diff --git a/client/packages/lowcoder-comps/jest.config.js b/client/packages/lowcoder-comps/jest.config.js index ffc92e51c..89a76bd41 100644 --- a/client/packages/lowcoder-comps/jest.config.js +++ b/client/packages/lowcoder-comps/jest.config.js @@ -2,4 +2,5 @@ import config from "../../config/test/jest.config.js"; export default { ...config, + setupFiles: [...config.setupFiles, 'jest-canvas-mock'], }; diff --git a/client/packages/lowcoder-comps/package.json b/client/packages/lowcoder-comps/package.json index 9af9f74c4..75176169c 100644 --- a/client/packages/lowcoder-comps/package.json +++ b/client/packages/lowcoder-comps/package.json @@ -69,6 +69,7 @@ }, "devDependencies": { "jest": "29.3.0", + "jest-canvas-mock": "^2.5.2", "vite": "^4.3.9", "vite-tsconfig-paths": "^3.6.0" } diff --git a/client/packages/lowcoder-comps/package/icons/icon-chart.svg b/client/packages/lowcoder-comps/package/icons/icon-chart.svg new file mode 100644 index 000000000..459da3127 --- /dev/null +++ b/client/packages/lowcoder-comps/package/icons/icon-chart.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/client/packages/lowcoder-comps/package/icons/icon-comp-calendar.svg b/client/packages/lowcoder-comps/package/icons/icon-comp-calendar.svg new file mode 100644 index 000000000..9845fb266 --- /dev/null +++ b/client/packages/lowcoder-comps/package/icons/icon-comp-calendar.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/packages/lowcoder-comps/package/index.js b/client/packages/lowcoder-comps/package/index.js new file mode 100644 index 000000000..e615e8307 --- /dev/null +++ b/client/packages/lowcoder-comps/package/index.js @@ -0,0 +1,107669 @@ +(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.id="lowcoder-comps-0.0.14",e.appendChild(document.createTextNode("")),document.head.appendChild(e)}}catch(c){console.error("vite-plugin-css-injected-by-js",c)}})(); +var c9 = Object.defineProperty, h9 = Object.defineProperties; +var f9 = Object.getOwnPropertyDescriptors; +var sD = Object.getOwnPropertySymbols; +var d9 = Object.prototype.hasOwnProperty, v9 = Object.prototype.propertyIsEnumerable; +var lD = (r, e, t) => e in r ? c9(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, sn = (r, e) => { + for (var t in e || (e = {})) + d9.call(e, t) && lD(r, t, e[t]); + if (sD) + for (var t of sD(e)) + v9.call(e, t) && lD(r, t, e[t]); + return r; +}, Za = (r, e) => h9(r, f9(e)); +var uD = (r, e, t) => new Promise((n, i) => { + var a = (l) => { + try { + s(t.next(l)); + } catch (u) { + i(u); + } + }, o = (l) => { + try { + s(t.throw(l)); + } catch (u) { + i(u); + } + }, s = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(a, o); + s((t = t.apply(r, e)).next()); +}); +var WC = function(r, e) { + return WC = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) { + t.__proto__ = n; + } || function(t, n) { + for (var i in n) + Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); + }, WC(r, e); +}; +function Ji(r, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); + WC(r, e); + function t() { + this.constructor = r; + } + r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); +} +var sr = function() { + return sr = Object.assign || function(e) { + for (var t, n = 1, i = arguments.length; n < i; n++) { + t = arguments[n]; + for (var a in t) + Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]); + } + return e; + }, sr.apply(this, arguments); +}; +function Gi(r, e, t, n) { + var i = arguments.length, a = i < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, o; + if (typeof Reflect == "object" && typeof Reflect.decorate == "function") + a = Reflect.decorate(r, e, t, n); + else + for (var s = r.length - 1; s >= 0; s--) + (o = r[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(e, t, a) : o(e, t)) || a); + return i > 3 && a && Object.defineProperty(e, t, a), a; +} +function eo(r, e, t) { + if (t || arguments.length === 2) + for (var n = 0, i = e.length, a; n < i; n++) + (a || !(n in e)) && (a || (a = Array.prototype.slice.call(e, 0, n)), a[n] = e[n]); + return r.concat(a || Array.prototype.slice.call(e)); +} +function p9(r, e, t) { + return e ? r.length === 0 && e.length === 0 ? !0 : r.length === e.length && e.every(function(n, i) { + var a, o; + return (o = (a = t == null ? void 0 : t[i]) === null || a === void 0 ? void 0 : a.call(t, n, r[i])) !== null && o !== void 0 ? o : n === r[i]; + }) : !1; +} +function g9(r, e, t, n) { + var i, a = (i = r == null ? void 0 : r.__cache) === null || i === void 0 ? void 0 : i[e]; + if (a && p9(t, a.args, n)) + return a.result; +} +function m9(r, e, t, n, i) { + var a = g9(t, n, e, i); + if (a) + return a.value; + var o = { + id: Symbol("id"), + args: e, + time: Date.now() + }; + t.__cache || (t.__cache = {}), t.__cache[n] = o; + var s = r.apply(t, e); + return o.result = { value: s }, s; +} +function va(r) { + return function(e, t, n) { + var i = n.value; + return n.value = function() { + for (var a = [], o = 0; o < arguments.length; o++) + a[o] = arguments[o]; + return m9(i, a, this, t, r); + }, n; + }; +} +var y9 = 0, _9 = ( + /** @class */ + function() { + function r() { + var e = this; + this.root = Symbol("root"), this.stack = [], this.initRecord = function() { + return { obj: e.root, name: "@root", childrenPerfInfo: [], costMs: 0, depth: 0, info: {} }; + }, this.getRecordByStack = function(t) { + var n = e.record; + return (t != null ? t : e.stack).forEach(function(i) { + n = n.childrenPerfInfo[i]; + }), n; + }, this.clear = function() { + e.record = e.initRecord(); + }, this.print = function(t, n) { + n === void 0 && (n = y9); + var i = e.getRecordByStack(t); + console.info("~~ PerfInfo. costMs: ".concat(i.costMs.toFixed(3), ", stack: ").concat(t, ", [name]").concat(i.name, ", [info]"), i.info, ", obj: ", i.obj, ", depth: ".concat(i.depth, ", size: ").concat($lodash.size(i.childrenPerfInfo))), i.childrenPerfInfo.forEach(function(a, o) { + a.costMs >= n && console.info(" costMs: ".concat(a.costMs.toFixed(3), " [").concat(o, "]").concat(a.name, " [info]"), a.info, ". obj: ", a.obj, ""); + }); + }, this.record = this.initRecord(); + } + return r.prototype.log = function(e, t, n) { + e[t] = n; + }, r.prototype.perf = function(e, t, n) { + return n($lodash.noop); + }, r; + }() +), Md = new _9(); +globalThis.evalPerfUtil = Md; +var Cl = ( + /** @class */ + function() { + function r() { + this.type = "abstract", this.evalCache = {}; + } + return r.prototype.evaluate = function(e, t) { + var n = this; + return Md.perf(this, "eval", function() { + e = e != null ? e : {}; + var i = n.filterNodes(e); + if (hD(n.evalCache.dependingNodeMap, i)) + return n.evalCache.value; + n.evalCache.cyclic = !1; + var a = n.justEval(e, t); + return n.evalCache.dependingNodeMap = i, n.evalCache.value = a, n.evalCache.cyclic || (n.evalCache.cyclic = n.getChildren().some(function(o) { + return o.hasCycle(); + })), a; + }); + }, r.prototype.hasCycle = function() { + var e; + return (e = this.evalCache.cyclic) !== null && e !== void 0 ? e : !1; + }, r.prototype.dependNames = function() { + return Object.keys(this.dependValues()); + }, r.prototype.isHitEvalCache = function(e) { + e = e != null ? e : {}; + var t = this.filterNodes(e); + return hD(this.evalCache.dependingNodeMap, t); + }, r; + }() +); +function cD(r) { + var e = /* @__PURE__ */ new Map(); + return r.forEach(function(t, n) { + n.type === "wrap" ? e.set(n.delegate, t) : e.set(n, t); + }), e; +} +function b9(r, e) { + return e !== void 0 && r.size === e.size && Array.from(e).every(function(t) { + return r.has(t); + }); +} +function hD(r, e) { + if (!r || r.size !== e.size) + return !1; + var t = cD(r), n = cD(e), i = !0; + return n.forEach(function(a, o) { + i = i && b9(a, t.get(o)); + }), i; +} +var x9 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n) { + var i = r.call(this) || this; + return i.child = t, i.func = n, i.type = "function", i; + } + return e.prototype.filterNodes = function(t) { + var n = this; + return Md.perf(this, "filterNodes", function() { + return n.child.filterNodes(t); + }); + }, e.prototype.justEval = function(t, n) { + return this.func(this.child.evaluate(t, n)); + }, e.prototype.getChildren = function() { + return [this.child]; + }, e.prototype.dependValues = function() { + return this.child.dependValues(); + }, e.prototype.fetchInfo = function(t, n) { + return this.child.fetchInfo(t, n); + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "fetchInfo", null), e; + }(Cl) +); +function Kz(r, e) { + return new x9(r, e); +} +function hI(r, e, t) { + if (e) { + var n = r.get(e); + n === void 0 && (n = /* @__PURE__ */ new Set(), r.set(e, n)), t.forEach(function(i) { + return n == null ? void 0 : n.add(i); + }); + } +} +function t_(r, e) { + return e == null || e.forEach(function(t, n) { + return hI(r, n, t); + }), r; +} +var S9 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t) { + var n = r.call(this) || this; + return n.children = t, n.type = "record", n; + } + return e.prototype.filterNodes = function(t) { + var n = this; + return Md.perf(this, "filterNodes", function() { + var i = /* @__PURE__ */ new Map(); + return Object.values(n.children).forEach(function(a) { + t_(i, a.filterNodes(t)); + }), i; + }); + }, e.prototype.justEval = function(t, n) { + var i = this; + return $lodash.mapValues(this.children, function(a, o) { + return Md.perf(i, "eval-".concat(o), function() { + return a.evaluate(t, n); + }); + }); + }, e.prototype.getChildren = function() { + return Object.values(this.children); + }, e.prototype.dependValues = function() { + var t = Object.values(this.children); + if (t.length === 1) + return t[0].dependValues(); + var n = {}; + return t.forEach(function(i) { + Object.entries(i.dependValues()).forEach(function(a) { + var o = a[0], s = a[1]; + n[o] = s; + }); + }), n; + }, e.prototype.fetchInfo = function(t, n) { + var i = !1, a = !0; + return Object.entries(this.children).forEach(function(o) { + o[0]; + var s = o[1], l = s.fetchInfo(t, n); + i = l.isFetching || i, a = l.ready && a; + }), { isFetching: i, ready: a }; + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "fetchInfo", null), e; + }(Cl) +); +function mb(r) { + return new S9(r); +} +(function(r) { + Ji(e, r); + function e(t) { + var n = r.call(this) || this; + return n.type = "cached", n.child = w9(t), n; + } + return e.prototype.filterNodes = function(t) { + return this.child.filterNodes(t); + }, e.prototype.justEval = function(t, n) { + var i = this.child.isHitEvalCache(t), a = this.child.evaluate(t, n); + return { value: a, isCached: i }; + }, e.prototype.getChildren = function() { + return [this.child]; + }, e.prototype.dependValues = function() { + return this.child.dependValues(); + }, e.prototype.fetchInfo = function(t) { + return this.child.fetchInfo(t); + }, Gi([ + va() + ], e.prototype, "filterNodes", null), e; +})(Cl); +function w9(r) { + var e = Kz(r, function(t) { + return t; + }); + return e.evalCache = sr({}, r.evalCache), e; +} +function C9(r) { + return r instanceof RegExp ? r.toString() : r === void 0 || typeof r == "number" ? r + "" : typeof r == "string" ? '"' + r + '"' : JSON.stringify(r, function(e, t) { + switch (typeof t) { + case "function": + case "bigint": + case "symbol": + case "undefined": + return t + ""; + case "number": + if (!isFinite(t)) + return t + ""; + } + return t; + }); +} +var _l = ( + /** @class */ + function() { + function r(e, t, n, i) { + this.value = e, this.msg = t, this.extra = n, this.midValue = i; + } + return r.prototype.hasError = function() { + return this.msg !== void 0; + }, r.prototype.getMsg = function(e) { + var t; + return e === void 0 && (e = C9), (t = this.hasError() ? this.msg : e(this.value)) !== null && t !== void 0 ? t : ""; + }, r; + }() +); +function T9(r) { + return 'DependencyError: "'.concat(r.unevaledValue, '" caused a cyclic dependency.'); +} +function fI(r) { + return r instanceof TypeError && r.hint ? r.hint + ` +` + r.name + ": " + r.message : r instanceof Error ? r.name + ": " + r.message : "UnknownError: unknown exception during eval"; +} +function I9(r) { + var e = {}; + return r.forEach(function(t, n) { + t.forEach(function(i) { + var a = i.split("."), o = Qz(a, n), s = a[0], l = qz(e[s], o); + e[s] = l; + }); + }), e; +} +function Qz(r, e) { + var t; + if (r.length <= 0) + throw new Error("path length should not be 0"); + return r.length === 1 ? e : Qz(r.slice(0, -1), mb((t = {}, t[r[r.length - 1]] = e, t))); +} +function qz(r, e) { + if (!r || r === e) + return e; + if (!r_(r) || !r_(e)) + throw new Error("unevaledNode should be type of RecordNode"); + var t = r.children, n = e.children, i = sr({}, t); + return Object.keys(n).forEach(function(a) { + var o = t[a], s = n[a], l = o ? qz(o, s) : s; + i[a] = l; + }), mb(i); +} +function r_(r) { + return r.type === "record"; +} +var A9 = /{{([\s\S]*?)}}/; +function ng(r) { + return A9.test(r); +} +function eB(r) { + for (var e = [], t = 0, n = r.indexOf("{{"); n >= 0; ) { + for (var i = n + 2; i < r.length && r[i] === "{"; ) + i++; + var a = r.indexOf("}}", i); + if (a < 0) + break; + for (var o = r.indexOf("{{", a + 2), s = o >= 0 ? o : r.length, l = i - n - 2, u = i - n, c = Number.MAX_VALUE, h = Number.MAX_VALUE; i < s; i++) + switch (r[i]) { + case "{": + u++; + break; + case "}": + if (u--, r[i - 1] === "}") { + var f = Math.min(Math.max(u, 0), l), v = Math.abs(u - f); + (v < c || v === c && f < h) && (c = v, h = f, a = i + 1); + } + break; + } + e.push(r.slice(t, n + h), r.slice(n + h, a)), t = a, n = o; + } + return e.push(r.slice(t)), e.filter(function(b) { + return b; + }); +} +function Yx(r, e, t) { + for (var n = /* @__PURE__ */ new Map(), i = 0, a = eB(r); i < a.length; i++) { + var o = a[i]; + ng(o) && t_(n, rB(o.slice(2, -2), e, t)); + } + return n; +} +function E9(r, e) { + if (!ng(r)) + return !1; + var t = !1; + return rB(r.slice(2, -2), e).forEach(function(n, i) { + t = t || i.hasCycle(); + }), t; +} +function tB(r) { + var e = [], t = /[a-zA-Z_$][a-zA-Z_$0-9.[\]]*/g, n = r.match(t); + n && e.push.apply(e, n); + var i = []; + return (r.match(/\[[a-zA-Z_][a-zA-Z_0-9\[\].]*\]/g) || []).forEach(function(a) { + i.push.apply(i, tB(a.slice(1, -1))); + }), e.push.apply(e, i), e.length === 0 ? [r] : e; +} +function rB(r, e, t) { + var n = /* @__PURE__ */ new Map(), i = tB(r); + return i.forEach(function(a) { + var o = $lodash.toPath(a), s = M9(t ? o.slice(0, t) : o, e); + s && hI(n, s[0], [s[1]]); + }), n; +} +function M9(r, e) { + if (!(r.length <= 0)) { + for (var t = e, n = void 0, i = [], a = 0, o = r; a < o.length; a++) { + var s = o[a], l = t[s]; + if (!t.hasOwnProperty(s) || !l || (n = l, i.push(s), !r_(n))) + break; + t = n.children; + } + return n ? [n, i.join(".")] : void 0; + } +} +var nB = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, iB = { exports: {} }; +(function(r) { + (function(e, t) { + r.exports ? r.exports = t() : e.log = t(); + })(nB, function() { + var e = function() { + }, t = "undefined", n = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), i = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function a(w, p) { + var d = w[p]; + if (typeof d.bind == "function") + return d.bind(w); + try { + return Function.prototype.bind.call(d, w); + } catch (m) { + return function() { + return Function.prototype.apply.apply(d, [w, arguments]); + }; + } + } + function o() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function s(w) { + return w === "debug" && (w = "log"), typeof console === t ? !1 : w === "trace" && n ? o : console[w] !== void 0 ? a(console, w) : console.log !== void 0 ? a(console, "log") : e; + } + function l(w, p) { + for (var d = 0; d < i.length; d++) { + var m = i[d]; + this[m] = d < w ? e : this.methodFactory(m, w, p); + } + this.log = this.debug; + } + function u(w, p, d) { + return function() { + typeof console !== t && (l.call(this, p, d), this[w].apply(this, arguments)); + }; + } + function c(w, p, d) { + return s(w) || u.apply(this, arguments); + } + function h(w, p, d) { + var m = this, _; + p = p == null ? "WARN" : p; + var y = "loglevel"; + typeof w == "string" ? y += ":" + w : typeof w == "symbol" && (y = void 0); + function x(C) { + var E = (i[C] || "silent").toUpperCase(); + if (!(typeof window === t || !y)) { + try { + window.localStorage[y] = E; + return; + } catch (M) { + } + try { + window.document.cookie = encodeURIComponent(y) + "=" + E + ";"; + } catch (M) { + } + } + } + function g() { + var C; + if (!(typeof window === t || !y)) { + try { + C = window.localStorage[y]; + } catch (P) { + } + if (typeof C === t) + try { + var E = window.document.cookie, M = E.indexOf( + encodeURIComponent(y) + "=" + ); + M !== -1 && (C = /^([^;]+)/.exec(E.slice(M))[1]); + } catch (P) { + } + return m.levels[C] === void 0 && (C = void 0), C; + } + } + function S() { + if (!(typeof window === t || !y)) { + try { + window.localStorage.removeItem(y); + return; + } catch (C) { + } + try { + window.document.cookie = encodeURIComponent(y) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch (C) { + } + } + } + m.name = w, m.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, m.methodFactory = d || c, m.getLevel = function() { + return _; + }, m.setLevel = function(C, E) { + if (typeof C == "string" && m.levels[C.toUpperCase()] !== void 0 && (C = m.levels[C.toUpperCase()]), typeof C == "number" && C >= 0 && C <= m.levels.SILENT) { + if (_ = C, E !== !1 && x(C), l.call(m, C, w), typeof console === t && C < m.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + C; + }, m.setDefaultLevel = function(C) { + p = C, g() || m.setLevel(C, !1); + }, m.resetLevel = function() { + m.setLevel(p, !1), S(); + }, m.enableAll = function(C) { + m.setLevel(m.levels.TRACE, C); + }, m.disableAll = function(C) { + m.setLevel(m.levels.SILENT, C); + }; + var T = g(); + T == null && (T = p), m.setLevel(T, !1); + } + var f = new h(), v = {}; + f.getLogger = function(p) { + if (typeof p != "symbol" && typeof p != "string" || p === "") + throw new TypeError("You must supply a name when creating a logger."); + var d = v[p]; + return d || (d = v[p] = new h( + p, + f.getLevel(), + f.methodFactory + )), d; + }; + var b = typeof window !== t ? window.log : void 0; + return f.noConflict = function() { + return typeof window !== t && window.log === f && (window.log = b), f; + }, f.getLoggers = function() { + return v; + }, f.default = f, f; + }); +})(iB); +var yb = iB.exports, aB = /* @__PURE__ */ new Set([ + "top", + "parent", + "document", + "location", + "chrome", + "fetch", + "XMLHttpRequest", + "importScripts", + "Navigator", + "MutationObserver" +]), oB = new Set(eo(eo([], Array.from(aB.values()), !0), [ + "setTimeout", + "setInterval", + "setImmediate" +], !1)), YC = /* @__PURE__ */ new Set(["window", "globalThis", "self", "global"]); +function XC() { + return new Proxy(function() { + return XC(); + }, { + get: function(r, e, t) { + return e === "toString" ? function() { + return ""; + } : e === Symbol.toPrimitive ? function() { + return ""; + } : (yb.log("[Sandbox] access ".concat(String(e), " on black hole, return mock object")), XC()); + } + }); +} +function D9(r, e, t, n) { + e === void 0 && (e = oB); + var i = new Proxy(Object.assign({}, r), { + has: function() { + return !0; + }, + set: function(a, o, s) { + return typeof o == "string" && (t == null || t(o)), Reflect.set(a, o, s); + }, + get: function(a, o) { + return o in a ? Reflect.get(a, o) : YC.has(o) ? i : typeof o == "string" && (e != null && e.has(o)) && !n ? (yb.log("[Sandbox] access ".concat(String(o), " on mock window, return mock object")), XC()) : sB(o); + } + }); + return i; +} +var py, fD = !1; +function k9(r) { + return r instanceof Element || r instanceof HTMLCollection; +} +function sB(r) { + var e = Reflect.get(window, r); + if (typeof e == "function" && !e.prototype) + return e.bind(window); + if (!k9(e)) + return e; +} +function O9(r, e, t) { + var n = t || {}, i = n.disableLimit, a = i === void 0 ? !1 : i, o = n.scope, s = o === void 0 ? "expression" : o, l = n.onSetGlobalVars, u = function(f) { + return f in r || f in (e || {}) || YC.has(f); + }, c = {}, h = s === "function" ? aB : oB; + return (s === "function" || !py || a !== fD) && (py = D9(py, h, l, a)), fD = a, new Proxy(py, { + has: function(f, v) { + return !0; + }, + get: function(f, v, b) { + if (v !== Symbol.unscopables) { + if (v === "toJSON" || YC.has(v)) + return f; + if (v in r) { + if (v in c) + return Reflect.get(c, v); + var w = Reflect.get(r, v, b); + return typeof w == "object" && w !== null && (e && v in e && (w = Object.assign({}, w, Reflect.get(e, v))), Object.freeze(w), Object.values(w).forEach(Object.freeze)), Reflect.set(c, v, w), w; + } + return a ? sB(v) : Reflect.get(f, v, b); + } + }, + set: function(f, v, b, w) { + if (u(v)) + throw new Error(v.toString() + " can't be modified"); + return Reflect.set(f, v, b, w); + }, + defineProperty: function(f, v, b) { + if (u(v)) + throw new Error("can't define property:" + v.toString()); + return Reflect.defineProperty(f, v, b); + }, + deleteProperty: function(f, v) { + if (u(v)) + throw new Error("can't delete property:" + v.toString()); + return Reflect.deleteProperty(f, v); + }, + setPrototypeOf: function(f, v) { + throw new Error("can't invoke setPrototypeOf"); + } + }); +} +function lB(r, e, t) { + return uB("return (".concat(r, ` +);`), e, t); +} +function uB(r, e, t, n, i) { + var a = `with(this){ + return (`.concat(i ? "async " : "", `function() { + 'use strict'; + `).concat(r, `; + }).call(this); + }`), o = new Function(a), s = O9(e, t, n), l = o.call(s); + return l; +} +var cB = { exports: {} }, hB = { exports: {} }; +(function(r, e) { + (function(t, n) { + r.exports = n(); + })(nB, function() { + return t = { 421: function(i, a) { + var o, s; + (s = typeof (o = function(l) { + var u = l; + l.isBooleanArray = function(g) { + return (Array.isArray(g) || g instanceof Int8Array) && g.$type$ === "BooleanArray"; + }, l.isByteArray = function(g) { + return g instanceof Int8Array && g.$type$ !== "BooleanArray"; + }, l.isShortArray = function(g) { + return g instanceof Int16Array; + }, l.isCharArray = function(g) { + return g instanceof Uint16Array && g.$type$ === "CharArray"; + }, l.isIntArray = function(g) { + return g instanceof Int32Array; + }, l.isFloatArray = function(g) { + return g instanceof Float32Array; + }, l.isDoubleArray = function(g) { + return g instanceof Float64Array; + }, l.isLongArray = function(g) { + return Array.isArray(g) && g.$type$ === "LongArray"; + }, l.isArray = function(g) { + return Array.isArray(g) && !g.$type$; + }, l.isArrayish = function(g) { + return Array.isArray(g) || ArrayBuffer.isView(g); + }, l.arrayToString = function(g) { + if (g === null) + return "null"; + var S = l.isCharArray(g) ? String.fromCharCode : l.toString; + return "[" + Array.prototype.map.call(g, function(T) { + return S(T); + }).join(", ") + "]"; + }, l.toByte = function(g) { + return (255 & g) << 24 >> 24; + }, l.toChar = function(g) { + return 65535 & g; + }, l.toBoxedChar = function(g) { + return g == null || g instanceof l.BoxedChar ? g : new l.BoxedChar(g); + }, l.unboxChar = function(g) { + return g == null ? g : l.toChar(g); + }, l.equals = function(g, S) { + return g == null ? S == null : S != null && (g != g ? S != S : typeof g == "object" && typeof g.equals == "function" ? g.equals(S) : typeof g == "number" && typeof S == "number" ? g === S && (g !== 0 || 1 / g == 1 / S) : g === S); + }, l.hashCode = function(g) { + if (g == null) + return 0; + var S = typeof g; + return S === "object" ? typeof g.hashCode == "function" ? g.hashCode() : m(g) : S === "function" ? m(g) : S === "number" ? l.numberHashCode(g) : S === "boolean" ? Number(g) : function(T) { + for (var C = 0, E = 0; E < T.length; E++) + C = 31 * C + T.charCodeAt(E) | 0; + return C; + }(String(g)); + }, l.toString = function(g) { + return g == null ? "null" : l.isArrayish(g) ? "[...]" : g.toString(); + }; + var c, h, f, v, b, w, p, d = "kotlinHashCodeValue$"; + function m(g) { + if (!(d in g)) { + var S = 4294967296 * Math.random() | 0; + Object.defineProperty(g, d, { value: S, enumerable: !1 }); + } + return g.kotlinHashCodeValue$; + } + function _() { + throw new Error("This marker function should never been called. Looks like compiler did not eliminate it properly. Please, report an issue if you caught this exception."); + } + function y(g, S) { + return (4294901760 & g) * (65535 & S) + (65535 & g) * (0 | S) | 0; + } + function x(g, S) { + if (g === S) + return !0; + var T = g.$metadata$; + if (T != null) { + for (var C = T.interfaces, E = 0; E < C.length; E++) + if (x(C[E], S)) + return !0; + } + var M = g.prototype != null ? Object.getPrototypeOf(g.prototype) : null, P = M != null ? M.constructor : null; + return P != null && x(P, S); + } + l.identityHashCode = m, l.Long = function(g, S) { + this.low_ = 0 | g, this.high_ = 0 | S; + }, l.Long.$metadata$ = { kind: "class", simpleName: "Long", interfaces: [] }, l.Long.IntCache_ = {}, l.Long.fromInt = function(g) { + if (-128 <= g && g < 128) { + var S = l.Long.IntCache_[g]; + if (S) + return S; + } + var T = new l.Long(0 | g, g < 0 ? -1 : 0); + return -128 <= g && g < 128 && (l.Long.IntCache_[g] = T), T; + }, l.Long.fromNumber = function(g) { + return isNaN(g) ? l.Long.ZERO : g <= -l.Long.TWO_PWR_63_DBL_ ? l.Long.MIN_VALUE : g + 1 >= l.Long.TWO_PWR_63_DBL_ ? l.Long.MAX_VALUE : g < 0 ? l.Long.fromNumber(-g).negate() : new l.Long(g % l.Long.TWO_PWR_32_DBL_ | 0, g / l.Long.TWO_PWR_32_DBL_ | 0); + }, l.Long.fromBits = function(g, S) { + return new l.Long(g, S); + }, l.Long.fromString = function(g, S) { + if (g.length == 0) + throw Error("number format error: empty string"); + var T = S || 10; + if (T < 2 || 36 < T) + throw Error("radix out of range: " + T); + if (g.charAt(0) == "-") + return l.Long.fromString(g.substring(1), T).negate(); + if (g.indexOf("-") >= 0) + throw Error('number format error: interior "-" character: ' + g); + for (var C = l.Long.fromNumber(Math.pow(T, 8)), E = l.Long.ZERO, M = 0; M < g.length; M += 8) { + var P = Math.min(8, g.length - M), R = parseInt(g.substring(M, M + P), T); + if (P < 8) { + var N = l.Long.fromNumber(Math.pow(T, P)); + E = E.multiply(N).add(l.Long.fromNumber(R)); + } else + E = (E = E.multiply(C)).add(l.Long.fromNumber(R)); + } + return E; + }, l.Long.TWO_PWR_16_DBL_ = 65536, l.Long.TWO_PWR_24_DBL_ = 1 << 24, l.Long.TWO_PWR_32_DBL_ = l.Long.TWO_PWR_16_DBL_ * l.Long.TWO_PWR_16_DBL_, l.Long.TWO_PWR_31_DBL_ = l.Long.TWO_PWR_32_DBL_ / 2, l.Long.TWO_PWR_48_DBL_ = l.Long.TWO_PWR_32_DBL_ * l.Long.TWO_PWR_16_DBL_, l.Long.TWO_PWR_64_DBL_ = l.Long.TWO_PWR_32_DBL_ * l.Long.TWO_PWR_32_DBL_, l.Long.TWO_PWR_63_DBL_ = l.Long.TWO_PWR_64_DBL_ / 2, l.Long.ZERO = l.Long.fromInt(0), l.Long.ONE = l.Long.fromInt(1), l.Long.NEG_ONE = l.Long.fromInt(-1), l.Long.MAX_VALUE = l.Long.fromBits(-1, 2147483647), l.Long.MIN_VALUE = l.Long.fromBits(0, -2147483648), l.Long.TWO_PWR_24_ = l.Long.fromInt(1 << 24), l.Long.prototype.toInt = function() { + return this.low_; + }, l.Long.prototype.toNumber = function() { + return this.high_ * l.Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned(); + }, l.Long.prototype.hashCode = function() { + return this.high_ ^ this.low_; + }, l.Long.prototype.toString = function(g) { + var S = g || 10; + if (S < 2 || 36 < S) + throw Error("radix out of range: " + S); + if (this.isZero()) + return "0"; + if (this.isNegative()) { + if (this.equalsLong(l.Long.MIN_VALUE)) { + var T = l.Long.fromNumber(S), C = this.div(T), E = C.multiply(T).subtract(this); + return C.toString(S) + E.toInt().toString(S); + } + return "-" + this.negate().toString(S); + } + for (var M = l.Long.fromNumber(Math.pow(S, 6)), P = (E = this, ""); ; ) { + var R = E.div(M), N = E.subtract(R.multiply(M)).toInt().toString(S); + if ((E = R).isZero()) + return N + P; + for (; N.length < 6; ) + N = "0" + N; + P = "" + N + P; + } + }, l.Long.prototype.getHighBits = function() { + return this.high_; + }, l.Long.prototype.getLowBits = function() { + return this.low_; + }, l.Long.prototype.getLowBitsUnsigned = function() { + return this.low_ >= 0 ? this.low_ : l.Long.TWO_PWR_32_DBL_ + this.low_; + }, l.Long.prototype.getNumBitsAbs = function() { + if (this.isNegative()) + return this.equalsLong(l.Long.MIN_VALUE) ? 64 : this.negate().getNumBitsAbs(); + for (var g = this.high_ != 0 ? this.high_ : this.low_, S = 31; S > 0 && !(g & 1 << S); S--) + ; + return this.high_ != 0 ? S + 33 : S + 1; + }, l.Long.prototype.isZero = function() { + return this.high_ == 0 && this.low_ == 0; + }, l.Long.prototype.isNegative = function() { + return this.high_ < 0; + }, l.Long.prototype.isOdd = function() { + return (1 & this.low_) == 1; + }, l.Long.prototype.equalsLong = function(g) { + return this.high_ == g.high_ && this.low_ == g.low_; + }, l.Long.prototype.notEqualsLong = function(g) { + return this.high_ != g.high_ || this.low_ != g.low_; + }, l.Long.prototype.lessThan = function(g) { + return this.compare(g) < 0; + }, l.Long.prototype.lessThanOrEqual = function(g) { + return this.compare(g) <= 0; + }, l.Long.prototype.greaterThan = function(g) { + return this.compare(g) > 0; + }, l.Long.prototype.greaterThanOrEqual = function(g) { + return this.compare(g) >= 0; + }, l.Long.prototype.compare = function(g) { + if (this.equalsLong(g)) + return 0; + var S = this.isNegative(), T = g.isNegative(); + return S && !T ? -1 : !S && T ? 1 : this.subtract(g).isNegative() ? -1 : 1; + }, l.Long.prototype.negate = function() { + return this.equalsLong(l.Long.MIN_VALUE) ? l.Long.MIN_VALUE : this.not().add(l.Long.ONE); + }, l.Long.prototype.add = function(g) { + var S = this.high_ >>> 16, T = 65535 & this.high_, C = this.low_ >>> 16, E = 65535 & this.low_, M = g.high_ >>> 16, P = 65535 & g.high_, R = g.low_ >>> 16, N = 0, F = 0, U = 0, $ = 0; + return U += ($ += E + (65535 & g.low_)) >>> 16, $ &= 65535, F += (U += C + R) >>> 16, U &= 65535, N += (F += T + P) >>> 16, F &= 65535, N += S + M, N &= 65535, l.Long.fromBits(U << 16 | $, N << 16 | F); + }, l.Long.prototype.subtract = function(g) { + return this.add(g.negate()); + }, l.Long.prototype.multiply = function(g) { + if (this.isZero() || g.isZero()) + return l.Long.ZERO; + if (this.equalsLong(l.Long.MIN_VALUE)) + return g.isOdd() ? l.Long.MIN_VALUE : l.Long.ZERO; + if (g.equalsLong(l.Long.MIN_VALUE)) + return this.isOdd() ? l.Long.MIN_VALUE : l.Long.ZERO; + if (this.isNegative()) + return g.isNegative() ? this.negate().multiply(g.negate()) : this.negate().multiply(g).negate(); + if (g.isNegative()) + return this.multiply(g.negate()).negate(); + if (this.lessThan(l.Long.TWO_PWR_24_) && g.lessThan(l.Long.TWO_PWR_24_)) + return l.Long.fromNumber(this.toNumber() * g.toNumber()); + var S = this.high_ >>> 16, T = 65535 & this.high_, C = this.low_ >>> 16, E = 65535 & this.low_, M = g.high_ >>> 16, P = 65535 & g.high_, R = g.low_ >>> 16, N = 65535 & g.low_, F = 0, U = 0, $ = 0, G = 0; + return $ += (G += E * N) >>> 16, G &= 65535, U += ($ += C * N) >>> 16, $ &= 65535, U += ($ += E * R) >>> 16, $ &= 65535, F += (U += T * N) >>> 16, U &= 65535, F += (U += C * R) >>> 16, U &= 65535, F += (U += E * P) >>> 16, U &= 65535, F += S * N + T * R + C * P + E * M, F &= 65535, l.Long.fromBits($ << 16 | G, F << 16 | U); + }, l.Long.prototype.div = function(g) { + if (g.isZero()) + throw Error("division by zero"); + if (this.isZero()) + return l.Long.ZERO; + if (this.equalsLong(l.Long.MIN_VALUE)) { + if (g.equalsLong(l.Long.ONE) || g.equalsLong(l.Long.NEG_ONE)) + return l.Long.MIN_VALUE; + if (g.equalsLong(l.Long.MIN_VALUE)) + return l.Long.ONE; + if ((C = this.shiftRight(1).div(g).shiftLeft(1)).equalsLong(l.Long.ZERO)) + return g.isNegative() ? l.Long.ONE : l.Long.NEG_ONE; + var S = this.subtract(g.multiply(C)); + return C.add(S.div(g)); + } + if (g.equalsLong(l.Long.MIN_VALUE)) + return l.Long.ZERO; + if (this.isNegative()) + return g.isNegative() ? this.negate().div(g.negate()) : this.negate().div(g).negate(); + if (g.isNegative()) + return this.div(g.negate()).negate(); + var T = l.Long.ZERO; + for (S = this; S.greaterThanOrEqual(g); ) { + for (var C = Math.max(1, Math.floor(S.toNumber() / g.toNumber())), E = Math.ceil(Math.log(C) / Math.LN2), M = E <= 48 ? 1 : Math.pow(2, E - 48), P = l.Long.fromNumber(C), R = P.multiply(g); R.isNegative() || R.greaterThan(S); ) + C -= M, R = (P = l.Long.fromNumber(C)).multiply(g); + P.isZero() && (P = l.Long.ONE), T = T.add(P), S = S.subtract(R); + } + return T; + }, l.Long.prototype.modulo = function(g) { + return this.subtract(this.div(g).multiply(g)); + }, l.Long.prototype.not = function() { + return l.Long.fromBits(~this.low_, ~this.high_); + }, l.Long.prototype.and = function(g) { + return l.Long.fromBits(this.low_ & g.low_, this.high_ & g.high_); + }, l.Long.prototype.or = function(g) { + return l.Long.fromBits(this.low_ | g.low_, this.high_ | g.high_); + }, l.Long.prototype.xor = function(g) { + return l.Long.fromBits(this.low_ ^ g.low_, this.high_ ^ g.high_); + }, l.Long.prototype.shiftLeft = function(g) { + if ((g &= 63) == 0) + return this; + var S = this.low_; + if (g < 32) { + var T = this.high_; + return l.Long.fromBits(S << g, T << g | S >>> 32 - g); + } + return l.Long.fromBits(0, S << g - 32); + }, l.Long.prototype.shiftRight = function(g) { + if ((g &= 63) == 0) + return this; + var S = this.high_; + if (g < 32) { + var T = this.low_; + return l.Long.fromBits(T >>> g | S << 32 - g, S >> g); + } + return l.Long.fromBits(S >> g - 32, S >= 0 ? 0 : -1); + }, l.Long.prototype.shiftRightUnsigned = function(g) { + if ((g &= 63) == 0) + return this; + var S = this.high_; + if (g < 32) { + var T = this.low_; + return l.Long.fromBits(T >>> g | S << 32 - g, S >>> g); + } + return g == 32 ? l.Long.fromBits(S, 0) : l.Long.fromBits(S >>> g - 32, 0); + }, l.Long.prototype.equals = function(g) { + return g instanceof l.Long && this.equalsLong(g); + }, l.Long.prototype.compareTo_11rb$ = l.Long.prototype.compare, l.Long.prototype.inc = function() { + return this.add(l.Long.ONE); + }, l.Long.prototype.dec = function() { + return this.add(l.Long.NEG_ONE); + }, l.Long.prototype.valueOf = function() { + return this.toNumber(); + }, l.Long.prototype.unaryPlus = function() { + return this; + }, l.Long.prototype.unaryMinus = l.Long.prototype.negate, l.Long.prototype.inv = l.Long.prototype.not, l.Long.prototype.rangeTo = function(g) { + return new l.kotlin.ranges.LongRange(this, g); + }, l.defineInlineFunction = function(g, S) { + return S; + }, l.wrapFunction = function(g) { + var S = function() { + return (S = g()).apply(this, arguments); + }; + return function() { + return S.apply(this, arguments); + }; + }, l.suspendCall = function(g) { + return g; + }, l.coroutineResult = function(g) { + _(); + }, l.coroutineReceiver = function(g) { + _(); + }, l.compareTo = function(g, S) { + var T = typeof g; + return T === "number" ? typeof S == "number" ? l.doubleCompareTo(g, S) : l.primitiveCompareTo(g, S) : T === "string" || T === "boolean" ? l.primitiveCompareTo(g, S) : g.compareTo_11rb$(S); + }, l.primitiveCompareTo = function(g, S) { + return g < S ? -1 : g > S ? 1 : 0; + }, l.doubleCompareTo = function(g, S) { + if (g < S) + return -1; + if (g > S) + return 1; + if (g === S) { + if (g !== 0) + return 0; + var T = 1 / g; + return T === 1 / S ? 0 : T < 0 ? -1 : 1; + } + return g != g ? S != S ? 0 : 1 : -1; + }, l.imul = Math.imul || y, l.imulEmulated = y, c = new ArrayBuffer(8), h = new Float64Array(c), f = new Int32Array(c), v = 0, b = 1, h[0] = -1, f[v] !== 0 && (v = 1, b = 0), l.numberHashCode = function(g) { + return (0 | g) === g ? 0 | g : (h[0] = g, (31 * f[b] | 0) + f[v] | 0); + }, l.ensureNotNull = function(g) { + return g != null ? g : l.throwNPE(); + }, String.prototype.startsWith === void 0 && Object.defineProperty(String.prototype, "startsWith", { value: function(g, S) { + return S = S || 0, this.lastIndexOf(g, S) === S; + } }), String.prototype.endsWith === void 0 && Object.defineProperty(String.prototype, "endsWith", { value: function(g, S) { + var T = this.toString(); + (S === void 0 || S > T.length) && (S = T.length), S -= g.length; + var C = T.indexOf(g, S); + return C !== -1 && C === S; + } }), Math.sign === void 0 && (Math.sign = function(g) { + return (g = +g) == 0 || isNaN(g) ? Number(g) : g > 0 ? 1 : -1; + }), Math.trunc === void 0 && (Math.trunc = function(g) { + return isNaN(g) ? NaN : g > 0 ? Math.floor(g) : Math.ceil(g); + }), function() { + var g = Math.sqrt(2220446049250313e-31), S = Math.sqrt(g), T = 1 / g, C = 1 / S; + if (Math.sinh === void 0 && (Math.sinh = function(M) { + if (Math.abs(M) < S) { + var P = M; + return Math.abs(M) > g && (P += M * M * M / 6), P; + } + var R = Math.exp(M), N = 1 / R; + return isFinite(R) ? isFinite(N) ? (R - N) / 2 : -Math.exp(-M - Math.LN2) : Math.exp(M - Math.LN2); + }), Math.cosh === void 0 && (Math.cosh = function(M) { + var P = Math.exp(M), R = 1 / P; + return isFinite(P) && isFinite(R) ? (P + R) / 2 : Math.exp(Math.abs(M) - Math.LN2); + }), Math.tanh === void 0 && (Math.tanh = function(M) { + if (Math.abs(M) < S) { + var P = M; + return Math.abs(M) > g && (P -= M * M * M / 3), P; + } + var R = Math.exp(+M), N = Math.exp(-M); + return R === 1 / 0 ? 1 : N === 1 / 0 ? -1 : (R - N) / (R + N); + }), Math.asinh === void 0) { + var E = function(M) { + if (M >= +S) + return M > C ? M > T ? Math.log(M) + Math.LN2 : Math.log(2 * M + 1 / (2 * M)) : Math.log(M + Math.sqrt(M * M + 1)); + if (M <= -S) + return -E(-M); + var P = M; + return Math.abs(M) >= g && (P -= M * M * M / 6), P; + }; + Math.asinh = E; + } + Math.acosh === void 0 && (Math.acosh = function(M) { + if (M < 1) + return NaN; + if (M - 1 >= S) + return M > T ? Math.log(M) + Math.LN2 : Math.log(M + Math.sqrt(M * M - 1)); + var P = Math.sqrt(M - 1), R = P; + return P >= g && (R -= P * P * P / 12), Math.sqrt(2) * R; + }), Math.atanh === void 0 && (Math.atanh = function(M) { + if (Math.abs(M) < S) { + var P = M; + return Math.abs(M) > g && (P += M * M * M / 3), P; + } + return Math.log((1 + M) / (1 - M)) / 2; + }), Math.log1p === void 0 && (Math.log1p = function(M) { + if (Math.abs(M) < S) { + var P = M * M, R = P * M; + return -R * M / 4 + R / 3 - P / 2 + M; + } + return Math.log(M + 1); + }), Math.expm1 === void 0 && (Math.expm1 = function(M) { + if (Math.abs(M) < S) { + var P = M * M, R = P * M; + return R * M / 24 + R / 6 + P / 2 + M; + } + return Math.exp(M) - 1; + }); + }(), Math.hypot === void 0 && (Math.hypot = function() { + for (var g = 0, S = arguments.length, T = 0; T < S; T++) { + if (arguments[T] === 1 / 0 || arguments[T] === -1 / 0) + return 1 / 0; + g += arguments[T] * arguments[T]; + } + return Math.sqrt(g); + }), Math.log10 === void 0 && (Math.log10 = function(g) { + return Math.log(g) * Math.LOG10E; + }), Math.log2 === void 0 && (Math.log2 = function(g) { + return Math.log(g) * Math.LOG2E; + }), Math.clz32 === void 0 && (Math.clz32 = (w = Math.log, p = Math.LN2, function(g) { + var S = g >>> 0; + return S === 0 ? 32 : 31 - (w(S) / p | 0) | 0; + })), ArrayBuffer.isView === void 0 && (ArrayBuffer.isView = function(g) { + return g != null && g.__proto__ != null && g.__proto__.__proto__ === Int8Array.prototype.__proto__; + }), Array.prototype.fill === void 0 && Object.defineProperty(Array.prototype, "fill", { value: function(g) { + if (this == null) + throw new TypeError("this is null or not defined"); + for (var S = Object(this), T = S.length >>> 0, C = arguments[1] >> 0, E = C < 0 ? Math.max(T + C, 0) : Math.min(C, T), M = arguments[2], P = M === void 0 ? T : M >> 0, R = P < 0 ? Math.max(T + P, 0) : Math.min(P, T); E < R; ) + S[E] = g, E++; + return S; + } }), function() { + function g(R, N) { + return R < 0 ? Math.max(0, R + N) : Math.min(R, N); + } + function S(R, N) { + return N === void 0 && (N = this.length), R = g(R || 0, this.length), N = Math.max(R, g(N, this.length)), new this.constructor(this.subarray(R, N)); + } + for (var T = [Int8Array, Int16Array, Uint16Array, Int32Array, Float32Array, Float64Array], C = 0; C < T.length; ++C) + (P = T[C]).prototype.fill === void 0 && Object.defineProperty(P.prototype, "fill", { value: Array.prototype.fill }), P.prototype.slice === void 0 && Object.defineProperty(P.prototype, "slice", { value: S }); + try { + (function() { + }).apply(null, new Int32Array(0)); + } catch (R) { + var E = Function.prototype.apply; + Object.defineProperty(Function.prototype, "apply", { value: function(N, F) { + return E.call(this, N, [].slice.call(F)); + } }); + } + for (C = 0; C < T.length; ++C) + (P = T[C]).prototype.map === void 0 && Object.defineProperty(P.prototype, "map", { value: function(R, N) { + return [].slice.call(this).map(R, N); + } }); + var M = function(R, N) { + if (R < N) + return -1; + if (R > N) + return 1; + if (R === N) { + if (R !== 0) + return 0; + var F = 1 / R; + return F === 1 / N ? 0 : F < 0 ? -1 : 1; + } + return R != R ? N != N ? 0 : 1 : -1; + }; + for (C = 0; C < T.length; ++C) { + var P; + (P = T[C]).prototype.sort === void 0 && Object.defineProperty(P.prototype, "sort", { value: function(R) { + return Array.prototype.sort.call(this, R || M); + } }); + } + }(), l.Kind = { CLASS: "class", INTERFACE: "interface", OBJECT: "object" }, l.isType = function(g, S) { + if (S === Object) + switch (typeof g) { + case "string": + case "number": + case "boolean": + case "function": + return !0; + default: + return g instanceof Object; + } + if (g == null || S == null || typeof g != "object" && typeof g != "function") + return !1; + if (typeof S == "function" && g instanceof S) + return !0; + var T = Object.getPrototypeOf(S), C = T != null ? T.constructor : null; + if (C != null && "$metadata$" in C && C.$metadata$.kind === l.Kind.OBJECT) + return g === S; + var E = S.$metadata$; + return E == null ? g instanceof S : E.kind === l.Kind.INTERFACE && g.constructor != null && x(g.constructor, S); + }, l.isNumber = function(g) { + return typeof g == "number" || g instanceof l.Long; + }, l.isChar = function(g) { + return g instanceof l.BoxedChar; + }, l.isCharSequence = function(g) { + return typeof g == "string" || l.isType(g, l.kotlin.CharSequence); + }, function() { + var g = l.Kind.INTERFACE, S = l.Kind.OBJECT, T = l.Kind.CLASS, C = (l.defineInlineFunction, l.wrapFunction, l.equals); + function E() { + } + function M() { + N(), this.name$ = "", this.ordinal$ = 0; + } + function P() { + R = this; + } + l.Long.ZERO, E.$metadata$ = { kind: g, simpleName: "Comparable", interfaces: [] }, Object.defineProperty(M.prototype, "name", { configurable: !0, get: function() { + return this.name$; + } }), Object.defineProperty(M.prototype, "ordinal", { configurable: !0, get: function() { + return this.ordinal$; + } }), M.prototype.compareTo_11rb$ = function(se) { + return l.primitiveCompareTo(this.ordinal, se.ordinal); + }, M.prototype.equals = function(se) { + return this === se; + }, M.prototype.hashCode = function() { + return l.identityHashCode(this); + }, M.prototype.toString = function() { + return this.name; + }, P.$metadata$ = { kind: S, simpleName: "Companion", interfaces: [] }; + var R = null; + function N() { + return R === null && new P(), R; + } + function F() { + U = this, this.MIN_VALUE = 5e-324, this.MAX_VALUE = 17976931348623157e292, this.POSITIVE_INFINITY = 1 / 0, this.NEGATIVE_INFINITY = -1 / 0, this.NaN = NaN, this.SIZE_BYTES = 8, this.SIZE_BITS = 64; + } + M.$metadata$ = { kind: T, simpleName: "Enum", interfaces: [E] }, F.$metadata$ = { kind: S, simpleName: "DoubleCompanionObject", interfaces: [] }; + var U = null; + function $() { + G = this, this.MIN_VALUE = 14e-46, this.MAX_VALUE = 34028235e31, this.POSITIVE_INFINITY = 1 / 0, this.NEGATIVE_INFINITY = -1 / 0, this.NaN = NaN, this.SIZE_BYTES = 4, this.SIZE_BITS = 32; + } + $.$metadata$ = { kind: S, simpleName: "FloatCompanionObject", interfaces: [] }; + var G = null; + function Q() { + ee = this, this.MIN_VALUE = -2147483648, this.MAX_VALUE = 2147483647, this.SIZE_BYTES = 4, this.SIZE_BITS = 32; + } + Q.$metadata$ = { kind: S, simpleName: "IntCompanionObject", interfaces: [] }; + var ee = null; + function ce() { + ne = this, this.MIN_VALUE = l.Long.MIN_VALUE, this.MAX_VALUE = l.Long.MAX_VALUE, this.SIZE_BYTES = 8, this.SIZE_BITS = 64; + } + ce.$metadata$ = { kind: S, simpleName: "LongCompanionObject", interfaces: [] }; + var ne = null; + function fe() { + K = this, this.MIN_VALUE = 0, this.MAX_VALUE = 65535, this.MIN_HIGH_SURROGATE = 55296, this.MAX_HIGH_SURROGATE = 56319, this.MIN_LOW_SURROGATE = 56320, this.MAX_LOW_SURROGATE = 57343, this.MIN_SURROGATE = this.MIN_HIGH_SURROGATE, this.MAX_SURROGATE = this.MAX_LOW_SURROGATE, this.SIZE_BYTES = 2, this.SIZE_BITS = 16; + } + fe.$metadata$ = { kind: S, simpleName: "CharCompanionObject", interfaces: [] }; + var K = null; + function Oe() { + xe = this; + } + Oe.$metadata$ = { kind: S, simpleName: "StringCompanionObject", interfaces: [] }; + var xe = null, Ge = u.kotlin || (u.kotlin = {}); + Ge.Comparable = E, Object.defineProperty(M, "Companion", { get: N }), Ge.Enum = M, u.newArray = function(se, te) { + return function(pe, re) { + var ae; + ae = pe.length - 1 | 0; + for (var le = 0; le <= ae; le++) + pe[le] = re; + return pe; + }(Array(se), te); + }, u.charArray = function(se, te) { + var pe, re = new Uint16Array(se); + if (re.$type$ = "CharArray", te == null || C(te, !0) || C(te, !1)) + pe = re; + else { + var ae; + ae = re.length - 1 | 0; + for (var le = 0; le <= ae; le++) + re[le] = te(le); + pe = re; + } + return pe; + }; + var oe = Ge.js || (Ge.js = {}), de = oe.internal || (oe.internal = {}); + Object.defineProperty(de, "DoubleCompanionObject", { get: function() { + return U === null && new F(), U; + } }), Object.defineProperty(de, "FloatCompanionObject", { get: function() { + return G === null && new $(), G; + } }), Object.defineProperty(de, "IntCompanionObject", { get: function() { + return ee === null && new Q(), ee; + } }), Object.defineProperty(de, "LongCompanionObject", { get: function() { + return ne === null && new ce(), ne; + } }), Object.defineProperty(de, "CharCompanionObject", { get: function() { + return K === null && new fe(), K; + } }), Object.defineProperty(de, "StringCompanionObject", { get: function() { + return xe === null && new Oe(), xe; + } }); + }(), function() { + var g = l.defineInlineFunction, S = l.wrapFunction, T = l.equals, C = l.toBoxedChar, E = l.unboxChar, M = (l.kotlin.js.internal.DoubleCompanionObject, l.Long.ZERO), P = Math, R = l.Kind.CLASS, N = l.toChar, F = (l.Long.NEG_ONE, l.toByte), U = (l.Long.fromInt(-128), l.Long.fromInt(127), l.Long.fromInt(-2147483648), l.Long.fromInt(2147483647), l.Long.MIN_VALUE), $ = (l.Long.MAX_VALUE, l.Long.fromInt(-32768), l.Long.fromInt(32767), l.toString), G = (l.Long.fromInt(255), new l.Long(-1, 0), l.Long.fromInt(65535), l.Kind.INTERFACE), Q = l.Kind.OBJECT, ee = l.Long.ONE, ce = l.kotlin.Enum, ne = l.kotlin.Comparable, fe = l.ensureNotNull, K = Object, Oe = l.throwCCE, xe = Error, Ge = l.arrayToString, oe = l.hashCode, de = (l.kotlin.js.internal.FloatCompanionObject, l.kotlin.js.internal.CharCompanionObject), se = (new l.Long(-1478467534, -1720727600), new l.Long(-888910638, 1920087921), new l.Long(1993859828, 793161749)); + function te(O, j) { + return re(O, j) >= 0; + } + function pe(O, j) { + if (j == null) { + for (var Z = 0; Z !== O.length; ++Z) + if (O[Z] == null) + return Z; + } else + for (var ye = 0; ye !== O.length; ++ye) + if (T(j, O[ye])) + return ye; + return -1; + } + function re(O, j) { + for (var Z = 0; Z !== O.length; ++Z) + if (j === O[Z]) + return Z; + return -1; + } + function ae(O, j) { + var Z, ye; + if (j == null) + for (Z = et(le(O)).iterator(); Z.hasNext(); ) { + var Be = Z.next(); + if (O[Be] == null) + return Be; + } + else + for (ye = et(le(O)).iterator(); ye.hasNext(); ) { + var lt = ye.next(); + if (T(j, O[lt])) + return lt; + } + return -1; + } + function le(O) { + return new Je(0, ue(O)); + } + function ue(O) { + return O.length - 1 | 0; + } + function Ae(O, j) { + var Z; + for (Z = 0; Z !== O.length; ++Z) { + var ye = O[Z]; + j.add_11rb$(ye); + } + return j; + } + function Te(O) { + var j; + switch (O.length) { + case 0: + j = Tu(); + break; + case 1: + j = Ar(O[0]); + break; + default: + j = Ae(O, bu(O.length)); + } + return j; + } + function Ne(O) { + this.closure$iterator = O; + } + function He(O, j) { + return l.isType(O, ar) ? O.contains_11rb$(j) : je(O, j) >= 0; + } + function je(O, j) { + var Z; + if (l.isType(O, Tr)) + return O.indexOf_11rb$(j); + var ye = 0; + for (Z = O.iterator(); Z.hasNext(); ) { + var Be = Z.next(); + if (lo(ye), T(j, Be)) + return ye; + ye = ye + 1 | 0; + } + return -1; + } + function be(O, j) { + var Z; + for (Z = O.iterator(); Z.hasNext(); ) { + var ye = Z.next(); + j.add_11rb$(ye); + } + return j; + } + function ge(O) { + var j; + if (l.isType(O, ar)) { + switch (O.size) { + case 0: + j = Tu(); + break; + case 1: + j = Ar(l.isType(O, Tr) ? O.get_za3lpa$(0) : O.iterator().next()); + break; + default: + j = be(O, bu(O.size)); + } + return j; + } + return zm(be(O, yu())); + } + function _e(O, j, Z, ye, Be, lt, Lt, br) { + var mr; + Z === void 0 && (Z = ", "), ye === void 0 && (ye = ""), Be === void 0 && (Be = ""), lt === void 0 && (lt = -1), Lt === void 0 && (Lt = "..."), br === void 0 && (br = null), j.append_gw00v9$(ye); + var an = 0; + for (mr = O.iterator(); mr.hasNext(); ) { + var Bo = mr.next(); + if ((an = an + 1 | 0) > 1 && j.append_gw00v9$(Z), !(lt < 0 || an <= lt)) + break; + Hm(j, Bo, br); + } + return lt >= 0 && an > lt && j.append_gw00v9$(Lt), j.append_gw00v9$(Be), j; + } + function we(O, j, Z, ye, Be, lt, Lt) { + return j === void 0 && (j = ", "), Z === void 0 && (Z = ""), ye === void 0 && (ye = ""), Be === void 0 && (Be = -1), lt === void 0 && (lt = "..."), Lt === void 0 && (Lt = null), _e(O, yv(), j, Z, ye, Be, lt, Lt).toString(); + } + function Ie(O) { + return new Ne((j = O, function() { + return j.iterator(); + })); + var j; + } + function Me(O, j) { + return Co().fromClosedRange_qt1dr2$(O, j, -1); + } + function et(O) { + return Co().fromClosedRange_qt1dr2$(O.last, O.first, 0 | -O.step); + } + function yt(O, j) { + return O < j ? j : O; + } + function vt(O, j) { + return O > j ? j : O; + } + function ze(O, j) { + if (!(j >= 0)) + throw Gr(("Requested element count " + j + " is less than zero.").toString()); + return j === 0 ? wf() : l.isType(O, wu) ? O.take_za3lpa$(j) : new Rl(O, j); + } + function bt(O, j) { + return new Pc(O, j); + } + function _t() { + } + function $t() { + } + function fr() { + } + function _r() { + } + function ar() { + } + function or() { + } + function Tr() { + } + function tn() { + } + function rn() { + } + function qe() { + } + function Xe() { + } + function Ze() { + } + function st() { + } + function St() { + } + function tt() { + } + function Vr() { + } + function cn() { + } + function ct() { + } + function Re() { + } + function Br() { + } + function dr() { + } + function ur(O, j, Z) { + Re.call(this), this.step = Z, this.finalElement_0 = 0 | j, this.hasNext_0 = this.step > 0 ? O <= j : O >= j, this.next_0 = this.hasNext_0 ? 0 | O : this.finalElement_0; + } + function wn(O, j, Z) { + Br.call(this), this.step = Z, this.finalElement_0 = j, this.hasNext_0 = this.step > 0 ? O <= j : O >= j, this.next_0 = this.hasNext_0 ? O : this.finalElement_0; + } + function vr(O, j, Z) { + dr.call(this), this.step = Z, this.finalElement_0 = j, this.hasNext_0 = this.step.toNumber() > 0 ? O.compareTo_11rb$(j) <= 0 : O.compareTo_11rb$(j) >= 0, this.next_0 = this.hasNext_0 ? O : this.finalElement_0; + } + function Vt(O, j, Z) { + if (pr(), Z === 0) + throw Gr("Step must be non-zero."); + if (Z === -2147483648) + throw Gr("Step must be greater than Int.MIN_VALUE to avoid overflow on negation."); + this.first = O, this.last = N(ci(0 | O, 0 | j, Z)), this.step = Z; + } + function wi() { + wt = this; + } + new l.Long(1, -2147483648), new l.Long(1908874354, -59652324), new l.Long(1, -1073741824), new l.Long(1108857478, -1074), l.Long.fromInt(-2147483647), new l.Long(2077252342, 2147), new l.Long(-2077252342, -2148), new l.Long(387905, -1073741824), new l.Long(-387905, 1073741823), new l.Long(-1, 1073741823), new l.Long(-1108857478, 1073), l.Long.fromInt(2047), Qi.prototype = Object.create(xe.prototype), Qi.prototype.constructor = Qi, Hr.prototype = Object.create(Qi.prototype), Hr.prototype.constructor = Hr, ur.prototype = Object.create(Re.prototype), ur.prototype.constructor = ur, wn.prototype = Object.create(Br.prototype), wn.prototype.constructor = wn, vr.prototype = Object.create(dr.prototype), vr.prototype.constructor = vr, Ct.prototype = Object.create(Vt.prototype), Ct.prototype.constructor = Ct, Je.prototype = Object.create(Fn.prototype), Je.prototype.constructor = Je, qt.prototype = Object.create(Wr.prototype), qt.prototype.constructor = qt, ki.prototype = Object.create(xe.prototype), ki.prototype.constructor = ki, qi.prototype = Object.create(Hr.prototype), qi.prototype.constructor = qi, Oi.prototype = Object.create(Hr.prototype), Oi.prototype.constructor = Oi, Tn.prototype = Object.create(Hr.prototype), Tn.prototype.constructor = Tn, za.prototype = Object.create(Hr.prototype), za.prototype.constructor = za, dn.prototype = Object.create(qi.prototype), dn.prototype.constructor = dn, _i.prototype = Object.create(Hr.prototype), _i.prototype.constructor = _i, Li.prototype = Object.create(Hr.prototype), Li.prototype.constructor = Li, so.prototype = Object.create(Hr.prototype), so.prototype.constructor = so, _a.prototype = Object.create(Hr.prototype), _a.prototype.constructor = _a, ai.prototype = Object.create(Pn.prototype), ai.prototype.constructor = ai, Mn.prototype = Object.create(Pn.prototype), Mn.prototype.constructor = Mn, ti.prototype = Object.create(ja.prototype), ti.prototype.constructor = ti, Er.prototype = Object.create(Mn.prototype), Er.prototype.constructor = Er, ri.prototype = Object.create(Er.prototype), ri.prototype.constructor = ri, Gt.prototype = Object.create(Mn.prototype), Gt.prototype.constructor = Gt, ni.prototype = Object.create(Gt.prototype), ni.prototype.constructor = ni, Ve.prototype = Object.create(Gt.prototype), Ve.prototype.constructor = Ve, Zn.prototype = Object.create(Mn.prototype), Zn.prototype.constructor = Zn, Xn.prototype = Object.create(Kn.prototype), Xn.prototype.constructor = Xn, Mr.prototype = Object.create(Er.prototype), Mr.prototype.constructor = Mr, fi.prototype = Object.create(ni.prototype), fi.prototype.constructor = fi, hn.prototype = Object.create(Xn.prototype), hn.prototype.constructor = hn, nn.prototype = Object.create(Gt.prototype), nn.prototype.constructor = nn, Ha.prototype = Object.create(Ln.prototype), Ha.prototype.constructor = Ha, Fi.prototype = Object.create(ni.prototype), Fi.prototype.constructor = Fi, mt.prototype = Object.create(hn.prototype), mt.prototype.constructor = mt, Pi.prototype = Object.create(nn.prototype), Pi.prototype.constructor = Pi, Do.prototype = Object.create(ta.prototype), Do.prototype.constructor = Do, Fr.prototype = Object.create(ta.prototype), Fr.prototype.constructor = Fr, ra.prototype = Object.create(Fr.prototype), ra.prototype.constructor = ra, gr.prototype = Object.create(Nr.prototype), gr.prototype.constructor = gr, z.prototype = Object.create(Nr.prototype), z.prototype.constructor = z, J.prototype = Object.create(Nr.prototype), J.prototype.constructor = J, Ol.prototype = Object.create(ai.prototype), Ol.prototype.constructor = Ol, Ga.prototype = Object.create(Pn.prototype), Ga.prototype.constructor = Ga, Pl.prototype = Object.create(ai.prototype), Pl.prototype.constructor = Pl, Lo.prototype = Object.create(Js.prototype), Lo.prototype.constructor = Lo, fo.prototype = Object.create(Pn.prototype), fo.prototype.constructor = fo, Ks.prototype = Object.create(fo.prototype), Ks.prototype.constructor = Ks, Qs.prototype = Object.create(Pn.prototype), Qs.prototype.constructor = Qs, xa.prototype = Object.create(ce.prototype), xa.prototype.constructor = xa, bs.prototype = Object.create(Re.prototype), bs.prototype.constructor = bs, zl.prototype = Object.create(ki.prototype), zl.prototype.constructor = zl, Ne.prototype.iterator = function() { + return this.closure$iterator(); + }, Ne.$metadata$ = { kind: R, interfaces: [Po] }, _t.$metadata$ = { kind: G, simpleName: "Annotation", interfaces: [] }, $t.$metadata$ = { kind: G, simpleName: "CharSequence", interfaces: [] }, fr.$metadata$ = { kind: G, simpleName: "Iterable", interfaces: [] }, _r.$metadata$ = { kind: G, simpleName: "MutableIterable", interfaces: [fr] }, ar.$metadata$ = { kind: G, simpleName: "Collection", interfaces: [fr] }, or.$metadata$ = { kind: G, simpleName: "MutableCollection", interfaces: [_r, ar] }, Tr.$metadata$ = { kind: G, simpleName: "List", interfaces: [ar] }, tn.$metadata$ = { kind: G, simpleName: "MutableList", interfaces: [or, Tr] }, rn.$metadata$ = { kind: G, simpleName: "Set", interfaces: [ar] }, qe.$metadata$ = { kind: G, simpleName: "MutableSet", interfaces: [or, rn] }, Xe.prototype.getOrDefault_xwzc9p$ = function(O, j) { + throw new zl(); + }, Ze.$metadata$ = { kind: G, simpleName: "Entry", interfaces: [] }, Xe.$metadata$ = { kind: G, simpleName: "Map", interfaces: [] }, st.prototype.remove_xwzc9p$ = function(O, j) { + return !0; + }, St.$metadata$ = { kind: G, simpleName: "MutableEntry", interfaces: [Ze] }, st.$metadata$ = { kind: G, simpleName: "MutableMap", interfaces: [Xe] }, tt.$metadata$ = { kind: G, simpleName: "Iterator", interfaces: [] }, Vr.$metadata$ = { kind: G, simpleName: "MutableIterator", interfaces: [tt] }, cn.$metadata$ = { kind: G, simpleName: "ListIterator", interfaces: [tt] }, ct.$metadata$ = { kind: G, simpleName: "MutableListIterator", interfaces: [Vr, cn] }, Re.prototype.next = function() { + return C(this.nextChar()); + }, Re.$metadata$ = { kind: R, simpleName: "CharIterator", interfaces: [tt] }, Br.prototype.next = function() { + return this.nextInt(); + }, Br.$metadata$ = { kind: R, simpleName: "IntIterator", interfaces: [tt] }, dr.prototype.next = function() { + return this.nextLong(); + }, dr.$metadata$ = { kind: R, simpleName: "LongIterator", interfaces: [tt] }, ur.prototype.hasNext = function() { + return this.hasNext_0; + }, ur.prototype.nextChar = function() { + var O = this.next_0; + if (O === this.finalElement_0) { + if (!this.hasNext_0) + throw ei(); + this.hasNext_0 = !1; + } else + this.next_0 = this.next_0 + this.step | 0; + return N(O); + }, ur.$metadata$ = { kind: R, simpleName: "CharProgressionIterator", interfaces: [Re] }, wn.prototype.hasNext = function() { + return this.hasNext_0; + }, wn.prototype.nextInt = function() { + var O = this.next_0; + if (O === this.finalElement_0) { + if (!this.hasNext_0) + throw ei(); + this.hasNext_0 = !1; + } else + this.next_0 = this.next_0 + this.step | 0; + return O; + }, wn.$metadata$ = { kind: R, simpleName: "IntProgressionIterator", interfaces: [Br] }, vr.prototype.hasNext = function() { + return this.hasNext_0; + }, vr.prototype.nextLong = function() { + var O = this.next_0; + if (T(O, this.finalElement_0)) { + if (!this.hasNext_0) + throw ei(); + this.hasNext_0 = !1; + } else + this.next_0 = this.next_0.add(this.step); + return O; + }, vr.$metadata$ = { kind: R, simpleName: "LongProgressionIterator", interfaces: [dr] }, Vt.prototype.iterator = function() { + return new ur(this.first, this.last, this.step); + }, Vt.prototype.isEmpty = function() { + return this.step > 0 ? this.first > this.last : this.first < this.last; + }, Vt.prototype.equals = function(O) { + return l.isType(O, Vt) && (this.isEmpty() && O.isEmpty() || this.first === O.first && this.last === O.last && this.step === O.step); + }, Vt.prototype.hashCode = function() { + return this.isEmpty() ? -1 : (31 * ((31 * (0 | this.first) | 0) + (0 | this.last) | 0) | 0) + this.step | 0; + }, Vt.prototype.toString = function() { + return this.step > 0 ? String.fromCharCode(this.first) + ".." + String.fromCharCode(this.last) + " step " + this.step : String.fromCharCode(this.first) + " downTo " + String.fromCharCode(this.last) + " step " + (0 | -this.step); + }, wi.prototype.fromClosedRange_ayra44$ = function(O, j, Z) { + return new Vt(O, j, Z); + }, wi.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var wt = null; + function pr() { + return wt === null && new wi(), wt; + } + function Fn(O, j, Z) { + if (Co(), Z === 0) + throw Gr("Step must be non-zero."); + if (Z === -2147483648) + throw Gr("Step must be greater than Int.MIN_VALUE to avoid overflow on negation."); + this.first = O, this.last = ci(O, j, Z), this.step = Z; + } + function Ra() { + oo = this; + } + Vt.$metadata$ = { kind: R, simpleName: "CharProgression", interfaces: [fr] }, Fn.prototype.iterator = function() { + return new wn(this.first, this.last, this.step); + }, Fn.prototype.isEmpty = function() { + return this.step > 0 ? this.first > this.last : this.first < this.last; + }, Fn.prototype.equals = function(O) { + return l.isType(O, Fn) && (this.isEmpty() && O.isEmpty() || this.first === O.first && this.last === O.last && this.step === O.step); + }, Fn.prototype.hashCode = function() { + return this.isEmpty() ? -1 : (31 * ((31 * this.first | 0) + this.last | 0) | 0) + this.step | 0; + }, Fn.prototype.toString = function() { + return this.step > 0 ? this.first.toString() + ".." + this.last + " step " + this.step : this.first.toString() + " downTo " + this.last + " step " + (0 | -this.step); + }, Ra.prototype.fromClosedRange_qt1dr2$ = function(O, j, Z) { + return new Fn(O, j, Z); + }, Ra.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var oo = null; + function Co() { + return oo === null && new Ra(), oo; + } + function Wr(O, j, Z) { + if (Sr(), T(Z, M)) + throw Gr("Step must be non-zero."); + if (T(Z, U)) + throw Gr("Step must be greater than Long.MIN_VALUE to avoid overflow on negation."); + this.first = O, this.last = ya(O, j, Z), this.step = Z; + } + function Na() { + jr = this; + } + Fn.$metadata$ = { kind: R, simpleName: "IntProgression", interfaces: [fr] }, Wr.prototype.iterator = function() { + return new vr(this.first, this.last, this.step); + }, Wr.prototype.isEmpty = function() { + return this.step.toNumber() > 0 ? this.first.compareTo_11rb$(this.last) > 0 : this.first.compareTo_11rb$(this.last) < 0; + }, Wr.prototype.equals = function(O) { + return l.isType(O, Wr) && (this.isEmpty() && O.isEmpty() || T(this.first, O.first) && T(this.last, O.last) && T(this.step, O.step)); + }, Wr.prototype.hashCode = function() { + return this.isEmpty() ? -1 : l.Long.fromInt(31).multiply(l.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32)))).add(this.step.xor(this.step.shiftRightUnsigned(32))).toInt(); + }, Wr.prototype.toString = function() { + return this.step.toNumber() > 0 ? this.first.toString() + ".." + this.last.toString() + " step " + this.step.toString() : this.first.toString() + " downTo " + this.last.toString() + " step " + this.step.unaryMinus().toString(); + }, Na.prototype.fromClosedRange_b9bd0d$ = function(O, j, Z) { + return new Wr(O, j, Z); + }, Na.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var jr = null; + function Sr() { + return jr === null && new Na(), jr; + } + function $r() { + } + function Ct(O, j) { + Ue(), Vt.call(this, O, j, 1); + } + function he() { + Qe = this, this.EMPTY = new Ct(N(1), N(0)); + } + Wr.$metadata$ = { kind: R, simpleName: "LongProgression", interfaces: [fr] }, $r.prototype.contains_mef7kx$ = function(O) { + return l.compareTo(O, this.start) >= 0 && l.compareTo(O, this.endInclusive) <= 0; + }, $r.prototype.isEmpty = function() { + return l.compareTo(this.start, this.endInclusive) > 0; + }, $r.$metadata$ = { kind: G, simpleName: "ClosedRange", interfaces: [] }, Object.defineProperty(Ct.prototype, "start", { configurable: !0, get: function() { + return C(this.first); + } }), Object.defineProperty(Ct.prototype, "endInclusive", { configurable: !0, get: function() { + return C(this.last); + } }), Ct.prototype.contains_mef7kx$ = function(O) { + return this.first <= O && O <= this.last; + }, Ct.prototype.isEmpty = function() { + return this.first > this.last; + }, Ct.prototype.equals = function(O) { + return l.isType(O, Ct) && (this.isEmpty() && O.isEmpty() || this.first === O.first && this.last === O.last); + }, Ct.prototype.hashCode = function() { + return this.isEmpty() ? -1 : (31 * (0 | this.first) | 0) + (0 | this.last) | 0; + }, Ct.prototype.toString = function() { + return String.fromCharCode(this.first) + ".." + String.fromCharCode(this.last); + }, he.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var Qe = null; + function Ue() { + return Qe === null && new he(), Qe; + } + function Je(O, j) { + It(), Fn.call(this, O, j, 1); + } + function at() { + Dt = this, this.EMPTY = new Je(1, 0); + } + Ct.$metadata$ = { kind: R, simpleName: "CharRange", interfaces: [$r, Vt] }, Object.defineProperty(Je.prototype, "start", { configurable: !0, get: function() { + return this.first; + } }), Object.defineProperty(Je.prototype, "endInclusive", { configurable: !0, get: function() { + return this.last; + } }), Je.prototype.contains_mef7kx$ = function(O) { + return this.first <= O && O <= this.last; + }, Je.prototype.isEmpty = function() { + return this.first > this.last; + }, Je.prototype.equals = function(O) { + return l.isType(O, Je) && (this.isEmpty() && O.isEmpty() || this.first === O.first && this.last === O.last); + }, Je.prototype.hashCode = function() { + return this.isEmpty() ? -1 : (31 * this.first | 0) + this.last | 0; + }, Je.prototype.toString = function() { + return this.first.toString() + ".." + this.last; + }, at.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var Dt = null; + function It() { + return Dt === null && new at(), Dt; + } + function qt(O, j) { + Nt(), Wr.call(this, O, j, ee); + } + function Lr() { + wr = this, this.EMPTY = new qt(ee, M); + } + Je.$metadata$ = { kind: R, simpleName: "IntRange", interfaces: [$r, Fn] }, Object.defineProperty(qt.prototype, "start", { configurable: !0, get: function() { + return this.first; + } }), Object.defineProperty(qt.prototype, "endInclusive", { configurable: !0, get: function() { + return this.last; + } }), qt.prototype.contains_mef7kx$ = function(O) { + return this.first.compareTo_11rb$(O) <= 0 && O.compareTo_11rb$(this.last) <= 0; + }, qt.prototype.isEmpty = function() { + return this.first.compareTo_11rb$(this.last) > 0; + }, qt.prototype.equals = function(O) { + return l.isType(O, qt) && (this.isEmpty() && O.isEmpty() || T(this.first, O.first) && T(this.last, O.last)); + }, qt.prototype.hashCode = function() { + return this.isEmpty() ? -1 : l.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32))).toInt(); + }, qt.prototype.toString = function() { + return this.first.toString() + ".." + this.last.toString(); + }, Lr.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var wr = null; + function Nt() { + return wr === null && new Lr(), wr; + } + function nt() { + Cn = this; + } + qt.$metadata$ = { kind: R, simpleName: "LongRange", interfaces: [$r, Wr] }, nt.prototype.toString = function() { + return "kotlin.Unit"; + }, nt.$metadata$ = { kind: Q, simpleName: "Unit", interfaces: [] }; + var Cn = null; + function ui() { + return Cn === null && new nt(), Cn; + } + function yn(O, j) { + var Z = O % j; + return Z >= 0 ? Z : Z + j | 0; + } + function To(O, j) { + var Z = O.modulo(j); + return Z.toNumber() >= 0 ? Z : Z.add(j); + } + function ss(O, j, Z) { + return yn(yn(O, Z) - yn(j, Z) | 0, Z); + } + function Wn(O, j, Z) { + return To(To(O, Z).subtract(To(j, Z)), Z); + } + function ci(O, j, Z) { + if (Z > 0) + return O >= j ? j : j - ss(j, O, Z) | 0; + if (Z < 0) + return O <= j ? j : j + ss(O, j, 0 | -Z) | 0; + throw Gr("Step is zero."); + } + function ya(O, j, Z) { + if (Z.toNumber() > 0) + return O.compareTo_11rb$(j) >= 0 ? j : j.subtract(Wn(j, O, Z)); + if (Z.toNumber() < 0) + return O.compareTo_11rb$(j) <= 0 ? j : j.add(Wn(O, j, Z.unaryMinus())); + throw Gr("Step is zero."); + } + function fn(O) { + this.c = O; + } + function Yn(O) { + this.resultContinuation_0 = O, this.state_0 = 0, this.exceptionState_0 = 0, this.result_0 = null, this.exception_0 = null, this.finallyPath_0 = null, this.context_hxcuhl$_0 = this.resultContinuation_0.context, this.intercepted__0 = null; + } + function Nn() { + ls = this; + } + fn.prototype.equals = function(O) { + return l.isType(O, fn) && this.c === O.c; + }, fn.prototype.hashCode = function() { + return this.c; + }, fn.prototype.toString = function() { + return String.fromCharCode(E(this.c)); + }, fn.prototype.compareTo_11rb$ = function(O) { + return this.c - O; + }, fn.prototype.valueOf = function() { + return this.c; + }, fn.$metadata$ = { kind: R, simpleName: "BoxedChar", interfaces: [ne] }, Object.defineProperty(Yn.prototype, "context", { configurable: !0, get: function() { + return this.context_hxcuhl$_0; + } }), Yn.prototype.intercepted = function() { + var O, j, Z, ye; + if ((Z = this.intercepted__0) != null) + ye = Z; + else { + var Be = (j = (O = this.context.get_j3r2sn$(Au())) != null ? O.interceptContinuation_wj8d80$(this) : null) != null ? j : this; + this.intercepted__0 = Be, ye = Be; + } + return ye; + }, Yn.prototype.resumeWith_tl1gpc$ = function(O) { + for (var j, Z = { v: this }, ye = { v: O.isFailure ? null : (j = O.value) == null || l.isType(j, K) ? j : Oe() }, Be = { v: O.exceptionOrNull() }; ; ) { + var lt, Lt, br = Z.v, mr = br.resultContinuation_0; + Be.v == null ? br.result_0 = ye.v : (br.state_0 = br.exceptionState_0, br.exception_0 = Be.v); + try { + var an = br.doResume(); + if (an === el()) + return; + ye.v = an, Be.v = null; + } catch (Bo) { + ye.v = null, Be.v = Bo; + } + if (br.releaseIntercepted_0(), !l.isType(mr, Yn)) + return (lt = Be.v) != null ? (mr.resumeWith_tl1gpc$(new $i(Wm(lt))), Lt = nt) : Lt = null, void (Lt == null && mr.resumeWith_tl1gpc$(new $i(ye.v))); + Z.v = mr; + } + }, Yn.prototype.releaseIntercepted_0 = function() { + var O = this.intercepted__0; + O != null && O !== this && fe(this.context.get_j3r2sn$(Au())).releaseInterceptedContinuation_k98bjh$(O), this.intercepted__0 = us(); + }, Yn.$metadata$ = { kind: R, simpleName: "CoroutineImpl", interfaces: [Iu] }, Object.defineProperty(Nn.prototype, "context", { configurable: !0, get: function() { + throw On("This continuation is already complete".toString()); + } }), Nn.prototype.resumeWith_tl1gpc$ = function(O) { + throw On("This continuation is already complete".toString()); + }, Nn.prototype.toString = function() { + return "This continuation is already complete"; + }, Nn.$metadata$ = { kind: Q, simpleName: "CompletedContinuation", interfaces: [Iu] }; + var ls = null; + function us() { + return ls === null && new Nn(), ls; + } + function ki(O, j) { + var Z; + xe.call(this), Z = j != null ? j : null, this.message_q7r8iu$_0 = O === void 0 && Z != null ? l.toString(Z) : O, this.cause_us9j0c$_0 = Z, l.captureStack(xe, this), this.name = "Error"; + } + function Ki(O, j) { + return j = j || Object.create(ki.prototype), ki.call(j, O, null), j; + } + function Qi(O, j) { + var Z; + xe.call(this), Z = j != null ? j : null, this.message_8yp7un$_0 = O === void 0 && Z != null ? l.toString(Z) : O, this.cause_th0jdv$_0 = Z, l.captureStack(xe, this), this.name = "Exception"; + } + function Hr(O, j) { + Qi.call(this, O, j), this.name = "RuntimeException"; + } + function Io(O, j) { + return j = j || Object.create(Hr.prototype), Hr.call(j, O, null), j; + } + function qi(O, j) { + Hr.call(this, O, j), this.name = "IllegalArgumentException"; + } + function Gr(O, j) { + return j = j || Object.create(qi.prototype), qi.call(j, O, null), j; + } + function Oi(O, j) { + Hr.call(this, O, j), this.name = "IllegalStateException"; + } + function On(O, j) { + return j = j || Object.create(Oi.prototype), Oi.call(j, O, null), j; + } + function Tn(O) { + Io(O, this), this.name = "IndexOutOfBoundsException"; + } + function za(O, j) { + Hr.call(this, O, j), this.name = "UnsupportedOperationException"; + } + function Us(O) { + return O = O || Object.create(za.prototype), za.call(O, null, null), O; + } + function cs(O, j) { + return j = j || Object.create(za.prototype), za.call(j, O, null), j; + } + function dn(O) { + Gr(O, this), this.name = "NumberFormatException"; + } + function _i(O) { + Io(O, this), this.name = "NullPointerException"; + } + function Li(O) { + Io(O, this), this.name = "ClassCastException"; + } + function so(O) { + Io(O, this), this.name = "NoSuchElementException"; + } + function ei(O) { + return O = O || Object.create(so.prototype), so.call(O, null), O; + } + function _a(O) { + Io(O, this), this.name = "ArithmeticException"; + } + function du(O, j, Z) { + return er().checkRangeIndexes_cub51b$(j, Z, O.length), O.slice(j, Z); + } + function vu(O) { + this.function$ = O; + } + function Ir(O) { + return O.toArray !== void 0 ? O.toArray() : hi(O); + } + function hi(O) { + for (var j = [], Z = O.iterator(); Z.hasNext(); ) + j.push(Z.next()); + return j; + } + function In(O, j) { + var Z; + if (j.length < O.size) + return hi(O); + for (var ye = O.iterator(), Be = 0; ye.hasNext(); ) + j[Z = Be, Be = Z + 1 | 0, Z] = ye.next(); + return Be < j.length && (j[Be] = null), j; + } + function Ar(O) { + return Nm([O]); + } + function Ba(O, j, Z, ye, Be) { + er().checkRangeIndexes_cub51b$(ye, Be, O.length); + var lt = Be - ye | 0; + if (er().checkRangeIndexes_cub51b$(Z, Z + lt | 0, j.length), ArrayBuffer.isView(j) && ArrayBuffer.isView(O)) { + var Lt = O.subarray(ye, Be); + j.set(Lt, Z); + } else if (O !== j || Z <= ye) + for (var br = 0; br < lt; br++) + j[Z + br | 0] = O[ye + br | 0]; + else + for (var mr = lt - 1 | 0; mr >= 0; mr--) + j[Z + mr | 0] = O[ye + mr | 0]; + } + function lo(O) { + return O < 0 && Om(), O; + } + function Ao(O) { + return O; + } + function Mn() { + Pn.call(this); + } + function Er() { + Mn.call(this), this.modCount = 0; + } + function ja(O) { + this.$outer = O, this.index_0 = 0, this.last_0 = -1; + } + function ti(O, j) { + this.$outer = O, ja.call(this, this.$outer), er().checkPositionIndex_6xvm5r$(j, this.$outer.size), this.index_0 = j; + } + function ri(O, j, Z) { + Er.call(this), this.list_0 = O, this.fromIndex_0 = j, this._size_0 = 0, er().checkRangeIndexes_cub51b$(this.fromIndex_0, Z, this.list_0.size), this._size_0 = Z - this.fromIndex_0 | 0; + } + function Xn() { + Kn.call(this), this._keys_qe2m0n$_0 = null, this._values_kxdlqh$_0 = null; + } + function Ln(O, j) { + this.key_5xhq3d$_0 = O, this._value_0 = j; + } + function ni() { + Gt.call(this); + } + function Ve(O) { + this.this$AbstractMutableMap = O, Gt.call(this); + } + function Fa(O) { + this.closure$entryIterator = O; + } + function Zn(O) { + this.this$AbstractMutableMap = O, Mn.call(this); + } + function ea(O) { + this.closure$entryIterator = O; + } + function Gt() { + Mn.call(this); + } + function Mr(O) { + Er.call(this), this.array_hd7ov6$_0 = O, this.isReadOnly_dbt2oh$_0 = !1; + } + function $a(O) { + return O = O || Object.create(Mr.prototype), Mr.call(O, []), O; + } + function Cr(O, j) { + return j = j || Object.create(Mr.prototype), Mr.call(j, []), j; + } + function Yt() { + } + function bi() { + At = this; + } + Object.defineProperty(ki.prototype, "message", { get: function() { + return this.message_q7r8iu$_0; + } }), Object.defineProperty(ki.prototype, "cause", { get: function() { + return this.cause_us9j0c$_0; + } }), ki.$metadata$ = { kind: R, simpleName: "Error", interfaces: [xe] }, Object.defineProperty(Qi.prototype, "message", { get: function() { + return this.message_8yp7un$_0; + } }), Object.defineProperty(Qi.prototype, "cause", { get: function() { + return this.cause_th0jdv$_0; + } }), Qi.$metadata$ = { kind: R, simpleName: "Exception", interfaces: [xe] }, Hr.$metadata$ = { kind: R, simpleName: "RuntimeException", interfaces: [Qi] }, qi.$metadata$ = { kind: R, simpleName: "IllegalArgumentException", interfaces: [Hr] }, Oi.$metadata$ = { kind: R, simpleName: "IllegalStateException", interfaces: [Hr] }, Tn.$metadata$ = { kind: R, simpleName: "IndexOutOfBoundsException", interfaces: [Hr] }, za.$metadata$ = { kind: R, simpleName: "UnsupportedOperationException", interfaces: [Hr] }, dn.$metadata$ = { kind: R, simpleName: "NumberFormatException", interfaces: [qi] }, _i.$metadata$ = { kind: R, simpleName: "NullPointerException", interfaces: [Hr] }, Li.$metadata$ = { kind: R, simpleName: "ClassCastException", interfaces: [Hr] }, so.$metadata$ = { kind: R, simpleName: "NoSuchElementException", interfaces: [Hr] }, _a.$metadata$ = { kind: R, simpleName: "ArithmeticException", interfaces: [Hr] }, vu.prototype.compare = function(O, j) { + return this.function$(O, j); + }, vu.$metadata$ = { kind: G, simpleName: "Comparator", interfaces: [] }, Mn.prototype.remove_11rb$ = function(O) { + this.checkIsMutable(); + for (var j = this.iterator(); j.hasNext(); ) + if (T(j.next(), O)) + return j.remove(), !0; + return !1; + }, Mn.prototype.addAll_brywnq$ = function(O) { + var j; + this.checkIsMutable(); + var Z = !1; + for (j = O.iterator(); j.hasNext(); ) { + var ye = j.next(); + this.add_11rb$(ye) && (Z = !0); + } + return Z; + }, Mn.prototype.removeAll_brywnq$ = function(O) { + var j; + return this.checkIsMutable(), Tv(l.isType(this, _r) ? this : xi(), (j = O, function(Z) { + return j.contains_11rb$(Z); + })); + }, Mn.prototype.retainAll_brywnq$ = function(O) { + var j; + return this.checkIsMutable(), Tv(l.isType(this, _r) ? this : xi(), (j = O, function(Z) { + return !j.contains_11rb$(Z); + })); + }, Mn.prototype.clear = function() { + this.checkIsMutable(); + for (var O = this.iterator(); O.hasNext(); ) + O.next(), O.remove(); + }, Mn.prototype.toJSON = function() { + return this.toArray(); + }, Mn.prototype.checkIsMutable = function() { + }, Mn.$metadata$ = { kind: R, simpleName: "AbstractMutableCollection", interfaces: [or, Pn] }, Er.prototype.add_11rb$ = function(O) { + return this.checkIsMutable(), this.add_wxm5ur$(this.size, O), !0; + }, Er.prototype.addAll_u57x28$ = function(O, j) { + var Z, ye; + this.checkIsMutable(); + var Be = O, lt = !1; + for (Z = j.iterator(); Z.hasNext(); ) { + var Lt = Z.next(); + this.add_wxm5ur$((Be = (ye = Be) + 1 | 0, ye), Lt), lt = !0; + } + return lt; + }, Er.prototype.clear = function() { + this.checkIsMutable(), this.removeRange_vux9f0$(0, this.size); + }, Er.prototype.removeAll_brywnq$ = function(O) { + return this.checkIsMutable(), Iv(this, (j = O, function(Z) { + return j.contains_11rb$(Z); + })); + var j; + }, Er.prototype.retainAll_brywnq$ = function(O) { + return this.checkIsMutable(), Iv(this, (j = O, function(Z) { + return !j.contains_11rb$(Z); + })); + var j; + }, Er.prototype.iterator = function() { + return new ja(this); + }, Er.prototype.contains_11rb$ = function(O) { + return this.indexOf_11rb$(O) >= 0; + }, Er.prototype.indexOf_11rb$ = function(O) { + var j; + j = gs(this); + for (var Z = 0; Z <= j; Z++) + if (T(this.get_za3lpa$(Z), O)) + return Z; + return -1; + }, Er.prototype.lastIndexOf_11rb$ = function(O) { + for (var j = gs(this); j >= 0; j--) + if (T(this.get_za3lpa$(j), O)) + return j; + return -1; + }, Er.prototype.listIterator = function() { + return this.listIterator_za3lpa$(0); + }, Er.prototype.listIterator_za3lpa$ = function(O) { + return new ti(this, O); + }, Er.prototype.subList_vux9f0$ = function(O, j) { + return new ri(this, O, j); + }, Er.prototype.removeRange_vux9f0$ = function(O, j) { + for (var Z = this.listIterator_za3lpa$(O), ye = j - O | 0, Be = 0; Be < ye; Be++) + Z.next(), Z.remove(); + }, Er.prototype.equals = function(O) { + return O === this || !!l.isType(O, Tr) && er().orderedEquals_e92ka7$(this, O); + }, Er.prototype.hashCode = function() { + return er().orderedHashCode_nykoif$(this); + }, ja.prototype.hasNext = function() { + return this.index_0 < this.$outer.size; + }, ja.prototype.next = function() { + var O; + if (!this.hasNext()) + throw ei(); + return this.last_0 = (O = this.index_0, this.index_0 = O + 1 | 0, O), this.$outer.get_za3lpa$(this.last_0); + }, ja.prototype.remove = function() { + if (this.last_0 === -1) + throw On("Call next() or previous() before removing element from the iterator.".toString()); + this.$outer.removeAt_za3lpa$(this.last_0), this.index_0 = this.last_0, this.last_0 = -1; + }, ja.$metadata$ = { kind: R, simpleName: "IteratorImpl", interfaces: [Vr] }, ti.prototype.hasPrevious = function() { + return this.index_0 > 0; + }, ti.prototype.nextIndex = function() { + return this.index_0; + }, ti.prototype.previous = function() { + if (!this.hasPrevious()) + throw ei(); + return this.last_0 = (this.index_0 = this.index_0 - 1 | 0, this.index_0), this.$outer.get_za3lpa$(this.last_0); + }, ti.prototype.previousIndex = function() { + return this.index_0 - 1 | 0; + }, ti.prototype.add_11rb$ = function(O) { + this.$outer.add_wxm5ur$(this.index_0, O), this.index_0 = this.index_0 + 1 | 0, this.last_0 = -1; + }, ti.prototype.set_11rb$ = function(O) { + if (this.last_0 === -1) + throw On("Call next() or previous() before updating element value with the iterator.".toString()); + this.$outer.set_wxm5ur$(this.last_0, O); + }, ti.$metadata$ = { kind: R, simpleName: "ListIteratorImpl", interfaces: [ct, ja] }, ri.prototype.add_wxm5ur$ = function(O, j) { + er().checkPositionIndex_6xvm5r$(O, this._size_0), this.list_0.add_wxm5ur$(this.fromIndex_0 + O | 0, j), this._size_0 = this._size_0 + 1 | 0; + }, ri.prototype.get_za3lpa$ = function(O) { + return er().checkElementIndex_6xvm5r$(O, this._size_0), this.list_0.get_za3lpa$(this.fromIndex_0 + O | 0); + }, ri.prototype.removeAt_za3lpa$ = function(O) { + er().checkElementIndex_6xvm5r$(O, this._size_0); + var j = this.list_0.removeAt_za3lpa$(this.fromIndex_0 + O | 0); + return this._size_0 = this._size_0 - 1 | 0, j; + }, ri.prototype.set_wxm5ur$ = function(O, j) { + return er().checkElementIndex_6xvm5r$(O, this._size_0), this.list_0.set_wxm5ur$(this.fromIndex_0 + O | 0, j); + }, Object.defineProperty(ri.prototype, "size", { configurable: !0, get: function() { + return this._size_0; + } }), ri.prototype.checkIsMutable = function() { + this.list_0.checkIsMutable(); + }, ri.$metadata$ = { kind: R, simpleName: "SubList", interfaces: [Mo, Er] }, Er.$metadata$ = { kind: R, simpleName: "AbstractMutableList", interfaces: [tn, Mn] }, Object.defineProperty(Ln.prototype, "key", { get: function() { + return this.key_5xhq3d$_0; + } }), Object.defineProperty(Ln.prototype, "value", { configurable: !0, get: function() { + return this._value_0; + } }), Ln.prototype.setValue_11rc$ = function(O) { + var j = this._value_0; + return this._value_0 = O, j; + }, Ln.prototype.hashCode = function() { + return kc().entryHashCode_9fthdn$(this); + }, Ln.prototype.toString = function() { + return kc().entryToString_9fthdn$(this); + }, Ln.prototype.equals = function(O) { + return kc().entryEquals_js7fox$(this, O); + }, Ln.$metadata$ = { kind: R, simpleName: "SimpleEntry", interfaces: [St] }, ni.prototype.contains_11rb$ = function(O) { + return this.containsEntry_kw6fkd$(O); + }, ni.prototype.remove_11rb$ = function(O) { + return this.removeEntry_kw6fkd$(O); + }, ni.$metadata$ = { kind: R, simpleName: "AbstractEntrySet", interfaces: [Gt] }, Xn.prototype.clear = function() { + this.entries.clear(); + }, Ve.prototype.add_11rb$ = function(O) { + throw cs("Add is not supported on keys"); + }, Ve.prototype.clear = function() { + this.this$AbstractMutableMap.clear(); + }, Ve.prototype.contains_11rb$ = function(O) { + return this.this$AbstractMutableMap.containsKey_11rb$(O); + }, Fa.prototype.hasNext = function() { + return this.closure$entryIterator.hasNext(); + }, Fa.prototype.next = function() { + return this.closure$entryIterator.next().key; + }, Fa.prototype.remove = function() { + this.closure$entryIterator.remove(); + }, Fa.$metadata$ = { kind: R, interfaces: [Vr] }, Ve.prototype.iterator = function() { + return new Fa(this.this$AbstractMutableMap.entries.iterator()); + }, Ve.prototype.remove_11rb$ = function(O) { + return this.checkIsMutable(), !!this.this$AbstractMutableMap.containsKey_11rb$(O) && (this.this$AbstractMutableMap.remove_11rb$(O), !0); + }, Object.defineProperty(Ve.prototype, "size", { configurable: !0, get: function() { + return this.this$AbstractMutableMap.size; + } }), Ve.prototype.checkIsMutable = function() { + this.this$AbstractMutableMap.checkIsMutable(); + }, Ve.$metadata$ = { kind: R, interfaces: [Gt] }, Object.defineProperty(Xn.prototype, "keys", { configurable: !0, get: function() { + return this._keys_qe2m0n$_0 == null && (this._keys_qe2m0n$_0 = new Ve(this)), fe(this._keys_qe2m0n$_0); + } }), Xn.prototype.putAll_a2k3zr$ = function(O) { + var j; + for (this.checkIsMutable(), j = O.entries.iterator(); j.hasNext(); ) { + var Z = j.next(), ye = Z.key, Be = Z.value; + this.put_xwzc9p$(ye, Be); + } + }, Zn.prototype.add_11rb$ = function(O) { + throw cs("Add is not supported on values"); + }, Zn.prototype.clear = function() { + this.this$AbstractMutableMap.clear(); + }, Zn.prototype.contains_11rb$ = function(O) { + return this.this$AbstractMutableMap.containsValue_11rc$(O); + }, ea.prototype.hasNext = function() { + return this.closure$entryIterator.hasNext(); + }, ea.prototype.next = function() { + return this.closure$entryIterator.next().value; + }, ea.prototype.remove = function() { + this.closure$entryIterator.remove(); + }, ea.$metadata$ = { kind: R, interfaces: [Vr] }, Zn.prototype.iterator = function() { + return new ea(this.this$AbstractMutableMap.entries.iterator()); + }, Object.defineProperty(Zn.prototype, "size", { configurable: !0, get: function() { + return this.this$AbstractMutableMap.size; + } }), Zn.prototype.equals = function(O) { + return this === O || !!l.isType(O, ar) && er().orderedEquals_e92ka7$(this, O); + }, Zn.prototype.hashCode = function() { + return er().orderedHashCode_nykoif$(this); + }, Zn.prototype.checkIsMutable = function() { + this.this$AbstractMutableMap.checkIsMutable(); + }, Zn.$metadata$ = { kind: R, interfaces: [Mn] }, Object.defineProperty(Xn.prototype, "values", { configurable: !0, get: function() { + return this._values_kxdlqh$_0 == null && (this._values_kxdlqh$_0 = new Zn(this)), fe(this._values_kxdlqh$_0); + } }), Xn.prototype.remove_11rb$ = function(O) { + this.checkIsMutable(); + for (var j = this.entries.iterator(); j.hasNext(); ) { + var Z = j.next(), ye = Z.key; + if (T(O, ye)) { + var Be = Z.value; + return j.remove(), Be; + } + } + return null; + }, Xn.prototype.checkIsMutable = function() { + }, Xn.$metadata$ = { kind: R, simpleName: "AbstractMutableMap", interfaces: [st, Kn] }, Gt.prototype.equals = function(O) { + return O === this || !!l.isType(O, rn) && Su().setEquals_y8f7en$(this, O); + }, Gt.prototype.hashCode = function() { + return Su().unorderedHashCode_nykoif$(this); + }, Gt.$metadata$ = { kind: R, simpleName: "AbstractMutableSet", interfaces: [qe, Mn] }, Mr.prototype.build = function() { + return this.checkIsMutable(), this.isReadOnly_dbt2oh$_0 = !0, this; + }, Mr.prototype.trimToSize = function() { + }, Mr.prototype.ensureCapacity_za3lpa$ = function(O) { + }, Object.defineProperty(Mr.prototype, "size", { configurable: !0, get: function() { + return this.array_hd7ov6$_0.length; + } }), Mr.prototype.get_za3lpa$ = function(O) { + var j; + return (j = this.array_hd7ov6$_0[this.rangeCheck_xcmk5o$_0(O)]) == null || l.isType(j, K) ? j : xi(); + }, Mr.prototype.set_wxm5ur$ = function(O, j) { + var Z; + this.checkIsMutable(), this.rangeCheck_xcmk5o$_0(O); + var ye = this.array_hd7ov6$_0[O]; + return this.array_hd7ov6$_0[O] = j, (Z = ye) == null || l.isType(Z, K) ? Z : xi(); + }, Mr.prototype.add_11rb$ = function(O) { + return this.checkIsMutable(), this.array_hd7ov6$_0.push(O), this.modCount = this.modCount + 1 | 0, !0; + }, Mr.prototype.add_wxm5ur$ = function(O, j) { + this.checkIsMutable(), this.array_hd7ov6$_0.splice(this.insertionRangeCheck_xwivfl$_0(O), 0, j), this.modCount = this.modCount + 1 | 0; + }, Mr.prototype.addAll_brywnq$ = function(O) { + return this.checkIsMutable(), !O.isEmpty() && (this.array_hd7ov6$_0 = this.array_hd7ov6$_0.concat(Ir(O)), this.modCount = this.modCount + 1 | 0, !0); + }, Mr.prototype.addAll_u57x28$ = function(O, j) { + return this.checkIsMutable(), this.insertionRangeCheck_xwivfl$_0(O), O === this.size ? this.addAll_brywnq$(j) : !j.isEmpty() && (O === this.size ? this.addAll_brywnq$(j) : (this.array_hd7ov6$_0 = O === 0 ? Ir(j).concat(this.array_hd7ov6$_0) : du(this.array_hd7ov6$_0, 0, O).concat(Ir(j), du(this.array_hd7ov6$_0, O, this.size)), this.modCount = this.modCount + 1 | 0, !0)); + }, Mr.prototype.removeAt_za3lpa$ = function(O) { + return this.checkIsMutable(), this.rangeCheck_xcmk5o$_0(O), this.modCount = this.modCount + 1 | 0, O === gs(this) ? this.array_hd7ov6$_0.pop() : this.array_hd7ov6$_0.splice(O, 1)[0]; + }, Mr.prototype.remove_11rb$ = function(O) { + var j; + this.checkIsMutable(), j = this.array_hd7ov6$_0; + for (var Z = 0; Z !== j.length; ++Z) + if (T(this.array_hd7ov6$_0[Z], O)) + return this.array_hd7ov6$_0.splice(Z, 1), this.modCount = this.modCount + 1 | 0, !0; + return !1; + }, Mr.prototype.removeRange_vux9f0$ = function(O, j) { + this.checkIsMutable(), this.modCount = this.modCount + 1 | 0, this.array_hd7ov6$_0.splice(O, j - O | 0); + }, Mr.prototype.clear = function() { + this.checkIsMutable(), this.array_hd7ov6$_0 = [], this.modCount = this.modCount + 1 | 0; + }, Mr.prototype.indexOf_11rb$ = function(O) { + return pe(this.array_hd7ov6$_0, O); + }, Mr.prototype.lastIndexOf_11rb$ = function(O) { + return ae(this.array_hd7ov6$_0, O); + }, Mr.prototype.toString = function() { + return Ge(this.array_hd7ov6$_0); + }, Mr.prototype.toArray_ro6dgy$ = function(O) { + var j, Z; + if (O.length < this.size) + return l.isArray(j = this.toArray()) ? j : xi(); + var ye = l.isArray(Z = this.array_hd7ov6$_0) ? Z : xi(); + return Ba(ye, O, 0, 0, ye.length), O.length > this.size && (O[this.size] = null), O; + }, Mr.prototype.toArray = function() { + return [].slice.call(this.array_hd7ov6$_0); + }, Mr.prototype.checkIsMutable = function() { + if (this.isReadOnly_dbt2oh$_0) + throw Us(); + }, Mr.prototype.rangeCheck_xcmk5o$_0 = function(O) { + return er().checkElementIndex_6xvm5r$(O, this.size), O; + }, Mr.prototype.insertionRangeCheck_xwivfl$_0 = function(O) { + return er().checkPositionIndex_6xvm5r$(O, this.size), O; + }, Mr.$metadata$ = { kind: R, simpleName: "ArrayList", interfaces: [Mo, Er, tn] }, bi.prototype.equals_oaftn8$ = function(O, j) { + return T(O, j); + }, bi.prototype.getHashCode_s8jyv4$ = function(O) { + var j; + return (j = O != null ? oe(O) : null) != null ? j : 0; + }, bi.$metadata$ = { kind: Q, simpleName: "HashCode", interfaces: [Yt] }; + var At = null; + function Jn() { + return At === null && new bi(), At; + } + function hn() { + this.internalMap_uxhen5$_0 = null, this.equality_vgh6cm$_0 = null, this._entries_7ih87x$_0 = null; + } + function fi(O) { + this.$outer = O, ni.call(this); + } + function Ws(O, j) { + return j = j || Object.create(hn.prototype), Xn.call(j), hn.call(j), j.internalMap_uxhen5$_0 = O, j.equality_vgh6cm$_0 = O.equality, j; + } + function Eo(O) { + return O = O || Object.create(hn.prototype), Ws(new ii(Jn()), O), O; + } + function pu(O, j, Z) { + if (j === void 0 && (j = 0), Eo(Z = Z || Object.create(hn.prototype)), !(O >= 0)) + throw Gr(("Negative initial capacity: " + O).toString()); + if (!(j >= 0)) + throw Gr(("Non-positive load factor: " + j).toString()); + return Z; + } + function nn() { + this.map_8be2vx$ = null; + } + function Ys(O, j, Z) { + return j === void 0 && (j = 0), Z = Z || Object.create(nn.prototype), Gt.call(Z), nn.call(Z), Z.map_8be2vx$ = pu(O, j), Z; + } + function _n(O, j) { + return Ys(O, 0, j = j || Object.create(nn.prototype)), j; + } + function di(O, j) { + return j = j || Object.create(nn.prototype), Gt.call(j), nn.call(j), j.map_8be2vx$ = O, j; + } + function ii(O) { + this.equality_mamlu8$_0 = O, this.backingMap_0 = this.createJsMap(), this.size_x3bm7r$_0 = 0; + } + function vi(O) { + this.this$InternalHashCodeMap = O, this.state = -1, this.keys = Object.keys(O.backingMap_0), this.keyIndex = -1, this.chainOrEntry = null, this.isChain = !1, this.itemIndex = -1, this.lastEntry = null; + } + function hs() { + } + function gu(O) { + this.equality_qma612$_0 = O, this.backingMap_0 = this.createJsMap(), this.size_6u3ykz$_0 = 0; + } + function mt() { + this.head_1lr44l$_0 = null, this.map_97q5dv$_0 = null, this.isReadOnly_uhyvn5$_0 = !1; + } + function Ha(O, j, Z) { + this.$outer = O, Ln.call(this, j, Z), this.next_8be2vx$ = null, this.prev_8be2vx$ = null; + } + function Fi(O) { + this.$outer = O, ni.call(this); + } + function fs(O) { + this.$outer = O, this.last_0 = null, this.next_0 = null, this.next_0 = this.$outer.$outer.head_1lr44l$_0; + } + function mu(O) { + return Eo(O = O || Object.create(mt.prototype)), mt.call(O), O.map_97q5dv$_0 = Eo(), O; + } + function Ec(O, j, Z) { + return j === void 0 && (j = 0), pu(O, j, Z = Z || Object.create(mt.prototype)), mt.call(Z), Z.map_97q5dv$_0 = Eo(), Z; + } + function Pi() { + } + function yu(O) { + return O = O || Object.create(Pi.prototype), di(mu(), O), Pi.call(O), O; + } + function _u(O, j, Z) { + return j === void 0 && (j = 0), Z = Z || Object.create(Pi.prototype), di(Ec(O, j), Z), Pi.call(Z), Z; + } + function bu(O, j) { + return _u(O, 0, j = j || Object.create(Pi.prototype)), j; + } + function Mo() { + } + function ta() { + } + function Do(O) { + ta.call(this), this.outputStream = O; + } + function Fr() { + ta.call(this), this.buffer = ""; + } + function ra() { + Fr.call(this); + } + function Va(O, j) { + this.delegate_0 = O, this.result_0 = j; + } + function Xs(O, j) { + this.closure$context = O, this.closure$resumeWith = j; + } + function xi() { + throw new Li("Illegal cast"); + } + function kl(O) { + throw On(O); + } + function ba() { + } + function ko() { + } + function Ht() { + } + function Nr(O) { + this.jClass_1ppatx$_0 = O; + } + function gr(O) { + var j; + Nr.call(this, O), this.simpleName_m7mxi0$_0 = (j = O.$metadata$) != null ? j.simpleName : null; + } + function z(O, j, Z) { + Nr.call(this, O), this.givenSimpleName_0 = j, this.isInstanceFunction_0 = Z; + } + function J() { + ve = this, Nr.call(this, Object), this.simpleName_lnzy73$_0 = "Nothing"; + } + Yt.$metadata$ = { kind: G, simpleName: "EqualityComparator", interfaces: [] }, fi.prototype.add_11rb$ = function(O) { + throw cs("Add is not supported on entries"); + }, fi.prototype.clear = function() { + this.$outer.clear(); + }, fi.prototype.containsEntry_kw6fkd$ = function(O) { + return this.$outer.containsEntry_8hxqw4$(O); + }, fi.prototype.iterator = function() { + return this.$outer.internalMap_uxhen5$_0.iterator(); + }, fi.prototype.removeEntry_kw6fkd$ = function(O) { + return !!He(this, O) && (this.$outer.remove_11rb$(O.key), !0); + }, Object.defineProperty(fi.prototype, "size", { configurable: !0, get: function() { + return this.$outer.size; + } }), fi.$metadata$ = { kind: R, simpleName: "EntrySet", interfaces: [ni] }, hn.prototype.clear = function() { + this.internalMap_uxhen5$_0.clear(); + }, hn.prototype.containsKey_11rb$ = function(O) { + return this.internalMap_uxhen5$_0.contains_11rb$(O); + }, hn.prototype.containsValue_11rc$ = function(O) { + var j, Z = this.internalMap_uxhen5$_0; + e: + do { + var ye; + if (l.isType(Z, ar) && Z.isEmpty()) { + j = !1; + break e; + } + for (ye = Z.iterator(); ye.hasNext(); ) { + var Be = ye.next(); + if (this.equality_vgh6cm$_0.equals_oaftn8$(Be.value, O)) { + j = !0; + break e; + } + } + j = !1; + } while (0); + return j; + }, Object.defineProperty(hn.prototype, "entries", { configurable: !0, get: function() { + return this._entries_7ih87x$_0 == null && (this._entries_7ih87x$_0 = this.createEntrySet()), fe(this._entries_7ih87x$_0); + } }), hn.prototype.createEntrySet = function() { + return new fi(this); + }, hn.prototype.get_11rb$ = function(O) { + return this.internalMap_uxhen5$_0.get_11rb$(O); + }, hn.prototype.put_xwzc9p$ = function(O, j) { + return this.internalMap_uxhen5$_0.put_xwzc9p$(O, j); + }, hn.prototype.remove_11rb$ = function(O) { + return this.internalMap_uxhen5$_0.remove_11rb$(O); + }, Object.defineProperty(hn.prototype, "size", { configurable: !0, get: function() { + return this.internalMap_uxhen5$_0.size; + } }), hn.$metadata$ = { kind: R, simpleName: "HashMap", interfaces: [Xn, st] }, nn.prototype.add_11rb$ = function(O) { + return this.map_8be2vx$.put_xwzc9p$(O, this) == null; + }, nn.prototype.clear = function() { + this.map_8be2vx$.clear(); + }, nn.prototype.contains_11rb$ = function(O) { + return this.map_8be2vx$.containsKey_11rb$(O); + }, nn.prototype.isEmpty = function() { + return this.map_8be2vx$.isEmpty(); + }, nn.prototype.iterator = function() { + return this.map_8be2vx$.keys.iterator(); + }, nn.prototype.remove_11rb$ = function(O) { + return this.map_8be2vx$.remove_11rb$(O) != null; + }, Object.defineProperty(nn.prototype, "size", { configurable: !0, get: function() { + return this.map_8be2vx$.size; + } }), nn.$metadata$ = { kind: R, simpleName: "HashSet", interfaces: [Gt, qe] }, Object.defineProperty(ii.prototype, "equality", { get: function() { + return this.equality_mamlu8$_0; + } }), Object.defineProperty(ii.prototype, "size", { configurable: !0, get: function() { + return this.size_x3bm7r$_0; + }, set: function(O) { + this.size_x3bm7r$_0 = O; + } }), ii.prototype.put_xwzc9p$ = function(O, j) { + var Z = this.equality.getHashCode_s8jyv4$(O), ye = this.getChainOrEntryOrNull_0(Z); + if (ye == null) + this.backingMap_0[Z] = new Ln(O, j); + else { + if (!l.isArray(ye)) { + var Be = ye; + return this.equality.equals_oaftn8$(Be.key, O) ? Be.setValue_11rc$(j) : (this.backingMap_0[Z] = [Be, new Ln(O, j)], this.size = this.size + 1 | 0, null); + } + var lt = ye, Lt = this.findEntryInChain_0(lt, O); + if (Lt != null) + return Lt.setValue_11rc$(j); + lt.push(new Ln(O, j)); + } + return this.size = this.size + 1 | 0, null; + }, ii.prototype.remove_11rb$ = function(O) { + var j, Z = this.equality.getHashCode_s8jyv4$(O); + if ((j = this.getChainOrEntryOrNull_0(Z)) == null) + return null; + var ye = j; + if (!l.isArray(ye)) { + var Be = ye; + return this.equality.equals_oaftn8$(Be.key, O) ? (delete this.backingMap_0[Z], this.size = this.size - 1 | 0, Be.value) : null; + } + for (var lt = ye, Lt = 0; Lt !== lt.length; ++Lt) { + var br = lt[Lt]; + if (this.equality.equals_oaftn8$(O, br.key)) + return lt.length === 1 ? (lt.length = 0, delete this.backingMap_0[Z]) : lt.splice(Lt, 1), this.size = this.size - 1 | 0, br.value; + } + return null; + }, ii.prototype.clear = function() { + this.backingMap_0 = this.createJsMap(), this.size = 0; + }, ii.prototype.contains_11rb$ = function(O) { + return this.getEntry_0(O) != null; + }, ii.prototype.get_11rb$ = function(O) { + var j; + return (j = this.getEntry_0(O)) != null ? j.value : null; + }, ii.prototype.getEntry_0 = function(O) { + var j; + if ((j = this.getChainOrEntryOrNull_0(this.equality.getHashCode_s8jyv4$(O))) == null) + return null; + var Z = j; + if (l.isArray(Z)) { + var ye = Z; + return this.findEntryInChain_0(ye, O); + } + var Be = Z; + return this.equality.equals_oaftn8$(Be.key, O) ? Be : null; + }, ii.prototype.findEntryInChain_0 = function(O, j) { + var Z; + e: + do { + var ye; + for (ye = 0; ye !== O.length; ++ye) { + var Be = O[ye]; + if (this.equality.equals_oaftn8$(Be.key, j)) { + Z = Be; + break e; + } + } + Z = null; + } while (0); + return Z; + }, vi.prototype.computeNext_0 = function() { + if (this.chainOrEntry != null && this.isChain) { + var O = this.chainOrEntry.length; + if (this.itemIndex = this.itemIndex + 1 | 0, this.itemIndex < O) + return 0; + } + return this.keyIndex = this.keyIndex + 1 | 0, this.keyIndex < this.keys.length ? (this.chainOrEntry = this.this$InternalHashCodeMap.backingMap_0[this.keys[this.keyIndex]], this.isChain = l.isArray(this.chainOrEntry), this.itemIndex = 0, 0) : (this.chainOrEntry = null, 1); + }, vi.prototype.hasNext = function() { + return this.state === -1 && (this.state = this.computeNext_0()), this.state === 0; + }, vi.prototype.next = function() { + if (!this.hasNext()) + throw ei(); + var O = this.isChain ? this.chainOrEntry[this.itemIndex] : this.chainOrEntry; + return this.lastEntry = O, this.state = -1, O; + }, vi.prototype.remove = function() { + if (this.lastEntry == null) + throw On("Required value was null.".toString()); + this.this$InternalHashCodeMap.remove_11rb$(fe(this.lastEntry).key), this.lastEntry = null, this.itemIndex = this.itemIndex - 1 | 0; + }, vi.$metadata$ = { kind: R, interfaces: [Vr] }, ii.prototype.iterator = function() { + return new vi(this); + }, ii.prototype.getChainOrEntryOrNull_0 = function(O) { + var j = this.backingMap_0[O]; + return j === void 0 ? null : j; + }, ii.$metadata$ = { kind: R, simpleName: "InternalHashCodeMap", interfaces: [hs] }, hs.prototype.createJsMap = function() { + var O = /* @__PURE__ */ Object.create(null); + return O.foo = 1, delete O.foo, O; + }, hs.$metadata$ = { kind: G, simpleName: "InternalMap", interfaces: [_r] }, Ha.prototype.setValue_11rc$ = function(O) { + return this.$outer.checkIsMutable(), Ln.prototype.setValue_11rc$.call(this, O); + }, Ha.$metadata$ = { kind: R, simpleName: "ChainEntry", interfaces: [Ln] }, fs.prototype.hasNext = function() { + return this.next_0 !== null; + }, fs.prototype.next = function() { + if (!this.hasNext()) + throw ei(); + var O = fe(this.next_0); + this.last_0 = O; + var j = O.next_8be2vx$; + return this.$outer.$outer, this.next_0 = j !== this.$outer.$outer.head_1lr44l$_0 ? j : null, O; + }, fs.prototype.remove = function() { + if (this.last_0 == null) + throw On("Check failed.".toString()); + this.$outer.checkIsMutable(), this.$outer.$outer.remove_njjxy0$_0(fe(this.last_0)), this.$outer.$outer.map_97q5dv$_0.remove_11rb$(fe(this.last_0).key), this.last_0 = null; + }, fs.$metadata$ = { kind: R, simpleName: "EntryIterator", interfaces: [Vr] }, Fi.prototype.add_11rb$ = function(O) { + throw cs("Add is not supported on entries"); + }, Fi.prototype.clear = function() { + this.$outer.clear(); + }, Fi.prototype.containsEntry_kw6fkd$ = function(O) { + return this.$outer.containsEntry_8hxqw4$(O); + }, Fi.prototype.iterator = function() { + return new fs(this); + }, Fi.prototype.removeEntry_kw6fkd$ = function(O) { + return this.checkIsMutable(), !!He(this, O) && (this.$outer.remove_11rb$(O.key), !0); + }, Object.defineProperty(Fi.prototype, "size", { configurable: !0, get: function() { + return this.$outer.size; + } }), Fi.prototype.checkIsMutable = function() { + this.$outer.checkIsMutable(); + }, Fi.$metadata$ = { kind: R, simpleName: "EntrySet", interfaces: [ni] }, mt.prototype.addToEnd_lfi3hf$_0 = function(O) { + if (O.next_8be2vx$ != null || O.prev_8be2vx$ != null) + throw On("Check failed.".toString()); + var j = this.head_1lr44l$_0; + if (j == null) + this.head_1lr44l$_0 = O, O.next_8be2vx$ = O, O.prev_8be2vx$ = O; + else { + var Z = j.prev_8be2vx$; + if (Z == null) + throw On("Required value was null.".toString()); + var ye = Z; + O.prev_8be2vx$ = ye, O.next_8be2vx$ = j, j.prev_8be2vx$ = O, ye.next_8be2vx$ = O; + } + }, mt.prototype.remove_njjxy0$_0 = function(O) { + O.next_8be2vx$ === O ? this.head_1lr44l$_0 = null : (this.head_1lr44l$_0 === O && (this.head_1lr44l$_0 = O.next_8be2vx$), fe(O.next_8be2vx$).prev_8be2vx$ = O.prev_8be2vx$, fe(O.prev_8be2vx$).next_8be2vx$ = O.next_8be2vx$), O.next_8be2vx$ = null, O.prev_8be2vx$ = null; + }, mt.prototype.build = function() { + return this.checkIsMutable(), this.isReadOnly_uhyvn5$_0 = !0, this; + }, mt.prototype.clear = function() { + this.checkIsMutable(), this.map_97q5dv$_0.clear(), this.head_1lr44l$_0 = null; + }, mt.prototype.containsKey_11rb$ = function(O) { + return this.map_97q5dv$_0.containsKey_11rb$(O); + }, mt.prototype.containsValue_11rc$ = function(O) { + var j; + if ((j = this.head_1lr44l$_0) == null) + return !1; + var Z = j; + do { + if (T(Z.value, O)) + return !0; + Z = fe(Z.next_8be2vx$); + } while (Z !== this.head_1lr44l$_0); + return !1; + }, mt.prototype.createEntrySet = function() { + return new Fi(this); + }, mt.prototype.get_11rb$ = function(O) { + var j; + return (j = this.map_97q5dv$_0.get_11rb$(O)) != null ? j.value : null; + }, mt.prototype.put_xwzc9p$ = function(O, j) { + this.checkIsMutable(); + var Z = this.map_97q5dv$_0.get_11rb$(O); + if (Z == null) { + var ye = new Ha(this, O, j); + return this.map_97q5dv$_0.put_xwzc9p$(O, ye), this.addToEnd_lfi3hf$_0(ye), null; + } + return Z.setValue_11rc$(j); + }, mt.prototype.remove_11rb$ = function(O) { + this.checkIsMutable(); + var j = this.map_97q5dv$_0.remove_11rb$(O); + return j != null ? (this.remove_njjxy0$_0(j), j.value) : null; + }, Object.defineProperty(mt.prototype, "size", { configurable: !0, get: function() { + return this.map_97q5dv$_0.size; + } }), mt.prototype.checkIsMutable = function() { + if (this.isReadOnly_uhyvn5$_0) + throw Us(); + }, mt.$metadata$ = { kind: R, simpleName: "LinkedHashMap", interfaces: [hn, st] }, Pi.prototype.build = function() { + var O; + return (l.isType(O = this.map_8be2vx$, mt) ? O : xi()).build(), this; + }, Pi.prototype.checkIsMutable = function() { + this.map_8be2vx$.checkIsMutable(); + }, Pi.$metadata$ = { kind: R, simpleName: "LinkedHashSet", interfaces: [nn, qe] }, Mo.$metadata$ = { kind: G, simpleName: "RandomAccess", interfaces: [] }, ta.prototype.println = function() { + this.print_s8jyv4$(` +`); + }, ta.prototype.println_s8jyv4$ = function(O) { + this.print_s8jyv4$(O), this.println(); + }, ta.prototype.flush = function() { + }, ta.$metadata$ = { kind: R, simpleName: "BaseOutput", interfaces: [] }, Do.prototype.print_s8jyv4$ = function(O) { + var j = String(O); + this.outputStream.write(j); + }, Do.$metadata$ = { kind: R, simpleName: "NodeJsOutput", interfaces: [ta] }, Fr.prototype.print_s8jyv4$ = function(O) { + this.buffer += String(O); + }, Fr.prototype.flush = function() { + this.buffer = ""; + }, Fr.$metadata$ = { kind: R, simpleName: "BufferedOutput", interfaces: [ta] }, ra.prototype.print_s8jyv4$ = function(O) { + var j = String(O), Z = j.lastIndexOf(` +`, 0); + Z >= 0 && (this.buffer = this.buffer + j.substring(0, Z), this.flush(), j = j.substring(Z + 1 | 0)), this.buffer = this.buffer + j; + }, ra.prototype.flush = function() { + console.log(this.buffer), this.buffer = ""; + }, ra.$metadata$ = { kind: R, simpleName: "BufferedOutputToConsoleLog", interfaces: [Fr] }, Object.defineProperty(Va.prototype, "context", { configurable: !0, get: function() { + return this.delegate_0.context; + } }), Va.prototype.resumeWith_tl1gpc$ = function(O) { + var j = this.result_0; + if (j === Eu()) + this.result_0 = O.value; + else { + if (j !== el()) + throw On("Already resumed"); + this.result_0 = tl(), this.delegate_0.resumeWith_tl1gpc$(O); + } + }, Va.prototype.getOrThrow = function() { + var O; + if (this.result_0 === Eu()) + return this.result_0 = el(), el(); + var j = this.result_0; + if (j === tl()) + O = el(); + else { + if (l.isType(j, oa)) + throw j.exception; + O = j; + } + return O; + }, Va.$metadata$ = { kind: R, simpleName: "SafeContinuation", interfaces: [Iu] }, Object.defineProperty(Xs.prototype, "context", { configurable: !0, get: function() { + return this.closure$context; + } }), Xs.prototype.resumeWith_tl1gpc$ = function(O) { + this.closure$resumeWith(O); + }, Xs.$metadata$ = { kind: R, interfaces: [Iu] }, ba.$metadata$ = { kind: G, simpleName: "Serializable", interfaces: [] }, ko.$metadata$ = { kind: G, simpleName: "KCallable", interfaces: [] }, Ht.$metadata$ = { kind: G, simpleName: "KClass", interfaces: [Rv] }, Object.defineProperty(Nr.prototype, "jClass", { get: function() { + return this.jClass_1ppatx$_0; + } }), Object.defineProperty(Nr.prototype, "qualifiedName", { configurable: !0, get: function() { + throw new zl(); + } }), Nr.prototype.equals = function(O) { + return l.isType(O, Nr) && T(this.jClass, O.jClass); + }, Nr.prototype.hashCode = function() { + var O, j; + return (j = (O = this.simpleName) != null ? oe(O) : null) != null ? j : 0; + }, Nr.prototype.toString = function() { + return "class " + $(this.simpleName); + }, Nr.$metadata$ = { kind: R, simpleName: "KClassImpl", interfaces: [Ht] }, Object.defineProperty(gr.prototype, "simpleName", { configurable: !0, get: function() { + return this.simpleName_m7mxi0$_0; + } }), gr.prototype.isInstance_s8jyv4$ = function(O) { + var j = this.jClass; + return l.isType(O, j); + }, gr.$metadata$ = { kind: R, simpleName: "SimpleKClassImpl", interfaces: [Nr] }, z.prototype.equals = function(O) { + return !!l.isType(O, z) && Nr.prototype.equals.call(this, O) && T(this.givenSimpleName_0, O.givenSimpleName_0); + }, Object.defineProperty(z.prototype, "simpleName", { configurable: !0, get: function() { + return this.givenSimpleName_0; + } }), z.prototype.isInstance_s8jyv4$ = function(O) { + return this.isInstanceFunction_0(O); + }, z.$metadata$ = { kind: R, simpleName: "PrimitiveKClassImpl", interfaces: [Nr] }, Object.defineProperty(J.prototype, "simpleName", { configurable: !0, get: function() { + return this.simpleName_lnzy73$_0; + } }), J.prototype.isInstance_s8jyv4$ = function(O) { + return !1; + }, Object.defineProperty(J.prototype, "jClass", { configurable: !0, get: function() { + throw cs("There's no native JS class for Nothing type"); + } }), J.prototype.equals = function(O) { + return O === this; + }, J.prototype.hashCode = function() { + return 0; + }, J.$metadata$ = { kind: Q, simpleName: "NothingKClassImpl", interfaces: [Nr] }; + var ve = null; + function ke() { + return ve === null && new J(), ve; + } + function it() { + } + function ht() { + } + function Et() { + } + function Qt() { + } + function lr() { + } + function zn() { + } + function Bn() { + } + function na() { + pf = this, this.anyClass = new z(Object, "Any", uo), this.numberClass = new z(Number, "Number", ds), this.nothingClass = ke(), this.booleanClass = new z(Boolean, "Boolean", co), this.byteClass = new z(Number, "Byte", Zs), this.shortClass = new z(Number, "Short", vs), this.intClass = new z(Number, "Int", Ex), this.floatClass = new z(Number, "Float", Mx), this.doubleClass = new z(Number, "Double", Dx), this.arrayClass = new z(Array, "Array", kx), this.stringClass = new z(String, "String", Ox), this.throwableClass = new z(Error, "Throwable", Lx), this.booleanArrayClass = new z(Array, "BooleanArray", Px), this.charArrayClass = new z(Uint16Array, "CharArray", wm), this.byteArrayClass = new z(Int8Array, "ByteArray", Rx), this.shortArrayClass = new z(Int16Array, "ShortArray", Nx), this.intArrayClass = new z(Int32Array, "IntArray", zx), this.longArrayClass = new z(Array, "LongArray", Cm), this.floatArrayClass = new z(Float32Array, "FloatArray", Bx), this.doubleArrayClass = new z(Float64Array, "DoubleArray", Tm); + } + function uo(O) { + return l.isType(O, K); + } + function ds(O) { + return l.isNumber(O); + } + function co(O) { + return typeof O == "boolean"; + } + function Zs(O) { + return typeof O == "number"; + } + function vs(O) { + return typeof O == "number"; + } + function Ex(O) { + return typeof O == "number"; + } + function Mx(O) { + return typeof O == "number"; + } + function Dx(O) { + return typeof O == "number"; + } + function kx(O) { + return l.isArray(O); + } + function Ox(O) { + return typeof O == "string"; + } + function Lx(O) { + return l.isType(O, xe); + } + function Px(O) { + return l.isBooleanArray(O); + } + function wm(O) { + return l.isCharArray(O); + } + function Rx(O) { + return l.isByteArray(O); + } + function Nx(O) { + return l.isShortArray(O); + } + function zx(O) { + return l.isIntArray(O); + } + function Cm(O) { + return l.isLongArray(O); + } + function Bx(O) { + return l.isFloatArray(O); + } + function Tm(O) { + return l.isDoubleArray(O); + } + Object.defineProperty(it.prototype, "simpleName", { configurable: !0, get: function() { + throw On("Unknown simpleName for ErrorKClass".toString()); + } }), Object.defineProperty(it.prototype, "qualifiedName", { configurable: !0, get: function() { + throw On("Unknown qualifiedName for ErrorKClass".toString()); + } }), it.prototype.isInstance_s8jyv4$ = function(O) { + throw On("Can's check isInstance on ErrorKClass".toString()); + }, it.prototype.equals = function(O) { + return O === this; + }, it.prototype.hashCode = function() { + return 0; + }, it.$metadata$ = { kind: R, simpleName: "ErrorKClass", interfaces: [Ht] }, ht.$metadata$ = { kind: G, simpleName: "KProperty", interfaces: [ko] }, Et.$metadata$ = { kind: G, simpleName: "KMutableProperty", interfaces: [ht] }, Qt.$metadata$ = { kind: G, simpleName: "KProperty0", interfaces: [ht] }, lr.$metadata$ = { kind: G, simpleName: "KMutableProperty0", interfaces: [Et, Qt] }, zn.$metadata$ = { kind: G, simpleName: "KProperty1", interfaces: [ht] }, Bn.$metadata$ = { kind: G, simpleName: "KMutableProperty1", interfaces: [Et, zn] }, na.prototype.functionClass = function(O) { + var j, Z, ye; + if ((j = pv[O]) != null) + Z = j; + else { + var Be = new z(Function, "Function" + O, (ye = O, function(lt) { + return typeof lt == "function" && lt.length === ye; + })); + pv[O] = Be, Z = Be; + } + return Z; + }, na.$metadata$ = { kind: Q, simpleName: "PrimitiveClasses", interfaces: [] }; + var pv, pf = null; + function pi() { + return pf === null && new na(), pf; + } + function Im(O) { + return Array.isArray(O) ? Am(O) : gf(O); + } + function Am(O) { + switch (O.length) { + case 1: + return gf(O[0]); + case 0: + return ke(); + default: + return new it(); + } + } + function gf(O) { + var j; + if (O === String) + return pi().stringClass; + var Z = O.$metadata$; + if (Z != null) + if (Z.$kClass$ == null) { + var ye = new gr(O); + Z.$kClass$ = ye, j = ye; + } else + j = Z.$kClass$; + else + j = new gr(O); + return j; + } + function gv(O) { + O.lastIndex = 0; + } + function mv() { + } + function cr(O) { + this.string_0 = O !== void 0 ? O : ""; + } + function yv(O) { + return O = O || Object.create(cr.prototype), cr.call(O, ""), O; + } + function _v(O) { + var j = String.fromCharCode(O).toUpperCase(); + return j.length > 1 ? O : j.charCodeAt(0); + } + function Em(O) { + return new Ct(de.MIN_HIGH_SURROGATE, de.MAX_HIGH_SURROGATE).contains_mef7kx$(O); + } + function Mm(O) { + return new Ct(de.MIN_LOW_SURROGATE, de.MAX_LOW_SURROGATE).contains_mef7kx$(O); + } + function Oo(O) { + this.value = O; + } + function Ci(O, j) { + mf(), this.pattern = O, this.options = ge(j), this.nativePattern_0 = new RegExp(O, we(j, "", "gu", void 0, void 0, void 0, Fx)); + } + function jx(O) { + return O.next(); + } + function Mc() { + bv = this, this.patternEscape_0 = new RegExp("[\\\\^$*+?.()|[\\]{}]", "g"), this.replacementEscape_0 = new RegExp("\\$", "g"); + } + mv.$metadata$ = { kind: G, simpleName: "Appendable", interfaces: [] }, Object.defineProperty(cr.prototype, "length", { configurable: !0, get: function() { + return this.string_0.length; + } }), cr.prototype.charCodeAt = function(O) { + var j = this.string_0; + if (!(O >= 0 && O <= rl(j))) + throw new Tn("index: " + O + ", length: " + this.length + "}"); + return j.charCodeAt(O); + }, cr.prototype.subSequence_vux9f0$ = function(O, j) { + return this.string_0.substring(O, j); + }, cr.prototype.append_s8itvh$ = function(O) { + return this.string_0 += String.fromCharCode(O), this; + }, cr.prototype.append_gw00v9$ = function(O) { + return this.string_0 += $(O), this; + }, cr.prototype.append_ezbsdh$ = function(O, j, Z) { + return this.appendRange_3peag4$(O != null ? O : "null", j, Z); + }, cr.prototype.reverse = function() { + for (var O, j, Z = "", ye = this.string_0.length - 1 | 0; ye >= 0; ) { + var Be = this.string_0.charCodeAt((ye = (O = ye) - 1 | 0, O)); + if (Mm(Be) && ye >= 0) { + var lt = this.string_0.charCodeAt((ye = (j = ye) - 1 | 0, j)); + Z = Em(lt) ? Z + String.fromCharCode(C(lt)) + String.fromCharCode(C(Be)) : Z + String.fromCharCode(C(Be)) + String.fromCharCode(C(lt)); + } else + Z += String.fromCharCode(Be); + } + return this.string_0 = Z, this; + }, cr.prototype.append_s8jyv4$ = function(O) { + return this.string_0 += $(O), this; + }, cr.prototype.append_6taknv$ = function(O) { + return this.string_0 += O, this; + }, cr.prototype.append_4hbowm$ = function(O) { + return this.string_0 += yf(O), this; + }, cr.prototype.append_61zpoe$ = function(O) { + return this.append_pdl1vj$(O); + }, cr.prototype.append_pdl1vj$ = function(O) { + return this.string_0 = this.string_0 + (O != null ? O : "null"), this; + }, cr.prototype.capacity = function() { + return this.length; + }, cr.prototype.ensureCapacity_za3lpa$ = function(O) { + }, cr.prototype.indexOf_61zpoe$ = function(O) { + return this.string_0.indexOf(O); + }, cr.prototype.indexOf_bm4lxs$ = function(O, j) { + return this.string_0.indexOf(O, j); + }, cr.prototype.lastIndexOf_61zpoe$ = function(O) { + return this.string_0.lastIndexOf(O); + }, cr.prototype.lastIndexOf_bm4lxs$ = function(O, j) { + return O.length === 0 && j < 0 ? -1 : this.string_0.lastIndexOf(O, j); + }, cr.prototype.insert_fzusl$ = function(O, j) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + $(j) + this.string_0.substring(O), this; + }, cr.prototype.insert_6t1mh3$ = function(O, j) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + String.fromCharCode(C(j)) + this.string_0.substring(O), this; + }, cr.prototype.insert_7u455s$ = function(O, j) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + yf(j) + this.string_0.substring(O), this; + }, cr.prototype.insert_1u9bqd$ = function(O, j) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + $(j) + this.string_0.substring(O), this; + }, cr.prototype.insert_6t2rgq$ = function(O, j) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + $(j) + this.string_0.substring(O), this; + }, cr.prototype.insert_19mbxw$ = function(O, j) { + return this.insert_vqvrqt$(O, j); + }, cr.prototype.insert_vqvrqt$ = function(O, j) { + er().checkPositionIndex_6xvm5r$(O, this.length); + var Z = j != null ? j : "null"; + return this.string_0 = this.string_0.substring(0, O) + Z + this.string_0.substring(O), this; + }, cr.prototype.setLength_za3lpa$ = function(O) { + if (O < 0) + throw Gr("Negative new length: " + O + "."); + if (O <= this.length) + this.string_0 = this.string_0.substring(0, O); + else + for (var j = this.length; j < O; j++) + this.string_0 += String.fromCharCode(0); + }, cr.prototype.substring_za3lpa$ = function(O) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0.substring(O); + }, cr.prototype.substring_vux9f0$ = function(O, j) { + return er().checkBoundsIndexes_cub51b$(O, j, this.length), this.string_0.substring(O, j); + }, cr.prototype.trimToSize = function() { + }, cr.prototype.toString = function() { + return this.string_0; + }, cr.prototype.clear = function() { + return this.string_0 = "", this; + }, cr.prototype.set_6t1mh3$ = function(O, j) { + er().checkElementIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + String.fromCharCode(C(j)) + this.string_0.substring(O + 1 | 0); + }, cr.prototype.setRange_98i29q$ = function(O, j, Z) { + return this.checkReplaceRange_0(O, j, this.length), this.string_0 = this.string_0.substring(0, O) + Z + this.string_0.substring(j), this; + }, cr.prototype.checkReplaceRange_0 = function(O, j, Z) { + if (O < 0 || O > Z) + throw new Tn("startIndex: " + O + ", length: " + Z); + if (O > j) + throw Gr("startIndex(" + O + ") > endIndex(" + j + ")"); + }, cr.prototype.deleteAt_za3lpa$ = function(O) { + return er().checkElementIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + this.string_0.substring(O + 1 | 0), this; + }, cr.prototype.deleteRange_vux9f0$ = function(O, j) { + return this.checkReplaceRange_0(O, j, this.length), this.string_0 = this.string_0.substring(0, O) + this.string_0.substring(j), this; + }, cr.prototype.toCharArray_pqkatk$ = function(O, j, Z, ye) { + var Be; + j === void 0 && (j = 0), Z === void 0 && (Z = 0), ye === void 0 && (ye = this.length), er().checkBoundsIndexes_cub51b$(Z, ye, this.length), er().checkBoundsIndexes_cub51b$(j, j + ye - Z | 0, O.length); + for (var lt = j, Lt = Z; Lt < ye; Lt++) + O[Be = lt, lt = Be + 1 | 0, Be] = this.string_0.charCodeAt(Lt); + }, cr.prototype.appendRange_8chfmy$ = function(O, j, Z) { + return this.string_0 += xv(O, j, Z), this; + }, cr.prototype.appendRange_3peag4$ = function(O, j, Z) { + var ye = O.toString(); + return er().checkBoundsIndexes_cub51b$(j, Z, ye.length), this.string_0 += ye.substring(j, Z), this; + }, cr.prototype.insertRange_ar8yzk$ = function(O, j, Z, ye) { + return er().checkPositionIndex_6xvm5r$(O, this.length), this.string_0 = this.string_0.substring(0, O) + xv(j, Z, ye) + this.string_0.substring(O), this; + }, cr.prototype.insertRange_mnv9ne$ = function(O, j, Z, ye) { + er().checkPositionIndex_6xvm5r$(O, this.length); + var Be = j.toString(); + return er().checkBoundsIndexes_cub51b$(Z, ye, Be.length), this.string_0 = this.string_0.substring(0, O) + Be.substring(Z, ye) + this.string_0.substring(O), this; + }, cr.$metadata$ = { kind: R, simpleName: "StringBuilder", interfaces: [$t, mv] }, Oo.$metadata$ = { kind: R, simpleName: "MatchGroup", interfaces: [] }, Oo.prototype.component1 = function() { + return this.value; + }, Oo.prototype.copy_61zpoe$ = function(O) { + return new Oo(O === void 0 ? this.value : O); + }, Oo.prototype.toString = function() { + return "MatchGroup(value=" + l.toString(this.value) + ")"; + }, Oo.prototype.hashCode = function() { + var O = 0; + return 31 * O + l.hashCode(this.value) | 0; + }, Oo.prototype.equals = function(O) { + return this === O || O !== null && typeof O == "object" && Object.getPrototypeOf(this) === Object.getPrototypeOf(O) && l.equals(this.value, O.value); + }, Ci.prototype.matches_6bul2c$ = function(O) { + gv(this.nativePattern_0); + var j = this.nativePattern_0.exec(O.toString()); + return j != null && j.index === 0 && this.nativePattern_0.lastIndex === O.length; + }, Ci.prototype.containsMatchIn_6bul2c$ = function(O) { + return gv(this.nativePattern_0), this.nativePattern_0.test(O.toString()); + }, Ci.prototype.find_905azu$ = function(O, j) { + if (j === void 0 && (j = 0), j < 0 || j > O.length) + throw new Tn("Start index out of bounds: " + j + ", input length: " + O.length); + return xu(this.nativePattern_0, O.toString(), j); + }, Ci.prototype.findAll_905azu$ = function(O, j) { + if (j === void 0 && (j = 0), j < 0 || j > O.length) + throw new Tn("Start index out of bounds: " + j + ", input length: " + O.length); + return Rm((Z = O, ye = j, Be = this, function() { + return Be.find_905azu$(Z, ye); + }), jx); + var Z, ye, Be; + }, Ci.prototype.matchEntire_6bul2c$ = function(O) { + return Vm(this.pattern, 94) && Of(this.pattern, 36) ? this.find_905azu$(O) : new Ci("^" + Nv(No(this.pattern, l.charArrayOf(94)), l.charArrayOf(36)) + "$", this.options).find_905azu$(O); + }, Ci.prototype.replace_x2uqeu$ = function(O, j) { + return O.toString().replace(this.nativePattern_0, j); + }, Ci.prototype.replace_20wsma$ = g("kotlin.kotlin.text.Regex.replace_20wsma$", S(function() { + var O = u.kotlin.text.StringBuilder_init_za3lpa$, j = l.ensureNotNull; + return function(Z, ye) { + var Be = this.find_905azu$(Z); + if (Be == null) + return Z.toString(); + var lt = 0, Lt = Z.length, br = O(Lt); + do { + var mr = j(Be); + br.append_ezbsdh$(Z, lt, mr.range.start), br.append_gw00v9$(ye(mr)), lt = mr.range.endInclusive + 1 | 0, Be = mr.next(); + } while (lt < Lt && Be != null); + return lt < Lt && br.append_ezbsdh$(Z, lt, Lt), br.toString(); + }; + })), Ci.prototype.replaceFirst_x2uqeu$ = function(O, j) { + var Z, ye = this.options, Be = Cr(Lm(ye, 10)); + for (Z = ye.iterator(); Z.hasNext(); ) { + var lt = Z.next(); + Be.add_11rb$(lt.value); + } + var Lt = we(Be, ""); + return O.toString().replace(new RegExp(this.pattern, Lt), j); + }, Ci.prototype.split_905azu$ = function(O, j) { + var Z; + if (j === void 0 && (j = 0), !(j >= 0)) + throw Gr(("Limit must be non-negative, but was " + j).toString()); + var ye = this.findAll_905azu$(O), Be = j === 0 ? ye : ze(ye, j - 1 | 0), lt = $a(), Lt = 0; + for (Z = Be.iterator(); Z.hasNext(); ) { + var br = Z.next(); + lt.add_11rb$(l.subSequence(O, Lt, br.range.start).toString()), Lt = br.range.endInclusive + 1 | 0; + } + return lt.add_11rb$(l.subSequence(O, Lt, O.length).toString()), lt; + }, Ci.prototype.toString = function() { + return this.nativePattern_0.toString(); + }, Mc.prototype.fromLiteral_61zpoe$ = function(O) { + return Dm(this.escape_61zpoe$(O)); + }, Mc.prototype.escape_61zpoe$ = function(O) { + return O.replace(this.patternEscape_0, "\\$&"); + }, Mc.prototype.escapeReplacement_61zpoe$ = function(O) { + return O.replace(this.replacementEscape_0, "$$$$"); + }, Mc.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var bv = null; + function mf() { + return bv === null && new Mc(), bv; + } + function Fx(O) { + return O.value; + } + function Dm(O, j) { + return j = j || Object.create(Ci.prototype), Ci.call(j, O, Tu()), j; + } + function ps(O, j, Z, ye) { + this.closure$match = O, this.this$findNext = j, this.closure$input = Z, this.closure$range = ye, this.range_co6b9w$_0 = ye, this.groups_qcaztb$_0 = new Ga(O), this.groupValues__0 = null; + } + function Ol(O) { + this.closure$match = O, ai.call(this); + } + function Ga(O) { + this.closure$match = O, Pn.call(this); + } + function xu(O, j, Z) { + O.lastIndex = Z; + var ye = O.exec(j); + return ye == null ? null : new ps(ye, O, j, new Je(ye.index, O.lastIndex - 1 | 0)); + } + function yf(O) { + var j, Z = ""; + for (j = 0; j !== O.length; ++j) { + var ye = E(O[j]); + Z += String.fromCharCode(ye); + } + return Z; + } + function xv(O, j, Z) { + j === void 0 && (j = 0), Z === void 0 && (Z = O.length), er().checkBoundsIndexes_cub51b$(j, Z, O.length); + for (var ye = "", Be = j; Be < Z; Be++) + ye += String.fromCharCode(O[Be]); + return ye; + } + function $x(O, j, Z) { + if (Z === void 0 && (Z = !1), Z) { + var ye = O.length, Be = j.length, lt = P.min(ye, Be); + if (lt === 0) + return ye - Be | 0; + for (var Lt = 0; ; ) { + var br = P.min(Lt + 16 | 0, lt), mr = O.substring(Lt, br), an = j.substring(Lt, br); + if (!T(mr, an) && (mr = mr.toUpperCase(), an = an.toUpperCase(), !T(mr, an) && (mr = mr.toLowerCase(), an = an.toLowerCase(), !T(mr, an)))) + return l.compareTo(mr, an); + if (br === lt) + break; + Lt = br; + } + return ye - Be | 0; + } + return l.compareTo(O, j); + } + function Ll(O, j, Z, ye, Be, lt) { + return lt === void 0 && (lt = !1), Mu(O, j, Z, ye, Be, lt); + } + function Pn() { + } + function ai() { + er(), Pn.call(this); + } + function Pl(O, j, Z) { + ai.call(this), this.list_0 = O, this.fromIndex_0 = j, this._size_0 = 0, er().checkRangeIndexes_cub51b$(this.fromIndex_0, Z, this.list_0.size), this._size_0 = Z - this.fromIndex_0 | 0; + } + function Js(O) { + this.$outer = O, this.index_0 = 0; + } + function Lo(O, j) { + this.$outer = O, Js.call(this, this.$outer), er().checkPositionIndex_6xvm5r$(j, this.$outer.size), this.index_0 = j; + } + function ho() { + Sv = this; + } + Ci.$metadata$ = { kind: R, simpleName: "Regex", interfaces: [] }, Object.defineProperty(ps.prototype, "range", { configurable: !0, get: function() { + return this.range_co6b9w$_0; + } }), Object.defineProperty(ps.prototype, "value", { configurable: !0, get: function() { + return fe(this.closure$match[0]); + } }), Object.defineProperty(ps.prototype, "groups", { configurable: !0, get: function() { + return this.groups_qcaztb$_0; + } }), Object.defineProperty(Ol.prototype, "size", { configurable: !0, get: function() { + return this.closure$match.length; + } }), Ol.prototype.get_za3lpa$ = function(O) { + var j; + return (j = this.closure$match[O]) != null ? j : ""; + }, Ol.$metadata$ = { kind: R, interfaces: [ai] }, Object.defineProperty(ps.prototype, "groupValues", { configurable: !0, get: function() { + return this.groupValues__0 == null && (this.groupValues__0 = new Ol(this.closure$match)), fe(this.groupValues__0); + } }), ps.prototype.next = function() { + return xu(this.this$findNext, this.closure$input, this.closure$range.isEmpty() ? this.closure$range.start + 1 | 0 : this.closure$range.endInclusive + 1 | 0); + }, Object.defineProperty(Ga.prototype, "size", { configurable: !0, get: function() { + return this.closure$match.length; + } }), Ga.prototype.iterator = function() { + return bt(Ie(km(this)), (O = this, function(j) { + return O.get_za3lpa$(j); + })).iterator(); + var O; + }, Ga.prototype.get_za3lpa$ = function(O) { + var j; + return (j = this.closure$match[O]) != null ? new Oo(j) : null; + }, Ga.$metadata$ = { kind: R, interfaces: [Pn, Bv] }, ps.$metadata$ = { kind: R, interfaces: [Du] }, Pn.prototype.contains_11rb$ = function(O) { + var j; + e: + do { + var Z; + if (l.isType(this, ar) && this.isEmpty()) { + j = !1; + break e; + } + for (Z = this.iterator(); Z.hasNext(); ) { + var ye = Z.next(); + if (T(ye, O)) { + j = !0; + break e; + } + } + j = !1; + } while (0); + return j; + }, Pn.prototype.containsAll_brywnq$ = function(O) { + var j; + e: + do { + var Z; + if (l.isType(O, ar) && O.isEmpty()) { + j = !0; + break e; + } + for (Z = O.iterator(); Z.hasNext(); ) { + var ye = Z.next(); + if (!this.contains_11rb$(ye)) { + j = !1; + break e; + } + } + j = !0; + } while (0); + return j; + }, Pn.prototype.isEmpty = function() { + return this.size === 0; + }, Pn.prototype.toString = function() { + return we(this, ", ", "[", "]", void 0, void 0, (O = this, function(j) { + return j === O ? "(this Collection)" : $(j); + })); + var O; + }, Pn.prototype.toArray = function() { + return hi(this); + }, Pn.prototype.toArray_ro6dgy$ = function(O) { + return In(this, O); + }, Pn.$metadata$ = { kind: R, simpleName: "AbstractCollection", interfaces: [ar] }, ai.prototype.iterator = function() { + return new Js(this); + }, ai.prototype.indexOf_11rb$ = function(O) { + var j; + e: + do { + var Z, ye = 0; + for (Z = this.iterator(); Z.hasNext(); ) { + var Be = Z.next(); + if (T(Be, O)) { + j = ye; + break e; + } + ye = ye + 1 | 0; + } + j = -1; + } while (0); + return j; + }, ai.prototype.lastIndexOf_11rb$ = function(O) { + var j; + e: + do { + for (var Z = this.listIterator_za3lpa$(this.size); Z.hasPrevious(); ) + if (T(Z.previous(), O)) { + j = Z.nextIndex(); + break e; + } + j = -1; + } while (0); + return j; + }, ai.prototype.listIterator = function() { + return new Lo(this, 0); + }, ai.prototype.listIterator_za3lpa$ = function(O) { + return new Lo(this, O); + }, ai.prototype.subList_vux9f0$ = function(O, j) { + return new Pl(this, O, j); + }, Pl.prototype.get_za3lpa$ = function(O) { + return er().checkElementIndex_6xvm5r$(O, this._size_0), this.list_0.get_za3lpa$(this.fromIndex_0 + O | 0); + }, Object.defineProperty(Pl.prototype, "size", { configurable: !0, get: function() { + return this._size_0; + } }), Pl.$metadata$ = { kind: R, simpleName: "SubList", interfaces: [Mo, ai] }, ai.prototype.equals = function(O) { + return O === this || !!l.isType(O, Tr) && er().orderedEquals_e92ka7$(this, O); + }, ai.prototype.hashCode = function() { + return er().orderedHashCode_nykoif$(this); + }, Js.prototype.hasNext = function() { + return this.index_0 < this.$outer.size; + }, Js.prototype.next = function() { + var O, j; + if (!this.hasNext()) + throw ei(); + return O = this.index_0, this.index_0 = O + 1 | 0, j = O, this.$outer.get_za3lpa$(j); + }, Js.$metadata$ = { kind: R, simpleName: "IteratorImpl", interfaces: [tt] }, Lo.prototype.hasPrevious = function() { + return this.index_0 > 0; + }, Lo.prototype.nextIndex = function() { + return this.index_0; + }, Lo.prototype.previous = function() { + if (!this.hasPrevious()) + throw ei(); + return this.$outer.get_za3lpa$((this.index_0 = this.index_0 - 1 | 0, this.index_0)); + }, Lo.prototype.previousIndex = function() { + return this.index_0 - 1 | 0; + }, Lo.$metadata$ = { kind: R, simpleName: "ListIteratorImpl", interfaces: [cn, Js] }, ho.prototype.checkElementIndex_6xvm5r$ = function(O, j) { + if (O < 0 || O >= j) + throw new Tn("index: " + O + ", size: " + j); + }, ho.prototype.checkPositionIndex_6xvm5r$ = function(O, j) { + if (O < 0 || O > j) + throw new Tn("index: " + O + ", size: " + j); + }, ho.prototype.checkRangeIndexes_cub51b$ = function(O, j, Z) { + if (O < 0 || j > Z) + throw new Tn("fromIndex: " + O + ", toIndex: " + j + ", size: " + Z); + if (O > j) + throw Gr("fromIndex: " + O + " > toIndex: " + j); + }, ho.prototype.checkBoundsIndexes_cub51b$ = function(O, j, Z) { + if (O < 0 || j > Z) + throw new Tn("startIndex: " + O + ", endIndex: " + j + ", size: " + Z); + if (O > j) + throw Gr("startIndex: " + O + " > endIndex: " + j); + }, ho.prototype.orderedHashCode_nykoif$ = function(O) { + var j, Z, ye = 1; + for (j = O.iterator(); j.hasNext(); ) { + var Be = j.next(); + ye = (31 * ye | 0) + ((Z = Be != null ? oe(Be) : null) != null ? Z : 0) | 0; + } + return ye; + }, ho.prototype.orderedEquals_e92ka7$ = function(O, j) { + var Z; + if (O.size !== j.size) + return !1; + var ye = j.iterator(); + for (Z = O.iterator(); Z.hasNext(); ) { + var Be = Z.next(), lt = ye.next(); + if (!T(Be, lt)) + return !1; + } + return !0; + }, ho.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var Sv = null; + function er() { + return Sv === null && new ho(), Sv; + } + function Kn() { + kc(), this._keys_up5z3z$_0 = null, this._values_6nw1f1$_0 = null; + } + function Ks(O) { + this.this$AbstractMap = O, fo.call(this); + } + function _f(O) { + this.closure$entryIterator = O; + } + function Qs(O) { + this.this$AbstractMap = O, Pn.call(this); + } + function bf(O) { + this.closure$entryIterator = O; + } + function Dc() { + wv = this; + } + ai.$metadata$ = { kind: R, simpleName: "AbstractList", interfaces: [Tr, Pn] }, Kn.prototype.containsKey_11rb$ = function(O) { + return this.implFindEntry_8k1i24$_0(O) != null; + }, Kn.prototype.containsValue_11rc$ = function(O) { + var j, Z = this.entries; + e: + do { + var ye; + if (l.isType(Z, ar) && Z.isEmpty()) { + j = !1; + break e; + } + for (ye = Z.iterator(); ye.hasNext(); ) { + var Be = ye.next(); + if (T(Be.value, O)) { + j = !0; + break e; + } + } + j = !1; + } while (0); + return j; + }, Kn.prototype.containsEntry_8hxqw4$ = function(O) { + if (!l.isType(O, Ze)) + return !1; + var j = O.key, Z = O.value, ye = (l.isType(this, Xe) ? this : Oe()).get_11rb$(j); + if (!T(Z, ye)) + return !1; + var Be = ye == null; + return Be && (Be = !(l.isType(this, Xe) ? this : Oe()).containsKey_11rb$(j)), !Be; + }, Kn.prototype.equals = function(O) { + if (O === this) + return !0; + if (!l.isType(O, Xe) || this.size !== O.size) + return !1; + var j, Z = O.entries; + e: + do { + var ye; + if (l.isType(Z, ar) && Z.isEmpty()) { + j = !0; + break e; + } + for (ye = Z.iterator(); ye.hasNext(); ) { + var Be = ye.next(); + if (!this.containsEntry_8hxqw4$(Be)) { + j = !1; + break e; + } + } + j = !0; + } while (0); + return j; + }, Kn.prototype.get_11rb$ = function(O) { + var j; + return (j = this.implFindEntry_8k1i24$_0(O)) != null ? j.value : null; + }, Kn.prototype.hashCode = function() { + return oe(this.entries); + }, Kn.prototype.isEmpty = function() { + return this.size === 0; + }, Object.defineProperty(Kn.prototype, "size", { configurable: !0, get: function() { + return this.entries.size; + } }), Ks.prototype.contains_11rb$ = function(O) { + return this.this$AbstractMap.containsKey_11rb$(O); + }, _f.prototype.hasNext = function() { + return this.closure$entryIterator.hasNext(); + }, _f.prototype.next = function() { + return this.closure$entryIterator.next().key; + }, _f.$metadata$ = { kind: R, interfaces: [tt] }, Ks.prototype.iterator = function() { + return new _f(this.this$AbstractMap.entries.iterator()); + }, Object.defineProperty(Ks.prototype, "size", { configurable: !0, get: function() { + return this.this$AbstractMap.size; + } }), Ks.$metadata$ = { kind: R, interfaces: [fo] }, Object.defineProperty(Kn.prototype, "keys", { configurable: !0, get: function() { + return this._keys_up5z3z$_0 == null && (this._keys_up5z3z$_0 = new Ks(this)), fe(this._keys_up5z3z$_0); + } }), Kn.prototype.toString = function() { + return we(this.entries, ", ", "{", "}", void 0, void 0, (O = this, function(j) { + return O.toString_55he67$_0(j); + })); + var O; + }, Kn.prototype.toString_55he67$_0 = function(O) { + return this.toString_kthv8s$_0(O.key) + "=" + this.toString_kthv8s$_0(O.value); + }, Kn.prototype.toString_kthv8s$_0 = function(O) { + return O === this ? "(this Map)" : $(O); + }, Qs.prototype.contains_11rb$ = function(O) { + return this.this$AbstractMap.containsValue_11rc$(O); + }, bf.prototype.hasNext = function() { + return this.closure$entryIterator.hasNext(); + }, bf.prototype.next = function() { + return this.closure$entryIterator.next().value; + }, bf.$metadata$ = { kind: R, interfaces: [tt] }, Qs.prototype.iterator = function() { + return new bf(this.this$AbstractMap.entries.iterator()); + }, Object.defineProperty(Qs.prototype, "size", { configurable: !0, get: function() { + return this.this$AbstractMap.size; + } }), Qs.$metadata$ = { kind: R, interfaces: [Pn] }, Object.defineProperty(Kn.prototype, "values", { configurable: !0, get: function() { + return this._values_6nw1f1$_0 == null && (this._values_6nw1f1$_0 = new Qs(this)), fe(this._values_6nw1f1$_0); + } }), Kn.prototype.implFindEntry_8k1i24$_0 = function(O) { + var j, Z = this.entries; + e: + do { + var ye; + for (ye = Z.iterator(); ye.hasNext(); ) { + var Be = ye.next(); + if (T(Be.key, O)) { + j = Be; + break e; + } + } + j = null; + } while (0); + return j; + }, Dc.prototype.entryHashCode_9fthdn$ = function(O) { + var j, Z, ye, Be; + return ((Z = (j = O.key) != null ? oe(j) : null) != null ? Z : 0) ^ ((Be = (ye = O.value) != null ? oe(ye) : null) != null ? Be : 0); + }, Dc.prototype.entryToString_9fthdn$ = function(O) { + return $(O.key) + "=" + $(O.value); + }, Dc.prototype.entryEquals_js7fox$ = function(O, j) { + return !!l.isType(j, Ze) && T(O.key, j.key) && T(O.value, j.value); + }, Dc.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var wv = null; + function kc() { + return wv === null && new Dc(), wv; + } + function fo() { + Su(), Pn.call(this); + } + function xf() { + Cv = this; + } + Kn.$metadata$ = { kind: R, simpleName: "AbstractMap", interfaces: [Xe] }, fo.prototype.equals = function(O) { + return O === this || !!l.isType(O, rn) && Su().setEquals_y8f7en$(this, O); + }, fo.prototype.hashCode = function() { + return Su().unorderedHashCode_nykoif$(this); + }, xf.prototype.unorderedHashCode_nykoif$ = function(O) { + var j, Z = 0; + for (j = O.iterator(); j.hasNext(); ) { + var ye, Be = j.next(); + Z = Z + ((ye = Be != null ? oe(Be) : null) != null ? ye : 0) | 0; + } + return Z; + }, xf.prototype.setEquals_y8f7en$ = function(O, j) { + return O.size === j.size && O.containsAll_brywnq$(j); + }, xf.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var Cv = null; + function Su() { + return Cv === null && new xf(), Cv; + } + function qs() { + Sf = this; + } + fo.$metadata$ = { kind: R, simpleName: "AbstractSet", interfaces: [rn, Pn] }, qs.prototype.hasNext = function() { + return !1; + }, qs.prototype.hasPrevious = function() { + return !1; + }, qs.prototype.nextIndex = function() { + return 0; + }, qs.prototype.previousIndex = function() { + return -1; + }, qs.prototype.next = function() { + throw ei(); + }, qs.prototype.previous = function() { + throw ei(); + }, qs.$metadata$ = { kind: Q, simpleName: "EmptyIterator", interfaces: [cn] }; + var Sf = null; + function Oc() { + return Sf === null && new qs(), Sf; + } + function km(O) { + return new Je(0, O.size - 1 | 0); + } + function gs(O) { + return O.size - 1 | 0; + } + function Om() { + throw new _a("Index overflow has happened."); + } + function Lm(O, j) { + return l.isType(O, ar) ? O.size : j; + } + function Tv(O, j) { + return Pm(O, j, !0); + } + function Pm(O, j, Z) { + for (var ye = { v: !1 }, Be = O.iterator(); Be.hasNext(); ) + j(Be.next()) === Z && (Be.remove(), ye.v = !0); + return ye.v; + } + function Iv(O, j) { + return function(Z, ye, Be) { + var lt, Lt, br; + if (!l.isType(Z, Mo)) + return Pm(l.isType(lt = Z, _r) ? lt : xi(), ye, Be); + var mr = 0; + Lt = gs(Z); + for (var an = 0; an <= Lt; an++) { + var Bo = Z.get_za3lpa$(an); + ye(Bo) !== Be && (mr !== an && Z.set_wxm5ur$(mr, Bo), mr = mr + 1 | 0); + } + if (mr < Z.size) { + br = mr; + for (var il = gs(Z); il >= br; il--) + Z.removeAt_za3lpa$(il); + return !0; + } + return !1; + }(O, j, !0); + } + function Po() { + } + function wf() { + return Ev(); + } + function Lc() { + Av = this; + } + Po.$metadata$ = { kind: G, simpleName: "Sequence", interfaces: [] }, Lc.prototype.iterator = function() { + return Oc(); + }, Lc.prototype.drop_za3lpa$ = function(O) { + return Ev(); + }, Lc.prototype.take_za3lpa$ = function(O) { + return Ev(); + }, Lc.$metadata$ = { kind: Q, simpleName: "EmptySequence", interfaces: [wu, Po] }; + var Av = null; + function Ev() { + return Av === null && new Lc(), Av; + } + function Pc(O, j) { + this.sequence_0 = O, this.transformer_0 = j; + } + function Cf(O) { + this.this$TransformingSequence = O, this.iterator = O.sequence_0.iterator(); + } + function Tf(O, j, Z) { + this.sequence_0 = O, this.transformer_0 = j, this.iterator_0 = Z; + } + function Rc(O) { + this.this$FlatteningSequence = O, this.iterator = O.sequence_0.iterator(), this.itemIterator = null; + } + function wu() { + } + function ms(O, j, Z) { + if (this.sequence_0 = O, this.startIndex_0 = j, this.endIndex_0 = Z, !(this.startIndex_0 >= 0)) + throw Gr(("startIndex should be non-negative, but is " + this.startIndex_0).toString()); + if (!(this.endIndex_0 >= 0)) + throw Gr(("endIndex should be non-negative, but is " + this.endIndex_0).toString()); + if (!(this.endIndex_0 >= this.startIndex_0)) + throw Gr(("endIndex should be not less than startIndex, but was " + this.endIndex_0 + " < " + this.startIndex_0).toString()); + } + function Nc(O) { + this.this$SubSequence = O, this.iterator = O.sequence_0.iterator(), this.position = 0; + } + function Rl(O, j) { + if (this.sequence_0 = O, this.count_0 = j, !(this.count_0 >= 0)) + throw Gr(("count must be non-negative, but was " + this.count_0 + ".").toString()); + } + function If(O) { + this.left = O.count_0, this.iterator = O.sequence_0.iterator(); + } + function Mv(O, j) { + this.getInitialValue_0 = O, this.getNextValue_0 = j; + } + function Cu(O) { + this.this$GeneratorSequence = O, this.nextItem = null, this.nextState = -2; + } + function Rm(O, j) { + return new Mv(O, j); + } + function vo() { + Af = this, this.serialVersionUID_0 = se; + } + Cf.prototype.next = function() { + return this.this$TransformingSequence.transformer_0(this.iterator.next()); + }, Cf.prototype.hasNext = function() { + return this.iterator.hasNext(); + }, Cf.$metadata$ = { kind: R, interfaces: [tt] }, Pc.prototype.iterator = function() { + return new Cf(this); + }, Pc.prototype.flatten_1tglza$ = function(O) { + return new Tf(this.sequence_0, this.transformer_0, O); + }, Pc.$metadata$ = { kind: R, simpleName: "TransformingSequence", interfaces: [Po] }, Rc.prototype.next = function() { + if (!this.ensureItemIterator_0()) + throw ei(); + return fe(this.itemIterator).next(); + }, Rc.prototype.hasNext = function() { + return this.ensureItemIterator_0(); + }, Rc.prototype.ensureItemIterator_0 = function() { + var O; + for (((O = this.itemIterator) != null ? O.hasNext() : null) === !1 && (this.itemIterator = null); this.itemIterator == null; ) { + if (!this.iterator.hasNext()) + return !1; + var j = this.iterator.next(), Z = this.this$FlatteningSequence.iterator_0(this.this$FlatteningSequence.transformer_0(j)); + if (Z.hasNext()) + return this.itemIterator = Z, !0; + } + return !0; + }, Rc.$metadata$ = { kind: R, interfaces: [tt] }, Tf.prototype.iterator = function() { + return new Rc(this); + }, Tf.$metadata$ = { kind: R, simpleName: "FlatteningSequence", interfaces: [Po] }, wu.$metadata$ = { kind: G, simpleName: "DropTakeSequence", interfaces: [Po] }, Object.defineProperty(ms.prototype, "count_0", { configurable: !0, get: function() { + return this.endIndex_0 - this.startIndex_0 | 0; + } }), ms.prototype.drop_za3lpa$ = function(O) { + return O >= this.count_0 ? wf() : new ms(this.sequence_0, this.startIndex_0 + O | 0, this.endIndex_0); + }, ms.prototype.take_za3lpa$ = function(O) { + return O >= this.count_0 ? this : new ms(this.sequence_0, this.startIndex_0, this.startIndex_0 + O | 0); + }, Nc.prototype.drop_0 = function() { + for (; this.position < this.this$SubSequence.startIndex_0 && this.iterator.hasNext(); ) + this.iterator.next(), this.position = this.position + 1 | 0; + }, Nc.prototype.hasNext = function() { + return this.drop_0(), this.position < this.this$SubSequence.endIndex_0 && this.iterator.hasNext(); + }, Nc.prototype.next = function() { + if (this.drop_0(), this.position >= this.this$SubSequence.endIndex_0) + throw ei(); + return this.position = this.position + 1 | 0, this.iterator.next(); + }, Nc.$metadata$ = { kind: R, interfaces: [tt] }, ms.prototype.iterator = function() { + return new Nc(this); + }, ms.$metadata$ = { kind: R, simpleName: "SubSequence", interfaces: [wu, Po] }, Rl.prototype.drop_za3lpa$ = function(O) { + return O >= this.count_0 ? wf() : new ms(this.sequence_0, O, this.count_0); + }, Rl.prototype.take_za3lpa$ = function(O) { + return O >= this.count_0 ? this : new Rl(this.sequence_0, O); + }, If.prototype.next = function() { + if (this.left === 0) + throw ei(); + return this.left = this.left - 1 | 0, this.iterator.next(); + }, If.prototype.hasNext = function() { + return this.left > 0 && this.iterator.hasNext(); + }, If.$metadata$ = { kind: R, interfaces: [tt] }, Rl.prototype.iterator = function() { + return new If(this); + }, Rl.$metadata$ = { kind: R, simpleName: "TakeSequence", interfaces: [wu, Po] }, Cu.prototype.calcNext_0 = function() { + this.nextItem = this.nextState === -2 ? this.this$GeneratorSequence.getInitialValue_0() : this.this$GeneratorSequence.getNextValue_0(fe(this.nextItem)), this.nextState = this.nextItem == null ? 0 : 1; + }, Cu.prototype.next = function() { + var O; + if (this.nextState < 0 && this.calcNext_0(), this.nextState === 0) + throw ei(); + var j = l.isType(O = this.nextItem, K) ? O : xi(); + return this.nextState = -1, j; + }, Cu.prototype.hasNext = function() { + return this.nextState < 0 && this.calcNext_0(), this.nextState === 1; + }, Cu.$metadata$ = { kind: R, interfaces: [tt] }, Mv.prototype.iterator = function() { + return new Cu(this); + }, Mv.$metadata$ = { kind: R, simpleName: "GeneratorSequence", interfaces: [Po] }, vo.prototype.equals = function(O) { + return l.isType(O, rn) && O.isEmpty(); + }, vo.prototype.hashCode = function() { + return 0; + }, vo.prototype.toString = function() { + return "[]"; + }, Object.defineProperty(vo.prototype, "size", { configurable: !0, get: function() { + return 0; + } }), vo.prototype.isEmpty = function() { + return !0; + }, vo.prototype.contains_11rb$ = function(O) { + return !1; + }, vo.prototype.containsAll_brywnq$ = function(O) { + return O.isEmpty(); + }, vo.prototype.iterator = function() { + return Oc(); + }, vo.prototype.readResolve_0 = function() { + return Dv(); + }, vo.$metadata$ = { kind: Q, simpleName: "EmptySet", interfaces: [ba, rn] }; + var Af = null; + function Dv() { + return Af === null && new vo(), Af; + } + function Tu() { + return Dv(); + } + function Nm(O) { + return Ae(O, _n(O.length)); + } + function zm(O) { + switch (O.size) { + case 0: + return Tu(); + case 1: + return Ar(O.iterator().next()); + default: + return O; + } + } + function Iu() { + } + function Ef() { + Au(); + } + function Bm() { + kv = this; + } + Iu.$metadata$ = { kind: G, simpleName: "Continuation", interfaces: [] }, g("kotlin.kotlin.coroutines.suspendCoroutine_922awp$", S(function() { + var O = u.kotlin.coroutines.intrinsics.intercepted_f9mg25$, j = u.kotlin.coroutines.SafeContinuation_init_wj8d80$; + return function(Z, ye) { + return l.suspendCall((Be = Z, function(lt) { + var Lt = j(O(lt)); + return Be(Lt), Lt.getOrThrow(); + })(l.coroutineReceiver())), l.coroutineResult(l.coroutineReceiver()); + var Be; + }; + })), Bm.$metadata$ = { kind: Q, simpleName: "Key", interfaces: [Ov] }; + var kv = null; + function Au() { + return kv === null && new Bm(), kv; + } + function Ro() { + } + function Hx(O, j) { + var Z = O.minusKey_yeqjby$(j.key); + if (Z === _s()) + return j; + var ye = Z.get_j3r2sn$(Au()); + if (ye == null) + return new $n(Z, j); + var Be = Z.minusKey_yeqjby$(Au()); + return Be === _s() ? new $n(j, ye) : new $n(new $n(Be, j), ye); + } + function Ov() { + } + function ia() { + } + function zc(O) { + this.key_no4tas$_0 = O; + } + function ys() { + Lv = this, this.serialVersionUID_0 = M; + } + Ro.prototype.plus_1fupul$ = function(O) { + return O === _s() ? this : O.fold_3cc69b$(this, Hx); + }, Ov.$metadata$ = { kind: G, simpleName: "Key", interfaces: [] }, ia.prototype.get_j3r2sn$ = function(O) { + return T(this.key, O) ? l.isType(this, ia) ? this : xi() : null; + }, ia.prototype.fold_3cc69b$ = function(O, j) { + return j(O, this); + }, ia.prototype.minusKey_yeqjby$ = function(O) { + return T(this.key, O) ? _s() : this; + }, ia.$metadata$ = { kind: G, simpleName: "Element", interfaces: [Ro] }, Ro.$metadata$ = { kind: G, simpleName: "CoroutineContext", interfaces: [] }, ys.prototype.readResolve_0 = function() { + return _s(); + }, ys.prototype.get_j3r2sn$ = function(O) { + return null; + }, ys.prototype.fold_3cc69b$ = function(O, j) { + return O; + }, ys.prototype.plus_1fupul$ = function(O) { + return O; + }, ys.prototype.minusKey_yeqjby$ = function(O) { + return this; + }, ys.prototype.hashCode = function() { + return 0; + }, ys.prototype.toString = function() { + return "EmptyCoroutineContext"; + }, ys.$metadata$ = { kind: Q, simpleName: "EmptyCoroutineContext", interfaces: [ba, Ro] }; + var Lv = null; + function _s() { + return Lv === null && new ys(), Lv; + } + function $n(O, j) { + this.left_0 = O, this.element_0 = j; + } + function Vx(O, j) { + return O.length === 0 ? j.toString() : O + ", " + j; + } + function Pv(O) { + this.elements = O; + } + $n.prototype.get_j3r2sn$ = function(O) { + for (var j, Z = this; ; ) { + if ((j = Z.element_0.get_j3r2sn$(O)) != null) + return j; + var ye = Z.left_0; + if (!l.isType(ye, $n)) + return ye.get_j3r2sn$(O); + Z = ye; + } + }, $n.prototype.fold_3cc69b$ = function(O, j) { + return j(this.left_0.fold_3cc69b$(O, j), this.element_0); + }, $n.prototype.minusKey_yeqjby$ = function(O) { + if (this.element_0.get_j3r2sn$(O) != null) + return this.left_0; + var j = this.left_0.minusKey_yeqjby$(O); + return j === this.left_0 ? this : j === _s() ? this.element_0 : new $n(j, this.element_0); + }, $n.prototype.size_0 = function() { + for (var O, j, Z = this, ye = 2; ; ) { + if ((j = l.isType(O = Z.left_0, $n) ? O : null) == null) + return ye; + Z = j, ye = ye + 1 | 0; + } + }, $n.prototype.contains_0 = function(O) { + return T(this.get_j3r2sn$(O.key), O); + }, $n.prototype.containsAll_0 = function(O) { + for (var j, Z = O; ; ) { + if (!this.contains_0(Z.element_0)) + return !1; + var ye = Z.left_0; + if (!l.isType(ye, $n)) + return this.contains_0(l.isType(j = ye, ia) ? j : xi()); + Z = ye; + } + }, $n.prototype.equals = function(O) { + return this === O || l.isType(O, $n) && O.size_0() === this.size_0() && O.containsAll_0(this); + }, $n.prototype.hashCode = function() { + return oe(this.left_0) + oe(this.element_0) | 0; + }, $n.prototype.toString = function() { + return "[" + this.fold_3cc69b$("", Vx) + "]"; + }, $n.prototype.writeReplace_0 = function() { + var O, j, Z, ye = this.size_0(), Be = l.newArray(ye, null), lt = { v: 0 }; + if (this.fold_3cc69b$(ui(), (j = Be, Z = lt, function(Lt, br) { + var mr; + return j[mr = Z.v, Z.v = mr + 1 | 0, mr] = br, nt; + })), lt.v !== ye) + throw On("Check failed.".toString()); + return new Pv(l.isArray(O = Be) ? O : xi()); + }; + var jm, Fm, $m; + function el() { + return Df(); + } + function xa(O, j) { + ce.call(this), this.name$ = O, this.ordinal$ = j; + } + function Mf() { + Mf = function() { + }, jm = new xa("COROUTINE_SUSPENDED", 0), Fm = new xa("UNDECIDED", 1), $m = new xa("RESUMED", 2); + } + function Df() { + return Mf(), jm; + } + function Eu() { + return Mf(), Fm; + } + function tl() { + return Mf(), $m; + } + function Rv() { + } + function Hm(O, j, Z) { + Z != null ? O.append_gw00v9$(Z(j)) : j == null || l.isCharSequence(j) ? O.append_gw00v9$(j) : l.isChar(j) ? O.append_s8itvh$(E(j)) : O.append_gw00v9$($(j)); + } + function kf(O, j, Z) { + if (Z === void 0 && (Z = !1), O === j) + return !0; + if (!Z) + return !1; + var ye = _v(O), Be = _v(j), lt = ye === Be; + return lt || (lt = String.fromCharCode(ye).toLowerCase().charCodeAt(0) === String.fromCharCode(Be).toLowerCase().charCodeAt(0)), lt; + } + function No(O, j) { + var Z, ye, Be = l.isCharSequence(Z = O) ? Z : Oe(); + e: + do { + var lt, Lt, br, mr; + Lt = (lt = zv(Be)).first, br = lt.last, mr = lt.step; + for (var an = Lt; an <= br; an += mr) + if (!te(j, E(C(Be.charCodeAt(an))))) { + ye = l.subSequence(Be, an, Be.length); + break e; + } + ye = ""; + } while (0); + return ye.toString(); + } + function Nv(O, j) { + var Z, ye, Be = l.isCharSequence(Z = O) ? Z : Oe(); + e: + do { + var lt; + for (lt = et(zv(Be)).iterator(); lt.hasNext(); ) { + var Lt = lt.next(); + if (!te(j, E(C(Be.charCodeAt(Lt))))) { + ye = l.subSequence(Be, 0, Lt + 1 | 0); + break e; + } + } + ye = ""; + } while (0); + return ye.toString(); + } + function bs(O) { + this.this$iterator = O, Re.call(this), this.index_0 = 0; + } + function zv(O) { + return new Je(0, O.length - 1 | 0); + } + function rl(O) { + return O.length - 1 | 0; + } + function Mu(O, j, Z, ye, Be, lt) { + if (ye < 0 || j < 0 || j > (O.length - Be | 0) || ye > (Z.length - Be | 0)) + return !1; + for (var Lt = 0; Lt < Be; Lt++) + if (!kf(O.charCodeAt(j + Lt | 0), Z.charCodeAt(ye + Lt | 0), lt)) + return !1; + return !0; + } + function Vm(O, j, Z) { + return Z === void 0 && (Z = !1), O.length > 0 && kf(O.charCodeAt(0), j, Z); + } + function Of(O, j, Z) { + return Z === void 0 && (Z = !1), O.length > 0 && kf(O.charCodeAt(rl(O)), j, Z); + } + function Bv() { + } + function Du() { + } + function aa(O) { + this.match = O; + } + function Bc() { + } + function Gm() { + jv = this; + } + Pv.prototype.readResolve_0 = function() { + var O, j = this.elements, Z = _s(); + for (O = 0; O !== j.length; ++O) { + var ye = j[O]; + Z = Z.plus_1fupul$(ye); + } + return Z; + }, Pv.$metadata$ = { kind: R, simpleName: "Serialized", interfaces: [ba] }, $n.$metadata$ = { kind: R, simpleName: "CombinedContext", interfaces: [ba, Ro] }, g("kotlin.kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn_zb0pmy$", S(function() { + var O = u.kotlin.NotImplementedError; + return function(j, Z) { + throw new O("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic"); + }; + })), xa.$metadata$ = { kind: R, simpleName: "CoroutineSingletons", interfaces: [ce] }, xa.values = function() { + return [Df(), Eu(), tl()]; + }, xa.valueOf_61zpoe$ = function(O) { + switch (O) { + case "COROUTINE_SUSPENDED": + return Df(); + case "UNDECIDED": + return Eu(); + case "RESUMED": + return tl(); + default: + kl("No enum constant kotlin.coroutines.intrinsics.CoroutineSingletons." + O); + } + }, Rv.$metadata$ = { kind: G, simpleName: "KClassifier", interfaces: [] }, bs.prototype.nextChar = function() { + var O, j; + return O = this.index_0, this.index_0 = O + 1 | 0, j = O, this.this$iterator.charCodeAt(j); + }, bs.prototype.hasNext = function() { + return this.index_0 < this.this$iterator.length; + }, bs.$metadata$ = { kind: R, interfaces: [Re] }, Bv.$metadata$ = { kind: G, simpleName: "MatchGroupCollection", interfaces: [ar] }, Object.defineProperty(Du.prototype, "destructured", { configurable: !0, get: function() { + return new aa(this); + } }), aa.prototype.component1 = g("kotlin.kotlin.text.MatchResult.Destructured.component1", function() { + return this.match.groupValues.get_za3lpa$(1); + }), aa.prototype.component2 = g("kotlin.kotlin.text.MatchResult.Destructured.component2", function() { + return this.match.groupValues.get_za3lpa$(2); + }), aa.prototype.component3 = g("kotlin.kotlin.text.MatchResult.Destructured.component3", function() { + return this.match.groupValues.get_za3lpa$(3); + }), aa.prototype.component4 = g("kotlin.kotlin.text.MatchResult.Destructured.component4", function() { + return this.match.groupValues.get_za3lpa$(4); + }), aa.prototype.component5 = g("kotlin.kotlin.text.MatchResult.Destructured.component5", function() { + return this.match.groupValues.get_za3lpa$(5); + }), aa.prototype.component6 = g("kotlin.kotlin.text.MatchResult.Destructured.component6", function() { + return this.match.groupValues.get_za3lpa$(6); + }), aa.prototype.component7 = g("kotlin.kotlin.text.MatchResult.Destructured.component7", function() { + return this.match.groupValues.get_za3lpa$(7); + }), aa.prototype.component8 = g("kotlin.kotlin.text.MatchResult.Destructured.component8", function() { + return this.match.groupValues.get_za3lpa$(8); + }), aa.prototype.component9 = g("kotlin.kotlin.text.MatchResult.Destructured.component9", function() { + return this.match.groupValues.get_za3lpa$(9); + }), aa.prototype.component10 = g("kotlin.kotlin.text.MatchResult.Destructured.component10", function() { + return this.match.groupValues.get_za3lpa$(10); + }), aa.prototype.toList = function() { + return this.match.groupValues.subList_vux9f0$(1, this.match.groupValues.size); + }, aa.$metadata$ = { kind: R, simpleName: "Destructured", interfaces: [] }, Du.$metadata$ = { kind: G, simpleName: "MatchResult", interfaces: [] }, Bc.$metadata$ = { kind: G, simpleName: "Lazy", interfaces: [] }, Gm.$metadata$ = { kind: Q, simpleName: "UNINITIALIZED_VALUE", interfaces: [] }; + var jv = null; + function jc() { + return jv === null && new Gm(), jv; + } + function Nl(O) { + this.initializer_0 = O, this._value_0 = jc(); + } + function ku(O) { + this.value_7taq70$_0 = O; + } + function $i(O) { + Um(), this.value = O; + } + function Lf() { + Fv = this; + } + Object.defineProperty(Nl.prototype, "value", { configurable: !0, get: function() { + var O; + return this._value_0 === jc() && (this._value_0 = fe(this.initializer_0)(), this.initializer_0 = null), (O = this._value_0) == null || l.isType(O, K) ? O : xi(); + } }), Nl.prototype.isInitialized = function() { + return this._value_0 !== jc(); + }, Nl.prototype.toString = function() { + return this.isInitialized() ? $(this.value) : "Lazy value not initialized yet."; + }, Nl.prototype.writeReplace_0 = function() { + return new ku(this.value); + }, Nl.$metadata$ = { kind: R, simpleName: "UnsafeLazyImpl", interfaces: [ba, Bc] }, Object.defineProperty(ku.prototype, "value", { get: function() { + return this.value_7taq70$_0; + } }), ku.prototype.isInitialized = function() { + return !0; + }, ku.prototype.toString = function() { + return $(this.value); + }, ku.$metadata$ = { kind: R, simpleName: "InitializedLazyImpl", interfaces: [ba, Bc] }, Object.defineProperty($i.prototype, "isSuccess", { configurable: !0, get: function() { + return !l.isType(this.value, oa); + } }), Object.defineProperty($i.prototype, "isFailure", { configurable: !0, get: function() { + return l.isType(this.value, oa); + } }), $i.prototype.getOrNull = g("kotlin.kotlin.Result.getOrNull", S(function() { + var O = Object, j = l.throwCCE; + return function() { + var Z; + return this.isFailure ? null : (Z = this.value) == null || l.isType(Z, O) ? Z : j(); + }; + })), $i.prototype.exceptionOrNull = function() { + return l.isType(this.value, oa) ? this.value.exception : null; + }, $i.prototype.toString = function() { + return l.isType(this.value, oa) ? this.value.toString() : "Success(" + $(this.value) + ")"; + }, Lf.prototype.success_mh5how$ = g("kotlin.kotlin.Result.Companion.success_mh5how$", S(function() { + var O = u.kotlin.Result; + return function(j) { + return new O(j); + }; + })), Lf.prototype.failure_lsqlk3$ = g("kotlin.kotlin.Result.Companion.failure_lsqlk3$", S(function() { + var O = u.kotlin.createFailure_tcv7n7$, j = u.kotlin.Result; + return function(Z) { + return new j(O(Z)); + }; + })), Lf.$metadata$ = { kind: Q, simpleName: "Companion", interfaces: [] }; + var Fv = null; + function Um() { + return Fv === null && new Lf(), Fv; + } + function oa(O) { + this.exception = O; + } + function Wm(O) { + return new oa(O); + } + function $v(O) { + if (l.isType(O.value, oa)) + throw O.value.exception; + } + function zl(O) { + O === void 0 && (O = "An operation is not implemented."), Ki(O, this), this.name = "NotImplementedError"; + } + oa.prototype.equals = function(O) { + return l.isType(O, oa) && T(this.exception, O.exception); + }, oa.prototype.hashCode = function() { + return oe(this.exception); + }, oa.prototype.toString = function() { + return "Failure(" + this.exception + ")"; + }, oa.$metadata$ = { kind: R, simpleName: "Failure", interfaces: [ba] }, $i.$metadata$ = { kind: R, simpleName: "Result", interfaces: [ba] }, $i.prototype.unbox = function() { + return this.value; + }, $i.prototype.hashCode = function() { + var O = 0; + return 31 * O + l.hashCode(this.value) | 0; + }, $i.prototype.equals = function(O) { + return this === O || O !== null && typeof O == "object" && Object.getPrototypeOf(this) === Object.getPrototypeOf(O) && l.equals(this.value, O.value); + }, zl.$metadata$ = { kind: R, simpleName: "NotImplementedError", interfaces: [ki] }; + var tr = u.kotlin || (u.kotlin = {}), pt = tr.collections || (tr.collections = {}); + pt.contains_o2f9me$ = te, pt.get_lastIndex_m7z4lg$ = ue, pt.indexOf_mjy6jw$ = pe, pt.indexOf_o2f9me$ = re, pt.get_indices_m7z4lg$ = le; + var sa = tr.ranges || (tr.ranges = {}); + sa.reversed_zf1xzc$ = et, pt.lastIndexOf_mjy6jw$ = ae, tr.IllegalArgumentException_init_pdl1vj$ = Gr, pt.ArrayList_init_287e2$ = $a, pt.mapCapacity_za3lpa$ = Ao, sa.coerceAtLeast_dqglrj$ = yt, sa.coerceAtMost_dqglrj$ = vt, pt.toCollection_5n4o2z$ = Ae, pt.toSet_us0mfu$ = Te, pt.LinkedHashMap_init_q3lmfv$ = mu, pt.ArrayList_init_ww73n8$ = Cr, tr.NoSuchElementException_init = ei, tr.UnsupportedOperationException_init_pdl1vj$ = cs, pt.collectionSizeOrDefault_ba2ldo$ = Lm, pt.contains_2ws7j4$ = He, pt.get_lastIndex_55thoc$ = gs, pt.indexOf_2ws7j4$ = je, pt.checkIndexOverflow_za3lpa$ = lo, pt.toCollection_5cfyqp$ = be, pt.toSet_7wnvza$ = ge, pt.Collection = ar, pt.joinTo_gcc71v$ = _e, pt.joinToString_fmv235$ = we, pt.asSequence_7wnvza$ = Ie; + var vn = tr.text || (tr.text = {}); + sa.downTo_dqglrj$ = Me; + var zo = tr.sequences || (tr.sequences = {}); + zo.Sequence = Po, zo.take_wuwhe2$ = ze, zo.map_z5avom$ = bt, vn.get_lastIndex_gw00vp$ = rl, vn.iterator_gw00vp$ = function(O) { + return new bs(O); + }, vn.get_indices_gw00vp$ = zv, vn.StringBuilder_init = yv; + var Ym = tr.js || (tr.js = {}); + tr.Annotation = _t, tr.CharSequence = $t, pt.Iterable = fr, pt.MutableIterable = _r, pt.MutableCollection = or, pt.List = Tr, pt.MutableList = tn, pt.Set = rn, pt.MutableSet = qe, Xe.Entry = Ze, pt.Map = Xe, st.MutableEntry = St, pt.MutableMap = st, pt.Iterator = tt, pt.MutableIterator = Vr, pt.ListIterator = cn, pt.MutableListIterator = ct, pt.CharIterator = Re, pt.IntIterator = Br, pt.LongIterator = dr, sa.CharProgressionIterator = ur, sa.IntProgressionIterator = wn, sa.LongProgressionIterator = vr, Object.defineProperty(Vt, "Companion", { get: pr }), sa.CharProgression = Vt, Object.defineProperty(Fn, "Companion", { get: Co }), sa.IntProgression = Fn, Object.defineProperty(Wr, "Companion", { get: Sr }), sa.LongProgression = Wr, sa.ClosedRange = $r, Object.defineProperty(Ct, "Companion", { get: Ue }), sa.CharRange = Ct, Object.defineProperty(Je, "Companion", { get: It }), sa.IntRange = Je, Object.defineProperty(qt, "Companion", { get: Nt }), sa.LongRange = qt, Object.defineProperty(tr, "Unit", { get: ui }); + var Xm = tr.internal || (tr.internal = {}); + Xm.getProgressionLastElement_qt1dr2$ = ci, Xm.getProgressionLastElement_b9bd0d$ = ya, u.subSequence = function(O, j, Z) { + return typeof O == "string" ? O.substring(j, Z) : O.subSequence_vux9f0$(j, Z); + }, u.captureStack = function(O, j) { + Error.captureStackTrace ? Error.captureStackTrace(j) : j.stack = new Error().stack; + }, u.newThrowable = function(O, j) { + var Z, ye = new Error(); + return Z = T(typeof O, "undefined") ? j != null ? j.toString() : null : O, ye.message = Z, ye.cause = j, ye.name = "Throwable", ye; + }, u.BoxedChar = fn, u.charArrayOf = function() { + var O = "CharArray", j = new Uint16Array([].slice.call(arguments)); + return j.$type$ = O, j; + }; + var Ua = tr.coroutines || (tr.coroutines = {}); + Ua.CoroutineImpl = Yn, Object.defineProperty(Ua, "CompletedContinuation", { get: us }); + var Pf = Ua.intrinsics || (Ua.intrinsics = {}); + Pf.intercepted_f9mg25$ = function(O) { + var j, Z, ye; + return (ye = (Z = l.isType(j = O, Yn) ? j : null) != null ? Z.intercepted() : null) != null ? ye : O; + }, tr.Error_init_pdl1vj$ = Ki, tr.Error = ki, tr.Exception = Qi, tr.RuntimeException_init_pdl1vj$ = Io, tr.RuntimeException = Hr, tr.IllegalArgumentException = qi, tr.IllegalStateException_init_pdl1vj$ = On, tr.IllegalStateException = Oi, tr.IndexOutOfBoundsException = Tn, tr.UnsupportedOperationException_init = Us, tr.UnsupportedOperationException = za, tr.NumberFormatException = dn, tr.NullPointerException = _i, tr.ClassCastException = Li, tr.NoSuchElementException = so, tr.ArithmeticException = _a, tr.lazy_klfg04$ = function(O) { + return new Nl(O); + }, pt.arrayCopy = Ba, pt.copyOfRange_5f8l3u$ = du, tr.Comparator = vu, pt.copyToArray = Ir, pt.copyToArrayImpl = hi, pt.copyToExistingArrayImpl = In, pt.setOf_mh5how$ = Ar, pt.LinkedHashSet_init_287e2$ = yu, pt.LinkedHashSet_init_ww73n8$ = bu, pt.AbstractMutableCollection = Mn, pt.AbstractMutableList = Er, Xn.SimpleEntry_init_trwmqg$ = function(O, j) { + return j = j || Object.create(Ln.prototype), Ln.call(j, O.key, O.value), j; + }, Xn.SimpleEntry = Ln, Xn.AbstractEntrySet = ni, pt.AbstractMutableMap = Xn, pt.AbstractMutableSet = Gt, pt.ArrayList_init_mqih57$ = function(O, j) { + return j = j || Object.create(Mr.prototype), Mr.call(j, Ir(O)), j; + }, pt.ArrayList = Mr, Object.defineProperty(Yt, "HashCode", { get: Jn }), pt.EqualityComparator = Yt, pt.HashMap_init_va96d4$ = Ws, pt.HashMap_init_q3lmfv$ = Eo, pt.HashMap_init_xf5xz2$ = pu, pt.HashMap = hn, pt.HashSet_init_2wofer$ = Ys, pt.HashSet_init_ww73n8$ = _n, pt.HashSet_init_nn01ho$ = di, pt.HashSet = nn, pt.InternalHashCodeMap = ii, pt.InternalMap = hs, pt.InternalStringMap = gu, pt.LinkedHashMap_init_xf5xz2$ = Ec, pt.LinkedHashMap = mt, pt.LinkedHashSet_init_2wofer$ = _u, pt.LinkedHashSet = Pi, pt.RandomAccess = Mo; + var Bl = tr.io || (tr.io = {}); + Bl.BaseOutput = ta, Bl.NodeJsOutput = Do, Bl.BufferedOutput = Fr, Bl.BufferedOutputToConsoleLog = ra, Ua.SafeContinuation_init_wj8d80$ = function(O, j) { + return j = j || Object.create(Va.prototype), Va.call(j, O, Eu()), j; + }, Ua.SafeContinuation = Va, u.throwNPE = function(O) { + throw new _i(O); + }, u.throwCCE = xi, u.throwISE = kl, Bl.Serializable = ba; + var Wa = tr.reflect || (tr.reflect = {}); + Wa.KCallable = ko, Wa.KClass = Ht; + var Rf = Wa.js || (Wa.js = {}), nl = Rf.internal || (Rf.internal = {}); + nl.KClassImpl = Nr, nl.SimpleKClassImpl = gr, nl.PrimitiveKClassImpl = z, Object.defineProperty(nl, "NothingKClassImpl", { get: ke }), nl.ErrorKClass = it, Wa.KProperty = ht, Wa.KMutableProperty = Et, Wa.KProperty0 = Qt, Wa.KMutableProperty0 = lr, Wa.KProperty1 = zn, Wa.KMutableProperty1 = Bn, Object.defineProperty(nl, "PrimitiveClasses", { get: pi }), u.getKClass = Im, u.getKClassM = Am, u.getKClassFromExpression = function(O) { + var j; + switch (typeof O) { + case "string": + j = pi().stringClass; + break; + case "number": + j = (0 | O) === O ? pi().intClass : pi().doubleClass; + break; + case "boolean": + j = pi().booleanClass; + break; + case "function": + j = pi().functionClass(O.length); + break; + default: + if (l.isBooleanArray(O)) + j = pi().booleanArrayClass; + else if (l.isCharArray(O)) + j = pi().charArrayClass; + else if (l.isByteArray(O)) + j = pi().byteArrayClass; + else if (l.isShortArray(O)) + j = pi().shortArrayClass; + else if (l.isIntArray(O)) + j = pi().intArrayClass; + else if (l.isLongArray(O)) + j = pi().longArrayClass; + else if (l.isFloatArray(O)) + j = pi().floatArrayClass; + else if (l.isDoubleArray(O)) + j = pi().doubleArrayClass; + else if (l.isType(O, Ht)) + j = Im(Ht); + else if (l.isArray(O)) + j = pi().arrayClass; + else { + var Z = Object.getPrototypeOf(O).constructor; + j = Z === Object ? pi().anyClass : Z === Error ? pi().throwableClass : gf(Z); + } + } + return j; + }, u.getKClass1 = gf, Ym.reset_xjqeni$ = gv, vn.Appendable = mv, vn.StringBuilder_init_za3lpa$ = function(O, j) { + return yv(j = j || Object.create(cr.prototype)), j; + }, vn.StringBuilder = cr, vn.uppercaseChar_myv2d0$ = _v, vn.isHighSurrogate_myv2d0$ = Em, vn.isLowSurrogate_myv2d0$ = Mm, vn.MatchGroup = Oo, Object.defineProperty(Ci, "Companion", { get: mf }), vn.Regex_init_61zpoe$ = Dm, vn.Regex = Ci, vn.concatToString_355ntz$ = yf, vn.concatToString_wlitf7$ = xv, vn.compareTo_7epoxm$ = $x, vn.regionMatches_h3ii2q$ = Ll, vn.replace_680rmw$ = function(O, j, Z, ye) { + return ye === void 0 && (ye = !1), O.replace(new RegExp(mf().escape_61zpoe$(j), ye ? "gui" : "gu"), mf().escapeReplacement_61zpoe$(Z)); + }, pt.AbstractCollection = Pn, Object.defineProperty(ai, "Companion", { get: er }), pt.AbstractList = ai, Object.defineProperty(Kn, "Companion", { get: kc }), pt.AbstractMap = Kn, Object.defineProperty(fo, "Companion", { get: Su }), pt.AbstractSet = fo, Object.defineProperty(pt, "EmptyIterator", { get: Oc }), pt.get_indices_gzk92b$ = km, pt.throwIndexOverflow = Om, pt.removeAll_uhyeqt$ = Tv, pt.removeAll_qafx1e$ = Iv, zo.emptySequence_287e2$ = wf, zo.TransformingSequence = Pc, zo.FlatteningSequence = Tf, zo.DropTakeSequence = wu, zo.SubSequence = ms, zo.TakeSequence = Rl, zo.generateSequence_c6s9hp$ = Rm, Object.defineProperty(pt, "EmptySet", { get: Dv }), pt.emptySet_287e2$ = Tu, pt.setOf_i5x0yv$ = function(O) { + return O.length > 0 ? Te(O) : Tu(); + }, pt.hashSetOf_i5x0yv$ = Nm, pt.optimizeReadOnlySet_94kdbt$ = zm, Ua.Continuation = Iu, tr.Result = $i, Pf.get_COROUTINE_SUSPENDED = el, Object.defineProperty(Ef, "Key", { get: Au }), Ua.ContinuationInterceptor = Ef, Ro.Key = Ov, Ro.Element = ia, Ua.CoroutineContext = Ro, Ua.AbstractCoroutineContextElement = zc, Object.defineProperty(Ua, "EmptyCoroutineContext", { get: _s }), Ua.CombinedContext = $n, Object.defineProperty(Pf, "COROUTINE_SUSPENDED", { get: el }), Object.defineProperty(xa, "COROUTINE_SUSPENDED", { get: Df }), Object.defineProperty(xa, "UNDECIDED", { get: Eu }), Object.defineProperty(xa, "RESUMED", { get: tl }), Pf.CoroutineSingletons = xa, Wa.KClassifier = Rv, vn.appendElement_k2zgzt$ = Hm, vn.equals_4lte5s$ = kf, vn.trimStart_wqw3xr$ = No, vn.trimEnd_wqw3xr$ = Nv, vn.regionMatchesImpl_4c7s8r$ = Mu, vn.startsWith_sgbm27$ = Vm, vn.endsWith_sgbm27$ = Of, vn.indexOf_l5u8uk$ = function(O, j, Z, ye) { + return Z === void 0 && (Z = 0), ye === void 0 && (ye = !1), ye || typeof O != "string" ? function(Be, lt, Lt, br, mr, an) { + var Bo, il; + an === void 0 && (an = !1); + var Hv = an ? Me(vt(Lt, rl(Be)), yt(br, 0)) : new Je(yt(Lt, 0), vt(br, Be.length)); + if (typeof Be == "string" && typeof lt == "string") + for (Bo = Hv.iterator(); Bo.hasNext(); ) { + var Zm = Bo.next(); + if (Ll(lt, 0, Be, Zm, lt.length, mr)) + return Zm; + } + else + for (il = Hv.iterator(); il.hasNext(); ) { + var xs = il.next(); + if (Mu(lt, 0, Be, xs, lt.length, mr)) + return xs; + } + return -1; + }(O, j, Z, O.length, ye) : O.indexOf(j, Z); + }, vn.MatchGroupCollection = Bv, Du.Destructured = aa, vn.MatchResult = Du, tr.Lazy = Bc, Object.defineProperty(tr, "UNINITIALIZED_VALUE", { get: jc }), tr.UnsafeLazyImpl = Nl, tr.InitializedLazyImpl = ku, tr.createFailure_tcv7n7$ = Wm, Object.defineProperty($i, "Companion", { get: Um }), $i.Failure = oa, tr.throwOnFailure_iacion$ = $v, tr.NotImplementedError = zl, st.prototype.getOrDefault_xwzc9p$ = Xe.prototype.getOrDefault_xwzc9p$, Kn.prototype.getOrDefault_xwzc9p$ = Xe.prototype.getOrDefault_xwzc9p$, Xn.prototype.remove_xwzc9p$ = st.prototype.remove_xwzc9p$, ii.prototype.createJsMap = hs.prototype.createJsMap, gu.prototype.createJsMap = hs.prototype.createJsMap, Object.defineProperty(ps.prototype, "destructured", Object.getOwnPropertyDescriptor(Du.prototype, "destructured")), Xe.prototype.getOrDefault_xwzc9p$, st.prototype.remove_xwzc9p$, st.prototype.getOrDefault_xwzc9p$, Xe.prototype.getOrDefault_xwzc9p$, ia.prototype.plus_1fupul$ = Ro.prototype.plus_1fupul$, Ef.prototype.fold_3cc69b$ = ia.prototype.fold_3cc69b$, Ef.prototype.plus_1fupul$ = ia.prototype.plus_1fupul$, zc.prototype.get_j3r2sn$ = ia.prototype.get_j3r2sn$, zc.prototype.fold_3cc69b$ = ia.prototype.fold_3cc69b$, zc.prototype.minusKey_yeqjby$ = ia.prototype.minusKey_yeqjby$, zc.prototype.plus_1fupul$ = ia.prototype.plus_1fupul$, $n.prototype.plus_1fupul$ = Ro.prototype.plus_1fupul$, $r.prototype.contains_mef7kx$, $r.prototype.isEmpty, typeof process != "undefined" && process.versions && process.versions.node ? new Do(process.stdout) : new ra(), new Xs(_s(), function(O) { + var j; + return $v(O), (j = O.value) == null || l.isType(j, K) || Oe(), nt; + }), pv = l.newArray(0, null), new Int8Array([F(239), F(191), F(189)]), new $i(el()); + }(); + }) == "function" ? o.apply(a, [a]) : o) === void 0 || (i.exports = s); + }, 42: function(i, a, o) { + var s, l, u; + l = [a, o(421)], (u = typeof (s = function(c, h) { + var f = h.Kind.OBJECT, v = h.Kind.CLASS, b = (h.kotlin.js.internal.StringCompanionObject, Error), w = h.Kind.INTERFACE, p = h.toChar, d = h.ensureNotNull, m = h.kotlin.Unit, _ = (h.kotlin.js.internal.IntCompanionObject, h.kotlin.js.internal.LongCompanionObject, h.kotlin.js.internal.FloatCompanionObject, h.kotlin.js.internal.DoubleCompanionObject, h.kotlin.collections.MutableIterator), y = h.hashCode, x = h.throwCCE, g = h.equals, S = h.kotlin.collections.MutableIterable, T = h.kotlin.collections.ArrayList_init_mqih57$, C = h.getKClass, E = h.kotlin.collections.Iterator, M = h.toByte, P = h.kotlin.collections.Iterable, R = h.toString, N = h.unboxChar, F = h.kotlin.collections.joinToString_fmv235$, U = h.kotlin.collections.setOf_i5x0yv$, $ = h.kotlin.collections.ArrayList_init_ww73n8$, G = h.kotlin.text.iterator_gw00vp$, Q = h.toBoxedChar, ee = Math, ce = h.kotlin.text.Regex_init_61zpoe$, ne = h.kotlin.lazy_klfg04$, fe = h.kotlin.text.replace_680rmw$, K = h.kotlin.text.StringBuilder_init_za3lpa$, Oe = h.kotlin.Annotation, xe = String, Ge = h.kotlin.text.indexOf_l5u8uk$, oe = h.kotlin.NumberFormatException, de = h.kotlin.Exception, se = Object, te = h.kotlin.collections.MutableList; + function pe() { + re = this; + } + _e.prototype = Object.create(b.prototype), _e.prototype.constructor = _e, we.prototype = Object.create(b.prototype), we.prototype.constructor = we, Me.prototype = Object.create(b.prototype), Me.prototype.constructor = Me, et.prototype = Object.create(b.prototype), et.prototype.constructor = et, ze.prototype = Object.create(b.prototype), ze.prototype.constructor = ze, fr.prototype = Object.create(Re.prototype), fr.prototype.constructor = fr, ct.prototype = Object.create(b.prototype), ct.prototype.constructor = ct, Vt.prototype = Object.create(jr.prototype), Vt.prototype.constructor = Vt, pr.prototype = Object.create(Nt.prototype), pr.prototype.constructor = pr, Sr.prototype = Object.create(Nt.prototype), Sr.prototype.constructor = Sr, $r.prototype = Object.create(Nt.prototype), $r.prototype.constructor = $r, Ct.prototype = Object.create(Nt.prototype), Ct.prototype.constructor = Ct, wr.prototype = Object.create(Nt.prototype), wr.prototype.constructor = wr, fn.prototype = Object.create(b.prototype), fn.prototype.constructor = fn, Nn.prototype = Object.create(yn.prototype), Nn.prototype.constructor = Nn, Yn.prototype = Object.create(Ki.prototype), Yn.prototype.constructor = Yn, Hr.prototype = Object.create(Ki.prototype), Hr.prototype.constructor = Hr, Gr.prototype = Object.create(Re.prototype), Gr.prototype.constructor = Gr, Oi.prototype = Object.create(b.prototype), Oi.prototype.constructor = Oi, On.prototype = Object.create(b.prototype), On.prototype.constructor = On, hi.prototype = Object.create(Ir.prototype), hi.prototype.constructor = hi, In.prototype = Object.create(Ir.prototype), In.prototype.constructor = In, Ar.prototype = Object.create(Ir.prototype), Ar.prototype.constructor = Ar, lo.prototype = Object.create(b.prototype), lo.prototype.constructor = lo, Ao.prototype = Object.create(b.prototype), Ao.prototype.constructor = Ao, ri.prototype = Object.create(b.prototype), ri.prototype.constructor = ri, Ln.prototype = Object.create(Ar.prototype), Ln.prototype.constructor = Ln, ni.prototype = Object.create(Ar.prototype), ni.prototype.constructor = ni, Ve.prototype = Object.create(Ar.prototype), Ve.prototype.constructor = Ve, Fa.prototype = Object.create(Ar.prototype), Fa.prototype.constructor = Fa, Zn.prototype = Object.create(Ar.prototype), Zn.prototype.constructor = Zn, ea.prototype = Object.create(Ar.prototype), ea.prototype.constructor = ea, Gt.prototype = Object.create(Ar.prototype), Gt.prototype.constructor = Gt, Mr.prototype = Object.create(Ar.prototype), Mr.prototype.constructor = Mr, $a.prototype = Object.create(Ar.prototype), $a.prototype.constructor = $a, Cr.prototype = Object.create(Ar.prototype), Cr.prototype.constructor = Cr, pe.prototype.fill_ugzc7n$ = function(z, J) { + var ve; + ve = z.length - 1 | 0; + for (var ke = 0; ke <= ve; ke++) + z[ke] = J; + }, pe.$metadata$ = { kind: f, simpleName: "Arrays", interfaces: [] }; + var re = null; + function ae() { + return re === null && new pe(), re; + } + function le(z) { + z === void 0 && (z = ""), this.src = z; + } + function ue(z) { + this.this$ByteInputStream = z, this.next = 0; + } + function Ae() { + Te = this; + } + ue.prototype.read_8chfmy$ = function(z, J, ve) { + var ke, it, ht = 0; + ke = J + ve - 1 | 0; + for (var Et = J; Et <= ke && !(this.next >= this.this$ByteInputStream.src.length); Et++) + z[Et] = this.this$ByteInputStream.src.charCodeAt((it = this.next, this.next = it + 1 | 0, it)), ht = ht + 1 | 0; + return ht === 0 ? -1 : ht; + }, ue.$metadata$ = { kind: v, interfaces: [vt] }, le.prototype.bufferedReader = function() { + return new ue(this); + }, le.prototype.reader = function() { + return this.bufferedReader(); + }, le.$metadata$ = { kind: v, simpleName: "ByteInputStream", interfaces: [Ie] }, Ae.prototype.isWhitespace_s8itvh$ = function(z) { + var J; + switch (z) { + case 32: + case 9: + case 10: + case 13: + J = !0; + break; + default: + J = !1; + } + return J; + }, Ae.$metadata$ = { kind: f, simpleName: "Character", interfaces: [] }; + var Te = null; + function Ne() { + He = this; + } + Ne.prototype.unmodifiableList_zfnyf4$ = function(z) { + Ze("not implemented"); + }, Ne.$metadata$ = { kind: f, simpleName: "Collections", interfaces: [] }; + var He = null; + function je() { + return He === null && new Ne(), He; + } + function be(z, J, ve, ke, it) { + var ht, Et, Qt = ve; + ht = ke + it - 1 | 0; + for (var lr = ke; lr <= ht; lr++) + J[Et = Qt, Qt = Et + 1 | 0, Et] = z.charCodeAt(lr); + } + function ge(z, J, ve, ke) { + return _u().create_8chfmy$(J, ve, ke); + } + function _e(z) { + z === void 0 && (z = null), b.call(this), this.message_opjsbb$_0 = z, this.cause_18nhvr$_0 = null, h.captureStack(b, this), this.name = "IOException"; + } + function we(z) { + z === void 0 && (z = null), b.call(this), this.message_nykor0$_0 = z, this.cause_n038z2$_0 = null, h.captureStack(b, this), this.name = "IllegalArgumentException"; + } + function Ie() { + } + function Me(z) { + z === void 0 && (z = null), b.call(this), this.message_77za5l$_0 = z, this.cause_jiegcr$_0 = null, h.captureStack(b, this), this.name = "NullPointerException"; + } + function et() { + b.call(this), this.message_l78tod$_0 = void 0, this.cause_y27uld$_0 = null, h.captureStack(b, this), this.name = "NumberFormatException"; + } + function yt() { + } + function vt() { + } + function ze(z) { + z === void 0 && (z = null), b.call(this), this.message_2hhrll$_0 = z, this.cause_blbmi1$_0 = null, h.captureStack(b, this), this.name = "RuntimeException"; + } + function bt(z, J) { + return J = J || Object.create(ze.prototype), ze.call(J, z.message), J; + } + function _t() { + this.value = ""; + } + function $t(z) { + this.string = z, this.nextPos_0 = 0; + } + function fr() { + wn(this), this.value = ""; + } + function _r(z, J) { + J(); + } + function ar(z) { + return new le(z); + } + function or(z, J, ve) { + Ze("implement"); + } + function Tr(z, J) { + Ze("implement"); + } + function tn(z, J, ve) { + Ze("implement"); + } + function rn(z, J, ve) { + Ze("implement"); + } + function qe(z, J) { + Ze("implement"); + } + function Xe(z, J) { + Ze("implement"); + } + function Ze(z) { + throw h.newThrowable(z); + } + function st(z, J) { + Ze("implement"); + } + function St(z, J) { + Ze("implement"); + } + function tt(z, J) { + Ze("implement"); + } + function Vr(z, J) { + Ze("implement"); + } + function cn(z, J) { + Ze("implement"); + } + function ct(z) { + z === void 0 && (z = null), b.call(this), this.message_3rkdyj$_0 = z, this.cause_2kxft9$_0 = null, h.captureStack(b, this), this.name = "UnsupportedOperationException"; + } + function Re() { + ur(), this.writeBuffer_9jar4r$_0 = null, this.lock = null; + } + function Br() { + dr = this, this.WRITE_BUFFER_SIZE_0 = 1024; + } + Object.defineProperty(_e.prototype, "message", { get: function() { + return this.message_opjsbb$_0; + } }), Object.defineProperty(_e.prototype, "cause", { get: function() { + return this.cause_18nhvr$_0; + } }), _e.$metadata$ = { kind: v, simpleName: "IOException", interfaces: [b] }, Object.defineProperty(we.prototype, "message", { get: function() { + return this.message_nykor0$_0; + } }), Object.defineProperty(we.prototype, "cause", { get: function() { + return this.cause_n038z2$_0; + } }), we.$metadata$ = { kind: v, simpleName: "IllegalArgumentException", interfaces: [b] }, Ie.$metadata$ = { kind: w, simpleName: "InputStream", interfaces: [] }, Object.defineProperty(Me.prototype, "message", { get: function() { + return this.message_77za5l$_0; + } }), Object.defineProperty(Me.prototype, "cause", { get: function() { + return this.cause_jiegcr$_0; + } }), Me.$metadata$ = { kind: v, simpleName: "NullPointerException", interfaces: [b] }, Object.defineProperty(et.prototype, "message", { get: function() { + return this.message_l78tod$_0; + } }), Object.defineProperty(et.prototype, "cause", { get: function() { + return this.cause_y27uld$_0; + } }), et.$metadata$ = { kind: v, simpleName: "NumberFormatException", interfaces: [b] }, yt.prototype.defaultReadObject = function() { + Ze("not implemented"); + }, yt.$metadata$ = { kind: w, simpleName: "ObjectInputStream", interfaces: [] }, vt.$metadata$ = { kind: w, simpleName: "Reader", interfaces: [] }, Object.defineProperty(ze.prototype, "message", { get: function() { + return this.message_2hhrll$_0; + } }), Object.defineProperty(ze.prototype, "cause", { get: function() { + return this.cause_blbmi1$_0; + } }), ze.$metadata$ = { kind: v, simpleName: "RuntimeException", interfaces: [b] }, Object.defineProperty(_t.prototype, "length", { configurable: !0, get: function() { + return this.value.length; + }, set: function(z) { + this.value = this.value.substring(0, z); + } }), _t.prototype.append_8chfmy$ = function(z, J, ve) { + var ke; + ke = J + ve - 1 | 0; + for (var it = J; it <= ke; it++) + this.value += String.fromCharCode(z[it]); + }, _t.prototype.append_s8itvh$ = function(z) { + this.value += String.fromCharCode(z); + }, _t.prototype.append_61zpoe$ = function(z) { + var J; + J = z.length - 1 | 0; + for (var ve = 0; ve <= J; ve++) + this.value += String.fromCharCode(z.charCodeAt(ve)); + }, _t.prototype.isEmpty = function() { + return this.length === 0; + }, _t.prototype.toString = function() { + return this.value; + }, _t.prototype.byteInputStream = function() { + return new le(this.value); + }, _t.$metadata$ = { kind: v, simpleName: "StringBuilder", interfaces: [] }, $t.prototype.read_8chfmy$ = function(z, J, ve) { + var ke, it, ht = 0; + ke = J + ve - 1 | 0; + for (var Et = J; Et <= ke && !(this.nextPos_0 >= this.string.length); Et++) + z[Et] = this.string.charCodeAt((it = this.nextPos_0, this.nextPos_0 = it + 1 | 0, it)), ht = ht + 1 | 0; + return ht > 0 ? ht : -1; + }, $t.$metadata$ = { kind: v, simpleName: "StringReader", interfaces: [vt] }, fr.prototype.write_8chfmy$ = function(z, J, ve) { + var ke; + ke = J + ve - 1 | 0; + for (var it = J; it <= ke; it++) + this.value += String.fromCharCode(z[it]); + }, fr.prototype.flush = function() { + this.value = ""; + }, fr.prototype.close = function() { + }, fr.prototype.toString = function() { + return this.value; + }, fr.$metadata$ = { kind: v, simpleName: "StringWriter", interfaces: [Re] }, Object.defineProperty(ct.prototype, "message", { get: function() { + return this.message_3rkdyj$_0; + } }), Object.defineProperty(ct.prototype, "cause", { get: function() { + return this.cause_2kxft9$_0; + } }), ct.$metadata$ = { kind: v, simpleName: "UnsupportedOperationException", interfaces: [b] }, Re.prototype.write_za3lpa$ = function(z) { + var J, ve; + _r(this.lock, (J = this, ve = z, function() { + return J.writeBuffer_9jar4r$_0 == null && (J.writeBuffer_9jar4r$_0 = h.charArray(ur().WRITE_BUFFER_SIZE_0)), d(J.writeBuffer_9jar4r$_0)[0] = p(ve), J.write_8chfmy$(d(J.writeBuffer_9jar4r$_0), 0, 1), m; + })); + }, Re.prototype.write_4hbowm$ = function(z) { + this.write_8chfmy$(z, 0, z.length); + }, Re.prototype.write_61zpoe$ = function(z) { + this.write_3m52m6$(z, 0, z.length); + }, Re.prototype.write_3m52m6$ = function(z, J, ve) { + var ke, it, ht, Et; + _r(this.lock, (ke = ve, it = this, ht = z, Et = J, function() { + var Qt; + return ke <= ur().WRITE_BUFFER_SIZE_0 ? (it.writeBuffer_9jar4r$_0 == null && (it.writeBuffer_9jar4r$_0 = h.charArray(ur().WRITE_BUFFER_SIZE_0)), Qt = d(it.writeBuffer_9jar4r$_0)) : Qt = h.charArray(ke), be(ht, Qt, 0, Et, Et + ke | 0), it.write_8chfmy$(Qt, 0, ke), m; + })); + }, Re.prototype.append_gw00v9$ = function(z) { + return z == null ? this.write_61zpoe$("null") : this.write_61zpoe$(z.toString()), this; + }, Re.prototype.append_ezbsdh$ = function(z, J, ve) { + var ke = z != null ? z : "null"; + return this.write_61zpoe$(h.subSequence(ke, J, ve).toString()), this; + }, Re.prototype.append_s8itvh$ = function(z) { + return this.write_za3lpa$(0 | z), this; + }, Br.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var dr = null; + function ur() { + return dr === null && new Br(), dr; + } + function wn(z) { + return z = z || Object.create(Re.prototype), Re.call(z), z.lock = z, z; + } + function vr() { + wi = this, this.NULL = new Sr("null"), this.TRUE = new Sr("true"), this.FALSE = new Sr("false"); + } + function Vt() { + jr.call(this), this.value_wcgww9$_0 = null; + } + Re.$metadata$ = { kind: v, simpleName: "Writer", interfaces: [] }, vr.prototype.value_za3lpa$ = function(z) { + return new $r(rn()); + }, vr.prototype.value_s8cxhz$ = function(z) { + return new $r(tn()); + }, vr.prototype.value_mx4ult$ = function(z) { + if (tt() || St()) + throw new we("Infinite and NaN values not permitted in JSON"); + return new $r(this.cutOffPointZero_0(qe())); + }, vr.prototype.value_14dthe$ = function(z) { + if (cn() || Vr()) + throw new we("Infinite and NaN values not permitted in JSON"); + return new $r(this.cutOffPointZero_0(Xe())); + }, vr.prototype.value_pdl1vj$ = function(z) { + return z == null ? this.NULL : new wr(z); + }, vr.prototype.value_6taknv$ = function(z) { + return z ? this.TRUE : this.FALSE; + }, vr.prototype.array = function() { + return Wr(); + }, vr.prototype.array_pmhfmb$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_za3lpa$(ke); + } + return ve; + }, vr.prototype.array_2muz52$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_s8cxhz$(ke); + } + return ve; + }, vr.prototype.array_8cqhcw$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_mx4ult$(ke); + } + return ve; + }, vr.prototype.array_yqxtqz$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_14dthe$(ke); + } + return ve; + }, vr.prototype.array_wwrst0$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_6taknv$(ke); + } + return ve; + }, vr.prototype.array_vqirvp$ = function(z) { + var J, ve = Wr(); + for (J = 0; J !== z.length; ++J) { + var ke = z[J]; + ve.add_61zpoe$(ke); + } + return ve; + }, vr.prototype.object = function() { + return qt(); + }, vr.prototype.parse_61zpoe$ = function(z) { + return new _n().parse_61zpoe$(z); + }, vr.prototype.parse_6nb378$ = function(z) { + return new _n().streamToValue(new Ha(z)); + }, vr.prototype.cutOffPointZero_0 = function(z) { + var J; + if (st()) { + var ve = z.length - 2 | 0; + J = z.substring(0, ve); + } else + J = z; + return J; + }, Object.defineProperty(Vt.prototype, "value", { configurable: !0, get: function() { + return this.value_wcgww9$_0; + }, set: function(z) { + this.value_wcgww9$_0 = z; + } }), Vt.prototype.startArray = function() { + return Wr(); + }, Vt.prototype.startObject = function() { + return qt(); + }, Vt.prototype.endNull = function() { + this.value = wt().NULL; + }, Vt.prototype.endBoolean_6taknv$ = function(z) { + this.value = z ? wt().TRUE : wt().FALSE; + }, Vt.prototype.endString_61zpoe$ = function(z) { + this.value = new wr(z); + }, Vt.prototype.endNumber_61zpoe$ = function(z) { + this.value = new $r(z); + }, Vt.prototype.endArray_11rb$ = function(z) { + this.value = z; + }, Vt.prototype.endObject_11rc$ = function(z) { + this.value = z; + }, Vt.prototype.endArrayValue_11rb$ = function(z) { + z != null && z.add_luq74r$(this.value); + }, Vt.prototype.endObjectValue_otyqx2$ = function(z, J) { + z != null && z.add_8kvr2e$(J, this.value); + }, Vt.$metadata$ = { kind: v, simpleName: "DefaultHandler", interfaces: [jr] }, vr.$metadata$ = { kind: f, simpleName: "Json", interfaces: [] }; + var wi = null; + function wt() { + return wi === null && new vr(), wi; + } + function pr() { + Co(), this.values_0 = null; + } + function Fn(z) { + this.closure$iterator = z; + } + function Ra() { + oo = this; + } + Object.defineProperty(pr.prototype, "isEmpty", { configurable: !0, get: function() { + return this.values_0.isEmpty(); + } }), pr.prototype.add_za3lpa$ = function(z) { + return this.values_0.add_11rb$(wt().value_za3lpa$(z)), this; + }, pr.prototype.add_s8cxhz$ = function(z) { + return this.values_0.add_11rb$(wt().value_s8cxhz$(z)), this; + }, pr.prototype.add_mx4ult$ = function(z) { + return this.values_0.add_11rb$(wt().value_mx4ult$(z)), this; + }, pr.prototype.add_14dthe$ = function(z) { + return this.values_0.add_11rb$(wt().value_14dthe$(z)), this; + }, pr.prototype.add_6taknv$ = function(z) { + return this.values_0.add_11rb$(wt().value_6taknv$(z)), this; + }, pr.prototype.add_61zpoe$ = function(z) { + return this.values_0.add_11rb$(wt().value_pdl1vj$(z)), this; + }, pr.prototype.add_luq74r$ = function(z) { + if (z == null) + throw new Me("value is null"); + return this.values_0.add_11rb$(z), this; + }, pr.prototype.set_vux9f0$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_za3lpa$(J)), this; + }, pr.prototype.set_6svq3l$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_s8cxhz$(J)), this; + }, pr.prototype.set_24o109$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_mx4ult$(J)), this; + }, pr.prototype.set_5wr77w$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_14dthe$(J)), this; + }, pr.prototype.set_fzusl$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_6taknv$(J)), this; + }, pr.prototype.set_19mbxw$ = function(z, J) { + return this.values_0.set_wxm5ur$(z, wt().value_pdl1vj$(J)), this; + }, pr.prototype.set_zefct7$ = function(z, J) { + if (J == null) + throw new Me("value is null"); + return this.values_0.set_wxm5ur$(z, J), this; + }, pr.prototype.remove_za3lpa$ = function(z) { + return this.values_0.removeAt_za3lpa$(z), this; + }, pr.prototype.size = function() { + return this.values_0.size; + }, pr.prototype.get_za3lpa$ = function(z) { + return this.values_0.get_za3lpa$(z); + }, pr.prototype.values = function() { + return je().unmodifiableList_zfnyf4$(this.values_0); + }, Fn.prototype.hasNext = function() { + return this.closure$iterator.hasNext(); + }, Fn.prototype.next = function() { + return this.closure$iterator.next(); + }, Fn.prototype.remove = function() { + throw new ct(); + }, Fn.$metadata$ = { kind: v, interfaces: [_] }, pr.prototype.iterator = function() { + return new Fn(this.values_0.iterator()); + }, pr.prototype.write_l4e0ba$ = function(z) { + z.writeArrayOpen(); + var J = this.iterator(); + if (J.hasNext()) + for (J.next().write_l4e0ba$(z); J.hasNext(); ) + z.writeArraySeparator(), J.next().write_l4e0ba$(z); + z.writeArrayClose(); + }, Object.defineProperty(pr.prototype, "isArray", { configurable: !0, get: function() { + return !0; + } }), pr.prototype.asArray = function() { + return this; + }, pr.prototype.hashCode = function() { + return y(this.values_0); + }, pr.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, pr) ? ve : x(); + return g(this.values_0, d(ke).values_0); + }, Ra.prototype.readFrom_6nb378$ = function(z) { + return ui().readFromReader_6nb378$(z).asArray(); + }, Ra.prototype.readFrom_61zpoe$ = function(z) { + return ui().readFrom_61zpoe$(z).asArray(); + }, Ra.prototype.unmodifiableArray_v27daa$ = function(z) { + return Na(z, !0); + }, Ra.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var oo = null; + function Co() { + return oo === null && new Ra(), oo; + } + function Wr(z) { + return z = z || Object.create(pr.prototype), Nt.call(z), pr.call(z), z.values_0 = new Fr(), z; + } + function Na(z, J, ve) { + if (ve = ve || Object.create(pr.prototype), Nt.call(ve), pr.call(ve), z == null) + throw new Me("array is null"); + return ve.values_0 = J ? je().unmodifiableList_zfnyf4$(z.values_0) : T(z.values_0), ve; + } + function jr() { + this.parser_3qxlfk$_0 = null; + } + function Sr(z) { + Nt.call(this), this.value = z, this.isNull_35npp$_0 = g("null", this.value), this.isTrue_3de4$_0 = g("true", this.value), this.isFalse_6t83vt$_0 = g("false", this.value); + } + function $r(z) { + Nt.call(this), this.string_0 = z; + } + function Ct() { + It(), this.names_0 = null, this.values_0 = null, this.table_0 = null; + } + function he(z, J) { + this.closure$namesIterator = z, this.closure$valuesIterator = J; + } + function Qe(z, J) { + this.name = z, this.value = J; + } + function Ue() { + this.hashTable_0 = new Int8Array(32); + } + function Je(z) { + return z = z || Object.create(Ue.prototype), Ue.call(z), z; + } + function at() { + Dt = this; + } + pr.$metadata$ = { kind: v, simpleName: "JsonArray", interfaces: [S, Nt] }, Object.defineProperty(jr.prototype, "parser", { configurable: !0, get: function() { + return this.parser_3qxlfk$_0; + }, set: function(z) { + this.parser_3qxlfk$_0 = z; + } }), Object.defineProperty(jr.prototype, "location", { configurable: !0, get: function() { + return d(this.parser).location; + } }), jr.prototype.startNull = function() { + }, jr.prototype.endNull = function() { + }, jr.prototype.startBoolean = function() { + }, jr.prototype.endBoolean_6taknv$ = function(z) { + }, jr.prototype.startString = function() { + }, jr.prototype.endString_61zpoe$ = function(z) { + }, jr.prototype.startNumber = function() { + }, jr.prototype.endNumber_61zpoe$ = function(z) { + }, jr.prototype.startArray = function() { + return null; + }, jr.prototype.endArray_11rb$ = function(z) { + }, jr.prototype.startArrayValue_11rb$ = function(z) { + }, jr.prototype.endArrayValue_11rb$ = function(z) { + }, jr.prototype.startObject = function() { + return null; + }, jr.prototype.endObject_11rc$ = function(z) { + }, jr.prototype.startObjectName_11rc$ = function(z) { + }, jr.prototype.endObjectName_otyqx2$ = function(z, J) { + }, jr.prototype.startObjectValue_otyqx2$ = function(z, J) { + }, jr.prototype.endObjectValue_otyqx2$ = function(z, J) { + }, jr.$metadata$ = { kind: v, simpleName: "JsonHandler", interfaces: [] }, Object.defineProperty(Sr.prototype, "isNull", { configurable: !0, get: function() { + return this.isNull_35npp$_0; + } }), Object.defineProperty(Sr.prototype, "isTrue", { configurable: !0, get: function() { + return this.isTrue_3de4$_0; + } }), Object.defineProperty(Sr.prototype, "isFalse", { configurable: !0, get: function() { + return this.isFalse_6t83vt$_0; + } }), Object.defineProperty(Sr.prototype, "isBoolean", { configurable: !0, get: function() { + return this.isTrue || this.isFalse; + } }), Sr.prototype.write_l4e0ba$ = function(z) { + z.writeLiteral_y4putb$(this.value); + }, Sr.prototype.toString = function() { + return this.value; + }, Sr.prototype.hashCode = function() { + return y(this.value); + }, Sr.prototype.asBoolean = function() { + return this.isNull ? Nt.prototype.asBoolean.call(this) : this.isTrue; + }, Sr.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = C(Sr)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, Sr) ? ve : x(); + return g(this.value, d(ke).value); + }, Sr.$metadata$ = { kind: v, simpleName: "JsonLiteral", interfaces: [Nt] }, Object.defineProperty($r.prototype, "isNumber", { configurable: !0, get: function() { + return !0; + } }), $r.prototype.toString = function() { + return this.string_0; + }, $r.prototype.write_l4e0ba$ = function(z) { + z.writeNumber_y4putb$(this.string_0); + }, $r.prototype.asInt = function() { + return kl(0, this.string_0, 10); + }, $r.prototype.asLong = function() { + return or(0, this.string_0); + }, $r.prototype.asFloat = function() { + return Tr(0, this.string_0); + }, $r.prototype.asDouble = function() { + return Do(0, this.string_0); + }, $r.prototype.hashCode = function() { + return y(this.string_0); + }, $r.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, $r) ? ve : x(); + return g(this.string_0, d(ke).string_0); + }, $r.$metadata$ = { kind: v, simpleName: "JsonNumber", interfaces: [Nt] }, Object.defineProperty(Ct.prototype, "isEmpty", { configurable: !0, get: function() { + return this.names_0.isEmpty(); + } }), Object.defineProperty(Ct.prototype, "isObject", { configurable: !0, get: function() { + return !0; + } }), Ct.prototype.add_bm4lxs$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_za3lpa$(J)), this; + }, Ct.prototype.add_4wgjuj$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_s8cxhz$(J)), this; + }, Ct.prototype.add_9sobi5$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_mx4ult$(J)), this; + }, Ct.prototype.add_io5o9c$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_14dthe$(J)), this; + }, Ct.prototype.add_ivxn3r$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_6taknv$(J)), this; + }, Ct.prototype.add_puj7f4$ = function(z, J) { + return this.add_8kvr2e$(z, wt().value_pdl1vj$(J)), this; + }, Ct.prototype.add_8kvr2e$ = function(z, J) { + if (z == null) + throw new Me("name is null"); + if (J == null) + throw new Me("value is null"); + return d(this.table_0).add_bm4lxs$(z, this.names_0.size), this.names_0.add_11rb$(z), this.values_0.add_11rb$(J), this; + }, Ct.prototype.set_bm4lxs$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_za3lpa$(J)), this; + }, Ct.prototype.set_4wgjuj$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_s8cxhz$(J)), this; + }, Ct.prototype.set_9sobi5$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_mx4ult$(J)), this; + }, Ct.prototype.set_io5o9c$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_14dthe$(J)), this; + }, Ct.prototype.set_ivxn3r$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_6taknv$(J)), this; + }, Ct.prototype.set_puj7f4$ = function(z, J) { + return this.set_8kvr2e$(z, wt().value_pdl1vj$(J)), this; + }, Ct.prototype.set_8kvr2e$ = function(z, J) { + if (z == null) + throw new Me("name is null"); + if (J == null) + throw new Me("value is null"); + var ve = this.indexOf_y4putb$(z); + return ve !== -1 ? this.values_0.set_wxm5ur$(ve, J) : (d(this.table_0).add_bm4lxs$(z, this.names_0.size), this.names_0.add_11rb$(z), this.values_0.add_11rb$(J)), this; + }, Ct.prototype.remove_pdl1vj$ = function(z) { + if (z == null) + throw new Me("name is null"); + var J = this.indexOf_y4putb$(z); + return J !== -1 && (d(this.table_0).remove_za3lpa$(J), this.names_0.removeAt_za3lpa$(J), this.values_0.removeAt_za3lpa$(J)), this; + }, Ct.prototype.merge_1kkabt$ = function(z) { + var J; + if (z == null) + throw new Me("object is null"); + for (J = z.iterator(); J.hasNext(); ) { + var ve = J.next(); + this.set_8kvr2e$(ve.name, ve.value); + } + return this; + }, Ct.prototype.get_pdl1vj$ = function(z) { + if (z == null) + throw new Me("name is null"); + var J = this.indexOf_y4putb$(z); + return J !== -1 ? this.values_0.get_za3lpa$(J) : null; + }, Ct.prototype.getInt_bm4lxs$ = function(z, J) { + var ve, ke = this.get_pdl1vj$(z); + return (ve = ke != null ? ke.asInt() : null) != null ? ve : J; + }, Ct.prototype.getLong_4wgjuj$ = function(z, J) { + var ve, ke = this.get_pdl1vj$(z); + return (ve = ke != null ? ke.asLong() : null) != null ? ve : J; + }, Ct.prototype.getFloat_9sobi5$ = function(z, J) { + var ve, ke = this.get_pdl1vj$(z); + return (ve = ke != null ? ke.asFloat() : null) != null ? ve : J; + }, Ct.prototype.getDouble_io5o9c$ = function(z, J) { + var ve, ke = this.get_pdl1vj$(z); + return (ve = ke != null ? ke.asDouble() : null) != null ? ve : J; + }, Ct.prototype.getBoolean_ivxn3r$ = function(z, J) { + var ve, ke = this.get_pdl1vj$(z); + return (ve = ke != null ? ke.asBoolean() : null) != null ? ve : J; + }, Ct.prototype.getString_puj7f4$ = function(z, J) { + var ve = this.get_pdl1vj$(z); + return ve != null ? ve.asString() : J; + }, Ct.prototype.size = function() { + return this.names_0.size; + }, Ct.prototype.names = function() { + return je().unmodifiableList_zfnyf4$(this.names_0); + }, he.prototype.hasNext = function() { + return this.closure$namesIterator.hasNext(); + }, he.prototype.next = function() { + return new Qe(this.closure$namesIterator.next(), this.closure$valuesIterator.next()); + }, he.$metadata$ = { kind: v, interfaces: [E] }, Ct.prototype.iterator = function() { + return new he(this.names_0.iterator(), this.values_0.iterator()); + }, Ct.prototype.write_l4e0ba$ = function(z) { + z.writeObjectOpen(); + var J = this.names_0.iterator(), ve = this.values_0.iterator(); + if (J.hasNext()) + for (z.writeMemberName_y4putb$(J.next()), z.writeMemberSeparator(), ve.next().write_l4e0ba$(z); J.hasNext(); ) + z.writeObjectSeparator(), z.writeMemberName_y4putb$(J.next()), z.writeMemberSeparator(), ve.next().write_l4e0ba$(z); + z.writeObjectClose(); + }, Ct.prototype.asObject = function() { + return this; + }, Ct.prototype.hashCode = function() { + var z = 1; + return (31 * (z = (31 * z | 0) + y(this.names_0) | 0) | 0) + y(this.values_0) | 0; + }, Ct.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, Ct) ? ve : x(); + return g(this.names_0, d(ke).names_0) && g(this.values_0, ke.values_0); + }, Ct.prototype.indexOf_y4putb$ = function(z) { + var J = d(this.table_0).get_za3rmp$(z); + return J !== -1 && g(z, this.names_0.get_za3lpa$(J)) ? J : this.names_0.lastIndexOf_11rb$(z); + }, Ct.prototype.readObject_0 = function(z) { + z.defaultReadObject(), this.table_0 = Je(), this.updateHashIndex_0(); + }, Ct.prototype.updateHashIndex_0 = function() { + var z; + z = this.names_0.size - 1 | 0; + for (var J = 0; J <= z; J++) + d(this.table_0).add_bm4lxs$(this.names_0.get_za3lpa$(J), J); + }, Qe.prototype.hashCode = function() { + var z = 1; + return (31 * (z = (31 * z | 0) + y(this.name) | 0) | 0) + y(this.value) | 0; + }, Qe.prototype.equals = function(z) { + var J, ve, ke; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var it = (ve = z) == null || h.isType(ve, Qe) ? ve : x(); + return g(this.name, d(it).name) && ((ke = this.value) != null ? ke.equals(it.value) : null); + }, Qe.$metadata$ = { kind: v, simpleName: "Member", interfaces: [] }, Ue.prototype.add_bm4lxs$ = function(z, J) { + var ve = this.hashSlotFor_0(z); + this.hashTable_0[ve] = J < 255 ? M(J + 1 | 0) : 0; + }, Ue.prototype.remove_za3lpa$ = function(z) { + var J; + J = this.hashTable_0.length - 1 | 0; + for (var ve = 0; ve <= J; ve++) + if (this.hashTable_0[ve] === (z + 1 | 0)) + this.hashTable_0[ve] = 0; + else if (this.hashTable_0[ve] > (z + 1 | 0)) { + var ke; + (ke = this.hashTable_0)[ve] = M(ke[ve] - 1); + } + }, Ue.prototype.get_za3rmp$ = function(z) { + var J = this.hashSlotFor_0(z); + return (255 & this.hashTable_0[J]) - 1 | 0; + }, Ue.prototype.hashSlotFor_0 = function(z) { + return y(z) & this.hashTable_0.length - 1; + }, Ue.$metadata$ = { kind: v, simpleName: "HashIndexTable", interfaces: [] }, at.prototype.readFrom_6nb378$ = function(z) { + return ui().readFromReader_6nb378$(z).asObject(); + }, at.prototype.readFrom_61zpoe$ = function(z) { + return ui().readFrom_61zpoe$(z).asObject(); + }, at.prototype.unmodifiableObject_p5jd56$ = function(z) { + return Lr(z, !0); + }, at.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var Dt = null; + function It() { + return Dt === null && new at(), Dt; + } + function qt(z) { + return z = z || Object.create(Ct.prototype), Nt.call(z), Ct.call(z), z.names_0 = new Fr(), z.values_0 = new Fr(), z.table_0 = Je(), z; + } + function Lr(z, J, ve) { + if (ve = ve || Object.create(Ct.prototype), Nt.call(ve), Ct.call(ve), z == null) + throw new Me("object is null"); + return J ? (ve.names_0 = je().unmodifiableList_zfnyf4$(z.names_0), ve.values_0 = je().unmodifiableList_zfnyf4$(z.values_0)) : (ve.names_0 = T(z.names_0), ve.values_0 = T(z.values_0)), ve.table_0 = Je(), ve.updateHashIndex_0(), ve; + } + function wr(z) { + Nt.call(this), this.string_0 = z; + } + function Nt() { + ui(); + } + function nt() { + Cn = this, this.TRUE = new Sr("true"), this.FALSE = new Sr("false"), this.NULL = new Sr("null"); + } + Ct.$metadata$ = { kind: v, simpleName: "JsonObject", interfaces: [P, Nt] }, wr.prototype.write_l4e0ba$ = function(z) { + z.writeString_y4putb$(this.string_0); + }, Object.defineProperty(wr.prototype, "isString", { configurable: !0, get: function() { + return !0; + } }), wr.prototype.asString = function() { + return this.string_0; + }, wr.prototype.hashCode = function() { + return y(this.string_0); + }, wr.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, wr) ? ve : x(); + return g(this.string_0, d(ke).string_0); + }, wr.$metadata$ = { kind: v, simpleName: "JsonString", interfaces: [Nt] }, Object.defineProperty(Nt.prototype, "isObject", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isArray", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isNumber", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isString", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isBoolean", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isTrue", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isFalse", { configurable: !0, get: function() { + return !1; + } }), Object.defineProperty(Nt.prototype, "isNull", { configurable: !0, get: function() { + return !1; + } }), Nt.prototype.asObject = function() { + throw new ct("Not an object: " + this.toString()); + }, Nt.prototype.asArray = function() { + throw new ct("Not an array: " + this.toString()); + }, Nt.prototype.asInt = function() { + throw new ct("Not a number: " + this.toString()); + }, Nt.prototype.asLong = function() { + throw new ct("Not a number: " + this.toString()); + }, Nt.prototype.asFloat = function() { + throw new ct("Not a number: " + this.toString()); + }, Nt.prototype.asDouble = function() { + throw new ct("Not a number: " + this.toString()); + }, Nt.prototype.asString = function() { + throw new ct("Not a string: " + this.toString()); + }, Nt.prototype.asBoolean = function() { + throw new ct("Not a boolean: " + this.toString()); + }, Nt.prototype.writeTo_j6tqms$ = function(z, J) { + if (J === void 0 && (J = qi().MINIMAL), z == null) + throw new Me("writer is null"); + if (J == null) + throw new Me("config is null"); + var ve = new Gr(z, 128); + this.write_l4e0ba$(J.createWriter_97tyn8$(ve)), ve.flush(); + }, Nt.prototype.toString = function() { + return this.toString_fmi98k$(qi().MINIMAL); + }, Nt.prototype.toString_fmi98k$ = function(z) { + var J = new fr(); + try { + this.writeTo_j6tqms$(J, z); + } catch (ve) { + throw h.isType(ve, _e) ? bt(ve) : ve; + } + return J.toString(); + }, Nt.prototype.equals = function(z) { + return this === z; + }, nt.prototype.readFromReader_6nb378$ = function(z) { + return wt().parse_6nb378$(z); + }, nt.prototype.readFrom_61zpoe$ = function(z) { + return wt().parse_61zpoe$(z); + }, nt.prototype.valueOf_za3lpa$ = function(z) { + return wt().value_za3lpa$(z); + }, nt.prototype.valueOf_s8cxhz$ = function(z) { + return wt().value_s8cxhz$(z); + }, nt.prototype.valueOf_mx4ult$ = function(z) { + return wt().value_mx4ult$(z); + }, nt.prototype.valueOf_14dthe$ = function(z) { + return wt().value_14dthe$(z); + }, nt.prototype.valueOf_61zpoe$ = function(z) { + return wt().value_pdl1vj$(z); + }, nt.prototype.valueOf_6taknv$ = function(z) { + return wt().value_6taknv$(z); + }, nt.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var Cn = null; + function ui() { + return Cn === null && new nt(), Cn; + } + function yn(z) { + Wn(), this.writer = z; + } + function To() { + ss = this, this.CONTROL_CHARACTERS_END_0 = 31, this.QUOT_CHARS_0 = h.charArrayOf(92, 34), this.BS_CHARS_0 = h.charArrayOf(92, 92), this.LF_CHARS_0 = h.charArrayOf(92, 110), this.CR_CHARS_0 = h.charArrayOf(92, 114), this.TAB_CHARS_0 = h.charArrayOf(92, 116), this.UNICODE_2028_CHARS_0 = h.charArrayOf(92, 117, 50, 48, 50, 56), this.UNICODE_2029_CHARS_0 = h.charArrayOf(92, 117, 50, 48, 50, 57), this.HEX_DIGITS_0 = h.charArrayOf(48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102); + } + Nt.$metadata$ = { kind: v, simpleName: "JsonValue", interfaces: [] }, yn.prototype.writeLiteral_y4putb$ = function(z) { + this.writer.write_61zpoe$(z); + }, yn.prototype.writeNumber_y4putb$ = function(z) { + this.writer.write_61zpoe$(z); + }, yn.prototype.writeString_y4putb$ = function(z) { + ci(this.writer, 34), this.writeJsonString_y4putb$(z), ci(this.writer, 34); + }, yn.prototype.writeArrayOpen = function() { + ci(this.writer, 91); + }, yn.prototype.writeArrayClose = function() { + ci(this.writer, 93); + }, yn.prototype.writeArraySeparator = function() { + ci(this.writer, 44); + }, yn.prototype.writeObjectOpen = function() { + ci(this.writer, 123); + }, yn.prototype.writeObjectClose = function() { + ci(this.writer, 125); + }, yn.prototype.writeMemberName_y4putb$ = function(z) { + ci(this.writer, 34), this.writeJsonString_y4putb$(z), ci(this.writer, 34); + }, yn.prototype.writeMemberSeparator = function() { + ci(this.writer, 58); + }, yn.prototype.writeObjectSeparator = function() { + ci(this.writer, 44); + }, yn.prototype.writeJsonString_y4putb$ = function(z) { + var J, ve = z.length, ke = 0; + J = ve - 1 | 0; + for (var it = 0; it <= J; it++) { + var ht = Wn().getReplacementChars_0(z.charCodeAt(it)); + ht != null && (this.writer.write_3m52m6$(z, ke, it - ke | 0), this.writer.write_4hbowm$(ht), ke = it + 1 | 0); + } + this.writer.write_3m52m6$(z, ke, ve - ke | 0); + }, To.prototype.getReplacementChars_0 = function(z) { + return z > 92 ? z < 8232 || z > 8233 ? null : z === 8232 ? this.UNICODE_2028_CHARS_0 : this.UNICODE_2029_CHARS_0 : z === 92 ? this.BS_CHARS_0 : z > 34 ? null : z === 34 ? this.QUOT_CHARS_0 : (0 | z) > this.CONTROL_CHARACTERS_END_0 ? null : z === 10 ? this.LF_CHARS_0 : z === 13 ? this.CR_CHARS_0 : z === 9 ? this.TAB_CHARS_0 : h.charArrayOf(92, 117, 48, 48, this.HEX_DIGITS_0[(0 | z) >> 4 & 15], this.HEX_DIGITS_0[15 & (0 | z)]); + }, To.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var ss = null; + function Wn() { + return ss === null && new To(), ss; + } + function ci(z, J) { + z.write_za3lpa$(0 | J); + } + function ya(z, J, ve) { + this.offset = z, this.line = J, this.column = ve; + } + function fn(z, J) { + b.call(this), this.message_72rz6e$_0 = z + " at " + R(J), this.cause_95carw$_0 = null, this.location = J, h.captureStack(b, this), this.name = "ParseException"; + } + function Yn(z) { + ki(), Ki.call(this), this.indentChars_0 = z; + } + function Nn(z, J) { + yn.call(this, z), this.indentChars_0 = J, this.indent_0 = 0; + } + function ls() { + us = this; + } + yn.$metadata$ = { kind: v, simpleName: "JsonWriter", interfaces: [] }, ya.prototype.toString = function() { + return this.line.toString() + ":" + R(this.column); + }, ya.prototype.hashCode = function() { + return this.offset; + }, ya.prototype.equals = function(z) { + var J, ve; + if (this === z) + return !0; + if (z == null || (J = h.getKClassFromExpression(this)) == null || !J.equals(h.getKClassFromExpression(z))) + return !1; + var ke = (ve = z) == null || h.isType(ve, ya) ? ve : x(); + return this.offset === d(ke).offset && this.column === ke.column && this.line === ke.line; + }, ya.$metadata$ = { kind: v, simpleName: "Location", interfaces: [] }, Object.defineProperty(fn.prototype, "offset", { configurable: !0, get: function() { + return this.location.offset; + } }), Object.defineProperty(fn.prototype, "line", { configurable: !0, get: function() { + return this.location.line; + } }), Object.defineProperty(fn.prototype, "column", { configurable: !0, get: function() { + return this.location.column; + } }), Object.defineProperty(fn.prototype, "message", { get: function() { + return this.message_72rz6e$_0; + } }), Object.defineProperty(fn.prototype, "cause", { get: function() { + return this.cause_95carw$_0; + } }), fn.$metadata$ = { kind: v, simpleName: "ParseException", interfaces: [b] }, Yn.prototype.createWriter_97tyn8$ = function(z) { + return new Nn(z, this.indentChars_0); + }, Nn.prototype.writeArrayOpen = function() { + this.indent_0 = this.indent_0 + 1 | 0, this.writer.write_za3lpa$(91), this.writeNewLine_0(); + }, Nn.prototype.writeArrayClose = function() { + this.indent_0 = this.indent_0 - 1 | 0, this.writeNewLine_0(), this.writer.write_za3lpa$(93); + }, Nn.prototype.writeArraySeparator = function() { + this.writer.write_za3lpa$(44), this.writeNewLine_0() || this.writer.write_za3lpa$(32); + }, Nn.prototype.writeObjectOpen = function() { + this.indent_0 = this.indent_0 + 1 | 0, this.writer.write_za3lpa$(123), this.writeNewLine_0(); + }, Nn.prototype.writeObjectClose = function() { + this.indent_0 = this.indent_0 - 1 | 0, this.writeNewLine_0(), this.writer.write_za3lpa$(125); + }, Nn.prototype.writeMemberSeparator = function() { + this.writer.write_za3lpa$(58), this.writer.write_za3lpa$(32); + }, Nn.prototype.writeObjectSeparator = function() { + this.writer.write_za3lpa$(44), this.writeNewLine_0() || this.writer.write_za3lpa$(32); + }, Nn.prototype.writeNewLine_0 = function() { + var z; + if (this.indentChars_0 == null) + return !1; + this.writer.write_za3lpa$(10), z = this.indent_0 - 1 | 0; + for (var J = 0; J <= z; J++) + this.writer.write_4hbowm$(this.indentChars_0); + return !0; + }, Nn.$metadata$ = { kind: v, simpleName: "PrettyPrintWriter", interfaces: [yn] }, ls.prototype.singleLine = function() { + return new Yn(h.charArray(0)); + }, ls.prototype.indentWithSpaces_za3lpa$ = function(z) { + if (z < 0) + throw new we("number is negative"); + var J = h.charArray(z); + return ae().fill_ugzc7n$(J, 32), new Yn(J); + }, ls.prototype.indentWithTabs = function() { + return new Yn(h.charArrayOf(9)); + }, ls.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var us = null; + function ki() { + return us === null && new ls(), us; + } + function Ki() { + qi(); + } + function Qi() { + Io = this, this.MINIMAL = new Hr(), this.PRETTY_PRINT = ki().indentWithSpaces_za3lpa$(2); + } + function Hr() { + Ki.call(this); + } + Yn.$metadata$ = { kind: v, simpleName: "PrettyPrint", interfaces: [Ki] }, Hr.prototype.createWriter_97tyn8$ = function(z) { + return new yn(z); + }, Hr.$metadata$ = { kind: v, interfaces: [Ki] }, Qi.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var Io = null; + function qi() { + return Io === null && new Qi(), Io; + } + function Gr(z, J) { + J === void 0 && (J = 16), wn(this), this.writer_0 = z, this.buffer_0 = null, this.fill_0 = 0, this.buffer_0 = h.charArray(J); + } + function Oi(z) { + z === void 0 && (z = null), b.call(this), this.message_y7nasg$_0 = z, this.cause_26vz5q$_0 = null, h.captureStack(b, this), this.name = "SyntaxException"; + } + function On(z) { + z === void 0 && (z = null), b.call(this), this.message_kt89er$_0 = z, this.cause_c2uidd$_0 = null, h.captureStack(b, this), this.name = "IoException"; + } + function Tn(z) { + cs(), this.flex = z, this.myTokenType_0 = null, this.bufferSequence_i8enee$_0 = null, this.myTokenStart_0 = 0, this.myTokenEnd_0 = 0, this.bufferEnd_7ee91e$_0 = 0, this.myState_0 = 0, this.myFailed_0 = !1; + } + function za() { + Us = this; + } + Ki.$metadata$ = { kind: v, simpleName: "WriterConfig", interfaces: [] }, Gr.prototype.write_za3lpa$ = function(z) { + var J; + this.fill_0 > (this.buffer_0.length - 1 | 0) && this.flush(), this.buffer_0[J = this.fill_0, this.fill_0 = J + 1 | 0, J] = p(z); + }, Gr.prototype.write_8chfmy$ = function(z, J, ve) { + this.fill_0 > (this.buffer_0.length - ve | 0) && (this.flush(), ve > this.buffer_0.length) ? this.writer_0.write_8chfmy$(z, J, ve) : (xi().arraycopy_yp22ie$(z, J, this.buffer_0, this.fill_0, ve), this.fill_0 = this.fill_0 + ve | 0); + }, Gr.prototype.write_3m52m6$ = function(z, J, ve) { + this.fill_0 > (this.buffer_0.length - ve | 0) && (this.flush(), ve > this.buffer_0.length) ? this.writer_0.write_3m52m6$(z, J, ve) : (be(z, this.buffer_0, this.fill_0, J, ve), this.fill_0 = this.fill_0 + ve | 0); + }, Gr.prototype.flush = function() { + this.writer_0.write_8chfmy$(this.buffer_0, 0, this.fill_0), this.fill_0 = 0; + }, Gr.prototype.close = function() { + }, Gr.$metadata$ = { kind: v, simpleName: "WritingBuffer", interfaces: [Re] }, Object.defineProperty(Oi.prototype, "message", { get: function() { + return this.message_y7nasg$_0; + } }), Object.defineProperty(Oi.prototype, "cause", { get: function() { + return this.cause_26vz5q$_0; + } }), Oi.$metadata$ = { kind: v, simpleName: "SyntaxException", interfaces: [b] }, Object.defineProperty(On.prototype, "message", { get: function() { + return this.message_kt89er$_0; + } }), Object.defineProperty(On.prototype, "cause", { get: function() { + return this.cause_c2uidd$_0; + } }), On.$metadata$ = { kind: v, simpleName: "IoException", interfaces: [b] }, Object.defineProperty(Tn.prototype, "bufferSequence", { configurable: !0, get: function() { + return this.bufferSequence_i8enee$_0; + }, set: function(z) { + this.bufferSequence_i8enee$_0 = z; + } }), Object.defineProperty(Tn.prototype, "bufferEnd", { configurable: !0, get: function() { + return this.bufferEnd_7ee91e$_0; + }, set: function(z) { + this.bufferEnd_7ee91e$_0 = z; + } }), Object.defineProperty(Tn.prototype, "state", { configurable: !0, get: function() { + return this.locateToken_0(), this.myState_0; + } }), Object.defineProperty(Tn.prototype, "tokenType", { configurable: !0, get: function() { + return this.locateToken_0(), this.myTokenType_0; + } }), Object.defineProperty(Tn.prototype, "tokenStart", { configurable: !0, get: function() { + return this.locateToken_0(), this.myTokenStart_0; + } }), Object.defineProperty(Tn.prototype, "tokenEnd", { configurable: !0, get: function() { + return this.locateToken_0(), this.myTokenEnd_0; + } }), Tn.prototype.start_6na8x6$ = function(z, J, ve, ke) { + this.bufferSequence = z, this.myTokenEnd_0 = J, this.myTokenStart_0 = this.myTokenEnd_0, this.bufferEnd = ve, this.flex.reset_6na8x6$(d(this.bufferSequence), J, ve, ke), this.myTokenType_0 = null; + }, Tn.prototype.advance = function() { + this.locateToken_0(), this.myTokenType_0 = null; + }, Tn.prototype.locateToken_0 = function() { + if (this.myTokenType_0 == null && (this.myTokenStart_0 = this.myTokenEnd_0, !this.myFailed_0)) + try { + this.myState_0 = this.flex.yystate(), this.myTokenType_0 = this.flex.advance(); + } catch (z) { + if (h.isType(z, ri) || !h.isType(z, b)) + throw z; + this.myFailed_0 = !0, this.myTokenType_0 = mt().BAD_CHARACTER, this.myTokenEnd_0 = this.bufferEnd; + } + }, za.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var Us = null; + function cs() { + return Us === null && new za(), Us; + } + function dn(z) { + z === void 0 && (z = new _i()), this.options_0 = z, this.buffer_0 = new _t(), this.level_0 = 0; + } + function _i() { + _a(), this.target = "json", this.quoteFallback = "double", this.useQuotes = !0, this.usePropertyNameQuotes = !0, this.useArrayCommas = !0, this.useObjectCommas = !0, this.indentLevel = 2, this.objectItemNewline = !1, this.arrayItemNewline = !1, this.isSpaceAfterComma = !0, this.isSpaceAfterColon = !0, this.escapeUnicode = !1; + } + function Li() { + ei = this; + } + Tn.$metadata$ = { kind: v, simpleName: "FlexAdapter", interfaces: [] }, Object.defineProperty(Li.prototype, "RJsonCompact", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "rjson", z.useQuotes = !1, z.usePropertyNameQuotes = !1, z.quoteFallback = "single", z.useArrayCommas = !1, z.useObjectCommas = !1, z.objectItemNewline = !1, z.arrayItemNewline = !1, z.isSpaceAfterComma = !1, z.isSpaceAfterColon = !1, z; + } }), Object.defineProperty(Li.prototype, "RJsonPretty", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "rjson", z.useQuotes = !1, z.usePropertyNameQuotes = !1, z.quoteFallback = "single", z.useArrayCommas = !1, z.useObjectCommas = !1, z.objectItemNewline = !0, z.arrayItemNewline = !0, z.isSpaceAfterComma = !0, z.isSpaceAfterColon = !0, z; + } }), Object.defineProperty(Li.prototype, "JsonCompact", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "json", z.useQuotes = !0, z.usePropertyNameQuotes = !0, z.useArrayCommas = !0, z.useObjectCommas = !0, z.objectItemNewline = !1, z.arrayItemNewline = !1, z.isSpaceAfterComma = !1, z.isSpaceAfterColon = !1, z; + } }), Object.defineProperty(Li.prototype, "JsonPretty", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "json", z.useQuotes = !0, z.usePropertyNameQuotes = !0, z.useArrayCommas = !0, z.useObjectCommas = !0, z.objectItemNewline = !0, z.arrayItemNewline = !0, z.isSpaceAfterComma = !0, z.isSpaceAfterColon = !0, z; + } }), Object.defineProperty(Li.prototype, "JsCompact", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "js", z.useQuotes = !0, z.usePropertyNameQuotes = !1, z.quoteFallback = "single", z.useArrayCommas = !0, z.useObjectCommas = !0, z.objectItemNewline = !1, z.arrayItemNewline = !1, z.isSpaceAfterComma = !1, z.isSpaceAfterColon = !1, z; + } }), Object.defineProperty(Li.prototype, "JsPretty", { configurable: !0, get: function() { + var z = new _i(); + return z.target = "js", z.useQuotes = !0, z.usePropertyNameQuotes = !1, z.quoteFallback = "single", z.useArrayCommas = !0, z.useObjectCommas = !0, z.objectItemNewline = !0, z.arrayItemNewline = !0, z.isSpaceAfterComma = !0, z.isSpaceAfterColon = !0, z; + } }), Li.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var so, ei = null; + function _a() { + return ei === null && new Li(), ei; + } + function du(z) { + return !!so.contains_11rb$(z) || !ce("[a-zA-Z_][a-zA-Z_0-9]*").matches_6bul2c$(z); + } + function vu(z) { + this.elementType = z; + } + function Ir(z) { + this.id = z; + } + function hi(z) { + Ir.call(this, z); + } + function In(z) { + Ir.call(this, z); + } + function Ar(z) { + Ir.call(this, z.elementType.id), this.node = z; + } + function Ba(z) { + this.string = z; + } + function lo() { + b.call(this), this.message_5xs4d4$_0 = void 0, this.cause_f0a41y$_0 = null, h.captureStack(b, this), this.name = "ArrayIndexOutOfBoundsException"; + } + function Ao(z) { + b.call(this), this.message_v24yh0$_0 = z, this.cause_rj05em$_0 = null, h.captureStack(b, this), this.name = "Error"; + } + function Mn() { + ti(); + } + function Er() { + ja = this; + } + _i.$metadata$ = { kind: v, simpleName: "Options", interfaces: [] }, dn.prototype.valueToStream = function(z) { + return this.buffer_0.length = 0, this.printValue_0(z), this.buffer_0.byteInputStream(); + }, dn.prototype.valueToString = function(z) { + return this.buffer_0.length = 0, this.printValue_0(z), this.buffer_0.toString(); + }, dn.prototype.stringToString = function(z) { + var J = Ys().getDefault().createParser().streamToValue(ar(z)); + return this.buffer_0.length = 0, this.printValue_0(J), this.buffer_0.toString(); + }, dn.prototype.streamToStream = function(z) { + var J = Ys().getDefault().createParser().streamToValue(z); + return this.buffer_0.length = 0, this.printValue_0(J), this.buffer_0.byteInputStream(); + }, dn.prototype.streamToString = function(z) { + var J = Ys().getDefault().createParser().streamToValue(z); + return this.printValue_0(J), this.buffer_0.toString(); + }, dn.prototype.printValue_0 = function(z, J) { + if (J === void 0 && (J = !1), h.isType(z, Sr)) + this.append_0(z.value, void 0, J); + else if (h.isType(z, wr)) { + var ve = this.tryEscapeUnicode_0(z.asString()); + this.append_0(Mo(ve, this.options_0, !1), void 0, J); + } else if (h.isType(z, $r)) + this.append_0(this.toIntOrDecimalString_0(z), void 0, J); + else if (h.isType(z, Ct)) + this.printObject_0(z, J); + else { + if (!h.isType(z, pr)) + throw new Oi("Unexpected type: " + h.getKClassFromExpression(z).toString()); + this.printArray_0(z, J); + } + }, dn.prototype.tryEscapeUnicode_0 = function(z) { + var J; + if (this.options_0.escapeUnicode) { + var ve, ke = $(z.length); + for (ve = G(z); ve.hasNext(); ) { + var it, ht = N(ve.next()), Et = ke.add_11rb$, Qt = Q(ht); + if ((0 | N(Qt)) > 2047) { + for (var lr = "\\u" + bu(0 | N(Qt)); lr.length < 4; ) + lr = "0" + lr; + it = lr; + } else + it = String.fromCharCode(N(Qt)); + Et.call(ke, it); + } + J = F(ke, ""); + } else + J = z; + return J; + }, dn.prototype.printObject_0 = function(z, J) { + this.append_0("{", void 0, J), this.level_0 = this.level_0 + 1 | 0; + for (var ve = !!this.options_0.objectItemNewline && this.options_0.arrayItemNewline, ke = 0, it = z.iterator(); it.hasNext(); ++ke) { + var ht = it.next(); + this.options_0.objectItemNewline && this.buffer_0.append_61zpoe$(` +`), this.printPair_0(ht.name, ht.value, ve), ke < (z.size() - 1 | 0) && (this.options_0.useObjectCommas ? (this.append_0(",", void 0, !1), this.options_0.isSpaceAfterComma && !this.options_0.objectItemNewline && this.append_0(" ", void 0, !1)) : this.options_0.objectItemNewline || this.append_0(" ", void 0, !1)); + } + this.level_0 = this.level_0 - 1 | 0, this.options_0.objectItemNewline && this.buffer_0.append_61zpoe$(` +`), this.append_0("}", void 0, this.options_0.objectItemNewline); + }, dn.prototype.printArray_0 = function(z, J) { + var ve; + J === void 0 && (J = !0), this.append_0("[", void 0, J), this.level_0 = this.level_0 + 1 | 0; + var ke = 0; + for (ve = z.iterator(); ve.hasNext(); ) { + var it = ve.next(), ht = this.options_0.arrayItemNewline; + this.options_0.arrayItemNewline && this.buffer_0.append_61zpoe$(` +`), this.printValue_0(it, ht), ke < (z.size() - 1 | 0) && (this.options_0.useArrayCommas ? (this.append_0(",", void 0, !1), this.options_0.isSpaceAfterComma && !this.options_0.arrayItemNewline && this.append_0(" ", void 0, !1)) : this.options_0.arrayItemNewline || this.append_0(" ", void 0, !1)), ke = ke + 1 | 0; + } + this.level_0 = this.level_0 - 1 | 0, this.options_0.arrayItemNewline && this.buffer_0.append_61zpoe$(` +`), this.append_0("]", void 0, this.options_0.arrayItemNewline); + }, dn.prototype.printPair_0 = function(z, J, ve) { + ve === void 0 && (ve = !0), this.printKey_0(z, ve), this.append_0(":", void 0, !1), this.options_0.isSpaceAfterColon && this.append_0(" ", void 0, !1), this.printValue_0(J, !1); + }, dn.prototype.printKey_0 = function(z, J) { + if (J === void 0 && (J = !0), !this.options_0.usePropertyNameQuotes && ta(z)) + this.append_0(z, void 0, J); + else { + var ve = this.tryEscapeUnicode_0(z); + this.append_0(Mo(ve, this.options_0, !0), void 0, J); + } + }, dn.prototype.append_0 = function(z, J, ve) { + var ke, it; + if (J === void 0 && (J = !1), ve === void 0 && (ve = !0), J && this.buffer_0.append_61zpoe$(` +`), ve) { + ke = this.level_0; + for (var ht = 0; ht < ke; ht++) { + it = this.options_0.indentLevel; + for (var Et = 0; Et < it; Et++) + this.buffer_0.append_61zpoe$(" "); + } + } + this.buffer_0.append_61zpoe$(z); + }, dn.prototype.toIntOrDecimalString_0 = function(z) { + var J, ve = z.asDouble(), ke = z.asDouble(); + if (ve === ee.floor(ke)) + return z.asInt().toString(); + try { + return z.asDouble().toString(); + } catch (it) { + if (!h.isType(it, b)) + throw it; + J = z.asInt().toString(); + } + return J; + }, dn.$metadata$ = { kind: v, simpleName: "PrettyPrinter", interfaces: [] }, vu.$metadata$ = { kind: v, simpleName: "ASTNode", interfaces: [] }, Ir.$metadata$ = { kind: v, simpleName: "IElementType", interfaces: [] }, hi.$metadata$ = { kind: v, simpleName: "RJsonElementType", interfaces: [Ir] }, In.$metadata$ = { kind: v, simpleName: "RJsonTokenType", interfaces: [Ir] }, Ar.$metadata$ = { kind: v, simpleName: "PsiElement", interfaces: [Ir] }, Ba.$metadata$ = { kind: v, simpleName: "Reader", interfaces: [] }, Object.defineProperty(lo.prototype, "message", { get: function() { + return this.message_5xs4d4$_0; + } }), Object.defineProperty(lo.prototype, "cause", { get: function() { + return this.cause_f0a41y$_0; + } }), lo.$metadata$ = { kind: v, simpleName: "ArrayIndexOutOfBoundsException", interfaces: [b] }, Object.defineProperty(Ao.prototype, "message", { get: function() { + return this.message_v24yh0$_0; + } }), Object.defineProperty(Ao.prototype, "cause", { get: function() { + return this.cause_rj05em$_0; + } }), Ao.$metadata$ = { kind: v, simpleName: "Error", interfaces: [b] }, Er.prototype.codePointAt_905azu$ = function(z, J) { + return 0 | z.charCodeAt(J); + }, Er.prototype.charCount_za3lpa$ = function(z) { + return 1; + }, Er.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var ja = null; + function ti() { + return ja === null && new Er(), ja; + } + function ri() { + b.call(this), this.message_us6fov$_0 = void 0, this.cause_i5ew99$_0 = null, h.captureStack(b, this), this.name = "ProcessCanceledException"; + } + function Xn() { + } + function Ln(z) { + Ar.call(this, z); + } + function ni(z) { + Ar.call(this, z); + } + function Ve(z) { + Ar.call(this, z); + } + function Fa(z) { + Ar.call(this, z); + } + function Zn(z) { + Ar.call(this, z); + } + function ea(z) { + Ar.call(this, z); + } + function Gt(z) { + Ar.call(this, z); + } + function Mr(z) { + Ar.call(this, z); + } + function $a(z) { + Ar.call(this, z); + } + function Cr(z) { + Ar.call(this, z); + } + function Yt(z) { + Jn(), this.zzReader_0 = z, this.zzState_0 = 0, this.zzLexicalState_0 = Jn().YYINITIAL, this.zzBuffer_0 = "", this.zzMarkedPos_0 = 0, this.zzCurrentPos_0 = 0, this.tokenStart_f7s8lc$_0 = 0, this.zzEndRead_0 = 0, this.zzAtBOL_0 = !0, this.zzAtEOF_0 = !1, this.zzEOFDone_0 = !1, this.yychar = 0, this.yycolumn = 0, this.yyline = 0; + } + function bi() { + At = this, this.YYEOF = -1, this.ZZ_BUFFERSIZE_0 = 16384, this.YYINITIAL = 0, this.ZZ_LEXSTATE_0 = new Int32Array([0, 0]), this.ZZ_CMAP_Z = this.zzUnpackCMap_0("\0C€"), this.ZZ_CMAP_Y = this.zzUnpackCMap_0("\0+Ÿ"), this.ZZ_CMAP_A = this.zzUnpackCMap_0(` \0\0\0\x07\0 \0\v\v\f \r\0\0\0 \0\0\b\0 +!\0\0"\0\0# \0\0\0\x1B\x07\0\0ß\0\0\v\0\0/\0 \0`), this.ZZ_ACTION_PACKED_0_0 = `\x07\b  +\0\v\f\0\r\0\0\0\f\0`, this.ZZ_ACTION_0 = this.zzUnpackAction_1(), this.ZZ_ROWMAP_PACKED_0_0 = "\0\0\0$\0H\0l\0\0´\0Ø\0ü\0Ġ\0ń\0Ũ\0ƌ\0ư\0ǔ\0Ǹ\0Ȝ\0ɀ\0ɤ\0ʈ\0\0\0\0\0\0\0ʬ\0Ø\0ː\0˴\0̘\0\0̼\0͠\0΄\0\0Ψ\0ό\0\0ϰ\0Д\0и\0ќ\0Ҁ\0Ҥ\0ӈ\0Ӭ\0Ԑ\0Դ\0՘\0ϰ\0ռ\0֠\0ׄ\0ר\0$\0\0´\0ü\0Ġ\0،\0$\0ذ\0$\0ٔ\0$\0ٸ\0ڜ", this.ZZ_ROWMAP_0 = this.zzUnpackRowMap_1(), this.ZZ_TRANS_PACKED_0_0 = `\x07\b  +\v\f\r\0\0\x1B\0\0\0 \0$\0\0 \x1B\0!!\0!"#!$\0$%$&$\0\0\x1B\0\v\f\r\0\0\0\x1B\0\r'\b\0\0\0\x1B\0\f\r \0\0\0\x1B\0\r \0\0\0\x1B\0(\v\0\0\0\x1B\0\x07)\0\0\0\x1B\0\0*\0\0\x1B\0\r+\0\0\0\x1B\0\0,\0\0\x1B\0\r-\0 +\0\0!.\0/\0!!\0!0#\x1B!\0!!$\0$1$&$\0!$\02\0\x1B\02222\02\0\0\x1B\0(\v\0\0\0\x1B\0\b3\0\0\0\x1B\0\04\0\0\x1B\0\05\0\0\x1B\0\06\0\0\x1B\0\f7\08.\09!!\0:!!$\0;!$\0\0\x1B\0 <\0\0\0\x1B\0\0=\0\0\x1B\0\0>\0\0\x1B\0\0?\0\0\x1B\0\x07@\0\0\0\x1B\0\0A\0\0\x1B\0 B\0\0\0\x1B\0 +C\0\0\0\x1B\0\v7\0`, this.ZZ_TRANS_0 = this.zzUnpackTrans_1(), this.ZZ_UNKNOWN_ERROR_0 = 0, this.ZZ_NO_MATCH_0 = 1, this.ZZ_PUSHBACK_2BIG_0 = 2, this.ZZ_ERROR_MSG_0 = ["Unknown internal scanner error", "Error: could not match input", "Error: pushback value was too large"], this.ZZ_ATTRIBUTE_PACKED_0_0 = "  \0\0 \0 \0 \x07\0 \0\b", this.ZZ_ATTRIBUTE_0 = this.zzUnpackAttribute_1(); + } + Mn.$metadata$ = { kind: v, simpleName: "Character", interfaces: [] }, Object.defineProperty(ri.prototype, "message", { get: function() { + return this.message_us6fov$_0; + } }), Object.defineProperty(ri.prototype, "cause", { get: function() { + return this.cause_i5ew99$_0; + } }), ri.$metadata$ = { kind: v, simpleName: "ProcessCanceledException", interfaces: [b] }, Xn.$metadata$ = { kind: v, simpleName: "StringBuffer", interfaces: [] }, Ln.$metadata$ = { kind: v, simpleName: "RJsonIdImpl", interfaces: [Ar] }, ni.$metadata$ = { kind: v, simpleName: "RJsonBooleanImpl", interfaces: [Ar] }, Ve.$metadata$ = { kind: v, simpleName: "RJsonCommentImpl", interfaces: [Ar] }, Fa.$metadata$ = { kind: v, simpleName: "RJsonListImpl", interfaces: [Ar] }, Zn.$metadata$ = { kind: v, simpleName: "RJsonObjectImpl", interfaces: [Ar] }, ea.$metadata$ = { kind: v, simpleName: "RJsonPairImpl", interfaces: [Ar] }, Gt.$metadata$ = { kind: v, simpleName: "RJsonStringImpl", interfaces: [Ar] }, Mr.$metadata$ = { kind: v, simpleName: "RJsonValueImpl", interfaces: [Ar] }, $a.$metadata$ = { kind: v, simpleName: "RJsonWhiteSpaceImpl", interfaces: [Ar] }, Cr.$metadata$ = { kind: v, simpleName: "RJsonBadCharacterImpl", interfaces: [Ar] }, Object.defineProperty(Yt.prototype, "tokenStart", { configurable: !0, get: function() { + return this.tokenStart_f7s8lc$_0; + }, set: function(z) { + this.tokenStart_f7s8lc$_0 = z; + } }), Object.defineProperty(Yt.prototype, "tokenEnd", { configurable: !0, get: function() { + return this.tokenStart + this.yylength() | 0; + } }), Yt.prototype.reset_6na8x6$ = function(z, J, ve, ke) { + this.zzBuffer_0 = z, this.tokenStart = J, this.zzMarkedPos_0 = this.tokenStart, this.zzCurrentPos_0 = this.zzMarkedPos_0, this.zzAtEOF_0 = !1, this.zzAtBOL_0 = !0, this.zzEndRead_0 = ve, this.yybegin_za3lpa$(ke); + }, Yt.prototype.zzRefill_0 = function() { + return !0; + }, Yt.prototype.yystate = function() { + return this.zzLexicalState_0; + }, Yt.prototype.yybegin_za3lpa$ = function(z) { + this.zzLexicalState_0 = z; + }, Yt.prototype.yytext = function() { + return h.subSequence(this.zzBuffer_0, this.tokenStart, this.zzMarkedPos_0); + }, Yt.prototype.yycharat_za3lpa$ = function(z) { + return Q(this.zzBuffer_0.charCodeAt(this.tokenStart + z | 0)); + }, Yt.prototype.yylength = function() { + return this.zzMarkedPos_0 - this.tokenStart | 0; + }, Yt.prototype.zzScanError_0 = function(z) { + var J; + try { + J = Jn().ZZ_ERROR_MSG_0[z]; + } catch (ve) { + if (!h.isType(ve, lo)) + throw ve; + J = Jn().ZZ_ERROR_MSG_0[Jn().ZZ_UNKNOWN_ERROR_0]; + } + throw new Ao(J); + }, Yt.prototype.yypushback_za3lpa$ = function(z) { + z > this.yylength() && this.zzScanError_0(Jn().ZZ_PUSHBACK_2BIG_0), this.zzMarkedPos_0 = this.zzMarkedPos_0 - z | 0; + }, Yt.prototype.zzDoEOF_0 = function() { + this.zzEOFDone_0 || (this.zzEOFDone_0 = !0); + }, Yt.prototype.advance = function() { + for (var z = { v: 0 }, J = { v: null }, ve = { v: null }, ke = { v: null }, it = { v: this.zzEndRead_0 }, ht = { v: this.zzBuffer_0 }, Et = Jn().ZZ_TRANS_0, Qt = Jn().ZZ_ROWMAP_0, lr = Jn().ZZ_ATTRIBUTE_0; ; ) { + ke.v = this.zzMarkedPos_0, this.yychar = this.yychar + (ke.v - this.tokenStart) | 0; + var zn, Bn, na = !1; + for (ve.v = this.tokenStart; ve.v < ke.v; ) { + switch (zn = ti().codePointAt_905azu$(ht.v, ve.v), Bn = ti().charCount_za3lpa$(zn), zn) { + case 11: + case 12: + case 133: + case 8232: + case 8233: + this.yyline = this.yyline + 1 | 0, this.yycolumn = 0, na = !1; + break; + case 13: + this.yyline = this.yyline + 1 | 0, this.yycolumn = 0, na = !0; + break; + case 10: + na ? na = !1 : (this.yyline = this.yyline + 1 | 0, this.yycolumn = 0); + break; + default: + na = !1, this.yycolumn = this.yycolumn + Bn | 0; + } + ve.v = ve.v + Bn | 0; + } + if (na) { + var uo; + if (ke.v < it.v) + uo = ht.v.charCodeAt(ke.v) === 10; + else if (this.zzAtEOF_0) + uo = !1; + else { + var ds = this.zzRefill_0(); + it.v = this.zzEndRead_0, ke.v = this.zzMarkedPos_0, ht.v = this.zzBuffer_0, uo = !ds && ht.v.charCodeAt(ke.v) === 10; + } + uo && (this.yyline = this.yyline - 1 | 0); + } + J.v = -1, this.tokenStart = ke.v, this.zzCurrentPos_0 = this.tokenStart, ve.v = this.zzCurrentPos_0, this.zzState_0 = Jn().ZZ_LEXSTATE_0[this.zzLexicalState_0]; + var co = { v: lr[this.zzState_0] }; + for ((1 & co.v) == 1 && (J.v = this.zzState_0); ; ) { + if (ve.v < it.v) + z.v = ti().codePointAt_905azu$(ht.v, ve.v), ve.v = ve.v + ti().charCount_za3lpa$(z.v) | 0; + else { + if (this.zzAtEOF_0) { + z.v = Jn().YYEOF; + break; + } + this.zzCurrentPos_0 = ve.v, this.zzMarkedPos_0 = ke.v; + var Zs = this.zzRefill_0(); + if (ve.v = this.zzCurrentPos_0, ke.v = this.zzMarkedPos_0, ht.v = this.zzBuffer_0, it.v = this.zzEndRead_0, Zs) { + z.v = Jn().YYEOF; + break; + } + z.v = ti().codePointAt_905azu$(ht.v, ve.v), ve.v = ve.v + ti().charCount_za3lpa$(z.v) | 0; + } + var vs = Et[Qt[this.zzState_0] + Jn().ZZ_CMAP_za3lpa$(z.v) | 0]; + if (vs === -1 || (this.zzState_0 = vs, co.v = lr[this.zzState_0], (1 & co.v) == 1 && (J.v = this.zzState_0, ke.v = ve.v, (8 & co.v) == 8))) + break; + } + if (this.zzMarkedPos_0 = ke.v, z.v === Jn().YYEOF && this.tokenStart === this.zzCurrentPos_0) + return this.zzAtEOF_0 = !0, this.zzDoEOF_0(), null; + switch (J.v < 0 ? J.v : Jn().ZZ_ACTION_0[J.v]) { + case 1: + return mt().NUMBER; + case 19: + break; + case 2: + return mt().BARE_STRING; + case 20: + break; + case 3: + return mt().WHITE_SPACE; + case 21: + break; + case 4: + return mt().BAD_CHARACTER; + case 22: + break; + case 5: + return mt().COLON; + case 23: + break; + case 6: + return mt().L_CURLY; + case 24: + break; + case 7: + return mt().R_CURLY; + case 25: + break; + case 8: + return mt().L_BRACKET; + case 26: + break; + case 9: + return mt().R_BRACKET; + case 27: + break; + case 10: + return mt().COMMA; + case 28: + break; + case 11: + return mt().LINE_COMMENT; + case 29: + break; + case 12: + return mt().BLOCK_COMMENT; + case 30: + break; + case 13: + return mt().DOUBLE_QUOTED_STRING; + case 31: + break; + case 14: + return mt().SINGLE_QUOTED_STRING; + case 32: + break; + case 15: + return mt().TICK_QUOTED_STRING; + case 33: + break; + case 16: + return mt().NULL; + case 34: + break; + case 17: + return mt().TRUE; + case 35: + break; + case 18: + return mt().FALSE; + case 36: + break; + default: + this.zzScanError_0(Jn().ZZ_NO_MATCH_0); + } + } + }, bi.prototype.ZZ_CMAP_za3lpa$ = function(z) { + return 0 | this.ZZ_CMAP_A[(0 | this.ZZ_CMAP_Y[0 | this.ZZ_CMAP_Z[z >> 14] | z >> 7 & 127]) << 7 | 127 & z]; + }, bi.prototype.zzUnpackAction_1 = function() { + var z = new Int32Array(67), J = 0; + return J = this.zzUnpackAction_0(this.ZZ_ACTION_PACKED_0_0, J, z), z; + }, bi.prototype.zzUnpackAction_0 = function(z, J, ve) { + for (var ke, it, ht, Et = 0, Qt = J, lr = z.length; Et < lr; ) { + var zn = 0 | z.charCodeAt((Et = (ke = Et) + 1 | 0, ke)), Bn = 0 | z.charCodeAt((Et = (it = Et) + 1 | 0, it)); + do + ve[ht = Qt, Qt = ht + 1 | 0, ht] = Bn; + while ((zn = zn - 1 | 0) > 0); + } + return Qt; + }, bi.prototype.zzUnpackRowMap_1 = function() { + var z = new Int32Array(67), J = 0; + return J = this.zzUnpackRowMap_0(this.ZZ_ROWMAP_PACKED_0_0, J, z), z; + }, bi.prototype.zzUnpackRowMap_0 = function(z, J, ve) { + for (var ke, it, ht, Et = 0, Qt = J, lr = z.length; Et < lr; ) { + var zn = (0 | z.charCodeAt((Et = (ke = Et) + 1 | 0, ke))) << 16; + ve[ht = Qt, Qt = ht + 1 | 0, ht] = 0 | zn | z.charCodeAt((Et = (it = Et) + 1 | 0, it)); + } + return Qt; + }, bi.prototype.zzUnpackTrans_1 = function() { + var z = new Int32Array(1728), J = 0; + return J = this.zzUnpackTrans_0(this.ZZ_TRANS_PACKED_0_0, J, z), z; + }, bi.prototype.zzUnpackTrans_0 = function(z, J, ve) { + for (var ke, it, ht, Et = 0, Qt = J, lr = z.length; Et < lr; ) { + var zn = 0 | z.charCodeAt((Et = (ke = Et) + 1 | 0, ke)), Bn = 0 | z.charCodeAt((Et = (it = Et) + 1 | 0, it)); + Bn = Bn - 1 | 0; + do + ve[ht = Qt, Qt = ht + 1 | 0, ht] = Bn; + while ((zn = zn - 1 | 0) > 0); + } + return Qt; + }, bi.prototype.zzUnpackAttribute_1 = function() { + var z = new Int32Array(67), J = 0; + return J = this.zzUnpackAttribute_0(this.ZZ_ATTRIBUTE_PACKED_0_0, J, z), z; + }, bi.prototype.zzUnpackAttribute_0 = function(z, J, ve) { + for (var ke, it, ht, Et = 0, Qt = J, lr = z.length; Et < lr; ) { + var zn = 0 | z.charCodeAt((Et = (ke = Et) + 1 | 0, ke)), Bn = 0 | z.charCodeAt((Et = (it = Et) + 1 | 0, it)); + do + ve[ht = Qt, Qt = ht + 1 | 0, ht] = Bn; + while ((zn = zn - 1 | 0) > 0); + } + return Qt; + }, bi.prototype.zzUnpackCMap_0 = function(z) { + for (var J, ve, ke, it = { v: 0 }, ht = 0, Et = z.length; ht < Et; ) + it.v = it.v + (0 | z.charCodeAt(ht)) | 0, ht = ht + 2 | 0; + for (var Qt = h.charArray(it.v), lr = 0, zn = 0; lr < z.length; ) { + var Bn = 0 | z.charCodeAt((lr = (J = lr) + 1 | 0, J)), na = z.charCodeAt((lr = (ve = lr) + 1 | 0, ve)); + do + Qt[ke = zn, zn = ke + 1 | 0, ke] = na; + while ((Bn = Bn - 1 | 0) > 0); + } + return Qt; + }, bi.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var At = null; + function Jn() { + return At === null && new bi(), At; + } + function hn() { + } + function fi() { + } + function Ws() { + Ys(); + } + function Eo() { + nn = this, this.factory_2h3e2k$_0 = ne(pu); + } + function pu() { + return new Ws(); + } + Yt.$metadata$ = { kind: v, simpleName: "RJsonLexer", interfaces: [] }, hn.$metadata$ = { kind: w, simpleName: "RJsonParser", interfaces: [] }, fi.prototype.stringToJson = function(z) { + return wt().parse_61zpoe$(z).toString(); + }, fi.prototype.stringToValue = function(z) { + return wt().parse_61zpoe$(z); + }, fi.prototype.streamToValue = function(z) { + return wt().parse_6nb378$(z.reader()); + }, fi.prototype.streamToJsonStream = function(z) { + return new le(wt().parse_6nb378$(z.reader()).toString()); + }, fi.prototype.streamToRJsonStream = function(z) { + var J = wt().parse_6nb378$(z.bufferedReader()); + return new dn(_a().RJsonCompact).valueToStream(J); + }, fi.$metadata$ = { kind: v, simpleName: "RJsonParserImpl", interfaces: [hn] }, Object.defineProperty(Eo.prototype, "factory_0", { configurable: !0, get: function() { + return this.factory_2h3e2k$_0.value; + } }), Eo.prototype.getDefault = function() { + return this.factory_0; + }, Eo.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var nn = null; + function Ys() { + return nn === null && new Eo(), nn; + } + function _n() { + this.lexer = new Yt(null), this.type = null, this.location_i61z51$_0 = new ya(this.lexer.yychar, this.lexer.yyline, this.lexer.yycolumn), this.rxUnicode_0 = ce("\\\\u([a-fA-F0-9]{4})"), this.rxBareEscape_0 = ce("\\\\."); + } + function di() { + mt(); + } + function ii() { + vi = this; + } + Ws.prototype.createParser = function() { + return new _n(); + }, Ws.$metadata$ = { kind: v, simpleName: "RJsonParserFactory", interfaces: [] }, Object.defineProperty(_n.prototype, "location", { configurable: !0, get: function() { + return new ya(this.lexer.yychar, this.lexer.yyline, this.lexer.yycolumn); + }, set: function(z) { + this.location_i61z51$_0 = z; + } }), _n.prototype.parse_61zpoe$ = function(z) { + var J; + this.lexer.reset_6na8x6$(z, 0, z.length, Jn().YYINITIAL), this.advance_0(), this.skipWhitespaceAndComments_0(); + try { + J = this.readValue_0(); + } catch (ve) { + throw h.isType(ve, fn) ? ve : h.isType(ve, b) ? new fn("Expected value", this.location) : ve; + } + if (this.skipWhitespaceAndComments_0(), this.type != null) + throw new fn("Expected EOF but received " + this.currentTokenString_0(), this.location); + return J; + }, _n.prototype.stringToValue = function(z) { + return this.parse_61zpoe$(z); + }, _n.prototype.stringToJson = function(z) { + return this.stringToValue(z).toString(); + }, _n.prototype.streamToValue = function(z) { + return h.isType(z, le) ? this.parse_61zpoe$(z.src) : this.parse_61zpoe$(z.bufferedReader().toString()); + }, _n.prototype.streamToJsonStream = function(z) { + return new dn(_a().JsonCompact).streamToStream(z); + }, _n.prototype.streamToRJsonStream = function(z) { + return new dn(_a().RJsonCompact).streamToStream(z); + }, _n.prototype.advance_0 = function() { + this.type = this.lexer.advance(); + }, _n.prototype.readValue_0 = function() { + var z; + if (this.skipWhitespaceAndComments_0(), d(this.type), z = this.type, g(z, mt().L_BRACKET)) + return this.advance_0(), this.readList_0(); + if (g(z, mt().L_CURLY)) + return this.advance_0(), this.readObject_0(); + if (g(z, mt().BARE_STRING)) { + var J = new wr(this.unescapeBare_0(this.lexer.yytext().toString())); + return this.advance_0(), J; + } + if (g(z, mt().DOUBLE_QUOTED_STRING) || g(z, mt().SINGLE_QUOTED_STRING) || g(z, mt().TICK_QUOTED_STRING)) { + var ve = this.lexer.yytext().toString(), ke = ve.length - 1 | 0, it = new wr(this.unescape_0(ve.substring(1, ke))); + return this.advance_0(), it; + } + if (g(z, mt().TRUE)) { + var ht = new Sr(this.lexer.yytext().toString()); + return this.advance_0(), ht; + } + if (g(z, mt().FALSE)) { + var Et = new Sr(this.lexer.yytext().toString()); + return this.advance_0(), Et; + } + if (g(z, mt().NULL)) { + var Qt = new Sr(this.lexer.yytext().toString()); + return this.advance_0(), Qt; + } + if (g(z, mt().NUMBER)) { + var lr = new $r(this.lexer.yytext().toString()); + return this.advance_0(), lr; + } + throw new fn("Did not expect " + this.currentTokenString_0(), this.location); + }, _n.prototype.currentTokenString_0 = function() { + return g(this.type, mt().BAD_CHARACTER) ? "(" + this.lexer.yytext() + ")" : d(this.type).id; + }, _n.prototype.skipWhitespaceAndComments_0 = function() { + for (var z; ; ) { + if (z = this.type, !(g(z, mt().WHITE_SPACE) || g(z, mt().BLOCK_COMMENT) || g(z, mt().LINE_COMMENT))) + return; + this.advance_0(); + } + }, _n.prototype.skipComma_0 = function() { + for (var z; ; ) { + if (z = this.type, !(g(z, mt().WHITE_SPACE) || g(z, mt().BLOCK_COMMENT) || g(z, mt().LINE_COMMENT) || g(z, mt().COMMA))) + return; + this.advance_0(); + } + }, _n.prototype.readList_0 = function() { + for (var z = Wr(); ; ) { + if (this.skipWhitespaceAndComments_0(), g(this.type, mt().R_BRACKET)) + return this.advance_0(), z; + try { + z.add_luq74r$(this.readValue_0()); + } catch (J) { + throw h.isType(J, b) ? new fn("Expected value or R_BRACKET", this.location) : J; + } + this.skipComma_0(); + } + }, _n.prototype.readObject_0 = function() { + for (var z = qt(); ; ) { + if (this.skipWhitespaceAndComments_0(), g(this.type, mt().R_CURLY)) + return this.advance_0(), z; + var J, ve; + try { + J = this.readName_0(); + } catch (ke) { + throw h.isType(ke, b) ? new fn("Expected object property name or R_CURLY", this.location) : ke; + } + this.skipWhitespaceAndComments_0(), this.consume_0(mt().COLON), this.skipWhitespaceAndComments_0(); + try { + ve = this.readValue_0(); + } catch (ke) { + throw h.isType(ke, b) ? new fn("Expected value or R_CURLY", this.location) : ke; + } + this.skipComma_0(), z.add_8kvr2e$(J, ve); + } + }, _n.prototype.consume_0 = function(z) { + if (this.skipWhitespaceAndComments_0(), !g(this.type, z)) + throw new fn("Expected " + z.id, new ya(this.lexer.yychar, this.lexer.yyline, this.lexer.yycolumn)); + this.advance_0(); + }, _n.prototype.readName_0 = function() { + var z; + if (this.skipWhitespaceAndComments_0(), z = this.type, g(z, mt().NUMBER) || g(z, mt().TRUE) || g(z, mt().FALSE) || g(z, mt().NULL)) { + var J = this.lexer.yytext().toString(); + return this.advance_0(), J; + } + if (g(z, mt().BARE_STRING)) { + var ve = this.lexer.yytext().toString(); + return this.advance_0(), this.unescapeBare_0(ve); + } + if (g(z, mt().DOUBLE_QUOTED_STRING) || g(z, mt().SINGLE_QUOTED_STRING) || g(z, mt().TICK_QUOTED_STRING)) { + var ke = this.lexer.yytext().toString(), it = ke.length - 1 | 0, ht = ke.substring(1, it); + return this.advance_0(), this.unescape_0(ht); + } + throw new fn("Expected property name or R_CURLY, not " + this.currentTokenString_0(), new ya(this.lexer.yychar, this.lexer.yyline, this.lexer.yycolumn)); + }, _n.prototype.unescape_0 = function(z) { + var J, ve = this.rxUnicode_0; + e: + do { + var ke = ve.find_905azu$(z); + if (ke == null) { + J = z.toString(); + break e; + } + var it = 0, ht = z.length, Et = K(ht); + do { + var Qt = d(ke); + Et.append_ezbsdh$(z, it, Qt.range.start), Et.append_gw00v9$("" + String.fromCharCode(Q(p(kl(0, d(Qt.groups.get_za3lpa$(1)).value, 16))))), it = Qt.range.endInclusive + 1 | 0, ke = Qt.next(); + } while (it < ht && ke != null); + it < ht && Et.append_ezbsdh$(z, it, ht), J = Et.toString(); + } while (0); + var lr = J; + return lr = fe(lr, "\\'", "'"), lr = fe(lr, "\\`", "`"), lr = fe(lr, '\\"', '"'), lr = fe(lr, "\\ ", " "), fe(lr, `\\ +`, ""); + }, _n.prototype.unescapeBare_0 = function(z) { + var J, ve = this.rxUnicode_0; + e: + do { + var ke = ve.find_905azu$(z); + if (ke == null) { + J = z.toString(); + break e; + } + var it = 0, ht = z.length, Et = K(ht); + do { + var Qt = d(ke); + Et.append_ezbsdh$(z, it, Qt.range.start), Et.append_gw00v9$("" + String.fromCharCode(Q(p(kl(0, d(Qt.groups.get_za3lpa$(1)).value, 16))))), it = Qt.range.endInclusive + 1 | 0, ke = Qt.next(); + } while (it < ht && ke != null); + it < ht && Et.append_ezbsdh$(z, it, ht), J = Et.toString(); + } while (0); + var lr, zn = J, Bn = zn, na = this.rxBareEscape_0; + e: + do { + var uo = na.find_905azu$(Bn); + if (uo == null) { + lr = Bn.toString(); + break e; + } + var ds = 0, co = Bn.length, Zs = K(co); + do { + var vs = d(uo); + Zs.append_ezbsdh$(Bn, ds, vs.range.start), Zs.append_gw00v9$(vs.value.substring(1)), ds = vs.range.endInclusive + 1 | 0, uo = vs.next(); + } while (ds < co && uo != null); + ds < co && Zs.append_ezbsdh$(Bn, ds, co), lr = Zs.toString(); + } while (0); + return lr; + }, _n.$metadata$ = { kind: v, simpleName: "RJsonParser2", interfaces: [hn] }, ii.prototype.createElement_a4qy0p$ = function(z) { + var J = z.elementType; + if (J === mt().BOOLEAN) + return new ni(z); + if (J === mt().COMMENT) + return new Ve(z); + if (J === mt().ID) + return new Ln(z); + if (J === mt().LIST) + return new Fa(z); + if (J === mt().OBJECT) + return new Zn(z); + if (J === mt().PAIR) + return new ea(z); + if (J === mt().STRING) + return new Gt(z); + if (J === mt().VALUE) + return new Mr(z); + if (J === mt().WHITE_SPACE) + return new $a(z); + if (J === mt().BAD_CHARACTER) + return new Cr(z); + throw h.newThrowable("Unknown element type: " + J); + }, ii.$metadata$ = { kind: f, simpleName: "Factory", interfaces: [] }; + var vi = null; + function hs() { + gu = this, this.BOOLEAN = new hi("BOOLEAN"), this.COMMENT = new hi("COMMENT"), this.ID = new hi("ID"), this.LIST = new hi("LIST"), this.OBJECT = new hi("OBJECT"), this.PAIR = new hi("PAIR"), this.STRING = new hi("STRING"), this.VALUE = new hi("VALUE"), this.BARE_STRING = new In("BARE_STRING"), this.BLOCK_COMMENT = new In("BLOCK_COMMENT"), this.COLON = new In("COLON"), this.COMMA = new In("COMMA"), this.DOUBLE_QUOTED_STRING = new In("DOUBLE_QUOTED_STRING"), this.FALSE = new In("FALSE"), this.LINE_COMMENT = new In("LINE_COMMENT"), this.L_BRACKET = new In("L_BRACKET"), this.L_CURLY = new In("L_CURLY"), this.NULL = new In("NULL"), this.NUMBER = new In("NUMBER"), this.R_BRACKET = new In("R_BRACKET"), this.R_CURLY = new In("R_CURLY"), this.SINGLE_QUOTED_STRING = new In("SINGLE_QUOTED_STRING"), this.TICK_QUOTED_STRING = new In("TICK_QUOTED_STRING"), this.TRUE = new In("TRUE"), this.WHITE_SPACE = new In("WHITE_SPACE"), this.BAD_CHARACTER = new In("BAD_CHARACTER"); + } + hs.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var gu = null; + function mt() { + return gu === null && new hs(), gu; + } + function Ha(z) { + this.theReader_0 = z; + } + function Fi() { + } + function fs() { + _u(); + } + function mu() { + yu = this; + } + di.$metadata$ = { kind: w, simpleName: "RJsonTypes", interfaces: [] }, Ha.prototype.reader = function() { + return this.theReader_0; + }, Ha.prototype.bufferedReader = function() { + return this.reader(); + }, Ha.$metadata$ = { kind: v, simpleName: "ReaderInputStream", interfaces: [Ie] }, Fi.$metadata$ = { kind: v, simpleName: "JsDummy", interfaces: [Oe] }, mu.prototype.create_8chfmy$ = function(z, J, ve) { + var ke, it = new xe(); + ke = J + ve - 1 | 0; + for (var ht = J; ht <= ke; ht++) + it += String.fromCharCode(Q(z[ht])); + return it; + }, mu.$metadata$ = { kind: f, simpleName: "Companion", interfaces: [] }; + var Ec, Pi, yu = null; + function _u() { + return yu === null && new mu(), yu; + } + function bu(z) { + return z.toString(16); + } + function Mo(z, J, ve) { + var ke; + if (!isNaN(parseFloat(z))) + return g(J.quoteFallback, "single") ? "'" + z + "'" : g(J.quoteFallback, "backtick") ? "`" + z + "`" : '"' + z + '"'; + var it = ve ? J.usePropertyNameQuotes : J.useQuotes; + if (!it && Ec.test(z) && (it = !0), !it && g(z, "") && (it = !0), !it && ve && g(J.target, "js") && (it = du(z)), it) { + var ht = z; + ke = g(J.quoteFallback, "single") && Ge(z, "'") === -1 ? "'" + (ht = fe(ht, "'", "\\'")) + "'" : g(J.quoteFallback, "backtick") && Ge(z, "`") === -1 ? "`" + (ht = fe(ht, "`", "\\`")) + "`" : '"' + (ht = fe(ht, '"', '\\"')) + '"'; + } else + ke = z; + return ke; + } + function ta(z) { + return Pi.test(z); + } + function Do(z, J) { + try { + if (!Pi.test(J)) + throw new oe("not a float"); + var ve = parseFloat(J); + if (!isFinite(ve)) + throw new oe("not finite"); + return ve; + } catch (ke) { + throw h.isType(ke, de) ? new oe(ke.message) : ke; + } + } + function Fr() { + this.a = []; + } + function ra(z) { + this.this$ArrayList = z, this._n = 0; + } + function Va() { + Xs = this; + } + fs.$metadata$ = { kind: v, simpleName: "XString", interfaces: [] }, Fr.prototype.add_11rb$ = function(z) { + return this.a.push(z), !0; + }, Fr.prototype.add_wxm5ur$ = function(z, J) { + Ze("not implemented"); + }, Fr.prototype.addAll_u57x28$ = function(z, J) { + Ze("not implemented"); + }, Fr.prototype.addAll_brywnq$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.clear = function() { + Ze("not implemented"); + }, Fr.prototype.listIterator = function() { + Ze("not implemented"); + }, Fr.prototype.listIterator_za3lpa$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.remove_11rb$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.removeAll_brywnq$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.removeAt_za3lpa$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.retainAll_brywnq$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.subList_vux9f0$ = function(z, J) { + Ze("not implemented"); + }, Object.defineProperty(Fr.prototype, "size", { configurable: !0, get: function() { + return this.a.length; + } }), Fr.prototype.contains_11rb$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.containsAll_brywnq$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.get_za3lpa$ = function(z) { + return this.a[z]; + }, Fr.prototype.indexOf_11rb$ = function(z) { + Ze("not implemented"); + }, Fr.prototype.isEmpty = function() { + Ze("not implemented"); + }, ra.prototype.hasNext = function() { + var z; + return this._n < (typeof (z = this.this$ArrayList.a.length) == "number" ? z : x()); + }, ra.prototype.next = function() { + var z, J; + return (J = this.this$ArrayList.a[z = this._n, this._n = z + 1 | 0, z]) == null || h.isType(J, se) ? J : x(); + }, ra.prototype.remove = function() { + Ze("not implemented"); + }, ra.$metadata$ = { kind: v, interfaces: [_] }, Fr.prototype.iterator = function() { + return new ra(this); + }, Fr.prototype.set_wxm5ur$ = function(z, J) { + Ze("not implemented"); + }, Fr.prototype.lastIndexOf_11rb$ = function(z) { + Ze("not implemented"); + }, Fr.$metadata$ = { kind: v, simpleName: "ArrayList", interfaces: [te] }, Va.prototype.arraycopy_yp22ie$ = function(z, J, ve, ke, it) { + var ht, Et, Qt = ke; + ht = J + it | 0; + for (var lr = J; lr < ht; lr++) + ve[Et = Qt, Qt = Et + 1 | 0, Et] = z[lr]; + }, Va.prototype.arraycopy_nlwz52$ = function(z, J, ve, ke, it) { + Ze("not implemented"); + }, Va.$metadata$ = { kind: f, simpleName: "System", interfaces: [] }; + var Xs = null; + function xi() { + return Xs === null && new Va(), Xs; + } + function kl(z, J, ve) { + try { + return parseInt(J, ve); + } catch (ke) { + throw h.isType(ke, b) ? h.newThrowable(ke.message) : ke; + } + } + var ba = c.tv || (c.tv = {}), ko = ba.twelvetone || (ba.twelvetone = {}), Ht = ko.io || (ko.io = {}); + Object.defineProperty(Ht, "Arrays", { get: ae }), Ht.ByteInputStream = le, Object.defineProperty(Ht, "Character", { get: function() { + return Te === null && new Ae(), Te; + } }), Object.defineProperty(Ht, "Collections", { get: je }), Ht.toCharArray_s3n7h2$ = be, Ht.create_cqx1qy$ = function(z, J) { + return ge(0, J, 0, J.length); + }, Ht.create_h51huu$ = ge, Ht.IOException = _e, Ht.IllegalArgumentException = we, Ht.InputStream = Ie, Ht.NullPointerException = Me, Ht.NumberFormatException = et, Ht.ObjectInputStream = yt, Ht.Reader = vt, Ht.RuntimeException_init_tcv7n7$ = bt, Ht.RuntimeException = ze, Ht.StringBuilder = _t, Ht.StringReader = $t, Ht.StringWriter = fr, Ht.synchronized_d6h5k9$ = _r, Ht.byteInputStream_7efafi$ = ar, Ht.parseLong_bufzu3$ = or, Ht.parseFloat_b12yl5$ = Tr, Ht.toString_esb6h6$ = tn, Ht.toString_mgw2my$ = rn, Ht.toString_4qhq6s$ = qe, Ht.toString_9s8ssy$ = Xe, Ht.TODO_y4putb$ = Ze, Ht.endsWith_7azisw$ = st, Ht.isNaN_4qhq6s$ = St, Ht.isInfinite_4qhq6s$ = tt, Ht.isNaN_9s8ssy$ = Vr, Ht.isInfinite_9s8ssy$ = cn, Ht.UnsupportedOperationException = ct, Object.defineProperty(Re, "Companion", { get: ur }), Ht.Writer_init = wn, Ht.Writer_init_s8jyv4$ = function(z, J) { + if (J = J || Object.create(Re.prototype), Re.call(J), z == null) + throw new Me(); + return J.lock = z, J; + }, Ht.Writer = Re, vr.prototype.DefaultHandler = Vt; + var Nr = ko.json || (ko.json = {}); + Object.defineProperty(Nr, "Json", { get: wt }), Object.defineProperty(pr, "Companion", { get: Co }), Nr.JsonArray_init = Wr, Nr.JsonArray_init_v27daa$ = function(z, J) { + return Na(z, !1, J = J || Object.create(pr.prototype)), J; + }, Nr.JsonArray = pr, Nr.JsonHandler = jr, Nr.JsonLiteral = Sr, Nr.JsonNumber = $r, Ct.Member = Qe, Ct.HashIndexTable_init = Je, Ct.HashIndexTable_init_s5uoma$ = function(z, J) { + return J = J || Object.create(Ue.prototype), Ue.call(J), xi().arraycopy_nlwz52$(z.hashTable_0, 0, J.hashTable_0, 0, J.hashTable_0.length), J; + }, Ct.HashIndexTable = Ue, Object.defineProperty(Ct, "Companion", { get: It }), Nr.JsonObject_init = qt, Nr.JsonObject_init_p5jd56$ = function(z, J) { + return Lr(z, !1, J = J || Object.create(Ct.prototype)), J; + }, Nr.JsonObject = Ct, Nr.JsonString = wr, Object.defineProperty(Nt, "Companion", { get: ui }), Nr.JsonValue = Nt, Object.defineProperty(yn, "Companion", { get: Wn }), Nr.JsonWriter = yn, Nr.write_cm3p45$ = ci, Nr.Location = ya, Nr.ParseException = fn, Object.defineProperty(Yn, "Companion", { get: ki }), Nr.PrettyPrint = Yn, Object.defineProperty(Ki, "Companion", { get: qi }), Nr.WriterConfig = Ki, Nr.WritingBuffer = Gr; + var gr = ko.rjson || (ko.rjson = {}); + return gr.SyntaxException = Oi, gr.IoException = On, Object.defineProperty(Tn, "Companion", { get: cs }), gr.FlexAdapter = Tn, Object.defineProperty(_i, "Companion", { get: _a }), dn.Options = _i, gr.PrettyPrinter = dn, Object.defineProperty(gr, "es3keywords", { get: function() { + return so; + } }), gr.needsPropertyNameQuotes_y4putb$ = du, gr.ASTNode = vu, gr.IElementType = Ir, gr.RJsonElementType = hi, gr.RJsonTokenType = In, gr.PsiElement = Ar, gr.Reader = Ba, gr.ArrayIndexOutOfBoundsException = lo, gr.Error = Ao, Object.defineProperty(Mn, "Companion", { get: ti }), gr.Character = Mn, gr.ProcessCanceledException = ri, gr.StringBuffer = Xn, gr.RJsonIdImpl = Ln, gr.RJsonBooleanImpl = ni, gr.RJsonCommentImpl = Ve, gr.RJsonListImpl = Fa, gr.RJsonObjectImpl = Zn, gr.RJsonPairImpl = ea, gr.RJsonStringImpl = Gt, gr.RJsonValueImpl = Mr, gr.RJsonWhiteSpaceImpl = $a, gr.RJsonBadCharacterImpl = Cr, Object.defineProperty(Yt, "Companion", { get: Jn }), gr.RJsonLexer = Yt, gr.RJsonParser = hn, gr.RJsonParserImpl = fi, Object.defineProperty(Ws, "Companion", { get: Ys }), gr.RJsonParserFactory = Ws, gr.RJsonParser2 = _n, Object.defineProperty(di, "Factory", { get: function() { + return vi === null && new ii(), vi; + } }), Object.defineProperty(di, "Companion", { get: mt }), gr.RJsonTypes = di, gr.ReaderInputStream = Ha, Ht.JsDummy = Fi, Object.defineProperty(fs, "Companion", { get: _u }), Ht.XString = fs, Ht.toHexString_kcn2v3$ = bu, Ht.startsWith_7azisw$ = function(z, J) { + return z.startsWith(J); + }, Ht.escapeIfNeeded_po7bw7$ = Mo, Ht.isNumber_y4putb$ = ta, Ht.parseDouble_2lv9n6$ = Do, Ht.ArrayList = Fr, Object.defineProperty(Ht, "System", { get: xi }), Ht.parseInt_doe1q$ = kl, Ht.substring_2ag3u6$ = function(z, J, ve, ke) { + return J.substring(ve, ke); + }, so = U(["abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with"]), Ec = /[\s\u0012:\[\]\{\},\\"']/, Pi = /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/, c; + }) == "function" ? s.apply(a, l) : s) === void 0 || (i.exports = u); + } }, n = {}, function i(a) { + var o = n[a]; + if (o !== void 0) + return o.exports; + var s = n[a] = { exports: {} }; + return t[a].call(s.exports, s, s.exports, i), s.exports; + }(42); + var t, n; + }); +})(hB); +(function(r) { + const e = hB.exports, t = e.tv.twelvetone.rjson, n = t.PrettyPrinter.Options; + n.JsonCompact = n.Companion.JsonCompact, n.JsonPretty = n.Companion.JsonPretty, n.RJsonCompact = n.Companion.RJsonCompact, n.RJsonPretty = n.Companion.RJsonPretty, n.JsCompact = n.Companion.JsCompact, n.JsPretty = n.Companion.JsPretty, r.exports = { + createParser: () => t.RJsonParserFactory.Companion.getDefault().createParser(), + createParserFactory: () => t.RJsonParserFactory.Companion.getDefault(), + PrettyPrinter: t.PrettyPrinter, + /** + * @deprecated since 0.1.0. Use toJson() instead. + * @param rjsonString {String} + * @returns {String} + */ + convert: function(i) { + return t.RJsonParserFactory.Companion.getDefault().createParser().stringToJson(i); + }, + /** + * + * @param rjsonString {String} + * @param compact {Boolean} + * @returns {String} + */ + toJson: function(i, a = !0) { + const s = t.RJsonParserFactory.Companion.getDefault().createParser().stringToValue(i); + let l; + return a ? l = t.PrettyPrinter.Options.Companion.JsonCompact : l = t.PrettyPrinter.Options.Companion.JsonPretty, new t.PrettyPrinter(l).valueToString(s); + }, + /** + * + * @param rjsonString {String} + * @param compact {Boolean} + * @returns {String} + */ + toRJson: function(i, a = !0) { + const s = t.RJsonParserFactory.Companion.getDefault().createParser().stringToValue(i); + let l; + return a ? l = t.PrettyPrinter.Options.Companion.RJsonCompact : l = t.PrettyPrinter.Options.Companion.RJsonPretty, new t.PrettyPrinter(l).valueToString(s); + }, + /** + * + * @param rjsonString {String} + * @param compact {Boolean} + * @returns {String} + */ + toJs: function(i, a = !0) { + const s = t.RJsonParserFactory.Companion.getDefault().createParser().stringToValue(i); + let l; + return a ? l = t.PrettyPrinter.Options.Companion.JsCompact : l = t.PrettyPrinter.Options.Companion.JsPretty, new t.PrettyPrinter(l).valueToString(s); + }, + /** + * + * @param options {Options} PrettyPrinter options + * @param stringOrValue {string|object} a JsonLike string or JsonValue + * @returns {string} + */ + prettyPrint: function(i, a) { + const o = new t.PrettyPrinter(i); + return typeof a == "string" ? o.stringToString(a) : o.valueToString(a); + }, + api: e, + PrettyPrinter: t.PrettyPrinter, + Options: n + }, r.exports.default = r.exports; +})(cB); +function L9(r, e) { + return r.trim().length === 0 ? "" : cB.exports.toJson(r, e); +} +function P9(r, e, t) { + if (!r) + return new _l("", void 0, { segments: [{ value: t, success: !0 }] }); + try { + var n = lB(r, e); + return new _l(n, void 0, { segments: [{ value: t, success: !0 }] }); + } catch (i) { + return new _l("", fI(i), { + segments: [{ value: t, success: !1 }] + }); + } +} +function R9(r, e) { + return new fB(r, e).parse(); +} +var fB = ( + /** @class */ + function() { + function r(e, t) { + this.context = t, this.valueAndMsgs = [], this.segments = eB(e.trim()); + } + return r.prototype.parse = function() { + var e; + try { + var t = this.parseObject(); + return this.valueAndMsgs.length === 0 ? new _l(t) : new _l(t, (e = $lodash.find(this.valueAndMsgs, "msg")) === null || e === void 0 ? void 0 : e.msg, { + segments: this.valueAndMsgs.flatMap(function(n) { + var i, a; + return (a = (i = n == null ? void 0 : n.extra) === null || i === void 0 ? void 0 : i.segments) !== null && a !== void 0 ? a : []; + }) + }); + } catch (n) { + return new _l("", fI(n)); + } + }, r.prototype.parseObject = function() { + var e = this, t = this.segments.map(function(n) { + return ng(n) ? e.evalDynamicSegment(n) : n; + }); + return t.length === 1 ? t[0] : t.join(""); + }, r.prototype.evalDynamicSegment = function(e) { + var t = P9(e.slice(2, -2).trim(), this.context, e); + return this.valueAndMsgs.push(t), t.value; + }, r; + }() +); +function N9(r, e) { + return new z9(r, e).parse(); +} +var z9 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n) { + var i = r.call(this, t, n) || this; + return i.evalIndexedObject = i.evalIndexedObject.bind(i), i; + } + return e.prototype.parseObject = function() { + try { + return this.parseRelaxedJson(); + } catch (t) { + return r.prototype.parseObject.call(this); + } + }, e.prototype.parseRelaxedJson = function() { + var t = this.segments.map(function(a, o) { + return ng(a) ? "\\{\\{" + o + "\\}\\}" : a; + }).join(""); + if (t.length === 0) + return ""; + var n = L9(t, !0), i = lB(n.replace(/\\{\\{\d+\\}\\}/g, function(a) { + return "\\\\{\\\\{" + a.slice(4, -4) + "\\\\}\\\\}"; + }), {}); + return this.evalIndexedObject(i); + }, e.prototype.evalIndexedObject = function(t) { + if (typeof t == "string") + return this.evalIndexedStringToObject(t); + if (typeof t != "object" || t === null) + return t; + if (Array.isArray(t)) + return t.map(this.evalIndexedObject); + for (var n = {}, i = 0, a = Object.entries(t); i < a.length; i++) { + var o = a[i], s = o[0], l = o[1]; + n[this.evalIndexedStringToString(s)] = this.evalIndexedObject(l); + } + return n; + }, e.prototype.evalIndexedStringToObject = function(t) { + return t.match(/^{{\d+}}$/) ? this.evalIndexedSnippet(t) : this.evalIndexedStringToString(t); + }, e.prototype.evalIndexedStringToString = function(t) { + var n = this; + return t.replace(/({{\d+}})|(\\{\\{\d+\\}\\})/g, function(i) { + return n.evalIndexedSnippet(i) + ""; + }); + }, e.prototype.evalIndexedSnippet = function(t) { + var n = parseInt(t.startsWith("{{") ? t.slice(2, -2) : t.slice(4, -4)); + if (n >= 0 && n < this.segments.length) { + var i = this.segments[n]; + if (ng(i)) + return this.evalDynamicSegment(i); + } + return t; + }, e; + }(fB) +); +function B9(r, e, t, n) { + try { + return new _l(function(i, a, o) { + return a === void 0 && (a = !1), o === void 0 && (o = "function"), uB(r.startsWith("return") ? r + ` +` : "return ".concat(n ? "async " : "", "function(){'use strict'; ").concat(r, ` +}()`), i ? sr(sr({}, e), i) : e, t, { disableLimit: a, scope: o }, n); + }); + } catch (i) { + return new _l(function() { + }, fI(i)); + } +} +function j9(r, e, t) { + if (e) + switch (e) { + case "JSON": + return function(n) { + return N9(r, n); + }; + case "Function": + return function(n) { + return B9(r, n, t); + }; + } + return function(n) { + return R9(r, n); + }; +} +var dD = "isFetching", vD = "latestEndTime", F9 = "triggerType"; +(function(r) { + Ji(e, r); + function e(t, n) { + var i = this, a; + return i = r.call(this) || this, i.unevaledValue = t, i.options = n, i.type = "input", i.directDepends = /* @__PURE__ */ new Map(), i.codeType = n == null ? void 0 : n.codeType, i.evalWithMethods = (a = n == null ? void 0 : n.evalWithMethods) !== null && a !== void 0 ? a : !0, i; + } + return e.prototype.convertedValue = function() { + return this.codeType === "Function" ? "{{function(){".concat(this.unevaledValue, "}}}") : this.unevaledValue; + }, e.prototype.filterNodes = function(t) { + if (this.evalCache.inFilterNodes) + return /* @__PURE__ */ new Map(); + this.evalCache.inFilterNodes = !0; + try { + var n = this.filterDirectDepends(t), i = t_(/* @__PURE__ */ new Map(), n); + n.forEach(function(o, s) { + t_(i, s.filterNodes(t)); + }); + var a = Yx(this.convertedValue(), t, 1); + return a.forEach(function(o, s) { + if (r_(s)) + for (var l = function(f) { + var v = s.children[f]; + v && hI(i, v, Array.from(o).map(function(b) { + return b + "." + f; + })); + }, u = 0, c = [dD, vD]; u < c.length; u++) { + var h = c[u]; + l(h); + } + }), i; + } finally { + this.evalCache.inFilterNodes = !1; + } + }, e.prototype.filterDirectDepends = function(t) { + return Yx(this.convertedValue(), t); + }, e.prototype.justEval = function(t, n) { + if (this.evalCache.inEval) + return this.evalCache.cyclic = !0, new _l(""); + this.evalCache.inEval = !0; + try { + var i = this.filterDirectDepends(t); + this.directDepends = i; + var a = I9(i), o = j9(this.unevaledValue, this.codeType, this.evalWithMethods ? n : {}), s = Kz(mb(a), o), l = s.evaluate(t); + return this.evalCache.cyclic && (l = new _l(l.value, (l.msg ? l.msg + ` +` : "") + T9(this), $9(l.extra, t))), l; + } finally { + this.evalCache.inEval = !1; + } + }, e.prototype.getChildren = function() { + return this.directDepends ? Array.from(this.directDepends.keys()) : []; + }, e.prototype.dependValues = function() { + var t = {}; + return this.directDepends.forEach(function(n, i) { + i instanceof Cl && n.forEach(function(a) { + t[a] = i.evalCache.value; + }); + }), t; + }, e.prototype.fetchInfo = function(t, n) { + if (this.evalCache.inIsFetching) + return { + isFetching: !1, + ready: !0 + }; + this.evalCache.inIsFetching = !0; + try { + var i = Yx(this.convertedValue(), t, 1), a = !1, o = !0; + i.forEach(function(l, u) { + var c = u.evaluate(t); + n != null && n.ignoreManualDepReadyStatus && $lodash.has(c, F9) && c.triggerType === "manual" || ($lodash.has(c, dD) && (a = a || c.isFetching === !0), $lodash.has(c, vD) && (o = o && c.latestEndTime > 0)); + }); + var s = this.filterNodes(t); + return s.forEach(function(l, u) { + var c = u.fetchInfo(t, n); + a = a || c.isFetching, o = o && c.ready; + }), { + isFetching: a, + ready: o + }; + } finally { + this.evalCache.inIsFetching = !1; + } + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "filterDirectDepends", null), Gi([ + va() + ], e.prototype, "fetchInfo", null), e; +})(Cl); +function $9(r, e) { + var t; + return (t = r == null ? void 0 : r.segments) === null || t === void 0 || t.forEach(function(n) { + n.success && (n.success = !E9(n.value, e)); + }), r; +} +(function(r) { + Ji(e, r); + function e(t, n) { + var i = r.call(this) || this; + return i.child = t, i.options = n, i.type = "fetchCheck", i; + } + return e.prototype.filterNodes = function(t) { + return this.child.filterNodes(t); + }, e.prototype.justEval = function(t) { + return this.fetchInfo(t); + }, e.prototype.getChildren = function() { + return [this.child]; + }, e.prototype.dependValues = function() { + return this.child.dependValues(); + }, e.prototype.fetchInfo = function(t) { + return this.child.fetchInfo(t, this.options); + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "fetchInfo", null), e; +})(Cl); +const Gv = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, H9 = typeof AbortController == "function", n_ = H9 ? AbortController : class { + constructor() { + this.signal = new dB(); + } + abort() { + this.signal.dispatchEvent("abort"); + } +}, V9 = typeof AbortSignal == "function", G9 = typeof n_.AbortSignal == "function", dB = V9 ? AbortSignal : G9 ? n_.AbortController : class { + constructor() { + this.aborted = !1, this._listeners = []; + } + dispatchEvent(e) { + if (e === "abort") { + this.aborted = !0; + const t = { type: e, target: this }; + this.onabort(t), this._listeners.forEach((n) => n(t), this); + } + } + onabort() { + } + addEventListener(e, t) { + e === "abort" && this._listeners.push(t); + } + removeEventListener(e, t) { + e === "abort" && (this._listeners = this._listeners.filter((n) => n !== t)); + } +}, dI = /* @__PURE__ */ new Set(), Xx = (r, e) => { + const t = `LRU_CACHE_OPTION_${r}`; + _b(t) && vI(t, `${r} option`, `options.${e}`, Vh); +}, Zx = (r, e) => { + const t = `LRU_CACHE_METHOD_${r}`; + if (_b(t)) { + const { prototype: n } = Vh, { get: i } = Object.getOwnPropertyDescriptor(n, r); + vI(t, `${r} method`, `cache.${e}()`, i); + } +}, U9 = (r, e) => { + const t = `LRU_CACHE_PROPERTY_${r}`; + if (_b(t)) { + const { prototype: n } = Vh, { get: i } = Object.getOwnPropertyDescriptor(n, r); + vI(t, `${r} property`, `cache.${e}`, i); + } +}, vB = (...r) => { + typeof process == "object" && process && typeof process.emitWarning == "function" ? process.emitWarning(...r) : console.error(...r); +}, _b = (r) => !dI.has(r), vI = (r, e, t, n) => { + dI.add(r); + const i = `The ${e} is deprecated. Please use ${t} instead.`; + vB(i, "DeprecationWarning", r, n); +}, $u = (r) => r && r === Math.floor(r) && r > 0 && isFinite(r), pB = (r) => $u(r) ? r <= Math.pow(2, 8) ? Uint8Array : r <= Math.pow(2, 16) ? Uint16Array : r <= Math.pow(2, 32) ? Uint32Array : r <= Number.MAX_SAFE_INTEGER ? M0 : null : null; +class M0 extends Array { + constructor(e) { + super(e), this.fill(0); + } +} +class W9 { + constructor(e) { + if (e === 0) + return []; + const t = pB(e); + this.heap = new t(e), this.length = 0; + } + push(e) { + this.heap[this.length++] = e; + } + pop() { + return this.heap[--this.length]; + } +} +class Vh { + constructor(e = {}) { + const { + max: t = 0, + ttl: n, + ttlResolution: i = 1, + ttlAutopurge: a, + updateAgeOnGet: o, + updateAgeOnHas: s, + allowStale: l, + dispose: u, + disposeAfter: c, + noDisposeOnSet: h, + noUpdateTTL: f, + maxSize: v = 0, + maxEntrySize: b = 0, + sizeCalculation: w, + fetchMethod: p, + fetchContext: d, + noDeleteOnFetchRejection: m, + noDeleteOnStaleGet: _ + } = e, { length: y, maxAge: x, stale: g } = e instanceof Vh ? {} : e; + if (t !== 0 && !$u(t)) + throw new TypeError("max option must be a nonnegative integer"); + const S = t ? pB(t) : Array; + if (!S) + throw new Error("invalid max value: " + t); + if (this.max = t, this.maxSize = v, this.maxEntrySize = b || this.maxSize, this.sizeCalculation = w || y, this.sizeCalculation) { + if (!this.maxSize && !this.maxEntrySize) + throw new TypeError( + "cannot set sizeCalculation without setting maxSize or maxEntrySize" + ); + if (typeof this.sizeCalculation != "function") + throw new TypeError("sizeCalculation set to non-function"); + } + if (this.fetchMethod = p || null, this.fetchMethod && typeof this.fetchMethod != "function") + throw new TypeError( + "fetchMethod must be a function if specified" + ); + if (this.fetchContext = d, !this.fetchMethod && d !== void 0) + throw new TypeError( + "cannot set fetchContext without fetchMethod" + ); + if (this.keyMap = /* @__PURE__ */ new Map(), this.keyList = new Array(t).fill(null), this.valList = new Array(t).fill(null), this.next = new S(t), this.prev = new S(t), this.head = 0, this.tail = 0, this.free = new W9(t), this.initialFill = 1, this.size = 0, typeof u == "function" && (this.dispose = u), typeof c == "function" ? (this.disposeAfter = c, this.disposed = []) : (this.disposeAfter = null, this.disposed = null), this.noDisposeOnSet = !!h, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!m, this.maxEntrySize !== 0) { + if (this.maxSize !== 0 && !$u(this.maxSize)) + throw new TypeError( + "maxSize must be a positive integer if specified" + ); + if (!$u(this.maxEntrySize)) + throw new TypeError( + "maxEntrySize must be a positive integer if specified" + ); + this.initializeSizeTracking(); + } + if (this.allowStale = !!l || !!g, this.noDeleteOnStaleGet = !!_, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!s, this.ttlResolution = $u(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = n || x || 0, this.ttl) { + if (!$u(this.ttl)) + throw new TypeError( + "ttl must be a positive integer if specified" + ); + this.initializeTTLTracking(); + } + if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) + throw new TypeError( + "At least one of max, maxSize, or ttl is required" + ); + if (!this.ttlAutopurge && !this.max && !this.maxSize) { + const T = "LRU_CACHE_UNBOUNDED"; + _b(T) && (dI.add(T), vB("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", T, Vh)); + } + g && Xx("stale", "allowStale"), x && Xx("maxAge", "ttl"), y && Xx("length", "sizeCalculation"); + } + getRemainingTTL(e) { + return this.has(e, { updateAgeOnHas: !1 }) ? 1 / 0 : 0; + } + initializeTTLTracking() { + this.ttls = new M0(this.max), this.starts = new M0(this.max), this.setItemTTL = (n, i, a = Gv.now()) => { + if (this.starts[n] = i !== 0 ? a : 0, this.ttls[n] = i, i !== 0 && this.ttlAutopurge) { + const o = setTimeout(() => { + this.isStale(n) && this.delete(this.keyList[n]); + }, i + 1); + o.unref && o.unref(); + } + }, this.updateItemAge = (n) => { + this.starts[n] = this.ttls[n] !== 0 ? Gv.now() : 0; + }; + let e = 0; + const t = () => { + const n = Gv.now(); + if (this.ttlResolution > 0) { + e = n; + const i = setTimeout( + () => e = 0, + this.ttlResolution + ); + i.unref && i.unref(); + } + return n; + }; + this.getRemainingTTL = (n) => { + const i = this.keyMap.get(n); + return i === void 0 ? 0 : this.ttls[i] === 0 || this.starts[i] === 0 ? 1 / 0 : this.starts[i] + this.ttls[i] - (e || t()); + }, this.isStale = (n) => this.ttls[n] !== 0 && this.starts[n] !== 0 && (e || t()) - this.starts[n] > this.ttls[n]; + } + updateItemAge(e) { + } + setItemTTL(e, t, n) { + } + isStale(e) { + return !1; + } + initializeSizeTracking() { + this.calculatedSize = 0, this.sizes = new M0(this.max), this.removeItemSize = (e) => { + this.calculatedSize -= this.sizes[e], this.sizes[e] = 0; + }, this.requireSize = (e, t, n, i) => { + if (this.isBackgroundFetch(t)) + return 0; + if (!$u(n)) + if (i) { + if (typeof i != "function") + throw new TypeError("sizeCalculation must be a function"); + if (n = i(t, e), !$u(n)) + throw new TypeError( + "sizeCalculation return invalid (expect positive integer)" + ); + } else + throw new TypeError( + "invalid size value (must be positive integer)" + ); + return n; + }, this.addItemSize = (e, t) => { + if (this.sizes[e] = t, this.maxSize) { + const n = this.maxSize - this.sizes[e]; + for (; this.calculatedSize > n; ) + this.evict(!0); + } + this.calculatedSize += this.sizes[e]; + }; + } + removeItemSize(e) { + } + addItemSize(e, t) { + } + requireSize(e, t, n, i) { + if (n || i) + throw new TypeError( + "cannot set size without setting maxSize or maxEntrySize on cache" + ); + } + *indexes({ allowStale: e = this.allowStale } = {}) { + if (this.size) + for (let t = this.tail; !(!this.isValidIndex(t) || ((e || !this.isStale(t)) && (yield t), t === this.head)); ) + t = this.prev[t]; + } + *rindexes({ allowStale: e = this.allowStale } = {}) { + if (this.size) + for (let t = this.head; !(!this.isValidIndex(t) || ((e || !this.isStale(t)) && (yield t), t === this.tail)); ) + t = this.next[t]; + } + isValidIndex(e) { + return this.keyMap.get(this.keyList[e]) === e; + } + *entries() { + for (const e of this.indexes()) + yield [this.keyList[e], this.valList[e]]; + } + *rentries() { + for (const e of this.rindexes()) + yield [this.keyList[e], this.valList[e]]; + } + *keys() { + for (const e of this.indexes()) + yield this.keyList[e]; + } + *rkeys() { + for (const e of this.rindexes()) + yield this.keyList[e]; + } + *values() { + for (const e of this.indexes()) + yield this.valList[e]; + } + *rvalues() { + for (const e of this.rindexes()) + yield this.valList[e]; + } + [Symbol.iterator]() { + return this.entries(); + } + find(e, t = {}) { + for (const n of this.indexes()) + if (e(this.valList[n], this.keyList[n], this)) + return this.get(this.keyList[n], t); + } + forEach(e, t = this) { + for (const n of this.indexes()) + e.call(t, this.valList[n], this.keyList[n], this); + } + rforEach(e, t = this) { + for (const n of this.rindexes()) + e.call(t, this.valList[n], this.keyList[n], this); + } + get prune() { + return Zx("prune", "purgeStale"), this.purgeStale; + } + purgeStale() { + let e = !1; + for (const t of this.rindexes({ allowStale: !0 })) + this.isStale(t) && (this.delete(this.keyList[t]), e = !0); + return e; + } + dump() { + const e = []; + for (const t of this.indexes({ allowStale: !0 })) { + const n = this.keyList[t], i = this.valList[t], o = { value: this.isBackgroundFetch(i) ? i.__staleWhileFetching : i }; + if (this.ttls) { + o.ttl = this.ttls[t]; + const s = Gv.now() - this.starts[t]; + o.start = Math.floor(Date.now() - s); + } + this.sizes && (o.size = this.sizes[t]), e.unshift([n, o]); + } + return e; + } + load(e) { + this.clear(); + for (const [t, n] of e) { + if (n.start) { + const i = Date.now() - n.start; + n.start = Gv.now() - i; + } + this.set(t, n.value, n); + } + } + dispose(e, t, n) { + } + set(e, t, { + ttl: n = this.ttl, + start: i, + noDisposeOnSet: a = this.noDisposeOnSet, + size: o = 0, + sizeCalculation: s = this.sizeCalculation, + noUpdateTTL: l = this.noUpdateTTL + } = {}) { + if (o = this.requireSize(e, t, o, s), this.maxEntrySize && o > this.maxEntrySize) + return this.delete(e), this; + let u = this.size === 0 ? void 0 : this.keyMap.get(e); + if (u === void 0) + u = this.newIndex(), this.keyList[u] = e, this.valList[u] = t, this.keyMap.set(e, u), this.next[this.tail] = u, this.prev[u] = this.tail, this.tail = u, this.size++, this.addItemSize(u, o), l = !1; + else { + const c = this.valList[u]; + t !== c && (this.isBackgroundFetch(c) ? c.__abortController.abort() : a || (this.dispose(c, e, "set"), this.disposeAfter && this.disposed.push([c, e, "set"])), this.removeItemSize(u), this.valList[u] = t, this.addItemSize(u, o)), this.moveToTail(u); + } + if (n !== 0 && this.ttl === 0 && !this.ttls && this.initializeTTLTracking(), l || this.setItemTTL(u, n, i), this.disposeAfter) + for (; this.disposed.length; ) + this.disposeAfter(...this.disposed.shift()); + return this; + } + newIndex() { + return this.size === 0 ? this.tail : this.size === this.max && this.max !== 0 ? this.evict(!1) : this.free.length !== 0 ? this.free.pop() : this.initialFill++; + } + pop() { + if (this.size) { + const e = this.valList[this.head]; + return this.evict(!0), e; + } + } + evict(e) { + const t = this.head, n = this.keyList[t], i = this.valList[t]; + return this.isBackgroundFetch(i) ? i.__abortController.abort() : (this.dispose(i, n, "evict"), this.disposeAfter && this.disposed.push([i, n, "evict"])), this.removeItemSize(t), e && (this.keyList[t] = null, this.valList[t] = null, this.free.push(t)), this.head = this.next[t], this.keyMap.delete(n), this.size--, t; + } + has(e, { updateAgeOnHas: t = this.updateAgeOnHas } = {}) { + const n = this.keyMap.get(e); + return n !== void 0 && !this.isStale(n) ? (t && this.updateItemAge(n), !0) : !1; + } + // like get(), but without any LRU updating or TTL expiration + peek(e, { allowStale: t = this.allowStale } = {}) { + const n = this.keyMap.get(e); + if (n !== void 0 && (t || !this.isStale(n))) { + const i = this.valList[n]; + return this.isBackgroundFetch(i) ? i.__staleWhileFetching : i; + } + } + backgroundFetch(e, t, n, i) { + const a = t === void 0 ? void 0 : this.valList[t]; + if (this.isBackgroundFetch(a)) + return a; + const o = new n_(), s = { + signal: o.signal, + options: n, + context: i + }, l = (f) => (o.signal.aborted || this.set(e, f, s.options), f), u = (f) => { + if (this.valList[t] === h && (!n.noDeleteOnFetchRejection || h.__staleWhileFetching === void 0 ? this.delete(e) : this.valList[t] = h.__staleWhileFetching), h.__returned === h) + throw f; + }, c = (f) => f(this.fetchMethod(e, a, s)), h = new Promise(c).then(l, u); + return h.__abortController = o, h.__staleWhileFetching = a, h.__returned = null, t === void 0 ? (this.set(e, h, s.options), t = this.keyMap.get(e)) : this.valList[t] = h, h; + } + isBackgroundFetch(e) { + return e && typeof e == "object" && typeof e.then == "function" && Object.prototype.hasOwnProperty.call( + e, + "__staleWhileFetching" + ) && Object.prototype.hasOwnProperty.call(e, "__returned") && (e.__returned === e || e.__returned === null); + } + // this takes the union of get() and set() opts, because it does both + fetch(v) { + return uD(this, arguments, function* (e, { + // get options + allowStale: t = this.allowStale, + updateAgeOnGet: n = this.updateAgeOnGet, + noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, + // set options + ttl: a = this.ttl, + noDisposeOnSet: o = this.noDisposeOnSet, + size: s = 0, + sizeCalculation: l = this.sizeCalculation, + noUpdateTTL: u = this.noUpdateTTL, + // fetch exclusive options + noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, + fetchContext: h = this.fetchContext, + forceRefresh: f = !1 + } = {}) { + if (!this.fetchMethod) + return this.get(e, { + allowStale: t, + updateAgeOnGet: n, + noDeleteOnStaleGet: i + }); + const b = { + allowStale: t, + updateAgeOnGet: n, + noDeleteOnStaleGet: i, + ttl: a, + noDisposeOnSet: o, + size: s, + sizeCalculation: l, + noUpdateTTL: u, + noDeleteOnFetchRejection: c + }; + let w = this.keyMap.get(e); + if (w === void 0) { + const p = this.backgroundFetch(e, w, b, h); + return p.__returned = p; + } else { + const p = this.valList[w]; + if (this.isBackgroundFetch(p)) + return t && p.__staleWhileFetching !== void 0 ? p.__staleWhileFetching : p.__returned = p; + if (!f && !this.isStale(w)) + return this.moveToTail(w), n && this.updateItemAge(w), p; + const d = this.backgroundFetch(e, w, b, h); + return t && d.__staleWhileFetching !== void 0 ? d.__staleWhileFetching : d.__returned = d; + } + }); + } + get(e, { + allowStale: t = this.allowStale, + updateAgeOnGet: n = this.updateAgeOnGet, + noDeleteOnStaleGet: i = this.noDeleteOnStaleGet + } = {}) { + const a = this.keyMap.get(e); + if (a !== void 0) { + const o = this.valList[a], s = this.isBackgroundFetch(o); + return this.isStale(a) ? s ? t ? o.__staleWhileFetching : void 0 : (i || this.delete(e), t ? o : void 0) : s ? void 0 : (this.moveToTail(a), n && this.updateItemAge(a), o); + } + } + connect(e, t) { + this.prev[t] = e, this.next[e] = t; + } + moveToTail(e) { + e !== this.tail && (e === this.head ? this.head = this.next[e] : this.connect(this.prev[e], this.next[e]), this.connect(this.tail, e), this.tail = e); + } + get del() { + return Zx("del", "delete"), this.delete; + } + delete(e) { + let t = !1; + if (this.size !== 0) { + const n = this.keyMap.get(e); + if (n !== void 0) + if (t = !0, this.size === 1) + this.clear(); + else { + this.removeItemSize(n); + const i = this.valList[n]; + this.isBackgroundFetch(i) ? i.__abortController.abort() : (this.dispose(i, e, "delete"), this.disposeAfter && this.disposed.push([i, e, "delete"])), this.keyMap.delete(e), this.keyList[n] = null, this.valList[n] = null, n === this.tail ? this.tail = this.prev[n] : n === this.head ? this.head = this.next[n] : (this.next[this.prev[n]] = this.next[n], this.prev[this.next[n]] = this.prev[n]), this.size--, this.free.push(n); + } + } + if (this.disposed) + for (; this.disposed.length; ) + this.disposeAfter(...this.disposed.shift()); + return t; + } + clear() { + for (const e of this.rindexes({ allowStale: !0 })) { + const t = this.valList[e]; + if (this.isBackgroundFetch(t)) + t.__abortController.abort(); + else { + const n = this.keyList[e]; + this.dispose(t, n, "delete"), this.disposeAfter && this.disposed.push([t, n, "delete"]); + } + } + if (this.keyMap.clear(), this.valList.fill(null), this.keyList.fill(null), this.ttls && (this.ttls.fill(0), this.starts.fill(0)), this.sizes && this.sizes.fill(0), this.head = 0, this.tail = 0, this.initialFill = 1, this.free.length = 0, this.calculatedSize = 0, this.size = 0, this.disposed) + for (; this.disposed.length; ) + this.disposeAfter(...this.disposed.shift()); + } + get reset() { + return Zx("reset", "clear"), this.clear; + } + get length() { + return U9("length", "size"), this.size; + } + static get AbortController() { + return n_; + } + static get AbortSignal() { + return dB; + } +} +var Y9 = Vh, X9 = Y9, Z9 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t) { + var n = r.call(this) || this; + return n.value = t, n.type = "simple", n; + } + return e.prototype.filterNodes = function(t) { + return Md.perf(this, "filterNodes", function() { + return /* @__PURE__ */ new Map(); + }); + }, e.prototype.justEval = function(t) { + return this.value; + }, e.prototype.getChildren = function() { + return []; + }, e.prototype.dependValues = function() { + return {}; + }, e.prototype.fetchInfo = function(t) { + return { + isFetching: !1, + ready: !0 + }; + }, Gi([ + va() + ], e.prototype, "filterNodes", null), e; + }(Cl) +); +function gB(r) { + return new Z9(r); +} +var pD = new X9({ max: 16384 }); +function J9(r) { + var e = pD.get(r); + return e === void 0 && (e = gB(r), pD.set(r, e)), e; +} +(function(r) { + Ji(e, r); + function e(t, n, i, a) { + var o = r.call(this) || this; + return o.delegate = t, o.moduleExposingNodes = n, o.moduleExposingMethods = i, o.inputNodes = a, o.type = "wrap", o; + } + return e.prototype.wrap = function(t, n) { + if (!this.inputNodes) + return this.moduleExposingNodes; + var i = Object.entries(this.inputNodes); + if (i.length === 0) + return this.moduleExposingNodes; + var a = {}; + return i.forEach(function(o) { + var s = o[0], l = o[1], u = typeof l == "string" ? t[l] : l; + u && (a[s] = new e(u, t, n)); + }), sr(sr({}, this.moduleExposingNodes), a); + }, e.prototype.filterNodes = function(t) { + return this.delegate.filterNodes(this.wrap(t, {})); + }, e.prototype.justEval = function(t, n) { + return this.delegate.evaluate(this.wrap(t, n), this.moduleExposingMethods); + }, e.prototype.fetchInfo = function(t) { + return this.delegate.fetchInfo(this.wrap(t, {})); + }, e.prototype.getChildren = function() { + return [this.delegate]; + }, e.prototype.dependValues = function() { + return {}; + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "fetchInfo", null), e; +})(Cl); +(function(r) { + Ji(e, r); + function e(t) { + var n = r.call(this) || this; + return n.child = t, n.type = "wrapContext", n; + } + return e.prototype.filterNodes = function(t) { + return this.child.filterNodes(t); + }, e.prototype.justEval = function(t, n) { + var i = this; + return function(a) { + var o; + return a ? (o = sr({}, t), Object.entries(a).forEach(function(s) { + var l = s[0], u = s[1]; + o[l] = J9(u); + })) : o = t, i.child.evaluate(o, n); + }; + }, e.prototype.getChildren = function() { + return [this.child]; + }, e.prototype.dependValues = function() { + return this.child.dependValues(); + }, e.prototype.fetchInfo = function(t) { + return this.child.fetchInfo(t); + }, Gi([ + va() + ], e.prototype, "filterNodes", null), e; +})(Cl); +(function(r) { + Ji(e, r); + function e(t, n) { + var i = r.call(this) || this; + return i.child = t, i.paramNodes = n, i.type = "wrapContextV2", i; + } + return e.prototype.filterNodes = function(t) { + return this.child.filterNodes(t); + }, e.prototype.justEval = function(t, n) { + return this.child.evaluate(this.wrap(t), n); + }, e.prototype.getChildren = function() { + return [this.child]; + }, e.prototype.dependValues = function() { + return this.child.dependValues(); + }, e.prototype.fetchInfo = function(t) { + return this.child.fetchInfo(this.wrap(t)); + }, e.prototype.wrap = function(t) { + return sr(sr({}, t), this.paramNodes); + }, Gi([ + va() + ], e.prototype, "filterNodes", null), Gi([ + va() + ], e.prototype, "wrap", null), e; +})(Cl); +var ha; +(function(r) { + r.CHANGE_VALUE = "CHANGE_VALUE", r.RENAME = "RENAME", r.MULTI_CHANGE = "MULTI_CHANGE", r.DELETE_COMP = "DELETE_COMP", r.REPLACE_COMP = "REPLACE_COMP", r.ONLY_EVAL = "NEED_EVAL", r.UPDATE_NODES_V2 = "UPDATE_NODES_V2", r.EXECUTE_QUERY = "EXECUTE_QUERY", r.TRIGGER_MODULE_EVENT = "TRIGGER_MODULE_EVENT", r.ROUTE_BY_NAME = "ROUTE_BY_NAME", r.UPDATE_ACTION_CONTEXT = "UPDATE_ACTION_CONTEXT", r.CUSTOM = "CUSTOM", r.BROADCAST = "BROADCAST"; +})(ha || (ha = {})); +function K9(r, e) { + return { + type: ha.CUSTOM, + path: [], + value: r, + editDSL: e + }; +} +function Q9(r, e) { + return !mB(r) && q9(r, e); +} +function q9(r, e) { + return r.type === ha.CUSTOM && $lodash.get(r.value, "type") === e; +} +function pI(r, e) { + return { + type: ha.CHANGE_VALUE, + path: [], + editDSL: e, + value: r + }; +} +function gd(r, e) { + return sr(sr({}, e), { path: eo([r], e.path, !0) }); +} +function mB(r) { + var e, t; + return ((t = (e = r == null ? void 0 : r.path) === null || e === void 0 ? void 0 : e.length) !== null && t !== void 0 ? t : 0) > 0; +} +function e8(r) { + return [r.path[0], sr(sr({}, r), { path: r.path.slice(1) })]; +} +function wp(r, e, t) { + return gd(r, pI(e, t)); +} +function t8(r) { + return { + type: ha.UPDATE_NODES_V2, + path: [], + editDSL: !1, + value: r + }; +} +var i_ = "__cache__"; +function r8(r, e, t) { + var n = t.value, i = i_ + e; + t.value = function() { + for (var a = [], o = 0; o < arguments.length; o++) + a[o] = arguments[o]; + var s = this; + return s[i] || (s[i] = [n.apply(this, a)]), s[i][0]; + }; +} +function gD(r, e) { + return r === e ? !0 : Object.keys(r).length === Object.keys(e).length && Object.keys(r).every(function(t) { + return e.hasOwnProperty(t) && r[t] === e[t]; + }); +} +function n8(r, e) { + if (e === void 0) + return !0; + var t = Object.keys(e).findIndex(function(n) { + return r[n] !== e[n]; + }); + return t === -1; +} +function a_(r, e, t) { + var n = Object.assign(Object.create(Object.getPrototypeOf(r)), r); + return Object.keys(n).forEach(function(i) { + if (i.startsWith(i_)) { + var a = i.slice(i_.length); + (!(t != null && t.keepCacheKeys) || !(t != null && t.keepCacheKeys.includes(a))) && delete n[i]; + } + }), Object.assign(n, e); +} +var yB = ( + /** @class */ + function() { + function r(e) { + var t; + this.dispatch = (t = e.dispatch) !== null && t !== void 0 ? t : function(n) { + }; + } + return r.prototype.changeDispatch = function(e) { + return a_(this, { dispatch: e }, { keepCacheKeys: ["node"] }); + }, r.prototype.dispatchChangeValueAction = function(e) { + this.dispatch(this.changeValueAction(e)); + }, r.prototype.changeValueAction = function(e) { + return pI(e, !0); + }, r.prototype.node = function() { + return this.nodeWithoutCache(); + }, Gi([ + r8 + ], r.prototype, "node", null), r; + }() +); +function mD(r, e) { + return function(t) { + r && r(gd(e, t)); + }; +} +(function(r) { + Ji(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.IGNORABLE_DEFAULT_VALUE = {}, n.children = n.parseChildrenFromValue(t), n; + } + return e.prototype.reduce = function(t) { + var n = this.reduceOrUndefined(t); + return n || (console.warn("not supported action, should not happen, action:", t, ` +current comp:`, this), this); + }, e.prototype.reduceOrUndefined = function(t) { + var n, i, a; + if (t.type === ha.DELETE_COMP && t.path.length === 1) + return this.setChildren($lodash.omit(this.children, t.path[0])); + if (t.type === ha.REPLACE_COMP && t.path.length === 1) { + var o = t.compFactory; + if (!o) + return this; + var s = t.path[0], l = this.children[s], u = l.toJsonValue(), c = new o({ + value: u, + dispatch: mD(this.dispatch, s) + }); + return this.setChildren(sr(sr({}, this.children), (n = {}, n[s] = c, n))); + } + if (mB(t)) { + var h = e8(t), f = h[0], v = h[1], b = this.children[f]; + if (!b) + return yb.error("found bad action path ", f), this; + var w = b.reduce(v); + return this.setChild(f, w); + } + switch (t.type) { + case ha.MULTI_CHANGE: { + var p = t.changes, d = $lodash.omitBy(this.children, function(g, S) { + var T = p[S]; + return T && T.type === ha.DELETE_COMP && T.path.length === 0; + }); + return d = $lodash.mapValues(d, function(g, S) { + var T = p[S]; + return T ? g.reduce(T) : g; + }), this.setChildren(d); + } + case ha.UPDATE_NODES_V2: { + var m = t.value; + if (m === void 0) + return this; + var _ = i_ + "REDUCE_UPDATE_NODE"; + if (this[_] === m) + return this; + var y = $lodash.mapValues(this.children, function(g, S) { + return m.hasOwnProperty(S) ? g.reduce(t8(m[S])) : g; + }), x = (a = this.extraNode()) === null || a === void 0 ? void 0 : a.updateNodeFields(m); + return gD(y, this.children) && n8(this, x) ? this : a_(this, sr((i = { children: y }, i[_] = m, i), x), { keepCacheKeys: ["node"] }); + } + case ha.CHANGE_VALUE: + return this.setChildren(this.parseChildrenFromValue({ + dispatch: this.dispatch, + value: t.value + })); + case ha.BROADCAST: + return this.setChildren($lodash.mapValues(this.children, function(g) { + return g.reduce(t); + })); + case ha.ONLY_EVAL: + return this; + } + }, e.prototype.setChild = function(t, n) { + var i; + return this.children[t] === n ? this : this.setChildren(sr(sr({}, this.children), (i = {}, i[t] = n, i))); + }, e.prototype.setChildren = function(t, n) { + return gD(t, this.children) ? this : a_(this, { children: t }, n); + }, e.prototype.extraNode = function() { + }, e.prototype.childrenNode = function() { + var t = this, n = {}; + return Object.keys(this.children).forEach(function(i) { + var a = t.children[i].node(); + a !== void 0 && (n[i] = a); + }), n; + }, e.prototype.nodeWithoutCache = function() { + var t; + return mb(sr(sr({}, this.childrenNode()), (t = this.extraNode()) === null || t === void 0 ? void 0 : t.node)); + }, e.prototype.changeDispatch = function(t) { + var n = $lodash.mapValues(this.children, function(i, a) { + return i.changeDispatch(mD(t, a)); + }); + return r.prototype.changeDispatch.call(this, t).setChildren(n, { keepCacheKeys: ["node"] }); + }, e.prototype.ignoreChildDefaultValue = function() { + return !1; + }, e.prototype.toJsonValue = function() { + var t = this, n = {}, i = this.ignoreChildDefaultValue(); + return Object.keys(this.children).forEach(function(a) { + var o = t.children[a]; + if (!o.hasOwnProperty("NO_PERSISTENCE")) { + var s = o.toJsonValue(); + i && $lodash.isEqual(s, o.IGNORABLE_DEFAULT_VALUE) || (n[a] = s); + } + }), n; + }, e.prototype.autoHeight = function() { + return !0; + }, e.prototype.changeChildAction = function(t, n) { + return gd(t, this.children[t].changeValueAction(n)); + }, e; +})(yB); +var i8 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t) { + var n = this, i; + return n = r.call(this, t) || this, n.value = (i = n.oldValueToNew(t.value)) !== null && i !== void 0 ? i : n.getDefaultValue(), n; + } + return e.prototype.oldValueToNew = function(t) { + return t; + }, e.prototype.reduce = function(t) { + return t.type === ha.CHANGE_VALUE ? this.value === t.value ? this : a_(this, { value: t.value }) : this; + }, e.prototype.nodeWithoutCache = function() { + return gB(this.value); + }, e.prototype.exposingNode = function() { + return this.node(); + }, e.prototype.toJsonValue = function() { + return this.value; + }, e; + }(yB) +); +(function(r) { + Ji(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.getView = function() { + return this.value; + }, e; +})(i8); +var _B = { exports: {} }, Nf = {}; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var Jx, yD; +function bB() { + if (yD) + return Jx; + yD = 1; + var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable; + function n(a) { + if (a == null) + throw new TypeError("Object.assign cannot be called with null or undefined"); + return Object(a); + } + function i() { + try { + if (!Object.assign) + return !1; + var a = new String("abc"); + if (a[5] = "de", Object.getOwnPropertyNames(a)[0] === "5") + return !1; + for (var o = {}, s = 0; s < 10; s++) + o["_" + String.fromCharCode(s)] = s; + var l = Object.getOwnPropertyNames(o).map(function(c) { + return o[c]; + }); + if (l.join("") !== "0123456789") + return !1; + var u = {}; + return "abcdefghijklmnopqrst".split("").forEach(function(c) { + u[c] = c; + }), Object.keys(Object.assign({}, u)).join("") === "abcdefghijklmnopqrst"; + } catch (c) { + return !1; + } + } + return Jx = i() ? Object.assign : function(a, o) { + for (var s, l = n(a), u, c = 1; c < arguments.length; c++) { + s = Object(arguments[c]); + for (var h in s) + e.call(s, h) && (l[h] = s[h]); + if (r) { + u = r(s); + for (var f = 0; f < u.length; f++) + t.call(s, u[f]) && (l[u[f]] = s[u[f]]); + } + } + return l; + }, Jx; +} +var gI = { exports: {} }, Kr = {}; +/** @license React v17.0.2 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var _D; +function a8() { + if (_D) + return Kr; + _D = 1; + var r = bB(), e = 60103, t = 60106; + Kr.Fragment = 60107, Kr.StrictMode = 60108, Kr.Profiler = 60114; + var n = 60109, i = 60110, a = 60112; + Kr.Suspense = 60113; + var o = 60115, s = 60116; + if (typeof Symbol == "function" && Symbol.for) { + var l = Symbol.for; + e = l("react.element"), t = l("react.portal"), Kr.Fragment = l("react.fragment"), Kr.StrictMode = l("react.strict_mode"), Kr.Profiler = l("react.profiler"), n = l("react.provider"), i = l("react.context"), a = l("react.forward_ref"), Kr.Suspense = l("react.suspense"), o = l("react.memo"), s = l("react.lazy"); + } + var u = typeof Symbol == "function" && Symbol.iterator; + function c($) { + return $ === null || typeof $ != "object" ? null : ($ = u && $[u] || $["@@iterator"], typeof $ == "function" ? $ : null); + } + function h($) { + for (var G = "https://reactjs.org/docs/error-decoder.html?invariant=" + $, Q = 1; Q < arguments.length; Q++) + G += "&args[]=" + encodeURIComponent(arguments[Q]); + return "Minified React error #" + $ + "; visit " + G + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; + } + var f = { isMounted: function() { + return !1; + }, enqueueForceUpdate: function() { + }, enqueueReplaceState: function() { + }, enqueueSetState: function() { + } }, v = {}; + function b($, G, Q) { + this.props = $, this.context = G, this.refs = v, this.updater = Q || f; + } + b.prototype.isReactComponent = {}, b.prototype.setState = function($, G) { + if (typeof $ != "object" && typeof $ != "function" && $ != null) + throw Error(h(85)); + this.updater.enqueueSetState(this, $, G, "setState"); + }, b.prototype.forceUpdate = function($) { + this.updater.enqueueForceUpdate(this, $, "forceUpdate"); + }; + function w() { + } + w.prototype = b.prototype; + function p($, G, Q) { + this.props = $, this.context = G, this.refs = v, this.updater = Q || f; + } + var d = p.prototype = new w(); + d.constructor = p, r(d, b.prototype), d.isPureReactComponent = !0; + var m = { current: null }, _ = Object.prototype.hasOwnProperty, y = { key: !0, ref: !0, __self: !0, __source: !0 }; + function x($, G, Q) { + var ee, ce = {}, ne = null, fe = null; + if (G != null) + for (ee in G.ref !== void 0 && (fe = G.ref), G.key !== void 0 && (ne = "" + G.key), G) + _.call(G, ee) && !y.hasOwnProperty(ee) && (ce[ee] = G[ee]); + var K = arguments.length - 2; + if (K === 1) + ce.children = Q; + else if (1 < K) { + for (var Oe = Array(K), xe = 0; xe < K; xe++) + Oe[xe] = arguments[xe + 2]; + ce.children = Oe; + } + if ($ && $.defaultProps) + for (ee in K = $.defaultProps, K) + ce[ee] === void 0 && (ce[ee] = K[ee]); + return { $$typeof: e, type: $, key: ne, ref: fe, props: ce, _owner: m.current }; + } + function g($, G) { + return { $$typeof: e, type: $.type, key: G, ref: $.ref, props: $.props, _owner: $._owner }; + } + function S($) { + return typeof $ == "object" && $ !== null && $.$$typeof === e; + } + function T($) { + var G = { "=": "=0", ":": "=2" }; + return "$" + $.replace(/[=:]/g, function(Q) { + return G[Q]; + }); + } + var C = /\/+/g; + function E($, G) { + return typeof $ == "object" && $ !== null && $.key != null ? T("" + $.key) : G.toString(36); + } + function M($, G, Q, ee, ce) { + var ne = typeof $; + (ne === "undefined" || ne === "boolean") && ($ = null); + var fe = !1; + if ($ === null) + fe = !0; + else + switch (ne) { + case "string": + case "number": + fe = !0; + break; + case "object": + switch ($.$$typeof) { + case e: + case t: + fe = !0; + } + } + if (fe) + return fe = $, ce = ce(fe), $ = ee === "" ? "." + E(fe, 0) : ee, Array.isArray(ce) ? (Q = "", $ != null && (Q = $.replace(C, "$&/") + "/"), M(ce, G, Q, "", function(xe) { + return xe; + })) : ce != null && (S(ce) && (ce = g(ce, Q + (!ce.key || fe && fe.key === ce.key ? "" : ("" + ce.key).replace(C, "$&/") + "/") + $)), G.push(ce)), 1; + if (fe = 0, ee = ee === "" ? "." : ee + ":", Array.isArray($)) + for (var K = 0; K < $.length; K++) { + ne = $[K]; + var Oe = ee + E(ne, K); + fe += M(ne, G, Q, Oe, ce); + } + else if (Oe = c($), typeof Oe == "function") + for ($ = Oe.call($), K = 0; !(ne = $.next()).done; ) + ne = ne.value, Oe = ee + E(ne, K++), fe += M(ne, G, Q, Oe, ce); + else if (ne === "object") + throw G = "" + $, Error(h(31, G === "[object Object]" ? "object with keys {" + Object.keys($).join(", ") + "}" : G)); + return fe; + } + function P($, G, Q) { + if ($ == null) + return $; + var ee = [], ce = 0; + return M($, ee, "", "", function(ne) { + return G.call(Q, ne, ce++); + }), ee; + } + function R($) { + if ($._status === -1) { + var G = $._result; + G = G(), $._status = 0, $._result = G, G.then(function(Q) { + $._status === 0 && (Q = Q.default, $._status = 1, $._result = Q); + }, function(Q) { + $._status === 0 && ($._status = 2, $._result = Q); + }); + } + if ($._status === 1) + return $._result; + throw $._result; + } + var N = { current: null }; + function F() { + var $ = N.current; + if ($ === null) + throw Error(h(321)); + return $; + } + var U = { ReactCurrentDispatcher: N, ReactCurrentBatchConfig: { transition: 0 }, ReactCurrentOwner: m, IsSomeRendererActing: { current: !1 }, assign: r }; + return Kr.Children = { map: P, forEach: function($, G, Q) { + P($, function() { + G.apply(this, arguments); + }, Q); + }, count: function($) { + var G = 0; + return P($, function() { + G++; + }), G; + }, toArray: function($) { + return P($, function(G) { + return G; + }) || []; + }, only: function($) { + if (!S($)) + throw Error(h(143)); + return $; + } }, Kr.Component = b, Kr.PureComponent = p, Kr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = U, Kr.cloneElement = function($, G, Q) { + if ($ == null) + throw Error(h(267, $)); + var ee = r({}, $.props), ce = $.key, ne = $.ref, fe = $._owner; + if (G != null) { + if (G.ref !== void 0 && (ne = G.ref, fe = m.current), G.key !== void 0 && (ce = "" + G.key), $.type && $.type.defaultProps) + var K = $.type.defaultProps; + for (Oe in G) + _.call(G, Oe) && !y.hasOwnProperty(Oe) && (ee[Oe] = G[Oe] === void 0 && K !== void 0 ? K[Oe] : G[Oe]); + } + var Oe = arguments.length - 2; + if (Oe === 1) + ee.children = Q; + else if (1 < Oe) { + K = Array(Oe); + for (var xe = 0; xe < Oe; xe++) + K[xe] = arguments[xe + 2]; + ee.children = K; + } + return { + $$typeof: e, + type: $.type, + key: ce, + ref: ne, + props: ee, + _owner: fe + }; + }, Kr.createContext = function($, G) { + return G === void 0 && (G = null), $ = { $$typeof: i, _calculateChangedBits: G, _currentValue: $, _currentValue2: $, _threadCount: 0, Provider: null, Consumer: null }, $.Provider = { $$typeof: n, _context: $ }, $.Consumer = $; + }, Kr.createElement = x, Kr.createFactory = function($) { + var G = x.bind(null, $); + return G.type = $, G; + }, Kr.createRef = function() { + return { current: null }; + }, Kr.forwardRef = function($) { + return { $$typeof: a, render: $ }; + }, Kr.isValidElement = S, Kr.lazy = function($) { + return { $$typeof: s, _payload: { _status: -1, _result: $ }, _init: R }; + }, Kr.memo = function($, G) { + return { $$typeof: o, type: $, compare: G === void 0 ? null : G }; + }, Kr.useCallback = function($, G) { + return F().useCallback($, G); + }, Kr.useContext = function($, G) { + return F().useContext($, G); + }, Kr.useDebugValue = function() { + }, Kr.useEffect = function($, G) { + return F().useEffect($, G); + }, Kr.useImperativeHandle = function($, G, Q) { + return F().useImperativeHandle($, G, Q); + }, Kr.useLayoutEffect = function($, G) { + return F().useLayoutEffect($, G); + }, Kr.useMemo = function($, G) { + return F().useMemo($, G); + }, Kr.useReducer = function($, G, Q) { + return F().useReducer($, G, Q); + }, Kr.useRef = function($) { + return F().useRef($); + }, Kr.useState = function($) { + return F().useState($); + }, Kr.version = "17.0.2", Kr; +} +(function(r) { + r.exports = a8(); +})(gI); +/** @license React v17.0.2 + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var bD; +function o8() { + if (bD) + return Nf; + bD = 1, bB(); + var r = gI.exports, e = 60103; + if (Nf.Fragment = 60107, typeof Symbol == "function" && Symbol.for) { + var t = Symbol.for; + e = t("react.element"), Nf.Fragment = t("react.fragment"); + } + var n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = Object.prototype.hasOwnProperty, a = { key: !0, ref: !0, __self: !0, __source: !0 }; + function o(s, l, u) { + var c, h = {}, f = null, v = null; + u !== void 0 && (f = "" + u), l.key !== void 0 && (f = "" + l.key), l.ref !== void 0 && (v = l.ref); + for (c in l) + i.call(l, c) && !a.hasOwnProperty(c) && (h[c] = l[c]); + if (s && s.defaultProps) + for (c in l = s.defaultProps, l) + h[c] === void 0 && (h[c] = l[c]); + return { $$typeof: e, type: s, key: f, ref: v, props: h, _owner: n.current }; + } + return Nf.jsx = o, Nf.jsxs = o, Nf; +} +(function(r) { + r.exports = o8(); +})(_B); +var s8 = {}, l8 = {}, u8 = /* @__PURE__ */ Object.freeze({ + __proto__: null, + en: s8, + zh: l8 +}), Yr; +(function(r) { + r[r.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", r[r.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", r[r.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", r[r.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", r[r.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", r[r.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", r[r.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", r[r.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", r[r.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", r[r.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", r[r.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", r[r.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", r[r.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", r[r.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", r[r.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", r[r.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", r[r.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", r[r.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", r[r.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", r[r.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", r[r.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", r[r.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", r[r.INVALID_TAG = 23] = "INVALID_TAG", r[r.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", r[r.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", r[r.UNCLOSED_TAG = 27] = "UNCLOSED_TAG"; +})(Yr || (Yr = {})); +var Hn; +(function(r) { + r[r.literal = 0] = "literal", r[r.argument = 1] = "argument", r[r.number = 2] = "number", r[r.date = 3] = "date", r[r.time = 4] = "time", r[r.select = 5] = "select", r[r.plural = 6] = "plural", r[r.pound = 7] = "pound", r[r.tag = 8] = "tag"; +})(Hn || (Hn = {})); +var Dd; +(function(r) { + r[r.number = 0] = "number", r[r.dateTime = 1] = "dateTime"; +})(Dd || (Dd = {})); +function xD(r) { + return r.type === Hn.literal; +} +function c8(r) { + return r.type === Hn.argument; +} +function xB(r) { + return r.type === Hn.number; +} +function SB(r) { + return r.type === Hn.date; +} +function wB(r) { + return r.type === Hn.time; +} +function CB(r) { + return r.type === Hn.select; +} +function TB(r) { + return r.type === Hn.plural; +} +function h8(r) { + return r.type === Hn.pound; +} +function IB(r) { + return r.type === Hn.tag; +} +function AB(r) { + return !!(r && typeof r == "object" && r.type === Dd.number); +} +function ZC(r) { + return !!(r && typeof r == "object" && r.type === Dd.dateTime); +} +var EB = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, f8 = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; +function d8(r) { + var e = {}; + return r.replace(f8, function(t) { + var n = t.length; + switch (t[0]) { + case "G": + e.era = n === 4 ? "long" : n === 5 ? "narrow" : "short"; + break; + case "y": + e.year = n === 2 ? "2-digit" : "numeric"; + break; + case "Y": + case "u": + case "U": + case "r": + throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead"); + case "q": + case "Q": + throw new RangeError("`q/Q` (quarter) patterns are not supported"); + case "M": + case "L": + e.month = ["numeric", "2-digit", "short", "long", "narrow"][n - 1]; + break; + case "w": + case "W": + throw new RangeError("`w/W` (week) patterns are not supported"); + case "d": + e.day = ["numeric", "2-digit"][n - 1]; + break; + case "D": + case "F": + case "g": + throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead"); + case "E": + e.weekday = n === 4 ? "short" : n === 5 ? "narrow" : "short"; + break; + case "e": + if (n < 4) + throw new RangeError("`e..eee` (weekday) patterns are not supported"); + e.weekday = ["short", "long", "narrow", "short"][n - 4]; + break; + case "c": + if (n < 4) + throw new RangeError("`c..ccc` (weekday) patterns are not supported"); + e.weekday = ["short", "long", "narrow", "short"][n - 4]; + break; + case "a": + e.hour12 = !0; + break; + case "b": + case "B": + throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead"); + case "h": + e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][n - 1]; + break; + case "H": + e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][n - 1]; + break; + case "K": + e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][n - 1]; + break; + case "k": + e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][n - 1]; + break; + case "j": + case "J": + case "C": + throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead"); + case "m": + e.minute = ["numeric", "2-digit"][n - 1]; + break; + case "s": + e.second = ["numeric", "2-digit"][n - 1]; + break; + case "S": + case "A": + throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead"); + case "z": + e.timeZoneName = n < 4 ? "short" : "long"; + break; + case "Z": + case "O": + case "v": + case "V": + case "X": + case "x": + throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead"); + } + return ""; + }), e; +} +var v8 = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i; +function p8(r) { + if (r.length === 0) + throw new Error("Number skeleton cannot be empty"); + for (var e = r.split(v8).filter(function(f) { + return f.length > 0; + }), t = [], n = 0, i = e; n < i.length; n++) { + var a = i[n], o = a.split("/"); + if (o.length === 0) + throw new Error("Invalid number skeleton"); + for (var s = o[0], l = o.slice(1), u = 0, c = l; u < c.length; u++) { + var h = c[u]; + if (h.length === 0) + throw new Error("Invalid number skeleton"); + } + t.push({ stem: s, options: l }); + } + return t; +} +function g8(r) { + return r.replace(/^(.*?)-/, ""); +} +var SD = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, MB = /^(@+)?(\+|#+)?[rs]?$/g, m8 = /(\*)(0+)|(#+)(0+)|(0+)/g, DB = /^(0+)$/; +function wD(r) { + var e = {}; + return r[r.length - 1] === "r" ? e.roundingPriority = "morePrecision" : r[r.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), r.replace(MB, function(t, n, i) { + return typeof i != "string" ? (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length) : i === "+" ? e.minimumSignificantDigits = n.length : n[0] === "#" ? e.maximumSignificantDigits = n.length : (e.minimumSignificantDigits = n.length, e.maximumSignificantDigits = n.length + (typeof i == "string" ? i.length : 0)), ""; + }), e; +} +function kB(r) { + switch (r) { + case "sign-auto": + return { + signDisplay: "auto" + }; + case "sign-accounting": + case "()": + return { + currencySign: "accounting" + }; + case "sign-always": + case "+!": + return { + signDisplay: "always" + }; + case "sign-accounting-always": + case "()!": + return { + signDisplay: "always", + currencySign: "accounting" + }; + case "sign-except-zero": + case "+?": + return { + signDisplay: "exceptZero" + }; + case "sign-accounting-except-zero": + case "()?": + return { + signDisplay: "exceptZero", + currencySign: "accounting" + }; + case "sign-never": + case "+_": + return { + signDisplay: "never" + }; + } +} +function y8(r) { + var e; + if (r[0] === "E" && r[1] === "E" ? (e = { + notation: "engineering" + }, r = r.slice(2)) : r[0] === "E" && (e = { + notation: "scientific" + }, r = r.slice(1)), e) { + var t = r.slice(0, 2); + if (t === "+!" ? (e.signDisplay = "always", r = r.slice(2)) : t === "+?" && (e.signDisplay = "exceptZero", r = r.slice(2)), !DB.test(r)) + throw new Error("Malformed concise eng/scientific notation"); + e.minimumIntegerDigits = r.length; + } + return e; +} +function CD(r) { + var e = {}, t = kB(r); + return t || e; +} +function _8(r) { + for (var e = {}, t = 0, n = r; t < n.length; t++) { + var i = n[t]; + switch (i.stem) { + case "percent": + case "%": + e.style = "percent"; + continue; + case "%x100": + e.style = "percent", e.scale = 100; + continue; + case "currency": + e.style = "currency", e.currency = i.options[0]; + continue; + case "group-off": + case ",_": + e.useGrouping = !1; + continue; + case "precision-integer": + case ".": + e.maximumFractionDigits = 0; + continue; + case "measure-unit": + case "unit": + e.style = "unit", e.unit = g8(i.options[0]); + continue; + case "compact-short": + case "K": + e.notation = "compact", e.compactDisplay = "short"; + continue; + case "compact-long": + case "KK": + e.notation = "compact", e.compactDisplay = "long"; + continue; + case "scientific": + e = sr(sr(sr({}, e), { notation: "scientific" }), i.options.reduce(function(l, u) { + return sr(sr({}, l), CD(u)); + }, {})); + continue; + case "engineering": + e = sr(sr(sr({}, e), { notation: "engineering" }), i.options.reduce(function(l, u) { + return sr(sr({}, l), CD(u)); + }, {})); + continue; + case "notation-simple": + e.notation = "standard"; + continue; + case "unit-width-narrow": + e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow"; + continue; + case "unit-width-short": + e.currencyDisplay = "code", e.unitDisplay = "short"; + continue; + case "unit-width-full-name": + e.currencyDisplay = "name", e.unitDisplay = "long"; + continue; + case "unit-width-iso-code": + e.currencyDisplay = "symbol"; + continue; + case "scale": + e.scale = parseFloat(i.options[0]); + continue; + case "integer-width": + if (i.options.length > 1) + throw new RangeError("integer-width stems only accept a single optional option"); + i.options[0].replace(m8, function(l, u, c, h, f, v) { + if (u) + e.minimumIntegerDigits = c.length; + else { + if (h && f) + throw new Error("We currently do not support maximum integer digits"); + if (v) + throw new Error("We currently do not support exact integer digits"); + } + return ""; + }); + continue; + } + if (DB.test(i.stem)) { + e.minimumIntegerDigits = i.stem.length; + continue; + } + if (SD.test(i.stem)) { + if (i.options.length > 1) + throw new RangeError("Fraction-precision stems only accept a single optional option"); + i.stem.replace(SD, function(l, u, c, h, f, v) { + return c === "*" ? e.minimumFractionDigits = u.length : h && h[0] === "#" ? e.maximumFractionDigits = h.length : f && v ? (e.minimumFractionDigits = f.length, e.maximumFractionDigits = f.length + v.length) : (e.minimumFractionDigits = u.length, e.maximumFractionDigits = u.length), ""; + }); + var a = i.options[0]; + a === "w" ? e = sr(sr({}, e), { trailingZeroDisplay: "stripIfInteger" }) : a && (e = sr(sr({}, e), wD(a))); + continue; + } + if (MB.test(i.stem)) { + e = sr(sr({}, e), wD(i.stem)); + continue; + } + var o = kB(i.stem); + o && (e = sr(sr({}, e), o)); + var s = y8(i.stem); + s && (e = sr(sr({}, e), s)); + } + return e; +} +var gy = { + AX: [ + "H" + ], + BQ: [ + "H" + ], + CP: [ + "H" + ], + CZ: [ + "H" + ], + DK: [ + "H" + ], + FI: [ + "H" + ], + ID: [ + "H" + ], + IS: [ + "H" + ], + ML: [ + "H" + ], + NE: [ + "H" + ], + RU: [ + "H" + ], + SE: [ + "H" + ], + SJ: [ + "H" + ], + SK: [ + "H" + ], + AS: [ + "h", + "H" + ], + BT: [ + "h", + "H" + ], + DJ: [ + "h", + "H" + ], + ER: [ + "h", + "H" + ], + GH: [ + "h", + "H" + ], + IN: [ + "h", + "H" + ], + LS: [ + "h", + "H" + ], + PG: [ + "h", + "H" + ], + PW: [ + "h", + "H" + ], + SO: [ + "h", + "H" + ], + TO: [ + "h", + "H" + ], + VU: [ + "h", + "H" + ], + WS: [ + "h", + "H" + ], + "001": [ + "H", + "h" + ], + AL: [ + "h", + "H", + "hB" + ], + TD: [ + "h", + "H", + "hB" + ], + "ca-ES": [ + "H", + "h", + "hB" + ], + CF: [ + "H", + "h", + "hB" + ], + CM: [ + "H", + "h", + "hB" + ], + "fr-CA": [ + "H", + "h", + "hB" + ], + "gl-ES": [ + "H", + "h", + "hB" + ], + "it-CH": [ + "H", + "h", + "hB" + ], + "it-IT": [ + "H", + "h", + "hB" + ], + LU: [ + "H", + "h", + "hB" + ], + NP: [ + "H", + "h", + "hB" + ], + PF: [ + "H", + "h", + "hB" + ], + SC: [ + "H", + "h", + "hB" + ], + SM: [ + "H", + "h", + "hB" + ], + SN: [ + "H", + "h", + "hB" + ], + TF: [ + "H", + "h", + "hB" + ], + VA: [ + "H", + "h", + "hB" + ], + CY: [ + "h", + "H", + "hb", + "hB" + ], + GR: [ + "h", + "H", + "hb", + "hB" + ], + CO: [ + "h", + "H", + "hB", + "hb" + ], + DO: [ + "h", + "H", + "hB", + "hb" + ], + KP: [ + "h", + "H", + "hB", + "hb" + ], + KR: [ + "h", + "H", + "hB", + "hb" + ], + NA: [ + "h", + "H", + "hB", + "hb" + ], + PA: [ + "h", + "H", + "hB", + "hb" + ], + PR: [ + "h", + "H", + "hB", + "hb" + ], + VE: [ + "h", + "H", + "hB", + "hb" + ], + AC: [ + "H", + "h", + "hb", + "hB" + ], + AI: [ + "H", + "h", + "hb", + "hB" + ], + BW: [ + "H", + "h", + "hb", + "hB" + ], + BZ: [ + "H", + "h", + "hb", + "hB" + ], + CC: [ + "H", + "h", + "hb", + "hB" + ], + CK: [ + "H", + "h", + "hb", + "hB" + ], + CX: [ + "H", + "h", + "hb", + "hB" + ], + DG: [ + "H", + "h", + "hb", + "hB" + ], + FK: [ + "H", + "h", + "hb", + "hB" + ], + GB: [ + "H", + "h", + "hb", + "hB" + ], + GG: [ + "H", + "h", + "hb", + "hB" + ], + GI: [ + "H", + "h", + "hb", + "hB" + ], + IE: [ + "H", + "h", + "hb", + "hB" + ], + IM: [ + "H", + "h", + "hb", + "hB" + ], + IO: [ + "H", + "h", + "hb", + "hB" + ], + JE: [ + "H", + "h", + "hb", + "hB" + ], + LT: [ + "H", + "h", + "hb", + "hB" + ], + MK: [ + "H", + "h", + "hb", + "hB" + ], + MN: [ + "H", + "h", + "hb", + "hB" + ], + MS: [ + "H", + "h", + "hb", + "hB" + ], + NF: [ + "H", + "h", + "hb", + "hB" + ], + NG: [ + "H", + "h", + "hb", + "hB" + ], + NR: [ + "H", + "h", + "hb", + "hB" + ], + NU: [ + "H", + "h", + "hb", + "hB" + ], + PN: [ + "H", + "h", + "hb", + "hB" + ], + SH: [ + "H", + "h", + "hb", + "hB" + ], + SX: [ + "H", + "h", + "hb", + "hB" + ], + TA: [ + "H", + "h", + "hb", + "hB" + ], + ZA: [ + "H", + "h", + "hb", + "hB" + ], + "af-ZA": [ + "H", + "h", + "hB", + "hb" + ], + AR: [ + "H", + "h", + "hB", + "hb" + ], + CL: [ + "H", + "h", + "hB", + "hb" + ], + CR: [ + "H", + "h", + "hB", + "hb" + ], + CU: [ + "H", + "h", + "hB", + "hb" + ], + EA: [ + "H", + "h", + "hB", + "hb" + ], + "es-BO": [ + "H", + "h", + "hB", + "hb" + ], + "es-BR": [ + "H", + "h", + "hB", + "hb" + ], + "es-EC": [ + "H", + "h", + "hB", + "hb" + ], + "es-ES": [ + "H", + "h", + "hB", + "hb" + ], + "es-GQ": [ + "H", + "h", + "hB", + "hb" + ], + "es-PE": [ + "H", + "h", + "hB", + "hb" + ], + GT: [ + "H", + "h", + "hB", + "hb" + ], + HN: [ + "H", + "h", + "hB", + "hb" + ], + IC: [ + "H", + "h", + "hB", + "hb" + ], + KG: [ + "H", + "h", + "hB", + "hb" + ], + KM: [ + "H", + "h", + "hB", + "hb" + ], + LK: [ + "H", + "h", + "hB", + "hb" + ], + MA: [ + "H", + "h", + "hB", + "hb" + ], + MX: [ + "H", + "h", + "hB", + "hb" + ], + NI: [ + "H", + "h", + "hB", + "hb" + ], + PY: [ + "H", + "h", + "hB", + "hb" + ], + SV: [ + "H", + "h", + "hB", + "hb" + ], + UY: [ + "H", + "h", + "hB", + "hb" + ], + JP: [ + "H", + "h", + "K" + ], + AD: [ + "H", + "hB" + ], + AM: [ + "H", + "hB" + ], + AO: [ + "H", + "hB" + ], + AT: [ + "H", + "hB" + ], + AW: [ + "H", + "hB" + ], + BE: [ + "H", + "hB" + ], + BF: [ + "H", + "hB" + ], + BJ: [ + "H", + "hB" + ], + BL: [ + "H", + "hB" + ], + BR: [ + "H", + "hB" + ], + CG: [ + "H", + "hB" + ], + CI: [ + "H", + "hB" + ], + CV: [ + "H", + "hB" + ], + DE: [ + "H", + "hB" + ], + EE: [ + "H", + "hB" + ], + FR: [ + "H", + "hB" + ], + GA: [ + "H", + "hB" + ], + GF: [ + "H", + "hB" + ], + GN: [ + "H", + "hB" + ], + GP: [ + "H", + "hB" + ], + GW: [ + "H", + "hB" + ], + HR: [ + "H", + "hB" + ], + IL: [ + "H", + "hB" + ], + IT: [ + "H", + "hB" + ], + KZ: [ + "H", + "hB" + ], + MC: [ + "H", + "hB" + ], + MD: [ + "H", + "hB" + ], + MF: [ + "H", + "hB" + ], + MQ: [ + "H", + "hB" + ], + MZ: [ + "H", + "hB" + ], + NC: [ + "H", + "hB" + ], + NL: [ + "H", + "hB" + ], + PM: [ + "H", + "hB" + ], + PT: [ + "H", + "hB" + ], + RE: [ + "H", + "hB" + ], + RO: [ + "H", + "hB" + ], + SI: [ + "H", + "hB" + ], + SR: [ + "H", + "hB" + ], + ST: [ + "H", + "hB" + ], + TG: [ + "H", + "hB" + ], + TR: [ + "H", + "hB" + ], + WF: [ + "H", + "hB" + ], + YT: [ + "H", + "hB" + ], + BD: [ + "h", + "hB", + "H" + ], + PK: [ + "h", + "hB", + "H" + ], + AZ: [ + "H", + "hB", + "h" + ], + BA: [ + "H", + "hB", + "h" + ], + BG: [ + "H", + "hB", + "h" + ], + CH: [ + "H", + "hB", + "h" + ], + GE: [ + "H", + "hB", + "h" + ], + LI: [ + "H", + "hB", + "h" + ], + ME: [ + "H", + "hB", + "h" + ], + RS: [ + "H", + "hB", + "h" + ], + UA: [ + "H", + "hB", + "h" + ], + UZ: [ + "H", + "hB", + "h" + ], + XK: [ + "H", + "hB", + "h" + ], + AG: [ + "h", + "hb", + "H", + "hB" + ], + AU: [ + "h", + "hb", + "H", + "hB" + ], + BB: [ + "h", + "hb", + "H", + "hB" + ], + BM: [ + "h", + "hb", + "H", + "hB" + ], + BS: [ + "h", + "hb", + "H", + "hB" + ], + CA: [ + "h", + "hb", + "H", + "hB" + ], + DM: [ + "h", + "hb", + "H", + "hB" + ], + "en-001": [ + "h", + "hb", + "H", + "hB" + ], + FJ: [ + "h", + "hb", + "H", + "hB" + ], + FM: [ + "h", + "hb", + "H", + "hB" + ], + GD: [ + "h", + "hb", + "H", + "hB" + ], + GM: [ + "h", + "hb", + "H", + "hB" + ], + GU: [ + "h", + "hb", + "H", + "hB" + ], + GY: [ + "h", + "hb", + "H", + "hB" + ], + JM: [ + "h", + "hb", + "H", + "hB" + ], + KI: [ + "h", + "hb", + "H", + "hB" + ], + KN: [ + "h", + "hb", + "H", + "hB" + ], + KY: [ + "h", + "hb", + "H", + "hB" + ], + LC: [ + "h", + "hb", + "H", + "hB" + ], + LR: [ + "h", + "hb", + "H", + "hB" + ], + MH: [ + "h", + "hb", + "H", + "hB" + ], + MP: [ + "h", + "hb", + "H", + "hB" + ], + MW: [ + "h", + "hb", + "H", + "hB" + ], + NZ: [ + "h", + "hb", + "H", + "hB" + ], + SB: [ + "h", + "hb", + "H", + "hB" + ], + SG: [ + "h", + "hb", + "H", + "hB" + ], + SL: [ + "h", + "hb", + "H", + "hB" + ], + SS: [ + "h", + "hb", + "H", + "hB" + ], + SZ: [ + "h", + "hb", + "H", + "hB" + ], + TC: [ + "h", + "hb", + "H", + "hB" + ], + TT: [ + "h", + "hb", + "H", + "hB" + ], + UM: [ + "h", + "hb", + "H", + "hB" + ], + US: [ + "h", + "hb", + "H", + "hB" + ], + VC: [ + "h", + "hb", + "H", + "hB" + ], + VG: [ + "h", + "hb", + "H", + "hB" + ], + VI: [ + "h", + "hb", + "H", + "hB" + ], + ZM: [ + "h", + "hb", + "H", + "hB" + ], + BO: [ + "H", + "hB", + "h", + "hb" + ], + EC: [ + "H", + "hB", + "h", + "hb" + ], + ES: [ + "H", + "hB", + "h", + "hb" + ], + GQ: [ + "H", + "hB", + "h", + "hb" + ], + PE: [ + "H", + "hB", + "h", + "hb" + ], + AE: [ + "h", + "hB", + "hb", + "H" + ], + "ar-001": [ + "h", + "hB", + "hb", + "H" + ], + BH: [ + "h", + "hB", + "hb", + "H" + ], + DZ: [ + "h", + "hB", + "hb", + "H" + ], + EG: [ + "h", + "hB", + "hb", + "H" + ], + EH: [ + "h", + "hB", + "hb", + "H" + ], + HK: [ + "h", + "hB", + "hb", + "H" + ], + IQ: [ + "h", + "hB", + "hb", + "H" + ], + JO: [ + "h", + "hB", + "hb", + "H" + ], + KW: [ + "h", + "hB", + "hb", + "H" + ], + LB: [ + "h", + "hB", + "hb", + "H" + ], + LY: [ + "h", + "hB", + "hb", + "H" + ], + MO: [ + "h", + "hB", + "hb", + "H" + ], + MR: [ + "h", + "hB", + "hb", + "H" + ], + OM: [ + "h", + "hB", + "hb", + "H" + ], + PH: [ + "h", + "hB", + "hb", + "H" + ], + PS: [ + "h", + "hB", + "hb", + "H" + ], + QA: [ + "h", + "hB", + "hb", + "H" + ], + SA: [ + "h", + "hB", + "hb", + "H" + ], + SD: [ + "h", + "hB", + "hb", + "H" + ], + SY: [ + "h", + "hB", + "hb", + "H" + ], + TN: [ + "h", + "hB", + "hb", + "H" + ], + YE: [ + "h", + "hB", + "hb", + "H" + ], + AF: [ + "H", + "hb", + "hB", + "h" + ], + LA: [ + "H", + "hb", + "hB", + "h" + ], + CN: [ + "H", + "hB", + "hb", + "h" + ], + LV: [ + "H", + "hB", + "hb", + "h" + ], + TL: [ + "H", + "hB", + "hb", + "h" + ], + "zu-ZA": [ + "H", + "hB", + "hb", + "h" + ], + CD: [ + "hB", + "H" + ], + IR: [ + "hB", + "H" + ], + "hi-IN": [ + "hB", + "h", + "H" + ], + "kn-IN": [ + "hB", + "h", + "H" + ], + "ml-IN": [ + "hB", + "h", + "H" + ], + "te-IN": [ + "hB", + "h", + "H" + ], + KH: [ + "hB", + "h", + "H", + "hb" + ], + "ta-IN": [ + "hB", + "h", + "hb", + "H" + ], + BN: [ + "hb", + "hB", + "h", + "H" + ], + MY: [ + "hb", + "hB", + "h", + "H" + ], + ET: [ + "hB", + "hb", + "h", + "H" + ], + "gu-IN": [ + "hB", + "hb", + "h", + "H" + ], + "mr-IN": [ + "hB", + "hb", + "h", + "H" + ], + "pa-IN": [ + "hB", + "hb", + "h", + "H" + ], + TW: [ + "hB", + "hb", + "h", + "H" + ], + KE: [ + "hB", + "hb", + "H", + "h" + ], + MM: [ + "hB", + "hb", + "H", + "h" + ], + TZ: [ + "hB", + "hb", + "H", + "h" + ], + UG: [ + "hB", + "hb", + "H", + "h" + ] +}; +function b8(r, e) { + for (var t = "", n = 0; n < r.length; n++) { + var i = r.charAt(n); + if (i === "j") { + for (var a = 0; n + 1 < r.length && r.charAt(n + 1) === i; ) + a++, n++; + var o = 1 + (a & 1), s = a < 2 ? 1 : 3 + (a >> 1), l = "a", u = x8(e); + for ((u == "H" || u == "k") && (s = 0); s-- > 0; ) + t += l; + for (; o-- > 0; ) + t = u + t; + } else + i === "J" ? t += "H" : t += i; + } + return t; +} +function x8(r) { + var e = r.hourCycle; + if (e === void 0 && // @ts-ignore hourCycle(s) is not identified yet + r.hourCycles && // @ts-ignore + r.hourCycles.length && (e = r.hourCycles[0]), e) + switch (e) { + case "h24": + return "k"; + case "h23": + return "H"; + case "h12": + return "h"; + case "h11": + return "K"; + default: + throw new Error("Invalid hourCycle"); + } + var t = r.language, n; + t !== "root" && (n = r.maximize().region); + var i = gy[n || ""] || gy[t || ""] || gy["".concat(t, "-001")] || gy["001"]; + return i[0]; +} +var Kx, S8 = new RegExp("^".concat(EB.source, "*")), w8 = new RegExp("".concat(EB.source, "*$")); +function Qr(r, e) { + return { start: r, end: e }; +} +var C8 = !!String.prototype.startsWith, T8 = !!String.fromCodePoint, I8 = !!Object.fromEntries, A8 = !!String.prototype.codePointAt, E8 = !!String.prototype.trimStart, M8 = !!String.prototype.trimEnd, D8 = !!Number.isSafeInteger, k8 = D8 ? Number.isSafeInteger : function(r) { + return typeof r == "number" && isFinite(r) && Math.floor(r) === r && Math.abs(r) <= 9007199254740991; +}, JC = !0; +try { + var O8 = LB("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"); + JC = ((Kx = O8.exec("a")) === null || Kx === void 0 ? void 0 : Kx[0]) === "a"; +} catch (r) { + JC = !1; +} +var TD = C8 ? ( + // Native + function(e, t, n) { + return e.startsWith(t, n); + } +) : ( + // For IE11 + function(e, t, n) { + return e.slice(n, n + t.length) === t; + } +), KC = T8 ? String.fromCodePoint : ( + // IE11 + function() { + for (var e = [], t = 0; t < arguments.length; t++) + e[t] = arguments[t]; + for (var n = "", i = e.length, a = 0, o; i > a; ) { + if (o = e[a++], o > 1114111) + throw RangeError(o + " is not a valid code point"); + n += o < 65536 ? String.fromCharCode(o) : String.fromCharCode(((o -= 65536) >> 10) + 55296, o % 1024 + 56320); + } + return n; + } +), ID = ( + // native + I8 ? Object.fromEntries : ( + // Ponyfill + function(e) { + for (var t = {}, n = 0, i = e; n < i.length; n++) { + var a = i[n], o = a[0], s = a[1]; + t[o] = s; + } + return t; + } + ) +), OB = A8 ? ( + // Native + function(e, t) { + return e.codePointAt(t); + } +) : ( + // IE 11 + function(e, t) { + var n = e.length; + if (!(t < 0 || t >= n)) { + var i = e.charCodeAt(t), a; + return i < 55296 || i > 56319 || t + 1 === n || (a = e.charCodeAt(t + 1)) < 56320 || a > 57343 ? i : (i - 55296 << 10) + (a - 56320) + 65536; + } + } +), L8 = E8 ? ( + // Native + function(e) { + return e.trimStart(); + } +) : ( + // Ponyfill + function(e) { + return e.replace(S8, ""); + } +), P8 = M8 ? ( + // Native + function(e) { + return e.trimEnd(); + } +) : ( + // Ponyfill + function(e) { + return e.replace(w8, ""); + } +); +function LB(r, e) { + return new RegExp(r, e); +} +var QC; +if (JC) { + var AD = LB("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"); + QC = function(e, t) { + var n; + AD.lastIndex = t; + var i = AD.exec(e); + return (n = i[1]) !== null && n !== void 0 ? n : ""; + }; +} else + QC = function(e, t) { + for (var n = []; ; ) { + var i = OB(e, t); + if (i === void 0 || PB(i) || B8(i)) + break; + n.push(i), t += i >= 65536 ? 2 : 1; + } + return KC.apply(void 0, n); + }; +var R8 = ( + /** @class */ + function() { + function r(e, t) { + t === void 0 && (t = {}), this.message = e, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!t.ignoreTag, this.locale = t.locale, this.requiresOtherClause = !!t.requiresOtherClause, this.shouldParseSkeletons = !!t.shouldParseSkeletons; + } + return r.prototype.parse = function() { + if (this.offset() !== 0) + throw Error("parser can only be used once"); + return this.parseMessage(0, "", !1); + }, r.prototype.parseMessage = function(e, t, n) { + for (var i = []; !this.isEOF(); ) { + var a = this.char(); + if (a === 123) { + var o = this.parseArgument(e, n); + if (o.err) + return o; + i.push(o.val); + } else { + if (a === 125 && e > 0) + break; + if (a === 35 && (t === "plural" || t === "selectordinal")) { + var s = this.clonePosition(); + this.bump(), i.push({ + type: Hn.pound, + location: Qr(s, this.clonePosition()) + }); + } else if (a === 60 && !this.ignoreTag && this.peek() === 47) { + if (n) + break; + return this.error(Yr.UNMATCHED_CLOSING_TAG, Qr(this.clonePosition(), this.clonePosition())); + } else if (a === 60 && !this.ignoreTag && qC(this.peek() || 0)) { + var o = this.parseTag(e, t); + if (o.err) + return o; + i.push(o.val); + } else { + var o = this.parseLiteral(e, t); + if (o.err) + return o; + i.push(o.val); + } + } + } + return { val: i, err: null }; + }, r.prototype.parseTag = function(e, t) { + var n = this.clonePosition(); + this.bump(); + var i = this.parseTagName(); + if (this.bumpSpace(), this.bumpIf("/>")) + return { + val: { + type: Hn.literal, + value: "<".concat(i, "/>"), + location: Qr(n, this.clonePosition()) + }, + err: null + }; + if (this.bumpIf(">")) { + var a = this.parseMessage(e + 1, t, !0); + if (a.err) + return a; + var o = a.val, s = this.clonePosition(); + if (this.bumpIf("") ? { + val: { + type: Hn.tag, + value: i, + children: o, + location: Qr(n, this.clonePosition()) + }, + err: null + } : this.error(Yr.INVALID_TAG, Qr(s, this.clonePosition()))); + } else + return this.error(Yr.UNCLOSED_TAG, Qr(n, this.clonePosition())); + } else + return this.error(Yr.INVALID_TAG, Qr(n, this.clonePosition())); + }, r.prototype.parseTagName = function() { + var e = this.offset(); + for (this.bump(); !this.isEOF() && z8(this.char()); ) + this.bump(); + return this.message.slice(e, this.offset()); + }, r.prototype.parseLiteral = function(e, t) { + for (var n = this.clonePosition(), i = ""; ; ) { + var a = this.tryParseQuote(t); + if (a) { + i += a; + continue; + } + var o = this.tryParseUnquoted(e, t); + if (o) { + i += o; + continue; + } + var s = this.tryParseLeftAngleBracket(); + if (s) { + i += s; + continue; + } + break; + } + var l = Qr(n, this.clonePosition()); + return { + val: { type: Hn.literal, value: i, location: l }, + err: null + }; + }, r.prototype.tryParseLeftAngleBracket = function() { + return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail. + !N8(this.peek() || 0)) ? (this.bump(), "<") : null; + }, r.prototype.tryParseQuote = function(e) { + if (this.isEOF() || this.char() !== 39) + return null; + switch (this.peek()) { + case 39: + return this.bump(), this.bump(), "'"; + case 123: + case 60: + case 62: + case 125: + break; + case 35: + if (e === "plural" || e === "selectordinal") + break; + return null; + default: + return null; + } + this.bump(); + var t = [this.char()]; + for (this.bump(); !this.isEOF(); ) { + var n = this.char(); + if (n === 39) + if (this.peek() === 39) + t.push(39), this.bump(); + else { + this.bump(); + break; + } + else + t.push(n); + this.bump(); + } + return KC.apply(void 0, t); + }, r.prototype.tryParseUnquoted = function(e, t) { + if (this.isEOF()) + return null; + var n = this.char(); + return n === 60 || n === 123 || n === 35 && (t === "plural" || t === "selectordinal") || n === 125 && e > 0 ? null : (this.bump(), KC(n)); + }, r.prototype.parseArgument = function(e, t) { + var n = this.clonePosition(); + if (this.bump(), this.bumpSpace(), this.isEOF()) + return this.error(Yr.EXPECT_ARGUMENT_CLOSING_BRACE, Qr(n, this.clonePosition())); + if (this.char() === 125) + return this.bump(), this.error(Yr.EMPTY_ARGUMENT, Qr(n, this.clonePosition())); + var i = this.parseIdentifierIfPossible().value; + if (!i) + return this.error(Yr.MALFORMED_ARGUMENT, Qr(n, this.clonePosition())); + if (this.bumpSpace(), this.isEOF()) + return this.error(Yr.EXPECT_ARGUMENT_CLOSING_BRACE, Qr(n, this.clonePosition())); + switch (this.char()) { + case 125: + return this.bump(), { + val: { + type: Hn.argument, + // value does not include the opening and closing braces. + value: i, + location: Qr(n, this.clonePosition()) + }, + err: null + }; + case 44: + return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(Yr.EXPECT_ARGUMENT_CLOSING_BRACE, Qr(n, this.clonePosition())) : this.parseArgumentOptions(e, t, i, n); + default: + return this.error(Yr.MALFORMED_ARGUMENT, Qr(n, this.clonePosition())); + } + }, r.prototype.parseIdentifierIfPossible = function() { + var e = this.clonePosition(), t = this.offset(), n = QC(this.message, t), i = t + n.length; + this.bumpTo(i); + var a = this.clonePosition(), o = Qr(e, a); + return { value: n, location: o }; + }, r.prototype.parseArgumentOptions = function(e, t, n, i) { + var a, o = this.clonePosition(), s = this.parseIdentifierIfPossible().value, l = this.clonePosition(); + switch (s) { + case "": + return this.error(Yr.EXPECT_ARGUMENT_TYPE, Qr(o, l)); + case "number": + case "date": + case "time": { + this.bumpSpace(); + var u = null; + if (this.bumpIf(",")) { + this.bumpSpace(); + var c = this.clonePosition(), h = this.parseSimpleArgStyleIfPossible(); + if (h.err) + return h; + var f = P8(h.val); + if (f.length === 0) + return this.error(Yr.EXPECT_ARGUMENT_STYLE, Qr(this.clonePosition(), this.clonePosition())); + var v = Qr(c, this.clonePosition()); + u = { style: f, styleLocation: v }; + } + var b = this.tryParseArgumentClose(i); + if (b.err) + return b; + var w = Qr(i, this.clonePosition()); + if (u && TD(u == null ? void 0 : u.style, "::", 0)) { + var p = L8(u.style.slice(2)); + if (s === "number") { + var h = this.parseNumberSkeletonFromString(p, u.styleLocation); + return h.err ? h : { + val: { type: Hn.number, value: n, location: w, style: h.val }, + err: null + }; + } else { + if (p.length === 0) + return this.error(Yr.EXPECT_DATE_TIME_SKELETON, w); + var d = p; + this.locale && (d = b8(p, this.locale)); + var f = { + type: Dd.dateTime, + pattern: d, + location: u.styleLocation, + parsedOptions: this.shouldParseSkeletons ? d8(d) : {} + }, m = s === "date" ? Hn.date : Hn.time; + return { + val: { type: m, value: n, location: w, style: f }, + err: null + }; + } + } + return { + val: { + type: s === "number" ? Hn.number : s === "date" ? Hn.date : Hn.time, + value: n, + location: w, + style: (a = u == null ? void 0 : u.style) !== null && a !== void 0 ? a : null + }, + err: null + }; + } + case "plural": + case "selectordinal": + case "select": { + var _ = this.clonePosition(); + if (this.bumpSpace(), !this.bumpIf(",")) + return this.error(Yr.EXPECT_SELECT_ARGUMENT_OPTIONS, Qr(_, sr({}, _))); + this.bumpSpace(); + var y = this.parseIdentifierIfPossible(), x = 0; + if (s !== "select" && y.value === "offset") { + if (!this.bumpIf(":")) + return this.error(Yr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, Qr(this.clonePosition(), this.clonePosition())); + this.bumpSpace(); + var h = this.tryParseDecimalInteger(Yr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, Yr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE); + if (h.err) + return h; + this.bumpSpace(), y = this.parseIdentifierIfPossible(), x = h.val; + } + var g = this.tryParsePluralOrSelectOptions(e, s, t, y); + if (g.err) + return g; + var b = this.tryParseArgumentClose(i); + if (b.err) + return b; + var S = Qr(i, this.clonePosition()); + return s === "select" ? { + val: { + type: Hn.select, + value: n, + options: ID(g.val), + location: S + }, + err: null + } : { + val: { + type: Hn.plural, + value: n, + options: ID(g.val), + offset: x, + pluralType: s === "plural" ? "cardinal" : "ordinal", + location: S + }, + err: null + }; + } + default: + return this.error(Yr.INVALID_ARGUMENT_TYPE, Qr(o, l)); + } + }, r.prototype.tryParseArgumentClose = function(e) { + return this.isEOF() || this.char() !== 125 ? this.error(Yr.EXPECT_ARGUMENT_CLOSING_BRACE, Qr(e, this.clonePosition())) : (this.bump(), { val: !0, err: null }); + }, r.prototype.parseSimpleArgStyleIfPossible = function() { + for (var e = 0, t = this.clonePosition(); !this.isEOF(); ) { + var n = this.char(); + switch (n) { + case 39: { + this.bump(); + var i = this.clonePosition(); + if (!this.bumpUntil("'")) + return this.error(Yr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, Qr(i, this.clonePosition())); + this.bump(); + break; + } + case 123: { + e += 1, this.bump(); + break; + } + case 125: { + if (e > 0) + e -= 1; + else + return { + val: this.message.slice(t.offset, this.offset()), + err: null + }; + break; + } + default: + this.bump(); + break; + } + } + return { + val: this.message.slice(t.offset, this.offset()), + err: null + }; + }, r.prototype.parseNumberSkeletonFromString = function(e, t) { + var n = []; + try { + n = p8(e); + } catch (i) { + return this.error(Yr.INVALID_NUMBER_SKELETON, t); + } + return { + val: { + type: Dd.number, + tokens: n, + location: t, + parsedOptions: this.shouldParseSkeletons ? _8(n) : {} + }, + err: null + }; + }, r.prototype.tryParsePluralOrSelectOptions = function(e, t, n, i) { + for (var a, o = !1, s = [], l = /* @__PURE__ */ new Set(), u = i.value, c = i.location; ; ) { + if (u.length === 0) { + var h = this.clonePosition(); + if (t !== "select" && this.bumpIf("=")) { + var f = this.tryParseDecimalInteger(Yr.EXPECT_PLURAL_ARGUMENT_SELECTOR, Yr.INVALID_PLURAL_ARGUMENT_SELECTOR); + if (f.err) + return f; + c = Qr(h, this.clonePosition()), u = this.message.slice(h.offset, this.offset()); + } else + break; + } + if (l.has(u)) + return this.error(t === "select" ? Yr.DUPLICATE_SELECT_ARGUMENT_SELECTOR : Yr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, c); + u === "other" && (o = !0), this.bumpSpace(); + var v = this.clonePosition(); + if (!this.bumpIf("{")) + return this.error(t === "select" ? Yr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : Yr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, Qr(this.clonePosition(), this.clonePosition())); + var b = this.parseMessage(e + 1, t, n); + if (b.err) + return b; + var w = this.tryParseArgumentClose(v); + if (w.err) + return w; + s.push([ + u, + { + value: b.val, + location: Qr(v, this.clonePosition()) + } + ]), l.add(u), this.bumpSpace(), a = this.parseIdentifierIfPossible(), u = a.value, c = a.location; + } + return s.length === 0 ? this.error(t === "select" ? Yr.EXPECT_SELECT_ARGUMENT_SELECTOR : Yr.EXPECT_PLURAL_ARGUMENT_SELECTOR, Qr(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !o ? this.error(Yr.MISSING_OTHER_CLAUSE, Qr(this.clonePosition(), this.clonePosition())) : { val: s, err: null }; + }, r.prototype.tryParseDecimalInteger = function(e, t) { + var n = 1, i = this.clonePosition(); + this.bumpIf("+") || this.bumpIf("-") && (n = -1); + for (var a = !1, o = 0; !this.isEOF(); ) { + var s = this.char(); + if (s >= 48 && s <= 57) + a = !0, o = o * 10 + (s - 48), this.bump(); + else + break; + } + var l = Qr(i, this.clonePosition()); + return a ? (o *= n, k8(o) ? { val: o, err: null } : this.error(t, l)) : this.error(e, l); + }, r.prototype.offset = function() { + return this.position.offset; + }, r.prototype.isEOF = function() { + return this.offset() === this.message.length; + }, r.prototype.clonePosition = function() { + return { + offset: this.position.offset, + line: this.position.line, + column: this.position.column + }; + }, r.prototype.char = function() { + var e = this.position.offset; + if (e >= this.message.length) + throw Error("out of bound"); + var t = OB(this.message, e); + if (t === void 0) + throw Error("Offset ".concat(e, " is at invalid UTF-16 code unit boundary")); + return t; + }, r.prototype.error = function(e, t) { + return { + val: null, + err: { + kind: e, + message: this.message, + location: t + } + }; + }, r.prototype.bump = function() { + if (!this.isEOF()) { + var e = this.char(); + e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2); + } + }, r.prototype.bumpIf = function(e) { + if (TD(this.message, e, this.offset())) { + for (var t = 0; t < e.length; t++) + this.bump(); + return !0; + } + return !1; + }, r.prototype.bumpUntil = function(e) { + var t = this.offset(), n = this.message.indexOf(e, t); + return n >= 0 ? (this.bumpTo(n), !0) : (this.bumpTo(this.message.length), !1); + }, r.prototype.bumpTo = function(e) { + if (this.offset() > e) + throw Error("targetOffset ".concat(e, " must be greater than or equal to the current offset ").concat(this.offset())); + for (e = Math.min(e, this.message.length); ; ) { + var t = this.offset(); + if (t === e) + break; + if (t > e) + throw Error("targetOffset ".concat(e, " is at invalid UTF-16 code unit boundary")); + if (this.bump(), this.isEOF()) + break; + } + }, r.prototype.bumpSpace = function() { + for (; !this.isEOF() && PB(this.char()); ) + this.bump(); + }, r.prototype.peek = function() { + if (this.isEOF()) + return null; + var e = this.char(), t = this.offset(), n = this.message.charCodeAt(t + (e >= 65536 ? 2 : 1)); + return n != null ? n : null; + }, r; + }() +); +function qC(r) { + return r >= 97 && r <= 122 || r >= 65 && r <= 90; +} +function N8(r) { + return qC(r) || r === 47; +} +function z8(r) { + return r === 45 || r === 46 || r >= 48 && r <= 57 || r === 95 || r >= 97 && r <= 122 || r >= 65 && r <= 90 || r == 183 || r >= 192 && r <= 214 || r >= 216 && r <= 246 || r >= 248 && r <= 893 || r >= 895 && r <= 8191 || r >= 8204 && r <= 8205 || r >= 8255 && r <= 8256 || r >= 8304 && r <= 8591 || r >= 11264 && r <= 12271 || r >= 12289 && r <= 55295 || r >= 63744 && r <= 64975 || r >= 65008 && r <= 65533 || r >= 65536 && r <= 983039; +} +function PB(r) { + return r >= 9 && r <= 13 || r === 32 || r === 133 || r >= 8206 && r <= 8207 || r === 8232 || r === 8233; +} +function B8(r) { + return r >= 33 && r <= 35 || r === 36 || r >= 37 && r <= 39 || r === 40 || r === 41 || r === 42 || r === 43 || r === 44 || r === 45 || r >= 46 && r <= 47 || r >= 58 && r <= 59 || r >= 60 && r <= 62 || r >= 63 && r <= 64 || r === 91 || r === 92 || r === 93 || r === 94 || r === 96 || r === 123 || r === 124 || r === 125 || r === 126 || r === 161 || r >= 162 && r <= 165 || r === 166 || r === 167 || r === 169 || r === 171 || r === 172 || r === 174 || r === 176 || r === 177 || r === 182 || r === 187 || r === 191 || r === 215 || r === 247 || r >= 8208 && r <= 8213 || r >= 8214 && r <= 8215 || r === 8216 || r === 8217 || r === 8218 || r >= 8219 && r <= 8220 || r === 8221 || r === 8222 || r === 8223 || r >= 8224 && r <= 8231 || r >= 8240 && r <= 8248 || r === 8249 || r === 8250 || r >= 8251 && r <= 8254 || r >= 8257 && r <= 8259 || r === 8260 || r === 8261 || r === 8262 || r >= 8263 && r <= 8273 || r === 8274 || r === 8275 || r >= 8277 && r <= 8286 || r >= 8592 && r <= 8596 || r >= 8597 && r <= 8601 || r >= 8602 && r <= 8603 || r >= 8604 && r <= 8607 || r === 8608 || r >= 8609 && r <= 8610 || r === 8611 || r >= 8612 && r <= 8613 || r === 8614 || r >= 8615 && r <= 8621 || r === 8622 || r >= 8623 && r <= 8653 || r >= 8654 && r <= 8655 || r >= 8656 && r <= 8657 || r === 8658 || r === 8659 || r === 8660 || r >= 8661 && r <= 8691 || r >= 8692 && r <= 8959 || r >= 8960 && r <= 8967 || r === 8968 || r === 8969 || r === 8970 || r === 8971 || r >= 8972 && r <= 8991 || r >= 8992 && r <= 8993 || r >= 8994 && r <= 9e3 || r === 9001 || r === 9002 || r >= 9003 && r <= 9083 || r === 9084 || r >= 9085 && r <= 9114 || r >= 9115 && r <= 9139 || r >= 9140 && r <= 9179 || r >= 9180 && r <= 9185 || r >= 9186 && r <= 9254 || r >= 9255 && r <= 9279 || r >= 9280 && r <= 9290 || r >= 9291 && r <= 9311 || r >= 9472 && r <= 9654 || r === 9655 || r >= 9656 && r <= 9664 || r === 9665 || r >= 9666 && r <= 9719 || r >= 9720 && r <= 9727 || r >= 9728 && r <= 9838 || r === 9839 || r >= 9840 && r <= 10087 || r === 10088 || r === 10089 || r === 10090 || r === 10091 || r === 10092 || r === 10093 || r === 10094 || r === 10095 || r === 10096 || r === 10097 || r === 10098 || r === 10099 || r === 10100 || r === 10101 || r >= 10132 && r <= 10175 || r >= 10176 && r <= 10180 || r === 10181 || r === 10182 || r >= 10183 && r <= 10213 || r === 10214 || r === 10215 || r === 10216 || r === 10217 || r === 10218 || r === 10219 || r === 10220 || r === 10221 || r === 10222 || r === 10223 || r >= 10224 && r <= 10239 || r >= 10240 && r <= 10495 || r >= 10496 && r <= 10626 || r === 10627 || r === 10628 || r === 10629 || r === 10630 || r === 10631 || r === 10632 || r === 10633 || r === 10634 || r === 10635 || r === 10636 || r === 10637 || r === 10638 || r === 10639 || r === 10640 || r === 10641 || r === 10642 || r === 10643 || r === 10644 || r === 10645 || r === 10646 || r === 10647 || r === 10648 || r >= 10649 && r <= 10711 || r === 10712 || r === 10713 || r === 10714 || r === 10715 || r >= 10716 && r <= 10747 || r === 10748 || r === 10749 || r >= 10750 && r <= 11007 || r >= 11008 && r <= 11055 || r >= 11056 && r <= 11076 || r >= 11077 && r <= 11078 || r >= 11079 && r <= 11084 || r >= 11085 && r <= 11123 || r >= 11124 && r <= 11125 || r >= 11126 && r <= 11157 || r === 11158 || r >= 11159 && r <= 11263 || r >= 11776 && r <= 11777 || r === 11778 || r === 11779 || r === 11780 || r === 11781 || r >= 11782 && r <= 11784 || r === 11785 || r === 11786 || r === 11787 || r === 11788 || r === 11789 || r >= 11790 && r <= 11798 || r === 11799 || r >= 11800 && r <= 11801 || r === 11802 || r === 11803 || r === 11804 || r === 11805 || r >= 11806 && r <= 11807 || r === 11808 || r === 11809 || r === 11810 || r === 11811 || r === 11812 || r === 11813 || r === 11814 || r === 11815 || r === 11816 || r === 11817 || r >= 11818 && r <= 11822 || r === 11823 || r >= 11824 && r <= 11833 || r >= 11834 && r <= 11835 || r >= 11836 && r <= 11839 || r === 11840 || r === 11841 || r === 11842 || r >= 11843 && r <= 11855 || r >= 11856 && r <= 11857 || r === 11858 || r >= 11859 && r <= 11903 || r >= 12289 && r <= 12291 || r === 12296 || r === 12297 || r === 12298 || r === 12299 || r === 12300 || r === 12301 || r === 12302 || r === 12303 || r === 12304 || r === 12305 || r >= 12306 && r <= 12307 || r === 12308 || r === 12309 || r === 12310 || r === 12311 || r === 12312 || r === 12313 || r === 12314 || r === 12315 || r === 12316 || r === 12317 || r >= 12318 && r <= 12319 || r === 12320 || r === 12336 || r === 64830 || r === 64831 || r >= 65093 && r <= 65094; +} +function e1(r) { + r.forEach(function(e) { + if (delete e.location, CB(e) || TB(e)) + for (var t in e.options) + delete e.options[t].location, e1(e.options[t].value); + else + xB(e) && AB(e.style) || (SB(e) || wB(e)) && ZC(e.style) ? delete e.style.location : IB(e) && e1(e.children); + }); +} +function j8(r, e) { + e === void 0 && (e = {}), e = sr({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, e); + var t = new R8(r, e).parse(); + if (t.err) { + var n = SyntaxError(Yr[t.err.kind]); + throw n.location = t.err.location, n.originalMessage = t.err.message, n; + } + return e != null && e.captureLocation || e1(t.val), t.val; +} +function Qx(r, e) { + var t = e && e.cache ? e.cache : U8, n = e && e.serializer ? e.serializer : G8, i = e && e.strategy ? e.strategy : $8; + return i(r, { + cache: t, + serializer: n + }); +} +function F8(r) { + return r == null || typeof r == "number" || typeof r == "boolean"; +} +function RB(r, e, t, n) { + var i = F8(n) ? n : t(n), a = e.get(i); + return typeof a == "undefined" && (a = r.call(this, n), e.set(i, a)), a; +} +function NB(r, e, t) { + var n = Array.prototype.slice.call(arguments, 3), i = t(n), a = e.get(i); + return typeof a == "undefined" && (a = r.apply(this, n), e.set(i, a)), a; +} +function mI(r, e, t, n, i) { + return t.bind(e, r, n, i); +} +function $8(r, e) { + var t = r.length === 1 ? RB : NB; + return mI(r, this, t, e.cache.create(), e.serializer); +} +function H8(r, e) { + return mI(r, this, NB, e.cache.create(), e.serializer); +} +function V8(r, e) { + return mI(r, this, RB, e.cache.create(), e.serializer); +} +var G8 = function() { + return JSON.stringify(arguments); +}; +function yI() { + this.cache = /* @__PURE__ */ Object.create(null); +} +yI.prototype.get = function(r) { + return this.cache[r]; +}; +yI.prototype.set = function(r, e) { + this.cache[r] = e; +}; +var U8 = { + create: function() { + return new yI(); + } +}, qx = { + variadic: H8, + monadic: V8 +}, kd; +(function(r) { + r.MISSING_VALUE = "MISSING_VALUE", r.INVALID_VALUE = "INVALID_VALUE", r.MISSING_INTL_API = "MISSING_INTL_API"; +})(kd || (kd = {})); +var bb = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n, i) { + var a = r.call(this, t) || this; + return a.code = n, a.originalMessage = i, a; + } + return e.prototype.toString = function() { + return "[formatjs Error: ".concat(this.code, "] ").concat(this.message); + }, e; + }(Error) +), ED = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n, i, a) { + return r.call(this, 'Invalid values for "'.concat(t, '": "').concat(n, '". Options are "').concat(Object.keys(i).join('", "'), '"'), kd.INVALID_VALUE, a) || this; + } + return e; + }(bb) +), W8 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n, i) { + return r.call(this, 'Value for "'.concat(t, '" must be of type ').concat(n), kd.INVALID_VALUE, i) || this; + } + return e; + }(bb) +), Y8 = ( + /** @class */ + function(r) { + Ji(e, r); + function e(t, n) { + return r.call(this, 'The intl string context variable "'.concat(t, '" was not provided to the string "').concat(n, '"'), kd.MISSING_VALUE, n) || this; + } + return e; + }(bb) +), Ca; +(function(r) { + r[r.literal = 0] = "literal", r[r.object = 1] = "object"; +})(Ca || (Ca = {})); +function X8(r) { + return r.length < 2 ? r : r.reduce(function(e, t) { + var n = e[e.length - 1]; + return !n || n.type !== Ca.literal || t.type !== Ca.literal ? e.push(t) : n.value += t.value, e; + }, []); +} +function Z8(r) { + return typeof r == "function"; +} +function D0(r, e, t, n, i, a, o) { + if (r.length === 1 && xD(r[0])) + return [ + { + type: Ca.literal, + value: r[0].value + } + ]; + for (var s = [], l = 0, u = r; l < u.length; l++) { + var c = u[l]; + if (xD(c)) { + s.push({ + type: Ca.literal, + value: c.value + }); + continue; + } + if (h8(c)) { + typeof a == "number" && s.push({ + type: Ca.literal, + value: t.getNumberFormat(e).format(a) + }); + continue; + } + var h = c.value; + if (!(i && h in i)) + throw new Y8(h, o); + var f = i[h]; + if (c8(c)) { + (!f || typeof f == "string" || typeof f == "number") && (f = typeof f == "string" || typeof f == "number" ? String(f) : ""), s.push({ + type: typeof f == "string" ? Ca.literal : Ca.object, + value: f + }); + continue; + } + if (SB(c)) { + var v = typeof c.style == "string" ? n.date[c.style] : ZC(c.style) ? c.style.parsedOptions : void 0; + s.push({ + type: Ca.literal, + value: t.getDateTimeFormat(e, v).format(f) + }); + continue; + } + if (wB(c)) { + var v = typeof c.style == "string" ? n.time[c.style] : ZC(c.style) ? c.style.parsedOptions : n.time.medium; + s.push({ + type: Ca.literal, + value: t.getDateTimeFormat(e, v).format(f) + }); + continue; + } + if (xB(c)) { + var v = typeof c.style == "string" ? n.number[c.style] : AB(c.style) ? c.style.parsedOptions : void 0; + v && v.scale && (f = f * (v.scale || 1)), s.push({ + type: Ca.literal, + value: t.getNumberFormat(e, v).format(f) + }); + continue; + } + if (IB(c)) { + var b = c.children, w = c.value, p = i[w]; + if (!Z8(p)) + throw new W8(w, "function", o); + var d = D0(b, e, t, n, i, a), m = p(d.map(function(x) { + return x.value; + })); + Array.isArray(m) || (m = [m]), s.push.apply(s, m.map(function(x) { + return { + type: typeof x == "string" ? Ca.literal : Ca.object, + value: x + }; + })); + } + if (CB(c)) { + var _ = c.options[f] || c.options.other; + if (!_) + throw new ED(c.value, f, Object.keys(c.options), o); + s.push.apply(s, D0(_.value, e, t, n, i)); + continue; + } + if (TB(c)) { + var _ = c.options["=".concat(f)]; + if (!_) { + if (!Intl.PluralRules) + throw new bb(`Intl.PluralRules is not available in this environment. +Try polyfilling it using "@formatjs/intl-pluralrules" +`, kd.MISSING_INTL_API, o); + var y = t.getPluralRules(e, { type: c.pluralType }).select(f - (c.offset || 0)); + _ = c.options[y] || c.options.other; + } + if (!_) + throw new ED(c.value, f, Object.keys(c.options), o); + s.push.apply(s, D0(_.value, e, t, n, i, f - (c.offset || 0))); + continue; + } + } + return X8(s); +} +function J8(r, e) { + return e ? sr(sr(sr({}, r || {}), e || {}), Object.keys(r).reduce(function(t, n) { + return t[n] = sr(sr({}, r[n]), e[n] || {}), t; + }, {})) : r; +} +function K8(r, e) { + return e ? Object.keys(r).reduce(function(t, n) { + return t[n] = J8(r[n], e[n]), t; + }, sr({}, r)) : r; +} +function eS(r) { + return { + create: function() { + return { + get: function(e) { + return r[e]; + }, + set: function(e, t) { + r[e] = t; + } + }; + } + }; +} +function Q8(r) { + return r === void 0 && (r = { + number: {}, + dateTime: {}, + pluralRules: {} + }), { + getNumberFormat: Qx(function() { + for (var e, t = [], n = 0; n < arguments.length; n++) + t[n] = arguments[n]; + return new ((e = Intl.NumberFormat).bind.apply(e, eo([void 0], t, !1)))(); + }, { + cache: eS(r.number), + strategy: qx.variadic + }), + getDateTimeFormat: Qx(function() { + for (var e, t = [], n = 0; n < arguments.length; n++) + t[n] = arguments[n]; + return new ((e = Intl.DateTimeFormat).bind.apply(e, eo([void 0], t, !1)))(); + }, { + cache: eS(r.dateTime), + strategy: qx.variadic + }), + getPluralRules: Qx(function() { + for (var e, t = [], n = 0; n < arguments.length; n++) + t[n] = arguments[n]; + return new ((e = Intl.PluralRules).bind.apply(e, eo([void 0], t, !1)))(); + }, { + cache: eS(r.pluralRules), + strategy: qx.variadic + }) + }; +} +var q8 = ( + /** @class */ + function() { + function r(e, t, n, i) { + t === void 0 && (t = r.defaultLocale); + var a = this; + if (this.formatterCache = { + number: {}, + dateTime: {}, + pluralRules: {} + }, this.format = function(o) { + var s = a.formatToParts(o); + if (s.length === 1) + return s[0].value; + var l = s.reduce(function(u, c) { + return !u.length || c.type !== Ca.literal || typeof u[u.length - 1] != "string" ? u.push(c.value) : u[u.length - 1] += c.value, u; + }, []); + return l.length <= 1 ? l[0] || "" : l; + }, this.formatToParts = function(o) { + return D0(a.ast, a.locales, a.formatters, a.formats, o, void 0, a.message); + }, this.resolvedOptions = function() { + var o; + return { + locale: ((o = a.resolvedLocale) === null || o === void 0 ? void 0 : o.toString()) || Intl.NumberFormat.supportedLocalesOf(a.locales)[0] + }; + }, this.getAst = function() { + return a.ast; + }, this.locales = t, this.resolvedLocale = r.resolveLocale(t), typeof e == "string") { + if (this.message = e, !r.__parse) + throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`"); + this.ast = r.__parse(e, { + ignoreTag: i == null ? void 0 : i.ignoreTag, + locale: this.resolvedLocale + }); + } else + this.ast = e; + if (!Array.isArray(this.ast)) + throw new TypeError("A message must be provided as a String or AST."); + this.formats = K8(r.formats, n), this.formatters = i && i.formatters || Q8(this.formatterCache); + } + return Object.defineProperty(r, "defaultLocale", { + get: function() { + return r.memoizedDefaultLocale || (r.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), r.memoizedDefaultLocale; + }, + enumerable: !1, + configurable: !0 + }), r.memoizedDefaultLocale = null, r.resolveLocale = function(e) { + if (typeof Intl.Locale != "undefined") { + var t = Intl.NumberFormat.supportedLocalesOf(e); + return t.length > 0 ? new Intl.Locale(t[0]) : new Intl.Locale(typeof e == "string" ? e : e[0]); + } + }, r.__parse = j8, r.formats = { + number: { + integer: { + maximumFractionDigits: 0 + }, + currency: { + style: "currency" + }, + percent: { + style: "percent" + } + }, + date: { + short: { + month: "numeric", + day: "numeric", + year: "2-digit" + }, + medium: { + month: "short", + day: "numeric", + year: "numeric" + }, + long: { + month: "long", + day: "numeric", + year: "numeric" + }, + full: { + weekday: "long", + month: "long", + day: "numeric", + year: "numeric" + } + }, + time: { + short: { + hour: "numeric", + minute: "numeric" + }, + medium: { + hour: "numeric", + minute: "numeric", + second: "numeric" + }, + long: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + }, + full: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + } + } + }, r; + }() +), e6 = q8, o_ = "en", md = [o_]; +globalThis.navigator && (navigator.languages && navigator.languages.length > 0 ? md = eo([], navigator.languages, !0) : md = [navigator.language || navigator.userLanguage || o_]); +function t6(r) { + var e = r.trim(); + if (e) + try { + if (Intl.Locale) { + var t = new Intl.Locale(e), n = t.language, i = t.region; + return { locale: e, language: n, region: i }; + } + var a = e.split("-"), o = a.slice(1, 3).find(function(s) { + return s.length === 2; + }); + return { locale: e, language: a[0].toLowerCase(), region: o == null ? void 0 : o.toUpperCase() }; + } catch (s) { + yb.error("Parse locale:".concat(e, " failed."), s); + } +} +function t1(r) { + return r.map(t6).filter(function(e) { + return e; + }); +} +var _I = t1(md.includes(o_) ? md : eo(eo([], md, !0), [o_], !1)), zB = sr({ locales: md }, _I[0]); +function r6(r, e) { + for (var t = 0, n = _I; t < n.length; t++) { + var i = n[t], a = e(i); + if (a !== void 0) + return a; + } + return r; +} +function bI(r, e, t, n) { + var i = eo([], _I, !0), a = t1(n || []); + a.length > 0 && (i = eo(eo([], a, !0), i, !0)); + for (var o = t1((t != null ? t : "").split(",")).map(function(f) { + var v; + return f.language + ((v = f.region) !== null && v !== void 0 ? v : ""); + }).filter(function(f) { + return r[f + e] !== void 0; + }), s = eo(eo([], i.flatMap(function(f) { + var v = f.language, b = f.region; + return [ + b ? v + b : void 0, + v, + o.find(function(w) { + return w.startsWith(v); + }) + ]; + }).filter(function(f) { + return f && (!t || o.includes(f)); + }), !0), o, !0).map(function(f) { + return f + e; + }), l = 0, u = s; l < u.length; l++) { + var c = u[l], h = r[c]; + if (h !== void 0) + return { data: h, language: c.slice(0, 2) }; + } + throw new Error("Not found ".concat(s)); +} +var n6 = "@", i6 = Object.fromEntries(Object.entries(bI(u8, "").data).map(function(r) { + var e = r[0], t = r[1]; + return [ + n6 + e, + t + ]; +})), a6 = ( + /** @class */ + function() { + function r(e, t, n) { + var i = bI(e, "", t, n), a = $lodash.merge(e.en, i.data), o = i.language; + this.messages = Object.assign({}, a, i6), this.language = o, this.trans = this.trans.bind(this), this.transToNode = this.transToNode.bind(this); + } + return r.prototype.trans = function(e, t) { + return this.transToNode(e, t).toString(); + }, r.prototype.transToNode = function(e, t) { + var n = this.getMessage(e), i = new e6(n, zB.locale).format(t); + return Array.isArray(i) ? i.map(function(a, o) { + return _B.exports.jsx(gI.exports.Fragment, { children: a }, o); + }) : i; + }, r.prototype.getMessage = function(e) { + var t = this.messages[e]; + if (t !== void 0) + return t; + for (var n = this.messages, i = 0, a = e.split("."); i < a.length; i++) { + var o = a[i]; + n !== void 0 && (n = n[o]); + } + return n; + }, r; + }() +); +function o6(r, e) { + return bI(r, "Obj", e).data; +} +const s6 = { + chart: { + delete: "Delete", + data: "Data", + mode: "Mode", + config: "Configuration", + UIMode: "UI Mode", + chartType: "Chart type", + xAxis: "X-axis", + chartSeries: "Chart series", + customSeries: "Custom series", + add: "Add", + confirmDelete: "Confirm Delete: ", + seriesName: "Series Name", + dataColumns: "Data columns", + title: "Title", + xAxisDirection: "X axis direction", + xAxisName: "X axis name", + xAxisType: "X axis type", + xAxisTypeTooltip: "By default, it will be automatically detected according to X-axis data. For the type description, please refer to: ", + logBase: "LogBase", + yAxisName: "Y axis name", + yAxisType: "Y axis type", + yAxisDataFormat: "Y axis data type", + yAxisDataFormatTooltip: `Value indicates the value of each coordinate. Example: '{{value * 100 + "%"}}'`, + basicBar: "Basic bar", + stackedBar: "Stacked bar", + barType: "Bar chart type", + categoryAxis: "Category axis", + valueAxis: "Value axis", + timeAxis: "Time axis", + logAxis: "Log axis", + auto: "Default", + legendPosition: "Legend position", + basicLine: "Basic line", + stackedLine: "Stacked line", + areaLine: "Area line", + smooth: "Smooth curve", + lineType: "Line chart type", + basicPie: "Basic pie", + doughnutPie: "Doughnut pie", + rosePie: "Rose pie", + pieType: "Pie chart type", + spending: "Spending", + budget: "Budget", + bar: "Bar chart", + line: "Line chart", + scatter: "Scatter chart", + pie: "Pie chart", + horizontal: "Horizontal", + vertical: "Vertical", + noData: "No data", + unknown: "Unknown", + select: "Select", + unSelect: "Unselect", + echartsOptionLabel: "Option", + echartsOptionTooltip: "ECharts option", + echartsOptionExamples: "ECharts examples", + echartsMapOptionTooltip: "ECharts Map Option", + echartsMapOptionExamples: "ECharts Map Examples", + selectDesc: "Triggered when the user selects part of the data in the chart", + unselectDesc: "Triggered when the user unselects part of the data in the chart", + selectedPointsDesc: "Selected points", + dataDesc: "The raw data used in the current chart", + titleDesc: "Current chart title", + scatterShape: "Scatter shape", + circle: "Circle", + rect: "Rect", + triangle: "Triangle", + diamond: "Diamond", + pin: "Pin", + arrow: "Arrow", + pointColorLabel: "Point color", + pointColorTooltip: `Set the point color according to the series name and current point value, optional variables: seriesName, value. Example: '{{value < 25000 ? "red" : "green"}}'` + }, + imageEditor: { + defaultSrc: "", + save: "Save", + saveDesc: "Save image", + src: "Image source", + name: "Image name", + buttonText: "Button text", + srcDesc: "Image source", + nameDesc: "Image name", + dataURIDesc: "Image data URI", + dataDesc: "Image data", + buttonTextDesc: "Button text" + }, + calendar: { + events: "Events data", + editable: "Editable", + defaultDate: "Default date", + defaultDateTooltip: "The date that the calendar initially displays", + defaultView: "Default view", + defaultViewTooltip: "The view that the calendar initially displays", + showEventTime: "Show event times", + showEventTimeTooltip: "Whether to display the time text of the event", + showWeekends: "Show weekends", + showAllDay: "Show all-day", + showAllDayTooltip: "Whether to display the all-day slot in the week and day views", + dayMaxEvents: "Day max events", + dayMaxEventsTooltip: "The maximum number of events to display in the month view per day, with 0 being limited to the height of the cell", + eventMaxStack: "Event max stack", + eventMaxStackTooltip: "The maximum number of events to stack horizontally in the week and day views, with 0 being no limit", + selectInterval: "The interval selected on the calendar", + selectEvent: "Selected event", + changeSet: "The event object changed by dragging in the calendar, the key is the eventId, and the value is the event", + headerBtnBackground: "Button background", + btnText: "Button text", + title: "Title", + selectBackground: "Selected background", + today: "Today", + month: "Month", + week: "Week", + day: "Day", + list: "List", + monday: "Monday", + tuesday: "Tuesday", + wednesday: "Wednesday", + thursday: "Thursday", + friday: "Friday", + saturday: "Saturday", + sunday: "Sunday", + startWeek: "Start from", + creatEvent: "Create event", + editEvent: "Edit event", + eventName: "Event name", + eventColor: "Event color", + eventGroupId: "Group ID", + groupIdTooltip: "Group ID is used to group different events, and events in the same group can be dragged and resized together.", + more: "more", + allDay: "All day", + eventNameRequire: "Please enter Event name", + eventId: "Event ID", + eventIdRequire: "Please enter Event ID", + eventIdTooltip: "Unique ID for each event", + eventIdExist: "ID already exists" + } +}, l6 = { + chart: { + delete: "删除", + data: "数据", + mode: "模式", + config: "配置", + UIMode: "UI模式", + chartType: "图表类型", + xAxis: "X轴", + chartSeries: "图表系列", + customSeries: "自定义系列", + add: "添加", + confirmDelete: "确认删除:", + seriesName: "系列名称", + dataColumns: "数据列", + title: "标题", + xAxisDirection: "X轴方向", + xAxisName: "X轴名称", + xAxisType: "X轴类型", + xAxisTypeTooltip: "默认情况下,根据X轴数据自动检测.有关类型描述,请参考:", + logBase: "对数底数", + yAxisName: "Y轴名称", + yAxisType: "Y轴类型", + yAxisDataFormat: "Y轴数据格式", + yAxisDataFormatTooltip: `值表示每个坐标的值.示例:'{{value * 100 + "%"}}'`, + basicBar: "基本柱状图", + stackedBar: "堆叠柱状图", + barType: "柱状图类型", + categoryAxis: "分类轴", + valueAxis: "值轴", + timeAxis: "时间轴", + logAxis: "对数轴", + auto: "自动", + legendPosition: "图例位置", + basicLine: "基本折线图", + stackedLine: "堆叠折线图", + areaLine: "区域折线图", + smooth: "平滑曲线", + lineType: "折线图类型", + basicPie: "基本饼图", + doughnutPie: "环形饼图", + rosePie: "玫瑰饼图", + pieType: "饼图类型", + spending: "支出", + budget: "预算", + bar: "柱状图", + line: "折线图", + scatter: "散点图", + pie: "饼图", + horizontal: "水平", + vertical: "垂直", + noData: "无数据", + unknown: "未知", + select: "选择", + unSelect: "取消选择", + echartsOptionLabel: "选项", + echartsOptionTooltip: "ECharts选项", + echartsOptionExamples: "ECharts示例", + echartsMapOptionTooltip: "ECharts地图选项", + echartsMapOptionExamples: "ECharts地图示例", + selectDesc: "当用户选择图表中的部分数据时触发", + unselectDesc: "当用户取消选择图表中的部分数据时触发", + selectedPointsDesc: "已选中的数据点", + dataDesc: "当前图表使用的原始数据", + titleDesc: "当前图表标题", + scatterShape: "散点形状", + circle: "圆形", + rect: "矩形", + triangle: "三角形", + diamond: "菱形", + pin: "图钉", + arrow: "箭头", + pointColorLabel: "数据点颜色", + pointColorTooltip: `根据系列名称和当前数据点值设置数据点颜色,可选变量:seriesName、value.示例:'{{value < 25000 ? "red" : "green"}}'` + }, + imageEditor: { + defaultSrc: "", + save: "保存", + saveDesc: "保存图像", + src: "图像来源", + name: "图像名称", + buttonText: "按钮文本", + srcDesc: "图像来源", + nameDesc: "图像名称", + dataURIDesc: "图像数据URI", + dataDesc: "图像数据", + buttonTextDesc: "按钮文本" + }, + calendar: { + events: "事件数据", + editable: "可编辑", + defaultDate: "默认日期", + defaultDateTooltip: "日历最初显示的日期", + defaultView: "默认视图", + defaultViewTooltip: "日历最初显示的视图", + showEventTime: "显示事件时间", + showEventTimeTooltip: "是否显示事件的时间文本", + showWeekends: "显示周末", + showAllDay: "显示全天", + showAllDayTooltip: "是否在周视图和日视图中显示全天时间段", + dayMaxEvents: "每日最多事件数", + dayMaxEventsTooltip: "在月视图中每天显示的事件最大数量,为0表示限制为单元格的高度", + eventMaxStack: "事件最大堆叠数", + eventMaxStackTooltip: "在周视图和日视图中水平堆叠的事件的最大数量,为0表示没有限制", + selectInterval: "日历上选择的时间间隔", + selectEvent: "已选事件", + changeSet: "拖动日历中更改的事件对象,键为eventId,值为事件对象", + headerBtnBackground: "按钮背景", + btnText: "按钮文本", + title: "标题", + selectBackground: "选择背景", + today: "今天", + month: "月", + week: "周", + day: "日", + list: "列表", + monday: "星期一", + tuesday: "星期二", + wednesday: "星期三", + thursday: "星期四", + friday: "星期五", + saturday: "星期六", + sunday: "星期日", + startWeek: "起始星期", + creatEvent: "创建事件", + editEvent: "编辑事件", + eventName: "事件名称", + eventColor: "事件颜色", + eventGroupId: "分组ID", + groupIdTooltip: "分组ID用于将不同的事件分组,同一组内的事件可以一起拖动和调整大小.", + more: "更多", + allDay: "全天", + eventNameRequire: "请输入事件名称", + eventId: "事件ID", + eventIdRequire: "请输入事件ID", + eventIdTooltip: "每个事件的唯一标识符", + eventIdExist: "ID已存在" + } +}, u6 = { + tooltip: { + trigger: "item" + }, + animation: !0, + series: [{ + name: "Population", + type: "scatter", + coordinateSystem: "gmap", + itemStyle: { + color: "#00c1de" + }, + data: [{ + name: "Azerbaijan", + value: [47.395, 40.43, 8352021] + }, { + name: "Albania", + value: [20.068, 41.143, 3153731] + }, { + name: "Armenia", + value: [44.563, 40.534, 3017661] + }, { + name: "Bosnia and Herzegovina", + value: [17.786, 44.169, 3915238] + }, { + name: "Bulgaria", + value: [25.231, 42.761, 7744591] + }, { + name: "Cyprus", + value: [33.219, 35.043, 836321] + }, { + name: "Denmark", + value: [9.264, 56.058, 5416945] + }, { + name: "Ireland", + value: [-8.152, 53.177, 4143294] + }, { + name: "Estonia", + value: [25.793, 58.674, 1344312] + }, { + name: "Austria", + value: [14.912, 47.683, 8291979] + }, { + name: "Czech Republic", + value: [15.338, 49.743, 10191762] + }, { + name: "Finland", + value: [26.272, 64.504, 5246004] + }, { + name: "France", + value: [2.55, 46.565, 60990544] + }, { + name: "Georgia", + value: [43.518, 42.176, 4473409] + }, { + name: "Germany", + value: [9.851, 51.11, 82652369] + }, { + name: "Greece", + value: [21.766, 39.666, 11099737] + }, { + name: "Croatia", + value: [16.693, 45.723, 455149] + }, { + name: "Hungary", + value: [19.134, 47.07, 10086387] + }, { + name: "Iceland", + value: [-18.48, 64.764, 295732] + }, { + name: "Israel", + value: [34.851, 31.026, 6692037] + }, { + name: "Italy", + value: [12.8, 42.7, 5864636] + }, { + name: "Latvia", + value: [25.641, 56.858, 2301793] + }, { + name: "Belarus", + value: [28.047, 53.54, 9795287] + }, { + name: "Lithuania", + value: [23.897, 55.336, 3425077] + }, { + name: "Slovakia", + value: [19.491, 48.707, 5386995] + }, { + name: "Liechtenstein", + value: [9.555, 47.153, 34598] + }, { + name: "The former Yugoslav Republic of Macedonia", + value: [21.698, 41.6, 2033655] + }, { + name: "Malta", + value: [14.442, 35.89, 402617] + }, { + name: "Belgium", + value: [4.664, 50.643, 10398049] + }, { + name: "Faroe Islands", + value: [-6.864, 62.05, 48205] + }, { + name: "Andorra", + value: [1.576, 42.549, 73483] + }, { + name: "Luxembourg", + value: [6.088, 49.771, 456613] + }, { + name: "Monaco", + value: [7.412, 43.75, 325] + }, { + name: "Montenegro", + value: [19.254, 42.792, 607969] + }, { + name: "Netherlands", + value: [5.389, 52.077, 1632769] + }, { + name: "Norway", + value: [8.74, 61.152, 4638836] + }, { + name: "Poland", + value: [19.401, 52.125, 38195558] + }, { + name: "Portugal", + value: [-8.058, 40.309, 10528226] + }, { + name: "Romania", + value: [24.969, 45.844, 21627557] + }, { + name: "Republic of Moldova", + value: [28.599, 47.193, 3876661] + }, { + name: "Slovenia", + value: [14.827, 46.124, 1999425] + }, { + name: "Spain", + value: [-3.649, 40.227, 43397491] + }, { + name: "Sweden", + value: [15.27, 62.011, 9038049] + }, { + name: "Switzerland", + value: [7.908, 46.861, 7424389] + }, { + name: "Turkey", + value: [35.179, 39.061, 72969723] + }, { + name: "United Kingdom", + value: [-1.6, 53, 60244834] + }, { + name: "Ukraine", + value: [31.388, 49.016, 46917544] + }, { + name: "San Marino", + value: [12.46, 43.942, 30214] + }, { + name: "Serbia", + value: [20.806, 44.032, 9863026] + }, { + name: "Holy See (Vatican City)", + value: [12.451, 41.904, 783] + }, { + name: "Russia", + value: [96.689, 61.988, 143953092] + }], + encode: { + value: 2, + lng: 0, + lat: 1 + } + }] +}, c6 = { + defaultDataSource: [{ + date: "2021-09", + department: "Administration", + spending: 9003, + budget: 8e3 + }, { + date: "2021-09", + department: "Finance", + spending: 3033, + budget: 4e3 + }, { + date: "2021-09", + department: "Sales", + spending: 9230, + budget: 8e3 + }, { + date: "2021-10", + department: "Administration", + spending: 13032, + budget: 15e3 + }, { + date: "2021-10", + department: "Finance", + spending: 2300, + budget: 5e3 + }, { + date: "2021-10", + department: "Sales", + spending: 7323.5, + budget: 8e3 + }, { + date: "2021-11", + department: "Administration", + spending: 13e3, + budget: 16023 + }, { + date: "2021-11", + department: "Finance", + spending: 3569.5, + budget: 3e3 + }, { + date: "2021-11", + department: "Sales", + spending: 1e4, + budget: 9932 + }, { + date: "2021-12", + department: "Administration", + spending: 18033, + budget: 2e4 + }, { + date: "2021-12", + department: "Finance", + spending: 4890, + budget: 4500 + }, { + date: "2021-12", + department: "Sales", + spending: 9322, + budget: 8e3 + }], + defaultEchartsJsonOption: { + title: { + text: "Funnel Chart", + left: "center" + }, + backgroundColor: "#ffffff", + color: $lowcoder_sdk.chartColorPalette, + tooltip: { + trigger: "item", + formatter: "{a}
{b} : {c}%" + }, + legend: { + data: ["Show", "Click", "Visit", "Query", "Buy"], + top: "bottom" + }, + series: [{ + name: "Funnel", + type: "funnel", + left: "10%", + top: 60, + bottom: 60, + width: "80%", + min: 0, + max: 100, + gap: 2, + label: { + show: !0, + position: "inside" + }, + data: [{ + value: 100, + name: "Show" + }, { + value: 80, + name: "Click" + }, { + value: 60, + name: "Visit" + }, { + value: 40, + name: "Query" + }, { + value: 20, + name: "Buy" + }] + }] + }, + defaultMapJsonOption: u6 +}, h6 = void 0, BB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + en: s6, + enObj: c6, + zh: l6, + zhObj: h6 +}, Symbol.toStringTag, { value: "Module" })), { + trans: Ye, + language: jB +} = new a6(BB, ""), Vg = o6(BB, ""); +function f6() { + return r6("EN", (r) => { + switch (r.language) { + case "en": + return "EN"; + case "zh": + return "ZH"; + } + }); +} +function d6() { + switch (jB) { + case "zh": + return "zh-cn"; + default: + return "en-gb"; + } +} +const FB = jB === "zh" ? "zh" : "en", $B = `https://echarts.apache.org/${FB}/option.html`, v6 = `https://echarts.apache.org/examples/${FB}/index.html`, p6 = `${$B}#xAxis.type`, MD = "https://maps.googleapis.com/maps/api/js?v=3.exp", g6 = "https://github.com/plainheart/echarts-extension-gmap", m6 = "https://codepen.io/plainheart/pen/VweLGbR"; +var y6 = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}; +function xI(r) { + return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; +} +var HB = { exports: {} }, Gg = {}; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var DD = Object.getOwnPropertySymbols, _6 = Object.prototype.hasOwnProperty, b6 = Object.prototype.propertyIsEnumerable; +function x6(r) { + if (r == null) + throw new TypeError("Object.assign cannot be called with null or undefined"); + return Object(r); +} +function S6() { + try { + if (!Object.assign) + return !1; + var r = new String("abc"); + if (r[5] = "de", Object.getOwnPropertyNames(r)[0] === "5") + return !1; + for (var e = {}, t = 0; t < 10; t++) + e["_" + String.fromCharCode(t)] = t; + var n = Object.getOwnPropertyNames(e).map(function(a) { + return e[a]; + }); + if (n.join("") !== "0123456789") + return !1; + var i = {}; + return "abcdefghijklmnopqrst".split("").forEach(function(a) { + i[a] = a; + }), Object.keys(Object.assign({}, i)).join("") === "abcdefghijklmnopqrst"; + } catch (a) { + return !1; + } +} +S6(); +const w6 = $react; +/** @license React v17.0.2 + * react-jsx-runtime.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +var C6 = w6, VB = 60103; +Gg.Fragment = 60107; +if (typeof Symbol == "function" && Symbol.for) { + var kD = Symbol.for; + VB = kD("react.element"), Gg.Fragment = kD("react.fragment"); +} +var T6 = C6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, I6 = Object.prototype.hasOwnProperty, A6 = { key: !0, ref: !0, __self: !0, __source: !0 }; +function GB(r, e, t) { + var n, i = {}, a = null, o = null; + t !== void 0 && (a = "" + t), e.key !== void 0 && (a = "" + e.key), e.ref !== void 0 && (o = e.ref); + for (n in e) + I6.call(e, n) && !A6.hasOwnProperty(n) && (i[n] = e[n]); + if (r && r.defaultProps) + for (n in e = r.defaultProps, e) + i[n] === void 0 && (i[n] = e[n]); + return { $$typeof: VB, type: r, key: a, ref: o, props: i, _owner: T6.current }; +} +Gg.jsx = GB; +Gg.jsxs = GB; +HB.exports = Gg; +var SI = HB.exports; +const Ni = SI.Fragment, Bt = SI.jsx, Rn = SI.jsxs, E6 = [{ + label: Ye("chart.auto"), + value: "default" +}, { + label: Ye("chart.categoryAxis"), + value: "category" +}, { + label: Ye("chart.valueAxis"), + value: "value" +}, { + label: Ye("chart.timeAxis"), + value: "time" +}, { + label: Ye("chart.logAxis"), + value: "log" +}], M6 = [{ + label: Ye("chart.valueAxis"), + value: "value" +}, { + label: Ye("chart.categoryAxis"), + value: "category" +}, { + label: Ye("chart.timeAxis"), + value: "time" +}, { + label: Ye("chart.logAxis"), + value: "log" +}], UB = { + axisName: $lowcoder_sdk.StringControl, + logBase: $lowcoder_sdk.NumberControl +}, WB = $lowcoder_sdk.withContext(new $lowcoder_sdk.MultiCompBuilder({ + value: $lowcoder_sdk.StringControl +}, (r) => r.value).setPropertyViewFn((r) => r.value.propertyView({ + label: Ye("chart.yAxisDataFormat"), + placeholder: "{{value}}", + tooltip: Ye("chart.yAxisDataFormatTooltip") +})).build(), ["value"]), D6 = function() { + return new $lowcoder_sdk.MultiCompBuilder(Za(sn({}, UB), { + type: $lowcoder_sdk.dropdownControl(E6, "default") + }), (r) => { + const e = { + name: r.axisName, + nameGap: 22, + // @ts-ignore + nameLocation: "middle" + }; + return r.type !== "default" && (e.type = r.type), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [r.axisName.propertyView({ + label: Ye("chart.xAxisName") + }), r.type.propertyView({ + label: Ye("chart.xAxisType"), + tooltip: /* @__PURE__ */ Rn(Ni, { + children: [Ye("chart.xAxisTypeTooltip"), /* @__PURE__ */ Bt("a", { + href: p6, + target: "_blank", + rel: "noreferrer", + children: Ye("chart.xAxisType") + })] + }) + }), r.type.getView() === "log" && r.logBase.propertyView({ + label: Ye("chart.logBase") + })] + })).build(); +}(), k6 = function() { + return new $lowcoder_sdk.MultiCompBuilder(Za(sn({}, UB), { + // the old data has "type" field with default value "category". change field name to "yAxisType" for compatibility + yAxisType: $lowcoder_sdk.dropdownControl(M6, "value"), + formatter: WB + }), (r) => () => { + const e = { + name: r.axisName, + type: r.yAxisType, + nameTextStyle: { + align: "left" + } + }, t = new Intl.NumberFormat(zB.locales, { + notation: "compact" + }); + return e.axisLabel = { + formatter: (n) => { + const i = r.formatter({ + value: n + }); + return !$lodash.isNil(i) && i !== "" ? i : (r.yAxisType === "value" || r.yAxisType === "log") && typeof n == "number" ? t.format(n) : n + ""; + } + }, r.yAxisType === "log" && (e.logBase = r.logBase || 10), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [r.axisName.propertyView({ + label: Ye("chart.yAxisName") + }), r.yAxisType.propertyView({ + label: Ye("chart.yAxisType") + }), r.yAxisType.getView() === "log" && r.logBase.propertyView({ + label: Ye("chart.logBase") + }), r.formatter.getPropertyView()] + })).build(); +}(); +function O6(r) { + if (!r || r.length <= 0) + return "category"; + const e = r[0]; + return e ? $lowcoder_sdk.isNumeric(e) ? "value" : isNaN(new Date(e.toString()).getDate()) ? "category" : "time" : "category"; +} +const tS = { + year: 3600 * 24 * 1e3 * 365, + month: 3600 * 24 * 1e3 * 28, + day: 3600 * 24 * 1e3 +}; +function L6(r) { + const e = r.map((t) => { + if (!t) + return 1; + const n = t.toString().length; + return n === 4 ? tS.year : n === 6 || n === 7 ? tS.month : n === 10 || n === 8 ? tS.day : 1; + }); + return $lodash.min(e); +} +let OD; +function P6(r) { + const t = (OD || (OD = document.createElement("canvas"))).getContext("2d"); + return t ? (t.font = "normal 12px sans-serif", r.map((n) => n ? t.measureText(n.toString()).width + 2 : 0)) : []; +} +function R6(r, e, t, n, i) { + const a = sn({}, r), o = sn({}, e); + if (a.type || (a.type = O6(n)), a.type === "category" && i) { + const s = P6(n), l = $lodash.max(s), u = s[s.length - 1]; + let c = i.w / n.length, h = 0, f = l; + if (l && c < l && t === "horizontal") { + f = Math.min(l, 150); + const v = u && u * 0.87 > c / 2 + i.right; + h = v ? 270 : 330, a.nameGap = v ? f + 5 : f / 2 + 10; + } else + t === "vertical" && l && (a.nameGap = l + 10); + a.axisLabel = { + interval: 0, + width: f, + // @ts-ignore + overflow: "truncate", + rotate: h + }; + } else if (a.type === "time") { + a.minInterval = L6(n); + const s = Vg.timeXAxisLabel; + s && (a.axisLabel = s); + } + return t === "vertical" && (o.nameLocation = "middle", o.nameGap = 25), t === "horizontal" ? { + xConfig: a, + yConfig: o + } : { + xConfig: o, + yConfig: a + }; +} +const N6 = [{ + label: Ye("chart.basicBar"), + value: "basicBar" +}, { + label: Ye("chart.stackedBar"), + value: "stackedBar" +}], z6 = function() { + return new $lowcoder_sdk.MultiCompBuilder({ + showLabel: $lowcoder_sdk.BoolControl, + type: $lowcoder_sdk.dropdownControl(N6, "basicBar") + }, (r) => { + const e = { + type: "bar", + label: { + show: r.showLabel, + position: "top" + } + }; + return r.type === "stackedBar" && (e.stack = "stackValue"), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [$lowcoder_sdk.showLabelPropertyView(r), r.type.propertyView({ + label: Ye("chart.barType"), + radioButton: !0 + })] + })).build(); +}(), B6 = [{ + label: /* @__PURE__ */ Bt($lowcoder_sdk.AlignBottom, {}), + value: "bottom" +}, { + label: /* @__PURE__ */ Bt($lowcoder_sdk.AlignRight, {}), + value: "right" +}, { + label: /* @__PURE__ */ Bt($lowcoder_sdk.AlignClose, {}), + value: "close" +}], j6 = function() { + return new $lowcoder_sdk.MultiCompBuilder({ + position: $lowcoder_sdk.dropdownControl(B6, "bottom") + }, (r) => { + const e = { + top: "bottom", + type: "scroll" + }; + return r.position === "right" ? (e.top = "center", e.left = "right", e.orient = "vertical") : r.position === "close" && (e.show = !1), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Bt(Ni, { + children: r.position.propertyView({ + label: Ye("chart.legendPosition"), + radioButton: !0 + }) + })).build(); +}(), F6 = [{ + label: Ye("chart.basicLine"), + value: "basicLine" +}, { + label: Ye("chart.stackedLine"), + value: "stackedLine" +}, { + label: Ye("chart.areaLine"), + value: "areaLine" +}], YB = $lowcoder_sdk.withContext(new $lowcoder_sdk.MultiCompBuilder({ + value: $lowcoder_sdk.ColorOrBoolCodeControl +}, (r) => r.value).setPropertyViewFn((r) => r.value.propertyView({ + label: Ye("chart.pointColorLabel"), + placeholder: "{{value < 25000}}", + tooltip: Ye("chart.pointColorTooltip") +})).build(), ["seriesName", "value"]), $6 = function() { + return new $lowcoder_sdk.MultiCompBuilder({ + showLabel: $lowcoder_sdk.BoolControl, + type: $lowcoder_sdk.dropdownControl(F6, "basicLine"), + smooth: $lowcoder_sdk.BoolControl, + itemColor: YB + }, (r) => { + const e = { + type: "line", + label: { + show: r.showLabel + }, + itemStyle: { + color: (t) => { + if (!t.encode || !t.dimensionNames) + return t.color; + const n = t.dimensionNames[t.encode.y[0]], i = r.itemColor({ + seriesName: t.seriesName, + value: t.data[n] + }); + return i === "true" ? "red" : i === "false" || !i ? t.color : i; + } + } + }; + return r.type === "stackedLine" ? e.stack = "stackValue" : r.type === "areaLine" && (e.areaStyle = {}), r.smooth && (e.smooth = !0), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [r.type.propertyView({ + label: Ye("chart.lineType") + }), $lowcoder_sdk.showLabelPropertyView(r), r.smooth.propertyView({ + label: Ye("chart.smooth") + }), r.itemColor.getPropertyView()] + })).build(); +}(), H6 = [{ + label: Ye("chart.basicPie"), + value: "basicPie" +}, { + label: Ye("chart.doughnutPie"), + value: "doughnutPie" +}, { + label: Ye("chart.rosePie"), + value: "rosePie" +}], LD = [65, 35, 20], V6 = function() { + return new $lowcoder_sdk.MultiCompBuilder({ + type: $lowcoder_sdk.dropdownControl(H6, "basicPie") + }, (r) => { + const e = { + type: "pie", + label: { + show: !0, + formatter: "{d}%" + } + }; + return r.type === "rosePie" ? e.roseType = "area" : r.type === "doughnutPie" && (e.radius = ["40%", "60%"]), e; + }).setPropertyViewFn((r) => /* @__PURE__ */ Bt(Ni, { + children: r.type.propertyView({ + label: Ye("chart.pieType") + }) + })).build(); +}(); +function G6(r, e, t) { + const n = Math.min(r, LD.length), i = LD[n - 1], o = Array.isArray(t.radius) ? [(i / 1.6).toFixed(2) + "%", i + "%"] : i + "%", s = 100 / n, l = (s * (e % n) + s / 2).toFixed(2) + "%", u = Math.floor(e / n) + 1, c = (100 / Math.floor((n * 2 + r - 1) / n) * u).toFixed(2) + "%"; + return { + radius: o, + center: [l, c] + }; +} +const U6 = [{ + label: Ye("chart.circle"), + value: "circle" +}, { + label: Ye("chart.rect"), + value: "rect" +}, { + label: Ye("chart.triangle"), + value: "triangle" +}, { + label: Ye("chart.diamond"), + value: "diamond" +}, { + label: Ye("chart.pin"), + value: "pin" +}, { + label: Ye("chart.arrow"), + value: "arrow" +}], W6 = function() { + return new $lowcoder_sdk.MultiCompBuilder({ + showLabel: $lowcoder_sdk.BoolControl, + shape: $lowcoder_sdk.dropdownControl(U6, "circle") + }, (r) => ({ + type: "scatter", + symbol: r.shape, + label: { + show: r.showLabel + } + })).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [$lowcoder_sdk.showLabelPropertyView(r), r.shape.propertyView({ + label: Ye("chart.scatterShape") + })] + })).build(); +}(); +function XB(r, e) { + return { + seriesName: r, + columnName: e, + dataIndex: $lowcoder_sdk.genRandomKey() + }; +} +const Y6 = { + columnName: $lowcoder_sdk.StringControl, + seriesName: $lowcoder_sdk.StringControl, + hide: $lowcoder_sdk.BoolControl, + // unique key, for sort + dataIndex: $lowcoder_sdk.valueComp("") +}, X6 = new $lowcoder_sdk.MultiCompBuilder(Y6, (r) => r).setPropertyViewFn(() => /* @__PURE__ */ Bt(Ni, {})).build(); +class Z6 extends X6 { + getPropertyViewWithData(e) { + return /* @__PURE__ */ Rn(Ni, { + children: [this.children.seriesName.propertyView({ + label: Ye("chart.seriesName") + }), /* @__PURE__ */ Bt($lowcoder_sdk.Dropdown, { + value: this.children.columnName.getView(), + options: e, + label: Ye("chart.dataColumns"), + onChange: (t) => { + this.children.columnName.dispatchChangeValueAction(t); + } + })] + }); + } +} +const J6 = $lowcoder_sdk.list(Z6); +class K6 extends J6 { + reduce(e) { + if (Q9(e, "chartDataChanged")) { + const t = this.genExampleSeriesActions(e.value.chartData); + return this.reduce(this.multiAction(t)); + } + return super.reduce(e); + } + genExampleSeriesActions(e) { + const t = []; + if (!e || e.length <= 0 || !e[0]) + return t; + let n = 0; + const i = this.getView().map((o) => o.getView().columnName); + return i.forEach((o) => { + var s; + ((s = e[0]) == null ? void 0 : s[o]) === void 0 && (t.push(this.deleteAction(0)), n++); + }), i.length > n || Object.keys(e[0]).filter((o) => !i.includes(o) && $lowcoder_sdk.isNumeric(e[0][o])).slice(0, 3).forEach((o) => t.push(this.pushAction(XB(o, o)))), t; + } + dispatchDataChanged(e) { + this.dispatch(K9({ + type: "chartDataChanged", + chartData: e + })); + } +} +const Q6 = [{ + label: Ye("chart.bar"), + value: "bar" +}, { + label: Ye("chart.line"), + value: "line" +}, { + label: Ye("chart.scatter"), + value: "scatter" +}, { + label: Ye("chart.pie"), + value: "pie" +}], q6 = [{ + label: Ye("chart.UIMode"), + value: "ui" +}, { + label: "ECharts JSON", + value: "json" +}, { + label: "Map", + value: "map" +}], eY = [{ + label: Ye("chart.select"), + value: "select", + description: Ye("chart.selectDesc") +}, { + label: Ye("chart.unSelect"), + value: "unselect", + description: Ye("chart.unselectDesc") +}], tY = [{ + label: Ye("chart.horizontal"), + value: "horizontal" +}, { + label: Ye("chart.vertical"), + value: "vertical" +}], rY = { + animation: !1, + xAxis: { + type: "category", + name: Ye("chart.noData"), + nameLocation: "middle", + data: [], + axisLine: { + lineStyle: { + color: "#8B8FA3" + } + } + }, + yAxis: { + type: "value", + axisLabel: { + color: "#8B8FA3" + }, + splitLine: { + lineStyle: { + color: "#F0F0F0" + } + } + }, + tooltip: { + show: !1 + }, + series: [{ + data: [700], + type: "line", + itemStyle: { + opacity: 0 + } + }] +}, nY = { + animation: !1, + tooltip: { + show: !1 + }, + legend: { + formatter: Ye("chart.unknown"), + top: "bottom", + selectedMode: !1 + }, + color: ["#B8BBCC", "#CED0D9", "#DCDEE6", "#E6E6EB"], + series: [{ + type: "pie", + radius: "35%", + center: ["25%", "50%"], + silent: !0, + label: { + show: !1 + }, + data: [{ + name: "1", + value: 70 + }, { + name: "2", + value: 68 + }, { + name: "3", + value: 48 + }, { + name: "4", + value: 40 + }] + }, { + type: "pie", + radius: "35%", + center: ["75%", "50%"], + silent: !0, + label: { + show: !1 + }, + data: [{ + name: "1", + value: 70 + }, { + name: "2", + value: 68 + }, { + name: "3", + value: 48 + }, { + name: "4", + value: 40 + }] + }] +}, ZB = (r) => { + if (!r) + return []; + const e = []; + return r.slice(0, 50).forEach((t) => { + Object.keys(t).forEach((n) => { + e.includes(n) || e.push(n); + }); + }), e; +}, iY = { + bar: z6, + line: $6, + pie: V6, + scatter: W6 +}, aY = $lowcoder_sdk.withType(iY, "bar"), oY = { + title: $lowcoder_sdk.StringControl, + data: $lowcoder_sdk.jsonControl($lowcoder_sdk.toJSONObjectArray, Vg.defaultDataSource), + xAxisKey: $lowcoder_sdk.valueComp(""), + // x-axis, key from data + xAxisDirection: $lowcoder_sdk.dropdownControl(tY, "horizontal"), + series: K6, + xConfig: D6, + yConfig: k6, + legendConfig: j6, + onEvent: $lowcoder_sdk.eventHandlerControl(eY), + chartConfig: aY +}, sY = { + mapInstance: $lowcoder_sdk.stateComp(), + getMapInstance: $lowcoder_sdk.FunctionControl, + mapApiKey: $lowcoder_sdk.withDefault($lowcoder_sdk.StringControl, ""), + mapZoomLevel: $lowcoder_sdk.withDefault($lowcoder_sdk.NumberControl, 3), + mapCenterLng: $lowcoder_sdk.withDefault($lowcoder_sdk.NumberControl, 15.932644), + mapCenterLat: $lowcoder_sdk.withDefault($lowcoder_sdk.NumberControl, 50.942063), + mapOptions: $lowcoder_sdk.jsonControl($lowcoder_sdk.toObject, Vg.defaultMapJsonOption) +}, JB = sn(sn({ + mode: $lowcoder_sdk.dropdownControl(q6, "ui"), + echartsOption: $lowcoder_sdk.jsonControl($lowcoder_sdk.toObject, Vg.defaultEchartsJsonOption), + selectedPoints: $lowcoder_sdk.stateComp([]) +}, oY), sY); +$lowcoder_sdk.uiChildren(JB); +function lY(r, e) { + const t = r.series.getView(), n = ZB(r.data.getView()).map((l) => ({ + label: l, + value: l + })), i = /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: Ye("chart.data"), + children: [r.data.propertyView({ + label: Ye("chart.data") + }), /* @__PURE__ */ Bt($lowcoder_sdk.Dropdown, { + value: r.chartConfig.children.compType.getView(), + options: Q6, + label: Ye("chart.chartType"), + onChange: (l) => { + r.chartConfig.children.comp.children.hasOwnProperty("showLabel") ? r.chartConfig.dispatchChangeValueAction({ + compType: l, + comp: { + showLabel: r.chartConfig.children.comp.children.showLabel.toJsonValue() + } + }) : r.chartConfig.dispatchChangeValueAction({ + compType: l + }); + } + }), /* @__PURE__ */ Bt($lowcoder_sdk.Dropdown, { + value: r.xAxisKey.getView(), + options: n, + label: Ye("chart.xAxis"), + onChange: (l) => { + e(wp("xAxisKey", l)); + } + }), /* @__PURE__ */ Bt($lowcoder_sdk.Option, { + items: t, + title: Ye("chart.chartSeries"), + itemTitle: (l) => l.getView().seriesName, + popoverTitle: (l) => l.getView().columnName, + content: (l, u) => /* @__PURE__ */ Rn(Ni, { + children: [l.getPropertyViewWithData(n), /* @__PURE__ */ Bt($lowcoder_sdk.RedButton, { + onClick: () => { + $lowcoder_sdk.CustomModal.confirm({ + title: Ye("chart.delete"), + content: Ye("chart.confirmDelete") + `${l.getView().seriesName}?`, + onConfirm: () => r.series.dispatch(r.series.deleteAction(u)), + confirmBtnType: "delete", + okText: Ye("chart.delete") + }); + }, + children: Ye("chart.delete") + })] + }), + onAdd: () => { + n.length <= 0 || r.series.dispatch(r.series.pushAction(XB(Ye("chart.customSeries"), n[0].value))); + }, + onMove: (l, u) => { + const c = r.series.arrayMoveAction(l, u); + r.series.dispatch(c); + }, + hide: (l) => l.getView().hide, + onHide: (l, u) => l.children.hide.dispatchChangeValueAction(u), + dataIndex: (l) => l.getView().dataIndex + })] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.interaction, + children: r.onEvent.getPropertyView() + }), /* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.layout, + children: [r.title.propertyView({ + label: Ye("chart.title") + }), r.chartConfig.children.compType.getView() !== "pie" && /* @__PURE__ */ Rn(Ni, { + children: [r.xAxisDirection.propertyView({ + label: Ye("chart.xAxisDirection"), + radioButton: !0 + }), r.xConfig.getPropertyView(), r.yConfig.getPropertyView()] + }), r.legendConfig.getPropertyView(), $lowcoder_sdk.hiddenPropertyView(r)] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.style, + children: r.chartConfig.getPropertyView() + })] + }), a = /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: Ye("chart.config"), + children: r.echartsOption.propertyView({ + label: Ye("chart.echartsOptionLabel"), + styleName: "higher", + tooltip: /* @__PURE__ */ Rn("div", { + children: [/* @__PURE__ */ Bt("a", { + href: $B, + target: "_blank", + rel: "noopener noreferrer", + children: Ye("chart.echartsOptionTooltip") + }), /* @__PURE__ */ Bt("br", {}), /* @__PURE__ */ Bt("a", { + href: v6, + target: "_blank", + rel: "noopener noreferrer", + children: Ye("chart.echartsOptionExamples") + })] + }) + }) + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.layout, + children: $lowcoder_sdk.hiddenPropertyView(r) + })] + }), o = /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: "Map Configuration", + children: [r.mapApiKey.propertyView({ + label: "API Key" + }), r.mapZoomLevel.propertyView({ + label: "Zoom Level" + }), $lowcoder_sdk.controlItem({}, /* @__PURE__ */ Bt("b", { + style: { + marginTop: "8px" + }, + children: "Center Position" + })), r.mapCenterLng.propertyView({ + label: "Longitude" + }), r.mapCenterLat.propertyView({ + label: "Latitude" + })] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: "Map Data", + children: r.mapOptions.propertyView({ + label: Ye("chart.echartsOptionLabel"), + styleName: "higher", + tooltip: /* @__PURE__ */ Rn("div", { + children: [/* @__PURE__ */ Bt("a", { + href: g6, + target: "_blank", + rel: "noopener noreferrer", + children: Ye("chart.echartsMapOptionTooltip") + }), /* @__PURE__ */ Bt("br", {}), /* @__PURE__ */ Bt("a", { + href: m6, + target: "_blank", + rel: "noopener noreferrer", + children: Ye("chart.echartsMapOptionExamples") + })] + }) + }) + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.layout, + children: $lowcoder_sdk.hiddenPropertyView(r) + })] + }), s = (l) => { + switch (l) { + case "ui": + return i; + case "json": + return a; + case "map": + return o; + } + }; + return /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: Ye("chart.mode"), + children: r.mode.propertyView({ + label: "", + radioButton: !0 + }) + }), s(r.mode.getView())] + }); +} +var r1 = function(r, e) { + return r1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) { + t.__proto__ = n; + } || function(t, n) { + for (var i in n) + Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); + }, r1(r, e); +}; +function uY(r, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); + r1(r, e); + function t() { + this.constructor = r; + } + r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); +} +function cY(r, e) { + var t = {}; + for (var n in r) + Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]); + if (r != null && typeof Object.getOwnPropertySymbols == "function") + for (var i = 0, n = Object.getOwnPropertySymbols(r); i < n.length; i++) + e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[i]) && (t[n[i]] = r[n[i]]); + return t; +} +var my = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}; +function hY(r) { + var e = typeof r; + return r != null && (e == "object" || e == "function"); +} +var wI = hY, fY = typeof my == "object" && my && my.Object === Object && my, dY = fY, vY = dY, pY = typeof self == "object" && self && self.Object === Object && self, gY = vY || pY || Function("return this")(), KB = gY, mY = KB, yY = function() { + return mY.Date.now(); +}, _Y = yY, bY = /\s/; +function xY(r) { + for (var e = r.length; e-- && bY.test(r.charAt(e)); ) + ; + return e; +} +var SY = xY, wY = SY, CY = /^\s+/; +function TY(r) { + return r && r.slice(0, wY(r) + 1).replace(CY, ""); +} +var IY = TY, AY = KB, EY = AY.Symbol, QB = EY, PD = QB, qB = Object.prototype, MY = qB.hasOwnProperty, DY = qB.toString, Uv = PD ? PD.toStringTag : void 0; +function kY(r) { + var e = MY.call(r, Uv), t = r[Uv]; + try { + r[Uv] = void 0; + var n = !0; + } catch (a) { + } + var i = DY.call(r); + return n && (e ? r[Uv] = t : delete r[Uv]), i; +} +var OY = kY, LY = Object.prototype, PY = LY.toString; +function RY(r) { + return PY.call(r); +} +var NY = RY, RD = QB, zY = OY, BY = NY, jY = "[object Null]", FY = "[object Undefined]", ND = RD ? RD.toStringTag : void 0; +function $Y(r) { + return r == null ? r === void 0 ? FY : jY : ND && ND in Object(r) ? zY(r) : BY(r); +} +var HY = $Y; +function VY(r) { + return r != null && typeof r == "object"; +} +var GY = VY, UY = HY, WY = GY, YY = "[object Symbol]"; +function XY(r) { + return typeof r == "symbol" || WY(r) && UY(r) == YY; +} +var ZY = XY, JY = IY, zD = wI, KY = ZY, BD = 0 / 0, QY = /^[-+]0x[0-9a-f]+$/i, qY = /^0b[01]+$/i, e7 = /^0o[0-7]+$/i, t7 = parseInt; +function r7(r) { + if (typeof r == "number") + return r; + if (KY(r)) + return BD; + if (zD(r)) { + var e = typeof r.valueOf == "function" ? r.valueOf() : r; + r = zD(e) ? e + "" : e; + } + if (typeof r != "string") + return r === 0 ? r : +r; + r = JY(r); + var t = qY.test(r); + return t || e7.test(r) ? t7(r.slice(2), t ? 2 : 8) : QY.test(r) ? BD : +r; +} +var n7 = r7, i7 = wI, rS = _Y, jD = n7, a7 = "Expected a function", o7 = Math.max, s7 = Math.min; +function l7(r, e, t) { + var n, i, a, o, s, l, u = 0, c = !1, h = !1, f = !0; + if (typeof r != "function") + throw new TypeError(a7); + e = jD(e) || 0, i7(t) && (c = !!t.leading, h = "maxWait" in t, a = h ? o7(jD(t.maxWait) || 0, e) : a, f = "trailing" in t ? !!t.trailing : f); + function v(g) { + var S = n, T = i; + return n = i = void 0, u = g, o = r.apply(T, S), o; + } + function b(g) { + return u = g, s = setTimeout(d, e), c ? v(g) : o; + } + function w(g) { + var S = g - l, T = g - u, C = e - S; + return h ? s7(C, a - T) : C; + } + function p(g) { + var S = g - l, T = g - u; + return l === void 0 || S >= e || S < 0 || h && T >= a; + } + function d() { + var g = rS(); + if (p(g)) + return m(g); + s = setTimeout(d, w(g)); + } + function m(g) { + return s = void 0, f && n ? v(g) : (n = i = void 0, o); + } + function _() { + s !== void 0 && clearTimeout(s), u = 0, n = l = i = s = void 0; + } + function y() { + return s === void 0 ? o : m(rS()); + } + function x() { + var g = rS(), S = p(g); + if (n = arguments, i = this, l = g, S) { + if (s === void 0) + return b(l); + if (h) + return clearTimeout(s), s = setTimeout(d, e), v(l); + } + return s === void 0 && (s = setTimeout(d, e)), o; + } + return x.cancel = _, x.flush = y, x; +} +var ej = l7, u7 = ej, c7 = wI, h7 = "Expected a function"; +function f7(r, e, t) { + var n = !0, i = !0; + if (typeof r != "function") + throw new TypeError(h7); + return c7(t) && (n = "leading" in t ? !!t.leading : n, i = "trailing" in t ? !!t.trailing : i), u7(r, e, { + leading: n, + maxWait: e, + trailing: i + }); +} +var d7 = f7, v7 = function(r, e, t, n) { + switch (e) { + case "debounce": + return ej(r, t, n); + case "throttle": + return d7(r, t, n); + default: + return r; + } +}, n1 = function(r) { + return typeof r == "function"; +}, id = function() { + return typeof window == "undefined"; +}, FD = function(r) { + return r instanceof Element || r instanceof HTMLDocument; +}, p7 = function(r, e, t, n) { + return function(i) { + var a = i.width, o = i.height; + e(function(s) { + return s.width === a && s.height === o || s.width === a && !n || s.height === o && !t ? s : (r && n1(r) && r(a, o), { width: a, height: o }); + }); + }; +}, tj = ( + /** @class */ + function(r) { + uY(e, r); + function e(t) { + var n = r.call(this, t) || this; + n.cancelHandler = function() { + n.resizeHandler && n.resizeHandler.cancel && (n.resizeHandler.cancel(), n.resizeHandler = null); + }, n.attachObserver = function() { + var u = n.props, c = u.targetRef, h = u.observerOptions; + if (!id()) { + c && c.current && (n.targetRef.current = c.current); + var f = n.getElement(); + f && (n.observableElement && n.observableElement === f || (n.observableElement = f, n.resizeObserver.observe(f, h))); + } + }, n.getElement = function() { + var u = n.props, c = u.querySelector, h = u.targetDomEl; + if (id()) + return null; + if (c) + return document.querySelector(c); + if (h && FD(h)) + return h; + if (n.targetRef && FD(n.targetRef.current)) + return n.targetRef.current; + var f = $react_dom.findDOMNode(n); + if (!f) + return null; + var v = n.getRenderType(); + switch (v) { + case "renderProp": + return f; + case "childFunction": + return f; + case "child": + return f; + case "childArray": + return f; + default: + return f.parentElement; + } + }, n.createResizeHandler = function(u) { + var c = n.props, h = c.handleWidth, f = h === void 0 ? !0 : h, v = c.handleHeight, b = v === void 0 ? !0 : v, w = c.onResize; + if (!(!f && !b)) { + var p = p7(w, n.setState.bind(n), f, b); + u.forEach(function(d) { + var m = d && d.contentRect || {}, _ = m.width, y = m.height, x = !n.skipOnMount && !id(); + x && p({ width: _, height: y }), n.skipOnMount = !1; + }); + } + }, n.getRenderType = function() { + var u = n.props, c = u.render, h = u.children; + return n1(c) ? "renderProp" : n1(h) ? "childFunction" : $react.isValidElement(h) ? "child" : Array.isArray(h) ? "childArray" : "parent"; + }; + var i = t.skipOnMount, a = t.refreshMode, o = t.refreshRate, s = o === void 0 ? 1e3 : o, l = t.refreshOptions; + return n.state = { + width: void 0, + height: void 0 + }, n.skipOnMount = i, n.targetRef = $react.createRef(), n.observableElement = null, id() || (n.resizeHandler = v7(n.createResizeHandler, a, s, l), n.resizeObserver = new window.ResizeObserver(n.resizeHandler)), n; + } + return e.prototype.componentDidMount = function() { + this.attachObserver(); + }, e.prototype.componentDidUpdate = function() { + this.attachObserver(); + }, e.prototype.componentWillUnmount = function() { + id() || (this.observableElement = null, this.resizeObserver.disconnect(), this.cancelHandler()); + }, e.prototype.render = function() { + var t = this.props, n = t.render, i = t.children, a = t.nodeType, o = a === void 0 ? "div" : a, s = this.state, l = s.width, u = s.height, c = { width: l, height: u, targetRef: this.targetRef }, h = this.getRenderType(), f; + switch (h) { + case "renderProp": + return n && n(c); + case "childFunction": + return f = i, f(c); + case "child": + if (f = i, f.type && typeof f.type == "string") { + c.targetRef; + var v = cY(c, ["targetRef"]); + return $react.cloneElement(f, v); + } + return $react.cloneElement(f, c); + case "childArray": + return f = i, f.map(function(b) { + return !!b && $react.cloneElement(b, c); + }); + default: + return $react.createElement(o, null); + } + }, e; + }($react.PureComponent) +); +id() ? $react.useEffect : $react.useLayoutEffect; +/*! ***************************************************************************** +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. +***************************************************************************** */ +var i1 = function(r, e) { + return i1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) { + t.__proto__ = n; + } || function(t, n) { + for (var i in n) + Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); + }, i1(r, e); +}; +function Pe(r, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); + i1(r, e); + function t() { + this.constructor = r; + } + r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); +} +var g7 = function() { + function r() { + this.firefox = !1, this.ie = !1, this.edge = !1, this.newEdge = !1, this.weChat = !1; + } + return r; +}(), m7 = function() { + function r() { + this.browser = new g7(), this.node = !1, this.wxa = !1, this.worker = !1, this.svgSupported = !1, this.touchEventsSupported = !1, this.pointerEventsSupported = !1, this.domSupported = !1, this.transformSupported = !1, this.transform3dSupported = !1, this.hasGlobalWindow = typeof window != "undefined"; + } + return r; +}(), hh = new m7(); +typeof wx == "object" && typeof wx.getSystemInfoSync == "function" ? (hh.wxa = !0, hh.touchEventsSupported = !0) : typeof document == "undefined" && typeof self != "undefined" ? hh.worker = !0 : typeof navigator == "undefined" ? (hh.node = !0, hh.svgSupported = !0) : y7(navigator.userAgent, hh); +function y7(r, e) { + var t = e.browser, n = r.match(/Firefox\/([\d.]+)/), i = r.match(/MSIE\s([\d.]+)/) || r.match(/Trident\/.+?rv:(([\d.]+))/), a = r.match(/Edge?\/([\d.]+)/), o = /micromessenger/i.test(r); + n && (t.firefox = !0, t.version = n[1]), i && (t.ie = !0, t.version = i[1]), a && (t.edge = !0, t.version = a[1], t.newEdge = +a[1].split(".")[0] > 18), o && (t.weChat = !0), e.svgSupported = typeof SVGRect != "undefined", e.touchEventsSupported = "ontouchstart" in window && !t.ie && !t.edge, e.pointerEventsSupported = "onpointerdown" in window && (t.edge || t.ie && +t.version >= 11), e.domSupported = typeof document != "undefined"; + var s = document.documentElement.style; + e.transform3dSupported = (t.ie && "transition" in s || t.edge || "WebKitCSSMatrix" in window && "m11" in new WebKitCSSMatrix() || "MozPerspective" in s) && !("OTransition" in s), e.transformSupported = e.transform3dSupported || t.ie && +t.version >= 9; +} +const Dr = hh; +var CI = 12, rj = "sans-serif", hc = CI + "px " + rj, _7 = 20, b7 = 100, x7 = "007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N"; +function S7(r) { + var e = {}; + if (typeof JSON == "undefined") + return e; + for (var t = 0; t < r.length; t++) { + var n = String.fromCharCode(t + 32), i = (r.charCodeAt(t) - _7) / b7; + e[n] = i; + } + return e; +} +var w7 = S7(x7), Bs = { + createCanvas: function() { + return typeof document != "undefined" && document.createElement("canvas"); + }, + measureText: function() { + var r, e; + return function(t, n) { + if (!r) { + var i = Bs.createCanvas(); + r = i && i.getContext("2d"); + } + if (r) + return e !== n && (e = r.font = n || hc), r.measureText(t); + t = t || "", n = n || hc; + var a = /(\d+)px/.exec(n), o = a && +a[1] || CI, s = 0; + if (n.indexOf("mono") >= 0) + s = o * t.length; + else + for (var l = 0; l < t.length; l++) { + var u = w7[t[l]]; + s += u == null ? o : u * o; + } + return { width: s }; + }; + }(), + loadImage: function(r, e, t) { + var n = new Image(); + return n.onload = e, n.onerror = t, n.src = r, n; + } +}; +function TI(r) { + for (var e in Bs) + r[e] && (Bs[e] = r[e]); +} +var nj = es([ + "Function", + "RegExp", + "Date", + "Error", + "CanvasGradient", + "CanvasPattern", + "Image", + "Canvas" +], function(r, e) { + return r["[object " + e + "]"] = !0, r; +}, {}), ij = es([ + "Int8", + "Uint8", + "Uint8Clamped", + "Int16", + "Uint16", + "Int32", + "Uint32", + "Float32", + "Float64" +], function(r, e) { + return r["[object " + e + "Array]"] = !0, r; +}, {}), Yd = Object.prototype.toString, xb = Array.prototype, C7 = xb.forEach, T7 = xb.filter, II = xb.slice, I7 = xb.map, $D = function() { +}.constructor, yy = $D ? $D.prototype : null, AI = "__proto__", A7 = 2311; +function EI() { + return A7++; +} +function Sb() { + for (var r = [], e = 0; e < arguments.length; e++) + r[e] = arguments[e]; + typeof console != "undefined" && console.error.apply(console, r); +} +function Ot(r) { + if (r == null || typeof r != "object") + return r; + var e = r, t = Yd.call(r); + if (t === "[object Array]") { + if (!yd(r)) { + e = []; + for (var n = 0, i = r.length; n < i; n++) + e[n] = Ot(r[n]); + } + } else if (ij[t]) { + if (!yd(r)) { + var a = r.constructor; + if (a.from) + e = a.from(r); + else { + e = new a(r.length); + for (var n = 0, i = r.length; n < i; n++) + e[n] = r[n]; + } + } + } else if (!nj[t] && !yd(r) && !Od(r)) { + e = {}; + for (var o in r) + r.hasOwnProperty(o) && o !== AI && (e[o] = Ot(r[o])); + } + return e; +} +function Ut(r, e, t) { + if (!kt(e) || !kt(r)) + return t ? Ot(e) : r; + for (var n in e) + if (e.hasOwnProperty(n) && n !== AI) { + var i = r[n], a = e[n]; + kt(a) && kt(i) && !We(a) && !We(i) && !Od(a) && !Od(i) && !a1(a) && !a1(i) && !yd(a) && !yd(i) ? Ut(i, a, t) : (t || !(n in r)) && (r[n] = Ot(e[n])); + } + return r; +} +function wb(r, e) { + for (var t = r[0], n = 1, i = r.length; n < i; n++) + t = Ut(t, r[n], e); + return t; +} +function Fe(r, e) { + if (Object.assign) + Object.assign(r, e); + else + for (var t in e) + e.hasOwnProperty(t) && t !== AI && (r[t] = e[t]); + return r; +} +function Mt(r, e, t) { + for (var n = yr(e), i = 0; i < n.length; i++) { + var a = n[i]; + (t ? e[a] != null : r[a] == null) && (r[a] = e[a]); + } + return r; +} +var E7 = Bs.createCanvas; +function ir(r, e) { + if (r) { + if (r.indexOf) + return r.indexOf(e); + for (var t = 0, n = r.length; t < n; t++) + if (r[t] === e) + return t; + } + return -1; +} +function MI(r, e) { + var t = r.prototype; + function n() { + } + n.prototype = e.prototype, r.prototype = new n(); + for (var i in t) + t.hasOwnProperty(i) && (r.prototype[i] = t[i]); + r.prototype.constructor = r, r.superClass = e; +} +function qn(r, e, t) { + if (r = "prototype" in r ? r.prototype : r, e = "prototype" in e ? e.prototype : e, Object.getOwnPropertyNames) + for (var n = Object.getOwnPropertyNames(e), i = 0; i < n.length; i++) { + var a = n[i]; + a !== "constructor" && (t ? e[a] != null : r[a] == null) && (r[a] = e[a]); + } + else + Mt(r, e, t); +} +function Yi(r) { + return !r || typeof r == "string" ? !1 : typeof r.length == "number"; +} +function X(r, e, t) { + if (r && e) + if (r.forEach && r.forEach === C7) + r.forEach(e, t); + else if (r.length === +r.length) + for (var n = 0, i = r.length; n < i; n++) + e.call(t, r[n], n, r); + else + for (var a in r) + r.hasOwnProperty(a) && e.call(t, r[a], a, r); +} +function Ke(r, e, t) { + if (!r) + return []; + if (!e) + return Cb(r); + if (r.map && r.map === I7) + return r.map(e, t); + for (var n = [], i = 0, a = r.length; i < a; i++) + n.push(e.call(t, r[i], i, r)); + return n; +} +function es(r, e, t, n) { + if (r && e) { + for (var i = 0, a = r.length; i < a; i++) + t = e.call(n, t, r[i], i, r); + return t; + } +} +function Jr(r, e, t) { + if (!r) + return []; + if (!e) + return Cb(r); + if (r.filter && r.filter === T7) + return r.filter(e, t); + for (var n = [], i = 0, a = r.length; i < a; i++) + e.call(t, r[i], i, r) && n.push(r[i]); + return n; +} +function aj(r, e, t) { + if (r && e) { + for (var n = 0, i = r.length; n < i; n++) + if (e.call(t, r[n], n, r)) + return r[n]; + } +} +function yr(r) { + if (!r) + return []; + if (Object.keys) + return Object.keys(r); + var e = []; + for (var t in r) + r.hasOwnProperty(t) && e.push(t); + return e; +} +function M7(r, e) { + for (var t = [], n = 2; n < arguments.length; n++) + t[n - 2] = arguments[n]; + return function() { + return r.apply(e, t.concat(II.call(arguments))); + }; +} +var ft = yy && Tt(yy.bind) ? yy.call.bind(yy.bind) : M7; +function jt(r) { + for (var e = [], t = 1; t < arguments.length; t++) + e[t - 1] = arguments[t]; + return function() { + return r.apply(this, e.concat(II.call(arguments))); + }; +} +function We(r) { + return Array.isArray ? Array.isArray(r) : Yd.call(r) === "[object Array]"; +} +function Tt(r) { + return typeof r == "function"; +} +function ut(r) { + return typeof r == "string"; +} +function s_(r) { + return Yd.call(r) === "[object String]"; +} +function Pr(r) { + return typeof r == "number"; +} +function kt(r) { + var e = typeof r; + return e === "function" || !!r && e === "object"; +} +function a1(r) { + return !!nj[Yd.call(r)]; +} +function no(r) { + return !!ij[Yd.call(r)]; +} +function Od(r) { + return typeof r == "object" && typeof r.nodeType == "number" && typeof r.ownerDocument == "object"; +} +function Ug(r) { + return r.colorStops != null; +} +function oj(r) { + return r.image != null; +} +function sj(r) { + return Yd.call(r) === "[object RegExp]"; +} +function Ld(r) { + return r !== r; +} +function Ii() { + for (var r = [], e = 0; e < arguments.length; e++) + r[e] = arguments[e]; + for (var t = 0, n = r.length; t < n; t++) + if (r[t] != null) + return r[t]; +} +function Jt(r, e) { + return r != null ? r : e; +} +function Ps(r, e, t) { + return r != null ? r : e != null ? e : t; +} +function Cb(r) { + for (var e = [], t = 1; t < arguments.length; t++) + e[t - 1] = arguments[t]; + return II.apply(r, e); +} +function Tb(r) { + if (typeof r == "number") + return [r, r, r, r]; + var e = r.length; + return e === 2 ? [r[0], r[1], r[0], r[1]] : e === 3 ? [r[0], r[1], r[2], r[1]] : r; +} +function pa(r, e) { + if (!r) + throw new Error(e); +} +function Qo(r) { + return r == null ? null : typeof r.trim == "function" ? r.trim() : r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); +} +var lj = "__ec_primitive__"; +function ig(r) { + r[lj] = !0; +} +function yd(r) { + return r[lj]; +} +var D7 = function() { + function r() { + this.data = {}; + } + return r.prototype.delete = function(e) { + var t = this.has(e); + return t && delete this.data[e], t; + }, r.prototype.has = function(e) { + return this.data.hasOwnProperty(e); + }, r.prototype.get = function(e) { + return this.data[e]; + }, r.prototype.set = function(e, t) { + return this.data[e] = t, this; + }, r.prototype.keys = function() { + return yr(this.data); + }, r.prototype.forEach = function(e) { + var t = this.data; + for (var n in t) + t.hasOwnProperty(n) && e(t[n], n); + }, r; +}(), uj = typeof Map == "function"; +function k7() { + return uj ? /* @__PURE__ */ new Map() : new D7(); +} +var cj = function() { + function r(e) { + var t = We(e); + this.data = k7(); + var n = this; + e instanceof r ? e.each(i) : e && X(e, i); + function i(a, o) { + t ? n.set(a, o) : n.set(o, a); + } + } + return r.prototype.hasKey = function(e) { + return this.data.has(e); + }, r.prototype.get = function(e) { + return this.data.get(e); + }, r.prototype.set = function(e, t) { + return this.data.set(e, t), t; + }, r.prototype.each = function(e, t) { + this.data.forEach(function(n, i) { + e.call(t, n, i); + }); + }, r.prototype.keys = function() { + var e = this.data.keys(); + return uj ? Array.from(e) : e; + }, r.prototype.removeKey = function(e) { + this.data.delete(e); + }, r; +}(); +function xt(r) { + return new cj(r); +} +function ag(r, e) { + for (var t = new r.constructor(r.length + e.length), n = 0; n < r.length; n++) + t[n] = r[n]; + for (var i = r.length, n = 0; n < e.length; n++) + t[n + i] = e[n]; + return t; +} +function Wg(r, e) { + var t; + if (Object.create) + t = Object.create(r); + else { + var n = function() { + }; + n.prototype = r, t = new n(); + } + return e && Fe(t, e), t; +} +function DI(r) { + var e = r.style; + e.webkitUserSelect = "none", e.userSelect = "none", e.webkitTapHighlightColor = "rgba(0,0,0,0)", e["-webkit-touch-callout"] = "none"; +} +function gt(r, e) { + return r.hasOwnProperty(e); +} +function Qn() { +} +var Np = 180 / Math.PI; +const hj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + HashMap: cj, + RADIAN_TO_DEGREE: Np, + assert: pa, + bind: ft, + clone: Ot, + concatArray: ag, + createCanvas: E7, + createHashMap: xt, + createObject: Wg, + curry: jt, + defaults: Mt, + disableUserSelect: DI, + each: X, + eqNaN: Ld, + extend: Fe, + filter: Jr, + find: aj, + guid: EI, + hasOwn: gt, + indexOf: ir, + inherits: MI, + isArray: We, + isArrayLike: Yi, + isBuiltInObject: a1, + isDom: Od, + isFunction: Tt, + isGradientObject: Ug, + isImagePatternObject: oj, + isNumber: Pr, + isObject: kt, + isPrimitive: yd, + isRegExp: sj, + isString: ut, + isStringSafe: s_, + isTypedArray: no, + keys: yr, + logError: Sb, + map: Ke, + merge: Ut, + mergeAll: wb, + mixin: qn, + noop: Qn, + normalizeCssArray: Tb, + reduce: es, + retrieve: Ii, + retrieve2: Jt, + retrieve3: Ps, + setAsPrimitive: ig, + slice: Cb, + trim: Qo +}, Symbol.toStringTag, { value: "Module" })); +/*! ***************************************************************************** +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. +***************************************************************************** */ +var o1 = function(r, e) { + return o1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) { + t.__proto__ = n; + } || function(t, n) { + for (var i in n) + Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); + }, o1(r, e); +}; +function En(r, e) { + if (typeof e != "function" && e !== null) + throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); + o1(r, e); + function t() { + this.constructor = r; + } + r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t()); +} +function Sc(r, e) { + return r == null && (r = 0), e == null && (e = 0), [r, e]; +} +function ca(r, e) { + return r[0] = e[0], r[1] = e[1], r; +} +function bl(r) { + return [r[0], r[1]]; +} +function fj(r, e, t) { + return r[0] = e, r[1] = t, r; +} +function s1(r, e, t) { + return r[0] = e[0] + t[0], r[1] = e[1] + t[1], r; +} +function l_(r, e, t, n) { + return r[0] = e[0] + t[0] * n, r[1] = e[1] + t[1] * n, r; +} +function Yu(r, e, t) { + return r[0] = e[0] - t[0], r[1] = e[1] - t[1], r; +} +function og(r) { + return Math.sqrt(kI(r)); +} +var O7 = og; +function kI(r) { + return r[0] * r[0] + r[1] * r[1]; +} +var L7 = kI; +function P7(r, e, t) { + return r[0] = e[0] * t[0], r[1] = e[1] * t[1], r; +} +function R7(r, e, t) { + return r[0] = e[0] / t[0], r[1] = e[1] / t[1], r; +} +function N7(r, e) { + return r[0] * e[0] + r[1] * e[1]; +} +function zp(r, e, t) { + return r[0] = e[0] * t, r[1] = e[1] * t, r; +} +function rf(r, e) { + var t = og(e); + return t === 0 ? (r[0] = 0, r[1] = 0) : (r[0] = e[0] / t, r[1] = e[1] / t), r; +} +function u_(r, e) { + return Math.sqrt((r[0] - e[0]) * (r[0] - e[0]) + (r[1] - e[1]) * (r[1] - e[1])); +} +var Gl = u_; +function dj(r, e) { + return (r[0] - e[0]) * (r[0] - e[0]) + (r[1] - e[1]) * (r[1] - e[1]); +} +var nc = dj; +function z7(r, e) { + return r[0] = -e[0], r[1] = -e[1], r; +} +function Bp(r, e, t, n) { + return r[0] = e[0] + n * (t[0] - e[0]), r[1] = e[1] + n * (t[1] - e[1]), r; +} +function zi(r, e, t) { + var n = e[0], i = e[1]; + return r[0] = t[0] * n + t[2] * i + t[4], r[1] = t[1] * n + t[3] * i + t[5], r; +} +function Ul(r, e, t) { + return r[0] = Math.min(e[0], t[0]), r[1] = Math.min(e[1], t[1]), r; +} +function Wl(r, e, t) { + return r[0] = Math.max(e[0], t[0]), r[1] = Math.max(e[1], t[1]), r; +} +const vj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + add: s1, + applyTransform: zi, + clone: bl, + copy: ca, + create: Sc, + dist: Gl, + distSquare: nc, + distance: u_, + distanceSquare: dj, + div: R7, + dot: N7, + len: og, + lenSquare: kI, + length: O7, + lengthSquare: L7, + lerp: Bp, + max: Wl, + min: Ul, + mul: P7, + negate: z7, + normalize: rf, + scale: zp, + scaleAndAdd: l_, + set: fj, + sub: Yu +}, Symbol.toStringTag, { value: "Module" })); +var zf = function() { + function r(e, t) { + this.target = e, this.topTarget = t && t.topTarget; + } + return r; +}(), B7 = function() { + function r(e) { + this.handler = e, e.on("mousedown", this._dragStart, this), e.on("mousemove", this._drag, this), e.on("mouseup", this._dragEnd, this); + } + return r.prototype._dragStart = function(e) { + for (var t = e.target; t && !t.draggable; ) + t = t.parent || t.__hostTarget; + t && (this._draggingTarget = t, t.dragging = !0, this._x = e.offsetX, this._y = e.offsetY, this.handler.dispatchToElement(new zf(t, e), "dragstart", e.event)); + }, r.prototype._drag = function(e) { + var t = this._draggingTarget; + if (t) { + var n = e.offsetX, i = e.offsetY, a = n - this._x, o = i - this._y; + this._x = n, this._y = i, t.drift(a, o, e), this.handler.dispatchToElement(new zf(t, e), "drag", e.event); + var s = this.handler.findHover(n, i, t).target, l = this._dropTarget; + this._dropTarget = s, t !== s && (l && s !== l && this.handler.dispatchToElement(new zf(l, e), "dragleave", e.event), s && s !== l && this.handler.dispatchToElement(new zf(s, e), "dragenter", e.event)); + } + }, r.prototype._dragEnd = function(e) { + var t = this._draggingTarget; + t && (t.dragging = !1), this.handler.dispatchToElement(new zf(t, e), "dragend", e.event), this._dropTarget && this.handler.dispatchToElement(new zf(this._dropTarget, e), "drop", e.event), this._draggingTarget = null, this._dropTarget = null; + }, r; +}(); +const j7 = B7; +var F7 = function() { + function r(e) { + e && (this._$eventProcessor = e); + } + return r.prototype.on = function(e, t, n, i) { + this._$handlers || (this._$handlers = {}); + var a = this._$handlers; + if (typeof t == "function" && (i = n, n = t, t = null), !n || !e) + return this; + var o = this._$eventProcessor; + t != null && o && o.normalizeQuery && (t = o.normalizeQuery(t)), a[e] || (a[e] = []); + for (var s = 0; s < a[e].length; s++) + if (a[e][s].h === n) + return this; + var l = { + h: n, + query: t, + ctx: i || this, + callAtLast: n.zrEventfulCallAtLast + }, u = a[e].length - 1, c = a[e][u]; + return c && c.callAtLast ? a[e].splice(u, 0, l) : a[e].push(l), this; + }, r.prototype.isSilent = function(e) { + var t = this._$handlers; + return !t || !t[e] || !t[e].length; + }, r.prototype.off = function(e, t) { + var n = this._$handlers; + if (!n) + return this; + if (!e) + return this._$handlers = {}, this; + if (t) { + if (n[e]) { + for (var i = [], a = 0, o = n[e].length; a < o; a++) + n[e][a].h !== t && i.push(n[e][a]); + n[e] = i; + } + n[e] && n[e].length === 0 && delete n[e]; + } else + delete n[e]; + return this; + }, r.prototype.trigger = function(e) { + for (var t = [], n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + if (!this._$handlers) + return this; + var i = this._$handlers[e], a = this._$eventProcessor; + if (i) + for (var o = t.length, s = i.length, l = 0; l < s; l++) { + var u = i[l]; + if (!(a && a.filter && u.query != null && !a.filter(e, u.query))) + switch (o) { + case 0: + u.h.call(u.ctx); + break; + case 1: + u.h.call(u.ctx, t[0]); + break; + case 2: + u.h.call(u.ctx, t[0], t[1]); + break; + default: + u.h.apply(u.ctx, t); + break; + } + } + return a && a.afterTrigger && a.afterTrigger(e), this; + }, r.prototype.triggerWithContext = function(e) { + for (var t = [], n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + if (!this._$handlers) + return this; + var i = this._$handlers[e], a = this._$eventProcessor; + if (i) + for (var o = t.length, s = t[o - 1], l = i.length, u = 0; u < l; u++) { + var c = i[u]; + if (!(a && a.filter && c.query != null && !a.filter(e, c.query))) + switch (o) { + case 0: + c.h.call(s); + break; + case 1: + c.h.call(s, t[0]); + break; + case 2: + c.h.call(s, t[0], t[1]); + break; + default: + c.h.apply(s, t.slice(1, o - 1)); + break; + } + } + return a && a.afterTrigger && a.afterTrigger(e), this; + }, r; +}(); +const rs = F7; +var $7 = Math.log(2); +function l1(r, e, t, n, i, a) { + var o = n + "-" + i, s = r.length; + if (a.hasOwnProperty(o)) + return a[o]; + if (e === 1) { + var l = Math.round(Math.log((1 << s) - 1 & ~i) / $7); + return r[t][l]; + } + for (var u = n | 1 << t, c = t + 1; n & 1 << c; ) + c++; + for (var h = 0, f = 0, v = 0; f < s; f++) { + var b = 1 << f; + b & i || (h += (v % 2 ? -1 : 1) * r[t][f] * l1(r, e - 1, c, u, i | b, a), v++); + } + return a[o] = h, h; +} +function HD(r, e) { + var t = [ + [r[0], r[1], 1, 0, 0, 0, -e[0] * r[0], -e[0] * r[1]], + [0, 0, 0, r[0], r[1], 1, -e[1] * r[0], -e[1] * r[1]], + [r[2], r[3], 1, 0, 0, 0, -e[2] * r[2], -e[2] * r[3]], + [0, 0, 0, r[2], r[3], 1, -e[3] * r[2], -e[3] * r[3]], + [r[4], r[5], 1, 0, 0, 0, -e[4] * r[4], -e[4] * r[5]], + [0, 0, 0, r[4], r[5], 1, -e[5] * r[4], -e[5] * r[5]], + [r[6], r[7], 1, 0, 0, 0, -e[6] * r[6], -e[6] * r[7]], + [0, 0, 0, r[6], r[7], 1, -e[7] * r[6], -e[7] * r[7]] + ], n = {}, i = l1(t, 8, 0, 0, 0, n); + if (i !== 0) { + for (var a = [], o = 0; o < 8; o++) + for (var s = 0; s < 8; s++) + a[s] == null && (a[s] = 0), a[s] += ((o + s) % 2 ? -1 : 1) * l1(t, 7, o === 0 ? 1 : 0, 1 << o, 1 << s, n) / i * e[o]; + return function(l, u, c) { + var h = u * a[6] + c * a[7] + 1; + l[0] = (u * a[0] + c * a[1] + a[2]) / h, l[1] = (u * a[3] + c * a[4] + a[5]) / h; + }; + } +} +var VD = "___zrEVENTSAVED", nS = []; +function H7(r, e, t, n, i) { + return u1(nS, e, n, i, !0) && u1(r, t, nS[0], nS[1]); +} +function u1(r, e, t, n, i) { + if (e.getBoundingClientRect && Dr.domSupported && !pj(e)) { + var a = e[VD] || (e[VD] = {}), o = V7(e, a), s = G7(o, a, i); + if (s) + return s(r, t, n), !0; + } + return !1; +} +function V7(r, e) { + var t = e.markers; + if (t) + return t; + t = e.markers = []; + for (var n = ["left", "right"], i = ["top", "bottom"], a = 0; a < 4; a++) { + var o = document.createElement("div"), s = o.style, l = a % 2, u = (a >> 1) % 2; + s.cssText = [ + "position: absolute", + "visibility: hidden", + "padding: 0", + "margin: 0", + "border-width: 0", + "user-select: none", + "width:0", + "height:0", + n[l] + ":0", + i[u] + ":0", + n[1 - l] + ":auto", + i[1 - u] + ":auto", + "" + ].join("!important;"), r.appendChild(o), t.push(o); + } + return t; +} +function G7(r, e, t) { + for (var n = t ? "invTrans" : "trans", i = e[n], a = e.srcCoords, o = [], s = [], l = !0, u = 0; u < 4; u++) { + var c = r[u].getBoundingClientRect(), h = 2 * u, f = c.left, v = c.top; + o.push(f, v), l = l && a && f === a[h] && v === a[h + 1], s.push(r[u].offsetLeft, r[u].offsetTop); + } + return l && i ? i : (e.srcCoords = o, e[n] = t ? HD(s, o) : HD(o, s)); +} +function pj(r) { + return r.nodeName.toUpperCase() === "CANVAS"; +} +var U7 = /([&<>"'])/g, W7 = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}; +function Ea(r) { + return r == null ? "" : (r + "").replace(U7, function(e, t) { + return W7[t]; + }); +} +var Y7 = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, iS = [], X7 = Dr.browser.firefox && +Dr.browser.version.split(".")[0] < 39; +function c1(r, e, t, n) { + return t = t || {}, n ? GD(r, e, t) : X7 && e.layerX != null && e.layerX !== e.offsetX ? (t.zrX = e.layerX, t.zrY = e.layerY) : e.offsetX != null ? (t.zrX = e.offsetX, t.zrY = e.offsetY) : GD(r, e, t), t; +} +function GD(r, e, t) { + if (Dr.domSupported && r.getBoundingClientRect) { + var n = e.clientX, i = e.clientY; + if (pj(r)) { + var a = r.getBoundingClientRect(); + t.zrX = n - a.left, t.zrY = i - a.top; + return; + } else if (u1(iS, r, n, i)) { + t.zrX = iS[0], t.zrY = iS[1]; + return; + } + } + t.zrX = t.zrY = 0; +} +function OI(r) { + return r || window.event; +} +function Go(r, e, t) { + if (e = OI(e), e.zrX != null) + return e; + var n = e.type, i = n && n.indexOf("touch") >= 0; + if (i) { + var o = n !== "touchend" ? e.targetTouches[0] : e.changedTouches[0]; + o && c1(r, o, e, t); + } else { + c1(r, e, e, t); + var a = Z7(e); + e.zrDelta = a ? a / 120 : -(e.detail || 0) / 3; + } + var s = e.button; + return e.which == null && s !== void 0 && Y7.test(e.type) && (e.which = s & 1 ? 1 : s & 2 ? 3 : s & 4 ? 2 : 0), e; +} +function Z7(r) { + var e = r.wheelDelta; + if (e) + return e; + var t = r.deltaX, n = r.deltaY; + if (t == null || n == null) + return e; + var i = Math.abs(n !== 0 ? n : t), a = n > 0 ? -1 : n < 0 ? 1 : t > 0 ? -1 : 1; + return 3 * i * a; +} +function h1(r, e, t, n) { + r.addEventListener(e, t, n); +} +function J7(r, e, t, n) { + r.removeEventListener(e, t, n); +} +var eu = function(r) { + r.preventDefault(), r.stopPropagation(), r.cancelBubble = !0; +}; +function UD(r) { + return r.which === 2 || r.which === 3; +} +var K7 = function() { + function r() { + this._track = []; + } + return r.prototype.recognize = function(e, t, n) { + return this._doTrack(e, t, n), this._recognize(e); + }, r.prototype.clear = function() { + return this._track.length = 0, this; + }, r.prototype._doTrack = function(e, t, n) { + var i = e.touches; + if (i) { + for (var a = { + points: [], + touches: [], + target: t, + event: e + }, o = 0, s = i.length; o < s; o++) { + var l = i[o], u = c1(n, l, {}); + a.points.push([u.zrX, u.zrY]), a.touches.push(l); + } + this._track.push(a); + } + }, r.prototype._recognize = function(e) { + for (var t in aS) + if (aS.hasOwnProperty(t)) { + var n = aS[t](this._track, e); + if (n) + return n; + } + }, r; +}(); +function WD(r) { + var e = r[1][0] - r[0][0], t = r[1][1] - r[0][1]; + return Math.sqrt(e * e + t * t); +} +function Q7(r) { + return [ + (r[0][0] + r[1][0]) / 2, + (r[0][1] + r[1][1]) / 2 + ]; +} +var aS = { + pinch: function(r, e) { + var t = r.length; + if (t) { + var n = (r[t - 1] || {}).points, i = (r[t - 2] || {}).points || n; + if (i && i.length > 1 && n && n.length > 1) { + var a = WD(n) / WD(i); + !isFinite(a) && (a = 1), e.pinchScale = a; + var o = Q7(n); + return e.pinchX = o[0], e.pinchY = o[1], { + type: "pinch", + target: r[0].target, + event: e + }; + } + } + } +}; +function io() { + return [1, 0, 0, 1, 0, 0]; +} +function Yg(r) { + return r[0] = 1, r[1] = 0, r[2] = 0, r[3] = 1, r[4] = 0, r[5] = 0, r; +} +function Ib(r, e) { + return r[0] = e[0], r[1] = e[1], r[2] = e[2], r[3] = e[3], r[4] = e[4], r[5] = e[5], r; +} +function xl(r, e, t) { + var n = e[0] * t[0] + e[2] * t[1], i = e[1] * t[0] + e[3] * t[1], a = e[0] * t[2] + e[2] * t[3], o = e[1] * t[2] + e[3] * t[3], s = e[0] * t[4] + e[2] * t[5] + e[4], l = e[1] * t[4] + e[3] * t[5] + e[5]; + return r[0] = n, r[1] = i, r[2] = a, r[3] = o, r[4] = s, r[5] = l, r; +} +function js(r, e, t) { + return r[0] = e[0], r[1] = e[1], r[2] = e[2], r[3] = e[3], r[4] = e[4] + t[0], r[5] = e[5] + t[1], r; +} +function wc(r, e, t) { + var n = e[0], i = e[2], a = e[4], o = e[1], s = e[3], l = e[5], u = Math.sin(t), c = Math.cos(t); + return r[0] = n * c + o * u, r[1] = -n * u + o * c, r[2] = i * c + s * u, r[3] = -i * u + c * s, r[4] = c * a + u * l, r[5] = c * l - u * a, r; +} +function Ab(r, e, t) { + var n = t[0], i = t[1]; + return r[0] = e[0] * n, r[1] = e[1] * i, r[2] = e[2] * n, r[3] = e[3] * i, r[4] = e[4] * n, r[5] = e[5] * i, r; +} +function nf(r, e) { + var t = e[0], n = e[2], i = e[4], a = e[1], o = e[3], s = e[5], l = t * o - a * n; + return l ? (l = 1 / l, r[0] = o * l, r[1] = -a * l, r[2] = -n * l, r[3] = t * l, r[4] = (n * s - o * i) * l, r[5] = (a * i - t * s) * l, r) : null; +} +function gj(r) { + var e = io(); + return Ib(e, r), e; +} +const mj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + clone: gj, + copy: Ib, + create: io, + identity: Yg, + invert: nf, + mul: xl, + rotate: wc, + scale: Ab, + translate: js +}, Symbol.toStringTag, { value: "Module" })); +var q7 = function() { + function r(e, t) { + this.x = e || 0, this.y = t || 0; + } + return r.prototype.copy = function(e) { + return this.x = e.x, this.y = e.y, this; + }, r.prototype.clone = function() { + return new r(this.x, this.y); + }, r.prototype.set = function(e, t) { + return this.x = e, this.y = t, this; + }, r.prototype.equal = function(e) { + return e.x === this.x && e.y === this.y; + }, r.prototype.add = function(e) { + return this.x += e.x, this.y += e.y, this; + }, r.prototype.scale = function(e) { + this.x *= e, this.y *= e; + }, r.prototype.scaleAndAdd = function(e, t) { + this.x += e.x * t, this.y += e.y * t; + }, r.prototype.sub = function(e) { + return this.x -= e.x, this.y -= e.y, this; + }, r.prototype.dot = function(e) { + return this.x * e.x + this.y * e.y; + }, r.prototype.len = function() { + return Math.sqrt(this.x * this.x + this.y * this.y); + }, r.prototype.lenSquare = function() { + return this.x * this.x + this.y * this.y; + }, r.prototype.normalize = function() { + var e = this.len(); + return this.x /= e, this.y /= e, this; + }, r.prototype.distance = function(e) { + var t = this.x - e.x, n = this.y - e.y; + return Math.sqrt(t * t + n * n); + }, r.prototype.distanceSquare = function(e) { + var t = this.x - e.x, n = this.y - e.y; + return t * t + n * n; + }, r.prototype.negate = function() { + return this.x = -this.x, this.y = -this.y, this; + }, r.prototype.transform = function(e) { + if (e) { + var t = this.x, n = this.y; + return this.x = e[0] * t + e[2] * n + e[4], this.y = e[1] * t + e[3] * n + e[5], this; + } + }, r.prototype.toArray = function(e) { + return e[0] = this.x, e[1] = this.y, e; + }, r.prototype.fromArray = function(e) { + this.x = e[0], this.y = e[1]; + }, r.set = function(e, t, n) { + e.x = t, e.y = n; + }, r.copy = function(e, t) { + e.x = t.x, e.y = t.y; + }, r.len = function(e) { + return Math.sqrt(e.x * e.x + e.y * e.y); + }, r.lenSquare = function(e) { + return e.x * e.x + e.y * e.y; + }, r.dot = function(e, t) { + return e.x * t.x + e.y * t.y; + }, r.add = function(e, t, n) { + e.x = t.x + n.x, e.y = t.y + n.y; + }, r.sub = function(e, t, n) { + e.x = t.x - n.x, e.y = t.y - n.y; + }, r.scale = function(e, t, n) { + e.x = t.x * n, e.y = t.y * n; + }, r.scaleAndAdd = function(e, t, n, i) { + e.x = t.x + n.x * i, e.y = t.y + n.y * i; + }, r.lerp = function(e, t, n, i) { + var a = 1 - i; + e.x = a * t.x + i * n.x, e.y = a * t.y + i * n.y; + }, r; +}(); +const Zt = q7; +var _y = Math.min, by = Math.max, $c = new Zt(), Hc = new Zt(), Vc = new Zt(), Gc = new Zt(), Wv = new Zt(), Yv = new Zt(), eX = function() { + function r(e, t, n, i) { + n < 0 && (e = e + n, n = -n), i < 0 && (t = t + i, i = -i), this.x = e, this.y = t, this.width = n, this.height = i; + } + return r.prototype.union = function(e) { + var t = _y(e.x, this.x), n = _y(e.y, this.y); + isFinite(this.x) && isFinite(this.width) ? this.width = by(e.x + e.width, this.x + this.width) - t : this.width = e.width, isFinite(this.y) && isFinite(this.height) ? this.height = by(e.y + e.height, this.y + this.height) - n : this.height = e.height, this.x = t, this.y = n; + }, r.prototype.applyTransform = function(e) { + r.applyTransform(this, this, e); + }, r.prototype.calculateTransform = function(e) { + var t = this, n = e.width / t.width, i = e.height / t.height, a = io(); + return js(a, a, [-t.x, -t.y]), Ab(a, a, [n, i]), js(a, a, [e.x, e.y]), a; + }, r.prototype.intersect = function(e, t) { + if (!e) + return !1; + e instanceof r || (e = r.create(e)); + var n = this, i = n.x, a = n.x + n.width, o = n.y, s = n.y + n.height, l = e.x, u = e.x + e.width, c = e.y, h = e.y + e.height, f = !(a < l || u < i || s < c || h < o); + if (t) { + var v = 1 / 0, b = 0, w = Math.abs(a - l), p = Math.abs(u - i), d = Math.abs(s - c), m = Math.abs(h - o), _ = Math.min(w, p), y = Math.min(d, m); + a < l || u < i ? _ > b && (b = _, w < p ? Zt.set(Yv, -w, 0) : Zt.set(Yv, p, 0)) : _ < v && (v = _, w < p ? Zt.set(Wv, w, 0) : Zt.set(Wv, -p, 0)), s < c || h < o ? y > b && (b = y, d < m ? Zt.set(Yv, 0, -d) : Zt.set(Yv, 0, m)) : _ < v && (v = _, d < m ? Zt.set(Wv, 0, d) : Zt.set(Wv, 0, -m)); + } + return t && Zt.copy(t, f ? Wv : Yv), f; + }, r.prototype.contain = function(e, t) { + var n = this; + return e >= n.x && e <= n.x + n.width && t >= n.y && t <= n.y + n.height; + }, r.prototype.clone = function() { + return new r(this.x, this.y, this.width, this.height); + }, r.prototype.copy = function(e) { + r.copy(this, e); + }, r.prototype.plain = function() { + return { + x: this.x, + y: this.y, + width: this.width, + height: this.height + }; + }, r.prototype.isFinite = function() { + return isFinite(this.x) && isFinite(this.y) && isFinite(this.width) && isFinite(this.height); + }, r.prototype.isZero = function() { + return this.width === 0 || this.height === 0; + }, r.create = function(e) { + return new r(e.x, e.y, e.width, e.height); + }, r.copy = function(e, t) { + e.x = t.x, e.y = t.y, e.width = t.width, e.height = t.height; + }, r.applyTransform = function(e, t, n) { + if (!n) { + e !== t && r.copy(e, t); + return; + } + if (n[1] < 1e-5 && n[1] > -1e-5 && n[2] < 1e-5 && n[2] > -1e-5) { + var i = n[0], a = n[3], o = n[4], s = n[5]; + e.x = t.x * i + o, e.y = t.y * a + s, e.width = t.width * i, e.height = t.height * a, e.width < 0 && (e.x += e.width, e.width = -e.width), e.height < 0 && (e.y += e.height, e.height = -e.height); + return; + } + $c.x = Vc.x = t.x, $c.y = Gc.y = t.y, Hc.x = Gc.x = t.x + t.width, Hc.y = Vc.y = t.y + t.height, $c.transform(n), Gc.transform(n), Hc.transform(n), Vc.transform(n), e.x = _y($c.x, Hc.x, Vc.x, Gc.x), e.y = _y($c.y, Hc.y, Vc.y, Gc.y); + var l = by($c.x, Hc.x, Vc.x, Gc.x), u = by($c.y, Hc.y, Vc.y, Gc.y); + e.width = l - e.x, e.height = u - e.y; + }, r; +}(); +const Wt = eX; +var yj = "silent"; +function tX(r, e, t) { + return { + type: r, + event: t, + target: e.target, + topTarget: e.topTarget, + cancelBubble: !1, + offsetX: t.zrX, + offsetY: t.zrY, + gestureEvent: t.gestureEvent, + pinchX: t.pinchX, + pinchY: t.pinchY, + pinchScale: t.pinchScale, + wheelDelta: t.zrDelta, + zrByTouch: t.zrByTouch, + which: t.which, + stop: rX + }; +} +function rX() { + eu(this.event); +} +var nX = function(r) { + En(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.handler = null, t; + } + return e.prototype.dispose = function() { + }, e.prototype.setCursor = function() { + }, e; +}(rs), Xv = function() { + function r(e, t) { + this.x = e, this.y = t; + } + return r; +}(), iX = [ + "click", + "dblclick", + "mousewheel", + "mouseout", + "mouseup", + "mousedown", + "mousemove", + "contextmenu" +], oS = new Wt(0, 0, 0, 0), _j = function(r) { + En(e, r); + function e(t, n, i, a, o) { + var s = r.call(this) || this; + return s._hovered = new Xv(0, 0), s.storage = t, s.painter = n, s.painterRoot = a, s._pointerSize = o, i = i || new nX(), s.proxy = null, s.setHandlerProxy(i), s._draggingMgr = new j7(s), s; + } + return e.prototype.setHandlerProxy = function(t) { + this.proxy && this.proxy.dispose(), t && (X(iX, function(n) { + t.on && t.on(n, this[n], this); + }, this), t.handler = this), this.proxy = t; + }, e.prototype.mousemove = function(t) { + var n = t.zrX, i = t.zrY, a = bj(this, n, i), o = this._hovered, s = o.target; + s && !s.__zr && (o = this.findHover(o.x, o.y), s = o.target); + var l = this._hovered = a ? new Xv(n, i) : this.findHover(n, i), u = l.target, c = this.proxy; + c.setCursor && c.setCursor(u ? u.cursor : "default"), s && u !== s && this.dispatchToElement(o, "mouseout", t), this.dispatchToElement(l, "mousemove", t), u && u !== s && this.dispatchToElement(l, "mouseover", t); + }, e.prototype.mouseout = function(t) { + var n = t.zrEventControl; + n !== "only_globalout" && this.dispatchToElement(this._hovered, "mouseout", t), n !== "no_globalout" && this.trigger("globalout", { type: "globalout", event: t }); + }, e.prototype.resize = function() { + this._hovered = new Xv(0, 0); + }, e.prototype.dispatch = function(t, n) { + var i = this[t]; + i && i.call(this, n); + }, e.prototype.dispose = function() { + this.proxy.dispose(), this.storage = null, this.proxy = null, this.painter = null; + }, e.prototype.setCursorStyle = function(t) { + var n = this.proxy; + n.setCursor && n.setCursor(t); + }, e.prototype.dispatchToElement = function(t, n, i) { + t = t || {}; + var a = t.target; + if (!(a && a.silent)) { + for (var o = "on" + n, s = tX(n, t, i); a && (a[o] && (s.cancelBubble = !!a[o].call(a, s)), a.trigger(n, s), a = a.__hostTarget ? a.__hostTarget : a.parent, !s.cancelBubble); ) + ; + s.cancelBubble || (this.trigger(n, s), this.painter && this.painter.eachOtherLayer && this.painter.eachOtherLayer(function(l) { + typeof l[o] == "function" && l[o].call(l, s), l.trigger && l.trigger(n, s); + })); + } + }, e.prototype.findHover = function(t, n, i) { + var a = this.storage.getDisplayList(), o = new Xv(t, n); + if (YD(a, o, t, n, i), this._pointerSize && !o.target) { + for (var s = [], l = this._pointerSize, u = l / 2, c = new Wt(t - u, n - u, l, l), h = a.length - 1; h >= 0; h--) { + var f = a[h]; + f !== i && !f.ignore && !f.ignoreCoarsePointer && (!f.parent || !f.parent.ignoreCoarsePointer) && (oS.copy(f.getBoundingRect()), f.transform && oS.applyTransform(f.transform), oS.intersect(c) && s.push(f)); + } + if (s.length) + for (var v = 4, b = Math.PI / 12, w = Math.PI * 2, p = 0; p < u; p += v) + for (var d = 0; d < w; d += b) { + var m = t + p * Math.cos(d), _ = n + p * Math.sin(d); + if (YD(s, o, m, _, i), o.target) + return o; + } + } + return o; + }, e.prototype.processGesture = function(t, n) { + this._gestureMgr || (this._gestureMgr = new K7()); + var i = this._gestureMgr; + n === "start" && i.clear(); + var a = i.recognize(t, this.findHover(t.zrX, t.zrY, null).target, this.proxy.dom); + if (n === "end" && i.clear(), a) { + var o = a.type; + t.gestureEvent = o; + var s = new Xv(); + s.target = a.target, this.dispatchToElement(s, o, a.event); + } + }, e; +}(rs); +X(["click", "mousedown", "mouseup", "mousewheel", "dblclick", "contextmenu"], function(r) { + _j.prototype[r] = function(e) { + var t = e.zrX, n = e.zrY, i = bj(this, t, n), a, o; + if ((r !== "mouseup" || !i) && (a = this.findHover(t, n), o = a.target), r === "mousedown") + this._downEl = o, this._downPoint = [e.zrX, e.zrY], this._upEl = o; + else if (r === "mouseup") + this._upEl = o; + else if (r === "click") { + if (this._downEl !== this._upEl || !this._downPoint || Gl(this._downPoint, [e.zrX, e.zrY]) > 4) + return; + this._downPoint = null; + } + this.dispatchToElement(a, r, e); + }; +}); +function aX(r, e, t) { + if (r[r.rectHover ? "rectContain" : "contain"](e, t)) { + for (var n = r, i = void 0, a = !1; n; ) { + if (n.ignoreClip && (a = !0), !a) { + var o = n.getClipPath(); + if (o && !o.contain(e, t)) + return !1; + n.silent && (i = !0); + } + var s = n.__hostTarget; + n = s || n.parent; + } + return i ? yj : !0; + } + return !1; +} +function YD(r, e, t, n, i) { + for (var a = r.length - 1; a >= 0; a--) { + var o = r[a], s = void 0; + if (o !== i && !o.ignore && (s = aX(o, t, n)) && (!e.topTarget && (e.topTarget = o), s !== yj)) { + e.target = o; + break; + } + } +} +function bj(r, e, t) { + var n = r.painter; + return e < 0 || e > n.getWidth() || t < 0 || t > n.getHeight(); +} +const oX = _j; +var xj = 32, Zv = 7; +function sX(r) { + for (var e = 0; r >= xj; ) + e |= r & 1, r >>= 1; + return r + e; +} +function XD(r, e, t, n) { + var i = e + 1; + if (i === t) + return 1; + if (n(r[i++], r[e]) < 0) { + for (; i < t && n(r[i], r[i - 1]) < 0; ) + i++; + lX(r, e, i); + } else + for (; i < t && n(r[i], r[i - 1]) >= 0; ) + i++; + return i - e; +} +function lX(r, e, t) { + for (t--; e < t; ) { + var n = r[e]; + r[e++] = r[t], r[t--] = n; + } +} +function ZD(r, e, t, n, i) { + for (n === e && n++; n < t; n++) { + for (var a = r[n], o = e, s = n, l; o < s; ) + l = o + s >>> 1, i(a, r[l]) < 0 ? s = l : o = l + 1; + var u = n - o; + switch (u) { + case 3: + r[o + 3] = r[o + 2]; + case 2: + r[o + 2] = r[o + 1]; + case 1: + r[o + 1] = r[o]; + break; + default: + for (; u > 0; ) + r[o + u] = r[o + u - 1], u--; + } + r[o] = a; + } +} +function sS(r, e, t, n, i, a) { + var o = 0, s = 0, l = 1; + if (a(r, e[t + i]) > 0) { + for (s = n - i; l < s && a(r, e[t + i + l]) > 0; ) + o = l, l = (l << 1) + 1, l <= 0 && (l = s); + l > s && (l = s), o += i, l += i; + } else { + for (s = i + 1; l < s && a(r, e[t + i - l]) <= 0; ) + o = l, l = (l << 1) + 1, l <= 0 && (l = s); + l > s && (l = s); + var u = o; + o = i - l, l = i - u; + } + for (o++; o < l; ) { + var c = o + (l - o >>> 1); + a(r, e[t + c]) > 0 ? o = c + 1 : l = c; + } + return l; +} +function lS(r, e, t, n, i, a) { + var o = 0, s = 0, l = 1; + if (a(r, e[t + i]) < 0) { + for (s = i + 1; l < s && a(r, e[t + i - l]) < 0; ) + o = l, l = (l << 1) + 1, l <= 0 && (l = s); + l > s && (l = s); + var u = o; + o = i - l, l = i - u; + } else { + for (s = n - i; l < s && a(r, e[t + i + l]) >= 0; ) + o = l, l = (l << 1) + 1, l <= 0 && (l = s); + l > s && (l = s), o += i, l += i; + } + for (o++; o < l; ) { + var c = o + (l - o >>> 1); + a(r, e[t + c]) < 0 ? l = c : o = c + 1; + } + return l; +} +function uX(r, e) { + var t = Zv, n, i, a = 0; + r.length; + var o = []; + n = [], i = []; + function s(v, b) { + n[a] = v, i[a] = b, a += 1; + } + function l() { + for (; a > 1; ) { + var v = a - 2; + if (v >= 1 && i[v - 1] <= i[v] + i[v + 1] || v >= 2 && i[v - 2] <= i[v] + i[v - 1]) + i[v - 1] < i[v + 1] && v--; + else if (i[v] > i[v + 1]) + break; + c(v); + } + } + function u() { + for (; a > 1; ) { + var v = a - 2; + v > 0 && i[v - 1] < i[v + 1] && v--, c(v); + } + } + function c(v) { + var b = n[v], w = i[v], p = n[v + 1], d = i[v + 1]; + i[v] = w + d, v === a - 3 && (n[v + 1] = n[v + 2], i[v + 1] = i[v + 2]), a--; + var m = lS(r[p], r, b, w, 0, e); + b += m, w -= m, w !== 0 && (d = sS(r[b + w - 1], r, p, d, d - 1, e), d !== 0 && (w <= d ? h(b, w, p, d) : f(b, w, p, d))); + } + function h(v, b, w, p) { + var d = 0; + for (d = 0; d < b; d++) + o[d] = r[v + d]; + var m = 0, _ = w, y = v; + if (r[y++] = r[_++], --p === 0) { + for (d = 0; d < b; d++) + r[y + d] = o[m + d]; + return; + } + if (b === 1) { + for (d = 0; d < p; d++) + r[y + d] = r[_ + d]; + r[y + p] = o[m]; + return; + } + for (var x = t, g, S, T; ; ) { + g = 0, S = 0, T = !1; + do + if (e(r[_], o[m]) < 0) { + if (r[y++] = r[_++], S++, g = 0, --p === 0) { + T = !0; + break; + } + } else if (r[y++] = o[m++], g++, S = 0, --b === 1) { + T = !0; + break; + } + while ((g | S) < x); + if (T) + break; + do { + if (g = lS(r[_], o, m, b, 0, e), g !== 0) { + for (d = 0; d < g; d++) + r[y + d] = o[m + d]; + if (y += g, m += g, b -= g, b <= 1) { + T = !0; + break; + } + } + if (r[y++] = r[_++], --p === 0) { + T = !0; + break; + } + if (S = sS(o[m], r, _, p, 0, e), S !== 0) { + for (d = 0; d < S; d++) + r[y + d] = r[_ + d]; + if (y += S, _ += S, p -= S, p === 0) { + T = !0; + break; + } + } + if (r[y++] = o[m++], --b === 1) { + T = !0; + break; + } + x--; + } while (g >= Zv || S >= Zv); + if (T) + break; + x < 0 && (x = 0), x += 2; + } + if (t = x, t < 1 && (t = 1), b === 1) { + for (d = 0; d < p; d++) + r[y + d] = r[_ + d]; + r[y + p] = o[m]; + } else { + if (b === 0) + throw new Error(); + for (d = 0; d < b; d++) + r[y + d] = o[m + d]; + } + } + function f(v, b, w, p) { + var d = 0; + for (d = 0; d < p; d++) + o[d] = r[w + d]; + var m = v + b - 1, _ = p - 1, y = w + p - 1, x = 0, g = 0; + if (r[y--] = r[m--], --b === 0) { + for (x = y - (p - 1), d = 0; d < p; d++) + r[x + d] = o[d]; + return; + } + if (p === 1) { + for (y -= b, m -= b, g = y + 1, x = m + 1, d = b - 1; d >= 0; d--) + r[g + d] = r[x + d]; + r[y] = o[_]; + return; + } + for (var S = t; ; ) { + var T = 0, C = 0, E = !1; + do + if (e(o[_], r[m]) < 0) { + if (r[y--] = r[m--], T++, C = 0, --b === 0) { + E = !0; + break; + } + } else if (r[y--] = o[_--], C++, T = 0, --p === 1) { + E = !0; + break; + } + while ((T | C) < S); + if (E) + break; + do { + if (T = b - lS(o[_], r, v, b, b - 1, e), T !== 0) { + for (y -= T, m -= T, b -= T, g = y + 1, x = m + 1, d = T - 1; d >= 0; d--) + r[g + d] = r[x + d]; + if (b === 0) { + E = !0; + break; + } + } + if (r[y--] = o[_--], --p === 1) { + E = !0; + break; + } + if (C = p - sS(r[m], o, 0, p, p - 1, e), C !== 0) { + for (y -= C, _ -= C, p -= C, g = y + 1, x = _ + 1, d = 0; d < C; d++) + r[g + d] = o[x + d]; + if (p <= 1) { + E = !0; + break; + } + } + if (r[y--] = r[m--], --b === 0) { + E = !0; + break; + } + S--; + } while (T >= Zv || C >= Zv); + if (E) + break; + S < 0 && (S = 0), S += 2; + } + if (t = S, t < 1 && (t = 1), p === 1) { + for (y -= b, m -= b, g = y + 1, x = m + 1, d = b - 1; d >= 0; d--) + r[g + d] = r[x + d]; + r[y] = o[_]; + } else { + if (p === 0) + throw new Error(); + for (x = y - (p - 1), d = 0; d < p; d++) + r[x + d] = o[d]; + } + } + return { + mergeRuns: l, + forceMergeRuns: u, + pushRun: s + }; +} +function k0(r, e, t, n) { + t || (t = 0), n || (n = r.length); + var i = n - t; + if (!(i < 2)) { + var a = 0; + if (i < xj) { + a = XD(r, t, n, e), ZD(r, t, n, t + a, e); + return; + } + var o = uX(r, e), s = sX(i); + do { + if (a = XD(r, t, n, e), a < s) { + var l = i; + l > s && (l = s), ZD(r, t, t + l, t + a, e), a = l; + } + o.pushRun(t, a), o.mergeRuns(), i -= a, t += a; + } while (i !== 0); + o.forceMergeRuns(); + } +} +var go = 1, Cp = 2, ad = 4, JD = !1; +function uS() { + JD || (JD = !0, console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors")); +} +function KD(r, e) { + return r.zlevel === e.zlevel ? r.z === e.z ? r.z2 - e.z2 : r.z - e.z : r.zlevel - e.zlevel; +} +var cX = function() { + function r() { + this._roots = [], this._displayList = [], this._displayListLen = 0, this.displayableSortFunc = KD; + } + return r.prototype.traverse = function(e, t) { + for (var n = 0; n < this._roots.length; n++) + this._roots[n].traverse(e, t); + }, r.prototype.getDisplayList = function(e, t) { + t = t || !1; + var n = this._displayList; + return (e || !n.length) && this.updateDisplayList(t), n; + }, r.prototype.updateDisplayList = function(e) { + this._displayListLen = 0; + for (var t = this._roots, n = this._displayList, i = 0, a = t.length; i < a; i++) + this._updateAndAddDisplayable(t[i], null, e); + n.length = this._displayListLen, k0(n, KD); + }, r.prototype._updateAndAddDisplayable = function(e, t, n) { + if (!(e.ignore && !n)) { + e.beforeUpdate(), e.update(), e.afterUpdate(); + var i = e.getClipPath(); + if (e.ignoreClip) + t = null; + else if (i) { + t ? t = t.slice() : t = []; + for (var a = i, o = e; a; ) + a.parent = o, a.updateTransform(), t.push(a), o = a, a = a.getClipPath(); + } + if (e.childrenRef) { + for (var s = e.childrenRef(), l = 0; l < s.length; l++) { + var u = s[l]; + e.__dirty && (u.__dirty |= go), this._updateAndAddDisplayable(u, t, n); + } + e.__dirty = 0; + } else { + var c = e; + t && t.length ? c.__clipPaths = t : c.__clipPaths && c.__clipPaths.length > 0 && (c.__clipPaths = []), isNaN(c.z) && (uS(), c.z = 0), isNaN(c.z2) && (uS(), c.z2 = 0), isNaN(c.zlevel) && (uS(), c.zlevel = 0), this._displayList[this._displayListLen++] = c; + } + var h = e.getDecalElement && e.getDecalElement(); + h && this._updateAndAddDisplayable(h, t, n); + var f = e.getTextGuideLine(); + f && this._updateAndAddDisplayable(f, t, n); + var v = e.getTextContent(); + v && this._updateAndAddDisplayable(v, t, n); + } + }, r.prototype.addRoot = function(e) { + e.__zr && e.__zr.storage === this || this._roots.push(e); + }, r.prototype.delRoot = function(e) { + if (e instanceof Array) { + for (var t = 0, n = e.length; t < n; t++) + this.delRoot(e[t]); + return; + } + var i = ir(this._roots, e); + i >= 0 && this._roots.splice(i, 1); + }, r.prototype.delAllRoots = function() { + this._roots = [], this._displayList = [], this._displayListLen = 0; + }, r.prototype.getRoots = function() { + return this._roots; + }, r.prototype.dispose = function() { + this._displayList = null, this._roots = null; + }, r; +}(); +const hX = cX; +var Sj; +Sj = Dr.hasGlobalWindow && (window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window) || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame) || function(r) { + return setTimeout(r, 16); +}; +const f1 = Sj; +var O0 = { + linear: function(r) { + return r; + }, + quadraticIn: function(r) { + return r * r; + }, + quadraticOut: function(r) { + return r * (2 - r); + }, + quadraticInOut: function(r) { + return (r *= 2) < 1 ? 0.5 * r * r : -0.5 * (--r * (r - 2) - 1); + }, + cubicIn: function(r) { + return r * r * r; + }, + cubicOut: function(r) { + return --r * r * r + 1; + }, + cubicInOut: function(r) { + return (r *= 2) < 1 ? 0.5 * r * r * r : 0.5 * ((r -= 2) * r * r + 2); + }, + quarticIn: function(r) { + return r * r * r * r; + }, + quarticOut: function(r) { + return 1 - --r * r * r * r; + }, + quarticInOut: function(r) { + return (r *= 2) < 1 ? 0.5 * r * r * r * r : -0.5 * ((r -= 2) * r * r * r - 2); + }, + quinticIn: function(r) { + return r * r * r * r * r; + }, + quinticOut: function(r) { + return --r * r * r * r * r + 1; + }, + quinticInOut: function(r) { + return (r *= 2) < 1 ? 0.5 * r * r * r * r * r : 0.5 * ((r -= 2) * r * r * r * r + 2); + }, + sinusoidalIn: function(r) { + return 1 - Math.cos(r * Math.PI / 2); + }, + sinusoidalOut: function(r) { + return Math.sin(r * Math.PI / 2); + }, + sinusoidalInOut: function(r) { + return 0.5 * (1 - Math.cos(Math.PI * r)); + }, + exponentialIn: function(r) { + return r === 0 ? 0 : Math.pow(1024, r - 1); + }, + exponentialOut: function(r) { + return r === 1 ? 1 : 1 - Math.pow(2, -10 * r); + }, + exponentialInOut: function(r) { + return r === 0 ? 0 : r === 1 ? 1 : (r *= 2) < 1 ? 0.5 * Math.pow(1024, r - 1) : 0.5 * (-Math.pow(2, -10 * (r - 1)) + 2); + }, + circularIn: function(r) { + return 1 - Math.sqrt(1 - r * r); + }, + circularOut: function(r) { + return Math.sqrt(1 - --r * r); + }, + circularInOut: function(r) { + return (r *= 2) < 1 ? -0.5 * (Math.sqrt(1 - r * r) - 1) : 0.5 * (Math.sqrt(1 - (r -= 2) * r) + 1); + }, + elasticIn: function(r) { + var e, t = 0.1, n = 0.4; + return r === 0 ? 0 : r === 1 ? 1 : (!t || t < 1 ? (t = 1, e = n / 4) : e = n * Math.asin(1 / t) / (2 * Math.PI), -(t * Math.pow(2, 10 * (r -= 1)) * Math.sin((r - e) * (2 * Math.PI) / n))); + }, + elasticOut: function(r) { + var e, t = 0.1, n = 0.4; + return r === 0 ? 0 : r === 1 ? 1 : (!t || t < 1 ? (t = 1, e = n / 4) : e = n * Math.asin(1 / t) / (2 * Math.PI), t * Math.pow(2, -10 * r) * Math.sin((r - e) * (2 * Math.PI) / n) + 1); + }, + elasticInOut: function(r) { + var e, t = 0.1, n = 0.4; + return r === 0 ? 0 : r === 1 ? 1 : (!t || t < 1 ? (t = 1, e = n / 4) : e = n * Math.asin(1 / t) / (2 * Math.PI), (r *= 2) < 1 ? -0.5 * (t * Math.pow(2, 10 * (r -= 1)) * Math.sin((r - e) * (2 * Math.PI) / n)) : t * Math.pow(2, -10 * (r -= 1)) * Math.sin((r - e) * (2 * Math.PI) / n) * 0.5 + 1); + }, + backIn: function(r) { + var e = 1.70158; + return r * r * ((e + 1) * r - e); + }, + backOut: function(r) { + var e = 1.70158; + return --r * r * ((e + 1) * r + e) + 1; + }, + backInOut: function(r) { + var e = 2.5949095; + return (r *= 2) < 1 ? 0.5 * (r * r * ((e + 1) * r - e)) : 0.5 * ((r -= 2) * r * ((e + 1) * r + e) + 2); + }, + bounceIn: function(r) { + return 1 - O0.bounceOut(1 - r); + }, + bounceOut: function(r) { + return r < 1 / 2.75 ? 7.5625 * r * r : r < 2 / 2.75 ? 7.5625 * (r -= 1.5 / 2.75) * r + 0.75 : r < 2.5 / 2.75 ? 7.5625 * (r -= 2.25 / 2.75) * r + 0.9375 : 7.5625 * (r -= 2.625 / 2.75) * r + 0.984375; + }, + bounceInOut: function(r) { + return r < 0.5 ? O0.bounceIn(r * 2) * 0.5 : O0.bounceOut(r * 2 - 1) * 0.5 + 0.5; + } +}; +const wj = O0; +var xy = Math.pow, ic = Math.sqrt, c_ = 1e-8, Cj = 1e-4, QD = ic(3), Sy = 1 / 3, vl = Sc(), Xo = Sc(), _d = Sc(); +function Xu(r) { + return r > -c_ && r < c_; +} +function Tj(r) { + return r > c_ || r < -c_; +} +function Ti(r, e, t, n, i) { + var a = 1 - i; + return a * a * (a * r + 3 * i * e) + i * i * (i * n + 3 * a * t); +} +function qD(r, e, t, n, i) { + var a = 1 - i; + return 3 * (((e - r) * a + 2 * (t - e) * i) * a + (n - t) * i * i); +} +function h_(r, e, t, n, i, a) { + var o = n + 3 * (e - t) - r, s = 3 * (t - e * 2 + r), l = 3 * (e - r), u = r - i, c = s * s - 3 * o * l, h = s * l - 9 * o * u, f = l * l - 3 * s * u, v = 0; + if (Xu(c) && Xu(h)) + if (Xu(s)) + a[0] = 0; + else { + var b = -l / s; + b >= 0 && b <= 1 && (a[v++] = b); + } + else { + var w = h * h - 4 * c * f; + if (Xu(w)) { + var p = h / c, b = -s / o + p, d = -p / 2; + b >= 0 && b <= 1 && (a[v++] = b), d >= 0 && d <= 1 && (a[v++] = d); + } else if (w > 0) { + var m = ic(w), _ = c * s + 1.5 * o * (-h + m), y = c * s + 1.5 * o * (-h - m); + _ < 0 ? _ = -xy(-_, Sy) : _ = xy(_, Sy), y < 0 ? y = -xy(-y, Sy) : y = xy(y, Sy); + var b = (-s - (_ + y)) / (3 * o); + b >= 0 && b <= 1 && (a[v++] = b); + } else { + var x = (2 * c * s - 3 * o * h) / (2 * ic(c * c * c)), g = Math.acos(x) / 3, S = ic(c), T = Math.cos(g), b = (-s - 2 * S * T) / (3 * o), d = (-s + S * (T + QD * Math.sin(g))) / (3 * o), C = (-s + S * (T - QD * Math.sin(g))) / (3 * o); + b >= 0 && b <= 1 && (a[v++] = b), d >= 0 && d <= 1 && (a[v++] = d), C >= 0 && C <= 1 && (a[v++] = C); + } + } + return v; +} +function Ij(r, e, t, n, i) { + var a = 6 * t - 12 * e + 6 * r, o = 9 * e + 3 * n - 3 * r - 9 * t, s = 3 * e - 3 * r, l = 0; + if (Xu(o)) { + if (Tj(a)) { + var u = -s / a; + u >= 0 && u <= 1 && (i[l++] = u); + } + } else { + var c = a * a - 4 * o * s; + if (Xu(c)) + i[0] = -a / (2 * o); + else if (c > 0) { + var h = ic(c), u = (-a + h) / (2 * o), f = (-a - h) / (2 * o); + u >= 0 && u <= 1 && (i[l++] = u), f >= 0 && f <= 1 && (i[l++] = f); + } + } + return l; +} +function fc(r, e, t, n, i, a) { + var o = (e - r) * i + r, s = (t - e) * i + e, l = (n - t) * i + t, u = (s - o) * i + o, c = (l - s) * i + s, h = (c - u) * i + u; + a[0] = r, a[1] = o, a[2] = u, a[3] = h, a[4] = h, a[5] = c, a[6] = l, a[7] = n; +} +function Aj(r, e, t, n, i, a, o, s, l, u, c) { + var h, f = 5e-3, v = 1 / 0, b, w, p, d; + vl[0] = l, vl[1] = u; + for (var m = 0; m < 1; m += 0.05) + Xo[0] = Ti(r, t, i, o, m), Xo[1] = Ti(e, n, a, s, m), p = nc(vl, Xo), p < v && (h = m, v = p); + v = 1 / 0; + for (var _ = 0; _ < 32 && !(f < Cj); _++) + b = h - f, w = h + f, Xo[0] = Ti(r, t, i, o, b), Xo[1] = Ti(e, n, a, s, b), p = nc(Xo, vl), b >= 0 && p < v ? (h = b, v = p) : (_d[0] = Ti(r, t, i, o, w), _d[1] = Ti(e, n, a, s, w), d = nc(_d, vl), w <= 1 && d < v ? (h = w, v = d) : f *= 0.5); + return c && (c[0] = Ti(r, t, i, o, h), c[1] = Ti(e, n, a, s, h)), ic(v); +} +function fX(r, e, t, n, i, a, o, s, l) { + for (var u = r, c = e, h = 0, f = 1 / l, v = 1; v <= l; v++) { + var b = v * f, w = Ti(r, t, i, o, b), p = Ti(e, n, a, s, b), d = w - u, m = p - c; + h += Math.sqrt(d * d + m * m), u = w, c = p; + } + return h; +} +function Ri(r, e, t, n) { + var i = 1 - n; + return i * (i * r + 2 * n * e) + n * n * t; +} +function d1(r, e, t, n) { + return 2 * ((1 - n) * (e - r) + n * (t - e)); +} +function dX(r, e, t, n, i) { + var a = r - 2 * e + t, o = 2 * (e - r), s = r - n, l = 0; + if (Xu(a)) { + if (Tj(o)) { + var u = -s / o; + u >= 0 && u <= 1 && (i[l++] = u); + } + } else { + var c = o * o - 4 * a * s; + if (Xu(c)) { + var u = -o / (2 * a); + u >= 0 && u <= 1 && (i[l++] = u); + } else if (c > 0) { + var h = ic(c), u = (-o + h) / (2 * a), f = (-o - h) / (2 * a); + u >= 0 && u <= 1 && (i[l++] = u), f >= 0 && f <= 1 && (i[l++] = f); + } + } + return l; +} +function Ej(r, e, t) { + var n = r + t - 2 * e; + return n === 0 ? 0.5 : (r - e) / n; +} +function sg(r, e, t, n, i) { + var a = (e - r) * n + r, o = (t - e) * n + e, s = (o - a) * n + a; + i[0] = r, i[1] = a, i[2] = s, i[3] = s, i[4] = o, i[5] = t; +} +function Mj(r, e, t, n, i, a, o, s, l) { + var u, c = 5e-3, h = 1 / 0; + vl[0] = o, vl[1] = s; + for (var f = 0; f < 1; f += 0.05) { + Xo[0] = Ri(r, t, i, f), Xo[1] = Ri(e, n, a, f); + var v = nc(vl, Xo); + v < h && (u = f, h = v); + } + h = 1 / 0; + for (var b = 0; b < 32 && !(c < Cj); b++) { + var w = u - c, p = u + c; + Xo[0] = Ri(r, t, i, w), Xo[1] = Ri(e, n, a, w); + var v = nc(Xo, vl); + if (w >= 0 && v < h) + u = w, h = v; + else { + _d[0] = Ri(r, t, i, p), _d[1] = Ri(e, n, a, p); + var d = nc(_d, vl); + p <= 1 && d < h ? (u = p, h = d) : c *= 0.5; + } + } + return l && (l[0] = Ri(r, t, i, u), l[1] = Ri(e, n, a, u)), ic(h); +} +function vX(r, e, t, n, i, a, o) { + for (var s = r, l = e, u = 0, c = 1 / o, h = 1; h <= o; h++) { + var f = h * c, v = Ri(r, t, i, f), b = Ri(e, n, a, f), w = v - s, p = b - l; + u += Math.sqrt(w * w + p * p), s = v, l = b; + } + return u; +} +var pX = /cubic-bezier\(([0-9,\.e ]+)\)/; +function LI(r) { + var e = r && pX.exec(r); + if (e) { + var t = e[1].split(","), n = +Qo(t[0]), i = +Qo(t[1]), a = +Qo(t[2]), o = +Qo(t[3]); + if (isNaN(n + i + a + o)) + return; + var s = []; + return function(l) { + return l <= 0 ? 0 : l >= 1 ? 1 : h_(0, n, a, 1, l, s) && Ti(0, i, o, 1, s[0]); + }; + } +} +var gX = function() { + function r(e) { + this._inited = !1, this._startTime = 0, this._pausedTime = 0, this._paused = !1, this._life = e.life || 1e3, this._delay = e.delay || 0, this.loop = e.loop || !1, this.onframe = e.onframe || Qn, this.ondestroy = e.ondestroy || Qn, this.onrestart = e.onrestart || Qn, e.easing && this.setEasing(e.easing); + } + return r.prototype.step = function(e, t) { + if (this._inited || (this._startTime = e + this._delay, this._inited = !0), this._paused) { + this._pausedTime += t; + return; + } + var n = this._life, i = e - this._startTime - this._pausedTime, a = i / n; + a < 0 && (a = 0), a = Math.min(a, 1); + var o = this.easingFunc, s = o ? o(a) : a; + if (this.onframe(s), a === 1) + if (this.loop) { + var l = i % n; + this._startTime = e - l, this._pausedTime = 0, this.onrestart(); + } else + return !0; + return !1; + }, r.prototype.pause = function() { + this._paused = !0; + }, r.prototype.resume = function() { + this._paused = !1; + }, r.prototype.setEasing = function(e) { + this.easing = e, this.easingFunc = Tt(e) ? e : wj[e] || LI(e); + }, r; +}(); +const mX = gX; +var Dj = function() { + function r(e) { + this.value = e; + } + return r; +}(), yX = function() { + function r() { + this._len = 0; + } + return r.prototype.insert = function(e) { + var t = new Dj(e); + return this.insertEntry(t), t; + }, r.prototype.insertEntry = function(e) { + this.head ? (this.tail.next = e, e.prev = this.tail, e.next = null, this.tail = e) : this.head = this.tail = e, this._len++; + }, r.prototype.remove = function(e) { + var t = e.prev, n = e.next; + t ? t.next = n : this.head = n, n ? n.prev = t : this.tail = t, e.next = e.prev = null, this._len--; + }, r.prototype.len = function() { + return this._len; + }, r.prototype.clear = function() { + this.head = this.tail = null, this._len = 0; + }, r; +}(), _X = function() { + function r(e) { + this._list = new yX(), this._maxSize = 10, this._map = {}, this._maxSize = e; + } + return r.prototype.put = function(e, t) { + var n = this._list, i = this._map, a = null; + if (i[e] == null) { + var o = n.len(), s = this._lastRemovedEntry; + if (o >= this._maxSize && o > 0) { + var l = n.head; + n.remove(l), delete i[l.key], a = l.value, this._lastRemovedEntry = l; + } + s ? s.value = t : s = new Dj(t), s.key = e, n.insertEntry(s), i[e] = s; + } + return a; + }, r.prototype.get = function(e) { + var t = this._map[e], n = this._list; + if (t != null) + return t !== n.tail && (n.remove(t), n.insertEntry(t)), t.value; + }, r.prototype.clear = function() { + this._list.clear(), this._map = {}; + }, r.prototype.len = function() { + return this._list.len(); + }, r; +}(); +const Xg = _X; +var ek = { + transparent: [0, 0, 0, 0], + aliceblue: [240, 248, 255, 1], + antiquewhite: [250, 235, 215, 1], + aqua: [0, 255, 255, 1], + aquamarine: [127, 255, 212, 1], + azure: [240, 255, 255, 1], + beige: [245, 245, 220, 1], + bisque: [255, 228, 196, 1], + black: [0, 0, 0, 1], + blanchedalmond: [255, 235, 205, 1], + blue: [0, 0, 255, 1], + blueviolet: [138, 43, 226, 1], + brown: [165, 42, 42, 1], + burlywood: [222, 184, 135, 1], + cadetblue: [95, 158, 160, 1], + chartreuse: [127, 255, 0, 1], + chocolate: [210, 105, 30, 1], + coral: [255, 127, 80, 1], + cornflowerblue: [100, 149, 237, 1], + cornsilk: [255, 248, 220, 1], + crimson: [220, 20, 60, 1], + cyan: [0, 255, 255, 1], + darkblue: [0, 0, 139, 1], + darkcyan: [0, 139, 139, 1], + darkgoldenrod: [184, 134, 11, 1], + darkgray: [169, 169, 169, 1], + darkgreen: [0, 100, 0, 1], + darkgrey: [169, 169, 169, 1], + darkkhaki: [189, 183, 107, 1], + darkmagenta: [139, 0, 139, 1], + darkolivegreen: [85, 107, 47, 1], + darkorange: [255, 140, 0, 1], + darkorchid: [153, 50, 204, 1], + darkred: [139, 0, 0, 1], + darksalmon: [233, 150, 122, 1], + darkseagreen: [143, 188, 143, 1], + darkslateblue: [72, 61, 139, 1], + darkslategray: [47, 79, 79, 1], + darkslategrey: [47, 79, 79, 1], + darkturquoise: [0, 206, 209, 1], + darkviolet: [148, 0, 211, 1], + deeppink: [255, 20, 147, 1], + deepskyblue: [0, 191, 255, 1], + dimgray: [105, 105, 105, 1], + dimgrey: [105, 105, 105, 1], + dodgerblue: [30, 144, 255, 1], + firebrick: [178, 34, 34, 1], + floralwhite: [255, 250, 240, 1], + forestgreen: [34, 139, 34, 1], + fuchsia: [255, 0, 255, 1], + gainsboro: [220, 220, 220, 1], + ghostwhite: [248, 248, 255, 1], + gold: [255, 215, 0, 1], + goldenrod: [218, 165, 32, 1], + gray: [128, 128, 128, 1], + green: [0, 128, 0, 1], + greenyellow: [173, 255, 47, 1], + grey: [128, 128, 128, 1], + honeydew: [240, 255, 240, 1], + hotpink: [255, 105, 180, 1], + indianred: [205, 92, 92, 1], + indigo: [75, 0, 130, 1], + ivory: [255, 255, 240, 1], + khaki: [240, 230, 140, 1], + lavender: [230, 230, 250, 1], + lavenderblush: [255, 240, 245, 1], + lawngreen: [124, 252, 0, 1], + lemonchiffon: [255, 250, 205, 1], + lightblue: [173, 216, 230, 1], + lightcoral: [240, 128, 128, 1], + lightcyan: [224, 255, 255, 1], + lightgoldenrodyellow: [250, 250, 210, 1], + lightgray: [211, 211, 211, 1], + lightgreen: [144, 238, 144, 1], + lightgrey: [211, 211, 211, 1], + lightpink: [255, 182, 193, 1], + lightsalmon: [255, 160, 122, 1], + lightseagreen: [32, 178, 170, 1], + lightskyblue: [135, 206, 250, 1], + lightslategray: [119, 136, 153, 1], + lightslategrey: [119, 136, 153, 1], + lightsteelblue: [176, 196, 222, 1], + lightyellow: [255, 255, 224, 1], + lime: [0, 255, 0, 1], + limegreen: [50, 205, 50, 1], + linen: [250, 240, 230, 1], + magenta: [255, 0, 255, 1], + maroon: [128, 0, 0, 1], + mediumaquamarine: [102, 205, 170, 1], + mediumblue: [0, 0, 205, 1], + mediumorchid: [186, 85, 211, 1], + mediumpurple: [147, 112, 219, 1], + mediumseagreen: [60, 179, 113, 1], + mediumslateblue: [123, 104, 238, 1], + mediumspringgreen: [0, 250, 154, 1], + mediumturquoise: [72, 209, 204, 1], + mediumvioletred: [199, 21, 133, 1], + midnightblue: [25, 25, 112, 1], + mintcream: [245, 255, 250, 1], + mistyrose: [255, 228, 225, 1], + moccasin: [255, 228, 181, 1], + navajowhite: [255, 222, 173, 1], + navy: [0, 0, 128, 1], + oldlace: [253, 245, 230, 1], + olive: [128, 128, 0, 1], + olivedrab: [107, 142, 35, 1], + orange: [255, 165, 0, 1], + orangered: [255, 69, 0, 1], + orchid: [218, 112, 214, 1], + palegoldenrod: [238, 232, 170, 1], + palegreen: [152, 251, 152, 1], + paleturquoise: [175, 238, 238, 1], + palevioletred: [219, 112, 147, 1], + papayawhip: [255, 239, 213, 1], + peachpuff: [255, 218, 185, 1], + peru: [205, 133, 63, 1], + pink: [255, 192, 203, 1], + plum: [221, 160, 221, 1], + powderblue: [176, 224, 230, 1], + purple: [128, 0, 128, 1], + red: [255, 0, 0, 1], + rosybrown: [188, 143, 143, 1], + royalblue: [65, 105, 225, 1], + saddlebrown: [139, 69, 19, 1], + salmon: [250, 128, 114, 1], + sandybrown: [244, 164, 96, 1], + seagreen: [46, 139, 87, 1], + seashell: [255, 245, 238, 1], + sienna: [160, 82, 45, 1], + silver: [192, 192, 192, 1], + skyblue: [135, 206, 235, 1], + slateblue: [106, 90, 205, 1], + slategray: [112, 128, 144, 1], + slategrey: [112, 128, 144, 1], + snow: [255, 250, 250, 1], + springgreen: [0, 255, 127, 1], + steelblue: [70, 130, 180, 1], + tan: [210, 180, 140, 1], + teal: [0, 128, 128, 1], + thistle: [216, 191, 216, 1], + tomato: [255, 99, 71, 1], + turquoise: [64, 224, 208, 1], + violet: [238, 130, 238, 1], + wheat: [245, 222, 179, 1], + white: [255, 255, 255, 1], + whitesmoke: [245, 245, 245, 1], + yellow: [255, 255, 0, 1], + yellowgreen: [154, 205, 50, 1] +}; +function Rs(r) { + return r = Math.round(r), r < 0 ? 0 : r > 255 ? 255 : r; +} +function bX(r) { + return r = Math.round(r), r < 0 ? 0 : r > 360 ? 360 : r; +} +function lg(r) { + return r < 0 ? 0 : r > 1 ? 1 : r; +} +function cS(r) { + var e = r; + return e.length && e.charAt(e.length - 1) === "%" ? Rs(parseFloat(e) / 100 * 255) : Rs(parseInt(e, 10)); +} +function Lh(r) { + var e = r; + return e.length && e.charAt(e.length - 1) === "%" ? lg(parseFloat(e) / 100) : lg(parseFloat(e)); +} +function hS(r, e, t) { + return t < 0 ? t += 1 : t > 1 && (t -= 1), t * 6 < 1 ? r + (e - r) * t * 6 : t * 2 < 1 ? e : t * 3 < 2 ? r + (e - r) * (2 / 3 - t) * 6 : r; +} +function Zu(r, e, t) { + return r + (e - r) * t; +} +function Vo(r, e, t, n, i) { + return r[0] = e, r[1] = t, r[2] = n, r[3] = i, r; +} +function v1(r, e) { + return r[0] = e[0], r[1] = e[1], r[2] = e[2], r[3] = e[3], r; +} +var kj = new Xg(20), wy = null; +function Bf(r, e) { + wy && v1(wy, e), wy = kj.put(r, wy || e.slice()); +} +function Ma(r, e) { + if (r) { + e = e || []; + var t = kj.get(r); + if (t) + return v1(e, t); + r = r + ""; + var n = r.replace(/ /g, "").toLowerCase(); + if (n in ek) + return v1(e, ek[n]), Bf(r, e), e; + var i = n.length; + if (n.charAt(0) === "#") { + if (i === 4 || i === 5) { + var a = parseInt(n.slice(1, 4), 16); + if (!(a >= 0 && a <= 4095)) { + Vo(e, 0, 0, 0, 1); + return; + } + return Vo(e, (a & 3840) >> 4 | (a & 3840) >> 8, a & 240 | (a & 240) >> 4, a & 15 | (a & 15) << 4, i === 5 ? parseInt(n.slice(4), 16) / 15 : 1), Bf(r, e), e; + } else if (i === 7 || i === 9) { + var a = parseInt(n.slice(1, 7), 16); + if (!(a >= 0 && a <= 16777215)) { + Vo(e, 0, 0, 0, 1); + return; + } + return Vo(e, (a & 16711680) >> 16, (a & 65280) >> 8, a & 255, i === 9 ? parseInt(n.slice(7), 16) / 255 : 1), Bf(r, e), e; + } + return; + } + var o = n.indexOf("("), s = n.indexOf(")"); + if (o !== -1 && s + 1 === i) { + var l = n.substr(0, o), u = n.substr(o + 1, s - (o + 1)).split(","), c = 1; + switch (l) { + case "rgba": + if (u.length !== 4) + return u.length === 3 ? Vo(e, +u[0], +u[1], +u[2], 1) : Vo(e, 0, 0, 0, 1); + c = Lh(u.pop()); + case "rgb": + if (u.length >= 3) + return Vo(e, cS(u[0]), cS(u[1]), cS(u[2]), u.length === 3 ? c : Lh(u[3])), Bf(r, e), e; + Vo(e, 0, 0, 0, 1); + return; + case "hsla": + if (u.length !== 4) { + Vo(e, 0, 0, 0, 1); + return; + } + return u[3] = Lh(u[3]), p1(u, e), Bf(r, e), e; + case "hsl": + if (u.length !== 3) { + Vo(e, 0, 0, 0, 1); + return; + } + return p1(u, e), Bf(r, e), e; + default: + return; + } + } + Vo(e, 0, 0, 0, 1); + } +} +function p1(r, e) { + var t = (parseFloat(r[0]) % 360 + 360) % 360 / 360, n = Lh(r[1]), i = Lh(r[2]), a = i <= 0.5 ? i * (n + 1) : i + n - i * n, o = i * 2 - a; + return e = e || [], Vo(e, Rs(hS(o, a, t + 1 / 3) * 255), Rs(hS(o, a, t) * 255), Rs(hS(o, a, t - 1 / 3) * 255), 1), r.length === 4 && (e[3] = r[3]), e; +} +function xX(r) { + if (r) { + var e = r[0] / 255, t = r[1] / 255, n = r[2] / 255, i = Math.min(e, t, n), a = Math.max(e, t, n), o = a - i, s = (a + i) / 2, l, u; + if (o === 0) + l = 0, u = 0; + else { + s < 0.5 ? u = o / (a + i) : u = o / (2 - a - i); + var c = ((a - e) / 6 + o / 2) / o, h = ((a - t) / 6 + o / 2) / o, f = ((a - n) / 6 + o / 2) / o; + e === a ? l = f - h : t === a ? l = 1 / 3 + c - f : n === a && (l = 2 / 3 + h - c), l < 0 && (l += 1), l > 1 && (l -= 1); + } + var v = [l * 360, u, s]; + return r[3] != null && v.push(r[3]), v; + } +} +function f_(r, e) { + var t = Ma(r); + if (t) { + for (var n = 0; n < 3; n++) + e < 0 ? t[n] = t[n] * (1 - e) | 0 : t[n] = (255 - t[n]) * e + t[n] | 0, t[n] > 255 ? t[n] = 255 : t[n] < 0 && (t[n] = 0); + return Ns(t, t.length === 4 ? "rgba" : "rgb"); + } +} +function SX(r) { + var e = Ma(r); + if (e) + return ((1 << 24) + (e[0] << 16) + (e[1] << 8) + +e[2]).toString(16).slice(1); +} +function jp(r, e, t) { + if (!(!(e && e.length) || !(r >= 0 && r <= 1))) { + t = t || []; + var n = r * (e.length - 1), i = Math.floor(n), a = Math.ceil(n), o = e[i], s = e[a], l = n - i; + return t[0] = Rs(Zu(o[0], s[0], l)), t[1] = Rs(Zu(o[1], s[1], l)), t[2] = Rs(Zu(o[2], s[2], l)), t[3] = lg(Zu(o[3], s[3], l)), t; + } +} +var wX = jp; +function PI(r, e, t) { + if (!(!(e && e.length) || !(r >= 0 && r <= 1))) { + var n = r * (e.length - 1), i = Math.floor(n), a = Math.ceil(n), o = Ma(e[i]), s = Ma(e[a]), l = n - i, u = Ns([ + Rs(Zu(o[0], s[0], l)), + Rs(Zu(o[1], s[1], l)), + Rs(Zu(o[2], s[2], l)), + lg(Zu(o[3], s[3], l)) + ], "rgba"); + return t ? { + color: u, + leftIndex: i, + rightIndex: a, + value: n + } : u; + } +} +var CX = PI; +function bd(r, e, t, n) { + var i = Ma(r); + if (r) + return i = xX(i), e != null && (i[0] = bX(e)), t != null && (i[1] = Lh(t)), n != null && (i[2] = Lh(n)), Ns(p1(i), "rgba"); +} +function ug(r, e) { + var t = Ma(r); + if (t && e != null) + return t[3] = lg(e), Ns(t, "rgba"); +} +function Ns(r, e) { + if (!(!r || !r.length)) { + var t = r[0] + "," + r[1] + "," + r[2]; + return (e === "rgba" || e === "hsva" || e === "hsla") && (t += "," + r[3]), e + "(" + t + ")"; + } +} +function cg(r, e) { + var t = Ma(r); + return t ? (0.299 * t[0] + 0.587 * t[1] + 0.114 * t[2]) * t[3] / 255 + (1 - t[3]) * e : 0; +} +function TX() { + return Ns([ + Math.round(Math.random() * 255), + Math.round(Math.random() * 255), + Math.round(Math.random() * 255) + ], "rgb"); +} +const Oj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + fastLerp: jp, + fastMapToColor: wX, + lerp: PI, + lift: f_, + lum: cg, + mapToColor: CX, + modifyAlpha: ug, + modifyHSL: bd, + parse: Ma, + random: TX, + stringify: Ns, + toHex: SX +}, Symbol.toStringTag, { value: "Module" })); +var d_ = Math.round; +function hg(r) { + var e; + if (!r || r === "transparent") + r = "none"; + else if (typeof r == "string" && r.indexOf("rgba") > -1) { + var t = Ma(r); + t && (r = "rgb(" + t[0] + "," + t[1] + "," + t[2] + ")", e = t[3]); + } + return { + color: r, + opacity: e == null ? 1 : e + }; +} +var tk = 1e-4; +function Ju(r) { + return r < tk && r > -tk; +} +function Cy(r) { + return d_(r * 1e3) / 1e3; +} +function g1(r) { + return d_(r * 1e4) / 1e4; +} +function IX(r) { + return "matrix(" + Cy(r[0]) + "," + Cy(r[1]) + "," + Cy(r[2]) + "," + Cy(r[3]) + "," + g1(r[4]) + "," + g1(r[5]) + ")"; +} +var AX = { + left: "start", + right: "end", + center: "middle", + middle: "middle" +}; +function EX(r, e, t) { + return t === "top" ? r += e / 2 : t === "bottom" && (r -= e / 2), r; +} +function MX(r) { + return r && (r.shadowBlur || r.shadowOffsetX || r.shadowOffsetY); +} +function DX(r) { + var e = r.style, t = r.getGlobalScale(); + return [ + e.shadowColor, + (e.shadowBlur || 0).toFixed(2), + (e.shadowOffsetX || 0).toFixed(2), + (e.shadowOffsetY || 0).toFixed(2), + t[0], + t[1] + ].join(","); +} +function Lj(r) { + return r && !!r.image; +} +function kX(r) { + return r && !!r.svgElement; +} +function RI(r) { + return Lj(r) || kX(r); +} +function Pj(r) { + return r.type === "linear"; +} +function Rj(r) { + return r.type === "radial"; +} +function Nj(r) { + return r && (r.type === "linear" || r.type === "radial"); +} +function Eb(r) { + return "url(#" + r + ")"; +} +function zj(r) { + var e = r.getGlobalScale(), t = Math.max(e[0], e[1]); + return Math.max(Math.ceil(Math.log(t) / Math.log(10)), 1); +} +function Bj(r) { + var e = r.x || 0, t = r.y || 0, n = (r.rotation || 0) * Np, i = Jt(r.scaleX, 1), a = Jt(r.scaleY, 1), o = r.skewX || 0, s = r.skewY || 0, l = []; + return (e || t) && l.push("translate(" + e + "px," + t + "px)"), n && l.push("rotate(" + n + ")"), (i !== 1 || a !== 1) && l.push("scale(" + i + "," + a + ")"), (o || s) && l.push("skew(" + d_(o * Np) + "deg, " + d_(s * Np) + "deg)"), l.join(" "); +} +var OX = function() { + return Dr.hasGlobalWindow && Tt(window.btoa) ? function(r) { + return window.btoa(unescape(encodeURIComponent(r))); + } : typeof Buffer != "undefined" ? function(r) { + return Buffer.from(r).toString("base64"); + } : function(r) { + return null; + }; +}(), m1 = Array.prototype.slice; +function Hl(r, e, t) { + return (e - r) * t + r; +} +function fS(r, e, t, n) { + for (var i = e.length, a = 0; a < i; a++) + r[a] = Hl(e[a], t[a], n); + return r; +} +function LX(r, e, t, n) { + for (var i = e.length, a = i && e[0].length, o = 0; o < i; o++) { + r[o] || (r[o] = []); + for (var s = 0; s < a; s++) + r[o][s] = Hl(e[o][s], t[o][s], n); + } + return r; +} +function Ty(r, e, t, n) { + for (var i = e.length, a = 0; a < i; a++) + r[a] = e[a] + t[a] * n; + return r; +} +function rk(r, e, t, n) { + for (var i = e.length, a = i && e[0].length, o = 0; o < i; o++) { + r[o] || (r[o] = []); + for (var s = 0; s < a; s++) + r[o][s] = e[o][s] + t[o][s] * n; + } + return r; +} +function PX(r, e) { + for (var t = r.length, n = e.length, i = t > n ? e : r, a = Math.min(t, n), o = i[a - 1] || { color: [0, 0, 0, 0], offset: 0 }, s = a; s < Math.max(t, n); s++) + i.push({ + offset: o.offset, + color: o.color.slice() + }); +} +function RX(r, e, t) { + var n = r, i = e; + if (!(!n.push || !i.push)) { + var a = n.length, o = i.length; + if (a !== o) { + var s = a > o; + if (s) + n.length = o; + else + for (var l = a; l < o; l++) + n.push(t === 1 ? i[l] : m1.call(i[l])); + } + for (var u = n[0] && n[0].length, l = 0; l < n.length; l++) + if (t === 1) + isNaN(n[l]) && (n[l] = i[l]); + else + for (var c = 0; c < u; c++) + isNaN(n[l][c]) && (n[l][c] = i[l][c]); + } +} +function Fp(r) { + if (Yi(r)) { + var e = r.length; + if (Yi(r[0])) { + for (var t = [], n = 0; n < e; n++) + t.push(m1.call(r[n])); + return t; + } + return m1.call(r); + } + return r; +} +function L0(r) { + return r[0] = Math.floor(r[0]) || 0, r[1] = Math.floor(r[1]) || 0, r[2] = Math.floor(r[2]) || 0, r[3] = r[3] == null ? 1 : r[3], "rgba(" + r.join(",") + ")"; +} +function NX(r) { + return Yi(r && r[0]) ? 2 : 1; +} +var Iy = 0, P0 = 1, jj = 2, Tp = 3, y1 = 4, _1 = 5, nk = 6; +function ik(r) { + return r === y1 || r === _1; +} +function Ay(r) { + return r === P0 || r === jj; +} +var Jv = [0, 0, 0, 0], zX = function() { + function r(e) { + this.keyframes = [], this.discrete = !1, this._invalid = !1, this._needsSort = !1, this._lastFr = 0, this._lastFrP = 0, this.propName = e; + } + return r.prototype.isFinished = function() { + return this._finished; + }, r.prototype.setFinished = function() { + this._finished = !0, this._additiveTrack && this._additiveTrack.setFinished(); + }, r.prototype.needsAnimate = function() { + return this.keyframes.length >= 1; + }, r.prototype.getAdditiveTrack = function() { + return this._additiveTrack; + }, r.prototype.addKeyframe = function(e, t, n) { + this._needsSort = !0; + var i = this.keyframes, a = i.length, o = !1, s = nk, l = t; + if (Yi(t)) { + var u = NX(t); + s = u, (u === 1 && !Pr(t[0]) || u === 2 && !Pr(t[0][0])) && (o = !0); + } else if (Pr(t) && !Ld(t)) + s = Iy; + else if (ut(t)) + if (!isNaN(+t)) + s = Iy; + else { + var c = Ma(t); + c && (l = c, s = Tp); + } + else if (Ug(t)) { + var h = Fe({}, l); + h.colorStops = Ke(t.colorStops, function(v) { + return { + offset: v.offset, + color: Ma(v.color) + }; + }), Pj(t) ? s = y1 : Rj(t) && (s = _1), l = h; + } + a === 0 ? this.valType = s : (s !== this.valType || s === nk) && (o = !0), this.discrete = this.discrete || o; + var f = { + time: e, + value: l, + rawValue: t, + percent: 0 + }; + return n && (f.easing = n, f.easingFunc = Tt(n) ? n : wj[n] || LI(n)), i.push(f), f; + }, r.prototype.prepare = function(e, t) { + var n = this.keyframes; + this._needsSort && n.sort(function(w, p) { + return w.time - p.time; + }); + for (var i = this.valType, a = n.length, o = n[a - 1], s = this.discrete, l = Ay(i), u = ik(i), c = 0; c < a; c++) { + var h = n[c], f = h.value, v = o.value; + h.percent = h.time / e, s || (l && c !== a - 1 ? RX(f, v, i) : u && PX(f.colorStops, v.colorStops)); + } + if (!s && i !== _1 && t && this.needsAnimate() && t.needsAnimate() && i === t.valType && !t._finished) { + this._additiveTrack = t; + for (var b = n[0].value, c = 0; c < a; c++) + i === Iy ? n[c].additiveValue = n[c].value - b : i === Tp ? n[c].additiveValue = Ty([], n[c].value, b, -1) : Ay(i) && (n[c].additiveValue = i === P0 ? Ty([], n[c].value, b, -1) : rk([], n[c].value, b, -1)); + } + }, r.prototype.step = function(e, t) { + if (!this._finished) { + this._additiveTrack && this._additiveTrack._finished && (this._additiveTrack = null); + var n = this._additiveTrack != null, i = n ? "additiveValue" : "value", a = this.valType, o = this.keyframes, s = o.length, l = this.propName, u = a === Tp, c, h = this._lastFr, f = Math.min, v, b; + if (s === 1) + v = b = o[0]; + else { + if (t < 0) + c = 0; + else if (t < this._lastFrP) { + var w = f(h + 1, s - 1); + for (c = w; c >= 0 && !(o[c].percent <= t); c--) + ; + c = f(c, s - 2); + } else { + for (c = h; c < s && !(o[c].percent > t); c++) + ; + c = f(c - 1, s - 2); + } + b = o[c + 1], v = o[c]; + } + if (v && b) { + this._lastFr = c, this._lastFrP = t; + var p = b.percent - v.percent, d = p === 0 ? 1 : f((t - v.percent) / p, 1); + b.easingFunc && (d = b.easingFunc(d)); + var m = n ? this._additiveValue : u ? Jv : e[l]; + if ((Ay(a) || u) && !m && (m = this._additiveValue = []), this.discrete) + e[l] = d < 1 ? v.rawValue : b.rawValue; + else if (Ay(a)) + a === P0 ? fS(m, v[i], b[i], d) : LX(m, v[i], b[i], d); + else if (ik(a)) { + var _ = v[i], y = b[i], x = a === y1; + e[l] = { + type: x ? "linear" : "radial", + x: Hl(_.x, y.x, d), + y: Hl(_.y, y.y, d), + colorStops: Ke(_.colorStops, function(S, T) { + var C = y.colorStops[T]; + return { + offset: Hl(S.offset, C.offset, d), + color: L0(fS([], S.color, C.color, d)) + }; + }), + global: y.global + }, x ? (e[l].x2 = Hl(_.x2, y.x2, d), e[l].y2 = Hl(_.y2, y.y2, d)) : e[l].r = Hl(_.r, y.r, d); + } else if (u) + fS(m, v[i], b[i], d), n || (e[l] = L0(m)); + else { + var g = Hl(v[i], b[i], d); + n ? this._additiveValue = g : e[l] = g; + } + n && this._addToTarget(e); + } + } + }, r.prototype._addToTarget = function(e) { + var t = this.valType, n = this.propName, i = this._additiveValue; + t === Iy ? e[n] = e[n] + i : t === Tp ? (Ma(e[n], Jv), Ty(Jv, Jv, i, 1), e[n] = L0(Jv)) : t === P0 ? Ty(e[n], e[n], i, 1) : t === jj && rk(e[n], e[n], i, 1); + }, r; +}(), BX = function() { + function r(e, t, n, i) { + if (this._tracks = {}, this._trackKeys = [], this._maxTime = 0, this._started = 0, this._clip = null, this._target = e, this._loop = t, t && i) { + Sb("Can' use additive animation on looped animation."); + return; + } + this._additiveAnimators = i, this._allowDiscrete = n; + } + return r.prototype.getMaxTime = function() { + return this._maxTime; + }, r.prototype.getDelay = function() { + return this._delay; + }, r.prototype.getLoop = function() { + return this._loop; + }, r.prototype.getTarget = function() { + return this._target; + }, r.prototype.changeTarget = function(e) { + this._target = e; + }, r.prototype.when = function(e, t, n) { + return this.whenWithKeys(e, t, yr(t), n); + }, r.prototype.whenWithKeys = function(e, t, n, i) { + for (var a = this._tracks, o = 0; o < n.length; o++) { + var s = n[o], l = a[s]; + if (!l) { + l = a[s] = new zX(s); + var u = void 0, c = this._getAdditiveTrack(s); + if (c) { + var h = c.keyframes, f = h[h.length - 1]; + u = f && f.value, c.valType === Tp && u && (u = L0(u)); + } else + u = this._target[s]; + if (u == null) + continue; + e > 0 && l.addKeyframe(0, Fp(u), i), this._trackKeys.push(s); + } + l.addKeyframe(e, Fp(t[s]), i); + } + return this._maxTime = Math.max(this._maxTime, e), this; + }, r.prototype.pause = function() { + this._clip.pause(), this._paused = !0; + }, r.prototype.resume = function() { + this._clip.resume(), this._paused = !1; + }, r.prototype.isPaused = function() { + return !!this._paused; + }, r.prototype.duration = function(e) { + return this._maxTime = e, this._force = !0, this; + }, r.prototype._doneCallback = function() { + this._setTracksFinished(), this._clip = null; + var e = this._doneCbs; + if (e) + for (var t = e.length, n = 0; n < t; n++) + e[n].call(this); + }, r.prototype._abortedCallback = function() { + this._setTracksFinished(); + var e = this.animation, t = this._abortedCbs; + if (e && e.removeClip(this._clip), this._clip = null, t) + for (var n = 0; n < t.length; n++) + t[n].call(this); + }, r.prototype._setTracksFinished = function() { + for (var e = this._tracks, t = this._trackKeys, n = 0; n < t.length; n++) + e[t[n]].setFinished(); + }, r.prototype._getAdditiveTrack = function(e) { + var t, n = this._additiveAnimators; + if (n) + for (var i = 0; i < n.length; i++) { + var a = n[i].getTrack(e); + a && (t = a); + } + return t; + }, r.prototype.start = function(e) { + if (!(this._started > 0)) { + this._started = 1; + for (var t = this, n = [], i = this._maxTime || 0, a = 0; a < this._trackKeys.length; a++) { + var o = this._trackKeys[a], s = this._tracks[o], l = this._getAdditiveTrack(o), u = s.keyframes, c = u.length; + if (s.prepare(i, l), s.needsAnimate()) + if (!this._allowDiscrete && s.discrete) { + var h = u[c - 1]; + h && (t._target[s.propName] = h.rawValue), s.setFinished(); + } else + n.push(s); + } + if (n.length || this._force) { + var f = new mX({ + life: i, + loop: this._loop, + delay: this._delay || 0, + onframe: function(v) { + t._started = 2; + var b = t._additiveAnimators; + if (b) { + for (var w = !1, p = 0; p < b.length; p++) + if (b[p]._clip) { + w = !0; + break; + } + w || (t._additiveAnimators = null); + } + for (var p = 0; p < n.length; p++) + n[p].step(t._target, v); + var d = t._onframeCbs; + if (d) + for (var p = 0; p < d.length; p++) + d[p](t._target, v); + }, + ondestroy: function() { + t._doneCallback(); + } + }); + this._clip = f, this.animation && this.animation.addClip(f), e && f.setEasing(e); + } else + this._doneCallback(); + return this; + } + }, r.prototype.stop = function(e) { + if (this._clip) { + var t = this._clip; + e && t.onframe(1), this._abortedCallback(); + } + }, r.prototype.delay = function(e) { + return this._delay = e, this; + }, r.prototype.during = function(e) { + return e && (this._onframeCbs || (this._onframeCbs = []), this._onframeCbs.push(e)), this; + }, r.prototype.done = function(e) { + return e && (this._doneCbs || (this._doneCbs = []), this._doneCbs.push(e)), this; + }, r.prototype.aborted = function(e) { + return e && (this._abortedCbs || (this._abortedCbs = []), this._abortedCbs.push(e)), this; + }, r.prototype.getClip = function() { + return this._clip; + }, r.prototype.getTrack = function(e) { + return this._tracks[e]; + }, r.prototype.getTracks = function() { + var e = this; + return Ke(this._trackKeys, function(t) { + return e._tracks[t]; + }); + }, r.prototype.stopTracks = function(e, t) { + if (!e.length || !this._clip) + return !0; + for (var n = this._tracks, i = this._trackKeys, a = 0; a < e.length; a++) { + var o = n[e[a]]; + o && !o.isFinished() && (t ? o.step(this._target, 1) : this._started === 1 && o.step(this._target, 0), o.setFinished()); + } + for (var s = !0, a = 0; a < i.length; a++) + if (!n[i[a]].isFinished()) { + s = !1; + break; + } + return s && this._abortedCallback(), s; + }, r.prototype.saveTo = function(e, t, n) { + if (e) { + t = t || this._trackKeys; + for (var i = 0; i < t.length; i++) { + var a = t[i], o = this._tracks[a]; + if (!(!o || o.isFinished())) { + var s = o.keyframes, l = s[n ? 0 : s.length - 1]; + l && (e[a] = Fp(l.rawValue)); + } + } + } + }, r.prototype.__changeFinalValue = function(e, t) { + t = t || yr(e); + for (var n = 0; n < t.length; n++) { + var i = t[n], a = this._tracks[i]; + if (a) { + var o = a.keyframes; + if (o.length > 1) { + var s = o.pop(); + a.addKeyframe(s.time, e[i]), a.prepare(this._maxTime, a.getAdditiveTrack()); + } + } + } + }, r; +}(); +const NI = BX; +function hd() { + return (/* @__PURE__ */ new Date()).getTime(); +} +var jX = function(r) { + En(e, r); + function e(t) { + var n = r.call(this) || this; + return n._running = !1, n._time = 0, n._pausedTime = 0, n._pauseStart = 0, n._paused = !1, t = t || {}, n.stage = t.stage || {}, n; + } + return e.prototype.addClip = function(t) { + t.animation && this.removeClip(t), this._head ? (this._tail.next = t, t.prev = this._tail, t.next = null, this._tail = t) : this._head = this._tail = t, t.animation = this; + }, e.prototype.addAnimator = function(t) { + t.animation = this; + var n = t.getClip(); + n && this.addClip(n); + }, e.prototype.removeClip = function(t) { + if (t.animation) { + var n = t.prev, i = t.next; + n ? n.next = i : this._head = i, i ? i.prev = n : this._tail = n, t.next = t.prev = t.animation = null; + } + }, e.prototype.removeAnimator = function(t) { + var n = t.getClip(); + n && this.removeClip(n), t.animation = null; + }, e.prototype.update = function(t) { + for (var n = hd() - this._pausedTime, i = n - this._time, a = this._head; a; ) { + var o = a.next, s = a.step(n, i); + s && (a.ondestroy(), this.removeClip(a)), a = o; + } + this._time = n, t || (this.trigger("frame", i), this.stage.update && this.stage.update()); + }, e.prototype._startLoop = function() { + var t = this; + this._running = !0; + function n() { + t._running && (f1(n), !t._paused && t.update()); + } + f1(n); + }, e.prototype.start = function() { + this._running || (this._time = hd(), this._pausedTime = 0, this._startLoop()); + }, e.prototype.stop = function() { + this._running = !1; + }, e.prototype.pause = function() { + this._paused || (this._pauseStart = hd(), this._paused = !0); + }, e.prototype.resume = function() { + this._paused && (this._pausedTime += hd() - this._pauseStart, this._paused = !1); + }, e.prototype.clear = function() { + for (var t = this._head; t; ) { + var n = t.next; + t.prev = t.next = t.animation = null, t = n; + } + this._head = this._tail = null; + }, e.prototype.isFinished = function() { + return this._head == null; + }, e.prototype.animate = function(t, n) { + n = n || {}, this.start(); + var i = new NI(t, n.loop); + return this.addAnimator(i), i; + }, e; +}(rs); +const FX = jX; +var $X = 300, dS = Dr.domSupported, vS = function() { + var r = [ + "click", + "dblclick", + "mousewheel", + "wheel", + "mouseout", + "mouseup", + "mousedown", + "mousemove", + "contextmenu" + ], e = [ + "touchstart", + "touchend", + "touchmove" + ], t = { + pointerdown: 1, + pointerup: 1, + pointermove: 1, + pointerout: 1 + }, n = Ke(r, function(i) { + var a = i.replace("mouse", "pointer"); + return t.hasOwnProperty(a) ? a : i; + }); + return { + mouse: r, + touch: e, + pointer: n + }; +}(), ak = { + mouse: ["mousemove", "mouseup"], + pointer: ["pointermove", "pointerup"] +}, ok = !1; +function b1(r) { + var e = r.pointerType; + return e === "pen" || e === "touch"; +} +function HX(r) { + r.touching = !0, r.touchTimer != null && (clearTimeout(r.touchTimer), r.touchTimer = null), r.touchTimer = setTimeout(function() { + r.touching = !1, r.touchTimer = null; + }, 700); +} +function pS(r) { + r && (r.zrByTouch = !0); +} +function VX(r, e) { + return Go(r.dom, new GX(r, e), !0); +} +function Fj(r, e) { + for (var t = e, n = !1; t && t.nodeType !== 9 && !(n = t.domBelongToZr || t !== e && t === r.painterRoot); ) + t = t.parentNode; + return n; +} +var GX = function() { + function r(e, t) { + this.stopPropagation = Qn, this.stopImmediatePropagation = Qn, this.preventDefault = Qn, this.type = t.type, this.target = this.currentTarget = e.dom, this.pointerType = t.pointerType, this.clientX = t.clientX, this.clientY = t.clientY; + } + return r; +}(), As = { + mousedown: function(r) { + r = Go(this.dom, r), this.__mayPointerCapture = [r.zrX, r.zrY], this.trigger("mousedown", r); + }, + mousemove: function(r) { + r = Go(this.dom, r); + var e = this.__mayPointerCapture; + e && (r.zrX !== e[0] || r.zrY !== e[1]) && this.__togglePointerCapture(!0), this.trigger("mousemove", r); + }, + mouseup: function(r) { + r = Go(this.dom, r), this.__togglePointerCapture(!1), this.trigger("mouseup", r); + }, + mouseout: function(r) { + r = Go(this.dom, r); + var e = r.toElement || r.relatedTarget; + Fj(this, e) || (this.__pointerCapturing && (r.zrEventControl = "no_globalout"), this.trigger("mouseout", r)); + }, + wheel: function(r) { + ok = !0, r = Go(this.dom, r), this.trigger("mousewheel", r); + }, + mousewheel: function(r) { + ok || (r = Go(this.dom, r), this.trigger("mousewheel", r)); + }, + touchstart: function(r) { + r = Go(this.dom, r), pS(r), this.__lastTouchMoment = /* @__PURE__ */ new Date(), this.handler.processGesture(r, "start"), As.mousemove.call(this, r), As.mousedown.call(this, r); + }, + touchmove: function(r) { + r = Go(this.dom, r), pS(r), this.handler.processGesture(r, "change"), As.mousemove.call(this, r); + }, + touchend: function(r) { + r = Go(this.dom, r), pS(r), this.handler.processGesture(r, "end"), As.mouseup.call(this, r), +/* @__PURE__ */ new Date() - +this.__lastTouchMoment < $X && As.click.call(this, r); + }, + pointerdown: function(r) { + As.mousedown.call(this, r); + }, + pointermove: function(r) { + b1(r) || As.mousemove.call(this, r); + }, + pointerup: function(r) { + As.mouseup.call(this, r); + }, + pointerout: function(r) { + b1(r) || As.mouseout.call(this, r); + } +}; +X(["click", "dblclick", "contextmenu"], function(r) { + As[r] = function(e) { + e = Go(this.dom, e), this.trigger(r, e); + }; +}); +var x1 = { + pointermove: function(r) { + b1(r) || x1.mousemove.call(this, r); + }, + pointerup: function(r) { + x1.mouseup.call(this, r); + }, + mousemove: function(r) { + this.trigger("mousemove", r); + }, + mouseup: function(r) { + var e = this.__pointerCapturing; + this.__togglePointerCapture(!1), this.trigger("mouseup", r), e && (r.zrEventControl = "only_globalout", this.trigger("mouseout", r)); + } +}; +function UX(r, e) { + var t = e.domHandlers; + Dr.pointerEventsSupported ? X(vS.pointer, function(n) { + R0(e, n, function(i) { + t[n].call(r, i); + }); + }) : (Dr.touchEventsSupported && X(vS.touch, function(n) { + R0(e, n, function(i) { + t[n].call(r, i), HX(e); + }); + }), X(vS.mouse, function(n) { + R0(e, n, function(i) { + i = OI(i), e.touching || t[n].call(r, i); + }); + })); +} +function WX(r, e) { + Dr.pointerEventsSupported ? X(ak.pointer, t) : Dr.touchEventsSupported || X(ak.mouse, t); + function t(n) { + function i(a) { + a = OI(a), Fj(r, a.target) || (a = VX(r, a), e.domHandlers[n].call(r, a)); + } + R0(e, n, i, { capture: !0 }); + } +} +function R0(r, e, t, n) { + r.mounted[e] = t, r.listenerOpts[e] = n, h1(r.domTarget, e, t, n); +} +function gS(r) { + var e = r.mounted; + for (var t in e) + e.hasOwnProperty(t) && J7(r.domTarget, t, e[t], r.listenerOpts[t]); + r.mounted = {}; +} +var sk = function() { + function r(e, t) { + this.mounted = {}, this.listenerOpts = {}, this.touching = !1, this.domTarget = e, this.domHandlers = t; + } + return r; +}(), YX = function(r) { + En(e, r); + function e(t, n) { + var i = r.call(this) || this; + return i.__pointerCapturing = !1, i.dom = t, i.painterRoot = n, i._localHandlerScope = new sk(t, As), dS && (i._globalHandlerScope = new sk(document, x1)), UX(i, i._localHandlerScope), i; + } + return e.prototype.dispose = function() { + gS(this._localHandlerScope), dS && gS(this._globalHandlerScope); + }, e.prototype.setCursor = function(t) { + this.dom.style && (this.dom.style.cursor = t || "default"); + }, e.prototype.__togglePointerCapture = function(t) { + if (this.__mayPointerCapture = null, dS && +this.__pointerCapturing ^ +t) { + this.__pointerCapturing = t; + var n = this._globalHandlerScope; + t ? WX(this, n) : gS(n); + } + }, e; +}(rs); +const XX = YX; +var $j = 1; +Dr.hasGlobalWindow && ($j = Math.max(window.devicePixelRatio || window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI || 1, 1)); +var v_ = $j, S1 = 0.4, w1 = "#333", C1 = "#ccc", ZX = "#eee", lk = Yg, uk = 5e-5; +function Uc(r) { + return r > uk || r < -uk; +} +var Wc = [], jf = [], mS = io(), yS = Math.abs, JX = function() { + function r() { + } + return r.prototype.getLocalTransform = function(e) { + return r.getLocalTransform(this, e); + }, r.prototype.setPosition = function(e) { + this.x = e[0], this.y = e[1]; + }, r.prototype.setScale = function(e) { + this.scaleX = e[0], this.scaleY = e[1]; + }, r.prototype.setSkew = function(e) { + this.skewX = e[0], this.skewY = e[1]; + }, r.prototype.setOrigin = function(e) { + this.originX = e[0], this.originY = e[1]; + }, r.prototype.needLocalTransform = function() { + return Uc(this.rotation) || Uc(this.x) || Uc(this.y) || Uc(this.scaleX - 1) || Uc(this.scaleY - 1) || Uc(this.skewX) || Uc(this.skewY); + }, r.prototype.updateTransform = function() { + var e = this.parent && this.parent.transform, t = this.needLocalTransform(), n = this.transform; + if (!(t || e)) { + n && (lk(n), this.invTransform = null); + return; + } + n = n || io(), t ? this.getLocalTransform(n) : lk(n), e && (t ? xl(n, e, n) : Ib(n, e)), this.transform = n, this._resolveGlobalScaleRatio(n); + }, r.prototype._resolveGlobalScaleRatio = function(e) { + var t = this.globalScaleRatio; + if (t != null && t !== 1) { + this.getGlobalScale(Wc); + var n = Wc[0] < 0 ? -1 : 1, i = Wc[1] < 0 ? -1 : 1, a = ((Wc[0] - n) * t + n) / Wc[0] || 0, o = ((Wc[1] - i) * t + i) / Wc[1] || 0; + e[0] *= a, e[1] *= a, e[2] *= o, e[3] *= o; + } + this.invTransform = this.invTransform || io(), nf(this.invTransform, e); + }, r.prototype.getComputedTransform = function() { + for (var e = this, t = []; e; ) + t.push(e), e = e.parent; + for (; e = t.pop(); ) + e.updateTransform(); + return this.transform; + }, r.prototype.setLocalTransform = function(e) { + if (e) { + var t = e[0] * e[0] + e[1] * e[1], n = e[2] * e[2] + e[3] * e[3], i = Math.atan2(e[1], e[0]), a = Math.PI / 2 + i - Math.atan2(e[3], e[2]); + n = Math.sqrt(n) * Math.cos(a), t = Math.sqrt(t), this.skewX = a, this.skewY = 0, this.rotation = -i, this.x = +e[4], this.y = +e[5], this.scaleX = t, this.scaleY = n, this.originX = 0, this.originY = 0; + } + }, r.prototype.decomposeTransform = function() { + if (this.transform) { + var e = this.parent, t = this.transform; + e && e.transform && (xl(jf, e.invTransform, t), t = jf); + var n = this.originX, i = this.originY; + (n || i) && (mS[4] = n, mS[5] = i, xl(jf, t, mS), jf[4] -= n, jf[5] -= i, t = jf), this.setLocalTransform(t); + } + }, r.prototype.getGlobalScale = function(e) { + var t = this.transform; + return e = e || [], t ? (e[0] = Math.sqrt(t[0] * t[0] + t[1] * t[1]), e[1] = Math.sqrt(t[2] * t[2] + t[3] * t[3]), t[0] < 0 && (e[0] = -e[0]), t[3] < 0 && (e[1] = -e[1]), e) : (e[0] = 1, e[1] = 1, e); + }, r.prototype.transformCoordToLocal = function(e, t) { + var n = [e, t], i = this.invTransform; + return i && zi(n, n, i), n; + }, r.prototype.transformCoordToGlobal = function(e, t) { + var n = [e, t], i = this.transform; + return i && zi(n, n, i), n; + }, r.prototype.getLineScale = function() { + var e = this.transform; + return e && yS(e[0] - 1) > 1e-10 && yS(e[3] - 1) > 1e-10 ? Math.sqrt(yS(e[0] * e[3] - e[2] * e[1])) : 1; + }, r.prototype.copyTransform = function(e) { + Hj(this, e); + }, r.getLocalTransform = function(e, t) { + t = t || []; + var n = e.originX || 0, i = e.originY || 0, a = e.scaleX, o = e.scaleY, s = e.anchorX, l = e.anchorY, u = e.rotation || 0, c = e.x, h = e.y, f = e.skewX ? Math.tan(e.skewX) : 0, v = e.skewY ? Math.tan(-e.skewY) : 0; + if (n || i || s || l) { + var b = n + s, w = i + l; + t[4] = -b * a - f * w * o, t[5] = -w * o - v * b * a; + } else + t[4] = t[5] = 0; + return t[0] = a, t[3] = o, t[1] = v * a, t[2] = f * o, u && wc(t, t, u), t[4] += n + c, t[5] += i + h, t; + }, r.initDefaultProps = function() { + var e = r.prototype; + e.scaleX = e.scaleY = e.globalScaleRatio = 1, e.x = e.y = e.originX = e.originY = e.skewX = e.skewY = e.rotation = e.anchorX = e.anchorY = 0; + }(), r; +}(), Tl = [ + "x", + "y", + "originX", + "originY", + "anchorX", + "anchorY", + "rotation", + "scaleX", + "scaleY", + "skewX", + "skewY" +]; +function Hj(r, e) { + for (var t = 0; t < Tl.length; t++) { + var n = Tl[t]; + r[n] = e[n]; + } +} +const Yl = JX; +var ck = {}; +function _o(r, e) { + e = e || hc; + var t = ck[e]; + t || (t = ck[e] = new Xg(500)); + var n = t.get(r); + return n == null && (n = Bs.measureText(r, e).width, t.put(r, n)), n; +} +function hk(r, e, t, n) { + var i = _o(r, e), a = Mb(e), o = Ip(0, i, t), s = od(0, a, n), l = new Wt(o, s, i, a); + return l; +} +function Zg(r, e, t, n) { + var i = ((r || "") + "").split(` +`), a = i.length; + if (a === 1) + return hk(i[0], e, t, n); + for (var o = new Wt(0, 0, 0, 0), s = 0; s < i.length; s++) { + var l = hk(i[s], e, t, n); + s === 0 ? o.copy(l) : o.union(l); + } + return o; +} +function Ip(r, e, t) { + return t === "right" ? r -= e : t === "center" && (r -= e / 2), r; +} +function od(r, e, t) { + return t === "middle" ? r -= e / 2 : t === "bottom" && (r -= e), r; +} +function Mb(r) { + return _o("国", r); +} +function Fs(r, e) { + return typeof r == "string" ? r.lastIndexOf("%") >= 0 ? parseFloat(r) / 100 * e : parseFloat(r) : r; +} +function p_(r, e, t) { + var n = e.position || "inside", i = e.distance != null ? e.distance : 5, a = t.height, o = t.width, s = a / 2, l = t.x, u = t.y, c = "left", h = "top"; + if (n instanceof Array) + l += Fs(n[0], t.width), u += Fs(n[1], t.height), c = null, h = null; + else + switch (n) { + case "left": + l -= i, u += s, c = "right", h = "middle"; + break; + case "right": + l += i + o, u += s, h = "middle"; + break; + case "top": + l += o / 2, u -= i, c = "center", h = "bottom"; + break; + case "bottom": + l += o / 2, u += a + i, c = "center"; + break; + case "inside": + l += o / 2, u += s, c = "center", h = "middle"; + break; + case "insideLeft": + l += i, u += s, h = "middle"; + break; + case "insideRight": + l += o - i, u += s, c = "right", h = "middle"; + break; + case "insideTop": + l += o / 2, u += i, c = "center"; + break; + case "insideBottom": + l += o / 2, u += a - i, c = "center", h = "bottom"; + break; + case "insideTopLeft": + l += i, u += i; + break; + case "insideTopRight": + l += o - i, u += i, c = "right"; + break; + case "insideBottomLeft": + l += i, u += a - i, h = "bottom"; + break; + case "insideBottomRight": + l += o - i, u += a - i, c = "right", h = "bottom"; + break; + } + return r = r || {}, r.x = l, r.y = u, r.align = c, r.verticalAlign = h, r; +} +var _S = "__zr_normal__", bS = Tl.concat(["ignore"]), KX = es(Tl, function(r, e) { + return r[e] = !0, r; +}, { ignore: !1 }), Ff = {}, QX = new Wt(0, 0, 0, 0), zI = function() { + function r(e) { + this.id = EI(), this.animators = [], this.currentStates = [], this.states = {}, this._init(e); + } + return r.prototype._init = function(e) { + this.attr(e); + }, r.prototype.drift = function(e, t, n) { + switch (this.draggable) { + case "horizontal": + t = 0; + break; + case "vertical": + e = 0; + break; + } + var i = this.transform; + i || (i = this.transform = [1, 0, 0, 1, 0, 0]), i[4] += e, i[5] += t, this.decomposeTransform(), this.markRedraw(); + }, r.prototype.beforeUpdate = function() { + }, r.prototype.afterUpdate = function() { + }, r.prototype.update = function() { + this.updateTransform(), this.__dirty && this.updateInnerText(); + }, r.prototype.updateInnerText = function(e) { + var t = this._textContent; + if (t && (!t.ignore || e)) { + this.textConfig || (this.textConfig = {}); + var n = this.textConfig, i = n.local, a = t.innerTransformable, o = void 0, s = void 0, l = !1; + a.parent = i ? this : null; + var u = !1; + if (a.copyTransform(t), n.position != null) { + var c = QX; + n.layoutRect ? c.copy(n.layoutRect) : c.copy(this.getBoundingRect()), i || c.applyTransform(this.transform), this.calculateTextPosition ? this.calculateTextPosition(Ff, n, c) : p_(Ff, n, c), a.x = Ff.x, a.y = Ff.y, o = Ff.align, s = Ff.verticalAlign; + var h = n.origin; + if (h && n.rotation != null) { + var f = void 0, v = void 0; + h === "center" ? (f = c.width * 0.5, v = c.height * 0.5) : (f = Fs(h[0], c.width), v = Fs(h[1], c.height)), u = !0, a.originX = -a.x + f + (i ? 0 : c.x), a.originY = -a.y + v + (i ? 0 : c.y); + } + } + n.rotation != null && (a.rotation = n.rotation); + var b = n.offset; + b && (a.x += b[0], a.y += b[1], u || (a.originX = -b[0], a.originY = -b[1])); + var w = n.inside == null ? typeof n.position == "string" && n.position.indexOf("inside") >= 0 : n.inside, p = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {}), d = void 0, m = void 0, _ = void 0; + w && this.canBeInsideText() ? (d = n.insideFill, m = n.insideStroke, (d == null || d === "auto") && (d = this.getInsideTextFill()), (m == null || m === "auto") && (m = this.getInsideTextStroke(d), _ = !0)) : (d = n.outsideFill, m = n.outsideStroke, (d == null || d === "auto") && (d = this.getOutsideFill()), (m == null || m === "auto") && (m = this.getOutsideStroke(d), _ = !0)), d = d || "#000", (d !== p.fill || m !== p.stroke || _ !== p.autoStroke || o !== p.align || s !== p.verticalAlign) && (l = !0, p.fill = d, p.stroke = m, p.autoStroke = _, p.align = o, p.verticalAlign = s, t.setDefaultTextStyle(p)), t.__dirty |= go, l && t.dirtyStyle(!0); + } + }, r.prototype.canBeInsideText = function() { + return !0; + }, r.prototype.getInsideTextFill = function() { + return "#fff"; + }, r.prototype.getInsideTextStroke = function(e) { + return "#000"; + }, r.prototype.getOutsideFill = function() { + return this.__zr && this.__zr.isDarkMode() ? C1 : w1; + }, r.prototype.getOutsideStroke = function(e) { + var t = this.__zr && this.__zr.getBackgroundColor(), n = typeof t == "string" && Ma(t); + n || (n = [255, 255, 255, 1]); + for (var i = n[3], a = this.__zr.isDarkMode(), o = 0; o < 3; o++) + n[o] = n[o] * i + (a ? 0 : 255) * (1 - i); + return n[3] = 1, Ns(n, "rgba"); + }, r.prototype.traverse = function(e, t) { + }, r.prototype.attrKV = function(e, t) { + e === "textConfig" ? this.setTextConfig(t) : e === "textContent" ? this.setTextContent(t) : e === "clipPath" ? this.setClipPath(t) : e === "extra" ? (this.extra = this.extra || {}, Fe(this.extra, t)) : this[e] = t; + }, r.prototype.hide = function() { + this.ignore = !0, this.markRedraw(); + }, r.prototype.show = function() { + this.ignore = !1, this.markRedraw(); + }, r.prototype.attr = function(e, t) { + if (typeof e == "string") + this.attrKV(e, t); + else if (kt(e)) + for (var n = e, i = yr(n), a = 0; a < i.length; a++) { + var o = i[a]; + this.attrKV(o, e[o]); + } + return this.markRedraw(), this; + }, r.prototype.saveCurrentToNormalState = function(e) { + this._innerSaveToNormal(e); + for (var t = this._normalState, n = 0; n < this.animators.length; n++) { + var i = this.animators[n], a = i.__fromStateTransition; + if (!(i.getLoop() || a && a !== _S)) { + var o = i.targetName, s = o ? t[o] : t; + i.saveTo(s); + } + } + }, r.prototype._innerSaveToNormal = function(e) { + var t = this._normalState; + t || (t = this._normalState = {}), e.textConfig && !t.textConfig && (t.textConfig = this.textConfig), this._savePrimaryToNormal(e, t, bS); + }, r.prototype._savePrimaryToNormal = function(e, t, n) { + for (var i = 0; i < n.length; i++) { + var a = n[i]; + e[a] != null && !(a in t) && (t[a] = this[a]); + } + }, r.prototype.hasState = function() { + return this.currentStates.length > 0; + }, r.prototype.getState = function(e) { + return this.states[e]; + }, r.prototype.ensureState = function(e) { + var t = this.states; + return t[e] || (t[e] = {}), t[e]; + }, r.prototype.clearStates = function(e) { + this.useState(_S, !1, e); + }, r.prototype.useState = function(e, t, n, i) { + var a = e === _S, o = this.hasState(); + if (!(!o && a)) { + var s = this.currentStates, l = this.stateTransition; + if (!(ir(s, e) >= 0 && (t || s.length === 1))) { + var u; + if (this.stateProxy && !a && (u = this.stateProxy(e)), u || (u = this.states && this.states[e]), !u && !a) { + Sb("State " + e + " not exists."); + return; + } + a || this.saveCurrentToNormalState(u); + var c = !!(u && u.hoverLayer || i); + c && this._toggleHoverLayerFlag(!0), this._applyStateObj(e, u, this._normalState, t, !n && !this.__inHover && l && l.duration > 0, l); + var h = this._textContent, f = this._textGuide; + return h && h.useState(e, t, n, c), f && f.useState(e, t, n, c), a ? (this.currentStates = [], this._normalState = {}) : t ? this.currentStates.push(e) : this.currentStates = [e], this._updateAnimationTargets(), this.markRedraw(), !c && this.__inHover && (this._toggleHoverLayerFlag(!1), this.__dirty &= ~go), u; + } + } + }, r.prototype.useStates = function(e, t, n) { + if (!e.length) + this.clearStates(); + else { + var i = [], a = this.currentStates, o = e.length, s = o === a.length; + if (s) { + for (var l = 0; l < o; l++) + if (e[l] !== a[l]) { + s = !1; + break; + } + } + if (s) + return; + for (var l = 0; l < o; l++) { + var u = e[l], c = void 0; + this.stateProxy && (c = this.stateProxy(u, e)), c || (c = this.states[u]), c && i.push(c); + } + var h = i[o - 1], f = !!(h && h.hoverLayer || n); + f && this._toggleHoverLayerFlag(!0); + var v = this._mergeStates(i), b = this.stateTransition; + this.saveCurrentToNormalState(v), this._applyStateObj(e.join(","), v, this._normalState, !1, !t && !this.__inHover && b && b.duration > 0, b); + var w = this._textContent, p = this._textGuide; + w && w.useStates(e, t, f), p && p.useStates(e, t, f), this._updateAnimationTargets(), this.currentStates = e.slice(), this.markRedraw(), !f && this.__inHover && (this._toggleHoverLayerFlag(!1), this.__dirty &= ~go); + } + }, r.prototype._updateAnimationTargets = function() { + for (var e = 0; e < this.animators.length; e++) { + var t = this.animators[e]; + t.targetName && t.changeTarget(this[t.targetName]); + } + }, r.prototype.removeState = function(e) { + var t = ir(this.currentStates, e); + if (t >= 0) { + var n = this.currentStates.slice(); + n.splice(t, 1), this.useStates(n); + } + }, r.prototype.replaceState = function(e, t, n) { + var i = this.currentStates.slice(), a = ir(i, e), o = ir(i, t) >= 0; + a >= 0 ? o ? i.splice(a, 1) : i[a] = t : n && !o && i.push(t), this.useStates(i); + }, r.prototype.toggleState = function(e, t) { + t ? this.useState(e, !0) : this.removeState(e); + }, r.prototype._mergeStates = function(e) { + for (var t = {}, n, i = 0; i < e.length; i++) { + var a = e[i]; + Fe(t, a), a.textConfig && (n = n || {}, Fe(n, a.textConfig)); + } + return n && (t.textConfig = n), t; + }, r.prototype._applyStateObj = function(e, t, n, i, a, o) { + var s = !(t && i); + t && t.textConfig ? (this.textConfig = Fe({}, i ? this.textConfig : n.textConfig), Fe(this.textConfig, t.textConfig)) : s && n.textConfig && (this.textConfig = n.textConfig); + for (var l = {}, u = !1, c = 0; c < bS.length; c++) { + var h = bS[c], f = a && KX[h]; + t && t[h] != null ? f ? (u = !0, l[h] = t[h]) : this[h] = t[h] : s && n[h] != null && (f ? (u = !0, l[h] = n[h]) : this[h] = n[h]); + } + if (!a) + for (var c = 0; c < this.animators.length; c++) { + var v = this.animators[c], b = v.targetName; + v.getLoop() || v.__changeFinalValue(b ? (t || n)[b] : t || n); + } + u && this._transitionState(e, l, o); + }, r.prototype._attachComponent = function(e) { + if (!(e.__zr && !e.__hostTarget) && e !== this) { + var t = this.__zr; + t && e.addSelfToZr(t), e.__zr = t, e.__hostTarget = this; + } + }, r.prototype._detachComponent = function(e) { + e.__zr && e.removeSelfFromZr(e.__zr), e.__zr = null, e.__hostTarget = null; + }, r.prototype.getClipPath = function() { + return this._clipPath; + }, r.prototype.setClipPath = function(e) { + this._clipPath && this._clipPath !== e && this.removeClipPath(), this._attachComponent(e), this._clipPath = e, this.markRedraw(); + }, r.prototype.removeClipPath = function() { + var e = this._clipPath; + e && (this._detachComponent(e), this._clipPath = null, this.markRedraw()); + }, r.prototype.getTextContent = function() { + return this._textContent; + }, r.prototype.setTextContent = function(e) { + var t = this._textContent; + t !== e && (t && t !== e && this.removeTextContent(), e.innerTransformable = new Yl(), this._attachComponent(e), this._textContent = e, this.markRedraw()); + }, r.prototype.setTextConfig = function(e) { + this.textConfig || (this.textConfig = {}), Fe(this.textConfig, e), this.markRedraw(); + }, r.prototype.removeTextConfig = function() { + this.textConfig = null, this.markRedraw(); + }, r.prototype.removeTextContent = function() { + var e = this._textContent; + e && (e.innerTransformable = null, this._detachComponent(e), this._textContent = null, this._innerTextDefaultStyle = null, this.markRedraw()); + }, r.prototype.getTextGuideLine = function() { + return this._textGuide; + }, r.prototype.setTextGuideLine = function(e) { + this._textGuide && this._textGuide !== e && this.removeTextGuideLine(), this._attachComponent(e), this._textGuide = e, this.markRedraw(); + }, r.prototype.removeTextGuideLine = function() { + var e = this._textGuide; + e && (this._detachComponent(e), this._textGuide = null, this.markRedraw()); + }, r.prototype.markRedraw = function() { + this.__dirty |= go; + var e = this.__zr; + e && (this.__inHover ? e.refreshHover() : e.refresh()), this.__hostTarget && this.__hostTarget.markRedraw(); + }, r.prototype.dirty = function() { + this.markRedraw(); + }, r.prototype._toggleHoverLayerFlag = function(e) { + this.__inHover = e; + var t = this._textContent, n = this._textGuide; + t && (t.__inHover = e), n && (n.__inHover = e); + }, r.prototype.addSelfToZr = function(e) { + if (this.__zr !== e) { + this.__zr = e; + var t = this.animators; + if (t) + for (var n = 0; n < t.length; n++) + e.animation.addAnimator(t[n]); + this._clipPath && this._clipPath.addSelfToZr(e), this._textContent && this._textContent.addSelfToZr(e), this._textGuide && this._textGuide.addSelfToZr(e); + } + }, r.prototype.removeSelfFromZr = function(e) { + if (this.__zr) { + this.__zr = null; + var t = this.animators; + if (t) + for (var n = 0; n < t.length; n++) + e.animation.removeAnimator(t[n]); + this._clipPath && this._clipPath.removeSelfFromZr(e), this._textContent && this._textContent.removeSelfFromZr(e), this._textGuide && this._textGuide.removeSelfFromZr(e); + } + }, r.prototype.animate = function(e, t, n) { + var i = e ? this[e] : this, a = new NI(i, t, n); + return e && (a.targetName = e), this.addAnimator(a, e), a; + }, r.prototype.addAnimator = function(e, t) { + var n = this.__zr, i = this; + e.during(function() { + i.updateDuringAnimation(t); + }).done(function() { + var a = i.animators, o = ir(a, e); + o >= 0 && a.splice(o, 1); + }), this.animators.push(e), n && n.animation.addAnimator(e), n && n.wakeUp(); + }, r.prototype.updateDuringAnimation = function(e) { + this.markRedraw(); + }, r.prototype.stopAnimation = function(e, t) { + for (var n = this.animators, i = n.length, a = [], o = 0; o < i; o++) { + var s = n[o]; + !e || e === s.scope ? s.stop(t) : a.push(s); + } + return this.animators = a, this; + }, r.prototype.animateTo = function(e, t, n) { + xS(this, e, t, n); + }, r.prototype.animateFrom = function(e, t, n) { + xS(this, e, t, n, !0); + }, r.prototype._transitionState = function(e, t, n, i) { + for (var a = xS(this, t, n, i), o = 0; o < a.length; o++) + a[o].__fromStateTransition = e; + }, r.prototype.getBoundingRect = function() { + return null; + }, r.prototype.getPaintRect = function() { + return null; + }, r.initDefaultProps = function() { + var e = r.prototype; + e.type = "element", e.name = "", e.ignore = e.silent = e.isGroup = e.draggable = e.dragging = e.ignoreClip = e.__inHover = !1, e.__dirty = go; + function t(n, i, a, o) { + Object.defineProperty(e, n, { + get: function() { + if (!this[i]) { + var l = this[i] = []; + s(this, l); + } + return this[i]; + }, + set: function(l) { + this[a] = l[0], this[o] = l[1], this[i] = l, s(this, l); + } + }); + function s(l, u) { + Object.defineProperty(u, 0, { + get: function() { + return l[a]; + }, + set: function(c) { + l[a] = c; + } + }), Object.defineProperty(u, 1, { + get: function() { + return l[o]; + }, + set: function(c) { + l[o] = c; + } + }); + } + } + Object.defineProperty && (t("position", "_legacyPos", "x", "y"), t("scale", "_legacyScale", "scaleX", "scaleY"), t("origin", "_legacyOrigin", "originX", "originY")); + }(), r; +}(); +qn(zI, rs); +qn(zI, Yl); +function xS(r, e, t, n, i) { + t = t || {}; + var a = []; + Vj(r, "", r, e, t, n, a, i); + var o = a.length, s = !1, l = t.done, u = t.aborted, c = function() { + s = !0, o--, o <= 0 && (s ? l && l() : u && u()); + }, h = function() { + o--, o <= 0 && (s ? l && l() : u && u()); + }; + o || l && l(), a.length > 0 && t.during && a[0].during(function(b, w) { + t.during(w); + }); + for (var f = 0; f < a.length; f++) { + var v = a[f]; + c && v.done(c), h && v.aborted(h), t.force && v.duration(t.duration), v.start(t.easing); + } + return a; +} +function SS(r, e, t) { + for (var n = 0; n < t; n++) + r[n] = e[n]; +} +function qX(r) { + return Yi(r[0]); +} +function eZ(r, e, t) { + if (Yi(e[t])) + if (Yi(r[t]) || (r[t] = []), no(e[t])) { + var n = e[t].length; + r[t].length !== n && (r[t] = new e[t].constructor(n), SS(r[t], e[t], n)); + } else { + var i = e[t], a = r[t], o = i.length; + if (qX(i)) + for (var s = i[0].length, l = 0; l < o; l++) + a[l] ? SS(a[l], i[l], s) : a[l] = Array.prototype.slice.call(i[l]); + else + SS(a, i, o); + a.length = i.length; + } + else + r[t] = e[t]; +} +function tZ(r, e) { + return r === e || Yi(r) && Yi(e) && rZ(r, e); +} +function rZ(r, e) { + var t = r.length; + if (t !== e.length) + return !1; + for (var n = 0; n < t; n++) + if (r[n] !== e[n]) + return !1; + return !0; +} +function Vj(r, e, t, n, i, a, o, s) { + for (var l = yr(n), u = i.duration, c = i.delay, h = i.additive, f = i.setToFinal, v = !kt(a), b = r.animators, w = [], p = 0; p < l.length; p++) { + var d = l[p], m = n[d]; + if (m != null && t[d] != null && (v || a[d])) + if (kt(m) && !Yi(m) && !Ug(m)) { + if (e) { + s || (t[d] = m, r.updateDuringAnimation(e)); + continue; + } + Vj(r, d, t[d], m, i, a && a[d], o, s); + } else + w.push(d); + else + s || (t[d] = m, r.updateDuringAnimation(e), w.push(d)); + } + var _ = w.length; + if (!h && _) + for (var y = 0; y < b.length; y++) { + var x = b[y]; + if (x.targetName === e) { + var g = x.stopTracks(w); + if (g) { + var S = ir(b, x); + b.splice(S, 1); + } + } + } + if (i.force || (w = Jr(w, function(M) { + return !tZ(n[M], t[M]); + }), _ = w.length), _ > 0 || i.force && !o.length) { + var T = void 0, C = void 0, E = void 0; + if (s) { + C = {}, f && (T = {}); + for (var y = 0; y < _; y++) { + var d = w[y]; + C[d] = t[d], f ? T[d] = n[d] : t[d] = n[d]; + } + } else if (f) { + E = {}; + for (var y = 0; y < _; y++) { + var d = w[y]; + E[d] = Fp(t[d]), eZ(t, n, d); + } + } + var x = new NI(t, !1, !1, h ? Jr(b, function(P) { + return P.targetName === e; + }) : null); + x.targetName = e, i.scope && (x.scope = i.scope), f && T && x.whenWithKeys(0, T, w), E && x.whenWithKeys(0, E, w), x.whenWithKeys(u == null ? 500 : u, s ? C : n, w).delay(c || 0), r.addAnimator(x, e), o.push(x); + } +} +const Gj = zI; +var Uj = function(r) { + En(e, r); + function e(t) { + var n = r.call(this) || this; + return n.isGroup = !0, n._children = [], n.attr(t), n; + } + return e.prototype.childrenRef = function() { + return this._children; + }, e.prototype.children = function() { + return this._children.slice(); + }, e.prototype.childAt = function(t) { + return this._children[t]; + }, e.prototype.childOfName = function(t) { + for (var n = this._children, i = 0; i < n.length; i++) + if (n[i].name === t) + return n[i]; + }, e.prototype.childCount = function() { + return this._children.length; + }, e.prototype.add = function(t) { + return t && t !== this && t.parent !== this && (this._children.push(t), this._doAdd(t)), this; + }, e.prototype.addBefore = function(t, n) { + if (t && t !== this && t.parent !== this && n && n.parent === this) { + var i = this._children, a = i.indexOf(n); + a >= 0 && (i.splice(a, 0, t), this._doAdd(t)); + } + return this; + }, e.prototype.replace = function(t, n) { + var i = ir(this._children, t); + return i >= 0 && this.replaceAt(n, i), this; + }, e.prototype.replaceAt = function(t, n) { + var i = this._children, a = i[n]; + if (t && t !== this && t.parent !== this && t !== a) { + i[n] = t, a.parent = null; + var o = this.__zr; + o && a.removeSelfFromZr(o), this._doAdd(t); + } + return this; + }, e.prototype._doAdd = function(t) { + t.parent && t.parent.remove(t), t.parent = this; + var n = this.__zr; + n && n !== t.__zr && t.addSelfToZr(n), n && n.refresh(); + }, e.prototype.remove = function(t) { + var n = this.__zr, i = this._children, a = ir(i, t); + return a < 0 ? this : (i.splice(a, 1), t.parent = null, n && t.removeSelfFromZr(n), n && n.refresh(), this); + }, e.prototype.removeAll = function() { + for (var t = this._children, n = this.__zr, i = 0; i < t.length; i++) { + var a = t[i]; + n && a.removeSelfFromZr(n), a.parent = null; + } + return t.length = 0, this; + }, e.prototype.eachChild = function(t, n) { + for (var i = this._children, a = 0; a < i.length; a++) { + var o = i[a]; + t.call(n, o, a); + } + return this; + }, e.prototype.traverse = function(t, n) { + for (var i = 0; i < this._children.length; i++) { + var a = this._children[i], o = t.call(n, a); + a.isGroup && !o && a.traverse(t, n); + } + return this; + }, e.prototype.addSelfToZr = function(t) { + r.prototype.addSelfToZr.call(this, t); + for (var n = 0; n < this._children.length; n++) { + var i = this._children[n]; + i.addSelfToZr(t); + } + }, e.prototype.removeSelfFromZr = function(t) { + r.prototype.removeSelfFromZr.call(this, t); + for (var n = 0; n < this._children.length; n++) { + var i = this._children[n]; + i.removeSelfFromZr(t); + } + }, e.prototype.getBoundingRect = function(t) { + for (var n = new Wt(0, 0, 0, 0), i = t || this._children, a = [], o = null, s = 0; s < i.length; s++) { + var l = i[s]; + if (!(l.ignore || l.invisible)) { + var u = l.getBoundingRect(), c = l.getLocalTransform(a); + c ? (Wt.applyTransform(n, u, c), o = o || n.clone(), o.union(n)) : (o = o || u.clone(), o.union(u)); + } + } + return o || n; + }, e; +}(Gj); +Uj.prototype.type = "group"; +const Rt = Uj; +/*! +* ZRender, a high performance 2d drawing library. +* +* Copyright (c) 2013, Baidu Inc. +* All rights reserved. +* +* LICENSE +* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt +*/ +var N0 = {}, Th = {}; +function nZ(r) { + delete Th[r]; +} +function iZ(r) { + if (!r) + return !1; + if (typeof r == "string") + return cg(r, 1) < S1; + if (r.colorStops) { + for (var e = r.colorStops, t = 0, n = e.length, i = 0; i < n; i++) + t += cg(e[i].color, 1); + return t /= n, t < S1; + } + return !1; +} +var aZ = function() { + function r(e, t, n) { + var i = this; + this._sleepAfterStill = 10, this._stillFrameAccum = 0, this._needsRefresh = !0, this._needsRefreshHover = !0, this._darkMode = !1, n = n || {}, this.dom = t, this.id = e; + var a = new hX(), o = n.renderer || "canvas"; + N0[o] || (o = yr(N0)[0]), n.useDirtyRect = n.useDirtyRect == null ? !1 : n.useDirtyRect; + var s = new N0[o](t, a, n, e), l = n.ssr || s.ssrOnly; + this.storage = a, this.painter = s; + var u = !Dr.node && !Dr.worker && !l ? new XX(s.getViewportRoot(), s.root) : null, c = n.useCoarsePointer, h = c == null || c === "auto" ? Dr.touchEventsSupported : !!c, f = 44, v; + h && (v = Jt(n.pointerSize, f)), this.handler = new oX(a, s, u, s.root, v), this.animation = new FX({ + stage: { + update: l ? null : function() { + return i._flush(!0); + } + } + }), l || this.animation.start(); + } + return r.prototype.add = function(e) { + e && (this.storage.addRoot(e), e.addSelfToZr(this), this.refresh()); + }, r.prototype.remove = function(e) { + e && (this.storage.delRoot(e), e.removeSelfFromZr(this), this.refresh()); + }, r.prototype.configLayer = function(e, t) { + this.painter.configLayer && this.painter.configLayer(e, t), this.refresh(); + }, r.prototype.setBackgroundColor = function(e) { + this.painter.setBackgroundColor && this.painter.setBackgroundColor(e), this.refresh(), this._backgroundColor = e, this._darkMode = iZ(e); + }, r.prototype.getBackgroundColor = function() { + return this._backgroundColor; + }, r.prototype.setDarkMode = function(e) { + this._darkMode = e; + }, r.prototype.isDarkMode = function() { + return this._darkMode; + }, r.prototype.refreshImmediately = function(e) { + e || this.animation.update(!0), this._needsRefresh = !1, this.painter.refresh(), this._needsRefresh = !1; + }, r.prototype.refresh = function() { + this._needsRefresh = !0, this.animation.start(); + }, r.prototype.flush = function() { + this._flush(!1); + }, r.prototype._flush = function(e) { + var t, n = hd(); + this._needsRefresh && (t = !0, this.refreshImmediately(e)), this._needsRefreshHover && (t = !0, this.refreshHoverImmediately()); + var i = hd(); + t ? (this._stillFrameAccum = 0, this.trigger("rendered", { + elapsedTime: i - n + })) : this._sleepAfterStill > 0 && (this._stillFrameAccum++, this._stillFrameAccum > this._sleepAfterStill && this.animation.stop()); + }, r.prototype.setSleepAfterStill = function(e) { + this._sleepAfterStill = e; + }, r.prototype.wakeUp = function() { + this.animation.start(), this._stillFrameAccum = 0; + }, r.prototype.refreshHover = function() { + this._needsRefreshHover = !0; + }, r.prototype.refreshHoverImmediately = function() { + this._needsRefreshHover = !1, this.painter.refreshHover && this.painter.getType() === "canvas" && this.painter.refreshHover(); + }, r.prototype.resize = function(e) { + e = e || {}, this.painter.resize(e.width, e.height), this.handler.resize(); + }, r.prototype.clearAnimation = function() { + this.animation.clear(); + }, r.prototype.getWidth = function() { + return this.painter.getWidth(); + }, r.prototype.getHeight = function() { + return this.painter.getHeight(); + }, r.prototype.setCursorStyle = function(e) { + this.handler.setCursorStyle(e); + }, r.prototype.findHover = function(e, t) { + return this.handler.findHover(e, t); + }, r.prototype.on = function(e, t, n) { + return this.handler.on(e, t, n), this; + }, r.prototype.off = function(e, t) { + this.handler.off(e, t); + }, r.prototype.trigger = function(e, t) { + this.handler.trigger(e, t); + }, r.prototype.clear = function() { + for (var e = this.storage.getRoots(), t = 0; t < e.length; t++) + e[t] instanceof Rt && e[t].removeSelfFromZr(this); + this.storage.delAllRoots(), this.painter.clear(); + }, r.prototype.dispose = function() { + this.animation.stop(), this.clear(), this.storage.dispose(), this.painter.dispose(), this.handler.dispose(), this.animation = this.storage = this.painter = this.handler = null, nZ(this.id); + }, r; +}(); +function T1(r, e) { + var t = new aZ(EI(), r, e); + return Th[t.id] = t, t; +} +function oZ(r) { + r.dispose(); +} +function sZ() { + for (var r in Th) + Th.hasOwnProperty(r) && Th[r].dispose(); + Th = {}; +} +function lZ(r) { + return Th[r]; +} +function Wj(r, e) { + N0[r] = e; +} +var uZ = "5.4.4"; +const Yj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + dispose: oZ, + disposeAll: sZ, + getInstance: lZ, + init: T1, + registerPainter: Wj, + version: uZ +}, Symbol.toStringTag, { value: "Module" })); +var fk = 1e-4, Xj = 20; +function cZ(r) { + return r.replace(/^\s+|\s+$/g, ""); +} +function Zr(r, e, t, n) { + var i = e[0], a = e[1], o = t[0], s = t[1], l = a - i, u = s - o; + if (l === 0) + return u === 0 ? o : (o + s) / 2; + if (n) + if (l > 0) { + if (r <= i) + return o; + if (r >= a) + return s; + } else { + if (r >= i) + return o; + if (r <= a) + return s; + } + else { + if (r === i) + return o; + if (r === a) + return s; + } + return (r - i) / l * u + o; +} +function ot(r, e) { + switch (r) { + case "center": + case "middle": + r = "50%"; + break; + case "left": + case "top": + r = "0%"; + break; + case "right": + case "bottom": + r = "100%"; + break; + } + return ut(r) ? cZ(r).match(/%$/) ? parseFloat(r) / 100 * e : parseFloat(r) : r == null ? NaN : +r; +} +function Vn(r, e, t) { + return e == null && (e = 10), e = Math.min(Math.max(0, e), Xj), r = (+r).toFixed(e), t ? r : +r; +} +function yo(r) { + return r.sort(function(e, t) { + return e - t; + }), r; +} +function Ds(r) { + if (r = +r, isNaN(r)) + return 0; + if (r > 1e-14) { + for (var e = 1, t = 0; t < 15; t++, e *= 10) + if (Math.round(r * e) / e === r) + return t; + } + return Zj(r); +} +function Zj(r) { + var e = r.toString().toLowerCase(), t = e.indexOf("e"), n = t > 0 ? +e.slice(t + 1) : 0, i = t > 0 ? t : e.length, a = e.indexOf("."), o = a < 0 ? 0 : i - 1 - a; + return Math.max(0, o - n); +} +function BI(r, e) { + var t = Math.log, n = Math.LN10, i = Math.floor(t(r[1] - r[0]) / n), a = Math.round(t(Math.abs(e[1] - e[0])) / n), o = Math.min(Math.max(-i + a, 0), 20); + return isFinite(o) ? o : 20; +} +function hZ(r, e, t) { + if (!r[e]) + return 0; + var n = Jj(r, t); + return n[e] || 0; +} +function Jj(r, e) { + var t = es(r, function(v, b) { + return v + (isNaN(b) ? 0 : b); + }, 0); + if (t === 0) + return []; + for (var n = Math.pow(10, e), i = Ke(r, function(v) { + return (isNaN(v) ? 0 : v) / t * n * 100; + }), a = n * 100, o = Ke(i, function(v) { + return Math.floor(v); + }), s = es(o, function(v, b) { + return v + b; + }, 0), l = Ke(i, function(v, b) { + return v - o[b]; + }); s < a; ) { + for (var u = Number.NEGATIVE_INFINITY, c = null, h = 0, f = l.length; h < f; ++h) + l[h] > u && (u = l[h], c = h); + ++o[c], l[c] = 0, ++s; + } + return Ke(o, function(v) { + return v / n; + }); +} +function fZ(r, e) { + var t = Math.max(Ds(r), Ds(e)), n = r + e; + return t > Xj ? n : Vn(n, t); +} +var I1 = 9007199254740991; +function jI(r) { + var e = Math.PI * 2; + return (r % e + e) % e; +} +function fg(r) { + return r > -fk && r < fk; +} +var dZ = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; +function So(r) { + if (r instanceof Date) + return r; + if (ut(r)) { + var e = dZ.exec(r); + if (!e) + return /* @__PURE__ */ new Date(NaN); + if (e[8]) { + var t = +e[4] || 0; + return e[8].toUpperCase() !== "Z" && (t -= +e[8].slice(0, 3)), new Date(Date.UTC(+e[1], +(e[2] || 1) - 1, +e[3] || 1, t, +(e[5] || 0), +e[6] || 0, e[7] ? +e[7].substring(0, 3) : 0)); + } else + return new Date(+e[1], +(e[2] || 1) - 1, +e[3] || 1, +e[4] || 0, +(e[5] || 0), +e[6] || 0, e[7] ? +e[7].substring(0, 3) : 0); + } else if (r == null) + return /* @__PURE__ */ new Date(NaN); + return new Date(Math.round(r)); +} +function Kj(r) { + return Math.pow(10, Db(r)); +} +function Db(r) { + if (r === 0) + return 0; + var e = Math.floor(Math.log(r) / Math.LN10); + return r / Math.pow(10, e) >= 10 && e++, e; +} +function FI(r, e) { + var t = Db(r), n = Math.pow(10, t), i = r / n, a; + return e ? i < 1.5 ? a = 1 : i < 2.5 ? a = 2 : i < 4 ? a = 3 : i < 7 ? a = 5 : a = 10 : i < 1 ? a = 1 : i < 2 ? a = 2 : i < 3 ? a = 3 : i < 5 ? a = 5 : a = 10, r = a * n, t >= -20 ? +r.toFixed(t < 0 ? -t : 0) : r; +} +function z0(r, e) { + var t = (r.length - 1) * e + 1, n = Math.floor(t), i = +r[n - 1], a = t - n; + return a ? i + a * (r[n] - i) : i; +} +function A1(r) { + r.sort(function(l, u) { + return s(l, u, 0) ? -1 : 1; + }); + for (var e = -1 / 0, t = 1, n = 0; n < r.length; ) { + for (var i = r[n].interval, a = r[n].close, o = 0; o < 2; o++) + i[o] <= e && (i[o] = e, a[o] = o ? 1 : 1 - t), e = i[o], t = a[o]; + i[0] === i[1] && a[0] * a[1] !== 1 ? r.splice(n, 1) : n++; + } + return r; + function s(l, u, c) { + return l.interval[c] < u.interval[c] || l.interval[c] === u.interval[c] && (l.close[c] - u.close[c] === (c ? -1 : 1) || !c && s(l, u, 1)); + } +} +function Il(r) { + var e = parseFloat(r); + return e == r && (e !== 0 || !ut(r) || r.indexOf("x") <= 0) ? e : NaN; +} +function $I(r) { + return !isNaN(Il(r)); +} +function Qj() { + return Math.round(Math.random() * 9); +} +function qj(r, e) { + return e === 0 ? r : qj(e, r % e); +} +function dk(r, e) { + return r == null ? e : e == null ? r : r * e / qj(r, e); +} +function Ur(r) { + throw new Error(r); +} +function vk(r, e, t) { + return (e - r) * t + r; +} +var e5 = "series\0", t5 = "\0_ec_\0"; +function ln(r) { + return r instanceof Array ? r : r == null ? [] : [r]; +} +function Gh(r, e, t) { + if (r) { + r[e] = r[e] || {}, r.emphasis = r.emphasis || {}, r.emphasis[e] = r.emphasis[e] || {}; + for (var n = 0, i = t.length; n < i; n++) { + var a = t[n]; + !r.emphasis[e].hasOwnProperty(a) && r[e].hasOwnProperty(a) && (r.emphasis[e][a] = r[e][a]); + } + } +} +var pk = ["fontStyle", "fontWeight", "fontSize", "fontFamily", "rich", "tag", "color", "textBorderColor", "textBorderWidth", "width", "height", "lineHeight", "align", "verticalAlign", "baseline", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "textShadowColor", "textShadowBlur", "textShadowOffsetX", "textShadowOffsetY", "backgroundColor", "borderColor", "borderWidth", "borderRadius", "padding"]; +function Xd(r) { + return kt(r) && !We(r) && !(r instanceof Date) ? r.value : r; +} +function vZ(r) { + return kt(r) && !(r instanceof Array); +} +function r5(r, e, t) { + var n = t === "normalMerge", i = t === "replaceMerge", a = t === "replaceAll"; + r = r || [], e = (e || []).slice(); + var o = xt(); + X(e, function(l, u) { + if (!kt(l)) { + e[u] = null; + return; + } + }); + var s = pZ(r, o, t); + return (n || i) && gZ(s, r, o, e), n && mZ(s, e), n || i ? yZ(s, e, i) : a && _Z(s, e), bZ(s), s; +} +function pZ(r, e, t) { + var n = []; + if (t === "replaceAll") + return n; + for (var i = 0; i < r.length; i++) { + var a = r[i]; + a && a.id != null && e.set(a.id, i), n.push({ + existing: t === "replaceMerge" || dg(a) ? null : a, + newOption: null, + keyInfo: null, + brandNew: null + }); + } + return n; +} +function gZ(r, e, t, n) { + X(n, function(i, a) { + if (!(!i || i.id == null)) { + var o = $p(i.id), s = t.get(o); + if (s != null) { + var l = r[s]; + pa(!l.newOption, 'Duplicated option on id "' + o + '".'), l.newOption = i, l.existing = e[s], n[a] = null; + } + } + }); +} +function mZ(r, e) { + X(e, function(t, n) { + if (!(!t || t.name == null)) + for (var i = 0; i < r.length; i++) { + var a = r[i].existing; + if (!r[i].newOption && a && (a.id == null || t.id == null) && !dg(t) && !dg(a) && n5("name", a, t)) { + r[i].newOption = t, e[n] = null; + return; + } + } + }); +} +function yZ(r, e, t) { + X(e, function(n) { + if (n) { + for ( + var i, a = 0; + // Be `!resultItem` only when `nextIdx >= result.length`. + (i = r[a]) && // (1) Existing models that already have id should be able to mapped to. Because + // after mapping performed, model will always be assigned with an id if user not given. + // After that all models have id. + // (2) If new option has id, it can only set to a hole or append to the last. It should + // not be merged to the existings with different id. Because id should not be overwritten. + // (3) Name can be overwritten, because axis use name as 'show label text'. + (i.newOption || dg(i.existing) || // In mode "replaceMerge", here no not-mapped-non-internal-existing. + i.existing && n.id != null && !n5("id", n, i.existing)); + ) + a++; + i ? (i.newOption = n, i.brandNew = t) : r.push({ + newOption: n, + brandNew: t, + existing: null, + keyInfo: null + }), a++; + } + }); +} +function _Z(r, e) { + X(e, function(t) { + r.push({ + newOption: t, + brandNew: !0, + existing: null, + keyInfo: null + }); + }); +} +function bZ(r) { + var e = xt(); + X(r, function(t) { + var n = t.existing; + n && e.set(n.id, t); + }), X(r, function(t) { + var n = t.newOption; + pa(!n || n.id == null || !e.get(n.id) || e.get(n.id) === t, "id duplicates: " + (n && n.id)), n && n.id != null && e.set(n.id, t), !t.keyInfo && (t.keyInfo = {}); + }), X(r, function(t, n) { + var i = t.existing, a = t.newOption, o = t.keyInfo; + if (kt(a)) { + if (o.name = a.name != null ? $p(a.name) : i ? i.name : e5 + n, i) + o.id = $p(i.id); + else if (a.id != null) + o.id = $p(a.id); + else { + var s = 0; + do + o.id = "\0" + o.name + "\0" + s++; + while (e.get(o.id)); + } + e.set(o.id, t); + } + }); +} +function n5(r, e, t) { + var n = Si(e[r], null), i = Si(t[r], null); + return n != null && i != null && n === i; +} +function $p(r) { + return Si(r, ""); +} +function Si(r, e) { + return r == null ? e : ut(r) ? r : Pr(r) || s_(r) ? r + "" : e; +} +function HI(r) { + var e = r.name; + return !!(e && e.indexOf(e5)); +} +function dg(r) { + return r && r.id != null && $p(r.id).indexOf(t5) === 0; +} +function xZ(r) { + return t5 + r; +} +function SZ(r, e, t) { + X(r, function(n) { + var i = n.newOption; + kt(i) && (n.keyInfo.mainType = e, n.keyInfo.subType = wZ(e, i, n.existing, t)); + }); +} +function wZ(r, e, t, n) { + var i = e.type ? e.type : t ? t.subType : n.determineSubType(r, e); + return i; +} +function CZ(r, e) { + var t = {}, n = {}; + return i(r || [], t), i(e || [], n, t), [a(t), a(n)]; + function i(o, s, l) { + for (var u = 0, c = o.length; u < c; u++) { + var h = Si(o[u].seriesId, null); + if (h == null) + return; + for (var f = ln(o[u].dataIndex), v = l && l[h], b = 0, w = f.length; b < w; b++) { + var p = f[b]; + v && v[p] ? v[p] = null : (s[h] || (s[h] = {}))[p] = 1; + } + } + } + function a(o, s) { + var l = []; + for (var u in o) + if (o.hasOwnProperty(u) && o[u] != null) + if (s) + l.push(+u); + else { + var c = a(o[u], !0); + c.length && l.push({ + seriesId: u, + dataIndex: c + }); + } + return l; + } +} +function Uh(r, e) { + if (e.dataIndexInside != null) + return e.dataIndexInside; + if (e.dataIndex != null) + return We(e.dataIndex) ? Ke(e.dataIndex, function(t) { + return r.indexOfRawIndex(t); + }) : r.indexOfRawIndex(e.dataIndex); + if (e.name != null) + return We(e.name) ? Ke(e.name, function(t) { + return r.indexOfName(t); + }) : r.indexOfName(e.name); +} +function Rr() { + var r = "__ec_inner_" + TZ++; + return function(e) { + return e[r] || (e[r] = {}); + }; +} +var TZ = Qj(); +function Hp(r, e, t) { + var n = VI(e, t), i = n.mainTypeSpecified, a = n.queryOptionMap, o = n.others, s = o, l = t ? t.defaultMainType : null; + return !i && l && a.set(l, {}), a.each(function(u, c) { + var h = Jg(r, c, u, { + useDefault: l === c, + enableAll: t && t.enableAll != null ? t.enableAll : !0, + enableNone: t && t.enableNone != null ? t.enableNone : !0 + }); + s[c + "Models"] = h.models, s[c + "Model"] = h.models[0]; + }), s; +} +function VI(r, e) { + var t; + if (ut(r)) { + var n = {}; + n[r + "Index"] = 0, t = n; + } else + t = r; + var i = xt(), a = {}, o = !1; + return X(t, function(s, l) { + if (l === "dataIndex" || l === "dataIndexInside") { + a[l] = s; + return; + } + var u = l.match(/^(\w+)(Index|Id|Name)$/) || [], c = u[1], h = (u[2] || "").toLowerCase(); + if (!(!c || !h || e && e.includeMainTypes && ir(e.includeMainTypes, c) < 0)) { + o = o || !!c; + var f = i.get(c) || i.set(c, {}); + f[h] = s; + } + }), { + mainTypeSpecified: o, + queryOptionMap: i, + others: a + }; +} +var mi = { + useDefault: !0, + enableAll: !1, + enableNone: !1 +}, IZ = { + useDefault: !1, + enableAll: !0, + enableNone: !0 +}; +function Jg(r, e, t, n) { + n = n || mi; + var i = t.index, a = t.id, o = t.name, s = { + models: null, + specified: i != null || a != null || o != null + }; + if (!s.specified) { + var l = void 0; + return s.models = n.useDefault && (l = r.getComponent(e)) ? [l] : [], s; + } + return i === "none" || i === !1 ? (pa(n.enableNone, '`"none"` or `false` is not a valid value on index option.'), s.models = [], s) : (i === "all" && (pa(n.enableAll, '`"all"` is not a valid value on index option.'), i = a = o = null), s.models = r.queryComponents({ + mainType: e, + index: i, + id: a, + name: o + }), s); +} +function i5(r, e, t) { + r.setAttribute ? r.setAttribute(e, t) : r[e] = t; +} +function AZ(r, e) { + return r.getAttribute ? r.getAttribute(e) : r[e]; +} +function EZ(r) { + return r === "auto" ? Dr.domSupported ? "html" : "richText" : r || "html"; +} +function E1(r, e) { + var t = xt(), n = []; + return X(r, function(i) { + var a = e(i); + (t.get(a) || (n.push(a), t.set(a, []))).push(i); + }), { + keys: n, + buckets: t + }; +} +function a5(r, e, t, n, i) { + var a = e == null || e === "auto"; + if (n == null) + return n; + if (Pr(n)) { + var o = vk(t || 0, n, i); + return Vn(o, a ? Math.max(Ds(t || 0), Ds(n)) : e); + } else { + if (ut(n)) + return i < 1 ? t : n; + for (var s = [], l = t, u = n, c = Math.max(l ? l.length : 0, u.length), h = 0; h < c; ++h) { + var f = r.getDimensionInfo(h); + if (f && f.type === "ordinal") + s[h] = (i < 1 && l ? l : u)[h]; + else { + var v = l && l[h] ? l[h] : 0, b = u[h], o = vk(v, b, i); + s[h] = Vn(o, a ? Math.max(Ds(v), Ds(b)) : e); + } + } + return s; + } +} +var MZ = ".", Yc = "___EC__COMPONENT__CONTAINER___", o5 = "___EC__EXTENDED_CLASS___"; +function gl(r) { + var e = { + main: "", + sub: "" + }; + if (r) { + var t = r.split(MZ); + e.main = t[0] || "", e.sub = t[1] || ""; + } + return e; +} +function DZ(r) { + pa(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(r), 'componentType "' + r + '" illegal'); +} +function kZ(r) { + return !!(r && r[o5]); +} +function GI(r, e) { + r.$constructor = r, r.extend = function(t) { + var n = this, i; + return OZ(n) ? i = /** @class */ + function(a) { + Pe(o, a); + function o() { + return a.apply(this, arguments) || this; + } + return o; + }(n) : (i = function() { + (t.$constructor || n).apply(this, arguments); + }, MI(i, this)), Fe(i.prototype, t), i[o5] = !0, i.extend = this.extend, i.superCall = RZ, i.superApply = NZ, i.superClass = n, i; + }; +} +function OZ(r) { + return Tt(r) && /^class\s/.test(Function.prototype.toString.call(r)); +} +function s5(r, e) { + r.extend = e.extend; +} +var LZ = Math.round(Math.random() * 10); +function PZ(r) { + var e = ["__\0is_clz", LZ++].join("_"); + r.prototype[e] = !0, r.isInstance = function(t) { + return !!(t && t[e]); + }; +} +function RZ(r, e) { + for (var t = [], n = 2; n < arguments.length; n++) + t[n - 2] = arguments[n]; + return this.superClass.prototype[e].apply(r, t); +} +function NZ(r, e, t) { + return this.superClass.prototype[e].apply(r, t); +} +function kb(r) { + var e = {}; + r.registerClass = function(n) { + var i = n.type || n.prototype.type; + if (i) { + DZ(i), n.prototype.type = i; + var a = gl(i); + if (!a.sub) + e[a.main] = n; + else if (a.sub !== Yc) { + var o = t(a); + o[a.sub] = n; + } + } + return n; + }, r.getClass = function(n, i, a) { + var o = e[n]; + if (o && o[Yc] && (o = i ? o[i] : null), a && !o) + throw new Error(i ? "Component " + n + "." + (i || "") + " is used but not imported." : n + ".type should be specified."); + return o; + }, r.getClassesByMainType = function(n) { + var i = gl(n), a = [], o = e[i.main]; + return o && o[Yc] ? X(o, function(s, l) { + l !== Yc && a.push(s); + }) : a.push(o), a; + }, r.hasClass = function(n) { + var i = gl(n); + return !!e[i.main]; + }, r.getAllClassMainTypes = function() { + var n = []; + return X(e, function(i, a) { + n.push(a); + }), n; + }, r.hasSubTypes = function(n) { + var i = gl(n), a = e[i.main]; + return a && a[Yc]; + }; + function t(n) { + var i = e[n.main]; + return (!i || !i[Yc]) && (i = e[n.main] = {}, i[Yc] = !0), i; + } +} +function Wh(r, e) { + for (var t = 0; t < r.length; t++) + r[t][1] || (r[t][1] = r[t][0]); + return e = e || !1, function(n, i, a) { + for (var o = {}, s = 0; s < r.length; s++) { + var l = r[s][1]; + if (!(i && ir(i, l) >= 0 || a && ir(a, l) < 0)) { + var u = n.getShallow(l, e); + u != null && (o[r[s][0]] = u); + } + } + return o; + }; +} +var zZ = [ + ["fill", "color"], + ["shadowBlur"], + ["shadowOffsetX"], + ["shadowOffsetY"], + ["opacity"], + ["shadowColor"] + // Option decal is in `DecalObject` but style.decal is in `PatternObject`. + // So do not transfer decal directly. +], BZ = Wh(zZ), jZ = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getAreaStyle = function(e, t) { + return BZ(this, e, t); + }, r; + }() +), M1 = new Xg(50); +function FZ(r) { + if (typeof r == "string") { + var e = M1.get(r); + return e && e.image; + } else + return r; +} +function UI(r, e, t, n, i) { + if (r) + if (typeof r == "string") { + if (e && e.__zrImageSrc === r || !t) + return e; + var a = M1.get(r), o = { hostEl: t, cb: n, cbPayload: i }; + return a ? (e = a.image, !Ob(e) && a.pending.push(o)) : (e = Bs.loadImage(r, gk, gk), e.__zrImageSrc = r, M1.put(r, e.__cachedImgObj = { + image: e, + pending: [o] + })), e; + } else + return r; + else + return e; +} +function gk() { + var r = this.__cachedImgObj; + this.onload = this.onerror = this.__cachedImgObj = null; + for (var e = 0; e < r.pending.length; e++) { + var t = r.pending[e], n = t.cb; + n && n(this, t.cbPayload), t.hostEl.dirty(); + } + r.pending.length = 0; +} +function Ob(r) { + return r && r.width && r.height; +} +var wS = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g; +function l5(r, e, t, n, i) { + if (!e) + return ""; + var a = (r + "").split(` +`); + i = u5(e, t, n, i); + for (var o = 0, s = a.length; o < s; o++) + a[o] = c5(a[o], i); + return a.join(` +`); +} +function u5(r, e, t, n) { + n = n || {}; + var i = Fe({}, n); + i.font = e, t = Jt(t, "..."), i.maxIterations = Jt(n.maxIterations, 2); + var a = i.minChar = Jt(n.minChar, 0); + i.cnCharWidth = _o("国", e); + var o = i.ascCharWidth = _o("a", e); + i.placeholder = Jt(n.placeholder, ""); + for (var s = r = Math.max(0, r - 1), l = 0; l < a && s >= o; l++) + s -= o; + var u = _o(t, e); + return u > s && (t = "", u = 0), s = r - u, i.ellipsis = t, i.ellipsisWidth = u, i.contentWidth = s, i.containerWidth = r, i; +} +function c5(r, e) { + var t = e.containerWidth, n = e.font, i = e.contentWidth; + if (!t) + return ""; + var a = _o(r, n); + if (a <= t) + return r; + for (var o = 0; ; o++) { + if (a <= i || o >= e.maxIterations) { + r += e.ellipsis; + break; + } + var s = o === 0 ? $Z(r, i, e.ascCharWidth, e.cnCharWidth) : a > 0 ? Math.floor(r.length * i / a) : 0; + r = r.substr(0, s), a = _o(r, n); + } + return r === "" && (r = e.placeholder), r; +} +function $Z(r, e, t, n) { + for (var i = 0, a = 0, o = r.length; a < o && i < e; a++) { + var s = r.charCodeAt(a); + i += 0 <= s && s <= 127 ? t : n; + } + return a; +} +function HZ(r, e) { + r != null && (r += ""); + var t = e.overflow, n = e.padding, i = e.font, a = t === "truncate", o = Mb(i), s = Jt(e.lineHeight, o), l = !!e.backgroundColor, u = e.lineOverflow === "truncate", c = e.width, h; + c != null && (t === "break" || t === "breakAll") ? h = r ? h5(r, e.font, c, t === "breakAll", 0).lines : [] : h = r ? r.split(` +`) : []; + var f = h.length * s, v = Jt(e.height, f); + if (f > v && u) { + var b = Math.floor(v / s); + h = h.slice(0, b); + } + if (r && a && c != null) + for (var w = u5(c, i, e.ellipsis, { + minChar: e.truncateMinChar, + placeholder: e.placeholder + }), p = 0; p < h.length; p++) + h[p] = c5(h[p], w); + for (var d = v, m = 0, p = 0; p < h.length; p++) + m = Math.max(_o(h[p], i), m); + c == null && (c = m); + var _ = m; + return n && (d += n[0] + n[2], _ += n[1] + n[3], c += n[1] + n[3]), l && (_ = c), { + lines: h, + height: v, + outerWidth: _, + outerHeight: d, + lineHeight: s, + calculatedLineHeight: o, + contentWidth: m, + contentHeight: f, + width: c + }; +} +var VZ = function() { + function r() { + } + return r; +}(), mk = function() { + function r(e) { + this.tokens = [], e && (this.tokens = e); + } + return r; +}(), GZ = function() { + function r() { + this.width = 0, this.height = 0, this.contentWidth = 0, this.contentHeight = 0, this.outerWidth = 0, this.outerHeight = 0, this.lines = []; + } + return r; +}(); +function UZ(r, e) { + var t = new GZ(); + if (r != null && (r += ""), !r) + return t; + for (var n = e.width, i = e.height, a = e.overflow, o = (a === "break" || a === "breakAll") && n != null ? { width: n, accumWidth: 0, breakAll: a === "breakAll" } : null, s = wS.lastIndex = 0, l; (l = wS.exec(r)) != null; ) { + var u = l.index; + u > s && CS(t, r.substring(s, u), e, o), CS(t, l[2], e, o, l[1]), s = wS.lastIndex; + } + s < r.length && CS(t, r.substring(s, r.length), e, o); + var c = [], h = 0, f = 0, v = e.padding, b = a === "truncate", w = e.lineOverflow === "truncate"; + function p(G, Q, ee) { + G.width = Q, G.lineHeight = ee, h += ee, f = Math.max(f, Q); + } + e: + for (var d = 0; d < t.lines.length; d++) { + for (var m = t.lines[d], _ = 0, y = 0, x = 0; x < m.tokens.length; x++) { + var g = m.tokens[x], S = g.styleName && e.rich[g.styleName] || {}, T = g.textPadding = S.padding, C = T ? T[1] + T[3] : 0, E = g.font = S.font || e.font; + g.contentHeight = Mb(E); + var M = Jt(S.height, g.contentHeight); + if (g.innerHeight = M, T && (M += T[0] + T[2]), g.height = M, g.lineHeight = Ps(S.lineHeight, e.lineHeight, M), g.align = S && S.align || e.align, g.verticalAlign = S && S.verticalAlign || "middle", w && i != null && h + g.lineHeight > i) { + x > 0 ? (m.tokens = m.tokens.slice(0, x), p(m, y, _), t.lines = t.lines.slice(0, d + 1)) : t.lines = t.lines.slice(0, d); + break e; + } + var P = S.width, R = P == null || P === "auto"; + if (typeof P == "string" && P.charAt(P.length - 1) === "%") + g.percentWidth = P, c.push(g), g.contentWidth = _o(g.text, E); + else { + if (R) { + var N = S.backgroundColor, F = N && N.image; + F && (F = FZ(F), Ob(F) && (g.width = Math.max(g.width, F.width * M / F.height))); + } + var U = b && n != null ? n - y : null; + U != null && U < g.width ? !R || U < C ? (g.text = "", g.width = g.contentWidth = 0) : (g.text = l5(g.text, U - C, E, e.ellipsis, { minChar: e.truncateMinChar }), g.width = g.contentWidth = _o(g.text, E)) : g.contentWidth = _o(g.text, E); + } + g.width += C, y += g.width, S && (_ = Math.max(_, g.lineHeight)); + } + p(m, y, _); + } + t.outerWidth = t.width = Jt(n, f), t.outerHeight = t.height = Jt(i, h), t.contentHeight = h, t.contentWidth = f, v && (t.outerWidth += v[1] + v[3], t.outerHeight += v[0] + v[2]); + for (var d = 0; d < c.length; d++) { + var g = c[d], $ = g.percentWidth; + g.width = parseInt($, 10) / 100 * t.width; + } + return t; +} +function CS(r, e, t, n, i) { + var a = e === "", o = i && t.rich[i] || {}, s = r.lines, l = o.font || t.font, u = !1, c, h; + if (n) { + var f = o.padding, v = f ? f[1] + f[3] : 0; + if (o.width != null && o.width !== "auto") { + var b = Fs(o.width, n.width) + v; + s.length > 0 && b + n.accumWidth > n.width && (c = e.split(` +`), u = !0), n.accumWidth = b; + } else { + var w = h5(e, l, n.width, n.breakAll, n.accumWidth); + n.accumWidth = w.accumWidth + v, h = w.linesWidths, c = w.lines; + } + } else + c = e.split(` +`); + for (var p = 0; p < c.length; p++) { + var d = c[p], m = new VZ(); + if (m.styleName = i, m.text = d, m.isLineHolder = !d && !a, typeof o.width == "number" ? m.width = o.width : m.width = h ? h[p] : _o(d, l), !p && !u) { + var _ = (s[s.length - 1] || (s[0] = new mk())).tokens, y = _.length; + y === 1 && _[0].isLineHolder ? _[0] = m : (d || !y || a) && _.push(m); + } else + s.push(new mk([m])); + } +} +function WZ(r) { + var e = r.charCodeAt(0); + return e >= 32 && e <= 591 || e >= 880 && e <= 4351 || e >= 4608 && e <= 5119 || e >= 7680 && e <= 8303; +} +var YZ = es(",&?/;] ".split(""), function(r, e) { + return r[e] = !0, r; +}, {}); +function XZ(r) { + return WZ(r) ? !!YZ[r] : !0; +} +function h5(r, e, t, n, i) { + for (var a = [], o = [], s = "", l = "", u = 0, c = 0, h = 0; h < r.length; h++) { + var f = r.charAt(h); + if (f === ` +`) { + l && (s += l, c += u), a.push(s), o.push(c), s = "", l = "", u = 0, c = 0; + continue; + } + var v = _o(f, e), b = n ? !1 : !XZ(f); + if (a.length ? c + v > t : i + c + v > t) { + c ? (s || l) && (b ? (s || (s = l, l = "", u = 0, c = u), a.push(s), o.push(c - u), l += f, u += v, s = "", c = u) : (l && (s += l, l = "", u = 0), a.push(s), o.push(c), s = f, c = v)) : b ? (a.push(l), o.push(u), l = f, u = v) : (a.push(f), o.push(v)); + continue; + } + c += v, b ? (l += f, u += v) : (l && (s += l, l = "", u = 0), s += f); + } + return !a.length && !s && (s = r, l = "", u = 0), l && (s += l), s && (a.push(s), o.push(c)), a.length === 1 && (c += i), { + accumWidth: c, + lines: a, + linesWidths: o + }; +} +var D1 = "__zr_style_" + Math.round(Math.random() * 10), Ph = { + shadowBlur: 0, + shadowOffsetX: 0, + shadowOffsetY: 0, + shadowColor: "#000", + opacity: 1, + blend: "source-over" +}, Lb = { + style: { + shadowBlur: !0, + shadowOffsetX: !0, + shadowOffsetY: !0, + shadowColor: !0, + opacity: !0 + } +}; +Ph[D1] = !0; +var yk = ["z", "z2", "invisible"], ZZ = ["invisible"], JZ = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype._init = function(t) { + for (var n = yr(t), i = 0; i < n.length; i++) { + var a = n[i]; + a === "style" ? this.useStyle(t[a]) : r.prototype.attrKV.call(this, a, t[a]); + } + this.style || this.useStyle({}); + }, e.prototype.beforeBrush = function() { + }, e.prototype.afterBrush = function() { + }, e.prototype.innerBeforeBrush = function() { + }, e.prototype.innerAfterBrush = function() { + }, e.prototype.shouldBePainted = function(t, n, i, a) { + var o = this.transform; + if (this.ignore || this.invisible || this.style.opacity === 0 || this.culling && KZ(this, t, n) || o && !o[0] && !o[3]) + return !1; + if (i && this.__clipPaths) { + for (var s = 0; s < this.__clipPaths.length; ++s) + if (this.__clipPaths[s].isZeroArea()) + return !1; + } + if (a && this.parent) + for (var l = this.parent; l; ) { + if (l.ignore) + return !1; + l = l.parent; + } + return !0; + }, e.prototype.contain = function(t, n) { + return this.rectContain(t, n); + }, e.prototype.traverse = function(t, n) { + t.call(n, this); + }, e.prototype.rectContain = function(t, n) { + var i = this.transformCoordToLocal(t, n), a = this.getBoundingRect(); + return a.contain(i[0], i[1]); + }, e.prototype.getPaintRect = function() { + var t = this._paintRect; + if (!this._paintRect || this.__dirty) { + var n = this.transform, i = this.getBoundingRect(), a = this.style, o = a.shadowBlur || 0, s = a.shadowOffsetX || 0, l = a.shadowOffsetY || 0; + t = this._paintRect || (this._paintRect = new Wt(0, 0, 0, 0)), n ? Wt.applyTransform(t, i, n) : t.copy(i), (o || s || l) && (t.width += o * 2 + Math.abs(s), t.height += o * 2 + Math.abs(l), t.x = Math.min(t.x, t.x + s - o), t.y = Math.min(t.y, t.y + l - o)); + var u = this.dirtyRectTolerance; + t.isZero() || (t.x = Math.floor(t.x - u), t.y = Math.floor(t.y - u), t.width = Math.ceil(t.width + 1 + u * 2), t.height = Math.ceil(t.height + 1 + u * 2)); + } + return t; + }, e.prototype.setPrevPaintRect = function(t) { + t ? (this._prevPaintRect = this._prevPaintRect || new Wt(0, 0, 0, 0), this._prevPaintRect.copy(t)) : this._prevPaintRect = null; + }, e.prototype.getPrevPaintRect = function() { + return this._prevPaintRect; + }, e.prototype.animateStyle = function(t) { + return this.animate("style", t); + }, e.prototype.updateDuringAnimation = function(t) { + t === "style" ? this.dirtyStyle() : this.markRedraw(); + }, e.prototype.attrKV = function(t, n) { + t !== "style" ? r.prototype.attrKV.call(this, t, n) : this.style ? this.setStyle(n) : this.useStyle(n); + }, e.prototype.setStyle = function(t, n) { + return typeof t == "string" ? this.style[t] = n : Fe(this.style, t), this.dirtyStyle(), this; + }, e.prototype.dirtyStyle = function(t) { + t || this.markRedraw(), this.__dirty |= Cp, this._rect && (this._rect = null); + }, e.prototype.dirty = function() { + this.dirtyStyle(); + }, e.prototype.styleChanged = function() { + return !!(this.__dirty & Cp); + }, e.prototype.styleUpdated = function() { + this.__dirty &= ~Cp; + }, e.prototype.createStyle = function(t) { + return Wg(Ph, t); + }, e.prototype.useStyle = function(t) { + t[D1] || (t = this.createStyle(t)), this.__inHover ? this.__hoverStyle = t : this.style = t, this.dirtyStyle(); + }, e.prototype.isStyleObject = function(t) { + return t[D1]; + }, e.prototype._innerSaveToNormal = function(t) { + r.prototype._innerSaveToNormal.call(this, t); + var n = this._normalState; + t.style && !n.style && (n.style = this._mergeStyle(this.createStyle(), this.style)), this._savePrimaryToNormal(t, n, yk); + }, e.prototype._applyStateObj = function(t, n, i, a, o, s) { + r.prototype._applyStateObj.call(this, t, n, i, a, o, s); + var l = !(n && a), u; + if (n && n.style ? o ? a ? u = n.style : (u = this._mergeStyle(this.createStyle(), i.style), this._mergeStyle(u, n.style)) : (u = this._mergeStyle(this.createStyle(), a ? this.style : i.style), this._mergeStyle(u, n.style)) : l && (u = i.style), u) + if (o) { + var c = this.style; + if (this.style = this.createStyle(l ? {} : c), l) + for (var h = yr(c), f = 0; f < h.length; f++) { + var v = h[f]; + v in u && (u[v] = u[v], this.style[v] = c[v]); + } + for (var b = yr(u), f = 0; f < b.length; f++) { + var v = b[f]; + this.style[v] = this.style[v]; + } + this._transitionState(t, { + style: u + }, s, this.getAnimationStyleProps()); + } else + this.useStyle(u); + for (var w = this.__inHover ? ZZ : yk, f = 0; f < w.length; f++) { + var v = w[f]; + n && n[v] != null ? this[v] = n[v] : l && i[v] != null && (this[v] = i[v]); + } + }, e.prototype._mergeStates = function(t) { + for (var n = r.prototype._mergeStates.call(this, t), i, a = 0; a < t.length; a++) { + var o = t[a]; + o.style && (i = i || {}, this._mergeStyle(i, o.style)); + } + return i && (n.style = i), n; + }, e.prototype._mergeStyle = function(t, n) { + return Fe(t, n), t; + }, e.prototype.getAnimationStyleProps = function() { + return Lb; + }, e.initDefaultProps = function() { + var t = e.prototype; + t.type = "displayable", t.invisible = !1, t.z = 0, t.z2 = 0, t.zlevel = 0, t.culling = !1, t.cursor = "pointer", t.rectHover = !1, t.incremental = !1, t._rect = null, t.dirtyRectTolerance = 0, t.__dirty = go | Cp; + }(), e; +}(Gj), TS = new Wt(0, 0, 0, 0), IS = new Wt(0, 0, 0, 0); +function KZ(r, e, t) { + return TS.copy(r.getBoundingRect()), r.transform && TS.applyTransform(r.transform), IS.width = e, IS.height = t, !TS.intersect(IS); +} +const ts = JZ; +var Qa = Math.min, qa = Math.max, AS = Math.sin, ES = Math.cos, Xc = Math.PI * 2, Ey = Sc(), My = Sc(), Dy = Sc(); +function Pb(r, e, t) { + if (r.length !== 0) { + for (var n = r[0], i = n[0], a = n[0], o = n[1], s = n[1], l = 1; l < r.length; l++) + n = r[l], i = Qa(i, n[0]), a = qa(a, n[0]), o = Qa(o, n[1]), s = qa(s, n[1]); + e[0] = i, e[1] = o, t[0] = a, t[1] = s; + } +} +function _k(r, e, t, n, i, a) { + i[0] = Qa(r, t), i[1] = Qa(e, n), a[0] = qa(r, t), a[1] = qa(e, n); +} +var bk = [], xk = []; +function QZ(r, e, t, n, i, a, o, s, l, u) { + var c = Ij, h = Ti, f = c(r, t, i, o, bk); + l[0] = 1 / 0, l[1] = 1 / 0, u[0] = -1 / 0, u[1] = -1 / 0; + for (var v = 0; v < f; v++) { + var b = h(r, t, i, o, bk[v]); + l[0] = Qa(b, l[0]), u[0] = qa(b, u[0]); + } + f = c(e, n, a, s, xk); + for (var v = 0; v < f; v++) { + var w = h(e, n, a, s, xk[v]); + l[1] = Qa(w, l[1]), u[1] = qa(w, u[1]); + } + l[0] = Qa(r, l[0]), u[0] = qa(r, u[0]), l[0] = Qa(o, l[0]), u[0] = qa(o, u[0]), l[1] = Qa(e, l[1]), u[1] = qa(e, u[1]), l[1] = Qa(s, l[1]), u[1] = qa(s, u[1]); +} +function qZ(r, e, t, n, i, a, o, s) { + var l = Ej, u = Ri, c = qa(Qa(l(r, t, i), 1), 0), h = qa(Qa(l(e, n, a), 1), 0), f = u(r, t, i, c), v = u(e, n, a, h); + o[0] = Qa(r, i, f), o[1] = Qa(e, a, v), s[0] = qa(r, i, f), s[1] = qa(e, a, v); +} +function eJ(r, e, t, n, i, a, o, s, l) { + var u = Ul, c = Wl, h = Math.abs(i - a); + if (h % Xc < 1e-4 && h > 1e-4) { + s[0] = r - t, s[1] = e - n, l[0] = r + t, l[1] = e + n; + return; + } + if (Ey[0] = ES(i) * t + r, Ey[1] = AS(i) * n + e, My[0] = ES(a) * t + r, My[1] = AS(a) * n + e, u(s, Ey, My), c(l, Ey, My), i = i % Xc, i < 0 && (i = i + Xc), a = a % Xc, a < 0 && (a = a + Xc), i > a && !o ? a += Xc : i < a && o && (i += Xc), o) { + var f = a; + a = i, i = f; + } + for (var v = 0; v < a; v += Math.PI / 2) + v > i && (Dy[0] = ES(v) * t + r, Dy[1] = AS(v) * n + e, u(s, Dy, s), c(l, Dy, l)); +} +var pn = { + M: 1, + L: 2, + C: 3, + Q: 4, + A: 5, + Z: 6, + R: 7 +}, Zc = [], Jc = [], al = [], Lu = [], ol = [], sl = [], MS = Math.min, DS = Math.max, Kc = Math.cos, Qc = Math.sin, jl = Math.abs, k1 = Math.PI, Hu = k1 * 2, kS = typeof Float32Array != "undefined", Kv = []; +function OS(r) { + var e = Math.round(r / k1 * 1e8) / 1e8; + return e % 2 * k1; +} +function f5(r, e) { + var t = OS(r[0]); + t < 0 && (t += Hu); + var n = t - r[0], i = r[1]; + i += n, !e && i - t >= Hu ? i = t + Hu : e && t - i >= Hu ? i = t - Hu : !e && t > i ? i = t + (Hu - OS(t - i)) : e && t < i && (i = t - (Hu - OS(i - t))), r[0] = t, r[1] = i; +} +var tJ = function() { + function r(e) { + this.dpr = 1, this._xi = 0, this._yi = 0, this._x0 = 0, this._y0 = 0, this._len = 0, e && (this._saveData = !1), this._saveData && (this.data = []); + } + return r.prototype.increaseVersion = function() { + this._version++; + }, r.prototype.getVersion = function() { + return this._version; + }, r.prototype.setScale = function(e, t, n) { + n = n || 0, n > 0 && (this._ux = jl(n / v_ / e) || 0, this._uy = jl(n / v_ / t) || 0); + }, r.prototype.setDPR = function(e) { + this.dpr = e; + }, r.prototype.setContext = function(e) { + this._ctx = e; + }, r.prototype.getContext = function() { + return this._ctx; + }, r.prototype.beginPath = function() { + return this._ctx && this._ctx.beginPath(), this.reset(), this; + }, r.prototype.reset = function() { + this._saveData && (this._len = 0), this._pathSegLen && (this._pathSegLen = null, this._pathLen = 0), this._version++; + }, r.prototype.moveTo = function(e, t) { + return this._drawPendingPt(), this.addData(pn.M, e, t), this._ctx && this._ctx.moveTo(e, t), this._x0 = e, this._y0 = t, this._xi = e, this._yi = t, this; + }, r.prototype.lineTo = function(e, t) { + var n = jl(e - this._xi), i = jl(t - this._yi), a = n > this._ux || i > this._uy; + if (this.addData(pn.L, e, t), this._ctx && a && this._ctx.lineTo(e, t), a) + this._xi = e, this._yi = t, this._pendingPtDist = 0; + else { + var o = n * n + i * i; + o > this._pendingPtDist && (this._pendingPtX = e, this._pendingPtY = t, this._pendingPtDist = o); + } + return this; + }, r.prototype.bezierCurveTo = function(e, t, n, i, a, o) { + return this._drawPendingPt(), this.addData(pn.C, e, t, n, i, a, o), this._ctx && this._ctx.bezierCurveTo(e, t, n, i, a, o), this._xi = a, this._yi = o, this; + }, r.prototype.quadraticCurveTo = function(e, t, n, i) { + return this._drawPendingPt(), this.addData(pn.Q, e, t, n, i), this._ctx && this._ctx.quadraticCurveTo(e, t, n, i), this._xi = n, this._yi = i, this; + }, r.prototype.arc = function(e, t, n, i, a, o) { + this._drawPendingPt(), Kv[0] = i, Kv[1] = a, f5(Kv, o), i = Kv[0], a = Kv[1]; + var s = a - i; + return this.addData(pn.A, e, t, n, n, i, s, 0, o ? 0 : 1), this._ctx && this._ctx.arc(e, t, n, i, a, o), this._xi = Kc(a) * n + e, this._yi = Qc(a) * n + t, this; + }, r.prototype.arcTo = function(e, t, n, i, a) { + return this._drawPendingPt(), this._ctx && this._ctx.arcTo(e, t, n, i, a), this; + }, r.prototype.rect = function(e, t, n, i) { + return this._drawPendingPt(), this._ctx && this._ctx.rect(e, t, n, i), this.addData(pn.R, e, t, n, i), this; + }, r.prototype.closePath = function() { + this._drawPendingPt(), this.addData(pn.Z); + var e = this._ctx, t = this._x0, n = this._y0; + return e && e.closePath(), this._xi = t, this._yi = n, this; + }, r.prototype.fill = function(e) { + e && e.fill(), this.toStatic(); + }, r.prototype.stroke = function(e) { + e && e.stroke(), this.toStatic(); + }, r.prototype.len = function() { + return this._len; + }, r.prototype.setData = function(e) { + var t = e.length; + !(this.data && this.data.length === t) && kS && (this.data = new Float32Array(t)); + for (var n = 0; n < t; n++) + this.data[n] = e[n]; + this._len = t; + }, r.prototype.appendPath = function(e) { + e instanceof Array || (e = [e]); + for (var t = e.length, n = 0, i = this._len, a = 0; a < t; a++) + n += e[a].len(); + kS && this.data instanceof Float32Array && (this.data = new Float32Array(i + n)); + for (var a = 0; a < t; a++) + for (var o = e[a].data, s = 0; s < o.length; s++) + this.data[i++] = o[s]; + this._len = i; + }, r.prototype.addData = function(e, t, n, i, a, o, s, l, u) { + if (this._saveData) { + var c = this.data; + this._len + arguments.length > c.length && (this._expandData(), c = this.data); + for (var h = 0; h < arguments.length; h++) + c[this._len++] = arguments[h]; + } + }, r.prototype._drawPendingPt = function() { + this._pendingPtDist > 0 && (this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY), this._pendingPtDist = 0); + }, r.prototype._expandData = function() { + if (!(this.data instanceof Array)) { + for (var e = [], t = 0; t < this._len; t++) + e[t] = this.data[t]; + this.data = e; + } + }, r.prototype.toStatic = function() { + if (this._saveData) { + this._drawPendingPt(); + var e = this.data; + e instanceof Array && (e.length = this._len, kS && this._len > 11 && (this.data = new Float32Array(e))); + } + }, r.prototype.getBoundingRect = function() { + al[0] = al[1] = ol[0] = ol[1] = Number.MAX_VALUE, Lu[0] = Lu[1] = sl[0] = sl[1] = -Number.MAX_VALUE; + var e = this.data, t = 0, n = 0, i = 0, a = 0, o; + for (o = 0; o < this._len; ) { + var s = e[o++], l = o === 1; + switch (l && (t = e[o], n = e[o + 1], i = t, a = n), s) { + case pn.M: + t = i = e[o++], n = a = e[o++], ol[0] = i, ol[1] = a, sl[0] = i, sl[1] = a; + break; + case pn.L: + _k(t, n, e[o], e[o + 1], ol, sl), t = e[o++], n = e[o++]; + break; + case pn.C: + QZ(t, n, e[o++], e[o++], e[o++], e[o++], e[o], e[o + 1], ol, sl), t = e[o++], n = e[o++]; + break; + case pn.Q: + qZ(t, n, e[o++], e[o++], e[o], e[o + 1], ol, sl), t = e[o++], n = e[o++]; + break; + case pn.A: + var u = e[o++], c = e[o++], h = e[o++], f = e[o++], v = e[o++], b = e[o++] + v; + o += 1; + var w = !e[o++]; + l && (i = Kc(v) * h + u, a = Qc(v) * f + c), eJ(u, c, h, f, v, b, w, ol, sl), t = Kc(b) * h + u, n = Qc(b) * f + c; + break; + case pn.R: + i = t = e[o++], a = n = e[o++]; + var p = e[o++], d = e[o++]; + _k(i, a, i + p, a + d, ol, sl); + break; + case pn.Z: + t = i, n = a; + break; + } + Ul(al, al, ol), Wl(Lu, Lu, sl); + } + return o === 0 && (al[0] = al[1] = Lu[0] = Lu[1] = 0), new Wt(al[0], al[1], Lu[0] - al[0], Lu[1] - al[1]); + }, r.prototype._calculateLength = function() { + var e = this.data, t = this._len, n = this._ux, i = this._uy, a = 0, o = 0, s = 0, l = 0; + this._pathSegLen || (this._pathSegLen = []); + for (var u = this._pathSegLen, c = 0, h = 0, f = 0; f < t; ) { + var v = e[f++], b = f === 1; + b && (a = e[f], o = e[f + 1], s = a, l = o); + var w = -1; + switch (v) { + case pn.M: + a = s = e[f++], o = l = e[f++]; + break; + case pn.L: { + var p = e[f++], d = e[f++], m = p - a, _ = d - o; + (jl(m) > n || jl(_) > i || f === t - 1) && (w = Math.sqrt(m * m + _ * _), a = p, o = d); + break; + } + case pn.C: { + var y = e[f++], x = e[f++], p = e[f++], d = e[f++], g = e[f++], S = e[f++]; + w = fX(a, o, y, x, p, d, g, S, 10), a = g, o = S; + break; + } + case pn.Q: { + var y = e[f++], x = e[f++], p = e[f++], d = e[f++]; + w = vX(a, o, y, x, p, d, 10), a = p, o = d; + break; + } + case pn.A: + var T = e[f++], C = e[f++], E = e[f++], M = e[f++], P = e[f++], R = e[f++], N = R + P; + f += 1, e[f++], b && (s = Kc(P) * E + T, l = Qc(P) * M + C), w = DS(E, M) * MS(Hu, Math.abs(R)), a = Kc(N) * E + T, o = Qc(N) * M + C; + break; + case pn.R: { + s = a = e[f++], l = o = e[f++]; + var F = e[f++], U = e[f++]; + w = F * 2 + U * 2; + break; + } + case pn.Z: { + var m = s - a, _ = l - o; + w = Math.sqrt(m * m + _ * _), a = s, o = l; + break; + } + } + w >= 0 && (u[h++] = w, c += w); + } + return this._pathLen = c, c; + }, r.prototype.rebuildPath = function(e, t) { + var n = this.data, i = this._ux, a = this._uy, o = this._len, s, l, u, c, h, f, v = t < 1, b, w, p = 0, d = 0, m, _ = 0, y, x; + if (!(v && (this._pathSegLen || this._calculateLength(), b = this._pathSegLen, w = this._pathLen, m = t * w, !m))) + e: + for (var g = 0; g < o; ) { + var S = n[g++], T = g === 1; + switch (T && (u = n[g], c = n[g + 1], s = u, l = c), S !== pn.L && _ > 0 && (e.lineTo(y, x), _ = 0), S) { + case pn.M: + s = u = n[g++], l = c = n[g++], e.moveTo(u, c); + break; + case pn.L: { + h = n[g++], f = n[g++]; + var C = jl(h - u), E = jl(f - c); + if (C > i || E > a) { + if (v) { + var M = b[d++]; + if (p + M > m) { + var P = (m - p) / M; + e.lineTo(u * (1 - P) + h * P, c * (1 - P) + f * P); + break e; + } + p += M; + } + e.lineTo(h, f), u = h, c = f, _ = 0; + } else { + var R = C * C + E * E; + R > _ && (y = h, x = f, _ = R); + } + break; + } + case pn.C: { + var N = n[g++], F = n[g++], U = n[g++], $ = n[g++], G = n[g++], Q = n[g++]; + if (v) { + var M = b[d++]; + if (p + M > m) { + var P = (m - p) / M; + fc(u, N, U, G, P, Zc), fc(c, F, $, Q, P, Jc), e.bezierCurveTo(Zc[1], Jc[1], Zc[2], Jc[2], Zc[3], Jc[3]); + break e; + } + p += M; + } + e.bezierCurveTo(N, F, U, $, G, Q), u = G, c = Q; + break; + } + case pn.Q: { + var N = n[g++], F = n[g++], U = n[g++], $ = n[g++]; + if (v) { + var M = b[d++]; + if (p + M > m) { + var P = (m - p) / M; + sg(u, N, U, P, Zc), sg(c, F, $, P, Jc), e.quadraticCurveTo(Zc[1], Jc[1], Zc[2], Jc[2]); + break e; + } + p += M; + } + e.quadraticCurveTo(N, F, U, $), u = U, c = $; + break; + } + case pn.A: + var ee = n[g++], ce = n[g++], ne = n[g++], fe = n[g++], K = n[g++], Oe = n[g++], xe = n[g++], Ge = !n[g++], oe = ne > fe ? ne : fe, de = jl(ne - fe) > 1e-3, se = K + Oe, te = !1; + if (v) { + var M = b[d++]; + p + M > m && (se = K + Oe * (m - p) / M, te = !0), p += M; + } + if (de && e.ellipse ? e.ellipse(ee, ce, ne, fe, xe, K, se, Ge) : e.arc(ee, ce, oe, K, se, Ge), te) + break e; + T && (s = Kc(K) * ne + ee, l = Qc(K) * fe + ce), u = Kc(se) * ne + ee, c = Qc(se) * fe + ce; + break; + case pn.R: + s = u = n[g], l = c = n[g + 1], h = n[g++], f = n[g++]; + var pe = n[g++], re = n[g++]; + if (v) { + var M = b[d++]; + if (p + M > m) { + var ae = m - p; + e.moveTo(h, f), e.lineTo(h + MS(ae, pe), f), ae -= pe, ae > 0 && e.lineTo(h + pe, f + MS(ae, re)), ae -= re, ae > 0 && e.lineTo(h + DS(pe - ae, 0), f + re), ae -= pe, ae > 0 && e.lineTo(h, f + DS(re - ae, 0)); + break e; + } + p += M; + } + e.rect(h, f, pe, re); + break; + case pn.Z: + if (v) { + var M = b[d++]; + if (p + M > m) { + var P = (m - p) / M; + e.lineTo(u * (1 - P) + s * P, c * (1 - P) + l * P); + break e; + } + p += M; + } + e.closePath(), u = s, c = l; + } + } + }, r.prototype.clone = function() { + var e = new r(), t = this.data; + return e.data = t.slice ? t.slice() : Array.prototype.slice.call(t), e._len = this._len, e; + }, r.CMD = pn, r.initDefaultProps = function() { + var e = r.prototype; + e._saveData = !0, e._ux = 0, e._uy = 0, e._pendingPtDist = 0, e._version = 0; + }(), r; +}(); +const Al = tJ; +function Uu(r, e, t, n, i, a, o) { + if (i === 0) + return !1; + var s = i, l = 0, u = r; + if (o > e + s && o > n + s || o < e - s && o < n - s || a > r + s && a > t + s || a < r - s && a < t - s) + return !1; + if (r !== t) + l = (e - n) / (r - t), u = (r * n - t * e) / (r - t); + else + return Math.abs(a - r) <= s / 2; + var c = l * a - o + u, h = c * c / (l * l + 1); + return h <= s / 2 * s / 2; +} +function rJ(r, e, t, n, i, a, o, s, l, u, c) { + if (l === 0) + return !1; + var h = l; + if (c > e + h && c > n + h && c > a + h && c > s + h || c < e - h && c < n - h && c < a - h && c < s - h || u > r + h && u > t + h && u > i + h && u > o + h || u < r - h && u < t - h && u < i - h && u < o - h) + return !1; + var f = Aj(r, e, t, n, i, a, o, s, u, c, null); + return f <= h / 2; +} +function d5(r, e, t, n, i, a, o, s, l) { + if (o === 0) + return !1; + var u = o; + if (l > e + u && l > n + u && l > a + u || l < e - u && l < n - u && l < a - u || s > r + u && s > t + u && s > i + u || s < r - u && s < t - u && s < i - u) + return !1; + var c = Mj(r, e, t, n, i, a, s, l, null); + return c <= u / 2; +} +var Sk = Math.PI * 2; +function ks(r) { + return r %= Sk, r < 0 && (r += Sk), r; +} +var Qv = Math.PI * 2; +function nJ(r, e, t, n, i, a, o, s, l) { + if (o === 0) + return !1; + var u = o; + s -= r, l -= e; + var c = Math.sqrt(s * s + l * l); + if (c - u > t || c + u < t) + return !1; + if (Math.abs(n - i) % Qv < 1e-4) + return !0; + if (a) { + var h = n; + n = ks(i), i = ks(h); + } else + n = ks(n), i = ks(i); + n > i && (i += Qv); + var f = Math.atan2(l, s); + return f < 0 && (f += Qv), f >= n && f <= i || f + Qv >= n && f + Qv <= i; +} +function Vl(r, e, t, n, i, a) { + if (a > e && a > n || a < e && a < n || n === e) + return 0; + var o = (a - e) / (n - e), s = n < e ? 1 : -1; + (o === 1 || o === 0) && (s = n < e ? 0.5 : -0.5); + var l = o * (t - r) + r; + return l === i ? 1 / 0 : l > i ? s : 0; +} +var Pu = Al.CMD, qc = Math.PI * 2, iJ = 1e-4; +function aJ(r, e) { + return Math.abs(r - e) < iJ; +} +var Ta = [-1, -1, -1], Wo = [-1, -1]; +function oJ() { + var r = Wo[0]; + Wo[0] = Wo[1], Wo[1] = r; +} +function sJ(r, e, t, n, i, a, o, s, l, u) { + if (u > e && u > n && u > a && u > s || u < e && u < n && u < a && u < s) + return 0; + var c = h_(e, n, a, s, u, Ta); + if (c === 0) + return 0; + for (var h = 0, f = -1, v = void 0, b = void 0, w = 0; w < c; w++) { + var p = Ta[w], d = p === 0 || p === 1 ? 0.5 : 1, m = Ti(r, t, i, o, p); + m < l || (f < 0 && (f = Ij(e, n, a, s, Wo), Wo[1] < Wo[0] && f > 1 && oJ(), v = Ti(e, n, a, s, Wo[0]), f > 1 && (b = Ti(e, n, a, s, Wo[1]))), f === 2 ? p < Wo[0] ? h += v < e ? d : -d : p < Wo[1] ? h += b < v ? d : -d : h += s < b ? d : -d : p < Wo[0] ? h += v < e ? d : -d : h += s < v ? d : -d); + } + return h; +} +function lJ(r, e, t, n, i, a, o, s) { + if (s > e && s > n && s > a || s < e && s < n && s < a) + return 0; + var l = dX(e, n, a, s, Ta); + if (l === 0) + return 0; + var u = Ej(e, n, a); + if (u >= 0 && u <= 1) { + for (var c = 0, h = Ri(e, n, a, u), f = 0; f < l; f++) { + var v = Ta[f] === 0 || Ta[f] === 1 ? 0.5 : 1, b = Ri(r, t, i, Ta[f]); + b < o || (Ta[f] < u ? c += h < e ? v : -v : c += a < h ? v : -v); + } + return c; + } else { + var v = Ta[0] === 0 || Ta[0] === 1 ? 0.5 : 1, b = Ri(r, t, i, Ta[0]); + return b < o ? 0 : a < e ? v : -v; + } +} +function uJ(r, e, t, n, i, a, o, s) { + if (s -= e, s > t || s < -t) + return 0; + var l = Math.sqrt(t * t - s * s); + Ta[0] = -l, Ta[1] = l; + var u = Math.abs(n - i); + if (u < 1e-4) + return 0; + if (u >= qc - 1e-4) { + n = 0, i = qc; + var c = a ? 1 : -1; + return o >= Ta[0] + r && o <= Ta[1] + r ? c : 0; + } + if (n > i) { + var h = n; + n = i, i = h; + } + n < 0 && (n += qc, i += qc); + for (var f = 0, v = 0; v < 2; v++) { + var b = Ta[v]; + if (b + r > o) { + var w = Math.atan2(s, b), c = a ? 1 : -1; + w < 0 && (w = qc + w), (w >= n && w <= i || w + qc >= n && w + qc <= i) && (w > Math.PI / 2 && w < Math.PI * 1.5 && (c = -c), f += c); + } + } + return f; +} +function v5(r, e, t, n, i) { + for (var a = r.data, o = r.len(), s = 0, l = 0, u = 0, c = 0, h = 0, f, v, b = 0; b < o; ) { + var w = a[b++], p = b === 1; + switch (w === Pu.M && b > 1 && (t || (s += Vl(l, u, c, h, n, i))), p && (l = a[b], u = a[b + 1], c = l, h = u), w) { + case Pu.M: + c = a[b++], h = a[b++], l = c, u = h; + break; + case Pu.L: + if (t) { + if (Uu(l, u, a[b], a[b + 1], e, n, i)) + return !0; + } else + s += Vl(l, u, a[b], a[b + 1], n, i) || 0; + l = a[b++], u = a[b++]; + break; + case Pu.C: + if (t) { + if (rJ(l, u, a[b++], a[b++], a[b++], a[b++], a[b], a[b + 1], e, n, i)) + return !0; + } else + s += sJ(l, u, a[b++], a[b++], a[b++], a[b++], a[b], a[b + 1], n, i) || 0; + l = a[b++], u = a[b++]; + break; + case Pu.Q: + if (t) { + if (d5(l, u, a[b++], a[b++], a[b], a[b + 1], e, n, i)) + return !0; + } else + s += lJ(l, u, a[b++], a[b++], a[b], a[b + 1], n, i) || 0; + l = a[b++], u = a[b++]; + break; + case Pu.A: + var d = a[b++], m = a[b++], _ = a[b++], y = a[b++], x = a[b++], g = a[b++]; + b += 1; + var S = !!(1 - a[b++]); + f = Math.cos(x) * _ + d, v = Math.sin(x) * y + m, p ? (c = f, h = v) : s += Vl(l, u, f, v, n, i); + var T = (n - d) * y / _ + d; + if (t) { + if (nJ(d, m, y, x, x + g, S, e, T, i)) + return !0; + } else + s += uJ(d, m, y, x, x + g, S, T, i); + l = Math.cos(x + g) * _ + d, u = Math.sin(x + g) * y + m; + break; + case Pu.R: + c = l = a[b++], h = u = a[b++]; + var C = a[b++], E = a[b++]; + if (f = c + C, v = h + E, t) { + if (Uu(c, h, f, h, e, n, i) || Uu(f, h, f, v, e, n, i) || Uu(f, v, c, v, e, n, i) || Uu(c, v, c, h, e, n, i)) + return !0; + } else + s += Vl(f, h, f, v, n, i), s += Vl(c, v, c, h, n, i); + break; + case Pu.Z: + if (t) { + if (Uu(l, u, c, h, e, n, i)) + return !0; + } else + s += Vl(l, u, c, h, n, i); + l = c, u = h; + break; + } + } + return !t && !aJ(u, h) && (s += Vl(l, u, c, h, n, i) || 0), s !== 0; +} +function cJ(r, e, t) { + return v5(r, 0, !1, e, t); +} +function hJ(r, e, t, n) { + return v5(r, e, !0, t, n); +} +var g_ = Mt({ + fill: "#000", + stroke: null, + strokePercent: 1, + fillOpacity: 1, + strokeOpacity: 1, + lineDashOffset: 0, + lineWidth: 1, + lineCap: "butt", + miterLimit: 10, + strokeNoScale: !1, + strokeFirst: !1 +}, Ph), fJ = { + style: Mt({ + fill: !0, + stroke: !0, + strokePercent: !0, + fillOpacity: !0, + strokeOpacity: !0, + lineDashOffset: !0, + lineWidth: !0, + miterLimit: !0 + }, Lb.style) +}, LS = Tl.concat([ + "invisible", + "culling", + "z", + "z2", + "zlevel", + "parent" +]), dJ = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.update = function() { + var t = this; + r.prototype.update.call(this); + var n = this.style; + if (n.decal) { + var i = this._decalEl = this._decalEl || new e(); + i.buildPath === e.prototype.buildPath && (i.buildPath = function(l) { + t.buildPath(l, t.shape); + }), i.silent = !0; + var a = i.style; + for (var o in n) + a[o] !== n[o] && (a[o] = n[o]); + a.fill = n.fill ? n.decal : null, a.decal = null, a.shadowColor = null, n.strokeFirst && (a.stroke = null); + for (var s = 0; s < LS.length; ++s) + i[LS[s]] = this[LS[s]]; + i.__dirty |= go; + } else + this._decalEl && (this._decalEl = null); + }, e.prototype.getDecalElement = function() { + return this._decalEl; + }, e.prototype._init = function(t) { + var n = yr(t); + this.shape = this.getDefaultShape(); + var i = this.getDefaultStyle(); + i && this.useStyle(i); + for (var a = 0; a < n.length; a++) { + var o = n[a], s = t[o]; + o === "style" ? this.style ? Fe(this.style, s) : this.useStyle(s) : o === "shape" ? Fe(this.shape, s) : r.prototype.attrKV.call(this, o, s); + } + this.style || this.useStyle({}); + }, e.prototype.getDefaultStyle = function() { + return null; + }, e.prototype.getDefaultShape = function() { + return {}; + }, e.prototype.canBeInsideText = function() { + return this.hasFill(); + }, e.prototype.getInsideTextFill = function() { + var t = this.style.fill; + if (t !== "none") { + if (ut(t)) { + var n = cg(t, 0); + return n > 0.5 ? w1 : n > 0.2 ? ZX : C1; + } else if (t) + return C1; + } + return w1; + }, e.prototype.getInsideTextStroke = function(t) { + var n = this.style.fill; + if (ut(n)) { + var i = this.__zr, a = !!(i && i.isDarkMode()), o = cg(t, 0) < S1; + if (a === o) + return n; + } + }, e.prototype.buildPath = function(t, n, i) { + }, e.prototype.pathUpdated = function() { + this.__dirty &= ~ad; + }, e.prototype.getUpdatedPathProxy = function(t) { + return !this.path && this.createPathProxy(), this.path.beginPath(), this.buildPath(this.path, this.shape, t), this.path; + }, e.prototype.createPathProxy = function() { + this.path = new Al(!1); + }, e.prototype.hasStroke = function() { + var t = this.style, n = t.stroke; + return !(n == null || n === "none" || !(t.lineWidth > 0)); + }, e.prototype.hasFill = function() { + var t = this.style, n = t.fill; + return n != null && n !== "none"; + }, e.prototype.getBoundingRect = function() { + var t = this._rect, n = this.style, i = !t; + if (i) { + var a = !1; + this.path || (a = !0, this.createPathProxy()); + var o = this.path; + (a || this.__dirty & ad) && (o.beginPath(), this.buildPath(o, this.shape, !1), this.pathUpdated()), t = o.getBoundingRect(); + } + if (this._rect = t, this.hasStroke() && this.path && this.path.len() > 0) { + var s = this._rectStroke || (this._rectStroke = t.clone()); + if (this.__dirty || i) { + s.copy(t); + var l = n.strokeNoScale ? this.getLineScale() : 1, u = n.lineWidth; + if (!this.hasFill()) { + var c = this.strokeContainThreshold; + u = Math.max(u, c == null ? 4 : c); + } + l > 1e-10 && (s.width += u / l, s.height += u / l, s.x -= u / l / 2, s.y -= u / l / 2); + } + return s; + } + return t; + }, e.prototype.contain = function(t, n) { + var i = this.transformCoordToLocal(t, n), a = this.getBoundingRect(), o = this.style; + if (t = i[0], n = i[1], a.contain(t, n)) { + var s = this.path; + if (this.hasStroke()) { + var l = o.lineWidth, u = o.strokeNoScale ? this.getLineScale() : 1; + if (u > 1e-10 && (this.hasFill() || (l = Math.max(l, this.strokeContainThreshold)), hJ(s, l / u, t, n))) + return !0; + } + if (this.hasFill()) + return cJ(s, t, n); + } + return !1; + }, e.prototype.dirtyShape = function() { + this.__dirty |= ad, this._rect && (this._rect = null), this._decalEl && this._decalEl.dirtyShape(), this.markRedraw(); + }, e.prototype.dirty = function() { + this.dirtyStyle(), this.dirtyShape(); + }, e.prototype.animateShape = function(t) { + return this.animate("shape", t); + }, e.prototype.updateDuringAnimation = function(t) { + t === "style" ? this.dirtyStyle() : t === "shape" ? this.dirtyShape() : this.markRedraw(); + }, e.prototype.attrKV = function(t, n) { + t === "shape" ? this.setShape(n) : r.prototype.attrKV.call(this, t, n); + }, e.prototype.setShape = function(t, n) { + var i = this.shape; + return i || (i = this.shape = {}), typeof t == "string" ? i[t] = n : Fe(i, t), this.dirtyShape(), this; + }, e.prototype.shapeChanged = function() { + return !!(this.__dirty & ad); + }, e.prototype.createStyle = function(t) { + return Wg(g_, t); + }, e.prototype._innerSaveToNormal = function(t) { + r.prototype._innerSaveToNormal.call(this, t); + var n = this._normalState; + t.shape && !n.shape && (n.shape = Fe({}, this.shape)); + }, e.prototype._applyStateObj = function(t, n, i, a, o, s) { + r.prototype._applyStateObj.call(this, t, n, i, a, o, s); + var l = !(n && a), u; + if (n && n.shape ? o ? a ? u = n.shape : (u = Fe({}, i.shape), Fe(u, n.shape)) : (u = Fe({}, a ? this.shape : i.shape), Fe(u, n.shape)) : l && (u = i.shape), u) + if (o) { + this.shape = Fe({}, this.shape); + for (var c = {}, h = yr(u), f = 0; f < h.length; f++) { + var v = h[f]; + typeof u[v] == "object" ? this.shape[v] = u[v] : c[v] = u[v]; + } + this._transitionState(t, { + shape: c + }, s); + } else + this.shape = u, this.dirtyShape(); + }, e.prototype._mergeStates = function(t) { + for (var n = r.prototype._mergeStates.call(this, t), i, a = 0; a < t.length; a++) { + var o = t[a]; + o.shape && (i = i || {}, this._mergeStyle(i, o.shape)); + } + return i && (n.shape = i), n; + }, e.prototype.getAnimationStyleProps = function() { + return fJ; + }, e.prototype.isZeroArea = function() { + return !1; + }, e.extend = function(t) { + var n = function(a) { + En(o, a); + function o(s) { + var l = a.call(this, s) || this; + return t.init && t.init.call(l, s), l; + } + return o.prototype.getDefaultStyle = function() { + return Ot(t.style); + }, o.prototype.getDefaultShape = function() { + return Ot(t.shape); + }, o; + }(e); + for (var i in t) + typeof t[i] == "function" && (n.prototype[i] = t[i]); + return n; + }, e.initDefaultProps = function() { + var t = e.prototype; + t.type = "path", t.strokeContainThreshold = 5, t.segmentIgnoreThreshold = 0, t.subPixelOptimize = !1, t.autoBatch = !1, t.__dirty = go | Cp | ad; + }(), e; +}(ts); +const hr = dJ; +var vJ = Mt({ + strokeFirst: !0, + font: hc, + x: 0, + y: 0, + textAlign: "left", + textBaseline: "top", + miterLimit: 2 +}, g_), p5 = function(r) { + En(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.hasStroke = function() { + var t = this.style, n = t.stroke; + return n != null && n !== "none" && t.lineWidth > 0; + }, e.prototype.hasFill = function() { + var t = this.style, n = t.fill; + return n != null && n !== "none"; + }, e.prototype.createStyle = function(t) { + return Wg(vJ, t); + }, e.prototype.setBoundingRect = function(t) { + this._rect = t; + }, e.prototype.getBoundingRect = function() { + var t = this.style; + if (!this._rect) { + var n = t.text; + n != null ? n += "" : n = ""; + var i = Zg(n, t.font, t.textAlign, t.textBaseline); + if (i.x += t.x || 0, i.y += t.y || 0, this.hasStroke()) { + var a = t.lineWidth; + i.x -= a / 2, i.y -= a / 2, i.width += a, i.height += a; + } + this._rect = i; + } + return this._rect; + }, e.initDefaultProps = function() { + var t = e.prototype; + t.dirtyRectTolerance = 10; + }(), e; +}(ts); +p5.prototype.type = "tspan"; +const vg = p5; +var pJ = Mt({ + x: 0, + y: 0 +}, Ph), gJ = { + style: Mt({ + x: !0, + y: !0, + width: !0, + height: !0, + sx: !0, + sy: !0, + sWidth: !0, + sHeight: !0 + }, Lb.style) +}; +function mJ(r) { + return !!(r && typeof r != "string" && r.width && r.height); +} +var g5 = function(r) { + En(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.createStyle = function(t) { + return Wg(pJ, t); + }, e.prototype._getSize = function(t) { + var n = this.style, i = n[t]; + if (i != null) + return i; + var a = mJ(n.image) ? n.image : this.__image; + if (!a) + return 0; + var o = t === "width" ? "height" : "width", s = n[o]; + return s == null ? a[t] : a[t] / a[o] * s; + }, e.prototype.getWidth = function() { + return this._getSize("width"); + }, e.prototype.getHeight = function() { + return this._getSize("height"); + }, e.prototype.getAnimationStyleProps = function() { + return gJ; + }, e.prototype.getBoundingRect = function() { + var t = this.style; + return this._rect || (this._rect = new Wt(t.x || 0, t.y || 0, this.getWidth(), this.getHeight())), this._rect; + }, e; +}(ts); +g5.prototype.type = "image"; +const ji = g5; +function yJ(r, e) { + var t = e.x, n = e.y, i = e.width, a = e.height, o = e.r, s, l, u, c; + i < 0 && (t = t + i, i = -i), a < 0 && (n = n + a, a = -a), typeof o == "number" ? s = l = u = c = o : o instanceof Array ? o.length === 1 ? s = l = u = c = o[0] : o.length === 2 ? (s = u = o[0], l = c = o[1]) : o.length === 3 ? (s = o[0], l = c = o[1], u = o[2]) : (s = o[0], l = o[1], u = o[2], c = o[3]) : s = l = u = c = 0; + var h; + s + l > i && (h = s + l, s *= i / h, l *= i / h), u + c > i && (h = u + c, u *= i / h, c *= i / h), l + u > a && (h = l + u, l *= a / h, u *= a / h), s + c > a && (h = s + c, s *= a / h, c *= a / h), r.moveTo(t + s, n), r.lineTo(t + i - l, n), l !== 0 && r.arc(t + i - l, n + l, l, -Math.PI / 2, 0), r.lineTo(t + i, n + a - u), u !== 0 && r.arc(t + i - u, n + a - u, u, 0, Math.PI / 2), r.lineTo(t + c, n + a), c !== 0 && r.arc(t + c, n + a - c, c, Math.PI / 2, Math.PI), r.lineTo(t, n + s), s !== 0 && r.arc(t + s, n + s, s, Math.PI, Math.PI * 1.5); +} +var fd = Math.round; +function m5(r, e, t) { + if (e) { + var n = e.x1, i = e.x2, a = e.y1, o = e.y2; + r.x1 = n, r.x2 = i, r.y1 = a, r.y2 = o; + var s = t && t.lineWidth; + return s && (fd(n * 2) === fd(i * 2) && (r.x1 = r.x2 = Ih(n, s, !0)), fd(a * 2) === fd(o * 2) && (r.y1 = r.y2 = Ih(a, s, !0))), r; + } +} +function y5(r, e, t) { + if (e) { + var n = e.x, i = e.y, a = e.width, o = e.height; + r.x = n, r.y = i, r.width = a, r.height = o; + var s = t && t.lineWidth; + return s && (r.x = Ih(n, s, !0), r.y = Ih(i, s, !0), r.width = Math.max(Ih(n + a, s, !1) - r.x, a === 0 ? 0 : 1), r.height = Math.max(Ih(i + o, s, !1) - r.y, o === 0 ? 0 : 1)), r; + } +} +function Ih(r, e, t) { + if (!e) + return r; + var n = fd(r * 2); + return (n + fd(e)) % 2 === 0 ? n / 2 : (n + (t ? 1 : -1)) / 2; +} +var _J = function() { + function r() { + this.x = 0, this.y = 0, this.width = 0, this.height = 0; + } + return r; +}(), bJ = {}, _5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new _J(); + }, e.prototype.buildPath = function(t, n) { + var i, a, o, s; + if (this.subPixelOptimize) { + var l = y5(bJ, n, this.style); + i = l.x, a = l.y, o = l.width, s = l.height, l.r = n.r, n = l; + } else + i = n.x, a = n.y, o = n.width, s = n.height; + n.r ? yJ(t, n) : t.rect(i, a, o, s); + }, e.prototype.isZeroArea = function() { + return !this.shape.width || !this.shape.height; + }, e; +}(hr); +_5.prototype.type = "rect"; +const Or = _5; +var wk = { + fill: "#000" +}, Ck = 2, xJ = { + style: Mt({ + fill: !0, + stroke: !0, + fillOpacity: !0, + strokeOpacity: !0, + lineWidth: !0, + fontSize: !0, + lineHeight: !0, + width: !0, + height: !0, + textShadowColor: !0, + textShadowBlur: !0, + textShadowOffsetX: !0, + textShadowOffsetY: !0, + backgroundColor: !0, + padding: !0, + borderColor: !0, + borderWidth: !0, + borderRadius: !0 + }, Lb.style) +}, b5 = function(r) { + En(e, r); + function e(t) { + var n = r.call(this) || this; + return n.type = "text", n._children = [], n._defaultStyle = wk, n.attr(t), n; + } + return e.prototype.childrenRef = function() { + return this._children; + }, e.prototype.update = function() { + r.prototype.update.call(this), this.styleChanged() && this._updateSubTexts(); + for (var t = 0; t < this._children.length; t++) { + var n = this._children[t]; + n.zlevel = this.zlevel, n.z = this.z, n.z2 = this.z2, n.culling = this.culling, n.cursor = this.cursor, n.invisible = this.invisible; + } + }, e.prototype.updateTransform = function() { + var t = this.innerTransformable; + t ? (t.updateTransform(), t.transform && (this.transform = t.transform)) : r.prototype.updateTransform.call(this); + }, e.prototype.getLocalTransform = function(t) { + var n = this.innerTransformable; + return n ? n.getLocalTransform(t) : r.prototype.getLocalTransform.call(this, t); + }, e.prototype.getComputedTransform = function() { + return this.__hostTarget && (this.__hostTarget.getComputedTransform(), this.__hostTarget.updateInnerText(!0)), r.prototype.getComputedTransform.call(this); + }, e.prototype._updateSubTexts = function() { + this._childCursor = 0, CJ(this.style), this.style.rich ? this._updateRichTexts() : this._updatePlainTexts(), this._children.length = this._childCursor, this.styleUpdated(); + }, e.prototype.addSelfToZr = function(t) { + r.prototype.addSelfToZr.call(this, t); + for (var n = 0; n < this._children.length; n++) + this._children[n].__zr = t; + }, e.prototype.removeSelfFromZr = function(t) { + r.prototype.removeSelfFromZr.call(this, t); + for (var n = 0; n < this._children.length; n++) + this._children[n].__zr = null; + }, e.prototype.getBoundingRect = function() { + if (this.styleChanged() && this._updateSubTexts(), !this._rect) { + for (var t = new Wt(0, 0, 0, 0), n = this._children, i = [], a = null, o = 0; o < n.length; o++) { + var s = n[o], l = s.getBoundingRect(), u = s.getLocalTransform(i); + u ? (t.copy(l), t.applyTransform(u), a = a || t.clone(), a.union(t)) : (a = a || l.clone(), a.union(l)); + } + this._rect = a || t; + } + return this._rect; + }, e.prototype.setDefaultTextStyle = function(t) { + this._defaultStyle = t || wk; + }, e.prototype.setTextContent = function(t) { + }, e.prototype._mergeStyle = function(t, n) { + if (!n) + return t; + var i = n.rich, a = t.rich || i && {}; + return Fe(t, n), i && a ? (this._mergeRich(a, i), t.rich = a) : a && (t.rich = a), t; + }, e.prototype._mergeRich = function(t, n) { + for (var i = yr(n), a = 0; a < i.length; a++) { + var o = i[a]; + t[o] = t[o] || {}, Fe(t[o], n[o]); + } + }, e.prototype.getAnimationStyleProps = function() { + return xJ; + }, e.prototype._getOrCreateChild = function(t) { + var n = this._children[this._childCursor]; + return (!n || !(n instanceof t)) && (n = new t()), this._children[this._childCursor++] = n, n.__zr = this.__zr, n.parent = this, n; + }, e.prototype._updatePlainTexts = function() { + var t = this.style, n = t.font || hc, i = t.padding, a = kk(t), o = HZ(a, t), s = PS(t), l = !!t.backgroundColor, u = o.outerHeight, c = o.outerWidth, h = o.contentWidth, f = o.lines, v = o.lineHeight, b = this._defaultStyle, w = t.x || 0, p = t.y || 0, d = t.align || b.align || "left", m = t.verticalAlign || b.verticalAlign || "top", _ = w, y = od(p, o.contentHeight, m); + if (s || i) { + var x = Ip(w, c, d), g = od(p, u, m); + s && this._renderBackground(t, t, x, g, c, u); + } + y += v / 2, i && (_ = Dk(w, d, i), m === "top" ? y += i[0] : m === "bottom" && (y -= i[2])); + for (var S = 0, T = !1, C = Mk("fill" in t ? t.fill : (T = !0, b.fill)), E = Ek("stroke" in t ? t.stroke : !l && (!b.autoStroke || T) ? (S = Ck, b.stroke) : null), M = t.textShadowBlur > 0, P = t.width != null && (t.overflow === "truncate" || t.overflow === "break" || t.overflow === "breakAll"), R = o.calculatedLineHeight, N = 0; N < f.length; N++) { + var F = this._getOrCreateChild(vg), U = F.createStyle(); + F.useStyle(U), U.text = f[N], U.x = _, U.y = y, d && (U.textAlign = d), U.textBaseline = "middle", U.opacity = t.opacity, U.strokeFirst = !0, M && (U.shadowBlur = t.textShadowBlur || 0, U.shadowColor = t.textShadowColor || "transparent", U.shadowOffsetX = t.textShadowOffsetX || 0, U.shadowOffsetY = t.textShadowOffsetY || 0), U.stroke = E, U.fill = C, E && (U.lineWidth = t.lineWidth || S, U.lineDash = t.lineDash, U.lineDashOffset = t.lineDashOffset || 0), U.font = n, Ik(U, t), y += v, P && F.setBoundingRect(new Wt(Ip(U.x, t.width, U.textAlign), od(U.y, R, U.textBaseline), h, R)); + } + }, e.prototype._updateRichTexts = function() { + var t = this.style, n = kk(t), i = UZ(n, t), a = i.width, o = i.outerWidth, s = i.outerHeight, l = t.padding, u = t.x || 0, c = t.y || 0, h = this._defaultStyle, f = t.align || h.align, v = t.verticalAlign || h.verticalAlign, b = Ip(u, o, f), w = od(c, s, v), p = b, d = w; + l && (p += l[3], d += l[0]); + var m = p + a; + PS(t) && this._renderBackground(t, t, b, w, o, s); + for (var _ = !!t.backgroundColor, y = 0; y < i.lines.length; y++) { + for (var x = i.lines[y], g = x.tokens, S = g.length, T = x.lineHeight, C = x.width, E = 0, M = p, P = m, R = S - 1, N = void 0; E < S && (N = g[E], !N.align || N.align === "left"); ) + this._placeToken(N, t, T, d, M, "left", _), C -= N.width, M += N.width, E++; + for (; R >= 0 && (N = g[R], N.align === "right"); ) + this._placeToken(N, t, T, d, P, "right", _), C -= N.width, P -= N.width, R--; + for (M += (a - (M - p) - (m - P) - C) / 2; E <= R; ) + N = g[E], this._placeToken(N, t, T, d, M + N.width / 2, "center", _), M += N.width, E++; + d += T; + } + }, e.prototype._placeToken = function(t, n, i, a, o, s, l) { + var u = n.rich[t.styleName] || {}; + u.text = t.text; + var c = t.verticalAlign, h = a + i / 2; + c === "top" ? h = a + t.height / 2 : c === "bottom" && (h = a + i - t.height / 2); + var f = !t.isLineHolder && PS(u); + f && this._renderBackground(u, n, s === "right" ? o - t.width : s === "center" ? o - t.width / 2 : o, h - t.height / 2, t.width, t.height); + var v = !!u.backgroundColor, b = t.textPadding; + b && (o = Dk(o, s, b), h -= t.height / 2 - b[0] - t.innerHeight / 2); + var w = this._getOrCreateChild(vg), p = w.createStyle(); + w.useStyle(p); + var d = this._defaultStyle, m = !1, _ = 0, y = Mk("fill" in u ? u.fill : "fill" in n ? n.fill : (m = !0, d.fill)), x = Ek("stroke" in u ? u.stroke : "stroke" in n ? n.stroke : !v && !l && (!d.autoStroke || m) ? (_ = Ck, d.stroke) : null), g = u.textShadowBlur > 0 || n.textShadowBlur > 0; + p.text = t.text, p.x = o, p.y = h, g && (p.shadowBlur = u.textShadowBlur || n.textShadowBlur || 0, p.shadowColor = u.textShadowColor || n.textShadowColor || "transparent", p.shadowOffsetX = u.textShadowOffsetX || n.textShadowOffsetX || 0, p.shadowOffsetY = u.textShadowOffsetY || n.textShadowOffsetY || 0), p.textAlign = s, p.textBaseline = "middle", p.font = t.font || hc, p.opacity = Ps(u.opacity, n.opacity, 1), Ik(p, u), x && (p.lineWidth = Ps(u.lineWidth, n.lineWidth, _), p.lineDash = Jt(u.lineDash, n.lineDash), p.lineDashOffset = n.lineDashOffset || 0, p.stroke = x), y && (p.fill = y); + var S = t.contentWidth, T = t.contentHeight; + w.setBoundingRect(new Wt(Ip(p.x, S, p.textAlign), od(p.y, T, p.textBaseline), S, T)); + }, e.prototype._renderBackground = function(t, n, i, a, o, s) { + var l = t.backgroundColor, u = t.borderWidth, c = t.borderColor, h = l && l.image, f = l && !h, v = t.borderRadius, b = this, w, p; + if (f || t.lineHeight || u && c) { + w = this._getOrCreateChild(Or), w.useStyle(w.createStyle()), w.style.fill = null; + var d = w.shape; + d.x = i, d.y = a, d.width = o, d.height = s, d.r = v, w.dirtyShape(); + } + if (f) { + var m = w.style; + m.fill = l || null, m.fillOpacity = Jt(t.fillOpacity, 1); + } else if (h) { + p = this._getOrCreateChild(ji), p.onload = function() { + b.dirtyStyle(); + }; + var _ = p.style; + _.image = l.image, _.x = i, _.y = a, _.width = o, _.height = s; + } + if (u && c) { + var m = w.style; + m.lineWidth = u, m.stroke = c, m.strokeOpacity = Jt(t.strokeOpacity, 1), m.lineDash = t.borderDash, m.lineDashOffset = t.borderDashOffset || 0, w.strokeContainThreshold = 0, w.hasFill() && w.hasStroke() && (m.strokeFirst = !0, m.lineWidth *= 2); + } + var y = (w || p).style; + y.shadowBlur = t.shadowBlur || 0, y.shadowColor = t.shadowColor || "transparent", y.shadowOffsetX = t.shadowOffsetX || 0, y.shadowOffsetY = t.shadowOffsetY || 0, y.opacity = Ps(t.opacity, n.opacity, 1); + }, e.makeFont = function(t) { + var n = ""; + return S5(t) && (n = [ + t.fontStyle, + t.fontWeight, + x5(t.fontSize), + t.fontFamily || "sans-serif" + ].join(" ")), n && Qo(n) || t.textFont || t.font; + }, e; +}(ts), SJ = { left: !0, right: 1, center: 1 }, wJ = { top: 1, bottom: 1, middle: 1 }, Tk = ["fontStyle", "fontWeight", "fontSize", "fontFamily"]; +function x5(r) { + return typeof r == "string" && (r.indexOf("px") !== -1 || r.indexOf("rem") !== -1 || r.indexOf("em") !== -1) ? r : isNaN(+r) ? CI + "px" : r + "px"; +} +function Ik(r, e) { + for (var t = 0; t < Tk.length; t++) { + var n = Tk[t], i = e[n]; + i != null && (r[n] = i); + } +} +function S5(r) { + return r.fontSize != null || r.fontFamily || r.fontWeight; +} +function CJ(r) { + return Ak(r), X(r.rich, Ak), r; +} +function Ak(r) { + if (r) { + r.font = b5.makeFont(r); + var e = r.align; + e === "middle" && (e = "center"), r.align = e == null || SJ[e] ? e : "left"; + var t = r.verticalAlign; + t === "center" && (t = "middle"), r.verticalAlign = t == null || wJ[t] ? t : "top"; + var n = r.padding; + n && (r.padding = Tb(r.padding)); + } +} +function Ek(r, e) { + return r == null || e <= 0 || r === "transparent" || r === "none" ? null : r.image || r.colorStops ? "#000" : r; +} +function Mk(r) { + return r == null || r === "none" ? null : r.image || r.colorStops ? "#000" : r; +} +function Dk(r, e, t) { + return e === "right" ? r - t[1] : e === "center" ? r + t[3] / 2 - t[1] / 2 : r + t[3]; +} +function kk(r) { + var e = r.text; + return e != null && (e += ""), e; +} +function PS(r) { + return !!(r.backgroundColor || r.lineHeight || r.borderWidth && r.borderColor); +} +const kr = b5; +var Ft = Rr(), O1 = function(r, e, t, n) { + if (n) { + var i = Ft(n); + i.dataIndex = t, i.dataType = e, i.seriesIndex = r, n.type === "group" && n.traverse(function(a) { + var o = Ft(a); + o.seriesIndex = r, o.dataIndex = t, o.dataType = e; + }); + } +}, Ok = 1, Lk = {}, w5 = Rr(), WI = Rr(), YI = 0, Kg = 1, Rb = 2, ka = ["emphasis", "blur", "select"], pg = ["normal", "emphasis", "blur", "select"], Zd = 10, TJ = 9, Rh = "highlight", B0 = "downplay", Vp = "select", j0 = "unselect", Gp = "toggleSelect"; +function $f(r) { + return r != null && r !== "none"; +} +var Pk = new Xg(100); +function Rk(r) { + if (ut(r)) { + var e = Pk.get(r); + return e || (e = f_(r, -0.1), Pk.put(r, e)), e; + } else if (Ug(r)) { + var t = Fe({}, r); + return t.colorStops = Ke(r.colorStops, function(n) { + return { + offset: n.offset, + color: f_(n.color, -0.1) + }; + }), t; + } + return r; +} +function Nb(r, e, t) { + r.onHoverStateChange && (r.hoverState || 0) !== t && r.onHoverStateChange(e), r.hoverState = t; +} +function C5(r) { + Nb(r, "emphasis", Rb); +} +function T5(r) { + r.hoverState === Rb && Nb(r, "normal", YI); +} +function XI(r) { + Nb(r, "blur", Kg); +} +function I5(r) { + r.hoverState === Kg && Nb(r, "normal", YI); +} +function IJ(r) { + r.selected = !0; +} +function AJ(r) { + r.selected = !1; +} +function Nk(r, e, t) { + e(r, t); +} +function uu(r, e, t) { + Nk(r, e, t), r.isGroup && r.traverse(function(n) { + Nk(n, e, t); + }); +} +function m_(r, e) { + switch (e) { + case "emphasis": + r.hoverState = Rb; + break; + case "normal": + r.hoverState = YI; + break; + case "blur": + r.hoverState = Kg; + break; + case "select": + r.selected = !0; + } +} +function EJ(r, e, t, n) { + for (var i = r.style, a = {}, o = 0; o < e.length; o++) { + var s = e[o], l = i[s]; + a[s] = l == null ? n && n[s] : l; + } + for (var o = 0; o < r.animators.length; o++) { + var u = r.animators[o]; + u.__fromStateTransition && u.__fromStateTransition.indexOf(t) < 0 && u.targetName === "style" && u.saveTo(a, e); + } + return a; +} +function MJ(r, e, t, n) { + var i = t && ir(t, "select") >= 0, a = !1; + if (r instanceof hr) { + var o = w5(r), s = i && o.selectFill || o.normalFill, l = i && o.selectStroke || o.normalStroke; + if ($f(s) || $f(l)) { + n = n || {}; + var u = n.style || {}; + u.fill === "inherit" ? (a = !0, n = Fe({}, n), u = Fe({}, u), u.fill = s) : !$f(u.fill) && $f(s) ? (a = !0, n = Fe({}, n), u = Fe({}, u), u.fill = Rk(s)) : !$f(u.stroke) && $f(l) && (a || (n = Fe({}, n), u = Fe({}, u)), u.stroke = Rk(l)), n.style = u; + } + } + if (n && n.z2 == null) { + a || (n = Fe({}, n)); + var c = r.z2EmphasisLift; + n.z2 = r.z2 + (c != null ? c : Zd); + } + return n; +} +function DJ(r, e, t) { + if (t && t.z2 == null) { + t = Fe({}, t); + var n = r.z2SelectLift; + t.z2 = r.z2 + (n != null ? n : TJ); + } + return t; +} +function kJ(r, e, t) { + var n = ir(r.currentStates, e) >= 0, i = r.style.opacity, a = n ? null : EJ(r, ["opacity"], e, { + opacity: 1 + }); + t = t || {}; + var o = t.style || {}; + return o.opacity == null && (t = Fe({}, t), o = Fe({ + // Already being applied 'emphasis'. DON'T mul opacity multiple times. + opacity: n ? i : a.opacity * 0.1 + }, o), t.style = o), t; +} +function RS(r, e) { + var t = this.states[r]; + if (this.style) { + if (r === "emphasis") + return MJ(this, r, e, t); + if (r === "blur") + return kJ(this, r, t); + if (r === "select") + return DJ(this, r, t); + } + return t; +} +function Yh(r) { + r.stateProxy = RS; + var e = r.getTextContent(), t = r.getTextGuideLine(); + e && (e.stateProxy = RS), t && (t.stateProxy = RS); +} +function zk(r, e) { + !D5(r, e) && !r.__highByOuter && uu(r, C5); +} +function Bk(r, e) { + !D5(r, e) && !r.__highByOuter && uu(r, T5); +} +function tu(r, e) { + r.__highByOuter |= 1 << (e || 0), uu(r, C5); +} +function ru(r, e) { + !(r.__highByOuter &= ~(1 << (e || 0))) && uu(r, T5); +} +function A5(r) { + uu(r, XI); +} +function ZI(r) { + uu(r, I5); +} +function E5(r) { + uu(r, IJ); +} +function M5(r) { + uu(r, AJ); +} +function D5(r, e) { + return r.__highDownSilentOnTouch && e.zrByTouch; +} +function k5(r) { + var e = r.getModel(), t = [], n = []; + e.eachComponent(function(i, a) { + var o = WI(a), s = i === "series", l = s ? r.getViewOfSeriesModel(a) : r.getViewOfComponentModel(a); + !s && n.push(l), o.isBlured && (l.group.traverse(function(u) { + I5(u); + }), s && t.push(a)), o.isBlured = !1; + }), X(n, function(i) { + i && i.toggleBlurSeries && i.toggleBlurSeries(t, !1, e); + }); +} +function L1(r, e, t, n) { + var i = n.getModel(); + t = t || "coordinateSystem"; + function a(u, c) { + for (var h = 0; h < c.length; h++) { + var f = u.getItemGraphicEl(c[h]); + f && ZI(f); + } + } + if (r != null && !(!e || e === "none")) { + var o = i.getSeriesByIndex(r), s = o.coordinateSystem; + s && s.master && (s = s.master); + var l = []; + i.eachSeries(function(u) { + var c = o === u, h = u.coordinateSystem; + h && h.master && (h = h.master); + var f = h && s ? h === s : c; + if (!// Not blur other series if blurScope series + (t === "series" && !c || t === "coordinateSystem" && !f || e === "series" && c)) { + var v = n.getViewOfSeriesModel(u); + if (v.group.traverse(function(p) { + p.__highByOuter && c && e === "self" || XI(p); + }), Yi(e)) + a(u.getData(), e); + else if (kt(e)) + for (var b = yr(e), w = 0; w < b.length; w++) + a(u.getData(b[w]), e[b[w]]); + l.push(u), WI(u).isBlured = !0; + } + }), i.eachComponent(function(u, c) { + if (u !== "series") { + var h = n.getViewOfComponentModel(c); + h && h.toggleBlurSeries && h.toggleBlurSeries(l, !0, i); + } + }); + } +} +function P1(r, e, t) { + if (!(r == null || e == null)) { + var n = t.getModel().getComponent(r, e); + if (n) { + WI(n).isBlured = !0; + var i = t.getViewOfComponentModel(n); + !i || !i.focusBlurEnabled || i.group.traverse(function(a) { + XI(a); + }); + } + } +} +function OJ(r, e, t) { + var n = r.seriesIndex, i = r.getData(e.dataType); + if (i) { + var a = Uh(i, e); + a = (We(a) ? a[0] : a) || 0; + var o = i.getItemGraphicEl(a); + if (!o) + for (var s = i.count(), l = 0; !o && l < s; ) + o = i.getItemGraphicEl(l++); + if (o) { + var u = Ft(o); + L1(n, u.focus, u.blurScope, t); + } else { + var c = r.get(["emphasis", "focus"]), h = r.get(["emphasis", "blurScope"]); + c != null && L1(n, c, h, t); + } + } +} +function JI(r, e, t, n) { + var i = { + focusSelf: !1, + dispatchers: null + }; + if (r == null || r === "series" || e == null || t == null) + return i; + var a = n.getModel().getComponent(r, e); + if (!a) + return i; + var o = n.getViewOfComponentModel(a); + if (!o || !o.findHighDownDispatchers) + return i; + for (var s = o.findHighDownDispatchers(t), l, u = 0; u < s.length; u++) + if (Ft(s[u]).focus === "self") { + l = !0; + break; + } + return { + focusSelf: l, + dispatchers: s + }; +} +function LJ(r, e, t) { + var n = Ft(r), i = JI(n.componentMainType, n.componentIndex, n.componentHighDownName, t), a = i.dispatchers, o = i.focusSelf; + a ? (o && P1(n.componentMainType, n.componentIndex, t), X(a, function(s) { + return zk(s, e); + })) : (L1(n.seriesIndex, n.focus, n.blurScope, t), n.focus === "self" && P1(n.componentMainType, n.componentIndex, t), zk(r, e)); +} +function PJ(r, e, t) { + k5(t); + var n = Ft(r), i = JI(n.componentMainType, n.componentIndex, n.componentHighDownName, t).dispatchers; + i ? X(i, function(a) { + return Bk(a, e); + }) : Bk(r, e); +} +function RJ(r, e, t) { + if (N1(e)) { + var n = e.dataType, i = r.getData(n), a = Uh(i, e); + We(a) || (a = [a]), r[e.type === Gp ? "toggleSelect" : e.type === Vp ? "select" : "unselect"](a, n); + } +} +function jk(r) { + var e = r.getAllData(); + X(e, function(t) { + var n = t.data, i = t.type; + n.eachItemGraphicEl(function(a, o) { + r.isSelected(o, i) ? E5(a) : M5(a); + }); + }); +} +function NJ(r) { + var e = []; + return r.eachSeries(function(t) { + var n = t.getAllData(); + X(n, function(i) { + i.data; + var a = i.type, o = t.getSelectedDataIndices(); + if (o.length > 0) { + var s = { + dataIndex: o, + seriesIndex: t.seriesIndex + }; + a != null && (s.dataType = a), e.push(s); + } + }); + }), e; +} +function ac(r, e, t) { + Ah(r, !0), uu(r, Yh), R1(r, e, t); +} +function zJ(r) { + Ah(r, !1); +} +function Un(r, e, t, n) { + n ? zJ(r) : ac(r, e, t); +} +function R1(r, e, t) { + var n = Ft(r); + e != null ? (n.focus = e, n.blurScope = t) : n.focus && (n.focus = null); +} +var Fk = ["emphasis", "blur", "select"], BJ = { + itemStyle: "getItemStyle", + lineStyle: "getLineStyle", + areaStyle: "getAreaStyle" +}; +function Xi(r, e, t, n) { + t = t || "itemStyle"; + for (var i = 0; i < Fk.length; i++) { + var a = Fk[i], o = e.getModel([a, t]), s = r.ensureState(a); + s.style = n ? n(o) : o[BJ[t]](); + } +} +function Ah(r, e) { + var t = e === !1, n = r; + r.highDownSilentOnTouch && (n.__highDownSilentOnTouch = r.highDownSilentOnTouch), (!t || n.__highDownDispatcher) && (n.__highByOuter = n.__highByOuter || 0, n.__highDownDispatcher = !t); +} +function gg(r) { + return !!(r && r.__highDownDispatcher); +} +function jJ(r, e, t) { + var n = Ft(r); + n.componentMainType = e.mainType, n.componentIndex = e.componentIndex, n.componentHighDownName = t; +} +function FJ(r) { + var e = Lk[r]; + return e == null && Ok <= 32 && (e = Lk[r] = Ok++), e; +} +function N1(r) { + var e = r.type; + return e === Vp || e === j0 || e === Gp; +} +function $k(r) { + var e = r.type; + return e === Rh || e === B0; +} +function $J(r) { + var e = w5(r); + e.normalFill = r.style.fill, e.normalStroke = r.style.stroke; + var t = r.states.select || {}; + e.selectFill = t.style && t.style.fill || null, e.selectStroke = t.style && t.style.stroke || null; +} +var Hf = Al.CMD, HJ = [[], [], []], Hk = Math.sqrt, VJ = Math.atan2; +function O5(r, e) { + if (e) { + var t = r.data, n = r.len(), i, a, o, s, l, u, c = Hf.M, h = Hf.C, f = Hf.L, v = Hf.R, b = Hf.A, w = Hf.Q; + for (o = 0, s = 0; o < n; ) { + switch (i = t[o++], s = o, a = 0, i) { + case c: + a = 1; + break; + case f: + a = 1; + break; + case h: + a = 3; + break; + case w: + a = 2; + break; + case b: + var p = e[4], d = e[5], m = Hk(e[0] * e[0] + e[1] * e[1]), _ = Hk(e[2] * e[2] + e[3] * e[3]), y = VJ(-e[1] / _, e[0] / m); + t[o] *= m, t[o++] += p, t[o] *= _, t[o++] += d, t[o++] *= m, t[o++] *= _, t[o++] += y, t[o++] += y, o += 2, s = o; + break; + case v: + u[0] = t[o++], u[1] = t[o++], zi(u, u, e), t[s++] = u[0], t[s++] = u[1], u[0] += t[o++], u[1] += t[o++], zi(u, u, e), t[s++] = u[0], t[s++] = u[1]; + } + for (l = 0; l < a; l++) { + var x = HJ[l]; + x[0] = t[o++], x[1] = t[o++], zi(x, x, e), t[s++] = x[0], t[s++] = x[1]; + } + } + r.increaseVersion(); + } +} +var NS = Math.sqrt, ky = Math.sin, Oy = Math.cos, qv = Math.PI; +function Vk(r) { + return Math.sqrt(r[0] * r[0] + r[1] * r[1]); +} +function z1(r, e) { + return (r[0] * e[0] + r[1] * e[1]) / (Vk(r) * Vk(e)); +} +function Gk(r, e) { + return (r[0] * e[1] < r[1] * e[0] ? -1 : 1) * Math.acos(z1(r, e)); +} +function Uk(r, e, t, n, i, a, o, s, l, u, c) { + var h = l * (qv / 180), f = Oy(h) * (r - t) / 2 + ky(h) * (e - n) / 2, v = -1 * ky(h) * (r - t) / 2 + Oy(h) * (e - n) / 2, b = f * f / (o * o) + v * v / (s * s); + b > 1 && (o *= NS(b), s *= NS(b)); + var w = (i === a ? -1 : 1) * NS((o * o * (s * s) - o * o * (v * v) - s * s * (f * f)) / (o * o * (v * v) + s * s * (f * f))) || 0, p = w * o * v / s, d = w * -s * f / o, m = (r + t) / 2 + Oy(h) * p - ky(h) * d, _ = (e + n) / 2 + ky(h) * p + Oy(h) * d, y = Gk([1, 0], [(f - p) / o, (v - d) / s]), x = [(f - p) / o, (v - d) / s], g = [(-1 * f - p) / o, (-1 * v - d) / s], S = Gk(x, g); + if (z1(x, g) <= -1 && (S = qv), z1(x, g) >= 1 && (S = 0), S < 0) { + var T = Math.round(S / qv * 1e6) / 1e6; + S = qv * 2 + T % 2 * qv; + } + c.addData(u, m, _, o, s, y, S, h, a); +} +var GJ = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig, UJ = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g; +function WJ(r) { + var e = new Al(); + if (!r) + return e; + var t = 0, n = 0, i = t, a = n, o, s = Al.CMD, l = r.match(GJ); + if (!l) + return e; + for (var u = 0; u < l.length; u++) { + for (var c = l[u], h = c.charAt(0), f = void 0, v = c.match(UJ) || [], b = v.length, w = 0; w < b; w++) + v[w] = parseFloat(v[w]); + for (var p = 0; p < b; ) { + var d = void 0, m = void 0, _ = void 0, y = void 0, x = void 0, g = void 0, S = void 0, T = t, C = n, E = void 0, M = void 0; + switch (h) { + case "l": + t += v[p++], n += v[p++], f = s.L, e.addData(f, t, n); + break; + case "L": + t = v[p++], n = v[p++], f = s.L, e.addData(f, t, n); + break; + case "m": + t += v[p++], n += v[p++], f = s.M, e.addData(f, t, n), i = t, a = n, h = "l"; + break; + case "M": + t = v[p++], n = v[p++], f = s.M, e.addData(f, t, n), i = t, a = n, h = "L"; + break; + case "h": + t += v[p++], f = s.L, e.addData(f, t, n); + break; + case "H": + t = v[p++], f = s.L, e.addData(f, t, n); + break; + case "v": + n += v[p++], f = s.L, e.addData(f, t, n); + break; + case "V": + n = v[p++], f = s.L, e.addData(f, t, n); + break; + case "C": + f = s.C, e.addData(f, v[p++], v[p++], v[p++], v[p++], v[p++], v[p++]), t = v[p - 2], n = v[p - 1]; + break; + case "c": + f = s.C, e.addData(f, v[p++] + t, v[p++] + n, v[p++] + t, v[p++] + n, v[p++] + t, v[p++] + n), t += v[p - 2], n += v[p - 1]; + break; + case "S": + d = t, m = n, E = e.len(), M = e.data, o === s.C && (d += t - M[E - 4], m += n - M[E - 3]), f = s.C, T = v[p++], C = v[p++], t = v[p++], n = v[p++], e.addData(f, d, m, T, C, t, n); + break; + case "s": + d = t, m = n, E = e.len(), M = e.data, o === s.C && (d += t - M[E - 4], m += n - M[E - 3]), f = s.C, T = t + v[p++], C = n + v[p++], t += v[p++], n += v[p++], e.addData(f, d, m, T, C, t, n); + break; + case "Q": + T = v[p++], C = v[p++], t = v[p++], n = v[p++], f = s.Q, e.addData(f, T, C, t, n); + break; + case "q": + T = v[p++] + t, C = v[p++] + n, t += v[p++], n += v[p++], f = s.Q, e.addData(f, T, C, t, n); + break; + case "T": + d = t, m = n, E = e.len(), M = e.data, o === s.Q && (d += t - M[E - 4], m += n - M[E - 3]), t = v[p++], n = v[p++], f = s.Q, e.addData(f, d, m, t, n); + break; + case "t": + d = t, m = n, E = e.len(), M = e.data, o === s.Q && (d += t - M[E - 4], m += n - M[E - 3]), t += v[p++], n += v[p++], f = s.Q, e.addData(f, d, m, t, n); + break; + case "A": + _ = v[p++], y = v[p++], x = v[p++], g = v[p++], S = v[p++], T = t, C = n, t = v[p++], n = v[p++], f = s.A, Uk(T, C, t, n, g, S, _, y, x, f, e); + break; + case "a": + _ = v[p++], y = v[p++], x = v[p++], g = v[p++], S = v[p++], T = t, C = n, t += v[p++], n += v[p++], f = s.A, Uk(T, C, t, n, g, S, _, y, x, f, e); + break; + } + } + (h === "z" || h === "Z") && (f = s.Z, e.addData(f), t = i, n = a), o = f; + } + return e.toStatic(), e; +} +var L5 = function(r) { + En(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.applyTransform = function(t) { + }, e; +}(hr); +function P5(r) { + return r.setData != null; +} +function R5(r, e) { + var t = WJ(r), n = Fe({}, e); + return n.buildPath = function(i) { + if (P5(i)) { + i.setData(t.data); + var a = i.getContext(); + a && i.rebuildPath(a, 1); + } else { + var a = i; + t.rebuildPath(a, 1); + } + }, n.applyTransform = function(i) { + O5(t, i), this.dirtyShape(); + }, n; +} +function N5(r, e) { + return new L5(R5(r, e)); +} +function YJ(r, e) { + var t = R5(r, e), n = function(i) { + En(a, i); + function a(o) { + var s = i.call(this, o) || this; + return s.applyTransform = t.applyTransform, s.buildPath = t.buildPath, s; + } + return a; + }(L5); + return n; +} +function XJ(r, e) { + for (var t = [], n = r.length, i = 0; i < n; i++) { + var a = r[i]; + t.push(a.getUpdatedPathProxy(!0)); + } + var o = new hr(e); + return o.createPathProxy(), o.buildPath = function(s) { + if (P5(s)) { + s.appendPath(t); + var l = s.getContext(); + l && s.rebuildPath(l, 1); + } + }, o; +} +function KI(r, e) { + e = e || {}; + var t = new hr(); + return r.shape && t.setShape(r.shape), t.setStyle(r.style), e.bakeTransform ? O5(t.path, r.getComputedTransform()) : e.toLocal ? t.setLocalTransform(r.getComputedTransform()) : t.copyTransform(r), t.buildPath = r.buildPath, t.applyTransform = t.applyTransform, t.z = r.z, t.z2 = r.z2, t.zlevel = r.zlevel, t; +} +var ZJ = function() { + function r() { + this.cx = 0, this.cy = 0, this.r = 0; + } + return r; +}(), z5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new ZJ(); + }, e.prototype.buildPath = function(t, n) { + t.moveTo(n.cx + n.r, n.cy), t.arc(n.cx, n.cy, n.r, 0, Math.PI * 2); + }, e; +}(hr); +z5.prototype.type = "circle"; +const $s = z5; +var JJ = function() { + function r() { + this.cx = 0, this.cy = 0, this.rx = 0, this.ry = 0; + } + return r; +}(), B5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new JJ(); + }, e.prototype.buildPath = function(t, n) { + var i = 0.5522848, a = n.cx, o = n.cy, s = n.rx, l = n.ry, u = s * i, c = l * i; + t.moveTo(a - s, o), t.bezierCurveTo(a - s, o - c, a - u, o - l, a, o - l), t.bezierCurveTo(a + u, o - l, a + s, o - c, a + s, o), t.bezierCurveTo(a + s, o + c, a + u, o + l, a, o + l), t.bezierCurveTo(a - u, o + l, a - s, o + c, a - s, o), t.closePath(); + }, e; +}(hr); +B5.prototype.type = "ellipse"; +const zb = B5; +var j5 = Math.PI, zS = j5 * 2, eh = Math.sin, Vf = Math.cos, KJ = Math.acos, la = Math.atan2, Wk = Math.abs, Up = Math.sqrt, Ap = Math.max, ll = Math.min, Is = 1e-4; +function QJ(r, e, t, n, i, a, o, s) { + var l = t - r, u = n - e, c = o - i, h = s - a, f = h * l - c * u; + if (!(f * f < Is)) + return f = (c * (e - a) - h * (r - i)) / f, [r + f * l, e + f * u]; +} +function Ly(r, e, t, n, i, a, o) { + var s = r - t, l = e - n, u = (o ? a : -a) / Up(s * s + l * l), c = u * l, h = -u * s, f = r + c, v = e + h, b = t + c, w = n + h, p = (f + b) / 2, d = (v + w) / 2, m = b - f, _ = w - v, y = m * m + _ * _, x = i - a, g = f * w - b * v, S = (_ < 0 ? -1 : 1) * Up(Ap(0, x * x * y - g * g)), T = (g * _ - m * S) / y, C = (-g * m - _ * S) / y, E = (g * _ + m * S) / y, M = (-g * m + _ * S) / y, P = T - p, R = C - d, N = E - p, F = M - d; + return P * P + R * R > N * N + F * F && (T = E, C = M), { + cx: T, + cy: C, + x0: -c, + y0: -h, + x1: T * (i / x - 1), + y1: C * (i / x - 1) + }; +} +function qJ(r) { + var e; + if (We(r)) { + var t = r.length; + if (!t) + return r; + t === 1 ? e = [r[0], r[0], 0, 0] : t === 2 ? e = [r[0], r[0], r[1], r[1]] : t === 3 ? e = r.concat(r[2]) : e = r; + } else + e = [r, r, r, r]; + return e; +} +function eK(r, e) { + var t, n = Ap(e.r, 0), i = Ap(e.r0 || 0, 0), a = n > 0, o = i > 0; + if (!(!a && !o)) { + if (a || (n = i, i = 0), i > n) { + var s = n; + n = i, i = s; + } + var l = e.startAngle, u = e.endAngle; + if (!(isNaN(l) || isNaN(u))) { + var c = e.cx, h = e.cy, f = !!e.clockwise, v = Wk(u - l), b = v > zS && v % zS; + if (b > Is && (v = b), !(n > Is)) + r.moveTo(c, h); + else if (v > zS - Is) + r.moveTo(c + n * Vf(l), h + n * eh(l)), r.arc(c, h, n, l, u, !f), i > Is && (r.moveTo(c + i * Vf(u), h + i * eh(u)), r.arc(c, h, i, u, l, f)); + else { + var w = void 0, p = void 0, d = void 0, m = void 0, _ = void 0, y = void 0, x = void 0, g = void 0, S = void 0, T = void 0, C = void 0, E = void 0, M = void 0, P = void 0, R = void 0, N = void 0, F = n * Vf(l), U = n * eh(l), $ = i * Vf(u), G = i * eh(u), Q = v > Is; + if (Q) { + var ee = e.cornerRadius; + ee && (t = qJ(ee), w = t[0], p = t[1], d = t[2], m = t[3]); + var ce = Wk(n - i) / 2; + if (_ = ll(ce, d), y = ll(ce, m), x = ll(ce, w), g = ll(ce, p), C = S = Ap(_, y), E = T = Ap(x, g), (S > Is || T > Is) && (M = n * Vf(u), P = n * eh(u), R = i * Vf(l), N = i * eh(l), v < j5)) { + var ne = QJ(F, U, R, N, M, P, $, G); + if (ne) { + var fe = F - ne[0], K = U - ne[1], Oe = M - ne[0], xe = P - ne[1], Ge = 1 / eh(KJ((fe * Oe + K * xe) / (Up(fe * fe + K * K) * Up(Oe * Oe + xe * xe))) / 2), oe = Up(ne[0] * ne[0] + ne[1] * ne[1]); + C = ll(S, (n - oe) / (Ge + 1)), E = ll(T, (i - oe) / (Ge - 1)); + } + } + } + if (!Q) + r.moveTo(c + F, h + U); + else if (C > Is) { + var de = ll(d, C), se = ll(m, C), te = Ly(R, N, F, U, n, de, f), pe = Ly(M, P, $, G, n, se, f); + r.moveTo(c + te.cx + te.x0, h + te.cy + te.y0), C < S && de === se ? r.arc(c + te.cx, h + te.cy, C, la(te.y0, te.x0), la(pe.y0, pe.x0), !f) : (de > 0 && r.arc(c + te.cx, h + te.cy, de, la(te.y0, te.x0), la(te.y1, te.x1), !f), r.arc(c, h, n, la(te.cy + te.y1, te.cx + te.x1), la(pe.cy + pe.y1, pe.cx + pe.x1), !f), se > 0 && r.arc(c + pe.cx, h + pe.cy, se, la(pe.y1, pe.x1), la(pe.y0, pe.x0), !f)); + } else + r.moveTo(c + F, h + U), r.arc(c, h, n, l, u, !f); + if (!(i > Is) || !Q) + r.lineTo(c + $, h + G); + else if (E > Is) { + var de = ll(w, E), se = ll(p, E), te = Ly($, G, M, P, i, -se, f), pe = Ly(F, U, R, N, i, -de, f); + r.lineTo(c + te.cx + te.x0, h + te.cy + te.y0), E < T && de === se ? r.arc(c + te.cx, h + te.cy, E, la(te.y0, te.x0), la(pe.y0, pe.x0), !f) : (se > 0 && r.arc(c + te.cx, h + te.cy, se, la(te.y0, te.x0), la(te.y1, te.x1), !f), r.arc(c, h, i, la(te.cy + te.y1, te.cx + te.x1), la(pe.cy + pe.y1, pe.cx + pe.x1), f), de > 0 && r.arc(c + pe.cx, h + pe.cy, de, la(pe.y1, pe.x1), la(pe.y0, pe.x0), !f)); + } else + r.lineTo(c + $, h + G), r.arc(c, h, i, u, l, f); + } + r.closePath(); + } + } +} +var tK = function() { + function r() { + this.cx = 0, this.cy = 0, this.r0 = 0, this.r = 0, this.startAngle = 0, this.endAngle = Math.PI * 2, this.clockwise = !0, this.cornerRadius = 0; + } + return r; +}(), F5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new tK(); + }, e.prototype.buildPath = function(t, n) { + eK(t, n); + }, e.prototype.isZeroArea = function() { + return this.shape.startAngle === this.shape.endAngle || this.shape.r === this.shape.r0; + }, e; +}(hr); +F5.prototype.type = "sector"; +const Oa = F5; +var rK = function() { + function r() { + this.cx = 0, this.cy = 0, this.r = 0, this.r0 = 0; + } + return r; +}(), $5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new rK(); + }, e.prototype.buildPath = function(t, n) { + var i = n.cx, a = n.cy, o = Math.PI * 2; + t.moveTo(i + n.r, a), t.arc(i, a, n.r, 0, o, !1), t.moveTo(i + n.r0, a), t.arc(i, a, n.r0, 0, o, !0); + }, e; +}(hr); +$5.prototype.type = "ring"; +const Qg = $5; +function nK(r, e, t, n) { + var i = [], a = [], o = [], s = [], l, u, c, h; + if (n) { + c = [1 / 0, 1 / 0], h = [-1 / 0, -1 / 0]; + for (var f = 0, v = r.length; f < v; f++) + Ul(c, c, r[f]), Wl(h, h, r[f]); + Ul(c, c, n[0]), Wl(h, h, n[1]); + } + for (var f = 0, v = r.length; f < v; f++) { + var b = r[f]; + if (t) + l = r[f ? f - 1 : v - 1], u = r[(f + 1) % v]; + else if (f === 0 || f === v - 1) { + i.push(bl(r[f])); + continue; + } else + l = r[f - 1], u = r[f + 1]; + Yu(a, u, l), zp(a, a, e); + var w = u_(b, l), p = u_(b, u), d = w + p; + d !== 0 && (w /= d, p /= d), zp(o, a, -w), zp(s, a, p); + var m = s1([], b, o), _ = s1([], b, s); + n && (Wl(m, m, c), Ul(m, m, h), Wl(_, _, c), Ul(_, _, h)), i.push(m), i.push(_); + } + return t && i.push(i.shift()), i; +} +function H5(r, e, t) { + var n = e.smooth, i = e.points; + if (i && i.length >= 2) { + if (n) { + var a = nK(i, n, t, e.smoothConstraint); + r.moveTo(i[0][0], i[0][1]); + for (var o = i.length, s = 0; s < (t ? o : o - 1); s++) { + var l = a[s * 2], u = a[s * 2 + 1], c = i[(s + 1) % o]; + r.bezierCurveTo(l[0], l[1], u[0], u[1], c[0], c[1]); + } + } else { + r.moveTo(i[0][0], i[0][1]); + for (var s = 1, h = i.length; s < h; s++) + r.lineTo(i[s][0], i[s][1]); + } + t && r.closePath(); + } +} +var iK = function() { + function r() { + this.points = null, this.smooth = 0, this.smoothConstraint = null; + } + return r; +}(), V5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new iK(); + }, e.prototype.buildPath = function(t, n) { + H5(t, n, !0); + }, e; +}(hr); +V5.prototype.type = "polygon"; +const La = V5; +var aK = function() { + function r() { + this.points = null, this.percent = 1, this.smooth = 0, this.smoothConstraint = null; + } + return r; +}(), G5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new aK(); + }, e.prototype.buildPath = function(t, n) { + H5(t, n, !1); + }, e; +}(hr); +G5.prototype.type = "polyline"; +const Pa = G5; +var oK = {}, sK = function() { + function r() { + this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0, this.percent = 1; + } + return r; +}(), U5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new sK(); + }, e.prototype.buildPath = function(t, n) { + var i, a, o, s; + if (this.subPixelOptimize) { + var l = m5(oK, n, this.style); + i = l.x1, a = l.y1, o = l.x2, s = l.y2; + } else + i = n.x1, a = n.y1, o = n.x2, s = n.y2; + var u = n.percent; + u !== 0 && (t.moveTo(i, a), u < 1 && (o = i * (1 - u) + o * u, s = a * (1 - u) + s * u), t.lineTo(o, s)); + }, e.prototype.pointAt = function(t) { + var n = this.shape; + return [ + n.x1 * (1 - t) + n.x2 * t, + n.y1 * (1 - t) + n.y2 * t + ]; + }, e; +}(hr); +U5.prototype.type = "line"; +const Ai = U5; +var Ja = [], lK = function() { + function r() { + this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0, this.cpx1 = 0, this.cpy1 = 0, this.percent = 1; + } + return r; +}(); +function Yk(r, e, t) { + var n = r.cpx2, i = r.cpy2; + return n != null || i != null ? [ + (t ? qD : Ti)(r.x1, r.cpx1, r.cpx2, r.x2, e), + (t ? qD : Ti)(r.y1, r.cpy1, r.cpy2, r.y2, e) + ] : [ + (t ? d1 : Ri)(r.x1, r.cpx1, r.x2, e), + (t ? d1 : Ri)(r.y1, r.cpy1, r.y2, e) + ]; +} +var W5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new lK(); + }, e.prototype.buildPath = function(t, n) { + var i = n.x1, a = n.y1, o = n.x2, s = n.y2, l = n.cpx1, u = n.cpy1, c = n.cpx2, h = n.cpy2, f = n.percent; + f !== 0 && (t.moveTo(i, a), c == null || h == null ? (f < 1 && (sg(i, l, o, f, Ja), l = Ja[1], o = Ja[2], sg(a, u, s, f, Ja), u = Ja[1], s = Ja[2]), t.quadraticCurveTo(l, u, o, s)) : (f < 1 && (fc(i, l, c, o, f, Ja), l = Ja[1], c = Ja[2], o = Ja[3], fc(a, u, h, s, f, Ja), u = Ja[1], h = Ja[2], s = Ja[3]), t.bezierCurveTo(l, u, c, h, o, s))); + }, e.prototype.pointAt = function(t) { + return Yk(this.shape, t, !1); + }, e.prototype.tangentAt = function(t) { + var n = Yk(this.shape, t, !0); + return rf(n, n); + }, e; +}(hr); +W5.prototype.type = "bezier-curve"; +const qg = W5; +var uK = function() { + function r() { + this.cx = 0, this.cy = 0, this.r = 0, this.startAngle = 0, this.endAngle = Math.PI * 2, this.clockwise = !0; + } + return r; +}(), Y5 = function(r) { + En(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new uK(); + }, e.prototype.buildPath = function(t, n) { + var i = n.cx, a = n.cy, o = Math.max(n.r, 0), s = n.startAngle, l = n.endAngle, u = n.clockwise, c = Math.cos(s), h = Math.sin(s); + t.moveTo(c * o + i, h * o + a), t.arc(i, a, o, s, l, !u); + }, e; +}(hr); +Y5.prototype.type = "arc"; +const Bb = Y5; +var cK = function(r) { + En(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "compound", t; + } + return e.prototype._updatePathDirty = function() { + for (var t = this.shape.paths, n = this.shapeChanged(), i = 0; i < t.length; i++) + n = n || t[i].shapeChanged(); + n && this.dirtyShape(); + }, e.prototype.beforeBrush = function() { + this._updatePathDirty(); + for (var t = this.shape.paths || [], n = this.getGlobalScale(), i = 0; i < t.length; i++) + t[i].path || t[i].createPathProxy(), t[i].path.setScale(n[0], n[1], t[i].segmentIgnoreThreshold); + }, e.prototype.buildPath = function(t, n) { + for (var i = n.paths || [], a = 0; a < i.length; a++) + i[a].buildPath(t, i[a].shape, !0); + }, e.prototype.afterBrush = function() { + for (var t = this.shape.paths || [], n = 0; n < t.length; n++) + t[n].pathUpdated(); + }, e.prototype.getBoundingRect = function() { + return this._updatePathDirty.call(this), hr.prototype.getBoundingRect.call(this); + }, e; +}(hr); +const jb = cK; +var hK = function() { + function r(e) { + this.colorStops = e || []; + } + return r.prototype.addColorStop = function(e, t) { + this.colorStops.push({ + offset: e, + color: t + }); + }, r; +}(); +const X5 = hK; +var fK = function(r) { + En(e, r); + function e(t, n, i, a, o, s) { + var l = r.call(this, o) || this; + return l.x = t == null ? 0 : t, l.y = n == null ? 0 : n, l.x2 = i == null ? 1 : i, l.y2 = a == null ? 0 : a, l.type = "linear", l.global = s || !1, l; + } + return e; +}(X5); +const Jd = fK; +var dK = function(r) { + En(e, r); + function e(t, n, i, a, o) { + var s = r.call(this, a) || this; + return s.x = t == null ? 0.5 : t, s.y = n == null ? 0.5 : n, s.r = i == null ? 0.5 : i, s.type = "radial", s.global = o || !1, s; + } + return e; +}(X5); +const QI = dK; +var th = [0, 0], rh = [0, 0], Py = new Zt(), Ry = new Zt(), vK = function() { + function r(e, t) { + this._corners = [], this._axes = [], this._origin = [0, 0]; + for (var n = 0; n < 4; n++) + this._corners[n] = new Zt(); + for (var n = 0; n < 2; n++) + this._axes[n] = new Zt(); + e && this.fromBoundingRect(e, t); + } + return r.prototype.fromBoundingRect = function(e, t) { + var n = this._corners, i = this._axes, a = e.x, o = e.y, s = a + e.width, l = o + e.height; + if (n[0].set(a, o), n[1].set(s, o), n[2].set(s, l), n[3].set(a, l), t) + for (var u = 0; u < 4; u++) + n[u].transform(t); + Zt.sub(i[0], n[1], n[0]), Zt.sub(i[1], n[3], n[0]), i[0].normalize(), i[1].normalize(); + for (var u = 0; u < 2; u++) + this._origin[u] = i[u].dot(n[0]); + }, r.prototype.intersect = function(e, t) { + var n = !0, i = !t; + return Py.set(1 / 0, 1 / 0), Ry.set(0, 0), !this._intersectCheckOneSide(this, e, Py, Ry, i, 1) && (n = !1, i) || !this._intersectCheckOneSide(e, this, Py, Ry, i, -1) && (n = !1, i) || i || Zt.copy(t, n ? Py : Ry), n; + }, r.prototype._intersectCheckOneSide = function(e, t, n, i, a, o) { + for (var s = !0, l = 0; l < 2; l++) { + var u = this._axes[l]; + if (this._getProjMinMaxOnAxis(l, e._corners, th), this._getProjMinMaxOnAxis(l, t._corners, rh), th[1] < rh[0] || th[0] > rh[1]) { + if (s = !1, a) + return s; + var c = Math.abs(rh[0] - th[1]), h = Math.abs(th[0] - rh[1]); + Math.min(c, h) > i.len() && (c < h ? Zt.scale(i, u, -c * o) : Zt.scale(i, u, h * o)); + } else if (n) { + var c = Math.abs(rh[0] - th[1]), h = Math.abs(th[0] - rh[1]); + Math.min(c, h) < n.len() && (c < h ? Zt.scale(n, u, c * o) : Zt.scale(n, u, -h * o)); + } + } + return s; + }, r.prototype._getProjMinMaxOnAxis = function(e, t, n) { + for (var i = this._axes[e], a = this._origin, o = t[0].dot(i) + a[e], s = o, l = o, u = 1; u < t.length; u++) { + var c = t[u].dot(i) + a[e]; + s = Math.min(c, s), l = Math.max(c, l); + } + n[0] = s, n[1] = l; + }, r; +}(); +const y_ = vK; +var pK = [], gK = function(r) { + En(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.notClear = !0, t.incremental = !0, t._displayables = [], t._temporaryDisplayables = [], t._cursor = 0, t; + } + return e.prototype.traverse = function(t, n) { + t.call(n, this); + }, e.prototype.useStyle = function() { + this.style = {}; + }, e.prototype.getCursor = function() { + return this._cursor; + }, e.prototype.innerAfterBrush = function() { + this._cursor = this._displayables.length; + }, e.prototype.clearDisplaybles = function() { + this._displayables = [], this._temporaryDisplayables = [], this._cursor = 0, this.markRedraw(), this.notClear = !1; + }, e.prototype.clearTemporalDisplayables = function() { + this._temporaryDisplayables = []; + }, e.prototype.addDisplayable = function(t, n) { + n ? this._temporaryDisplayables.push(t) : this._displayables.push(t), this.markRedraw(); + }, e.prototype.addDisplayables = function(t, n) { + n = n || !1; + for (var i = 0; i < t.length; i++) + this.addDisplayable(t[i], n); + }, e.prototype.getDisplayables = function() { + return this._displayables; + }, e.prototype.getTemporalDisplayables = function() { + return this._temporaryDisplayables; + }, e.prototype.eachPendingDisplayable = function(t) { + for (var n = this._cursor; n < this._displayables.length; n++) + t && t(this._displayables[n]); + for (var n = 0; n < this._temporaryDisplayables.length; n++) + t && t(this._temporaryDisplayables[n]); + }, e.prototype.update = function() { + this.updateTransform(); + for (var t = this._cursor; t < this._displayables.length; t++) { + var n = this._displayables[t]; + n.parent = this, n.update(), n.parent = null; + } + for (var t = 0; t < this._temporaryDisplayables.length; t++) { + var n = this._temporaryDisplayables[t]; + n.parent = this, n.update(), n.parent = null; + } + }, e.prototype.getBoundingRect = function() { + if (!this._rect) { + for (var t = new Wt(1 / 0, 1 / 0, -1 / 0, -1 / 0), n = 0; n < this._displayables.length; n++) { + var i = this._displayables[n], a = i.getBoundingRect().clone(); + i.needLocalTransform() && a.applyTransform(i.getLocalTransform(pK)), t.union(a); + } + this._rect = t; + } + return this._rect; + }, e.prototype.contain = function(t, n) { + var i = this.transformCoordToLocal(t, n), a = this.getBoundingRect(); + if (a.contain(i[0], i[1])) + for (var o = 0; o < this._displayables.length; o++) { + var s = this._displayables[o]; + if (s.contain(t, n)) + return !0; + } + return !1; + }, e; +}(ts); +const Z5 = gK; +var J5 = Rr(); +function Kd(r, e, t, n, i) { + var a; + if (e && e.ecModel) { + var o = e.ecModel.getUpdatePayload(); + a = o && o.animation; + } + var s = e && e.isAnimationEnabled(), l = r === "update"; + if (s) { + var u = void 0, c = void 0, h = void 0; + n ? (u = Jt(n.duration, 200), c = Jt(n.easing, "cubicOut"), h = 0) : (u = e.getShallow(l ? "animationDurationUpdate" : "animationDuration"), c = e.getShallow(l ? "animationEasingUpdate" : "animationEasing"), h = e.getShallow(l ? "animationDelayUpdate" : "animationDelay")), a && (a.duration != null && (u = a.duration), a.easing != null && (c = a.easing), a.delay != null && (h = a.delay)), Tt(h) && (h = h(t, i)), Tt(u) && (u = u(t)); + var f = { + duration: u || 0, + delay: h, + easing: c + }; + return f; + } else + return null; +} +function qI(r, e, t, n, i, a, o) { + var s = !1, l; + Tt(i) ? (o = a, a = i, i = null) : kt(i) && (a = i.cb, o = i.during, s = i.isFrom, l = i.removeOpt, i = i.dataIndex); + var u = r === "leave"; + u || e.stopAnimation("leave"); + var c = Kd(r, n, i, u ? l || {} : null, n && n.getAnimationDelayParams ? n.getAnimationDelayParams(e, i) : null); + if (c && c.duration > 0) { + var h = c.duration, f = c.delay, v = c.easing, b = { + duration: h, + delay: f || 0, + easing: v, + done: a, + force: !!a || !!o, + // Set to final state in update/init animation. + // So the post processing based on the path shape can be done correctly. + setToFinal: !u, + scope: r, + during: o + }; + s ? e.animateFrom(t, b) : e.animateTo(t, b); + } else + e.stopAnimation(), !s && e.attr(t), o && o(1), a && a(); +} +function zr(r, e, t, n, i, a) { + qI("update", r, e, t, n, i, a); +} +function An(r, e, t, n, i, a) { + qI("enter", r, e, t, n, i, a); +} +function xd(r) { + if (!r.__zr) + return !0; + for (var e = 0; e < r.animators.length; e++) { + var t = r.animators[e]; + if (t.scope === "leave") + return !0; + } + return !1; +} +function dc(r, e, t, n, i, a) { + xd(r) || qI("leave", r, e, t, n, i, a); +} +function Xk(r, e, t, n) { + r.removeTextContent(), r.removeTextGuideLine(), dc(r, { + style: { + opacity: 0 + } + }, e, t, n); +} +function mg(r, e, t) { + function n() { + r.parent && r.parent.remove(r); + } + r.isGroup ? r.traverse(function(i) { + i.isGroup || Xk(i, e, t, n); + }) : Xk(r, e, t, n); +} +function Hs(r) { + J5(r).oldStyle = r.style; +} +function mK(r) { + return J5(r).oldStyle; +} +var __ = Math.max, b_ = Math.min, B1 = {}; +function K5(r) { + return hr.extend(r); +} +var yK = YJ; +function Q5(r, e) { + return yK(r, e); +} +function ns(r, e) { + B1[r] = e; +} +function Fb(r) { + if (B1.hasOwnProperty(r)) + return B1[r]; +} +function em(r, e, t, n) { + var i = N5(r, e); + return t && (n === "center" && (t = q5(t, i.getBoundingRect())), tA(i, t)), i; +} +function eA(r, e, t) { + var n = new ji({ + style: { + image: r, + x: e.x, + y: e.y, + width: e.width, + height: e.height + }, + onload: function(i) { + if (t === "center") { + var a = { + width: i.width, + height: i.height + }; + n.setStyle(q5(e, a)); + } + } + }); + return n; +} +function q5(r, e) { + var t = e.width / e.height, n = r.height * t, i; + n <= r.width ? i = r.height : (n = r.width, i = n / t); + var a = r.x + r.width / 2, o = r.y + r.height / 2; + return { + x: a - n / 2, + y: o - i / 2, + width: n, + height: i + }; +} +var mo = XJ; +function tA(r, e) { + if (r.applyTransform) { + var t = r.getBoundingRect(), n = t.calculateTransform(e); + r.applyTransform(n); + } +} +function Pd(r, e) { + return m5(r, r, { + lineWidth: e + }), r; +} +function _K(r) { + return y5(r.shape, r.shape, r.style), r; +} +var F0 = Ih; +function oc(r, e) { + for (var t = Yg([]); r && r !== e; ) + xl(t, r.getLocalTransform(), t), r = r.parent; + return t; +} +function zs(r, e, t) { + return e && !Yi(e) && (e = Yl.getLocalTransform(e)), t && (e = nf([], e)), zi([], r, e); +} +function $b(r, e, t) { + var n = e[4] === 0 || e[5] === 0 || e[0] === 0 ? 1 : Math.abs(2 * e[4] / e[0]), i = e[4] === 0 || e[5] === 0 || e[2] === 0 ? 1 : Math.abs(2 * e[4] / e[2]), a = [r === "left" ? -n : r === "right" ? n : 0, r === "top" ? -i : r === "bottom" ? i : 0]; + return a = zs(a, e, t), Math.abs(a[0]) > Math.abs(a[1]) ? a[0] > 0 ? "right" : "left" : a[1] > 0 ? "bottom" : "top"; +} +function Zk(r) { + return !r.isGroup; +} +function bK(r) { + return r.shape != null; +} +function tm(r, e, t) { + if (!r || !e) + return; + function n(o) { + var s = {}; + return o.traverse(function(l) { + Zk(l) && l.anid && (s[l.anid] = l); + }), s; + } + function i(o) { + var s = { + x: o.x, + y: o.y, + rotation: o.rotation + }; + return bK(o) && (s.shape = Fe({}, o.shape)), s; + } + var a = n(r); + e.traverse(function(o) { + if (Zk(o) && o.anid) { + var s = a[o.anid]; + if (s) { + var l = i(o); + o.attr(i(s)), zr(o, l, t, Ft(o).dataIndex); + } + } + }); +} +function rA(r, e) { + return Ke(r, function(t) { + var n = t[0]; + n = __(n, e.x), n = b_(n, e.x + e.width); + var i = t[1]; + return i = __(i, e.y), i = b_(i, e.y + e.height), [n, i]; + }); +} +function eF(r, e) { + var t = __(r.x, e.x), n = b_(r.x + r.width, e.x + e.width), i = __(r.y, e.y), a = b_(r.y + r.height, e.y + e.height); + if (n >= t && a >= i) + return { + x: t, + y: i, + width: n - t, + height: a - i + }; +} +function Qd(r, e, t) { + var n = Fe({ + rectHover: !0 + }, e), i = n.style = { + strokeNoScale: !0 + }; + if (t = t || { + x: -1, + y: -1, + width: 2, + height: 2 + }, r) + return r.indexOf("image://") === 0 ? (i.image = r.slice(8), Mt(i, t), new ji(n)) : em(r.replace("path://", ""), n, t, "center"); +} +function Ep(r, e, t, n, i) { + for (var a = 0, o = i[i.length - 1]; a < i.length; a++) { + var s = i[a]; + if (tF(r, e, t, n, s[0], s[1], o[0], o[1])) + return !0; + o = s; + } +} +function tF(r, e, t, n, i, a, o, s) { + var l = t - r, u = n - e, c = o - i, h = s - a, f = BS(c, h, l, u); + if (xK(f)) + return !1; + var v = r - i, b = e - a, w = BS(v, b, l, u) / f; + if (w < 0 || w > 1) + return !1; + var p = BS(v, b, c, h) / f; + return !(p < 0 || p > 1); +} +function BS(r, e, t, n) { + return r * n - t * e; +} +function xK(r) { + return r <= 1e-6 && r >= -1e-6; +} +function qd(r) { + var e = r.itemTooltipOption, t = r.componentModel, n = r.itemName, i = ut(e) ? { + formatter: e + } : e, a = t.mainType, o = t.componentIndex, s = { + componentType: a, + name: n, + $vars: ["name"] + }; + s[a + "Index"] = o; + var l = r.formatterParamsExtra; + l && X(yr(l), function(c) { + gt(s, c) || (s[c] = l[c], s.$vars.push(c)); + }); + var u = Ft(r.el); + u.componentMainType = a, u.componentIndex = o, u.tooltipConfig = { + name: n, + option: Mt({ + content: n, + formatterParams: s + }, i) + }; +} +function Jk(r, e) { + var t; + r.isGroup && (t = e(r)), t || r.traverse(e); +} +function Cc(r, e) { + if (r) + if (We(r)) + for (var t = 0; t < r.length; t++) + Jk(r[t], e); + else + Jk(r, e); +} +ns("circle", $s); +ns("ellipse", zb); +ns("sector", Oa); +ns("ring", Qg); +ns("polygon", La); +ns("polyline", Pa); +ns("rect", Or); +ns("line", Ai); +ns("bezierCurve", qg); +ns("arc", Bb); +const rm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Arc: Bb, + BezierCurve: qg, + BoundingRect: Wt, + Circle: $s, + CompoundPath: jb, + Ellipse: zb, + Group: Rt, + Image: ji, + IncrementalDisplayable: Z5, + Line: Ai, + LinearGradient: Jd, + OrientedBoundingRect: y_, + Path: hr, + Point: Zt, + Polygon: La, + Polyline: Pa, + RadialGradient: QI, + Rect: Or, + Ring: Qg, + Sector: Oa, + Text: kr, + applyTransform: zs, + clipPointsByRect: rA, + clipRectByRect: eF, + createIcon: Qd, + extendPath: Q5, + extendShape: K5, + getShapeClass: Fb, + getTransform: oc, + groupTransition: tm, + initProps: An, + isElementRemoved: xd, + lineLineIntersect: tF, + linePolygonIntersect: Ep, + makeImage: eA, + makePath: em, + mergePath: mo, + registerShape: ns, + removeElement: dc, + removeElementWithFadeOut: mg, + resizePath: tA, + setTooltipConfig: qd, + subPixelOptimize: F0, + subPixelOptimizeLine: Pd, + subPixelOptimizeRect: _K, + transformDirection: $b, + traverseElements: Cc, + updateProps: zr +}, Symbol.toStringTag, { value: "Module" })); +var Hb = {}; +function rF(r, e) { + for (var t = 0; t < ka.length; t++) { + var n = ka[t], i = e[n], a = r.ensureState(n); + a.style = a.style || {}, a.style.text = i; + } + var o = r.currentStates.slice(); + r.clearStates(!0), r.setStyle({ + text: e.normal + }), r.useStates(o, !0); +} +function j1(r, e, t) { + var n = r.labelFetcher, i = r.labelDataIndex, a = r.labelDimIndex, o = e.normal, s; + n && (s = n.getFormattedLabel(i, "normal", null, a, o && o.get("formatter"), t != null ? { + interpolatedValue: t + } : null)), s == null && (s = Tt(r.defaultText) ? r.defaultText(i, r, t) : r.defaultText); + for (var l = { + normal: s + }, u = 0; u < ka.length; u++) { + var c = ka[u], h = e[c]; + l[c] = Jt(n ? n.getFormattedLabel(i, c, null, a, h && h.get("formatter")) : null, s); + } + return l; +} +function Zi(r, e, t, n) { + t = t || Hb; + for (var i = r instanceof kr, a = !1, o = 0; o < pg.length; o++) { + var s = e[pg[o]]; + if (s && s.getShallow("show")) { + a = !0; + break; + } + } + var l = i ? r : r.getTextContent(); + if (a) { + i || (l || (l = new kr(), r.setTextContent(l)), r.stateProxy && (l.stateProxy = r.stateProxy)); + var u = j1(t, e), c = e.normal, h = !!c.getShallow("show"), f = gn(c, n && n.normal, t, !1, !i); + f.text = u.normal, i || r.setTextConfig(x_(c, t, !1)); + for (var o = 0; o < ka.length; o++) { + var v = ka[o], s = e[v]; + if (s) { + var b = l.ensureState(v), w = !!Jt(s.getShallow("show"), h); + if (w !== h && (b.ignore = !w), b.style = gn(s, n && n[v], t, !0, !i), b.style.text = u[v], !i) { + var p = r.ensureState(v); + p.textConfig = x_(s, t, !0); + } + } + } + l.silent = !!c.getShallow("silent"), l.style.x != null && (f.x = l.style.x), l.style.y != null && (f.y = l.style.y), l.ignore = !h, l.useStyle(f), l.dirty(), t.enableTextSetter && (ev(l).setLabelText = function(d) { + var m = j1(t, e, d); + rF(l, m); + }); + } else + l && (l.ignore = !0); + r.dirty(); +} +function Mi(r, e) { + e = e || "label"; + for (var t = { + normal: r.getModel(e) + }, n = 0; n < ka.length; n++) { + var i = ka[n]; + t[i] = r.getModel([i, e]); + } + return t; +} +function gn(r, e, t, n, i) { + var a = {}; + return SK(a, r, t, n, i), e && Fe(a, e), a; +} +function x_(r, e, t) { + e = e || {}; + var n = {}, i, a = r.getShallow("rotate"), o = Jt(r.getShallow("distance"), t ? null : 5), s = r.getShallow("offset"); + return i = r.getShallow("position") || (t ? null : "inside"), i === "outside" && (i = e.defaultOutsidePosition || "top"), i != null && (n.position = i), s != null && (n.offset = s), a != null && (a *= Math.PI / 180, n.rotation = a), o != null && (n.distance = o), n.outsideFill = r.get("color") === "inherit" ? e.inheritColor || null : "auto", n; +} +function SK(r, e, t, n, i) { + t = t || Hb; + var a = e.ecModel, o = a && a.option.textStyle, s = wK(e), l; + if (s) { + l = {}; + for (var u in s) + if (s.hasOwnProperty(u)) { + var c = e.getModel(["rich", u]); + eO(l[u] = {}, c, o, t, n, i, !1, !0); + } + } + l && (r.rich = l); + var h = e.get("overflow"); + h && (r.overflow = h); + var f = e.get("minMargin"); + f != null && (r.margin = f), eO(r, e, o, t, n, i, !0, !1); +} +function wK(r) { + for (var e; r && r !== r.ecModel; ) { + var t = (r.option || Hb).rich; + if (t) { + e = e || {}; + for (var n = yr(t), i = 0; i < n.length; i++) { + var a = n[i]; + e[a] = 1; + } + } + r = r.parentModel; + } + return e; +} +var Kk = ["fontStyle", "fontWeight", "fontSize", "fontFamily", "textShadowColor", "textShadowBlur", "textShadowOffsetX", "textShadowOffsetY"], Qk = ["align", "lineHeight", "width", "height", "tag", "verticalAlign", "ellipsis"], qk = ["padding", "borderWidth", "borderRadius", "borderDashOffset", "backgroundColor", "borderColor", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY"]; +function eO(r, e, t, n, i, a, o, s) { + t = !i && t || Hb; + var l = n && n.inheritColor, u = e.getShallow("color"), c = e.getShallow("textBorderColor"), h = Jt(e.getShallow("opacity"), t.opacity); + (u === "inherit" || u === "auto") && (l ? u = l : u = null), (c === "inherit" || c === "auto") && (l ? c = l : c = null), a || (u = u || t.color, c = c || t.textBorderColor), u != null && (r.fill = u), c != null && (r.stroke = c); + var f = Jt(e.getShallow("textBorderWidth"), t.textBorderWidth); + f != null && (r.lineWidth = f); + var v = Jt(e.getShallow("textBorderType"), t.textBorderType); + v != null && (r.lineDash = v); + var b = Jt(e.getShallow("textBorderDashOffset"), t.textBorderDashOffset); + b != null && (r.lineDashOffset = b), !i && h == null && !s && (h = n && n.defaultOpacity), h != null && (r.opacity = h), !i && !a && r.fill == null && n.inheritColor && (r.fill = n.inheritColor); + for (var w = 0; w < Kk.length; w++) { + var p = Kk[w], d = Jt(e.getShallow(p), t[p]); + d != null && (r[p] = d); + } + for (var w = 0; w < Qk.length; w++) { + var p = Qk[w], d = e.getShallow(p); + d != null && (r[p] = d); + } + if (r.verticalAlign == null) { + var m = e.getShallow("baseline"); + m != null && (r.verticalAlign = m); + } + if (!o || !n.disableBox) { + for (var w = 0; w < qk.length; w++) { + var p = qk[w], d = e.getShallow(p); + d != null && (r[p] = d); + } + var _ = e.getShallow("borderType"); + _ != null && (r.borderDash = _), (r.backgroundColor === "auto" || r.backgroundColor === "inherit") && l && (r.backgroundColor = l), (r.borderColor === "auto" || r.borderColor === "inherit") && l && (r.borderColor = l); + } +} +function nF(r, e) { + var t = e && e.getModel("textStyle"); + return Qo([ + // FIXME in node-canvas fontWeight is before fontStyle + r.fontStyle || t && t.getShallow("fontStyle") || "", + r.fontWeight || t && t.getShallow("fontWeight") || "", + (r.fontSize || t && t.getShallow("fontSize") || 12) + "px", + r.fontFamily || t && t.getShallow("fontFamily") || "sans-serif" + ].join(" ")); +} +var ev = Rr(); +function iF(r, e, t, n) { + if (r) { + var i = ev(r); + i.prevValue = i.value, i.value = t; + var a = e.normal; + i.valueAnimation = a.get("valueAnimation"), i.valueAnimation && (i.precision = a.get("precision"), i.defaultInterpolatedText = n, i.statesModels = e); + } +} +function aF(r, e, t, n, i) { + var a = ev(r); + if (!a.valueAnimation || a.prevValue === a.value) + return; + var o = a.defaultInterpolatedText, s = Jt(a.interpolatedValue, a.prevValue), l = a.value; + function u(c) { + var h = a5(t, a.precision, s, l, c); + a.interpolatedValue = c === 1 ? null : h; + var f = j1({ + labelDataIndex: e, + labelFetcher: i, + defaultText: o ? o(h) : h + "" + }, a.statesModels, h); + rF(r, f); + } + r.percent = 0, (a.prevValue == null ? An : zr)(r, { + // percent is used to prevent animation from being aborted #15916 + percent: 1 + }, n, e, null, u); +} +var CK = ["textStyle", "color"], jS = ["fontStyle", "fontWeight", "fontSize", "fontFamily", "padding", "lineHeight", "rich", "width", "height", "overflow"], FS = new kr(), TK = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getTextColor = function(e) { + var t = this.ecModel; + return this.getShallow("color") || (!e && t ? t.get(CK) : null); + }, r.prototype.getFont = function() { + return nF({ + fontStyle: this.getShallow("fontStyle"), + fontWeight: this.getShallow("fontWeight"), + fontSize: this.getShallow("fontSize"), + fontFamily: this.getShallow("fontFamily") + }, this.ecModel); + }, r.prototype.getTextRect = function(e) { + for (var t = { + text: e, + verticalAlign: this.getShallow("verticalAlign") || this.getShallow("baseline") + }, n = 0; n < jS.length; n++) + t[jS[n]] = this.getShallow(jS[n]); + return FS.useStyle(t), FS.update(), FS.getBoundingRect(); + }, r; + }() +); +const IK = TK; +var oF = [ + ["lineWidth", "width"], + ["stroke", "color"], + ["opacity"], + ["shadowBlur"], + ["shadowOffsetX"], + ["shadowOffsetY"], + ["shadowColor"], + ["lineDash", "type"], + ["lineDashOffset", "dashOffset"], + ["lineCap", "cap"], + ["lineJoin", "join"], + ["miterLimit"] + // Option decal is in `DecalObject` but style.decal is in `PatternObject`. + // So do not transfer decal directly. +], AK = Wh(oF), EK = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getLineStyle = function(e) { + return AK(this, e); + }, r; + }() +), sF = [ + ["fill", "color"], + ["stroke", "borderColor"], + ["lineWidth", "borderWidth"], + ["opacity"], + ["shadowBlur"], + ["shadowOffsetX"], + ["shadowOffsetY"], + ["shadowColor"], + ["lineDash", "borderType"], + ["lineDashOffset", "borderDashOffset"], + ["lineCap", "borderCap"], + ["lineJoin", "borderJoin"], + ["miterLimit", "borderMiterLimit"] + // Option decal is in `DecalObject` but style.decal is in `PatternObject`. + // So do not transfer decal directly. +], MK = Wh(sF), DK = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getItemStyle = function(e, t) { + return MK(this, e, t); + }, r; + }() +), af = ( + /** @class */ + function() { + function r(e, t, n) { + this.parentModel = t, this.ecModel = n, this.option = e; + } + return r.prototype.init = function(e, t, n) { + }, r.prototype.mergeOption = function(e, t) { + Ut(this.option, e, !0); + }, r.prototype.get = function(e, t) { + return e == null ? this.option : this._doGet(this.parsePath(e), !t && this.parentModel); + }, r.prototype.getShallow = function(e, t) { + var n = this.option, i = n == null ? n : n[e]; + if (i == null && !t) { + var a = this.parentModel; + a && (i = a.getShallow(e)); + } + return i; + }, r.prototype.getModel = function(e, t) { + var n = e != null, i = n ? this.parsePath(e) : null, a = n ? this._doGet(i) : this.option; + return t = t || this.parentModel && this.parentModel.getModel(this.resolveParentPath(i)), new r(a, t, this.ecModel); + }, r.prototype.isEmpty = function() { + return this.option == null; + }, r.prototype.restoreData = function() { + }, r.prototype.clone = function() { + var e = this.constructor; + return new e(Ot(this.option)); + }, r.prototype.parsePath = function(e) { + return typeof e == "string" ? e.split(".") : e; + }, r.prototype.resolveParentPath = function(e) { + return e; + }, r.prototype.isAnimationEnabled = function() { + if (!Dr.node && this.option) { + if (this.option.animation != null) + return !!this.option.animation; + if (this.parentModel) + return this.parentModel.isAnimationEnabled(); + } + }, r.prototype._doGet = function(e, t) { + var n = this.option; + if (!e) + return n; + for (var i = 0; i < e.length && !(e[i] && (n = n && typeof n == "object" ? n[e[i]] : null, n == null)); i++) + ; + return n == null && t && (n = t._doGet(this.resolveParentPath(e), t.parentModel)), n; + }, r; + }() +); +GI(af); +PZ(af); +qn(af, EK); +qn(af, DK); +qn(af, jZ); +qn(af, IK); +const qr = af; +var kK = Math.round(Math.random() * 10); +function tv(r) { + return [r || "", kK++].join("_"); +} +function OK(r) { + var e = {}; + r.registerSubTypeDefaulter = function(t, n) { + var i = gl(t); + e[i.main] = n; + }, r.determineSubType = function(t, n) { + var i = n.type; + if (!i) { + var a = gl(t).main; + r.hasSubTypes(t) && e[a] && (i = e[a](n)); + } + return i; + }; +} +function LK(r, e) { + r.topologicalTravel = function(a, o, s, l) { + if (!a.length) + return; + var u = t(o), c = u.graph, h = u.noEntryList, f = {}; + for (X(a, function(m) { + f[m] = !0; + }); h.length; ) { + var v = h.pop(), b = c[v], w = !!f[v]; + w && (s.call(l, v, b.originalDeps.slice()), delete f[v]), X(b.successor, w ? d : p); + } + X(f, function() { + var m = ""; + throw new Error(m); + }); + function p(m) { + c[m].entryCount--, c[m].entryCount === 0 && h.push(m); + } + function d(m) { + f[m] = !0, p(m); + } + }; + function t(a) { + var o = {}, s = []; + return X(a, function(l) { + var u = n(o, l), c = u.originalDeps = e(l), h = i(c, a); + u.entryCount = h.length, u.entryCount === 0 && s.push(l), X(h, function(f) { + ir(u.predecessor, f) < 0 && u.predecessor.push(f); + var v = n(o, f); + ir(v.successor, f) < 0 && v.successor.push(l); + }); + }), { + graph: o, + noEntryList: s + }; + } + function n(a, o) { + return a[o] || (a[o] = { + predecessor: [], + successor: [] + }), a[o]; + } + function i(a, o) { + var s = []; + return X(a, function(l) { + ir(o, l) >= 0 && s.push(l); + }), s; + } +} +function Tc(r, e) { + return Ut(Ut({}, r, !0), e, !0); +} +const PK = { + time: { + month: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + dayOfWeekAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + }, + legend: { + selector: { + all: "All", + inverse: "Inv" + } + }, + toolbox: { + brush: { + title: { + rect: "Box Select", + polygon: "Lasso Select", + lineX: "Horizontally Select", + lineY: "Vertically Select", + keep: "Keep Selections", + clear: "Clear Selections" + } + }, + dataView: { + title: "Data View", + lang: ["Data View", "Close", "Refresh"] + }, + dataZoom: { + title: { + zoom: "Zoom", + back: "Zoom Reset" + } + }, + magicType: { + title: { + line: "Switch to Line Chart", + bar: "Switch to Bar Chart", + stack: "Stack", + tiled: "Tile" + } + }, + restore: { + title: "Restore" + }, + saveAsImage: { + title: "Save as Image", + lang: ["Right Click to Save Image"] + } + }, + series: { + typeNames: { + pie: "Pie chart", + bar: "Bar chart", + line: "Line chart", + scatter: "Scatter plot", + effectScatter: "Ripple scatter plot", + radar: "Radar chart", + tree: "Tree", + treemap: "Treemap", + boxplot: "Boxplot", + candlestick: "Candlestick", + k: "K line chart", + heatmap: "Heat map", + map: "Map", + parallel: "Parallel coordinate map", + lines: "Line graph", + graph: "Relationship graph", + sankey: "Sankey diagram", + funnel: "Funnel chart", + gauge: "Gauge", + pictorialBar: "Pictorial bar", + themeRiver: "Theme River Map", + sunburst: "Sunburst" + } + }, + aria: { + general: { + withTitle: 'This is a chart about "{title}"', + withoutTitle: "This is a chart" + }, + series: { + single: { + prefix: "", + withName: " with type {seriesType} named {seriesName}.", + withoutName: " with type {seriesType}." + }, + multiple: { + prefix: ". It consists of {seriesCount} series count.", + withName: " The {seriesId} series is a {seriesType} representing {seriesName}.", + withoutName: " The {seriesId} series is a {seriesType}.", + separator: { + middle: "", + end: "" + } + } + }, + data: { + allData: "The data is as follows: ", + partialData: "The first {displayCnt} items are: ", + withName: "the data for {name} is {value}", + withoutName: "{value}", + separator: { + middle: ", ", + end: ". " + } + } + } +}, RK = { + time: { + month: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthAbbr: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], + dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], + dayOfWeekAbbr: ["日", "一", "二", "三", "四", "五", "六"] + }, + legend: { + selector: { + all: "全选", + inverse: "反选" + } + }, + toolbox: { + brush: { + title: { + rect: "矩形选择", + polygon: "圈选", + lineX: "横向选择", + lineY: "纵向选择", + keep: "保持选择", + clear: "清除选择" + } + }, + dataView: { + title: "数据视图", + lang: ["数据视图", "关闭", "刷新"] + }, + dataZoom: { + title: { + zoom: "区域缩放", + back: "区域缩放还原" + } + }, + magicType: { + title: { + line: "切换为折线图", + bar: "切换为柱状图", + stack: "切换为堆叠", + tiled: "切换为平铺" + } + }, + restore: { + title: "还原" + }, + saveAsImage: { + title: "保存为图片", + lang: ["右键另存为图片"] + } + }, + series: { + typeNames: { + pie: "饼图", + bar: "柱状图", + line: "折线图", + scatter: "散点图", + effectScatter: "涟漪散点图", + radar: "雷达图", + tree: "树图", + treemap: "矩形树图", + boxplot: "箱型图", + candlestick: "K线图", + k: "K线图", + heatmap: "热力图", + map: "地图", + parallel: "平行坐标图", + lines: "线图", + graph: "关系图", + sankey: "桑基图", + funnel: "漏斗图", + gauge: "仪表盘图", + pictorialBar: "象形柱图", + themeRiver: "主题河流图", + sunburst: "旭日图" + } + }, + aria: { + general: { + withTitle: "这是一个关于“{title}”的图表。", + withoutTitle: "这是一个图表," + }, + series: { + single: { + prefix: "", + withName: "图表类型是{seriesType},表示{seriesName}。", + withoutName: "图表类型是{seriesType}。" + }, + multiple: { + prefix: "它由{seriesCount}个图表系列组成。", + withName: "第{seriesId}个系列是一个表示{seriesName}的{seriesType},", + withoutName: "第{seriesId}个系列是一个{seriesType},", + separator: { + middle: ";", + end: "。" + } + } + }, + data: { + allData: "其数据是——", + partialData: "其中,前{displayCnt}项是——", + withName: "{name}的数据是{value}", + withoutName: "{value}", + separator: { + middle: ",", + end: "" + } + } + } +}; +var S_ = "ZH", nA = "EN", yg = nA, $0 = {}, iA = {}, lF = Dr.domSupported ? function() { + var r = ( + /* eslint-disable-next-line */ + (document.documentElement.lang || navigator.language || navigator.browserLanguage).toUpperCase() + ); + return r.indexOf(S_) > -1 ? S_ : yg; +}() : yg; +function Vb(r, e) { + r = r.toUpperCase(), iA[r] = new qr(e), $0[r] = e; +} +function NK(r) { + if (ut(r)) { + var e = $0[r.toUpperCase()] || {}; + return r === S_ || r === nA ? Ot(e) : Ut(Ot(e), Ot($0[yg]), !1); + } else + return Ut(Ot(r), Ot($0[yg]), !1); +} +function F1(r) { + return iA[r]; +} +function zK() { + return iA[yg]; +} +Vb(nA, PK); +Vb(S_, RK); +var aA = 1e3, oA = aA * 60, Wp = oA * 60, Jo = Wp * 24, tO = Jo * 365, Mp = { + year: "{yyyy}", + month: "{MMM}", + day: "{d}", + hour: "{HH}:{mm}", + minute: "{HH}:{mm}", + second: "{HH}:{mm}:{ss}", + millisecond: "{HH}:{mm}:{ss} {SSS}", + none: "{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}" +}, Ny = "{yyyy}-{MM}-{dd}", rO = { + year: "{yyyy}", + month: "{yyyy}-{MM}", + day: Ny, + hour: Ny + " " + Mp.hour, + minute: Ny + " " + Mp.minute, + second: Ny + " " + Mp.second, + millisecond: Mp.none +}, $S = ["year", "month", "day", "hour", "minute", "second", "millisecond"], uF = ["year", "half-year", "quarter", "month", "week", "half-week", "day", "half-day", "quarter-day", "hour", "minute", "second", "millisecond"]; +function Ia(r, e) { + return r += "", "0000".substr(0, e - r.length) + r; +} +function Sd(r) { + switch (r) { + case "half-year": + case "quarter": + return "month"; + case "week": + case "half-week": + return "day"; + case "half-day": + case "quarter-day": + return "hour"; + default: + return r; + } +} +function BK(r) { + return r === Sd(r); +} +function jK(r) { + switch (r) { + case "year": + case "month": + return "day"; + case "millisecond": + return "millisecond"; + default: + return "second"; + } +} +function nm(r, e, t, n) { + var i = So(r), a = i[sA(t)](), o = i[wd(t)]() + 1, s = Math.floor((o - 1) / 3) + 1, l = i[Gb(t)](), u = i["get" + (t ? "UTC" : "") + "Day"](), c = i[_g(t)](), h = (c - 1) % 12 + 1, f = i[Ub(t)](), v = i[Wb(t)](), b = i[Yb(t)](), w = n instanceof qr ? n : F1(n || lF) || zK(), p = w.getModel("time"), d = p.get("month"), m = p.get("monthAbbr"), _ = p.get("dayOfWeek"), y = p.get("dayOfWeekAbbr"); + return (e || "").replace(/{yyyy}/g, a + "").replace(/{yy}/g, Ia(a % 100 + "", 2)).replace(/{Q}/g, s + "").replace(/{MMMM}/g, d[o - 1]).replace(/{MMM}/g, m[o - 1]).replace(/{MM}/g, Ia(o, 2)).replace(/{M}/g, o + "").replace(/{dd}/g, Ia(l, 2)).replace(/{d}/g, l + "").replace(/{eeee}/g, _[u]).replace(/{ee}/g, y[u]).replace(/{e}/g, u + "").replace(/{HH}/g, Ia(c, 2)).replace(/{H}/g, c + "").replace(/{hh}/g, Ia(h + "", 2)).replace(/{h}/g, h + "").replace(/{mm}/g, Ia(f, 2)).replace(/{m}/g, f + "").replace(/{ss}/g, Ia(v, 2)).replace(/{s}/g, v + "").replace(/{SSS}/g, Ia(b, 3)).replace(/{S}/g, b + ""); +} +function FK(r, e, t, n, i) { + var a = null; + if (ut(t)) + a = t; + else if (Tt(t)) + a = t(r.value, e, { + level: r.level + }); + else { + var o = Fe({}, Mp); + if (r.level > 0) + for (var s = 0; s < $S.length; ++s) + o[$S[s]] = "{primary|" + o[$S[s]] + "}"; + var l = t ? t.inherit === !1 ? t : Mt(t, o) : o, u = cF(r.value, i); + if (l[u]) + a = l[u]; + else if (l.inherit) { + for (var c = uF.indexOf(u), s = c - 1; s >= 0; --s) + if (l[u]) { + a = l[u]; + break; + } + a = a || o.none; + } + if (We(a)) { + var h = r.level == null ? 0 : r.level >= 0 ? r.level : a.length + r.level; + h = Math.min(h, a.length - 1), a = a[h]; + } + } + return nm(new Date(r.value), a, i, n); +} +function cF(r, e) { + var t = So(r), n = t[wd(e)]() + 1, i = t[Gb(e)](), a = t[_g(e)](), o = t[Ub(e)](), s = t[Wb(e)](), l = t[Yb(e)](), u = l === 0, c = u && s === 0, h = c && o === 0, f = h && a === 0, v = f && i === 1, b = v && n === 1; + return b ? "year" : v ? "month" : f ? "day" : h ? "hour" : c ? "minute" : u ? "second" : "millisecond"; +} +function nO(r, e, t) { + var n = Pr(r) ? So(r) : r; + switch (e = e || cF(r, t), e) { + case "year": + return n[sA(t)](); + case "half-year": + return n[wd(t)]() >= 6 ? 1 : 0; + case "quarter": + return Math.floor((n[wd(t)]() + 1) / 4); + case "month": + return n[wd(t)](); + case "day": + return n[Gb(t)](); + case "half-day": + return n[_g(t)]() / 24; + case "hour": + return n[_g(t)](); + case "minute": + return n[Ub(t)](); + case "second": + return n[Wb(t)](); + case "millisecond": + return n[Yb(t)](); + } +} +function sA(r) { + return r ? "getUTCFullYear" : "getFullYear"; +} +function wd(r) { + return r ? "getUTCMonth" : "getMonth"; +} +function Gb(r) { + return r ? "getUTCDate" : "getDate"; +} +function _g(r) { + return r ? "getUTCHours" : "getHours"; +} +function Ub(r) { + return r ? "getUTCMinutes" : "getMinutes"; +} +function Wb(r) { + return r ? "getUTCSeconds" : "getSeconds"; +} +function Yb(r) { + return r ? "getUTCMilliseconds" : "getMilliseconds"; +} +function $K(r) { + return r ? "setUTCFullYear" : "setFullYear"; +} +function hF(r) { + return r ? "setUTCMonth" : "setMonth"; +} +function fF(r) { + return r ? "setUTCDate" : "setDate"; +} +function dF(r) { + return r ? "setUTCHours" : "setHours"; +} +function vF(r) { + return r ? "setUTCMinutes" : "setMinutes"; +} +function pF(r) { + return r ? "setUTCSeconds" : "setSeconds"; +} +function gF(r) { + return r ? "setUTCMilliseconds" : "setMilliseconds"; +} +function HK(r, e, t, n, i, a, o, s) { + var l = new kr({ + style: { + text: r, + font: e, + align: t, + verticalAlign: n, + padding: i, + rich: a, + overflow: o ? "truncate" : null, + lineHeight: s + } + }); + return l.getBoundingRect(); +} +function lA(r) { + if (!$I(r)) + return ut(r) ? r : "-"; + var e = (r + "").split("."); + return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, "$1,") + (e.length > 1 ? "." + e[1] : ""); +} +function uA(r, e) { + return r = (r || "").toLowerCase().replace(/-(.)/g, function(t, n) { + return n.toUpperCase(); + }), e && r && (r = r.charAt(0).toUpperCase() + r.slice(1)), r; +} +var of = Tb; +function $1(r, e, t) { + var n = "{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}"; + function i(c) { + return c && Qo(c) ? c : "-"; + } + function a(c) { + return !!(c != null && !isNaN(c) && isFinite(c)); + } + var o = e === "time", s = r instanceof Date; + if (o || s) { + var l = o ? So(r) : r; + if (isNaN(+l)) { + if (s) + return "-"; + } else + return nm(l, n, t); + } + if (e === "ordinal") + return s_(r) ? i(r) : Pr(r) && a(r) ? r + "" : "-"; + var u = Il(r); + return a(u) ? lA(u) : s_(r) ? i(r) : typeof r == "boolean" ? r + "" : "-"; +} +var iO = ["a", "b", "c", "d", "e", "f", "g"], HS = function(r, e) { + return "{" + r + (e == null ? "" : e) + "}"; +}; +function cA(r, e, t) { + We(e) || (e = [e]); + var n = e.length; + if (!n) + return ""; + for (var i = e[0].$vars || [], a = 0; a < i.length; a++) { + var o = iO[a]; + r = r.replace(HS(o), HS(o, 0)); + } + for (var s = 0; s < n; s++) + for (var l = 0; l < i.length; l++) { + var u = e[s][i[l]]; + r = r.replace(HS(iO[l], s), t ? Ea(u) : u); + } + return r; +} +function VK(r, e, t) { + return X(e, function(n, i) { + r = r.replace("{" + i + "}", t ? Ea(n) : n); + }), r; +} +function mF(r, e) { + var t = ut(r) ? { + color: r, + extraCssText: e + } : r || {}, n = t.color, i = t.type; + e = t.extraCssText; + var a = t.renderMode || "html"; + if (!n) + return ""; + if (a === "html") + return i === "subItem" ? '' : ''; + var o = t.markerId || "markerX"; + return { + renderMode: a, + content: "{" + o + "|} ", + style: i === "subItem" ? { + width: 4, + height: 4, + borderRadius: 2, + backgroundColor: n + } : { + width: 10, + height: 10, + borderRadius: 5, + backgroundColor: n + } + }; +} +function GK(r, e, t) { + (r === "week" || r === "month" || r === "quarter" || r === "half-year" || r === "year") && (r = `MM-dd +yyyy`); + var n = So(e), i = t ? "getUTC" : "get", a = n[i + "FullYear"](), o = n[i + "Month"]() + 1, s = n[i + "Date"](), l = n[i + "Hours"](), u = n[i + "Minutes"](), c = n[i + "Seconds"](), h = n[i + "Milliseconds"](); + return r = r.replace("MM", Ia(o, 2)).replace("M", o).replace("yyyy", a).replace("yy", Ia(a % 100 + "", 2)).replace("dd", Ia(s, 2)).replace("d", s).replace("hh", Ia(l, 2)).replace("h", l).replace("mm", Ia(u, 2)).replace("m", u).replace("ss", Ia(c, 2)).replace("s", c).replace("SSS", Ia(h, 3)), r; +} +function UK(r) { + return r && r.charAt(0).toUpperCase() + r.substr(1); +} +function Xh(r, e) { + return e = e || "transparent", ut(r) ? r : kt(r) && r.colorStops && (r.colorStops[0] || {}).color || e; +} +function w_(r, e) { + if (e === "_blank" || e === "blank") { + var t = window.open(); + t.opener = null, t.location.href = r; + } else + window.open(r, e); +} +var H0 = X, yF = ["left", "right", "top", "bottom", "width", "height"], Eh = [["width", "left", "right"], ["height", "top", "bottom"]]; +function hA(r, e, t, n, i) { + var a = 0, o = 0; + n == null && (n = 1 / 0), i == null && (i = 1 / 0); + var s = 0; + e.eachChild(function(l, u) { + var c = l.getBoundingRect(), h = e.childAt(u + 1), f = h && h.getBoundingRect(), v, b; + if (r === "horizontal") { + var w = c.width + (f ? -f.x + c.x : 0); + v = a + w, v > n || l.newline ? (a = 0, v = w, o += s + t, s = c.height) : s = Math.max(s, c.height); + } else { + var p = c.height + (f ? -f.y + c.y : 0); + b = o + p, b > i || l.newline ? (a += s + t, o = 0, b = p, s = c.width) : s = Math.max(s, c.width); + } + l.newline || (l.x = a, l.y = o, l.markRedraw(), r === "horizontal" ? a = v + t : o = b + t); + }); +} +var Nh = hA; +jt(hA, "vertical"); +jt(hA, "horizontal"); +function WK(r, e, t) { + var n = e.width, i = e.height, a = ot(r.left, n), o = ot(r.top, i), s = ot(r.right, n), l = ot(r.bottom, i); + return (isNaN(a) || isNaN(parseFloat(r.left))) && (a = 0), (isNaN(s) || isNaN(parseFloat(r.right))) && (s = n), (isNaN(o) || isNaN(parseFloat(r.top))) && (o = 0), (isNaN(l) || isNaN(parseFloat(r.bottom))) && (l = i), t = of(t || 0), { + width: Math.max(s - a - t[1] - t[3], 0), + height: Math.max(l - o - t[0] - t[2], 0) + }; +} +function yi(r, e, t) { + t = of(t || 0); + var n = e.width, i = e.height, a = ot(r.left, n), o = ot(r.top, i), s = ot(r.right, n), l = ot(r.bottom, i), u = ot(r.width, n), c = ot(r.height, i), h = t[2] + t[0], f = t[1] + t[3], v = r.aspect; + switch (isNaN(u) && (u = n - s - f - a), isNaN(c) && (c = i - l - h - o), v != null && (isNaN(u) && isNaN(c) && (v > n / i ? u = n * 0.8 : c = i * 0.8), isNaN(u) && (u = v * c), isNaN(c) && (c = u / v)), isNaN(a) && (a = n - s - u - f), isNaN(o) && (o = i - l - c - h), r.left || r.right) { + case "center": + a = n / 2 - u / 2 - t[3]; + break; + case "right": + a = n - u - f; + break; + } + switch (r.top || r.bottom) { + case "middle": + case "center": + o = i / 2 - c / 2 - t[0]; + break; + case "bottom": + o = i - c - h; + break; + } + a = a || 0, o = o || 0, isNaN(u) && (u = n - f - a - (s || 0)), isNaN(c) && (c = i - h - o - (l || 0)); + var b = new Wt(a + t[3], o + t[0], u, c); + return b.margin = t, b; +} +function Xb(r, e, t, n, i, a) { + var o = !i || !i.hv || i.hv[0], s = !i || !i.hv || i.hv[1], l = i && i.boundingMode || "all"; + if (a = a || r, a.x = r.x, a.y = r.y, !o && !s) + return !1; + var u; + if (l === "raw") + u = r.type === "group" ? new Wt(0, 0, +e.width || 0, +e.height || 0) : r.getBoundingRect(); + else if (u = r.getBoundingRect(), r.needLocalTransform()) { + var c = r.getLocalTransform(); + u = u.clone(), u.applyTransform(c); + } + var h = yi(Mt({ + width: u.width, + height: u.height + }, e), t, n), f = o ? h.x - u.x : 0, v = s ? h.y - u.y : 0; + return l === "raw" ? (a.x = f, a.y = v) : (a.x += f, a.y += v), a === r && r.markRedraw(), !0; +} +function YK(r, e) { + return r[Eh[e][0]] != null || r[Eh[e][1]] != null && r[Eh[e][2]] != null; +} +function bg(r) { + var e = r.layoutMode || r.constructor.layoutMode; + return kt(e) ? e : e ? { + type: e + } : null; +} +function vc(r, e, t) { + var n = t && t.ignoreSize; + !We(n) && (n = [n, n]); + var i = o(Eh[0], 0), a = o(Eh[1], 1); + u(Eh[0], r, i), u(Eh[1], r, a); + function o(c, h) { + var f = {}, v = 0, b = {}, w = 0, p = 2; + if (H0(c, function(_) { + b[_] = r[_]; + }), H0(c, function(_) { + s(e, _) && (f[_] = b[_] = e[_]), l(f, _) && v++, l(b, _) && w++; + }), n[h]) + return l(e, c[1]) ? b[c[2]] = null : l(e, c[2]) && (b[c[1]] = null), b; + if (w === p || !v) + return b; + if (v >= p) + return f; + for (var d = 0; d < c.length; d++) { + var m = c[d]; + if (!s(f, m) && s(r, m)) { + f[m] = r[m]; + break; + } + } + return f; + } + function s(c, h) { + return c.hasOwnProperty(h); + } + function l(c, h) { + return c[h] != null && c[h] !== "auto"; + } + function u(c, h, f) { + H0(c, function(v) { + h[v] = f[v]; + }); + } +} +function rv(r) { + return _F({}, r); +} +function _F(r, e) { + return e && r && H0(yF, function(t) { + e.hasOwnProperty(t) && (r[t] = e[t]); + }), r; +} +var XK = Rr(), nv = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this, t, n, i) || this; + return a.uid = tv("ec_cpt_model"), a; + } + return e.prototype.init = function(t, n, i) { + this.mergeDefaultAndTheme(t, i); + }, e.prototype.mergeDefaultAndTheme = function(t, n) { + var i = bg(this), a = i ? rv(t) : {}, o = n.getTheme(); + Ut(t, o.get(this.mainType)), Ut(t, this.getDefaultOption()), i && vc(t, a, i); + }, e.prototype.mergeOption = function(t, n) { + Ut(this.option, t, !0); + var i = bg(this); + i && vc(this.option, t, i); + }, e.prototype.optionUpdated = function(t, n) { + }, e.prototype.getDefaultOption = function() { + var t = this.constructor; + if (!kZ(t)) + return t.defaultOption; + var n = XK(this); + if (!n.defaultOption) { + for (var i = [], a = t; a; ) { + var o = a.prototype.defaultOption; + o && i.push(o), a = a.superClass; + } + for (var s = {}, l = i.length - 1; l >= 0; l--) + s = Ut(s, i[l], !0); + n.defaultOption = s; + } + return n.defaultOption; + }, e.prototype.getReferringComponents = function(t, n) { + var i = t + "Index", a = t + "Id"; + return Jg(this.ecModel, t, { + index: this.get(i, !0), + id: this.get(a, !0) + }, n); + }, e.prototype.getBoxLayoutParams = function() { + var t = this; + return { + left: t.get("left"), + top: t.get("top"), + right: t.get("right"), + bottom: t.get("bottom"), + width: t.get("width"), + height: t.get("height") + }; + }, e.prototype.getZLevelKey = function() { + return ""; + }, e.prototype.setZLevel = function(t) { + this.option.zlevel = t; + }, e.protoInitialize = function() { + var t = e.prototype; + t.type = "component", t.id = "", t.name = "", t.mainType = "", t.subType = "", t.componentIndex = 0; + }(), e; + }(qr) +); +s5(nv, qr); +kb(nv); +OK(nv); +LK(nv, ZK); +function ZK(r) { + var e = []; + return X(nv.getClassesByMainType(r), function(t) { + e = e.concat(t.dependencies || t.prototype.dependencies || []); + }), e = Ke(e, function(t) { + return gl(t).main; + }), r !== "dataset" && ir(e, "dataset") <= 0 && e.unshift("dataset"), e; +} +const xr = nv; +var bF = ""; +typeof navigator != "undefined" && (bF = navigator.platform || ""); +var Gf = "rgba(0, 0, 0, 0.2)"; +const JK = { + darkMode: "auto", + // backgroundColor: 'rgba(0,0,0,0)', + colorBy: "series", + color: ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272", "#fc8452", "#9a60b4", "#ea7ccc"], + gradientColor: ["#f6efa6", "#d88273", "#bf444c"], + aria: { + decal: { + decals: [{ + color: Gf, + dashArrayX: [1, 0], + dashArrayY: [2, 5], + symbolSize: 1, + rotation: Math.PI / 6 + }, { + color: Gf, + symbol: "circle", + dashArrayX: [[8, 8], [0, 8, 8, 0]], + dashArrayY: [6, 0], + symbolSize: 0.8 + }, { + color: Gf, + dashArrayX: [1, 0], + dashArrayY: [4, 3], + rotation: -Math.PI / 4 + }, { + color: Gf, + dashArrayX: [[6, 6], [0, 6, 6, 0]], + dashArrayY: [6, 0] + }, { + color: Gf, + dashArrayX: [[1, 0], [1, 6]], + dashArrayY: [1, 0, 6, 0], + rotation: Math.PI / 4 + }, { + color: Gf, + symbol: "triangle", + dashArrayX: [[9, 9], [0, 9, 9, 0]], + dashArrayY: [7, 2], + symbolSize: 0.75 + }] + } + }, + // If xAxis and yAxis declared, grid is created by default. + // grid: {}, + textStyle: { + // color: '#000', + // decoration: 'none', + // PENDING + fontFamily: bF.match(/^Win/) ? "Microsoft YaHei" : "sans-serif", + // fontFamily: 'Arial, Verdana, sans-serif', + fontSize: 12, + fontStyle: "normal", + fontWeight: "normal" + }, + // http://blogs.adobe.com/webplatform/2014/02/24/using-blend-modes-in-html-canvas/ + // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation + // Default is source-over + blendMode: null, + stateAnimation: { + duration: 300, + easing: "cubicOut" + }, + animation: "auto", + animationDuration: 1e3, + animationDurationUpdate: 500, + animationEasing: "cubicInOut", + animationEasingUpdate: "cubicInOut", + animationThreshold: 2e3, + // Configuration for progressive/incremental rendering + progressiveThreshold: 3e3, + progressive: 400, + // Threshold of if use single hover layer to optimize. + // It is recommended that `hoverLayerThreshold` is equivalent to or less than + // `progressiveThreshold`, otherwise hover will cause restart of progressive, + // which is unexpected. + // see example . + hoverLayerThreshold: 3e3, + // See: module:echarts/scale/Time + useUTC: !1 +}; +var xF = xt(["tooltip", "label", "itemName", "itemId", "itemGroupId", "seriesName"]), is = "original", ga = "arrayRows", as = "objectRows", Ml = "keyedColumns", sc = "typedArray", SF = "unknown", Sl = "column", iv = "row", Vi = { + Must: 1, + Might: 2, + Not: 3 + // Other cases +}, wF = Rr(); +function KK(r) { + wF(r).datasetMap = xt(); +} +function CF(r, e, t) { + var n = {}, i = dA(e); + if (!i || !r) + return n; + var a = [], o = [], s = e.ecModel, l = wF(s).datasetMap, u = i.uid + "_" + t.seriesLayoutBy, c, h; + r = r.slice(), X(r, function(w, p) { + var d = kt(w) ? w : r[p] = { + name: w + }; + d.type === "ordinal" && c == null && (c = p, h = b(d)), n[d.name] = []; + }); + var f = l.get(u) || l.set(u, { + categoryWayDim: h, + valueWayDim: 0 + }); + X(r, function(w, p) { + var d = w.name, m = b(w); + if (c == null) { + var _ = f.valueWayDim; + v(n[d], _, m), v(o, _, m), f.valueWayDim += m; + } else if (c === p) + v(n[d], 0, m), v(a, 0, m); + else { + var _ = f.categoryWayDim; + v(n[d], _, m), v(o, _, m), f.categoryWayDim += m; + } + }); + function v(w, p, d) { + for (var m = 0; m < d; m++) + w.push(p + m); + } + function b(w) { + var p = w.dimsDef; + return p ? p.length : 1; + } + return a.length && (n.itemName = a), o.length && (n.seriesName = o), n; +} +function fA(r, e, t) { + var n = {}, i = dA(r); + if (!i) + return n; + var a = e.sourceFormat, o = e.dimensionsDefine, s; + (a === as || a === Ml) && X(o, function(c, h) { + (kt(c) ? c.name : c) === "name" && (s = h); + }); + var l = function() { + for (var c = {}, h = {}, f = [], v = 0, b = Math.min(5, t); v < b; v++) { + var w = IF(e.data, a, e.seriesLayoutBy, o, e.startIndex, v); + f.push(w); + var p = w === Vi.Not; + if (p && c.v == null && v !== s && (c.v = v), (c.n == null || c.n === c.v || !p && f[c.n] === Vi.Not) && (c.n = v), d(c) && f[c.n] !== Vi.Not) + return c; + p || (w === Vi.Might && h.v == null && v !== s && (h.v = v), (h.n == null || h.n === h.v) && (h.n = v)); + } + function d(m) { + return m.v != null && m.n != null; + } + return d(c) ? c : d(h) ? h : null; + }(); + if (l) { + n.value = [l.v]; + var u = s != null ? s : l.n; + n.itemName = [u], n.seriesName = [u]; + } + return n; +} +function dA(r) { + var e = r.get("data", !0); + if (!e) + return Jg(r.ecModel, "dataset", { + index: r.get("datasetIndex", !0), + id: r.get("datasetId", !0) + }, mi).models[0]; +} +function QK(r) { + return !r.get("transform", !0) && !r.get("fromTransformResult", !0) ? [] : Jg(r.ecModel, "dataset", { + index: r.get("fromDatasetIndex", !0), + id: r.get("fromDatasetId", !0) + }, mi).models; +} +function TF(r, e) { + return IF(r.data, r.sourceFormat, r.seriesLayoutBy, r.dimensionsDefine, r.startIndex, e); +} +function IF(r, e, t, n, i, a) { + var o, s = 5; + if (no(r)) + return Vi.Not; + var l, u; + if (n) { + var c = n[a]; + kt(c) ? (l = c.name, u = c.type) : ut(c) && (l = c); + } + if (u != null) + return u === "ordinal" ? Vi.Must : Vi.Not; + if (e === ga) { + var h = r; + if (t === iv) { + for (var f = h[a], v = 0; v < (f || []).length && v < s; v++) + if ((o = y(f[i + v])) != null) + return o; + } else + for (var v = 0; v < h.length && v < s; v++) { + var b = h[i + v]; + if (b && (o = y(b[a])) != null) + return o; + } + } else if (e === as) { + var w = r; + if (!l) + return Vi.Not; + for (var v = 0; v < w.length && v < s; v++) { + var p = w[v]; + if (p && (o = y(p[l])) != null) + return o; + } + } else if (e === Ml) { + var d = r; + if (!l) + return Vi.Not; + var f = d[l]; + if (!f || no(f)) + return Vi.Not; + for (var v = 0; v < f.length && v < s; v++) + if ((o = y(f[v])) != null) + return o; + } else if (e === is) + for (var m = r, v = 0; v < m.length && v < s; v++) { + var p = m[v], _ = Xd(p); + if (!We(_)) + return Vi.Not; + if ((o = y(_[a])) != null) + return o; + } + function y(x) { + var g = ut(x); + if (x != null && isFinite(x) && x !== "") + return g ? Vi.Might : Vi.Not; + if (g && x !== "-") + return Vi.Must; + } + return Vi.Not; +} +var H1 = xt(); +function qK(r, e) { + pa(H1.get(r) == null && e), H1.set(r, e); +} +function eQ(r, e, t) { + var n = H1.get(e); + if (!n) + return t; + var i = n(r); + return i ? t.concat(i) : t; +} +var aO = Rr(), tQ = Rr(), vA = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getColorFromPalette = function(e, t, n) { + var i = ln(this.get("color", !0)), a = this.get("colorLayer", !0); + return AF(this, aO, i, a, e, t, n); + }, r.prototype.clearColorPalette = function() { + nQ(this, aO); + }, r; + }() +); +function V1(r, e, t, n) { + var i = ln(r.get(["aria", "decal", "decals"])); + return AF(r, tQ, i, null, e, t, n); +} +function rQ(r, e) { + for (var t = r.length, n = 0; n < t; n++) + if (r[n].length > e) + return r[n]; + return r[t - 1]; +} +function AF(r, e, t, n, i, a, o) { + a = a || r; + var s = e(a), l = s.paletteIdx || 0, u = s.paletteNameMap = s.paletteNameMap || {}; + if (u.hasOwnProperty(i)) + return u[i]; + var c = o == null || !n ? t : rQ(n, o); + if (c = c || t, !(!c || !c.length)) { + var h = c[l]; + return i && (u[i] = h), s.paletteIdx = (l + 1) % c.length, h; + } +} +function nQ(r, e) { + e(r).paletteIdx = 0, e(r).paletteNameMap = {}; +} +var zy, ep, oO, sO = "\0_ec_inner", iQ = 1, EF = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.init = function(t, n, i, a, o, s) { + a = a || {}, this.option = null, this._theme = new qr(a), this._locale = new qr(o), this._optionManager = s; + }, e.prototype.setOption = function(t, n, i) { + var a = cO(n); + this._optionManager.setOption(t, i, a), this._resetOption(null, a); + }, e.prototype.resetOption = function(t, n) { + return this._resetOption(t, cO(n)); + }, e.prototype._resetOption = function(t, n) { + var i = !1, a = this._optionManager; + if (!t || t === "recreate") { + var o = a.mountOption(t === "recreate"); + !this.option || t === "recreate" ? oO(this, o) : (this.restoreData(), this._mergeOption(o, n)), i = !0; + } + if ((t === "timeline" || t === "media") && this.restoreData(), !t || t === "recreate" || t === "timeline") { + var s = a.getTimelineOption(this); + s && (i = !0, this._mergeOption(s, n)); + } + if (!t || t === "recreate" || t === "media") { + var l = a.getMediaOption(this); + l.length && X(l, function(u) { + i = !0, this._mergeOption(u, n); + }, this); + } + return i; + }, e.prototype.mergeOption = function(t) { + this._mergeOption(t, null); + }, e.prototype._mergeOption = function(t, n) { + var i = this.option, a = this._componentsMap, o = this._componentsCount, s = [], l = xt(), u = n && n.replaceMergeMainTypeMap; + KK(this), X(t, function(h, f) { + h != null && (xr.hasClass(f) ? f && (s.push(f), l.set(f, !0)) : i[f] = i[f] == null ? Ot(h) : Ut(i[f], h, !0)); + }), u && u.each(function(h, f) { + xr.hasClass(f) && !l.get(f) && (s.push(f), l.set(f, !0)); + }), xr.topologicalTravel(s, xr.getAllClassMainTypes(), c, this); + function c(h) { + var f = eQ(this, h, ln(t[h])), v = a.get(h), b = ( + // `!oldCmptList` means init. See the comment in `mappingToExists` + v ? u && u.get(h) ? "replaceMerge" : "normalMerge" : "replaceAll" + ), w = r5(v, f, b); + SZ(w, h, xr), i[h] = null, a.set(h, null), o.set(h, 0); + var p = [], d = [], m = 0, _; + X(w, function(y, x) { + var g = y.existing, S = y.newOption; + if (!S) + g && (g.mergeOption({}, this), g.optionUpdated({}, !1)); + else { + var T = h === "series", C = xr.getClass( + h, + y.keyInfo.subType, + !T + // Give a more detailed warn later if series don't exists + ); + if (!C) + return; + if (h === "tooltip") { + if (_) + return; + _ = !0; + } + if (g && g.constructor === C) + g.name = y.keyInfo.name, g.mergeOption(S, this), g.optionUpdated(S, !1); + else { + var E = Fe({ + componentIndex: x + }, y.keyInfo); + g = new C(S, this, this, E), Fe(g, E), y.brandNew && (g.__requireNewView = !0), g.init(S, this, this), g.optionUpdated(null, !0); + } + } + g ? (p.push(g.option), d.push(g), m++) : (p.push(void 0), d.push(void 0)); + }, this), i[h] = p, a.set(h, d), o.set(h, m), h === "series" && zy(this); + } + this._seriesIndices || zy(this); + }, e.prototype.getOption = function() { + var t = Ot(this.option); + return X(t, function(n, i) { + if (xr.hasClass(i)) { + for (var a = ln(n), o = a.length, s = !1, l = o - 1; l >= 0; l--) + a[l] && !dg(a[l]) ? s = !0 : (a[l] = null, !s && o--); + a.length = o, t[i] = a; + } + }), delete t[sO], t; + }, e.prototype.getTheme = function() { + return this._theme; + }, e.prototype.getLocaleModel = function() { + return this._locale; + }, e.prototype.setUpdatePayload = function(t) { + this._payload = t; + }, e.prototype.getUpdatePayload = function() { + return this._payload; + }, e.prototype.getComponent = function(t, n) { + var i = this._componentsMap.get(t); + if (i) { + var a = i[n || 0]; + if (a) + return a; + if (n == null) { + for (var o = 0; o < i.length; o++) + if (i[o]) + return i[o]; + } + } + }, e.prototype.queryComponents = function(t) { + var n = t.mainType; + if (!n) + return []; + var i = t.index, a = t.id, o = t.name, s = this._componentsMap.get(n); + if (!s || !s.length) + return []; + var l; + return i != null ? (l = [], X(ln(i), function(u) { + s[u] && l.push(s[u]); + })) : a != null ? l = lO("id", a, s) : o != null ? l = lO("name", o, s) : l = Jr(s, function(u) { + return !!u; + }), uO(l, t); + }, e.prototype.findComponents = function(t) { + var n = t.query, i = t.mainType, a = s(n), o = a ? this.queryComponents(a) : Jr(this._componentsMap.get(i), function(u) { + return !!u; + }); + return l(uO(o, t)); + function s(u) { + var c = i + "Index", h = i + "Id", f = i + "Name"; + return u && (u[c] != null || u[h] != null || u[f] != null) ? { + mainType: i, + // subType will be filtered finally. + index: u[c], + id: u[h], + name: u[f] + } : null; + } + function l(u) { + return t.filter ? Jr(u, t.filter) : u; + } + }, e.prototype.eachComponent = function(t, n, i) { + var a = this._componentsMap; + if (Tt(t)) { + var o = n, s = t; + a.each(function(h, f) { + for (var v = 0; h && v < h.length; v++) { + var b = h[v]; + b && s.call(o, f, b, b.componentIndex); + } + }); + } else + for (var l = ut(t) ? a.get(t) : kt(t) ? this.findComponents(t) : null, u = 0; l && u < l.length; u++) { + var c = l[u]; + c && n.call(i, c, c.componentIndex); + } + }, e.prototype.getSeriesByName = function(t) { + var n = Si(t, null); + return Jr(this._componentsMap.get("series"), function(i) { + return !!i && n != null && i.name === n; + }); + }, e.prototype.getSeriesByIndex = function(t) { + return this._componentsMap.get("series")[t]; + }, e.prototype.getSeriesByType = function(t) { + return Jr(this._componentsMap.get("series"), function(n) { + return !!n && n.subType === t; + }); + }, e.prototype.getSeries = function() { + return Jr(this._componentsMap.get("series"), function(t) { + return !!t; + }); + }, e.prototype.getSeriesCount = function() { + return this._componentsCount.get("series"); + }, e.prototype.eachSeries = function(t, n) { + ep(this), X(this._seriesIndices, function(i) { + var a = this._componentsMap.get("series")[i]; + t.call(n, a, i); + }, this); + }, e.prototype.eachRawSeries = function(t, n) { + X(this._componentsMap.get("series"), function(i) { + i && t.call(n, i, i.componentIndex); + }); + }, e.prototype.eachSeriesByType = function(t, n, i) { + ep(this), X(this._seriesIndices, function(a) { + var o = this._componentsMap.get("series")[a]; + o.subType === t && n.call(i, o, a); + }, this); + }, e.prototype.eachRawSeriesByType = function(t, n, i) { + return X(this.getSeriesByType(t), n, i); + }, e.prototype.isSeriesFiltered = function(t) { + return ep(this), this._seriesIndicesMap.get(t.componentIndex) == null; + }, e.prototype.getCurrentSeriesIndices = function() { + return (this._seriesIndices || []).slice(); + }, e.prototype.filterSeries = function(t, n) { + ep(this); + var i = []; + X(this._seriesIndices, function(a) { + var o = this._componentsMap.get("series")[a]; + t.call(n, o, a) && i.push(a); + }, this), this._seriesIndices = i, this._seriesIndicesMap = xt(i); + }, e.prototype.restoreData = function(t) { + zy(this); + var n = this._componentsMap, i = []; + n.each(function(a, o) { + xr.hasClass(o) && i.push(o); + }), xr.topologicalTravel(i, xr.getAllClassMainTypes(), function(a) { + X(n.get(a), function(o) { + o && (a !== "series" || !aQ(o, t)) && o.restoreData(); + }); + }); + }, e.internalField = function() { + zy = function(t) { + var n = t._seriesIndices = []; + X(t._componentsMap.get("series"), function(i) { + i && n.push(i.componentIndex); + }), t._seriesIndicesMap = xt(n); + }, ep = function(t) { + }, oO = function(t, n) { + t.option = {}, t.option[sO] = iQ, t._componentsMap = xt({ + series: [] + }), t._componentsCount = xt(); + var i = n.aria; + kt(i) && i.enabled == null && (i.enabled = !0), oQ(n, t._theme.option), Ut(n, JK, !1), t._mergeOption(n, null); + }; + }(), e; + }(qr) +); +function aQ(r, e) { + if (e) { + var t = e.seriesIndex, n = e.seriesId, i = e.seriesName; + return t != null && r.componentIndex !== t || n != null && r.id !== n || i != null && r.name !== i; + } +} +function oQ(r, e) { + var t = r.color && !r.colorLayer; + X(e, function(n, i) { + i === "colorLayer" && t || xr.hasClass(i) || (typeof n == "object" ? r[i] = r[i] ? Ut(r[i], n, !1) : Ot(n) : r[i] == null && (r[i] = n)); + }); +} +function lO(r, e, t) { + if (We(e)) { + var n = xt(); + return X(e, function(a) { + if (a != null) { + var o = Si(a, null); + o != null && n.set(a, !0); + } + }), Jr(t, function(a) { + return a && n.get(a[r]); + }); + } else { + var i = Si(e, null); + return Jr(t, function(a) { + return a && i != null && a[r] === i; + }); + } +} +function uO(r, e) { + return e.hasOwnProperty("subType") ? Jr(r, function(t) { + return t && t.subType === e.subType; + }) : r; +} +function cO(r) { + var e = xt(); + return r && X(ln(r.replaceMerge), function(t) { + e.set(t, !0); + }), { + replaceMergeMainTypeMap: e + }; +} +qn(EF, vA); +const MF = EF; +var sQ = [ + "getDom", + "getZr", + "getWidth", + "getHeight", + "getDevicePixelRatio", + "dispatchAction", + "isSSR", + "isDisposed", + "on", + "off", + "getDataURL", + "getConnectedDataURL", + // 'getModel', + "getOption", + // 'getViewOfComponentModel', + // 'getViewOfSeriesModel', + "getId", + "updateLabelLayout" +], lQ = ( + /** @class */ + function() { + function r(e) { + X(sQ, function(t) { + this[t] = ft(e[t], e); + }, this); + } + return r; + }() +); +const DF = lQ; +var VS = {}, uQ = ( + /** @class */ + function() { + function r() { + this._coordinateSystems = []; + } + return r.prototype.create = function(e, t) { + var n = []; + X(VS, function(i, a) { + var o = i.create(e, t); + n = n.concat(o || []); + }), this._coordinateSystems = n; + }, r.prototype.update = function(e, t) { + X(this._coordinateSystems, function(n) { + n.update && n.update(e, t); + }); + }, r.prototype.getCoordinateSystems = function() { + return this._coordinateSystems.slice(); + }, r.register = function(e, t) { + VS[e] = t; + }, r.get = function(e) { + return VS[e]; + }, r; + }() +); +const av = uQ; +var cQ = /^(min|max)?(.+)$/, hQ = ( + /** @class */ + function() { + function r(e) { + this._timelineOptions = [], this._mediaList = [], this._currentMediaIndices = [], this._api = e; + } + return r.prototype.setOption = function(e, t, n) { + e && (X(ln(e.series), function(o) { + o && o.data && no(o.data) && ig(o.data); + }), X(ln(e.dataset), function(o) { + o && o.source && no(o.source) && ig(o.source); + })), e = Ot(e); + var i = this._optionBackup, a = fQ(e, t, !i); + this._newBaseOption = a.baseOption, i ? (a.timelineOptions.length && (i.timelineOptions = a.timelineOptions), a.mediaList.length && (i.mediaList = a.mediaList), a.mediaDefault && (i.mediaDefault = a.mediaDefault)) : this._optionBackup = a; + }, r.prototype.mountOption = function(e) { + var t = this._optionBackup; + return this._timelineOptions = t.timelineOptions, this._mediaList = t.mediaList, this._mediaDefault = t.mediaDefault, this._currentMediaIndices = [], Ot(e ? t.baseOption : this._newBaseOption); + }, r.prototype.getTimelineOption = function(e) { + var t, n = this._timelineOptions; + if (n.length) { + var i = e.getComponent("timeline"); + i && (t = Ot( + // FIXME:TS as TimelineModel or quivlant interface + n[i.getCurrentIndex()] + )); + } + return t; + }, r.prototype.getMediaOption = function(e) { + var t = this._api.getWidth(), n = this._api.getHeight(), i = this._mediaList, a = this._mediaDefault, o = [], s = []; + if (!i.length && !a) + return s; + for (var l = 0, u = i.length; l < u; l++) + dQ(i[l].query, t, n) && o.push(l); + return !o.length && a && (o = [-1]), o.length && !pQ(o, this._currentMediaIndices) && (s = Ke(o, function(c) { + return Ot(c === -1 ? a.option : i[c].option); + })), this._currentMediaIndices = o, s; + }, r; + }() +); +function fQ(r, e, t) { + var n = [], i, a, o = r.baseOption, s = r.timeline, l = r.options, u = r.media, c = !!r.media, h = !!(l || s || o && o.timeline); + o ? (a = o, a.timeline || (a.timeline = s)) : ((h || c) && (r.options = r.media = null), a = r), c && We(u) && X(u, function(v) { + v && v.option && (v.query ? n.push(v) : i || (i = v)); + }), f(a), X(l, function(v) { + return f(v); + }), X(n, function(v) { + return f(v.option); + }); + function f(v) { + X(e, function(b) { + b(v, t); + }); + } + return { + baseOption: a, + timelineOptions: l || [], + mediaDefault: i, + mediaList: n + }; +} +function dQ(r, e, t) { + var n = { + width: e, + height: t, + aspectratio: e / t + // lower case for convenience. + }, i = !0; + return X(r, function(a, o) { + var s = o.match(cQ); + if (!(!s || !s[1] || !s[2])) { + var l = s[1], u = s[2].toLowerCase(); + vQ(n[u], a, l) || (i = !1); + } + }), i; +} +function vQ(r, e, t) { + return t === "min" ? r >= e : t === "max" ? r <= e : r === e; +} +function pQ(r, e) { + return r.join(",") === e.join(","); +} +const gQ = hQ; +var Cs = X, xg = kt, hO = ["areaStyle", "lineStyle", "nodeStyle", "linkStyle", "chordStyle", "label", "labelLine"]; +function GS(r) { + var e = r && r.itemStyle; + if (e) + for (var t = 0, n = hO.length; t < n; t++) { + var i = hO[t], a = e.normal, o = e.emphasis; + a && a[i] && (r[i] = r[i] || {}, r[i].normal ? Ut(r[i].normal, a[i]) : r[i].normal = a[i], a[i] = null), o && o[i] && (r[i] = r[i] || {}, r[i].emphasis ? Ut(r[i].emphasis, o[i]) : r[i].emphasis = o[i], o[i] = null); + } +} +function fa(r, e, t) { + if (r && r[e] && (r[e].normal || r[e].emphasis)) { + var n = r[e].normal, i = r[e].emphasis; + n && (t ? (r[e].normal = r[e].emphasis = null, Mt(r[e], n)) : r[e] = n), i && (r.emphasis = r.emphasis || {}, r.emphasis[e] = i, i.focus && (r.emphasis.focus = i.focus), i.blurScope && (r.emphasis.blurScope = i.blurScope)); + } +} +function Dp(r) { + fa(r, "itemStyle"), fa(r, "lineStyle"), fa(r, "areaStyle"), fa(r, "label"), fa(r, "labelLine"), fa(r, "upperLabel"), fa(r, "edgeLabel"); +} +function gi(r, e) { + var t = xg(r) && r[e], n = xg(t) && t.textStyle; + if (n) + for (var i = 0, a = pk.length; i < a; i++) { + var o = pk[i]; + n.hasOwnProperty(o) && (t[o] = n[o]); + } +} +function Uo(r) { + r && (Dp(r), gi(r, "label"), r.emphasis && gi(r.emphasis, "label")); +} +function mQ(r) { + if (xg(r)) { + GS(r), Dp(r), gi(r, "label"), gi(r, "upperLabel"), gi(r, "edgeLabel"), r.emphasis && (gi(r.emphasis, "label"), gi(r.emphasis, "upperLabel"), gi(r.emphasis, "edgeLabel")); + var e = r.markPoint; + e && (GS(e), Uo(e)); + var t = r.markLine; + t && (GS(t), Uo(t)); + var n = r.markArea; + n && Uo(n); + var i = r.data; + if (r.type === "graph") { + i = i || r.nodes; + var a = r.links || r.edges; + if (a && !no(a)) + for (var o = 0; o < a.length; o++) + Uo(a[o]); + X(r.categories, function(u) { + Dp(u); + }); + } + if (i && !no(i)) + for (var o = 0; o < i.length; o++) + Uo(i[o]); + if (e = r.markPoint, e && e.data) + for (var s = e.data, o = 0; o < s.length; o++) + Uo(s[o]); + if (t = r.markLine, t && t.data) + for (var l = t.data, o = 0; o < l.length; o++) + We(l[o]) ? (Uo(l[o][0]), Uo(l[o][1])) : Uo(l[o]); + r.type === "gauge" ? (gi(r, "axisLabel"), gi(r, "title"), gi(r, "detail")) : r.type === "treemap" ? (fa(r.breadcrumb, "itemStyle"), X(r.levels, function(u) { + Dp(u); + })) : r.type === "tree" && Dp(r.leaves); + } +} +function Fl(r) { + return We(r) ? r : r ? [r] : []; +} +function fO(r) { + return (We(r) ? r[0] : r) || {}; +} +function yQ(r, e) { + Cs(Fl(r.series), function(n) { + xg(n) && mQ(n); + }); + var t = ["xAxis", "yAxis", "radiusAxis", "angleAxis", "singleAxis", "parallelAxis", "radar"]; + e && t.push("valueAxis", "categoryAxis", "logAxis", "timeAxis"), Cs(t, function(n) { + Cs(Fl(r[n]), function(i) { + i && (gi(i, "axisLabel"), gi(i.axisPointer, "label")); + }); + }), Cs(Fl(r.parallel), function(n) { + var i = n && n.parallelAxisDefault; + gi(i, "axisLabel"), gi(i && i.axisPointer, "label"); + }), Cs(Fl(r.calendar), function(n) { + fa(n, "itemStyle"), gi(n, "dayLabel"), gi(n, "monthLabel"), gi(n, "yearLabel"); + }), Cs(Fl(r.radar), function(n) { + gi(n, "name"), n.name && n.axisName == null && (n.axisName = n.name, delete n.name), n.nameGap != null && n.axisNameGap == null && (n.axisNameGap = n.nameGap, delete n.nameGap); + }), Cs(Fl(r.geo), function(n) { + xg(n) && (Uo(n), Cs(Fl(n.regions), function(i) { + Uo(i); + })); + }), Cs(Fl(r.timeline), function(n) { + Uo(n), fa(n, "label"), fa(n, "itemStyle"), fa(n, "controlStyle", !0); + var i = n.data; + We(i) && X(i, function(a) { + kt(a) && (fa(a, "label"), fa(a, "itemStyle")); + }); + }), Cs(Fl(r.toolbox), function(n) { + fa(n, "iconStyle"), Cs(n.feature, function(i) { + fa(i, "iconStyle"); + }); + }), gi(fO(r.axisPointer), "label"), gi(fO(r.tooltip).axisPointer, "label"); +} +function _Q(r, e) { + for (var t = e.split(","), n = r, i = 0; i < t.length && (n = n && n[t[i]], n != null); i++) + ; + return n; +} +function bQ(r, e, t, n) { + for (var i = e.split(","), a = r, o, s = 0; s < i.length - 1; s++) + o = i[s], a[o] == null && (a[o] = {}), a = a[o]; + (n || a[i[s]] == null) && (a[i[s]] = t); +} +function dO(r) { + r && X(xQ, function(e) { + e[0] in r && !(e[1] in r) && (r[e[1]] = r[e[0]]); + }); +} +var xQ = [["x", "left"], ["y", "top"], ["x2", "right"], ["y2", "bottom"]], SQ = ["grid", "geo", "parallel", "legend", "toolbox", "title", "visualMap", "dataZoom", "timeline"], US = [["borderRadius", "barBorderRadius"], ["borderColor", "barBorderColor"], ["borderWidth", "barBorderWidth"]]; +function tp(r) { + var e = r && r.itemStyle; + if (e) + for (var t = 0; t < US.length; t++) { + var n = US[t][1], i = US[t][0]; + e[n] != null && (e[i] = e[n]); + } +} +function vO(r) { + r && r.alignTo === "edge" && r.margin != null && r.edgeDistance == null && (r.edgeDistance = r.margin); +} +function pO(r) { + r && r.downplay && !r.blur && (r.blur = r.downplay); +} +function wQ(r) { + r && r.focusNodeAdjacency != null && (r.emphasis = r.emphasis || {}, r.emphasis.focus == null && (r.emphasis.focus = "adjacency")); +} +function kF(r, e) { + if (r) + for (var t = 0; t < r.length; t++) + e(r[t]), r[t] && kF(r[t].children, e); +} +function OF(r, e) { + yQ(r, e), r.series = ln(r.series), X(r.series, function(t) { + if (kt(t)) { + var n = t.type; + if (n === "line") + t.clipOverflow != null && (t.clip = t.clipOverflow); + else if (n === "pie" || n === "gauge") { + t.clockWise != null && (t.clockwise = t.clockWise), vO(t.label); + var i = t.data; + if (i && !no(i)) + for (var a = 0; a < i.length; a++) + vO(i[a]); + t.hoverOffset != null && (t.emphasis = t.emphasis || {}, (t.emphasis.scaleSize = null) && (t.emphasis.scaleSize = t.hoverOffset)); + } else if (n === "gauge") { + var o = _Q(t, "pointer.color"); + o != null && bQ(t, "itemStyle.color", o); + } else if (n === "bar") { + tp(t), tp(t.backgroundStyle), tp(t.emphasis); + var i = t.data; + if (i && !no(i)) + for (var a = 0; a < i.length; a++) + typeof i[a] == "object" && (tp(i[a]), tp(i[a] && i[a].emphasis)); + } else if (n === "sunburst") { + var s = t.highlightPolicy; + s && (t.emphasis = t.emphasis || {}, t.emphasis.focus || (t.emphasis.focus = s)), pO(t), kF(t.data, pO); + } else + n === "graph" || n === "sankey" ? wQ(t) : n === "map" && (t.mapType && !t.map && (t.map = t.mapType), t.mapLocation && Mt(t, t.mapLocation)); + t.hoverAnimation != null && (t.emphasis = t.emphasis || {}, t.emphasis && t.emphasis.scale == null && (t.emphasis.scale = t.hoverAnimation)), dO(t); + } + }), r.dataRange && (r.visualMap = r.dataRange), X(SQ, function(t) { + var n = r[t]; + n && (We(n) || (n = [n]), X(n, function(i) { + dO(i); + })); + }); +} +function CQ(r) { + var e = xt(); + r.eachSeries(function(t) { + var n = t.get("stack"); + if (n) { + var i = e.get(n) || e.set(n, []), a = t.getData(), o = { + // Used for calculate axis extent automatically. + // TODO: Type getCalculationInfo return more specific type? + stackResultDimension: a.getCalculationInfo("stackResultDimension"), + stackedOverDimension: a.getCalculationInfo("stackedOverDimension"), + stackedDimension: a.getCalculationInfo("stackedDimension"), + stackedByDimension: a.getCalculationInfo("stackedByDimension"), + isStackedByIndex: a.getCalculationInfo("isStackedByIndex"), + data: a, + seriesModel: t + }; + if (!o.stackedDimension || !(o.isStackedByIndex || o.stackedByDimension)) + return; + i.length && a.setCalculationInfo("stackedOnSeries", i[i.length - 1].seriesModel), i.push(o); + } + }), e.each(TQ); +} +function TQ(r) { + X(r, function(e, t) { + var n = [], i = [NaN, NaN], a = [e.stackResultDimension, e.stackedOverDimension], o = e.data, s = e.isStackedByIndex, l = e.seriesModel.get("stackStrategy") || "samesign"; + o.modify(a, function(u, c, h) { + var f = o.get(e.stackedDimension, h); + if (isNaN(f)) + return i; + var v, b; + s ? b = o.getRawIndex(h) : v = o.get(e.stackedByDimension, h); + for (var w = NaN, p = t - 1; p >= 0; p--) { + var d = r[p]; + if (s || (b = d.data.rawIndexOf(d.stackedByDimension, v)), b >= 0) { + var m = d.data.getByRawIndex(d.stackResultDimension, b); + if (l === "all" || l === "positive" && m > 0 || l === "negative" && m < 0 || l === "samesign" && f >= 0 && m > 0 || l === "samesign" && f <= 0 && m < 0) { + f = fZ(f, m), w = m; + break; + } + } + } + return n[0] = f, n[1] = w, n; + }); + }); +} +var Zb = ( + /** @class */ + function() { + function r(e) { + this.data = e.data || (e.sourceFormat === Ml ? {} : []), this.sourceFormat = e.sourceFormat || SF, this.seriesLayoutBy = e.seriesLayoutBy || Sl, this.startIndex = e.startIndex || 0, this.dimensionsDetectedCount = e.dimensionsDetectedCount, this.metaRawOption = e.metaRawOption; + var t = this.dimensionsDefine = e.dimensionsDefine; + if (t) + for (var n = 0; n < t.length; n++) { + var i = t[n]; + i.type == null && TF(this, n) === Vi.Must && (i.type = "ordinal"); + } + } + return r; + }() +); +function pA(r) { + return r instanceof Zb; +} +function G1(r, e, t) { + t = t || LF(r); + var n = e.seriesLayoutBy, i = AQ(r, t, n, e.sourceHeader, e.dimensions), a = new Zb({ + data: r, + sourceFormat: t, + seriesLayoutBy: n, + dimensionsDefine: i.dimensionsDefine, + startIndex: i.startIndex, + dimensionsDetectedCount: i.dimensionsDetectedCount, + metaRawOption: Ot(e) + }); + return a; +} +function gA(r) { + return new Zb({ + data: r, + sourceFormat: no(r) ? sc : is + }); +} +function IQ(r) { + return new Zb({ + data: r.data, + sourceFormat: r.sourceFormat, + seriesLayoutBy: r.seriesLayoutBy, + dimensionsDefine: Ot(r.dimensionsDefine), + startIndex: r.startIndex, + dimensionsDetectedCount: r.dimensionsDetectedCount + }); +} +function LF(r) { + var e = SF; + if (no(r)) + e = sc; + else if (We(r)) { + r.length === 0 && (e = ga); + for (var t = 0, n = r.length; t < n; t++) { + var i = r[t]; + if (i != null) { + if (We(i)) { + e = ga; + break; + } else if (kt(i)) { + e = as; + break; + } + } + } + } else if (kt(r)) { + for (var a in r) + if (gt(r, a) && Yi(r[a])) { + e = Ml; + break; + } + } + return e; +} +function AQ(r, e, t, n, i) { + var a, o; + if (!r) + return { + dimensionsDefine: gO(i), + startIndex: o, + dimensionsDetectedCount: a + }; + if (e === ga) { + var s = r; + n === "auto" || n == null ? mO(function(u) { + u != null && u !== "-" && (ut(u) ? o == null && (o = 1) : o = 0); + }, t, s, 10) : o = Pr(n) ? n : n ? 1 : 0, !i && o === 1 && (i = [], mO(function(u, c) { + i[c] = u != null ? u + "" : ""; + }, t, s, 1 / 0)), a = i ? i.length : t === iv ? s.length : s[0] ? s[0].length : null; + } else if (e === as) + i || (i = EQ(r)); + else if (e === Ml) + i || (i = [], X(r, function(u, c) { + i.push(c); + })); + else if (e === is) { + var l = Xd(r[0]); + a = We(l) && l.length || 1; + } + return { + startIndex: o, + dimensionsDefine: gO(i), + dimensionsDetectedCount: a + }; +} +function EQ(r) { + for (var e = 0, t; e < r.length && !(t = r[e++]); ) + ; + if (t) + return yr(t); +} +function gO(r) { + if (r) { + var e = xt(); + return Ke(r, function(t, n) { + t = kt(t) ? t : { + name: t + }; + var i = { + name: t.name, + displayName: t.displayName, + type: t.type + }; + if (i.name == null) + return i; + i.name += "", i.displayName == null && (i.displayName = i.name); + var a = e.get(i.name); + return a ? i.name += "-" + a.count++ : e.set(i.name, { + count: 1 + }), i; + }); + } +} +function mO(r, e, t, n) { + if (e === iv) + for (var i = 0; i < t.length && i < n; i++) + r(t[i] ? t[i][0] : null, i); + else + for (var a = t[0] || [], i = 0; i < a.length && i < n; i++) + r(a[i], i); +} +function PF(r) { + var e = r.sourceFormat; + return e === as || e === Ml; +} +var nh, ih, ah, yO, _O, RF = ( + /** @class */ + function() { + function r(e, t) { + var n = pA(e) ? e : gA(e); + this._source = n; + var i = this._data = n.data; + n.sourceFormat === sc && (this._offset = 0, this._dimSize = t, this._data = i), _O(this, i, n); + } + return r.prototype.getSource = function() { + return this._source; + }, r.prototype.count = function() { + return 0; + }, r.prototype.getItem = function(e, t) { + }, r.prototype.appendData = function(e) { + }, r.prototype.clean = function() { + }, r.protoInitialize = function() { + var e = r.prototype; + e.pure = !1, e.persistent = !0; + }(), r.internalField = function() { + var e; + _O = function(o, s, l) { + var u = l.sourceFormat, c = l.seriesLayoutBy, h = l.startIndex, f = l.dimensionsDefine, v = yO[mA(u, c)]; + if (Fe(o, v), u === sc) + o.getItem = t, o.count = i, o.fillStorage = n; + else { + var b = NF(u, c); + o.getItem = ft(b, null, s, h, f); + var w = zF(u, c); + o.count = ft(w, null, s, h, f); + } + }; + var t = function(o, s) { + o = o - this._offset, s = s || []; + for (var l = this._data, u = this._dimSize, c = u * o, h = 0; h < u; h++) + s[h] = l[c + h]; + return s; + }, n = function(o, s, l, u) { + for (var c = this._data, h = this._dimSize, f = 0; f < h; f++) { + for (var v = u[f], b = v[0] == null ? 1 / 0 : v[0], w = v[1] == null ? -1 / 0 : v[1], p = s - o, d = l[f], m = 0; m < p; m++) { + var _ = c[m * h + f]; + d[o + m] = _, _ < b && (b = _), _ > w && (w = _); + } + v[0] = b, v[1] = w; + } + }, i = function() { + return this._data ? this._data.length / this._dimSize : 0; + }; + yO = (e = {}, e[ga + "_" + Sl] = { + pure: !0, + appendData: a + }, e[ga + "_" + iv] = { + pure: !0, + appendData: function() { + throw new Error('Do not support appendData when set seriesLayoutBy: "row".'); + } + }, e[as] = { + pure: !0, + appendData: a + }, e[Ml] = { + pure: !0, + appendData: function(o) { + var s = this._data; + X(o, function(l, u) { + for (var c = s[u] || (s[u] = []), h = 0; h < (l || []).length; h++) + c.push(l[h]); + }); + } + }, e[is] = { + appendData: a + }, e[sc] = { + persistent: !1, + pure: !0, + appendData: function(o) { + this._data = o; + }, + // Clean self if data is already used. + clean: function() { + this._offset += this.count(), this._data = null; + } + }, e); + function a(o) { + for (var s = 0; s < o.length; s++) + this._data.push(o[s]); + } + }(), r; + }() +), bO = function(r, e, t, n) { + return r[n]; +}, MQ = (nh = {}, nh[ga + "_" + Sl] = function(r, e, t, n) { + return r[n + e]; +}, nh[ga + "_" + iv] = function(r, e, t, n, i) { + n += e; + for (var a = i || [], o = r, s = 0; s < o.length; s++) { + var l = o[s]; + a[s] = l ? l[n] : null; + } + return a; +}, nh[as] = bO, nh[Ml] = function(r, e, t, n, i) { + for (var a = i || [], o = 0; o < t.length; o++) { + var s = t[o].name, l = r[s]; + a[o] = l ? l[n] : null; + } + return a; +}, nh[is] = bO, nh); +function NF(r, e) { + var t = MQ[mA(r, e)]; + return t; +} +var xO = function(r, e, t) { + return r.length; +}, DQ = (ih = {}, ih[ga + "_" + Sl] = function(r, e, t) { + return Math.max(0, r.length - e); +}, ih[ga + "_" + iv] = function(r, e, t) { + var n = r[0]; + return n ? Math.max(0, n.length - e) : 0; +}, ih[as] = xO, ih[Ml] = function(r, e, t) { + var n = t[0].name, i = r[n]; + return i ? i.length : 0; +}, ih[is] = xO, ih); +function zF(r, e) { + var t = DQ[mA(r, e)]; + return t; +} +var WS = function(r, e, t) { + return r[e]; +}, kQ = (ah = {}, ah[ga] = WS, ah[as] = function(r, e, t) { + return r[t]; +}, ah[Ml] = WS, ah[is] = function(r, e, t) { + var n = Xd(r); + return n instanceof Array ? n[e] : n; +}, ah[sc] = WS, ah); +function BF(r) { + var e = kQ[r]; + return e; +} +function mA(r, e) { + return r === ga ? r + "_" + e : r; +} +function Rd(r, e, t) { + if (r) { + var n = r.getRawDataItem(e); + if (n != null) { + var i = r.getStore(), a = i.getSource().sourceFormat; + if (t != null) { + var o = r.getDimensionIndex(t), s = i.getDimensionProperty(o); + return BF(a)(n, o, s); + } else { + var l = n; + return a === is && (l = Xd(n)), l; + } + } + } +} +var OQ = /\{@(.+?)\}/g, yA = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getDataParams = function(e, t) { + var n = this.getData(t), i = this.getRawValue(e, t), a = n.getRawIndex(e), o = n.getName(e), s = n.getRawDataItem(e), l = n.getItemVisual(e, "style"), u = l && l[n.getItemVisual(e, "drawType") || "fill"], c = l && l.stroke, h = this.mainType, f = h === "series", v = n.userOutput && n.userOutput.get(); + return { + componentType: h, + componentSubType: this.subType, + componentIndex: this.componentIndex, + seriesType: f ? this.subType : null, + seriesIndex: this.seriesIndex, + seriesId: f ? this.id : null, + seriesName: f ? this.name : null, + name: o, + dataIndex: a, + data: s, + dataType: t, + value: i, + color: u, + borderColor: c, + dimensionNames: v ? v.fullDimensions : null, + encode: v ? v.encode : null, + // Param name list for mapping `a`, `b`, `c`, `d`, `e` + $vars: ["seriesName", "name", "value"] + }; + }, r.prototype.getFormattedLabel = function(e, t, n, i, a, o) { + t = t || "normal"; + var s = this.getData(n), l = this.getDataParams(e, n); + if (o && (l.value = o.interpolatedValue), i != null && We(l.value) && (l.value = l.value[i]), !a) { + var u = s.getItemModel(e); + a = u.get(t === "normal" ? ["label", "formatter"] : [t, "label", "formatter"]); + } + if (Tt(a)) + return l.status = t, l.dimensionIndex = i, a(l); + if (ut(a)) { + var c = cA(a, l); + return c.replace(OQ, function(h, f) { + var v = f.length, b = f; + b.charAt(0) === "[" && b.charAt(v - 1) === "]" && (b = +b.slice(1, v - 1)); + var w = Rd(s, e, b); + if (o && We(o.interpolatedValue)) { + var p = s.getDimensionIndex(b); + p >= 0 && (w = o.interpolatedValue[p]); + } + return w != null ? w + "" : ""; + }); + } + }, r.prototype.getRawValue = function(e, t) { + return Rd(this.getData(t), e); + }, r.prototype.formatTooltip = function(e, t, n) { + }, r; + }() +); +function SO(r) { + var e, t; + return kt(r) ? r.type && (t = r) : e = r, { + text: e, + // markers: markers || markersExisting, + frag: t + }; +} +function Yp(r) { + return new LQ(r); +} +var LQ = ( + /** @class */ + function() { + function r(e) { + e = e || {}, this._reset = e.reset, this._plan = e.plan, this._count = e.count, this._onDirty = e.onDirty, this._dirty = !0; + } + return r.prototype.perform = function(e) { + var t = this._upstream, n = e && e.skip; + if (this._dirty && t) { + var i = this.context; + i.data = i.outputData = t.context.outputData; + } + this.__pipeline && (this.__pipeline.currentTask = this); + var a; + this._plan && !n && (a = this._plan(this.context)); + var o = c(this._modBy), s = this._modDataCount || 0, l = c(e && e.modBy), u = e && e.modDataCount || 0; + (o !== l || s !== u) && (a = "reset"); + function c(m) { + return !(m >= 1) && (m = 1), m; + } + var h; + (this._dirty || a === "reset") && (this._dirty = !1, h = this._doReset(n)), this._modBy = l, this._modDataCount = u; + var f = e && e.step; + if (t ? this._dueEnd = t._outputDueEnd : this._dueEnd = this._count ? this._count(this.context) : 1 / 0, this._progress) { + var v = this._dueIndex, b = Math.min(f != null ? this._dueIndex + f : 1 / 0, this._dueEnd); + if (!n && (h || v < b)) { + var w = this._progress; + if (We(w)) + for (var p = 0; p < w.length; p++) + this._doProgress(w[p], v, b, l, u); + else + this._doProgress(w, v, b, l, u); + } + this._dueIndex = b; + var d = this._settedOutputEnd != null ? this._settedOutputEnd : b; + this._outputDueEnd = d; + } else + this._dueIndex = this._outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : this._dueEnd; + return this.unfinished(); + }, r.prototype.dirty = function() { + this._dirty = !0, this._onDirty && this._onDirty(this.context); + }, r.prototype._doProgress = function(e, t, n, i, a) { + wO.reset(t, n, i, a), this._callingProgress = e, this._callingProgress({ + start: t, + end: n, + count: n - t, + next: wO.next + }, this.context); + }, r.prototype._doReset = function(e) { + this._dueIndex = this._outputDueEnd = this._dueEnd = 0, this._settedOutputEnd = null; + var t, n; + !e && this._reset && (t = this._reset(this.context), t && t.progress && (n = t.forceFirstProgress, t = t.progress), We(t) && !t.length && (t = null)), this._progress = t, this._modBy = this._modDataCount = null; + var i = this._downstream; + return i && i.dirty(), n; + }, r.prototype.unfinished = function() { + return this._progress && this._dueIndex < this._dueEnd; + }, r.prototype.pipe = function(e) { + (this._downstream !== e || this._dirty) && (this._downstream = e, e._upstream = this, e.dirty()); + }, r.prototype.dispose = function() { + this._disposed || (this._upstream && (this._upstream._downstream = null), this._downstream && (this._downstream._upstream = null), this._dirty = !1, this._disposed = !0); + }, r.prototype.getUpstream = function() { + return this._upstream; + }, r.prototype.getDownstream = function() { + return this._downstream; + }, r.prototype.setOutputEnd = function(e) { + this._outputDueEnd = this._settedOutputEnd = e; + }, r; + }() +), wO = function() { + var r, e, t, n, i, a = { + reset: function(l, u, c, h) { + e = l, r = u, t = c, n = h, i = Math.ceil(n / t), a.next = t > 1 && n > 0 ? s : o; + } + }; + return a; + function o() { + return e < r ? e++ : null; + } + function s() { + var l = e % i * t + Math.ceil(e / i), u = e >= r ? null : l < n ? l : e; + return e++, u; + } +}(); +function lc(r, e) { + var t = e && e.type; + return t === "ordinal" ? r : (t === "time" && !Pr(r) && r != null && r !== "-" && (r = +So(r)), r == null || r === "" ? NaN : +r); +} +var PQ = xt({ + number: function(r) { + return parseFloat(r); + }, + time: function(r) { + return +So(r); + }, + trim: function(r) { + return ut(r) ? Qo(r) : r; + } +}); +function jF(r) { + return PQ.get(r); +} +var FF = { + lt: function(r, e) { + return r < e; + }, + lte: function(r, e) { + return r <= e; + }, + gt: function(r, e) { + return r > e; + }, + gte: function(r, e) { + return r >= e; + } +}, RQ = ( + /** @class */ + function() { + function r(e, t) { + if (!Pr(t)) { + var n = ""; + Ur(n); + } + this._opFn = FF[e], this._rvalFloat = Il(t); + } + return r.prototype.evaluate = function(e) { + return Pr(e) ? this._opFn(e, this._rvalFloat) : this._opFn(Il(e), this._rvalFloat); + }, r; + }() +), $F = ( + /** @class */ + function() { + function r(e, t) { + var n = e === "desc"; + this._resultLT = n ? 1 : -1, t == null && (t = n ? "min" : "max"), this._incomparable = t === "min" ? -1 / 0 : 1 / 0; + } + return r.prototype.evaluate = function(e, t) { + var n = Pr(e) ? e : Il(e), i = Pr(t) ? t : Il(t), a = isNaN(n), o = isNaN(i); + if (a && (n = this._incomparable), o && (i = this._incomparable), a && o) { + var s = ut(e), l = ut(t); + s && (n = l ? e : 0), l && (i = s ? t : 0); + } + return n < i ? this._resultLT : n > i ? -this._resultLT : 0; + }, r; + }() +), NQ = ( + /** @class */ + function() { + function r(e, t) { + this._rval = t, this._isEQ = e, this._rvalTypeof = typeof t, this._rvalFloat = Il(t); + } + return r.prototype.evaluate = function(e) { + var t = e === this._rval; + if (!t) { + var n = typeof e; + n !== this._rvalTypeof && (n === "number" || this._rvalTypeof === "number") && (t = Il(e) === this._rvalFloat); + } + return this._isEQ ? t : !t; + }, r; + }() +); +function zQ(r, e) { + return r === "eq" || r === "ne" ? new NQ(r === "eq", e) : gt(FF, r) ? new RQ(r, e) : null; +} +var BQ = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getRawData = function() { + throw new Error("not supported"); + }, r.prototype.getRawDataItem = function(e) { + throw new Error("not supported"); + }, r.prototype.cloneRawData = function() { + }, r.prototype.getDimensionInfo = function(e) { + }, r.prototype.cloneAllDimensionInfo = function() { + }, r.prototype.count = function() { + }, r.prototype.retrieveValue = function(e, t) { + }, r.prototype.retrieveValueFromItem = function(e, t) { + }, r.prototype.convertValue = function(e, t) { + return lc(e, t); + }, r; + }() +); +function jQ(r, e) { + var t = new BQ(), n = r.data, i = t.sourceFormat = r.sourceFormat, a = r.startIndex, o = ""; + r.seriesLayoutBy !== Sl && Ur(o); + var s = [], l = {}, u = r.dimensionsDefine; + if (u) + X(u, function(w, p) { + var d = w.name, m = { + index: p, + name: d, + displayName: w.displayName + }; + if (s.push(m), d != null) { + var _ = ""; + gt(l, d) && Ur(_), l[d] = m; + } + }); + else + for (var c = 0; c < r.dimensionsDetectedCount; c++) + s.push({ + index: c + }); + var h = NF(i, Sl); + e.__isBuiltIn && (t.getRawDataItem = function(w) { + return h(n, a, s, w); + }, t.getRawData = ft(FQ, null, r)), t.cloneRawData = ft($Q, null, r); + var f = zF(i, Sl); + t.count = ft(f, null, n, a, s); + var v = BF(i); + t.retrieveValue = function(w, p) { + var d = h(n, a, s, w); + return b(d, p); + }; + var b = t.retrieveValueFromItem = function(w, p) { + if (w != null) { + var d = s[p]; + if (d) + return v(w, p, d.name); + } + }; + return t.getDimensionInfo = ft(HQ, null, s, l), t.cloneAllDimensionInfo = ft(VQ, null, s), t; +} +function FQ(r) { + var e = r.sourceFormat; + if (!_A(e)) { + var t = ""; + Ur(t); + } + return r.data; +} +function $Q(r) { + var e = r.sourceFormat, t = r.data; + if (!_A(e)) { + var n = ""; + Ur(n); + } + if (e === ga) { + for (var i = [], a = 0, o = t.length; a < o; a++) + i.push(t[a].slice()); + return i; + } else if (e === as) { + for (var i = [], a = 0, o = t.length; a < o; a++) + i.push(Fe({}, t[a])); + return i; + } +} +function HQ(r, e, t) { + if (t != null) { + if (Pr(t) || !isNaN(t) && !gt(e, t)) + return r[t]; + if (gt(e, t)) + return e[t]; + } +} +function VQ(r) { + return Ot(r); +} +var HF = xt(); +function GQ(r) { + r = Ot(r); + var e = r.type, t = ""; + e || Ur(t); + var n = e.split(":"); + n.length !== 2 && Ur(t); + var i = !1; + n[0] === "echarts" && (e = n[1], i = !0), r.__isBuiltIn = i, HF.set(e, r); +} +function UQ(r, e, t) { + var n = ln(r), i = n.length, a = ""; + i || Ur(a); + for (var o = 0, s = i; o < s; o++) { + var l = n[o]; + e = WQ(l, e), o !== s - 1 && (e.length = Math.max(e.length, 1)); + } + return e; +} +function WQ(r, e, t, n) { + var i = ""; + e.length || Ur(i), kt(r) || Ur(i); + var a = r.type, o = HF.get(a); + o || Ur(i); + var s = Ke(e, function(u) { + return jQ(u, o); + }), l = ln(o.transform({ + upstream: s[0], + upstreamList: s, + config: Ot(r.config) + })); + return Ke(l, function(u, c) { + var h = ""; + kt(u) || Ur(h), u.data || Ur(h); + var f = LF(u.data); + _A(f) || Ur(h); + var v, b = e[0]; + if (b && c === 0 && !u.dimensions) { + var w = b.startIndex; + w && (u.data = b.data.slice(0, w).concat(u.data)), v = { + seriesLayoutBy: Sl, + sourceHeader: w, + dimensions: b.metaRawOption.dimensions + }; + } else + v = { + seriesLayoutBy: Sl, + sourceHeader: 0, + dimensions: u.dimensions + }; + return G1(u.data, v, null); + }); +} +function _A(r) { + return r === ga || r === as; +} +var Jb = "undefined", YQ = typeof Uint32Array === Jb ? Array : Uint32Array, XQ = typeof Uint16Array === Jb ? Array : Uint16Array, VF = typeof Int32Array === Jb ? Array : Int32Array, CO = typeof Float64Array === Jb ? Array : Float64Array, GF = { + float: CO, + int: VF, + // Ordinal data type can be string or int + ordinal: Array, + number: Array, + time: CO +}, YS; +function rp(r) { + return r > 65535 ? YQ : XQ; +} +function Uf() { + return [1 / 0, -1 / 0]; +} +function ZQ(r) { + var e = r.constructor; + return e === Array ? r.slice() : new e(r); +} +function TO(r, e, t, n, i) { + var a = GF[t || "float"]; + if (i) { + var o = r[e], s = o && o.length; + if (s !== n) { + for (var l = new a(n), u = 0; u < s; u++) + l[u] = o[u]; + r[e] = l; + } + } else + r[e] = new a(n); +} +var JQ = ( + /** @class */ + function() { + function r() { + this._chunks = [], this._rawExtent = [], this._extent = [], this._count = 0, this._rawCount = 0, this._calcDimNameToIdx = xt(); + } + return r.prototype.initData = function(e, t, n) { + this._provider = e, this._chunks = [], this._indices = null, this.getRawIndex = this._getRawIdxIdentity; + var i = e.getSource(), a = this.defaultDimValueGetter = YS[i.sourceFormat]; + this._dimValueGetter = n || a, this._rawExtent = [], PF(i), this._dimensions = Ke(t, function(o) { + return { + // Only pick these two props. Not leak other properties like orderMeta. + type: o.type, + property: o.property + }; + }), this._initDataFromProvider(0, e.count()); + }, r.prototype.getProvider = function() { + return this._provider; + }, r.prototype.getSource = function() { + return this._provider.getSource(); + }, r.prototype.ensureCalculationDimension = function(e, t) { + var n = this._calcDimNameToIdx, i = this._dimensions, a = n.get(e); + if (a != null) { + if (i[a].type === t) + return a; + } else + a = i.length; + return i[a] = { + type: t + }, n.set(e, a), this._chunks[a] = new GF[t || "float"](this._rawCount), this._rawExtent[a] = Uf(), a; + }, r.prototype.collectOrdinalMeta = function(e, t) { + var n = this._chunks[e], i = this._dimensions[e], a = this._rawExtent, o = i.ordinalOffset || 0, s = n.length; + o === 0 && (a[e] = Uf()); + for (var l = a[e], u = o; u < s; u++) { + var c = n[u] = t.parseAndCollect(n[u]); + isNaN(c) || (l[0] = Math.min(c, l[0]), l[1] = Math.max(c, l[1])); + } + i.ordinalMeta = t, i.ordinalOffset = s, i.type = "ordinal"; + }, r.prototype.getOrdinalMeta = function(e) { + var t = this._dimensions[e], n = t.ordinalMeta; + return n; + }, r.prototype.getDimensionProperty = function(e) { + var t = this._dimensions[e]; + return t && t.property; + }, r.prototype.appendData = function(e) { + var t = this._provider, n = this.count(); + t.appendData(e); + var i = t.count(); + return t.persistent || (i += n), n < i && this._initDataFromProvider(n, i, !0), [n, i]; + }, r.prototype.appendValues = function(e, t) { + for (var n = this._chunks, i = this._dimensions, a = i.length, o = this._rawExtent, s = this.count(), l = s + Math.max(e.length, t || 0), u = 0; u < a; u++) { + var c = i[u]; + TO(n, u, c.type, l, !0); + } + for (var h = [], f = s; f < l; f++) + for (var v = f - s, b = 0; b < a; b++) { + var c = i[b], w = YS.arrayRows.call(this, e[v] || h, c.property, v, b); + n[b][f] = w; + var p = o[b]; + w < p[0] && (p[0] = w), w > p[1] && (p[1] = w); + } + return this._rawCount = this._count = l, { + start: s, + end: l + }; + }, r.prototype._initDataFromProvider = function(e, t, n) { + for (var i = this._provider, a = this._chunks, o = this._dimensions, s = o.length, l = this._rawExtent, u = Ke(o, function(m) { + return m.property; + }), c = 0; c < s; c++) { + var h = o[c]; + l[c] || (l[c] = Uf()), TO(a, c, h.type, t, n); + } + if (i.fillStorage) + i.fillStorage(e, t, a, l); + else + for (var f = [], v = e; v < t; v++) { + f = i.getItem(v, f); + for (var b = 0; b < s; b++) { + var w = a[b], p = this._dimValueGetter(f, u[b], v, b); + w[v] = p; + var d = l[b]; + p < d[0] && (d[0] = p), p > d[1] && (d[1] = p); + } + } + !i.persistent && i.clean && i.clean(), this._rawCount = this._count = t, this._extent = []; + }, r.prototype.count = function() { + return this._count; + }, r.prototype.get = function(e, t) { + if (!(t >= 0 && t < this._count)) + return NaN; + var n = this._chunks[e]; + return n ? n[this.getRawIndex(t)] : NaN; + }, r.prototype.getValues = function(e, t) { + var n = [], i = []; + if (t == null) { + t = e, e = []; + for (var a = 0; a < this._dimensions.length; a++) + i.push(a); + } else + i = e; + for (var a = 0, o = i.length; a < o; a++) + n.push(this.get(i[a], t)); + return n; + }, r.prototype.getByRawIndex = function(e, t) { + if (!(t >= 0 && t < this._rawCount)) + return NaN; + var n = this._chunks[e]; + return n ? n[t] : NaN; + }, r.prototype.getSum = function(e) { + var t = this._chunks[e], n = 0; + if (t) + for (var i = 0, a = this.count(); i < a; i++) { + var o = this.get(e, i); + isNaN(o) || (n += o); + } + return n; + }, r.prototype.getMedian = function(e) { + var t = []; + this.each([e], function(a) { + isNaN(a) || t.push(a); + }); + var n = t.sort(function(a, o) { + return a - o; + }), i = this.count(); + return i === 0 ? 0 : i % 2 === 1 ? n[(i - 1) / 2] : (n[i / 2] + n[i / 2 - 1]) / 2; + }, r.prototype.indexOfRawIndex = function(e) { + if (e >= this._rawCount || e < 0) + return -1; + if (!this._indices) + return e; + var t = this._indices, n = t[e]; + if (n != null && n < this._count && n === e) + return e; + for (var i = 0, a = this._count - 1; i <= a; ) { + var o = (i + a) / 2 | 0; + if (t[o] < e) + i = o + 1; + else if (t[o] > e) + a = o - 1; + else + return o; + } + return -1; + }, r.prototype.indicesOfNearest = function(e, t, n) { + var i = this._chunks, a = i[e], o = []; + if (!a) + return o; + n == null && (n = 1 / 0); + for (var s = 1 / 0, l = -1, u = 0, c = 0, h = this.count(); c < h; c++) { + var f = this.getRawIndex(c), v = t - a[f], b = Math.abs(v); + b <= n && ((b < s || b === s && v >= 0 && l < 0) && (s = b, l = v, u = 0), v === l && (o[u++] = c)); + } + return o.length = u, o; + }, r.prototype.getIndices = function() { + var e, t = this._indices; + if (t) { + var n = t.constructor, i = this._count; + if (n === Array) { + e = new n(i); + for (var a = 0; a < i; a++) + e[a] = t[a]; + } else + e = new n(t.buffer, 0, i); + } else { + var n = rp(this._rawCount); + e = new n(this.count()); + for (var a = 0; a < e.length; a++) + e[a] = a; + } + return e; + }, r.prototype.filter = function(e, t) { + if (!this._count) + return this; + for (var n = this.clone(), i = n.count(), a = rp(n._rawCount), o = new a(i), s = [], l = e.length, u = 0, c = e[0], h = n._chunks, f = 0; f < i; f++) { + var v = void 0, b = n.getRawIndex(f); + if (l === 0) + v = t(f); + else if (l === 1) { + var w = h[c][b]; + v = t(w, f); + } else { + for (var p = 0; p < l; p++) + s[p] = h[e[p]][b]; + s[p] = f, v = t.apply(null, s); + } + v && (o[u++] = b); + } + return u < i && (n._indices = o), n._count = u, n._extent = [], n._updateGetRawIdx(), n; + }, r.prototype.selectRange = function(e) { + var t = this.clone(), n = t._count; + if (!n) + return this; + var i = yr(e), a = i.length; + if (!a) + return this; + var o = t.count(), s = rp(t._rawCount), l = new s(o), u = 0, c = i[0], h = e[c][0], f = e[c][1], v = t._chunks, b = !1; + if (!t._indices) { + var w = 0; + if (a === 1) { + for (var p = v[i[0]], d = 0; d < n; d++) { + var m = p[d]; + (m >= h && m <= f || isNaN(m)) && (l[u++] = w), w++; + } + b = !0; + } else if (a === 2) { + for (var p = v[i[0]], _ = v[i[1]], y = e[i[1]][0], x = e[i[1]][1], d = 0; d < n; d++) { + var m = p[d], g = _[d]; + (m >= h && m <= f || isNaN(m)) && (g >= y && g <= x || isNaN(g)) && (l[u++] = w), w++; + } + b = !0; + } + } + if (!b) + if (a === 1) + for (var d = 0; d < o; d++) { + var S = t.getRawIndex(d), m = v[i[0]][S]; + (m >= h && m <= f || isNaN(m)) && (l[u++] = S); + } + else + for (var d = 0; d < o; d++) { + for (var T = !0, S = t.getRawIndex(d), C = 0; C < a; C++) { + var E = i[C], m = v[E][S]; + (m < e[E][0] || m > e[E][1]) && (T = !1); + } + T && (l[u++] = t.getRawIndex(d)); + } + return u < o && (t._indices = l), t._count = u, t._extent = [], t._updateGetRawIdx(), t; + }, r.prototype.map = function(e, t) { + var n = this.clone(e); + return this._updateDims(n, e, t), n; + }, r.prototype.modify = function(e, t) { + this._updateDims(this, e, t); + }, r.prototype._updateDims = function(e, t, n) { + for (var i = e._chunks, a = [], o = t.length, s = e.count(), l = [], u = e._rawExtent, c = 0; c < t.length; c++) + u[t[c]] = Uf(); + for (var h = 0; h < s; h++) { + for (var f = e.getRawIndex(h), v = 0; v < o; v++) + l[v] = i[t[v]][f]; + l[o] = h; + var b = n && n.apply(null, l); + if (b != null) { + typeof b != "object" && (a[0] = b, b = a); + for (var c = 0; c < b.length; c++) { + var w = t[c], p = b[c], d = u[w], m = i[w]; + m && (m[f] = p), p < d[0] && (d[0] = p), p > d[1] && (d[1] = p); + } + } + } + }, r.prototype.lttbDownSample = function(e, t) { + var n = this.clone([e], !0), i = n._chunks, a = i[e], o = this.count(), s = 0, l = Math.floor(1 / t), u = this.getRawIndex(0), c, h, f, v = new (rp(this._rawCount))(Math.min((Math.ceil(o / l) + 2) * 2, o)); + v[s++] = u; + for (var b = 1; b < o - 1; b += l) { + for (var w = Math.min(b + l, o - 1), p = Math.min(b + l * 2, o), d = (p + w) / 2, m = 0, _ = w; _ < p; _++) { + var y = this.getRawIndex(_), x = a[y]; + isNaN(x) || (m += x); + } + m /= p - w; + var g = b, S = Math.min(b + l, o), T = b - 1, C = a[u]; + c = -1, f = g; + for (var E = -1, M = 0, _ = g; _ < S; _++) { + var y = this.getRawIndex(_), x = a[y]; + if (isNaN(x)) { + M++, E < 0 && (E = y); + continue; + } + h = Math.abs((T - d) * (x - C) - (T - _) * (m - C)), h > c && (c = h, f = y); + } + M > 0 && M < S - g && (v[s++] = Math.min(E, f), f = Math.max(E, f)), v[s++] = f, u = f; + } + return v[s++] = this.getRawIndex(o - 1), n._count = s, n._indices = v, n.getRawIndex = this._getRawIdx, n; + }, r.prototype.downSample = function(e, t, n, i) { + for (var a = this.clone([e], !0), o = a._chunks, s = [], l = Math.floor(1 / t), u = o[e], c = this.count(), h = a._rawExtent[e] = Uf(), f = new (rp(this._rawCount))(Math.ceil(c / l)), v = 0, b = 0; b < c; b += l) { + l > c - b && (l = c - b, s.length = l); + for (var w = 0; w < l; w++) { + var p = this.getRawIndex(b + w); + s[w] = u[p]; + } + var d = n(s), m = this.getRawIndex(Math.min(b + i(s, d) || 0, c - 1)); + u[m] = d, d < h[0] && (h[0] = d), d > h[1] && (h[1] = d), f[v++] = m; + } + return a._count = v, a._indices = f, a._updateGetRawIdx(), a; + }, r.prototype.each = function(e, t) { + if (this._count) + for (var n = e.length, i = this._chunks, a = 0, o = this.count(); a < o; a++) { + var s = this.getRawIndex(a); + switch (n) { + case 0: + t(a); + break; + case 1: + t(i[e[0]][s], a); + break; + case 2: + t(i[e[0]][s], i[e[1]][s], a); + break; + default: + for (var l = 0, u = []; l < n; l++) + u[l] = i[e[l]][s]; + u[l] = a, t.apply(null, u); + } + } + }, r.prototype.getDataExtent = function(e) { + var t = this._chunks[e], n = Uf(); + if (!t) + return n; + var i = this.count(), a = !this._indices, o; + if (a) + return this._rawExtent[e].slice(); + if (o = this._extent[e], o) + return o.slice(); + o = n; + for (var s = o[0], l = o[1], u = 0; u < i; u++) { + var c = this.getRawIndex(u), h = t[c]; + h < s && (s = h), h > l && (l = h); + } + return o = [s, l], this._extent[e] = o, o; + }, r.prototype.getRawDataItem = function(e) { + var t = this.getRawIndex(e); + if (this._provider.persistent) + return this._provider.getItem(t); + for (var n = [], i = this._chunks, a = 0; a < i.length; a++) + n.push(i[a][t]); + return n; + }, r.prototype.clone = function(e, t) { + var n = new r(), i = this._chunks, a = e && es(e, function(s, l) { + return s[l] = !0, s; + }, {}); + if (a) + for (var o = 0; o < i.length; o++) + n._chunks[o] = a[o] ? ZQ(i[o]) : i[o]; + else + n._chunks = i; + return this._copyCommonProps(n), t || (n._indices = this._cloneIndices()), n._updateGetRawIdx(), n; + }, r.prototype._copyCommonProps = function(e) { + e._count = this._count, e._rawCount = this._rawCount, e._provider = this._provider, e._dimensions = this._dimensions, e._extent = Ot(this._extent), e._rawExtent = Ot(this._rawExtent); + }, r.prototype._cloneIndices = function() { + if (this._indices) { + var e = this._indices.constructor, t = void 0; + if (e === Array) { + var n = this._indices.length; + t = new e(n); + for (var i = 0; i < n; i++) + t[i] = this._indices[i]; + } else + t = new e(this._indices); + return t; + } + return null; + }, r.prototype._getRawIdxIdentity = function(e) { + return e; + }, r.prototype._getRawIdx = function(e) { + return e < this._count && e >= 0 ? this._indices[e] : -1; + }, r.prototype._updateGetRawIdx = function() { + this.getRawIndex = this._indices ? this._getRawIdx : this._getRawIdxIdentity; + }, r.internalField = function() { + function e(t, n, i, a) { + return lc(t[a], this._dimensions[a]); + } + YS = { + arrayRows: e, + objectRows: function(t, n, i, a) { + return lc(t[n], this._dimensions[a]); + }, + keyedColumns: e, + original: function(t, n, i, a) { + var o = t && (t.value == null ? t : t.value); + return lc(o instanceof Array ? o[a] : o, this._dimensions[a]); + }, + typedArray: function(t, n, i, a) { + return t[a]; + } + }; + }(), r; + }() +); +const U1 = JQ; +var UF = ( + /** @class */ + function() { + function r(e) { + this._sourceList = [], this._storeList = [], this._upstreamSignList = [], this._versionSignBase = 0, this._dirty = !0, this._sourceHost = e; + } + return r.prototype.dirty = function() { + this._setLocalSource([], []), this._storeList = [], this._dirty = !0; + }, r.prototype._setLocalSource = function(e, t) { + this._sourceList = e, this._upstreamSignList = t, this._versionSignBase++, this._versionSignBase > 9e10 && (this._versionSignBase = 0); + }, r.prototype._getVersionSign = function() { + return this._sourceHost.uid + "_" + this._versionSignBase; + }, r.prototype.prepareSource = function() { + this._isDirty() && (this._createSource(), this._dirty = !1); + }, r.prototype._createSource = function() { + this._setLocalSource([], []); + var e = this._sourceHost, t = this._getUpstreamSourceManagers(), n = !!t.length, i, a; + if (By(e)) { + var o = e, s = void 0, l = void 0, u = void 0; + if (n) { + var c = t[0]; + c.prepareSource(), u = c.getSource(), s = u.data, l = u.sourceFormat, a = [c._getVersionSign()]; + } else + s = o.get("data", !0), l = no(s) ? sc : is, a = []; + var h = this._getSourceMetaRawOption() || {}, f = u && u.metaRawOption || {}, v = Jt(h.seriesLayoutBy, f.seriesLayoutBy) || null, b = Jt(h.sourceHeader, f.sourceHeader), w = Jt(h.dimensions, f.dimensions), p = v !== f.seriesLayoutBy || !!b != !!f.sourceHeader || w; + i = p ? [G1(s, { + seriesLayoutBy: v, + sourceHeader: b, + dimensions: w + }, l)] : []; + } else { + var d = e; + if (n) { + var m = this._applyTransform(t); + i = m.sourceList, a = m.upstreamSignList; + } else { + var _ = d.get("source", !0); + i = [G1(_, this._getSourceMetaRawOption(), null)], a = []; + } + } + this._setLocalSource(i, a); + }, r.prototype._applyTransform = function(e) { + var t = this._sourceHost, n = t.get("transform", !0), i = t.get("fromTransformResult", !0); + if (i != null) { + var a = ""; + e.length !== 1 && AO(a); + } + var o, s = [], l = []; + return X(e, function(u) { + u.prepareSource(); + var c = u.getSource(i || 0), h = ""; + i != null && !c && AO(h), s.push(c), l.push(u._getVersionSign()); + }), n ? o = UQ(n, s, { + datasetIndex: t.componentIndex + }) : i != null && (o = [IQ(s[0])]), { + sourceList: o, + upstreamSignList: l + }; + }, r.prototype._isDirty = function() { + if (this._dirty) + return !0; + for (var e = this._getUpstreamSourceManagers(), t = 0; t < e.length; t++) { + var n = e[t]; + if ( + // Consider the case that there is ancestor diry, call it recursively. + // The performance is probably not an issue because usually the chain is not long. + n._isDirty() || this._upstreamSignList[t] !== n._getVersionSign() + ) + return !0; + } + }, r.prototype.getSource = function(e) { + e = e || 0; + var t = this._sourceList[e]; + if (!t) { + var n = this._getUpstreamSourceManagers(); + return n[0] && n[0].getSource(e); + } + return t; + }, r.prototype.getSharedDataStore = function(e) { + var t = e.makeStoreSchema(); + return this._innerGetDataStore(t.dimensions, e.source, t.hash); + }, r.prototype._innerGetDataStore = function(e, t, n) { + var i = 0, a = this._storeList, o = a[i]; + o || (o = a[i] = {}); + var s = o[n]; + if (!s) { + var l = this._getUpstreamSourceManagers()[0]; + By(this._sourceHost) && l ? s = l._innerGetDataStore(e, t, n) : (s = new U1(), s.initData(new RF(t, e.length), e)), o[n] = s; + } + return s; + }, r.prototype._getUpstreamSourceManagers = function() { + var e = this._sourceHost; + if (By(e)) { + var t = dA(e); + return t ? [t.getSourceManager()] : []; + } else + return Ke(QK(e), function(n) { + return n.getSourceManager(); + }); + }, r.prototype._getSourceMetaRawOption = function() { + var e = this._sourceHost, t, n, i; + if (By(e)) + t = e.get("seriesLayoutBy", !0), n = e.get("sourceHeader", !0), i = e.get("dimensions", !0); + else if (!this._getUpstreamSourceManagers().length) { + var a = e; + t = a.get("seriesLayoutBy", !0), n = a.get("sourceHeader", !0), i = a.get("dimensions", !0); + } + return { + seriesLayoutBy: t, + sourceHeader: n, + dimensions: i + }; + }, r; + }() +); +function IO(r) { + var e = r.option.transform; + e && ig(r.option.transform); +} +function By(r) { + return r.mainType === "series"; +} +function AO(r) { + throw new Error(r); +} +var WF = "line-height:1"; +function YF(r, e) { + var t = r.color || "#6e7079", n = r.fontSize || 12, i = r.fontWeight || "400", a = r.color || "#464646", o = r.fontSize || 14, s = r.fontWeight || "900"; + return e === "html" ? { + // eslint-disable-next-line max-len + nameStyle: "font-size:" + Ea(n + "") + "px;color:" + Ea(t) + ";font-weight:" + Ea(i + ""), + // eslint-disable-next-line max-len + valueStyle: "font-size:" + Ea(o + "") + "px;color:" + Ea(a) + ";font-weight:" + Ea(s + "") + } : { + nameStyle: { + fontSize: n, + fill: t, + fontWeight: i + }, + valueStyle: { + fontSize: o, + fill: a, + fontWeight: s + } + }; +} +var KQ = [0, 10, 20, 30], QQ = ["", ` +`, ` + +`, ` + + +`]; +function Di(r, e) { + return e.type = r, e; +} +function W1(r) { + return r.type === "section"; +} +function XF(r) { + return W1(r) ? qQ : eq; +} +function ZF(r) { + if (W1(r)) { + var e = 0, t = r.blocks.length, n = t > 1 || t > 0 && !r.noHeader; + return X(r.blocks, function(i) { + var a = ZF(i); + a >= e && (e = a + +(n && // 0 always can not be readable gap level. + (!a || W1(i) && !i.noHeader))); + }), e; + } + return 0; +} +function qQ(r, e, t, n) { + var i = e.noHeader, a = tq(ZF(e)), o = [], s = e.blocks || []; + pa(!s || We(s)), s = s || []; + var l = r.orderMode; + if (e.sortBlocks && l) { + s = s.slice(); + var u = { + valueAsc: "asc", + valueDesc: "desc" + }; + if (gt(u, l)) { + var c = new $F(u[l], null); + s.sort(function(b, w) { + return c.evaluate(b.sortParam, w.sortParam); + }); + } else + l === "seriesDesc" && s.reverse(); + } + X(s, function(b, w) { + var p = e.valueFormatter, d = XF(b)( + // Inherit valueFormatter + p ? Fe(Fe({}, r), { + valueFormatter: p + }) : r, + b, + w > 0 ? a.html : 0, + n + ); + d != null && o.push(d); + }); + var h = r.renderMode === "richText" ? o.join(a.richText) : Y1(o.join(""), i ? t : a.html); + if (i) + return h; + var f = $1(e.header, "ordinal", r.useUTC), v = YF(n, r.renderMode).nameStyle; + return r.renderMode === "richText" ? JF(r, f, v) + a.richText + h : Y1('
' + Ea(f) + "
" + h, t); +} +function eq(r, e, t, n) { + var i = r.renderMode, a = e.noName, o = e.noValue, s = !e.markerType, l = e.name, u = r.useUTC, c = e.valueFormatter || r.valueFormatter || function(y) { + return y = We(y) ? y : [y], Ke(y, function(x, g) { + return $1(x, We(v) ? v[g] : v, u); + }); + }; + if (!(a && o)) { + var h = s ? "" : r.markupStyleCreator.makeTooltipMarker(e.markerType, e.markerColor || "#333", i), f = a ? "" : $1(l, "ordinal", u), v = e.valueType, b = o ? [] : c(e.value), w = !s || !a, p = !s && a, d = YF(n, i), m = d.nameStyle, _ = d.valueStyle; + return i === "richText" ? (s ? "" : h) + (a ? "" : JF(r, f, m)) + (o ? "" : iq(r, b, w, p, _)) : Y1((s ? "" : h) + (a ? "" : rq(f, !s, m)) + (o ? "" : nq(b, w, p, _)), t); + } +} +function EO(r, e, t, n, i, a) { + if (r) { + var o = XF(r), s = { + useUTC: i, + renderMode: t, + orderMode: n, + markupStyleCreator: e, + valueFormatter: r.valueFormatter + }; + return o(s, r, 0, a); + } +} +function tq(r) { + return { + html: KQ[r], + richText: QQ[r] + }; +} +function Y1(r, e) { + var t = '
', n = "margin: " + e + "px 0 0"; + return '
' + r + t + "
"; +} +function rq(r, e, t) { + var n = e ? "margin-left:2px" : ""; + return '' + Ea(r) + ""; +} +function nq(r, e, t, n) { + var i = t ? "10px" : "20px", a = e ? "float:right;margin-left:" + i : ""; + return r = We(r) ? r : [r], '' + Ke(r, function(o) { + return Ea(o); + }).join("  ") + ""; +} +function JF(r, e, t) { + return r.markupStyleCreator.wrapRichTextStyle(e, t); +} +function iq(r, e, t, n, i) { + var a = [i], o = n ? 10 : 20; + return t && a.push({ + padding: [0, 0, 0, o], + align: "right" + }), r.markupStyleCreator.wrapRichTextStyle(We(e) ? e.join(" ") : e, a); +} +function KF(r, e) { + var t = r.getData().getItemVisual(e, "style"), n = t[r.visualDrawType]; + return Xh(n); +} +function QF(r, e) { + var t = r.get("padding"); + return t != null ? t : e === "richText" ? [8, 10] : 10; +} +var XS = ( + /** @class */ + function() { + function r() { + this.richTextStyles = {}, this._nextStyleNameId = Qj(); + } + return r.prototype._generateStyleName = function() { + return "__EC_aUTo_" + this._nextStyleNameId++; + }, r.prototype.makeTooltipMarker = function(e, t, n) { + var i = n === "richText" ? this._generateStyleName() : null, a = mF({ + color: t, + type: e, + renderMode: n, + markerId: i + }); + return ut(a) ? a : (this.richTextStyles[i] = a.style, a.content); + }, r.prototype.wrapRichTextStyle = function(e, t) { + var n = {}; + We(t) ? X(t, function(a) { + return Fe(n, a); + }) : Fe(n, t); + var i = this._generateStyleName(); + return this.richTextStyles[i] = n, "{" + i + "|" + e + "}"; + }, r; + }() +); +function qF(r) { + var e = r.series, t = r.dataIndex, n = r.multipleSeries, i = e.getData(), a = i.mapDimensionsAll("defaultedTooltip"), o = a.length, s = e.getRawValue(t), l = We(s), u = KF(e, t), c, h, f, v; + if (o > 1 || l && !o) { + var b = aq(s, e, t, a, u); + c = b.inlineValues, h = b.inlineValueTypes, f = b.blocks, v = b.inlineValues[0]; + } else if (o) { + var w = i.getDimensionInfo(a[0]); + v = c = Rd(i, t, a[0]), h = w.type; + } else + v = c = l ? s[0] : s; + var p = HI(e), d = p && e.name || "", m = i.getName(t), _ = n ? d : m; + return Di("section", { + header: d, + // When series name is not specified, do not show a header line with only '-'. + // This case always happens in tooltip.trigger: 'item'. + noHeader: n || !p, + sortParam: v, + blocks: [Di("nameValue", { + markerType: "item", + markerColor: u, + // Do not mix display seriesName and itemName in one tooltip, + // which might confuses users. + name: _, + // name dimension might be auto assigned, where the name might + // be not readable. So we check trim here. + noName: !Qo(_), + value: c, + valueType: h + })].concat(f || []) + }); +} +function aq(r, e, t, n, i) { + var a = e.getData(), o = es(r, function(h, f, v) { + var b = a.getDimensionInfo(v); + return h = h || b && b.tooltip !== !1 && b.displayName != null; + }, !1), s = [], l = [], u = []; + n.length ? X(n, function(h) { + c(Rd(a, t, h), h); + }) : X(r, c); + function c(h, f) { + var v = a.getDimensionInfo(f); + !v || v.otherDims.tooltip === !1 || (o ? u.push(Di("nameValue", { + markerType: "subItem", + markerColor: i, + name: v.displayName, + value: h, + valueType: v.type + })) : (s.push(h), l.push(v.type))); + } + return { + inlineValues: s, + inlineValueTypes: l, + blocks: u + }; +} +var Ru = Rr(); +function jy(r, e) { + return r.getName(e) || r.getId(e); +} +var V0 = "__universalTransitionEnabled", Kb = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t._selectedDataIndicesMap = {}, t; + } + return e.prototype.init = function(t, n, i) { + this.seriesIndex = this.componentIndex, this.dataTask = Yp({ + count: sq, + reset: lq + }), this.dataTask.context = { + model: this + }, this.mergeDefaultAndTheme(t, i); + var a = Ru(this).sourceManager = new UF(this); + a.prepareSource(); + var o = this.getInitialData(t, i); + DO(o, this), this.dataTask.context.data = o, Ru(this).dataBeforeProcessed = o, MO(this), this._initSelectedMapFromData(o); + }, e.prototype.mergeDefaultAndTheme = function(t, n) { + var i = bg(this), a = i ? rv(t) : {}, o = this.subType; + xr.hasClass(o) && (o += "Series"), Ut(t, n.getTheme().get(this.subType)), Ut(t, this.getDefaultOption()), Gh(t, "label", ["show"]), this.fillDataTextStyle(t.data), i && vc(t, a, i); + }, e.prototype.mergeOption = function(t, n) { + t = Ut(this.option, t, !0), this.fillDataTextStyle(t.data); + var i = bg(this); + i && vc(this.option, t, i); + var a = Ru(this).sourceManager; + a.dirty(), a.prepareSource(); + var o = this.getInitialData(t, n); + DO(o, this), this.dataTask.dirty(), this.dataTask.context.data = o, Ru(this).dataBeforeProcessed = o, MO(this), this._initSelectedMapFromData(o); + }, e.prototype.fillDataTextStyle = function(t) { + if (t && !no(t)) + for (var n = ["show"], i = 0; i < t.length; i++) + t[i] && t[i].label && Gh(t[i], "label", n); + }, e.prototype.getInitialData = function(t, n) { + }, e.prototype.appendData = function(t) { + var n = this.getRawData(); + n.appendData(t.data); + }, e.prototype.getData = function(t) { + var n = X1(this); + if (n) { + var i = n.context.data; + return t == null ? i : i.getLinkedData(t); + } else + return Ru(this).data; + }, e.prototype.getAllData = function() { + var t = this.getData(); + return t && t.getLinkedDataAll ? t.getLinkedDataAll() : [{ + data: t + }]; + }, e.prototype.setData = function(t) { + var n = X1(this); + if (n) { + var i = n.context; + i.outputData = t, n !== this.dataTask && (i.data = t); + } + Ru(this).data = t; + }, e.prototype.getEncode = function() { + var t = this.get("encode", !0); + if (t) + return xt(t); + }, e.prototype.getSourceManager = function() { + return Ru(this).sourceManager; + }, e.prototype.getSource = function() { + return this.getSourceManager().getSource(); + }, e.prototype.getRawData = function() { + return Ru(this).dataBeforeProcessed; + }, e.prototype.getColorBy = function() { + var t = this.get("colorBy"); + return t || "series"; + }, e.prototype.isColorBySeries = function() { + return this.getColorBy() === "series"; + }, e.prototype.getBaseAxis = function() { + var t = this.coordinateSystem; + return t && t.getBaseAxis && t.getBaseAxis(); + }, e.prototype.formatTooltip = function(t, n, i) { + return qF({ + series: this, + dataIndex: t, + multipleSeries: n + }); + }, e.prototype.isAnimationEnabled = function() { + var t = this.ecModel; + if (Dr.node && !(t && t.ssr)) + return !1; + var n = this.getShallow("animation"); + return n && this.getData().count() > this.getShallow("animationThreshold") && (n = !1), !!n; + }, e.prototype.restoreData = function() { + this.dataTask.dirty(); + }, e.prototype.getColorFromPalette = function(t, n, i) { + var a = this.ecModel, o = vA.prototype.getColorFromPalette.call(this, t, n, i); + return o || (o = a.getColorFromPalette(t, n, i)), o; + }, e.prototype.coordDimToDataDim = function(t) { + return this.getRawData().mapDimensionsAll(t); + }, e.prototype.getProgressive = function() { + return this.get("progressive"); + }, e.prototype.getProgressiveThreshold = function() { + return this.get("progressiveThreshold"); + }, e.prototype.select = function(t, n) { + this._innerSelect(this.getData(n), t); + }, e.prototype.unselect = function(t, n) { + var i = this.option.selectedMap; + if (i) { + var a = this.option.selectedMode, o = this.getData(n); + if (a === "series" || i === "all") { + this.option.selectedMap = {}, this._selectedDataIndicesMap = {}; + return; + } + for (var s = 0; s < t.length; s++) { + var l = t[s], u = jy(o, l); + i[u] = !1, this._selectedDataIndicesMap[u] = -1; + } + } + }, e.prototype.toggleSelect = function(t, n) { + for (var i = [], a = 0; a < t.length; a++) + i[0] = t[a], this.isSelected(t[a], n) ? this.unselect(i, n) : this.select(i, n); + }, e.prototype.getSelectedDataIndices = function() { + if (this.option.selectedMap === "all") + return [].slice.call(this.getData().getIndices()); + for (var t = this._selectedDataIndicesMap, n = yr(t), i = [], a = 0; a < n.length; a++) { + var o = t[n[a]]; + o >= 0 && i.push(o); + } + return i; + }, e.prototype.isSelected = function(t, n) { + var i = this.option.selectedMap; + if (!i) + return !1; + var a = this.getData(n); + return (i === "all" || i[jy(a, t)]) && !a.getItemModel(t).get(["select", "disabled"]); + }, e.prototype.isUniversalTransitionEnabled = function() { + if (this[V0]) + return !0; + var t = this.option.universalTransition; + return t ? t === !0 ? !0 : t && t.enabled : !1; + }, e.prototype._innerSelect = function(t, n) { + var i, a, o = this.option, s = o.selectedMode, l = n.length; + if (!(!s || !l)) { + if (s === "series") + o.selectedMap = "all"; + else if (s === "multiple") { + kt(o.selectedMap) || (o.selectedMap = {}); + for (var u = o.selectedMap, c = 0; c < l; c++) { + var h = n[c], f = jy(t, h); + u[f] = !0, this._selectedDataIndicesMap[f] = t.getRawIndex(h); + } + } else if (s === "single" || s === !0) { + var v = n[l - 1], f = jy(t, v); + o.selectedMap = (i = {}, i[f] = !0, i), this._selectedDataIndicesMap = (a = {}, a[f] = t.getRawIndex(v), a); + } + } + }, e.prototype._initSelectedMapFromData = function(t) { + if (!this.option.selectedMap) { + var n = []; + t.hasItemOption && t.each(function(i) { + var a = t.getRawDataItem(i); + a && a.selected && n.push(i); + }), n.length > 0 && this._innerSelect(t, n); + } + }, e.registerClass = function(t) { + return xr.registerClass(t); + }, e.protoInitialize = function() { + var t = e.prototype; + t.type = "series.__base__", t.seriesIndex = 0, t.ignoreStyleOnData = !1, t.hasSymbolVisual = !1, t.defaultSymbol = "circle", t.visualStyleAccessPath = "itemStyle", t.visualDrawType = "fill"; + }(), e; + }(xr) +); +qn(Kb, yA); +qn(Kb, vA); +s5(Kb, xr); +function MO(r) { + var e = r.name; + HI(r) || (r.name = oq(r) || e); +} +function oq(r) { + var e = r.getRawData(), t = e.mapDimensionsAll("seriesName"), n = []; + return X(t, function(i) { + var a = e.getDimensionInfo(i); + a.displayName && n.push(a.displayName); + }), n.join(" "); +} +function sq(r) { + return r.model.getRawData().count(); +} +function lq(r) { + var e = r.model; + return e.setData(e.getRawData().cloneShallow()), uq; +} +function uq(r, e) { + e.outputData && r.end > e.outputData.count() && e.model.getRawData().cloneShallow(e.outputData); +} +function DO(r, e) { + X(ag(r.CHANGABLE_METHODS, r.DOWNSAMPLE_METHODS), function(t) { + r.wrapMethod(t, jt(cq, e)); + }); +} +function cq(r, e) { + var t = X1(r); + return t && t.setOutputEnd((e || this).count()), e; +} +function X1(r) { + var e = (r.ecModel || {}).scheduler, t = e && e.getPipeline(r.uid); + if (t) { + var n = t.currentTask; + if (n) { + var i = n.agentStubMap; + i && (n = i.get(r.uid)); + } + return n; + } +} +const mn = Kb; +var bA = ( + /** @class */ + function() { + function r() { + this.group = new Rt(), this.uid = tv("viewComponent"); + } + return r.prototype.init = function(e, t) { + }, r.prototype.render = function(e, t, n, i) { + }, r.prototype.dispose = function(e, t) { + }, r.prototype.updateView = function(e, t, n, i) { + }, r.prototype.updateLayout = function(e, t, n, i) { + }, r.prototype.updateVisual = function(e, t, n, i) { + }, r.prototype.toggleBlurSeries = function(e, t, n) { + }, r.prototype.eachRendered = function(e) { + var t = this.group; + t && t.traverse(e); + }, r; + }() +); +GI(bA); +kb(bA); +const Sn = bA; +function ov() { + var r = Rr(); + return function(e) { + var t = r(e), n = e.pipelineContext, i = !!t.large, a = !!t.progressiveRender, o = t.large = !!(n && n.large), s = t.progressiveRender = !!(n && n.progressiveRender); + return (i !== o || a !== s) && "reset"; + }; +} +var e4 = Rr(), hq = ov(), xA = ( + /** @class */ + function() { + function r() { + this.group = new Rt(), this.uid = tv("viewChart"), this.renderTask = Yp({ + plan: fq, + reset: dq + }), this.renderTask.context = { + view: this + }; + } + return r.prototype.init = function(e, t) { + }, r.prototype.render = function(e, t, n, i) { + }, r.prototype.highlight = function(e, t, n, i) { + var a = e.getData(i && i.dataType); + a && OO(a, i, "emphasis"); + }, r.prototype.downplay = function(e, t, n, i) { + var a = e.getData(i && i.dataType); + a && OO(a, i, "normal"); + }, r.prototype.remove = function(e, t) { + this.group.removeAll(); + }, r.prototype.dispose = function(e, t) { + }, r.prototype.updateView = function(e, t, n, i) { + this.render(e, t, n, i); + }, r.prototype.updateLayout = function(e, t, n, i) { + this.render(e, t, n, i); + }, r.prototype.updateVisual = function(e, t, n, i) { + this.render(e, t, n, i); + }, r.prototype.eachRendered = function(e) { + Cc(this.group, e); + }, r.markUpdateMethod = function(e, t) { + e4(e).updateMethod = t; + }, r.protoInitialize = function() { + var e = r.prototype; + e.type = "chart"; + }(), r; + }() +); +function kO(r, e, t) { + r && gg(r) && (e === "emphasis" ? tu : ru)(r, t); +} +function OO(r, e, t) { + var n = Uh(r, e), i = e && e.highlightKey != null ? FJ(e.highlightKey) : null; + n != null ? X(ln(n), function(a) { + kO(r.getItemGraphicEl(a), t, i); + }) : r.eachItemGraphicEl(function(a) { + kO(a, t, i); + }); +} +GI(xA); +kb(xA); +function fq(r) { + return hq(r.model); +} +function dq(r) { + var e = r.model, t = r.ecModel, n = r.api, i = r.payload, a = e.pipelineContext.progressiveRender, o = r.view, s = i && e4(i).updateMethod, l = a ? "incrementalPrepareRender" : s && o[s] ? s : "render"; + return l !== "render" && o[l](e, t, n, i), vq[l]; +} +var vq = { + incrementalPrepareRender: { + progress: function(r, e) { + e.view.incrementalRender(r, e.model, e.ecModel, e.api, e.payload); + } + }, + render: { + // Put view.render in `progress` to support appendData. But in this case + // view.render should not be called in reset, otherwise it will be called + // twise. Use `forceFirstProgress` to make sure that view.render is called + // in any cases. + forceFirstProgress: !0, + progress: function(r, e) { + e.view.render(e.model, e.ecModel, e.api, e.payload); + } + } +}; +const en = xA; +var C_ = "\0__throttleOriginMethod", LO = "\0__throttleRate", PO = "\0__throttleType"; +function Zh(r, e, t) { + var n, i = 0, a = 0, o = null, s, l, u, c; + e = e || 0; + function h() { + a = (/* @__PURE__ */ new Date()).getTime(), o = null, r.apply(l, u || []); + } + var f = function() { + for (var v = [], b = 0; b < arguments.length; b++) + v[b] = arguments[b]; + n = (/* @__PURE__ */ new Date()).getTime(), l = this, u = v; + var w = c || e, p = c || t; + c = null, s = n - (p ? i : a) - w, clearTimeout(o), p ? o = setTimeout(h, w) : s >= 0 ? h() : o = setTimeout(h, -s), i = n; + }; + return f.clear = function() { + o && (clearTimeout(o), o = null); + }, f.debounceNextCall = function(v) { + c = v; + }, f; +} +function sv(r, e, t, n) { + var i = r[e]; + if (i) { + var a = i[C_] || i, o = i[PO], s = i[LO]; + if (s !== t || o !== n) { + if (t == null || !n) + return r[e] = a; + i = r[e] = Zh(a, t, n === "debounce"), i[C_] = a, i[PO] = n, i[LO] = t; + } + return i; + } +} +function Sg(r, e) { + var t = r[e]; + t && t[C_] && (t.clear && t.clear(), r[e] = t[C_]); +} +var RO = Rr(), NO = { + itemStyle: Wh(sF, !0), + lineStyle: Wh(oF, !0) +}, pq = { + lineStyle: "stroke", + itemStyle: "fill" +}; +function t4(r, e) { + var t = r.visualStyleMapper || NO[e]; + return t || (console.warn("Unknown style type '" + e + "'."), NO.itemStyle); +} +function r4(r, e) { + var t = r.visualDrawType || pq[e]; + return t || (console.warn("Unknown style type '" + e + "'."), "fill"); +} +var gq = { + createOnAllSeries: !0, + performRawSeries: !0, + reset: function(r, e) { + var t = r.getData(), n = r.visualStyleAccessPath || "itemStyle", i = r.getModel(n), a = t4(r, n), o = a(i), s = i.getShallow("decal"); + s && (t.setVisual("decal", s), s.dirty = !0); + var l = r4(r, n), u = o[l], c = Tt(u) ? u : null, h = o.fill === "auto" || o.stroke === "auto"; + if (!o[l] || c || h) { + var f = r.getColorFromPalette( + // TODO series count changed. + r.name, + null, + e.getSeriesCount() + ); + o[l] || (o[l] = f, t.setVisual("colorFromPalette", !0)), o.fill = o.fill === "auto" || Tt(o.fill) ? f : o.fill, o.stroke = o.stroke === "auto" || Tt(o.stroke) ? f : o.stroke; + } + if (t.setVisual("style", o), t.setVisual("drawType", l), !e.isSeriesFiltered(r) && c) + return t.setVisual("colorFromPalette", !1), { + dataEach: function(v, b) { + var w = r.getDataParams(b), p = Fe({}, o); + p[l] = c(w), v.setItemVisual(b, "style", p); + } + }; + } +}, np = new qr(), mq = { + createOnAllSeries: !0, + performRawSeries: !0, + reset: function(r, e) { + if (!(r.ignoreStyleOnData || e.isSeriesFiltered(r))) { + var t = r.getData(), n = r.visualStyleAccessPath || "itemStyle", i = t4(r, n), a = t.getVisual("drawType"); + return { + dataEach: t.hasItemOption ? function(o, s) { + var l = o.getRawDataItem(s); + if (l && l[n]) { + np.option = l[n]; + var u = i(np), c = o.ensureUniqueItemVisual(s, "style"); + Fe(c, u), np.option.decal && (o.setItemVisual(s, "decal", np.option.decal), np.option.decal.dirty = !0), a in u && o.setItemVisual(s, "colorFromPalette", !1); + } + } : null + }; + } + } +}, yq = { + performRawSeries: !0, + overallReset: function(r) { + var e = xt(); + r.eachSeries(function(t) { + var n = t.getColorBy(); + if (!t.isColorBySeries()) { + var i = t.type + "-" + n, a = e.get(i); + a || (a = {}, e.set(i, a)), RO(t).scope = a; + } + }), r.eachSeries(function(t) { + if (!(t.isColorBySeries() || r.isSeriesFiltered(t))) { + var n = t.getRawData(), i = {}, a = t.getData(), o = RO(t).scope, s = t.visualStyleAccessPath || "itemStyle", l = r4(t, s); + a.each(function(u) { + var c = a.getRawIndex(u); + i[c] = u; + }), n.each(function(u) { + var c = i[u], h = a.getItemVisual(c, "colorFromPalette"); + if (h) { + var f = a.ensureUniqueItemVisual(c, "style"), v = n.getName(u) || u + "", b = n.count(); + f[l] = t.getColorFromPalette(v, o, b); + } + }); + } + }); + } +}, Fy = Math.PI; +function _q(r, e) { + e = e || {}, Mt(e, { + text: "loading", + textColor: "#000", + fontSize: 12, + fontWeight: "normal", + fontStyle: "normal", + fontFamily: "sans-serif", + maskColor: "rgba(255, 255, 255, 0.8)", + showSpinner: !0, + color: "#5470c6", + spinnerRadius: 10, + lineWidth: 5, + zlevel: 0 + }); + var t = new Rt(), n = new Or({ + style: { + fill: e.maskColor + }, + zlevel: e.zlevel, + z: 1e4 + }); + t.add(n); + var i = new kr({ + style: { + text: e.text, + fill: e.textColor, + fontSize: e.fontSize, + fontWeight: e.fontWeight, + fontStyle: e.fontStyle, + fontFamily: e.fontFamily + }, + zlevel: e.zlevel, + z: 10001 + }), a = new Or({ + style: { + fill: "none" + }, + textContent: i, + textConfig: { + position: "right", + distance: 10 + }, + zlevel: e.zlevel, + z: 10001 + }); + t.add(a); + var o; + return e.showSpinner && (o = new Bb({ + shape: { + startAngle: -Fy / 2, + endAngle: -Fy / 2 + 0.1, + r: e.spinnerRadius + }, + style: { + stroke: e.color, + lineCap: "round", + lineWidth: e.lineWidth + }, + zlevel: e.zlevel, + z: 10001 + }), o.animateShape(!0).when(1e3, { + endAngle: Fy * 3 / 2 + }).start("circularInOut"), o.animateShape(!0).when(1e3, { + startAngle: Fy * 3 / 2 + }).delay(300).start("circularInOut"), t.add(o)), t.resize = function() { + var s = i.getBoundingRect().width, l = e.showSpinner ? e.spinnerRadius : 0, u = (r.getWidth() - l * 2 - (e.showSpinner && s ? 10 : 0) - s) / 2 - (e.showSpinner && s ? 0 : 5 + s / 2) + (e.showSpinner ? 0 : s / 2) + (s ? 0 : l), c = r.getHeight() / 2; + e.showSpinner && o.setShape({ + cx: u, + cy: c + }), a.setShape({ + x: u - l, + y: c - l, + width: l * 2, + height: l * 2 + }), n.setShape({ + x: 0, + y: 0, + width: r.getWidth(), + height: r.getHeight() + }); + }, t.resize(), t; +} +var bq = ( + /** @class */ + function() { + function r(e, t, n, i) { + this._stageTaskMap = xt(), this.ecInstance = e, this.api = t, n = this._dataProcessorHandlers = n.slice(), i = this._visualHandlers = i.slice(), this._allHandlers = n.concat(i); + } + return r.prototype.restoreData = function(e, t) { + e.restoreData(t), this._stageTaskMap.each(function(n) { + var i = n.overallTask; + i && i.dirty(); + }); + }, r.prototype.getPerformArgs = function(e, t) { + if (e.__pipeline) { + var n = this._pipelineMap.get(e.__pipeline.id), i = n.context, a = !t && n.progressiveEnabled && (!i || i.progressiveRender) && e.__idxInPipeline > n.blockIndex, o = a ? n.step : null, s = i && i.modDataCount, l = s != null ? Math.ceil(s / o) : null; + return { + step: o, + modBy: l, + modDataCount: s + }; + } + }, r.prototype.getPipeline = function(e) { + return this._pipelineMap.get(e); + }, r.prototype.updateStreamModes = function(e, t) { + var n = this._pipelineMap.get(e.uid), i = e.getData(), a = i.count(), o = n.progressiveEnabled && t.incrementalPrepareRender && a >= n.threshold, s = e.get("large") && a >= e.get("largeThreshold"), l = e.get("progressiveChunkMode") === "mod" ? a : null; + e.pipelineContext = n.context = { + progressiveRender: o, + modDataCount: l, + large: s + }; + }, r.prototype.restorePipelines = function(e) { + var t = this, n = t._pipelineMap = xt(); + e.eachSeries(function(i) { + var a = i.getProgressive(), o = i.uid; + n.set(o, { + id: o, + head: null, + tail: null, + threshold: i.getProgressiveThreshold(), + progressiveEnabled: a && !(i.preventIncremental && i.preventIncremental()), + blockIndex: -1, + step: Math.round(a || 700), + count: 0 + }), t._pipe(i, i.dataTask); + }); + }, r.prototype.prepareStageTasks = function() { + var e = this._stageTaskMap, t = this.api.getModel(), n = this.api; + X(this._allHandlers, function(i) { + var a = e.get(i.uid) || e.set(i.uid, {}), o = ""; + pa(!(i.reset && i.overallReset), o), i.reset && this._createSeriesStageTask(i, a, t, n), i.overallReset && this._createOverallStageTask(i, a, t, n); + }, this); + }, r.prototype.prepareView = function(e, t, n, i) { + var a = e.renderTask, o = a.context; + o.model = t, o.ecModel = n, o.api = i, a.__block = !e.incrementalPrepareRender, this._pipe(t, a); + }, r.prototype.performDataProcessorTasks = function(e, t) { + this._performStageTasks(this._dataProcessorHandlers, e, t, { + block: !0 + }); + }, r.prototype.performVisualTasks = function(e, t, n) { + this._performStageTasks(this._visualHandlers, e, t, n); + }, r.prototype._performStageTasks = function(e, t, n, i) { + i = i || {}; + var a = !1, o = this; + X(e, function(l, u) { + if (!(i.visualType && i.visualType !== l.visualType)) { + var c = o._stageTaskMap.get(l.uid), h = c.seriesTaskMap, f = c.overallTask; + if (f) { + var v, b = f.agentStubMap; + b.each(function(p) { + s(i, p) && (p.dirty(), v = !0); + }), v && f.dirty(), o.updatePayload(f, n); + var w = o.getPerformArgs(f, i.block); + b.each(function(p) { + p.perform(w); + }), f.perform(w) && (a = !0); + } else + h && h.each(function(p, d) { + s(i, p) && p.dirty(); + var m = o.getPerformArgs(p, i.block); + m.skip = !l.performRawSeries && t.isSeriesFiltered(p.context.model), o.updatePayload(p, n), p.perform(m) && (a = !0); + }); + } + }); + function s(l, u) { + return l.setDirty && (!l.dirtyMap || l.dirtyMap.get(u.__pipeline.id)); + } + this.unfinished = a || this.unfinished; + }, r.prototype.performSeriesTasks = function(e) { + var t; + e.eachSeries(function(n) { + t = n.dataTask.perform() || t; + }), this.unfinished = t || this.unfinished; + }, r.prototype.plan = function() { + this._pipelineMap.each(function(e) { + var t = e.tail; + do { + if (t.__block) { + e.blockIndex = t.__idxInPipeline; + break; + } + t = t.getUpstream(); + } while (t); + }); + }, r.prototype.updatePayload = function(e, t) { + t !== "remain" && (e.context.payload = t); + }, r.prototype._createSeriesStageTask = function(e, t, n, i) { + var a = this, o = t.seriesTaskMap, s = t.seriesTaskMap = xt(), l = e.seriesType, u = e.getTargetSeries; + e.createOnAllSeries ? n.eachRawSeries(c) : l ? n.eachRawSeriesByType(l, c) : u && u(n, i).each(c); + function c(h) { + var f = h.uid, v = s.set(f, o && o.get(f) || Yp({ + plan: Tq, + reset: Iq, + count: Eq + })); + v.context = { + model: h, + ecModel: n, + api: i, + // PENDING: `useClearVisual` not used? + useClearVisual: e.isVisual && !e.isLayout, + plan: e.plan, + reset: e.reset, + scheduler: a + }, a._pipe(h, v); + } + }, r.prototype._createOverallStageTask = function(e, t, n, i) { + var a = this, o = t.overallTask = t.overallTask || Yp({ + reset: xq + }); + o.context = { + ecModel: n, + api: i, + overallReset: e.overallReset, + scheduler: a + }; + var s = o.agentStubMap, l = o.agentStubMap = xt(), u = e.seriesType, c = e.getTargetSeries, h = !0, f = !1, v = ""; + pa(!e.createOnAllSeries, v), u ? n.eachRawSeriesByType(u, b) : c ? c(n, i).each(b) : (h = !1, X(n.getSeries(), b)); + function b(w) { + var p = w.uid, d = l.set(p, s && s.get(p) || // When the result of `getTargetSeries` changed, the overallTask + // should be set as dirty and re-performed. + (f = !0, Yp({ + reset: Sq, + onDirty: Cq + }))); + d.context = { + model: w, + overallProgress: h + // FIXME:TS never used, so comment it + // modifyOutputEnd: modifyOutputEnd + }, d.agent = o, d.__block = h, a._pipe(w, d); + } + f && o.dirty(); + }, r.prototype._pipe = function(e, t) { + var n = e.uid, i = this._pipelineMap.get(n); + !i.head && (i.head = t), i.tail && i.tail.pipe(t), i.tail = t, t.__idxInPipeline = i.count++, t.__pipeline = i; + }, r.wrapStageHandler = function(e, t) { + return Tt(e) && (e = { + overallReset: e, + seriesType: Mq(e) + }), e.uid = tv("stageHandler"), t && (e.visualType = t), e; + }, r; + }() +); +function xq(r) { + r.overallReset(r.ecModel, r.api, r.payload); +} +function Sq(r) { + return r.overallProgress && wq; +} +function wq() { + this.agent.dirty(), this.getDownstream().dirty(); +} +function Cq() { + this.agent && this.agent.dirty(); +} +function Tq(r) { + return r.plan ? r.plan(r.model, r.ecModel, r.api, r.payload) : null; +} +function Iq(r) { + r.useClearVisual && r.data.clearAllVisual(); + var e = r.resetDefines = ln(r.reset(r.model, r.ecModel, r.api, r.payload)); + return e.length > 1 ? Ke(e, function(t, n) { + return n4(n); + }) : Aq; +} +var Aq = n4(0); +function n4(r) { + return function(e, t) { + var n = t.data, i = t.resetDefines[r]; + if (i && i.dataEach) + for (var a = e.start; a < e.end; a++) + i.dataEach(n, a); + else + i && i.progress && i.progress(e, n); + }; +} +function Eq(r) { + return r.data.count(); +} +function Mq(r) { + T_ = null; + try { + r(wg, i4); + } catch (e) { + } + return T_; +} +var wg = {}, i4 = {}, T_; +a4(wg, MF); +a4(i4, DF); +wg.eachSeriesByType = wg.eachRawSeriesByType = function(r) { + T_ = r; +}; +wg.eachComponent = function(r) { + r.mainType === "series" && r.subType && (T_ = r.subType); +}; +function a4(r, e) { + for (var t in e.prototype) + r[t] = Qn; +} +const o4 = bq; +var zO = ["#37A2DA", "#32C5E9", "#67E0E3", "#9FE6B8", "#FFDB5C", "#ff9f7f", "#fb7293", "#E062AE", "#E690D1", "#e7bcf3", "#9d96f5", "#8378EA", "#96BFFF"]; +const Dq = { + color: zO, + colorLayer: [["#37A2DA", "#ffd85c", "#fd7b5f"], ["#37A2DA", "#67E0E3", "#FFDB5C", "#ff9f7f", "#E062AE", "#9d96f5"], ["#37A2DA", "#32C5E9", "#9FE6B8", "#FFDB5C", "#ff9f7f", "#fb7293", "#e7bcf3", "#8378EA", "#96BFFF"], zO] +}; +var wa = "#B9B8CE", BO = "#100C2A", $y = function() { + return { + axisLine: { + lineStyle: { + color: wa + } + }, + splitLine: { + lineStyle: { + color: "#484753" + } + }, + splitArea: { + areaStyle: { + color: ["rgba(255,255,255,0.02)", "rgba(255,255,255,0.05)"] + } + }, + minorSplitLine: { + lineStyle: { + color: "#20203B" + } + } + }; +}, jO = ["#4992ff", "#7cffb2", "#fddd60", "#ff6e76", "#58d9f9", "#05c091", "#ff8a45", "#8d48e3", "#dd79ff"], s4 = { + darkMode: !0, + color: jO, + backgroundColor: BO, + axisPointer: { + lineStyle: { + color: "#817f91" + }, + crossStyle: { + color: "#817f91" + }, + label: { + // TODO Contrast of label backgorundColor + color: "#fff" + } + }, + legend: { + textStyle: { + color: wa + } + }, + textStyle: { + color: wa + }, + title: { + textStyle: { + color: "#EEF1FA" + }, + subtextStyle: { + color: "#B9B8CE" + } + }, + toolbox: { + iconStyle: { + borderColor: wa + } + }, + dataZoom: { + borderColor: "#71708A", + textStyle: { + color: wa + }, + brushStyle: { + color: "rgba(135,163,206,0.3)" + }, + handleStyle: { + color: "#353450", + borderColor: "#C5CBE3" + }, + moveHandleStyle: { + color: "#B0B6C3", + opacity: 0.3 + }, + fillerColor: "rgba(135,163,206,0.2)", + emphasis: { + handleStyle: { + borderColor: "#91B7F2", + color: "#4D587D" + }, + moveHandleStyle: { + color: "#636D9A", + opacity: 0.7 + } + }, + dataBackground: { + lineStyle: { + color: "#71708A", + width: 1 + }, + areaStyle: { + color: "#71708A" + } + }, + selectedDataBackground: { + lineStyle: { + color: "#87A3CE" + }, + areaStyle: { + color: "#87A3CE" + } + } + }, + visualMap: { + textStyle: { + color: wa + } + }, + timeline: { + lineStyle: { + color: wa + }, + label: { + color: wa + }, + controlStyle: { + color: wa, + borderColor: wa + } + }, + calendar: { + itemStyle: { + color: BO + }, + dayLabel: { + color: wa + }, + monthLabel: { + color: wa + }, + yearLabel: { + color: wa + } + }, + timeAxis: $y(), + logAxis: $y(), + valueAxis: $y(), + categoryAxis: $y(), + line: { + symbol: "circle" + }, + graph: { + color: jO + }, + gauge: { + title: { + color: wa + }, + axisLine: { + lineStyle: { + color: [[1, "rgba(207,212,219,0.2)"]] + } + }, + axisLabel: { + color: wa + }, + detail: { + color: "#EEF1FA" + } + }, + candlestick: { + itemStyle: { + color: "#f64e56", + color0: "#54ea92", + borderColor: "#f64e56", + borderColor0: "#54ea92" + // borderColor: '#ca2824', + // borderColor0: '#09a443' + } + } +}; +s4.categoryAxis.splitLine.show = !1; +const kq = s4; +var Oq = ( + /** @class */ + function() { + function r() { + } + return r.prototype.normalizeQuery = function(e) { + var t = {}, n = {}, i = {}; + if (ut(e)) { + var a = gl(e); + t.mainType = a.main || null, t.subType = a.sub || null; + } else { + var o = ["Index", "Name", "Id"], s = { + name: 1, + dataIndex: 1, + dataType: 1 + }; + X(e, function(l, u) { + for (var c = !1, h = 0; h < o.length; h++) { + var f = o[h], v = u.lastIndexOf(f); + if (v > 0 && v === u.length - f.length) { + var b = u.slice(0, v); + b !== "data" && (t.mainType = b, t[f.toLowerCase()] = l, c = !0); + } + } + s.hasOwnProperty(u) && (n[u] = l, c = !0), c || (i[u] = l); + }); + } + return { + cptQuery: t, + dataQuery: n, + otherQuery: i + }; + }, r.prototype.filter = function(e, t) { + var n = this.eventInfo; + if (!n) + return !0; + var i = n.targetEl, a = n.packedEvent, o = n.model, s = n.view; + if (!o || !s) + return !0; + var l = t.cptQuery, u = t.dataQuery; + return c(l, o, "mainType") && c(l, o, "subType") && c(l, o, "index", "componentIndex") && c(l, o, "name") && c(l, o, "id") && c(u, a, "name") && c(u, a, "dataIndex") && c(u, a, "dataType") && (!s.filterForExposedEvent || s.filterForExposedEvent(e, t.otherQuery, i, a)); + function c(h, f, v, b) { + return h[v] == null || f[b || v] === h[v]; + } + }, r.prototype.afterTrigger = function() { + this.eventInfo = null; + }, r; + }() +), Z1 = ["symbol", "symbolSize", "symbolRotate", "symbolOffset"], FO = Z1.concat(["symbolKeepAspect"]), Lq = { + createOnAllSeries: !0, + // For legend. + performRawSeries: !0, + reset: function(r, e) { + var t = r.getData(); + if (r.legendIcon && t.setVisual("legendIcon", r.legendIcon), !r.hasSymbolVisual) + return; + for (var n = {}, i = {}, a = !1, o = 0; o < Z1.length; o++) { + var s = Z1[o], l = r.get(s); + Tt(l) ? (a = !0, i[s] = l) : n[s] = l; + } + if (n.symbol = n.symbol || r.defaultSymbol, t.setVisual(Fe({ + legendIcon: r.legendIcon || n.symbol, + symbolKeepAspect: r.get("symbolKeepAspect") + }, n)), e.isSeriesFiltered(r)) + return; + var u = yr(i); + function c(h, f) { + for (var v = r.getRawValue(f), b = r.getDataParams(f), w = 0; w < u.length; w++) { + var p = u[w]; + h.setItemVisual(f, p, i[p](v, b)); + } + } + return { + dataEach: a ? c : null + }; + } +}, Pq = { + createOnAllSeries: !0, + // For legend. + performRawSeries: !0, + reset: function(r, e) { + if (!r.hasSymbolVisual || e.isSeriesFiltered(r)) + return; + var t = r.getData(); + function n(i, a) { + for (var o = i.getItemModel(a), s = 0; s < FO.length; s++) { + var l = FO[s], u = o.getShallow(l, !0); + u != null && i.setItemVisual(a, l, u); + } + } + return { + dataEach: t.hasItemOption ? n : null + }; + } +}; +function SA(r, e, t) { + switch (t) { + case "color": + var n = r.getItemVisual(e, "style"); + return n[r.getVisual("drawType")]; + case "opacity": + return r.getItemVisual(e, "style").opacity; + case "symbol": + case "symbolSize": + case "liftZ": + return r.getItemVisual(e, t); + } +} +function im(r, e) { + switch (e) { + case "color": + var t = r.getVisual("style"); + return t[r.getVisual("drawType")]; + case "opacity": + return r.getVisual("style").opacity; + case "symbol": + case "symbolSize": + case "liftZ": + return r.getVisual(e); + } +} +function l4(r, e, t, n) { + switch (t) { + case "color": + var i = r.ensureUniqueItemVisual(e, "style"); + i[r.getVisual("drawType")] = n, r.setItemVisual(e, "colorFromPalette", !1); + break; + case "opacity": + r.ensureUniqueItemVisual(e, "style").opacity = n; + break; + case "symbol": + case "symbolSize": + case "liftZ": + r.setItemVisual(e, t, n); + break; + } +} +function u4(r, e) { + function t(n, i) { + var a = []; + return n.eachComponent({ + mainType: "series", + subType: r, + query: i + }, function(o) { + a.push(o.seriesIndex); + }), a; + } + X([[r + "ToggleSelect", "toggleSelect"], [r + "Select", "select"], [r + "UnSelect", "unselect"]], function(n) { + e(n[0], function(i, a, o) { + i = Fe({}, i), o.dispatchAction(Fe(i, { + type: n[1], + seriesIndex: t(a, i) + })); + }); + }); +} +function Wf(r, e, t, n, i) { + var a = r + e; + t.isSilent(a) || n.eachComponent({ + mainType: "series", + subType: "pie" + }, function(o) { + for (var s = o.seriesIndex, l = o.option.selectedMap, u = i.selected, c = 0; c < u.length; c++) + if (u[c].seriesIndex === s) { + var h = o.getData(), f = Uh(h, i.fromActionPayload); + t.trigger(a, { + type: a, + seriesId: o.id, + name: We(f) ? h.getName(f[0]) : h.getName(f), + selected: ut(l) ? l : Fe({}, l) + }); + } + }); +} +function Rq(r, e, t) { + r.on("selectchanged", function(n) { + var i = t.getModel(); + n.isFromClick ? (Wf("map", "selectchanged", e, i, n), Wf("pie", "selectchanged", e, i, n)) : n.fromAction === "select" ? (Wf("map", "selected", e, i, n), Wf("pie", "selected", e, i, n)) : n.fromAction === "unselect" && (Wf("map", "unselected", e, i, n), Wf("pie", "unselected", e, i, n)); + }); +} +function Mh(r, e, t) { + for (var n; r && !(e(r) && (n = r, t)); ) + r = r.__hostTarget || r.parent; + return n; +} +var Nq = Math.round(Math.random() * 9), zq = typeof Object.defineProperty == "function", Bq = function() { + function r() { + this._id = "__ec_inner_" + Nq++; + } + return r.prototype.get = function(e) { + return this._guard(e)[this._id]; + }, r.prototype.set = function(e, t) { + var n = this._guard(e); + return zq ? Object.defineProperty(n, this._id, { + value: t, + enumerable: !1, + configurable: !0 + }) : n[this._id] = t, this; + }, r.prototype.delete = function(e) { + return this.has(e) ? (delete this._guard(e)[this._id], !0) : !1; + }, r.prototype.has = function(e) { + return !!this._guard(e)[this._id]; + }, r.prototype._guard = function(e) { + if (e !== Object(e)) + throw TypeError("Value of WeakMap is not a non-null object."); + return e; + }, r; +}(); +const jq = Bq; +var Fq = hr.extend({ + type: "triangle", + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function(r, e) { + var t = e.cx, n = e.cy, i = e.width / 2, a = e.height / 2; + r.moveTo(t, n - a), r.lineTo(t + i, n + a), r.lineTo(t - i, n + a), r.closePath(); + } +}), $q = hr.extend({ + type: "diamond", + shape: { + cx: 0, + cy: 0, + width: 0, + height: 0 + }, + buildPath: function(r, e) { + var t = e.cx, n = e.cy, i = e.width / 2, a = e.height / 2; + r.moveTo(t, n - a), r.lineTo(t + i, n), r.lineTo(t, n + a), r.lineTo(t - i, n), r.closePath(); + } +}), Hq = hr.extend({ + type: "pin", + shape: { + // x, y on the cusp + x: 0, + y: 0, + width: 0, + height: 0 + }, + buildPath: function(r, e) { + var t = e.x, n = e.y, i = e.width / 5 * 3, a = Math.max(i, e.height), o = i / 2, s = o * o / (a - o), l = n - a + o + s, u = Math.asin(s / o), c = Math.cos(u) * o, h = Math.sin(u), f = Math.cos(u), v = o * 0.6, b = o * 0.7; + r.moveTo(t - c, l + s), r.arc(t, l, o, Math.PI - u, Math.PI * 2 + u), r.bezierCurveTo(t + c - h * v, l + s + f * v, t, n - b, t, n), r.bezierCurveTo(t, n - b, t - c + h * v, l + s + f * v, t - c, l + s), r.closePath(); + } +}), Vq = hr.extend({ + type: "arrow", + shape: { + x: 0, + y: 0, + width: 0, + height: 0 + }, + buildPath: function(r, e) { + var t = e.height, n = e.width, i = e.x, a = e.y, o = n / 3 * 2; + r.moveTo(i, a), r.lineTo(i + o, a + t), r.lineTo(i, a + t / 4 * 3), r.lineTo(i - o, a + t), r.lineTo(i, a), r.closePath(); + } +}), Gq = { + line: Ai, + rect: Or, + roundRect: Or, + square: Or, + circle: $s, + diamond: $q, + pin: Hq, + arrow: Vq, + triangle: Fq +}, Uq = { + line: function(r, e, t, n, i) { + i.x1 = r, i.y1 = e + n / 2, i.x2 = r + t, i.y2 = e + n / 2; + }, + rect: function(r, e, t, n, i) { + i.x = r, i.y = e, i.width = t, i.height = n; + }, + roundRect: function(r, e, t, n, i) { + i.x = r, i.y = e, i.width = t, i.height = n, i.r = Math.min(t, n) / 4; + }, + square: function(r, e, t, n, i) { + var a = Math.min(t, n); + i.x = r, i.y = e, i.width = a, i.height = a; + }, + circle: function(r, e, t, n, i) { + i.cx = r + t / 2, i.cy = e + n / 2, i.r = Math.min(t, n) / 2; + }, + diamond: function(r, e, t, n, i) { + i.cx = r + t / 2, i.cy = e + n / 2, i.width = t, i.height = n; + }, + pin: function(r, e, t, n, i) { + i.x = r + t / 2, i.y = e + n / 2, i.width = t, i.height = n; + }, + arrow: function(r, e, t, n, i) { + i.x = r + t / 2, i.y = e + n / 2, i.width = t, i.height = n; + }, + triangle: function(r, e, t, n, i) { + i.cx = r + t / 2, i.cy = e + n / 2, i.width = t, i.height = n; + } +}, I_ = {}; +X(Gq, function(r, e) { + I_[e] = new r(); +}); +var Wq = hr.extend({ + type: "symbol", + shape: { + symbolType: "", + x: 0, + y: 0, + width: 0, + height: 0 + }, + calculateTextPosition: function(r, e, t) { + var n = p_(r, e, t), i = this.shape; + return i && i.symbolType === "pin" && e.position === "inside" && (n.y = t.y + t.height * 0.4), n; + }, + buildPath: function(r, e, t) { + var n = e.symbolType; + if (n !== "none") { + var i = I_[n]; + i || (n = "rect", i = I_[n]), Uq[n](e.x, e.y, e.width, e.height, i.shape), i.buildPath(r, i.shape, t); + } + } +}); +function Yq(r, e) { + if (this.type !== "image") { + var t = this.style; + this.__isEmptyBrush ? (t.stroke = r, t.fill = e || "#fff", t.lineWidth = 2) : this.shape.symbolType === "line" ? t.stroke = r : t.fill = r, this.markRedraw(); + } +} +function li(r, e, t, n, i, a, o) { + var s = r.indexOf("empty") === 0; + s && (r = r.substr(5, 1).toLowerCase() + r.substr(6)); + var l; + return r.indexOf("image://") === 0 ? l = eA(r.slice(8), new Wt(e, t, n, i), o ? "center" : "cover") : r.indexOf("path://") === 0 ? l = em(r.slice(7), {}, new Wt(e, t, n, i), o ? "center" : "cover") : l = new Wq({ + shape: { + symbolType: r, + x: e, + y: t, + width: n, + height: i + } + }), l.__isEmptyBrush = s, l.setColor = Yq, a && l.setColor(a), l; +} +function lv(r) { + return We(r) || (r = [+r, +r]), [r[0] || 0, r[1] || 0]; +} +function sf(r, e) { + if (r != null) + return We(r) || (r = [r, r]), [ot(r[0], e[0]) || 0, ot(Jt(r[1], r[0]), e[1]) || 0]; +} +function Dh(r) { + return isFinite(r); +} +function Xq(r, e, t) { + var n = e.x == null ? 0 : e.x, i = e.x2 == null ? 1 : e.x2, a = e.y == null ? 0 : e.y, o = e.y2 == null ? 0 : e.y2; + e.global || (n = n * t.width + t.x, i = i * t.width + t.x, a = a * t.height + t.y, o = o * t.height + t.y), n = Dh(n) ? n : 0, i = Dh(i) ? i : 1, a = Dh(a) ? a : 0, o = Dh(o) ? o : 0; + var s = r.createLinearGradient(n, a, i, o); + return s; +} +function Zq(r, e, t) { + var n = t.width, i = t.height, a = Math.min(n, i), o = e.x == null ? 0.5 : e.x, s = e.y == null ? 0.5 : e.y, l = e.r == null ? 0.5 : e.r; + e.global || (o = o * n + t.x, s = s * i + t.y, l = l * a), o = Dh(o) ? o : 0.5, s = Dh(s) ? s : 0.5, l = l >= 0 && Dh(l) ? l : 0.5; + var u = r.createRadialGradient(o, s, 0, o, s, l); + return u; +} +function J1(r, e, t) { + for (var n = e.type === "radial" ? Zq(r, e, t) : Xq(r, e, t), i = e.colorStops, a = 0; a < i.length; a++) + n.addColorStop(i[a].offset, i[a].color); + return n; +} +function Jq(r, e) { + if (r === e || !r && !e) + return !1; + if (!r || !e || r.length !== e.length) + return !0; + for (var t = 0; t < r.length; t++) + if (r[t] !== e[t]) + return !0; + return !1; +} +function Hy(r) { + return parseInt(r, 10); +} +function dd(r, e, t) { + var n = ["width", "height"][e], i = ["clientWidth", "clientHeight"][e], a = ["paddingLeft", "paddingTop"][e], o = ["paddingRight", "paddingBottom"][e]; + if (t[n] != null && t[n] !== "auto") + return parseFloat(t[n]); + var s = document.defaultView.getComputedStyle(r); + return (r[i] || Hy(s[n]) || Hy(r.style[n])) - (Hy(s[a]) || 0) - (Hy(s[o]) || 0) | 0; +} +function Kq(r, e) { + return !r || r === "solid" || !(e > 0) ? null : r === "dashed" ? [4 * e, 2 * e] : r === "dotted" ? [e] : Pr(r) ? [r] : We(r) ? r : null; +} +function wA(r) { + var e = r.style, t = e.lineDash && e.lineWidth > 0 && Kq(e.lineDash, e.lineWidth), n = e.lineDashOffset; + if (t) { + var i = e.strokeNoScale && r.getLineScale ? r.getLineScale() : 1; + i && i !== 1 && (t = Ke(t, function(a) { + return a / i; + }), n /= i); + } + return [t, n]; +} +var Qq = new Al(!0); +function A_(r) { + var e = r.stroke; + return !(e == null || e === "none" || !(r.lineWidth > 0)); +} +function $O(r) { + return typeof r == "string" && r !== "none"; +} +function E_(r) { + var e = r.fill; + return e != null && e !== "none"; +} +function HO(r, e) { + if (e.fillOpacity != null && e.fillOpacity !== 1) { + var t = r.globalAlpha; + r.globalAlpha = e.fillOpacity * e.opacity, r.fill(), r.globalAlpha = t; + } else + r.fill(); +} +function VO(r, e) { + if (e.strokeOpacity != null && e.strokeOpacity !== 1) { + var t = r.globalAlpha; + r.globalAlpha = e.strokeOpacity * e.opacity, r.stroke(), r.globalAlpha = t; + } else + r.stroke(); +} +function K1(r, e, t) { + var n = UI(e.image, e.__image, t); + if (Ob(n)) { + var i = r.createPattern(n, e.repeat || "repeat"); + if (typeof DOMMatrix == "function" && i && i.setTransform) { + var a = new DOMMatrix(); + a.translateSelf(e.x || 0, e.y || 0), a.rotateSelf(0, 0, (e.rotation || 0) * Np), a.scaleSelf(e.scaleX || 1, e.scaleY || 1), i.setTransform(a); + } + return i; + } +} +function qq(r, e, t, n) { + var i, a = A_(t), o = E_(t), s = t.strokePercent, l = s < 1, u = !e.path; + (!e.silent || l) && u && e.createPathProxy(); + var c = e.path || Qq, h = e.__dirty; + if (!n) { + var f = t.fill, v = t.stroke, b = o && !!f.colorStops, w = a && !!v.colorStops, p = o && !!f.image, d = a && !!v.image, m = void 0, _ = void 0, y = void 0, x = void 0, g = void 0; + (b || w) && (g = e.getBoundingRect()), b && (m = h ? J1(r, f, g) : e.__canvasFillGradient, e.__canvasFillGradient = m), w && (_ = h ? J1(r, v, g) : e.__canvasStrokeGradient, e.__canvasStrokeGradient = _), p && (y = h || !e.__canvasFillPattern ? K1(r, f, e) : e.__canvasFillPattern, e.__canvasFillPattern = y), d && (x = h || !e.__canvasStrokePattern ? K1(r, v, e) : e.__canvasStrokePattern, e.__canvasStrokePattern = y), b ? r.fillStyle = m : p && (y ? r.fillStyle = y : o = !1), w ? r.strokeStyle = _ : d && (x ? r.strokeStyle = x : a = !1); + } + var S = e.getGlobalScale(); + c.setScale(S[0], S[1], e.segmentIgnoreThreshold); + var T, C; + r.setLineDash && t.lineDash && (i = wA(e), T = i[0], C = i[1]); + var E = !0; + (u || h & ad) && (c.setDPR(r.dpr), l ? c.setContext(null) : (c.setContext(r), E = !1), c.reset(), e.buildPath(c, e.shape, n), c.toStatic(), e.pathUpdated()), E && c.rebuildPath(r, l ? s : 1), T && (r.setLineDash(T), r.lineDashOffset = C), n || (t.strokeFirst ? (a && VO(r, t), o && HO(r, t)) : (o && HO(r, t), a && VO(r, t))), T && r.setLineDash([]); +} +function eee(r, e, t) { + var n = e.__image = UI(t.image, e.__image, e, e.onload); + if (!(!n || !Ob(n))) { + var i = t.x || 0, a = t.y || 0, o = e.getWidth(), s = e.getHeight(), l = n.width / n.height; + if (o == null && s != null ? o = s * l : s == null && o != null ? s = o / l : o == null && s == null && (o = n.width, s = n.height), t.sWidth && t.sHeight) { + var u = t.sx || 0, c = t.sy || 0; + r.drawImage(n, u, c, t.sWidth, t.sHeight, i, a, o, s); + } else if (t.sx && t.sy) { + var u = t.sx, c = t.sy, h = o - u, f = s - c; + r.drawImage(n, u, c, h, f, i, a, o, s); + } else + r.drawImage(n, i, a, o, s); + } +} +function tee(r, e, t) { + var n, i = t.text; + if (i != null && (i += ""), i) { + r.font = t.font || hc, r.textAlign = t.textAlign, r.textBaseline = t.textBaseline; + var a = void 0, o = void 0; + r.setLineDash && t.lineDash && (n = wA(e), a = n[0], o = n[1]), a && (r.setLineDash(a), r.lineDashOffset = o), t.strokeFirst ? (A_(t) && r.strokeText(i, t.x, t.y), E_(t) && r.fillText(i, t.x, t.y)) : (E_(t) && r.fillText(i, t.x, t.y), A_(t) && r.strokeText(i, t.x, t.y)), a && r.setLineDash([]); + } +} +var GO = ["shadowBlur", "shadowOffsetX", "shadowOffsetY"], UO = [ + ["lineCap", "butt"], + ["lineJoin", "miter"], + ["miterLimit", 10] +]; +function c4(r, e, t, n, i) { + var a = !1; + if (!n && (t = t || {}, e === t)) + return !1; + if (n || e.opacity !== t.opacity) { + to(r, i), a = !0; + var o = Math.max(Math.min(e.opacity, 1), 0); + r.globalAlpha = isNaN(o) ? Ph.opacity : o; + } + (n || e.blend !== t.blend) && (a || (to(r, i), a = !0), r.globalCompositeOperation = e.blend || Ph.blend); + for (var s = 0; s < GO.length; s++) { + var l = GO[s]; + (n || e[l] !== t[l]) && (a || (to(r, i), a = !0), r[l] = r.dpr * (e[l] || 0)); + } + return (n || e.shadowColor !== t.shadowColor) && (a || (to(r, i), a = !0), r.shadowColor = e.shadowColor || Ph.shadowColor), a; +} +function WO(r, e, t, n, i) { + var a = Cg(e, i.inHover), o = n ? null : t && Cg(t, i.inHover) || {}; + if (a === o) + return !1; + var s = c4(r, a, o, n, i); + if ((n || a.fill !== o.fill) && (s || (to(r, i), s = !0), $O(a.fill) && (r.fillStyle = a.fill)), (n || a.stroke !== o.stroke) && (s || (to(r, i), s = !0), $O(a.stroke) && (r.strokeStyle = a.stroke)), (n || a.opacity !== o.opacity) && (s || (to(r, i), s = !0), r.globalAlpha = a.opacity == null ? 1 : a.opacity), e.hasStroke()) { + var l = a.lineWidth, u = l / (a.strokeNoScale && e.getLineScale ? e.getLineScale() : 1); + r.lineWidth !== u && (s || (to(r, i), s = !0), r.lineWidth = u); + } + for (var c = 0; c < UO.length; c++) { + var h = UO[c], f = h[0]; + (n || a[f] !== o[f]) && (s || (to(r, i), s = !0), r[f] = a[f] || h[1]); + } + return s; +} +function ree(r, e, t, n, i) { + return c4(r, Cg(e, i.inHover), t && Cg(t, i.inHover), n, i); +} +function h4(r, e) { + var t = e.transform, n = r.dpr || 1; + t ? r.setTransform(n * t[0], n * t[1], n * t[2], n * t[3], n * t[4], n * t[5]) : r.setTransform(n, 0, 0, n, 0, 0); +} +function nee(r, e, t) { + for (var n = !1, i = 0; i < r.length; i++) { + var a = r[i]; + n = n || a.isZeroArea(), h4(e, a), e.beginPath(), a.buildPath(e, a.shape), e.clip(); + } + t.allClipped = n; +} +function iee(r, e) { + return r && e ? r[0] !== e[0] || r[1] !== e[1] || r[2] !== e[2] || r[3] !== e[3] || r[4] !== e[4] || r[5] !== e[5] : !(!r && !e); +} +var YO = 1, XO = 2, ZO = 3, JO = 4; +function aee(r) { + var e = E_(r), t = A_(r); + return !(r.lineDash || !(+e ^ +t) || e && typeof r.fill != "string" || t && typeof r.stroke != "string" || r.strokePercent < 1 || r.strokeOpacity < 1 || r.fillOpacity < 1); +} +function to(r, e) { + e.batchFill && r.fill(), e.batchStroke && r.stroke(), e.batchFill = "", e.batchStroke = ""; +} +function Cg(r, e) { + return e && r.__hoverStyle || r.style; +} +function Qb(r, e) { + kh(r, e, { inHover: !1, viewWidth: 0, viewHeight: 0 }, !0); +} +function kh(r, e, t, n) { + var i = e.transform; + if (!e.shouldBePainted(t.viewWidth, t.viewHeight, !1, !1)) { + e.__dirty &= ~go, e.__isRendered = !1; + return; + } + var a = e.__clipPaths, o = t.prevElClipPaths, s = !1, l = !1; + if ((!o || Jq(a, o)) && (o && o.length && (to(r, t), r.restore(), l = s = !0, t.prevElClipPaths = null, t.allClipped = !1, t.prevEl = null), a && a.length && (to(r, t), r.save(), nee(a, r, t), s = !0), t.prevElClipPaths = a), t.allClipped) { + e.__isRendered = !1; + return; + } + e.beforeBrush && e.beforeBrush(), e.innerBeforeBrush(); + var u = t.prevEl; + u || (l = s = !0); + var c = e instanceof hr && e.autoBatch && aee(e.style); + s || iee(i, u.transform) ? (to(r, t), h4(r, e)) : c || to(r, t); + var h = Cg(e, t.inHover); + e instanceof hr ? (t.lastDrawType !== YO && (l = !0, t.lastDrawType = YO), WO(r, e, u, l, t), (!c || !t.batchFill && !t.batchStroke) && r.beginPath(), qq(r, e, h, c), c && (t.batchFill = h.fill || "", t.batchStroke = h.stroke || "")) : e instanceof vg ? (t.lastDrawType !== ZO && (l = !0, t.lastDrawType = ZO), WO(r, e, u, l, t), tee(r, e, h)) : e instanceof ji ? (t.lastDrawType !== XO && (l = !0, t.lastDrawType = XO), ree(r, e, u, l, t), eee(r, e, h)) : e.getTemporalDisplayables && (t.lastDrawType !== JO && (l = !0, t.lastDrawType = JO), oee(r, e, t)), c && n && to(r, t), e.innerAfterBrush(), e.afterBrush && e.afterBrush(), t.prevEl = e, e.__dirty = 0, e.__isRendered = !0; +} +function oee(r, e, t) { + var n = e.getDisplayables(), i = e.getTemporalDisplayables(); + r.save(); + var a = { + prevElClipPaths: null, + prevEl: null, + allClipped: !1, + viewWidth: t.viewWidth, + viewHeight: t.viewHeight, + inHover: t.inHover + }, o, s; + for (o = e.getCursor(), s = n.length; o < s; o++) { + var l = n[o]; + l.beforeBrush && l.beforeBrush(), l.innerBeforeBrush(), kh(r, l, a, o === s - 1), l.innerAfterBrush(), l.afterBrush && l.afterBrush(), a.prevEl = l; + } + for (var u = 0, c = i.length; u < c; u++) { + var l = i[u]; + l.beforeBrush && l.beforeBrush(), l.innerBeforeBrush(), kh(r, l, a, u === c - 1), l.innerAfterBrush(), l.afterBrush && l.afterBrush(), a.prevEl = l; + } + e.clearTemporalDisplayables(), e.notClear = !0, r.restore(); +} +var ZS = new jq(), KO = new Xg(100), QO = ["symbol", "symbolSize", "symbolKeepAspect", "color", "backgroundColor", "dashArrayX", "dashArrayY", "maxTileWidth", "maxTileHeight"]; +function Nd(r, e) { + if (r === "none") + return null; + var t = e.getDevicePixelRatio(), n = e.getZr(), i = n.painter.type === "svg"; + r.dirty && ZS.delete(r); + var a = ZS.get(r); + if (a) + return a; + var o = Mt(r, { + symbol: "rect", + symbolSize: 1, + symbolKeepAspect: !0, + color: "rgba(0, 0, 0, 0.2)", + backgroundColor: null, + dashArrayX: 5, + dashArrayY: 5, + rotation: 0, + maxTileWidth: 512, + maxTileHeight: 512 + }); + o.backgroundColor === "none" && (o.backgroundColor = null); + var s = { + repeat: "repeat" + }; + return l(s), s.rotation = o.rotation, s.scaleX = s.scaleY = i ? 1 : 1 / t, ZS.set(r, s), r.dirty = !1, s; + function l(u) { + for (var c = [t], h = !0, f = 0; f < QO.length; ++f) { + var v = o[QO[f]]; + if (v != null && !We(v) && !ut(v) && !Pr(v) && typeof v != "boolean") { + h = !1; + break; + } + c.push(v); + } + var b; + if (h) { + b = c.join(",") + (i ? "-svg" : ""); + var w = KO.get(b); + w && (i ? u.svgElement = w : u.image = w); + } + var p = d4(o.dashArrayX), d = see(o.dashArrayY), m = f4(o.symbol), _ = lee(p), y = v4(d), x = !i && Bs.createCanvas(), g = i && { + tag: "g", + attrs: {}, + key: "dcl", + children: [] + }, S = C(), T; + x && (x.width = S.width * t, x.height = S.height * t, T = x.getContext("2d")), E(), h && KO.put(b, x || g), u.image = x, u.svgElement = g, u.svgWidth = S.width, u.svgHeight = S.height; + function C() { + for (var M = 1, P = 0, R = _.length; P < R; ++P) + M = dk(M, _[P]); + for (var N = 1, P = 0, R = m.length; P < R; ++P) + N = dk(N, m[P].length); + M *= N; + var F = y * _.length * m.length; + return { + width: Math.max(1, Math.min(M, o.maxTileWidth)), + height: Math.max(1, Math.min(F, o.maxTileHeight)) + }; + } + function E() { + T && (T.clearRect(0, 0, x.width, x.height), o.backgroundColor && (T.fillStyle = o.backgroundColor, T.fillRect(0, 0, x.width, x.height))); + for (var M = 0, P = 0; P < d.length; ++P) + M += d[P]; + if (M <= 0) + return; + for (var R = -y, N = 0, F = 0, U = 0; R < S.height; ) { + if (N % 2 === 0) { + for (var $ = F / 2 % m.length, G = 0, Q = 0, ee = 0; G < S.width * 2; ) { + for (var ce = 0, P = 0; P < p[U].length; ++P) + ce += p[U][P]; + if (ce <= 0) + break; + if (Q % 2 === 0) { + var ne = (1 - o.symbolSize) * 0.5, fe = G + p[U][Q] * ne, K = R + d[N] * ne, Oe = p[U][Q] * o.symbolSize, xe = d[N] * o.symbolSize, Ge = ee / 2 % m[$].length; + oe(fe, K, Oe, xe, m[$][Ge]); + } + G += p[U][Q], ++ee, ++Q, Q === p[U].length && (Q = 0); + } + ++U, U === p.length && (U = 0); + } + R += d[N], ++F, ++N, N === d.length && (N = 0); + } + function oe(de, se, te, pe, re) { + var ae = i ? 1 : t, le = li(re, de * ae, se * ae, te * ae, pe * ae, o.color, o.symbolKeepAspect); + if (i) { + var ue = n.painter.renderOneToVNode(le); + ue && g.children.push(ue); + } else + Qb(T, le); + } + } + } +} +function f4(r) { + if (!r || r.length === 0) + return [["rect"]]; + if (ut(r)) + return [[r]]; + for (var e = !0, t = 0; t < r.length; ++t) + if (!ut(r[t])) { + e = !1; + break; + } + if (e) + return f4([r]); + for (var n = [], t = 0; t < r.length; ++t) + ut(r[t]) ? n.push([r[t]]) : n.push(r[t]); + return n; +} +function d4(r) { + if (!r || r.length === 0) + return [[0, 0]]; + if (Pr(r)) { + var e = Math.ceil(r); + return [[e, e]]; + } + for (var t = !0, n = 0; n < r.length; ++n) + if (!Pr(r[n])) { + t = !1; + break; + } + if (t) + return d4([r]); + for (var i = [], n = 0; n < r.length; ++n) + if (Pr(r[n])) { + var e = Math.ceil(r[n]); + i.push([e, e]); + } else { + var e = Ke(r[n], function(s) { + return Math.ceil(s); + }); + e.length % 2 === 1 ? i.push(e.concat(e)) : i.push(e); + } + return i; +} +function see(r) { + if (!r || typeof r == "object" && r.length === 0) + return [0, 0]; + if (Pr(r)) { + var e = Math.ceil(r); + return [e, e]; + } + var t = Ke(r, function(n) { + return Math.ceil(n); + }); + return r.length % 2 ? t.concat(t) : t; +} +function lee(r) { + return Ke(r, function(e) { + return v4(e); + }); +} +function v4(r) { + for (var e = 0, t = 0; t < r.length; ++t) + e += r[t]; + return r.length % 2 === 1 ? e * 2 : e; +} +function uee(r, e) { + r.eachRawSeries(function(t) { + if (!r.isSeriesFiltered(t)) { + var n = t.getData(); + n.hasItemVisual() && n.each(function(o) { + var s = n.getItemVisual(o, "decal"); + if (s) { + var l = n.ensureUniqueItemVisual(o, "style"); + l.decal = Nd(s, e); + } + }); + var i = n.getVisual("decal"); + if (i) { + var a = n.getVisual("style"); + a.decal = Nd(i, e); + } + } + }); +} +var cee = new rs(); +const Es = cee; +var p4 = {}; +function hee(r, e) { + p4[r] = e; +} +function g4(r) { + return p4[r]; +} +var CA = "5.4.3", m4 = { + zrender: "5.4.4" +}, fee = 1, dee = 800, vee = 900, pee = 1e3, gee = 2e3, mee = 5e3, y4 = 1e3, yee = 1100, TA = 2e3, _4 = 3e3, _ee = 4e3, qb = 4500, bee = 4600, xee = 5e3, See = 6e3, b4 = 7e3, IA = { + PROCESSOR: { + FILTER: pee, + SERIES_FILTER: dee, + STATISTIC: mee + }, + VISUAL: { + LAYOUT: y4, + PROGRESSIVE_LAYOUT: yee, + GLOBAL: TA, + CHART: _4, + POST_CHART_LAYOUT: bee, + COMPONENT: _ee, + BRUSH: xee, + CHART_ITEM: qb, + ARIA: See, + DECAL: b4 + } +}, ua = "__flagInMainProcess", Ka = "__pendingUpdate", JS = "__needsUpdateStatus", qO = /^[a-zA-Z0-9_]+$/, KS = "__connectUpdateStatus", e2 = 0, wee = 1, Cee = 2; +function x4(r) { + return function() { + for (var e = [], t = 0; t < arguments.length; t++) + e[t] = arguments[t]; + if (this.isDisposed()) { + this.id; + return; + } + return w4(this, r, e); + }; +} +function S4(r) { + return function() { + for (var e = [], t = 0; t < arguments.length; t++) + e[t] = arguments[t]; + return w4(this, r, e); + }; +} +function w4(r, e, t) { + return t[0] = t[0] && t[0].toLowerCase(), rs.prototype[e].apply(r, t); +} +var C4 = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e; + }(rs) +), T4 = C4.prototype; +T4.on = S4("on"); +T4.off = S4("off"); +var Yf, QS, Vy, Nu, qS, ew, tw, ip, ap, t2, r2, rw, n2, Gy, i2, I4, jo, a2, M_ = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this, new Oq()) || this; + a._chartsViews = [], a._chartsMap = {}, a._componentsViews = [], a._componentsMap = {}, a._pendingActions = [], i = i || {}, ut(n) && (n = A4[n]), a._dom = t; + var o = "canvas", s = "auto", l = !1, u = a._zr = T1(t, { + renderer: i.renderer || o, + devicePixelRatio: i.devicePixelRatio, + width: i.width, + height: i.height, + ssr: i.ssr, + useDirtyRect: Jt(i.useDirtyRect, l), + useCoarsePointer: Jt(i.useCoarsePointer, s), + pointerSize: i.pointerSize + }); + a._ssr = i.ssr, a._throttledZrFlush = Zh(ft(u.flush, u), 17), n = Ot(n), n && OF(n, !0), a._theme = n, a._locale = NK(i.locale || lF), a._coordSysMgr = new av(); + var c = a._api = i2(a); + function h(f, v) { + return f.__prio - v.__prio; + } + return k0(k_, h), k0(Q1, h), a._scheduler = new o4(a, c, Q1, k_), a._messageCenter = new C4(), a._initEvents(), a.resize = ft(a.resize, a), u.animation.on("frame", a._onframe, a), t2(u, a), r2(u, a), ig(a), a; + } + return e.prototype._onframe = function() { + if (!this._disposed) { + a2(this); + var t = this._scheduler; + if (this[Ka]) { + var n = this[Ka].silent; + this[ua] = !0; + try { + Yf(this), Nu.update.call(this, null, this[Ka].updateParams); + } catch (l) { + throw this[ua] = !1, this[Ka] = null, l; + } + this._zr.flush(), this[ua] = !1, this[Ka] = null, ip.call(this, n), ap.call(this, n); + } else if (t.unfinished) { + var i = fee, a = this._model, o = this._api; + t.unfinished = !1; + do { + var s = +/* @__PURE__ */ new Date(); + t.performSeriesTasks(a), t.performDataProcessorTasks(a), ew(this, a), t.performVisualTasks(a), Gy(this, this._model, o, "remain", {}), i -= +/* @__PURE__ */ new Date() - s; + } while (i > 0 && t.unfinished); + t.unfinished || this._zr.flush(); + } + } + }, e.prototype.getDom = function() { + return this._dom; + }, e.prototype.getId = function() { + return this.id; + }, e.prototype.getZr = function() { + return this._zr; + }, e.prototype.isSSR = function() { + return this._ssr; + }, e.prototype.setOption = function(t, n, i) { + if (!this[ua]) { + if (this._disposed) { + this.id; + return; + } + var a, o, s; + if (kt(n) && (i = n.lazyUpdate, a = n.silent, o = n.replaceMerge, s = n.transition, n = n.notMerge), this[ua] = !0, !this._model || n) { + var l = new gQ(this._api), u = this._theme, c = this._model = new MF(); + c.scheduler = this._scheduler, c.ssr = this._ssr, c.init(null, null, null, u, this._locale, l); + } + this._model.setOption(t, { + replaceMerge: o + }, q1); + var h = { + seriesTransition: s, + optionChanged: !0 + }; + if (i) + this[Ka] = { + silent: a, + updateParams: h + }, this[ua] = !1, this.getZr().wakeUp(); + else { + try { + Yf(this), Nu.update.call(this, null, h); + } catch (f) { + throw this[Ka] = null, this[ua] = !1, f; + } + this._ssr || this._zr.flush(), this[Ka] = null, this[ua] = !1, ip.call(this, a), ap.call(this, a); + } + } + }, e.prototype.setTheme = function() { + }, e.prototype.getModel = function() { + return this._model; + }, e.prototype.getOption = function() { + return this._model && this._model.getOption(); + }, e.prototype.getWidth = function() { + return this._zr.getWidth(); + }, e.prototype.getHeight = function() { + return this._zr.getHeight(); + }, e.prototype.getDevicePixelRatio = function() { + return this._zr.painter.dpr || Dr.hasGlobalWindow && window.devicePixelRatio || 1; + }, e.prototype.getRenderedCanvas = function(t) { + return this.renderToCanvas(t); + }, e.prototype.renderToCanvas = function(t) { + t = t || {}; + var n = this._zr.painter; + return n.getRenderedCanvas({ + backgroundColor: t.backgroundColor || this._model.get("backgroundColor"), + pixelRatio: t.pixelRatio || this.getDevicePixelRatio() + }); + }, e.prototype.renderToSVGString = function(t) { + t = t || {}; + var n = this._zr.painter; + return n.renderToString({ + useViewBox: t.useViewBox + }); + }, e.prototype.getSvgDataURL = function() { + if (Dr.svgSupported) { + var t = this._zr, n = t.storage.getDisplayList(); + return X(n, function(i) { + i.stopAnimation(null, !0); + }), t.painter.toDataURL(); + } + }, e.prototype.getDataURL = function(t) { + if (this._disposed) { + this.id; + return; + } + t = t || {}; + var n = t.excludeComponents, i = this._model, a = [], o = this; + X(n, function(l) { + i.eachComponent({ + mainType: l + }, function(u) { + var c = o._componentsMap[u.__viewId]; + c.group.ignore || (a.push(c), c.group.ignore = !0); + }); + }); + var s = this._zr.painter.getType() === "svg" ? this.getSvgDataURL() : this.renderToCanvas(t).toDataURL("image/" + (t && t.type || "png")); + return X(a, function(l) { + l.group.ignore = !1; + }), s; + }, e.prototype.getConnectedDataURL = function(t) { + if (this._disposed) { + this.id; + return; + } + var n = t.type === "svg", i = this.group, a = Math.min, o = Math.max, s = 1 / 0; + if (O_[i]) { + var l = s, u = s, c = -s, h = -s, f = [], v = t && t.pixelRatio || this.getDevicePixelRatio(); + X(zh, function(_, y) { + if (_.group === i) { + var x = n ? _.getZr().painter.getSvgDom().innerHTML : _.renderToCanvas(Ot(t)), g = _.getDom().getBoundingClientRect(); + l = a(g.left, l), u = a(g.top, u), c = o(g.right, c), h = o(g.bottom, h), f.push({ + dom: x, + left: g.left, + top: g.top + }); + } + }), l *= v, u *= v, c *= v, h *= v; + var b = c - l, w = h - u, p = Bs.createCanvas(), d = T1(p, { + renderer: n ? "svg" : "canvas" + }); + if (d.resize({ + width: b, + height: w + }), n) { + var m = ""; + return X(f, function(_) { + var y = _.left - l, x = _.top - u; + m += '' + _.dom + ""; + }), d.painter.getSvgRoot().innerHTML = m, t.connectedBackgroundColor && d.painter.setBackgroundColor(t.connectedBackgroundColor), d.refreshImmediately(), d.painter.toDataURL(); + } else + return t.connectedBackgroundColor && d.add(new Or({ + shape: { + x: 0, + y: 0, + width: b, + height: w + }, + style: { + fill: t.connectedBackgroundColor + } + })), X(f, function(_) { + var y = new ji({ + style: { + x: _.left * v - l, + y: _.top * v - u, + image: _.dom + } + }); + d.add(y); + }), d.refreshImmediately(), p.toDataURL("image/" + (t && t.type || "png")); + } else + return this.getDataURL(t); + }, e.prototype.convertToPixel = function(t, n) { + return qS(this, "convertToPixel", t, n); + }, e.prototype.convertFromPixel = function(t, n) { + return qS(this, "convertFromPixel", t, n); + }, e.prototype.containPixel = function(t, n) { + if (this._disposed) { + this.id; + return; + } + var i = this._model, a, o = Hp(i, t); + return X(o, function(s, l) { + l.indexOf("Models") >= 0 && X(s, function(u) { + var c = u.coordinateSystem; + if (c && c.containPoint) + a = a || !!c.containPoint(n); + else if (l === "seriesModels") { + var h = this._chartsMap[u.__viewId]; + h && h.containPoint && (a = a || h.containPoint(n, u)); + } + }, this); + }, this), !!a; + }, e.prototype.getVisual = function(t, n) { + var i = this._model, a = Hp(i, t, { + defaultMainType: "series" + }), o = a.seriesModel, s = o.getData(), l = a.hasOwnProperty("dataIndexInside") ? a.dataIndexInside : a.hasOwnProperty("dataIndex") ? s.indexOfRawIndex(a.dataIndex) : null; + return l != null ? SA(s, l, n) : im(s, n); + }, e.prototype.getViewOfComponentModel = function(t) { + return this._componentsMap[t.__viewId]; + }, e.prototype.getViewOfSeriesModel = function(t) { + return this._chartsMap[t.__viewId]; + }, e.prototype._initEvents = function() { + var t = this; + X(Tee, function(n) { + var i = function(a) { + var o = t.getModel(), s = a.target, l, u = n === "globalout"; + if (u ? l = {} : s && Mh(s, function(b) { + var w = Ft(b); + if (w && w.dataIndex != null) { + var p = w.dataModel || o.getSeriesByIndex(w.seriesIndex); + return l = p && p.getDataParams(w.dataIndex, w.dataType, s) || {}, !0; + } else if (w.eventData) + return l = Fe({}, w.eventData), !0; + }, !0), l) { + var c = l.componentType, h = l.componentIndex; + (c === "markLine" || c === "markPoint" || c === "markArea") && (c = "series", h = l.seriesIndex); + var f = c && h != null && o.getComponent(c, h), v = f && t[f.mainType === "series" ? "_chartsMap" : "_componentsMap"][f.__viewId]; + l.event = a, l.type = n, t._$eventProcessor.eventInfo = { + targetEl: s, + packedEvent: l, + model: f, + view: v + }, t.trigger(n, l); + } + }; + i.zrEventfulCallAtLast = !0, t._zr.on(n, i, t); + }), X(Xp, function(n, i) { + t._messageCenter.on(i, function(a) { + this.trigger(i, a); + }, t); + }), X(["selectchanged"], function(n) { + t._messageCenter.on(n, function(i) { + this.trigger(n, i); + }, t); + }), Rq(this._messageCenter, this, this._api); + }, e.prototype.isDisposed = function() { + return this._disposed; + }, e.prototype.clear = function() { + if (this._disposed) { + this.id; + return; + } + this.setOption({ + series: [] + }, !0); + }, e.prototype.dispose = function() { + if (this._disposed) { + this.id; + return; + } + this._disposed = !0; + var t = this.getDom(); + t && i5(this.getDom(), EA, ""); + var n = this, i = n._api, a = n._model; + X(n._componentsViews, function(o) { + o.dispose(a, i); + }), X(n._chartsViews, function(o) { + o.dispose(a, i); + }), n._zr.dispose(), n._dom = n._model = n._chartsMap = n._componentsMap = n._chartsViews = n._componentsViews = n._scheduler = n._api = n._zr = n._throttledZrFlush = n._theme = n._coordSysMgr = n._messageCenter = null, delete zh[n.id]; + }, e.prototype.resize = function(t) { + if (!this[ua]) { + if (this._disposed) { + this.id; + return; + } + this._zr.resize(t); + var n = this._model; + if (this._loadingFX && this._loadingFX.resize(), !!n) { + var i = n.resetOption("media"), a = t && t.silent; + this[Ka] && (a == null && (a = this[Ka].silent), i = !0, this[Ka] = null), this[ua] = !0; + try { + i && Yf(this), Nu.update.call(this, { + type: "resize", + animation: Fe({ + // Disable animation + duration: 0 + }, t && t.animation) + }); + } catch (o) { + throw this[ua] = !1, o; + } + this[ua] = !1, ip.call(this, a), ap.call(this, a); + } + } + }, e.prototype.showLoading = function(t, n) { + if (this._disposed) { + this.id; + return; + } + if (kt(t) && (n = t, t = ""), t = t || "default", this.hideLoading(), !!eT[t]) { + var i = eT[t](this._api, n), a = this._zr; + this._loadingFX = i, a.add(i); + } + }, e.prototype.hideLoading = function() { + if (this._disposed) { + this.id; + return; + } + this._loadingFX && this._zr.remove(this._loadingFX), this._loadingFX = null; + }, e.prototype.makeActionFromEvent = function(t) { + var n = Fe({}, t); + return n.type = Xp[t.type], n; + }, e.prototype.dispatchAction = function(t, n) { + if (this._disposed) { + this.id; + return; + } + if (kt(n) || (n = { + silent: !!n + }), !!D_[t.type] && this._model) { + if (this[ua]) { + this._pendingActions.push(t); + return; + } + var i = n.silent; + tw.call(this, t, i); + var a = n.flush; + a ? this._zr.flush() : a !== !1 && Dr.browser.weChat && this._throttledZrFlush(), ip.call(this, i), ap.call(this, i); + } + }, e.prototype.updateLabelLayout = function() { + Es.trigger("series:layoutlabels", this._model, this._api, { + // Not adding series labels. + // TODO + updatedSeries: [] + }); + }, e.prototype.appendData = function(t) { + if (this._disposed) { + this.id; + return; + } + var n = t.seriesIndex, i = this.getModel(), a = i.getSeriesByIndex(n); + a.appendData(t), this._scheduler.unfinished = !0, this.getZr().wakeUp(); + }, e.internalField = function() { + Yf = function(h) { + var f = h._scheduler; + f.restorePipelines(h._model), f.prepareStageTasks(), QS(h, !0), QS(h, !1), f.plan(); + }, QS = function(h, f) { + for (var v = h._model, b = h._scheduler, w = f ? h._componentsViews : h._chartsViews, p = f ? h._componentsMap : h._chartsMap, d = h._zr, m = h._api, _ = 0; _ < w.length; _++) + w[_].__alive = !1; + f ? v.eachComponent(function(g, S) { + g !== "series" && y(S); + }) : v.eachSeries(y); + function y(g) { + var S = g.__requireNewView; + g.__requireNewView = !1; + var T = "_ec_" + g.id + "_" + g.type, C = !S && p[T]; + if (!C) { + var E = gl(g.type), M = f ? Sn.getClass(E.main, E.sub) : ( + // FIXME:TS + // (ChartView as ChartViewConstructor).getClass('series', classType.sub) + // For backward compat, still support a chart type declared as only subType + // like "liquidfill", but recommend "series.liquidfill" + // But need a base class to make a type series. + en.getClass(E.sub) + ); + C = new M(), C.init(v, m), p[T] = C, w.push(C), d.add(C.group); + } + g.__viewId = C.__id = T, C.__alive = !0, C.__model = g, C.group.__ecComponentInfo = { + mainType: g.mainType, + index: g.componentIndex + }, !f && b.prepareView(C, g, v, m); + } + for (var _ = 0; _ < w.length; ) { + var x = w[_]; + x.__alive ? _++ : (!f && x.renderTask.dispose(), d.remove(x.group), x.dispose(v, m), w.splice(_, 1), p[x.__id] === x && delete p[x.__id], x.__id = x.group.__ecComponentInfo = null); + } + }, Vy = function(h, f, v, b, w) { + var p = h._model; + if (p.setUpdatePayload(v), !b) { + X([].concat(h._componentsViews).concat(h._chartsViews), x); + return; + } + var d = {}; + d[b + "Id"] = v[b + "Id"], d[b + "Index"] = v[b + "Index"], d[b + "Name"] = v[b + "Name"]; + var m = { + mainType: b, + query: d + }; + w && (m.subType = w); + var _ = v.excludeSeriesId, y; + _ != null && (y = xt(), X(ln(_), function(g) { + var S = Si(g, null); + S != null && y.set(S, !0); + })), p && p.eachComponent(m, function(g) { + var S = y && y.get(g.id) != null; + if (!S) + if ($k(v)) + if (g instanceof mn) + v.type === Rh && !v.notBlur && !g.get(["emphasis", "disabled"]) && OJ(g, v, h._api); + else { + var T = JI(g.mainType, g.componentIndex, v.name, h._api), C = T.focusSelf, E = T.dispatchers; + v.type === Rh && C && !v.notBlur && P1(g.mainType, g.componentIndex, h._api), E && X(E, function(M) { + v.type === Rh ? tu(M) : ru(M); + }); + } + else + N1(v) && g instanceof mn && (RJ(g, v, h._api), jk(g), jo(h)); + }, h), p && p.eachComponent(m, function(g) { + var S = y && y.get(g.id) != null; + S || x(h[b === "series" ? "_chartsMap" : "_componentsMap"][g.__viewId]); + }, h); + function x(g) { + g && g.__alive && g[f] && g[f](g.__model, p, h._api, v); + } + }, Nu = { + prepareAndUpdate: function(h) { + Yf(this), Nu.update.call(this, h, { + // Needs to mark option changed if newOption is given. + // It's from MagicType. + // TODO If use a separate flag optionChanged in payload? + optionChanged: h.newOption != null + }); + }, + update: function(h, f) { + var v = this._model, b = this._api, w = this._zr, p = this._coordSysMgr, d = this._scheduler; + if (v) { + v.setUpdatePayload(h), d.restoreData(v, h), d.performSeriesTasks(v), p.create(v, b), d.performDataProcessorTasks(v, h), ew(this, v), p.update(v, b), t(v), d.performVisualTasks(v, h), rw(this, v, b, h, f); + var m = v.get("backgroundColor") || "transparent", _ = v.get("darkMode"); + w.setBackgroundColor(m), _ != null && _ !== "auto" && w.setDarkMode(_), Es.trigger("afterupdate", v, b); + } + }, + updateTransform: function(h) { + var f = this, v = this._model, b = this._api; + if (v) { + v.setUpdatePayload(h); + var w = []; + v.eachComponent(function(d, m) { + if (d !== "series") { + var _ = f.getViewOfComponentModel(m); + if (_ && _.__alive) + if (_.updateTransform) { + var y = _.updateTransform(m, v, b, h); + y && y.update && w.push(_); + } else + w.push(_); + } + }); + var p = xt(); + v.eachSeries(function(d) { + var m = f._chartsMap[d.__viewId]; + if (m.updateTransform) { + var _ = m.updateTransform(d, v, b, h); + _ && _.update && p.set(d.uid, 1); + } else + p.set(d.uid, 1); + }), t(v), this._scheduler.performVisualTasks(v, h, { + setDirty: !0, + dirtyMap: p + }), Gy(this, v, b, h, {}, p), Es.trigger("afterupdate", v, b); + } + }, + updateView: function(h) { + var f = this._model; + f && (f.setUpdatePayload(h), en.markUpdateMethod(h, "updateView"), t(f), this._scheduler.performVisualTasks(f, h, { + setDirty: !0 + }), rw(this, f, this._api, h, {}), Es.trigger("afterupdate", f, this._api)); + }, + updateVisual: function(h) { + var f = this, v = this._model; + v && (v.setUpdatePayload(h), v.eachSeries(function(b) { + b.getData().clearAllVisual(); + }), en.markUpdateMethod(h, "updateVisual"), t(v), this._scheduler.performVisualTasks(v, h, { + visualType: "visual", + setDirty: !0 + }), v.eachComponent(function(b, w) { + if (b !== "series") { + var p = f.getViewOfComponentModel(w); + p && p.__alive && p.updateVisual(w, v, f._api, h); + } + }), v.eachSeries(function(b) { + var w = f._chartsMap[b.__viewId]; + w.updateVisual(b, v, f._api, h); + }), Es.trigger("afterupdate", v, this._api)); + }, + updateLayout: function(h) { + Nu.update.call(this, h); + } + }, qS = function(h, f, v, b) { + if (h._disposed) { + h.id; + return; + } + for (var w = h._model, p = h._coordSysMgr.getCoordinateSystems(), d, m = Hp(w, v), _ = 0; _ < p.length; _++) { + var y = p[_]; + if (y[f] && (d = y[f](w, m, b)) != null) + return d; + } + }, ew = function(h, f) { + var v = h._chartsMap, b = h._scheduler; + f.eachSeries(function(w) { + b.updateStreamModes(w, v[w.__viewId]); + }); + }, tw = function(h, f) { + var v = this, b = this.getModel(), w = h.type, p = h.escapeConnect, d = D_[w], m = d.actionInfo, _ = (m.update || "update").split(":"), y = _.pop(), x = _[0] != null && gl(_[0]); + this[ua] = !0; + var g = [h], S = !1; + h.batch && (S = !0, g = Ke(h.batch, function(N) { + return N = Mt(Fe({}, N), h), N.batch = null, N; + })); + var T = [], C, E = N1(h), M = $k(h); + if (M && k5(this._api), X(g, function(N) { + if (C = d.action(N, v._model, v._api), C = C || Fe({}, N), C.type = m.event || C.type, T.push(C), M) { + var F = VI(h), U = F.queryOptionMap, $ = F.mainTypeSpecified, G = $ ? U.keys()[0] : "series"; + Vy(v, y, N, G), jo(v); + } else + E ? (Vy(v, y, N, "series"), jo(v)) : x && Vy(v, y, N, x.main, x.sub); + }), y !== "none" && !M && !E && !x) + try { + this[Ka] ? (Yf(this), Nu.update.call(this, h), this[Ka] = null) : Nu[y].call(this, h); + } catch (N) { + throw this[ua] = !1, N; + } + if (S ? C = { + type: m.event || w, + escapeConnect: p, + batch: T + } : C = T[0], this[ua] = !1, !f) { + var P = this._messageCenter; + if (P.trigger(C.type, C), E) { + var R = { + type: "selectchanged", + escapeConnect: p, + selected: NJ(b), + isFromClick: h.isFromClick || !1, + fromAction: h.type, + fromActionPayload: h + }; + P.trigger(R.type, R); + } + } + }, ip = function(h) { + for (var f = this._pendingActions; f.length; ) { + var v = f.shift(); + tw.call(this, v, h); + } + }, ap = function(h) { + !h && this.trigger("updated"); + }, t2 = function(h, f) { + h.on("rendered", function(v) { + f.trigger("rendered", v), // Although zr is dirty if initial animation is not finished + // and this checking is called on frame, we also check + // animation finished for robustness. + h.animation.isFinished() && !f[Ka] && !f._scheduler.unfinished && !f._pendingActions.length && f.trigger("finished"); + }); + }, r2 = function(h, f) { + h.on("mouseover", function(v) { + var b = v.target, w = Mh(b, gg); + w && (LJ(w, v, f._api), jo(f)); + }).on("mouseout", function(v) { + var b = v.target, w = Mh(b, gg); + w && (PJ(w, v, f._api), jo(f)); + }).on("click", function(v) { + var b = v.target, w = Mh(b, function(m) { + return Ft(m).dataIndex != null; + }, !0); + if (w) { + var p = w.selected ? "unselect" : "select", d = Ft(w); + f._api.dispatchAction({ + type: p, + dataType: d.dataType, + dataIndexInside: d.dataIndex, + seriesIndex: d.seriesIndex, + isFromClick: !0 + }); + } + }); + }; + function t(h) { + h.clearColorPalette(), h.eachSeries(function(f) { + f.clearColorPalette(); + }); + } + function n(h) { + var f = [], v = [], b = !1; + if (h.eachComponent(function(m, _) { + var y = _.get("zlevel") || 0, x = _.get("z") || 0, g = _.getZLevelKey(); + b = b || !!g, (m === "series" ? v : f).push({ + zlevel: y, + z: x, + idx: _.componentIndex, + type: m, + key: g + }); + }), b) { + var w = f.concat(v), p, d; + k0(w, function(m, _) { + return m.zlevel === _.zlevel ? m.z - _.z : m.zlevel - _.zlevel; + }), X(w, function(m) { + var _ = h.getComponent(m.type, m.idx), y = m.zlevel, x = m.key; + p != null && (y = Math.max(p, y)), x ? (y === p && x !== d && y++, d = x) : d && (y === p && y++, d = ""), p = y, _.setZLevel(y); + }); + } + } + rw = function(h, f, v, b, w) { + n(f), n2(h, f, v, b, w), X(h._chartsViews, function(p) { + p.__alive = !1; + }), Gy(h, f, v, b, w), X(h._chartsViews, function(p) { + p.__alive || p.remove(f, v); + }); + }, n2 = function(h, f, v, b, w, p) { + X(p || h._componentsViews, function(d) { + var m = d.__model; + u(m, d), d.render(m, f, v, b), s(m, d), c(m, d); + }); + }, Gy = function(h, f, v, b, w, p) { + var d = h._scheduler; + w = Fe(w || {}, { + updatedSeries: f.getSeries() + }), Es.trigger("series:beforeupdate", f, v, w); + var m = !1; + f.eachSeries(function(_) { + var y = h._chartsMap[_.__viewId]; + y.__alive = !0; + var x = y.renderTask; + d.updatePayload(x, b), u(_, y), p && p.get(_.uid) && x.dirty(), x.perform(d.getPerformArgs(x)) && (m = !0), y.group.silent = !!_.get("silent"), o(_, y), jk(_); + }), d.unfinished = m || d.unfinished, Es.trigger("series:layoutlabels", f, v, w), Es.trigger("series:transition", f, v, w), f.eachSeries(function(_) { + var y = h._chartsMap[_.__viewId]; + s(_, y), c(_, y); + }), a(h, f), Es.trigger("series:afterupdate", f, v, w); + }, jo = function(h) { + h[JS] = !0, h.getZr().wakeUp(); + }, a2 = function(h) { + h[JS] && (h.getZr().storage.traverse(function(f) { + xd(f) || i(f); + }), h[JS] = !1); + }; + function i(h) { + for (var f = [], v = h.currentStates, b = 0; b < v.length; b++) { + var w = v[b]; + w === "emphasis" || w === "blur" || w === "select" || f.push(w); + } + h.selected && h.states.select && f.push("select"), h.hoverState === Rb && h.states.emphasis ? f.push("emphasis") : h.hoverState === Kg && h.states.blur && f.push("blur"), h.useStates(f); + } + function a(h, f) { + var v = h._zr, b = v.storage, w = 0; + b.traverse(function(p) { + p.isGroup || w++; + }), w > f.get("hoverLayerThreshold") && !Dr.node && !Dr.worker && f.eachSeries(function(p) { + if (!p.preventUsingHoverLayer) { + var d = h._chartsMap[p.__viewId]; + d.__alive && d.eachRendered(function(m) { + m.states.emphasis && (m.states.emphasis.hoverLayer = !0); + }); + } + }); + } + function o(h, f) { + var v = h.get("blendMode") || null; + f.eachRendered(function(b) { + b.isGroup || (b.style.blend = v); + }); + } + function s(h, f) { + if (!h.preventAutoZ) { + var v = h.get("z") || 0, b = h.get("zlevel") || 0; + f.eachRendered(function(w) { + return l(w, v, b, -1 / 0), !0; + }); + } + } + function l(h, f, v, b) { + var w = h.getTextContent(), p = h.getTextGuideLine(), d = h.isGroup; + if (d) + for (var m = h.childrenRef(), _ = 0; _ < m.length; _++) + b = Math.max(l(m[_], f, v, b), b); + else + h.z = f, h.zlevel = v, b = Math.max(h.z2, b); + if (w && (w.z = f, w.zlevel = v, isFinite(b) && (w.z2 = b + 2)), p) { + var y = h.textGuideLineConfig; + p.z = f, p.zlevel = v, isFinite(b) && (p.z2 = b + (y && y.showAbove ? 1 : -1)); + } + return b; + } + function u(h, f) { + f.eachRendered(function(v) { + if (!xd(v)) { + var b = v.getTextContent(), w = v.getTextGuideLine(); + v.stateTransition && (v.stateTransition = null), b && b.stateTransition && (b.stateTransition = null), w && w.stateTransition && (w.stateTransition = null), v.hasState() ? (v.prevStates = v.currentStates, v.clearStates()) : v.prevStates && (v.prevStates = null); + } + }); + } + function c(h, f) { + var v = h.getModel("stateAnimation"), b = h.isAnimationEnabled(), w = v.get("duration"), p = w > 0 ? { + duration: w, + delay: v.get("delay"), + easing: v.get("easing") + // additive: stateAnimationModel.get('additive') + } : null; + f.eachRendered(function(d) { + if (d.states && d.states.emphasis) { + if (xd(d)) + return; + if (d instanceof hr && $J(d), d.__dirty) { + var m = d.prevStates; + m && d.useStates(m); + } + if (b) { + d.stateTransition = p; + var _ = d.getTextContent(), y = d.getTextGuideLine(); + _ && (_.stateTransition = p), y && (y.stateTransition = p); + } + d.__dirty && i(d); + } + }); + } + i2 = function(h) { + return new /** @class */ + (function(f) { + Pe(v, f); + function v() { + return f !== null && f.apply(this, arguments) || this; + } + return v.prototype.getCoordinateSystems = function() { + return h._coordSysMgr.getCoordinateSystems(); + }, v.prototype.getComponentByElement = function(b) { + for (; b; ) { + var w = b.__ecComponentInfo; + if (w != null) + return h._model.getComponent(w.mainType, w.index); + b = b.parent; + } + }, v.prototype.enterEmphasis = function(b, w) { + tu(b, w), jo(h); + }, v.prototype.leaveEmphasis = function(b, w) { + ru(b, w), jo(h); + }, v.prototype.enterBlur = function(b) { + A5(b), jo(h); + }, v.prototype.leaveBlur = function(b) { + ZI(b), jo(h); + }, v.prototype.enterSelect = function(b) { + E5(b), jo(h); + }, v.prototype.leaveSelect = function(b) { + M5(b), jo(h); + }, v.prototype.getModel = function() { + return h.getModel(); + }, v.prototype.getViewOfComponentModel = function(b) { + return h.getViewOfComponentModel(b); + }, v.prototype.getViewOfSeriesModel = function(b) { + return h.getViewOfSeriesModel(b); + }, v; + }(DF))(h); + }, I4 = function(h) { + function f(v, b) { + for (var w = 0; w < v.length; w++) { + var p = v[w]; + p[KS] = b; + } + } + X(Xp, function(v, b) { + h._messageCenter.on(b, function(w) { + if (O_[h.group] && h[KS] !== e2) { + if (w && w.escapeConnect) + return; + var p = h.makeActionFromEvent(w), d = []; + X(zh, function(m) { + m !== h && m.group === h.group && d.push(m); + }), f(d, e2), X(d, function(m) { + m[KS] !== wee && m.dispatchAction(p); + }), f(d, Cee); + } + }); + }); + }; + }(), e; + }(rs) +), AA = M_.prototype; +AA.on = x4("on"); +AA.off = x4("off"); +AA.one = function(r, e, t) { + var n = this; + function i() { + for (var a = [], o = 0; o < arguments.length; o++) + a[o] = arguments[o]; + e && e.apply && e.apply(this, a), n.off(r, i); + } + this.on.call(this, r, i, t); +}; +var Tee = ["click", "dblclick", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", "globalout", "contextmenu"]; +var D_ = {}, Xp = {}, Q1 = [], q1 = [], k_ = [], A4 = {}, eT = {}, zh = {}, O_ = {}, Iee = +/* @__PURE__ */ new Date() - 0, Aee = +/* @__PURE__ */ new Date() - 0, EA = "_echarts_instance_"; +function MA(r, e, t) { + var n = !(t && t.ssr); + if (n) { + var i = am(r); + if (i) + return i; + } + var a = new M_(r, e, t); + return a.id = "ec_" + Iee++, zh[a.id] = a, n && i5(r, EA, a.id), I4(a), Es.trigger("afterinit", a), a; +} +function E4(r) { + if (We(r)) { + var e = r; + r = null, X(e, function(t) { + t.group != null && (r = t.group); + }), r = r || "g_" + Aee++, X(e, function(t) { + t.group = r; + }); + } + return O_[r] = !0, r; +} +function DA(r) { + O_[r] = !1; +} +var M4 = DA; +function D4(r) { + ut(r) ? r = zh[r] : r instanceof M_ || (r = am(r)), r instanceof M_ && !r.isDisposed() && r.dispose(); +} +function am(r) { + return zh[AZ(r, EA)]; +} +function k4(r) { + return zh[r]; +} +function ex(r, e) { + A4[r] = e; +} +function tx(r) { + ir(q1, r) < 0 && q1.push(r); +} +function rx(r, e) { + RA(Q1, r, e, gee); +} +function kA(r) { + om("afterinit", r); +} +function OA(r) { + om("afterupdate", r); +} +function om(r, e) { + Es.on(r, e); +} +function os(r, e, t) { + Tt(e) && (t = e, e = ""); + var n = kt(r) ? r.type : [r, r = { + event: e + }][0]; + r.event = (r.event || n).toLowerCase(), e = r.event, !Xp[e] && (pa(qO.test(n) && qO.test(e)), D_[n] || (D_[n] = { + action: t, + actionInfo: r + }), Xp[e] = n); +} +function LA(r, e) { + av.register(r, e); +} +function O4(r) { + var e = av.get(r); + if (e) + return e.getDimensionsInfo ? e.getDimensionsInfo() : e.dimensions.slice(); +} +function PA(r, e) { + RA(k_, r, e, y4, "layout"); +} +function cu(r, e) { + RA(k_, r, e, _4, "visual"); +} +var o2 = []; +function RA(r, e, t, n, i) { + if ((Tt(e) || kt(e)) && (t = e, e = n), !(ir(o2, t) >= 0)) { + o2.push(t); + var a = o4.wrapStageHandler(t, i); + a.__prio = e, a.__raw = t, r.push(a); + } +} +function nx(r, e) { + eT[r] = e; +} +function L4(r) { + TI({ + createCanvas: r + }); +} +function NA(r, e, t) { + var n = g4("registerMap"); + n && n(r, e, t); +} +function P4(r) { + var e = g4("getMap"); + return e && e(r); +} +var zA = GQ; +cu(TA, gq); +cu(qb, mq); +cu(qb, yq); +cu(TA, Lq); +cu(qb, Pq); +cu(b4, uee); +tx(OF); +rx(vee, CQ); +nx("default", _q); +os({ + type: Rh, + event: Rh, + update: Rh +}, Qn); +os({ + type: B0, + event: B0, + update: B0 +}, Qn); +os({ + type: Vp, + event: Vp, + update: Vp +}, Qn); +os({ + type: j0, + event: j0, + update: j0 +}, Qn); +os({ + type: Gp, + event: Gp, + update: Gp +}, Qn); +ex("light", Dq); +ex("dark", kq); +var R4 = {}, s2 = [], Eee = { + registerPreprocessor: tx, + registerProcessor: rx, + registerPostInit: kA, + registerPostUpdate: OA, + registerUpdateLifecycle: om, + registerAction: os, + registerCoordinateSystem: LA, + registerLayout: PA, + registerVisual: cu, + registerTransform: zA, + registerLoading: nx, + registerMap: NA, + registerImpl: hee, + PRIORITY: IA, + ComponentModel: xr, + ComponentView: Sn, + SeriesModel: mn, + ChartView: en, + // TODO Use ComponentModel and SeriesModel instead of Constructor + registerComponentModel: function(r) { + xr.registerClass(r); + }, + registerComponentView: function(r) { + Sn.registerClass(r); + }, + registerSeriesModel: function(r) { + mn.registerClass(r); + }, + registerChartView: function(r) { + en.registerClass(r); + }, + registerSubTypeDefaulter: function(r, e) { + xr.registerSubTypeDefaulter(r, e); + }, + registerPainter: function(r, e) { + Wj(r, e); + } +}; +function Kt(r) { + if (We(r)) { + X(r, function(e) { + Kt(e); + }); + return; + } + ir(s2, r) >= 0 || (s2.push(r), Tt(r) && (r = { + install: r + }), r.install(Eee)); +} +function op(r) { + return r == null ? 0 : r.length || 1; +} +function l2(r) { + return r; +} +var Mee = ( + /** @class */ + function() { + function r(e, t, n, i, a, o) { + this._old = e, this._new = t, this._oldKeyGetter = n || l2, this._newKeyGetter = i || l2, this.context = a, this._diffModeMultiple = o === "multiple"; + } + return r.prototype.add = function(e) { + return this._add = e, this; + }, r.prototype.update = function(e) { + return this._update = e, this; + }, r.prototype.updateManyToOne = function(e) { + return this._updateManyToOne = e, this; + }, r.prototype.updateOneToMany = function(e) { + return this._updateOneToMany = e, this; + }, r.prototype.updateManyToMany = function(e) { + return this._updateManyToMany = e, this; + }, r.prototype.remove = function(e) { + return this._remove = e, this; + }, r.prototype.execute = function() { + this[this._diffModeMultiple ? "_executeMultiple" : "_executeOneToOne"](); + }, r.prototype._executeOneToOne = function() { + var e = this._old, t = this._new, n = {}, i = new Array(e.length), a = new Array(t.length); + this._initIndexMap(e, null, i, "_oldKeyGetter"), this._initIndexMap(t, n, a, "_newKeyGetter"); + for (var o = 0; o < e.length; o++) { + var s = i[o], l = n[s], u = op(l); + if (u > 1) { + var c = l.shift(); + l.length === 1 && (n[s] = l[0]), this._update && this._update(c, o); + } else + u === 1 ? (n[s] = null, this._update && this._update(l, o)) : this._remove && this._remove(o); + } + this._performRestAdd(a, n); + }, r.prototype._executeMultiple = function() { + var e = this._old, t = this._new, n = {}, i = {}, a = [], o = []; + this._initIndexMap(e, n, a, "_oldKeyGetter"), this._initIndexMap(t, i, o, "_newKeyGetter"); + for (var s = 0; s < a.length; s++) { + var l = a[s], u = n[l], c = i[l], h = op(u), f = op(c); + if (h > 1 && f === 1) + this._updateManyToOne && this._updateManyToOne(c, u), i[l] = null; + else if (h === 1 && f > 1) + this._updateOneToMany && this._updateOneToMany(c, u), i[l] = null; + else if (h === 1 && f === 1) + this._update && this._update(c, u), i[l] = null; + else if (h > 1 && f > 1) + this._updateManyToMany && this._updateManyToMany(c, u), i[l] = null; + else if (h > 1) + for (var v = 0; v < h; v++) + this._remove && this._remove(u[v]); + else + this._remove && this._remove(u); + } + this._performRestAdd(o, i); + }, r.prototype._performRestAdd = function(e, t) { + for (var n = 0; n < e.length; n++) { + var i = e[n], a = t[i], o = op(a); + if (o > 1) + for (var s = 0; s < o; s++) + this._add && this._add(a[s]); + else + o === 1 && this._add && this._add(a); + t[i] = null; + } + }, r.prototype._initIndexMap = function(e, t, n, i) { + for (var a = this._diffModeMultiple, o = 0; o < e.length; o++) { + var s = "_ec_" + this[i](e[o], o); + if (a || (n[o] = s), !!t) { + var l = t[s], u = op(l); + u === 0 ? (t[s] = o, a && n.push(s)) : u === 1 ? t[s] = [l, o] : l.push(o); + } + } + }, r; + }() +); +const nu = Mee; +var Dee = ( + /** @class */ + function() { + function r(e, t) { + this._encode = e, this._schema = t; + } + return r.prototype.get = function() { + return { + // Do not generate full dimension name until fist used. + fullDimensions: this._getFullDimensionNames(), + encode: this._encode + }; + }, r.prototype._getFullDimensionNames = function() { + return this._cachedDimNames || (this._cachedDimNames = this._schema ? this._schema.makeOutputDimensionNames() : []), this._cachedDimNames; + }, r; + }() +); +function kee(r, e) { + var t = {}, n = t.encode = {}, i = xt(), a = [], o = [], s = {}; + X(r.dimensions, function(f) { + var v = r.getDimensionInfo(f), b = v.coordDim; + if (b) { + var w = v.coordDimIndex; + nw(n, b)[w] = f, v.isExtraCoord || (i.set(b, 1), Oee(v.type) && (a[0] = f), nw(s, b)[w] = r.getDimensionIndex(v.name)), v.defaultTooltip && o.push(f); + } + xF.each(function(p, d) { + var m = nw(n, d), _ = v.otherDims[d]; + _ != null && _ !== !1 && (m[_] = v.name); + }); + }); + var l = [], u = {}; + i.each(function(f, v) { + var b = n[v]; + u[v] = b[0], l = l.concat(b); + }), t.dataDimsOnCoord = l, t.dataDimIndicesOnCoord = Ke(l, function(f) { + return r.getDimensionInfo(f).storeDimIndex; + }), t.encodeFirstDimNotExtra = u; + var c = n.label; + c && c.length && (a = c.slice()); + var h = n.tooltip; + return h && h.length ? o = h.slice() : o.length || (o = a.slice()), n.defaultedLabel = a, n.defaultedTooltip = o, t.userOutput = new Dee(s, e), t; +} +function nw(r, e) { + return r.hasOwnProperty(e) || (r[e] = []), r[e]; +} +function L_(r) { + return r === "category" ? "ordinal" : r === "time" ? "time" : "float"; +} +function Oee(r) { + return !(r === "ordinal" || r === "time"); +} +var Lee = ( + /** @class */ + function() { + function r(e) { + this.otherDims = {}, e != null && Fe(this, e); + } + return r; + }() +); +const G0 = Lee; +var Pee = Rr(), Ree = { + float: "f", + int: "i", + ordinal: "o", + number: "n", + time: "t" +}, N4 = ( + /** @class */ + function() { + function r(e) { + this.dimensions = e.dimensions, this._dimOmitted = e.dimensionOmitted, this.source = e.source, this._fullDimCount = e.fullDimensionCount, this._updateDimOmitted(e.dimensionOmitted); + } + return r.prototype.isDimensionOmitted = function() { + return this._dimOmitted; + }, r.prototype._updateDimOmitted = function(e) { + this._dimOmitted = e, e && (this._dimNameMap || (this._dimNameMap = j4(this.source))); + }, r.prototype.getSourceDimensionIndex = function(e) { + return Jt(this._dimNameMap.get(e), -1); + }, r.prototype.getSourceDimension = function(e) { + var t = this.source.dimensionsDefine; + if (t) + return t[e]; + }, r.prototype.makeStoreSchema = function() { + for (var e = this._fullDimCount, t = PF(this.source), n = !F4(e), i = "", a = [], o = 0, s = 0; o < e; o++) { + var l = void 0, u = void 0, c = void 0, h = this.dimensions[s]; + if (h && h.storeDimIndex === o) + l = t ? h.name : null, u = h.type, c = h.ordinalMeta, s++; + else { + var f = this.getSourceDimension(o); + f && (l = t ? f.name : null, u = f.type); + } + a.push({ + property: l, + type: u, + ordinalMeta: c + }), t && l != null && (!h || !h.isCalculationCoord) && (i += n ? l.replace(/\`/g, "`1").replace(/\$/g, "`2") : l), i += "$", i += Ree[u] || "f", c && (i += c.uid), i += "$"; + } + var v = this.source, b = [v.seriesLayoutBy, v.startIndex, i].join("$$"); + return { + dimensions: a, + hash: b + }; + }, r.prototype.makeOutputDimensionNames = function() { + for (var e = [], t = 0, n = 0; t < this._fullDimCount; t++) { + var i = void 0, a = this.dimensions[n]; + if (a && a.storeDimIndex === t) + a.isCalculationCoord || (i = a.name), n++; + else { + var o = this.getSourceDimension(t); + o && (i = o.name); + } + e.push(i); + } + return e; + }, r.prototype.appendCalculationDimension = function(e) { + this.dimensions.push(e), e.isCalculationCoord = !0, this._fullDimCount++, this._updateDimOmitted(!0); + }, r; + }() +); +function z4(r) { + return r instanceof N4; +} +function B4(r) { + for (var e = xt(), t = 0; t < (r || []).length; t++) { + var n = r[t], i = kt(n) ? n.name : n; + i != null && e.get(i) == null && e.set(i, t); + } + return e; +} +function j4(r) { + var e = Pee(r); + return e.dimNameMap || (e.dimNameMap = B4(r.dimensionsDefine)); +} +function F4(r) { + return r > 30; +} +var sp = kt, zu = Ke, Nee = typeof Int32Array == "undefined" ? Array : Int32Array, zee = "e\0\0", u2 = -1, Bee = ["hasItemOption", "_nameList", "_idList", "_invertedIndicesMap", "_dimSummary", "userOutput", "_rawData", "_dimValueGetter", "_nameDimIdx", "_idDimIdx", "_nameRepeatCount"], jee = ["_approximateExtent"], c2, Uy, lp, up, iw, Wy, aw, Fee = ( + /** @class */ + function() { + function r(e, t) { + this.type = "list", this._dimOmitted = !1, this._nameList = [], this._idList = [], this._visual = {}, this._layout = {}, this._itemVisuals = [], this._itemLayouts = [], this._graphicEls = [], this._approximateExtent = {}, this._calculationInfo = {}, this.hasItemOption = !1, this.TRANSFERABLE_METHODS = ["cloneShallow", "downSample", "lttbDownSample", "map"], this.CHANGABLE_METHODS = ["filterSelf", "selectRange"], this.DOWNSAMPLE_METHODS = ["downSample", "lttbDownSample"]; + var n, i = !1; + z4(e) ? (n = e.dimensions, this._dimOmitted = e.isDimensionOmitted(), this._schema = e) : (i = !0, n = e), n = n || ["x", "y"]; + for (var a = {}, o = [], s = {}, l = !1, u = {}, c = 0; c < n.length; c++) { + var h = n[c], f = ut(h) ? new G0({ + name: h + }) : h instanceof G0 ? h : new G0(h), v = f.name; + f.type = f.type || "float", f.coordDim || (f.coordDim = v, f.coordDimIndex = 0); + var b = f.otherDims = f.otherDims || {}; + o.push(v), a[v] = f, u[v] != null && (l = !0), f.createInvertedIndices && (s[v] = []), b.itemName === 0 && (this._nameDimIdx = c), b.itemId === 0 && (this._idDimIdx = c), i && (f.storeDimIndex = c); + } + if (this.dimensions = o, this._dimInfos = a, this._initGetDimensionInfo(l), this.hostModel = t, this._invertedIndicesMap = s, this._dimOmitted) { + var w = this._dimIdxToName = xt(); + X(o, function(p) { + w.set(a[p].storeDimIndex, p); + }); + } + } + return r.prototype.getDimension = function(e) { + var t = this._recognizeDimIndex(e); + if (t == null) + return e; + if (t = e, !this._dimOmitted) + return this.dimensions[t]; + var n = this._dimIdxToName.get(t); + if (n != null) + return n; + var i = this._schema.getSourceDimension(t); + if (i) + return i.name; + }, r.prototype.getDimensionIndex = function(e) { + var t = this._recognizeDimIndex(e); + if (t != null) + return t; + if (e == null) + return -1; + var n = this._getDimInfo(e); + return n ? n.storeDimIndex : this._dimOmitted ? this._schema.getSourceDimensionIndex(e) : -1; + }, r.prototype._recognizeDimIndex = function(e) { + if (Pr(e) || e != null && !isNaN(e) && !this._getDimInfo(e) && (!this._dimOmitted || this._schema.getSourceDimensionIndex(e) < 0)) + return +e; + }, r.prototype._getStoreDimIndex = function(e) { + var t = this.getDimensionIndex(e); + return t; + }, r.prototype.getDimensionInfo = function(e) { + return this._getDimInfo(this.getDimension(e)); + }, r.prototype._initGetDimensionInfo = function(e) { + var t = this._dimInfos; + this._getDimInfo = e ? function(n) { + return t.hasOwnProperty(n) ? t[n] : void 0; + } : function(n) { + return t[n]; + }; + }, r.prototype.getDimensionsOnCoord = function() { + return this._dimSummary.dataDimsOnCoord.slice(); + }, r.prototype.mapDimension = function(e, t) { + var n = this._dimSummary; + if (t == null) + return n.encodeFirstDimNotExtra[e]; + var i = n.encode[e]; + return i ? i[t] : null; + }, r.prototype.mapDimensionsAll = function(e) { + var t = this._dimSummary, n = t.encode[e]; + return (n || []).slice(); + }, r.prototype.getStore = function() { + return this._store; + }, r.prototype.initData = function(e, t, n) { + var i = this, a; + if (e instanceof U1 && (a = e), !a) { + var o = this.dimensions, s = pA(e) || Yi(e) ? new RF(e, o.length) : e; + a = new U1(); + var l = zu(o, function(u) { + return { + type: i._dimInfos[u].type, + property: u + }; + }); + a.initData(s, l, n); + } + this._store = a, this._nameList = (t || []).slice(), this._idList = [], this._nameRepeatCount = {}, this._doInit(0, a.count()), this._dimSummary = kee(this, this._schema), this.userOutput = this._dimSummary.userOutput; + }, r.prototype.appendData = function(e) { + var t = this._store.appendData(e); + this._doInit(t[0], t[1]); + }, r.prototype.appendValues = function(e, t) { + var n = this._store.appendValues(e, t.length), i = n.start, a = n.end, o = this._shouldMakeIdFromName(); + if (this._updateOrdinalMeta(), t) + for (var s = i; s < a; s++) { + var l = s - i; + this._nameList[s] = t[l], o && aw(this, s); + } + }, r.prototype._updateOrdinalMeta = function() { + for (var e = this._store, t = this.dimensions, n = 0; n < t.length; n++) { + var i = this._dimInfos[t[n]]; + i.ordinalMeta && e.collectOrdinalMeta(i.storeDimIndex, i.ordinalMeta); + } + }, r.prototype._shouldMakeIdFromName = function() { + var e = this._store.getProvider(); + return this._idDimIdx == null && e.getSource().sourceFormat !== sc && !e.fillStorage; + }, r.prototype._doInit = function(e, t) { + if (!(e >= t)) { + var n = this._store, i = n.getProvider(); + this._updateOrdinalMeta(); + var a = this._nameList, o = this._idList, s = i.getSource().sourceFormat, l = s === is; + if (l && !i.pure) + for (var u = [], c = e; c < t; c++) { + var h = i.getItem(c, u); + if (!this.hasItemOption && vZ(h) && (this.hasItemOption = !0), h) { + var f = h.name; + a[c] == null && f != null && (a[c] = Si(f, null)); + var v = h.id; + o[c] == null && v != null && (o[c] = Si(v, null)); + } + } + if (this._shouldMakeIdFromName()) + for (var c = e; c < t; c++) + aw(this, c); + c2(this); + } + }, r.prototype.getApproximateExtent = function(e) { + return this._approximateExtent[e] || this._store.getDataExtent(this._getStoreDimIndex(e)); + }, r.prototype.setApproximateExtent = function(e, t) { + t = this.getDimension(t), this._approximateExtent[t] = e.slice(); + }, r.prototype.getCalculationInfo = function(e) { + return this._calculationInfo[e]; + }, r.prototype.setCalculationInfo = function(e, t) { + sp(e) ? Fe(this._calculationInfo, e) : this._calculationInfo[e] = t; + }, r.prototype.getName = function(e) { + var t = this.getRawIndex(e), n = this._nameList[t]; + return n == null && this._nameDimIdx != null && (n = lp(this, this._nameDimIdx, t)), n == null && (n = ""), n; + }, r.prototype._getCategory = function(e, t) { + var n = this._store.get(e, t), i = this._store.getOrdinalMeta(e); + return i ? i.categories[n] : n; + }, r.prototype.getId = function(e) { + return Uy(this, this.getRawIndex(e)); + }, r.prototype.count = function() { + return this._store.count(); + }, r.prototype.get = function(e, t) { + var n = this._store, i = this._dimInfos[e]; + if (i) + return n.get(i.storeDimIndex, t); + }, r.prototype.getByRawIndex = function(e, t) { + var n = this._store, i = this._dimInfos[e]; + if (i) + return n.getByRawIndex(i.storeDimIndex, t); + }, r.prototype.getIndices = function() { + return this._store.getIndices(); + }, r.prototype.getDataExtent = function(e) { + return this._store.getDataExtent(this._getStoreDimIndex(e)); + }, r.prototype.getSum = function(e) { + return this._store.getSum(this._getStoreDimIndex(e)); + }, r.prototype.getMedian = function(e) { + return this._store.getMedian(this._getStoreDimIndex(e)); + }, r.prototype.getValues = function(e, t) { + var n = this, i = this._store; + return We(e) ? i.getValues(zu(e, function(a) { + return n._getStoreDimIndex(a); + }), t) : i.getValues(e); + }, r.prototype.hasValue = function(e) { + for (var t = this._dimSummary.dataDimIndicesOnCoord, n = 0, i = t.length; n < i; n++) + if (isNaN(this._store.get(t[n], e))) + return !1; + return !0; + }, r.prototype.indexOfName = function(e) { + for (var t = 0, n = this._store.count(); t < n; t++) + if (this.getName(t) === e) + return t; + return -1; + }, r.prototype.getRawIndex = function(e) { + return this._store.getRawIndex(e); + }, r.prototype.indexOfRawIndex = function(e) { + return this._store.indexOfRawIndex(e); + }, r.prototype.rawIndexOf = function(e, t) { + var n = e && this._invertedIndicesMap[e], i = n[t]; + return i == null || isNaN(i) ? u2 : i; + }, r.prototype.indicesOfNearest = function(e, t, n) { + return this._store.indicesOfNearest(this._getStoreDimIndex(e), t, n); + }, r.prototype.each = function(e, t, n) { + Tt(e) && (n = t, t = e, e = []); + var i = n || this, a = zu(up(e), this._getStoreDimIndex, this); + this._store.each(a, i ? ft(t, i) : t); + }, r.prototype.filterSelf = function(e, t, n) { + Tt(e) && (n = t, t = e, e = []); + var i = n || this, a = zu(up(e), this._getStoreDimIndex, this); + return this._store = this._store.filter(a, i ? ft(t, i) : t), this; + }, r.prototype.selectRange = function(e) { + var t = this, n = {}, i = yr(e); + return X(i, function(a) { + var o = t._getStoreDimIndex(a); + n[o] = e[a]; + }), this._store = this._store.selectRange(n), this; + }, r.prototype.mapArray = function(e, t, n) { + Tt(e) && (n = t, t = e, e = []), n = n || this; + var i = []; + return this.each(e, function() { + i.push(t && t.apply(this, arguments)); + }, n), i; + }, r.prototype.map = function(e, t, n, i) { + var a = n || i || this, o = zu(up(e), this._getStoreDimIndex, this), s = Wy(this); + return s._store = this._store.map(o, a ? ft(t, a) : t), s; + }, r.prototype.modify = function(e, t, n, i) { + var a = n || i || this, o = zu(up(e), this._getStoreDimIndex, this); + this._store.modify(o, a ? ft(t, a) : t); + }, r.prototype.downSample = function(e, t, n, i) { + var a = Wy(this); + return a._store = this._store.downSample(this._getStoreDimIndex(e), t, n, i), a; + }, r.prototype.lttbDownSample = function(e, t) { + var n = Wy(this); + return n._store = this._store.lttbDownSample(this._getStoreDimIndex(e), t), n; + }, r.prototype.getRawDataItem = function(e) { + return this._store.getRawDataItem(e); + }, r.prototype.getItemModel = function(e) { + var t = this.hostModel, n = this.getRawDataItem(e); + return new qr(n, t, t && t.ecModel); + }, r.prototype.diff = function(e) { + var t = this; + return new nu(e ? e.getStore().getIndices() : [], this.getStore().getIndices(), function(n) { + return Uy(e, n); + }, function(n) { + return Uy(t, n); + }); + }, r.prototype.getVisual = function(e) { + var t = this._visual; + return t && t[e]; + }, r.prototype.setVisual = function(e, t) { + this._visual = this._visual || {}, sp(e) ? Fe(this._visual, e) : this._visual[e] = t; + }, r.prototype.getItemVisual = function(e, t) { + var n = this._itemVisuals[e], i = n && n[t]; + return i == null ? this.getVisual(t) : i; + }, r.prototype.hasItemVisual = function() { + return this._itemVisuals.length > 0; + }, r.prototype.ensureUniqueItemVisual = function(e, t) { + var n = this._itemVisuals, i = n[e]; + i || (i = n[e] = {}); + var a = i[t]; + return a == null && (a = this.getVisual(t), We(a) ? a = a.slice() : sp(a) && (a = Fe({}, a)), i[t] = a), a; + }, r.prototype.setItemVisual = function(e, t, n) { + var i = this._itemVisuals[e] || {}; + this._itemVisuals[e] = i, sp(t) ? Fe(i, t) : i[t] = n; + }, r.prototype.clearAllVisual = function() { + this._visual = {}, this._itemVisuals = []; + }, r.prototype.setLayout = function(e, t) { + sp(e) ? Fe(this._layout, e) : this._layout[e] = t; + }, r.prototype.getLayout = function(e) { + return this._layout[e]; + }, r.prototype.getItemLayout = function(e) { + return this._itemLayouts[e]; + }, r.prototype.setItemLayout = function(e, t, n) { + this._itemLayouts[e] = n ? Fe(this._itemLayouts[e] || {}, t) : t; + }, r.prototype.clearItemLayouts = function() { + this._itemLayouts.length = 0; + }, r.prototype.setItemGraphicEl = function(e, t) { + var n = this.hostModel && this.hostModel.seriesIndex; + O1(n, this.dataType, e, t), this._graphicEls[e] = t; + }, r.prototype.getItemGraphicEl = function(e) { + return this._graphicEls[e]; + }, r.prototype.eachItemGraphicEl = function(e, t) { + X(this._graphicEls, function(n, i) { + n && e && e.call(t, n, i); + }); + }, r.prototype.cloneShallow = function(e) { + return e || (e = new r(this._schema ? this._schema : zu(this.dimensions, this._getDimInfo, this), this.hostModel)), iw(e, this), e._store = this._store, e; + }, r.prototype.wrapMethod = function(e, t) { + var n = this[e]; + Tt(n) && (this.__wrappedMethods = this.__wrappedMethods || [], this.__wrappedMethods.push(e), this[e] = function() { + var i = n.apply(this, arguments); + return t.apply(this, [i].concat(Cb(arguments))); + }); + }, r.internalField = function() { + c2 = function(e) { + var t = e._invertedIndicesMap; + X(t, function(n, i) { + var a = e._dimInfos[i], o = a.ordinalMeta, s = e._store; + if (o) { + n = t[i] = new Nee(o.categories.length); + for (var l = 0; l < n.length; l++) + n[l] = u2; + for (var l = 0; l < s.count(); l++) + n[s.get(a.storeDimIndex, l)] = l; + } + }); + }, lp = function(e, t, n) { + return Si(e._getCategory(t, n), null); + }, Uy = function(e, t) { + var n = e._idList[t]; + return n == null && e._idDimIdx != null && (n = lp(e, e._idDimIdx, t)), n == null && (n = zee + t), n; + }, up = function(e) { + return We(e) || (e = e != null ? [e] : []), e; + }, Wy = function(e) { + var t = new r(e._schema ? e._schema : zu(e.dimensions, e._getDimInfo, e), e.hostModel); + return iw(t, e), t; + }, iw = function(e, t) { + X(Bee.concat(t.__wrappedMethods || []), function(n) { + t.hasOwnProperty(n) && (e[n] = t[n]); + }), e.__wrappedMethods = t.__wrappedMethods, X(jee, function(n) { + e[n] = Ot(t[n]); + }), e._calculationInfo = Fe({}, t._calculationInfo); + }, aw = function(e, t) { + var n = e._nameList, i = e._idList, a = e._nameDimIdx, o = e._idDimIdx, s = n[t], l = i[t]; + if (s == null && a != null && (n[t] = s = lp(e, a, t)), l == null && o != null && (i[t] = l = lp(e, o, t)), l == null && s != null) { + var u = e._nameRepeatCount, c = u[s] = (u[s] || 0) + 1; + l = s, c > 1 && (l += "__ec__" + c), i[t] = l; + } + }; + }(), r; + }() +); +const Ui = Fee; +function $ee(r, e) { + return uv(r, e).dimensions; +} +function uv(r, e) { + pA(r) || (r = gA(r)), e = e || {}; + var t = e.coordDimensions || [], n = e.dimensionsDefine || r.dimensionsDefine || [], i = xt(), a = [], o = Vee(r, t, n, e.dimensionsCount), s = e.canOmitUnusedDimensions && F4(o), l = n === r.dimensionsDefine, u = l ? j4(r) : B4(n), c = e.encodeDefine; + !c && e.encodeDefaulter && (c = e.encodeDefaulter(r, o)); + for (var h = xt(c), f = new VF(o), v = 0; v < f.length; v++) + f[v] = -1; + function b(C) { + var E = f[C]; + if (E < 0) { + var M = n[C], P = kt(M) ? M : { + name: M + }, R = new G0(), N = P.name; + N != null && u.get(N) != null && (R.name = R.displayName = N), P.type != null && (R.type = P.type), P.displayName != null && (R.displayName = P.displayName); + var F = a.length; + return f[C] = F, R.storeDimIndex = C, a.push(R), R; + } + return a[E]; + } + if (!s) + for (var v = 0; v < o; v++) + b(v); + h.each(function(C, E) { + var M = ln(C).slice(); + if (M.length === 1 && !ut(M[0]) && M[0] < 0) { + h.set(E, !1); + return; + } + var P = h.set(E, []); + X(M, function(R, N) { + var F = ut(R) ? u.get(R) : R; + F != null && F < o && (P[N] = F, p(b(F), E, N)); + }); + }); + var w = 0; + X(t, function(C) { + var E, M, P, R; + if (ut(C)) + E = C, R = {}; + else { + R = C, E = R.name; + var N = R.ordinalMeta; + R.ordinalMeta = null, R = Fe({}, R), R.ordinalMeta = N, M = R.dimsDef, P = R.otherDims, R.name = R.coordDim = R.coordDimIndex = R.dimsDef = R.otherDims = null; + } + var F = h.get(E); + if (F !== !1) { + if (F = ln(F), !F.length) + for (var U = 0; U < (M && M.length || 1); U++) { + for (; w < o && b(w).coordDim != null; ) + w++; + w < o && F.push(w++); + } + X(F, function($, G) { + var Q = b($); + if (l && R.type != null && (Q.type = R.type), p(Mt(Q, R), E, G), Q.name == null && M) { + var ee = M[G]; + !kt(ee) && (ee = { + name: ee + }), Q.name = Q.displayName = ee.name, Q.defaultTooltip = ee.defaultTooltip; + } + P && Mt(Q.otherDims, P); + }); + } + }); + function p(C, E, M) { + xF.get(E) != null ? C.otherDims[E] = M : (C.coordDim = E, C.coordDimIndex = M, i.set(E, !0)); + } + var d = e.generateCoord, m = e.generateCoordCount, _ = m != null; + m = d ? m || 1 : 0; + var y = d || "value"; + function x(C) { + C.name == null && (C.name = C.coordDim); + } + if (s) + X(a, function(C) { + x(C); + }), a.sort(function(C, E) { + return C.storeDimIndex - E.storeDimIndex; + }); + else + for (var g = 0; g < o; g++) { + var S = b(g), T = S.coordDim; + T == null && (S.coordDim = Gee(y, i, _), S.coordDimIndex = 0, (!d || m <= 0) && (S.isExtraCoord = !0), m--), x(S), S.type == null && (TF(r, g) === Vi.Must || S.isExtraCoord && (S.otherDims.itemName != null || S.otherDims.seriesName != null)) && (S.type = "ordinal"); + } + return Hee(a), new N4({ + source: r, + dimensions: a, + fullDimensionCount: o, + dimensionOmitted: s + }); +} +function Hee(r) { + for (var e = xt(), t = 0; t < r.length; t++) { + var n = r[t], i = n.name, a = e.get(i) || 0; + a > 0 && (n.name = i + (a - 1)), a++, e.set(i, a); + } +} +function Vee(r, e, t, n) { + var i = Math.max(r.dimensionsDetectedCount || 1, e.length, t.length, n || 0); + return X(e, function(a) { + var o; + kt(a) && (o = a.dimsDef) && (i = Math.max(i, o.length)); + }), i; +} +function Gee(r, e, t) { + if (t || e.hasKey(r)) { + for (var n = 0; e.hasKey(r + n); ) + n++; + r += n; + } + return e.set(r, !0), r; +} +var Uee = ( + /** @class */ + function() { + function r(e) { + this.coordSysDims = [], this.axisMap = xt(), this.categoryAxisMap = xt(), this.coordSysName = e; + } + return r; + }() +); +function Wee(r) { + var e = r.get("coordinateSystem"), t = new Uee(e), n = Yee[e]; + if (n) + return n(r, t, t.axisMap, t.categoryAxisMap), t; +} +var Yee = { + cartesian2d: function(r, e, t, n) { + var i = r.getReferringComponents("xAxis", mi).models[0], a = r.getReferringComponents("yAxis", mi).models[0]; + e.coordSysDims = ["x", "y"], t.set("x", i), t.set("y", a), Xf(i) && (n.set("x", i), e.firstCategoryDimIndex = 0), Xf(a) && (n.set("y", a), e.firstCategoryDimIndex == null && (e.firstCategoryDimIndex = 1)); + }, + singleAxis: function(r, e, t, n) { + var i = r.getReferringComponents("singleAxis", mi).models[0]; + e.coordSysDims = ["single"], t.set("single", i), Xf(i) && (n.set("single", i), e.firstCategoryDimIndex = 0); + }, + polar: function(r, e, t, n) { + var i = r.getReferringComponents("polar", mi).models[0], a = i.findAxisModel("radiusAxis"), o = i.findAxisModel("angleAxis"); + e.coordSysDims = ["radius", "angle"], t.set("radius", a), t.set("angle", o), Xf(a) && (n.set("radius", a), e.firstCategoryDimIndex = 0), Xf(o) && (n.set("angle", o), e.firstCategoryDimIndex == null && (e.firstCategoryDimIndex = 1)); + }, + geo: function(r, e, t, n) { + e.coordSysDims = ["lng", "lat"]; + }, + parallel: function(r, e, t, n) { + var i = r.ecModel, a = i.getComponent("parallel", r.get("parallelIndex")), o = e.coordSysDims = a.dimensions.slice(); + X(a.parallelAxisIndex, function(s, l) { + var u = i.getComponent("parallelAxis", s), c = o[l]; + t.set(c, u), Xf(u) && (n.set(c, u), e.firstCategoryDimIndex == null && (e.firstCategoryDimIndex = l)); + }); + } +}; +function Xf(r) { + return r.get("type") === "category"; +} +function $4(r, e, t) { + t = t || {}; + var n = t.byIndex, i = t.stackedCoordDimension, a, o, s; + Xee(e) ? a = e : (o = e.schema, a = o.dimensions, s = e.store); + var l = !!(r && r.get("stack")), u, c, h, f; + if (X(a, function(m, _) { + ut(m) && (a[_] = m = { + name: m + }), l && !m.isExtraCoord && (!n && !u && m.ordinalMeta && (u = m), !c && m.type !== "ordinal" && m.type !== "time" && (!i || i === m.coordDim) && (c = m)); + }), c && !n && !u && (n = !0), c) { + h = "__\0ecstackresult_" + r.id, f = "__\0ecstackedover_" + r.id, u && (u.createInvertedIndices = !0); + var v = c.coordDim, b = c.type, w = 0; + X(a, function(m) { + m.coordDim === v && w++; + }); + var p = { + name: h, + coordDim: v, + coordDimIndex: w, + type: b, + isExtraCoord: !0, + isCalculationCoord: !0, + storeDimIndex: a.length + }, d = { + name: f, + // This dimension contains stack base (generally, 0), so do not set it as + // `stackedDimCoordDim` to avoid extent calculation, consider log scale. + coordDim: f, + coordDimIndex: w + 1, + type: b, + isExtraCoord: !0, + isCalculationCoord: !0, + storeDimIndex: a.length + 1 + }; + o ? (s && (p.storeDimIndex = s.ensureCalculationDimension(f, b), d.storeDimIndex = s.ensureCalculationDimension(h, b)), o.appendCalculationDimension(p), o.appendCalculationDimension(d)) : (a.push(p), a.push(d)); + } + return { + stackedDimension: c && c.name, + stackedByDimension: u && u.name, + isStackedByIndex: n, + stackedOverDimension: f, + stackResultDimension: h + }; +} +function Xee(r) { + return !z4(r.schema); +} +function iu(r, e) { + return !!e && e === r.getCalculationInfo("stackedDimension"); +} +function BA(r, e) { + return iu(r, e) ? r.getCalculationInfo("stackResultDimension") : e; +} +function Zee(r, e) { + var t = r.get("coordinateSystem"), n = av.get(t), i; + return e && e.coordSysDims && (i = Ke(e.coordSysDims, function(a) { + var o = { + name: a + }, s = e.axisMap.get(a); + if (s) { + var l = s.get("type"); + o.type = L_(l); + } + return o; + })), i || (i = n && (n.getDimensionsInfo ? n.getDimensionsInfo() : n.dimensions.slice()) || ["x", "y"]), i; +} +function Jee(r, e, t) { + var n, i; + return t && X(r, function(a, o) { + var s = a.coordDim, l = t.categoryAxisMap.get(s); + l && (n == null && (n = o), a.ordinalMeta = l.getOrdinalMeta(), e && (a.createInvertedIndices = !0)), a.otherDims.itemName != null && (i = !0); + }), !i && n != null && (r[n].otherDims.itemName = 0), n; +} +function Dl(r, e, t) { + t = t || {}; + var n = e.getSourceManager(), i, a = !1; + r ? (a = !0, i = gA(r)) : (i = n.getSource(), a = i.sourceFormat === is); + var o = Wee(e), s = Zee(e, o), l = t.useEncodeDefaulter, u = Tt(l) ? l : l ? jt(CF, s, e) : null, c = { + coordDimensions: s, + generateCoord: t.generateCoord, + encodeDefine: e.getEncode(), + encodeDefaulter: u, + canOmitUnusedDimensions: !a + }, h = uv(i, c), f = Jee(h.dimensions, t.createInvertedIndices, o), v = a ? null : n.getSharedDataStore(h), b = $4(e, { + schema: h, + store: v + }), w = new Ui(h, e); + w.setCalculationInfo(b); + var p = f != null && Kee(i) ? function(d, m, _, y) { + return y === f ? _ : this.defaultDimValueGetter(d, m, _, y); + } : null; + return w.hasItemOption = !1, w.initData( + // Try to reuse the data store in sourceManager if using dataset. + a ? i : v, + null, + p + ), w; +} +function Kee(r) { + if (r.sourceFormat === is) { + var e = Qee(r.data || []); + return !We(Xd(e)); + } +} +function Qee(r) { + for (var e = 0; e < r.length && r[e] == null; ) + e++; + return r[e]; +} +var H4 = ( + /** @class */ + function() { + function r(e) { + this._setting = e || {}, this._extent = [1 / 0, -1 / 0]; + } + return r.prototype.getSetting = function(e) { + return this._setting[e]; + }, r.prototype.unionExtent = function(e) { + var t = this._extent; + e[0] < t[0] && (t[0] = e[0]), e[1] > t[1] && (t[1] = e[1]); + }, r.prototype.unionExtentFromData = function(e, t) { + this.unionExtent(e.getApproximateExtent(t)); + }, r.prototype.getExtent = function() { + return this._extent.slice(); + }, r.prototype.setExtent = function(e, t) { + var n = this._extent; + isNaN(e) || (n[0] = e), isNaN(t) || (n[1] = t); + }, r.prototype.isInExtentRange = function(e) { + return this._extent[0] <= e && this._extent[1] >= e; + }, r.prototype.isBlank = function() { + return this._isBlank; + }, r.prototype.setBlank = function(e) { + this._isBlank = e; + }, r; + }() +); +kb(H4); +const hu = H4; +var qee = 0, ete = ( + /** @class */ + function() { + function r(e) { + this.categories = e.categories || [], this._needCollect = e.needCollect, this._deduplication = e.deduplication, this.uid = ++qee; + } + return r.createByAxisModel = function(e) { + var t = e.option, n = t.data, i = n && Ke(n, tte); + return new r({ + categories: i, + needCollect: !i, + // deduplication is default in axis. + deduplication: t.dedplication !== !1 + }); + }, r.prototype.getOrdinal = function(e) { + return this._getOrCreateMap().get(e); + }, r.prototype.parseAndCollect = function(e) { + var t, n = this._needCollect; + if (!ut(e) && !n) + return e; + if (n && !this._deduplication) + return t = this.categories.length, this.categories[t] = e, t; + var i = this._getOrCreateMap(); + return t = i.get(e), t == null && (n ? (t = this.categories.length, this.categories[t] = e, i.set(e, t)) : t = NaN), t; + }, r.prototype._getOrCreateMap = function() { + return this._map || (this._map = xt(this.categories)); + }, r; + }() +); +function tte(r) { + return kt(r) && r.value != null ? r.value : r + ""; +} +const tT = ete; +function rT(r) { + return r.type === "interval" || r.type === "log"; +} +function rte(r, e, t, n) { + var i = {}, a = r[1] - r[0], o = i.interval = FI(a / e, !0); + t != null && o < t && (o = i.interval = t), n != null && o > n && (o = i.interval = n); + var s = i.intervalPrecision = V4(o), l = i.niceTickExtent = [Vn(Math.ceil(r[0] / o) * o, s), Vn(Math.floor(r[1] / o) * o, s)]; + return nte(l, r), i; +} +function ow(r) { + var e = Math.pow(10, Db(r)), t = r / e; + return t ? t === 2 ? t = 3 : t === 3 ? t = 5 : t *= 2 : t = 1, Vn(t * e); +} +function V4(r) { + return Ds(r) + 2; +} +function h2(r, e, t) { + r[e] = Math.max(Math.min(r[e], t[1]), t[0]); +} +function nte(r, e) { + !isFinite(r[0]) && (r[0] = e[0]), !isFinite(r[1]) && (r[1] = e[1]), h2(r, 0, e), h2(r, 1, e), r[0] > r[1] && (r[0] = r[1]); +} +function ix(r, e) { + return r >= e[0] && r <= e[1]; +} +function ax(r, e) { + return e[1] === e[0] ? 0.5 : (r - e[0]) / (e[1] - e[0]); +} +function ox(r, e) { + return r * (e[1] - e[0]) + e[0]; +} +var G4 = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + n.type = "ordinal"; + var i = n.getSetting("ordinalMeta"); + return i || (i = new tT({})), We(i) && (i = new tT({ + categories: Ke(i, function(a) { + return kt(a) ? a.value : a; + }) + })), n._ordinalMeta = i, n._extent = n.getSetting("extent") || [0, i.categories.length - 1], n; + } + return e.prototype.parse = function(t) { + return t == null ? NaN : ut(t) ? this._ordinalMeta.getOrdinal(t) : Math.round(t); + }, e.prototype.contain = function(t) { + return t = this.parse(t), ix(t, this._extent) && this._ordinalMeta.categories[t] != null; + }, e.prototype.normalize = function(t) { + return t = this._getTickNumber(this.parse(t)), ax(t, this._extent); + }, e.prototype.scale = function(t) { + return t = Math.round(ox(t, this._extent)), this.getRawOrdinalNumber(t); + }, e.prototype.getTicks = function() { + for (var t = [], n = this._extent, i = n[0]; i <= n[1]; ) + t.push({ + value: i + }), i++; + return t; + }, e.prototype.getMinorTicks = function(t) { + }, e.prototype.setSortInfo = function(t) { + if (t == null) { + this._ordinalNumbersByTick = this._ticksByOrdinalNumber = null; + return; + } + for (var n = t.ordinalNumbers, i = this._ordinalNumbersByTick = [], a = this._ticksByOrdinalNumber = [], o = 0, s = this._ordinalMeta.categories.length, l = Math.min(s, n.length); o < l; ++o) { + var u = n[o]; + i[o] = u, a[u] = o; + } + for (var c = 0; o < s; ++o) { + for (; a[c] != null; ) + c++; + i.push(c), a[c] = o; + } + }, e.prototype._getTickNumber = function(t) { + var n = this._ticksByOrdinalNumber; + return n && t >= 0 && t < n.length ? n[t] : t; + }, e.prototype.getRawOrdinalNumber = function(t) { + var n = this._ordinalNumbersByTick; + return n && t >= 0 && t < n.length ? n[t] : t; + }, e.prototype.getLabel = function(t) { + if (!this.isBlank()) { + var n = this.getRawOrdinalNumber(t.value), i = this._ordinalMeta.categories[n]; + return i == null ? "" : i + ""; + } + }, e.prototype.count = function() { + return this._extent[1] - this._extent[0] + 1; + }, e.prototype.unionExtentFromData = function(t, n) { + this.unionExtent(t.getApproximateExtent(n)); + }, e.prototype.isInExtentRange = function(t) { + return t = this._getTickNumber(t), this._extent[0] <= t && this._extent[1] >= t; + }, e.prototype.getOrdinalMeta = function() { + return this._ordinalMeta; + }, e.prototype.calcNiceTicks = function() { + }, e.prototype.calcNiceExtent = function() { + }, e.type = "ordinal", e; + }(hu) +); +hu.registerClass(G4); +const jA = G4; +var oh = Vn, U4 = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "interval", t._interval = 0, t._intervalPrecision = 2, t; + } + return e.prototype.parse = function(t) { + return t; + }, e.prototype.contain = function(t) { + return ix(t, this._extent); + }, e.prototype.normalize = function(t) { + return ax(t, this._extent); + }, e.prototype.scale = function(t) { + return ox(t, this._extent); + }, e.prototype.setExtent = function(t, n) { + var i = this._extent; + isNaN(t) || (i[0] = parseFloat(t)), isNaN(n) || (i[1] = parseFloat(n)); + }, e.prototype.unionExtent = function(t) { + var n = this._extent; + t[0] < n[0] && (n[0] = t[0]), t[1] > n[1] && (n[1] = t[1]), this.setExtent(n[0], n[1]); + }, e.prototype.getInterval = function() { + return this._interval; + }, e.prototype.setInterval = function(t) { + this._interval = t, this._niceExtent = this._extent.slice(), this._intervalPrecision = V4(t); + }, e.prototype.getTicks = function(t) { + var n = this._interval, i = this._extent, a = this._niceExtent, o = this._intervalPrecision, s = []; + if (!n) + return s; + var l = 1e4; + i[0] < a[0] && (t ? s.push({ + value: oh(a[0] - n, o) + }) : s.push({ + value: i[0] + })); + for (var u = a[0]; u <= a[1] && (s.push({ + value: u + }), u = oh(u + n, o), u !== s[s.length - 1].value); ) + if (s.length > l) + return []; + var c = s.length ? s[s.length - 1].value : a[1]; + return i[1] > c && (t ? s.push({ + value: oh(c + n, o) + }) : s.push({ + value: i[1] + })), s; + }, e.prototype.getMinorTicks = function(t) { + for (var n = this.getTicks(!0), i = [], a = this.getExtent(), o = 1; o < n.length; o++) { + for (var s = n[o], l = n[o - 1], u = 0, c = [], h = s.value - l.value, f = h / t; u < t - 1; ) { + var v = oh(l.value + (u + 1) * f); + v > a[0] && v < a[1] && c.push(v), u++; + } + i.push(c); + } + return i; + }, e.prototype.getLabel = function(t, n) { + if (t == null) + return ""; + var i = n && n.precision; + i == null ? i = Ds(t.value) || 0 : i === "auto" && (i = this._intervalPrecision); + var a = oh(t.value, i, !0); + return lA(a); + }, e.prototype.calcNiceTicks = function(t, n, i) { + t = t || 5; + var a = this._extent, o = a[1] - a[0]; + if (isFinite(o)) { + o < 0 && (o = -o, a.reverse()); + var s = rte(a, t, n, i); + this._intervalPrecision = s.intervalPrecision, this._interval = s.interval, this._niceExtent = s.niceTickExtent; + } + }, e.prototype.calcNiceExtent = function(t) { + var n = this._extent; + if (n[0] === n[1]) + if (n[0] !== 0) { + var i = Math.abs(n[0]); + t.fixMax || (n[1] += i / 2), n[0] -= i / 2; + } else + n[1] = 1; + var a = n[1] - n[0]; + isFinite(a) || (n[0] = 0, n[1] = 1), this.calcNiceTicks(t.splitNumber, t.minInterval, t.maxInterval); + var o = this._interval; + t.fixMin || (n[0] = oh(Math.floor(n[0] / o) * o)), t.fixMax || (n[1] = oh(Math.ceil(n[1] / o) * o)); + }, e.prototype.setNiceExtent = function(t, n) { + this._niceExtent = [t, n]; + }, e.type = "interval", e; + }(hu) +); +hu.registerClass(U4); +const pc = U4; +var W4 = typeof Float32Array != "undefined", ite = W4 ? Float32Array : Array; +function ml(r) { + return We(r) ? W4 ? new Float32Array(r) : r : new ite(r); +} +var nT = "__ec_stack_"; +function FA(r) { + return r.get("stack") || nT + r.seriesIndex; +} +function $A(r) { + return r.dim + r.index; +} +function ate(r) { + var e = [], t = r.axis, n = "axis0"; + if (t.type === "category") { + for (var i = t.getBandWidth(), a = 0; a < r.count; a++) + e.push(Mt({ + bandWidth: i, + axisKey: n, + stackId: nT + a + }, r)); + for (var o = Z4(e), s = [], a = 0; a < r.count; a++) { + var l = o[n][nT + a]; + l.offsetCenter = l.offset + l.width / 2, s.push(l); + } + return s; + } +} +function Y4(r, e) { + var t = []; + return e.eachSeriesByType(r, function(n) { + Q4(n) && t.push(n); + }), t; +} +function ote(r) { + var e = {}; + X(r, function(l) { + var u = l.coordinateSystem, c = u.getBaseAxis(); + if (!(c.type !== "time" && c.type !== "value")) + for (var h = l.getData(), f = c.dim + "_" + c.index, v = h.getDimensionIndex(h.mapDimension(c.dim)), b = h.getStore(), w = 0, p = b.count(); w < p; ++w) { + var d = b.get(v, w); + e[f] ? e[f].push(d) : e[f] = [d]; + } + }); + var t = {}; + for (var n in e) + if (e.hasOwnProperty(n)) { + var i = e[n]; + if (i) { + i.sort(function(l, u) { + return l - u; + }); + for (var a = null, o = 1; o < i.length; ++o) { + var s = i[o] - i[o - 1]; + s > 0 && (a = a === null ? s : Math.min(a, s)); + } + t[n] = a; + } + } + return t; +} +function X4(r) { + var e = ote(r), t = []; + return X(r, function(n) { + var i = n.coordinateSystem, a = i.getBaseAxis(), o = a.getExtent(), s; + if (a.type === "category") + s = a.getBandWidth(); + else if (a.type === "value" || a.type === "time") { + var l = a.dim + "_" + a.index, u = e[l], c = Math.abs(o[1] - o[0]), h = a.scale.getExtent(), f = Math.abs(h[1] - h[0]); + s = u ? c / f * u : c; + } else { + var v = n.getData(); + s = Math.abs(o[1] - o[0]) / v.count(); + } + var b = ot(n.get("barWidth"), s), w = ot(n.get("barMaxWidth"), s), p = ot( + // barMinWidth by default is 0.5 / 1 in cartesian. Because in value axis, + // the auto-calculated bar width might be less than 0.5 / 1. + n.get("barMinWidth") || (q4(n) ? 0.5 : 1), + s + ), d = n.get("barGap"), m = n.get("barCategoryGap"); + t.push({ + bandWidth: s, + barWidth: b, + barMaxWidth: w, + barMinWidth: p, + barGap: d, + barCategoryGap: m, + axisKey: $A(a), + stackId: FA(n) + }); + }), Z4(t); +} +function Z4(r) { + var e = {}; + X(r, function(n, i) { + var a = n.axisKey, o = n.bandWidth, s = e[a] || { + bandWidth: o, + remainedWidth: o, + autoWidthCount: 0, + categoryGap: null, + gap: "20%", + stacks: {} + }, l = s.stacks; + e[a] = s; + var u = n.stackId; + l[u] || s.autoWidthCount++, l[u] = l[u] || { + width: 0, + maxWidth: 0 + }; + var c = n.barWidth; + c && !l[u].width && (l[u].width = c, c = Math.min(s.remainedWidth, c), s.remainedWidth -= c); + var h = n.barMaxWidth; + h && (l[u].maxWidth = h); + var f = n.barMinWidth; + f && (l[u].minWidth = f); + var v = n.barGap; + v != null && (s.gap = v); + var b = n.barCategoryGap; + b != null && (s.categoryGap = b); + }); + var t = {}; + return X(e, function(n, i) { + t[i] = {}; + var a = n.stacks, o = n.bandWidth, s = n.categoryGap; + if (s == null) { + var l = yr(a).length; + s = Math.max(35 - l * 4, 15) + "%"; + } + var u = ot(s, o), c = ot(n.gap, 1), h = n.remainedWidth, f = n.autoWidthCount, v = (h - u) / (f + (f - 1) * c); + v = Math.max(v, 0), X(a, function(d) { + var m = d.maxWidth, _ = d.minWidth; + if (d.width) { + var y = d.width; + m && (y = Math.min(y, m)), _ && (y = Math.max(y, _)), d.width = y, h -= y + c * y, f--; + } else { + var y = v; + m && m < y && (y = Math.min(m, h)), _ && _ > y && (y = _), y !== v && (d.width = y, h -= y + c * y, f--); + } + }), v = (h - u) / (f + (f - 1) * c), v = Math.max(v, 0); + var b = 0, w; + X(a, function(d, m) { + d.width || (d.width = v), w = d, b += d.width * (1 + c); + }), w && (b -= w.width * c); + var p = -b / 2; + X(a, function(d, m) { + t[i][m] = t[i][m] || { + bandWidth: o, + offset: p, + width: d.width + }, p += d.width * (1 + c); + }); + }), t; +} +function ste(r, e, t) { + if (r && e) { + var n = r[$A(e)]; + return n != null && t != null ? n[FA(t)] : n; + } +} +function J4(r, e) { + var t = Y4(r, e), n = X4(t); + X(t, function(i) { + var a = i.getData(), o = i.coordinateSystem, s = o.getBaseAxis(), l = FA(i), u = n[$A(s)][l], c = u.offset, h = u.width; + a.setLayout({ + bandWidth: u.bandWidth, + offset: c, + size: h + }); + }); +} +function K4(r) { + return { + seriesType: r, + plan: ov(), + reset: function(e) { + if (Q4(e)) { + var t = e.getData(), n = e.coordinateSystem, i = n.getBaseAxis(), a = n.getOtherAxis(i), o = t.getDimensionIndex(t.mapDimension(a.dim)), s = t.getDimensionIndex(t.mapDimension(i.dim)), l = e.get("showBackground", !0), u = t.mapDimension(a.dim), c = t.getCalculationInfo("stackResultDimension"), h = iu(t, u) && !!t.getCalculationInfo("stackedOnSeries"), f = a.isHorizontal(), v = lte(i, a), b = q4(e), w = e.get("barMinHeight") || 0, p = c && t.getDimensionIndex(c), d = t.getLayout("size"), m = t.getLayout("offset"); + return { + progress: function(_, y) { + for (var x = _.count, g = b && ml(x * 3), S = b && l && ml(x * 3), T = b && ml(x), C = n.master.getRect(), E = f ? C.width : C.height, M, P = y.getStore(), R = 0; (M = _.next()) != null; ) { + var N = P.get(h ? p : o, M), F = P.get(s, M), U = v, $ = void 0; + h && ($ = +N - P.get(o, M)); + var G = void 0, Q = void 0, ee = void 0, ce = void 0; + if (f) { + var ne = n.dataToPoint([N, F]); + if (h) { + var fe = n.dataToPoint([$, F]); + U = fe[0]; + } + G = U, Q = ne[1] + m, ee = ne[0] - U, ce = d, Math.abs(ee) < w && (ee = (ee < 0 ? -1 : 1) * w); + } else { + var ne = n.dataToPoint([F, N]); + if (h) { + var fe = n.dataToPoint([F, $]); + U = fe[1]; + } + G = ne[0] + m, Q = U, ee = d, ce = ne[1] - U, Math.abs(ce) < w && (ce = (ce <= 0 ? -1 : 1) * w); + } + b ? (g[R] = G, g[R + 1] = Q, g[R + 2] = f ? ee : ce, S && (S[R] = f ? C.x : G, S[R + 1] = f ? Q : C.y, S[R + 2] = E), T[M] = M) : y.setItemLayout(M, { + x: G, + y: Q, + width: ee, + height: ce + }), R += 3; + } + b && y.setLayout({ + largePoints: g, + largeDataIndices: T, + largeBackgroundPoints: S, + valueAxisHorizontal: f + }); + } + }; + } + } + }; +} +function Q4(r) { + return r.coordinateSystem && r.coordinateSystem.type === "cartesian2d"; +} +function q4(r) { + return r.pipelineContext && r.pipelineContext.large; +} +function lte(r, e) { + return e.toGlobalCoord(e.dataToCoord(e.type === "log" ? 1 : 0)); +} +var ute = function(r, e, t, n) { + for (; t < n; ) { + var i = t + n >>> 1; + r[i][1] < e ? t = i + 1 : n = i; + } + return t; +}, e$ = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "time", n; + } + return e.prototype.getLabel = function(t) { + var n = this.getSetting("useUTC"); + return nm(t.value, rO[jK(Sd(this._minLevelUnit))] || rO.second, n, this.getSetting("locale")); + }, e.prototype.getFormattedLabel = function(t, n, i) { + var a = this.getSetting("useUTC"), o = this.getSetting("locale"); + return FK(t, n, i, o, a); + }, e.prototype.getTicks = function() { + var t = this._interval, n = this._extent, i = []; + if (!t) + return i; + i.push({ + value: n[0], + level: 0 + }); + var a = this.getSetting("useUTC"), o = gte(this._minLevelUnit, this._approxInterval, a, n); + return i = i.concat(o), i.push({ + value: n[1], + level: 0 + }), i; + }, e.prototype.calcNiceExtent = function(t) { + var n = this._extent; + if (n[0] === n[1] && (n[0] -= Jo, n[1] += Jo), n[1] === -1 / 0 && n[0] === 1 / 0) { + var i = /* @__PURE__ */ new Date(); + n[1] = +new Date(i.getFullYear(), i.getMonth(), i.getDate()), n[0] = n[1] - Jo; + } + this.calcNiceTicks(t.splitNumber, t.minInterval, t.maxInterval); + }, e.prototype.calcNiceTicks = function(t, n, i) { + t = t || 10; + var a = this._extent, o = a[1] - a[0]; + this._approxInterval = o / t, n != null && this._approxInterval < n && (this._approxInterval = n), i != null && this._approxInterval > i && (this._approxInterval = i); + var s = Yy.length, l = Math.min(ute(Yy, this._approxInterval, 0, s), s - 1); + this._interval = Yy[l][1], this._minLevelUnit = Yy[Math.max(l - 1, 0)][0]; + }, e.prototype.parse = function(t) { + return Pr(t) ? t : +So(t); + }, e.prototype.contain = function(t) { + return ix(this.parse(t), this._extent); + }, e.prototype.normalize = function(t) { + return ax(this.parse(t), this._extent); + }, e.prototype.scale = function(t) { + return ox(t, this._extent); + }, e.type = "time", e; + }(pc) +), Yy = [ + // Format interval + ["second", aA], + ["minute", oA], + ["hour", Wp], + ["quarter-day", Wp * 6], + ["half-day", Wp * 12], + ["day", Jo * 1.2], + ["half-week", Jo * 3.5], + ["week", Jo * 7], + ["month", Jo * 31], + ["quarter", Jo * 95], + ["half-year", tO / 2], + ["year", tO] + // 1Y +]; +function cte(r, e, t, n) { + var i = So(e), a = So(t), o = function(b) { + return nO(i, b, n) === nO(a, b, n); + }, s = function() { + return o("year"); + }, l = function() { + return s() && o("month"); + }, u = function() { + return l() && o("day"); + }, c = function() { + return u() && o("hour"); + }, h = function() { + return c() && o("minute"); + }, f = function() { + return h() && o("second"); + }, v = function() { + return f() && o("millisecond"); + }; + switch (r) { + case "year": + return s(); + case "month": + return l(); + case "day": + return u(); + case "hour": + return c(); + case "minute": + return h(); + case "second": + return f(); + case "millisecond": + return v(); + } +} +function hte(r, e) { + return r /= Jo, r > 16 ? 16 : r > 7.5 ? 7 : r > 3.5 ? 4 : r > 1.5 ? 2 : 1; +} +function fte(r) { + var e = 30 * Jo; + return r /= e, r > 6 ? 6 : r > 3 ? 3 : r > 2 ? 2 : 1; +} +function dte(r) { + return r /= Wp, r > 12 ? 12 : r > 6 ? 6 : r > 3.5 ? 4 : r > 2 ? 2 : 1; +} +function f2(r, e) { + return r /= e ? oA : aA, r > 30 ? 30 : r > 20 ? 20 : r > 15 ? 15 : r > 10 ? 10 : r > 5 ? 5 : r > 2 ? 2 : 1; +} +function vte(r) { + return FI(r, !0); +} +function pte(r, e, t) { + var n = new Date(r); + switch (Sd(e)) { + case "year": + case "month": + n[hF(t)](0); + case "day": + n[fF(t)](1); + case "hour": + n[dF(t)](0); + case "minute": + n[vF(t)](0); + case "second": + n[pF(t)](0), n[gF(t)](0); + } + return n.getTime(); +} +function gte(r, e, t, n) { + var i = 1e4, a = uF, o = 0; + function s(E, M, P, R, N, F, U) { + for (var $ = new Date(M), G = M, Q = $[R](); G < P && G <= n[1]; ) + U.push({ + value: G + }), Q += E, $[N](Q), G = $.getTime(); + U.push({ + value: G, + notAdd: !0 + }); + } + function l(E, M, P) { + var R = [], N = !M.length; + if (!cte(Sd(E), n[0], n[1], t)) { + N && (M = [{ + // TODO Optimize. Not include so may ticks. + value: pte(new Date(n[0]), E, t) + }, { + value: n[1] + }]); + for (var F = 0; F < M.length - 1; F++) { + var U = M[F].value, $ = M[F + 1].value; + if (U !== $) { + var G = void 0, Q = void 0, ee = void 0, ce = !1; + switch (E) { + case "year": + G = Math.max(1, Math.round(e / Jo / 365)), Q = sA(t), ee = $K(t); + break; + case "half-year": + case "quarter": + case "month": + G = fte(e), Q = wd(t), ee = hF(t); + break; + case "week": + case "half-week": + case "day": + G = hte(e), Q = Gb(t), ee = fF(t), ce = !0; + break; + case "half-day": + case "quarter-day": + case "hour": + G = dte(e), Q = _g(t), ee = dF(t); + break; + case "minute": + G = f2(e, !0), Q = Ub(t), ee = vF(t); + break; + case "second": + G = f2(e, !1), Q = Wb(t), ee = pF(t); + break; + case "millisecond": + G = vte(e), Q = Yb(t), ee = gF(t); + break; + } + s(G, U, $, Q, ee, ce, R), E === "year" && P.length > 1 && F === 0 && P.unshift({ + value: P[0].value - G + }); + } + } + for (var F = 0; F < R.length; F++) + P.push(R[F]); + return R; + } + } + for (var u = [], c = [], h = 0, f = 0, v = 0; v < a.length && o++ < i; ++v) { + var b = Sd(a[v]); + if (BK(a[v])) { + l(a[v], u[u.length - 1] || [], c); + var w = a[v + 1] ? Sd(a[v + 1]) : null; + if (b !== w) { + if (c.length) { + f = h, c.sort(function(E, M) { + return E.value - M.value; + }); + for (var p = [], d = 0; d < c.length; ++d) { + var m = c[d].value; + (d === 0 || c[d - 1].value !== m) && (p.push(c[d]), m >= n[0] && m <= n[1] && h++); + } + var _ = (n[1] - n[0]) / e; + if (h > _ * 1.5 && f > _ / 1.5 || (u.push(p), h > _ || r === a[v])) + break; + } + c = []; + } + } + } + for (var y = Jr(Ke(u, function(E) { + return Jr(E, function(M) { + return M.value >= n[0] && M.value <= n[1] && !M.notAdd; + }); + }), function(E) { + return E.length > 0; + }), x = [], g = y.length - 1, v = 0; v < y.length; ++v) + for (var S = y[v], T = 0; T < S.length; ++T) + x.push({ + value: S[T].value, + level: g - v + }); + x.sort(function(E, M) { + return E.value - M.value; + }); + for (var C = [], v = 0; v < x.length; ++v) + (v === 0 || x[v].value !== x[v - 1].value) && C.push(x[v]); + return C; +} +hu.registerClass(e$); +const t$ = e$; +var d2 = hu.prototype, Zp = pc.prototype, mte = Vn, yte = Math.floor, _te = Math.ceil, Xy = Math.pow, Ts = Math.log, HA = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "log", t.base = 10, t._originalScale = new pc(), t._interval = 0, t; + } + return e.prototype.getTicks = function(t) { + var n = this._originalScale, i = this._extent, a = n.getExtent(), o = Zp.getTicks.call(this, t); + return Ke(o, function(s) { + var l = s.value, u = Vn(Xy(this.base, l)); + return u = l === i[0] && this._fixMin ? Zy(u, a[0]) : u, u = l === i[1] && this._fixMax ? Zy(u, a[1]) : u, { + value: u + }; + }, this); + }, e.prototype.setExtent = function(t, n) { + var i = Ts(this.base); + t = Ts(Math.max(0, t)) / i, n = Ts(Math.max(0, n)) / i, Zp.setExtent.call(this, t, n); + }, e.prototype.getExtent = function() { + var t = this.base, n = d2.getExtent.call(this); + n[0] = Xy(t, n[0]), n[1] = Xy(t, n[1]); + var i = this._originalScale, a = i.getExtent(); + return this._fixMin && (n[0] = Zy(n[0], a[0])), this._fixMax && (n[1] = Zy(n[1], a[1])), n; + }, e.prototype.unionExtent = function(t) { + this._originalScale.unionExtent(t); + var n = this.base; + t[0] = Ts(t[0]) / Ts(n), t[1] = Ts(t[1]) / Ts(n), d2.unionExtent.call(this, t); + }, e.prototype.unionExtentFromData = function(t, n) { + this.unionExtent(t.getApproximateExtent(n)); + }, e.prototype.calcNiceTicks = function(t) { + t = t || 10; + var n = this._extent, i = n[1] - n[0]; + if (!(i === 1 / 0 || i <= 0)) { + var a = Kj(i), o = t / i * a; + for (o <= 0.5 && (a *= 10); !isNaN(a) && Math.abs(a) < 1 && Math.abs(a) > 0; ) + a *= 10; + var s = [Vn(_te(n[0] / a) * a), Vn(yte(n[1] / a) * a)]; + this._interval = a, this._niceExtent = s; + } + }, e.prototype.calcNiceExtent = function(t) { + Zp.calcNiceExtent.call(this, t), this._fixMin = t.fixMin, this._fixMax = t.fixMax; + }, e.prototype.parse = function(t) { + return t; + }, e.prototype.contain = function(t) { + return t = Ts(t) / Ts(this.base), ix(t, this._extent); + }, e.prototype.normalize = function(t) { + return t = Ts(t) / Ts(this.base), ax(t, this._extent); + }, e.prototype.scale = function(t) { + return t = ox(t, this._extent), Xy(this.base, t); + }, e.type = "log", e; + }(hu) +), r$ = HA.prototype; +r$.getMinorTicks = Zp.getMinorTicks; +r$.getLabel = Zp.getLabel; +function Zy(r, e) { + return mte(r, Ds(e)); +} +hu.registerClass(HA); +const bte = HA; +var xte = ( + /** @class */ + function() { + function r(e, t, n) { + this._prepareParams(e, t, n); + } + return r.prototype._prepareParams = function(e, t, n) { + n[1] < n[0] && (n = [NaN, NaN]), this._dataMin = n[0], this._dataMax = n[1]; + var i = this._isOrdinal = e.type === "ordinal"; + this._needCrossZero = e.type === "interval" && t.getNeedCrossZero && t.getNeedCrossZero(); + var a = this._modelMinRaw = t.get("min", !0); + Tt(a) ? this._modelMinNum = Jy(e, a({ + min: n[0], + max: n[1] + })) : a !== "dataMin" && (this._modelMinNum = Jy(e, a)); + var o = this._modelMaxRaw = t.get("max", !0); + if (Tt(o) ? this._modelMaxNum = Jy(e, o({ + min: n[0], + max: n[1] + })) : o !== "dataMax" && (this._modelMaxNum = Jy(e, o)), i) + this._axisDataLen = t.getCategories().length; + else { + var s = t.get("boundaryGap"), l = We(s) ? s : [s || 0, s || 0]; + typeof l[0] == "boolean" || typeof l[1] == "boolean" ? this._boundaryGapInner = [0, 0] : this._boundaryGapInner = [Fs(l[0], 1), Fs(l[1], 1)]; + } + }, r.prototype.calculate = function() { + var e = this._isOrdinal, t = this._dataMin, n = this._dataMax, i = this._axisDataLen, a = this._boundaryGapInner, o = e ? null : n - t || Math.abs(t), s = this._modelMinRaw === "dataMin" ? t : this._modelMinNum, l = this._modelMaxRaw === "dataMax" ? n : this._modelMaxNum, u = s != null, c = l != null; + s == null && (s = e ? i ? 0 : NaN : t - a[0] * o), l == null && (l = e ? i ? i - 1 : NaN : n + a[1] * o), (s == null || !isFinite(s)) && (s = NaN), (l == null || !isFinite(l)) && (l = NaN); + var h = Ld(s) || Ld(l) || e && !i; + this._needCrossZero && (s > 0 && l > 0 && !u && (s = 0), s < 0 && l < 0 && !c && (l = 0)); + var f = this._determinedMin, v = this._determinedMax; + return f != null && (s = f, u = !0), v != null && (l = v, c = !0), { + min: s, + max: l, + minFixed: u, + maxFixed: c, + isBlank: h + }; + }, r.prototype.modifyDataMinMax = function(e, t) { + this[wte[e]] = t; + }, r.prototype.setDeterminedMinMax = function(e, t) { + var n = Ste[e]; + this[n] = t; + }, r.prototype.freeze = function() { + this.frozen = !0; + }, r; + }() +), Ste = { + min: "_determinedMin", + max: "_determinedMax" +}, wte = { + min: "_dataMin", + max: "_dataMax" +}; +function n$(r, e, t) { + var n = r.rawExtentInfo; + return n || (n = new xte(r, e, t), r.rawExtentInfo = n, n); +} +function Jy(r, e) { + return e == null ? null : Ld(e) ? NaN : r.parse(e); +} +function i$(r, e) { + var t = r.type, n = n$(r, e, r.getExtent()).calculate(); + r.setBlank(n.isBlank); + var i = n.min, a = n.max, o = e.ecModel; + if (o && t === "time") { + var s = Y4("bar", o), l = !1; + if (X(s, function(h) { + l = l || h.getBaseAxis() === e.axis; + }), l) { + var u = X4(s), c = Cte(i, a, e, u); + i = c.min, a = c.max; + } + } + return { + extent: [i, a], + // "fix" means "fixed", the value should not be + // changed in the subsequent steps. + fixMin: n.minFixed, + fixMax: n.maxFixed + }; +} +function Cte(r, e, t, n) { + var i = t.axis.getExtent(), a = i[1] - i[0], o = ste(n, t.axis); + if (o === void 0) + return { + min: r, + max: e + }; + var s = 1 / 0; + X(o, function(v) { + s = Math.min(v.offset, s); + }); + var l = -1 / 0; + X(o, function(v) { + l = Math.max(v.offset + v.width, l); + }), s = Math.abs(s), l = Math.abs(l); + var u = s + l, c = e - r, h = 1 - (s + l) / a, f = c / h - c; + return e += f * (l / u), r -= f * (s / u), { + min: r, + max: e + }; +} +function Jh(r, e) { + var t = e, n = i$(r, t), i = n.extent, a = t.get("splitNumber"); + r instanceof bte && (r.base = t.get("logBase")); + var o = r.type, s = t.get("interval"), l = o === "interval" || o === "time"; + r.setExtent(i[0], i[1]), r.calcNiceExtent({ + splitNumber: a, + fixMin: n.fixMin, + fixMax: n.fixMax, + minInterval: l ? t.get("minInterval") : null, + maxInterval: l ? t.get("maxInterval") : null + }), s != null && r.setInterval && r.setInterval(s); +} +function sm(r, e) { + if (e = e || r.get("type"), e) + switch (e) { + case "category": + return new jA({ + ordinalMeta: r.getOrdinalMeta ? r.getOrdinalMeta() : r.getCategories(), + extent: [1 / 0, -1 / 0] + }); + case "time": + return new t$({ + locale: r.ecModel.getLocaleModel(), + useUTC: r.ecModel.get("useUTC") + }); + default: + return new (hu.getClass(e) || pc)(); + } +} +function Tte(r) { + var e = r.scale.getExtent(), t = e[0], n = e[1]; + return !(t > 0 && n > 0 || t < 0 && n < 0); +} +function lm(r) { + var e = r.getLabelModel().get("formatter"), t = r.type === "category" ? r.scale.getExtent()[0] : null; + return r.scale.type === "time" ? function(n) { + return function(i, a) { + return r.scale.getFormattedLabel(i, a, n); + }; + }(e) : ut(e) ? function(n) { + return function(i) { + var a = r.scale.getLabel(i), o = n.replace("{value}", a != null ? a : ""); + return o; + }; + }(e) : Tt(e) ? function(n) { + return function(i, a) { + return t != null && (a = i.value - t), n(VA(r, i), a, i.level != null ? { + level: i.level + } : null); + }; + }(e) : function(n) { + return r.scale.getLabel(n); + }; +} +function VA(r, e) { + return r.type === "category" ? r.scale.getLabel(e) : e.value; +} +function Ite(r) { + var e = r.model, t = r.scale; + if (!(!e.get(["axisLabel", "show"]) || t.isBlank())) { + var n, i, a = t.getExtent(); + t instanceof jA ? i = t.count() : (n = t.getTicks(), i = n.length); + var o = r.getLabelModel(), s = lm(r), l, u = 1; + i > 40 && (u = Math.ceil(i / 40)); + for (var c = 0; c < i; c += u) { + var h = n ? n[c] : { + value: a[0] + c + }, f = s(h, c), v = o.getTextRect(f), b = Ate(v, o.get("rotate") || 0); + l ? l.union(b) : l = b; + } + return l; + } +} +function Ate(r, e) { + var t = e * Math.PI / 180, n = r.width, i = r.height, a = n * Math.abs(Math.cos(t)) + Math.abs(i * Math.sin(t)), o = n * Math.abs(Math.sin(t)) + Math.abs(i * Math.cos(t)), s = new Wt(r.x, r.y, a, o); + return s; +} +function GA(r) { + var e = r.get("interval"); + return e == null ? "auto" : e; +} +function a$(r) { + return r.type === "category" && GA(r.getLabelModel()) === 0; +} +function P_(r, e) { + var t = {}; + return X(r.mapDimensionsAll(e), function(n) { + t[BA(r, n)] = !0; + }), yr(t); +} +function Ete(r, e, t) { + e && X(P_(e, t), function(n) { + var i = e.getApproximateExtent(n); + i[0] < r[0] && (r[0] = i[0]), i[1] > r[1] && (r[1] = i[1]); + }); +} +var cv = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getNeedCrossZero = function() { + var e = this.option; + return !e.scale; + }, r.prototype.getCoordSysModel = function() { + }, r; + }() +); +function Mte(r) { + return Dl(null, r); +} +var Dte = { + isDimensionStacked: iu, + enableDataStack: $4, + getStackedDimension: BA +}; +function kte(r, e) { + var t = e; + e instanceof qr || (t = new qr(e)); + var n = sm(t); + return n.setExtent(r[0], r[1]), Jh(n, t), n; +} +function Ote(r) { + qn(r, cv); +} +function Lte(r, e) { + return e = e || {}, gn(r, null, null, e.state !== "normal"); +} +const o$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createDimensions: $ee, + createList: Mte, + createScale: kte, + createSymbol: li, + createTextStyle: Lte, + dataStack: Dte, + enableHoverEmphasis: ac, + getECData: Ft, + getLayoutRect: yi, + mixinAxisModelCommonMethods: Ote +}, Symbol.toStringTag, { value: "Module" })); +var Pte = 1e-8; +function v2(r, e) { + return Math.abs(r - e) < Pte; +} +function bh(r, e, t) { + var n = 0, i = r[0]; + if (!i) + return !1; + for (var a = 1; a < r.length; a++) { + var o = r[a]; + n += Vl(i[0], i[1], o[0], o[1], e, t), i = o; + } + var s = r[0]; + return (!v2(i[0], s[0]) || !v2(i[1], s[1])) && (n += Vl(i[0], i[1], s[0], s[1], e, t)), n !== 0; +} +var Rte = []; +function sw(r, e) { + for (var t = 0; t < r.length; t++) + zi(r[t], r[t], e); +} +function p2(r, e, t, n) { + for (var i = 0; i < r.length; i++) { + var a = r[i]; + n && (a = n.project(a)), a && isFinite(a[0]) && isFinite(a[1]) && (Ul(e, e, a), Wl(t, t, a)); + } +} +function Nte(r) { + for (var e = 0, t = 0, n = 0, i = r.length, a = r[i - 1][0], o = r[i - 1][1], s = 0; s < i; s++) { + var l = r[s][0], u = r[s][1], c = a * u - l * o; + e += c, t += (a + l) * c, n += (o + u) * c, a = l, o = u; + } + return e ? [t / e / 3, n / e / 3, e] : [r[0][0] || 0, r[0][1] || 0]; +} +var s$ = ( + /** @class */ + function() { + function r(e) { + this.name = e; + } + return r.prototype.setCenter = function(e) { + this._center = e; + }, r.prototype.getCenter = function() { + var e = this._center; + return e || (e = this._center = this.calcCenter()), e; + }, r; + }() +), g2 = ( + /** @class */ + function() { + function r(e, t) { + this.type = "polygon", this.exterior = e, this.interiors = t; + } + return r; + }() +), m2 = ( + /** @class */ + function() { + function r(e) { + this.type = "linestring", this.points = e; + } + return r; + }() +), l$ = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this, t) || this; + return a.type = "geoJSON", a.geometries = n, a._center = i && [i[0], i[1]], a; + } + return e.prototype.calcCenter = function() { + for (var t = this.geometries, n, i = 0, a = 0; a < t.length; a++) { + var o = t[a], s = o.exterior, l = s && s.length; + l > i && (n = o, i = l); + } + if (n) + return Nte(n.exterior); + var u = this.getBoundingRect(); + return [u.x + u.width / 2, u.y + u.height / 2]; + }, e.prototype.getBoundingRect = function(t) { + var n = this._rect; + if (n && !t) + return n; + var i = [1 / 0, 1 / 0], a = [-1 / 0, -1 / 0], o = this.geometries; + return X(o, function(s) { + s.type === "polygon" ? p2(s.exterior, i, a, t) : X(s.points, function(l) { + p2(l, i, a, t); + }); + }), isFinite(i[0]) && isFinite(i[1]) && isFinite(a[0]) && isFinite(a[1]) || (i[0] = i[1] = a[0] = a[1] = 0), n = new Wt(i[0], i[1], a[0] - i[0], a[1] - i[1]), t || (this._rect = n), n; + }, e.prototype.contain = function(t) { + var n = this.getBoundingRect(), i = this.geometries; + if (!n.contain(t[0], t[1])) + return !1; + e: + for (var a = 0, o = i.length; a < o; a++) { + var s = i[a]; + if (s.type === "polygon") { + var l = s.exterior, u = s.interiors; + if (bh(l, t[0], t[1])) { + for (var c = 0; c < (u ? u.length : 0); c++) + if (bh(u[c], t[0], t[1])) + continue e; + return !0; + } + } + } + return !1; + }, e.prototype.transformTo = function(t, n, i, a) { + var o = this.getBoundingRect(), s = o.width / o.height; + i ? a || (a = i / s) : i = s * a; + for (var l = new Wt(t, n, i, a), u = o.calculateTransform(l), c = this.geometries, h = 0; h < c.length; h++) { + var f = c[h]; + f.type === "polygon" ? (sw(f.exterior, u), X(f.interiors, function(v) { + sw(v, u); + })) : X(f.points, function(v) { + sw(v, u); + }); + } + o = this._rect, o.copy(l), this._center = [o.x + o.width / 2, o.y + o.height / 2]; + }, e.prototype.cloneShallow = function(t) { + t == null && (t = this.name); + var n = new e(t, this.geometries, this._center); + return n._rect = this._rect, n.transformTo = null, n; + }, e; + }(s$) +), zte = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n) { + var i = r.call(this, t) || this; + return i.type = "geoSVG", i._elOnlyForCalculate = n, i; + } + return e.prototype.calcCenter = function() { + for (var t = this._elOnlyForCalculate, n = t.getBoundingRect(), i = [n.x + n.width / 2, n.y + n.height / 2], a = Yg(Rte), o = t; o && !o.isGeoSVGGraphicRoot; ) + xl(a, o.getLocalTransform(), a), o = o.parent; + return nf(a, a), zi(i, i, a), i; + }, e; + }(s$) +); +function Bte(r) { + if (!r.UTF8Encoding) + return r; + var e = r, t = e.UTF8Scale; + t == null && (t = 1024); + var n = e.features; + return X(n, function(i) { + var a = i.geometry, o = a.encodeOffsets, s = a.coordinates; + if (o) + switch (a.type) { + case "LineString": + a.coordinates = u$(s, o, t); + break; + case "Polygon": + lw(s, o, t); + break; + case "MultiLineString": + lw(s, o, t); + break; + case "MultiPolygon": + X(s, function(l, u) { + return lw(l, o[u], t); + }); + } + }), e.UTF8Encoding = !1, e; +} +function lw(r, e, t) { + for (var n = 0; n < r.length; n++) + r[n] = u$(r[n], e[n], t); +} +function u$(r, e, t) { + for (var n = [], i = e[0], a = e[1], o = 0; o < r.length; o += 2) { + var s = r.charCodeAt(o) - 64, l = r.charCodeAt(o + 1) - 64; + s = s >> 1 ^ -(s & 1), l = l >> 1 ^ -(l & 1), s += i, l += a, i = s, a = l, n.push([s / t, l / t]); + } + return n; +} +function Tg(r, e) { + return r = Bte(r), Ke(Jr(r.features, function(t) { + return t.geometry && t.properties && t.geometry.coordinates.length > 0; + }), function(t) { + var n = t.properties, i = t.geometry, a = []; + switch (i.type) { + case "Polygon": + var o = i.coordinates; + a.push(new g2(o[0], o.slice(1))); + break; + case "MultiPolygon": + X(i.coordinates, function(l) { + l[0] && a.push(new g2(l[0], l.slice(1))); + }); + break; + case "LineString": + a.push(new m2([i.coordinates])); + break; + case "MultiLineString": + a.push(new m2(i.coordinates)); + } + var s = new l$(n[e || "name"], a, n.cp); + return s.properties = n, s; + }); +} +const c$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + MAX_SAFE_INTEGER: I1, + asc: yo, + getPercentWithPrecision: hZ, + getPixelPrecision: BI, + getPrecision: Ds, + getPrecisionSafe: Zj, + isNumeric: $I, + isRadianAroundZero: fg, + linearMap: Zr, + nice: FI, + numericToNumber: Il, + parseDate: So, + quantile: z0, + quantity: Kj, + quantityExponent: Db, + reformIntervals: A1, + remRadian: jI, + round: Vn +}, Symbol.toStringTag, { value: "Module" })), h$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + format: nm, + parse: So +}, Symbol.toStringTag, { value: "Module" })), f$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Arc: Bb, + BezierCurve: qg, + BoundingRect: Wt, + Circle: $s, + CompoundPath: jb, + Ellipse: zb, + Group: Rt, + Image: ji, + IncrementalDisplayable: Z5, + Line: Ai, + LinearGradient: Jd, + Polygon: La, + Polyline: Pa, + RadialGradient: QI, + Rect: Or, + Ring: Qg, + Sector: Oa, + Text: kr, + clipPointsByRect: rA, + clipRectByRect: eF, + createIcon: Qd, + extendPath: Q5, + extendShape: K5, + getShapeClass: Fb, + getTransform: oc, + initProps: An, + makeImage: eA, + makePath: em, + mergePath: mo, + registerShape: ns, + resizePath: tA, + updateProps: zr +}, Symbol.toStringTag, { value: "Module" })), d$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addCommas: lA, + capitalFirst: UK, + encodeHTML: Ea, + formatTime: GK, + formatTpl: cA, + getTextRect: HK, + getTooltipMarker: mF, + normalizeCssArray: of, + toCamelCase: uA, + truncateText: l5 +}, Symbol.toStringTag, { value: "Module" })), v$ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + bind: ft, + clone: Ot, + curry: jt, + defaults: Mt, + each: X, + extend: Fe, + filter: Jr, + indexOf: ir, + inherits: MI, + isArray: We, + isFunction: Tt, + isObject: kt, + isString: ut, + map: Ke, + merge: Ut, + reduce: es +}, Symbol.toStringTag, { value: "Module" })); +var Ig = Rr(); +function jte(r) { + return r.type === "category" ? $te(r) : Vte(r); +} +function Fte(r, e) { + return r.type === "category" ? Hte(r, e) : { + ticks: Ke(r.scale.getTicks(), function(t) { + return t.value; + }) + }; +} +function $te(r) { + var e = r.getLabelModel(), t = p$(r, e); + return !e.get("show") || r.scale.isBlank() ? { + labels: [], + labelCategoryInterval: t.labelCategoryInterval + } : t; +} +function p$(r, e) { + var t = g$(r, "labels"), n = GA(e), i = m$(t, n); + if (i) + return i; + var a, o; + return Tt(n) ? a = b$(r, n) : (o = n === "auto" ? Gte(r) : n, a = _$(r, o)), y$(t, n, { + labels: a, + labelCategoryInterval: o + }); +} +function Hte(r, e) { + var t = g$(r, "ticks"), n = GA(e), i = m$(t, n); + if (i) + return i; + var a, o; + if ((!e.get("show") || r.scale.isBlank()) && (a = []), Tt(n)) + a = b$(r, n, !0); + else if (n === "auto") { + var s = p$(r, r.getLabelModel()); + o = s.labelCategoryInterval, a = Ke(s.labels, function(l) { + return l.tickValue; + }); + } else + o = n, a = _$(r, o, !0); + return y$(t, n, { + ticks: a, + tickCategoryInterval: o + }); +} +function Vte(r) { + var e = r.scale.getTicks(), t = lm(r); + return { + labels: Ke(e, function(n, i) { + return { + level: n.level, + formattedLabel: t(n, i), + rawLabel: r.scale.getLabel(n), + tickValue: n.value + }; + }) + }; +} +function g$(r, e) { + return Ig(r)[e] || (Ig(r)[e] = []); +} +function m$(r, e) { + for (var t = 0; t < r.length; t++) + if (r[t].key === e) + return r[t].value; +} +function y$(r, e, t) { + return r.push({ + key: e, + value: t + }), t; +} +function Gte(r) { + var e = Ig(r).autoInterval; + return e != null ? e : Ig(r).autoInterval = r.calculateCategoryInterval(); +} +function Ute(r) { + var e = Wte(r), t = lm(r), n = (e.axisRotate - e.labelRotate) / 180 * Math.PI, i = r.scale, a = i.getExtent(), o = i.count(); + if (a[1] - a[0] < 1) + return 0; + var s = 1; + o > 40 && (s = Math.max(1, Math.floor(o / 40))); + for (var l = a[0], u = r.dataToCoord(l + 1) - r.dataToCoord(l), c = Math.abs(u * Math.cos(n)), h = Math.abs(u * Math.sin(n)), f = 0, v = 0; l <= a[1]; l += s) { + var b = 0, w = 0, p = Zg(t({ + value: l + }), e.font, "center", "top"); + b = p.width * 1.3, w = p.height * 1.3, f = Math.max(f, b, 7), v = Math.max(v, w, 7); + } + var d = f / c, m = v / h; + isNaN(d) && (d = 1 / 0), isNaN(m) && (m = 1 / 0); + var _ = Math.max(0, Math.floor(Math.min(d, m))), y = Ig(r.model), x = r.getExtent(), g = y.lastAutoInterval, S = y.lastTickCount; + return g != null && S != null && Math.abs(g - _) <= 1 && Math.abs(S - o) <= 1 && g > _ && y.axisExtent0 === x[0] && y.axisExtent1 === x[1] ? _ = g : (y.lastTickCount = o, y.lastAutoInterval = _, y.axisExtent0 = x[0], y.axisExtent1 = x[1]), _; +} +function Wte(r) { + var e = r.getLabelModel(); + return { + axisRotate: r.getRotate ? r.getRotate() : r.isHorizontal && !r.isHorizontal() ? 90 : 0, + labelRotate: e.get("rotate") || 0, + font: e.getFont() + }; +} +function _$(r, e, t) { + var n = lm(r), i = r.scale, a = i.getExtent(), o = r.getLabelModel(), s = [], l = Math.max((e || 0) + 1, 1), u = a[0], c = i.count(); + u !== 0 && l > 1 && c / l > 2 && (u = Math.round(Math.ceil(u / l) * l)); + var h = a$(r), f = o.get("showMinLabel") || h, v = o.get("showMaxLabel") || h; + f && u !== a[0] && w(a[0]); + for (var b = u; b <= a[1]; b += l) + w(b); + v && b - l !== a[1] && w(a[1]); + function w(p) { + var d = { + value: p + }; + s.push(t ? p : { + formattedLabel: n(d), + rawLabel: i.getLabel(d), + tickValue: p + }); + } + return s; +} +function b$(r, e, t) { + var n = r.scale, i = lm(r), a = []; + return X(n.getTicks(), function(o) { + var s = n.getLabel(o), l = o.value; + e(o.value, s) && a.push(t ? l : { + formattedLabel: i(o), + rawLabel: s, + tickValue: l + }); + }), a; +} +var y2 = [0, 1], Yte = ( + /** @class */ + function() { + function r(e, t, n) { + this.onBand = !1, this.inverse = !1, this.dim = e, this.scale = t, this._extent = n || [0, 0]; + } + return r.prototype.contain = function(e) { + var t = this._extent, n = Math.min(t[0], t[1]), i = Math.max(t[0], t[1]); + return e >= n && e <= i; + }, r.prototype.containData = function(e) { + return this.scale.contain(e); + }, r.prototype.getExtent = function() { + return this._extent.slice(); + }, r.prototype.getPixelPrecision = function(e) { + return BI(e || this.scale.getExtent(), this._extent); + }, r.prototype.setExtent = function(e, t) { + var n = this._extent; + n[0] = e, n[1] = t; + }, r.prototype.dataToCoord = function(e, t) { + var n = this._extent, i = this.scale; + return e = i.normalize(e), this.onBand && i.type === "ordinal" && (n = n.slice(), _2(n, i.count())), Zr(e, y2, n, t); + }, r.prototype.coordToData = function(e, t) { + var n = this._extent, i = this.scale; + this.onBand && i.type === "ordinal" && (n = n.slice(), _2(n, i.count())); + var a = Zr(e, n, y2, t); + return this.scale.scale(a); + }, r.prototype.pointToData = function(e, t) { + }, r.prototype.getTicksCoords = function(e) { + e = e || {}; + var t = e.tickModel || this.getTickModel(), n = Fte(this, t), i = n.ticks, a = Ke(i, function(s) { + return { + coord: this.dataToCoord(this.scale.type === "ordinal" ? this.scale.getRawOrdinalNumber(s) : s), + tickValue: s + }; + }, this), o = t.get("alignWithLabel"); + return Xte(this, a, o, e.clamp), a; + }, r.prototype.getMinorTicksCoords = function() { + if (this.scale.type === "ordinal") + return []; + var e = this.model.getModel("minorTick"), t = e.get("splitNumber"); + t > 0 && t < 100 || (t = 5); + var n = this.scale.getMinorTicks(t), i = Ke(n, function(a) { + return Ke(a, function(o) { + return { + coord: this.dataToCoord(o), + tickValue: o + }; + }, this); + }, this); + return i; + }, r.prototype.getViewLabels = function() { + return jte(this).labels; + }, r.prototype.getLabelModel = function() { + return this.model.getModel("axisLabel"); + }, r.prototype.getTickModel = function() { + return this.model.getModel("axisTick"); + }, r.prototype.getBandWidth = function() { + var e = this._extent, t = this.scale.getExtent(), n = t[1] - t[0] + (this.onBand ? 1 : 0); + n === 0 && (n = 1); + var i = Math.abs(e[1] - e[0]); + return Math.abs(i) / n; + }, r.prototype.calculateCategoryInterval = function() { + return Ute(this); + }, r; + }() +); +function _2(r, e) { + var t = r[1] - r[0], n = e, i = t / n / 2; + r[0] += i, r[1] -= i; +} +function Xte(r, e, t, n) { + var i = e.length; + if (!r.onBand || t || !i) + return; + var a = r.getExtent(), o, s; + if (i === 1) + e[0].coord = a[0], o = e[1] = { + coord: a[1] + }; + else { + var l = e[i - 1].tickValue - e[0].tickValue, u = (e[i - 1].coord - e[0].coord) / l; + X(e, function(v) { + v.coord -= u / 2; + }); + var c = r.scale.getExtent(); + s = 1 + c[1] - e[i - 1].tickValue, o = { + coord: e[i - 1].coord + u * s + }, e.push(o); + } + var h = a[0] > a[1]; + f(e[0].coord, a[0]) && (n ? e[0].coord = a[0] : e.shift()), n && f(a[0], e[0].coord) && e.unshift({ + coord: a[0] + }), f(a[1], o.coord) && (n ? o.coord = a[1] : e.pop()), n && f(o.coord, a[1]) && e.push({ + coord: a[1] + }); + function f(v, b) { + return v = Vn(v), b = Vn(b), h ? v > b : v < b; + } +} +const wo = Yte; +function x$(r) { + var e = xr.extend(r); + return xr.registerClass(e), e; +} +function S$(r) { + var e = Sn.extend(r); + return Sn.registerClass(e), e; +} +function w$(r) { + var e = mn.extend(r); + return mn.registerClass(e), e; +} +function C$(r) { + var e = en.extend(r); + return en.registerClass(e), e; +} +var cp = Math.PI * 2, sh = Al.CMD, Zte = ["top", "right", "bottom", "left"]; +function Jte(r, e, t, n, i) { + var a = t.width, o = t.height; + switch (r) { + case "top": + n.set(t.x + a / 2, t.y - e), i.set(0, -1); + break; + case "bottom": + n.set(t.x + a / 2, t.y + o + e), i.set(0, 1); + break; + case "left": + n.set(t.x - e, t.y + o / 2), i.set(-1, 0); + break; + case "right": + n.set(t.x + a + e, t.y + o / 2), i.set(1, 0); + break; + } +} +function Kte(r, e, t, n, i, a, o, s, l) { + o -= r, s -= e; + var u = Math.sqrt(o * o + s * s); + o /= u, s /= u; + var c = o * t + r, h = s * t + e; + if (Math.abs(n - i) % cp < 1e-4) + return l[0] = c, l[1] = h, u - t; + if (a) { + var f = n; + n = ks(i), i = ks(f); + } else + n = ks(n), i = ks(i); + n > i && (i += cp); + var v = Math.atan2(s, o); + if (v < 0 && (v += cp), v >= n && v <= i || v + cp >= n && v + cp <= i) + return l[0] = c, l[1] = h, u - t; + var b = t * Math.cos(n) + r, w = t * Math.sin(n) + e, p = t * Math.cos(i) + r, d = t * Math.sin(i) + e, m = (b - o) * (b - o) + (w - s) * (w - s), _ = (p - o) * (p - o) + (d - s) * (d - s); + return m < _ ? (l[0] = b, l[1] = w, Math.sqrt(m)) : (l[0] = p, l[1] = d, Math.sqrt(_)); +} +function R_(r, e, t, n, i, a, o, s) { + var l = i - r, u = a - e, c = t - r, h = n - e, f = Math.sqrt(c * c + h * h); + c /= f, h /= f; + var v = l * c + u * h, b = v / f; + s && (b = Math.min(Math.max(b, 0), 1)), b *= f; + var w = o[0] = r + b * c, p = o[1] = e + b * h; + return Math.sqrt((w - i) * (w - i) + (p - a) * (p - a)); +} +function T$(r, e, t, n, i, a, o) { + t < 0 && (r = r + t, t = -t), n < 0 && (e = e + n, n = -n); + var s = r + t, l = e + n, u = o[0] = Math.min(Math.max(i, r), s), c = o[1] = Math.min(Math.max(a, e), l); + return Math.sqrt((u - i) * (u - i) + (c - a) * (c - a)); +} +var Ms = []; +function Qte(r, e, t) { + var n = T$(e.x, e.y, e.width, e.height, r.x, r.y, Ms); + return t.set(Ms[0], Ms[1]), n; +} +function qte(r, e, t) { + for (var n = 0, i = 0, a = 0, o = 0, s, l, u = 1 / 0, c = e.data, h = r.x, f = r.y, v = 0; v < c.length; ) { + var b = c[v++]; + v === 1 && (n = c[v], i = c[v + 1], a = n, o = i); + var w = u; + switch (b) { + case sh.M: + a = c[v++], o = c[v++], n = a, i = o; + break; + case sh.L: + w = R_(n, i, c[v], c[v + 1], h, f, Ms, !0), n = c[v++], i = c[v++]; + break; + case sh.C: + w = Aj(n, i, c[v++], c[v++], c[v++], c[v++], c[v], c[v + 1], h, f, Ms), n = c[v++], i = c[v++]; + break; + case sh.Q: + w = Mj(n, i, c[v++], c[v++], c[v], c[v + 1], h, f, Ms), n = c[v++], i = c[v++]; + break; + case sh.A: + var p = c[v++], d = c[v++], m = c[v++], _ = c[v++], y = c[v++], x = c[v++]; + v += 1; + var g = !!(1 - c[v++]); + s = Math.cos(y) * m + p, l = Math.sin(y) * _ + d, v <= 1 && (a = s, o = l); + var S = (h - p) * _ / m + p; + w = Kte(p, d, _, y, y + x, g, S, f, Ms), n = Math.cos(y + x) * m + p, i = Math.sin(y + x) * _ + d; + break; + case sh.R: + a = n = c[v++], o = i = c[v++]; + var T = c[v++], C = c[v++]; + w = T$(a, o, T, C, h, f, Ms); + break; + case sh.Z: + w = R_(n, i, a, o, h, f, Ms, !0), n = a, i = o; + break; + } + w < u && (u = w, t.set(Ms[0], Ms[1])); + } + return u; +} +var Os = new Zt(), bn = new Zt(), si = new Zt(), yl = new Zt(), pl = new Zt(); +function b2(r, e) { + if (r) { + var t = r.getTextGuideLine(), n = r.getTextContent(); + if (n && t) { + var i = r.textGuideLineConfig || {}, a = [[0, 0], [0, 0], [0, 0]], o = i.candidates || Zte, s = n.getBoundingRect().clone(); + s.applyTransform(n.getComputedTransform()); + var l = 1 / 0, u = i.anchor, c = r.getComputedTransform(), h = c && nf([], c), f = e.get("length2") || 0; + u && si.copy(u); + for (var v = 0; v < o.length; v++) { + var b = o[v]; + Jte(b, 0, s, Os, yl), Zt.scaleAndAdd(bn, Os, yl, f), bn.transform(h); + var w = r.getBoundingRect(), p = u ? u.distance(bn) : r instanceof hr ? qte(bn, r.path, si) : Qte(bn, w, si); + p < l && (l = p, bn.transform(c), si.transform(c), si.toArray(a[0]), bn.toArray(a[1]), Os.toArray(a[2])); + } + I$(a, e.get("minTurnAngle")), t.setShape({ + points: a + }); + } + } +} +var N_ = [], Aa = new Zt(); +function I$(r, e) { + if (e <= 180 && e > 0) { + e = e / 180 * Math.PI, Os.fromArray(r[0]), bn.fromArray(r[1]), si.fromArray(r[2]), Zt.sub(yl, Os, bn), Zt.sub(pl, si, bn); + var t = yl.len(), n = pl.len(); + if (!(t < 1e-3 || n < 1e-3)) { + yl.scale(1 / t), pl.scale(1 / n); + var i = yl.dot(pl), a = Math.cos(e); + if (a < i) { + var o = R_(bn.x, bn.y, si.x, si.y, Os.x, Os.y, N_, !1); + Aa.fromArray(N_), Aa.scaleAndAdd(pl, o / Math.tan(Math.PI - e)); + var s = si.x !== bn.x ? (Aa.x - bn.x) / (si.x - bn.x) : (Aa.y - bn.y) / (si.y - bn.y); + if (isNaN(s)) + return; + s < 0 ? Zt.copy(Aa, bn) : s > 1 && Zt.copy(Aa, si), Aa.toArray(r[1]); + } + } + } +} +function ere(r, e, t) { + if (t <= 180 && t > 0) { + t = t / 180 * Math.PI, Os.fromArray(r[0]), bn.fromArray(r[1]), si.fromArray(r[2]), Zt.sub(yl, bn, Os), Zt.sub(pl, si, bn); + var n = yl.len(), i = pl.len(); + if (!(n < 1e-3 || i < 1e-3)) { + yl.scale(1 / n), pl.scale(1 / i); + var a = yl.dot(e), o = Math.cos(t); + if (a < o) { + var s = R_(bn.x, bn.y, si.x, si.y, Os.x, Os.y, N_, !1); + Aa.fromArray(N_); + var l = Math.PI / 2, u = Math.acos(pl.dot(e)), c = l + u - t; + if (c >= l) + Zt.copy(Aa, si); + else { + Aa.scaleAndAdd(pl, s / Math.tan(Math.PI / 2 - c)); + var h = si.x !== bn.x ? (Aa.x - bn.x) / (si.x - bn.x) : (Aa.y - bn.y) / (si.y - bn.y); + if (isNaN(h)) + return; + h < 0 ? Zt.copy(Aa, bn) : h > 1 && Zt.copy(Aa, si); + } + Aa.toArray(r[1]); + } + } + } +} +function x2(r, e, t, n) { + var i = t === "normal", a = i ? r : r.ensureState(t); + a.ignore = e; + var o = n.get("smooth"); + o && o === !0 && (o = 0.3), a.shape = a.shape || {}, o > 0 && (a.shape.smooth = o); + var s = n.getModel("lineStyle").getLineStyle(); + i ? r.useStyle(s) : a.style = s; +} +function tre(r, e) { + var t = e.smooth, n = e.points; + if (n) + if (r.moveTo(n[0][0], n[0][1]), t > 0 && n.length >= 3) { + var i = Gl(n[0], n[1]), a = Gl(n[1], n[2]); + if (!i || !a) { + r.lineTo(n[1][0], n[1][1]), r.lineTo(n[2][0], n[2][1]); + return; + } + var o = Math.min(i, a) * t, s = Bp([], n[1], n[0], o / i), l = Bp([], n[1], n[2], o / a), u = Bp([], s, l, 0.5); + r.bezierCurveTo(s[0], s[1], s[0], s[1], u[0], u[1]), r.bezierCurveTo(l[0], l[1], l[0], l[1], n[2][0], n[2][1]); + } else + for (var c = 1; c < n.length; c++) + r.lineTo(n[c][0], n[c][1]); +} +function UA(r, e, t) { + var n = r.getTextGuideLine(), i = r.getTextContent(); + if (!i) { + n && r.removeTextGuideLine(); + return; + } + for (var a = e.normal, o = a.get("show"), s = i.ignore, l = 0; l < pg.length; l++) { + var u = pg[l], c = e[u], h = u === "normal"; + if (c) { + var f = c.get("show"), v = h ? s : Jt(i.states[u] && i.states[u].ignore, s); + if (v || !Jt(f, o)) { + var b = h ? n : n && n.states[u]; + b && (b.ignore = !0); + continue; + } + n || (n = new Pa(), r.setTextGuideLine(n), !h && (s || !o) && x2(n, !0, "normal", e.normal), r.stateProxy && (n.stateProxy = r.stateProxy)), x2(n, !1, u, c); + } + } + if (n) { + Mt(n.style, t), n.style.fill = null; + var w = a.get("showAbove"), p = r.textGuideLineConfig = r.textGuideLineConfig || {}; + p.showAbove = w || !1, n.buildPath = tre; + } +} +function WA(r, e) { + e = e || "labelLine"; + for (var t = { + normal: r.getModel(e) + }, n = 0; n < ka.length; n++) { + var i = ka[n]; + t[i] = r.getModel([i, e]); + } + return t; +} +function A$(r) { + for (var e = [], t = 0; t < r.length; t++) { + var n = r[t]; + if (!n.defaultAttr.ignore) { + var i = n.label, a = i.getComputedTransform(), o = i.getBoundingRect(), s = !a || a[1] < 1e-5 && a[2] < 1e-5, l = i.style.margin || 0, u = o.clone(); + u.applyTransform(a), u.x -= l / 2, u.y -= l / 2, u.width += l, u.height += l; + var c = s ? new y_(o, a) : null; + e.push({ + label: i, + labelLine: n.labelLine, + rect: u, + localRect: o, + obb: c, + priority: n.priority, + defaultAttr: n.defaultAttr, + layoutOption: n.computedLayoutOption, + axisAligned: s, + transform: a + }); + } + } + return e; +} +function E$(r, e, t, n, i, a) { + var o = r.length; + if (o < 2) + return; + r.sort(function(T, C) { + return T.rect[e] - C.rect[e]; + }); + for (var s = 0, l, u = !1, c = 0, h = 0; h < o; h++) { + var f = r[h], v = f.rect; + l = v[e] - s, l < 0 && (v[e] -= l, f.label[e] -= l, u = !0); + var b = Math.max(-l, 0); + c += b, s = v[e] + v[t]; + } + c > 0 && a && x(-c / o, 0, o); + var w = r[0], p = r[o - 1], d, m; + _(), d < 0 && g(-d, 0.8), m < 0 && g(m, 0.8), _(), y(d, m, 1), y(m, d, -1), _(), d < 0 && S(-d), m < 0 && S(m); + function _() { + d = w.rect[e] - n, m = i - p.rect[e] - p.rect[t]; + } + function y(T, C, E) { + if (T < 0) { + var M = Math.min(C, -T); + if (M > 0) { + x(M * E, 0, o); + var P = M + T; + P < 0 && g(-P * E, 1); + } else + g(-T * E, 1); + } + } + function x(T, C, E) { + T !== 0 && (u = !0); + for (var M = C; M < E; M++) { + var P = r[M], R = P.rect; + R[e] += T, P.label[e] += T; + } + } + function g(T, C) { + for (var E = [], M = 0, P = 1; P < o; P++) { + var R = r[P - 1].rect, N = Math.max(r[P].rect[e] - R[e] - R[t], 0); + E.push(N), M += N; + } + if (M) { + var F = Math.min(Math.abs(T) / M, C); + if (T > 0) + for (var P = 0; P < o - 1; P++) { + var U = E[P] * F; + x(U, 0, P + 1); + } + else + for (var P = o - 1; P > 0; P--) { + var U = E[P - 1] * F; + x(-U, P, o); + } + } + } + function S(T) { + var C = T < 0 ? -1 : 1; + T = Math.abs(T); + for (var E = Math.ceil(T / (o - 1)), M = 0; M < o - 1; M++) + if (C > 0 ? x(E, 0, M + 1) : x(-E, o - M - 1, o), T -= E, T <= 0) + return; + } + return u; +} +function rre(r, e, t, n) { + return E$(r, "x", "width", e, t, n); +} +function M$(r, e, t, n) { + return E$(r, "y", "height", e, t, n); +} +function D$(r) { + var e = []; + r.sort(function(w, p) { + return p.priority - w.priority; + }); + var t = new Wt(0, 0, 0, 0); + function n(w) { + if (!w.ignore) { + var p = w.ensureState("emphasis"); + p.ignore == null && (p.ignore = !1); + } + w.ignore = !0; + } + for (var i = 0; i < r.length; i++) { + var a = r[i], o = a.axisAligned, s = a.localRect, l = a.transform, u = a.label, c = a.labelLine; + t.copy(a.rect), t.width -= 0.1, t.height -= 0.1, t.x += 0.05, t.y += 0.05; + for (var h = a.obb, f = !1, v = 0; v < e.length; v++) { + var b = e[v]; + if (t.intersect(b.rect)) { + if (o && b.axisAligned) { + f = !0; + break; + } + if (b.obb || (b.obb = new y_(b.localRect, b.transform)), h || (h = new y_(s, l)), h.intersect(b.obb)) { + f = !0; + break; + } + } + } + f ? (n(u), c && n(c)) : (u.attr("ignore", a.defaultAttr.ignore), c && c.attr("ignore", a.defaultAttr.labelGuideIgnore), e.push(a)); + } +} +function nre(r) { + if (r) { + for (var e = [], t = 0; t < r.length; t++) + e.push(r[t].slice()); + return e; + } +} +function ire(r, e) { + var t = r.label, n = e && e.getTextGuideLine(); + return { + dataIndex: r.dataIndex, + dataType: r.dataType, + seriesIndex: r.seriesModel.seriesIndex, + text: r.label.style.text, + rect: r.hostRect, + labelRect: r.rect, + // x: labelAttr.x, + // y: labelAttr.y, + align: t.style.align, + verticalAlign: t.style.verticalAlign, + labelLinePoints: nre(n && n.shape.points) + }; +} +var S2 = ["align", "verticalAlign", "width", "height", "fontSize"], Sa = new Yl(), uw = Rr(), are = Rr(); +function Ky(r, e, t) { + for (var n = 0; n < t.length; n++) { + var i = t[n]; + e[i] != null && (r[i] = e[i]); + } +} +var Qy = ["x", "y", "rotation"], ore = ( + /** @class */ + function() { + function r() { + this._labelList = [], this._chartViewList = []; + } + return r.prototype.clearLabels = function() { + this._labelList = [], this._chartViewList = []; + }, r.prototype._addLabel = function(e, t, n, i, a) { + var o = i.style, s = i.__hostTarget, l = s.textConfig || {}, u = i.getComputedTransform(), c = i.getBoundingRect().plain(); + Wt.applyTransform(c, c, u), u ? Sa.setLocalTransform(u) : (Sa.x = Sa.y = Sa.rotation = Sa.originX = Sa.originY = 0, Sa.scaleX = Sa.scaleY = 1), Sa.rotation = ks(Sa.rotation); + var h = i.__hostTarget, f; + if (h) { + f = h.getBoundingRect().plain(); + var v = h.getComputedTransform(); + Wt.applyTransform(f, f, v); + } + var b = f && h.getTextGuideLine(); + this._labelList.push({ + label: i, + labelLine: b, + seriesModel: n, + dataIndex: e, + dataType: t, + layoutOption: a, + computedLayoutOption: null, + rect: c, + hostRect: f, + // Label with lower priority will be hidden when overlapped + // Use rect size as default priority + priority: f ? f.width * f.height : 0, + // Save default label attributes. + // For restore if developers want get back to default value in callback. + defaultAttr: { + ignore: i.ignore, + labelGuideIgnore: b && b.ignore, + x: Sa.x, + y: Sa.y, + scaleX: Sa.scaleX, + scaleY: Sa.scaleY, + rotation: Sa.rotation, + style: { + x: o.x, + y: o.y, + align: o.align, + verticalAlign: o.verticalAlign, + width: o.width, + height: o.height, + fontSize: o.fontSize + }, + cursor: i.cursor, + attachedPos: l.position, + attachedRot: l.rotation + } + }); + }, r.prototype.addLabelsOfSeries = function(e) { + var t = this; + this._chartViewList.push(e); + var n = e.__model, i = n.get("labelLayout"); + (Tt(i) || yr(i).length) && e.group.traverse(function(a) { + if (a.ignore) + return !0; + var o = a.getTextContent(), s = Ft(a); + o && !o.disableLabelLayout && t._addLabel(s.dataIndex, s.dataType, n, o, i); + }); + }, r.prototype.updateLayoutConfig = function(e) { + var t = e.getWidth(), n = e.getHeight(); + function i(_, y) { + return function() { + b2(_, y); + }; + } + for (var a = 0; a < this._labelList.length; a++) { + var o = this._labelList[a], s = o.label, l = s.__hostTarget, u = o.defaultAttr, c = void 0; + Tt(o.layoutOption) ? c = o.layoutOption(ire(o, l)) : c = o.layoutOption, c = c || {}, o.computedLayoutOption = c; + var h = Math.PI / 180; + l && l.setTextConfig({ + // Force to set local false. + local: !1, + // Ignore position and rotation config on the host el if x or y is changed. + position: c.x != null || c.y != null ? null : u.attachedPos, + // Ignore rotation config on the host el if rotation is changed. + rotation: c.rotate != null ? c.rotate * h : u.attachedRot, + offset: [c.dx || 0, c.dy || 0] + }); + var f = !1; + if (c.x != null ? (s.x = ot(c.x, t), s.setStyle("x", 0), f = !0) : (s.x = u.x, s.setStyle("x", u.style.x)), c.y != null ? (s.y = ot(c.y, n), s.setStyle("y", 0), f = !0) : (s.y = u.y, s.setStyle("y", u.style.y)), c.labelLinePoints) { + var v = l.getTextGuideLine(); + v && (v.setShape({ + points: c.labelLinePoints + }), f = !1); + } + var b = uw(s); + b.needsUpdateLabelLine = f, s.rotation = c.rotate != null ? c.rotate * h : u.rotation, s.scaleX = u.scaleX, s.scaleY = u.scaleY; + for (var w = 0; w < S2.length; w++) { + var p = S2[w]; + s.setStyle(p, c[p] != null ? c[p] : u.style[p]); + } + if (c.draggable) { + if (s.draggable = !0, s.cursor = "move", l) { + var d = o.seriesModel; + if (o.dataIndex != null) { + var m = o.seriesModel.getData(o.dataType); + d = m.getItemModel(o.dataIndex); + } + s.on("drag", i(l, d.getModel("labelLine"))); + } + } else + s.off("drag"), s.cursor = u.cursor; + } + }, r.prototype.layout = function(e) { + var t = e.getWidth(), n = e.getHeight(), i = A$(this._labelList), a = Jr(i, function(l) { + return l.layoutOption.moveOverlap === "shiftX"; + }), o = Jr(i, function(l) { + return l.layoutOption.moveOverlap === "shiftY"; + }); + rre(a, 0, t), M$(o, 0, n); + var s = Jr(i, function(l) { + return l.layoutOption.hideOverlap; + }); + D$(s); + }, r.prototype.processLabelsOverall = function() { + var e = this; + X(this._chartViewList, function(t) { + var n = t.__model, i = t.ignoreLabelLineUpdate, a = n.isAnimationEnabled(); + t.group.traverse(function(o) { + if (o.ignore && !o.forceLabelAnimation) + return !0; + var s = !i, l = o.getTextContent(); + !s && l && (s = uw(l).needsUpdateLabelLine), s && e._updateLabelLine(o, n), a && e._animateLabels(o, n); + }); + }); + }, r.prototype._updateLabelLine = function(e, t) { + var n = e.getTextContent(), i = Ft(e), a = i.dataIndex; + if (n && a != null) { + var o = t.getData(i.dataType), s = o.getItemModel(a), l = {}, u = o.getItemVisual(a, "style"); + if (u) { + var c = o.getVisual("drawType"); + l.stroke = u[c]; + } + var h = s.getModel("labelLine"); + UA(e, WA(s), l), b2(e, h); + } + }, r.prototype._animateLabels = function(e, t) { + var n = e.getTextContent(), i = e.getTextGuideLine(); + if (n && (e.forceLabelAnimation || !n.ignore && !n.invisible && !e.disableLabelAnimation && !xd(e))) { + var a = uw(n), o = a.oldLayout, s = Ft(e), l = s.dataIndex, u = { + x: n.x, + y: n.y, + rotation: n.rotation + }, c = t.getData(s.dataType); + if (o) { + n.attr(o); + var f = e.prevStates; + f && (ir(f, "select") >= 0 && n.attr(a.oldLayoutSelect), ir(f, "emphasis") >= 0 && n.attr(a.oldLayoutEmphasis)), zr(n, u, t, l); + } else if (n.attr(u), !ev(n).valueAnimation) { + var h = Jt(n.style.opacity, 1); + n.style.opacity = 0, An(n, { + style: { + opacity: h + } + }, t, l); + } + if (a.oldLayout = u, n.states.select) { + var v = a.oldLayoutSelect = {}; + Ky(v, u, Qy), Ky(v, n.states.select, Qy); + } + if (n.states.emphasis) { + var b = a.oldLayoutEmphasis = {}; + Ky(b, u, Qy), Ky(b, n.states.emphasis, Qy); + } + aF(n, l, c, t, t); + } + if (i && !i.ignore && !i.invisible) { + var a = are(i), o = a.oldLayout, w = { + points: i.shape.points + }; + o ? (i.attr({ + shape: o + }), zr(i, { + shape: w + }, t)) : (i.setShape(w), i.style.strokePercent = 0, An(i, { + style: { + strokePercent: 1 + } + }, t)), a.oldLayout = w; + } + }, r; + }() +); +const sre = ore; +var cw = Rr(); +function k$(r) { + r.registerUpdateLifecycle("series:beforeupdate", function(e, t, n) { + var i = cw(t).labelManager; + i || (i = cw(t).labelManager = new sre()), i.clearLabels(); + }), r.registerUpdateLifecycle("series:layoutlabels", function(e, t, n) { + var i = cw(t).labelManager; + n.updatedSeries.forEach(function(a) { + i.addLabelsOfSeries(t.getViewOfSeriesModel(a)); + }), i.updateLayoutConfig(t), i.layout(t), i.processLabelsOverall(); + }); +} +var hw = Math.sin, fw = Math.cos, O$ = Math.PI, lh = Math.PI * 2, lre = 180 / O$, ure = function() { + function r() { + } + return r.prototype.reset = function(e) { + this._start = !0, this._d = [], this._str = "", this._p = Math.pow(10, e || 4); + }, r.prototype.moveTo = function(e, t) { + this._add("M", e, t); + }, r.prototype.lineTo = function(e, t) { + this._add("L", e, t); + }, r.prototype.bezierCurveTo = function(e, t, n, i, a, o) { + this._add("C", e, t, n, i, a, o); + }, r.prototype.quadraticCurveTo = function(e, t, n, i) { + this._add("Q", e, t, n, i); + }, r.prototype.arc = function(e, t, n, i, a, o) { + this.ellipse(e, t, n, n, 0, i, a, o); + }, r.prototype.ellipse = function(e, t, n, i, a, o, s, l) { + var u = s - o, c = !l, h = Math.abs(u), f = Ju(h - lh) || (c ? u >= lh : -u >= lh), v = u > 0 ? u % lh : u % lh + lh, b = !1; + f ? b = !0 : Ju(h) ? b = !1 : b = v >= O$ == !!c; + var w = e + n * fw(o), p = t + i * hw(o); + this._start && this._add("M", w, p); + var d = Math.round(a * lre); + if (f) { + var m = 1 / this._p, _ = (c ? 1 : -1) * (lh - m); + this._add("A", n, i, d, 1, +c, e + n * fw(o + _), t + i * hw(o + _)), m > 0.01 && this._add("A", n, i, d, 0, +c, w, p); + } else { + var y = e + n * fw(s), x = t + i * hw(s); + this._add("A", n, i, d, +b, +c, y, x); + } + }, r.prototype.rect = function(e, t, n, i) { + this._add("M", e, t), this._add("l", n, 0), this._add("l", 0, i), this._add("l", -n, 0), this._add("Z"); + }, r.prototype.closePath = function() { + this._d.length > 0 && this._add("Z"); + }, r.prototype._add = function(e, t, n, i, a, o, s, l, u) { + for (var c = [], h = this._p, f = 1; f < arguments.length; f++) { + var v = arguments[f]; + if (isNaN(v)) { + this._invalid = !0; + return; + } + c.push(Math.round(v * h) / h); + } + this._d.push(e + c.join(" ")), this._start = e === "Z"; + }, r.prototype.generateStr = function() { + this._str = this._invalid ? "" : this._d.join(""), this._d = []; + }, r.prototype.getStr = function() { + return this._str; + }, r; +}(); +const L$ = ure; +var Jp = "none", cre = Math.round; +function hre(r) { + var e = r.fill; + return e != null && e !== Jp; +} +function fre(r) { + var e = r.stroke; + return e != null && e !== Jp; +} +var iT = ["lineCap", "miterLimit", "lineJoin"], dre = Ke(iT, function(r) { + return "stroke-" + r.toLowerCase(); +}); +function vre(r, e, t, n) { + var i = e.opacity == null ? 1 : e.opacity; + if (t instanceof ji) { + r("opacity", i); + return; + } + if (hre(e)) { + var a = hg(e.fill); + r("fill", a.color); + var o = e.fillOpacity != null ? e.fillOpacity * a.opacity * i : a.opacity * i; + (n || o < 1) && r("fill-opacity", o); + } else + r("fill", Jp); + if (fre(e)) { + var s = hg(e.stroke); + r("stroke", s.color); + var l = e.strokeNoScale ? t.getLineScale() : 1, u = l ? (e.lineWidth || 0) / l : 0, c = e.strokeOpacity != null ? e.strokeOpacity * s.opacity * i : s.opacity * i, h = e.strokeFirst; + if ((n || u !== 1) && r("stroke-width", u), (n || h) && r("paint-order", h ? "stroke" : "fill"), (n || c < 1) && r("stroke-opacity", c), e.lineDash) { + var f = wA(t), v = f[0], b = f[1]; + v && (b = cre(b || 0), r("stroke-dasharray", v.join(",")), (b || n) && r("stroke-dashoffset", b)); + } else + n && r("stroke-dasharray", Jp); + for (var w = 0; w < iT.length; w++) { + var p = iT[w]; + if (n || e[p] !== g_[p]) { + var d = e[p] || g_[p]; + d && r(dre[w], d); + } + } + } else + n && r("stroke", Jp); +} +var P$ = "http://www.w3.org/2000/svg", R$ = "http://www.w3.org/1999/xlink", pre = "http://www.w3.org/2000/xmlns/", gre = "http://www.w3.org/XML/1998/namespace"; +function N$(r) { + return document.createElementNS(P$, r); +} +function Ei(r, e, t, n, i) { + return { + tag: r, + attrs: t || {}, + children: n, + text: i, + key: e + }; +} +function mre(r, e) { + var t = []; + if (e) + for (var n in e) { + var i = e[n], a = n; + i !== !1 && (i !== !0 && i != null && (a += '="' + i + '"'), t.push(a)); + } + return "<" + r + " " + t.join(" ") + ">"; +} +function yre(r) { + return ""; +} +function YA(r, e) { + e = e || {}; + var t = e.newline ? ` +` : ""; + function n(i) { + var a = i.children, o = i.tag, s = i.attrs, l = i.text; + return mre(o, s) + (o !== "style" ? Ea(l) : l || "") + (a ? "" + t + Ke(a, function(u) { + return n(u); + }).join(t) + t : "") + yre(o); + } + return n(r); +} +function _re(r, e, t) { + t = t || {}; + var n = t.newline ? ` +` : "", i = " {" + n, a = n + "}", o = Ke(yr(r), function(l) { + return l + i + Ke(yr(r[l]), function(u) { + return u + ":" + r[l][u] + ";"; + }).join(n) + a; + }).join(n), s = Ke(yr(e), function(l) { + return "@keyframes " + l + i + Ke(yr(e[l]), function(u) { + return u + i + Ke(yr(e[l][u]), function(c) { + var h = e[l][u][c]; + return c === "d" && (h = 'path("' + h + '")'), c + ":" + h + ";"; + }).join(n) + a; + }).join(n) + a; + }).join(n); + return !o && !s ? "" : [""].join(n); +} +function aT(r) { + return { + zrId: r, + shadowCache: {}, + patternCache: {}, + gradientCache: {}, + clipPathCache: {}, + defs: {}, + cssNodes: {}, + cssAnims: {}, + cssClassIdx: 0, + cssAnimIdx: 0, + shadowIdx: 0, + gradientIdx: 0, + patternIdx: 0, + clipPathIdx: 0 + }; +} +function w2(r, e, t, n) { + return Ei("svg", "root", { + width: r, + height: e, + xmlns: P$, + "xmlns:xlink": R$, + version: "1.1", + baseProfile: "full", + viewBox: n ? "0 0 " + r + " " + e : !1 + }, t); +} +var C2 = { + cubicIn: "0.32,0,0.67,0", + cubicOut: "0.33,1,0.68,1", + cubicInOut: "0.65,0,0.35,1", + quadraticIn: "0.11,0,0.5,0", + quadraticOut: "0.5,1,0.89,1", + quadraticInOut: "0.45,0,0.55,1", + quarticIn: "0.5,0,0.75,0", + quarticOut: "0.25,1,0.5,1", + quarticInOut: "0.76,0,0.24,1", + quinticIn: "0.64,0,0.78,0", + quinticOut: "0.22,1,0.36,1", + quinticInOut: "0.83,0,0.17,1", + sinusoidalIn: "0.12,0,0.39,0", + sinusoidalOut: "0.61,1,0.88,1", + sinusoidalInOut: "0.37,0,0.63,1", + exponentialIn: "0.7,0,0.84,0", + exponentialOut: "0.16,1,0.3,1", + exponentialInOut: "0.87,0,0.13,1", + circularIn: "0.55,0,1,0.45", + circularOut: "0,0.55,0.45,1", + circularInOut: "0.85,0,0.15,1" +}, fh = "transform-origin"; +function bre(r, e, t) { + var n = Fe({}, r.shape); + Fe(n, e), r.buildPath(t, n); + var i = new L$(); + return i.reset(zj(r)), t.rebuildPath(i, 1), i.generateStr(), i.getStr(); +} +function xre(r, e) { + var t = e.originX, n = e.originY; + (t || n) && (r[fh] = t + "px " + n + "px"); +} +var Sre = { + fill: "fill", + opacity: "opacity", + lineWidth: "stroke-width", + lineDashOffset: "stroke-dashoffset" +}; +function z$(r, e) { + var t = e.zrId + "-ani-" + e.cssAnimIdx++; + return e.cssAnims[t] = r, t; +} +function wre(r, e, t) { + var n = r.shape.paths, i = {}, a, o; + if (X(n, function(l) { + var u = aT(t.zrId); + u.animation = !0, sx(l, {}, u, !0); + var c = u.cssAnims, h = u.cssNodes, f = yr(c), v = f.length; + if (v) { + o = f[v - 1]; + var b = c[o]; + for (var w in b) { + var p = b[w]; + i[w] = i[w] || { d: "" }, i[w].d += p.d || ""; + } + for (var d in h) { + var m = h[d].animation; + m.indexOf(o) >= 0 && (a = m); + } + } + }), !!a) { + e.d = !1; + var s = z$(i, t); + return a.replace(o, s); + } +} +function T2(r) { + return ut(r) ? C2[r] ? "cubic-bezier(" + C2[r] + ")" : LI(r) ? r : "" : ""; +} +function sx(r, e, t, n) { + var i = r.animators, a = i.length, o = []; + if (r instanceof jb) { + var s = wre(r, e, t); + if (s) + o.push(s); + else if (!a) + return; + } else if (!a) + return; + for (var l = {}, u = 0; u < a; u++) { + var c = i[u], h = [c.getMaxTime() / 1e3 + "s"], f = T2(c.getClip().easing), v = c.getDelay(); + f ? h.push(f) : h.push("linear"), v && h.push(v / 1e3 + "s"), c.getLoop() && h.push("infinite"); + var b = h.join(" "); + l[b] = l[b] || [b, []], l[b][1].push(c); + } + function w(m) { + var _ = m[1], y = _.length, x = {}, g = {}, S = {}, T = "animation-timing-function"; + function C(oe, de, se) { + for (var te = oe.getTracks(), pe = oe.getMaxTime(), re = 0; re < te.length; re++) { + var ae = te[re]; + if (ae.needsAnimate()) { + var le = ae.keyframes, ue = ae.propName; + if (se && (ue = se(ue)), ue) + for (var Ae = 0; Ae < le.length; Ae++) { + var Te = le[Ae], Ne = Math.round(Te.time / pe * 100) + "%", He = T2(Te.easing), je = Te.rawValue; + (ut(je) || Pr(je)) && (de[Ne] = de[Ne] || {}, de[Ne][ue] = Te.rawValue, He && (de[Ne][T] = He)); + } + } + } + } + for (var E = 0; E < y; E++) { + var M = _[E], P = M.targetName; + P ? P === "shape" && C(M, g) : !n && C(M, x); + } + for (var R in x) { + var N = {}; + Hj(N, r), Fe(N, x[R]); + var F = Bj(N), U = x[R][T]; + S[R] = F ? { + transform: F + } : {}, xre(S[R], N), U && (S[R][T] = U); + } + var $, G = !0; + for (var R in g) { + S[R] = S[R] || {}; + var Q = !$, U = g[R][T]; + Q && ($ = new Al()); + var ee = $.len(); + $.reset(), S[R].d = bre(r, g[R], $); + var ce = $.len(); + if (!Q && ee !== ce) { + G = !1; + break; + } + U && (S[R][T] = U); + } + if (!G) + for (var R in S) + delete S[R].d; + if (!n) + for (var E = 0; E < y; E++) { + var M = _[E], P = M.targetName; + P === "style" && C(M, S, function(te) { + return Sre[te]; + }); + } + for (var ne = yr(S), fe = !0, K, E = 1; E < ne.length; E++) { + var Oe = ne[E - 1], xe = ne[E]; + if (S[Oe][fh] !== S[xe][fh]) { + fe = !1; + break; + } + K = S[Oe][fh]; + } + if (fe && K) { + for (var R in S) + S[R][fh] && delete S[R][fh]; + e[fh] = K; + } + if (Jr(ne, function(oe) { + return yr(S[oe]).length > 0; + }).length) { + var Ge = z$(S, t); + return Ge + " " + m[0] + " both"; + } + } + for (var p in l) { + var s = w(l[p]); + s && o.push(s); + } + if (o.length) { + var d = t.zrId + "-cls-" + t.cssClassIdx++; + t.cssNodes["." + d] = { + animation: o.join(",") + }, e.class = d; + } +} +var Ag = Math.round; +function B$(r) { + return r && ut(r.src); +} +function j$(r) { + return r && Tt(r.toDataURL); +} +function XA(r, e, t, n) { + vre(function(i, a) { + var o = i === "fill" || i === "stroke"; + o && Nj(a) ? $$(e, r, i, n) : o && RI(a) ? H$(t, r, i, n) : r[i] = a; + }, e, t, !1), Dre(t, r, n); +} +function I2(r) { + return Ju(r[0] - 1) && Ju(r[1]) && Ju(r[2]) && Ju(r[3] - 1); +} +function Cre(r) { + return Ju(r[4]) && Ju(r[5]); +} +function ZA(r, e, t) { + if (e && !(Cre(e) && I2(e))) { + var n = t ? 10 : 1e4; + r.transform = I2(e) ? "translate(" + Ag(e[4] * n) / n + " " + Ag(e[5] * n) / n + ")" : IX(e); + } +} +function A2(r, e, t) { + for (var n = r.points, i = [], a = 0; a < n.length; a++) + i.push(Ag(n[a][0] * t) / t), i.push(Ag(n[a][1] * t) / t); + e.points = i.join(" "); +} +function E2(r) { + return !r.smooth; +} +function Tre(r) { + var e = Ke(r, function(t) { + return typeof t == "string" ? [t, t] : t; + }); + return function(t, n, i) { + for (var a = 0; a < e.length; a++) { + var o = e[a], s = t[o[0]]; + s != null && (n[o[1]] = Ag(s * i) / i); + } + }; +} +var Ire = { + circle: [Tre(["cx", "cy", "r"])], + polyline: [A2, E2], + polygon: [A2, E2] +}; +function Are(r) { + for (var e = r.animators, t = 0; t < e.length; t++) + if (e[t].targetName === "shape") + return !0; + return !1; +} +function F$(r, e) { + var t = r.style, n = r.shape, i = Ire[r.type], a = {}, o = e.animation, s = "path", l = r.style.strokePercent, u = e.compress && zj(r) || 4; + if (i && !e.willUpdate && !(i[1] && !i[1](n)) && !(o && Are(r)) && !(l < 1)) { + s = r.type; + var c = Math.pow(10, u); + i[0](n, a, c); + } else { + var h = !r.path || r.shapeChanged(); + r.path || r.createPathProxy(); + var f = r.path; + h && (f.beginPath(), r.buildPath(f, r.shape), r.pathUpdated()); + var v = f.getVersion(), b = r, w = b.__svgPathBuilder; + (b.__svgPathVersion !== v || !w || l !== b.__svgPathStrokePercent) && (w || (w = b.__svgPathBuilder = new L$()), w.reset(u), f.rebuildPath(w, l), w.generateStr(), b.__svgPathVersion = v, b.__svgPathStrokePercent = l), a.d = w.getStr(); + } + return ZA(a, r.transform), XA(a, t, r, e), e.animation && sx(r, a, e), Ei(s, r.id + "", a); +} +function Ere(r, e) { + var t = r.style, n = t.image; + if (n && !ut(n) && (B$(n) ? n = n.src : j$(n) && (n = n.toDataURL())), !!n) { + var i = t.x || 0, a = t.y || 0, o = t.width, s = t.height, l = { + href: n, + width: o, + height: s + }; + return i && (l.x = i), a && (l.y = a), ZA(l, r.transform), XA(l, t, r, e), e.animation && sx(r, l, e), Ei("image", r.id + "", l); + } +} +function Mre(r, e) { + var t = r.style, n = t.text; + if (n != null && (n += ""), !(!n || isNaN(t.x) || isNaN(t.y))) { + var i = t.font || hc, a = t.x || 0, o = EX(t.y || 0, Mb(i), t.textBaseline), s = AX[t.textAlign] || t.textAlign, l = { + "dominant-baseline": "central", + "text-anchor": s + }; + if (S5(t)) { + var u = "", c = t.fontStyle, h = x5(t.fontSize); + if (!parseFloat(h)) + return; + var f = t.fontFamily || rj, v = t.fontWeight; + u += "font-size:" + h + ";font-family:" + f + ";", c && c !== "normal" && (u += "font-style:" + c + ";"), v && v !== "normal" && (u += "font-weight:" + v + ";"), l.style = u; + } else + l.style = "font: " + i; + return n.match(/\s/) && (l["xml:space"] = "preserve"), a && (l.x = a), o && (l.y = o), ZA(l, r.transform), XA(l, t, r, e), e.animation && sx(r, l, e), Ei("text", r.id + "", l, void 0, n); + } +} +function M2(r, e) { + if (r instanceof hr) + return F$(r, e); + if (r instanceof ji) + return Ere(r, e); + if (r instanceof vg) + return Mre(r, e); +} +function Dre(r, e, t) { + var n = r.style; + if (MX(n)) { + var i = DX(r), a = t.shadowCache, o = a[i]; + if (!o) { + var s = r.getGlobalScale(), l = s[0], u = s[1]; + if (!l || !u) + return; + var c = n.shadowOffsetX || 0, h = n.shadowOffsetY || 0, f = n.shadowBlur, v = hg(n.shadowColor), b = v.opacity, w = v.color, p = f / 2 / l, d = f / 2 / u, m = p + " " + d; + o = t.zrId + "-s" + t.shadowIdx++, t.defs[o] = Ei("filter", o, { + id: o, + x: "-100%", + y: "-100%", + width: "300%", + height: "300%" + }, [ + Ei("feDropShadow", "", { + dx: c / l, + dy: h / u, + stdDeviation: m, + "flood-color": w, + "flood-opacity": b + }) + ]), a[i] = o; + } + e.filter = Eb(o); + } +} +function $$(r, e, t, n) { + var i = r[t], a, o = { + gradientUnits: i.global ? "userSpaceOnUse" : "objectBoundingBox" + }; + if (Pj(i)) + a = "linearGradient", o.x1 = i.x, o.y1 = i.y, o.x2 = i.x2, o.y2 = i.y2; + else if (Rj(i)) + a = "radialGradient", o.cx = Jt(i.x, 0.5), o.cy = Jt(i.y, 0.5), o.r = Jt(i.r, 0.5); + else + return; + for (var s = i.colorStops, l = [], u = 0, c = s.length; u < c; ++u) { + var h = g1(s[u].offset) * 100 + "%", f = s[u].color, v = hg(f), b = v.color, w = v.opacity, p = { + offset: h + }; + p["stop-color"] = b, w < 1 && (p["stop-opacity"] = w), l.push(Ei("stop", u + "", p)); + } + var d = Ei(a, "", o, l), m = YA(d), _ = n.gradientCache, y = _[m]; + y || (y = n.zrId + "-g" + n.gradientIdx++, _[m] = y, o.id = y, n.defs[y] = Ei(a, y, o, l)), e[t] = Eb(y); +} +function H$(r, e, t, n) { + var i = r.style[t], a = r.getBoundingRect(), o = {}, s = i.repeat, l = s === "no-repeat", u = s === "repeat-x", c = s === "repeat-y", h; + if (Lj(i)) { + var f = i.imageWidth, v = i.imageHeight, b = void 0, w = i.image; + if (ut(w) ? b = w : B$(w) ? b = w.src : j$(w) && (b = w.toDataURL()), typeof Image == "undefined") { + var p = "Image width/height must been given explictly in svg-ssr renderer."; + pa(f, p), pa(v, p); + } else if (f == null || v == null) { + var d = function(E, M) { + if (E) { + var P = E.elm, R = f || M.width, N = v || M.height; + E.tag === "pattern" && (u ? (N = 1, R /= a.width) : c && (R = 1, N /= a.height)), E.attrs.width = R, E.attrs.height = N, P && (P.setAttribute("width", R), P.setAttribute("height", N)); + } + }, m = UI(b, null, r, function(E) { + l || d(g, E), d(h, E); + }); + m && m.width && m.height && (f = f || m.width, v = v || m.height); + } + h = Ei("image", "img", { + href: b, + width: f, + height: v + }), o.width = f, o.height = v; + } else + i.svgElement && (h = Ot(i.svgElement), o.width = i.svgWidth, o.height = i.svgHeight); + if (h) { + var _, y; + l ? _ = y = 1 : u ? (y = 1, _ = o.width / a.width) : c ? (_ = 1, y = o.height / a.height) : o.patternUnits = "userSpaceOnUse", _ != null && !isNaN(_) && (o.width = _), y != null && !isNaN(y) && (o.height = y); + var x = Bj(i); + x && (o.patternTransform = x); + var g = Ei("pattern", "", o, [h]), S = YA(g), T = n.patternCache, C = T[S]; + C || (C = n.zrId + "-p" + n.patternIdx++, T[S] = C, o.id = C, g = n.defs[C] = Ei("pattern", C, o, [h])), e[t] = Eb(C); + } +} +function kre(r, e, t) { + var n = t.clipPathCache, i = t.defs, a = n[r.id]; + if (!a) { + a = t.zrId + "-c" + t.clipPathIdx++; + var o = { + id: a + }; + n[r.id] = a, i[a] = Ei("clipPath", a, o, [F$(r, t)]); + } + e["clip-path"] = Eb(a); +} +function D2(r) { + return document.createTextNode(r); +} +function xh(r, e, t) { + r.insertBefore(e, t); +} +function k2(r, e) { + r.removeChild(e); +} +function O2(r, e) { + r.appendChild(e); +} +function V$(r) { + return r.parentNode; +} +function G$(r) { + return r.nextSibling; +} +function dw(r, e) { + r.textContent = e; +} +var L2 = 58, Ore = 120, Lre = Ei("", ""); +function oT(r) { + return r === void 0; +} +function fl(r) { + return r !== void 0; +} +function Pre(r, e, t) { + for (var n = {}, i = e; i <= t; ++i) { + var a = r[i].key; + a !== void 0 && (n[a] = i); + } + return n; +} +function kp(r, e) { + var t = r.key === e.key, n = r.tag === e.tag; + return n && t; +} +function Eg(r) { + var e, t = r.children, n = r.tag; + if (fl(n)) { + var i = r.elm = N$(n); + if (JA(Lre, r), We(t)) + for (e = 0; e < t.length; ++e) { + var a = t[e]; + a != null && O2(i, Eg(a)); + } + else + fl(r.text) && !kt(r.text) && O2(i, D2(r.text)); + } else + r.elm = D2(r.text); + return r.elm; +} +function U$(r, e, t, n, i) { + for (; n <= i; ++n) { + var a = t[n]; + a != null && xh(r, Eg(a), e); + } +} +function z_(r, e, t, n) { + for (; t <= n; ++t) { + var i = e[t]; + if (i != null) + if (fl(i.tag)) { + var a = V$(i.elm); + k2(a, i.elm); + } else + k2(r, i.elm); + } +} +function JA(r, e) { + var t, n = e.elm, i = r && r.attrs || {}, a = e.attrs || {}; + if (i !== a) { + for (t in a) { + var o = a[t], s = i[t]; + s !== o && (o === !0 ? n.setAttribute(t, "") : o === !1 ? n.removeAttribute(t) : t.charCodeAt(0) !== Ore ? n.setAttribute(t, o) : t === "xmlns:xlink" || t === "xmlns" ? n.setAttributeNS(pre, t, o) : t.charCodeAt(3) === L2 ? n.setAttributeNS(gre, t, o) : t.charCodeAt(5) === L2 ? n.setAttributeNS(R$, t, o) : n.setAttribute(t, o)); + } + for (t in i) + t in a || n.removeAttribute(t); + } +} +function Rre(r, e, t) { + for (var n = 0, i = 0, a = e.length - 1, o = e[0], s = e[a], l = t.length - 1, u = t[0], c = t[l], h, f, v, b; n <= a && i <= l; ) + o == null ? o = e[++n] : s == null ? s = e[--a] : u == null ? u = t[++i] : c == null ? c = t[--l] : kp(o, u) ? (sd(o, u), o = e[++n], u = t[++i]) : kp(s, c) ? (sd(s, c), s = e[--a], c = t[--l]) : kp(o, c) ? (sd(o, c), xh(r, o.elm, G$(s.elm)), o = e[++n], c = t[--l]) : kp(s, u) ? (sd(s, u), xh(r, s.elm, o.elm), s = e[--a], u = t[++i]) : (oT(h) && (h = Pre(e, n, a)), f = h[u.key], oT(f) ? xh(r, Eg(u), o.elm) : (v = e[f], v.tag !== u.tag ? xh(r, Eg(u), o.elm) : (sd(v, u), e[f] = void 0, xh(r, v.elm, o.elm))), u = t[++i]); + (n <= a || i <= l) && (n > a ? (b = t[l + 1] == null ? null : t[l + 1].elm, U$(r, b, t, i, l)) : z_(r, e, n, a)); +} +function sd(r, e) { + var t = e.elm = r.elm, n = r.children, i = e.children; + r !== e && (JA(r, e), oT(e.text) ? fl(n) && fl(i) ? n !== i && Rre(t, n, i) : fl(i) ? (fl(r.text) && dw(t, ""), U$(t, null, i, 0, i.length - 1)) : fl(n) ? z_(t, n, 0, n.length - 1) : fl(r.text) && dw(t, "") : r.text !== e.text && (fl(n) && z_(t, n, 0, n.length - 1), dw(t, e.text))); +} +function Nre(r, e) { + if (kp(r, e)) + sd(r, e); + else { + var t = r.elm, n = V$(t); + Eg(e), n !== null && (xh(n, e.elm, G$(t)), z_(n, [r], 0, 0)); + } + return e; +} +var zre = 0, Bre = function() { + function r(e, t, n) { + if (this.type = "svg", this.refreshHover = P2(), this.configLayer = P2(), this.storage = t, this._opts = n = Fe({}, n), this.root = e, this._id = "zr" + zre++, this._oldVNode = w2(n.width, n.height), e && !n.ssr) { + var i = this._viewport = document.createElement("div"); + i.style.cssText = "position:relative;overflow:hidden"; + var a = this._svgDom = this._oldVNode.elm = N$("svg"); + JA(null, this._oldVNode), i.appendChild(a), e.appendChild(i); + } + this.resize(n.width, n.height); + } + return r.prototype.getType = function() { + return this.type; + }, r.prototype.getViewportRoot = function() { + return this._viewport; + }, r.prototype.getViewportRootOffset = function() { + var e = this.getViewportRoot(); + if (e) + return { + offsetLeft: e.offsetLeft || 0, + offsetTop: e.offsetTop || 0 + }; + }, r.prototype.getSvgDom = function() { + return this._svgDom; + }, r.prototype.refresh = function() { + if (this.root) { + var e = this.renderToVNode({ + willUpdate: !0 + }); + e.attrs.style = "position:absolute;left:0;top:0;user-select:none", Nre(this._oldVNode, e), this._oldVNode = e; + } + }, r.prototype.renderOneToVNode = function(e) { + return M2(e, aT(this._id)); + }, r.prototype.renderToVNode = function(e) { + e = e || {}; + var t = this.storage.getDisplayList(!0), n = this._width, i = this._height, a = aT(this._id); + a.animation = e.animation, a.willUpdate = e.willUpdate, a.compress = e.compress; + var o = [], s = this._bgVNode = jre(n, i, this._backgroundColor, a); + s && o.push(s); + var l = e.compress ? null : this._mainVNode = Ei("g", "main", {}, []); + this._paintList(t, a, l ? l.children : o), l && o.push(l); + var u = Ke(yr(a.defs), function(f) { + return a.defs[f]; + }); + if (u.length && o.push(Ei("defs", "defs", {}, u)), e.animation) { + var c = _re(a.cssNodes, a.cssAnims, { newline: !0 }); + if (c) { + var h = Ei("style", "stl", {}, [], c); + o.push(h); + } + } + return w2(n, i, o, e.useViewBox); + }, r.prototype.renderToString = function(e) { + return e = e || {}, YA(this.renderToVNode({ + animation: Jt(e.cssAnimation, !0), + willUpdate: !1, + compress: !0, + useViewBox: Jt(e.useViewBox, !0) + }), { newline: !0 }); + }, r.prototype.setBackgroundColor = function(e) { + this._backgroundColor = e; + }, r.prototype.getSvgRoot = function() { + return this._mainVNode && this._mainVNode.elm; + }, r.prototype._paintList = function(e, t, n) { + for (var i = e.length, a = [], o = 0, s, l, u = 0, c = 0; c < i; c++) { + var h = e[c]; + if (!h.invisible) { + var f = h.__clipPaths, v = f && f.length || 0, b = l && l.length || 0, w = void 0; + for (w = Math.max(v - 1, b - 1); w >= 0 && !(f && l && f[w] === l[w]); w--) + ; + for (var p = b - 1; p > w; p--) + o--, s = a[o - 1]; + for (var d = w + 1; d < v; d++) { + var m = {}; + kre(f[d], m, t); + var _ = Ei("g", "clip-g-" + u++, m, []); + (s ? s.children : n).push(_), a[o++] = _, s = _; + } + l = f; + var y = M2(h, t); + y && (s ? s.children : n).push(y); + } + } + }, r.prototype.resize = function(e, t) { + var n = this._opts, i = this.root, a = this._viewport; + if (e != null && (n.width = e), t != null && (n.height = t), i && a && (a.style.display = "none", e = dd(i, 0, n), t = dd(i, 1, n), a.style.display = ""), this._width !== e || this._height !== t) { + if (this._width = e, this._height = t, a) { + var o = a.style; + o.width = e + "px", o.height = t + "px"; + } + if (RI(this._backgroundColor)) + this.refresh(); + else { + var s = this._svgDom; + s && (s.setAttribute("width", e), s.setAttribute("height", t)); + var l = this._bgVNode && this._bgVNode.elm; + l && (l.setAttribute("width", e), l.setAttribute("height", t)); + } + } + }, r.prototype.getWidth = function() { + return this._width; + }, r.prototype.getHeight = function() { + return this._height; + }, r.prototype.dispose = function() { + this.root && (this.root.innerHTML = ""), this._svgDom = this._viewport = this.storage = this._oldVNode = this._bgVNode = this._mainVNode = null; + }, r.prototype.clear = function() { + this._svgDom && (this._svgDom.innerHTML = null), this._oldVNode = null; + }, r.prototype.toDataURL = function(e) { + var t = this.renderToString(), n = "data:image/svg+xml;"; + return e ? (t = OX(t), t && n + "base64," + t) : n + "charset=UTF-8," + encodeURIComponent(t); + }, r; +}(); +function P2(r) { + return function() { + }; +} +function jre(r, e, t, n) { + var i; + if (t && t !== "none") + if (i = Ei("rect", "bg", { + width: r, + height: e, + x: "0", + y: "0", + id: "0" + }), Nj(t)) + $$({ fill: t }, i.attrs, "fill", n); + else if (RI(t)) + H$({ + style: { + fill: t + }, + dirty: Qn, + getBoundingRect: function() { + return { width: r, height: e }; + } + }, i.attrs, "fill", n); + else { + var a = hg(t), o = a.color, s = a.opacity; + i.attrs.fill = o, s < 1 && (i.attrs["fill-opacity"] = s); + } + return i; +} +const Fre = Bre; +function $re(r) { + r.registerPainter("svg", Fre); +} +function R2(r, e, t) { + var n = Bs.createCanvas(), i = e.getWidth(), a = e.getHeight(), o = n.style; + return o && (o.position = "absolute", o.left = "0", o.top = "0", o.width = i + "px", o.height = a + "px", n.setAttribute("data-zr-dom-id", r)), n.width = i * t, n.height = a * t, n; +} +var Hre = function(r) { + En(e, r); + function e(t, n, i) { + var a = r.call(this) || this; + a.motionBlur = !1, a.lastFrameAlpha = 0.7, a.dpr = 1, a.virtual = !1, a.config = {}, a.incremental = !1, a.zlevel = 0, a.maxRepaintRectCount = 5, a.__dirty = !0, a.__firstTimePaint = !0, a.__used = !1, a.__drawIndex = 0, a.__startIndex = 0, a.__endIndex = 0, a.__prevStartIndex = null, a.__prevEndIndex = null; + var o; + i = i || v_, typeof t == "string" ? o = R2(t, n, i) : kt(t) && (o = t, t = o.id), a.id = t, a.dom = o; + var s = o.style; + return s && (DI(o), o.onselectstart = function() { + return !1; + }, s.padding = "0", s.margin = "0", s.borderWidth = "0"), a.painter = n, a.dpr = i, a; + } + return e.prototype.getElementCount = function() { + return this.__endIndex - this.__startIndex; + }, e.prototype.afterBrush = function() { + this.__prevStartIndex = this.__startIndex, this.__prevEndIndex = this.__endIndex; + }, e.prototype.initContext = function() { + this.ctx = this.dom.getContext("2d"), this.ctx.dpr = this.dpr; + }, e.prototype.setUnpainted = function() { + this.__firstTimePaint = !0; + }, e.prototype.createBackBuffer = function() { + var t = this.dpr; + this.domBack = R2("back-" + this.id, this.painter, t), this.ctxBack = this.domBack.getContext("2d"), t !== 1 && this.ctxBack.scale(t, t); + }, e.prototype.createRepaintRects = function(t, n, i, a) { + if (this.__firstTimePaint) + return this.__firstTimePaint = !1, null; + var o = [], s = this.maxRepaintRectCount, l = !1, u = new Wt(0, 0, 0, 0); + function c(m) { + if (!(!m.isFinite() || m.isZero())) + if (o.length === 0) { + var _ = new Wt(0, 0, 0, 0); + _.copy(m), o.push(_); + } else { + for (var y = !1, x = 1 / 0, g = 0, S = 0; S < o.length; ++S) { + var T = o[S]; + if (T.intersect(m)) { + var C = new Wt(0, 0, 0, 0); + C.copy(T), C.union(m), o[S] = C, y = !0; + break; + } else if (l) { + u.copy(m), u.union(T); + var E = m.width * m.height, M = T.width * T.height, P = u.width * u.height, R = P - E - M; + R < x && (x = R, g = S); + } + } + if (l && (o[g].union(m), y = !0), !y) { + var _ = new Wt(0, 0, 0, 0); + _.copy(m), o.push(_); + } + l || (l = o.length >= s); + } + } + for (var h = this.__startIndex; h < this.__endIndex; ++h) { + var f = t[h]; + if (f) { + var v = f.shouldBePainted(i, a, !0, !0), b = f.__isRendered && (f.__dirty & go || !v) ? f.getPrevPaintRect() : null; + b && c(b); + var w = v && (f.__dirty & go || !f.__isRendered) ? f.getPaintRect() : null; + w && c(w); + } + } + for (var h = this.__prevStartIndex; h < this.__prevEndIndex; ++h) { + var f = n[h], v = f.shouldBePainted(i, a, !0, !0); + if (f && (!v || !f.__zr) && f.__isRendered) { + var b = f.getPrevPaintRect(); + b && c(b); + } + } + var p; + do { + p = !1; + for (var h = 0; h < o.length; ) { + if (o[h].isZero()) { + o.splice(h, 1); + continue; + } + for (var d = h + 1; d < o.length; ) + o[h].intersect(o[d]) ? (p = !0, o[h].union(o[d]), o.splice(d, 1)) : d++; + h++; + } + } while (p); + return this._paintRects = o, o; + }, e.prototype.debugGetPaintRects = function() { + return (this._paintRects || []).slice(); + }, e.prototype.resize = function(t, n) { + var i = this.dpr, a = this.dom, o = a.style, s = this.domBack; + o && (o.width = t + "px", o.height = n + "px"), a.width = t * i, a.height = n * i, s && (s.width = t * i, s.height = n * i, i !== 1 && this.ctxBack.scale(i, i)); + }, e.prototype.clear = function(t, n, i) { + var a = this.dom, o = this.ctx, s = a.width, l = a.height; + n = n || this.clearColor; + var u = this.motionBlur && !t, c = this.lastFrameAlpha, h = this.dpr, f = this; + u && (this.domBack || this.createBackBuffer(), this.ctxBack.globalCompositeOperation = "copy", this.ctxBack.drawImage(a, 0, 0, s / h, l / h)); + var v = this.domBack; + function b(w, p, d, m) { + if (o.clearRect(w, p, d, m), n && n !== "transparent") { + var _ = void 0; + if (Ug(n)) { + var y = n.global || n.__width === d && n.__height === m; + _ = y && n.__canvasGradient || J1(o, n, { + x: 0, + y: 0, + width: d, + height: m + }), n.__canvasGradient = _, n.__width = d, n.__height = m; + } else + oj(n) && (n.scaleX = n.scaleX || h, n.scaleY = n.scaleY || h, _ = K1(o, n, { + dirty: function() { + f.setUnpainted(), f.__painter.refresh(); + } + })); + o.save(), o.fillStyle = _ || n, o.fillRect(w, p, d, m), o.restore(); + } + u && (o.save(), o.globalAlpha = c, o.drawImage(v, w, p, d, m), o.restore()); + } + !i || u ? b(0, 0, s, l) : i.length && X(i, function(w) { + b(w.x * h, w.y * h, w.width * h, w.height * h); + }); + }, e; +}(rs); +const vw = Hre; +var N2 = 1e5, uh = 314159, qy = 0.01, Vre = 1e-3; +function Gre(r) { + return r ? r.__builtin__ ? !0 : !(typeof r.resize != "function" || typeof r.refresh != "function") : !1; +} +function Ure(r, e) { + var t = document.createElement("div"); + return t.style.cssText = [ + "position:relative", + "width:" + r + "px", + "height:" + e + "px", + "padding:0", + "margin:0", + "border-width:0" + ].join(";") + ";", t; +} +var Wre = function() { + function r(e, t, n, i) { + this.type = "canvas", this._zlevelList = [], this._prevDisplayList = [], this._layers = {}, this._layerConfig = {}, this._needsManuallyCompositing = !1, this.type = "canvas"; + var a = !e.nodeName || e.nodeName.toUpperCase() === "CANVAS"; + this._opts = n = Fe({}, n || {}), this.dpr = n.devicePixelRatio || v_, this._singleCanvas = a, this.root = e; + var o = e.style; + o && (DI(e), e.innerHTML = ""), this.storage = t; + var s = this._zlevelList; + this._prevDisplayList = []; + var l = this._layers; + if (a) { + var c = e, h = c.width, f = c.height; + n.width != null && (h = n.width), n.height != null && (f = n.height), this.dpr = n.devicePixelRatio || 1, c.width = h * this.dpr, c.height = f * this.dpr, this._width = h, this._height = f; + var v = new vw(c, this, this.dpr); + v.__builtin__ = !0, v.initContext(), l[uh] = v, v.zlevel = uh, s.push(uh), this._domRoot = e; + } else { + this._width = dd(e, 0, n), this._height = dd(e, 1, n); + var u = this._domRoot = Ure(this._width, this._height); + e.appendChild(u); + } + } + return r.prototype.getType = function() { + return "canvas"; + }, r.prototype.isSingleCanvas = function() { + return this._singleCanvas; + }, r.prototype.getViewportRoot = function() { + return this._domRoot; + }, r.prototype.getViewportRootOffset = function() { + var e = this.getViewportRoot(); + if (e) + return { + offsetLeft: e.offsetLeft || 0, + offsetTop: e.offsetTop || 0 + }; + }, r.prototype.refresh = function(e) { + var t = this.storage.getDisplayList(!0), n = this._prevDisplayList, i = this._zlevelList; + this._redrawId = Math.random(), this._paintList(t, n, e, this._redrawId); + for (var a = 0; a < i.length; a++) { + var o = i[a], s = this._layers[o]; + if (!s.__builtin__ && s.refresh) { + var l = a === 0 ? this._backgroundColor : null; + s.refresh(l); + } + } + return this._opts.useDirtyRect && (this._prevDisplayList = t.slice()), this; + }, r.prototype.refreshHover = function() { + this._paintHoverList(this.storage.getDisplayList(!1)); + }, r.prototype._paintHoverList = function(e) { + var t = e.length, n = this._hoverlayer; + if (n && n.clear(), !!t) { + for (var i = { + inHover: !0, + viewWidth: this._width, + viewHeight: this._height + }, a, o = 0; o < t; o++) { + var s = e[o]; + s.__inHover && (n || (n = this._hoverlayer = this.getLayer(N2)), a || (a = n.ctx, a.save()), kh(a, s, i, o === t - 1)); + } + a && a.restore(); + } + }, r.prototype.getHoverLayer = function() { + return this.getLayer(N2); + }, r.prototype.paintOne = function(e, t) { + Qb(e, t); + }, r.prototype._paintList = function(e, t, n, i) { + if (this._redrawId === i) { + n = n || !1, this._updateLayerStatus(e); + var a = this._doPaintList(e, t, n), o = a.finished, s = a.needsRefreshHover; + if (this._needsManuallyCompositing && this._compositeManually(), s && this._paintHoverList(e), o) + this.eachLayer(function(u) { + u.afterBrush && u.afterBrush(); + }); + else { + var l = this; + f1(function() { + l._paintList(e, t, n, i); + }); + } + } + }, r.prototype._compositeManually = function() { + var e = this.getLayer(uh).ctx, t = this._domRoot.width, n = this._domRoot.height; + e.clearRect(0, 0, t, n), this.eachBuiltinLayer(function(i) { + i.virtual && e.drawImage(i.dom, 0, 0, t, n); + }); + }, r.prototype._doPaintList = function(e, t, n) { + for (var i = this, a = [], o = this._opts.useDirtyRect, s = 0; s < this._zlevelList.length; s++) { + var l = this._zlevelList[s], u = this._layers[l]; + u.__builtin__ && u !== this._hoverlayer && (u.__dirty || n) && a.push(u); + } + for (var c = !0, h = !1, f = function(w) { + var p = a[w], d = p.ctx, m = o && p.createRepaintRects(e, t, v._width, v._height), _ = n ? p.__startIndex : p.__drawIndex, y = !n && p.incremental && Date.now, x = y && Date.now(), g = p.zlevel === v._zlevelList[0] ? v._backgroundColor : null; + if (p.__startIndex === p.__endIndex) + p.clear(!1, g, m); + else if (_ === p.__startIndex) { + var S = e[_]; + (!S.incremental || !S.notClear || n) && p.clear(!1, g, m); + } + _ === -1 && (console.error("For some unknown reason. drawIndex is -1"), _ = p.__startIndex); + var T, C = function(R) { + var N = { + inHover: !1, + allClipped: !1, + prevEl: null, + viewWidth: i._width, + viewHeight: i._height + }; + for (T = _; T < p.__endIndex; T++) { + var F = e[T]; + if (F.__inHover && (h = !0), i._doPaintEl(F, p, o, R, N, T === p.__endIndex - 1), y) { + var U = Date.now() - x; + if (U > 15) + break; + } + } + N.prevElClipPaths && d.restore(); + }; + if (m) + if (m.length === 0) + T = p.__endIndex; + else + for (var E = v.dpr, M = 0; M < m.length; ++M) { + var P = m[M]; + d.save(), d.beginPath(), d.rect(P.x * E, P.y * E, P.width * E, P.height * E), d.clip(), C(P), d.restore(); + } + else + d.save(), C(), d.restore(); + p.__drawIndex = T, p.__drawIndex < p.__endIndex && (c = !1); + }, v = this, b = 0; b < a.length; b++) + f(b); + return Dr.wxa && X(this._layers, function(w) { + w && w.ctx && w.ctx.draw && w.ctx.draw(); + }), { + finished: c, + needsRefreshHover: h + }; + }, r.prototype._doPaintEl = function(e, t, n, i, a, o) { + var s = t.ctx; + if (n) { + var l = e.getPaintRect(); + (!i || l && l.intersect(i)) && (kh(s, e, a, o), e.setPrevPaintRect(l)); + } else + kh(s, e, a, o); + }, r.prototype.getLayer = function(e, t) { + this._singleCanvas && !this._needsManuallyCompositing && (e = uh); + var n = this._layers[e]; + return n || (n = new vw("zr_" + e, this, this.dpr), n.zlevel = e, n.__builtin__ = !0, this._layerConfig[e] ? Ut(n, this._layerConfig[e], !0) : this._layerConfig[e - qy] && Ut(n, this._layerConfig[e - qy], !0), t && (n.virtual = t), this.insertLayer(e, n), n.initContext()), n; + }, r.prototype.insertLayer = function(e, t) { + var n = this._layers, i = this._zlevelList, a = i.length, o = this._domRoot, s = null, l = -1; + if (!n[e] && Gre(t)) { + if (a > 0 && e > i[0]) { + for (l = 0; l < a - 1 && !(i[l] < e && i[l + 1] > e); l++) + ; + s = n[i[l]]; + } + if (i.splice(l + 1, 0, e), n[e] = t, !t.virtual) + if (s) { + var u = s.dom; + u.nextSibling ? o.insertBefore(t.dom, u.nextSibling) : o.appendChild(t.dom); + } else + o.firstChild ? o.insertBefore(t.dom, o.firstChild) : o.appendChild(t.dom); + t.__painter = this; + } + }, r.prototype.eachLayer = function(e, t) { + for (var n = this._zlevelList, i = 0; i < n.length; i++) { + var a = n[i]; + e.call(t, this._layers[a], a); + } + }, r.prototype.eachBuiltinLayer = function(e, t) { + for (var n = this._zlevelList, i = 0; i < n.length; i++) { + var a = n[i], o = this._layers[a]; + o.__builtin__ && e.call(t, o, a); + } + }, r.prototype.eachOtherLayer = function(e, t) { + for (var n = this._zlevelList, i = 0; i < n.length; i++) { + var a = n[i], o = this._layers[a]; + o.__builtin__ || e.call(t, o, a); + } + }, r.prototype.getLayers = function() { + return this._layers; + }, r.prototype._updateLayerStatus = function(e) { + this.eachBuiltinLayer(function(h, f) { + h.__dirty = h.__used = !1; + }); + function t(h) { + a && (a.__endIndex !== h && (a.__dirty = !0), a.__endIndex = h); + } + if (this._singleCanvas) + for (var n = 1; n < e.length; n++) { + var i = e[n]; + if (i.zlevel !== e[n - 1].zlevel || i.incremental) { + this._needsManuallyCompositing = !0; + break; + } + } + var a = null, o = 0, s, l; + for (l = 0; l < e.length; l++) { + var i = e[l], u = i.zlevel, c = void 0; + s !== u && (s = u, o = 0), i.incremental ? (c = this.getLayer(u + Vre, this._needsManuallyCompositing), c.incremental = !0, o = 1) : c = this.getLayer(u + (o > 0 ? qy : 0), this._needsManuallyCompositing), c.__builtin__ || Sb("ZLevel " + u + " has been used by unkown layer " + c.id), c !== a && (c.__used = !0, c.__startIndex !== l && (c.__dirty = !0), c.__startIndex = l, c.incremental ? c.__drawIndex = -1 : c.__drawIndex = l, t(l), a = c), i.__dirty & go && !i.__inHover && (c.__dirty = !0, c.incremental && c.__drawIndex < 0 && (c.__drawIndex = l)); + } + t(l), this.eachBuiltinLayer(function(h, f) { + !h.__used && h.getElementCount() > 0 && (h.__dirty = !0, h.__startIndex = h.__endIndex = h.__drawIndex = 0), h.__dirty && h.__drawIndex < 0 && (h.__drawIndex = h.__startIndex); + }); + }, r.prototype.clear = function() { + return this.eachBuiltinLayer(this._clearLayer), this; + }, r.prototype._clearLayer = function(e) { + e.clear(); + }, r.prototype.setBackgroundColor = function(e) { + this._backgroundColor = e, X(this._layers, function(t) { + t.setUnpainted(); + }); + }, r.prototype.configLayer = function(e, t) { + if (t) { + var n = this._layerConfig; + n[e] ? Ut(n[e], t, !0) : n[e] = t; + for (var i = 0; i < this._zlevelList.length; i++) { + var a = this._zlevelList[i]; + if (a === e || a === e + qy) { + var o = this._layers[a]; + Ut(o, n[e], !0); + } + } + } + }, r.prototype.delLayer = function(e) { + var t = this._layers, n = this._zlevelList, i = t[e]; + i && (i.dom.parentNode.removeChild(i.dom), delete t[e], n.splice(ir(n, e), 1)); + }, r.prototype.resize = function(e, t) { + if (this._domRoot.style) { + var n = this._domRoot; + n.style.display = "none"; + var i = this._opts, a = this.root; + if (e != null && (i.width = e), t != null && (i.height = t), e = dd(a, 0, i), t = dd(a, 1, i), n.style.display = "", this._width !== e || t !== this._height) { + n.style.width = e + "px", n.style.height = t + "px"; + for (var o in this._layers) + this._layers.hasOwnProperty(o) && this._layers[o].resize(e, t); + this.refresh(!0); + } + this._width = e, this._height = t; + } else { + if (e == null || t == null) + return; + this._width = e, this._height = t, this.getLayer(uh).resize(e, t); + } + return this; + }, r.prototype.clearLayer = function(e) { + var t = this._layers[e]; + t && t.clear(); + }, r.prototype.dispose = function() { + this.root.innerHTML = "", this.root = this.storage = this._domRoot = this._layers = null; + }, r.prototype.getRenderedCanvas = function(e) { + if (e = e || {}, this._singleCanvas && !this._compositeManually) + return this._layers[uh].dom; + var t = new vw("image", this, e.pixelRatio || this.dpr); + t.initContext(), t.clear(!1, e.backgroundColor || this._backgroundColor); + var n = t.ctx; + if (e.pixelRatio <= this.dpr) { + this.refresh(); + var i = t.dom.width, a = t.dom.height; + this.eachLayer(function(h) { + h.__builtin__ ? n.drawImage(h.dom, 0, 0, i, a) : h.renderToCanvas && (n.save(), h.renderToCanvas(n), n.restore()); + }); + } else + for (var o = { + inHover: !1, + viewWidth: this._width, + viewHeight: this._height + }, s = this.storage.getDisplayList(!0), l = 0, u = s.length; l < u; l++) { + var c = s[l]; + kh(n, c, o, l === u - 1); + } + return t.dom; + }, r.prototype.getWidth = function() { + return this._width; + }, r.prototype.getHeight = function() { + return this._height; + }, r; +}(); +const Yre = Wre; +function W$(r) { + r.registerPainter("canvas", Yre); +} +var Xre = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t; + } + return e.prototype.getInitialData = function(t) { + return Dl(null, this, { + useEncodeDefaulter: !0 + }); + }, e.prototype.getLegendIcon = function(t) { + var n = new Rt(), i = li("line", 0, t.itemHeight / 2, t.itemWidth, 0, t.lineStyle.stroke, !1); + n.add(i), i.setStyle(t.lineStyle); + var a = this.getData().getVisual("symbol"), o = this.getData().getVisual("symbolRotate"), s = a === "none" ? "circle" : a, l = t.itemHeight * 0.8, u = li(s, (t.itemWidth - l) / 2, (t.itemHeight - l) / 2, l, l, t.itemStyle.fill); + n.add(u), u.setStyle(t.itemStyle); + var c = t.iconRotate === "inherit" ? o : t.iconRotate || 0; + return u.rotation = c * Math.PI / 180, u.setOrigin([t.itemWidth / 2, t.itemHeight / 2]), s.indexOf("empty") > -1 && (u.style.stroke = u.style.fill, u.style.fill = "#fff", u.style.lineWidth = 2), n; + }, e.type = "series.line", e.dependencies = ["grid", "polar"], e.defaultOption = { + // zlevel: 0, + z: 3, + coordinateSystem: "cartesian2d", + legendHoverLink: !0, + clip: !0, + label: { + position: "top" + }, + // itemStyle: { + // }, + endLabel: { + show: !1, + valueAnimation: !0, + distance: 8 + }, + lineStyle: { + width: 2, + type: "solid" + }, + emphasis: { + scale: !0 + }, + // areaStyle: { + // origin of areaStyle. Valid values: + // `'auto'/null/undefined`: from axisLine to data + // `'start'`: from min to data + // `'end'`: from data to max + // origin: 'auto' + // }, + // false, 'start', 'end', 'middle' + step: !1, + // Disabled if step is true + smooth: !1, + smoothMonotone: null, + symbol: "emptyCircle", + symbolSize: 4, + symbolRotate: null, + showSymbol: !0, + // `false`: follow the label interval strategy. + // `true`: show all symbols. + // `'auto'`: If possible, show all symbols, otherwise + // follow the label interval strategy. + showAllSymbol: "auto", + // Whether to connect break point. + connectNulls: !1, + // Sampling for large data. Can be: 'average', 'max', 'min', 'sum', 'lttb'. + sampling: "none", + animationEasing: "linear", + // Disable progressive + progressive: 0, + hoverLayerThreshold: 1 / 0, + universalTransition: { + divideShape: "clone" + }, + triggerLineEvent: !1 + }, e; + }(mn) +); +const Zre = Xre; +function zd(r, e) { + var t = r.mapDimensionsAll("defaultedLabel"), n = t.length; + if (n === 1) { + var i = Rd(r, e, t[0]); + return i != null ? i + "" : null; + } else if (n) { + for (var a = [], o = 0; o < t.length; o++) + a.push(Rd(r, e, t[o])); + return a.join(" "); + } +} +function Y$(r, e) { + var t = r.mapDimensionsAll("defaultedLabel"); + if (!We(e)) + return e + ""; + for (var n = [], i = 0; i < t.length; i++) { + var a = r.getDimensionIndex(t[i]); + a >= 0 && n.push(e[a]); + } + return n.join(" "); +} +var Jre = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a) { + var o = r.call(this) || this; + return o.updateData(t, n, i, a), o; + } + return e.prototype._createSymbol = function(t, n, i, a, o) { + this.removeAll(); + var s = li(t, -1, -1, 2, 2, null, o); + s.attr({ + z2: 100, + culling: !0, + scaleX: a[0] / 2, + scaleY: a[1] / 2 + }), s.drift = Kre, this._symbolType = t, this.add(s); + }, e.prototype.stopSymbolAnimation = function(t) { + this.childAt(0).stopAnimation(null, t); + }, e.prototype.getSymbolType = function() { + return this._symbolType; + }, e.prototype.getSymbolPath = function() { + return this.childAt(0); + }, e.prototype.highlight = function() { + tu(this.childAt(0)); + }, e.prototype.downplay = function() { + ru(this.childAt(0)); + }, e.prototype.setZ = function(t, n) { + var i = this.childAt(0); + i.zlevel = t, i.z = n; + }, e.prototype.setDraggable = function(t, n) { + var i = this.childAt(0); + i.draggable = t, i.cursor = !n && t ? "move" : i.cursor; + }, e.prototype.updateData = function(t, n, i, a) { + this.silent = !1; + var o = t.getItemVisual(n, "symbol") || "circle", s = t.hostModel, l = e.getSymbolSize(t, n), u = o !== this._symbolType, c = a && a.disableAnimation; + if (u) { + var h = t.getItemVisual(n, "symbolKeepAspect"); + this._createSymbol(o, t, n, l, h); + } else { + var f = this.childAt(0); + f.silent = !1; + var v = { + scaleX: l[0] / 2, + scaleY: l[1] / 2 + }; + c ? f.attr(v) : zr(f, v, s, n), Hs(f); + } + if (this._updateCommon(t, n, l, i, a), u) { + var f = this.childAt(0); + if (!c) { + var v = { + scaleX: this._sizeX, + scaleY: this._sizeY, + style: { + // Always fadeIn. Because it has fadeOut animation when symbol is removed.. + opacity: f.style.opacity + } + }; + f.scaleX = f.scaleY = 0, f.style.opacity = 0, An(f, v, s, n); + } + } + c && this.childAt(0).stopAnimation("leave"); + }, e.prototype._updateCommon = function(t, n, i, a, o) { + var s = this.childAt(0), l = t.hostModel, u, c, h, f, v, b, w, p, d; + if (a && (u = a.emphasisItemStyle, c = a.blurItemStyle, h = a.selectItemStyle, f = a.focus, v = a.blurScope, w = a.labelStatesModels, p = a.hoverScale, d = a.cursorStyle, b = a.emphasisDisabled), !a || t.hasItemOption) { + var m = a && a.itemModel ? a.itemModel : t.getItemModel(n), _ = m.getModel("emphasis"); + u = _.getModel("itemStyle").getItemStyle(), h = m.getModel(["select", "itemStyle"]).getItemStyle(), c = m.getModel(["blur", "itemStyle"]).getItemStyle(), f = _.get("focus"), v = _.get("blurScope"), b = _.get("disabled"), w = Mi(m), p = _.getShallow("scale"), d = m.getShallow("cursor"); + } + var y = t.getItemVisual(n, "symbolRotate"); + s.attr("rotation", (y || 0) * Math.PI / 180 || 0); + var x = sf(t.getItemVisual(n, "symbolOffset"), i); + x && (s.x = x[0], s.y = x[1]), d && s.attr("cursor", d); + var g = t.getItemVisual(n, "style"), S = g.fill; + if (s instanceof ji) { + var T = s.style; + s.useStyle(Fe({ + // TODO other properties like x, y ? + image: T.image, + x: T.x, + y: T.y, + width: T.width, + height: T.height + }, g)); + } else + s.__isEmptyBrush ? s.useStyle(Fe({}, g)) : s.useStyle(g), s.style.decal = null, s.setColor(S, o && o.symbolInnerColor), s.style.strokeNoScale = !0; + var C = t.getItemVisual(n, "liftZ"), E = this._z2; + C != null ? E == null && (this._z2 = s.z2, s.z2 += C) : E != null && (s.z2 = E, this._z2 = null); + var M = o && o.useNameLabel; + Zi(s, w, { + labelFetcher: l, + labelDataIndex: n, + defaultText: P, + inheritColor: S, + defaultOpacity: g.opacity + }); + function P(F) { + return M ? t.getName(F) : zd(t, F); + } + this._sizeX = i[0] / 2, this._sizeY = i[1] / 2; + var R = s.ensureState("emphasis"); + R.style = u, s.ensureState("select").style = h, s.ensureState("blur").style = c; + var N = p == null || p === !0 ? Math.max(1.1, 3 / this._sizeY) : isFinite(p) && p > 0 ? +p : 1; + R.scaleX = this._sizeX * N, R.scaleY = this._sizeY * N, this.setSymbolScale(1), Un(this, f, v, b); + }, e.prototype.setSymbolScale = function(t) { + this.scaleX = this.scaleY = t; + }, e.prototype.fadeOut = function(t, n, i) { + var a = this.childAt(0), o = Ft(this).dataIndex, s = i && i.animation; + if (this.silent = a.silent = !0, i && i.fadeLabel) { + var l = a.getTextContent(); + l && dc(l, { + style: { + opacity: 0 + } + }, n, { + dataIndex: o, + removeOpt: s, + cb: function() { + a.removeTextContent(); + } + }); + } else + a.removeTextContent(); + dc(a, { + style: { + opacity: 0 + }, + scaleX: 0, + scaleY: 0 + }, n, { + dataIndex: o, + cb: t, + removeOpt: s + }); + }, e.getSymbolSize = function(t, n) { + return lv(t.getItemVisual(n, "symbolSize")); + }, e; + }(Rt) +); +function Kre(r, e) { + this.parent.drift(r, e); +} +const um = Jre; +function pw(r, e, t, n) { + return e && !isNaN(e[0]) && !isNaN(e[1]) && !(n.isIgnore && n.isIgnore(t)) && !(n.clipShape && !n.clipShape.contain(e[0], e[1])) && r.getItemVisual(t, "symbol") !== "none"; +} +function z2(r) { + return r != null && !kt(r) && (r = { + isIgnore: r + }), r || {}; +} +function B2(r) { + var e = r.hostModel, t = e.getModel("emphasis"); + return { + emphasisItemStyle: t.getModel("itemStyle").getItemStyle(), + blurItemStyle: e.getModel(["blur", "itemStyle"]).getItemStyle(), + selectItemStyle: e.getModel(["select", "itemStyle"]).getItemStyle(), + focus: t.get("focus"), + blurScope: t.get("blurScope"), + emphasisDisabled: t.get("disabled"), + hoverScale: t.get("scale"), + labelStatesModels: Mi(e), + cursorStyle: e.get("cursor") + }; +} +var Qre = ( + /** @class */ + function() { + function r(e) { + this.group = new Rt(), this._SymbolCtor = e || um; + } + return r.prototype.updateData = function(e, t) { + this._progressiveEls = null, t = z2(t); + var n = this.group, i = e.hostModel, a = this._data, o = this._SymbolCtor, s = t.disableAnimation, l = B2(e), u = { + disableAnimation: s + }, c = t.getSymbolPoint || function(h) { + return e.getItemLayout(h); + }; + a || n.removeAll(), e.diff(a).add(function(h) { + var f = c(h); + if (pw(e, f, h, t)) { + var v = new o(e, h, l, u); + v.setPosition(f), e.setItemGraphicEl(h, v), n.add(v); + } + }).update(function(h, f) { + var v = a.getItemGraphicEl(f), b = c(h); + if (!pw(e, b, h, t)) { + n.remove(v); + return; + } + var w = e.getItemVisual(h, "symbol") || "circle", p = v && v.getSymbolType && v.getSymbolType(); + if (!v || p && p !== w) + n.remove(v), v = new o(e, h, l, u), v.setPosition(b); + else { + v.updateData(e, h, l, u); + var d = { + x: b[0], + y: b[1] + }; + s ? v.attr(d) : zr(v, d, i); + } + n.add(v), e.setItemGraphicEl(h, v); + }).remove(function(h) { + var f = a.getItemGraphicEl(h); + f && f.fadeOut(function() { + n.remove(f); + }, i); + }).execute(), this._getSymbolPoint = c, this._data = e; + }, r.prototype.updateLayout = function() { + var e = this, t = this._data; + t && t.eachItemGraphicEl(function(n, i) { + var a = e._getSymbolPoint(i); + n.setPosition(a), n.markRedraw(); + }); + }, r.prototype.incrementalPrepareUpdate = function(e) { + this._seriesScope = B2(e), this._data = null, this.group.removeAll(); + }, r.prototype.incrementalUpdate = function(e, t, n) { + this._progressiveEls = [], n = z2(n); + function i(l) { + l.isGroup || (l.incremental = !0, l.ensureState("emphasis").hoverLayer = !0); + } + for (var a = e.start; a < e.end; a++) { + var o = t.getItemLayout(a); + if (pw(t, o, a, n)) { + var s = new this._SymbolCtor(t, a, this._seriesScope); + s.traverse(i), s.setPosition(o), this.group.add(s), t.setItemGraphicEl(a, s), this._progressiveEls.push(s); + } + } + }, r.prototype.eachRendered = function(e) { + Cc(this._progressiveEls || this.group, e); + }, r.prototype.remove = function(e) { + var t = this.group, n = this._data; + n && e ? n.eachItemGraphicEl(function(i) { + i.fadeOut(function() { + t.remove(i); + }, n.hostModel); + }) : t.removeAll(); + }, r; + }() +); +const cm = Qre; +function X$(r, e, t) { + var n = r.getBaseAxis(), i = r.getOtherAxis(n), a = qre(i, t), o = n.dim, s = i.dim, l = e.mapDimension(s), u = e.mapDimension(o), c = s === "x" || s === "radius" ? 1 : 0, h = Ke(r.dimensions, function(b) { + return e.mapDimension(b); + }), f = !1, v = e.getCalculationInfo("stackResultDimension"); + return iu( + e, + h[0] + /* , dims[1] */ + ) && (f = !0, h[0] = v), iu( + e, + h[1] + /* , dims[0] */ + ) && (f = !0, h[1] = v), { + dataDimsForPoint: h, + valueStart: a, + valueAxisDim: s, + baseAxisDim: o, + stacked: !!f, + valueDim: l, + baseDim: u, + baseDataOffset: c, + stackedOverDimension: e.getCalculationInfo("stackedOverDimension") + }; +} +function qre(r, e) { + var t = 0, n = r.scale.getExtent(); + return e === "start" ? t = n[0] : e === "end" ? t = n[1] : Pr(e) && !isNaN(e) ? t = e : n[0] > 0 ? t = n[0] : n[1] < 0 && (t = n[1]), t; +} +function Z$(r, e, t, n) { + var i = NaN; + r.stacked && (i = t.get(t.getCalculationInfo("stackedOverDimension"), n)), isNaN(i) && (i = r.valueStart); + var a = r.baseDataOffset, o = []; + return o[a] = t.get(r.baseDim, n), o[1 - a] = i, e.dataToPoint(o); +} +function ene(r, e) { + var t = []; + return e.diff(r).add(function(n) { + t.push({ + cmd: "+", + idx: n + }); + }).update(function(n, i) { + t.push({ + cmd: "=", + idx: i, + idx1: n + }); + }).remove(function(n) { + t.push({ + cmd: "-", + idx: n + }); + }).execute(), t; +} +function tne(r, e, t, n, i, a, o, s) { + for (var l = ene(r, e), u = [], c = [], h = [], f = [], v = [], b = [], w = [], p = X$(i, e, o), d = r.getLayout("points") || [], m = e.getLayout("points") || [], _ = 0; _ < l.length; _++) { + var y = l[_], x = !0, g = void 0, S = void 0; + switch (y.cmd) { + case "=": + g = y.idx * 2, S = y.idx1 * 2; + var T = d[g], C = d[g + 1], E = m[S], M = m[S + 1]; + (isNaN(T) || isNaN(C)) && (T = E, C = M), u.push(T, C), c.push(E, M), h.push(t[g], t[g + 1]), f.push(n[S], n[S + 1]), w.push(e.getRawIndex(y.idx1)); + break; + case "+": + var P = y.idx, R = p.dataDimsForPoint, N = i.dataToPoint([e.get(R[0], P), e.get(R[1], P)]); + S = P * 2, u.push(N[0], N[1]), c.push(m[S], m[S + 1]); + var F = Z$(p, i, e, P); + h.push(F[0], F[1]), f.push(n[S], n[S + 1]), w.push(e.getRawIndex(P)); + break; + case "-": + x = !1; + } + x && (v.push(y), b.push(b.length)); + } + b.sort(function(Oe, xe) { + return w[Oe] - w[xe]; + }); + for (var U = u.length, $ = ml(U), G = ml(U), Q = ml(U), ee = ml(U), ce = [], _ = 0; _ < b.length; _++) { + var ne = b[_], fe = _ * 2, K = ne * 2; + $[fe] = u[K], $[fe + 1] = u[K + 1], G[fe] = c[K], G[fe + 1] = c[K + 1], Q[fe] = h[K], Q[fe + 1] = h[K + 1], ee[fe] = f[K], ee[fe + 1] = f[K + 1], ce[_] = v[ne]; + } + return { + current: $, + next: G, + stackedOnCurrent: Q, + stackedOnNext: ee, + status: ce + }; +} +var Bu = Math.min, ju = Math.max; +function Bh(r, e) { + return isNaN(r) || isNaN(e); +} +function sT(r, e, t, n, i, a, o, s, l) { + for (var u, c, h, f, v, b, w = t, p = 0; p < n; p++) { + var d = e[w * 2], m = e[w * 2 + 1]; + if (w >= i || w < 0) + break; + if (Bh(d, m)) { + if (l) { + w += a; + continue; + } + break; + } + if (w === t) + r[a > 0 ? "moveTo" : "lineTo"](d, m), h = d, f = m; + else { + var _ = d - u, y = m - c; + if (_ * _ + y * y < 0.5) { + w += a; + continue; + } + if (o > 0) { + for (var x = w + a, g = e[x * 2], S = e[x * 2 + 1]; g === d && S === m && p < n; ) + p++, x += a, w += a, g = e[x * 2], S = e[x * 2 + 1], d = e[w * 2], m = e[w * 2 + 1], _ = d - u, y = m - c; + var T = p + 1; + if (l) + for (; Bh(g, S) && T < n; ) + T++, x += a, g = e[x * 2], S = e[x * 2 + 1]; + var C = 0.5, E = 0, M = 0, P = void 0, R = void 0; + if (T >= n || Bh(g, S)) + v = d, b = m; + else { + E = g - u, M = S - c; + var N = d - u, F = g - d, U = m - c, $ = S - m, G = void 0, Q = void 0; + if (s === "x") { + G = Math.abs(N), Q = Math.abs(F); + var ee = E > 0 ? 1 : -1; + v = d - ee * G * o, b = m, P = d + ee * Q * o, R = m; + } else if (s === "y") { + G = Math.abs(U), Q = Math.abs($); + var ce = M > 0 ? 1 : -1; + v = d, b = m - ce * G * o, P = d, R = m + ce * Q * o; + } else + G = Math.sqrt(N * N + U * U), Q = Math.sqrt(F * F + $ * $), C = Q / (Q + G), v = d - E * o * (1 - C), b = m - M * o * (1 - C), P = d + E * o * C, R = m + M * o * C, P = Bu(P, ju(g, d)), R = Bu(R, ju(S, m)), P = ju(P, Bu(g, d)), R = ju(R, Bu(S, m)), E = P - d, M = R - m, v = d - E * G / Q, b = m - M * G / Q, v = Bu(v, ju(u, d)), b = Bu(b, ju(c, m)), v = ju(v, Bu(u, d)), b = ju(b, Bu(c, m)), E = d - v, M = m - b, P = d + E * Q / G, R = m + M * Q / G; + } + r.bezierCurveTo(h, f, v, b, d, m), h = P, f = R; + } else + r.lineTo(d, m); + } + u = d, c = m, w += a; + } + return p; +} +var J$ = ( + /** @class */ + function() { + function r() { + this.smooth = 0, this.smoothConstraint = !0; + } + return r; + }() +), rne = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "ec-polyline", n; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new J$(); + }, e.prototype.buildPath = function(t, n) { + var i = n.points, a = 0, o = i.length / 2; + if (n.connectNulls) { + for (; o > 0 && Bh(i[o * 2 - 2], i[o * 2 - 1]); o--) + ; + for (; a < o && Bh(i[a * 2], i[a * 2 + 1]); a++) + ; + } + for (; a < o; ) + a += sT(t, i, a, o, o, 1, n.smooth, n.smoothMonotone, n.connectNulls) + 1; + }, e.prototype.getPointOn = function(t, n) { + this.path || (this.createPathProxy(), this.buildPath(this.path, this.shape)); + for (var i = this.path, a = i.data, o = Al.CMD, s, l, u = n === "x", c = [], h = 0; h < a.length; ) { + var f = a[h++], v = void 0, b = void 0, w = void 0, p = void 0, d = void 0, m = void 0, _ = void 0; + switch (f) { + case o.M: + s = a[h++], l = a[h++]; + break; + case o.L: + if (v = a[h++], b = a[h++], _ = u ? (t - s) / (v - s) : (t - l) / (b - l), _ <= 1 && _ >= 0) { + var y = u ? (b - l) * _ + l : (v - s) * _ + s; + return u ? [t, y] : [y, t]; + } + s = v, l = b; + break; + case o.C: + v = a[h++], b = a[h++], w = a[h++], p = a[h++], d = a[h++], m = a[h++]; + var x = u ? h_(s, v, w, d, t, c) : h_(l, b, p, m, t, c); + if (x > 0) + for (var g = 0; g < x; g++) { + var S = c[g]; + if (S <= 1 && S >= 0) { + var y = u ? Ti(l, b, p, m, S) : Ti(s, v, w, d, S); + return u ? [t, y] : [y, t]; + } + } + s = d, l = m; + break; + } + } + }, e; + }(hr) +), nne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e; + }(J$) +), K$ = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "ec-polygon", n; + } + return e.prototype.getDefaultShape = function() { + return new nne(); + }, e.prototype.buildPath = function(t, n) { + var i = n.points, a = n.stackedOnPoints, o = 0, s = i.length / 2, l = n.smoothMonotone; + if (n.connectNulls) { + for (; s > 0 && Bh(i[s * 2 - 2], i[s * 2 - 1]); s--) + ; + for (; o < s && Bh(i[o * 2], i[o * 2 + 1]); o++) + ; + } + for (; o < s; ) { + var u = sT(t, i, o, s, s, 1, n.smooth, l, n.connectNulls); + sT(t, a, o + u - 1, u, s, -1, n.stackedOnSmooth, l, n.connectNulls), o += u + 1, t.closePath(); + } + }, e; + }(hr) +); +function Q$(r, e, t, n, i) { + var a = r.getArea(), o = a.x, s = a.y, l = a.width, u = a.height, c = t.get(["lineStyle", "width"]) || 2; + o -= c / 2, s -= c / 2, l += c, u += c, o = Math.floor(o), l = Math.round(l); + var h = new Or({ + shape: { + x: o, + y: s, + width: l, + height: u + } + }); + if (e) { + var f = r.getBaseAxis(), v = f.isHorizontal(), b = f.inverse; + v ? (b && (h.shape.x += l), h.shape.width = 0) : (b || (h.shape.y += u), h.shape.height = 0); + var w = Tt(i) ? function(p) { + i(p, h); + } : null; + An(h, { + shape: { + width: l, + height: u, + x: o, + y: s + } + }, t, null, n, w); + } + return h; +} +function q$(r, e, t) { + var n = r.getArea(), i = Vn(n.r0, 1), a = Vn(n.r, 1), o = new Oa({ + shape: { + cx: Vn(r.cx, 1), + cy: Vn(r.cy, 1), + r0: i, + r: a, + startAngle: n.startAngle, + endAngle: n.endAngle, + clockwise: n.clockwise + } + }); + if (e) { + var s = r.getBaseAxis().dim === "angle"; + s ? o.shape.endAngle = n.startAngle : o.shape.r = i, An(o, { + shape: { + endAngle: n.endAngle, + r: a + } + }, t); + } + return o; +} +function lx(r, e, t, n, i) { + if (r) { + if (r.type === "polar") + return q$(r, e, t); + if (r.type === "cartesian2d") + return Q$(r, e, t, n, i); + } else + return null; + return null; +} +function lf(r, e) { + return r.type === e; +} +function j2(r, e) { + if (r.length === e.length) { + for (var t = 0; t < r.length; t++) + if (r[t] !== e[t]) + return; + return !0; + } +} +function F2(r) { + for (var e = 1 / 0, t = 1 / 0, n = -1 / 0, i = -1 / 0, a = 0; a < r.length; ) { + var o = r[a++], s = r[a++]; + isNaN(o) || (e = Math.min(o, e), n = Math.max(o, n)), isNaN(s) || (t = Math.min(s, t), i = Math.max(s, i)); + } + return [[e, t], [n, i]]; +} +function $2(r, e) { + var t = F2(r), n = t[0], i = t[1], a = F2(e), o = a[0], s = a[1]; + return Math.max(Math.abs(n[0] - o[0]), Math.abs(n[1] - o[1]), Math.abs(i[0] - s[0]), Math.abs(i[1] - s[1])); +} +function H2(r) { + return Pr(r) ? r : r ? 0.5 : 0; +} +function ine(r, e, t) { + if (!t.valueDim) + return []; + for (var n = e.count(), i = ml(n * 2), a = 0; a < n; a++) { + var o = Z$(t, r, e, a); + i[a * 2] = o[0], i[a * 2 + 1] = o[1]; + } + return i; +} +function Fu(r, e, t, n) { + var i = e.getBaseAxis(), a = i.dim === "x" || i.dim === "radius" ? 0 : 1, o = [], s = 0, l = [], u = [], c = [], h = []; + if (n) { + for (s = 0; s < r.length; s += 2) + !isNaN(r[s]) && !isNaN(r[s + 1]) && h.push(r[s], r[s + 1]); + r = h; + } + for (s = 0; s < r.length - 2; s += 2) + switch (c[0] = r[s + 2], c[1] = r[s + 3], u[0] = r[s], u[1] = r[s + 1], o.push(u[0], u[1]), t) { + case "end": + l[a] = c[a], l[1 - a] = u[1 - a], o.push(l[0], l[1]); + break; + case "middle": + var f = (u[a] + c[a]) / 2, v = []; + l[a] = v[a] = f, l[1 - a] = u[1 - a], v[1 - a] = c[1 - a], o.push(l[0], l[1]), o.push(v[0], v[1]); + break; + default: + l[a] = u[a], l[1 - a] = c[1 - a], o.push(l[0], l[1]); + } + return o.push(r[s++], r[s++]), o; +} +function ane(r, e) { + var t = [], n = r.length, i, a; + function o(c, h, f) { + var v = c.coord, b = (f - v) / (h.coord - v), w = PI(b, [c.color, h.color]); + return { + coord: f, + color: w + }; + } + for (var s = 0; s < n; s++) { + var l = r[s], u = l.coord; + if (u < 0) + i = l; + else if (u > e) { + a ? t.push(o(a, l, e)) : i && t.push(o(i, l, 0), o(i, l, e)); + break; + } else + i && (t.push(o(i, l, 0)), i = null), t.push(l), a = l; + } + return t; +} +function one(r, e, t) { + var n = r.getVisual("visualMeta"); + if (!(!n || !n.length || !r.count()) && e.type === "cartesian2d") { + for (var i, a, o = n.length - 1; o >= 0; o--) { + var s = r.getDimensionInfo(n[o].dimension); + if (i = s && s.coordDim, i === "x" || i === "y") { + a = n[o]; + break; + } + } + if (a) { + var l = e.getAxis(i), u = Ke(a.stops, function(_) { + return { + coord: l.toGlobalCoord(l.dataToCoord(_.value)), + color: _.color + }; + }), c = u.length, h = a.outerColors.slice(); + c && u[0].coord > u[c - 1].coord && (u.reverse(), h.reverse()); + var f = ane(u, i === "x" ? t.getWidth() : t.getHeight()), v = f.length; + if (!v && c) + return u[0].coord < 0 ? h[1] ? h[1] : u[c - 1].color : h[0] ? h[0] : u[0].color; + var b = 10, w = f[0].coord - b, p = f[v - 1].coord + b, d = p - w; + if (d < 1e-3) + return "transparent"; + X(f, function(_) { + _.offset = (_.coord - w) / d; + }), f.push({ + // NOTE: inRangeStopLen may still be 0 if stoplen is zero. + offset: v ? f[v - 1].offset : 0.5, + color: h[1] || "transparent" + }), f.unshift({ + offset: v ? f[0].offset : 0.5, + color: h[0] || "transparent" + }); + var m = new Jd(0, 0, 0, 0, f, !0); + return m[i] = w, m[i + "2"] = p, m; + } + } +} +function sne(r, e, t) { + var n = r.get("showAllSymbol"), i = n === "auto"; + if (!(n && !i)) { + var a = t.getAxesByScale("ordinal")[0]; + if (a && !(i && lne(a, e))) { + var o = e.mapDimension(a.dim), s = {}; + return X(a.getViewLabels(), function(l) { + var u = a.scale.getRawOrdinalNumber(l.tickValue); + s[u] = 1; + }), function(l) { + return !s.hasOwnProperty(e.get(o, l)); + }; + } + } +} +function lne(r, e) { + var t = r.getExtent(), n = Math.abs(t[1] - t[0]) / r.scale.count(); + isNaN(n) && (n = 0); + for (var i = e.count(), a = Math.max(1, Math.round(i / 5)), o = 0; o < i; o += a) + if (um.getSymbolSize( + e, + o + // Only for cartesian, where `isHorizontal` exists. + )[r.isHorizontal() ? 1 : 0] * 1.5 > n) + return !1; + return !0; +} +function une(r, e) { + return isNaN(r) || isNaN(e); +} +function cne(r) { + for (var e = r.length / 2; e > 0 && une(r[e * 2 - 2], r[e * 2 - 1]); e--) + ; + return e - 1; +} +function V2(r, e) { + return [r[e * 2], r[e * 2 + 1]]; +} +function hne(r, e, t) { + for (var n = r.length / 2, i = t === "x" ? 0 : 1, a, o, s = 0, l = -1, u = 0; u < n; u++) + if (o = r[u * 2 + i], !(isNaN(o) || isNaN(r[u * 2 + 1 - i]))) { + if (u === 0) { + a = o; + continue; + } + if (a <= e && o >= e || a >= e && o <= e) { + l = u; + break; + } + s = u, a = o; + } + return { + range: [s, l], + t: (e - a) / (o - a) + }; +} +function eH(r) { + if (r.get(["endLabel", "show"])) + return !0; + for (var e = 0; e < ka.length; e++) + if (r.get([ka[e], "endLabel", "show"])) + return !0; + return !1; +} +function gw(r, e, t, n) { + if (lf(e, "cartesian2d")) { + var i = n.getModel("endLabel"), a = i.get("valueAnimation"), o = n.getData(), s = { + lastFrameIndex: 0 + }, l = eH(n) ? function(v, b) { + r._endLabelOnDuring(v, b, o, s, a, i, e); + } : null, u = e.getBaseAxis().isHorizontal(), c = Q$(e, t, n, function() { + var v = r._endLabel; + v && t && s.originalX != null && v.attr({ + x: s.originalX, + y: s.originalY + }); + }, l); + if (!n.get("clip", !0)) { + var h = c.shape, f = Math.max(h.width, h.height); + u ? (h.y -= f, h.height += f * 2) : (h.x -= f, h.width += f * 2); + } + return l && l(1, c), c; + } else + return q$(e, t, n); +} +function fne(r, e) { + var t = e.getBaseAxis(), n = t.isHorizontal(), i = t.inverse, a = n ? i ? "right" : "left" : "center", o = n ? "middle" : i ? "top" : "bottom"; + return { + normal: { + align: r.get("align") || a, + verticalAlign: r.get("verticalAlign") || o + } + }; +} +var dne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.init = function() { + var t = new Rt(), n = new cm(); + this.group.add(n.group), this._symbolDraw = n, this._lineGroup = t; + }, e.prototype.render = function(t, n, i) { + var a = this, o = t.coordinateSystem, s = this.group, l = t.getData(), u = t.getModel("lineStyle"), c = t.getModel("areaStyle"), h = l.getLayout("points") || [], f = o.type === "polar", v = this._coordSys, b = this._symbolDraw, w = this._polyline, p = this._polygon, d = this._lineGroup, m = !n.ssr && t.isAnimationEnabled(), _ = !c.isEmpty(), y = c.get("origin"), x = X$(o, l, y), g = _ && ine(o, l, x), S = t.get("showSymbol"), T = t.get("connectNulls"), C = S && !f && sne(t, l, o), E = this._data; + E && E.eachItemGraphicEl(function(xe, Ge) { + xe.__temp && (s.remove(xe), E.setItemGraphicEl(Ge, null)); + }), S || b.remove(), s.add(d); + var M = f ? !1 : t.get("step"), P; + o && o.getArea && t.get("clip", !0) && (P = o.getArea(), P.width != null ? (P.x -= 0.1, P.y -= 0.1, P.width += 0.2, P.height += 0.2) : P.r0 && (P.r0 -= 0.5, P.r += 0.5)), this._clipShapeForSymbol = P; + var R = one(l, o, i) || l.getVisual("style")[l.getVisual("drawType")]; + if (!(w && v.type === o.type && M === this._step)) + S && b.updateData(l, { + isIgnore: C, + clipShape: P, + disableAnimation: !0, + getSymbolPoint: function(xe) { + return [h[xe * 2], h[xe * 2 + 1]]; + } + }), m && this._initSymbolLabelAnimation(l, o, P), M && (h = Fu(h, o, M, T), g && (g = Fu(g, o, M, T))), w = this._newPolyline(h), _ ? p = this._newPolygon(h, g) : p && (d.remove(p), p = this._polygon = null), f || this._initOrUpdateEndLabel(t, o, Xh(R)), d.setClipPath(gw(this, o, !0, t)); + else { + _ && !p ? p = this._newPolygon(h, g) : p && !_ && (d.remove(p), p = this._polygon = null), f || this._initOrUpdateEndLabel(t, o, Xh(R)); + var N = d.getClipPath(); + if (N) { + var F = gw(this, o, !1, t); + An(N, { + shape: F.shape + }, t); + } else + d.setClipPath(gw(this, o, !0, t)); + S && b.updateData(l, { + isIgnore: C, + clipShape: P, + disableAnimation: !0, + getSymbolPoint: function(xe) { + return [h[xe * 2], h[xe * 2 + 1]]; + } + }), (!j2(this._stackedOnPoints, g) || !j2(this._points, h)) && (m ? this._doUpdateAnimation(l, g, o, i, M, y, T) : (M && (h = Fu(h, o, M, T), g && (g = Fu(g, o, M, T))), w.setShape({ + points: h + }), p && p.setShape({ + points: h, + stackedOnPoints: g + }))); + } + var U = t.getModel("emphasis"), $ = U.get("focus"), G = U.get("blurScope"), Q = U.get("disabled"); + if (w.useStyle(Mt( + // Use color in lineStyle first + u.getLineStyle(), + { + fill: "none", + stroke: R, + lineJoin: "bevel" + } + )), Xi(w, t, "lineStyle"), w.style.lineWidth > 0 && t.get(["emphasis", "lineStyle", "width"]) === "bolder") { + var ee = w.getState("emphasis").style; + ee.lineWidth = +w.style.lineWidth + 1; + } + Ft(w).seriesIndex = t.seriesIndex, Un(w, $, G, Q); + var ce = H2(t.get("smooth")), ne = t.get("smoothMonotone"); + if (w.setShape({ + smooth: ce, + smoothMonotone: ne, + connectNulls: T + }), p) { + var fe = l.getCalculationInfo("stackedOnSeries"), K = 0; + p.useStyle(Mt(c.getAreaStyle(), { + fill: R, + opacity: 0.7, + lineJoin: "bevel", + decal: l.getVisual("style").decal + })), fe && (K = H2(fe.get("smooth"))), p.setShape({ + smooth: ce, + stackedOnSmooth: K, + smoothMonotone: ne, + connectNulls: T + }), Xi(p, t, "areaStyle"), Ft(p).seriesIndex = t.seriesIndex, Un(p, $, G, Q); + } + var Oe = function(xe) { + a._changePolyState(xe); + }; + l.eachItemGraphicEl(function(xe) { + xe && (xe.onHoverStateChange = Oe); + }), this._polyline.onHoverStateChange = Oe, this._data = l, this._coordSys = o, this._stackedOnPoints = g, this._points = h, this._step = M, this._valueOrigin = y, t.get("triggerLineEvent") && (this.packEventData(t, w), p && this.packEventData(t, p)); + }, e.prototype.packEventData = function(t, n) { + Ft(n).eventData = { + componentType: "series", + componentSubType: "line", + componentIndex: t.componentIndex, + seriesIndex: t.seriesIndex, + seriesName: t.name, + seriesType: "line" + }; + }, e.prototype.highlight = function(t, n, i, a) { + var o = t.getData(), s = Uh(o, a); + if (this._changePolyState("emphasis"), !(s instanceof Array) && s != null && s >= 0) { + var l = o.getLayout("points"), u = o.getItemGraphicEl(s); + if (!u) { + var c = l[s * 2], h = l[s * 2 + 1]; + if (isNaN(c) || isNaN(h) || this._clipShapeForSymbol && !this._clipShapeForSymbol.contain(c, h)) + return; + var f = t.get("zlevel") || 0, v = t.get("z") || 0; + u = new um(o, s), u.x = c, u.y = h, u.setZ(f, v); + var b = u.getSymbolPath().getTextContent(); + b && (b.zlevel = f, b.z = v, b.z2 = this._polyline.z2 + 1), u.__temp = !0, o.setItemGraphicEl(s, u), u.stopSymbolAnimation(!0), this.group.add(u); + } + u.highlight(); + } else + en.prototype.highlight.call(this, t, n, i, a); + }, e.prototype.downplay = function(t, n, i, a) { + var o = t.getData(), s = Uh(o, a); + if (this._changePolyState("normal"), s != null && s >= 0) { + var l = o.getItemGraphicEl(s); + l && (l.__temp ? (o.setItemGraphicEl(s, null), this.group.remove(l)) : l.downplay()); + } else + en.prototype.downplay.call(this, t, n, i, a); + }, e.prototype._changePolyState = function(t) { + var n = this._polygon; + m_(this._polyline, t), n && m_(n, t); + }, e.prototype._newPolyline = function(t) { + var n = this._polyline; + return n && this._lineGroup.remove(n), n = new rne({ + shape: { + points: t + }, + segmentIgnoreThreshold: 2, + z2: 10 + }), this._lineGroup.add(n), this._polyline = n, n; + }, e.prototype._newPolygon = function(t, n) { + var i = this._polygon; + return i && this._lineGroup.remove(i), i = new K$({ + shape: { + points: t, + stackedOnPoints: n + }, + segmentIgnoreThreshold: 2 + }), this._lineGroup.add(i), this._polygon = i, i; + }, e.prototype._initSymbolLabelAnimation = function(t, n, i) { + var a, o, s = n.getBaseAxis(), l = s.inverse; + n.type === "cartesian2d" ? (a = s.isHorizontal(), o = !1) : n.type === "polar" && (a = s.dim === "angle", o = !0); + var u = t.hostModel, c = u.get("animationDuration"); + Tt(c) && (c = c(null)); + var h = u.get("animationDelay") || 0, f = Tt(h) ? h(null) : h; + t.eachItemGraphicEl(function(v, b) { + var w = v; + if (w) { + var p = [v.x, v.y], d = void 0, m = void 0, _ = void 0; + if (i) + if (o) { + var y = i, x = n.pointToCoord(p); + a ? (d = y.startAngle, m = y.endAngle, _ = -x[1] / 180 * Math.PI) : (d = y.r0, m = y.r, _ = x[0]); + } else { + var g = i; + a ? (d = g.x, m = g.x + g.width, _ = v.x) : (d = g.y + g.height, m = g.y, _ = v.y); + } + var S = m === d ? 0 : (_ - d) / (m - d); + l && (S = 1 - S); + var T = Tt(h) ? h(b) : c * S + f, C = w.getSymbolPath(), E = C.getTextContent(); + w.attr({ + scaleX: 0, + scaleY: 0 + }), w.animateTo({ + scaleX: 1, + scaleY: 1 + }, { + duration: 200, + setToFinal: !0, + delay: T + }), E && E.animateFrom({ + style: { + opacity: 0 + } + }, { + duration: 300, + delay: T + }), C.disableLabelAnimation = !0; + } + }); + }, e.prototype._initOrUpdateEndLabel = function(t, n, i) { + var a = t.getModel("endLabel"); + if (eH(t)) { + var o = t.getData(), s = this._polyline, l = o.getLayout("points"); + if (!l) { + s.removeTextContent(), this._endLabel = null; + return; + } + var u = this._endLabel; + u || (u = this._endLabel = new kr({ + z2: 200 + // should be higher than item symbol + }), u.ignoreClip = !0, s.setTextContent(this._endLabel), s.disableLabelAnimation = !0); + var c = cne(l); + c >= 0 && (Zi(s, Mi(t, "endLabel"), { + inheritColor: i, + labelFetcher: t, + labelDataIndex: c, + defaultText: function(h, f, v) { + return v != null ? Y$(o, v) : zd(o, h); + }, + enableTextSetter: !0 + }, fne(a, n)), s.textConfig.position = null); + } else + this._endLabel && (this._polyline.removeTextContent(), this._endLabel = null); + }, e.prototype._endLabelOnDuring = function(t, n, i, a, o, s, l) { + var u = this._endLabel, c = this._polyline; + if (u) { + t < 1 && a.originalX == null && (a.originalX = u.x, a.originalY = u.y); + var h = i.getLayout("points"), f = i.hostModel, v = f.get("connectNulls"), b = s.get("precision"), w = s.get("distance") || 0, p = l.getBaseAxis(), d = p.isHorizontal(), m = p.inverse, _ = n.shape, y = m ? d ? _.x : _.y + _.height : d ? _.x + _.width : _.y, x = (d ? w : 0) * (m ? -1 : 1), g = (d ? 0 : -w) * (m ? -1 : 1), S = d ? "x" : "y", T = hne(h, y, S), C = T.range, E = C[1] - C[0], M = void 0; + if (E >= 1) { + if (E > 1 && !v) { + var P = V2(h, C[0]); + u.attr({ + x: P[0] + x, + y: P[1] + g + }), o && (M = f.getRawValue(C[0])); + } else { + var P = c.getPointOn(y, S); + P && u.attr({ + x: P[0] + x, + y: P[1] + g + }); + var R = f.getRawValue(C[0]), N = f.getRawValue(C[1]); + o && (M = a5(i, b, R, N, T.t)); + } + a.lastFrameIndex = C[0]; + } else { + var F = t === 1 || a.lastFrameIndex > 0 ? C[0] : 0, P = V2(h, F); + o && (M = f.getRawValue(F)), u.attr({ + x: P[0] + x, + y: P[1] + g + }); + } + if (o) { + var U = ev(u); + typeof U.setLabelText == "function" && U.setLabelText(M); + } + } + }, e.prototype._doUpdateAnimation = function(t, n, i, a, o, s, l) { + var u = this._polyline, c = this._polygon, h = t.hostModel, f = tne(this._data, t, this._stackedOnPoints, n, this._coordSys, i, this._valueOrigin), v = f.current, b = f.stackedOnCurrent, w = f.next, p = f.stackedOnNext; + if (o && (v = Fu(f.current, i, o, l), b = Fu(f.stackedOnCurrent, i, o, l), w = Fu(f.next, i, o, l), p = Fu(f.stackedOnNext, i, o, l)), $2(v, w) > 3e3 || c && $2(b, p) > 3e3) { + u.stopAnimation(), u.setShape({ + points: w + }), c && (c.stopAnimation(), c.setShape({ + points: w, + stackedOnPoints: p + })); + return; + } + u.shape.__points = f.current, u.shape.points = v; + var d = { + shape: { + points: w + } + }; + f.current !== v && (d.shape.__points = f.next), u.stopAnimation(), zr(u, d, h), c && (c.setShape({ + // Reuse the points with polyline. + points: v, + stackedOnPoints: b + }), c.stopAnimation(), zr(c, { + shape: { + stackedOnPoints: p + } + }, h), u.shape.points !== c.shape.points && (c.shape.points = u.shape.points)); + for (var m = [], _ = f.status, y = 0; y < _.length; y++) { + var x = _[y].cmd; + if (x === "=") { + var g = t.getItemGraphicEl(_[y].idx1); + g && m.push({ + el: g, + ptIdx: y + // Index of points + }); + } + } + u.animators && u.animators.length && u.animators[0].during(function() { + c && c.dirtyShape(); + for (var S = u.shape.__points, T = 0; T < m.length; T++) { + var C = m[T].el, E = m[T].ptIdx * 2; + C.x = S[E], C.y = S[E + 1], C.markRedraw(); + } + }); + }, e.prototype.remove = function(t) { + var n = this.group, i = this._data; + this._lineGroup.removeAll(), this._symbolDraw.remove(!0), i && i.eachItemGraphicEl(function(a, o) { + a.__temp && (n.remove(a), i.setItemGraphicEl(o, null)); + }), this._polyline = this._polygon = this._coordSys = this._points = this._stackedOnPoints = this._endLabel = this._data = null; + }, e.type = "line", e; + }(en) +); +const vne = dne; +function hm(r, e) { + return { + seriesType: r, + plan: ov(), + reset: function(t) { + var n = t.getData(), i = t.coordinateSystem, a = t.pipelineContext, o = e || a.large; + if (i) { + var s = Ke(i.dimensions, function(v) { + return n.mapDimension(v); + }).slice(0, 2), l = s.length, u = n.getCalculationInfo("stackResultDimension"); + iu(n, s[0]) && (s[0] = u), iu(n, s[1]) && (s[1] = u); + var c = n.getStore(), h = n.getDimensionIndex(s[0]), f = n.getDimensionIndex(s[1]); + return l && { + progress: function(v, b) { + for (var w = v.end - v.start, p = o && ml(w * l), d = [], m = [], _ = v.start, y = 0; _ < v.end; _++) { + var x = void 0; + if (l === 1) { + var g = c.get(h, _); + x = i.dataToPoint(g, null, m); + } else + d[0] = c.get(h, _), d[1] = c.get(f, _), x = i.dataToPoint(d, null, m); + o ? (p[y++] = x[0], p[y++] = x[1]) : b.setItemLayout(_, x.slice()); + } + o && b.setLayout("points", p); + } + }; + } + } + }; +} +var pne = { + average: function(r) { + for (var e = 0, t = 0, n = 0; n < r.length; n++) + isNaN(r[n]) || (e += r[n], t++); + return t === 0 ? NaN : e / t; + }, + sum: function(r) { + for (var e = 0, t = 0; t < r.length; t++) + e += r[t] || 0; + return e; + }, + max: function(r) { + for (var e = -1 / 0, t = 0; t < r.length; t++) + r[t] > e && (e = r[t]); + return isFinite(e) ? e : NaN; + }, + min: function(r) { + for (var e = 1 / 0, t = 0; t < r.length; t++) + r[t] < e && (e = r[t]); + return isFinite(e) ? e : NaN; + }, + // TODO + // Median + nearest: function(r) { + return r[0]; + } +}, gne = function(r) { + return Math.round(r.length / 2); +}; +function tH(r) { + return { + seriesType: r, + // FIXME:TS never used, so comment it + // modifyOutputEnd: true, + reset: function(e, t, n) { + var i = e.getData(), a = e.get("sampling"), o = e.coordinateSystem, s = i.count(); + if (s > 10 && o.type === "cartesian2d" && a) { + var l = o.getBaseAxis(), u = o.getOtherAxis(l), c = l.getExtent(), h = n.getDevicePixelRatio(), f = Math.abs(c[1] - c[0]) * (h || 1), v = Math.round(s / f); + if (isFinite(v) && v > 1) { + a === "lttb" && e.setData(i.lttbDownSample(i.mapDimension(u.dim), 1 / v)); + var b = void 0; + ut(a) ? b = pne[a] : Tt(a) && (b = a), b && e.setData(i.downSample(i.mapDimension(u.dim), 1 / v, b, gne)); + } + } + } + }; +} +function mne(r) { + r.registerChartView(vne), r.registerSeriesModel(Zre), r.registerLayout(hm("line", !0)), r.registerVisual({ + seriesType: "line", + reset: function(e) { + var t = e.getData(), n = e.getModel("lineStyle").getLineStyle(); + n && !n.stroke && (n.stroke = t.getVisual("style").fill), t.setVisual("legendLineStyle", n); + } + }), r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC, tH("line")); +} +var rH = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.getInitialData = function(t, n) { + return Dl(null, this, { + useEncodeDefaulter: !0 + }); + }, e.prototype.getMarkerPosition = function(t, n, i) { + var a = this.coordinateSystem; + if (a && a.clampData) { + var o = a.clampData(t), s = a.dataToPoint(o); + if (i) + X(a.getAxes(), function(f, v) { + if (f.type === "category" && n != null) { + var b = f.getTicksCoords(), w = o[v], p = n[v] === "x1" || n[v] === "y1"; + if (p && (w += 1), b.length < 2) + return; + if (b.length === 2) { + s[v] = f.toGlobalCoord(f.getExtent()[p ? 1 : 0]); + return; + } + for (var d = void 0, m = void 0, _ = 1, y = 0; y < b.length; y++) { + var x = b[y].coord, g = y === b.length - 1 ? b[y - 1].tickValue + _ : b[y].tickValue; + if (g === w) { + m = x; + break; + } else if (g < w) + d = x; + else if (d != null && g > w) { + m = (x + d) / 2; + break; + } + y === 1 && (_ = g - b[0].tickValue); + } + m == null && (d ? d && (m = b[b.length - 1].coord) : m = b[0].coord), s[v] = f.toGlobalCoord(m); + } + }); + else { + var l = this.getData(), u = l.getLayout("offset"), c = l.getLayout("size"), h = a.getBaseAxis().isHorizontal() ? 0 : 1; + s[h] += u + c / 2; + } + return s; + } + return [NaN, NaN]; + }, e.type = "series.__base_bar__", e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "cartesian2d", + legendHoverLink: !0, + // stack: null + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, + barMinHeight: 0, + barMinAngle: 0, + // cursor: null, + large: !1, + largeThreshold: 400, + progressive: 3e3, + progressiveChunkMode: "mod" + }, e; + }(mn) +); +mn.registerClass(rH); +const B_ = rH; +var yne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.getInitialData = function() { + return Dl(null, this, { + useEncodeDefaulter: !0, + createInvertedIndices: !!this.get("realtimeSort", !0) || null + }); + }, e.prototype.getProgressive = function() { + return this.get("large") ? this.get("progressive") : !1; + }, e.prototype.getProgressiveThreshold = function() { + var t = this.get("progressiveThreshold"), n = this.get("largeThreshold"); + return n > t && (t = n), t; + }, e.prototype.brushSelector = function(t, n, i) { + return i.rect(n.getItemLayout(t)); + }, e.type = "series.bar", e.dependencies = ["grid", "polar"], e.defaultOption = Tc(B_.defaultOption, { + // If clipped + // Only available on cartesian2d + clip: !0, + roundCap: !1, + showBackground: !1, + backgroundStyle: { + color: "rgba(180, 180, 180, 0.2)", + borderColor: null, + borderWidth: 0, + borderType: "solid", + borderRadius: 0, + shadowBlur: 0, + shadowColor: null, + shadowOffsetX: 0, + shadowOffsetY: 0, + opacity: 1 + }, + select: { + itemStyle: { + borderColor: "#212121" + } + }, + realtimeSort: !1 + }), e; + }(B_) +); +const _ne = yne; +var bne = ( + /** @class */ + function() { + function r() { + this.cx = 0, this.cy = 0, this.r0 = 0, this.r = 0, this.startAngle = 0, this.endAngle = Math.PI * 2, this.clockwise = !0; + } + return r; + }() +), xne = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "sausage", n; + } + return e.prototype.getDefaultShape = function() { + return new bne(); + }, e.prototype.buildPath = function(t, n) { + var i = n.cx, a = n.cy, o = Math.max(n.r0 || 0, 0), s = Math.max(n.r, 0), l = (s - o) * 0.5, u = o + l, c = n.startAngle, h = n.endAngle, f = n.clockwise, v = Math.PI * 2, b = f ? h - c < v : c - h < v; + b || (c = h - (f ? v : -v)); + var w = Math.cos(c), p = Math.sin(c), d = Math.cos(h), m = Math.sin(h); + b ? (t.moveTo(w * o + i, p * o + a), t.arc(w * u + i, p * u + a, l, -Math.PI + c, c, !f)) : t.moveTo(w * s + i, p * s + a), t.arc(i, a, s, c, h, !f), t.arc(d * u + i, m * u + a, l, h - Math.PI * 2, h - Math.PI, !f), o !== 0 && t.arc(i, a, o, h, c, f); + }, e; + }(hr) +); +const j_ = xne; +function Sne(r, e) { + e = e || {}; + var t = e.isRoundCap; + return function(n, i, a) { + var o = i.position; + if (!o || o instanceof Array) + return p_(n, i, a); + var s = r(o), l = i.distance != null ? i.distance : 5, u = this.shape, c = u.cx, h = u.cy, f = u.r, v = u.r0, b = (f + v) / 2, w = u.startAngle, p = u.endAngle, d = (w + p) / 2, m = t ? Math.abs(f - v) / 2 : 0, _ = Math.cos, y = Math.sin, x = c + f * _(w), g = h + f * y(w), S = "left", T = "top"; + switch (s) { + case "startArc": + x = c + (v - l) * _(d), g = h + (v - l) * y(d), S = "center", T = "top"; + break; + case "insideStartArc": + x = c + (v + l) * _(d), g = h + (v + l) * y(d), S = "center", T = "bottom"; + break; + case "startAngle": + x = c + b * _(w) + e0(w, l + m, !1), g = h + b * y(w) + t0(w, l + m, !1), S = "right", T = "middle"; + break; + case "insideStartAngle": + x = c + b * _(w) + e0(w, -l + m, !1), g = h + b * y(w) + t0(w, -l + m, !1), S = "left", T = "middle"; + break; + case "middle": + x = c + b * _(d), g = h + b * y(d), S = "center", T = "middle"; + break; + case "endArc": + x = c + (f + l) * _(d), g = h + (f + l) * y(d), S = "center", T = "bottom"; + break; + case "insideEndArc": + x = c + (f - l) * _(d), g = h + (f - l) * y(d), S = "center", T = "top"; + break; + case "endAngle": + x = c + b * _(p) + e0(p, l + m, !0), g = h + b * y(p) + t0(p, l + m, !0), S = "left", T = "middle"; + break; + case "insideEndAngle": + x = c + b * _(p) + e0(p, -l + m, !0), g = h + b * y(p) + t0(p, -l + m, !0), S = "right", T = "middle"; + break; + default: + return p_(n, i, a); + } + return n = n || {}, n.x = x, n.y = g, n.align = S, n.verticalAlign = T, n; + }; +} +function wne(r, e, t, n) { + if (Pr(n)) { + r.setTextConfig({ + rotation: n + }); + return; + } else if (We(e)) { + r.setTextConfig({ + rotation: 0 + }); + return; + } + var i = r.shape, a = i.clockwise ? i.startAngle : i.endAngle, o = i.clockwise ? i.endAngle : i.startAngle, s = (a + o) / 2, l, u = t(e); + switch (u) { + case "startArc": + case "insideStartArc": + case "middle": + case "insideEndArc": + case "endArc": + l = s; + break; + case "startAngle": + case "insideStartAngle": + l = a; + break; + case "endAngle": + case "insideEndAngle": + l = o; + break; + default: + r.setTextConfig({ + rotation: 0 + }); + return; + } + var c = Math.PI * 1.5 - l; + u === "middle" && c > Math.PI / 2 && c < Math.PI * 1.5 && (c -= Math.PI), r.setTextConfig({ + rotation: c + }); +} +function e0(r, e, t) { + return e * Math.sin(r) * (t ? -1 : 1); +} +function t0(r, e, t) { + return e * Math.cos(r) * (t ? 1 : -1); +} +function Oh(r, e, t) { + var n = r.get("borderRadius"); + if (n == null) + return t ? { + cornerRadius: 0 + } : null; + We(n) || (n = [n, n, n, n]); + var i = Math.abs(e.r || 0 - e.r0 || 0); + return { + cornerRadius: Ke(n, function(a) { + return Fs(a, i); + }) + }; +} +var mw = Math.max, yw = Math.min; +function Cne(r, e) { + var t = r.getArea && r.getArea(); + if (lf(r, "cartesian2d")) { + var n = r.getBaseAxis(); + if (n.type !== "category" || !n.onBand) { + var i = e.getLayout("bandWidth"); + n.isHorizontal() ? (t.x -= i, t.width += i * 2) : (t.y -= i, t.height += i * 2); + } + } + return t; +} +var Tne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r.call(this) || this; + return t.type = e.type, t._isFirstFrame = !0, t; + } + return e.prototype.render = function(t, n, i, a) { + this._model = t, this._removeOnRenderedListener(i), this._updateDrawMode(t); + var o = t.get("coordinateSystem"); + (o === "cartesian2d" || o === "polar") && (this._progressiveEls = null, this._isLargeDraw ? this._renderLarge(t, n, i) : this._renderNormal(t, n, i, a)); + }, e.prototype.incrementalPrepareRender = function(t) { + this._clear(), this._updateDrawMode(t), this._updateLargeClip(t); + }, e.prototype.incrementalRender = function(t, n) { + this._progressiveEls = [], this._incrementalRenderLarge(t, n); + }, e.prototype.eachRendered = function(t) { + Cc(this._progressiveEls || this.group, t); + }, e.prototype._updateDrawMode = function(t) { + var n = t.pipelineContext.large; + (this._isLargeDraw == null || n !== this._isLargeDraw) && (this._isLargeDraw = n, this._clear()); + }, e.prototype._renderNormal = function(t, n, i, a) { + var o = this.group, s = t.getData(), l = this._data, u = t.coordinateSystem, c = u.getBaseAxis(), h; + u.type === "cartesian2d" ? h = c.isHorizontal() : u.type === "polar" && (h = c.dim === "angle"); + var f = t.isAnimationEnabled() ? t : null, v = Ine(t, u); + v && this._enableRealtimeSort(v, s, i); + var b = t.get("clip", !0) || v, w = Cne(u, s); + o.removeClipPath(); + var p = t.get("roundCap", !0), d = t.get("showBackground", !0), m = t.getModel("backgroundStyle"), _ = m.get("borderRadius") || 0, y = [], x = this._backgroundEls, g = a && a.isInitSort, S = a && a.type === "changeAxisOrder"; + function T(M) { + var P = r0[u.type](s, M), R = Lne(u, h, P); + return R.useStyle(m.getItemStyle()), u.type === "cartesian2d" ? R.setShape("r", _) : R.setShape("cornerRadius", _), y[M] = R, R; + } + s.diff(l).add(function(M) { + var P = s.getItemModel(M), R = r0[u.type](s, M, P); + if (d && T(M), !(!s.hasValue(M) || !X2[u.type](R))) { + var N = !1; + b && (N = G2[u.type](w, R)); + var F = U2[u.type](t, s, M, R, h, f, c.model, !1, p); + v && (F.forceLabelAnimation = !0), Z2(F, s, M, P, R, t, h, u.type === "polar"), g ? F.attr({ + shape: R + }) : v ? W2(v, f, F, R, M, h, !1, !1) : An(F, { + shape: R + }, t, M), s.setItemGraphicEl(M, F), o.add(F), F.ignore = N; + } + }).update(function(M, P) { + var R = s.getItemModel(M), N = r0[u.type](s, M, R); + if (d) { + var F = void 0; + x.length === 0 ? F = T(P) : (F = x[P], F.useStyle(m.getItemStyle()), u.type === "cartesian2d" ? F.setShape("r", _) : F.setShape("cornerRadius", _), y[M] = F); + var U = r0[u.type](s, M), $ = iH(h, U, u); + zr(F, { + shape: $ + }, f, M); + } + var G = l.getItemGraphicEl(P); + if (!s.hasValue(M) || !X2[u.type](N)) { + o.remove(G); + return; + } + var Q = !1; + if (b && (Q = G2[u.type](w, N), Q && o.remove(G)), G ? Hs(G) : G = U2[u.type](t, s, M, N, h, f, c.model, !!G, p), v && (G.forceLabelAnimation = !0), S) { + var ee = G.getTextContent(); + if (ee) { + var ce = ev(ee); + ce.prevValue != null && (ce.prevValue = ce.value); + } + } else + Z2(G, s, M, R, N, t, h, u.type === "polar"); + g ? G.attr({ + shape: N + }) : v ? W2(v, f, G, N, M, h, !0, S) : zr(G, { + shape: N + }, t, M, null), s.setItemGraphicEl(M, G), G.ignore = Q, o.add(G); + }).remove(function(M) { + var P = l.getItemGraphicEl(M); + P && mg(P, t, M); + }).execute(); + var C = this._backgroundGroup || (this._backgroundGroup = new Rt()); + C.removeAll(); + for (var E = 0; E < y.length; ++E) + C.add(y[E]); + o.add(C), this._backgroundEls = y, this._data = s; + }, e.prototype._renderLarge = function(t, n, i) { + this._clear(), K2(t, this.group), this._updateLargeClip(t); + }, e.prototype._incrementalRenderLarge = function(t, n) { + this._removeBackground(), K2(n, this.group, this._progressiveEls, !0); + }, e.prototype._updateLargeClip = function(t) { + var n = t.get("clip", !0) && lx(t.coordinateSystem, !1, t), i = this.group; + n ? i.setClipPath(n) : i.removeClipPath(); + }, e.prototype._enableRealtimeSort = function(t, n, i) { + var a = this; + if (n.count()) { + var o = t.baseAxis; + if (this._isFirstFrame) + this._dispatchInitSort(n, t, i), this._isFirstFrame = !1; + else { + var s = function(l) { + var u = n.getItemGraphicEl(l), c = u && u.shape; + return c && // The result should be consistent with the initial sort by data value. + // Do not support the case that both positive and negative exist. + Math.abs(o.isHorizontal() ? c.height : c.width) || 0; + }; + this._onRendered = function() { + a._updateSortWithinSameData(n, s, o, i); + }, i.getZr().on("rendered", this._onRendered); + } + } + }, e.prototype._dataSort = function(t, n, i) { + var a = []; + return t.each(t.mapDimension(n.dim), function(o, s) { + var l = i(s); + l = l == null ? NaN : l, a.push({ + dataIndex: s, + mappedValue: l, + ordinalNumber: o + }); + }), a.sort(function(o, s) { + return s.mappedValue - o.mappedValue; + }), { + ordinalNumbers: Ke(a, function(o) { + return o.ordinalNumber; + }) + }; + }, e.prototype._isOrderChangedWithinSameData = function(t, n, i) { + for (var a = i.scale, o = t.mapDimension(i.dim), s = Number.MAX_VALUE, l = 0, u = a.getOrdinalMeta().categories.length; l < u; ++l) { + var c = t.rawIndexOf(o, a.getRawOrdinalNumber(l)), h = c < 0 ? Number.MIN_VALUE : n(t.indexOfRawIndex(c)); + if (h > s) + return !0; + s = h; + } + return !1; + }, e.prototype._isOrderDifferentInView = function(t, n) { + for (var i = n.scale, a = i.getExtent(), o = Math.max(0, a[0]), s = Math.min(a[1], i.getOrdinalMeta().categories.length - 1); o <= s; ++o) + if (t.ordinalNumbers[o] !== i.getRawOrdinalNumber(o)) + return !0; + }, e.prototype._updateSortWithinSameData = function(t, n, i, a) { + if (this._isOrderChangedWithinSameData(t, n, i)) { + var o = this._dataSort(t, i, n); + this._isOrderDifferentInView(o, i) && (this._removeOnRenderedListener(a), a.dispatchAction({ + type: "changeAxisOrder", + componentType: i.dim + "Axis", + axisId: i.index, + sortInfo: o + })); + } + }, e.prototype._dispatchInitSort = function(t, n, i) { + var a = n.baseAxis, o = this._dataSort(t, a, function(s) { + return t.get(t.mapDimension(n.otherAxis.dim), s); + }); + i.dispatchAction({ + type: "changeAxisOrder", + componentType: a.dim + "Axis", + isInitSort: !0, + axisId: a.index, + sortInfo: o + }); + }, e.prototype.remove = function(t, n) { + this._clear(this._model), this._removeOnRenderedListener(n); + }, e.prototype.dispose = function(t, n) { + this._removeOnRenderedListener(n); + }, e.prototype._removeOnRenderedListener = function(t) { + this._onRendered && (t.getZr().off("rendered", this._onRendered), this._onRendered = null); + }, e.prototype._clear = function(t) { + var n = this.group, i = this._data; + t && t.isAnimationEnabled() && i && !this._isLargeDraw ? (this._removeBackground(), this._backgroundEls = [], i.eachItemGraphicEl(function(a) { + mg(a, t, Ft(a).dataIndex); + })) : n.removeAll(), this._data = null, this._isFirstFrame = !0; + }, e.prototype._removeBackground = function() { + this.group.remove(this._backgroundGroup), this._backgroundGroup = null; + }, e.type = "bar", e; + }(en) +), G2 = { + cartesian2d: function(r, e) { + var t = e.width < 0 ? -1 : 1, n = e.height < 0 ? -1 : 1; + t < 0 && (e.x += e.width, e.width = -e.width), n < 0 && (e.y += e.height, e.height = -e.height); + var i = r.x + r.width, a = r.y + r.height, o = mw(e.x, r.x), s = yw(e.x + e.width, i), l = mw(e.y, r.y), u = yw(e.y + e.height, a), c = s < o, h = u < l; + return e.x = c && o > i ? s : o, e.y = h && l > a ? u : l, e.width = c ? 0 : s - o, e.height = h ? 0 : u - l, t < 0 && (e.x += e.width, e.width = -e.width), n < 0 && (e.y += e.height, e.height = -e.height), c || h; + }, + polar: function(r, e) { + var t = e.r0 <= e.r ? 1 : -1; + if (t < 0) { + var n = e.r; + e.r = e.r0, e.r0 = n; + } + var i = yw(e.r, r.r), a = mw(e.r0, r.r0); + e.r = i, e.r0 = a; + var o = i - a < 0; + if (t < 0) { + var n = e.r; + e.r = e.r0, e.r0 = n; + } + return o; + } +}, U2 = { + cartesian2d: function(r, e, t, n, i, a, o, s, l) { + var u = new Or({ + shape: Fe({}, n), + z2: 1 + }); + if (u.__dataIndex = t, u.name = "item", a) { + var c = u.shape, h = i ? "height" : "width"; + c[h] = 0; + } + return u; + }, + polar: function(r, e, t, n, i, a, o, s, l) { + var u = !i && l ? j_ : Oa, c = new u({ + shape: n, + z2: 1 + }); + c.name = "item"; + var h = nH(i); + if (c.calculateTextPosition = Sne(h, { + isRoundCap: u === j_ + }), a) { + var f = c.shape, v = i ? "r" : "endAngle", b = {}; + f[v] = i ? n.r0 : n.startAngle, b[v] = n[v], (s ? zr : An)(c, { + shape: b + // __value: typeof dataValue === 'string' ? parseInt(dataValue, 10) : dataValue + }, a); + } + return c; + } +}; +function Ine(r, e) { + var t = r.get("realtimeSort", !0), n = e.getBaseAxis(); + if (t && n.type === "category" && e.type === "cartesian2d") + return { + baseAxis: n, + otherAxis: e.getOtherAxis(n) + }; +} +function W2(r, e, t, n, i, a, o, s) { + var l, u; + a ? (u = { + x: n.x, + width: n.width + }, l = { + y: n.y, + height: n.height + }) : (u = { + y: n.y, + height: n.height + }, l = { + x: n.x, + width: n.width + }), s || (o ? zr : An)(t, { + shape: l + }, e, i, null); + var c = e ? r.baseAxis.model : null; + (o ? zr : An)(t, { + shape: u + }, c, i); +} +function Y2(r, e) { + for (var t = 0; t < e.length; t++) + if (!isFinite(r[e[t]])) + return !0; + return !1; +} +var Ane = ["x", "y", "width", "height"], Ene = ["cx", "cy", "r", "startAngle", "endAngle"], X2 = { + cartesian2d: function(r) { + return !Y2(r, Ane); + }, + polar: function(r) { + return !Y2(r, Ene); + } +}, r0 = { + // itemModel is only used to get borderWidth, which is not needed + // when calculating bar background layout. + cartesian2d: function(r, e, t) { + var n = r.getItemLayout(e), i = t ? Dne(t, n) : 0, a = n.width > 0 ? 1 : -1, o = n.height > 0 ? 1 : -1; + return { + x: n.x + a * i / 2, + y: n.y + o * i / 2, + width: n.width - a * i, + height: n.height - o * i + }; + }, + polar: function(r, e, t) { + var n = r.getItemLayout(e); + return { + cx: n.cx, + cy: n.cy, + r0: n.r0, + r: n.r, + startAngle: n.startAngle, + endAngle: n.endAngle, + clockwise: n.clockwise + }; + } +}; +function Mne(r) { + return r.startAngle != null && r.endAngle != null && r.startAngle === r.endAngle; +} +function nH(r) { + return function(e) { + var t = e ? "Arc" : "Angle"; + return function(n) { + switch (n) { + case "start": + case "insideStart": + case "end": + case "insideEnd": + return n + t; + default: + return n; + } + }; + }(r); +} +function Z2(r, e, t, n, i, a, o, s) { + var l = e.getItemVisual(t, "style"); + if (s) { + if (!a.get("roundCap")) { + var c = r.shape, h = Oh(n.getModel("itemStyle"), c, !0); + Fe(c, h), r.setShape(c); + } + } else { + var u = n.get(["itemStyle", "borderRadius"]) || 0; + r.setShape("r", u); + } + r.useStyle(l); + var f = n.getShallow("cursor"); + f && r.attr("cursor", f); + var v = s ? o ? i.r >= i.r0 ? "endArc" : "startArc" : i.endAngle >= i.startAngle ? "endAngle" : "startAngle" : o ? i.height >= 0 ? "bottom" : "top" : i.width >= 0 ? "right" : "left", b = Mi(n); + Zi(r, b, { + labelFetcher: a, + labelDataIndex: t, + defaultText: zd(a.getData(), t), + inheritColor: l.fill, + defaultOpacity: l.opacity, + defaultOutsidePosition: v + }); + var w = r.getTextContent(); + if (s && w) { + var p = n.get(["label", "position"]); + r.textConfig.inside = p === "middle" ? !0 : null, wne(r, p === "outside" ? v : p, nH(o), n.get(["label", "rotate"])); + } + iF(w, b, a.getRawValue(t), function(m) { + return Y$(e, m); + }); + var d = n.getModel(["emphasis"]); + Un(r, d.get("focus"), d.get("blurScope"), d.get("disabled")), Xi(r, n), Mne(i) && (r.style.fill = "none", r.style.stroke = "none", X(r.states, function(m) { + m.style && (m.style.fill = m.style.stroke = "none"); + })); +} +function Dne(r, e) { + var t = r.get(["itemStyle", "borderColor"]); + if (!t || t === "none") + return 0; + var n = r.get(["itemStyle", "borderWidth"]) || 0, i = isNaN(e.width) ? Number.MAX_VALUE : Math.abs(e.width), a = isNaN(e.height) ? Number.MAX_VALUE : Math.abs(e.height); + return Math.min(n, i, a); +} +var kne = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), J2 = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "largeBar", n; + } + return e.prototype.getDefaultShape = function() { + return new kne(); + }, e.prototype.buildPath = function(t, n) { + for (var i = n.points, a = this.baseDimIdx, o = 1 - this.baseDimIdx, s = [], l = [], u = this.barWidth, c = 0; c < i.length; c += 3) + l[a] = u, l[o] = i[c + 2], s[a] = i[c + a], s[o] = i[c + o], t.rect(s[0], s[1], l[0], l[1]); + }, e; + }(hr) +); +function K2(r, e, t, n) { + var i = r.getData(), a = i.getLayout("valueAxisHorizontal") ? 1 : 0, o = i.getLayout("largeDataIndices"), s = i.getLayout("size"), l = r.getModel("backgroundStyle"), u = i.getLayout("largeBackgroundPoints"); + if (u) { + var c = new J2({ + shape: { + points: u + }, + incremental: !!n, + silent: !0, + z2: 0 + }); + c.baseDimIdx = a, c.largeDataIndices = o, c.barWidth = s, c.useStyle(l.getItemStyle()), e.add(c), t && t.push(c); + } + var h = new J2({ + shape: { + points: i.getLayout("largePoints") + }, + incremental: !!n, + ignoreCoarsePointer: !0, + z2: 1 + }); + h.baseDimIdx = a, h.largeDataIndices = o, h.barWidth = s, e.add(h), h.useStyle(i.getVisual("style")), Ft(h).seriesIndex = r.seriesIndex, r.get("silent") || (h.on("mousedown", Q2), h.on("mousemove", Q2)), t && t.push(h); +} +var Q2 = Zh(function(r) { + var e = this, t = One(e, r.offsetX, r.offsetY); + Ft(e).dataIndex = t >= 0 ? t : null; +}, 30, !1); +function One(r, e, t) { + for (var n = r.baseDimIdx, i = 1 - n, a = r.shape.points, o = r.largeDataIndices, s = [], l = [], u = r.barWidth, c = 0, h = a.length / 3; c < h; c++) { + var f = c * 3; + if (l[n] = u, l[i] = a[f + 2], s[n] = a[f + n], s[i] = a[f + i], l[i] < 0 && (s[i] += l[i], l[i] = -l[i]), e >= s[0] && e <= s[0] + l[0] && t >= s[1] && t <= s[1] + l[1]) + return o[c]; + } + return -1; +} +function iH(r, e, t) { + if (lf(t, "cartesian2d")) { + var n = e, i = t.getArea(); + return { + x: r ? n.x : i.x, + y: r ? i.y : n.y, + width: r ? n.width : i.width, + height: r ? i.height : n.height + }; + } else { + var i = t.getArea(), a = e; + return { + cx: i.cx, + cy: i.cy, + r0: r ? i.r0 : a.r0, + r: r ? i.r : a.r, + startAngle: r ? a.startAngle : 0, + endAngle: r ? a.endAngle : Math.PI * 2 + }; + } +} +function Lne(r, e, t) { + var n = r.type === "polar" ? Oa : Or; + return new n({ + shape: iH(e, t, r), + silent: !0, + z2: 0 + }); +} +const Pne = Tne; +function Rne(r) { + r.registerChartView(Pne), r.registerSeriesModel(_ne), r.registerLayout(r.PRIORITY.VISUAL.LAYOUT, jt(J4, "bar")), r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, K4("bar")), r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC, tH("bar")), r.registerAction({ + type: "changeAxisOrder", + event: "changeAxisOrder", + update: "update" + }, function(e, t) { + var n = e.componentType || "series"; + t.eachComponent({ + mainType: n, + query: e + }, function(i) { + e.sortInfo && i.axis.setCategorySortInfo(e.sortInfo); + }); + }); +} +var n0 = Math.PI * 2, q2 = Math.PI / 180; +function aH(r, e) { + return yi(r.getBoxLayoutParams(), { + width: e.getWidth(), + height: e.getHeight() + }); +} +function oH(r, e) { + var t = aH(r, e), n = r.get("center"), i = r.get("radius"); + We(i) || (i = [0, i]); + var a = ot(t.width, e.getWidth()), o = ot(t.height, e.getHeight()), s = Math.min(a, o), l = ot(i[0], s / 2), u = ot(i[1], s / 2), c, h, f = r.coordinateSystem; + if (f) { + var v = f.dataToPoint(n); + c = v[0] || 0, h = v[1] || 0; + } else + We(n) || (n = [n, n]), c = ot(n[0], a) + t.x, h = ot(n[1], o) + t.y; + return { + cx: c, + cy: h, + r0: l, + r: u + }; +} +function Nne(r, e, t) { + e.eachSeriesByType(r, function(n) { + var i = n.getData(), a = i.mapDimension("value"), o = aH(n, t), s = oH(n, t), l = s.cx, u = s.cy, c = s.r, h = s.r0, f = -n.get("startAngle") * q2, v = n.get("minAngle") * q2, b = 0; + i.each(a, function(E) { + !isNaN(E) && b++; + }); + var w = i.getSum(a), p = Math.PI / (w || b) * 2, d = n.get("clockwise"), m = n.get("roseType"), _ = n.get("stillShowZeroSum"), y = i.getDataExtent(a); + y[0] = 0; + var x = n0, g = 0, S = f, T = d ? 1 : -1; + if (i.setLayout({ + viewRect: o, + r: c + }), i.each(a, function(E, M) { + var P; + if (isNaN(E)) { + i.setItemLayout(M, { + angle: NaN, + startAngle: NaN, + endAngle: NaN, + clockwise: d, + cx: l, + cy: u, + r0: h, + r: m ? NaN : c + }); + return; + } + m !== "area" ? P = w === 0 && _ ? p : E * p : P = n0 / b, P < v ? (P = v, x -= v) : g += E; + var R = S + T * P; + i.setItemLayout(M, { + angle: P, + startAngle: S, + endAngle: R, + clockwise: d, + cx: l, + cy: u, + r0: h, + r: m ? Zr(E, y, [h, c]) : c + }), S = R; + }), x < n0 && b) + if (x <= 1e-3) { + var C = n0 / b; + i.each(a, function(E, M) { + if (!isNaN(E)) { + var P = i.getItemLayout(M); + P.angle = C, P.startAngle = f + T * M * C, P.endAngle = f + T * (M + 1) * C; + } + }); + } else + p = x / g, S = f, i.each(a, function(E, M) { + if (!isNaN(E)) { + var P = i.getItemLayout(M), R = P.angle === v ? v : E * p; + P.startAngle = S, P.endAngle = S + T * R, S += T * R; + } + }); + }); +} +function fm(r) { + return { + seriesType: r, + reset: function(e, t) { + var n = t.findComponents({ + mainType: "legend" + }); + if (!(!n || !n.length)) { + var i = e.getData(); + i.filterSelf(function(a) { + for (var o = i.getName(a), s = 0; s < n.length; s++) + if (!n[s].isSelected(o)) + return !1; + return !0; + }); + } + } + }; +} +var zne = Math.PI / 180; +function eL(r, e, t, n, i, a, o, s, l, u) { + if (r.length < 2) + return; + function c(w) { + for (var p = w.rB, d = p * p, m = 0; m < w.list.length; m++) { + var _ = w.list[m], y = Math.abs(_.label.y - t), x = n + _.len, g = x * x, S = Math.sqrt((1 - Math.abs(y * y / d)) * g), T = e + (S + _.len2) * i, C = T - _.label.x, E = _.targetTextWidth - C * i; + sH(_, E, !0), _.label.x = T; + } + } + function h(w) { + for (var p = { + list: [], + maxY: 0 + }, d = { + list: [], + maxY: 0 + }, m = 0; m < w.length; m++) + if (w[m].labelAlignTo === "none") { + var _ = w[m], y = _.label.y > t ? d : p, x = Math.abs(_.label.y - t); + if (x >= y.maxY) { + var g = _.label.x - e - _.len2 * i, S = n + _.len, T = Math.abs(g) < S ? Math.sqrt(x * x / (1 - g * g / S / S)) : S; + y.rB = T, y.maxY = x; + } + y.list.push(_); + } + c(p), c(d); + } + for (var f = r.length, v = 0; v < f; v++) + if (r[v].position === "outer" && r[v].labelAlignTo === "labelLine") { + var b = r[v].label.x - u; + r[v].linePoints[1][0] += b, r[v].label.x = u; + } + M$(r, l, l + o) && h(r); +} +function Bne(r, e, t, n, i, a, o, s) { + for (var l = [], u = [], c = Number.MAX_VALUE, h = -Number.MAX_VALUE, f = 0; f < r.length; f++) { + var v = r[f].label; + _w(r[f]) || (v.x < e ? (c = Math.min(c, v.x), l.push(r[f])) : (h = Math.max(h, v.x), u.push(r[f]))); + } + for (var f = 0; f < r.length; f++) { + var b = r[f]; + if (!_w(b) && b.linePoints) { + if (b.labelStyleWidth != null) + continue; + var v = b.label, w = b.linePoints, p = void 0; + b.labelAlignTo === "edge" ? v.x < e ? p = w[2][0] - b.labelDistance - o - b.edgeDistance : p = o + i - b.edgeDistance - w[2][0] - b.labelDistance : b.labelAlignTo === "labelLine" ? v.x < e ? p = c - o - b.bleedMargin : p = o + i - h - b.bleedMargin : v.x < e ? p = v.x - o - b.bleedMargin : p = o + i - v.x - b.bleedMargin, b.targetTextWidth = p, sH(b, p); + } + } + eL(u, e, t, n, 1, i, a, o, s, h), eL(l, e, t, n, -1, i, a, o, s, c); + for (var f = 0; f < r.length; f++) { + var b = r[f]; + if (!_w(b) && b.linePoints) { + var v = b.label, w = b.linePoints, d = b.labelAlignTo === "edge", m = v.style.padding, _ = m ? m[1] + m[3] : 0, y = v.style.backgroundColor ? 0 : _, x = b.rect.width + y, g = w[1][0] - w[2][0]; + d ? v.x < e ? w[2][0] = o + b.edgeDistance + x + b.labelDistance : w[2][0] = o + i - b.edgeDistance - x - b.labelDistance : (v.x < e ? w[2][0] = v.x + b.labelDistance : w[2][0] = v.x - b.labelDistance, w[1][0] = w[2][0] + g), w[1][1] = w[2][1] = v.y; + } + } +} +function sH(r, e, t) { + if (t === void 0 && (t = !1), r.labelStyleWidth == null) { + var n = r.label, i = n.style, a = r.rect, o = i.backgroundColor, s = i.padding, l = s ? s[1] + s[3] : 0, u = i.overflow, c = a.width + (o ? 0 : l); + if (e < c || t) { + var h = a.height; + if (u && u.match("break")) { + n.setStyle("backgroundColor", null), n.setStyle("width", e - l); + var f = n.getBoundingRect(); + n.setStyle("width", Math.ceil(f.width)), n.setStyle("backgroundColor", o); + } else { + var v = e - l, b = e < c ? v : ( + // Current available width is enough, but the text may have + // already been wrapped with a smaller available width. + t ? v > r.unconstrainedWidth ? null : v : ( + // Current available width is enough, so no need to + // constrain. + null + ) + ); + n.setStyle("width", b); + } + var w = n.getBoundingRect(); + a.width = w.width; + var p = (n.style.margin || 0) + 2.1; + a.height = w.height + p, a.y -= (a.height - h) / 2; + } + } +} +function _w(r) { + return r.position === "center"; +} +function jne(r) { + var e = r.getData(), t = [], n, i, a = !1, o = (r.get("minShowLabelAngle") || 0) * zne, s = e.getLayout("viewRect"), l = e.getLayout("r"), u = s.width, c = s.x, h = s.y, f = s.height; + function v(g) { + g.ignore = !0; + } + function b(g) { + if (!g.ignore) + return !0; + for (var S in g.states) + if (g.states[S].ignore === !1) + return !0; + return !1; + } + e.each(function(g) { + var S = e.getItemGraphicEl(g), T = S.shape, C = S.getTextContent(), E = S.getTextGuideLine(), M = e.getItemModel(g), P = M.getModel("label"), R = P.get("position") || M.get(["emphasis", "label", "position"]), N = P.get("distanceToLabelLine"), F = P.get("alignTo"), U = ot(P.get("edgeDistance"), u), $ = P.get("bleedMargin"), G = M.getModel("labelLine"), Q = G.get("length"); + Q = ot(Q, u); + var ee = G.get("length2"); + if (ee = ot(ee, u), Math.abs(T.endAngle - T.startAngle) < o) { + X(C.states, v), C.ignore = !0, E && (X(E.states, v), E.ignore = !0); + return; + } + if (b(C)) { + var ce = (T.startAngle + T.endAngle) / 2, ne = Math.cos(ce), fe = Math.sin(ce), K, Oe, xe, Ge; + n = T.cx, i = T.cy; + var oe = R === "inside" || R === "inner"; + if (R === "center") + K = T.cx, Oe = T.cy, Ge = "center"; + else { + var de = (oe ? (T.r + T.r0) / 2 * ne : T.r * ne) + n, se = (oe ? (T.r + T.r0) / 2 * fe : T.r * fe) + i; + if (K = de + ne * 3, Oe = se + fe * 3, !oe) { + var te = de + ne * (Q + l - T.r), pe = se + fe * (Q + l - T.r), re = te + (ne < 0 ? -1 : 1) * ee, ae = pe; + F === "edge" ? K = ne < 0 ? c + U : c + u - U : K = re + (ne < 0 ? -N : N), Oe = ae, xe = [[de, se], [te, pe], [re, ae]]; + } + Ge = oe ? "center" : F === "edge" ? ne > 0 ? "right" : "left" : ne > 0 ? "left" : "right"; + } + var le = Math.PI, ue = 0, Ae = P.get("rotate"); + if (Pr(Ae)) + ue = Ae * (le / 180); + else if (R === "center") + ue = 0; + else if (Ae === "radial" || Ae === !0) { + var Te = ne < 0 ? -ce + le : -ce; + ue = Te; + } else if (Ae === "tangential" && R !== "outside" && R !== "outer") { + var Ne = Math.atan2(ne, fe); + Ne < 0 && (Ne = le * 2 + Ne); + var He = fe > 0; + He && (Ne = le + Ne), ue = Ne - le; + } + if (a = !!ue, C.x = K, C.y = Oe, C.rotation = ue, C.setStyle({ + verticalAlign: "middle" + }), oe) { + C.setStyle({ + align: Ge + }); + var ge = C.states.select; + ge && (ge.x += C.x, ge.y += C.y); + } else { + var je = C.getBoundingRect().clone(); + je.applyTransform(C.getComputedTransform()); + var be = (C.style.margin || 0) + 2.1; + je.y -= be / 2, je.height += be, t.push({ + label: C, + labelLine: E, + position: R, + len: Q, + len2: ee, + minTurnAngle: G.get("minTurnAngle"), + maxSurfaceAngle: G.get("maxSurfaceAngle"), + surfaceNormal: new Zt(ne, fe), + linePoints: xe, + textAlign: Ge, + labelDistance: N, + labelAlignTo: F, + edgeDistance: U, + bleedMargin: $, + rect: je, + unconstrainedWidth: je.width, + labelStyleWidth: C.style.width + }); + } + S.setTextConfig({ + inside: oe + }); + } + }), !a && r.get("avoidLabelOverlap") && Bne(t, n, i, l, u, f, c, h); + for (var w = 0; w < t.length; w++) { + var p = t[w], d = p.label, m = p.labelLine, _ = isNaN(d.x) || isNaN(d.y); + if (d) { + d.setStyle({ + align: p.textAlign + }), _ && (X(d.states, v), d.ignore = !0); + var y = d.states.select; + y && (y.x += d.x, y.y += d.y); + } + if (m) { + var x = p.linePoints; + _ || !x ? (X(m.states, v), m.ignore = !0) : (I$(x, p.minTurnAngle), ere(x, p.surfaceNormal, p.maxSurfaceAngle), m.setShape({ + points: x + }), d.__hostTarget.textGuideLineConfig = { + anchor: new Zt(x[0][0], x[0][1]) + }); + } + } +} +var Fne = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this) || this; + a.z2 = 2; + var o = new kr(); + return a.setTextContent(o), a.updateData(t, n, i, !0), a; + } + return e.prototype.updateData = function(t, n, i, a) { + var o = this, s = t.hostModel, l = t.getItemModel(n), u = l.getModel("emphasis"), c = t.getItemLayout(n), h = Fe(Oh(l.getModel("itemStyle"), c, !0), c); + if (isNaN(h.startAngle)) { + o.setShape(h); + return; + } + if (a) { + o.setShape(h); + var f = s.getShallow("animationType"); + s.ecModel.ssr ? (An(o, { + scaleX: 0, + scaleY: 0 + }, s, { + dataIndex: n, + isFrom: !0 + }), o.originX = h.cx, o.originY = h.cy) : f === "scale" ? (o.shape.r = c.r0, An(o, { + shape: { + r: c.r + } + }, s, n)) : i != null ? (o.setShape({ + startAngle: i, + endAngle: i + }), An(o, { + shape: { + startAngle: c.startAngle, + endAngle: c.endAngle + } + }, s, n)) : (o.shape.endAngle = c.startAngle, zr(o, { + shape: { + endAngle: c.endAngle + } + }, s, n)); + } else + Hs(o), zr(o, { + shape: h + }, s, n); + o.useStyle(t.getItemVisual(n, "style")), Xi(o, l); + var v = (c.startAngle + c.endAngle) / 2, b = s.get("selectedOffset"), w = Math.cos(v) * b, p = Math.sin(v) * b, d = l.getShallow("cursor"); + d && o.attr("cursor", d), this._updateLabel(s, t, n), o.ensureState("emphasis").shape = Fe({ + r: c.r + (u.get("scale") && u.get("scaleSize") || 0) + }, Oh(u.getModel("itemStyle"), c)), Fe(o.ensureState("select"), { + x: w, + y: p, + shape: Oh(l.getModel(["select", "itemStyle"]), c) + }), Fe(o.ensureState("blur"), { + shape: Oh(l.getModel(["blur", "itemStyle"]), c) + }); + var m = o.getTextGuideLine(), _ = o.getTextContent(); + m && Fe(m.ensureState("select"), { + x: w, + y: p + }), Fe(_.ensureState("select"), { + x: w, + y: p + }), Un(this, u.get("focus"), u.get("blurScope"), u.get("disabled")); + }, e.prototype._updateLabel = function(t, n, i) { + var a = this, o = n.getItemModel(i), s = o.getModel("labelLine"), l = n.getItemVisual(i, "style"), u = l && l.fill, c = l && l.opacity; + Zi(a, Mi(o), { + labelFetcher: n.hostModel, + labelDataIndex: i, + inheritColor: u, + defaultOpacity: c, + defaultText: t.getFormattedLabel(i, "normal") || n.getName(i) + }); + var h = a.getTextContent(); + a.setTextConfig({ + // reset position, rotation + position: null, + rotation: null + }), h.attr({ + z2: 10 + }); + var f = t.get(["label", "position"]); + if (f !== "outside" && f !== "outer") + a.removeTextGuideLine(); + else { + var v = this.getTextGuideLine(); + v || (v = new Pa(), this.setTextGuideLine(v)), UA(this, WA(o), { + stroke: u, + opacity: Ps(s.get(["lineStyle", "opacity"]), c, 1) + }); + } + }, e; + }(Oa) +), $ne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.ignoreLabelLineUpdate = !0, t; + } + return e.prototype.render = function(t, n, i, a) { + var o = t.getData(), s = this._data, l = this.group, u; + if (!s && o.count() > 0) { + for (var c = o.getItemLayout(0), h = 1; isNaN(c && c.startAngle) && h < o.count(); ++h) + c = o.getItemLayout(h); + c && (u = c.startAngle); + } + if (this._emptyCircleSector && l.remove(this._emptyCircleSector), o.count() === 0 && t.get("showEmptyCircle")) { + var f = new Oa({ + shape: oH(t, i) + }); + f.useStyle(t.getModel("emptyCircleStyle").getItemStyle()), this._emptyCircleSector = f, l.add(f); + } + o.diff(s).add(function(v) { + var b = new Fne(o, v, u); + o.setItemGraphicEl(v, b), l.add(b); + }).update(function(v, b) { + var w = s.getItemGraphicEl(b); + w.updateData(o, v, u), w.off("click"), l.add(w), o.setItemGraphicEl(v, w); + }).remove(function(v) { + var b = s.getItemGraphicEl(v); + mg(b, t, v); + }).execute(), jne(t), t.get("animationTypeUpdate") !== "expansion" && (this._data = o); + }, e.prototype.dispose = function() { + }, e.prototype.containPoint = function(t, n) { + var i = n.getData(), a = i.getItemLayout(0); + if (a) { + var o = t[0] - a.cx, s = t[1] - a.cy, l = Math.sqrt(o * o + s * s); + return l <= a.r && l >= a.r0; + } + }, e.type = "pie", e; + }(en) +); +const Hne = $ne; +function hv(r, e, t) { + e = We(e) && { + coordDimensions: e + } || Fe({ + encodeDefine: r.getEncode() + }, e); + var n = r.getSource(), i = uv(n, e).dimensions, a = new Ui(i, r); + return a.initData(n, t), a; +} +var Vne = ( + /** @class */ + function() { + function r(e, t) { + this._getDataWithEncodedVisual = e, this._getRawData = t; + } + return r.prototype.getAllNames = function() { + var e = this._getRawData(); + return e.mapArray(e.getName); + }, r.prototype.containName = function(e) { + var t = this._getRawData(); + return t.indexOfName(e) >= 0; + }, r.prototype.indexOfName = function(e) { + var t = this._getDataWithEncodedVisual(); + return t.indexOfName(e); + }, r.prototype.getItemVisual = function(e, t) { + var n = this._getDataWithEncodedVisual(); + return n.getItemVisual(e, t); + }, r; + }() +); +const dm = Vne; +var Gne = Rr(), Une = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.init = function(t) { + r.prototype.init.apply(this, arguments), this.legendVisualProvider = new dm(ft(this.getData, this), ft(this.getRawData, this)), this._defaultLabelLine(t); + }, e.prototype.mergeOption = function() { + r.prototype.mergeOption.apply(this, arguments); + }, e.prototype.getInitialData = function() { + return hv(this, { + coordDimensions: ["value"], + encodeDefaulter: jt(fA, this) + }); + }, e.prototype.getDataParams = function(t) { + var n = this.getData(), i = Gne(n), a = i.seats; + if (!a) { + var o = []; + n.each(n.mapDimension("value"), function(l) { + o.push(l); + }), a = i.seats = Jj(o, n.hostModel.get("percentPrecision")); + } + var s = r.prototype.getDataParams.call(this, t); + return s.percent = a[t] || 0, s.$vars.push("percent"), s; + }, e.prototype._defaultLabelLine = function(t) { + Gh(t, "labelLine", ["show"]); + var n = t.labelLine, i = t.emphasis.labelLine; + n.show = n.show && t.label.show, i.show = i.show && t.emphasis.label.show; + }, e.type = "series.pie", e.defaultOption = { + // zlevel: 0, + z: 2, + legendHoverLink: !0, + colorBy: "data", + // 默认全局居中 + center: ["50%", "50%"], + radius: [0, "75%"], + // 默认顺时针 + clockwise: !0, + startAngle: 90, + // 最小角度改为0 + minAngle: 0, + // If the angle of a sector less than `minShowLabelAngle`, + // the label will not be displayed. + minShowLabelAngle: 0, + // 选中时扇区偏移量 + selectedOffset: 10, + // 选择模式,默认关闭,可选single,multiple + // selectedMode: false, + // 南丁格尔玫瑰图模式,'radius'(半径) | 'area'(面积) + // roseType: null, + percentPrecision: 2, + // If still show when all data zero. + stillShowZeroSum: !0, + // cursor: null, + left: 0, + top: 0, + right: 0, + bottom: 0, + width: null, + height: null, + label: { + // color: 'inherit', + // If rotate around circle + rotate: 0, + show: !0, + overflow: "truncate", + // 'outer', 'inside', 'center' + position: "outer", + // 'none', 'labelLine', 'edge'. Works only when position is 'outer' + alignTo: "none", + // Closest distance between label and chart edge. + // Works only position is 'outer' and alignTo is 'edge'. + edgeDistance: "25%", + // Works only position is 'outer' and alignTo is not 'edge'. + bleedMargin: 10, + // Distance between text and label line. + distanceToLabelLine: 5 + // formatter: 标签文本格式器,同 tooltip.formatter,不支持异步回调 + // 默认使用全局文本样式,详见 textStyle + // distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数 + }, + // Enabled when label.normal.position is 'outer' + labelLine: { + show: !0, + // 引导线两段中的第一段长度 + length: 15, + // 引导线两段中的第二段长度 + length2: 15, + smooth: !1, + minTurnAngle: 90, + maxSurfaceAngle: 90, + lineStyle: { + // color: 各异, + width: 1, + type: "solid" + } + }, + itemStyle: { + borderWidth: 1, + borderJoin: "round" + }, + showEmptyCircle: !0, + emptyCircleStyle: { + color: "lightgray", + opacity: 1 + }, + labelLayout: { + // Hide the overlapped label. + hideOverlap: !0 + }, + emphasis: { + scale: !0, + scaleSize: 5 + }, + // If use strategy to avoid label overlapping + avoidLabelOverlap: !0, + // Animation type. Valid values: expansion, scale + animationType: "expansion", + animationDuration: 1e3, + // Animation type when update. Valid values: transition, expansion + animationTypeUpdate: "transition", + animationEasingUpdate: "cubicInOut", + animationDurationUpdate: 500, + animationEasing: "cubicInOut" + }, e; + }(mn) +); +const Wne = Une; +function Yne(r) { + return { + seriesType: r, + reset: function(e, t) { + var n = e.getData(); + n.filterSelf(function(i) { + var a = n.mapDimension("value"), o = n.get(a, i); + return !(Pr(o) && !isNaN(o) && o < 0); + }); + } + }; +} +function Xne(r) { + r.registerChartView(Hne), r.registerSeriesModel(Wne), u4("pie", r.registerAction), r.registerLayout(jt(Nne, "pie")), r.registerProcessor(fm("pie")), r.registerProcessor(Yne("pie")); +} +var Zne = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t; + } + return e.prototype.getInitialData = function(t, n) { + return Dl(null, this, { + useEncodeDefaulter: !0 + }); + }, e.prototype.getProgressive = function() { + var t = this.option.progressive; + return t == null ? this.option.large ? 5e3 : this.get("progressive") : t; + }, e.prototype.getProgressiveThreshold = function() { + var t = this.option.progressiveThreshold; + return t == null ? this.option.large ? 1e4 : this.get("progressiveThreshold") : t; + }, e.prototype.brushSelector = function(t, n, i) { + return i.point(n.getItemLayout(t)); + }, e.prototype.getZLevelKey = function() { + return this.getData().count() > this.getProgressiveThreshold() ? this.id : ""; + }, e.type = "series.scatter", e.dependencies = ["grid", "polar", "geo", "singleAxis", "calendar"], e.defaultOption = { + coordinateSystem: "cartesian2d", + // zlevel: 0, + z: 2, + legendHoverLink: !0, + symbolSize: 10, + // symbolRotate: null, // 图形旋转控制 + large: !1, + // Available when large is true + largeThreshold: 2e3, + // cursor: null, + itemStyle: { + opacity: 0.8 + // color: 各异 + }, + emphasis: { + scale: !0 + }, + // If clip the overflow graphics + // Works on cartesian / polar series + clip: !0, + select: { + itemStyle: { + borderColor: "#212121" + } + }, + universalTransition: { + divideShape: "clone" + } + // progressive: null + }, e; + }(mn) +); +const Jne = Zne; +var lH = 4, Kne = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), Qne = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n._off = 0, n.hoverDataIdx = -1, n; + } + return e.prototype.getDefaultShape = function() { + return new Kne(); + }, e.prototype.reset = function() { + this.notClear = !1, this._off = 0; + }, e.prototype.buildPath = function(t, n) { + var i = n.points, a = n.size, o = this.symbolProxy, s = o.shape, l = t.getContext ? t.getContext() : t, u = l && a[0] < lH, c = this.softClipShape, h; + if (u) { + this._ctx = l; + return; + } + for (this._ctx = null, h = this._off; h < i.length; ) { + var f = i[h++], v = i[h++]; + isNaN(f) || isNaN(v) || c && !c.contain(f, v) || (s.x = f - a[0] / 2, s.y = v - a[1] / 2, s.width = a[0], s.height = a[1], o.buildPath(t, s, !0)); + } + this.incremental && (this._off = h, this.notClear = !0); + }, e.prototype.afterBrush = function() { + var t = this.shape, n = t.points, i = t.size, a = this._ctx, o = this.softClipShape, s; + if (a) { + for (s = this._off; s < n.length; ) { + var l = n[s++], u = n[s++]; + isNaN(l) || isNaN(u) || o && !o.contain(l, u) || a.fillRect(l - i[0] / 2, u - i[1] / 2, i[0], i[1]); + } + this.incremental && (this._off = s, this.notClear = !0); + } + }, e.prototype.findDataIndex = function(t, n) { + for (var i = this.shape, a = i.points, o = i.size, s = Math.max(o[0], 4), l = Math.max(o[1], 4), u = a.length / 2 - 1; u >= 0; u--) { + var c = u * 2, h = a[c] - s / 2, f = a[c + 1] - l / 2; + if (t >= h && n >= f && t <= h + s && n <= f + l) + return u; + } + return -1; + }, e.prototype.contain = function(t, n) { + var i = this.transformCoordToLocal(t, n), a = this.getBoundingRect(); + if (t = i[0], n = i[1], a.contain(t, n)) { + var o = this.hoverDataIdx = this.findDataIndex(t, n); + return o >= 0; + } + return this.hoverDataIdx = -1, !1; + }, e.prototype.getBoundingRect = function() { + var t = this._rect; + if (!t) { + for (var n = this.shape, i = n.points, a = n.size, o = a[0], s = a[1], l = 1 / 0, u = 1 / 0, c = -1 / 0, h = -1 / 0, f = 0; f < i.length; ) { + var v = i[f++], b = i[f++]; + l = Math.min(v, l), c = Math.max(v, c), u = Math.min(b, u), h = Math.max(b, h); + } + t = this._rect = new Wt(l - o / 2, u - s / 2, c - l + o, h - u + s); + } + return t; + }, e; + }(hr) +), qne = ( + /** @class */ + function() { + function r() { + this.group = new Rt(); + } + return r.prototype.updateData = function(e, t) { + this._clear(); + var n = this._create(); + n.setShape({ + points: e.getLayout("points") + }), this._setCommon(n, e, t); + }, r.prototype.updateLayout = function(e) { + var t = e.getLayout("points"); + this.group.eachChild(function(n) { + if (n.startIndex != null) { + var i = (n.endIndex - n.startIndex) * 2, a = n.startIndex * 4 * 2; + t = new Float32Array(t.buffer, a, i); + } + n.setShape("points", t), n.reset(); + }); + }, r.prototype.incrementalPrepareUpdate = function(e) { + this._clear(); + }, r.prototype.incrementalUpdate = function(e, t, n) { + var i = this._newAdded[0], a = t.getLayout("points"), o = i && i.shape.points; + if (o && o.length < 2e4) { + var s = o.length, l = new Float32Array(s + a.length); + l.set(o), l.set(a, s), i.endIndex = e.end, i.setShape({ + points: l + }); + } else { + this._newAdded = []; + var u = this._create(); + u.startIndex = e.start, u.endIndex = e.end, u.incremental = !0, u.setShape({ + points: a + }), this._setCommon(u, t, n); + } + }, r.prototype.eachRendered = function(e) { + this._newAdded[0] && e(this._newAdded[0]); + }, r.prototype._create = function() { + var e = new Qne({ + cursor: "default" + }); + return e.ignoreCoarsePointer = !0, this.group.add(e), this._newAdded.push(e), e; + }, r.prototype._setCommon = function(e, t, n) { + var i = t.hostModel; + n = n || {}; + var a = t.getVisual("symbolSize"); + e.setShape("size", a instanceof Array ? a : [a, a]), e.softClipShape = n.clipShape || null, e.symbolProxy = li(t.getVisual("symbol"), 0, 0, 0, 0), e.setColor = e.symbolProxy.setColor; + var o = e.shape.size[0] < lH; + e.useStyle( + // Draw shadow when doing fillRect is extremely slow. + i.getModel("itemStyle").getItemStyle(o ? ["color", "shadowBlur", "shadowColor"] : ["color"]) + ); + var s = t.getVisual("style"), l = s && s.fill; + l && e.setColor(l); + var u = Ft(e); + u.seriesIndex = i.seriesIndex, e.on("mousemove", function(c) { + u.dataIndex = null; + var h = e.hoverDataIdx; + h >= 0 && (u.dataIndex = h + (e.startIndex || 0)); + }); + }, r.prototype.remove = function() { + this._clear(); + }, r.prototype._clear = function() { + this._newAdded = [], this.group.removeAll(); + }, r; + }() +); +const eie = qne; +var tie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this._updateSymbolDraw(a, t); + o.updateData(a, { + // TODO + // If this parameter should be a shape or a bounding volume + // shape will be more general. + // But bounding volume like bounding rect will be much faster in the contain calculation + clipShape: this._getClipShape(t) + }), this._finished = !0; + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + var a = t.getData(), o = this._updateSymbolDraw(a, t); + o.incrementalPrepareUpdate(a), this._finished = !1; + }, e.prototype.incrementalRender = function(t, n, i) { + this._symbolDraw.incrementalUpdate(t, n.getData(), { + clipShape: this._getClipShape(n) + }), this._finished = t.end === n.getData().count(); + }, e.prototype.updateTransform = function(t, n, i) { + var a = t.getData(); + if (this.group.dirty(), !this._finished || a.count() > 1e4) + return { + update: !0 + }; + var o = hm("").reset(t, n, i); + o.progress && o.progress({ + start: 0, + end: a.count(), + count: a.count() + }, a), this._symbolDraw.updateLayout(a); + }, e.prototype.eachRendered = function(t) { + this._symbolDraw && this._symbolDraw.eachRendered(t); + }, e.prototype._getClipShape = function(t) { + var n = t.coordinateSystem, i = n && n.getArea && n.getArea(); + return t.get("clip", !0) ? i : null; + }, e.prototype._updateSymbolDraw = function(t, n) { + var i = this._symbolDraw, a = n.pipelineContext, o = a.large; + return (!i || o !== this._isLargeDraw) && (i && i.remove(), i = this._symbolDraw = o ? new eie() : new cm(), this._isLargeDraw = o, this.group.removeAll()), this.group.add(i.group), i; + }, e.prototype.remove = function(t, n) { + this._symbolDraw && this._symbolDraw.remove(!0), this._symbolDraw = null; + }, e.prototype.dispose = function() { + }, e.type = "scatter", e; + }(en) +); +const rie = tie; +var nie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.type = "grid", e.dependencies = ["xAxis", "yAxis"], e.layoutMode = "box", e.defaultOption = { + show: !1, + // zlevel: 0, + z: 0, + left: "10%", + top: 60, + right: "10%", + bottom: 70, + // If grid size contain label + containLabel: !1, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + backgroundColor: "rgba(0,0,0,0)", + borderWidth: 1, + borderColor: "#ccc" + }, e; + }(xr) +); +const iie = nie; +var lT = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.getCoordSysModel = function() { + return this.getReferringComponents("grid", mi).models[0]; + }, e.type = "cartesian2dAxis", e; + }(xr) +); +qn(lT, cv); +var uH = { + show: !0, + // zlevel: 0, + z: 0, + // Inverse the axis. + inverse: !1, + // Axis name displayed. + name: "", + // 'start' | 'middle' | 'end' + nameLocation: "end", + // By degree. By default auto rotate by nameLocation. + nameRotate: null, + nameTruncate: { + maxWidth: null, + ellipsis: "...", + placeholder: "." + }, + // Use global text style by default. + nameTextStyle: {}, + // The gap between axisName and axisLine. + nameGap: 15, + // Default `false` to support tooltip. + silent: !1, + // Default `false` to avoid legacy user event listener fail. + triggerEvent: !1, + tooltip: { + show: !1 + }, + axisPointer: {}, + axisLine: { + show: !0, + onZero: !0, + onZeroAxisIndex: null, + lineStyle: { + color: "#6E7079", + width: 1, + type: "solid" + }, + // The arrow at both ends the the axis. + symbol: ["none", "none"], + symbolSize: [10, 15] + }, + axisTick: { + show: !0, + // Whether axisTick is inside the grid or outside the grid. + inside: !1, + // The length of axisTick. + length: 5, + lineStyle: { + width: 1 + } + }, + axisLabel: { + show: !0, + // Whether axisLabel is inside the grid or outside the grid. + inside: !1, + rotate: 0, + // true | false | null/undefined (auto) + showMinLabel: null, + // true | false | null/undefined (auto) + showMaxLabel: null, + margin: 8, + // formatter: null, + fontSize: 12 + }, + splitLine: { + show: !0, + lineStyle: { + color: ["#E0E6F1"], + width: 1, + type: "solid" + } + }, + splitArea: { + show: !1, + areaStyle: { + color: ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"] + } + } +}, aie = Ut({ + // The gap at both ends of the axis. For categoryAxis, boolean. + boundaryGap: !0, + // Set false to faster category collection. + deduplication: null, + // splitArea: { + // show: false + // }, + splitLine: { + show: !1 + }, + axisTick: { + // If tick is align with label when boundaryGap is true + alignWithLabel: !1, + interval: "auto" + }, + axisLabel: { + interval: "auto" + } +}, uH), KA = Ut({ + boundaryGap: [0, 0], + axisLine: { + // Not shown when other axis is categoryAxis in cartesian + show: "auto" + }, + axisTick: { + // Not shown when other axis is categoryAxis in cartesian + show: "auto" + }, + // TODO + // min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60] + splitNumber: 5, + minorTick: { + // Minor tick, not available for cateogry axis. + show: !1, + // Split number of minor ticks. The value should be in range of (0, 100) + splitNumber: 5, + // Length of minor tick + length: 3, + // Line style + lineStyle: { + // Default to be same with axisTick + } + }, + minorSplitLine: { + show: !1, + lineStyle: { + color: "#F4F7FD", + width: 1 + } + } +}, uH), oie = Ut({ + splitNumber: 6, + axisLabel: { + // To eliminate labels that are not nice + showMinLabel: !1, + showMaxLabel: !1, + rich: { + primary: { + fontWeight: "bold" + } + } + }, + splitLine: { + show: !1 + } +}, KA), sie = Mt({ + logBase: 10 +}, KA); +const cH = { + category: aie, + value: KA, + time: oie, + log: sie +}; +var lie = { + value: 1, + category: 1, + time: 1, + log: 1 +}; +function Bd(r, e, t, n) { + X(lie, function(i, a) { + var o = Ut(Ut({}, cH[a], !0), n, !0), s = ( + /** @class */ + function(l) { + Pe(u, l); + function u() { + var c = l !== null && l.apply(this, arguments) || this; + return c.type = e + "Axis." + a, c; + } + return u.prototype.mergeDefaultAndTheme = function(c, h) { + var f = bg(this), v = f ? rv(c) : {}, b = h.getTheme(); + Ut(c, b.get(a + "Axis")), Ut(c, this.getDefaultOption()), c.type = tL(c), f && vc(c, v, f); + }, u.prototype.optionUpdated = function() { + var c = this.option; + c.type === "category" && (this.__ordinalMeta = tT.createByAxisModel(this)); + }, u.prototype.getCategories = function(c) { + var h = this.option; + if (h.type === "category") + return c ? h.data : this.__ordinalMeta.categories; + }, u.prototype.getOrdinalMeta = function() { + return this.__ordinalMeta; + }, u.type = e + "Axis." + a, u.defaultOption = o, u; + }(t) + ); + r.registerComponentModel(s); + }), r.registerSubTypeDefaulter(e + "Axis", tL); +} +function tL(r) { + return r.type || (r.data ? "category" : "value"); +} +var uie = ( + /** @class */ + function() { + function r(e) { + this.type = "cartesian", this._dimList = [], this._axes = {}, this.name = e || ""; + } + return r.prototype.getAxis = function(e) { + return this._axes[e]; + }, r.prototype.getAxes = function() { + return Ke(this._dimList, function(e) { + return this._axes[e]; + }, this); + }, r.prototype.getAxesByScale = function(e) { + return e = e.toLowerCase(), Jr(this.getAxes(), function(t) { + return t.scale.type === e; + }); + }, r.prototype.addAxis = function(e) { + var t = e.dim; + this._axes[t] = e, this._dimList.push(t); + }, r; + }() +); +const cie = uie; +var uT = ["x", "y"]; +function rL(r) { + return r.type === "interval" || r.type === "time"; +} +var hie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "cartesian2d", t.dimensions = uT, t; + } + return e.prototype.calcAffineTransform = function() { + this._transform = this._invTransform = null; + var t = this.getAxis("x").scale, n = this.getAxis("y").scale; + if (!(!rL(t) || !rL(n))) { + var i = t.getExtent(), a = n.getExtent(), o = this.dataToPoint([i[0], a[0]]), s = this.dataToPoint([i[1], a[1]]), l = i[1] - i[0], u = a[1] - a[0]; + if (!(!l || !u)) { + var c = (s[0] - o[0]) / l, h = (s[1] - o[1]) / u, f = o[0] - i[0] * c, v = o[1] - a[0] * h, b = this._transform = [c, 0, 0, h, f, v]; + this._invTransform = nf([], b); + } + } + }, e.prototype.getBaseAxis = function() { + return this.getAxesByScale("ordinal")[0] || this.getAxesByScale("time")[0] || this.getAxis("x"); + }, e.prototype.containPoint = function(t) { + var n = this.getAxis("x"), i = this.getAxis("y"); + return n.contain(n.toLocalCoord(t[0])) && i.contain(i.toLocalCoord(t[1])); + }, e.prototype.containData = function(t) { + return this.getAxis("x").containData(t[0]) && this.getAxis("y").containData(t[1]); + }, e.prototype.containZone = function(t, n) { + var i = this.dataToPoint(t), a = this.dataToPoint(n), o = this.getArea(), s = new Wt(i[0], i[1], a[0] - i[0], a[1] - i[1]); + return o.intersect(s); + }, e.prototype.dataToPoint = function(t, n, i) { + i = i || []; + var a = t[0], o = t[1]; + if (this._transform && a != null && isFinite(a) && o != null && isFinite(o)) + return zi(i, t, this._transform); + var s = this.getAxis("x"), l = this.getAxis("y"); + return i[0] = s.toGlobalCoord(s.dataToCoord(a, n)), i[1] = l.toGlobalCoord(l.dataToCoord(o, n)), i; + }, e.prototype.clampData = function(t, n) { + var i = this.getAxis("x").scale, a = this.getAxis("y").scale, o = i.getExtent(), s = a.getExtent(), l = i.parse(t[0]), u = a.parse(t[1]); + return n = n || [], n[0] = Math.min(Math.max(Math.min(o[0], o[1]), l), Math.max(o[0], o[1])), n[1] = Math.min(Math.max(Math.min(s[0], s[1]), u), Math.max(s[0], s[1])), n; + }, e.prototype.pointToData = function(t, n) { + var i = []; + if (this._invTransform) + return zi(i, t, this._invTransform); + var a = this.getAxis("x"), o = this.getAxis("y"); + return i[0] = a.coordToData(a.toLocalCoord(t[0]), n), i[1] = o.coordToData(o.toLocalCoord(t[1]), n), i; + }, e.prototype.getOtherAxis = function(t) { + return this.getAxis(t.dim === "x" ? "y" : "x"); + }, e.prototype.getArea = function() { + var t = this.getAxis("x").getGlobalExtent(), n = this.getAxis("y").getGlobalExtent(), i = Math.min(t[0], t[1]), a = Math.min(n[0], n[1]), o = Math.max(t[0], t[1]) - i, s = Math.max(n[0], n[1]) - a; + return new Wt(i, a, o, s); + }, e; + }(cie) +), fie = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a, o) { + var s = r.call(this, t, n, i) || this; + return s.index = 0, s.type = a || "value", s.position = o || "bottom", s; + } + return e.prototype.isHorizontal = function() { + var t = this.position; + return t === "top" || t === "bottom"; + }, e.prototype.getGlobalExtent = function(t) { + var n = this.getExtent(); + return n[0] = this.toGlobalCoord(n[0]), n[1] = this.toGlobalCoord(n[1]), t && n[0] > n[1] && n.reverse(), n; + }, e.prototype.pointToData = function(t, n) { + return this.coordToData(this.toLocalCoord(t[this.dim === "x" ? 0 : 1]), n); + }, e.prototype.setCategorySortInfo = function(t) { + if (this.type !== "category") + return !1; + this.model.option.categorySortInfo = t, this.scale.setSortInfo(t); + }, e; + }(wo) +); +const die = fie; +function cT(r, e, t) { + t = t || {}; + var n = r.coordinateSystem, i = e.axis, a = {}, o = i.getAxesOnZeroOf()[0], s = i.position, l = o ? "onZero" : s, u = i.dim, c = n.getRect(), h = [c.x, c.x + c.width, c.y, c.y + c.height], f = { + left: 0, + right: 1, + top: 0, + bottom: 1, + onZero: 2 + }, v = e.get("offset") || 0, b = u === "x" ? [h[2] - v, h[3] + v] : [h[0] - v, h[1] + v]; + if (o) { + var w = o.toGlobalCoord(o.dataToCoord(0)); + b[f.onZero] = Math.max(Math.min(w, b[1]), b[0]); + } + a.position = [u === "y" ? b[f[l]] : h[0], u === "x" ? b[f[l]] : h[3]], a.rotation = Math.PI / 2 * (u === "x" ? 0 : 1); + var p = { + top: -1, + bottom: 1, + left: -1, + right: 1 + }; + a.labelDirection = a.tickDirection = a.nameDirection = p[s], a.labelOffset = o ? b[f[s]] - b[f.onZero] : 0, e.get(["axisTick", "inside"]) && (a.tickDirection = -a.tickDirection), Ii(t.labelInside, e.get(["axisLabel", "inside"])) && (a.labelDirection = -a.labelDirection); + var d = e.get(["axisLabel", "rotate"]); + return a.labelRotate = l === "top" ? -d : d, a.z2 = 1, a; +} +function nL(r) { + return r.get("coordinateSystem") === "cartesian2d"; +} +function iL(r) { + var e = { + xAxisModel: null, + yAxisModel: null + }; + return X(e, function(t, n) { + var i = n.replace(/Model$/, ""), a = r.getReferringComponents(i, mi).models[0]; + e[n] = a; + }), e; +} +var bw = Math.log; +function hH(r, e, t) { + var n = pc.prototype, i = n.getTicks.call(t), a = n.getTicks.call(t, !0), o = i.length - 1, s = n.getInterval.call(t), l = i$(r, e), u = l.extent, c = l.fixMin, h = l.fixMax; + if (r.type === "log") { + var f = bw(r.base); + u = [bw(u[0]) / f, bw(u[1]) / f]; + } + r.setExtent(u[0], u[1]), r.calcNiceExtent({ + splitNumber: o, + fixMin: c, + fixMax: h + }); + var v = n.getExtent.call(r); + c && (u[0] = v[0]), h && (u[1] = v[1]); + var b = n.getInterval.call(r), w = u[0], p = u[1]; + if (c && h) + b = (p - w) / o; + else if (c) + for (p = u[0] + b * o; p < u[1] && isFinite(p) && isFinite(u[1]); ) + b = ow(b), p = u[0] + b * o; + else if (h) + for (w = u[1] - b * o; w > u[0] && isFinite(w) && isFinite(u[0]); ) + b = ow(b), w = u[1] - b * o; + else { + var d = r.getTicks().length - 1; + d > o && (b = ow(b)); + var m = b * o; + p = Math.ceil(u[1] / b) * b, w = Vn(p - m), w < 0 && u[0] >= 0 ? (w = 0, p = Vn(m)) : p > 0 && u[1] <= 0 && (p = 0, w = -Vn(m)); + } + var _ = (i[0].value - a[0].value) / s, y = (i[o].value - a[o].value) / s; + n.setExtent.call(r, w + b * _, p + b * y), n.setInterval.call(r, b), (_ || y) && n.setNiceExtent.call(r, w + b, p - b); +} +var vie = ( + /** @class */ + function() { + function r(e, t, n) { + this.type = "grid", this._coordsMap = {}, this._coordsList = [], this._axesMap = {}, this._axesList = [], this.axisPointerEnabled = !0, this.dimensions = uT, this._initCartesian(e, t, n), this.model = e; + } + return r.prototype.getRect = function() { + return this._rect; + }, r.prototype.update = function(e, t) { + var n = this._axesMap; + this._updateScale(e, this.model); + function i(o) { + var s, l = yr(o), u = l.length; + if (u) { + for (var c = [], h = u - 1; h >= 0; h--) { + var f = +l[h], v = o[f], b = v.model, w = v.scale; + // Only value and log axis without interval support alignTicks. + rT(w) && b.get("alignTicks") && b.get("interval") == null ? c.push(v) : (Jh(w, b), rT(w) && (s = v)); + } + c.length && (s || (s = c.pop(), Jh(s.scale, s.model)), X(c, function(p) { + hH(p.scale, p.model, s.scale); + })); + } + } + i(n.x), i(n.y); + var a = {}; + X(n.x, function(o) { + aL(n, "y", o, a); + }), X(n.y, function(o) { + aL(n, "x", o, a); + }), this.resize(this.model, t); + }, r.prototype.resize = function(e, t, n) { + var i = e.getBoxLayoutParams(), a = !n && e.get("containLabel"), o = yi(i, { + width: t.getWidth(), + height: t.getHeight() + }); + this._rect = o; + var s = this._axesList; + l(), a && (X(s, function(u) { + if (!u.model.get(["axisLabel", "inside"])) { + var c = Ite(u); + if (c) { + var h = u.isHorizontal() ? "height" : "width", f = u.model.get(["axisLabel", "margin"]); + o[h] -= c[h] + f, u.position === "top" ? o.y += c.height + f : u.position === "left" && (o.x += c.width + f); + } + } + }), l()), X(this._coordsList, function(u) { + u.calcAffineTransform(); + }); + function l() { + X(s, function(u) { + var c = u.isHorizontal(), h = c ? [0, o.width] : [0, o.height], f = u.inverse ? 1 : 0; + u.setExtent(h[f], h[1 - f]), pie(u, c ? o.x : o.y); + }); + } + }, r.prototype.getAxis = function(e, t) { + var n = this._axesMap[e]; + if (n != null) + return n[t || 0]; + }, r.prototype.getAxes = function() { + return this._axesList.slice(); + }, r.prototype.getCartesian = function(e, t) { + if (e != null && t != null) { + var n = "x" + e + "y" + t; + return this._coordsMap[n]; + } + kt(e) && (t = e.yAxisIndex, e = e.xAxisIndex); + for (var i = 0, a = this._coordsList; i < a.length; i++) + if (a[i].getAxis("x").index === e || a[i].getAxis("y").index === t) + return a[i]; + }, r.prototype.getCartesians = function() { + return this._coordsList.slice(); + }, r.prototype.convertToPixel = function(e, t, n) { + var i = this._findConvertTarget(t); + return i.cartesian ? i.cartesian.dataToPoint(n) : i.axis ? i.axis.toGlobalCoord(i.axis.dataToCoord(n)) : null; + }, r.prototype.convertFromPixel = function(e, t, n) { + var i = this._findConvertTarget(t); + return i.cartesian ? i.cartesian.pointToData(n) : i.axis ? i.axis.coordToData(i.axis.toLocalCoord(n)) : null; + }, r.prototype._findConvertTarget = function(e) { + var t = e.seriesModel, n = e.xAxisModel || t && t.getReferringComponents("xAxis", mi).models[0], i = e.yAxisModel || t && t.getReferringComponents("yAxis", mi).models[0], a = e.gridModel, o = this._coordsList, s, l; + if (t) + s = t.coordinateSystem, ir(o, s) < 0 && (s = null); + else if (n && i) + s = this.getCartesian(n.componentIndex, i.componentIndex); + else if (n) + l = this.getAxis("x", n.componentIndex); + else if (i) + l = this.getAxis("y", i.componentIndex); + else if (a) { + var u = a.coordinateSystem; + u === this && (s = this._coordsList[0]); + } + return { + cartesian: s, + axis: l + }; + }, r.prototype.containPoint = function(e) { + var t = this._coordsList[0]; + if (t) + return t.containPoint(e); + }, r.prototype._initCartesian = function(e, t, n) { + var i = this, a = this, o = { + left: !1, + right: !1, + top: !1, + bottom: !1 + }, s = { + x: {}, + y: {} + }, l = { + x: 0, + y: 0 + }; + if (t.eachComponent("xAxis", u("x"), this), t.eachComponent("yAxis", u("y"), this), !l.x || !l.y) { + this._axesMap = {}, this._axesList = []; + return; + } + this._axesMap = s, X(s.x, function(c, h) { + X(s.y, function(f, v) { + var b = "x" + h + "y" + v, w = new hie(b); + w.master = i, w.model = e, i._coordsMap[b] = w, i._coordsList.push(w), w.addAxis(c), w.addAxis(f); + }); + }); + function u(c) { + return function(h, f) { + if (xw(h, e)) { + var v = h.get("position"); + c === "x" ? v !== "top" && v !== "bottom" && (v = o.bottom ? "top" : "bottom") : v !== "left" && v !== "right" && (v = o.left ? "right" : "left"), o[v] = !0; + var b = new die(c, sm(h), [0, 0], h.get("type"), v), w = b.type === "category"; + b.onBand = w && h.get("boundaryGap"), b.inverse = h.get("inverse"), h.axis = b, b.model = h, b.grid = a, b.index = f, a._axesList.push(b), s[c][f] = b, l[c]++; + } + }; + } + }, r.prototype._updateScale = function(e, t) { + X(this._axesList, function(i) { + if (i.scale.setExtent(1 / 0, -1 / 0), i.type === "category") { + var a = i.model.get("categorySortInfo"); + i.scale.setSortInfo(a); + } + }), e.eachSeries(function(i) { + if (nL(i)) { + var a = iL(i), o = a.xAxisModel, s = a.yAxisModel; + if (!xw(o, t) || !xw(s, t)) + return; + var l = this.getCartesian(o.componentIndex, s.componentIndex), u = i.getData(), c = l.getAxis("x"), h = l.getAxis("y"); + n(u, c), n(u, h); + } + }, this); + function n(i, a) { + X(P_(i, a.dim), function(o) { + a.scale.unionExtentFromData(i, o); + }); + } + }, r.prototype.getTooltipAxes = function(e) { + var t = [], n = []; + return X(this.getCartesians(), function(i) { + var a = e != null && e !== "auto" ? i.getAxis(e) : i.getBaseAxis(), o = i.getOtherAxis(a); + ir(t, a) < 0 && t.push(a), ir(n, o) < 0 && n.push(o); + }), { + baseAxes: t, + otherAxes: n + }; + }, r.create = function(e, t) { + var n = []; + return e.eachComponent("grid", function(i, a) { + var o = new r(i, e, t); + o.name = "grid_" + a, o.resize(i, t, !0), i.coordinateSystem = o, n.push(o); + }), e.eachSeries(function(i) { + if (nL(i)) { + var a = iL(i), o = a.xAxisModel, s = a.yAxisModel, l = o.getCoordSysModel(), u = l.coordinateSystem; + i.coordinateSystem = u.getCartesian(o.componentIndex, s.componentIndex); + } + }), n; + }, r.dimensions = uT, r; + }() +); +function xw(r, e) { + return r.getCoordSysModel() === e; +} +function aL(r, e, t, n) { + t.getAxesOnZeroOf = function() { + return a ? [a] : []; + }; + var i = r[e], a, o = t.model, s = o.get(["axisLine", "onZero"]), l = o.get(["axisLine", "onZeroAxisIndex"]); + if (!s) + return; + if (l != null) + oL(i[l]) && (a = i[l]); + else + for (var u in i) + if (i.hasOwnProperty(u) && oL(i[u]) && !n[c(i[u])]) { + a = i[u]; + break; + } + a && (n[c(a)] = !0); + function c(h) { + return h.dim + "_" + h.index; + } +} +function oL(r) { + return r && r.type !== "category" && r.type !== "time" && Tte(r); +} +function pie(r, e) { + var t = r.getExtent(), n = t[0] + t[1]; + r.toGlobalCoord = r.dim === "x" ? function(i) { + return i + e; + } : function(i) { + return n - i + e; + }, r.toLocalCoord = r.dim === "x" ? function(i) { + return i - e; + } : function(i) { + return n - i + e; + }; +} +const gie = vie; +var Ku = Math.PI, jh = ( + /** @class */ + function() { + function r(e, t) { + this.group = new Rt(), this.opt = t, this.axisModel = e, Mt(t, { + labelOffset: 0, + nameDirection: 1, + tickDirection: 1, + labelDirection: 1, + silent: !0, + handleAutoShown: function() { + return !0; + } + }); + var n = new Rt({ + x: t.position[0], + y: t.position[1], + rotation: t.rotation + }); + n.updateTransform(), this._transformGroup = n; + } + return r.prototype.hasBuilder = function(e) { + return !!sL[e]; + }, r.prototype.add = function(e) { + sL[e](this.opt, this.axisModel, this.group, this._transformGroup); + }, r.prototype.getGroup = function() { + return this.group; + }, r.innerTextLayout = function(e, t, n) { + var i = jI(t - e), a, o; + return fg(i) ? (o = n > 0 ? "top" : "bottom", a = "center") : fg(i - Ku) ? (o = n > 0 ? "bottom" : "top", a = "center") : (o = "middle", i > 0 && i < Ku ? a = n > 0 ? "right" : "left" : a = n > 0 ? "left" : "right"), { + rotation: i, + textAlign: a, + textVerticalAlign: o + }; + }, r.makeAxisEventDataBase = function(e) { + var t = { + componentType: e.mainType, + componentIndex: e.componentIndex + }; + return t[e.mainType + "Index"] = e.componentIndex, t; + }, r.isLabelSilent = function(e) { + var t = e.get("tooltip"); + return e.get("silent") || !(e.get("triggerEvent") || t && t.show); + }, r; + }() +), sL = { + axisLine: function(r, e, t, n) { + var i = e.get(["axisLine", "show"]); + if (i === "auto" && r.handleAutoShown && (i = r.handleAutoShown("axisLine")), !!i) { + var a = e.axis.getExtent(), o = n.transform, s = [a[0], 0], l = [a[1], 0], u = s[0] > l[0]; + o && (zi(s, s, o), zi(l, l, o)); + var c = Fe({ + lineCap: "round" + }, e.getModel(["axisLine", "lineStyle"]).getLineStyle()), h = new Ai({ + shape: { + x1: s[0], + y1: s[1], + x2: l[0], + y2: l[1] + }, + style: c, + strokeContainThreshold: r.strokeContainThreshold || 5, + silent: !0, + z2: 1 + }); + Pd(h.shape, h.style.lineWidth), h.anid = "line", t.add(h); + var f = e.get(["axisLine", "symbol"]); + if (f != null) { + var v = e.get(["axisLine", "symbolSize"]); + ut(f) && (f = [f, f]), (ut(v) || Pr(v)) && (v = [v, v]); + var b = sf(e.get(["axisLine", "symbolOffset"]) || 0, v), w = v[0], p = v[1]; + X([{ + rotate: r.rotation + Math.PI / 2, + offset: b[0], + r: 0 + }, { + rotate: r.rotation - Math.PI / 2, + offset: b[1], + r: Math.sqrt((s[0] - l[0]) * (s[0] - l[0]) + (s[1] - l[1]) * (s[1] - l[1])) + }], function(d, m) { + if (f[m] !== "none" && f[m] != null) { + var _ = li(f[m], -w / 2, -p / 2, w, p, c.stroke, !0), y = d.r + d.offset, x = u ? l : s; + _.attr({ + rotation: d.rotate, + x: x[0] + y * Math.cos(r.rotation), + y: x[1] - y * Math.sin(r.rotation), + silent: !0, + z2: 11 + }), t.add(_); + } + }); + } + } + }, + axisTickLabel: function(r, e, t, n) { + var i = _ie(t, n, e, r), a = xie(t, n, e, r); + if (yie(e, a, i), bie(t, n, e, r.tickDirection), e.get(["axisLabel", "hideOverlap"])) { + var o = A$(Ke(a, function(s) { + return { + label: s, + priority: s.z2, + defaultAttr: { + ignore: s.ignore + } + }; + })); + D$(o); + } + }, + axisName: function(r, e, t, n) { + var i = Ii(r.axisName, e.get("name")); + if (i) { + var a = e.get("nameLocation"), o = r.nameDirection, s = e.getModel("nameTextStyle"), l = e.get("nameGap") || 0, u = e.axis.getExtent(), c = u[0] > u[1] ? -1 : 1, h = [ + a === "start" ? u[0] - c * l : a === "end" ? u[1] + c * l : (u[0] + u[1]) / 2, + // Reuse labelOffset. + uL(a) ? r.labelOffset + o * l : 0 + ], f, v = e.get("nameRotate"); + v != null && (v = v * Ku / 180); + var b; + uL(a) ? f = jh.innerTextLayout( + r.rotation, + v != null ? v : r.rotation, + // Adapt to axis. + o + ) : (f = mie(r.rotation, a, v || 0, u), b = r.axisNameAvailableWidth, b != null && (b = Math.abs(b / Math.sin(f.rotation)), !isFinite(b) && (b = null))); + var w = s.getFont(), p = e.get("nameTruncate", !0) || {}, d = p.ellipsis, m = Ii(r.nameTruncateMaxWidth, p.maxWidth, b), _ = new kr({ + x: h[0], + y: h[1], + rotation: f.rotation, + silent: jh.isLabelSilent(e), + style: gn(s, { + text: i, + font: w, + overflow: "truncate", + width: m, + ellipsis: d, + fill: s.getTextColor() || e.get(["axisLine", "lineStyle", "color"]), + align: s.get("align") || f.textAlign, + verticalAlign: s.get("verticalAlign") || f.textVerticalAlign + }), + z2: 1 + }); + if (qd({ + el: _, + componentModel: e, + itemName: i + }), _.__fullText = i, _.anid = "name", e.get("triggerEvent")) { + var y = jh.makeAxisEventDataBase(e); + y.targetType = "axisName", y.name = i, Ft(_).eventData = y; + } + n.add(_), _.updateTransform(), t.add(_), _.decomposeTransform(); + } + } +}; +function mie(r, e, t, n) { + var i = jI(t - r), a, o, s = n[0] > n[1], l = e === "start" && !s || e !== "start" && s; + return fg(i - Ku / 2) ? (o = l ? "bottom" : "top", a = "center") : fg(i - Ku * 1.5) ? (o = l ? "top" : "bottom", a = "center") : (o = "middle", i < Ku * 1.5 && i > Ku / 2 ? a = l ? "left" : "right" : a = l ? "right" : "left"), { + rotation: i, + textAlign: a, + textVerticalAlign: o + }; +} +function yie(r, e, t) { + if (!a$(r.axis)) { + var n = r.get(["axisLabel", "showMinLabel"]), i = r.get(["axisLabel", "showMaxLabel"]); + e = e || [], t = t || []; + var a = e[0], o = e[1], s = e[e.length - 1], l = e[e.length - 2], u = t[0], c = t[1], h = t[t.length - 1], f = t[t.length - 2]; + n === !1 ? (Fo(a), Fo(u)) : lL(a, o) && (n ? (Fo(o), Fo(c)) : (Fo(a), Fo(u))), i === !1 ? (Fo(s), Fo(h)) : lL(l, s) && (i ? (Fo(l), Fo(f)) : (Fo(s), Fo(h))); + } +} +function Fo(r) { + r && (r.ignore = !0); +} +function lL(r, e) { + var t = r && r.getBoundingRect().clone(), n = e && e.getBoundingRect().clone(); + if (!(!t || !n)) { + var i = Yg([]); + return wc(i, i, -r.rotation), t.applyTransform(xl([], i, r.getLocalTransform())), n.applyTransform(xl([], i, e.getLocalTransform())), t.intersect(n); + } +} +function uL(r) { + return r === "middle" || r === "center"; +} +function fH(r, e, t, n, i) { + for (var a = [], o = [], s = [], l = 0; l < r.length; l++) { + var u = r[l].coord; + o[0] = u, o[1] = 0, s[0] = u, s[1] = t, e && (zi(o, o, e), zi(s, s, e)); + var c = new Ai({ + shape: { + x1: o[0], + y1: o[1], + x2: s[0], + y2: s[1] + }, + style: n, + z2: 2, + autoBatch: !0, + silent: !0 + }); + Pd(c.shape, c.style.lineWidth), c.anid = i + "_" + r[l].tickValue, a.push(c); + } + return a; +} +function _ie(r, e, t, n) { + var i = t.axis, a = t.getModel("axisTick"), o = a.get("show"); + if (o === "auto" && n.handleAutoShown && (o = n.handleAutoShown("axisTick")), !(!o || i.scale.isBlank())) { + for (var s = a.getModel("lineStyle"), l = n.tickDirection * a.get("length"), u = i.getTicksCoords(), c = fH(u, e.transform, l, Mt(s.getLineStyle(), { + stroke: t.get(["axisLine", "lineStyle", "color"]) + }), "ticks"), h = 0; h < c.length; h++) + r.add(c[h]); + return c; + } +} +function bie(r, e, t, n) { + var i = t.axis, a = t.getModel("minorTick"); + if (!(!a.get("show") || i.scale.isBlank())) { + var o = i.getMinorTicksCoords(); + if (o.length) + for (var s = a.getModel("lineStyle"), l = n * a.get("length"), u = Mt(s.getLineStyle(), Mt(t.getModel("axisTick").getLineStyle(), { + stroke: t.get(["axisLine", "lineStyle", "color"]) + })), c = 0; c < o.length; c++) + for (var h = fH(o[c], e.transform, l, u, "minorticks_" + c), f = 0; f < h.length; f++) + r.add(h[f]); + } +} +function xie(r, e, t, n) { + var i = t.axis, a = Ii(n.axisLabelShow, t.get(["axisLabel", "show"])); + if (!(!a || i.scale.isBlank())) { + var o = t.getModel("axisLabel"), s = o.get("margin"), l = i.getViewLabels(), u = (Ii(n.labelRotate, o.get("rotate")) || 0) * Ku / 180, c = jh.innerTextLayout(n.rotation, u, n.labelDirection), h = t.getCategories && t.getCategories(!0), f = [], v = jh.isLabelSilent(t), b = t.get("triggerEvent"); + return X(l, function(w, p) { + var d = i.scale.type === "ordinal" ? i.scale.getRawOrdinalNumber(w.tickValue) : w.tickValue, m = w.formattedLabel, _ = w.rawLabel, y = o; + if (h && h[d]) { + var x = h[d]; + kt(x) && x.textStyle && (y = new qr(x.textStyle, o, t.ecModel)); + } + var g = y.getTextColor() || t.get(["axisLine", "lineStyle", "color"]), S = i.dataToCoord(d), T = new kr({ + x: S, + y: n.labelOffset + n.labelDirection * s, + rotation: c.rotation, + silent: v, + z2: 10 + (w.level || 0), + style: gn(y, { + text: m, + align: y.getShallow("align", !0) || c.textAlign, + verticalAlign: y.getShallow("verticalAlign", !0) || y.getShallow("baseline", !0) || c.textVerticalAlign, + fill: Tt(g) ? g( + // (1) In category axis with data zoom, tick is not the original + // index of axis.data. So tick should not be exposed to user + // in category axis. + // (2) Compatible with previous version, which always use formatted label as + // input. But in interval scale the formatted label is like '223,445', which + // maked user replace ','. So we modify it to return original val but remain + // it as 'string' to avoid error in replacing. + i.type === "category" ? _ : i.type === "value" ? d + "" : d, + p + ) : g + }) + }); + if (T.anid = "label_" + d, b) { + var C = jh.makeAxisEventDataBase(t); + C.targetType = "axisLabel", C.value = _, C.tickIndex = p, i.type === "category" && (C.dataIndex = d), Ft(T).eventData = C; + } + e.add(T), T.updateTransform(), f.push(T), r.add(T), T.decomposeTransform(); + }), f; + } +} +const au = jh; +function Sie(r, e) { + var t = { + /** + * key: makeKey(axis.model) + * value: { + * axis, + * coordSys, + * axisPointerModel, + * triggerTooltip, + * triggerEmphasis, + * involveSeries, + * snap, + * seriesModels, + * seriesDataCount + * } + */ + axesInfo: {}, + seriesInvolved: !1, + /** + * key: makeKey(coordSys.model) + * value: Object: key makeKey(axis.model), value: axisInfo + */ + coordSysAxesInfo: {}, + coordSysMap: {} + }; + return wie(t, r, e), t.seriesInvolved && Tie(t, r), t; +} +function wie(r, e, t) { + var n = e.getComponent("tooltip"), i = e.getComponent("axisPointer"), a = i.get("link", !0) || [], o = []; + X(t.getCoordinateSystems(), function(s) { + if (!s.axisPointerEnabled) + return; + var l = Mg(s.model), u = r.coordSysAxesInfo[l] = {}; + r.coordSysMap[l] = s; + var c = s.model, h = c.getModel("tooltip", n); + if (X(s.getAxes(), jt(w, !1, null)), s.getTooltipAxes && n && h.get("show")) { + var f = h.get("trigger") === "axis", v = h.get(["axisPointer", "type"]) === "cross", b = s.getTooltipAxes(h.get(["axisPointer", "axis"])); + (f || v) && X(b.baseAxes, jt(w, v ? "cross" : !0, f)), v && X(b.otherAxes, jt(w, "cross", !1)); + } + function w(p, d, m) { + var _ = m.model.getModel("axisPointer", i), y = _.get("show"); + if (!(!y || y === "auto" && !p && !hT(_))) { + d == null && (d = _.get("triggerTooltip")), _ = p ? Cie(m, h, i, e, p, d) : _; + var x = _.get("snap"), g = _.get("triggerEmphasis"), S = Mg(m.model), T = d || x || m.type === "category", C = r.axesInfo[S] = { + key: S, + axis: m, + coordSys: s, + axisPointerModel: _, + triggerTooltip: d, + triggerEmphasis: g, + involveSeries: T, + snap: x, + useHandle: hT(_), + seriesModels: [], + linkGroup: null + }; + u[S] = C, r.seriesInvolved = r.seriesInvolved || T; + var E = Iie(a, m); + if (E != null) { + var M = o[E] || (o[E] = { + axesInfo: {} + }); + M.axesInfo[S] = C, M.mapper = a[E].mapper, C.linkGroup = M; + } + } + } + }); +} +function Cie(r, e, t, n, i, a) { + var o = e.getModel("axisPointer"), s = ["type", "snap", "lineStyle", "shadowStyle", "label", "animation", "animationDurationUpdate", "animationEasingUpdate", "z"], l = {}; + X(s, function(f) { + l[f] = Ot(o.get(f)); + }), l.snap = r.type !== "category" && !!a, o.get("type") === "cross" && (l.type = "line"); + var u = l.label || (l.label = {}); + if (u.show == null && (u.show = !1), i === "cross") { + var c = o.get(["label", "show"]); + if (u.show = c != null ? c : !0, !a) { + var h = l.lineStyle = o.get("crossStyle"); + h && Mt(u, h.textStyle); + } + } + return r.model.getModel("axisPointer", new qr(l, t, n)); +} +function Tie(r, e) { + e.eachSeries(function(t) { + var n = t.coordinateSystem, i = t.get(["tooltip", "trigger"], !0), a = t.get(["tooltip", "show"], !0); + !n || i === "none" || i === !1 || i === "item" || a === !1 || t.get(["axisPointer", "show"], !0) === !1 || X(r.coordSysAxesInfo[Mg(n.model)], function(o) { + var s = o.axis; + n.getAxis(s.dim) === s && (o.seriesModels.push(t), o.seriesDataCount == null && (o.seriesDataCount = 0), o.seriesDataCount += t.getData().count()); + }); + }); +} +function Iie(r, e) { + for (var t = e.model, n = e.dim, i = 0; i < r.length; i++) { + var a = r[i] || {}; + if (Sw(a[n + "AxisId"], t.id) || Sw(a[n + "AxisIndex"], t.componentIndex) || Sw(a[n + "AxisName"], t.name)) + return i; + } +} +function Sw(r, e) { + return r === "all" || We(r) && ir(r, e) >= 0 || r === e; +} +function Aie(r) { + var e = QA(r); + if (e) { + var t = e.axisPointerModel, n = e.axis.scale, i = t.option, a = t.get("status"), o = t.get("value"); + o != null && (o = n.parse(o)); + var s = hT(t); + a == null && (i.status = s ? "show" : "hide"); + var l = n.getExtent().slice(); + l[0] > l[1] && l.reverse(), // Pick a value on axis when initializing. + (o == null || o > l[1]) && (o = l[1]), o < l[0] && (o = l[0]), i.value = o, s && (i.status = e.axis.scale.isBlank() ? "hide" : "show"); + } +} +function QA(r) { + var e = (r.ecModel.getComponent("axisPointer") || {}).coordSysAxesInfo; + return e && e.axesInfo[Mg(r)]; +} +function Eie(r) { + var e = QA(r); + return e && e.axisPointerModel; +} +function hT(r) { + return !!r.get(["handle", "show"]); +} +function Mg(r) { + return r.type + "||" + r.id; +} +var cL = {}, Mie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i, a) { + this.axisPointerClass && Aie(t), r.prototype.render.apply(this, arguments), this._doUpdateAxisPointerClass(t, i, !0); + }, e.prototype.updateAxisPointer = function(t, n, i, a) { + this._doUpdateAxisPointerClass(t, i, !1); + }, e.prototype.remove = function(t, n) { + var i = this._axisPointer; + i && i.remove(n); + }, e.prototype.dispose = function(t, n) { + this._disposeAxisPointer(n), r.prototype.dispose.apply(this, arguments); + }, e.prototype._doUpdateAxisPointerClass = function(t, n, i) { + var a = e.getAxisPointerClass(this.axisPointerClass); + if (a) { + var o = Eie(t); + o ? (this._axisPointer || (this._axisPointer = new a())).render(t, o, n, i) : this._disposeAxisPointer(n); + } + }, e.prototype._disposeAxisPointer = function(t) { + this._axisPointer && this._axisPointer.dispose(t), this._axisPointer = null; + }, e.registerAxisPointerClass = function(t, n) { + cL[t] = n; + }, e.getAxisPointerClass = function(t) { + return t && cL[t]; + }, e.type = "axis", e; + }(Sn) +); +const uf = Mie; +var fT = Rr(); +function dH(r, e, t, n) { + var i = t.axis; + if (!i.scale.isBlank()) { + var a = t.getModel("splitArea"), o = a.getModel("areaStyle"), s = o.get("color"), l = n.coordinateSystem.getRect(), u = i.getTicksCoords({ + tickModel: a, + clamp: !0 + }); + if (u.length) { + var c = s.length, h = fT(r).splitAreaColors, f = xt(), v = 0; + if (h) + for (var b = 0; b < u.length; b++) { + var w = h.get(u[b].tickValue); + if (w != null) { + v = (w + (c - 1) * b) % c; + break; + } + } + var p = i.toGlobalCoord(u[0].coord), d = o.getAreaStyle(); + s = We(s) ? s : [s]; + for (var b = 1; b < u.length; b++) { + var m = i.toGlobalCoord(u[b].coord), _ = void 0, y = void 0, x = void 0, g = void 0; + i.isHorizontal() ? (_ = p, y = l.y, x = m - _, g = l.height, p = _ + x) : (_ = l.x, y = p, x = l.width, g = m - y, p = y + g); + var S = u[b - 1].tickValue; + S != null && f.set(S, v), e.add(new Or({ + anid: S != null ? "area_" + S : null, + shape: { + x: _, + y, + width: x, + height: g + }, + style: Mt({ + fill: s[v] + }, d), + autoBatch: !0, + silent: !0 + })), v = (v + 1) % c; + } + fT(r).splitAreaColors = f; + } + } +} +function vH(r) { + fT(r).splitAreaColors = null; +} +var Die = ["axisLine", "axisTickLabel", "axisName"], kie = ["splitArea", "splitLine", "minorSplitLine"], pH = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.axisPointerClass = "CartesianAxisPointer", t; + } + return e.prototype.render = function(t, n, i, a) { + this.group.removeAll(); + var o = this._axisGroup; + if (this._axisGroup = new Rt(), this.group.add(this._axisGroup), !!t.get("show")) { + var s = t.getCoordSysModel(), l = cT(s, t), u = new au(t, Fe({ + handleAutoShown: function(h) { + for (var f = s.coordinateSystem.getCartesians(), v = 0; v < f.length; v++) + if (rT(f[v].getOtherAxis(t.axis).scale)) + return !0; + return !1; + } + }, l)); + X(Die, u.add, u), this._axisGroup.add(u.getGroup()), X(kie, function(h) { + t.get([h, "show"]) && Oie[h](this, this._axisGroup, t, s); + }, this); + var c = a && a.type === "changeAxisOrder" && a.isInitSort; + c || tm(o, this._axisGroup, t), r.prototype.render.call(this, t, n, i, a); + } + }, e.prototype.remove = function() { + vH(this); + }, e.type = "cartesianAxis", e; + }(uf) +), Oie = { + splitLine: function(r, e, t, n) { + var i = t.axis; + if (!i.scale.isBlank()) { + var a = t.getModel("splitLine"), o = a.getModel("lineStyle"), s = o.get("color"); + s = We(s) ? s : [s]; + for (var l = n.coordinateSystem.getRect(), u = i.isHorizontal(), c = 0, h = i.getTicksCoords({ + tickModel: a + }), f = [], v = [], b = o.getLineStyle(), w = 0; w < h.length; w++) { + var p = i.toGlobalCoord(h[w].coord); + u ? (f[0] = p, f[1] = l.y, v[0] = p, v[1] = l.y + l.height) : (f[0] = l.x, f[1] = p, v[0] = l.x + l.width, v[1] = p); + var d = c++ % s.length, m = h[w].tickValue, _ = new Ai({ + anid: m != null ? "line_" + h[w].tickValue : null, + autoBatch: !0, + shape: { + x1: f[0], + y1: f[1], + x2: v[0], + y2: v[1] + }, + style: Mt({ + stroke: s[d] + }, b), + silent: !0 + }); + Pd(_.shape, b.lineWidth), e.add(_); + } + } + }, + minorSplitLine: function(r, e, t, n) { + var i = t.axis, a = t.getModel("minorSplitLine"), o = a.getModel("lineStyle"), s = n.coordinateSystem.getRect(), l = i.isHorizontal(), u = i.getMinorTicksCoords(); + if (u.length) + for (var c = [], h = [], f = o.getLineStyle(), v = 0; v < u.length; v++) + for (var b = 0; b < u[v].length; b++) { + var w = i.toGlobalCoord(u[v][b].coord); + l ? (c[0] = w, c[1] = s.y, h[0] = w, h[1] = s.y + s.height) : (c[0] = s.x, c[1] = w, h[0] = s.x + s.width, h[1] = w); + var p = new Ai({ + anid: "minor_line_" + u[v][b].tickValue, + autoBatch: !0, + shape: { + x1: c[0], + y1: c[1], + x2: h[0], + y2: h[1] + }, + style: f, + silent: !0 + }); + Pd(p.shape, f.lineWidth), e.add(p); + } + }, + splitArea: function(r, e, t, n) { + dH(r, e, t, n); + } +}, gH = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "xAxis", e; + }(pH) +), Lie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = gH.type, t; + } + return e.type = "yAxis", e; + }(pH) +), Pie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "grid", t; + } + return e.prototype.render = function(t, n) { + this.group.removeAll(), t.get("show") && this.group.add(new Or({ + shape: t.coordinateSystem.getRect(), + style: Mt({ + fill: t.get("backgroundColor") + }, t.getItemStyle()), + silent: !0, + z2: -1 + })); + }, e.type = "grid", e; + }(Sn) +), hL = { + // gridIndex: 0, + // gridId: '', + offset: 0 +}; +function mH(r) { + r.registerComponentView(Pie), r.registerComponentModel(iie), r.registerCoordinateSystem("cartesian2d", gie), Bd(r, "x", lT, hL), Bd(r, "y", lT, hL), r.registerComponentView(gH), r.registerComponentView(Lie), r.registerPreprocessor(function(e) { + e.xAxis && e.yAxis && !e.grid && (e.grid = {}); + }); +} +function Rie(r) { + Kt(mH), r.registerSeriesModel(Jne), r.registerChartView(rie), r.registerLayout(hm("scatter")); +} +function Nie(r) { + r.eachSeriesByType("radar", function(e) { + var t = e.getData(), n = [], i = e.coordinateSystem; + if (i) { + var a = i.getIndicatorAxes(); + X(a, function(o, s) { + t.each(t.mapDimension(a[s].dim), function(l, u) { + n[u] = n[u] || []; + var c = i.dataToPoint(l, s); + n[u][s] = fL(c) ? c : dL(i); + }); + }), t.each(function(o) { + var s = aj(n[o], function(l) { + return fL(l); + }) || dL(i); + n[o].push(s.slice()), t.setItemLayout(o, n[o]); + }); + } + }); +} +function fL(r) { + return !isNaN(r[0]) && !isNaN(r[1]); +} +function dL(r) { + return [r.cx, r.cy]; +} +function zie(r) { + var e = r.polar; + if (e) { + We(e) || (e = [e]); + var t = []; + X(e, function(n, i) { + n.indicator ? (n.type && !n.shape && (n.shape = n.type), r.radar = r.radar || [], We(r.radar) || (r.radar = [r.radar]), r.radar.push(n)) : t.push(n); + }), r.polar = t; + } + X(r.series, function(n) { + n && n.type === "radar" && n.polarIndex && (n.radarIndex = n.polarIndex); + }); +} +var Bie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = t.coordinateSystem, o = this.group, s = t.getData(), l = this._data; + function u(f, v) { + var b = f.getItemVisual(v, "symbol") || "circle"; + if (b !== "none") { + var w = lv(f.getItemVisual(v, "symbolSize")), p = li(b, -1, -1, 2, 2), d = f.getItemVisual(v, "symbolRotate") || 0; + return p.attr({ + style: { + strokeNoScale: !0 + }, + z2: 100, + scaleX: w[0] / 2, + scaleY: w[1] / 2, + rotation: d * Math.PI / 180 || 0 + }), p; + } + } + function c(f, v, b, w, p, d) { + b.removeAll(); + for (var m = 0; m < v.length - 1; m++) { + var _ = u(w, p); + _ && (_.__dimIdx = m, f[m] ? (_.setPosition(f[m]), rm[d ? "initProps" : "updateProps"](_, { + x: v[m][0], + y: v[m][1] + }, t, p)) : _.setPosition(v[m]), b.add(_)); + } + } + function h(f) { + return Ke(f, function(v) { + return [a.cx, a.cy]; + }); + } + s.diff(l).add(function(f) { + var v = s.getItemLayout(f); + if (v) { + var b = new La(), w = new Pa(), p = { + shape: { + points: v + } + }; + b.shape.points = h(v), w.shape.points = h(v), An(b, p, t, f), An(w, p, t, f); + var d = new Rt(), m = new Rt(); + d.add(w), d.add(b), d.add(m), c(w.shape.points, v, m, s, f, !0), s.setItemGraphicEl(f, d); + } + }).update(function(f, v) { + var b = l.getItemGraphicEl(v), w = b.childAt(0), p = b.childAt(1), d = b.childAt(2), m = { + shape: { + points: s.getItemLayout(f) + } + }; + m.shape.points && (c(w.shape.points, m.shape.points, d, s, f, !1), Hs(p), Hs(w), zr(w, m, t), zr(p, m, t), s.setItemGraphicEl(f, b)); + }).remove(function(f) { + o.remove(l.getItemGraphicEl(f)); + }).execute(), s.eachItemGraphicEl(function(f, v) { + var b = s.getItemModel(v), w = f.childAt(0), p = f.childAt(1), d = f.childAt(2), m = s.getItemVisual(v, "style"), _ = m.fill; + o.add(f), w.useStyle(Mt(b.getModel("lineStyle").getLineStyle(), { + fill: "none", + stroke: _ + })), Xi(w, b, "lineStyle"), Xi(p, b, "areaStyle"); + var y = b.getModel("areaStyle"), x = y.isEmpty() && y.parentModel.isEmpty(); + p.ignore = x, X(["emphasis", "select", "blur"], function(T) { + var C = b.getModel([T, "areaStyle"]), E = C.isEmpty() && C.parentModel.isEmpty(); + p.ensureState(T).ignore = E && x; + }), p.useStyle(Mt(y.getAreaStyle(), { + fill: _, + opacity: 0.7, + decal: m.decal + })); + var g = b.getModel("emphasis"), S = g.getModel("itemStyle").getItemStyle(); + d.eachChild(function(T) { + if (T instanceof ji) { + var C = T.style; + T.useStyle(Fe({ + // TODO other properties like x, y ? + image: C.image, + x: C.x, + y: C.y, + width: C.width, + height: C.height + }, m)); + } else + T.useStyle(m), T.setColor(_), T.style.strokeNoScale = !0; + var E = T.ensureState("emphasis"); + E.style = Ot(S); + var M = s.getStore().get(s.getDimensionIndex(T.__dimIdx), v); + (M == null || isNaN(M)) && (M = ""), Zi(T, Mi(b), { + labelFetcher: s.hostModel, + labelDataIndex: v, + labelDimIndex: T.__dimIdx, + defaultText: M, + inheritColor: _, + defaultOpacity: m.opacity + }); + }), Un(f, g.get("focus"), g.get("blurScope"), g.get("disabled")); + }), this._data = s; + }, e.prototype.remove = function() { + this.group.removeAll(), this._data = null; + }, e.type = "radar", e; + }(en) +); +const jie = Bie; +var Fie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t; + } + return e.prototype.init = function(t) { + r.prototype.init.apply(this, arguments), this.legendVisualProvider = new dm(ft(this.getData, this), ft(this.getRawData, this)); + }, e.prototype.getInitialData = function(t, n) { + return hv(this, { + generateCoord: "indicator_", + generateCoordCount: 1 / 0 + }); + }, e.prototype.formatTooltip = function(t, n, i) { + var a = this.getData(), o = this.coordinateSystem, s = o.getIndicatorAxes(), l = this.getData().getName(t), u = l === "" ? this.name : l, c = KF(this, t); + return Di("section", { + header: u, + sortBlocks: !0, + blocks: Ke(s, function(h) { + var f = a.get(a.mapDimension(h.dim), t); + return Di("nameValue", { + markerType: "subItem", + markerColor: c, + name: h.name, + value: f, + sortParam: f + }); + }) + }); + }, e.prototype.getTooltipPosition = function(t) { + if (t != null) { + for (var n = this.getData(), i = this.coordinateSystem, a = n.getValues(Ke(i.dimensions, function(u) { + return n.mapDimension(u); + }), t), o = 0, s = a.length; o < s; o++) + if (!isNaN(a[o])) { + var l = i.getIndicatorAxes(); + return i.coordToPoint(l[o].dataToCoord(a[o]), o); + } + } + }, e.type = "series.radar", e.dependencies = ["radar"], e.defaultOption = { + // zlevel: 0, + z: 2, + colorBy: "data", + coordinateSystem: "radar", + legendHoverLink: !0, + radarIndex: 0, + lineStyle: { + width: 2, + type: "solid", + join: "round" + }, + label: { + position: "top" + }, + // areaStyle: { + // }, + // itemStyle: {} + symbolSize: 8 + // symbolRotate: null + }, e; + }(mn) +); +const $ie = Fie; +var hp = cH.value; +function i0(r, e) { + return Mt({ + show: e + }, r); +} +var Hie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.optionUpdated = function() { + var t = this.get("boundaryGap"), n = this.get("splitNumber"), i = this.get("scale"), a = this.get("axisLine"), o = this.get("axisTick"), s = this.get("axisLabel"), l = this.get("axisName"), u = this.get(["axisName", "show"]), c = this.get(["axisName", "formatter"]), h = this.get("axisNameGap"), f = this.get("triggerEvent"), v = Ke(this.get("indicator") || [], function(b) { + b.max != null && b.max > 0 && !b.min ? b.min = 0 : b.min != null && b.min < 0 && !b.max && (b.max = 0); + var w = l; + b.color != null && (w = Mt({ + color: b.color + }, l)); + var p = Ut(Ot(b), { + boundaryGap: t, + splitNumber: n, + scale: i, + axisLine: a, + axisTick: o, + // axisType: axisType, + axisLabel: s, + // Compatible with 2 and use text + name: b.text, + showName: u, + nameLocation: "end", + nameGap: h, + // min: 0, + nameTextStyle: w, + triggerEvent: f + }, !1); + if (ut(c)) { + var d = p.name; + p.name = c.replace("{value}", d != null ? d : ""); + } else + Tt(c) && (p.name = c(p.name, p)); + var m = new qr(p, null, this.ecModel); + return qn(m, cv.prototype), m.mainType = "radar", m.componentIndex = this.componentIndex, m; + }, this); + this._indicatorModels = v; + }, e.prototype.getIndicatorModels = function() { + return this._indicatorModels; + }, e.type = "radar", e.defaultOption = { + // zlevel: 0, + z: 0, + center: ["50%", "50%"], + radius: "75%", + startAngle: 90, + axisName: { + show: !0 + // formatter: null + // textStyle: {} + }, + boundaryGap: [0, 0], + splitNumber: 5, + axisNameGap: 15, + scale: !1, + // Polygon or circle + shape: "polygon", + axisLine: Ut({ + lineStyle: { + color: "#bbb" + } + }, hp.axisLine), + axisLabel: i0(hp.axisLabel, !1), + axisTick: i0(hp.axisTick, !1), + // axisType: 'value', + splitLine: i0(hp.splitLine, !0), + splitArea: i0(hp.splitArea, !0), + // {text, min, max} + indicator: [] + }, e; + }(xr) +); +const Vie = Hie; +var Gie = ["axisLine", "axisTickLabel", "axisName"], Uie = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = this.group; + a.removeAll(), this._buildAxes(t), this._buildSplitLineAndArea(t); + }, e.prototype._buildAxes = function(t) { + var n = t.coordinateSystem, i = n.getIndicatorAxes(), a = Ke(i, function(o) { + var s = o.model.get("showName") ? o.name : "", l = new au(o.model, { + axisName: s, + position: [n.cx, n.cy], + rotation: o.angle, + labelDirection: -1, + tickDirection: -1, + nameDirection: 1 + }); + return l; + }); + X(a, function(o) { + X(Gie, o.add, o), this.group.add(o.getGroup()); + }, this); + }, e.prototype._buildSplitLineAndArea = function(t) { + var n = t.coordinateSystem, i = n.getIndicatorAxes(); + if (!i.length) + return; + var a = t.get("shape"), o = t.getModel("splitLine"), s = t.getModel("splitArea"), l = o.getModel("lineStyle"), u = s.getModel("areaStyle"), c = o.get("show"), h = s.get("show"), f = l.get("color"), v = u.get("color"), b = We(f) ? f : [f], w = We(v) ? v : [v], p = [], d = []; + function m(F, U, $) { + var G = $ % U.length; + return F[G] = F[G] || [], G; + } + if (a === "circle") + for (var _ = i[0].getTicksCoords(), y = n.cx, x = n.cy, g = 0; g < _.length; g++) { + if (c) { + var S = m(p, b, g); + p[S].push(new $s({ + shape: { + cx: y, + cy: x, + r: _[g].coord + } + })); + } + if (h && g < _.length - 1) { + var S = m(d, w, g); + d[S].push(new Qg({ + shape: { + cx: y, + cy: x, + r0: _[g].coord, + r: _[g + 1].coord + } + })); + } + } + else + for (var T, C = Ke(i, function(F, U) { + var $ = F.getTicksCoords(); + return T = T == null ? $.length - 1 : Math.min($.length - 1, T), Ke($, function(G) { + return n.coordToPoint(G.coord, U); + }); + }), E = [], g = 0; g <= T; g++) { + for (var M = [], P = 0; P < i.length; P++) + M.push(C[P][g]); + if (M[0] && M.push(M[0].slice()), c) { + var S = m(p, b, g); + p[S].push(new Pa({ + shape: { + points: M + } + })); + } + if (h && E) { + var S = m(d, w, g - 1); + d[S].push(new La({ + shape: { + points: M.concat(E) + } + })); + } + E = M.slice().reverse(); + } + var R = l.getLineStyle(), N = u.getAreaStyle(); + X(d, function(F, U) { + this.group.add(mo(F, { + style: Mt({ + stroke: "none", + fill: w[U % w.length] + }, N), + silent: !0 + })); + }, this), X(p, function(F, U) { + this.group.add(mo(F, { + style: Mt({ + fill: "none", + stroke: b[U % b.length] + }, R), + silent: !0 + })); + }, this); + }, e.type = "radar", e; + }(Sn) +); +const Wie = Uie; +var Yie = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this, t, n, i) || this; + return a.type = "value", a.angle = 0, a.name = "", a; + } + return e; + }(wo) +); +const Xie = Yie; +var Zie = ( + /** @class */ + function() { + function r(e, t, n) { + this.dimensions = [], this._model = e, this._indicatorAxes = Ke(e.getIndicatorModels(), function(i, a) { + var o = "indicator_" + a, s = new Xie( + o, + new pc() + // (indicatorModel.get('axisType') === 'log') ? new LogScale() : new IntervalScale() + ); + return s.name = i.get("name"), s.model = i, i.axis = s, this.dimensions.push(o), s; + }, this), this.resize(e, n); + } + return r.prototype.getIndicatorAxes = function() { + return this._indicatorAxes; + }, r.prototype.dataToPoint = function(e, t) { + var n = this._indicatorAxes[t]; + return this.coordToPoint(n.dataToCoord(e), t); + }, r.prototype.coordToPoint = function(e, t) { + var n = this._indicatorAxes[t], i = n.angle, a = this.cx + e * Math.cos(i), o = this.cy - e * Math.sin(i); + return [a, o]; + }, r.prototype.pointToData = function(e) { + var t = e[0] - this.cx, n = e[1] - this.cy, i = Math.sqrt(t * t + n * n); + t /= i, n /= i; + for (var a = Math.atan2(-n, t), o = 1 / 0, s, l = -1, u = 0; u < this._indicatorAxes.length; u++) { + var c = this._indicatorAxes[u], h = Math.abs(a - c.angle); + h < o && (s = c, l = u, o = h); + } + return [l, +(s && s.coordToData(i))]; + }, r.prototype.resize = function(e, t) { + var n = e.get("center"), i = t.getWidth(), a = t.getHeight(), o = Math.min(i, a) / 2; + this.cx = ot(n[0], i), this.cy = ot(n[1], a), this.startAngle = e.get("startAngle") * Math.PI / 180; + var s = e.get("radius"); + (ut(s) || Pr(s)) && (s = [0, s]), this.r0 = ot(s[0], o), this.r = ot(s[1], o), X(this._indicatorAxes, function(l, u) { + l.setExtent(this.r0, this.r); + var c = this.startAngle + u * Math.PI * 2 / this._indicatorAxes.length; + c = Math.atan2(Math.sin(c), Math.cos(c)), l.angle = c; + }, this); + }, r.prototype.update = function(e, t) { + var n = this._indicatorAxes, i = this._model; + X(n, function(s) { + s.scale.setExtent(1 / 0, -1 / 0); + }), e.eachSeriesByType("radar", function(s, l) { + if (!(s.get("coordinateSystem") !== "radar" || e.getComponent("radar", s.get("radarIndex")) !== i)) { + var u = s.getData(); + X(n, function(c) { + c.scale.unionExtentFromData(u, u.mapDimension(c.dim)); + }); + } + }, this); + var a = i.get("splitNumber"), o = new pc(); + o.setExtent(0, a), o.setInterval(1), X(n, function(s, l) { + hH(s.scale, s.model, o); + }); + }, r.prototype.convertToPixel = function(e, t, n) { + return console.warn("Not implemented."), null; + }, r.prototype.convertFromPixel = function(e, t, n) { + return console.warn("Not implemented."), null; + }, r.prototype.containPoint = function(e) { + return console.warn("Not implemented."), !1; + }, r.create = function(e, t) { + var n = []; + return e.eachComponent("radar", function(i) { + var a = new r(i, e, t); + n.push(a), i.coordinateSystem = a; + }), e.eachSeriesByType("radar", function(i) { + i.get("coordinateSystem") === "radar" && (i.coordinateSystem = n[i.get("radarIndex") || 0]); + }), n; + }, r.dimensions = [], r; + }() +); +const Jie = Zie; +function Kie(r) { + r.registerCoordinateSystem("radar", Jie), r.registerComponentModel(Vie), r.registerComponentView(Wie), r.registerVisual({ + seriesType: "radar", + reset: function(e) { + var t = e.getData(); + t.each(function(n) { + t.setItemVisual(n, "legendIcon", "roundRect"); + }), t.setVisual("legendIcon", "roundRect"); + } + }); +} +function Qie(r) { + Kt(Kie), r.registerChartView(jie), r.registerSeriesModel($ie), r.registerLayout(Nie), r.registerProcessor(fm("radar")), r.registerPreprocessor(zie); +} +var vL = "\0_ec_interaction_mutex"; +function qie(r, e, t) { + var n = qA(r); + n[e] = t; +} +function eae(r, e, t) { + var n = qA(r), i = n[e]; + i === t && (n[e] = null); +} +function pL(r, e) { + return !!qA(r)[e]; +} +function qA(r) { + return r[vL] || (r[vL] = {}); +} +os({ + type: "takeGlobalCursor", + event: "globalCursorTaken", + update: "update" +}, Qn); +var tae = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this) || this; + n._zr = t; + var i = ft(n._mousedownHandler, n), a = ft(n._mousemoveHandler, n), o = ft(n._mouseupHandler, n), s = ft(n._mousewheelHandler, n), l = ft(n._pinchHandler, n); + return n.enable = function(u, c) { + this.disable(), this._opt = Mt(Ot(c) || {}, { + zoomOnMouseWheel: !0, + moveOnMouseMove: !0, + // By default, wheel do not trigger move. + moveOnMouseWheel: !1, + preventDefaultMouseMove: !0 + }), u == null && (u = !0), (u === !0 || u === "move" || u === "pan") && (t.on("mousedown", i), t.on("mousemove", a), t.on("mouseup", o)), (u === !0 || u === "scale" || u === "zoom") && (t.on("mousewheel", s), t.on("pinch", l)); + }, n.disable = function() { + t.off("mousedown", i), t.off("mousemove", a), t.off("mouseup", o), t.off("mousewheel", s), t.off("pinch", l); + }, n; + } + return e.prototype.isDragging = function() { + return this._dragging; + }, e.prototype.isPinching = function() { + return this._pinching; + }, e.prototype.setPointerChecker = function(t) { + this.pointerChecker = t; + }, e.prototype.dispose = function() { + this.disable(); + }, e.prototype._mousedownHandler = function(t) { + if (!UD(t)) { + for (var n = t.target; n; ) { + if (n.draggable) + return; + n = n.__hostTarget || n.parent; + } + var i = t.offsetX, a = t.offsetY; + this.pointerChecker && this.pointerChecker(t, i, a) && (this._x = i, this._y = a, this._dragging = !0); + } + }, e.prototype._mousemoveHandler = function(t) { + if (!(!this._dragging || !U0("moveOnMouseMove", t, this._opt) || t.gestureEvent === "pinch" || pL(this._zr, "globalPan"))) { + var n = t.offsetX, i = t.offsetY, a = this._x, o = this._y, s = n - a, l = i - o; + this._x = n, this._y = i, this._opt.preventDefaultMouseMove && eu(t.event), yH(this, "pan", "moveOnMouseMove", t, { + dx: s, + dy: l, + oldX: a, + oldY: o, + newX: n, + newY: i, + isAvailableBehavior: null + }); + } + }, e.prototype._mouseupHandler = function(t) { + UD(t) || (this._dragging = !1); + }, e.prototype._mousewheelHandler = function(t) { + var n = U0("zoomOnMouseWheel", t, this._opt), i = U0("moveOnMouseWheel", t, this._opt), a = t.wheelDelta, o = Math.abs(a), s = t.offsetX, l = t.offsetY; + if (!(a === 0 || !n && !i)) { + if (n) { + var u = o > 3 ? 1.4 : o > 1 ? 1.2 : 1.1, c = a > 0 ? u : 1 / u; + ww(this, "zoom", "zoomOnMouseWheel", t, { + scale: c, + originX: s, + originY: l, + isAvailableBehavior: null + }); + } + if (i) { + var h = Math.abs(a), f = (a > 0 ? 1 : -1) * (h > 3 ? 0.4 : h > 1 ? 0.15 : 0.05); + ww(this, "scrollMove", "moveOnMouseWheel", t, { + scrollDelta: f, + originX: s, + originY: l, + isAvailableBehavior: null + }); + } + } + }, e.prototype._pinchHandler = function(t) { + if (!pL(this._zr, "globalPan")) { + var n = t.pinchScale > 1 ? 1.1 : 1 / 1.1; + ww(this, "zoom", null, t, { + scale: n, + originX: t.pinchX, + originY: t.pinchY, + isAvailableBehavior: null + }); + } + }, e; + }(rs) +); +function ww(r, e, t, n, i) { + r.pointerChecker && r.pointerChecker(n, i.originX, i.originY) && (eu(n.event), yH(r, e, t, n, i)); +} +function yH(r, e, t, n, i) { + i.isAvailableBehavior = ft(U0, null, t, n), r.trigger(e, i); +} +function U0(r, e, t) { + var n = t[r]; + return !r || n && (!ut(n) || e.event[n + "Key"]); +} +const vm = tae; +function eE(r, e, t) { + var n = r.target; + n.x += e, n.y += t, n.dirty(); +} +function tE(r, e, t, n) { + var i = r.target, a = r.zoomLimit, o = r.zoom = r.zoom || 1; + if (o *= e, a) { + var s = a.min || 0, l = a.max || 1 / 0; + o = Math.max(Math.min(l, o), s); + } + var u = o / r.zoom; + r.zoom = o, i.x -= (t - i.x) * (u - 1), i.y -= (n - i.y) * (u - 1), i.scaleX *= u, i.scaleY *= u, i.dirty(); +} +var rae = { + axisPointer: 1, + tooltip: 1, + brush: 1 +}; +function ux(r, e, t) { + var n = e.getComponentByElement(r.topTarget), i = n && n.coordinateSystem; + return n && n !== t && !rae.hasOwnProperty(n.mainType) && i && i.model !== t; +} +function _H(r) { + if (ut(r)) { + var e = new DOMParser(); + r = e.parseFromString(r, "text/xml"); + } + var t = r; + for (t.nodeType === 9 && (t = t.firstChild); t.nodeName.toLowerCase() !== "svg" || t.nodeType !== 1; ) + t = t.nextSibling; + return t; +} +var Cw, F_ = { + fill: "fill", + stroke: "stroke", + "stroke-width": "lineWidth", + opacity: "opacity", + "fill-opacity": "fillOpacity", + "stroke-opacity": "strokeOpacity", + "stroke-dasharray": "lineDash", + "stroke-dashoffset": "lineDashOffset", + "stroke-linecap": "lineCap", + "stroke-linejoin": "lineJoin", + "stroke-miterlimit": "miterLimit", + "font-family": "fontFamily", + "font-size": "fontSize", + "font-style": "fontStyle", + "font-weight": "fontWeight", + "text-anchor": "textAlign", + visibility: "visibility", + display: "display" +}, gL = yr(F_), $_ = { + "alignment-baseline": "textBaseline", + "stop-color": "stopColor" +}, mL = yr($_), nae = function() { + function r() { + this._defs = {}, this._root = null; + } + return r.prototype.parse = function(e, t) { + t = t || {}; + var n = _H(e); + this._defsUsePending = []; + var i = new Rt(); + this._root = i; + var a = [], o = n.getAttribute("viewBox") || "", s = parseFloat(n.getAttribute("width") || t.width), l = parseFloat(n.getAttribute("height") || t.height); + isNaN(s) && (s = null), isNaN(l) && (l = null), po(n, i, null, !0, !1); + for (var u = n.firstChild; u; ) + this._parseNode(u, i, a, null, !1, !1), u = u.nextSibling; + oae(this._defs, this._defsUsePending), this._defsUsePending = []; + var c, h; + if (o) { + var f = cx(o); + f.length >= 4 && (c = { + x: parseFloat(f[0] || 0), + y: parseFloat(f[1] || 0), + width: parseFloat(f[2]), + height: parseFloat(f[3]) + }); + } + if (c && s != null && l != null && (h = xH(c, { x: 0, y: 0, width: s, height: l }), !t.ignoreViewBox)) { + var v = i; + i = new Rt(), i.add(v), v.scaleX = v.scaleY = h.scale, v.x = h.x, v.y = h.y; + } + return !t.ignoreRootClip && s != null && l != null && i.setClipPath(new Or({ + shape: { x: 0, y: 0, width: s, height: l } + })), { + root: i, + width: s, + height: l, + viewBoxRect: c, + viewBoxTransform: h, + named: a + }; + }, r.prototype._parseNode = function(e, t, n, i, a, o) { + var s = e.nodeName.toLowerCase(), l, u = i; + if (s === "defs" && (a = !0), s === "text" && (o = !0), s === "defs" || s === "switch") + l = t; + else { + if (!a) { + var c = Cw[s]; + if (c && gt(Cw, s)) { + l = c.call(this, e, t); + var h = e.getAttribute("name"); + if (h) { + var f = { + name: h, + namedFrom: null, + svgNodeTagLower: s, + el: l + }; + n.push(f), s === "g" && (u = f); + } else + i && n.push({ + name: i.name, + namedFrom: i, + svgNodeTagLower: s, + el: l + }); + t.add(l); + } + } + var v = yL[s]; + if (v && gt(yL, s)) { + var b = v.call(this, e), w = e.getAttribute("id"); + w && (this._defs[w] = b); + } + } + if (l && l.isGroup) + for (var p = e.firstChild; p; ) + p.nodeType === 1 ? this._parseNode(p, l, n, u, a, o) : p.nodeType === 3 && o && this._parseText(p, l), p = p.nextSibling; + }, r.prototype._parseText = function(e, t) { + var n = new vg({ + style: { + text: e.textContent + }, + silent: !0, + x: this._textX || 0, + y: this._textY || 0 + }); + $o(t, n), po(e, n, this._defsUsePending, !1, !1), iae(n, t); + var i = n.style, a = i.fontSize; + a && a < 9 && (i.fontSize = 9, n.scaleX *= a / 9, n.scaleY *= a / 9); + var o = (i.fontSize || i.fontFamily) && [ + i.fontStyle, + i.fontWeight, + (i.fontSize || 12) + "px", + i.fontFamily || "sans-serif" + ].join(" "); + i.font = o; + var s = n.getBoundingRect(); + return this._textX += s.width, t.add(n), n; + }, r.internalField = function() { + Cw = { + g: function(e, t) { + var n = new Rt(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n; + }, + rect: function(e, t) { + var n = new Or(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n.setShape({ + x: parseFloat(e.getAttribute("x") || "0"), + y: parseFloat(e.getAttribute("y") || "0"), + width: parseFloat(e.getAttribute("width") || "0"), + height: parseFloat(e.getAttribute("height") || "0") + }), n.silent = !0, n; + }, + circle: function(e, t) { + var n = new $s(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n.setShape({ + cx: parseFloat(e.getAttribute("cx") || "0"), + cy: parseFloat(e.getAttribute("cy") || "0"), + r: parseFloat(e.getAttribute("r") || "0") + }), n.silent = !0, n; + }, + line: function(e, t) { + var n = new Ai(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n.setShape({ + x1: parseFloat(e.getAttribute("x1") || "0"), + y1: parseFloat(e.getAttribute("y1") || "0"), + x2: parseFloat(e.getAttribute("x2") || "0"), + y2: parseFloat(e.getAttribute("y2") || "0") + }), n.silent = !0, n; + }, + ellipse: function(e, t) { + var n = new zb(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n.setShape({ + cx: parseFloat(e.getAttribute("cx") || "0"), + cy: parseFloat(e.getAttribute("cy") || "0"), + rx: parseFloat(e.getAttribute("rx") || "0"), + ry: parseFloat(e.getAttribute("ry") || "0") + }), n.silent = !0, n; + }, + polygon: function(e, t) { + var n = e.getAttribute("points"), i; + n && (i = xL(n)); + var a = new La({ + shape: { + points: i || [] + }, + silent: !0 + }); + return $o(t, a), po(e, a, this._defsUsePending, !1, !1), a; + }, + polyline: function(e, t) { + var n = e.getAttribute("points"), i; + n && (i = xL(n)); + var a = new Pa({ + shape: { + points: i || [] + }, + silent: !0 + }); + return $o(t, a), po(e, a, this._defsUsePending, !1, !1), a; + }, + image: function(e, t) { + var n = new ji(); + return $o(t, n), po(e, n, this._defsUsePending, !1, !1), n.setStyle({ + image: e.getAttribute("xlink:href") || e.getAttribute("href"), + x: +e.getAttribute("x"), + y: +e.getAttribute("y"), + width: +e.getAttribute("width"), + height: +e.getAttribute("height") + }), n.silent = !0, n; + }, + text: function(e, t) { + var n = e.getAttribute("x") || "0", i = e.getAttribute("y") || "0", a = e.getAttribute("dx") || "0", o = e.getAttribute("dy") || "0"; + this._textX = parseFloat(n) + parseFloat(a), this._textY = parseFloat(i) + parseFloat(o); + var s = new Rt(); + return $o(t, s), po(e, s, this._defsUsePending, !1, !0), s; + }, + tspan: function(e, t) { + var n = e.getAttribute("x"), i = e.getAttribute("y"); + n != null && (this._textX = parseFloat(n)), i != null && (this._textY = parseFloat(i)); + var a = e.getAttribute("dx") || "0", o = e.getAttribute("dy") || "0", s = new Rt(); + return $o(t, s), po(e, s, this._defsUsePending, !1, !0), this._textX += parseFloat(a), this._textY += parseFloat(o), s; + }, + path: function(e, t) { + var n = e.getAttribute("d") || "", i = N5(n); + return $o(t, i), po(e, i, this._defsUsePending, !1, !1), i.silent = !0, i; + } + }; + }(), r; +}(), yL = { + lineargradient: function(r) { + var e = parseInt(r.getAttribute("x1") || "0", 10), t = parseInt(r.getAttribute("y1") || "0", 10), n = parseInt(r.getAttribute("x2") || "10", 10), i = parseInt(r.getAttribute("y2") || "0", 10), a = new Jd(e, t, n, i); + return _L(r, a), bL(r, a), a; + }, + radialgradient: function(r) { + var e = parseInt(r.getAttribute("cx") || "0", 10), t = parseInt(r.getAttribute("cy") || "0", 10), n = parseInt(r.getAttribute("r") || "0", 10), i = new QI(e, t, n); + return _L(r, i), bL(r, i), i; + } +}; +function _L(r, e) { + var t = r.getAttribute("gradientUnits"); + t === "userSpaceOnUse" && (e.global = !0); +} +function bL(r, e) { + for (var t = r.firstChild; t; ) { + if (t.nodeType === 1 && t.nodeName.toLocaleLowerCase() === "stop") { + var n = t.getAttribute("offset"), i = void 0; + n && n.indexOf("%") > 0 ? i = parseInt(n, 10) / 100 : n ? i = parseFloat(n) : i = 0; + var a = {}; + bH(t, a, a); + var o = a.stopColor || t.getAttribute("stop-color") || "#000000"; + e.colorStops.push({ + offset: i, + color: o + }); + } + t = t.nextSibling; + } +} +function $o(r, e) { + r && r.__inheritedStyle && (e.__inheritedStyle || (e.__inheritedStyle = {}), Mt(e.__inheritedStyle, r.__inheritedStyle)); +} +function xL(r) { + for (var e = cx(r), t = [], n = 0; n < e.length; n += 2) { + var i = parseFloat(e[n]), a = parseFloat(e[n + 1]); + t.push([i, a]); + } + return t; +} +function po(r, e, t, n, i) { + var a = e, o = a.__inheritedStyle = a.__inheritedStyle || {}, s = {}; + r.nodeType === 1 && (uae(r, e), bH(r, o, s), n || cae(r, o, s)), a.style = a.style || {}, o.fill != null && (a.style.fill = SL(a, "fill", o.fill, t)), o.stroke != null && (a.style.stroke = SL(a, "stroke", o.stroke, t)), X([ + "lineWidth", + "opacity", + "fillOpacity", + "strokeOpacity", + "miterLimit", + "fontSize" + ], function(l) { + o[l] != null && (a.style[l] = parseFloat(o[l])); + }), X([ + "lineDashOffset", + "lineCap", + "lineJoin", + "fontWeight", + "fontFamily", + "fontStyle", + "textAlign" + ], function(l) { + o[l] != null && (a.style[l] = o[l]); + }), i && (a.__selfStyle = s), o.lineDash && (a.style.lineDash = Ke(cx(o.lineDash), function(l) { + return parseFloat(l); + })), (o.visibility === "hidden" || o.visibility === "collapse") && (a.invisible = !0), o.display === "none" && (a.ignore = !0); +} +function iae(r, e) { + var t = e.__selfStyle; + if (t) { + var n = t.textBaseline, i = n; + !n || n === "auto" || n === "baseline" ? i = "alphabetic" : n === "before-edge" || n === "text-before-edge" ? i = "top" : n === "after-edge" || n === "text-after-edge" ? i = "bottom" : (n === "central" || n === "mathematical") && (i = "middle"), r.style.textBaseline = i; + } + var a = e.__inheritedStyle; + if (a) { + var o = a.textAlign, s = o; + o && (o === "middle" && (s = "center"), r.style.textAlign = s); + } +} +var aae = /^url\(\s*#(.*?)\)/; +function SL(r, e, t, n) { + var i = t && t.match(aae); + if (i) { + var a = Qo(i[1]); + n.push([r, e, a]); + return; + } + return t === "none" && (t = null), t; +} +function oae(r, e) { + for (var t = 0; t < e.length; t++) { + var n = e[t]; + n[0].style[n[1]] = r[n[2]]; + } +} +var sae = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g; +function cx(r) { + return r.match(sae) || []; +} +var lae = /(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g, Tw = Math.PI / 180; +function uae(r, e) { + var t = r.getAttribute("transform"); + if (t) { + t = t.replace(/,/g, " "); + var n = [], i = null; + t.replace(lae, function(h, f, v) { + return n.push(f, v), ""; + }); + for (var a = n.length - 1; a > 0; a -= 2) { + var o = n[a], s = n[a - 1], l = cx(o); + switch (i = i || io(), s) { + case "translate": + js(i, i, [parseFloat(l[0]), parseFloat(l[1] || "0")]); + break; + case "scale": + Ab(i, i, [parseFloat(l[0]), parseFloat(l[1] || l[0])]); + break; + case "rotate": + wc(i, i, -parseFloat(l[0]) * Tw); + break; + case "skewX": + var u = Math.tan(parseFloat(l[0]) * Tw); + xl(i, [1, 0, u, 1, 0, 0], i); + break; + case "skewY": + var c = Math.tan(parseFloat(l[0]) * Tw); + xl(i, [1, c, 0, 1, 0, 0], i); + break; + case "matrix": + i[0] = parseFloat(l[0]), i[1] = parseFloat(l[1]), i[2] = parseFloat(l[2]), i[3] = parseFloat(l[3]), i[4] = parseFloat(l[4]), i[5] = parseFloat(l[5]); + break; + } + } + e.setLocalTransform(i); + } +} +var wL = /([^\s:;]+)\s*:\s*([^:;]+)/g; +function bH(r, e, t) { + var n = r.getAttribute("style"); + if (n) { + wL.lastIndex = 0; + for (var i; (i = wL.exec(n)) != null; ) { + var a = i[1], o = gt(F_, a) ? F_[a] : null; + o && (e[o] = i[2]); + var s = gt($_, a) ? $_[a] : null; + s && (t[s] = i[2]); + } + } +} +function cae(r, e, t) { + for (var n = 0; n < gL.length; n++) { + var i = gL[n], a = r.getAttribute(i); + a != null && (e[F_[i]] = a); + } + for (var n = 0; n < mL.length; n++) { + var i = mL[n], a = r.getAttribute(i); + a != null && (t[$_[i]] = a); + } +} +function xH(r, e) { + var t = e.width / r.width, n = e.height / r.height, i = Math.min(t, n); + return { + scale: i, + x: -(r.x + r.width / 2) * i + (e.x + e.width / 2), + y: -(r.y + r.height / 2) * i + (e.y + e.height / 2) + }; +} +function hae(r, e) { + var t = new nae(); + return t.parse(r, e); +} +var fae = xt([ + "rect", + "circle", + "line", + "ellipse", + "polygon", + "polyline", + "path", + // are also enabled because some SVG might paint text itself, + // but still need to trigger events or tooltip. + "text", + "tspan", + // is also enabled because this case: if multiple tags share one name + // and need label displayed, every tags will display the name, which is not + // expected. So we can put them into a . Thereby only one label + // displayed and located based on the bounding rect of the . + "g" +]), dae = ( + /** @class */ + function() { + function r(e, t) { + this.type = "geoSVG", this._usedGraphicMap = xt(), this._freedGraphics = [], this._mapName = e, this._parsedXML = _H(t); + } + return r.prototype.load = function() { + var e = this._firstGraphic; + if (!e) { + e = this._firstGraphic = this._buildGraphic(this._parsedXML), this._freedGraphics.push(e), this._boundingRect = this._firstGraphic.boundingRect.clone(); + var t = pae(e.named), n = t.regions, i = t.regionsMap; + this._regions = n, this._regionsMap = i; + } + return { + boundingRect: this._boundingRect, + regions: this._regions, + regionsMap: this._regionsMap + }; + }, r.prototype._buildGraphic = function(e) { + var t, n; + try { + t = e && hae(e, { + ignoreViewBox: !0, + ignoreRootClip: !0 + }) || {}, n = t.root, pa(n != null); + } catch (p) { + throw new Error(`Invalid svg format +` + p.message); + } + var i = new Rt(); + i.add(n), i.isGeoSVGGraphicRoot = !0; + var a = t.width, o = t.height, s = t.viewBoxRect, l = this._boundingRect; + if (!l) { + var u = void 0, c = void 0, h = void 0, f = void 0; + if (a != null ? (u = 0, h = a) : s && (u = s.x, h = s.width), o != null ? (c = 0, f = o) : s && (c = s.y, f = s.height), u == null || c == null) { + var v = n.getBoundingRect(); + u == null && (u = v.x, h = v.width), c == null && (c = v.y, f = v.height); + } + l = this._boundingRect = new Wt(u, c, h, f); + } + if (s) { + var b = xH(s, l); + n.scaleX = n.scaleY = b.scale, n.x = b.x, n.y = b.y; + } + i.setClipPath(new Or({ + shape: l.plain() + })); + var w = []; + return X(t.named, function(p) { + fae.get(p.svgNodeTagLower) != null && (w.push(p), vae(p.el)); + }), { + root: i, + boundingRect: l, + named: w + }; + }, r.prototype.useGraphic = function(e) { + var t = this._usedGraphicMap, n = t.get(e); + return n || (n = this._freedGraphics.pop() || this._buildGraphic(this._parsedXML), t.set(e, n), n); + }, r.prototype.freeGraphic = function(e) { + var t = this._usedGraphicMap, n = t.get(e); + n && (t.removeKey(e), this._freedGraphics.push(n)); + }, r; + }() +); +function vae(r) { + r.silent = !1, r.isGroup && r.traverse(function(e) { + e.silent = !1; + }); +} +function pae(r) { + var e = [], t = xt(); + return X(r, function(n) { + if (n.namedFrom == null) { + var i = new zte(n.name, n.el); + e.push(i), t.set(n.name, i); + } + }), { + regions: e, + regionsMap: t + }; +} +var dT = [126, 25], CL = "南海诸岛", dh = [[[0, 3.5], [7, 11.2], [15, 11.9], [30, 7], [42, 0.7], [52, 0.7], [56, 7.7], [59, 0.7], [64, 0.7], [64, 0], [5, 0], [0, 3.5]], [[13, 16.1], [19, 14.7], [16, 21.7], [11, 23.1], [13, 16.1]], [[12, 32.2], [14, 38.5], [15, 38.5], [13, 32.2], [12, 32.2]], [[16, 47.6], [12, 53.2], [13, 53.2], [18, 47.6], [16, 47.6]], [[6, 64.4], [8, 70], [9, 70], [8, 64.4], [6, 64.4]], [[23, 82.6], [29, 79.8], [30, 79.8], [25, 82.6], [23, 82.6]], [[37, 70.7], [43, 62.3], [44, 62.3], [39, 70.7], [37, 70.7]], [[48, 51.1], [51, 45.5], [53, 45.5], [50, 51.1], [48, 51.1]], [[51, 35], [51, 28.7], [53, 28.7], [53, 35], [51, 35]], [[52, 22.4], [55, 17.5], [56, 17.5], [53, 22.4], [52, 22.4]], [[58, 12.6], [62, 7], [63, 7], [60, 12.6], [58, 12.6]], [[0, 3.5], [0, 93.1], [64, 93.1], [64, 0], [63, 0], [63, 92.4], [1, 92.4], [1, 3.5], [0, 3.5]]]; +for (var ch = 0; ch < dh.length; ch++) + for (var Zf = 0; Zf < dh[ch].length; Zf++) + dh[ch][Zf][0] /= 10.5, dh[ch][Zf][1] /= -10.5 / 0.75, dh[ch][Zf][0] += dT[0], dh[ch][Zf][1] += dT[1]; +function gae(r, e) { + if (r === "china") { + for (var t = 0; t < e.length; t++) + if (e[t].name === CL) + return; + e.push(new l$(CL, Ke(dh, function(n) { + return { + type: "polygon", + exterior: n + }; + }), dT)); + } +} +var mae = { + 南海诸岛: [32, 80], + // 全国 + 广东: [0, -10], + 香港: [10, 5], + 澳门: [-10, 10], + // '北京': [-10, 0], + 天津: [5, 5] +}; +function yae(r, e) { + if (r === "china") { + var t = mae[e.name]; + if (t) { + var n = e.getCenter(); + n[0] += t[0] / 10.5, n[1] += -t[1] / (10.5 / 0.75), e.setCenter(n); + } + } +} +var _ae = [[[123.45165252685547, 25.73527164402261], [123.49731445312499, 25.73527164402261], [123.49731445312499, 25.750734064600884], [123.45165252685547, 25.750734064600884], [123.45165252685547, 25.73527164402261]]]; +function bae(r, e) { + r === "china" && e.name === "台湾" && e.geometries.push({ + type: "polygon", + exterior: _ae[0] + }); +} +var xae = "name", Sae = ( + /** @class */ + function() { + function r(e, t, n) { + this.type = "geoJSON", this._parsedMap = xt(), this._mapName = e, this._specialAreas = n, this._geoJSON = Cae(t); + } + return r.prototype.load = function(e, t) { + t = t || xae; + var n = this._parsedMap.get(t); + if (!n) { + var i = this._parseToRegions(t); + n = this._parsedMap.set(t, { + regions: i, + boundingRect: wae(i) + }); + } + var a = xt(), o = []; + return X(n.regions, function(s) { + var l = s.name; + e && gt(e, l) && (s = s.cloneShallow(l = e[l])), o.push(s), a.set(l, s); + }), { + regions: o, + boundingRect: n.boundingRect || new Wt(0, 0, 0, 0), + regionsMap: a + }; + }, r.prototype._parseToRegions = function(e) { + var t = this._mapName, n = this._geoJSON, i; + try { + i = n ? Tg(n, e) : []; + } catch (a) { + throw new Error(`Invalid geoJson format +` + a.message); + } + return gae(t, i), X(i, function(a) { + var o = a.name; + yae(t, a), bae(t, a); + var s = this._specialAreas && this._specialAreas[o]; + s && a.transformTo(s.left, s.top, s.width, s.height); + }, this), i; + }, r.prototype.getMapForUser = function() { + return { + // For backward compatibility, use geoJson + // PENDING: it has been returning them without clone. + // do we need to avoid outsite modification? + geoJson: this._geoJSON, + geoJSON: this._geoJSON, + specialAreas: this._specialAreas + }; + }, r; + }() +); +function wae(r) { + for (var e, t = 0; t < r.length; t++) { + var n = r[t].getBoundingRect(); + e = e || n.clone(), e.union(n); + } + return e; +} +function Cae(r) { + return ut(r) ? typeof JSON != "undefined" && JSON.parse ? JSON.parse(r) : new Function("return (" + r + ");")() : r; +} +var fp = xt(); +const ou = { + /** + * Compatible with previous `echarts.registerMap`. + * + * @usage + * ```js + * + * echarts.registerMap('USA', geoJson, specialAreas); + * + * echarts.registerMap('USA', { + * geoJson: geoJson, + * specialAreas: {...} + * }); + * echarts.registerMap('USA', { + * geoJSON: geoJson, + * specialAreas: {...} + * }); + * + * echarts.registerMap('airport', { + * svg: svg + * } + * ``` + * + * Note: + * Do not support that register multiple geoJSON or SVG + * one map name. Because different geoJSON and SVG have + * different unit. It's not easy to make sure how those + * units are mapping/normalize. + * If intending to use multiple geoJSON or SVG, we can + * use multiple geo coordinate system. + */ + registerMap: function(r, e, t) { + if (e.svg) { + var n = new dae(r, e.svg); + fp.set(r, n); + } else { + var i = e.geoJson || e.geoJSON; + i && !e.features ? t = e.specialAreas : i = e; + var n = new Sae(r, i, t); + fp.set(r, n); + } + }, + getGeoResource: function(r) { + return fp.get(r); + }, + /** + * Only for exporting to users. + * **MUST NOT** used internally. + */ + getMapForUser: function(r) { + var e = fp.get(r); + return e && e.type === "geoJSON" && e.getMapForUser(); + }, + load: function(r, e, t) { + var n = fp.get(r); + if (n) + return n.load(e, t); + } +}; +var rE = ["rect", "circle", "line", "ellipse", "polygon", "polyline", "path"], Tae = xt(rE), Iae = xt(rE.concat(["g"])), Aae = xt(rE.concat(["g"])), SH = Rr(); +function a0(r) { + var e = r.getItemStyle(), t = r.get("areaColor"); + return t != null && (e.fill = t), e; +} +function TL(r) { + var e = r.style; + e && (e.stroke = e.stroke || e.fill, e.fill = null); +} +var Eae = ( + /** @class */ + function() { + function r(e) { + var t = new Rt(); + this.uid = tv("ec_map_draw"), this._controller = new vm(e.getZr()), this._controllerHost = { + target: t + }, this.group = t, t.add(this._regionsGroup = new Rt()), t.add(this._svgGroup = new Rt()); + } + return r.prototype.draw = function(e, t, n, i, a) { + var o = e.mainType === "geo", s = e.getData && e.getData(); + o && t.eachComponent({ + mainType: "series", + subType: "map" + }, function(d) { + !s && d.getHostGeoModel() === e && (s = d.getData()); + }); + var l = e.coordinateSystem, u = this._regionsGroup, c = this.group, h = l.getTransformInfo(), f = h.raw, v = h.roam, b = !u.childAt(0) || a; + b ? (c.x = v.x, c.y = v.y, c.scaleX = v.scaleX, c.scaleY = v.scaleY, c.dirty()) : zr(c, v, e); + var w = s && s.getVisual("visualMeta") && s.getVisual("visualMeta").length > 0, p = { + api: n, + geo: l, + mapOrGeoModel: e, + data: s, + isVisualEncodedByVisualMap: w, + isGeo: o, + transformInfoRaw: f + }; + l.resourceType === "geoJSON" ? this._buildGeoJSON(p) : l.resourceType === "geoSVG" && this._buildSVG(p), this._updateController(e, t, n), this._updateMapSelectHandler(e, u, n, i); + }, r.prototype._buildGeoJSON = function(e) { + var t = this._regionsGroupByName = xt(), n = xt(), i = this._regionsGroup, a = e.transformInfoRaw, o = e.mapOrGeoModel, s = e.data, l = e.geo.projection, u = l && l.stream; + function c(v, b) { + return b && (v = b(v)), v && [v[0] * a.scaleX + a.x, v[1] * a.scaleY + a.y]; + } + function h(v) { + for (var b = [], w = !u && l && l.project, p = 0; p < v.length; ++p) { + var d = c(v[p], w); + d && b.push(d); + } + return b; + } + function f(v) { + return { + shape: { + points: h(v) + } + }; + } + i.removeAll(), X(e.geo.regions, function(v) { + var b = v.name, w = t.get(b), p = n.get(b) || {}, d = p.dataIdx, m = p.regionModel; + w || (w = t.set(b, new Rt()), i.add(w), d = s ? s.indexOfName(b) : null, m = e.isGeo ? o.getRegionModel(b) : s ? s.getItemModel(d) : null, n.set(b, { + dataIdx: d, + regionModel: m + })); + var _ = [], y = []; + X(v.geometries, function(S) { + if (S.type === "polygon") { + var T = [S.exterior].concat(S.interiors || []); + u && (T = kL(T, u)), X(T, function(E) { + _.push(new La(f(E))); + }); + } else { + var C = S.points; + u && (C = kL(C, u, !0)), X(C, function(E) { + y.push(new Pa(f(E))); + }); + } + }); + var x = c(v.getCenter(), l && l.project); + function g(S, T) { + if (S.length) { + var C = new jb({ + culling: !0, + segmentIgnoreThreshold: 1, + shape: { + paths: S + } + }); + w.add(C), IL(e, C, d, m), AL(e, C, b, m, o, d, x), T && (TL(C), X(C.states, TL)); + } + } + g(_), g(y, !0); + }), t.each(function(v, b) { + var w = n.get(b), p = w.dataIdx, d = w.regionModel; + EL(e, v, b, d, o, p), ML(e, v, b, d, o), DL(e, v, b, d, o); + }, this); + }, r.prototype._buildSVG = function(e) { + var t = e.geo.map, n = e.transformInfoRaw; + this._svgGroup.x = n.x, this._svgGroup.y = n.y, this._svgGroup.scaleX = n.scaleX, this._svgGroup.scaleY = n.scaleY, this._svgResourceChanged(t) && (this._freeSVG(), this._useSVG(t)); + var i = this._svgDispatcherMap = xt(), a = !1; + X(this._svgGraphicRecord.named, function(o) { + var s = o.name, l = e.mapOrGeoModel, u = e.data, c = o.svgNodeTagLower, h = o.el, f = u ? u.indexOfName(s) : null, v = l.getRegionModel(s); + if (Tae.get(c) != null && h instanceof ts && IL(e, h, f, v), h instanceof ts && (h.culling = !0), h.z2EmphasisLift = 0, !o.namedFrom && (Aae.get(c) != null && AL(e, h, s, v, l, f, null), EL(e, h, s, v, l, f), ML(e, h, s, v, l), Iae.get(c) != null)) { + var b = DL(e, h, s, v, l); + b === "self" && (a = !0); + var w = i.get(s) || i.set(s, []); + w.push(h); + } + }, this), this._enableBlurEntireSVG(a, e); + }, r.prototype._enableBlurEntireSVG = function(e, t) { + if (e && t.isGeo) { + var n = t.mapOrGeoModel.getModel(["blur", "itemStyle"]).getItemStyle(), i = n.opacity; + this._svgGraphicRecord.root.traverse(function(a) { + if (!a.isGroup) { + Yh(a); + var o = a.ensureState("blur").style || {}; + o.opacity == null && i != null && (o.opacity = i), a.ensureState("emphasis"); + } + }); + } + }, r.prototype.remove = function() { + this._regionsGroup.removeAll(), this._regionsGroupByName = null, this._svgGroup.removeAll(), this._freeSVG(), this._controller.dispose(), this._controllerHost = null; + }, r.prototype.findHighDownDispatchers = function(e, t) { + if (e == null) + return []; + var n = t.coordinateSystem; + if (n.resourceType === "geoJSON") { + var i = this._regionsGroupByName; + if (i) { + var a = i.get(e); + return a ? [a] : []; + } + } else if (n.resourceType === "geoSVG") + return this._svgDispatcherMap && this._svgDispatcherMap.get(e) || []; + }, r.prototype._svgResourceChanged = function(e) { + return this._svgMapName !== e; + }, r.prototype._useSVG = function(e) { + var t = ou.getGeoResource(e); + if (t && t.type === "geoSVG") { + var n = t.useGraphic(this.uid); + this._svgGroup.add(n.root), this._svgGraphicRecord = n, this._svgMapName = e; + } + }, r.prototype._freeSVG = function() { + var e = this._svgMapName; + if (e != null) { + var t = ou.getGeoResource(e); + t && t.type === "geoSVG" && t.freeGraphic(this.uid), this._svgGraphicRecord = null, this._svgDispatcherMap = null, this._svgGroup.removeAll(), this._svgMapName = null; + } + }, r.prototype._updateController = function(e, t, n) { + var i = e.coordinateSystem, a = this._controller, o = this._controllerHost; + o.zoomLimit = e.get("scaleLimit"), o.zoom = i.getZoom(), a.enable(e.get("roam") || !1); + var s = e.mainType; + function l() { + var u = { + type: "geoRoam", + componentType: s + }; + return u[s + "Id"] = e.id, u; + } + a.off("pan").on("pan", function(u) { + this._mouseDownFlag = !1, eE(o, u.dx, u.dy), n.dispatchAction(Fe(l(), { + dx: u.dx, + dy: u.dy, + animation: { + duration: 0 + } + })); + }, this), a.off("zoom").on("zoom", function(u) { + this._mouseDownFlag = !1, tE(o, u.scale, u.originX, u.originY), n.dispatchAction(Fe(l(), { + zoom: u.scale, + originX: u.originX, + originY: u.originY, + animation: { + duration: 0 + } + })); + }, this), a.setPointerChecker(function(u, c, h) { + return i.containPoint([c, h]) && !ux(u, n, e); + }); + }, r.prototype.resetForLabelLayout = function() { + this.group.traverse(function(e) { + var t = e.getTextContent(); + t && (t.ignore = SH(t).ignore); + }); + }, r.prototype._updateMapSelectHandler = function(e, t, n, i) { + var a = this; + t.off("mousedown"), t.off("click"), e.get("selectedMode") && (t.on("mousedown", function() { + a._mouseDownFlag = !0; + }), t.on("click", function(o) { + a._mouseDownFlag && (a._mouseDownFlag = !1); + })); + }, r; + }() +); +function IL(r, e, t, n) { + var i = n.getModel("itemStyle"), a = n.getModel(["emphasis", "itemStyle"]), o = n.getModel(["blur", "itemStyle"]), s = n.getModel(["select", "itemStyle"]), l = a0(i), u = a0(a), c = a0(s), h = a0(o), f = r.data; + if (f) { + var v = f.getItemVisual(t, "style"), b = f.getItemVisual(t, "decal"); + r.isVisualEncodedByVisualMap && v.fill && (l.fill = v.fill), b && (l.decal = Nd(b, r.api)); + } + e.setStyle(l), e.style.strokeNoScale = !0, e.ensureState("emphasis").style = u, e.ensureState("select").style = c, e.ensureState("blur").style = h, Yh(e); +} +function AL(r, e, t, n, i, a, o) { + var s = r.data, l = r.isGeo, u = s && isNaN(s.get(s.mapDimension("value"), a)), c = s && s.getItemLayout(a); + if (l || u || c && c.showLabel) { + var h = l ? t : a, f = void 0; + (!s || a >= 0) && (f = i); + var v = o ? { + normal: { + align: "center", + verticalAlign: "middle" + } + } : null; + Zi(e, Mi(n), { + labelFetcher: f, + labelDataIndex: h, + defaultText: t + }, v); + var b = e.getTextContent(); + if (b && (SH(b).ignore = b.ignore, e.textConfig && o)) { + var w = e.getBoundingRect().clone(); + e.textConfig.layoutRect = w, e.textConfig.position = [(o[0] - w.x) / w.width * 100 + "%", (o[1] - w.y) / w.height * 100 + "%"]; + } + e.disableLabelAnimation = !0; + } else + e.removeTextContent(), e.removeTextConfig(), e.disableLabelAnimation = null; +} +function EL(r, e, t, n, i, a) { + r.data ? r.data.setItemGraphicEl(a, e) : Ft(e).eventData = { + componentType: "geo", + componentIndex: i.componentIndex, + geoIndex: i.componentIndex, + name: t, + region: n && n.option || {} + }; +} +function ML(r, e, t, n, i) { + r.data || qd({ + el: e, + componentModel: i, + itemName: t, + // @ts-ignore FIXME:TS fix the "compatible with each other"? + itemTooltipOption: n.get("tooltip") + }); +} +function DL(r, e, t, n, i) { + e.highDownSilentOnTouch = !!i.get("selectedMode"); + var a = n.getModel("emphasis"), o = a.get("focus"); + return Un(e, o, a.get("blurScope"), a.get("disabled")), r.isGeo && jJ(e, i, t), o; +} +function kL(r, e, t) { + var n = [], i; + function a() { + i = []; + } + function o() { + i.length && (n.push(i), i = []); + } + var s = e({ + polygonStart: a, + polygonEnd: o, + lineStart: a, + lineEnd: o, + point: function(l, u) { + isFinite(l) && isFinite(u) && i.push([l, u]); + }, + sphere: function() { + } + }); + return !t && s.polygonStart(), X(r, function(l) { + s.lineStart(); + for (var u = 0; u < l.length; u++) + s.point(l[u][0], l[u][1]); + s.lineEnd(); + }), !t && s.polygonEnd(), n; +} +const wH = Eae; +var Mae = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i, a) { + if (!(a && a.type === "mapToggleSelect" && a.from === this.uid)) { + var o = this.group; + if (o.removeAll(), !t.getHostGeoModel()) { + if (this._mapDraw && a && a.type === "geoRoam" && this._mapDraw.resetForLabelLayout(), a && a.type === "geoRoam" && a.componentType === "series" && a.seriesId === t.id) { + var s = this._mapDraw; + s && o.add(s.group); + } else if (t.needsDrawMap) { + var s = this._mapDraw || new wH(i); + o.add(s.group), s.draw(t, n, i, this, a), this._mapDraw = s; + } else + this._mapDraw && this._mapDraw.remove(), this._mapDraw = null; + t.get("showLegendSymbol") && n.getComponent("legend") && this._renderSymbols(t, n, i); + } + } + }, e.prototype.remove = function() { + this._mapDraw && this._mapDraw.remove(), this._mapDraw = null, this.group.removeAll(); + }, e.prototype.dispose = function() { + this._mapDraw && this._mapDraw.remove(), this._mapDraw = null; + }, e.prototype._renderSymbols = function(t, n, i) { + var a = t.originalData, o = this.group; + a.each(a.mapDimension("value"), function(s, l) { + if (!isNaN(s)) { + var u = a.getItemLayout(l); + if (!(!u || !u.point)) { + var c = u.point, h = u.offset, f = new $s({ + style: { + // Because the special of map draw. + // Which needs statistic of multiple series and draw on one map. + // And each series also need a symbol with legend color + // + // Layout and visual are put one the different data + // TODO + fill: t.getData().getVisual("style").fill + }, + shape: { + cx: c[0] + h * 9, + cy: c[1], + r: 3 + }, + silent: !0, + // Do not overlap the first series, on which labels are displayed. + z2: 8 + (h ? 0 : Zd + 1) + }); + if (!h) { + var v = t.mainSeries.getData(), b = a.getName(l), w = v.indexOfName(b), p = a.getItemModel(l), d = p.getModel("label"), m = v.getItemGraphicEl(w); + Zi(f, Mi(p), { + labelFetcher: { + getFormattedLabel: function(_, y) { + return t.getFormattedLabel(w, y); + } + }, + defaultText: b + }), f.disableLabelAnimation = !0, d.get("position") || f.setTextConfig({ + position: "bottom" + }), m.onHoverStateChange = function(_) { + m_(f, _); + }; + } + o.add(f); + } + } + }); + }, e.type = "map", e; + }(en) +); +const Dae = Mae; +var kae = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.needsDrawMap = !1, t.seriesGroup = [], t.getTooltipPosition = function(n) { + if (n != null) { + var i = this.getData().getName(n), a = this.coordinateSystem, o = a.getRegion(i); + return o && a.dataToPoint(o.getCenter()); + } + }, t; + } + return e.prototype.getInitialData = function(t) { + for (var n = hv(this, { + coordDimensions: ["value"], + encodeDefaulter: jt(fA, this) + }), i = xt(), a = [], o = 0, s = n.count(); o < s; o++) { + var l = n.getName(o); + i.set(l, !0); + } + var u = ou.load(this.getMapType(), this.option.nameMap, this.option.nameProperty); + return X(u.regions, function(c) { + var h = c.name; + i.get(h) || a.push(h); + }), n.appendValues([], a), n; + }, e.prototype.getHostGeoModel = function() { + var t = this.option.geoIndex; + return t != null ? this.ecModel.getComponent("geo", t) : null; + }, e.prototype.getMapType = function() { + return (this.getHostGeoModel() || this).option.map; + }, e.prototype.getRawValue = function(t) { + var n = this.getData(); + return n.get(n.mapDimension("value"), t); + }, e.prototype.getRegionModel = function(t) { + var n = this.getData(); + return n.getItemModel(n.indexOfName(t)); + }, e.prototype.formatTooltip = function(t, n, i) { + for (var a = this.getData(), o = this.getRawValue(t), s = a.getName(t), l = this.seriesGroup, u = [], c = 0; c < l.length; c++) { + var h = l[c].originalData.indexOfName(s), f = a.mapDimension("value"); + isNaN(l[c].originalData.get(f, h)) || u.push(l[c].name); + } + return Di("section", { + header: u.join(", "), + noHeader: !u.length, + blocks: [Di("nameValue", { + name: s, + value: o + })] + }); + }, e.prototype.setZoom = function(t) { + this.option.zoom = t; + }, e.prototype.setCenter = function(t) { + this.option.center = t; + }, e.prototype.getLegendIcon = function(t) { + var n = t.icon || "roundRect", i = li(n, 0, 0, t.itemWidth, t.itemHeight, t.itemStyle.fill); + return i.setStyle(t.itemStyle), i.style.stroke = "none", n.indexOf("empty") > -1 && (i.style.stroke = i.style.fill, i.style.fill = "#fff", i.style.lineWidth = 2), i; + }, e.type = "series.map", e.dependencies = ["geo"], e.layoutMode = "box", e.defaultOption = { + // 一级层叠 + // zlevel: 0, + // 二级层叠 + z: 2, + coordinateSystem: "geo", + // map should be explicitly specified since ec3. + map: "", + // If `geoIndex` is not specified, a exclusive geo will be + // created. Otherwise use the specified geo component, and + // `map` and `mapType` are ignored. + // geoIndex: 0, + // 'center' | 'left' | 'right' | 'x%' | {number} + left: "center", + // 'center' | 'top' | 'bottom' | 'x%' | {number} + top: "center", + // right + // bottom + // width: + // height + // Aspect is width / height. Inited to be geoJson bbox aspect + // This parameter is used for scale this aspect + // Default value: + // for geoSVG source: 1, + // for geoJSON source: 0.75. + aspectScale: null, + // Layout with center and size + // If you want to put map in a fixed size box with right aspect ratio + // This two properties may be more convenient. + // layoutCenter: [50%, 50%] + // layoutSize: 100 + showLegendSymbol: !0, + // Define left-top, right-bottom coords to control view + // For example, [ [180, 90], [-180, -90] ], + // higher priority than center and zoom + boundingCoords: null, + // Default on center of map + center: null, + zoom: 1, + scaleLimit: null, + selectedMode: !0, + label: { + show: !1, + color: "#000" + }, + // scaleLimit: null, + itemStyle: { + borderWidth: 0.5, + borderColor: "#444", + areaColor: "#eee" + }, + emphasis: { + label: { + show: !0, + color: "rgb(100,0,0)" + }, + itemStyle: { + areaColor: "rgba(255,215,0,0.8)" + } + }, + select: { + label: { + show: !0, + color: "rgb(100,0,0)" + }, + itemStyle: { + color: "rgba(255,215,0,0.8)" + } + }, + nameProperty: "name" + }, e; + }(mn) +); +const Oae = kae; +function Lae(r, e) { + var t = {}; + return X(r, function(n) { + n.each(n.mapDimension("value"), function(i, a) { + var o = "ec-" + n.getName(a); + t[o] = t[o] || [], isNaN(i) || t[o].push(i); + }); + }), r[0].map(r[0].mapDimension("value"), function(n, i) { + for (var a = "ec-" + r[0].getName(i), o = 0, s = 1 / 0, l = -1 / 0, u = t[a].length, c = 0; c < u; c++) + s = Math.min(s, t[a][c]), l = Math.max(l, t[a][c]), o += t[a][c]; + var h; + return e === "min" ? h = s : e === "max" ? h = l : e === "average" ? h = o / u : h = o, u === 0 ? NaN : h; + }); +} +function Pae(r) { + var e = {}; + r.eachSeriesByType("map", function(t) { + var n = t.getHostGeoModel(), i = n ? "o" + n.id : "i" + t.getMapType(); + (e[i] = e[i] || []).push(t); + }), X(e, function(t, n) { + for (var i = Lae(Ke(t, function(o) { + return o.getData(); + }), t[0].get("mapValueCalculation")), a = 0; a < t.length; a++) + t[a].originalData = t[a].getData(); + for (var a = 0; a < t.length; a++) + t[a].seriesGroup = t, t[a].needsDrawMap = a === 0 && !t[a].getHostGeoModel(), t[a].setData(i.cloneShallow()), t[a].mainSeries = t[0]; + }); +} +function Rae(r) { + var e = {}; + r.eachSeriesByType("map", function(t) { + var n = t.getMapType(); + if (!(t.getHostGeoModel() || e[n])) { + var i = {}; + X(t.seriesGroup, function(o) { + var s = o.coordinateSystem, l = o.originalData; + o.get("showLegendSymbol") && r.getComponent("legend") && l.each(l.mapDimension("value"), function(u, c) { + var h = l.getName(c), f = s.getRegion(h); + if (!(!f || isNaN(u))) { + var v = i[h] || 0, b = s.dataToPoint(f.getCenter()); + i[h] = v + 1, l.setItemLayout(c, { + point: b, + offset: v + }); + } + }); + }); + var a = t.getData(); + a.each(function(o) { + var s = a.getName(o), l = a.getItemLayout(o) || {}; + l.showLabel = !i[s], a.setItemLayout(o, l); + }), e[n] = !0; + } + }); +} +var OL = zi, Nae = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this) || this; + return n.type = "view", n.dimensions = ["x", "y"], n._roamTransformable = new Yl(), n._rawTransformable = new Yl(), n.name = t, n; + } + return e.prototype.setBoundingRect = function(t, n, i, a) { + return this._rect = new Wt(t, n, i, a), this._rect; + }, e.prototype.getBoundingRect = function() { + return this._rect; + }, e.prototype.setViewRect = function(t, n, i, a) { + this._transformTo(t, n, i, a), this._viewRect = new Wt(t, n, i, a); + }, e.prototype._transformTo = function(t, n, i, a) { + var o = this.getBoundingRect(), s = this._rawTransformable; + s.transform = o.calculateTransform(new Wt(t, n, i, a)); + var l = s.parent; + s.parent = null, s.decomposeTransform(), s.parent = l, this._updateTransform(); + }, e.prototype.setCenter = function(t, n) { + t && (this._center = [ot(t[0], n.getWidth()), ot(t[1], n.getHeight())], this._updateCenterAndZoom()); + }, e.prototype.setZoom = function(t) { + t = t || 1; + var n = this.zoomLimit; + n && (n.max != null && (t = Math.min(n.max, t)), n.min != null && (t = Math.max(n.min, t))), this._zoom = t, this._updateCenterAndZoom(); + }, e.prototype.getDefaultCenter = function() { + var t = this.getBoundingRect(), n = t.x + t.width / 2, i = t.y + t.height / 2; + return [n, i]; + }, e.prototype.getCenter = function() { + return this._center || this.getDefaultCenter(); + }, e.prototype.getZoom = function() { + return this._zoom || 1; + }, e.prototype.getRoamTransform = function() { + return this._roamTransformable.getLocalTransform(); + }, e.prototype._updateCenterAndZoom = function() { + var t = this._rawTransformable.getLocalTransform(), n = this._roamTransformable, i = this.getDefaultCenter(), a = this.getCenter(), o = this.getZoom(); + a = zi([], a, t), i = zi([], i, t), n.originX = a[0], n.originY = a[1], n.x = i[0] - a[0], n.y = i[1] - a[1], n.scaleX = n.scaleY = o, this._updateTransform(); + }, e.prototype._updateTransform = function() { + var t = this._roamTransformable, n = this._rawTransformable; + n.parent = t, t.updateTransform(), n.updateTransform(), Ib(this.transform || (this.transform = []), n.transform || io()), this._rawTransform = n.getLocalTransform(), this.invTransform = this.invTransform || [], nf(this.invTransform, this.transform), this.decomposeTransform(); + }, e.prototype.getTransformInfo = function() { + var t = this._rawTransformable, n = this._roamTransformable, i = new Yl(); + return i.transform = n.transform, i.decomposeTransform(), { + roam: { + x: i.x, + y: i.y, + scaleX: i.scaleX, + scaleY: i.scaleY + }, + raw: { + x: t.x, + y: t.y, + scaleX: t.scaleX, + scaleY: t.scaleY + } + }; + }, e.prototype.getViewRect = function() { + return this._viewRect; + }, e.prototype.getViewRectAfterRoam = function() { + var t = this.getBoundingRect().clone(); + return t.applyTransform(this.transform), t; + }, e.prototype.dataToPoint = function(t, n, i) { + var a = n ? this._rawTransform : this.transform; + return i = i || [], a ? OL(i, t, a) : ca(i, t); + }, e.prototype.pointToData = function(t) { + var n = this.invTransform; + return n ? OL([], t, n) : [t[0], t[1]]; + }, e.prototype.convertToPixel = function(t, n, i) { + var a = LL(n); + return a === this ? a.dataToPoint(i) : null; + }, e.prototype.convertFromPixel = function(t, n, i) { + var a = LL(n); + return a === this ? a.pointToData(i) : null; + }, e.prototype.containPoint = function(t) { + return this.getViewRectAfterRoam().contain(t[0], t[1]); + }, e.dimensions = ["x", "y"], e; + }(Yl) +); +function LL(r) { + var e = r.seriesModel; + return e ? e.coordinateSystem : null; +} +const pm = Nae; +var zae = { + geoJSON: { + aspectScale: 0.75, + invertLongitute: !0 + }, + geoSVG: { + aspectScale: 1, + invertLongitute: !1 + } +}, CH = ["lng", "lat"], TH = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this, t) || this; + a.dimensions = CH, a.type = "geo", a._nameCoordMap = xt(), a.map = n; + var o = i.projection, s = ou.load(n, i.nameMap, i.nameProperty), l = ou.getGeoResource(n); + a.resourceType = l ? l.type : null; + var u = a.regions = s.regions, c = zae[l.type]; + a._regionsMap = s.regionsMap, a.regions = s.regions, a.projection = o; + var h; + if (o) + for (var f = 0; f < u.length; f++) { + var v = u[f].getBoundingRect(o); + h = h || v.clone(), h.union(v); + } + else + h = s.boundingRect; + return a.setBoundingRect(h.x, h.y, h.width, h.height), a.aspectScale = o ? 1 : Jt(i.aspectScale, c.aspectScale), a._invertLongitute = o ? !1 : c.invertLongitute, a; + } + return e.prototype._transformTo = function(t, n, i, a) { + var o = this.getBoundingRect(), s = this._invertLongitute; + o = o.clone(), s && (o.y = -o.y - o.height); + var l = this._rawTransformable; + l.transform = o.calculateTransform(new Wt(t, n, i, a)); + var u = l.parent; + l.parent = null, l.decomposeTransform(), l.parent = u, s && (l.scaleY = -l.scaleY), this._updateTransform(); + }, e.prototype.getRegion = function(t) { + return this._regionsMap.get(t); + }, e.prototype.getRegionByCoord = function(t) { + for (var n = this.regions, i = 0; i < n.length; i++) { + var a = n[i]; + if (a.type === "geoJSON" && a.contain(t)) + return n[i]; + } + }, e.prototype.addGeoCoord = function(t, n) { + this._nameCoordMap.set(t, n); + }, e.prototype.getGeoCoord = function(t) { + var n = this._regionsMap.get(t); + return this._nameCoordMap.get(t) || n && n.getCenter(); + }, e.prototype.dataToPoint = function(t, n, i) { + if (ut(t) && (t = this.getGeoCoord(t)), t) { + var a = this.projection; + return a && (t = a.project(t)), t && this.projectedToPoint(t, n, i); + } + }, e.prototype.pointToData = function(t) { + var n = this.projection; + return n && (t = n.unproject(t)), t && this.pointToProjected(t); + }, e.prototype.pointToProjected = function(t) { + return r.prototype.pointToData.call(this, t); + }, e.prototype.projectedToPoint = function(t, n, i) { + return r.prototype.dataToPoint.call(this, t, n, i); + }, e.prototype.convertToPixel = function(t, n, i) { + var a = PL(n); + return a === this ? a.dataToPoint(i) : null; + }, e.prototype.convertFromPixel = function(t, n, i) { + var a = PL(n); + return a === this ? a.pointToData(i) : null; + }, e; + }(pm) +); +qn(TH, pm); +function PL(r) { + var e = r.geoModel, t = r.seriesModel; + return e ? e.coordinateSystem : t ? t.coordinateSystem || (t.getReferringComponents("geo", mi).models[0] || {}).coordinateSystem : null; +} +const RL = TH; +function NL(r, e) { + var t = r.get("boundingCoords"); + if (t != null) { + var n = t[0], i = t[1]; + if (isFinite(n[0]) && isFinite(n[1]) && isFinite(i[0]) && isFinite(i[1])) { + var a = this.projection; + if (a) { + var o = n[0], s = n[1], l = i[0], u = i[1]; + n = [1 / 0, 1 / 0], i = [-1 / 0, -1 / 0]; + var c = function(g, S, T, C) { + for (var E = T - g, M = C - S, P = 0; P <= 100; P++) { + var R = P / 100, N = a.project([g + E * R, S + M * R]); + Ul(n, n, N), Wl(i, i, N); + } + }; + c(o, s, l, s), c(l, s, l, u), c(l, u, o, u), c(o, u, l, s); + } + this.setBoundingRect(n[0], n[1], i[0] - n[0], i[1] - n[1]); + } + } + var h = this.getBoundingRect(), f = r.get("layoutCenter"), v = r.get("layoutSize"), b = e.getWidth(), w = e.getHeight(), p = h.width / h.height * this.aspectScale, d = !1, m, _; + f && v && (m = [ot(f[0], b), ot(f[1], w)], _ = ot(v, Math.min(b, w)), !isNaN(m[0]) && !isNaN(m[1]) && !isNaN(_) && (d = !0)); + var y; + if (d) + y = {}, p > 1 ? (y.width = _, y.height = _ / p) : (y.height = _, y.width = _ * p), y.y = m[1] - y.height / 2, y.x = m[0] - y.width / 2; + else { + var x = r.getBoxLayoutParams(); + x.aspect = p, y = yi(x, { + width: b, + height: w + }); + } + this.setViewRect(y.x, y.y, y.width, y.height), this.setCenter(r.get("center"), e), this.setZoom(r.get("zoom")); +} +function Bae(r, e) { + X(e.get("geoCoord"), function(t, n) { + r.addGeoCoord(n, t); + }); +} +var jae = ( + /** @class */ + function() { + function r() { + this.dimensions = CH; + } + return r.prototype.create = function(e, t) { + var n = []; + function i(o) { + return { + nameProperty: o.get("nameProperty"), + aspectScale: o.get("aspectScale"), + projection: o.get("projection") + }; + } + e.eachComponent("geo", function(o, s) { + var l = o.get("map"), u = new RL(l + s, l, Fe({ + nameMap: o.get("nameMap") + }, i(o))); + u.zoomLimit = o.get("scaleLimit"), n.push(u), o.coordinateSystem = u, u.model = o, u.resize = NL, u.resize(o, t); + }), e.eachSeries(function(o) { + var s = o.get("coordinateSystem"); + if (s === "geo") { + var l = o.get("geoIndex") || 0; + o.coordinateSystem = n[l]; + } + }); + var a = {}; + return e.eachSeriesByType("map", function(o) { + if (!o.getHostGeoModel()) { + var s = o.getMapType(); + a[s] = a[s] || [], a[s].push(o); + } + }), X(a, function(o, s) { + var l = Ke(o, function(c) { + return c.get("nameMap"); + }), u = new RL(s, s, Fe({ + nameMap: wb(l) + }, i(o[0]))); + u.zoomLimit = Ii.apply(null, Ke(o, function(c) { + return c.get("scaleLimit"); + })), n.push(u), u.resize = NL, u.resize(o[0], t), X(o, function(c) { + c.coordinateSystem = u, Bae(u, c); + }); + }), n; + }, r.prototype.getFilledRegions = function(e, t, n, i) { + for (var a = (e || []).slice(), o = xt(), s = 0; s < a.length; s++) + o.set(a[s].name, a[s]); + var l = ou.load(t, n, i); + return X(l.regions, function(u) { + var c = u.name; + !o.get(c) && a.push({ + name: c + }); + }), a; + }, r; + }() +), Fae = new jae(); +const IH = Fae; +var $ae = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n, i) { + var a = ou.getGeoResource(t.map); + if (a && a.type === "geoJSON") { + var o = t.itemStyle = t.itemStyle || {}; + "color" in o || (o.color = "#eee"); + } + this.mergeDefaultAndTheme(t, i), Gh(t, "label", ["show"]); + }, e.prototype.optionUpdated = function() { + var t = this, n = this.option; + n.regions = IH.getFilledRegions(n.regions, n.map, n.nameMap, n.nameProperty); + var i = {}; + this._optionModelMap = es(n.regions || [], function(a, o) { + var s = o.name; + return s && (a.set(s, new qr(o, t, t.ecModel)), o.selected && (i[s] = !0)), a; + }, xt()), n.selectedMap || (n.selectedMap = i); + }, e.prototype.getRegionModel = function(t) { + return this._optionModelMap.get(t) || new qr(null, this, this.ecModel); + }, e.prototype.getFormattedLabel = function(t, n) { + var i = this.getRegionModel(t), a = n === "normal" ? i.get(["label", "formatter"]) : i.get(["emphasis", "label", "formatter"]), o = { + name: t + }; + if (Tt(a)) + return o.status = n, a(o); + if (ut(a)) + return a.replace("{a}", t != null ? t : ""); + }, e.prototype.setZoom = function(t) { + this.option.zoom = t; + }, e.prototype.setCenter = function(t) { + this.option.center = t; + }, e.prototype.select = function(t) { + var n = this.option, i = n.selectedMode; + if (i) { + i !== "multiple" && (n.selectedMap = null); + var a = n.selectedMap || (n.selectedMap = {}); + a[t] = !0; + } + }, e.prototype.unSelect = function(t) { + var n = this.option.selectedMap; + n && (n[t] = !1); + }, e.prototype.toggleSelected = function(t) { + this[this.isSelected(t) ? "unSelect" : "select"](t); + }, e.prototype.isSelected = function(t) { + var n = this.option.selectedMap; + return !!(n && n[t]); + }, e.type = "geo", e.layoutMode = "box", e.defaultOption = { + // zlevel: 0, + z: 0, + show: !0, + left: "center", + top: "center", + // Default value: + // for geoSVG source: 1, + // for geoJSON source: 0.75. + aspectScale: null, + // /// Layout with center and size + // If you want to put map in a fixed size box with right aspect ratio + // This two properties may be more convenient + // layoutCenter: [50%, 50%] + // layoutSize: 100 + silent: !1, + // Map type + map: "", + // Define left-top, right-bottom coords to control view + // For example, [ [180, 90], [-180, -90] ] + boundingCoords: null, + // Default on center of map + center: null, + zoom: 1, + scaleLimit: null, + // selectedMode: false + label: { + show: !1, + color: "#000" + }, + itemStyle: { + borderWidth: 0.5, + borderColor: "#444" + // Default color: + // + geoJSON: #eee + // + geoSVG: null (use SVG original `fill`) + // color: '#eee' + }, + emphasis: { + label: { + show: !0, + color: "rgb(100,0,0)" + }, + itemStyle: { + color: "rgba(255,215,0,0.8)" + } + }, + select: { + label: { + show: !0, + color: "rgb(100,0,0)" + }, + itemStyle: { + color: "rgba(255,215,0,0.8)" + } + }, + regions: [] + // tooltip: { + // show: false + // } + }, e; + }(xr) +); +const Hae = $ae; +function zL(r, e) { + return r.pointToProjected ? r.pointToProjected(e) : r.pointToData(e); +} +function nE(r, e, t, n) { + var i = r.getZoom(), a = r.getCenter(), o = e.zoom, s = r.projectedToPoint ? r.projectedToPoint(a) : r.dataToPoint(a); + if (e.dx != null && e.dy != null && (s[0] -= e.dx, s[1] -= e.dy, r.setCenter(zL(r, s), n)), o != null) { + if (t) { + var l = t.min || 0, u = t.max || 1 / 0; + o = Math.max(Math.min(i * o, u), l) / i; + } + r.scaleX *= o, r.scaleY *= o; + var c = (e.originX - r.x) * (o - 1), h = (e.originY - r.y) * (o - 1); + r.x -= c, r.y -= h, r.updateTransform(), r.setCenter(zL(r, s), n), r.setZoom(o * i); + } + return { + center: r.getCenter(), + zoom: r.getZoom() + }; +} +var Vae = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.focusBlurEnabled = !0, t; + } + return e.prototype.init = function(t, n) { + this._api = n; + }, e.prototype.render = function(t, n, i, a) { + if (this._model = t, !t.get("show")) { + this._mapDraw && this._mapDraw.remove(), this._mapDraw = null; + return; + } + this._mapDraw || (this._mapDraw = new wH(i)); + var o = this._mapDraw; + o.draw(t, n, i, this, a), o.group.on("click", this._handleRegionClick, this), o.group.silent = t.get("silent"), this.group.add(o.group), this.updateSelectStatus(t, n, i); + }, e.prototype._handleRegionClick = function(t) { + var n; + Mh(t.target, function(i) { + return (n = Ft(i).eventData) != null; + }, !0), n && this._api.dispatchAction({ + type: "geoToggleSelect", + geoId: this._model.id, + name: n.name + }); + }, e.prototype.updateSelectStatus = function(t, n, i) { + var a = this; + this._mapDraw.group.traverse(function(o) { + var s = Ft(o).eventData; + if (s) + return a._model.isSelected(s.name) ? i.enterSelect(o) : i.leaveSelect(o), !0; + }); + }, e.prototype.findHighDownDispatchers = function(t) { + return this._mapDraw && this._mapDraw.findHighDownDispatchers(t, this._model); + }, e.prototype.dispose = function() { + this._mapDraw && this._mapDraw.remove(); + }, e.type = "geo", e; + }(Sn) +); +const Gae = Vae; +function Uae(r, e, t) { + ou.registerMap(r, e, t); +} +function AH(r) { + r.registerCoordinateSystem("geo", IH), r.registerComponentModel(Hae), r.registerComponentView(Gae), r.registerImpl("registerMap", Uae), r.registerImpl("getMap", function(t) { + return ou.getMapForUser(t); + }); + function e(t, n) { + n.update = "geo:updateSelectStatus", r.registerAction(n, function(i, a) { + var o = {}, s = []; + return a.eachComponent({ + mainType: "geo", + query: i + }, function(l) { + l[t](i.name); + var u = l.coordinateSystem; + X(u.regions, function(h) { + o[h.name] = l.isSelected(h.name) || !1; + }); + var c = []; + X(o, function(h, f) { + o[f] && c.push(f); + }), s.push({ + geoIndex: l.componentIndex, + // Use singular, the same naming convention as the event `selectchanged`. + name: c + }); + }), { + selected: o, + allSelected: s, + name: i.name + }; + }); + } + e("toggleSelected", { + type: "geoToggleSelect", + event: "geoselectchanged" + }), e("select", { + type: "geoSelect", + event: "geoselected" + }), e("unSelect", { + type: "geoUnSelect", + event: "geounselected" + }), r.registerAction({ + type: "geoRoam", + event: "geoRoam", + update: "updateTransform" + }, function(t, n, i) { + var a = t.componentType || "series"; + n.eachComponent({ + mainType: a, + query: t + }, function(o) { + var s = o.coordinateSystem; + if (s.type === "geo") { + var l = nE(s, t, o.get("scaleLimit"), i); + o.setCenter && o.setCenter(l.center), o.setZoom && o.setZoom(l.zoom), a === "series" && X(o.seriesGroup, function(u) { + u.setCenter(l.center), u.setZoom(l.zoom); + }); + } + }); + }); +} +function Wae(r) { + Kt(AH), r.registerChartView(Dae), r.registerSeriesModel(Oae), r.registerLayout(Rae), r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC, Pae), u4("map", r.registerAction); +} +function Yae(r) { + var e = r; + e.hierNode = { + defaultAncestor: null, + ancestor: e, + prelim: 0, + modifier: 0, + change: 0, + shift: 0, + i: 0, + thread: null + }; + for (var t = [e], n, i; n = t.pop(); ) + if (i = n.children, n.isExpand && i.length) + for (var a = i.length, o = a - 1; o >= 0; o--) { + var s = i[o]; + s.hierNode = { + defaultAncestor: null, + ancestor: s, + prelim: 0, + modifier: 0, + change: 0, + shift: 0, + i: o, + thread: null + }, t.push(s); + } +} +function Xae(r, e) { + var t = r.isExpand ? r.children : [], n = r.parentNode.children, i = r.hierNode.i ? n[r.hierNode.i - 1] : null; + if (t.length) { + Kae(r); + var a = (t[0].hierNode.prelim + t[t.length - 1].hierNode.prelim) / 2; + i ? (r.hierNode.prelim = i.hierNode.prelim + e(r, i), r.hierNode.modifier = r.hierNode.prelim - a) : r.hierNode.prelim = a; + } else + i && (r.hierNode.prelim = i.hierNode.prelim + e(r, i)); + r.parentNode.hierNode.defaultAncestor = Qae(r, i, r.parentNode.hierNode.defaultAncestor || n[0], e); +} +function Zae(r) { + var e = r.hierNode.prelim + r.parentNode.hierNode.modifier; + r.setLayout({ + x: e + }, !0), r.hierNode.modifier += r.parentNode.hierNode.modifier; +} +function BL(r) { + return arguments.length ? r : toe; +} +function Op(r, e) { + return r -= Math.PI / 2, { + x: e * Math.cos(r), + y: e * Math.sin(r) + }; +} +function Jae(r, e) { + return yi(r.getBoxLayoutParams(), { + width: e.getWidth(), + height: e.getHeight() + }); +} +function Kae(r) { + for (var e = r.children, t = e.length, n = 0, i = 0; --t >= 0; ) { + var a = e[t]; + a.hierNode.prelim += n, a.hierNode.modifier += n, i += a.hierNode.change, n += a.hierNode.shift + i; + } +} +function Qae(r, e, t, n) { + if (e) { + for (var i = r, a = r, o = a.parentNode.children[0], s = e, l = i.hierNode.modifier, u = a.hierNode.modifier, c = o.hierNode.modifier, h = s.hierNode.modifier; s = Iw(s), a = Aw(a), s && a; ) { + i = Iw(i), o = Aw(o), i.hierNode.ancestor = r; + var f = s.hierNode.prelim + h - a.hierNode.prelim - u + n(s, a); + f > 0 && (eoe(qae(s, r, t), r, f), u += f, l += f), h += s.hierNode.modifier, u += a.hierNode.modifier, l += i.hierNode.modifier, c += o.hierNode.modifier; + } + s && !Iw(i) && (i.hierNode.thread = s, i.hierNode.modifier += h - l), a && !Aw(o) && (o.hierNode.thread = a, o.hierNode.modifier += u - c, t = r); + } + return t; +} +function Iw(r) { + var e = r.children; + return e.length && r.isExpand ? e[e.length - 1] : r.hierNode.thread; +} +function Aw(r) { + var e = r.children; + return e.length && r.isExpand ? e[0] : r.hierNode.thread; +} +function qae(r, e, t) { + return r.hierNode.ancestor.parentNode === e.parentNode ? r.hierNode.ancestor : t; +} +function eoe(r, e, t) { + var n = t / (e.hierNode.i - r.hierNode.i); + e.hierNode.change -= n, e.hierNode.shift += t, e.hierNode.modifier += t, e.hierNode.prelim += t, r.hierNode.change += n; +} +function toe(r, e) { + return r.parentNode === e.parentNode ? 1 : 2; +} +var roe = ( + /** @class */ + function() { + function r() { + this.parentPoint = [], this.childPoints = []; + } + return r; + }() +), noe = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new roe(); + }, e.prototype.buildPath = function(t, n) { + var i = n.childPoints, a = i.length, o = n.parentPoint, s = i[0], l = i[a - 1]; + if (a === 1) { + t.moveTo(o[0], o[1]), t.lineTo(s[0], s[1]); + return; + } + var u = n.orient, c = u === "TB" || u === "BT" ? 0 : 1, h = 1 - c, f = ot(n.forkPosition, 1), v = []; + v[c] = o[c], v[h] = o[h] + (l[h] - o[h]) * f, t.moveTo(o[0], o[1]), t.lineTo(v[0], v[1]), t.moveTo(s[0], s[1]), v[c] = s[c], t.lineTo(v[0], v[1]), v[c] = l[c], t.lineTo(v[0], v[1]), t.lineTo(l[0], l[1]); + for (var b = 1; b < a - 1; b++) { + var w = i[b]; + t.moveTo(w[0], w[1]), v[c] = w[c], t.lineTo(v[0], v[1]); + } + }, e; + }(hr) +), ioe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._mainGroup = new Rt(), t; + } + return e.prototype.init = function(t, n) { + this._controller = new vm(n.getZr()), this._controllerHost = { + target: this.group + }, this.group.add(this._mainGroup); + }, e.prototype.render = function(t, n, i) { + var a = t.getData(), o = t.layoutInfo, s = this._mainGroup, l = t.get("layout"); + l === "radial" ? (s.x = o.x + o.width / 2, s.y = o.y + o.height / 2) : (s.x = o.x, s.y = o.y), this._updateViewCoordSys(t, i), this._updateController(t, n, i); + var u = this._data; + a.diff(u).add(function(c) { + jL(a, c) && FL(a, c, null, s, t); + }).update(function(c, h) { + var f = u.getItemGraphicEl(h); + if (!jL(a, c)) { + f && HL(u, h, f, s, t); + return; + } + FL(a, c, f, s, t); + }).remove(function(c) { + var h = u.getItemGraphicEl(c); + h && HL(u, c, h, s, t); + }).execute(), this._nodeScaleRatio = t.get("nodeScaleRatio"), this._updateNodeAndLinkScale(t), t.get("expandAndCollapse") === !0 && a.eachItemGraphicEl(function(c, h) { + c.off("click").on("click", function() { + i.dispatchAction({ + type: "treeExpandAndCollapse", + seriesId: t.id, + dataIndex: h + }); + }); + }), this._data = a; + }, e.prototype._updateViewCoordSys = function(t, n) { + var i = t.getData(), a = []; + i.each(function(h) { + var f = i.getItemLayout(h); + f && !isNaN(f.x) && !isNaN(f.y) && a.push([+f.x, +f.y]); + }); + var o = [], s = []; + Pb(a, o, s); + var l = this._min, u = this._max; + s[0] - o[0] === 0 && (o[0] = l ? l[0] : o[0] - 1, s[0] = u ? u[0] : s[0] + 1), s[1] - o[1] === 0 && (o[1] = l ? l[1] : o[1] - 1, s[1] = u ? u[1] : s[1] + 1); + var c = t.coordinateSystem = new pm(); + c.zoomLimit = t.get("scaleLimit"), c.setBoundingRect(o[0], o[1], s[0] - o[0], s[1] - o[1]), c.setCenter(t.get("center"), n), c.setZoom(t.get("zoom")), this.group.attr({ + x: c.x, + y: c.y, + scaleX: c.scaleX, + scaleY: c.scaleY + }), this._min = o, this._max = s; + }, e.prototype._updateController = function(t, n, i) { + var a = this, o = this._controller, s = this._controllerHost, l = this.group; + o.setPointerChecker(function(u, c, h) { + var f = l.getBoundingRect(); + return f.applyTransform(l.transform), f.contain(c, h) && !ux(u, i, t); + }), o.enable(t.get("roam")), s.zoomLimit = t.get("scaleLimit"), s.zoom = t.coordinateSystem.getZoom(), o.off("pan").off("zoom").on("pan", function(u) { + eE(s, u.dx, u.dy), i.dispatchAction({ + seriesId: t.id, + type: "treeRoam", + dx: u.dx, + dy: u.dy + }); + }).on("zoom", function(u) { + tE(s, u.scale, u.originX, u.originY), i.dispatchAction({ + seriesId: t.id, + type: "treeRoam", + zoom: u.scale, + originX: u.originX, + originY: u.originY + }), a._updateNodeAndLinkScale(t), i.updateLabelLayout(); + }); + }, e.prototype._updateNodeAndLinkScale = function(t) { + var n = t.getData(), i = this._getNodeGlobalScale(t); + n.eachItemGraphicEl(function(a, o) { + a.setSymbolScale(i); + }); + }, e.prototype._getNodeGlobalScale = function(t) { + var n = t.coordinateSystem; + if (n.type !== "view") + return 1; + var i = this._nodeScaleRatio, a = n.scaleX || 1, o = n.getZoom(), s = (o - 1) * i + 1; + return s / a; + }, e.prototype.dispose = function() { + this._controller && this._controller.dispose(), this._controllerHost = null; + }, e.prototype.remove = function() { + this._mainGroup.removeAll(), this._data = null; + }, e.type = "tree", e; + }(en) +); +function jL(r, e) { + var t = r.getItemLayout(e); + return t && !isNaN(t.x) && !isNaN(t.y); +} +function FL(r, e, t, n, i) { + var a = !t, o = r.tree.getNodeByDataIndex(e), s = o.getModel(), l = o.getVisual("style").fill, u = o.isExpand === !1 && o.children.length !== 0 ? l : "#fff", c = r.tree.root, h = o.parentNode === c ? o : o.parentNode || o, f = r.getItemGraphicEl(h.dataIndex), v = h.getLayout(), b = f ? { + x: f.__oldX, + y: f.__oldY, + rawX: f.__radialOldRawX, + rawY: f.__radialOldRawY + } : v, w = o.getLayout(); + a ? (t = new um(r, e, null, { + symbolInnerColor: u, + useNameLabel: !0 + }), t.x = b.x, t.y = b.y) : t.updateData(r, e, null, { + symbolInnerColor: u, + useNameLabel: !0 + }), t.__radialOldRawX = t.__radialRawX, t.__radialOldRawY = t.__radialRawY, t.__radialRawX = w.rawX, t.__radialRawY = w.rawY, n.add(t), r.setItemGraphicEl(e, t), t.__oldX = t.x, t.__oldY = t.y, zr(t, { + x: w.x, + y: w.y + }, i); + var p = t.getSymbolPath(); + if (i.get("layout") === "radial") { + var d = c.children[0], m = d.getLayout(), _ = d.children.length, y = void 0, x = void 0; + if (w.x === m.x && o.isExpand === !0 && d.children.length) { + var g = { + x: (d.children[0].getLayout().x + d.children[_ - 1].getLayout().x) / 2, + y: (d.children[0].getLayout().y + d.children[_ - 1].getLayout().y) / 2 + }; + y = Math.atan2(g.y - m.y, g.x - m.x), y < 0 && (y = Math.PI * 2 + y), x = g.x < m.x, x && (y = y - Math.PI); + } else + y = Math.atan2(w.y - m.y, w.x - m.x), y < 0 && (y = Math.PI * 2 + y), o.children.length === 0 || o.children.length !== 0 && o.isExpand === !1 ? (x = w.x < m.x, x && (y = y - Math.PI)) : (x = w.x > m.x, x || (y = y - Math.PI)); + var S = x ? "left" : "right", T = s.getModel("label"), C = T.get("rotate"), E = C * (Math.PI / 180), M = p.getTextContent(); + M && (p.setTextConfig({ + position: T.get("position") || S, + rotation: C == null ? -y : E, + origin: "center" + }), M.setStyle("verticalAlign", "middle")); + } + var P = s.get(["emphasis", "focus"]), R = P === "relative" ? ag(o.getAncestorsIndices(), o.getDescendantIndices()) : P === "ancestor" ? o.getAncestorsIndices() : P === "descendant" ? o.getDescendantIndices() : null; + R && (Ft(t).focus = R), aoe(i, o, c, t, b, v, w, n), t.__edge && (t.onHoverStateChange = function(N) { + if (N !== "blur") { + var F = o.parentNode && r.getItemGraphicEl(o.parentNode.dataIndex); + F && F.hoverState === Kg || m_(t.__edge, N); + } + }); +} +function aoe(r, e, t, n, i, a, o, s) { + var l = e.getModel(), u = r.get("edgeShape"), c = r.get("layout"), h = r.getOrient(), f = r.get(["lineStyle", "curveness"]), v = r.get("edgeForkPosition"), b = l.getModel("lineStyle").getLineStyle(), w = n.__edge; + if (u === "curve") + e.parentNode && e.parentNode !== t && (w || (w = n.__edge = new qg({ + shape: vT(c, h, f, i, i) + })), zr(w, { + shape: vT(c, h, f, a, o) + }, r)); + else if (u === "polyline" && c === "orthogonal" && e !== t && e.children && e.children.length !== 0 && e.isExpand === !0) { + for (var p = e.children, d = [], m = 0; m < p.length; m++) { + var _ = p[m].getLayout(); + d.push([_.x, _.y]); + } + w || (w = n.__edge = new noe({ + shape: { + parentPoint: [o.x, o.y], + childPoints: [[o.x, o.y]], + orient: h, + forkPosition: v + } + })), zr(w, { + shape: { + parentPoint: [o.x, o.y], + childPoints: d + } + }, r); + } + w && !(u === "polyline" && !e.isExpand) && (w.useStyle(Mt({ + strokeNoScale: !0, + fill: null + }, b)), Xi(w, l, "lineStyle"), Yh(w), s.add(w)); +} +function $L(r, e, t, n, i) { + var a = e.tree.root, o = EH(a, r), s = o.source, l = o.sourceLayout, u = e.getItemGraphicEl(r.dataIndex); + if (u) { + var c = e.getItemGraphicEl(s.dataIndex), h = c.__edge, f = u.__edge || (s.isExpand === !1 || s.children.length === 1 ? h : void 0), v = n.get("edgeShape"), b = n.get("layout"), w = n.get("orient"), p = n.get(["lineStyle", "curveness"]); + f && (v === "curve" ? dc(f, { + shape: vT(b, w, p, l, l), + style: { + opacity: 0 + } + }, n, { + cb: function() { + t.remove(f); + }, + removeOpt: i + }) : v === "polyline" && n.get("layout") === "orthogonal" && dc(f, { + shape: { + parentPoint: [l.x, l.y], + childPoints: [[l.x, l.y]] + }, + style: { + opacity: 0 + } + }, n, { + cb: function() { + t.remove(f); + }, + removeOpt: i + })); + } +} +function EH(r, e) { + for (var t = e.parentNode === r ? e : e.parentNode || e, n; n = t.getLayout(), n == null; ) + t = t.parentNode === r ? t : t.parentNode || t; + return { + source: t, + sourceLayout: n + }; +} +function HL(r, e, t, n, i) { + var a = r.tree.getNodeByDataIndex(e), o = r.tree.root, s = EH(o, a).sourceLayout, l = { + duration: i.get("animationDurationUpdate"), + easing: i.get("animationEasingUpdate") + }; + dc(t, { + x: s.x + 1, + y: s.y + 1 + }, i, { + cb: function() { + n.remove(t), r.setItemGraphicEl(e, null); + }, + removeOpt: l + }), t.fadeOut(null, r.hostModel, { + fadeLabel: !0, + animation: l + }), a.children.forEach(function(u) { + $L(u, r, n, i, l); + }), $L(a, r, n, i, l); +} +function vT(r, e, t, n, i) { + var a, o, s, l, u, c, h, f; + if (r === "radial") { + u = n.rawX, h = n.rawY, c = i.rawX, f = i.rawY; + var v = Op(u, h), b = Op(u, h + (f - h) * t), w = Op(c, f + (h - f) * t), p = Op(c, f); + return { + x1: v.x || 0, + y1: v.y || 0, + x2: p.x || 0, + y2: p.y || 0, + cpx1: b.x || 0, + cpy1: b.y || 0, + cpx2: w.x || 0, + cpy2: w.y || 0 + }; + } else + u = n.x, h = n.y, c = i.x, f = i.y, (e === "LR" || e === "RL") && (a = u + (c - u) * t, o = h, s = c + (u - c) * t, l = f), (e === "TB" || e === "BT") && (a = u, o = h + (f - h) * t, s = c, l = f + (h - f) * t); + return { + x1: u, + y1: h, + x2: c, + y2: f, + cpx1: a, + cpy1: o, + cpx2: s, + cpy2: l + }; +} +const ooe = ioe; +var qo = Rr(); +function MH(r) { + var e = r.mainData, t = r.datas; + t || (t = { + main: e + }, r.datasAttr = { + main: "data" + }), r.datas = r.mainData = null, DH(e, t, r), X(t, function(n) { + X(e.TRANSFERABLE_METHODS, function(i) { + n.wrapMethod(i, jt(soe, r)); + }); + }), e.wrapMethod("cloneShallow", jt(uoe, r)), X(e.CHANGABLE_METHODS, function(n) { + e.wrapMethod(n, jt(loe, r)); + }), pa(t[e.dataType] === e); +} +function soe(r, e) { + if (foe(this)) { + var t = Fe({}, qo(this).datas); + t[this.dataType] = e, DH(e, t, r); + } else + iE(e, this.dataType, qo(this).mainData, r); + return e; +} +function loe(r, e) { + return r.struct && r.struct.update(), e; +} +function uoe(r, e) { + return X(qo(e).datas, function(t, n) { + t !== e && iE(t.cloneShallow(), n, e, r); + }), e; +} +function coe(r) { + var e = qo(this).mainData; + return r == null || e == null ? e : qo(e).datas[r]; +} +function hoe() { + var r = qo(this).mainData; + return r == null ? [{ + data: r + }] : Ke(yr(qo(r).datas), function(e) { + return { + type: e, + data: qo(r).datas[e] + }; + }); +} +function foe(r) { + return qo(r).mainData === r; +} +function DH(r, e, t) { + qo(r).datas = {}, X(e, function(n, i) { + iE(n, i, r, t); + }); +} +function iE(r, e, t, n) { + qo(t).datas[e] = r, qo(r).mainData = t, r.dataType = e, n.struct && (r[n.structAttr] = n.struct, n.struct[n.datasAttr[e]] = r), r.getLinkedData = coe, r.getLinkedDataAll = hoe; +} +var doe = ( + /** @class */ + function() { + function r(e, t) { + this.depth = 0, this.height = 0, this.dataIndex = -1, this.children = [], this.viewChildren = [], this.isExpand = !1, this.name = e || "", this.hostTree = t; + } + return r.prototype.isRemoved = function() { + return this.dataIndex < 0; + }, r.prototype.eachNode = function(e, t, n) { + Tt(e) && (n = t, t = e, e = null), e = e || {}, ut(e) && (e = { + order: e + }); + var i = e.order || "preorder", a = this[e.attr || "children"], o; + i === "preorder" && (o = t.call(n, this)); + for (var s = 0; !o && s < a.length; s++) + a[s].eachNode(e, t, n); + i === "postorder" && t.call(n, this); + }, r.prototype.updateDepthAndHeight = function(e) { + var t = 0; + this.depth = e; + for (var n = 0; n < this.children.length; n++) { + var i = this.children[n]; + i.updateDepthAndHeight(e + 1), i.height > t && (t = i.height); + } + this.height = t + 1; + }, r.prototype.getNodeById = function(e) { + if (this.getId() === e) + return this; + for (var t = 0, n = this.children, i = n.length; t < i; t++) { + var a = n[t].getNodeById(e); + if (a) + return a; + } + }, r.prototype.contains = function(e) { + if (e === this) + return !0; + for (var t = 0, n = this.children, i = n.length; t < i; t++) { + var a = n[t].contains(e); + if (a) + return a; + } + }, r.prototype.getAncestors = function(e) { + for (var t = [], n = e ? this : this.parentNode; n; ) + t.push(n), n = n.parentNode; + return t.reverse(), t; + }, r.prototype.getAncestorsIndices = function() { + for (var e = [], t = this; t; ) + e.push(t.dataIndex), t = t.parentNode; + return e.reverse(), e; + }, r.prototype.getDescendantIndices = function() { + var e = []; + return this.eachNode(function(t) { + e.push(t.dataIndex); + }), e; + }, r.prototype.getValue = function(e) { + var t = this.hostTree.data; + return t.getStore().get(t.getDimensionIndex(e || "value"), this.dataIndex); + }, r.prototype.setLayout = function(e, t) { + this.dataIndex >= 0 && this.hostTree.data.setItemLayout(this.dataIndex, e, t); + }, r.prototype.getLayout = function() { + return this.hostTree.data.getItemLayout(this.dataIndex); + }, r.prototype.getModel = function(e) { + if (!(this.dataIndex < 0)) { + var t = this.hostTree, n = t.data.getItemModel(this.dataIndex); + return n.getModel(e); + } + }, r.prototype.getLevelModel = function() { + return (this.hostTree.levelModels || [])[this.depth]; + }, r.prototype.setVisual = function(e, t) { + this.dataIndex >= 0 && this.hostTree.data.setItemVisual(this.dataIndex, e, t); + }, r.prototype.getVisual = function(e) { + return this.hostTree.data.getItemVisual(this.dataIndex, e); + }, r.prototype.getRawIndex = function() { + return this.hostTree.data.getRawIndex(this.dataIndex); + }, r.prototype.getId = function() { + return this.hostTree.data.getId(this.dataIndex); + }, r.prototype.getChildIndex = function() { + if (this.parentNode) { + for (var e = this.parentNode.children, t = 0; t < e.length; ++t) + if (e[t] === this) + return t; + return -1; + } + return -1; + }, r.prototype.isAncestorOf = function(e) { + for (var t = e.parentNode; t; ) { + if (t === this) + return !0; + t = t.parentNode; + } + return !1; + }, r.prototype.isDescendantOf = function(e) { + return e !== this && e.isAncestorOf(this); + }, r; + }() +), voe = ( + /** @class */ + function() { + function r(e) { + this.type = "tree", this._nodes = [], this.hostModel = e; + } + return r.prototype.eachNode = function(e, t, n) { + this.root.eachNode(e, t, n); + }, r.prototype.getNodeByDataIndex = function(e) { + var t = this.data.getRawIndex(e); + return this._nodes[t]; + }, r.prototype.getNodeById = function(e) { + return this.root.getNodeById(e); + }, r.prototype.update = function() { + for (var e = this.data, t = this._nodes, n = 0, i = t.length; n < i; n++) + t[n].dataIndex = -1; + for (var n = 0, i = e.count(); n < i; n++) + t[e.getRawIndex(n)].dataIndex = n; + }, r.prototype.clearLayouts = function() { + this.data.clearItemLayouts(); + }, r.createTree = function(e, t, n) { + var i = new r(t), a = [], o = 1; + s(e); + function s(c, h) { + var f = c.value; + o = Math.max(o, We(f) ? f.length : 1), a.push(c); + var v = new doe(Si(c.name, ""), i); + h ? poe(v, h) : i.root = v, i._nodes.push(v); + var b = c.children; + if (b) + for (var w = 0; w < b.length; w++) + s(b[w], v); + } + i.root.updateDepthAndHeight(0); + var l = uv(a, { + coordDimensions: ["value"], + dimensionsCount: o + }).dimensions, u = new Ui(l, t); + return u.initData(a), n && n(u), MH({ + mainData: u, + struct: i, + structAttr: "tree" + }), i.update(), i; + }, r; + }() +); +function poe(r, e) { + var t = e.children; + r.parentNode !== e && (t.push(r), r.parentNode = e); +} +const aE = voe; +function Dg(r, e, t) { + if (r && ir(e, r.type) >= 0) { + var n = t.getData().tree.root, i = r.targetNode; + if (ut(i) && (i = n.getNodeById(i)), i && n.contains(i)) + return { + node: i + }; + var a = r.targetNodeId; + if (a != null && (i = n.getNodeById(a))) + return { + node: i + }; + } +} +function kH(r) { + for (var e = []; r; ) + r = r.parentNode, r && e.push(r); + return e.reverse(); +} +function oE(r, e) { + var t = kH(r); + return ir(t, e) >= 0; +} +function hx(r, e) { + for (var t = []; r; ) { + var n = r.dataIndex; + t.push({ + name: r.name, + dataIndex: n, + value: e.getRawValue(n) + }), r = r.parentNode; + } + return t.reverse(), t; +} +var goe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.hasSymbolVisual = !0, t.ignoreStyleOnData = !0, t; + } + return e.prototype.getInitialData = function(t) { + var n = { + name: t.name, + children: t.data + }, i = t.leaves || {}, a = new qr(i, this, this.ecModel), o = aE.createTree(n, this, s); + function s(h) { + h.wrapMethod("getItemModel", function(f, v) { + var b = o.getNodeByDataIndex(v); + return b && b.children.length && b.isExpand || (f.parentModel = a), f; + }); + } + var l = 0; + o.eachNode("preorder", function(h) { + h.depth > l && (l = h.depth); + }); + var u = t.expandAndCollapse, c = u && t.initialTreeDepth >= 0 ? t.initialTreeDepth : l; + return o.root.eachNode("preorder", function(h) { + var f = h.hostTree.data.getRawDataItem(h.dataIndex); + h.isExpand = f && f.collapsed != null ? !f.collapsed : h.depth <= c; + }), o.data; + }, e.prototype.getOrient = function() { + var t = this.get("orient"); + return t === "horizontal" ? t = "LR" : t === "vertical" && (t = "TB"), t; + }, e.prototype.setZoom = function(t) { + this.option.zoom = t; + }, e.prototype.setCenter = function(t) { + this.option.center = t; + }, e.prototype.formatTooltip = function(t, n, i) { + for (var a = this.getData().tree, o = a.root.children[0], s = a.getNodeByDataIndex(t), l = s.getValue(), u = s.name; s && s !== o; ) + u = s.parentNode.name + "." + u, s = s.parentNode; + return Di("nameValue", { + name: u, + value: l, + noValue: isNaN(l) || l == null + }); + }, e.prototype.getDataParams = function(t) { + var n = r.prototype.getDataParams.apply(this, arguments), i = this.getData().tree.getNodeByDataIndex(t); + return n.treeAncestors = hx(i, this), n.collapsed = !i.isExpand, n; + }, e.type = "series.tree", e.layoutMode = "box", e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "view", + // the position of the whole view + left: "12%", + top: "12%", + right: "12%", + bottom: "12%", + // the layout of the tree, two value can be selected, 'orthogonal' or 'radial' + layout: "orthogonal", + // value can be 'polyline' + edgeShape: "curve", + edgeForkPosition: "50%", + // true | false | 'move' | 'scale', see module:component/helper/RoamController. + roam: !1, + // Symbol size scale ratio in roam + nodeScaleRatio: 0.4, + // Default on center of graph + center: null, + zoom: 1, + orient: "LR", + symbol: "emptyCircle", + symbolSize: 7, + expandAndCollapse: !0, + initialTreeDepth: 2, + lineStyle: { + color: "#ccc", + width: 1.5, + curveness: 0.5 + }, + itemStyle: { + color: "lightsteelblue", + // borderColor: '#c23531', + borderWidth: 1.5 + }, + label: { + show: !0 + }, + animationEasing: "linear", + animationDuration: 700, + animationDurationUpdate: 500 + }, e; + }(mn) +); +const moe = goe; +function yoe(r, e, t) { + for (var n = [r], i = [], a; a = n.pop(); ) + if (i.push(a), a.isExpand) { + var o = a.children; + if (o.length) + for (var s = 0; s < o.length; s++) + n.push(o[s]); + } + for (; a = i.pop(); ) + e(a, t); +} +function dp(r, e) { + for (var t = [r], n; n = t.pop(); ) + if (e(n), n.isExpand) { + var i = n.children; + if (i.length) + for (var a = i.length - 1; a >= 0; a--) + t.push(i[a]); + } +} +function _oe(r, e) { + r.eachSeriesByType("tree", function(t) { + boe(t, e); + }); +} +function boe(r, e) { + var t = Jae(r, e); + r.layoutInfo = t; + var n = r.get("layout"), i = 0, a = 0, o = null; + n === "radial" ? (i = 2 * Math.PI, a = Math.min(t.height, t.width) / 2, o = BL(function(_, y) { + return (_.parentNode === y.parentNode ? 1 : 2) / _.depth; + })) : (i = t.width, a = t.height, o = BL()); + var s = r.getData().tree.root, l = s.children[0]; + if (l) { + Yae(s), yoe(l, Xae, o), s.hierNode.modifier = -l.hierNode.prelim, dp(l, Zae); + var u = l, c = l, h = l; + dp(l, function(_) { + var y = _.getLayout().x; + y < u.getLayout().x && (u = _), y > c.getLayout().x && (c = _), _.depth > h.depth && (h = _); + }); + var f = u === c ? 1 : o(u, c) / 2, v = f - u.getLayout().x, b = 0, w = 0, p = 0, d = 0; + if (n === "radial") + b = i / (c.getLayout().x + f + v), w = a / (h.depth - 1 || 1), dp(l, function(_) { + p = (_.getLayout().x + v) * b, d = (_.depth - 1) * w; + var y = Op(p, d); + _.setLayout({ + x: y.x, + y: y.y, + rawX: p, + rawY: d + }, !0); + }); + else { + var m = r.getOrient(); + m === "RL" || m === "LR" ? (w = a / (c.getLayout().x + f + v), b = i / (h.depth - 1 || 1), dp(l, function(_) { + d = (_.getLayout().x + v) * w, p = m === "LR" ? (_.depth - 1) * b : i - (_.depth - 1) * b, _.setLayout({ + x: p, + y: d + }, !0); + })) : (m === "TB" || m === "BT") && (b = i / (c.getLayout().x + f + v), w = a / (h.depth - 1 || 1), dp(l, function(_) { + p = (_.getLayout().x + v) * b, d = m === "TB" ? (_.depth - 1) * w : a - (_.depth - 1) * w, _.setLayout({ + x: p, + y: d + }, !0); + })); + } + } +} +function xoe(r) { + r.eachSeriesByType("tree", function(e) { + var t = e.getData(), n = t.tree; + n.eachNode(function(i) { + var a = i.getModel(), o = a.getModel("itemStyle").getItemStyle(), s = t.ensureUniqueItemVisual(i.dataIndex, "style"); + Fe(s, o); + }); + }); +} +function Soe(r) { + r.registerAction({ + type: "treeExpandAndCollapse", + event: "treeExpandAndCollapse", + update: "update" + }, function(e, t) { + t.eachComponent({ + mainType: "series", + subType: "tree", + query: e + }, function(n) { + var i = e.dataIndex, a = n.getData().tree, o = a.getNodeByDataIndex(i); + o.isExpand = !o.isExpand; + }); + }), r.registerAction({ + type: "treeRoam", + event: "treeRoam", + // Here we set 'none' instead of 'update', because roam action + // just need to update the transform matrix without having to recalculate + // the layout. So don't need to go through the whole update process, such + // as 'dataPrcocess', 'coordSystemUpdate', 'layout' and so on. + update: "none" + }, function(e, t, n) { + t.eachComponent({ + mainType: "series", + subType: "tree", + query: e + }, function(i) { + var a = i.coordinateSystem, o = nE(a, e, void 0, n); + i.setCenter && i.setCenter(o.center), i.setZoom && i.setZoom(o.zoom); + }); + }); +} +function woe(r) { + r.registerChartView(ooe), r.registerSeriesModel(moe), r.registerLayout(_oe), r.registerVisual(xoe), Soe(r); +} +var VL = ["treemapZoomToNode", "treemapRender", "treemapMove"]; +function Coe(r) { + for (var e = 0; e < VL.length; e++) + r.registerAction({ + type: VL[e], + update: "updateView" + }, Qn); + r.registerAction({ + type: "treemapRootToNode", + update: "updateView" + }, function(t, n) { + n.eachComponent({ + mainType: "series", + subType: "treemap", + query: t + }, i); + function i(a, o) { + var s = ["treemapZoomToNode", "treemapRootToNode"], l = Dg(t, s, a); + if (l) { + var u = a.getViewRoot(); + u && (t.direction = oE(u, l.node) ? "rollUp" : "drillDown"), a.resetViewRoot(l.node); + } + } + }); +} +function OH(r) { + var e = r.getData(), t = e.tree, n = {}; + t.eachNode(function(i) { + for (var a = i; a && a.depth > 1; ) + a = a.parentNode; + var o = V1(r.ecModel, a.name || a.dataIndex + "", n); + i.setVisual("decal", o); + }); +} +var Toe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.preventUsingHoverLayer = !0, t; + } + return e.prototype.getInitialData = function(t, n) { + var i = { + name: t.name, + children: t.data + }; + LH(i); + var a = t.levels || [], o = this.designatedVisualItemStyle = {}, s = new qr({ + itemStyle: o + }, this, n); + a = t.levels = Ioe(a, n); + var l = Ke(a || [], function(h) { + return new qr(h, s, n); + }, this), u = aE.createTree(i, this, c); + function c(h) { + h.wrapMethod("getItemModel", function(f, v) { + var b = u.getNodeByDataIndex(v), w = b ? l[b.depth] : null; + return f.parentModel = w || s, f; + }); + } + return u.data; + }, e.prototype.optionUpdated = function() { + this.resetViewRoot(); + }, e.prototype.formatTooltip = function(t, n, i) { + var a = this.getData(), o = this.getRawValue(t), s = a.getName(t); + return Di("nameValue", { + name: s, + value: o + }); + }, e.prototype.getDataParams = function(t) { + var n = r.prototype.getDataParams.apply(this, arguments), i = this.getData().tree.getNodeByDataIndex(t); + return n.treeAncestors = hx(i, this), n.treePathInfo = n.treeAncestors, n; + }, e.prototype.setLayoutInfo = function(t) { + this.layoutInfo = this.layoutInfo || {}, Fe(this.layoutInfo, t); + }, e.prototype.mapIdToIndex = function(t) { + var n = this._idIndexMap; + n || (n = this._idIndexMap = xt(), this._idIndexMapCount = 0); + var i = n.get(t); + return i == null && n.set(t, i = this._idIndexMapCount++), i; + }, e.prototype.getViewRoot = function() { + return this._viewRoot; + }, e.prototype.resetViewRoot = function(t) { + t ? this._viewRoot = t : t = this._viewRoot; + var n = this.getRawData().tree.root; + (!t || t !== n && !n.contains(t)) && (this._viewRoot = n); + }, e.prototype.enableAriaDecal = function() { + OH(this); + }, e.type = "series.treemap", e.layoutMode = "box", e.defaultOption = { + // Disable progressive rendering + progressive: 0, + // size: ['80%', '80%'], // deprecated, compatible with ec2. + left: "center", + top: "middle", + width: "80%", + height: "80%", + sort: !0, + clipWindow: "origin", + squareRatio: 0.5 * (1 + Math.sqrt(5)), + leafDepth: null, + drillDownIcon: "▶", + // to align specialized icon. ▷▶❒❐▼✚ + zoomToNodeRatio: 0.32 * 0.32, + roam: !0, + nodeClick: "zoomToNode", + animation: !0, + animationDurationUpdate: 900, + animationEasing: "quinticInOut", + breadcrumb: { + show: !0, + height: 22, + left: "center", + top: "bottom", + // right + // bottom + emptyItemWidth: 25, + itemStyle: { + color: "rgba(0,0,0,0.7)", + textStyle: { + color: "#fff" + } + }, + emphasis: { + itemStyle: { + color: "rgba(0,0,0,0.9)" + // '#5793f3', + } + } + }, + label: { + show: !0, + // Do not use textDistance, for ellipsis rect just the same as treemap node rect. + distance: 0, + padding: 5, + position: "inside", + // formatter: null, + color: "#fff", + overflow: "truncate" + // align + // verticalAlign + }, + upperLabel: { + show: !1, + position: [0, "50%"], + height: 20, + // formatter: null, + // color: '#fff', + overflow: "truncate", + // align: null, + verticalAlign: "middle" + }, + itemStyle: { + color: null, + colorAlpha: null, + colorSaturation: null, + borderWidth: 0, + gapWidth: 0, + borderColor: "#fff", + borderColorSaturation: null + // If specified, borderColor will be ineffective, and the + // border color is evaluated by color of current node and + // borderColorSaturation. + }, + emphasis: { + upperLabel: { + show: !0, + position: [0, "50%"], + overflow: "truncate", + verticalAlign: "middle" + } + }, + visualDimension: 0, + visualMin: null, + visualMax: null, + color: [], + // level[n].color (if necessary). + // + Specify color list of each level. level[0].color would be global + // color list if not specified. (see method `setDefault`). + // + But set as a empty array to forbid fetch color from global palette + // when using nodeModel.get('color'), otherwise nodes on deep level + // will always has color palette set and are not able to inherit color + // from parent node. + // + TreemapSeries.color can not be set as 'none', otherwise effect + // legend color fetching (see seriesColor.js). + colorAlpha: null, + colorSaturation: null, + colorMappingBy: "index", + visibleMin: 10, + // be rendered. Only works when sort is 'asc' or 'desc'. + childrenVisibleMin: null, + // grandchildren will not show. + // Why grandchildren? If not grandchildren but children, + // some siblings show children and some not, + // the appearance may be mess and not consistent, + levels: [] + // Each item: { + // visibleMin, itemStyle, visualDimension, label + // } + }, e; + }(mn) +); +function LH(r) { + var e = 0; + X(r.children, function(n) { + LH(n); + var i = n.value; + We(i) && (i = i[0]), e += i; + }); + var t = r.value; + We(t) && (t = t[0]), (t == null || isNaN(t)) && (t = e), t < 0 && (t = 0), We(r.value) ? r.value[0] = t : r.value = t; +} +function Ioe(r, e) { + var t = ln(e.get("color")), n = ln(e.get(["aria", "decal", "decals"])); + if (t) { + r = r || []; + var i, a; + X(r, function(s) { + var l = new qr(s), u = l.get("color"), c = l.get("decal"); + (l.get(["itemStyle", "color"]) || u && u !== "none") && (i = !0), (l.get(["itemStyle", "decal"]) || c && c !== "none") && (a = !0); + }); + var o = r[0] || (r[0] = {}); + return i || (o.color = t.slice()), !a && n && (o.decal = n.slice()), r; + } +} +const Aoe = Toe; +var Eoe = 8, GL = 8, Ew = 5, Moe = ( + /** @class */ + function() { + function r(e) { + this.group = new Rt(), e.add(this.group); + } + return r.prototype.render = function(e, t, n, i) { + var a = e.getModel("breadcrumb"), o = this.group; + if (o.removeAll(), !(!a.get("show") || !n)) { + var s = a.getModel("itemStyle"), l = a.getModel("emphasis"), u = s.getModel("textStyle"), c = l.getModel(["itemStyle", "textStyle"]), h = { + pos: { + left: a.get("left"), + right: a.get("right"), + top: a.get("top"), + bottom: a.get("bottom") + }, + box: { + width: t.getWidth(), + height: t.getHeight() + }, + emptyItemWidth: a.get("emptyItemWidth"), + totalWidth: 0, + renderList: [] + }; + this._prepare(n, h, u), this._renderContent(e, h, s, l, u, c, i), Xb(o, h.pos, h.box); + } + }, r.prototype._prepare = function(e, t, n) { + for (var i = e; i; i = i.parentNode) { + var a = Si(i.getModel().get("name"), ""), o = n.getTextRect(a), s = Math.max(o.width + Eoe * 2, t.emptyItemWidth); + t.totalWidth += s + GL, t.renderList.push({ + node: i, + text: a, + width: s + }); + } + }, r.prototype._renderContent = function(e, t, n, i, a, o, s) { + for (var l = 0, u = t.emptyItemWidth, c = e.get(["breadcrumb", "height"]), h = WK(t.pos, t.box), f = t.totalWidth, v = t.renderList, b = i.getModel("itemStyle").getItemStyle(), w = v.length - 1; w >= 0; w--) { + var p = v[w], d = p.node, m = p.width, _ = p.text; + f > h.width && (f -= m - u, m = u, _ = null); + var y = new La({ + shape: { + points: Doe(l, 0, m, c, w === v.length - 1, w === 0) + }, + style: Mt(n.getItemStyle(), { + lineJoin: "bevel" + }), + textContent: new kr({ + style: gn(a, { + text: _ + }) + }), + textConfig: { + position: "inside" + }, + z2: Zd * 1e4, + onclick: jt(s, d) + }); + y.disableLabelAnimation = !0, y.getTextContent().ensureState("emphasis").style = gn(o, { + text: _ + }), y.ensureState("emphasis").style = b, Un(y, i.get("focus"), i.get("blurScope"), i.get("disabled")), this.group.add(y), koe(y, e, d), l += m + GL; + } + }, r.prototype.remove = function() { + this.group.removeAll(); + }, r; + }() +); +function Doe(r, e, t, n, i, a) { + var o = [[i ? r : r - Ew, e], [r + t, e], [r + t, e + n], [i ? r : r - Ew, e + n]]; + return !a && o.splice(2, 0, [r + t + Ew, e + n / 2]), !i && o.push([r, e + n / 2]), o; +} +function koe(r, e, t) { + Ft(r).eventData = { + componentType: "series", + componentSubType: "treemap", + componentIndex: e.componentIndex, + seriesIndex: e.seriesIndex, + seriesName: e.name, + seriesType: "treemap", + selfType: "breadcrumb", + nodeData: { + dataIndex: t && t.dataIndex, + name: t && t.name + }, + treePathInfo: t && hx(t, e) + }; +} +const Ooe = Moe; +var Loe = ( + /** @class */ + function() { + function r() { + this._storage = [], this._elExistsMap = {}; + } + return r.prototype.add = function(e, t, n, i, a) { + return this._elExistsMap[e.id] ? !1 : (this._elExistsMap[e.id] = !0, this._storage.push({ + el: e, + target: t, + duration: n, + delay: i, + easing: a + }), !0); + }, r.prototype.finished = function(e) { + return this._finishedCallback = e, this; + }, r.prototype.start = function() { + for (var e = this, t = this._storage.length, n = function() { + t--, t <= 0 && (e._storage.length = 0, e._elExistsMap = {}, e._finishedCallback && e._finishedCallback()); + }, i = 0, a = this._storage.length; i < a; i++) { + var o = this._storage[i]; + o.el.animateTo(o.target, { + duration: o.duration, + delay: o.delay, + easing: o.easing, + setToFinal: !0, + done: n, + aborted: n + }); + } + return this; + }, r; + }() +); +function Poe() { + return new Loe(); +} +var pT = Rt, UL = Or, WL = 3, YL = "label", XL = "upperLabel", Roe = Zd * 10, Noe = Zd * 2, zoe = Zd * 3, vh = Wh([ + ["fill", "color"], + // `borderColor` and `borderWidth` has been occupied, + // so use `stroke` to indicate the stroke of the rect. + ["stroke", "strokeColor"], + ["lineWidth", "strokeWidth"], + ["shadowBlur"], + ["shadowOffsetX"], + ["shadowOffsetY"], + ["shadowColor"] + // Option decal is in `DecalObject` but style.decal is in `PatternObject`. + // So do not transfer decal directly. +]), ZL = function(r) { + var e = vh(r); + return e.stroke = e.fill = e.lineWidth = null, e; +}, H_ = Rr(), Boe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._state = "ready", t._storage = vp(), t; + } + return e.prototype.render = function(t, n, i, a) { + var o = n.findComponents({ + mainType: "series", + subType: "treemap", + query: a + }); + if (!(ir(o, t) < 0)) { + this.seriesModel = t, this.api = i, this.ecModel = n; + var s = ["treemapZoomToNode", "treemapRootToNode"], l = Dg(a, s, t), u = a && a.type, c = t.layoutInfo, h = !this._oldTree, f = this._storage, v = u === "treemapRootToNode" && l && f ? { + rootNodeGroup: f.nodeGroup[l.node.getRawIndex()], + direction: a.direction + } : null, b = this._giveContainerGroup(c), w = t.get("animation"), p = this._doRender(b, t, v); + w && !h && (!u || u === "treemapZoomToNode" || u === "treemapRootToNode") ? this._doAnimation(b, p, t, v) : p.renderFinally(), this._resetController(i), this._renderBreadcrumb(t, i, l); + } + }, e.prototype._giveContainerGroup = function(t) { + var n = this._containerGroup; + return n || (n = this._containerGroup = new pT(), this._initEvents(n), this.group.add(n)), n.x = t.x, n.y = t.y, n; + }, e.prototype._doRender = function(t, n, i) { + var a = n.getData().tree, o = this._oldTree, s = vp(), l = vp(), u = this._storage, c = []; + function h(p, d, m, _) { + return joe(n, l, u, i, s, c, p, d, m, _); + } + v(a.root ? [a.root] : [], o && o.root ? [o.root] : [], t, a === o || !o, 0); + var f = b(u); + return this._oldTree = a, this._storage = l, { + lastsForAnimation: s, + willDeleteEls: f, + renderFinally: w + }; + function v(p, d, m, _, y) { + _ ? (d = p, X(p, function(S, T) { + !S.isRemoved() && g(T, T); + })) : new nu(d, p, x, x).add(g).update(g).remove(jt(g, null)).execute(); + function x(S) { + return S.getId(); + } + function g(S, T) { + var C = S != null ? p[S] : null, E = T != null ? d[T] : null, M = h(C, E, m, y); + M && v(C && C.viewChildren || [], E && E.viewChildren || [], M, _, y + 1); + } + } + function b(p) { + var d = vp(); + return p && X(p, function(m, _) { + var y = d[_]; + X(m, function(x) { + x && (y.push(x), H_(x).willDelete = !0); + }); + }), d; + } + function w() { + X(f, function(p) { + X(p, function(d) { + d.parent && d.parent.remove(d); + }); + }), X(c, function(p) { + p.invisible = !0, p.dirty(); + }); + } + }, e.prototype._doAnimation = function(t, n, i, a) { + var o = i.get("animationDurationUpdate"), s = i.get("animationEasing"), l = (Tt(o) ? 0 : o) || 0, u = (Tt(s) ? null : s) || "cubicOut", c = Poe(); + X(n.willDeleteEls, function(h, f) { + X(h, function(v, b) { + if (!v.invisible) { + var w = v.parent, p, d = H_(w); + if (a && a.direction === "drillDown") + p = w === a.rootNodeGroup ? { + shape: { + x: 0, + y: 0, + width: d.nodeWidth, + height: d.nodeHeight + }, + style: { + opacity: 0 + } + } : { + style: { + opacity: 0 + } + }; + else { + var m = 0, _ = 0; + d.willDelete || (m = d.nodeWidth / 2, _ = d.nodeHeight / 2), p = f === "nodeGroup" ? { + x: m, + y: _, + style: { + opacity: 0 + } + } : { + shape: { + x: m, + y: _, + width: 0, + height: 0 + }, + style: { + opacity: 0 + } + }; + } + p && c.add(v, p, l, 0, u); + } + }); + }), X(this._storage, function(h, f) { + X(h, function(v, b) { + var w = n.lastsForAnimation[f][b], p = {}; + w && (v instanceof Rt ? w.oldX != null && (p.x = v.x, p.y = v.y, v.x = w.oldX, v.y = w.oldY) : (w.oldShape && (p.shape = Fe({}, v.shape), v.setShape(w.oldShape)), w.fadein ? (v.setStyle("opacity", 0), p.style = { + opacity: 1 + }) : v.style.opacity !== 1 && (p.style = { + opacity: 1 + })), c.add(v, p, l, 0, u)); + }); + }, this), this._state = "animating", c.finished(ft(function() { + this._state = "ready", n.renderFinally(); + }, this)).start(); + }, e.prototype._resetController = function(t) { + var n = this._controller; + n || (n = this._controller = new vm(t.getZr()), n.enable(this.seriesModel.get("roam")), n.on("pan", ft(this._onPan, this)), n.on("zoom", ft(this._onZoom, this))); + var i = new Wt(0, 0, t.getWidth(), t.getHeight()); + n.setPointerChecker(function(a, o, s) { + return i.contain(o, s); + }); + }, e.prototype._clearController = function() { + var t = this._controller; + t && (t.dispose(), t = null); + }, e.prototype._onPan = function(t) { + if (this._state !== "animating" && (Math.abs(t.dx) > WL || Math.abs(t.dy) > WL)) { + var n = this.seriesModel.getData().tree.root; + if (!n) + return; + var i = n.getLayout(); + if (!i) + return; + this.api.dispatchAction({ + type: "treemapMove", + from: this.uid, + seriesId: this.seriesModel.id, + rootRect: { + x: i.x + t.dx, + y: i.y + t.dy, + width: i.width, + height: i.height + } + }); + } + }, e.prototype._onZoom = function(t) { + var n = t.originX, i = t.originY; + if (this._state !== "animating") { + var a = this.seriesModel.getData().tree.root; + if (!a) + return; + var o = a.getLayout(); + if (!o) + return; + var s = new Wt(o.x, o.y, o.width, o.height), l = this.seriesModel.layoutInfo; + n -= l.x, i -= l.y; + var u = io(); + js(u, u, [-n, -i]), Ab(u, u, [t.scale, t.scale]), js(u, u, [n, i]), s.applyTransform(u), this.api.dispatchAction({ + type: "treemapRender", + from: this.uid, + seriesId: this.seriesModel.id, + rootRect: { + x: s.x, + y: s.y, + width: s.width, + height: s.height + } + }); + } + }, e.prototype._initEvents = function(t) { + var n = this; + t.on("click", function(i) { + if (n._state === "ready") { + var a = n.seriesModel.get("nodeClick", !0); + if (a) { + var o = n.findTarget(i.offsetX, i.offsetY); + if (o) { + var s = o.node; + if (s.getLayout().isLeafRoot) + n._rootToNode(o); + else if (a === "zoomToNode") + n._zoomToNode(o); + else if (a === "link") { + var l = s.hostTree.data.getItemModel(s.dataIndex), u = l.get("link", !0), c = l.get("target", !0) || "blank"; + u && w_(u, c); + } + } + } + } + }, this); + }, e.prototype._renderBreadcrumb = function(t, n, i) { + var a = this; + i || (i = t.get("leafDepth", !0) != null ? { + node: t.getViewRoot() + } : this.findTarget(n.getWidth() / 2, n.getHeight() / 2), i || (i = { + node: t.getData().tree.root + })), (this._breadcrumb || (this._breadcrumb = new Ooe(this.group))).render(t, n, i.node, function(o) { + a._state !== "animating" && (oE(t.getViewRoot(), o) ? a._rootToNode({ + node: o + }) : a._zoomToNode({ + node: o + })); + }); + }, e.prototype.remove = function() { + this._clearController(), this._containerGroup && this._containerGroup.removeAll(), this._storage = vp(), this._state = "ready", this._breadcrumb && this._breadcrumb.remove(); + }, e.prototype.dispose = function() { + this._clearController(); + }, e.prototype._zoomToNode = function(t) { + this.api.dispatchAction({ + type: "treemapZoomToNode", + from: this.uid, + seriesId: this.seriesModel.id, + targetNode: t.node + }); + }, e.prototype._rootToNode = function(t) { + this.api.dispatchAction({ + type: "treemapRootToNode", + from: this.uid, + seriesId: this.seriesModel.id, + targetNode: t.node + }); + }, e.prototype.findTarget = function(t, n) { + var i, a = this.seriesModel.getViewRoot(); + return a.eachNode({ + attr: "viewChildren", + order: "preorder" + }, function(o) { + var s = this._storage.background[o.getRawIndex()]; + if (s) { + var l = s.transformCoordToLocal(t, n), u = s.shape; + if (u.x <= l[0] && l[0] <= u.x + u.width && u.y <= l[1] && l[1] <= u.y + u.height) + i = { + node: o, + offsetX: l[0], + offsetY: l[1] + }; + else + return !1; + } + }, this), i; + }, e.type = "treemap", e; + }(en) +); +function vp() { + return { + nodeGroup: [], + background: [], + content: [] + }; +} +function joe(r, e, t, n, i, a, o, s, l, u) { + if (!o) + return; + var c = o.getLayout(), h = r.getData(), f = o.getModel(); + if (h.setItemGraphicEl(o.dataIndex, null), !c || !c.isInView) + return; + var v = c.width, b = c.height, w = c.borderWidth, p = c.invisible, d = o.getRawIndex(), m = s && s.getRawIndex(), _ = o.viewChildren, y = c.upperHeight, x = _ && _.length, g = f.getModel("itemStyle"), S = f.getModel(["emphasis", "itemStyle"]), T = f.getModel(["blur", "itemStyle"]), C = f.getModel(["select", "itemStyle"]), E = g.get("borderRadius") || 0, M = K("nodeGroup", pT); + if (!M) + return; + if (l.add(M), M.x = c.x || 0, M.y = c.y || 0, M.markRedraw(), H_(M).nodeWidth = v, H_(M).nodeHeight = b, c.isAboveViewRoot) + return M; + var P = K("background", UL, u, Noe); + P && Q(M, P, x && c.upperLabelHeight); + var R = f.getModel("emphasis"), N = R.get("focus"), F = R.get("blurScope"), U = R.get("disabled"), $ = N === "ancestor" ? o.getAncestorsIndices() : N === "descendant" ? o.getDescendantIndices() : N; + if (x) + gg(M) && Ah(M, !1), P && (Ah(P, !U), h.setItemGraphicEl(o.dataIndex, P), R1(P, $, F)); + else { + var G = K("content", UL, u, zoe); + G && ee(M, G), P.disableMorphing = !0, P && gg(P) && Ah(P, !1), Ah(M, !U), h.setItemGraphicEl(o.dataIndex, M), R1(M, $, F); + } + return M; + function Q(Ge, oe, de) { + var se = Ft(oe); + if (se.dataIndex = o.dataIndex, se.seriesIndex = r.seriesIndex, oe.setShape({ + x: 0, + y: 0, + width: v, + height: b, + r: E + }), p) + ce(oe); + else { + oe.invisible = !1; + var te = o.getVisual("style"), pe = te.stroke, re = ZL(g); + re.fill = pe; + var ae = vh(S); + ae.fill = S.get("borderColor"); + var le = vh(T); + le.fill = T.get("borderColor"); + var ue = vh(C); + if (ue.fill = C.get("borderColor"), de) { + var Ae = v - 2 * w; + ne( + // PENDING: convert ZRColor to ColorString for text. + oe, + pe, + te.opacity, + { + x: w, + y: 0, + width: Ae, + height: y + } + ); + } else + oe.removeTextContent(); + oe.setStyle(re), oe.ensureState("emphasis").style = ae, oe.ensureState("blur").style = le, oe.ensureState("select").style = ue, Yh(oe); + } + Ge.add(oe); + } + function ee(Ge, oe) { + var de = Ft(oe); + de.dataIndex = o.dataIndex, de.seriesIndex = r.seriesIndex; + var se = Math.max(v - 2 * w, 0), te = Math.max(b - 2 * w, 0); + if (oe.culling = !0, oe.setShape({ + x: w, + y: w, + width: se, + height: te, + r: E + }), p) + ce(oe); + else { + oe.invisible = !1; + var pe = o.getVisual("style"), re = pe.fill, ae = ZL(g); + ae.fill = re, ae.decal = pe.decal; + var le = vh(S), ue = vh(T), Ae = vh(C); + ne(oe, re, pe.opacity, null), oe.setStyle(ae), oe.ensureState("emphasis").style = le, oe.ensureState("blur").style = ue, oe.ensureState("select").style = Ae, Yh(oe); + } + Ge.add(oe); + } + function ce(Ge) { + !Ge.invisible && a.push(Ge); + } + function ne(Ge, oe, de, se) { + var te = f.getModel(se ? XL : YL), pe = Si(f.get("name"), null), re = te.getShallow("show"); + Zi(Ge, Mi(f, se ? XL : YL), { + defaultText: re ? pe : null, + inheritColor: oe, + defaultOpacity: de, + labelFetcher: r, + labelDataIndex: o.dataIndex + }); + var ae = Ge.getTextContent(); + if (ae) { + var le = ae.style, ue = Tb(le.padding || 0); + se && (Ge.setTextConfig({ + layoutRect: se + }), ae.disableLabelLayout = !0), ae.beforeUpdate = function() { + var Te = Math.max((se ? se.width : Ge.shape.width) - ue[1] - ue[3], 0), Ne = Math.max((se ? se.height : Ge.shape.height) - ue[0] - ue[2], 0); + (le.width !== Te || le.height !== Ne) && ae.setStyle({ + width: Te, + height: Ne + }); + }, le.truncateMinChar = 2, le.lineOverflow = "truncate", fe(le, se, c); + var Ae = ae.getState("emphasis"); + fe(Ae ? Ae.style : null, se, c); + } + } + function fe(Ge, oe, de) { + var se = Ge ? Ge.text : null; + if (!oe && de.isLeafRoot && se != null) { + var te = r.get("drillDownIcon", !0); + Ge.text = te ? te + " " + se : se; + } + } + function K(Ge, oe, de, se) { + var te = m != null && t[Ge][m], pe = i[Ge]; + return te ? (t[Ge][m] = null, Oe(pe, te)) : p || (te = new oe(), te instanceof ts && (te.z2 = Foe(de, se)), xe(pe, te)), e[Ge][d] = te; + } + function Oe(Ge, oe) { + var de = Ge[d] = {}; + oe instanceof pT ? (de.oldX = oe.x, de.oldY = oe.y) : de.oldShape = Fe({}, oe.shape); + } + function xe(Ge, oe) { + var de = Ge[d] = {}, se = o.parentNode, te = oe instanceof Rt; + if (se && (!n || n.direction === "drillDown")) { + var pe = 0, re = 0, ae = i.background[se.getRawIndex()]; + !n && ae && ae.oldShape && (pe = ae.oldShape.width, re = ae.oldShape.height), te ? (de.oldX = 0, de.oldY = re) : de.oldShape = { + x: pe, + y: re, + width: 0, + height: 0 + }; + } + de.fadein = !te; + } +} +function Foe(r, e) { + return r * Roe + e; +} +const $oe = Boe; +var kg = X, Hoe = kt, V_ = -1, sE = ( + /** @class */ + function() { + function r(e) { + var t = e.mappingMethod, n = e.type, i = this.option = Ot(e); + this.type = n, this.mappingMethod = t, this._normalizeData = Uoe[t]; + var a = r.visualHandlers[n]; + this.applyVisual = a.applyVisual, this.getColorMapper = a.getColorMapper, this._normalizedToVisual = a._normalizedToVisual[t], t === "piecewise" ? (Mw(i), Voe(i)) : t === "category" ? i.categories ? Goe(i) : Mw(i, !0) : (pa(t !== "linear" || i.dataExtent), Mw(i)); + } + return r.prototype.mapValueToVisual = function(e) { + var t = this._normalizeData(e); + return this._normalizedToVisual(t, e); + }, r.prototype.getNormalizer = function() { + return ft(this._normalizeData, this); + }, r.listVisualTypes = function() { + return yr(r.visualHandlers); + }, r.isValidType = function(e) { + return r.visualHandlers.hasOwnProperty(e); + }, r.eachVisual = function(e, t, n) { + kt(e) ? X(e, t, n) : t.call(n, e); + }, r.mapVisual = function(e, t, n) { + var i, a = We(e) ? [] : kt(e) ? {} : (i = !0, null); + return r.eachVisual(e, function(o, s) { + var l = t.call(n, o, s); + i ? a = l : a[s] = l; + }), a; + }, r.retrieveVisuals = function(e) { + var t = {}, n; + return e && kg(r.visualHandlers, function(i, a) { + e.hasOwnProperty(a) && (t[a] = e[a], n = !0); + }), n ? t : null; + }, r.prepareVisualTypes = function(e) { + if (We(e)) + e = e.slice(); + else if (Hoe(e)) { + var t = []; + kg(e, function(n, i) { + t.push(i); + }), e = t; + } else + return []; + return e.sort(function(n, i) { + return i === "color" && n !== "color" && n.indexOf("color") === 0 ? 1 : -1; + }), e; + }, r.dependsOn = function(e, t) { + return t === "color" ? !!(e && e.indexOf(t) === 0) : e === t; + }, r.findPieceIndex = function(e, t, n) { + for (var i, a = 1 / 0, o = 0, s = t.length; o < s; o++) { + var l = t[o].value; + if (l != null) { + if (l === e || ut(l) && l === e + "") + return o; + n && f(l, o); + } + } + for (var o = 0, s = t.length; o < s; o++) { + var u = t[o], c = u.interval, h = u.close; + if (c) { + if (c[0] === -1 / 0) { + if (s0(h[1], e, c[1])) + return o; + } else if (c[1] === 1 / 0) { + if (s0(h[0], c[0], e)) + return o; + } else if (s0(h[0], c[0], e) && s0(h[1], e, c[1])) + return o; + n && f(c[0], o), n && f(c[1], o); + } + } + if (n) + return e === 1 / 0 ? t.length - 1 : e === -1 / 0 ? 0 : i; + function f(v, b) { + var w = Math.abs(v - e); + w < a && (a = w, i = b); + } + }, r.visualHandlers = { + color: { + applyVisual: pp("color"), + getColorMapper: function() { + var e = this.option; + return ft(e.mappingMethod === "category" ? function(t, n) { + return !n && (t = this._normalizeData(t)), Lp.call(this, t); + } : function(t, n, i) { + var a = !!i; + return !n && (t = this._normalizeData(t)), i = jp(t, e.parsedVisual, i), a ? i : Ns(i, "rgba"); + }, this); + }, + _normalizedToVisual: { + linear: function(e) { + return Ns(jp(e, this.option.parsedVisual), "rgba"); + }, + category: Lp, + piecewise: function(e, t) { + var n = mT.call(this, t); + return n == null && (n = Ns(jp(e, this.option.parsedVisual), "rgba")), n; + }, + fixed: ph + } + }, + colorHue: o0(function(e, t) { + return bd(e, t); + }), + colorSaturation: o0(function(e, t) { + return bd(e, null, t); + }), + colorLightness: o0(function(e, t) { + return bd(e, null, null, t); + }), + colorAlpha: o0(function(e, t) { + return ug(e, t); + }), + decal: { + applyVisual: pp("decal"), + _normalizedToVisual: { + linear: null, + category: Lp, + piecewise: null, + fixed: null + } + }, + opacity: { + applyVisual: pp("opacity"), + _normalizedToVisual: gT([0, 1]) + }, + liftZ: { + applyVisual: pp("liftZ"), + _normalizedToVisual: { + linear: ph, + category: ph, + piecewise: ph, + fixed: ph + } + }, + symbol: { + applyVisual: function(e, t, n) { + var i = this.mapValueToVisual(e); + n("symbol", i); + }, + _normalizedToVisual: { + linear: JL, + category: Lp, + piecewise: function(e, t) { + var n = mT.call(this, t); + return n == null && (n = JL.call(this, e)), n; + }, + fixed: ph + } + }, + symbolSize: { + applyVisual: pp("symbolSize"), + _normalizedToVisual: gT([0, 1]) + } + }, r; + }() +); +function Voe(r) { + var e = r.pieceList; + r.hasSpecialVisual = !1, X(e, function(t, n) { + t.originIndex = n, t.visual != null && (r.hasSpecialVisual = !0); + }); +} +function Goe(r) { + var e = r.categories, t = r.categoryMap = {}, n = r.visual; + if (kg(e, function(o, s) { + t[o] = s; + }), !We(n)) { + var i = []; + kt(n) ? kg(n, function(o, s) { + var l = t[s]; + i[l != null ? l : V_] = o; + }) : i[V_] = n, n = PH(r, i); + } + for (var a = e.length - 1; a >= 0; a--) + n[a] == null && (delete t[e[a]], e.pop()); +} +function Mw(r, e) { + var t = r.visual, n = []; + kt(t) ? kg(t, function(a) { + n.push(a); + }) : t != null && n.push(t); + var i = { + color: 1, + symbol: 1 + }; + !e && n.length === 1 && !i.hasOwnProperty(r.type) && (n[1] = n[0]), PH(r, n); +} +function o0(r) { + return { + applyVisual: function(e, t, n) { + var i = this.mapValueToVisual(e); + n("color", r(t("color"), i)); + }, + _normalizedToVisual: gT([0, 1]) + }; +} +function JL(r) { + var e = this.option.visual; + return e[Math.round(Zr(r, [0, 1], [0, e.length - 1], !0))] || {}; +} +function pp(r) { + return function(e, t, n) { + n(r, this.mapValueToVisual(e)); + }; +} +function Lp(r) { + var e = this.option.visual; + return e[this.option.loop && r !== V_ ? r % e.length : r]; +} +function ph() { + return this.option.visual[0]; +} +function gT(r) { + return { + linear: function(e) { + return Zr(e, r, this.option.visual, !0); + }, + category: Lp, + piecewise: function(e, t) { + var n = mT.call(this, t); + return n == null && (n = Zr(e, r, this.option.visual, !0)), n; + }, + fixed: ph + }; +} +function mT(r) { + var e = this.option, t = e.pieceList; + if (e.hasSpecialVisual) { + var n = sE.findPieceIndex(r, t), i = t[n]; + if (i && i.visual) + return i.visual[this.type]; + } +} +function PH(r, e) { + return r.visual = e, r.type === "color" && (r.parsedVisual = Ke(e, function(t) { + var n = Ma(t); + return n || [0, 0, 0, 1]; + })), e; +} +var Uoe = { + linear: function(r) { + return Zr(r, this.option.dataExtent, [0, 1], !0); + }, + piecewise: function(r) { + var e = this.option.pieceList, t = sE.findPieceIndex(r, e, !0); + if (t != null) + return Zr(t, [0, e.length - 1], [0, 1], !0); + }, + category: function(r) { + var e = this.option.categories ? this.option.categoryMap[r] : r; + return e == null ? V_ : e; + }, + fixed: Qn +}; +function s0(r, e, t) { + return r ? e <= t : e < t; +} +const Wi = sE; +var Woe = "itemStyle", RH = Rr(); +const Yoe = { + seriesType: "treemap", + reset: function(r) { + var e = r.getData().tree, t = e.root; + t.isRemoved() || NH( + t, + // Visual should calculate from tree root but not view root. + {}, + r.getViewRoot().getAncestors(), + r + ); + } +}; +function NH(r, e, t, n) { + var i = r.getModel(), a = r.getLayout(), o = r.hostTree.data; + if (!(!a || a.invisible || !a.isInView)) { + var s = i.getModel(Woe), l = Xoe(s, e, n), u = o.ensureUniqueItemVisual(r.dataIndex, "style"), c = s.get("borderColor"), h = s.get("borderColorSaturation"), f; + h != null && (f = KL(l), c = Zoe(h, f)), u.stroke = c; + var v = r.viewChildren; + if (!v || !v.length) + f = KL(l), u.fill = f; + else { + var b = Joe(r, i, a, s, l, v); + X(v, function(w, p) { + if (w.depth >= t.length || w === t[w.depth]) { + var d = Koe(i, l, w, p, b, n); + NH(w, d, t, n); + } + }); + } + } +} +function Xoe(r, e, t) { + var n = Fe({}, e), i = t.designatedVisualItemStyle; + return X(["color", "colorAlpha", "colorSaturation"], function(a) { + i[a] = e[a]; + var o = r.get(a); + i[a] = null, o != null && (n[a] = o); + }), n; +} +function KL(r) { + var e = Dw(r, "color"); + if (e) { + var t = Dw(r, "colorAlpha"), n = Dw(r, "colorSaturation"); + return n && (e = bd(e, null, null, n)), t && (e = ug(e, t)), e; + } +} +function Zoe(r, e) { + return e != null ? bd(e, null, null, r) : null; +} +function Dw(r, e) { + var t = r[e]; + if (t != null && t !== "none") + return t; +} +function Joe(r, e, t, n, i, a) { + if (!(!a || !a.length)) { + var o = kw(e, "color") || i.color != null && i.color !== "none" && (kw(e, "colorAlpha") || kw(e, "colorSaturation")); + if (o) { + var s = e.get("visualMin"), l = e.get("visualMax"), u = t.dataExtent.slice(); + s != null && s < u[0] && (u[0] = s), l != null && l > u[1] && (u[1] = l); + var c = e.get("colorMappingBy"), h = { + type: o.name, + dataExtent: u, + visual: o.range + }; + h.type === "color" && (c === "index" || c === "id") ? (h.mappingMethod = "category", h.loop = !0) : h.mappingMethod = "linear"; + var f = new Wi(h); + return RH(f).drColorMappingBy = c, f; + } + } +} +function kw(r, e) { + var t = r.get(e); + return We(t) && t.length ? { + name: e, + range: t + } : null; +} +function Koe(r, e, t, n, i, a) { + var o = Fe({}, e); + if (i) { + var s = i.type, l = s === "color" && RH(i).drColorMappingBy, u = l === "index" ? n : l === "id" ? a.mapIdToIndex(t.getId()) : t.getValue(r.get("visualDimension")); + o[s] = i.mapValueToVisual(u); + } + return o; +} +var Og = Math.max, G_ = Math.min, QL = Ii, lE = X, zH = ["itemStyle", "borderWidth"], Qoe = ["itemStyle", "gapWidth"], qoe = ["upperLabel", "show"], ese = ["upperLabel", "height"]; +const tse = { + seriesType: "treemap", + reset: function(r, e, t, n) { + var i = t.getWidth(), a = t.getHeight(), o = r.option, s = yi(r.getBoxLayoutParams(), { + width: t.getWidth(), + height: t.getHeight() + }), l = o.size || [], u = ot(QL(s.width, l[0]), i), c = ot(QL(s.height, l[1]), a), h = n && n.type, f = ["treemapZoomToNode", "treemapRootToNode"], v = Dg(n, f, r), b = h === "treemapRender" || h === "treemapMove" ? n.rootRect : null, w = r.getViewRoot(), p = kH(w); + if (h !== "treemapMove") { + var d = h === "treemapZoomToNode" ? sse(r, v, w, u, c) : b ? [b.width, b.height] : [u, c], m = o.sort; + m && m !== "asc" && m !== "desc" && (m = "desc"); + var _ = { + squareRatio: o.squareRatio, + sort: m, + leafDepth: o.leafDepth + }; + w.hostTree.clearLayouts(); + var y = { + x: 0, + y: 0, + width: d[0], + height: d[1], + area: d[0] * d[1] + }; + w.setLayout(y), BH(w, _, !1, 0), y = w.getLayout(), lE(p, function(g, S) { + var T = (p[S + 1] || w).getValue(); + g.setLayout(Fe({ + dataExtent: [T, T], + borderWidth: 0, + upperHeight: 0 + }, y)); + }); + } + var x = r.getData().tree.root; + x.setLayout(lse(s, b, v), !0), r.setLayoutInfo(s), jH( + x, + // Transform to base element coordinate system. + new Wt(-s.x, -s.y, i, a), + p, + w, + 0 + ); + } +}; +function BH(r, e, t, n) { + var i, a; + if (!r.isRemoved()) { + var o = r.getLayout(); + i = o.width, a = o.height; + var s = r.getModel(), l = s.get(zH), u = s.get(Qoe) / 2, c = FH(s), h = Math.max(l, c), f = l - u, v = h - u; + r.setLayout({ + borderWidth: l, + upperHeight: h, + upperLabelHeight: c + }, !0), i = Og(i - 2 * f, 0), a = Og(a - f - v, 0); + var b = i * a, w = rse(r, s, b, e, t, n); + if (w.length) { + var p = { + x: f, + y: v, + width: i, + height: a + }, d = G_(i, a), m = 1 / 0, _ = []; + _.area = 0; + for (var y = 0, x = w.length; y < x; ) { + var g = w[y]; + _.push(g), _.area += g.getLayout().area; + var S = ose(_, d, e.squareRatio); + S <= m ? (y++, m = S) : (_.area -= _.pop().getLayout().area, qL(_, d, p, u, !1), d = G_(p.width, p.height), _.length = _.area = 0, m = 1 / 0); + } + if (_.length && qL(_, d, p, u, !0), !t) { + var T = s.get("childrenVisibleMin"); + T != null && b < T && (t = !0); + } + for (var y = 0, x = w.length; y < x; y++) + BH(w[y], e, t, n + 1); + } + } +} +function rse(r, e, t, n, i, a) { + var o = r.children || [], s = n.sort; + s !== "asc" && s !== "desc" && (s = null); + var l = n.leafDepth != null && n.leafDepth <= a; + if (i && !l) + return r.viewChildren = []; + o = Jr(o, function(v) { + return !v.isRemoved(); + }), ise(o, s); + var u = ase(e, o, s); + if (u.sum === 0) + return r.viewChildren = []; + if (u.sum = nse(e, t, u.sum, s, o), u.sum === 0) + return r.viewChildren = []; + for (var c = 0, h = o.length; c < h; c++) { + var f = o[c].getValue() / u.sum * t; + o[c].setLayout({ + area: f + }); + } + return l && (o.length && r.setLayout({ + isLeafRoot: !0 + }, !0), o.length = 0), r.viewChildren = o, r.setLayout({ + dataExtent: u.dataExtent + }, !0), o; +} +function nse(r, e, t, n, i) { + if (!n) + return t; + for (var a = r.get("visibleMin"), o = i.length, s = o, l = o - 1; l >= 0; l--) { + var u = i[n === "asc" ? o - l - 1 : l].getValue(); + u / t * e < a && (s = l, t -= u); + } + return n === "asc" ? i.splice(0, o - s) : i.splice(s, o - s), t; +} +function ise(r, e) { + return e && r.sort(function(t, n) { + var i = e === "asc" ? t.getValue() - n.getValue() : n.getValue() - t.getValue(); + return i === 0 ? e === "asc" ? t.dataIndex - n.dataIndex : n.dataIndex - t.dataIndex : i; + }), r; +} +function ase(r, e, t) { + for (var n = 0, i = 0, a = e.length; i < a; i++) + n += e[i].getValue(); + var o = r.get("visualDimension"), s; + return !e || !e.length ? s = [NaN, NaN] : o === "value" && t ? (s = [e[e.length - 1].getValue(), e[0].getValue()], t === "asc" && s.reverse()) : (s = [1 / 0, -1 / 0], lE(e, function(l) { + var u = l.getValue(o); + u < s[0] && (s[0] = u), u > s[1] && (s[1] = u); + })), { + sum: n, + dataExtent: s + }; +} +function ose(r, e, t) { + for (var n = 0, i = 1 / 0, a = 0, o = void 0, s = r.length; a < s; a++) + o = r[a].getLayout().area, o && (o < i && (i = o), o > n && (n = o)); + var l = r.area * r.area, u = e * e * t; + return l ? Og(u * n / l, l / (u * i)) : 1 / 0; +} +function qL(r, e, t, n, i) { + var a = e === t.width ? 0 : 1, o = 1 - a, s = ["x", "y"], l = ["width", "height"], u = t[s[a]], c = e ? r.area / e : 0; + (i || c > t[l[o]]) && (c = t[l[o]]); + for (var h = 0, f = r.length; h < f; h++) { + var v = r[h], b = {}, w = c ? v.getLayout().area / c : 0, p = b[l[o]] = Og(c - 2 * n, 0), d = t[s[a]] + t[l[a]] - u, m = h === f - 1 || d < w ? d : w, _ = b[l[a]] = Og(m - 2 * n, 0); + b[s[o]] = t[s[o]] + G_(n, p / 2), b[s[a]] = u + G_(n, _ / 2), u += m, v.setLayout(b, !0); + } + t[s[o]] += c, t[l[o]] -= c; +} +function sse(r, e, t, n, i) { + var a = (e || {}).node, o = [n, i]; + if (!a || a === t) + return o; + for (var s, l = n * i, u = l * r.option.zoomToNodeRatio; s = a.parentNode; ) { + for (var c = 0, h = s.children, f = 0, v = h.length; f < v; f++) + c += h[f].getValue(); + var b = a.getValue(); + if (b === 0) + return o; + u *= c / b; + var w = s.getModel(), p = w.get(zH), d = Math.max(p, FH(w)); + u += 4 * p * p + (3 * p + d) * Math.pow(u, 0.5), u > I1 && (u = I1), a = s; + } + u < l && (u = l); + var m = Math.pow(u / l, 0.5); + return [n * m, i * m]; +} +function lse(r, e, t) { + if (e) + return { + x: e.x, + y: e.y + }; + var n = { + x: 0, + y: 0 + }; + if (!t) + return n; + var i = t.node, a = i.getLayout(); + if (!a) + return n; + for (var o = [a.width / 2, a.height / 2], s = i; s; ) { + var l = s.getLayout(); + o[0] += l.x, o[1] += l.y, s = s.parentNode; + } + return { + x: r.width / 2 - o[0], + y: r.height / 2 - o[1] + }; +} +function jH(r, e, t, n, i) { + var a = r.getLayout(), o = t[i], s = o && o === r; + if (!(o && !s || i === t.length && r !== n)) { + r.setLayout({ + // isInView means: viewRoot sub tree + viewAbovePath + isInView: !0, + // invisible only means: outside view clip so that the node can not + // see but still layout for animation preparation but not render. + invisible: !s && !e.intersect(a), + isAboveViewRoot: s + }, !0); + var l = new Wt(e.x - a.x, e.y - a.y, e.width, e.height); + lE(r.viewChildren || [], function(u) { + jH(u, l, t, n, i + 1); + }); + } +} +function FH(r) { + return r.get(qoe) ? r.get(ese) : 0; +} +function use(r) { + r.registerSeriesModel(Aoe), r.registerChartView($oe), r.registerVisual(Yoe), r.registerLayout(tse), Coe(r); +} +function cse(r) { + var e = r.findComponents({ + mainType: "legend" + }); + !e || !e.length || r.eachSeriesByType("graph", function(t) { + var n = t.getCategoriesData(), i = t.getGraph(), a = i.data, o = n.mapArray(n.getName); + a.filterSelf(function(s) { + var l = a.getItemModel(s), u = l.getShallow("category"); + if (u != null) { + Pr(u) && (u = o[u]); + for (var c = 0; c < e.length; c++) + if (!e[c].isSelected(u)) + return !1; + } + return !0; + }); + }); +} +function hse(r) { + var e = {}; + r.eachSeriesByType("graph", function(t) { + var n = t.getCategoriesData(), i = t.getData(), a = {}; + n.each(function(o) { + var s = n.getName(o); + a["ec-" + s] = o; + var l = n.getItemModel(o), u = l.getModel("itemStyle").getItemStyle(); + u.fill || (u.fill = t.getColorFromPalette(s, e)), n.setItemVisual(o, "style", u); + for (var c = ["symbol", "symbolSize", "symbolKeepAspect"], h = 0; h < c.length; h++) { + var f = l.getShallow(c[h], !0); + f != null && n.setItemVisual(o, c[h], f); + } + }), n.count() && i.each(function(o) { + var s = i.getItemModel(o), l = s.getShallow("category"); + if (l != null) { + ut(l) && (l = a["ec-" + l]); + var u = n.getItemVisual(l, "style"), c = i.ensureUniqueItemVisual(o, "style"); + Fe(c, u); + for (var h = ["symbol", "symbolSize", "symbolKeepAspect"], f = 0; f < h.length; f++) + i.setItemVisual(o, h[f], n.getItemVisual(l, h[f])); + } + }); + }); +} +function l0(r) { + return r instanceof Array || (r = [r, r]), r; +} +function fse(r) { + r.eachSeriesByType("graph", function(e) { + var t = e.getGraph(), n = e.getEdgeData(), i = l0(e.get("edgeSymbol")), a = l0(e.get("edgeSymbolSize")); + n.setVisual("fromSymbol", i && i[0]), n.setVisual("toSymbol", i && i[1]), n.setVisual("fromSymbolSize", a && a[0]), n.setVisual("toSymbolSize", a && a[1]), n.setVisual("style", e.getModel("lineStyle").getLineStyle()), n.each(function(o) { + var s = n.getItemModel(o), l = t.getEdgeByIndex(o), u = l0(s.getShallow("symbol", !0)), c = l0(s.getShallow("symbolSize", !0)), h = s.getModel("lineStyle").getLineStyle(), f = n.ensureUniqueItemVisual(o, "style"); + switch (Fe(f, h), f.stroke) { + case "source": { + var v = l.node1.getVisual("style"); + f.stroke = v && v.fill; + break; + } + case "target": { + var v = l.node2.getVisual("style"); + f.stroke = v && v.fill; + break; + } + } + u[0] && l.setVisual("fromSymbol", u[0]), u[1] && l.setVisual("toSymbol", u[1]), c[0] && l.setVisual("fromSymbolSize", c[0]), c[1] && l.setVisual("toSymbolSize", c[1]); + }); + }); +} +var yT = "-->", fx = function(r) { + return r.get("autoCurveness") || null; +}, $H = function(r, e) { + var t = fx(r), n = 20, i = []; + if (Pr(t)) + n = t; + else if (We(t)) { + r.__curvenessList = t; + return; + } + e > n && (n = e); + var a = n % 2 ? n + 2 : n + 3; + i = []; + for (var o = 0; o < a; o++) + i.push((o % 2 ? o + 1 : o) / 10 * (o % 2 ? -1 : 1)); + r.__curvenessList = i; +}, Lg = function(r, e, t) { + var n = [r.id, r.dataIndex].join("."), i = [e.id, e.dataIndex].join("."); + return [t.uid, n, i].join(yT); +}, HH = function(r) { + var e = r.split(yT); + return [e[0], e[2], e[1]].join(yT); +}, dse = function(r, e) { + var t = Lg(r.node1, r.node2, e); + return e.__edgeMap[t]; +}, vse = function(r, e) { + var t = _T(Lg(r.node1, r.node2, e), e), n = _T(Lg(r.node2, r.node1, e), e); + return t + n; +}, _T = function(r, e) { + var t = e.__edgeMap; + return t[r] ? t[r].length : 0; +}; +function pse(r) { + fx(r) && (r.__curvenessList = [], r.__edgeMap = {}, $H(r)); +} +function gse(r, e, t, n) { + if (fx(t)) { + var i = Lg(r, e, t), a = t.__edgeMap, o = a[HH(i)]; + a[i] && !o ? a[i].isForward = !0 : o && a[i] && (o.isForward = !0, a[i].isForward = !1), a[i] = a[i] || [], a[i].push(n); + } +} +function uE(r, e, t, n) { + var i = fx(e), a = We(i); + if (!i) + return null; + var o = dse(r, e); + if (!o) + return null; + for (var s = -1, l = 0; l < o.length; l++) + if (o[l] === t) { + s = l; + break; + } + var u = vse(r, e); + $H(e, u), r.lineStyle = r.lineStyle || {}; + var c = Lg(r.node1, r.node2, e), h = e.__curvenessList, f = a || u % 2 ? 0 : 1; + if (o.isForward) + return h[f + s]; + var v = HH(c), b = _T(v, e), w = h[s + b + f]; + return n ? a ? i && i[0] === 0 ? (b + f) % 2 ? w : -w : ((b % 2 ? 0 : 1) + f) % 2 ? w : -w : (b + f) % 2 ? w : -w : h[s + b + f]; +} +function VH(r) { + var e = r.coordinateSystem; + if (!(e && e.type !== "view")) { + var t = r.getGraph(); + t.eachNode(function(n) { + var i = n.getModel(); + n.setLayout([+i.get("x"), +i.get("y")]); + }), cE(t, r); + } +} +function cE(r, e) { + r.eachEdge(function(t, n) { + var i = Ps(t.getModel().get(["lineStyle", "curveness"]), -uE(t, e, n, !0), 0), a = bl(t.node1.getLayout()), o = bl(t.node2.getLayout()), s = [a, o]; + +i && s.push([(a[0] + o[0]) / 2 - (a[1] - o[1]) * i, (a[1] + o[1]) / 2 - (o[0] - a[0]) * i]), t.setLayout(s); + }); +} +function mse(r, e) { + r.eachSeriesByType("graph", function(t) { + var n = t.get("layout"), i = t.coordinateSystem; + if (i && i.type !== "view") { + var a = t.getData(), o = []; + X(i.dimensions, function(f) { + o = o.concat(a.mapDimensionsAll(f)); + }); + for (var s = 0; s < a.count(); s++) { + for (var l = [], u = !1, c = 0; c < o.length; c++) { + var h = a.get(o[c], s); + isNaN(h) || (u = !0), l.push(h); + } + u ? a.setItemLayout(s, i.dataToPoint(l)) : a.setItemLayout(s, [NaN, NaN]); + } + cE(a.graph, t); + } else + (!n || n === "none") && VH(t); + }); +} +function Pp(r) { + var e = r.coordinateSystem; + if (e.type !== "view") + return 1; + var t = r.option.nodeScaleRatio, n = e.scaleX, i = e.getZoom(), a = (i - 1) * t + 1; + return a / n; +} +function Rp(r) { + var e = r.getVisual("symbolSize"); + return e instanceof Array && (e = (e[0] + e[1]) / 2), +e; +} +var eP = Math.PI, Ow = []; +function hE(r, e, t, n) { + var i = r.coordinateSystem; + if (!(i && i.type !== "view")) { + var a = i.getBoundingRect(), o = r.getData(), s = o.graph, l = a.width / 2 + a.x, u = a.height / 2 + a.y, c = Math.min(a.width, a.height) / 2, h = o.count(); + if (o.setLayout({ + cx: l, + cy: u + }), !!h) { + if (t) { + var f = i.pointToData(n), v = f[0], b = f[1], w = [v - l, b - u]; + rf(w, w), zp(w, w, c), t.setLayout([l + w[0], u + w[1]], !0); + var p = r.get(["circular", "rotateLabel"]); + GH(t, p, l, u); + } + yse[e](r, s, o, c, l, u, h), s.eachEdge(function(d, m) { + var _ = Ps(d.getModel().get(["lineStyle", "curveness"]), uE(d, r, m), 0), y = bl(d.node1.getLayout()), x = bl(d.node2.getLayout()), g, S = (y[0] + x[0]) / 2, T = (y[1] + x[1]) / 2; + +_ && (_ *= 3, g = [l * _ + S * (1 - _), u * _ + T * (1 - _)]), d.setLayout([y, x, g]); + }); + } + } +} +var yse = { + value: function(r, e, t, n, i, a, o) { + var s = 0, l = t.getSum("value"), u = Math.PI * 2 / (l || o); + e.eachNode(function(c) { + var h = c.getValue("value"), f = u * (l ? h : 1) / 2; + s += f, c.setLayout([n * Math.cos(s) + i, n * Math.sin(s) + a]), s += f; + }); + }, + symbolSize: function(r, e, t, n, i, a, o) { + var s = 0; + Ow.length = o; + var l = Pp(r); + e.eachNode(function(h) { + var f = Rp(h); + isNaN(f) && (f = 2), f < 0 && (f = 0), f *= l; + var v = Math.asin(f / 2 / n); + isNaN(v) && (v = eP / 2), Ow[h.dataIndex] = v, s += v * 2; + }); + var u = (2 * eP - s) / o / 2, c = 0; + e.eachNode(function(h) { + var f = u + Ow[h.dataIndex]; + c += f, (!h.getLayout() || !h.getLayout().fixed) && h.setLayout([n * Math.cos(c) + i, n * Math.sin(c) + a]), c += f; + }); + } +}; +function GH(r, e, t, n) { + var i = r.getGraphicEl(); + if (i) { + var a = r.getModel(), o = a.get(["label", "rotate"]) || 0, s = i.getSymbolPath(); + if (e) { + var l = r.getLayout(), u = Math.atan2(l[1] - n, l[0] - t); + u < 0 && (u = Math.PI * 2 + u); + var c = l[0] < t; + c && (u = u - Math.PI); + var h = c ? "left" : "right"; + s.setTextConfig({ + rotation: -u, + position: h, + origin: "center" + }); + var f = s.ensureState("emphasis"); + Fe(f.textConfig || (f.textConfig = {}), { + position: h + }); + } else + s.setTextConfig({ + rotation: o *= Math.PI / 180 + }); + } +} +function _se(r) { + r.eachSeriesByType("graph", function(e) { + e.get("layout") === "circular" && hE(e, "symbolSize"); + }); +} +var Jf = l_; +function bse(r, e, t) { + for (var n = r, i = e, a = t.rect, o = a.width, s = a.height, l = [a.x + o / 2, a.y + s / 2], u = t.gravity == null ? 0.1 : t.gravity, c = 0; c < n.length; c++) { + var h = n[c]; + h.p || (h.p = Sc(o * (Math.random() - 0.5) + l[0], s * (Math.random() - 0.5) + l[1])), h.pp = bl(h.p), h.edges = null; + } + var f = t.friction == null ? 0.6 : t.friction, v = f, b, w; + return { + warmUp: function() { + v = f * 0.8; + }, + setFixed: function(p) { + n[p].fixed = !0; + }, + setUnfixed: function(p) { + n[p].fixed = !1; + }, + /** + * Before step hook + */ + beforeStep: function(p) { + b = p; + }, + /** + * After step hook + */ + afterStep: function(p) { + w = p; + }, + /** + * Some formulas were originally copied from "d3.js" + * https://github.com/d3/d3/blob/b516d77fb8566b576088e73410437494717ada26/src/layout/force.js + * with some modifications made for this project. + * See the license statement at the head of this file. + */ + step: function(p) { + b && b(n, i); + for (var d = [], m = n.length, _ = 0; _ < i.length; _++) { + var y = i[_]; + if (!y.ignoreForceLayout) { + var x = y.n1, g = y.n2; + Yu(d, g.p, x.p); + var S = og(d) - y.d, T = g.w / (x.w + g.w); + isNaN(T) && (T = 0), rf(d, d), !x.fixed && Jf(x.p, x.p, d, T * S * v), !g.fixed && Jf(g.p, g.p, d, -(1 - T) * S * v); + } + } + for (var _ = 0; _ < m; _++) { + var C = n[_]; + C.fixed || (Yu(d, l, C.p), Jf(C.p, C.p, d, u * v)); + } + for (var _ = 0; _ < m; _++) + for (var x = n[_], E = _ + 1; E < m; E++) { + var g = n[E]; + Yu(d, g.p, x.p); + var S = og(d); + S === 0 && (fj(d, Math.random() - 0.5, Math.random() - 0.5), S = 1); + var M = (x.rep + g.rep) / S / S; + !x.fixed && Jf(x.pp, x.pp, d, M), !g.fixed && Jf(g.pp, g.pp, d, -M); + } + for (var P = [], _ = 0; _ < m; _++) { + var C = n[_]; + C.fixed || (Yu(P, C.p, C.pp), Jf(C.p, C.p, P, v), ca(C.pp, C.p)); + } + v = v * 0.992; + var R = v < 0.01; + w && w(n, i, R), p && p(R); + } + }; +} +function xse(r) { + r.eachSeriesByType("graph", function(e) { + var t = e.coordinateSystem; + if (!(t && t.type !== "view")) + if (e.get("layout") === "force") { + var n = e.preservedPoints || {}, i = e.getGraph(), a = i.data, o = i.edgeData, s = e.getModel("force"), l = s.get("initLayout"); + e.preservedPoints ? a.each(function(_) { + var y = a.getId(_); + a.setItemLayout(_, n[y] || [NaN, NaN]); + }) : !l || l === "none" ? VH(e) : l === "circular" && hE(e, "value"); + var u = a.getDataExtent("value"), c = o.getDataExtent("value"), h = s.get("repulsion"), f = s.get("edgeLength"), v = We(h) ? h : [h, h], b = We(f) ? f : [f, f]; + b = [b[1], b[0]]; + var w = a.mapArray("value", function(_, y) { + var x = a.getItemLayout(y), g = Zr(_, u, v); + return isNaN(g) && (g = (v[0] + v[1]) / 2), { + w: g, + rep: g, + fixed: a.getItemModel(y).get("fixed"), + p: !x || isNaN(x[0]) || isNaN(x[1]) ? null : x + }; + }), p = o.mapArray("value", function(_, y) { + var x = i.getEdgeByIndex(y), g = Zr(_, c, b); + isNaN(g) && (g = (b[0] + b[1]) / 2); + var S = x.getModel(), T = Ps(x.getModel().get(["lineStyle", "curveness"]), -uE(x, e, y, !0), 0); + return { + n1: w[x.node1.dataIndex], + n2: w[x.node2.dataIndex], + d: g, + curveness: T, + ignoreForceLayout: S.get("ignoreForceLayout") + }; + }), d = t.getBoundingRect(), m = bse(w, p, { + rect: d, + gravity: s.get("gravity"), + friction: s.get("friction") + }); + m.beforeStep(function(_, y) { + for (var x = 0, g = _.length; x < g; x++) + _[x].fixed && ca(_[x].p, i.getNodeByIndex(x).getLayout()); + }), m.afterStep(function(_, y, x) { + for (var g = 0, S = _.length; g < S; g++) + _[g].fixed || i.getNodeByIndex(g).setLayout(_[g].p), n[a.getId(g)] = _[g].p; + for (var g = 0, S = y.length; g < S; g++) { + var T = y[g], C = i.getEdgeByIndex(g), E = T.n1.p, M = T.n2.p, P = C.getLayout(); + P = P ? P.slice() : [], P[0] = P[0] || [], P[1] = P[1] || [], ca(P[0], E), ca(P[1], M), +T.curveness && (P[2] = [(E[0] + M[0]) / 2 - (E[1] - M[1]) * T.curveness, (E[1] + M[1]) / 2 - (M[0] - E[0]) * T.curveness]), C.setLayout(P); + } + }), e.forceLayout = m, e.preservedPoints = n, m.step(); + } else + e.forceLayout = null; + }); +} +function Sse(r, e, t) { + var n = Fe(r.getBoxLayoutParams(), { + aspect: t + }); + return yi(n, { + width: e.getWidth(), + height: e.getHeight() + }); +} +function wse(r, e) { + var t = []; + return r.eachSeriesByType("graph", function(n) { + var i = n.get("coordinateSystem"); + if (!i || i === "view") { + var a = n.getData(), o = a.mapArray(function(p) { + var d = a.getItemModel(p); + return [+d.get("x"), +d.get("y")]; + }), s = [], l = []; + Pb(o, s, l), l[0] - s[0] === 0 && (l[0] += 1, s[0] -= 1), l[1] - s[1] === 0 && (l[1] += 1, s[1] -= 1); + var u = (l[0] - s[0]) / (l[1] - s[1]), c = Sse(n, e, u); + isNaN(u) && (s = [c.x, c.y], l = [c.x + c.width, c.y + c.height]); + var h = l[0] - s[0], f = l[1] - s[1], v = c.width, b = c.height, w = n.coordinateSystem = new pm(); + w.zoomLimit = n.get("scaleLimit"), w.setBoundingRect(s[0], s[1], h, f), w.setViewRect(c.x, c.y, v, b), w.setCenter(n.get("center"), e), w.setZoom(n.get("zoom")), t.push(w); + } + }), t; +} +var tP = Ai.prototype, Lw = qg.prototype, UH = ( + /** @class */ + function() { + function r() { + this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0, this.percent = 1; + } + return r; + }() +); +(function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e; +})(UH); +function Pw(r) { + return isNaN(+r.cpx1) || isNaN(+r.cpy1); +} +var Cse = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "ec-line", n; + } + return e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new UH(); + }, e.prototype.buildPath = function(t, n) { + Pw(n) ? tP.buildPath.call(this, t, n) : Lw.buildPath.call(this, t, n); + }, e.prototype.pointAt = function(t) { + return Pw(this.shape) ? tP.pointAt.call(this, t) : Lw.pointAt.call(this, t); + }, e.prototype.tangentAt = function(t) { + var n = this.shape, i = Pw(n) ? [n.x2 - n.x1, n.y2 - n.y1] : Lw.tangentAt.call(this, t); + return rf(i, i); + }, e; + }(hr) +); +const Tse = Cse; +var Rw = ["fromSymbol", "toSymbol"]; +function rP(r) { + return "_" + r + "Type"; +} +function nP(r, e, t) { + var n = e.getItemVisual(t, r); + if (!n || n === "none") + return n; + var i = e.getItemVisual(t, r + "Size"), a = e.getItemVisual(t, r + "Rotate"), o = e.getItemVisual(t, r + "Offset"), s = e.getItemVisual(t, r + "KeepAspect"), l = lv(i), u = sf(o || 0, l); + return n + l + u + (a || "") + (s || ""); +} +function iP(r, e, t) { + var n = e.getItemVisual(t, r); + if (!(!n || n === "none")) { + var i = e.getItemVisual(t, r + "Size"), a = e.getItemVisual(t, r + "Rotate"), o = e.getItemVisual(t, r + "Offset"), s = e.getItemVisual(t, r + "KeepAspect"), l = lv(i), u = sf(o || 0, l), c = li(n, -l[0] / 2 + u[0], -l[1] / 2 + u[1], l[0], l[1], null, s); + return c.__specifiedRotation = a == null || isNaN(a) ? void 0 : +a * Math.PI / 180 || 0, c.name = r, c; + } +} +function Ise(r) { + var e = new Tse({ + name: "line", + subPixelOptimize: !0 + }); + return bT(e.shape, r), e; +} +function bT(r, e) { + r.x1 = e[0][0], r.y1 = e[0][1], r.x2 = e[1][0], r.y2 = e[1][1], r.percent = 1; + var t = e[2]; + t ? (r.cpx1 = t[0], r.cpy1 = t[1]) : (r.cpx1 = NaN, r.cpy1 = NaN); +} +var Ase = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this) || this; + return a._createLine(t, n, i), a; + } + return e.prototype._createLine = function(t, n, i) { + var a = t.hostModel, o = t.getItemLayout(n), s = Ise(o); + s.shape.percent = 0, An(s, { + shape: { + percent: 1 + } + }, a, n), this.add(s), X(Rw, function(l) { + var u = iP(l, t, n); + this.add(u), this[rP(l)] = nP(l, t, n); + }, this), this._updateCommonStl(t, n, i); + }, e.prototype.updateData = function(t, n, i) { + var a = t.hostModel, o = this.childOfName("line"), s = t.getItemLayout(n), l = { + shape: {} + }; + bT(l.shape, s), zr(o, l, a, n), X(Rw, function(u) { + var c = nP(u, t, n), h = rP(u); + if (this[h] !== c) { + this.remove(this.childOfName(u)); + var f = iP(u, t, n); + this.add(f); + } + this[h] = c; + }, this), this._updateCommonStl(t, n, i); + }, e.prototype.getLinePath = function() { + return this.childAt(0); + }, e.prototype._updateCommonStl = function(t, n, i) { + var a = t.hostModel, o = this.childOfName("line"), s = i && i.emphasisLineStyle, l = i && i.blurLineStyle, u = i && i.selectLineStyle, c = i && i.labelStatesModels, h = i && i.emphasisDisabled, f = i && i.focus, v = i && i.blurScope; + if (!i || t.hasItemOption) { + var b = t.getItemModel(n), w = b.getModel("emphasis"); + s = w.getModel("lineStyle").getLineStyle(), l = b.getModel(["blur", "lineStyle"]).getLineStyle(), u = b.getModel(["select", "lineStyle"]).getLineStyle(), h = w.get("disabled"), f = w.get("focus"), v = w.get("blurScope"), c = Mi(b); + } + var p = t.getItemVisual(n, "style"), d = p.stroke; + o.useStyle(p), o.style.fill = null, o.style.strokeNoScale = !0, o.ensureState("emphasis").style = s, o.ensureState("blur").style = l, o.ensureState("select").style = u, X(Rw, function(g) { + var S = this.childOfName(g); + if (S) { + S.setColor(d), S.style.opacity = p.opacity; + for (var T = 0; T < ka.length; T++) { + var C = ka[T], E = o.getState(C); + if (E) { + var M = E.style || {}, P = S.ensureState(C), R = P.style || (P.style = {}); + M.stroke != null && (R[S.__isEmptyBrush ? "stroke" : "fill"] = M.stroke), M.opacity != null && (R.opacity = M.opacity); + } + } + S.markRedraw(); + } + }, this); + var m = a.getRawValue(n); + Zi(this, c, { + labelDataIndex: n, + labelFetcher: { + getFormattedLabel: function(g, S) { + return a.getFormattedLabel(g, S, t.dataType); + } + }, + inheritColor: d || "#000", + defaultOpacity: p.opacity, + defaultText: (m == null ? t.getName(n) : isFinite(m) ? Vn(m) : m) + "" + }); + var _ = this.getTextContent(); + if (_) { + var y = c.normal; + _.__align = _.style.align, _.__verticalAlign = _.style.verticalAlign, _.__position = y.get("position") || "middle"; + var x = y.get("distance"); + We(x) || (x = [x, x]), _.__labelDistance = x; + } + this.setTextConfig({ + position: null, + local: !0, + inside: !1 + // Can't be inside for stroke element. + }), Un(this, f, v, h); + }, e.prototype.highlight = function() { + tu(this); + }, e.prototype.downplay = function() { + ru(this); + }, e.prototype.updateLayout = function(t, n) { + this.setLinePoints(t.getItemLayout(n)); + }, e.prototype.setLinePoints = function(t) { + var n = this.childOfName("line"); + bT(n.shape, t), n.dirty(); + }, e.prototype.beforeUpdate = function() { + var t = this, n = t.childOfName("fromSymbol"), i = t.childOfName("toSymbol"), a = t.getTextContent(); + if (!n && !i && (!a || a.ignore)) + return; + for (var o = 1, s = this.parent; s; ) + s.scaleX && (o /= s.scaleX), s = s.parent; + var l = t.childOfName("line"); + if (!this.__dirty && !l.__dirty) + return; + var u = l.shape.percent, c = l.pointAt(0), h = l.pointAt(u), f = Yu([], h, c); + rf(f, f); + function v(E, M) { + var P = E.__specifiedRotation; + if (P == null) { + var R = l.tangentAt(M); + E.attr("rotation", (M === 1 ? -1 : 1) * Math.PI / 2 - Math.atan2(R[1], R[0])); + } else + E.attr("rotation", P); + } + if (n && (n.setPosition(c), v(n, 0), n.scaleX = n.scaleY = o * u, n.markRedraw()), i && (i.setPosition(h), v(i, 1), i.scaleX = i.scaleY = o * u, i.markRedraw()), a && !a.ignore) { + a.x = a.y = 0, a.originX = a.originY = 0; + var b = void 0, w = void 0, p = a.__labelDistance, d = p[0] * o, m = p[1] * o, _ = u / 2, y = l.tangentAt(_), x = [y[1], -y[0]], g = l.pointAt(_); + x[1] > 0 && (x[0] = -x[0], x[1] = -x[1]); + var S = y[0] < 0 ? -1 : 1; + if (a.__position !== "start" && a.__position !== "end") { + var T = -Math.atan2(y[1], y[0]); + h[0] < c[0] && (T = Math.PI + T), a.rotation = T; + } + var C = void 0; + switch (a.__position) { + case "insideStartTop": + case "insideMiddleTop": + case "insideEndTop": + case "middle": + C = -m, w = "bottom"; + break; + case "insideStartBottom": + case "insideMiddleBottom": + case "insideEndBottom": + C = m, w = "top"; + break; + default: + C = 0, w = "middle"; + } + switch (a.__position) { + case "end": + a.x = f[0] * d + h[0], a.y = f[1] * m + h[1], b = f[0] > 0.8 ? "left" : f[0] < -0.8 ? "right" : "center", w = f[1] > 0.8 ? "top" : f[1] < -0.8 ? "bottom" : "middle"; + break; + case "start": + a.x = -f[0] * d + c[0], a.y = -f[1] * m + c[1], b = f[0] > 0.8 ? "right" : f[0] < -0.8 ? "left" : "center", w = f[1] > 0.8 ? "bottom" : f[1] < -0.8 ? "top" : "middle"; + break; + case "insideStartTop": + case "insideStart": + case "insideStartBottom": + a.x = d * S + c[0], a.y = c[1] + C, b = y[0] < 0 ? "right" : "left", a.originX = -d * S, a.originY = -C; + break; + case "insideMiddleTop": + case "insideMiddle": + case "insideMiddleBottom": + case "middle": + a.x = g[0], a.y = g[1] + C, b = "center", a.originY = -C; + break; + case "insideEndTop": + case "insideEnd": + case "insideEndBottom": + a.x = -d * S + h[0], a.y = h[1] + C, b = y[0] >= 0 ? "right" : "left", a.originX = d * S, a.originY = -C; + break; + } + a.scaleX = a.scaleY = o, a.setStyle({ + // Use the user specified text align and baseline first + verticalAlign: a.__verticalAlign || w, + align: a.__align || b + }); + } + }, e; + }(Rt) +); +const fE = Ase; +var Ese = ( + /** @class */ + function() { + function r(e) { + this.group = new Rt(), this._LineCtor = e || fE; + } + return r.prototype.updateData = function(e) { + var t = this; + this._progressiveEls = null; + var n = this, i = n.group, a = n._lineData; + n._lineData = e, a || i.removeAll(); + var o = aP(e); + e.diff(a).add(function(s) { + t._doAdd(e, s, o); + }).update(function(s, l) { + t._doUpdate(a, e, l, s, o); + }).remove(function(s) { + i.remove(a.getItemGraphicEl(s)); + }).execute(); + }, r.prototype.updateLayout = function() { + var e = this._lineData; + e && e.eachItemGraphicEl(function(t, n) { + t.updateLayout(e, n); + }, this); + }, r.prototype.incrementalPrepareUpdate = function(e) { + this._seriesScope = aP(e), this._lineData = null, this.group.removeAll(); + }, r.prototype.incrementalUpdate = function(e, t) { + this._progressiveEls = []; + function n(s) { + !s.isGroup && !Mse(s) && (s.incremental = !0, s.ensureState("emphasis").hoverLayer = !0); + } + for (var i = e.start; i < e.end; i++) { + var a = t.getItemLayout(i); + if (Nw(a)) { + var o = new this._LineCtor(t, i, this._seriesScope); + o.traverse(n), this.group.add(o), t.setItemGraphicEl(i, o), this._progressiveEls.push(o); + } + } + }, r.prototype.remove = function() { + this.group.removeAll(); + }, r.prototype.eachRendered = function(e) { + Cc(this._progressiveEls || this.group, e); + }, r.prototype._doAdd = function(e, t, n) { + var i = e.getItemLayout(t); + if (Nw(i)) { + var a = new this._LineCtor(e, t, n); + e.setItemGraphicEl(t, a), this.group.add(a); + } + }, r.prototype._doUpdate = function(e, t, n, i, a) { + var o = e.getItemGraphicEl(n); + if (!Nw(t.getItemLayout(i))) { + this.group.remove(o); + return; + } + o ? o.updateData(t, i, a) : o = new this._LineCtor(t, i, a), t.setItemGraphicEl(i, o), this.group.add(o); + }, r; + }() +); +function Mse(r) { + return r.animators && r.animators.length > 0; +} +function aP(r) { + var e = r.hostModel, t = e.getModel("emphasis"); + return { + lineStyle: e.getModel("lineStyle").getLineStyle(), + emphasisLineStyle: t.getModel(["lineStyle"]).getLineStyle(), + blurLineStyle: e.getModel(["blur", "lineStyle"]).getLineStyle(), + selectLineStyle: e.getModel(["select", "lineStyle"]).getLineStyle(), + emphasisDisabled: t.get("disabled"), + blurScope: t.get("blurScope"), + focus: t.get("focus"), + labelStatesModels: Mi(e) + }; +} +function oP(r) { + return isNaN(r[0]) || isNaN(r[1]); +} +function Nw(r) { + return r && !oP(r[0]) && !oP(r[1]); +} +const dE = Ese; +var zw = [], Bw = [], jw = [], Kf = Ri, Fw = nc, sP = Math.abs; +function lP(r, e, t) { + for (var n = r[0], i = r[1], a = r[2], o = 1 / 0, s, l = t * t, u = 0.1, c = 0.1; c <= 0.9; c += 0.1) { + zw[0] = Kf(n[0], i[0], a[0], c), zw[1] = Kf(n[1], i[1], a[1], c); + var h = sP(Fw(zw, e) - l); + h < o && (o = h, s = c); + } + for (var f = 0; f < 32; f++) { + var v = s + u; + Bw[0] = Kf(n[0], i[0], a[0], s), Bw[1] = Kf(n[1], i[1], a[1], s), jw[0] = Kf(n[0], i[0], a[0], v), jw[1] = Kf(n[1], i[1], a[1], v); + var h = Fw(Bw, e) - l; + if (sP(h) < 0.01) + break; + var b = Fw(jw, e) - l; + u /= 2, h < 0 ? b >= 0 ? s = s + u : s = s - u : b >= 0 ? s = s - u : s = s + u; + } + return s; +} +function $w(r, e) { + var t = [], n = sg, i = [[], [], []], a = [[], []], o = []; + e /= 2, r.eachEdge(function(s, l) { + var u = s.getLayout(), c = s.getVisual("fromSymbol"), h = s.getVisual("toSymbol"); + u.__original || (u.__original = [bl(u[0]), bl(u[1])], u[2] && u.__original.push(bl(u[2]))); + var f = u.__original; + if (u[2] != null) { + if (ca(i[0], f[0]), ca(i[1], f[2]), ca(i[2], f[1]), c && c !== "none") { + var v = Rp(s.node1), b = lP(i, f[0], v * e); + n(i[0][0], i[1][0], i[2][0], b, t), i[0][0] = t[3], i[1][0] = t[4], n(i[0][1], i[1][1], i[2][1], b, t), i[0][1] = t[3], i[1][1] = t[4]; + } + if (h && h !== "none") { + var v = Rp(s.node2), b = lP(i, f[1], v * e); + n(i[0][0], i[1][0], i[2][0], b, t), i[1][0] = t[1], i[2][0] = t[2], n(i[0][1], i[1][1], i[2][1], b, t), i[1][1] = t[1], i[2][1] = t[2]; + } + ca(u[0], i[0]), ca(u[1], i[2]), ca(u[2], i[1]); + } else { + if (ca(a[0], f[0]), ca(a[1], f[1]), Yu(o, a[1], a[0]), rf(o, o), c && c !== "none") { + var v = Rp(s.node1); + l_(a[0], a[0], o, v * e); + } + if (h && h !== "none") { + var v = Rp(s.node2); + l_(a[1], a[1], o, -v * e); + } + ca(u[0], a[0]), ca(u[1], a[1]); + } + }); +} +function uP(r) { + return r.type === "view"; +} +var Dse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n) { + var i = new cm(), a = new dE(), o = this.group; + this._controller = new vm(n.getZr()), this._controllerHost = { + target: o + }, o.add(i.group), o.add(a.group), this._symbolDraw = i, this._lineDraw = a, this._firstRender = !0; + }, e.prototype.render = function(t, n, i) { + var a = this, o = t.coordinateSystem; + this._model = t; + var s = this._symbolDraw, l = this._lineDraw, u = this.group; + if (uP(o)) { + var c = { + x: o.x, + y: o.y, + scaleX: o.scaleX, + scaleY: o.scaleY + }; + this._firstRender ? u.attr(c) : zr(u, c, t); + } + $w(t.getGraph(), Pp(t)); + var h = t.getData(); + s.updateData(h); + var f = t.getEdgeData(); + l.updateData(f), this._updateNodeAndLinkScale(), this._updateController(t, n, i), clearTimeout(this._layoutTimeout); + var v = t.forceLayout, b = t.get(["force", "layoutAnimation"]); + v && this._startForceLayoutIteration(v, b); + var w = t.get("layout"); + h.graph.eachNode(function(_) { + var y = _.dataIndex, x = _.getGraphicEl(), g = _.getModel(); + if (x) { + x.off("drag").off("dragend"); + var S = g.get("draggable"); + S && x.on("drag", function(C) { + switch (w) { + case "force": + v.warmUp(), !a._layouting && a._startForceLayoutIteration(v, b), v.setFixed(y), h.setItemLayout(y, [x.x, x.y]); + break; + case "circular": + h.setItemLayout(y, [x.x, x.y]), _.setLayout({ + fixed: !0 + }, !0), hE(t, "symbolSize", _, [C.offsetX, C.offsetY]), a.updateLayout(t); + break; + case "none": + default: + h.setItemLayout(y, [x.x, x.y]), cE(t.getGraph(), t), a.updateLayout(t); + break; + } + }).on("dragend", function() { + v && v.setUnfixed(y); + }), x.setDraggable(S, !!g.get("cursor")); + var T = g.get(["emphasis", "focus"]); + T === "adjacency" && (Ft(x).focus = _.getAdjacentDataIndices()); + } + }), h.graph.eachEdge(function(_) { + var y = _.getGraphicEl(), x = _.getModel().get(["emphasis", "focus"]); + y && x === "adjacency" && (Ft(y).focus = { + edge: [_.dataIndex], + node: [_.node1.dataIndex, _.node2.dataIndex] + }); + }); + var p = t.get("layout") === "circular" && t.get(["circular", "rotateLabel"]), d = h.getLayout("cx"), m = h.getLayout("cy"); + h.graph.eachNode(function(_) { + GH(_, p, d, m); + }), this._firstRender = !1; + }, e.prototype.dispose = function() { + this._controller && this._controller.dispose(), this._controllerHost = null; + }, e.prototype._startForceLayoutIteration = function(t, n) { + var i = this; + (function a() { + t.step(function(o) { + i.updateLayout(i._model), (i._layouting = !o) && (n ? i._layoutTimeout = setTimeout(a, 16) : a()); + }); + })(); + }, e.prototype._updateController = function(t, n, i) { + var a = this, o = this._controller, s = this._controllerHost, l = this.group; + if (o.setPointerChecker(function(u, c, h) { + var f = l.getBoundingRect(); + return f.applyTransform(l.transform), f.contain(c, h) && !ux(u, i, t); + }), !uP(t.coordinateSystem)) { + o.disable(); + return; + } + o.enable(t.get("roam")), s.zoomLimit = t.get("scaleLimit"), s.zoom = t.coordinateSystem.getZoom(), o.off("pan").off("zoom").on("pan", function(u) { + eE(s, u.dx, u.dy), i.dispatchAction({ + seriesId: t.id, + type: "graphRoam", + dx: u.dx, + dy: u.dy + }); + }).on("zoom", function(u) { + tE(s, u.scale, u.originX, u.originY), i.dispatchAction({ + seriesId: t.id, + type: "graphRoam", + zoom: u.scale, + originX: u.originX, + originY: u.originY + }), a._updateNodeAndLinkScale(), $w(t.getGraph(), Pp(t)), a._lineDraw.updateLayout(), i.updateLabelLayout(); + }); + }, e.prototype._updateNodeAndLinkScale = function() { + var t = this._model, n = t.getData(), i = Pp(t); + n.eachItemGraphicEl(function(a, o) { + a && a.setSymbolScale(i); + }); + }, e.prototype.updateLayout = function(t) { + $w(t.getGraph(), Pp(t)), this._symbolDraw.updateLayout(), this._lineDraw.updateLayout(); + }, e.prototype.remove = function(t, n) { + this._symbolDraw && this._symbolDraw.remove(), this._lineDraw && this._lineDraw.remove(); + }, e.type = "graph", e; + }(en) +); +const kse = Dse; +function Qf(r) { + return "_EC_" + r; +} +var Ose = ( + /** @class */ + function() { + function r(e) { + this.type = "graph", this.nodes = [], this.edges = [], this._nodesMap = {}, this._edgesMap = {}, this._directed = e || !1; + } + return r.prototype.isDirected = function() { + return this._directed; + }, r.prototype.addNode = function(e, t) { + e = e == null ? "" + t : "" + e; + var n = this._nodesMap; + if (!n[Qf(e)]) { + var i = new gh(e, t); + return i.hostGraph = this, this.nodes.push(i), n[Qf(e)] = i, i; + } + }, r.prototype.getNodeByIndex = function(e) { + var t = this.data.getRawIndex(e); + return this.nodes[t]; + }, r.prototype.getNodeById = function(e) { + return this._nodesMap[Qf(e)]; + }, r.prototype.addEdge = function(e, t, n) { + var i = this._nodesMap, a = this._edgesMap; + if (Pr(e) && (e = this.nodes[e]), Pr(t) && (t = this.nodes[t]), e instanceof gh || (e = i[Qf(e)]), t instanceof gh || (t = i[Qf(t)]), !(!e || !t)) { + var o = e.id + "-" + t.id, s = new WH(e, t, n); + return s.hostGraph = this, this._directed && (e.outEdges.push(s), t.inEdges.push(s)), e.edges.push(s), e !== t && t.edges.push(s), this.edges.push(s), a[o] = s, s; + } + }, r.prototype.getEdgeByIndex = function(e) { + var t = this.edgeData.getRawIndex(e); + return this.edges[t]; + }, r.prototype.getEdge = function(e, t) { + e instanceof gh && (e = e.id), t instanceof gh && (t = t.id); + var n = this._edgesMap; + return this._directed ? n[e + "-" + t] : n[e + "-" + t] || n[t + "-" + e]; + }, r.prototype.eachNode = function(e, t) { + for (var n = this.nodes, i = n.length, a = 0; a < i; a++) + n[a].dataIndex >= 0 && e.call(t, n[a], a); + }, r.prototype.eachEdge = function(e, t) { + for (var n = this.edges, i = n.length, a = 0; a < i; a++) + n[a].dataIndex >= 0 && n[a].node1.dataIndex >= 0 && n[a].node2.dataIndex >= 0 && e.call(t, n[a], a); + }, r.prototype.breadthFirstTraverse = function(e, t, n, i) { + if (t instanceof gh || (t = this._nodesMap[Qf(t)]), !!t) { + for (var a = n === "out" ? "outEdges" : n === "in" ? "inEdges" : "edges", o = 0; o < this.nodes.length; o++) + this.nodes[o].__visited = !1; + if (!e.call(i, t, null)) + for (var s = [t]; s.length; ) + for (var l = s.shift(), u = l[a], o = 0; o < u.length; o++) { + var c = u[o], h = c.node1 === l ? c.node2 : c.node1; + if (!h.__visited) { + if (e.call(i, h, l)) + return; + s.push(h), h.__visited = !0; + } + } + } + }, r.prototype.update = function() { + for (var e = this.data, t = this.edgeData, n = this.nodes, i = this.edges, a = 0, o = n.length; a < o; a++) + n[a].dataIndex = -1; + for (var a = 0, o = e.count(); a < o; a++) + n[e.getRawIndex(a)].dataIndex = a; + t.filterSelf(function(s) { + var l = i[t.getRawIndex(s)]; + return l.node1.dataIndex >= 0 && l.node2.dataIndex >= 0; + }); + for (var a = 0, o = i.length; a < o; a++) + i[a].dataIndex = -1; + for (var a = 0, o = t.count(); a < o; a++) + i[t.getRawIndex(a)].dataIndex = a; + }, r.prototype.clone = function() { + for (var e = new r(this._directed), t = this.nodes, n = this.edges, i = 0; i < t.length; i++) + e.addNode(t[i].id, t[i].dataIndex); + for (var i = 0; i < n.length; i++) { + var a = n[i]; + e.addEdge(a.node1.id, a.node2.id, a.dataIndex); + } + return e; + }, r; + }() +), gh = ( + /** @class */ + function() { + function r(e, t) { + this.inEdges = [], this.outEdges = [], this.edges = [], this.dataIndex = -1, this.id = e == null ? "" : e, this.dataIndex = t == null ? -1 : t; + } + return r.prototype.degree = function() { + return this.edges.length; + }, r.prototype.inDegree = function() { + return this.inEdges.length; + }, r.prototype.outDegree = function() { + return this.outEdges.length; + }, r.prototype.getModel = function(e) { + if (!(this.dataIndex < 0)) { + var t = this.hostGraph, n = t.data.getItemModel(this.dataIndex); + return n.getModel(e); + } + }, r.prototype.getAdjacentDataIndices = function() { + for (var e = { + edge: [], + node: [] + }, t = 0; t < this.edges.length; t++) { + var n = this.edges[t]; + n.dataIndex < 0 || (e.edge.push(n.dataIndex), e.node.push(n.node1.dataIndex, n.node2.dataIndex)); + } + return e; + }, r.prototype.getTrajectoryDataIndices = function() { + for (var e = xt(), t = xt(), n = 0; n < this.edges.length; n++) { + var i = this.edges[n]; + if (!(i.dataIndex < 0)) { + e.set(i.dataIndex, !0); + for (var a = [i.node1], o = [i.node2], s = 0; s < a.length; ) { + var l = a[s]; + s++, t.set(l.dataIndex, !0); + for (var u = 0; u < l.inEdges.length; u++) + e.set(l.inEdges[u].dataIndex, !0), a.push(l.inEdges[u].node1); + } + for (s = 0; s < o.length; ) { + var c = o[s]; + s++, t.set(c.dataIndex, !0); + for (var u = 0; u < c.outEdges.length; u++) + e.set(c.outEdges[u].dataIndex, !0), o.push(c.outEdges[u].node2); + } + } + } + return { + edge: e.keys(), + node: t.keys() + }; + }, r; + }() +), WH = ( + /** @class */ + function() { + function r(e, t, n) { + this.dataIndex = -1, this.node1 = e, this.node2 = t, this.dataIndex = n == null ? -1 : n; + } + return r.prototype.getModel = function(e) { + if (!(this.dataIndex < 0)) { + var t = this.hostGraph, n = t.edgeData.getItemModel(this.dataIndex); + return n.getModel(e); + } + }, r.prototype.getAdjacentDataIndices = function() { + return { + edge: [this.dataIndex], + node: [this.node1.dataIndex, this.node2.dataIndex] + }; + }, r.prototype.getTrajectoryDataIndices = function() { + var e = xt(), t = xt(); + e.set(this.dataIndex, !0); + for (var n = [this.node1], i = [this.node2], a = 0; a < n.length; ) { + var o = n[a]; + a++, t.set(o.dataIndex, !0); + for (var s = 0; s < o.inEdges.length; s++) + e.set(o.inEdges[s].dataIndex, !0), n.push(o.inEdges[s].node1); + } + for (a = 0; a < i.length; ) { + var l = i[a]; + a++, t.set(l.dataIndex, !0); + for (var s = 0; s < l.outEdges.length; s++) + e.set(l.outEdges[s].dataIndex, !0), i.push(l.outEdges[s].node2); + } + return { + edge: e.keys(), + node: t.keys() + }; + }, r; + }() +); +function YH(r, e) { + return { + /** + * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'. + */ + getValue: function(t) { + var n = this[r][e]; + return n.getStore().get(n.getDimensionIndex(t || "value"), this.dataIndex); + }, + // TODO: TYPE stricter type. + setVisual: function(t, n) { + this.dataIndex >= 0 && this[r][e].setItemVisual(this.dataIndex, t, n); + }, + getVisual: function(t) { + return this[r][e].getItemVisual(this.dataIndex, t); + }, + setLayout: function(t, n) { + this.dataIndex >= 0 && this[r][e].setItemLayout(this.dataIndex, t, n); + }, + getLayout: function() { + return this[r][e].getItemLayout(this.dataIndex); + }, + getGraphicEl: function() { + return this[r][e].getItemGraphicEl(this.dataIndex); + }, + getRawIndex: function() { + return this[r][e].getRawIndex(this.dataIndex); + } + }; +} +qn(gh, YH("hostGraph", "data")); +qn(WH, YH("hostGraph", "edgeData")); +const Lse = Ose; +function XH(r, e, t, n, i) { + for (var a = new Lse(n), o = 0; o < r.length; o++) + a.addNode(Ii( + // Id, name, dataIndex + r[o].id, + r[o].name, + o + ), o); + for (var s = [], l = [], u = 0, o = 0; o < e.length; o++) { + var c = e[o], h = c.source, f = c.target; + a.addEdge(h, f, u) && (l.push(c), s.push(Ii(Si(c.id, null), h + " > " + f)), u++); + } + var v = t.get("coordinateSystem"), b; + if (v === "cartesian2d" || v === "polar") + b = Dl(r, t); + else { + var w = av.get(v), p = w ? w.dimensions || [] : []; + ir(p, "value") < 0 && p.concat(["value"]); + var d = uv(r, { + coordDimensions: p, + encodeDefine: t.getEncode() + }).dimensions; + b = new Ui(d, t), b.initData(r); + } + var m = new Ui(["value"], t); + return m.initData(l, s), i && i(b, m), MH({ + mainData: b, + struct: a, + structAttr: "graph", + datas: { + node: b, + edge: m + }, + datasAttr: { + node: "data", + edge: "edgeData" + } + }), a.update(), a; +} +var Pse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t; + } + return e.prototype.init = function(t) { + r.prototype.init.apply(this, arguments); + var n = this; + function i() { + return n._categoriesData; + } + this.legendVisualProvider = new dm(i, i), this.fillDataTextStyle(t.edges || t.links), this._updateCategoriesData(); + }, e.prototype.mergeOption = function(t) { + r.prototype.mergeOption.apply(this, arguments), this.fillDataTextStyle(t.edges || t.links), this._updateCategoriesData(); + }, e.prototype.mergeDefaultAndTheme = function(t) { + r.prototype.mergeDefaultAndTheme.apply(this, arguments), Gh(t, "edgeLabel", ["show"]); + }, e.prototype.getInitialData = function(t, n) { + var i = t.edges || t.links || [], a = t.data || t.nodes || [], o = this; + if (a && i) { + pse(this); + var s = XH(a, i, this, !0, l); + return X(s.edges, function(u) { + gse(u.node1, u.node2, this, u.dataIndex); + }, this), s.data; + } + function l(u, c) { + u.wrapMethod("getItemModel", function(b) { + var w = o._categoriesModels, p = b.getShallow("category"), d = w[p]; + return d && (d.parentModel = b.parentModel, b.parentModel = d), b; + }); + var h = qr.prototype.getModel; + function f(b, w) { + var p = h.call(this, b, w); + return p.resolveParentPath = v, p; + } + c.wrapMethod("getItemModel", function(b) { + return b.resolveParentPath = v, b.getModel = f, b; + }); + function v(b) { + if (b && (b[0] === "label" || b[1] === "label")) { + var w = b.slice(); + return b[0] === "label" ? w[0] = "edgeLabel" : b[1] === "label" && (w[1] = "edgeLabel"), w; + } + return b; + } + } + }, e.prototype.getGraph = function() { + return this.getData().graph; + }, e.prototype.getEdgeData = function() { + return this.getGraph().edgeData; + }, e.prototype.getCategoriesData = function() { + return this._categoriesData; + }, e.prototype.formatTooltip = function(t, n, i) { + if (i === "edge") { + var a = this.getData(), o = this.getDataParams(t, i), s = a.graph.getEdgeByIndex(t), l = a.getName(s.node1.dataIndex), u = a.getName(s.node2.dataIndex), c = []; + return l != null && c.push(l), u != null && c.push(u), Di("nameValue", { + name: c.join(" > "), + value: o.value, + noValue: o.value == null + }); + } + var h = qF({ + series: this, + dataIndex: t, + multipleSeries: n + }); + return h; + }, e.prototype._updateCategoriesData = function() { + var t = Ke(this.option.categories || [], function(i) { + return i.value != null ? i : Fe({ + value: 0 + }, i); + }), n = new Ui(["value"], this); + n.initData(t), this._categoriesData = n, this._categoriesModels = n.mapArray(function(i) { + return n.getItemModel(i); + }); + }, e.prototype.setZoom = function(t) { + this.option.zoom = t; + }, e.prototype.setCenter = function(t) { + this.option.center = t; + }, e.prototype.isAnimationEnabled = function() { + return r.prototype.isAnimationEnabled.call(this) && !(this.get("layout") === "force" && this.get(["force", "layoutAnimation"])); + }, e.type = "series.graph", e.dependencies = ["grid", "polar", "geo", "singleAxis", "calendar"], e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "view", + // Default option for all coordinate systems + // xAxisIndex: 0, + // yAxisIndex: 0, + // polarIndex: 0, + // geoIndex: 0, + legendHoverLink: !0, + layout: null, + // Configuration of circular layout + circular: { + rotateLabel: !1 + }, + // Configuration of force directed layout + force: { + initLayout: null, + // Node repulsion. Can be an array to represent range. + repulsion: [0, 50], + gravity: 0.1, + // Initial friction + friction: 0.6, + // Edge length. Can be an array to represent range. + edgeLength: 30, + layoutAnimation: !0 + }, + left: "center", + top: "center", + // right: null, + // bottom: null, + // width: '80%', + // height: '80%', + symbol: "circle", + symbolSize: 10, + edgeSymbol: ["none", "none"], + edgeSymbolSize: 10, + edgeLabel: { + position: "middle", + distance: 5 + }, + draggable: !1, + roam: !1, + // Default on center of graph + center: null, + zoom: 1, + // Symbol size scale ratio in roam + nodeScaleRatio: 0.6, + // cursor: null, + // categories: [], + // data: [] + // Or + // nodes: [] + // + // links: [] + // Or + // edges: [] + label: { + show: !1, + formatter: "{b}" + }, + itemStyle: {}, + lineStyle: { + color: "#aaa", + width: 1, + opacity: 0.5 + }, + emphasis: { + scale: !0, + label: { + show: !0 + } + }, + select: { + itemStyle: { + borderColor: "#212121" + } + } + }, e; + }(mn) +); +const Rse = Pse; +var Nse = { + type: "graphRoam", + event: "graphRoam", + update: "none" +}; +function zse(r) { + r.registerChartView(kse), r.registerSeriesModel(Rse), r.registerProcessor(cse), r.registerVisual(hse), r.registerVisual(fse), r.registerLayout(mse), r.registerLayout(r.PRIORITY.VISUAL.POST_CHART_LAYOUT, _se), r.registerLayout(xse), r.registerCoordinateSystem("graphView", { + dimensions: pm.dimensions, + create: wse + }), r.registerAction({ + type: "focusNodeAdjacency", + event: "focusNodeAdjacency", + update: "series:focusNodeAdjacency" + }, Qn), r.registerAction({ + type: "unfocusNodeAdjacency", + event: "unfocusNodeAdjacency", + update: "series:unfocusNodeAdjacency" + }, Qn), r.registerAction(Nse, function(e, t, n) { + t.eachComponent({ + mainType: "series", + query: e + }, function(i) { + var a = i.coordinateSystem, o = nE(a, e, void 0, n); + i.setCenter && i.setCenter(o.center), i.setZoom && i.setZoom(o.zoom); + }); + }); +} +var Bse = ( + /** @class */ + function() { + function r() { + this.angle = 0, this.width = 10, this.r = 10, this.x = 0, this.y = 0; + } + return r; + }() +), jse = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "pointer", n; + } + return e.prototype.getDefaultShape = function() { + return new Bse(); + }, e.prototype.buildPath = function(t, n) { + var i = Math.cos, a = Math.sin, o = n.r, s = n.width, l = n.angle, u = n.x - i(l) * s * (s >= o / 3 ? 1 : 2), c = n.y - a(l) * s * (s >= o / 3 ? 1 : 2); + l = n.angle - Math.PI / 2, t.moveTo(u, c), t.lineTo(n.x + i(l) * s, n.y + a(l) * s), t.lineTo(n.x + i(n.angle) * o, n.y + a(n.angle) * o), t.lineTo(n.x - i(l) * s, n.y - a(l) * s), t.lineTo(u, c); + }, e; + }(hr) +); +const Fse = jse; +function $se(r, e) { + var t = r.get("center"), n = e.getWidth(), i = e.getHeight(), a = Math.min(n, i), o = ot(t[0], e.getWidth()), s = ot(t[1], e.getHeight()), l = ot(r.get("radius"), a / 2); + return { + cx: o, + cy: s, + r: l + }; +} +function u0(r, e) { + var t = r == null ? "" : r + ""; + return e && (ut(e) ? t = e.replace("{value}", t) : Tt(e) && (t = e(r))), t; +} +var Hse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + this.group.removeAll(); + var a = t.get(["axisLine", "lineStyle", "color"]), o = $se(t, i); + this._renderMain(t, n, i, a, o), this._data = t.getData(); + }, e.prototype.dispose = function() { + }, e.prototype._renderMain = function(t, n, i, a, o) { + var s = this.group, l = t.get("clockwise"), u = -t.get("startAngle") / 180 * Math.PI, c = -t.get("endAngle") / 180 * Math.PI, h = t.getModel("axisLine"), f = h.get("roundCap"), v = f ? j_ : Oa, b = h.get("show"), w = h.getModel("lineStyle"), p = w.get("width"), d = [u, c]; + f5(d, !l), u = d[0], c = d[1]; + for (var m = c - u, _ = u, y = [], x = 0; b && x < a.length; x++) { + var g = Math.min(Math.max(a[x][0], 0), 1); + c = u + m * g; + var S = new v({ + shape: { + startAngle: _, + endAngle: c, + cx: o.cx, + cy: o.cy, + clockwise: l, + r0: o.r - p, + r: o.r + }, + silent: !0 + }); + S.setStyle({ + fill: a[x][1] + }), S.setStyle(w.getLineStyle( + // Because we use sector to simulate arc + // so the properties for stroking are useless + ["color", "width"] + )), y.push(S), _ = c; + } + y.reverse(), X(y, function(C) { + return s.add(C); + }); + var T = function(C) { + if (C <= 0) + return a[0][1]; + var E; + for (E = 0; E < a.length; E++) + if (a[E][0] >= C && (E === 0 ? 0 : a[E - 1][0]) < C) + return a[E][1]; + return a[E - 1][1]; + }; + this._renderTicks(t, n, i, T, o, u, c, l, p), this._renderTitleAndDetail(t, n, i, T, o), this._renderAnchor(t, o), this._renderPointer(t, n, i, T, o, u, c, l, p); + }, e.prototype._renderTicks = function(t, n, i, a, o, s, l, u, c) { + for (var h = this.group, f = o.cx, v = o.cy, b = o.r, w = +t.get("min"), p = +t.get("max"), d = t.getModel("splitLine"), m = t.getModel("axisTick"), _ = t.getModel("axisLabel"), y = t.get("splitNumber"), x = m.get("splitNumber"), g = ot(d.get("length"), b), S = ot(m.get("length"), b), T = s, C = (l - s) / y, E = C / x, M = d.getModel("lineStyle").getLineStyle(), P = m.getModel("lineStyle").getLineStyle(), R = d.get("distance"), N, F, U = 0; U <= y; U++) { + if (N = Math.cos(T), F = Math.sin(T), d.get("show")) { + var $ = R ? R + c : c, G = new Ai({ + shape: { + x1: N * (b - $) + f, + y1: F * (b - $) + v, + x2: N * (b - g - $) + f, + y2: F * (b - g - $) + v + }, + style: M, + silent: !0 + }); + M.stroke === "auto" && G.setStyle({ + stroke: a(U / y) + }), h.add(G); + } + if (_.get("show")) { + var $ = _.get("distance") + R, Q = u0(Vn(U / y * (p - w) + w), _.get("formatter")), ee = a(U / y), ce = N * (b - g - $) + f, ne = F * (b - g - $) + v, fe = _.get("rotate"), K = 0; + fe === "radial" ? (K = -T + 2 * Math.PI, K > Math.PI / 2 && (K += Math.PI)) : fe === "tangential" ? K = -T - Math.PI / 2 : Pr(fe) && (K = fe * Math.PI / 180), K === 0 ? h.add(new kr({ + style: gn(_, { + text: Q, + x: ce, + y: ne, + verticalAlign: F < -0.8 ? "top" : F > 0.8 ? "bottom" : "middle", + align: N < -0.4 ? "left" : N > 0.4 ? "right" : "center" + }, { + inheritColor: ee + }), + silent: !0 + })) : h.add(new kr({ + style: gn(_, { + text: Q, + x: ce, + y: ne, + verticalAlign: "middle", + align: "center" + }, { + inheritColor: ee + }), + silent: !0, + originX: ce, + originY: ne, + rotation: K + })); + } + if (m.get("show") && U !== y) { + var $ = m.get("distance"); + $ = $ ? $ + c : c; + for (var Oe = 0; Oe <= x; Oe++) { + N = Math.cos(T), F = Math.sin(T); + var xe = new Ai({ + shape: { + x1: N * (b - $) + f, + y1: F * (b - $) + v, + x2: N * (b - S - $) + f, + y2: F * (b - S - $) + v + }, + silent: !0, + style: P + }); + P.stroke === "auto" && xe.setStyle({ + stroke: a((U + Oe / x) / y) + }), h.add(xe), T += E; + } + T -= E; + } else + T += C; + } + }, e.prototype._renderPointer = function(t, n, i, a, o, s, l, u, c) { + var h = this.group, f = this._data, v = this._progressEls, b = [], w = t.get(["pointer", "show"]), p = t.getModel("progress"), d = p.get("show"), m = t.getData(), _ = m.mapDimension("value"), y = +t.get("min"), x = +t.get("max"), g = [y, x], S = [s, l]; + function T(E, M) { + var P = m.getItemModel(E), R = P.getModel("pointer"), N = ot(R.get("width"), o.r), F = ot(R.get("length"), o.r), U = t.get(["pointer", "icon"]), $ = R.get("offsetCenter"), G = ot($[0], o.r), Q = ot($[1], o.r), ee = R.get("keepAspect"), ce; + return U ? ce = li(U, G - N / 2, Q - F, N, F, null, ee) : ce = new Fse({ + shape: { + angle: -Math.PI / 2, + width: N, + r: F, + x: G, + y: Q + } + }), ce.rotation = -(M + Math.PI / 2), ce.x = o.cx, ce.y = o.cy, ce; + } + function C(E, M) { + var P = p.get("roundCap"), R = P ? j_ : Oa, N = p.get("overlap"), F = N ? p.get("width") : c / m.count(), U = N ? o.r - F : o.r - (E + 1) * F, $ = N ? o.r : o.r - E * F, G = new R({ + shape: { + startAngle: s, + endAngle: M, + cx: o.cx, + cy: o.cy, + clockwise: u, + r0: U, + r: $ + } + }); + return N && (G.z2 = x - m.get(_, E) % x), G; + } + (d || w) && (m.diff(f).add(function(E) { + var M = m.get(_, E); + if (w) { + var P = T(E, s); + An(P, { + rotation: -((isNaN(+M) ? S[0] : Zr(M, g, S, !0)) + Math.PI / 2) + }, t), h.add(P), m.setItemGraphicEl(E, P); + } + if (d) { + var R = C(E, s), N = p.get("clip"); + An(R, { + shape: { + endAngle: Zr(M, g, S, N) + } + }, t), h.add(R), O1(t.seriesIndex, m.dataType, E, R), b[E] = R; + } + }).update(function(E, M) { + var P = m.get(_, E); + if (w) { + var R = f.getItemGraphicEl(M), N = R ? R.rotation : s, F = T(E, N); + F.rotation = N, zr(F, { + rotation: -((isNaN(+P) ? S[0] : Zr(P, g, S, !0)) + Math.PI / 2) + }, t), h.add(F), m.setItemGraphicEl(E, F); + } + if (d) { + var U = v[M], $ = U ? U.shape.endAngle : s, G = C(E, $), Q = p.get("clip"); + zr(G, { + shape: { + endAngle: Zr(P, g, S, Q) + } + }, t), h.add(G), O1(t.seriesIndex, m.dataType, E, G), b[E] = G; + } + }).execute(), m.each(function(E) { + var M = m.getItemModel(E), P = M.getModel("emphasis"), R = P.get("focus"), N = P.get("blurScope"), F = P.get("disabled"); + if (w) { + var U = m.getItemGraphicEl(E), $ = m.getItemVisual(E, "style"), G = $.fill; + if (U instanceof ji) { + var Q = U.style; + U.useStyle(Fe({ + image: Q.image, + x: Q.x, + y: Q.y, + width: Q.width, + height: Q.height + }, $)); + } else + U.useStyle($), U.type !== "pointer" && U.setColor(G); + U.setStyle(M.getModel(["pointer", "itemStyle"]).getItemStyle()), U.style.fill === "auto" && U.setStyle("fill", a(Zr(m.get(_, E), g, [0, 1], !0))), U.z2EmphasisLift = 0, Xi(U, M), Un(U, R, N, F); + } + if (d) { + var ee = b[E]; + ee.useStyle(m.getItemVisual(E, "style")), ee.setStyle(M.getModel(["progress", "itemStyle"]).getItemStyle()), ee.z2EmphasisLift = 0, Xi(ee, M), Un(ee, R, N, F); + } + }), this._progressEls = b); + }, e.prototype._renderAnchor = function(t, n) { + var i = t.getModel("anchor"), a = i.get("show"); + if (a) { + var o = i.get("size"), s = i.get("icon"), l = i.get("offsetCenter"), u = i.get("keepAspect"), c = li(s, n.cx - o / 2 + ot(l[0], n.r), n.cy - o / 2 + ot(l[1], n.r), o, o, null, u); + c.z2 = i.get("showAbove") ? 1 : 0, c.setStyle(i.getModel("itemStyle").getItemStyle()), this.group.add(c); + } + }, e.prototype._renderTitleAndDetail = function(t, n, i, a, o) { + var s = this, l = t.getData(), u = l.mapDimension("value"), c = +t.get("min"), h = +t.get("max"), f = new Rt(), v = [], b = [], w = t.isAnimationEnabled(), p = t.get(["pointer", "showAbove"]); + l.diff(this._data).add(function(d) { + v[d] = new kr({ + silent: !0 + }), b[d] = new kr({ + silent: !0 + }); + }).update(function(d, m) { + v[d] = s._titleEls[m], b[d] = s._detailEls[m]; + }).execute(), l.each(function(d) { + var m = l.getItemModel(d), _ = l.get(u, d), y = new Rt(), x = a(Zr(_, [c, h], [0, 1], !0)), g = m.getModel("title"); + if (g.get("show")) { + var S = g.get("offsetCenter"), T = o.cx + ot(S[0], o.r), C = o.cy + ot(S[1], o.r), E = v[d]; + E.attr({ + z2: p ? 0 : 2, + style: gn(g, { + x: T, + y: C, + text: l.getName(d), + align: "center", + verticalAlign: "middle" + }, { + inheritColor: x + }) + }), y.add(E); + } + var M = m.getModel("detail"); + if (M.get("show")) { + var P = M.get("offsetCenter"), R = o.cx + ot(P[0], o.r), N = o.cy + ot(P[1], o.r), F = ot(M.get("width"), o.r), U = ot(M.get("height"), o.r), $ = t.get(["progress", "show"]) ? l.getItemVisual(d, "style").fill : x, E = b[d], G = M.get("formatter"); + E.attr({ + z2: p ? 0 : 2, + style: gn(M, { + x: R, + y: N, + text: u0(_, G), + width: isNaN(F) ? null : F, + height: isNaN(U) ? null : U, + align: "center", + verticalAlign: "middle" + }, { + inheritColor: $ + }) + }), iF(E, { + normal: M + }, _, function(ee) { + return u0(ee, G); + }), w && aF(E, d, l, t, { + getFormattedLabel: function(ee, ce, ne, fe, K, Oe) { + return u0(Oe ? Oe.interpolatedValue : _, G); + } + }), y.add(E); + } + f.add(y); + }), this.group.add(f), this._titleEls = v, this._detailEls = b; + }, e.type = "gauge", e; + }(en) +); +const Vse = Hse; +var Gse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.visualStyleAccessPath = "itemStyle", t; + } + return e.prototype.getInitialData = function(t, n) { + return hv(this, ["value"]); + }, e.type = "series.gauge", e.defaultOption = { + // zlevel: 0, + z: 2, + colorBy: "data", + // 默认全局居中 + center: ["50%", "50%"], + legendHoverLink: !0, + radius: "75%", + startAngle: 225, + endAngle: -45, + clockwise: !0, + // 最小值 + min: 0, + // 最大值 + max: 100, + // 分割段数,默认为10 + splitNumber: 10, + // 坐标轴线 + axisLine: { + // 默认显示,属性show控制显示与否 + show: !0, + roundCap: !1, + lineStyle: { + color: [[1, "#E6EBF8"]], + width: 10 + } + }, + // 坐标轴线 + progress: { + // 默认显示,属性show控制显示与否 + show: !1, + overlap: !0, + width: 10, + roundCap: !1, + clip: !0 + }, + // 分隔线 + splitLine: { + // 默认显示,属性show控制显示与否 + show: !0, + // 属性length控制线长 + length: 10, + distance: 10, + // 属性lineStyle(详见lineStyle)控制线条样式 + lineStyle: { + color: "#63677A", + width: 3, + type: "solid" + } + }, + // 坐标轴小标记 + axisTick: { + // 属性show控制显示与否,默认不显示 + show: !0, + // 每份split细分多少段 + splitNumber: 5, + // 属性length控制线长 + length: 6, + distance: 10, + // 属性lineStyle控制线条样式 + lineStyle: { + color: "#63677A", + width: 1, + type: "solid" + } + }, + axisLabel: { + show: !0, + distance: 15, + // formatter: null, + color: "#464646", + fontSize: 12, + rotate: 0 + }, + pointer: { + icon: null, + offsetCenter: [0, 0], + show: !0, + showAbove: !0, + length: "60%", + width: 6, + keepAspect: !1 + }, + anchor: { + show: !1, + showAbove: !1, + size: 6, + icon: "circle", + offsetCenter: [0, 0], + keepAspect: !1, + itemStyle: { + color: "#fff", + borderWidth: 0, + borderColor: "#5470c6" + } + }, + title: { + show: !0, + // x, y,单位px + offsetCenter: [0, "20%"], + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + color: "#464646", + fontSize: 16, + valueAnimation: !1 + }, + detail: { + show: !0, + backgroundColor: "rgba(0,0,0,0)", + borderWidth: 0, + borderColor: "#ccc", + width: 100, + height: null, + padding: [5, 10], + // x, y,单位px + offsetCenter: [0, "40%"], + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + color: "#464646", + fontSize: 30, + fontWeight: "bold", + lineHeight: 30, + valueAnimation: !1 + } + }, e; + }(mn) +); +const Use = Gse; +function Wse(r) { + r.registerChartView(Vse), r.registerSeriesModel(Use); +} +var Yse = ["itemStyle", "opacity"], Xse = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n) { + var i = r.call(this) || this, a = i, o = new Pa(), s = new kr(); + return a.setTextContent(s), i.setTextGuideLine(o), i.updateData(t, n, !0), i; + } + return e.prototype.updateData = function(t, n, i) { + var a = this, o = t.hostModel, s = t.getItemModel(n), l = t.getItemLayout(n), u = s.getModel("emphasis"), c = s.get(Yse); + c = c == null ? 1 : c, i || Hs(a), a.useStyle(t.getItemVisual(n, "style")), a.style.lineJoin = "round", i ? (a.setShape({ + points: l.points + }), a.style.opacity = 0, An(a, { + style: { + opacity: c + } + }, o, n)) : zr(a, { + style: { + opacity: c + }, + shape: { + points: l.points + } + }, o, n), Xi(a, s), this._updateLabel(t, n), Un(this, u.get("focus"), u.get("blurScope"), u.get("disabled")); + }, e.prototype._updateLabel = function(t, n) { + var i = this, a = this.getTextGuideLine(), o = i.getTextContent(), s = t.hostModel, l = t.getItemModel(n), u = t.getItemLayout(n), c = u.label, h = t.getItemVisual(n, "style"), f = h.fill; + Zi( + // position will not be used in setLabelStyle + o, + Mi(l), + { + labelFetcher: t.hostModel, + labelDataIndex: n, + defaultOpacity: h.opacity, + defaultText: t.getName(n) + }, + { + normal: { + align: c.textAlign, + verticalAlign: c.verticalAlign + } + } + ), i.setTextConfig({ + local: !0, + inside: !!c.inside, + insideStroke: f, + // insideFill: 'auto', + outsideFill: f + }); + var v = c.linePoints; + a.setShape({ + points: v + }), i.textGuideLineConfig = { + anchor: v ? new Zt(v[0][0], v[0][1]) : null + }, zr(o, { + style: { + x: c.x, + y: c.y + } + }, s, n), o.attr({ + rotation: c.rotation, + originX: c.x, + originY: c.y, + z2: 10 + }), UA(i, WA(l), { + // Default use item visual color + stroke: f + }); + }, e; + }(La) +), Zse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.ignoreLabelLineUpdate = !0, t; + } + return e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this._data, s = this.group; + a.diff(o).add(function(l) { + var u = new Xse(a, l); + a.setItemGraphicEl(l, u), s.add(u); + }).update(function(l, u) { + var c = o.getItemGraphicEl(u); + c.updateData(a, l), s.add(c), a.setItemGraphicEl(l, c); + }).remove(function(l) { + var u = o.getItemGraphicEl(l); + mg(u, t, l); + }).execute(), this._data = a; + }, e.prototype.remove = function() { + this.group.removeAll(), this._data = null; + }, e.prototype.dispose = function() { + }, e.type = "funnel", e; + }(en) +); +const Jse = Zse; +var Kse = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t) { + r.prototype.init.apply(this, arguments), this.legendVisualProvider = new dm(ft(this.getData, this), ft(this.getRawData, this)), this._defaultLabelLine(t); + }, e.prototype.getInitialData = function(t, n) { + return hv(this, { + coordDimensions: ["value"], + encodeDefaulter: jt(fA, this) + }); + }, e.prototype._defaultLabelLine = function(t) { + Gh(t, "labelLine", ["show"]); + var n = t.labelLine, i = t.emphasis.labelLine; + n.show = n.show && t.label.show, i.show = i.show && t.emphasis.label.show; + }, e.prototype.getDataParams = function(t) { + var n = this.getData(), i = r.prototype.getDataParams.call(this, t), a = n.mapDimension("value"), o = n.getSum(a); + return i.percent = o ? +(n.get(a, t) / o * 100).toFixed(2) : 0, i.$vars.push("percent"), i; + }, e.type = "series.funnel", e.defaultOption = { + // zlevel: 0, // 一级层叠 + z: 2, + legendHoverLink: !0, + colorBy: "data", + left: 80, + top: 60, + right: 80, + bottom: 60, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + // 默认取数据最小最大值 + // min: 0, + // max: 100, + minSize: "0%", + maxSize: "100%", + sort: "descending", + orient: "vertical", + gap: 0, + funnelAlign: "center", + label: { + show: !0, + position: "outer" + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 + }, + labelLine: { + show: !0, + length: 20, + lineStyle: { + // color: 各异, + width: 1 + } + }, + itemStyle: { + // color: 各异, + borderColor: "#fff", + borderWidth: 1 + }, + emphasis: { + label: { + show: !0 + } + }, + select: { + itemStyle: { + borderColor: "#212121" + } + } + }, e; + }(mn) +); +const Qse = Kse; +function qse(r, e) { + return yi(r.getBoxLayoutParams(), { + width: e.getWidth(), + height: e.getHeight() + }); +} +function ele(r, e) { + for (var t = r.mapDimension("value"), n = r.mapArray(t, function(l) { + return l; + }), i = [], a = e === "ascending", o = 0, s = r.count(); o < s; o++) + i[o] = o; + return Tt(e) ? i.sort(e) : e !== "none" && i.sort(function(l, u) { + return a ? n[l] - n[u] : n[u] - n[l]; + }), i; +} +function tle(r) { + var e = r.hostModel, t = e.get("orient"); + r.each(function(n) { + var i = r.getItemModel(n), a = i.getModel("label"), o = a.get("position"), s = i.getModel("labelLine"), l = r.getItemLayout(n), u = l.points, c = o === "inner" || o === "inside" || o === "center" || o === "insideLeft" || o === "insideRight", h, f, v, b; + if (c) + o === "insideLeft" ? (f = (u[0][0] + u[3][0]) / 2 + 5, v = (u[0][1] + u[3][1]) / 2, h = "left") : o === "insideRight" ? (f = (u[1][0] + u[2][0]) / 2 - 5, v = (u[1][1] + u[2][1]) / 2, h = "right") : (f = (u[0][0] + u[1][0] + u[2][0] + u[3][0]) / 4, v = (u[0][1] + u[1][1] + u[2][1] + u[3][1]) / 4, h = "center"), b = [[f, v], [f, v]]; + else { + var w = void 0, p = void 0, d = void 0, m = void 0, _ = s.get("length"); + o === "left" ? (w = (u[3][0] + u[0][0]) / 2, p = (u[3][1] + u[0][1]) / 2, d = w - _, f = d - 5, h = "right") : o === "right" ? (w = (u[1][0] + u[2][0]) / 2, p = (u[1][1] + u[2][1]) / 2, d = w + _, f = d + 5, h = "left") : o === "top" ? (w = (u[3][0] + u[0][0]) / 2, p = (u[3][1] + u[0][1]) / 2, m = p - _, v = m - 5, h = "center") : o === "bottom" ? (w = (u[1][0] + u[2][0]) / 2, p = (u[1][1] + u[2][1]) / 2, m = p + _, v = m + 5, h = "center") : o === "rightTop" ? (w = t === "horizontal" ? u[3][0] : u[1][0], p = t === "horizontal" ? u[3][1] : u[1][1], t === "horizontal" ? (m = p - _, v = m - 5, h = "center") : (d = w + _, f = d + 5, h = "top")) : o === "rightBottom" ? (w = u[2][0], p = u[2][1], t === "horizontal" ? (m = p + _, v = m + 5, h = "center") : (d = w + _, f = d + 5, h = "bottom")) : o === "leftTop" ? (w = u[0][0], p = t === "horizontal" ? u[0][1] : u[1][1], t === "horizontal" ? (m = p - _, v = m - 5, h = "center") : (d = w - _, f = d - 5, h = "right")) : o === "leftBottom" ? (w = t === "horizontal" ? u[1][0] : u[3][0], p = t === "horizontal" ? u[1][1] : u[2][1], t === "horizontal" ? (m = p + _, v = m + 5, h = "center") : (d = w - _, f = d - 5, h = "right")) : (w = (u[1][0] + u[2][0]) / 2, p = (u[1][1] + u[2][1]) / 2, t === "horizontal" ? (m = p + _, v = m + 5, h = "center") : (d = w + _, f = d + 5, h = "left")), t === "horizontal" ? (d = w, f = d) : (m = p, v = m), b = [[w, p], [d, m]]; + } + l.label = { + linePoints: b, + x: f, + y: v, + verticalAlign: "middle", + textAlign: h, + inside: c + }; + }); +} +function rle(r, e) { + r.eachSeriesByType("funnel", function(t) { + var n = t.getData(), i = n.mapDimension("value"), a = t.get("sort"), o = qse(t, e), s = t.get("orient"), l = o.width, u = o.height, c = ele(n, a), h = o.x, f = o.y, v = s === "horizontal" ? [ot(t.get("minSize"), u), ot(t.get("maxSize"), u)] : [ot(t.get("minSize"), l), ot(t.get("maxSize"), l)], b = n.getDataExtent(i), w = t.get("min"), p = t.get("max"); + w == null && (w = Math.min(b[0], 0)), p == null && (p = b[1]); + var d = t.get("funnelAlign"), m = t.get("gap"), _ = s === "horizontal" ? l : u, y = (_ - m * (n.count() - 1)) / n.count(), x = function(N, F) { + if (s === "horizontal") { + var U = n.get(i, N) || 0, $ = Zr(U, [w, p], v, !0), G = void 0; + switch (d) { + case "top": + G = f; + break; + case "center": + G = f + (u - $) / 2; + break; + case "bottom": + G = f + (u - $); + break; + } + return [[F, G], [F, G + $]]; + } + var Q = n.get(i, N) || 0, ee = Zr(Q, [w, p], v, !0), ce; + switch (d) { + case "left": + ce = h; + break; + case "center": + ce = h + (l - ee) / 2; + break; + case "right": + ce = h + l - ee; + break; + } + return [[ce, F], [ce + ee, F]]; + }; + a === "ascending" && (y = -y, m = -m, s === "horizontal" ? h += l : f += u, c = c.reverse()); + for (var g = 0; g < c.length; g++) { + var S = c[g], T = c[g + 1], C = n.getItemModel(S); + if (s === "horizontal") { + var E = C.get(["itemStyle", "width"]); + E == null ? E = y : (E = ot(E, l), a === "ascending" && (E = -E)); + var M = x(S, h), P = x(T, h + E); + h += E + m, n.setItemLayout(S, { + points: M.concat(P.slice().reverse()) + }); + } else { + var R = C.get(["itemStyle", "height"]); + R == null ? R = y : (R = ot(R, u), a === "ascending" && (R = -R)); + var M = x(S, f), P = x(T, f + R); + f += R + m, n.setItemLayout(S, { + points: M.concat(P.slice().reverse()) + }); + } + } + tle(n); + }); +} +function nle(r) { + r.registerChartView(Jse), r.registerSeriesModel(Qse), r.registerLayout(rle), r.registerProcessor(fm("funnel")); +} +var ile = 0.3, ale = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._dataGroup = new Rt(), t._initialized = !1, t; + } + return e.prototype.init = function() { + this.group.add(this._dataGroup); + }, e.prototype.render = function(t, n, i, a) { + this._progressiveEls = null; + var o = this._dataGroup, s = t.getData(), l = this._data, u = t.coordinateSystem, c = u.dimensions, h = hP(t); + s.diff(l).add(f).update(v).remove(b).execute(); + function f(p) { + var d = cP(s, o, p, c, u); + Hw(d, s, p, h); + } + function v(p, d) { + var m = l.getItemGraphicEl(d), _ = ZH(s, p, c, u); + s.setItemGraphicEl(p, m), zr(m, { + shape: { + points: _ + } + }, t, p), Hs(m), Hw(m, s, p, h); + } + function b(p) { + var d = l.getItemGraphicEl(p); + o.remove(d); + } + if (!this._initialized) { + this._initialized = !0; + var w = ole(u, t, function() { + setTimeout(function() { + o.removeClipPath(); + }); + }); + o.setClipPath(w); + } + this._data = s; + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + this._initialized = !0, this._data = null, this._dataGroup.removeAll(); + }, e.prototype.incrementalRender = function(t, n, i) { + for (var a = n.getData(), o = n.coordinateSystem, s = o.dimensions, l = hP(n), u = this._progressiveEls = [], c = t.start; c < t.end; c++) { + var h = cP(a, this._dataGroup, c, s, o); + h.incremental = !0, Hw(h, a, c, l), u.push(h); + } + }, e.prototype.remove = function() { + this._dataGroup && this._dataGroup.removeAll(), this._data = null; + }, e.type = "parallel", e; + }(en) +); +function ole(r, e, t) { + var n = r.model, i = r.getRect(), a = new Or({ + shape: { + x: i.x, + y: i.y, + width: i.width, + height: i.height + } + }), o = n.get("layout") === "horizontal" ? "width" : "height"; + return a.setShape(o, 0), An(a, { + shape: { + width: i.width, + height: i.height + } + }, e, t), a; +} +function ZH(r, e, t, n) { + for (var i = [], a = 0; a < t.length; a++) { + var o = t[a], s = r.get(r.mapDimension(o), e); + sle(s, n.getAxis(o).type) || i.push(n.dataToPoint(s, o)); + } + return i; +} +function cP(r, e, t, n, i) { + var a = ZH(r, t, n, i), o = new Pa({ + shape: { + points: a + }, + // silent: true, + z2: 10 + }); + return e.add(o), r.setItemGraphicEl(t, o), o; +} +function hP(r) { + var e = r.get("smooth", !0); + return e === !0 && (e = ile), e = Il(e), Ld(e) && (e = 0), { + smooth: e + }; +} +function Hw(r, e, t, n) { + r.useStyle(e.getItemVisual(t, "style")), r.style.fill = null, r.setShape("smooth", n.smooth); + var i = e.getItemModel(t), a = i.getModel("emphasis"); + Xi(r, i, "lineStyle"), Un(r, a.get("focus"), a.get("blurScope"), a.get("disabled")); +} +function sle(r, e) { + return e === "category" ? r == null : r == null || isNaN(r); +} +const lle = ale; +var ule = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.visualStyleAccessPath = "lineStyle", t.visualDrawType = "stroke", t; + } + return e.prototype.getInitialData = function(t, n) { + return Dl(null, this, { + useEncodeDefaulter: ft(cle, null, this) + }); + }, e.prototype.getRawIndicesByActiveState = function(t) { + var n = this.coordinateSystem, i = this.getData(), a = []; + return n.eachActiveState(i, function(o, s) { + t === o && a.push(i.getRawIndex(s)); + }), a; + }, e.type = "series.parallel", e.dependencies = ["parallel"], e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "parallel", + parallelIndex: 0, + label: { + show: !1 + }, + inactiveOpacity: 0.05, + activeOpacity: 1, + lineStyle: { + width: 1, + opacity: 0.45, + type: "solid" + }, + emphasis: { + label: { + show: !1 + } + }, + progressive: 500, + smooth: !1, + animationEasing: "linear" + }, e; + }(mn) +); +function cle(r) { + var e = r.ecModel.getComponent("parallel", r.get("parallelIndex")); + if (e) { + var t = {}; + return X(e.dimensions, function(n) { + var i = hle(n); + t[n] = i; + }), t; + } +} +function hle(r) { + return +r.replace("dim", ""); +} +const fle = ule; +var dle = ["lineStyle", "opacity"], vle = { + seriesType: "parallel", + reset: function(r, e) { + var t = r.coordinateSystem, n = { + normal: r.get(["lineStyle", "opacity"]), + active: r.get("activeOpacity"), + inactive: r.get("inactiveOpacity") + }; + return { + progress: function(i, a) { + t.eachActiveState(a, function(o, s) { + var l = n[o]; + if (o === "normal" && a.hasItemOption) { + var u = a.getItemModel(s).get(dle, !0); + u != null && (l = u); + } + var c = a.ensureUniqueItemVisual(s, "style"); + c.opacity = l; + }, i.start, i.end); + } + }; + } +}; +const ple = vle; +function gle(r) { + mle(r), yle(r); +} +function mle(r) { + if (!r.parallel) { + var e = !1; + X(r.series, function(t) { + t && t.type === "parallel" && (e = !0); + }), e && (r.parallel = [{}]); + } +} +function yle(r) { + var e = ln(r.parallelAxis); + X(e, function(t) { + if (kt(t)) { + var n = t.parallelIndex || 0, i = ln(r.parallel)[n]; + i && i.parallelAxisDefault && Ut(t, i.parallelAxisDefault, !1); + } + }); +} +var _le = 5, ble = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + this._model = t, this._api = i, this._handlers || (this._handlers = {}, X(xle, function(a, o) { + i.getZr().on(o, this._handlers[o] = ft(a, this)); + }, this)), sv(this, "_throttledDispatchExpand", t.get("axisExpandRate"), "fixRate"); + }, e.prototype.dispose = function(t, n) { + Sg(this, "_throttledDispatchExpand"), X(this._handlers, function(i, a) { + n.getZr().off(a, i); + }), this._handlers = null; + }, e.prototype._throttledDispatchExpand = function(t) { + this._dispatchExpand(t); + }, e.prototype._dispatchExpand = function(t) { + t && this._api.dispatchAction(Fe({ + type: "parallelAxisExpand" + }, t)); + }, e.type = "parallel", e; + }(Sn) +), xle = { + mousedown: function(r) { + Vw(this, "click") && (this._mouseDownPoint = [r.offsetX, r.offsetY]); + }, + mouseup: function(r) { + var e = this._mouseDownPoint; + if (Vw(this, "click") && e) { + var t = [r.offsetX, r.offsetY], n = Math.pow(e[0] - t[0], 2) + Math.pow(e[1] - t[1], 2); + if (n > _le) + return; + var i = this._model.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX, r.offsetY]); + i.behavior !== "none" && this._dispatchExpand({ + axisExpandWindow: i.axisExpandWindow + }); + } + this._mouseDownPoint = null; + }, + mousemove: function(r) { + if (!(this._mouseDownPoint || !Vw(this, "mousemove"))) { + var e = this._model, t = e.coordinateSystem.getSlidedAxisExpandWindow([r.offsetX, r.offsetY]), n = t.behavior; + n === "jump" && this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")), this._throttledDispatchExpand(n === "none" ? null : { + axisExpandWindow: t.axisExpandWindow, + // Jumping uses animation, and sliding suppresses animation. + animation: n === "jump" ? null : { + duration: 0 + // Disable animation. + } + }); + } + } +}; +function Vw(r, e) { + var t = r._model; + return t.get("axisExpandable") && t.get("axisExpandTriggerOn") === e; +} +const Sle = ble; +var wle = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function() { + r.prototype.init.apply(this, arguments), this.mergeOption({}); + }, e.prototype.mergeOption = function(t) { + var n = this.option; + t && Ut(n, t, !0), this._initDimensions(); + }, e.prototype.contains = function(t, n) { + var i = t.get("parallelIndex"); + return i != null && n.getComponent("parallel", i) === this; + }, e.prototype.setAxisExpand = function(t) { + X(["axisExpandable", "axisExpandCenter", "axisExpandCount", "axisExpandWidth", "axisExpandWindow"], function(n) { + t.hasOwnProperty(n) && (this.option[n] = t[n]); + }, this); + }, e.prototype._initDimensions = function() { + var t = this.dimensions = [], n = this.parallelAxisIndex = [], i = Jr(this.ecModel.queryComponents({ + mainType: "parallelAxis" + }), function(a) { + return (a.get("parallelIndex") || 0) === this.componentIndex; + }, this); + X(i, function(a) { + t.push("dim" + a.get("dim")), n.push(a.componentIndex); + }); + }, e.type = "parallel", e.dependencies = ["parallelAxis"], e.layoutMode = "box", e.defaultOption = { + // zlevel: 0, + z: 0, + left: 80, + top: 60, + right: 80, + bottom: 60, + // width: {totalWidth} - left - right, + // height: {totalHeight} - top - bottom, + layout: "horizontal", + // FIXME + // naming? + axisExpandable: !1, + axisExpandCenter: null, + axisExpandCount: 0, + axisExpandWidth: 50, + axisExpandRate: 17, + axisExpandDebounce: 50, + // [out, in, jumpTarget]. In percentage. If use [null, 0.05], null means full. + // Do not doc to user until necessary. + axisExpandSlideTriggerArea: [-0.15, 0.05, 0.4], + axisExpandTriggerOn: "click", + parallelAxisDefault: null + }, e; + }(xr) +); +const Cle = wle; +var Tle = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a, o) { + var s = r.call(this, t, n, i) || this; + return s.type = a || "value", s.axisIndex = o, s; + } + return e.prototype.isHorizontal = function() { + return this.coordinateSystem.getModel().get("layout") !== "horizontal"; + }, e; + }(wo) +); +const Ile = Tle; +function cf(r, e, t, n, i, a) { + r = r || 0; + var o = t[1] - t[0]; + if (i != null && (i = qf(i, [0, o])), a != null && (a = Math.max(a, i != null ? i : 0)), n === "all") { + var s = Math.abs(e[1] - e[0]); + s = qf(s, [0, o]), i = a = qf(s, [i, a]), n = 0; + } + e[0] = qf(e[0], t), e[1] = qf(e[1], t); + var l = Gw(e, n); + e[n] += r; + var u = i || 0, c = t.slice(); + l.sign < 0 ? c[0] += u : c[1] -= u, e[n] = qf(e[n], c); + var h; + return h = Gw(e, n), i != null && (h.sign !== l.sign || h.span < i) && (e[1 - n] = e[n] + l.sign * i), h = Gw(e, n), a != null && h.span > a && (e[1 - n] = e[n] + h.sign * a), e; +} +function Gw(r, e) { + var t = r[e] - r[1 - e]; + return { + span: Math.abs(t), + sign: t > 0 ? -1 : t < 0 ? 1 : e ? -1 : 1 + }; +} +function qf(r, e) { + return Math.min(e[1] != null ? e[1] : 1 / 0, Math.max(e[0] != null ? e[0] : -1 / 0, r)); +} +var Uw = X, JH = Math.min, KH = Math.max, fP = Math.floor, Ale = Math.ceil, dP = Vn, Ele = Math.PI, Mle = ( + /** @class */ + function() { + function r(e, t, n) { + this.type = "parallel", this._axesMap = xt(), this._axesLayout = {}, this.dimensions = e.dimensions, this._model = e, this._init(e, t, n); + } + return r.prototype._init = function(e, t, n) { + var i = e.dimensions, a = e.parallelAxisIndex; + Uw(i, function(o, s) { + var l = a[s], u = t.getComponent("parallelAxis", l), c = this._axesMap.set(o, new Ile(o, sm(u), [0, 0], u.get("type"), l)), h = c.type === "category"; + c.onBand = h && u.get("boundaryGap"), c.inverse = u.get("inverse"), u.axis = c, c.model = u, c.coordinateSystem = u.coordinateSystem = this; + }, this); + }, r.prototype.update = function(e, t) { + this._updateAxesFromSeries(this._model, e); + }, r.prototype.containPoint = function(e) { + var t = this._makeLayoutInfo(), n = t.axisBase, i = t.layoutBase, a = t.pixelDimIndex, o = e[1 - a], s = e[a]; + return o >= n && o <= n + t.axisLength && s >= i && s <= i + t.layoutLength; + }, r.prototype.getModel = function() { + return this._model; + }, r.prototype._updateAxesFromSeries = function(e, t) { + t.eachSeries(function(n) { + if (e.contains(n, t)) { + var i = n.getData(); + Uw(this.dimensions, function(a) { + var o = this._axesMap.get(a); + o.scale.unionExtentFromData(i, i.mapDimension(a)), Jh(o.scale, o.model); + }, this); + } + }, this); + }, r.prototype.resize = function(e, t) { + this._rect = yi(e.getBoxLayoutParams(), { + width: t.getWidth(), + height: t.getHeight() + }), this._layoutAxes(); + }, r.prototype.getRect = function() { + return this._rect; + }, r.prototype._makeLayoutInfo = function() { + var e = this._model, t = this._rect, n = ["x", "y"], i = ["width", "height"], a = e.get("layout"), o = a === "horizontal" ? 0 : 1, s = t[i[o]], l = [0, s], u = this.dimensions.length, c = c0(e.get("axisExpandWidth"), l), h = c0(e.get("axisExpandCount") || 0, [0, u]), f = e.get("axisExpandable") && u > 3 && u > h && h > 1 && c > 0 && s > 0, v = e.get("axisExpandWindow"), b; + if (v) + b = c0(v[1] - v[0], l), v[1] = v[0] + b; + else { + b = c0(c * (h - 1), l); + var w = e.get("axisExpandCenter") || fP(u / 2); + v = [c * w - b / 2], v[1] = v[0] + b; + } + var p = (s - b) / (u - h); + p < 3 && (p = 0); + var d = [fP(dP(v[0] / c, 1)) + 1, Ale(dP(v[1] / c, 1)) - 1], m = p / c * v[0]; + return { + layout: a, + pixelDimIndex: o, + layoutBase: t[n[o]], + layoutLength: s, + axisBase: t[n[1 - o]], + axisLength: t[i[1 - o]], + axisExpandable: f, + axisExpandWidth: c, + axisCollapseWidth: p, + axisExpandWindow: v, + axisCount: u, + winInnerIndices: d, + axisExpandWindow0Pos: m + }; + }, r.prototype._layoutAxes = function() { + var e = this._rect, t = this._axesMap, n = this.dimensions, i = this._makeLayoutInfo(), a = i.layout; + t.each(function(o) { + var s = [0, i.axisLength], l = o.inverse ? 1 : 0; + o.setExtent(s[l], s[1 - l]); + }), Uw(n, function(o, s) { + var l = (i.axisExpandable ? kle : Dle)(s, i), u = { + horizontal: { + x: l.position, + y: i.axisLength + }, + vertical: { + x: 0, + y: l.position + } + }, c = { + horizontal: Ele / 2, + vertical: 0 + }, h = [u[a].x + e.x, u[a].y + e.y], f = c[a], v = io(); + wc(v, v, f), js(v, v, h), this._axesLayout[o] = { + position: h, + rotation: f, + transform: v, + axisNameAvailableWidth: l.axisNameAvailableWidth, + axisLabelShow: l.axisLabelShow, + nameTruncateMaxWidth: l.nameTruncateMaxWidth, + tickDirection: 1, + labelDirection: 1 + }; + }, this); + }, r.prototype.getAxis = function(e) { + return this._axesMap.get(e); + }, r.prototype.dataToPoint = function(e, t) { + return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e), t); + }, r.prototype.eachActiveState = function(e, t, n, i) { + n == null && (n = 0), i == null && (i = e.count()); + var a = this._axesMap, o = this.dimensions, s = [], l = []; + X(o, function(p) { + s.push(e.mapDimension(p)), l.push(a.get(p).model); + }); + for (var u = this.hasAxisBrushed(), c = n; c < i; c++) { + var h = void 0; + if (!u) + h = "normal"; + else { + h = "active"; + for (var f = e.getValues(s, c), v = 0, b = o.length; v < b; v++) { + var w = l[v].getActiveState(f[v]); + if (w === "inactive") { + h = "inactive"; + break; + } + } + } + t(h, c); + } + }, r.prototype.hasAxisBrushed = function() { + for (var e = this.dimensions, t = this._axesMap, n = !1, i = 0, a = e.length; i < a; i++) + t.get(e[i]).model.getActiveState() !== "normal" && (n = !0); + return n; + }, r.prototype.axisCoordToPoint = function(e, t) { + var n = this._axesLayout[t]; + return zs([e, 0], n.transform); + }, r.prototype.getAxisLayout = function(e) { + return Ot(this._axesLayout[e]); + }, r.prototype.getSlidedAxisExpandWindow = function(e) { + var t = this._makeLayoutInfo(), n = t.pixelDimIndex, i = t.axisExpandWindow.slice(), a = i[1] - i[0], o = [0, t.axisExpandWidth * (t.axisCount - 1)]; + if (!this.containPoint(e)) + return { + behavior: "none", + axisExpandWindow: i + }; + var s = e[n] - t.layoutBase - t.axisExpandWindow0Pos, l, u = "slide", c = t.axisCollapseWidth, h = this._model.get("axisExpandSlideTriggerArea"), f = h[0] != null; + if (c) + f && c && s < a * h[0] ? (u = "jump", l = s - a * h[2]) : f && c && s > a * (1 - h[0]) ? (u = "jump", l = s - a * (1 - h[2])) : (l = s - a * h[1]) >= 0 && (l = s - a * (1 - h[1])) <= 0 && (l = 0), l *= t.axisExpandWidth / c, l ? cf(l, i, o, "all") : u = "none"; + else { + var v = i[1] - i[0], b = o[1] * s / v; + i = [KH(0, b - v / 2)], i[1] = JH(o[1], i[0] + v), i[0] = i[1] - v; + } + return { + axisExpandWindow: i, + behavior: u + }; + }, r; + }() +); +function c0(r, e) { + return JH(KH(r, e[0]), e[1]); +} +function Dle(r, e) { + var t = e.layoutLength / (e.axisCount - 1); + return { + position: t * r, + axisNameAvailableWidth: t, + axisLabelShow: !0 + }; +} +function kle(r, e) { + var t = e.layoutLength, n = e.axisExpandWidth, i = e.axisCount, a = e.axisCollapseWidth, o = e.winInnerIndices, s, l = a, u = !1, c; + return r < o[0] ? (s = r * a, c = a) : r <= o[1] ? (s = e.axisExpandWindow0Pos + r * n - e.axisExpandWindow[0], l = n, u = !0) : (s = t - (i - 1 - r) * a, c = a), { + position: s, + axisNameAvailableWidth: l, + axisLabelShow: u, + nameTruncateMaxWidth: c + }; +} +const Ole = Mle; +function Lle(r, e) { + var t = []; + return r.eachComponent("parallel", function(n, i) { + var a = new Ole(n, r, e); + a.name = "parallel_" + i, a.resize(n, e), n.coordinateSystem = a, a.model = n, t.push(a); + }), r.eachSeries(function(n) { + if (n.get("coordinateSystem") === "parallel") { + var i = n.getReferringComponents("parallel", mi).models[0]; + n.coordinateSystem = i.coordinateSystem; + } + }), t; +} +var Ple = { + create: Lle +}; +const Rle = Ple; +var QH = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.activeIntervals = [], t; + } + return e.prototype.getAreaSelectStyle = function() { + return Wh([ + ["fill", "color"], + ["lineWidth", "borderWidth"], + ["stroke", "borderColor"], + ["width", "width"], + ["opacity", "opacity"] + // Option decal is in `DecalObject` but style.decal is in `PatternObject`. + // So do not transfer decal directly. + ])(this.getModel("areaSelectStyle")); + }, e.prototype.setActiveIntervals = function(t) { + var n = this.activeIntervals = Ot(t); + if (n) + for (var i = n.length - 1; i >= 0; i--) + yo(n[i]); + }, e.prototype.getActiveState = function(t) { + var n = this.activeIntervals; + if (!n.length) + return "normal"; + if (t == null || isNaN(+t)) + return "inactive"; + if (n.length === 1) { + var i = n[0]; + if (i[0] <= t && t <= i[1]) + return "active"; + } else + for (var a = 0, o = n.length; a < o; a++) + if (n[a][0] <= t && t <= n[a][1]) + return "active"; + return "inactive"; + }, e; + }(xr) +); +qn(QH, cv); +const vP = QH; +var Kh = !0, Pg = Math.min, jd = Math.max, Nle = Math.pow, zle = 1e4, Ble = 6, jle = 6, pP = "globalPan", Fle = { + w: [0, 0], + e: [0, 1], + n: [1, 0], + s: [1, 1] +}, $le = { + w: "ew", + e: "ew", + n: "ns", + s: "ns", + ne: "nesw", + sw: "nesw", + nw: "nwse", + se: "nwse" +}, gP = { + brushStyle: { + lineWidth: 2, + stroke: "rgba(210,219,238,0.3)", + fill: "#D2DBEE" + }, + transformable: !0, + brushMode: "single", + removeOnClick: !1 +}, Hle = 0, Vle = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this) || this; + return n._track = [], n._covers = [], n._handlers = {}, n._zr = t, n.group = new Rt(), n._uid = "brushController_" + Hle++, X(Jle, function(i, a) { + this._handlers[a] = ft(i, this); + }, n), n; + } + return e.prototype.enableBrush = function(t) { + return this._brushType && this._doDisableBrush(), t.brushType && this._doEnableBrush(t), this; + }, e.prototype._doEnableBrush = function(t) { + var n = this._zr; + this._enableGlobalPan || qie(n, pP, this._uid), X(this._handlers, function(i, a) { + n.on(a, i); + }), this._brushType = t.brushType, this._brushOption = Ut(Ot(gP), t, !0); + }, e.prototype._doDisableBrush = function() { + var t = this._zr; + eae(t, pP, this._uid), X(this._handlers, function(n, i) { + t.off(i, n); + }), this._brushType = this._brushOption = null; + }, e.prototype.setPanels = function(t) { + if (t && t.length) { + var n = this._panels = {}; + X(t, function(i) { + n[i.panelId] = Ot(i); + }); + } else + this._panels = null; + return this; + }, e.prototype.mount = function(t) { + t = t || {}, this._enableGlobalPan = t.enableGlobalPan; + var n = this.group; + return this._zr.add(n), n.attr({ + x: t.x || 0, + y: t.y || 0, + rotation: t.rotation || 0, + scaleX: t.scaleX || 1, + scaleY: t.scaleY || 1 + }), this._transform = n.getLocalTransform(), this; + }, e.prototype.updateCovers = function(t) { + t = Ke(t, function(f) { + return Ut(Ot(gP), f, !0); + }); + var n = "\0-brush-index-", i = this._covers, a = this._covers = [], o = this, s = this._creatingCover; + return new nu(i, t, u, l).add(c).update(c).remove(h).execute(), this; + function l(f, v) { + return (f.id != null ? f.id : n + v) + "-" + f.brushType; + } + function u(f, v) { + return l(f.__brushOption, v); + } + function c(f, v) { + var b = t[f]; + if (v != null && i[v] === s) + a[f] = i[v]; + else { + var w = a[f] = v != null ? (i[v].__brushOption = b, i[v]) : e3(o, qH(o, b)); + vE(o, w); + } + } + function h(f) { + i[f] !== s && o.group.remove(i[f]); + } + }, e.prototype.unmount = function() { + return this.enableBrush(!1), xT(this), this._zr.remove(this.group), this; + }, e.prototype.dispose = function() { + this.unmount(), this.off(); + }, e; + }(rs) +); +function qH(r, e) { + var t = dx[e.brushType].createCover(r, e); + return t.__brushOption = e, r3(t, e), r.group.add(t), t; +} +function e3(r, e) { + var t = pE(e); + return t.endCreating && (t.endCreating(r, e), r3(e, e.__brushOption)), e; +} +function t3(r, e) { + var t = e.__brushOption; + pE(e).updateCoverShape(r, e, t.range, t); +} +function r3(r, e) { + var t = e.z; + t == null && (t = zle), r.traverse(function(n) { + n.z = t, n.z2 = t; + }); +} +function vE(r, e) { + pE(e).updateCommon(r, e), t3(r, e); +} +function pE(r) { + return dx[r.__brushOption.brushType]; +} +function gE(r, e, t) { + var n = r._panels; + if (!n) + return Kh; + var i, a = r._transform; + return X(n, function(o) { + o.isTargetByCursor(e, t, a) && (i = o); + }), i; +} +function n3(r, e) { + var t = r._panels; + if (!t) + return Kh; + var n = e.__brushOption.panelId; + return n != null ? t[n] : Kh; +} +function xT(r) { + var e = r._covers, t = e.length; + return X(e, function(n) { + r.group.remove(n); + }, r), e.length = 0, !!t; +} +function Qh(r, e) { + var t = Ke(r._covers, function(n) { + var i = n.__brushOption, a = Ot(i.range); + return { + brushType: i.brushType, + panelId: i.panelId, + range: a + }; + }); + r.trigger("brush", { + areas: t, + isEnd: !!e.isEnd, + removeOnClick: !!e.removeOnClick + }); +} +function Gle(r) { + var e = r._track; + if (!e.length) + return !1; + var t = e[e.length - 1], n = e[0], i = t[0] - n[0], a = t[1] - n[1], o = Nle(i * i + a * a, 0.5); + return o > Ble; +} +function i3(r) { + var e = r.length - 1; + return e < 0 && (e = 0), [r[0], r[e]]; +} +function a3(r, e, t, n) { + var i = new Rt(); + return i.add(new Or({ + name: "main", + style: mE(t), + silent: !0, + draggable: !0, + cursor: "move", + drift: jt(mP, r, e, i, ["n", "s", "w", "e"]), + ondragend: jt(Qh, e, { + isEnd: !0 + }) + })), X(n, function(a) { + i.add(new Or({ + name: a.join(""), + style: { + opacity: 0 + }, + draggable: !0, + silent: !0, + invisible: !0, + drift: jt(mP, r, e, i, a), + ondragend: jt(Qh, e, { + isEnd: !0 + }) + })); + }), i; +} +function o3(r, e, t, n) { + var i = n.brushStyle.lineWidth || 0, a = jd(i, jle), o = t[0][0], s = t[1][0], l = o - i / 2, u = s - i / 2, c = t[0][1], h = t[1][1], f = c - a + i / 2, v = h - a + i / 2, b = c - o, w = h - s, p = b + i, d = w + i; + $l(r, e, "main", o, s, b, w), n.transformable && ($l(r, e, "w", l, u, a, d), $l(r, e, "e", f, u, a, d), $l(r, e, "n", l, u, p, a), $l(r, e, "s", l, v, p, a), $l(r, e, "nw", l, u, a, a), $l(r, e, "ne", f, u, a, a), $l(r, e, "sw", l, v, a, a), $l(r, e, "se", f, v, a, a)); +} +function ST(r, e) { + var t = e.__brushOption, n = t.transformable, i = e.childAt(0); + i.useStyle(mE(t)), i.attr({ + silent: !n, + cursor: n ? "move" : "default" + }), X([["w"], ["e"], ["n"], ["s"], ["s", "e"], ["s", "w"], ["n", "e"], ["n", "w"]], function(a) { + var o = e.childOfName(a.join("")), s = a.length === 1 ? wT(r, a[0]) : Wle(r, a); + o && o.attr({ + silent: !n, + invisible: !n, + cursor: n ? $le[s] + "-resize" : null + }); + }); +} +function $l(r, e, t, n, i, a, o) { + var s = e.childOfName(t); + s && s.setShape(Xle(yE(r, e, [[n, i], [n + a, i + o]]))); +} +function mE(r) { + return Mt({ + strokeNoScale: !0 + }, r.brushStyle); +} +function s3(r, e, t, n) { + var i = [Pg(r, t), Pg(e, n)], a = [jd(r, t), jd(e, n)]; + return [ + [i[0], a[0]], + [i[1], a[1]] + // y range + ]; +} +function Ule(r) { + return oc(r.group); +} +function wT(r, e) { + var t = { + w: "left", + e: "right", + n: "top", + s: "bottom" + }, n = { + left: "w", + right: "e", + top: "n", + bottom: "s" + }, i = $b(t[e], Ule(r)); + return n[i]; +} +function Wle(r, e) { + var t = [wT(r, e[0]), wT(r, e[1])]; + return (t[0] === "e" || t[0] === "w") && t.reverse(), t.join(""); +} +function mP(r, e, t, n, i, a) { + var o = t.__brushOption, s = r.toRectRange(o.range), l = l3(e, i, a); + X(n, function(u) { + var c = Fle[u]; + s[c[0]][c[1]] += l[c[0]]; + }), o.range = r.fromRectRange(s3(s[0][0], s[1][0], s[0][1], s[1][1])), vE(e, t), Qh(e, { + isEnd: !1 + }); +} +function Yle(r, e, t, n) { + var i = e.__brushOption.range, a = l3(r, t, n); + X(i, function(o) { + o[0] += a[0], o[1] += a[1]; + }), vE(r, e), Qh(r, { + isEnd: !1 + }); +} +function l3(r, e, t) { + var n = r.group, i = n.transformCoordToLocal(e, t), a = n.transformCoordToLocal(0, 0); + return [i[0] - a[0], i[1] - a[1]]; +} +function yE(r, e, t) { + var n = n3(r, e); + return n && n !== Kh ? n.clipPath(t, r._transform) : Ot(t); +} +function Xle(r) { + var e = Pg(r[0][0], r[1][0]), t = Pg(r[0][1], r[1][1]), n = jd(r[0][0], r[1][0]), i = jd(r[0][1], r[1][1]); + return { + x: e, + y: t, + width: n - e, + height: i - t + }; +} +function Zle(r, e, t) { + if ( + // Check active + !(!r._brushType || Kle(r, e.offsetX, e.offsetY)) + ) { + var n = r._zr, i = r._covers, a = gE(r, e, t); + if (!r._dragging) + for (var o = 0; o < i.length; o++) { + var s = i[o].__brushOption; + if (a && (a === Kh || s.panelId === a.panelId) && dx[s.brushType].contain(i[o], t[0], t[1])) + return; + } + a && n.setCursorStyle("crosshair"); + } +} +function CT(r) { + var e = r.event; + e.preventDefault && e.preventDefault(); +} +function TT(r, e, t) { + return r.childOfName("main").contain(e, t); +} +function u3(r, e, t, n) { + var i = r._creatingCover, a = r._creatingPanel, o = r._brushOption, s; + if (r._track.push(t.slice()), Gle(r) || i) { + if (a && !i) { + o.brushMode === "single" && xT(r); + var l = Ot(o); + l.brushType = yP(l.brushType, a), l.panelId = a === Kh ? null : a.panelId, i = r._creatingCover = qH(r, l), r._covers.push(i); + } + if (i) { + var u = dx[yP(r._brushType, a)], c = i.__brushOption; + c.range = u.getCreatingRange(yE(r, i, r._track)), n && (e3(r, i), u.updateCommon(r, i)), t3(r, i), s = { + isEnd: n + }; + } + } else + n && o.brushMode === "single" && o.removeOnClick && gE(r, e, t) && xT(r) && (s = { + isEnd: n, + removeOnClick: !0 + }); + return s; +} +function yP(r, e) { + return r === "auto" ? e.defaultBrushType : r; +} +var Jle = { + mousedown: function(r) { + if (this._dragging) + _P(this, r); + else if (!r.target || !r.target.draggable) { + CT(r); + var e = this.group.transformCoordToLocal(r.offsetX, r.offsetY); + this._creatingCover = null; + var t = this._creatingPanel = gE(this, r, e); + t && (this._dragging = !0, this._track = [e.slice()]); + } + }, + mousemove: function(r) { + var e = r.offsetX, t = r.offsetY, n = this.group.transformCoordToLocal(e, t); + if (Zle(this, r, n), this._dragging) { + CT(r); + var i = u3(this, r, n, !1); + i && Qh(this, i); + } + }, + mouseup: function(r) { + _P(this, r); + } +}; +function _P(r, e) { + if (r._dragging) { + CT(e); + var t = e.offsetX, n = e.offsetY, i = r.group.transformCoordToLocal(t, n), a = u3(r, e, i, !0); + r._dragging = !1, r._track = [], r._creatingCover = null, a && Qh(r, a); + } +} +function Kle(r, e, t) { + var n = r._zr; + return e < 0 || e > n.getWidth() || t < 0 || t > n.getHeight(); +} +var dx = { + lineX: bP(0), + lineY: bP(1), + rect: { + createCover: function(r, e) { + function t(n) { + return n; + } + return a3({ + toRectRange: t, + fromRectRange: t + }, r, e, [["w"], ["e"], ["n"], ["s"], ["s", "e"], ["s", "w"], ["n", "e"], ["n", "w"]]); + }, + getCreatingRange: function(r) { + var e = i3(r); + return s3(e[1][0], e[1][1], e[0][0], e[0][1]); + }, + updateCoverShape: function(r, e, t, n) { + o3(r, e, t, n); + }, + updateCommon: ST, + contain: TT + }, + polygon: { + createCover: function(r, e) { + var t = new Rt(); + return t.add(new Pa({ + name: "main", + style: mE(e), + silent: !0 + })), t; + }, + getCreatingRange: function(r) { + return r; + }, + endCreating: function(r, e) { + e.remove(e.childAt(0)), e.add(new La({ + name: "main", + draggable: !0, + drift: jt(Yle, r, e), + ondragend: jt(Qh, r, { + isEnd: !0 + }) + })); + }, + updateCoverShape: function(r, e, t, n) { + e.childAt(0).setShape({ + points: yE(r, e, t) + }); + }, + updateCommon: ST, + contain: TT + } +}; +function bP(r) { + return { + createCover: function(e, t) { + return a3({ + toRectRange: function(n) { + var i = [n, [0, 100]]; + return r && i.reverse(), i; + }, + fromRectRange: function(n) { + return n[r]; + } + }, e, t, [[["w"], ["e"]], [["n"], ["s"]]][r]); + }, + getCreatingRange: function(e) { + var t = i3(e), n = Pg(t[0][r], t[1][r]), i = jd(t[0][r], t[1][r]); + return [n, i]; + }, + updateCoverShape: function(e, t, n, i) { + var a, o = n3(e, t); + if (o !== Kh && o.getLinearBrushOtherExtent) + a = o.getLinearBrushOtherExtent(r); + else { + var s = e._zr; + a = [0, [s.getWidth(), s.getHeight()][1 - r]]; + } + var l = [n, a]; + r && l.reverse(), o3(e, t, l, i); + }, + updateCommon: ST, + contain: TT + }; +} +const _E = Vle; +function c3(r) { + return r = bE(r), function(e) { + return rA(e, r); + }; +} +function h3(r, e) { + return r = bE(r), function(t) { + var n = e != null ? e : t, i = n ? r.width : r.height, a = n ? r.x : r.y; + return [a, a + (i || 0)]; + }; +} +function f3(r, e, t) { + var n = bE(r); + return function(i, a) { + return n.contain(a[0], a[1]) && !ux(i, e, t); + }; +} +function bE(r) { + return Wt.create(r); +} +var Qle = ["axisLine", "axisTickLabel", "axisName"], qle = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n) { + r.prototype.init.apply(this, arguments), (this._brushController = new _E(n.getZr())).on("brush", ft(this._onBrush, this)); + }, e.prototype.render = function(t, n, i, a) { + if (!eue(t, n, a)) { + this.axisModel = t, this.api = i, this.group.removeAll(); + var o = this._axisGroup; + if (this._axisGroup = new Rt(), this.group.add(this._axisGroup), !!t.get("show")) { + var s = rue(t, n), l = s.coordinateSystem, u = t.getAreaSelectStyle(), c = u.width, h = t.axis.dim, f = l.getAxisLayout(h), v = Fe({ + strokeContainThreshold: c + }, f), b = new au(t, v); + X(Qle, b.add, b), this._axisGroup.add(b.getGroup()), this._refreshBrushController(v, u, t, s, c, i), tm(o, this._axisGroup, t); + } + } + }, e.prototype._refreshBrushController = function(t, n, i, a, o, s) { + var l = i.axis.getExtent(), u = l[1] - l[0], c = Math.min(30, Math.abs(u) * 0.1), h = Wt.create({ + x: l[0], + y: -o / 2, + width: u, + height: o + }); + h.x -= c, h.width += 2 * c, this._brushController.mount({ + enableGlobalPan: !0, + rotation: t.rotation, + x: t.position[0], + y: t.position[1] + }).setPanels([{ + panelId: "pl", + clipPath: c3(h), + isTargetByCursor: f3(h, s, a), + getLinearBrushOtherExtent: h3(h, 0) + }]).enableBrush({ + brushType: "lineX", + brushStyle: n, + removeOnClick: !0 + }).updateCovers(tue(i)); + }, e.prototype._onBrush = function(t) { + var n = t.areas, i = this.axisModel, a = i.axis, o = Ke(n, function(s) { + return [a.coordToData(s.range[0], !0), a.coordToData(s.range[1], !0)]; + }); + (!i.option.realtime === t.isEnd || t.removeOnClick) && this.api.dispatchAction({ + type: "axisAreaSelect", + parallelAxisId: i.id, + intervals: o + }); + }, e.prototype.dispose = function() { + this._brushController.dispose(); + }, e.type = "parallelAxis", e; + }(Sn) +); +function eue(r, e, t) { + return t && t.type === "axisAreaSelect" && e.findComponents({ + mainType: "parallelAxis", + query: t + })[0] === r; +} +function tue(r) { + var e = r.axis; + return Ke(r.activeIntervals, function(t) { + return { + brushType: "lineX", + panelId: "pl", + range: [e.dataToCoord(t[0], !0), e.dataToCoord(t[1], !0)] + }; + }); +} +function rue(r, e) { + return e.getComponent("parallel", r.get("parallelIndex")); +} +const nue = qle; +var iue = { + type: "axisAreaSelect", + event: "axisAreaSelected" + // update: 'updateVisual' +}; +function aue(r) { + r.registerAction(iue, function(e, t) { + t.eachComponent({ + mainType: "parallelAxis", + query: e + }, function(n) { + n.axis.model.setActiveIntervals(e.intervals); + }); + }), r.registerAction("parallelAxisExpand", function(e, t) { + t.eachComponent({ + mainType: "parallel", + query: e + }, function(n) { + n.setAxisExpand(e); + }); + }); +} +var oue = { + type: "value", + areaSelectStyle: { + width: 20, + borderWidth: 1, + borderColor: "rgba(160,197,232)", + color: "rgba(160,197,232)", + opacity: 0.3 + }, + realtime: !0, + z: 10 +}; +function d3(r) { + r.registerComponentView(Sle), r.registerComponentModel(Cle), r.registerCoordinateSystem("parallel", Rle), r.registerPreprocessor(gle), r.registerComponentModel(vP), r.registerComponentView(nue), Bd(r, "parallel", vP, oue), aue(r); +} +function sue(r) { + Kt(d3), r.registerChartView(lle), r.registerSeriesModel(fle), r.registerVisual(r.PRIORITY.VISUAL.BRUSH, ple); +} +var lue = ( + /** @class */ + function() { + function r() { + this.x1 = 0, this.y1 = 0, this.x2 = 0, this.y2 = 0, this.cpx1 = 0, this.cpy1 = 0, this.cpx2 = 0, this.cpy2 = 0, this.extent = 0; + } + return r; + }() +), uue = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + return r.call(this, t) || this; + } + return e.prototype.getDefaultShape = function() { + return new lue(); + }, e.prototype.buildPath = function(t, n) { + var i = n.extent; + t.moveTo(n.x1, n.y1), t.bezierCurveTo(n.cpx1, n.cpy1, n.cpx2, n.cpy2, n.x2, n.y2), n.orient === "vertical" ? (t.lineTo(n.x2 + i, n.y2), t.bezierCurveTo(n.cpx2 + i, n.cpy2, n.cpx1 + i, n.cpy1, n.x1 + i, n.y1)) : (t.lineTo(n.x2, n.y2 + i), t.bezierCurveTo(n.cpx2, n.cpy2 + i, n.cpx1, n.cpy1 + i, n.x1, n.y1 + i)), t.closePath(); + }, e.prototype.highlight = function() { + tu(this); + }, e.prototype.downplay = function() { + ru(this); + }, e; + }(hr) +), cue = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._focusAdjacencyDisabled = !1, t; + } + return e.prototype.render = function(t, n, i) { + var a = this, o = t.getGraph(), s = this.group, l = t.layoutInfo, u = l.width, c = l.height, h = t.getData(), f = t.getData("edge"), v = t.get("orient"); + this._model = t, s.removeAll(), s.x = l.x, s.y = l.y, o.eachEdge(function(b) { + var w = new uue(), p = Ft(w); + p.dataIndex = b.dataIndex, p.seriesIndex = t.seriesIndex, p.dataType = "edge"; + var d = b.getModel(), m = d.getModel("lineStyle"), _ = m.get("curveness"), y = b.node1.getLayout(), x = b.node1.getModel(), g = x.get("localX"), S = x.get("localY"), T = b.node2.getLayout(), C = b.node2.getModel(), E = C.get("localX"), M = C.get("localY"), P = b.getLayout(), R, N, F, U, $, G, Q, ee; + w.shape.extent = Math.max(1, P.dy), w.shape.orient = v, v === "vertical" ? (R = (g != null ? g * u : y.x) + P.sy, N = (S != null ? S * c : y.y) + y.dy, F = (E != null ? E * u : T.x) + P.ty, U = M != null ? M * c : T.y, $ = R, G = N * (1 - _) + U * _, Q = F, ee = N * _ + U * (1 - _)) : (R = (g != null ? g * u : y.x) + y.dx, N = (S != null ? S * c : y.y) + P.sy, F = E != null ? E * u : T.x, U = (M != null ? M * c : T.y) + P.ty, $ = R * (1 - _) + F * _, G = N, Q = R * _ + F * (1 - _), ee = U), w.setShape({ + x1: R, + y1: N, + x2: F, + y2: U, + cpx1: $, + cpy1: G, + cpx2: Q, + cpy2: ee + }), w.useStyle(m.getItemStyle()), xP(w.style, v, b); + var ce = "" + d.get("value"), ne = Mi(d, "edgeLabel"); + Zi(w, ne, { + labelFetcher: { + getFormattedLabel: function(Oe, xe, Ge, oe, de, se) { + return t.getFormattedLabel( + Oe, + xe, + "edge", + oe, + // ensure edgeLabel formatter is provided + // to prevent the inheritance from `label.formatter` of the series + Ps(de, ne.normal && ne.normal.get("formatter"), ce), + se + ); + } + }, + labelDataIndex: b.dataIndex, + defaultText: ce + }), w.setTextConfig({ + position: "inside" + }); + var fe = d.getModel("emphasis"); + Xi(w, d, "lineStyle", function(Oe) { + var xe = Oe.getItemStyle(); + return xP(xe, v, b), xe; + }), s.add(w), f.setItemGraphicEl(b.dataIndex, w); + var K = fe.get("focus"); + Un(w, K === "adjacency" ? b.getAdjacentDataIndices() : K === "trajectory" ? b.getTrajectoryDataIndices() : K, fe.get("blurScope"), fe.get("disabled")); + }), o.eachNode(function(b) { + var w = b.getLayout(), p = b.getModel(), d = p.get("localX"), m = p.get("localY"), _ = p.getModel("emphasis"), y = new Or({ + shape: { + x: d != null ? d * u : w.x, + y: m != null ? m * c : w.y, + width: w.dx, + height: w.dy + }, + style: p.getModel("itemStyle").getItemStyle(), + z2: 10 + }); + Zi(y, Mi(p), { + labelFetcher: { + getFormattedLabel: function(g, S) { + return t.getFormattedLabel(g, S, "node"); + } + }, + labelDataIndex: b.dataIndex, + defaultText: b.id + }), y.disableLabelAnimation = !0, y.setStyle("fill", b.getVisual("color")), y.setStyle("decal", b.getVisual("style").decal), Xi(y, p), s.add(y), h.setItemGraphicEl(b.dataIndex, y), Ft(y).dataType = "node"; + var x = _.get("focus"); + Un(y, x === "adjacency" ? b.getAdjacentDataIndices() : x === "trajectory" ? b.getTrajectoryDataIndices() : x, _.get("blurScope"), _.get("disabled")); + }), h.eachItemGraphicEl(function(b, w) { + var p = h.getItemModel(w); + p.get("draggable") && (b.drift = function(d, m) { + a._focusAdjacencyDisabled = !0, this.shape.x += d, this.shape.y += m, this.dirty(), i.dispatchAction({ + type: "dragNode", + seriesId: t.id, + dataIndex: h.getRawIndex(w), + localX: this.shape.x / u, + localY: this.shape.y / c + }); + }, b.ondragend = function() { + a._focusAdjacencyDisabled = !1; + }, b.draggable = !0, b.cursor = "move"); + }), !this._data && t.isAnimationEnabled() && s.setClipPath(hue(s.getBoundingRect(), t, function() { + s.removeClipPath(); + })), this._data = t.getData(); + }, e.prototype.dispose = function() { + }, e.type = "sankey", e; + }(en) +); +function xP(r, e, t) { + switch (r.fill) { + case "source": + r.fill = t.node1.getVisual("color"), r.decal = t.node1.getVisual("style").decal; + break; + case "target": + r.fill = t.node2.getVisual("color"), r.decal = t.node2.getVisual("style").decal; + break; + case "gradient": + var n = t.node1.getVisual("color"), i = t.node2.getVisual("color"); + ut(n) && ut(i) && (r.fill = new Jd(0, 0, +(e === "horizontal"), +(e === "vertical"), [{ + color: n, + offset: 0 + }, { + color: i, + offset: 1 + }])); + } +} +function hue(r, e, t) { + var n = new Or({ + shape: { + x: r.x - 10, + y: r.y - 10, + width: 0, + height: r.height + 20 + } + }); + return An(n, { + shape: { + width: r.width + 20 + } + }, e, t), n; +} +const fue = cue; +var due = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.getInitialData = function(t, n) { + var i = t.edges || t.links, a = t.data || t.nodes, o = t.levels; + this.levelModels = []; + for (var s = this.levelModels, l = 0; l < o.length; l++) + o[l].depth != null && o[l].depth >= 0 && (s[o[l].depth] = new qr(o[l], this, n)); + if (a && i) { + var u = XH(a, i, this, !0, c); + return u.data; + } + function c(h, f) { + h.wrapMethod("getItemModel", function(v, b) { + var w = v.parentModel, p = w.getData().getItemLayout(b); + if (p) { + var d = p.depth, m = w.levelModels[d]; + m && (v.parentModel = m); + } + return v; + }), f.wrapMethod("getItemModel", function(v, b) { + var w = v.parentModel, p = w.getGraph().getEdgeByIndex(b), d = p.node1.getLayout(); + if (d) { + var m = d.depth, _ = w.levelModels[m]; + _ && (v.parentModel = _); + } + return v; + }); + } + }, e.prototype.setNodePosition = function(t, n) { + var i = this.option.data || this.option.nodes, a = i[t]; + a.localX = n[0], a.localY = n[1]; + }, e.prototype.getGraph = function() { + return this.getData().graph; + }, e.prototype.getEdgeData = function() { + return this.getGraph().edgeData; + }, e.prototype.formatTooltip = function(t, n, i) { + function a(v) { + return isNaN(v) || v == null; + } + if (i === "edge") { + var o = this.getDataParams(t, i), s = o.data, l = o.value, u = s.source + " -- " + s.target; + return Di("nameValue", { + name: u, + value: l, + noValue: a(l) + }); + } else { + var c = this.getGraph().getNodeByIndex(t), h = c.getLayout().value, f = this.getDataParams(t, i).data.name; + return Di("nameValue", { + name: f != null ? f + "" : null, + value: h, + noValue: a(h) + }); + } + }, e.prototype.optionUpdated = function() { + }, e.prototype.getDataParams = function(t, n) { + var i = r.prototype.getDataParams.call(this, t, n); + if (i.value == null && n === "node") { + var a = this.getGraph().getNodeByIndex(t), o = a.getLayout().value; + i.value = o; + } + return i; + }, e.type = "series.sankey", e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "view", + left: "5%", + top: "5%", + right: "20%", + bottom: "5%", + orient: "horizontal", + nodeWidth: 20, + nodeGap: 8, + draggable: !0, + layoutIterations: 32, + label: { + show: !0, + position: "right", + fontSize: 12 + }, + edgeLabel: { + show: !1, + fontSize: 12 + }, + levels: [], + nodeAlign: "justify", + lineStyle: { + color: "#314656", + opacity: 0.2, + curveness: 0.5 + }, + emphasis: { + label: { + show: !0 + }, + lineStyle: { + opacity: 0.5 + } + }, + select: { + itemStyle: { + borderColor: "#212121" + } + }, + animationEasing: "linear", + animationDuration: 1e3 + }, e; + }(mn) +); +const vue = due; +function pue(r, e) { + r.eachSeriesByType("sankey", function(t) { + var n = t.get("nodeWidth"), i = t.get("nodeGap"), a = gue(t, e); + t.layoutInfo = a; + var o = a.width, s = a.height, l = t.getGraph(), u = l.nodes, c = l.edges; + yue(u); + var h = Jr(u, function(w) { + return w.getLayout().value === 0; + }), f = h.length !== 0 ? 0 : t.get("layoutIterations"), v = t.get("orient"), b = t.get("nodeAlign"); + mue(u, c, n, i, o, s, f, v, b); + }); +} +function gue(r, e) { + return yi(r.getBoxLayoutParams(), { + width: e.getWidth(), + height: e.getHeight() + }); +} +function mue(r, e, t, n, i, a, o, s, l) { + _ue(r, e, t, i, a, s, l), wue(r, e, a, i, n, o, s), Oue(r, s); +} +function yue(r) { + X(r, function(e) { + var t = uc(e.outEdges, U_), n = uc(e.inEdges, U_), i = e.getValue() || 0, a = Math.max(t, n, i); + e.setLayout({ + value: a + }, !0); + }); +} +function _ue(r, e, t, n, i, a, o) { + for (var s = [], l = [], u = [], c = [], h = 0, f = 0; f < e.length; f++) + s[f] = 1; + for (var f = 0; f < r.length; f++) + l[f] = r[f].inEdges.length, l[f] === 0 && u.push(r[f]); + for (var v = -1; u.length; ) { + for (var b = 0; b < u.length; b++) { + var w = u[b], p = w.hostGraph.data.getRawDataItem(w.dataIndex), d = p.depth != null && p.depth >= 0; + d && p.depth > v && (v = p.depth), w.setLayout({ + depth: d ? p.depth : h + }, !0), a === "vertical" ? w.setLayout({ + dy: t + }, !0) : w.setLayout({ + dx: t + }, !0); + for (var m = 0; m < w.outEdges.length; m++) { + var _ = w.outEdges[m], y = e.indexOf(_); + s[y] = 0; + var x = _.node2, g = r.indexOf(x); + --l[g] === 0 && c.indexOf(x) < 0 && c.push(x); + } + } + ++h, u = c, c = []; + } + for (var f = 0; f < s.length; f++) + if (s[f] === 1) + throw new Error("Sankey is a DAG, the original data has cycle!"); + var S = v > h - 1 ? v : h - 1; + o && o !== "left" && bue(r, o, a, S); + var T = a === "vertical" ? (i - t) / S : (n - t) / S; + Sue(r, T, a); +} +function v3(r) { + var e = r.hostGraph.data.getRawDataItem(r.dataIndex); + return e.depth != null && e.depth >= 0; +} +function bue(r, e, t, n) { + if (e === "right") { + for (var i = [], a = r, o = 0; a.length; ) { + for (var s = 0; s < a.length; s++) { + var l = a[s]; + l.setLayout({ + skNodeHeight: o + }, !0); + for (var u = 0; u < l.inEdges.length; u++) { + var c = l.inEdges[u]; + i.indexOf(c.node1) < 0 && i.push(c.node1); + } + } + a = i, i = [], ++o; + } + X(r, function(h) { + v3(h) || h.setLayout({ + depth: Math.max(0, n - h.getLayout().skNodeHeight) + }, !0); + }); + } else + e === "justify" && xue(r, n); +} +function xue(r, e) { + X(r, function(t) { + !v3(t) && !t.outEdges.length && t.setLayout({ + depth: e + }, !0); + }); +} +function Sue(r, e, t) { + X(r, function(n) { + var i = n.getLayout().depth * e; + t === "vertical" ? n.setLayout({ + y: i + }, !0) : n.setLayout({ + x: i + }, !0); + }); +} +function wue(r, e, t, n, i, a, o) { + var s = Cue(r, o); + Tue(s, e, t, n, i, o), Ww(s, i, t, n, o); + for (var l = 1; a > 0; a--) + l *= 0.99, Iue(s, l, o), Ww(s, i, t, n, o), kue(s, l, o), Ww(s, i, t, n, o); +} +function Cue(r, e) { + var t = [], n = e === "vertical" ? "y" : "x", i = E1(r, function(a) { + return a.getLayout()[n]; + }); + return i.keys.sort(function(a, o) { + return a - o; + }), X(i.keys, function(a) { + t.push(i.buckets.get(a)); + }), t; +} +function Tue(r, e, t, n, i, a) { + var o = 1 / 0; + X(r, function(s) { + var l = s.length, u = 0; + X(s, function(h) { + u += h.getLayout().value; + }); + var c = a === "vertical" ? (n - (l - 1) * i) / u : (t - (l - 1) * i) / u; + c < o && (o = c); + }), X(r, function(s) { + X(s, function(l, u) { + var c = l.getLayout().value * o; + a === "vertical" ? (l.setLayout({ + x: u + }, !0), l.setLayout({ + dx: c + }, !0)) : (l.setLayout({ + y: u + }, !0), l.setLayout({ + dy: c + }, !0)); + }); + }), X(e, function(s) { + var l = +s.getValue() * o; + s.setLayout({ + dy: l + }, !0); + }); +} +function Ww(r, e, t, n, i) { + var a = i === "vertical" ? "x" : "y"; + X(r, function(o) { + o.sort(function(w, p) { + return w.getLayout()[a] - p.getLayout()[a]; + }); + for (var s, l, u, c = 0, h = o.length, f = i === "vertical" ? "dx" : "dy", v = 0; v < h; v++) + l = o[v], u = c - l.getLayout()[a], u > 0 && (s = l.getLayout()[a] + u, i === "vertical" ? l.setLayout({ + x: s + }, !0) : l.setLayout({ + y: s + }, !0)), c = l.getLayout()[a] + l.getLayout()[f] + e; + var b = i === "vertical" ? n : t; + if (u = c - e - b, u > 0) { + s = l.getLayout()[a] - u, i === "vertical" ? l.setLayout({ + x: s + }, !0) : l.setLayout({ + y: s + }, !0), c = s; + for (var v = h - 2; v >= 0; --v) + l = o[v], u = l.getLayout()[a] + l.getLayout()[f] + e - c, u > 0 && (s = l.getLayout()[a] - u, i === "vertical" ? l.setLayout({ + x: s + }, !0) : l.setLayout({ + y: s + }, !0)), c = l.getLayout()[a]; + } + }); +} +function Iue(r, e, t) { + X(r.slice().reverse(), function(n) { + X(n, function(i) { + if (i.outEdges.length) { + var a = uc(i.outEdges, Aue, t) / uc(i.outEdges, U_); + if (isNaN(a)) { + var o = i.outEdges.length; + a = o ? uc(i.outEdges, Eue, t) / o : 0; + } + if (t === "vertical") { + var s = i.getLayout().x + (a - gc(i, t)) * e; + i.setLayout({ + x: s + }, !0); + } else { + var l = i.getLayout().y + (a - gc(i, t)) * e; + i.setLayout({ + y: l + }, !0); + } + } + }); + }); +} +function Aue(r, e) { + return gc(r.node2, e) * r.getValue(); +} +function Eue(r, e) { + return gc(r.node2, e); +} +function Mue(r, e) { + return gc(r.node1, e) * r.getValue(); +} +function Due(r, e) { + return gc(r.node1, e); +} +function gc(r, e) { + return e === "vertical" ? r.getLayout().x + r.getLayout().dx / 2 : r.getLayout().y + r.getLayout().dy / 2; +} +function U_(r) { + return r.getValue(); +} +function uc(r, e, t) { + for (var n = 0, i = r.length, a = -1; ++a < i; ) { + var o = +e(r[a], t); + isNaN(o) || (n += o); + } + return n; +} +function kue(r, e, t) { + X(r, function(n) { + X(n, function(i) { + if (i.inEdges.length) { + var a = uc(i.inEdges, Mue, t) / uc(i.inEdges, U_); + if (isNaN(a)) { + var o = i.inEdges.length; + a = o ? uc(i.inEdges, Due, t) / o : 0; + } + if (t === "vertical") { + var s = i.getLayout().x + (a - gc(i, t)) * e; + i.setLayout({ + x: s + }, !0); + } else { + var l = i.getLayout().y + (a - gc(i, t)) * e; + i.setLayout({ + y: l + }, !0); + } + } + }); + }); +} +function Oue(r, e) { + var t = e === "vertical" ? "x" : "y"; + X(r, function(n) { + n.outEdges.sort(function(i, a) { + return i.node2.getLayout()[t] - a.node2.getLayout()[t]; + }), n.inEdges.sort(function(i, a) { + return i.node1.getLayout()[t] - a.node1.getLayout()[t]; + }); + }), X(r, function(n) { + var i = 0, a = 0; + X(n.outEdges, function(o) { + o.setLayout({ + sy: i + }, !0), i += o.getLayout().dy; + }), X(n.inEdges, function(o) { + o.setLayout({ + ty: a + }, !0), a += o.getLayout().dy; + }); + }); +} +function Lue(r) { + r.eachSeriesByType("sankey", function(e) { + var t = e.getGraph(), n = t.nodes, i = t.edges; + if (n.length) { + var a = 1 / 0, o = -1 / 0; + X(n, function(s) { + var l = s.getLayout().value; + l < a && (a = l), l > o && (o = l); + }), X(n, function(s) { + var l = new Wi({ + type: "color", + mappingMethod: "linear", + dataExtent: [a, o], + visual: e.get("color") + }), u = l.mapValueToVisual(s.getLayout().value), c = s.getModel().get(["itemStyle", "color"]); + c != null ? (s.setVisual("color", c), s.setVisual("style", { + fill: c + })) : (s.setVisual("color", u), s.setVisual("style", { + fill: u + })); + }); + } + i.length && X(i, function(s) { + var l = s.getModel().get("lineStyle"); + s.setVisual("style", l); + }); + }); +} +function Pue(r) { + r.registerChartView(fue), r.registerSeriesModel(vue), r.registerLayout(pue), r.registerVisual(Lue), r.registerAction({ + type: "dragNode", + event: "dragnode", + // here can only use 'update' now, other value is not support in echarts. + update: "update" + }, function(e, t) { + t.eachComponent({ + mainType: "series", + subType: "sankey", + query: e + }, function(n) { + n.setNodePosition(e.dataIndex, [e.localX, e.localY]); + }); + }); +} +var p3 = ( + /** @class */ + function() { + function r() { + } + return r.prototype.getInitialData = function(e, t) { + var n, i = t.getComponent("xAxis", this.get("xAxisIndex")), a = t.getComponent("yAxis", this.get("yAxisIndex")), o = i.get("type"), s = a.get("type"), l; + o === "category" ? (e.layout = "horizontal", n = i.getOrdinalMeta(), l = !0) : s === "category" ? (e.layout = "vertical", n = a.getOrdinalMeta(), l = !0) : e.layout = e.layout || "horizontal"; + var u = ["x", "y"], c = e.layout === "horizontal" ? 0 : 1, h = this._baseAxisDim = u[c], f = u[1 - c], v = [i, a], b = v[c].get("type"), w = v[1 - c].get("type"), p = e.data; + if (p && l) { + var d = []; + X(p, function(y, x) { + var g; + We(y) ? (g = y.slice(), y.unshift(x)) : We(y.value) ? (g = Fe({}, y), g.value = g.value.slice(), y.value.unshift(x)) : g = y, d.push(g); + }), e.data = d; + } + var m = this.defaultValueDimensions, _ = [{ + name: h, + type: L_(b), + ordinalMeta: n, + otherDims: { + tooltip: !1, + itemName: 0 + }, + dimsDef: ["base"] + }, { + name: f, + type: L_(w), + dimsDef: m.slice() + }]; + return hv(this, { + coordDimensions: _, + dimensionsCount: m.length + 1, + encodeDefaulter: jt(CF, _, this) + }); + }, r.prototype.getBaseAxis = function() { + var e = this._baseAxisDim; + return this.ecModel.getComponent(e + "Axis", this.get(e + "AxisIndex")).axis; + }, r; + }() +), g3 = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.defaultValueDimensions = [{ + name: "min", + defaultTooltip: !0 + }, { + name: "Q1", + defaultTooltip: !0 + }, { + name: "median", + defaultTooltip: !0 + }, { + name: "Q3", + defaultTooltip: !0 + }, { + name: "max", + defaultTooltip: !0 + }], t.visualDrawType = "stroke", t; + } + return e.type = "series.boxplot", e.dependencies = ["xAxis", "yAxis", "grid"], e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "cartesian2d", + legendHoverLink: !0, + layout: null, + boxWidth: [7, 50], + itemStyle: { + color: "#fff", + borderWidth: 1 + }, + emphasis: { + scale: !0, + itemStyle: { + borderWidth: 2, + shadowBlur: 5, + shadowOffsetX: 1, + shadowOffsetY: 1, + shadowColor: "rgba(0,0,0,0.2)" + } + }, + animationDuration: 800 + }, e; + }(mn) +); +qn(g3, p3, !0); +const Rue = g3; +var Nue = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this.group, s = this._data; + this._data || o.removeAll(); + var l = t.get("layout") === "horizontal" ? 1 : 0; + a.diff(s).add(function(u) { + if (a.hasValue(u)) { + var c = a.getItemLayout(u), h = SP(c, a, u, l, !0); + a.setItemGraphicEl(u, h), o.add(h); + } + }).update(function(u, c) { + var h = s.getItemGraphicEl(c); + if (!a.hasValue(u)) { + o.remove(h); + return; + } + var f = a.getItemLayout(u); + h ? (Hs(h), m3(f, h, a, u)) : h = SP(f, a, u, l), o.add(h), a.setItemGraphicEl(u, h); + }).remove(function(u) { + var c = s.getItemGraphicEl(u); + c && o.remove(c); + }).execute(), this._data = a; + }, e.prototype.remove = function(t) { + var n = this.group, i = this._data; + this._data = null, i && i.eachItemGraphicEl(function(a) { + a && n.remove(a); + }); + }, e.type = "boxplot", e; + }(en) +), zue = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), Bue = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "boxplotBoxPath", n; + } + return e.prototype.getDefaultShape = function() { + return new zue(); + }, e.prototype.buildPath = function(t, n) { + var i = n.points, a = 0; + for (t.moveTo(i[a][0], i[a][1]), a++; a < 4; a++) + t.lineTo(i[a][0], i[a][1]); + for (t.closePath(); a < i.length; a++) + t.moveTo(i[a][0], i[a][1]), a++, t.lineTo(i[a][0], i[a][1]); + }, e; + }(hr) +); +function SP(r, e, t, n, i) { + var a = r.ends, o = new Bue({ + shape: { + points: i ? jue(a, n, r) : a + } + }); + return m3(r, o, e, t, i), o; +} +function m3(r, e, t, n, i) { + var a = t.hostModel, o = rm[i ? "initProps" : "updateProps"]; + o(e, { + shape: { + points: r.ends + } + }, a, n), e.useStyle(t.getItemVisual(n, "style")), e.style.strokeNoScale = !0, e.z2 = 100; + var s = t.getItemModel(n), l = s.getModel("emphasis"); + Xi(e, s), Un(e, l.get("focus"), l.get("blurScope"), l.get("disabled")); +} +function jue(r, e, t) { + return Ke(r, function(n) { + return n = n.slice(), n[e] = t.initBaseline, n; + }); +} +const Fue = Nue; +var Kp = X; +function $ue(r) { + var e = Hue(r); + Kp(e, function(t) { + var n = t.seriesModels; + n.length && (Vue(t), Kp(n, function(i, a) { + Gue(i, t.boxOffsetList[a], t.boxWidthList[a]); + })); + }); +} +function Hue(r) { + var e = [], t = []; + return r.eachSeriesByType("boxplot", function(n) { + var i = n.getBaseAxis(), a = ir(t, i); + a < 0 && (a = t.length, t[a] = i, e[a] = { + axis: i, + seriesModels: [] + }), e[a].seriesModels.push(n); + }), e; +} +function Vue(r) { + var e = r.axis, t = r.seriesModels, n = t.length, i = r.boxWidthList = [], a = r.boxOffsetList = [], o = [], s; + if (e.type === "category") + s = e.getBandWidth(); + else { + var l = 0; + Kp(t, function(b) { + l = Math.max(l, b.getData().count()); + }); + var u = e.getExtent(); + s = Math.abs(u[1] - u[0]) / l; + } + Kp(t, function(b) { + var w = b.get("boxWidth"); + We(w) || (w = [w, w]), o.push([ot(w[0], s) || 0, ot(w[1], s) || 0]); + }); + var c = s * 0.8 - 2, h = c / n * 0.3, f = (c - h * (n - 1)) / n, v = f / 2 - c / 2; + Kp(t, function(b, w) { + a.push(v), v += h + f, i.push(Math.min(Math.max(f, o[w][0]), o[w][1])); + }); +} +function Gue(r, e, t) { + var n = r.coordinateSystem, i = r.getData(), a = t / 2, o = r.get("layout") === "horizontal" ? 0 : 1, s = 1 - o, l = ["x", "y"], u = i.mapDimension(l[o]), c = i.mapDimensionsAll(l[s]); + if (u == null || c.length < 5) + return; + for (var h = 0; h < i.count(); h++) { + var f = i.get(u, h), v = _(f, c[2], h), b = _(f, c[0], h), w = _(f, c[1], h), p = _(f, c[3], h), d = _(f, c[4], h), m = []; + y(m, w, !1), y(m, p, !0), m.push(b, w, d, p), x(m, b), x(m, d), x(m, v), i.setItemLayout(h, { + initBaseline: v[s], + ends: m + }); + } + function _(g, S, T) { + var C = i.get(S, T), E = []; + E[o] = g, E[s] = C; + var M; + return isNaN(g) || isNaN(C) ? M = [NaN, NaN] : (M = n.dataToPoint(E), M[o] += e), M; + } + function y(g, S, T) { + var C = S.slice(), E = S.slice(); + C[o] += a, E[o] -= a, T ? g.push(C, E) : g.push(E, C); + } + function x(g, S) { + var T = S.slice(), C = S.slice(); + T[o] -= a, C[o] += a, g.push(T, C); + } +} +function Uue(r, e) { + e = e || {}; + for (var t = [], n = [], i = e.boundIQR, a = i === "none" || i === 0, o = 0; o < r.length; o++) { + var s = yo(r[o].slice()), l = z0(s, 0.25), u = z0(s, 0.5), c = z0(s, 0.75), h = s[0], f = s[s.length - 1], v = (i == null ? 1.5 : i) * (c - l), b = a ? h : Math.max(h, l - v), w = a ? f : Math.min(f, c + v), p = e.itemNameFormatter, d = Tt(p) ? p({ + value: o + }) : ut(p) ? p.replace("{value}", o + "") : o + ""; + t.push([d, b, l, u, c, w]); + for (var m = 0; m < s.length; m++) { + var _ = s[m]; + if (_ < b || _ > w) { + var y = [d, _]; + n.push(y); + } + } + } + return { + boxData: t, + outliers: n + }; +} +var Wue = { + type: "echarts:boxplot", + transform: function(e) { + var t = e.upstream; + if (t.sourceFormat !== ga) { + var n = ""; + Ur(n); + } + var i = Uue(t.getRawData(), e.config); + return [{ + dimensions: ["ItemName", "Low", "Q1", "Q2", "Q3", "High"], + data: i.boxData + }, { + data: i.outliers + }]; + } +}; +function Yue(r) { + r.registerSeriesModel(Rue), r.registerChartView(Fue), r.registerLayout($ue), r.registerTransform(Wue); +} +var Xue = ["color", "borderColor"], Zue = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + this.group.removeClipPath(), this._progressiveEls = null, this._updateDrawMode(t), this._isLargeDraw ? this._renderLarge(t) : this._renderNormal(t); + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + this._clear(), this._updateDrawMode(t); + }, e.prototype.incrementalRender = function(t, n, i, a) { + this._progressiveEls = [], this._isLargeDraw ? this._incrementalRenderLarge(t, n) : this._incrementalRenderNormal(t, n); + }, e.prototype.eachRendered = function(t) { + Cc(this._progressiveEls || this.group, t); + }, e.prototype._updateDrawMode = function(t) { + var n = t.pipelineContext.large; + (this._isLargeDraw == null || n !== this._isLargeDraw) && (this._isLargeDraw = n, this._clear()); + }, e.prototype._renderNormal = function(t) { + var n = t.getData(), i = this._data, a = this.group, o = n.getLayout("isSimpleBox"), s = t.get("clip", !0), l = t.coordinateSystem, u = l.getArea && l.getArea(); + this._data || a.removeAll(), n.diff(i).add(function(c) { + if (n.hasValue(c)) { + var h = n.getItemLayout(c); + if (s && wP(u, h)) + return; + var f = Yw(h, c, !0); + An(f, { + shape: { + points: h.ends + } + }, t, c), Xw(f, n, c, o), a.add(f), n.setItemGraphicEl(c, f); + } + }).update(function(c, h) { + var f = i.getItemGraphicEl(h); + if (!n.hasValue(c)) { + a.remove(f); + return; + } + var v = n.getItemLayout(c); + if (s && wP(u, v)) { + a.remove(f); + return; + } + f ? (zr(f, { + shape: { + points: v.ends + } + }, t, c), Hs(f)) : f = Yw(v), Xw(f, n, c, o), a.add(f), n.setItemGraphicEl(c, f); + }).remove(function(c) { + var h = i.getItemGraphicEl(c); + h && a.remove(h); + }).execute(), this._data = n; + }, e.prototype._renderLarge = function(t) { + this._clear(), CP(t, this.group); + var n = t.get("clip", !0) ? lx(t.coordinateSystem, !1, t) : null; + n ? this.group.setClipPath(n) : this.group.removeClipPath(); + }, e.prototype._incrementalRenderNormal = function(t, n) { + for (var i = n.getData(), a = i.getLayout("isSimpleBox"), o; (o = t.next()) != null; ) { + var s = i.getItemLayout(o), l = Yw(s); + Xw(l, i, o, a), l.incremental = !0, this.group.add(l), this._progressiveEls.push(l); + } + }, e.prototype._incrementalRenderLarge = function(t, n) { + CP(n, this.group, this._progressiveEls, !0); + }, e.prototype.remove = function(t) { + this._clear(); + }, e.prototype._clear = function() { + this.group.removeAll(), this._data = null; + }, e.type = "candlestick", e; + }(en) +), Jue = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), Kue = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "normalCandlestickBox", n; + } + return e.prototype.getDefaultShape = function() { + return new Jue(); + }, e.prototype.buildPath = function(t, n) { + var i = n.points; + this.__simpleBox ? (t.moveTo(i[4][0], i[4][1]), t.lineTo(i[6][0], i[6][1])) : (t.moveTo(i[0][0], i[0][1]), t.lineTo(i[1][0], i[1][1]), t.lineTo(i[2][0], i[2][1]), t.lineTo(i[3][0], i[3][1]), t.closePath(), t.moveTo(i[4][0], i[4][1]), t.lineTo(i[5][0], i[5][1]), t.moveTo(i[6][0], i[6][1]), t.lineTo(i[7][0], i[7][1])); + }, e; + }(hr) +); +function Yw(r, e, t) { + var n = r.ends; + return new Kue({ + shape: { + points: t ? Que(n, r) : n + }, + z2: 100 + }); +} +function wP(r, e) { + for (var t = !0, n = 0; n < e.ends.length; n++) + if (r.contain(e.ends[n][0], e.ends[n][1])) { + t = !1; + break; + } + return t; +} +function Xw(r, e, t, n) { + var i = e.getItemModel(t); + r.useStyle(e.getItemVisual(t, "style")), r.style.strokeNoScale = !0, r.__simpleBox = n, Xi(r, i); +} +function Que(r, e) { + return Ke(r, function(t) { + return t = t.slice(), t[1] = e.initBaseline, t; + }); +} +var que = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), Zw = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n.type = "largeCandlestickBox", n; + } + return e.prototype.getDefaultShape = function() { + return new que(); + }, e.prototype.buildPath = function(t, n) { + for (var i = n.points, a = 0; a < i.length; ) + if (this.__sign === i[a++]) { + var o = i[a++]; + t.moveTo(o, i[a++]), t.lineTo(o, i[a++]); + } else + a += 3; + }, e; + }(hr) +); +function CP(r, e, t, n) { + var i = r.getData(), a = i.getLayout("largePoints"), o = new Zw({ + shape: { + points: a + }, + __sign: 1, + ignoreCoarsePointer: !0 + }); + e.add(o); + var s = new Zw({ + shape: { + points: a + }, + __sign: -1, + ignoreCoarsePointer: !0 + }); + e.add(s); + var l = new Zw({ + shape: { + points: a + }, + __sign: 0, + ignoreCoarsePointer: !0 + }); + e.add(l), Jw(1, o, r), Jw(-1, s, r), Jw(0, l, r), n && (o.incremental = !0, s.incremental = !0), t && t.push(o, s); +} +function Jw(r, e, t, n) { + var i = t.get(["itemStyle", r > 0 ? "borderColor" : "borderColor0"]) || t.get(["itemStyle", r > 0 ? "color" : "color0"]); + r === 0 && (i = t.get(["itemStyle", "borderColorDoji"])); + var a = t.getModel("itemStyle").getItemStyle(Xue); + e.useStyle(a), e.style.fill = null, e.style.stroke = i; +} +const ece = Zue; +var y3 = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.defaultValueDimensions = [{ + name: "open", + defaultTooltip: !0 + }, { + name: "close", + defaultTooltip: !0 + }, { + name: "lowest", + defaultTooltip: !0 + }, { + name: "highest", + defaultTooltip: !0 + }], t; + } + return e.prototype.getShadowDim = function() { + return "open"; + }, e.prototype.brushSelector = function(t, n, i) { + var a = n.getItemLayout(t); + return a && i.rect(a.brushRect); + }, e.type = "series.candlestick", e.dependencies = ["xAxis", "yAxis", "grid"], e.defaultOption = { + // zlevel: 0, + z: 2, + coordinateSystem: "cartesian2d", + legendHoverLink: !0, + // xAxisIndex: 0, + // yAxisIndex: 0, + layout: null, + clip: !0, + itemStyle: { + color: "#eb5454", + color0: "#47b262", + borderColor: "#eb5454", + borderColor0: "#47b262", + borderColorDoji: null, + // borderColor: '#d24040', + // borderColor0: '#398f4f', + borderWidth: 1 + }, + emphasis: { + scale: !0, + itemStyle: { + borderWidth: 2 + } + }, + barMaxWidth: null, + barMinWidth: null, + barWidth: null, + large: !0, + largeThreshold: 600, + progressive: 3e3, + progressiveThreshold: 1e4, + progressiveChunkMode: "mod", + animationEasing: "linear", + animationDuration: 300 + }, e; + }(mn) +); +qn(y3, p3, !0); +const tce = y3; +function rce(r) { + !r || !We(r.series) || X(r.series, function(e) { + kt(e) && e.type === "k" && (e.type = "candlestick"); + }); +} +var nce = ["itemStyle", "borderColor"], ice = ["itemStyle", "borderColor0"], ace = ["itemStyle", "borderColorDoji"], oce = ["itemStyle", "color"], sce = ["itemStyle", "color0"], lce = { + seriesType: "candlestick", + plan: ov(), + // For legend. + performRawSeries: !0, + reset: function(r, e) { + function t(a, o) { + return o.get(a > 0 ? oce : sce); + } + function n(a, o) { + return o.get(a === 0 ? ace : a > 0 ? nce : ice); + } + if (!e.isSeriesFiltered(r)) { + var i = r.pipelineContext.large; + return !i && { + progress: function(a, o) { + for (var s; (s = a.next()) != null; ) { + var l = o.getItemModel(s), u = o.getItemLayout(s).sign, c = l.getItemStyle(); + c.fill = t(u, l), c.stroke = n(u, l) || c.fill; + var h = o.ensureUniqueItemVisual(s, "style"); + Fe(h, c); + } + } + }; + } + } +}; +const uce = lce; +var cce = { + seriesType: "candlestick", + plan: ov(), + reset: function(r) { + var e = r.coordinateSystem, t = r.getData(), n = hce(r, t), i = 0, a = 1, o = ["x", "y"], s = t.getDimensionIndex(t.mapDimension(o[i])), l = Ke(t.mapDimensionsAll(o[a]), t.getDimensionIndex, t), u = l[0], c = l[1], h = l[2], f = l[3]; + if (t.setLayout({ + candleWidth: n, + // The value is experimented visually. + isSimpleBox: n <= 1.3 + }), s < 0 || l.length < 4) + return; + return { + progress: r.pipelineContext.large ? b : v + }; + function v(w, p) { + for (var d, m = p.getStore(); (d = w.next()) != null; ) { + var _ = m.get(s, d), y = m.get(u, d), x = m.get(c, d), g = m.get(h, d), S = m.get(f, d), T = Math.min(y, x), C = Math.max(y, x), E = $(T, _), M = $(C, _), P = $(g, _), R = $(S, _), N = []; + G(N, M, 0), G(N, E, 1), N.push(ee(R), ee(M), ee(P), ee(E)); + var F = p.getItemModel(d), U = !!F.get(["itemStyle", "borderColorDoji"]); + p.setItemLayout(d, { + sign: TP(m, d, y, x, c, U), + initBaseline: y > x ? M[a] : E[a], + ends: N, + brushRect: Q(g, S, _) + }); + } + function $(ce, ne) { + var fe = []; + return fe[i] = ne, fe[a] = ce, isNaN(ne) || isNaN(ce) ? [NaN, NaN] : e.dataToPoint(fe); + } + function G(ce, ne, fe) { + var K = ne.slice(), Oe = ne.slice(); + K[i] = F0(K[i] + n / 2, 1, !1), Oe[i] = F0(Oe[i] - n / 2, 1, !0), fe ? ce.push(K, Oe) : ce.push(Oe, K); + } + function Q(ce, ne, fe) { + var K = $(ce, fe), Oe = $(ne, fe); + return K[i] -= n / 2, Oe[i] -= n / 2, { + x: K[0], + y: K[1], + width: n, + height: Oe[1] - K[1] + }; + } + function ee(ce) { + return ce[i] = F0(ce[i], 1), ce; + } + } + function b(w, p) { + for (var d = ml(w.count * 4), m = 0, _, y = [], x = [], g, S = p.getStore(), T = !!r.get(["itemStyle", "borderColorDoji"]); (g = w.next()) != null; ) { + var C = S.get(s, g), E = S.get(u, g), M = S.get(c, g), P = S.get(h, g), R = S.get(f, g); + if (isNaN(C) || isNaN(P) || isNaN(R)) { + d[m++] = NaN, m += 3; + continue; + } + d[m++] = TP(S, g, E, M, c, T), y[i] = C, y[a] = P, _ = e.dataToPoint(y, null, x), d[m++] = _ ? _[0] : NaN, d[m++] = _ ? _[1] : NaN, y[a] = R, _ = e.dataToPoint(y, null, x), d[m++] = _ ? _[1] : NaN; + } + p.setLayout("largePoints", d); + } + } +}; +function TP(r, e, t, n, i, a) { + var o; + return t > n ? o = -1 : t < n ? o = 1 : o = a ? 0 : e > 0 ? r.get(i, e - 1) <= n ? 1 : -1 : ( + // No record of previous, set to be positive + 1 + ), o; +} +function hce(r, e) { + var t = r.getBaseAxis(), n, i = t.type === "category" ? t.getBandWidth() : (n = t.getExtent(), Math.abs(n[1] - n[0]) / e.count()), a = ot(Jt(r.get("barMaxWidth"), i), i), o = ot(Jt(r.get("barMinWidth"), 1), i), s = r.get("barWidth"); + return s != null ? ot(s, i) : Math.max(Math.min(i / 2, a), o); +} +const fce = cce; +function dce(r) { + r.registerChartView(ece), r.registerSeriesModel(tce), r.registerPreprocessor(rce), r.registerVisual(uce), r.registerLayout(fce); +} +function IP(r, e) { + var t = e.rippleEffectColor || e.color; + r.eachChild(function(n) { + n.attr({ + z: e.z, + zlevel: e.zlevel, + style: { + stroke: e.brushType === "stroke" ? t : null, + fill: e.brushType === "fill" ? t : null + } + }); + }); +} +var vce = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n) { + var i = r.call(this) || this, a = new um(t, n), o = new Rt(); + return i.add(a), i.add(o), i.updateData(t, n), i; + } + return e.prototype.stopEffectAnimation = function() { + this.childAt(1).removeAll(); + }, e.prototype.startEffectAnimation = function(t) { + for (var n = t.symbolType, i = t.color, a = t.rippleNumber, o = this.childAt(1), s = 0; s < a; s++) { + var l = li(n, -1, -1, 2, 2, i); + l.attr({ + style: { + strokeNoScale: !0 + }, + z2: 99, + silent: !0, + scaleX: 0.5, + scaleY: 0.5 + }); + var u = -s / a * t.period + t.effectOffset; + l.animate("", !0).when(t.period, { + scaleX: t.rippleScale / 2, + scaleY: t.rippleScale / 2 + }).delay(u).start(), l.animateStyle(!0).when(t.period, { + opacity: 0 + }).delay(u).start(), o.add(l); + } + IP(o, t); + }, e.prototype.updateEffectAnimation = function(t) { + for (var n = this._effectCfg, i = this.childAt(1), a = ["symbolType", "period", "rippleScale", "rippleNumber"], o = 0; o < a.length; o++) { + var s = a[o]; + if (n[s] !== t[s]) { + this.stopEffectAnimation(), this.startEffectAnimation(t); + return; + } + } + IP(i, t); + }, e.prototype.highlight = function() { + tu(this); + }, e.prototype.downplay = function() { + ru(this); + }, e.prototype.getSymbolType = function() { + var t = this.childAt(0); + return t && t.getSymbolType(); + }, e.prototype.updateData = function(t, n) { + var i = this, a = t.hostModel; + this.childAt(0).updateData(t, n); + var o = this.childAt(1), s = t.getItemModel(n), l = t.getItemVisual(n, "symbol"), u = lv(t.getItemVisual(n, "symbolSize")), c = t.getItemVisual(n, "style"), h = c && c.fill, f = s.getModel("emphasis"); + o.setScale(u), o.traverse(function(p) { + p.setStyle("fill", h); + }); + var v = sf(t.getItemVisual(n, "symbolOffset"), u); + v && (o.x = v[0], o.y = v[1]); + var b = t.getItemVisual(n, "symbolRotate"); + o.rotation = (b || 0) * Math.PI / 180 || 0; + var w = {}; + w.showEffectOn = a.get("showEffectOn"), w.rippleScale = s.get(["rippleEffect", "scale"]), w.brushType = s.get(["rippleEffect", "brushType"]), w.period = s.get(["rippleEffect", "period"]) * 1e3, w.effectOffset = n / t.count(), w.z = a.getShallow("z") || 0, w.zlevel = a.getShallow("zlevel") || 0, w.symbolType = l, w.color = h, w.rippleEffectColor = s.get(["rippleEffect", "color"]), w.rippleNumber = s.get(["rippleEffect", "number"]), w.showEffectOn === "render" ? (this._effectCfg ? this.updateEffectAnimation(w) : this.startEffectAnimation(w), this._effectCfg = w) : (this._effectCfg = null, this.stopEffectAnimation(), this.onHoverStateChange = function(p) { + p === "emphasis" ? w.showEffectOn !== "render" && i.startEffectAnimation(w) : p === "normal" && w.showEffectOn !== "render" && i.stopEffectAnimation(); + }), this._effectCfg = w, Un(this, f.get("focus"), f.get("blurScope"), f.get("disabled")); + }, e.prototype.fadeOut = function(t) { + t && t(); + }, e; + }(Rt) +); +const pce = vce; +var gce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function() { + this._symbolDraw = new cm(pce); + }, e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this._symbolDraw; + o.updateData(a, { + clipShape: this._getClipShape(t) + }), this.group.add(o.group); + }, e.prototype._getClipShape = function(t) { + var n = t.coordinateSystem, i = n && n.getArea && n.getArea(); + return t.get("clip", !0) ? i : null; + }, e.prototype.updateTransform = function(t, n, i) { + var a = t.getData(); + this.group.dirty(); + var o = hm("").reset(t, n, i); + o.progress && o.progress({ + start: 0, + end: a.count(), + count: a.count() + }, a), this._symbolDraw.updateLayout(); + }, e.prototype._updateGroupTransform = function(t) { + var n = t.coordinateSystem; + n && n.getRoamTransform && (this.group.transform = gj(n.getRoamTransform()), this.group.decomposeTransform()); + }, e.prototype.remove = function(t, n) { + this._symbolDraw && this._symbolDraw.remove(!0); + }, e.type = "effectScatter", e; + }(en) +); +const mce = gce; +var yce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t; + } + return e.prototype.getInitialData = function(t, n) { + return Dl(null, this, { + useEncodeDefaulter: !0 + }); + }, e.prototype.brushSelector = function(t, n, i) { + return i.point(n.getItemLayout(t)); + }, e.type = "series.effectScatter", e.dependencies = ["grid", "polar"], e.defaultOption = { + coordinateSystem: "cartesian2d", + // zlevel: 0, + z: 2, + legendHoverLink: !0, + effectType: "ripple", + progressive: 0, + // When to show the effect, option: 'render'|'emphasis' + showEffectOn: "render", + clip: !0, + // Ripple effect config + rippleEffect: { + period: 4, + // Scale of ripple + scale: 2.5, + // Brush type can be fill or stroke + brushType: "fill", + // Ripple number + number: 3 + }, + universalTransition: { + divideShape: "clone" + }, + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, + // Polar coordinate system + // polarIndex: 0, + // Geo coordinate system + // geoIndex: 0, + // symbol: null, // 图形类型 + symbolSize: 10 + // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2 + // symbolRotate: null, // 图形旋转控制 + // itemStyle: { + // opacity: 1 + // } + }, e; + }(mn) +); +const _ce = yce; +function bce(r) { + r.registerChartView(mce), r.registerSeriesModel(_ce), r.registerLayout(hm("effectScatter")); +} +var xce = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this) || this; + return a.add(a.createLine(t, n, i)), a._updateEffectSymbol(t, n), a; + } + return e.prototype.createLine = function(t, n, i) { + return new fE(t, n, i); + }, e.prototype._updateEffectSymbol = function(t, n) { + var i = t.getItemModel(n), a = i.getModel("effect"), o = a.get("symbolSize"), s = a.get("symbol"); + We(o) || (o = [o, o]); + var l = t.getItemVisual(n, "style"), u = a.get("color") || l && l.stroke, c = this.childAt(1); + this._symbolType !== s && (this.remove(c), c = li(s, -0.5, -0.5, 1, 1, u), c.z2 = 100, c.culling = !0, this.add(c)), c && (c.setStyle("shadowColor", u), c.setStyle(a.getItemStyle(["color"])), c.scaleX = o[0], c.scaleY = o[1], c.setColor(u), this._symbolType = s, this._symbolScale = o, this._updateEffectAnimation(t, a, n)); + }, e.prototype._updateEffectAnimation = function(t, n, i) { + var a = this.childAt(1); + if (a) { + var o = t.getItemLayout(i), s = n.get("period") * 1e3, l = n.get("loop"), u = n.get("roundTrip"), c = n.get("constantSpeed"), h = Ii(n.get("delay"), function(v) { + return v / t.count() * s / 3; + }); + if (a.ignore = !0, this._updateAnimationPoints(a, o), c > 0 && (s = this._getLineLength(a) / c * 1e3), s !== this._period || l !== this._loop || u !== this._roundTrip) { + a.stopAnimation(); + var f = void 0; + Tt(h) ? f = h(i) : f = h, a.__t > 0 && (f = -s * a.__t), this._animateSymbol(a, s, f, l, u); + } + this._period = s, this._loop = l, this._roundTrip = u; + } + }, e.prototype._animateSymbol = function(t, n, i, a, o) { + if (n > 0) { + t.__t = 0; + var s = this, l = t.animate("", a).when(o ? n * 2 : n, { + __t: o ? 2 : 1 + }).delay(i).during(function() { + s._updateSymbolPosition(t); + }); + a || l.done(function() { + s.remove(t); + }), l.start(); + } + }, e.prototype._getLineLength = function(t) { + return Gl(t.__p1, t.__cp1) + Gl(t.__cp1, t.__p2); + }, e.prototype._updateAnimationPoints = function(t, n) { + t.__p1 = n[0], t.__p2 = n[1], t.__cp1 = n[2] || [(n[0][0] + n[1][0]) / 2, (n[0][1] + n[1][1]) / 2]; + }, e.prototype.updateData = function(t, n, i) { + this.childAt(0).updateData(t, n, i), this._updateEffectSymbol(t, n); + }, e.prototype._updateSymbolPosition = function(t) { + var n = t.__p1, i = t.__p2, a = t.__cp1, o = t.__t < 1 ? t.__t : 2 - t.__t, s = [t.x, t.y], l = s.slice(), u = Ri, c = d1; + s[0] = u(n[0], a[0], i[0], o), s[1] = u(n[1], a[1], i[1], o); + var h = t.__t < 1 ? c(n[0], a[0], i[0], o) : c(i[0], a[0], n[0], 1 - o), f = t.__t < 1 ? c(n[1], a[1], i[1], o) : c(i[1], a[1], n[1], 1 - o); + t.rotation = -Math.atan2(f, h) - Math.PI / 2, (this._symbolType === "line" || this._symbolType === "rect" || this._symbolType === "roundRect") && (t.__lastT !== void 0 && t.__lastT < t.__t ? (t.scaleY = Gl(l, s) * 1.05, o === 1 && (s[0] = l[0] + (s[0] - l[0]) / 2, s[1] = l[1] + (s[1] - l[1]) / 2)) : t.__lastT === 1 ? t.scaleY = 2 * Gl(n, s) : t.scaleY = this._symbolScale[1]), t.__lastT = t.__t, t.ignore = !1, t.x = s[0], t.y = s[1]; + }, e.prototype.updateLayout = function(t, n) { + this.childAt(0).updateLayout(t, n); + var i = t.getItemModel(n).getModel("effect"); + this._updateEffectAnimation(t, i, n); + }, e; + }(Rt) +); +const _3 = xce; +var Sce = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i) { + var a = r.call(this) || this; + return a._createPolyline(t, n, i), a; + } + return e.prototype._createPolyline = function(t, n, i) { + var a = t.getItemLayout(n), o = new Pa({ + shape: { + points: a + } + }); + this.add(o), this._updateCommonStl(t, n, i); + }, e.prototype.updateData = function(t, n, i) { + var a = t.hostModel, o = this.childAt(0), s = { + shape: { + points: t.getItemLayout(n) + } + }; + zr(o, s, a, n), this._updateCommonStl(t, n, i); + }, e.prototype._updateCommonStl = function(t, n, i) { + var a = this.childAt(0), o = t.getItemModel(n), s = i && i.emphasisLineStyle, l = i && i.focus, u = i && i.blurScope, c = i && i.emphasisDisabled; + if (!i || t.hasItemOption) { + var h = o.getModel("emphasis"); + s = h.getModel("lineStyle").getLineStyle(), c = h.get("disabled"), l = h.get("focus"), u = h.get("blurScope"); + } + a.useStyle(t.getItemVisual(n, "style")), a.style.fill = null, a.style.strokeNoScale = !0; + var f = a.ensureState("emphasis"); + f.style = s, Un(this, l, u, c); + }, e.prototype.updateLayout = function(t, n) { + var i = this.childAt(0); + i.setShape("points", t.getItemLayout(n)); + }, e; + }(Rt) +); +const b3 = Sce; +var wce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t._lastFrame = 0, t._lastFramePercent = 0, t; + } + return e.prototype.createLine = function(t, n, i) { + return new b3(t, n, i); + }, e.prototype._updateAnimationPoints = function(t, n) { + this._points = n; + for (var i = [0], a = 0, o = 1; o < n.length; o++) { + var s = n[o - 1], l = n[o]; + a += Gl(s, l), i.push(a); + } + if (a === 0) { + this._length = 0; + return; + } + for (var o = 0; o < i.length; o++) + i[o] /= a; + this._offsets = i, this._length = a; + }, e.prototype._getLineLength = function() { + return this._length; + }, e.prototype._updateSymbolPosition = function(t) { + var n = t.__t < 1 ? t.__t : 2 - t.__t, i = this._points, a = this._offsets, o = i.length; + if (a) { + var s = this._lastFrame, l; + if (n < this._lastFramePercent) { + var u = Math.min(s + 1, o - 1); + for (l = u; l >= 0 && !(a[l] <= n); l--) + ; + l = Math.min(l, o - 2); + } else { + for (l = s; l < o && !(a[l] > n); l++) + ; + l = Math.min(l - 1, o - 2); + } + var c = (n - a[l]) / (a[l + 1] - a[l]), h = i[l], f = i[l + 1]; + t.x = h[0] * (1 - c) + c * f[0], t.y = h[1] * (1 - c) + c * f[1]; + var v = t.__t < 1 ? f[0] - h[0] : h[0] - f[0], b = t.__t < 1 ? f[1] - h[1] : h[1] - f[1]; + t.rotation = -Math.atan2(b, v) - Math.PI / 2, this._lastFrame = l, this._lastFramePercent = n, t.ignore = !1; + } + }, e; + }(_3) +); +const Cce = wce; +var Tce = ( + /** @class */ + function() { + function r() { + this.polyline = !1, this.curveness = 0, this.segs = []; + } + return r; + }() +), Ice = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t) { + var n = r.call(this, t) || this; + return n._off = 0, n.hoverDataIdx = -1, n; + } + return e.prototype.reset = function() { + this.notClear = !1, this._off = 0; + }, e.prototype.getDefaultStyle = function() { + return { + stroke: "#000", + fill: null + }; + }, e.prototype.getDefaultShape = function() { + return new Tce(); + }, e.prototype.buildPath = function(t, n) { + var i = n.segs, a = n.curveness, o; + if (n.polyline) + for (o = this._off; o < i.length; ) { + var s = i[o++]; + if (s > 0) { + t.moveTo(i[o++], i[o++]); + for (var l = 1; l < s; l++) + t.lineTo(i[o++], i[o++]); + } + } + else + for (o = this._off; o < i.length; ) { + var u = i[o++], c = i[o++], h = i[o++], f = i[o++]; + if (t.moveTo(u, c), a > 0) { + var v = (u + h) / 2 - (c - f) * a, b = (c + f) / 2 - (h - u) * a; + t.quadraticCurveTo(v, b, h, f); + } else + t.lineTo(h, f); + } + this.incremental && (this._off = o, this.notClear = !0); + }, e.prototype.findDataIndex = function(t, n) { + var i = this.shape, a = i.segs, o = i.curveness, s = this.style.lineWidth; + if (i.polyline) + for (var l = 0, u = 0; u < a.length; ) { + var c = a[u++]; + if (c > 0) + for (var h = a[u++], f = a[u++], v = 1; v < c; v++) { + var b = a[u++], w = a[u++]; + if (Uu(h, f, b, w, s, t, n)) + return l; + } + l++; + } + else + for (var l = 0, u = 0; u < a.length; ) { + var h = a[u++], f = a[u++], b = a[u++], w = a[u++]; + if (o > 0) { + var p = (h + b) / 2 - (f - w) * o, d = (f + w) / 2 - (b - h) * o; + if (d5(h, f, p, d, b, w, s, t, n)) + return l; + } else if (Uu(h, f, b, w, s, t, n)) + return l; + l++; + } + return -1; + }, e.prototype.contain = function(t, n) { + var i = this.transformCoordToLocal(t, n), a = this.getBoundingRect(); + if (t = i[0], n = i[1], a.contain(t, n)) { + var o = this.hoverDataIdx = this.findDataIndex(t, n); + return o >= 0; + } + return this.hoverDataIdx = -1, !1; + }, e.prototype.getBoundingRect = function() { + var t = this._rect; + if (!t) { + for (var n = this.shape, i = n.segs, a = 1 / 0, o = 1 / 0, s = -1 / 0, l = -1 / 0, u = 0; u < i.length; ) { + var c = i[u++], h = i[u++]; + a = Math.min(c, a), s = Math.max(c, s), o = Math.min(h, o), l = Math.max(h, l); + } + t = this._rect = new Wt(a, o, s, l); + } + return t; + }, e; + }(hr) +), Ace = ( + /** @class */ + function() { + function r() { + this.group = new Rt(); + } + return r.prototype.updateData = function(e) { + this._clear(); + var t = this._create(); + t.setShape({ + segs: e.getLayout("linesPoints") + }), this._setCommon(t, e); + }, r.prototype.incrementalPrepareUpdate = function(e) { + this.group.removeAll(), this._clear(); + }, r.prototype.incrementalUpdate = function(e, t) { + var n = this._newAdded[0], i = t.getLayout("linesPoints"), a = n && n.shape.segs; + if (a && a.length < 2e4) { + var o = a.length, s = new Float32Array(o + i.length); + s.set(a), s.set(i, o), n.setShape({ + segs: s + }); + } else { + this._newAdded = []; + var l = this._create(); + l.incremental = !0, l.setShape({ + segs: i + }), this._setCommon(l, t), l.__startIndex = e.start; + } + }, r.prototype.remove = function() { + this._clear(); + }, r.prototype.eachRendered = function(e) { + this._newAdded[0] && e(this._newAdded[0]); + }, r.prototype._create = function() { + var e = new Ice({ + cursor: "default", + ignoreCoarsePointer: !0 + }); + return this._newAdded.push(e), this.group.add(e), e; + }, r.prototype._setCommon = function(e, t, n) { + var i = t.hostModel; + e.setShape({ + polyline: i.get("polyline"), + curveness: i.get(["lineStyle", "curveness"]) + }), e.useStyle(i.getModel("lineStyle").getLineStyle()), e.style.strokeNoScale = !0; + var a = t.getVisual("style"); + a && a.stroke && e.setStyle("stroke", a.stroke), e.setStyle("fill", null); + var o = Ft(e); + o.seriesIndex = i.seriesIndex, e.on("mousemove", function(s) { + o.dataIndex = null; + var l = e.hoverDataIdx; + l > 0 && (o.dataIndex = l + e.__startIndex); + }); + }, r.prototype._clear = function() { + this._newAdded = [], this.group.removeAll(); + }, r; + }() +); +const Ece = Ace; +var Mce = { + seriesType: "lines", + plan: ov(), + reset: function(r) { + var e = r.coordinateSystem; + if (e) { + var t = r.get("polyline"), n = r.pipelineContext.large; + return { + progress: function(i, a) { + var o = []; + if (n) { + var s = void 0, l = i.end - i.start; + if (t) { + for (var u = 0, c = i.start; c < i.end; c++) + u += r.getLineCoordsCount(c); + s = new Float32Array(l + u * 2); + } else + s = new Float32Array(l * 4); + for (var h = 0, f = [], c = i.start; c < i.end; c++) { + var v = r.getLineCoords(c, o); + t && (s[h++] = v); + for (var b = 0; b < v; b++) + f = e.dataToPoint(o[b], !1, f), s[h++] = f[0], s[h++] = f[1]; + } + a.setLayout("linesPoints", s); + } else + for (var c = i.start; c < i.end; c++) { + var w = a.getItemModel(c), v = r.getLineCoords(c, o), p = []; + if (t) + for (var d = 0; d < v; d++) + p.push(e.dataToPoint(o[d])); + else { + p[0] = e.dataToPoint(o[0]), p[1] = e.dataToPoint(o[1]); + var m = w.get(["lineStyle", "curveness"]); + +m && (p[2] = [(p[0][0] + p[1][0]) / 2 - (p[0][1] - p[1][1]) * m, (p[0][1] + p[1][1]) / 2 - (p[1][0] - p[0][0]) * m]); + } + a.setItemLayout(c, p); + } + } + }; + } + } +}; +const x3 = Mce; +var Dce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this._updateLineDraw(a, t), s = t.get("zlevel"), l = t.get(["effect", "trailLength"]), u = i.getZr(), c = u.painter.getType() === "svg"; + c || u.painter.getLayer(s).clear(!0), this._lastZlevel != null && !c && u.configLayer(this._lastZlevel, { + motionBlur: !1 + }), this._showEffect(t) && l > 0 && (c || u.configLayer(s, { + motionBlur: !0, + lastFrameAlpha: Math.max(Math.min(l / 10 + 0.9, 1), 0) + })), o.updateData(a); + var h = t.get("clip", !0) && lx(t.coordinateSystem, !1, t); + h ? this.group.setClipPath(h) : this.group.removeClipPath(), this._lastZlevel = s, this._finished = !0; + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + var a = t.getData(), o = this._updateLineDraw(a, t); + o.incrementalPrepareUpdate(a), this._clearLayer(i), this._finished = !1; + }, e.prototype.incrementalRender = function(t, n, i) { + this._lineDraw.incrementalUpdate(t, n.getData()), this._finished = t.end === n.getData().count(); + }, e.prototype.eachRendered = function(t) { + this._lineDraw && this._lineDraw.eachRendered(t); + }, e.prototype.updateTransform = function(t, n, i) { + var a = t.getData(), o = t.pipelineContext; + if (!this._finished || o.large || o.progressiveRender) + return { + update: !0 + }; + var s = x3.reset(t, n, i); + s.progress && s.progress({ + start: 0, + end: a.count(), + count: a.count() + }, a), this._lineDraw.updateLayout(), this._clearLayer(i); + }, e.prototype._updateLineDraw = function(t, n) { + var i = this._lineDraw, a = this._showEffect(n), o = !!n.get("polyline"), s = n.pipelineContext, l = s.large; + return (!i || a !== this._hasEffet || o !== this._isPolyline || l !== this._isLargeDraw) && (i && i.remove(), i = this._lineDraw = l ? new Ece() : new dE(o ? a ? Cce : b3 : a ? _3 : fE), this._hasEffet = a, this._isPolyline = o, this._isLargeDraw = l), this.group.add(i.group), i; + }, e.prototype._showEffect = function(t) { + return !!t.get(["effect", "show"]); + }, e.prototype._clearLayer = function(t) { + var n = t.getZr(), i = n.painter.getType() === "svg"; + !i && this._lastZlevel != null && n.painter.getLayer(this._lastZlevel).clear(!0); + }, e.prototype.remove = function(t, n) { + this._lineDraw && this._lineDraw.remove(), this._lineDraw = null, this._clearLayer(n); + }, e.prototype.dispose = function(t, n) { + this.remove(t, n); + }, e.type = "lines", e; + }(en) +); +const kce = Dce; +var Oce = typeof Uint32Array == "undefined" ? Array : Uint32Array, Lce = typeof Float64Array == "undefined" ? Array : Float64Array; +function AP(r) { + var e = r.data; + e && e[0] && e[0][0] && e[0][0].coord && (r.data = Ke(e, function(t) { + var n = [t[0].coord, t[1].coord], i = { + coords: n + }; + return t[0].name && (i.fromName = t[0].name), t[1].name && (i.toName = t[1].name), wb([i, t[0], t[1]]); + })); +} +var Pce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.visualStyleAccessPath = "lineStyle", t.visualDrawType = "stroke", t; + } + return e.prototype.init = function(t) { + t.data = t.data || [], AP(t); + var n = this._processFlatCoordsArray(t.data); + this._flatCoords = n.flatCoords, this._flatCoordsOffset = n.flatCoordsOffset, n.flatCoords && (t.data = new Float32Array(n.count)), r.prototype.init.apply(this, arguments); + }, e.prototype.mergeOption = function(t) { + if (AP(t), t.data) { + var n = this._processFlatCoordsArray(t.data); + this._flatCoords = n.flatCoords, this._flatCoordsOffset = n.flatCoordsOffset, n.flatCoords && (t.data = new Float32Array(n.count)); + } + r.prototype.mergeOption.apply(this, arguments); + }, e.prototype.appendData = function(t) { + var n = this._processFlatCoordsArray(t.data); + n.flatCoords && (this._flatCoords ? (this._flatCoords = ag(this._flatCoords, n.flatCoords), this._flatCoordsOffset = ag(this._flatCoordsOffset, n.flatCoordsOffset)) : (this._flatCoords = n.flatCoords, this._flatCoordsOffset = n.flatCoordsOffset), t.data = new Float32Array(n.count)), this.getRawData().appendData(t.data); + }, e.prototype._getCoordsFromItemModel = function(t) { + var n = this.getData().getItemModel(t), i = n.option instanceof Array ? n.option : n.getShallow("coords"); + return i; + }, e.prototype.getLineCoordsCount = function(t) { + return this._flatCoordsOffset ? this._flatCoordsOffset[t * 2 + 1] : this._getCoordsFromItemModel(t).length; + }, e.prototype.getLineCoords = function(t, n) { + if (this._flatCoordsOffset) { + for (var i = this._flatCoordsOffset[t * 2], a = this._flatCoordsOffset[t * 2 + 1], o = 0; o < a; o++) + n[o] = n[o] || [], n[o][0] = this._flatCoords[i + o * 2], n[o][1] = this._flatCoords[i + o * 2 + 1]; + return a; + } else { + for (var s = this._getCoordsFromItemModel(t), o = 0; o < s.length; o++) + n[o] = n[o] || [], n[o][0] = s[o][0], n[o][1] = s[o][1]; + return s.length; + } + }, e.prototype._processFlatCoordsArray = function(t) { + var n = 0; + if (this._flatCoords && (n = this._flatCoords.length), Pr(t[0])) { + for (var i = t.length, a = new Oce(i), o = new Lce(i), s = 0, l = 0, u = 0, c = 0; c < i; ) { + u++; + var h = t[c++]; + a[l++] = s + n, a[l++] = h; + for (var f = 0; f < h; f++) { + var v = t[c++], b = t[c++]; + o[s++] = v, o[s++] = b; + } + } + return { + flatCoordsOffset: new Uint32Array(a.buffer, 0, l), + flatCoords: o, + count: u + }; + } + return { + flatCoordsOffset: null, + flatCoords: null, + count: t.length + }; + }, e.prototype.getInitialData = function(t, n) { + var i = new Ui(["value"], this); + return i.hasItemOption = !1, i.initData(t.data, [], function(a, o, s, l) { + if (a instanceof Array) + return NaN; + i.hasItemOption = !0; + var u = a.value; + if (u != null) + return u instanceof Array ? u[l] : u; + }), i; + }, e.prototype.formatTooltip = function(t, n, i) { + var a = this.getData(), o = a.getItemModel(t), s = o.get("name"); + if (s) + return s; + var l = o.get("fromName"), u = o.get("toName"), c = []; + return l != null && c.push(l), u != null && c.push(u), Di("nameValue", { + name: c.join(" > ") + }); + }, e.prototype.preventIncremental = function() { + return !!this.get(["effect", "show"]); + }, e.prototype.getProgressive = function() { + var t = this.option.progressive; + return t == null ? this.option.large ? 1e4 : this.get("progressive") : t; + }, e.prototype.getProgressiveThreshold = function() { + var t = this.option.progressiveThreshold; + return t == null ? this.option.large ? 2e4 : this.get("progressiveThreshold") : t; + }, e.prototype.getZLevelKey = function() { + var t = this.getModel("effect"), n = t.get("trailLength"); + return this.getData().count() > this.getProgressiveThreshold() ? this.id : t.get("show") && n > 0 ? n + "" : ""; + }, e.type = "series.lines", e.dependencies = ["grid", "polar", "geo", "calendar"], e.defaultOption = { + coordinateSystem: "geo", + // zlevel: 0, + z: 2, + legendHoverLink: !0, + // Cartesian coordinate system + xAxisIndex: 0, + yAxisIndex: 0, + symbol: ["none", "none"], + symbolSize: [10, 10], + // Geo coordinate system + geoIndex: 0, + effect: { + show: !1, + period: 4, + constantSpeed: 0, + symbol: "circle", + symbolSize: 3, + loop: !0, + trailLength: 0.2 + }, + large: !1, + // Available when large is true + largeThreshold: 2e3, + polyline: !1, + clip: !0, + label: { + show: !1, + position: "end" + // distance: 5, + // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调 + }, + lineStyle: { + opacity: 0.5 + } + }, e; + }(mn) +); +const Rce = Pce; +function h0(r) { + return r instanceof Array || (r = [r, r]), r; +} +var Nce = { + seriesType: "lines", + reset: function(r) { + var e = h0(r.get("symbol")), t = h0(r.get("symbolSize")), n = r.getData(); + n.setVisual("fromSymbol", e && e[0]), n.setVisual("toSymbol", e && e[1]), n.setVisual("fromSymbolSize", t && t[0]), n.setVisual("toSymbolSize", t && t[1]); + function i(a, o) { + var s = a.getItemModel(o), l = h0(s.getShallow("symbol", !0)), u = h0(s.getShallow("symbolSize", !0)); + l[0] && a.setItemVisual(o, "fromSymbol", l[0]), l[1] && a.setItemVisual(o, "toSymbol", l[1]), u[0] && a.setItemVisual(o, "fromSymbolSize", u[0]), u[1] && a.setItemVisual(o, "toSymbolSize", u[1]); + } + return { + dataEach: n.hasItemOption ? i : null + }; + } +}; +const zce = Nce; +function Bce(r) { + r.registerChartView(kce), r.registerSeriesModel(Rce), r.registerLayout(x3), r.registerVisual(zce); +} +var jce = 256, Fce = ( + /** @class */ + function() { + function r() { + this.blurSize = 30, this.pointSize = 20, this.maxOpacity = 1, this.minOpacity = 0, this._gradientPixels = { + inRange: null, + outOfRange: null + }; + var e = Bs.createCanvas(); + this.canvas = e; + } + return r.prototype.update = function(e, t, n, i, a, o) { + var s = this._getBrush(), l = this._getGradient(a, "inRange"), u = this._getGradient(a, "outOfRange"), c = this.pointSize + this.blurSize, h = this.canvas, f = h.getContext("2d"), v = e.length; + h.width = t, h.height = n; + for (var b = 0; b < v; ++b) { + var w = e[b], p = w[0], d = w[1], m = w[2], _ = i(m); + f.globalAlpha = _, f.drawImage(s, p - c, d - c); + } + if (!h.width || !h.height) + return h; + for (var y = f.getImageData(0, 0, h.width, h.height), x = y.data, g = 0, S = x.length, T = this.minOpacity, C = this.maxOpacity, E = C - T; g < S; ) { + var _ = x[g + 3] / 256, M = Math.floor(_ * (jce - 1)) * 4; + if (_ > 0) { + var P = o(_) ? l : u; + _ > 0 && (_ = _ * E + T), x[g++] = P[M], x[g++] = P[M + 1], x[g++] = P[M + 2], x[g++] = P[M + 3] * _ * 256; + } else + g += 4; + } + return f.putImageData(y, 0, 0), h; + }, r.prototype._getBrush = function() { + var e = this._brushCanvas || (this._brushCanvas = Bs.createCanvas()), t = this.pointSize + this.blurSize, n = t * 2; + e.width = n, e.height = n; + var i = e.getContext("2d"); + return i.clearRect(0, 0, n, n), i.shadowOffsetX = n, i.shadowBlur = this.blurSize, i.shadowColor = "#000", i.beginPath(), i.arc(-t, t, this.pointSize, 0, Math.PI * 2, !0), i.closePath(), i.fill(), e; + }, r.prototype._getGradient = function(e, t) { + for (var n = this._gradientPixels, i = n[t] || (n[t] = new Uint8ClampedArray(256 * 4)), a = [0, 0, 0, 0], o = 0, s = 0; s < 256; s++) + e[t](s / 255, !0, a), i[o++] = a[0], i[o++] = a[1], i[o++] = a[2], i[o++] = a[3]; + return i; + }, r; + }() +); +const $ce = Fce; +function Hce(r, e, t) { + var n = r[1] - r[0]; + e = Ke(e, function(o) { + return { + interval: [(o.interval[0] - r[0]) / n, (o.interval[1] - r[0]) / n] + }; + }); + var i = e.length, a = 0; + return function(o) { + var s; + for (s = a; s < i; s++) { + var l = e[s].interval; + if (l[0] <= o && o <= l[1]) { + a = s; + break; + } + } + if (s === i) + for (s = a - 1; s >= 0; s--) { + var l = e[s].interval; + if (l[0] <= o && o <= l[1]) { + a = s; + break; + } + } + return s >= 0 && s < i && t[s]; + }; +} +function Vce(r, e) { + var t = r[1] - r[0]; + return e = [(e[0] - r[0]) / t, (e[1] - r[0]) / t], function(n) { + return n >= e[0] && n <= e[1]; + }; +} +function EP(r) { + var e = r.dimensions; + return e[0] === "lng" && e[1] === "lat"; +} +var Gce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a; + n.eachComponent("visualMap", function(s) { + s.eachTargetSeries(function(l) { + l === t && (a = s); + }); + }), this._progressiveEls = null, this.group.removeAll(); + var o = t.coordinateSystem; + o.type === "cartesian2d" || o.type === "calendar" ? this._renderOnCartesianAndCalendar(t, i, 0, t.getData().count()) : EP(o) && this._renderOnGeo(o, t, a, i); + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + this.group.removeAll(); + }, e.prototype.incrementalRender = function(t, n, i, a) { + var o = n.coordinateSystem; + o && (EP(o) ? this.render(n, i, a) : (this._progressiveEls = [], this._renderOnCartesianAndCalendar(n, a, t.start, t.end, !0))); + }, e.prototype.eachRendered = function(t) { + Cc(this._progressiveEls || this.group, t); + }, e.prototype._renderOnCartesianAndCalendar = function(t, n, i, a, o) { + var s = t.coordinateSystem, l = lf(s, "cartesian2d"), u, c, h, f; + if (l) { + var v = s.getAxis("x"), b = s.getAxis("y"); + u = v.getBandWidth() + 0.5, c = b.getBandWidth() + 0.5, h = v.scale.getExtent(), f = b.scale.getExtent(); + } + for (var w = this.group, p = t.getData(), d = t.getModel(["emphasis", "itemStyle"]).getItemStyle(), m = t.getModel(["blur", "itemStyle"]).getItemStyle(), _ = t.getModel(["select", "itemStyle"]).getItemStyle(), y = t.get(["itemStyle", "borderRadius"]), x = Mi(t), g = t.getModel("emphasis"), S = g.get("focus"), T = g.get("blurScope"), C = g.get("disabled"), E = l ? [p.mapDimension("x"), p.mapDimension("y"), p.mapDimension("value")] : [p.mapDimension("time"), p.mapDimension("value")], M = i; M < a; M++) { + var P = void 0, R = p.getItemVisual(M, "style"); + if (l) { + var N = p.get(E[0], M), F = p.get(E[1], M); + if (isNaN(p.get(E[2], M)) || isNaN(N) || isNaN(F) || N < h[0] || N > h[1] || F < f[0] || F > f[1]) + continue; + var U = s.dataToPoint([N, F]); + P = new Or({ + shape: { + x: U[0] - u / 2, + y: U[1] - c / 2, + width: u, + height: c + }, + style: R + }); + } else { + if (isNaN(p.get(E[1], M))) + continue; + P = new Or({ + z2: 1, + shape: s.dataToRect([p.get(E[0], M)]).contentShape, + style: R + }); + } + if (p.hasItemOption) { + var $ = p.getItemModel(M), G = $.getModel("emphasis"); + d = G.getModel("itemStyle").getItemStyle(), m = $.getModel(["blur", "itemStyle"]).getItemStyle(), _ = $.getModel(["select", "itemStyle"]).getItemStyle(), y = $.get(["itemStyle", "borderRadius"]), S = G.get("focus"), T = G.get("blurScope"), C = G.get("disabled"), x = Mi($); + } + P.shape.r = y; + var Q = t.getRawValue(M), ee = "-"; + Q && Q[2] != null && (ee = Q[2] + ""), Zi(P, x, { + labelFetcher: t, + labelDataIndex: M, + defaultOpacity: R.opacity, + defaultText: ee + }), P.ensureState("emphasis").style = d, P.ensureState("blur").style = m, P.ensureState("select").style = _, Un(P, S, T, C), P.incremental = o, o && (P.states.emphasis.hoverLayer = !0), w.add(P), p.setItemGraphicEl(M, P), this._progressiveEls && this._progressiveEls.push(P); + } + }, e.prototype._renderOnGeo = function(t, n, i, a) { + var o = i.targetVisuals.inRange, s = i.targetVisuals.outOfRange, l = n.getData(), u = this._hmLayer || this._hmLayer || new $ce(); + u.blurSize = n.get("blurSize"), u.pointSize = n.get("pointSize"), u.minOpacity = n.get("minOpacity"), u.maxOpacity = n.get("maxOpacity"); + var c = t.getViewRect().clone(), h = t.getRoamTransform(); + c.applyTransform(h); + var f = Math.max(c.x, 0), v = Math.max(c.y, 0), b = Math.min(c.width + c.x, a.getWidth()), w = Math.min(c.height + c.y, a.getHeight()), p = b - f, d = w - v, m = [l.mapDimension("lng"), l.mapDimension("lat"), l.mapDimension("value")], _ = l.mapArray(m, function(S, T, C) { + var E = t.dataToPoint([S, T]); + return E[0] -= f, E[1] -= v, E.push(C), E; + }), y = i.getExtent(), x = i.type === "visualMap.continuous" ? Vce(y, i.option.range) : Hce(y, i.getPieceList(), i.option.selected); + u.update(_, p, d, o.color.getNormalizer(), { + inRange: o.color.getColorMapper(), + outOfRange: s.color.getColorMapper() + }, x); + var g = new ji({ + style: { + width: p, + height: d, + x: f, + y: v, + image: u.canvas + }, + silent: !0 + }); + this.group.add(g); + }, e.type = "heatmap", e; + }(en) +); +const Uce = Gce; +var Wce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.getInitialData = function(t, n) { + return Dl(null, this, { + generateCoord: "value" + }); + }, e.prototype.preventIncremental = function() { + var t = av.get(this.get("coordinateSystem")); + if (t && t.dimensions) + return t.dimensions[0] === "lng" && t.dimensions[1] === "lat"; + }, e.type = "series.heatmap", e.dependencies = ["grid", "geo", "calendar"], e.defaultOption = { + coordinateSystem: "cartesian2d", + // zlevel: 0, + z: 2, + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, + // Geo coordinate system + geoIndex: 0, + blurSize: 30, + pointSize: 20, + maxOpacity: 1, + minOpacity: 0, + select: { + itemStyle: { + borderColor: "#212121" + } + } + }, e; + }(mn) +); +const Yce = Wce; +function Xce(r) { + r.registerChartView(Uce), r.registerSeriesModel(Yce); +} +var Zce = ["itemStyle", "borderWidth"], MP = [{ + xy: "x", + wh: "width", + index: 0, + posDesc: ["left", "right"] +}, { + xy: "y", + wh: "height", + index: 1, + posDesc: ["top", "bottom"] +}], Kw = new $s(), Jce = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = this.group, o = t.getData(), s = this._data, l = t.coordinateSystem, u = l.getBaseAxis(), c = u.isHorizontal(), h = l.master.getRect(), f = { + ecSize: { + width: i.getWidth(), + height: i.getHeight() + }, + seriesModel: t, + coordSys: l, + coordSysExtent: [[h.x, h.x + h.width], [h.y, h.y + h.height]], + isHorizontal: c, + valueDim: MP[+c], + categoryDim: MP[1 - +c] + }; + return o.diff(s).add(function(v) { + if (o.hasValue(v)) { + var b = kP(o, v), w = DP(o, v, b, f), p = OP(o, f, w); + o.setItemGraphicEl(v, p), a.add(p), PP(p, f, w); + } + }).update(function(v, b) { + var w = s.getItemGraphicEl(b); + if (!o.hasValue(v)) { + a.remove(w); + return; + } + var p = kP(o, v), d = DP(o, v, p, f), m = A3(o, d); + w && m !== w.__pictorialShapeStr && (a.remove(w), o.setItemGraphicEl(v, null), w = null), w ? nhe(w, f, d) : w = OP(o, f, d, !0), o.setItemGraphicEl(v, w), w.__pictorialSymbolMeta = d, a.add(w), PP(w, f, d); + }).remove(function(v) { + var b = s.getItemGraphicEl(v); + b && LP(s, v, b.__pictorialSymbolMeta.animationModel, b); + }).execute(), this._data = o, this.group; + }, e.prototype.remove = function(t, n) { + var i = this.group, a = this._data; + t.get("animation") ? a && a.eachItemGraphicEl(function(o) { + LP(a, Ft(o).dataIndex, t, o); + }) : i.removeAll(); + }, e.type = "pictorialBar", e; + }(en) +); +function DP(r, e, t, n) { + var i = r.getItemLayout(e), a = t.get("symbolRepeat"), o = t.get("symbolClip"), s = t.get("symbolPosition") || "start", l = t.get("symbolRotate"), u = (l || 0) * Math.PI / 180 || 0, c = t.get("symbolPatternSize") || 2, h = t.isAnimationEnabled(), f = { + dataIndex: e, + layout: i, + itemModel: t, + symbolType: r.getItemVisual(e, "symbol") || "circle", + style: r.getItemVisual(e, "style"), + symbolClip: o, + symbolRepeat: a, + symbolRepeatDirection: t.get("symbolRepeatDirection"), + symbolPatternSize: c, + rotation: u, + animationModel: h ? t : null, + hoverScale: h && t.get(["emphasis", "scale"]), + z2: t.getShallow("z", !0) || 0 + }; + Kce(t, a, i, n, f), Qce(r, e, i, a, o, f.boundingLength, f.pxSign, c, n, f), qce(t, f.symbolScale, u, n, f); + var v = f.symbolSize, b = sf(t.get("symbolOffset"), v); + return ehe(t, v, i, a, o, b, s, f.valueLineWidth, f.boundingLength, f.repeatCutLength, n, f), f; +} +function Kce(r, e, t, n, i) { + var a = n.valueDim, o = r.get("symbolBoundingData"), s = n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()), l = s.toGlobalCoord(s.dataToCoord(0)), u = 1 - +(t[a.wh] <= 0), c; + if (We(o)) { + var h = [Qw(s, o[0]) - l, Qw(s, o[1]) - l]; + h[1] < h[0] && h.reverse(), c = h[u]; + } else + o != null ? c = Qw(s, o) - l : e ? c = n.coordSysExtent[a.index][u] - l : c = t[a.wh]; + i.boundingLength = c, e && (i.repeatCutLength = t[a.wh]), i.pxSign = c > 0 ? 1 : -1; +} +function Qw(r, e) { + return r.toGlobalCoord(r.dataToCoord(r.scale.parse(e))); +} +function Qce(r, e, t, n, i, a, o, s, l, u) { + var c = l.valueDim, h = l.categoryDim, f = Math.abs(t[h.wh]), v = r.getItemVisual(e, "symbolSize"), b; + We(v) ? b = v.slice() : v == null ? b = ["100%", "100%"] : b = [v, v], b[h.index] = ot(b[h.index], f), b[c.index] = ot(b[c.index], n ? f : Math.abs(a)), u.symbolSize = b; + var w = u.symbolScale = [b[0] / s, b[1] / s]; + w[c.index] *= (l.isHorizontal ? -1 : 1) * o; +} +function qce(r, e, t, n, i) { + var a = r.get(Zce) || 0; + a && (Kw.attr({ + scaleX: e[0], + scaleY: e[1], + rotation: t + }), Kw.updateTransform(), a /= Kw.getLineScale(), a *= e[n.valueDim.index]), i.valueLineWidth = a || 0; +} +function ehe(r, e, t, n, i, a, o, s, l, u, c, h) { + var f = c.categoryDim, v = c.valueDim, b = h.pxSign, w = Math.max(e[v.index] + s, 0), p = w; + if (n) { + var d = Math.abs(l), m = Ii(r.get("symbolMargin"), "15%") + "", _ = !1; + m.lastIndexOf("!") === m.length - 1 && (_ = !0, m = m.slice(0, m.length - 1)); + var y = ot(m, e[v.index]), x = Math.max(w + y * 2, 0), g = _ ? 0 : y * 2, S = $I(n), T = S ? n : RP((d + g) / x), C = d - T * w; + y = C / 2 / (_ ? T : Math.max(T - 1, 1)), x = w + y * 2, g = _ ? 0 : y * 2, !S && n !== "fixed" && (T = u ? RP((Math.abs(u) + g) / x) : 0), p = T * x - g, h.repeatTimes = T, h.symbolMargin = y; + } + var E = b * (p / 2), M = h.pathPosition = []; + M[f.index] = t[f.wh] / 2, M[v.index] = o === "start" ? E : o === "end" ? l - E : l / 2, a && (M[0] += a[0], M[1] += a[1]); + var P = h.bundlePosition = []; + P[f.index] = t[f.xy], P[v.index] = t[v.xy]; + var R = h.barRectShape = Fe({}, t); + R[v.wh] = b * Math.max(Math.abs(t[v.wh]), Math.abs(M[v.index] + E)), R[f.wh] = t[f.wh]; + var N = h.clipShape = {}; + N[f.xy] = -t[f.xy], N[f.wh] = c.ecSize[f.wh], N[v.xy] = 0, N[v.wh] = t[v.wh]; +} +function S3(r) { + var e = r.symbolPatternSize, t = li( + // Consider texture img, make a big size. + r.symbolType, + -e / 2, + -e / 2, + e, + e + ); + return t.attr({ + culling: !0 + }), t.type !== "image" && t.setStyle({ + strokeNoScale: !0 + }), t; +} +function w3(r, e, t, n) { + var i = r.__pictorialBundle, a = t.symbolSize, o = t.valueLineWidth, s = t.pathPosition, l = e.valueDim, u = t.repeatTimes || 0, c = 0, h = a[e.valueDim.index] + o + t.symbolMargin * 2; + for (xE(r, function(w) { + w.__pictorialAnimationIndex = c, w.__pictorialRepeatTimes = u, c < u ? Cd(w, null, b(c), t, n) : Cd(w, null, { + scaleX: 0, + scaleY: 0 + }, t, n, function() { + i.remove(w); + }), c++; + }); c < u; c++) { + var f = S3(t); + f.__pictorialAnimationIndex = c, f.__pictorialRepeatTimes = u, i.add(f); + var v = b(c); + Cd(f, { + x: v.x, + y: v.y, + scaleX: 0, + scaleY: 0 + }, { + scaleX: v.scaleX, + scaleY: v.scaleY, + rotation: v.rotation + }, t, n); + } + function b(w) { + var p = s.slice(), d = t.pxSign, m = w; + return (t.symbolRepeatDirection === "start" ? d > 0 : d < 0) && (m = u - 1 - w), p[l.index] = h * (m - u / 2 + 0.5) + s[l.index], { + x: p[0], + y: p[1], + scaleX: t.symbolScale[0], + scaleY: t.symbolScale[1], + rotation: t.rotation + }; + } +} +function C3(r, e, t, n) { + var i = r.__pictorialBundle, a = r.__pictorialMainPath; + a ? Cd(a, null, { + x: t.pathPosition[0], + y: t.pathPosition[1], + scaleX: t.symbolScale[0], + scaleY: t.symbolScale[1], + rotation: t.rotation + }, t, n) : (a = r.__pictorialMainPath = S3(t), i.add(a), Cd(a, { + x: t.pathPosition[0], + y: t.pathPosition[1], + scaleX: 0, + scaleY: 0, + rotation: t.rotation + }, { + scaleX: t.symbolScale[0], + scaleY: t.symbolScale[1] + }, t, n)); +} +function T3(r, e, t) { + var n = Fe({}, e.barRectShape), i = r.__pictorialBarRect; + i ? Cd(i, null, { + shape: n + }, e, t) : (i = r.__pictorialBarRect = new Or({ + z2: 2, + shape: n, + silent: !0, + style: { + stroke: "transparent", + fill: "transparent", + lineWidth: 0 + } + }), i.disableMorphing = !0, r.add(i)); +} +function I3(r, e, t, n) { + if (t.symbolClip) { + var i = r.__pictorialClipPath, a = Fe({}, t.clipShape), o = e.valueDim, s = t.animationModel, l = t.dataIndex; + if (i) + zr(i, { + shape: a + }, s, l); + else { + a[o.wh] = 0, i = new Or({ + shape: a + }), r.__pictorialBundle.setClipPath(i), r.__pictorialClipPath = i; + var u = {}; + u[o.wh] = t.clipShape[o.wh], rm[n ? "updateProps" : "initProps"](i, { + shape: u + }, s, l); + } + } +} +function kP(r, e) { + var t = r.getItemModel(e); + return t.getAnimationDelayParams = the, t.isAnimationEnabled = rhe, t; +} +function the(r) { + return { + index: r.__pictorialAnimationIndex, + count: r.__pictorialRepeatTimes + }; +} +function rhe() { + return this.parentModel.isAnimationEnabled() && !!this.getShallow("animation"); +} +function OP(r, e, t, n) { + var i = new Rt(), a = new Rt(); + return i.add(a), i.__pictorialBundle = a, a.x = t.bundlePosition[0], a.y = t.bundlePosition[1], t.symbolRepeat ? w3(i, e, t) : C3(i, e, t), T3(i, t, n), I3(i, e, t, n), i.__pictorialShapeStr = A3(r, t), i.__pictorialSymbolMeta = t, i; +} +function nhe(r, e, t) { + var n = t.animationModel, i = t.dataIndex, a = r.__pictorialBundle; + zr(a, { + x: t.bundlePosition[0], + y: t.bundlePosition[1] + }, n, i), t.symbolRepeat ? w3(r, e, t, !0) : C3(r, e, t, !0), T3(r, t, !0), I3(r, e, t, !0); +} +function LP(r, e, t, n) { + var i = n.__pictorialBarRect; + i && i.removeTextContent(); + var a = []; + xE(n, function(o) { + a.push(o); + }), n.__pictorialMainPath && a.push(n.__pictorialMainPath), n.__pictorialClipPath && (t = null), X(a, function(o) { + dc(o, { + scaleX: 0, + scaleY: 0 + }, t, e, function() { + n.parent && n.parent.remove(n); + }); + }), r.setItemGraphicEl(e, null); +} +function A3(r, e) { + return [r.getItemVisual(e.dataIndex, "symbol") || "none", !!e.symbolRepeat, !!e.symbolClip].join(":"); +} +function xE(r, e, t) { + X(r.__pictorialBundle.children(), function(n) { + n !== r.__pictorialBarRect && e.call(t, n); + }); +} +function Cd(r, e, t, n, i, a) { + e && r.attr(e), n.symbolClip && !i ? t && r.attr(t) : t && rm[i ? "updateProps" : "initProps"](r, t, n.animationModel, n.dataIndex, a); +} +function PP(r, e, t) { + var n = t.dataIndex, i = t.itemModel, a = i.getModel("emphasis"), o = a.getModel("itemStyle").getItemStyle(), s = i.getModel(["blur", "itemStyle"]).getItemStyle(), l = i.getModel(["select", "itemStyle"]).getItemStyle(), u = i.getShallow("cursor"), c = a.get("focus"), h = a.get("blurScope"), f = a.get("scale"); + xE(r, function(w) { + if (w instanceof ji) { + var p = w.style; + w.useStyle(Fe({ + // TODO other properties like dx, dy ? + image: p.image, + x: p.x, + y: p.y, + width: p.width, + height: p.height + }, t.style)); + } else + w.useStyle(t.style); + var d = w.ensureState("emphasis"); + d.style = o, f && (d.scaleX = w.scaleX * 1.1, d.scaleY = w.scaleY * 1.1), w.ensureState("blur").style = s, w.ensureState("select").style = l, u && (w.cursor = u), w.z2 = t.z2; + }); + var v = e.valueDim.posDesc[+(t.boundingLength > 0)], b = r.__pictorialBarRect; + Zi(b, Mi(i), { + labelFetcher: e.seriesModel, + labelDataIndex: n, + defaultText: zd(e.seriesModel.getData(), n), + inheritColor: t.style.fill, + defaultOpacity: t.style.opacity, + defaultOutsidePosition: v + }), Un(r, c, h, a.get("disabled")); +} +function RP(r) { + var e = Math.round(r); + return Math.abs(r - e) < 1e-4 ? e : Math.ceil(r); +} +const ihe = Jce; +var ahe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.hasSymbolVisual = !0, t.defaultSymbol = "roundRect", t; + } + return e.prototype.getInitialData = function(t) { + return t.stack = null, r.prototype.getInitialData.apply(this, arguments); + }, e.type = "series.pictorialBar", e.dependencies = ["grid"], e.defaultOption = Tc(B_.defaultOption, { + symbol: "circle", + symbolSize: null, + symbolRotate: null, + symbolPosition: null, + symbolOffset: null, + symbolMargin: null, + symbolRepeat: !1, + symbolRepeatDirection: "end", + symbolClip: !1, + symbolBoundingData: null, + symbolPatternSize: 400, + barGap: "-100%", + // z can be set in data item, which is z2 actually. + // Disable progressive + progressive: 0, + emphasis: { + // By default pictorialBar do not hover scale. Hover scale is not suitable + // for the case that both has foreground and background. + scale: !1 + }, + select: { + itemStyle: { + borderColor: "#212121" + } + } + }), e; + }(B_) +); +const ohe = ahe; +function she(r) { + r.registerChartView(ihe), r.registerSeriesModel(ohe), r.registerLayout(r.PRIORITY.VISUAL.LAYOUT, jt(J4, "pictorialBar")), r.registerLayout(r.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, K4("pictorialBar")); +} +var lhe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._layers = [], t; + } + return e.prototype.render = function(t, n, i) { + var a = t.getData(), o = this, s = this.group, l = t.getLayerSeries(), u = a.getLayout("layoutInfo"), c = u.rect, h = u.boundaryGap; + s.x = 0, s.y = c.y + h[0]; + function f(p) { + return p.name; + } + var v = new nu(this._layersSeries || [], l, f, f), b = []; + v.add(ft(w, this, "add")).update(ft(w, this, "update")).remove(ft(w, this, "remove")).execute(); + function w(p, d, m) { + var _ = o._layers; + if (p === "remove") { + s.remove(_[d]); + return; + } + for (var y = [], x = [], g, S = l[d].indices, T = 0; T < S.length; T++) { + var C = a.getItemLayout(S[T]), E = C.x, M = C.y0, P = C.y; + y.push(E, M), x.push(E, M + P), g = a.getItemVisual(S[T], "style"); + } + var R, N = a.getItemLayout(S[0]), F = t.getModel("label"), U = F.get("margin"), $ = t.getModel("emphasis"); + if (p === "add") { + var G = b[d] = new Rt(); + R = new K$({ + shape: { + points: y, + stackedOnPoints: x, + smooth: 0.4, + stackedOnSmooth: 0.4, + smoothConstraint: !1 + }, + z2: 0 + }), G.add(R), s.add(G), t.isAnimationEnabled() && R.setClipPath(uhe(R.getBoundingRect(), t, function() { + R.removeClipPath(); + })); + } else { + var G = _[m]; + R = G.childAt(0), s.add(G), b[d] = G, zr(R, { + shape: { + points: y, + stackedOnPoints: x + } + }, t), Hs(R); + } + Zi(R, Mi(t), { + labelDataIndex: S[T - 1], + defaultText: a.getName(S[T - 1]), + inheritColor: g.fill + }, { + normal: { + verticalAlign: "middle" + // align: 'right' + } + }), R.setTextConfig({ + position: null, + local: !0 + }); + var Q = R.getTextContent(); + Q && (Q.x = N.x - U, Q.y = N.y0 + N.y / 2), R.useStyle(g), a.setItemGraphicEl(d, R), Xi(R, t), Un(R, $.get("focus"), $.get("blurScope"), $.get("disabled")); + } + this._layersSeries = l, this._layers = b; + }, e.type = "themeRiver", e; + }(en) +); +function uhe(r, e, t) { + var n = new Or({ + shape: { + x: r.x - 10, + y: r.y - 10, + width: 0, + height: r.height + 20 + } + }); + return An(n, { + shape: { + x: r.x - 50, + width: r.width + 100, + height: r.height + 20 + } + }, e, t), n; +} +const che = lhe; +var qw = 2, hhe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t) { + r.prototype.init.apply(this, arguments), this.legendVisualProvider = new dm(ft(this.getData, this), ft(this.getRawData, this)); + }, e.prototype.fixData = function(t) { + var n = t.length, i = {}, a = E1(t, function(f) { + return i.hasOwnProperty(f[0] + "") || (i[f[0] + ""] = -1), f[2]; + }), o = []; + a.buckets.each(function(f, v) { + o.push({ + name: v, + dataList: f + }); + }); + for (var s = o.length, l = 0; l < s; ++l) { + for (var u = o[l].name, c = 0; c < o[l].dataList.length; ++c) { + var h = o[l].dataList[c][0] + ""; + i[h] = l; + } + for (var h in i) + i.hasOwnProperty(h) && i[h] !== l && (i[h] = l, t[n] = [h, 0, u], n++); + } + return t; + }, e.prototype.getInitialData = function(t, n) { + for (var i = this.getReferringComponents("singleAxis", mi).models[0], a = i.get("type"), o = Jr(t.data, function(b) { + return b[2] !== void 0; + }), s = this.fixData(o || []), l = [], u = this.nameMap = xt(), c = 0, h = 0; h < s.length; ++h) + l.push(s[h][qw]), u.get(s[h][qw]) || (u.set(s[h][qw], c), c++); + var f = uv(s, { + coordDimensions: ["single"], + dimensionsDefine: [{ + name: "time", + type: L_(a) + }, { + name: "value", + type: "float" + }, { + name: "name", + type: "ordinal" + }], + encodeDefine: { + single: 0, + value: 1, + itemName: 2 + } + }).dimensions, v = new Ui(f, this); + return v.initData(s), v; + }, e.prototype.getLayerSeries = function() { + for (var t = this.getData(), n = t.count(), i = [], a = 0; a < n; ++a) + i[a] = a; + var o = t.mapDimension("single"), s = E1(i, function(u) { + return t.get("name", u); + }), l = []; + return s.buckets.each(function(u, c) { + u.sort(function(h, f) { + return t.get(o, h) - t.get(o, f); + }), l.push({ + name: c, + indices: u + }); + }), l; + }, e.prototype.getAxisTooltipData = function(t, n, i) { + We(t) || (t = t ? [t] : []); + for (var a = this.getData(), o = this.getLayerSeries(), s = [], l = o.length, u, c = 0; c < l; ++c) { + for (var h = Number.MAX_VALUE, f = -1, v = o[c].indices.length, b = 0; b < v; ++b) { + var w = a.get(t[0], o[c].indices[b]), p = Math.abs(w - n); + p <= h && (u = w, h = p, f = o[c].indices[b]); + } + s.push(f); + } + return { + dataIndices: s, + nestestValue: u + }; + }, e.prototype.formatTooltip = function(t, n, i) { + var a = this.getData(), o = a.getName(t), s = a.get(a.mapDimension("value"), t); + return Di("nameValue", { + name: o, + value: s + }); + }, e.type = "series.themeRiver", e.dependencies = ["singleAxis"], e.defaultOption = { + // zlevel: 0, + z: 2, + colorBy: "data", + coordinateSystem: "singleAxis", + // gap in axis's orthogonal orientation + boundaryGap: ["10%", "10%"], + // legendHoverLink: true, + singleAxisIndex: 0, + animationEasing: "linear", + label: { + margin: 4, + show: !0, + position: "left", + fontSize: 11 + }, + emphasis: { + label: { + show: !0 + } + } + }, e; + }(mn) +); +const fhe = hhe; +function dhe(r, e) { + r.eachSeriesByType("themeRiver", function(t) { + var n = t.getData(), i = t.coordinateSystem, a = {}, o = i.getRect(); + a.rect = o; + var s = t.get("boundaryGap"), l = i.getAxis(); + if (a.boundaryGap = s, l.orient === "horizontal") { + s[0] = ot(s[0], o.height), s[1] = ot(s[1], o.height); + var u = o.height - s[0] - s[1]; + NP(n, t, u); + } else { + s[0] = ot(s[0], o.width), s[1] = ot(s[1], o.width); + var c = o.width - s[0] - s[1]; + NP(n, t, c); + } + n.setLayout("layoutInfo", a); + }); +} +function NP(r, e, t) { + if (r.count()) + for (var n = e.coordinateSystem, i = e.getLayerSeries(), a = r.mapDimension("single"), o = r.mapDimension("value"), s = Ke(i, function(p) { + return Ke(p.indices, function(d) { + var m = n.dataToPoint(r.get(a, d)); + return m[1] = r.get(o, d), m; + }); + }), l = vhe(s), u = l.y0, c = t / l.max, h = i.length, f = i[0].indices.length, v, b = 0; b < f; ++b) { + v = u[b] * c, r.setItemLayout(i[0].indices[b], { + layerIndex: 0, + x: s[0][b][0], + y0: v, + y: s[0][b][1] * c + }); + for (var w = 1; w < h; ++w) + v += s[w - 1][b][1] * c, r.setItemLayout(i[w].indices[b], { + layerIndex: w, + x: s[w][b][0], + y0: v, + y: s[w][b][1] * c + }); + } +} +function vhe(r) { + for (var e = r.length, t = r[0].length, n = [], i = [], a = 0, o = 0; o < t; ++o) { + for (var s = 0, l = 0; l < e; ++l) + s += r[l][o][1]; + s > a && (a = s), n.push(s); + } + for (var u = 0; u < t; ++u) + i[u] = (a - n[u]) / 2; + a = 0; + for (var c = 0; c < t; ++c) { + var h = n[c] + i[c]; + h > a && (a = h); + } + return { + y0: i, + max: a + }; +} +function phe(r) { + r.registerChartView(che), r.registerSeriesModel(fhe), r.registerLayout(dhe), r.registerProcessor(fm("themeRiver")); +} +var ghe = 2, mhe = 4, yhe = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a) { + var o = r.call(this) || this; + o.z2 = ghe, o.textConfig = { + inside: !0 + }, Ft(o).seriesIndex = n.seriesIndex; + var s = new kr({ + z2: mhe, + silent: t.getModel().get(["label", "silent"]) + }); + return o.setTextContent(s), o.updateData(!0, t, n, i, a), o; + } + return e.prototype.updateData = function(t, n, i, a, o) { + this.node = n, n.piece = this, i = i || this._seriesModel, a = a || this._ecModel; + var s = this; + Ft(s).dataIndex = n.dataIndex; + var l = n.getModel(), u = l.getModel("emphasis"), c = n.getLayout(), h = Fe({}, c); + h.label = null; + var f = n.getVisual("style"); + f.lineJoin = "bevel"; + var v = n.getVisual("decal"); + v && (f.decal = Nd(v, o)); + var b = Oh(l.getModel("itemStyle"), h, !0); + Fe(h, b), X(ka, function(m) { + var _ = s.ensureState(m), y = l.getModel([m, "itemStyle"]); + _.style = y.getItemStyle(); + var x = Oh(y, h); + x && (_.shape = x); + }), t ? (s.setShape(h), s.shape.r = c.r0, An(s, { + shape: { + r: c.r + } + }, i, n.dataIndex)) : (zr(s, { + shape: h + }, i), Hs(s)), s.useStyle(f), this._updateLabel(i); + var w = l.getShallow("cursor"); + w && s.attr("cursor", w), this._seriesModel = i || this._seriesModel, this._ecModel = a || this._ecModel; + var p = u.get("focus"), d = p === "ancestor" ? n.getAncestorsIndices() : p === "descendant" ? n.getDescendantIndices() : p; + Un(this, d, u.get("blurScope"), u.get("disabled")); + }, e.prototype._updateLabel = function(t) { + var n = this, i = this.node.getModel(), a = i.getModel("label"), o = this.node.getLayout(), s = o.endAngle - o.startAngle, l = (o.startAngle + o.endAngle) / 2, u = Math.cos(l), c = Math.sin(l), h = this, f = h.getTextContent(), v = this.node.dataIndex, b = a.get("minAngle") / 180 * Math.PI, w = a.get("show") && !(b != null && Math.abs(s) < b); + f.ignore = !w, X(pg, function(d) { + var m = d === "normal" ? i.getModel("label") : i.getModel([d, "label"]), _ = d === "normal", y = _ ? f : f.ensureState(d), x = t.getFormattedLabel(v, d); + _ && (x = x || n.node.name), y.style = gn(m, {}, null, d !== "normal", !0), x && (y.style.text = x); + var g = m.get("show"); + g != null && !_ && (y.ignore = !g); + var S = p(m, "position"), T = _ ? h : h.states[d], C = T.style.fill; + T.textConfig = { + outsideFill: m.get("color") === "inherit" ? C : null, + inside: S !== "outside" + }; + var E, M = p(m, "distance") || 0, P = p(m, "align"); + S === "outside" ? (E = o.r + M, P = l > Math.PI / 2 ? "right" : "left") : !P || P === "center" ? (s === 2 * Math.PI && o.r0 === 0 ? E = 0 : E = (o.r + o.r0) / 2, P = "center") : P === "left" ? (E = o.r0 + M, l > Math.PI / 2 && (P = "right")) : P === "right" && (E = o.r - M, l > Math.PI / 2 && (P = "left")), y.style.align = P, y.style.verticalAlign = p(m, "verticalAlign") || "middle", y.x = E * u + o.cx, y.y = E * c + o.cy; + var R = p(m, "rotate"), N = 0; + R === "radial" ? (N = ks(-l), N > Math.PI / 2 && N < Math.PI * 1.5 && (N += Math.PI)) : R === "tangential" ? (N = Math.PI / 2 - l, N > Math.PI / 2 ? N -= Math.PI : N < -Math.PI / 2 && (N += Math.PI)) : Pr(R) && (N = R * Math.PI / 180), y.rotation = ks(N); + }); + function p(d, m) { + var _ = d.get(m); + return _ == null ? a.get(m) : _; + } + f.dirtyStyle(); + }, e; + }(Oa) +); +const zP = yhe; +var IT = "sunburstRootToNode", BP = "sunburstHighlight", _he = "sunburstUnhighlight"; +function bhe(r) { + r.registerAction({ + type: IT, + update: "updateView" + }, function(e, t) { + t.eachComponent({ + mainType: "series", + subType: "sunburst", + query: e + }, n); + function n(i, a) { + var o = Dg(e, [IT], i); + if (o) { + var s = i.getViewRoot(); + s && (e.direction = oE(s, o.node) ? "rollUp" : "drillDown"), i.resetViewRoot(o.node); + } + } + }), r.registerAction({ + type: BP, + update: "none" + }, function(e, t, n) { + e = Fe({}, e), t.eachComponent({ + mainType: "series", + subType: "sunburst", + query: e + }, i); + function i(a) { + var o = Dg(e, [BP], a); + o && (e.dataIndex = o.node.dataIndex); + } + n.dispatchAction(Fe(e, { + type: "highlight" + })); + }), r.registerAction({ + type: _he, + update: "updateView" + }, function(e, t, n) { + e = Fe({}, e), n.dispatchAction(Fe(e, { + type: "downplay" + })); + }); +} +var xhe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i, a) { + var o = this; + this.seriesModel = t, this.api = i, this.ecModel = n; + var s = t.getData(), l = s.tree.root, u = t.getViewRoot(), c = this.group, h = t.get("renderLabelForZeroData"), f = []; + u.eachNode(function(m) { + f.push(m); + }); + var v = this._oldChildren || []; + b(f, v), d(l, u), this._initEvents(), this._oldChildren = f; + function b(m, _) { + if (m.length === 0 && _.length === 0) + return; + new nu(_, m, y, y).add(x).update(x).remove(jt(x, null)).execute(); + function y(g) { + return g.getId(); + } + function x(g, S) { + var T = g == null ? null : m[g], C = S == null ? null : _[S]; + w(T, C); + } + } + function w(m, _) { + if (!h && m && !m.getValue() && (m = null), m !== l && _ !== l) { + if (_ && _.piece) + m ? (_.piece.updateData(!1, m, t, n, i), s.setItemGraphicEl(m.dataIndex, _.piece)) : p(_); + else if (m) { + var y = new zP(m, t, n, i); + c.add(y), s.setItemGraphicEl(m.dataIndex, y); + } + } + } + function p(m) { + m && m.piece && (c.remove(m.piece), m.piece = null); + } + function d(m, _) { + _.depth > 0 ? (o.virtualPiece ? o.virtualPiece.updateData(!1, m, t, n, i) : (o.virtualPiece = new zP(m, t, n, i), c.add(o.virtualPiece)), _.piece.off("click"), o.virtualPiece.on("click", function(y) { + o._rootToNode(_.parentNode); + })) : o.virtualPiece && (c.remove(o.virtualPiece), o.virtualPiece = null); + } + }, e.prototype._initEvents = function() { + var t = this; + this.group.off("click"), this.group.on("click", function(n) { + var i = !1, a = t.seriesModel.getViewRoot(); + a.eachNode(function(o) { + if (!i && o.piece && o.piece === n.target) { + var s = o.getModel().get("nodeClick"); + if (s === "rootToNode") + t._rootToNode(o); + else if (s === "link") { + var l = o.getModel(), u = l.get("link"); + if (u) { + var c = l.get("target", !0) || "_blank"; + w_(u, c); + } + } + i = !0; + } + }); + }); + }, e.prototype._rootToNode = function(t) { + t !== this.seriesModel.getViewRoot() && this.api.dispatchAction({ + type: IT, + from: this.uid, + seriesId: this.seriesModel.id, + targetNode: t + }); + }, e.prototype.containPoint = function(t, n) { + var i = n.getData(), a = i.getItemLayout(0); + if (a) { + var o = t[0] - a.cx, s = t[1] - a.cy, l = Math.sqrt(o * o + s * s); + return l <= a.r && l >= a.r0; + } + }, e.type = "sunburst", e; + }(en) +); +const She = xhe; +var whe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.ignoreStyleOnData = !0, t; + } + return e.prototype.getInitialData = function(t, n) { + var i = { + name: t.name, + children: t.data + }; + E3(i); + var a = this._levelModels = Ke(t.levels || [], function(l) { + return new qr(l, this, n); + }, this), o = aE.createTree(i, this, s); + function s(l) { + l.wrapMethod("getItemModel", function(u, c) { + var h = o.getNodeByDataIndex(c), f = a[h.depth]; + return f && (u.parentModel = f), u; + }); + } + return o.data; + }, e.prototype.optionUpdated = function() { + this.resetViewRoot(); + }, e.prototype.getDataParams = function(t) { + var n = r.prototype.getDataParams.apply(this, arguments), i = this.getData().tree.getNodeByDataIndex(t); + return n.treePathInfo = hx(i, this), n; + }, e.prototype.getLevelModel = function(t) { + return this._levelModels && this._levelModels[t.depth]; + }, e.prototype.getViewRoot = function() { + return this._viewRoot; + }, e.prototype.resetViewRoot = function(t) { + t ? this._viewRoot = t : t = this._viewRoot; + var n = this.getRawData().tree.root; + (!t || t !== n && !n.contains(t)) && (this._viewRoot = n); + }, e.prototype.enableAriaDecal = function() { + OH(this); + }, e.type = "series.sunburst", e.defaultOption = { + // zlevel: 0, + z: 2, + // 默认全局居中 + center: ["50%", "50%"], + radius: [0, "75%"], + // 默认顺时针 + clockwise: !0, + startAngle: 90, + // 最小角度改为0 + minAngle: 0, + // If still show when all data zero. + stillShowZeroSum: !0, + // 'rootToNode', 'link', or false + nodeClick: "rootToNode", + renderLabelForZeroData: !1, + label: { + // could be: 'radial', 'tangential', or 'none' + rotate: "radial", + show: !0, + opacity: 1, + // 'left' is for inner side of inside, and 'right' is for outer + // side for inside + align: "center", + position: "inside", + distance: 5, + silent: !0 + }, + itemStyle: { + borderWidth: 1, + borderColor: "white", + borderType: "solid", + shadowBlur: 0, + shadowColor: "rgba(0, 0, 0, 0.2)", + shadowOffsetX: 0, + shadowOffsetY: 0, + opacity: 1 + }, + emphasis: { + focus: "descendant" + }, + blur: { + itemStyle: { + opacity: 0.2 + }, + label: { + opacity: 0.1 + } + }, + // Animation type can be expansion, scale. + animationType: "expansion", + animationDuration: 1e3, + animationDurationUpdate: 500, + data: [], + /** + * Sort order. + * + * Valid values: 'desc', 'asc', null, or callback function. + * 'desc' and 'asc' for descend and ascendant order; + * null for not sorting; + * example of callback function: + * function(nodeA, nodeB) { + * return nodeA.getValue() - nodeB.getValue(); + * } + */ + sort: "desc" + }, e; + }(mn) +); +function E3(r) { + var e = 0; + X(r.children, function(n) { + E3(n); + var i = n.value; + We(i) && (i = i[0]), e += i; + }); + var t = r.value; + We(t) && (t = t[0]), (t == null || isNaN(t)) && (t = e), t < 0 && (t = 0), We(r.value) ? r.value[0] = t : r.value = t; +} +const Che = whe; +var jP = Math.PI / 180; +function The(r, e, t) { + e.eachSeriesByType(r, function(n) { + var i = n.get("center"), a = n.get("radius"); + We(a) || (a = [0, a]), We(i) || (i = [i, i]); + var o = t.getWidth(), s = t.getHeight(), l = Math.min(o, s), u = ot(i[0], o), c = ot(i[1], s), h = ot(a[0], l / 2), f = ot(a[1], l / 2), v = -n.get("startAngle") * jP, b = n.get("minAngle") * jP, w = n.getData().tree.root, p = n.getViewRoot(), d = p.depth, m = n.get("sort"); + m != null && M3(p, m); + var _ = 0; + X(p.children, function(U) { + !isNaN(U.getValue()) && _++; + }); + var y = p.getValue(), x = Math.PI / (y || _) * 2, g = p.depth > 0, S = p.height - (g ? -1 : 1), T = (f - h) / (S || 1), C = n.get("clockwise"), E = n.get("stillShowZeroSum"), M = C ? 1 : -1, P = function(U, $) { + if (U) { + var G = $; + if (U !== w) { + var Q = U.getValue(), ee = y === 0 && E ? x : Q * x; + ee < b && (ee = b), G = $ + M * ee; + var ce = U.depth - d - (g ? -1 : 1), ne = h + T * ce, fe = h + T * (ce + 1), K = n.getLevelModel(U); + if (K) { + var Oe = K.get("r0", !0), xe = K.get("r", !0), Ge = K.get("radius", !0); + Ge != null && (Oe = Ge[0], xe = Ge[1]), Oe != null && (ne = ot(Oe, l / 2)), xe != null && (fe = ot(xe, l / 2)); + } + U.setLayout({ + angle: ee, + startAngle: $, + endAngle: G, + clockwise: C, + cx: u, + cy: c, + r0: ne, + r: fe + }); + } + if (U.children && U.children.length) { + var oe = 0; + X(U.children, function(de) { + oe += P(de, $ + oe); + }); + } + return G - $; + } + }; + if (g) { + var R = h, N = h + T, F = Math.PI * 2; + w.setLayout({ + angle: F, + startAngle: v, + endAngle: v + F, + clockwise: C, + cx: u, + cy: c, + r0: R, + r: N + }); + } + P(p, v); + }); +} +function M3(r, e) { + var t = r.children || []; + r.children = Ihe(t, e), t.length && X(r.children, function(n) { + M3(n, e); + }); +} +function Ihe(r, e) { + if (Tt(e)) { + var t = Ke(r, function(i, a) { + var o = i.getValue(); + return { + params: { + depth: i.depth, + height: i.height, + dataIndex: i.dataIndex, + getValue: function() { + return o; + } + }, + index: a + }; + }); + return t.sort(function(i, a) { + return e(i.params, a.params); + }), Ke(t, function(i) { + return r[i.index]; + }); + } else { + var n = e === "asc"; + return r.sort(function(i, a) { + var o = (i.getValue() - a.getValue()) * (n ? 1 : -1); + return o === 0 ? (i.dataIndex - a.dataIndex) * (n ? -1 : 1) : o; + }); + } +} +function Ahe(r) { + var e = {}; + function t(n, i, a) { + for (var o = n; o && o.depth > 1; ) + o = o.parentNode; + var s = i.getColorFromPalette(o.name || o.dataIndex + "", e); + return n.depth > 1 && ut(s) && (s = f_(s, (n.depth - 1) / (a - 1) * 0.5)), s; + } + r.eachSeriesByType("sunburst", function(n) { + var i = n.getData(), a = i.tree; + a.eachNode(function(o) { + var s = o.getModel(), l = s.getModel("itemStyle").getItemStyle(); + l.fill || (l.fill = t(o, n, a.root.height)); + var u = i.ensureUniqueItemVisual(o.dataIndex, "style"); + Fe(u, l); + }); + }); +} +function Ehe(r) { + r.registerChartView(She), r.registerSeriesModel(Che), r.registerLayout(jt(The, "sunburst")), r.registerProcessor(jt(fm, "sunburst")), r.registerVisual(Ahe), bhe(r); +} +var FP = { + color: "fill", + borderColor: "stroke" +}, Mhe = { + symbol: 1, + symbolSize: 1, + symbolKeepAspect: 1, + legendIcon: 1, + visualMeta: 1, + liftZ: 1, + decal: 1 +}, Jl = Rr(), Dhe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.optionUpdated = function() { + this.currentZLevel = this.get("zlevel", !0), this.currentZ = this.get("z", !0); + }, e.prototype.getInitialData = function(t, n) { + return Dl(null, this); + }, e.prototype.getDataParams = function(t, n, i) { + var a = r.prototype.getDataParams.call(this, t, n); + return i && (a.info = Jl(i).info), a; + }, e.type = "series.custom", e.dependencies = ["grid", "polar", "geo", "singleAxis", "calendar"], e.defaultOption = { + coordinateSystem: "cartesian2d", + // zlevel: 0, + z: 2, + legendHoverLink: !0, + // Custom series will not clip by default. + // Some case will use custom series to draw label + // For example https://echarts.apache.org/examples/en/editor.html?c=custom-gantt-flight + clip: !1 + // Cartesian coordinate system + // xAxisIndex: 0, + // yAxisIndex: 0, + // Polar coordinate system + // polarIndex: 0, + // Geo coordinate system + // geoIndex: 0, + }, e; + }(mn) +); +const khe = Dhe; +function Ohe(r, e) { + return e = e || [0, 0], Ke(["x", "y"], function(t, n) { + var i = this.getAxis(t), a = e[n], o = r[n] / 2; + return i.type === "category" ? i.getBandWidth() : Math.abs(i.dataToCoord(a - o) - i.dataToCoord(a + o)); + }, this); +} +function Lhe(r) { + var e = r.master.getRect(); + return { + coordSys: { + // The name exposed to user is always 'cartesian2d' but not 'grid'. + type: "cartesian2d", + x: e.x, + y: e.y, + width: e.width, + height: e.height + }, + api: { + coord: function(t) { + return r.dataToPoint(t); + }, + size: ft(Ohe, r) + } + }; +} +function Phe(r, e) { + return e = e || [0, 0], Ke([0, 1], function(t) { + var n = e[t], i = r[t] / 2, a = [], o = []; + return a[t] = n - i, o[t] = n + i, a[1 - t] = o[1 - t] = e[1 - t], Math.abs(this.dataToPoint(a)[t] - this.dataToPoint(o)[t]); + }, this); +} +function Rhe(r) { + var e = r.getBoundingRect(); + return { + coordSys: { + type: "geo", + x: e.x, + y: e.y, + width: e.width, + height: e.height, + zoom: r.getZoom() + }, + api: { + coord: function(t) { + return r.dataToPoint(t); + }, + size: ft(Phe, r) + } + }; +} +function Nhe(r, e) { + var t = this.getAxis(), n = e instanceof Array ? e[0] : e, i = (r instanceof Array ? r[0] : r) / 2; + return t.type === "category" ? t.getBandWidth() : Math.abs(t.dataToCoord(n - i) - t.dataToCoord(n + i)); +} +function zhe(r) { + var e = r.getRect(); + return { + coordSys: { + type: "singleAxis", + x: e.x, + y: e.y, + width: e.width, + height: e.height + }, + api: { + coord: function(t) { + return r.dataToPoint(t); + }, + size: ft(Nhe, r) + } + }; +} +function Bhe(r, e) { + return e = e || [0, 0], Ke(["Radius", "Angle"], function(t, n) { + var i = "get" + t + "Axis", a = this[i](), o = e[n], s = r[n] / 2, l = a.type === "category" ? a.getBandWidth() : Math.abs(a.dataToCoord(o - s) - a.dataToCoord(o + s)); + return t === "Angle" && (l = l * Math.PI / 180), l; + }, this); +} +function jhe(r) { + var e = r.getRadiusAxis(), t = r.getAngleAxis(), n = e.getExtent(); + return n[0] > n[1] && n.reverse(), { + coordSys: { + type: "polar", + cx: r.cx, + cy: r.cy, + r: n[1], + r0: n[0] + }, + api: { + coord: function(i) { + var a = e.dataToRadius(i[0]), o = t.dataToAngle(i[1]), s = r.coordToPoint([a, o]); + return s.push(a, o * Math.PI / 180), s; + }, + size: ft(Bhe, r) + } + }; +} +function Fhe(r) { + var e = r.getRect(), t = r.getRangeInfo(); + return { + coordSys: { + type: "calendar", + x: e.x, + y: e.y, + width: e.width, + height: e.height, + cellWidth: r.getCellWidth(), + cellHeight: r.getCellHeight(), + rangeInfo: { + start: t.start, + end: t.end, + weeks: t.weeks, + dayCount: t.allDay + } + }, + api: { + coord: function(n, i) { + return r.dataToPoint(n, i); + } + } + }; +} +function D3(r, e, t, n) { + return r && (r.legacy || r.legacy !== !1 && !t && !n && e !== "tspan" && (e === "text" || gt(r, "text"))); +} +function k3(r, e, t) { + var n = r, i, a, o; + if (e === "text") + o = n; + else { + o = {}, gt(n, "text") && (o.text = n.text), gt(n, "rich") && (o.rich = n.rich), gt(n, "textFill") && (o.fill = n.textFill), gt(n, "textStroke") && (o.stroke = n.textStroke), gt(n, "fontFamily") && (o.fontFamily = n.fontFamily), gt(n, "fontSize") && (o.fontSize = n.fontSize), gt(n, "fontStyle") && (o.fontStyle = n.fontStyle), gt(n, "fontWeight") && (o.fontWeight = n.fontWeight), a = { + type: "text", + style: o, + // ec4 does not support rectText trigger. + // And when text position is different in normal and emphasis + // => hover text trigger emphasis; + // => text position changed, leave mouse pointer immediately; + // That might cause incorrect state. + silent: !0 + }, i = {}; + var s = gt(n, "textPosition"); + t ? i.position = s ? n.textPosition : "inside" : s && (i.position = n.textPosition), gt(n, "textPosition") && (i.position = n.textPosition), gt(n, "textOffset") && (i.offset = n.textOffset), gt(n, "textRotation") && (i.rotation = n.textRotation), gt(n, "textDistance") && (i.distance = n.textDistance); + } + return $P(o, r), X(o.rich, function(l) { + $P(l, l); + }), { + textConfig: i, + textContent: a + }; +} +function $P(r, e) { + e && (e.font = e.textFont || e.font, gt(e, "textStrokeWidth") && (r.lineWidth = e.textStrokeWidth), gt(e, "textAlign") && (r.align = e.textAlign), gt(e, "textVerticalAlign") && (r.verticalAlign = e.textVerticalAlign), gt(e, "textLineHeight") && (r.lineHeight = e.textLineHeight), gt(e, "textWidth") && (r.width = e.textWidth), gt(e, "textHeight") && (r.height = e.textHeight), gt(e, "textBackgroundColor") && (r.backgroundColor = e.textBackgroundColor), gt(e, "textPadding") && (r.padding = e.textPadding), gt(e, "textBorderColor") && (r.borderColor = e.textBorderColor), gt(e, "textBorderWidth") && (r.borderWidth = e.textBorderWidth), gt(e, "textBorderRadius") && (r.borderRadius = e.textBorderRadius), gt(e, "textBoxShadowColor") && (r.shadowColor = e.textBoxShadowColor), gt(e, "textBoxShadowBlur") && (r.shadowBlur = e.textBoxShadowBlur), gt(e, "textBoxShadowOffsetX") && (r.shadowOffsetX = e.textBoxShadowOffsetX), gt(e, "textBoxShadowOffsetY") && (r.shadowOffsetY = e.textBoxShadowOffsetY)); +} +function HP(r, e, t) { + var n = r; + n.textPosition = n.textPosition || t.position || "inside", t.offset != null && (n.textOffset = t.offset), t.rotation != null && (n.textRotation = t.rotation), t.distance != null && (n.textDistance = t.distance); + var i = n.textPosition.indexOf("inside") >= 0, a = r.fill || "#000"; + VP(n, e); + var o = n.textFill == null; + return i ? o && (n.textFill = t.insideFill || "#fff", !n.textStroke && t.insideStroke && (n.textStroke = t.insideStroke), !n.textStroke && (n.textStroke = a), n.textStrokeWidth == null && (n.textStrokeWidth = 2)) : (o && (n.textFill = r.fill || t.outsideFill || "#000"), !n.textStroke && t.outsideStroke && (n.textStroke = t.outsideStroke)), n.text = e.text, n.rich = e.rich, X(e.rich, function(s) { + VP(s, s); + }), n; +} +function VP(r, e) { + e && (gt(e, "fill") && (r.textFill = e.fill), gt(e, "stroke") && (r.textStroke = e.fill), gt(e, "lineWidth") && (r.textStrokeWidth = e.lineWidth), gt(e, "font") && (r.font = e.font), gt(e, "fontStyle") && (r.fontStyle = e.fontStyle), gt(e, "fontWeight") && (r.fontWeight = e.fontWeight), gt(e, "fontSize") && (r.fontSize = e.fontSize), gt(e, "fontFamily") && (r.fontFamily = e.fontFamily), gt(e, "align") && (r.textAlign = e.align), gt(e, "verticalAlign") && (r.textVerticalAlign = e.verticalAlign), gt(e, "lineHeight") && (r.textLineHeight = e.lineHeight), gt(e, "width") && (r.textWidth = e.width), gt(e, "height") && (r.textHeight = e.height), gt(e, "backgroundColor") && (r.textBackgroundColor = e.backgroundColor), gt(e, "padding") && (r.textPadding = e.padding), gt(e, "borderColor") && (r.textBorderColor = e.borderColor), gt(e, "borderWidth") && (r.textBorderWidth = e.borderWidth), gt(e, "borderRadius") && (r.textBorderRadius = e.borderRadius), gt(e, "shadowColor") && (r.textBoxShadowColor = e.shadowColor), gt(e, "shadowBlur") && (r.textBoxShadowBlur = e.shadowBlur), gt(e, "shadowOffsetX") && (r.textBoxShadowOffsetX = e.shadowOffsetX), gt(e, "shadowOffsetY") && (r.textBoxShadowOffsetY = e.shadowOffsetY), gt(e, "textShadowColor") && (r.textShadowColor = e.textShadowColor), gt(e, "textShadowBlur") && (r.textShadowBlur = e.textShadowBlur), gt(e, "textShadowOffsetX") && (r.textShadowOffsetX = e.textShadowOffsetX), gt(e, "textShadowOffsetY") && (r.textShadowOffsetY = e.textShadowOffsetY)); +} +var O3 = { + position: ["x", "y"], + scale: ["scaleX", "scaleY"], + origin: ["originX", "originY"] +}, GP = yr(O3); +es(Tl, function(r, e) { + return r[e] = 1, r; +}, {}); +Tl.join(", "); +var W_ = ["", "style", "shape", "extra"], Fd = Rr(); +function SE(r, e, t, n, i) { + var a = r + "Animation", o = Kd(r, n, i) || {}, s = Fd(e).userDuring; + return o.duration > 0 && (o.during = s ? ft(Uhe, { + el: e, + userDuring: s + }) : null, o.setToFinal = !0, o.scope = r), Fe(o, t[a]), o; +} +function W0(r, e, t, n) { + n = n || {}; + var i = n.dataIndex, a = n.isInit, o = n.clearStyle, s = t.isAnimationEnabled(), l = Fd(r), u = e.style; + l.userDuring = e.during; + var c = {}, h = {}; + if (Yhe(r, e, h), WP("shape", e, h), WP("extra", e, h), !a && s && (Whe(r, e, c), UP("shape", r, e, c), UP("extra", r, e, c), Xhe(r, e, u, c)), h.style = u, $he(r, h, o), Vhe(r, e), s) + if (a) { + var f = {}; + X(W_, function(b) { + var w = b ? e[b] : e; + w && w.enterFrom && (b && (f[b] = f[b] || {}), Fe(b ? f[b] : f, w.enterFrom)); + }); + var v = SE("enter", r, e, t, i); + v.duration > 0 && r.animateFrom(f, v); + } else + Hhe(r, e, i || 0, t, c); + L3(r, e), u ? r.dirty() : r.markRedraw(); +} +function L3(r, e) { + for (var t = Fd(r).leaveToProps, n = 0; n < W_.length; n++) { + var i = W_[n], a = i ? e[i] : e; + a && a.leaveTo && (t || (t = Fd(r).leaveToProps = {}), i && (t[i] = t[i] || {}), Fe(i ? t[i] : t, a.leaveTo)); + } +} +function vx(r, e, t, n) { + if (r) { + var i = r.parent, a = Fd(r).leaveToProps; + if (a) { + var o = SE("update", r, e, t, 0); + o.done = function() { + i.remove(r), n && n(); + }, r.animateTo(a, o); + } else + i.remove(r), n && n(); + } +} +function Fh(r) { + return r === "all"; +} +function $he(r, e, t) { + var n = e.style; + if (!r.isGroup && n) { + if (t) { + r.useStyle({}); + for (var i = r.animators, a = 0; a < i.length; a++) { + var o = i[a]; + o.targetName === "style" && o.changeTarget(r.style); + } + } + r.setStyle(n); + } + e && (e.style = null, e && r.attr(e), e.style = n); +} +function Hhe(r, e, t, n, i) { + if (i) { + var a = SE("update", r, e, n, t); + a.duration > 0 && r.animateFrom(i, a); + } +} +function Vhe(r, e) { + gt(e, "silent") && (r.silent = e.silent), gt(e, "ignore") && (r.ignore = e.ignore), r instanceof ts && gt(e, "invisible") && (r.invisible = e.invisible), r instanceof hr && gt(e, "autoBatch") && (r.autoBatch = e.autoBatch); +} +var cl = {}, Ghe = { + // Usually other props do not need to be changed in animation during. + setTransform: function(r, e) { + return cl.el[r] = e, this; + }, + getTransform: function(r) { + return cl.el[r]; + }, + setShape: function(r, e) { + var t = cl.el, n = t.shape || (t.shape = {}); + return n[r] = e, t.dirtyShape && t.dirtyShape(), this; + }, + getShape: function(r) { + var e = cl.el.shape; + if (e) + return e[r]; + }, + setStyle: function(r, e) { + var t = cl.el, n = t.style; + return n && (n[r] = e, t.dirtyStyle && t.dirtyStyle()), this; + }, + getStyle: function(r) { + var e = cl.el.style; + if (e) + return e[r]; + }, + setExtra: function(r, e) { + var t = cl.el.extra || (cl.el.extra = {}); + return t[r] = e, this; + }, + getExtra: function(r) { + var e = cl.el.extra; + if (e) + return e[r]; + } +}; +function Uhe() { + var r = this, e = r.el; + if (e) { + var t = Fd(e).userDuring, n = r.userDuring; + if (t !== n) { + r.el = r.userDuring = null; + return; + } + cl.el = e, n(Ghe); + } +} +function UP(r, e, t, n) { + var i = t[r]; + if (i) { + var a = e[r], o; + if (a) { + var s = t.transition, l = i.transition; + if (l) + if (!o && (o = n[r] = {}), Fh(l)) + Fe(o, a); + else + for (var u = ln(l), c = 0; c < u.length; c++) { + var h = u[c], f = a[h]; + o[h] = f; + } + else if (Fh(s) || ir(s, r) >= 0) { + !o && (o = n[r] = {}); + for (var v = yr(a), c = 0; c < v.length; c++) { + var h = v[c], f = a[h]; + Zhe(i[h], f) && (o[h] = f); + } + } + } + } +} +function WP(r, e, t) { + var n = e[r]; + if (n) + for (var i = t[r] = {}, a = yr(n), o = 0; o < a.length; o++) { + var s = a[o]; + i[s] = Fp(n[s]); + } +} +function Whe(r, e, t) { + for (var n = e.transition, i = Fh(n) ? Tl : ln(n || []), a = 0; a < i.length; a++) { + var o = i[a]; + if (!(o === "style" || o === "shape" || o === "extra")) { + var s = r[o]; + t[o] = s; + } + } +} +function Yhe(r, e, t) { + for (var n = 0; n < GP.length; n++) { + var i = GP[n], a = O3[i], o = e[i]; + o && (t[a[0]] = o[0], t[a[1]] = o[1]); + } + for (var n = 0; n < Tl.length; n++) { + var s = Tl[n]; + e[s] != null && (t[s] = e[s]); + } +} +function Xhe(r, e, t, n) { + if (t) { + var i = r.style, a; + if (i) { + var o = t.transition, s = e.transition; + if (o && !Fh(o)) { + var l = ln(o); + !a && (a = n.style = {}); + for (var u = 0; u < l.length; u++) { + var c = l[u], h = i[c]; + a[c] = h; + } + } else if (r.getAnimationStyleProps && (Fh(s) || Fh(o) || ir(s, "style") >= 0)) { + var f = r.getAnimationStyleProps(), v = f ? f.style : null; + if (v) { + !a && (a = n.style = {}); + for (var b = yr(t), u = 0; u < b.length; u++) { + var c = b[u]; + if (v[c]) { + var h = i[c]; + a[c] = h; + } + } + } + } + } + } +} +function Zhe(r, e) { + return Yi(r) ? r !== e : r != null && isFinite(r); +} +var P3 = Rr(), Jhe = ["percent", "easing", "shape", "style", "extra"]; +function R3(r) { + r.stopAnimation("keyframe"), r.attr(P3(r)); +} +function Y_(r, e, t) { + if (!(!t.isAnimationEnabled() || !e)) { + if (We(e)) { + X(e, function(s) { + Y_(r, s, t); + }); + return; + } + var n = e.keyframes, i = e.duration; + if (t && i == null) { + var a = Kd("enter", t, 0); + i = a && a.duration; + } + if (!(!n || !i)) { + var o = P3(r); + X(W_, function(s) { + if (!(s && !r[s])) { + var l; + n.sort(function(u, c) { + return u.percent - c.percent; + }), X(n, function(u) { + var c = r.animators, h = s ? u[s] : u; + if (h) { + var f = yr(h); + if (s || (f = Jr(f, function(w) { + return ir(Jhe, w) < 0; + })), !!f.length) { + l || (l = r.animate(s, e.loop, !0), l.scope = "keyframe"); + for (var v = 0; v < c.length; v++) + c[v] !== l && c[v].targetName === l.targetName && c[v].stopTracks(f); + s && (o[s] = o[s] || {}); + var b = s ? o[s] : o; + X(f, function(w) { + b[w] = ((s ? r[s] : r) || {})[w]; + }), l.whenWithKeys(i * u.percent, h, f, u.easing); + } + } + }), l && l.delay(e.delay || 0).duration(i).start(e.easing); + } + }); + } + } +} +var Kl = "emphasis", Qu = "normal", wE = "blur", CE = "select", mc = [Qu, Kl, wE, CE], eC = { + normal: ["itemStyle"], + emphasis: [Kl, "itemStyle"], + blur: [wE, "itemStyle"], + select: [CE, "itemStyle"] +}, tC = { + normal: ["label"], + emphasis: [Kl, "label"], + blur: [wE, "label"], + select: [CE, "label"] +}, Khe = ["x", "y"], Qhe = "e\0\0", Ho = { + normal: {}, + emphasis: {}, + blur: {}, + select: {} +}, qhe = { + cartesian2d: Lhe, + geo: Rhe, + single: zhe, + polar: jhe, + calendar: Fhe +}; +function AT(r) { + return r instanceof hr; +} +function ET(r) { + return r instanceof ts; +} +function efe(r, e) { + e.copyTransform(r), ET(e) && ET(r) && (e.setStyle(r.style), e.z = r.z, e.z2 = r.z2, e.zlevel = r.zlevel, e.invisible = r.invisible, e.ignore = r.ignore, AT(e) && AT(r) && e.setShape(r.shape)); +} +var tfe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i, a) { + this._progressiveEls = null; + var o = this._data, s = t.getData(), l = this.group, u = YP(t, s, n, i); + o || l.removeAll(), s.diff(o).add(function(h) { + rC(i, null, h, u(h, a), t, l, s); + }).remove(function(h) { + var f = o.getItemGraphicEl(h); + f && vx(f, Jl(f).option, t); + }).update(function(h, f) { + var v = o.getItemGraphicEl(f); + rC(i, v, h, u(h, a), t, l, s); + }).execute(); + var c = t.get("clip", !0) ? lx(t.coordinateSystem, !1, t) : null; + c ? l.setClipPath(c) : l.removeClipPath(), this._data = s; + }, e.prototype.incrementalPrepareRender = function(t, n, i) { + this.group.removeAll(), this._data = null; + }, e.prototype.incrementalRender = function(t, n, i, a, o) { + var s = n.getData(), l = YP(n, s, i, a), u = this._progressiveEls = []; + function c(v) { + v.isGroup || (v.incremental = !0, v.ensureState("emphasis").hoverLayer = !0); + } + for (var h = t.start; h < t.end; h++) { + var f = rC(null, null, h, l(h, o), n, this.group, s); + f && (f.traverse(c), u.push(f)); + } + }, e.prototype.eachRendered = function(t) { + Cc(this._progressiveEls || this.group, t); + }, e.prototype.filterForExposedEvent = function(t, n, i, a) { + var o = n.element; + if (o == null || i.name === o) + return !0; + for (; (i = i.__hostTarget || i.parent) && i !== this.group; ) + if (i.name === o) + return !0; + return !1; + }, e.type = "custom", e; + }(en) +); +const rfe = tfe; +function TE(r) { + var e = r.type, t; + if (e === "path") { + var n = r.shape, i = n.width != null && n.height != null ? { + x: n.x || 0, + y: n.y || 0, + width: n.width, + height: n.height + } : null, a = B3(n); + t = em(a, null, i, n.layout || "center"), Jl(t).customPathData = a; + } else if (e === "image") + t = new ji({}), Jl(t).customImagePath = r.style.image; + else if (e === "text") + t = new kr({}); + else if (e === "group") + t = new Rt(); + else { + if (e === "compoundPath") + throw new Error('"compoundPath" is not supported yet.'); + var o = Fb(e); + if (!o) { + var s = ""; + Ur(s); + } + t = new o(); + } + return Jl(t).customGraphicType = e, t.name = r.name, t.z2EmphasisLift = 1, t.z2SelectLift = 1, t; +} +function IE(r, e, t, n, i, a, o) { + R3(e); + var s = i && i.normal.cfg; + s && e.setTextConfig(s), n && n.transition == null && (n.transition = Khe); + var l = n && n.style; + if (l) { + if (e.type === "text") { + var u = l; + gt(u, "textFill") && (u.fill = u.textFill), gt(u, "textStroke") && (u.stroke = u.textStroke); + } + var c = void 0, h = AT(e) ? l.decal : null; + r && h && (h.dirty = !0, c = Nd(h, r)), l.__decalPattern = c; + } + if (ET(e) && l) { + var c = l.__decalPattern; + c && (l.decal = c); + } + W0(e, n, a, { + dataIndex: t, + isInit: o, + clearStyle: !0 + }), Y_(e, n.keyframeAnimation, a); +} +function N3(r, e, t, n, i) { + var a = e.isGroup ? null : e, o = i && i[r].cfg; + if (a) { + var s = a.ensureState(r); + if (n === !1) { + var l = a.getState(r); + l && (l.style = null); + } else + s.style = n || null; + o && (s.textConfig = o), Yh(a); + } +} +function nfe(r, e, t) { + if (!r.isGroup) { + var n = r, i = t.currentZ, a = t.currentZLevel; + n.z = i, n.zlevel = a; + var o = e.z2; + o != null && (n.z2 = o || 0); + for (var s = 0; s < mc.length; s++) + ife(n, e, mc[s]); + } +} +function ife(r, e, t) { + var n = t === Qu, i = n ? e : X_(e, t), a = i ? i.z2 : null, o; + a != null && (o = n ? r : r.ensureState(t), o.z2 = a || 0); +} +function YP(r, e, t, n) { + var i = r.get("renderItem"), a = r.coordinateSystem, o = {}; + a && (o = a.prepareCustoms ? a.prepareCustoms(a) : qhe[a.type](a)); + for (var s = Mt({ + getWidth: n.getWidth, + getHeight: n.getHeight, + getZr: n.getZr, + getDevicePixelRatio: n.getDevicePixelRatio, + value: y, + style: g, + ordinalRawValue: x, + styleEmphasis: S, + visual: E, + barLayout: M, + currentSeriesIndices: P, + font: R + }, o.api || {}), l = { + // The life cycle of context: current round of rendering. + // The global life cycle is probably not necessary, because + // user can store global status by themselves. + context: {}, + seriesId: r.id, + seriesName: r.name, + seriesIndex: r.seriesIndex, + coordSys: o.coordSys, + dataInsideLength: e.count(), + encode: afe(r.getData()) + }, u, c, h = {}, f = {}, v = {}, b = {}, w = 0; w < mc.length; w++) { + var p = mc[w]; + v[p] = r.getModel(eC[p]), b[p] = r.getModel(tC[p]); + } + function d(N) { + return N === u ? c || (c = e.getItemModel(N)) : e.getItemModel(N); + } + function m(N, F) { + return e.hasItemOption ? N === u ? h[F] || (h[F] = d(N).getModel(eC[F])) : d(N).getModel(eC[F]) : v[F]; + } + function _(N, F) { + return e.hasItemOption ? N === u ? f[F] || (f[F] = d(N).getModel(tC[F])) : d(N).getModel(tC[F]) : b[F]; + } + return function(N, F) { + return u = N, c = null, h = {}, f = {}, i && i(Mt({ + dataIndexInside: N, + dataIndex: e.getRawIndex(N), + // Can be used for optimization when zoom or roam. + actionType: F ? F.type : null + }, l), s); + }; + function y(N, F) { + return F == null && (F = u), e.getStore().get(e.getDimensionIndex(N || 0), F); + } + function x(N, F) { + F == null && (F = u), N = N || 0; + var U = e.getDimensionInfo(N); + if (!U) { + var $ = e.getDimensionIndex(N); + return $ >= 0 ? e.getStore().get($, F) : void 0; + } + var G = e.get(U.name, F), Q = U && U.ordinalMeta; + return Q ? Q.categories[G] : G; + } + function g(N, F) { + F == null && (F = u); + var U = e.getItemVisual(F, "style"), $ = U && U.fill, G = U && U.opacity, Q = m(F, Qu).getItemStyle(); + $ != null && (Q.fill = $), G != null && (Q.opacity = G); + var ee = { + inheritColor: ut($) ? $ : "#000" + }, ce = _(F, Qu), ne = gn(ce, null, ee, !1, !0); + ne.text = ce.getShallow("show") ? Jt(r.getFormattedLabel(F, Qu), zd(e, F)) : null; + var fe = x_(ce, ee, !1); + return C(N, Q), Q = HP(Q, ne, fe), N && T(Q, N), Q.legacy = !0, Q; + } + function S(N, F) { + F == null && (F = u); + var U = m(F, Kl).getItemStyle(), $ = _(F, Kl), G = gn($, null, null, !0, !0); + G.text = $.getShallow("show") ? Ps(r.getFormattedLabel(F, Kl), r.getFormattedLabel(F, Qu), zd(e, F)) : null; + var Q = x_($, null, !0); + return C(N, U), U = HP(U, G, Q), N && T(U, N), U.legacy = !0, U; + } + function T(N, F) { + for (var U in F) + gt(F, U) && (N[U] = F[U]); + } + function C(N, F) { + N && (N.textFill && (F.textFill = N.textFill), N.textPosition && (F.textPosition = N.textPosition)); + } + function E(N, F) { + if (F == null && (F = u), gt(FP, N)) { + var U = e.getItemVisual(F, "style"); + return U ? U[FP[N]] : null; + } + if (gt(Mhe, N)) + return e.getItemVisual(F, N); + } + function M(N) { + if (a.type === "cartesian2d") { + var F = a.getBaseAxis(); + return ate(Mt({ + axis: F + }, N)); + } + } + function P() { + return t.getCurrentSeriesIndices(); + } + function R(N) { + return nF(N, t); + } +} +function afe(r) { + var e = {}; + return X(r.dimensions, function(t) { + var n = r.getDimensionInfo(t); + if (!n.isExtraCoord) { + var i = n.coordDim, a = e[i] = e[i] || []; + a[n.coordDimIndex] = r.getDimensionIndex(t); + } + }), e; +} +function rC(r, e, t, n, i, a, o) { + if (!n) { + a.remove(e); + return; + } + var s = AE(r, e, t, n, i, a); + return s && o.setItemGraphicEl(t, s), s && Un(s, n.focus, n.blurScope, n.emphasisDisabled), s; +} +function AE(r, e, t, n, i, a) { + var o = -1, s = e; + e && z3(e, n, i) && (o = ir(a.childrenRef(), e), e = null); + var l = !e, u = e; + u ? u.clearStates() : (u = TE(n), s && efe(s, u)), n.morph === !1 ? u.disableMorphing = !0 : u.disableMorphing && (u.disableMorphing = !1), Ho.normal.cfg = Ho.normal.conOpt = Ho.emphasis.cfg = Ho.emphasis.conOpt = Ho.blur.cfg = Ho.blur.conOpt = Ho.select.cfg = Ho.select.conOpt = null, Ho.isLegacy = !1, sfe(u, t, n, i, l, Ho), ofe(u, t, n, i, l), IE(r, u, t, n, Ho, i, l), gt(n, "info") && (Jl(u).info = n.info); + for (var c = 0; c < mc.length; c++) { + var h = mc[c]; + if (h !== Qu) { + var f = X_(n, h), v = EE(n, f, h); + N3(h, u, f, v, Ho); + } + } + return nfe(u, n, i), n.type === "group" && lfe(r, u, t, n, i), o >= 0 ? a.replaceAt(u, o) : a.add(u), u; +} +function z3(r, e, t) { + var n = Jl(r), i = e.type, a = e.shape, o = e.style; + return ( + // Always create new if universal transition is enabled. + // Because we do transition after render. It needs to know what old element is. Replacement will loose it. + t.isUniversalTransitionEnabled() || i != null && i !== n.customGraphicType || i === "path" && ffe(a) && B3(a) !== n.customPathData || i === "image" && gt(o, "image") && o.image !== n.customImagePath + ); +} +function ofe(r, e, t, n, i) { + var a = t.clipPath; + if (a === !1) + r && r.getClipPath() && r.removeClipPath(); + else if (a) { + var o = r.getClipPath(); + o && z3(o, a, n) && (o = null), o || (o = TE(a), r.setClipPath(o)), IE(null, o, e, a, null, n, i); + } +} +function sfe(r, e, t, n, i, a) { + if (!r.isGroup) { + XP(t, null, a), XP(t, Kl, a); + var o = a.normal.conOpt, s = a.emphasis.conOpt, l = a.blur.conOpt, u = a.select.conOpt; + if (o != null || s != null || u != null || l != null) { + var c = r.getTextContent(); + if (o === !1) + c && r.removeTextContent(); + else { + o = a.normal.conOpt = o || { + type: "text" + }, c ? c.clearStates() : (c = TE(o), r.setTextContent(c)), IE(null, c, e, o, null, n, i); + for (var h = o && o.style, f = 0; f < mc.length; f++) { + var v = mc[f]; + if (v !== Qu) { + var b = a[v].conOpt; + N3(v, c, b, EE(o, b, v), null); + } + } + h ? c.dirty() : c.markRedraw(); + } + } + } +} +function XP(r, e, t) { + var n = e ? X_(r, e) : r, i = e ? EE(r, n, Kl) : r.style, a = r.type, o = n ? n.textConfig : null, s = r.textContent, l = s ? e ? X_(s, e) : s : null; + if (i && // Because emphasis style has little info to detect legacy, + // if normal is legacy, emphasis is trade as legacy. + (t.isLegacy || D3(i, a, !!o, !!l))) { + t.isLegacy = !0; + var u = k3(i, a, !e); + !o && u.textConfig && (o = u.textConfig), !l && u.textContent && (l = u.textContent); + } + if (!e && l) { + var c = l; + !c.type && (c.type = "text"); + } + var h = e ? t[e] : t.normal; + h.cfg = o, h.conOpt = l; +} +function X_(r, e) { + return e ? r ? r[e] : null : r; +} +function EE(r, e, t) { + var n = e && e.style; + return n == null && t === Kl && r && (n = r.styleEmphasis), n; +} +function lfe(r, e, t, n, i) { + var a = n.children, o = a ? a.length : 0, s = n.$mergeChildren, l = s === "byName" || n.diffChildrenByName, u = s === !1; + if (!(!o && !l && !u)) { + if (l) { + cfe({ + api: r, + oldChildren: e.children() || [], + newChildren: a || [], + dataIndex: t, + seriesModel: i, + group: e + }); + return; + } + u && e.removeAll(); + for (var c = 0; c < o; c++) { + var h = a[c], f = e.childAt(c); + h ? (h.ignore == null && (h.ignore = !1), AE(r, f, t, h, i, e)) : f.ignore = !0; + } + for (var v = e.childCount() - 1; v >= c; v--) { + var b = e.childAt(v); + ufe(e, b, i); + } + } +} +function ufe(r, e, t) { + e && vx(e, Jl(r).option, t); +} +function cfe(r) { + new nu(r.oldChildren, r.newChildren, ZP, ZP, r).add(JP).update(JP).remove(hfe).execute(); +} +function ZP(r, e) { + var t = r && r.name; + return t != null ? t : Qhe + e; +} +function JP(r, e) { + var t = this.context, n = r != null ? t.newChildren[r] : null, i = e != null ? t.oldChildren[e] : null; + AE(t.api, i, t.dataIndex, n, t.seriesModel, t.group); +} +function hfe(r) { + var e = this.context, t = e.oldChildren[r]; + t && vx(t, Jl(t).option, e.seriesModel); +} +function B3(r) { + return r && (r.pathData || r.d); +} +function ffe(r) { + return r && (gt(r, "pathData") || gt(r, "d")); +} +function dfe(r) { + r.registerChartView(rfe), r.registerSeriesModel(khe); +} +var Sh = Rr(), KP = Ot, nC = ft, vfe = ( + /** @class */ + function() { + function r() { + this._dragging = !1, this.animationThreshold = 15; + } + return r.prototype.render = function(e, t, n, i) { + var a = t.get("value"), o = t.get("status"); + if (this._axisModel = e, this._axisPointerModel = t, this._api = n, !(!i && this._lastValue === a && this._lastStatus === o)) { + this._lastValue = a, this._lastStatus = o; + var s = this._group, l = this._handle; + if (!o || o === "hide") { + s && s.hide(), l && l.hide(); + return; + } + s && s.show(), l && l.show(); + var u = {}; + this.makeElOption(u, a, e, t, n); + var c = u.graphicKey; + c !== this._lastGraphicKey && this.clear(n), this._lastGraphicKey = c; + var h = this._moveAnimation = this.determineAnimation(e, t); + if (!s) + s = this._group = new Rt(), this.createPointerEl(s, u, e, t), this.createLabelEl(s, u, e, t), n.getZr().add(s); + else { + var f = jt(QP, t, h); + this.updatePointerEl(s, u, f), this.updateLabelEl(s, u, f, t); + } + eR(s, t, !0), this._renderHandle(a); + } + }, r.prototype.remove = function(e) { + this.clear(e); + }, r.prototype.dispose = function(e) { + this.clear(e); + }, r.prototype.determineAnimation = function(e, t) { + var n = t.get("animation"), i = e.axis, a = i.type === "category", o = t.get("snap"); + if (!o && !a) + return !1; + if (n === "auto" || n == null) { + var s = this.animationThreshold; + if (a && i.getBandWidth() > s) + return !0; + if (o) { + var l = QA(e).seriesDataCount, u = i.getExtent(); + return Math.abs(u[0] - u[1]) / l > s; + } + return !1; + } + return n === !0; + }, r.prototype.makeElOption = function(e, t, n, i, a) { + }, r.prototype.createPointerEl = function(e, t, n, i) { + var a = t.pointer; + if (a) { + var o = Sh(e).pointerEl = new rm[a.type](KP(t.pointer)); + e.add(o); + } + }, r.prototype.createLabelEl = function(e, t, n, i) { + if (t.label) { + var a = Sh(e).labelEl = new kr(KP(t.label)); + e.add(a), qP(a, i); + } + }, r.prototype.updatePointerEl = function(e, t, n) { + var i = Sh(e).pointerEl; + i && t.pointer && (i.setStyle(t.pointer.style), n(i, { + shape: t.pointer.shape + })); + }, r.prototype.updateLabelEl = function(e, t, n, i) { + var a = Sh(e).labelEl; + a && (a.setStyle(t.label.style), n(a, { + // Consider text length change in vertical axis, animation should + // be used on shape, otherwise the effect will be weird. + // TODOTODO + // shape: elOption.label.shape, + x: t.label.x, + y: t.label.y + }), qP(a, i)); + }, r.prototype._renderHandle = function(e) { + if (!(this._dragging || !this.updateHandleTransform)) { + var t = this._axisPointerModel, n = this._api.getZr(), i = this._handle, a = t.getModel("handle"), o = t.get("status"); + if (!a.get("show") || !o || o === "hide") { + i && n.remove(i), this._handle = null; + return; + } + var s; + this._handle || (s = !0, i = this._handle = Qd(a.get("icon"), { + cursor: "move", + draggable: !0, + onmousemove: function(u) { + eu(u.event); + }, + onmousedown: nC(this._onHandleDragMove, this, 0, 0), + drift: nC(this._onHandleDragMove, this), + ondragend: nC(this._onHandleDragEnd, this) + }), n.add(i)), eR(i, t, !1), i.setStyle(a.getItemStyle(null, ["color", "borderColor", "borderWidth", "opacity", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY"])); + var l = a.get("size"); + We(l) || (l = [l, l]), i.scaleX = l[0] / 2, i.scaleY = l[1] / 2, sv(this, "_doDispatchAxisPointer", a.get("throttle") || 0, "fixRate"), this._moveHandleToValue(e, s); + } + }, r.prototype._moveHandleToValue = function(e, t) { + QP(this._axisPointerModel, !t && this._moveAnimation, this._handle, iC(this.getHandleTransform(e, this._axisModel, this._axisPointerModel))); + }, r.prototype._onHandleDragMove = function(e, t) { + var n = this._handle; + if (n) { + this._dragging = !0; + var i = this.updateHandleTransform(iC(n), [e, t], this._axisModel, this._axisPointerModel); + this._payloadInfo = i, n.stopAnimation(), n.attr(iC(i)), Sh(n).lastProp = null, this._doDispatchAxisPointer(); + } + }, r.prototype._doDispatchAxisPointer = function() { + var e = this._handle; + if (e) { + var t = this._payloadInfo, n = this._axisModel; + this._api.dispatchAction({ + type: "updateAxisPointer", + x: t.cursorPoint[0], + y: t.cursorPoint[1], + tooltipOption: t.tooltipOption, + axesInfo: [{ + axisDim: n.axis.dim, + axisIndex: n.componentIndex + }] + }); + } + }, r.prototype._onHandleDragEnd = function() { + this._dragging = !1; + var e = this._handle; + if (e) { + var t = this._axisPointerModel.get("value"); + this._moveHandleToValue(t), this._api.dispatchAction({ + type: "hideTip" + }); + } + }, r.prototype.clear = function(e) { + this._lastValue = null, this._lastStatus = null; + var t = e.getZr(), n = this._group, i = this._handle; + t && n && (this._lastGraphicKey = null, n && t.remove(n), i && t.remove(i), this._group = null, this._handle = null, this._payloadInfo = null), Sg(this, "_doDispatchAxisPointer"); + }, r.prototype.doClear = function() { + }, r.prototype.buildLabel = function(e, t, n) { + return n = n || 0, { + x: e[n], + y: e[1 - n], + width: t[n], + height: t[1 - n] + }; + }, r; + }() +); +function QP(r, e, t, n) { + j3(Sh(t).lastProp, n) || (Sh(t).lastProp = n, e ? zr(t, n, r) : (t.stopAnimation(), t.attr(n))); +} +function j3(r, e) { + if (kt(r) && kt(e)) { + var t = !0; + return X(e, function(n, i) { + t = t && j3(r[i], n); + }), !!t; + } else + return r === e; +} +function qP(r, e) { + r[e.get(["label", "show"]) ? "show" : "hide"](); +} +function iC(r) { + return { + x: r.x || 0, + y: r.y || 0, + rotation: r.rotation || 0 + }; +} +function eR(r, e, t) { + var n = e.get("z"), i = e.get("zlevel"); + r && r.traverse(function(a) { + a.type !== "group" && (n != null && (a.z = n), i != null && (a.zlevel = i), a.silent = t); + }); +} +const ME = vfe; +function DE(r) { + var e = r.get("type"), t = r.getModel(e + "Style"), n; + return e === "line" ? (n = t.getLineStyle(), n.fill = null) : e === "shadow" && (n = t.getAreaStyle(), n.stroke = null), n; +} +function F3(r, e, t, n, i) { + var a = t.get("value"), o = $3(a, e.axis, e.ecModel, t.get("seriesDataIndices"), { + precision: t.get(["label", "precision"]), + formatter: t.get(["label", "formatter"]) + }), s = t.getModel("label"), l = of(s.get("padding") || 0), u = s.getFont(), c = Zg(o, u), h = i.position, f = c.width + l[1] + l[3], v = c.height + l[0] + l[2], b = i.align; + b === "right" && (h[0] -= f), b === "center" && (h[0] -= f / 2); + var w = i.verticalAlign; + w === "bottom" && (h[1] -= v), w === "middle" && (h[1] -= v / 2), pfe(h, f, v, n); + var p = s.get("backgroundColor"); + (!p || p === "auto") && (p = e.get(["axisLine", "lineStyle", "color"])), r.label = { + // shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')}, + x: h[0], + y: h[1], + style: gn(s, { + text: o, + font: u, + fill: s.getTextColor(), + padding: l, + backgroundColor: p + }), + // Label should be over axisPointer. + z2: 10 + }; +} +function pfe(r, e, t, n) { + var i = n.getWidth(), a = n.getHeight(); + r[0] = Math.min(r[0] + e, i) - e, r[1] = Math.min(r[1] + t, a) - t, r[0] = Math.max(r[0], 0), r[1] = Math.max(r[1], 0); +} +function $3(r, e, t, n, i) { + r = e.scale.parse(r); + var a = e.scale.getLabel({ + value: r + }, { + // If `precision` is set, width can be fixed (like '12.00500'), which + // helps to debounce when when moving label. + precision: i.precision + }), o = i.formatter; + if (o) { + var s = { + value: VA(e, { + value: r + }), + axisDimension: e.dim, + axisIndex: e.index, + seriesData: [] + }; + X(n, function(l) { + var u = t.getSeriesByIndex(l.seriesIndex), c = l.dataIndexInside, h = u && u.getDataParams(c); + h && s.seriesData.push(h); + }), ut(o) ? a = o.replace("{value}", a) : Tt(o) && (a = o(s)); + } + return a; +} +function kE(r, e, t) { + var n = io(); + return wc(n, n, t.rotation), js(n, n, t.position), zs([r.dataToCoord(e), (t.labelOffset || 0) + (t.labelDirection || 1) * (t.labelMargin || 0)], n); +} +function H3(r, e, t, n, i, a) { + var o = au.innerTextLayout(t.rotation, 0, t.labelDirection); + t.labelMargin = i.get(["label", "margin"]), F3(e, n, i, a, { + position: kE(n.axis, r, t), + align: o.textAlign, + verticalAlign: o.textVerticalAlign + }); +} +function OE(r, e, t) { + return t = t || 0, { + x1: r[t], + y1: r[1 - t], + x2: e[t], + y2: e[1 - t] + }; +} +function V3(r, e, t) { + return t = t || 0, { + x: r[t], + y: r[1 - t], + width: e[t], + height: e[1 - t] + }; +} +function tR(r, e, t, n, i, a) { + return { + cx: r, + cy: e, + r0: t, + r: n, + startAngle: i, + endAngle: a, + clockwise: !0 + }; +} +var gfe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.makeElOption = function(t, n, i, a, o) { + var s = i.axis, l = s.grid, u = a.get("type"), c = rR(l, s).getOtherAxis(s).getGlobalExtent(), h = s.toGlobalCoord(s.dataToCoord(n, !0)); + if (u && u !== "none") { + var f = DE(a), v = mfe[u](s, h, c); + v.style = f, t.graphicKey = v.type, t.pointer = v; + } + var b = cT(l.model, i); + H3( + // @ts-ignore + n, + t, + b, + i, + a, + o + ); + }, e.prototype.getHandleTransform = function(t, n, i) { + var a = cT(n.axis.grid.model, n, { + labelInside: !1 + }); + a.labelMargin = i.get(["handle", "margin"]); + var o = kE(n.axis, t, a); + return { + x: o[0], + y: o[1], + rotation: a.rotation + (a.labelDirection < 0 ? Math.PI : 0) + }; + }, e.prototype.updateHandleTransform = function(t, n, i, a) { + var o = i.axis, s = o.grid, l = o.getGlobalExtent(!0), u = rR(s, o).getOtherAxis(o).getGlobalExtent(), c = o.dim === "x" ? 0 : 1, h = [t.x, t.y]; + h[c] += n[c], h[c] = Math.min(l[1], h[c]), h[c] = Math.max(l[0], h[c]); + var f = (u[1] + u[0]) / 2, v = [f, f]; + v[c] = h[c]; + var b = [{ + verticalAlign: "middle" + }, { + align: "center" + }]; + return { + x: h[0], + y: h[1], + rotation: t.rotation, + cursorPoint: v, + tooltipOption: b[c] + }; + }, e; + }(ME) +); +function rR(r, e) { + var t = {}; + return t[e.dim + "AxisIndex"] = e.index, r.getCartesian(t); +} +var mfe = { + line: function(r, e, t) { + var n = OE([e, t[0]], [e, t[1]], nR(r)); + return { + type: "Line", + subPixelOptimize: !0, + shape: n + }; + }, + shadow: function(r, e, t) { + var n = Math.max(1, r.getBandWidth()), i = t[1] - t[0]; + return { + type: "Rect", + shape: V3([e - n / 2, t[0]], [n, i], nR(r)) + }; + } +}; +function nR(r) { + return r.dim === "x" ? 0 : 1; +} +const yfe = gfe; +var _fe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "axisPointer", e.defaultOption = { + // 'auto' means that show when triggered by tooltip or handle. + show: "auto", + // zlevel: 0, + z: 50, + type: "line", + // axispointer triggered by tootip determine snap automatically, + // see `modelHelper`. + snap: !1, + triggerTooltip: !0, + triggerEmphasis: !0, + value: null, + status: null, + link: [], + // Do not set 'auto' here, otherwise global animation: false + // will not effect at this axispointer. + animation: null, + animationDurationUpdate: 200, + lineStyle: { + color: "#B9BEC9", + width: 1, + type: "dashed" + }, + shadowStyle: { + color: "rgba(210,219,238,0.2)" + }, + label: { + show: !0, + formatter: null, + precision: "auto", + margin: 3, + color: "#fff", + padding: [5, 7, 5, 7], + backgroundColor: "auto", + borderColor: null, + borderWidth: 0, + borderRadius: 3 + }, + handle: { + show: !1, + // eslint-disable-next-line + icon: "M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z", + size: 45, + // handle margin is from symbol center to axis, which is stable when circular move. + margin: 50, + // color: '#1b8bbd' + // color: '#2f4554' + color: "#333", + shadowBlur: 3, + shadowColor: "#aaa", + shadowOffsetX: 0, + shadowOffsetY: 2, + // For mobile performance + throttle: 40 + } + }, e; + }(xr) +); +const bfe = _fe; +var Xl = Rr(), xfe = X; +function G3(r, e, t) { + if (!Dr.node) { + var n = e.getZr(); + Xl(n).records || (Xl(n).records = {}), Sfe(n, e); + var i = Xl(n).records[r] || (Xl(n).records[r] = {}); + i.handler = t; + } +} +function Sfe(r, e) { + if (Xl(r).initialized) + return; + Xl(r).initialized = !0, t("click", jt(iR, "click")), t("mousemove", jt(iR, "mousemove")), t("globalout", Cfe); + function t(n, i) { + r.on(n, function(a) { + var o = Tfe(e); + xfe(Xl(r).records, function(s) { + s && i(s, a, o.dispatchAction); + }), wfe(o.pendings, e); + }); + } +} +function wfe(r, e) { + var t = r.showTip.length, n = r.hideTip.length, i; + t ? i = r.showTip[t - 1] : n && (i = r.hideTip[n - 1]), i && (i.dispatchAction = null, e.dispatchAction(i)); +} +function Cfe(r, e, t) { + r.handler("leave", null, t); +} +function iR(r, e, t, n) { + e.handler(r, t, n); +} +function Tfe(r) { + var e = { + showTip: [], + hideTip: [] + }, t = function(n) { + var i = e[n.type]; + i ? i.push(n) : (n.dispatchAction = t, r.dispatchAction(n)); + }; + return { + dispatchAction: t, + pendings: e + }; +} +function MT(r, e) { + if (!Dr.node) { + var t = e.getZr(), n = (Xl(t).records || {})[r]; + n && (Xl(t).records[r] = null); + } +} +var Ife = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = n.getComponent("tooltip"), o = t.get("triggerOn") || a && a.get("triggerOn") || "mousemove|click"; + G3("axisPointer", i, function(s, l, u) { + o !== "none" && (s === "leave" || o.indexOf(s) >= 0) && u({ + type: "updateAxisPointer", + currTrigger: s, + x: l && l.offsetX, + y: l && l.offsetY + }); + }); + }, e.prototype.remove = function(t, n) { + MT("axisPointer", n); + }, e.prototype.dispose = function(t, n) { + MT("axisPointer", n); + }, e.type = "axisPointer", e; + }(Sn) +); +const Afe = Ife; +function U3(r, e) { + var t = [], n = r.seriesIndex, i; + if (n == null || !(i = e.getSeriesByIndex(n))) + return { + point: [] + }; + var a = i.getData(), o = Uh(a, r); + if (o == null || o < 0 || We(o)) + return { + point: [] + }; + var s = a.getItemGraphicEl(o), l = i.coordinateSystem; + if (i.getTooltipPosition) + t = i.getTooltipPosition(o) || []; + else if (l && l.dataToPoint) + if (r.isStacked) { + var u = l.getBaseAxis(), c = l.getOtherAxis(u), h = c.dim, f = u.dim, v = h === "x" || h === "radius" ? 1 : 0, b = a.mapDimension(f), w = []; + w[v] = a.get(b, o), w[1 - v] = a.get(a.getCalculationInfo("stackResultDimension"), o), t = l.dataToPoint(w) || []; + } else + t = l.dataToPoint(a.getValues(Ke(l.dimensions, function(d) { + return a.mapDimension(d); + }), o)) || []; + else if (s) { + var p = s.getBoundingRect().clone(); + p.applyTransform(s.transform), t = [p.x + p.width / 2, p.y + p.height / 2]; + } + return { + point: t, + el: s + }; +} +var aR = Rr(); +function Efe(r, e, t) { + var n = r.currTrigger, i = [r.x, r.y], a = r, o = r.dispatchAction || ft(t.dispatchAction, t), s = e.getComponent("axisPointer").coordSysAxesInfo; + if (s) { + Y0(i) && (i = U3({ + seriesIndex: a.seriesIndex, + // Do not use dataIndexInside from other ec instance. + // FIXME: auto detect it? + dataIndex: a.dataIndex + }, e).point); + var l = Y0(i), u = a.axesInfo, c = s.axesInfo, h = n === "leave" || Y0(i), f = {}, v = {}, b = { + list: [], + map: {} + }, w = { + showPointer: jt(Dfe, v), + showTooltip: jt(kfe, b) + }; + X(s.coordSysMap, function(d, m) { + var _ = l || d.containPoint(i); + X(s.coordSysAxesInfo[m], function(y, x) { + var g = y.axis, S = Rfe(u, y); + if (!h && _ && (!u || S)) { + var T = S && S.value; + T == null && !l && (T = g.pointToData(i)), T != null && oR(y, T, w, !1, f); + } + }); + }); + var p = {}; + return X(c, function(d, m) { + var _ = d.linkGroup; + _ && !v[m] && X(_.axesInfo, function(y, x) { + var g = v[x]; + if (y !== d && g) { + var S = g.value; + _.mapper && (S = d.axis.scale.parse(_.mapper(S, sR(y), sR(d)))), p[d.key] = S; + } + }); + }), X(p, function(d, m) { + oR(c[m], d, w, !0, f); + }), Ofe(v, c, f), Lfe(b, i, r, o), Pfe(c, o, t), f; + } +} +function oR(r, e, t, n, i) { + var a = r.axis; + if (!(a.scale.isBlank() || !a.containData(e))) { + if (!r.involveSeries) { + t.showPointer(r, e); + return; + } + var o = Mfe(e, r), s = o.payloadBatch, l = o.snapToValue; + s[0] && i.seriesIndex == null && Fe(i, s[0]), !n && r.snap && a.containData(l) && l != null && (e = l), t.showPointer(r, e, s), t.showTooltip(r, o, l); + } +} +function Mfe(r, e) { + var t = e.axis, n = t.dim, i = r, a = [], o = Number.MAX_VALUE, s = -1; + return X(e.seriesModels, function(l, u) { + var c = l.getData().mapDimensionsAll(n), h, f; + if (l.getAxisTooltipData) { + var v = l.getAxisTooltipData(c, r, t); + f = v.dataIndices, h = v.nestestValue; + } else { + if (f = l.getData().indicesOfNearest( + c[0], + r, + // Add a threshold to avoid find the wrong dataIndex + // when data length is not same. + // false, + t.type === "category" ? 0.5 : null + ), !f.length) + return; + h = l.getData().get(c[0], f[0]); + } + if (!(h == null || !isFinite(h))) { + var b = r - h, w = Math.abs(b); + w <= o && ((w < o || b >= 0 && s < 0) && (o = w, s = b, i = h, a.length = 0), X(f, function(p) { + a.push({ + seriesIndex: l.seriesIndex, + dataIndexInside: p, + dataIndex: l.getData().getRawIndex(p) + }); + })); + } + }), { + payloadBatch: a, + snapToValue: i + }; +} +function Dfe(r, e, t, n) { + r[e.key] = { + value: t, + payloadBatch: n + }; +} +function kfe(r, e, t, n) { + var i = t.payloadBatch, a = e.axis, o = a.model, s = e.axisPointerModel; + if (!(!e.triggerTooltip || !i.length)) { + var l = e.coordSys.model, u = Mg(l), c = r.map[u]; + c || (c = r.map[u] = { + coordSysId: l.id, + coordSysIndex: l.componentIndex, + coordSysType: l.type, + coordSysMainType: l.mainType, + dataByAxis: [] + }, r.list.push(c)), c.dataByAxis.push({ + axisDim: a.dim, + axisIndex: o.componentIndex, + axisType: o.type, + axisId: o.id, + value: n, + // Caustion: viewHelper.getValueLabel is actually on "view stage", which + // depends that all models have been updated. So it should not be performed + // here. Considering axisPointerModel used here is volatile, which is hard + // to be retrieve in TooltipView, we prepare parameters here. + valueLabelOpt: { + precision: s.get(["label", "precision"]), + formatter: s.get(["label", "formatter"]) + }, + seriesDataIndices: i.slice() + }); + } +} +function Ofe(r, e, t) { + var n = t.axesInfo = []; + X(e, function(i, a) { + var o = i.axisPointerModel.option, s = r[a]; + s ? (!i.useHandle && (o.status = "show"), o.value = s.value, o.seriesDataIndices = (s.payloadBatch || []).slice()) : !i.useHandle && (o.status = "hide"), o.status === "show" && n.push({ + axisDim: i.axis.dim, + axisIndex: i.axis.model.componentIndex, + value: o.value + }); + }); +} +function Lfe(r, e, t, n) { + if (Y0(e) || !r.list.length) { + n({ + type: "hideTip" + }); + return; + } + var i = ((r.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {}; + n({ + type: "showTip", + escapeConnect: !0, + x: e[0], + y: e[1], + tooltipOption: t.tooltipOption, + position: t.position, + dataIndexInside: i.dataIndexInside, + dataIndex: i.dataIndex, + seriesIndex: i.seriesIndex, + dataByCoordSys: r.list + }); +} +function Pfe(r, e, t) { + var n = t.getZr(), i = "axisPointerLastHighlights", a = aR(n)[i] || {}, o = aR(n)[i] = {}; + X(r, function(u, c) { + var h = u.axisPointerModel.option; + h.status === "show" && u.triggerEmphasis && X(h.seriesDataIndices, function(f) { + var v = f.seriesIndex + " | " + f.dataIndex; + o[v] = f; + }); + }); + var s = [], l = []; + X(a, function(u, c) { + !o[c] && l.push(u); + }), X(o, function(u, c) { + !a[c] && s.push(u); + }), l.length && t.dispatchAction({ + type: "downplay", + escapeConnect: !0, + // Not blur others when highlight in axisPointer. + notBlur: !0, + batch: l + }), s.length && t.dispatchAction({ + type: "highlight", + escapeConnect: !0, + // Not blur others when highlight in axisPointer. + notBlur: !0, + batch: s + }); +} +function Rfe(r, e) { + for (var t = 0; t < (r || []).length; t++) { + var n = r[t]; + if (e.axis.dim === n.axisDim && e.axis.model.componentIndex === n.axisIndex) + return n; + } +} +function sR(r) { + var e = r.axis.model, t = {}, n = t.axisDim = r.axis.dim; + return t.axisIndex = t[n + "AxisIndex"] = e.componentIndex, t.axisName = t[n + "AxisName"] = e.name, t.axisId = t[n + "AxisId"] = e.id, t; +} +function Y0(r) { + return !r || r[0] == null || isNaN(r[0]) || r[1] == null || isNaN(r[1]); +} +function gm(r) { + uf.registerAxisPointerClass("CartesianAxisPointer", yfe), r.registerComponentModel(bfe), r.registerComponentView(Afe), r.registerPreprocessor(function(e) { + if (e) { + (!e.axisPointer || e.axisPointer.length === 0) && (e.axisPointer = {}); + var t = e.axisPointer.link; + t && !We(t) && (e.axisPointer.link = [t]); + } + }), r.registerProcessor(r.PRIORITY.PROCESSOR.STATISTIC, function(e, t) { + e.getComponent("axisPointer").coordSysAxesInfo = Sie(e, t); + }), r.registerAction({ + type: "updateAxisPointer", + event: "updateAxisPointer", + update: ":updateAxisPointer" + }, Efe); +} +function Nfe(r) { + Kt(mH), Kt(gm); +} +var zfe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.makeElOption = function(t, n, i, a, o) { + var s = i.axis; + s.dim === "angle" && (this.animationThreshold = Math.PI / 18); + var l = s.polar, u = l.getOtherAxis(s), c = u.getExtent(), h = s.dataToCoord(n), f = a.get("type"); + if (f && f !== "none") { + var v = DE(a), b = jfe[f](s, l, h, c); + b.style = v, t.graphicKey = b.type, t.pointer = b; + } + var w = a.get(["label", "margin"]), p = Bfe(n, i, a, l, w); + F3(t, i, a, o, p); + }, e; + }(ME) +); +function Bfe(r, e, t, n, i) { + var a = e.axis, o = a.dataToCoord(r), s = n.getAngleAxis().getExtent()[0]; + s = s / 180 * Math.PI; + var l = n.getRadiusAxis().getExtent(), u, c, h; + if (a.dim === "radius") { + var f = io(); + wc(f, f, s), js(f, f, [n.cx, n.cy]), u = zs([o, -i], f); + var v = e.getModel("axisLabel").get("rotate") || 0, b = au.innerTextLayout(s, v * Math.PI / 180, -1); + c = b.textAlign, h = b.textVerticalAlign; + } else { + var w = l[1]; + u = n.coordToPoint([w + i, o]); + var p = n.cx, d = n.cy; + c = Math.abs(u[0] - p) / w < 0.3 ? "center" : u[0] > p ? "left" : "right", h = Math.abs(u[1] - d) / w < 0.3 ? "middle" : u[1] > d ? "top" : "bottom"; + } + return { + position: u, + align: c, + verticalAlign: h + }; +} +var jfe = { + line: function(r, e, t, n) { + return r.dim === "angle" ? { + type: "Line", + shape: OE(e.coordToPoint([n[0], t]), e.coordToPoint([n[1], t])) + } : { + type: "Circle", + shape: { + cx: e.cx, + cy: e.cy, + r: t + } + }; + }, + shadow: function(r, e, t, n) { + var i = Math.max(1, r.getBandWidth()), a = Math.PI / 180; + return r.dim === "angle" ? { + type: "Sector", + shape: tR( + e.cx, + e.cy, + n[0], + n[1], + // In ECharts y is negative if angle is positive + (-t - i / 2) * a, + (-t + i / 2) * a + ) + } : { + type: "Sector", + shape: tR(e.cx, e.cy, t - i / 2, t + i / 2, 0, Math.PI * 2) + }; + } +}; +const Ffe = zfe; +var $fe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.findAxisModel = function(t) { + var n, i = this.ecModel; + return i.eachComponent(t, function(a) { + a.getCoordSysModel() === this && (n = a); + }, this), n; + }, e.type = "polar", e.dependencies = ["radiusAxis", "angleAxis"], e.defaultOption = { + // zlevel: 0, + z: 0, + center: ["50%", "50%"], + radius: "80%" + }, e; + }(xr) +); +const Hfe = $fe; +var LE = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.getCoordSysModel = function() { + return this.getReferringComponents("polar", mi).models[0]; + }, e.type = "polarAxis", e; + }(xr) +); +qn(LE, cv); +var Vfe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "angleAxis", e; + }(LE) +), Gfe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "radiusAxis", e; + }(LE) +), PE = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n) { + return r.call(this, "radius", t, n) || this; + } + return e.prototype.pointToData = function(t, n) { + return this.polar.pointToData(t, n)[this.dim === "radius" ? 0 : 1]; + }, e; + }(wo) +); +PE.prototype.dataToRadius = wo.prototype.dataToCoord; +PE.prototype.radiusToData = wo.prototype.coordToData; +const Ufe = PE; +var Wfe = Rr(), RE = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n) { + return r.call(this, "angle", t, n || [0, 360]) || this; + } + return e.prototype.pointToData = function(t, n) { + return this.polar.pointToData(t, n)[this.dim === "radius" ? 0 : 1]; + }, e.prototype.calculateCategoryInterval = function() { + var t = this, n = t.getLabelModel(), i = t.scale, a = i.getExtent(), o = i.count(); + if (a[1] - a[0] < 1) + return 0; + var s = a[0], l = t.dataToCoord(s + 1) - t.dataToCoord(s), u = Math.abs(l), c = Zg(s == null ? "" : s + "", n.getFont(), "center", "top"), h = Math.max(c.height, 7), f = h / u; + isNaN(f) && (f = 1 / 0); + var v = Math.max(0, Math.floor(f)), b = Wfe(t.model), w = b.lastAutoInterval, p = b.lastTickCount; + return w != null && p != null && Math.abs(w - v) <= 1 && Math.abs(p - o) <= 1 && w > v ? v = w : (b.lastTickCount = o, b.lastAutoInterval = v), v; + }, e; + }(wo) +); +RE.prototype.dataToAngle = wo.prototype.dataToCoord; +RE.prototype.angleToData = wo.prototype.coordToData; +const Yfe = RE; +var W3 = ["radius", "angle"], Xfe = ( + /** @class */ + function() { + function r(e) { + this.dimensions = W3, this.type = "polar", this.cx = 0, this.cy = 0, this._radiusAxis = new Ufe(), this._angleAxis = new Yfe(), this.axisPointerEnabled = !0, this.name = e || "", this._radiusAxis.polar = this._angleAxis.polar = this; + } + return r.prototype.containPoint = function(e) { + var t = this.pointToCoord(e); + return this._radiusAxis.contain(t[0]) && this._angleAxis.contain(t[1]); + }, r.prototype.containData = function(e) { + return this._radiusAxis.containData(e[0]) && this._angleAxis.containData(e[1]); + }, r.prototype.getAxis = function(e) { + var t = "_" + e + "Axis"; + return this[t]; + }, r.prototype.getAxes = function() { + return [this._radiusAxis, this._angleAxis]; + }, r.prototype.getAxesByScale = function(e) { + var t = [], n = this._angleAxis, i = this._radiusAxis; + return n.scale.type === e && t.push(n), i.scale.type === e && t.push(i), t; + }, r.prototype.getAngleAxis = function() { + return this._angleAxis; + }, r.prototype.getRadiusAxis = function() { + return this._radiusAxis; + }, r.prototype.getOtherAxis = function(e) { + var t = this._angleAxis; + return e === t ? this._radiusAxis : t; + }, r.prototype.getBaseAxis = function() { + return this.getAxesByScale("ordinal")[0] || this.getAxesByScale("time")[0] || this.getAngleAxis(); + }, r.prototype.getTooltipAxes = function(e) { + var t = e != null && e !== "auto" ? this.getAxis(e) : this.getBaseAxis(); + return { + baseAxes: [t], + otherAxes: [this.getOtherAxis(t)] + }; + }, r.prototype.dataToPoint = function(e, t) { + return this.coordToPoint([this._radiusAxis.dataToRadius(e[0], t), this._angleAxis.dataToAngle(e[1], t)]); + }, r.prototype.pointToData = function(e, t) { + var n = this.pointToCoord(e); + return [this._radiusAxis.radiusToData(n[0], t), this._angleAxis.angleToData(n[1], t)]; + }, r.prototype.pointToCoord = function(e) { + var t = e[0] - this.cx, n = e[1] - this.cy, i = this.getAngleAxis(), a = i.getExtent(), o = Math.min(a[0], a[1]), s = Math.max(a[0], a[1]); + i.inverse ? o = s - 360 : s = o + 360; + var l = Math.sqrt(t * t + n * n); + t /= l, n /= l; + for (var u = Math.atan2(-n, t) / Math.PI * 180, c = u < o ? 1 : -1; u < o || u > s; ) + u += c * 360; + return [l, u]; + }, r.prototype.coordToPoint = function(e) { + var t = e[0], n = e[1] / 180 * Math.PI, i = Math.cos(n) * t + this.cx, a = -Math.sin(n) * t + this.cy; + return [i, a]; + }, r.prototype.getArea = function() { + var e = this.getAngleAxis(), t = this.getRadiusAxis(), n = t.getExtent().slice(); + n[0] > n[1] && n.reverse(); + var i = e.getExtent(), a = Math.PI / 180; + return { + cx: this.cx, + cy: this.cy, + r0: n[0], + r: n[1], + startAngle: -i[0] * a, + endAngle: -i[1] * a, + clockwise: e.inverse, + contain: function(o, s) { + var l = o - this.cx, u = s - this.cy, c = l * l + u * u - 1e-4, h = this.r, f = this.r0; + return c <= h * h && c >= f * f; + } + }; + }, r.prototype.convertToPixel = function(e, t, n) { + var i = lR(t); + return i === this ? this.dataToPoint(n) : null; + }, r.prototype.convertFromPixel = function(e, t, n) { + var i = lR(t); + return i === this ? this.pointToData(n) : null; + }, r; + }() +); +function lR(r) { + var e = r.seriesModel, t = r.polarModel; + return t && t.coordinateSystem || e && e.coordinateSystem; +} +const Zfe = Xfe; +function Jfe(r, e, t) { + var n = e.get("center"), i = t.getWidth(), a = t.getHeight(); + r.cx = ot(n[0], i), r.cy = ot(n[1], a); + var o = r.getRadiusAxis(), s = Math.min(i, a) / 2, l = e.get("radius"); + l == null ? l = [0, "100%"] : We(l) || (l = [0, l]); + var u = [ot(l[0], s), ot(l[1], s)]; + o.inverse ? o.setExtent(u[1], u[0]) : o.setExtent(u[0], u[1]); +} +function Kfe(r, e) { + var t = this, n = t.getAngleAxis(), i = t.getRadiusAxis(); + if (n.scale.setExtent(1 / 0, -1 / 0), i.scale.setExtent(1 / 0, -1 / 0), r.eachSeries(function(s) { + if (s.coordinateSystem === t) { + var l = s.getData(); + X(P_(l, "radius"), function(u) { + i.scale.unionExtentFromData(l, u); + }), X(P_(l, "angle"), function(u) { + n.scale.unionExtentFromData(l, u); + }); + } + }), Jh(n.scale, n.model), Jh(i.scale, i.model), n.type === "category" && !n.onBand) { + var a = n.getExtent(), o = 360 / n.scale.count(); + n.inverse ? a[1] += o : a[1] -= o, n.setExtent(a[0], a[1]); + } +} +function Qfe(r) { + return r.mainType === "angleAxis"; +} +function uR(r, e) { + if (r.type = e.get("type"), r.scale = sm(e), r.onBand = e.get("boundaryGap") && r.type === "category", r.inverse = e.get("inverse"), Qfe(e)) { + r.inverse = r.inverse !== e.get("clockwise"); + var t = e.get("startAngle"); + r.setExtent(t, t + (r.inverse ? -360 : 360)); + } + e.axis = r, r.model = e; +} +var qfe = { + dimensions: W3, + create: function(r, e) { + var t = []; + return r.eachComponent("polar", function(n, i) { + var a = new Zfe(i + ""); + a.update = Kfe; + var o = a.getRadiusAxis(), s = a.getAngleAxis(), l = n.findAxisModel("radiusAxis"), u = n.findAxisModel("angleAxis"); + uR(o, l), uR(s, u), Jfe(a, n, e), t.push(a), n.coordinateSystem = a, a.model = n; + }), r.eachSeries(function(n) { + if (n.get("coordinateSystem") === "polar") { + var i = n.getReferringComponents("polar", mi).models[0]; + n.coordinateSystem = i.coordinateSystem; + } + }), t; + } +}; +const ede = qfe; +var tde = ["axisLine", "axisLabel", "axisTick", "minorTick", "splitLine", "minorSplitLine", "splitArea"]; +function f0(r, e, t) { + e[1] > e[0] && (e = e.slice().reverse()); + var n = r.coordToPoint([e[0], t]), i = r.coordToPoint([e[1], t]); + return { + x1: n[0], + y1: n[1], + x2: i[0], + y2: i[1] + }; +} +function d0(r) { + var e = r.getRadiusAxis(); + return e.inverse ? 0 : 1; +} +function cR(r) { + var e = r[0], t = r[r.length - 1]; + e && t && Math.abs(Math.abs(e.coord - t.coord) - 360) < 1e-4 && r.pop(); +} +var rde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.axisPointerClass = "PolarAxisPointer", t; + } + return e.prototype.render = function(t, n) { + if (this.group.removeAll(), !!t.get("show")) { + var i = t.axis, a = i.polar, o = a.getRadiusAxis().getExtent(), s = i.getTicksCoords(), l = i.getMinorTicksCoords(), u = Ke(i.getViewLabels(), function(c) { + c = Ot(c); + var h = i.scale, f = h.type === "ordinal" ? h.getRawOrdinalNumber(c.tickValue) : c.tickValue; + return c.coord = i.dataToCoord(f), c; + }); + cR(u), cR(s), X(tde, function(c) { + t.get([c, "show"]) && (!i.scale.isBlank() || c === "axisLine") && nde[c](this.group, t, a, s, l, o, u); + }, this); + } + }, e.type = "angleAxis", e; + }(uf) +), nde = { + axisLine: function(r, e, t, n, i, a) { + var o = e.getModel(["axisLine", "lineStyle"]), s = d0(t), l = s ? 0 : 1, u; + a[l] === 0 ? u = new $s({ + shape: { + cx: t.cx, + cy: t.cy, + r: a[s] + }, + style: o.getLineStyle(), + z2: 1, + silent: !0 + }) : u = new Qg({ + shape: { + cx: t.cx, + cy: t.cy, + r: a[s], + r0: a[l] + }, + style: o.getLineStyle(), + z2: 1, + silent: !0 + }), u.style.fill = null, r.add(u); + }, + axisTick: function(r, e, t, n, i, a) { + var o = e.getModel("axisTick"), s = (o.get("inside") ? -1 : 1) * o.get("length"), l = a[d0(t)], u = Ke(n, function(c) { + return new Ai({ + shape: f0(t, [l, l + s], c.coord) + }); + }); + r.add(mo(u, { + style: Mt(o.getModel("lineStyle").getLineStyle(), { + stroke: e.get(["axisLine", "lineStyle", "color"]) + }) + })); + }, + minorTick: function(r, e, t, n, i, a) { + if (i.length) { + for (var o = e.getModel("axisTick"), s = e.getModel("minorTick"), l = (o.get("inside") ? -1 : 1) * s.get("length"), u = a[d0(t)], c = [], h = 0; h < i.length; h++) + for (var f = 0; f < i[h].length; f++) + c.push(new Ai({ + shape: f0(t, [u, u + l], i[h][f].coord) + })); + r.add(mo(c, { + style: Mt(s.getModel("lineStyle").getLineStyle(), Mt(o.getLineStyle(), { + stroke: e.get(["axisLine", "lineStyle", "color"]) + })) + })); + } + }, + axisLabel: function(r, e, t, n, i, a, o) { + var s = e.getCategories(!0), l = e.getModel("axisLabel"), u = l.get("margin"), c = e.get("triggerEvent"); + X(o, function(h, f) { + var v = l, b = h.tickValue, w = a[d0(t)], p = t.coordToPoint([w + u, h.coord]), d = t.cx, m = t.cy, _ = Math.abs(p[0] - d) / w < 0.3 ? "center" : p[0] > d ? "left" : "right", y = Math.abs(p[1] - m) / w < 0.3 ? "middle" : p[1] > m ? "top" : "bottom"; + if (s && s[b]) { + var x = s[b]; + kt(x) && x.textStyle && (v = new qr(x.textStyle, l, l.ecModel)); + } + var g = new kr({ + silent: au.isLabelSilent(e), + style: gn(v, { + x: p[0], + y: p[1], + fill: v.getTextColor() || e.get(["axisLine", "lineStyle", "color"]), + text: h.formattedLabel, + align: _, + verticalAlign: y + }) + }); + if (r.add(g), c) { + var S = au.makeAxisEventDataBase(e); + S.targetType = "axisLabel", S.value = h.rawLabel, Ft(g).eventData = S; + } + }, this); + }, + splitLine: function(r, e, t, n, i, a) { + var o = e.getModel("splitLine"), s = o.getModel("lineStyle"), l = s.get("color"), u = 0; + l = l instanceof Array ? l : [l]; + for (var c = [], h = 0; h < n.length; h++) { + var f = u++ % l.length; + c[f] = c[f] || [], c[f].push(new Ai({ + shape: f0(t, a, n[h].coord) + })); + } + for (var h = 0; h < c.length; h++) + r.add(mo(c[h], { + style: Mt({ + stroke: l[h % l.length] + }, s.getLineStyle()), + silent: !0, + z: e.get("z") + })); + }, + minorSplitLine: function(r, e, t, n, i, a) { + if (i.length) { + for (var o = e.getModel("minorSplitLine"), s = o.getModel("lineStyle"), l = [], u = 0; u < i.length; u++) + for (var c = 0; c < i[u].length; c++) + l.push(new Ai({ + shape: f0(t, a, i[u][c].coord) + })); + r.add(mo(l, { + style: s.getLineStyle(), + silent: !0, + z: e.get("z") + })); + } + }, + splitArea: function(r, e, t, n, i, a) { + if (n.length) { + var o = e.getModel("splitArea"), s = o.getModel("areaStyle"), l = s.get("color"), u = 0; + l = l instanceof Array ? l : [l]; + for (var c = [], h = Math.PI / 180, f = -n[0].coord * h, v = Math.min(a[0], a[1]), b = Math.max(a[0], a[1]), w = e.get("clockwise"), p = 1, d = n.length; p <= d; p++) { + var m = p === d ? n[0].coord : n[p].coord, _ = u++ % l.length; + c[_] = c[_] || [], c[_].push(new Oa({ + shape: { + cx: t.cx, + cy: t.cy, + r0: v, + r: b, + startAngle: f, + endAngle: -m * h, + clockwise: w + }, + silent: !0 + })), f = -m * h; + } + for (var p = 0; p < c.length; p++) + r.add(mo(c[p], { + style: Mt({ + fill: l[p % l.length] + }, s.getAreaStyle()), + silent: !0 + })); + } + } +}; +const ide = rde; +var ade = ["axisLine", "axisTickLabel", "axisName"], ode = ["splitLine", "splitArea", "minorSplitLine"], sde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.axisPointerClass = "PolarAxisPointer", t; + } + return e.prototype.render = function(t, n) { + if (this.group.removeAll(), !!t.get("show")) { + var i = this._axisGroup, a = this._axisGroup = new Rt(); + this.group.add(a); + var o = t.axis, s = o.polar, l = s.getAngleAxis(), u = o.getTicksCoords(), c = o.getMinorTicksCoords(), h = l.getExtent()[0], f = o.getExtent(), v = ude(s, t, h), b = new au(t, v); + X(ade, b.add, b), a.add(b.getGroup()), tm(i, a, t), X(ode, function(w) { + t.get([w, "show"]) && !o.scale.isBlank() && lde[w](this.group, t, s, h, f, u, c); + }, this); + } + }, e.type = "radiusAxis", e; + }(uf) +), lde = { + splitLine: function(r, e, t, n, i, a) { + var o = e.getModel("splitLine"), s = o.getModel("lineStyle"), l = s.get("color"), u = 0; + l = l instanceof Array ? l : [l]; + for (var c = [], h = 0; h < a.length; h++) { + var f = u++ % l.length; + c[f] = c[f] || [], c[f].push(new $s({ + shape: { + cx: t.cx, + cy: t.cy, + // ensure circle radius >= 0 + r: Math.max(a[h].coord, 0) + } + })); + } + for (var h = 0; h < c.length; h++) + r.add(mo(c[h], { + style: Mt({ + stroke: l[h % l.length], + fill: null + }, s.getLineStyle()), + silent: !0 + })); + }, + minorSplitLine: function(r, e, t, n, i, a, o) { + if (o.length) { + for (var s = e.getModel("minorSplitLine"), l = s.getModel("lineStyle"), u = [], c = 0; c < o.length; c++) + for (var h = 0; h < o[c].length; h++) + u.push(new $s({ + shape: { + cx: t.cx, + cy: t.cy, + r: o[c][h].coord + } + })); + r.add(mo(u, { + style: Mt({ + fill: null + }, l.getLineStyle()), + silent: !0 + })); + } + }, + splitArea: function(r, e, t, n, i, a) { + if (a.length) { + var o = e.getModel("splitArea"), s = o.getModel("areaStyle"), l = s.get("color"), u = 0; + l = l instanceof Array ? l : [l]; + for (var c = [], h = a[0].coord, f = 1; f < a.length; f++) { + var v = u++ % l.length; + c[v] = c[v] || [], c[v].push(new Oa({ + shape: { + cx: t.cx, + cy: t.cy, + r0: h, + r: a[f].coord, + startAngle: 0, + endAngle: Math.PI * 2 + }, + silent: !0 + })), h = a[f].coord; + } + for (var f = 0; f < c.length; f++) + r.add(mo(c[f], { + style: Mt({ + fill: l[f % l.length] + }, s.getAreaStyle()), + silent: !0 + })); + } + } +}; +function ude(r, e, t) { + return { + position: [r.cx, r.cy], + rotation: t / 180 * Math.PI, + labelDirection: -1, + tickDirection: -1, + nameDirection: 1, + labelRotate: e.getModel("axisLabel").get("rotate"), + // Over splitLine and splitArea + z2: 1 + }; +} +const cde = sde; +function Y3(r) { + return r.get("stack") || "__ec_stack_" + r.seriesIndex; +} +function X3(r, e) { + return e.dim + r.model.componentIndex; +} +function hde(r, e, t) { + var n = {}, i = fde(Jr(e.getSeriesByType(r), function(a) { + return !e.isSeriesFiltered(a) && a.coordinateSystem && a.coordinateSystem.type === "polar"; + })); + e.eachSeriesByType(r, function(a) { + if (a.coordinateSystem.type === "polar") { + var o = a.getData(), s = a.coordinateSystem, l = s.getBaseAxis(), u = X3(s, l), c = Y3(a), h = i[u][c], f = h.offset, v = h.width, b = s.getOtherAxis(l), w = a.coordinateSystem.cx, p = a.coordinateSystem.cy, d = a.get("barMinHeight") || 0, m = a.get("barMinAngle") || 0; + n[c] = n[c] || []; + for (var _ = o.mapDimension(b.dim), y = o.mapDimension(l.dim), x = iu( + o, + _ + /* , baseDim */ + ), g = l.dim !== "radius" || !a.get("roundCap", !0), S = b.dataToCoord(0), T = 0, C = o.count(); T < C; T++) { + var E = o.get(_, T), M = o.get(y, T), P = E >= 0 ? "p" : "n", R = S; + x && (n[c][M] || (n[c][M] = { + p: S, + n: S + // Negative stack + }), R = n[c][M][P]); + var N = void 0, F = void 0, U = void 0, $ = void 0; + if (b.dim === "radius") { + var G = b.dataToCoord(E) - S, Q = l.dataToCoord(M); + Math.abs(G) < d && (G = (G < 0 ? -1 : 1) * d), N = R, F = R + G, U = Q - f, $ = U - v, x && (n[c][M][P] = F); + } else { + var ee = b.dataToCoord(E, g) - S, ce = l.dataToCoord(M); + Math.abs(ee) < m && (ee = (ee < 0 ? -1 : 1) * m), N = ce + f, F = N + v, U = R, $ = R + ee, x && (n[c][M][P] = $); + } + o.setItemLayout(T, { + cx: w, + cy: p, + r0: N, + r: F, + // Consider that positive angle is anti-clockwise, + // while positive radian of sector is clockwise + startAngle: -U * Math.PI / 180, + endAngle: -$ * Math.PI / 180, + /** + * Keep the same logic with bar in catesion: use end value to + * control direction. Notice that if clockwise is true (by + * default), the sector will always draw clockwisely, no matter + * whether endAngle is greater or less than startAngle. + */ + clockwise: U >= $ + }); + } + } + }); +} +function fde(r) { + var e = {}; + X(r, function(n, i) { + var a = n.getData(), o = n.coordinateSystem, s = o.getBaseAxis(), l = X3(o, s), u = s.getExtent(), c = s.type === "category" ? s.getBandWidth() : Math.abs(u[1] - u[0]) / a.count(), h = e[l] || { + bandWidth: c, + remainedWidth: c, + autoWidthCount: 0, + categoryGap: "20%", + gap: "30%", + stacks: {} + }, f = h.stacks; + e[l] = h; + var v = Y3(n); + f[v] || h.autoWidthCount++, f[v] = f[v] || { + width: 0, + maxWidth: 0 + }; + var b = ot(n.get("barWidth"), c), w = ot(n.get("barMaxWidth"), c), p = n.get("barGap"), d = n.get("barCategoryGap"); + b && !f[v].width && (b = Math.min(h.remainedWidth, b), f[v].width = b, h.remainedWidth -= b), w && (f[v].maxWidth = w), p != null && (h.gap = p), d != null && (h.categoryGap = d); + }); + var t = {}; + return X(e, function(n, i) { + t[i] = {}; + var a = n.stacks, o = n.bandWidth, s = ot(n.categoryGap, o), l = ot(n.gap, 1), u = n.remainedWidth, c = n.autoWidthCount, h = (u - s) / (c + (c - 1) * l); + h = Math.max(h, 0), X(a, function(w, p) { + var d = w.maxWidth; + d && d < h && (d = Math.min(d, u), w.width && (d = Math.min(d, w.width)), u -= d, w.width = d, c--); + }), h = (u - s) / (c + (c - 1) * l), h = Math.max(h, 0); + var f = 0, v; + X(a, function(w, p) { + w.width || (w.width = h), v = w, f += w.width * (1 + l); + }), v && (f -= v.width * l); + var b = -f / 2; + X(a, function(w, p) { + t[i][p] = t[i][p] || { + offset: b, + width: w.width + }, b += w.width * (1 + l); + }); + }), t; +} +var dde = { + startAngle: 90, + clockwise: !0, + splitNumber: 12, + axisLabel: { + rotate: 0 + } +}, vde = { + splitNumber: 5 +}, pde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "polar", e; + }(Sn) +); +function gde(r) { + Kt(gm), uf.registerAxisPointerClass("PolarAxisPointer", Ffe), r.registerCoordinateSystem("polar", ede), r.registerComponentModel(Hfe), r.registerComponentView(pde), Bd(r, "angle", Vfe, dde), Bd(r, "radius", Gfe, vde), r.registerComponentView(ide), r.registerComponentView(cde), r.registerLayout(jt(hde, "bar")); +} +function DT(r, e) { + e = e || {}; + var t = r.coordinateSystem, n = r.axis, i = {}, a = n.position, o = n.orient, s = t.getRect(), l = [s.x, s.x + s.width, s.y, s.y + s.height], u = { + horizontal: { + top: l[2], + bottom: l[3] + }, + vertical: { + left: l[0], + right: l[1] + } + }; + i.position = [o === "vertical" ? u.vertical[a] : l[0], o === "horizontal" ? u.horizontal[a] : l[3]]; + var c = { + horizontal: 0, + vertical: 1 + }; + i.rotation = Math.PI / 2 * c[o]; + var h = { + top: -1, + bottom: 1, + right: 1, + left: -1 + }; + i.labelDirection = i.tickDirection = i.nameDirection = h[a], r.get(["axisTick", "inside"]) && (i.tickDirection = -i.tickDirection), Ii(e.labelInside, r.get(["axisLabel", "inside"])) && (i.labelDirection = -i.labelDirection); + var f = e.rotate; + return f == null && (f = r.get(["axisLabel", "rotate"])), i.labelRotation = a === "top" ? -f : f, i.z2 = 1, i; +} +var mde = ["axisLine", "axisTickLabel", "axisName"], yde = ["splitArea", "splitLine"], _de = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.axisPointerClass = "SingleAxisPointer", t; + } + return e.prototype.render = function(t, n, i, a) { + var o = this.group; + o.removeAll(); + var s = this._axisGroup; + this._axisGroup = new Rt(); + var l = DT(t), u = new au(t, l); + X(mde, u.add, u), o.add(this._axisGroup), o.add(u.getGroup()), X(yde, function(c) { + t.get([c, "show"]) && bde[c](this, this.group, this._axisGroup, t); + }, this), tm(s, this._axisGroup, t), r.prototype.render.call(this, t, n, i, a); + }, e.prototype.remove = function() { + vH(this); + }, e.type = "singleAxis", e; + }(uf) +), bde = { + splitLine: function(r, e, t, n) { + var i = n.axis; + if (!i.scale.isBlank()) { + var a = n.getModel("splitLine"), o = a.getModel("lineStyle"), s = o.get("color"); + s = s instanceof Array ? s : [s]; + for (var l = o.get("width"), u = n.coordinateSystem.getRect(), c = i.isHorizontal(), h = [], f = 0, v = i.getTicksCoords({ + tickModel: a + }), b = [], w = [], p = 0; p < v.length; ++p) { + var d = i.toGlobalCoord(v[p].coord); + c ? (b[0] = d, b[1] = u.y, w[0] = d, w[1] = u.y + u.height) : (b[0] = u.x, b[1] = d, w[0] = u.x + u.width, w[1] = d); + var m = new Ai({ + shape: { + x1: b[0], + y1: b[1], + x2: w[0], + y2: w[1] + }, + silent: !0 + }); + Pd(m.shape, l); + var _ = f++ % s.length; + h[_] = h[_] || [], h[_].push(m); + } + for (var y = o.getLineStyle(["color"]), p = 0; p < h.length; ++p) + e.add(mo(h[p], { + style: Mt({ + stroke: s[p % s.length] + }, y), + silent: !0 + })); + } + }, + splitArea: function(r, e, t, n) { + dH(r, t, n, n); + } +}; +const xde = _de; +var Z3 = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.getCoordSysModel = function() { + return this; + }, e.type = "singleAxis", e.layoutMode = "box", e.defaultOption = { + left: "5%", + top: "5%", + right: "5%", + bottom: "5%", + type: "value", + position: "bottom", + orient: "horizontal", + axisLine: { + show: !0, + lineStyle: { + width: 1, + type: "solid" + } + }, + // Single coordinate system and single axis is the, + // which is used as the parent tooltip model. + // same model, so we set default tooltip show as true. + tooltip: { + show: !0 + }, + axisTick: { + show: !0, + length: 6, + lineStyle: { + width: 1 + } + }, + axisLabel: { + show: !0, + interval: "auto" + }, + splitLine: { + show: !0, + lineStyle: { + type: "dashed", + opacity: 0.2 + } + } + }, e; + }(xr) +); +qn(Z3, cv.prototype); +const aC = Z3; +var Sde = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a, o) { + var s = r.call(this, t, n, i) || this; + return s.type = a || "value", s.position = o || "bottom", s; + } + return e.prototype.isHorizontal = function() { + var t = this.position; + return t === "top" || t === "bottom"; + }, e.prototype.pointToData = function(t, n) { + return this.coordinateSystem.pointToData(t)[0]; + }, e; + }(wo) +); +const wde = Sde; +var J3 = ["single"], Cde = ( + /** @class */ + function() { + function r(e, t, n) { + this.type = "single", this.dimension = "single", this.dimensions = J3, this.axisPointerEnabled = !0, this.model = e, this._init(e, t, n); + } + return r.prototype._init = function(e, t, n) { + var i = this.dimension, a = new wde(i, sm(e), [0, 0], e.get("type"), e.get("position")), o = a.type === "category"; + a.onBand = o && e.get("boundaryGap"), a.inverse = e.get("inverse"), a.orient = e.get("orient"), e.axis = a, a.model = e, a.coordinateSystem = this, this._axis = a; + }, r.prototype.update = function(e, t) { + e.eachSeries(function(n) { + if (n.coordinateSystem === this) { + var i = n.getData(); + X(i.mapDimensionsAll(this.dimension), function(a) { + this._axis.scale.unionExtentFromData(i, a); + }, this), Jh(this._axis.scale, this._axis.model); + } + }, this); + }, r.prototype.resize = function(e, t) { + this._rect = yi({ + left: e.get("left"), + top: e.get("top"), + right: e.get("right"), + bottom: e.get("bottom"), + width: e.get("width"), + height: e.get("height") + }, { + width: t.getWidth(), + height: t.getHeight() + }), this._adjustAxis(); + }, r.prototype.getRect = function() { + return this._rect; + }, r.prototype._adjustAxis = function() { + var e = this._rect, t = this._axis, n = t.isHorizontal(), i = n ? [0, e.width] : [0, e.height], a = t.inverse ? 1 : 0; + t.setExtent(i[a], i[1 - a]), this._updateAxisTransform(t, n ? e.x : e.y); + }, r.prototype._updateAxisTransform = function(e, t) { + var n = e.getExtent(), i = n[0] + n[1], a = e.isHorizontal(); + e.toGlobalCoord = a ? function(o) { + return o + t; + } : function(o) { + return i - o + t; + }, e.toLocalCoord = a ? function(o) { + return o - t; + } : function(o) { + return i - o + t; + }; + }, r.prototype.getAxis = function() { + return this._axis; + }, r.prototype.getBaseAxis = function() { + return this._axis; + }, r.prototype.getAxes = function() { + return [this._axis]; + }, r.prototype.getTooltipAxes = function() { + return { + baseAxes: [this.getAxis()], + // Empty otherAxes + otherAxes: [] + }; + }, r.prototype.containPoint = function(e) { + var t = this.getRect(), n = this.getAxis(), i = n.orient; + return i === "horizontal" ? n.contain(n.toLocalCoord(e[0])) && e[1] >= t.y && e[1] <= t.y + t.height : n.contain(n.toLocalCoord(e[1])) && e[0] >= t.y && e[0] <= t.y + t.height; + }, r.prototype.pointToData = function(e) { + var t = this.getAxis(); + return [t.coordToData(t.toLocalCoord(e[t.orient === "horizontal" ? 0 : 1]))]; + }, r.prototype.dataToPoint = function(e) { + var t = this.getAxis(), n = this.getRect(), i = [], a = t.orient === "horizontal" ? 0 : 1; + return e instanceof Array && (e = e[0]), i[a] = t.toGlobalCoord(t.dataToCoord(+e)), i[1 - a] = a === 0 ? n.y + n.height / 2 : n.x + n.width / 2, i; + }, r.prototype.convertToPixel = function(e, t, n) { + var i = hR(t); + return i === this ? this.dataToPoint(n) : null; + }, r.prototype.convertFromPixel = function(e, t, n) { + var i = hR(t); + return i === this ? this.pointToData(n) : null; + }, r; + }() +); +function hR(r) { + var e = r.seriesModel, t = r.singleAxisModel; + return t && t.coordinateSystem || e && e.coordinateSystem; +} +function Tde(r, e) { + var t = []; + return r.eachComponent("singleAxis", function(n, i) { + var a = new Cde(n, r, e); + a.name = "single_" + i, a.resize(n, e), n.coordinateSystem = a, t.push(a); + }), r.eachSeries(function(n) { + if (n.get("coordinateSystem") === "singleAxis") { + var i = n.getReferringComponents("singleAxis", mi).models[0]; + n.coordinateSystem = i && i.coordinateSystem; + } + }), t; +} +var Ide = { + create: Tde, + dimensions: J3 +}; +const Ade = Ide; +var fR = ["x", "y"], Ede = ["width", "height"], Mde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.makeElOption = function(t, n, i, a, o) { + var s = i.axis, l = s.coordinateSystem, u = oC(l, 1 - Z_(s)), c = l.dataToPoint(n)[0], h = a.get("type"); + if (h && h !== "none") { + var f = DE(a), v = Dde[h](s, c, u); + v.style = f, t.graphicKey = v.type, t.pointer = v; + } + var b = DT(i); + H3( + // @ts-ignore + n, + t, + b, + i, + a, + o + ); + }, e.prototype.getHandleTransform = function(t, n, i) { + var a = DT(n, { + labelInside: !1 + }); + a.labelMargin = i.get(["handle", "margin"]); + var o = kE(n.axis, t, a); + return { + x: o[0], + y: o[1], + rotation: a.rotation + (a.labelDirection < 0 ? Math.PI : 0) + }; + }, e.prototype.updateHandleTransform = function(t, n, i, a) { + var o = i.axis, s = o.coordinateSystem, l = Z_(o), u = oC(s, l), c = [t.x, t.y]; + c[l] += n[l], c[l] = Math.min(u[1], c[l]), c[l] = Math.max(u[0], c[l]); + var h = oC(s, 1 - l), f = (h[1] + h[0]) / 2, v = [f, f]; + return v[l] = c[l], { + x: c[0], + y: c[1], + rotation: t.rotation, + cursorPoint: v, + tooltipOption: { + verticalAlign: "middle" + } + }; + }, e; + }(ME) +), Dde = { + line: function(r, e, t) { + var n = OE([e, t[0]], [e, t[1]], Z_(r)); + return { + type: "Line", + subPixelOptimize: !0, + shape: n + }; + }, + shadow: function(r, e, t) { + var n = r.getBandWidth(), i = t[1] - t[0]; + return { + type: "Rect", + shape: V3([e - n / 2, t[0]], [n, i], Z_(r)) + }; + } +}; +function Z_(r) { + return r.isHorizontal() ? 0 : 1; +} +function oC(r, e) { + var t = r.getRect(); + return [t[fR[e]], t[fR[e]] + t[Ede[e]]]; +} +const kde = Mde; +var Ode = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "single", e; + }(Sn) +); +function Lde(r) { + Kt(gm), uf.registerAxisPointerClass("SingleAxisPointer", kde), r.registerComponentView(Ode), r.registerComponentView(xde), r.registerComponentModel(aC), Bd(r, "single", aC, aC.defaultOption), r.registerCoordinateSystem("single", Ade); +} +var Pde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n, i) { + var a = rv(t); + r.prototype.init.apply(this, arguments), dR(t, a); + }, e.prototype.mergeOption = function(t) { + r.prototype.mergeOption.apply(this, arguments), dR(this.option, t); + }, e.prototype.getCellSize = function() { + return this.option.cellSize; + }, e.type = "calendar", e.defaultOption = { + // zlevel: 0, + z: 2, + left: 80, + top: 60, + cellSize: 20, + // horizontal vertical + orient: "horizontal", + // month separate line style + splitLine: { + show: !0, + lineStyle: { + color: "#000", + width: 1, + type: "solid" + } + }, + // rect style temporarily unused emphasis + itemStyle: { + color: "#fff", + borderWidth: 1, + borderColor: "#ccc" + }, + // week text style + dayLabel: { + show: !0, + firstDay: 0, + // start end + position: "start", + margin: "50%", + color: "#000" + }, + // month text style + monthLabel: { + show: !0, + // start end + position: "start", + margin: 5, + // center or left + align: "center", + formatter: null, + color: "#000" + }, + // year text style + yearLabel: { + show: !0, + // top bottom left right + position: null, + margin: 30, + formatter: null, + color: "#ccc", + fontFamily: "sans-serif", + fontWeight: "bolder", + fontSize: 20 + } + }, e; + }(xr) +); +function dR(r, e) { + var t = r.cellSize, n; + We(t) ? n = t : n = r.cellSize = [t, t], n.length === 1 && (n[1] = n[0]); + var i = Ke([0, 1], function(a) { + return YK(e, a) && (n[a] = "auto"), n[a] != null && n[a] !== "auto"; + }); + vc(r, e, { + type: "box", + ignoreSize: i + }); +} +const Rde = Pde; +var Nde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + var a = this.group; + a.removeAll(); + var o = t.coordinateSystem, s = o.getRangeInfo(), l = o.getOrient(), u = n.getLocaleModel(); + this._renderDayRect(t, s, a), this._renderLines(t, s, l, a), this._renderYearText(t, s, l, a), this._renderMonthText(t, u, l, a), this._renderWeekText(t, u, s, l, a); + }, e.prototype._renderDayRect = function(t, n, i) { + for (var a = t.coordinateSystem, o = t.getModel("itemStyle").getItemStyle(), s = a.getCellWidth(), l = a.getCellHeight(), u = n.start.time; u <= n.end.time; u = a.getNextNDay(u, 1).time) { + var c = a.dataToRect([u], !1).tl, h = new Or({ + shape: { + x: c[0], + y: c[1], + width: s, + height: l + }, + cursor: "default", + style: o + }); + i.add(h); + } + }, e.prototype._renderLines = function(t, n, i, a) { + var o = this, s = t.coordinateSystem, l = t.getModel(["splitLine", "lineStyle"]).getLineStyle(), u = t.get(["splitLine", "show"]), c = l.lineWidth; + this._tlpoints = [], this._blpoints = [], this._firstDayOfMonth = [], this._firstDayPoints = []; + for (var h = n.start, f = 0; h.time <= n.end.time; f++) { + b(h.formatedDate), f === 0 && (h = s.getDateInfo(n.start.y + "-" + n.start.m)); + var v = h.date; + v.setMonth(v.getMonth() + 1), h = s.getDateInfo(v); + } + b(s.getNextNDay(n.end.time, 1).formatedDate); + function b(w) { + o._firstDayOfMonth.push(s.getDateInfo(w)), o._firstDayPoints.push(s.dataToRect([w], !1).tl); + var p = o._getLinePointsOfOneWeek(t, w, i); + o._tlpoints.push(p[0]), o._blpoints.push(p[p.length - 1]), u && o._drawSplitline(p, l, a); + } + u && this._drawSplitline(o._getEdgesPoints(o._tlpoints, c, i), l, a), u && this._drawSplitline(o._getEdgesPoints(o._blpoints, c, i), l, a); + }, e.prototype._getEdgesPoints = function(t, n, i) { + var a = [t[0].slice(), t[t.length - 1].slice()], o = i === "horizontal" ? 0 : 1; + return a[0][o] = a[0][o] - n / 2, a[1][o] = a[1][o] + n / 2, a; + }, e.prototype._drawSplitline = function(t, n, i) { + var a = new Pa({ + z2: 20, + shape: { + points: t + }, + style: n + }); + i.add(a); + }, e.prototype._getLinePointsOfOneWeek = function(t, n, i) { + for (var a = t.coordinateSystem, o = a.getDateInfo(n), s = [], l = 0; l < 7; l++) { + var u = a.getNextNDay(o.time, l), c = a.dataToRect([u.time], !1); + s[2 * u.day] = c.tl, s[2 * u.day + 1] = c[i === "horizontal" ? "bl" : "tr"]; + } + return s; + }, e.prototype._formatterLabel = function(t, n) { + return ut(t) && t ? VK(t, n) : Tt(t) ? t(n) : n.nameMap; + }, e.prototype._yearTextPositionControl = function(t, n, i, a, o) { + var s = n[0], l = n[1], u = ["center", "bottom"]; + a === "bottom" ? (l += o, u = ["center", "top"]) : a === "left" ? s -= o : a === "right" ? (s += o, u = ["center", "top"]) : l -= o; + var c = 0; + return (a === "left" || a === "right") && (c = Math.PI / 2), { + rotation: c, + x: s, + y: l, + style: { + align: u[0], + verticalAlign: u[1] + } + }; + }, e.prototype._renderYearText = function(t, n, i, a) { + var o = t.getModel("yearLabel"); + if (o.get("show")) { + var s = o.get("margin"), l = o.get("position"); + l || (l = i !== "horizontal" ? "top" : "left"); + var u = [this._tlpoints[this._tlpoints.length - 1], this._blpoints[0]], c = (u[0][0] + u[1][0]) / 2, h = (u[0][1] + u[1][1]) / 2, f = i === "horizontal" ? 0 : 1, v = { + top: [c, u[f][1]], + bottom: [c, u[1 - f][1]], + left: [u[1 - f][0], h], + right: [u[f][0], h] + }, b = n.start.y; + +n.end.y > +n.start.y && (b = b + "-" + n.end.y); + var w = o.get("formatter"), p = { + start: n.start.y, + end: n.end.y, + nameMap: b + }, d = this._formatterLabel(w, p), m = new kr({ + z2: 30, + style: gn(o, { + text: d + }) + }); + m.attr(this._yearTextPositionControl(m, v[l], i, l, s)), a.add(m); + } + }, e.prototype._monthTextPositionControl = function(t, n, i, a, o) { + var s = "left", l = "top", u = t[0], c = t[1]; + return i === "horizontal" ? (c = c + o, n && (s = "center"), a === "start" && (l = "bottom")) : (u = u + o, n && (l = "middle"), a === "start" && (s = "right")), { + x: u, + y: c, + align: s, + verticalAlign: l + }; + }, e.prototype._renderMonthText = function(t, n, i, a) { + var o = t.getModel("monthLabel"); + if (o.get("show")) { + var s = o.get("nameMap"), l = o.get("margin"), u = o.get("position"), c = o.get("align"), h = [this._tlpoints, this._blpoints]; + (!s || ut(s)) && (s && (n = F1(s) || n), s = n.get(["time", "monthAbbr"]) || []); + var f = u === "start" ? 0 : 1, v = i === "horizontal" ? 0 : 1; + l = u === "start" ? -l : l; + for (var b = c === "center", w = 0; w < h[f].length - 1; w++) { + var p = h[f][w].slice(), d = this._firstDayOfMonth[w]; + if (b) { + var m = this._firstDayPoints[w]; + p[v] = (m[v] + h[0][w + 1][v]) / 2; + } + var _ = o.get("formatter"), y = s[+d.m - 1], x = { + yyyy: d.y, + yy: (d.y + "").slice(2), + MM: d.m, + M: +d.m, + nameMap: y + }, g = this._formatterLabel(_, x), S = new kr({ + z2: 30, + style: Fe(gn(o, { + text: g + }), this._monthTextPositionControl(p, b, i, u, l)) + }); + a.add(S); + } + } + }, e.prototype._weekTextPositionControl = function(t, n, i, a, o) { + var s = "center", l = "middle", u = t[0], c = t[1], h = i === "start"; + return n === "horizontal" ? (u = u + a + (h ? 1 : -1) * o[0] / 2, s = h ? "right" : "left") : (c = c + a + (h ? 1 : -1) * o[1] / 2, l = h ? "bottom" : "top"), { + x: u, + y: c, + align: s, + verticalAlign: l + }; + }, e.prototype._renderWeekText = function(t, n, i, a, o) { + var s = t.getModel("dayLabel"); + if (s.get("show")) { + var l = t.coordinateSystem, u = s.get("position"), c = s.get("nameMap"), h = s.get("margin"), f = l.getFirstDayOfWeek(); + if (!c || ut(c)) { + c && (n = F1(c) || n); + var v = n.get(["time", "dayOfWeekShort"]); + c = v || Ke(n.get(["time", "dayOfWeekAbbr"]), function(x) { + return x[0]; + }); + } + var b = l.getNextNDay(i.end.time, 7 - i.lweek).time, w = [l.getCellWidth(), l.getCellHeight()]; + h = ot(h, Math.min(w[1], w[0])), u === "start" && (b = l.getNextNDay(i.start.time, -(7 + i.fweek)).time, h = -h); + for (var p = 0; p < 7; p++) { + var d = l.getNextNDay(b, p), m = l.dataToRect([d.time], !1).center, _ = p; + _ = Math.abs((p + f) % 7); + var y = new kr({ + z2: 30, + style: Fe(gn(s, { + text: c[_] + }), this._weekTextPositionControl(m, a, u, h, w)) + }); + o.add(y); + } + } + }, e.type = "calendar", e; + }(Sn) +); +const zde = Nde; +var sC = 864e5, Bde = ( + /** @class */ + function() { + function r(e, t, n) { + this.type = "calendar", this.dimensions = r.dimensions, this.getDimensionsInfo = r.getDimensionsInfo, this._model = e; + } + return r.getDimensionsInfo = function() { + return [{ + name: "time", + type: "time" + }, "value"]; + }, r.prototype.getRangeInfo = function() { + return this._rangeInfo; + }, r.prototype.getModel = function() { + return this._model; + }, r.prototype.getRect = function() { + return this._rect; + }, r.prototype.getCellWidth = function() { + return this._sw; + }, r.prototype.getCellHeight = function() { + return this._sh; + }, r.prototype.getOrient = function() { + return this._orient; + }, r.prototype.getFirstDayOfWeek = function() { + return this._firstDayOfWeek; + }, r.prototype.getDateInfo = function(e) { + e = So(e); + var t = e.getFullYear(), n = e.getMonth() + 1, i = n < 10 ? "0" + n : "" + n, a = e.getDate(), o = a < 10 ? "0" + a : "" + a, s = e.getDay(); + return s = Math.abs((s + 7 - this.getFirstDayOfWeek()) % 7), { + y: t + "", + m: i, + d: o, + day: s, + time: e.getTime(), + formatedDate: t + "-" + i + "-" + o, + date: e + }; + }, r.prototype.getNextNDay = function(e, t) { + return t = t || 0, t === 0 ? this.getDateInfo(e) : (e = new Date(this.getDateInfo(e).time), e.setDate(e.getDate() + t), this.getDateInfo(e)); + }, r.prototype.update = function(e, t) { + this._firstDayOfWeek = +this._model.getModel("dayLabel").get("firstDay"), this._orient = this._model.get("orient"), this._lineWidth = this._model.getModel("itemStyle").getItemStyle().lineWidth || 0, this._rangeInfo = this._getRangeInfo(this._initRangeOption()); + var n = this._rangeInfo.weeks || 1, i = ["width", "height"], a = this._model.getCellSize().slice(), o = this._model.getBoxLayoutParams(), s = this._orient === "horizontal" ? [n, 7] : [7, n]; + X([0, 1], function(h) { + c(a, h) && (o[i[h]] = a[h] * s[h]); + }); + var l = { + width: t.getWidth(), + height: t.getHeight() + }, u = this._rect = yi(o, l); + X([0, 1], function(h) { + c(a, h) || (a[h] = u[i[h]] / s[h]); + }); + function c(h, f) { + return h[f] != null && h[f] !== "auto"; + } + this._sw = a[0], this._sh = a[1]; + }, r.prototype.dataToPoint = function(e, t) { + We(e) && (e = e[0]), t == null && (t = !0); + var n = this.getDateInfo(e), i = this._rangeInfo, a = n.formatedDate; + if (t && !(n.time >= i.start.time && n.time < i.end.time + sC)) + return [NaN, NaN]; + var o = n.day, s = this._getRangeInfo([i.start.time, a]).nthWeek; + return this._orient === "vertical" ? [this._rect.x + o * this._sw + this._sw / 2, this._rect.y + s * this._sh + this._sh / 2] : [this._rect.x + s * this._sw + this._sw / 2, this._rect.y + o * this._sh + this._sh / 2]; + }, r.prototype.pointToData = function(e) { + var t = this.pointToDate(e); + return t && t.time; + }, r.prototype.dataToRect = function(e, t) { + var n = this.dataToPoint(e, t); + return { + contentShape: { + x: n[0] - (this._sw - this._lineWidth) / 2, + y: n[1] - (this._sh - this._lineWidth) / 2, + width: this._sw - this._lineWidth, + height: this._sh - this._lineWidth + }, + center: n, + tl: [n[0] - this._sw / 2, n[1] - this._sh / 2], + tr: [n[0] + this._sw / 2, n[1] - this._sh / 2], + br: [n[0] + this._sw / 2, n[1] + this._sh / 2], + bl: [n[0] - this._sw / 2, n[1] + this._sh / 2] + }; + }, r.prototype.pointToDate = function(e) { + var t = Math.floor((e[0] - this._rect.x) / this._sw) + 1, n = Math.floor((e[1] - this._rect.y) / this._sh) + 1, i = this._rangeInfo.range; + return this._orient === "vertical" ? this._getDateByWeeksAndDay(n, t - 1, i) : this._getDateByWeeksAndDay(t, n - 1, i); + }, r.prototype.convertToPixel = function(e, t, n) { + var i = vR(t); + return i === this ? i.dataToPoint(n) : null; + }, r.prototype.convertFromPixel = function(e, t, n) { + var i = vR(t); + return i === this ? i.pointToData(n) : null; + }, r.prototype.containPoint = function(e) { + return console.warn("Not implemented."), !1; + }, r.prototype._initRangeOption = function() { + var e = this._model.get("range"), t; + if (We(e) && e.length === 1 && (e = e[0]), We(e)) + t = e; + else { + var n = e.toString(); + if (/^\d{4}$/.test(n) && (t = [n + "-01-01", n + "-12-31"]), /^\d{4}[\/|-]\d{1,2}$/.test(n)) { + var i = this.getDateInfo(n), a = i.date; + a.setMonth(a.getMonth() + 1); + var o = this.getNextNDay(a, -1); + t = [i.formatedDate, o.formatedDate]; + } + /^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(n) && (t = [n, n]); + } + if (!t) + return e; + var s = this._getRangeInfo(t); + return s.start.time > s.end.time && t.reverse(), t; + }, r.prototype._getRangeInfo = function(e) { + var t = [this.getDateInfo(e[0]), this.getDateInfo(e[1])], n; + t[0].time > t[1].time && (n = !0, t.reverse()); + var i = Math.floor(t[1].time / sC) - Math.floor(t[0].time / sC) + 1, a = new Date(t[0].time), o = a.getDate(), s = t[1].date.getDate(); + a.setDate(o + i - 1); + var l = a.getDate(); + if (l !== s) + for (var u = a.getTime() - t[1].time > 0 ? 1 : -1; (l = a.getDate()) !== s && (a.getTime() - t[1].time) * u > 0; ) + i -= u, a.setDate(l - u); + var c = Math.floor((i + t[0].day + 6) / 7), h = n ? -c + 1 : c - 1; + return n && t.reverse(), { + range: [t[0].formatedDate, t[1].formatedDate], + start: t[0], + end: t[1], + allDay: i, + weeks: c, + // From 0. + nthWeek: h, + fweek: t[0].day, + lweek: t[1].day + }; + }, r.prototype._getDateByWeeksAndDay = function(e, t, n) { + var i = this._getRangeInfo(n); + if (e > i.weeks || e === 0 && t < i.fweek || e === i.weeks && t > i.lweek) + return null; + var a = (e - 1) * 7 - i.fweek + t, o = new Date(i.start.time); + return o.setDate(+i.start.d + a), this.getDateInfo(o); + }, r.create = function(e, t) { + var n = []; + return e.eachComponent("calendar", function(i) { + var a = new r(i); + n.push(a), i.coordinateSystem = a; + }), e.eachSeries(function(i) { + i.get("coordinateSystem") === "calendar" && (i.coordinateSystem = n[i.get("calendarIndex") || 0]); + }), n; + }, r.dimensions = ["time", "value"], r; + }() +); +function vR(r) { + var e = r.calendarModel, t = r.seriesModel, n = e ? e.coordinateSystem : t ? t.coordinateSystem : null; + return n; +} +const jde = Bde; +function Fde(r) { + r.registerComponentModel(Rde), r.registerComponentView(zde), r.registerCoordinateSystem("calendar", jde); +} +function $de(r, e) { + var t = r.existing; + if (e.id = r.keyInfo.id, !e.type && t && (e.type = t.type), e.parentId == null) { + var n = e.parentOption; + n ? e.parentId = n.id : t && (e.parentId = t.parentId); + } + e.parentOption = null; +} +function pR(r, e) { + var t; + return X(e, function(n) { + r[n] != null && r[n] !== "auto" && (t = !0); + }), t; +} +function Hde(r, e, t) { + var n = Fe({}, t), i = r[e], a = t.$action || "merge"; + a === "merge" ? i ? (Ut(i, n, !0), vc(i, n, { + ignoreSize: !0 + }), _F(t, i), v0(t, i), v0(t, i, "shape"), v0(t, i, "style"), v0(t, i, "extra"), t.clipPath = i.clipPath) : r[e] = n : a === "replace" ? r[e] = n : a === "remove" && i && (r[e] = null); +} +var K3 = ["transition", "enterFrom", "leaveTo"], Vde = K3.concat(["enterAnimation", "updateAnimation", "leaveAnimation"]); +function v0(r, e, t) { + if (t && (!r[t] && e[t] && (r[t] = {}), r = r[t], e = e[t]), !(!r || !e)) + for (var n = t ? K3 : Vde, i = 0; i < n.length; i++) { + var a = n[i]; + r[a] == null && e[a] != null && (r[a] = e[a]); + } +} +function Gde(r, e) { + if (r && (r.hv = e.hv = [ + // Rigid body, don't care about `width`. + pR(e, ["left", "right"]), + // Rigid body, don't care about `height`. + pR(e, ["top", "bottom"]) + ], r.type === "group")) { + var t = r, n = e; + t.width == null && (t.width = n.width = 0), t.height == null && (t.height = n.height = 0); + } +} +var Ude = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.preventAutoZ = !0, t; + } + return e.prototype.mergeOption = function(t, n) { + var i = this.option.elements; + this.option.elements = null, r.prototype.mergeOption.call(this, t, n), this.option.elements = i; + }, e.prototype.optionUpdated = function(t, n) { + var i = this.option, a = (n ? i : t).elements, o = i.elements = n ? [] : i.elements, s = []; + this._flatten(a, s, null); + var l = r5(o, s, "normalMerge"), u = this._elOptionsToUpdate = []; + X(l, function(c, h) { + var f = c.newOption; + f && (u.push(f), $de(c, f), Hde(o, h, f), Gde(o[h], f)); + }, this), i.elements = Jr(o, function(c) { + return c && delete c.$action, c != null; + }); + }, e.prototype._flatten = function(t, n, i) { + X(t, function(a) { + if (a) { + i && (a.parentOption = i), n.push(a); + var o = a.children; + o && o.length && this._flatten(o, n, a), delete a.children; + } + }, this); + }, e.prototype.useElOptionsToUpdate = function() { + var t = this._elOptionsToUpdate; + return this._elOptionsToUpdate = null, t; + }, e.type = "graphic", e.defaultOption = { + elements: [] + // parentId: null + }, e; + }(xr) +), gR = { + // Reserved but not supported in graphic component. + path: null, + compoundPath: null, + // Supported in graphic component. + group: Rt, + image: ji, + text: kr +}, Yo = Rr(), Wde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function() { + this._elMap = xt(); + }, e.prototype.render = function(t, n, i) { + t !== this._lastGraphicModel && this._clear(), this._lastGraphicModel = t, this._updateElements(t), this._relocate(t, i); + }, e.prototype._updateElements = function(t) { + var n = t.useElOptionsToUpdate(); + if (n) { + var i = this._elMap, a = this.group, o = t.get("z"), s = t.get("zlevel"); + X(n, function(l) { + var u = Si(l.id, null), c = u != null ? i.get(u) : null, h = Si(l.parentId, null), f = h != null ? i.get(h) : a, v = l.type, b = l.style; + v === "text" && b && l.hv && l.hv[1] && (b.textVerticalAlign = b.textBaseline = b.verticalAlign = b.align = null); + var w = l.textContent, p = l.textConfig; + if (b && D3(b, v, !!p, !!w)) { + var d = k3(b, v, !0); + !p && d.textConfig && (p = l.textConfig = d.textConfig), !w && d.textContent && (w = d.textContent); + } + var m = Yde(l), _ = l.$action || "merge", y = _ === "merge", x = _ === "replace"; + if (y) { + var g = !c, S = c; + g ? S = mR(u, f, l.type, i) : (S && (Yo(S).isNew = !1), R3(S)), S && (W0(S, m, t, { + isInit: g + }), yR(S, l, o, s)); + } else if (x) { + X0(c, l, i, t); + var T = mR(u, f, l.type, i); + T && (W0(T, m, t, { + isInit: !0 + }), yR(T, l, o, s)); + } else + _ === "remove" && (L3(c, l), X0(c, l, i, t)); + var C = i.get(u); + if (C && w) + if (y) { + var E = C.getTextContent(); + E ? E.attr(w) : C.setTextContent(new kr(w)); + } else + x && C.setTextContent(new kr(w)); + if (C) { + var M = l.clipPath; + if (M) { + var P = M.type, R = void 0, g = !1; + if (y) { + var N = C.getClipPath(); + g = !N || Yo(N).type !== P, R = g ? kT(P) : N; + } else + x && (g = !0, R = kT(P)); + C.setClipPath(R), W0(R, M, t, { + isInit: g + }), Y_(R, M.keyframeAnimation, t); + } + var F = Yo(C); + C.setTextConfig(p), F.option = l, Xde(C, t, l), qd({ + el: C, + componentModel: t, + itemName: C.name, + itemTooltipOption: l.tooltip + }), Y_(C, l.keyframeAnimation, t); + } + }); + } + }, e.prototype._relocate = function(t, n) { + for (var i = t.option.elements, a = this.group, o = this._elMap, s = n.getWidth(), l = n.getHeight(), u = ["x", "y"], c = 0; c < i.length; c++) { + var h = i[c], f = Si(h.id, null), v = f != null ? o.get(f) : null; + if (!(!v || !v.isGroup)) { + var b = v.parent, w = b === a, p = Yo(v), d = Yo(b); + p.width = ot(p.option.width, w ? s : d.width) || 0, p.height = ot(p.option.height, w ? l : d.height) || 0; + } + } + for (var c = i.length - 1; c >= 0; c--) { + var h = i[c], f = Si(h.id, null), v = f != null ? o.get(f) : null; + if (v) { + var b = v.parent, d = Yo(b), m = b === a ? { + width: s, + height: l + } : { + width: d.width, + height: d.height + }, _ = {}, y = Xb(v, h, m, null, { + hv: h.hv, + boundingMode: h.bounding + }, _); + if (!Yo(v).isNew && y) { + for (var x = h.transition, g = {}, S = 0; S < u.length; S++) { + var T = u[S], C = _[T]; + x && (Fh(x) || ir(x, T) >= 0) ? g[T] = C : v[T] = C; + } + zr(v, g, t, 0); + } else + v.attr(_); + } + } + }, e.prototype._clear = function() { + var t = this, n = this._elMap; + n.each(function(i) { + X0(i, Yo(i).option, n, t._lastGraphicModel); + }), this._elMap = xt(); + }, e.prototype.dispose = function() { + this._clear(); + }, e.type = "graphic", e; + }(Sn) +); +function kT(r) { + var e = gt(gR, r) ? gR[r] : Fb(r), t = new e({}); + return Yo(t).type = r, t; +} +function mR(r, e, t, n) { + var i = kT(t); + return e.add(i), n.set(r, i), Yo(i).id = r, Yo(i).isNew = !0, i; +} +function X0(r, e, t, n) { + var i = r && r.parent; + i && (r.type === "group" && r.traverse(function(a) { + X0(a, e, t, n); + }), vx(r, e, n), t.removeKey(Yo(r).id)); +} +function yR(r, e, t, n) { + r.isGroup || X([ + ["cursor", ts.prototype.cursor], + // We should not support configure z and zlevel in the element level. + // But seems we didn't limit it previously. So here still use it to avoid breaking. + ["zlevel", n || 0], + ["z", t || 0], + // z2 must not be null/undefined, otherwise sort error may occur. + ["z2", 0] + ], function(i) { + var a = i[0]; + gt(e, a) ? r[a] = Jt(e[a], i[1]) : r[a] == null && (r[a] = i[1]); + }), X(yr(e), function(i) { + if (i.indexOf("on") === 0) { + var a = e[i]; + r[i] = Tt(a) ? a : null; + } + }), gt(e, "draggable") && (r.draggable = e.draggable), e.name != null && (r.name = e.name), e.id != null && (r.id = e.id); +} +function Yde(r) { + return r = Fe({}, r), X(["id", "parentId", "$action", "hv", "bounding", "textContent", "clipPath"].concat(yF), function(e) { + delete r[e]; + }), r; +} +function Xde(r, e, t) { + var n = Ft(r).eventData; + !r.silent && !r.ignore && !n && (n = Ft(r).eventData = { + componentType: "graphic", + componentIndex: e.componentIndex, + name: r.name + }), n && (n.info = t.info); +} +function Zde(r) { + r.registerComponentModel(Ude), r.registerComponentView(Wde), r.registerPreprocessor(function(e) { + var t = e.graphic; + We(t) ? !t[0] || !t[0].elements ? e.graphic = [{ + elements: t + }] : e.graphic = [e.graphic[0]] : t && !t.elements && (e.graphic = [{ + elements: [t] + }]); + }); +} +var _R = ["x", "y", "radius", "angle", "single"], Jde = ["cartesian2d", "polar", "singleAxis"]; +function Kde(r) { + var e = r.get("coordinateSystem"); + return ir(Jde, e) >= 0; +} +function qu(r) { + return r + "Axis"; +} +function Qde(r, e) { + var t = xt(), n = [], i = xt(); + r.eachComponent({ + mainType: "dataZoom", + query: e + }, function(c) { + i.get(c.uid) || s(c); + }); + var a; + do + a = !1, r.eachComponent("dataZoom", o); + while (a); + function o(c) { + !i.get(c.uid) && l(c) && (s(c), a = !0); + } + function s(c) { + i.set(c.uid, !0), n.push(c), u(c); + } + function l(c) { + var h = !1; + return c.eachTargetAxis(function(f, v) { + var b = t.get(f); + b && b[v] && (h = !0); + }), h; + } + function u(c) { + c.eachTargetAxis(function(h, f) { + (t.get(h) || t.set(h, []))[f] = !0; + }); + } + return n; +} +function Q3(r) { + var e = r.ecModel, t = { + infoList: [], + infoMap: xt() + }; + return r.eachTargetAxis(function(n, i) { + var a = e.getComponent(qu(n), i); + if (a) { + var o = a.getCoordSysModel(); + if (o) { + var s = o.uid, l = t.infoMap.get(s); + l || (l = { + model: o, + axisModels: [] + }, t.infoList.push(l), t.infoMap.set(s, l)), l.axisModels.push(a); + } + } + }), t; +} +var lC = ( + /** @class */ + function() { + function r() { + this.indexList = [], this.indexMap = []; + } + return r.prototype.add = function(e) { + this.indexMap[e] || (this.indexList.push(e), this.indexMap[e] = !0); + }, r; + }() +), qde = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._autoThrottle = !0, t._noTarget = !0, t._rangePropMode = ["percent", "percent"], t; + } + return e.prototype.init = function(t, n, i) { + var a = bR(t); + this.settledOption = a, this.mergeDefaultAndTheme(t, i), this._doInit(a); + }, e.prototype.mergeOption = function(t) { + var n = bR(t); + Ut(this.option, t, !0), Ut(this.settledOption, n, !0), this._doInit(n); + }, e.prototype._doInit = function(t) { + var n = this.option; + this._setDefaultThrottle(t), this._updateRangeUse(t); + var i = this.settledOption; + X([["start", "startValue"], ["end", "endValue"]], function(a, o) { + this._rangePropMode[o] === "value" && (n[a[0]] = i[a[0]] = null); + }, this), this._resetTarget(); + }, e.prototype._resetTarget = function() { + var t = this.get("orient", !0), n = this._targetAxisInfoMap = xt(), i = this._fillSpecifiedTargetAxis(n); + i ? this._orient = t || this._makeAutoOrientByTargetAxis() : (this._orient = t || "horizontal", this._fillAutoTargetAxisByOrient(n, this._orient)), this._noTarget = !0, n.each(function(a) { + a.indexList.length && (this._noTarget = !1); + }, this); + }, e.prototype._fillSpecifiedTargetAxis = function(t) { + var n = !1; + return X(_R, function(i) { + var a = this.getReferringComponents(qu(i), IZ); + if (a.specified) { + n = !0; + var o = new lC(); + X(a.models, function(s) { + o.add(s.componentIndex); + }), t.set(i, o); + } + }, this), n; + }, e.prototype._fillAutoTargetAxisByOrient = function(t, n) { + var i = this.ecModel, a = !0; + if (a) { + var o = n === "vertical" ? "y" : "x", s = i.findComponents({ + mainType: o + "Axis" + }); + l(s, o); + } + if (a) { + var s = i.findComponents({ + mainType: "singleAxis", + filter: function(c) { + return c.get("orient", !0) === n; + } + }); + l(s, "single"); + } + function l(u, c) { + var h = u[0]; + if (h) { + var f = new lC(); + if (f.add(h.componentIndex), t.set(c, f), a = !1, c === "x" || c === "y") { + var v = h.getReferringComponents("grid", mi).models[0]; + v && X(u, function(b) { + h.componentIndex !== b.componentIndex && v === b.getReferringComponents("grid", mi).models[0] && f.add(b.componentIndex); + }); + } + } + } + a && X(_R, function(u) { + if (a) { + var c = i.findComponents({ + mainType: qu(u), + filter: function(f) { + return f.get("type", !0) === "category"; + } + }); + if (c[0]) { + var h = new lC(); + h.add(c[0].componentIndex), t.set(u, h), a = !1; + } + } + }, this); + }, e.prototype._makeAutoOrientByTargetAxis = function() { + var t; + return this.eachTargetAxis(function(n) { + !t && (t = n); + }, this), t === "y" ? "vertical" : "horizontal"; + }, e.prototype._setDefaultThrottle = function(t) { + if (t.hasOwnProperty("throttle") && (this._autoThrottle = !1), this._autoThrottle) { + var n = this.ecModel.option; + this.option.throttle = n.animation && n.animationDurationUpdate > 0 ? 100 : 20; + } + }, e.prototype._updateRangeUse = function(t) { + var n = this._rangePropMode, i = this.get("rangeMode"); + X([["start", "startValue"], ["end", "endValue"]], function(a, o) { + var s = t[a[0]] != null, l = t[a[1]] != null; + s && !l ? n[o] = "percent" : !s && l ? n[o] = "value" : i ? n[o] = i[o] : s && (n[o] = "percent"); + }); + }, e.prototype.noTarget = function() { + return this._noTarget; + }, e.prototype.getFirstTargetAxisModel = function() { + var t; + return this.eachTargetAxis(function(n, i) { + t == null && (t = this.ecModel.getComponent(qu(n), i)); + }, this), t; + }, e.prototype.eachTargetAxis = function(t, n) { + this._targetAxisInfoMap.each(function(i, a) { + X(i.indexList, function(o) { + t.call(n, a, o); + }); + }); + }, e.prototype.getAxisProxy = function(t, n) { + var i = this.getAxisModel(t, n); + if (i) + return i.__dzAxisProxy; + }, e.prototype.getAxisModel = function(t, n) { + var i = this._targetAxisInfoMap.get(t); + if (i && i.indexMap[n]) + return this.ecModel.getComponent(qu(t), n); + }, e.prototype.setRawRange = function(t) { + var n = this.option, i = this.settledOption; + X([["start", "startValue"], ["end", "endValue"]], function(a) { + (t[a[0]] != null || t[a[1]] != null) && (n[a[0]] = i[a[0]] = t[a[0]], n[a[1]] = i[a[1]] = t[a[1]]); + }, this), this._updateRangeUse(t); + }, e.prototype.setCalculatedRange = function(t) { + var n = this.option; + X(["start", "startValue", "end", "endValue"], function(i) { + n[i] = t[i]; + }); + }, e.prototype.getPercentRange = function() { + var t = this.findRepresentativeAxisProxy(); + if (t) + return t.getDataPercentWindow(); + }, e.prototype.getValueRange = function(t, n) { + if (t == null && n == null) { + var i = this.findRepresentativeAxisProxy(); + if (i) + return i.getDataValueWindow(); + } else + return this.getAxisProxy(t, n).getDataValueWindow(); + }, e.prototype.findRepresentativeAxisProxy = function(t) { + if (t) + return t.__dzAxisProxy; + for (var n, i = this._targetAxisInfoMap.keys(), a = 0; a < i.length; a++) + for (var o = i[a], s = this._targetAxisInfoMap.get(o), l = 0; l < s.indexList.length; l++) { + var u = this.getAxisProxy(o, s.indexList[l]); + if (u.hostedBy(this)) + return u; + n || (n = u); + } + return n; + }, e.prototype.getRangePropMode = function() { + return this._rangePropMode.slice(); + }, e.prototype.getOrient = function() { + return this._orient; + }, e.type = "dataZoom", e.dependencies = ["xAxis", "yAxis", "radiusAxis", "angleAxis", "singleAxis", "series", "toolbox"], e.defaultOption = { + // zlevel: 0, + z: 4, + filterMode: "filter", + start: 0, + end: 100 + }, e; + }(xr) +); +function bR(r) { + var e = {}; + return X(["start", "end", "startValue", "endValue", "throttle"], function(t) { + r.hasOwnProperty(t) && (e[t] = r[t]); + }), e; +} +const Rg = qde; +var eve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "dataZoom.select", e; + }(Rg) +); +const tve = eve; +var rve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i, a) { + this.dataZoomModel = t, this.ecModel = n, this.api = i; + }, e.type = "dataZoom", e; + }(Sn) +); +const NE = rve; +var nve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "dataZoom.select", e; + }(NE) +); +const ive = nve; +var ld = X, xR = yo, ave = ( + /** @class */ + function() { + function r(e, t, n, i) { + this._dimName = e, this._axisIndex = t, this.ecModel = i, this._dataZoomModel = n; + } + return r.prototype.hostedBy = function(e) { + return this._dataZoomModel === e; + }, r.prototype.getDataValueWindow = function() { + return this._valueWindow.slice(); + }, r.prototype.getDataPercentWindow = function() { + return this._percentWindow.slice(); + }, r.prototype.getTargetSeriesModels = function() { + var e = []; + return this.ecModel.eachSeries(function(t) { + if (Kde(t)) { + var n = qu(this._dimName), i = t.getReferringComponents(n, mi).models[0]; + i && this._axisIndex === i.componentIndex && e.push(t); + } + }, this), e; + }, r.prototype.getAxisModel = function() { + return this.ecModel.getComponent(this._dimName + "Axis", this._axisIndex); + }, r.prototype.getMinMaxSpan = function() { + return Ot(this._minMaxSpan); + }, r.prototype.calculateDataWindow = function(e) { + var t = this._dataExtent, n = this.getAxisModel(), i = n.axis.scale, a = this._dataZoomModel.getRangePropMode(), o = [0, 100], s = [], l = [], u; + ld(["start", "end"], function(f, v) { + var b = e[f], w = e[f + "Value"]; + a[v] === "percent" ? (b == null && (b = o[v]), w = i.parse(Zr(b, o, t))) : (u = !0, w = w == null ? t[v] : i.parse(w), b = Zr(w, t, o)), l[v] = w == null || isNaN(w) ? t[v] : w, s[v] = b == null || isNaN(b) ? o[v] : b; + }), xR(l), xR(s); + var c = this._minMaxSpan; + u ? h(l, s, t, o, !1) : h(s, l, o, t, !0); + function h(f, v, b, w, p) { + var d = p ? "Span" : "ValueSpan"; + cf(0, f, b, "all", c["min" + d], c["max" + d]); + for (var m = 0; m < 2; m++) + v[m] = Zr(f[m], b, w, !0), p && (v[m] = i.parse(v[m])); + } + return { + valueWindow: l, + percentWindow: s + }; + }, r.prototype.reset = function(e) { + if (e === this._dataZoomModel) { + var t = this.getTargetSeriesModels(); + this._dataExtent = ove(this, this._dimName, t), this._updateMinMaxSpan(); + var n = this.calculateDataWindow(e.settledOption); + this._valueWindow = n.valueWindow, this._percentWindow = n.percentWindow, this._setAxisModel(); + } + }, r.prototype.filterData = function(e, t) { + if (e !== this._dataZoomModel) + return; + var n = this._dimName, i = this.getTargetSeriesModels(), a = e.get("filterMode"), o = this._valueWindow; + if (a === "none") + return; + ld(i, function(l) { + var u = l.getData(), c = u.mapDimensionsAll(n); + if (c.length) { + if (a === "weakFilter") { + var h = u.getStore(), f = Ke(c, function(v) { + return u.getDimensionIndex(v); + }, u); + u.filterSelf(function(v) { + for (var b, w, p, d = 0; d < c.length; d++) { + var m = h.get(f[d], v), _ = !isNaN(m), y = m < o[0], x = m > o[1]; + if (_ && !y && !x) + return !0; + _ && (p = !0), y && (b = !0), x && (w = !0); + } + return p && b && w; + }); + } else + ld(c, function(v) { + if (a === "empty") + l.setData(u = u.map(v, function(w) { + return s(w) ? w : NaN; + })); + else { + var b = {}; + b[v] = o, u.selectRange(b); + } + }); + ld(c, function(v) { + u.setApproximateExtent(o, v); + }); + } + }); + function s(l) { + return l >= o[0] && l <= o[1]; + } + }, r.prototype._updateMinMaxSpan = function() { + var e = this._minMaxSpan = {}, t = this._dataZoomModel, n = this._dataExtent; + ld(["min", "max"], function(i) { + var a = t.get(i + "Span"), o = t.get(i + "ValueSpan"); + o != null && (o = this.getAxisModel().axis.scale.parse(o)), o != null ? a = Zr(n[0] + o, n, [0, 100], !0) : a != null && (o = Zr(a, [0, 100], n, !0) - n[0]), e[i + "Span"] = a, e[i + "ValueSpan"] = o; + }, this); + }, r.prototype._setAxisModel = function() { + var e = this.getAxisModel(), t = this._percentWindow, n = this._valueWindow; + if (t) { + var i = BI(n, [0, 500]); + i = Math.min(i, 20); + var a = e.axis.scale.rawExtentInfo; + t[0] !== 0 && a.setDeterminedMinMax("min", +n[0].toFixed(i)), t[1] !== 100 && a.setDeterminedMinMax("max", +n[1].toFixed(i)), a.freeze(); + } + }, r; + }() +); +function ove(r, e, t) { + var n = [1 / 0, -1 / 0]; + ld(t, function(o) { + Ete(n, o.getData(), e); + }); + var i = r.getAxisModel(), a = n$(i.axis.scale, i, n).calculate(); + return [a.min, a.max]; +} +const sve = ave; +var lve = { + // `dataZoomProcessor` will only be performed in needed series. Consider if + // there is a line series and a pie series, it is better not to update the + // line series if only pie series is needed to be updated. + getTargetSeries: function(r) { + function e(i) { + r.eachComponent("dataZoom", function(a) { + a.eachTargetAxis(function(o, s) { + var l = r.getComponent(qu(o), s); + i(o, s, l, a); + }); + }); + } + e(function(i, a, o, s) { + o.__dzAxisProxy = null; + }); + var t = []; + e(function(i, a, o, s) { + o.__dzAxisProxy || (o.__dzAxisProxy = new sve(i, a, s, r), t.push(o.__dzAxisProxy)); + }); + var n = xt(); + return X(t, function(i) { + X(i.getTargetSeriesModels(), function(a) { + n.set(a.uid, a); + }); + }), n; + }, + // Consider appendData, where filter should be performed. Because data process is + // in block mode currently, it is not need to worry about that the overallProgress + // execute every frame. + overallReset: function(r, e) { + r.eachComponent("dataZoom", function(t) { + t.eachTargetAxis(function(n, i) { + t.getAxisProxy(n, i).reset(t); + }), t.eachTargetAxis(function(n, i) { + t.getAxisProxy(n, i).filterData(t, e); + }); + }), r.eachComponent("dataZoom", function(t) { + var n = t.findRepresentativeAxisProxy(); + if (n) { + var i = n.getDataPercentWindow(), a = n.getDataValueWindow(); + t.setCalculatedRange({ + start: i[0], + end: i[1], + startValue: a[0], + endValue: a[1] + }); + } + }); + } +}; +const uve = lve; +function cve(r) { + r.registerAction("dataZoom", function(e, t) { + var n = Qde(t, e); + X(n, function(i) { + i.setRawRange({ + start: e.start, + end: e.end, + startValue: e.startValue, + endValue: e.endValue + }); + }); + }); +} +var SR = !1; +function zE(r) { + SR || (SR = !0, r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER, uve), cve(r), r.registerSubTypeDefaulter("dataZoom", function() { + return "slider"; + })); +} +function hve(r) { + r.registerComponentModel(tve), r.registerComponentView(ive), zE(r); +} +var Zo = ( + /** @class */ + function() { + function r() { + } + return r; + }() +), q3 = {}; +function ud(r, e) { + q3[r] = e; +} +function eV(r) { + return q3[r]; +} +var fve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.optionUpdated = function() { + r.prototype.optionUpdated.apply(this, arguments); + var t = this.ecModel; + X(this.option.feature, function(n, i) { + var a = eV(i); + a && (a.getDefaultOption && (a.defaultOption = a.getDefaultOption(t)), Ut(n, a.defaultOption)); + }); + }, e.type = "toolbox", e.layoutMode = { + type: "box", + ignoreSize: !0 + }, e.defaultOption = { + show: !0, + z: 6, + // zlevel: 0, + orient: "horizontal", + left: "right", + top: "top", + // right + // bottom + backgroundColor: "transparent", + borderColor: "#ccc", + borderRadius: 0, + borderWidth: 0, + padding: 5, + itemSize: 15, + itemGap: 8, + showTitle: !0, + iconStyle: { + borderColor: "#666", + color: "none" + }, + emphasis: { + iconStyle: { + borderColor: "#3E98C5" + } + }, + // textStyle: {}, + // feature + tooltip: { + show: !1, + position: "bottom" + } + }, e; + }(xr) +); +const dve = fve; +function vve(r, e, t) { + var n = e.getBoxLayoutParams(), i = e.get("padding"), a = { + width: t.getWidth(), + height: t.getHeight() + }, o = yi(n, a, i); + Nh(e.get("orient"), r, e.get("itemGap"), o.width, o.height), Xb(r, n, a, i); +} +function tV(r, e) { + var t = of(e.get("padding")), n = e.getItemStyle(["color", "opacity"]); + return n.fill = e.get("backgroundColor"), r = new Or({ + shape: { + x: r.x - t[3], + y: r.y - t[0], + width: r.width + t[1] + t[3], + height: r.height + t[0] + t[2], + r: e.get("borderRadius") + }, + style: n, + silent: !0, + z2: -1 + }), r; +} +var pve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.render = function(t, n, i, a) { + var o = this.group; + if (o.removeAll(), !t.get("show")) + return; + var s = +t.get("itemSize"), l = t.get("orient") === "vertical", u = t.get("feature") || {}, c = this._features || (this._features = {}), h = []; + X(u, function(b, w) { + h.push(w); + }), new nu(this._featureNames || [], h).add(f).update(f).remove(jt(f, null)).execute(), this._featureNames = h; + function f(b, w) { + var p = h[b], d = h[w], m = u[p], _ = new qr(m, t, t.ecModel), y; + if (a && a.newTitle != null && a.featureName === p && (m.title = a.newTitle), p && !d) { + if (gve(p)) + y = { + onclick: _.option.onclick, + featureName: p + }; + else { + var x = eV(p); + if (!x) + return; + y = new x(); + } + c[p] = y; + } else if (y = c[d], !y) + return; + y.uid = tv("toolbox-feature"), y.model = _, y.ecModel = n, y.api = i; + var g = y instanceof Zo; + if (!p && d) { + g && y.dispose && y.dispose(n, i); + return; + } + if (!_.get("show") || g && y.unusable) { + g && y.remove && y.remove(n, i); + return; + } + v(_, y, p), _.setIconStatus = function(S, T) { + var C = this.option, E = this.iconPaths; + C.iconStatus = C.iconStatus || {}, C.iconStatus[S] = T, E[S] && (T === "emphasis" ? tu : ru)(E[S]); + }, y instanceof Zo && y.render && y.render(_, n, i, a); + } + function v(b, w, p) { + var d = b.getModel("iconStyle"), m = b.getModel(["emphasis", "iconStyle"]), _ = w instanceof Zo && w.getIcons ? w.getIcons() : b.get("icon"), y = b.get("title") || {}, x, g; + ut(_) ? (x = {}, x[p] = _) : x = _, ut(y) ? (g = {}, g[p] = y) : g = y; + var S = b.iconPaths = {}; + X(x, function(T, C) { + var E = Qd(T, {}, { + x: -s / 2, + y: -s / 2, + width: s, + height: s + }); + E.setStyle(d.getItemStyle()); + var M = E.ensureState("emphasis"); + M.style = m.getItemStyle(); + var P = new kr({ + style: { + text: g[C], + align: m.get("textAlign"), + borderRadius: m.get("textBorderRadius"), + padding: m.get("textPadding"), + fill: null + }, + ignore: !0 + }); + E.setTextContent(P), qd({ + el: E, + componentModel: t, + itemName: C, + formatterParamsExtra: { + title: g[C] + } + }), E.__title = g[C], E.on("mouseover", function() { + var R = m.getItemStyle(), N = l ? t.get("right") == null && t.get("left") !== "right" ? "right" : "left" : t.get("bottom") == null && t.get("top") !== "bottom" ? "bottom" : "top"; + P.setStyle({ + fill: m.get("textFill") || R.fill || R.stroke || "#000", + backgroundColor: m.get("textBackgroundColor") + }), E.setTextConfig({ + position: m.get("textPosition") || N + }), P.ignore = !t.get("showTitle"), i.enterEmphasis(this); + }).on("mouseout", function() { + b.get(["iconStatus", C]) !== "emphasis" && i.leaveEmphasis(this), P.hide(); + }), (b.get(["iconStatus", C]) === "emphasis" ? tu : ru)(E), o.add(E), E.on("click", ft(w.onclick, w, n, i, C)), S[C] = E; + }); + } + vve(o, t, i), o.add(tV(o.getBoundingRect(), t)), l || o.eachChild(function(b) { + var w = b.__title, p = b.ensureState("emphasis"), d = p.textConfig || (p.textConfig = {}), m = b.getTextContent(), _ = m && m.ensureState("emphasis"); + if (_ && !Tt(_) && w) { + var y = _.style || (_.style = {}), x = Zg(w, kr.makeFont(y)), g = b.x + o.x, S = b.y + o.y + s, T = !1; + S + x.height > i.getHeight() && (d.position = "top", T = !0); + var C = T ? -5 - x.height : s + 10; + g + x.width / 2 > i.getWidth() ? (d.position = ["100%", C], y.align = "right") : g - x.width / 2 < 0 && (d.position = [0, C], y.align = "left"); + } + }); + }, e.prototype.updateView = function(t, n, i, a) { + X(this._features, function(o) { + o instanceof Zo && o.updateView && o.updateView(o.model, n, i, a); + }); + }, e.prototype.remove = function(t, n) { + X(this._features, function(i) { + i instanceof Zo && i.remove && i.remove(t, n); + }), this.group.removeAll(); + }, e.prototype.dispose = function(t, n) { + X(this._features, function(i) { + i instanceof Zo && i.dispose && i.dispose(t, n); + }); + }, e.type = "toolbox", e; + }(Sn) +); +function gve(r) { + return r.indexOf("my") === 0; +} +const mve = pve; +var yve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.onclick = function(t, n) { + var i = this.model, a = i.get("name") || t.get("title.0.text") || "echarts", o = n.getZr().painter.getType() === "svg", s = o ? "svg" : i.get("type", !0) || "png", l = n.getConnectedDataURL({ + type: s, + backgroundColor: i.get("backgroundColor", !0) || t.get("backgroundColor") || "#fff", + connectedBackgroundColor: i.get("connectedBackgroundColor"), + excludeComponents: i.get("excludeComponents"), + pixelRatio: i.get("pixelRatio") + }), u = Dr.browser; + if (Tt(MouseEvent) && (u.newEdge || !u.ie && !u.edge)) { + var c = document.createElement("a"); + c.download = a + "." + s, c.target = "_blank", c.href = l; + var h = new MouseEvent("click", { + // some micro front-end framework, window maybe is a Proxy + view: document.defaultView, + bubbles: !0, + cancelable: !1 + }); + c.dispatchEvent(h); + } else if (window.navigator.msSaveOrOpenBlob || o) { + var f = l.split(","), v = f[0].indexOf("base64") > -1, b = o ? decodeURIComponent(f[1]) : f[1]; + v && (b = window.atob(b)); + var w = a + "." + s; + if (window.navigator.msSaveOrOpenBlob) { + for (var p = b.length, d = new Uint8Array(p); p--; ) + d[p] = b.charCodeAt(p); + var m = new Blob([d]); + window.navigator.msSaveOrOpenBlob(m, w); + } else { + var _ = document.createElement("iframe"); + document.body.appendChild(_); + var y = _.contentWindow, x = y.document; + x.open("image/svg+xml", "replace"), x.write(b), x.close(), y.focus(), x.execCommand("SaveAs", !0, w), document.body.removeChild(_); + } + } else { + var g = i.get("lang"), S = '', T = window.open(); + T.document.write(S), T.document.title = a; + } + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + icon: "M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0", + title: t.getLocaleModel().get(["toolbox", "saveAsImage", "title"]), + type: "png", + // Default use option.backgroundColor + // backgroundColor: '#fff', + connectedBackgroundColor: "#fff", + name: "", + excludeComponents: ["toolbox"], + // use current pixel ratio of device by default + // pixelRatio: 1, + lang: t.getLocaleModel().get(["toolbox", "saveAsImage", "lang"]) + }; + return n; + }, e; + }(Zo) +); +const _ve = yve; +var wR = "__ec_magicType_stack__", bve = [["line", "bar"], ["stack"]], xve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.getIcons = function() { + var t = this.model, n = t.get("icon"), i = {}; + return X(t.get("type"), function(a) { + n[a] && (i[a] = n[a]); + }), i; + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + type: [], + // Icon group + icon: { + line: "M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4", + bar: "M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7", + // eslint-disable-next-line + stack: "M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z" + // jshint ignore:line + }, + // `line`, `bar`, `stack`, `tiled` + title: t.getLocaleModel().get(["toolbox", "magicType", "title"]), + option: {}, + seriesIndex: {} + }; + return n; + }, e.prototype.onclick = function(t, n, i) { + var a = this.model, o = a.get(["seriesIndex", i]); + if (CR[i]) { + var s = { + series: [] + }, l = function(h) { + var f = h.subType, v = h.id, b = CR[i](f, v, h, a); + b && (Mt(b, h.option), s.series.push(b)); + var w = h.coordinateSystem; + if (w && w.type === "cartesian2d" && (i === "line" || i === "bar")) { + var p = w.getAxesByScale("ordinal")[0]; + if (p) { + var d = p.dim, m = d + "Axis", _ = h.getReferringComponents(m, mi).models[0], y = _.componentIndex; + s[m] = s[m] || []; + for (var x = 0; x <= y; x++) + s[m][y] = s[m][y] || {}; + s[m][y].boundaryGap = i === "bar"; + } + } + }; + X(bve, function(h) { + ir(h, i) >= 0 && X(h, function(f) { + a.setIconStatus(f, "normal"); + }); + }), a.setIconStatus(i, "emphasis"), t.eachComponent({ + mainType: "series", + query: o == null ? null : { + seriesIndex: o + } + }, l); + var u, c = i; + i === "stack" && (u = Ut({ + stack: a.option.title.tiled, + tiled: a.option.title.stack + }, a.option.title), a.get(["iconStatus", i]) !== "emphasis" && (c = "tiled")), n.dispatchAction({ + type: "changeMagicType", + currentType: c, + newOption: s, + newTitle: u, + featureName: "magicType" + }); + } + }, e; + }(Zo) +), CR = { + line: function(r, e, t, n) { + if (r === "bar") + return Ut({ + id: e, + type: "line", + // Preserve data related option + data: t.get("data"), + stack: t.get("stack"), + markPoint: t.get("markPoint"), + markLine: t.get("markLine") + }, n.get(["option", "line"]) || {}, !0); + }, + bar: function(r, e, t, n) { + if (r === "line") + return Ut({ + id: e, + type: "bar", + // Preserve data related option + data: t.get("data"), + stack: t.get("stack"), + markPoint: t.get("markPoint"), + markLine: t.get("markLine") + }, n.get(["option", "bar"]) || {}, !0); + }, + stack: function(r, e, t, n) { + var i = t.get("stack") === wR; + if (r === "line" || r === "bar") + return n.setIconStatus("stack", i ? "normal" : "emphasis"), Ut({ + id: e, + stack: i ? "" : wR + }, n.get(["option", "stack"]) || {}, !0); + } +}; +os({ + type: "changeMagicType", + event: "magicTypeChanged", + update: "prepareAndUpdate" +}, function(r, e) { + e.mergeOption(r.newOption); +}); +const Sve = xve; +var px = new Array(60).join("-"), $d = " "; +function wve(r) { + var e = {}, t = [], n = []; + return r.eachRawSeries(function(i) { + var a = i.coordinateSystem; + if (a && (a.type === "cartesian2d" || a.type === "polar")) { + var o = a.getBaseAxis(); + if (o.type === "category") { + var s = o.dim + "_" + o.index; + e[s] || (e[s] = { + categoryAxis: o, + valueAxis: a.getOtherAxis(o), + series: [] + }, n.push({ + axisDim: o.dim, + axisIndex: o.index + })), e[s].series.push(i); + } else + t.push(i); + } else + t.push(i); + }), { + seriesGroupByCategoryAxis: e, + other: t, + meta: n + }; +} +function Cve(r) { + var e = []; + return X(r, function(t, n) { + var i = t.categoryAxis, a = t.valueAxis, o = a.dim, s = [" "].concat(Ke(t.series, function(v) { + return v.name; + })), l = [i.model.getCategories()]; + X(t.series, function(v) { + var b = v.getRawData(); + l.push(v.getRawData().mapArray(b.mapDimension(o), function(w) { + return w; + })); + }); + for (var u = [s.join($d)], c = 0; c < l[0].length; c++) { + for (var h = [], f = 0; f < l.length; f++) + h.push(l[f][c]); + u.push(h.join($d)); + } + e.push(u.join(` +`)); + }), e.join(` + +` + px + ` + +`); +} +function Tve(r) { + return Ke(r, function(e) { + var t = e.getRawData(), n = [e.name], i = []; + return t.each(t.dimensions, function() { + for (var a = arguments.length, o = arguments[a - 1], s = t.getName(o), l = 0; l < a - 1; l++) + i[l] = arguments[l]; + n.push((s ? s + $d : "") + i.join($d)); + }), n.join(` +`); + }).join(` + +` + px + ` + +`); +} +function Ive(r) { + var e = wve(r); + return { + value: Jr([Cve(e.seriesGroupByCategoryAxis), Tve(e.other)], function(t) { + return !!t.replace(/[\n\t\s]/g, ""); + }).join(` + +` + px + ` + +`), + meta: e.meta + }; +} +function J_(r) { + return r.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); +} +function Ave(r) { + var e = r.slice(0, r.indexOf(` +`)); + if (e.indexOf($d) >= 0) + return !0; +} +var OT = new RegExp("[" + $d + "]+", "g"); +function Eve(r) { + for (var e = r.split(/\n+/g), t = J_(e.shift()).split(OT), n = [], i = Ke(t, function(l) { + return { + name: l, + data: [] + }; + }), a = 0; a < e.length; a++) { + var o = J_(e[a]).split(OT); + n.push(o.shift()); + for (var s = 0; s < o.length; s++) + i[s] && (i[s].data[a] = o[s]); + } + return { + series: i, + categories: n + }; +} +function Mve(r) { + for (var e = r.split(/\n+/g), t = J_(e.shift()), n = [], i = 0; i < e.length; i++) { + var a = J_(e[i]); + if (a) { + var o = a.split(OT), s = "", l = void 0, u = !1; + isNaN(o[0]) ? (u = !0, s = o[0], o = o.slice(1), n[i] = { + name: s, + value: [] + }, l = n[i].value) : l = n[i] = []; + for (var c = 0; c < o.length; c++) + l.push(+o[c]); + l.length === 1 && (u ? n[i].value = l[0] : n[i] = l[0]); + } + } + return { + name: t, + data: n + }; +} +function Dve(r, e) { + var t = r.split(new RegExp(` +*` + px + ` +*`, "g")), n = { + series: [] + }; + return X(t, function(i, a) { + if (Ave(i)) { + var o = Eve(i), s = e[a], l = s.axisDim + "Axis"; + s && (n[l] = n[l] || [], n[l][s.axisIndex] = { + data: o.categories + }, n.series = n.series.concat(o.series)); + } else { + var o = Mve(i); + n.series.push(o); + } + }), n; +} +var kve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.onclick = function(t, n) { + setTimeout(function() { + n.dispatchAction({ + type: "hideTip" + }); + }); + var i = n.getDom(), a = this.model; + this._dom && i.removeChild(this._dom); + var o = document.createElement("div"); + o.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;padding:5px", o.style.backgroundColor = a.get("backgroundColor") || "#fff"; + var s = document.createElement("h4"), l = a.get("lang") || []; + s.innerHTML = l[0] || a.get("title"), s.style.cssText = "margin:10px 20px", s.style.color = a.get("textColor"); + var u = document.createElement("div"), c = document.createElement("textarea"); + u.style.cssText = "overflow:auto"; + var h = a.get("optionToContent"), f = a.get("contentToOption"), v = Ive(t); + if (Tt(h)) { + var b = h(n.getOption()); + ut(b) ? u.innerHTML = b : Od(b) && u.appendChild(b); + } else { + c.readOnly = a.get("readOnly"); + var w = c.style; + w.cssText = "display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none", w.color = a.get("textColor"), w.borderColor = a.get("textareaBorderColor"), w.backgroundColor = a.get("textareaColor"), c.value = v.value, u.appendChild(c); + } + var p = v.meta, d = document.createElement("div"); + d.style.cssText = "position:absolute;bottom:5px;left:0;right:0"; + var m = "float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px", _ = document.createElement("div"), y = document.createElement("div"); + m += ";background-color:" + a.get("buttonColor"), m += ";color:" + a.get("buttonTextColor"); + var x = this; + function g() { + i.removeChild(o), x._dom = null; + } + h1(_, "click", g), h1(y, "click", function() { + if (f == null && h != null || f != null && h == null) { + g(); + return; + } + var S; + try { + Tt(f) ? S = f(u, n.getOption()) : S = Dve(c.value, p); + } catch (T) { + throw g(), new Error("Data view format error " + T); + } + S && n.dispatchAction({ + type: "changeDataView", + newOption: S + }), g(); + }), _.innerHTML = l[1], y.innerHTML = l[2], y.style.cssText = _.style.cssText = m, !a.get("readOnly") && d.appendChild(y), d.appendChild(_), o.appendChild(s), o.appendChild(u), o.appendChild(d), u.style.height = i.clientHeight - 80 + "px", i.appendChild(o), this._dom = o; + }, e.prototype.remove = function(t, n) { + this._dom && n.getDom().removeChild(this._dom); + }, e.prototype.dispose = function(t, n) { + this.remove(t, n); + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + readOnly: !1, + optionToContent: null, + contentToOption: null, + // eslint-disable-next-line + icon: "M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28", + title: t.getLocaleModel().get(["toolbox", "dataView", "title"]), + lang: t.getLocaleModel().get(["toolbox", "dataView", "lang"]), + backgroundColor: "#fff", + textColor: "#000", + textareaColor: "#fff", + textareaBorderColor: "#333", + buttonColor: "#c23531", + buttonTextColor: "#fff" + }; + return n; + }, e; + }(Zo) +); +function Ove(r, e) { + return Ke(r, function(t, n) { + var i = e && e[n]; + if (kt(i) && !We(i)) { + var a = kt(t) && !We(t); + a || (t = { + value: t + }); + var o = i.name != null && t.name == null; + return t = Mt(t, i), o && delete t.name, t; + } else + return t; + }); +} +os({ + type: "changeDataView", + event: "dataViewChanged", + update: "prepareAndUpdate" +}, function(r, e) { + var t = []; + X(r.newOption.series, function(n) { + var i = e.getSeriesByName(n.name)[0]; + if (!i) + t.push(Fe({ + // Default is scatter + type: "scatter" + }, n)); + else { + var a = i.get("data"); + t.push({ + name: n.name, + data: Ove(n.data, a) + }); + } + }), e.mergeOption(Mt({ + series: t + }, r.newOption)); +}); +const Lve = kve; +var rV = X, nV = Rr(); +function Pve(r, e) { + var t = BE(r); + rV(e, function(n, i) { + for (var a = t.length - 1; a >= 0; a--) { + var o = t[a]; + if (o[i]) + break; + } + if (a < 0) { + var s = r.queryComponents({ + mainType: "dataZoom", + subType: "select", + id: i + })[0]; + if (s) { + var l = s.getPercentRange(); + t[0][i] = { + dataZoomId: i, + start: l[0], + end: l[1] + }; + } + } + }), t.push(e); +} +function Rve(r) { + var e = BE(r), t = e[e.length - 1]; + e.length > 1 && e.pop(); + var n = {}; + return rV(t, function(i, a) { + for (var o = e.length - 1; o >= 0; o--) + if (i = e[o][a], i) { + n[a] = i; + break; + } + }), n; +} +function Nve(r) { + nV(r).snapshots = null; +} +function zve(r) { + return BE(r).length; +} +function BE(r) { + var e = nV(r); + return e.snapshots || (e.snapshots = [{}]), e.snapshots; +} +var Bve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.onclick = function(t, n) { + Nve(t), n.dispatchAction({ + type: "restore", + from: this.uid + }); + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + // eslint-disable-next-line + icon: "M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5", + title: t.getLocaleModel().get(["toolbox", "restore", "title"]) + }; + return n; + }, e; + }(Zo) +); +os({ + type: "restore", + event: "restore", + update: "prepareAndUpdate" +}, function(r, e) { + e.resetOption("recreate"); +}); +const jve = Bve; +var Fve = ["grid", "xAxis", "yAxis", "geo", "graph", "polar", "radiusAxis", "angleAxis", "bmap"], $ve = ( + /** @class */ + function() { + function r(e, t, n) { + var i = this; + this._targetInfoList = []; + var a = TR(t, e); + X(Hve, function(o, s) { + (!n || !n.include || ir(n.include, s) >= 0) && o(a, i._targetInfoList); + }); + } + return r.prototype.setOutputRanges = function(e, t) { + return this.matchOutputRanges(e, t, function(n, i, a) { + if ((n.coordRanges || (n.coordRanges = [])).push(i), !n.coordRange) { + n.coordRange = i; + var o = uC[n.brushType](0, a, i); + n.__rangeOffset = { + offset: MR[n.brushType](o.values, n.range, [1, 1]), + xyMinMax: o.xyMinMax + }; + } + }), e; + }, r.prototype.matchOutputRanges = function(e, t, n) { + X(e, function(i) { + var a = this.findTargetInfo(i, t); + a && a !== !0 && X(a.coordSyses, function(o) { + var s = uC[i.brushType](1, o, i.range, !0); + n(i, s.values, o, t); + }); + }, this); + }, r.prototype.setInputRanges = function(e, t) { + X(e, function(n) { + var i = this.findTargetInfo(n, t); + if (n.range = n.range || [], i && i !== !0) { + n.panelId = i.panelId; + var a = uC[n.brushType](0, i.coordSys, n.coordRange), o = n.__rangeOffset; + n.range = o ? MR[n.brushType](a.values, o.offset, Vve(a.xyMinMax, o.xyMinMax)) : a.values; + } + }, this); + }, r.prototype.makePanelOpts = function(e, t) { + return Ke(this._targetInfoList, function(n) { + var i = n.getPanelRect(); + return { + panelId: n.panelId, + defaultBrushType: t ? t(n) : null, + clipPath: c3(i), + isTargetByCursor: f3(i, e, n.coordSysModel), + getLinearBrushOtherExtent: h3(i) + }; + }); + }, r.prototype.controlSeries = function(e, t, n) { + var i = this.findTargetInfo(e, n); + return i === !0 || i && ir(i.coordSyses, t.coordinateSystem) >= 0; + }, r.prototype.findTargetInfo = function(e, t) { + for (var n = this._targetInfoList, i = TR(t, e), a = 0; a < n.length; a++) { + var o = n[a], s = e.panelId; + if (s) { + if (o.panelId === s) + return o; + } else + for (var l = 0; l < IR.length; l++) + if (IR[l](i, o)) + return o; + } + return !0; + }, r; + }() +); +function LT(r) { + return r[0] > r[1] && r.reverse(), r; +} +function TR(r, e) { + return Hp(r, e, { + includeMainTypes: Fve + }); +} +var Hve = { + grid: function(r, e) { + var t = r.xAxisModels, n = r.yAxisModels, i = r.gridModels, a = xt(), o = {}, s = {}; + !t && !n && !i || (X(t, function(l) { + var u = l.axis.grid.model; + a.set(u.id, u), o[u.id] = !0; + }), X(n, function(l) { + var u = l.axis.grid.model; + a.set(u.id, u), s[u.id] = !0; + }), X(i, function(l) { + a.set(l.id, l), o[l.id] = !0, s[l.id] = !0; + }), a.each(function(l) { + var u = l.coordinateSystem, c = []; + X(u.getCartesians(), function(h, f) { + (ir(t, h.getAxis("x").model) >= 0 || ir(n, h.getAxis("y").model) >= 0) && c.push(h); + }), e.push({ + panelId: "grid--" + l.id, + gridModel: l, + coordSysModel: l, + // Use the first one as the representitive coordSys. + coordSys: c[0], + coordSyses: c, + getPanelRect: AR.grid, + xAxisDeclared: o[l.id], + yAxisDeclared: s[l.id] + }); + })); + }, + geo: function(r, e) { + X(r.geoModels, function(t) { + var n = t.coordinateSystem; + e.push({ + panelId: "geo--" + t.id, + geoModel: t, + coordSysModel: t, + coordSys: n, + coordSyses: [n], + getPanelRect: AR.geo + }); + }); + } +}, IR = [ + // grid + function(r, e) { + var t = r.xAxisModel, n = r.yAxisModel, i = r.gridModel; + return !i && t && (i = t.axis.grid.model), !i && n && (i = n.axis.grid.model), i && i === e.gridModel; + }, + // geo + function(r, e) { + var t = r.geoModel; + return t && t === e.geoModel; + } +], AR = { + grid: function() { + return this.coordSys.master.getRect().clone(); + }, + geo: function() { + var r = this.coordSys, e = r.getBoundingRect().clone(); + return e.applyTransform(oc(r)), e; + } +}, uC = { + lineX: jt(ER, 0), + lineY: jt(ER, 1), + rect: function(r, e, t, n) { + var i = r ? e.pointToData([t[0][0], t[1][0]], n) : e.dataToPoint([t[0][0], t[1][0]], n), a = r ? e.pointToData([t[0][1], t[1][1]], n) : e.dataToPoint([t[0][1], t[1][1]], n), o = [LT([i[0], a[0]]), LT([i[1], a[1]])]; + return { + values: o, + xyMinMax: o + }; + }, + polygon: function(r, e, t, n) { + var i = [[1 / 0, -1 / 0], [1 / 0, -1 / 0]], a = Ke(t, function(o) { + var s = r ? e.pointToData(o, n) : e.dataToPoint(o, n); + return i[0][0] = Math.min(i[0][0], s[0]), i[1][0] = Math.min(i[1][0], s[1]), i[0][1] = Math.max(i[0][1], s[0]), i[1][1] = Math.max(i[1][1], s[1]), s; + }); + return { + values: a, + xyMinMax: i + }; + } +}; +function ER(r, e, t, n) { + var i = t.getAxis(["x", "y"][r]), a = LT(Ke([0, 1], function(s) { + return e ? i.coordToData(i.toLocalCoord(n[s]), !0) : i.toGlobalCoord(i.dataToCoord(n[s])); + })), o = []; + return o[r] = a, o[1 - r] = [NaN, NaN], { + values: a, + xyMinMax: o + }; +} +var MR = { + lineX: jt(DR, 0), + lineY: jt(DR, 1), + rect: function(r, e, t) { + return [[r[0][0] - t[0] * e[0][0], r[0][1] - t[0] * e[0][1]], [r[1][0] - t[1] * e[1][0], r[1][1] - t[1] * e[1][1]]]; + }, + polygon: function(r, e, t) { + return Ke(r, function(n, i) { + return [n[0] - t[0] * e[i][0], n[1] - t[1] * e[i][1]]; + }); + } +}; +function DR(r, e, t, n) { + return [e[0] - n[r] * t[0], e[1] - n[r] * t[1]]; +} +function Vve(r, e) { + var t = kR(r), n = kR(e), i = [t[0] / n[0], t[1] / n[1]]; + return isNaN(i[0]) && (i[0] = 1), isNaN(i[1]) && (i[1] = 1), i; +} +function kR(r) { + return r ? [r[0][1] - r[0][0], r[1][1] - r[1][0]] : [NaN, NaN]; +} +const jE = $ve; +var PT = X, Gve = xZ("toolbox-dataZoom_"), Uve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.render = function(t, n, i, a) { + this._brushController || (this._brushController = new _E(i.getZr()), this._brushController.on("brush", ft(this._onBrush, this)).mount()), Xve(t, n, this, a, i), Yve(t, n); + }, e.prototype.onclick = function(t, n, i) { + Wve[i].call(this); + }, e.prototype.remove = function(t, n) { + this._brushController && this._brushController.unmount(); + }, e.prototype.dispose = function(t, n) { + this._brushController && this._brushController.dispose(); + }, e.prototype._onBrush = function(t) { + var n = t.areas; + if (!t.isEnd || !n.length) + return; + var i = {}, a = this.ecModel; + this._brushController.updateCovers([]); + var o = new jE(FE(this.model), a, { + include: ["grid"] + }); + o.matchOutputRanges(n, a, function(u, c, h) { + if (h.type === "cartesian2d") { + var f = u.brushType; + f === "rect" ? (s("x", h, c[0]), s("y", h, c[1])) : s({ + lineX: "x", + lineY: "y" + }[f], h, c); + } + }), Pve(a, i), this._dispatchZoomAction(i); + function s(u, c, h) { + var f = c.getAxis(u), v = f.model, b = l(u, v, a), w = b.findRepresentativeAxisProxy(v).getMinMaxSpan(); + (w.minValueSpan != null || w.maxValueSpan != null) && (h = cf(0, h.slice(), f.scale.getExtent(), 0, w.minValueSpan, w.maxValueSpan)), b && (i[b.id] = { + dataZoomId: b.id, + startValue: h[0], + endValue: h[1] + }); + } + function l(u, c, h) { + var f; + return h.eachComponent({ + mainType: "dataZoom", + subType: "select" + }, function(v) { + var b = v.getAxisModel(u, c.componentIndex); + b && (f = v); + }), f; + } + }, e.prototype._dispatchZoomAction = function(t) { + var n = []; + PT(t, function(i, a) { + n.push(Ot(i)); + }), n.length && this.api.dispatchAction({ + type: "dataZoom", + from: this.uid, + batch: n + }); + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + filterMode: "filter", + // Icon group + icon: { + zoom: "M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1", + back: "M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26" + }, + // `zoom`, `back` + title: t.getLocaleModel().get(["toolbox", "dataZoom", "title"]), + brushStyle: { + borderWidth: 0, + color: "rgba(210,219,238,0.2)" + } + }; + return n; + }, e; + }(Zo) +), Wve = { + zoom: function() { + var r = !this._isZoomActive; + this.api.dispatchAction({ + type: "takeGlobalCursor", + key: "dataZoomSelect", + dataZoomSelectActive: r + }); + }, + back: function() { + this._dispatchZoomAction(Rve(this.ecModel)); + } +}; +function FE(r) { + var e = { + xAxisIndex: r.get("xAxisIndex", !0), + yAxisIndex: r.get("yAxisIndex", !0), + xAxisId: r.get("xAxisId", !0), + yAxisId: r.get("yAxisId", !0) + }; + return e.xAxisIndex == null && e.xAxisId == null && (e.xAxisIndex = "all"), e.yAxisIndex == null && e.yAxisId == null && (e.yAxisIndex = "all"), e; +} +function Yve(r, e) { + r.setIconStatus("back", zve(e) > 1 ? "emphasis" : "normal"); +} +function Xve(r, e, t, n, i) { + var a = t._isZoomActive; + n && n.type === "takeGlobalCursor" && (a = n.key === "dataZoomSelect" ? n.dataZoomSelectActive : !1), t._isZoomActive = a, r.setIconStatus("zoom", a ? "emphasis" : "normal"); + var o = new jE(FE(r), e, { + include: ["grid"] + }), s = o.makePanelOpts(i, function(l) { + return l.xAxisDeclared && !l.yAxisDeclared ? "lineX" : !l.xAxisDeclared && l.yAxisDeclared ? "lineY" : "rect"; + }); + t._brushController.setPanels(s).enableBrush(a && s.length ? { + brushType: "auto", + brushStyle: r.getModel("brushStyle").getItemStyle() + } : !1); +} +qK("dataZoom", function(r) { + var e = r.getComponent("toolbox", 0), t = ["feature", "dataZoom"]; + if (!e || e.get(t) == null) + return; + var n = e.getModel(t), i = [], a = FE(n), o = Hp(r, a); + PT(o.xAxisModels, function(l) { + return s(l, "xAxis", "xAxisIndex"); + }), PT(o.yAxisModels, function(l) { + return s(l, "yAxis", "yAxisIndex"); + }); + function s(l, u, c) { + var h = l.componentIndex, f = { + type: "select", + $fromToolbox: !0, + // Default to be filter + filterMode: n.get("filterMode", !0) || "filter", + // Id for merge mapping. + id: Gve + u + h + }; + f[c] = h, i.push(f); + } + return i; +}); +const Zve = Uve; +function Jve(r) { + r.registerComponentModel(dve), r.registerComponentView(mve), ud("saveAsImage", _ve), ud("magicType", Sve), ud("dataView", Lve), ud("dataZoom", Zve), ud("restore", jve), Kt(hve); +} +var Kve = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "tooltip", e.dependencies = ["axisPointer"], e.defaultOption = { + // zlevel: 0, + z: 60, + show: !0, + // tooltip main content + showContent: !0, + // 'trigger' only works on coordinate system. + // 'item' | 'axis' | 'none' + trigger: "item", + // 'click' | 'mousemove' | 'none' + triggerOn: "mousemove|click", + alwaysShowContent: !1, + displayMode: "single", + renderMode: "auto", + // whether restraint content inside viewRect. + // If renderMode: 'richText', default true. + // If renderMode: 'html', defaut false (for backward compat). + confine: null, + showDelay: 0, + hideDelay: 100, + // Animation transition time, unit is second + transitionDuration: 0.4, + enterable: !1, + backgroundColor: "#fff", + // box shadow + shadowBlur: 10, + shadowColor: "rgba(0, 0, 0, .2)", + shadowOffsetX: 1, + shadowOffsetY: 2, + // tooltip border radius, unit is px, default is 4 + borderRadius: 4, + // tooltip border width, unit is px, default is 0 (no border) + borderWidth: 1, + // Tooltip inside padding, default is 5 for all direction + // Array is allowed to set up, right, bottom, left, same with css + // The default value: See `tooltip/tooltipMarkup.ts#getPaddingFromTooltipModel`. + padding: null, + // Extra css text + extraCssText: "", + // axis indicator, trigger by axis + axisPointer: { + // default is line + // legal values: 'line' | 'shadow' | 'cross' + type: "line", + // Valid when type is line, appoint tooltip line locate on which line. Optional + // legal values: 'x' | 'y' | 'angle' | 'radius' | 'auto' + // default is 'auto', chose the axis which type is category. + // for multiply y axis, cartesian coord chose x axis, polar chose angle axis + axis: "auto", + animation: "auto", + animationDurationUpdate: 200, + animationEasingUpdate: "exponentialOut", + crossStyle: { + color: "#999", + width: 1, + type: "dashed", + // TODO formatter + textStyle: {} + } + // lineStyle and shadowStyle should not be specified here, + // otherwise it will always override those styles on option.axisPointer. + }, + textStyle: { + color: "#666", + fontSize: 14 + } + }, e; + }(xr) +); +const Qve = Kve; +function iV(r) { + var e = r.get("confine"); + return e != null ? !!e : r.get("renderMode") === "richText"; +} +function aV(r) { + if (Dr.domSupported) { + for (var e = document.documentElement.style, t = 0, n = r.length; t < n; t++) + if (r[t] in e) + return r[t]; + } +} +var oV = aV(["transform", "webkitTransform", "OTransform", "MozTransform", "msTransform"]), qve = aV(["webkitTransition", "transition", "OTransition", "MozTransition", "msTransition"]); +function sV(r, e) { + if (!r) + return e; + e = uA(e, !0); + var t = r.indexOf(e); + return r = t === -1 ? e : "-" + r.slice(0, t) + "-" + e, r.toLowerCase(); +} +function epe(r, e) { + var t = r.currentStyle || document.defaultView && document.defaultView.getComputedStyle(r); + return t ? e ? t[e] : t : null; +} +var tpe = sV(qve, "transition"), $E = sV(oV, "transform"), rpe = "position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;" + (Dr.transform3dSupported ? "will-change:transform;" : ""); +function npe(r) { + return r = r === "left" ? "right" : r === "right" ? "left" : r === "top" ? "bottom" : "top", r; +} +function ipe(r, e, t) { + if (!ut(t) || t === "inside") + return ""; + var n = r.get("backgroundColor"), i = r.get("borderWidth"); + e = Xh(e); + var a = npe(t), o = Math.max(Math.round(i) * 1.5, 6), s = "", l = $E + ":", u; + ir(["left", "right"], a) > -1 ? (s += "top:50%", l += "translateY(-50%) rotate(" + (u = a === "left" ? -225 : -45) + "deg)") : (s += "left:50%", l += "translateX(-50%) rotate(" + (u = a === "top" ? 225 : 45) + "deg)"); + var c = u * Math.PI / 180, h = o + i, f = h * Math.abs(Math.cos(c)) + h * Math.abs(Math.sin(c)), v = Math.round(((f - Math.SQRT2 * i) / 2 + Math.SQRT2 * i - (f - h) / 2) * 100) / 100; + s += ";" + a + ":-" + v + "px"; + var b = e + " solid " + i + "px;", w = ["position:absolute;width:" + o + "px;height:" + o + "px;z-index:-1;", s + ";" + l + ";", "border-bottom:" + b, "border-right:" + b, "background-color:" + n + ";"]; + return '
'; +} +function ape(r, e) { + var t = "cubic-bezier(0.23,1,0.32,1)", n = " " + r / 2 + "s " + t, i = "opacity" + n + ",visibility" + n; + return e || (n = " " + r + "s " + t, i += Dr.transformSupported ? "," + $E + n : ",left" + n + ",top" + n), tpe + ":" + i; +} +function OR(r, e, t) { + var n = r.toFixed(0) + "px", i = e.toFixed(0) + "px"; + if (!Dr.transformSupported) + return t ? "top:" + i + ";left:" + n + ";" : [["top", i], ["left", n]]; + var a = Dr.transform3dSupported, o = "translate" + (a ? "3d" : "") + "(" + n + "," + i + (a ? ",0" : "") + ")"; + return t ? "top:0;left:0;" + $E + ":" + o + ";" : [["top", 0], ["left", 0], [oV, o]]; +} +function ope(r) { + var e = [], t = r.get("fontSize"), n = r.getTextColor(); + n && e.push("color:" + n), e.push("font:" + r.getFont()), t && e.push("line-height:" + Math.round(t * 3 / 2) + "px"); + var i = r.get("textShadowColor"), a = r.get("textShadowBlur") || 0, o = r.get("textShadowOffsetX") || 0, s = r.get("textShadowOffsetY") || 0; + return i && a && e.push("text-shadow:" + o + "px " + s + "px " + a + "px " + i), X(["decoration", "align"], function(l) { + var u = r.get(l); + u && e.push("text-" + l + ":" + u); + }), e.join(";"); +} +function spe(r, e, t) { + var n = [], i = r.get("transitionDuration"), a = r.get("backgroundColor"), o = r.get("shadowBlur"), s = r.get("shadowColor"), l = r.get("shadowOffsetX"), u = r.get("shadowOffsetY"), c = r.getModel("textStyle"), h = QF(r, "html"), f = l + "px " + u + "px " + o + "px " + s; + return n.push("box-shadow:" + f), e && i && n.push(ape(i, t)), a && n.push("background-color:" + a), X(["width", "color", "radius"], function(v) { + var b = "border-" + v, w = uA(b), p = r.get(w); + p != null && n.push(b + ":" + p + (v === "color" ? "" : "px")); + }), n.push(ope(c)), h != null && n.push("padding:" + of(h).join("px ") + "px"), n.join(";") + ";"; +} +function LR(r, e, t, n, i) { + var a = e && e.painter; + if (t) { + var o = a && a.getViewportRoot(); + o && H7(r, o, document.body, n, i); + } else { + r[0] = n, r[1] = i; + var s = a && a.getViewportRootOffset(); + s && (r[0] += s.offsetLeft, r[1] += s.offsetTop); + } + r[2] = r[0] / e.getWidth(), r[3] = r[1] / e.getHeight(); +} +var lpe = ( + /** @class */ + function() { + function r(e, t, n) { + if (this._show = !1, this._styleCoord = [0, 0, 0, 0], this._enterable = !0, this._alwaysShowContent = !1, this._firstShow = !0, this._longHide = !0, Dr.wxa) + return null; + var i = document.createElement("div"); + i.domBelongToZr = !0, this.el = i; + var a = this._zr = t.getZr(), o = this._appendToBody = n && n.appendToBody; + LR(this._styleCoord, a, o, t.getWidth() / 2, t.getHeight() / 2), o ? document.body.appendChild(i) : e.appendChild(i), this._container = e; + var s = this; + i.onmouseenter = function() { + s._enterable && (clearTimeout(s._hideTimeout), s._show = !0), s._inContent = !0; + }, i.onmousemove = function(l) { + if (l = l || window.event, !s._enterable) { + var u = a.handler, c = a.painter.getViewportRoot(); + Go(c, l, !0), u.dispatch("mousemove", l); + } + }, i.onmouseleave = function() { + s._inContent = !1, s._enterable && s._show && s.hideLater(s._hideDelay); + }; + } + return r.prototype.update = function(e) { + var t = this._container, n = epe(t, "position"), i = t.style; + i.position !== "absolute" && n !== "absolute" && (i.position = "relative"); + var a = e.get("alwaysShowContent"); + a && this._moveIfResized(), this._alwaysShowContent = a, this.el.className = e.get("className") || ""; + }, r.prototype.show = function(e, t) { + clearTimeout(this._hideTimeout), clearTimeout(this._longHideTimeout); + var n = this.el, i = n.style, a = this._styleCoord; + n.innerHTML ? i.cssText = rpe + spe(e, !this._firstShow, this._longHide) + OR(a[0], a[1], !0) + ("border-color:" + Xh(t) + ";") + (e.get("extraCssText") || "") + (";pointer-events:" + (this._enterable ? "auto" : "none")) : i.display = "none", this._show = !0, this._firstShow = !1, this._longHide = !1; + }, r.prototype.setContent = function(e, t, n, i, a) { + var o = this.el; + if (e == null) { + o.innerHTML = ""; + return; + } + var s = ""; + if (ut(a) && n.get("trigger") === "item" && !iV(n) && (s = ipe(n, i, a)), ut(e)) + o.innerHTML = e + s; + else if (e) { + o.innerHTML = "", We(e) || (e = [e]); + for (var l = 0; l < e.length; l++) + Od(e[l]) && e[l].parentNode !== o && o.appendChild(e[l]); + if (s && o.childNodes.length) { + var u = document.createElement("div"); + u.innerHTML = s, o.appendChild(u); + } + } + }, r.prototype.setEnterable = function(e) { + this._enterable = e; + }, r.prototype.getSize = function() { + var e = this.el; + return [e.offsetWidth, e.offsetHeight]; + }, r.prototype.moveTo = function(e, t) { + var n = this._styleCoord; + if (LR(n, this._zr, this._appendToBody, e, t), n[0] != null && n[1] != null) { + var i = this.el.style, a = OR(n[0], n[1]); + X(a, function(o) { + i[o[0]] = o[1]; + }); + } + }, r.prototype._moveIfResized = function() { + var e = this._styleCoord[2], t = this._styleCoord[3]; + this.moveTo(e * this._zr.getWidth(), t * this._zr.getHeight()); + }, r.prototype.hide = function() { + var e = this, t = this.el.style; + t.visibility = "hidden", t.opacity = "0", Dr.transform3dSupported && (t.willChange = ""), this._show = !1, this._longHideTimeout = setTimeout(function() { + return e._longHide = !0; + }, 500); + }, r.prototype.hideLater = function(e) { + this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent && (e ? (this._hideDelay = e, this._show = !1, this._hideTimeout = setTimeout(ft(this.hide, this), e)) : this.hide()); + }, r.prototype.isShow = function() { + return this._show; + }, r.prototype.dispose = function() { + this.el.parentNode.removeChild(this.el); + }, r; + }() +); +const upe = lpe; +var cpe = ( + /** @class */ + function() { + function r(e) { + this._show = !1, this._styleCoord = [0, 0, 0, 0], this._alwaysShowContent = !1, this._enterable = !0, this._zr = e.getZr(), RR(this._styleCoord, this._zr, e.getWidth() / 2, e.getHeight() / 2); + } + return r.prototype.update = function(e) { + var t = e.get("alwaysShowContent"); + t && this._moveIfResized(), this._alwaysShowContent = t; + }, r.prototype.show = function() { + this._hideTimeout && clearTimeout(this._hideTimeout), this.el.show(), this._show = !0; + }, r.prototype.setContent = function(e, t, n, i, a) { + var o = this; + kt(e) && Ur(""), this.el && this._zr.remove(this.el); + var s = n.getModel("textStyle"); + this.el = new kr({ + style: { + rich: t.richTextStyles, + text: e, + lineHeight: 22, + borderWidth: 1, + borderColor: i, + textShadowColor: s.get("textShadowColor"), + fill: n.get(["textStyle", "color"]), + padding: QF(n, "richText"), + verticalAlign: "top", + align: "left" + }, + z: n.get("z") + }), X(["backgroundColor", "borderRadius", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY"], function(u) { + o.el.style[u] = n.get(u); + }), X(["textShadowBlur", "textShadowOffsetX", "textShadowOffsetY"], function(u) { + o.el.style[u] = s.get(u) || 0; + }), this._zr.add(this.el); + var l = this; + this.el.on("mouseover", function() { + l._enterable && (clearTimeout(l._hideTimeout), l._show = !0), l._inContent = !0; + }), this.el.on("mouseout", function() { + l._enterable && l._show && l.hideLater(l._hideDelay), l._inContent = !1; + }); + }, r.prototype.setEnterable = function(e) { + this._enterable = e; + }, r.prototype.getSize = function() { + var e = this.el, t = this.el.getBoundingRect(), n = PR(e.style); + return [t.width + n.left + n.right, t.height + n.top + n.bottom]; + }, r.prototype.moveTo = function(e, t) { + var n = this.el; + if (n) { + var i = this._styleCoord; + RR(i, this._zr, e, t), e = i[0], t = i[1]; + var a = n.style, o = Vu(a.borderWidth || 0), s = PR(a); + n.x = e + o + s.left, n.y = t + o + s.top, n.markRedraw(); + } + }, r.prototype._moveIfResized = function() { + var e = this._styleCoord[2], t = this._styleCoord[3]; + this.moveTo(e * this._zr.getWidth(), t * this._zr.getHeight()); + }, r.prototype.hide = function() { + this.el && this.el.hide(), this._show = !1; + }, r.prototype.hideLater = function(e) { + this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent && (e ? (this._hideDelay = e, this._show = !1, this._hideTimeout = setTimeout(ft(this.hide, this), e)) : this.hide()); + }, r.prototype.isShow = function() { + return this._show; + }, r.prototype.dispose = function() { + this._zr.remove(this.el); + }, r; + }() +); +function Vu(r) { + return Math.max(0, r); +} +function PR(r) { + var e = Vu(r.shadowBlur || 0), t = Vu(r.shadowOffsetX || 0), n = Vu(r.shadowOffsetY || 0); + return { + left: Vu(e - t), + right: Vu(e + t), + top: Vu(e - n), + bottom: Vu(e + n) + }; +} +function RR(r, e, t, n) { + r[0] = t, r[1] = n, r[2] = r[0] / e.getWidth(), r[3] = r[1] / e.getHeight(); +} +const hpe = cpe; +var fpe = new Or({ + shape: { + x: -1, + y: -1, + width: 2, + height: 2 + } +}), dpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n) { + if (!(Dr.node || !n.getDom())) { + var i = t.getComponent("tooltip"), a = this._renderMode = EZ(i.get("renderMode")); + this._tooltipContent = a === "richText" ? new hpe(n) : new upe(n.getDom(), n, { + appendToBody: i.get("appendToBody", !0) + }); + } + }, e.prototype.render = function(t, n, i) { + if (!(Dr.node || !i.getDom())) { + this.group.removeAll(), this._tooltipModel = t, this._ecModel = n, this._api = i; + var a = this._tooltipContent; + a.update(t), a.setEnterable(t.get("enterable")), this._initGlobalListener(), this._keepShow(), this._renderMode !== "richText" && t.get("transitionDuration") ? sv(this, "_updatePosition", 50, "fixRate") : Sg(this, "_updatePosition"); + } + }, e.prototype._initGlobalListener = function() { + var t = this._tooltipModel, n = t.get("triggerOn"); + G3("itemTooltip", this._api, ft(function(i, a, o) { + n !== "none" && (n.indexOf(i) >= 0 ? this._tryShow(a, o) : i === "leave" && this._hide(o)); + }, this)); + }, e.prototype._keepShow = function() { + var t = this._tooltipModel, n = this._ecModel, i = this._api, a = t.get("triggerOn"); + if (this._lastX != null && this._lastY != null && a !== "none" && a !== "click") { + var o = this; + clearTimeout(this._refreshUpdateTimeout), this._refreshUpdateTimeout = setTimeout(function() { + !i.isDisposed() && o.manuallyShowTip(t, n, i, { + x: o._lastX, + y: o._lastY, + dataByCoordSys: o._lastDataByCoordSys + }); + }); + } + }, e.prototype.manuallyShowTip = function(t, n, i, a) { + if (!(a.from === this.uid || Dr.node || !i.getDom())) { + var o = NR(a, i); + this._ticket = ""; + var s = a.dataByCoordSys, l = mpe(a, n, i); + if (l) { + var u = l.el.getBoundingRect().clone(); + u.applyTransform(l.el.transform), this._tryShow({ + offsetX: u.x + u.width / 2, + offsetY: u.y + u.height / 2, + target: l.el, + position: a.position, + // When manully trigger, the mouse is not on the el, so we'd better to + // position tooltip on the bottom of the el and display arrow is possible. + positionDefault: "bottom" + }, o); + } else if (a.tooltip && a.x != null && a.y != null) { + var c = fpe; + c.x = a.x, c.y = a.y, c.update(), Ft(c).tooltipConfig = { + name: null, + option: a.tooltip + }, this._tryShow({ + offsetX: a.x, + offsetY: a.y, + target: c + }, o); + } else if (s) + this._tryShow({ + offsetX: a.x, + offsetY: a.y, + position: a.position, + dataByCoordSys: s, + tooltipOption: a.tooltipOption + }, o); + else if (a.seriesIndex != null) { + if (this._manuallyAxisShowTip(t, n, i, a)) + return; + var h = U3(a, n), f = h.point[0], v = h.point[1]; + f != null && v != null && this._tryShow({ + offsetX: f, + offsetY: v, + target: h.el, + position: a.position, + // When manully trigger, the mouse is not on the el, so we'd better to + // position tooltip on the bottom of the el and display arrow is possible. + positionDefault: "bottom" + }, o); + } else + a.x != null && a.y != null && (i.dispatchAction({ + type: "updateAxisPointer", + x: a.x, + y: a.y + }), this._tryShow({ + offsetX: a.x, + offsetY: a.y, + position: a.position, + target: i.getZr().findHover(a.x, a.y).target + }, o)); + } + }, e.prototype.manuallyHideTip = function(t, n, i, a) { + var o = this._tooltipContent; + this._tooltipModel && o.hideLater(this._tooltipModel.get("hideDelay")), this._lastX = this._lastY = this._lastDataByCoordSys = null, a.from !== this.uid && this._hide(NR(a, i)); + }, e.prototype._manuallyAxisShowTip = function(t, n, i, a) { + var o = a.seriesIndex, s = a.dataIndex, l = n.getComponent("axisPointer").coordSysAxesInfo; + if (!(o == null || s == null || l == null)) { + var u = n.getSeriesByIndex(o); + if (u) { + var c = u.getData(), h = gp([c.getItemModel(s), u, (u.coordinateSystem || {}).model], this._tooltipModel); + if (h.get("trigger") === "axis") + return i.dispatchAction({ + type: "updateAxisPointer", + seriesIndex: o, + dataIndex: s, + position: a.position + }), !0; + } + } + }, e.prototype._tryShow = function(t, n) { + var i = t.target, a = this._tooltipModel; + if (a) { + this._lastX = t.offsetX, this._lastY = t.offsetY; + var o = t.dataByCoordSys; + if (o && o.length) + this._showAxisTooltip(o, t); + else if (i) { + this._lastDataByCoordSys = null; + var s, l; + Mh(i, function(u) { + if (Ft(u).dataIndex != null) + return s = u, !0; + if (Ft(u).tooltipConfig != null) + return l = u, !0; + }, !0), s ? this._showSeriesItemTooltip(t, s, n) : l ? this._showComponentItemTooltip(t, l, n) : this._hide(n); + } else + this._lastDataByCoordSys = null, this._hide(n); + } + }, e.prototype._showOrMove = function(t, n) { + var i = t.get("showDelay"); + n = ft(n, this), clearTimeout(this._showTimout), i > 0 ? this._showTimout = setTimeout(n, i) : n(); + }, e.prototype._showAxisTooltip = function(t, n) { + var i = this._ecModel, a = this._tooltipModel, o = [n.offsetX, n.offsetY], s = gp([n.tooltipOption], a), l = this._renderMode, u = [], c = Di("section", { + blocks: [], + noHeader: !0 + }), h = [], f = new XS(); + X(t, function(m) { + X(m.dataByAxis, function(_) { + var y = i.getComponent(_.axisDim + "Axis", _.axisIndex), x = _.value; + if (!(!y || x == null)) { + var g = $3(x, y.axis, i, _.seriesDataIndices, _.valueLabelOpt), S = Di("section", { + header: g, + noHeader: !Qo(g), + sortBlocks: !0, + blocks: [] + }); + c.blocks.push(S), X(_.seriesDataIndices, function(T) { + var C = i.getSeriesByIndex(T.seriesIndex), E = T.dataIndexInside, M = C.getDataParams(E); + if (!(M.dataIndex < 0)) { + M.axisDim = _.axisDim, M.axisIndex = _.axisIndex, M.axisType = _.axisType, M.axisId = _.axisId, M.axisValue = VA(y.axis, { + value: x + }), M.axisValueLabel = g, M.marker = f.makeTooltipMarker("item", Xh(M.color), l); + var P = SO(C.formatTooltip(E, !0, null)), R = P.frag; + if (R) { + var N = gp([C], a).get("valueFormatter"); + S.blocks.push(N ? Fe({ + valueFormatter: N + }, R) : R); + } + P.text && h.push(P.text), u.push(M); + } + }); + } + }); + }), c.blocks.reverse(), h.reverse(); + var v = n.position, b = s.get("order"), w = EO(c, f, l, b, i.get("useUTC"), s.get("textStyle")); + w && h.unshift(w); + var p = l === "richText" ? ` + +` : "
", d = h.join(p); + this._showOrMove(s, function() { + this._updateContentNotChangedOnAxis(t, u) ? this._updatePosition(s, v, o[0], o[1], this._tooltipContent, u) : this._showTooltipContent(s, d, u, Math.random() + "", o[0], o[1], v, null, f); + }); + }, e.prototype._showSeriesItemTooltip = function(t, n, i) { + var a = this._ecModel, o = Ft(n), s = o.seriesIndex, l = a.getSeriesByIndex(s), u = o.dataModel || l, c = o.dataIndex, h = o.dataType, f = u.getData(h), v = this._renderMode, b = t.positionDefault, w = gp([f.getItemModel(c), u, l && (l.coordinateSystem || {}).model], this._tooltipModel, b ? { + position: b + } : null), p = w.get("trigger"); + if (!(p != null && p !== "item")) { + var d = u.getDataParams(c, h), m = new XS(); + d.marker = m.makeTooltipMarker("item", Xh(d.color), v); + var _ = SO(u.formatTooltip(c, !1, h)), y = w.get("order"), x = w.get("valueFormatter"), g = _.frag, S = g ? EO(x ? Fe({ + valueFormatter: x + }, g) : g, m, v, y, a.get("useUTC"), w.get("textStyle")) : _.text, T = "item_" + u.name + "_" + c; + this._showOrMove(w, function() { + this._showTooltipContent(w, S, d, T, t.offsetX, t.offsetY, t.position, t.target, m); + }), i({ + type: "showTip", + dataIndexInside: c, + dataIndex: f.getRawIndex(c), + seriesIndex: s, + from: this.uid + }); + } + }, e.prototype._showComponentItemTooltip = function(t, n, i) { + var a = Ft(n), o = a.tooltipConfig, s = o.option || {}; + if (ut(s)) { + var l = s; + s = { + content: l, + // Fixed formatter + formatter: l + }; + } + var u = [s], c = this._ecModel.getComponent(a.componentMainType, a.componentIndex); + c && u.push(c), u.push({ + formatter: s.content + }); + var h = t.positionDefault, f = gp(u, this._tooltipModel, h ? { + position: h + } : null), v = f.get("content"), b = Math.random() + "", w = new XS(); + this._showOrMove(f, function() { + var p = Ot(f.get("formatterParams") || {}); + this._showTooltipContent(f, v, p, b, t.offsetX, t.offsetY, t.position, n, w); + }), i({ + type: "showTip", + from: this.uid + }); + }, e.prototype._showTooltipContent = function(t, n, i, a, o, s, l, u, c) { + if (this._ticket = "", !(!t.get("showContent") || !t.get("show"))) { + var h = this._tooltipContent; + h.setEnterable(t.get("enterable")); + var f = t.get("formatter"); + l = l || t.get("position"); + var v = n, b = this._getNearestPoint([o, s], i, t.get("trigger"), t.get("borderColor")), w = b.color; + if (f) + if (ut(f)) { + var p = t.ecModel.get("useUTC"), d = We(i) ? i[0] : i, m = d && d.axisType && d.axisType.indexOf("time") >= 0; + v = f, m && (v = nm(d.axisValue, v, p)), v = cA(v, i, !0); + } else if (Tt(f)) { + var _ = ft(function(y, x) { + y === this._ticket && (h.setContent(x, c, t, w, l), this._updatePosition(t, l, o, s, h, i, u)); + }, this); + this._ticket = a, v = f(i, a, _); + } else + v = f; + h.setContent(v, c, t, w, l), h.show(t, w), this._updatePosition(t, l, o, s, h, i, u); + } + }, e.prototype._getNearestPoint = function(t, n, i, a) { + if (i === "axis" || We(n)) + return { + color: a || (this._renderMode === "html" ? "#fff" : "none") + }; + if (!We(n)) + return { + color: a || n.color || n.borderColor + }; + }, e.prototype._updatePosition = function(t, n, i, a, o, s, l) { + var u = this._api.getWidth(), c = this._api.getHeight(); + n = n || t.get("position"); + var h = o.getSize(), f = t.get("align"), v = t.get("verticalAlign"), b = l && l.getBoundingRect().clone(); + if (l && b.applyTransform(l.transform), Tt(n) && (n = n([i, a], s, o.el, b, { + viewSize: [u, c], + contentSize: h.slice() + })), We(n)) + i = ot(n[0], u), a = ot(n[1], c); + else if (kt(n)) { + var w = n; + w.width = h[0], w.height = h[1]; + var p = yi(w, { + width: u, + height: c + }); + i = p.x, a = p.y, f = null, v = null; + } else if (ut(n) && l) { + var d = gpe(n, b, h, t.get("borderWidth")); + i = d[0], a = d[1]; + } else { + var d = vpe(i, a, o, u, c, f ? null : 20, v ? null : 20); + i = d[0], a = d[1]; + } + if (f && (i -= zR(f) ? h[0] / 2 : f === "right" ? h[0] : 0), v && (a -= zR(v) ? h[1] / 2 : v === "bottom" ? h[1] : 0), iV(t)) { + var d = ppe(i, a, o, u, c); + i = d[0], a = d[1]; + } + o.moveTo(i, a); + }, e.prototype._updateContentNotChangedOnAxis = function(t, n) { + var i = this._lastDataByCoordSys, a = this._cbParamsList, o = !!i && i.length === t.length; + return o && X(i, function(s, l) { + var u = s.dataByAxis || [], c = t[l] || {}, h = c.dataByAxis || []; + o = o && u.length === h.length, o && X(u, function(f, v) { + var b = h[v] || {}, w = f.seriesDataIndices || [], p = b.seriesDataIndices || []; + o = o && f.value === b.value && f.axisType === b.axisType && f.axisId === b.axisId && w.length === p.length, o && X(w, function(d, m) { + var _ = p[m]; + o = o && d.seriesIndex === _.seriesIndex && d.dataIndex === _.dataIndex; + }), a && X(f.seriesDataIndices, function(d) { + var m = d.seriesIndex, _ = n[m], y = a[m]; + _ && y && y.data !== _.data && (o = !1); + }); + }); + }), this._lastDataByCoordSys = t, this._cbParamsList = n, !!o; + }, e.prototype._hide = function(t) { + this._lastDataByCoordSys = null, t({ + type: "hideTip", + from: this.uid + }); + }, e.prototype.dispose = function(t, n) { + Dr.node || !n.getDom() || (Sg(this, "_updatePosition"), this._tooltipContent.dispose(), MT("itemTooltip", n)); + }, e.type = "tooltip", e; + }(Sn) +); +function gp(r, e, t) { + var n = e.ecModel, i; + t ? (i = new qr(t, n, n), i = new qr(e.option, i, n)) : i = e; + for (var a = r.length - 1; a >= 0; a--) { + var o = r[a]; + o && (o instanceof qr && (o = o.get("tooltip", !0)), ut(o) && (o = { + formatter: o + }), o && (i = new qr(o, i, n))); + } + return i; +} +function NR(r, e) { + return r.dispatchAction || ft(e.dispatchAction, e); +} +function vpe(r, e, t, n, i, a, o) { + var s = t.getSize(), l = s[0], u = s[1]; + return a != null && (r + l + a + 2 > n ? r -= l + a : r += a), o != null && (e + u + o > i ? e -= u + o : e += o), [r, e]; +} +function ppe(r, e, t, n, i) { + var a = t.getSize(), o = a[0], s = a[1]; + return r = Math.min(r + o, n) - o, e = Math.min(e + s, i) - s, r = Math.max(r, 0), e = Math.max(e, 0), [r, e]; +} +function gpe(r, e, t, n) { + var i = t[0], a = t[1], o = Math.ceil(Math.SQRT2 * n) + 8, s = 0, l = 0, u = e.width, c = e.height; + switch (r) { + case "inside": + s = e.x + u / 2 - i / 2, l = e.y + c / 2 - a / 2; + break; + case "top": + s = e.x + u / 2 - i / 2, l = e.y - a - o; + break; + case "bottom": + s = e.x + u / 2 - i / 2, l = e.y + c + o; + break; + case "left": + s = e.x - i - o, l = e.y + c / 2 - a / 2; + break; + case "right": + s = e.x + u + o, l = e.y + c / 2 - a / 2; + } + return [s, l]; +} +function zR(r) { + return r === "center" || r === "middle"; +} +function mpe(r, e, t) { + var n = VI(r).queryOptionMap, i = n.keys()[0]; + if (!(!i || i === "series")) { + var a = Jg(e, i, n.get(i), { + useDefault: !1, + enableAll: !1, + enableNone: !1 + }), o = a.models[0]; + if (o) { + var s = t.getViewOfComponentModel(o), l; + if (s.group.traverse(function(u) { + var c = Ft(u).tooltipConfig; + if (c && c.name === r.name) + return l = u, !0; + }), l) + return { + componentMainType: i, + componentIndex: o.componentIndex, + el: l + }; + } + } +} +const ype = dpe; +function _pe(r) { + Kt(gm), r.registerComponentModel(Qve), r.registerComponentView(ype), r.registerAction({ + type: "showTip", + event: "showTip", + update: "tooltip:manuallyShowTip" + }, Qn), r.registerAction({ + type: "hideTip", + event: "hideTip", + update: "tooltip:manuallyHideTip" + }, Qn); +} +var bpe = ["rect", "polygon", "keep", "clear"]; +function xpe(r, e) { + var t = ln(r ? r.brush : []); + if (t.length) { + var n = []; + X(t, function(l) { + var u = l.hasOwnProperty("toolbox") ? l.toolbox : []; + u instanceof Array && (n = n.concat(u)); + }); + var i = r && r.toolbox; + We(i) && (i = i[0]), i || (i = { + feature: {} + }, r.toolbox = [i]); + var a = i.feature || (i.feature = {}), o = a.brush || (a.brush = {}), s = o.type || (o.type = []); + s.push.apply(s, n), Spe(s), e && !s.length && s.push.apply(s, bpe); + } +} +function Spe(r) { + var e = {}; + X(r, function(t) { + e[t] = 1; + }), r.length = 0, X(e, function(t, n) { + r.push(n); + }); +} +var BR = X; +function jR(r) { + if (r) { + for (var e in r) + if (r.hasOwnProperty(e)) + return !0; + } +} +function RT(r, e, t) { + var n = {}; + return BR(e, function(a) { + var o = n[a] = i(); + BR(r[a], function(s, l) { + if (Wi.isValidType(l)) { + var u = { + type: l, + visual: s + }; + t && t(u, a), o[l] = new Wi(u), l === "opacity" && (u = Ot(u), u.type = "colorAlpha", o.__hidden.__alphaForOpacity = new Wi(u)); + } + }); + }), n; + function i() { + var a = function() { + }; + a.prototype.__hidden = a.prototype; + var o = new a(); + return o; + } +} +function lV(r, e, t) { + var n; + X(t, function(i) { + e.hasOwnProperty(i) && jR(e[i]) && (n = !0); + }), n && X(t, function(i) { + e.hasOwnProperty(i) && jR(e[i]) ? r[i] = Ot(e[i]) : delete r[i]; + }); +} +function wpe(r, e, t, n, i, a) { + var o = {}; + X(r, function(h) { + var f = Wi.prepareVisualTypes(e[h]); + o[h] = f; + }); + var s; + function l(h) { + return SA(t, s, h); + } + function u(h, f) { + l4(t, s, h, f); + } + a == null ? t.each(c) : t.each([a], c); + function c(h, f) { + s = a == null ? h : f; + var v = t.getRawDataItem(s); + if (!(v && v.visualMap === !1)) + for (var b = n.call(i, h), w = e[b], p = o[b], d = 0, m = p.length; d < m; d++) { + var _ = p[d]; + w[_] && w[_].applyVisual(h, l, u); + } + } +} +function Cpe(r, e, t, n) { + var i = {}; + return X(r, function(a) { + var o = Wi.prepareVisualTypes(e[a]); + i[a] = o; + }), { + progress: function(o, s) { + var l; + n != null && (l = s.getDimensionIndex(n)); + function u(x) { + return SA(s, h, x); + } + function c(x, g) { + l4(s, h, x, g); + } + for (var h, f = s.getStore(); (h = o.next()) != null; ) { + var v = s.getRawDataItem(h); + if (!(v && v.visualMap === !1)) + for (var b = n != null ? f.get(l, h) : h, w = t(b), p = e[w], d = i[w], m = 0, _ = d.length; m < _; m++) { + var y = d[m]; + p[y] && p[y].applyVisual(b, u, c); + } + } + } + }; +} +function Tpe(r) { + var e = r.brushType, t = { + point: function(n) { + return FR[e].point(n, t, r); + }, + rect: function(n) { + return FR[e].rect(n, t, r); + } + }; + return t; +} +var FR = { + lineX: $R(0), + lineY: $R(1), + rect: { + point: function(r, e, t) { + return r && t.boundingRect.contain(r[0], r[1]); + }, + rect: function(r, e, t) { + return r && t.boundingRect.intersect(r); + } + }, + polygon: { + point: function(r, e, t) { + return r && t.boundingRect.contain(r[0], r[1]) && bh(t.range, r[0], r[1]); + }, + rect: function(r, e, t) { + var n = t.range; + if (!r || n.length <= 1) + return !1; + var i = r.x, a = r.y, o = r.width, s = r.height, l = n[0]; + if (bh(n, i, a) || bh(n, i + o, a) || bh(n, i, a + s) || bh(n, i + o, a + s) || Wt.create(r).contain(l[0], l[1]) || Ep(i, a, i + o, a, n) || Ep(i, a, i, a + s, n) || Ep(i + o, a, i + o, a + s, n) || Ep(i, a + s, i + o, a + s, n)) + return !0; + } + } +}; +function $R(r) { + var e = ["x", "y"], t = ["width", "height"]; + return { + point: function(n, i, a) { + if (n) { + var o = a.range, s = n[r]; + return mp(s, o); + } + }, + rect: function(n, i, a) { + if (n) { + var o = a.range, s = [n[e[r]], n[e[r]] + n[t[r]]]; + return s[1] < s[0] && s.reverse(), mp(s[0], o) || mp(s[1], o) || mp(o[0], s) || mp(o[1], s); + } + } + }; +} +function mp(r, e) { + return e[0] <= r && r <= e[1]; +} +var HR = ["inBrush", "outOfBrush"], cC = "__ecBrushSelect", NT = "__ecInBrushSelectEvent"; +function uV(r) { + r.eachComponent({ + mainType: "brush" + }, function(e) { + var t = e.brushTargetManager = new jE(e.option, r); + t.setInputRanges(e.areas, r); + }); +} +function Ipe(r, e, t) { + var n = [], i, a; + r.eachComponent({ + mainType: "brush" + }, function(o) { + t && t.type === "takeGlobalCursor" && o.setBrushOption(t.key === "brush" ? t.brushOption : { + brushType: !1 + }); + }), uV(r), r.eachComponent({ + mainType: "brush" + }, function(o, s) { + var l = { + brushId: o.id, + brushIndex: s, + brushName: o.name, + areas: Ot(o.areas), + selected: [] + }; + n.push(l); + var u = o.option, c = u.brushLink, h = [], f = [], v = [], b = !1; + s || (i = u.throttleType, a = u.throttleDelay); + var w = Ke(o.areas, function(x) { + var g = Dpe[x.brushType], S = Mt({ + boundingRect: g ? g(x) : void 0 + }, x); + return S.selectors = Tpe(S), S; + }), p = RT(o.option, HR, function(x) { + x.mappingMethod = "fixed"; + }); + We(c) && X(c, function(x) { + h[x] = 1; + }); + function d(x) { + return c === "all" || !!h[x]; + } + function m(x) { + return !!x.length; + } + r.eachSeries(function(x, g) { + var S = v[g] = []; + x.subType === "parallel" ? _(x, g) : y(x, g, S); + }); + function _(x, g) { + var S = x.coordinateSystem; + b = b || S.hasAxisBrushed(), d(g) && S.eachActiveState(x.getData(), function(T, C) { + T === "active" && (f[C] = 1); + }); + } + function y(x, g, S) { + if (!(!x.brushSelector || Mpe(o, g)) && (X(w, function(C) { + o.brushTargetManager.controlSeries(C, x, r) && S.push(C), b = b || m(S); + }), d(g) && m(S))) { + var T = x.getData(); + T.each(function(C) { + VR(x, S, T, C) && (f[C] = 1); + }); + } + } + r.eachSeries(function(x, g) { + var S = { + seriesId: x.id, + seriesIndex: g, + seriesName: x.name, + dataIndex: [] + }; + l.selected.push(S); + var T = v[g], C = x.getData(), E = d(g) ? function(M) { + return f[M] ? (S.dataIndex.push(C.getRawIndex(M)), "inBrush") : "outOfBrush"; + } : function(M) { + return VR(x, T, C, M) ? (S.dataIndex.push(C.getRawIndex(M)), "inBrush") : "outOfBrush"; + }; + (d(g) ? b : m(T)) && wpe(HR, p, C, E); + }); + }), Ape(e, i, a, n, t); +} +function Ape(r, e, t, n, i) { + if (i) { + var a = r.getZr(); + if (!a[NT]) { + a[cC] || (a[cC] = Epe); + var o = sv(a, cC, t, e); + o(r, n); + } + } +} +function Epe(r, e) { + if (!r.isDisposed()) { + var t = r.getZr(); + t[NT] = !0, r.dispatchAction({ + type: "brushSelect", + batch: e + }), t[NT] = !1; + } +} +function VR(r, e, t, n) { + for (var i = 0, a = e.length; i < a; i++) { + var o = e[i]; + if (r.brushSelector(n, t, o.selectors, o)) + return !0; + } +} +function Mpe(r, e) { + var t = r.option.seriesIndex; + return t != null && t !== "all" && (We(t) ? ir(t, e) < 0 : e !== t); +} +var Dpe = { + rect: function(r) { + return GR(r.range); + }, + polygon: function(r) { + for (var e, t = r.range, n = 0, i = t.length; n < i; n++) { + e = e || [[1 / 0, -1 / 0], [1 / 0, -1 / 0]]; + var a = t[n]; + a[0] < e[0][0] && (e[0][0] = a[0]), a[0] > e[0][1] && (e[0][1] = a[0]), a[1] < e[1][0] && (e[1][0] = a[1]), a[1] > e[1][1] && (e[1][1] = a[1]); + } + return e && GR(e); + } +}; +function GR(r) { + return new Wt(r[0][0], r[1][0], r[0][1] - r[0][0], r[1][1] - r[1][0]); +} +var kpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n) { + this.ecModel = t, this.api = n, this.model, (this._brushController = new _E(n.getZr())).on("brush", ft(this._onBrush, this)).mount(); + }, e.prototype.render = function(t, n, i, a) { + this.model = t, this._updateController(t, n, i, a); + }, e.prototype.updateTransform = function(t, n, i, a) { + uV(n), this._updateController(t, n, i, a); + }, e.prototype.updateVisual = function(t, n, i, a) { + this.updateTransform(t, n, i, a); + }, e.prototype.updateView = function(t, n, i, a) { + this._updateController(t, n, i, a); + }, e.prototype._updateController = function(t, n, i, a) { + (!a || a.$from !== t.id) && this._brushController.setPanels(t.brushTargetManager.makePanelOpts(i)).enableBrush(t.brushOption).updateCovers(t.areas.slice()); + }, e.prototype.dispose = function() { + this._brushController.dispose(); + }, e.prototype._onBrush = function(t) { + var n = this.model.id, i = this.model.brushTargetManager.setOutputRanges(t.areas, this.ecModel); + (!t.isEnd || t.removeOnClick) && this.api.dispatchAction({ + type: "brush", + brushId: n, + areas: Ot(i), + $from: n + }), t.isEnd && this.api.dispatchAction({ + type: "brushEnd", + brushId: n, + areas: Ot(i), + $from: n + }); + }, e.type = "brush", e; + }(Sn) +); +const Ope = kpe; +var Lpe = "#ddd", Ppe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.areas = [], t.brushOption = {}, t; + } + return e.prototype.optionUpdated = function(t, n) { + var i = this.option; + !n && lV(i, t, ["inBrush", "outOfBrush"]); + var a = i.inBrush = i.inBrush || {}; + i.outOfBrush = i.outOfBrush || { + color: Lpe + }, a.hasOwnProperty("liftZ") || (a.liftZ = 5); + }, e.prototype.setAreas = function(t) { + t && (this.areas = Ke(t, function(n) { + return UR(this.option, n); + }, this)); + }, e.prototype.setBrushOption = function(t) { + this.brushOption = UR(this.option, t), this.brushType = this.brushOption.brushType; + }, e.type = "brush", e.dependencies = ["geo", "grid", "xAxis", "yAxis", "parallel", "series"], e.defaultOption = { + seriesIndex: "all", + brushType: "rect", + brushMode: "single", + transformable: !0, + brushStyle: { + borderWidth: 1, + color: "rgba(210,219,238,0.3)", + borderColor: "#D2DBEE" + }, + throttleType: "fixRate", + throttleDelay: 0, + removeOnClick: !0, + z: 1e4 + }, e; + }(xr) +); +function UR(r, e) { + return Ut({ + brushType: r.brushType, + brushMode: r.brushMode, + transformable: r.transformable, + brushStyle: new qr(r.brushStyle).getItemStyle(), + removeOnClick: r.removeOnClick, + z: r.z + }, e, !0); +} +const Rpe = Ppe; +var Npe = ["rect", "polygon", "lineX", "lineY", "keep", "clear"], zpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + return r !== null && r.apply(this, arguments) || this; + } + return e.prototype.render = function(t, n, i) { + var a, o, s; + n.eachComponent({ + mainType: "brush" + }, function(l) { + a = l.brushType, o = l.brushOption.brushMode || "single", s = s || !!l.areas.length; + }), this._brushType = a, this._brushMode = o, X(t.get("type", !0), function(l) { + t.setIconStatus(l, (l === "keep" ? o === "multiple" : l === "clear" ? s : l === a) ? "emphasis" : "normal"); + }); + }, e.prototype.updateView = function(t, n, i) { + this.render(t, n, i); + }, e.prototype.getIcons = function() { + var t = this.model, n = t.get("icon", !0), i = {}; + return X(t.get("type", !0), function(a) { + n[a] && (i[a] = n[a]); + }), i; + }, e.prototype.onclick = function(t, n, i) { + var a = this._brushType, o = this._brushMode; + i === "clear" ? (n.dispatchAction({ + type: "axisAreaSelect", + intervals: [] + }), n.dispatchAction({ + type: "brush", + command: "clear", + // Clear all areas of all brush components. + areas: [] + })) : n.dispatchAction({ + type: "takeGlobalCursor", + key: "brush", + brushOption: { + brushType: i === "keep" ? a : a === i ? !1 : i, + brushMode: i === "keep" ? o === "multiple" ? "single" : "multiple" : o + } + }); + }, e.getDefaultOption = function(t) { + var n = { + show: !0, + type: Npe.slice(), + icon: { + /* eslint-disable */ + rect: "M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13", + polygon: "M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2", + lineX: "M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4", + lineY: "M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4", + keep: "M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z", + clear: "M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2" + // jshint ignore:line + /* eslint-enable */ + }, + // `rect`, `polygon`, `lineX`, `lineY`, `keep`, `clear` + title: t.getLocaleModel().get(["toolbox", "brush", "title"]) + }; + return n; + }, e; + }(Zo) +); +const Bpe = zpe; +function jpe(r) { + r.registerComponentView(Ope), r.registerComponentModel(Rpe), r.registerPreprocessor(xpe), r.registerVisual(r.PRIORITY.VISUAL.BRUSH, Ipe), r.registerAction({ + type: "brush", + event: "brush", + update: "updateVisual" + }, function(e, t) { + t.eachComponent({ + mainType: "brush", + query: e + }, function(n) { + n.setAreas(e.areas); + }); + }), r.registerAction({ + type: "brushSelect", + event: "brushSelected", + update: "none" + }, Qn), r.registerAction({ + type: "brushEnd", + event: "brushEnd", + update: "none" + }, Qn), ud("brush", Bpe); +} +var Fpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.layoutMode = { + type: "box", + ignoreSize: !0 + }, t; + } + return e.type = "title", e.defaultOption = { + // zlevel: 0, + z: 6, + show: !0, + text: "", + target: "blank", + subtext: "", + subtarget: "blank", + left: 0, + top: 0, + backgroundColor: "rgba(0,0,0,0)", + borderColor: "#ccc", + borderWidth: 0, + padding: 5, + itemGap: 10, + textStyle: { + fontSize: 18, + fontWeight: "bold", + color: "#464646" + }, + subtextStyle: { + fontSize: 12, + color: "#6E7079" + } + }, e; + }(xr) +), $pe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.render = function(t, n, i) { + if (this.group.removeAll(), !!t.get("show")) { + var a = this.group, o = t.getModel("textStyle"), s = t.getModel("subtextStyle"), l = t.get("textAlign"), u = Jt(t.get("textBaseline"), t.get("textVerticalAlign")), c = new kr({ + style: gn(o, { + text: t.get("text"), + fill: o.getTextColor() + }, { + disableBox: !0 + }), + z2: 10 + }), h = c.getBoundingRect(), f = t.get("subtext"), v = new kr({ + style: gn(s, { + text: f, + fill: s.getTextColor(), + y: h.height + t.get("itemGap"), + verticalAlign: "top" + }, { + disableBox: !0 + }), + z2: 10 + }), b = t.get("link"), w = t.get("sublink"), p = t.get("triggerEvent", !0); + c.silent = !b && !p, v.silent = !w && !p, b && c.on("click", function() { + w_(b, "_" + t.get("target")); + }), w && v.on("click", function() { + w_(w, "_" + t.get("subtarget")); + }), Ft(c).eventData = Ft(v).eventData = p ? { + componentType: "title", + componentIndex: t.componentIndex + } : null, a.add(c), f && a.add(v); + var d = a.getBoundingRect(), m = t.getBoxLayoutParams(); + m.width = d.width, m.height = d.height; + var _ = yi(m, { + width: i.getWidth(), + height: i.getHeight() + }, t.get("padding")); + l || (l = t.get("left") || t.get("right"), l === "middle" && (l = "center"), l === "right" ? _.x += _.width : l === "center" && (_.x += _.width / 2)), u || (u = t.get("top") || t.get("bottom"), u === "center" && (u = "middle"), u === "bottom" ? _.y += _.height : u === "middle" && (_.y += _.height / 2), u = u || "top"), a.x = _.x, a.y = _.y, a.markRedraw(); + var y = { + align: l, + verticalAlign: u + }; + c.setStyle(y), v.setStyle(y), d = a.getBoundingRect(); + var x = _.margin, g = t.getItemStyle(["color", "opacity"]); + g.fill = t.get("backgroundColor"); + var S = new Or({ + shape: { + x: d.x - x[3], + y: d.y - x[0], + width: d.width + x[1] + x[3], + height: d.height + x[0] + x[2], + r: t.get("borderRadius") + }, + style: g, + subPixelOptimize: !0, + silent: !0 + }); + a.add(S); + } + }, e.type = "title", e; + }(Sn) +); +function Hpe(r) { + r.registerComponentModel(Fpe), r.registerComponentView($pe); +} +var Vpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.layoutMode = "box", t; + } + return e.prototype.init = function(t, n, i) { + this.mergeDefaultAndTheme(t, i), this._initData(); + }, e.prototype.mergeOption = function(t) { + r.prototype.mergeOption.apply(this, arguments), this._initData(); + }, e.prototype.setCurrentIndex = function(t) { + t == null && (t = this.option.currentIndex); + var n = this._data.count(); + this.option.loop ? t = (t % n + n) % n : (t >= n && (t = n - 1), t < 0 && (t = 0)), this.option.currentIndex = t; + }, e.prototype.getCurrentIndex = function() { + return this.option.currentIndex; + }, e.prototype.isIndexMax = function() { + return this.getCurrentIndex() >= this._data.count() - 1; + }, e.prototype.setPlayState = function(t) { + this.option.autoPlay = !!t; + }, e.prototype.getPlayState = function() { + return !!this.option.autoPlay; + }, e.prototype._initData = function() { + var t = this.option, n = t.data || [], i = t.axisType, a = this._names = [], o; + i === "category" ? (o = [], X(n, function(u, c) { + var h = Si(Xd(u), ""), f; + kt(u) ? (f = Ot(u), f.value = c) : f = c, o.push(f), a.push(h); + })) : o = n; + var s = { + category: "ordinal", + time: "time", + value: "number" + }[i] || "number", l = this._data = new Ui([{ + name: "value", + type: s + }], this); + l.initData(o, a); + }, e.prototype.getData = function() { + return this._data; + }, e.prototype.getCategories = function() { + if (this.get("axisType") === "category") + return this._names.slice(); + }, e.type = "timeline", e.defaultOption = { + // zlevel: 0, // 一级层叠 + z: 4, + show: !0, + axisType: "time", + realtime: !0, + left: "20%", + top: null, + right: "20%", + bottom: 0, + width: null, + height: 40, + padding: 5, + controlPosition: "left", + autoPlay: !1, + rewind: !1, + loop: !0, + playInterval: 2e3, + currentIndex: 0, + itemStyle: {}, + label: { + color: "#000" + }, + data: [] + }, e; + }(xr) +); +const WR = Vpe; +var cV = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "timeline.slider", e.defaultOption = Tc(WR.defaultOption, { + backgroundColor: "rgba(0,0,0,0)", + borderColor: "#ccc", + borderWidth: 0, + orient: "horizontal", + inverse: !1, + tooltip: { + trigger: "item" + // data item may also have tootip attr. + }, + symbol: "circle", + symbolSize: 12, + lineStyle: { + show: !0, + width: 2, + color: "#DAE1F5" + }, + label: { + position: "auto", + // When using number, label position is not + // restricted by viewRect. + // positive: right/bottom, negative: left/top + show: !0, + interval: "auto", + rotate: 0, + // formatter: null, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + color: "#A4B1D7" + }, + itemStyle: { + color: "#A4B1D7", + borderWidth: 1 + }, + checkpointStyle: { + symbol: "circle", + symbolSize: 15, + color: "#316bf3", + borderColor: "#fff", + borderWidth: 2, + shadowBlur: 2, + shadowOffsetX: 1, + shadowOffsetY: 1, + shadowColor: "rgba(0, 0, 0, 0.3)", + // borderColor: 'rgba(194,53,49, 0.5)', + animation: !0, + animationDuration: 300, + animationEasing: "quinticInOut" + }, + controlStyle: { + show: !0, + showPlayBtn: !0, + showPrevBtn: !0, + showNextBtn: !0, + itemSize: 24, + itemGap: 12, + position: "left", + playIcon: "path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z", + stopIcon: "path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z", + // eslint-disable-next-line max-len + nextIcon: "M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z", + // eslint-disable-next-line max-len + prevIcon: "M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z", + prevBtnSize: 18, + nextBtnSize: 18, + color: "#A4B1D7", + borderColor: "#A4B1D7", + borderWidth: 1 + }, + emphasis: { + label: { + show: !0, + // 其余属性默认使用全局文本样式,详见TEXTSTYLE + color: "#6f778d" + }, + itemStyle: { + color: "#316BF3" + }, + controlStyle: { + color: "#316BF3", + borderColor: "#316BF3", + borderWidth: 2 + } + }, + progress: { + lineStyle: { + color: "#316BF3" + }, + itemStyle: { + color: "#316BF3" + }, + label: { + color: "#6f778d" + } + }, + data: [] + }), e; + }(WR) +); +qn(cV, yA.prototype); +const Gpe = cV; +var Upe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "timeline", e; + }(Sn) +); +const Wpe = Upe; +var Ype = ( + /** @class */ + function(r) { + Pe(e, r); + function e(t, n, i, a) { + var o = r.call(this, t, n, i) || this; + return o.type = a || "value", o; + } + return e.prototype.getLabelModel = function() { + return this.model.getModel("label"); + }, e.prototype.isHorizontal = function() { + return this.model.get("orient") === "horizontal"; + }, e; + }(wo) +); +const Xpe = Ype; +var hC = Math.PI, YR = Rr(), Zpe = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function(t, n) { + this.api = n; + }, e.prototype.render = function(t, n, i) { + if (this.model = t, this.api = i, this.ecModel = n, this.group.removeAll(), t.get("show", !0)) { + var a = this._layout(t, i), o = this._createGroup("_mainGroup"), s = this._createGroup("_labelGroup"), l = this._axis = this._createAxis(a, t); + t.formatTooltip = function(u) { + var c = l.scale.getLabel({ + value: u + }); + return Di("nameValue", { + noName: !0, + value: c + }); + }, X(["AxisLine", "AxisTick", "Control", "CurrentPointer"], function(u) { + this["_render" + u](a, o, l, t); + }, this), this._renderAxisLabel(a, s, l, t), this._position(a, t); + } + this._doPlayStop(), this._updateTicksStatus(); + }, e.prototype.remove = function() { + this._clearTimer(), this.group.removeAll(); + }, e.prototype.dispose = function() { + this._clearTimer(); + }, e.prototype._layout = function(t, n) { + var i = t.get(["label", "position"]), a = t.get("orient"), o = Kpe(t, n), s; + i == null || i === "auto" ? s = a === "horizontal" ? o.y + o.height / 2 < n.getHeight() / 2 ? "-" : "+" : o.x + o.width / 2 < n.getWidth() / 2 ? "+" : "-" : ut(i) ? s = { + horizontal: { + top: "-", + bottom: "+" + }, + vertical: { + left: "-", + right: "+" + } + }[a][i] : s = i; + var l = { + horizontal: "center", + vertical: s >= 0 || s === "+" ? "left" : "right" + }, u = { + horizontal: s >= 0 || s === "+" ? "top" : "bottom", + vertical: "middle" + }, c = { + horizontal: 0, + vertical: hC / 2 + }, h = a === "vertical" ? o.height : o.width, f = t.getModel("controlStyle"), v = f.get("show", !0), b = v ? f.get("itemSize") : 0, w = v ? f.get("itemGap") : 0, p = b + w, d = t.get(["label", "rotate"]) || 0; + d = d * hC / 180; + var m, _, y, x = f.get("position", !0), g = v && f.get("showPlayBtn", !0), S = v && f.get("showPrevBtn", !0), T = v && f.get("showNextBtn", !0), C = 0, E = h; + x === "left" || x === "bottom" ? (g && (m = [0, 0], C += p), S && (_ = [C, 0], C += p), T && (y = [E - b, 0], E -= p)) : (g && (m = [E - b, 0], E -= p), S && (_ = [0, 0], C += p), T && (y = [E - b, 0], E -= p)); + var M = [C, E]; + return t.get("inverse") && M.reverse(), { + viewRect: o, + mainLength: h, + orient: a, + rotation: c[a], + labelRotation: d, + labelPosOpt: s, + labelAlign: t.get(["label", "align"]) || l[a], + labelBaseline: t.get(["label", "verticalAlign"]) || t.get(["label", "baseline"]) || u[a], + // Based on mainGroup. + playPosition: m, + prevBtnPosition: _, + nextBtnPosition: y, + axisExtent: M, + controlSize: b, + controlGap: w + }; + }, e.prototype._position = function(t, n) { + var i = this._mainGroup, a = this._labelGroup, o = t.viewRect; + if (t.orient === "vertical") { + var s = io(), l = o.x, u = o.y + o.height; + js(s, s, [-l, -u]), wc(s, s, -hC / 2), js(s, s, [l, u]), o = o.clone(), o.applyTransform(s); + } + var c = m(o), h = m(i.getBoundingRect()), f = m(a.getBoundingRect()), v = [i.x, i.y], b = [a.x, a.y]; + b[0] = v[0] = c[0][0]; + var w = t.labelPosOpt; + if (w == null || ut(w)) { + var p = w === "+" ? 0 : 1; + _(v, h, c, 1, p), _(b, f, c, 1, 1 - p); + } else { + var p = w >= 0 ? 0 : 1; + _(v, h, c, 1, p), b[1] = v[1] + w; + } + i.setPosition(v), a.setPosition(b), i.rotation = a.rotation = t.rotation, d(i), d(a); + function d(y) { + y.originX = c[0][0] - y.x, y.originY = c[1][0] - y.y; + } + function m(y) { + return [[y.x, y.x + y.width], [y.y, y.y + y.height]]; + } + function _(y, x, g, S, T) { + y[S] += g[S][T] - x[S][T]; + } + }, e.prototype._createAxis = function(t, n) { + var i = n.getData(), a = n.get("axisType"), o = Jpe(n, a); + o.getTicks = function() { + return i.mapArray(["value"], function(u) { + return { + value: u + }; + }); + }; + var s = i.getDataExtent("value"); + o.setExtent(s[0], s[1]), o.calcNiceTicks(); + var l = new Xpe("value", o, t.axisExtent, a); + return l.model = n, l; + }, e.prototype._createGroup = function(t) { + var n = this[t] = new Rt(); + return this.group.add(n), n; + }, e.prototype._renderAxisLine = function(t, n, i, a) { + var o = i.getExtent(); + if (a.get(["lineStyle", "show"])) { + var s = new Ai({ + shape: { + x1: o[0], + y1: 0, + x2: o[1], + y2: 0 + }, + style: Fe({ + lineCap: "round" + }, a.getModel("lineStyle").getLineStyle()), + silent: !0, + z2: 1 + }); + n.add(s); + var l = this._progressLine = new Ai({ + shape: { + x1: o[0], + x2: this._currentPointer ? this._currentPointer.x : o[0], + y1: 0, + y2: 0 + }, + style: Mt({ + lineCap: "round", + lineWidth: s.style.lineWidth + }, a.getModel(["progress", "lineStyle"]).getLineStyle()), + silent: !0, + z2: 1 + }); + n.add(l); + } + }, e.prototype._renderAxisTick = function(t, n, i, a) { + var o = this, s = a.getData(), l = i.scale.getTicks(); + this._tickSymbols = [], X(l, function(u) { + var c = i.dataToCoord(u.value), h = s.getItemModel(u.value), f = h.getModel("itemStyle"), v = h.getModel(["emphasis", "itemStyle"]), b = h.getModel(["progress", "itemStyle"]), w = { + x: c, + y: 0, + onclick: ft(o._changeTimeline, o, u.value) + }, p = XR(h, f, n, w); + p.ensureState("emphasis").style = v.getItemStyle(), p.ensureState("progress").style = b.getItemStyle(), ac(p); + var d = Ft(p); + h.get("tooltip") ? (d.dataIndex = u.value, d.dataModel = a) : d.dataIndex = d.dataModel = null, o._tickSymbols.push(p); + }); + }, e.prototype._renderAxisLabel = function(t, n, i, a) { + var o = this, s = i.getLabelModel(); + if (s.get("show")) { + var l = a.getData(), u = i.getViewLabels(); + this._tickLabels = [], X(u, function(c) { + var h = c.tickValue, f = l.getItemModel(h), v = f.getModel("label"), b = f.getModel(["emphasis", "label"]), w = f.getModel(["progress", "label"]), p = i.dataToCoord(c.tickValue), d = new kr({ + x: p, + y: 0, + rotation: t.labelRotation - t.rotation, + onclick: ft(o._changeTimeline, o, h), + silent: !1, + style: gn(v, { + text: c.formattedLabel, + align: t.labelAlign, + verticalAlign: t.labelBaseline + }) + }); + d.ensureState("emphasis").style = gn(b), d.ensureState("progress").style = gn(w), n.add(d), ac(d), YR(d).dataIndex = h, o._tickLabels.push(d); + }); + } + }, e.prototype._renderControl = function(t, n, i, a) { + var o = t.controlSize, s = t.rotation, l = a.getModel("controlStyle").getItemStyle(), u = a.getModel(["emphasis", "controlStyle"]).getItemStyle(), c = a.getPlayState(), h = a.get("inverse", !0); + f(t.nextBtnPosition, "next", ft(this._changeTimeline, this, h ? "-" : "+")), f(t.prevBtnPosition, "prev", ft(this._changeTimeline, this, h ? "+" : "-")), f(t.playPosition, c ? "stop" : "play", ft(this._handlePlayClick, this, !c), !0); + function f(v, b, w, p) { + if (v) { + var d = Fs(Jt(a.get(["controlStyle", b + "BtnSize"]), o), o), m = [0, -d / 2, d, d], _ = Qpe(a, b + "Icon", m, { + x: v[0], + y: v[1], + originX: o / 2, + originY: 0, + rotation: p ? -s : 0, + rectHover: !0, + style: l, + onclick: w + }); + _.ensureState("emphasis").style = u, n.add(_), ac(_); + } + } + }, e.prototype._renderCurrentPointer = function(t, n, i, a) { + var o = a.getData(), s = a.getCurrentIndex(), l = o.getItemModel(s).getModel("checkpointStyle"), u = this, c = { + onCreate: function(h) { + h.draggable = !0, h.drift = ft(u._handlePointerDrag, u), h.ondragend = ft(u._handlePointerDragend, u), ZR(h, u._progressLine, s, i, a, !0); + }, + onUpdate: function(h) { + ZR(h, u._progressLine, s, i, a); + } + }; + this._currentPointer = XR(l, l, this._mainGroup, {}, this._currentPointer, c); + }, e.prototype._handlePlayClick = function(t) { + this._clearTimer(), this.api.dispatchAction({ + type: "timelinePlayChange", + playState: t, + from: this.uid + }); + }, e.prototype._handlePointerDrag = function(t, n, i) { + this._clearTimer(), this._pointerChangeTimeline([i.offsetX, i.offsetY]); + }, e.prototype._handlePointerDragend = function(t) { + this._pointerChangeTimeline([t.offsetX, t.offsetY], !0); + }, e.prototype._pointerChangeTimeline = function(t, n) { + var i = this._toAxisCoord(t)[0], a = this._axis, o = yo(a.getExtent().slice()); + i > o[1] && (i = o[1]), i < o[0] && (i = o[0]), this._currentPointer.x = i, this._currentPointer.markRedraw(); + var s = this._progressLine; + s && (s.shape.x2 = i, s.dirty()); + var l = this._findNearestTick(i), u = this.model; + (n || l !== u.getCurrentIndex() && u.get("realtime")) && this._changeTimeline(l); + }, e.prototype._doPlayStop = function() { + var t = this; + this._clearTimer(), this.model.getPlayState() && (this._timer = setTimeout(function() { + var n = t.model; + t._changeTimeline(n.getCurrentIndex() + (n.get("rewind", !0) ? -1 : 1)); + }, this.model.get("playInterval"))); + }, e.prototype._toAxisCoord = function(t) { + var n = this._mainGroup.getLocalTransform(); + return zs(t, n, !0); + }, e.prototype._findNearestTick = function(t) { + var n = this.model.getData(), i = 1 / 0, a, o = this._axis; + return n.each(["value"], function(s, l) { + var u = o.dataToCoord(s), c = Math.abs(u - t); + c < i && (i = c, a = l); + }), a; + }, e.prototype._clearTimer = function() { + this._timer && (clearTimeout(this._timer), this._timer = null); + }, e.prototype._changeTimeline = function(t) { + var n = this.model.getCurrentIndex(); + t === "+" ? t = n + 1 : t === "-" && (t = n - 1), this.api.dispatchAction({ + type: "timelineChange", + currentIndex: t, + from: this.uid + }); + }, e.prototype._updateTicksStatus = function() { + var t = this.model.getCurrentIndex(), n = this._tickSymbols, i = this._tickLabels; + if (n) + for (var a = 0; a < n.length; a++) + n && n[a] && n[a].toggleState("progress", a < t); + if (i) + for (var a = 0; a < i.length; a++) + i && i[a] && i[a].toggleState("progress", YR(i[a]).dataIndex <= t); + }, e.type = "timeline.slider", e; + }(Wpe) +); +function Jpe(r, e) { + if (e = e || r.get("type"), e) + switch (e) { + case "category": + return new jA({ + ordinalMeta: r.getCategories(), + extent: [1 / 0, -1 / 0] + }); + case "time": + return new t$({ + locale: r.ecModel.getLocaleModel(), + useUTC: r.ecModel.get("useUTC") + }); + default: + return new pc(); + } +} +function Kpe(r, e) { + return yi(r.getBoxLayoutParams(), { + width: e.getWidth(), + height: e.getHeight() + }, r.get("padding")); +} +function Qpe(r, e, t, n) { + var i = n.style, a = Qd(r.get(["controlStyle", e]), n || {}, new Wt(t[0], t[1], t[2], t[3])); + return i && a.setStyle(i), a; +} +function XR(r, e, t, n, i, a) { + var o = e.get("color"); + if (i) + i.setColor(o), t.add(i), a && a.onUpdate(i); + else { + var s = r.get("symbol"); + i = li(s, -1, -1, 2, 2, o), i.setStyle("strokeNoScale", !0), t.add(i), a && a.onCreate(i); + } + var l = e.getItemStyle(["color"]); + i.setStyle(l), n = Ut({ + rectHover: !0, + z2: 100 + }, n, !0); + var u = lv(r.get("symbolSize")); + n.scaleX = u[0] / 2, n.scaleY = u[1] / 2; + var c = sf(r.get("symbolOffset"), u); + c && (n.x = (n.x || 0) + c[0], n.y = (n.y || 0) + c[1]); + var h = r.get("symbolRotate"); + return n.rotation = (h || 0) * Math.PI / 180 || 0, i.attr(n), i.updateTransform(), i; +} +function ZR(r, e, t, n, i, a) { + if (!r.dragging) { + var o = i.getModel("checkpointStyle"), s = n.dataToCoord(i.getData().get("value", t)); + if (a || !o.get("animation", !0)) + r.attr({ + x: s, + y: 0 + }), e && e.attr({ + shape: { + x2: s + } + }); + else { + var l = { + duration: o.get("animationDuration", !0), + easing: o.get("animationEasing", !0) + }; + r.stopAnimation(null, !0), r.animateTo({ + x: s, + y: 0 + }, l), e && e.animateTo({ + shape: { + x2: s + } + }, l); + } + } +} +const qpe = Zpe; +function ege(r) { + r.registerAction({ + type: "timelineChange", + event: "timelineChanged", + update: "prepareAndUpdate" + }, function(e, t, n) { + var i = t.getComponent("timeline"); + return i && e.currentIndex != null && (i.setCurrentIndex(e.currentIndex), !i.get("loop", !0) && i.isIndexMax() && i.getPlayState() && (i.setPlayState(!1), n.dispatchAction({ + type: "timelinePlayChange", + playState: !1, + from: e.from + }))), t.resetOption("timeline", { + replaceMerge: i.get("replaceMerge", !0) + }), Mt({ + currentIndex: i.option.currentIndex + }, e); + }), r.registerAction({ + type: "timelinePlayChange", + event: "timelinePlayChanged", + update: "update" + }, function(e, t) { + var n = t.getComponent("timeline"); + n && e.playState != null && n.setPlayState(e.playState); + }); +} +function tge(r) { + var e = r && r.timeline; + We(e) || (e = e ? [e] : []), X(e, function(t) { + t && rge(t); + }); +} +function rge(r) { + var e = r.type, t = { + number: "value", + time: "time" + }; + if (t[e] && (r.axisType = t[e], delete r.type), JR(r), wh(r, "controlPosition")) { + var n = r.controlStyle || (r.controlStyle = {}); + wh(n, "position") || (n.position = r.controlPosition), n.position === "none" && !wh(n, "show") && (n.show = !1, delete n.position), delete r.controlPosition; + } + X(r.data || [], function(i) { + kt(i) && !We(i) && (!wh(i, "value") && wh(i, "name") && (i.value = i.name), JR(i)); + }); +} +function JR(r) { + var e = r.itemStyle || (r.itemStyle = {}), t = e.emphasis || (e.emphasis = {}), n = r.label || r.label || {}, i = n.normal || (n.normal = {}), a = { + normal: 1, + emphasis: 1 + }; + X(n, function(o, s) { + !a[s] && !wh(i, s) && (i[s] = o); + }), t.label && !wh(n, "emphasis") && (n.emphasis = t.label, delete t.label); +} +function wh(r, e) { + return r.hasOwnProperty(e); +} +function nge(r) { + r.registerComponentModel(Gpe), r.registerComponentView(qpe), r.registerSubTypeDefaulter("timeline", function() { + return "slider"; + }), ege(r), r.registerPreprocessor(tge); +} +function HE(r, e) { + if (!r) + return !1; + for (var t = We(r) ? r : [r], n = 0; n < t.length; n++) + if (t[n] && t[n][e]) + return !0; + return !1; +} +function p0(r) { + Gh(r, "label", ["show"]); +} +var g0 = Rr(), hV = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.createdBySelf = !1, t; + } + return e.prototype.init = function(t, n, i) { + this.mergeDefaultAndTheme(t, i), this._mergeOption(t, i, !1, !0); + }, e.prototype.isAnimationEnabled = function() { + if (Dr.node) + return !1; + var t = this.__hostSeries; + return this.getShallow("animation") && t && t.isAnimationEnabled(); + }, e.prototype.mergeOption = function(t, n) { + this._mergeOption(t, n, !1, !1); + }, e.prototype._mergeOption = function(t, n, i, a) { + var o = this.mainType; + i || n.eachSeries(function(s) { + var l = s.get(this.mainType, !0), u = g0(s)[o]; + if (!l || !l.data) { + g0(s)[o] = null; + return; + } + u ? u._mergeOption(l, n, !0) : (a && p0(l), X(l.data, function(c) { + c instanceof Array ? (p0(c[0]), p0(c[1])) : p0(c); + }), u = this.createMarkerModelFromSeries(l, this, n), Fe(u, { + mainType: this.mainType, + // Use the same series index and name + seriesIndex: s.seriesIndex, + name: s.name, + createdBySelf: !0 + }), u.__hostSeries = s), g0(s)[o] = u; + }, this); + }, e.prototype.formatTooltip = function(t, n, i) { + var a = this.getData(), o = this.getRawValue(t), s = a.getName(t); + return Di("section", { + header: this.name, + blocks: [Di("nameValue", { + name: s, + value: o, + noName: !s, + noValue: o == null + })] + }); + }, e.prototype.getData = function() { + return this._data; + }, e.prototype.setData = function(t) { + this._data = t; + }, e.getMarkerModelFromSeries = function(t, n) { + return g0(t)[n]; + }, e.type = "marker", e.dependencies = ["series", "grid", "polar", "geo"], e; + }(xr) +); +qn(hV, yA.prototype); +const yc = hV; +var ige = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.createMarkerModelFromSeries = function(t, n, i) { + return new e(t, n, i); + }, e.type = "markPoint", e.defaultOption = { + // zlevel: 0, + z: 5, + symbol: "pin", + symbolSize: 50, + // symbolRotate: 0, + // symbolOffset: [0, 0] + tooltip: { + trigger: "item" + }, + label: { + show: !0, + position: "inside" + }, + itemStyle: { + borderWidth: 2 + }, + emphasis: { + label: { + show: !0 + } + } + }, e; + }(yc) +); +const age = ige; +function zT(r) { + return !(isNaN(parseFloat(r.x)) && isNaN(parseFloat(r.y))); +} +function oge(r) { + return !isNaN(parseFloat(r.x)) && !isNaN(parseFloat(r.y)); +} +function m0(r, e, t, n, i, a) { + var o = [], s = iu( + e, + n + /* , otherDataDim */ + ), l = s ? e.getCalculationInfo("stackResultDimension") : n, u = VE(e, l, r), c = e.indicesOfNearest(l, u)[0]; + o[i] = e.get(t, c), o[a] = e.get(l, c); + var h = e.get(n, c), f = Ds(e.get(n, c)); + return f = Math.min(f, 20), f >= 0 && (o[a] = +o[a].toFixed(f)), [o, h]; +} +var fC = { + min: jt(m0, "min"), + max: jt(m0, "max"), + average: jt(m0, "average"), + median: jt(m0, "median") +}; +function Ng(r, e) { + if (e) { + var t = r.getData(), n = r.coordinateSystem, i = n && n.dimensions; + if (!oge(e) && !We(e.coord) && We(i)) { + var a = fV(e, t, n, r); + if (e = Ot(e), e.type && fC[e.type] && a.baseAxis && a.valueAxis) { + var o = ir(i, a.baseAxis.dim), s = ir(i, a.valueAxis.dim), l = fC[e.type](t, a.baseDataDim, a.valueDataDim, o, s); + e.coord = l[0], e.value = l[1]; + } else + e.coord = [e.xAxis != null ? e.xAxis : e.radiusAxis, e.yAxis != null ? e.yAxis : e.angleAxis]; + } + if (e.coord == null || !We(i)) + e.coord = []; + else + for (var u = e.coord, c = 0; c < 2; c++) + fC[u[c]] && (u[c] = VE(t, t.mapDimension(i[c]), u[c])); + return e; + } +} +function fV(r, e, t, n) { + var i = {}; + return r.valueIndex != null || r.valueDim != null ? (i.valueDataDim = r.valueIndex != null ? e.getDimension(r.valueIndex) : r.valueDim, i.valueAxis = t.getAxis(sge(n, i.valueDataDim)), i.baseAxis = t.getOtherAxis(i.valueAxis), i.baseDataDim = e.mapDimension(i.baseAxis.dim)) : (i.baseAxis = n.getBaseAxis(), i.valueAxis = t.getOtherAxis(i.baseAxis), i.baseDataDim = e.mapDimension(i.baseAxis.dim), i.valueDataDim = e.mapDimension(i.valueAxis.dim)), i; +} +function sge(r, e) { + var t = r.getData().getDimensionInfo(e); + return t && t.coordDim; +} +function zg(r, e) { + return r && r.containData && e.coord && !zT(e) ? r.containData(e.coord) : !0; +} +function lge(r, e, t) { + return r && r.containZone && e.coord && t.coord && !zT(e) && !zT(t) ? r.containZone(e.coord, t.coord) : !0; +} +function dV(r, e) { + return r ? function(t, n, i, a) { + var o = a < 2 ? t.coord && t.coord[a] : t.value; + return lc(o, e[a]); + } : function(t, n, i, a) { + return lc(t.value, e[a]); + }; +} +function VE(r, e, t) { + if (t === "average") { + var n = 0, i = 0; + return r.each(e, function(a, o) { + isNaN(a) || (n += a, i++); + }), n / i; + } else + return t === "median" ? r.getMedian(e) : r.getDataExtent(e)[t === "max" ? 1 : 0]; +} +var dC = Rr(), uge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.init = function() { + this.markerGroupMap = xt(); + }, e.prototype.render = function(t, n, i) { + var a = this, o = this.markerGroupMap; + o.each(function(s) { + dC(s).keep = !1; + }), n.eachSeries(function(s) { + var l = yc.getMarkerModelFromSeries(s, a.type); + l && a.renderSeries(s, l, n, i); + }), o.each(function(s) { + !dC(s).keep && a.group.remove(s.group); + }); + }, e.prototype.markKeep = function(t) { + dC(t).keep = !0; + }, e.prototype.toggleBlurSeries = function(t, n) { + var i = this; + X(t, function(a) { + var o = yc.getMarkerModelFromSeries(a, i.type); + if (o) { + var s = o.getData(); + s.eachItemGraphicEl(function(l) { + l && (n ? A5(l) : ZI(l)); + }); + } + }); + }, e.type = "marker", e; + }(Sn) +); +const GE = uge; +function KR(r, e, t) { + var n = e.coordinateSystem; + r.each(function(i) { + var a = r.getItemModel(i), o, s = ot(a.get("x"), t.getWidth()), l = ot(a.get("y"), t.getHeight()); + if (!isNaN(s) && !isNaN(l)) + o = [s, l]; + else if (e.getMarkerPosition) + o = e.getMarkerPosition(r.getValues(r.dimensions, i)); + else if (n) { + var u = r.get(n.dimensions[0], i), c = r.get(n.dimensions[1], i); + o = n.dataToPoint([u, c]); + } + isNaN(s) || (o[0] = s), isNaN(l) || (o[1] = l), r.setItemLayout(i, o); + }); +} +var cge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.updateTransform = function(t, n, i) { + n.eachSeries(function(a) { + var o = yc.getMarkerModelFromSeries(a, "markPoint"); + o && (KR(o.getData(), a, i), this.markerGroupMap.get(a.id).updateLayout()); + }, this); + }, e.prototype.renderSeries = function(t, n, i, a) { + var o = t.coordinateSystem, s = t.id, l = t.getData(), u = this.markerGroupMap, c = u.get(s) || u.set(s, new cm()), h = hge(o, t, n); + n.setData(h), KR(n.getData(), t, a), h.each(function(f) { + var v = h.getItemModel(f), b = v.getShallow("symbol"), w = v.getShallow("symbolSize"), p = v.getShallow("symbolRotate"), d = v.getShallow("symbolOffset"), m = v.getShallow("symbolKeepAspect"); + if (Tt(b) || Tt(w) || Tt(p) || Tt(d)) { + var _ = n.getRawValue(f), y = n.getDataParams(f); + Tt(b) && (b = b(_, y)), Tt(w) && (w = w(_, y)), Tt(p) && (p = p(_, y)), Tt(d) && (d = d(_, y)); + } + var x = v.getModel("itemStyle").getItemStyle(), g = im(l, "color"); + x.fill || (x.fill = g), h.setItemVisual(f, { + symbol: b, + symbolSize: w, + symbolRotate: p, + symbolOffset: d, + symbolKeepAspect: m, + style: x + }); + }), c.updateData(h), this.group.add(c.group), h.eachItemGraphicEl(function(f) { + f.traverse(function(v) { + Ft(v).dataModel = n; + }); + }), this.markKeep(c), c.group.silent = n.get("silent") || t.get("silent"); + }, e.type = "markPoint", e; + }(GE) +); +function hge(r, e, t) { + var n; + r ? n = Ke(r && r.dimensions, function(s) { + var l = e.getData().getDimensionInfo(e.getData().mapDimension(s)) || {}; + return Fe(Fe({}, l), { + name: s, + // DON'T use ordinalMeta to parse and collect ordinal. + ordinalMeta: null + }); + }) : n = [{ + name: "value", + type: "float" + }]; + var i = new Ui(n, t), a = Ke(t.get("data"), jt(Ng, e)); + r && (a = Jr(a, jt(zg, r))); + var o = dV(!!r, n); + return i.initData(a, null, o), i; +} +const fge = cge; +function dge(r) { + r.registerComponentModel(age), r.registerComponentView(fge), r.registerPreprocessor(function(e) { + HE(e.series, "markPoint") && (e.markPoint = e.markPoint || {}); + }); +} +var vge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.createMarkerModelFromSeries = function(t, n, i) { + return new e(t, n, i); + }, e.type = "markLine", e.defaultOption = { + // zlevel: 0, + z: 5, + symbol: ["circle", "arrow"], + symbolSize: [8, 16], + // symbolRotate: 0, + symbolOffset: 0, + precision: 2, + tooltip: { + trigger: "item" + }, + label: { + show: !0, + position: "end", + distance: 5 + }, + lineStyle: { + type: "dashed" + }, + emphasis: { + label: { + show: !0 + }, + lineStyle: { + width: 3 + } + }, + animationEasing: "linear" + }, e; + }(yc) +); +const pge = vge; +var y0 = Rr(), gge = function(r, e, t, n) { + var i = r.getData(), a; + if (We(n)) + a = n; + else { + var o = n.type; + if (o === "min" || o === "max" || o === "average" || o === "median" || n.xAxis != null || n.yAxis != null) { + var s = void 0, l = void 0; + if (n.yAxis != null || n.xAxis != null) + s = e.getAxis(n.yAxis != null ? "y" : "x"), l = Ii(n.yAxis, n.xAxis); + else { + var u = fV(n, i, e, r); + s = u.valueAxis; + var c = BA(i, u.valueDataDim); + l = VE(i, c, o); + } + var h = s.dim === "x" ? 0 : 1, f = 1 - h, v = Ot(n), b = { + coord: [] + }; + v.type = null, v.coord = [], v.coord[f] = -1 / 0, b.coord[f] = 1 / 0; + var w = t.get("precision"); + w >= 0 && Pr(l) && (l = +l.toFixed(Math.min(w, 20))), v.coord[h] = b.coord[h] = l, a = [v, b, { + type: o, + valueIndex: n.valueIndex, + // Force to use the value of calculated value. + value: l + }]; + } else + a = []; + } + var p = [Ng(r, a[0]), Ng(r, a[1]), Fe({}, a[2])]; + return p[2].type = p[2].type || null, Ut(p[2], p[0]), Ut(p[2], p[1]), p; +}; +function K_(r) { + return !isNaN(r) && !isFinite(r); +} +function QR(r, e, t, n) { + var i = 1 - r, a = n.dimensions[r]; + return K_(e[i]) && K_(t[i]) && e[r] === t[r] && n.getAxis(a).containData(e[r]); +} +function mge(r, e) { + if (r.type === "cartesian2d") { + var t = e[0].coord, n = e[1].coord; + if (t && n && (QR(1, t, n, r) || QR(0, t, n, r))) + return !0; + } + return zg(r, e[0]) && zg(r, e[1]); +} +function vC(r, e, t, n, i) { + var a = n.coordinateSystem, o = r.getItemModel(e), s, l = ot(o.get("x"), i.getWidth()), u = ot(o.get("y"), i.getHeight()); + if (!isNaN(l) && !isNaN(u)) + s = [l, u]; + else { + if (n.getMarkerPosition) + s = n.getMarkerPosition(r.getValues(r.dimensions, e)); + else { + var c = a.dimensions, h = r.get(c[0], e), f = r.get(c[1], e); + s = a.dataToPoint([h, f]); + } + if (lf(a, "cartesian2d")) { + var v = a.getAxis("x"), b = a.getAxis("y"), c = a.dimensions; + K_(r.get(c[0], e)) ? s[0] = v.toGlobalCoord(v.getExtent()[t ? 0 : 1]) : K_(r.get(c[1], e)) && (s[1] = b.toGlobalCoord(b.getExtent()[t ? 0 : 1])); + } + isNaN(l) || (s[0] = l), isNaN(u) || (s[1] = u); + } + r.setItemLayout(e, s); +} +var yge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.updateTransform = function(t, n, i) { + n.eachSeries(function(a) { + var o = yc.getMarkerModelFromSeries(a, "markLine"); + if (o) { + var s = o.getData(), l = y0(o).from, u = y0(o).to; + l.each(function(c) { + vC(l, c, !0, a, i), vC(u, c, !1, a, i); + }), s.each(function(c) { + s.setItemLayout(c, [l.getItemLayout(c), u.getItemLayout(c)]); + }), this.markerGroupMap.get(a.id).updateLayout(); + } + }, this); + }, e.prototype.renderSeries = function(t, n, i, a) { + var o = t.coordinateSystem, s = t.id, l = t.getData(), u = this.markerGroupMap, c = u.get(s) || u.set(s, new dE()); + this.group.add(c.group); + var h = _ge(o, t, n), f = h.from, v = h.to, b = h.line; + y0(n).from = f, y0(n).to = v, n.setData(b); + var w = n.get("symbol"), p = n.get("symbolSize"), d = n.get("symbolRotate"), m = n.get("symbolOffset"); + We(w) || (w = [w, w]), We(p) || (p = [p, p]), We(d) || (d = [d, d]), We(m) || (m = [m, m]), h.from.each(function(y) { + _(f, y, !0), _(v, y, !1); + }), b.each(function(y) { + var x = b.getItemModel(y).getModel("lineStyle").getLineStyle(); + b.setItemLayout(y, [f.getItemLayout(y), v.getItemLayout(y)]), x.stroke == null && (x.stroke = f.getItemVisual(y, "style").fill), b.setItemVisual(y, { + fromSymbolKeepAspect: f.getItemVisual(y, "symbolKeepAspect"), + fromSymbolOffset: f.getItemVisual(y, "symbolOffset"), + fromSymbolRotate: f.getItemVisual(y, "symbolRotate"), + fromSymbolSize: f.getItemVisual(y, "symbolSize"), + fromSymbol: f.getItemVisual(y, "symbol"), + toSymbolKeepAspect: v.getItemVisual(y, "symbolKeepAspect"), + toSymbolOffset: v.getItemVisual(y, "symbolOffset"), + toSymbolRotate: v.getItemVisual(y, "symbolRotate"), + toSymbolSize: v.getItemVisual(y, "symbolSize"), + toSymbol: v.getItemVisual(y, "symbol"), + style: x + }); + }), c.updateData(b), h.line.eachItemGraphicEl(function(y) { + Ft(y).dataModel = n, y.traverse(function(x) { + Ft(x).dataModel = n; + }); + }); + function _(y, x, g) { + var S = y.getItemModel(x); + vC(y, x, g, t, a); + var T = S.getModel("itemStyle").getItemStyle(); + T.fill == null && (T.fill = im(l, "color")), y.setItemVisual(x, { + symbolKeepAspect: S.get("symbolKeepAspect"), + // `0` should be considered as a valid value, so use `retrieve2` instead of `||` + symbolOffset: Jt(S.get("symbolOffset", !0), m[g ? 0 : 1]), + symbolRotate: Jt(S.get("symbolRotate", !0), d[g ? 0 : 1]), + // TODO: when 2d array is supported, it should ignore parent + symbolSize: Jt(S.get("symbolSize"), p[g ? 0 : 1]), + symbol: Jt(S.get("symbol", !0), w[g ? 0 : 1]), + style: T + }); + } + this.markKeep(c), c.group.silent = n.get("silent") || t.get("silent"); + }, e.type = "markLine", e; + }(GE) +); +function _ge(r, e, t) { + var n; + r ? n = Ke(r && r.dimensions, function(u) { + var c = e.getData().getDimensionInfo(e.getData().mapDimension(u)) || {}; + return Fe(Fe({}, c), { + name: u, + // DON'T use ordinalMeta to parse and collect ordinal. + ordinalMeta: null + }); + }) : n = [{ + name: "value", + type: "float" + }]; + var i = new Ui(n, t), a = new Ui(n, t), o = new Ui([], t), s = Ke(t.get("data"), jt(gge, e, r, t)); + r && (s = Jr(s, jt(mge, r))); + var l = dV(!!r, n); + return i.initData(Ke(s, function(u) { + return u[0]; + }), null, l), a.initData(Ke(s, function(u) { + return u[1]; + }), null, l), o.initData(Ke(s, function(u) { + return u[2]; + })), o.hasItemOption = !0, { + from: i, + to: a, + line: o + }; +} +const bge = yge; +function xge(r) { + r.registerComponentModel(pge), r.registerComponentView(bge), r.registerPreprocessor(function(e) { + HE(e.series, "markLine") && (e.markLine = e.markLine || {}); + }); +} +var Sge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.createMarkerModelFromSeries = function(t, n, i) { + return new e(t, n, i); + }, e.type = "markArea", e.defaultOption = { + // zlevel: 0, + // PENDING + z: 1, + tooltip: { + trigger: "item" + }, + // markArea should fixed on the coordinate system + animation: !1, + label: { + show: !0, + position: "top" + }, + itemStyle: { + // color and borderColor default to use color from series + // color: 'auto' + // borderColor: 'auto' + borderWidth: 0 + }, + emphasis: { + label: { + show: !0, + position: "top" + } + } + }, e; + }(yc) +); +const wge = Sge; +var _0 = Rr(), Cge = function(r, e, t, n) { + var i = n[0], a = n[1]; + if (!(!i || !a)) { + var o = Ng(r, i), s = Ng(r, a), l = o.coord, u = s.coord; + l[0] = Ii(l[0], -1 / 0), l[1] = Ii(l[1], -1 / 0), u[0] = Ii(u[0], 1 / 0), u[1] = Ii(u[1], 1 / 0); + var c = wb([{}, o, s]); + return c.coord = [o.coord, s.coord], c.x0 = o.x, c.y0 = o.y, c.x1 = s.x, c.y1 = s.y, c; + } +}; +function Q_(r) { + return !isNaN(r) && !isFinite(r); +} +function qR(r, e, t, n) { + var i = 1 - r; + return Q_(e[i]) && Q_(t[i]); +} +function Tge(r, e) { + var t = e.coord[0], n = e.coord[1], i = { + coord: t, + x: e.x0, + y: e.y0 + }, a = { + coord: n, + x: e.x1, + y: e.y1 + }; + return lf(r, "cartesian2d") ? t && n && (qR(1, t, n) || qR(0, t, n)) ? !0 : lge(r, i, a) : zg(r, i) || zg(r, a); +} +function eN(r, e, t, n, i) { + var a = n.coordinateSystem, o = r.getItemModel(e), s, l = ot(o.get(t[0]), i.getWidth()), u = ot(o.get(t[1]), i.getHeight()); + if (!isNaN(l) && !isNaN(u)) + s = [l, u]; + else { + if (n.getMarkerPosition) { + var c = r.getValues(["x0", "y0"], e), h = r.getValues(["x1", "y1"], e), f = a.clampData(c), v = a.clampData(h), b = []; + t[0] === "x0" ? b[0] = f[0] > v[0] ? h[0] : c[0] : b[0] = f[0] > v[0] ? c[0] : h[0], t[1] === "y0" ? b[1] = f[1] > v[1] ? h[1] : c[1] : b[1] = f[1] > v[1] ? c[1] : h[1], s = n.getMarkerPosition(b, t, !0); + } else { + var w = r.get(t[0], e), p = r.get(t[1], e), d = [w, p]; + a.clampData && a.clampData(d, d), s = a.dataToPoint(d, !0); + } + if (lf(a, "cartesian2d")) { + var m = a.getAxis("x"), _ = a.getAxis("y"), w = r.get(t[0], e), p = r.get(t[1], e); + Q_(w) ? s[0] = m.toGlobalCoord(m.getExtent()[t[0] === "x0" ? 0 : 1]) : Q_(p) && (s[1] = _.toGlobalCoord(_.getExtent()[t[1] === "y0" ? 0 : 1])); + } + isNaN(l) || (s[0] = l), isNaN(u) || (s[1] = u); + } + return s; +} +var tN = [["x0", "y0"], ["x1", "y0"], ["x1", "y1"], ["x0", "y1"]], Ige = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.updateTransform = function(t, n, i) { + n.eachSeries(function(a) { + var o = yc.getMarkerModelFromSeries(a, "markArea"); + if (o) { + var s = o.getData(); + s.each(function(l) { + var u = Ke(tN, function(h) { + return eN(s, l, h, a, i); + }); + s.setItemLayout(l, u); + var c = s.getItemGraphicEl(l); + c.setShape("points", u); + }); + } + }, this); + }, e.prototype.renderSeries = function(t, n, i, a) { + var o = t.coordinateSystem, s = t.id, l = t.getData(), u = this.markerGroupMap, c = u.get(s) || u.set(s, { + group: new Rt() + }); + this.group.add(c.group), this.markKeep(c); + var h = Age(o, t, n); + n.setData(h), h.each(function(f) { + var v = Ke(tN, function(T) { + return eN(h, f, T, t, a); + }), b = o.getAxis("x").scale, w = o.getAxis("y").scale, p = b.getExtent(), d = w.getExtent(), m = [b.parse(h.get("x0", f)), b.parse(h.get("x1", f))], _ = [w.parse(h.get("y0", f)), w.parse(h.get("y1", f))]; + yo(m), yo(_); + var y = !(p[0] > m[1] || p[1] < m[0] || d[0] > _[1] || d[1] < _[0]), x = !y; + h.setItemLayout(f, { + points: v, + allClipped: x + }); + var g = h.getItemModel(f).getModel("itemStyle").getItemStyle(), S = im(l, "color"); + g.fill || (g.fill = S, ut(g.fill) && (g.fill = ug(g.fill, 0.4))), g.stroke || (g.stroke = S), h.setItemVisual(f, "style", g); + }), h.diff(_0(c).data).add(function(f) { + var v = h.getItemLayout(f); + if (!v.allClipped) { + var b = new La({ + shape: { + points: v.points + } + }); + h.setItemGraphicEl(f, b), c.group.add(b); + } + }).update(function(f, v) { + var b = _0(c).data.getItemGraphicEl(v), w = h.getItemLayout(f); + w.allClipped ? b && c.group.remove(b) : (b ? zr(b, { + shape: { + points: w.points + } + }, n, f) : b = new La({ + shape: { + points: w.points + } + }), h.setItemGraphicEl(f, b), c.group.add(b)); + }).remove(function(f) { + var v = _0(c).data.getItemGraphicEl(f); + c.group.remove(v); + }).execute(), h.eachItemGraphicEl(function(f, v) { + var b = h.getItemModel(v), w = h.getItemVisual(v, "style"); + f.useStyle(h.getItemVisual(v, "style")), Zi(f, Mi(b), { + labelFetcher: n, + labelDataIndex: v, + defaultText: h.getName(v) || "", + inheritColor: ut(w.fill) ? ug(w.fill, 1) : "#000" + }), Xi(f, b), Un(f, null, null, b.get(["emphasis", "disabled"])), Ft(f).dataModel = n; + }), _0(c).data = h, c.group.silent = n.get("silent") || t.get("silent"); + }, e.type = "markArea", e; + }(GE) +); +function Age(r, e, t) { + var n, i, a = ["x0", "y0", "x1", "y1"]; + if (r) { + var o = Ke(r && r.dimensions, function(u) { + var c = e.getData(), h = c.getDimensionInfo(c.mapDimension(u)) || {}; + return Fe(Fe({}, h), { + name: u, + // DON'T use ordinalMeta to parse and collect ordinal. + ordinalMeta: null + }); + }); + i = Ke(a, function(u, c) { + return { + name: u, + type: o[c % 2].type + }; + }), n = new Ui(i, t); + } else + i = [{ + name: "value", + type: "float" + }], n = new Ui(i, t); + var s = Ke(t.get("data"), jt(Cge, e, r, t)); + r && (s = Jr(s, jt(Tge, r))); + var l = r ? function(u, c, h, f) { + var v = u.coord[Math.floor(f / 2)][f % 2]; + return lc(v, i[f]); + } : function(u, c, h, f) { + return lc(u.value, i[f]); + }; + return n.initData(s, null, l), n.hasItemOption = !0, n; +} +const Ege = Ige; +function Mge(r) { + r.registerComponentModel(wge), r.registerComponentView(Ege), r.registerPreprocessor(function(e) { + HE(e.series, "markArea") && (e.markArea = e.markArea || {}); + }); +} +var Dge = function(r, e) { + if (e === "all") + return { + type: "all", + title: r.getLocaleModel().get(["legend", "selector", "all"]) + }; + if (e === "inverse") + return { + type: "inverse", + title: r.getLocaleModel().get(["legend", "selector", "inverse"]) + }; +}, kge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.layoutMode = { + type: "box", + // legend.width/height are maxWidth/maxHeight actually, + // whereas real width/height is calculated by its content. + // (Setting {left: 10, right: 10} does not make sense). + // So consider the case: + // `setOption({legend: {left: 10});` + // then `setOption({legend: {right: 10});` + // The previous `left` should be cleared by setting `ignoreSize`. + ignoreSize: !0 + }, t; + } + return e.prototype.init = function(t, n, i) { + this.mergeDefaultAndTheme(t, i), t.selected = t.selected || {}, this._updateSelector(t); + }, e.prototype.mergeOption = function(t, n) { + r.prototype.mergeOption.call(this, t, n), this._updateSelector(t); + }, e.prototype._updateSelector = function(t) { + var n = t.selector, i = this.ecModel; + n === !0 && (n = t.selector = ["all", "inverse"]), We(n) && X(n, function(a, o) { + ut(a) && (a = { + type: a + }), n[o] = Ut(a, Dge(i, a.type)); + }); + }, e.prototype.optionUpdated = function() { + this._updateData(this.ecModel); + var t = this._data; + if (t[0] && this.get("selectedMode") === "single") { + for (var n = !1, i = 0; i < t.length; i++) { + var a = t[i].get("name"); + if (this.isSelected(a)) { + this.select(a), n = !0; + break; + } + } + !n && this.select(t[0].get("name")); + } + }, e.prototype._updateData = function(t) { + var n = [], i = []; + t.eachRawSeries(function(l) { + var u = l.name; + i.push(u); + var c; + if (l.legendVisualProvider) { + var h = l.legendVisualProvider, f = h.getAllNames(); + t.isSeriesFiltered(l) || (i = i.concat(f)), f.length ? n = n.concat(f) : c = !0; + } else + c = !0; + c && HI(l) && n.push(l.name); + }), this._availableNames = i; + var a = this.get("data") || n, o = xt(), s = Ke(a, function(l) { + return (ut(l) || Pr(l)) && (l = { + name: l + }), o.get(l.name) ? null : (o.set(l.name, !0), new qr(l, this, this.ecModel)); + }, this); + this._data = Jr(s, function(l) { + return !!l; + }); + }, e.prototype.getData = function() { + return this._data; + }, e.prototype.select = function(t) { + var n = this.option.selected, i = this.get("selectedMode"); + if (i === "single") { + var a = this._data; + X(a, function(o) { + n[o.get("name")] = !1; + }); + } + n[t] = !0; + }, e.prototype.unSelect = function(t) { + this.get("selectedMode") !== "single" && (this.option.selected[t] = !1); + }, e.prototype.toggleSelected = function(t) { + var n = this.option.selected; + n.hasOwnProperty(t) || (n[t] = !0), this[n[t] ? "unSelect" : "select"](t); + }, e.prototype.allSelect = function() { + var t = this._data, n = this.option.selected; + X(t, function(i) { + n[i.get("name", !0)] = !0; + }); + }, e.prototype.inverseSelect = function() { + var t = this._data, n = this.option.selected; + X(t, function(i) { + var a = i.get("name", !0); + n.hasOwnProperty(a) || (n[a] = !0), n[a] = !n[a]; + }); + }, e.prototype.isSelected = function(t) { + var n = this.option.selected; + return !(n.hasOwnProperty(t) && !n[t]) && ir(this._availableNames, t) >= 0; + }, e.prototype.getOrient = function() { + return this.get("orient") === "vertical" ? { + index: 1, + name: "vertical" + } : { + index: 0, + name: "horizontal" + }; + }, e.type = "legend.plain", e.dependencies = ["series"], e.defaultOption = { + // zlevel: 0, + z: 4, + show: !0, + orient: "horizontal", + left: "center", + // right: 'center', + top: 0, + // bottom: null, + align: "auto", + backgroundColor: "rgba(0,0,0,0)", + borderColor: "#ccc", + borderRadius: 0, + borderWidth: 0, + padding: 5, + itemGap: 10, + itemWidth: 25, + itemHeight: 14, + symbolRotate: "inherit", + symbolKeepAspect: !0, + inactiveColor: "#ccc", + inactiveBorderColor: "#ccc", + inactiveBorderWidth: "auto", + itemStyle: { + color: "inherit", + opacity: "inherit", + borderColor: "inherit", + borderWidth: "auto", + borderCap: "inherit", + borderJoin: "inherit", + borderDashOffset: "inherit", + borderMiterLimit: "inherit" + }, + lineStyle: { + width: "auto", + color: "inherit", + inactiveColor: "#ccc", + inactiveWidth: 2, + opacity: "inherit", + type: "inherit", + cap: "inherit", + join: "inherit", + dashOffset: "inherit", + miterLimit: "inherit" + }, + textStyle: { + color: "#333" + }, + selectedMode: !0, + selector: !1, + selectorLabel: { + show: !0, + borderRadius: 10, + padding: [3, 5, 3, 5], + fontSize: 12, + fontFamily: "sans-serif", + color: "#666", + borderWidth: 1, + borderColor: "#666" + }, + emphasis: { + selectorLabel: { + show: !0, + color: "#eee", + backgroundColor: "#666" + } + }, + selectorPosition: "auto", + selectorItemGap: 7, + selectorButtonGap: 10, + tooltip: { + show: !1 + } + }, e; + }(xr) +); +const BT = kge; +var ed = jt, jT = X, b0 = Rt, Oge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.newlineDisabled = !1, t; + } + return e.prototype.init = function() { + this.group.add(this._contentGroup = new b0()), this.group.add(this._selectorGroup = new b0()), this._isFirstRender = !0; + }, e.prototype.getContentGroup = function() { + return this._contentGroup; + }, e.prototype.getSelectorGroup = function() { + return this._selectorGroup; + }, e.prototype.render = function(t, n, i) { + var a = this._isFirstRender; + if (this._isFirstRender = !1, this.resetInner(), !!t.get("show", !0)) { + var o = t.get("align"), s = t.get("orient"); + (!o || o === "auto") && (o = t.get("left") === "right" && s === "vertical" ? "right" : "left"); + var l = t.get("selector", !0), u = t.get("selectorPosition", !0); + l && (!u || u === "auto") && (u = s === "horizontal" ? "end" : "start"), this.renderInner(o, t, n, i, l, s, u); + var c = t.getBoxLayoutParams(), h = { + width: i.getWidth(), + height: i.getHeight() + }, f = t.get("padding"), v = yi(c, h, f), b = this.layoutInner(t, o, v, a, l, u), w = yi(Mt({ + width: b.width, + height: b.height + }, c), h, f); + this.group.x = w.x - b.x, this.group.y = w.y - b.y, this.group.markRedraw(), this.group.add(this._backgroundEl = tV(b, t)); + } + }, e.prototype.resetInner = function() { + this.getContentGroup().removeAll(), this._backgroundEl && this.group.remove(this._backgroundEl), this.getSelectorGroup().removeAll(); + }, e.prototype.renderInner = function(t, n, i, a, o, s, l) { + var u = this.getContentGroup(), c = xt(), h = n.get("selectedMode"), f = []; + i.eachRawSeries(function(v) { + !v.get("legendHoverLink") && f.push(v.id); + }), jT(n.getData(), function(v, b) { + var w = v.get("name"); + if (!this.newlineDisabled && (w === "" || w === ` +`)) { + var p = new b0(); + p.newline = !0, u.add(p); + return; + } + var d = i.getSeriesByName(w)[0]; + if (!c.get(w)) + if (d) { + var m = d.getData(), _ = m.getVisual("legendLineStyle") || {}, y = m.getVisual("legendIcon"), x = m.getVisual("style"), g = this._createItem(d, w, b, v, n, t, _, x, y, h, a); + g.on("click", ed(rN, w, null, a, f)).on("mouseover", ed(FT, d.name, null, a, f)).on("mouseout", ed($T, d.name, null, a, f)), c.set(w, !0); + } else + i.eachRawSeries(function(S) { + if (!c.get(w) && S.legendVisualProvider) { + var T = S.legendVisualProvider; + if (!T.containName(w)) + return; + var C = T.indexOfName(w), E = T.getItemVisual(C, "style"), M = T.getItemVisual(C, "legendIcon"), P = Ma(E.fill); + P && P[3] === 0 && (P[3] = 0.2, E = Fe(Fe({}, E), { + fill: Ns(P, "rgba") + })); + var R = this._createItem(S, w, b, v, n, t, {}, E, M, h, a); + R.on("click", ed(rN, null, w, a, f)).on("mouseover", ed(FT, null, w, a, f)).on("mouseout", ed($T, null, w, a, f)), c.set(w, !0); + } + }, this); + }, this), o && this._createSelector(o, n, a, s, l); + }, e.prototype._createSelector = function(t, n, i, a, o) { + var s = this.getSelectorGroup(); + jT(t, function(u) { + var c = u.type, h = new kr({ + style: { + x: 0, + y: 0, + align: "center", + verticalAlign: "middle" + }, + onclick: function() { + i.dispatchAction({ + type: c === "all" ? "legendAllSelect" : "legendInverseSelect" + }); + } + }); + s.add(h); + var f = n.getModel("selectorLabel"), v = n.getModel(["emphasis", "selectorLabel"]); + Zi(h, { + normal: f, + emphasis: v + }, { + defaultText: u.title + }), ac(h); + }); + }, e.prototype._createItem = function(t, n, i, a, o, s, l, u, c, h, f) { + var v = t.visualDrawType, b = o.get("itemWidth"), w = o.get("itemHeight"), p = o.isSelected(n), d = a.get("symbolRotate"), m = a.get("symbolKeepAspect"), _ = a.get("icon"); + c = _ || c || "roundRect"; + var y = Lge(c, a, l, u, v, p, f), x = new b0(), g = a.getModel("textStyle"); + if (Tt(t.getLegendIcon) && (!_ || _ === "inherit")) + x.add(t.getLegendIcon({ + itemWidth: b, + itemHeight: w, + icon: c, + iconRotate: d, + itemStyle: y.itemStyle, + lineStyle: y.lineStyle, + symbolKeepAspect: m + })); + else { + var S = _ === "inherit" && t.getData().getVisual("symbol") ? d === "inherit" ? t.getData().getVisual("symbolRotate") : d : 0; + x.add(Pge({ + itemWidth: b, + itemHeight: w, + icon: c, + iconRotate: S, + itemStyle: y.itemStyle, + lineStyle: y.lineStyle, + symbolKeepAspect: m + })); + } + var T = s === "left" ? b + 5 : -5, C = s, E = o.get("formatter"), M = n; + ut(E) && E ? M = E.replace("{name}", n != null ? n : "") : Tt(E) && (M = E(n)); + var P = p ? g.getTextColor() : a.get("inactiveColor"); + x.add(new kr({ + style: gn(g, { + text: M, + x: T, + y: w / 2, + fill: P, + align: C, + verticalAlign: "middle" + }, { + inheritColor: P + }) + })); + var R = new Or({ + shape: x.getBoundingRect(), + invisible: !0 + }), N = a.getModel("tooltip"); + return N.get("show") && qd({ + el: R, + componentModel: o, + itemName: n, + itemTooltipOption: N.option + }), x.add(R), x.eachChild(function(F) { + F.silent = !0; + }), R.silent = !h, this.getContentGroup().add(x), ac(x), x.__legendDataIndex = i, x; + }, e.prototype.layoutInner = function(t, n, i, a, o, s) { + var l = this.getContentGroup(), u = this.getSelectorGroup(); + Nh(t.get("orient"), l, t.get("itemGap"), i.width, i.height); + var c = l.getBoundingRect(), h = [-c.x, -c.y]; + if (u.markRedraw(), l.markRedraw(), o) { + Nh( + // Buttons in selectorGroup always layout horizontally + "horizontal", + u, + t.get("selectorItemGap", !0) + ); + var f = u.getBoundingRect(), v = [-f.x, -f.y], b = t.get("selectorButtonGap", !0), w = t.getOrient().index, p = w === 0 ? "width" : "height", d = w === 0 ? "height" : "width", m = w === 0 ? "y" : "x"; + s === "end" ? v[w] += c[p] + b : h[w] += f[p] + b, v[1 - w] += c[d] / 2 - f[d] / 2, u.x = v[0], u.y = v[1], l.x = h[0], l.y = h[1]; + var _ = { + x: 0, + y: 0 + }; + return _[p] = c[p] + b + f[p], _[d] = Math.max(c[d], f[d]), _[m] = Math.min(0, f[m] + v[1 - w]), _; + } else + return l.x = h[0], l.y = h[1], this.group.getBoundingRect(); + }, e.prototype.remove = function() { + this.getContentGroup().removeAll(), this._isFirstRender = !0; + }, e.type = "legend.plain", e; + }(Sn) +); +function Lge(r, e, t, n, i, a, o) { + function s(p, d) { + p.lineWidth === "auto" && (p.lineWidth = d.lineWidth > 0 ? 2 : 0), jT(p, function(m, _) { + p[_] === "inherit" && (p[_] = d[_]); + }); + } + var l = e.getModel("itemStyle"), u = l.getItemStyle(), c = r.lastIndexOf("empty", 0) === 0 ? "fill" : "stroke", h = l.getShallow("decal"); + u.decal = !h || h === "inherit" ? n.decal : Nd(h, o), u.fill === "inherit" && (u.fill = n[i]), u.stroke === "inherit" && (u.stroke = n[c]), u.opacity === "inherit" && (u.opacity = (i === "fill" ? n : t).opacity), s(u, n); + var f = e.getModel("lineStyle"), v = f.getLineStyle(); + if (s(v, t), u.fill === "auto" && (u.fill = n.fill), u.stroke === "auto" && (u.stroke = n.fill), v.stroke === "auto" && (v.stroke = n.fill), !a) { + var b = e.get("inactiveBorderWidth"), w = u[c]; + u.lineWidth = b === "auto" ? n.lineWidth > 0 && w ? 2 : 0 : u.lineWidth, u.fill = e.get("inactiveColor"), u.stroke = e.get("inactiveBorderColor"), v.stroke = f.get("inactiveColor"), v.lineWidth = f.get("inactiveWidth"); + } + return { + itemStyle: u, + lineStyle: v + }; +} +function Pge(r) { + var e = r.icon || "roundRect", t = li(e, 0, 0, r.itemWidth, r.itemHeight, r.itemStyle.fill, r.symbolKeepAspect); + return t.setStyle(r.itemStyle), t.rotation = (r.iconRotate || 0) * Math.PI / 180, t.setOrigin([r.itemWidth / 2, r.itemHeight / 2]), e.indexOf("empty") > -1 && (t.style.stroke = t.style.fill, t.style.fill = "#fff", t.style.lineWidth = 2), t; +} +function rN(r, e, t, n) { + $T(r, e, t, n), t.dispatchAction({ + type: "legendToggleSelect", + name: r != null ? r : e + }), FT(r, e, t, n); +} +function vV(r) { + for (var e = r.getZr().storage.getDisplayList(), t, n = 0, i = e.length; n < i && !(t = e[n].states.emphasis); ) + n++; + return t && t.hoverLayer; +} +function FT(r, e, t, n) { + vV(t) || t.dispatchAction({ + type: "highlight", + seriesName: r, + name: e, + excludeSeriesId: n + }); +} +function $T(r, e, t, n) { + vV(t) || t.dispatchAction({ + type: "downplay", + seriesName: r, + name: e, + excludeSeriesId: n + }); +} +const pV = Oge; +function Rge(r) { + var e = r.findComponents({ + mainType: "legend" + }); + e && e.length && r.filterSeries(function(t) { + for (var n = 0; n < e.length; n++) + if (!e[n].isSelected(t.name)) + return !1; + return !0; + }); +} +function yp(r, e, t) { + var n = {}, i = r === "toggleSelected", a; + return t.eachComponent("legend", function(o) { + i && a != null ? o[a ? "select" : "unSelect"](e.name) : r === "allSelect" || r === "inverseSelect" ? o[r]() : (o[r](e.name), a = o.isSelected(e.name)); + var s = o.getData(); + X(s, function(l) { + var u = l.get("name"); + if (!(u === ` +` || u === "")) { + var c = o.isSelected(u); + n.hasOwnProperty(u) ? n[u] = n[u] && c : n[u] = c; + } + }); + }), r === "allSelect" || r === "inverseSelect" ? { + selected: n + } : { + name: e.name, + selected: n + }; +} +function Nge(r) { + r.registerAction("legendToggleSelect", "legendselectchanged", jt(yp, "toggleSelected")), r.registerAction("legendAllSelect", "legendselectall", jt(yp, "allSelect")), r.registerAction("legendInverseSelect", "legendinverseselect", jt(yp, "inverseSelect")), r.registerAction("legendSelect", "legendselected", jt(yp, "select")), r.registerAction("legendUnSelect", "legendunselected", jt(yp, "unSelect")); +} +function gV(r) { + r.registerComponentModel(BT), r.registerComponentView(pV), r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER, Rge), r.registerSubTypeDefaulter("legend", function() { + return "plain"; + }), Nge(r); +} +var zge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.setScrollDataIndex = function(t) { + this.option.scrollDataIndex = t; + }, e.prototype.init = function(t, n, i) { + var a = rv(t); + r.prototype.init.call(this, t, n, i), nN(this, t, a); + }, e.prototype.mergeOption = function(t, n) { + r.prototype.mergeOption.call(this, t, n), nN(this, this.option, t); + }, e.type = "legend.scroll", e.defaultOption = Tc(BT.defaultOption, { + scrollDataIndex: 0, + pageButtonItemGap: 5, + pageButtonGap: null, + pageButtonPosition: "end", + pageFormatter: "{current}/{total}", + pageIcons: { + horizontal: ["M0,0L12,-10L12,10z", "M0,0L-12,-10L-12,10z"], + vertical: ["M0,0L20,0L10,-20z", "M0,0L20,0L10,20z"] + }, + pageIconColor: "#2f4554", + pageIconInactiveColor: "#aaa", + pageIconSize: 15, + pageTextStyle: { + color: "#333" + }, + animationDurationUpdate: 800 + }), e; + }(BT) +); +function nN(r, e, t) { + var n = r.getOrient(), i = [1, 1]; + i[n.index] = 0, vc(e, t, { + type: "box", + ignoreSize: !!i + }); +} +const Bge = zge; +var iN = Rt, pC = ["width", "height"], gC = ["x", "y"], jge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.newlineDisabled = !0, t._currentIndex = 0, t; + } + return e.prototype.init = function() { + r.prototype.init.call(this), this.group.add(this._containerGroup = new iN()), this._containerGroup.add(this.getContentGroup()), this.group.add(this._controllerGroup = new iN()); + }, e.prototype.resetInner = function() { + r.prototype.resetInner.call(this), this._controllerGroup.removeAll(), this._containerGroup.removeClipPath(), this._containerGroup.__rectSize = null; + }, e.prototype.renderInner = function(t, n, i, a, o, s, l) { + var u = this; + r.prototype.renderInner.call(this, t, n, i, a, o, s, l); + var c = this._controllerGroup, h = n.get("pageIconSize", !0), f = We(h) ? h : [h, h]; + b("pagePrev", 0); + var v = n.getModel("pageTextStyle"); + c.add(new kr({ + name: "pageText", + style: { + // Placeholder to calculate a proper layout. + text: "xx/xx", + fill: v.getTextColor(), + font: v.getFont(), + verticalAlign: "middle", + align: "center" + }, + silent: !0 + })), b("pageNext", 1); + function b(w, p) { + var d = w + "DataIndex", m = Qd(n.get("pageIcons", !0)[n.getOrient().name][p], { + // Buttons will be created in each render, so we do not need + // to worry about avoiding using legendModel kept in scope. + onclick: ft(u._pageGo, u, d, n, a) + }, { + x: -f[0] / 2, + y: -f[1] / 2, + width: f[0], + height: f[1] + }); + m.name = w, c.add(m); + } + }, e.prototype.layoutInner = function(t, n, i, a, o, s) { + var l = this.getSelectorGroup(), u = t.getOrient().index, c = pC[u], h = gC[u], f = pC[1 - u], v = gC[1 - u]; + o && Nh( + // Buttons in selectorGroup always layout horizontally + "horizontal", + l, + t.get("selectorItemGap", !0) + ); + var b = t.get("selectorButtonGap", !0), w = l.getBoundingRect(), p = [-w.x, -w.y], d = Ot(i); + o && (d[c] = i[c] - w[c] - b); + var m = this._layoutContentAndController(t, a, d, u, c, f, v, h); + if (o) { + if (s === "end") + p[u] += m[c] + b; + else { + var _ = w[c] + b; + p[u] -= _, m[h] -= _; + } + m[c] += w[c] + b, p[1 - u] += m[v] + m[f] / 2 - w[f] / 2, m[f] = Math.max(m[f], w[f]), m[v] = Math.min(m[v], w[v] + p[1 - u]), l.x = p[0], l.y = p[1], l.markRedraw(); + } + return m; + }, e.prototype._layoutContentAndController = function(t, n, i, a, o, s, l, u) { + var c = this.getContentGroup(), h = this._containerGroup, f = this._controllerGroup; + Nh(t.get("orient"), c, t.get("itemGap"), a ? i.width : null, a ? null : i.height), Nh( + // Buttons in controller are layout always horizontally. + "horizontal", + f, + t.get("pageButtonItemGap", !0) + ); + var v = c.getBoundingRect(), b = f.getBoundingRect(), w = this._showController = v[o] > i[o], p = [-v.x, -v.y]; + n || (p[a] = c[u]); + var d = [0, 0], m = [-b.x, -b.y], _ = Jt(t.get("pageButtonGap", !0), t.get("itemGap", !0)); + if (w) { + var y = t.get("pageButtonPosition", !0); + y === "end" ? m[a] += i[o] - b[o] : d[a] += b[o] + _; + } + m[1 - a] += v[s] / 2 - b[s] / 2, c.setPosition(p), h.setPosition(d), f.setPosition(m); + var x = { + x: 0, + y: 0 + }; + if (x[o] = w ? i[o] : v[o], x[s] = Math.max(v[s], b[s]), x[l] = Math.min(0, b[l] + m[1 - a]), h.__rectSize = i[o], w) { + var g = { + x: 0, + y: 0 + }; + g[o] = Math.max(i[o] - b[o] - _, 0), g[s] = x[s], h.setClipPath(new Or({ + shape: g + })), h.__rectSize = g[o]; + } else + f.eachChild(function(T) { + T.attr({ + invisible: !0, + silent: !0 + }); + }); + var S = this._getPageInfo(t); + return S.pageIndex != null && zr( + c, + { + x: S.contentPosition[0], + y: S.contentPosition[1] + }, + // When switch from "show controller" to "not show controller", view should be + // updated immediately without animation, otherwise causes weird effect. + w ? t : null + ), this._updatePageInfoView(t, S), x; + }, e.prototype._pageGo = function(t, n, i) { + var a = this._getPageInfo(n)[t]; + a != null && i.dispatchAction({ + type: "legendScroll", + scrollDataIndex: a, + legendId: n.id + }); + }, e.prototype._updatePageInfoView = function(t, n) { + var i = this._controllerGroup; + X(["pagePrev", "pageNext"], function(c) { + var h = c + "DataIndex", f = n[h] != null, v = i.childOfName(c); + v && (v.setStyle("fill", f ? t.get("pageIconColor", !0) : t.get("pageIconInactiveColor", !0)), v.cursor = f ? "pointer" : "default"); + }); + var a = i.childOfName("pageText"), o = t.get("pageFormatter"), s = n.pageIndex, l = s != null ? s + 1 : 0, u = n.pageCount; + a && o && a.setStyle("text", ut(o) ? o.replace("{current}", l == null ? "" : l + "").replace("{total}", u == null ? "" : u + "") : o({ + current: l, + total: u + })); + }, e.prototype._getPageInfo = function(t) { + var n = t.get("scrollDataIndex", !0), i = this.getContentGroup(), a = this._containerGroup.__rectSize, o = t.getOrient().index, s = pC[o], l = gC[o], u = this._findTargetItemIndex(n), c = i.children(), h = c[u], f = c.length, v = f ? 1 : 0, b = { + contentPosition: [i.x, i.y], + pageCount: v, + pageIndex: v - 1, + pagePrevDataIndex: null, + pageNextDataIndex: null + }; + if (!h) + return b; + var w = y(h); + b.contentPosition[o] = -w.s; + for (var p = u + 1, d = w, m = w, _ = null; p <= f; ++p) + _ = y(c[p]), // Half of the last item is out of the window. + (!_ && m.e > d.s + a || // If the current item does not intersect with the window, the new page + // can be started at the current item or the last item. + _ && !x(_, d.s)) && (m.i > d.i ? d = m : d = _, d && (b.pageNextDataIndex == null && (b.pageNextDataIndex = d.i), ++b.pageCount)), m = _; + for (var p = u - 1, d = w, m = w, _ = null; p >= -1; --p) + _ = y(c[p]), // If the the end item does not intersect with the window started + // from the current item, a page can be settled. + (!_ || !x(m, _.s)) && // e.g., when page size is smaller than item size. + d.i < m.i && (m = d, b.pagePrevDataIndex == null && (b.pagePrevDataIndex = d.i), ++b.pageCount, ++b.pageIndex), d = _; + return b; + function y(g) { + if (g) { + var S = g.getBoundingRect(), T = S[l] + g[l]; + return { + s: T, + e: T + S[s], + i: g.__legendDataIndex + }; + } + } + function x(g, S) { + return g.e >= S && g.s <= S + a; + } + }, e.prototype._findTargetItemIndex = function(t) { + if (!this._showController) + return 0; + var n, i = this.getContentGroup(), a; + return i.eachChild(function(o, s) { + var l = o.__legendDataIndex; + a == null && l != null && (a = s), l === t && (n = s); + }), n != null ? n : a; + }, e.type = "legend.scroll", e; + }(pV) +); +const Fge = jge; +function $ge(r) { + r.registerAction("legendScroll", "legendscroll", function(e, t) { + var n = e.scrollDataIndex; + n != null && t.eachComponent({ + mainType: "legend", + subType: "scroll", + query: e + }, function(i) { + i.setScrollDataIndex(n); + }); + }); +} +function Hge(r) { + Kt(gV), r.registerComponentModel(Bge), r.registerComponentView(Fge), $ge(r); +} +function Vge(r) { + Kt(gV), Kt(Hge); +} +var Gge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "dataZoom.inside", e.defaultOption = Tc(Rg.defaultOption, { + disabled: !1, + zoomLock: !1, + zoomOnMouseWheel: !0, + moveOnMouseMove: !0, + moveOnMouseWheel: !1, + preventDefaultMouseMove: !0 + }), e; + }(Rg) +); +const Uge = Gge; +var UE = Rr(); +function Wge(r, e, t) { + UE(r).coordSysRecordMap.each(function(n) { + var i = n.dataZoomInfoMap.get(e.uid); + i && (i.getRange = t); + }); +} +function Yge(r, e) { + for (var t = UE(r).coordSysRecordMap, n = t.keys(), i = 0; i < n.length; i++) { + var a = n[i], o = t.get(a), s = o.dataZoomInfoMap; + if (s) { + var l = e.uid, u = s.get(l); + u && (s.removeKey(l), s.keys().length || mV(t, o)); + } + } +} +function mV(r, e) { + if (e) { + r.removeKey(e.model.uid); + var t = e.controller; + t && t.dispose(); + } +} +function Xge(r, e) { + var t = { + model: e, + containsPoint: jt(Jge, e), + dispatchAction: jt(Zge, r), + dataZoomInfoMap: null, + controller: null + }, n = t.controller = new vm(r.getZr()); + return X(["pan", "zoom", "scrollMove"], function(i) { + n.on(i, function(a) { + var o = []; + t.dataZoomInfoMap.each(function(s) { + if (a.isAvailableBehavior(s.model.option)) { + var l = (s.getRange || {})[i], u = l && l(s.dzReferCoordSysInfo, t.model.mainType, t.controller, a); + !s.model.get("disabled", !0) && u && o.push({ + dataZoomId: s.model.id, + start: u[0], + end: u[1] + }); + } + }), o.length && t.dispatchAction(o); + }); + }), t; +} +function Zge(r, e) { + r.isDisposed() || r.dispatchAction({ + type: "dataZoom", + animation: { + easing: "cubicOut", + duration: 100 + }, + batch: e + }); +} +function Jge(r, e, t, n) { + return r.coordinateSystem.containPoint([t, n]); +} +function Kge(r) { + var e, t = "type_", n = { + type_true: 2, + type_move: 1, + type_false: 0, + type_undefined: -1 + }, i = !0; + return r.each(function(a) { + var o = a.model, s = o.get("disabled", !0) ? !1 : o.get("zoomLock", !0) ? "move" : !0; + n[t + s] > n[t + e] && (e = s), i = i && o.get("preventDefaultMouseMove", !0); + }), { + controlType: e, + opt: { + // RoamController will enable all of these functionalities, + // and the final behavior is determined by its event listener + // provided by each inside zoom. + zoomOnMouseWheel: !0, + moveOnMouseMove: !0, + moveOnMouseWheel: !0, + preventDefaultMouseMove: !!i + } + }; +} +function Qge(r) { + r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER, function(e, t) { + var n = UE(t), i = n.coordSysRecordMap || (n.coordSysRecordMap = xt()); + i.each(function(a) { + a.dataZoomInfoMap = null; + }), e.eachComponent({ + mainType: "dataZoom", + subType: "inside" + }, function(a) { + var o = Q3(a); + X(o.infoList, function(s) { + var l = s.model.uid, u = i.get(l) || i.set(l, Xge(t, s.model)), c = u.dataZoomInfoMap || (u.dataZoomInfoMap = xt()); + c.set(a.uid, { + dzReferCoordSysInfo: s, + model: a, + getRange: null + }); + }); + }), i.each(function(a) { + var o = a.controller, s, l = a.dataZoomInfoMap; + if (l) { + var u = l.keys()[0]; + u != null && (s = l.get(u)); + } + if (!s) { + mV(i, a); + return; + } + var c = Kge(l); + o.enable(c.controlType, c.opt), o.setPointerChecker(a.containsPoint), sv(a, "dispatchAction", s.model.get("throttle", !0), "fixRate"); + }); + }); +} +var qge = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "dataZoom.inside", t; + } + return e.prototype.render = function(t, n, i) { + if (r.prototype.render.apply(this, arguments), t.noTarget()) { + this._clear(); + return; + } + this.range = t.getPercentRange(), Wge(i, t, { + pan: ft(mC.pan, this), + zoom: ft(mC.zoom, this), + scrollMove: ft(mC.scrollMove, this) + }); + }, e.prototype.dispose = function() { + this._clear(), r.prototype.dispose.apply(this, arguments); + }, e.prototype._clear = function() { + Yge(this.api, this.dataZoomModel), this.range = null; + }, e.type = "dataZoom.inside", e; + }(NE) +), mC = { + zoom: function(r, e, t, n) { + var i = this.range, a = i.slice(), o = r.axisModels[0]; + if (o) { + var s = yC[e](null, [n.originX, n.originY], o, t, r), l = (s.signal > 0 ? s.pixelStart + s.pixelLength - s.pixel : s.pixel - s.pixelStart) / s.pixelLength * (a[1] - a[0]) + a[0], u = Math.max(1 / n.scale, 0); + a[0] = (a[0] - l) * u + l, a[1] = (a[1] - l) * u + l; + var c = this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan(); + if (cf(0, a, [0, 100], 0, c.minSpan, c.maxSpan), this.range = a, i[0] !== a[0] || i[1] !== a[1]) + return a; + } + }, + pan: aN(function(r, e, t, n, i, a) { + var o = yC[n]([a.oldX, a.oldY], [a.newX, a.newY], e, i, t); + return o.signal * (r[1] - r[0]) * o.pixel / o.pixelLength; + }), + scrollMove: aN(function(r, e, t, n, i, a) { + var o = yC[n]([0, 0], [a.scrollDelta, a.scrollDelta], e, i, t); + return o.signal * (r[1] - r[0]) * a.scrollDelta; + }) +}; +function aN(r) { + return function(e, t, n, i) { + var a = this.range, o = a.slice(), s = e.axisModels[0]; + if (s) { + var l = r(o, s, e, t, n, i); + if (cf(l, o, [0, 100], "all"), this.range = o, a[0] !== o[0] || a[1] !== o[1]) + return o; + } + }; +} +var yC = { + grid: function(r, e, t, n, i) { + var a = t.axis, o = {}, s = i.model.coordinateSystem.getRect(); + return r = r || [0, 0], a.dim === "x" ? (o.pixel = e[0] - r[0], o.pixelLength = s.width, o.pixelStart = s.x, o.signal = a.inverse ? 1 : -1) : (o.pixel = e[1] - r[1], o.pixelLength = s.height, o.pixelStart = s.y, o.signal = a.inverse ? -1 : 1), o; + }, + polar: function(r, e, t, n, i) { + var a = t.axis, o = {}, s = i.model.coordinateSystem, l = s.getRadiusAxis().getExtent(), u = s.getAngleAxis().getExtent(); + return r = r ? s.pointToCoord(r) : [0, 0], e = s.pointToCoord(e), t.mainType === "radiusAxis" ? (o.pixel = e[0] - r[0], o.pixelLength = l[1] - l[0], o.pixelStart = l[0], o.signal = a.inverse ? 1 : -1) : (o.pixel = e[1] - r[1], o.pixelLength = u[1] - u[0], o.pixelStart = u[0], o.signal = a.inverse ? -1 : 1), o; + }, + singleAxis: function(r, e, t, n, i) { + var a = t.axis, o = i.model.coordinateSystem.getRect(), s = {}; + return r = r || [0, 0], a.orient === "horizontal" ? (s.pixel = e[0] - r[0], s.pixelLength = o.width, s.pixelStart = o.x, s.signal = a.inverse ? 1 : -1) : (s.pixel = e[1] - r[1], s.pixelLength = o.height, s.pixelStart = o.y, s.signal = a.inverse ? -1 : 1), s; + } +}; +const eme = qge; +function yV(r) { + zE(r), r.registerComponentModel(Uge), r.registerComponentView(eme), Qge(r); +} +var tme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.type = "dataZoom.slider", e.layoutMode = "box", e.defaultOption = Tc(Rg.defaultOption, { + show: !0, + // deault value can only be drived in view stage. + right: "ph", + top: "ph", + width: "ph", + height: "ph", + left: null, + bottom: null, + borderColor: "#d2dbee", + borderRadius: 3, + backgroundColor: "rgba(47,69,84,0)", + // dataBackgroundColor: '#ddd', + dataBackground: { + lineStyle: { + color: "#d2dbee", + width: 0.5 + }, + areaStyle: { + color: "#d2dbee", + opacity: 0.2 + } + }, + selectedDataBackground: { + lineStyle: { + color: "#8fb0f7", + width: 0.5 + }, + areaStyle: { + color: "#8fb0f7", + opacity: 0.2 + } + }, + // Color of selected window. + fillerColor: "rgba(135,175,274,0.2)", + handleIcon: "path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z", + // Percent of the slider height + handleSize: "100%", + handleStyle: { + color: "#fff", + borderColor: "#ACB8D1" + }, + moveHandleSize: 7, + moveHandleIcon: "path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z", + moveHandleStyle: { + color: "#D2DBEE", + opacity: 0.7 + }, + showDetail: !0, + showDataShadow: "auto", + realtime: !0, + zoomLock: !1, + textStyle: { + color: "#6E7079" + }, + brushSelect: !0, + brushStyle: { + color: "rgba(135,175,274,0.15)" + }, + emphasis: { + handleStyle: { + borderColor: "#8FB0F7" + }, + moveHandleStyle: { + color: "#8FB0F7" + } + } + }), e; + }(Rg) +); +const rme = tme; +var _p = Or, oN = 7, nme = 1, _C = 30, ime = 7, bp = "horizontal", sN = "vertical", ame = 5, ome = ["line", "bar", "candlestick", "scatter"], sme = { + easing: "cubicOut", + duration: 100, + delay: 0 +}, lme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._displayables = {}, t; + } + return e.prototype.init = function(t, n) { + this.api = n, this._onBrush = ft(this._onBrush, this), this._onBrushEnd = ft(this._onBrushEnd, this); + }, e.prototype.render = function(t, n, i, a) { + if (r.prototype.render.apply(this, arguments), sv(this, "_dispatchZoomAction", t.get("throttle"), "fixRate"), this._orient = t.getOrient(), t.get("show") === !1) { + this.group.removeAll(); + return; + } + if (t.noTarget()) { + this._clear(), this.group.removeAll(); + return; + } + (!a || a.type !== "dataZoom" || a.from !== this.uid) && this._buildView(), this._updateView(); + }, e.prototype.dispose = function() { + this._clear(), r.prototype.dispose.apply(this, arguments); + }, e.prototype._clear = function() { + Sg(this, "_dispatchZoomAction"); + var t = this.api.getZr(); + t.off("mousemove", this._onBrush), t.off("mouseup", this._onBrushEnd); + }, e.prototype._buildView = function() { + var t = this.group; + t.removeAll(), this._brushing = !1, this._displayables.brushRect = null, this._resetLocation(), this._resetInterval(); + var n = this._displayables.sliderGroup = new Rt(); + this._renderBackground(), this._renderHandle(), this._renderDataShadow(), t.add(n), this._positionGroup(); + }, e.prototype._resetLocation = function() { + var t = this.dataZoomModel, n = this.api, i = t.get("brushSelect"), a = i ? ime : 0, o = this._findCoordRect(), s = { + width: n.getWidth(), + height: n.getHeight() + }, l = this._orient === bp ? { + // Why using 'right', because right should be used in vertical, + // and it is better to be consistent for dealing with position param merge. + right: s.width - o.x - o.width, + top: s.height - _C - oN - a, + width: o.width, + height: _C + } : { + right: oN, + top: o.y, + width: _C, + height: o.height + }, u = rv(t.option); + X(["right", "top", "width", "height"], function(h) { + u[h] === "ph" && (u[h] = l[h]); + }); + var c = yi(u, s); + this._location = { + x: c.x, + y: c.y + }, this._size = [c.width, c.height], this._orient === sN && this._size.reverse(); + }, e.prototype._positionGroup = function() { + var t = this.group, n = this._location, i = this._orient, a = this.dataZoomModel.getFirstTargetAxisModel(), o = a && a.get("inverse"), s = this._displayables.sliderGroup, l = (this._dataShadowInfo || {}).otherAxisInverse; + s.attr(i === bp && !o ? { + scaleY: l ? 1 : -1, + scaleX: 1 + } : i === bp && o ? { + scaleY: l ? 1 : -1, + scaleX: -1 + } : i === sN && !o ? { + scaleY: l ? -1 : 1, + scaleX: 1, + rotation: Math.PI / 2 + } : { + scaleY: l ? -1 : 1, + scaleX: -1, + rotation: Math.PI / 2 + }); + var u = t.getBoundingRect([s]); + t.x = n.x - u.x, t.y = n.y - u.y, t.markRedraw(); + }, e.prototype._getViewExtent = function() { + return [0, this._size[0]]; + }, e.prototype._renderBackground = function() { + var t = this.dataZoomModel, n = this._size, i = this._displayables.sliderGroup, a = t.get("brushSelect"); + i.add(new _p({ + silent: !0, + shape: { + x: 0, + y: 0, + width: n[0], + height: n[1] + }, + style: { + fill: t.get("backgroundColor") + }, + z2: -40 + })); + var o = new _p({ + shape: { + x: 0, + y: 0, + width: n[0], + height: n[1] + }, + style: { + fill: "transparent" + }, + z2: 0, + onclick: ft(this._onClickPanel, this) + }), s = this.api.getZr(); + a ? (o.on("mousedown", this._onBrushStart, this), o.cursor = "crosshair", s.on("mousemove", this._onBrush), s.on("mouseup", this._onBrushEnd)) : (s.off("mousemove", this._onBrush), s.off("mouseup", this._onBrushEnd)), i.add(o); + }, e.prototype._renderDataShadow = function() { + var t = this._dataShadowInfo = this._prepareDataShadowInfo(); + if (this._displayables.dataShadowSegs = [], !t) + return; + var n = this._size, i = this._shadowSize || [], a = t.series, o = a.getRawData(), s = a.getShadowDim && a.getShadowDim(), l = s && o.getDimensionInfo(s) ? a.getShadowDim() : t.otherDim; + if (l == null) + return; + var u = this._shadowPolygonPts, c = this._shadowPolylinePts; + if (o !== this._shadowData || l !== this._shadowDim || n[0] !== i[0] || n[1] !== i[1]) { + var h = o.getDataExtent(l), f = (h[1] - h[0]) * 0.3; + h = [h[0] - f, h[1] + f]; + var v = [0, n[1]], b = [0, n[0]], w = [[n[0], 0], [0, 0]], p = [], d = b[1] / (o.count() - 1), m = 0, _ = Math.round(o.count() / n[0]), y; + o.each([l], function(C, E) { + if (_ > 0 && E % _) { + m += d; + return; + } + var M = C == null || isNaN(C) || C === "", P = M ? 0 : Zr(C, h, v, !0); + M && !y && E ? (w.push([w[w.length - 1][0], 0]), p.push([p[p.length - 1][0], 0])) : !M && y && (w.push([m, 0]), p.push([m, 0])), w.push([m, P]), p.push([m, P]), m += d, y = M; + }), u = this._shadowPolygonPts = w, c = this._shadowPolylinePts = p; + } + this._shadowData = o, this._shadowDim = l, this._shadowSize = [n[0], n[1]]; + var x = this.dataZoomModel; + function g(C) { + var E = x.getModel(C ? "selectedDataBackground" : "dataBackground"), M = new Rt(), P = new La({ + shape: { + points: u + }, + segmentIgnoreThreshold: 1, + style: E.getModel("areaStyle").getAreaStyle(), + silent: !0, + z2: -20 + }), R = new Pa({ + shape: { + points: c + }, + segmentIgnoreThreshold: 1, + style: E.getModel("lineStyle").getLineStyle(), + silent: !0, + z2: -19 + }); + return M.add(P), M.add(R), M; + } + for (var S = 0; S < 3; S++) { + var T = g(S === 1); + this._displayables.sliderGroup.add(T), this._displayables.dataShadowSegs.push(T); + } + }, e.prototype._prepareDataShadowInfo = function() { + var t = this.dataZoomModel, n = t.get("showDataShadow"); + if (n !== !1) { + var i, a = this.ecModel; + return t.eachTargetAxis(function(o, s) { + var l = t.getAxisProxy(o, s).getTargetSeriesModels(); + X(l, function(u) { + if (!i && !(n !== !0 && ir(ome, u.get("type")) < 0)) { + var c = a.getComponent(qu(o), s).axis, h = ume(o), f, v = u.coordinateSystem; + h != null && v.getOtherAxis && (f = v.getOtherAxis(c).inverse), h = u.getData().mapDimension(h), i = { + thisAxis: c, + series: u, + thisDim: o, + otherDim: h, + otherAxisInverse: f + }; + } + }, this); + }, this), i; + } + }, e.prototype._renderHandle = function() { + var t = this.group, n = this._displayables, i = n.handles = [null, null], a = n.handleLabels = [null, null], o = this._displayables.sliderGroup, s = this._size, l = this.dataZoomModel, u = this.api, c = l.get("borderRadius") || 0, h = l.get("brushSelect"), f = n.filler = new _p({ + silent: h, + style: { + fill: l.get("fillerColor") + }, + textConfig: { + position: "inside" + } + }); + o.add(f), o.add(new _p({ + silent: !0, + subPixelOptimize: !0, + shape: { + x: 0, + y: 0, + width: s[0], + height: s[1], + r: c + }, + style: { + // deprecated option + stroke: l.get("dataBackgroundColor") || l.get("borderColor"), + lineWidth: nme, + fill: "rgba(0,0,0,0)" + } + })), X([0, 1], function(_) { + var y = l.get("handleIcon"); + !I_[y] && y.indexOf("path://") < 0 && y.indexOf("image://") < 0 && (y = "path://" + y); + var x = li(y, -1, 0, 2, 2, null, !0); + x.attr({ + cursor: lN(this._orient), + draggable: !0, + drift: ft(this._onDragMove, this, _), + ondragend: ft(this._onDragEnd, this), + onmouseover: ft(this._showDataInfo, this, !0), + onmouseout: ft(this._showDataInfo, this, !1), + z2: 5 + }); + var g = x.getBoundingRect(), S = l.get("handleSize"); + this._handleHeight = ot(S, this._size[1]), this._handleWidth = g.width / g.height * this._handleHeight, x.setStyle(l.getModel("handleStyle").getItemStyle()), x.style.strokeNoScale = !0, x.rectHover = !0, x.ensureState("emphasis").style = l.getModel(["emphasis", "handleStyle"]).getItemStyle(), ac(x); + var T = l.get("handleColor"); + T != null && (x.style.fill = T), o.add(i[_] = x); + var C = l.getModel("textStyle"); + t.add(a[_] = new kr({ + silent: !0, + invisible: !0, + style: gn(C, { + x: 0, + y: 0, + text: "", + verticalAlign: "middle", + align: "center", + fill: C.getTextColor(), + font: C.getFont() + }), + z2: 10 + })); + }, this); + var v = f; + if (h) { + var b = ot(l.get("moveHandleSize"), s[1]), w = n.moveHandle = new Or({ + style: l.getModel("moveHandleStyle").getItemStyle(), + silent: !0, + shape: { + r: [0, 0, 2, 2], + y: s[1] - 0.5, + height: b + } + }), p = b * 0.8, d = n.moveHandleIcon = li(l.get("moveHandleIcon"), -p / 2, -p / 2, p, p, "#fff", !0); + d.silent = !0, d.y = s[1] + b / 2 - 0.5, w.ensureState("emphasis").style = l.getModel(["emphasis", "moveHandleStyle"]).getItemStyle(); + var m = Math.min(s[1] / 2, Math.max(b, 10)); + v = n.moveZone = new Or({ + invisible: !0, + shape: { + y: s[1] - m, + height: b + m + } + }), v.on("mouseover", function() { + u.enterEmphasis(w); + }).on("mouseout", function() { + u.leaveEmphasis(w); + }), o.add(w), o.add(d), o.add(v); + } + v.attr({ + draggable: !0, + cursor: lN(this._orient), + drift: ft(this._onDragMove, this, "all"), + ondragstart: ft(this._showDataInfo, this, !0), + ondragend: ft(this._onDragEnd, this), + onmouseover: ft(this._showDataInfo, this, !0), + onmouseout: ft(this._showDataInfo, this, !1) + }); + }, e.prototype._resetInterval = function() { + var t = this._range = this.dataZoomModel.getPercentRange(), n = this._getViewExtent(); + this._handleEnds = [Zr(t[0], [0, 100], n, !0), Zr(t[1], [0, 100], n, !0)]; + }, e.prototype._updateInterval = function(t, n) { + var i = this.dataZoomModel, a = this._handleEnds, o = this._getViewExtent(), s = i.findRepresentativeAxisProxy().getMinMaxSpan(), l = [0, 100]; + cf(n, a, o, i.get("zoomLock") ? "all" : t, s.minSpan != null ? Zr(s.minSpan, l, o, !0) : null, s.maxSpan != null ? Zr(s.maxSpan, l, o, !0) : null); + var u = this._range, c = this._range = yo([Zr(a[0], o, l, !0), Zr(a[1], o, l, !0)]); + return !u || u[0] !== c[0] || u[1] !== c[1]; + }, e.prototype._updateView = function(t) { + var n = this._displayables, i = this._handleEnds, a = yo(i.slice()), o = this._size; + X([0, 1], function(v) { + var b = n.handles[v], w = this._handleHeight; + b.attr({ + scaleX: w / 2, + scaleY: w / 2, + // This is a trick, by adding an extra tiny offset to let the default handle's end point align to the drag window. + // NOTE: It may affect some custom shapes a bit. But we prefer to have better result by default. + x: i[v] + (v ? -1 : 1), + y: o[1] / 2 - w / 2 + }); + }, this), n.filler.setShape({ + x: a[0], + y: 0, + width: a[1] - a[0], + height: o[1] + }); + var s = { + x: a[0], + width: a[1] - a[0] + }; + n.moveHandle && (n.moveHandle.setShape(s), n.moveZone.setShape(s), n.moveZone.getBoundingRect(), n.moveHandleIcon && n.moveHandleIcon.attr("x", s.x + s.width / 2)); + for (var l = n.dataShadowSegs, u = [0, a[0], a[1], o[0]], c = 0; c < l.length; c++) { + var h = l[c], f = h.getClipPath(); + f || (f = new Or(), h.setClipPath(f)), f.setShape({ + x: u[c], + y: 0, + width: u[c + 1] - u[c], + height: o[1] + }); + } + this._updateDataInfo(t); + }, e.prototype._updateDataInfo = function(t) { + var n = this.dataZoomModel, i = this._displayables, a = i.handleLabels, o = this._orient, s = ["", ""]; + if (n.get("showDetail")) { + var l = n.findRepresentativeAxisProxy(); + if (l) { + var u = l.getAxisModel().axis, c = this._range, h = t ? l.calculateDataWindow({ + start: c[0], + end: c[1] + }).valueWindow : l.getDataValueWindow(); + s = [this._formatLabel(h[0], u), this._formatLabel(h[1], u)]; + } + } + var f = yo(this._handleEnds.slice()); + v.call(this, 0), v.call(this, 1); + function v(b) { + var w = oc(i.handles[b].parent, this.group), p = $b(b === 0 ? "right" : "left", w), d = this._handleWidth / 2 + ame, m = zs([f[b] + (b === 0 ? -d : d), this._size[1] / 2], w); + a[b].setStyle({ + x: m[0], + y: m[1], + verticalAlign: o === bp ? "middle" : p, + align: o === bp ? p : "center", + text: s[b] + }); + } + }, e.prototype._formatLabel = function(t, n) { + var i = this.dataZoomModel, a = i.get("labelFormatter"), o = i.get("labelPrecision"); + (o == null || o === "auto") && (o = n.getPixelPrecision()); + var s = t == null || isNaN(t) ? "" : n.type === "category" || n.type === "time" ? n.scale.getLabel({ + value: Math.round(t) + }) : t.toFixed(Math.min(o, 20)); + return Tt(a) ? a(t, s) : ut(a) ? a.replace("{value}", s) : s; + }, e.prototype._showDataInfo = function(t) { + t = this._dragging || t; + var n = this._displayables, i = n.handleLabels; + i[0].attr("invisible", !t), i[1].attr("invisible", !t), n.moveHandle && this.api[t ? "enterEmphasis" : "leaveEmphasis"](n.moveHandle, 1); + }, e.prototype._onDragMove = function(t, n, i, a) { + this._dragging = !0, eu(a.event); + var o = this._displayables.sliderGroup.getLocalTransform(), s = zs([n, i], o, !0), l = this._updateInterval(t, s[0]), u = this.dataZoomModel.get("realtime"); + this._updateView(!u), l && u && this._dispatchZoomAction(!0); + }, e.prototype._onDragEnd = function() { + this._dragging = !1, this._showDataInfo(!1); + var t = this.dataZoomModel.get("realtime"); + !t && this._dispatchZoomAction(!1); + }, e.prototype._onClickPanel = function(t) { + var n = this._size, i = this._displayables.sliderGroup.transformCoordToLocal(t.offsetX, t.offsetY); + if (!(i[0] < 0 || i[0] > n[0] || i[1] < 0 || i[1] > n[1])) { + var a = this._handleEnds, o = (a[0] + a[1]) / 2, s = this._updateInterval("all", i[0] - o); + this._updateView(), s && this._dispatchZoomAction(!1); + } + }, e.prototype._onBrushStart = function(t) { + var n = t.offsetX, i = t.offsetY; + this._brushStart = new Zt(n, i), this._brushing = !0, this._brushStartTime = +/* @__PURE__ */ new Date(); + }, e.prototype._onBrushEnd = function(t) { + if (this._brushing) { + var n = this._displayables.brushRect; + if (this._brushing = !1, !!n) { + n.attr("ignore", !0); + var i = n.shape, a = +/* @__PURE__ */ new Date(); + if (!(a - this._brushStartTime < 200 && Math.abs(i.width) < 5)) { + var o = this._getViewExtent(), s = [0, 100]; + this._range = yo([Zr(i.x, o, s, !0), Zr(i.x + i.width, o, s, !0)]), this._handleEnds = [i.x, i.x + i.width], this._updateView(), this._dispatchZoomAction(!1); + } + } + } + }, e.prototype._onBrush = function(t) { + this._brushing && (eu(t.event), this._updateBrushRect(t.offsetX, t.offsetY)); + }, e.prototype._updateBrushRect = function(t, n) { + var i = this._displayables, a = this.dataZoomModel, o = i.brushRect; + o || (o = i.brushRect = new _p({ + silent: !0, + style: a.getModel("brushStyle").getItemStyle() + }), i.sliderGroup.add(o)), o.attr("ignore", !1); + var s = this._brushStart, l = this._displayables.sliderGroup, u = l.transformCoordToLocal(t, n), c = l.transformCoordToLocal(s.x, s.y), h = this._size; + u[0] = Math.max(Math.min(h[0], u[0]), 0), o.setShape({ + x: c[0], + y: 0, + width: u[0] - c[0], + height: h[1] + }); + }, e.prototype._dispatchZoomAction = function(t) { + var n = this._range; + this.api.dispatchAction({ + type: "dataZoom", + from: this.uid, + dataZoomId: this.dataZoomModel.id, + animation: t ? sme : null, + start: n[0], + end: n[1] + }); + }, e.prototype._findCoordRect = function() { + var t, n = Q3(this.dataZoomModel).infoList; + if (!t && n.length) { + var i = n[0].model.coordinateSystem; + t = i.getRect && i.getRect(); + } + if (!t) { + var a = this.api.getWidth(), o = this.api.getHeight(); + t = { + x: a * 0.2, + y: o * 0.2, + width: a * 0.6, + height: o * 0.6 + }; + } + return t; + }, e.type = "dataZoom.slider", e; + }(NE) +); +function ume(r) { + var e = { + x: "y", + y: "x", + radius: "angle", + angle: "radius" + }; + return e[r]; +} +function lN(r) { + return r === "vertical" ? "ns-resize" : "ew-resize"; +} +const cme = lme; +function _V(r) { + r.registerComponentModel(rme), r.registerComponentView(cme), zE(r); +} +function hme(r) { + Kt(yV), Kt(_V); +} +var fme = { + /** + * @public + */ + get: function(r, e, t) { + var n = Ot((dme[r] || {})[e]); + return t && We(n) ? n[n.length - 1] : n; + } +}, dme = { + color: { + active: ["#006edd", "#e0ffff"], + inactive: ["rgba(0,0,0,0)"] + }, + colorHue: { + active: [0, 360], + inactive: [0, 0] + }, + colorSaturation: { + active: [0.3, 1], + inactive: [0, 0] + }, + colorLightness: { + active: [0.9, 0.5], + inactive: [0, 0] + }, + colorAlpha: { + active: [0.3, 1], + inactive: [0, 0] + }, + opacity: { + active: [0.3, 1], + inactive: [0, 0] + }, + symbol: { + active: ["circle", "roundRect", "diamond"], + inactive: ["none"] + }, + symbolSize: { + active: [10, 50], + inactive: [0, 0] + } +}; +const bV = fme; +var uN = Wi.mapVisual, vme = Wi.eachVisual, pme = We, cN = X, gme = yo, mme = Zr, yme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.stateList = ["inRange", "outOfRange"], t.replacableOptionKeys = ["inRange", "outOfRange", "target", "controller", "color"], t.layoutMode = { + type: "box", + ignoreSize: !0 + }, t.dataBound = [-1 / 0, 1 / 0], t.targetVisuals = {}, t.controllerVisuals = {}, t; + } + return e.prototype.init = function(t, n, i) { + this.mergeDefaultAndTheme(t, i); + }, e.prototype.optionUpdated = function(t, n) { + var i = this.option; + !n && lV(i, t, this.replacableOptionKeys), this.textStyleModel = this.getModel("textStyle"), this.resetItemSize(), this.completeVisualOption(); + }, e.prototype.resetVisual = function(t) { + var n = this.stateList; + t = ft(t, this), this.controllerVisuals = RT(this.option.controller, n, t), this.targetVisuals = RT(this.option.target, n, t); + }, e.prototype.getItemSymbol = function() { + return null; + }, e.prototype.getTargetSeriesIndices = function() { + var t = this.option.seriesIndex, n = []; + return t == null || t === "all" ? this.ecModel.eachSeries(function(i, a) { + n.push(a); + }) : n = ln(t), n; + }, e.prototype.eachTargetSeries = function(t, n) { + X(this.getTargetSeriesIndices(), function(i) { + var a = this.ecModel.getSeriesByIndex(i); + a && t.call(n, a); + }, this); + }, e.prototype.isTargetSeries = function(t) { + var n = !1; + return this.eachTargetSeries(function(i) { + i === t && (n = !0); + }), n; + }, e.prototype.formatValueText = function(t, n, i) { + var a = this.option, o = a.precision, s = this.dataBound, l = a.formatter, u; + i = i || ["<", ">"], We(t) && (t = t.slice(), u = !0); + var c = n ? t : u ? [h(t[0]), h(t[1])] : h(t); + if (ut(l)) + return l.replace("{value}", u ? c[0] : c).replace("{value2}", u ? c[1] : c); + if (Tt(l)) + return u ? l(t[0], t[1]) : l(t); + if (u) + return t[0] === s[0] ? i[0] + " " + c[1] : t[1] === s[1] ? i[1] + " " + c[0] : c[0] + " - " + c[1]; + return c; + function h(f) { + return f === s[0] ? "min" : f === s[1] ? "max" : (+f).toFixed(Math.min(o, 20)); + } + }, e.prototype.resetExtent = function() { + var t = this.option, n = gme([t.min, t.max]); + this._dataExtent = n; + }, e.prototype.getDataDimensionIndex = function(t) { + var n = this.option.dimension; + if (n != null) + return t.getDimensionIndex(n); + for (var i = t.dimensions, a = i.length - 1; a >= 0; a--) { + var o = i[a], s = t.getDimensionInfo(o); + if (!s.isCalculationCoord) + return s.storeDimIndex; + } + }, e.prototype.getExtent = function() { + return this._dataExtent.slice(); + }, e.prototype.completeVisualOption = function() { + var t = this.ecModel, n = this.option, i = { + inRange: n.inRange, + outOfRange: n.outOfRange + }, a = n.target || (n.target = {}), o = n.controller || (n.controller = {}); + Ut(a, i), Ut(o, i); + var s = this.isCategory(); + l.call(this, a), l.call(this, o), u.call(this, a, "inRange", "outOfRange"), c.call(this, o); + function l(h) { + pme(n.color) && !h.inRange && (h.inRange = { + color: n.color.slice().reverse() + }), h.inRange = h.inRange || { + color: t.get("gradientColor") + }; + } + function u(h, f, v) { + var b = h[f], w = h[v]; + b && !w && (w = h[v] = {}, cN(b, function(p, d) { + if (Wi.isValidType(d)) { + var m = bV.get(d, "inactive", s); + m != null && (w[d] = m, d === "color" && !w.hasOwnProperty("opacity") && !w.hasOwnProperty("colorAlpha") && (w.opacity = [0, 0])); + } + })); + } + function c(h) { + var f = (h.inRange || {}).symbol || (h.outOfRange || {}).symbol, v = (h.inRange || {}).symbolSize || (h.outOfRange || {}).symbolSize, b = this.get("inactiveColor"), w = this.getItemSymbol(), p = w || "roundRect"; + cN(this.stateList, function(d) { + var m = this.itemSize, _ = h[d]; + _ || (_ = h[d] = { + color: s ? b : [b] + }), _.symbol == null && (_.symbol = f && Ot(f) || (s ? p : [p])), _.symbolSize == null && (_.symbolSize = v && Ot(v) || (s ? m[0] : [m[0], m[0]])), _.symbol = uN(_.symbol, function(g) { + return g === "none" ? p : g; + }); + var y = _.symbolSize; + if (y != null) { + var x = -1 / 0; + vme(y, function(g) { + g > x && (x = g); + }), _.symbolSize = uN(y, function(g) { + return mme(g, [0, x], [0, m[0]], !0); + }); + } + }, this); + } + }, e.prototype.resetItemSize = function() { + this.itemSize = [parseFloat(this.get("itemWidth")), parseFloat(this.get("itemHeight"))]; + }, e.prototype.isCategory = function() { + return !!this.option.categories; + }, e.prototype.setSelected = function(t) { + }, e.prototype.getSelected = function() { + return null; + }, e.prototype.getValueState = function(t) { + return null; + }, e.prototype.getVisualMeta = function(t) { + return null; + }, e.type = "visualMap", e.dependencies = ["series"], e.defaultOption = { + show: !0, + // zlevel: 0, + z: 4, + seriesIndex: "all", + min: 0, + max: 200, + left: 0, + right: null, + top: null, + bottom: 0, + itemWidth: null, + itemHeight: null, + inverse: !1, + orient: "vertical", + backgroundColor: "rgba(0,0,0,0)", + borderColor: "#ccc", + contentColor: "#5793f3", + inactiveColor: "#aaa", + borderWidth: 0, + padding: 5, + // 接受数组分别设定上右下左边距,同css + textGap: 10, + precision: 0, + textStyle: { + color: "#333" + // 值域文字颜色 + } + }, e; + }(xr) +); +const q_ = yme; +var hN = [20, 140], _me = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.optionUpdated = function(t, n) { + r.prototype.optionUpdated.apply(this, arguments), this.resetExtent(), this.resetVisual(function(i) { + i.mappingMethod = "linear", i.dataExtent = this.getExtent(); + }), this._resetRange(); + }, e.prototype.resetItemSize = function() { + r.prototype.resetItemSize.apply(this, arguments); + var t = this.itemSize; + (t[0] == null || isNaN(t[0])) && (t[0] = hN[0]), (t[1] == null || isNaN(t[1])) && (t[1] = hN[1]); + }, e.prototype._resetRange = function() { + var t = this.getExtent(), n = this.option.range; + !n || n.auto ? (t.auto = 1, this.option.range = t) : We(n) && (n[0] > n[1] && n.reverse(), n[0] = Math.max(n[0], t[0]), n[1] = Math.min(n[1], t[1])); + }, e.prototype.completeVisualOption = function() { + r.prototype.completeVisualOption.apply(this, arguments), X(this.stateList, function(t) { + var n = this.option.controller[t].symbolSize; + n && n[0] !== n[1] && (n[0] = n[1] / 3); + }, this); + }, e.prototype.setSelected = function(t) { + this.option.range = t.slice(), this._resetRange(); + }, e.prototype.getSelected = function() { + var t = this.getExtent(), n = yo((this.get("range") || []).slice()); + return n[0] > t[1] && (n[0] = t[1]), n[1] > t[1] && (n[1] = t[1]), n[0] < t[0] && (n[0] = t[0]), n[1] < t[0] && (n[1] = t[0]), n; + }, e.prototype.getValueState = function(t) { + var n = this.option.range, i = this.getExtent(); + return (n[0] <= i[0] || n[0] <= t) && (n[1] >= i[1] || t <= n[1]) ? "inRange" : "outOfRange"; + }, e.prototype.findTargetDataIndices = function(t) { + var n = []; + return this.eachTargetSeries(function(i) { + var a = [], o = i.getData(); + o.each(this.getDataDimensionIndex(o), function(s, l) { + t[0] <= s && s <= t[1] && a.push(l); + }, this), n.push({ + seriesId: i.id, + dataIndex: a + }); + }, this), n; + }, e.prototype.getVisualMeta = function(t) { + var n = fN(this, "outOfRange", this.getExtent()), i = fN(this, "inRange", this.option.range.slice()), a = []; + function o(v, b) { + a.push({ + value: v, + color: t(v, b) + }); + } + for (var s = 0, l = 0, u = i.length, c = n.length; l < c && (!i.length || n[l] <= i[0]); l++) + n[l] < i[s] && o(n[l], "outOfRange"); + for (var h = 1; s < u; s++, h = 0) + h && a.length && o(i[s], "outOfRange"), o(i[s], "inRange"); + for (var h = 1; l < c; l++) + (!i.length || i[i.length - 1] < n[l]) && (h && (a.length && o(a[a.length - 1].value, "outOfRange"), h = 0), o(n[l], "outOfRange")); + var f = a.length; + return { + stops: a, + outerColors: [f ? a[0].color : "transparent", f ? a[f - 1].color : "transparent"] + }; + }, e.type = "visualMap.continuous", e.defaultOption = Tc(q_.defaultOption, { + align: "auto", + calculable: !1, + hoverLink: !0, + realtime: !0, + handleIcon: "path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z", + handleSize: "120%", + handleStyle: { + borderColor: "#fff", + borderWidth: 1 + }, + indicatorIcon: "circle", + indicatorSize: "50%", + indicatorStyle: { + borderColor: "#fff", + borderWidth: 2, + shadowBlur: 2, + shadowOffsetX: 1, + shadowOffsetY: 1, + shadowColor: "rgba(0,0,0,0.2)" + } + // emphasis: { + // handleStyle: { + // shadowBlur: 3, + // shadowOffsetX: 1, + // shadowOffsetY: 1, + // shadowColor: 'rgba(0,0,0,0.2)' + // } + // } + }), e; + }(q_) +); +function fN(r, e, t) { + if (t[0] === t[1]) + return t.slice(); + for (var n = 200, i = (t[1] - t[0]) / n, a = t[0], o = [], s = 0; s <= n && a < t[1]; s++) + o.push(a), a += i; + return o.push(t[1]), o; +} +const bme = _me; +var xme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t.autoPositionValues = { + left: 1, + right: 1, + top: 1, + bottom: 1 + }, t; + } + return e.prototype.init = function(t, n) { + this.ecModel = t, this.api = n; + }, e.prototype.render = function(t, n, i, a) { + if (this.visualMapModel = t, t.get("show") === !1) { + this.group.removeAll(); + return; + } + this.doRender(t, n, i, a); + }, e.prototype.renderBackground = function(t) { + var n = this.visualMapModel, i = of(n.get("padding") || 0), a = t.getBoundingRect(); + t.add(new Or({ + z2: -1, + silent: !0, + shape: { + x: a.x - i[3], + y: a.y - i[0], + width: a.width + i[3] + i[1], + height: a.height + i[0] + i[2] + }, + style: { + fill: n.get("backgroundColor"), + stroke: n.get("borderColor"), + lineWidth: n.get("borderWidth") + } + })); + }, e.prototype.getControllerVisual = function(t, n, i) { + i = i || {}; + var a = i.forceState, o = this.visualMapModel, s = {}; + if (n === "color") { + var l = o.get("contentColor"); + s.color = l; + } + function u(v) { + return s[v]; + } + function c(v, b) { + s[v] = b; + } + var h = o.controllerVisuals[a || o.getValueState(t)], f = Wi.prepareVisualTypes(h); + return X(f, function(v) { + var b = h[v]; + i.convertOpacityToAlpha && v === "opacity" && (v = "colorAlpha", b = h.__alphaForOpacity), Wi.dependsOn(v, n) && b && b.applyVisual(t, u, c); + }), s[n]; + }, e.prototype.positionGroup = function(t) { + var n = this.visualMapModel, i = this.api; + Xb(t, n.getBoxLayoutParams(), { + width: i.getWidth(), + height: i.getHeight() + }); + }, e.prototype.doRender = function(t, n, i, a) { + }, e.type = "visualMap", e; + }(Sn) +); +const xV = xme; +var dN = [["left", "right", "width"], ["top", "bottom", "height"]]; +function SV(r, e, t) { + var n = r.option, i = n.align; + if (i != null && i !== "auto") + return i; + for (var a = { + width: e.getWidth(), + height: e.getHeight() + }, o = n.orient === "horizontal" ? 1 : 0, s = dN[o], l = [0, null, 10], u = {}, c = 0; c < 3; c++) + u[dN[1 - o][c]] = l[c], u[s[c]] = c === 2 ? t[0] : n[s[c]]; + var h = [["x", "width", 3], ["y", "height", 0]][o], f = yi(u, a, n.padding); + return s[(f.margin[h[2]] || 0) + f[h[0]] + f[h[1]] * 0.5 < a[h[1]] * 0.5 ? 0 : 1]; +} +function Z0(r, e) { + return X(r || [], function(t) { + t.dataIndex != null && (t.dataIndexInside = t.dataIndex, t.dataIndex = null), t.highlightKey = "visualMap" + (e ? e.componentIndex : ""); + }), r; +} +var hl = Zr, Sme = X, vN = Math.min, bC = Math.max, wme = 12, Cme = 6, Tme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._shapes = {}, t._dataInterval = [], t._handleEnds = [], t._hoverLinkDataIndices = [], t; + } + return e.prototype.doRender = function(t, n, i, a) { + this._api = i, (!a || a.type !== "selectDataRange" || a.from !== this.uid) && this._buildView(); + }, e.prototype._buildView = function() { + this.group.removeAll(); + var t = this.visualMapModel, n = this.group; + this._orient = t.get("orient"), this._useHandle = t.get("calculable"), this._resetInterval(), this._renderBar(n); + var i = t.get("text"); + this._renderEndsText(n, i, 0), this._renderEndsText(n, i, 1), this._updateView(!0), this.renderBackground(n), this._updateView(), this._enableHoverLinkToSeries(), this._enableHoverLinkFromSeries(), this.positionGroup(n); + }, e.prototype._renderEndsText = function(t, n, i) { + if (n) { + var a = n[1 - i]; + a = a != null ? a + "" : ""; + var o = this.visualMapModel, s = o.get("textGap"), l = o.itemSize, u = this._shapes.mainGroup, c = this._applyTransform([l[0] / 2, i === 0 ? -s : l[1] + s], u), h = this._applyTransform(i === 0 ? "bottom" : "top", u), f = this._orient, v = this.visualMapModel.textStyleModel; + this.group.add(new kr({ + style: gn(v, { + x: c[0], + y: c[1], + verticalAlign: f === "horizontal" ? "middle" : h, + align: f === "horizontal" ? h : "center", + text: a + }) + })); + } + }, e.prototype._renderBar = function(t) { + var n = this.visualMapModel, i = this._shapes, a = n.itemSize, o = this._orient, s = this._useHandle, l = SV(n, this.api, a), u = i.mainGroup = this._createBarGroup(l), c = new Rt(); + u.add(c), c.add(i.outOfRange = pN()), c.add(i.inRange = pN(null, s ? mN(this._orient) : null, ft(this._dragHandle, this, "all", !1), ft(this._dragHandle, this, "all", !0))), c.setClipPath(new Or({ + shape: { + x: 0, + y: 0, + width: a[0], + height: a[1], + r: 3 + } + })); + var h = n.textStyleModel.getTextRect("国"), f = bC(h.width, h.height); + s && (i.handleThumbs = [], i.handleLabels = [], i.handleLabelPoints = [], this._createHandle(n, u, 0, a, f, o), this._createHandle(n, u, 1, a, f, o)), this._createIndicator(n, u, a, f, o), t.add(u); + }, e.prototype._createHandle = function(t, n, i, a, o, s) { + var l = ft(this._dragHandle, this, i, !1), u = ft(this._dragHandle, this, i, !0), c = Fs(t.get("handleSize"), a[0]), h = li(t.get("handleIcon"), -c / 2, -c / 2, c, c, null, !0), f = mN(this._orient); + h.attr({ + cursor: f, + draggable: !0, + drift: l, + ondragend: u, + onmousemove: function(d) { + eu(d.event); + } + }), h.x = a[0] / 2, h.useStyle(t.getModel("handleStyle").getItemStyle()), h.setStyle({ + strokeNoScale: !0, + strokeFirst: !0 + }), h.style.lineWidth *= 2, h.ensureState("emphasis").style = t.getModel(["emphasis", "handleStyle"]).getItemStyle(), Ah(h, !0), n.add(h); + var v = this.visualMapModel.textStyleModel, b = new kr({ + cursor: f, + draggable: !0, + drift: l, + onmousemove: function(d) { + eu(d.event); + }, + ondragend: u, + style: gn(v, { + x: 0, + y: 0, + text: "" + }) + }); + b.ensureState("blur").style = { + opacity: 0.1 + }, b.stateTransition = { + duration: 200 + }, this.group.add(b); + var w = [c, 0], p = this._shapes; + p.handleThumbs[i] = h, p.handleLabelPoints[i] = w, p.handleLabels[i] = b; + }, e.prototype._createIndicator = function(t, n, i, a, o) { + var s = Fs(t.get("indicatorSize"), i[0]), l = li(t.get("indicatorIcon"), -s / 2, -s / 2, s, s, null, !0); + l.attr({ + cursor: "move", + invisible: !0, + silent: !0, + x: i[0] / 2 + }); + var u = t.getModel("indicatorStyle").getItemStyle(); + if (l instanceof ji) { + var c = l.style; + l.useStyle(Fe({ + // TODO other properties like x, y ? + image: c.image, + x: c.x, + y: c.y, + width: c.width, + height: c.height + }, u)); + } else + l.useStyle(u); + n.add(l); + var h = this.visualMapModel.textStyleModel, f = new kr({ + silent: !0, + invisible: !0, + style: gn(h, { + x: 0, + y: 0, + text: "" + }) + }); + this.group.add(f); + var v = [(o === "horizontal" ? a / 2 : Cme) + i[0] / 2, 0], b = this._shapes; + b.indicator = l, b.indicatorLabel = f, b.indicatorLabelPoint = v, this._firstShowIndicator = !0; + }, e.prototype._dragHandle = function(t, n, i, a) { + if (this._useHandle) { + if (this._dragging = !n, !n) { + var o = this._applyTransform([i, a], this._shapes.mainGroup, !0); + this._updateInterval(t, o[1]), this._hideIndicator(), this._updateView(); + } + n === !this.visualMapModel.get("realtime") && this.api.dispatchAction({ + type: "selectDataRange", + from: this.uid, + visualMapId: this.visualMapModel.id, + selected: this._dataInterval.slice() + }), n ? !this._hovering && this._clearHoverLinkToSeries() : gN(this.visualMapModel) && this._doHoverLinkToSeries(this._handleEnds[t], !1); + } + }, e.prototype._resetInterval = function() { + var t = this.visualMapModel, n = this._dataInterval = t.getSelected(), i = t.getExtent(), a = [0, t.itemSize[1]]; + this._handleEnds = [hl(n[0], i, a, !0), hl(n[1], i, a, !0)]; + }, e.prototype._updateInterval = function(t, n) { + n = n || 0; + var i = this.visualMapModel, a = this._handleEnds, o = [0, i.itemSize[1]]; + cf( + n, + a, + o, + t, + // cross is forbidden + 0 + ); + var s = i.getExtent(); + this._dataInterval = [hl(a[0], o, s, !0), hl(a[1], o, s, !0)]; + }, e.prototype._updateView = function(t) { + var n = this.visualMapModel, i = n.getExtent(), a = this._shapes, o = [0, n.itemSize[1]], s = t ? o : this._handleEnds, l = this._createBarVisual(this._dataInterval, i, s, "inRange"), u = this._createBarVisual(i, i, o, "outOfRange"); + a.inRange.setStyle({ + fill: l.barColor + // opacity: visualInRange.opacity + }).setShape("points", l.barPoints), a.outOfRange.setStyle({ + fill: u.barColor + // opacity: visualOutOfRange.opacity + }).setShape("points", u.barPoints), this._updateHandle(s, l); + }, e.prototype._createBarVisual = function(t, n, i, a) { + var o = { + forceState: a, + convertOpacityToAlpha: !0 + }, s = this._makeColorGradient(t, o), l = [this.getControllerVisual(t[0], "symbolSize", o), this.getControllerVisual(t[1], "symbolSize", o)], u = this._createBarPoints(i, l); + return { + barColor: new Jd(0, 0, 0, 1, s), + barPoints: u, + handlesColor: [s[0].color, s[s.length - 1].color] + }; + }, e.prototype._makeColorGradient = function(t, n) { + var i = 100, a = [], o = (t[1] - t[0]) / i; + a.push({ + color: this.getControllerVisual(t[0], "color", n), + offset: 0 + }); + for (var s = 1; s < i; s++) { + var l = t[0] + o * s; + if (l > t[1]) + break; + a.push({ + color: this.getControllerVisual(l, "color", n), + offset: s / i + }); + } + return a.push({ + color: this.getControllerVisual(t[1], "color", n), + offset: 1 + }), a; + }, e.prototype._createBarPoints = function(t, n) { + var i = this.visualMapModel.itemSize; + return [[i[0] - n[0], t[0]], [i[0], t[0]], [i[0], t[1]], [i[0] - n[1], t[1]]]; + }, e.prototype._createBarGroup = function(t) { + var n = this._orient, i = this.visualMapModel.get("inverse"); + return new Rt(n === "horizontal" && !i ? { + scaleX: t === "bottom" ? 1 : -1, + rotation: Math.PI / 2 + } : n === "horizontal" && i ? { + scaleX: t === "bottom" ? -1 : 1, + rotation: -Math.PI / 2 + } : n === "vertical" && !i ? { + scaleX: t === "left" ? 1 : -1, + scaleY: -1 + } : { + scaleX: t === "left" ? 1 : -1 + }); + }, e.prototype._updateHandle = function(t, n) { + if (this._useHandle) { + var i = this._shapes, a = this.visualMapModel, o = i.handleThumbs, s = i.handleLabels, l = a.itemSize, u = a.getExtent(); + Sme([0, 1], function(c) { + var h = o[c]; + h.setStyle("fill", n.handlesColor[c]), h.y = t[c]; + var f = hl(t[c], [0, l[1]], u, !0), v = this.getControllerVisual(f, "symbolSize"); + h.scaleX = h.scaleY = v / l[0], h.x = l[0] - v / 2; + var b = zs(i.handleLabelPoints[c], oc(h, this.group)); + s[c].setStyle({ + x: b[0], + y: b[1], + text: a.formatValueText(this._dataInterval[c]), + verticalAlign: "middle", + align: this._orient === "vertical" ? this._applyTransform("left", i.mainGroup) : "center" + }); + }, this); + } + }, e.prototype._showIndicator = function(t, n, i, a) { + var o = this.visualMapModel, s = o.getExtent(), l = o.itemSize, u = [0, l[1]], c = this._shapes, h = c.indicator; + if (h) { + h.attr("invisible", !1); + var f = { + convertOpacityToAlpha: !0 + }, v = this.getControllerVisual(t, "color", f), b = this.getControllerVisual(t, "symbolSize"), w = hl(t, s, u, !0), p = l[0] - b / 2, d = { + x: h.x, + y: h.y + }; + h.y = w, h.x = p; + var m = zs(c.indicatorLabelPoint, oc(h, this.group)), _ = c.indicatorLabel; + _.attr("invisible", !1); + var y = this._applyTransform("left", c.mainGroup), x = this._orient, g = x === "horizontal"; + _.setStyle({ + text: (i || "") + o.formatValueText(n), + verticalAlign: g ? y : "middle", + align: g ? "center" : y + }); + var S = { + x: p, + y: w, + style: { + fill: v + } + }, T = { + style: { + x: m[0], + y: m[1] + } + }; + if (o.ecModel.isAnimationEnabled() && !this._firstShowIndicator) { + var C = { + duration: 100, + easing: "cubicInOut", + additive: !0 + }; + h.x = d.x, h.y = d.y, h.animateTo(S, C), _.animateTo(T, C); + } else + h.attr(S), _.attr(T); + this._firstShowIndicator = !1; + var E = this._shapes.handleLabels; + if (E) + for (var M = 0; M < E.length; M++) + this._api.enterBlur(E[M]); + } + }, e.prototype._enableHoverLinkToSeries = function() { + var t = this; + this._shapes.mainGroup.on("mousemove", function(n) { + if (t._hovering = !0, !t._dragging) { + var i = t.visualMapModel.itemSize, a = t._applyTransform([n.offsetX, n.offsetY], t._shapes.mainGroup, !0, !0); + a[1] = vN(bC(0, a[1]), i[1]), t._doHoverLinkToSeries(a[1], 0 <= a[0] && a[0] <= i[0]); + } + }).on("mouseout", function() { + t._hovering = !1, !t._dragging && t._clearHoverLinkToSeries(); + }); + }, e.prototype._enableHoverLinkFromSeries = function() { + var t = this.api.getZr(); + this.visualMapModel.option.hoverLink ? (t.on("mouseover", this._hoverLinkFromSeriesMouseOver, this), t.on("mouseout", this._hideIndicator, this)) : this._clearHoverLinkFromSeries(); + }, e.prototype._doHoverLinkToSeries = function(t, n) { + var i = this.visualMapModel, a = i.itemSize; + if (i.option.hoverLink) { + var o = [0, a[1]], s = i.getExtent(); + t = vN(bC(o[0], t), o[1]); + var l = Ime(i, s, o), u = [t - l, t + l], c = hl(t, o, s, !0), h = [hl(u[0], o, s, !0), hl(u[1], o, s, !0)]; + u[0] < o[0] && (h[0] = -1 / 0), u[1] > o[1] && (h[1] = 1 / 0), n && (h[0] === -1 / 0 ? this._showIndicator(c, h[1], "< ", l) : h[1] === 1 / 0 ? this._showIndicator(c, h[0], "> ", l) : this._showIndicator(c, c, "≈ ", l)); + var f = this._hoverLinkDataIndices, v = []; + (n || gN(i)) && (v = this._hoverLinkDataIndices = i.findTargetDataIndices(h)); + var b = CZ(f, v); + this._dispatchHighDown("downplay", Z0(b[0], i)), this._dispatchHighDown("highlight", Z0(b[1], i)); + } + }, e.prototype._hoverLinkFromSeriesMouseOver = function(t) { + var n; + if (Mh(t.target, function(l) { + var u = Ft(l); + if (u.dataIndex != null) + return n = u, !0; + }, !0), !!n) { + var i = this.ecModel.getSeriesByIndex(n.seriesIndex), a = this.visualMapModel; + if (a.isTargetSeries(i)) { + var o = i.getData(n.dataType), s = o.getStore().get(a.getDataDimensionIndex(o), n.dataIndex); + isNaN(s) || this._showIndicator(s, s); + } + } + }, e.prototype._hideIndicator = function() { + var t = this._shapes; + t.indicator && t.indicator.attr("invisible", !0), t.indicatorLabel && t.indicatorLabel.attr("invisible", !0); + var n = this._shapes.handleLabels; + if (n) + for (var i = 0; i < n.length; i++) + this._api.leaveBlur(n[i]); + }, e.prototype._clearHoverLinkToSeries = function() { + this._hideIndicator(); + var t = this._hoverLinkDataIndices; + this._dispatchHighDown("downplay", Z0(t, this.visualMapModel)), t.length = 0; + }, e.prototype._clearHoverLinkFromSeries = function() { + this._hideIndicator(); + var t = this.api.getZr(); + t.off("mouseover", this._hoverLinkFromSeriesMouseOver), t.off("mouseout", this._hideIndicator); + }, e.prototype._applyTransform = function(t, n, i, a) { + var o = oc(n, a ? null : this.group); + return We(t) ? zs(t, o, i) : $b(t, o, i); + }, e.prototype._dispatchHighDown = function(t, n) { + n && n.length && this.api.dispatchAction({ + type: t, + batch: n + }); + }, e.prototype.dispose = function() { + this._clearHoverLinkFromSeries(), this._clearHoverLinkToSeries(); + }, e.prototype.remove = function() { + this._clearHoverLinkFromSeries(), this._clearHoverLinkToSeries(); + }, e.type = "visualMap.continuous", e; + }(xV) +); +function pN(r, e, t, n) { + return new La({ + shape: { + points: r + }, + draggable: !!t, + cursor: e, + drift: t, + onmousemove: function(i) { + eu(i.event); + }, + ondragend: n + }); +} +function Ime(r, e, t) { + var n = wme / 2, i = r.get("hoverLinkDataSize"); + return i && (n = hl(i, e, t, !0) / 2), n; +} +function gN(r) { + var e = r.get("hoverLinkOnHandle"); + return !!(e == null ? r.get("realtime") : e); +} +function mN(r) { + return r === "vertical" ? "ns-resize" : "ew-resize"; +} +const Ame = Tme; +var Eme = { + type: "selectDataRange", + event: "dataRangeSelected", + // FIXME use updateView appears wrong + update: "update" +}, Mme = function(r, e) { + e.eachComponent({ + mainType: "visualMap", + query: r + }, function(t) { + t.setSelected(r.selected); + }); +}, Dme = [ + { + createOnAllSeries: !0, + reset: function(r, e) { + var t = []; + return e.eachComponent("visualMap", function(n) { + var i = r.pipelineContext; + !n.isTargetSeries(r) || i && i.large || t.push(Cpe(n.stateList, n.targetVisuals, ft(n.getValueState, n), n.getDataDimensionIndex(r.getData()))); + }), t; + } + }, + // Only support color. + { + createOnAllSeries: !0, + reset: function(r, e) { + var t = r.getData(), n = []; + e.eachComponent("visualMap", function(i) { + if (i.isTargetSeries(r)) { + var a = i.getVisualMeta(ft(kme, null, r, i)) || { + stops: [], + outerColors: [] + }, o = i.getDataDimensionIndex(t); + o >= 0 && (a.dimension = o, n.push(a)); + } + }), r.getData().setVisual("visualMeta", n); + } + } +]; +function kme(r, e, t, n) { + for (var i = e.targetVisuals[n], a = Wi.prepareVisualTypes(i), o = { + color: im(r.getData(), "color") + // default color. + }, s = 0, l = a.length; s < l; s++) { + var u = a[s], c = i[u === "opacity" ? "__alphaForOpacity" : u]; + c && c.applyVisual(t, h, f); + } + return o.color; + function h(v) { + return o[v]; + } + function f(v, b) { + o[v] = b; + } +} +var yN = X; +function Ome(r) { + var e = r && r.visualMap; + We(e) || (e = e ? [e] : []), yN(e, function(t) { + if (t) { + td(t, "splitList") && !td(t, "pieces") && (t.pieces = t.splitList, delete t.splitList); + var n = t.pieces; + n && We(n) && yN(n, function(i) { + kt(i) && (td(i, "start") && !td(i, "min") && (i.min = i.start), td(i, "end") && !td(i, "max") && (i.max = i.end)); + }); + } + }); +} +function td(r, e) { + return r && r.hasOwnProperty && r.hasOwnProperty(e); +} +var _N = !1; +function wV(r) { + _N || (_N = !0, r.registerSubTypeDefaulter("visualMap", function(e) { + return !e.categories && (!(e.pieces ? e.pieces.length > 0 : e.splitNumber > 0) || e.calculable) ? "continuous" : "piecewise"; + }), r.registerAction(Eme, Mme), X(Dme, function(e) { + r.registerVisual(r.PRIORITY.VISUAL.COMPONENT, e); + }), r.registerPreprocessor(Ome)); +} +function CV(r) { + r.registerComponentModel(bme), r.registerComponentView(Ame), wV(r); +} +var Lme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t._pieceList = [], t; + } + return e.prototype.optionUpdated = function(t, n) { + r.prototype.optionUpdated.apply(this, arguments), this.resetExtent(); + var i = this._mode = this._determineMode(); + this._pieceList = [], Pme[this._mode].call(this, this._pieceList), this._resetSelected(t, n); + var a = this.option.categories; + this.resetVisual(function(o, s) { + i === "categories" ? (o.mappingMethod = "category", o.categories = Ot(a)) : (o.dataExtent = this.getExtent(), o.mappingMethod = "piecewise", o.pieceList = Ke(this._pieceList, function(l) { + return l = Ot(l), s !== "inRange" && (l.visual = null), l; + })); + }); + }, e.prototype.completeVisualOption = function() { + var t = this.option, n = {}, i = Wi.listVisualTypes(), a = this.isCategory(); + X(t.pieces, function(s) { + X(i, function(l) { + s.hasOwnProperty(l) && (n[l] = 1); + }); + }), X(n, function(s, l) { + var u = !1; + X(this.stateList, function(c) { + u = u || o(t, c, l) || o(t.target, c, l); + }, this), !u && X(this.stateList, function(c) { + (t[c] || (t[c] = {}))[l] = bV.get(l, c === "inRange" ? "active" : "inactive", a); + }); + }, this); + function o(s, l, u) { + return s && s[l] && s[l].hasOwnProperty(u); + } + r.prototype.completeVisualOption.apply(this, arguments); + }, e.prototype._resetSelected = function(t, n) { + var i = this.option, a = this._pieceList, o = (n ? i : t).selected || {}; + if (i.selected = o, X(a, function(l, u) { + var c = this.getSelectedMapKey(l); + o.hasOwnProperty(c) || (o[c] = !0); + }, this), i.selectedMode === "single") { + var s = !1; + X(a, function(l, u) { + var c = this.getSelectedMapKey(l); + o[c] && (s ? o[c] = !1 : s = !0); + }, this); + } + }, e.prototype.getItemSymbol = function() { + return this.get("itemSymbol"); + }, e.prototype.getSelectedMapKey = function(t) { + return this._mode === "categories" ? t.value + "" : t.index + ""; + }, e.prototype.getPieceList = function() { + return this._pieceList; + }, e.prototype._determineMode = function() { + var t = this.option; + return t.pieces && t.pieces.length > 0 ? "pieces" : this.option.categories ? "categories" : "splitNumber"; + }, e.prototype.setSelected = function(t) { + this.option.selected = Ot(t); + }, e.prototype.getValueState = function(t) { + var n = Wi.findPieceIndex(t, this._pieceList); + return n != null && this.option.selected[this.getSelectedMapKey(this._pieceList[n])] ? "inRange" : "outOfRange"; + }, e.prototype.findTargetDataIndices = function(t) { + var n = [], i = this._pieceList; + return this.eachTargetSeries(function(a) { + var o = [], s = a.getData(); + s.each(this.getDataDimensionIndex(s), function(l, u) { + var c = Wi.findPieceIndex(l, i); + c === t && o.push(u); + }, this), n.push({ + seriesId: a.id, + dataIndex: o + }); + }, this), n; + }, e.prototype.getRepresentValue = function(t) { + var n; + if (this.isCategory()) + n = t.value; + else if (t.value != null) + n = t.value; + else { + var i = t.interval || []; + n = i[0] === -1 / 0 && i[1] === 1 / 0 ? 0 : (i[0] + i[1]) / 2; + } + return n; + }, e.prototype.getVisualMeta = function(t) { + if (this.isCategory()) + return; + var n = [], i = ["", ""], a = this; + function o(c, h) { + var f = a.getRepresentValue({ + interval: c + }); + h || (h = a.getValueState(f)); + var v = t(f, h); + c[0] === -1 / 0 ? i[0] = v : c[1] === 1 / 0 ? i[1] = v : n.push({ + value: c[0], + color: v + }, { + value: c[1], + color: v + }); + } + var s = this._pieceList.slice(); + if (!s.length) + s.push({ + interval: [-1 / 0, 1 / 0] + }); + else { + var l = s[0].interval[0]; + l !== -1 / 0 && s.unshift({ + interval: [-1 / 0, l] + }), l = s[s.length - 1].interval[1], l !== 1 / 0 && s.push({ + interval: [l, 1 / 0] + }); + } + var u = -1 / 0; + return X(s, function(c) { + var h = c.interval; + h && (h[0] > u && o([u, h[0]], "outOfRange"), o(h.slice()), u = h[1]); + }, this), { + stops: n, + outerColors: i + }; + }, e.type = "visualMap.piecewise", e.defaultOption = Tc(q_.defaultOption, { + selected: null, + minOpen: !1, + maxOpen: !1, + align: "auto", + itemWidth: 20, + itemHeight: 14, + itemSymbol: "roundRect", + pieces: null, + categories: null, + splitNumber: 5, + selectedMode: "multiple", + itemGap: 10, + hoverLink: !0 + // Enable hover highlight. + }), e; + }(q_) +), Pme = { + splitNumber: function(r) { + var e = this.option, t = Math.min(e.precision, 20), n = this.getExtent(), i = e.splitNumber; + i = Math.max(parseInt(i, 10), 1), e.splitNumber = i; + for (var a = (n[1] - n[0]) / i; +a.toFixed(t) !== a && t < 5; ) + t++; + e.precision = t, a = +a.toFixed(t), e.minOpen && r.push({ + interval: [-1 / 0, n[0]], + close: [0, 0] + }); + for (var o = 0, s = n[0]; o < i; s += a, o++) { + var l = o === i - 1 ? n[1] : s + a; + r.push({ + interval: [s, l], + close: [1, 1] + }); + } + e.maxOpen && r.push({ + interval: [n[1], 1 / 0], + close: [0, 0] + }), A1(r), X(r, function(u, c) { + u.index = c, u.text = this.formatValueText(u.interval); + }, this); + }, + categories: function(r) { + var e = this.option; + X(e.categories, function(t) { + r.push({ + text: this.formatValueText(t, !0), + value: t + }); + }, this), bN(e, r); + }, + pieces: function(r) { + var e = this.option; + X(e.pieces, function(t, n) { + kt(t) || (t = { + value: t + }); + var i = { + text: "", + index: n + }; + if (t.label != null && (i.text = t.label), t.hasOwnProperty("value")) { + var a = i.value = t.value; + i.interval = [a, a], i.close = [1, 1]; + } else { + for (var o = i.interval = [], s = i.close = [0, 0], l = [1, 0, 1], u = [-1 / 0, 1 / 0], c = [], h = 0; h < 2; h++) { + for (var f = [["gte", "gt", "min"], ["lte", "lt", "max"]][h], v = 0; v < 3 && o[h] == null; v++) + o[h] = t[f[v]], s[h] = l[v], c[h] = v === 2; + o[h] == null && (o[h] = u[h]); + } + c[0] && o[1] === 1 / 0 && (s[0] = 0), c[1] && o[0] === -1 / 0 && (s[1] = 0), o[0] === o[1] && s[0] && s[1] && (i.value = o[0]); + } + i.visual = Wi.retrieveVisuals(t), r.push(i); + }, this), bN(e, r), A1(r), X(r, function(t) { + var n = t.close, i = [["<", "≤"][n[1]], [">", "≥"][n[0]]]; + t.text = t.text || this.formatValueText(t.value != null ? t.value : t.interval, !1, i); + }, this); + } +}; +function bN(r, e) { + var t = r.inverse; + (r.orient === "vertical" ? !t : t) && e.reverse(); +} +const Rme = Lme; +var Nme = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = e.type, t; + } + return e.prototype.doRender = function() { + var t = this.group; + t.removeAll(); + var n = this.visualMapModel, i = n.get("textGap"), a = n.textStyleModel, o = a.getFont(), s = a.getTextColor(), l = this._getItemAlign(), u = n.itemSize, c = this._getViewData(), h = c.endsText, f = Ii(n.get("showLabel", !0), !h); + h && this._renderEndsText(t, h[0], u, f, l), X(c.viewPieceList, function(v) { + var b = v.piece, w = new Rt(); + w.onclick = ft(this._onItemClick, this, b), this._enableHoverLink(w, v.indexInModelPieceList); + var p = n.getRepresentValue(b); + if (this._createItemSymbol(w, p, [0, 0, u[0], u[1]]), f) { + var d = this.visualMapModel.getValueState(p); + w.add(new kr({ + style: { + x: l === "right" ? -i : u[0] + i, + y: u[1] / 2, + text: b.text, + verticalAlign: "middle", + align: l, + font: o, + fill: s, + opacity: d === "outOfRange" ? 0.5 : 1 + } + })); + } + t.add(w); + }, this), h && this._renderEndsText(t, h[1], u, f, l), Nh(n.get("orient"), t, n.get("itemGap")), this.renderBackground(t), this.positionGroup(t); + }, e.prototype._enableHoverLink = function(t, n) { + var i = this; + t.on("mouseover", function() { + return a("highlight"); + }).on("mouseout", function() { + return a("downplay"); + }); + var a = function(o) { + var s = i.visualMapModel; + s.option.hoverLink && i.api.dispatchAction({ + type: o, + batch: Z0(s.findTargetDataIndices(n), s) + }); + }; + }, e.prototype._getItemAlign = function() { + var t = this.visualMapModel, n = t.option; + if (n.orient === "vertical") + return SV(t, this.api, t.itemSize); + var i = n.align; + return (!i || i === "auto") && (i = "left"), i; + }, e.prototype._renderEndsText = function(t, n, i, a, o) { + if (n) { + var s = new Rt(), l = this.visualMapModel.textStyleModel; + s.add(new kr({ + style: gn(l, { + x: a ? o === "right" ? i[0] : 0 : i[0] / 2, + y: i[1] / 2, + verticalAlign: "middle", + align: a ? o : "center", + text: n + }) + })), t.add(s); + } + }, e.prototype._getViewData = function() { + var t = this.visualMapModel, n = Ke(t.getPieceList(), function(s, l) { + return { + piece: s, + indexInModelPieceList: l + }; + }), i = t.get("text"), a = t.get("orient"), o = t.get("inverse"); + return (a === "horizontal" ? o : !o) ? n.reverse() : i && (i = i.slice().reverse()), { + viewPieceList: n, + endsText: i + }; + }, e.prototype._createItemSymbol = function(t, n, i) { + t.add(li( + // symbol will be string + this.getControllerVisual(n, "symbol"), + i[0], + i[1], + i[2], + i[3], + // color will be string + this.getControllerVisual(n, "color") + )); + }, e.prototype._onItemClick = function(t) { + var n = this.visualMapModel, i = n.option, a = i.selectedMode; + if (a) { + var o = Ot(i.selected), s = n.getSelectedMapKey(t); + a === "single" || a === !0 ? (o[s] = !0, X(o, function(l, u) { + o[u] = u === s; + })) : o[s] = !o[s], this.api.dispatchAction({ + type: "selectDataRange", + from: this.uid, + visualMapId: this.visualMapModel.id, + selected: o + }); + } + }, e.type = "visualMap.piecewise", e; + }(xV) +); +const zme = Nme; +function TV(r) { + r.registerComponentModel(Rme), r.registerComponentView(zme), wV(r); +} +function Bme(r) { + Kt(CV), Kt(TV); +} +var jme = { + label: { + enabled: !0 + }, + decal: { + show: !1 + } +}, xN = Rr(), Fme = {}; +function $me(r, e) { + var t = r.getModel("aria"); + if (!t.get("enabled")) + return; + var n = Ot(jme); + Ut(n.label, r.getLocaleModel().get("aria"), !1), Ut(t.option, n, !1), i(), a(); + function i() { + var u = t.getModel("decal"), c = u.get("show"); + if (c) { + var h = xt(); + r.eachSeries(function(f) { + if (!f.isColorBySeries()) { + var v = h.get(f.type); + v || (v = {}, h.set(f.type, v)), xN(f).scope = v; + } + }), r.eachRawSeries(function(f) { + if (r.isSeriesFiltered(f)) + return; + if (Tt(f.enableAriaDecal)) { + f.enableAriaDecal(); + return; + } + var v = f.getData(); + if (f.isColorBySeries()) { + var m = V1(f.ecModel, f.name, Fme, r.getSeriesCount()), _ = v.getVisual("decal"); + v.setVisual("decal", y(_, m)); + } else { + var b = f.getRawData(), w = {}, p = xN(f).scope; + v.each(function(x) { + var g = v.getRawIndex(x); + w[g] = x; + }); + var d = b.count(); + b.each(function(x) { + var g = w[x], S = b.getName(x) || x + "", T = V1(f.ecModel, S, p, d), C = v.getItemVisual(g, "decal"); + v.setItemVisual(g, "decal", y(C, T)); + }); + } + function y(x, g) { + var S = x ? Fe(Fe({}, g), x) : g; + return S.dirty = !0, S; + } + }); + } + } + function a() { + var u = r.getLocaleModel().get("aria"), c = t.getModel("label"); + if (c.option = Mt(c.option, u), !!c.get("enabled")) { + var h = e.getZr().dom; + if (c.get("description")) { + h.setAttribute("aria-label", c.get("description")); + return; + } + var f = r.getSeriesCount(), v = c.get(["data", "maxCount"]) || 10, b = c.get(["series", "maxCount"]) || 10, w = Math.min(f, b), p; + if (!(f < 1)) { + var d = s(); + if (d) { + var m = c.get(["general", "withTitle"]); + p = o(m, { + title: d + }); + } else + p = c.get(["general", "withoutTitle"]); + var _ = [], y = f > 1 ? c.get(["series", "multiple", "prefix"]) : c.get(["series", "single", "prefix"]); + p += o(y, { + seriesCount: f + }), r.eachSeries(function(T, C) { + if (C < w) { + var E = void 0, M = T.get("name"), P = M ? "withName" : "withoutName"; + E = f > 1 ? c.get(["series", "multiple", P]) : c.get(["series", "single", P]), E = o(E, { + seriesId: T.seriesIndex, + seriesName: T.get("name"), + seriesType: l(T.subType) + }); + var R = T.getData(); + if (R.count() > v) { + var N = c.get(["data", "partialData"]); + E += o(N, { + displayCnt: v + }); + } else + E += c.get(["data", "allData"]); + for (var F = c.get(["data", "separator", "middle"]), U = c.get(["data", "separator", "end"]), $ = [], G = 0; G < R.count(); G++) + if (G < v) { + var Q = R.getName(G), ee = R.getValues(G), ce = c.get(["data", Q ? "withName" : "withoutName"]); + $.push(o(ce, { + name: Q, + value: ee.join(F) + })); + } + E += $.join(F) + U, _.push(E); + } + }); + var x = c.getModel(["series", "multiple", "separator"]), g = x.get("middle"), S = x.get("end"); + p += _.join(g) + S, h.setAttribute("aria-label", p); + } + } + } + function o(u, c) { + if (!ut(u)) + return u; + var h = u; + return X(c, function(f, v) { + h = h.replace(new RegExp("\\{\\s*" + v + "\\s*\\}", "g"), f); + }), h; + } + function s() { + var u = r.get("title"); + return u && u.length && (u = u[0]), u && u.text; + } + function l(u) { + return r.getLocaleModel().get(["series", "typeNames"])[u] || "自定义图"; + } +} +function Hme(r) { + if (!(!r || !r.aria)) { + var e = r.aria; + e.show != null && (e.enabled = e.show), e.label = e.label || {}, X(["description", "general", "series", "data"], function(t) { + e[t] != null && (e.label[t] = e[t]); + }); + } +} +function Vme(r) { + r.registerPreprocessor(Hme), r.registerVisual(r.PRIORITY.VISUAL.ARIA, $me); +} +var SN = { + value: "eq", + // PENDING: not good for literal semantic? + "<": "lt", + "<=": "lte", + ">": "gt", + ">=": "gte", + "=": "eq", + "!=": "ne", + "<>": "ne" + // Might be misleading for sake of the difference between '==' and '===', + // so don't support them. + // '==': 'eq', + // '===': 'seq', + // '!==': 'sne' + // PENDING: Whether support some common alias "ge", "le", "neq"? + // ge: 'gte', + // le: 'lte', + // neq: 'ne', +}, Gme = ( + /** @class */ + function() { + function r(e) { + var t = this._condVal = ut(e) ? new RegExp(e) : sj(e) ? e : null; + if (t == null) { + var n = ""; + Ur(n); + } + } + return r.prototype.evaluate = function(e) { + var t = typeof e; + return ut(t) ? this._condVal.test(e) : Pr(t) ? this._condVal.test(e + "") : !1; + }, r; + }() +), Ume = ( + /** @class */ + function() { + function r() { + } + return r.prototype.evaluate = function() { + return this.value; + }, r; + }() +), Wme = ( + /** @class */ + function() { + function r() { + } + return r.prototype.evaluate = function() { + for (var e = this.children, t = 0; t < e.length; t++) + if (!e[t].evaluate()) + return !1; + return !0; + }, r; + }() +), Yme = ( + /** @class */ + function() { + function r() { + } + return r.prototype.evaluate = function() { + for (var e = this.children, t = 0; t < e.length; t++) + if (e[t].evaluate()) + return !0; + return !1; + }, r; + }() +), Xme = ( + /** @class */ + function() { + function r() { + } + return r.prototype.evaluate = function() { + return !this.child.evaluate(); + }, r; + }() +), Zme = ( + /** @class */ + function() { + function r() { + } + return r.prototype.evaluate = function() { + for (var e = !!this.valueParser, t = this.getValue, n = t(this.valueGetterParam), i = e ? this.valueParser(n) : null, a = 0; a < this.subCondList.length; a++) + if (!this.subCondList[a].evaluate(e ? i : n)) + return !1; + return !0; + }, r; + }() +); +function WE(r, e) { + if (r === !0 || r === !1) { + var t = new Ume(); + return t.value = r, t; + } + var n = ""; + return IV(r) || Ur(n), r.and ? wN("and", r, e) : r.or ? wN("or", r, e) : r.not ? Jme(r, e) : Kme(r, e); +} +function wN(r, e, t) { + var n = e[r], i = ""; + We(n) || Ur(i), n.length || Ur(i); + var a = r === "and" ? new Wme() : new Yme(); + return a.children = Ke(n, function(o) { + return WE(o, t); + }), a.children.length || Ur(i), a; +} +function Jme(r, e) { + var t = r.not, n = ""; + IV(t) || Ur(n); + var i = new Xme(); + return i.child = WE(t, e), i.child || Ur(n), i; +} +function Kme(r, e) { + for (var t = "", n = e.prepareGetValue(r), i = [], a = yr(r), o = r.parser, s = o ? jF(o) : null, l = 0; l < a.length; l++) { + var u = a[l]; + if (!(u === "parser" || e.valueGetterAttrMap.get(u))) { + var c = gt(SN, u) ? SN[u] : u, h = r[u], f = s ? s(h) : h, v = zQ(c, f) || c === "reg" && new Gme(f); + v || Ur(t), i.push(v); + } + } + i.length || Ur(t); + var b = new Zme(); + return b.valueGetterParam = n, b.valueParser = s, b.getValue = e.getValue, b.subCondList = i, b; +} +function IV(r) { + return kt(r) && !Yi(r); +} +var Qme = ( + /** @class */ + function() { + function r(e, t) { + this._cond = WE(e, t); + } + return r.prototype.evaluate = function() { + return this._cond.evaluate(); + }, r; + }() +); +function qme(r, e) { + return new Qme(r, e); +} +var eye = { + type: "echarts:filter", + // PENDING: enhance to filter by index rather than create new data + transform: function(r) { + for (var e = r.upstream, t, n = qme(r.config, { + valueGetterAttrMap: xt({ + dimension: !0 + }), + prepareGetValue: function(s) { + var l = "", u = s.dimension; + gt(s, "dimension") || Ur(l); + var c = e.getDimensionInfo(u); + return c || Ur(l), { + dimIdx: c.index + }; + }, + getValue: function(s) { + return e.retrieveValueFromItem(t, s.dimIdx); + } + }), i = [], a = 0, o = e.count(); a < o; a++) + t = e.getRawDataItem(a), n.evaluate() && i.push(t); + return { + data: i + }; + } +}, tye = { + type: "echarts:sort", + transform: function(r) { + var e = r.upstream, t = r.config, n = "", i = ln(t); + i.length || Ur(n); + var a = []; + X(i, function(c) { + var h = c.dimension, f = c.order, v = c.parser, b = c.incomparable; + if (h == null && Ur(n), f !== "asc" && f !== "desc" && Ur(n), b && b !== "min" && b !== "max") { + var w = ""; + Ur(w); + } + if (f !== "asc" && f !== "desc") { + var p = ""; + Ur(p); + } + var d = e.getDimensionInfo(h); + d || Ur(n); + var m = v ? jF(v) : null; + v && !m && Ur(n), a.push({ + dimIdx: d.index, + parser: m, + comparator: new $F(f, b) + }); + }); + var o = e.sourceFormat; + o !== ga && o !== as && Ur(n); + for (var s = [], l = 0, u = e.count(); l < u; l++) + s.push(e.getRawDataItem(l)); + return s.sort(function(c, h) { + for (var f = 0; f < a.length; f++) { + var v = a[f], b = e.retrieveValueFromItem(c, v.dimIdx), w = e.retrieveValueFromItem(h, v.dimIdx); + v.parser && (b = v.parser(b), w = v.parser(w)); + var p = v.comparator.evaluate(b, w); + if (p !== 0) + return p; + } + return 0; + }), { + data: s + }; + } +}; +function rye(r) { + r.registerTransform(eye), r.registerTransform(tye); +} +var nye = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "dataset", t; + } + return e.prototype.init = function(t, n, i) { + r.prototype.init.call(this, t, n, i), this._sourceManager = new UF(this), IO(this); + }, e.prototype.mergeOption = function(t, n) { + r.prototype.mergeOption.call(this, t, n), IO(this); + }, e.prototype.optionUpdated = function() { + this._sourceManager.dirty(); + }, e.prototype.getSourceManager = function() { + return this._sourceManager; + }, e.type = "dataset", e.defaultOption = { + seriesLayoutBy: Sl + }, e; + }(xr) +), iye = ( + /** @class */ + function(r) { + Pe(e, r); + function e() { + var t = r !== null && r.apply(this, arguments) || this; + return t.type = "dataset", t; + } + return e.type = "dataset", e; + }(Sn) +); +function AV(r) { + r.registerComponentModel(nye), r.registerComponentView(iye); +} +var ul = Al.CMD; +function vd(r, e) { + return Math.abs(r - e) < 1e-5; +} +function HT(r) { + var e = r.data, t = r.len(), n = [], i, a = 0, o = 0, s = 0, l = 0; + function u(R, N) { + i && i.length > 2 && n.push(i), i = [R, N]; + } + function c(R, N, F, U) { + vd(R, F) && vd(N, U) || i.push(R, N, F, U, F, U); + } + function h(R, N, F, U, $, G) { + var Q = Math.abs(N - R), ee = Math.tan(Q / 4) * 4 / 3, ce = N < R ? -1 : 1, ne = Math.cos(R), fe = Math.sin(R), K = Math.cos(N), Oe = Math.sin(N), xe = ne * $ + F, Ge = fe * G + U, oe = K * $ + F, de = Oe * G + U, se = $ * ee * ce, te = G * ee * ce; + i.push(xe - se * fe, Ge + te * ne, oe + se * Oe, de - te * K, oe, de); + } + for (var f, v, b, w, p = 0; p < t; ) { + var d = e[p++], m = p === 1; + switch (m && (a = e[p], o = e[p + 1], s = a, l = o, (d === ul.L || d === ul.C || d === ul.Q) && (i = [s, l])), d) { + case ul.M: + a = s = e[p++], o = l = e[p++], u(s, l); + break; + case ul.L: + f = e[p++], v = e[p++], c(a, o, f, v), a = f, o = v; + break; + case ul.C: + i.push(e[p++], e[p++], e[p++], e[p++], a = e[p++], o = e[p++]); + break; + case ul.Q: + f = e[p++], v = e[p++], b = e[p++], w = e[p++], i.push(a + 2 / 3 * (f - a), o + 2 / 3 * (v - o), b + 2 / 3 * (f - b), w + 2 / 3 * (v - w), b, w), a = b, o = w; + break; + case ul.A: + var _ = e[p++], y = e[p++], x = e[p++], g = e[p++], S = e[p++], T = e[p++] + S; + p += 1; + var C = !e[p++]; + f = Math.cos(S) * x + _, v = Math.sin(S) * g + y, m ? (s = f, l = v, u(s, l)) : c(a, o, f, v), a = Math.cos(T) * x + _, o = Math.sin(T) * g + y; + for (var E = (C ? -1 : 1) * Math.PI / 2, M = S; C ? M > T : M < T; M += E) { + var P = C ? Math.max(M + E, T) : Math.min(M + E, T); + h(M, P, _, y, x, g); + } + break; + case ul.R: + s = a = e[p++], l = o = e[p++], f = s + e[p++], v = l + e[p++], u(f, l), c(f, l, f, v), c(f, v, s, v), c(s, v, s, l), c(s, l, f, l); + break; + case ul.Z: + i && c(a, o, s, l), a = s, o = l; + break; + } + } + return i && i.length > 2 && n.push(i), n; +} +function VT(r, e, t, n, i, a, o, s, l, u) { + if (vd(r, t) && vd(e, n) && vd(i, o) && vd(a, s)) { + l.push(o, s); + return; + } + var c = 2 / u, h = c * c, f = o - r, v = s - e, b = Math.sqrt(f * f + v * v); + f /= b, v /= b; + var w = t - r, p = n - e, d = i - o, m = a - s, _ = w * w + p * p, y = d * d + m * m; + if (_ < h && y < h) { + l.push(o, s); + return; + } + var x = f * w + v * p, g = -f * d - v * m, S = _ - x * x, T = y - g * g; + if (S < h && x >= 0 && T < h && g >= 0) { + l.push(o, s); + return; + } + var C = [], E = []; + fc(r, t, i, o, 0.5, C), fc(e, n, a, s, 0.5, E), VT(C[0], E[0], C[1], E[1], C[2], E[2], C[3], E[3], l, u), VT(C[4], E[4], C[5], E[5], C[6], E[6], C[7], E[7], l, u); +} +function aye(r, e) { + var t = HT(r), n = []; + e = e || 1; + for (var i = 0; i < t.length; i++) { + var a = t[i], o = [], s = a[0], l = a[1]; + o.push(s, l); + for (var u = 2; u < a.length; ) { + var c = a[u++], h = a[u++], f = a[u++], v = a[u++], b = a[u++], w = a[u++]; + VT(s, l, c, h, f, v, b, w, o, e), s = b, l = w; + } + n.push(o); + } + return n; +} +function EV(r, e, t) { + var n = r[e], i = r[1 - e], a = Math.abs(n / i), o = Math.ceil(Math.sqrt(a * t)), s = Math.floor(t / o); + s === 0 && (s = 1, o = t); + for (var l = [], u = 0; u < o; u++) + l.push(s); + var c = o * s, h = t - c; + if (h > 0) + for (var u = 0; u < h; u++) + l[u % o] += 1; + return l; +} +function CN(r, e, t) { + for (var n = r.r0, i = r.r, a = r.startAngle, o = r.endAngle, s = Math.abs(o - a), l = s * i, u = i - n, c = l > Math.abs(u), h = EV([l, u], c ? 0 : 1, e), f = (c ? s : u) / h.length, v = 0; v < h.length; v++) + for (var b = (c ? u : s) / h[v], w = 0; w < h[v]; w++) { + var p = {}; + c ? (p.startAngle = a + f * v, p.endAngle = a + f * (v + 1), p.r0 = n + b * w, p.r = n + b * (w + 1)) : (p.startAngle = a + b * w, p.endAngle = a + b * (w + 1), p.r0 = n + f * v, p.r = n + f * (v + 1)), p.clockwise = r.clockwise, p.cx = r.cx, p.cy = r.cy, t.push(p); + } +} +function oye(r, e, t) { + for (var n = r.width, i = r.height, a = n > i, o = EV([n, i], a ? 0 : 1, e), s = a ? "width" : "height", l = a ? "height" : "width", u = a ? "x" : "y", c = a ? "y" : "x", h = r[s] / o.length, f = 0; f < o.length; f++) + for (var v = r[l] / o[f], b = 0; b < o[f]; b++) { + var w = {}; + w[u] = f * h, w[c] = b * v, w[s] = h, w[l] = v, w.x += r.x, w.y += r.y, t.push(w); + } +} +function TN(r, e, t, n) { + return r * n - t * e; +} +function sye(r, e, t, n, i, a, o, s) { + var l = t - r, u = n - e, c = o - i, h = s - a, f = TN(c, h, l, u); + if (Math.abs(f) < 1e-6) + return null; + var v = r - i, b = e - a, w = TN(v, b, c, h) / f; + return w < 0 || w > 1 ? null : new Zt(w * l + r, w * u + e); +} +function lye(r, e, t) { + var n = new Zt(); + Zt.sub(n, t, e), n.normalize(); + var i = new Zt(); + Zt.sub(i, r, e); + var a = i.dot(n); + return a; +} +function rd(r, e) { + var t = r[r.length - 1]; + t && t[0] === e[0] && t[1] === e[1] || r.push(e); +} +function uye(r, e, t) { + for (var n = r.length, i = [], a = 0; a < n; a++) { + var o = r[a], s = r[(a + 1) % n], l = sye(o[0], o[1], s[0], s[1], e.x, e.y, t.x, t.y); + l && i.push({ + projPt: lye(l, e, t), + pt: l, + idx: a + }); + } + if (i.length < 2) + return [{ points: r }, { points: r }]; + i.sort(function(p, d) { + return p.projPt - d.projPt; + }); + var u = i[0], c = i[i.length - 1]; + if (c.idx < u.idx) { + var h = u; + u = c, c = h; + } + for (var f = [u.pt.x, u.pt.y], v = [c.pt.x, c.pt.y], b = [f], w = [v], a = u.idx + 1; a <= c.idx; a++) + rd(b, r[a].slice()); + rd(b, v), rd(b, f); + for (var a = c.idx + 1; a <= u.idx + n; a++) + rd(w, r[a % n].slice()); + return rd(w, f), rd(w, v), [{ + points: b + }, { + points: w + }]; +} +function IN(r) { + var e = r.points, t = [], n = []; + Pb(e, t, n); + var i = new Wt(t[0], t[1], n[0] - t[0], n[1] - t[1]), a = i.width, o = i.height, s = i.x, l = i.y, u = new Zt(), c = new Zt(); + return a > o ? (u.x = c.x = s + a / 2, u.y = l, c.y = l + o) : (u.y = c.y = l + o / 2, u.x = s, c.x = s + a), uye(e, u, c); +} +function eb(r, e, t, n) { + if (t === 1) + n.push(e); + else { + var i = Math.floor(t / 2), a = r(e); + eb(r, a[0], i, n), eb(r, a[1], t - i, n); + } + return n; +} +function cye(r, e) { + for (var t = [], n = 0; n < e; n++) + t.push(KI(r)); + return t; +} +function hye(r, e) { + e.setStyle(r.style), e.z = r.z, e.z2 = r.z2, e.zlevel = r.zlevel; +} +function fye(r) { + for (var e = [], t = 0; t < r.length; ) + e.push([r[t++], r[t++]]); + return e; +} +function dye(r, e) { + var t = [], n = r.shape, i; + switch (r.type) { + case "rect": + oye(n, e, t), i = Or; + break; + case "sector": + CN(n, e, t), i = Oa; + break; + case "circle": + CN({ + r0: 0, + r: n.r, + startAngle: 0, + endAngle: Math.PI * 2, + cx: n.cx, + cy: n.cy + }, e, t), i = Oa; + break; + default: + var a = r.getComputedTransform(), o = a ? Math.sqrt(Math.max(a[0] * a[0] + a[1] * a[1], a[2] * a[2] + a[3] * a[3])) : 1, s = Ke(aye(r.getUpdatedPathProxy(), o), function(d) { + return fye(d); + }), l = s.length; + if (l === 0) + eb(IN, { + points: s[0] + }, e, t); + else if (l === e) + for (var u = 0; u < l; u++) + t.push({ + points: s[u] + }); + else { + var c = 0, h = Ke(s, function(d) { + var m = [], _ = []; + Pb(d, m, _); + var y = (_[1] - m[1]) * (_[0] - m[0]); + return c += y, { poly: d, area: y }; + }); + h.sort(function(d, m) { + return m.area - d.area; + }); + for (var f = e, u = 0; u < l; u++) { + var v = h[u]; + if (f <= 0) + break; + var b = u === l - 1 ? f : Math.ceil(v.area / c * e); + b < 0 || (eb(IN, { + points: v.poly + }, b, t), f -= b); + } + } + i = La; + break; + } + if (!i) + return cye(r, e); + for (var w = [], u = 0; u < t.length; u++) { + var p = new i(); + p.setShape(t[u]), hye(r, p), w.push(p); + } + return w; +} +function vye(r, e) { + var t = r.length, n = e.length; + if (t === n) + return [r, e]; + for (var i = [], a = [], o = t < n ? r : e, s = Math.min(t, n), l = Math.abs(n - t) / 6, u = (s - 2) / 6, c = Math.ceil(l / u) + 1, h = [o[0], o[1]], f = l, v = 2; v < s; ) { + var b = o[v - 2], w = o[v - 1], p = o[v++], d = o[v++], m = o[v++], _ = o[v++], y = o[v++], x = o[v++]; + if (f <= 0) { + h.push(p, d, m, _, y, x); + continue; + } + for (var g = Math.min(f, c - 1) + 1, S = 1; S <= g; S++) { + var T = S / g; + fc(b, p, m, y, T, i), fc(w, d, _, x, T, a), b = i[3], w = a[3], h.push(i[1], a[1], i[2], a[2], b, w), p = i[5], d = a[5], m = i[6], _ = a[6]; + } + f -= g - 1; + } + return o === r ? [h, e] : [r, h]; +} +function AN(r, e) { + for (var t = r.length, n = r[t - 2], i = r[t - 1], a = [], o = 0; o < e.length; ) + a[o++] = n, a[o++] = i; + return a; +} +function pye(r, e) { + for (var t, n, i, a = [], o = [], s = 0; s < Math.max(r.length, e.length); s++) { + var l = r[s], u = e[s], c = void 0, h = void 0; + l ? u ? (t = vye(l, u), c = t[0], h = t[1], n = c, i = h) : (h = AN(i || l, l), c = l) : (c = AN(n || u, u), h = u), a.push(c), o.push(h); + } + return [a, o]; +} +function EN(r) { + for (var e = 0, t = 0, n = 0, i = r.length, a = 0, o = i - 2; a < i; o = a, a += 2) { + var s = r[o], l = r[o + 1], u = r[a], c = r[a + 1], h = s * c - u * l; + e += h, t += (s + u) * h, n += (l + c) * h; + } + return e === 0 ? [r[0] || 0, r[1] || 0] : [t / e / 3, n / e / 3, e]; +} +function gye(r, e, t, n) { + for (var i = (r.length - 2) / 6, a = 1 / 0, o = 0, s = r.length, l = s - 2, u = 0; u < i; u++) { + for (var c = u * 6, h = 0, f = 0; f < s; f += 2) { + var v = f === 0 ? c : (c + f - 2) % l + 2, b = r[v] - t[0], w = r[v + 1] - t[1], p = e[f] - n[0], d = e[f + 1] - n[1], m = p - b, _ = d - w; + h += m * m + _ * _; + } + h < a && (a = h, o = u); + } + return o; +} +function mye(r) { + for (var e = [], t = r.length, n = 0; n < t; n += 2) + e[n] = r[t - n - 2], e[n + 1] = r[t - n - 1]; + return e; +} +function yye(r, e, t, n) { + for (var i = [], a, o = 0; o < r.length; o++) { + var s = r[o], l = e[o], u = EN(s), c = EN(l); + a == null && (a = u[2] < 0 != c[2] < 0); + var h = [], f = [], v = 0, b = 1 / 0, w = [], p = s.length; + a && (s = mye(s)); + for (var d = gye(s, l, u, c) * 6, m = p - 2, _ = 0; _ < m; _ += 2) { + var y = (d + _) % m + 2; + h[_ + 2] = s[y] - u[0], h[_ + 3] = s[y + 1] - u[1]; + } + if (h[0] = s[d] - u[0], h[1] = s[d + 1] - u[1], t > 0) + for (var x = n / t, g = -n / 2; g <= n / 2; g += x) { + for (var S = Math.sin(g), T = Math.cos(g), C = 0, _ = 0; _ < s.length; _ += 2) { + var E = h[_], M = h[_ + 1], P = l[_] - c[0], R = l[_ + 1] - c[1], N = P * T - R * S, F = P * S + R * T; + w[_] = N, w[_ + 1] = F; + var U = N - E, $ = F - M; + C += U * U + $ * $; + } + if (C < b) { + b = C, v = g; + for (var G = 0; G < w.length; G++) + f[G] = w[G]; + } + } + else + for (var Q = 0; Q < p; Q += 2) + f[Q] = l[Q] - c[0], f[Q + 1] = l[Q + 1] - c[1]; + i.push({ + from: h, + to: f, + fromCp: u, + toCp: c, + rotation: -v + }); + } + return i; +} +function tb(r) { + return r.__isCombineMorphing; +} +var MV = "__mOriginal_"; +function rb(r, e, t) { + var n = MV + e, i = r[n] || r[e]; + r[n] || (r[n] = r[e]); + var a = t.replace, o = t.after, s = t.before; + r[e] = function() { + var l = arguments, u; + return s && s.apply(this, l), a ? u = a.apply(this, l) : u = i.apply(this, l), o && o.apply(this, l), u; + }; +} +function Qp(r, e) { + var t = MV + e; + r[t] && (r[e] = r[t], r[t] = null); +} +function MN(r, e) { + for (var t = 0; t < r.length; t++) + for (var n = r[t], i = 0; i < n.length; ) { + var a = n[i], o = n[i + 1]; + n[i++] = e[0] * a + e[2] * o + e[4], n[i++] = e[1] * a + e[3] * o + e[5]; + } +} +function DV(r, e) { + var t = r.getUpdatedPathProxy(), n = e.getUpdatedPathProxy(), i = pye(HT(t), HT(n)), a = i[0], o = i[1], s = r.getComputedTransform(), l = e.getComputedTransform(); + function u() { + this.transform = null; + } + s && MN(a, s), l && MN(o, l), rb(e, "updateTransform", { replace: u }), e.transform = null; + var c = yye(a, o, 10, Math.PI), h = []; + rb(e, "buildPath", { replace: function(f) { + for (var v = e.__morphT, b = 1 - v, w = [], p = 0; p < c.length; p++) { + var d = c[p], m = d.from, _ = d.to, y = d.rotation * v, x = d.fromCp, g = d.toCp, S = Math.sin(y), T = Math.cos(y); + Bp(w, x, g, v); + for (var C = 0; C < m.length; C += 2) { + var E = m[C], M = m[C + 1], P = _[C], R = _[C + 1], N = E * b + P * v, F = M * b + R * v; + h[C] = N * T - F * S + w[0], h[C + 1] = N * S + F * T + w[1]; + } + var U = h[0], $ = h[1]; + f.moveTo(U, $); + for (var C = 2; C < m.length; ) { + var P = h[C++], R = h[C++], G = h[C++], Q = h[C++], ee = h[C++], ce = h[C++]; + U === P && $ === R && G === ee && Q === ce ? f.lineTo(ee, ce) : f.bezierCurveTo(P, R, G, Q, ee, ce), U = ee, $ = ce; + } + } + } }); +} +function YE(r, e, t) { + if (!r || !e) + return e; + var n = t.done, i = t.during; + DV(r, e), e.__morphT = 0; + function a() { + Qp(e, "buildPath"), Qp(e, "updateTransform"), e.__morphT = -1, e.createPathProxy(), e.dirtyShape(); + } + return e.animateTo({ + __morphT: 1 + }, Mt({ + during: function(o) { + e.dirtyShape(), i && i(o); + }, + done: function() { + a(), n && n(); + } + }, t)), e; +} +function _ye(r, e, t, n, i, a) { + var o = 16; + r = i === t ? 0 : Math.round(32767 * (r - t) / (i - t)), e = a === n ? 0 : Math.round(32767 * (e - n) / (a - n)); + for (var s = 0, l, u = (1 << o) / 2; u > 0; u /= 2) { + var c = 0, h = 0; + (r & u) > 0 && (c = 1), (e & u) > 0 && (h = 1), s += u * u * (3 * c ^ h), h === 0 && (c === 1 && (r = u - 1 - r, e = u - 1 - e), l = r, r = e, e = l); + } + return s; +} +function nb(r) { + var e = 1 / 0, t = 1 / 0, n = -1 / 0, i = -1 / 0, a = Ke(r, function(s) { + var l = s.getBoundingRect(), u = s.getComputedTransform(), c = l.x + l.width / 2 + (u ? u[4] : 0), h = l.y + l.height / 2 + (u ? u[5] : 0); + return e = Math.min(c, e), t = Math.min(h, t), n = Math.max(c, n), i = Math.max(h, i), [c, h]; + }), o = Ke(a, function(s, l) { + return { + cp: s, + z: _ye(s[0], s[1], e, t, n, i), + path: r[l] + }; + }); + return o.sort(function(s, l) { + return s.z - l.z; + }).map(function(s) { + return s.path; + }); +} +function kV(r) { + return dye(r.path, r.count); +} +function GT() { + return { + fromIndividuals: [], + toIndividuals: [], + count: 0 + }; +} +function bye(r, e, t) { + var n = []; + function i(x) { + for (var g = 0; g < x.length; g++) { + var S = x[g]; + tb(S) ? i(S.childrenRef()) : S instanceof hr && n.push(S); + } + } + i(r); + var a = n.length; + if (!a) + return GT(); + var o = t.dividePath || kV, s = o({ + path: e, + count: a + }); + if (s.length !== a) + return console.error("Invalid morphing: unmatched splitted path"), GT(); + n = nb(n), s = nb(s); + for (var l = t.done, u = t.during, c = t.individualDelay, h = new Yl(), f = 0; f < a; f++) { + var v = n[f], b = s[f]; + b.parent = e, b.copyTransform(h), c || DV(v, b); + } + e.__isCombineMorphing = !0, e.childrenRef = function() { + return s; + }; + function w(x) { + for (var g = 0; g < s.length; g++) + s[g].addSelfToZr(x); + } + rb(e, "addSelfToZr", { + after: function(x) { + w(x); + } + }), rb(e, "removeSelfFromZr", { + after: function(x) { + for (var g = 0; g < s.length; g++) + s[g].removeSelfFromZr(x); + } + }); + function p() { + e.__isCombineMorphing = !1, e.__morphT = -1, e.childrenRef = null, Qp(e, "addSelfToZr"), Qp(e, "removeSelfFromZr"); + } + var d = s.length; + if (c) + for (var m = d, _ = function() { + m--, m === 0 && (p(), l && l()); + }, f = 0; f < d; f++) { + var y = c ? Mt({ + delay: (t.delay || 0) + c(f, d, n[f], s[f]), + done: _ + }, t) : t; + YE(n[f], s[f], y); + } + else + e.__morphT = 0, e.animateTo({ + __morphT: 1 + }, Mt({ + during: function(x) { + for (var g = 0; g < d; g++) { + var S = s[g]; + S.__morphT = e.__morphT, S.dirtyShape(); + } + u && u(x); + }, + done: function() { + p(); + for (var x = 0; x < r.length; x++) + Qp(r[x], "updateTransform"); + l && l(); + } + }, t)); + return e.__zr && w(e.__zr), { + fromIndividuals: n, + toIndividuals: s, + count: d + }; +} +function xye(r, e, t) { + var n = e.length, i = [], a = t.dividePath || kV; + function o(v) { + for (var b = 0; b < v.length; b++) { + var w = v[b]; + tb(w) ? o(w.childrenRef()) : w instanceof hr && i.push(w); + } + } + if (tb(r)) { + o(r.childrenRef()); + var s = i.length; + if (s < n) + for (var l = 0, u = s; u < n; u++) + i.push(KI(i[l++ % s])); + i.length = n; + } else { + i = a({ path: r, count: n }); + for (var c = r.getComputedTransform(), u = 0; u < i.length; u++) + i[u].setLocalTransform(c); + if (i.length !== n) + return console.error("Invalid morphing: unmatched splitted path"), GT(); + } + i = nb(i), e = nb(e); + for (var h = t.individualDelay, u = 0; u < n; u++) { + var f = h ? Mt({ + delay: (t.delay || 0) + h(u, n, i[u], e[u]) + }, t) : t; + YE(i[u], e[u], f); + } + return { + fromIndividuals: i, + toIndividuals: e, + count: e.length + }; +} +function DN(r) { + return We(r[0]); +} +function kN(r, e) { + for (var t = [], n = r.length, i = 0; i < n; i++) + t.push({ + one: r[i], + many: [] + }); + for (var i = 0; i < e.length; i++) { + var a = e[i].length, o = void 0; + for (o = 0; o < a; o++) + t[o % n].many.push(e[i][o]); + } + for (var s = 0, i = n - 1; i >= 0; i--) + if (!t[i].many.length) { + var l = t[s].many; + if (l.length <= 1) + if (s) + s = 0; + else + return t; + var a = l.length, u = Math.ceil(a / 2); + t[i].many = l.slice(u, a), t[s].many = l.slice(0, u), s++; + } + return t; +} +var Sye = { + clone: function(r) { + for (var e = [], t = 1 - Math.pow(1 - r.path.style.opacity, 1 / r.count), n = 0; n < r.count; n++) { + var i = KI(r.path); + i.setStyle("opacity", t), e.push(i); + } + return e; + }, + // Use the default divider + split: null +}; +function xC(r, e, t, n, i, a) { + if (!r.length || !e.length) + return; + var o = Kd("update", n, i); + if (!(o && o.duration > 0)) + return; + var s = n.getModel("universalTransition").get("delay"), l = Object.assign({ + // Need to setToFinal so the further calculation based on the style can be correct. + // Like emphasis color. + setToFinal: !0 + }, o), u, c; + DN(r) && (u = r, c = e), DN(e) && (u = e, c = r); + function h(d, m, _, y, x) { + var g = d.many, S = d.one; + if (g.length === 1 && !x) { + var T = m ? g[0] : S, C = m ? S : g[0]; + if (tb(T)) + h({ + many: [T], + one: C + }, !0, _, y, !0); + else { + var E = s ? Mt({ + delay: s(_, y) + }, l) : l; + YE(T, C, E), a(T, C, T, C, E); + } + } else + for (var M = Mt({ + dividePath: Sye[t], + individualDelay: s && function($, G, Q, ee) { + return s($ + _, y); + } + }, l), P = m ? bye(g, S, M) : xye(S, g, M), R = P.fromIndividuals, N = P.toIndividuals, F = R.length, U = 0; U < F; U++) { + var E = s ? Mt({ + delay: s(U, F) + }, l) : l; + a(R[U], N[U], m ? g[U] : d.one, m ? d.one : g[U], E); + } + } + for (var f = u ? u === r : r.length > e.length, v = u ? kN(c, u) : kN(f ? e : r, [f ? r : e]), b = 0, w = 0; w < v.length; w++) + b += v[w].many.length; + for (var p = 0, w = 0; w < v.length; w++) + h(v[w], f, p, b), p += v[w].many.length; +} +function mh(r) { + if (!r) + return []; + if (We(r)) { + for (var e = [], t = 0; t < r.length; t++) + e.push(mh(r[t])); + return e; + } + var n = []; + return r.traverse(function(i) { + i instanceof hr && !i.disableMorphing && !i.invisible && !i.ignore && n.push(i); + }), n; +} +var OV = 1e4, wye = Rr(); +function Cye(r) { + for (var e = r.dimensions, t = 0; t < e.length; t++) { + var n = r.getDimensionInfo(e[t]); + if (n && n.otherDims.itemGroupId === 0) + return e[t]; + } +} +function ON(r) { + var e = []; + return X(r, function(t) { + var n = t.data; + if (!(n.count() > OV)) + for (var i = n.getIndices(), a = Cye(n), o = 0; o < i.length; o++) + e.push({ + dataGroupId: t.dataGroupId, + data: n, + dim: t.dim || a, + divide: t.divide, + dataIndex: o + }); + }), e; +} +function SC(r, e, t) { + r.traverse(function(n) { + n instanceof hr && An(n, { + style: { + opacity: 0 + } + }, e, { + dataIndex: t, + isFrom: !0 + }); + }); +} +function wC(r) { + if (r.parent) { + var e = r.getComputedTransform(); + r.setLocalTransform(e), r.parent.remove(r); + } +} +function nd(r) { + r.stopAnimation(), r.isGroup && r.traverse(function(e) { + e.stopAnimation(); + }); +} +function Tye(r, e, t) { + var n = Kd("update", t, e); + n && r.traverse(function(i) { + if (i instanceof ts) { + var a = mK(i); + a && i.animateFrom({ + style: a + }, n); + } + }); +} +function Iye(r, e) { + var t = r.length; + if (t !== e.length) + return !1; + for (var n = 0; n < t; n++) { + var i = r[n], a = e[n]; + if (i.data.getId(i.dataIndex) !== a.data.getId(a.dataIndex)) + return !1; + } + return !0; +} +function LV(r, e, t) { + var n = ON(r), i = ON(e); + function a(d, m, _, y, x) { + (_ || d) && m.animateFrom({ + style: _ && _ !== d ? ( + // dividingMethod like clone may override the style(opacity) + // So extend it to raw style. + Fe(Fe({}, _.style), d.style) + ) : d.style + }, x); + } + function o(d) { + for (var m = 0; m < d.length; m++) + if (d[m].dim) + return d[m].dim; + } + var s = o(n), l = o(i), u = !1; + function c(d, m) { + return function(_) { + var y = _.data, x = _.dataIndex; + if (m) + return y.getId(x); + var g = _.dataGroupId, S = d ? s || l : l || s, T = S && y.getDimensionInfo(S), C = T && T.ordinalMeta; + if (T) { + var E = y.get(T.name, x); + return C && C.categories[E] || E + ""; + } + var M = y.getRawDataItem(x); + return M && M.groupId ? M.groupId + "" : g || y.getId(x); + }; + } + var h = Iye(n, i), f = {}; + if (!h) + for (var v = 0; v < i.length; v++) { + var b = i[v], w = b.data.getItemGraphicEl(b.dataIndex); + w && (f[w.id] = !0); + } + function p(d, m) { + var _ = n[m], y = i[d], x = y.data.hostModel, g = _.data.getItemGraphicEl(_.dataIndex), S = y.data.getItemGraphicEl(y.dataIndex); + if (g === S) { + S && Tye(S, y.dataIndex, x); + return; + } + // We can't use the elements that already being morphed + g && f[g.id] || S && (nd(S), g ? (nd(g), wC(g), u = !0, xC(mh(g), mh(S), y.divide, x, d, a)) : SC(S, x, d)); + } + new nu(n, i, c(!0, h), c(!1, h), null, "multiple").update(p).updateManyToOne(function(d, m) { + var _ = i[d], y = _.data, x = y.hostModel, g = y.getItemGraphicEl(_.dataIndex), S = Jr(Ke(m, function(T) { + return n[T].data.getItemGraphicEl(n[T].dataIndex); + }), function(T) { + return T && T !== g && !f[T.id]; + }); + g && (nd(g), S.length ? (X(S, function(T) { + nd(T), wC(T); + }), u = !0, xC(mh(S), mh(g), _.divide, x, d, a)) : SC(g, x, _.dataIndex)); + }).updateOneToMany(function(d, m) { + var _ = n[m], y = _.data.getItemGraphicEl(_.dataIndex); + if (!(y && f[y.id])) { + var x = Jr(Ke(d, function(S) { + return i[S].data.getItemGraphicEl(i[S].dataIndex); + }), function(S) { + return S && S !== y; + }), g = i[d[0]].data.hostModel; + x.length && (X(x, function(S) { + return nd(S); + }), y ? (nd(y), wC(y), u = !0, xC( + mh(y), + mh(x), + _.divide, + // Use divide on old. + g, + d[0], + a + )) : X(x, function(S) { + return SC(S, g, d[0]); + })); + } + }).updateManyToMany(function(d, m) { + new nu(m, d, function(_) { + return n[_].data.getId(n[_].dataIndex); + }, function(_) { + return i[_].data.getId(i[_].dataIndex); + }).update(function(_, y) { + p(d[_], m[y]); + }).execute(); + }).execute(), u && X(e, function(d) { + var m = d.data, _ = m.hostModel, y = _ && t.getViewOfSeriesModel(_), x = Kd("update", _, 0); + y && _.isAnimationEnabled() && x && x.duration > 0 && y.group.traverse(function(g) { + g instanceof hr && !g.animators.length && g.animateFrom({ + style: { + opacity: 0 + } + }, x); + }); + }); +} +function LN(r) { + var e = r.getModel("universalTransition").get("seriesKey"); + return e || r.id; +} +function PN(r) { + return We(r) ? r.sort().join(",") : r; +} +function Wu(r) { + if (r.hostModel) + return r.hostModel.getModel("universalTransition").get("divideShape"); +} +function Aye(r, e) { + var t = xt(), n = xt(), i = xt(); + return X(r.oldSeries, function(a, o) { + var s = r.oldDataGroupIds[o], l = r.oldData[o], u = LN(a), c = PN(u); + n.set(c, { + dataGroupId: s, + data: l + }), We(u) && X(u, function(h) { + i.set(h, { + key: c, + dataGroupId: s, + data: l + }); + }); + }), X(e.updatedSeries, function(a) { + if (a.isUniversalTransitionEnabled() && a.isAnimationEnabled()) { + var o = a.get("dataGroupId"), s = a.getData(), l = LN(a), u = PN(l), c = n.get(u); + if (c) + t.set(u, { + oldSeries: [{ + dataGroupId: c.dataGroupId, + divide: Wu(c.data), + data: c.data + }], + newSeries: [{ + dataGroupId: o, + divide: Wu(s), + data: s + }] + }); + else if (We(l)) { + var h = []; + X(l, function(b) { + var w = n.get(b); + w.data && h.push({ + dataGroupId: w.dataGroupId, + divide: Wu(w.data), + data: w.data + }); + }), h.length && t.set(u, { + oldSeries: h, + newSeries: [{ + dataGroupId: o, + data: s, + divide: Wu(s) + }] + }); + } else { + var f = i.get(l); + if (f) { + var v = t.get(f.key); + v || (v = { + oldSeries: [{ + dataGroupId: f.dataGroupId, + data: f.data, + divide: Wu(f.data) + }], + newSeries: [] + }, t.set(f.key, v)), v.newSeries.push({ + dataGroupId: o, + data: s, + divide: Wu(s) + }); + } + } + } + }), t; +} +function RN(r, e) { + for (var t = 0; t < r.length; t++) { + var n = e.seriesIndex != null && e.seriesIndex === r[t].seriesIndex || e.seriesId != null && e.seriesId === r[t].id; + if (n) + return t; + } +} +function Eye(r, e, t, n) { + var i = [], a = []; + X(ln(r.from), function(o) { + var s = RN(e.oldSeries, o); + s >= 0 && i.push({ + dataGroupId: e.oldDataGroupIds[s], + data: e.oldData[s], + // TODO can specify divideShape in transition. + divide: Wu(e.oldData[s]), + dim: o.dimension + }); + }), X(ln(r.to), function(o) { + var s = RN(t.updatedSeries, o); + if (s >= 0) { + var l = t.updatedSeries[s].getData(); + a.push({ + dataGroupId: e.oldDataGroupIds[s], + data: l, + divide: Wu(l), + dim: o.dimension + }); + } + }), i.length > 0 && a.length > 0 && LV(i, a, n); +} +function Mye(r) { + r.registerUpdateLifecycle("series:beforeupdate", function(e, t, n) { + X(ln(n.seriesTransition), function(i) { + X(ln(i.to), function(a) { + for (var o = n.updatedSeries, s = 0; s < o.length; s++) + (a.seriesIndex != null && a.seriesIndex === o[s].seriesIndex || a.seriesId != null && a.seriesId === o[s].id) && (o[s][V0] = !0); + }); + }); + }), r.registerUpdateLifecycle("series:transition", function(e, t, n) { + var i = wye(t); + if (i.oldSeries && n.updatedSeries && n.optionChanged) { + var a = n.seriesTransition; + if (a) + X(ln(a), function(v) { + Eye(v, i, n, t); + }); + else { + var o = Aye(i, n); + X(o.keys(), function(v) { + var b = o.get(v); + LV(b.oldSeries, b.newSeries, t); + }); + } + X(n.updatedSeries, function(v) { + v[V0] && (v[V0] = !1); + }); + } + for (var s = e.getSeries(), l = i.oldSeries = [], u = i.oldDataGroupIds = [], c = i.oldData = [], h = 0; h < s.length; h++) { + var f = s[h].getData(); + f.count() < OV && (l.push(s[h]), u.push(s[h].get("dataGroupId")), c.push(f)); + } + }); +} +Kt([W$]); +Kt([$re]); +Kt([mne, Rne, Xne, Rie, Qie, Wae, woe, use, zse, Wse, nle, sue, Pue, Yue, dce, bce, Bce, Xce, she, phe, Ehe, dfe]); +Kt(Nfe); +Kt(gde); +Kt(AH); +Kt(Lde); +Kt(d3); +Kt(Fde); +Kt(Zde); +Kt(Jve); +Kt(_pe); +Kt(gm); +Kt(jpe); +Kt(Hpe); +Kt(nge); +Kt(dge); +Kt(xge); +Kt(Mge); +Kt(Vge); +Kt(hme); +Kt(yV); +Kt(_V); +Kt(Bme); +Kt(CV); +Kt(TV); +Kt(Vme); +Kt(rye); +Kt(AV); +Kt(Mye); +Kt(k$); +const Dye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Axis: wo, + ChartView: en, + ComponentModel: xr, + ComponentView: Sn, + List: Ui, + Model: qr, + PRIORITY: IA, + SeriesModel: mn, + color: Oj, + connect: E4, + dataTool: R4, + dependencies: m4, + disConnect: M4, + disconnect: DA, + dispose: D4, + env: Dr, + extendChartView: C$, + extendComponentModel: x$, + extendComponentView: S$, + extendSeriesModel: w$, + format: d$, + getCoordinateSystemDimensions: O4, + getInstanceByDom: am, + getInstanceById: k4, + getMap: P4, + graphic: f$, + helper: o$, + init: MA, + innerDrawElementOnCanvas: Qb, + matrix: mj, + number: c$, + parseGeoJSON: Tg, + parseGeoJson: Tg, + registerAction: os, + registerCoordinateSystem: LA, + registerLayout: PA, + registerLoading: nx, + registerLocale: Vb, + registerMap: NA, + registerPostInit: kA, + registerPostUpdate: OA, + registerPreprocessor: tx, + registerProcessor: rx, + registerTheme: ex, + registerTransform: zA, + registerUpdateLifecycle: om, + registerVisual: cu, + setCanvasCreator: L4, + setPlatformAPI: TI, + throttle: Zh, + time: h$, + use: Kt, + util: v$, + vector: vj, + version: CA, + zrUtil: hj, + zrender: Yj +}, Symbol.toStringTag, { value: "Module" })); +var kye = function r(e, t) { + if (e === t) + return !0; + if (e && t && typeof e == "object" && typeof t == "object") { + if (e.constructor !== t.constructor) + return !1; + var n, i, a; + if (Array.isArray(e)) { + if (n = e.length, n != t.length) + return !1; + for (i = n; i-- !== 0; ) + if (!r(e[i], t[i])) + return !1; + return !0; + } + if (e.constructor === RegExp) + return e.source === t.source && e.flags === t.flags; + if (e.valueOf !== Object.prototype.valueOf) + return e.valueOf() === t.valueOf(); + if (e.toString !== Object.prototype.toString) + return e.toString() === t.toString(); + if (a = Object.keys(e), n = a.length, n !== Object.keys(t).length) + return !1; + for (i = n; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(t, a[i])) + return !1; + for (i = n; i-- !== 0; ) { + var o = a[i]; + if (!r(e[o], t[o])) + return !1; + } + return !0; + } + return e !== e && t !== t; +}; +const xp = /* @__PURE__ */ xI(kye); +var PV = { exports: {} }; +(function(r) { + (function(e, t) { + r.exports ? r.exports = t() : e.log = t(); + })(y6, function() { + var e = function() { + }, t = "undefined", n = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), i = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + function a(w, p) { + var d = w[p]; + if (typeof d.bind == "function") + return d.bind(w); + try { + return Function.prototype.bind.call(d, w); + } catch (m) { + return function() { + return Function.prototype.apply.apply(d, [w, arguments]); + }; + } + } + function o() { + console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace(); + } + function s(w) { + return w === "debug" && (w = "log"), typeof console === t ? !1 : w === "trace" && n ? o : console[w] !== void 0 ? a(console, w) : console.log !== void 0 ? a(console, "log") : e; + } + function l(w, p) { + for (var d = 0; d < i.length; d++) { + var m = i[d]; + this[m] = d < w ? e : this.methodFactory(m, w, p); + } + this.log = this.debug; + } + function u(w, p, d) { + return function() { + typeof console !== t && (l.call(this, p, d), this[w].apply(this, arguments)); + }; + } + function c(w, p, d) { + return s(w) || u.apply(this, arguments); + } + function h(w, p, d) { + var m = this, _; + p = p == null ? "WARN" : p; + var y = "loglevel"; + typeof w == "string" ? y += ":" + w : typeof w == "symbol" && (y = void 0); + function x(C) { + var E = (i[C] || "silent").toUpperCase(); + if (!(typeof window === t || !y)) { + try { + window.localStorage[y] = E; + return; + } catch (M) { + } + try { + window.document.cookie = encodeURIComponent(y) + "=" + E + ";"; + } catch (M) { + } + } + } + function g() { + var C; + if (!(typeof window === t || !y)) { + try { + C = window.localStorage[y]; + } catch (P) { + } + if (typeof C === t) + try { + var E = window.document.cookie, M = E.indexOf( + encodeURIComponent(y) + "=" + ); + M !== -1 && (C = /^([^;]+)/.exec(E.slice(M))[1]); + } catch (P) { + } + return m.levels[C] === void 0 && (C = void 0), C; + } + } + function S() { + if (!(typeof window === t || !y)) { + try { + window.localStorage.removeItem(y); + return; + } catch (C) { + } + try { + window.document.cookie = encodeURIComponent(y) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + } catch (C) { + } + } + } + m.name = w, m.levels = { + TRACE: 0, + DEBUG: 1, + INFO: 2, + WARN: 3, + ERROR: 4, + SILENT: 5 + }, m.methodFactory = d || c, m.getLevel = function() { + return _; + }, m.setLevel = function(C, E) { + if (typeof C == "string" && m.levels[C.toUpperCase()] !== void 0 && (C = m.levels[C.toUpperCase()]), typeof C == "number" && C >= 0 && C <= m.levels.SILENT) { + if (_ = C, E !== !1 && x(C), l.call(m, C, w), typeof console === t && C < m.levels.SILENT) + return "No console available for logging"; + } else + throw "log.setLevel() called with invalid level: " + C; + }, m.setDefaultLevel = function(C) { + p = C, g() || m.setLevel(C, !1); + }, m.resetLevel = function() { + m.setLevel(p, !1), S(); + }, m.enableAll = function(C) { + m.setLevel(m.levels.TRACE, C); + }, m.disableAll = function(C) { + m.setLevel(m.levels.SILENT, C); + }; + var T = g(); + T == null && (T = p), m.setLevel(T, !1); + } + var f = new h(), v = {}; + f.getLogger = function(p) { + if (typeof p != "symbol" && typeof p != "string" || p === "") + throw new TypeError("You must supply a name when creating a logger."); + var d = v[p]; + return d || (d = v[p] = new h( + p, + f.getLevel(), + f.methodFactory + )), d; + }; + var b = typeof window !== t ? window.log : void 0; + return f.noConflict = function() { + return typeof window !== t && window.log === f && (window.log = b), f; + }, f.getLoggers = function() { + return v; + }, f.default = f, f; + }); +})(PV); +var Oye = PV.exports; +const RV = /* @__PURE__ */ xI(Oye); +function Lye(r) { + return typeof r == "string"; +} +function CC(r) { + return typeof r == "function"; +} +class Pye extends $react.PureComponent { + constructor(e) { + super(e), this.echarts = e.echarts, this.ele = null; + } + componentDidMount() { + this.renderNewEcharts(); + } + // update + componentDidUpdate(e) { + const { + shouldSetOption: t + } = this.props; + if (t && CC(t) && !t(e, this.props)) + return; + if (!xp(e.theme, this.props.theme) || !xp(e.opts, this.props.opts) || !xp(e.onEvents, this.props.onEvents) || !xp(e.mode, this.props.mode)) { + this.dispose(), this.renderNewEcharts(); + return; + } + if (this.props.mode === "json") { + this.updateEChartsOption(); + return; + } + const n = ["option", "notMerge", "lazyUpdate", "showLoading", "loadingOption"]; + xp($lodash.pick(this.props, n), $lodash.pick(e, n)) || this.updateEChartsOption(); + } + componentWillUnmount() { + this.dispose(); + } + /** + * return the echart object + * 1. if exist, return the existed instance + * 2. or new one instance + */ + getEchartsInstance() { + return this.echarts.getInstanceByDom(this.ele) || this.echarts.init(this.ele, this.props.theme, this.props.opts); + } + /** + * dispose echarts and clear size-sensor + */ + dispose() { + this.ele && this.echarts.dispose(this.ele); + } + /** + * render a new echarts instance + */ + renderNewEcharts() { + const { + onEvents: e, + onChartReady: t + } = this.props, n = this.updateEChartsOption(); + this.bindEvents(n, e || {}), t && CC(t) && t(n); + } + // bind the events + bindEvents(e, t) { + function n(i, a) { + Lye(i) && CC(a) && e.on(i, (o) => { + a(o, e); + }); + } + for (const i in t) + Object.prototype.hasOwnProperty.call(t, i) && n(i, t[i]); + } + /** + * render the echarts + */ + updateEChartsOption() { + const { + option: e, + notMerge: t = !1, + lazyUpdate: n = !1, + showLoading: i, + loadingOption: a = null + } = this.props, o = this.getEchartsInstance(); + try { + o.setOption(e, { + notMerge: t, + lazyUpdate: n, + silent: !0 + }); + } catch (s) { + this.dispose(), RV.warn("invalid echarts option:", s); + } + return i ? o.showLoading(a) : o.hideLoading(), o; + } + render() { + const { + style: e, + className: t = "" + } = this.props, n = sn({ + height: 300 + }, e); + return /* @__PURE__ */ Bt("div", { + ref: (i) => { + this.ele = i; + }, + style: n, + className: `echarts-for-react ${t}` + }); + } +} +class Rye extends Pye { + constructor(e) { + super(e), this.echarts = Dye; + } +} +var Nye = 20, zye = 1, qh = 1e6, NN = 1e6, Bye = -7, jye = 21, Fye = !1, mm = "[big.js] ", hf = mm + "Invalid ", gx = hf + "decimal places", $ye = hf + "rounding mode", NV = mm + "Division by zero", xn = {}, wl = void 0, Hye = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; +function zV() { + function r(e) { + var t = this; + if (!(t instanceof r)) + return e === wl ? zV() : new r(e); + if (e instanceof r) + t.s = e.s, t.e = e.e, t.c = e.c.slice(); + else { + if (typeof e != "string") { + if (r.strict === !0 && typeof e != "bigint") + throw TypeError(hf + "value"); + e = e === 0 && 1 / e < 0 ? "-0" : String(e); + } + Vye(t, e); + } + t.constructor = r; + } + return r.prototype = xn, r.DP = Nye, r.RM = zye, r.NE = Bye, r.PE = jye, r.strict = Fye, r.roundDown = 0, r.roundHalfUp = 1, r.roundHalfEven = 2, r.roundUp = 3, r; +} +function Vye(r, e) { + var t, n, i; + if (!Hye.test(e)) + throw Error(hf + "number"); + for (r.s = e.charAt(0) == "-" ? (e = e.slice(1), -1) : 1, (t = e.indexOf(".")) > -1 && (e = e.replace(".", "")), (n = e.search(/e/i)) > 0 ? (t < 0 && (t = n), t += +e.slice(n + 1), e = e.substring(0, n)) : t < 0 && (t = e.length), i = e.length, n = 0; n < i && e.charAt(n) == "0"; ) + ++n; + if (n == i) + r.c = [r.e = 0]; + else { + for (; i > 0 && e.charAt(--i) == "0"; ) + ; + for (r.e = t - n - 1, r.c = [], t = 0; n <= i; ) + r.c[t++] = +e.charAt(n++); + } + return r; +} +function ff(r, e, t, n) { + var i = r.c; + if (t === wl && (t = r.constructor.RM), t !== 0 && t !== 1 && t !== 2 && t !== 3) + throw Error($ye); + if (e < 1) + n = t === 3 && (n || !!i[0]) || e === 0 && (t === 1 && i[0] >= 5 || t === 2 && (i[0] > 5 || i[0] === 5 && (n || i[1] !== wl))), i.length = 1, n ? (r.e = r.e - e + 1, i[0] = 1) : i[0] = r.e = 0; + else if (e < i.length) { + if (n = t === 1 && i[e] >= 5 || t === 2 && (i[e] > 5 || i[e] === 5 && (n || i[e + 1] !== wl || i[e - 1] & 1)) || t === 3 && (n || !!i[0]), i.length = e, n) { + for (; ++i[--e] > 9; ) + if (i[e] = 0, e === 0) { + ++r.e, i.unshift(1); + break; + } + } + for (e = i.length; !i[--e]; ) + i.pop(); + } + return r; +} +function fv(r, e, t) { + var n = r.e, i = r.c.join(""), a = i.length; + if (e) + i = i.charAt(0) + (a > 1 ? "." + i.slice(1) : "") + (n < 0 ? "e" : "e+") + n; + else if (n < 0) { + for (; ++n; ) + i = "0" + i; + i = "0." + i; + } else if (n > 0) + if (++n > a) + for (n -= a; n--; ) + i += "0"; + else + n < a && (i = i.slice(0, n) + "." + i.slice(n)); + else + a > 1 && (i = i.charAt(0) + "." + i.slice(1)); + return r.s < 0 && t ? "-" + i : i; +} +xn.abs = function() { + var r = new this.constructor(this); + return r.s = 1, r; +}; +xn.cmp = function(r) { + var e, t = this, n = t.c, i = (r = new t.constructor(r)).c, a = t.s, o = r.s, s = t.e, l = r.e; + if (!n[0] || !i[0]) + return n[0] ? a : i[0] ? -o : 0; + if (a != o) + return a; + if (e = a < 0, s != l) + return s > l ^ e ? 1 : -1; + for (o = (s = n.length) < (l = i.length) ? s : l, a = -1; ++a < o; ) + if (n[a] != i[a]) + return n[a] > i[a] ^ e ? 1 : -1; + return s == l ? 0 : s > l ^ e ? 1 : -1; +}; +xn.div = function(r) { + var e = this, t = e.constructor, n = e.c, i = (r = new t(r)).c, a = e.s == r.s ? 1 : -1, o = t.DP; + if (o !== ~~o || o < 0 || o > qh) + throw Error(gx); + if (!i[0]) + throw Error(NV); + if (!n[0]) + return r.s = a, r.c = [r.e = 0], r; + var s, l, u, c, h, f = i.slice(), v = s = i.length, b = n.length, w = n.slice(0, s), p = w.length, d = r, m = d.c = [], _ = 0, y = o + (d.e = e.e - r.e) + 1; + for (d.s = a, a = y < 0 ? 0 : y, f.unshift(0); p++ < s; ) + w.push(0); + do { + for (u = 0; u < 10; u++) { + if (s != (p = w.length)) + c = s > p ? 1 : -1; + else + for (h = -1, c = 0; ++h < s; ) + if (i[h] != w[h]) { + c = i[h] > w[h] ? 1 : -1; + break; + } + if (c < 0) { + for (l = p == s ? i : f; p; ) { + if (w[--p] < l[p]) { + for (h = p; h && !w[--h]; ) + w[h] = 9; + --w[h], w[p] += 10; + } + w[p] -= l[p]; + } + for (; !w[0]; ) + w.shift(); + } else + break; + } + m[_++] = c ? u : ++u, w[0] && c ? w[p] = n[v] || 0 : w = [n[v]]; + } while ((v++ < b || w[0] !== wl) && a--); + return !m[0] && _ != 1 && (m.shift(), d.e--, y--), _ > y && ff(d, y, t.RM, w[0] !== wl), d; +}; +xn.eq = function(r) { + return this.cmp(r) === 0; +}; +xn.gt = function(r) { + return this.cmp(r) > 0; +}; +xn.gte = function(r) { + return this.cmp(r) > -1; +}; +xn.lt = function(r) { + return this.cmp(r) < 0; +}; +xn.lte = function(r) { + return this.cmp(r) < 1; +}; +xn.minus = xn.sub = function(r) { + var e, t, n, i, a = this, o = a.constructor, s = a.s, l = (r = new o(r)).s; + if (s != l) + return r.s = -l, a.plus(r); + var u = a.c.slice(), c = a.e, h = r.c, f = r.e; + if (!u[0] || !h[0]) + return h[0] ? r.s = -l : u[0] ? r = new o(a) : r.s = 1, r; + if (s = c - f) { + for ((i = s < 0) ? (s = -s, n = u) : (f = c, n = h), n.reverse(), l = s; l--; ) + n.push(0); + n.reverse(); + } else + for (t = ((i = u.length < h.length) ? u : h).length, s = l = 0; l < t; l++) + if (u[l] != h[l]) { + i = u[l] < h[l]; + break; + } + if (i && (n = u, u = h, h = n, r.s = -r.s), (l = (t = h.length) - (e = u.length)) > 0) + for (; l--; ) + u[e++] = 0; + for (l = e; t > s; ) { + if (u[--t] < h[t]) { + for (e = t; e && !u[--e]; ) + u[e] = 9; + --u[e], u[t] += 10; + } + u[t] -= h[t]; + } + for (; u[--l] === 0; ) + u.pop(); + for (; u[0] === 0; ) + u.shift(), --f; + return u[0] || (r.s = 1, u = [f = 0]), r.c = u, r.e = f, r; +}; +xn.mod = function(r) { + var e, t = this, n = t.constructor, i = t.s, a = (r = new n(r)).s; + if (!r.c[0]) + throw Error(NV); + return t.s = r.s = 1, e = r.cmp(t) == 1, t.s = i, r.s = a, e ? new n(t) : (i = n.DP, a = n.RM, n.DP = n.RM = 0, t = t.div(r), n.DP = i, n.RM = a, this.minus(t.times(r))); +}; +xn.neg = function() { + var r = new this.constructor(this); + return r.s = -r.s, r; +}; +xn.plus = xn.add = function(r) { + var e, t, n, i = this, a = i.constructor; + if (r = new a(r), i.s != r.s) + return r.s = -r.s, i.minus(r); + var o = i.e, s = i.c, l = r.e, u = r.c; + if (!s[0] || !u[0]) + return u[0] || (s[0] ? r = new a(i) : r.s = i.s), r; + if (s = s.slice(), e = o - l) { + for (e > 0 ? (l = o, n = u) : (e = -e, n = s), n.reverse(); e--; ) + n.push(0); + n.reverse(); + } + for (s.length - u.length < 0 && (n = u, u = s, s = n), e = u.length, t = 0; e; s[e] %= 10) + t = (s[--e] = s[e] + u[e] + t) / 10 | 0; + for (t && (s.unshift(t), ++l), e = s.length; s[--e] === 0; ) + s.pop(); + return r.c = s, r.e = l, r; +}; +xn.pow = function(r) { + var e = this, t = new e.constructor("1"), n = t, i = r < 0; + if (r !== ~~r || r < -NN || r > NN) + throw Error(hf + "exponent"); + for (i && (r = -r); r & 1 && (n = n.times(e)), r >>= 1, !!r; ) + e = e.times(e); + return i ? t.div(n) : n; +}; +xn.prec = function(r, e) { + if (r !== ~~r || r < 1 || r > qh) + throw Error(hf + "precision"); + return ff(new this.constructor(this), r, e); +}; +xn.round = function(r, e) { + if (r === wl) + r = 0; + else if (r !== ~~r || r < -qh || r > qh) + throw Error(gx); + return ff(new this.constructor(this), r + this.e + 1, e); +}; +xn.sqrt = function() { + var r, e, t, n = this, i = n.constructor, a = n.s, o = n.e, s = new i("0.5"); + if (!n.c[0]) + return new i(n); + if (a < 0) + throw Error(mm + "No square root"); + a = Math.sqrt(n + ""), a === 0 || a === 1 / 0 ? (e = n.c.join(""), e.length + o & 1 || (e += "0"), a = Math.sqrt(e), o = ((o + 1) / 2 | 0) - (o < 0 || o & 1), r = new i((a == 1 / 0 ? "5e" : (a = a.toExponential()).slice(0, a.indexOf("e") + 1)) + o)) : r = new i(a + ""), o = r.e + (i.DP += 4); + do + t = r, r = s.times(t.plus(n.div(t))); + while (t.c.slice(0, o).join("") !== r.c.slice(0, o).join("")); + return ff(r, (i.DP -= 4) + r.e + 1, i.RM); +}; +xn.times = xn.mul = function(r) { + var e, t = this, n = t.constructor, i = t.c, a = (r = new n(r)).c, o = i.length, s = a.length, l = t.e, u = r.e; + if (r.s = t.s == r.s ? 1 : -1, !i[0] || !a[0]) + return r.c = [r.e = 0], r; + for (r.e = l + u, o < s && (e = i, i = a, a = e, u = o, o = s, s = u), e = new Array(u = o + s); u--; ) + e[u] = 0; + for (l = s; l--; ) { + for (s = 0, u = o + l; u > l; ) + s = e[u] + a[l] * i[u - l - 1] + s, e[u--] = s % 10, s = s / 10 | 0; + e[u] = s; + } + for (s ? ++r.e : e.shift(), l = e.length; !e[--l]; ) + e.pop(); + return r.c = e, r; +}; +xn.toExponential = function(r, e) { + var t = this, n = t.c[0]; + if (r !== wl) { + if (r !== ~~r || r < 0 || r > qh) + throw Error(gx); + for (t = ff(new t.constructor(t), ++r, e); t.c.length < r; ) + t.c.push(0); + } + return fv(t, !0, !!n); +}; +xn.toFixed = function(r, e) { + var t = this, n = t.c[0]; + if (r !== wl) { + if (r !== ~~r || r < 0 || r > qh) + throw Error(gx); + for (t = ff(new t.constructor(t), r + t.e + 1, e), r = r + t.e + 1; t.c.length < r; ) + t.c.push(0); + } + return fv(t, !1, !!n); +}; +xn[Symbol.for("nodejs.util.inspect.custom")] = xn.toJSON = xn.toString = function() { + var r = this, e = r.constructor; + return fv(r, r.e <= e.NE || r.e >= e.PE, !!r.c[0]); +}; +xn.toNumber = function() { + var r = Number(fv(this, !0, !0)); + if (this.constructor.strict === !0 && !this.eq(r.toString())) + throw Error(mm + "Imprecise conversion"); + return r; +}; +xn.toPrecision = function(r, e) { + var t = this, n = t.constructor, i = t.c[0]; + if (r !== wl) { + if (r !== ~~r || r < 1 || r > qh) + throw Error(hf + "precision"); + for (t = ff(new n(t), r, e); t.c.length < r; ) + t.c.push(0); + } + return fv(t, r <= t.e || t.e <= n.NE || t.e >= n.PE, !!i); +}; +xn.valueOf = function() { + var r = this, e = r.constructor; + if (e.strict === !0) + throw Error(mm + "valueOf disallowed"); + return fv(r, r.e <= e.NE || r.e >= e.PE, !0); +}; +var Gye = zV(); +function Uye(r, e, t) { + const n = []; + return r.reduce((i, a) => { + if (a == null) + return i; + const o = a[e]; + if (!i[o]) { + const s = {}; + t.forEach((l) => { + s[l] = 0; + }), i[o] = s, n.push(i[o]); + } + return i[o][e] = o, t.forEach((s) => { + if (s !== e) + if ($lowcoder_sdk.isNumeric(a[s])) { + const l = Gye(a[s]); + i[o][s] = l.add(i[o][s]).toNumber(); + } else + i[o][s] += 1; + }), i; + }, {}), n; +} +const Wye = /* @__PURE__ */ new Set(["pie"]), Yye = ["hidden", "selectedPoints", "onEvent", "mapInstance"]; +function BV(r) { + return !Wye.has(r); +} +function Xye(r) { + const e = r.series.filter((n) => !n.getView().hide), t = e.length; + return e.map((n, i) => { + if (BV(r.chartConfig.type)) { + let a, o; + const s = r.xAxisDirection === "horizontal"; + let l = r.chartConfig.itemStyle; + if (r.chartConfig.type === "bar") { + const u = s ? [2, 2, 0, 0] : [0, 2, 2, 0]; + r.chartConfig.stack && i === e.length - 1 ? l = Za(sn({}, l), { borderRadius: u }) : r.chartConfig.stack || (l = Za(sn({}, l), { borderRadius: u })); + } + return s ? (a = r.xAxisKey, o = n.getView().columnName) : (a = n.getView().columnName, o = r.xAxisKey), Za(sn({ + name: n.getView().seriesName, + selectedMode: "single", + select: { + itemStyle: { + borderColor: "#000" + } + }, + encode: { + x: a, + y: o + } + }, r.chartConfig), { + itemStyle: l, + label: sn(sn({}, r.chartConfig.label), !s && { position: "outside" }) + }); + } else { + const a = G6(t, i, r.chartConfig); + return Za(sn({}, r.chartConfig), { + radius: a.radius, + center: a.center, + name: n.getView().seriesName, + selectedMode: "single", + encode: { + itemName: r.xAxisKey, + value: n.getView().columnName + } + }); + } + }); +} +function Zye(r, e) { + if (r.mode === "json") + return r.echartsOption ? r.echartsOption : {}; + if (r.mode === "map") { + const { + mapZoomLevel: l, + mapCenterLat: u, + mapCenterLng: c, + mapOptions: h + } = r; + return sn({ + gmap: { + center: [c, u], + zoom: l, + renderOnMoving: !0, + echartsLayerZIndex: 2019, + roam: !0 + } + }, h || {}); + } + const t = BV(r.chartConfig.type), n = { + left: 20, + right: r.legendConfig.left === "right" ? "10%" : 20, + top: 50, + bottom: 35 + }; + let i = { + title: { text: r.title, left: "center" }, + tooltip: { + confine: !0, + trigger: t ? "axis" : "item" + }, + legend: r.legendConfig, + grid: Za(sn({}, n), { + containLabel: !0 + }) + }; + if (r.data.length <= 0) + return sn(sn({}, i), t ? rY : nY); + const a = r.yConfig(), o = r.series.filter((l) => !l.getView().hide).map((l) => l.getView().columnName), s = a.type === "category" || a.type === "time" ? r.data : Uye(r.data, r.xAxisKey, o); + if (i = Za(sn({}, i), { + dataset: [ + { + source: s, + sourceHeader: !1 + } + ], + series: Xye(r) + }), t) { + let l; + if (e) { + const c = typeof n.right == "number" ? n.right : e.w * parseFloat(n.right) / 100; + l = { + // actually it's self-adaptive with the x-axis label on the left, not that accurate but work + w: e.w - n.left - c, + // also self-adaptive on the bottom + h: e.h - n.top - n.bottom, + right: c + }; + } + const u = R6( + r.xConfig, + a, + r.xAxisDirection, + s.map((c) => c[r.xAxisKey]), + l + ); + i = Za(sn({}, i), { + // @ts-ignore + xAxis: u.xConfig, + // @ts-ignore + yAxis: u.yConfig + }); + } + return i; +} +function zN(r, e) { + var i; + const t = e.series, n = $lodash.isArray(e.dataset) && ((i = e.dataset[0]) == null ? void 0 : i.source); + return t && n ? r.selected.flatMap((a) => { + const o = t[a.seriesIndex]; + return !o || !o.encode ? [] : a.dataIndex.map((s) => { + const l = { + seriesName: o.name + }; + return o.encode.itemName && o.encode.value ? Za(sn({}, l), { + itemName: n[s][o.encode.itemName], + value: n[s][o.encode.value] + }) : Za(sn({}, l), { + x: n[s][o.encode.x], + y: n[s][o.encode.y] + }); + }); + }) : []; +} +function Jye(r) { + const e = `${MD}&key=${r}`, t = document.getElementsByTagName("script"); + let n = $lodash.findIndex(t, (a) => a.src.endsWith(e)); + if (n > -1) + return t[n]; + n = $lodash.findIndex(t, (a) => a.src.startsWith(MD)), n > -1 && t[n].remove(); + const i = document.createElement("script"); + return i.type = "text/javascript", i.src = e, i.async = !0, i.defer = !0, window.document.body.appendChild(i), i; +} +Kt([W$, AV]); +const Kye = { + init: function() { + return MA.apply(null, arguments); + } +}; +Kt(k$); +const Qye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Axis: wo, + ChartView: en, + ComponentModel: xr, + ComponentView: Sn, + List: Ui, + Model: qr, + PRIORITY: IA, + SeriesModel: mn, + color: Oj, + connect: E4, + dataTool: R4, + default: Kye, + dependencies: m4, + disConnect: M4, + disconnect: DA, + dispose: D4, + env: Dr, + extendChartView: C$, + extendComponentModel: x$, + extendComponentView: S$, + extendSeriesModel: w$, + format: d$, + getCoordinateSystemDimensions: O4, + getInstanceByDom: am, + getInstanceById: k4, + getMap: P4, + graphic: f$, + helper: o$, + init: MA, + innerDrawElementOnCanvas: Qb, + matrix: mj, + number: c$, + parseGeoJSON: Tg, + parseGeoJson: Tg, + registerAction: os, + registerCoordinateSystem: LA, + registerLayout: PA, + registerLoading: nx, + registerLocale: Vb, + registerMap: NA, + registerPostInit: kA, + registerPostUpdate: OA, + registerPreprocessor: tx, + registerProcessor: rx, + registerTheme: ex, + registerTransform: zA, + registerUpdateLifecycle: om, + registerVisual: cu, + setCanvasCreator: L4, + setPlatformAPI: TI, + throttle: Zh, + time: h$, + use: Kt, + util: v$, + vector: vj, + version: CA, + zrUtil: hj, + zrender: Yj +}, Symbol.toStringTag, { value: "Module" })); +/*! + * echarts-extension-gmap + * @version 1.6.0 + * @author plainheart + * + * MIT License + * + * Copyright (c) 2020-2022 Zhongxiang Wang + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ +var UT = CA.split("."), Td = UT[0] > 4, Ko = "gmap"; +function qye(r, e) { + return r && e && r[0] === e[0] && r[1] === e[1]; +} +function e0e(r, e) { + return e = e || [0, 0], Ke([0, 1], function(t) { + var n = e[t], i = r[t] / 2, a = [], o = []; + return a[t] = n - i, o[t] = n + i, a[1 - t] = o[1 - t] = e[1 - t], Math.abs(this.dataToPoint(a)[t] - this.dataToPoint(o)[t]); + }, this); +} +function Bg(r, e) { + this._gmap = r, this.dimensions = ["lng", "lat"], this._mapOffset = [0, 0], this._api = e; +} +var ao = Bg.prototype, t0e = ["echartsLayerZIndex", "renderOnMoving"]; +ao.setZoom = function(r) { + this._zoom = r; +}; +ao.setCenter = function(r) { + var e = new google.maps.LatLng(r[1], r[0]); + this._center = jV(e, this._gmap); +}; +ao.setMapOffset = function(r) { + this._mapOffset = r; +}; +ao.setGoogleMap = function(r) { + this._gmap = r; +}; +ao.getGoogleMap = function() { + return this._gmap; +}; +ao.dataToPoint = function(r) { + var e = new google.maps.LatLng(r[1], r[0]), t = jV(e, this._gmap), n = this._mapOffset; + return [t.x - n[0], t.y - n[1]]; +}; +ao.pointToData = function(r) { + var e = this._mapOffset, t = n0e(new google.maps.Point(r[0] + e[0], r[1] + e[1]), this._gmap); + return [t.lng(), t.lat()]; +}; +ao.getViewRect = function() { + var r = this._api; + return new Wt(0, 0, r.getWidth(), r.getHeight()); +}; +ao.getRoamTransform = function() { + return io(); +}; +ao.prepareCustoms = function() { + var r = this.getViewRect(); + return { + coordSys: { + type: Ko, + x: r.x, + y: r.y, + width: r.width, + height: r.height + }, + api: { + coord: ft(this.dataToPoint, this), + size: ft(e0e, this) + } + }; +}; +ao.convertToPixel = function(r, e, t) { + return this.dataToPoint(t); +}; +ao.convertFromPixel = function(r, e, t) { + return this.pointToData(t); +}; +Bg.create = function(r, e) { + var t, n = e.getDom(); + return r.eachComponent(Ko, function(i) { + var a = e.getZr().painter, o = a.getViewportRoot(); + if (typeof google == "undefined" || !google.maps || !google.maps.Map) + throw new Error("Google Map API is not loaded"); + if (TC = TC || r0e(), t) + throw new Error("Only one google map component is allowed"); + var s = i.getGoogleMap(); + if (!s) { + var l = "ec-extension-google-map", u = n.querySelector("." + l); + u && (o.style.left = "0", o.style.top = "0", n.removeChild(u)), u = document.createElement("div"), u.className = l, u.style.cssText = "position:absolute;top:0;left:0;right:0;bottom:0", n.appendChild(u); + var c = Ot(i.get()), h = c.echartsLayerZIndex; + X(t0e, function(y) { + delete c[y]; + }); + var f = c.center; + We(f) && (c.center = { + lng: f[0], + lat: f[1] + }), s = new google.maps.Map(u, c), i.setGoogleMap(s), i.__projectionChangeListener && i.__projectionChangeListener.remove(), i.__projectionChangeListener = google.maps.event.addListener(s, "projection_changed", function() { + var y = i.getEChartsLayer(); + y && y.setMap(null); + var x = new TC(o, s); + x.setZIndex(h), i.setEChartsLayer(x); + }), a.getViewportRootOffset = function() { + return { + offsetLeft: 0, + offsetTop: 0 + }; + }; + } + var v = i.get("center"), b = [v.lng != null ? v.lng : v[0], v.lat != null ? v.lat : v[1]], w = i.get("zoom"); + if (v && w) { + var p = s.getCenter(), d = s.getZoom(), m = i.centerOrZoomChanged([p.lng(), p.lat()], d); + if (m) { + var _ = new google.maps.LatLng(b[1], b[0]); + s.setOptions({ + center: _, + zoom: w + }); + } + } + t = new Bg(s, e), t.setMapOffset(i.__mapOffset || [0, 0]), t.setZoom(w), t.setCenter(b), i.coordinateSystem = t; + }), r.eachSeries(function(i) { + i.get("coordinateSystem") === Ko && (i.coordinateSystem = t); + }), t && [t]; +}; +var TC; +function r0e() { + function r(e, t) { + this._root = e, this.setMap(t); + } + return r.prototype = new google.maps.OverlayView(), r.prototype.onAdd = function() { + var e = this.getMap(); + e.__overlayProjection = this.getProjection(), e.getDiv().querySelector(".gm-style > div").appendChild(this._root); + }, r.prototype.draw = function() { + google.maps.event.trigger(this.getMap(), "gmaprender"); + }, r.prototype.onRemove = function() { + this._root.parentNode.removeChild(this._root), this._root = null; + }, r.prototype.setZIndex = function(e) { + this._root.style.zIndex = e; + }, r.prototype.getZIndex = function() { + return this._root.style.zIndex; + }, r; +} +function jV(r, e) { + var t = e.__overlayProjection; + return t ? t.fromLatLngToContainerPixel(r) : new google.maps.Point(-1 / 0, -1 / 0); +} +function n0e(r, e) { + var t = e.__overlayProjection; + return t ? t.fromContainerPixelToLatLng(r) : new google.maps.Point(-1 / 0, -1 / 0); +} +ao.dimensions = Bg.dimensions = ["lng", "lat"]; +ao.type = Ko; +var BN = { + type: Ko, + setGoogleMap: function(e) { + this.__gmap = e; + }, + getGoogleMap: function() { + return this.__gmap; + }, + setEChartsLayer: function(e) { + this.__echartsLayer = e; + }, + getEChartsLayer: function() { + return this.__echartsLayer; + }, + setCenterAndZoom: function(e, t) { + this.option.center = e, this.option.zoom = t; + }, + centerOrZoomChanged: function(e, t) { + var n = this.option; + return !(qye(e, n.center) && t === n.zoom); + }, + defaultOption: { + center: { + lat: 39.90923, + lng: 116.397428 + }, + zoom: 5, + // extension options + // since v1.4.0 + roam: !0, + echartsLayerZIndex: 2e3, + renderOnMoving: !0 + } +}, jN = Td ? xr.extend(BN) : BN, FN = { + type: Ko, + render: function(e, t, n) { + var i = !0, a = e.getGoogleMap(), o = n.getZr().painter.getViewportRoot(), s = e.coordinateSystem, l = e.get("renderOnMoving"), u = a.getDiv(), c = u.firstChild, h = c.clientWidth, f = c.clientHeight, v = function() { + if (!i) { + if (c.clientWidth !== h || c.clientHeight !== f) + return b(); + var p = [-parseInt(u.style.left, 10) || 0, -parseInt(u.style.top, 10) || 0]; + o.style.left = p[0] + "px", o.style.top = p[1] + "px", s.setMapOffset(p), e.__mapOffset = p, n.dispatchAction({ + type: Ko + "Roam", + animation: { + // in ECharts 5.x, + // we can set animation duration as 0 + // to ensure no delay when moving or zooming + duration: 0 + } + }); + } + }, b = function() { + am(n.getDom()).resize({ + width: c.clientWidth, + height: c.clientHeight + }); + }; + this._renderHandler && this._renderHandler.remove(), l || (v = Zh(v, 100, !0), b = Zh(b, 100, !0)), this._renderHandler = google.maps.event.addListener(a, l ? "gmaprender" : "idle", v), a.setOptions({ + gestureHandling: e.get("roam") ? "auto" : "none" + }), i = !1; + }, + dispose: function() { + this._renderHandler && this._renderHandler.remove(), delete this._renderHandler; + var e = this.__model; + if (e) { + var t = e.getGoogleMap(); + if (t) { + delete t.__overlayProjection, google.maps.event.clearInstanceListeners(t); + var n = t.getDiv(); + n.parentNode && n.parentNode.removeChild(n); + } + e.setGoogleMap(null), e.setEChartsLayer(null), e.coordinateSystem && (e.coordinateSystem.setGoogleMap(null), e.coordinateSystem = null); + } + } +}, $N = Td ? Sn.extend(FN) : FN; +function HN(r) { + (!Td || UT[0] == 5 && UT[1] < 4) && r.registerLayout(function(e) { + e.eachSeriesByType("pie", function(t) { + var n = t.coordinateSystem, i = t.getData(), a = i.mapDimension("value"); + if (n && n.type === Ko) { + var o = t.get("center"), s = n.dataToPoint(o), l = s[0], u = s[1]; + i.each(a, function(c, h) { + var f = i.getItemLayout(h); + f.cx = l, f.cy = u; + }); + } + }); + }), Td ? r.registerComponentModel(jN) : r.extendComponentModel(jN), Td ? r.registerComponentView($N) : r.extendComponentView($N), r.registerCoordinateSystem(Ko, Bg), r.registerAction({ + type: Ko + "Roam", + event: Ko + "Roam", + update: "updateLayout" + }, function(e, t) { + t.eachComponent(Ko, function(n) { + var i = n.getGoogleMap(), a = i.getCenter(); + n.setCenterAndZoom([a.lng(), a.lat()], i.getZoom()); + }); + }); +} +Td ? Kt(HN) : HN(Qye); +let Hd = function() { + return new $lowcoder_sdk.UICompBuilder(JB, () => null).setPropertyViewFn(lY).build(); +}(); +Hd = $lowcoder_sdk.withViewFn(Hd, (r) => { + const e = $react.useRef(), [t, n] = $react.useState(), [i, a] = $react.useState(!1), o = $react.useRef(!0), s = $react.useContext($lowcoder_sdk.ThemeContext), l = { + color: $lowcoder_sdk.chartColorPalette, + backgroundColor: "#fff" + }; + let u = l; + try { + u = s != null && s.theme.chart ? JSON.parse(s == null ? void 0 : s.theme.chart) : l; + } catch (d) { + RV.error("theme chart error: ", d); + } + const c = r.children.onEvent.getView(); + $react.useEffect(() => { + var m; + const d = (m = e == null ? void 0 : e.current) == null ? void 0 : m.getEchartsInstance(); + return d ? (d == null || d.on("selectchanged", (_) => { + const y = d == null ? void 0 : d.getOption(); + _.fromAction === "select" ? (r.dispatch(wp("selectedPoints", zN(_, y))), c("select")) : _.fromAction === "unselect" && (r.dispatch(wp("selectedPoints", zN(_, y))), c("unselect")); + }), () => d == null ? void 0 : d.off("selectchanged")) : $lodash.noop; + }, [c]); + const h = $lodash.omit(r.children, Yye), f = $react.useMemo(() => Zye($lowcoder_sdk.childrenToProps(h), t), [t, ...Object.values(h)]), v = $react.useMemo(() => i || (window == null ? void 0 : window.google), [i]), b = () => { + setTimeout(() => { + var _, y, x; + a(!0); + const d = (_ = e == null ? void 0 : e.current) == null ? void 0 : _.getEchartsInstance(); + if (!d) + return $lodash.noop; + const m = (x = (y = d == null ? void 0 : d.getModel()) == null ? void 0 : y.getComponent("gmap")) == null ? void 0 : x.getGoogleMap(); + r.dispatch(wp("mapInstance", m)); + }, 1e3); + }, w = r.children.mapApiKey.getView(), p = r.children.mode.getView(); + return $react.useEffect(() => { + if (console.log(f), p !== "map") { + r.dispatch(wp("mapInstance", void 0)); + return; + } + const d = Jye(w); + if (v) { + b(); + return; + } + d.addEventListener("load", function() { + b(); + }); + }, [p, w, f]), /* @__PURE__ */ Bt(tj, { + onResize: (d, m) => { + var _; + d && m && n({ + w: d, + h: m + }), o.current ? o.current = !1 : (_ = e.current) == null || _.getEchartsInstance().resize(); + }, + children: (p !== "map" || p === "map" && v) && /* @__PURE__ */ Bt(Rye, { + ref: (d) => e.current = d, + style: { + height: "100%" + }, + notMerge: !0, + lazyUpdate: !0, + opts: { + locale: f6() + }, + option: f, + theme: p !== "map" ? u : void 0, + mode: p + }) + }); +}); +function i0e(r, e, t) { + const n = t && r.length > 0 && r[0][t]; + let i = n; + if (e === "time") { + const a = typeof n == "number" || typeof n == "string" ? new Date(n).getTime() : null; + a && (i = a); + } + return i; +} +Hd = class extends Hd { + updateContext(r) { + let e = r; + const t = r.children.data.getView(), n = r.children.series.getView().find((o) => !o.getView().hide), i = i0e(t, r.children.yConfig.children.yAxisType.getView(), n == null ? void 0 : n.children.columnName.getView()); + i !== r.lastYAxisFormatContextVal && (r.lastYAxisFormatContextVal = i, e = r.setChild("yConfig", r.children.yConfig.reduce(gd("formatter", WB.changeContextDataAction({ + value: i + }))))); + const a = { + seriesName: n == null ? void 0 : n.children.seriesName.getView(), + value: i + }; + return r.children.chartConfig.children.comp.children.hasOwnProperty("itemColor") && !$lodash.isEqual(a, r.lastColorContext) && (r.lastColorContext = a, e = e.setChild("chartConfig", r.children.chartConfig.reduce(gd("comp", gd("itemColor", YB.changeContextDataAction(a)))))), e; + } + reduce(r) { + const e = super.reduce(r); + if (r.type === ha.UPDATE_NODES_V2) { + const t = e.children.data.getView(); + return e.children.data !== this.children.data && setTimeout(() => { + const n = ZB(t); + n.length > 0 && !n.includes(e.children.xAxisKey.getView()) && e.children.xAxisKey.dispatch(pI(n[0] || "")), e.children.series.dispatchDataChanged(t); + }, 0), this.updateContext(e); + } + return e; + } + autoHeight() { + return !1; + } +}; +let FV = $lowcoder_sdk.withExposingConfigs(Hd, [$lowcoder_sdk.depsConfig({ + name: "selectedPoints", + desc: Ye("chart.selectedPointsDesc"), + depKeys: ["selectedPoints"], + func: (r) => r.selectedPoints +}), $lowcoder_sdk.depsConfig({ + name: "data", + desc: Ye("chart.dataDesc"), + depKeys: ["data", "mode"], + func: (r) => r.mode === "ui" ? r.data : [] +}), $lowcoder_sdk.depsConfig({ + name: "mapInstance", + desc: "Echarts map instance", + depKeys: ["mapInstance"], + func: (r) => r.mapInstance +}), new $lowcoder_sdk.NameConfig("title", Ye("chart.titleDesc"))]); +FV = $lowcoder_sdk.withMethodExposing(Hd, [{ + method: { + name: "getMapInstance" + }, + execute: (r) => new Promise((e) => { + console.log(r.children.mapInstance.getView()), e(r.children.mapInstance.getView()); + }) +}]); +const a0e = $lowcoder_sdk.withDefault(FV, { + xAxisKey: "date", + series: [{ + dataIndex: $lowcoder_sdk.genRandomKey(), + seriesName: Ye("chart.spending"), + columnName: "spending" + }, { + dataIndex: $lowcoder_sdk.genRandomKey(), + seriesName: Ye("chart.budget"), + columnName: "budget" + }] +}), o0e = { + label: Ye("imageEditor.save"), + value: "save", + description: Ye("imageEditor.saveDesc") +}, s0e = $styled_components.div` + height: 100%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + .tui-image-editor-container.top .tui-image-editor-controls-logo { + display: none; + } + .tui-image-editor-container .tui-image-editor-header-logo, + .tui-image-editor-container .tui-image-editor-controls-logo { + display: none; + } + .tui-image-editor-container .tui-image-editor-header-buttons button, + .tui-image-editor-container .tui-image-editor-header-buttons div, + .tui-image-editor-container .tui-image-editor-controls-buttons button, + .tui-image-editor-container .tui-image-editor-controls-buttons div { + display: none; + } + .tie-btn-hand { + display: none !important; + } + .tui-image-editor-container .tui-image-editor-menu, + .tui-image-editor-container .tui-image-editor-help-menu { + background-color: #f3f4f6 !important; + } +`, l0e = $styled_components($antd.Button)` + position: absolute; + right: 8px; + bottom: 4px; + z-index: 100; +`, u0e = { + // image + "common.bi.image": "", + "common.bisize.width": "0px", + "common.bisize.height": "0px", + "common.backgroundImage": "none", + "common.backgroundColor": "#f3f4f6", + "common.border": "1px solid #444", + // header + "header.backgroundImage": "none", + "header.backgroundColor": "#f3f4f6", + "header.border": "0px", + "header.display": "none", + // icons default + "menu.normalIcon.color": "#8a8a8a", + "menu.activeIcon.color": "#555555", + "menu.disabledIcon.color": "#434343", + "menu.hoverIcon.color": "#e9e9e9", + "submenu.normalIcon.color": "#8a8a8a", + "submenu.activeIcon.color": "#e9e9e9", + "menu.iconSize.width": "24px", + "menu.iconSize.height": "24px", + "submenu.iconSize.width": "32px", + "submenu.iconSize.height": "32px", + // submenu primary color + "submenu.backgroundColor": "#1e1e1e", + "submenu.partition.color": "#858585", + // submenu labels + "submenu.normalLabel.color": "#858585", + "submenu.normalLabel.fontWeight": "lighter", + "submenu.activeLabel.color": "#fff", + "submenu.activeLabel.fontWeight": "lighter", + // checkbox style + "checkbox.border": "1px solid #ccc", + "checkbox.backgroundColor": "#fff", + // rango style + "range.pointer.color": "#fff", + "range.bar.color": "#666", + "range.subbar.color": "#d1d1d1", + "range.disabledPointer.color": "#414141", + "range.disabledBar.color": "#282828", + "range.disabledSubbar.color": "#414141", + "range.value.color": "#fff", + "range.value.fontWeight": "lighter", + "range.value.fontSize": "11px", + "range.value.border": "1px solid #353535", + "range.value.backgroundColor": "#151515", + "range.title.color": "#fff", + "range.title.fontWeight": "lighter", + // colorpicker style + "colorpicker.button.border": "1px solid #1e1e1e", + "colorpicker.title.color": "#fff" +}; +var $V = { exports: {} }, IC = { exports: {} }; +/*! + * TOAST UI Color Picker + * @version 2.2.8 + * @author NHN Cloud FE Development Team + * @license MIT + */ +var VN; +function c0e() { + return VN || (VN = 1, function(r, e) { + (function(n, i) { + r.exports = i(); + })(window, function() { + return ( + /******/ + function(t) { + var n = {}; + function i(a) { + if (n[a]) + return n[a].exports; + var o = n[a] = { + /******/ + i: a, + /******/ + l: !1, + /******/ + exports: {} + /******/ + }; + return t[a].call(o.exports, o, o.exports, i), o.l = !0, o.exports; + } + return i.m = t, i.c = n, i.d = function(a, o, s) { + i.o(a, o) || Object.defineProperty(a, o, { enumerable: !0, get: s }); + }, i.r = function(a) { + typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(a, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(a, "__esModule", { value: !0 }); + }, i.t = function(a, o) { + if (o & 1 && (a = i(a)), o & 8 || o & 4 && typeof a == "object" && a && a.__esModule) + return a; + var s = /* @__PURE__ */ Object.create(null); + if (i.r(s), Object.defineProperty(s, "default", { enumerable: !0, value: a }), o & 2 && typeof a != "string") + for (var l in a) + i.d(s, l, function(u) { + return a[u]; + }.bind(null, l)); + return s; + }, i.n = function(a) { + var o = a && a.__esModule ? ( + /******/ + function() { + return a.default; + } + ) : ( + /******/ + function() { + return a; + } + ); + return i.d(o, "a", o), o; + }, i.o = function(a, o) { + return Object.prototype.hasOwnProperty.call(a, o); + }, i.p = "dist", i(i.s = 33); + }([ + /* 0 */ + /***/ + function(t, n, i) { + function a(o, s) { + var l = Object.prototype.hasOwnProperty, u, c, h, f; + for (h = 1, f = arguments.length; h < f; h += 1) { + u = arguments[h]; + for (c in u) + l.call(u, c) && (o[c] = u[c]); + } + return o; + } + t.exports = a; + }, + /* 1 */ + /***/ + function(t, n, i) { + function a(o) { + return o instanceof Array; + } + t.exports = a; + }, + /* 2 */ + /***/ + function(t, n, i) { + var a = i(1), o = i(6), s = i(7); + function l(u, c, h) { + a(u) ? o(u, c, h) : s(u, c, h); + } + t.exports = l; + }, + /* 3 */ + /***/ + function(t, n, i) { + function a(o) { + return o === void 0; + } + t.exports = a; + }, + /* 4 */ + /***/ + function(t, n, i) { + var a = i(22), o = i(2), s = i(6), l = i(7), u = i(37), c = 0, h = { + /** + * Get the number of properties in the object. + * @param {Object} obj - object + * @returns {number} + */ + getLength: function(f) { + var v = 0; + return l(f, function() { + v += 1; + }), v; + }, + /** + * Constructs a new array by executing the provided callback function. + * @param {Object|Array} obj - object or array to be traversed + * @param {function} iteratee - callback function + * @param {Object} context - context of callback function + * @returns {Array} + */ + map: function(f, v, b) { + var w = []; + return o(f, function() { + w.push(v.apply(b || null, arguments)); + }), w; + }, + /** + * Construct a new array with elements that pass the test by the provided callback function. + * @param {Array|NodeList|Arguments} arr - array to be traversed + * @param {function} iteratee - callback function + * @param {Object} context - context of callback function + * @returns {Array} + */ + filter: function(f, v, b) { + var w = []; + return s(f, function(p) { + v.apply(b || null, arguments) && w.push(p); + }), w; + }, + /** + * Create an unique id for a color-picker instance. + * @returns {number} + */ + generateId: function() { + return c += 1, c; + }, + /** + * True when browser is below IE8. + */ + isOldBrowser: function() { + return a.msie && a.version < 9; + }(), + /** + * send host name + * @ignore + */ + sendHostName: function() { + u("color-picker", "UA-129987462-1"); + } + }; + t.exports = h; + }, + /* 5 */ + /***/ + function(t, n, i) { + var a = i(1); + function o(s, l, u) { + var c, h; + if (u = u || 0, !a(l)) + return -1; + if (Array.prototype.indexOf) + return Array.prototype.indexOf.call(l, s, u); + for (h = l.length, c = u; u >= 0 && c < h; c += 1) + if (l[c] === s) + return c; + return -1; + } + t.exports = o; + }, + /* 6 */ + /***/ + function(t, n, i) { + function a(o, s, l) { + var u = 0, c = o.length; + for (l = l || null; u < c && s.call(l, o[u], u, o) !== !1; u += 1) + ; + } + t.exports = a; + }, + /* 7 */ + /***/ + function(t, n, i) { + function a(o, s, l) { + var u; + l = l || null; + for (u in o) + if (o.hasOwnProperty(u) && s.call(l, o[u], u, o) === !1) + break; + } + t.exports = a; + }, + /* 8 */ + /***/ + function(t, n, i) { + var a = i(39), o = i(13), s = i(41), l = i(3), u = i(9), c = i(19), h = i(4); + function f(v, b) { + var w = h.generateId(); + l(b) && (b = u.appendHTMLElement("div")), a(b, "tui-view-" + w), this.id = w, this.container = b, this.childs = new c(function(p) { + return p.id; + }), this.parent = null; + } + f.prototype.addChild = function(v, b) { + b && b.call(v, this), v.parent = this, this.childs.add(v); + }, f.prototype.removeChild = function(v, b) { + var w = s(v) ? this.childs.items[v] : v; + b && b.call(w, this), this.childs.remove(w.id); + }, f.prototype.render = function() { + this.childs.each(function(v) { + v.render(); + }); + }, f.prototype.recursive = function(v, b) { + o(v) && (b || v(this), this.childs.each(function(w) { + w.recursive(v); + })); + }, f.prototype.resize = function() { + for (var v = Array.prototype.slice.call(arguments), b = this.parent; b; ) + o(b._onResize) && b._onResize.apply(b, v), b = b.parent; + }, f.prototype._beforeDestroy = function() { + }, f.prototype._destroy = function() { + this._beforeDestroy(), this.container.innerHTML = "", this.id = this.parent = this.childs = this.container = null; + }, f.prototype.destroy = function(v) { + this.childs && (this.childs.each(function(b) { + b.destroy(!0), b._destroy(); + }), this.childs.clear()), !v && this._destroy(); + }, f.prototype.getViewBound = function() { + var v = this.container.getBoundingClientRect(); + return { + x: v.left, + y: v.top, + width: v.right - v.left, + height: v.bottom - v.top + }; + }, t.exports = f; + }, + /* 9 */ + /***/ + function(t, n, i) { + var a = { + /** + * Create DOM element and return it. + * @param {string} tagName Tag name to append. + * @param {HTMLElement} [container] HTML element will be parent to created element. + * if not supplied, will use **document.body** + * @param {string} [className] Design class names to appling created element. + * @returns {HTMLElement} HTML element created. + */ + appendHTMLElement: function(o, s, l) { + var u = document.createElement(o); + return u.className = l || "", s ? s.appendChild(u) : document.body.appendChild(u), u; + } + }; + t.exports = a; + }, + /* 10 */ + /***/ + function(t, n, i) { + var a = i(0), o = i(20), s = i(11), l = i(21), u = i(1), c = i(13), h = i(2), f = /\s+/g; + function v() { + this.events = null, this.contexts = null; + } + v.mixin = function(b) { + a(b.prototype, v.prototype); + }, v.prototype._getHandlerItem = function(b, w) { + var p = { handler: b }; + return w && (p.context = w), p; + }, v.prototype._safeEvent = function(b) { + var w = this.events, p; + return w || (w = this.events = {}), b && (p = w[b], p || (p = [], w[b] = p), w = p), w; + }, v.prototype._safeContext = function() { + var b = this.contexts; + return b || (b = this.contexts = []), b; + }, v.prototype._indexOfContext = function(b) { + for (var w = this._safeContext(), p = 0; w[p]; ) { + if (b === w[p][0]) + return p; + p += 1; + } + return -1; + }, v.prototype._memorizeContext = function(b) { + var w, p; + o(b) && (w = this._safeContext(), p = this._indexOfContext(b), p > -1 ? w[p][1] += 1 : w.push([b, 1])); + }, v.prototype._forgetContext = function(b) { + var w, p; + o(b) && (w = this._safeContext(), p = this._indexOfContext(b), p > -1 && (w[p][1] -= 1, w[p][1] <= 0 && w.splice(p, 1))); + }, v.prototype._bindEvent = function(b, w, p) { + var d = this._safeEvent(b); + this._memorizeContext(p), d.push(this._getHandlerItem(w, p)); + }, v.prototype.on = function(b, w, p) { + var d = this; + s(b) ? (b = b.split(f), h(b, function(m) { + d._bindEvent(m, w, p); + })) : l(b) && (p = w, h(b, function(m, _) { + d.on(_, m, p); + })); + }, v.prototype.once = function(b, w, p) { + var d = this; + if (l(b)) { + p = w, h(b, function(_, y) { + d.once(y, _, p); + }); + return; + } + function m() { + w.apply(p, arguments), d.off(b, m, p); + } + this.on(b, m, p); + }, v.prototype._spliceMatches = function(b, w) { + var p = 0, d; + if (u(b)) + for (d = b.length; p < d; p += 1) + w(b[p]) === !0 && (b.splice(p, 1), d -= 1, p -= 1); + }, v.prototype._matchHandler = function(b) { + var w = this; + return function(p) { + var d = b === p.handler; + return d && w._forgetContext(p.context), d; + }; + }, v.prototype._matchContext = function(b) { + var w = this; + return function(p) { + var d = b === p.context; + return d && w._forgetContext(p.context), d; + }; + }, v.prototype._matchHandlerAndContext = function(b, w) { + var p = this; + return function(d) { + var m = b === d.handler, _ = w === d.context, y = m && _; + return y && p._forgetContext(d.context), y; + }; + }, v.prototype._offByEventName = function(b, w) { + var p = this, d = c(w), m = p._matchHandler(w); + b = b.split(f), h(b, function(_) { + var y = p._safeEvent(_); + d ? p._spliceMatches(y, m) : (h(y, function(x) { + p._forgetContext(x.context); + }), p.events[_] = []); + }); + }, v.prototype._offByHandler = function(b) { + var w = this, p = this._matchHandler(b); + h(this._safeEvent(), function(d) { + w._spliceMatches(d, p); + }); + }, v.prototype._offByObject = function(b, w) { + var p = this, d; + this._indexOfContext(b) < 0 ? h(b, function(m, _) { + p.off(_, m); + }) : s(w) ? (d = this._matchContext(b), p._spliceMatches(this._safeEvent(w), d)) : c(w) ? (d = this._matchHandlerAndContext(w, b), h(this._safeEvent(), function(m) { + p._spliceMatches(m, d); + })) : (d = this._matchContext(b), h(this._safeEvent(), function(m) { + p._spliceMatches(m, d); + })); + }, v.prototype.off = function(b, w) { + s(b) ? this._offByEventName(b, w) : arguments.length ? c(b) ? this._offByHandler(b) : l(b) && this._offByObject(b, w) : (this.events = {}, this.contexts = []); + }, v.prototype.fire = function(b) { + this.invoke.apply(this, arguments); + }, v.prototype.invoke = function(b) { + var w, p, d, m; + if (!this.hasListener(b)) + return !0; + for (w = this._safeEvent(b), p = Array.prototype.slice.call(arguments, 1), d = 0; w[d]; ) { + if (m = w[d], m.handler.apply(m.context, p) === !1) + return !1; + d += 1; + } + return !0; + }, v.prototype.hasListener = function(b) { + return this.getListenerLength(b) > 0; + }, v.prototype.getListenerLength = function(b) { + var w = this._safeEvent(b); + return w.length; + }, t.exports = v; + }, + /* 11 */ + /***/ + function(t, n, i) { + function a(o) { + return typeof o == "string" || o instanceof String; + } + t.exports = a; + }, + /* 12 */ + /***/ + function(t, n, i) { + var a = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, o = { + /** + * pad left zero characters. + * @param {number} number number value to pad zero. + * @param {number} length pad length to want. + * @returns {string} padded string. + */ + leadingZero: function(s, l) { + var u = "", c = 0; + if ((s + "").length > l) + return s + ""; + for (; c < l - 1; c += 1) + u += "0"; + return (u + s).slice(l * -1); + }, + /** + * Check validate of hex string value is RGB + * @param {string} str - rgb hex string + * @returns {boolean} return true when supplied str is valid RGB hex string + */ + isValidRGB: function(s) { + return a.test(s); + }, + // @license RGB <-> HSV conversion utilities based off of http://www.cs.rit.edu/~ncs/color/t_convert.html + /** + * Convert color hex string to rgb number array + * @param {string} hexStr - hex string + * @returns {number[]} rgb numbers + */ + hexToRGB: function(s) { + var l, u, c; + return o.isValidRGB(s) ? (s = s.substring(1), l = parseInt(s.substr(0, 2), 16), u = parseInt(s.substr(2, 2), 16), c = parseInt(s.substr(4, 2), 16), [l, u, c]) : !1; + }, + /** + * Convert rgb number to hex string + * @param {number} r - red + * @param {number} g - green + * @param {number} b - blue + * @returns {string|boolean} return false when supplied rgb number is not valid. otherwise, converted hex string + */ + rgbToHEX: function(s, l, u) { + var c = "#" + o.leadingZero(s.toString(16), 2) + o.leadingZero(l.toString(16), 2) + o.leadingZero(u.toString(16), 2); + return o.isValidRGB(c) ? c : !1; + }, + /** + * Convert rgb number to HSV value + * @param {number} r - red + * @param {number} g - green + * @param {number} b - blue + * @returns {number[]} hsv value + */ + rgbToHSV: function(s, l, u) { + var c, h, f, v, b, w; + if (s /= 255, l /= 255, u /= 255, c = Math.max(s, l, u), h = Math.min(s, l, u), b = c, w = c - h, v = c === 0 ? 0 : w / c, c === h) + f = 0; + else { + switch (c) { + case s: + f = (l - u) / w + (l < u ? 6 : 0); + break; + case l: + f = (u - s) / w + 2; + break; + case u: + f = (s - l) / w + 4; + break; + } + f /= 6; + } + return [Math.round(f * 360), Math.round(v * 100), Math.round(b * 100)]; + }, + /** + * Convert HSV number to RGB + * @param {number} h - hue + * @param {number} s - saturation + * @param {number} v - value + * @returns {number[]} rgb value + */ + hsvToRGB: function(s, l, u) { + var c, h, f, v, b, w, p, d; + if (s = Math.max(0, Math.min(360, s)), l = Math.max(0, Math.min(100, l)), u = Math.max(0, Math.min(100, u)), l /= 100, u /= 100, l === 0) + return c = h = f = u, [Math.round(c * 255), Math.round(h * 255), Math.round(f * 255)]; + switch (s /= 60, v = Math.floor(s), b = s - v, w = u * (1 - l), p = u * (1 - l * b), d = u * (1 - l * (1 - b)), v) { + case 0: + c = u, h = d, f = w; + break; + case 1: + c = p, h = u, f = w; + break; + case 2: + c = w, h = u, f = d; + break; + case 3: + c = w, h = p, f = u; + break; + case 4: + c = d, h = w, f = u; + break; + default: + c = u, h = w, f = p; + break; + } + return [Math.round(c * 255), Math.round(h * 255), Math.round(f * 255)]; + } + }; + t.exports = o; + }, + /* 13 */ + /***/ + function(t, n, i) { + function a(o) { + return o instanceof Function; + } + t.exports = a; + }, + /* 14 */ + /***/ + function(t, n, i) { + var a = i(11), o = i(2), s = i(26); + function l(h, f, v, b) { + if (a(f)) { + o(f.split(/\s+/g), function(w) { + u(h, w, v, b); + }); + return; + } + o(f, function(w, p) { + u(h, p, w, v); + }); + } + function u(h, f, v, b) { + function w(p) { + v.call(b || h, p || window.event); + } + "addEventListener" in h ? h.addEventListener(f, w) : "attachEvent" in h && h.attachEvent("on" + f, w), c(h, f, v, w); + } + function c(h, f, v, b) { + var w = s(h, f), p = !1; + o(w, function(d) { + return d.handler === v ? (p = !0, !1) : !0; + }), p || w.push({ + handler: v, + wrappedHandler: b + }); + } + t.exports = l; + }, + /* 15 */ + /***/ + function(t, n, i) { + function a(o) { + if (o.preventDefault) { + o.preventDefault(); + return; + } + o.returnValue = !1; + } + t.exports = a; + }, + /* 16 */ + /***/ + function(t, n, i) { + function a(o) { + return o.replace(/([A-Z])/g, function(s) { + return "-" + s.toLowerCase(); + }); + } + t.exports = a; + }, + /* 17 */ + /***/ + function(t, n, i) { + var a = i(11), o = i(2), s = i(26); + function l(h, f, v) { + if (a(f)) { + o(f.split(/\s+/g), function(b) { + u(h, b, v); + }); + return; + } + o(f, function(b, w) { + u(h, w, b); + }); + } + function u(h, f, v) { + var b = s(h, f), w; + v ? (o(b, function(p, d) { + return v === p.handler ? (c(h, f, p.wrappedHandler), w = d, !1) : !0; + }), b.splice(w, 1)) : (o(b, function(p) { + c(h, f, p.wrappedHandler); + }), b.splice(0, b.length)); + } + function c(h, f, v) { + "removeEventListener" in h ? h.removeEventListener(f, v) : "detachEvent" in h && h.detachEvent("on" + f, v); + } + t.exports = l; + }, + /* 18 */ + /***/ + function(t, n, i) { + var a = i(50); + function o(s, l) { + var u = a(l.prototype); + u.constructor = s, s.prototype = u; + } + t.exports = o; + }, + /* 19 */ + /***/ + function(t, n, i) { + var a = i(6), o = i(7), s = i(0), l = i(1), u = i(20), c = i(13), h = i(21), f = i(4), v = Array.prototype.slice; + function b(w) { + this.items = {}, this.length = 0, c(w) && (this.getItemID = w); + } + b.and = function(w) { + var p; + return w = v.call(arguments), p = w.length, function(d) { + for (var m = 0; m < p; m += 1) + if (!w[m].call(null, d)) + return !1; + return !0; + }; + }, b.or = function(w) { + var p; + return w = v.call(arguments), p = w.length, function(d) { + for (var m = 1, _ = w[0].call(null, d); m < p; m += 1) + _ = _ || w[m].call(null, d); + return _; + }; + }, b.merge = function(w) { + var p = {}, d = new b(w.getItemID); + return a(arguments, function(m) { + s(p, m.items); + }), d.items = p, d.length = f.getLength(d.items), d; + }, b.prototype.getItemID = function(w) { + return w._id + ""; + }, b.prototype.add = function(w) { + var p, d; + if (arguments.length > 1) { + a(v.call(arguments), function(m) { + this.add(m); + }, this); + return; + } + p = this.getItemID(w), d = this.items, d[p] || (this.length += 1), d[p] = w; + }, b.prototype.remove = function(w) { + var p = [], d, m; + return this.length ? arguments.length > 1 ? (p = f.map(v.call(arguments), function(_) { + return this.remove(_); + }, this), p) : (d = this.items, h(w) && (w = this.getItemID(w)), d[w] ? (this.length -= 1, m = d[w], delete d[w], m) : p) : p; + }, b.prototype.clear = function() { + this.items = {}, this.length = 0; + }, b.prototype.has = function(w) { + var p, d; + return this.length ? (p = c(w), d = !1, p ? this.each(function(m) { + return w(m) === !0 ? (d = !0, !1) : !0; + }) : (w = h(w) ? this.getItemID(w) : w, d = u(this.items[w])), d) : !1; + }, b.prototype.doWhenHas = function(w, p, d) { + var m = this.items[w]; + u(m) && p.call(d || this, m); + }, b.prototype.find = function(w) { + var p = new b(); + return this.hasOwnProperty("getItemID") && (p.getItemID = this.getItemID), this.each(function(d) { + w(d) === !0 && p.add(d); + }), p; + }, b.prototype.groupBy = function(w, p) { + var d = {}, m = c(w), _ = this.getItemID, y, x; + if (l(w)) { + if (a(w, function(g) { + d[g + ""] = new b(_); + }), !p) + return d; + w = p, m = !0; + } + return this.each(function(g) { + m ? x = w(g) : (x = g[w], c(x) && (x = x.apply(g))), y = d[x], y || (y = d[x] = new b(_)), y.add(g); + }), d; + }, b.prototype.single = function() { + var w; + return this.each(function(p) { + return w = p, !1; + }, this), w; + }, b.prototype.sort = function(w) { + var p = []; + return this.each(function(d) { + p.push(d); + }), c(w) && (p = p.sort(w)), p; + }, b.prototype.each = function(w, p) { + o(this.items, w, p || this); + }, b.prototype.toArray = function() { + return this.length ? f.map(this.items, function(w) { + return w; + }) : []; + }, t.exports = b; + }, + /* 20 */ + /***/ + function(t, n, i) { + var a = i(3), o = i(36); + function s(l) { + return !a(l) && !o(l); + } + t.exports = s; + }, + /* 21 */ + /***/ + function(t, n, i) { + function a(o) { + return o === Object(o); + } + t.exports = a; + }, + /* 22 */ + /***/ + function(t, n, i) { + var a = { + chrome: !1, + firefox: !1, + safari: !1, + msie: !1, + edge: !1, + others: !1, + version: 0 + }; + typeof window != "undefined" && window.navigator && o(); + function o() { + var s = window.navigator, l = s.appName.replace(/\s/g, "_"), u = s.userAgent, c = /MSIE\s([0-9]+[.0-9]*)/, h = /Trident.*rv:11\./, f = /Edge\/(\d+)\./, v = { + firefox: /Firefox\/(\d+)\./, + chrome: /Chrome\/(\d+)\./, + safari: /Version\/([\d.]+).*Safari\/(\d+)/ + }, b, w, p = { + Microsoft_Internet_Explorer: function() { + var m = u.match(c); + m ? (a.msie = !0, a.version = parseFloat(m[1])) : a.others = !0; + }, + Netscape: function() { + var m = !1; + if (h.exec(u)) + a.msie = !0, a.version = 11, m = !0; + else if (f.exec(u)) + a.edge = !0, a.version = u.match(f)[1], m = !0; + else + for (b in v) + if (v.hasOwnProperty(b) && (w = u.match(v[b]), w && w.length > 1)) { + a[b] = m = !0, a.version = parseFloat(w[1] || 0); + break; + } + m || (a.others = !0); + } + }, d = p[l]; + d && p[l](); + } + t.exports = a; + }, + /* 23 */ + /***/ + function(t, n, i) { + var a = i(3); + function o(s) { + return !s || !s.className ? "" : a(s.className.baseVal) ? s.className : s.className.baseVal; + } + t.exports = o; + }, + /* 24 */ + /***/ + function(t, n, i) { + (function(a) { + var o = i(10), s = i(42), l = i(44), u = i(47), c = i(28), h = i(17), f = i(14), v = i(15), b = i(0); + function w(p, d) { + f(d, "mousedown", this._onMouseDown, this), this.options = b({ + distance: 10 + }, p), this.container = d, this._isMoved = !1, this._distance = 0, this._dragStartFired = !1, this._dragStartEventData = null; + } + w.prototype.destroy = function() { + h(this.container, "mousedown", this._onMouseDown), this.options = this.container = this._isMoved = this._distance = this._dragStartFired = this._dragStartEventData = null; + }, w.prototype._toggleDragEvent = function(p) { + var d = this.container; + p ? (s(d), f(window, "dragstart", v), f(a.document, { + mousemove: this._onMouseMove, + mouseup: this._onMouseUp + }, this)) : (l(d), h(window, "dragstart", v), h(a.document, { + mousemove: this._onMouseMove, + mouseup: this._onMouseUp + })); + }, w.prototype._getEventData = function(p) { + return { + target: c(p), + originEvent: p + }; + }, w.prototype._onMouseDown = function(p) { + u(p) === 0 && (this._distance = 0, this._dragStartFired = !1, this._dragStartEventData = this._getEventData(p), this._toggleDragEvent(!0)); + }, w.prototype._onMouseMove = function(p) { + var d = this.options.distance; + if (v(p), this._isMoved = !0, this._distance < d) { + this._distance += 1; + return; + } + if (!this._dragStartFired && (this._dragStartFired = !0, !this.invoke("dragStart", this._dragStartEventData))) { + this._toggleDragEvent(!1); + return; + } + this.fire("drag", this._getEventData(p)); + }, w.prototype._onMouseUp = function(p) { + if (this._toggleDragEvent(!1), this._isMoved) { + this._isMoved = !1, this.fire("dragEnd", this._getEventData(p)); + return; + } + this.fire("click", this._getEventData(p)); + }, o.mixin(w), t.exports = w; + }).call(this, i(25)); + }, + /* 25 */ + /***/ + function(t, n) { + var i; + i = function() { + return this; + }(); + try { + i = i || new Function("return this")(); + } catch (a) { + typeof window == "object" && (i = window); + } + t.exports = i; + }, + /* 26 */ + /***/ + function(t, n, i) { + var a = "_feEventKey"; + function o(s, l) { + var u = s[a], c; + return u || (u = s[a] = {}), c = u[l], c || (c = u[l] = []), c; + } + t.exports = o; + }, + /* 27 */ + /***/ + function(t, n, i) { + function a(o) { + var s = document.documentElement.style, l, u; + for (l = 0, u = o.length; l < u; l += 1) + if (o[l] in s) + return o[l]; + return !1; + } + t.exports = a; + }, + /* 28 */ + /***/ + function(t, n, i) { + function a(o) { + return o.target || o.srcElement; + } + t.exports = a; + }, + /* 29 */ + /***/ + function(t, n, i) { + var a = i(10), o = i(28), s = i(17), l = i(14), u = i(30), c = i(0), h = i(18), f = i(9), v = i(12), b = i(8), w = i(51); + function p(d, m) { + this.options = c({ + cssPrefix: "tui-colorpicker-", + preset: ["#181818", "#282828", "#383838", "#585858", "#B8B8B8", "#D8D8D8", "#E8E8E8", "#F8F8F8", "#AB4642", "#DC9656", "#F7CA88", "#A1B56C", "#86C1B9", "#7CAFC2", "#BA8BAF", "#A16946"], + detailTxt: "Detail" + }, d), m = f.appendHTMLElement("div", m, this.options.cssPrefix + "palette-container"), b.call(this, d, m); + } + h(p, b), p.prototype._onClick = function(d) { + var m = this.options, _ = o(d), y = {}; + if (u(_, m.cssPrefix + "palette-button")) { + y.color = _.value, this.fire("_selectColor", y); + return; + } + u(_, m.cssPrefix + "palette-toggle-slider") && this.fire("_toggleSlider"); + }, p.prototype._onChange = function(d) { + var m = this.options, _ = o(d), y = {}; + u(_, m.cssPrefix + "palette-hex") && (y.color = _.value, this.fire("_selectColor", y)); + }, p.prototype._beforeDestroy = function() { + this._toggleEvent(!1); + }, p.prototype._toggleEvent = function(d) { + var m = this.options, _ = this.container, y = d ? l : s, x; + y(_, "click", this._onClick, this), x = _.querySelector("." + m.cssPrefix + "palette-hex", _), x && y(x, "change", this._onChange, this); + }, p.prototype.render = function(d) { + var m = this.options, _ = ""; + this._toggleEvent(!1), _ = w({ + cssPrefix: m.cssPrefix, + preset: m.preset, + detailTxt: m.detailTxt, + color: d, + isValidRGB: v.isValidRGB, + getItemClass: function(y) { + return y ? "" : " " + m.cssPrefix + "color-transparent"; + }, + isSelected: function(y) { + return y === d ? " " + m.cssPrefix + "selected" : ""; + } + }), this.container.innerHTML = _, this._toggleEvent(!0); + }, a.mixin(p), t.exports = p; + }, + /* 30 */ + /***/ + function(t, n, i) { + var a = i(5), o = i(23); + function s(l, u) { + var c; + return l.classList ? l.classList.contains(u) : (c = o(l).split(/\s+/), a(u, c) > -1); + } + t.exports = s; + }, + /* 31 */ + /***/ + function(t, n, i) { + var a = i(10), o = i(53), s = i(54), l = i(30), u = i(0), c = i(18), h = i(9), f = i(32), v = i(12), b = i(8), w = i(24), p = i(57), d = -7, m = 112, _ = -3, y = 115, x = 359.99; + function g(S, T) { + T = h.appendHTMLElement("div", T, S.cssPrefix + "slider-container"), T.style.display = "none", b.call(this, S, T), this.options = u({ + color: "#f8f8f8", + cssPrefix: "tui-colorpicker-" + }, S), this._dragDataCache = {}, this.sliderHandleElement = null, this.huebarHandleElement = null, this.baseColorElement = null, this.drag = new w({ + distance: 0 + }, T), this.colorSliderPosLimitRange = [d, m], this.huebarPosLimitRange = [_, y], this.drag.on({ + dragStart: this._onDragStart, + drag: this._onDrag, + dragEnd: this._onDragEnd, + click: this._onClick + }, this); + } + c(g, b), g.prototype._beforeDestroy = function() { + this.drag.off(), this.drag = this.options = this._dragDataCache = this.sliderHandleElement = this.huebarHandleElement = this.baseColorElement = null; + }, g.prototype.toggle = function(S) { + this.container.style.display = S ? "block" : "none"; + }, g.prototype.isVisible = function() { + return this.container.style.display === "block"; + }, g.prototype.render = function(S) { + var T = this.container, C = this.options, E = p.layout, M, P; + v.isValidRGB(S) && (E = E.replace(/{{slider}}/, p.slider), E = E.replace(/{{huebar}}/, p.huebar), E = E.replace(/{{cssPrefix}}/g, C.cssPrefix), E = E.replace(/{{id}}/g, C.id), this.container.innerHTML = E, this.sliderSvgElement = T.querySelector("." + C.cssPrefix + "svg-slider"), this.huebarSvgElement = T.querySelector("." + C.cssPrefix + "svg-huebar"), this.sliderHandleElement = T.querySelector("." + C.cssPrefix + "slider-handle"), this.huebarHandleElement = T.querySelector("." + C.cssPrefix + "huebar-handle"), this.baseColorElement = T.querySelector("." + C.cssPrefix + "slider-basecolor"), M = v.hexToRGB(S), P = v.rgbToHSV.apply(null, M), this.moveHue(P[0], !0), this.moveSaturationAndValue(P[1], P[2], !0)); + }, g.prototype._setColorSliderPosMax = function() { + var S = this.sliderSvgElement.getClientRects()[0]; + S && (this.colorSliderPosLimitRange[1] = S.height - 10); + }, g.prototype._moveColorSliderHandle = function(S, T, C) { + var E = this.sliderHandleElement, M; + T = Math.max(this.colorSliderPosLimitRange[0], T), T = Math.min(this.colorSliderPosLimitRange[1], T), S = Math.max(this.colorSliderPosLimitRange[0], S), S = Math.min(this.colorSliderPosLimitRange[1], S), f.setTranslateXY(E, S, T), M = T > 50 ? "white" : "black", f.setStrokeColor(E, M), C || this.fire("_selectColor", { + color: v.rgbToHEX.apply(null, this.getRGB()) + }); + }, g.prototype.moveSaturationAndValue = function(S, T, C) { + var E, M, P, R; + S = S || 0, T = T || 0, E = Math.abs(this.colorSliderPosLimitRange[0]), M = this.colorSliderPosLimitRange[1], P = S * M / 100 - E, R = M - T * M / 100 - E, this._moveColorSliderHandle(P, R, C); + }, g.prototype._moveColorSliderByPosition = function(S, T) { + var C = this.colorSliderPosLimitRange[0]; + this._moveColorSliderHandle(S + C, T + C); + }, g.prototype.getSaturationAndValue = function() { + var S = Math.abs(this.colorSliderPosLimitRange[0]), T = S + this.colorSliderPosLimitRange[1], C = f.getTranslateXY(this.sliderHandleElement), E, M; + return E = (C[1] + S) / T * 100, M = 100 - (C[0] + S) / T * 100, [E, M]; + }, g.prototype._setHueBarPosMax = function() { + var S = this.huebarSvgElement.getClientRects()[0]; + S && (this.huebarPosLimitRange[1] = S.height - 7); + }, g.prototype._moveHueHandle = function(S, T) { + var C = this.huebarHandleElement, E = this.baseColorElement, M, P; + S = Math.max(this.huebarPosLimitRange[0], S), S = Math.min(this.huebarPosLimitRange[1], S), f.setTranslateY(C, S), M = v.hsvToRGB(this.getHue(), 100, 100), P = v.rgbToHEX.apply(null, M), f.setGradientColorStop(E, P), T || this.fire("_selectColor", { + color: v.rgbToHEX.apply(null, this.getRGB()) + }); + }, g.prototype.moveHue = function(S, T) { + var C = 0, E, M; + E = Math.abs(this.huebarPosLimitRange[0]), M = E + this.huebarPosLimitRange[1], S = S || 0, C = M * S / x - E, this._moveHueHandle(C, T); + }, g.prototype._moveHueByPosition = function(S) { + var T = this.huebarPosLimitRange[0]; + this._moveHueHandle(S + T); + }, g.prototype.getHue = function() { + var S = this.huebarHandleElement, T = f.getTranslateXY(S), C, E; + return C = Math.abs(this.huebarPosLimitRange[0]), E = C + this.huebarPosLimitRange[1], (T[0] + C) * x / E; + }, g.prototype.getHSV = function() { + var S = this.getSaturationAndValue(), T = this.getHue(); + return [T].concat(S); + }, g.prototype.getRGB = function() { + return v.hsvToRGB.apply(null, this.getHSV()); + }, g.prototype._prepareColorSliderForMouseEvent = function(S) { + var T = this.options, C = s(S.target, "." + T.cssPrefix + "slider-part"), E; + return E = this._dragDataCache = { + isColorSlider: l(C, T.cssPrefix + "slider-left"), + parentElement: C + }, E; + }, g.prototype._onClick = function(S) { + var T = this._prepareColorSliderForMouseEvent(S), C = o(S.originEvent, T.parentElement); + T.isColorSlider ? this._moveColorSliderByPosition(C[0], C[1]) : this._moveHueByPosition(C[1]), this._dragDataCache = null; + }, g.prototype._onDragStart = function(S) { + this._setColorSliderPosMax(), this._setHueBarPosMax(), this._prepareColorSliderForMouseEvent(S); + }, g.prototype._onDrag = function(S) { + var T = this._dragDataCache, C = o(S.originEvent, T.parentElement); + T.isColorSlider ? this._moveColorSliderByPosition(C[0], C[1]) : this._moveHueByPosition(C[1]); + }, g.prototype._onDragEnd = function() { + this._dragDataCache = null; + }, a.mixin(g), t.exports = g; + }, + /* 32 */ + /***/ + function(t, n, i) { + var a = i(4).isOldBrowser, o = /[\.\-0-9]+/g, s = -6, l = { + /** + * Get translate transform value + * @param {SVG|VML} obj - svg or vml object that want to know translate x, y + * @returns {number[]} translated coordinates [x, y] + */ + getTranslateXY: function(u) { + var c; + return a ? (c = u.style, [parseFloat(c.top), parseFloat(c.left)]) : (c = u.getAttribute("transform"), c ? (c = c.match(o), [parseFloat(c[1]), parseFloat(c[0])]) : [0, 0]); + }, + /** + * Set translate transform value + * @param {SVG|VML} obj - SVG or VML object to setting translate transform. + * @param {number} x - translate X value + * @param {number} y - translate Y value + */ + setTranslateXY: function(u, c, h) { + a ? (u.style.left = c + "px", u.style.top = h + "px") : u.setAttribute("transform", "translate(" + c + "," + h + ")"); + }, + /** + * Set translate only Y value + * @param {SVG|VML} obj - SVG or VML object to setting translate transform. + * @param {number} y - translate Y value + */ + setTranslateY: function(u, c) { + a ? u.style.top = c + "px" : u.setAttribute("transform", "translate(" + s + "," + c + ")"); + }, + /** + * Set stroke color to SVG or VML object + * @param {SVG|VML} obj - SVG or VML object to setting stroke color + * @param {string} colorStr - color string + */ + setStrokeColor: function(u, c) { + a ? u.strokecolor = c : u.setAttribute("stroke", c); + }, + /** + * Set gradient stop color to SVG, VML object. + * @param {SVG|VML} obj - SVG, VML object to applying gradient stop color + * @param {string} colorStr - color string + */ + setGradientColorStop: function(u, c) { + a ? u.color = c : u.setAttribute("stop-color", c); + } + }; + t.exports = l; + }, + /* 33 */ + /***/ + function(t, n, i) { + i(34), t.exports = i(35); + }, + /* 34 */ + /***/ + function(t, n, i) { + }, + /* 35 */ + /***/ + function(t, n, i) { + var a = i(19), o = i(8), s = i(24), l = i(48), u = i(29), c = i(31), h = i(12), f = i(32), v = { + Collection: a, + View: o, + Drag: s, + create: l, + Palette: u, + Slider: c, + colorutil: h, + svgvml: f + }; + t.exports = v; + }, + /* 36 */ + /***/ + function(t, n, i) { + function a(o) { + return o === null; + } + t.exports = a; + }, + /* 37 */ + /***/ + function(t, n, i) { + var a = i(3), o = i(38), s = 7 * 24 * 60 * 60 * 1e3; + function l(c) { + var h = (/* @__PURE__ */ new Date()).getTime(); + return h - c > s; + } + function u(c, h) { + var f = "https://www.google-analytics.com/collect", v = location.hostname, b = "event", w = "use", p = "TOAST UI " + c + " for " + v + ": Statistics", d = window.localStorage.getItem(p); + !a(window.tui) && window.tui.usageStatistics === !1 || d && !l(d) || (window.localStorage.setItem(p, (/* @__PURE__ */ new Date()).getTime()), setTimeout(function() { + (document.readyState === "interactive" || document.readyState === "complete") && o(f, { + v: 1, + t: b, + tid: h, + cid: v, + dp: v, + dh: c, + el: c, + ec: w + }); + }, 1e3)); + } + t.exports = u; + }, + /* 38 */ + /***/ + function(t, n, i) { + var a = i(7); + function o(s, l) { + var u = document.createElement("img"), c = ""; + return a(l, function(h, f) { + c += "&" + f + "=" + h; + }), c = c.substring(1), u.src = s + "?" + c, u.style.display = "none", document.body.appendChild(u), document.body.removeChild(u), u; + } + t.exports = o; + }, + /* 39 */ + /***/ + function(t, n, i) { + var a = i(2), o = i(5), s = i(23), l = i(40); + function u(c) { + var h = Array.prototype.slice.call(arguments, 1), f = c.classList, v = [], b; + if (f) { + a(h, function(w) { + c.classList.add(w); + }); + return; + } + b = s(c), b && (h = [].concat(b.split(/\s+/), h)), a(h, function(w) { + o(w, v) < 0 && v.push(w); + }), l(c, v); + } + t.exports = u; + }, + /* 40 */ + /***/ + function(t, n, i) { + var a = i(1), o = i(3); + function s(l, u) { + if (u = a(u) ? u.join(" ") : u, u = u.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), o(l.className.baseVal)) { + l.className = u; + return; + } + l.className.baseVal = u; + } + t.exports = s; + }, + /* 41 */ + /***/ + function(t, n, i) { + function a(o) { + return typeof o == "number" || o instanceof Number; + } + t.exports = a; + }, + /* 42 */ + /***/ + function(t, n, i) { + var a = i(14), o = i(15), s = i(43), l = i(27), u = "onselectstart" in document, c = "prevUserSelect", h = l([ + "userSelect", + "WebkitUserSelect", + "OUserSelect", + "MozUserSelect", + "msUserSelect" + ]); + function f(v) { + v || (v = document), u ? a(v, "selectstart", o) : (v = v === document ? document.documentElement : v, s(v, c, v.style[h]), v.style[h] = "none"); + } + t.exports = f; + }, + /* 43 */ + /***/ + function(t, n, i) { + var a = i(16); + function o(s, l, u) { + if (s.dataset) { + s.dataset[l] = u; + return; + } + s.setAttribute("data-" + a(l), u); + } + t.exports = o; + }, + /* 44 */ + /***/ + function(t, n, i) { + var a = i(17), o = i(15), s = i(45), l = i(46), u = i(27), c = "onselectstart" in document, h = "prevUserSelect", f = u([ + "userSelect", + "WebkitUserSelect", + "OUserSelect", + "MozUserSelect", + "msUserSelect" + ]); + function v(b) { + b || (b = document), c ? a(b, "selectstart", o) : (b = b === document ? document.documentElement : b, b.style[f] = s(b, h) || "auto", l(b, h)); + } + t.exports = v; + }, + /* 45 */ + /***/ + function(t, n, i) { + var a = i(16); + function o(s, l) { + return s.dataset ? s.dataset[l] : s.getAttribute("data-" + a(l)); + } + t.exports = o; + }, + /* 46 */ + /***/ + function(t, n, i) { + var a = i(16); + function o(s, l) { + if (s.dataset) { + delete s.dataset[l]; + return; + } + s.removeAttribute("data-" + a(l)); + } + t.exports = o; + }, + /* 47 */ + /***/ + function(t, n, i) { + var a = i(22), o = i(5), s = ["0", "1", "3", "5", "7"], l = ["2", "6"], u = ["4"]; + function c(f) { + return a.msie && a.version <= 8 ? h(f) : f.button; + } + function h(f) { + var v = String(f.button); + return o(v, s) > -1 ? 0 : o(v, l) > -1 ? 2 : o(v, u) > -1 ? 1 : null; + } + t.exports = c; + }, + /* 48 */ + /***/ + function(t, n, i) { + var a = i(10), o = i(0), s = i(4), l = i(12), u = i(49), c = i(29), h = i(31), f = 0; + function v() { + return f += 1, f; + } + function b(w) { + var p; + if (!(this instanceof b)) + return new b(w); + if (w = this.options = o({ + container: null, + color: "#f8f8f8", + preset: ["#181818", "#282828", "#383838", "#585858", "#b8b8b8", "#d8d8d8", "#e8e8e8", "#f8f8f8", "#ab4642", "#dc9656", "#f7ca88", "#a1b56c", "#86c1b9", "#7cafc2", "#ba8baf", "#a16946"], + cssPrefix: "tui-colorpicker-", + detailTxt: "Detail", + id: v(), + usageStatistics: !0 + }, w), !w.container) + throw new Error("ColorPicker(): need container option."); + p = this.layout = new u(w, w.container), this.palette = new c(w, p.container), this.palette.on({ + _selectColor: this._onSelectColorInPalette, + _toggleSlider: this._onToggleSlider + }, this), this.slider = new h(w, p.container), this.slider.on("_selectColor", this._onSelectColorInSlider, this), p.addChild(this.palette), p.addChild(this.slider), this.render(w.color), w.usageStatistics && s.sendHostName(); + } + b.prototype._onSelectColorInPalette = function(w) { + var p = w.color, d = this.options; + if (!l.isValidRGB(p) && p !== "") { + this.render(); + return; + } + this.fire("selectColor", { + color: p, + origin: "palette" + }), d.color !== p && (d.color = p, this.render(p)); + }, b.prototype._onToggleSlider = function() { + this.slider.toggle(!this.slider.isVisible()); + }, b.prototype._onSelectColorInSlider = function(w) { + var p = w.color, d = this.options; + this.fire("selectColor", { + color: p, + origin: "slider" + }), d.color !== p && (d.color = p, this.palette.render(p)); + }, b.prototype.setColor = function(w) { + if (!l.isValidRGB(w)) + throw new Error("ColorPicker#setColor(): need valid hex string color value"); + this.options.color = w, this.render(w); + }, b.prototype.getColor = function() { + return this.options.color; + }, b.prototype.toggle = function(w) { + this.layout.container.style.display = w ? "block" : "none"; + }, b.prototype.render = function(w) { + this.layout.render(w || this.options.color); + }, b.prototype.destroy = function() { + this.layout.destroy(), this.options.container.innerHTML = "", this.layout = this.slider = this.palette = this.options = null; + }, a.mixin(b), t.exports = b; + }, + /* 49 */ + /***/ + function(t, n, i) { + var a = i(0), o = i(18), s = i(9), l = i(8); + function u(c, h) { + this.options = a({ + cssPrefix: "tui-colorpicker-" + }, c), h = s.appendHTMLElement("div", h, this.options.cssPrefix + "container"), l.call(this, c, h), this.render(); + } + o(u, l), u.prototype.render = function(c) { + this.recursive(function(h) { + h.render(c); + }, !0); + }, t.exports = u; + }, + /* 50 */ + /***/ + function(t, n, i) { + function a(o) { + function s() { + } + return s.prototype = o, new s(); + } + t.exports = a; + }, + /* 51 */ + /***/ + function(t, n, i) { + var a = i(52); + t.exports = function(o) { + var s = ['
  • '].join(""), l = ['
      ', "{{each preset}}", s, "{{/each}}", "
    ", '
    ', '', '', '{{color}}', "
    "].join(` +`); + return a(l, o); + }; + }, + /* 52 */ + /***/ + function(t, n, i) { + var a = i(5), o = i(2), s = i(1), l = i(11), u = i(0), c = /{{\s?|\s?}}/g, h = /^[a-zA-Z0-9_@]+\[[a-zA-Z0-9_@"']+\]$/, f = /\[\s?|\s?\]/, v = /^[a-zA-Z_]+\.[a-zA-Z_]+$/, b = /\./, w = /^["']\w+["']$/, p = /"|'/g, d = /^-?\d+\.?\d*$/, m = 2, _ = { + if: T, + each: C, + with: E + }, y = "a".split(/a/).length === 3, x = function() { + return y ? function($, G) { + return $.split(G); + } : function($, G) { + var Q = [], ee = 0, ce, ne; + for (G.global || (G = new RegExp(G, "g")), ce = G.exec($); ce !== null; ) + ne = ce.index, Q.push($.slice(ee, ne)), ee = ne + ce[0].length, ce = G.exec($); + return Q.push($.slice(ee)), Q; + }; + }(); + function g($, G) { + var Q, ee = G[$]; + return $ === "true" ? ee = !0 : $ === "false" ? ee = !1 : w.test($) ? ee = $.replace(p, "") : h.test($) ? (Q = $.split(f), ee = g(Q[0], G)[g(Q[1], G)]) : v.test($) ? (Q = $.split(b), ee = g(Q[0], G)[Q[1]]) : d.test($) && (ee = parseFloat($)), ee; + } + function S($, G) { + var Q = [$], ee = [], ce = 0, ne = 0; + return o(G, function(fe, K) { + fe.indexOf("if") === 0 ? ce += 1 : fe === "/if" ? ce -= 1 : !ce && (fe.indexOf("elseif") === 0 || fe === "else") && (Q.push(fe === "else" ? ["true"] : fe.split(" ").slice(1)), ee.push(G.slice(ne, K)), ne = K + 1); + }), ee.push(G.slice(ne)), { + exps: Q, + sourcesInsideIf: ee + }; + } + function T($, G, Q) { + var ee = S($, G), ce = !1, ne = ""; + return o(ee.exps, function(fe, K) { + return ce = R(fe, Q), ce && (ne = F(ee.sourcesInsideIf[K], Q)), !ce; + }), ne; + } + function C($, G, Q) { + var ee = R($, Q), ce = s(ee) ? "@index" : "@key", ne = {}, fe = ""; + return o(ee, function(K, Oe) { + ne[ce] = Oe, ne["@this"] = K, u(Q, ne), fe += F(G.slice(), Q); + }), fe; + } + function E($, G, Q) { + var ee = a("as", $), ce = $[ee + 1], ne = R($.slice(0, ee), Q), fe = {}; + return fe[ce] = ne, F(G, u(Q, fe)) || ""; + } + function M($, G, Q) { + var ee = $.splice(G + 1, Q - G); + return ee.pop(), ee; + } + function P($, G, Q) { + for (var ee = _[$], ce = 1, ne = 0, fe, K = ne + m, Oe = G[K]; ce && l(Oe); ) + Oe.indexOf($) === 0 ? ce += 1 : Oe.indexOf("/" + $) === 0 && (ce -= 1, fe = K), K += m, Oe = G[K]; + if (ce) + throw Error($ + " needs {{/" + $ + "}} expression."); + return G[ne] = ee( + G[ne].split(" ").slice(1), + M(G, ne, fe), + Q + ), G; + } + function R($, G) { + var Q = g($[0], G); + return Q instanceof Function ? N(Q, $.slice(1), G) : Q; + } + function N($, G, Q) { + var ee = []; + return o(G, function(ce) { + ee.push(g(ce, Q)); + }), $.apply(null, ee); + } + function F($, G) { + for (var Q = 1, ee = $[Q], ce, ne, fe; l(ee); ) + ce = ee.split(" "), ne = ce[0], _[ne] ? (fe = P(ne, $.splice(Q, $.length - Q), G), $ = $.concat(fe)) : $[Q] = R(ce, G), Q += m, ee = $[Q]; + return $.join(""); + } + function U($, G) { + return F(x($, c), G); + } + t.exports = U; + }, + /* 53 */ + /***/ + function(t, n, i) { + var a = i(1); + function o(s, l) { + var u = a(s), c = u ? s[0] : s.clientX, h = u ? s[1] : s.clientY, f; + return l ? (f = l.getBoundingClientRect(), [ + c - f.left - l.clientLeft, + h - f.top - l.clientTop + ]) : [c, h]; + } + t.exports = o; + }, + /* 54 */ + /***/ + function(t, n, i) { + var a = i(55); + function o(s, l) { + var u = s.parentNode; + if (a(s, l)) + return s; + for (; u && u !== document; ) { + if (a(u, l)) + return u; + u = u.parentNode; + } + return null; + } + t.exports = o; + }, + /* 55 */ + /***/ + function(t, n, i) { + var a = i(5), o = i(56), s = Element.prototype, l = s.matches || s.webkitMatchesSelector || s.mozMatchesSelector || s.msMatchesSelector || function(c) { + var h = this.document || this.ownerDocument; + return a(this, o(h.querySelectorAll(c))) > -1; + }; + function u(c, h) { + return l.call(c, h); + } + t.exports = u; + }, + /* 56 */ + /***/ + function(t, n, i) { + var a = i(6); + function o(s) { + var l; + try { + l = Array.prototype.slice.call(s); + } catch (u) { + l = [], a(s, function(c) { + l.push(c); + }); + } + return l; + } + t.exports = o; + }, + /* 57 */ + /***/ + function(t, n, i) { + (function(a) { + var o = i(4).isOldBrowser, s = ['
    {{slider}}
    ', '
    {{huebar}}
    '].join(` +`), l = ['', "", '', '', '', "", '', '', '', "", "", '', '', '', ""].join(` +`), u = ['
    ', '', '', "", '', '', "", '', "
    "].join(` +`), c = ['', "", '', '', '', '', '', '', '', '', "", "", '', '', ""].join(` +`), h = ['
    ', '', '', "", '', "
    "].join(` +`); + o && a.document.namespaces.add("v", "urn:schemas-microsoft-com:vml"), t.exports = { + layout: s, + slider: o ? u : l, + huebar: o ? h : c + }; + }).call(this, i(25)); + } + /******/ + ]) + ); + }); + }(IC)), IC.exports; +} +/*! + * TOAST UI ImageEditor + * @version 3.15.3 + * @license MIT + */ +(function(r, e) { + (function(n, i) { + r.exports = i(c0e()); + })(self, function(t) { + return ( + /******/ + function() { + var n = { + /***/ + 2777: ( + /***/ + function(s, l, u) { + /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */ + var c = c || { version: "4.6.0" }; + if (l.fabric = c, typeof document != "undefined" && typeof window != "undefined") + document instanceof (typeof HTMLDocument != "undefined" ? HTMLDocument : Document) ? c.document = document : c.document = document.implementation.createHTMLDocument(""), c.window = window; + else { + var h = u(4960), f = new h.JSDOM( + decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"), + { + features: { + FetchExternalResources: ["img"] + }, + resources: "usable" + } + ).window; + c.document = f.document, c.jsdomImplForWrapper = u(6759).implForWrapper, c.nodeCanvas = u(6272).Canvas, c.window = f, DOMParser = c.window.DOMParser; + } + c.isTouchSupported = "ontouchstart" in c.window || "ontouchstart" in c.document || c.window && c.window.navigator && c.window.navigator.maxTouchPoints > 0, c.isLikelyNode = typeof Buffer != "undefined" && typeof window == "undefined", c.SHARED_ATTRIBUTES = [ + "display", + "transform", + "fill", + "fill-opacity", + "fill-rule", + "opacity", + "stroke", + "stroke-dasharray", + "stroke-linecap", + "stroke-dashoffset", + "stroke-linejoin", + "stroke-miterlimit", + "stroke-opacity", + "stroke-width", + "id", + "paint-order", + "vector-effect", + "instantiated_by_use", + "clip-path" + ], c.DPI = 96, c.reNum = "(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)", c.commaWsp = "(?:\\s+,?\\s*|,\\s*)", c.rePathCommand = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig, c.reNonWord = /[ \n\.,;!\?\-]/, c.fontPaths = {}, c.iMatrix = [1, 0, 0, 1, 0, 0], c.svgNS = "http://www.w3.org/2000/svg", c.perfLimitSizeTotal = 2097152, c.maxCacheSideLimit = 4096, c.minCacheSideLimit = 256, c.charWidthsCache = {}, c.textureSize = 2048, c.disableStyleCopyPaste = !1, c.enableGLFiltering = !0, c.devicePixelRatio = c.window.devicePixelRatio || c.window.webkitDevicePixelRatio || c.window.mozDevicePixelRatio || 1, c.browserShadowBlurConstant = 1, c.arcToSegmentsCache = {}, c.boundsOfCurveCache = {}, c.cachesBoundsOfCurve = !0, c.forceGLPutImageData = !1, c.initFilterBackend = function() { + if (c.enableGLFiltering && c.isWebglSupported && c.isWebglSupported(c.textureSize)) + return console.log("max texture size: " + c.maxTextureSize), new c.WebglFilterBackend({ tileSize: c.textureSize }); + if (c.Canvas2dFilterBackend) + return new c.Canvas2dFilterBackend(); + }, typeof document != "undefined" && typeof window != "undefined" && (window.fabric = c), function() { + function p(g, S) { + if (this.__eventListeners[g]) { + var T = this.__eventListeners[g]; + S ? T[T.indexOf(S)] = !1 : c.util.array.fill(T, !1); + } + } + function d(g, S) { + if (this.__eventListeners || (this.__eventListeners = {}), arguments.length === 1) + for (var T in g) + this.on(T, g[T]); + else + this.__eventListeners[g] || (this.__eventListeners[g] = []), this.__eventListeners[g].push(S); + return this; + } + function m(g, S) { + var T = function() { + S.apply(this, arguments), this.off(g, T); + }.bind(this); + this.on(g, T); + } + function _(g, S) { + if (arguments.length === 1) + for (var T in g) + m.call(this, T, g[T]); + else + m.call(this, g, S); + return this; + } + function y(g, S) { + if (!this.__eventListeners) + return this; + if (arguments.length === 0) + for (g in this.__eventListeners) + p.call(this, g); + else if (arguments.length === 1 && typeof arguments[0] == "object") + for (var T in g) + p.call(this, T, g[T]); + else + p.call(this, g, S); + return this; + } + function x(g, S) { + if (!this.__eventListeners) + return this; + var T = this.__eventListeners[g]; + if (!T) + return this; + for (var C = 0, E = T.length; C < E; C++) + T[C] && T[C].call(this, S || {}); + return this.__eventListeners[g] = T.filter(function(M) { + return M !== !1; + }), this; + } + c.Observable = { + fire: x, + on: d, + once: _, + off: y + }; + }(), c.Collection = { + _objects: [], + /** + * Adds objects to collection, Canvas or Group, then renders canvas + * (if `renderOnAddRemove` is not `false`). + * in case of Group no changes to bounding box are made. + * Objects should be instances of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the add method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + add: function() { + if (this._objects.push.apply(this._objects, arguments), this._onObjectAdded) + for (var p = 0, d = arguments.length; p < d; p++) + this._onObjectAdded(arguments[p]); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * Use of this function is highly discouraged for groups. + * you can add a bunch of objects with the insertAt method but then you NEED + * to run a addWithUpdate call for the Group class or position/bbox will be wrong. + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ + insertAt: function(p, d, m) { + var _ = this._objects; + return m ? _[d] = p : _.splice(d, 0, p), this._onObjectAdded && this._onObjectAdded(p), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove: function() { + for (var p = this._objects, d, m = !1, _ = 0, y = arguments.length; _ < y; _++) + d = p.indexOf(arguments[_]), d !== -1 && (m = !0, p.splice(d, 1), this._onObjectRemoved && this._onObjectRemoved(arguments[_])); + return this.renderOnAddRemove && m && this.requestRenderAll(), this; + }, + /** + * Executes given function for each object in this group + * @param {Function} callback + * Callback invoked with current object as first argument, + * index - as second and an array of all objects - as third. + * Callback is invoked in a context of Global Object (e.g. `window`) + * when no `context` argument is given + * + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + * @chainable + */ + forEachObject: function(p, d) { + for (var m = this.getObjects(), _ = 0, y = m.length; _ < y; _++) + p.call(d, m[_], _, m); + return this; + }, + /** + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * since 2.3.5 this method return always a COPY of the array; + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ + getObjects: function(p) { + return typeof p == "undefined" ? this._objects.concat() : this._objects.filter(function(d) { + return d.type === p; + }); + }, + /** + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ + item: function(p) { + return this._objects[p]; + }, + /** + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ + isEmpty: function() { + return this._objects.length === 0; + }, + /** + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ + size: function() { + return this._objects.length; + }, + /** + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @param {Boolean} [deep=false] `true` to check all descendants, `false` to check only `_objects` + * @return {Boolean} `true` if collection contains an object + */ + contains: function(p, d) { + return this._objects.indexOf(p) > -1 ? !0 : d ? this._objects.some(function(m) { + return typeof m.contains == "function" && m.contains(p, !0); + }) : !1; + }, + /** + * Returns number representation of a collection complexity + * @return {Number} complexity + */ + complexity: function() { + return this._objects.reduce(function(p, d) { + return p += d.complexity ? d.complexity() : 0, p; + }, 0); + } + }, c.CommonMethods = { + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ + _setOptions: function(p) { + for (var d in p) + this.set(d, p[d]); + }, + /** + * @private + * @param {Object} [filler] Options object + * @param {String} [property] property to set the Gradient to + */ + _initGradient: function(p, d) { + p && p.colorStops && !(p instanceof c.Gradient) && this.set(d, new c.Gradient(p)); + }, + /** + * @private + * @param {Object} [filler] Options object + * @param {String} [property] property to set the Pattern to + * @param {Function} [callback] callback to invoke after pattern load + */ + _initPattern: function(p, d, m) { + p && p.source && !(p instanceof c.Pattern) ? this.set(d, new c.Pattern(p, m)) : m && m(); + }, + /** + * @private + */ + _setObject: function(p) { + for (var d in p) + this._set(d, p[d]); + }, + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + * @return {fabric.Object} thisArg + * @chainable + */ + set: function(p, d) { + return typeof p == "object" ? this._setObject(p) : this._set(p, d), this; + }, + _set: function(p, d) { + this[p] = d; + }, + /** + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + * @return {fabric.Object} thisArg + * @chainable + */ + toggle: function(p) { + var d = this.get(p); + return typeof d == "boolean" && this.set(p, !d), this; + }, + /** + * Basic getter + * @param {String} property Property name + * @return {*} value of a property + */ + get: function(p) { + return this[p]; + } + }, function(p) { + var d = Math.sqrt, m = Math.atan2, _ = Math.pow, y = Math.PI / 180, x = Math.PI / 2; + c.util = { + /** + * Calculate the cos of an angle, avoiding returning floats for known results + * @static + * @memberOf fabric.util + * @param {Number} angle the angle in radians or in degree + * @return {Number} + */ + cos: function(g) { + if (g === 0) + return 1; + g < 0 && (g = -g); + var S = g / x; + switch (S) { + case 1: + case 3: + return 0; + case 2: + return -1; + } + return Math.cos(g); + }, + /** + * Calculate the sin of an angle, avoiding returning floats for known results + * @static + * @memberOf fabric.util + * @param {Number} angle the angle in radians or in degree + * @return {Number} + */ + sin: function(g) { + if (g === 0) + return 0; + var S = g / x, T = 1; + switch (g < 0 && (T = -1), S) { + case 1: + return T; + case 2: + return 0; + case 3: + return -T; + } + return Math.sin(g); + }, + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @static + * @memberOf fabric.util + * @param {Array} array + * @param {*} value + * @return {Array} original array + */ + removeFromArray: function(g, S) { + var T = g.indexOf(S); + return T !== -1 && g.splice(T, 1), g; + }, + /** + * Returns random number between 2 specified ones. + * @static + * @memberOf fabric.util + * @param {Number} min lower limit + * @param {Number} max upper limit + * @return {Number} random value (between min and max) + */ + getRandomInt: function(g, S) { + return Math.floor(Math.random() * (S - g + 1)) + g; + }, + /** + * Transforms degrees to radians. + * @static + * @memberOf fabric.util + * @param {Number} degrees value in degrees + * @return {Number} value in radians + */ + degreesToRadians: function(g) { + return g * y; + }, + /** + * Transforms radians to degrees. + * @static + * @memberOf fabric.util + * @param {Number} radians value in radians + * @return {Number} value in degrees + */ + radiansToDegrees: function(g) { + return g / y; + }, + /** + * Rotates `point` around `origin` with `radians` + * @static + * @memberOf fabric.util + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + * @return {fabric.Point} The new rotated point + */ + rotatePoint: function(g, S, T) { + var C = new c.Point(g.x - S.x, g.y - S.y), E = c.util.rotateVector(C, T); + return new c.Point(E.x, E.y).addEquals(S); + }, + /** + * Rotates `vector` with `radians` + * @static + * @memberOf fabric.util + * @param {Object} vector The vector to rotate (x and y) + * @param {Number} radians The radians of the angle for the rotation + * @return {Object} The new rotated point + */ + rotateVector: function(g, S) { + var T = c.util.sin(S), C = c.util.cos(S), E = g.x * C - g.y * T, M = g.x * T + g.y * C; + return { + x: E, + y: M + }; + }, + /** + * Apply transform t to point p + * @static + * @memberOf fabric.util + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + * @return {fabric.Point} The transformed point + */ + transformPoint: function(g, S, T) { + return T ? new c.Point( + S[0] * g.x + S[2] * g.y, + S[1] * g.x + S[3] * g.y + ) : new c.Point( + S[0] * g.x + S[2] * g.y + S[4], + S[1] * g.x + S[3] * g.y + S[5] + ); + }, + /** + * Returns coordinates of points's bounding rectangle (left, top, width, height) + * @param {Array} points 4 points array + * @param {Array} [transform] an array of 6 numbers representing a 2x3 transform matrix + * @return {Object} Object with left, top, width, height properties + */ + makeBoundingBoxFromPoints: function(g, S) { + if (S) + for (var T = 0; T < g.length; T++) + g[T] = c.util.transformPoint(g[T], S); + var C = [g[0].x, g[1].x, g[2].x, g[3].x], E = c.util.array.min(C), M = c.util.array.max(C), P = M - E, R = [g[0].y, g[1].y, g[2].y, g[3].y], N = c.util.array.min(R), F = c.util.array.max(R), U = F - N; + return { + left: E, + top: N, + width: P, + height: U + }; + }, + /** + * Invert transformation t + * @static + * @memberOf fabric.util + * @param {Array} t The transform + * @return {Array} The inverted transform + */ + invertTransform: function(g) { + var S = 1 / (g[0] * g[3] - g[1] * g[2]), T = [S * g[3], -S * g[1], -S * g[2], S * g[0]], C = c.util.transformPoint({ x: g[4], y: g[5] }, T, !0); + return T[4] = -C.x, T[5] = -C.y, T; + }, + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @static + * @memberOf fabric.util + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + * @return {Number} + */ + toFixed: function(g, S) { + return parseFloat(Number(g).toFixed(S)); + }, + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + * @param {Number} fontSize + * @return {Number|String} + */ + parseUnit: function(g, S) { + var T = /\D{0,2}$/.exec(g), C = parseFloat(g); + switch (S || (S = c.Text.DEFAULT_SVG_FONT_SIZE), T[0]) { + case "mm": + return C * c.DPI / 25.4; + case "cm": + return C * c.DPI / 2.54; + case "in": + return C * c.DPI; + case "pt": + return C * c.DPI / 72; + case "pc": + return C * c.DPI / 72 * 12; + case "em": + return C * S; + default: + return C; + } + }, + /** + * Function which always returns `false`. + * @static + * @memberOf fabric.util + * @return {Boolean} + */ + falseFunction: function() { + return !1; + }, + /** + * Returns klass "Class" object of given namespace + * @memberOf fabric.util + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + * @return {Object} klass "Class" + */ + getKlass: function(g, S) { + return g = c.util.string.camelize(g.charAt(0).toUpperCase() + g.slice(1)), c.util.resolveNamespace(S)[g]; + }, + /** + * Returns array of attributes for given svg that fabric parses + * @memberOf fabric.util + * @param {String} type Type of svg element (eg. 'circle') + * @return {Array} string names of supported attributes + */ + getSvgAttributes: function(g) { + var S = [ + "instantiated_by_use", + "style", + "id", + "class" + ]; + switch (g) { + case "linearGradient": + S = S.concat(["x1", "y1", "x2", "y2", "gradientUnits", "gradientTransform"]); + break; + case "radialGradient": + S = S.concat(["gradientUnits", "gradientTransform", "cx", "cy", "r", "fx", "fy", "fr"]); + break; + case "stop": + S = S.concat(["offset", "stop-color", "stop-opacity"]); + break; + } + return S; + }, + /** + * Returns object of given namespace + * @memberOf fabric.util + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + * @return {Object} Object for given namespace (default fabric) + */ + resolveNamespace: function(g) { + if (!g) + return c; + var S = g.split("."), T = S.length, C, E = p || c.window; + for (C = 0; C < T; ++C) + E = E[S[C]]; + return E; + }, + /** + * Loads image element from given url and passes it to a callback + * @memberOf fabric.util + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {*} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage: function(g, S, T, C) { + if (!g) { + S && S.call(T, g); + return; + } + var E = c.util.createImage(), M = function() { + S && S.call(T, E, !1), E = E.onload = E.onerror = null; + }; + E.onload = M, E.onerror = function() { + c.log("Error loading " + E.src), S && S.call(T, null, !0), E = E.onload = E.onerror = null; + }, g.indexOf("data") !== 0 && C !== void 0 && C !== null && (E.crossOrigin = C), g.substring(0, 14) === "data:image/svg" && (E.onload = null, c.util.loadImageInDom(E, M)), E.src = g; + }, + /** + * Attaches SVG image with data: URL to the dom + * @memberOf fabric.util + * @param {Object} img Image object with data:image/svg src + * @param {Function} callback Callback; invoked with loaded image + * @return {Object} DOM element (div containing the SVG image) + */ + loadImageInDom: function(g, S) { + var T = c.document.createElement("div"); + T.style.width = T.style.height = "1px", T.style.left = T.style.top = "-100%", T.style.position = "absolute", T.appendChild(g), c.document.querySelector("body").appendChild(T), g.onload = function() { + S(), T.parentNode.removeChild(T), T = null; + }; + }, + /** + * Creates corresponding fabric instances from their object representations + * @static + * @memberOf fabric.util + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, + * called after each fabric object created. + */ + enlivenObjects: function(g, S, T, C) { + g = g || []; + var E = [], M = 0, P = g.length; + function R() { + ++M === P && S && S(E.filter(function(N) { + return N; + })); + } + if (!P) { + S && S(E); + return; + } + g.forEach(function(N, F) { + if (!N || !N.type) { + R(); + return; + } + var U = c.util.getKlass(N.type, T); + U.fromObject(N, function($, G) { + G || (E[F] = $), C && C(N, $, G), R(); + }); + }); + }, + /** + * Create and wait for loading of patterns + * @static + * @memberOf fabric.util + * @param {Array} patterns Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * called after each fabric object created. + */ + enlivenPatterns: function(g, S) { + g = g || []; + function T() { + ++E === M && S && S(C); + } + var C = [], E = 0, M = g.length; + if (!M) { + S && S(C); + return; + } + g.forEach(function(P, R) { + P && P.source ? new c.Pattern(P, function(N) { + C[R] = N, T(); + }) : (C[R] = P, T()); + }); + }, + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @static + * @memberOf fabric.util + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + * @param {String} path Value to set sourcePath to + * @return {fabric.Object|fabric.Group} + */ + groupSVGElements: function(g, S, T) { + var C; + return g && g.length === 1 ? g[0] : (S && (S.width && S.height ? S.centerPoint = { + x: S.width / 2, + y: S.height / 2 + } : (delete S.width, delete S.height)), C = new c.Group(g, S), typeof T != "undefined" && (C.sourcePath = T), C); + }, + /** + * Populates an object with properties of another object + * @static + * @memberOf fabric.util + * @param {Object} source Source object + * @param {Object} destination Destination object + * @return {Array} properties Properties names to include + */ + populateWithProperties: function(g, S, T) { + if (T && Object.prototype.toString.call(T) === "[object Array]") + for (var C = 0, E = T.length; C < E; C++) + T[C] in g && (S[T[C]] = g[T[C]]); + }, + /** + * WARNING: THIS WAS TO SUPPORT OLD BROWSERS. deprecated. + * WILL BE REMOVED IN FABRIC 5.0 + * Draws a dashed line between two points + * + * This method is used to draw dashed line around selection area. + * See dotted stroke in canvas + * + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + * @deprecated + */ + drawDashedLine: function(g, S, T, C, E, M) { + var P = C - S, R = E - T, N = d(P * P + R * R), F = m(R, P), U = M.length, $ = 0, G = !0; + for (g.save(), g.translate(S, T), g.moveTo(0, 0), g.rotate(F), S = 0; N > S; ) + S += M[$++ % U], S > N && (S = N), g[G ? "lineTo" : "moveTo"](S, 0), G = !G; + g.restore(); + }, + /** + * Creates canvas element + * @static + * @memberOf fabric.util + * @return {CanvasElement} initialized canvas element + */ + createCanvasElement: function() { + return c.document.createElement("canvas"); + }, + /** + * Creates a canvas element that is a copy of another and is also painted + * @param {CanvasElement} canvas to copy size and content of + * @static + * @memberOf fabric.util + * @return {CanvasElement} initialized canvas element + */ + copyCanvasElement: function(g) { + var S = c.util.createCanvasElement(); + return S.width = g.width, S.height = g.height, S.getContext("2d").drawImage(g, 0, 0), S; + }, + /** + * since 2.6.0 moved from canvas instance to utility. + * @param {CanvasElement} canvasEl to copy size and content of + * @param {String} format 'jpeg' or 'png', in some browsers 'webp' is ok too + * @param {Number} quality <= 1 and > 0 + * @static + * @memberOf fabric.util + * @return {String} data url + */ + toDataURL: function(g, S, T) { + return g.toDataURL("image/" + S, T); + }, + /** + * Creates image element (works on client and node) + * @static + * @memberOf fabric.util + * @return {HTMLImageElement} HTML image element + */ + createImage: function() { + return c.document.createElement("img"); + }, + /** + * Multiply matrix A by matrix B to nest transformations + * @static + * @memberOf fabric.util + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + * @param {Boolean} is2x2 flag to multiply matrices as 2x2 matrices + * @return {Array} The product of the two transform matrices + */ + multiplyTransformMatrices: function(g, S, T) { + return [ + g[0] * S[0] + g[2] * S[1], + g[1] * S[0] + g[3] * S[1], + g[0] * S[2] + g[2] * S[3], + g[1] * S[2] + g[3] * S[3], + T ? 0 : g[0] * S[4] + g[2] * S[5] + g[4], + T ? 0 : g[1] * S[4] + g[3] * S[5] + g[5] + ]; + }, + /** + * Decomposes standard 2x3 matrix into transform components + * @static + * @memberOf fabric.util + * @param {Array} a transformMatrix + * @return {Object} Components of transform + */ + qrDecompose: function(g) { + var S = m(g[1], g[0]), T = _(g[0], 2) + _(g[1], 2), C = d(T), E = (g[0] * g[3] - g[2] * g[1]) / C, M = m(g[0] * g[2] + g[1] * g[3], T); + return { + angle: S / y, + scaleX: C, + scaleY: E, + skewX: M / y, + skewY: 0, + translateX: g[4], + translateY: g[5] + }; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.angle] angle in degrees + * @return {Number[]} transform matrix + */ + calcRotateMatrix: function(g) { + if (!g.angle) + return c.iMatrix.concat(); + var S = c.util.degreesToRadians(g.angle), T = c.util.cos(S), C = c.util.sin(S); + return [T, C, -C, T, 0, 0]; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet. + * is called DimensionsTransformMatrix because those properties are the one that influence + * the size of the resulting box of the object. + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.scaleX] + * @param {Number} [options.scaleY] + * @param {Boolean} [options.flipX] + * @param {Boolean} [options.flipY] + * @param {Number} [options.skewX] + * @param {Number} [options.skewX] + * @return {Number[]} transform matrix + */ + calcDimensionsMatrix: function(g) { + var S = typeof g.scaleX == "undefined" ? 1 : g.scaleX, T = typeof g.scaleY == "undefined" ? 1 : g.scaleY, C = [ + g.flipX ? -S : S, + 0, + 0, + g.flipY ? -T : T, + 0, + 0 + ], E = c.util.multiplyTransformMatrices, M = c.util.degreesToRadians; + return g.skewX && (C = E( + C, + [1, 0, Math.tan(M(g.skewX)), 1], + !0 + )), g.skewY && (C = E( + C, + [1, Math.tan(M(g.skewY)), 0, 1], + !0 + )), C; + }, + /** + * Returns a transform matrix starting from an object of the same kind of + * the one returned from qrDecompose, useful also if you want to calculate some + * transformations from an object that is not enlived yet + * @static + * @memberOf fabric.util + * @param {Object} options + * @param {Number} [options.angle] + * @param {Number} [options.scaleX] + * @param {Number} [options.scaleY] + * @param {Boolean} [options.flipX] + * @param {Boolean} [options.flipY] + * @param {Number} [options.skewX] + * @param {Number} [options.skewX] + * @param {Number} [options.translateX] + * @param {Number} [options.translateY] + * @return {Number[]} transform matrix + */ + composeMatrix: function(g) { + var S = [1, 0, 0, 1, g.translateX || 0, g.translateY || 0], T = c.util.multiplyTransformMatrices; + return g.angle && (S = T(S, c.util.calcRotateMatrix(g))), (g.scaleX !== 1 || g.scaleY !== 1 || g.skewX || g.skewY || g.flipX || g.flipY) && (S = T(S, c.util.calcDimensionsMatrix(g))), S; + }, + /** + * reset an object transform state to neutral. Top and left are not accounted for + * @static + * @memberOf fabric.util + * @param {fabric.Object} target object to transform + */ + resetObjectTransform: function(g) { + g.scaleX = 1, g.scaleY = 1, g.skewX = 0, g.skewY = 0, g.flipX = !1, g.flipY = !1, g.rotate(0); + }, + /** + * Extract Object transform values + * @static + * @memberOf fabric.util + * @param {fabric.Object} target object to read from + * @return {Object} Components of transform + */ + saveObjectTransform: function(g) { + return { + scaleX: g.scaleX, + scaleY: g.scaleY, + skewX: g.skewX, + skewY: g.skewY, + angle: g.angle, + left: g.left, + flipX: g.flipX, + flipY: g.flipY, + top: g.top + }; + }, + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent: function(g, S, T, C) { + C > 0 && (S > C ? S -= C : S = 0, T > C ? T -= C : T = 0); + var E = !0, M, P, R = g.getImageData(S, T, C * 2 || 1, C * 2 || 1), N = R.data.length; + for (M = 3; M < N && (P = R.data[M], E = P <= 0, E !== !1); M += 4) + ; + return R = null, E; + }, + /** + * Parse preserveAspectRatio attribute from element + * @param {string} attribute to be parsed + * @return {Object} an object containing align and meetOrSlice attribute + */ + parsePreserveAspectRatioAttribute: function(g) { + var S = "meet", T = "Mid", C = "Mid", E = g.split(" "), M; + return E && E.length && (S = E.pop(), S !== "meet" && S !== "slice" ? (M = S, S = "meet") : E.length && (M = E.pop())), T = M !== "none" ? M.slice(1, 4) : "none", C = M !== "none" ? M.slice(5, 8) : "none", { + meetOrSlice: S, + alignX: T, + alignY: C + }; + }, + /** + * Clear char widths cache for the given font family or all the cache if no + * fontFamily is specified. + * Use it if you know you are loading fonts in a lazy way and you are not waiting + * for custom fonts to load properly when adding text objects to the canvas. + * If a text object is added when its own font is not loaded yet, you will get wrong + * measurement and so wrong bounding boxes. + * After the font cache is cleared, either change the textObject text content or call + * initDimensions() to trigger a recalculation + * @memberOf fabric.util + * @param {String} [fontFamily] font family to clear + */ + clearFabricFontCache: function(g) { + g = (g || "").toLowerCase(), g ? c.charWidthsCache[g] && delete c.charWidthsCache[g] : c.charWidthsCache = {}; + }, + /** + * Given current aspect ratio, determines the max width and height that can + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Number} ar aspect ratio + * @param {Number} maximumArea Maximum area you want to achieve + * @return {Object.x} Limited dimensions by X + * @return {Object.y} Limited dimensions by Y + */ + limitDimsByArea: function(g, S) { + var T = Math.sqrt(S * g), C = Math.floor(S / T); + return { x: Math.floor(T), y: C }; + }, + capValue: function(g, S, T) { + return Math.max(g, Math.min(S, T)); + }, + /** + * Finds the scale for the object source to fit inside the object destination, + * keeping aspect ratio intact. + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Object | fabric.Object} source + * @param {Number} source.height natural unscaled height of the object + * @param {Number} source.width natural unscaled width of the object + * @param {Object | fabric.Object} destination + * @param {Number} destination.height natural unscaled height of the object + * @param {Number} destination.width natural unscaled width of the object + * @return {Number} scale factor to apply to source to fit into destination + */ + findScaleToFit: function(g, S) { + return Math.min(S.width / g.width, S.height / g.height); + }, + /** + * Finds the scale for the object source to cover entirely the object destination, + * keeping aspect ratio intact. + * respect the total allowed area for the cache. + * @memberOf fabric.util + * @param {Object | fabric.Object} source + * @param {Number} source.height natural unscaled height of the object + * @param {Number} source.width natural unscaled width of the object + * @param {Object | fabric.Object} destination + * @param {Number} destination.height natural unscaled height of the object + * @param {Number} destination.width natural unscaled width of the object + * @return {Number} scale factor to apply to source to cover destination + */ + findScaleToCover: function(g, S) { + return Math.max(S.width / g.width, S.height / g.height); + }, + /** + * given an array of 6 number returns something like `"matrix(...numbers)"` + * @memberOf fabric.util + * @param {Array} transform an array with 6 numbers + * @return {String} transform matrix for svg + * @return {Object.y} Limited dimensions by Y + */ + matrixToSVG: function(g) { + return "matrix(" + g.map(function(S) { + return c.util.toFixed(S, c.Object.NUM_FRACTION_DIGITS); + }).join(" ") + ")"; + }, + /** + * given an object and a transform, apply the inverse transform to the object, + * this is equivalent to remove from that object that transformation, so that + * added in a space with the removed transform, the object will be the same as before. + * Removing from an object a transform that scale by 2 is like scaling it by 1/2. + * Removing from an object a transfrom that rotate by 30deg is like rotating by 30deg + * in the opposite direction. + * This util is used to add objects inside transformed groups or nested groups. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + removeTransformFromObject: function(g, S) { + var T = c.util.invertTransform(S), C = c.util.multiplyTransformMatrices(T, g.calcOwnMatrix()); + c.util.applyTransformToObject(g, C); + }, + /** + * given an object and a transform, apply the transform to the object. + * this is equivalent to change the space where the object is drawn. + * Adding to an object a transform that scale by 2 is like scaling it by 2. + * This is used when removing an object from an active selection for example. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + addTransformToObject: function(g, S) { + c.util.applyTransformToObject( + g, + c.util.multiplyTransformMatrices(S, g.calcOwnMatrix()) + ); + }, + /** + * discard an object transform state and apply the one from the matrix. + * @memberOf fabric.util + * @param {fabric.Object} object the object you want to transform + * @param {Array} transform the destination transform + */ + applyTransformToObject: function(g, S) { + var T = c.util.qrDecompose(S), C = new c.Point(T.translateX, T.translateY); + g.flipX = !1, g.flipY = !1, g.set("scaleX", T.scaleX), g.set("scaleY", T.scaleY), g.skewX = T.skewX, g.skewY = T.skewY, g.angle = T.angle, g.setPositionByOrigin(C, "center", "center"); + }, + /** + * given a width and height, return the size of the bounding box + * that can contains the box with width/height with applied transform + * described in options. + * Use to calculate the boxes around objects for controls. + * @memberOf fabric.util + * @param {Number} width + * @param {Number} height + * @param {Object} options + * @param {Number} options.scaleX + * @param {Number} options.scaleY + * @param {Number} options.skewX + * @param {Number} options.skewY + * @return {Object.x} width of containing + * @return {Object.y} height of containing + */ + sizeAfterTransform: function(g, S, T) { + var C = g / 2, E = S / 2, M = [ + { + x: -C, + y: -E + }, + { + x: C, + y: -E + }, + { + x: -C, + y: E + }, + { + x: C, + y: E + } + ], P = c.util.calcDimensionsMatrix(T), R = c.util.makeBoundingBoxFromPoints(M, P); + return { + x: R.width, + y: R.height + }; + } + }; + }(l), function() { + var p = Array.prototype.join, d = { + m: 2, + l: 2, + h: 1, + v: 1, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }, m = { + m: "l", + M: "L" + }; + function _(se, te, pe, re, ae, le, ue, Ae, Te, Ne, He) { + var je = c.util.cos(se), be = c.util.sin(se), ge = c.util.cos(te), _e = c.util.sin(te), we = pe * ae * ge - re * le * _e + ue, Ie = re * ae * ge + pe * le * _e + Ae, Me = Ne + Te * (-pe * ae * be - re * le * je), et = He + Te * (-re * ae * be + pe * le * je), yt = we + Te * (pe * ae * _e + re * le * ge), vt = Ie + Te * (re * ae * _e - pe * le * ge); + return [ + "C", + Me, + et, + yt, + vt, + we, + Ie + ]; + } + function y(se, te, pe, re, ae, le, ue) { + var Ae = Math.PI, Te = ue * Ae / 180, Ne = c.util.sin(Te), He = c.util.cos(Te), je = 0, be = 0; + pe = Math.abs(pe), re = Math.abs(re); + var ge = -He * se * 0.5 - Ne * te * 0.5, _e = -He * te * 0.5 + Ne * se * 0.5, we = pe * pe, Ie = re * re, Me = _e * _e, et = ge * ge, yt = we * Ie - we * Me - Ie * et, vt = 0; + if (yt < 0) { + var ze = Math.sqrt(1 - yt / (we * Ie)); + pe *= ze, re *= ze; + } else + vt = (ae === le ? -1 : 1) * Math.sqrt(yt / (we * Me + Ie * et)); + var bt = vt * pe * _e / re, _t = -vt * re * ge / pe, $t = He * bt - Ne * _t + se * 0.5, fr = Ne * bt + He * _t + te * 0.5, _r = x(1, 0, (ge - bt) / pe, (_e - _t) / re), ar = x((ge - bt) / pe, (_e - _t) / re, (-ge - bt) / pe, (-_e - _t) / re); + le === 0 && ar > 0 ? ar -= 2 * Ae : le === 1 && ar < 0 && (ar += 2 * Ae); + for (var or = Math.ceil(Math.abs(ar / Ae * 2)), Tr = [], tn = ar / or, rn = 8 / 3 * Math.sin(tn / 4) * Math.sin(tn / 4) / Math.sin(tn / 2), qe = _r + tn, Xe = 0; Xe < or; Xe++) + Tr[Xe] = _(_r, qe, He, Ne, pe, re, $t, fr, rn, je, be), je = Tr[Xe][5], be = Tr[Xe][6], _r = qe, qe += tn; + return Tr; + } + function x(se, te, pe, re) { + var ae = Math.atan2(te, se), le = Math.atan2(re, pe); + return le >= ae ? le - ae : 2 * Math.PI - (ae - le); + } + function g(se, te, pe, re, ae, le, ue, Ae) { + var Te; + if (c.cachesBoundsOfCurve && (Te = p.call(arguments), c.boundsOfCurveCache[Te])) + return c.boundsOfCurveCache[Te]; + var Ne = Math.sqrt, He = Math.min, je = Math.max, be = Math.abs, ge = [], _e = [[], []], we, Ie, Me, et, yt, vt, ze, bt; + Ie = 6 * se - 12 * pe + 6 * ae, we = -3 * se + 9 * pe - 9 * ae + 3 * ue, Me = 3 * pe - 3 * se; + for (var _t = 0; _t < 2; ++_t) { + if (_t > 0 && (Ie = 6 * te - 12 * re + 6 * le, we = -3 * te + 9 * re - 9 * le + 3 * Ae, Me = 3 * re - 3 * te), be(we) < 1e-12) { + if (be(Ie) < 1e-12) + continue; + et = -Me / Ie, 0 < et && et < 1 && ge.push(et); + continue; + } + ze = Ie * Ie - 4 * Me * we, !(ze < 0) && (bt = Ne(ze), yt = (-Ie + bt) / (2 * we), 0 < yt && yt < 1 && ge.push(yt), vt = (-Ie - bt) / (2 * we), 0 < vt && vt < 1 && ge.push(vt)); + } + for (var $t, fr, _r = ge.length, ar = _r, or; _r--; ) + et = ge[_r], or = 1 - et, $t = or * or * or * se + 3 * or * or * et * pe + 3 * or * et * et * ae + et * et * et * ue, _e[0][_r] = $t, fr = or * or * or * te + 3 * or * or * et * re + 3 * or * et * et * le + et * et * et * Ae, _e[1][_r] = fr; + _e[0][ar] = se, _e[1][ar] = te, _e[0][ar + 1] = ue, _e[1][ar + 1] = Ae; + var Tr = [ + { + x: He.apply(null, _e[0]), + y: He.apply(null, _e[1]) + }, + { + x: je.apply(null, _e[0]), + y: je.apply(null, _e[1]) + } + ]; + return c.cachesBoundsOfCurve && (c.boundsOfCurveCache[Te] = Tr), Tr; + } + function S(se, te, pe) { + for (var re = pe[1], ae = pe[2], le = pe[3], ue = pe[4], Ae = pe[5], Te = pe[6], Ne = pe[7], He = y(Te - se, Ne - te, re, ae, ue, Ae, le), je = 0, be = He.length; je < be; je++) + He[je][1] += se, He[je][2] += te, He[je][3] += se, He[je][4] += te, He[je][5] += se, He[je][6] += te; + return He; + } + function T(se) { + var te = 0, pe = 0, re = se.length, ae = 0, le = 0, ue, Ae, Te, Ne = [], He, je, be; + for (Ae = 0; Ae < re; ++Ae) { + switch (Te = !1, ue = se[Ae].slice(0), ue[0]) { + case "l": + ue[0] = "L", ue[1] += te, ue[2] += pe; + case "L": + te = ue[1], pe = ue[2]; + break; + case "h": + ue[1] += te; + case "H": + ue[0] = "L", ue[2] = pe, te = ue[1]; + break; + case "v": + ue[1] += pe; + case "V": + ue[0] = "L", pe = ue[1], ue[1] = te, ue[2] = pe; + break; + case "m": + ue[0] = "M", ue[1] += te, ue[2] += pe; + case "M": + te = ue[1], pe = ue[2], ae = ue[1], le = ue[2]; + break; + case "c": + ue[0] = "C", ue[1] += te, ue[2] += pe, ue[3] += te, ue[4] += pe, ue[5] += te, ue[6] += pe; + case "C": + je = ue[3], be = ue[4], te = ue[5], pe = ue[6]; + break; + case "s": + ue[0] = "S", ue[1] += te, ue[2] += pe, ue[3] += te, ue[4] += pe; + case "S": + He === "C" ? (je = 2 * te - je, be = 2 * pe - be) : (je = te, be = pe), te = ue[3], pe = ue[4], ue[0] = "C", ue[5] = ue[3], ue[6] = ue[4], ue[3] = ue[1], ue[4] = ue[2], ue[1] = je, ue[2] = be, je = ue[3], be = ue[4]; + break; + case "q": + ue[0] = "Q", ue[1] += te, ue[2] += pe, ue[3] += te, ue[4] += pe; + case "Q": + je = ue[1], be = ue[2], te = ue[3], pe = ue[4]; + break; + case "t": + ue[0] = "T", ue[1] += te, ue[2] += pe; + case "T": + He === "Q" ? (je = 2 * te - je, be = 2 * pe - be) : (je = te, be = pe), ue[0] = "Q", te = ue[1], pe = ue[2], ue[1] = je, ue[2] = be, ue[3] = te, ue[4] = pe; + break; + case "a": + ue[0] = "A", ue[6] += te, ue[7] += pe; + case "A": + Te = !0, Ne = Ne.concat(S(te, pe, ue)), te = ue[6], pe = ue[7]; + break; + case "z": + case "Z": + te = ae, pe = le; + break; + } + Te || Ne.push(ue), He = ue[0]; + } + return Ne; + } + function C(se, te, pe, re) { + return Math.sqrt((pe - se) * (pe - se) + (re - te) * (re - te)); + } + function E(se) { + return se * se * se; + } + function M(se) { + return 3 * se * se * (1 - se); + } + function P(se) { + return 3 * se * (1 - se) * (1 - se); + } + function R(se) { + return (1 - se) * (1 - se) * (1 - se); + } + function N(se, te, pe, re, ae, le, ue, Ae) { + return function(Te) { + var Ne = E(Te), He = M(Te), je = P(Te), be = R(Te); + return { + x: ue * Ne + ae * He + pe * je + se * be, + y: Ae * Ne + le * He + re * je + te * be + }; + }; + } + function F(se, te, pe, re, ae, le, ue, Ae) { + return function(Te) { + var Ne = 1 - Te, He = 3 * Ne * Ne * (pe - se) + 6 * Ne * Te * (ae - pe) + 3 * Te * Te * (ue - ae), je = 3 * Ne * Ne * (re - te) + 6 * Ne * Te * (le - re) + 3 * Te * Te * (Ae - le); + return Math.atan2(je, He); + }; + } + function U(se) { + return se * se; + } + function $(se) { + return 2 * se * (1 - se); + } + function G(se) { + return (1 - se) * (1 - se); + } + function Q(se, te, pe, re, ae, le) { + return function(ue) { + var Ae = U(ue), Te = $(ue), Ne = G(ue); + return { + x: ae * Ae + pe * Te + se * Ne, + y: le * Ae + re * Te + te * Ne + }; + }; + } + function ee(se, te, pe, re, ae, le) { + return function(ue) { + var Ae = 1 - ue, Te = 2 * Ae * (pe - se) + 2 * ue * (ae - pe), Ne = 2 * Ae * (re - te) + 2 * ue * (le - re); + return Math.atan2(Ne, Te); + }; + } + function ce(se, te, pe) { + var re = { x: te, y: pe }, ae, le = 0, ue; + for (ue = 1; ue <= 100; ue += 1) + ae = se(ue / 100), le += C(re.x, re.y, ae.x, ae.y), re = ae; + return le; + } + function ne(se, te) { + for (var pe = 0, re = 0, ae = se.iterator, le = { x: se.x, y: se.y }, ue, Ae, Te = 0.01, Ne = se.angleFinder, He; re < te && pe <= 1 && Te > 1e-4; ) + ue = ae(pe), He = pe, Ae = C(le.x, le.y, ue.x, ue.y), Ae + re > te ? (Te /= 2, pe -= Te) : (le = ue, pe += Te, re += Ae); + return ue.angle = Ne(He), ue; + } + function fe(se) { + for (var te = 0, pe = se.length, re, ae = 0, le = 0, ue = 0, Ae = 0, Te = [], Ne, He, je, be = 0; be < pe; be++) { + switch (re = se[be], He = { + x: ae, + y: le, + command: re[0] + }, re[0]) { + case "M": + He.length = 0, ue = ae = re[1], Ae = le = re[2]; + break; + case "L": + He.length = C(ae, le, re[1], re[2]), ae = re[1], le = re[2]; + break; + case "C": + Ne = N( + ae, + le, + re[1], + re[2], + re[3], + re[4], + re[5], + re[6] + ), je = F( + ae, + le, + re[1], + re[2], + re[3], + re[4], + re[5], + re[6] + ), He.iterator = Ne, He.angleFinder = je, He.length = ce(Ne, ae, le), ae = re[5], le = re[6]; + break; + case "Q": + Ne = Q( + ae, + le, + re[1], + re[2], + re[3], + re[4] + ), je = ee( + ae, + le, + re[1], + re[2], + re[3], + re[4] + ), He.iterator = Ne, He.angleFinder = je, He.length = ce(Ne, ae, le), ae = re[3], le = re[4]; + break; + case "Z": + case "z": + He.destX = ue, He.destY = Ae, He.length = C(ae, le, ue, Ae), ae = ue, le = Ae; + break; + } + te += He.length, Te.push(He); + } + return Te.push({ length: te, x: ae, y: le }), Te; + } + function K(se, te, pe) { + pe || (pe = fe(se)); + for (var re = 0; te - pe[re].length > 0 && re < pe.length - 2; ) + te -= pe[re].length, re++; + var ae = pe[re], le = te / ae.length, ue = ae.command, Ae = se[re], Te; + switch (ue) { + case "M": + return { x: ae.x, y: ae.y, angle: 0 }; + case "Z": + case "z": + return Te = new c.Point(ae.x, ae.y).lerp( + new c.Point(ae.destX, ae.destY), + le + ), Te.angle = Math.atan2(ae.destY - ae.y, ae.destX - ae.x), Te; + case "L": + return Te = new c.Point(ae.x, ae.y).lerp( + new c.Point(Ae[1], Ae[2]), + le + ), Te.angle = Math.atan2(Ae[2] - ae.y, Ae[1] - ae.x), Te; + case "C": + return ne(ae, te); + case "Q": + return ne(ae, te); + } + } + function Oe(se) { + var te = [], pe = [], re, ae, le = c.rePathCommand, ue = "[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*", Ae = "(" + ue + ")" + c.commaWsp, Te = "([01])" + c.commaWsp + "?", Ne = Ae + "?" + Ae + "?" + Ae + Te + Te + Ae + "?(" + ue + ")", He = new RegExp(Ne, "g"), je, be, ge; + if (!se || !se.match) + return te; + ge = se.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi); + for (var _e = 0, we, Ie = ge.length; _e < Ie; _e++) { + re = ge[_e], be = re.slice(1).trim(), pe.length = 0; + var Me = re.charAt(0); + if (we = [Me], Me.toLowerCase() === "a") + for (var et; et = He.exec(be); ) + for (var yt = 1; yt < et.length; yt++) + pe.push(et[yt]); + else + for (; je = le.exec(be); ) + pe.push(je[0]); + for (var yt = 0, vt = pe.length; yt < vt; yt++) + ae = parseFloat(pe[yt]), isNaN(ae) || we.push(ae); + var ze = d[Me.toLowerCase()], bt = m[Me] || Me; + if (we.length - 1 > ze) + for (var _t = 1, $t = we.length; _t < $t; _t += ze) + te.push([Me].concat(we.slice(_t, _t + ze))), Me = bt; + else + te.push(we); + } + return te; + } + function xe(se, te) { + var pe = [], re, ae = new c.Point(se[0].x, se[0].y), le = new c.Point(se[1].x, se[1].y), ue = se.length, Ae = 1, Te = 0, Ne = ue > 2; + for (te = te || 0, Ne && (Ae = se[2].x < le.x ? -1 : se[2].x === le.x ? 0 : 1, Te = se[2].y < le.y ? -1 : se[2].y === le.y ? 0 : 1), pe.push(["M", ae.x - Ae * te, ae.y - Te * te]), re = 1; re < ue; re++) { + if (!ae.eq(le)) { + var He = ae.midPointFrom(le); + pe.push(["Q", ae.x, ae.y, He.x, He.y]); + } + ae = se[re], re + 1 < se.length && (le = se[re + 1]); + } + return Ne && (Ae = ae.x > se[re - 2].x ? 1 : ae.x === se[re - 2].x ? 0 : -1, Te = ae.y > se[re - 2].y ? 1 : ae.y === se[re - 2].y ? 0 : -1), pe.push(["L", ae.x + Ae * te, ae.y + Te * te]), pe; + } + function Ge(se, te, pe) { + return pe && (te = c.util.multiplyTransformMatrices( + te, + [1, 0, 0, 1, -pe.x, -pe.y] + )), se.map(function(re) { + for (var ae = re.slice(0), le = {}, ue = 1; ue < re.length - 1; ue += 2) + le.x = re[ue], le.y = re[ue + 1], le = c.util.transformPoint(le, te), ae[ue] = le.x, ae[ue + 1] = le.y; + return ae; + }); + } + function oe(se, te, pe, re, ae, le, ue, Ae, Te) { + for (var Ne = 0, He = 0, je, be = [], ge = y(Ae - se, Te - te, pe, re, le, ue, ae), _e = 0, we = ge.length; _e < we; _e++) + je = g(Ne, He, ge[_e][1], ge[_e][2], ge[_e][3], ge[_e][4], ge[_e][5], ge[_e][6]), be.push({ x: je[0].x + se, y: je[0].y + te }), be.push({ x: je[1].x + se, y: je[1].y + te }), Ne = ge[_e][5], He = ge[_e][6]; + return be; + } + function de(se, te, pe, re) { + re = re.slice(0).unshift("X"); + var ae = S(te, pe, re); + ae.forEach(function(le) { + se.bezierCurveTo.apply(se, le.slice(1)); + }); + } + c.util.joinPath = function(se) { + return se.map(function(te) { + return te.join(" "); + }).join(" "); + }, c.util.parsePath = Oe, c.util.makePathSimpler = T, c.util.getSmoothPathFromPoints = xe, c.util.getPathSegmentsInfo = fe, c.util.getBoundsOfCurve = g, c.util.getPointOnPath = K, c.util.transformPath = Ge, c.util.fromArcToBeizers = S, c.util.getBoundsOfArc = oe, c.util.drawArc = de; + }(), function() { + var p = Array.prototype.slice; + function d(g, S) { + for (var T = p.call(arguments, 2), C = [], E = 0, M = g.length; E < M; E++) + C[E] = T.length ? g[E][S].apply(g[E], T) : g[E][S].call(g[E]); + return C; + } + function m(g, S) { + return x(g, S, function(T, C) { + return T >= C; + }); + } + function _(g, S) { + return x(g, S, function(T, C) { + return T < C; + }); + } + function y(g, S) { + for (var T = g.length; T--; ) + g[T] = S; + return g; + } + function x(g, S, T) { + if (!(!g || g.length === 0)) { + var C = g.length - 1, E = S ? g[C][S] : g[C]; + if (S) + for (; C--; ) + T(g[C][S], E) && (E = g[C][S]); + else + for (; C--; ) + T(g[C], E) && (E = g[C]); + return E; + } + } + c.util.array = { + fill: y, + invoke: d, + min: _, + max: m + }; + }(), function() { + function p(m, _, y) { + if (y) + if (!c.isLikelyNode && _ instanceof Element) + m = _; + else if (_ instanceof Array) { + m = []; + for (var x = 0, g = _.length; x < g; x++) + m[x] = p({}, _[x], y); + } else if (_ && typeof _ == "object") + for (var S in _) + S === "canvas" || S === "group" ? m[S] = null : _.hasOwnProperty(S) && (m[S] = p({}, _[S], y)); + else + m = _; + else + for (var S in _) + m[S] = _[S]; + return m; + } + function d(m, _) { + return p({}, m, _); + } + c.util.object = { + extend: p, + clone: d + }, c.util.object.extend(c.util, c.Observable); + }(), function() { + function p(x) { + return x.replace(/-+(.)?/g, function(g, S) { + return S ? S.toUpperCase() : ""; + }); + } + function d(x, g) { + return x.charAt(0).toUpperCase() + (g ? x.slice(1) : x.slice(1).toLowerCase()); + } + function m(x) { + return x.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"); + } + function _(x) { + var g = 0, S, T = []; + for (g = 0, S; g < x.length; g++) + (S = y(x, g)) !== !1 && T.push(S); + return T; + } + function y(x, g) { + var S = x.charCodeAt(g); + if (isNaN(S)) + return ""; + if (S < 55296 || S > 57343) + return x.charAt(g); + if (55296 <= S && S <= 56319) { + if (x.length <= g + 1) + throw "High surrogate without following low surrogate"; + var T = x.charCodeAt(g + 1); + if (56320 > T || T > 57343) + throw "High surrogate without following low surrogate"; + return x.charAt(g) + x.charAt(g + 1); + } + if (g === 0) + throw "Low surrogate without preceding high surrogate"; + var C = x.charCodeAt(g - 1); + if (55296 > C || C > 56319) + throw "Low surrogate without preceding high surrogate"; + return !1; + } + c.util.string = { + camelize: p, + capitalize: d, + escapeXml: m, + graphemeSplit: _ + }; + }(), function() { + var p = Array.prototype.slice, d = function() { + }, m = function() { + for (var S in { toString: 1 }) + if (S === "toString") + return !1; + return !0; + }(), _ = function(S, T, C) { + for (var E in T) + E in S.prototype && typeof S.prototype[E] == "function" && (T[E] + "").indexOf("callSuper") > -1 ? S.prototype[E] = function(M) { + return function() { + var P = this.constructor.superclass; + this.constructor.superclass = C; + var R = T[M].apply(this, arguments); + if (this.constructor.superclass = P, M !== "initialize") + return R; + }; + }(E) : S.prototype[E] = T[E], m && (T.toString !== Object.prototype.toString && (S.prototype.toString = T.toString), T.valueOf !== Object.prototype.valueOf && (S.prototype.valueOf = T.valueOf)); + }; + function y() { + } + function x(S) { + for (var T = null, C = this; C.constructor.superclass; ) { + var E = C.constructor.superclass.prototype[S]; + if (C[S] !== E) { + T = E; + break; + } + C = C.constructor.superclass.prototype; + } + return T ? arguments.length > 1 ? T.apply(this, p.call(arguments, 1)) : T.call(this) : console.log("tried to callSuper " + S + ", method not found in prototype chain", this); + } + function g() { + var S = null, T = p.call(arguments, 0); + typeof T[0] == "function" && (S = T.shift()); + function C() { + this.initialize.apply(this, arguments); + } + C.superclass = S, C.subclasses = [], S && (y.prototype = S.prototype, C.prototype = new y(), S.subclasses.push(C)); + for (var E = 0, M = T.length; E < M; E++) + _(C, T[E], S); + return C.prototype.initialize || (C.prototype.initialize = d), C.prototype.constructor = C, C.prototype.callSuper = x, C; + } + c.util.createClass = g; + }(), function() { + var p = !!c.document.createElement("div").attachEvent, d = ["touchstart", "touchmove", "touchend"]; + c.util.addListener = function(_, y, x, g) { + _ && _.addEventListener(y, x, p ? !1 : g); + }, c.util.removeListener = function(_, y, x, g) { + _ && _.removeEventListener(y, x, p ? !1 : g); + }; + function m(_) { + var y = _.changedTouches; + return y && y[0] ? y[0] : _; + } + c.util.getPointer = function(_) { + var y = _.target, x = c.util.getScrollLeftTop(y), g = m(_); + return { + x: g.clientX + x.left, + y: g.clientY + x.top + }; + }, c.util.isTouchEvent = function(_) { + return d.indexOf(_.type) > -1 || _.pointerType === "touch"; + }; + }(), function() { + function p(g, S) { + var T = g.style; + if (!T) + return g; + if (typeof S == "string") + return g.style.cssText += ";" + S, S.indexOf("opacity") > -1 ? x(g, S.match(/opacity:\s*(\d?\.?\d*)/)[1]) : g; + for (var C in S) + if (C === "opacity") + x(g, S[C]); + else { + var E = C === "float" || C === "cssFloat" ? typeof T.styleFloat == "undefined" ? "cssFloat" : "styleFloat" : C; + T[E] = S[C]; + } + return g; + } + var d = c.document.createElement("div"), m = typeof d.style.opacity == "string", _ = typeof d.style.filter == "string", y = /alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/, x = function(g) { + return g; + }; + m ? x = function(g, S) { + return g.style.opacity = S, g; + } : _ && (x = function(g, S) { + var T = g.style; + return g.currentStyle && !g.currentStyle.hasLayout && (T.zoom = 1), y.test(T.filter) ? (S = S >= 0.9999 ? "" : "alpha(opacity=" + S * 100 + ")", T.filter = T.filter.replace(y, S)) : T.filter += " alpha(opacity=" + S * 100 + ")", g; + }), c.util.setStyle = p; + }(), function() { + var p = Array.prototype.slice; + function d(R) { + return typeof R == "string" ? c.document.getElementById(R) : R; + } + var m, _ = function(R) { + return p.call(R, 0); + }; + try { + m = _(c.document.childNodes) instanceof Array; + } catch (R) { + } + m || (_ = function(R) { + for (var N = new Array(R.length), F = R.length; F--; ) + N[F] = R[F]; + return N; + }); + function y(R, N) { + var F = c.document.createElement(R); + for (var U in N) + U === "class" ? F.className = N[U] : U === "for" ? F.htmlFor = N[U] : F.setAttribute(U, N[U]); + return F; + } + function x(R, N) { + R && (" " + R.className + " ").indexOf(" " + N + " ") === -1 && (R.className += (R.className ? " " : "") + N); + } + function g(R, N, F) { + return typeof N == "string" && (N = y(N, F)), R.parentNode && R.parentNode.replaceChild(N, R), N.appendChild(R), N; + } + function S(R) { + for (var N = 0, F = 0, U = c.document.documentElement, $ = c.document.body || { + scrollLeft: 0, + scrollTop: 0 + }; R && (R.parentNode || R.host) && (R = R.parentNode || R.host, R === c.document ? (N = $.scrollLeft || U.scrollLeft || 0, F = $.scrollTop || U.scrollTop || 0) : (N += R.scrollLeft || 0, F += R.scrollTop || 0), !(R.nodeType === 1 && R.style.position === "fixed")); ) + ; + return { left: N, top: F }; + } + function T(R) { + var N, F = R && R.ownerDocument, U = { left: 0, top: 0 }, $ = { left: 0, top: 0 }, G, Q = { + borderLeftWidth: "left", + borderTopWidth: "top", + paddingLeft: "left", + paddingTop: "top" + }; + if (!F) + return $; + for (var ee in Q) + $[Q[ee]] += parseInt(C(R, ee), 10) || 0; + return N = F.documentElement, typeof R.getBoundingClientRect != "undefined" && (U = R.getBoundingClientRect()), G = S(R), { + left: U.left + G.left - (N.clientLeft || 0) + $.left, + top: U.top + G.top - (N.clientTop || 0) + $.top + }; + } + var C; + c.document.defaultView && c.document.defaultView.getComputedStyle ? C = function(R, N) { + var F = c.document.defaultView.getComputedStyle(R, null); + return F ? F[N] : void 0; + } : C = function(R, N) { + var F = R.style[N]; + return !F && R.currentStyle && (F = R.currentStyle[N]), F; + }, function() { + var R = c.document.documentElement.style, N = "userSelect" in R ? "userSelect" : "MozUserSelect" in R ? "MozUserSelect" : "WebkitUserSelect" in R ? "WebkitUserSelect" : "KhtmlUserSelect" in R ? "KhtmlUserSelect" : ""; + function F($) { + return typeof $.onselectstart != "undefined" && ($.onselectstart = c.util.falseFunction), N ? $.style[N] = "none" : typeof $.unselectable == "string" && ($.unselectable = "on"), $; + } + function U($) { + return typeof $.onselectstart != "undefined" && ($.onselectstart = null), N ? $.style[N] = "" : typeof $.unselectable == "string" && ($.unselectable = ""), $; + } + c.util.makeElementUnselectable = F, c.util.makeElementSelectable = U; + }(); + function E(R) { + var N = c.jsdomImplForWrapper(R); + return N._canvas || N._image; + } + function M(R) { + if (c.isLikelyNode) { + var N = c.jsdomImplForWrapper(R); + N && (N._image = null, N._canvas = null, N._currentSrc = null, N._attributes = null, N._classList = null); + } + } + function P(R, N) { + R.imageSmoothingEnabled = R.imageSmoothingEnabled || R.webkitImageSmoothingEnabled || R.mozImageSmoothingEnabled || R.msImageSmoothingEnabled || R.oImageSmoothingEnabled, R.imageSmoothingEnabled = N; + } + c.util.setImageSmoothing = P, c.util.getById = d, c.util.toArray = _, c.util.addClass = x, c.util.makeElement = y, c.util.wrapElement = g, c.util.getScrollLeftTop = S, c.util.getElementOffset = T, c.util.getNodeCanvas = E, c.util.cleanUpJsdomNode = M; + }(), function() { + function p(_, y) { + return _ + (/\?/.test(_) ? "&" : "?") + y; + } + function d() { + } + function m(_, y) { + y || (y = {}); + var x = y.method ? y.method.toUpperCase() : "GET", g = y.onComplete || function() { + }, S = new c.window.XMLHttpRequest(), T = y.body || y.parameters; + return S.onreadystatechange = function() { + S.readyState === 4 && (g(S), S.onreadystatechange = d); + }, x === "GET" && (T = null, typeof y.parameters == "string" && (_ = p(_, y.parameters))), S.open(x, _, !0), (x === "POST" || x === "PUT") && S.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), S.send(T), S; + } + c.util.request = m; + }(), c.log = console.log, c.warn = console.warn, function() { + function p() { + return !1; + } + function d(S, T, C, E) { + return -C * Math.cos(S / E * (Math.PI / 2)) + C + T; + } + function m(S) { + var T = !1; + return x(function(C) { + S || (S = {}); + var E = C || +/* @__PURE__ */ new Date(), M = S.duration || 500, P = E + M, R, N = S.onChange || p, F = S.abort || p, U = S.onComplete || p, $ = S.easing || d, G = "startValue" in S ? S.startValue : 0, Q = "endValue" in S ? S.endValue : 100, ee = S.byValue || Q - G; + S.onStart && S.onStart(), function ce(ne) { + R = ne || +/* @__PURE__ */ new Date(); + var fe = R > P ? M : R - E, K = fe / M, Oe = $(fe, G, ee, M), xe = Math.abs((Oe - G) / ee); + if (!T) { + if (F(Oe, xe, K)) { + U(Q, 1, 1); + return; + } + if (R > P) { + N(Q, 1, 1), U(Q, 1, 1); + return; + } else + N(Oe, xe, K), x(ce); + } + }(E); + }), function() { + T = !0; + }; + } + var _ = c.window.requestAnimationFrame || c.window.webkitRequestAnimationFrame || c.window.mozRequestAnimationFrame || c.window.oRequestAnimationFrame || c.window.msRequestAnimationFrame || function(S) { + return c.window.setTimeout(S, 1e3 / 60); + }, y = c.window.cancelAnimationFrame || c.window.clearTimeout; + function x() { + return _.apply(c.window, arguments); + } + function g() { + return y.apply(c.window, arguments); + } + c.util.animate = m, c.util.requestAnimFrame = x, c.util.cancelAnimFrame = g; + }(), function() { + function p(m, _, y) { + var x = "rgba(" + parseInt(m[0] + y * (_[0] - m[0]), 10) + "," + parseInt(m[1] + y * (_[1] - m[1]), 10) + "," + parseInt(m[2] + y * (_[2] - m[2]), 10); + return x += "," + (m && _ ? parseFloat(m[3] + y * (_[3] - m[3])) : 1), x += ")", x; + } + function d(m, _, y, x) { + var g = new c.Color(m).getSource(), S = new c.Color(_).getSource(), T = x.onComplete, C = x.onChange; + return x = x || {}, c.util.animate(c.util.object.extend(x, { + duration: y || 500, + startValue: g, + endValue: S, + byValue: S, + easing: function(E, M, P, R) { + var N = x.colorEasing ? x.colorEasing(E, R) : 1 - Math.cos(E / R * (Math.PI / 2)); + return p(M, P, N); + }, + // has to take in account for color restoring; + onComplete: function(E, M, P) { + if (T) + return T( + p(S, S, 0), + M, + P + ); + }, + onChange: function(E, M, P) { + if (C) { + if (Array.isArray(E)) + return C( + p(E, E, 0), + M, + P + ); + C(E, M, P); + } + } + })); + } + c.util.animateColor = d; + }(), function() { + function p(oe, de, se, te) { + return oe < Math.abs(de) ? (oe = de, te = se / 4) : de === 0 && oe === 0 ? te = se / (2 * Math.PI) * Math.asin(1) : te = se / (2 * Math.PI) * Math.asin(de / oe), { a: oe, c: de, p: se, s: te }; + } + function d(oe, de, se) { + return oe.a * Math.pow(2, 10 * (de -= 1)) * Math.sin((de * se - oe.s) * (2 * Math.PI) / oe.p); + } + function m(oe, de, se, te) { + return se * ((oe = oe / te - 1) * oe * oe + 1) + de; + } + function _(oe, de, se, te) { + return oe /= te / 2, oe < 1 ? se / 2 * oe * oe * oe + de : se / 2 * ((oe -= 2) * oe * oe + 2) + de; + } + function y(oe, de, se, te) { + return se * (oe /= te) * oe * oe * oe + de; + } + function x(oe, de, se, te) { + return -se * ((oe = oe / te - 1) * oe * oe * oe - 1) + de; + } + function g(oe, de, se, te) { + return oe /= te / 2, oe < 1 ? se / 2 * oe * oe * oe * oe + de : -se / 2 * ((oe -= 2) * oe * oe * oe - 2) + de; + } + function S(oe, de, se, te) { + return se * (oe /= te) * oe * oe * oe * oe + de; + } + function T(oe, de, se, te) { + return se * ((oe = oe / te - 1) * oe * oe * oe * oe + 1) + de; + } + function C(oe, de, se, te) { + return oe /= te / 2, oe < 1 ? se / 2 * oe * oe * oe * oe * oe + de : se / 2 * ((oe -= 2) * oe * oe * oe * oe + 2) + de; + } + function E(oe, de, se, te) { + return -se * Math.cos(oe / te * (Math.PI / 2)) + se + de; + } + function M(oe, de, se, te) { + return se * Math.sin(oe / te * (Math.PI / 2)) + de; + } + function P(oe, de, se, te) { + return -se / 2 * (Math.cos(Math.PI * oe / te) - 1) + de; + } + function R(oe, de, se, te) { + return oe === 0 ? de : se * Math.pow(2, 10 * (oe / te - 1)) + de; + } + function N(oe, de, se, te) { + return oe === te ? de + se : se * (-Math.pow(2, -10 * oe / te) + 1) + de; + } + function F(oe, de, se, te) { + return oe === 0 ? de : oe === te ? de + se : (oe /= te / 2, oe < 1 ? se / 2 * Math.pow(2, 10 * (oe - 1)) + de : se / 2 * (-Math.pow(2, -10 * --oe) + 2) + de); + } + function U(oe, de, se, te) { + return -se * (Math.sqrt(1 - (oe /= te) * oe) - 1) + de; + } + function $(oe, de, se, te) { + return se * Math.sqrt(1 - (oe = oe / te - 1) * oe) + de; + } + function G(oe, de, se, te) { + return oe /= te / 2, oe < 1 ? -se / 2 * (Math.sqrt(1 - oe * oe) - 1) + de : se / 2 * (Math.sqrt(1 - (oe -= 2) * oe) + 1) + de; + } + function Q(oe, de, se, te) { + var pe = 1.70158, re = 0, ae = se; + if (oe === 0) + return de; + if (oe /= te, oe === 1) + return de + se; + re || (re = te * 0.3); + var le = p(ae, se, re, pe); + return -d(le, oe, te) + de; + } + function ee(oe, de, se, te) { + var pe = 1.70158, re = 0, ae = se; + if (oe === 0) + return de; + if (oe /= te, oe === 1) + return de + se; + re || (re = te * 0.3); + var le = p(ae, se, re, pe); + return le.a * Math.pow(2, -10 * oe) * Math.sin((oe * te - le.s) * (2 * Math.PI) / le.p) + le.c + de; + } + function ce(oe, de, se, te) { + var pe = 1.70158, re = 0, ae = se; + if (oe === 0) + return de; + if (oe /= te / 2, oe === 2) + return de + se; + re || (re = te * 0.44999999999999996); + var le = p(ae, se, re, pe); + return oe < 1 ? -0.5 * d(le, oe, te) + de : le.a * Math.pow(2, -10 * (oe -= 1)) * Math.sin((oe * te - le.s) * (2 * Math.PI) / le.p) * 0.5 + le.c + de; + } + function ne(oe, de, se, te, pe) { + return pe === void 0 && (pe = 1.70158), se * (oe /= te) * oe * ((pe + 1) * oe - pe) + de; + } + function fe(oe, de, se, te, pe) { + return pe === void 0 && (pe = 1.70158), se * ((oe = oe / te - 1) * oe * ((pe + 1) * oe + pe) + 1) + de; + } + function K(oe, de, se, te, pe) { + return pe === void 0 && (pe = 1.70158), oe /= te / 2, oe < 1 ? se / 2 * (oe * oe * (((pe *= 1.525) + 1) * oe - pe)) + de : se / 2 * ((oe -= 2) * oe * (((pe *= 1.525) + 1) * oe + pe) + 2) + de; + } + function Oe(oe, de, se, te) { + return se - xe(te - oe, 0, se, te) + de; + } + function xe(oe, de, se, te) { + return (oe /= te) < 0.36363636363636365 ? se * (7.5625 * oe * oe) + de : oe < 0.7272727272727273 ? se * (7.5625 * (oe -= 0.5454545454545454) * oe + 0.75) + de : oe < 0.9090909090909091 ? se * (7.5625 * (oe -= 0.8181818181818182) * oe + 0.9375) + de : se * (7.5625 * (oe -= 0.9545454545454546) * oe + 0.984375) + de; + } + function Ge(oe, de, se, te) { + return oe < te / 2 ? Oe(oe * 2, 0, se, te) * 0.5 + de : xe(oe * 2 - te, 0, se, te) * 0.5 + se * 0.5 + de; + } + c.util.ease = { + /** + * Quadratic easing in + * @memberOf fabric.util.ease + */ + easeInQuad: function(oe, de, se, te) { + return se * (oe /= te) * oe + de; + }, + /** + * Quadratic easing out + * @memberOf fabric.util.ease + */ + easeOutQuad: function(oe, de, se, te) { + return -se * (oe /= te) * (oe - 2) + de; + }, + /** + * Quadratic easing in and out + * @memberOf fabric.util.ease + */ + easeInOutQuad: function(oe, de, se, te) { + return oe /= te / 2, oe < 1 ? se / 2 * oe * oe + de : -se / 2 * (--oe * (oe - 2) - 1) + de; + }, + /** + * Cubic easing in + * @memberOf fabric.util.ease + */ + easeInCubic: function(oe, de, se, te) { + return se * (oe /= te) * oe * oe + de; + }, + easeOutCubic: m, + easeInOutCubic: _, + easeInQuart: y, + easeOutQuart: x, + easeInOutQuart: g, + easeInQuint: S, + easeOutQuint: T, + easeInOutQuint: C, + easeInSine: E, + easeOutSine: M, + easeInOutSine: P, + easeInExpo: R, + easeOutExpo: N, + easeInOutExpo: F, + easeInCirc: U, + easeOutCirc: $, + easeInOutCirc: G, + easeInElastic: Q, + easeOutElastic: ee, + easeInOutElastic: ce, + easeInBack: ne, + easeOutBack: fe, + easeInOutBack: K, + easeInBounce: Oe, + easeOutBounce: xe, + easeInOutBounce: Ge + }; + }(), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.util.object.clone, y = d.util.toFixed, x = d.util.parseUnit, g = d.util.multiplyTransformMatrices, S = [ + "path", + "circle", + "polygon", + "polyline", + "ellipse", + "rect", + "line", + "image", + "text" + ], T = ["symbol", "image", "marker", "pattern", "view", "svg"], C = ["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"], E = ["symbol", "g", "a", "svg", "clipPath", "defs"], M = { + cx: "left", + x: "left", + r: "radius", + cy: "top", + y: "top", + display: "visible", + visibility: "visible", + transform: "transformMatrix", + "fill-opacity": "fillOpacity", + "fill-rule": "fillRule", + "font-family": "fontFamily", + "font-size": "fontSize", + "font-style": "fontStyle", + "font-weight": "fontWeight", + "letter-spacing": "charSpacing", + "paint-order": "paintFirst", + "stroke-dasharray": "strokeDashArray", + "stroke-dashoffset": "strokeDashOffset", + "stroke-linecap": "strokeLineCap", + "stroke-linejoin": "strokeLineJoin", + "stroke-miterlimit": "strokeMiterLimit", + "stroke-opacity": "strokeOpacity", + "stroke-width": "strokeWidth", + "text-decoration": "textDecoration", + "text-anchor": "textAnchor", + opacity: "opacity", + "clip-path": "clipPath", + "clip-rule": "clipRule", + "vector-effect": "strokeUniform", + "image-rendering": "imageSmoothing" + }, P = { + stroke: "strokeOpacity", + fill: "fillOpacity" + }, R = "font-size", N = "clip-path"; + d.svgValidTagNamesRegEx = $(S), d.svgViewBoxElementsRegEx = $(T), d.svgInvalidAncestorsRegEx = $(C), d.svgValidParentsRegEx = $(E), d.cssRules = {}, d.gradientDefs = {}, d.clipPaths = {}; + function F(re) { + return re in M ? M[re] : re; + } + function U(re, ae, le, ue) { + var Ae = Object.prototype.toString.call(ae) === "[object Array]", Te; + if ((re === "fill" || re === "stroke") && ae === "none") + ae = ""; + else { + if (re === "strokeUniform") + return ae === "non-scaling-stroke"; + if (re === "strokeDashArray") + ae === "none" ? ae = null : ae = ae.replace(/,/g, " ").split(/\s+/).map(parseFloat); + else if (re === "transformMatrix") + le && le.transformMatrix ? ae = g( + le.transformMatrix, + d.parseTransformAttribute(ae) + ) : ae = d.parseTransformAttribute(ae); + else if (re === "visible") + ae = ae !== "none" && ae !== "hidden", le && le.visible === !1 && (ae = !1); + else if (re === "opacity") + ae = parseFloat(ae), le && typeof le.opacity != "undefined" && (ae *= le.opacity); + else if (re === "textAnchor") + ae = ae === "start" ? "left" : ae === "end" ? "right" : "center"; + else if (re === "charSpacing") + Te = x(ae, ue) / ue * 1e3; + else if (re === "paintFirst") { + var Ne = ae.indexOf("fill"), He = ae.indexOf("stroke"), ae = "fill"; + (Ne > -1 && He > -1 && He < Ne || Ne === -1 && He > -1) && (ae = "stroke"); + } else { + if (re === "href" || re === "xlink:href" || re === "font") + return ae; + if (re === "imageSmoothing") + return ae === "optimizeQuality"; + Te = Ae ? ae.map(x) : x(ae, ue); + } + } + return !Ae && isNaN(Te) ? ae : Te; + } + function $(re) { + return new RegExp("^(" + re.join("|") + ")\\b", "i"); + } + function G(re) { + for (var ae in P) + if (!(typeof re[P[ae]] == "undefined" || re[ae] === "")) { + if (typeof re[ae] == "undefined") { + if (!d.Object.prototype[ae]) + continue; + re[ae] = d.Object.prototype[ae]; + } + if (re[ae].indexOf("url(") !== 0) { + var le = new d.Color(re[ae]); + re[ae] = le.setAlpha(y(le.getAlpha() * re[P[ae]], 2)).toRgba(); + } + } + return re; + } + function Q(re, ae) { + var le, ue = [], Ae, Te, Ne; + for (Te = 0, Ne = ae.length; Te < Ne; Te++) + le = ae[Te], Ae = re.getElementsByTagName(le), ue = ue.concat(Array.prototype.slice.call(Ae)); + return ue; + } + d.parseTransformAttribute = function() { + function re(ze, bt) { + var _t = d.util.cos(bt[0]), $t = d.util.sin(bt[0]), fr = 0, _r = 0; + bt.length === 3 && (fr = bt[1], _r = bt[2]), ze[0] = _t, ze[1] = $t, ze[2] = -$t, ze[3] = _t, ze[4] = fr - (_t * fr - $t * _r), ze[5] = _r - ($t * fr + _t * _r); + } + function ae(ze, bt) { + var _t = bt[0], $t = bt.length === 2 ? bt[1] : bt[0]; + ze[0] = _t, ze[3] = $t; + } + function le(ze, bt, _t) { + ze[_t] = Math.tan(d.util.degreesToRadians(bt[0])); + } + function ue(ze, bt) { + ze[4] = bt[0], bt.length === 2 && (ze[5] = bt[1]); + } + var Ae = d.iMatrix, Te = d.reNum, Ne = d.commaWsp, He = "(?:(skewX)\\s*\\(\\s*(" + Te + ")\\s*\\))", je = "(?:(skewY)\\s*\\(\\s*(" + Te + ")\\s*\\))", be = "(?:(rotate)\\s*\\(\\s*(" + Te + ")(?:" + Ne + "(" + Te + ")" + Ne + "(" + Te + "))?\\s*\\))", ge = "(?:(scale)\\s*\\(\\s*(" + Te + ")(?:" + Ne + "(" + Te + "))?\\s*\\))", _e = "(?:(translate)\\s*\\(\\s*(" + Te + ")(?:" + Ne + "(" + Te + "))?\\s*\\))", we = "(?:(matrix)\\s*\\(\\s*(" + Te + ")" + Ne + "(" + Te + ")" + Ne + "(" + Te + ")" + Ne + "(" + Te + ")" + Ne + "(" + Te + ")" + Ne + "(" + Te + ")\\s*\\))", Ie = "(?:" + we + "|" + _e + "|" + ge + "|" + be + "|" + He + "|" + je + ")", Me = "(?:" + Ie + "(?:" + Ne + "*" + Ie + ")*)", et = "^\\s*(?:" + Me + "?)\\s*$", yt = new RegExp(et), vt = new RegExp(Ie, "g"); + return function(ze) { + var bt = Ae.concat(), _t = []; + if (!ze || ze && !yt.test(ze)) + return bt; + ze.replace(vt, function(fr) { + var _r = new RegExp(Ie).exec(fr).filter(function(Tr) { + return !!Tr; + }), ar = _r[1], or = _r.slice(2).map(parseFloat); + switch (ar) { + case "translate": + ue(bt, or); + break; + case "rotate": + or[0] = d.util.degreesToRadians(or[0]), re(bt, or); + break; + case "scale": + ae(bt, or); + break; + case "skewX": + le(bt, or, 2); + break; + case "skewY": + le(bt, or, 1); + break; + case "matrix": + bt = or; + break; + } + _t.push(bt.concat()), bt = Ae.concat(); + }); + for (var $t = _t[0]; _t.length > 1; ) + _t.shift(), $t = d.util.multiplyTransformMatrices($t, _t[0]); + return $t; + }; + }(); + function ee(re, ae) { + var le, ue; + re.replace(/;\s*$/, "").split(";").forEach(function(Ae) { + var Te = Ae.split(":"); + le = Te[0].trim().toLowerCase(), ue = Te[1].trim(), ae[le] = ue; + }); + } + function ce(re, ae) { + var le, ue; + for (var Ae in re) + typeof re[Ae] != "undefined" && (le = Ae.toLowerCase(), ue = re[Ae], ae[le] = ue); + } + function ne(re, ae) { + var le = {}; + for (var ue in d.cssRules[ae]) + if (fe(re, ue.split(" "))) + for (var Ae in d.cssRules[ae][ue]) + le[Ae] = d.cssRules[ae][ue][Ae]; + return le; + } + function fe(re, ae) { + var le, ue = !0; + return le = Oe(re, ae.pop()), le && ae.length && (ue = K(re, ae)), le && ue && ae.length === 0; + } + function K(re, ae) { + for (var le, ue = !0; re.parentNode && re.parentNode.nodeType === 1 && ae.length; ) + ue && (le = ae.pop()), re = re.parentNode, ue = Oe(re, le); + return ae.length === 0; + } + function Oe(re, ae) { + var le = re.nodeName, ue = re.getAttribute("class"), Ae = re.getAttribute("id"), Te, Ne; + if (Te = new RegExp("^" + le, "i"), ae = ae.replace(Te, ""), Ae && ae.length && (Te = new RegExp("#" + Ae + "(?![a-zA-Z\\-]+)", "i"), ae = ae.replace(Te, "")), ue && ae.length) + for (ue = ue.split(" "), Ne = ue.length; Ne--; ) + Te = new RegExp("\\." + ue[Ne] + "(?![a-zA-Z\\-]+)", "i"), ae = ae.replace(Te, ""); + return ae.length === 0; + } + function xe(re, ae) { + var le; + if (re.getElementById && (le = re.getElementById(ae)), le) + return le; + var ue, Ae, Te, Ne = re.getElementsByTagName("*"); + for (Ae = 0, Te = Ne.length; Ae < Te; Ae++) + if (ue = Ne[Ae], ae === ue.getAttribute("id")) + return ue; + } + function Ge(re) { + for (var ae = Q(re, ["use", "svg:use"]), le = 0; ae.length && le < ae.length; ) { + var ue = ae[le], Ae = ue.getAttribute("xlink:href") || ue.getAttribute("href"); + if (Ae === null) + return; + var Te = Ae.substr(1), Ne = ue.getAttribute("x") || 0, He = ue.getAttribute("y") || 0, je = xe(re, Te).cloneNode(!0), be = (je.getAttribute("transform") || "") + " translate(" + Ne + ", " + He + ")", ge, _e = ae.length, we, Ie, Me, et, yt = d.svgNS; + if (de(je), /^svg$/i.test(je.nodeName)) { + var vt = je.ownerDocument.createElementNS(yt, "g"); + for (Ie = 0, Me = je.attributes, et = Me.length; Ie < et; Ie++) + we = Me.item(Ie), vt.setAttributeNS(yt, we.nodeName, we.nodeValue); + for (; je.firstChild; ) + vt.appendChild(je.firstChild); + je = vt; + } + for (Ie = 0, Me = ue.attributes, et = Me.length; Ie < et; Ie++) + we = Me.item(Ie), !(we.nodeName === "x" || we.nodeName === "y" || we.nodeName === "xlink:href" || we.nodeName === "href") && (we.nodeName === "transform" ? be = we.nodeValue + " " + be : je.setAttribute(we.nodeName, we.nodeValue)); + je.setAttribute("transform", be), je.setAttribute("instantiated_by_use", "1"), je.removeAttribute("id"), ge = ue.parentNode, ge.replaceChild(je, ue), ae.length === _e && le++; + } + } + var oe = new RegExp( + "^\\s*(" + d.reNum + "+)\\s*,?\\s*(" + d.reNum + "+)\\s*,?\\s*(" + d.reNum + "+)\\s*,?\\s*(" + d.reNum + "+)\\s*$" + ); + function de(re) { + if (!d.svgViewBoxElementsRegEx.test(re.nodeName)) + return {}; + var ae = re.getAttribute("viewBox"), le = 1, ue = 1, Ae = 0, Te = 0, Ne, He, je, be, ge = re.getAttribute("width"), _e = re.getAttribute("height"), we = re.getAttribute("x") || 0, Ie = re.getAttribute("y") || 0, Me = re.getAttribute("preserveAspectRatio") || "", et = !ae || !(ae = ae.match(oe)), yt = !ge || !_e || ge === "100%" || _e === "100%", vt = et && yt, ze = {}, bt = "", _t = 0, $t = 0; + if (ze.width = 0, ze.height = 0, ze.toBeParsed = vt, et && (we || Ie) && re.parentNode && re.parentNode.nodeName !== "#document" && (bt = " translate(" + x(we) + " " + x(Ie) + ") ", je = (re.getAttribute("transform") || "") + bt, re.setAttribute("transform", je), re.removeAttribute("x"), re.removeAttribute("y")), vt) + return ze; + if (et) + return ze.width = x(ge), ze.height = x(_e), ze; + if (Ae = -parseFloat(ae[1]), Te = -parseFloat(ae[2]), Ne = parseFloat(ae[3]), He = parseFloat(ae[4]), ze.minX = Ae, ze.minY = Te, ze.viewBoxWidth = Ne, ze.viewBoxHeight = He, yt ? (ze.width = Ne, ze.height = He) : (ze.width = x(ge), ze.height = x(_e), le = ze.width / Ne, ue = ze.height / He), Me = d.util.parsePreserveAspectRatioAttribute(Me), Me.alignX !== "none" && (Me.meetOrSlice === "meet" && (ue = le = le > ue ? ue : le), Me.meetOrSlice === "slice" && (ue = le = le > ue ? le : ue), _t = ze.width - Ne * le, $t = ze.height - He * le, Me.alignX === "Mid" && (_t /= 2), Me.alignY === "Mid" && ($t /= 2), Me.alignX === "Min" && (_t = 0), Me.alignY === "Min" && ($t = 0)), le === 1 && ue === 1 && Ae === 0 && Te === 0 && we === 0 && Ie === 0) + return ze; + if ((we || Ie) && re.parentNode.nodeName !== "#document" && (bt = " translate(" + x(we) + " " + x(Ie) + ") "), je = bt + " matrix(" + le + " 0 0 " + ue + " " + (Ae * le + _t) + " " + (Te * ue + $t) + ") ", re.nodeName === "svg") { + for (be = re.ownerDocument.createElementNS(d.svgNS, "g"); re.firstChild; ) + be.appendChild(re.firstChild); + re.appendChild(be); + } else + be = re, be.removeAttribute("x"), be.removeAttribute("y"), je = be.getAttribute("transform") + je; + return be.setAttribute("transform", je), ze; + } + function se(re, ae) { + for (; re && (re = re.parentNode); ) + if (re.nodeName && ae.test(re.nodeName.replace("svg:", "")) && !re.getAttribute("instantiated_by_use")) + return !0; + return !1; + } + d.parseSVGDocument = function(re, ae, le, ue) { + if (re) { + Ge(re); + var Ae = d.Object.__uid++, Te, Ne, He = de(re), je = d.util.toArray(re.getElementsByTagName("*")); + if (He.crossOrigin = ue && ue.crossOrigin, He.svgUid = Ae, je.length === 0 && d.isLikelyNode) { + je = re.selectNodes('//*[name(.)!="svg"]'); + var be = []; + for (Te = 0, Ne = je.length; Te < Ne; Te++) + be[Te] = je[Te]; + je = be; + } + var ge = je.filter(function(we) { + return de(we), d.svgValidTagNamesRegEx.test(we.nodeName.replace("svg:", "")) && !se(we, d.svgInvalidAncestorsRegEx); + }); + if (!ge || ge && !ge.length) { + ae && ae([], {}); + return; + } + var _e = {}; + je.filter(function(we) { + return we.nodeName.replace("svg:", "") === "clipPath"; + }).forEach(function(we) { + var Ie = we.getAttribute("id"); + _e[Ie] = d.util.toArray(we.getElementsByTagName("*")).filter(function(Me) { + return d.svgValidTagNamesRegEx.test(Me.nodeName.replace("svg:", "")); + }); + }), d.gradientDefs[Ae] = d.getGradientDefs(re), d.cssRules[Ae] = d.getCSSRules(re), d.clipPaths[Ae] = _e, d.parseElements(ge, function(we, Ie) { + ae && (ae(we, He, Ie, je), delete d.gradientDefs[Ae], delete d.cssRules[Ae], delete d.clipPaths[Ae]); + }, _(He), le, ue); + } + }; + function te(re, ae) { + var le = ["gradientTransform", "x1", "x2", "y1", "y2", "gradientUnits", "cx", "cy", "r", "fx", "fy"], ue = "xlink:href", Ae = ae.getAttribute(ue).substr(1), Te = xe(re, Ae); + if (Te && Te.getAttribute(ue) && te(re, Te), le.forEach(function(He) { + Te && !ae.hasAttribute(He) && Te.hasAttribute(He) && ae.setAttribute(He, Te.getAttribute(He)); + }), !ae.children.length) + for (var Ne = Te.cloneNode(!0); Ne.firstChild; ) + ae.appendChild(Ne.firstChild); + ae.removeAttribute(ue); + } + var pe = new RegExp( + "(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + d.reNum + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + d.reNum + "))?\\s+(.*)" + ); + m(d, { + /** + * Parses a short font declaration, building adding its properties to a style object + * @static + * @function + * @memberOf fabric + * @param {String} value font declaration + * @param {Object} oStyle definition + */ + parseFontDeclaration: function(re, ae) { + var le = re.match(pe); + if (le) { + var ue = le[1], Ae = le[3], Te = le[4], Ne = le[5], He = le[6]; + ue && (ae.fontStyle = ue), Ae && (ae.fontWeight = isNaN(parseFloat(Ae)) ? Ae : parseFloat(Ae)), Te && (ae.fontSize = x(Te)), He && (ae.fontFamily = He), Ne && (ae.lineHeight = Ne === "normal" ? 1 : Ne); + } + }, + /** + * Parses an SVG document, returning all of the gradient declarations found in it + * @static + * @function + * @memberOf fabric + * @param {SVGDocument} doc SVG document to parse + * @return {Object} Gradient definitions; key corresponds to element id, value -- to gradient definition element + */ + getGradientDefs: function(re) { + var ae = [ + "linearGradient", + "radialGradient", + "svg:linearGradient", + "svg:radialGradient" + ], le = Q(re, ae), ue, Ae = 0, Te = {}; + for (Ae = le.length; Ae--; ) + ue = le[Ae], ue.getAttribute("xlink:href") && te(re, ue), Te[ue.getAttribute("id")] = ue; + return Te; + }, + /** + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @static + * @memberOf fabric + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + * @return {Object} object containing parsed attributes' names/values + */ + parseAttributes: function(re, ae, le) { + if (re) { + var ue, Ae = {}, Te, Ne; + typeof le == "undefined" && (le = re.getAttribute("svgUid")), re.parentNode && d.svgValidParentsRegEx.test(re.parentNode.nodeName) && (Ae = d.parseAttributes(re.parentNode, ae, le)); + var He = ae.reduce(function(Me, et) { + return ue = re.getAttribute(et), ue && (Me[et] = ue), Me; + }, {}), je = m( + ne(re, le), + d.parseStyleAttribute(re) + ); + He = m( + He, + je + ), je[N] && re.setAttribute(N, je[N]), Te = Ne = Ae.fontSize || d.Text.DEFAULT_SVG_FONT_SIZE, He[R] && (He[R] = Te = x(He[R], Ne)); + var be, ge, _e = {}; + for (var we in He) + be = F(we), ge = U(be, He[we], Ae, Te), _e[be] = ge; + _e && _e.font && d.parseFontDeclaration(_e.font, _e); + var Ie = m(Ae, _e); + return d.svgValidParentsRegEx.test(re.nodeName) ? Ie : G(Ie); + } + }, + /** + * Transforms an array of svg elements to corresponding fabric.* instances + * @static + * @memberOf fabric + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + parseElements: function(re, ae, le, ue, Ae) { + new d.ElementsParser(re, ae, le, ue, Ae).parse(); + }, + /** + * Parses "style" attribute, retuning an object with values + * @static + * @memberOf fabric + * @param {SVGElement} element Element to parse + * @return {Object} Objects with values parsed from style attribute of an element + */ + parseStyleAttribute: function(re) { + var ae = {}, le = re.getAttribute("style"); + return le && (typeof le == "string" ? ee(le, ae) : ce(le, ae)), ae; + }, + /** + * Parses "points" attribute, returning an array of values + * @static + * @memberOf fabric + * @param {String} points points attribute string + * @return {Array} array of points + */ + parsePointsAttribute: function(re) { + if (!re) + return null; + re = re.replace(/,/g, " ").trim(), re = re.split(/\s+/); + var ae = [], le, ue; + for (le = 0, ue = re.length; le < ue; le += 2) + ae.push({ + x: parseFloat(re[le]), + y: parseFloat(re[le + 1]) + }); + return ae; + }, + /** + * Returns CSS rules for a given SVG document + * @static + * @function + * @memberOf fabric + * @param {SVGDocument} doc SVG document to parse + * @return {Object} CSS rules of this document + */ + getCSSRules: function(re) { + var ae = re.getElementsByTagName("style"), le, ue, Ae = {}, Te; + for (le = 0, ue = ae.length; le < ue; le++) { + var Ne = ae[le].textContent; + Ne = Ne.replace(/\/\*[\s\S]*?\*\//g, ""), Ne.trim() !== "" && (Te = Ne.match(/[^{]*\{[\s\S]*?\}/g), Te = Te.map(function(He) { + return He.trim(); + }), Te.forEach(function(He) { + var je = He.match(/([\s\S]*?)\s*\{([^}]*)\}/), be = {}, ge = je[2].trim(), _e = ge.replace(/;$/, "").split(/\s*;\s*/); + for (le = 0, ue = _e.length; le < ue; le++) { + var we = _e[le].split(/\s*:\s*/), Ie = we[0], Me = we[1]; + be[Ie] = Me; + } + He = je[1], He.split(",").forEach(function(et) { + et = et.replace(/^svg/i, "").trim(), et !== "" && (Ae[et] ? d.util.object.extend(Ae[et], be) : Ae[et] = d.util.object.clone(be)); + }); + })); + } + return Ae; + }, + /** + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. + * Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @memberOf fabric + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + * @param {Object} [options] Object containing options for parsing + * @param {String} [options.crossOrigin] crossOrigin crossOrigin setting to use for external resources + */ + loadSVGFromURL: function(re, ae, le, ue) { + re = re.replace(/^\n\s*/, "").trim(), new d.util.request(re, { + method: "get", + onComplete: Ae + }); + function Ae(Te) { + var Ne = Te.responseXML; + if (!Ne || !Ne.documentElement) + return ae && ae(null), !1; + d.parseSVGDocument(Ne.documentElement, function(He, je, be, ge) { + ae && ae(He, je, be, ge); + }, le, ue); + } + }, + /** + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @memberOf fabric + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + * @param {Object} [options] Object containing options for parsing + * @param {String} [options.crossOrigin] crossOrigin crossOrigin setting to use for external resources + */ + loadSVGFromString: function(re, ae, le, ue) { + var Ae = new d.window.DOMParser(), Te = Ae.parseFromString(re.trim(), "text/xml"); + d.parseSVGDocument(Te.documentElement, function(Ne, He, je, be) { + ae(Ne, He, je, be); + }, le, ue); + } + }); + }(l), c.ElementsParser = function(p, d, m, _, y, x) { + this.elements = p, this.callback = d, this.options = m, this.reviver = _, this.svgUid = m && m.svgUid || 0, this.parsingOptions = y, this.regexUrl = /^url\(['"]?#([^'"]+)['"]?\)/g, this.doc = x; + }, function(p) { + p.parse = function() { + this.instances = new Array(this.elements.length), this.numElements = this.elements.length, this.createObjects(); + }, p.createObjects = function() { + var d = this; + this.elements.forEach(function(m, _) { + m.setAttribute("svgUid", d.svgUid), d.createObject(m, _); + }); + }, p.findTag = function(d) { + return c[c.util.string.capitalize(d.tagName.replace("svg:", ""))]; + }, p.createObject = function(d, m) { + var _ = this.findTag(d); + if (_ && _.fromElement) + try { + _.fromElement(d, this.createCallback(m, d), this.options); + } catch (y) { + c.log(y); + } + else + this.checkIfDone(); + }, p.createCallback = function(d, m) { + var _ = this; + return function(y) { + var x; + _.resolveGradient(y, m, "fill"), _.resolveGradient(y, m, "stroke"), y instanceof c.Image && y._originalElement && (x = y.parsePreserveAspectRatioAttribute(m)), y._removeTransformMatrix(x), _.resolveClipPath(y, m), _.reviver && _.reviver(m, y), _.instances[d] = y, _.checkIfDone(); + }; + }, p.extractPropertyDefinition = function(d, m, _) { + var y = d[m], x = this.regexUrl; + if (x.test(y)) { + x.lastIndex = 0; + var g = x.exec(y)[1]; + return x.lastIndex = 0, c[_][this.svgUid][g]; + } + }, p.resolveGradient = function(d, m, _) { + var y = this.extractPropertyDefinition(d, _, "gradientDefs"); + if (y) { + var x = m.getAttribute(_ + "-opacity"), g = c.Gradient.fromElement(y, d, x, this.options); + d.set(_, g); + } + }, p.createClipPathCallback = function(d, m) { + return function(_) { + _._removeTransformMatrix(), _.fillRule = _.clipRule, m.push(_); + }; + }, p.resolveClipPath = function(d, m) { + var _ = this.extractPropertyDefinition(d, "clipPath", "clipPaths"), y, x, g, S, T, C; + if (_) { + S = [], g = c.util.invertTransform(d.calcTransformMatrix()); + for (var E = _[0].parentNode, M = m; M.parentNode && M.getAttribute("clip-path") !== d.clipPath; ) + M = M.parentNode; + M.parentNode.appendChild(E); + for (var P = 0; P < _.length; P++) + y = _[P], x = this.findTag(y), x.fromElement( + y, + this.createClipPathCallback(d, S), + this.options + ); + S.length === 1 ? _ = S[0] : _ = new c.Group(S), T = c.util.multiplyTransformMatrices( + g, + _.calcTransformMatrix() + ), _.clipPath && this.resolveClipPath(_, M); + var C = c.util.qrDecompose(T); + _.flipX = !1, _.flipY = !1, _.set("scaleX", C.scaleX), _.set("scaleY", C.scaleY), _.angle = C.angle, _.skewX = C.skewX, _.skewY = 0, _.setPositionByOrigin({ x: C.translateX, y: C.translateY }, "center", "center"), d.clipPath = _; + } else + delete d.clipPath; + }, p.checkIfDone = function() { + --this.numElements === 0 && (this.instances = this.instances.filter(function(d) { + return d != null; + }), this.callback(this.instances, this.elements)); + }; + }(c.ElementsParser.prototype), function(p) { + var d = p.fabric || (p.fabric = {}); + if (d.Point) { + d.warn("fabric.Point is already defined"); + return; + } + d.Point = m; + function m(_, y) { + this.x = _, this.y = y; + } + m.prototype = /** @lends fabric.Point.prototype */ + { + type: "point", + constructor: m, + /** + * Adds another point to this one and returns another one + * @param {fabric.Point} that + * @return {fabric.Point} new Point instance with added values + */ + add: function(_) { + return new m(this.x + _.x, this.y + _.y); + }, + /** + * Adds another point to this one + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + * @chainable + */ + addEquals: function(_) { + return this.x += _.x, this.y += _.y, this; + }, + /** + * Adds value to this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} new Point with added value + */ + scalarAdd: function(_) { + return new m(this.x + _, this.y + _); + }, + /** + * Adds value to this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + scalarAddEquals: function(_) { + return this.x += _, this.y += _, this; + }, + /** + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + * @return {fabric.Point} new Point object with subtracted values + */ + subtract: function(_) { + return new m(this.x - _.x, this.y - _.y); + }, + /** + * Subtracts another point from this point + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + * @chainable + */ + subtractEquals: function(_) { + return this.x -= _.x, this.y -= _.y, this; + }, + /** + * Subtracts value from this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + scalarSubtract: function(_) { + return new m(this.x - _, this.y - _); + }, + /** + * Subtracts value from this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + scalarSubtractEquals: function(_) { + return this.x -= _, this.y -= _, this; + }, + /** + * Multiplies this point by a value and returns a new one + * TODO: rename in scalarMultiply in 2.0 + * @param {Number} scalar + * @return {fabric.Point} + */ + multiply: function(_) { + return new m(this.x * _, this.y * _); + }, + /** + * Multiplies this point by a value + * TODO: rename in scalarMultiplyEquals in 2.0 + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + multiplyEquals: function(_) { + return this.x *= _, this.y *= _, this; + }, + /** + * Divides this point by a value and returns a new one + * TODO: rename in scalarDivide in 2.0 + * @param {Number} scalar + * @return {fabric.Point} + */ + divide: function(_) { + return new m(this.x / _, this.y / _); + }, + /** + * Divides this point by a value + * TODO: rename in scalarDivideEquals in 2.0 + * @param {Number} scalar + * @return {fabric.Point} thisArg + * @chainable + */ + divideEquals: function(_) { + return this.x /= _, this.y /= _, this; + }, + /** + * Returns true if this point is equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + eq: function(_) { + return this.x === _.x && this.y === _.y; + }, + /** + * Returns true if this point is less than another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lt: function(_) { + return this.x < _.x && this.y < _.y; + }, + /** + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lte: function(_) { + return this.x <= _.x && this.y <= _.y; + }, + /** + + * Returns true if this point is greater another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gt: function(_) { + return this.x > _.x && this.y > _.y; + }, + /** + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gte: function(_) { + return this.x >= _.x && this.y >= _.y; + }, + /** + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t , position of interpolation, between 0 and 1 default 0.5 + * @return {fabric.Point} + */ + lerp: function(_, y) { + return typeof y == "undefined" && (y = 0.5), y = Math.max(Math.min(1, y), 0), new m(this.x + (_.x - this.x) * y, this.y + (_.y - this.y) * y); + }, + /** + * Returns distance from this point and another one + * @param {fabric.Point} that + * @return {Number} + */ + distanceFrom: function(_) { + var y = this.x - _.x, x = this.y - _.y; + return Math.sqrt(y * y + x * x); + }, + /** + * Returns the point between this point and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + midPointFrom: function(_) { + return this.lerp(_); + }, + /** + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + min: function(_) { + return new m(Math.min(this.x, _.x), Math.min(this.y, _.y)); + }, + /** + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + max: function(_) { + return new m(Math.max(this.x, _.x), Math.max(this.y, _.y)); + }, + /** + * Returns string representation of this point + * @return {String} + */ + toString: function() { + return this.x + "," + this.y; + }, + /** + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + * @chainable + */ + setXY: function(_, y) { + return this.x = _, this.y = y, this; + }, + /** + * Sets x of this point + * @param {Number} x + * @chainable + */ + setX: function(_) { + return this.x = _, this; + }, + /** + * Sets y of this point + * @param {Number} y + * @chainable + */ + setY: function(_) { + return this.y = _, this; + }, + /** + * Sets x/y of this point from another point + * @param {fabric.Point} that + * @chainable + */ + setFromPoint: function(_) { + return this.x = _.x, this.y = _.y, this; + }, + /** + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ + swap: function(_) { + var y = this.x, x = this.y; + this.x = _.x, this.y = _.y, _.x = y, _.y = x; + }, + /** + * return a cloned instance of the point + * @return {fabric.Point} + */ + clone: function() { + return new m(this.x, this.y); + } + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + if (d.Intersection) { + d.warn("fabric.Intersection is already defined"); + return; + } + function m(_) { + this.status = _, this.points = []; + } + d.Intersection = m, d.Intersection.prototype = /** @lends fabric.Intersection.prototype */ + { + constructor: m, + /** + * Appends a point to intersection + * @param {fabric.Point} point + * @return {fabric.Intersection} thisArg + * @chainable + */ + appendPoint: function(_) { + return this.points.push(_), this; + }, + /** + * Appends points to intersection + * @param {Array} points + * @return {fabric.Intersection} thisArg + * @chainable + */ + appendPoints: function(_) { + return this.points = this.points.concat(_), this; + } + }, d.Intersection.intersectLineLine = function(_, y, x, g) { + var S, T = (g.x - x.x) * (_.y - x.y) - (g.y - x.y) * (_.x - x.x), C = (y.x - _.x) * (_.y - x.y) - (y.y - _.y) * (_.x - x.x), E = (g.y - x.y) * (y.x - _.x) - (g.x - x.x) * (y.y - _.y); + if (E !== 0) { + var M = T / E, P = C / E; + 0 <= M && M <= 1 && 0 <= P && P <= 1 ? (S = new m("Intersection"), S.appendPoint(new d.Point(_.x + M * (y.x - _.x), _.y + M * (y.y - _.y)))) : S = new m(); + } else + T === 0 || C === 0 ? S = new m("Coincident") : S = new m("Parallel"); + return S; + }, d.Intersection.intersectLinePolygon = function(_, y, x) { + var g = new m(), S = x.length, T, C, E, M; + for (M = 0; M < S; M++) + T = x[M], C = x[(M + 1) % S], E = m.intersectLineLine(_, y, T, C), g.appendPoints(E.points); + return g.points.length > 0 && (g.status = "Intersection"), g; + }, d.Intersection.intersectPolygonPolygon = function(_, y) { + var x = new m(), g = _.length, S; + for (S = 0; S < g; S++) { + var T = _[S], C = _[(S + 1) % g], E = m.intersectLinePolygon(T, C, y); + x.appendPoints(E.points); + } + return x.points.length > 0 && (x.status = "Intersection"), x; + }, d.Intersection.intersectPolygonRectangle = function(_, y, x) { + var g = y.min(x), S = y.max(x), T = new d.Point(S.x, g.y), C = new d.Point(g.x, S.y), E = m.intersectLinePolygon(g, T, _), M = m.intersectLinePolygon(T, S, _), P = m.intersectLinePolygon(S, C, _), R = m.intersectLinePolygon(C, g, _), N = new m(); + return N.appendPoints(E.points), N.appendPoints(M.points), N.appendPoints(P.points), N.appendPoints(R.points), N.points.length > 0 && (N.status = "Intersection"), N; + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + if (d.Color) { + d.warn("fabric.Color is already defined."); + return; + } + function m(y) { + y ? this._tryParsingColor(y) : this.setSource([0, 0, 0, 1]); + } + d.Color = m, d.Color.prototype = /** @lends fabric.Color.prototype */ + { + /** + * @private + * @param {String|Array} color Color value to parse + */ + _tryParsingColor: function(y) { + var x; + y in m.colorNameMap && (y = m.colorNameMap[y]), y === "transparent" && (x = [255, 255, 255, 0]), x || (x = m.sourceFromHex(y)), x || (x = m.sourceFromRgb(y)), x || (x = m.sourceFromHsl(y)), x || (x = [0, 0, 0, 1]), x && this.setSource(x); + }, + /** + * Adapted from https://github.com/mjijackson + * @private + * @param {Number} r Red color value + * @param {Number} g Green color value + * @param {Number} b Blue color value + * @return {Array} Hsl color + */ + _rgbToHsl: function(y, x, g) { + y /= 255, x /= 255, g /= 255; + var S, T, C, E = d.util.array.max([y, x, g]), M = d.util.array.min([y, x, g]); + if (C = (E + M) / 2, E === M) + S = T = 0; + else { + var P = E - M; + switch (T = C > 0.5 ? P / (2 - E - M) : P / (E + M), E) { + case y: + S = (x - g) / P + (x < g ? 6 : 0); + break; + case x: + S = (g - y) / P + 2; + break; + case g: + S = (y - x) / P + 4; + break; + } + S /= 6; + } + return [ + Math.round(S * 360), + Math.round(T * 100), + Math.round(C * 100) + ]; + }, + /** + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + * @return {Array} + */ + getSource: function() { + return this._source; + }, + /** + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + * @param {Array} source + */ + setSource: function(y) { + this._source = y; + }, + /** + * Returns color representation in RGB format + * @return {String} ex: rgb(0-255,0-255,0-255) + */ + toRgb: function() { + var y = this.getSource(); + return "rgb(" + y[0] + "," + y[1] + "," + y[2] + ")"; + }, + /** + * Returns color representation in RGBA format + * @return {String} ex: rgba(0-255,0-255,0-255,0-1) + */ + toRgba: function() { + var y = this.getSource(); + return "rgba(" + y[0] + "," + y[1] + "," + y[2] + "," + y[3] + ")"; + }, + /** + * Returns color representation in HSL format + * @return {String} ex: hsl(0-360,0%-100%,0%-100%) + */ + toHsl: function() { + var y = this.getSource(), x = this._rgbToHsl(y[0], y[1], y[2]); + return "hsl(" + x[0] + "," + x[1] + "%," + x[2] + "%)"; + }, + /** + * Returns color representation in HSLA format + * @return {String} ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ + toHsla: function() { + var y = this.getSource(), x = this._rgbToHsl(y[0], y[1], y[2]); + return "hsla(" + x[0] + "," + x[1] + "%," + x[2] + "%," + y[3] + ")"; + }, + /** + * Returns color representation in HEX format + * @return {String} ex: FF5555 + */ + toHex: function() { + var y = this.getSource(), x, g, S; + return x = y[0].toString(16), x = x.length === 1 ? "0" + x : x, g = y[1].toString(16), g = g.length === 1 ? "0" + g : g, S = y[2].toString(16), S = S.length === 1 ? "0" + S : S, x.toUpperCase() + g.toUpperCase() + S.toUpperCase(); + }, + /** + * Returns color representation in HEXA format + * @return {String} ex: FF5555CC + */ + toHexa: function() { + var y = this.getSource(), x; + return x = Math.round(y[3] * 255), x = x.toString(16), x = x.length === 1 ? "0" + x : x, this.toHex() + x.toUpperCase(); + }, + /** + * Gets value of alpha channel for this color + * @return {Number} 0-1 + */ + getAlpha: function() { + return this.getSource()[3]; + }, + /** + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + * @return {fabric.Color} thisArg + */ + setAlpha: function(y) { + var x = this.getSource(); + return x[3] = y, this.setSource(x), this; + }, + /** + * Transforms color to its grayscale representation + * @return {fabric.Color} thisArg + */ + toGrayscale: function() { + var y = this.getSource(), x = parseInt((y[0] * 0.3 + y[1] * 0.59 + y[2] * 0.11).toFixed(0), 10), g = y[3]; + return this.setSource([x, x, x, g]), this; + }, + /** + * Transforms color to its black and white representation + * @param {Number} threshold + * @return {fabric.Color} thisArg + */ + toBlackWhite: function(y) { + var x = this.getSource(), g = (x[0] * 0.3 + x[1] * 0.59 + x[2] * 0.11).toFixed(0), S = x[3]; + return y = y || 127, g = Number(g) < Number(y) ? 0 : 255, this.setSource([g, g, g, S]), this; + }, + /** + * Overlays color with another color + * @param {String|fabric.Color} otherColor + * @return {fabric.Color} thisArg + */ + overlayWith: function(y) { + y instanceof m || (y = new m(y)); + var x = [], g = this.getAlpha(), S = 0.5, T = this.getSource(), C = y.getSource(), E; + for (E = 0; E < 3; E++) + x.push(Math.round(T[E] * (1 - S) + C[E] * S)); + return x[3] = g, this.setSource(x), this; + } + }, d.Color.reRGBa = /^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i, d.Color.reHSLa = /^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i, d.Color.reHex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i, d.Color.colorNameMap = { + aliceblue: "#F0F8FF", + antiquewhite: "#FAEBD7", + aqua: "#00FFFF", + aquamarine: "#7FFFD4", + azure: "#F0FFFF", + beige: "#F5F5DC", + bisque: "#FFE4C4", + black: "#000000", + blanchedalmond: "#FFEBCD", + blue: "#0000FF", + blueviolet: "#8A2BE2", + brown: "#A52A2A", + burlywood: "#DEB887", + cadetblue: "#5F9EA0", + chartreuse: "#7FFF00", + chocolate: "#D2691E", + coral: "#FF7F50", + cornflowerblue: "#6495ED", + cornsilk: "#FFF8DC", + crimson: "#DC143C", + cyan: "#00FFFF", + darkblue: "#00008B", + darkcyan: "#008B8B", + darkgoldenrod: "#B8860B", + darkgray: "#A9A9A9", + darkgrey: "#A9A9A9", + darkgreen: "#006400", + 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: "#FF00FF", + gainsboro: "#DCDCDC", + ghostwhite: "#F8F8FF", + gold: "#FFD700", + goldenrod: "#DAA520", + gray: "#808080", + grey: "#808080", + green: "#008000", + greenyellow: "#ADFF2F", + 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", + lightgrey: "#D3D3D3", + lightgreen: "#90EE90", + lightpink: "#FFB6C1", + lightsalmon: "#FFA07A", + lightseagreen: "#20B2AA", + lightskyblue: "#87CEFA", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#B0C4DE", + lightyellow: "#FFFFE0", + lime: "#00FF00", + limegreen: "#32CD32", + linen: "#FAF0E6", + magenta: "#FF00FF", + 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: "#FF0000", + 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: "#FFFFFF", + whitesmoke: "#F5F5F5", + yellow: "#FFFF00", + yellowgreen: "#9ACD32" + }; + function _(y, x, g) { + return g < 0 && (g += 1), g > 1 && (g -= 1), g < 0.16666666666666666 ? y + (x - y) * 6 * g : g < 0.5 ? x : g < 0.6666666666666666 ? y + (x - y) * (0.6666666666666666 - g) * 6 : y; + } + d.Color.fromRgb = function(y) { + return m.fromSource(m.sourceFromRgb(y)); + }, d.Color.sourceFromRgb = function(y) { + var x = y.match(m.reRGBa); + if (x) { + var g = parseInt(x[1], 10) / (/%$/.test(x[1]) ? 100 : 1) * (/%$/.test(x[1]) ? 255 : 1), S = parseInt(x[2], 10) / (/%$/.test(x[2]) ? 100 : 1) * (/%$/.test(x[2]) ? 255 : 1), T = parseInt(x[3], 10) / (/%$/.test(x[3]) ? 100 : 1) * (/%$/.test(x[3]) ? 255 : 1); + return [ + parseInt(g, 10), + parseInt(S, 10), + parseInt(T, 10), + x[4] ? parseFloat(x[4]) : 1 + ]; + } + }, d.Color.fromRgba = m.fromRgb, d.Color.fromHsl = function(y) { + return m.fromSource(m.sourceFromHsl(y)); + }, d.Color.sourceFromHsl = function(y) { + var x = y.match(m.reHSLa); + if (x) { + var g = (parseFloat(x[1]) % 360 + 360) % 360 / 360, S = parseFloat(x[2]) / (/%$/.test(x[2]) ? 100 : 1), T = parseFloat(x[3]) / (/%$/.test(x[3]) ? 100 : 1), C, E, M; + if (S === 0) + C = E = M = T; + else { + var P = T <= 0.5 ? T * (S + 1) : T + S - T * S, R = T * 2 - P; + C = _(R, P, g + 0.3333333333333333), E = _(R, P, g), M = _(R, P, g - 0.3333333333333333); + } + return [ + Math.round(C * 255), + Math.round(E * 255), + Math.round(M * 255), + x[4] ? parseFloat(x[4]) : 1 + ]; + } + }, d.Color.fromHsla = m.fromHsl, d.Color.fromHex = function(y) { + return m.fromSource(m.sourceFromHex(y)); + }, d.Color.sourceFromHex = function(y) { + if (y.match(m.reHex)) { + var x = y.slice(y.indexOf("#") + 1), g = x.length === 3 || x.length === 4, S = x.length === 8 || x.length === 4, T = g ? x.charAt(0) + x.charAt(0) : x.substring(0, 2), C = g ? x.charAt(1) + x.charAt(1) : x.substring(2, 4), E = g ? x.charAt(2) + x.charAt(2) : x.substring(4, 6), M = S ? g ? x.charAt(3) + x.charAt(3) : x.substring(6, 8) : "FF"; + return [ + parseInt(T, 16), + parseInt(C, 16), + parseInt(E, 16), + parseFloat((parseInt(M, 16) / 255).toFixed(2)) + ]; + } + }, d.Color.fromSource = function(y) { + var x = new m(); + return x.setSource(y), x; + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], _ = ["ns", "nesw", "ew", "nwse"], y = {}, x = "left", g = "top", S = "right", T = "bottom", C = "center", E = { + top: T, + bottom: g, + left: S, + right: x, + center: C + }, M = d.util.radiansToDegrees, P = Math.sign || function(be) { + return (be > 0) - (be < 0) || +be; + }; + function R(be, ge) { + var _e = be.angle + M(Math.atan2(ge.y, ge.x)) + 360; + return Math.round(_e % 360 / 45); + } + function N(be, ge) { + var _e = ge.transform.target, we = _e.canvas, Ie = d.util.object.clone(ge); + Ie.target = _e, we && we.fire("object:" + be, Ie), _e.fire(be, ge); + } + function F(be, ge) { + var _e = ge.canvas, we = _e.uniScaleKey, Ie = be[we]; + return _e.uniformScaling && !Ie || !_e.uniformScaling && Ie; + } + function U(be) { + return be.originX === C && be.originY === C; + } + function $(be, ge, _e) { + var we = be.lockScalingX, Ie = be.lockScalingY; + return !!(we && Ie || !ge && (we || Ie) && _e || we && ge === "x" || Ie && ge === "y"); + } + function G(be, ge, _e) { + var we = "not-allowed", Ie = F(be, _e), Me = ""; + if (ge.x !== 0 && ge.y === 0 ? Me = "x" : ge.x === 0 && ge.y !== 0 && (Me = "y"), $(_e, Me, Ie)) + return we; + var et = R(_e, ge); + return m[et] + "-resize"; + } + function Q(be, ge, _e) { + var we = "not-allowed"; + if (ge.x !== 0 && _e.lockSkewingY || ge.y !== 0 && _e.lockSkewingX) + return we; + var Ie = R(_e, ge) % 4; + return _[Ie] + "-resize"; + } + function ee(be, ge, _e) { + return be[_e.canvas.altActionKey] ? y.skewCursorStyleHandler(be, ge, _e) : y.scaleCursorStyleHandler(be, ge, _e); + } + function ce(be, ge, _e) { + var we = be[_e.canvas.altActionKey]; + if (ge.x === 0) + return we ? "skewX" : "scaleY"; + if (ge.y === 0) + return we ? "skewY" : "scaleX"; + } + function ne(be, ge, _e) { + return _e.lockRotation ? "not-allowed" : ge.cursorStyle; + } + function fe(be, ge, _e, we) { + return { + e: be, + transform: ge, + pointer: { + x: _e, + y: we + } + }; + } + function K(be) { + return function(ge, _e, we, Ie) { + var Me = _e.target, et = Me.getCenterPoint(), yt = Me.translateToOriginPoint(et, _e.originX, _e.originY), vt = be(ge, _e, we, Ie); + return Me.setPositionByOrigin(yt, _e.originX, _e.originY), vt; + }; + } + function Oe(be, ge) { + return function(_e, we, Ie, Me) { + var et = ge(_e, we, Ie, Me); + return et && N(be, fe(_e, we, Ie, Me)), et; + }; + } + function xe(be, ge, _e, we, Ie) { + var Me = be.target, et = Me.controls[be.corner], yt = Me.canvas.getZoom(), vt = Me.padding / yt, ze = Me.toLocalPoint(new d.Point(we, Ie), ge, _e); + return ze.x >= vt && (ze.x -= vt), ze.x <= -vt && (ze.x += vt), ze.y >= vt && (ze.y -= vt), ze.y <= vt && (ze.y += vt), ze.x -= et.offsetX, ze.y -= et.offsetY, ze; + } + function Ge(be) { + return be.flipX !== be.flipY; + } + function oe(be, ge, _e, we, Ie) { + if (be[ge] !== 0) { + var Me = be._getTransformedDimensions()[we], et = Ie / Me * be[_e]; + be.set(_e, et); + } + } + function de(be, ge, _e, we) { + var Ie = ge.target, Me = Ie._getTransformedDimensions(0, Ie.skewY), et = xe(ge, ge.originX, ge.originY, _e, we), yt = Math.abs(et.x * 2) - Me.x, vt = Ie.skewX, ze; + yt < 2 ? ze = 0 : (ze = M( + Math.atan2(yt / Ie.scaleX, Me.y / Ie.scaleY) + ), ge.originX === x && ge.originY === T && (ze = -ze), ge.originX === S && ge.originY === g && (ze = -ze), Ge(Ie) && (ze = -ze)); + var bt = vt !== ze; + if (bt) { + var _t = Ie._getTransformedDimensions().y; + Ie.set("skewX", ze), oe(Ie, "skewY", "scaleY", "y", _t); + } + return bt; + } + function se(be, ge, _e, we) { + var Ie = ge.target, Me = Ie._getTransformedDimensions(Ie.skewX, 0), et = xe(ge, ge.originX, ge.originY, _e, we), yt = Math.abs(et.y * 2) - Me.y, vt = Ie.skewY, ze; + yt < 2 ? ze = 0 : (ze = M( + Math.atan2(yt / Ie.scaleY, Me.x / Ie.scaleX) + ), ge.originX === x && ge.originY === T && (ze = -ze), ge.originX === S && ge.originY === g && (ze = -ze), Ge(Ie) && (ze = -ze)); + var bt = vt !== ze; + if (bt) { + var _t = Ie._getTransformedDimensions().x; + Ie.set("skewY", ze), oe(Ie, "skewX", "scaleX", "x", _t); + } + return bt; + } + function te(be, ge, _e, we) { + var Ie = ge.target, Me = Ie.skewX, et, yt = ge.originY; + if (Ie.lockSkewingX) + return !1; + if (Me === 0) { + var vt = xe(ge, C, C, _e, we); + vt.x > 0 ? et = x : et = S; + } else + Me > 0 && (et = yt === g ? x : S), Me < 0 && (et = yt === g ? S : x), Ge(Ie) && (et = et === x ? S : x); + ge.originX = et; + var ze = Oe("skewing", K(de)); + return ze(be, ge, _e, we); + } + function pe(be, ge, _e, we) { + var Ie = ge.target, Me = Ie.skewY, et, yt = ge.originX; + if (Ie.lockSkewingY) + return !1; + if (Me === 0) { + var vt = xe(ge, C, C, _e, we); + vt.y > 0 ? et = g : et = T; + } else + Me > 0 && (et = yt === x ? g : T), Me < 0 && (et = yt === x ? T : g), Ge(Ie) && (et = et === g ? T : g); + ge.originY = et; + var ze = Oe("skewing", K(se)); + return ze(be, ge, _e, we); + } + function re(be, ge, _e, we) { + var Ie = ge, Me = Ie.target, et = Me.translateToOriginPoint(Me.getCenterPoint(), Ie.originX, Ie.originY); + if (Me.lockRotation) + return !1; + var yt = Math.atan2(Ie.ey - et.y, Ie.ex - et.x), vt = Math.atan2(we - et.y, _e - et.x), ze = M(vt - yt + Ie.theta), bt = !0; + if (Me.snapAngle > 0) { + var _t = Me.snapAngle, $t = Me.snapThreshold || _t, fr = Math.ceil(ze / _t) * _t, _r = Math.floor(ze / _t) * _t; + Math.abs(ze - _r) < $t ? ze = _r : Math.abs(ze - fr) < $t && (ze = fr); + } + return ze < 0 && (ze = 360 + ze), ze %= 360, bt = Me.angle !== ze, Me.angle = ze, bt; + } + function ae(be, ge, _e, we, Ie) { + Ie = Ie || {}; + var Me = ge.target, et = Me.lockScalingX, yt = Me.lockScalingY, vt = Ie.by, ze, bt, _t, $t, fr = F(be, Me), _r = $(Me, vt, fr), ar, or, Tr = ge.gestureScale; + if (_r) + return !1; + if (Tr) + bt = ge.scaleX * Tr, _t = ge.scaleY * Tr; + else { + if (ze = xe(ge, ge.originX, ge.originY, _e, we), ar = vt !== "y" ? P(ze.x) : 1, or = vt !== "x" ? P(ze.y) : 1, ge.signX || (ge.signX = ar), ge.signY || (ge.signY = or), Me.lockScalingFlip && (ge.signX !== ar || ge.signY !== or)) + return !1; + if ($t = Me._getTransformedDimensions(), fr && !vt) { + var tn = Math.abs(ze.x) + Math.abs(ze.y), rn = ge.original, qe = Math.abs($t.x * rn.scaleX / Me.scaleX) + Math.abs($t.y * rn.scaleY / Me.scaleY), Xe = tn / qe; + bt = rn.scaleX * Xe, _t = rn.scaleY * Xe; + } else + bt = Math.abs(ze.x * Me.scaleX / $t.x), _t = Math.abs(ze.y * Me.scaleY / $t.y); + U(ge) && (bt *= 2, _t *= 2), ge.signX !== ar && vt !== "y" && (ge.originX = E[ge.originX], bt *= -1, ge.signX = ar), ge.signY !== or && vt !== "x" && (ge.originY = E[ge.originY], _t *= -1, ge.signY = or); + } + var Ze = Me.scaleX, st = Me.scaleY; + return vt ? (vt === "x" && Me.set("scaleX", bt), vt === "y" && Me.set("scaleY", _t)) : (!et && Me.set("scaleX", bt), !yt && Me.set("scaleY", _t)), Ze !== Me.scaleX || st !== Me.scaleY; + } + function le(be, ge, _e, we) { + return ae(be, ge, _e, we); + } + function ue(be, ge, _e, we) { + return ae(be, ge, _e, we, { by: "x" }); + } + function Ae(be, ge, _e, we) { + return ae(be, ge, _e, we, { by: "y" }); + } + function Te(be, ge, _e, we) { + return be[ge.target.canvas.altActionKey] ? y.skewHandlerX(be, ge, _e, we) : y.scalingY(be, ge, _e, we); + } + function Ne(be, ge, _e, we) { + return be[ge.target.canvas.altActionKey] ? y.skewHandlerY(be, ge, _e, we) : y.scalingX(be, ge, _e, we); + } + function He(be, ge, _e, we) { + var Ie = ge.target, Me = xe(ge, ge.originX, ge.originY, _e, we), et = Ie.strokeWidth / (Ie.strokeUniform ? Ie.scaleX : 1), yt = U(ge) ? 2 : 1, vt = Ie.width, ze = Math.abs(Me.x * yt / Ie.scaleX) - et; + return Ie.set("width", Math.max(ze, 0)), vt !== ze; + } + function je(be, ge, _e, we) { + var Ie = ge.target, Me = _e - ge.offsetX, et = we - ge.offsetY, yt = !Ie.get("lockMovementX") && Ie.left !== Me, vt = !Ie.get("lockMovementY") && Ie.top !== et; + return yt && Ie.set("left", Me), vt && Ie.set("top", et), (yt || vt) && N("moving", fe(be, ge, _e, we)), yt || vt; + } + y.scaleCursorStyleHandler = G, y.skewCursorStyleHandler = Q, y.scaleSkewCursorStyleHandler = ee, y.rotationWithSnapping = Oe("rotating", K(re)), y.scalingEqually = Oe("scaling", K(le)), y.scalingX = Oe("scaling", K(ue)), y.scalingY = Oe("scaling", K(Ae)), y.scalingYOrSkewingX = Te, y.scalingXOrSkewingY = Ne, y.changeWidth = Oe("resizing", K(He)), y.skewHandlerX = te, y.skewHandlerY = pe, y.dragHandler = je, y.scaleOrSkewActionName = ce, y.rotationStyleHandler = ne, y.fireEvent = N, y.wrapWithFixedAnchor = K, y.wrapWithFireEvent = Oe, y.getLocalPoint = xe, d.controlsUtils = y; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.degreesToRadians, _ = d.controlsUtils; + function y(g, S, T, C, E) { + C = C || {}; + var M = this.sizeX || C.cornerSize || E.cornerSize, P = this.sizeY || C.cornerSize || E.cornerSize, R = typeof C.transparentCorners != "undefined" ? C.transparentCorners : E.transparentCorners, N = R ? "stroke" : "fill", F = !R && (C.cornerStrokeColor || E.cornerStrokeColor), U = S, $ = T, G; + g.save(), g.fillStyle = C.cornerColor || E.cornerColor, g.strokeStyle = C.cornerStrokeColor || E.cornerStrokeColor, M > P ? (G = M, g.scale(1, P / M), $ = T * M / P) : P > M ? (G = P, g.scale(M / P, 1), U = S * P / M) : G = M, g.lineWidth = 1, g.beginPath(), g.arc(U, $, G / 2, 0, 2 * Math.PI, !1), g[N](), F && g.stroke(), g.restore(); + } + function x(g, S, T, C, E) { + C = C || {}; + var M = this.sizeX || C.cornerSize || E.cornerSize, P = this.sizeY || C.cornerSize || E.cornerSize, R = typeof C.transparentCorners != "undefined" ? C.transparentCorners : E.transparentCorners, N = R ? "stroke" : "fill", F = !R && (C.cornerStrokeColor || E.cornerStrokeColor), U = M / 2, $ = P / 2; + g.save(), g.fillStyle = C.cornerColor || E.cornerColor, g.strokeStyle = C.cornerStrokeColor || E.cornerStrokeColor, g.lineWidth = 1, g.translate(S, T), g.rotate(m(E.angle)), g[N + "Rect"](-U, -$, M, P), F && g.strokeRect(-U, -$, M, P), g.restore(); + } + _.renderCircleControl = y, _.renderSquareControl = x; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + function m(_) { + for (var y in _) + this[y] = _[y]; + } + d.Control = m, d.Control.prototype = /** @lends fabric.Control.prototype */ + { + /** + * keep track of control visibility. + * mainly for backward compatibility. + * if you do not want to see a control, you can remove it + * from the controlset. + * @type {Boolean} + * @default true + */ + visible: !0, + /** + * Name of the action that the control will likely execute. + * This is optional. FabricJS uses to identify what the user is doing for some + * extra optimizations. If you are writing a custom control and you want to know + * somewhere else in the code what is going on, you can use this string here. + * you can also provide a custom getActionName if your control run multiple actions + * depending on some external state. + * default to scale since is the most common, used on 4 corners by default + * @type {String} + * @default 'scale' + */ + actionName: "scale", + /** + * Drawing angle of the control. + * NOT used for now, but name marked as needed for internal logic + * example: to reuse the same drawing function for different rotated controls + * @type {Number} + * @default 0 + */ + angle: 0, + /** + * Relative position of the control. X + * 0,0 is the center of the Object, while -0.5 (left) or 0.5 (right) are the extremities + * of the bounding box. + * @type {Number} + * @default 0 + */ + x: 0, + /** + * Relative position of the control. Y + * 0,0 is the center of the Object, while -0.5 (top) or 0.5 (bottom) are the extremities + * of the bounding box. + * @type {Number} + * @default 0 + */ + y: 0, + /** + * Horizontal offset of the control from the defined position. In pixels + * Positive offset moves the control to the right, negative to the left. + * It used when you want to have position of control that does not scale with + * the bounding box. Example: rotation control is placed at x:0, y: 0.5 on + * the boundindbox, with an offset of 30 pixels vertically. Those 30 pixels will + * stay 30 pixels no matter how the object is big. Another example is having 2 + * controls in the corner, that stay in the same position when the object scale. + * of the bounding box. + * @type {Number} + * @default 0 + */ + offsetX: 0, + /** + * Vertical offset of the control from the defined position. In pixels + * Positive offset moves the control to the bottom, negative to the top. + * @type {Number} + * @default 0 + */ + offsetY: 0, + /** + * Sets the length of the control. If null, defaults to object's cornerSize. + * Expects both sizeX and sizeY to be set when set. + * @type {?Number} + * @default null + */ + sizeX: null, + /** + * Sets the height of the control. If null, defaults to object's cornerSize. + * Expects both sizeX and sizeY to be set when set. + * @type {?Number} + * @default null + */ + sizeY: null, + /** + * Sets the length of the touch area of the control. If null, defaults to object's touchCornerSize. + * Expects both touchSizeX and touchSizeY to be set when set. + * @type {?Number} + * @default null + */ + touchSizeX: null, + /** + * Sets the height of the touch area of the control. If null, defaults to object's touchCornerSize. + * Expects both touchSizeX and touchSizeY to be set when set. + * @type {?Number} + * @default null + */ + touchSizeY: null, + /** + * Css cursor style to display when the control is hovered. + * if the method `cursorStyleHandler` is provided, this property is ignored. + * @type {String} + * @default 'crosshair' + */ + cursorStyle: "crosshair", + /** + * If controls has an offsetY or offsetX, draw a line that connects + * the control to the bounding box + * @type {Boolean} + * @default false + */ + withConnection: !1, + /** + * The control actionHandler, provide one to handle action ( control being moved ) + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + actionHandler: function() { + }, + /** + * The control handler for mouse down, provide one to handle mouse down on control + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + mouseDownHandler: function() { + }, + /** + * The control mouseUpHandler, provide one to handle an effect on mouse up. + * @param {Event} eventData the native mouse event + * @param {Object} transformData properties of the current transform + * @param {Number} x x position of the cursor + * @param {Number} y y position of the cursor + * @return {Boolean} true if the action/event modified the object + */ + mouseUpHandler: function() { + }, + /** + * Returns control actionHandler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getActionHandler: function() { + return this.actionHandler; + }, + /** + * Returns control mouseDown handler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getMouseDownHandler: function() { + return this.mouseDownHandler; + }, + /** + * Returns control mouseUp handler + * @param {Event} eventData the native mouse event + * @param {fabric.Object} fabricObject on which the control is displayed + * @param {fabric.Control} control control for which the action handler is being asked + * @return {Function} the action handler + */ + getMouseUpHandler: function() { + return this.mouseUpHandler; + }, + /** + * Returns control cursorStyle for css using cursorStyle. If you need a more elaborate + * function you can pass one in the constructor + * the cursorStyle property + * @param {Event} eventData the native mouse event + * @param {fabric.Control} control the current control ( likely this) + * @param {fabric.Object} object on which the control is displayed + * @return {String} + */ + cursorStyleHandler: function(_, y) { + return y.cursorStyle; + }, + /** + * Returns the action name. The basic implementation just return the actionName property. + * @param {Event} eventData the native mouse event + * @param {fabric.Control} control the current control ( likely this) + * @param {fabric.Object} object on which the control is displayed + * @return {String} + */ + getActionName: function(_, y) { + return y.actionName; + }, + /** + * Returns controls visibility + * @param {fabric.Object} object on which the control is displayed + * @param {String} controlKey key where the control is memorized on the + * @return {Boolean} + */ + getVisibility: function(_, y) { + var x = _._controlsVisibility; + return x && typeof x[y] != "undefined" ? x[y] : this.visible; + }, + /** + * Sets controls visibility + * @param {Boolean} visibility for the object + * @return {Void} + */ + setVisibility: function(_) { + this.visible = _; + }, + positionHandler: function(_, y) { + var x = d.util.transformPoint({ + x: this.x * _.x + this.offsetX, + y: this.y * _.y + this.offsetY + }, y); + return x; + }, + /** + * Returns the coords for this control based on object values. + * @param {Number} objectAngle angle from the fabric object holding the control + * @param {Number} objectCornerSize cornerSize from the fabric object holding the control (or touchCornerSize if + * isTouch is true) + * @param {Number} centerX x coordinate where the control center should be + * @param {Number} centerY y coordinate where the control center should be + * @param {boolean} isTouch true if touch corner, false if normal corner + */ + calcCornerCoords: function(_, y, x, g, S) { + var T, C, E, M, P = S ? this.touchSizeX : this.sizeX, R = S ? this.touchSizeY : this.sizeY; + if (P && R && P !== R) { + var N = Math.atan2(R, P), F = Math.sqrt(P * P + R * R) / 2, U = N - d.util.degreesToRadians(_), $ = Math.PI / 2 - N - d.util.degreesToRadians(_); + T = F * d.util.cos(U), C = F * d.util.sin(U), E = F * d.util.cos($), M = F * d.util.sin($); + } else { + var G = P && R ? P : y; + F = G * 0.7071067812; + var U = d.util.degreesToRadians(45 - _); + T = E = F * d.util.cos(U), C = M = F * d.util.sin(U); + } + return { + tl: { + x: x - M, + y: g - E + }, + tr: { + x: x + T, + y: g - C + }, + bl: { + x: x - T, + y: g + C + }, + br: { + x: x + M, + y: g + E + } + }; + }, + /** + * Render function for the control. + * When this function runs the context is unscaled. unrotate. Just retina scaled. + * all the functions will have to translate to the point left,top before starting Drawing + * if they want to draw a control where the position is detected. + * left and top are the result of the positionHandler function + * @param {RenderingContext2D} ctx the context where the control will be drawn + * @param {Number} left position of the canvas where we are about to render the control. + * @param {Number} top position of the canvas where we are about to render the control. + * @param {Object} styleOverride + * @param {fabric.Object} fabricObject the object where the control is about to be rendered + */ + render: function(_, y, x, g, S) { + switch (g = g || {}, g.cornerStyle || S.cornerStyle) { + case "circle": + d.controlsUtils.renderCircleControl.call(this, _, y, x, g, S); + break; + default: + d.controlsUtils.renderSquareControl.call(this, _, y, x, g, S); + } + } + }; + }(l), function() { + function p(x, g) { + var S = x.getAttribute("style"), T = x.getAttribute("offset") || 0, C, E, M, P; + if (T = parseFloat(T) / (/%$/.test(T) ? 100 : 1), T = T < 0 ? 0 : T > 1 ? 1 : T, S) { + var R = S.split(/\s*;\s*/); + for (R[R.length - 1] === "" && R.pop(), P = R.length; P--; ) { + var N = R[P].split(/\s*:\s*/), F = N[0].trim(), U = N[1].trim(); + F === "stop-color" ? C = U : F === "stop-opacity" && (M = U); + } + } + return C || (C = x.getAttribute("stop-color") || "rgb(0,0,0)"), M || (M = x.getAttribute("stop-opacity")), C = new c.Color(C), E = C.getAlpha(), M = isNaN(parseFloat(M)) ? 1 : parseFloat(M), M *= E * g, { + offset: T, + color: C.toRgb(), + opacity: M + }; + } + function d(x) { + return { + x1: x.getAttribute("x1") || 0, + y1: x.getAttribute("y1") || 0, + x2: x.getAttribute("x2") || "100%", + y2: x.getAttribute("y2") || 0 + }; + } + function m(x) { + return { + x1: x.getAttribute("fx") || x.getAttribute("cx") || "50%", + y1: x.getAttribute("fy") || x.getAttribute("cy") || "50%", + r1: 0, + x2: x.getAttribute("cx") || "50%", + y2: x.getAttribute("cy") || "50%", + r2: x.getAttribute("r") || "50%" + }; + } + var _ = c.util.object.clone; + c.Gradient = c.util.createClass( + /** @lends fabric.Gradient.prototype */ + { + /** + * Horizontal offset for aligning gradients coming from SVG when outside pathgroups + * @type Number + * @default 0 + */ + offsetX: 0, + /** + * Vertical offset for aligning gradients coming from SVG when outside pathgroups + * @type Number + * @default 0 + */ + offsetY: 0, + /** + * A transform matrix to apply to the gradient before painting. + * Imported from svg gradients, is not applied with the current transform in the center. + * Before this transform is applied, the origin point is at the top left corner of the object + * plus the addition of offsetY and offsetX. + * @type Number[] + * @default null + */ + gradientTransform: null, + /** + * coordinates units for coords. + * If `pixels`, the number of coords are in the same unit of width / height. + * If set as `percentage` the coords are still a number, but 1 means 100% of width + * for the X and 100% of the height for the y. It can be bigger than 1 and negative. + * allowed values pixels or percentage. + * @type String + * @default 'pixels' + */ + gradientUnits: "pixels", + /** + * Gradient type linear or radial + * @type String + * @default 'pixels' + */ + type: "linear", + /** + * Constructor + * @param {Object} options Options object with type, coords, gradientUnits and colorStops + * @param {Object} [options.type] gradient type linear or radial + * @param {Object} [options.gradientUnits] gradient units + * @param {Object} [options.offsetX] SVG import compatibility + * @param {Object} [options.offsetY] SVG import compatibility + * @param {Object[]} options.colorStops contains the colorstops. + * @param {Object} options.coords contains the coords of the gradient + * @param {Number} [options.coords.x1] X coordiante of the first point for linear or of the focal point for radial + * @param {Number} [options.coords.y1] Y coordiante of the first point for linear or of the focal point for radial + * @param {Number} [options.coords.x2] X coordiante of the second point for linear or of the center point for radial + * @param {Number} [options.coords.y2] Y coordiante of the second point for linear or of the center point for radial + * @param {Number} [options.coords.r1] only for radial gradient, radius of the inner circle + * @param {Number} [options.coords.r2] only for radial gradient, radius of the external circle + * @return {fabric.Gradient} thisArg + */ + initialize: function(x) { + x || (x = {}), x.coords || (x.coords = {}); + var g, S = this; + Object.keys(x).forEach(function(T) { + S[T] = x[T]; + }), this.id ? this.id += "_" + c.Object.__uid++ : this.id = c.Object.__uid++, g = { + x1: x.coords.x1 || 0, + y1: x.coords.y1 || 0, + x2: x.coords.x2 || 0, + y2: x.coords.y2 || 0 + }, this.type === "radial" && (g.r1 = x.coords.r1 || 0, g.r2 = x.coords.r2 || 0), this.coords = g, this.colorStops = x.colorStops.slice(); + }, + /** + * Adds another colorStop + * @param {Object} colorStop Object with offset and color + * @return {fabric.Gradient} thisArg + */ + addColorStop: function(x) { + for (var g in x) { + var S = new c.Color(x[g]); + this.colorStops.push({ + offset: parseFloat(g), + color: S.toRgb(), + opacity: S.getAlpha() + }); + } + return this; + }, + /** + * Returns object representation of a gradient + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} + */ + toObject: function(x) { + var g = { + type: this.type, + coords: this.coords, + colorStops: this.colorStops, + offsetX: this.offsetX, + offsetY: this.offsetY, + gradientUnits: this.gradientUnits, + gradientTransform: this.gradientTransform ? this.gradientTransform.concat() : this.gradientTransform + }; + return c.util.populateWithProperties(this, g, x), g; + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of an gradient + * @param {Object} object Object to create a gradient for + * @return {String} SVG representation of an gradient (linear/radial) + */ + toSVG: function(x, E) { + var S = _(this.coords, !0), T, C, E = E || {}, M, P, R = _(this.colorStops, !0), N = S.r1 > S.r2, F = this.gradientTransform ? this.gradientTransform.concat() : c.iMatrix.concat(), U = -this.offsetX, $ = -this.offsetY, G = !!E.additionalTransform, Q = this.gradientUnits === "pixels" ? "userSpaceOnUse" : "objectBoundingBox"; + if (R.sort(function(K, Oe) { + return K.offset - Oe.offset; + }), Q === "objectBoundingBox" ? (U /= x.width, $ /= x.height) : (U += x.width / 2, $ += x.height / 2), x.type === "path" && this.gradientUnits !== "percentage" && (U -= x.pathOffset.x, $ -= x.pathOffset.y), F[4] -= U, F[5] -= $, P = 'id="SVGID_' + this.id + '" gradientUnits="' + Q + '"', P += ' gradientTransform="' + (G ? E.additionalTransform + " " : "") + c.util.matrixToSVG(F) + '" ', this.type === "linear" ? M = [ + " +` + ] : this.type === "radial" && (M = [ + " +` + ]), this.type === "radial") { + if (N) + for (R = R.concat(), R.reverse(), T = 0, C = R.length; T < C; T++) + R[T].offset = 1 - R[T].offset; + var ee = Math.min(S.r1, S.r2); + if (ee > 0) { + var ce = Math.max(S.r1, S.r2), ne = ee / ce; + for (T = 0, C = R.length; T < C; T++) + R[T].offset += ne * (1 - R[T].offset); + } + } + for (T = 0, C = R.length; T < C; T++) { + var fe = R[T]; + M.push( + " +` + ); + } + return M.push(this.type === "linear" ? ` +` : ` +`), M.join(""); + }, + /* _TO_SVG_END_ */ + /** + * Returns an instance of CanvasGradient + * @param {CanvasRenderingContext2D} ctx Context to render on + * @return {CanvasGradient} + */ + toLive: function(x) { + var g, S = c.util.object.clone(this.coords), T, C; + if (this.type) { + for (this.type === "linear" ? g = x.createLinearGradient( + S.x1, + S.y1, + S.x2, + S.y2 + ) : this.type === "radial" && (g = x.createRadialGradient( + S.x1, + S.y1, + S.r1, + S.x2, + S.y2, + S.r2 + )), T = 0, C = this.colorStops.length; T < C; T++) { + var E = this.colorStops[T].color, M = this.colorStops[T].opacity, P = this.colorStops[T].offset; + typeof M != "undefined" && (E = new c.Color(E).setAlpha(M).toRgba()), g.addColorStop(P, E); + } + return g; + } + } + } + ), c.util.object.extend(c.Gradient, { + /* _FROM_SVG_START_ */ + /** + * Returns {@link fabric.Gradient} instance from an SVG element + * @static + * @memberOf fabric.Gradient + * @param {SVGGradientElement} el SVG gradient element + * @param {fabric.Object} instance + * @param {String} opacityAttr A fill-opacity or stroke-opacity attribute to multiply to each stop's opacity. + * @param {Object} svgOptions an object containing the size of the SVG in order to parse correctly gradients + * that uses gradientUnits as 'userSpaceOnUse' and percentages. + * @param {Object.number} viewBoxWidth width part of the viewBox attribute on svg + * @param {Object.number} viewBoxHeight height part of the viewBox attribute on svg + * @param {Object.number} width width part of the svg tag if viewBox is not specified + * @param {Object.number} height height part of the svg tag if viewBox is not specified + * @return {fabric.Gradient} Gradient instance + * @see http://www.w3.org/TR/SVG/pservers.html#LinearGradientElement + * @see http://www.w3.org/TR/SVG/pservers.html#RadialGradientElement + */ + fromElement: function(x, g, S, T) { + var C = parseFloat(S) / (/%$/.test(S) ? 100 : 1); + C = C < 0 ? 0 : C > 1 ? 1 : C, isNaN(C) && (C = 1); + var E = x.getElementsByTagName("stop"), M, P = x.getAttribute("gradientUnits") === "userSpaceOnUse" ? "pixels" : "percentage", R = x.getAttribute("gradientTransform") || "", N = [], F, U, $ = 0, G = 0, Q; + for (x.nodeName === "linearGradient" || x.nodeName === "LINEARGRADIENT" ? (M = "linear", F = d(x)) : (M = "radial", F = m(x)), U = E.length; U--; ) + N.push(p(E[U], C)); + Q = c.parseTransformAttribute(R), y(g, F, T, P), P === "pixels" && ($ = -g.left, G = -g.top); + var ee = new c.Gradient({ + id: x.getAttribute("id"), + type: M, + coords: F, + colorStops: N, + gradientUnits: P, + gradientTransform: Q, + offsetX: $, + offsetY: G + }); + return ee; + } + /* _FROM_SVG_END_ */ + }); + function y(x, g, S, T) { + var C, E; + Object.keys(g).forEach(function(M) { + C = g[M], C === "Infinity" ? E = 1 : C === "-Infinity" ? E = 0 : (E = parseFloat(g[M], 10), typeof C == "string" && /^(\d+\.\d+)%|(\d+)%$/.test(C) && (E *= 0.01, T === "pixels" && ((M === "x1" || M === "x2" || M === "r2") && (E *= S.viewBoxWidth || S.width), (M === "y1" || M === "y2") && (E *= S.viewBoxHeight || S.height)))), g[M] = E; + }); + } + }(), function() { + var p = c.util.toFixed; + c.Pattern = c.util.createClass( + /** @lends fabric.Pattern.prototype */ + { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + * @type String + * @default + */ + repeat: "repeat", + /** + * Pattern horizontal offset from object's left/top corner + * @type Number + * @default + */ + offsetX: 0, + /** + * Pattern vertical offset from object's left/top corner + * @type Number + * @default + */ + offsetY: 0, + /** + * crossOrigin value (one of "", "anonymous", "use-credentials") + * @see https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes + * @type String + * @default + */ + crossOrigin: "", + /** + * transform matrix to change the pattern, imported from svgs. + * @type Array + * @default + */ + patternTransform: null, + /** + * Constructor + * @param {Object} [options] Options object + * @param {Function} [callback] function to invoke after callback init. + * @return {fabric.Pattern} thisArg + */ + initialize: function(d, m) { + if (d || (d = {}), this.id = c.Object.__uid++, this.setOptions(d), !d.source || d.source && typeof d.source != "string") { + m && m(this); + return; + } else { + var _ = this; + this.source = c.util.createImage(), c.util.loadImage(d.source, function(y, x) { + _.source = y, m && m(_, x); + }, null, this.crossOrigin); + } + }, + /** + * Returns object representation of a pattern + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of a pattern instance + */ + toObject: function(d) { + var m = c.Object.NUM_FRACTION_DIGITS, _, y; + return typeof this.source.src == "string" ? _ = this.source.src : typeof this.source == "object" && this.source.toDataURL && (_ = this.source.toDataURL()), y = { + type: "pattern", + source: _, + repeat: this.repeat, + crossOrigin: this.crossOrigin, + offsetX: p(this.offsetX, m), + offsetY: p(this.offsetY, m), + patternTransform: this.patternTransform ? this.patternTransform.concat() : null + }, c.util.populateWithProperties(this, y, d), y; + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + * @return {String} SVG representation of a pattern + */ + toSVG: function(d) { + var m = typeof this.source == "function" ? this.source() : this.source, _ = m.width / d.width, y = m.height / d.height, x = this.offsetX / d.width, g = this.offsetY / d.height, S = ""; + return (this.repeat === "repeat-x" || this.repeat === "no-repeat") && (y = 1, g && (y += Math.abs(g))), (this.repeat === "repeat-y" || this.repeat === "no-repeat") && (_ = 1, x && (_ += Math.abs(x))), m.src ? S = m.src : m.toDataURL && (S = m.toDataURL()), ' + + +`; + }, + /* _TO_SVG_END_ */ + setOptions: function(d) { + for (var m in d) + this[m] = d[m]; + }, + /** + * Returns an instance of CanvasPattern + * @param {CanvasRenderingContext2D} ctx Context to create pattern + * @return {CanvasPattern} + */ + toLive: function(d) { + var m = this.source; + return !m || typeof m.src != "undefined" && (!m.complete || m.naturalWidth === 0 || m.naturalHeight === 0) ? "" : d.createPattern(m, this.repeat); + } + } + ); + }(), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.toFixed; + if (d.Shadow) { + d.warn("fabric.Shadow is already defined."); + return; + } + d.Shadow = d.util.createClass( + /** @lends fabric.Shadow.prototype */ + { + /** + * Shadow color + * @type String + * @default + */ + color: "rgb(0,0,0)", + /** + * Shadow blur + * @type Number + */ + blur: 0, + /** + * Shadow horizontal offset + * @type Number + * @default + */ + offsetX: 0, + /** + * Shadow vertical offset + * @type Number + * @default + */ + offsetY: 0, + /** + * Whether the shadow should affect stroke operations + * @type Boolean + * @default + */ + affectStroke: !1, + /** + * Indicates whether toObject should include default values + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * When `false`, the shadow will scale with the object. + * When `true`, the shadow's offsetX, offsetY, and blur will not be affected by the object's scale. + * default to false + * @type Boolean + * @default + */ + nonScaling: !1, + /** + * Constructor + * @param {Object|String} [options] Options object with any of color, blur, offsetX, offsetY properties or string (e.g. "rgba(0,0,0,0.2) 2px 2px 10px") + * @return {fabric.Shadow} thisArg + */ + initialize: function(_) { + typeof _ == "string" && (_ = this._parseShadow(_)); + for (var y in _) + this[y] = _[y]; + this.id = d.Object.__uid++; + }, + /** + * @private + * @param {String} shadow Shadow value to parse + * @return {Object} Shadow object with color, offsetX, offsetY and blur + */ + _parseShadow: function(_) { + var y = _.trim(), x = d.Shadow.reOffsetsAndBlur.exec(y) || [], g = y.replace(d.Shadow.reOffsetsAndBlur, "") || "rgb(0,0,0)"; + return { + color: g.trim(), + offsetX: parseFloat(x[1], 10) || 0, + offsetY: parseFloat(x[2], 10) || 0, + blur: parseFloat(x[3], 10) || 0 + }; + }, + /** + * Returns a string representation of an instance + * @see http://www.w3.org/TR/css-text-decor-3/#text-shadow + * @return {String} Returns CSS3 text-shadow declaration + */ + toString: function() { + return [this.offsetX, this.offsetY, this.blur, this.color].join("px "); + }, + /* _TO_SVG_START_ */ + /** + * Returns SVG representation of a shadow + * @param {fabric.Object} object + * @return {String} SVG representation of a shadow + */ + toSVG: function(_) { + var y = 40, x = 40, g = d.Object.NUM_FRACTION_DIGITS, S = d.util.rotateVector( + { x: this.offsetX, y: this.offsetY }, + d.util.degreesToRadians(-_.angle) + ), T = 20, C = new d.Color(this.color); + return _.width && _.height && (y = m((Math.abs(S.x) + this.blur) / _.width, g) * 100 + T, x = m((Math.abs(S.y) + this.blur) / _.height, g) * 100 + T), _.flipX && (S.x *= -1), _.flipY && (S.y *= -1), ' + + + + + + + + + +`; + }, + /* _TO_SVG_END_ */ + /** + * Returns object representation of a shadow + * @return {Object} Object representation of a shadow instance + */ + toObject: function() { + if (this.includeDefaultValues) + return { + color: this.color, + blur: this.blur, + offsetX: this.offsetX, + offsetY: this.offsetY, + affectStroke: this.affectStroke, + nonScaling: this.nonScaling + }; + var _ = {}, y = d.Shadow.prototype; + return ["color", "blur", "offsetX", "offsetY", "affectStroke", "nonScaling"].forEach(function(x) { + this[x] !== y[x] && (_[x] = this[x]); + }, this), _; + } + } + ), d.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/; + }(l), function() { + if (c.StaticCanvas) { + c.warn("fabric.StaticCanvas is already defined."); + return; + } + var p = c.util.object.extend, d = c.util.getElementOffset, m = c.util.removeFromArray, _ = c.util.toFixed, y = c.util.transformPoint, x = c.util.invertTransform, g = c.util.getNodeCanvas, S = c.util.createCanvasElement, T = new Error("Could not initialize `canvas` element"); + c.StaticCanvas = c.util.createClass( + c.CommonMethods, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Constructor + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(C, E) { + E || (E = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(C, E); + }, + /** + * Background color of canvas instance. + * Should be set via {@link fabric.StaticCanvas#setBackgroundColor}. + * @type {(String|fabric.Pattern)} + * @default + */ + backgroundColor: "", + /** + * Background image of canvas instance. + * since 2.4.0 image caching is active, please when putting an image as background, add to the + * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom + * vale. As an alternative you can disable image objectCaching + * @type fabric.Image + * @default + */ + backgroundImage: null, + /** + * Overlay color of canvas instance. + * Should be set via {@link fabric.StaticCanvas#setOverlayColor} + * @since 1.3.9 + * @type {(String|fabric.Pattern)} + * @default + */ + overlayColor: "", + /** + * Overlay image of canvas instance. + * since 2.4.0 image caching is active, please when putting an image as overlay, add to the + * canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom + * vale. As an alternative you can disable image objectCaching + * @type fabric.Image + * @default + */ + overlayImage: null, + /** + * Indicates whether toObject/toDatalessObject should include default values + * if set to false, takes precedence over the object value. + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * Indicates whether objects' state should be saved + * @type Boolean + * @default + */ + stateful: !1, + /** + * Indicates whether {@link fabric.Collection.add}, {@link fabric.Collection.insertAt} and {@link fabric.Collection.remove}, + * {@link fabric.StaticCanvas.moveTo}, {@link fabric.StaticCanvas.clear} and many more, should also re-render canvas. + * Disabling this option will not give a performance boost when adding/removing a lot of objects to/from canvas at once + * since the renders are quequed and executed one per frame. + * Disabling is suggested anyway and managing the renders of the app manually is not a big effort ( canvas.requestRenderAll() ) + * Left default to true to do not break documentation and old app, fiddles. + * @type Boolean + * @default + */ + renderOnAddRemove: !0, + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + * @type Boolean + * @default + */ + controlsAboveOverlay: !1, + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + * @type Boolean + * @default + */ + allowTouchScrolling: !1, + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + * @type Boolean + * @default + */ + imageSmoothingEnabled: !0, + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + * @type Array + * @default + */ + viewportTransform: c.iMatrix.concat(), + /** + * if set to false background image is not affected by viewport transform + * @since 1.6.3 + * @type Boolean + * @default + */ + backgroundVpt: !0, + /** + * if set to false overlya image is not affected by viewport transform + * @since 1.6.3 + * @type Boolean + * @default + */ + overlayVpt: !0, + /** + * When true, canvas is scaled by devicePixelRatio for better rendering on retina screens + * @type Boolean + * @default + */ + enableRetinaScaling: !0, + /** + * Describe canvas element extension over design + * properties are tl,tr,bl,br. + * if canvas is not zoomed/panned those points are the four corner of canvas + * if canvas is viewportTransformed you those points indicate the extension + * of canvas element in plain untrasformed coordinates + * The coordinates get updated with @method calcViewportBoundaries. + * @memberOf fabric.StaticCanvas.prototype + */ + vptCoords: {}, + /** + * Based on vptCoords and object.aCoords, skip rendering of objects that + * are not included in current viewport. + * May greatly help in applications with crowded canvas and use of zoom/pan + * If One of the corner of the bounding box of the object is on the canvas + * the objects get rendered. + * @memberOf fabric.StaticCanvas.prototype + * @type Boolean + * @default + */ + skipOffscreen: !0, + /** + * a fabricObject that, without stroke define a clipping area with their shape. filled in black + * the clipPath object gets used when the canvas has rendered, and the context is placed in the + * top left corner of the canvas. + * clipPath will clip away controls, if you do not want this to happen use controlsAboveOverlay = true + * @type fabric.Object + */ + clipPath: void 0, + /** + * @private + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + */ + _initStatic: function(C, E) { + var M = this.requestRenderAllBound; + this._objects = [], this._createLowerCanvas(C), this._initOptions(E), this.interactive || this._initRetinaScaling(), E.overlayImage && this.setOverlayImage(E.overlayImage, M), E.backgroundImage && this.setBackgroundImage(E.backgroundImage, M), E.backgroundColor && this.setBackgroundColor(E.backgroundColor, M), E.overlayColor && this.setOverlayColor(E.overlayColor, M), this.calcOffset(); + }, + /** + * @private + */ + _isRetinaScaling: function() { + return c.devicePixelRatio !== 1 && this.enableRetinaScaling; + }, + /** + * @private + * @return {Number} retinaScaling if applied, otherwise 1; + */ + getRetinaScaling: function() { + return this._isRetinaScaling() ? c.devicePixelRatio : 1; + }, + /** + * @private + */ + _initRetinaScaling: function() { + if (this._isRetinaScaling()) { + var C = c.devicePixelRatio; + this.__initRetinaScaling(C, this.lowerCanvasEl, this.contextContainer), this.upperCanvasEl && this.__initRetinaScaling(C, this.upperCanvasEl, this.contextTop); + } + }, + __initRetinaScaling: function(C, E, M) { + E.setAttribute("width", this.width * C), E.setAttribute("height", this.height * C), M.scale(C, C); + }, + /** + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + * @return {fabric.Canvas} instance + * @chainable + */ + calcOffset: function() { + return this._offset = d(this.lowerCanvasEl), this; + }, + /** + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/MnzHT/|jsFiddle demo} + * @example Normal overlayImage with left/top = 0 + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * // Needed to position overlayImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example overlayImage with different properties + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top' + * }); + * @example Stretched overlayImage #1 - width/height correspond to canvas width/height + * fabric.Image.fromURL('http://fabricjs.com/assets/jail_cell_bars.png', function(img, isError) { + * img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'}); + * canvas.setOverlayImage(img, canvas.renderAll.bind(canvas)); + * }); + * @example Stretched overlayImage #2 - width/height correspond to canvas width/height + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * width: canvas.width, + * height: canvas.height, + * // Needed to position overlayImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example overlayImage loaded from cross-origin + * canvas.setOverlayImage('http://fabricjs.com/assets/jail_cell_bars.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top', + * crossOrigin: 'anonymous' + * }); + */ + setOverlayImage: function(C, E, M) { + return this.__setBgOverlayImage("overlayImage", C, E, M); + }, + /** + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/djnr8o7a/28/|jsFiddle demo} + * @example Normal backgroundImage with left/top = 0 + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * // Needed to position backgroundImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example backgroundImage with different properties + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top' + * }); + * @example Stretched backgroundImage #1 - width/height correspond to canvas width/height + * fabric.Image.fromURL('http://fabricjs.com/assets/honey_im_subtle.png', function(img, isError) { + * img.set({width: canvas.width, height: canvas.height, originX: 'left', originY: 'top'}); + * canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas)); + * }); + * @example Stretched backgroundImage #2 - width/height correspond to canvas width/height + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * width: canvas.width, + * height: canvas.height, + * // Needed to position backgroundImage at 0/0 + * originX: 'left', + * originY: 'top' + * }); + * @example backgroundImage loaded from cross-origin + * canvas.setBackgroundImage('http://fabricjs.com/assets/honey_im_subtle.png', canvas.renderAll.bind(canvas), { + * opacity: 0.5, + * angle: 45, + * left: 400, + * top: 400, + * originX: 'left', + * originY: 'top', + * crossOrigin: 'anonymous' + * }); + */ + // TODO: fix stretched examples + setBackgroundImage: function(C, E, M) { + return this.__setBgOverlayImage("backgroundImage", C, E, M); + }, + /** + * Sets {@link fabric.StaticCanvas#overlayColor|foreground color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set foreground color to + * @param {Function} callback Callback to invoke when foreground color is set + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/pB55h/|jsFiddle demo} + * @example Normal overlayColor - color value + * canvas.setOverlayColor('rgba(255, 73, 64, 0.6)', canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as overlayColor + * canvas.setOverlayColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png' + * }, canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as overlayColor with repeat and offset + * canvas.setOverlayColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png', + * repeat: 'repeat', + * offsetX: 200, + * offsetY: 100 + * }, canvas.renderAll.bind(canvas)); + */ + setOverlayColor: function(C, E) { + return this.__setBgOverlayColor("overlayColor", C, E); + }, + /** + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + * @return {fabric.Canvas} thisArg + * @chainable + * @see {@link http://jsfiddle.net/fabricjs/hXzvk/|jsFiddle demo} + * @example Normal backgroundColor - color value + * canvas.setBackgroundColor('rgba(255, 73, 64, 0.6)', canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as backgroundColor + * canvas.setBackgroundColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png' + * }, canvas.renderAll.bind(canvas)); + * @example fabric.Pattern used as backgroundColor with repeat and offset + * canvas.setBackgroundColor({ + * source: 'http://fabricjs.com/assets/escheresque_ste.png', + * repeat: 'repeat', + * offsetX: 200, + * offsetY: 100 + * }, canvas.renderAll.bind(canvas)); + */ + setBackgroundColor: function(C, E) { + return this.__setBgOverlayColor("backgroundColor", C, E); + }, + /** + * @private + * @param {String} property Property to set ({@link fabric.StaticCanvas#backgroundImage|backgroundImage} + * or {@link fabric.StaticCanvas#overlayImage|overlayImage}) + * @param {(fabric.Image|String|null)} image fabric.Image instance, URL of an image or null to set background or overlay to + * @param {Function} callback Callback to invoke when image is loaded and set as background or overlay. The first argument is the created image, the second argument is a flag indicating whether an error occurred or not. + * @param {Object} [options] Optional options to set for the {@link fabric.Image|image}. + */ + __setBgOverlayImage: function(C, E, M, P) { + return typeof E == "string" ? c.util.loadImage(E, function(R, N) { + if (R) { + var F = new c.Image(R, P); + this[C] = F, F.canvas = this; + } + M && M(R, N); + }, this, P && P.crossOrigin) : (P && E.setOptions(P), this[C] = E, E && (E.canvas = this), M && M(E, !1)), this; + }, + /** + * @private + * @param {String} property Property to set ({@link fabric.StaticCanvas#backgroundColor|backgroundColor} + * or {@link fabric.StaticCanvas#overlayColor|overlayColor}) + * @param {(Object|String|null)} color Object with pattern information, color value or null + * @param {Function} [callback] Callback is invoked when color is set + */ + __setBgOverlayColor: function(C, E, M) { + return this[C] = E, this._initGradient(E, C), this._initPattern(E, C, M), this; + }, + /** + * @private + */ + _createCanvasElement: function() { + var C = S(); + if (!C || (C.style || (C.style = {}), typeof C.getContext == "undefined")) + throw T; + return C; + }, + /** + * @private + * @param {Object} [options] Options object + */ + _initOptions: function(C) { + var E = this.lowerCanvasEl; + this._setOptions(C), this.width = this.width || parseInt(E.width, 10) || 0, this.height = this.height || parseInt(E.height, 10) || 0, this.lowerCanvasEl.style && (E.width = this.width, E.height = this.height, E.style.width = this.width + "px", E.style.height = this.height + "px", this.viewportTransform = this.viewportTransform.slice()); + }, + /** + * Creates a bottom canvas + * @private + * @param {HTMLElement} [canvasEl] + */ + _createLowerCanvas: function(C) { + C && C.getContext ? this.lowerCanvasEl = C : this.lowerCanvasEl = c.util.getById(C) || this._createCanvasElement(), c.util.addClass(this.lowerCanvasEl, "lower-canvas"), this._originalCanvasStyle = this.lowerCanvasEl.style, this.interactive && this._applyCanvasStyle(this.lowerCanvasEl), this.contextContainer = this.lowerCanvasEl.getContext("2d"); + }, + /** + * Returns canvas width (in px) + * @return {Number} + */ + getWidth: function() { + return this.width; + }, + /** + * Returns canvas height (in px) + * @return {Number} + */ + getHeight: function() { + return this.height; + }, + /** + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} instance + * @chainable true + */ + setWidth: function(C, E) { + return this.setDimensions({ width: C }, E); + }, + /** + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} instance + * @chainable true + */ + setHeight: function(C, E) { + return this.setDimensions({ height: C }, E); + }, + /** + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Number|String} [dimensions.width] Width of canvas element + * @param {Number|String} [dimensions.height] Height of canvas element + * @param {Object} [options] Options object + * @param {Boolean} [options.backstoreOnly=false] Set the given dimensions only as canvas backstore dimensions + * @param {Boolean} [options.cssOnly=false] Set the given dimensions only as css dimensions + * @return {fabric.Canvas} thisArg + * @chainable + */ + setDimensions: function(C, E) { + var M; + E = E || {}; + for (var P in C) + M = C[P], E.cssOnly || (this._setBackstoreDimension(P, C[P]), M += "px", this.hasLostContext = !0), E.backstoreOnly || this._setCssDimension(P, M); + return this._isCurrentlyDrawing && this.freeDrawingBrush && this.freeDrawingBrush._setBrushStyles(), this._initRetinaScaling(), this.calcOffset(), E.cssOnly || this.requestRenderAll(), this; + }, + /** + * Helper for setting width/height + * @private + * @param {String} prop property (width|height) + * @param {Number} value value to set property to + * @return {fabric.Canvas} instance + * @chainable true + */ + _setBackstoreDimension: function(C, E) { + return this.lowerCanvasEl[C] = E, this.upperCanvasEl && (this.upperCanvasEl[C] = E), this.cacheCanvasEl && (this.cacheCanvasEl[C] = E), this[C] = E, this; + }, + /** + * Helper for setting css width/height + * @private + * @param {String} prop property (width|height) + * @param {String} value value to set property to + * @return {fabric.Canvas} instance + * @chainable true + */ + _setCssDimension: function(C, E) { + return this.lowerCanvasEl.style[C] = E, this.upperCanvasEl && (this.upperCanvasEl.style[C] = E), this.wrapperEl && (this.wrapperEl.style[C] = E), this; + }, + /** + * Returns canvas zoom level + * @return {Number} + */ + getZoom: function() { + return this.viewportTransform[0]; + }, + /** + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + * @return {fabric.Canvas} instance + * @chainable true + */ + setViewportTransform: function(C) { + var E = this._activeObject, M = this.backgroundImage, P = this.overlayImage, R, N, F; + for (this.viewportTransform = C, N = 0, F = this._objects.length; N < F; N++) + R = this._objects[N], R.group || R.setCoords(!0); + return E && E.setCoords(), M && M.setCoords(!0), P && P.setCoords(!0), this.calcViewportBoundaries(), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Sets zoom level of this canvas instance, the zoom centered around point + * meaning that following zoom to point with the same point will have the visual + * effect of the zoom originating from that point. The point won't move. + * It has nothing to do with canvas center or visual center of the viewport. + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + * @return {fabric.Canvas} instance + * @chainable true + */ + zoomToPoint: function(C, E) { + var M = C, P = this.viewportTransform.slice(0); + C = y(C, x(this.viewportTransform)), P[0] = E, P[3] = E; + var R = y(C, P); + return P[4] += M.x - R.x, P[5] += M.y - R.y, this.setViewportTransform(P); + }, + /** + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + * @return {fabric.Canvas} instance + * @chainable true + */ + setZoom: function(C) { + return this.zoomToPoint(new c.Point(0, 0), C), this; + }, + /** + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + * @return {fabric.Canvas} instance + * @chainable true + */ + absolutePan: function(C) { + var E = this.viewportTransform.slice(0); + return E[4] = -C.x, E[5] = -C.y, this.setViewportTransform(E); + }, + /** + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + * @return {fabric.Canvas} instance + * @chainable true + */ + relativePan: function(C) { + return this.absolutePan(new c.Point( + -C.x - this.viewportTransform[4], + -C.y - this.viewportTransform[5] + )); + }, + /** + * Returns <canvas> element corresponding to this instance + * @return {HTMLCanvasElement} + */ + getElement: function() { + return this.lowerCanvasEl; + }, + /** + * @private + * @param {fabric.Object} obj Object that was added + */ + _onObjectAdded: function(C) { + this.stateful && C.setupState(), C._set("canvas", this), C.setCoords(), this.fire("object:added", { target: C }), C.fire("added"); + }, + /** + * @private + * @param {fabric.Object} obj Object that was removed + */ + _onObjectRemoved: function(C) { + this.fire("object:removed", { target: C }), C.fire("removed"), delete C.canvas; + }, + /** + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @return {fabric.Canvas} thisArg + * @chainable + */ + clearContext: function(C) { + return C.clearRect(0, 0, this.width, this.height), this; + }, + /** + * Returns context of canvas where objects are drawn + * @return {CanvasRenderingContext2D} + */ + getContext: function() { + return this.contextContainer; + }, + /** + * Clears all contexts (background, main, top) of an instance + * @return {fabric.Canvas} thisArg + * @chainable + */ + clear: function() { + return this.remove.apply(this, this.getObjects()), this.backgroundImage = null, this.overlayImage = null, this.backgroundColor = "", this.overlayColor = "", this._hasITextHandlers && (this.off("mouse:up", this._mouseUpITextHandler), this._iTextInstances = null, this._hasITextHandlers = !1), this.clearContext(this.contextContainer), this.fire("canvas:cleared"), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Renders the canvas + * @return {fabric.Canvas} instance + * @chainable + */ + renderAll: function() { + var C = this.contextContainer; + return this.renderCanvas(C, this._objects), this; + }, + /** + * Function created to be instance bound at initialization + * used in requestAnimationFrame rendering + * Let the fabricJS call it. If you call it manually you could have more + * animationFrame stacking on to of each other + * for an imperative rendering, use canvas.renderAll + * @private + * @return {fabric.Canvas} instance + * @chainable + */ + renderAndReset: function() { + this.isRendering = 0, this.renderAll(); + }, + /** + * Append a renderAll request to next animation frame. + * unless one is already in progress, in that case nothing is done + * a boolean flag will avoid appending more. + * @return {fabric.Canvas} instance + * @chainable + */ + requestRenderAll: function() { + return this.isRendering || (this.isRendering = c.util.requestAnimFrame(this.renderAndResetBound)), this; + }, + /** + * Calculate the position of the 4 corner of canvas with current viewportTransform. + * helps to determinate when an object is in the current rendering viewport using + * object absolute coordinates ( aCoords ) + * @return {Object} points.tl + * @chainable + */ + calcViewportBoundaries: function() { + var C = {}, E = this.width, M = this.height, P = x(this.viewportTransform); + return C.tl = y({ x: 0, y: 0 }, P), C.br = y({ x: E, y: M }, P), C.tr = new c.Point(C.br.x, C.tl.y), C.bl = new c.Point(C.tl.x, C.br.y), this.vptCoords = C, C; + }, + cancelRequestedRender: function() { + this.isRendering && (c.util.cancelAnimFrame(this.isRendering), this.isRendering = 0); + }, + /** + * Renders background, objects, overlay and controls. + * @param {CanvasRenderingContext2D} ctx + * @param {Array} objects to render + * @return {fabric.Canvas} instance + * @chainable + */ + renderCanvas: function(C, E) { + var M = this.viewportTransform, P = this.clipPath; + this.cancelRequestedRender(), this.calcViewportBoundaries(), this.clearContext(C), c.util.setImageSmoothing(C, this.imageSmoothingEnabled), this.fire("before:render", { ctx: C }), this._renderBackground(C), C.save(), C.transform(M[0], M[1], M[2], M[3], M[4], M[5]), this._renderObjects(C, E), C.restore(), !this.controlsAboveOverlay && this.interactive && this.drawControls(C), P && (P.canvas = this, P.shouldCache(), P._transformDone = !0, P.renderCache({ forClipping: !0 }), this.drawClipPathOnCanvas(C)), this._renderOverlay(C), this.controlsAboveOverlay && this.interactive && this.drawControls(C), this.fire("after:render", { ctx: C }); + }, + /** + * Paint the cached clipPath on the lowerCanvasEl + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawClipPathOnCanvas: function(C) { + var E = this.viewportTransform, M = this.clipPath; + C.save(), C.transform(E[0], E[1], E[2], E[3], E[4], E[5]), C.globalCompositeOperation = "destination-in", M.transform(C), C.scale(1 / M.zoomX, 1 / M.zoomY), C.drawImage(M._cacheCanvas, -M.cacheTranslationX, -M.cacheTranslationY), C.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Array} objects to render + */ + _renderObjects: function(C, E) { + var M, P; + for (M = 0, P = E.length; M < P; ++M) + E[M] && E[M].render(C); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {string} property 'background' or 'overlay' + */ + _renderBackgroundOrOverlay: function(C, E) { + var M = this[E + "Color"], P = this[E + "Image"], R = this.viewportTransform, N = this[E + "Vpt"]; + if (!(!M && !P)) { + if (M) { + C.save(), C.beginPath(), C.moveTo(0, 0), C.lineTo(this.width, 0), C.lineTo(this.width, this.height), C.lineTo(0, this.height), C.closePath(), C.fillStyle = M.toLive ? M.toLive(C, this) : M, N && C.transform(R[0], R[1], R[2], R[3], R[4], R[5]), C.transform(1, 0, 0, 1, M.offsetX || 0, M.offsetY || 0); + var F = M.gradientTransform || M.patternTransform; + F && C.transform(F[0], F[1], F[2], F[3], F[4], F[5]), C.fill(), C.restore(); + } + P && (C.save(), N && C.transform(R[0], R[1], R[2], R[3], R[4], R[5]), P.render(C), C.restore()); + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderBackground: function(C) { + this._renderBackgroundOrOverlay(C, "background"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderOverlay: function(C) { + this._renderBackgroundOrOverlay(C, "overlay"); + }, + /** + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + * @return {Object} object with "top" and "left" number values + */ + getCenter: function() { + return { + top: this.height / 2, + left: this.width / 2 + }; + }, + /** + * Centers object horizontally in the canvas + * @param {fabric.Object} object Object to center horizontally + * @return {fabric.Canvas} thisArg + */ + centerObjectH: function(C) { + return this._centerObject(C, new c.Point(this.getCenter().left, C.getCenterPoint().y)); + }, + /** + * Centers object vertically in the canvas + * @param {fabric.Object} object Object to center vertically + * @return {fabric.Canvas} thisArg + * @chainable + */ + centerObjectV: function(C) { + return this._centerObject(C, new c.Point(C.getCenterPoint().x, this.getCenter().top)); + }, + /** + * Centers object vertically and horizontally in the canvas + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + centerObject: function(C) { + var E = this.getCenter(); + return this._centerObject(C, new c.Point(E.left, E.top)); + }, + /** + * Centers object vertically and horizontally in the viewport + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObject: function(C) { + var E = this.getVpCenter(); + return this._centerObject(C, E); + }, + /** + * Centers object horizontally in the viewport, object.top is unchanged + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObjectH: function(C) { + var E = this.getVpCenter(); + return this._centerObject(C, new c.Point(E.x, C.getCenterPoint().y)), this; + }, + /** + * Centers object Vertically in the viewport, object.top is unchanged + * @param {fabric.Object} object Object to center vertically and horizontally + * @return {fabric.Canvas} thisArg + * @chainable + */ + viewportCenterObjectV: function(C) { + var E = this.getVpCenter(); + return this._centerObject(C, new c.Point(C.getCenterPoint().x, E.y)); + }, + /** + * Calculate the point in canvas that correspond to the center of actual viewport. + * @return {fabric.Point} vpCenter, viewport center + * @chainable + */ + getVpCenter: function() { + var C = this.getCenter(), E = x(this.viewportTransform); + return y({ x: C.left, y: C.top }, E); + }, + /** + * @private + * @param {fabric.Object} object Object to center + * @param {fabric.Point} center Center point + * @return {fabric.Canvas} thisArg + * @chainable + */ + _centerObject: function(C, E) { + return C.setPositionByOrigin(E, "center", "center"), C.setCoords(), this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Returns dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {String} json string + */ + toDatalessJSON: function(C) { + return this.toDatalessObject(C); + }, + /** + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(C) { + return this._toObjectMethod("toObject", C); + }, + /** + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(C) { + return this._toObjectMethod("toDatalessObject", C); + }, + /** + * @private + */ + _toObjectMethod: function(C, E) { + var M = this.clipPath, P = { + version: c.version, + objects: this._toObjects(C, E) + }; + return M && !M.excludeFromExport && (P.clipPath = this._toObject(this.clipPath, C, E)), p(P, this.__serializeBgOverlay(C, E)), c.util.populateWithProperties(this, P, E), P; + }, + /** + * @private + */ + _toObjects: function(C, E) { + return this._objects.filter(function(M) { + return !M.excludeFromExport; + }).map(function(M) { + return this._toObject(M, C, E); + }, this); + }, + /** + * @private + */ + _toObject: function(C, E, M) { + var P; + this.includeDefaultValues || (P = C.includeDefaultValues, C.includeDefaultValues = !1); + var R = C[E](M); + return this.includeDefaultValues || (C.includeDefaultValues = P), R; + }, + /** + * @private + */ + __serializeBgOverlay: function(C, E) { + var M = {}, P = this.backgroundImage, R = this.overlayImage, N = this.backgroundColor, F = this.overlayColor; + return N && N.toObject ? N.excludeFromExport || (M.background = N.toObject(E)) : N && (M.background = N), F && F.toObject ? F.excludeFromExport || (M.overlay = F.toObject(E)) : F && (M.overlay = F), P && !P.excludeFromExport && (M.backgroundImage = this._toObject(P, C, E)), R && !R.excludeFromExport && (M.overlayImage = this._toObject(R, C, E)), M; + }, + /* _TO_SVG_START_ */ + /** + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + * @type Boolean + * @default + */ + svgViewportTransformation: !0, + /** + * Returns SVG representation of canvas + * @function + * @param {Object} [options] Options object for SVG output + * @param {Boolean} [options.suppressPreamble=false] If true xml tag is not included + * @param {Object} [options.viewBox] SVG viewbox object + * @param {Number} [options.viewBox.x] x-coordinate of viewbox + * @param {Number} [options.viewBox.y] y-coordinate of viewbox + * @param {Number} [options.viewBox.width] Width of viewbox + * @param {Number} [options.viewBox.height] Height of viewbox + * @param {String} [options.encoding=UTF-8] Encoding of SVG output + * @param {String} [options.width] desired width of svg with or without units + * @param {String} [options.height] desired height of svg with or without units + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + * @return {String} SVG string + * @tutorial {@link http://fabricjs.com/fabric-intro-part-3#serialization} + * @see {@link http://jsfiddle.net/fabricjs/jQ3ZZ/|jsFiddle demo} + * @example Normal SVG output + * var svg = canvas.toSVG(); + * @example SVG output without preamble (without <?xml ../>) + * var svg = canvas.toSVG({suppressPreamble: true}); + * @example SVG output with viewBox attribute + * var svg = canvas.toSVG({ + * viewBox: { + * x: 100, + * y: 100, + * width: 200, + * height: 300 + * } + * }); + * @example SVG output with different encoding (default: UTF-8) + * var svg = canvas.toSVG({encoding: 'ISO-8859-1'}); + * @example Modify SVG output with reviver function + * var svg = canvas.toSVG(null, function(svg) { + * return svg.replace('stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; ', ''); + * }); + */ + toSVG: function(C, E) { + C || (C = {}), C.reviver = E; + var M = []; + return this._setSVGPreamble(M, C), this._setSVGHeader(M, C), this.clipPath && M.push(' +`), this._setSVGBgOverlayColor(M, "background"), this._setSVGBgOverlayImage(M, "backgroundImage", E), this._setSVGObjects(M, E), this.clipPath && M.push(` +`), this._setSVGBgOverlayColor(M, "overlay"), this._setSVGBgOverlayImage(M, "overlayImage", E), M.push(""), M.join(""); + }, + /** + * @private + */ + _setSVGPreamble: function(C, E) { + E.suppressPreamble || C.push( + ' +`, + ' +` + ); + }, + /** + * @private + */ + _setSVGHeader: function(C, E) { + var M = E.width || this.width, P = E.height || this.height, R, N = 'viewBox="0 0 ' + this.width + " " + this.height + '" ', F = c.Object.NUM_FRACTION_DIGITS; + E.viewBox ? N = 'viewBox="' + E.viewBox.x + " " + E.viewBox.y + " " + E.viewBox.width + " " + E.viewBox.height + '" ' : this.svgViewportTransformation && (R = this.viewportTransform, N = 'viewBox="' + _(-R[4] / R[0], F) + " " + _(-R[5] / R[3], F) + " " + _(this.width / R[0], F) + " " + _(this.height / R[3], F) + '" '), C.push( + " +`, + "Created with Fabric.js ", + c.version, + ` +`, + ` +`, + this.createSVGFontFacesMarkup(), + this.createSVGRefElementsMarkup(), + this.createSVGClipPathMarkup(E), + ` +` + ); + }, + createSVGClipPathMarkup: function(C) { + var E = this.clipPath; + return E ? (E.clipPathId = "CLIPPATH_" + c.Object.__uid++, ' +` + this.clipPath.toClipPathSVG(C.reviver) + ` +`) : ""; + }, + /** + * Creates markup containing SVG referenced elements like patterns, gradients etc. + * @return {String} + */ + createSVGRefElementsMarkup: function() { + var C = this, E = ["background", "overlay"].map(function(M) { + var P = C[M + "Color"]; + if (P && P.toLive) { + var R = C[M + "Vpt"], N = C.viewportTransform, F = { + width: C.width / (R ? N[0] : 1), + height: C.height / (R ? N[3] : 1) + }; + return P.toSVG( + F, + { additionalTransform: R ? c.util.matrixToSVG(N) : "" } + ); + } + }); + return E.join(""); + }, + /** + * Creates markup containing SVG font faces, + * font URLs for font faces must be collected by developers + * and are not extracted from the DOM by fabricjs + * @param {Array} objects Array of fabric objects + * @return {String} + */ + createSVGFontFacesMarkup: function() { + var C = "", E = {}, M, P, R, N, F, U, $, G, Q, ee = c.fontPaths, ce = []; + for (this._objects.forEach(function fe(K) { + ce.push(K), K._objects && K._objects.forEach(fe); + }), G = 0, Q = ce.length; G < Q; G++) + if (M = ce[G], P = M.fontFamily, !(M.type.indexOf("text") === -1 || E[P] || !ee[P]) && (E[P] = !0, !!M.styles)) { + R = M.styles; + for (F in R) { + N = R[F]; + for ($ in N) + U = N[$], P = U.fontFamily, !E[P] && ee[P] && (E[P] = !0); + } + } + for (var ne in E) + C += [ + ` @font-face { +`, + " font-family: '", + ne, + `'; +`, + " src: url('", + ee[ne], + `'); +`, + ` } +` + ].join(""); + return C && (C = [ + ' +` + ].join("")), C; + }, + /** + * @private + */ + _setSVGObjects: function(C, E) { + var M, P, R, N = this._objects; + for (P = 0, R = N.length; P < R; P++) + M = N[P], !M.excludeFromExport && this._setSVGObject(C, M, E); + }, + /** + * @private + */ + _setSVGObject: function(C, E, M) { + C.push(E.toSVG(M)); + }, + /** + * @private + */ + _setSVGBgOverlayImage: function(C, E, M) { + this[E] && !this[E].excludeFromExport && this[E].toSVG && C.push(this[E].toSVG(M)); + }, + /** + * @private + */ + _setSVGBgOverlayColor: function(C, E) { + var M = this[E + "Color"], P = this.viewportTransform, R = this.width, N = this.height; + if (M) + if (M.toLive) { + var F = M.repeat, U = c.util.invertTransform(P), $ = this[E + "Vpt"], G = $ ? c.util.matrixToSVG(U) : ""; + C.push( + ' +` + ); + } else + C.push( + ' +` + ); + }, + /* _TO_SVG_END_ */ + /** + * Moves an object or the objects of a multiple selection + * to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @return {fabric.Canvas} thisArg + * @chainable + */ + sendToBack: function(C) { + if (!C) + return this; + var E = this._activeObject, M, P, R; + if (C === E && C.type === "activeSelection") + for (R = E._objects, M = R.length; M--; ) + P = R[M], m(this._objects, P), this._objects.unshift(P); + else + m(this._objects, C), this._objects.unshift(C); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Moves an object or the objects of a multiple selection + * to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @return {fabric.Canvas} thisArg + * @chainable + */ + bringToFront: function(C) { + if (!C) + return this; + var E = this._activeObject, M, P, R; + if (C === E && C.type === "activeSelection") + for (R = E._objects, M = 0; M < R.length; M++) + P = R[M], m(this._objects, P), this._objects.push(P); + else + m(this._objects, C), this._objects.push(C); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * Moves an object or a selection down in stack of drawn objects + * An optional parameter, intersecting allows to move the object in behind + * the first intersecting object. Where intersection is calculated with + * bounding box. If no intersection is found, there will not be change in the + * stack. + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @return {fabric.Canvas} thisArg + * @chainable + */ + sendBackwards: function(C, E) { + if (!C) + return this; + var M = this._activeObject, P, R, N, F, U, $ = 0; + if (C === M && C.type === "activeSelection") + for (U = M._objects, P = 0; P < U.length; P++) + R = U[P], N = this._objects.indexOf(R), N > 0 + $ && (F = N - 1, m(this._objects, R), this._objects.splice(F, 0, R)), $++; + else + N = this._objects.indexOf(C), N !== 0 && (F = this._findNewLowerIndex(C, N, E), m(this._objects, C), this._objects.splice(F, 0, C)); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * @private + */ + _findNewLowerIndex: function(C, E, M) { + var P, R; + if (M) + for (P = E, R = E - 1; R >= 0; --R) { + var N = C.intersectsWithObject(this._objects[R]) || C.isContainedWithinObject(this._objects[R]) || this._objects[R].isContainedWithinObject(C); + if (N) { + P = R; + break; + } + } + else + P = E - 1; + return P; + }, + /** + * Moves an object or a selection up in stack of drawn objects + * An optional parameter, intersecting allows to move the object in front + * of the first intersecting object. Where intersection is calculated with + * bounding box. If no intersection is found, there will not be change in the + * stack. + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @return {fabric.Canvas} thisArg + * @chainable + */ + bringForward: function(C, E) { + if (!C) + return this; + var M = this._activeObject, P, R, N, F, U, $ = 0; + if (C === M && C.type === "activeSelection") + for (U = M._objects, P = U.length; P--; ) + R = U[P], N = this._objects.indexOf(R), N < this._objects.length - 1 - $ && (F = N + 1, m(this._objects, R), this._objects.splice(F, 0, R)), $++; + else + N = this._objects.indexOf(C), N !== this._objects.length - 1 && (F = this._findNewUpperIndex(C, N, E), m(this._objects, C), this._objects.splice(F, 0, C)); + return this.renderOnAddRemove && this.requestRenderAll(), this; + }, + /** + * @private + */ + _findNewUpperIndex: function(C, E, M) { + var P, R, N; + if (M) + for (P = E, R = E + 1, N = this._objects.length; R < N; ++R) { + var F = C.intersectsWithObject(this._objects[R]) || C.isContainedWithinObject(this._objects[R]) || this._objects[R].isContainedWithinObject(C); + if (F) { + P = R; + break; + } + } + else + P = E + 1; + return P; + }, + /** + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @return {fabric.Canvas} thisArg + * @chainable + */ + moveTo: function(C, E) { + return m(this._objects, C), this._objects.splice(E, 0, C), this.renderOnAddRemove && this.requestRenderAll(); + }, + /** + * Clears a canvas element and dispose objects + * @return {fabric.Canvas} thisArg + * @chainable + */ + dispose: function() { + return this.isRendering && (c.util.cancelAnimFrame(this.isRendering), this.isRendering = 0), this.forEachObject(function(C) { + C.dispose && C.dispose(); + }), this._objects = [], this.backgroundImage && this.backgroundImage.dispose && this.backgroundImage.dispose(), this.backgroundImage = null, this.overlayImage && this.overlayImage.dispose && this.overlayImage.dispose(), this.overlayImage = null, this._iTextInstances = null, this.contextContainer = null, this.lowerCanvasEl.classList.remove("lower-canvas"), this.lowerCanvasEl.style = this._originalCanvasStyle, delete this._originalCanvasStyle, this.lowerCanvasEl.setAttribute("width", this.width), this.lowerCanvasEl.setAttribute("height", this.height), c.util.cleanUpJsdomNode(this.lowerCanvasEl), this.lowerCanvasEl = void 0, this; + }, + /** + * Returns a string representation of an instance + * @return {String} string representation of an instance + */ + toString: function() { + return "#"; + } + } + ), p(c.StaticCanvas.prototype, c.Observable), p(c.StaticCanvas.prototype, c.Collection), p(c.StaticCanvas.prototype, c.DataURLExporter), p( + c.StaticCanvas, + /** @lends fabric.StaticCanvas */ + { + /** + * @static + * @type String + * @default + */ + EMPTY_JSON: '{"objects": [], "background": "white"}', + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * + * @param {String} methodName Method to check support for; + * Could be one of "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), + * `null` if canvas element or context can not be initialized + */ + supports: function(C) { + var E = S(); + if (!E || !E.getContext) + return null; + var M = E.getContext("2d"); + if (!M) + return null; + switch (C) { + case "setLineDash": + return typeof M.setLineDash != "undefined"; + default: + return null; + } + } + } + ), c.StaticCanvas.prototype.toJSON = c.StaticCanvas.prototype.toObject, c.isLikelyNode && (c.StaticCanvas.prototype.createPNGStream = function() { + var C = g(this.lowerCanvasEl); + return C && C.createPNGStream(); + }, c.StaticCanvas.prototype.createJPEGStream = function(C) { + var E = g(this.lowerCanvasEl); + return E && E.createJPEGStream(C); + }); + }(), c.BaseBrush = c.util.createClass( + /** @lends fabric.BaseBrush.prototype */ + { + /** + * Color of a brush + * @type String + * @default + */ + color: "rgb(0, 0, 0)", + /** + * Width of a brush, has to be a Number, no string literals + * @type Number + * @default + */ + width: 1, + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), + * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * Line endings style of a brush (one of "butt", "round", "square") + * @type String + * @default + */ + strokeLineCap: "round", + /** + * Corner style of a brush (one of "bevel", "round", "miter") + * @type String + * @default + */ + strokeLineJoin: "round", + /** + * Maximum miter length (used for strokeLineJoin = "miter") of a brush's + * @type Number + * @default + */ + strokeMiterLimit: 10, + /** + * Stroke Dash Array. + * @type Array + * @default + */ + strokeDashArray: null, + /** + * When `true`, the free drawing is limited to the whiteboard size. Default to false. + * @type Boolean + * @default false + */ + limitedToCanvasSize: !1, + /** + * Sets brush styles + * @private + */ + _setBrushStyles: function() { + var p = this.canvas.contextTop; + p.strokeStyle = this.color, p.lineWidth = this.width, p.lineCap = this.strokeLineCap, p.miterLimit = this.strokeMiterLimit, p.lineJoin = this.strokeLineJoin, p.setLineDash(this.strokeDashArray || []); + }, + /** + * Sets the transformation on given context + * @param {RenderingContext2d} ctx context to render on + * @private + */ + _saveAndTransform: function(p) { + var d = this.canvas.viewportTransform; + p.save(), p.transform(d[0], d[1], d[2], d[3], d[4], d[5]); + }, + /** + * Sets brush shadow styles + * @private + */ + _setShadow: function() { + if (this.shadow) { + var p = this.canvas, d = this.shadow, m = p.contextTop, _ = p.getZoom(); + p && p._isRetinaScaling() && (_ *= c.devicePixelRatio), m.shadowColor = d.color, m.shadowBlur = d.blur * _, m.shadowOffsetX = d.offsetX * _, m.shadowOffsetY = d.offsetY * _; + } + }, + needsFullRender: function() { + var p = new c.Color(this.color); + return p.getAlpha() < 1 || !!this.shadow; + }, + /** + * Removes brush shadow styles + * @private + */ + _resetShadow: function() { + var p = this.canvas.contextTop; + p.shadowColor = "", p.shadowBlur = p.shadowOffsetX = p.shadowOffsetY = 0; + }, + /** + * Check is pointer is outside canvas boundaries + * @param {Object} pointer + * @private + */ + _isOutSideCanvas: function(p) { + return p.x < 0 || p.x > this.canvas.getWidth() || p.y < 0 || p.y > this.canvas.getHeight(); + } + } + ), function() { + c.PencilBrush = c.util.createClass( + c.BaseBrush, + /** @lends fabric.PencilBrush.prototype */ + { + /** + * Discard points that are less than `decimate` pixel distant from each other + * @type Number + * @default 0.4 + */ + decimate: 0.4, + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.PencilBrush} Instance of a pencil brush + */ + initialize: function(p) { + this.canvas = p, this._points = []; + }, + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + _drawSegment: function(p, d, m) { + var _ = d.midPointFrom(m); + return p.quadraticCurveTo(d.x, d.y, _.x, _.y), _; + }, + /** + * Invoked on mouse down + * @param {Object} pointer + */ + onMouseDown: function(p, d) { + this.canvas._isMainEvent(d.e) && (this._prepareForDrawing(p), this._captureDrawingPath(p), this._render()); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(p, d) { + if (this.canvas._isMainEvent(d.e) && !(this.limitedToCanvasSize === !0 && this._isOutSideCanvas(p)) && this._captureDrawingPath(p) && this._points.length > 1) + if (this.needsFullRender()) + this.canvas.clearContext(this.canvas.contextTop), this._render(); + else { + var m = this._points, _ = m.length, y = this.canvas.contextTop; + this._saveAndTransform(y), this.oldEnd && (y.beginPath(), y.moveTo(this.oldEnd.x, this.oldEnd.y)), this.oldEnd = this._drawSegment(y, m[_ - 2], m[_ - 1], !0), y.stroke(), y.restore(); + } + }, + /** + * Invoked on mouse up + */ + onMouseUp: function(p) { + return this.canvas._isMainEvent(p.e) ? (this.oldEnd = void 0, this._finalizeAndAddPath(), !1) : !0; + }, + /** + * @private + * @param {Object} pointer Actual mouse position related to the canvas. + */ + _prepareForDrawing: function(p) { + var d = new c.Point(p.x, p.y); + this._reset(), this._addPoint(d), this.canvas.contextTop.moveTo(d.x, d.y); + }, + /** + * @private + * @param {fabric.Point} point Point to be added to points array + */ + _addPoint: function(p) { + return this._points.length > 1 && p.eq(this._points[this._points.length - 1]) ? !1 : (this._points.push(p), !0); + }, + /** + * Clear points array and set contextTop canvas style. + * @private + */ + _reset: function() { + this._points = [], this._setBrushStyles(), this._setShadow(); + }, + /** + * @private + * @param {Object} pointer Actual mouse position related to the canvas. + */ + _captureDrawingPath: function(p) { + var d = new c.Point(p.x, p.y); + return this._addPoint(d); + }, + /** + * Draw a smooth path on the topCanvas using quadraticCurveTo + * @private + */ + _render: function() { + var p = this.canvas.contextTop, d, m, _ = this._points[0], y = this._points[1]; + if (this._saveAndTransform(p), p.beginPath(), this._points.length === 2 && _.x === y.x && _.y === y.y) { + var x = this.width / 1e3; + _ = new c.Point(_.x, _.y), y = new c.Point(y.x, y.y), _.x -= x, y.x += x; + } + for (p.moveTo(_.x, _.y), d = 1, m = this._points.length; d < m; d++) + this._drawSegment(p, _, y), _ = this._points[d], y = this._points[d + 1]; + p.lineTo(_.x, _.y), p.stroke(), p.restore(); + }, + /** + * Converts points to SVG path + * @param {Array} points Array of points + * @return {(string|number)[][]} SVG path commands + */ + convertPointsToSVGPath: function(p) { + var d = this.width / 1e3; + return c.util.getSmoothPathFromPoints(p, d); + }, + /** + * @private + * @param {(string|number)[][]} pathData SVG path commands + * @returns {boolean} + */ + _isEmptySVGPath: function(p) { + var d = c.util.joinPath(p); + return d === "M 0 0 Q 0 0 0 0 L 0 0"; + }, + /** + * Creates fabric.Path object to add on canvas + * @param {(string|number)[][]} pathData Path data + * @return {fabric.Path} Path to add on canvas + */ + createPath: function(p) { + var d = new c.Path(p, { + fill: null, + stroke: this.color, + strokeWidth: this.width, + strokeLineCap: this.strokeLineCap, + strokeMiterLimit: this.strokeMiterLimit, + strokeLineJoin: this.strokeLineJoin, + strokeDashArray: this.strokeDashArray + }); + return this.shadow && (this.shadow.affectStroke = !0, d.shadow = new c.Shadow(this.shadow)), d; + }, + /** + * Decimate points array with the decimate value + */ + decimatePoints: function(p, d) { + if (p.length <= 2) + return p; + var m = this.canvas.getZoom(), _ = Math.pow(d / m, 2), y, x = p.length - 1, g = p[0], S = [g], T; + for (y = 1; y < x - 1; y++) + T = Math.pow(g.x - p[y].x, 2) + Math.pow(g.y - p[y].y, 2), T >= _ && (g = p[y], S.push(g)); + return S.push(p[x]), S; + }, + /** + * On mouseup after drawing the path on contextTop canvas + * we use the points captured to create an new fabric path object + * and add it to the fabric canvas. + */ + _finalizeAndAddPath: function() { + var p = this.canvas.contextTop; + p.closePath(), this.decimate && (this._points = this.decimatePoints(this._points, this.decimate)); + var d = this.convertPointsToSVGPath(this._points); + if (this._isEmptySVGPath(d)) { + this.canvas.requestRenderAll(); + return; + } + var m = this.createPath(d); + this.canvas.clearContext(this.canvas.contextTop), this.canvas.fire("before:path:created", { path: m }), this.canvas.add(m), this.canvas.requestRenderAll(), m.setCoords(), this._resetShadow(), this.canvas.fire("path:created", { path: m }); + } + } + ); + }(), c.CircleBrush = c.util.createClass( + c.BaseBrush, + /** @lends fabric.CircleBrush.prototype */ + { + /** + * Width of a brush + * @type Number + * @default + */ + width: 10, + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.CircleBrush} Instance of a circle brush + */ + initialize: function(p) { + this.canvas = p, this.points = []; + }, + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + drawDot: function(p) { + var d = this.addPoint(p), m = this.canvas.contextTop; + this._saveAndTransform(m), this.dot(m, d), m.restore(); + }, + dot: function(p, d) { + p.fillStyle = d.fill, p.beginPath(), p.arc(d.x, d.y, d.radius, 0, Math.PI * 2, !1), p.closePath(), p.fill(); + }, + /** + * Invoked on mouse down + */ + onMouseDown: function(p) { + this.points.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.drawDot(p); + }, + /** + * Render the full state of the brush + * @private + */ + _render: function() { + var p = this.canvas.contextTop, d, m, _ = this.points; + for (this._saveAndTransform(p), d = 0, m = _.length; d < m; d++) + this.dot(p, _[d]); + p.restore(); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(p) { + this.limitedToCanvasSize === !0 && this._isOutSideCanvas(p) || (this.needsFullRender() ? (this.canvas.clearContext(this.canvas.contextTop), this.addPoint(p), this._render()) : this.drawDot(p)); + }, + /** + * Invoked on mouse up + */ + onMouseUp: function() { + var p = this.canvas.renderOnAddRemove, d, m; + this.canvas.renderOnAddRemove = !1; + var _ = []; + for (d = 0, m = this.points.length; d < m; d++) { + var y = this.points[d], x = new c.Circle({ + radius: y.radius, + left: y.x, + top: y.y, + originX: "center", + originY: "center", + fill: y.fill + }); + this.shadow && (x.shadow = new c.Shadow(this.shadow)), _.push(x); + } + var g = new c.Group(_); + g.canvas = this.canvas, this.canvas.fire("before:path:created", { path: g }), this.canvas.add(g), this.canvas.fire("path:created", { path: g }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = p, this.canvas.requestRenderAll(); + }, + /** + * @param {Object} pointer + * @return {fabric.Point} Just added pointer point + */ + addPoint: function(p) { + var d = new c.Point(p.x, p.y), m = c.util.getRandomInt( + Math.max(0, this.width - 20), + this.width + 20 + ) / 2, _ = new c.Color(this.color).setAlpha(c.util.getRandomInt(0, 100) / 100).toRgba(); + return d.radius = m, d.fill = _, this.points.push(d), d; + } + } + ), c.SprayBrush = c.util.createClass( + c.BaseBrush, + /** @lends fabric.SprayBrush.prototype */ + { + /** + * Width of a spray + * @type Number + * @default + */ + width: 10, + /** + * Density of a spray (number of dots per chunk) + * @type Number + * @default + */ + density: 20, + /** + * Width of spray dots + * @type Number + * @default + */ + dotWidth: 1, + /** + * Width variance of spray dots + * @type Number + * @default + */ + dotWidthVariance: 1, + /** + * Whether opacity of a dot should be random + * @type Boolean + * @default + */ + randomOpacity: !1, + /** + * Whether overlapping dots (rectangles) should be removed (for performance reasons) + * @type Boolean + * @default + */ + optimizeOverlapping: !0, + /** + * Constructor + * @param {fabric.Canvas} canvas + * @return {fabric.SprayBrush} Instance of a spray brush + */ + initialize: function(p) { + this.canvas = p, this.sprayChunks = []; + }, + /** + * Invoked on mouse down + * @param {Object} pointer + */ + onMouseDown: function(p) { + this.sprayChunks.length = 0, this.canvas.clearContext(this.canvas.contextTop), this._setShadow(), this.addSprayChunk(p), this.render(this.sprayChunkPoints); + }, + /** + * Invoked on mouse move + * @param {Object} pointer + */ + onMouseMove: function(p) { + this.limitedToCanvasSize === !0 && this._isOutSideCanvas(p) || (this.addSprayChunk(p), this.render(this.sprayChunkPoints)); + }, + /** + * Invoked on mouse up + */ + onMouseUp: function() { + var p = this.canvas.renderOnAddRemove; + this.canvas.renderOnAddRemove = !1; + for (var d = [], m = 0, _ = this.sprayChunks.length; m < _; m++) + for (var y = this.sprayChunks[m], x = 0, g = y.length; x < g; x++) { + var S = new c.Rect({ + width: y[x].width, + height: y[x].width, + left: y[x].x + 1, + top: y[x].y + 1, + originX: "center", + originY: "center", + fill: this.color + }); + d.push(S); + } + this.optimizeOverlapping && (d = this._getOptimizedRects(d)); + var T = new c.Group(d); + this.shadow && T.set("shadow", new c.Shadow(this.shadow)), this.canvas.fire("before:path:created", { path: T }), this.canvas.add(T), this.canvas.fire("path:created", { path: T }), this.canvas.clearContext(this.canvas.contextTop), this._resetShadow(), this.canvas.renderOnAddRemove = p, this.canvas.requestRenderAll(); + }, + /** + * @private + * @param {Array} rects + */ + _getOptimizedRects: function(p) { + var d = {}, m, _, y; + for (_ = 0, y = p.length; _ < y; _++) + m = p[_].left + "" + p[_].top, d[m] || (d[m] = p[_]); + var x = []; + for (m in d) + x.push(d[m]); + return x; + }, + /** + * Render new chunk of spray brush + */ + render: function(p) { + var d = this.canvas.contextTop, m, _; + for (d.fillStyle = this.color, this._saveAndTransform(d), m = 0, _ = p.length; m < _; m++) { + var y = p[m]; + typeof y.opacity != "undefined" && (d.globalAlpha = y.opacity), d.fillRect(y.x, y.y, y.width, y.width); + } + d.restore(); + }, + /** + * Render all spray chunks + */ + _render: function() { + var p = this.canvas.contextTop, d, m; + for (p.fillStyle = this.color, this._saveAndTransform(p), d = 0, m = this.sprayChunks.length; d < m; d++) + this.render(this.sprayChunks[d]); + p.restore(); + }, + /** + * @param {Object} pointer + */ + addSprayChunk: function(p) { + this.sprayChunkPoints = []; + var d, m, _, y = this.width / 2, x; + for (x = 0; x < this.density; x++) { + d = c.util.getRandomInt(p.x - y, p.x + y), m = c.util.getRandomInt(p.y - y, p.y + y), this.dotWidthVariance ? _ = c.util.getRandomInt( + // bottom clamp width to 1 + Math.max(1, this.dotWidth - this.dotWidthVariance), + this.dotWidth + this.dotWidthVariance + ) : _ = this.dotWidth; + var g = new c.Point(d, m); + g.width = _, this.randomOpacity && (g.opacity = c.util.getRandomInt(0, 100) / 100), this.sprayChunkPoints.push(g); + } + this.sprayChunks.push(this.sprayChunkPoints); + } + } + ), c.PatternBrush = c.util.createClass( + c.PencilBrush, + /** @lends fabric.PatternBrush.prototype */ + { + getPatternSrc: function() { + var p = 20, d = 5, m = c.util.createCanvasElement(), _ = m.getContext("2d"); + return m.width = m.height = p + d, _.fillStyle = this.color, _.beginPath(), _.arc(p / 2, p / 2, p / 2, 0, Math.PI * 2, !1), _.closePath(), _.fill(), m; + }, + getPatternSrcFunction: function() { + return String(this.getPatternSrc).replace("this.color", '"' + this.color + '"'); + }, + /** + * Creates "pattern" instance property + */ + getPattern: function() { + return this.canvas.contextTop.createPattern(this.source || this.getPatternSrc(), "repeat"); + }, + /** + * Sets brush styles + */ + _setBrushStyles: function() { + this.callSuper("_setBrushStyles"), this.canvas.contextTop.strokeStyle = this.getPattern(); + }, + /** + * Creates path + */ + createPath: function(p) { + var d = this.callSuper("createPath", p), m = d._getLeftTopCoords().scalarAdd(d.strokeWidth / 2); + return d.stroke = new c.Pattern({ + source: this.source || this.getPatternSrcFunction(), + offsetX: -m.x, + offsetY: -m.y + }), d; + } + } + ), function() { + var p = c.util.getPointer, d = c.util.degreesToRadians, m = c.util.isTouchEvent; + c.Canvas = c.util.createClass( + c.StaticCanvas, + /** @lends fabric.Canvas.prototype */ + { + /** + * Constructor + * @param {HTMLElement | String} el <canvas> element to initialize instance on + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(y, x) { + x || (x = {}), this.renderAndResetBound = this.renderAndReset.bind(this), this.requestRenderAllBound = this.requestRenderAll.bind(this), this._initStatic(y, x), this._initInteractive(), this._createCacheCanvas(); + }, + /** + * When true, objects can be transformed by one side (unproportionally) + * when dragged on the corners that normally would not do that. + * @type Boolean + * @default + * @since fabric 4.0 // changed name and default value + */ + uniformScaling: !0, + /** + * Indicates which key switches uniform scaling. + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled. + * totally wrong named. this sounds like `uniform scaling` + * if Canvas.uniformScaling is true, pressing this will set it to false + * and viceversa. + * @since 1.6.2 + * @type String + * @default + */ + uniScaleKey: "shiftKey", + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredScaling: !1, + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredRotation: !1, + /** + * Indicates which key enable centered Transform + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled feature disabled. + * @since 1.6.2 + * @type String + * @default + */ + centeredKey: "altKey", + /** + * Indicates which key enable alternate action on corner + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled feature disabled. + * @since 1.6.2 + * @type String + * @default + */ + altActionKey: "shiftKey", + /** + * Indicates that canvas is interactive. This property should not be changed. + * @type Boolean + * @default + */ + interactive: !0, + /** + * Indicates whether group selection should be enabled + * @type Boolean + * @default + */ + selection: !0, + /** + * Indicates which key or keys enable multiple click selection + * Pass value as a string or array of strings + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * If `null` or empty or containing any other string that is not a modifier key + * feature is disabled. + * @since 1.6.2 + * @type String|Array + * @default + */ + selectionKey: "shiftKey", + /** + * Indicates which key enable alternative selection + * in case of target overlapping with active object + * values: 'altKey', 'shiftKey', 'ctrlKey'. + * For a series of reason that come from the general expectations on how + * things should work, this feature works only for preserveObjectStacking true. + * If `null` or 'none' or any other string that is not a modifier key + * feature is disabled. + * @since 1.6.5 + * @type null|String + * @default + */ + altSelectionKey: null, + /** + * Color of selection + * @type String + * @default + */ + selectionColor: "rgba(100, 100, 255, 0.3)", + // blue + /** + * Default dash array pattern + * If not empty the selection border is dashed + * @type Array + */ + selectionDashArray: [], + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + * @type String + * @default + */ + selectionBorderColor: "rgba(255, 255, 255, 0.3)", + /** + * Width of a line used in object/group selection + * @type Number + * @default + */ + selectionLineWidth: 1, + /** + * Select only shapes that are fully contained in the dragged selection rectangle. + * @type Boolean + * @default + */ + selectionFullyContained: !1, + /** + * Default cursor value used when hovering over an object on canvas + * @type String + * @default + */ + hoverCursor: "move", + /** + * Default cursor value used when moving an object on canvas + * @type String + * @default + */ + moveCursor: "move", + /** + * Default cursor value used for the entire canvas + * @type String + * @default + */ + defaultCursor: "default", + /** + * Cursor value used during free drawing + * @type String + * @default + */ + freeDrawingCursor: "crosshair", + /** + * Cursor value used for rotation point + * @type String + * @default + */ + rotationCursor: "crosshair", + /** + * Cursor value used for disabled elements ( corners with disabled action ) + * @type String + * @since 2.0.0 + * @default + */ + notAllowedCursor: "not-allowed", + /** + * Default element class that's given to wrapper (div) element of canvas + * @type String + * @default + */ + containerClass: "canvas-container", + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + * @type Boolean + * @default + */ + perPixelTargetFind: !1, + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + * @type Number + * @default + */ + targetFindTolerance: 0, + /** + * When true, target detection is skipped. Target detection will return always undefined. + * click selection won't work anymore, events will fire with no targets. + * if something is selected before setting it to true, it will be deselected at the first click. + * area selection will still work. check the `selection` property too. + * if you deactivate both, you should look into staticCanvas. + * @type Boolean + * @default + */ + skipTargetFind: !1, + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + * @tutorial {@link http://fabricjs.com/fabric-intro-part-4#free_drawing} + * @type Boolean + * @default + */ + isDrawingMode: !1, + /** + * Indicates whether objects should remain in current stack position when selected. + * When false objects are brought to top and rendered as part of the selection group + * @type Boolean + * @default + */ + preserveObjectStacking: !1, + /** + * Indicates the angle that an object will lock to while rotating. + * @type Number + * @since 1.6.7 + * @default + */ + snapAngle: 0, + /** + * Indicates the distance from the snapAngle the rotation will lock to the snapAngle. + * When `null`, the snapThreshold will default to the snapAngle. + * @type null|Number + * @since 1.6.7 + * @default + */ + snapThreshold: null, + /** + * Indicates if the right click on canvas can output the context menu or not + * @type Boolean + * @since 1.6.5 + * @default + */ + stopContextMenu: !1, + /** + * Indicates if the canvas can fire right click events + * @type Boolean + * @since 1.6.5 + * @default + */ + fireRightClick: !1, + /** + * Indicates if the canvas can fire middle click events + * @type Boolean + * @since 1.7.8 + * @default + */ + fireMiddleClick: !1, + /** + * Keep track of the subTargets for Mouse Events + * @type fabric.Object[] + */ + targets: [], + /** + * Keep track of the hovered target + * @type fabric.Object + * @private + */ + _hoveredTarget: null, + /** + * hold the list of nested targets hovered + * @type fabric.Object[] + * @private + */ + _hoveredTargets: [], + /** + * @private + */ + _initInteractive: function() { + this._currentTransform = null, this._groupSelector = null, this._initWrapperElement(), this._createUpperCanvas(), this._initEventListeners(), this._initRetinaScaling(), this.freeDrawingBrush = c.PencilBrush && new c.PencilBrush(this), this.calcOffset(); + }, + /** + * Divides objects in two groups, one to render immediately + * and one to render as activeGroup. + * @return {Array} objects to render immediately and pushes the other in the activeGroup. + */ + _chooseObjectsToRender: function() { + var y = this.getActiveObjects(), x, g, S; + if (y.length > 0 && !this.preserveObjectStacking) { + g = [], S = []; + for (var T = 0, C = this._objects.length; T < C; T++) + x = this._objects[T], y.indexOf(x) === -1 ? g.push(x) : S.push(x); + y.length > 1 && (this._activeObject._objects = S), g.push.apply(g, S); + } else + g = this._objects; + return g; + }, + /** + * Renders both the top canvas and the secondary container canvas. + * @return {fabric.Canvas} instance + * @chainable + */ + renderAll: function() { + this.contextTopDirty && !this._groupSelector && !this.isDrawingMode && (this.clearContext(this.contextTop), this.contextTopDirty = !1), this.hasLostContext && this.renderTopLayer(this.contextTop); + var y = this.contextContainer; + return this.renderCanvas(y, this._chooseObjectsToRender()), this; + }, + renderTopLayer: function(y) { + y.save(), this.isDrawingMode && this._isCurrentlyDrawing && (this.freeDrawingBrush && this.freeDrawingBrush._render(), this.contextTopDirty = !0), this.selection && this._groupSelector && (this._drawSelection(y), this.contextTopDirty = !0), y.restore(); + }, + /** + * Method to render only the top canvas. + * Also used to render the group selection box. + * @return {fabric.Canvas} thisArg + * @chainable + */ + renderTop: function() { + var y = this.contextTop; + return this.clearContext(y), this.renderTopLayer(y), this.fire("after:render"), this; + }, + /** + * @private + */ + _normalizePointer: function(y, x) { + var g = y.calcTransformMatrix(), S = c.util.invertTransform(g), T = this.restorePointerVpt(x); + return c.util.transformPoint(T, S); + }, + /** + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + * @return {Boolean} + */ + isTargetTransparent: function(y, x, g) { + if (y.shouldCache() && y._cacheCanvas && y !== this._activeObject) { + var S = this._normalizePointer(y, { x, y: g }), T = Math.max(y.cacheTranslationX + S.x * y.zoomX, 0), C = Math.max(y.cacheTranslationY + S.y * y.zoomY, 0), R = c.util.isTransparent( + y._cacheContext, + Math.round(T), + Math.round(C), + this.targetFindTolerance + ); + return R; + } + var E = this.contextCache, M = y.selectionBackgroundColor, P = this.viewportTransform; + y.selectionBackgroundColor = "", this.clearContext(E), E.save(), E.transform(P[0], P[1], P[2], P[3], P[4], P[5]), y.render(E), E.restore(), y.selectionBackgroundColor = M; + var R = c.util.isTransparent( + E, + x, + g, + this.targetFindTolerance + ); + return R; + }, + /** + * takes an event and determines if selection key has been pressed + * @private + * @param {Event} e Event object + */ + _isSelectionKeyPressed: function(y) { + var x = !1; + return Object.prototype.toString.call(this.selectionKey) === "[object Array]" ? x = !!this.selectionKey.find(function(g) { + return y[g] === !0; + }) : x = y[this.selectionKey], x; + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _shouldClearSelection: function(y, x) { + var g = this.getActiveObjects(), S = this._activeObject; + return !x || x && S && g.length > 1 && g.indexOf(x) === -1 && S !== x && !this._isSelectionKeyPressed(y) || x && !x.evented || x && !x.selectable && S && S !== x; + }, + /** + * centeredScaling from object can't override centeredScaling from canvas. + * this should be fixed, since object setting should take precedence over canvas. + * also this should be something that will be migrated in the control properties. + * as ability to define the origin of the transformation that the control provide. + * @private + * @param {fabric.Object} target + * @param {String} action + * @param {Boolean} altKey + */ + _shouldCenterTransform: function(y, x, g) { + if (y) { + var S; + return x === "scale" || x === "scaleX" || x === "scaleY" || x === "resizing" ? S = this.centeredScaling || y.centeredScaling : x === "rotate" && (S = this.centeredRotation || y.centeredRotation), S ? !g : g; + } + }, + /** + * should disappear before release 4.0 + * @private + */ + _getOriginFromCorner: function(y, x) { + var g = { + x: y.originX, + y: y.originY + }; + return x === "ml" || x === "tl" || x === "bl" ? g.x = "right" : (x === "mr" || x === "tr" || x === "br") && (g.x = "left"), x === "tl" || x === "mt" || x === "tr" ? g.y = "bottom" : (x === "bl" || x === "mb" || x === "br") && (g.y = "top"), g; + }, + /** + * @private + * @param {Boolean} alreadySelected true if target is already selected + * @param {String} corner a string representing the corner ml, mr, tl ... + * @param {Event} e Event object + * @param {fabric.Object} [target] inserted back to help overriding. Unused + */ + _getActionFromCorner: function(y, x, g, S) { + if (!x || !y) + return "drag"; + var T = S.controls[x]; + return T.getActionName(g, T, S); + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _setupCurrentTransform: function(y, x, g) { + if (x) { + var S = this.getPointer(y), T = x.__corner, C = x.controls[T], E = g && T ? C.getActionHandler(y, x, C) : c.controlsUtils.dragHandler, M = this._getActionFromCorner(g, T, y, x), P = this._getOriginFromCorner(x, T), R = y[this.centeredKey], N = { + target: x, + action: M, + actionHandler: E, + corner: T, + scaleX: x.scaleX, + scaleY: x.scaleY, + skewX: x.skewX, + skewY: x.skewY, + // used by transation + offsetX: S.x - x.left, + offsetY: S.y - x.top, + originX: P.x, + originY: P.y, + ex: S.x, + ey: S.y, + lastX: S.x, + lastY: S.y, + // unsure they are useful anymore. + // left: target.left, + // top: target.top, + theta: d(x.angle), + // end of unsure + width: x.width * x.scaleX, + shiftKey: y.shiftKey, + altKey: R, + original: c.util.saveObjectTransform(x) + }; + this._shouldCenterTransform(x, M, R) && (N.originX = "center", N.originY = "center"), N.original.originX = P.x, N.original.originY = P.y, this._currentTransform = N, this._beforeTransform(y); + } + }, + /** + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ + setCursor: function(y) { + this.upperCanvasEl.style.cursor = y; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx to draw the selection on + */ + _drawSelection: function(y) { + var x = this._groupSelector, g = new c.Point(x.ex, x.ey), S = c.util.transformPoint(g, this.viewportTransform), T = new c.Point(x.ex + x.left, x.ey + x.top), C = c.util.transformPoint(T, this.viewportTransform), E = Math.min(S.x, C.x), M = Math.min(S.y, C.y), P = Math.max(S.x, C.x), R = Math.max(S.y, C.y), N = this.selectionLineWidth / 2; + this.selectionColor && (y.fillStyle = this.selectionColor, y.fillRect(E, M, P - E, R - M)), !(!this.selectionLineWidth || !this.selectionBorderColor) && (y.lineWidth = this.selectionLineWidth, y.strokeStyle = this.selectionBorderColor, E += N, M += N, P -= N, R -= N, c.Object.prototype._setLineDash.call(this, y, this.selectionDashArray), y.strokeRect(E, M, P - E, R - M)); + }, + /** + * Method that determines what object we are clicking on + * the skipGroup parameter is for internal use, is needed for shift+click action + * 11/09/2018 TODO: would be cool if findTarget could discern between being a full target + * or the outside part of the corner. + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, activeGroup is skipped and only objects are traversed through + * @return {fabric.Object} the target found + */ + findTarget: function(y, x) { + if (!this.skipTargetFind) { + var g = !0, S = this.getPointer(y, g), T = this._activeObject, C = this.getActiveObjects(), E, M, P = m(y), R = C.length > 1 && !x || C.length === 1; + if (this.targets = [], R && T._findTargetCorner(S, P) || C.length > 1 && !x && T === this._searchPossibleTargets([T], S)) + return T; + if (C.length === 1 && T === this._searchPossibleTargets([T], S)) + if (this.preserveObjectStacking) + E = T, M = this.targets, this.targets = []; + else + return T; + var N = this._searchPossibleTargets(this._objects, S); + return y[this.altSelectionKey] && N && E && N !== E && (N = E, this.targets = M), N; + } + }, + /** + * Checks point is inside the object. + * @param {Object} [pointer] x,y object of point coordinates we want to check. + * @param {fabric.Object} obj Object to test against + * @param {Object} [globalPointer] x,y object of point coordinates relative to canvas used to search per pixel target. + * @return {Boolean} true if point is contained within an area of given object + * @private + */ + _checkTarget: function(y, x, g) { + if (x && x.visible && x.evented && // http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html + // http://idav.ucdavis.edu/~okreylos/TAship/Spring2000/PointInPolygon.html + x.containsPoint(y)) + if ((this.perPixelTargetFind || x.perPixelTargetFind) && !x.isEditing) { + var S = this.isTargetTransparent(x, g.x, g.y); + if (!S) + return !0; + } else + return !0; + }, + /** + * Function used to search inside objects an object that contains pointer in bounding box or that contains pointerOnCanvas when painted + * @param {Array} [objects] objects array to look into + * @param {Object} [pointer] x,y object of point coordinates we want to check. + * @return {fabric.Object} object that contains pointer + * @private + */ + _searchPossibleTargets: function(y, x) { + for (var g, S = y.length, T; S--; ) { + var C = y[S], E = C.group ? this._normalizePointer(C.group, x) : x; + if (this._checkTarget(E, C, x)) { + g = y[S], g.subTargetCheck && g instanceof c.Group && (T = this._searchPossibleTargets(g._objects, x), T && this.targets.push(T)); + break; + } + } + return g; + }, + /** + * Returns pointer coordinates without the effect of the viewport + * @param {Object} pointer with "x" and "y" number values + * @return {Object} object with "x" and "y" number values + */ + restorePointerVpt: function(y) { + return c.util.transformPoint( + y, + c.util.invertTransform(this.viewportTransform) + ); + }, + /** + * Returns pointer coordinates relative to canvas. + * Can return coordinates with or without viewportTransform. + * ignoreZoom false gives back coordinates that represent + * the point clicked on canvas element. + * ignoreZoom true gives back coordinates after being processed + * by the viewportTransform ( sort of coordinates of what is displayed + * on the canvas where you are clicking. + * ignoreZoom true = HTMLElement coordinates relative to top,left + * ignoreZoom false, default = fabric space coordinates, the same used for shape position + * To interact with your shapes top and left you want to use ignoreZoom true + * most of the time, while ignoreZoom false will give you coordinates + * compatible with the object.oCoords system. + * of the time. + * @param {Event} e + * @param {Boolean} ignoreZoom + * @return {Object} object with "x" and "y" number values + */ + getPointer: function(y, x) { + if (this._absolutePointer && !x) + return this._absolutePointer; + if (this._pointer && x) + return this._pointer; + var g = p(y), S = this.upperCanvasEl, T = S.getBoundingClientRect(), C = T.width || 0, E = T.height || 0, M; + (!C || !E) && ("top" in T && "bottom" in T && (E = Math.abs(T.top - T.bottom)), "right" in T && "left" in T && (C = Math.abs(T.right - T.left))), this.calcOffset(), g.x = g.x - this._offset.left, g.y = g.y - this._offset.top, x || (g = this.restorePointerVpt(g)); + var P = this.getRetinaScaling(); + return P !== 1 && (g.x /= P, g.y /= P), C === 0 || E === 0 ? M = { width: 1, height: 1 } : M = { + width: S.width / C, + height: S.height / E + }, { + x: g.x * M.width, + y: g.y * M.height + }; + }, + /** + * @private + * @throws {CANVAS_INIT_ERROR} If canvas can not be initialized + */ + _createUpperCanvas: function() { + var y = this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/, ""), x = this.lowerCanvasEl, g = this.upperCanvasEl; + g ? g.className = "" : (g = this._createCanvasElement(), this.upperCanvasEl = g), c.util.addClass(g, "upper-canvas " + y), this.wrapperEl.appendChild(g), this._copyCanvasStyle(x, g), this._applyCanvasStyle(g), this.contextTop = g.getContext("2d"); + }, + /** + * @private + */ + _createCacheCanvas: function() { + this.cacheCanvasEl = this._createCanvasElement(), this.cacheCanvasEl.setAttribute("width", this.width), this.cacheCanvasEl.setAttribute("height", this.height), this.contextCache = this.cacheCanvasEl.getContext("2d"); + }, + /** + * @private + */ + _initWrapperElement: function() { + this.wrapperEl = c.util.wrapElement(this.lowerCanvasEl, "div", { + class: this.containerClass + }), c.util.setStyle(this.wrapperEl, { + width: this.width + "px", + height: this.height + "px", + position: "relative" + }), c.util.makeElementUnselectable(this.wrapperEl); + }, + /** + * @private + * @param {HTMLElement} element canvas element to apply styles on + */ + _applyCanvasStyle: function(y) { + var x = this.width || y.width, g = this.height || y.height; + c.util.setStyle(y, { + position: "absolute", + width: x + "px", + height: g + "px", + left: 0, + top: 0, + "touch-action": this.allowTouchScrolling ? "manipulation" : "none", + "-ms-touch-action": this.allowTouchScrolling ? "manipulation" : "none" + }), y.width = x, y.height = g, c.util.makeElementUnselectable(y); + }, + /** + * Copy the entire inline style from one element (fromEl) to another (toEl) + * @private + * @param {Element} fromEl Element style is copied from + * @param {Element} toEl Element copied style is applied to + */ + _copyCanvasStyle: function(y, x) { + x.style.cssText = y.style.cssText; + }, + /** + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ + getSelectionContext: function() { + return this.contextTop; + }, + /** + * Returns <canvas> element on which object selection is drawn + * @return {HTMLCanvasElement} + */ + getSelectionElement: function() { + return this.upperCanvasEl; + }, + /** + * Returns currently active object + * @return {fabric.Object} active object + */ + getActiveObject: function() { + return this._activeObject; + }, + /** + * Returns an array with the current selected objects + * @return {fabric.Object} active object + */ + getActiveObjects: function() { + var y = this._activeObject; + return y ? y.type === "activeSelection" && y._objects ? y._objects.slice(0) : [y] : []; + }, + /** + * @private + * @param {fabric.Object} obj Object that was removed + */ + _onObjectRemoved: function(y) { + y === this._activeObject && (this.fire("before:selection:cleared", { target: y }), this._discardActiveObject(), this.fire("selection:cleared", { target: y }), y.fire("deselected")), y === this._hoveredTarget && (this._hoveredTarget = null, this._hoveredTargets = []), this.callSuper("_onObjectRemoved", y); + }, + /** + * @private + * Compares the old activeObject with the current one and fires correct events + * @param {fabric.Object} obj old activeObject + */ + _fireSelectionEvents: function(y, x) { + var g = !1, S = this.getActiveObjects(), T = [], C = []; + y.forEach(function(E) { + S.indexOf(E) === -1 && (g = !0, E.fire("deselected", { + e: x, + target: E + }), C.push(E)); + }), S.forEach(function(E) { + y.indexOf(E) === -1 && (g = !0, E.fire("selected", { + e: x, + target: E + }), T.push(E)); + }), y.length > 0 && S.length > 0 ? g && this.fire("selection:updated", { + e: x, + selected: T, + deselected: C, + // added for backward compatibility + // deprecated + updated: T[0] || C[0], + target: this._activeObject + }) : S.length > 0 ? this.fire("selection:created", { + e: x, + selected: T, + target: this._activeObject + }) : y.length > 0 && this.fire("selection:cleared", { + e: x, + deselected: C + }); + }, + /** + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + * @return {fabric.Canvas} thisArg + * @chainable + */ + setActiveObject: function(y, x) { + var g = this.getActiveObjects(); + return this._setActiveObject(y, x), this._fireSelectionEvents(g, x), this; + }, + /** + * This is a private method for now. + * This is supposed to be equivalent to setActiveObject but without firing + * any event. There is commitment to have this stay this way. + * This is the functional part of setActiveObject. + * @private + * @param {Object} object to set as active + * @param {Event} [e] Event (passed along when firing "object:selected") + * @return {Boolean} true if the selection happened + */ + _setActiveObject: function(y, x) { + return this._activeObject === y || !this._discardActiveObject(x, y) || y.onSelect({ e: x }) ? !1 : (this._activeObject = y, !0); + }, + /** + * This is a private method for now. + * This is supposed to be equivalent to discardActiveObject but without firing + * any events. There is commitment to have this stay this way. + * This is the functional part of discardActiveObject. + * @param {Event} [e] Event (passed along when firing "object:deselected") + * @param {Object} object to set as active + * @return {Boolean} true if the selection happened + * @private + */ + _discardActiveObject: function(y, x) { + var g = this._activeObject; + if (g) { + if (g.onDeselect({ e: y, object: x })) + return !1; + this._activeObject = null; + } + return !0; + }, + /** + * Discards currently active object and fire events. If the function is called by fabric + * as a consequence of a mouse event, the event is passed as a parameter and + * sent to the fire function for the custom events. When used as a method the + * e param does not have any application. + * @param {event} e + * @return {fabric.Canvas} thisArg + * @chainable + */ + discardActiveObject: function(y) { + var x = this.getActiveObjects(), g = this.getActiveObject(); + return x.length && this.fire("before:selection:cleared", { target: g, e: y }), this._discardActiveObject(y), this._fireSelectionEvents(x, y), this; + }, + /** + * Clears a canvas element and removes all event listeners + * @return {fabric.Canvas} thisArg + * @chainable + */ + dispose: function() { + var y = this.wrapperEl; + return this.removeListeners(), y.removeChild(this.upperCanvasEl), y.removeChild(this.lowerCanvasEl), this.contextCache = null, this.contextTop = null, ["upperCanvasEl", "cacheCanvasEl"].forEach(function(x) { + c.util.cleanUpJsdomNode(this[x]), this[x] = void 0; + }.bind(this)), y.parentNode && y.parentNode.replaceChild(this.lowerCanvasEl, this.wrapperEl), delete this.wrapperEl, c.StaticCanvas.prototype.dispose.call(this), this; + }, + /** + * Clears all contexts (background, main, top) of an instance + * @return {fabric.Canvas} thisArg + * @chainable + */ + clear: function() { + return this.discardActiveObject(), this.clearContext(this.contextTop), this.callSuper("clear"); + }, + /** + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ + drawControls: function(y) { + var x = this._activeObject; + x && x._renderControls(y); + }, + /** + * @private + */ + _toObject: function(y, x, g) { + var S = this._realizeGroupTransformOnObject(y), T = this.callSuper("_toObject", y, x, g); + return this._unwindGroupTransformOnObject(y, S), T; + }, + /** + * Realises an object's group transformation on it + * @private + * @param {fabric.Object} [instance] the object to transform (gets mutated) + * @returns the original values of instance which were changed + */ + _realizeGroupTransformOnObject: function(y) { + if (y.group && y.group.type === "activeSelection" && this._activeObject === y.group) { + var x = ["angle", "flipX", "flipY", "left", "scaleX", "scaleY", "skewX", "skewY", "top"], g = {}; + return x.forEach(function(S) { + g[S] = y[S]; + }), c.util.addTransformToObject(y, this._activeObject.calcOwnMatrix()), g; + } else + return null; + }, + /** + * Restores the changed properties of instance + * @private + * @param {fabric.Object} [instance] the object to un-transform (gets mutated) + * @param {Object} [originalValues] the original values of instance, as returned by _realizeGroupTransformOnObject + */ + _unwindGroupTransformOnObject: function(y, x) { + x && y.set(x); + }, + /** + * @private + */ + _setSVGObject: function(y, x, g) { + var S = this._realizeGroupTransformOnObject(x); + this.callSuper("_setSVGObject", y, x, g), this._unwindGroupTransformOnObject(x, S); + }, + setViewportTransform: function(y) { + this.renderOnAddRemove && this._activeObject && this._activeObject.isEditing && this._activeObject.clearContextTop(), c.StaticCanvas.prototype.setViewportTransform.call(this, y); + } + } + ); + for (var _ in c.StaticCanvas) + _ !== "prototype" && (c.Canvas[_] = c.StaticCanvas[_]); + }(), function() { + var p = c.util.addListener, d = c.util.removeListener, m = 3, _ = 2, y = 1, x = { passive: !1 }; + function g(S, T) { + return S.button && S.button === T - 1; + } + c.util.object.extend( + c.Canvas.prototype, + /** @lends fabric.Canvas.prototype */ + { + /** + * Contains the id of the touch event that owns the fabric transform + * @type Number + * @private + */ + mainTouchId: null, + /** + * Adds mouse listeners to canvas + * @private + */ + _initEventListeners: function() { + this.removeListeners(), this._bindEvents(), this.addOrRemove(p, "add"); + }, + /** + * return an event prefix pointer or mouse. + * @private + */ + _getEventPrefix: function() { + return this.enablePointerEvents ? "pointer" : "mouse"; + }, + addOrRemove: function(S, T) { + var C = this.upperCanvasEl, E = this._getEventPrefix(); + S(c.window, "resize", this._onResize), S(C, E + "down", this._onMouseDown), S(C, E + "move", this._onMouseMove, x), S(C, E + "out", this._onMouseOut), S(C, E + "enter", this._onMouseEnter), S(C, "wheel", this._onMouseWheel), S(C, "contextmenu", this._onContextMenu), S(C, "dblclick", this._onDoubleClick), S(C, "dragover", this._onDragOver), S(C, "dragenter", this._onDragEnter), S(C, "dragleave", this._onDragLeave), S(C, "drop", this._onDrop), this.enablePointerEvents || S(C, "touchstart", this._onTouchStart, x), typeof eventjs != "undefined" && T in eventjs && (eventjs[T](C, "gesture", this._onGesture), eventjs[T](C, "drag", this._onDrag), eventjs[T](C, "orientation", this._onOrientationChange), eventjs[T](C, "shake", this._onShake), eventjs[T](C, "longpress", this._onLongPress)); + }, + /** + * Removes all event listeners + */ + removeListeners: function() { + this.addOrRemove(d, "remove"); + var S = this._getEventPrefix(); + d(c.document, S + "up", this._onMouseUp), d(c.document, "touchend", this._onTouchEnd, x), d(c.document, S + "move", this._onMouseMove, x), d(c.document, "touchmove", this._onMouseMove, x); + }, + /** + * @private + */ + _bindEvents: function() { + this.eventsBound || (this._onMouseDown = this._onMouseDown.bind(this), this._onTouchStart = this._onTouchStart.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this), this._onTouchEnd = this._onTouchEnd.bind(this), this._onResize = this._onResize.bind(this), this._onGesture = this._onGesture.bind(this), this._onDrag = this._onDrag.bind(this), this._onShake = this._onShake.bind(this), this._onLongPress = this._onLongPress.bind(this), this._onOrientationChange = this._onOrientationChange.bind(this), this._onMouseWheel = this._onMouseWheel.bind(this), this._onMouseOut = this._onMouseOut.bind(this), this._onMouseEnter = this._onMouseEnter.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDoubleClick = this._onDoubleClick.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDragEnter = this._simpleEventHandler.bind(this, "dragenter"), this._onDragLeave = this._simpleEventHandler.bind(this, "dragleave"), this._onDrop = this._simpleEventHandler.bind(this, "drop"), this.eventsBound = !0); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js gesture + * @param {Event} [self] Inner Event object + */ + _onGesture: function(S, T) { + this.__onTransformGesture && this.__onTransformGesture(S, T); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js drag + * @param {Event} [self] Inner Event object + */ + _onDrag: function(S, T) { + this.__onDrag && this.__onDrag(S, T); + }, + /** + * @private + * @param {Event} [e] Event object fired on wheel event + */ + _onMouseWheel: function(S) { + this.__onMouseWheel(S); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseOut: function(S) { + var T = this._hoveredTarget; + this.fire("mouse:out", { target: T, e: S }), this._hoveredTarget = null, T && T.fire("mouseout", { e: S }); + var C = this; + this._hoveredTargets.forEach(function(E) { + C.fire("mouse:out", { target: T, e: S }), E && T.fire("mouseout", { e: S }); + }), this._hoveredTargets = [], this._iTextInstances && this._iTextInstances.forEach(function(E) { + E.isEditing && E.hiddenTextarea.focus(); + }); + }, + /** + * @private + * @param {Event} e Event object fired on mouseenter + */ + _onMouseEnter: function(S) { + !this._currentTransform && !this.findTarget(S) && (this.fire("mouse:over", { target: null, e: S }), this._hoveredTarget = null, this._hoveredTargets = []); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js orientation change + * @param {Event} [self] Inner Event object + */ + _onOrientationChange: function(S, T) { + this.__onOrientationChange && this.__onOrientationChange(S, T); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js shake + * @param {Event} [self] Inner Event object + */ + _onShake: function(S, T) { + this.__onShake && this.__onShake(S, T); + }, + /** + * @private + * @param {Event} [e] Event object fired on Event.js shake + * @param {Event} [self] Inner Event object + */ + _onLongPress: function(S, T) { + this.__onLongPress && this.__onLongPress(S, T); + }, + /** + * prevent default to allow drop event to be fired + * @private + * @param {Event} [e] Event object fired on Event.js shake + */ + _onDragOver: function(S) { + S.preventDefault(); + var T = this._simpleEventHandler("dragover", S); + this._fireEnterLeaveEvents(T, S); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onContextMenu: function(S) { + return this.stopContextMenu && (S.stopPropagation(), S.preventDefault()), !1; + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onDoubleClick: function(S) { + this._cacheTransformEventData(S), this._handleEvent(S, "dblclick"), this._resetTransformEventData(S); + }, + /** + * Return a the id of an event. + * returns either the pointerId or the identifier or 0 for the mouse event + * @private + * @param {Event} evt Event object + */ + getPointerId: function(S) { + var T = S.changedTouches; + return T ? T[0] && T[0].identifier : this.enablePointerEvents ? S.pointerId : -1; + }, + /** + * Determines if an event has the id of the event that is considered main + * @private + * @param {evt} event Event object + */ + _isMainEvent: function(S) { + return S.isPrimary === !0 ? !0 : S.isPrimary === !1 ? !1 : S.type === "touchend" && S.touches.length === 0 ? !0 : S.changedTouches ? S.changedTouches[0].identifier === this.mainTouchId : !0; + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onTouchStart: function(S) { + S.preventDefault(), this.mainTouchId === null && (this.mainTouchId = this.getPointerId(S)), this.__onMouseDown(S), this._resetTransformEventData(); + var T = this.upperCanvasEl, C = this._getEventPrefix(); + p(c.document, "touchend", this._onTouchEnd, x), p(c.document, "touchmove", this._onMouseMove, x), d(T, C + "down", this._onMouseDown); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseDown: function(S) { + this.__onMouseDown(S), this._resetTransformEventData(); + var T = this.upperCanvasEl, C = this._getEventPrefix(); + d(T, C + "move", this._onMouseMove, x), p(c.document, C + "up", this._onMouseUp), p(c.document, C + "move", this._onMouseMove, x); + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onTouchEnd: function(S) { + if (!(S.touches.length > 0)) { + this.__onMouseUp(S), this._resetTransformEventData(), this.mainTouchId = null; + var T = this._getEventPrefix(); + d(c.document, "touchend", this._onTouchEnd, x), d(c.document, "touchmove", this._onMouseMove, x); + var C = this; + this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(function() { + p(C.upperCanvasEl, T + "down", C._onMouseDown), C._willAddMouseDown = 0; + }, 400); + } + }, + /** + * @private + * @param {Event} e Event object fired on mouseup + */ + _onMouseUp: function(S) { + this.__onMouseUp(S), this._resetTransformEventData(); + var T = this.upperCanvasEl, C = this._getEventPrefix(); + this._isMainEvent(S) && (d(c.document, C + "up", this._onMouseUp), d(c.document, C + "move", this._onMouseMove, x), p(T, C + "move", this._onMouseMove, x)); + }, + /** + * @private + * @param {Event} e Event object fired on mousemove + */ + _onMouseMove: function(S) { + !this.allowTouchScrolling && S.preventDefault && S.preventDefault(), this.__onMouseMove(S); + }, + /** + * @private + */ + _onResize: function() { + this.calcOffset(); + }, + /** + * Decides whether the canvas should be redrawn in mouseup and mousedown events. + * @private + * @param {Object} target + */ + _shouldRender: function(S) { + var T = this._activeObject; + return !!T != !!S || T && S && T !== S ? !0 : (T && T.isEditing, !1); + }, + /** + * Method that defines the actions when mouse is released on canvas. + * The method resets the currentTransform parameters, store the image corner + * position in the image object and render the canvas on top. + * @private + * @param {Event} e Event object fired on mouseup + */ + __onMouseUp: function(S) { + var T, C = this._currentTransform, E = this._groupSelector, M = !1, P = !E || E.left === 0 && E.top === 0; + if (this._cacheTransformEventData(S), T = this._target, this._handleEvent(S, "up:before"), g(S, m)) { + this.fireRightClick && this._handleEvent(S, "up", m, P); + return; + } + if (g(S, _)) { + this.fireMiddleClick && this._handleEvent(S, "up", _, P), this._resetTransformEventData(); + return; + } + if (this.isDrawingMode && this._isCurrentlyDrawing) { + this._onMouseUpInDrawingMode(S); + return; + } + if (this._isMainEvent(S)) { + if (C && (this._finalizeCurrentTransform(S), M = C.actionPerformed), !P) { + var R = T === this._activeObject; + this._maybeGroupObjects(S), M || (M = this._shouldRender(T) || !R && T === this._activeObject); + } + if (T) { + if (T.selectable && T !== this._activeObject && T.activeOn === "up") + this.setActiveObject(T, S), M = !0; + else { + var N = T._findTargetCorner( + this.getPointer(S, !0), + c.util.isTouchEvent(S) + ), F = T.controls[N], U = F && F.getMouseUpHandler(S, T, F); + if (U) { + var $ = this.getPointer(S); + U(S, C, $.x, $.y); + } + } + T.isMoving = !1; + } + this._setCursorFromEvent(S, T), this._handleEvent(S, "up", y, P), this._groupSelector = null, this._currentTransform = null, T && (T.__corner = 0), M ? this.requestRenderAll() : P || this.renderTop(); + } + }, + /** + * @private + * Handle event firing for target and subtargets + * @param {Event} e event from mouse + * @param {String} eventType event to fire (up, down or move) + * @return {Fabric.Object} target return the the target found, for internal reasons. + */ + _simpleEventHandler: function(S, T) { + var C = this.findTarget(T), E = this.targets, M = { + e: T, + target: C, + subTargets: E + }; + if (this.fire(S, M), C && C.fire(S, M), !E) + return C; + for (var P = 0; P < E.length; P++) + E[P].fire(S, M); + return C; + }, + /** + * @private + * Handle event firing for target and subtargets + * @param {Event} e event from mouse + * @param {String} eventType event to fire (up, down or move) + * @param {fabric.Object} targetObj receiving event + * @param {Number} [button] button used in the event 1 = left, 2 = middle, 3 = right + * @param {Boolean} isClick for left button only, indicates that the mouse up happened without move. + */ + _handleEvent: function(S, T, C, E) { + var M = this._target, P = this.targets || [], R = { + e: S, + target: M, + subTargets: P, + button: C || y, + isClick: E || !1, + pointer: this._pointer, + absolutePointer: this._absolutePointer, + transform: this._currentTransform + }; + T === "up" && (R.currentTarget = this.findTarget(S), R.currentSubTargets = this.targets), this.fire("mouse:" + T, R), M && M.fire("mouse" + T, R); + for (var N = 0; N < P.length; N++) + P[N].fire("mouse" + T, R); + }, + /** + * @private + * @param {Event} e send the mouse event that generate the finalize down, so it can be used in the event + */ + _finalizeCurrentTransform: function(S) { + var T = this._currentTransform, C = T.target, E, M = { + e: S, + target: C, + transform: T, + action: T.action + }; + C._scaling && (C._scaling = !1), C.setCoords(), (T.actionPerformed || this.stateful && C.hasStateChanged()) && (T.actionPerformed && (E = this._addEventOptions(M, T), this._fire(E, M)), this._fire("modified", M)); + }, + /** + * Mutate option object in order to add by property and give back the event name. + * @private + * @deprecated since 4.2.0 + * @param {Object} options to mutate + * @param {Object} transform to inspect action from + */ + _addEventOptions: function(S, T) { + var C, E; + switch (T.action) { + case "scaleX": + C = "scaled", E = "x"; + break; + case "scaleY": + C = "scaled", E = "y"; + break; + case "skewX": + C = "skewed", E = "x"; + break; + case "skewY": + C = "skewed", E = "y"; + break; + case "scale": + C = "scaled", E = "equally"; + break; + case "rotate": + C = "rotated"; + break; + case "drag": + C = "moved"; + break; + } + return S.by = E, C; + }, + /** + * @private + * @param {Event} e Event object fired on mousedown + */ + _onMouseDownInDrawingMode: function(S) { + this._isCurrentlyDrawing = !0, this.getActiveObject() && this.discardActiveObject(S).requestRenderAll(); + var T = this.getPointer(S); + this.freeDrawingBrush.onMouseDown(T, { e: S, pointer: T }), this._handleEvent(S, "down"); + }, + /** + * @private + * @param {Event} e Event object fired on mousemove + */ + _onMouseMoveInDrawingMode: function(S) { + if (this._isCurrentlyDrawing) { + var T = this.getPointer(S); + this.freeDrawingBrush.onMouseMove(T, { e: S, pointer: T }); + } + this.setCursor(this.freeDrawingCursor), this._handleEvent(S, "move"); + }, + /** + * @private + * @param {Event} e Event object fired on mouseup + */ + _onMouseUpInDrawingMode: function(S) { + var T = this.getPointer(S); + this._isCurrentlyDrawing = this.freeDrawingBrush.onMouseUp({ e: S, pointer: T }), this._handleEvent(S, "up"); + }, + /** + * Method that defines the actions when mouse is clicked on canvas. + * The method inits the currentTransform parameters and renders all the + * canvas so the current image can be placed on the top canvas and the rest + * in on the container one. + * @private + * @param {Event} e Event object fired on mousedown + */ + __onMouseDown: function(S) { + this._cacheTransformEventData(S), this._handleEvent(S, "down:before"); + var T = this._target; + if (g(S, m)) { + this.fireRightClick && this._handleEvent(S, "down", m); + return; + } + if (g(S, _)) { + this.fireMiddleClick && this._handleEvent(S, "down", _); + return; + } + if (this.isDrawingMode) { + this._onMouseDownInDrawingMode(S); + return; + } + if (this._isMainEvent(S) && !this._currentTransform) { + var C = this._pointer; + this._previousPointer = C; + var E = this._shouldRender(T), M = this._shouldGroup(S, T); + if (this._shouldClearSelection(S, T) ? this.discardActiveObject(S) : M && (this._handleGrouping(S, T), T = this._activeObject), this.selection && (!T || !T.selectable && !T.isEditing && T !== this._activeObject) && (this._groupSelector = { + ex: this._absolutePointer.x, + ey: this._absolutePointer.y, + top: 0, + left: 0 + }), T) { + var P = T === this._activeObject; + T.selectable && T.activeOn === "down" && this.setActiveObject(T, S); + var R = T._findTargetCorner( + this.getPointer(S, !0), + c.util.isTouchEvent(S) + ); + if (T.__corner = R, T === this._activeObject && (R || !M)) { + this._setupCurrentTransform(S, T, P); + var N = T.controls[R], C = this.getPointer(S), F = N && N.getMouseDownHandler(S, T, N); + F && F(S, this._currentTransform, C.x, C.y); + } + } + this._handleEvent(S, "down"), (E || M) && this.requestRenderAll(); + } + }, + /** + * reset cache form common information needed during event processing + * @private + */ + _resetTransformEventData: function() { + this._target = null, this._pointer = null, this._absolutePointer = null; + }, + /** + * Cache common information needed during event processing + * @private + * @param {Event} e Event object fired on event + */ + _cacheTransformEventData: function(S) { + this._resetTransformEventData(), this._pointer = this.getPointer(S, !0), this._absolutePointer = this.restorePointerVpt(this._pointer), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(S) || null; + }, + /** + * @private + */ + _beforeTransform: function(S) { + var T = this._currentTransform; + this.stateful && T.target.saveState(), this.fire("before:transform", { + e: S, + transform: T + }); + }, + /** + * Method that defines the actions when mouse is hovering the canvas. + * The currentTransform parameter will define whether the user is rotating/scaling/translating + * an image or neither of them (only hovering). A group selection is also possible and would cancel + * all any other type of action. + * In case of an image transformation only the top canvas will be rendered. + * @private + * @param {Event} e Event object fired on mousemove + */ + __onMouseMove: function(S) { + this._handleEvent(S, "move:before"), this._cacheTransformEventData(S); + var T, C; + if (this.isDrawingMode) { + this._onMouseMoveInDrawingMode(S); + return; + } + if (this._isMainEvent(S)) { + var E = this._groupSelector; + E ? (C = this._absolutePointer, E.left = C.x - E.ex, E.top = C.y - E.ey, this.renderTop()) : this._currentTransform ? this._transformObject(S) : (T = this.findTarget(S) || null, this._setCursorFromEvent(S, T), this._fireOverOutEvents(T, S)), this._handleEvent(S, "move"), this._resetTransformEventData(); + } + }, + /** + * Manage the mouseout, mouseover events for the fabric object on the canvas + * @param {Fabric.Object} target the target where the target from the mousemove event + * @param {Event} e Event object fired on mousemove + * @private + */ + _fireOverOutEvents: function(S, T) { + var C = this._hoveredTarget, E = this._hoveredTargets, M = this.targets, P = Math.max(E.length, M.length); + this.fireSyntheticInOutEvents(S, T, { + oldTarget: C, + evtOut: "mouseout", + canvasEvtOut: "mouse:out", + evtIn: "mouseover", + canvasEvtIn: "mouse:over" + }); + for (var R = 0; R < P; R++) + this.fireSyntheticInOutEvents(M[R], T, { + oldTarget: E[R], + evtOut: "mouseout", + evtIn: "mouseover" + }); + this._hoveredTarget = S, this._hoveredTargets = this.targets.concat(); + }, + /** + * Manage the dragEnter, dragLeave events for the fabric objects on the canvas + * @param {Fabric.Object} target the target where the target from the onDrag event + * @param {Event} e Event object fired on ondrag + * @private + */ + _fireEnterLeaveEvents: function(S, T) { + var C = this._draggedoverTarget, E = this._hoveredTargets, M = this.targets, P = Math.max(E.length, M.length); + this.fireSyntheticInOutEvents(S, T, { + oldTarget: C, + evtOut: "dragleave", + evtIn: "dragenter" + }); + for (var R = 0; R < P; R++) + this.fireSyntheticInOutEvents(M[R], T, { + oldTarget: E[R], + evtOut: "dragleave", + evtIn: "dragenter" + }); + this._draggedoverTarget = S; + }, + /** + * Manage the synthetic in/out events for the fabric objects on the canvas + * @param {Fabric.Object} target the target where the target from the supported events + * @param {Event} e Event object fired + * @param {Object} config configuration for the function to work + * @param {String} config.targetName property on the canvas where the old target is stored + * @param {String} [config.canvasEvtOut] name of the event to fire at canvas level for out + * @param {String} config.evtOut name of the event to fire for out + * @param {String} [config.canvasEvtIn] name of the event to fire at canvas level for in + * @param {String} config.evtIn name of the event to fire for in + * @private + */ + fireSyntheticInOutEvents: function(S, T, C) { + var E, M, P = C.oldTarget, R, N, F = P !== S, U = C.canvasEvtIn, $ = C.canvasEvtOut; + F && (E = { e: T, target: S, previousTarget: P }, M = { e: T, target: P, nextTarget: S }), N = S && F, R = P && F, R && ($ && this.fire($, M), P.fire(C.evtOut, M)), N && (U && this.fire(U, E), S.fire(C.evtIn, E)); + }, + /** + * Method that defines actions when an Event Mouse Wheel + * @param {Event} e Event object fired on mouseup + */ + __onMouseWheel: function(S) { + this._cacheTransformEventData(S), this._handleEvent(S, "wheel"), this._resetTransformEventData(); + }, + /** + * @private + * @param {Event} e Event fired on mousemove + */ + _transformObject: function(S) { + var T = this.getPointer(S), C = this._currentTransform; + C.reset = !1, C.shiftKey = S.shiftKey, C.altKey = S[this.centeredKey], this._performTransformAction(S, C, T), C.actionPerformed && this.requestRenderAll(); + }, + /** + * @private + */ + _performTransformAction: function(S, T, C) { + var E = C.x, M = C.y, P = T.action, R = !1, N = T.actionHandler; + N && (R = N(S, T, E, M)), P === "drag" && R && (T.target.isMoving = !0, this.setCursor(T.target.moveCursor || this.moveCursor)), T.actionPerformed = T.actionPerformed || R; + }, + /** + * @private + */ + _fire: c.controlsUtils.fireEvent, + /** + * Sets the cursor depending on where the canvas is being hovered. + * Note: very buggy in Opera + * @param {Event} e Event object + * @param {Object} target Object that the mouse is hovering, if so. + */ + _setCursorFromEvent: function(S, T) { + if (!T) + return this.setCursor(this.defaultCursor), !1; + var C = T.hoverCursor || this.hoverCursor, E = this._activeObject && this._activeObject.type === "activeSelection" ? this._activeObject : null, M = (!E || !E.contains(T)) && T._findTargetCorner(this.getPointer(S, !0)); + M ? this.setCursor(this.getCornerCursor(M, T, S)) : (T.subTargetCheck && this.targets.concat().reverse().map(function(P) { + C = P.hoverCursor || C; + }), this.setCursor(C)); + }, + /** + * @private + */ + getCornerCursor: function(S, T, C) { + var E = T.controls[S]; + return E.cursorStyleHandler(C, E, T); + } + } + ); + }(), function() { + var p = Math.min, d = Math.max; + c.util.object.extend( + c.Canvas.prototype, + /** @lends fabric.Canvas.prototype */ + { + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + * @return {Boolean} + */ + _shouldGroup: function(m, _) { + var y = this._activeObject; + return y && this._isSelectionKeyPressed(m) && _ && _.selectable && this.selection && (y !== _ || y.type === "activeSelection") && !_.onSelect({ e: m }); + }, + /** + * @private + * @param {Event} e Event object + * @param {fabric.Object} target + */ + _handleGrouping: function(m, _) { + var y = this._activeObject; + y.__corner || _ === y && (_ = this.findTarget(m, !0), !_ || !_.selectable) || (y && y.type === "activeSelection" ? this._updateActiveSelection(_, m) : this._createActiveSelection(_, m)); + }, + /** + * @private + */ + _updateActiveSelection: function(m, _) { + var y = this._activeObject, x = y._objects.slice(0); + y.contains(m) ? (y.removeWithUpdate(m), this._hoveredTarget = m, this._hoveredTargets = this.targets.concat(), y.size() === 1 && this._setActiveObject(y.item(0), _)) : (y.addWithUpdate(m), this._hoveredTarget = y, this._hoveredTargets = this.targets.concat()), this._fireSelectionEvents(x, _); + }, + /** + * @private + */ + _createActiveSelection: function(m, _) { + var y = this.getActiveObjects(), x = this._createGroup(m); + this._hoveredTarget = x, this._setActiveObject(x, _), this._fireSelectionEvents(y, _); + }, + /** + * @private + * @param {Object} target + */ + _createGroup: function(m) { + var _ = this._objects, y = _.indexOf(this._activeObject) < _.indexOf(m), x = y ? [this._activeObject, m] : [m, this._activeObject]; + return this._activeObject.isEditing && this._activeObject.exitEditing(), new c.ActiveSelection(x, { + canvas: this + }); + }, + /** + * @private + * @param {Event} e mouse event + */ + _groupSelectedObjects: function(m) { + var _ = this._collectObjects(m), y; + _.length === 1 ? this.setActiveObject(_[0], m) : _.length > 1 && (y = new c.ActiveSelection(_.reverse(), { + canvas: this + }), this.setActiveObject(y, m)); + }, + /** + * @private + */ + _collectObjects: function(m) { + for (var _ = [], y, x = this._groupSelector.ex, g = this._groupSelector.ey, S = x + this._groupSelector.left, T = g + this._groupSelector.top, C = new c.Point(p(x, S), p(g, T)), E = new c.Point(d(x, S), d(g, T)), M = !this.selectionFullyContained, P = x === S && g === T, R = this._objects.length; R-- && (y = this._objects[R], !(!(!y || !y.selectable || !y.visible) && (M && y.intersectsWithRect(C, E, !0) || y.isContainedWithinRect(C, E, !0) || M && y.containsPoint(C, null, !0) || M && y.containsPoint(E, null, !0)) && (_.push(y), P))); ) + ; + return _.length > 1 && (_ = _.filter(function(N) { + return !N.onSelect({ e: m }); + })), _; + }, + /** + * @private + */ + _maybeGroupObjects: function(m) { + this.selection && this._groupSelector && this._groupSelectedObjects(m), this.setCursor(this.defaultCursor), this._groupSelector = null; + } + } + ); + }(), function() { + c.util.object.extend( + c.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately + * @param {Object} [options] Options object + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by, to have consistent + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 2.0.0 + * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format + * @see {@link http://jsfiddle.net/fabricjs/NfZVb/|jsFiddle demo} + * @example Generate jpeg dataURL with lower quality + * var dataURL = canvas.toDataURL({ + * format: 'jpeg', + * quality: 0.8 + * }); + * @example Generate cropped png dataURL (clipping of canvas) + * var dataURL = canvas.toDataURL({ + * format: 'png', + * left: 100, + * top: 100, + * width: 200, + * height: 200 + * }); + * @example Generate double scaled png dataURL + * var dataURL = canvas.toDataURL({ + * format: 'png', + * multiplier: 2 + * }); + */ + toDataURL: function(p) { + p || (p = {}); + var d = p.format || "png", m = p.quality || 1, _ = (p.multiplier || 1) * (p.enableRetinaScaling ? this.getRetinaScaling() : 1), y = this.toCanvasElement(_, p); + return c.util.toDataURL(y, d, m); + }, + /** + * Create a new HTMLCanvas element painted with the current canvas content. + * No need to resize the actual one or repaint it. + * Will transfer object ownership to a new canvas, paint it, and set everything back. + * This is an intermediary step used to get to a dataUrl but also it is useful to + * create quick image copies of a canvas without passing for the dataUrl string + * @param {Number} [multiplier] a zoom factor. + * @param {Object} [cropping] Cropping informations + * @param {Number} [cropping.left] Cropping left offset. + * @param {Number} [cropping.top] Cropping top offset. + * @param {Number} [cropping.width] Cropping width. + * @param {Number} [cropping.height] Cropping height. + */ + toCanvasElement: function(p, d) { + p = p || 1, d = d || {}; + var m = (d.width || this.width) * p, _ = (d.height || this.height) * p, y = this.getZoom(), x = this.width, g = this.height, S = y * p, T = this.viewportTransform, C = (T[4] - (d.left || 0)) * p, E = (T[5] - (d.top || 0)) * p, M = this.interactive, P = [S, 0, 0, S, C, E], R = this.enableRetinaScaling, N = c.util.createCanvasElement(), F = this.contextTop; + return N.width = m, N.height = _, this.contextTop = null, this.enableRetinaScaling = !1, this.interactive = !1, this.viewportTransform = P, this.width = m, this.height = _, this.calcViewportBoundaries(), this.renderCanvas(N.getContext("2d"), this._objects), this.viewportTransform = T, this.width = x, this.height = g, this.calcViewportBoundaries(), this.interactive = M, this.enableRetinaScaling = R, this.contextTop = F, N; + } + } + ); + }(), c.util.object.extend( + c.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Populates canvas with data from the specified JSON. + * JSON format must conform to the one of {@link fabric.Canvas#toJSON} + * @param {String|Object} json JSON string or object + * @param {Function} callback Callback, invoked when json is parsed + * and corresponding objects (e.g: {@link fabric.Image}) + * are initialized + * @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created. + * @return {fabric.Canvas} instance + * @chainable + * @tutorial {@link http://fabricjs.com/fabric-intro-part-3#deserialization} + * @see {@link http://jsfiddle.net/fabricjs/fmgXt/|jsFiddle demo} + * @example loadFromJSON + * canvas.loadFromJSON(json, canvas.renderAll.bind(canvas)); + * @example loadFromJSON with reviver + * canvas.loadFromJSON(json, canvas.renderAll.bind(canvas), function(o, object) { + * // `o` = json object + * // `object` = fabric.Object instance + * // ... do some stuff ... + * }); + */ + loadFromJSON: function(p, d, m) { + if (p) { + var _ = typeof p == "string" ? JSON.parse(p) : c.util.object.clone(p), y = this, x = _.clipPath, g = this.renderOnAddRemove; + return this.renderOnAddRemove = !1, delete _.clipPath, this._enlivenObjects(_.objects, function(S) { + y.clear(), y._setBgOverlay(_, function() { + x ? y._enlivenObjects([x], function(T) { + y.clipPath = T[0], y.__setupCanvas.call(y, _, S, g, d); + }) : y.__setupCanvas.call(y, _, S, g, d); + }); + }, m), this; + } + }, + /** + * @private + * @param {Object} serialized Object with background and overlay information + * @param {Array} restored canvas objects + * @param {Function} cached renderOnAddRemove callback + * @param {Function} callback Invoked after all background and overlay images/patterns loaded + */ + __setupCanvas: function(p, d, m, _) { + var y = this; + d.forEach(function(x, g) { + y.insertAt(x, g); + }), this.renderOnAddRemove = m, delete p.objects, delete p.backgroundImage, delete p.overlayImage, delete p.background, delete p.overlay, this._setOptions(p), this.renderAll(), _ && _(); + }, + /** + * @private + * @param {Object} serialized Object with background and overlay information + * @param {Function} callback Invoked after all background and overlay images/patterns loaded + */ + _setBgOverlay: function(p, d) { + var m = { + backgroundColor: !1, + overlayColor: !1, + backgroundImage: !1, + overlayImage: !1 + }; + if (!p.backgroundImage && !p.overlayImage && !p.background && !p.overlay) { + d && d(); + return; + } + var _ = function() { + m.backgroundImage && m.overlayImage && m.backgroundColor && m.overlayColor && d && d(); + }; + this.__setBgOverlay("backgroundImage", p.backgroundImage, m, _), this.__setBgOverlay("overlayImage", p.overlayImage, m, _), this.__setBgOverlay("backgroundColor", p.background, m, _), this.__setBgOverlay("overlayColor", p.overlay, m, _); + }, + /** + * @private + * @param {String} property Property to set (backgroundImage, overlayImage, backgroundColor, overlayColor) + * @param {(Object|String)} value Value to set + * @param {Object} loaded Set loaded property to true if property is set + * @param {Object} callback Callback function to invoke after property is set + */ + __setBgOverlay: function(p, d, m, _) { + var y = this; + if (!d) { + m[p] = !0, _ && _(); + return; + } + p === "backgroundImage" || p === "overlayImage" ? c.util.enlivenObjects([d], function(x) { + y[p] = x[0], m[p] = !0, _ && _(); + }) : this["set" + c.util.string.capitalize(p, !0)](d, function() { + m[p] = !0, _ && _(); + }); + }, + /** + * @private + * @param {Array} objects + * @param {Function} callback + * @param {Function} [reviver] + */ + _enlivenObjects: function(p, d, m) { + if (!p || p.length === 0) { + d && d([]); + return; + } + c.util.enlivenObjects(p, function(_) { + d && d(_); + }, null, m); + }, + /** + * @private + * @param {String} format + * @param {Function} callback + */ + _toDataURL: function(p, d) { + this.clone(function(m) { + d(m.toDataURL(p)); + }); + }, + /** + * @private + * @param {String} format + * @param {Number} multiplier + * @param {Function} callback + */ + _toDataURLWithMultiplier: function(p, d, m) { + this.clone(function(_) { + m(_.toDataURLWithMultiplier(p, d)); + }); + }, + /** + * Clones canvas instance + * @param {Object} [callback] Receives cloned instance as a first argument + * @param {Array} [properties] Array of properties to include in the cloned canvas and children + */ + clone: function(p, d) { + var m = JSON.stringify(this.toJSON(d)); + this.cloneWithoutData(function(_) { + _.loadFromJSON(m, function() { + p && p(_); + }); + }); + }, + /** + * Clones canvas instance without cloning existing data. + * This essentially copies canvas dimensions, clipping properties, etc. + * but leaves data empty (so that you can populate it with your own) + * @param {Object} [callback] Receives cloned instance as a first argument + */ + cloneWithoutData: function(p) { + var d = c.util.createCanvasElement(); + d.width = this.width, d.height = this.height; + var m = new c.Canvas(d); + this.backgroundImage ? (m.setBackgroundImage(this.backgroundImage.src, function() { + m.renderAll(), p && p(m); + }), m.backgroundImageOpacity = this.backgroundImageOpacity, m.backgroundImageStretch = this.backgroundImageStretch) : p && p(m); + } + } + ), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.util.object.clone, y = d.util.toFixed, x = d.util.string.capitalize, g = d.util.degreesToRadians, S = !d.isLikelyNode, T = 2; + d.Object || (d.Object = d.util.createClass( + d.CommonMethods, + /** @lends fabric.Object.prototype */ + { + /** + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + * @type String + * @default + */ + type: "object", + /** + * Horizontal origin of transformation of an object (one of "left", "right", "center") + * See http://jsfiddle.net/1ow02gea/244/ on how originX/originY affect objects in groups + * @type String + * @default + */ + originX: "left", + /** + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + * See http://jsfiddle.net/1ow02gea/244/ on how originX/originY affect objects in groups + * @type String + * @default + */ + originY: "top", + /** + * Top position of an object. Note that by default it's relative to object top. You can change this by setting originY={top/center/bottom} + * @type Number + * @default + */ + top: 0, + /** + * Left position of an object. Note that by default it's relative to object left. You can change this by setting originX={left/center/right} + * @type Number + * @default + */ + left: 0, + /** + * Object width + * @type Number + * @default + */ + width: 0, + /** + * Object height + * @type Number + * @default + */ + height: 0, + /** + * Object scale factor (horizontal) + * @type Number + * @default + */ + scaleX: 1, + /** + * Object scale factor (vertical) + * @type Number + * @default + */ + scaleY: 1, + /** + * When true, an object is rendered as flipped horizontally + * @type Boolean + * @default + */ + flipX: !1, + /** + * When true, an object is rendered as flipped vertically + * @type Boolean + * @default + */ + flipY: !1, + /** + * Opacity of an object + * @type Number + * @default + */ + opacity: 1, + /** + * Angle of rotation of an object (in degrees) + * @type Number + * @default + */ + angle: 0, + /** + * Angle of skew on x axes of an object (in degrees) + * @type Number + * @default + */ + skewX: 0, + /** + * Angle of skew on y axes of an object (in degrees) + * @type Number + * @default + */ + skewY: 0, + /** + * Size of object's controlling corners (in pixels) + * @type Number + * @default + */ + cornerSize: 13, + /** + * Size of object's controlling corners when touch interaction is detected + * @type Number + * @default + */ + touchCornerSize: 24, + /** + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + * @type Boolean + * @default + */ + transparentCorners: !0, + /** + * Default cursor value used when hovering over this object on canvas + * @type String + * @default + */ + hoverCursor: null, + /** + * Default cursor value used when moving this object on canvas + * @type String + * @default + */ + moveCursor: null, + /** + * Padding between object and its controlling borders (in pixels) + * @type Number + * @default + */ + padding: 0, + /** + * Color of controlling borders of an object (when it's active) + * @type String + * @default + */ + borderColor: "rgb(178,204,255)", + /** + * Array specifying dash pattern of an object's borders (hasBorder must be true) + * @since 1.6.2 + * @type Array + */ + borderDashArray: null, + /** + * Color of controlling corners of an object (when it's active) + * @type String + * @default + */ + cornerColor: "rgb(178,204,255)", + /** + * Color of controlling corners of an object (when it's active and transparentCorners false) + * @since 1.6.2 + * @type String + * @default + */ + cornerStrokeColor: null, + /** + * Specify style of control, 'rect' or 'circle' + * @since 1.6.2 + * @type String + */ + cornerStyle: "rect", + /** + * Array specifying dash pattern of an object's control (hasBorder must be true) + * @since 1.6.2 + * @type Array + */ + cornerDashArray: null, + /** + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredScaling: !1, + /** + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + * @since 1.3.4 + * @type Boolean + * @default + */ + centeredRotation: !0, + /** + * Color of object's fill + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + fill: "rgb(0,0,0)", + /** + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) + * @type String + * @default + */ + fillRule: "nonzero", + /** + * Composite rule used for canvas globalCompositeOperation + * @type String + * @default + */ + globalCompositeOperation: "source-over", + /** + * Background color of an object. + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + backgroundColor: "", + /** + * Selection Background color of an object. colored layer behind the object when it is active. + * does not mix good with globalCompositeOperation methods. + * @type String + * @default + */ + selectionBackgroundColor: "", + /** + * When defined, an object is rendered via stroke and this property specifies its color + * takes css colors https://www.w3.org/TR/css-color-3/ + * @type String + * @default + */ + stroke: null, + /** + * Width of a stroke used to render this object + * @type Number + * @default + */ + strokeWidth: 1, + /** + * Array specifying dash pattern of an object's stroke (stroke must be defined) + * @type Array + */ + strokeDashArray: null, + /** + * Line offset of an object's stroke + * @type Number + * @default + */ + strokeDashOffset: 0, + /** + * Line endings style of an object's stroke (one of "butt", "round", "square") + * @type String + * @default + */ + strokeLineCap: "butt", + /** + * Corner style of an object's stroke (one of "bevel", "round", "miter") + * @type String + * @default + */ + strokeLineJoin: "miter", + /** + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + * @type Number + * @default + */ + strokeMiterLimit: 4, + /** + * Shadow object representing shadow of this shape + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * Opacity of object's controlling borders when object is active and moving + * @type Number + * @default + */ + borderOpacityWhenMoving: 0.4, + /** + * Scale factor of object's controlling borders + * bigger number will make a thicker border + * border is 1, so this is basically a border thickness + * since there is no way to change the border itself. + * @type Number + * @default + */ + borderScaleFactor: 1, + /** + * Minimum allowed scale value of an object + * @type Number + * @default + */ + minScaleLimit: 0, + /** + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + * @type Boolean + * @default + */ + selectable: !0, + /** + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + * @type Boolean + * @default + */ + evented: !0, + /** + * When set to `false`, an object is not rendered on canvas + * @type Boolean + * @default + */ + visible: !0, + /** + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + * @type Boolean + * @default + */ + hasControls: !0, + /** + * When set to `false`, object's controlling borders are not rendered + * @type Boolean + * @default + */ + hasBorders: !0, + /** + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + * @type Boolean + * @default + */ + perPixelTargetFind: !1, + /** + * When `false`, default object's values are not included in its serialization + * @type Boolean + * @default + */ + includeDefaultValues: !0, + /** + * When `true`, object horizontal movement is locked + * @type Boolean + * @default + */ + lockMovementX: !1, + /** + * When `true`, object vertical movement is locked + * @type Boolean + * @default + */ + lockMovementY: !1, + /** + * When `true`, object rotation is locked + * @type Boolean + * @default + */ + lockRotation: !1, + /** + * When `true`, object horizontal scaling is locked + * @type Boolean + * @default + */ + lockScalingX: !1, + /** + * When `true`, object vertical scaling is locked + * @type Boolean + * @default + */ + lockScalingY: !1, + /** + * When `true`, object horizontal skewing is locked + * @type Boolean + * @default + */ + lockSkewingX: !1, + /** + * When `true`, object vertical skewing is locked + * @type Boolean + * @default + */ + lockSkewingY: !1, + /** + * When `true`, object cannot be flipped by scaling into negative values + * @type Boolean + * @default + */ + lockScalingFlip: !1, + /** + * When `true`, object is not exported in OBJECT/JSON + * @since 1.6.3 + * @type Boolean + * @default + */ + excludeFromExport: !1, + /** + * When `true`, object is cached on an additional canvas. + * When `false`, object is not cached unless necessary ( clipPath ) + * default to true + * @since 1.7.0 + * @type Boolean + * @default true + */ + objectCaching: S, + /** + * When `true`, object properties are checked for cache invalidation. In some particular + * situation you may want this to be disabled ( spray brush, very big, groups) + * or if your application does not allow you to modify properties for groups child you want + * to disable it for groups. + * default to false + * since 1.7.0 + * @type Boolean + * @default false + */ + statefullCache: !1, + /** + * When `true`, cache does not get updated during scaling. The picture will get blocky if scaled + * too much and will be redrawn with correct details at the end of scaling. + * this setting is performance and application dependant. + * default to true + * since 1.7.0 + * @type Boolean + * @default true + */ + noScaleCache: !0, + /** + * When `false`, the stoke width will scale with the object. + * When `true`, the stroke will always match the exact pixel size entered for stroke width. + * default to false + * @since 2.6.0 + * @type Boolean + * @default false + * @type Boolean + * @default false + */ + strokeUniform: !1, + /** + * When set to `true`, object's cache will be rerendered next render call. + * since 1.7.0 + * @type Boolean + * @default true + */ + dirty: !0, + /** + * keeps the value of the last hovered corner during mouse move. + * 0 is no corner, or 'mt', 'ml', 'mtr' etc.. + * It should be private, but there is no harm in using it as + * a read-only property. + * @type number|string|any + * @default 0 + */ + __corner: 0, + /** + * Determines if the fill or the stroke is drawn first (one of "fill" or "stroke") + * @type String + * @default + */ + paintFirst: "fill", + /** + * When 'down', object is set to active on mousedown/touchstart + * When 'up', object is set to active on mouseup/touchend + * Experimental. Let's see if this breaks anything before supporting officially + * @private + * since 4.4.0 + * @type String + * @default 'down' + */ + activeOn: "down", + /** + * List of properties to consider when checking if state + * of an object is changed (fabric.Object#hasStateChanged) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: "top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "), + /** + * List of properties to consider when checking if cache needs refresh + * Those properties are checked by statefullCache ON ( or lazy mode if we want ) or from single + * calls to Object.set(key, value). If the key is in this list, the object is marked as dirty + * and refreshed at the next render + * @type Array + */ + cacheProperties: "fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "), + /** + * List of properties to consider for animating colors. + * @type Array + */ + colorProperties: "fill stroke backgroundColor".split(" "), + /** + * a fabricObject that, without stroke define a clipping area with their shape. filled in black + * the clipPath object gets used when the object has rendered, and the context is placed in the center + * of the object cacheCanvas. + * If you want 0,0 of a clipPath to align with an object center, use clipPath.originX/Y to 'center' + * @type fabric.Object + */ + clipPath: void 0, + /** + * Meaningful ONLY when the object is used as clipPath. + * if true, the clipPath will make the object clip to the outside of the clipPath + * since 2.4.0 + * @type boolean + * @default false + */ + inverted: !1, + /** + * Meaningful ONLY when the object is used as clipPath. + * if true, the clipPath will have its top and left relative to canvas, and will + * not be influenced by the object transform. This will make the clipPath relative + * to the canvas, but clipping just a particular object. + * WARNING this is beta, this feature may change or be renamed. + * since 2.4.0 + * @type boolean + * @default false + */ + absolutePositioned: !1, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(C) { + C && this.setOptions(C); + }, + /** + * Create a the canvas used to keep the cached copy of the object + * @private + */ + _createCacheCanvas: function() { + this._cacheProperties = {}, this._cacheCanvas = d.util.createCanvasElement(), this._cacheContext = this._cacheCanvas.getContext("2d"), this._updateCacheCanvas(), this.dirty = !0; + }, + /** + * Limit the cache dimensions so that X * Y do not cross fabric.perfLimitSizeTotal + * and each side do not cross fabric.cacheSideLimit + * those numbers are configurable so that you can get as much detail as you want + * making bargain with performances. + * @param {Object} dims + * @param {Object} dims.width width of canvas + * @param {Object} dims.height height of canvas + * @param {Object} dims.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @param {Object} dims.zoomY zoomY zoom value to unscale the canvas before drawing cache + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _limitCacheSize: function(C) { + var E = d.perfLimitSizeTotal, M = C.width, P = C.height, R = d.maxCacheSideLimit, N = d.minCacheSideLimit; + if (M <= R && P <= R && M * P <= E) + return M < N && (C.width = N), P < N && (C.height = N), C; + var F = M / P, U = d.util.limitDimsByArea(F, E), $ = d.util.capValue, G = $(N, U.x, R), Q = $(N, U.y, R); + return M > G && (C.zoomX /= M / G, C.width = G, C.capped = !0), P > Q && (C.zoomY /= P / Q, C.height = Q, C.capped = !0), C; + }, + /** + * Return the dimension and the zoom level needed to create a cache canvas + * big enough to host the object to be cached. + * @private + * @return {Object}.x width of object to be cached + * @return {Object}.y height of object to be cached + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _getCacheCanvasDimensions: function() { + var C = this.getTotalObjectScaling(), E = this._getTransformedDimensions(0, 0), M = E.x * C.scaleX / this.scaleX, P = E.y * C.scaleY / this.scaleY; + return { + // for sure this ALIASING_LIMIT is slightly creating problem + // in situation in which the cache canvas gets an upper limit + // also objectScale contains already scaleX and scaleY + width: M + T, + height: P + T, + zoomX: C.scaleX, + zoomY: C.scaleY, + x: M, + y: P + }; + }, + /** + * Update width and height of the canvas for cache + * returns true or false if canvas needed resize. + * @private + * @return {Boolean} true if the canvas has been resized + */ + _updateCacheCanvas: function() { + var C = this.canvas; + if (this.noScaleCache && C && C._currentTransform) { + var E = C._currentTransform.target, M = C._currentTransform.action; + if (this === E && M.slice && M.slice(0, 5) === "scale") + return !1; + } + var P = this._cacheCanvas, R = this._limitCacheSize(this._getCacheCanvasDimensions()), N = d.minCacheSideLimit, F = R.width, U = R.height, $, G, Q = R.zoomX, ee = R.zoomY, ce = F !== this.cacheWidth || U !== this.cacheHeight, ne = this.zoomX !== Q || this.zoomY !== ee, fe = ce || ne, K = 0, Oe = 0, xe = !1; + if (ce) { + var Ge = this._cacheCanvas.width, oe = this._cacheCanvas.height, de = F > Ge || U > oe, se = (F < Ge * 0.9 || U < oe * 0.9) && Ge > N && oe > N; + xe = de || se, de && !R.capped && (F > N || U > N) && (K = F * 0.1, Oe = U * 0.1); + } + return this instanceof d.Text && this.path && (fe = !0, xe = !0, K += this.getHeightOfLine(0) * this.zoomX, Oe += this.getHeightOfLine(0) * this.zoomY), fe ? (xe ? (P.width = Math.ceil(F + K), P.height = Math.ceil(U + Oe)) : (this._cacheContext.setTransform(1, 0, 0, 1, 0, 0), this._cacheContext.clearRect(0, 0, P.width, P.height)), $ = R.x / 2, G = R.y / 2, this.cacheTranslationX = Math.round(P.width / 2 - $) + $, this.cacheTranslationY = Math.round(P.height / 2 - G) + G, this.cacheWidth = F, this.cacheHeight = U, this._cacheContext.translate(this.cacheTranslationX, this.cacheTranslationY), this._cacheContext.scale(Q, ee), this.zoomX = Q, this.zoomY = ee, !0) : !1; + }, + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions: function(C) { + this._setOptions(C), this._initGradient(C.fill, "fill"), this._initGradient(C.stroke, "stroke"), this._initPattern(C.fill, "fill"), this._initPattern(C.stroke, "stroke"); + }, + /** + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + */ + transform: function(C) { + var E = this.group && !this.group._transformDone || this.group && this.canvas && C === this.canvas.contextTop, M = this.calcTransformMatrix(!E); + C.transform(M[0], M[1], M[2], M[3], M[4], M[5]); + }, + /** + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(C) { + var E = d.Object.NUM_FRACTION_DIGITS, M = { + type: this.type, + version: d.version, + originX: this.originX, + originY: this.originY, + left: y(this.left, E), + top: y(this.top, E), + width: y(this.width, E), + height: y(this.height, E), + fill: this.fill && this.fill.toObject ? this.fill.toObject() : this.fill, + stroke: this.stroke && this.stroke.toObject ? this.stroke.toObject() : this.stroke, + strokeWidth: y(this.strokeWidth, E), + strokeDashArray: this.strokeDashArray ? this.strokeDashArray.concat() : this.strokeDashArray, + strokeLineCap: this.strokeLineCap, + strokeDashOffset: this.strokeDashOffset, + strokeLineJoin: this.strokeLineJoin, + strokeUniform: this.strokeUniform, + strokeMiterLimit: y(this.strokeMiterLimit, E), + scaleX: y(this.scaleX, E), + scaleY: y(this.scaleY, E), + angle: y(this.angle, E), + flipX: this.flipX, + flipY: this.flipY, + opacity: y(this.opacity, E), + shadow: this.shadow && this.shadow.toObject ? this.shadow.toObject() : this.shadow, + visible: this.visible, + backgroundColor: this.backgroundColor, + fillRule: this.fillRule, + paintFirst: this.paintFirst, + globalCompositeOperation: this.globalCompositeOperation, + skewX: y(this.skewX, E), + skewY: y(this.skewY, E) + }; + return this.clipPath && !this.clipPath.excludeFromExport && (M.clipPath = this.clipPath.toObject(C), M.clipPath.inverted = this.clipPath.inverted, M.clipPath.absolutePositioned = this.clipPath.absolutePositioned), d.util.populateWithProperties(this, M, C), this.includeDefaultValues || (M = this._removeDefaultValues(M)), M; + }, + /** + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toDatalessObject: function(C) { + return this.toObject(C); + }, + /** + * @private + * @param {Object} object + */ + _removeDefaultValues: function(C) { + var E = d.util.getKlass(C.type).prototype, M = E.stateProperties; + return M.forEach(function(P) { + if (!(P === "left" || P === "top")) { + C[P] === E[P] && delete C[P]; + var R = Object.prototype.toString.call(C[P]) === "[object Array]" && Object.prototype.toString.call(E[P]) === "[object Array]"; + R && C[P].length === 0 && E[P].length === 0 && delete C[P]; + } + }), C; + }, + /** + * Returns a string representation of an instance + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Return the object scale factor counting also the group scaling + * @return {Object} object with scaleX and scaleY properties + */ + getObjectScaling: function() { + if (!this.group) + return { + scaleX: this.scaleX, + scaleY: this.scaleY + }; + var C = d.util.qrDecompose(this.calcTransformMatrix()); + return { scaleX: Math.abs(C.scaleX), scaleY: Math.abs(C.scaleY) }; + }, + /** + * Return the object scale factor counting also the group scaling, zoom and retina + * @return {Object} object with scaleX and scaleY properties + */ + getTotalObjectScaling: function() { + var C = this.getObjectScaling(), E = C.scaleX, M = C.scaleY; + if (this.canvas) { + var P = this.canvas.getZoom(), R = this.canvas.getRetinaScaling(); + E *= P * R, M *= P * R; + } + return { scaleX: E, scaleY: M }; + }, + /** + * Return the object opacity counting also the group property + * @return {Number} + */ + getObjectOpacity: function() { + var C = this.opacity; + return this.group && (C *= this.group.getObjectOpacity()), C; + }, + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Object} thisArg + */ + _set: function(C, E) { + var M = C === "scaleX" || C === "scaleY", P = this[C] !== E, R = !1; + return M && (E = this._constrainScale(E)), C === "scaleX" && E < 0 ? (this.flipX = !this.flipX, E *= -1) : C === "scaleY" && E < 0 ? (this.flipY = !this.flipY, E *= -1) : C === "shadow" && E && !(E instanceof d.Shadow) ? E = new d.Shadow(E) : C === "dirty" && this.group && this.group.set("dirty", E), this[C] = E, P && (R = this.group && this.group.isOnACache(), this.cacheProperties.indexOf(C) > -1 ? (this.dirty = !0, R && this.group.set("dirty", !0)) : R && this.stateProperties.indexOf(C) > -1 && this.group.set("dirty", !0)), this; + }, + /** + * This callback function is called by the parent group of an object every + * time a non-delegated property changes on the group. It is passed the key + * and value as parameters. Not adding in this function's signature to avoid + * Travis build error about unused variables. + */ + setOnGroup: function() { + }, + /** + * Retrieves viewportTransform from Object's canvas if possible + * @method getViewportTransform + * @memberOf fabric.Object.prototype + * @return {Array} + */ + getViewportTransform: function() { + return this.canvas && this.canvas.viewportTransform ? this.canvas.viewportTransform : d.iMatrix.concat(); + }, + /* + * @private + * return if the object would be visible in rendering + * @memberOf fabric.Object.prototype + * @return {Boolean} + */ + isNotVisible: function() { + return this.opacity === 0 || !this.width && !this.height && this.strokeWidth === 0 || !this.visible; + }, + /** + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(C) { + this.isNotVisible() || this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (C.save(), this._setupCompositeOperation(C), this.drawSelectionBackground(C), this.transform(C), this._setOpacity(C), this._setShadow(C, this), this.shouldCache() ? (this.renderCache(), this.drawCacheOnCanvas(C)) : (this._removeCacheCanvas(), this.dirty = !1, this.drawObject(C), this.objectCaching && this.statefullCache && this.saveState({ propertySet: "cacheProperties" })), C.restore()); + }, + renderCache: function(C) { + C = C || {}, this._cacheCanvas || this._createCacheCanvas(), this.isCacheDirty() && (this.statefullCache && this.saveState({ propertySet: "cacheProperties" }), this.drawObject(this._cacheContext, C.forClipping), this.dirty = !1); + }, + /** + * Remove cacheCanvas and its dimensions from the objects + */ + _removeCacheCanvas: function() { + this._cacheCanvas = null, this.cacheWidth = 0, this.cacheHeight = 0; + }, + /** + * return true if the object will draw a stroke + * Does not consider text styles. This is just a shortcut used at rendering time + * We want it to be an approximation and be fast. + * wrote to avoid extra caching, it has to return true when stroke happens, + * can guess when it will not happen at 100% chance, does not matter if it misses + * some use case where the stroke is invisible. + * @since 3.0.0 + * @returns Boolean + */ + hasStroke: function() { + return this.stroke && this.stroke !== "transparent" && this.strokeWidth !== 0; + }, + /** + * return true if the object will draw a fill + * Does not consider text styles. This is just a shortcut used at rendering time + * We want it to be an approximation and be fast. + * wrote to avoid extra caching, it has to return true when fill happens, + * can guess when it will not happen at 100% chance, does not matter if it misses + * some use case where the fill is invisible. + * @since 3.0.0 + * @returns Boolean + */ + hasFill: function() { + return this.fill && this.fill !== "transparent"; + }, + /** + * When set to `true`, force the object to have its own cache, even if it is inside a group + * it may be needed when your object behave in a particular way on the cache and always needs + * its own isolated canvas to render correctly. + * Created to be overridden + * since 1.7.12 + * @returns Boolean + */ + needsItsOwnCache: function() { + return !!(this.paintFirst === "stroke" && this.hasFill() && this.hasStroke() && typeof this.shadow == "object" || this.clipPath); + }, + /** + * Decide if the object should cache or not. Create its own cache level + * objectCaching is a global flag, wins over everything + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * Read as: cache if is needed, or if the feature is enabled but we are not already caching. + * @return {Boolean} + */ + shouldCache: function() { + return this.ownCaching = this.needsItsOwnCache() || this.objectCaching && (!this.group || !this.group.isOnACache()), this.ownCaching; + }, + /** + * Check if this object or a child object will cast a shadow + * used by Group.shouldCache to know if child has a shadow recursively + * @return {Boolean} + */ + willDrawShadow: function() { + return !!this.shadow && (this.shadow.offsetX !== 0 || this.shadow.offsetY !== 0); + }, + /** + * Execute the drawing operation for an object clipPath + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawClipPathOnCache: function(C) { + var E = this.clipPath; + if (C.save(), E.inverted ? C.globalCompositeOperation = "destination-out" : C.globalCompositeOperation = "destination-in", E.absolutePositioned) { + var M = d.util.invertTransform(this.calcTransformMatrix()); + C.transform(M[0], M[1], M[2], M[3], M[4], M[5]); + } + E.transform(C), C.scale(1 / E.zoomX, 1 / E.zoomY), C.drawImage(E._cacheCanvas, -E.cacheTranslationX, -E.cacheTranslationY), C.restore(); + }, + /** + * Execute the drawing operation for an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawObject: function(C, E) { + var M = this.fill, P = this.stroke; + E ? (this.fill = "black", this.stroke = "", this._setClippingProperties(C)) : this._renderBackground(C), this._render(C), this._drawClipPath(C), this.fill = M, this.stroke = P; + }, + _drawClipPath: function(C) { + var E = this.clipPath; + E && (E.canvas = this.canvas, E.shouldCache(), E._transformDone = !0, E.renderCache({ forClipping: !0 }), this.drawClipPathOnCache(C)); + }, + /** + * Paint the cached copy of the object on the target context. + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawCacheOnCanvas: function(C) { + C.scale(1 / this.zoomX, 1 / this.zoomY), C.drawImage(this._cacheCanvas, -this.cacheTranslationX, -this.cacheTranslationY); + }, + /** + * Check if cache is dirty + * @param {Boolean} skipCanvas skip canvas checks because this object is painted + * on parent canvas. + */ + isCacheDirty: function(C) { + if (this.isNotVisible()) + return !1; + if (this._cacheCanvas && !C && this._updateCacheCanvas()) + return !0; + if (this.dirty || this.clipPath && this.clipPath.absolutePositioned || this.statefullCache && this.hasStateChanged("cacheProperties")) { + if (this._cacheCanvas && !C) { + var E = this.cacheWidth / this.zoomX, M = this.cacheHeight / this.zoomY; + this._cacheContext.clearRect(-E / 2, -M / 2, E, M); + } + return !0; + } + return !1; + }, + /** + * Draws a background for the object big as its untransformed dimensions + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderBackground: function(C) { + if (this.backgroundColor) { + var E = this._getNonTransformedDimensions(); + C.fillStyle = this.backgroundColor, C.fillRect( + -E.x / 2, + -E.y / 2, + E.x, + E.y + ), this._removeShadow(C); + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _setOpacity: function(C) { + this.group && !this.group._transformDone ? C.globalAlpha = this.getObjectOpacity() : C.globalAlpha *= this.opacity; + }, + _setStrokeStyles: function(C, E) { + var M = E.stroke; + M && (C.lineWidth = E.strokeWidth, C.lineCap = E.strokeLineCap, C.lineDashOffset = E.strokeDashOffset, C.lineJoin = E.strokeLineJoin, C.miterLimit = E.strokeMiterLimit, M.toLive ? M.gradientUnits === "percentage" || M.gradientTransform || M.patternTransform ? this._applyPatternForTransformedGradient(C, M) : (C.strokeStyle = M.toLive(C, this), this._applyPatternGradientTransform(C, M)) : C.strokeStyle = E.stroke); + }, + _setFillStyles: function(C, E) { + var M = E.fill; + M && (M.toLive ? (C.fillStyle = M.toLive(C, this), this._applyPatternGradientTransform(C, E.fill)) : C.fillStyle = M); + }, + _setClippingProperties: function(C) { + C.globalAlpha = 1, C.strokeStyle = "transparent", C.fillStyle = "#000000"; + }, + /** + * @private + * Sets line dash + * @param {CanvasRenderingContext2D} ctx Context to set the dash line on + * @param {Array} dashArray array representing dashes + */ + _setLineDash: function(C, E) { + !E || E.length === 0 || (1 & E.length && E.push.apply(E, E), C.setLineDash(E)); + }, + /** + * Renders controls and borders for the object + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [styleOverride] properties to override the object style + */ + _renderControls: function(C, E) { + var M = this.getViewportTransform(), P = this.calcTransformMatrix(), R, N, F; + E = E || {}, N = typeof E.hasBorders != "undefined" ? E.hasBorders : this.hasBorders, F = typeof E.hasControls != "undefined" ? E.hasControls : this.hasControls, P = d.util.multiplyTransformMatrices(M, P), R = d.util.qrDecompose(P), C.save(), C.translate(R.translateX, R.translateY), C.lineWidth = 1 * this.borderScaleFactor, this.group || (C.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1), C.rotate(g(R.angle)), E.forActiveSelection || this.group ? N && this.drawBordersInGroup(C, R, E) : N && this.drawBorders(C, E), F && this.drawControls(C, E), C.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _setShadow: function(C) { + if (this.shadow) { + var E = this.shadow, M = this.canvas, P, R = M && M.viewportTransform[0] || 1, N = M && M.viewportTransform[3] || 1; + E.nonScaling ? P = { scaleX: 1, scaleY: 1 } : P = this.getObjectScaling(), M && M._isRetinaScaling() && (R *= d.devicePixelRatio, N *= d.devicePixelRatio), C.shadowColor = E.color, C.shadowBlur = E.blur * d.browserShadowBlurConstant * (R + N) * (P.scaleX + P.scaleY) / 4, C.shadowOffsetX = E.offsetX * R * P.scaleX, C.shadowOffsetY = E.offsetY * N * P.scaleY; + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _removeShadow: function(C) { + this.shadow && (C.shadowColor = "", C.shadowBlur = C.shadowOffsetX = C.shadowOffsetY = 0); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} filler fabric.Pattern or fabric.Gradient + * @return {Object} offset.offsetX offset for text rendering + * @return {Object} offset.offsetY offset for text rendering + */ + _applyPatternGradientTransform: function(C, E) { + if (!E || !E.toLive) + return { offsetX: 0, offsetY: 0 }; + var M = E.gradientTransform || E.patternTransform, P = -this.width / 2 + E.offsetX || 0, R = -this.height / 2 + E.offsetY || 0; + return E.gradientUnits === "percentage" ? C.transform(this.width, 0, 0, this.height, P, R) : C.transform(1, 0, 0, 1, P, R), M && C.transform(M[0], M[1], M[2], M[3], M[4], M[5]), { offsetX: P, offsetY: R }; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderPaintInOrder: function(C) { + this.paintFirst === "stroke" ? (this._renderStroke(C), this._renderFill(C)) : (this._renderFill(C), this._renderStroke(C)); + }, + /** + * @private + * function that actually render something on the context. + * empty here to allow Obects to work on tests to benchmark fabric functionalites + * not related to rendering + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function() { + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderFill: function(C) { + this.fill && (C.save(), this._setFillStyles(C, this), this.fillRule === "evenodd" ? C.fill("evenodd") : C.fill(), C.restore()); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderStroke: function(C) { + if (!(!this.stroke || this.strokeWidth === 0)) { + if (this.shadow && !this.shadow.affectStroke && this._removeShadow(C), C.save(), this.strokeUniform && this.group) { + var E = this.getObjectScaling(); + C.scale(1 / E.scaleX, 1 / E.scaleY); + } else + this.strokeUniform && C.scale(1 / this.scaleX, 1 / this.scaleY); + this._setLineDash(C, this.strokeDashArray), this._setStrokeStyles(C, this), C.stroke(), C.restore(); + } + }, + /** + * This function try to patch the missing gradientTransform on canvas gradients. + * transforming a context to transform the gradient, is going to transform the stroke too. + * we want to transform the gradient but not the stroke operation, so we create + * a transformed gradient on a pattern and then we use the pattern instead of the gradient. + * this method has drwabacks: is slow, is in low resolution, needs a patch for when the size + * is limited. + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {fabric.Gradient} filler a fabric gradient instance + */ + _applyPatternForTransformedGradient: function(C, E) { + var M = this._limitCacheSize(this._getCacheCanvasDimensions()), P = d.util.createCanvasElement(), R, N = this.canvas.getRetinaScaling(), F = M.x / this.scaleX / N, U = M.y / this.scaleY / N; + P.width = F, P.height = U, R = P.getContext("2d"), R.beginPath(), R.moveTo(0, 0), R.lineTo(F, 0), R.lineTo(F, U), R.lineTo(0, U), R.closePath(), R.translate(F / 2, U / 2), R.scale( + M.zoomX / this.scaleX / N, + M.zoomY / this.scaleY / N + ), this._applyPatternGradientTransform(R, E), R.fillStyle = E.toLive(C), R.fill(), C.translate(-this.width / 2 - this.strokeWidth / 2, -this.height / 2 - this.strokeWidth / 2), C.scale( + N * this.scaleX / M.zoomX, + N * this.scaleY / M.zoomY + ), C.strokeStyle = R.createPattern(P, "no-repeat"); + }, + /** + * This function is an helper for svg import. it returns the center of the object in the svg + * untransformed coordinates + * @private + * @return {Object} center point from element coordinates + */ + _findCenterFromElement: function() { + return { x: this.left + this.width / 2, y: this.top + this.height / 2 }; + }, + /** + * This function is an helper for svg import. it decompose the transformMatrix + * and assign properties to object. + * untransformed coordinates + * @private + * @chainable + */ + _assignTransformMatrixProps: function() { + if (this.transformMatrix) { + var C = d.util.qrDecompose(this.transformMatrix); + this.flipX = !1, this.flipY = !1, this.set("scaleX", C.scaleX), this.set("scaleY", C.scaleY), this.angle = C.angle, this.skewX = C.skewX, this.skewY = 0; + } + }, + /** + * This function is an helper for svg import. it removes the transform matrix + * and set to object properties that fabricjs can handle + * @private + * @param {Object} preserveAspectRatioOptions + * @return {thisArg} + */ + _removeTransformMatrix: function(C) { + var E = this._findCenterFromElement(); + this.transformMatrix && (this._assignTransformMatrixProps(), E = d.util.transformPoint(E, this.transformMatrix)), this.transformMatrix = null, C && (this.scaleX *= C.scaleX, this.scaleY *= C.scaleY, this.cropX = C.cropX, this.cropY = C.cropY, E.x += C.offsetLeft, E.y += C.offsetTop, this.width = C.width, this.height = C.height), this.setPositionByOrigin(E, "center", "center"); + }, + /** + * Clones an instance, using a callback method will work for every object. + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone: function(C, E) { + var M = this.toObject(E); + this.constructor.fromObject ? this.constructor.fromObject(M, C) : d.Object._fromObject("Object", M, C); + }, + /** + * Creates an instance of fabric.Image out of an object + * makes use of toCanvasElement. + * Once this method was based on toDataUrl and loadImage, so it also had a quality + * and format option. toCanvasElement is faster and produce no loss of quality. + * If you need to get a real Jpeg or Png from an object, using toDataURL is the right way to do it. + * toCanvasElement and then toBlob from the obtained canvas is also a good option. + * This method is sync now, but still support the callback because we did not want to break. + * When fabricJS 5.0 will be planned, this will probably be changed to not have a callback. + * @param {Function} callback callback, invoked with an instance as a first argument + * @param {Object} [options] for clone as image, passed to toDataURL + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {fabric.Object} thisArg + */ + cloneAsImage: function(C, E) { + var M = this.toCanvasElement(E); + return C && C(new d.Image(M)), this; + }, + /** + * Converts an object into a HTMLCanvas element + * @param {Object} options Options object + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {HTMLCanvasElement} Returns DOM element with the fabric.Object + */ + toCanvasElement: function(C) { + C || (C = {}); + var E = d.util, M = E.saveObjectTransform(this), P = this.group, R = this.shadow, N = Math.abs, F = (C.multiplier || 1) * (C.enableRetinaScaling ? d.devicePixelRatio : 1); + delete this.group, C.withoutTransform && E.resetObjectTransform(this), C.withoutShadow && (this.shadow = null); + var U = d.util.createCanvasElement(), $ = this.getBoundingRect(!0, !0), G = this.shadow, Q, ee = { x: 0, y: 0 }, ce, ne, fe; + G && (ce = G.blur, G.nonScaling ? Q = { scaleX: 1, scaleY: 1 } : Q = this.getObjectScaling(), ee.x = 2 * Math.round(N(G.offsetX) + ce) * N(Q.scaleX), ee.y = 2 * Math.round(N(G.offsetY) + ce) * N(Q.scaleY)), ne = $.width + ee.x, fe = $.height + ee.y, U.width = Math.ceil(ne), U.height = Math.ceil(fe); + var K = new d.StaticCanvas(U, { + enableRetinaScaling: !1, + renderOnAddRemove: !1, + skipOffscreen: !1 + }); + C.format === "jpeg" && (K.backgroundColor = "#fff"), this.setPositionByOrigin(new d.Point(K.width / 2, K.height / 2), "center", "center"); + var Oe = this.canvas; + K.add(this); + var xe = K.toCanvasElement(F || 1, C); + return this.shadow = R, this.set("canvas", Oe), P && (this.group = P), this.set(M).setCoords(), K._objects = [], K.dispose(), K = null, xe; + }, + /** + * Converts an object into a data-url-like string + * @param {Object} options Options object + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in v1.2.14 + * @param {Boolean} [options.enableRetinaScaling] Enable retina scaling for clone image. Introduce in 1.6.4 + * @param {Boolean} [options.withoutTransform] Remove current object transform ( no scale , no angle, no flip, no skew ). Introduced in 2.3.4 + * @param {Boolean} [options.withoutShadow] Remove current object shadow. Introduced in 2.4.2 + * @return {String} Returns a data: URL containing a representation of the object in the format specified by options.format + */ + toDataURL: function(C) { + return C || (C = {}), d.util.toDataURL(this.toCanvasElement(C), C.format || "png", C.quality || 1); + }, + /** + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + * @return {Boolean} + */ + isType: function(C) { + return this.type === C; + }, + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance (is 1 unless subclassed) + */ + complexity: function() { + return 1; + }, + /** + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} JSON + */ + toJSON: function(C) { + return this.toObject(C); + }, + /** + * Sets "angle" of an instance with centered rotation + * @param {Number} angle Angle value (in degrees) + * @return {fabric.Object} thisArg + * @chainable + */ + rotate: function(C) { + var E = (this.originX !== "center" || this.originY !== "center") && this.centeredRotation; + return E && this._setOriginToCenter(), this.set("angle", C), E && this._resetOrigin(), this; + }, + /** + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + centerH: function() { + return this.canvas && this.canvas.centerObjectH(this), this; + }, + /** + * Centers object horizontally on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenterH: function() { + return this.canvas && this.canvas.viewportCenterObjectH(this), this; + }, + /** + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + centerV: function() { + return this.canvas && this.canvas.centerObjectV(this), this; + }, + /** + * Centers object vertically on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenterV: function() { + return this.canvas && this.canvas.viewportCenterObjectV(this), this; + }, + /** + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + center: function() { + return this.canvas && this.canvas.centerObject(this), this; + }, + /** + * Centers object on current viewport of canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @return {fabric.Object} thisArg + * @chainable + */ + viewportCenter: function() { + return this.canvas && this.canvas.viewportCenterObject(this), this; + }, + /** + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + * @return {Object} Coordinates of a pointer (x, y) + */ + getLocalPointer: function(C, E) { + E = E || this.canvas.getPointer(C); + var M = new d.Point(E.x, E.y), P = this._getLeftTopCoords(); + return this.angle && (M = d.util.rotatePoint( + M, + P, + g(-this.angle) + )), { + x: M.x - P.x, + y: M.y - P.y + }; + }, + /** + * Sets canvas globalCompositeOperation for specific object + * custom composition operation for the particular object can be specified using globalCompositeOperation property + * @param {CanvasRenderingContext2D} ctx Rendering canvas context + */ + _setupCompositeOperation: function(C) { + this.globalCompositeOperation && (C.globalCompositeOperation = this.globalCompositeOperation); + } + } + ), d.util.createAccessors && d.util.createAccessors(d.Object), m(d.Object.prototype, d.Observable), d.Object.NUM_FRACTION_DIGITS = 2, d.Object._fromObject = function(C, E, M, P) { + var R = d[C]; + E = _(E, !0), d.util.enlivenPatterns([E.fill, E.stroke], function(N) { + typeof N[0] != "undefined" && (E.fill = N[0]), typeof N[1] != "undefined" && (E.stroke = N[1]), d.util.enlivenObjects([E.clipPath], function(F) { + E.clipPath = F[0]; + var U = P ? new R(E[P], E) : new R(E); + M && M(U); + }); + }); + }, d.Object.__uid = 0); + }(l), function() { + var p = c.util.degreesToRadians, d = { + left: -0.5, + center: 0, + right: 0.5 + }, m = { + top: -0.5, + center: 0, + bottom: 0.5 + }; + c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Translates the coordinates from a set of origin to another (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} fromOriginX Horizontal origin: 'left', 'center' or 'right' + * @param {String} fromOriginY Vertical origin: 'top', 'center' or 'bottom' + * @param {String} toOriginX Horizontal origin: 'left', 'center' or 'right' + * @param {String} toOriginY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToGivenOrigin: function(_, y, x, g, S) { + var T = _.x, C = _.y, E, M, P; + return typeof y == "string" ? y = d[y] : y -= 0.5, typeof g == "string" ? g = d[g] : g -= 0.5, E = g - y, typeof x == "string" ? x = m[x] : x -= 0.5, typeof S == "string" ? S = m[S] : S -= 0.5, M = S - x, (E || M) && (P = this._getTransformedDimensions(), T = _.x + E * P.x, C = _.y + M * P.y), new c.Point(T, C); + }, + /** + * Translates the coordinates from origin to center coordinates (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToCenterPoint: function(_, y, x) { + var g = this.translateToGivenOrigin(_, y, x, "center", "center"); + return this.angle ? c.util.rotatePoint(g, _, p(this.angle)) : g; + }, + /** + * Translates the coordinates from center to origin coordinates (based on the object's dimensions) + * @param {fabric.Point} center The point which corresponds to center of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + translateToOriginPoint: function(_, y, x) { + var g = this.translateToGivenOrigin(_, "center", "center", y, x); + return this.angle ? c.util.rotatePoint(g, _, p(this.angle)) : g; + }, + /** + * Returns the real center coordinates of the object + * @return {fabric.Point} + */ + getCenterPoint: function() { + var _ = new c.Point(this.left, this.top); + return this.translateToCenterPoint(_, this.originX, this.originY); + }, + /** + * Returns the coordinates of the object based on center coordinates + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @return {fabric.Point} + */ + // getOriginPoint: function(center) { + // return this.translateToOriginPoint(center, this.originX, this.originY); + // }, + /** + * Returns the coordinates of the object as if it has a different origin + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + getPointByOrigin: function(_, y) { + var x = this.getCenterPoint(); + return this.translateToOriginPoint(x, _, y); + }, + /** + * Returns the point in local coordinates + * @param {fabric.Point} point The point relative to the global coordinate system + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {fabric.Point} + */ + toLocalPoint: function(_, y, x) { + var g = this.getCenterPoint(), S, T; + return typeof y != "undefined" && typeof x != "undefined" ? S = this.translateToGivenOrigin(g, "center", "center", y, x) : S = new c.Point(this.left, this.top), T = new c.Point(_.x, _.y), this.angle && (T = c.util.rotatePoint(T, g, -p(this.angle))), T.subtractEquals(S); + }, + /** + * Returns the point in global coordinates + * @param {fabric.Point} The point relative to the local coordinate system + * @return {fabric.Point} + */ + // toGlobalPoint: function(point) { + // return fabric.util.rotatePoint(point, this.getCenterPoint(), degreesToRadians(this.angle)).addEquals(new fabric.Point(this.left, this.top)); + // }, + /** + * Sets the position of the object taking into consideration the object's origin + * @param {fabric.Point} pos The new position of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {void} + */ + setPositionByOrigin: function(_, y, x) { + var g = this.translateToCenterPoint(_, y, x), S = this.translateToOriginPoint(g, this.originX, this.originY); + this.set("left", S.x), this.set("top", S.y); + }, + /** + * @param {String} to One of 'left', 'center', 'right' + */ + adjustPosition: function(_) { + var y = p(this.angle), x = this.getScaledWidth(), g = c.util.cos(y) * x, S = c.util.sin(y) * x, T, C; + typeof this.originX == "string" ? T = d[this.originX] : T = this.originX - 0.5, typeof _ == "string" ? C = d[_] : C = _ - 0.5, this.left += g * (C - T), this.top += S * (C - T), this.setCoords(), this.originX = _; + }, + /** + * Sets the origin/position of the object to it's center point + * @private + * @return {void} + */ + _setOriginToCenter: function() { + this._originalOriginX = this.originX, this._originalOriginY = this.originY; + var _ = this.getCenterPoint(); + this.originX = "center", this.originY = "center", this.left = _.x, this.top = _.y; + }, + /** + * Resets the origin/position of the object to it's original origin + * @private + * @return {void} + */ + _resetOrigin: function() { + var _ = this.translateToOriginPoint( + this.getCenterPoint(), + this._originalOriginX, + this._originalOriginY + ); + this.originX = this._originalOriginX, this.originY = this._originalOriginY, this.left = _.x, this.top = _.y, this._originalOriginX = null, this._originalOriginY = null; + }, + /** + * @private + */ + _getLeftTopCoords: function() { + return this.translateToOriginPoint(this.getCenterPoint(), "left", "top"); + } + } + ); + }(), function() { + function p(x) { + return [ + new c.Point(x.tl.x, x.tl.y), + new c.Point(x.tr.x, x.tr.y), + new c.Point(x.br.x, x.br.y), + new c.Point(x.bl.x, x.bl.y) + ]; + } + var d = c.util, m = d.degreesToRadians, _ = d.multiplyTransformMatrices, y = d.transformPoint; + d.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Describe object's corner position in canvas element coordinates. + * properties are depending on control keys and padding the main controls. + * each property is an object with x, y and corner. + * The `corner` property contains in a similar manner the 4 points of the + * interactive area of the corner. + * The coordinates depends from the controls positionHandler and are used + * to draw and locate controls + * @memberOf fabric.Object.prototype + */ + oCoords: null, + /** + * Describe object's corner position in canvas object absolute coordinates + * properties are tl,tr,bl,br and describe the four main corner. + * each property is an object with x, y, instance of Fabric.Point. + * The coordinates depends from this properties: width, height, scaleX, scaleY + * skewX, skewY, angle, strokeWidth, top, left. + * Those coordinates are useful to understand where an object is. They get updated + * with oCoords but they do not need to be updated when zoom or panning change. + * The coordinates get updated with @method setCoords. + * You can calculate them without updating with @method calcACoords(); + * @memberOf fabric.Object.prototype + */ + aCoords: null, + /** + * Describe object's corner position in canvas element coordinates. + * includes padding. Used of object detection. + * set and refreshed with setCoords and calcCoords. + * @memberOf fabric.Object.prototype + */ + lineCoords: null, + /** + * storage for object transform matrix + */ + ownMatrixCache: null, + /** + * storage for object full transform matrix + */ + matrixCache: null, + /** + * custom controls interface + * controls are added by default_controls.js + */ + controls: {}, + /** + * return correct set of coordinates for intersection + * this will return either aCoords or lineCoords. + * @param {Boolean} absolute will return aCoords if true or lineCoords + * @return {Object} {tl, tr, br, bl} points + */ + _getCoords: function(x, g) { + return g ? x ? this.calcACoords() : this.calcLineCoords() : ((!this.aCoords || !this.lineCoords) && this.setCoords(!0), x ? this.aCoords : this.lineCoords); + }, + /** + * return correct set of coordinates for intersection + * this will return either aCoords or lineCoords. + * The coords are returned in an array. + * @return {Array} [tl, tr, br, bl] of points + */ + getCoords: function(x, g) { + return p(this._getCoords(x, g)); + }, + /** + * Checks if object intersects with an area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object intersects with an area formed by 2 points + */ + intersectsWithRect: function(x, g, S, T) { + var C = this.getCoords(S, T), E = c.Intersection.intersectPolygonRectangle( + C, + x, + g + ); + return E.status === "Intersection"; + }, + /** + * Checks if object intersects with another object + * @param {Object} other Object to test + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object intersects with another object + */ + intersectsWithObject: function(x, g, S) { + var T = c.Intersection.intersectPolygonPolygon( + this.getCoords(g, S), + x.getCoords(g, S) + ); + return T.status === "Intersection" || x.isContainedWithinObject(this, g, S) || this.isContainedWithinObject(x, g, S); + }, + /** + * Checks if object is fully contained within area of another object + * @param {Object} other Object to test + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is fully contained within area of another object + */ + isContainedWithinObject: function(x, g, S) { + for (var T = this.getCoords(g, S), C = g ? x.aCoords : x.lineCoords, E = 0, M = x._getImageLines(C); E < 4; E++) + if (!x.containsPoint(T[E], M)) + return !1; + return !0; + }, + /** + * Checks if object is fully contained within area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is fully contained within area formed by 2 points + */ + isContainedWithinRect: function(x, g, S, T) { + var C = this.getBoundingRect(S, T); + return C.left >= x.x && C.left + C.width <= g.x && C.top >= x.y && C.top + C.height <= g.y; + }, + /** + * Checks if point is inside the object + * @param {fabric.Point} point Point to check against + * @param {Object} [lines] object returned from @method _getImageLines + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if point is inside the object + */ + containsPoint: function(x, E, S, T) { + var C = this._getCoords(S, T), E = E || this._getImageLines(C), M = this._findCrossPoints(x, E); + return M !== 0 && M % 2 === 1; + }, + /** + * Checks if object is contained within the canvas with current viewportTransform + * the check is done stopping at first point that appears on screen + * @param {Boolean} [calculate] use coordinates of current position instead of .aCoords + * @return {Boolean} true if object is fully or partially contained within canvas + */ + isOnScreen: function(x) { + if (!this.canvas) + return !1; + var g = this.canvas.vptCoords.tl, S = this.canvas.vptCoords.br, T = this.getCoords(!0, x); + return T.some(function(C) { + return C.x <= S.x && C.x >= g.x && C.y <= S.y && C.y >= g.y; + }) || this.intersectsWithRect(g, S, !0, x) ? !0 : this._containsCenterOfCanvas(g, S, x); + }, + /** + * Checks if the object contains the midpoint between canvas extremities + * Does not make sense outside the context of isOnScreen and isPartiallyOnScreen + * @private + * @param {Fabric.Point} pointTL Top Left point + * @param {Fabric.Point} pointBR Top Right point + * @param {Boolean} calculate use coordinates of current position instead of .oCoords + * @return {Boolean} true if the object contains the point + */ + _containsCenterOfCanvas: function(x, g, S) { + var T = { x: (x.x + g.x) / 2, y: (x.y + g.y) / 2 }; + return !!this.containsPoint(T, null, !0, S); + }, + /** + * Checks if object is partially contained within the canvas with current viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords + * @return {Boolean} true if object is partially contained within canvas + */ + isPartiallyOnScreen: function(x) { + if (!this.canvas) + return !1; + var g = this.canvas.vptCoords.tl, S = this.canvas.vptCoords.br; + if (this.intersectsWithRect(g, S, !0, x)) + return !0; + var T = this.getCoords(!0, x).every(function(C) { + return (C.x >= S.x || C.x <= g.x) && (C.y >= S.y || C.y <= g.y); + }); + return T && this._containsCenterOfCanvas(g, S, x); + }, + /** + * Method that returns an object with the object edges in it, given the coordinates of the corners + * @private + * @param {Object} oCoords Coordinates of the object corners + */ + _getImageLines: function(x) { + var g = { + topline: { + o: x.tl, + d: x.tr + }, + rightline: { + o: x.tr, + d: x.br + }, + bottomline: { + o: x.br, + d: x.bl + }, + leftline: { + o: x.bl, + d: x.tl + } + }; + return g; + }, + /** + * Helper method to determine how many cross points are between the 4 object edges + * and the horizontal line determined by a point on canvas + * @private + * @param {fabric.Point} point Point to check + * @param {Object} lines Coordinates of the object being evaluated + */ + // remove yi, not used but left code here just in case. + _findCrossPoints: function(x, g) { + var S, T, C, E, M, P = 0, R; + for (var N in g) + if (R = g[N], !(R.o.y < x.y && R.d.y < x.y) && !(R.o.y >= x.y && R.d.y >= x.y) && (R.o.x === R.d.x && R.o.x >= x.x ? M = R.o.x : (S = 0, T = (R.d.y - R.o.y) / (R.d.x - R.o.x), C = x.y - S * x.x, E = R.o.y - T * R.o.x, M = -(C - E) / (S - T)), M >= x.x && (P += 1), P === 2)) + break; + return P; + }, + /** + * Returns coordinates of object's bounding rectangle (left, top, width, height) + * the box is intended as aligned to axis of canvas. + * @param {Boolean} [absolute] use coordinates without viewportTransform + * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords / .aCoords + * @return {Object} Object with left, top, width, height properties + */ + getBoundingRect: function(x, g) { + var S = this.getCoords(x, g); + return d.makeBoundingBoxFromPoints(S); + }, + /** + * Returns width of an object's bounding box counting transformations + * before 2.0 it was named getWidth(); + * @return {Number} width value + */ + getScaledWidth: function() { + return this._getTransformedDimensions().x; + }, + /** + * Returns height of an object bounding box counting transformations + * before 2.0 it was named getHeight(); + * @return {Number} height value + */ + getScaledHeight: function() { + return this._getTransformedDimensions().y; + }, + /** + * Makes sure the scale is valid and modifies it if necessary + * @private + * @param {Number} value + * @return {Number} + */ + _constrainScale: function(x) { + return Math.abs(x) < this.minScaleLimit ? x < 0 ? -this.minScaleLimit : this.minScaleLimit : x === 0 ? 1e-4 : x; + }, + /** + * Scales an object (equally by x and y) + * @param {Number} value Scale factor + * @return {fabric.Object} thisArg + * @chainable + */ + scale: function(x) { + return this._set("scaleX", x), this._set("scaleY", x), this.setCoords(); + }, + /** + * Scales an object to a given width, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New width value + * @param {Boolean} absolute ignore viewport + * @return {fabric.Object} thisArg + * @chainable + */ + scaleToWidth: function(x, g) { + var S = this.getBoundingRect(g).width / this.getScaledWidth(); + return this.scale(x / this.width / S); + }, + /** + * Scales an object to a given height, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New height value + * @param {Boolean} absolute ignore viewport + * @return {fabric.Object} thisArg + * @chainable + */ + scaleToHeight: function(x, g) { + var S = this.getBoundingRect(g).height / this.getScaledHeight(); + return this.scale(x / this.height / S); + }, + /** + * Calculates and returns the .coords of an object. + * unused by the library, only for the end dev. + * @return {Object} Object with tl, tr, br, bl .... + * @chainable + * @deprecated + */ + calcCoords: function(x) { + return x ? this.calcACoords() : this.calcOCoords(); + }, + calcLineCoords: function() { + var x = this.getViewportTransform(), g = this.padding, S = m(this.angle), T = d.cos(S), C = d.sin(S), E = T * g, M = C * g, P = E + M, R = E - M, N = this.calcACoords(), F = { + tl: y(N.tl, x), + tr: y(N.tr, x), + bl: y(N.bl, x), + br: y(N.br, x) + }; + return g && (F.tl.x -= R, F.tl.y -= P, F.tr.x += P, F.tr.y -= R, F.bl.x -= P, F.bl.y += R, F.br.x += R, F.br.y += P), F; + }, + calcOCoords: function() { + var x = this._calcRotateMatrix(), g = this._calcTranslateMatrix(), S = this.getViewportTransform(), T = _(S, g), C = _(T, x), C = _(C, [1 / S[0], 0, 0, 1 / S[3], 0, 0]), E = this._calculateCurrentDimensions(), M = {}; + return this.forEachControl(function(P, R, N) { + M[R] = P.positionHandler(E, C, N); + }), M; + }, + calcACoords: function() { + var x = this._calcRotateMatrix(), g = this._calcTranslateMatrix(), S = _(g, x), T = this._getTransformedDimensions(), C = T.x / 2, E = T.y / 2; + return { + // corners + tl: y({ x: -C, y: -E }, S), + tr: y({ x: C, y: -E }, S), + bl: y({ x: -C, y: E }, S), + br: y({ x: C, y: E }, S) + }; + }, + /** + * Sets corner and controls position coordinates based on current angle, width and height, left and top. + * oCoords are used to find the corners + * aCoords are used to quickly find an object on the canvas + * lineCoords are used to quickly find object during pointer events. + * See {@link https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords|When-to-call-setCoords} + * @param {Boolean} [skipCorners] skip calculation of oCoords. + * @return {fabric.Object} thisArg + * @chainable + */ + setCoords: function(x) { + return this.aCoords = this.calcACoords(), this.lineCoords = this.group ? this.aCoords : this.calcLineCoords(), x ? this : (this.oCoords = this.calcOCoords(), this._setCornerCoords && this._setCornerCoords(), this); + }, + /** + * calculate rotation matrix of an object + * @return {Array} rotation matrix for the object + */ + _calcRotateMatrix: function() { + return d.calcRotateMatrix(this); + }, + /** + * calculate the translation matrix for an object transform + * @return {Array} rotation matrix for the object + */ + _calcTranslateMatrix: function() { + var x = this.getCenterPoint(); + return [1, 0, 0, 1, x.x, x.y]; + }, + transformMatrixKey: function(x) { + var g = "_", S = ""; + return !x && this.group && (S = this.group.transformMatrixKey(x) + g), S + this.top + g + this.left + g + this.scaleX + g + this.scaleY + g + this.skewX + g + this.skewY + g + this.angle + g + this.originX + g + this.originY + g + this.width + g + this.height + g + this.strokeWidth + this.flipX + this.flipY; + }, + /** + * calculate transform matrix that represents the current transformations from the + * object's properties. + * @param {Boolean} [skipGroup] return transform matrix for object not counting parent transformations + * There are some situation in which this is useful to avoid the fake rotation. + * @return {Array} transform matrix for the object + */ + calcTransformMatrix: function(x) { + var g = this.calcOwnMatrix(); + if (x || !this.group) + return g; + var S = this.transformMatrixKey(x), T = this.matrixCache || (this.matrixCache = {}); + return T.key === S ? T.value : (this.group && (g = _(this.group.calcTransformMatrix(!1), g)), T.key = S, T.value = g, g); + }, + /** + * calculate transform matrix that represents the current transformations from the + * object's properties, this matrix does not include the group transformation + * @return {Array} transform matrix for the object + */ + calcOwnMatrix: function() { + var x = this.transformMatrixKey(!0), g = this.ownMatrixCache || (this.ownMatrixCache = {}); + if (g.key === x) + return g.value; + var S = this._calcTranslateMatrix(), T = { + angle: this.angle, + translateX: S[4], + translateY: S[5], + scaleX: this.scaleX, + scaleY: this.scaleY, + skewX: this.skewX, + skewY: this.skewY, + flipX: this.flipX, + flipY: this.flipY + }; + return g.key = x, g.value = d.composeMatrix(T), g.value; + }, + /* + * Calculate object dimensions from its properties + * @private + * @deprecated since 3.4.0, please use fabric.util._calcDimensionsTransformMatrix + * not including or including flipX, flipY to emulate the flipping boolean + * @return {Object} .x width dimension + * @return {Object} .y height dimension + */ + _calcDimensionsTransformMatrix: function(x, g, S) { + return d.calcDimensionsMatrix({ + skewX: x, + skewY: g, + scaleX: this.scaleX * (S && this.flipX ? -1 : 1), + scaleY: this.scaleY * (S && this.flipY ? -1 : 1) + }); + }, + /* + * Calculate object dimensions from its properties + * @private + * @return {Object} .x width dimension + * @return {Object} .y height dimension + */ + _getNonTransformedDimensions: function() { + var x = this.strokeWidth, g = this.width + x, S = this.height + x; + return { x: g, y: S }; + }, + /* + * Calculate object bounding box dimensions from its properties scale, skew. + * @param {Number} skewX, a value to override current skewX + * @param {Number} skewY, a value to override current skewY + * @private + * @return {Object} .x width dimension + * @return {Object} .y height dimension + */ + _getTransformedDimensions: function(x, g) { + typeof x == "undefined" && (x = this.skewX), typeof g == "undefined" && (g = this.skewY); + var S, T, C, E = x === 0 && g === 0; + if (this.strokeUniform ? (T = this.width, C = this.height) : (S = this._getNonTransformedDimensions(), T = S.x, C = S.y), E) + return this._finalizeDimensions(T * this.scaleX, C * this.scaleY); + var M = d.sizeAfterTransform(T, C, { + scaleX: this.scaleX, + scaleY: this.scaleY, + skewX: x, + skewY: g + }); + return this._finalizeDimensions(M.x, M.y); + }, + /* + * Calculate object bounding box dimensions from its properties scale, skew. + * @param Number width width of the bbox + * @param Number height height of the bbox + * @private + * @return {Object} .x finalized width dimension + * @return {Object} .y finalized height dimension + */ + _finalizeDimensions: function(x, g) { + return this.strokeUniform ? { x: x + this.strokeWidth, y: g + this.strokeWidth } : { x, y: g }; + }, + /* + * Calculate object dimensions for controls box, including padding and canvas zoom. + * and active selection + * private + */ + _calculateCurrentDimensions: function() { + var x = this.getViewportTransform(), g = this._getTransformedDimensions(), S = y(g, x, !0); + return S.scalarAdd(2 * this.padding); + } + } + ); + }(), c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Moves an object to the bottom of the stack of drawn objects + * @return {fabric.Object} thisArg + * @chainable + */ + sendToBack: function() { + return this.group ? c.StaticCanvas.prototype.sendToBack.call(this.group, this) : this.canvas && this.canvas.sendToBack(this), this; + }, + /** + * Moves an object to the top of the stack of drawn objects + * @return {fabric.Object} thisArg + * @chainable + */ + bringToFront: function() { + return this.group ? c.StaticCanvas.prototype.bringToFront.call(this.group, this) : this.canvas && this.canvas.bringToFront(this), this; + }, + /** + * Moves an object down in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @return {fabric.Object} thisArg + * @chainable + */ + sendBackwards: function(p) { + return this.group ? c.StaticCanvas.prototype.sendBackwards.call(this.group, this, p) : this.canvas && this.canvas.sendBackwards(this, p), this; + }, + /** + * Moves an object up in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @return {fabric.Object} thisArg + * @chainable + */ + bringForward: function(p) { + return this.group ? c.StaticCanvas.prototype.bringForward.call(this.group, this, p) : this.canvas && this.canvas.bringForward(this, p), this; + }, + /** + * Moves an object to specified level in stack of drawn objects + * @param {Number} index New position of object + * @return {fabric.Object} thisArg + * @chainable + */ + moveTo: function(p) { + return this.group && this.group.type !== "activeSelection" ? c.StaticCanvas.prototype.moveTo.call(this.group, this, p) : this.canvas && this.canvas.moveTo(this, p), this; + } + } + ), function() { + function p(m, _) { + if (_) { + if (_.toLive) + return m + ": url(#SVGID_" + _.id + "); "; + var y = new c.Color(_), x = m + ": " + y.toRgb() + "; ", g = y.getAlpha(); + return g !== 1 && (x += m + "-opacity: " + g.toString() + "; "), x; + } else + return m + ": none; "; + } + var d = c.util.toFixed; + c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Returns styles-string for svg-export + * @param {Boolean} skipShadow a boolean to skip shadow filter output + * @return {String} + */ + getSvgStyles: function(m) { + var _ = this.fillRule ? this.fillRule : "nonzero", y = this.strokeWidth ? this.strokeWidth : "0", x = this.strokeDashArray ? this.strokeDashArray.join(" ") : "none", g = this.strokeDashOffset ? this.strokeDashOffset : "0", S = this.strokeLineCap ? this.strokeLineCap : "butt", T = this.strokeLineJoin ? this.strokeLineJoin : "miter", C = this.strokeMiterLimit ? this.strokeMiterLimit : "4", E = typeof this.opacity != "undefined" ? this.opacity : "1", M = this.visible ? "" : " visibility: hidden;", P = m ? "" : this.getSvgFilter(), R = p("fill", this.fill), N = p("stroke", this.stroke); + return [ + N, + "stroke-width: ", + y, + "; ", + "stroke-dasharray: ", + x, + "; ", + "stroke-linecap: ", + S, + "; ", + "stroke-dashoffset: ", + g, + "; ", + "stroke-linejoin: ", + T, + "; ", + "stroke-miterlimit: ", + C, + "; ", + R, + "fill-rule: ", + _, + "; ", + "opacity: ", + E, + ";", + P, + M + ].join(""); + }, + /** + * Returns styles-string for svg-export + * @param {Object} style the object from which to retrieve style properties + * @param {Boolean} useWhiteSpace a boolean to include an additional attribute in the style. + * @return {String} + */ + getSvgSpanStyles: function(m, _) { + var y = "; ", g = m.fontFamily ? "font-family: " + (m.fontFamily.indexOf("'") === -1 && m.fontFamily.indexOf('"') === -1 ? "'" + m.fontFamily + "'" : m.fontFamily) + y : "", x = m.strokeWidth ? "stroke-width: " + m.strokeWidth + y : "", g = g, S = m.fontSize ? "font-size: " + m.fontSize + "px" + y : "", T = m.fontStyle ? "font-style: " + m.fontStyle + y : "", C = m.fontWeight ? "font-weight: " + m.fontWeight + y : "", E = m.fill ? p("fill", m.fill) : "", M = m.stroke ? p("stroke", m.stroke) : "", P = this.getSvgTextDecoration(m), R = m.deltaY ? "baseline-shift: " + -m.deltaY + "; " : ""; + return P && (P = "text-decoration: " + P + y), [ + M, + x, + g, + S, + T, + C, + P, + E, + R, + _ ? "white-space: pre; " : "" + ].join(""); + }, + /** + * Returns text-decoration property for svg-export + * @param {Object} style the object from which to retrieve style properties + * @return {String} + */ + getSvgTextDecoration: function(m) { + return ["overline", "underline", "line-through"].filter(function(_) { + return m[_.replace("-", "")]; + }).join(" "); + }, + /** + * Returns filter for svg shadow + * @return {String} + */ + getSvgFilter: function() { + return this.shadow ? "filter: url(#SVGID_" + this.shadow.id + ");" : ""; + }, + /** + * Returns id attribute for svg output + * @return {String} + */ + getSvgCommons: function() { + return [ + this.id ? 'id="' + this.id + '" ' : "", + this.clipPath ? 'clip-path="url(#' + this.clipPath.clipPathId + ')" ' : "" + ].join(""); + }, + /** + * Returns transform-string for svg-export + * @param {Boolean} use the full transform or the single object one. + * @return {String} + */ + getSvgTransform: function(m, _) { + var y = m ? this.calcTransformMatrix() : this.calcOwnMatrix(), x = 'transform="' + c.util.matrixToSVG(y); + return x + (_ || "") + '" '; + }, + _setSVGBg: function(m) { + if (this.backgroundColor) { + var _ = c.Object.NUM_FRACTION_DIGITS; + m.push( + " +` + ); + } + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(m) { + return this._createBaseSVGMarkup(this._toSVG(m), { reviver: m }); + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(m) { + return " " + this._createBaseClipPathSVGMarkup(this._toSVG(m), { reviver: m }); + }, + /** + * @private + */ + _createBaseClipPathSVGMarkup: function(m, _) { + _ = _ || {}; + var y = _.reviver, x = _.additionalTransform || "", g = [ + this.getSvgTransform(!0, x), + this.getSvgCommons() + ].join(""), S = m.indexOf("COMMON_PARTS"); + return m[S] = g, y ? y(m.join("")) : m.join(""); + }, + /** + * @private + */ + _createBaseSVGMarkup: function(m, _) { + _ = _ || {}; + var y = _.noStyle, x = _.reviver, g = y ? "" : 'style="' + this.getSvgStyles() + '" ', S = _.withShadow ? 'style="' + this.getSvgFilter() + '" ' : "", T = this.clipPath, C = this.strokeUniform ? 'vector-effect="non-scaling-stroke" ' : "", E = T && T.absolutePositioned, M = this.stroke, P = this.fill, R = this.shadow, N, F = [], U, $ = m.indexOf("COMMON_PARTS"), G = _.additionalTransform; + return T && (T.clipPathId = "CLIPPATH_" + c.Object.__uid++, U = ' +` + T.toClipPathSVG(x) + ` +`), E && F.push( + " +` + ), F.push( + " +` + ), N = [ + g, + C, + y ? "" : this.addPaintOrder(), + " ", + G ? 'transform="' + G + '" ' : "" + ].join(""), m[$] = N, P && P.toLive && F.push(P.toSVG(this)), M && M.toLive && F.push(M.toSVG(this)), R && F.push(R.toSVG(this)), T && F.push(U), F.push(m.join("")), F.push(` +`), E && F.push(` +`), x ? x(F.join("")) : F.join(""); + }, + addPaintOrder: function() { + return this.paintFirst !== "fill" ? ' paint-order="' + this.paintFirst + '" ' : ""; + } + } + ); + }(), function() { + var p = c.util.object.extend, d = "stateProperties"; + function m(y, x, g) { + var S = {}, T = !0; + g.forEach(function(C) { + S[C] = y[C]; + }), p(y[x], S, T); + } + function _(y, x, g) { + if (y === x) + return !0; + if (Array.isArray(y)) { + if (!Array.isArray(x) || y.length !== x.length) + return !1; + for (var S = 0, T = y.length; S < T; S++) + if (!_(y[S], x[S])) + return !1; + return !0; + } else if (y && typeof y == "object") { + var C = Object.keys(y), E; + if (!x || typeof x != "object" || !g && C.length !== Object.keys(x).length) + return !1; + for (var S = 0, T = C.length; S < T; S++) + if (E = C[S], !(E === "canvas" || E === "group") && !_(y[E], x[E])) + return !1; + return !0; + } + } + c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Returns true if object state (one of its state properties) was changed + * @param {String} [propertySet] optional name for the set of property we want to save + * @return {Boolean} true if instance' state has changed since `{@link fabric.Object#saveState}` was called + */ + hasStateChanged: function(y) { + y = y || d; + var x = "_" + y; + return Object.keys(this[x]).length < this[y].length ? !0 : !_(this[x], this, !0); + }, + /** + * Saves state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + saveState: function(y) { + var x = y && y.propertySet || d, g = "_" + x; + return this[g] ? (m(this, g, this[x]), y && y.stateProperties && m(this, g, y.stateProperties), this) : this.setupState(y); + }, + /** + * Setups state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + setupState: function(y) { + y = y || {}; + var x = y.propertySet || d; + return y.propertySet = x, this["_" + x] = {}, this.saveState(y), this; + } + } + ); + }(), function() { + var p = c.util.degreesToRadians; + c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Determines which corner has been clicked + * @private + * @param {Object} pointer The pointer indicating the mouse position + * @return {String|Boolean} corner code (tl, tr, bl, br, etc.), or false if nothing is found + */ + _findTargetCorner: function(d, m) { + if (!this.hasControls || this.group || !this.canvas || this.canvas._activeObject !== this) + return !1; + var _ = d.x, y = d.y, x, g, S = Object.keys(this.oCoords), T = S.length - 1, C; + for (this.__corner = 0; T >= 0; T--) + if (C = S[T], !!this.isControlVisible(C) && (g = this._getImageLines(m ? this.oCoords[C].touchCorner : this.oCoords[C].corner), x = this._findCrossPoints({ x: _, y }, g), x !== 0 && x % 2 === 1)) + return this.__corner = C, C; + return !1; + }, + /** + * Calls a function for each control. The function gets called, + * with the control, the object that is calling the iterator and the control's key + * @param {Function} fn function to iterate over the controls over + */ + forEachControl: function(d) { + for (var m in this.controls) + d(this.controls[m], m, this); + }, + /** + * Sets the coordinates of the draggable boxes in the corners of + * the image used to scale/rotate it. + * note: if we would switch to ROUND corner area, all of this would disappear. + * everything would resolve to a single point and a pythagorean theorem for the distance + * @private + */ + _setCornerCoords: function() { + var d = this.oCoords; + for (var m in d) { + var _ = this.controls[m]; + d[m].corner = _.calcCornerCoords( + this.angle, + this.cornerSize, + d[m].x, + d[m].y, + !1 + ), d[m].touchCorner = _.calcCornerCoords( + this.angle, + this.touchCornerSize, + d[m].x, + d[m].y, + !0 + ); + } + }, + /** + * Draws a colored layer behind the object, inside its selection borders. + * Requires public options: padding, selectionBackgroundColor + * this function is called when the context is transformed + * has checks to be skipped when the object is on a staticCanvas + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @return {fabric.Object} thisArg + * @chainable + */ + drawSelectionBackground: function(d) { + if (!this.selectionBackgroundColor || this.canvas && !this.canvas.interactive || this.canvas && this.canvas._activeObject !== this) + return this; + d.save(); + var m = this.getCenterPoint(), _ = this._calculateCurrentDimensions(), y = this.canvas.viewportTransform; + return d.translate(m.x, m.y), d.scale(1 / y[0], 1 / y[3]), d.rotate(p(this.angle)), d.fillStyle = this.selectionBackgroundColor, d.fillRect(-_.x / 2, -_.y / 2, _.x, _.y), d.restore(), this; + }, + /** + * Draws borders of an object's bounding box. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawBorders: function(d, m) { + m = m || {}; + var _ = this._calculateCurrentDimensions(), y = this.borderScaleFactor, x = _.x + y, g = _.y + y, S = typeof m.hasControls != "undefined" ? m.hasControls : this.hasControls, T = !1; + return d.save(), d.strokeStyle = m.borderColor || this.borderColor, this._setLineDash(d, m.borderDashArray || this.borderDashArray), d.strokeRect( + -x / 2, + -g / 2, + x, + g + ), S && (d.beginPath(), this.forEachControl(function(C, E, M) { + C.withConnection && C.getVisibility(M, E) && (T = !0, d.moveTo(C.x * x, C.y * g), d.lineTo( + C.x * x + C.offsetX, + C.y * g + C.offsetY + )); + }), T && d.stroke()), d.restore(), this; + }, + /** + * Draws borders of an object's bounding box when it is inside a group. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {object} options object representing current object parameters + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawBordersInGroup: function(d, m, _) { + _ = _ || {}; + var y = c.util.sizeAfterTransform(this.width, this.height, m), x = this.strokeWidth, g = this.strokeUniform, S = this.borderScaleFactor, T = y.x + x * (g ? this.canvas.getZoom() : m.scaleX) + S, C = y.y + x * (g ? this.canvas.getZoom() : m.scaleY) + S; + return d.save(), this._setLineDash(d, _.borderDashArray || this.borderDashArray), d.strokeStyle = _.borderColor || this.borderColor, d.strokeRect( + -T / 2, + -C / 2, + T, + C + ), d.restore(), this; + }, + /** + * Draws corners of an object's bounding box. + * Requires public properties: width, height + * Requires public options: cornerSize, padding + * @param {CanvasRenderingContext2D} ctx Context to draw on + * @param {Object} styleOverride object to override the object style + * @return {fabric.Object} thisArg + * @chainable + */ + drawControls: function(d, m) { + m = m || {}, d.save(); + var _ = this.canvas.getRetinaScaling(), y, x; + return d.setTransform(_, 0, 0, _, 0, 0), d.strokeStyle = d.fillStyle = m.cornerColor || this.cornerColor, this.transparentCorners || (d.strokeStyle = m.cornerStrokeColor || this.cornerStrokeColor), this._setLineDash(d, m.cornerDashArray || this.cornerDashArray), this.setCoords(), this.group && (y = this.group.calcTransformMatrix()), this.forEachControl(function(g, S, T) { + x = T.oCoords[S], g.getVisibility(T, S) && (y && (x = c.util.transformPoint(x, y)), g.render(d, x.x, x.y, m, T)); + }), d.restore(), this; + }, + /** + * Returns true if the specified control is visible, false otherwise. + * @param {String} controlKey The key of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @returns {Boolean} true if the specified control is visible, false otherwise + */ + isControlVisible: function(d) { + return this.controls[d] && this.controls[d].getVisibility(this, d); + }, + /** + * Sets the visibility of the specified control. + * @param {String} controlKey The key of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @param {Boolean} visible true to set the specified control visible, false otherwise + * @return {fabric.Object} thisArg + * @chainable + */ + setControlVisible: function(d, m) { + return this._controlsVisibility || (this._controlsVisibility = {}), this._controlsVisibility[d] = m, this; + }, + /** + * Sets the visibility state of object controls. + * @param {Object} [options] Options object + * @param {Boolean} [options.bl] true to enable the bottom-left control, false to disable it + * @param {Boolean} [options.br] true to enable the bottom-right control, false to disable it + * @param {Boolean} [options.mb] true to enable the middle-bottom control, false to disable it + * @param {Boolean} [options.ml] true to enable the middle-left control, false to disable it + * @param {Boolean} [options.mr] true to enable the middle-right control, false to disable it + * @param {Boolean} [options.mt] true to enable the middle-top control, false to disable it + * @param {Boolean} [options.tl] true to enable the top-left control, false to disable it + * @param {Boolean} [options.tr] true to enable the top-right control, false to disable it + * @param {Boolean} [options.mtr] true to enable the middle-top-rotate control, false to disable it + * @return {fabric.Object} thisArg + * @chainable + */ + setControlsVisibility: function(d) { + d || (d = {}); + for (var m in d) + this.setControlVisible(m, d[m]); + return this; + }, + /** + * This callback function is called every time _discardActiveObject or _setActiveObject + * try to to deselect this object. If the function returns true, the process is cancelled + * @param {Object} [options] options sent from the upper functions + * @param {Event} [options.e] event if the process is generated by an event + */ + onDeselect: function() { + }, + /** + * This callback function is called every time _discardActiveObject or _setActiveObject + * try to to select this object. If the function returns true, the process is cancelled + * @param {Object} [options] options sent from the upper functions + * @param {Event} [options.e] event if the process is generated by an event + */ + onSelect: function() { + } + } + ); + }(), c.util.object.extend( + c.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Animation duration (in ms) for fx* methods + * @type Number + * @default + */ + FX_DURATION: 500, + /** + * Centers object horizontally with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxCenterObjectH: function(p, d) { + d = d || {}; + var m = function() { + }, _ = d.onComplete || m, y = d.onChange || m, x = this; + return c.util.animate({ + startValue: p.left, + endValue: this.getCenter().left, + duration: this.FX_DURATION, + onChange: function(g) { + p.set("left", g), x.requestRenderAll(), y(); + }, + onComplete: function() { + p.setCoords(), _(); + } + }), this; + }, + /** + * Centers object vertically with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxCenterObjectV: function(p, d) { + d = d || {}; + var m = function() { + }, _ = d.onComplete || m, y = d.onChange || m, x = this; + return c.util.animate({ + startValue: p.top, + endValue: this.getCenter().top, + duration: this.FX_DURATION, + onChange: function(g) { + p.set("top", g), x.requestRenderAll(), y(); + }, + onComplete: function() { + p.setCoords(), _(); + } + }), this; + }, + /** + * Same as `fabric.Canvas#remove` but animated + * @param {fabric.Object} object Object to remove + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxRemove: function(p, d) { + d = d || {}; + var m = function() { + }, _ = d.onComplete || m, y = d.onChange || m, x = this; + return c.util.animate({ + startValue: p.opacity, + endValue: 0, + duration: this.FX_DURATION, + onChange: function(g) { + p.set("opacity", g), x.requestRenderAll(), y(); + }, + onComplete: function() { + x.remove(p), _(); + } + }), this; + } + } + ), c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * Animates object's properties + * @param {String|Object} property Property to animate (if string) or properties to animate (if object) + * @param {Number|Object} value Value to animate property to (if string was given first) or options object + * @return {fabric.Object} thisArg + * @tutorial {@link http://fabricjs.com/fabric-intro-part-2#animation} + * @chainable + * + * As object — multiple properties + * + * object.animate({ left: ..., top: ... }); + * object.animate({ left: ..., top: ... }, { duration: ... }); + * + * As string — one property + * + * object.animate('left', ...); + * object.animate('left', { duration: ... }); + * + */ + animate: function() { + if (arguments[0] && typeof arguments[0] == "object") { + var p = [], d, m; + for (d in arguments[0]) + p.push(d); + for (var _ = 0, y = p.length; _ < y; _++) + d = p[_], m = _ !== y - 1, this._animate(d, arguments[0][d], arguments[1], m); + } else + this._animate.apply(this, arguments); + return this; + }, + /** + * @private + * @param {String} property Property to animate + * @param {String} to Value to animate to + * @param {Object} [options] Options object + * @param {Boolean} [skipCallbacks] When true, callbacks like onchange and oncomplete are not invoked + */ + _animate: function(p, d, m, _) { + var y = this, x; + d = d.toString(), m ? m = c.util.object.clone(m) : m = {}, ~p.indexOf(".") && (x = p.split(".")); + var g = y.colorProperties.indexOf(p) > -1 || x && y.colorProperties.indexOf(x[1]) > -1, S = x ? this.get(x[0])[x[1]] : this.get(p); + "from" in m || (m.from = S), g || (~d.indexOf("=") ? d = S + parseFloat(d.replace("=", "")) : d = parseFloat(d)); + var T = { + startValue: m.from, + endValue: d, + byValue: m.by, + easing: m.easing, + duration: m.duration, + abort: m.abort && function(C, E, M) { + return m.abort.call(y, C, E, M); + }, + onChange: function(C, E, M) { + x ? y[x[0]][x[1]] = C : y.set(p, C), !_ && m.onChange && m.onChange(C, E, M); + }, + onComplete: function(C, E, M) { + _ || (y.setCoords(), m.onComplete && m.onComplete(C, E, M)); + } + }; + return g ? c.util.animateColor(T.startValue, T.endValue, T.duration, T) : c.util.animate(T); + } + } + ), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.util.object.clone, y = { x1: 1, x2: 1, y1: 1, y2: 1 }; + if (d.Line) { + d.warn("fabric.Line is already defined"); + return; + } + d.Line = d.util.createClass( + d.Object, + /** @lends fabric.Line.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "line", + /** + * x value or first line edge + * @type Number + * @default + */ + x1: 0, + /** + * y value or first line edge + * @type Number + * @default + */ + y1: 0, + /** + * x value or second line edge + * @type Number + * @default + */ + x2: 0, + /** + * y value or second line edge + * @type Number + * @default + */ + y2: 0, + cacheProperties: d.Object.prototype.cacheProperties.concat("x1", "x2", "y1", "y2"), + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + * @return {fabric.Line} thisArg + */ + initialize: function(g, S) { + g || (g = [0, 0, 0, 0]), this.callSuper("initialize", S), this.set("x1", g[0]), this.set("y1", g[1]), this.set("x2", g[2]), this.set("y2", g[3]), this._setWidthHeight(S); + }, + /** + * @private + * @param {Object} [options] Options + */ + _setWidthHeight: function(g) { + g || (g = {}), this.width = Math.abs(this.x2 - this.x1), this.height = Math.abs(this.y2 - this.y1), this.left = "left" in g ? g.left : this._getLeftToOriginX(), this.top = "top" in g ? g.top : this._getTopToOriginY(); + }, + /** + * @private + * @param {String} key + * @param {*} value + */ + _set: function(g, S) { + return this.callSuper("_set", g, S), typeof y[g] != "undefined" && this._setWidthHeight(), this; + }, + /** + * @private + * @return {Number} leftToOriginX Distance from left edge of canvas to originX of Line. + */ + _getLeftToOriginX: x( + { + // property names + origin: "originX", + axis1: "x1", + axis2: "x2", + dimension: "width" + }, + { + // possible values of origin + nearest: "left", + center: "center", + farthest: "right" + } + ), + /** + * @private + * @return {Number} topToOriginY Distance from top edge of canvas to originY of Line. + */ + _getTopToOriginY: x( + { + // property names + origin: "originY", + axis1: "y1", + axis2: "y2", + dimension: "height" + }, + { + // possible values of origin + nearest: "top", + center: "center", + farthest: "bottom" + } + ), + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(g) { + g.beginPath(); + var S = this.calcLinePoints(); + g.moveTo(S.x1, S.y1), g.lineTo(S.x2, S.y2), g.lineWidth = this.strokeWidth; + var T = g.strokeStyle; + g.strokeStyle = this.stroke || g.fillStyle, this.stroke && this._renderStroke(g), g.strokeStyle = T; + }, + /** + * This function is an helper for svg import. it returns the center of the object in the svg + * untransformed coordinates + * @private + * @return {Object} center point from element coordinates + */ + _findCenterFromElement: function() { + return { + x: (this.x1 + this.x2) / 2, + y: (this.y1 + this.y2) / 2 + }; + }, + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(g) { + return m(this.callSuper("toObject", g), this.calcLinePoints()); + }, + /* + * Calculate object dimensions from its properties + * @private + */ + _getNonTransformedDimensions: function() { + var g = this.callSuper("_getNonTransformedDimensions"); + return this.strokeLineCap === "butt" && (this.width === 0 && (g.y -= this.strokeWidth), this.height === 0 && (g.x -= this.strokeWidth)), g; + }, + /** + * Recalculates line points given width and height + * @private + */ + calcLinePoints: function() { + var g = this.x1 <= this.x2 ? -1 : 1, S = this.y1 <= this.y2 ? -1 : 1, T = g * this.width * 0.5, C = S * this.height * 0.5, E = g * this.width * -0.5, M = S * this.height * -0.5; + return { + x1: T, + x2: E, + y1: C, + y2: M + }; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var g = this.calcLinePoints(); + return [ + " +` + ]; + } + /* _TO_SVG_END_ */ + } + ), d.Line.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")), d.Line.fromElement = function(g, S, T) { + T = T || {}; + var C = d.parseAttributes(g, d.Line.ATTRIBUTE_NAMES), E = [ + C.x1 || 0, + C.y1 || 0, + C.x2 || 0, + C.y2 || 0 + ]; + S(new d.Line(E, m(C, T))); + }, d.Line.fromObject = function(g, S) { + function T(E) { + delete E.points, S && S(E); + } + var C = _(g, !0); + C.points = [g.x1, g.y1, g.x2, g.y2], d.Object._fromObject("Line", C, T, "points"); + }; + function x(g, S) { + var T = g.origin, C = g.axis1, E = g.axis2, M = g.dimension, P = S.nearest, R = S.center, N = S.farthest; + return function() { + switch (this.get(T)) { + case P: + return Math.min(this.get(C), this.get(E)); + case R: + return Math.min(this.get(C), this.get(E)) + 0.5 * this.get(M); + case N: + return Math.max(this.get(C), this.get(E)); + } + }; + } + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = Math.PI; + if (d.Circle) { + d.warn("fabric.Circle is already defined."); + return; + } + d.Circle = d.util.createClass( + d.Object, + /** @lends fabric.Circle.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "circle", + /** + * Radius of this circle + * @type Number + * @default + */ + radius: 0, + /** + * Start angle of the circle, moving clockwise + * deprecated type, this should be in degree, this was an oversight. + * probably will change to degrees in next major version + * @type Number + * @default 0 + */ + startAngle: 0, + /** + * End angle of the circle + * deprecated type, this should be in degree, this was an oversight. + * probably will change to degrees in next major version + * @type Number + * @default 2Pi + */ + endAngle: m * 2, + cacheProperties: d.Object.prototype.cacheProperties.concat("radius", "startAngle", "endAngle"), + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Circle} thisArg + */ + _set: function(y, x) { + return this.callSuper("_set", y, x), y === "radius" && this.setRadius(x), this; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(y) { + return this.callSuper("toObject", ["radius", "startAngle", "endAngle"].concat(y)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var y, x = 0, g = 0, S = (this.endAngle - this.startAngle) % (2 * m); + if (S === 0) + y = [ + " +` + ]; + else { + var T = d.util.cos(this.startAngle) * this.radius, C = d.util.sin(this.startAngle) * this.radius, E = d.util.cos(this.endAngle) * this.radius, M = d.util.sin(this.endAngle) * this.radius, P = S > m ? "1" : "0"; + y = [ + ' +` + ]; + } + return y; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render on + */ + _render: function(y) { + y.beginPath(), y.arc( + 0, + 0, + this.radius, + this.startAngle, + this.endAngle, + !1 + ), this._renderPaintInOrder(y); + }, + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusX: function() { + return this.get("radius") * this.get("scaleX"); + }, + /** + * Returns vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusY: function() { + return this.get("radius") * this.get("scaleY"); + }, + /** + * Sets radius of an object (and updates width accordingly) + * @return {fabric.Circle} thisArg + */ + setRadius: function(y) { + return this.radius = y, this.set("width", y * 2).set("height", y * 2); + } + } + ), d.Circle.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")), d.Circle.fromElement = function(y, x) { + var g = d.parseAttributes(y, d.Circle.ATTRIBUTE_NAMES); + if (!_(g)) + throw new Error("value of `r` attribute is required and can not be negative"); + g.left = (g.left || 0) - g.radius, g.top = (g.top || 0) - g.radius, x(new d.Circle(g)); + }; + function _(y) { + return "radius" in y && y.radius >= 0; + } + d.Circle.fromObject = function(y, x) { + d.Object._fromObject("Circle", y, x); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + if (d.Triangle) { + d.warn("fabric.Triangle is already defined"); + return; + } + d.Triangle = d.util.createClass( + d.Object, + /** @lends fabric.Triangle.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "triangle", + /** + * Width is set to 100 to compensate the old initialize code that was setting it to 100 + * @type Number + * @default + */ + width: 100, + /** + * Height is set to 100 to compensate the old initialize code that was setting it to 100 + * @type Number + * @default + */ + height: 100, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(m) { + var _ = this.width / 2, y = this.height / 2; + m.beginPath(), m.moveTo(-_, y), m.lineTo(0, -y), m.lineTo(_, y), m.closePath(), this._renderPaintInOrder(m); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var m = this.width / 2, _ = this.height / 2, y = [ + -m + " " + _, + "0 " + -_, + m + " " + _ + ].join(","); + return [ + "' + ]; + } + /* _TO_SVG_END_ */ + } + ), d.Triangle.fromObject = function(m, _) { + return d.Object._fromObject("Triangle", m, _); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = Math.PI * 2; + if (d.Ellipse) { + d.warn("fabric.Ellipse is already defined."); + return; + } + d.Ellipse = d.util.createClass( + d.Object, + /** @lends fabric.Ellipse.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "ellipse", + /** + * Horizontal radius + * @type Number + * @default + */ + rx: 0, + /** + * Vertical radius + * @type Number + * @default + */ + ry: 0, + cacheProperties: d.Object.prototype.cacheProperties.concat("rx", "ry"), + /** + * Constructor + * @param {Object} [options] Options object + * @return {fabric.Ellipse} thisArg + */ + initialize: function(_) { + this.callSuper("initialize", _), this.set("rx", _ && _.rx || 0), this.set("ry", _ && _.ry || 0); + }, + /** + * @private + * @param {String} key + * @param {*} value + * @return {fabric.Ellipse} thisArg + */ + _set: function(_, y) { + switch (this.callSuper("_set", _, y), _) { + case "rx": + this.rx = y, this.set("width", y * 2); + break; + case "ry": + this.ry = y, this.set("height", y * 2); + break; + } + return this; + }, + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRx: function() { + return this.get("rx") * this.get("scaleX"); + }, + /** + * Returns Vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRy: function() { + return this.get("ry") * this.get("scaleY"); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(_) { + return this.callSuper("toObject", ["rx", "ry"].concat(_)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + return [ + " +` + ]; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render on + */ + _render: function(_) { + _.beginPath(), _.save(), _.transform(1, 0, 0, this.ry / this.rx, 0, 0), _.arc( + 0, + 0, + this.rx, + 0, + m, + !1 + ), _.restore(), this._renderPaintInOrder(_); + } + } + ), d.Ellipse.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")), d.Ellipse.fromElement = function(_, y) { + var x = d.parseAttributes(_, d.Ellipse.ATTRIBUTE_NAMES); + x.left = (x.left || 0) - x.rx, x.top = (x.top || 0) - x.ry, y(new d.Ellipse(x)); + }, d.Ellipse.fromObject = function(_, y) { + d.Object._fromObject("Ellipse", _, y); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend; + if (d.Rect) { + d.warn("fabric.Rect is already defined"); + return; + } + d.Rect = d.util.createClass( + d.Object, + /** @lends fabric.Rect.prototype */ + { + /** + * List of properties to consider when checking if state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: d.Object.prototype.stateProperties.concat("rx", "ry"), + /** + * Type of an object + * @type String + * @default + */ + type: "rect", + /** + * Horizontal border radius + * @type Number + * @default + */ + rx: 0, + /** + * Vertical border radius + * @type Number + * @default + */ + ry: 0, + cacheProperties: d.Object.prototype.cacheProperties.concat("rx", "ry"), + /** + * Constructor + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(_) { + this.callSuper("initialize", _), this._initRxRy(); + }, + /** + * Initializes rx/ry attributes + * @private + */ + _initRxRy: function() { + this.rx && !this.ry ? this.ry = this.rx : this.ry && !this.rx && (this.rx = this.ry); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(_) { + var y = this.rx ? Math.min(this.rx, this.width / 2) : 0, x = this.ry ? Math.min(this.ry, this.height / 2) : 0, g = this.width, S = this.height, T = -this.width / 2, C = -this.height / 2, E = y !== 0 || x !== 0, M = 1 - 0.5522847498; + _.beginPath(), _.moveTo(T + y, C), _.lineTo(T + g - y, C), E && _.bezierCurveTo(T + g - M * y, C, T + g, C + M * x, T + g, C + x), _.lineTo(T + g, C + S - x), E && _.bezierCurveTo(T + g, C + S - M * x, T + g - M * y, C + S, T + g - y, C + S), _.lineTo(T + y, C + S), E && _.bezierCurveTo(T + M * y, C + S, T, C + S - M * x, T, C + S - x), _.lineTo(T, C + x), E && _.bezierCurveTo(T, C + M * x, T + M * y, C, T + y, C), _.closePath(), this._renderPaintInOrder(_); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(_) { + return this.callSuper("toObject", ["rx", "ry"].concat(_)); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var _ = -this.width / 2, y = -this.height / 2; + return [ + " +` + ]; + } + /* _TO_SVG_END_ */ + } + ), d.Rect.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")), d.Rect.fromElement = function(_, y, x) { + if (!_) + return y(null); + x = x || {}; + var g = d.parseAttributes(_, d.Rect.ATTRIBUTE_NAMES); + g.left = g.left || 0, g.top = g.top || 0, g.height = g.height || 0, g.width = g.width || 0; + var S = new d.Rect(m(x ? d.util.object.clone(x) : {}, g)); + S.visible = S.visible && S.width > 0 && S.height > 0, y(S); + }, d.Rect.fromObject = function(_, y) { + return d.Object._fromObject("Rect", _, y); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.util.array.min, y = d.util.array.max, x = d.util.toFixed; + if (d.Polyline) { + d.warn("fabric.Polyline is already defined"); + return; + } + d.Polyline = d.util.createClass( + d.Object, + /** @lends fabric.Polyline.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "polyline", + /** + * Points array + * @type Array + * @default + */ + points: null, + cacheProperties: d.Object.prototype.cacheProperties.concat("points"), + /** + * Constructor + * @param {Array} points Array of points (where each point is an object with x and y) + * @param {Object} [options] Options object + * @return {fabric.Polyline} thisArg + * @example + * var poly = new fabric.Polyline([ + * { x: 10, y: 10 }, + * { x: 50, y: 30 }, + * { x: 40, y: 70 }, + * { x: 60, y: 50 }, + * { x: 100, y: 150 }, + * { x: 40, y: 100 } + * ], { + * stroke: 'red', + * left: 100, + * top: 100 + * }); + */ + initialize: function(g, S) { + S = S || {}, this.points = g || [], this.callSuper("initialize", S), this._setPositionDimensions(S); + }, + _setPositionDimensions: function(g) { + var S = this._calcDimensions(g), T; + this.width = S.width, this.height = S.height, g.fromSVG || (T = this.translateToGivenOrigin( + { x: S.left - this.strokeWidth / 2, y: S.top - this.strokeWidth / 2 }, + "left", + "top", + this.originX, + this.originY + )), typeof g.left == "undefined" && (this.left = g.fromSVG ? S.left : T.x), typeof g.top == "undefined" && (this.top = g.fromSVG ? S.top : T.y), this.pathOffset = { + x: S.left + this.width / 2, + y: S.top + this.height / 2 + }; + }, + /** + * Calculate the polygon min and max point from points array, + * returning an object with left, top, width, height to measure the + * polygon size + * @return {Object} object.left X coordinate of the polygon leftmost point + * @return {Object} object.top Y coordinate of the polygon topmost point + * @return {Object} object.width distance between X coordinates of the polygon leftmost and rightmost point + * @return {Object} object.height distance between Y coordinates of the polygon topmost and bottommost point + * @private + */ + _calcDimensions: function() { + var g = this.points, S = _(g, "x") || 0, T = _(g, "y") || 0, C = y(g, "x") || 0, E = y(g, "y") || 0, M = C - S, P = E - T; + return { + left: S, + top: T, + width: M, + height: P + }; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(g) { + return m(this.callSuper("toObject", g), { + points: this.points.concat() + }); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + for (var g = [], S = this.pathOffset.x, T = this.pathOffset.y, C = d.Object.NUM_FRACTION_DIGITS, E = 0, M = this.points.length; E < M; E++) + g.push( + x(this.points[E].x - S, C), + ",", + x(this.points[E].y - T, C), + " " + ); + return [ + "<" + this.type + " ", + "COMMON_PARTS", + 'points="', + g.join(""), + `" /> +` + ]; + }, + /* _TO_SVG_END_ */ + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + commonRender: function(g) { + var S, T = this.points.length, C = this.pathOffset.x, E = this.pathOffset.y; + if (!T || isNaN(this.points[T - 1].y)) + return !1; + g.beginPath(), g.moveTo(this.points[0].x - C, this.points[0].y - E); + for (var M = 0; M < T; M++) + S = this.points[M], g.lineTo(S.x - C, S.y - E); + return !0; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(g) { + this.commonRender(g) && this._renderPaintInOrder(g); + }, + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity: function() { + return this.get("points").length; + } + } + ), d.Polyline.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat(), d.Polyline.fromElementGenerator = function(g) { + return function(S, T, C) { + if (!S) + return T(null); + C || (C = {}); + var E = d.parsePointsAttribute(S.getAttribute("points")), M = d.parseAttributes(S, d[g].ATTRIBUTE_NAMES); + M.fromSVG = !0, T(new d[g](E, m(M, C))); + }; + }, d.Polyline.fromElement = d.Polyline.fromElementGenerator("Polyline"), d.Polyline.fromObject = function(g, S) { + return d.Object._fromObject("Polyline", g, S, "points"); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + if (d.Polygon) { + d.warn("fabric.Polygon is already defined"); + return; + } + d.Polygon = d.util.createClass( + d.Polyline, + /** @lends fabric.Polygon.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "polygon", + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(m) { + this.commonRender(m) && (m.closePath(), this._renderPaintInOrder(m)); + } + } + ), d.Polygon.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat(), d.Polygon.fromElement = d.Polyline.fromElementGenerator("Polygon"), d.Polygon.fromObject = function(m, _) { + d.Object._fromObject("Polygon", m, _, "points"); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.array.min, _ = d.util.array.max, y = d.util.object.extend, x = Object.prototype.toString, g = d.util.toFixed; + if (d.Path) { + d.warn("fabric.Path is already defined"); + return; + } + d.Path = d.util.createClass( + d.Object, + /** @lends fabric.Path.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "path", + /** + * Array of path points + * @type Array + * @default + */ + path: null, + cacheProperties: d.Object.prototype.cacheProperties.concat("path", "fillRule"), + stateProperties: d.Object.prototype.stateProperties.concat("path"), + /** + * Constructor + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + * @return {fabric.Path} thisArg + */ + initialize: function(S, T) { + T = T || {}, this.callSuper("initialize", T), S || (S = []); + var C = x.call(S) === "[object Array]"; + this.path = d.util.makePathSimpler( + C ? S : d.util.parsePath(S) + ), this.path && d.Polyline.prototype._setPositionDimensions.call(this, T); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render path on + */ + _renderPathCommands: function(S) { + var T, C = 0, E = 0, M = 0, P = 0, R = 0, N = 0, F = -this.pathOffset.x, U = -this.pathOffset.y; + S.beginPath(); + for (var $ = 0, G = this.path.length; $ < G; ++$) + switch (T = this.path[$], T[0]) { + case "L": + M = T[1], P = T[2], S.lineTo(M + F, P + U); + break; + case "M": + M = T[1], P = T[2], C = M, E = P, S.moveTo(M + F, P + U); + break; + case "C": + M = T[5], P = T[6], R = T[3], N = T[4], S.bezierCurveTo( + T[1] + F, + T[2] + U, + R + F, + N + U, + M + F, + P + U + ); + break; + case "Q": + S.quadraticCurveTo( + T[1] + F, + T[2] + U, + T[3] + F, + T[4] + U + ), M = T[3], P = T[4], R = T[1], N = T[2]; + break; + case "z": + case "Z": + M = C, P = E, S.closePath(); + break; + } + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx context to render path on + */ + _render: function(S) { + this._renderPathCommands(S), this._renderPaintInOrder(S); + }, + /** + * Returns string representation of an instance + * @return {String} string representation of an instance + */ + toString: function() { + return "#"; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(S) { + return y(this.callSuper("toObject", S), { + path: this.path.map(function(T) { + return T.slice(); + }) + }); + }, + /** + * Returns dataless object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(S) { + var T = this.toObject(["sourcePath"].concat(S)); + return T.sourcePath && delete T.path, T; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var S = d.util.joinPath(this.path); + return [ + " +` + ]; + }, + _getOffsetTransform: function() { + var S = d.Object.NUM_FRACTION_DIGITS; + return " translate(" + g(-this.pathOffset.x, S) + ", " + g(-this.pathOffset.y, S) + ")"; + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(S) { + var T = this._getOffsetTransform(); + return " " + this._createBaseClipPathSVGMarkup( + this._toSVG(), + { reviver: S, additionalTransform: T } + ); + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(S) { + var T = this._getOffsetTransform(); + return this._createBaseSVGMarkup(this._toSVG(), { reviver: S, additionalTransform: T }); + }, + /* _TO_SVG_END_ */ + /** + * Returns number representation of an instance complexity + * @return {Number} complexity of this instance + */ + complexity: function() { + return this.path.length; + }, + /** + * @private + */ + _calcDimensions: function() { + for (var S = [], T = [], C, E = 0, M = 0, P = 0, R = 0, N, F = 0, U = this.path.length; F < U; ++F) { + switch (C = this.path[F], C[0]) { + case "L": + P = C[1], R = C[2], N = []; + break; + case "M": + P = C[1], R = C[2], E = P, M = R, N = []; + break; + case "C": + N = d.util.getBoundsOfCurve( + P, + R, + C[1], + C[2], + C[3], + C[4], + C[5], + C[6] + ), P = C[5], R = C[6]; + break; + case "Q": + N = d.util.getBoundsOfCurve( + P, + R, + C[1], + C[2], + C[1], + C[2], + C[3], + C[4] + ), P = C[3], R = C[4]; + break; + case "z": + case "Z": + P = E, R = M; + break; + } + N.forEach(function(fe) { + S.push(fe.x), T.push(fe.y); + }), S.push(P), T.push(R); + } + var $ = m(S) || 0, G = m(T) || 0, Q = _(S) || 0, ee = _(T) || 0, ce = Q - $, ne = ee - G; + return { + left: $, + top: G, + width: ce, + height: ne + }; + } + } + ), d.Path.fromObject = function(S, T) { + if (typeof S.sourcePath == "string") { + var C = S.sourcePath; + d.loadSVGFromURL(C, function(E) { + var M = E[0]; + M.setOptions(S), T && T(M); + }); + } else + d.Object._fromObject("Path", S, T, "path"); + }, d.Path.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat(["d"]), d.Path.fromElement = function(S, T, C) { + var E = d.parseAttributes(S, d.Path.ATTRIBUTE_NAMES); + E.fromSVG = !0, T(new d.Path(E.d, y(E, C))); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.array.min, _ = d.util.array.max; + d.Group || (d.Group = d.util.createClass( + d.Object, + d.Collection, + /** @lends fabric.Group.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "group", + /** + * Width of stroke + * @type Number + * @default + */ + strokeWidth: 0, + /** + * Indicates if click, mouseover, mouseout events & hoverCursor should also check for subtargets + * @type Boolean + * @default + */ + subTargetCheck: !1, + /** + * Groups are container, do not render anything on theyr own, ence no cache properties + * @type Array + * @default + */ + cacheProperties: [], + /** + * setOnGroup is a method used for TextBox that is no more used since 2.0.0 The behavior is still + * available setting this boolean to true. + * @type Boolean + * @since 2.0.0 + * @default + */ + useSetOnGroup: !1, + /** + * Constructor + * @param {Object} objects Group objects + * @param {Object} [options] Options object + * @param {Boolean} [isAlreadyGrouped] if true, objects have been grouped already. + * @return {Object} thisArg + */ + initialize: function(y, x, g) { + x = x || {}, this._objects = [], g && this.callSuper("initialize", x), this._objects = y || []; + for (var S = this._objects.length; S--; ) + this._objects[S].group = this; + if (g) + this._updateObjectsACoords(); + else { + var T = x && x.centerPoint; + x.originX !== void 0 && (this.originX = x.originX), x.originY !== void 0 && (this.originY = x.originY), T || this._calcBounds(), this._updateObjectsCoords(T), delete x.centerPoint, this.callSuper("initialize", x); + } + this.setCoords(); + }, + /** + * @private + */ + _updateObjectsACoords: function() { + for (var y = !0, x = this._objects.length; x--; ) + this._objects[x].setCoords(y); + }, + /** + * @private + * @param {Boolean} [skipCoordsChange] if true, coordinates of objects enclosed in a group do not change + */ + _updateObjectsCoords: function(x) { + for (var x = x || this.getCenterPoint(), g = this._objects.length; g--; ) + this._updateObjectCoords(this._objects[g], x); + }, + /** + * @private + * @param {Object} object + * @param {fabric.Point} center, current center of group. + */ + _updateObjectCoords: function(y, x) { + var g = y.left, S = y.top, T = !0; + y.set({ + left: g - x.x, + top: S - x.y + }), y.group = this, y.setCoords(T); + }, + /** + * Returns string represenation of a group + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Adds an object to a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + addWithUpdate: function(y) { + var x = !!this.group; + return this._restoreObjectsState(), d.util.resetObjectTransform(this), y && (x && d.util.removeTransformFromObject(y, this.group.calcTransformMatrix()), this._objects.push(y), y.group = this, y._set("canvas", this.canvas)), this._calcBounds(), this._updateObjectsCoords(), this.dirty = !0, x ? this.group.addWithUpdate() : this.setCoords(), this; + }, + /** + * Removes an object from a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + removeWithUpdate: function(y) { + return this._restoreObjectsState(), d.util.resetObjectTransform(this), this.remove(y), this._calcBounds(), this._updateObjectsCoords(), this.setCoords(), this.dirty = !0, this; + }, + /** + * @private + */ + _onObjectAdded: function(y) { + this.dirty = !0, y.group = this, y._set("canvas", this.canvas); + }, + /** + * @private + */ + _onObjectRemoved: function(y) { + this.dirty = !0, delete y.group; + }, + /** + * @private + */ + _set: function(y, x) { + var g = this._objects.length; + if (this.useSetOnGroup) + for (; g--; ) + this._objects[g].setOnGroup(y, x); + if (y === "canvas") + for (; g--; ) + this._objects[g]._set(y, x); + d.Object.prototype._set.call(this, y, x); + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(y) { + var x = this.includeDefaultValues, g = this._objects.filter(function(T) { + return !T.excludeFromExport; + }).map(function(T) { + var C = T.includeDefaultValues; + T.includeDefaultValues = x; + var E = T.toObject(y); + return T.includeDefaultValues = C, E; + }), S = d.Object.prototype.toObject.call(this, y); + return S.objects = g, S; + }, + /** + * Returns object representation of an instance, in dataless mode. + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject: function(y) { + var x, g = this.sourcePath; + if (g) + x = g; + else { + var S = this.includeDefaultValues; + x = this._objects.map(function(C) { + var E = C.includeDefaultValues; + C.includeDefaultValues = S; + var M = C.toDatalessObject(y); + return C.includeDefaultValues = E, M; + }); + } + var T = d.Object.prototype.toDatalessObject.call(this, y); + return T.objects = x, T; + }, + /** + * Renders instance on a given context + * @param {CanvasRenderingContext2D} ctx context to render instance on + */ + render: function(y) { + this._transformDone = !0, this.callSuper("render", y), this._transformDone = !1; + }, + /** + * Decide if the object should cache or not. Create its own cache level + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group is already cached. + * @return {Boolean} + */ + shouldCache: function() { + var y = d.Object.prototype.shouldCache.call(this); + if (y) { + for (var x = 0, g = this._objects.length; x < g; x++) + if (this._objects[x].willDrawShadow()) + return this.ownCaching = !1, !1; + } + return y; + }, + /** + * Check if this object or a child object will cast a shadow + * @return {Boolean} + */ + willDrawShadow: function() { + if (d.Object.prototype.willDrawShadow.call(this)) + return !0; + for (var y = 0, x = this._objects.length; y < x; y++) + if (this._objects[y].willDrawShadow()) + return !0; + return !1; + }, + /** + * Check if this group or its parent group are caching, recursively up + * @return {Boolean} + */ + isOnACache: function() { + return this.ownCaching || this.group && this.group.isOnACache(); + }, + /** + * Execute the drawing operation for an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawObject: function(y) { + for (var x = 0, g = this._objects.length; x < g; x++) + this._objects[x].render(y); + this._drawClipPath(y); + }, + /** + * Check if cache is dirty + */ + isCacheDirty: function(y) { + if (this.callSuper("isCacheDirty", y)) + return !0; + if (!this.statefullCache) + return !1; + for (var x = 0, g = this._objects.length; x < g; x++) + if (this._objects[x].isCacheDirty(!0)) { + if (this._cacheCanvas) { + var S = this.cacheWidth / this.zoomX, T = this.cacheHeight / this.zoomY; + this._cacheContext.clearRect(-S / 2, -T / 2, S, T); + } + return !0; + } + return !1; + }, + /** + * Restores original state of each of group objects (original state is that which was before group was created). + * if the nested boolean is true, the original state will be restored just for the + * first group and not for all the group chain + * @private + * @param {Boolean} nested tell the function to restore object state up to the parent group and not more + * @return {fabric.Group} thisArg + * @chainable + */ + _restoreObjectsState: function() { + var y = this.calcOwnMatrix(); + return this._objects.forEach(function(x) { + d.util.addTransformToObject(x, y), delete x.group, x.setCoords(); + }), this; + }, + /** + * Realises the transform from this group onto the supplied object + * i.e. it tells you what would happen if the supplied object was in + * the group, and then the group was destroyed. It mutates the supplied + * object. + * Warning: this method is not useful anymore, it has been kept to no break the api. + * is not used in the fabricJS codebase + * this method will be reduced to using the utility. + * @private + * @deprecated + * @param {fabric.Object} object + * @param {Array} parentMatrix parent transformation + * @return {fabric.Object} transformedObject + */ + realizeTransform: function(y, x) { + return d.util.addTransformToObject(y, x), y; + }, + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + destroy: function() { + return this._objects.forEach(function(y) { + y.set("dirty", !0); + }), this._restoreObjectsState(); + }, + /** + * make a group an active selection, remove the group from canvas + * the group has to be on canvas for this to work. + * @return {fabric.ActiveSelection} thisArg + * @chainable + */ + toActiveSelection: function() { + if (this.canvas) { + var y = this._objects, x = this.canvas; + this._objects = []; + var g = this.toObject(); + delete g.objects; + var S = new d.ActiveSelection([]); + return S.set(g), S.type = "activeSelection", x.remove(this), y.forEach(function(T) { + T.group = S, T.dirty = !0, x.add(T); + }), S.canvas = x, S._objects = y, x._activeObject = S, S.setCoords(), S; + } + }, + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + ungroupOnCanvas: function() { + return this._restoreObjectsState(); + }, + /** + * Sets coordinates of all objects inside group + * @return {fabric.Group} thisArg + * @chainable + */ + setObjectsCoords: function() { + var y = !0; + return this.forEachObject(function(x) { + x.setCoords(y); + }), this; + }, + /** + * @private + */ + _calcBounds: function(y) { + for (var x = [], g = [], S, T, C, E = ["tr", "br", "bl", "tl"], M = 0, P = this._objects.length, R, N = E.length; M < P; ++M) { + for (S = this._objects[M], C = S.calcACoords(), R = 0; R < N; R++) + T = E[R], x.push(C[T].x), g.push(C[T].y); + S.aCoords = C; + } + this._getBounds(x, g, y); + }, + /** + * @private + */ + _getBounds: function(y, x, g) { + var S = new d.Point(m(y), m(x)), T = new d.Point(_(y), _(x)), C = S.y || 0, E = S.x || 0, M = T.x - S.x || 0, P = T.y - S.y || 0; + this.width = M, this.height = P, g || this.setPositionByOrigin({ x: E, y: C }, "left", "top"); + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + _toSVG: function(y) { + for (var x = [" +`], g = 0, S = this._objects.length; g < S; g++) + x.push(" ", this._objects[g].toSVG(y)); + return x.push(` +`), x; + }, + /** + * Returns styles-string for svg-export, specific version for group + * @return {String} + */ + getSvgStyles: function() { + var y = typeof this.opacity != "undefined" && this.opacity !== 1 ? "opacity: " + this.opacity + ";" : "", x = this.visible ? "" : " visibility: hidden;"; + return [ + y, + this.getSvgFilter(), + x + ].join(""); + }, + /** + * Returns svg clipPath representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toClipPathSVG: function(y) { + for (var x = [], g = 0, S = this._objects.length; g < S; g++) + x.push(" ", this._objects[g].toClipPathSVG(y)); + return this._createBaseClipPathSVGMarkup(x, { reviver: y }); + } + /* _TO_SVG_END_ */ + } + ), d.Group.fromObject = function(y, x) { + var g = y.objects, S = d.util.object.clone(y, !0); + if (delete S.objects, typeof g == "string") { + d.loadSVGFromURL(g, function(T) { + var C = d.util.groupSVGElements(T, y, g); + C.set(S), x && x(C); + }); + return; + } + d.util.enlivenObjects(g, function(T) { + d.util.enlivenObjects([y.clipPath], function(C) { + var E = d.util.object.clone(y, !0); + E.clipPath = C[0], delete E.objects, x && x(new d.Group(T, E, !0)); + }); + }); + }); + }(l), function(p) { + var d = p.fabric || (p.fabric = {}); + d.ActiveSelection || (d.ActiveSelection = d.util.createClass( + d.Group, + /** @lends fabric.ActiveSelection.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "activeSelection", + /** + * Constructor + * @param {Object} objects ActiveSelection objects + * @param {Object} [options] Options object + * @return {Object} thisArg + */ + initialize: function(m, _) { + _ = _ || {}, this._objects = m || []; + for (var y = this._objects.length; y--; ) + this._objects[y].group = this; + _.originX && (this.originX = _.originX), _.originY && (this.originY = _.originY), this._calcBounds(), this._updateObjectsCoords(), d.Object.prototype.initialize.call(this, _), this.setCoords(); + }, + /** + * Change te activeSelection to a normal group, + * High level function that automatically adds it to canvas as + * active object. no events fired. + * @since 2.0.0 + * @return {fabric.Group} + */ + toGroup: function() { + var m = this._objects.concat(); + this._objects = []; + var _ = d.Object.prototype.toObject.call(this), y = new d.Group([]); + if (delete _.type, y.set(_), m.forEach(function(g) { + g.canvas.remove(g), g.group = y; + }), y._objects = m, !this.canvas) + return y; + var x = this.canvas; + return x.add(y), x._activeObject = y, y.setCoords(), y; + }, + /** + * If returns true, deselection is cancelled. + * @since 2.0.0 + * @return {Boolean} [cancel] + */ + onDeselect: function() { + return this.destroy(), !1; + }, + /** + * Returns string representation of a group + * @return {String} + */ + toString: function() { + return "#"; + }, + /** + * Decide if the object should cache or not. Create its own cache level + * objectCaching is a global flag, wins over everything + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * @return {Boolean} + */ + shouldCache: function() { + return !1; + }, + /** + * Check if this group or its parent group are caching, recursively up + * @return {Boolean} + */ + isOnACache: function() { + return !1; + }, + /** + * Renders controls and borders for the object + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [styleOverride] properties to override the object style + * @param {Object} [childrenOverride] properties to override the children overrides + */ + _renderControls: function(m, _, y) { + m.save(), m.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1, this.callSuper("_renderControls", m, _), y = y || {}, typeof y.hasControls == "undefined" && (y.hasControls = !1), y.forActiveSelection = !0; + for (var x = 0, g = this._objects.length; x < g; x++) + this._objects[x]._renderControls(m, y); + m.restore(); + } + } + ), d.ActiveSelection.fromObject = function(m, _) { + d.util.enlivenObjects(m.objects, function(y) { + delete m.objects, _ && _(new d.ActiveSelection(y, m, !0)); + }); + }); + }(l), function(p) { + var d = c.util.object.extend; + if (p.fabric || (p.fabric = {}), p.fabric.Image) { + c.warn("fabric.Image is already defined."); + return; + } + c.Image = c.util.createClass( + c.Object, + /** @lends fabric.Image.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "image", + /** + * Width of a stroke. + * For image quality a stroke multiple of 2 gives better results. + * @type Number + * @default + */ + strokeWidth: 0, + /** + * When calling {@link fabric.Image.getSrc}, return value from element src with `element.getAttribute('src')`. + * This allows for relative urls as image src. + * @since 2.7.0 + * @type Boolean + * @default + */ + srcFromAttribute: !1, + /** + * private + * contains last value of scaleX to detect + * if the Image got resized after the last Render + * @type Number + */ + _lastScaleX: 1, + /** + * private + * contains last value of scaleY to detect + * if the Image got resized after the last Render + * @type Number + */ + _lastScaleY: 1, + /** + * private + * contains last value of scaling applied by the apply filter chain + * @type Number + */ + _filterScalingX: 1, + /** + * private + * contains last value of scaling applied by the apply filter chain + * @type Number + */ + _filterScalingY: 1, + /** + * minimum scale factor under which any resizeFilter is triggered to resize the image + * 0 will disable the automatic resize. 1 will trigger automatically always. + * number bigger than 1 are not implemented yet. + * @type Number + */ + minimumScaleTrigger: 0.5, + /** + * List of properties to consider when checking if + * state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: c.Object.prototype.stateProperties.concat("cropX", "cropY"), + /** + * List of properties to consider when checking if cache needs refresh + * Those properties are checked by statefullCache ON ( or lazy mode if we want ) or from single + * calls to Object.set(key, value). If the key is in this list, the object is marked as dirty + * and refreshed at the next render + * @type Array + */ + cacheProperties: c.Object.prototype.cacheProperties.concat("cropX", "cropY"), + /** + * key used to retrieve the texture representing this image + * @since 2.0.0 + * @type String + * @default + */ + cacheKey: "", + /** + * Image crop in pixels from original image size. + * @since 2.0.0 + * @type Number + * @default + */ + cropX: 0, + /** + * Image crop in pixels from original image size. + * @since 2.0.0 + * @type Number + * @default + */ + cropY: 0, + /** + * Indicates whether this canvas will use image smoothing when painting this image. + * Also influence if the cacheCanvas for this image uses imageSmoothing + * @since 4.0.0-beta.11 + * @type Boolean + * @default + */ + imageSmoothing: !0, + /** + * Constructor + * Image can be initialized with any canvas drawable or a string. + * The string should be a url and will be loaded as an image. + * Canvas and Image element work out of the box, while videos require extra code to work. + * Please check video element events for seeking. + * @param {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String} element Image element + * @param {Object} [options] Options object + * @param {function} [callback] callback function to call after eventual filters applied. + * @return {fabric.Image} thisArg + */ + initialize: function(m, _) { + _ || (_ = {}), this.filters = [], this.cacheKey = "texture" + c.Object.__uid++, this.callSuper("initialize", _), this._initElement(m, _); + }, + /** + * Returns image element which this instance if based on + * @return {HTMLImageElement} Image element + */ + getElement: function() { + return this._element || {}; + }, + /** + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Object} [options] Options object + * @return {fabric.Image} thisArg + * @chainable + */ + setElement: function(m, _) { + return this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._element = m, this._originalElement = m, this._initConfig(_), this.filters.length !== 0 && this.applyFilters(), this.resizeFilter && this.applyResizeFilters(), this; + }, + /** + * Delete a single texture if in webgl mode + */ + removeTexture: function(m) { + var _ = c.filterBackend; + _ && _.evictCachesForKey && _.evictCachesForKey(m); + }, + /** + * Delete textures, reference to elements and eventually JSDOM cleanup + */ + dispose: function() { + this.removeTexture(this.cacheKey), this.removeTexture(this.cacheKey + "_filtered"), this._cacheContext = void 0, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach(function(m) { + c.util.cleanUpJsdomNode(this[m]), this[m] = void 0; + }.bind(this)); + }, + /** + * Get the crossOrigin value (of the corresponding image element) + */ + getCrossOrigin: function() { + return this._originalElement && (this._originalElement.crossOrigin || null); + }, + /** + * Returns original size of an image + * @return {Object} Object with "width" and "height" properties + */ + getOriginalSize: function() { + var m = this.getElement(); + return { + width: m.naturalWidth || m.width, + height: m.naturalHeight || m.height + }; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _stroke: function(m) { + if (!(!this.stroke || this.strokeWidth === 0)) { + var _ = this.width / 2, y = this.height / 2; + m.beginPath(), m.moveTo(-_, -y), m.lineTo(_, -y), m.lineTo(_, y), m.lineTo(-_, y), m.lineTo(-_, -y), m.closePath(); + } + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(m) { + var _ = []; + this.filters.forEach(function(x) { + x && _.push(x.toObject()); + }); + var y = d( + this.callSuper( + "toObject", + ["cropX", "cropY"].concat(m) + ), + { + src: this.getSrc(), + crossOrigin: this.getCrossOrigin(), + filters: _ + } + ); + return this.resizeFilter && (y.resizeFilter = this.resizeFilter.toObject()), y; + }, + /** + * Returns true if an image has crop applied, inspecting values of cropX,cropY,width,height. + * @return {Boolean} + */ + hasCrop: function() { + return this.cropX || this.cropY || this.width < this._element.width || this.height < this._element.height; + }, + /* _TO_SVG_START_ */ + /** + * Returns svg representation of an instance + * @return {Array} an array of strings with the specific svg representation + * of the instance + */ + _toSVG: function() { + var m = [], _ = [], y, x = this._element, g = -this.width / 2, S = -this.height / 2, T = "", C = ""; + if (!x) + return []; + if (this.hasCrop()) { + var E = c.Object.__uid++; + m.push( + ' +`, + ' +`, + ` +` + ), T = ' clip-path="url(#imageCrop_' + E + ')" '; + } + if (this.imageSmoothing || (C = '" image-rendering="optimizeSpeed'), _.push( + " +` + ), this.stroke || this.strokeDashArray) { + var M = this.fill; + this.fill = null, y = [ + " +` + ], this.fill = M; + } + return this.paintFirst !== "fill" ? m = m.concat(y, _) : m = m.concat(_, y), m; + }, + /* _TO_SVG_END_ */ + /** + * Returns source of an image + * @param {Boolean} filtered indicates if the src is needed for svg + * @return {String} Source of an image + */ + getSrc: function(m) { + var _ = m ? this._element : this._originalElement; + return _ ? _.toDataURL ? _.toDataURL() : this.srcFromAttribute ? _.getAttribute("src") : _.src : this.src || ""; + }, + /** + * Sets source of an image + * @param {String} src Source string (URL) + * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) + * @param {Object} [options] Options object + * @param {String} [options.crossOrigin] crossOrigin value (one of "", "anonymous", "use-credentials") + * @see https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes + * @return {fabric.Image} thisArg + * @chainable + */ + setSrc: function(m, _, y) { + return c.util.loadImage(m, function(x, g) { + this.setElement(x, y), this._setWidthHeight(), _ && _(this, g); + }, this, y && y.crossOrigin), this; + }, + /** + * Returns string representation of an instance + * @return {String} String representation of an instance + */ + toString: function() { + return '#'; + }, + applyResizeFilters: function() { + var m = this.resizeFilter, _ = this.minimumScaleTrigger, y = this.getTotalObjectScaling(), x = y.scaleX, g = y.scaleY, S = this._filteredEl || this._originalElement; + if (this.group && this.set("dirty", !0), !m || x > _ && g > _) { + this._element = S, this._filterScalingX = 1, this._filterScalingY = 1, this._lastScaleX = x, this._lastScaleY = g; + return; + } + c.filterBackend || (c.filterBackend = c.initFilterBackend()); + var T = c.util.createCanvasElement(), C = this._filteredEl ? this.cacheKey + "_filtered" : this.cacheKey, E = S.width, M = S.height; + T.width = E, T.height = M, this._element = T, this._lastScaleX = m.scaleX = x, this._lastScaleY = m.scaleY = g, c.filterBackend.applyFilters( + [m], + S, + E, + M, + this._element, + C + ), this._filterScalingX = T.width / this._originalElement.width, this._filterScalingY = T.height / this._originalElement.height; + }, + /** + * Applies filters assigned to this image (from "filters" array) or from filter param + * @method applyFilters + * @param {Array} filters to be applied + * @param {Boolean} forResizing specify if the filter operation is a resize operation + * @return {thisArg} return the fabric.Image object + * @chainable + */ + applyFilters: function(m) { + if (m = m || this.filters || [], m = m.filter(function(S) { + return S && !S.isNeutralState(); + }), this.set("dirty", !0), this.removeTexture(this.cacheKey + "_filtered"), m.length === 0) + return this._element = this._originalElement, this._filteredEl = null, this._filterScalingX = 1, this._filterScalingY = 1, this; + var _ = this._originalElement, y = _.naturalWidth || _.width, x = _.naturalHeight || _.height; + if (this._element === this._originalElement) { + var g = c.util.createCanvasElement(); + g.width = y, g.height = x, this._element = g, this._filteredEl = g; + } else + this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, y, x), this._lastScaleX = 1, this._lastScaleY = 1; + return c.filterBackend || (c.filterBackend = c.initFilterBackend()), c.filterBackend.applyFilters( + m, + this._originalElement, + y, + x, + this._element, + this.cacheKey + ), (this._originalElement.width !== this._element.width || this._originalElement.height !== this._element.height) && (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height), this; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(m) { + c.util.setImageSmoothing(m, this.imageSmoothing), this.isMoving !== !0 && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(m), this._renderPaintInOrder(m); + }, + /** + * Paint the cached copy of the object on the target context. + * it will set the imageSmoothing for the draw operation + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + drawCacheOnCanvas: function(m) { + c.util.setImageSmoothing(m, this.imageSmoothing), c.Object.prototype.drawCacheOnCanvas.call(this, m); + }, + /** + * Decide if the object should cache or not. Create its own cache level + * needsItsOwnCache should be used when the object drawing method requires + * a cache step. None of the fabric classes requires it. + * Generally you do not cache objects in groups because the group outside is cached. + * This is the special image version where we would like to avoid caching where possible. + * Essentially images do not benefit from caching. They may require caching, and in that + * case we do it. Also caching an image usually ends in a loss of details. + * A full performance audit should be done. + * @return {Boolean} + */ + shouldCache: function() { + return this.needsItsOwnCache(); + }, + _renderFill: function(m) { + var _ = this._element; + if (_) { + var y = this._filterScalingX, x = this._filterScalingY, g = this.width, S = this.height, T = Math.min, C = Math.max, E = C(this.cropX, 0), M = C(this.cropY, 0), P = _.naturalWidth || _.width, R = _.naturalHeight || _.height, N = E * y, F = M * x, U = T(g * y, P - N), $ = T(S * x, R - F), G = -g / 2, Q = -S / 2, ee = T(g, P / y - E), ce = T(S, R / x - M); + _ && m.drawImage(_, N, F, U, $, G, Q, ee, ce); + } + }, + /** + * needed to check if image needs resize + * @private + */ + _needsResize: function() { + var m = this.getTotalObjectScaling(); + return m.scaleX !== this._lastScaleX || m.scaleY !== this._lastScaleY; + }, + /** + * @private + */ + _resetWidthHeight: function() { + this.set(this.getOriginalSize()); + }, + /** + * The Image class's initialization method. This method is automatically + * called by the constructor. + * @private + * @param {HTMLImageElement|String} element The element representing the image + * @param {Object} [options] Options object + */ + _initElement: function(m, _) { + this.setElement(c.util.getById(m), _), c.util.addClass(this.getElement(), c.Image.CSS_CANVAS); + }, + /** + * @private + * @param {Object} [options] Options object + */ + _initConfig: function(m) { + m || (m = {}), this.setOptions(m), this._setWidthHeight(m); + }, + /** + * @private + * @param {Array} filters to be initialized + * @param {Function} callback Callback to invoke when all fabric.Image.filters instances are created + */ + _initFilters: function(m, _) { + m && m.length ? c.util.enlivenObjects(m, function(y) { + _ && _(y); + }, "fabric.Image.filters") : _ && _(); + }, + /** + * @private + * Set the width and the height of the image object, using the element or the + * options. + * @param {Object} [options] Object with width/height properties + */ + _setWidthHeight: function(m) { + m || (m = {}); + var _ = this.getElement(); + this.width = m.width || _.naturalWidth || _.width || 0, this.height = m.height || _.naturalHeight || _.height || 0; + }, + /** + * Calculate offset for center and scale factor for the image in order to respect + * the preserveAspectRatio attribute + * @private + * @return {Object} + */ + parsePreserveAspectRatioAttribute: function() { + var m = c.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio || ""), _ = this._element.width, y = this._element.height, x = 1, g = 1, S = 0, T = 0, C = 0, E = 0, M, P = this.width, R = this.height, N = { width: P, height: R }; + return m && (m.alignX !== "none" || m.alignY !== "none") ? (m.meetOrSlice === "meet" && (x = g = c.util.findScaleToFit(this._element, N), M = (P - _ * x) / 2, m.alignX === "Min" && (S = -M), m.alignX === "Max" && (S = M), M = (R - y * g) / 2, m.alignY === "Min" && (T = -M), m.alignY === "Max" && (T = M)), m.meetOrSlice === "slice" && (x = g = c.util.findScaleToCover(this._element, N), M = _ - P / x, m.alignX === "Mid" && (C = M / 2), m.alignX === "Max" && (C = M), M = y - R / g, m.alignY === "Mid" && (E = M / 2), m.alignY === "Max" && (E = M), _ = P / x, y = R / g)) : (x = P / _, g = R / y), { + width: _, + height: y, + scaleX: x, + scaleY: g, + offsetLeft: S, + offsetTop: T, + cropX: C, + cropY: E + }; + } + } + ), c.Image.CSS_CANVAS = "canvas-img", c.Image.prototype.getSvgSrc = c.Image.prototype.getSrc, c.Image.fromObject = function(m, _) { + var y = c.util.object.clone(m); + c.util.loadImage(y.src, function(x, g) { + if (g) { + _ && _(null, !0); + return; + } + c.Image.prototype._initFilters.call(y, y.filters, function(S) { + y.filters = S || [], c.Image.prototype._initFilters.call(y, [y.resizeFilter], function(T) { + y.resizeFilter = T[0], c.util.enlivenObjects([y.clipPath], function(C) { + y.clipPath = C[0]; + var E = new c.Image(x, y); + _(E, !1); + }); + }); + }); + }, null, y.crossOrigin); + }, c.Image.fromURL = function(m, _, y) { + c.util.loadImage(m, function(x, g) { + _ && _(new c.Image(x, y), g); + }, null, y && y.crossOrigin); + }, c.Image.ATTRIBUTE_NAMES = c.SHARED_ATTRIBUTES.concat( + "x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ") + ), c.Image.fromElement = function(m, _, y) { + var x = c.parseAttributes(m, c.Image.ATTRIBUTE_NAMES); + c.Image.fromURL( + x["xlink:href"], + _, + d(y ? c.util.object.clone(y) : {}, x) + ); + }; + }(l), c.util.object.extend( + c.Object.prototype, + /** @lends fabric.Object.prototype */ + { + /** + * @private + * @return {Number} angle value + */ + _getAngleValueForStraighten: function() { + var p = this.angle % 360; + return p > 0 ? Math.round((p - 1) / 90) * 90 : Math.round(p / 90) * 90; + }, + /** + * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) + * @return {fabric.Object} thisArg + * @chainable + */ + straighten: function() { + return this.rotate(this._getAngleValueForStraighten()), this; + }, + /** + * Same as {@link fabric.Object.prototype.straighten} but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Object} thisArg + * @chainable + */ + fxStraighten: function(p) { + p = p || {}; + var d = function() { + }, m = p.onComplete || d, _ = p.onChange || d, y = this; + return c.util.animate({ + startValue: this.get("angle"), + endValue: this._getAngleValueForStraighten(), + duration: this.FX_DURATION, + onChange: function(x) { + y.rotate(x), _(); + }, + onComplete: function() { + y.setCoords(), m(); + } + }), this; + } + } + ), c.util.object.extend( + c.StaticCanvas.prototype, + /** @lends fabric.StaticCanvas.prototype */ + { + /** + * Straightens object, then rerenders canvas + * @param {fabric.Object} object Object to straighten + * @return {fabric.Canvas} thisArg + * @chainable + */ + straightenObject: function(p) { + return p.straighten(), this.requestRenderAll(), this; + }, + /** + * Same as {@link fabric.Canvas.prototype.straightenObject}, but animated + * @param {fabric.Object} object Object to straighten + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxStraightenObject: function(p) { + return p.fxStraighten({ + onChange: this.requestRenderAllBound + }), this; + } + } + ), function() { + function p(m, _) { + var y = "precision " + _ + ` float; +void main(){}`, x = m.createShader(m.FRAGMENT_SHADER); + return m.shaderSource(x, y), m.compileShader(x), !!m.getShaderParameter(x, m.COMPILE_STATUS); + } + c.isWebglSupported = function(m) { + if (c.isLikelyNode) + return !1; + m = m || c.WebglFilterBackend.prototype.tileSize; + var _ = document.createElement("canvas"), y = _.getContext("webgl") || _.getContext("experimental-webgl"), x = !1; + if (y) { + c.maxTextureSize = y.getParameter(y.MAX_TEXTURE_SIZE), x = c.maxTextureSize >= m; + for (var g = ["highp", "mediump", "lowp"], S = 0; S < 3; S++) + if (p(y, g[S])) { + c.webGlPrecision = g[S]; + break; + } + } + return this.isSupported = x, x; + }, c.WebglFilterBackend = d; + function d(m) { + m && m.tileSize && (this.tileSize = m.tileSize), this.setupGLContext(this.tileSize, this.tileSize), this.captureGPUInfo(); + } + d.prototype = /** @lends fabric.WebglFilterBackend.prototype */ + { + tileSize: 2048, + /** + * Experimental. This object is a sort of repository of help layers used to avoid + * of recreating them during frequent filtering. If you are previewing a filter with + * a slider you probably do not want to create help layers every filter step. + * in this object there will be appended some canvases, created once, resized sometimes + * cleared never. Clearing is left to the developer. + **/ + resources: {}, + /** + * Setup a WebGL context suitable for filtering, and bind any needed event handlers. + */ + setupGLContext: function(m, _) { + this.dispose(), this.createWebGLCanvas(m, _), this.aPosition = new Float32Array([0, 0, 0, 1, 1, 0, 1, 1]), this.chooseFastestCopyGLTo2DMethod(m, _); + }, + /** + * Pick a method to copy data from GL context to 2d canvas. In some browsers using + * putImageData is faster than drawImage for that specific operation. + */ + chooseFastestCopyGLTo2DMethod: function(m, _) { + var y = typeof window.performance != "undefined", x; + try { + new ImageData(1, 1), x = !0; + } catch (N) { + x = !1; + } + var g = typeof ArrayBuffer != "undefined", S = typeof Uint8ClampedArray != "undefined"; + if (y && x && g && S) { + var T = c.util.createCanvasElement(), C = new ArrayBuffer(m * _ * 4); + if (c.forceGLPutImageData) { + this.imageBuffer = C, this.copyGLTo2D = w; + return; + } + var E = { + imageBuffer: C, + destinationWidth: m, + destinationHeight: _, + targetCanvas: T + }, M, P, R; + T.width = m, T.height = _, M = window.performance.now(), b.call(E, this.gl, E), P = window.performance.now() - M, M = window.performance.now(), w.call(E, this.gl, E), R = window.performance.now() - M, P > R ? (this.imageBuffer = C, this.copyGLTo2D = w) : this.copyGLTo2D = b; + } + }, + /** + * Create a canvas element and associated WebGL context and attaches them as + * class properties to the GLFilterBackend class. + */ + createWebGLCanvas: function(m, _) { + var y = c.util.createCanvasElement(); + y.width = m, y.height = _; + var x = { + alpha: !0, + premultipliedAlpha: !1, + depth: !1, + stencil: !1, + antialias: !1 + }, g = y.getContext("webgl", x); + g || (g = y.getContext("experimental-webgl", x)), g && (g.clearColor(0, 0, 0, 0), this.canvas = y, this.gl = g); + }, + /** + * Attempts to apply the requested filters to the source provided, drawing the filtered output + * to the provided target canvas. + * + * @param {Array} filters The filters to apply. + * @param {HTMLImageElement|HTMLCanvasElement} source The source to be filtered. + * @param {Number} width The width of the source input. + * @param {Number} height The height of the source input. + * @param {HTMLCanvasElement} targetCanvas The destination for filtered output to be drawn. + * @param {String|undefined} cacheKey A key used to cache resources related to the source. If + * omitted, caching will be skipped. + */ + applyFilters: function(m, _, y, x, g, S) { + var T = this.gl, C; + S && (C = this.getCachedTexture(S, _)); + var E = { + originalWidth: _.width || _.originalWidth, + originalHeight: _.height || _.originalHeight, + sourceWidth: y, + sourceHeight: x, + destinationWidth: y, + destinationHeight: x, + context: T, + sourceTexture: this.createTexture(T, y, x, !C && _), + targetTexture: this.createTexture(T, y, x), + originalTexture: C || this.createTexture(T, y, x, !C && _), + passes: m.length, + webgl: !0, + aPosition: this.aPosition, + programCache: this.programCache, + pass: 0, + filterBackend: this, + targetCanvas: g + }, M = T.createFramebuffer(); + return T.bindFramebuffer(T.FRAMEBUFFER, M), m.forEach(function(P) { + P && P.applyTo(E); + }), v(E), this.copyGLTo2D(T, E), T.bindTexture(T.TEXTURE_2D, null), T.deleteTexture(E.sourceTexture), T.deleteTexture(E.targetTexture), T.deleteFramebuffer(M), g.getContext("2d").setTransform(1, 0, 0, 1, 0, 0), E; + }, + /** + * Detach event listeners, remove references, and clean up caches. + */ + dispose: function() { + this.canvas && (this.canvas = null, this.gl = null), this.clearWebGLCaches(); + }, + /** + * Wipe out WebGL-related caches. + */ + clearWebGLCaches: function() { + this.programCache = {}, this.textureCache = {}; + }, + /** + * Create a WebGL texture object. + * + * Accepts specific dimensions to initialize the texture to or a source image. + * + * @param {WebGLRenderingContext} gl The GL context to use for creating the texture. + * @param {Number} width The width to initialize the texture at. + * @param {Number} height The height to initialize the texture. + * @param {HTMLImageElement|HTMLCanvasElement} textureImageSource A source for the texture data. + * @returns {WebGLTexture} + */ + createTexture: function(m, _, y, x) { + var g = m.createTexture(); + return m.bindTexture(m.TEXTURE_2D, g), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MAG_FILTER, m.NEAREST), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_MIN_FILTER, m.NEAREST), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_S, m.CLAMP_TO_EDGE), m.texParameteri(m.TEXTURE_2D, m.TEXTURE_WRAP_T, m.CLAMP_TO_EDGE), x ? m.texImage2D(m.TEXTURE_2D, 0, m.RGBA, m.RGBA, m.UNSIGNED_BYTE, x) : m.texImage2D(m.TEXTURE_2D, 0, m.RGBA, _, y, 0, m.RGBA, m.UNSIGNED_BYTE, null), g; + }, + /** + * Can be optionally used to get a texture from the cache array + * + * If an existing texture is not found, a new texture is created and cached. + * + * @param {String} uniqueId A cache key to use to find an existing texture. + * @param {HTMLImageElement|HTMLCanvasElement} textureImageSource A source to use to create the + * texture cache entry if one does not already exist. + */ + getCachedTexture: function(m, _) { + if (this.textureCache[m]) + return this.textureCache[m]; + var y = this.createTexture( + this.gl, + _.width, + _.height, + _ + ); + return this.textureCache[m] = y, y; + }, + /** + * Clear out cached resources related to a source image that has been + * filtered previously. + * + * @param {String} cacheKey The cache key provided when the source image was filtered. + */ + evictCachesForKey: function(m) { + this.textureCache[m] && (this.gl.deleteTexture(this.textureCache[m]), delete this.textureCache[m]); + }, + copyGLTo2D: b, + /** + * Attempt to extract GPU information strings from a WebGL context. + * + * Useful information when debugging or blacklisting specific GPUs. + * + * @returns {Object} A GPU info object with renderer and vendor strings. + */ + captureGPUInfo: function() { + if (this.gpuInfo) + return this.gpuInfo; + var m = this.gl, _ = { renderer: "", vendor: "" }; + if (!m) + return _; + var y = m.getExtension("WEBGL_debug_renderer_info"); + if (y) { + var x = m.getParameter(y.UNMASKED_RENDERER_WEBGL), g = m.getParameter(y.UNMASKED_VENDOR_WEBGL); + x && (_.renderer = x.toLowerCase()), g && (_.vendor = g.toLowerCase()); + } + return this.gpuInfo = _, _; + } + }; + }(); + function v(p) { + var d = p.targetCanvas, m = d.width, _ = d.height, y = p.destinationWidth, x = p.destinationHeight; + (m !== y || _ !== x) && (d.width = y, d.height = x); + } + function b(p, d) { + var m = p.canvas, _ = d.targetCanvas, y = _.getContext("2d"); + y.translate(0, _.height), y.scale(1, -1); + var x = m.height - _.height; + y.drawImage( + m, + 0, + x, + _.width, + _.height, + 0, + 0, + _.width, + _.height + ); + } + function w(p, d) { + var m = d.targetCanvas, _ = m.getContext("2d"), y = d.destinationWidth, x = d.destinationHeight, g = y * x * 4, S = new Uint8Array(this.imageBuffer, 0, g), T = new Uint8ClampedArray(this.imageBuffer, 0, g); + p.readPixels(0, 0, y, x, p.RGBA, p.UNSIGNED_BYTE, S); + var C = new ImageData(T, y, x); + _.putImageData(C, 0, 0); + } + (function() { + var p = function() { + }; + c.Canvas2dFilterBackend = d; + function d() { + } + d.prototype = /** @lends fabric.Canvas2dFilterBackend.prototype */ + { + evictCachesForKey: p, + dispose: p, + clearWebGLCaches: p, + /** + * Experimental. This object is a sort of repository of help layers used to avoid + * of recreating them during frequent filtering. If you are previewing a filter with + * a slider you probably do not want to create help layers every filter step. + * in this object there will be appended some canvases, created once, resized sometimes + * cleared never. Clearing is left to the developer. + **/ + resources: {}, + /** + * Apply a set of filters against a source image and draw the filtered output + * to the provided destination canvas. + * + * @param {EnhancedFilter} filters The filter to apply. + * @param {HTMLImageElement|HTMLCanvasElement} sourceElement The source to be filtered. + * @param {Number} sourceWidth The width of the source input. + * @param {Number} sourceHeight The height of the source input. + * @param {HTMLCanvasElement} targetCanvas The destination for filtered output to be drawn. + */ + applyFilters: function(m, _, y, x, g) { + var S = g.getContext("2d"); + S.drawImage(_, 0, 0, y, x); + var T = S.getImageData(0, 0, y, x), C = S.getImageData(0, 0, y, x), E = { + sourceWidth: y, + sourceHeight: x, + imageData: T, + originalEl: _, + originalImageData: C, + canvasEl: g, + ctx: S, + filterBackend: this + }; + return m.forEach(function(M) { + M.applyTo(E); + }), (E.imageData.width !== y || E.imageData.height !== x) && (g.width = E.imageData.width, g.height = E.imageData.height), S.putImageData(E.imageData, 0, 0), E; + } + }; + })(), c.Image = c.Image || {}, c.Image.filters = c.Image.filters || {}, c.Image.filters.BaseFilter = c.util.createClass( + /** @lends fabric.Image.filters.BaseFilter.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "BaseFilter", + /** + * Array of attributes to send with buffers. do not modify + * @private + */ + vertexSource: `attribute vec2 aPosition; +varying vec2 vTexCoord; +void main() { +vTexCoord = aPosition; +gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0); +}`, + fragmentSource: `precision highp float; +varying vec2 vTexCoord; +uniform sampler2D uTexture; +void main() { +gl_FragColor = texture2D(uTexture, vTexCoord); +}`, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(p) { + p && this.setOptions(p); + }, + /** + * Sets filter's properties from options + * @param {Object} [options] Options object + */ + setOptions: function(p) { + for (var d in p) + this[d] = p[d]; + }, + /** + * Compile this filter's shader program. + * + * @param {WebGLRenderingContext} gl The GL canvas context to use for shader compilation. + * @param {String} fragmentSource fragmentShader source for compilation + * @param {String} vertexSource vertexShader source for compilation + */ + createProgram: function(p, d, m) { + d = d || this.fragmentSource, m = m || this.vertexSource, c.webGlPrecision !== "highp" && (d = d.replace( + /precision highp float/g, + "precision " + c.webGlPrecision + " float" + )); + var _ = p.createShader(p.VERTEX_SHADER); + if (p.shaderSource(_, m), p.compileShader(_), !p.getShaderParameter(_, p.COMPILE_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + "Vertex shader compile error for " + this.type + ": " + p.getShaderInfoLog(_) + ); + var y = p.createShader(p.FRAGMENT_SHADER); + if (p.shaderSource(y, d), p.compileShader(y), !p.getShaderParameter(y, p.COMPILE_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + "Fragment shader compile error for " + this.type + ": " + p.getShaderInfoLog(y) + ); + var x = p.createProgram(); + if (p.attachShader(x, _), p.attachShader(x, y), p.linkProgram(x), !p.getProgramParameter(x, p.LINK_STATUS)) + throw new Error( + // eslint-disable-next-line prefer-template + 'Shader link error for "${this.type}" ' + p.getProgramInfoLog(x) + ); + var g = this.getAttributeLocations(p, x), S = this.getUniformLocations(p, x) || {}; + return S.uStepW = p.getUniformLocation(x, "uStepW"), S.uStepH = p.getUniformLocation(x, "uStepH"), { + program: x, + attributeLocations: g, + uniformLocations: S + }; + }, + /** + * Return a map of attribute names to WebGLAttributeLocation objects. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {WebGLShaderProgram} program The shader program from which to take attribute locations. + * @returns {Object} A map of attribute names to attribute locations. + */ + getAttributeLocations: function(p, d) { + return { + aPosition: p.getAttribLocation(d, "aPosition") + }; + }, + /** + * Return a map of uniform names to WebGLUniformLocation objects. + * + * Intended to be overridden by subclasses. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {WebGLShaderProgram} program The shader program from which to take uniform locations. + * @returns {Object} A map of uniform names to uniform locations. + */ + getUniformLocations: function() { + return {}; + }, + /** + * Send attribute data from this filter to its shader program on the GPU. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {Object} attributeLocations A map of shader attribute names to their locations. + */ + sendAttributeData: function(p, d, m) { + var _ = d.aPosition, y = p.createBuffer(); + p.bindBuffer(p.ARRAY_BUFFER, y), p.enableVertexAttribArray(_), p.vertexAttribPointer(_, 2, p.FLOAT, !1, 0, 0), p.bufferData(p.ARRAY_BUFFER, m, p.STATIC_DRAW); + }, + _setupFrameBuffer: function(p) { + var d = p.context, m, _; + p.passes > 1 ? (m = p.destinationWidth, _ = p.destinationHeight, (p.sourceWidth !== m || p.sourceHeight !== _) && (d.deleteTexture(p.targetTexture), p.targetTexture = p.filterBackend.createTexture(d, m, _)), d.framebufferTexture2D( + d.FRAMEBUFFER, + d.COLOR_ATTACHMENT0, + d.TEXTURE_2D, + p.targetTexture, + 0 + )) : (d.bindFramebuffer(d.FRAMEBUFFER, null), d.finish()); + }, + _swapTextures: function(p) { + p.passes--, p.pass++; + var d = p.targetTexture; + p.targetTexture = p.sourceTexture, p.sourceTexture = d; + }, + /** + * Generic isNeutral implementation for one parameter based filters. + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * Other filters may need their own version ( ColorMatrix, HueRotation, gamma, ComposedFilter ) + * @param {Object} options + **/ + isNeutralState: function() { + var p = this.mainParameter, d = c.Image.filters[this.type].prototype; + if (p) + if (Array.isArray(d[p])) { + for (var m = d[p].length; m--; ) + if (this[p][m] !== d[p][m]) + return !1; + return !0; + } else + return d[p] === this[p]; + else + return !1; + }, + /** + * Apply this filter to the input image data provided. + * + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(p) { + p.webgl ? (this._setupFrameBuffer(p), this.applyToWebGL(p), this._swapTextures(p)) : this.applyTo2d(p); + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(p) { + return p.programCache.hasOwnProperty(this.type) || (p.programCache[this.type] = this.createProgram(p.context)), p.programCache[this.type]; + }, + /** + * Apply this filter using webgl. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.originalTexture The texture of the original input image. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyToWebGL: function(p) { + var d = p.context, m = this.retrieveShader(p); + p.pass === 0 && p.originalTexture ? d.bindTexture(d.TEXTURE_2D, p.originalTexture) : d.bindTexture(d.TEXTURE_2D, p.sourceTexture), d.useProgram(m.program), this.sendAttributeData(d, m.attributeLocations, p.aPosition), d.uniform1f(m.uniformLocations.uStepW, 1 / p.sourceWidth), d.uniform1f(m.uniformLocations.uStepH, 1 / p.sourceHeight), this.sendUniformData(d, m.uniformLocations), d.viewport(0, 0, p.destinationWidth, p.destinationHeight), d.drawArrays(d.TRIANGLE_STRIP, 0, 4); + }, + bindAdditionalTexture: function(p, d, m) { + p.activeTexture(m), p.bindTexture(p.TEXTURE_2D, d), p.activeTexture(p.TEXTURE0); + }, + unbindAdditionalTexture: function(p, d) { + p.activeTexture(d), p.bindTexture(p.TEXTURE_2D, null), p.activeTexture(p.TEXTURE0); + }, + getMainParameter: function() { + return this[this.mainParameter]; + }, + setMainParameter: function(p) { + this[this.mainParameter] = p; + }, + /** + * Send uniform data from this filter to its shader program on the GPU. + * + * Intended to be overridden by subclasses. + * + * @param {WebGLRenderingContext} gl The canvas context used to compile the shader program. + * @param {Object} uniformLocations A map of shader uniform names to their locations. + */ + sendUniformData: function() { + }, + /** + * If needed by a 2d filter, this functions can create an helper canvas to be used + * remember that options.targetCanvas is available for use till end of chain. + */ + createHelpLayer: function(p) { + if (!p.helpLayer) { + var d = document.createElement("canvas"); + d.width = p.sourceWidth, d.height = p.sourceHeight, p.helpLayer = d; + } + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + var p = { type: this.type }, d = this.mainParameter; + return d && (p[d] = this[d]), p; + }, + /** + * Returns a JSON representation of an instance + * @return {Object} JSON + */ + toJSON: function() { + return this.toObject(); + } + } + ), c.Image.filters.BaseFilter.fromObject = function(p, d) { + var m = new c.Image.filters[p.type](p); + return d && d(m), m; + }, function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.ColorMatrix = _( + m.BaseFilter, + /** @lends fabric.Image.filters.ColorMatrix.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "ColorMatrix", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +varying vec2 vTexCoord; +uniform mat4 uColorMatrix; +uniform vec4 uConstants; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color *= uColorMatrix; +color += uConstants; +gl_FragColor = color; +}`, + /** + * Colormatrix for pixels. + * array of 20 floats. Numbers in positions 4, 9, 14, 19 loose meaning + * outside the -1, 1 range. + * 0.0039215686 is the part of 1 that get translated to 1 in 2d + * @param {Array} matrix array of 20 numbers. + * @default + */ + matrix: [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + mainParameter: "matrix", + /** + * Lock the colormatrix on the color part, skipping alpha, manly for non webgl scenario + * to save some calculation + */ + colorsOnly: !0, + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(y) { + this.callSuper("initialize", y), this.matrix = this.matrix.slice(0); + }, + /** + * Apply the ColorMatrix operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S = g.length, T = this.matrix, C, E, M, P, R, N = this.colorsOnly; + for (R = 0; R < S; R += 4) + C = g[R], E = g[R + 1], M = g[R + 2], N ? (g[R] = C * T[0] + E * T[1] + M * T[2] + T[4] * 255, g[R + 1] = C * T[5] + E * T[6] + M * T[7] + T[9] * 255, g[R + 2] = C * T[10] + E * T[11] + M * T[12] + T[14] * 255) : (P = g[R + 3], g[R] = C * T[0] + E * T[1] + M * T[2] + P * T[3] + T[4] * 255, g[R + 1] = C * T[5] + E * T[6] + M * T[7] + P * T[8] + T[9] * 255, g[R + 2] = C * T[10] + E * T[11] + M * T[12] + P * T[13] + T[14] * 255, g[R + 3] = C * T[15] + E * T[16] + M * T[17] + P * T[18] + T[19] * 255); + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uColorMatrix: y.getUniformLocation(x, "uColorMatrix"), + uConstants: y.getUniformLocation(x, "uConstants") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + var g = this.matrix, S = [ + g[0], + g[1], + g[2], + g[3], + g[5], + g[6], + g[7], + g[8], + g[10], + g[11], + g[12], + g[13], + g[15], + g[16], + g[17], + g[18] + ], T = [g[4], g[9], g[14], g[19]]; + y.uniformMatrix4fv(x.uColorMatrix, !1, S), y.uniform4fv(x.uConstants, T); + } + } + ), d.Image.filters.ColorMatrix.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Brightness = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Brightness.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Brightness", + /** + * Fragment source for the brightness program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uBrightness; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color.rgb += uBrightness; +gl_FragColor = color; +}`, + /** + * Brightness value, from -1 to 1. + * translated to -255 to 255 for 2d + * 0.0039215686 is the part of 1 that get translated to 1 in 2d + * @param {Number} brightness + * @default + */ + brightness: 0, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "brightness", + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + if (this.brightness !== 0) { + var x = y.imageData, g = x.data, S, T = g.length, C = Math.round(this.brightness * 255); + for (S = 0; S < T; S += 4) + g[S] = g[S] + C, g[S + 1] = g[S + 1] + C, g[S + 2] = g[S + 2] + C; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uBrightness: y.getUniformLocation(x, "uBrightness") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1f(x.uBrightness, this.brightness); + } + } + ), d.Image.filters.Brightness.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.Image.filters, y = d.util.createClass; + _.Convolute = y( + _.BaseFilter, + /** @lends fabric.Image.filters.Convolute.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Convolute", + /* + * Opaque value (true/false) + */ + opaque: !1, + /* + * matrix for the filter, max 9x9 + */ + matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0], + /** + * Fragment source for the brightness program + */ + fragmentSource: { + Convolute_3_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[9]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 3.0; h+=1.0) { +for (float w = 0.0; w < 3.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_3_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[9]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 3.0; h+=1.0) { +for (float w = 0.0; w < 3.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_5_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[25]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 5.0; h+=1.0) { +for (float w = 0.0; w < 5.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_5_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[25]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 5.0; h+=1.0) { +for (float w = 0.0; w < 5.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_7_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[49]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 7.0; h+=1.0) { +for (float w = 0.0; w < 7.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_7_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[49]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 7.0; h+=1.0) { +for (float w = 0.0; w < 7.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}`, + Convolute_9_1: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[81]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 0); +for (float h = 0.0; h < 9.0; h+=1.0) { +for (float w = 0.0; w < 9.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0)); +color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)]; +} +} +gl_FragColor = color; +}`, + Convolute_9_0: `precision highp float; +uniform sampler2D uTexture; +uniform float uMatrix[81]; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +vec4 color = vec4(0, 0, 0, 1); +for (float h = 0.0; h < 9.0; h+=1.0) { +for (float w = 0.0; w < 9.0; w+=1.0) { +vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0)); +color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)]; +} +} +float alpha = texture2D(uTexture, vTexCoord).a; +gl_FragColor = color; +gl_FragColor.a = alpha; +}` + }, + /** + * Constructor + * @memberOf fabric.Image.filters.Convolute.prototype + * @param {Object} [options] Options object + * @param {Boolean} [options.opaque=false] Opaque value (true/false) + * @param {Array} [options.matrix] Filter matrix + */ + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(x) { + var g = Math.sqrt(this.matrix.length), S = this.type + "_" + g + "_" + (this.opaque ? 1 : 0), T = this.fragmentSource[S]; + return x.programCache.hasOwnProperty(S) || (x.programCache[S] = this.createProgram(x.context, T)), x.programCache[S]; + }, + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(x) { + var g = x.imageData, S = g.data, T = this.matrix, C = Math.round(Math.sqrt(T.length)), E = Math.floor(C / 2), M = g.width, P = g.height, R = x.ctx.createImageData(M, P), N = R.data, F = this.opaque ? 1 : 0, U, $, G, Q, ee, ce, ne, fe, K, Oe, xe, Ge, oe; + for (xe = 0; xe < P; xe++) + for (Oe = 0; Oe < M; Oe++) { + for (ee = (xe * M + Oe) * 4, U = 0, $ = 0, G = 0, Q = 0, oe = 0; oe < C; oe++) + for (Ge = 0; Ge < C; Ge++) + ne = xe + oe - E, ce = Oe + Ge - E, !(ne < 0 || ne >= P || ce < 0 || ce >= M) && (fe = (ne * M + ce) * 4, K = T[oe * C + Ge], U += S[fe] * K, $ += S[fe + 1] * K, G += S[fe + 2] * K, F || (Q += S[fe + 3] * K)); + N[ee] = U, N[ee + 1] = $, N[ee + 2] = G, F ? N[ee + 3] = S[ee + 3] : N[ee + 3] = Q; + } + x.imageData = R; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(x, g) { + return { + uMatrix: x.getUniformLocation(g, "uMatrix"), + uOpaque: x.getUniformLocation(g, "uOpaque"), + uHalfSize: x.getUniformLocation(g, "uHalfSize"), + uSize: x.getUniformLocation(g, "uSize") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(x, g) { + x.uniform1fv(g.uMatrix, this.matrix); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return m(this.callSuper("toObject"), { + opaque: this.opaque, + matrix: this.matrix + }); + } + } + ), d.Image.filters.Convolute.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Grayscale = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Grayscale.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Grayscale", + fragmentSource: { + average: `precision highp float; +uniform sampler2D uTexture; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float average = (color.r + color.b + color.g) / 3.0; +gl_FragColor = vec4(average, average, average, color.a); +}`, + lightness: `precision highp float; +uniform sampler2D uTexture; +uniform int uMode; +varying vec2 vTexCoord; +void main() { +vec4 col = texture2D(uTexture, vTexCoord); +float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0; +gl_FragColor = vec4(average, average, average, col.a); +}`, + luminosity: `precision highp float; +uniform sampler2D uTexture; +uniform int uMode; +varying vec2 vTexCoord; +void main() { +vec4 col = texture2D(uTexture, vTexCoord); +float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b; +gl_FragColor = vec4(average, average, average, col.a); +}` + }, + /** + * Grayscale mode, between 'average', 'lightness', 'luminosity' + * @param {String} type + * @default + */ + mode: "average", + mainParameter: "mode", + /** + * Apply the Grayscale operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S, T = g.length, C, E = this.mode; + for (S = 0; S < T; S += 4) + E === "average" ? C = (g[S] + g[S + 1] + g[S + 2]) / 3 : E === "lightness" ? C = (Math.min(g[S], g[S + 1], g[S + 2]) + Math.max(g[S], g[S + 1], g[S + 2])) / 2 : E === "luminosity" && (C = 0.21 * g[S] + 0.72 * g[S + 1] + 0.07 * g[S + 2]), g[S] = C, g[S + 1] = C, g[S + 2] = C; + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(y) { + var x = this.type + "_" + this.mode; + if (!y.programCache.hasOwnProperty(x)) { + var g = this.fragmentSource[this.mode]; + y.programCache[x] = this.createProgram(y.context, g); + } + return y.programCache[x]; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uMode: y.getUniformLocation(x, "uMode") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + var g = 1; + y.uniform1i(x.uMode, g); + }, + /** + * Grayscale filter isNeutralState implementation + * The filter is never neutral + * on the image + **/ + isNeutralState: function() { + return !1; + } + } + ), d.Image.filters.Grayscale.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Invert = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Invert.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Invert", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform int uInvert; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +if (uInvert == 1) { +gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a); +} else { +gl_FragColor = color; +} +}`, + /** + * Filter invert. if false, does nothing + * @param {Boolean} invert + * @default + */ + invert: !0, + mainParameter: "invert", + /** + * Apply the Invert operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S, T = g.length; + for (S = 0; S < T; S += 4) + g[S] = 255 - g[S], g[S + 1] = 255 - g[S + 1], g[S + 2] = 255 - g[S + 2]; + }, + /** + * Invert filter isNeutralState implementation + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * @param {Object} options + **/ + isNeutralState: function() { + return !this.invert; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uInvert: y.getUniformLocation(x, "uInvert") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1i(x.uInvert, this.invert); + } + } + ), d.Image.filters.Invert.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.Image.filters, y = d.util.createClass; + _.Noise = y( + _.BaseFilter, + /** @lends fabric.Image.filters.Noise.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Noise", + /** + * Fragment source for the noise program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uStepH; +uniform float uNoise; +uniform float uSeed; +varying vec2 vTexCoord; +float rand(vec2 co, float seed, float vScale) { +return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0); +} +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise; +gl_FragColor = color; +}`, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "noise", + /** + * Noise value, from + * @param {Number} noise + * @default + */ + noise: 0, + /** + * Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(x) { + if (this.noise !== 0) { + var g = x.imageData, S = g.data, T, C = S.length, E = this.noise, M; + for (T = 0, C = S.length; T < C; T += 4) + M = (0.5 - Math.random()) * E, S[T] += M, S[T + 1] += M, S[T + 2] += M; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(x, g) { + return { + uNoise: x.getUniformLocation(g, "uNoise"), + uSeed: x.getUniformLocation(g, "uSeed") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(x, g) { + x.uniform1f(g.uNoise, this.noise / 255), x.uniform1f(g.uSeed, Math.random()); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return m(this.callSuper("toObject"), { + noise: this.noise + }); + } + } + ), d.Image.filters.Noise.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Pixelate = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Pixelate.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Pixelate", + blocksize: 4, + mainParameter: "blocksize", + /** + * Fragment source for the Pixelate program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uBlocksize; +uniform float uStepW; +uniform float uStepH; +varying vec2 vTexCoord; +void main() { +float blockW = uBlocksize * uStepW; +float blockH = uBlocksize * uStepW; +int posX = int(vTexCoord.x / blockW); +int posY = int(vTexCoord.y / blockH); +float fposX = float(posX); +float fposY = float(posY); +vec2 squareCoords = vec2(fposX * blockW, fposY * blockH); +vec4 color = texture2D(uTexture, squareCoords); +gl_FragColor = color; +}`, + /** + * Apply the Pixelate operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S = x.height, T = x.width, C, E, M, P, R, N, F, U, $, G, Q; + for (E = 0; E < S; E += this.blocksize) + for (M = 0; M < T; M += this.blocksize) + for (C = E * 4 * T + M * 4, P = g[C], R = g[C + 1], N = g[C + 2], F = g[C + 3], G = Math.min(E + this.blocksize, S), Q = Math.min(M + this.blocksize, T), U = E; U < G; U++) + for ($ = M; $ < Q; $++) + C = U * 4 * T + $ * 4, g[C] = P, g[C + 1] = R, g[C + 2] = N, g[C + 3] = F; + }, + /** + * Indicate when the filter is not gonna apply changes to the image + **/ + isNeutralState: function() { + return this.blocksize === 1; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uBlocksize: y.getUniformLocation(x, "uBlocksize"), + uStepW: y.getUniformLocation(x, "uStepW"), + uStepH: y.getUniformLocation(x, "uStepH") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1f(x.uBlocksize, this.blocksize); + } + } + ), d.Image.filters.Pixelate.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.extend, _ = d.Image.filters, y = d.util.createClass; + _.RemoveColor = y( + _.BaseFilter, + /** @lends fabric.Image.filters.RemoveColor.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "RemoveColor", + /** + * Color to remove, in any format understood by fabric.Color. + * @param {String} type + * @default + */ + color: "#FFFFFF", + /** + * Fragment source for the brightness program + */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec4 uLow; +uniform vec4 uHigh; +varying vec2 vTexCoord; +void main() { +gl_FragColor = texture2D(uTexture, vTexCoord); +if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) { +gl_FragColor.a = 0.0; +} +}`, + /** + * distance to actual color, as value up or down from each r,g,b + * between 0 and 1 + **/ + distance: 0.02, + /** + * For color to remove inside distance, use alpha channel for a smoother deletion + * NOT IMPLEMENTED YET + **/ + useAlpha: !1, + /** + * Constructor + * @memberOf fabric.Image.filters.RemoveWhite.prototype + * @param {Object} [options] Options object + * @param {Number} [options.color=#RRGGBB] Threshold value + * @param {Number} [options.distance=10] Distance value + */ + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo2d: function(x) { + var g = x.imageData, S = g.data, T, C = this.distance * 255, E, M, P, R = new d.Color(this.color).getSource(), N = [ + R[0] - C, + R[1] - C, + R[2] - C + ], F = [ + R[0] + C, + R[1] + C, + R[2] + C + ]; + for (T = 0; T < S.length; T += 4) + E = S[T], M = S[T + 1], P = S[T + 2], E > N[0] && M > N[1] && P > N[2] && E < F[0] && M < F[1] && P < F[2] && (S[T + 3] = 0); + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(x, g) { + return { + uLow: x.getUniformLocation(g, "uLow"), + uHigh: x.getUniformLocation(g, "uHigh") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(x, g) { + var S = new d.Color(this.color).getSource(), T = parseFloat(this.distance), C = [ + 0 + S[0] / 255 - T, + 0 + S[1] / 255 - T, + 0 + S[2] / 255 - T, + 1 + ], E = [ + S[0] / 255 + T, + S[1] / 255 + T, + S[2] / 255 + T, + 1 + ]; + x.uniform4fv(g.uLow, C), x.uniform4fv(g.uHigh, E); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return m(this.callSuper("toObject"), { + color: this.color, + distance: this.distance + }); + } + } + ), d.Image.filters.RemoveColor.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass, y = { + Brownie: [ + 0.5997, + 0.34553, + -0.27082, + 0, + 0.186, + -0.0377, + 0.86095, + 0.15059, + 0, + -0.1449, + 0.24113, + -0.07441, + 0.44972, + 0, + -0.02965, + 0, + 0, + 0, + 1, + 0 + ], + Vintage: [ + 0.62793, + 0.32021, + -0.03965, + 0, + 0.03784, + 0.02578, + 0.64411, + 0.03259, + 0, + 0.02926, + 0.0466, + -0.08512, + 0.52416, + 0, + 0.02023, + 0, + 0, + 0, + 1, + 0 + ], + Kodachrome: [ + 1.12855, + -0.39673, + -0.03992, + 0, + 0.24991, + -0.16404, + 1.08352, + -0.05498, + 0, + 0.09698, + -0.16786, + -0.56034, + 1.60148, + 0, + 0.13972, + 0, + 0, + 0, + 1, + 0 + ], + Technicolor: [ + 1.91252, + -0.85453, + -0.09155, + 0, + 0.04624, + -0.30878, + 1.76589, + -0.10601, + 0, + -0.27589, + -0.2311, + -0.75018, + 1.84759, + 0, + 0.12137, + 0, + 0, + 0, + 1, + 0 + ], + Polaroid: [ + 1.438, + -0.062, + -0.062, + 0, + 0, + -0.122, + 1.378, + -0.122, + 0, + 0, + -0.016, + -0.016, + 1.483, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + Sepia: [ + 0.393, + 0.769, + 0.189, + 0, + 0, + 0.349, + 0.686, + 0.168, + 0, + 0, + 0.272, + 0.534, + 0.131, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], + BlackWhite: [ + 1.5, + 1.5, + 1.5, + 0, + -1, + 1.5, + 1.5, + 1.5, + 0, + -1, + 1.5, + 1.5, + 1.5, + 0, + -1, + 0, + 0, + 0, + 1, + 0 + ] + }; + for (var x in y) + m[x] = _( + m.ColorMatrix, + /** @lends fabric.Image.filters.Sepia.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: x, + /** + * Colormatrix for the effect + * array of 20 floats. Numbers in positions 4, 9, 14, 19 loose meaning + * outside the -1, 1 range. + * @param {Array} matrix array of 20 numbers. + * @default + */ + matrix: y[x], + /** + * Lock the matrix export for this kind of static, parameter less filters. + */ + mainParameter: !1, + /** + * Lock the colormatrix on the color part, skipping alpha + */ + colorsOnly: !0 + } + ), d.Image.filters[x].fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric, m = d.Image.filters, _ = d.util.createClass; + m.BlendColor = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Blend.prototype */ + { + type: "BlendColor", + /** + * Color to make the blend operation with. default to a reddish color since black or white + * gives always strong result. + **/ + color: "#F95C63", + /** + * Blend mode for the filter: one of multiply, add, diff, screen, subtract, + * darken, lighten, overlay, exclusion, tint. + **/ + mode: "multiply", + /** + * alpha value. represent the strength of the blend color operation. + **/ + alpha: 1, + /** + * Fragment source for the Multiply program + */ + fragmentSource: { + multiply: `gl_FragColor.rgb *= uColor.rgb; +`, + screen: `gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb); +`, + add: `gl_FragColor.rgb += uColor.rgb; +`, + diff: `gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb); +`, + subtract: `gl_FragColor.rgb -= uColor.rgb; +`, + lighten: `gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb); +`, + darken: `gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb); +`, + exclusion: `gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb); +`, + overlay: `if (uColor.r < 0.5) { +gl_FragColor.r *= 2.0 * uColor.r; +} else { +gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r); +} +if (uColor.g < 0.5) { +gl_FragColor.g *= 2.0 * uColor.g; +} else { +gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g); +} +if (uColor.b < 0.5) { +gl_FragColor.b *= 2.0 * uColor.b; +} else { +gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b); +} +`, + tint: `gl_FragColor.rgb *= (1.0 - uColor.a); +gl_FragColor.rgb += uColor.rgb; +` + }, + /** + * build the fragment source for the filters, joining the common part with + * the specific one. + * @param {String} mode the mode of the filter, a key of this.fragmentSource + * @return {String} the source to be compiled + * @private + */ + buildSource: function(y) { + return `precision highp float; +uniform sampler2D uTexture; +uniform vec4 uColor; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +gl_FragColor = color; +if (color.a > 0.0) { +` + this.fragmentSource[y] + `} +}`; + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(y) { + var x = this.type + "_" + this.mode, g; + return y.programCache.hasOwnProperty(x) || (g = this.buildSource(this.mode), y.programCache[x] = this.createProgram(y.context, g)), y.programCache[x]; + }, + /** + * Apply the Blend operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S = g.length, T, C, E, M, P, R, N, F = 1 - this.alpha; + N = new d.Color(this.color).getSource(), T = N[0] * this.alpha, C = N[1] * this.alpha, E = N[2] * this.alpha; + for (var U = 0; U < S; U += 4) + switch (M = g[U], P = g[U + 1], R = g[U + 2], this.mode) { + case "multiply": + g[U] = M * T / 255, g[U + 1] = P * C / 255, g[U + 2] = R * E / 255; + break; + case "screen": + g[U] = 255 - (255 - M) * (255 - T) / 255, g[U + 1] = 255 - (255 - P) * (255 - C) / 255, g[U + 2] = 255 - (255 - R) * (255 - E) / 255; + break; + case "add": + g[U] = M + T, g[U + 1] = P + C, g[U + 2] = R + E; + break; + case "diff": + case "difference": + g[U] = Math.abs(M - T), g[U + 1] = Math.abs(P - C), g[U + 2] = Math.abs(R - E); + break; + case "subtract": + g[U] = M - T, g[U + 1] = P - C, g[U + 2] = R - E; + break; + case "darken": + g[U] = Math.min(M, T), g[U + 1] = Math.min(P, C), g[U + 2] = Math.min(R, E); + break; + case "lighten": + g[U] = Math.max(M, T), g[U + 1] = Math.max(P, C), g[U + 2] = Math.max(R, E); + break; + case "overlay": + g[U] = T < 128 ? 2 * M * T / 255 : 255 - 2 * (255 - M) * (255 - T) / 255, g[U + 1] = C < 128 ? 2 * P * C / 255 : 255 - 2 * (255 - P) * (255 - C) / 255, g[U + 2] = E < 128 ? 2 * R * E / 255 : 255 - 2 * (255 - R) * (255 - E) / 255; + break; + case "exclusion": + g[U] = T + M - 2 * T * M / 255, g[U + 1] = C + P - 2 * C * P / 255, g[U + 2] = E + R - 2 * E * R / 255; + break; + case "tint": + g[U] = T + M * F, g[U + 1] = C + P * F, g[U + 2] = E + R * F; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uColor: y.getUniformLocation(x, "uColor") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + var g = new d.Color(this.color).getSource(); + g[0] = this.alpha * g[0] / 255, g[1] = this.alpha * g[1] / 255, g[2] = this.alpha * g[2] / 255, g[3] = this.alpha, y.uniform4fv(x.uColor, g); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + color: this.color, + mode: this.mode, + alpha: this.alpha + }; + } + } + ), d.Image.filters.BlendColor.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric, m = d.Image.filters, _ = d.util.createClass; + m.BlendImage = _( + m.BaseFilter, + /** @lends fabric.Image.filters.BlendImage.prototype */ + { + type: "BlendImage", + /** + * Color to make the blend operation with. default to a reddish color since black or white + * gives always strong result. + **/ + image: null, + /** + * Blend mode for the filter: one of multiply, add, diff, screen, subtract, + * darken, lighten, overlay, exclusion, tint. + **/ + mode: "multiply", + /** + * alpha value. represent the strength of the blend image operation. + * not implemented. + **/ + alpha: 1, + vertexSource: `attribute vec2 aPosition; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +uniform mat3 uTransformMatrix; +void main() { +vTexCoord = aPosition; +vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy; +gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0); +}`, + /** + * Fragment source for the Multiply program + */ + fragmentSource: { + multiply: `precision highp float; +uniform sampler2D uTexture; +uniform sampler2D uImage; +uniform vec4 uColor; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec4 color2 = texture2D(uImage, vTexCoord2); +color.rgba *= color2.rgba; +gl_FragColor = color; +}`, + mask: `precision highp float; +uniform sampler2D uTexture; +uniform sampler2D uImage; +uniform vec4 uColor; +varying vec2 vTexCoord; +varying vec2 vTexCoord2; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec4 color2 = texture2D(uImage, vTexCoord2); +color.a = color2.a; +gl_FragColor = color; +}` + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(y) { + var x = this.type + "_" + this.mode, g = this.fragmentSource[this.mode]; + return y.programCache.hasOwnProperty(x) || (y.programCache[x] = this.createProgram(y.context, g)), y.programCache[x]; + }, + applyToWebGL: function(y) { + var x = y.context, g = this.createTexture(y.filterBackend, this.image); + this.bindAdditionalTexture(x, g, x.TEXTURE1), this.callSuper("applyToWebGL", y), this.unbindAdditionalTexture(x, x.TEXTURE1); + }, + createTexture: function(y, x) { + return y.getCachedTexture(x.cacheKey, x._element); + }, + /** + * Calculate a transformMatrix to adapt the image to blend over + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + calculateMatrix: function() { + var y = this.image, x = y._element.width, g = y._element.height; + return [ + 1 / y.scaleX, + 0, + 0, + 0, + 1 / y.scaleY, + 0, + -y.left / x, + -y.top / g, + 1 + ]; + }, + /** + * Apply the Blend operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = y.filterBackend.resources, S = x.data, T = S.length, C = x.width, E = x.height, M, P, R, N, F, U, $, G, Q, ee, ce = this.image, ne; + g.blendImage || (g.blendImage = d.util.createCanvasElement()), Q = g.blendImage, ee = Q.getContext("2d"), Q.width !== C || Q.height !== E ? (Q.width = C, Q.height = E) : ee.clearRect(0, 0, C, E), ee.setTransform(ce.scaleX, 0, 0, ce.scaleY, ce.left, ce.top), ee.drawImage(ce._element, 0, 0, C, E), ne = ee.getImageData(0, 0, C, E).data; + for (var fe = 0; fe < T; fe += 4) + switch (F = S[fe], U = S[fe + 1], $ = S[fe + 2], G = S[fe + 3], M = ne[fe], P = ne[fe + 1], R = ne[fe + 2], N = ne[fe + 3], this.mode) { + case "multiply": + S[fe] = F * M / 255, S[fe + 1] = U * P / 255, S[fe + 2] = $ * R / 255, S[fe + 3] = G * N / 255; + break; + case "mask": + S[fe + 3] = N; + break; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uTransformMatrix: y.getUniformLocation(x, "uTransformMatrix"), + uImage: y.getUniformLocation(x, "uImage") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + var g = this.calculateMatrix(); + y.uniform1i(x.uImage, 1), y.uniformMatrix3fv(x.uTransformMatrix, !1, g); + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + image: this.image && this.image.toObject(), + mode: this.mode, + alpha: this.alpha + }; + } + } + ), d.Image.filters.BlendImage.fromObject = function(y, x) { + d.Image.fromObject(y.image, function(g) { + var S = d.util.object.clone(y); + S.image = g, x(new d.Image.filters.BlendImage(S)); + }); + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = Math.pow, _ = Math.floor, y = Math.sqrt, x = Math.abs, g = Math.round, S = Math.sin, T = Math.ceil, C = d.Image.filters, E = d.util.createClass; + C.Resize = E( + C.BaseFilter, + /** @lends fabric.Image.filters.Resize.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Resize", + /** + * Resize type + * for webgl resizeType is just lanczos, for canvas2d can be: + * bilinear, hermite, sliceHack, lanczos. + * @param {String} resizeType + * @default + */ + resizeType: "hermite", + /** + * Scale factor for resizing, x axis + * @param {Number} scaleX + * @default + */ + scaleX: 1, + /** + * Scale factor for resizing, y axis + * @param {Number} scaleY + * @default + */ + scaleY: 1, + /** + * LanczosLobes parameter for lanczos filter, valid for resizeType lanczos + * @param {Number} lanczosLobes + * @default + */ + lanczosLobes: 3, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(M, P) { + return { + uDelta: M.getUniformLocation(P, "uDelta"), + uTaps: M.getUniformLocation(P, "uTaps") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(M, P) { + M.uniform2fv(P.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), M.uniform1fv(P.uTaps, this.taps); + }, + /** + * Retrieves the cached shader. + * @param {Object} options + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + retrieveShader: function(M) { + var P = this.getFilterWindow(), R = this.type + "_" + P; + if (!M.programCache.hasOwnProperty(R)) { + var N = this.generateShader(P); + M.programCache[R] = this.createProgram(M.context, N); + } + return M.programCache[R]; + }, + getFilterWindow: function() { + var M = this.tempScale; + return Math.ceil(this.lanczosLobes / M); + }, + getTaps: function() { + for (var M = this.lanczosCreate(this.lanczosLobes), P = this.tempScale, R = this.getFilterWindow(), N = new Array(R), F = 1; F <= R; F++) + N[F - 1] = M(F * P); + return N; + }, + /** + * Generate vertex and shader sources from the necessary steps numbers + * @param {Number} filterWindow + */ + generateShader: function(N) { + for (var P = new Array(N), R = this.fragmentSourceTOP, N, F = 1; F <= N; F++) + P[F - 1] = F + ".0 * uDelta"; + return R += "uniform float uTaps[" + N + `]; +`, R += `void main() { +`, R += ` vec4 color = texture2D(uTexture, vTexCoord); +`, R += ` float sum = 1.0; +`, P.forEach(function(U, $) { + R += " color += texture2D(uTexture, vTexCoord + " + U + ") * uTaps[" + $ + `]; +`, R += " color += texture2D(uTexture, vTexCoord - " + U + ") * uTaps[" + $ + `]; +`, R += " sum += 2.0 * uTaps[" + $ + `]; +`; + }), R += ` gl_FragColor = color / sum; +`, R += "}", R; + }, + fragmentSourceTOP: `precision highp float; +uniform sampler2D uTexture; +uniform vec2 uDelta; +varying vec2 vTexCoord; +`, + /** + * Apply the resize filter to the image + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(M) { + M.webgl ? (M.passes++, this.width = M.sourceWidth, this.horizontal = !0, this.dW = Math.round(this.width * this.scaleX), this.dH = M.sourceHeight, this.tempScale = this.dW / this.width, this.taps = this.getTaps(), M.destinationWidth = this.dW, this._setupFrameBuffer(M), this.applyToWebGL(M), this._swapTextures(M), M.sourceWidth = M.destinationWidth, this.height = M.sourceHeight, this.horizontal = !1, this.dH = Math.round(this.height * this.scaleY), this.tempScale = this.dH / this.height, this.taps = this.getTaps(), M.destinationHeight = this.dH, this._setupFrameBuffer(M), this.applyToWebGL(M), this._swapTextures(M), M.sourceHeight = M.destinationHeight) : this.applyTo2d(M); + }, + isNeutralState: function() { + return this.scaleX === 1 && this.scaleY === 1; + }, + lanczosCreate: function(M) { + return function(P) { + if (P >= M || P <= -M) + return 0; + if (P < 11920929e-14 && P > -11920929e-14) + return 1; + P *= Math.PI; + var R = P / M; + return S(P) / P * S(R) / R; + }; + }, + /** + * Applies filter to canvas element + * @memberOf fabric.Image.filters.Resize.prototype + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} scaleX + * @param {Number} scaleY + */ + applyTo2d: function(M) { + var P = M.imageData, R = this.scaleX, N = this.scaleY; + this.rcpScaleX = 1 / R, this.rcpScaleY = 1 / N; + var F = P.width, U = P.height, $ = g(F * R), G = g(U * N), Q; + this.resizeType === "sliceHack" ? Q = this.sliceByTwo(M, F, U, $, G) : this.resizeType === "hermite" ? Q = this.hermiteFastResize(M, F, U, $, G) : this.resizeType === "bilinear" ? Q = this.bilinearFiltering(M, F, U, $, G) : this.resizeType === "lanczos" && (Q = this.lanczosResize(M, F, U, $, G)), M.imageData = Q; + }, + /** + * Filter sliceByTwo + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + sliceByTwo: function(M, P, R, N, F) { + var U = M.imageData, $ = 0.5, G = !1, Q = !1, ee = P * $, ce = R * $, ne = d.filterBackend.resources, fe, K, Oe = 0, xe = 0, Ge = P, oe = 0; + for (ne.sliceByTwo || (ne.sliceByTwo = document.createElement("canvas")), fe = ne.sliceByTwo, (fe.width < P * 1.5 || fe.height < R) && (fe.width = P * 1.5, fe.height = R), K = fe.getContext("2d"), K.clearRect(0, 0, P * 1.5, R), K.putImageData(U, 0, 0), N = _(N), F = _(F); !G || !Q; ) + P = ee, R = ce, N < _(ee * $) ? ee = _(ee * $) : (ee = N, G = !0), F < _(ce * $) ? ce = _(ce * $) : (ce = F, Q = !0), K.drawImage(fe, Oe, xe, P, R, Ge, oe, ee, ce), Oe = Ge, xe = oe, oe += ce; + return K.getImageData(Oe, xe, N, F); + }, + /** + * Filter lanczosResize + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + lanczosResize: function(M, P, R, N, F) { + function U(se) { + var te, pe, re, ae, le, ue, Ae, Te, Ne, He, je; + for (oe.x = (se + 0.5) * ce, de.x = _(oe.x), te = 0; te < F; te++) { + for (oe.y = (te + 0.5) * ne, de.y = _(oe.y), le = 0, ue = 0, Ae = 0, Te = 0, Ne = 0, pe = de.x - Oe; pe <= de.x + Oe; pe++) + if (!(pe < 0 || pe >= P)) { + He = _(1e3 * x(pe - oe.x)), Ge[He] || (Ge[He] = {}); + for (var be = de.y - xe; be <= de.y + xe; be++) + be < 0 || be >= R || (je = _(1e3 * x(be - oe.y)), Ge[He][je] || (Ge[He][je] = ee(y(m(He * fe, 2) + m(je * K, 2)) / 1e3)), re = Ge[He][je], re > 0 && (ae = (be * P + pe) * 4, le += re, ue += re * $[ae], Ae += re * $[ae + 1], Te += re * $[ae + 2], Ne += re * $[ae + 3])); + } + ae = (te * N + se) * 4, Q[ae] = ue / le, Q[ae + 1] = Ae / le, Q[ae + 2] = Te / le, Q[ae + 3] = Ne / le; + } + return ++se < N ? U(se) : G; + } + var $ = M.imageData.data, G = M.ctx.createImageData(N, F), Q = G.data, ee = this.lanczosCreate(this.lanczosLobes), ce = this.rcpScaleX, ne = this.rcpScaleY, fe = 2 / this.rcpScaleX, K = 2 / this.rcpScaleY, Oe = T(ce * this.lanczosLobes / 2), xe = T(ne * this.lanczosLobes / 2), Ge = {}, oe = {}, de = {}; + return U(0); + }, + /** + * bilinearFiltering + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + bilinearFiltering: function(M, P, R, N, F) { + var U, $, G, Q, ee, ce, ne, fe, K, Oe, xe, Ge, oe = 0, de, se = this.rcpScaleX, te = this.rcpScaleY, pe = 4 * (P - 1), re = M.imageData, ae = re.data, le = M.ctx.createImageData(N, F), ue = le.data; + for (ne = 0; ne < F; ne++) + for (fe = 0; fe < N; fe++) + for (ee = _(se * fe), ce = _(te * ne), K = se * fe - ee, Oe = te * ne - ce, de = 4 * (ce * P + ee), xe = 0; xe < 4; xe++) + U = ae[de + xe], $ = ae[de + 4 + xe], G = ae[de + pe + xe], Q = ae[de + pe + 4 + xe], Ge = U * (1 - K) * (1 - Oe) + $ * K * (1 - Oe) + G * Oe * (1 - K) + Q * K * Oe, ue[oe++] = Ge; + return le; + }, + /** + * hermiteFastResize + * @param {Object} canvasEl Canvas element to apply filter to + * @param {Number} oW Original Width + * @param {Number} oH Original Height + * @param {Number} dW Destination Width + * @param {Number} dH Destination Height + * @returns {ImageData} + */ + hermiteFastResize: function(M, P, R, N, F) { + for (var U = this.rcpScaleX, $ = this.rcpScaleY, G = T(U / 2), Q = T($ / 2), ee = M.imageData, ce = ee.data, ne = M.ctx.createImageData(N, F), fe = ne.data, K = 0; K < F; K++) + for (var Oe = 0; Oe < N; Oe++) { + for (var xe = (Oe + K * N) * 4, Ge = 0, oe = 0, de = 0, se = 0, te = 0, pe = 0, re = 0, ae = (K + 0.5) * $, le = _(K * $); le < (K + 1) * $; le++) + for (var ue = x(ae - (le + 0.5)) / Q, Ae = (Oe + 0.5) * U, Te = ue * ue, Ne = _(Oe * U); Ne < (Oe + 1) * U; Ne++) { + var He = x(Ae - (Ne + 0.5)) / G, je = y(Te + He * He); + je > 1 && je < -1 || (Ge = 2 * je * je * je - 3 * je * je + 1, Ge > 0 && (He = 4 * (Ne + le * P), re += Ge * ce[He + 3], de += Ge, ce[He + 3] < 255 && (Ge = Ge * ce[He + 3] / 250), se += Ge * ce[He], te += Ge * ce[He + 1], pe += Ge * ce[He + 2], oe += Ge)); + } + fe[xe] = se / oe, fe[xe + 1] = te / oe, fe[xe + 2] = pe / oe, fe[xe + 3] = re / de; + } + return ne; + }, + /** + * Returns object representation of an instance + * @return {Object} Object representation of an instance + */ + toObject: function() { + return { + type: this.type, + scaleX: this.scaleX, + scaleY: this.scaleY, + resizeType: this.resizeType, + lanczosLobes: this.lanczosLobes + }; + } + } + ), d.Image.filters.Resize.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Contrast = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Contrast.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Contrast", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uContrast; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast)); +color.rgb = contrastF * (color.rgb - 0.5) + 0.5; +gl_FragColor = color; +}`, + /** + * contrast value, range from -1 to 1. + * @param {Number} contrast + * @default 0 + */ + contrast: 0, + mainParameter: "contrast", + /** + * Constructor + * @memberOf fabric.Image.filters.Contrast.prototype + * @param {Object} [options] Options object + * @param {Number} [options.contrast=0] Value to contrast the image up (-1...1) + */ + /** + * Apply the Contrast operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(y) { + if (this.contrast !== 0) { + var x = y.imageData, g, T, S = x.data, T = S.length, C = Math.floor(this.contrast * 255), E = 259 * (C + 255) / (255 * (259 - C)); + for (g = 0; g < T; g += 4) + S[g] = E * (S[g] - 128) + 128, S[g + 1] = E * (S[g + 1] - 128) + 128, S[g + 2] = E * (S[g + 2] - 128) + 128; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uContrast: y.getUniformLocation(x, "uContrast") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1f(x.uContrast, this.contrast); + } + } + ), d.Image.filters.Contrast.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Saturation = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Saturation.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Saturation", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uSaturation; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float rgMax = max(color.r, color.g); +float rgbMax = max(rgMax, color.b); +color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00; +color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00; +color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00; +gl_FragColor = color; +}`, + /** + * Saturation value, from -1 to 1. + * Increases/decreases the color saturation. + * A value of 0 has no effect. + * + * @param {Number} saturation + * @default + */ + saturation: 0, + mainParameter: "saturation", + /** + * Constructor + * @memberOf fabric.Image.filters.Saturate.prototype + * @param {Object} [options] Options object + * @param {Number} [options.saturate=0] Value to saturate the image (-1...1) + */ + /** + * Apply the Saturation operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + if (this.saturation !== 0) { + var x = y.imageData, g = x.data, S = g.length, T = -this.saturation, C, E; + for (C = 0; C < S; C += 4) + E = Math.max(g[C], g[C + 1], g[C + 2]), g[C] += E !== g[C] ? (E - g[C]) * T : 0, g[C + 1] += E !== g[C + 1] ? (E - g[C + 1]) * T : 0, g[C + 2] += E !== g[C + 2] ? (E - g[C + 2]) * T : 0; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uSaturation: y.getUniformLocation(x, "uSaturation") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1f(x.uSaturation, -this.saturation); + } + } + ), d.Image.filters.Saturation.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Vibrance = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Vibrance.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Vibrance", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform float uVibrance; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +float max = max(color.r, max(color.g, color.b)); +float avg = (color.r + color.g + color.b) / 3.0; +float amt = (abs(max - avg) * 2.0) * uVibrance; +color.r += max != color.r ? (max - color.r) * amt : 0.00; +color.g += max != color.g ? (max - color.g) * amt : 0.00; +color.b += max != color.b ? (max - color.b) * amt : 0.00; +gl_FragColor = color; +}`, + /** + * Vibrance value, from -1 to 1. + * Increases/decreases the saturation of more muted colors with less effect on saturated colors. + * A value of 0 has no effect. + * + * @param {Number} vibrance + * @default + */ + vibrance: 0, + mainParameter: "vibrance", + /** + * Constructor + * @memberOf fabric.Image.filters.Vibrance.prototype + * @param {Object} [options] Options object + * @param {Number} [options.vibrance=0] Vibrance value for the image (between -1 and 1) + */ + /** + * Apply the Vibrance operation to a Uint8ClampedArray representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8ClampedArray to be filtered. + */ + applyTo2d: function(y) { + if (this.vibrance !== 0) { + var x = y.imageData, g = x.data, S = g.length, T = -this.vibrance, C, E, M, P; + for (C = 0; C < S; C += 4) + E = Math.max(g[C], g[C + 1], g[C + 2]), M = (g[C] + g[C + 1] + g[C + 2]) / 3, P = Math.abs(E - M) * 2 / 255 * T, g[C] += E !== g[C] ? (E - g[C]) * P : 0, g[C + 1] += E !== g[C + 1] ? (E - g[C + 1]) * P : 0, g[C + 2] += E !== g[C + 2] ? (E - g[C + 2]) * P : 0; + } + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uVibrance: y.getUniformLocation(x, "uVibrance") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform1f(x.uVibrance, -this.vibrance); + } + } + ), d.Image.filters.Vibrance.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Blur = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Blur.prototype */ + { + type: "Blur", + /* + 'gl_FragColor = vec4(0.0);', + 'gl_FragColor += texture2D(texture, vTexCoord + -7 * uDelta)*0.0044299121055113265;', + 'gl_FragColor += texture2D(texture, vTexCoord + -6 * uDelta)*0.00895781211794;', + 'gl_FragColor += texture2D(texture, vTexCoord + -5 * uDelta)*0.0215963866053;', + 'gl_FragColor += texture2D(texture, vTexCoord + -4 * uDelta)*0.0443683338718;', + 'gl_FragColor += texture2D(texture, vTexCoord + -3 * uDelta)*0.0776744219933;', + 'gl_FragColor += texture2D(texture, vTexCoord + -2 * uDelta)*0.115876621105;', + 'gl_FragColor += texture2D(texture, vTexCoord + -1 * uDelta)*0.147308056121;', + 'gl_FragColor += texture2D(texture, vTexCoord )*0.159576912161;', + 'gl_FragColor += texture2D(texture, vTexCoord + 1 * uDelta)*0.147308056121;', + 'gl_FragColor += texture2D(texture, vTexCoord + 2 * uDelta)*0.115876621105;', + 'gl_FragColor += texture2D(texture, vTexCoord + 3 * uDelta)*0.0776744219933;', + 'gl_FragColor += texture2D(texture, vTexCoord + 4 * uDelta)*0.0443683338718;', + 'gl_FragColor += texture2D(texture, vTexCoord + 5 * uDelta)*0.0215963866053;', + 'gl_FragColor += texture2D(texture, vTexCoord + 6 * uDelta)*0.00895781211794;', + 'gl_FragColor += texture2D(texture, vTexCoord + 7 * uDelta)*0.0044299121055113265;', + */ + /* eslint-disable max-len */ + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec2 uDelta; +varying vec2 vTexCoord; +const float nSamples = 15.0; +vec3 v3offset = vec3(12.9898, 78.233, 151.7182); +float random(vec3 scale) { +return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453); +} +void main() { +vec4 color = vec4(0.0); +float total = 0.0; +float offset = random(v3offset); +for (float t = -nSamples; t <= nSamples; t++) { +float percent = (t + offset - 0.5) / nSamples; +float weight = 1.0 - abs(percent); +color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight; +total += weight; +} +gl_FragColor = color / total; +}`, + /* eslint-enable max-len */ + /** + * blur value, in percentage of image dimensions. + * specific to keep the image blur constant at different resolutions + * range between 0 and 1. + */ + blur: 0, + mainParameter: "blur", + applyTo: function(y) { + y.webgl ? (this.aspectRatio = y.sourceWidth / y.sourceHeight, y.passes++, this._setupFrameBuffer(y), this.horizontal = !0, this.applyToWebGL(y), this._swapTextures(y), this._setupFrameBuffer(y), this.horizontal = !1, this.applyToWebGL(y), this._swapTextures(y)) : this.applyTo2d(y); + }, + applyTo2d: function(y) { + y.imageData = this.simpleBlur(y); + }, + simpleBlur: function(y) { + var x = y.filterBackend.resources, g, S, T = y.imageData.width, C = y.imageData.height; + x.blurLayer1 || (x.blurLayer1 = d.util.createCanvasElement(), x.blurLayer2 = d.util.createCanvasElement()), g = x.blurLayer1, S = x.blurLayer2, (g.width !== T || g.height !== C) && (S.width = g.width = T, S.height = g.height = C); + var E = g.getContext("2d"), M = S.getContext("2d"), P = 15, R, N, F, U, $ = this.blur * 0.06 * 0.5; + for (E.putImageData(y.imageData, 0, 0), M.clearRect(0, 0, T, C), U = -P; U <= P; U++) + R = (Math.random() - 0.5) / 4, N = U / P, F = $ * N * T + R, M.globalAlpha = 1 - Math.abs(N), M.drawImage(g, F, R), E.drawImage(S, 0, 0), M.globalAlpha = 1, M.clearRect(0, 0, S.width, S.height); + for (U = -P; U <= P; U++) + R = (Math.random() - 0.5) / 4, N = U / P, F = $ * N * C + R, M.globalAlpha = 1 - Math.abs(N), M.drawImage(g, R, F), E.drawImage(S, 0, 0), M.globalAlpha = 1, M.clearRect(0, 0, S.width, S.height); + y.ctx.drawImage(g, 0, 0); + var G = y.ctx.getImageData(0, 0, g.width, g.height); + return E.globalAlpha = 1, E.clearRect(0, 0, g.width, g.height), G; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + delta: y.getUniformLocation(x, "uDelta") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + var g = this.chooseRightDelta(); + y.uniform2fv(x.delta, g); + }, + /** + * choose right value of image percentage to blur with + * @returns {Array} a numeric array with delta values + */ + chooseRightDelta: function() { + var y = 1, x = [0, 0], g; + return this.horizontal ? this.aspectRatio > 1 && (y = 1 / this.aspectRatio) : this.aspectRatio < 1 && (y = this.aspectRatio), g = y * this.blur * 0.12, this.horizontal ? x[0] = g : x[1] = g, x; + } + } + ), m.Blur.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Gamma = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Gamma.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Gamma", + fragmentSource: `precision highp float; +uniform sampler2D uTexture; +uniform vec3 uGamma; +varying vec2 vTexCoord; +void main() { +vec4 color = texture2D(uTexture, vTexCoord); +vec3 correction = (1.0 / uGamma); +color.r = pow(color.r, correction.r); +color.g = pow(color.g, correction.g); +color.b = pow(color.b, correction.b); +gl_FragColor = color; +gl_FragColor.rgb *= color.a; +}`, + /** + * Gamma array value, from 0.01 to 2.2. + * @param {Array} gamma + * @default + */ + gamma: [1, 1, 1], + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "gamma", + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(y) { + this.gamma = [1, 1, 1], m.BaseFilter.prototype.initialize.call(this, y); + }, + /** + * Apply the Gamma operation to a Uint8Array representing the pixels of an image. + * + * @param {Object} options + * @param {ImageData} options.imageData The Uint8Array to be filtered. + */ + applyTo2d: function(y) { + var x = y.imageData, g = x.data, S = this.gamma, T = g.length, C = 1 / S[0], E = 1 / S[1], M = 1 / S[2], P; + for (this.rVals || (this.rVals = new Uint8Array(256), this.gVals = new Uint8Array(256), this.bVals = new Uint8Array(256)), P = 0, T = 256; P < T; P++) + this.rVals[P] = Math.pow(P / 255, C) * 255, this.gVals[P] = Math.pow(P / 255, E) * 255, this.bVals[P] = Math.pow(P / 255, M) * 255; + for (P = 0, T = g.length; P < T; P += 4) + g[P] = this.rVals[g[P]], g[P + 1] = this.gVals[g[P + 1]], g[P + 2] = this.bVals[g[P + 2]]; + }, + /** + * Return WebGL uniform locations for this filter's shader. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {WebGLShaderProgram} program This filter's compiled shader program. + */ + getUniformLocations: function(y, x) { + return { + uGamma: y.getUniformLocation(x, "uGamma") + }; + }, + /** + * Send data from this filter to its shader program's uniforms. + * + * @param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader. + * @param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects + */ + sendUniformData: function(y, x) { + y.uniform3fv(x.uGamma, this.gamma); + } + } + ), d.Image.filters.Gamma.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.Composed = _( + m.BaseFilter, + /** @lends fabric.Image.filters.Composed.prototype */ + { + type: "Composed", + /** + * A non sparse array of filters to apply + */ + subFilters: [], + /** + * Constructor + * @param {Object} [options] Options object + */ + initialize: function(y) { + this.callSuper("initialize", y), this.subFilters = this.subFilters.slice(0); + }, + /** + * Apply this container's filters to the input image provided. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be applied. + */ + applyTo: function(y) { + y.passes += this.subFilters.length - 1, this.subFilters.forEach(function(x) { + x.applyTo(y); + }); + }, + /** + * Serialize this filter into JSON. + * + * @returns {Object} A JSON representation of this filter. + */ + toObject: function() { + return d.util.object.extend(this.callSuper("toObject"), { + subFilters: this.subFilters.map(function(y) { + return y.toObject(); + }) + }); + }, + isNeutralState: function() { + return !this.subFilters.some(function(y) { + return !y.isNeutralState(); + }); + } + } + ), d.Image.filters.Composed.fromObject = function(y, x) { + var g = y.subFilters || [], S = g.map(function(C) { + return new d.Image.filters[C.type](C); + }), T = new d.Image.filters.Composed({ subFilters: S }); + return x && x(T), T; + }; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.Image.filters, _ = d.util.createClass; + m.HueRotation = _( + m.ColorMatrix, + /** @lends fabric.Image.filters.HueRotation.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "HueRotation", + /** + * HueRotation value, from -1 to 1. + * the unit is radians + * @param {Number} myParameter + * @default + */ + rotation: 0, + /** + * Describe the property that is the filter parameter + * @param {String} m + * @default + */ + mainParameter: "rotation", + calculateMatrix: function() { + var y = this.rotation * Math.PI, x = d.util.cos(y), g = d.util.sin(y), S = 1 / 3, T = Math.sqrt(S) * g, C = 1 - x; + this.matrix = [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0 + ], this.matrix[0] = x + C / 3, this.matrix[1] = S * C - T, this.matrix[2] = S * C + T, this.matrix[5] = S * C + T, this.matrix[6] = x + S * C, this.matrix[7] = S * C - T, this.matrix[10] = S * C - T, this.matrix[11] = S * C + T, this.matrix[12] = x + S * C; + }, + /** + * HueRotation isNeutralState implementation + * Used only in image applyFilters to discard filters that will not have an effect + * on the image + * @param {Object} options + **/ + isNeutralState: function(y) { + return this.calculateMatrix(), m.BaseFilter.prototype.isNeutralState.call(this, y); + }, + /** + * Apply this filter to the input image data provided. + * + * Determines whether to use WebGL or Canvas2D based on the options.webgl flag. + * + * @param {Object} options + * @param {Number} options.passes The number of filters remaining to be executed + * @param {Boolean} options.webgl Whether to use webgl to render the filter. + * @param {WebGLTexture} options.sourceTexture The texture setup as the source to be filtered. + * @param {WebGLTexture} options.targetTexture The texture where filtered output should be drawn. + * @param {WebGLRenderingContext} options.context The GL context used for rendering. + * @param {Object} options.programCache A map of compiled shader programs, keyed by filter type. + */ + applyTo: function(y) { + this.calculateMatrix(), m.BaseFilter.prototype.applyTo.call(this, y); + } + } + ), d.Image.filters.HueRotation.fromObject = d.Image.filters.BaseFilter.fromObject; + }(l), function(p) { + var d = p.fabric || (p.fabric = {}), m = d.util.object.clone; + if (d.Text) { + d.warn("fabric.Text is already defined"); + return; + } + var _ = "fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide".split(" "); + d.Text = d.util.createClass( + d.Object, + /** @lends fabric.Text.prototype */ + { + /** + * Properties which when set cause object to change dimensions + * @type Array + * @private + */ + _dimensionAffectingProps: [ + "fontSize", + "fontWeight", + "fontFamily", + "fontStyle", + "lineHeight", + "text", + "charSpacing", + "textAlign", + "styles", + "path", + "pathStartOffset", + "pathSide" + ], + /** + * @private + */ + _reNewline: /\r?\n/, + /** + * Use this regular expression to filter for whitespaces that is not a new line. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reSpacesAndTabs: /[ \t\r]/g, + /** + * Use this regular expression to filter for whitespace that is not a new line. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reSpaceAndTab: /[ \t\r]/, + /** + * Use this regular expression to filter consecutive groups of non spaces. + * Mostly used when text is 'justify' aligned. + * @private + */ + _reWords: /\S+/g, + /** + * Type of an object + * @type String + * @default + */ + type: "text", + /** + * Font size (in pixels) + * @type Number + * @default + */ + fontSize: 40, + /** + * Font weight (e.g. bold, normal, 400, 600, 800) + * @type {(Number|String)} + * @default + */ + fontWeight: "normal", + /** + * Font family + * @type String + * @default + */ + fontFamily: "Times New Roman", + /** + * Text decoration underline. + * @type Boolean + * @default + */ + underline: !1, + /** + * Text decoration overline. + * @type Boolean + * @default + */ + overline: !1, + /** + * Text decoration linethrough. + * @type Boolean + * @default + */ + linethrough: !1, + /** + * Text alignment. Possible values: "left", "center", "right", "justify", + * "justify-left", "justify-center" or "justify-right". + * @type String + * @default + */ + textAlign: "left", + /** + * Font style . Possible values: "", "normal", "italic" or "oblique". + * @type String + * @default + */ + fontStyle: "normal", + /** + * Line height + * @type Number + * @default + */ + lineHeight: 1.16, + /** + * Superscript schema object (minimum overlap) + * @type {Object} + * @default + */ + superscript: { + size: 0.6, + // fontSize factor + baseline: -0.35 + // baseline-shift factor (upwards) + }, + /** + * Subscript schema object (minimum overlap) + * @type {Object} + * @default + */ + subscript: { + size: 0.6, + // fontSize factor + baseline: 0.11 + // baseline-shift factor (downwards) + }, + /** + * Background color of text lines + * @type String + * @default + */ + textBackgroundColor: "", + /** + * List of properties to consider when checking if + * state of an object is changed ({@link fabric.Object#hasStateChanged}) + * as well as for history (undo/redo) purposes + * @type Array + */ + stateProperties: d.Object.prototype.stateProperties.concat(_), + /** + * List of properties to consider when checking if cache needs refresh + * @type Array + */ + cacheProperties: d.Object.prototype.cacheProperties.concat(_), + /** + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note: This property was named "strokeStyle" until v1.1.6 + * @type String + * @default + */ + stroke: null, + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property was named "textShadow" (String) until v1.2.11 + * @type fabric.Shadow + * @default + */ + shadow: null, + /** + * fabric.Path that the text should follow. + * since 4.6.0 the path will be drawn automatically. + * if you want to make the path visible, give it a stroke and strokeWidth or fill value + * if you want it to be hidden, assign visible = false to the path. + * This feature is in BETA, and SVG import/export is not yet supported. + * @type fabric.Path + * @example + * var textPath = new fabric.Text('Text on a path', { + * top: 150, + * left: 150, + * textAlign: 'center', + * charSpacing: -50, + * path: new fabric.Path('M 0 0 C 50 -100 150 -100 200 0', { + * strokeWidth: 1, + * visible: false + * }), + * pathSide: 'left', + * pathStartOffset: 0 + * }); + * @default + */ + path: null, + /** + * Offset amount for text path starting position + * Only used when text has a path + * @type Number + * @default + */ + pathStartOffset: 0, + /** + * Which side of the path the text should be drawn on. + * Only used when text has a path + * @type {String} 'left|right' + * @default + */ + pathSide: "left", + /** + * @private + */ + _fontSizeFraction: 0.222, + /** + * @private + */ + offsets: { + underline: 0.1, + linethrough: -0.315, + overline: -0.88 + }, + /** + * Text Line proportion to font Size (in pixels) + * @type Number + * @default + */ + _fontSizeMult: 1.13, + /** + * additional space between characters + * expressed in thousands of em unit + * @type Number + * @default + */ + charSpacing: 0, + /** + * Object containing character styles - top-level properties -> line numbers, + * 2nd-level properties - character numbers + * @type Object + * @default + */ + styles: null, + /** + * Reference to a context to measure text char or couple of chars + * the cacheContext of the canvas will be used or a freshly created one if the object is not on canvas + * once created it will be referenced on fabric._measuringContext to avoid creating a canvas for every + * text object created. + * @type {CanvasRenderingContext2D} + * @default + */ + _measuringContext: null, + /** + * Baseline shift, styles only, keep at 0 for the main text object + * @type {Number} + * @default + */ + deltaY: 0, + /** + * WARNING: EXPERIMENTAL. NOT SUPPORTED YET + * determine the direction of the text. + * This has to be set manually together with textAlign and originX for proper + * experience. + * some interesting link for the future + * https://www.w3.org/International/questions/qa-bidi-unicode-controls + * @since 4.5.0 + * @type {String} 'ltr|rtl' + * @default + */ + direction: "ltr", + /** + * Array of properties that define a style unit (of 'styles'). + * @type {Array} + * @default + */ + _styleProperties: [ + "stroke", + "strokeWidth", + "fill", + "fontFamily", + "fontSize", + "fontWeight", + "fontStyle", + "underline", + "overline", + "linethrough", + "deltaY", + "textBackgroundColor" + ], + /** + * contains characters bounding boxes + */ + __charBounds: [], + /** + * use this size when measuring text. To avoid IE11 rounding errors + * @type {Number} + * @default + * @readonly + * @private + */ + CACHE_FONT_SIZE: 400, + /** + * contains the min text width to avoid getting 0 + * @type {Number} + * @default + */ + MIN_TEXT_WIDTH: 2, + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.Text} thisArg + */ + initialize: function(y, x) { + this.styles = x ? x.styles || {} : {}, this.text = y, this.__skipDimension = !0, this.callSuper("initialize", x), this.path && this.setPathInfo(), this.__skipDimension = !1, this.initDimensions(), this.setCoords(), this.setupState({ propertySet: "_dimensionAffectingProps" }); + }, + /** + * If text has a path, it will add the extra information needed + * for path and text calculations + * @return {fabric.Text} thisArg + */ + setPathInfo: function() { + var y = this.path; + y && (y.segmentsInfo = d.util.getPathSegmentsInfo(y.path)); + }, + /** + * Return a context for measurement of text string. + * if created it gets stored for reuse + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.Text} thisArg + */ + getMeasuringContext: function() { + return d._measuringContext || (d._measuringContext = this.canvas && this.canvas.contextCache || d.util.createCanvasElement().getContext("2d")), d._measuringContext; + }, + /** + * @private + * Divides text into lines of text and lines of graphemes. + */ + _splitText: function() { + var y = this._splitTextIntoLines(this.text); + return this.textLines = y.lines, this._textLines = y.graphemeLines, this._unwrappedTextLines = y._unwrappedLines, this._text = y.graphemeText, y; + }, + /** + * Initialize or update text dimensions. + * Updates this.width and this.height with the proper values. + * Does not return dimensions. + */ + initDimensions: function() { + this.__skipDimension || (this._splitText(), this._clearCache(), this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.saveState({ propertySet: "_dimensionAffectingProps" })); + }, + /** + * Enlarge space boxes and shift the others + */ + enlargeSpaces: function() { + for (var y, x, g, S, T, C, E, M = 0, P = this._textLines.length; M < P; M++) + if (!(this.textAlign !== "justify" && (M === P - 1 || this.isEndOfWrapping(M))) && (S = 0, T = this._textLines[M], x = this.getLineWidth(M), x < this.width && (E = this.textLines[M].match(this._reSpacesAndTabs)))) { + g = E.length, y = (this.width - x) / g; + for (var R = 0, N = T.length; R <= N; R++) + C = this.__charBounds[M][R], this._reSpaceAndTab.test(T[R]) ? (C.width += y, C.kernedWidth += y, C.left += S, S += y) : C.left += S; + } + }, + /** + * Detect if the text line is ended with an hard break + * text and itext do not have wrapping, return false + * @return {Boolean} + */ + isEndOfWrapping: function(y) { + return y === this._textLines.length - 1; + }, + /** + * Detect if a line has a linebreak and so we need to account for it when moving + * and counting style. + * It return always for text and Itext. + * @return Number + */ + missingNewlineOffset: function() { + return 1; + }, + /** + * Returns string representation of an instance + * @return {String} String representation of text object + */ + toString: function() { + return "#'; + }, + /** + * Return the dimension and the zoom level needed to create a cache canvas + * big enough to host the object to be cached. + * @private + * @param {Object} dim.x width of object to be cached + * @param {Object} dim.y height of object to be cached + * @return {Object}.width width of canvas + * @return {Object}.height height of canvas + * @return {Object}.zoomX zoomX zoom value to unscale the canvas before drawing cache + * @return {Object}.zoomY zoomY zoom value to unscale the canvas before drawing cache + */ + _getCacheCanvasDimensions: function() { + var y = this.callSuper("_getCacheCanvasDimensions"), x = this.fontSize; + return y.width += x * y.zoomX, y.height += x * y.zoomY, y; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(y) { + var x = this.path; + x && !x.isNotVisible() && x._render(y), this._setTextStyles(y), this._renderTextLinesBackground(y), this._renderTextDecoration(y, "underline"), this._renderText(y), this._renderTextDecoration(y, "overline"), this._renderTextDecoration(y, "linethrough"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderText: function(y) { + this.paintFirst === "stroke" ? (this._renderTextStroke(y), this._renderTextFill(y)) : (this._renderTextFill(y), this._renderTextStroke(y)); + }, + /** + * Set the font parameter of the context with the object properties or with charStyle + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Object} [charStyle] object with font style properties + * @param {String} [charStyle.fontFamily] Font Family + * @param {Number} [charStyle.fontSize] Font size in pixels. ( without px suffix ) + * @param {String} [charStyle.fontWeight] Font weight + * @param {String} [charStyle.fontStyle] Font style (italic|normal) + */ + _setTextStyles: function(y, x, g) { + y.textBaseline = "alphabetic", y.font = this._getFontDeclaration(x, g); + }, + /** + * calculate and return the text Width measuring each line. + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @return {Number} Maximum width of fabric.Text object + */ + calcTextWidth: function() { + for (var y = this.getLineWidth(0), x = 1, g = this._textLines.length; x < g; x++) { + var S = this.getLineWidth(x); + S > y && (y = S); + } + return y; + }, + /** + * @private + * @param {String} method Method name ("fillText" or "strokeText") + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {String} line Text to render + * @param {Number} left Left position of text + * @param {Number} top Top position of text + * @param {Number} lineIndex Index of a line in a text + */ + _renderTextLine: function(y, x, g, S, T, C) { + this._renderChars(y, x, g, S, T, C); + }, + /** + * Renders the text background for lines, taking care of style + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextLinesBackground: function(y) { + if (!(!this.textBackgroundColor && !this.styleHas("textBackgroundColor"))) { + for (var x, g, S = y.fillStyle, T, C, E = this._getLeftOffset(), M = this._getTopOffset(), P = 0, R = 0, N, F, U = this.path, $, G = 0, Q = this._textLines.length; G < Q; G++) { + if (x = this.getHeightOfLine(G), !this.textBackgroundColor && !this.styleHas("textBackgroundColor", G)) { + M += x; + continue; + } + T = this._textLines[G], g = this._getLineLeftOffset(G), R = 0, P = 0, C = this.getValueOfPropertyAt(G, 0, "textBackgroundColor"); + for (var ee = 0, ce = T.length; ee < ce; ee++) + N = this.__charBounds[G][ee], F = this.getValueOfPropertyAt(G, ee, "textBackgroundColor"), U ? (y.save(), y.translate(N.renderLeft, N.renderTop), y.rotate(N.angle), y.fillStyle = F, F && y.fillRect( + -N.width / 2, + -x / this.lineHeight * (1 - this._fontSizeFraction), + N.width, + x / this.lineHeight + ), y.restore()) : F !== C ? ($ = E + g + P, this.direction === "rtl" && ($ = this.width - $ - R), y.fillStyle = C, C && y.fillRect( + $, + M, + R, + x / this.lineHeight + ), P = N.left, R = N.width, C = F) : R += N.kernedWidth; + F && !U && ($ = E + g + P, this.direction === "rtl" && ($ = this.width - $ - R), y.fillStyle = F, y.fillRect( + $, + M, + R, + x / this.lineHeight + )), M += x; + } + y.fillStyle = S, this._removeShadow(y); + } + }, + /** + * @private + * @param {Object} decl style declaration for cache + * @param {String} decl.fontFamily fontFamily + * @param {String} decl.fontStyle fontStyle + * @param {String} decl.fontWeight fontWeight + * @return {Object} reference to cache + */ + getFontCache: function(y) { + var x = y.fontFamily.toLowerCase(); + d.charWidthsCache[x] || (d.charWidthsCache[x] = {}); + var g = d.charWidthsCache[x], S = y.fontStyle.toLowerCase() + "_" + (y.fontWeight + "").toLowerCase(); + return g[S] || (g[S] = {}), g[S]; + }, + /** + * measure and return the width of a single character. + * possibly overridden to accommodate different measure logic or + * to hook some external lib for character measurement + * @private + * @param {String} _char, char to be measured + * @param {Object} charStyle style of char to be measured + * @param {String} [previousChar] previous char + * @param {Object} [prevCharStyle] style of previous char + */ + _measureChar: function(y, x, g, S) { + var T = this.getFontCache(x), C = this._getFontDeclaration(x), E = this._getFontDeclaration(S), M = g + y, P = C === E, R, N, F, U = x.fontSize / this.CACHE_FONT_SIZE, $; + if (g && T[g] !== void 0 && (F = T[g]), T[y] !== void 0 && ($ = R = T[y]), P && T[M] !== void 0 && (N = T[M], $ = N - F), R === void 0 || F === void 0 || N === void 0) { + var G = this.getMeasuringContext(); + this._setTextStyles(G, x, !0); + } + return R === void 0 && ($ = R = G.measureText(y).width, T[y] = R), F === void 0 && P && g && (F = G.measureText(g).width, T[g] = F), P && N === void 0 && (N = G.measureText(M).width, T[M] = N, $ = N - F), { width: R * U, kernedWidth: $ * U }; + }, + /** + * Computes height of character at given position + * @param {Number} line the line index number + * @param {Number} _char the character index number + * @return {Number} fontSize of the character + */ + getHeightOfChar: function(y, x) { + return this.getValueOfPropertyAt(y, x, "fontSize"); + }, + /** + * measure a text line measuring all characters. + * @param {Number} lineIndex line number + * @return {Number} Line width + */ + measureLine: function(y) { + var x = this._measureLine(y); + return this.charSpacing !== 0 && (x.width -= this._getWidthOfCharSpacing()), x.width < 0 && (x.width = 0), x; + }, + /** + * measure every grapheme of a line, populating __charBounds + * @param {Number} lineIndex + * @return {Object} object.width total width of characters + * @return {Object} object.widthOfSpaces length of chars that match this._reSpacesAndTabs + */ + _measureLine: function(y) { + var x = 0, g, S, T = this._textLines[y], C, E, M = 0, P = new Array(T.length), R = 0, N, F, U = this.path, $ = this.pathSide === "right"; + for (this.__charBounds[y] = P, g = 0; g < T.length; g++) + S = T[g], E = this._getGraphemeBox(S, y, g, C), P[g] = E, x += E.kernedWidth, C = S; + if (P[g] = { + left: E ? E.left + E.width : 0, + width: 0, + kernedWidth: 0, + height: this.fontSize + }, U) { + switch (F = U.segmentsInfo[U.segmentsInfo.length - 1].length, N = d.util.getPointOnPath(U.path, 0, U.segmentsInfo), N.x += U.pathOffset.x, N.y += U.pathOffset.y, this.textAlign) { + case "left": + R = $ ? F - x : 0; + break; + case "center": + R = (F - x) / 2; + break; + case "right": + R = $ ? 0 : F - x; + break; + } + for (R += this.pathStartOffset * ($ ? -1 : 1), g = $ ? T.length - 1 : 0; $ ? g >= 0 : g < T.length; $ ? g-- : g++) + E = P[g], R > F ? R %= F : R < 0 && (R += F), this._setGraphemeOnPath(R, E, N), R += E.kernedWidth; + } + return { width: x, numOfSpaces: M }; + }, + /** + * Calculate the angle and the left,top position of the char that follow a path. + * It appends it to graphemeInfo to be reused later at rendering + * @private + * @param {Number} positionInPath to be measured + * @param {Object} graphemeInfo current grapheme box information + * @param {Object} startingPoint position of the point + */ + _setGraphemeOnPath: function(y, x, g) { + var S = y + x.kernedWidth / 2, T = this.path, C = d.util.getPointOnPath(T.path, S, T.segmentsInfo); + x.renderLeft = C.x - g.x, x.renderTop = C.y - g.y, x.angle = C.angle + (this.pathSide === "right" ? Math.PI : 0); + }, + /** + * Measure and return the info of a single grapheme. + * needs the the info of previous graphemes already filled + * @private + * @param {String} grapheme to be measured + * @param {Number} lineIndex index of the line where the char is + * @param {Number} charIndex position in the line + * @param {String} [prevGrapheme] character preceding the one to be measured + */ + _getGraphemeBox: function(y, x, g, S, T) { + var C = this.getCompleteStyleDeclaration(x, g), E = S ? this.getCompleteStyleDeclaration(x, g - 1) : {}, M = this._measureChar(y, C, S, E), P = M.kernedWidth, R = M.width, N; + this.charSpacing !== 0 && (N = this._getWidthOfCharSpacing(), R += N, P += N); + var F = { + width: R, + left: 0, + height: C.fontSize, + kernedWidth: P, + deltaY: C.deltaY + }; + if (g > 0 && !T) { + var U = this.__charBounds[x][g - 1]; + F.left = U.left + U.width + M.kernedWidth - M.width; + } + return F; + }, + /** + * Calculate height of line at 'lineIndex' + * @param {Number} lineIndex index of line to calculate + * @return {Number} + */ + getHeightOfLine: function(y) { + if (this.__lineHeights[y]) + return this.__lineHeights[y]; + for (var x = this._textLines[y], g = this.getHeightOfChar(y, 0), S = 1, T = x.length; S < T; S++) + g = Math.max(this.getHeightOfChar(y, S), g); + return this.__lineHeights[y] = g * this.lineHeight * this._fontSizeMult; + }, + /** + * Calculate text box height + */ + calcTextHeight: function() { + for (var y, x = 0, g = 0, S = this._textLines.length; g < S; g++) + y = this.getHeightOfLine(g), x += g === S - 1 ? y / this.lineHeight : y; + return x; + }, + /** + * @private + * @return {Number} Left offset + */ + _getLeftOffset: function() { + return this.direction === "ltr" ? -this.width / 2 : this.width / 2; + }, + /** + * @private + * @return {Number} Top offset + */ + _getTopOffset: function() { + return -this.height / 2; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {String} method Method name ("fillText" or "strokeText") + */ + _renderTextCommon: function(y, x) { + y.save(); + for (var g = 0, S = this._getLeftOffset(), T = this._getTopOffset(), C = 0, E = this._textLines.length; C < E; C++) { + var M = this.getHeightOfLine(C), P = M / this.lineHeight, R = this._getLineLeftOffset(C); + this._renderTextLine( + x, + y, + this._textLines[C], + S + R, + T + g + P, + C + ), g += M; + } + y.restore(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextFill: function(y) { + !this.fill && !this.styleHas("fill") || this._renderTextCommon(y, "fillText"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextStroke: function(y) { + (!this.stroke || this.strokeWidth === 0) && this.isEmptyStyles() || (this.shadow && !this.shadow.affectStroke && this._removeShadow(y), y.save(), this._setLineDash(y, this.strokeDashArray), y.beginPath(), this._renderTextCommon(y, "strokeText"), y.closePath(), y.restore()); + }, + /** + * @private + * @param {String} method fillText or strokeText. + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Array} line Content of the line, splitted in an array by grapheme + * @param {Number} left + * @param {Number} top + * @param {Number} lineIndex + */ + _renderChars: function(y, x, g, S, T, C) { + var E = this.getHeightOfLine(C), M = this.textAlign.indexOf("justify") !== -1, P, R, N = "", F, U = 0, $, G = this.path, Q = !M && this.charSpacing === 0 && this.isEmptyStyles(C) && !G, ee = this.direction === "ltr", ce = this.direction === "ltr" ? 1 : -1, ne; + if (x.save(), T -= E * this._fontSizeFraction / this.lineHeight, Q) { + x.canvas.setAttribute("dir", ee ? "ltr" : "rtl"), x.direction = ee ? "ltr" : "rtl", x.textAlign = ee ? "left" : "right", this._renderChar(y, x, C, 0, g.join(""), S, T, E), x.restore(); + return; + } + for (var fe = 0, K = g.length - 1; fe <= K; fe++) + $ = fe === K || this.charSpacing || G, N += g[fe], F = this.__charBounds[C][fe], U === 0 ? (S += ce * (F.kernedWidth - F.width), U += F.width) : U += F.kernedWidth, M && !$ && this._reSpaceAndTab.test(g[fe]) && ($ = !0), $ || (P = P || this.getCompleteStyleDeclaration(C, fe), R = this.getCompleteStyleDeclaration(C, fe + 1), $ = this._hasStyleChanged(P, R)), $ && (G ? (x.save(), x.translate(F.renderLeft, F.renderTop), x.rotate(F.angle), this._renderChar(y, x, C, fe, N, -U / 2, 0, E), x.restore()) : (ne = S, x.canvas.setAttribute("dir", ee ? "ltr" : "rtl"), x.direction = ee ? "ltr" : "rtl", x.textAlign = ee ? "left" : "right", this._renderChar(y, x, C, fe, N, ne, T, E)), N = "", P = R, S += ce * U, U = 0); + x.restore(); + }, + /** + * This function try to patch the missing gradientTransform on canvas gradients. + * transforming a context to transform the gradient, is going to transform the stroke too. + * we want to transform the gradient but not the stroke operation, so we create + * a transformed gradient on a pattern and then we use the pattern instead of the gradient. + * this method has drawbacks: is slow, is in low resolution, needs a patch for when the size + * is limited. + * @private + * @param {fabric.Gradient} filler a fabric gradient instance + * @return {CanvasPattern} a pattern to use as fill/stroke style + */ + _applyPatternGradientTransformText: function(y) { + var x = d.util.createCanvasElement(), g, S = this.width + this.strokeWidth, T = this.height + this.strokeWidth; + return x.width = S, x.height = T, g = x.getContext("2d"), g.beginPath(), g.moveTo(0, 0), g.lineTo(S, 0), g.lineTo(S, T), g.lineTo(0, T), g.closePath(), g.translate(S / 2, T / 2), g.fillStyle = y.toLive(g), this._applyPatternGradientTransform(g, y), g.fill(), g.createPattern(x, "no-repeat"); + }, + handleFiller: function(y, x, g) { + var S, T; + return g.toLive ? g.gradientUnits === "percentage" || g.gradientTransform || g.patternTransform ? (S = -this.width / 2, T = -this.height / 2, y.translate(S, T), y[x] = this._applyPatternGradientTransformText(g), { offsetX: S, offsetY: T }) : (y[x] = g.toLive(y, this), this._applyPatternGradientTransform(y, g)) : (y[x] = g, { offsetX: 0, offsetY: 0 }); + }, + _setStrokeStyles: function(y, x) { + return y.lineWidth = x.strokeWidth, y.lineCap = this.strokeLineCap, y.lineDashOffset = this.strokeDashOffset, y.lineJoin = this.strokeLineJoin, y.miterLimit = this.strokeMiterLimit, this.handleFiller(y, "strokeStyle", x.stroke); + }, + _setFillStyles: function(y, x) { + return this.handleFiller(y, "fillStyle", x.fill); + }, + /** + * @private + * @param {String} method + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {String} _char + * @param {Number} left Left coordinate + * @param {Number} top Top coordinate + * @param {Number} lineHeight Height of the line + */ + _renderChar: function(y, x, g, S, T, C, E) { + var M = this._getStyleDeclaration(g, S), P = this.getCompleteStyleDeclaration(g, S), R = y === "fillText" && P.fill, N = y === "strokeText" && P.stroke && P.strokeWidth, F, U; + !N && !R || (x.save(), R && (F = this._setFillStyles(x, P)), N && (U = this._setStrokeStyles(x, P)), x.font = this._getFontDeclaration(P), M && M.textBackgroundColor && this._removeShadow(x), M && M.deltaY && (E += M.deltaY), R && x.fillText(T, C - F.offsetX, E - F.offsetY), N && x.strokeText(T, C - U.offsetX, E - U.offsetY), x.restore()); + }, + /** + * Turns the character into a 'superior figure' (i.e. 'superscript') + * @param {Number} start selection start + * @param {Number} end selection end + * @returns {fabric.Text} thisArg + * @chainable + */ + setSuperscript: function(y, x) { + return this._setScript(y, x, this.superscript); + }, + /** + * Turns the character into an 'inferior figure' (i.e. 'subscript') + * @param {Number} start selection start + * @param {Number} end selection end + * @returns {fabric.Text} thisArg + * @chainable + */ + setSubscript: function(y, x) { + return this._setScript(y, x, this.subscript); + }, + /** + * Applies 'schema' at given position + * @private + * @param {Number} start selection start + * @param {Number} end selection end + * @param {Number} schema + * @returns {fabric.Text} thisArg + * @chainable + */ + _setScript: function(y, x, g) { + var S = this.get2DCursorLocation(y, !0), T = this.getValueOfPropertyAt(S.lineIndex, S.charIndex, "fontSize"), C = this.getValueOfPropertyAt(S.lineIndex, S.charIndex, "deltaY"), E = { fontSize: T * g.size, deltaY: C + T * g.baseline }; + return this.setSelectionStyles(E, y, x), this; + }, + /** + * @private + * @param {Object} prevStyle + * @param {Object} thisStyle + */ + _hasStyleChanged: function(y, x) { + return y.fill !== x.fill || y.stroke !== x.stroke || y.strokeWidth !== x.strokeWidth || y.fontSize !== x.fontSize || y.fontFamily !== x.fontFamily || y.fontWeight !== x.fontWeight || y.fontStyle !== x.fontStyle || y.deltaY !== x.deltaY; + }, + /** + * @private + * @param {Object} prevStyle + * @param {Object} thisStyle + */ + _hasStyleChangedForSvg: function(y, x) { + return this._hasStyleChanged(y, x) || y.overline !== x.overline || y.underline !== x.underline || y.linethrough !== x.linethrough; + }, + /** + * @private + * @param {Number} lineIndex index text line + * @return {Number} Line left offset + */ + _getLineLeftOffset: function(y) { + var x = this.getLineWidth(y), g = this.width - x, S = this.textAlign, T = this.direction, E, C = 0, E = this.isEndOfWrapping(y); + return S === "justify" || S === "justify-center" && !E || S === "justify-right" && !E || S === "justify-left" && !E ? 0 : (S === "center" && (C = g / 2), S === "right" && (C = g), S === "justify-center" && (C = g / 2), S === "justify-right" && (C = g), T === "rtl" && (C -= g), C); + }, + /** + * @private + */ + _clearCache: function() { + this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = []; + }, + /** + * @private + */ + _shouldClearDimensionCache: function() { + var y = this._forceClearCache; + return y || (y = this.hasStateChanged("_dimensionAffectingProps")), y && (this.dirty = !0, this._forceClearCache = !1), y; + }, + /** + * Measure a single line given its index. Used to calculate the initial + * text bounding box. The values are calculated and stored in __lineWidths cache. + * @private + * @param {Number} lineIndex line number + * @return {Number} Line width + */ + getLineWidth: function(y) { + if (this.__lineWidths[y]) + return this.__lineWidths[y]; + var x, g = this._textLines[y], S; + return g === "" ? x = 0 : (S = this.measureLine(y), x = S.width), this.__lineWidths[y] = x, x; + }, + _getWidthOfCharSpacing: function() { + return this.charSpacing !== 0 ? this.fontSize * this.charSpacing / 1e3 : 0; + }, + /** + * Retrieves the value of property at given character position + * @param {Number} lineIndex the line number + * @param {Number} charIndex the character number + * @param {String} property the property name + * @returns the value of 'property' + */ + getValueOfPropertyAt: function(y, x, g) { + var S = this._getStyleDeclaration(y, x); + return S && typeof S[g] != "undefined" ? S[g] : this[g]; + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _renderTextDecoration: function(y, x) { + if (!(!this[x] && !this.styleHas(x))) { + for (var g, S, T, C, E, M, P, R, N = this._getLeftOffset(), F = this._getTopOffset(), U, $, G, Q, ee, ce, ne, fe, K = this.path, Oe = this._getWidthOfCharSpacing(), xe = this.offsets[x], Ge = 0, oe = this._textLines.length; Ge < oe; Ge++) { + if (g = this.getHeightOfLine(Ge), !this[x] && !this.styleHas(x, Ge)) { + F += g; + continue; + } + P = this._textLines[Ge], ce = g / this.lineHeight, C = this._getLineLeftOffset(Ge), $ = 0, G = 0, R = this.getValueOfPropertyAt(Ge, 0, x), fe = this.getValueOfPropertyAt(Ge, 0, "fill"), U = F + ce * (1 - this._fontSizeFraction), S = this.getHeightOfChar(Ge, 0), E = this.getValueOfPropertyAt(Ge, 0, "deltaY"); + for (var de = 0, se = P.length; de < se; de++) + if (Q = this.__charBounds[Ge][de], ee = this.getValueOfPropertyAt(Ge, de, x), ne = this.getValueOfPropertyAt(Ge, de, "fill"), T = this.getHeightOfChar(Ge, de), M = this.getValueOfPropertyAt(Ge, de, "deltaY"), K && ee && ne) + y.save(), y.fillStyle = fe, y.translate(Q.renderLeft, Q.renderTop), y.rotate(Q.angle), y.fillRect( + -Q.kernedWidth / 2, + xe * T + M, + Q.kernedWidth, + this.fontSize / 15 + ), y.restore(); + else if ((ee !== R || ne !== fe || T !== S || M !== E) && G > 0) { + var te = N + C + $; + this.direction === "rtl" && (te = this.width - te - G), R && fe && (y.fillStyle = fe, y.fillRect( + te, + U + xe * S + E, + G, + this.fontSize / 15 + )), $ = Q.left, G = Q.width, R = ee, fe = ne, S = T, E = M; + } else + G += Q.kernedWidth; + var te = N + C + $; + this.direction === "rtl" && (te = this.width - te - G), y.fillStyle = ne, ee && ne && y.fillRect( + te, + U + xe * S + E, + G - Oe, + this.fontSize / 15 + ), F += g; + } + this._removeShadow(y); + } + }, + /** + * return font declaration string for canvas context + * @param {Object} [styleObject] object + * @returns {String} font declaration formatted for canvas context. + */ + _getFontDeclaration: function(y, x) { + var g = y || this, S = this.fontFamily, T = d.Text.genericFonts.indexOf(S.toLowerCase()) > -1, C = S === void 0 || S.indexOf("'") > -1 || S.indexOf(",") > -1 || S.indexOf('"') > -1 || T ? g.fontFamily : '"' + g.fontFamily + '"'; + return [ + // node-canvas needs "weight style", while browsers need "style weight" + // verify if this can be fixed in JSDOM + d.isLikelyNode ? g.fontWeight : g.fontStyle, + d.isLikelyNode ? g.fontStyle : g.fontWeight, + x ? this.CACHE_FONT_SIZE + "px" : g.fontSize + "px", + C + ].join(" "); + }, + /** + * Renders text instance on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(y) { + this.visible && (this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._shouldClearDimensionCache() && this.initDimensions(), this.callSuper("render", y))); + }, + /** + * Returns the text as an array of lines. + * @param {String} text text to split + * @returns {Array} Lines in the text + */ + _splitTextIntoLines: function(y) { + for (var x = y.split(this._reNewline), g = new Array(x.length), S = [` +`], T = [], C = 0; C < x.length; C++) + g[C] = d.util.string.graphemeSplit(x[C]), T = T.concat(g[C], S); + return T.pop(), { _unwrappedLines: g, lines: x, graphemeText: T, graphemeLines: g }; + }, + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject: function(y) { + var x = _.concat(y), g = this.callSuper("toObject", x); + return g.styles = m(this.styles, !0), g.path && (g.path = this.path.toObject()), g; + }, + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + * @return {fabric.Object} thisArg + * @chainable + */ + set: function(y, x) { + this.callSuper("set", y, x); + var g = !1, S = !1; + if (typeof y == "object") + for (var T in y) + T === "path" && this.setPathInfo(), g = g || this._dimensionAffectingProps.indexOf(T) !== -1, S = S || T === "path"; + else + g = this._dimensionAffectingProps.indexOf(y) !== -1, S = y === "path"; + return S && this.setPathInfo(), g && (this.initDimensions(), this.setCoords()), this; + }, + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity: function() { + return 1; + } + } + ), d.Text.ATTRIBUTE_NAMES = d.SHARED_ATTRIBUTES.concat( + "x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ") + ), d.Text.DEFAULT_SVG_FONT_SIZE = 16, d.Text.fromElement = function(y, x, g) { + if (!y) + return x(null); + var S = d.parseAttributes(y, d.Text.ATTRIBUTE_NAMES), T = S.textAnchor || "left"; + if (g = d.util.object.extend(g ? m(g) : {}, S), g.top = g.top || 0, g.left = g.left || 0, S.textDecoration) { + var C = S.textDecoration; + C.indexOf("underline") !== -1 && (g.underline = !0), C.indexOf("overline") !== -1 && (g.overline = !0), C.indexOf("line-through") !== -1 && (g.linethrough = !0), delete g.textDecoration; + } + "dx" in S && (g.left += S.dx), "dy" in S && (g.top += S.dy), "fontSize" in g || (g.fontSize = d.Text.DEFAULT_SVG_FONT_SIZE); + var E = ""; + "textContent" in y ? E = y.textContent : "firstChild" in y && y.firstChild !== null && "data" in y.firstChild && y.firstChild.data !== null && (E = y.firstChild.data), E = E.replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " "); + var M = g.strokeWidth; + g.strokeWidth = 0; + var P = new d.Text(E, g), R = P.getScaledHeight() / P.height, N = (P.height + P.strokeWidth) * P.lineHeight - P.height, F = N * R, U = P.getScaledHeight() + F, $ = 0; + T === "center" && ($ = P.getScaledWidth() / 2), T === "right" && ($ = P.getScaledWidth()), P.set({ + left: P.left - $, + top: P.top - (U - P.fontSize * (0.07 + P._fontSizeFraction)) / P.lineHeight, + strokeWidth: typeof M != "undefined" ? M : 1 + }), x(P); + }, d.Text.fromObject = function(y, x) { + var g = m(y), S = y.path; + return delete g.path, d.Object._fromObject("Text", g, function(T) { + S ? d.Object._fromObject("Path", S, function(C) { + T.set("path", C), x(T); + }, "path") : x(T); + }, "text"); + }, d.Text.genericFonts = ["sans-serif", "serif", "cursive", "fantasy", "monospace"], d.util.createAccessors && d.util.createAccessors(d.Text); + }(l), function() { + c.util.object.extend( + c.Text.prototype, + /** @lends fabric.Text.prototype */ + { + /** + * Returns true if object has no styling or no styling in a line + * @param {Number} lineIndex , lineIndex is on wrapped lines. + * @return {Boolean} + */ + isEmptyStyles: function(p) { + if (!this.styles || typeof p != "undefined" && !this.styles[p]) + return !0; + var d = typeof p == "undefined" ? this.styles : { line: this.styles[p] }; + for (var m in d) + for (var _ in d[m]) + for (var y in d[m][_]) + return !1; + return !0; + }, + /** + * Returns true if object has a style property or has it ina specified line + * This function is used to detect if a text will use a particular property or not. + * @param {String} property to check for + * @param {Number} lineIndex to check the style on + * @return {Boolean} + */ + styleHas: function(p, d) { + if (!this.styles || !p || p === "" || typeof d != "undefined" && !this.styles[d]) + return !1; + var m = typeof d == "undefined" ? this.styles : { 0: this.styles[d] }; + for (var _ in m) + for (var y in m[_]) + if (typeof m[_][y][p] != "undefined") + return !0; + return !1; + }, + /** + * Check if characters in a text have a value for a property + * whose value matches the textbox's value for that property. If so, + * the character-level property is deleted. If the character + * has no other properties, then it is also deleted. Finally, + * if the line containing that character has no other characters + * then it also is deleted. + * + * @param {string} property The property to compare between characters and text. + */ + cleanStyle: function(p) { + if (!this.styles || !p || p === "") + return !1; + var d = this.styles, m = 0, _, y, x = !0, g = 0, S; + for (var T in d) { + _ = 0; + for (var C in d[T]) { + var S = d[T][C], E = S.hasOwnProperty(p); + m++, E ? (y ? S[p] !== y && (x = !1) : y = S[p], S[p] === this[p] && delete S[p]) : x = !1, Object.keys(S).length !== 0 ? _++ : delete d[T][C]; + } + _ === 0 && delete d[T]; + } + for (var M = 0; M < this._textLines.length; M++) + g += this._textLines[M].length; + x && m === g && (this[p] = y, this.removeStyle(p)); + }, + /** + * Remove a style property or properties from all individual character styles + * in a text object. Deletes the character style object if it contains no other style + * props. Deletes a line style object if it contains no other character styles. + * + * @param {String} props The property to remove from character styles. + */ + removeStyle: function(p) { + if (!(!this.styles || !p || p === "")) { + var d = this.styles, m, _, y; + for (_ in d) { + m = d[_]; + for (y in m) + delete m[y][p], Object.keys(m[y]).length === 0 && delete m[y]; + Object.keys(m).length === 0 && delete d[_]; + } + } + }, + /** + * @private + */ + _extendStyles: function(p, d) { + var m = this.get2DCursorLocation(p); + this._getLineStyle(m.lineIndex) || this._setLineStyle(m.lineIndex), this._getStyleDeclaration(m.lineIndex, m.charIndex) || this._setStyleDeclaration(m.lineIndex, m.charIndex, {}), c.util.object.extend(this._getStyleDeclaration(m.lineIndex, m.charIndex), d); + }, + /** + * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start) + * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used. + * @param {Boolean} [skipWrapping] consider the location for unwrapped lines. useful to manage styles. + */ + get2DCursorLocation: function(p, d) { + typeof p == "undefined" && (p = this.selectionStart); + for (var m = d ? this._unwrappedTextLines : this._textLines, _ = m.length, y = 0; y < _; y++) { + if (p <= m[y].length) + return { + lineIndex: y, + charIndex: p + }; + p -= m[y].length + this.missingNewlineOffset(y); + } + return { + lineIndex: y - 1, + charIndex: m[y - 1].length < p ? m[y - 1].length : p + }; + }, + /** + * Gets style of a current selection/cursor (at the start position) + * if startIndex or endIndex are not provided, selectionStart or selectionEnd will be used. + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1 + * @param {Boolean} [complete] get full style or not + * @return {Array} styles an array with one, zero or more Style objects + */ + getSelectionStyles: function(p, d, m) { + typeof p == "undefined" && (p = this.selectionStart || 0), typeof d == "undefined" && (d = this.selectionEnd || p); + for (var _ = [], y = p; y < d; y++) + _.push(this.getStyleAtPosition(y, m)); + return _; + }, + /** + * Gets style of a current selection/cursor position + * @param {Number} position to get styles at + * @param {Boolean} [complete] full style if true + * @return {Object} style Style object at a specified index + * @private + */ + getStyleAtPosition: function(p, d) { + var m = this.get2DCursorLocation(p), _ = d ? this.getCompleteStyleDeclaration(m.lineIndex, m.charIndex) : this._getStyleDeclaration(m.lineIndex, m.charIndex); + return _ || {}; + }, + /** + * Sets style of a current selection, if no selection exist, do not set anything. + * @param {Object} [styles] Styles object + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1 + * @return {fabric.IText} thisArg + * @chainable + */ + setSelectionStyles: function(p, d, m) { + typeof d == "undefined" && (d = this.selectionStart || 0), typeof m == "undefined" && (m = this.selectionEnd || d); + for (var _ = d; _ < m; _++) + this._extendStyles(_, p); + return this._forceClearCache = !0, this; + }, + /** + * get the reference, not a clone, of the style object for a given character + * @param {Number} lineIndex + * @param {Number} charIndex + * @return {Object} style object + */ + _getStyleDeclaration: function(p, d) { + var m = this.styles && this.styles[p]; + return m ? m[d] : null; + }, + /** + * return a new object that contains all the style property for a character + * the object returned is newly created + * @param {Number} lineIndex of the line where the character is + * @param {Number} charIndex position of the character on the line + * @return {Object} style object + */ + getCompleteStyleDeclaration: function(p, d) { + for (var m = this._getStyleDeclaration(p, d) || {}, _ = {}, y, x = 0; x < this._styleProperties.length; x++) + y = this._styleProperties[x], _[y] = typeof m[y] == "undefined" ? this[y] : m[y]; + return _; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {Object} style + * @private + */ + _setStyleDeclaration: function(p, d, m) { + this.styles[p][d] = m; + }, + /** + * + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _deleteStyleDeclaration: function(p, d) { + delete this.styles[p][d]; + }, + /** + * @param {Number} lineIndex + * @return {Boolean} if the line exists or not + * @private + */ + _getLineStyle: function(p) { + return !!this.styles[p]; + }, + /** + * Set the line style to an empty object so that is initialized + * @param {Number} lineIndex + * @private + */ + _setLineStyle: function(p) { + this.styles[p] = {}; + }, + /** + * @param {Number} lineIndex + * @private + */ + _deleteLineStyle: function(p) { + delete this.styles[p]; + } + } + ); + }(), function() { + function p(d) { + d.textDecoration && (d.textDecoration.indexOf("underline") > -1 && (d.underline = !0), d.textDecoration.indexOf("line-through") > -1 && (d.linethrough = !0), d.textDecoration.indexOf("overline") > -1 && (d.overline = !0), delete d.textDecoration); + } + c.IText = c.util.createClass( + c.Text, + c.Observable, + /** @lends fabric.IText.prototype */ + { + /** + * Type of an object + * @type String + * @default + */ + type: "i-text", + /** + * Index where text selection starts (or where cursor is when there is no selection) + * @type Number + * @default + */ + selectionStart: 0, + /** + * Index where text selection ends + * @type Number + * @default + */ + selectionEnd: 0, + /** + * Color of text selection + * @type String + * @default + */ + selectionColor: "rgba(17,119,255,0.3)", + /** + * Indicates whether text is in editing mode + * @type Boolean + * @default + */ + isEditing: !1, + /** + * Indicates whether a text can be edited + * @type Boolean + * @default + */ + editable: !0, + /** + * Border color of text object while it's in editing mode + * @type String + * @default + */ + editingBorderColor: "rgba(102,153,255,0.25)", + /** + * Width of cursor (in px) + * @type Number + * @default + */ + cursorWidth: 2, + /** + * Color of text cursor color in editing mode. + * if not set (default) will take color from the text. + * if set to a color value that fabric can understand, it will + * be used instead of the color of the text at the current position. + * @type String + * @default + */ + cursorColor: "", + /** + * Delay between cursor blink (in ms) + * @type Number + * @default + */ + cursorDelay: 1e3, + /** + * Duration of cursor fadein (in ms) + * @type Number + * @default + */ + cursorDuration: 600, + /** + * Indicates whether internal text char widths can be cached + * @type Boolean + * @default + */ + caching: !0, + /** + * DOM container to append the hiddenTextarea. + * An alternative to attaching to the document.body. + * Useful to reduce laggish redraw of the full document.body tree and + * also with modals event capturing that won't let the textarea take focus. + * @type HTMLElement + * @default + */ + hiddenTextareaContainer: null, + /** + * @private + */ + _reSpace: /\s|\n/, + /** + * @private + */ + _currentCursorOpacity: 0, + /** + * @private + */ + _selectionDirection: null, + /** + * @private + */ + _abortCursorAnimation: !1, + /** + * @private + */ + __widthOfSpace: [], + /** + * Helps determining when the text is in composition, so that the cursor + * rendering is altered. + */ + inCompositionMode: !1, + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + * @return {fabric.IText} thisArg + */ + initialize: function(d, m) { + this.callSuper("initialize", d, m), this.initBehavior(); + }, + /** + * Sets selection start (left boundary of a selection) + * @param {Number} index Index to set selection start to + */ + setSelectionStart: function(d) { + d = Math.max(d, 0), this._updateAndFire("selectionStart", d); + }, + /** + * Sets selection end (right boundary of a selection) + * @param {Number} index Index to set selection end to + */ + setSelectionEnd: function(d) { + d = Math.min(d, this.text.length), this._updateAndFire("selectionEnd", d); + }, + /** + * @private + * @param {String} property 'selectionStart' or 'selectionEnd' + * @param {Number} index new position of property + */ + _updateAndFire: function(d, m) { + this[d] !== m && (this._fireSelectionChanged(), this[d] = m), this._updateTextarea(); + }, + /** + * Fires the even of selection changed + * @private + */ + _fireSelectionChanged: function() { + this.fire("selection:changed"), this.canvas && this.canvas.fire("text:selection:changed", { target: this }); + }, + /** + * Initialize text dimensions. Render all text on given context + * or on a offscreen canvas to get the text width with measureText. + * Updates this.width and this.height with the proper values. + * Does not return dimensions. + * @private + */ + initDimensions: function() { + this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this.callSuper("initDimensions"); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render: function(d) { + this.clearContextTop(), this.callSuper("render", d), this.cursorOffsetCache = {}, this.renderCursorOrSelection(); + }, + /** + * @private + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + _render: function(d) { + this.callSuper("_render", d); + }, + /** + * Prepare and clean the contextTop + */ + clearContextTop: function(d) { + if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) { + var m = this.canvas.contextTop, _ = this.canvas.viewportTransform; + m.save(), m.transform(_[0], _[1], _[2], _[3], _[4], _[5]), this.transform(m), this._clearTextArea(m), d || m.restore(); + } + }, + /** + * Renders cursor or selection (depending on what exists) + * it does on the contextTop. If contextTop is not available, do nothing. + */ + renderCursorOrSelection: function() { + if (!(!this.isEditing || !this.canvas || !this.canvas.contextTop)) { + var d = this._getCursorBoundaries(), m = this.canvas.contextTop; + this.clearContextTop(!0), this.selectionStart === this.selectionEnd ? this.renderCursor(d, m) : this.renderSelection(d, m), m.restore(); + } + }, + _clearTextArea: function(d) { + var m = this.width + 4, _ = this.height + 4; + d.clearRect(-m / 2, -_ / 2, m, _); + }, + /** + * Returns cursor boundaries (left, top, leftOffset, topOffset) + * @private + * @param {Array} chars Array of characters + * @param {String} typeOfBoundaries + */ + _getCursorBoundaries: function(d) { + typeof d == "undefined" && (d = this.selectionStart); + var m = this._getLeftOffset(), _ = this._getTopOffset(), y = this._getCursorBoundariesOffsets(d); + return { + left: m, + top: _, + leftOffset: y.left, + topOffset: y.top + }; + }, + /** + * @private + */ + _getCursorBoundariesOffsets: function(d) { + if (this.cursorOffsetCache && "top" in this.cursorOffsetCache) + return this.cursorOffsetCache; + var m, _, y, x = 0, g = 0, S, T = this.get2DCursorLocation(d); + y = T.charIndex, _ = T.lineIndex; + for (var C = 0; C < _; C++) + x += this.getHeightOfLine(C); + m = this._getLineLeftOffset(_); + var E = this.__charBounds[_][y]; + return E && (g = E.left), this.charSpacing !== 0 && y === this._textLines[_].length && (g -= this._getWidthOfCharSpacing()), S = { + top: x, + left: m + (g > 0 ? g : 0) + }, this.direction === "rtl" && (S.left *= -1), this.cursorOffsetCache = S, this.cursorOffsetCache; + }, + /** + * Renders cursor + * @param {Object} boundaries + * @param {CanvasRenderingContext2D} ctx transformed context to draw on + */ + renderCursor: function(d, m) { + var _ = this.get2DCursorLocation(), y = _.lineIndex, x = _.charIndex > 0 ? _.charIndex - 1 : 0, g = this.getValueOfPropertyAt(y, x, "fontSize"), S = this.scaleX * this.canvas.getZoom(), T = this.cursorWidth / S, C = d.topOffset, E = this.getValueOfPropertyAt(y, x, "deltaY"); + C += (1 - this._fontSizeFraction) * this.getHeightOfLine(y) / this.lineHeight - g * (1 - this._fontSizeFraction), this.inCompositionMode && this.renderSelection(d, m), m.fillStyle = this.cursorColor || this.getValueOfPropertyAt(y, x, "fill"), m.globalAlpha = this.__isMousedown ? 1 : this._currentCursorOpacity, m.fillRect( + d.left + d.leftOffset - T / 2, + C + d.top + E, + T, + g + ); + }, + /** + * Renders text selection + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + * @param {CanvasRenderingContext2D} ctx transformed context to draw on + */ + renderSelection: function(d, m) { + for (var _ = this.inCompositionMode ? this.hiddenTextarea.selectionStart : this.selectionStart, y = this.inCompositionMode ? this.hiddenTextarea.selectionEnd : this.selectionEnd, x = this.textAlign.indexOf("justify") !== -1, g = this.get2DCursorLocation(_), S = this.get2DCursorLocation(y), T = g.lineIndex, C = S.lineIndex, E = g.charIndex < 0 ? 0 : g.charIndex, M = S.charIndex < 0 ? 0 : S.charIndex, P = T; P <= C; P++) { + var R = this._getLineLeftOffset(P) || 0, N = this.getHeightOfLine(P), F = 0, U = 0, $ = 0; + if (P === T && (U = this.__charBounds[T][E].left), P >= T && P < C) + $ = x && !this.isEndOfWrapping(P) ? this.width : this.getLineWidth(P) || 5; + else if (P === C) + if (M === 0) + $ = this.__charBounds[C][M].left; + else { + var G = this._getWidthOfCharSpacing(); + $ = this.__charBounds[C][M - 1].left + this.__charBounds[C][M - 1].width - G; + } + F = N, (this.lineHeight < 1 || P === C && this.lineHeight > 1) && (N /= this.lineHeight); + var Q = d.left + R + U, ee = $ - U, ce = N, ne = 0; + this.inCompositionMode ? (m.fillStyle = this.compositionColor || "black", ce = 1, ne = N) : m.fillStyle = this.selectionColor, this.direction === "rtl" && (Q = this.width - Q - ee), m.fillRect( + Q, + d.top + d.topOffset + ne, + ee, + ce + ), d.topOffset += F; + } + }, + /** + * High level function to know the height of the cursor. + * the currentChar is the one that precedes the cursor + * Returns fontSize of char at the current cursor + * Unused from the library, is for the end user + * @return {Number} Character font size + */ + getCurrentCharFontSize: function() { + var d = this._getCurrentCharIndex(); + return this.getValueOfPropertyAt(d.l, d.c, "fontSize"); + }, + /** + * High level function to know the color of the cursor. + * the currentChar is the one that precedes the cursor + * Returns color (fill) of char at the current cursor + * if the text object has a pattern or gradient for filler, it will return that. + * Unused by the library, is for the end user + * @return {String | fabric.Gradient | fabric.Pattern} Character color (fill) + */ + getCurrentCharColor: function() { + var d = this._getCurrentCharIndex(); + return this.getValueOfPropertyAt(d.l, d.c, "fill"); + }, + /** + * Returns the cursor position for the getCurrent.. functions + * @private + */ + _getCurrentCharIndex: function() { + var d = this.get2DCursorLocation(this.selectionStart, !0), m = d.charIndex > 0 ? d.charIndex - 1 : 0; + return { l: d.lineIndex, c: m }; + } + } + ), c.IText.fromObject = function(d, m) { + if (p(d), d.styles) + for (var _ in d.styles) + for (var y in d.styles[_]) + p(d.styles[_][y]); + c.Object._fromObject("IText", d, m, "text"); + }; + }(), function() { + var p = c.util.object.clone; + c.util.object.extend( + c.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes all the interactive behavior of IText + */ + initBehavior: function() { + this.initAddedHandler(), this.initRemovedHandler(), this.initCursorSelectionHandlers(), this.initDoubleClickSimulation(), this.mouseMoveHandler = this.mouseMoveHandler.bind(this); + }, + onDeselect: function() { + this.isEditing && this.exitEditing(), this.selected = !1; + }, + /** + * Initializes "added" event handler + */ + initAddedHandler: function() { + var d = this; + this.on("added", function() { + var m = d.canvas; + m && (m._hasITextHandlers || (m._hasITextHandlers = !0, d._initCanvasHandlers(m)), m._iTextInstances = m._iTextInstances || [], m._iTextInstances.push(d)); + }); + }, + initRemovedHandler: function() { + var d = this; + this.on("removed", function() { + var m = d.canvas; + m && (m._iTextInstances = m._iTextInstances || [], c.util.removeFromArray(m._iTextInstances, d), m._iTextInstances.length === 0 && (m._hasITextHandlers = !1, d._removeCanvasHandlers(m))); + }); + }, + /** + * register canvas event to manage exiting on other instances + * @private + */ + _initCanvasHandlers: function(d) { + d._mouseUpITextHandler = function() { + d._iTextInstances && d._iTextInstances.forEach(function(m) { + m.__isMousedown = !1; + }); + }, d.on("mouse:up", d._mouseUpITextHandler); + }, + /** + * remove canvas event to manage exiting on other instances + * @private + */ + _removeCanvasHandlers: function(d) { + d.off("mouse:up", d._mouseUpITextHandler); + }, + /** + * @private + */ + _tick: function() { + this._currentTickState = this._animateCursor(this, 1, this.cursorDuration, "_onTickComplete"); + }, + /** + * @private + */ + _animateCursor: function(d, m, _, y) { + var x; + return x = { + isAborted: !1, + abort: function() { + this.isAborted = !0; + } + }, d.animate("_currentCursorOpacity", m, { + duration: _, + onComplete: function() { + x.isAborted || d[y](); + }, + onChange: function() { + d.canvas && d.selectionStart === d.selectionEnd && d.renderCursorOrSelection(); + }, + abort: function() { + return x.isAborted; + } + }), x; + }, + /** + * @private + */ + _onTickComplete: function() { + var d = this; + this._cursorTimeout1 && clearTimeout(this._cursorTimeout1), this._cursorTimeout1 = setTimeout(function() { + d._currentTickCompleteState = d._animateCursor(d, 0, this.cursorDuration / 2, "_tick"); + }, 100); + }, + /** + * Initializes delayed cursor + */ + initDelayedCursor: function(d) { + var m = this, _ = d ? 0 : this.cursorDelay; + this.abortCursorAnimation(), this._currentCursorOpacity = 1, this._cursorTimeout2 = setTimeout(function() { + m._tick(); + }, _); + }, + /** + * Aborts cursor animation and clears all timeouts + */ + abortCursorAnimation: function() { + var d = this._currentTickState || this._currentTickCompleteState, m = this.canvas; + this._currentTickState && this._currentTickState.abort(), this._currentTickCompleteState && this._currentTickCompleteState.abort(), clearTimeout(this._cursorTimeout1), clearTimeout(this._cursorTimeout2), this._currentCursorOpacity = 0, d && m && m.clearContext(m.contextTop || m.contextContainer); + }, + /** + * Selects entire text + * @return {fabric.IText} thisArg + * @chainable + */ + selectAll: function() { + return this.selectionStart = 0, this.selectionEnd = this._text.length, this._fireSelectionChanged(), this._updateTextarea(), this; + }, + /** + * Returns selected text + * @return {String} + */ + getSelectedText: function() { + return this._text.slice(this.selectionStart, this.selectionEnd).join(""); + }, + /** + * Find new selection index representing start of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryLeft: function(d) { + var m = 0, _ = d - 1; + if (this._reSpace.test(this._text[_])) + for (; this._reSpace.test(this._text[_]); ) + m++, _--; + for (; /\S/.test(this._text[_]) && _ > -1; ) + m++, _--; + return d - m; + }, + /** + * Find new selection index representing end of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryRight: function(d) { + var m = 0, _ = d; + if (this._reSpace.test(this._text[_])) + for (; this._reSpace.test(this._text[_]); ) + m++, _++; + for (; /\S/.test(this._text[_]) && _ < this._text.length; ) + m++, _++; + return d + m; + }, + /** + * Find new selection index representing start of current line according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findLineBoundaryLeft: function(d) { + for (var m = 0, _ = d - 1; !/\n/.test(this._text[_]) && _ > -1; ) + m++, _--; + return d - m; + }, + /** + * Find new selection index representing end of current line according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findLineBoundaryRight: function(d) { + for (var m = 0, _ = d; !/\n/.test(this._text[_]) && _ < this._text.length; ) + m++, _++; + return d + m; + }, + /** + * Finds index corresponding to beginning or end of a word + * @param {Number} selectionStart Index of a character + * @param {Number} direction 1 or -1 + * @return {Number} Index of the beginning or end of a word + */ + searchWordBoundary: function(d, m) { + for (var _ = this._text, y = this._reSpace.test(_[d]) ? d - 1 : d, x = _[y], g = c.reNonWord; !g.test(x) && y > 0 && y < _.length; ) + y += m, x = _[y]; + return g.test(x) && (y += m === 1 ? 0 : 1), y; + }, + /** + * Selects a word based on the index + * @param {Number} selectionStart Index of a character + */ + selectWord: function(d) { + d = d || this.selectionStart; + var m = this.searchWordBoundary(d, -1), _ = this.searchWordBoundary(d, 1); + this.selectionStart = m, this.selectionEnd = _, this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection(); + }, + /** + * Selects a line based on the index + * @param {Number} selectionStart Index of a character + * @return {fabric.IText} thisArg + * @chainable + */ + selectLine: function(d) { + d = d || this.selectionStart; + var m = this.findLineBoundaryLeft(d), _ = this.findLineBoundaryRight(d); + return this.selectionStart = m, this.selectionEnd = _, this._fireSelectionChanged(), this._updateTextarea(), this; + }, + /** + * Enters editing state + * @return {fabric.IText} thisArg + * @chainable + */ + enterEditing: function(d) { + if (!(this.isEditing || !this.editable)) + return this.canvas && (this.canvas.calcOffset(), this.exitEditingOnOthers(this.canvas)), this.isEditing = !0, this.initHiddenTextarea(d), this.hiddenTextarea.focus(), this.hiddenTextarea.value = this.text, this._updateTextarea(), this._saveEditingProps(), this._setEditingProps(), this._textBeforeEdit = this.text, this._tick(), this.fire("editing:entered"), this._fireSelectionChanged(), this.canvas ? (this.canvas.fire("text:editing:entered", { target: this }), this.initMouseMoveHandler(), this.canvas.requestRenderAll(), this) : this; + }, + exitEditingOnOthers: function(d) { + d._iTextInstances && d._iTextInstances.forEach(function(m) { + m.selected = !1, m.isEditing && m.exitEditing(); + }); + }, + /** + * Initializes "mousemove" event handler + */ + initMouseMoveHandler: function() { + this.canvas.on("mouse:move", this.mouseMoveHandler); + }, + /** + * @private + */ + mouseMoveHandler: function(d) { + if (!(!this.__isMousedown || !this.isEditing)) { + var m = this.getSelectionStartFromPointer(d.e), _ = this.selectionStart, y = this.selectionEnd; + (m !== this.__selectionStartOnMouseDown || _ === y) && (_ === m || y === m) || (m > this.__selectionStartOnMouseDown ? (this.selectionStart = this.__selectionStartOnMouseDown, this.selectionEnd = m) : (this.selectionStart = m, this.selectionEnd = this.__selectionStartOnMouseDown), (this.selectionStart !== _ || this.selectionEnd !== y) && (this.restartCursorIfNeeded(), this._fireSelectionChanged(), this._updateTextarea(), this.renderCursorOrSelection())); + } + }, + /** + * @private + */ + _setEditingProps: function() { + this.hoverCursor = "text", this.canvas && (this.canvas.defaultCursor = this.canvas.moveCursor = "text"), this.borderColor = this.editingBorderColor, this.hasControls = this.selectable = !1, this.lockMovementX = this.lockMovementY = !0; + }, + /** + * convert from textarea to grapheme indexes + */ + fromStringToGraphemeSelection: function(d, m, _) { + var y = _.slice(0, d), x = c.util.string.graphemeSplit(y).length; + if (d === m) + return { selectionStart: x, selectionEnd: x }; + var g = _.slice(d, m), S = c.util.string.graphemeSplit(g).length; + return { selectionStart: x, selectionEnd: x + S }; + }, + /** + * convert from fabric to textarea values + */ + fromGraphemeToStringSelection: function(d, m, _) { + var y = _.slice(0, d), x = y.join("").length; + if (d === m) + return { selectionStart: x, selectionEnd: x }; + var g = _.slice(d, m), S = g.join("").length; + return { selectionStart: x, selectionEnd: x + S }; + }, + /** + * @private + */ + _updateTextarea: function() { + if (this.cursorOffsetCache = {}, !!this.hiddenTextarea) { + if (!this.inCompositionMode) { + var d = this.fromGraphemeToStringSelection(this.selectionStart, this.selectionEnd, this._text); + this.hiddenTextarea.selectionStart = d.selectionStart, this.hiddenTextarea.selectionEnd = d.selectionEnd; + } + this.updateTextareaPosition(); + } + }, + /** + * @private + */ + updateFromTextArea: function() { + if (this.hiddenTextarea) { + this.cursorOffsetCache = {}, this.text = this.hiddenTextarea.value, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()); + var d = this.fromStringToGraphemeSelection( + this.hiddenTextarea.selectionStart, + this.hiddenTextarea.selectionEnd, + this.hiddenTextarea.value + ); + this.selectionEnd = this.selectionStart = d.selectionEnd, this.inCompositionMode || (this.selectionStart = d.selectionStart), this.updateTextareaPosition(); + } + }, + /** + * @private + */ + updateTextareaPosition: function() { + if (this.selectionStart === this.selectionEnd) { + var d = this._calcTextareaPosition(); + this.hiddenTextarea.style.left = d.left, this.hiddenTextarea.style.top = d.top; + } + }, + /** + * @private + * @return {Object} style contains style for hiddenTextarea + */ + _calcTextareaPosition: function() { + if (!this.canvas) + return { x: 1, y: 1 }; + var d = this.inCompositionMode ? this.compositionStart : this.selectionStart, m = this._getCursorBoundaries(d), _ = this.get2DCursorLocation(d), y = _.lineIndex, x = _.charIndex, g = this.getValueOfPropertyAt(y, x, "fontSize") * this.lineHeight, S = m.leftOffset, T = this.calcTransformMatrix(), C = { + x: m.left + S, + y: m.top + m.topOffset + g + }, E = this.canvas.getRetinaScaling(), M = this.canvas.upperCanvasEl, P = M.width / E, R = M.height / E, N = P - g, F = R - g, U = M.clientWidth / P, $ = M.clientHeight / R; + return C = c.util.transformPoint(C, T), C = c.util.transformPoint(C, this.canvas.viewportTransform), C.x *= U, C.y *= $, C.x < 0 && (C.x = 0), C.x > N && (C.x = N), C.y < 0 && (C.y = 0), C.y > F && (C.y = F), C.x += this.canvas._offset.left, C.y += this.canvas._offset.top, { left: C.x + "px", top: C.y + "px", fontSize: g + "px", charHeight: g }; + }, + /** + * @private + */ + _saveEditingProps: function() { + this._savedProps = { + hasControls: this.hasControls, + borderColor: this.borderColor, + lockMovementX: this.lockMovementX, + lockMovementY: this.lockMovementY, + hoverCursor: this.hoverCursor, + selectable: this.selectable, + defaultCursor: this.canvas && this.canvas.defaultCursor, + moveCursor: this.canvas && this.canvas.moveCursor + }; + }, + /** + * @private + */ + _restoreEditingProps: function() { + this._savedProps && (this.hoverCursor = this._savedProps.hoverCursor, this.hasControls = this._savedProps.hasControls, this.borderColor = this._savedProps.borderColor, this.selectable = this._savedProps.selectable, this.lockMovementX = this._savedProps.lockMovementX, this.lockMovementY = this._savedProps.lockMovementY, this.canvas && (this.canvas.defaultCursor = this._savedProps.defaultCursor, this.canvas.moveCursor = this._savedProps.moveCursor)); + }, + /** + * Exits from editing state + * @return {fabric.IText} thisArg + * @chainable + */ + exitEditing: function() { + var d = this._textBeforeEdit !== this.text, m = this.hiddenTextarea; + return this.selected = !1, this.isEditing = !1, this.selectionEnd = this.selectionStart, m && (m.blur && m.blur(), m.parentNode && m.parentNode.removeChild(m)), this.hiddenTextarea = null, this.abortCursorAnimation(), this._restoreEditingProps(), this._currentCursorOpacity = 0, this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this.fire("editing:exited"), d && this.fire("modified"), this.canvas && (this.canvas.off("mouse:move", this.mouseMoveHandler), this.canvas.fire("text:editing:exited", { target: this }), d && this.canvas.fire("object:modified", { target: this })), this; + }, + /** + * @private + */ + _removeExtraneousStyles: function() { + for (var d in this.styles) + this._textLines[d] || delete this.styles[d]; + }, + /** + * remove and reflow a style block from start to end. + * @param {Number} start linear start position for removal (included in removal) + * @param {Number} end linear end position for removal ( excluded from removal ) + */ + removeStyleFromTo: function(d, m) { + var _ = this.get2DCursorLocation(d, !0), y = this.get2DCursorLocation(m, !0), x = _.lineIndex, g = _.charIndex, S = y.lineIndex, T = y.charIndex, C, E; + if (x !== S) { + if (this.styles[x]) + for (C = g; C < this._unwrappedTextLines[x].length; C++) + delete this.styles[x][C]; + if (this.styles[S]) + for (C = T; C < this._unwrappedTextLines[S].length; C++) + E = this.styles[S][C], E && (this.styles[x] || (this.styles[x] = {}), this.styles[x][g + C - T] = E); + for (C = x + 1; C <= S; C++) + delete this.styles[C]; + this.shiftLineStyles(S, x - S); + } else if (this.styles[x]) { + E = this.styles[x]; + var M = T - g, P, R; + for (C = g; C < T; C++) + delete E[C]; + for (R in this.styles[x]) + P = parseInt(R, 10), P >= T && (E[P - M] = E[R], delete E[R]); + } + }, + /** + * Shifts line styles up or down + * @param {Number} lineIndex Index of a line + * @param {Number} offset Can any number? + */ + shiftLineStyles: function(d, m) { + var _ = p(this.styles); + for (var y in this.styles) { + var x = parseInt(y, 10); + x > d && (this.styles[x + m] = _[x], _[x - m] || delete this.styles[x]); + } + }, + restartCursorIfNeeded: function() { + (!this._currentTickState || this._currentTickState.isAborted || !this._currentTickCompleteState || this._currentTickCompleteState.isAborted) && this.initDelayedCursor(); + }, + /** + * Handle insertion of more consecutive style lines for when one or more + * newlines gets added to the text. Since current style needs to be shifted + * first we shift the current style of the number lines needed, then we add + * new lines from the last to the first. + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Number} qty number of lines to add + * @param {Array} copiedStyle Array of objects styles + */ + insertNewlineStyleObject: function(d, m, _, y) { + var x, g = {}, S = !1, T = this._unwrappedTextLines[d].length === m; + _ || (_ = 1), this.shiftLineStyles(d, _), this.styles[d] && (x = this.styles[d][m === 0 ? m : m - 1]); + for (var C in this.styles[d]) { + var E = parseInt(C, 10); + E >= m && (S = !0, g[E - m] = this.styles[d][C], T && m === 0 || delete this.styles[d][C]); + } + var M = !1; + for (S && !T && (this.styles[d + _] = g, M = !0), M && _--; _ > 0; ) + y && y[_ - 1] ? this.styles[d + _] = { 0: p(y[_ - 1]) } : x ? this.styles[d + _] = { 0: p(x) } : delete this.styles[d + _], _--; + this._forceClearCache = !0; + }, + /** + * Inserts style object for a given line/char index + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Number} quantity number Style object to insert, if given + * @param {Array} copiedStyle array of style objects + */ + insertCharStyleObject: function(d, m, _, y) { + this.styles || (this.styles = {}); + var x = this.styles[d], g = x ? p(x) : {}; + _ || (_ = 1); + for (var S in g) { + var T = parseInt(S, 10); + T >= m && (x[T + _] = g[T], g[T - _] || delete x[T]); + } + if (this._forceClearCache = !0, y) { + for (; _--; ) + Object.keys(y[_]).length && (this.styles[d] || (this.styles[d] = {}), this.styles[d][m + _] = p(y[_])); + return; + } + if (x) + for (var C = x[m ? m - 1 : 1]; C && _--; ) + this.styles[d][m + _] = p(C); + }, + /** + * Inserts style object(s) + * @param {Array} insertedText Characters at the location where style is inserted + * @param {Number} start cursor index for inserting style + * @param {Array} [copiedStyle] array of style objects to insert. + */ + insertNewStyleBlock: function(d, m, _) { + for (var y = this.get2DCursorLocation(m, !0), x = [0], g = 0, S = 0; S < d.length; S++) + d[S] === ` +` ? (g++, x[g] = 0) : x[g]++; + x[0] > 0 && (this.insertCharStyleObject(y.lineIndex, y.charIndex, x[0], _), _ = _ && _.slice(x[0] + 1)), g && this.insertNewlineStyleObject( + y.lineIndex, + y.charIndex + x[0], + g + ); + for (var S = 1; S < g; S++) + x[S] > 0 ? this.insertCharStyleObject(y.lineIndex + S, 0, x[S], _) : _ && (this.styles[y.lineIndex + S][0] = _[0]), _ = _ && _.slice(x[S] + 1); + x[S] > 0 && this.insertCharStyleObject(y.lineIndex + S, 0, x[S], _); + }, + /** + * Set the selectionStart and selectionEnd according to the new position of cursor + * mimic the key - mouse navigation when shift is pressed. + */ + setSelectionStartEndWithShift: function(d, m, _) { + _ <= d ? (m === d ? this._selectionDirection = "left" : this._selectionDirection === "right" && (this._selectionDirection = "left", this.selectionEnd = d), this.selectionStart = _) : _ > d && _ < m ? this._selectionDirection === "right" ? this.selectionEnd = _ : this.selectionStart = _ : (m === d ? this._selectionDirection = "right" : this._selectionDirection === "left" && (this._selectionDirection = "right", this.selectionStart = m), this.selectionEnd = _); + }, + setSelectionInBoundaries: function() { + var d = this.text.length; + this.selectionStart > d ? this.selectionStart = d : this.selectionStart < 0 && (this.selectionStart = 0), this.selectionEnd > d ? this.selectionEnd = d : this.selectionEnd < 0 && (this.selectionEnd = 0); + } + } + ); + }(), c.util.object.extend( + c.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes "dbclick" event handler + */ + initDoubleClickSimulation: function() { + this.__lastClickTime = +/* @__PURE__ */ new Date(), this.__lastLastClickTime = +/* @__PURE__ */ new Date(), this.__lastPointer = {}, this.on("mousedown", this.onMouseDown); + }, + /** + * Default event handler to simulate triple click + * @private + */ + onMouseDown: function(p) { + if (this.canvas) { + this.__newClickTime = +/* @__PURE__ */ new Date(); + var d = p.pointer; + this.isTripleClick(d) && (this.fire("tripleclick", p), this._stopEvent(p.e)), this.__lastLastClickTime = this.__lastClickTime, this.__lastClickTime = this.__newClickTime, this.__lastPointer = d, this.__lastIsEditing = this.isEditing, this.__lastSelected = this.selected; + } + }, + isTripleClick: function(p) { + return this.__newClickTime - this.__lastClickTime < 500 && this.__lastClickTime - this.__lastLastClickTime < 500 && this.__lastPointer.x === p.x && this.__lastPointer.y === p.y; + }, + /** + * @private + */ + _stopEvent: function(p) { + p.preventDefault && p.preventDefault(), p.stopPropagation && p.stopPropagation(); + }, + /** + * Initializes event handlers related to cursor or selection + */ + initCursorSelectionHandlers: function() { + this.initMousedownHandler(), this.initMouseupHandler(), this.initClicks(); + }, + /** + * Default handler for double click, select a word + */ + doubleClickHandler: function(p) { + this.isEditing && this.selectWord(this.getSelectionStartFromPointer(p.e)); + }, + /** + * Default handler for triple click, select a line + */ + tripleClickHandler: function(p) { + this.isEditing && this.selectLine(this.getSelectionStartFromPointer(p.e)); + }, + /** + * Initializes double and triple click event handlers + */ + initClicks: function() { + this.on("mousedblclick", this.doubleClickHandler), this.on("tripleclick", this.tripleClickHandler); + }, + /** + * Default event handler for the basic functionalities needed on _mouseDown + * can be overridden to do something different. + * Scope of this implementation is: find the click position, set selectionStart + * find selectionEnd, initialize the drawing of either cursor or selection area + * initializing a mousedDown on a text area will cancel fabricjs knowledge of + * current compositionMode. It will be set to false. + */ + _mouseDownHandler: function(p) { + !this.canvas || !this.editable || p.e.button && p.e.button !== 1 || (this.__isMousedown = !0, this.selected && (this.inCompositionMode = !1, this.setCursorByClick(p.e)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection())); + }, + /** + * Default event handler for the basic functionalities needed on mousedown:before + * can be overridden to do something different. + * Scope of this implementation is: verify the object is already selected when mousing down + */ + _mouseDownHandlerBefore: function(p) { + !this.canvas || !this.editable || p.e.button && p.e.button !== 1 || (this.selected = this === this.canvas._activeObject); + }, + /** + * Initializes "mousedown" event handler + */ + initMousedownHandler: function() { + this.on("mousedown", this._mouseDownHandler), this.on("mousedown:before", this._mouseDownHandlerBefore); + }, + /** + * Initializes "mouseup" event handler + */ + initMouseupHandler: function() { + this.on("mouseup", this.mouseUpHandler); + }, + /** + * standard handler for mouse up, overridable + * @private + */ + mouseUpHandler: function(p) { + if (this.__isMousedown = !1, !(!this.editable || this.group || p.transform && p.transform.actionPerformed || p.e.button && p.e.button !== 1)) { + if (this.canvas) { + var d = this.canvas._activeObject; + if (d && d !== this) + return; + } + this.__lastSelected && !this.__corner ? (this.selected = !1, this.__lastSelected = !1, this.enterEditing(p.e), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(!0) : this.renderCursorOrSelection()) : this.selected = !0; + } + }, + /** + * Changes cursor location in a text depending on passed pointer (x/y) object + * @param {Event} e Event object + */ + setCursorByClick: function(p) { + var d = this.getSelectionStartFromPointer(p), m = this.selectionStart, _ = this.selectionEnd; + p.shiftKey ? this.setSelectionStartEndWithShift(m, _, d) : (this.selectionStart = d, this.selectionEnd = d), this.isEditing && (this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Returns index of a character corresponding to where an object was clicked + * @param {Event} e Event object + * @return {Number} Index of a character + */ + getSelectionStartFromPointer: function(p) { + for (var d = this.getLocalPointer(p), m = 0, _ = 0, y = 0, x = 0, g = 0, S, T, C = 0, E = this._textLines.length; C < E && y <= d.y; C++) + y += this.getHeightOfLine(C) * this.scaleY, g = C, C > 0 && (x += this._textLines[C - 1].length + this.missingNewlineOffset(C - 1)); + S = this._getLineLeftOffset(g), _ = S * this.scaleX, T = this._textLines[g], this.direction === "rtl" && (d.x = this.width * this.scaleX - d.x + _); + for (var M = 0, P = T.length; M < P && (m = _, _ += this.__charBounds[g][M].kernedWidth * this.scaleX, _ <= d.x); M++) + x++; + return this._getNewSelectionStartFromOffset(d, m, _, x, P); + }, + /** + * @private + */ + _getNewSelectionStartFromOffset: function(p, d, m, _, y) { + var x = p.x - d, g = m - p.x, S = g > x || g < 0 ? 0 : 1, T = _ + S; + return this.flipX && (T = y - T), T > this._text.length && (T = this._text.length), T; + } + } + ), c.util.object.extend( + c.IText.prototype, + /** @lends fabric.IText.prototype */ + { + /** + * Initializes hidden textarea (needed to bring up keyboard in iOS) + */ + initHiddenTextarea: function() { + this.hiddenTextarea = c.document.createElement("textarea"), this.hiddenTextarea.setAttribute("autocapitalize", "off"), this.hiddenTextarea.setAttribute("autocorrect", "off"), this.hiddenTextarea.setAttribute("autocomplete", "off"), this.hiddenTextarea.setAttribute("spellcheck", "false"), this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea", ""), this.hiddenTextarea.setAttribute("wrap", "off"); + var p = this._calcTextareaPosition(); + this.hiddenTextarea.style.cssText = "position: absolute; top: " + p.top + "; left: " + p.left + "; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; paddingーtop: " + p.fontSize + ";", this.hiddenTextareaContainer ? this.hiddenTextareaContainer.appendChild(this.hiddenTextarea) : c.document.body.appendChild(this.hiddenTextarea), c.util.addListener(this.hiddenTextarea, "keydown", this.onKeyDown.bind(this)), c.util.addListener(this.hiddenTextarea, "keyup", this.onKeyUp.bind(this)), c.util.addListener(this.hiddenTextarea, "input", this.onInput.bind(this)), c.util.addListener(this.hiddenTextarea, "copy", this.copy.bind(this)), c.util.addListener(this.hiddenTextarea, "cut", this.copy.bind(this)), c.util.addListener(this.hiddenTextarea, "paste", this.paste.bind(this)), c.util.addListener(this.hiddenTextarea, "compositionstart", this.onCompositionStart.bind(this)), c.util.addListener(this.hiddenTextarea, "compositionupdate", this.onCompositionUpdate.bind(this)), c.util.addListener(this.hiddenTextarea, "compositionend", this.onCompositionEnd.bind(this)), !this._clickHandlerInitialized && this.canvas && (c.util.addListener(this.canvas.upperCanvasEl, "click", this.onClick.bind(this)), this._clickHandlerInitialized = !0); + }, + /** + * For functionalities on keyDown + * Map a special key to a function of the instance/prototype + * If you need different behaviour for ESC or TAB or arrows, you have to change + * this map setting the name of a function that you build on the fabric.Itext or + * your prototype. + * the map change will affect all Instances unless you need for only some text Instances + * in that case you have to clone this object and assign your Instance. + * this.keysMap = fabric.util.object.clone(this.keysMap); + * The function must be in fabric.Itext.prototype.myFunction And will receive event as args[0] + */ + keysMap: { + 9: "exitEditing", + 27: "exitEditing", + 33: "moveCursorUp", + 34: "moveCursorDown", + 35: "moveCursorRight", + 36: "moveCursorLeft", + 37: "moveCursorLeft", + 38: "moveCursorUp", + 39: "moveCursorRight", + 40: "moveCursorDown" + }, + keysMapRtl: { + 9: "exitEditing", + 27: "exitEditing", + 33: "moveCursorUp", + 34: "moveCursorDown", + 35: "moveCursorLeft", + 36: "moveCursorRight", + 37: "moveCursorRight", + 38: "moveCursorUp", + 39: "moveCursorLeft", + 40: "moveCursorDown" + }, + /** + * For functionalities on keyUp + ctrl || cmd + */ + ctrlKeysMapUp: { + 67: "copy", + 88: "cut" + }, + /** + * For functionalities on keyDown + ctrl || cmd + */ + ctrlKeysMapDown: { + 65: "selectAll" + }, + onClick: function() { + this.hiddenTextarea && this.hiddenTextarea.focus(); + }, + /** + * Handles keydown event + * only used for arrows and combination of modifier keys. + * @param {Event} e Event object + */ + onKeyDown: function(p) { + if (this.isEditing) { + var d = this.direction === "rtl" ? this.keysMapRtl : this.keysMap; + if (p.keyCode in d) + this[d[p.keyCode]](p); + else if (p.keyCode in this.ctrlKeysMapDown && (p.ctrlKey || p.metaKey)) + this[this.ctrlKeysMapDown[p.keyCode]](p); + else + return; + p.stopImmediatePropagation(), p.preventDefault(), p.keyCode >= 33 && p.keyCode <= 40 ? (this.inCompositionMode = !1, this.clearContextTop(), this.renderCursorOrSelection()) : this.canvas && this.canvas.requestRenderAll(); + } + }, + /** + * Handles keyup event + * We handle KeyUp because ie11 and edge have difficulties copy/pasting + * if a copy/cut event fired, keyup is dismissed + * @param {Event} e Event object + */ + onKeyUp: function(p) { + if (!this.isEditing || this._copyDone || this.inCompositionMode) { + this._copyDone = !1; + return; + } + if (p.keyCode in this.ctrlKeysMapUp && (p.ctrlKey || p.metaKey)) + this[this.ctrlKeysMapUp[p.keyCode]](p); + else + return; + p.stopImmediatePropagation(), p.preventDefault(), this.canvas && this.canvas.requestRenderAll(); + }, + /** + * Handles onInput event + * @param {Event} e Event object + */ + onInput: function(p) { + var d = this.fromPaste; + if (this.fromPaste = !1, p && p.stopPropagation(), !!this.isEditing) { + var m = this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText, _ = this._text.length, y = m.length, x, g, S = y - _, T = this.selectionStart, C = this.selectionEnd, E = T !== C, M, P, R; + if (this.hiddenTextarea.value === "") { + this.styles = {}, this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll()); + return; + } + var N = this.fromStringToGraphemeSelection( + this.hiddenTextarea.selectionStart, + this.hiddenTextarea.selectionEnd, + this.hiddenTextarea.value + ), F = T > N.selectionStart; + E ? (x = this._text.slice(T, C), S += C - T) : y < _ && (F ? x = this._text.slice(C + S, C) : x = this._text.slice(T, T - S)), g = m.slice(N.selectionEnd - S, N.selectionEnd), x && x.length && (g.length && (M = this.getSelectionStyles(T, T + 1, !1), M = g.map(function() { + return M[0]; + })), E ? (P = T, R = C) : F ? (P = C - x.length, R = C) : (P = C, R = C + x.length), this.removeStyleFromTo(P, R)), g.length && (d && g.join("") === c.copiedText && !c.disableStyleCopyPaste && (M = c.copiedTextStyle), this.insertNewStyleBlock(g, T, M)), this.updateFromTextArea(), this.fire("changed"), this.canvas && (this.canvas.fire("text:changed", { target: this }), this.canvas.requestRenderAll()); + } + }, + /** + * Composition start + */ + onCompositionStart: function() { + this.inCompositionMode = !0; + }, + /** + * Composition end + */ + onCompositionEnd: function() { + this.inCompositionMode = !1; + }, + // /** + // * Composition update + // */ + onCompositionUpdate: function(p) { + this.compositionStart = p.target.selectionStart, this.compositionEnd = p.target.selectionEnd, this.updateTextareaPosition(); + }, + /** + * Copies selected text + * @param {Event} e Event object + */ + copy: function() { + this.selectionStart !== this.selectionEnd && (c.copiedText = this.getSelectedText(), c.disableStyleCopyPaste ? c.copiedTextStyle = null : c.copiedTextStyle = this.getSelectionStyles(this.selectionStart, this.selectionEnd, !0), this._copyDone = !0); + }, + /** + * Pastes text + * @param {Event} e Event object + */ + paste: function() { + this.fromPaste = !0; + }, + /** + * @private + * @param {Event} e Event object + * @return {Object} Clipboard data object + */ + _getClipboardData: function(p) { + return p && p.clipboardData || c.window.clipboardData; + }, + /** + * Finds the width in pixels before the cursor on the same line + * @private + * @param {Number} lineIndex + * @param {Number} charIndex + * @return {Number} widthBeforeCursor width before cursor + */ + _getWidthBeforeCursor: function(p, d) { + var m = this._getLineLeftOffset(p), _; + return d > 0 && (_ = this.__charBounds[p][d - 1], m += _.left + _.width), m; + }, + /** + * Gets start offset of a selection + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + getDownCursorOffset: function(p, d) { + var m = this._getSelectionForOffset(p, d), _ = this.get2DCursorLocation(m), y = _.lineIndex; + if (y === this._textLines.length - 1 || p.metaKey || p.keyCode === 34) + return this._text.length - m; + var x = _.charIndex, g = this._getWidthBeforeCursor(y, x), S = this._getIndexOnLine(y + 1, g), T = this._textLines[y].slice(x); + return T.length + S + 1 + this.missingNewlineOffset(y); + }, + /** + * private + * Helps finding if the offset should be counted from Start or End + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + _getSelectionForOffset: function(p, d) { + return p.shiftKey && this.selectionStart !== this.selectionEnd && d ? this.selectionEnd : this.selectionStart; + }, + /** + * @param {Event} e Event object + * @param {Boolean} isRight + * @return {Number} + */ + getUpCursorOffset: function(p, d) { + var m = this._getSelectionForOffset(p, d), _ = this.get2DCursorLocation(m), y = _.lineIndex; + if (y === 0 || p.metaKey || p.keyCode === 33) + return -m; + var x = _.charIndex, g = this._getWidthBeforeCursor(y, x), S = this._getIndexOnLine(y - 1, g), T = this._textLines[y].slice(0, x), C = this.missingNewlineOffset(y - 1); + return -this._textLines[y - 1].length + S - T.length + (1 - C); + }, + /** + * for a given width it founds the matching character. + * @private + */ + _getIndexOnLine: function(p, d) { + for (var m = this._textLines[p], _ = this._getLineLeftOffset(p), y = _, x = 0, g, S, T = 0, C = m.length; T < C; T++) + if (g = this.__charBounds[p][T].width, y += g, y > d) { + S = !0; + var E = y - g, M = y, P = Math.abs(E - d), R = Math.abs(M - d); + x = R < P ? T : T - 1; + break; + } + return S || (x = m.length - 1), x; + }, + /** + * Moves cursor down + * @param {Event} e Event object + */ + moveCursorDown: function(p) { + this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorUpOrDown("Down", p); + }, + /** + * Moves cursor up + * @param {Event} e Event object + */ + moveCursorUp: function(p) { + this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorUpOrDown("Up", p); + }, + /** + * Moves cursor up or down, fires the events + * @param {String} direction 'Up' or 'Down' + * @param {Event} e Event object + */ + _moveCursorUpOrDown: function(p, d) { + var m = "get" + p + "CursorOffset", _ = this[m](d, this._selectionDirection === "right"); + d.shiftKey ? this.moveCursorWithShift(_) : this.moveCursorWithoutShift(_), _ !== 0 && (this.setSelectionInBoundaries(), this.abortCursorAnimation(), this._currentCursorOpacity = 1, this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Moves cursor with shift + * @param {Number} offset + */ + moveCursorWithShift: function(p) { + var d = this._selectionDirection === "left" ? this.selectionStart + p : this.selectionEnd + p; + return this.setSelectionStartEndWithShift(this.selectionStart, this.selectionEnd, d), p !== 0; + }, + /** + * Moves cursor up without shift + * @param {Number} offset + */ + moveCursorWithoutShift: function(p) { + return p < 0 ? (this.selectionStart += p, this.selectionEnd = this.selectionStart) : (this.selectionEnd += p, this.selectionStart = this.selectionEnd), p !== 0; + }, + /** + * Moves cursor left + * @param {Event} e Event object + */ + moveCursorLeft: function(p) { + this.selectionStart === 0 && this.selectionEnd === 0 || this._moveCursorLeftOrRight("Left", p); + }, + /** + * @private + * @return {Boolean} true if a change happened + */ + _move: function(p, d, m) { + var _; + if (p.altKey) + _ = this["findWordBoundary" + m](this[d]); + else if (p.metaKey || p.keyCode === 35 || p.keyCode === 36) + _ = this["findLineBoundary" + m](this[d]); + else + return this[d] += m === "Left" ? -1 : 1, !0; + if (typeof _ !== void 0 && this[d] !== _) + return this[d] = _, !0; + }, + /** + * @private + */ + _moveLeft: function(p, d) { + return this._move(p, d, "Left"); + }, + /** + * @private + */ + _moveRight: function(p, d) { + return this._move(p, d, "Right"); + }, + /** + * Moves cursor left without keeping selection + * @param {Event} e + */ + moveCursorLeftWithoutShift: function(p) { + var d = !0; + return this._selectionDirection = "left", this.selectionEnd === this.selectionStart && this.selectionStart !== 0 && (d = this._moveLeft(p, "selectionStart")), this.selectionEnd = this.selectionStart, d; + }, + /** + * Moves cursor left while keeping selection + * @param {Event} e + */ + moveCursorLeftWithShift: function(p) { + if (this._selectionDirection === "right" && this.selectionStart !== this.selectionEnd) + return this._moveLeft(p, "selectionEnd"); + if (this.selectionStart !== 0) + return this._selectionDirection = "left", this._moveLeft(p, "selectionStart"); + }, + /** + * Moves cursor right + * @param {Event} e Event object + */ + moveCursorRight: function(p) { + this.selectionStart >= this._text.length && this.selectionEnd >= this._text.length || this._moveCursorLeftOrRight("Right", p); + }, + /** + * Moves cursor right or Left, fires event + * @param {String} direction 'Left', 'Right' + * @param {Event} e Event object + */ + _moveCursorLeftOrRight: function(p, d) { + var m = "moveCursor" + p + "With"; + this._currentCursorOpacity = 1, d.shiftKey ? m += "Shift" : m += "outShift", this[m](d) && (this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea()); + }, + /** + * Moves cursor right while keeping selection + * @param {Event} e + */ + moveCursorRightWithShift: function(p) { + if (this._selectionDirection === "left" && this.selectionStart !== this.selectionEnd) + return this._moveRight(p, "selectionStart"); + if (this.selectionEnd !== this._text.length) + return this._selectionDirection = "right", this._moveRight(p, "selectionEnd"); + }, + /** + * Moves cursor right without keeping selection + * @param {Event} e Event object + */ + moveCursorRightWithoutShift: function(p) { + var d = !0; + return this._selectionDirection = "right", this.selectionStart === this.selectionEnd ? (d = this._moveRight(p, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, d; + }, + /** + * Removes characters from start/end + * start/end ar per grapheme position in _text array. + * + * @param {Number} start + * @param {Number} end default to start + 1 + */ + removeChars: function(p, d) { + typeof d == "undefined" && (d = p + 1), this.removeStyleFromTo(p, d), this._text.splice(p, d - p), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles(); + }, + /** + * insert characters at start position, before start position. + * start equal 1 it means the text get inserted between actual grapheme 0 and 1 + * if style array is provided, it must be as the same length of text in graphemes + * if end is provided and is bigger than start, old text is replaced. + * start/end ar per grapheme position in _text array. + * + * @param {String} text text to insert + * @param {Array} style array of style objects + * @param {Number} start + * @param {Number} end default to start + 1 + */ + insertChars: function(p, d, m, _) { + typeof _ == "undefined" && (_ = m), _ > m && this.removeStyleFromTo(m, _); + var y = c.util.string.graphemeSplit(p); + this.insertNewStyleBlock(y, m, d), this._text = [].concat(this._text.slice(0, m), y, this._text.slice(_)), this.text = this._text.join(""), this.set("dirty", !0), this._shouldClearDimensionCache() && (this.initDimensions(), this.setCoords()), this._removeExtraneousStyles(); + } + } + ), function() { + var p = c.util.toFixed, d = / +/g; + c.util.object.extend( + c.Text.prototype, + /** @lends fabric.Text.prototype */ + { + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + _toSVG: function() { + var m = this._getSVGLeftTopOffsets(), _ = this._getSVGTextAndBg(m.textTop, m.textLeft); + return this._wrapSVGTextAndBg(_); + }, + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG: function(m) { + return this._createBaseSVGMarkup( + this._toSVG(), + { reviver: m, noStyle: !0, withShadow: !0 } + ); + }, + /** + * @private + */ + _getSVGLeftTopOffsets: function() { + return { + textLeft: -this.width / 2, + textTop: -this.height / 2, + lineTop: this.getHeightOfLine(0) + }; + }, + /** + * @private + */ + _wrapSVGTextAndBg: function(m) { + var _ = !0, y = this.getSvgTextDecoration(this); + return [ + m.textBgRects.join(""), + ' ", + m.textSpans.join(""), + ` +` + ]; + }, + /** + * @private + * @param {Number} textTopOffset Text top offset + * @param {Number} textLeftOffset Text left offset + * @return {Object} + */ + _getSVGTextAndBg: function(m, _) { + var y = [], x = [], g = m, S; + this._setSVGBg(x); + for (var T = 0, C = this._textLines.length; T < C; T++) + S = this._getLineLeftOffset(T), (this.textBackgroundColor || this.styleHas("textBackgroundColor", T)) && this._setSVGTextLineBg(x, T, _ + S, g), this._setSVGTextLineText(y, T, _ + S, g), g += this.getHeightOfLine(T); + return { + textSpans: y, + textBgRects: x + }; + }, + /** + * @private + */ + _createTextCharSpan: function(m, _, y, x) { + var g = m !== m.trim() || m.match(d), S = this.getSvgSpanStyles(_, g), T = S ? 'style="' + S + '"' : "", C = _.deltaY, E = "", M = c.Object.NUM_FRACTION_DIGITS; + return C && (E = ' dy="' + p(C, M) + '" '), [ + '", + c.util.string.escapeXml(m), + "" + ].join(""); + }, + _setSVGTextLineText: function(m, _, y, x) { + var g = this.getHeightOfLine(_), S = this.textAlign.indexOf("justify") !== -1, T, C, E = "", M, P, R = 0, N = this._textLines[_], F; + x += g * (1 - this._fontSizeFraction) / this.lineHeight; + for (var U = 0, $ = N.length - 1; U <= $; U++) + F = U === $ || this.charSpacing, E += N[U], M = this.__charBounds[_][U], R === 0 ? (y += M.kernedWidth - M.width, R += M.width) : R += M.kernedWidth, S && !F && this._reSpaceAndTab.test(N[U]) && (F = !0), F || (T = T || this.getCompleteStyleDeclaration(_, U), C = this.getCompleteStyleDeclaration(_, U + 1), F = this._hasStyleChangedForSvg(T, C)), F && (P = this._getStyleDeclaration(_, U) || {}, m.push(this._createTextCharSpan(E, P, y, x)), E = "", T = C, y += R, R = 0); + }, + _pushTextBgRect: function(m, _, y, x, g, S) { + var T = c.Object.NUM_FRACTION_DIGITS; + m.push( + " +` + ); + }, + _setSVGTextLineBg: function(m, _, y, x) { + for (var g = this._textLines[_], S = this.getHeightOfLine(_) / this.lineHeight, T = 0, C = 0, E, M, P = this.getValueOfPropertyAt(_, 0, "textBackgroundColor"), R = 0, N = g.length; R < N; R++) + E = this.__charBounds[_][R], M = this.getValueOfPropertyAt(_, R, "textBackgroundColor"), M !== P ? (P && this._pushTextBgRect( + m, + P, + y + C, + x, + T, + S + ), C = E.left, T = E.width, P = M) : T += E.kernedWidth; + M && this._pushTextBgRect( + m, + M, + y + C, + x, + T, + S + ); + }, + /** + * Adobe Illustrator (at least CS5) is unable to render rgba()-based fill values + * we work around it by "moving" alpha channel into opacity attribute and setting fill's alpha to 1 + * + * @private + * @param {*} value + * @return {String} + */ + _getFillAttributes: function(m) { + var _ = m && typeof m == "string" ? new c.Color(m) : ""; + return !_ || !_.getSource() || _.getAlpha() === 1 ? 'fill="' + m + '"' : 'opacity="' + _.getAlpha() + '" fill="' + _.setAlpha(1).toRgb() + '"'; + }, + /** + * @private + */ + _getSVGLineTopOffset: function(m) { + for (var _ = 0, y = 0, x = 0; x < m; x++) + _ += this.getHeightOfLine(x); + return y = this.getHeightOfLine(x), { + lineTop: _, + offset: (this._fontSizeMult - this._fontSizeFraction) * y / (this.lineHeight * this._fontSizeMult) + }; + }, + /** + * Returns styles-string for svg-export + * @param {Boolean} skipShadow a boolean to skip shadow filter output + * @return {String} + */ + getSvgStyles: function(m) { + var _ = c.Object.prototype.getSvgStyles.call(this, m); + return _ + " white-space: pre;"; + } + } + ); + }(), function(p) { + var d = p.fabric || (p.fabric = {}); + d.Textbox = d.util.createClass(d.IText, d.Observable, { + /** + * Type of an object + * @type String + * @default + */ + type: "textbox", + /** + * Minimum width of textbox, in pixels. + * @type Number + * @default + */ + minWidth: 20, + /** + * Minimum calculated width of a textbox, in pixels. + * fixed to 2 so that an empty textbox cannot go to 0 + * and is still selectable without text. + * @type Number + * @default + */ + dynamicMinWidth: 2, + /** + * Cached array of text wrapping. + * @type Array + */ + __cachedLines: null, + /** + * Override standard Object class values + */ + lockScalingFlip: !0, + /** + * Override standard Object class values + * Textbox needs this on false + */ + noScaleCache: !1, + /** + * Properties which when set cause object to change dimensions + * @type Object + * @private + */ + _dimensionAffectingProps: d.Text.prototype._dimensionAffectingProps.concat("width"), + /** + * Use this regular expression to split strings in breakable lines + * @private + */ + _wordJoiners: /[ \t\r]/, + /** + * Use this boolean property in order to split strings that have no white space concept. + * this is a cheap way to help with chinese/japanese + * @type Boolean + * @since 2.6.0 + */ + splitByGrapheme: !1, + /** + * Unlike superclass's version of this function, Textbox does not update + * its width. + * @private + * @override + */ + initDimensions: function() { + this.__skipDimension || (this.isEditing && this.initDelayedCursor(), this.clearContextTop(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), this.textAlign.indexOf("justify") !== -1 && this.enlargeSpaces(), this.height = this.calcTextHeight(), this.saveState({ propertySet: "_dimensionAffectingProps" })); + }, + /** + * Generate an object that translates the style object so that it is + * broken up by visual lines (new lines and automatic wrapping). + * The original text styles object is broken up by actual lines (new lines only), + * which is only sufficient for Text / IText + * @private + */ + _generateStyleMap: function(m) { + for (var _ = 0, y = 0, x = 0, g = {}, S = 0; S < m.graphemeLines.length; S++) + m.graphemeText[x] === ` +` && S > 0 ? (y = 0, x++, _++) : !this.splitByGrapheme && this._reSpaceAndTab.test(m.graphemeText[x]) && S > 0 && (y++, x++), g[S] = { line: _, offset: y }, x += m.graphemeLines[S].length, y += m.graphemeLines[S].length; + return g; + }, + /** + * Returns true if object has a style property or has it on a specified line + * @param {Number} lineIndex + * @return {Boolean} + */ + styleHas: function(m, _) { + if (this._styleMap && !this.isWrapping) { + var y = this._styleMap[_]; + y && (_ = y.line); + } + return d.Text.prototype.styleHas.call(this, m, _); + }, + /** + * Returns true if object has no styling or no styling in a line + * @param {Number} lineIndex , lineIndex is on wrapped lines. + * @return {Boolean} + */ + isEmptyStyles: function(m) { + if (!this.styles) + return !0; + var _ = 0, y = m + 1, x, g, S = !1, T = this._styleMap[m], C = this._styleMap[m + 1]; + T && (m = T.line, _ = T.offset), C && (y = C.line, S = y === m, x = C.offset), g = typeof m == "undefined" ? this.styles : { line: this.styles[m] }; + for (var E in g) + for (var M in g[E]) + if (M >= _ && (!S || M < x)) + for (var P in g[E][M]) + return !1; + return !0; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _getStyleDeclaration: function(m, _) { + if (this._styleMap && !this.isWrapping) { + var y = this._styleMap[m]; + if (!y) + return null; + m = y.line, _ = y.offset + _; + } + return this.callSuper("_getStyleDeclaration", m, _); + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @param {Object} style + * @private + */ + _setStyleDeclaration: function(m, _, y) { + var x = this._styleMap[m]; + m = x.line, _ = x.offset + _, this.styles[m][_] = y; + }, + /** + * @param {Number} lineIndex + * @param {Number} charIndex + * @private + */ + _deleteStyleDeclaration: function(m, _) { + var y = this._styleMap[m]; + m = y.line, _ = y.offset + _, delete this.styles[m][_]; + }, + /** + * probably broken need a fix + * Returns the real style line that correspond to the wrapped lineIndex line + * Used just to verify if the line does exist or not. + * @param {Number} lineIndex + * @returns {Boolean} if the line exists or not + * @private + */ + _getLineStyle: function(m) { + var _ = this._styleMap[m]; + return !!this.styles[_.line]; + }, + /** + * Set the line style to an empty object so that is initialized + * @param {Number} lineIndex + * @param {Object} style + * @private + */ + _setLineStyle: function(m) { + var _ = this._styleMap[m]; + this.styles[_.line] = {}; + }, + /** + * Wraps text using the 'width' property of Textbox. First this function + * splits text on newlines, so we preserve newlines entered by the user. + * Then it wraps each line using the width of the Textbox by calling + * _wrapLine(). + * @param {Array} lines The string array of text that is split into lines + * @param {Number} desiredWidth width you want to wrap to + * @returns {Array} Array of lines + */ + _wrapText: function(m, _) { + var y = [], x; + for (this.isWrapping = !0, x = 0; x < m.length; x++) + y = y.concat(this._wrapLine(m[x], x, _)); + return this.isWrapping = !1, y; + }, + /** + * Helper function to measure a string of text, given its lineIndex and charIndex offset + * it gets called when charBounds are not available yet. + * @param {CanvasRenderingContext2D} ctx + * @param {String} text + * @param {number} lineIndex + * @param {number} charOffset + * @returns {number} + * @private + */ + _measureWord: function(m, _, y) { + var x = 0, g, S = !0; + y = y || 0; + for (var T = 0, C = m.length; T < C; T++) { + var E = this._getGraphemeBox(m[T], _, T + y, g, S); + x += E.kernedWidth, g = m[T]; + } + return x; + }, + /** + * Wraps a line of text using the width of the Textbox and a context. + * @param {Array} line The grapheme array that represent the line + * @param {Number} lineIndex + * @param {Number} desiredWidth width you want to wrap the line to + * @param {Number} reservedSpace space to remove from wrapping for custom functionalities + * @returns {Array} Array of line(s) into which the given text is wrapped + * to. + */ + _wrapLine: function(m, _, y, Q) { + var g = 0, S = this.splitByGrapheme, T = [], C = [], E = S ? d.util.string.graphemeSplit(m) : m.split(this._wordJoiners), M = "", P = 0, R = S ? "" : " ", N = 0, F = 0, U = 0, $ = !0, G = this._getWidthOfCharSpacing(), Q = Q || 0; + E.length === 0 && E.push([]), y -= Q; + for (var ee = 0; ee < E.length; ee++) + M = S ? E[ee] : d.util.string.graphemeSplit(E[ee]), N = this._measureWord(M, _, P), P += M.length, g += F + N - G, g > y && !$ ? (T.push(C), C = [], g = N, $ = !0) : g += G, !$ && !S && C.push(R), C = C.concat(M), F = S ? 0 : this._measureWord([R], _, P), P++, $ = !1, N > U && (U = N); + return ee && T.push(C), U + Q > this.dynamicMinWidth && (this.dynamicMinWidth = U - G + Q), T; + }, + /** + * Detect if the text line is ended with an hard break + * text and itext do not have wrapping, return false + * @param {Number} lineIndex text to split + * @return {Boolean} + */ + isEndOfWrapping: function(m) { + return !this._styleMap[m + 1] || this._styleMap[m + 1].line !== this._styleMap[m].line; + }, + /** + * Detect if a line has a linebreak and so we need to account for it when moving + * and counting style. + * @return Number + */ + missingNewlineOffset: function(m) { + return this.splitByGrapheme ? this.isEndOfWrapping(m) ? 1 : 0 : 1; + }, + /** + * Gets lines of text to render in the Textbox. This function calculates + * text wrapping on the fly every time it is called. + * @param {String} text text to split + * @returns {Array} Array of lines in the Textbox. + * @override + */ + _splitTextIntoLines: function(m) { + for (var _ = d.Text.prototype._splitTextIntoLines.call(this, m), y = this._wrapText(_.lines, this.width), x = new Array(y.length), g = 0; g < y.length; g++) + x[g] = y[g].join(""); + return _.lines = x, _.graphemeLines = y, _; + }, + getMinWidth: function() { + return Math.max(this.minWidth, this.dynamicMinWidth); + }, + _removeExtraneousStyles: function() { + var m = {}; + for (var _ in this._styleMap) + this._textLines[_] && (m[this._styleMap[_].line] = 1); + for (var _ in this.styles) + m[_] || delete this.styles[_]; + }, + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject: function(m) { + return this.callSuper("toObject", ["minWidth", "splitByGrapheme"].concat(m)); + } + }), d.Textbox.fromObject = function(m, _) { + return d.Object._fromObject("Textbox", m, _, "text"); + }; + }(l), function() { + var p = c.controlsUtils, d = p.scaleSkewCursorStyleHandler, m = p.scaleCursorStyleHandler, _ = p.scalingEqually, y = p.scalingYOrSkewingX, x = p.scalingXOrSkewingY, g = p.scaleOrSkewActionName, S = c.Object.prototype.controls; + if (S.ml = new c.Control({ + x: -0.5, + y: 0, + cursorStyleHandler: d, + actionHandler: x, + getActionName: g + }), S.mr = new c.Control({ + x: 0.5, + y: 0, + cursorStyleHandler: d, + actionHandler: x, + getActionName: g + }), S.mb = new c.Control({ + x: 0, + y: 0.5, + cursorStyleHandler: d, + actionHandler: y, + getActionName: g + }), S.mt = new c.Control({ + x: 0, + y: -0.5, + cursorStyleHandler: d, + actionHandler: y, + getActionName: g + }), S.tl = new c.Control({ + x: -0.5, + y: -0.5, + cursorStyleHandler: m, + actionHandler: _ + }), S.tr = new c.Control({ + x: 0.5, + y: -0.5, + cursorStyleHandler: m, + actionHandler: _ + }), S.bl = new c.Control({ + x: -0.5, + y: 0.5, + cursorStyleHandler: m, + actionHandler: _ + }), S.br = new c.Control({ + x: 0.5, + y: 0.5, + cursorStyleHandler: m, + actionHandler: _ + }), S.mtr = new c.Control({ + x: 0, + y: -0.5, + actionHandler: p.rotationWithSnapping, + cursorStyleHandler: p.rotationStyleHandler, + offsetY: -40, + withConnection: !0, + actionName: "rotate" + }), c.Textbox) { + var T = c.Textbox.prototype.controls = {}; + T.mtr = S.mtr, T.tr = S.tr, T.br = S.br, T.tl = S.tl, T.bl = S.bl, T.mt = S.mt, T.mb = S.mb, T.mr = new c.Control({ + x: 0.5, + y: 0, + actionHandler: p.changeWidth, + cursorStyleHandler: d, + actionName: "resizing" + }), T.ml = new c.Control({ + x: -0.5, + y: 0, + actionHandler: p.changeWidth, + cursorStyleHandler: d, + actionName: "resizing" + }); + } + }(); + } + ), + /***/ + 3053: ( + /***/ + function(s, l, u) { + var c = u(602); + function h(f, v, b) { + var w, p; + if (b = b || 0, !c(v)) + return -1; + if (Array.prototype.indexOf) + return Array.prototype.indexOf.call(v, f, b); + for (p = v.length, w = b; b >= 0 && w < p; w += 1) + if (v[w] === f) + return w; + return -1; + } + s.exports = h; + } + ), + /***/ + 8592: ( + /***/ + function(s, l, u) { + var c = u(602), h = u(6092), f = u(5573); + function v(b, w, p) { + c(b) ? h(b, w, p) : f(b, w, p); + } + s.exports = v; + } + ), + /***/ + 6092: ( + /***/ + function(s) { + function l(u, c, h) { + var f = 0, v = u.length; + for (h = h || null; f < v && c.call(h, u[f], f, u) !== !1; f += 1) + ; + } + s.exports = l; + } + ), + /***/ + 5573: ( + /***/ + function(s) { + function l(u, c, h) { + var f; + h = h || null; + for (f in u) + if (u.hasOwnProperty(f) && c.call(h, u[f], f, u) === !1) + break; + } + s.exports = l; + } + ), + /***/ + 9052: ( + /***/ + function(s, l, u) { + var c = u(961), h = u(9886), f = u(2560), v = u(5393), b = u(602), w = u(5183), p = u(8592), d = /\s+/g; + function m() { + this.events = null, this.contexts = null; + } + m.mixin = function(_) { + c(_.prototype, m.prototype); + }, m.prototype._getHandlerItem = function(_, y) { + var x = { handler: _ }; + return y && (x.context = y), x; + }, m.prototype._safeEvent = function(_) { + var y = this.events, x; + return y || (y = this.events = {}), _ && (x = y[_], x || (x = [], y[_] = x), y = x), y; + }, m.prototype._safeContext = function() { + var _ = this.contexts; + return _ || (_ = this.contexts = []), _; + }, m.prototype._indexOfContext = function(_) { + for (var y = this._safeContext(), x = 0; y[x]; ) { + if (_ === y[x][0]) + return x; + x += 1; + } + return -1; + }, m.prototype._memorizeContext = function(_) { + var y, x; + h(_) && (y = this._safeContext(), x = this._indexOfContext(_), x > -1 ? y[x][1] += 1 : y.push([_, 1])); + }, m.prototype._forgetContext = function(_) { + var y, x; + h(_) && (y = this._safeContext(), x = this._indexOfContext(_), x > -1 && (y[x][1] -= 1, y[x][1] <= 0 && y.splice(x, 1))); + }, m.prototype._bindEvent = function(_, y, x) { + var g = this._safeEvent(_); + this._memorizeContext(x), g.push(this._getHandlerItem(y, x)); + }, m.prototype.on = function(_, y, x) { + var g = this; + f(_) ? (_ = _.split(d), p(_, function(S) { + g._bindEvent(S, y, x); + })) : v(_) && (x = y, p(_, function(S, T) { + g.on(T, S, x); + })); + }, m.prototype.once = function(_, y, x) { + var g = this; + if (v(_)) { + x = y, p(_, function(T, C) { + g.once(C, T, x); + }); + return; + } + function S() { + y.apply(x, arguments), g.off(_, S, x); + } + this.on(_, S, x); + }, m.prototype._spliceMatches = function(_, y) { + var x = 0, g; + if (b(_)) + for (g = _.length; x < g; x += 1) + y(_[x]) === !0 && (_.splice(x, 1), g -= 1, x -= 1); + }, m.prototype._matchHandler = function(_) { + var y = this; + return function(x) { + var g = _ === x.handler; + return g && y._forgetContext(x.context), g; + }; + }, m.prototype._matchContext = function(_) { + var y = this; + return function(x) { + var g = _ === x.context; + return g && y._forgetContext(x.context), g; + }; + }, m.prototype._matchHandlerAndContext = function(_, y) { + var x = this; + return function(g) { + var S = _ === g.handler, T = y === g.context, C = S && T; + return C && x._forgetContext(g.context), C; + }; + }, m.prototype._offByEventName = function(_, y) { + var x = this, g = w(y), S = x._matchHandler(y); + _ = _.split(d), p(_, function(T) { + var C = x._safeEvent(T); + g ? x._spliceMatches(C, S) : (p(C, function(E) { + x._forgetContext(E.context); + }), x.events[T] = []); + }); + }, m.prototype._offByHandler = function(_) { + var y = this, x = this._matchHandler(_); + p(this._safeEvent(), function(g) { + y._spliceMatches(g, x); + }); + }, m.prototype._offByObject = function(_, y) { + var x = this, g; + this._indexOfContext(_) < 0 ? p(_, function(S, T) { + x.off(T, S); + }) : f(y) ? (g = this._matchContext(_), x._spliceMatches(this._safeEvent(y), g)) : w(y) ? (g = this._matchHandlerAndContext(y, _), p(this._safeEvent(), function(S) { + x._spliceMatches(S, g); + })) : (g = this._matchContext(_), p(this._safeEvent(), function(S) { + x._spliceMatches(S, g); + })); + }, m.prototype.off = function(_, y) { + f(_) ? this._offByEventName(_, y) : arguments.length ? w(_) ? this._offByHandler(_) : v(_) && this._offByObject(_, y) : (this.events = {}, this.contexts = []); + }, m.prototype.fire = function(_) { + this.invoke.apply(this, arguments); + }, m.prototype.invoke = function(_) { + var y, x, g, S; + if (!this.hasListener(_)) + return !0; + for (y = this._safeEvent(_), x = Array.prototype.slice.call(arguments, 1), g = 0; y[g]; ) { + if (S = y[g], S.handler.apply(S.context, x) === !1) + return !1; + g += 1; + } + return !0; + }, m.prototype.hasListener = function(_) { + return this.getListenerLength(_) > 0; + }, m.prototype.getListenerLength = function(_) { + var y = this._safeEvent(_); + return y.length; + }, s.exports = m; + } + ), + /***/ + 961: ( + /***/ + function(s) { + function l(u, c) { + var h = Object.prototype.hasOwnProperty, f, v, b, w; + for (b = 1, w = arguments.length; b < w; b += 1) { + f = arguments[b]; + for (v in f) + h.call(f, v) && (u[v] = f[v]); + } + return u; + } + s.exports = l; + } + ), + /***/ + 1610: ( + /***/ + function(s, l, u) { + var c = u(5695), h = u(3778); + function f(v, b) { + for (var w = arguments, p = w[0], d = 1, m = w.length; d < m; d += 1) { + if (c(p) || h(p)) + return; + p = p[w[d]]; + } + return p; + } + s.exports = f; + } + ), + /***/ + 4564: ( + /***/ + function(s, l, u) { + var c = u(5573); + function h(f, v) { + var b = document.createElement("img"), w = ""; + return c(v, function(p, d) { + w += "&" + d + "=" + p; + }), w = w.substring(1), b.src = f + "?" + w, b.style.display = "none", document.body.appendChild(b), document.body.removeChild(b), b; + } + s.exports = h; + } + ), + /***/ + 4729: ( + /***/ + function(s, l, u) { + var c = u(5695), h = u(4564), f = 7 * 24 * 60 * 60 * 1e3; + function v(w) { + var p = (/* @__PURE__ */ new Date()).getTime(); + return p - w > f; + } + function b(w, p) { + var d = "https://www.google-analytics.com/collect", m = location.hostname, _ = "event", y = "use", x = "TOAST UI " + w + " for " + m + ": Statistics", g = window.localStorage.getItem(x); + !c(window.tui) && window.tui.usageStatistics === !1 || g && !v(g) || (window.localStorage.setItem(x, (/* @__PURE__ */ new Date()).getTime()), setTimeout(function() { + (document.readyState === "interactive" || document.readyState === "complete") && h(d, { + v: 1, + t: _, + tid: p, + cid: m, + dp: m, + dh: w, + el: w, + ec: y + }); + }, 1e3)); + } + s.exports = b; + } + ), + /***/ + 602: ( + /***/ + function(s) { + function l(u) { + return u instanceof Array; + } + s.exports = l; + } + ), + /***/ + 9886: ( + /***/ + function(s, l, u) { + var c = u(5695), h = u(3778); + function f(v) { + return !c(v) && !h(v); + } + s.exports = f; + } + ), + /***/ + 5183: ( + /***/ + function(s) { + function l(u) { + return u instanceof Function; + } + s.exports = l; + } + ), + /***/ + 3778: ( + /***/ + function(s) { + function l(u) { + return u === null; + } + s.exports = l; + } + ), + /***/ + 5393: ( + /***/ + function(s) { + function l(u) { + return u === Object(u); + } + s.exports = l; + } + ), + /***/ + 2560: ( + /***/ + function(s) { + function l(u) { + return typeof u == "string" || u instanceof String; + } + s.exports = l; + } + ), + /***/ + 5695: ( + /***/ + function(s) { + function l(u) { + return u === void 0; + } + s.exports = l; + } + ), + /***/ + 4426: ( + /***/ + function(s, l, u) { + s.exports = u(4486); + } + ), + /***/ + 9406: ( + /***/ + function(s, l, u) { + s.exports = u(4877); + } + ), + /***/ + 789: ( + /***/ + function(s, l, u) { + s.exports = u(7178); + } + ), + /***/ + 381: ( + /***/ + function(s, l, u) { + s.exports = u(5603); + } + ), + /***/ + 7636: ( + /***/ + function(s, l, u) { + s.exports = u(1206); + } + ), + /***/ + 1899: ( + /***/ + function(s, l, u) { + s.exports = u(6174); + } + ), + /***/ + 899: ( + /***/ + function(s, l, u) { + s.exports = u(57); + } + ), + /***/ + 8005: ( + /***/ + function(s, l, u) { + s.exports = u(4741); + } + ), + /***/ + 6562: ( + /***/ + function(s, l, u) { + s.exports = u(8368); + } + ), + /***/ + 9131: ( + /***/ + function(s, l, u) { + s.exports = u(3739); + } + ), + /***/ + 4383: ( + /***/ + function(s, l, u) { + s.exports = u(172); + } + ), + /***/ + 6065: ( + /***/ + function(s, l, u) { + s.exports = u(4963); + } + ), + /***/ + 1734: ( + /***/ + function(s, l, u) { + s.exports = u(7820); + } + ), + /***/ + 2461: ( + /***/ + function(s, l, u) { + s.exports = u(5636); + } + ), + /***/ + 5214: ( + /***/ + function(s, l, u) { + s.exports = u(5059); + } + ), + /***/ + 6397: ( + /***/ + function(s, l, u) { + s.exports = u(3969); + } + ), + /***/ + 8189: ( + /***/ + function(s, l, u) { + s.exports = u(6618); + } + ), + /***/ + 9146: ( + /***/ + function(s, l, u) { + s.exports = u(5279); + } + ), + /***/ + 4496: ( + /***/ + function(s, l, u) { + s.exports = u(9562); + } + ), + /***/ + 3972: ( + /***/ + function(s, l, u) { + s.exports = u(652); + } + ), + /***/ + 7172: ( + /***/ + function(s, l, u) { + s.exports = u(2813); + } + ), + /***/ + 1845: ( + /***/ + function(s, l, u) { + s.exports = u(8664); + } + ), + /***/ + 662: ( + /***/ + function(s, l, u) { + s.exports = u(1457); + } + ), + /***/ + 711: ( + /***/ + function(s, l, u) { + s.exports = u(2937); + } + ), + /***/ + 6623: ( + /***/ + function(s, l, u) { + s.exports = u(9297); + } + ), + /***/ + 7077: ( + /***/ + function(s, l, u) { + s.exports = u(8026); + } + ), + /***/ + 9856: ( + /***/ + function(s, l, u) { + s.exports = u(2044); + } + ), + /***/ + 4230: ( + /***/ + function(s, l, u) { + s.exports = u(2214); + } + ), + /***/ + 184: ( + /***/ + function(s, l, u) { + s.exports = u(9256); + } + ), + /***/ + 3742: ( + /***/ + function(s, l, u) { + s.exports = u(5659); + } + ), + /***/ + 1801: ( + /***/ + function(s) { + var l = { + rect: 1, + circle: 2, + triangle: 1 + }, u = { + rect: { + w: "width", + h: "height" + }, + circle: { + w: "rx", + h: "ry" + }, + triangle: { + w: "width", + h: "height" + } + }; + function c(d) { + var m = d.originX, _ = d.originY, y = m.substring(0, 1) + _.substring(0, 1); + d.startPoint = d.origins[y]; + } + function h(d, m, _) { + var y = d.x, x = d.y, g = m.x, S = m.y, T = _ * Math.PI / 180, C = (g - y) * Math.cos(T) - (S - x) * Math.sin(T) + y, E = (g - y) * Math.sin(T) + (S - x) * Math.cos(T) + x; + return { + originX: y > C ? "right" : "left", + originY: x > E ? "bottom" : "top" + }; + } + function f(d) { + return d.originX === "center" && d.originY === "center"; + } + function v(d, m) { + var _ = m.getPointByOrigin("center", "center"), y = -m.angle, x = h(_, d, y), g = x.originX, S = x.originY, T = m.getPointByOrigin(g, S), C = m.left - (_.x - T.x), E = m.top - (_.y - T.y); + m.set({ + originX: g, + originY: S, + left: C, + top: E + }), m.setCoords(); + } + function b(d, m) { + var _ = m.startPoint, y = -m.angle, x = h(_, d, y), g = x.originX, S = x.originY; + m.setPositionByOrigin(_, g, S), m.setCoords(); + } + function w(d) { + var m = d.type, _ = d.scaleX, y = d.scaleY, x = u[m], g = d[x.w] * _, S = d[x.h] * y; + if (d.isRegular) { + var T = Math.max(_, y); + g = d[x.w] * T, S = d[x.h] * T; + } + var C = { + hasControls: !1, + hasBorders: !1, + scaleX: 1, + scaleY: 1 + }; + C[x.w] = g, C[x.h] = S, d.set(C); + } + function p(d, m) { + var _ = m.type, y = m.strokeWidth, x = m.startPoint, g = l[_], S = u[_], T = m.type === "triangle", C = {}, E = Math.abs(x.x - d.x) / g, M = Math.abs(x.y - d.y) / g; + E > y && (E -= y / g), M > y && (M -= y / g), m.isRegular && (E = M = Math.max(E, M), T && (M = Math.sqrt(3) / 2 * E)), C[S.w] = E, C[S.h] = M, m.set(C); + } + s.exports = { + /** + * Set each origin value to shape + * @param {fabric.Object} shape - Shape object + */ + setOrigins: function(m) { + var _ = m.getPointByOrigin("left", "top"), y = m.getPointByOrigin("right", "top"), x = m.getPointByOrigin("right", "bottom"), g = m.getPointByOrigin("left", "bottom"); + m.origins = { + lt: _, + rt: y, + rb: x, + lb: g + }; + }, + /** + * Resize the shape + * @param {fabric.Object} shape - Shape object + * @param {{x: number, y: number}} pointer - Mouse pointer values on canvas + * @param {boolean} isScaling - Whether the resizing action is scaling or not + */ + resize: function(m, _, y) { + f(m) && (v(_, m), c(m)), y ? w(m) : p(_, m), b(_, m); + }, + /** + * Adjust the origin position of shape to center + * @param {fabric.Object} shape - Shape object + */ + adjustOriginToCenter: function(m) { + var _ = m.getPointByOrigin("center", "center"), y = m.originX, x = m.originY, g = m.getPointByOrigin(y, x), S = m.left + (_.x - g.x), T = m.top + (_.y - g.y); + m.set({ + hasControls: !0, + hasBorders: !0, + originX: "center", + originY: "center", + left: S, + top: T + }), m.setCoords(); + } + }; + } + ), + /***/ + 2221: ( + /***/ + function(s, l, u) { + u(5454), u(9173); + var c = u(7545); + s.exports = c.Array.from; + } + ), + /***/ + 5078: ( + /***/ + function(s, l, u) { + u(8118); + var c = u(7545); + s.exports = c.Array.isArray; + } + ), + /***/ + 6135: ( + /***/ + function(s, l, u) { + u(9106); + var c = u(5607); + s.exports = c("Array").concat; + } + ), + /***/ + 9510: ( + /***/ + function(s, l, u) { + u(1710); + var c = u(5607); + s.exports = c("Array").fill; + } + ), + /***/ + 3971: ( + /***/ + function(s, l, u) { + u(3436); + var c = u(5607); + s.exports = c("Array").filter; + } + ), + /***/ + 98: ( + /***/ + function(s, l, u) { + u(9823); + var c = u(5607); + s.exports = c("Array").forEach; + } + ), + /***/ + 2089: ( + /***/ + function(s, l, u) { + u(2276); + var c = u(5607); + s.exports = c("Array").indexOf; + } + ), + /***/ + 6209: ( + /***/ + function(s, l, u) { + u(3838); + var c = u(5607); + s.exports = c("Array").map; + } + ), + /***/ + 2671: ( + /***/ + function(s, l, u) { + u(5818); + var c = u(5607); + s.exports = c("Array").slice; + } + ), + /***/ + 1375: ( + /***/ + function(s, l, u) { + u(2178); + var c = u(5607); + s.exports = c("Array").splice; + } + ), + /***/ + 3528: ( + /***/ + function(s, l, u) { + u(665); + var c = u(5607); + s.exports = c("Function").bind; + } + ), + /***/ + 5739: ( + /***/ + function(s, l, u) { + u(8939), u(5454); + var c = u(8703); + s.exports = c; + } + ), + /***/ + 278: ( + /***/ + function(s, l, u) { + var c = u(3528), h = Function.prototype; + s.exports = function(f) { + var v = f.bind; + return f === h || f instanceof Function && v === h.bind ? c : v; + }; + } + ), + /***/ + 1484: ( + /***/ + function(s, l, u) { + var c = u(6135), h = Array.prototype; + s.exports = function(f) { + var v = f.concat; + return f === h || f instanceof Array && v === h.concat ? c : v; + }; + } + ), + /***/ + 7731: ( + /***/ + function(s, l, u) { + var c = u(9510), h = Array.prototype; + s.exports = function(f) { + var v = f.fill; + return f === h || f instanceof Array && v === h.fill ? c : v; + }; + } + ), + /***/ + 3669: ( + /***/ + function(s, l, u) { + var c = u(3971), h = Array.prototype; + s.exports = function(f) { + var v = f.filter; + return f === h || f instanceof Array && v === h.filter ? c : v; + }; + } + ), + /***/ + 2604: ( + /***/ + function(s, l, u) { + var c = u(2089), h = Array.prototype; + s.exports = function(f) { + var v = f.indexOf; + return f === h || f instanceof Array && v === h.indexOf ? c : v; + }; + } + ), + /***/ + 263: ( + /***/ + function(s, l, u) { + var c = u(6209), h = Array.prototype; + s.exports = function(f) { + var v = f.map; + return f === h || f instanceof Array && v === h.map ? c : v; + }; + } + ), + /***/ + 7663: ( + /***/ + function(s, l, u) { + var c = u(2671), h = Array.prototype; + s.exports = function(f) { + var v = f.slice; + return f === h || f instanceof Array && v === h.slice ? c : v; + }; + } + ), + /***/ + 5063: ( + /***/ + function(s, l, u) { + var c = u(1375), h = Array.prototype; + s.exports = function(f) { + var v = f.splice; + return f === h || f instanceof Array && v === h.splice ? c : v; + }; + } + ), + /***/ + 6813: ( + /***/ + function(s, l, u) { + var c = u(3842), h = String.prototype; + s.exports = function(f) { + var v = f.trim; + return typeof f == "string" || f === h || f instanceof String && v === h.trim ? c : v; + }; + } + ), + /***/ + 6285: ( + /***/ + function(s, l, u) { + u(2666); + var c = u(7545); + s.exports = c.Number.parseInt; + } + ), + /***/ + 3213: ( + /***/ + function(s, l, u) { + u(3113); + var c = u(7545), h = c.Object; + s.exports = function(v, b) { + return h.create(v, b); + }; + } + ), + /***/ + 3512: ( + /***/ + function(s, l, u) { + u(297); + var c = u(7545), h = c.Object, f = s.exports = function(b, w, p) { + return h.defineProperty(b, w, p); + }; + h.defineProperty.sham && (f.sham = !0); + } + ), + /***/ + 8168: ( + /***/ + function(s, l, u) { + u(9234); + var c = u(7545); + s.exports = c.Object.getPrototypeOf; + } + ), + /***/ + 8651: ( + /***/ + function(s, l, u) { + u(2647); + var c = u(7545); + s.exports = c.Object.keys; + } + ), + /***/ + 3083: ( + /***/ + function(s, l, u) { + u(3222); + var c = u(7545); + s.exports = c.Object.setPrototypeOf; + } + ), + /***/ + 2987: ( + /***/ + function(s, l, u) { + u(4859); + var c = u(7545); + s.exports = c.parseFloat; + } + ), + /***/ + 2239: ( + /***/ + function(s, l, u) { + u(5706); + var c = u(7545); + s.exports = c.parseInt; + } + ), + /***/ + 3154: ( + /***/ + function(s, l, u) { + u(4242), u(8939), u(6663), u(9021), u(7884), u(8885), u(1868), u(5454); + var c = u(7545); + s.exports = c.Promise; + } + ), + /***/ + 6577: ( + /***/ + function(s, l, u) { + u(5397); + var c = u(7545); + s.exports = c.Reflect.construct; + } + ), + /***/ + 3842: ( + /***/ + function(s, l, u) { + u(957); + var c = u(5607); + s.exports = c("String").trim; + } + ), + /***/ + 5008: ( + /***/ + function(s, l, u) { + u(9106), u(6663), u(6187), u(9781), u(492), u(6681), u(9594), u(3665), u(9017), u(1250), u(9786), u(503), u(6565), u(9322), u(3610), u(6886), u(3514), u(8671), u(8556), u(1367); + var c = u(7545); + s.exports = c.Symbol; + } + ), + /***/ + 994: ( + /***/ + function(s, l, u) { + u(8939), u(6663), u(5454), u(3665); + var c = u(9207); + s.exports = c.f("iterator"); + } + ), + /***/ + 2813: ( + /***/ + function(s, l, u) { + var c = u(3822); + s.exports = c; + } + ), + /***/ + 8664: ( + /***/ + function(s, l, u) { + var c = u(1434); + s.exports = c; + } + ), + /***/ + 1457: ( + /***/ + function(s, l, u) { + var c = u(7710); + s.exports = c; + } + ), + /***/ + 2937: ( + /***/ + function(s, l, u) { + var c = u(4741); + s.exports = c; + } + ), + /***/ + 9297: ( + /***/ + function(s, l, u) { + var c = u(4963); + s.exports = c; + } + ), + /***/ + 8026: ( + /***/ + function(s, l, u) { + var c = u(7820); + s.exports = c; + } + ), + /***/ + 2044: ( + /***/ + function(s, l, u) { + var c = u(8980); + s.exports = c; + } + ), + /***/ + 2214: ( + /***/ + function(s, l, u) { + var c = u(6672); + s.exports = c; + } + ), + /***/ + 9256: ( + /***/ + function(s, l, u) { + var c = u(2285); + u(177), u(9031), u(6658), u(1875), u(8658), u(4592), u(6680), s.exports = c; + } + ), + /***/ + 5659: ( + /***/ + function(s, l, u) { + var c = u(8535); + s.exports = c; + } + ), + /***/ + 6235: ( + /***/ + function(s, l, u) { + var c = u(6447), h = u(9288); + s.exports = function(f) { + if (c(f)) + return f; + throw TypeError(h(f) + " is not a function"); + }; + } + ), + /***/ + 1404: ( + /***/ + function(s, l, u) { + var c = u(2091), h = u(9288); + s.exports = function(f) { + if (c(f)) + return f; + throw TypeError(h(f) + " is not a constructor"); + }; + } + ), + /***/ + 7757: ( + /***/ + function(s, l, u) { + var c = u(6447); + s.exports = function(h) { + if (typeof h == "object" || c(h)) + return h; + throw TypeError("Can't set " + String(h) + " as a prototype"); + }; + } + ), + /***/ + 7423: ( + /***/ + function(s) { + s.exports = function() { + }; + } + ), + /***/ + 6961: ( + /***/ + function(s) { + s.exports = function(l, u, c) { + if (l instanceof u) + return l; + throw TypeError("Incorrect " + (c ? c + " " : "") + "invocation"); + }; + } + ), + /***/ + 1138: ( + /***/ + function(s, l, u) { + var c = u(5744); + s.exports = function(h) { + if (c(h)) + return h; + throw TypeError(String(h) + " is not an object"); + }; + } + ), + /***/ + 2724: ( + /***/ + function(s, l, u) { + var c = u(1795), h = u(7739), f = u(4104); + s.exports = function(b) { + for (var w = c(this), p = f(w), d = arguments.length, m = h(d > 1 ? arguments[1] : void 0, p), _ = d > 2 ? arguments[2] : void 0, y = _ === void 0 ? p : h(_, p); y > m; ) + w[m++] = b; + return w; + }; + } + ), + /***/ + 7397: ( + /***/ + function(s, l, u) { + var c = u(454).forEach, h = u(424), f = h("forEach"); + s.exports = f ? [].forEach : function(b) { + return c(this, b, arguments.length > 1 ? arguments[1] : void 0); + }; + } + ), + /***/ + 841: ( + /***/ + function(s, l, u) { + var c = u(8043), h = u(1795), f = u(1635), v = u(6109), b = u(2091), w = u(4104), p = u(9361), d = u(1669), m = u(8703); + s.exports = function(y) { + var x = h(y), g = b(this), S = arguments.length, T = S > 1 ? arguments[1] : void 0, C = T !== void 0; + C && (T = c(T, S > 2 ? arguments[2] : void 0, 2)); + var E = m(x), M = 0, P, R, N, F, U, $; + if (E && !(this == Array && v(E))) + for (F = d(x, E), U = F.next, R = g ? new this() : []; !(N = U.call(F)).done; M++) + $ = C ? f(F, T, [N.value, M], !0) : N.value, p(R, M, $); + else + for (P = w(x), R = g ? new this(P) : Array(P); P > M; M++) + $ = C ? T(x[M], M) : x[M], p(R, M, $); + return R.length = M, R; + }; + } + ), + /***/ + 8180: ( + /***/ + function(s, l, u) { + var c = u(101), h = u(7739), f = u(4104), v = function(b) { + return function(w, p, d) { + var m = c(w), _ = f(m), y = h(d, _), x; + if (b && p != p) { + for (; _ > y; ) + if (x = m[y++], x != x) + return !0; + } else + for (; _ > y; y++) + if ((b || y in m) && m[y] === p) + return b || y || 0; + return !b && -1; + }; + }; + s.exports = { + // `Array.prototype.includes` method + // https://tc39.es/ecma262/#sec-array.prototype.includes + includes: v(!0), + // `Array.prototype.indexOf` method + // https://tc39.es/ecma262/#sec-array.prototype.indexof + indexOf: v(!1) + }; + } + ), + /***/ + 454: ( + /***/ + function(s, l, u) { + var c = u(8043), h = u(2202), f = u(1795), v = u(4104), b = u(1321), w = [].push, p = function(d) { + var m = d == 1, _ = d == 2, y = d == 3, x = d == 4, g = d == 6, S = d == 7, T = d == 5 || g; + return function(C, E, M, P) { + for (var R = f(C), N = h(R), F = c(E, M, 3), U = v(N), $ = 0, G = P || b, Q = m ? G(C, U) : _ || S ? G(C, 0) : void 0, ee, ce; U > $; $++) + if ((T || $ in N) && (ee = N[$], ce = F(ee, $, R), d)) + if (m) + Q[$] = ce; + else if (ce) + switch (d) { + case 3: + return !0; + case 5: + return ee; + case 6: + return $; + case 2: + w.call(Q, ee); + } + else + switch (d) { + case 4: + return !1; + case 7: + w.call(Q, ee); + } + return g ? -1 : y || x ? x : Q; + }; + }; + s.exports = { + // `Array.prototype.forEach` method + // https://tc39.es/ecma262/#sec-array.prototype.foreach + forEach: p(0), + // `Array.prototype.map` method + // https://tc39.es/ecma262/#sec-array.prototype.map + map: p(1), + // `Array.prototype.filter` method + // https://tc39.es/ecma262/#sec-array.prototype.filter + filter: p(2), + // `Array.prototype.some` method + // https://tc39.es/ecma262/#sec-array.prototype.some + some: p(3), + // `Array.prototype.every` method + // https://tc39.es/ecma262/#sec-array.prototype.every + every: p(4), + // `Array.prototype.find` method + // https://tc39.es/ecma262/#sec-array.prototype.find + find: p(5), + // `Array.prototype.findIndex` method + // https://tc39.es/ecma262/#sec-array.prototype.findIndex + findIndex: p(6), + // `Array.prototype.filterReject` method + // https://github.com/tc39/proposal-array-filtering + filterReject: p(7) + }; + } + ), + /***/ + 242: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(8182), f = u(4218), v = h("species"); + s.exports = function(b) { + return f >= 51 || !c(function() { + var w = [], p = w.constructor = {}; + return p[v] = function() { + return { foo: 1 }; + }, w[b](Boolean).foo !== 1; + }); + }; + } + ), + /***/ + 424: ( + /***/ + function(s, l, u) { + var c = u(6192); + s.exports = function(h, f) { + var v = [][h]; + return !!v && c(function() { + v.call(null, f || function() { + throw 1; + }, 1); + }); + }; + } + ), + /***/ + 3712: ( + /***/ + function(s, l, u) { + var c = u(4770), h = u(2091), f = u(5744), v = u(8182), b = v("species"); + s.exports = function(w) { + var p; + return c(w) && (p = w.constructor, h(p) && (p === Array || c(p.prototype)) ? p = void 0 : f(p) && (p = p[b], p === null && (p = void 0))), p === void 0 ? Array : p; + }; + } + ), + /***/ + 1321: ( + /***/ + function(s, l, u) { + var c = u(3712); + s.exports = function(h, f) { + return new (c(h))(f === 0 ? 0 : f); + }; + } + ), + /***/ + 1635: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(6639); + s.exports = function(f, v, b, w) { + try { + return w ? v(c(b)[0], b[1]) : v(b); + } catch (p) { + h(f, "throw", p); + } + }; + } + ), + /***/ + 9770: ( + /***/ + function(s, l, u) { + var c = u(8182), h = c("iterator"), f = !1; + try { + var v = 0, b = { + next: function() { + return { done: !!v++ }; + }, + return: function() { + f = !0; + } + }; + b[h] = function() { + return this; + }, Array.from(b, function() { + throw 2; + }); + } catch (w) { + } + s.exports = function(w, p) { + if (!p && !f) + return !1; + var d = !1; + try { + var m = {}; + m[h] = function() { + return { + next: function() { + return { done: d = !0 }; + } + }; + }, w(m); + } catch (_) { + } + return d; + }; + } + ), + /***/ + 9272: ( + /***/ + function(s) { + var l = {}.toString; + s.exports = function(u) { + return l.call(u).slice(8, -1); + }; + } + ), + /***/ + 4696: ( + /***/ + function(s, l, u) { + var c = u(3471), h = u(6447), f = u(9272), v = u(8182), b = v("toStringTag"), w = f(function() { + return arguments; + }()) == "Arguments", p = function(d, m) { + try { + return d[m]; + } catch (_) { + } + }; + s.exports = c ? f : function(d) { + var m, _, y; + return d === void 0 ? "Undefined" : d === null ? "Null" : typeof (_ = p(m = Object(d), b)) == "string" ? _ : w ? f(m) : (y = f(m)) == "Object" && h(m.callee) ? "Arguments" : y; + }; + } + ), + /***/ + 4635: ( + /***/ + function(s, l, u) { + var c = u(6192); + s.exports = !c(function() { + function h() { + } + return h.prototype.constructor = null, Object.getPrototypeOf(new h()) !== h.prototype; + }); + } + ), + /***/ + 5148: ( + /***/ + function(s, l, u) { + var c = u(4413).IteratorPrototype, h = u(2853), f = u(774), v = u(1284), b = u(7771), w = function() { + return this; + }; + s.exports = function(p, d, m) { + var _ = d + " Iterator"; + return p.prototype = h(c, { next: f(1, m) }), v(p, _, !1, !0), b[_] = w, p; + }; + } + ), + /***/ + 8711: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(2760), f = u(774); + s.exports = c ? function(v, b, w) { + return h.f(v, b, f(1, w)); + } : function(v, b, w) { + return v[b] = w, v; + }; + } + ), + /***/ + 774: ( + /***/ + function(s) { + s.exports = function(l, u) { + return { + enumerable: !(l & 1), + configurable: !(l & 2), + writable: !(l & 4), + value: u + }; + }; + } + ), + /***/ + 9361: ( + /***/ + function(s, l, u) { + var c = u(77), h = u(2760), f = u(774); + s.exports = function(v, b, w) { + var p = c(b); + p in v ? h.f(v, p, f(0, w)) : v[p] = w; + }; + } + ), + /***/ + 7218: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(5546), f = u(2282), v = u(6447), b = u(5148), w = u(9341), p = u(4469), d = u(1284), m = u(8711), _ = u(9482), y = u(8182), x = u(7771), g = u(4413), S = f.PROPER, T = f.CONFIGURABLE, C = g.IteratorPrototype, E = g.BUGGY_SAFARI_ITERATORS, M = y("iterator"), P = "keys", R = "values", N = "entries", F = function() { + return this; + }; + s.exports = function(U, $, G, Q, ee, ce, ne) { + b(G, $, Q); + var fe = function(re) { + if (re === ee && oe) + return oe; + if (!E && re in xe) + return xe[re]; + switch (re) { + case P: + return function() { + return new G(this, re); + }; + case R: + return function() { + return new G(this, re); + }; + case N: + return function() { + return new G(this, re); + }; + } + return function() { + return new G(this); + }; + }, K = $ + " Iterator", Oe = !1, xe = U.prototype, Ge = xe[M] || xe["@@iterator"] || ee && xe[ee], oe = !E && Ge || fe(ee), de = $ == "Array" && xe.entries || Ge, se, te, pe; + if (de && (se = w(de.call(new U())), se !== Object.prototype && se.next && (!h && w(se) !== C && (p ? p(se, C) : v(se[M]) || _(se, M, F)), d(se, K, !0, !0), h && (x[K] = F))), S && ee == R && Ge && Ge.name !== R && (!h && T ? m(xe, "name", R) : (Oe = !0, oe = function() { + return Ge.call(this); + })), ee) + if (te = { + values: fe(R), + keys: ce ? oe : fe(P), + entries: fe(N) + }, ne) + for (pe in te) + (E || Oe || !(pe in xe)) && _(xe, pe, te[pe]); + else + c({ target: $, proto: !0, forced: E || Oe }, te); + return (!h || ne) && xe[M] !== oe && _(xe, M, oe, { name: ee }), x[$] = oe, te; + }; + } + ), + /***/ + 1488: ( + /***/ + function(s, l, u) { + var c = u(7545), h = u(4500), f = u(9207), v = u(2760).f; + s.exports = function(b) { + var w = c.Symbol || (c.Symbol = {}); + h(w, b) || v(w, b, { + value: f.f(b) + }); + }; + } + ), + /***/ + 69: ( + /***/ + function(s, l, u) { + var c = u(6192); + s.exports = !c(function() { + return Object.defineProperty({}, 1, { get: function() { + return 7; + } })[1] != 7; + }); + } + ), + /***/ + 7449: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(5744), f = c.document, v = h(f) && h(f.createElement); + s.exports = function(b) { + return v ? f.createElement(b) : {}; + }; + } + ), + /***/ + 7365: ( + /***/ + function(s) { + s.exports = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + } + ), + /***/ + 2957: ( + /***/ + function(s) { + s.exports = typeof window == "object"; + } + ), + /***/ + 9347: ( + /***/ + function(s, l, u) { + var c = u(8989), h = u(8576); + s.exports = /ipad|iphone|ipod/i.test(c) && h.Pebble !== void 0; + } + ), + /***/ + 9536: ( + /***/ + function(s, l, u) { + var c = u(8989); + s.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(c); + } + ), + /***/ + 224: ( + /***/ + function(s, l, u) { + var c = u(9272), h = u(8576); + s.exports = c(h.process) == "process"; + } + ), + /***/ + 5914: ( + /***/ + function(s, l, u) { + var c = u(8989); + s.exports = /web0s(?!.*chrome)/i.test(c); + } + ), + /***/ + 8989: ( + /***/ + function(s, l, u) { + var c = u(150); + s.exports = c("navigator", "userAgent") || ""; + } + ), + /***/ + 4218: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(8989), f = c.process, v = c.Deno, b = f && f.versions || v && v.version, w = b && b.v8, p, d; + w ? (p = w.split("."), d = p[0] < 4 ? 1 : p[0] + p[1]) : h && (p = h.match(/Edge\/(\d+)/), (!p || p[1] >= 74) && (p = h.match(/Chrome\/(\d+)/), p && (d = p[1]))), s.exports = d && +d; + } + ), + /***/ + 5607: ( + /***/ + function(s, l, u) { + var c = u(7545); + s.exports = function(h) { + return c[h + "Prototype"]; + }; + } + ), + /***/ + 2952: ( + /***/ + function(s) { + s.exports = [ + "constructor", + "hasOwnProperty", + "isPrototypeOf", + "propertyIsEnumerable", + "toLocaleString", + "toString", + "valueOf" + ]; + } + ), + /***/ + 3085: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(6447), f = u(5141).f, v = u(9245), b = u(7545), w = u(8043), p = u(8711), d = u(4500), m = function(_) { + var y = function(x, g, S) { + if (this instanceof _) { + switch (arguments.length) { + case 0: + return new _(); + case 1: + return new _(x); + case 2: + return new _(x, g); + } + return new _(x, g, S); + } + return _.apply(this, arguments); + }; + return y.prototype = _.prototype, y; + }; + s.exports = function(_, y) { + var x = _.target, g = _.global, S = _.stat, T = _.proto, C = g ? c : S ? c[x] : (c[x] || {}).prototype, E = g ? b : b[x] || p(b, x, {})[x], M = E.prototype, P, R, N, F, U, $, G, Q, ee; + for (F in y) + P = v(g ? F : x + (S ? "." : "#") + F, _.forced), R = !P && C && d(C, F), $ = E[F], R && (_.noTargetGet ? (ee = f(C, F), G = ee && ee.value) : G = C[F]), U = R && G ? G : y[F], !(R && typeof $ == typeof U) && (_.bind && R ? Q = w(U, c) : _.wrap && R ? Q = m(U) : T && h(U) ? Q = w(Function.call, U) : Q = U, (_.sham || U && U.sham || $ && $.sham) && p(Q, "sham", !0), p(E, F, Q), T && (N = x + "Prototype", d(b, N) || p(b, N, {}), p(b[N], F, U), _.real && M && !M[F] && p(M, F, U))); + }; + } + ), + /***/ + 6192: ( + /***/ + function(s) { + s.exports = function(l) { + try { + return !!l(); + } catch (u) { + return !0; + } + }; + } + ), + /***/ + 8043: ( + /***/ + function(s, l, u) { + var c = u(6235); + s.exports = function(h, f, v) { + if (c(h), f === void 0) + return h; + switch (v) { + case 0: + return function() { + return h.call(f); + }; + case 1: + return function(b) { + return h.call(f, b); + }; + case 2: + return function(b, w) { + return h.call(f, b, w); + }; + case 3: + return function(b, w, p) { + return h.call(f, b, w, p); + }; + } + return function() { + return h.apply(f, arguments); + }; + }; + } + ), + /***/ + 6782: ( + /***/ + function(s, l, u) { + var c = u(6235), h = u(5744), f = [].slice, v = {}, b = function(w, p, d) { + if (!(p in v)) { + for (var m = [], _ = 0; _ < p; _++) + m[_] = "a[" + _ + "]"; + v[p] = Function("C,a", "return new C(" + m.join(",") + ")"); + } + return v[p](w, d); + }; + s.exports = Function.bind || function(p) { + var d = c(this), m = f.call(arguments, 1), _ = function() { + var x = m.concat(f.call(arguments)); + return this instanceof _ ? b(d, x.length, x) : d.apply(p, x); + }; + return h(d.prototype) && (_.prototype = d.prototype), _; + }; + } + ), + /***/ + 2282: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(4500), f = Function.prototype, v = c && Object.getOwnPropertyDescriptor, b = h(f, "name"), w = b && function() { + }.name === "something", p = b && (!c || c && v(f, "name").configurable); + s.exports = { + EXISTS: b, + PROPER: w, + CONFIGURABLE: p + }; + } + ), + /***/ + 150: ( + /***/ + function(s, l, u) { + var c = u(7545), h = u(8576), f = u(6447), v = function(b) { + return f(b) ? b : void 0; + }; + s.exports = function(b, w) { + return arguments.length < 2 ? v(c[b]) || v(h[b]) : c[b] && c[b][w] || h[b] && h[b][w]; + }; + } + ), + /***/ + 8703: ( + /***/ + function(s, l, u) { + var c = u(4696), h = u(5037), f = u(7771), v = u(8182), b = v("iterator"); + s.exports = function(w) { + if (w != null) + return h(w, b) || h(w, "@@iterator") || f[c(w)]; + }; + } + ), + /***/ + 1669: ( + /***/ + function(s, l, u) { + var c = u(6235), h = u(1138), f = u(8703); + s.exports = function(v, b) { + var w = arguments.length < 2 ? f(v) : b; + if (c(w)) + return h(w.call(v)); + throw TypeError(String(v) + " is not iterable"); + }; + } + ), + /***/ + 5037: ( + /***/ + function(s, l, u) { + var c = u(6235); + s.exports = function(h, f) { + var v = h[f]; + return v == null ? void 0 : c(v); + }; + } + ), + /***/ + 8576: ( + /***/ + function(s, l, u) { + var c = function(h) { + return h && h.Math == Math && h; + }; + s.exports = // eslint-disable-next-line es/no-global-this -- safe + c(typeof globalThis == "object" && globalThis) || c(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe + c(typeof self == "object" && self) || c(typeof u.g == "object" && u.g) || // eslint-disable-next-line no-new-func -- fallback + function() { + return this; + }() || Function("return this")(); + } + ), + /***/ + 4500: ( + /***/ + function(s, l, u) { + var c = u(1795), h = {}.hasOwnProperty; + s.exports = Object.hasOwn || function(v, b) { + return h.call(c(v), b); + }; + } + ), + /***/ + 4535: ( + /***/ + function(s) { + s.exports = {}; + } + ), + /***/ + 3681: ( + /***/ + function(s, l, u) { + var c = u(8576); + s.exports = function(h, f) { + var v = c.console; + v && v.error && (arguments.length === 1 ? v.error(h) : v.error(h, f)); + }; + } + ), + /***/ + 7403: ( + /***/ + function(s, l, u) { + var c = u(150); + s.exports = c("document", "documentElement"); + } + ), + /***/ + 188: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(6192), f = u(7449); + s.exports = !c && !h(function() { + return Object.defineProperty(f("div"), "a", { + get: function() { + return 7; + } + }).a != 7; + }); + } + ), + /***/ + 2202: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(9272), f = "".split; + s.exports = c(function() { + return !Object("z").propertyIsEnumerable(0); + }) ? function(v) { + return h(v) == "String" ? f.call(v, "") : Object(v); + } : Object; + } + ), + /***/ + 9516: ( + /***/ + function(s, l, u) { + var c = u(6447), h = u(6434), f = Function.toString; + c(h.inspectSource) || (h.inspectSource = function(v) { + return f.call(v); + }), s.exports = h.inspectSource; + } + ), + /***/ + 273: ( + /***/ + function(s, l, u) { + var c = u(5744), h = u(8711); + s.exports = function(f, v) { + c(v) && "cause" in v && h(f, "cause", f.cause); + }; + } + ), + /***/ + 3326: ( + /***/ + function(s, l, u) { + var c = u(8921), h = u(8576), f = u(5744), v = u(8711), b = u(4500), w = u(6434), p = u(9766), d = u(4535), m = "Object already initialized", _ = h.WeakMap, y, x, g, S = function(N) { + return g(N) ? x(N) : y(N, {}); + }, T = function(N) { + return function(F) { + var U; + if (!f(F) || (U = x(F)).type !== N) + throw TypeError("Incompatible receiver, " + N + " required"); + return U; + }; + }; + if (c || w.state) { + var C = w.state || (w.state = new _()), E = C.get, M = C.has, P = C.set; + y = function(N, F) { + if (M.call(C, N)) + throw new TypeError(m); + return F.facade = N, P.call(C, N, F), F; + }, x = function(N) { + return E.call(C, N) || {}; + }, g = function(N) { + return M.call(C, N); + }; + } else { + var R = p("state"); + d[R] = !0, y = function(N, F) { + if (b(N, R)) + throw new TypeError(m); + return F.facade = N, v(N, R, F), F; + }, x = function(N) { + return b(N, R) ? N[R] : {}; + }, g = function(N) { + return b(N, R); + }; + } + s.exports = { + set: y, + get: x, + has: g, + enforce: S, + getterFor: T + }; + } + ), + /***/ + 6109: ( + /***/ + function(s, l, u) { + var c = u(8182), h = u(7771), f = c("iterator"), v = Array.prototype; + s.exports = function(b) { + return b !== void 0 && (h.Array === b || v[f] === b); + }; + } + ), + /***/ + 4770: ( + /***/ + function(s, l, u) { + var c = u(9272); + s.exports = Array.isArray || function(f) { + return c(f) == "Array"; + }; + } + ), + /***/ + 6447: ( + /***/ + function(s) { + s.exports = function(l) { + return typeof l == "function"; + }; + } + ), + /***/ + 2091: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(6447), f = u(4696), v = u(150), b = u(9516), w = [], p = v("Reflect", "construct"), d = /^\s*(?:class|function)\b/, m = d.exec, _ = !d.exec(function() { + }), y = function(g) { + if (!h(g)) + return !1; + try { + return p(Object, w, g), !0; + } catch (S) { + return !1; + } + }, x = function(g) { + if (!h(g)) + return !1; + switch (f(g)) { + case "AsyncFunction": + case "GeneratorFunction": + case "AsyncGeneratorFunction": + return !1; + } + return _ || !!m.call(d, b(g)); + }; + s.exports = !p || c(function() { + var g; + return y(y.call) || !y(Object) || !y(function() { + g = !0; + }) || g; + }) ? x : y; + } + ), + /***/ + 9245: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(6447), f = /#|\.prototype\./, v = function(m, _) { + var y = w[b(m)]; + return y == d ? !0 : y == p ? !1 : h(_) ? c(_) : !!_; + }, b = v.normalize = function(m) { + return String(m).replace(f, ".").toLowerCase(); + }, w = v.data = {}, p = v.NATIVE = "N", d = v.POLYFILL = "P"; + s.exports = v; + } + ), + /***/ + 5744: ( + /***/ + function(s, l, u) { + var c = u(6447); + s.exports = function(h) { + return typeof h == "object" ? h !== null : c(h); + }; + } + ), + /***/ + 5546: ( + /***/ + function(s) { + s.exports = !0; + } + ), + /***/ + 3236: ( + /***/ + function(s, l, u) { + var c = u(6447), h = u(150), f = u(615); + s.exports = f ? function(v) { + return typeof v == "symbol"; + } : function(v) { + var b = h("Symbol"); + return c(b) && Object(v) instanceof b; + }; + } + ), + /***/ + 3442: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(6109), f = u(4104), v = u(8043), b = u(1669), w = u(8703), p = u(6639), d = function(m, _) { + this.stopped = m, this.result = _; + }; + s.exports = function(m, _, y) { + var x = y && y.that, g = !!(y && y.AS_ENTRIES), S = !!(y && y.IS_ITERATOR), T = !!(y && y.INTERRUPTED), C = v(_, x, 1 + g + T), E, M, P, R, N, F, U, $ = function(Q) { + return E && p(E, "normal", Q), new d(!0, Q); + }, G = function(Q) { + return g ? (c(Q), T ? C(Q[0], Q[1], $) : C(Q[0], Q[1])) : T ? C(Q, $) : C(Q); + }; + if (S) + E = m; + else { + if (M = w(m), !M) + throw TypeError(String(m) + " is not iterable"); + if (h(M)) { + for (P = 0, R = f(m); R > P; P++) + if (N = G(m[P]), N && N instanceof d) + return N; + return new d(!1); + } + E = b(m, M); + } + for (F = E.next; !(U = F.call(E)).done; ) { + try { + N = G(U.value); + } catch (Q) { + p(E, "throw", Q); + } + if (typeof N == "object" && N && N instanceof d) + return N; + } + return new d(!1); + }; + } + ), + /***/ + 6639: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(5037); + s.exports = function(f, v, b) { + var w, p; + c(f); + try { + if (w = h(f, "return"), !w) { + if (v === "throw") + throw b; + return b; + } + w = w.call(f); + } catch (d) { + p = !0, w = d; + } + if (v === "throw") + throw b; + if (p) + throw w; + return c(w), b; + }; + } + ), + /***/ + 4413: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(6447), f = u(2853), v = u(9341), b = u(9482), w = u(8182), p = u(5546), d = w("iterator"), m = !1, _, y, x; + [].keys && (x = [].keys(), "next" in x ? (y = v(v(x)), y !== Object.prototype && (_ = y)) : m = !0); + var g = _ == null || c(function() { + var S = {}; + return _[d].call(S) !== S; + }); + g ? _ = {} : p && (_ = f(_)), h(_[d]) || b(_, d, function() { + return this; + }), s.exports = { + IteratorPrototype: _, + BUGGY_SAFARI_ITERATORS: m + }; + } + ), + /***/ + 7771: ( + /***/ + function(s) { + s.exports = {}; + } + ), + /***/ + 4104: ( + /***/ + function(s, l, u) { + var c = u(8445); + s.exports = function(h) { + return c(h.length); + }; + } + ), + /***/ + 2950: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(5141).f, f = u(7160).set, v = u(9536), b = u(9347), w = u(5914), p = u(224), d = c.MutationObserver || c.WebKitMutationObserver, m = c.document, _ = c.process, y = c.Promise, x = h(c, "queueMicrotask"), g = x && x.value, S, T, C, E, M, P, R, N; + g || (S = function() { + var F, U; + for (p && (F = _.domain) && F.exit(); T; ) { + U = T.fn, T = T.next; + try { + U(); + } catch ($) { + throw T ? E() : C = void 0, $; + } + } + C = void 0, F && F.enter(); + }, !v && !p && !w && d && m ? (M = !0, P = m.createTextNode(""), new d(S).observe(P, { characterData: !0 }), E = function() { + P.data = M = !M; + }) : !b && y && y.resolve ? (R = y.resolve(void 0), R.constructor = y, N = R.then, E = function() { + N.call(R, S); + }) : p ? E = function() { + _.nextTick(S); + } : E = function() { + f.call(c, S); + }), s.exports = g || function(F) { + var U = { fn: F, next: void 0 }; + C && (C.next = U), T || (T = U, E()), C = U; + }; + } + ), + /***/ + 4471: ( + /***/ + function(s, l, u) { + var c = u(8576); + s.exports = c.Promise; + } + ), + /***/ + 3045: ( + /***/ + function(s, l, u) { + var c = u(4218), h = u(6192); + s.exports = !!Object.getOwnPropertySymbols && !h(function() { + var f = Symbol(); + return !String(f) || !(Object(f) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + !Symbol.sham && c && c < 41; + }); + } + ), + /***/ + 4551: ( + /***/ + function(s, l, u) { + var c = u(6192), h = u(8182), f = u(5546), v = h("iterator"); + s.exports = !c(function() { + var b = new URL("b?a=1&b=2&c=3", "http://a"), w = b.searchParams, p = ""; + return b.pathname = "c%20d", w.forEach(function(d, m) { + w.delete("b"), p += m + d; + }), f && !b.toJSON || !w.sort || b.href !== "http://a/c%20d?a=1&c=3" || w.get("c") !== "3" || String(new URLSearchParams("?a=1")) !== "a=1" || !w[v] || new URL("https://a@b").username !== "a" || new URLSearchParams(new URLSearchParams("a=b")).get("a") !== "b" || new URL("http://тест").host !== "xn--e1aybc" || new URL("http://a#б").hash !== "#%D0%B1" || p !== "a1c3" || new URL("http://x", void 0).host !== "x"; + }); + } + ), + /***/ + 8921: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(6447), f = u(9516), v = c.WeakMap; + s.exports = h(v) && /native code/.test(f(v)); + } + ), + /***/ + 9438: ( + /***/ + function(s, l, u) { + var c = u(6235), h = function(f) { + var v, b; + this.promise = new f(function(w, p) { + if (v !== void 0 || b !== void 0) + throw TypeError("Bad Promise constructor"); + v = w, b = p; + }), this.resolve = c(v), this.reject = c(b); + }; + s.exports.f = function(f) { + return new h(f); + }; + } + ), + /***/ + 15: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(6192), f = u(4845), v = u(4277).trim, b = u(1450), w = c.parseFloat, p = c.Symbol, d = p && p.iterator, m = 1 / w(b + "-0") !== -1 / 0 || d && !h(function() { + w(Object(d)); + }); + s.exports = m ? function(y) { + var x = v(f(y)), g = w(x); + return g === 0 && x.charAt(0) == "-" ? -0 : g; + } : w; + } + ), + /***/ + 2558: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(6192), f = u(4845), v = u(4277).trim, b = u(1450), w = c.parseInt, p = c.Symbol, d = p && p.iterator, m = /^[+-]?0[Xx]/, _ = w(b + "08") !== 8 || w(b + "0x16") !== 22 || d && !h(function() { + w(Object(d)); + }); + s.exports = _ ? function(x, g) { + var S = v(f(x)); + return w(S, g >>> 0 || (m.test(S) ? 16 : 10)); + } : w; + } + ), + /***/ + 2503: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(6192), f = u(7653), v = u(4750), b = u(6007), w = u(1795), p = u(2202), d = Object.assign, m = Object.defineProperty; + s.exports = !d || h(function() { + if (c && d({ b: 1 }, d(m({}, "a", { + enumerable: !0, + get: function() { + m(this, "b", { + value: 3, + enumerable: !1 + }); + } + }), { b: 2 })).b !== 1) + return !0; + var _ = {}, y = {}, x = Symbol(), g = "abcdefghijklmnopqrst"; + return _[x] = 7, g.split("").forEach(function(S) { + y[S] = S; + }), d({}, _)[x] != 7 || f(d({}, y)).join("") != g; + }) ? function(y, x) { + for (var g = w(y), S = arguments.length, T = 1, C = v.f, E = b.f; S > T; ) + for (var M = p(arguments[T++]), P = C ? f(M).concat(C(M)) : f(M), R = P.length, N = 0, F; R > N; ) + F = P[N++], (!c || E.call(M, F)) && (g[F] = M[F]); + return g; + } : d; + } + ), + /***/ + 2853: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(1187), f = u(2952), v = u(4535), b = u(7403), w = u(7449), p = u(9766), d = ">", m = "<", _ = "prototype", y = "script", x = p("IE_PROTO"), g = function() { + }, S = function(P) { + return m + y + d + P + m + "/" + y + d; + }, T = function(P) { + P.write(S("")), P.close(); + var R = P.parentWindow.Object; + return P = null, R; + }, C = function() { + var P = w("iframe"), R = "java" + y + ":", N; + return P.style.display = "none", b.appendChild(P), P.src = String(R), N = P.contentWindow.document, N.open(), N.write(S("document.F=Object")), N.close(), N.F; + }, E, M = function() { + try { + E = new ActiveXObject("htmlfile"); + } catch (R) { + } + M = typeof document != "undefined" ? document.domain && E ? T(E) : C() : T(E); + for (var P = f.length; P--; ) + delete M[_][f[P]]; + return M(); + }; + v[x] = !0, s.exports = Object.create || function(R, N) { + var F; + return R !== null ? (g[_] = c(R), F = new g(), g[_] = null, F[x] = R) : F = M(), N === void 0 ? F : h(F, N); + }; + } + ), + /***/ + 1187: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(2760), f = u(1138), v = u(7653); + s.exports = c ? Object.defineProperties : function(w, p) { + f(w); + for (var d = v(p), m = d.length, _ = 0, y; m > _; ) + h.f(w, y = d[_++], p[y]); + return w; + }; + } + ), + /***/ + 2760: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(188), f = u(1138), v = u(77), b = Object.defineProperty; + l.f = c ? b : function(p, d, m) { + if (f(p), d = v(d), f(m), h) + try { + return b(p, d, m); + } catch (_) { + } + if ("get" in m || "set" in m) + throw TypeError("Accessors not supported"); + return "value" in m && (p[d] = m.value), p; + }; + } + ), + /***/ + 5141: ( + /***/ + function(s, l, u) { + var c = u(69), h = u(6007), f = u(774), v = u(101), b = u(77), w = u(4500), p = u(188), d = Object.getOwnPropertyDescriptor; + l.f = c ? d : function(_, y) { + if (_ = v(_), y = b(y), p) + try { + return d(_, y); + } catch (x) { + } + if (w(_, y)) + return f(!h.f.call(_, y), _[y]); + }; + } + ), + /***/ + 4052: ( + /***/ + function(s, l, u) { + var c = u(101), h = u(2092).f, f = {}.toString, v = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], b = function(w) { + try { + return h(w); + } catch (p) { + return v.slice(); + } + }; + s.exports.f = function(p) { + return v && f.call(p) == "[object Window]" ? b(p) : h(c(p)); + }; + } + ), + /***/ + 2092: ( + /***/ + function(s, l, u) { + var c = u(7934), h = u(2952), f = h.concat("length", "prototype"); + l.f = Object.getOwnPropertyNames || function(b) { + return c(b, f); + }; + } + ), + /***/ + 4750: ( + /***/ + function(s, l) { + l.f = Object.getOwnPropertySymbols; + } + ), + /***/ + 9341: ( + /***/ + function(s, l, u) { + var c = u(4500), h = u(6447), f = u(1795), v = u(9766), b = u(4635), w = v("IE_PROTO"), p = Object.prototype; + s.exports = b ? Object.getPrototypeOf : function(d) { + var m = f(d); + if (c(m, w)) + return m[w]; + var _ = m.constructor; + return h(_) && m instanceof _ ? _.prototype : m instanceof Object ? p : null; + }; + } + ), + /***/ + 7934: ( + /***/ + function(s, l, u) { + var c = u(4500), h = u(101), f = u(8180).indexOf, v = u(4535); + s.exports = function(b, w) { + var p = h(b), d = 0, m = [], _; + for (_ in p) + !c(v, _) && c(p, _) && m.push(_); + for (; w.length > d; ) + c(p, _ = w[d++]) && (~f(m, _) || m.push(_)); + return m; + }; + } + ), + /***/ + 7653: ( + /***/ + function(s, l, u) { + var c = u(7934), h = u(2952); + s.exports = Object.keys || function(v) { + return c(v, h); + }; + } + ), + /***/ + 6007: ( + /***/ + function(s, l) { + var u = {}.propertyIsEnumerable, c = Object.getOwnPropertyDescriptor, h = c && !u.call({ 1: 2 }, 1); + l.f = h ? function(v) { + var b = c(this, v); + return !!b && b.enumerable; + } : u; + } + ), + /***/ + 4469: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(7757); + s.exports = Object.setPrototypeOf || ("__proto__" in {} ? function() { + var f = !1, v = {}, b; + try { + b = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set, b.call(v, []), f = v instanceof Array; + } catch (w) { + } + return function(p, d) { + return c(p), h(d), f ? b.call(p, d) : p.__proto__ = d, p; + }; + }() : void 0); + } + ), + /***/ + 158: ( + /***/ + function(s, l, u) { + var c = u(3471), h = u(4696); + s.exports = c ? {}.toString : function() { + return "[object " + h(this) + "]"; + }; + } + ), + /***/ + 380: ( + /***/ + function(s, l, u) { + var c = u(6447), h = u(5744); + s.exports = function(f, v) { + var b, w; + if (v === "string" && c(b = f.toString) && !h(w = b.call(f)) || c(b = f.valueOf) && !h(w = b.call(f)) || v !== "string" && c(b = f.toString) && !h(w = b.call(f))) + return w; + throw TypeError("Can't convert object to primitive value"); + }; + } + ), + /***/ + 7545: ( + /***/ + function(s) { + s.exports = {}; + } + ), + /***/ + 892: ( + /***/ + function(s) { + s.exports = function(l) { + try { + return { error: !1, value: l() }; + } catch (u) { + return { error: !0, value: u }; + } + }; + } + ), + /***/ + 9126: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(5744), f = u(9438); + s.exports = function(v, b) { + if (c(v), h(b) && b.constructor === v) + return b; + var w = f.f(v), p = w.resolve; + return p(b), w.promise; + }; + } + ), + /***/ + 533: ( + /***/ + function(s, l, u) { + var c = u(9482); + s.exports = function(h, f, v) { + for (var b in f) + v && v.unsafe && h[b] ? h[b] = f[b] : c(h, b, f[b], v); + return h; + }; + } + ), + /***/ + 9482: ( + /***/ + function(s, l, u) { + var c = u(8711); + s.exports = function(h, f, v, b) { + b && b.enumerable ? h[f] = v : c(h, f, v); + }; + } + ), + /***/ + 3209: ( + /***/ + function(s) { + s.exports = function(l) { + if (l == null) + throw TypeError("Can't call method on " + l); + return l; + }; + } + ), + /***/ + 7613: ( + /***/ + function(s, l, u) { + var c = u(8576); + s.exports = function(h, f) { + try { + Object.defineProperty(c, h, { value: f, configurable: !0, writable: !0 }); + } catch (v) { + c[h] = f; + } + return f; + }; + } + ), + /***/ + 3656: ( + /***/ + function(s, l, u) { + var c = u(150), h = u(2760), f = u(8182), v = u(69), b = f("species"); + s.exports = function(w) { + var p = c(w), d = h.f; + v && p && !p[b] && d(p, b, { + configurable: !0, + get: function() { + return this; + } + }); + }; + } + ), + /***/ + 1284: ( + /***/ + function(s, l, u) { + var c = u(3471), h = u(2760).f, f = u(8711), v = u(4500), b = u(158), w = u(8182), p = w("toStringTag"); + s.exports = function(d, m, _, y) { + if (d) { + var x = _ ? d : d.prototype; + v(x, p) || h(x, p, { configurable: !0, value: m }), y && !c && f(x, "toString", b); + } + }; + } + ), + /***/ + 9766: ( + /***/ + function(s, l, u) { + var c = u(8717), h = u(2759), f = c("keys"); + s.exports = function(v) { + return f[v] || (f[v] = h(v)); + }; + } + ), + /***/ + 6434: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(7613), f = "__core-js_shared__", v = c[f] || h(f, {}); + s.exports = v; + } + ), + /***/ + 8717: ( + /***/ + function(s, l, u) { + var c = u(5546), h = u(6434); + (s.exports = function(f, v) { + return h[f] || (h[f] = v !== void 0 ? v : {}); + })("versions", []).push({ + version: "3.18.2", + mode: c ? "pure" : "global", + copyright: "© 2021 Denis Pushkarev (zloirock.ru)" + }); + } + ), + /***/ + 4743: ( + /***/ + function(s, l, u) { + var c = u(1138), h = u(1404), f = u(8182), v = f("species"); + s.exports = function(b, w) { + var p = c(b).constructor, d; + return p === void 0 || (d = c(p)[v]) == null ? w : h(d); + }; + } + ), + /***/ + 863: ( + /***/ + function(s, l, u) { + var c = u(1941), h = u(4845), f = u(3209), v = function(b) { + return function(w, p) { + var d = h(f(w)), m = c(p), _ = d.length, y, x; + return m < 0 || m >= _ ? b ? "" : void 0 : (y = d.charCodeAt(m), y < 55296 || y > 56319 || m + 1 === _ || (x = d.charCodeAt(m + 1)) < 56320 || x > 57343 ? b ? d.charAt(m) : y : b ? d.slice(m, m + 2) : (y - 55296 << 10) + (x - 56320) + 65536); + }; + }; + s.exports = { + // `String.prototype.codePointAt` method + // https://tc39.es/ecma262/#sec-string.prototype.codepointat + codeAt: v(!1), + // `String.prototype.at` method + // https://github.com/mathiasbynens/String.prototype.at + charAt: v(!0) + }; + } + ), + /***/ + 7977: ( + /***/ + function(s) { + var l = 2147483647, u = 36, c = 1, h = 26, f = 38, v = 700, b = 72, w = 128, p = "-", d = /[^\0-\u007E]/, m = /[.\u3002\uFF0E\uFF61]/g, _ = "Overflow: input needs wider integers to process", y = u - c, x = Math.floor, g = String.fromCharCode, S = function(M) { + for (var P = [], R = 0, N = M.length; R < N; ) { + var F = M.charCodeAt(R++); + if (F >= 55296 && F <= 56319 && R < N) { + var U = M.charCodeAt(R++); + (U & 64512) == 56320 ? P.push(((F & 1023) << 10) + (U & 1023) + 65536) : (P.push(F), R--); + } else + P.push(F); + } + return P; + }, T = function(M) { + return M + 22 + 75 * (M < 26); + }, C = function(M, P, R) { + var N = 0; + for (M = R ? x(M / v) : M >> 1, M += x(M / P); M > y * h >> 1; N += u) + M = x(M / y); + return x(N + (y + 1) * M / (M + f)); + }, E = function(M) { + var P = []; + M = S(M); + var R = M.length, N = w, F = 0, U = b, $, G; + for ($ = 0; $ < M.length; $++) + G = M[$], G < 128 && P.push(g(G)); + var Q = P.length, ee = Q; + for (Q && P.push(p); ee < R; ) { + var ce = l; + for ($ = 0; $ < M.length; $++) + G = M[$], G >= N && G < ce && (ce = G); + var ne = ee + 1; + if (ce - N > x((l - F) / ne)) + throw RangeError(_); + for (F += (ce - N) * ne, N = ce, $ = 0; $ < M.length; $++) { + if (G = M[$], G < N && ++F > l) + throw RangeError(_); + if (G == N) { + for (var fe = F, K = u; ; K += u) { + var Oe = K <= U ? c : K >= U + h ? h : K - U; + if (fe < Oe) + break; + var xe = fe - Oe, Ge = u - Oe; + P.push(g(T(Oe + xe % Ge))), fe = x(xe / Ge); + } + P.push(g(T(fe))), U = C(F, ne, ee == Q), F = 0, ++ee; + } + } + ++F, ++N; + } + return P.join(""); + }; + s.exports = function(M) { + var P = [], R = M.toLowerCase().replace(m, ".").split("."), N, F; + for (N = 0; N < R.length; N++) + F = R[N], P.push(d.test(F) ? "xn--" + E(F) : F); + return P.join("."); + }; + } + ), + /***/ + 6815: ( + /***/ + function(s, l, u) { + var c = u(2282).PROPER, h = u(6192), f = u(1450), v = "​…᠎"; + s.exports = function(b) { + return h(function() { + return !!f[b]() || v[b]() !== v || c && f[b].name !== b; + }); + }; + } + ), + /***/ + 4277: ( + /***/ + function(s, l, u) { + var c = u(3209), h = u(4845), f = u(1450), v = "[" + f + "]", b = RegExp("^" + v + v + "*"), w = RegExp(v + v + "*$"), p = function(d) { + return function(m) { + var _ = h(c(m)); + return d & 1 && (_ = _.replace(b, "")), d & 2 && (_ = _.replace(w, "")), _; + }; + }; + s.exports = { + // `String.prototype.{ trimLeft, trimStart }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimstart + start: p(1), + // `String.prototype.{ trimRight, trimEnd }` methods + // https://tc39.es/ecma262/#sec-string.prototype.trimend + end: p(2), + // `String.prototype.trim` method + // https://tc39.es/ecma262/#sec-string.prototype.trim + trim: p(3) + }; + } + ), + /***/ + 7160: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(6447), f = u(6192), v = u(8043), b = u(7403), w = u(7449), p = u(9536), d = u(224), m = c.setImmediate, _ = c.clearImmediate, y = c.process, x = c.MessageChannel, g = c.Dispatch, S = 0, T = {}, C = "onreadystatechange", E, M, P, R; + try { + E = c.location; + } catch (G) { + } + var N = function(G) { + if (T.hasOwnProperty(G)) { + var Q = T[G]; + delete T[G], Q(); + } + }, F = function(G) { + return function() { + N(G); + }; + }, U = function(G) { + N(G.data); + }, $ = function(G) { + c.postMessage(String(G), E.protocol + "//" + E.host); + }; + (!m || !_) && (m = function(Q) { + for (var ee = [], ce = arguments.length, ne = 1; ce > ne; ) + ee.push(arguments[ne++]); + return T[++S] = function() { + (h(Q) ? Q : Function(Q)).apply(void 0, ee); + }, M(S), S; + }, _ = function(Q) { + delete T[Q]; + }, d ? M = function(G) { + y.nextTick(F(G)); + } : g && g.now ? M = function(G) { + g.now(F(G)); + } : x && !p ? (P = new x(), R = P.port2, P.port1.onmessage = U, M = v(R.postMessage, R, 1)) : c.addEventListener && h(c.postMessage) && !c.importScripts && E && E.protocol !== "file:" && !f($) ? (M = $, c.addEventListener("message", U, !1)) : C in w("script") ? M = function(G) { + b.appendChild(w("script"))[C] = function() { + b.removeChild(this), N(G); + }; + } : M = function(G) { + setTimeout(F(G), 0); + }), s.exports = { + set: m, + clear: _ + }; + } + ), + /***/ + 7739: ( + /***/ + function(s, l, u) { + var c = u(1941), h = Math.max, f = Math.min; + s.exports = function(v, b) { + var w = c(v); + return w < 0 ? h(w + b, 0) : f(w, b); + }; + } + ), + /***/ + 101: ( + /***/ + function(s, l, u) { + var c = u(2202), h = u(3209); + s.exports = function(f) { + return c(h(f)); + }; + } + ), + /***/ + 1941: ( + /***/ + function(s) { + var l = Math.ceil, u = Math.floor; + s.exports = function(c) { + var h = +c; + return h !== h || h === 0 ? 0 : (h > 0 ? u : l)(h); + }; + } + ), + /***/ + 8445: ( + /***/ + function(s, l, u) { + var c = u(1941), h = Math.min; + s.exports = function(f) { + return f > 0 ? h(c(f), 9007199254740991) : 0; + }; + } + ), + /***/ + 1795: ( + /***/ + function(s, l, u) { + var c = u(3209); + s.exports = function(h) { + return Object(c(h)); + }; + } + ), + /***/ + 7888: ( + /***/ + function(s, l, u) { + var c = u(5744), h = u(3236), f = u(5037), v = u(380), b = u(8182), w = b("toPrimitive"); + s.exports = function(p, d) { + if (!c(p) || h(p)) + return p; + var m = f(p, w), _; + if (m) { + if (d === void 0 && (d = "default"), _ = m.call(p, d), !c(_) || h(_)) + return _; + throw TypeError("Can't convert object to primitive value"); + } + return d === void 0 && (d = "number"), v(p, d); + }; + } + ), + /***/ + 77: ( + /***/ + function(s, l, u) { + var c = u(7888), h = u(3236); + s.exports = function(f) { + var v = c(f, "string"); + return h(v) ? v : String(v); + }; + } + ), + /***/ + 3471: ( + /***/ + function(s, l, u) { + var c = u(8182), h = c("toStringTag"), f = {}; + f[h] = "z", s.exports = String(f) === "[object z]"; + } + ), + /***/ + 4845: ( + /***/ + function(s, l, u) { + var c = u(4696); + s.exports = function(h) { + if (c(h) === "Symbol") + throw TypeError("Cannot convert a Symbol value to a string"); + return String(h); + }; + } + ), + /***/ + 9288: ( + /***/ + function(s) { + s.exports = function(l) { + try { + return String(l); + } catch (u) { + return "Object"; + } + }; + } + ), + /***/ + 2759: ( + /***/ + function(s) { + var l = 0, u = Math.random(); + s.exports = function(c) { + return "Symbol(" + String(c === void 0 ? "" : c) + ")_" + (++l + u).toString(36); + }; + } + ), + /***/ + 615: ( + /***/ + function(s, l, u) { + var c = u(3045); + s.exports = c && !Symbol.sham && typeof Symbol.iterator == "symbol"; + } + ), + /***/ + 9207: ( + /***/ + function(s, l, u) { + var c = u(8182); + l.f = c; + } + ), + /***/ + 8182: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(8717), f = u(4500), v = u(2759), b = u(3045), w = u(615), p = h("wks"), d = c.Symbol, m = w ? d : d && d.withoutSetter || v; + s.exports = function(_) { + return (!f(p, _) || !(b || typeof p[_] == "string")) && (b && f(d, _) ? p[_] = d[_] : p[_] = m("Symbol." + _)), p[_]; + }; + } + ), + /***/ + 1450: ( + /***/ + function(s) { + s.exports = ` +\v\f\r                 \u2028\u2029\uFEFF`; + } + ), + /***/ + 4242: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(9341), f = u(4469), v = u(2853), b = u(8711), w = u(774), p = u(273), d = u(3442), m = u(4845), _ = function(x, g) { + var S = this, T = arguments.length > 2 ? arguments[2] : void 0; + if (!(S instanceof _)) + return new _(x, g, T); + f && (S = f(new Error(void 0), h(S))), g !== void 0 && b(S, "message", m(g)), p(S, T); + var C = []; + return d(x, C.push, { that: C }), b(S, "errors", C), S; + }; + _.prototype = v(Error.prototype, { + constructor: w(5, _), + message: w(5, ""), + name: w(5, "AggregateError") + }), c({ global: !0 }, { + AggregateError: _ + }); + } + ), + /***/ + 9106: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(6192), f = u(4770), v = u(5744), b = u(1795), w = u(4104), p = u(9361), d = u(1321), m = u(242), _ = u(8182), y = u(4218), x = _("isConcatSpreadable"), g = 9007199254740991, S = "Maximum allowed index exceeded", T = y >= 51 || !h(function() { + var P = []; + return P[x] = !1, P.concat()[0] !== P; + }), C = m("concat"), E = function(P) { + if (!v(P)) + return !1; + var R = P[x]; + return R !== void 0 ? !!R : f(P); + }, M = !T || !C; + c({ target: "Array", proto: !0, forced: M }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + concat: function(R) { + var N = b(this), F = d(N, 0), U = 0, $, G, Q, ee, ce; + for ($ = -1, Q = arguments.length; $ < Q; $++) + if (ce = $ === -1 ? N : arguments[$], E(ce)) { + if (ee = w(ce), U + ee > g) + throw TypeError(S); + for (G = 0; G < ee; G++, U++) + G in ce && p(F, U, ce[G]); + } else { + if (U >= g) + throw TypeError(S); + p(F, U++, ce); + } + return F.length = U, F; + } + }); + } + ), + /***/ + 1710: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(2724), f = u(7423); + c({ target: "Array", proto: !0 }, { + fill: h + }), f("fill"); + } + ), + /***/ + 3436: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(454).filter, f = u(242), v = f("filter"); + c({ target: "Array", proto: !0, forced: !v }, { + filter: function(w) { + return h(this, w, arguments.length > 1 ? arguments[1] : void 0); + } + }); + } + ), + /***/ + 9823: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(7397); + c({ target: "Array", proto: !0, forced: [].forEach != h }, { + forEach: h + }); + } + ), + /***/ + 9173: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(841), f = u(9770), v = !f(function(b) { + Array.from(b); + }); + c({ target: "Array", stat: !0, forced: v }, { + from: h + }); + } + ), + /***/ + 2276: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(8180).indexOf, f = u(424), v = [].indexOf, b = !!v && 1 / [1].indexOf(1, -0) < 0, w = f("indexOf"); + c({ target: "Array", proto: !0, forced: b || !w }, { + indexOf: function(d) { + return b ? v.apply(this, arguments) || 0 : h(this, d, arguments.length > 1 ? arguments[1] : void 0); + } + }); + } + ), + /***/ + 8118: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(4770); + c({ target: "Array", stat: !0 }, { + isArray: h + }); + } + ), + /***/ + 8939: ( + /***/ + function(s, l, u) { + var c = u(101), h = u(7423), f = u(7771), v = u(3326), b = u(7218), w = "Array Iterator", p = v.set, d = v.getterFor(w); + s.exports = b(Array, "Array", function(m, _) { + p(this, { + type: w, + target: c(m), + // target + index: 0, + // next index + kind: _ + // kind + }); + }, function() { + var m = d(this), _ = m.target, y = m.kind, x = m.index++; + return !_ || x >= _.length ? (m.target = void 0, { value: void 0, done: !0 }) : y == "keys" ? { value: x, done: !1 } : y == "values" ? { value: _[x], done: !1 } : { value: [x, _[x]], done: !1 }; + }, "values"), f.Arguments = f.Array, h("keys"), h("values"), h("entries"); + } + ), + /***/ + 3838: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(454).map, f = u(242), v = f("map"); + c({ target: "Array", proto: !0, forced: !v }, { + map: function(w) { + return h(this, w, arguments.length > 1 ? arguments[1] : void 0); + } + }); + } + ), + /***/ + 5818: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(4770), f = u(2091), v = u(5744), b = u(7739), w = u(4104), p = u(101), d = u(9361), m = u(8182), _ = u(242), y = _("slice"), x = m("species"), g = [].slice, S = Math.max; + c({ target: "Array", proto: !0, forced: !y }, { + slice: function(C, E) { + var M = p(this), P = w(M), R = b(C, P), N = b(E === void 0 ? P : E, P), F, U, $; + if (h(M) && (F = M.constructor, f(F) && (F === Array || h(F.prototype)) ? F = void 0 : v(F) && (F = F[x], F === null && (F = void 0)), F === Array || F === void 0)) + return g.call(M, R, N); + for (U = new (F === void 0 ? Array : F)(S(N - R, 0)), $ = 0; R < N; R++, $++) + R in M && d(U, $, M[R]); + return U.length = $, U; + } + }); + } + ), + /***/ + 2178: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(7739), f = u(1941), v = u(4104), b = u(1795), w = u(1321), p = u(9361), d = u(242), m = d("splice"), _ = Math.max, y = Math.min, x = 9007199254740991, g = "Maximum allowed length exceeded"; + c({ target: "Array", proto: !0, forced: !m }, { + splice: function(T, C) { + var E = b(this), M = v(E), P = h(T, M), R = arguments.length, N, F, U, $, G, Q; + if (R === 0 ? N = F = 0 : R === 1 ? (N = 0, F = M - P) : (N = R - 2, F = y(_(f(C), 0), M - P)), M + N - F > x) + throw TypeError(g); + for (U = w(E, F), $ = 0; $ < F; $++) + G = P + $, G in E && p(U, $, E[G]); + if (U.length = F, N < F) { + for ($ = P; $ < M - F; $++) + G = $ + F, Q = $ + N, G in E ? E[Q] = E[G] : delete E[Q]; + for ($ = M; $ > M - F + N; $--) + delete E[$ - 1]; + } else if (N > F) + for ($ = M - F; $ > P; $--) + G = $ + F - 1, Q = $ + N - 1, G in E ? E[Q] = E[G] : delete E[Q]; + for ($ = 0; $ < N; $++) + E[$ + P] = arguments[$ + 2]; + return E.length = M - F + N, U; + } + }); + } + ), + /***/ + 665: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(6782); + c({ target: "Function", proto: !0 }, { + bind: h + }); + } + ), + /***/ + 8671: ( + /***/ + function(s, l, u) { + var c = u(8576), h = u(1284); + h(c.JSON, "JSON", !0); + } + ), + /***/ + 8556: ( + /***/ + function() { + } + ), + /***/ + 2666: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(2558); + c({ target: "Number", stat: !0, forced: Number.parseInt != h }, { + parseInt: h + }); + } + ), + /***/ + 3113: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(69), f = u(2853); + c({ target: "Object", stat: !0, sham: !h }, { + create: f + }); + } + ), + /***/ + 297: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(69), f = u(2760); + c({ target: "Object", stat: !0, forced: !h, sham: !h }, { + defineProperty: f.f + }); + } + ), + /***/ + 9234: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(6192), f = u(1795), v = u(9341), b = u(4635), w = h(function() { + v(1); + }); + c({ target: "Object", stat: !0, forced: w, sham: !b }, { + getPrototypeOf: function(d) { + return v(f(d)); + } + }); + } + ), + /***/ + 2647: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(1795), f = u(7653), v = u(6192), b = v(function() { + f(1); + }); + c({ target: "Object", stat: !0, forced: b }, { + keys: function(p) { + return f(h(p)); + } + }); + } + ), + /***/ + 3222: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(4469); + c({ target: "Object", stat: !0 }, { + setPrototypeOf: h + }); + } + ), + /***/ + 6663: ( + /***/ + function() { + } + ), + /***/ + 4859: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(15); + c({ global: !0, forced: parseFloat != h }, { + parseFloat: h + }); + } + ), + /***/ + 5706: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(2558); + c({ global: !0, forced: parseInt != h }, { + parseInt: h + }); + } + ), + /***/ + 7884: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(6235), f = u(9438), v = u(892), b = u(3442); + c({ target: "Promise", stat: !0 }, { + allSettled: function(p) { + var d = this, m = f.f(d), _ = m.resolve, y = m.reject, x = v(function() { + var g = h(d.resolve), S = [], T = 0, C = 1; + b(p, function(E) { + var M = T++, P = !1; + S.push(void 0), C++, g.call(d, E).then(function(R) { + P || (P = !0, S[M] = { status: "fulfilled", value: R }, --C || _(S)); + }, function(R) { + P || (P = !0, S[M] = { status: "rejected", reason: R }, --C || _(S)); + }); + }), --C || _(S); + }); + return x.error && y(x.value), m.promise; + } + }); + } + ), + /***/ + 8885: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(6235), f = u(150), v = u(9438), b = u(892), w = u(3442), p = "No one promise resolved"; + c({ target: "Promise", stat: !0 }, { + any: function(m) { + var _ = this, y = v.f(_), x = y.resolve, g = y.reject, S = b(function() { + var T = h(_.resolve), C = [], E = 0, M = 1, P = !1; + w(m, function(R) { + var N = E++, F = !1; + C.push(void 0), M++, T.call(_, R).then(function(U) { + F || P || (P = !0, x(U)); + }, function(U) { + F || P || (F = !0, C[N] = U, --M || g(new (f("AggregateError"))(C, p))); + }); + }), --M || g(new (f("AggregateError"))(C, p)); + }); + return S.error && g(S.value), y.promise; + } + }); + } + ), + /***/ + 1868: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(5546), f = u(4471), v = u(6192), b = u(150), w = u(6447), p = u(4743), d = u(9126), m = u(9482), _ = !!f && v(function() { + f.prototype.finally.call({ then: function() { + } }, function() { + }); + }); + if (c({ target: "Promise", proto: !0, real: !0, forced: _ }, { + finally: function(x) { + var g = p(this, b("Promise")), S = w(x); + return this.then( + S ? function(T) { + return d(g, x()).then(function() { + return T; + }); + } : x, + S ? function(T) { + return d(g, x()).then(function() { + throw T; + }); + } : x + ); + } + }), !h && w(f)) { + var y = b("Promise").prototype.finally; + f.prototype.finally !== y && m(f.prototype, "finally", y, { unsafe: !0 }); + } + } + ), + /***/ + 9021: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(5546), f = u(8576), v = u(150), b = u(4471), w = u(9482), p = u(533), d = u(4469), m = u(1284), _ = u(3656), y = u(6235), x = u(6447), g = u(5744), S = u(6961), T = u(9516), C = u(3442), E = u(9770), M = u(4743), P = u(7160).set, R = u(2950), N = u(9126), F = u(3681), U = u(9438), $ = u(892), G = u(3326), Q = u(9245), ee = u(8182), ce = u(2957), ne = u(224), fe = u(4218), K = ee("species"), Oe = "Promise", xe = G.get, Ge = G.set, oe = G.getterFor(Oe), de = b && b.prototype, se = b, te = de, pe = f.TypeError, re = f.document, ae = f.process, le = U.f, ue = le, Ae = !!(re && re.createEvent && f.dispatchEvent), Te = x(f.PromiseRejectionEvent), Ne = "unhandledrejection", He = "rejectionhandled", je = 0, be = 1, ge = 2, _e = 1, we = 2, Ie = !1, Me, et, yt, vt, ze = Q(Oe, function() { + var qe = T(se), Xe = qe !== String(se); + if (!Xe && fe === 66 || h && !te.finally) + return !0; + if (fe >= 51 && /native code/.test(qe)) + return !1; + var Ze = new se(function(tt) { + tt(1); + }), st = function(tt) { + tt(function() { + }, function() { + }); + }, St = Ze.constructor = {}; + return St[K] = st, Ie = Ze.then(function() { + }) instanceof st, Ie ? !Xe && ce && !Te : !0; + }), bt = ze || !E(function(qe) { + se.all(qe).catch(function() { + }); + }), _t = function(qe) { + var Xe; + return g(qe) && x(Xe = qe.then) ? Xe : !1; + }, $t = function(qe, Xe) { + if (!qe.notified) { + qe.notified = !0; + var Ze = qe.reactions; + R(function() { + for (var st = qe.value, St = qe.state == be, tt = 0; Ze.length > tt; ) { + var Vr = Ze[tt++], cn = St ? Vr.ok : Vr.fail, ct = Vr.resolve, Re = Vr.reject, Br = Vr.domain, dr, ur, wn; + try { + cn ? (St || (qe.rejection === we && or(qe), qe.rejection = _e), cn === !0 ? dr = st : (Br && Br.enter(), dr = cn(st), Br && (Br.exit(), wn = !0)), dr === Vr.promise ? Re(pe("Promise-chain cycle")) : (ur = _t(dr)) ? ur.call(dr, ct, Re) : ct(dr)) : Re(st); + } catch (vr) { + Br && !wn && Br.exit(), Re(vr); + } + } + qe.reactions = [], qe.notified = !1, Xe && !qe.rejection && _r(qe); + }); + } + }, fr = function(qe, Xe, Ze) { + var st, St; + Ae ? (st = re.createEvent("Event"), st.promise = Xe, st.reason = Ze, st.initEvent(qe, !1, !0), f.dispatchEvent(st)) : st = { promise: Xe, reason: Ze }, !Te && (St = f["on" + qe]) ? St(st) : qe === Ne && F("Unhandled promise rejection", Ze); + }, _r = function(qe) { + P.call(f, function() { + var Xe = qe.facade, Ze = qe.value, st = ar(qe), St; + if (st && (St = $(function() { + ne ? ae.emit("unhandledRejection", Ze, Xe) : fr(Ne, Xe, Ze); + }), qe.rejection = ne || ar(qe) ? we : _e, St.error)) + throw St.value; + }); + }, ar = function(qe) { + return qe.rejection !== _e && !qe.parent; + }, or = function(qe) { + P.call(f, function() { + var Xe = qe.facade; + ne ? ae.emit("rejectionHandled", Xe) : fr(He, Xe, qe.value); + }); + }, Tr = function(qe, Xe, Ze) { + return function(st) { + qe(Xe, st, Ze); + }; + }, tn = function(qe, Xe, Ze) { + qe.done || (qe.done = !0, Ze && (qe = Ze), qe.value = Xe, qe.state = ge, $t(qe, !0)); + }, rn = function(qe, Xe, Ze) { + if (!qe.done) { + qe.done = !0, Ze && (qe = Ze); + try { + if (qe.facade === Xe) + throw pe("Promise can't be resolved itself"); + var st = _t(Xe); + st ? R(function() { + var St = { done: !1 }; + try { + st.call( + Xe, + Tr(rn, St, qe), + Tr(tn, St, qe) + ); + } catch (tt) { + tn(St, tt, qe); + } + }) : (qe.value = Xe, qe.state = be, $t(qe, !1)); + } catch (St) { + tn({ done: !1 }, St, qe); + } + } + }; + if (ze && (se = function(Xe) { + S(this, se, Oe), y(Xe), Me.call(this); + var Ze = xe(this); + try { + Xe(Tr(rn, Ze), Tr(tn, Ze)); + } catch (st) { + tn(Ze, st); + } + }, te = se.prototype, Me = function(Xe) { + Ge(this, { + type: Oe, + done: !1, + notified: !1, + parent: !1, + reactions: [], + rejection: !1, + state: je, + value: void 0 + }); + }, Me.prototype = p(te, { + // `Promise.prototype.then` method + // https://tc39.es/ecma262/#sec-promise.prototype.then + then: function(Xe, Ze) { + var st = oe(this), St = le(M(this, se)); + return St.ok = x(Xe) ? Xe : !0, St.fail = x(Ze) && Ze, St.domain = ne ? ae.domain : void 0, st.parent = !0, st.reactions.push(St), st.state != je && $t(st, !1), St.promise; + }, + // `Promise.prototype.catch` method + // https://tc39.es/ecma262/#sec-promise.prototype.catch + catch: function(qe) { + return this.then(void 0, qe); + } + }), et = function() { + var qe = new Me(), Xe = xe(qe); + this.promise = qe, this.resolve = Tr(rn, Xe), this.reject = Tr(tn, Xe); + }, U.f = le = function(qe) { + return qe === se || qe === yt ? new et(qe) : ue(qe); + }, !h && x(b) && de !== Object.prototype)) { + vt = de.then, Ie || (w(de, "then", function(Xe, Ze) { + var st = this; + return new se(function(St, tt) { + vt.call(st, St, tt); + }).then(Xe, Ze); + }, { unsafe: !0 }), w(de, "catch", te.catch, { unsafe: !0 })); + try { + delete de.constructor; + } catch (qe) { + } + d && d(de, te); + } + c({ global: !0, wrap: !0, forced: ze }, { + Promise: se + }), m(se, Oe, !1, !0), _(Oe), yt = v(Oe), c({ target: Oe, stat: !0, forced: ze }, { + // `Promise.reject` method + // https://tc39.es/ecma262/#sec-promise.reject + reject: function(Xe) { + var Ze = le(this); + return Ze.reject.call(void 0, Xe), Ze.promise; + } + }), c({ target: Oe, stat: !0, forced: h || ze }, { + // `Promise.resolve` method + // https://tc39.es/ecma262/#sec-promise.resolve + resolve: function(Xe) { + return N(h && this === yt ? se : this, Xe); + } + }), c({ target: Oe, stat: !0, forced: bt }, { + // `Promise.all` method + // https://tc39.es/ecma262/#sec-promise.all + all: function(Xe) { + var Ze = this, st = le(Ze), St = st.resolve, tt = st.reject, Vr = $(function() { + var cn = y(Ze.resolve), ct = [], Re = 0, Br = 1; + C(Xe, function(dr) { + var ur = Re++, wn = !1; + ct.push(void 0), Br++, cn.call(Ze, dr).then(function(vr) { + wn || (wn = !0, ct[ur] = vr, --Br || St(ct)); + }, tt); + }), --Br || St(ct); + }); + return Vr.error && tt(Vr.value), st.promise; + }, + // `Promise.race` method + // https://tc39.es/ecma262/#sec-promise.race + race: function(Xe) { + var Ze = this, st = le(Ze), St = st.reject, tt = $(function() { + var Vr = y(Ze.resolve); + C(Xe, function(cn) { + Vr.call(Ze, cn).then(st.resolve, St); + }); + }); + return tt.error && St(tt.value), st.promise; + } + }); + } + ), + /***/ + 5397: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(150), f = u(1404), v = u(1138), b = u(5744), w = u(2853), p = u(6782), d = u(6192), m = h("Reflect", "construct"), _ = d(function() { + function g() { + } + return !(m(function() { + }, [], g) instanceof g); + }), y = !d(function() { + m(function() { + }); + }), x = _ || y; + c({ target: "Reflect", stat: !0, forced: x, sham: x }, { + construct: function(S, T) { + f(S), v(T); + var C = arguments.length < 3 ? S : f(arguments[2]); + if (y && !_) + return m(S, T, C); + if (S == C) { + switch (T.length) { + case 0: + return new S(); + case 1: + return new S(T[0]); + case 2: + return new S(T[0], T[1]); + case 3: + return new S(T[0], T[1], T[2]); + case 4: + return new S(T[0], T[1], T[2], T[3]); + } + var E = [null]; + return E.push.apply(E, T), new (p.apply(S, E))(); + } + var M = C.prototype, P = w(b(M) ? M : Object.prototype), R = Function.apply.call(S, P, T); + return b(R) ? R : P; + } + }); + } + ), + /***/ + 1367: ( + /***/ + function() { + } + ), + /***/ + 5454: ( + /***/ + function(s, l, u) { + var c = u(863).charAt, h = u(4845), f = u(3326), v = u(7218), b = "String Iterator", w = f.set, p = f.getterFor(b); + v(String, "String", function(d) { + w(this, { + type: b, + string: h(d), + index: 0 + }); + }, function() { + var m = p(this), _ = m.string, y = m.index, x; + return y >= _.length ? { value: void 0, done: !0 } : (x = c(_, y), m.index += x.length, { value: x, done: !1 }); + }); + } + ), + /***/ + 957: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(4277).trim, f = u(6815); + c({ target: "String", proto: !0, forced: f("trim") }, { + trim: function() { + return h(this); + } + }); + } + ), + /***/ + 9781: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("asyncIterator"); + } + ), + /***/ + 492: ( + /***/ + function() { + } + ), + /***/ + 6681: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("hasInstance"); + } + ), + /***/ + 9594: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("isConcatSpreadable"); + } + ), + /***/ + 3665: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("iterator"); + } + ), + /***/ + 6187: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(8576), f = u(150), v = u(5546), b = u(69), w = u(3045), p = u(6192), d = u(4500), m = u(4770), _ = u(6447), y = u(5744), x = u(3236), g = u(1138), S = u(1795), T = u(101), C = u(77), E = u(4845), M = u(774), P = u(2853), R = u(7653), N = u(2092), F = u(4052), U = u(4750), $ = u(5141), G = u(2760), Q = u(6007), ee = u(9482), ce = u(8717), ne = u(9766), fe = u(4535), K = u(2759), Oe = u(8182), xe = u(9207), Ge = u(1488), oe = u(1284), de = u(3326), se = u(454).forEach, te = ne("hidden"), pe = "Symbol", re = "prototype", ae = Oe("toPrimitive"), le = de.set, ue = de.getterFor(pe), Ae = Object[re], Te = h.Symbol, Ne = f("JSON", "stringify"), He = $.f, je = G.f, be = F.f, ge = Q.f, _e = ce("symbols"), we = ce("op-symbols"), Ie = ce("string-to-symbol-registry"), Me = ce("symbol-to-string-registry"), et = ce("wks"), yt = h.QObject, vt = !yt || !yt[re] || !yt[re].findChild, ze = b && p(function() { + return P(je({}, "a", { + get: function() { + return je(this, "a", { value: 7 }).a; + } + })).a != 7; + }) ? function(qe, Xe, Ze) { + var st = He(Ae, Xe); + st && delete Ae[Xe], je(qe, Xe, Ze), st && qe !== Ae && je(Ae, Xe, st); + } : je, bt = function(qe, Xe) { + var Ze = _e[qe] = P(Te[re]); + return le(Ze, { + type: pe, + tag: qe, + description: Xe + }), b || (Ze.description = Xe), Ze; + }, _t = function(Xe, Ze, st) { + Xe === Ae && _t(we, Ze, st), g(Xe); + var St = C(Ze); + return g(st), d(_e, St) ? (st.enumerable ? (d(Xe, te) && Xe[te][St] && (Xe[te][St] = !1), st = P(st, { enumerable: M(0, !1) })) : (d(Xe, te) || je(Xe, te, M(1, {})), Xe[te][St] = !0), ze(Xe, St, st)) : je(Xe, St, st); + }, $t = function(Xe, Ze) { + g(Xe); + var st = T(Ze), St = R(st).concat(Tr(st)); + return se(St, function(tt) { + (!b || _r.call(st, tt)) && _t(Xe, tt, st[tt]); + }), Xe; + }, fr = function(Xe, Ze) { + return Ze === void 0 ? P(Xe) : $t(P(Xe), Ze); + }, _r = function(Xe) { + var Ze = C(Xe), st = ge.call(this, Ze); + return this === Ae && d(_e, Ze) && !d(we, Ze) ? !1 : st || !d(this, Ze) || !d(_e, Ze) || d(this, te) && this[te][Ze] ? st : !0; + }, ar = function(Xe, Ze) { + var st = T(Xe), St = C(Ze); + if (!(st === Ae && d(_e, St) && !d(we, St))) { + var tt = He(st, St); + return tt && d(_e, St) && !(d(st, te) && st[te][St]) && (tt.enumerable = !0), tt; + } + }, or = function(Xe) { + var Ze = be(T(Xe)), st = []; + return se(Ze, function(St) { + !d(_e, St) && !d(fe, St) && st.push(St); + }), st; + }, Tr = function(Xe) { + var Ze = Xe === Ae, st = be(Ze ? we : T(Xe)), St = []; + return se(st, function(tt) { + d(_e, tt) && (!Ze || d(Ae, tt)) && St.push(_e[tt]); + }), St; + }; + if (w || (Te = function() { + if (this instanceof Te) + throw TypeError("Symbol is not a constructor"); + var Xe = !arguments.length || arguments[0] === void 0 ? void 0 : E(arguments[0]), Ze = K(Xe), st = function(St) { + this === Ae && st.call(we, St), d(this, te) && d(this[te], Ze) && (this[te][Ze] = !1), ze(this, Ze, M(1, St)); + }; + return b && vt && ze(Ae, Ze, { configurable: !0, set: st }), bt(Ze, Xe); + }, ee(Te[re], "toString", function() { + return ue(this).tag; + }), ee(Te, "withoutSetter", function(qe) { + return bt(K(qe), qe); + }), Q.f = _r, G.f = _t, $.f = ar, N.f = F.f = or, U.f = Tr, xe.f = function(qe) { + return bt(Oe(qe), qe); + }, b && (je(Te[re], "description", { + configurable: !0, + get: function() { + return ue(this).description; + } + }), v || ee(Ae, "propertyIsEnumerable", _r, { unsafe: !0 }))), c({ global: !0, wrap: !0, forced: !w, sham: !w }, { + Symbol: Te + }), se(R(et), function(qe) { + Ge(qe); + }), c({ target: pe, stat: !0, forced: !w }, { + // `Symbol.for` method + // https://tc39.es/ecma262/#sec-symbol.for + for: function(qe) { + var Xe = E(qe); + if (d(Ie, Xe)) + return Ie[Xe]; + var Ze = Te(Xe); + return Ie[Xe] = Ze, Me[Ze] = Xe, Ze; + }, + // `Symbol.keyFor` method + // https://tc39.es/ecma262/#sec-symbol.keyfor + keyFor: function(Xe) { + if (!x(Xe)) + throw TypeError(Xe + " is not a symbol"); + if (d(Me, Xe)) + return Me[Xe]; + }, + useSetter: function() { + vt = !0; + }, + useSimple: function() { + vt = !1; + } + }), c({ target: "Object", stat: !0, forced: !w, sham: !b }, { + // `Object.create` method + // https://tc39.es/ecma262/#sec-object.create + create: fr, + // `Object.defineProperty` method + // https://tc39.es/ecma262/#sec-object.defineproperty + defineProperty: _t, + // `Object.defineProperties` method + // https://tc39.es/ecma262/#sec-object.defineproperties + defineProperties: $t, + // `Object.getOwnPropertyDescriptor` method + // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors + getOwnPropertyDescriptor: ar + }), c({ target: "Object", stat: !0, forced: !w }, { + // `Object.getOwnPropertyNames` method + // https://tc39.es/ecma262/#sec-object.getownpropertynames + getOwnPropertyNames: or, + // `Object.getOwnPropertySymbols` method + // https://tc39.es/ecma262/#sec-object.getownpropertysymbols + getOwnPropertySymbols: Tr + }), c({ target: "Object", stat: !0, forced: p(function() { + U.f(1); + }) }, { + getOwnPropertySymbols: function(Xe) { + return U.f(S(Xe)); + } + }), Ne) { + var tn = !w || p(function() { + var qe = Te(); + return Ne([qe]) != "[null]" || Ne({ a: qe }) != "{}" || Ne(Object(qe)) != "{}"; + }); + c({ target: "JSON", stat: !0, forced: tn }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + stringify: function(Xe, Ze, st) { + for (var St = [Xe], tt = 1, Vr; arguments.length > tt; ) + St.push(arguments[tt++]); + if (Vr = Ze, !(!y(Ze) && Xe === void 0 || x(Xe))) + return m(Ze) || (Ze = function(cn, ct) { + if (_(Vr) && (ct = Vr.call(this, cn, ct)), !x(ct)) + return ct; + }), St[1] = Ze, Ne.apply(null, St); + } + }); + } + if (!Te[re][ae]) { + var rn = Te[re].valueOf; + ee(Te[re], ae, function() { + return rn.apply(this, arguments); + }); + } + oe(Te, pe), fe[te] = !0; + } + ), + /***/ + 1250: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("matchAll"); + } + ), + /***/ + 9017: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("match"); + } + ), + /***/ + 9786: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("replace"); + } + ), + /***/ + 503: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("search"); + } + ), + /***/ + 6565: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("species"); + } + ), + /***/ + 9322: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("split"); + } + ), + /***/ + 3610: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("toPrimitive"); + } + ), + /***/ + 6886: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("toStringTag"); + } + ), + /***/ + 3514: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("unscopables"); + } + ), + /***/ + 177: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("asyncDispose"); + } + ), + /***/ + 9031: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("dispose"); + } + ), + /***/ + 6658: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("matcher"); + } + ), + /***/ + 1875: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("metadata"); + } + ), + /***/ + 8658: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("observable"); + } + ), + /***/ + 4592: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("patternMatch"); + } + ), + /***/ + 6680: ( + /***/ + function(s, l, u) { + var c = u(1488); + c("replaceAll"); + } + ), + /***/ + 162: ( + /***/ + function(s, l, u) { + u(8939); + var c = u(7365), h = u(8576), f = u(4696), v = u(8711), b = u(7771), w = u(8182), p = w("toStringTag"); + for (var d in c) { + var m = h[d], _ = m && m.prototype; + _ && f(_) !== p && v(_, p, d), b[d] = b.Array; + } + } + ), + /***/ + 2906: ( + /***/ + function(s, l, u) { + var c = u(3085), h = u(8576), f = u(6447), v = u(8989), b = [].slice, w = /MSIE .\./.test(v), p = function(d) { + return function(m, _) { + var y = arguments.length > 2, x = y ? b.call(arguments, 2) : void 0; + return d(y ? function() { + (f(m) ? m : Function(m)).apply(this, x); + } : m, _); + }; + }; + c({ global: !0, bind: !0, forced: w }, { + // `setTimeout` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout + setTimeout: p(h.setTimeout), + // `setInterval` method + // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval + setInterval: p(h.setInterval) + }); + } + ), + /***/ + 9336: ( + /***/ + function(s, l, u) { + u(8939); + var c = u(3085), h = u(150), f = u(4551), v = u(9482), b = u(533), w = u(1284), p = u(5148), d = u(3326), m = u(6961), _ = u(6447), y = u(4500), x = u(8043), g = u(4696), S = u(1138), T = u(5744), C = u(4845), E = u(2853), M = u(774), P = u(1669), R = u(8703), N = u(8182), F = h("fetch"), U = h("Request"), $ = U && U.prototype, G = h("Headers"), Q = N("iterator"), ee = "URLSearchParams", ce = ee + "Iterator", ne = d.set, fe = d.getterFor(ee), K = d.getterFor(ce), Oe = /\+/g, xe = Array(4), Ge = function(be) { + return xe[be - 1] || (xe[be - 1] = RegExp("((?:%[\\da-f]{2}){" + be + "})", "gi")); + }, oe = function(be) { + try { + return decodeURIComponent(be); + } catch (ge) { + return be; + } + }, de = function(be) { + var ge = be.replace(Oe, " "), _e = 4; + try { + return decodeURIComponent(ge); + } catch (we) { + for (; _e; ) + ge = ge.replace(Ge(_e--), oe); + return ge; + } + }, se = /[!'()~]|%20/g, te = { + "!": "%21", + "'": "%27", + "(": "%28", + ")": "%29", + "~": "%7E", + "%20": "+" + }, pe = function(be) { + return te[be]; + }, re = function(be) { + return encodeURIComponent(be).replace(se, pe); + }, ae = function(be, ge) { + if (ge) + for (var _e = ge.split("&"), we = 0, Ie, Me; we < _e.length; ) + Ie = _e[we++], Ie.length && (Me = Ie.split("="), be.push({ + key: de(Me.shift()), + value: de(Me.join("=")) + })); + }, le = function(be) { + this.entries.length = 0, ae(this.entries, be); + }, ue = function(be, ge) { + if (be < ge) + throw TypeError("Not enough arguments"); + }, Ae = p(function(ge, _e) { + ne(this, { + type: ce, + iterator: P(fe(ge).entries), + kind: _e + }); + }, "Iterator", function() { + var ge = K(this), _e = ge.kind, we = ge.iterator.next(), Ie = we.value; + return we.done || (we.value = _e === "keys" ? Ie.key : _e === "values" ? Ie.value : [Ie.key, Ie.value]), we; + }), Te = function() { + m(this, Te, ee); + var ge = arguments.length > 0 ? arguments[0] : void 0, _e = this, we = [], Ie, Me, et, yt, vt, ze, bt, _t, $t; + if (ne(_e, { + type: ee, + entries: we, + updateURL: function() { + }, + updateSearchParams: le + }), ge !== void 0) + if (T(ge)) + if (Ie = R(ge), Ie) + for (Me = P(ge, Ie), et = Me.next; !(yt = et.call(Me)).done; ) { + if (vt = P(S(yt.value)), ze = vt.next, (bt = ze.call(vt)).done || (_t = ze.call(vt)).done || !ze.call(vt).done) + throw TypeError("Expected sequence with length 2"); + we.push({ key: C(bt.value), value: C(_t.value) }); + } + else + for ($t in ge) + y(ge, $t) && we.push({ key: $t, value: C(ge[$t]) }); + else + ae( + we, + typeof ge == "string" ? ge.charAt(0) === "?" ? ge.slice(1) : ge : C(ge) + ); + }, Ne = Te.prototype; + if (b(Ne, { + // `URLSearchParams.prototype.append` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-append + append: function(ge, _e) { + ue(arguments.length, 2); + var we = fe(this); + we.entries.push({ key: C(ge), value: C(_e) }), we.updateURL(); + }, + // `URLSearchParams.prototype.delete` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-delete + delete: function(be) { + ue(arguments.length, 1); + for (var ge = fe(this), _e = ge.entries, we = C(be), Ie = 0; Ie < _e.length; ) + _e[Ie].key === we ? _e.splice(Ie, 1) : Ie++; + ge.updateURL(); + }, + // `URLSearchParams.prototype.get` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-get + get: function(ge) { + ue(arguments.length, 1); + for (var _e = fe(this).entries, we = C(ge), Ie = 0; Ie < _e.length; Ie++) + if (_e[Ie].key === we) + return _e[Ie].value; + return null; + }, + // `URLSearchParams.prototype.getAll` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-getall + getAll: function(ge) { + ue(arguments.length, 1); + for (var _e = fe(this).entries, we = C(ge), Ie = [], Me = 0; Me < _e.length; Me++) + _e[Me].key === we && Ie.push(_e[Me].value); + return Ie; + }, + // `URLSearchParams.prototype.has` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-has + has: function(ge) { + ue(arguments.length, 1); + for (var _e = fe(this).entries, we = C(ge), Ie = 0; Ie < _e.length; ) + if (_e[Ie++].key === we) + return !0; + return !1; + }, + // `URLSearchParams.prototype.set` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-set + set: function(ge, _e) { + ue(arguments.length, 1); + for (var we = fe(this), Ie = we.entries, Me = !1, et = C(ge), yt = C(_e), vt = 0, ze; vt < Ie.length; vt++) + ze = Ie[vt], ze.key === et && (Me ? Ie.splice(vt--, 1) : (Me = !0, ze.value = yt)); + Me || Ie.push({ key: et, value: yt }), we.updateURL(); + }, + // `URLSearchParams.prototype.sort` method + // https://url.spec.whatwg.org/#dom-urlsearchparams-sort + sort: function() { + var ge = fe(this), _e = ge.entries, we = _e.slice(), Ie, Me, et; + for (_e.length = 0, et = 0; et < we.length; et++) { + for (Ie = we[et], Me = 0; Me < et; Me++) + if (_e[Me].key > Ie.key) { + _e.splice(Me, 0, Ie); + break; + } + Me === et && _e.push(Ie); + } + ge.updateURL(); + }, + // `URLSearchParams.prototype.forEach` method + forEach: function(ge) { + for (var _e = fe(this).entries, we = x(ge, arguments.length > 1 ? arguments[1] : void 0, 3), Ie = 0, Me; Ie < _e.length; ) + Me = _e[Ie++], we(Me.value, Me.key, this); + }, + // `URLSearchParams.prototype.keys` method + keys: function() { + return new Ae(this, "keys"); + }, + // `URLSearchParams.prototype.values` method + values: function() { + return new Ae(this, "values"); + }, + // `URLSearchParams.prototype.entries` method + entries: function() { + return new Ae(this, "entries"); + } + }, { enumerable: !0 }), v(Ne, Q, Ne.entries, { name: "entries" }), v(Ne, "toString", function() { + for (var ge = fe(this).entries, _e = [], we = 0, Ie; we < ge.length; ) + Ie = ge[we++], _e.push(re(Ie.key) + "=" + re(Ie.value)); + return _e.join("&"); + }, { enumerable: !0 }), w(Te, ee), c({ global: !0, forced: !f }, { + URLSearchParams: Te + }), !f && _(G)) { + var He = function(be) { + if (T(be)) { + var ge = be.body, _e; + if (g(ge) === ee) + return _e = be.headers ? new G(be.headers) : new G(), _e.has("content-type") || _e.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), E(be, { + body: M(0, String(ge)), + headers: M(0, _e) + }); + } + return be; + }; + if (_(F) && c({ global: !0, enumerable: !0, forced: !0 }, { + fetch: function(ge) { + return F(ge, arguments.length > 1 ? He(arguments[1]) : {}); + } + }), _(U)) { + var je = function(ge) { + return m(this, je, "Request"), new U(ge, arguments.length > 1 ? He(arguments[1]) : {}); + }; + $.constructor = je, je.prototype = $, c({ global: !0, forced: !0 }, { + Request: je + }); + } + } + s.exports = { + URLSearchParams: Te, + getState: fe + }; + } + ), + /***/ + 4948: ( + /***/ + function(s, l, u) { + u(5454); + var c = u(3085), h = u(69), f = u(4551), v = u(8576), b = u(1187), w = u(9482), p = u(6961), d = u(4500), m = u(2503), _ = u(841), y = u(863).codeAt, x = u(7977), g = u(4845), S = u(1284), T = u(9336), C = u(3326), E = v.URL, M = T.URLSearchParams, P = T.getState, R = C.set, N = C.getterFor("URL"), F = Math.floor, U = Math.pow, $ = "Invalid authority", G = "Invalid scheme", Q = "Invalid host", ee = "Invalid port", ce = /[A-Za-z]/, ne = /[\d+-.A-Za-z]/, fe = /\d/, K = /^0x/i, Oe = /^[0-7]+$/, xe = /^\d+$/, Ge = /^[\dA-Fa-f]+$/, oe = /[\0\t\n\r #%/:<>?@[\\\]^|]/, de = /[\0\t\n\r #/:<>?@[\\\]^|]/, se = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, te = /[\t\n\r]/g, pe, re = function(he, Qe) { + var Ue, Je, at; + if (Qe.charAt(0) == "[") { + if (Qe.charAt(Qe.length - 1) != "]" || (Ue = le(Qe.slice(1, -1)), !Ue)) + return Q; + he.host = Ue; + } else if (_e(he)) { + if (Qe = x(Qe), oe.test(Qe) || (Ue = ae(Qe), Ue === null)) + return Q; + he.host = Ue; + } else { + if (de.test(Qe)) + return Q; + for (Ue = "", Je = _(Qe), at = 0; at < Je.length; at++) + Ue += be(Je[at], Te); + he.host = Ue; + } + }, ae = function(he) { + var Qe = he.split("."), Ue, Je, at, Dt, It, qt, Lr; + if (Qe.length && Qe[Qe.length - 1] == "" && Qe.pop(), Ue = Qe.length, Ue > 4) + return he; + for (Je = [], at = 0; at < Ue; at++) { + if (Dt = Qe[at], Dt == "") + return he; + if (It = 10, Dt.length > 1 && Dt.charAt(0) == "0" && (It = K.test(Dt) ? 16 : 8, Dt = Dt.slice(It == 8 ? 1 : 2)), Dt === "") + qt = 0; + else { + if (!(It == 10 ? xe : It == 8 ? Oe : Ge).test(Dt)) + return he; + qt = parseInt(Dt, It); + } + Je.push(qt); + } + for (at = 0; at < Ue; at++) + if (qt = Je[at], at == Ue - 1) { + if (qt >= U(256, 5 - Ue)) + return null; + } else if (qt > 255) + return null; + for (Lr = Je.pop(), at = 0; at < Je.length; at++) + Lr += Je[at] * U(256, 3 - at); + return Lr; + }, le = function(he) { + var Qe = [0, 0, 0, 0, 0, 0, 0, 0], Ue = 0, Je = null, at = 0, Dt, It, qt, Lr, wr, Nt, nt, Cn = function() { + return he.charAt(at); + }; + if (Cn() == ":") { + if (he.charAt(1) != ":") + return; + at += 2, Ue++, Je = Ue; + } + for (; Cn(); ) { + if (Ue == 8) + return; + if (Cn() == ":") { + if (Je !== null) + return; + at++, Ue++, Je = Ue; + continue; + } + for (Dt = It = 0; It < 4 && Ge.test(Cn()); ) + Dt = Dt * 16 + parseInt(Cn(), 16), at++, It++; + if (Cn() == ".") { + if (It == 0 || (at -= It, Ue > 6)) + return; + for (qt = 0; Cn(); ) { + if (Lr = null, qt > 0) + if (Cn() == "." && qt < 4) + at++; + else + return; + if (!fe.test(Cn())) + return; + for (; fe.test(Cn()); ) { + if (wr = parseInt(Cn(), 10), Lr === null) + Lr = wr; + else { + if (Lr == 0) + return; + Lr = Lr * 10 + wr; + } + if (Lr > 255) + return; + at++; + } + Qe[Ue] = Qe[Ue] * 256 + Lr, qt++, (qt == 2 || qt == 4) && Ue++; + } + if (qt != 4) + return; + break; + } else if (Cn() == ":") { + if (at++, !Cn()) + return; + } else if (Cn()) + return; + Qe[Ue++] = Dt; + } + if (Je !== null) + for (Nt = Ue - Je, Ue = 7; Ue != 0 && Nt > 0; ) + nt = Qe[Ue], Qe[Ue--] = Qe[Je + Nt - 1], Qe[Je + --Nt] = nt; + else if (Ue != 8) + return; + return Qe; + }, ue = function(he) { + for (var Qe = null, Ue = 1, Je = null, at = 0, Dt = 0; Dt < 8; Dt++) + he[Dt] !== 0 ? (at > Ue && (Qe = Je, Ue = at), Je = null, at = 0) : (Je === null && (Je = Dt), ++at); + return at > Ue && (Qe = Je, Ue = at), Qe; + }, Ae = function(he) { + var Qe, Ue, Je, at; + if (typeof he == "number") { + for (Qe = [], Ue = 0; Ue < 4; Ue++) + Qe.unshift(he % 256), he = F(he / 256); + return Qe.join("."); + } else if (typeof he == "object") { + for (Qe = "", Je = ue(he), Ue = 0; Ue < 8; Ue++) + at && he[Ue] === 0 || (at && (at = !1), Je === Ue ? (Qe += Ue ? ":" : "::", at = !0) : (Qe += he[Ue].toString(16), Ue < 7 && (Qe += ":"))); + return "[" + Qe + "]"; + } + return he; + }, Te = {}, Ne = m({}, Te, { + " ": 1, + '"': 1, + "<": 1, + ">": 1, + "`": 1 + }), He = m({}, Ne, { + "#": 1, + "?": 1, + "{": 1, + "}": 1 + }), je = m({}, He, { + "/": 1, + ":": 1, + ";": 1, + "=": 1, + "@": 1, + "[": 1, + "\\": 1, + "]": 1, + "^": 1, + "|": 1 + }), be = function(he, Qe) { + var Ue = y(he, 0); + return Ue > 32 && Ue < 127 && !d(Qe, he) ? he : encodeURIComponent(he); + }, ge = { + ftp: 21, + file: null, + http: 80, + https: 443, + ws: 80, + wss: 443 + }, _e = function(he) { + return d(ge, he.scheme); + }, we = function(he) { + return he.username != "" || he.password != ""; + }, Ie = function(he) { + return !he.host || he.cannotBeABaseURL || he.scheme == "file"; + }, Me = function(he, Qe) { + var Ue; + return he.length == 2 && ce.test(he.charAt(0)) && ((Ue = he.charAt(1)) == ":" || !Qe && Ue == "|"); + }, et = function(he) { + var Qe; + return he.length > 1 && Me(he.slice(0, 2)) && (he.length == 2 || (Qe = he.charAt(2)) === "/" || Qe === "\\" || Qe === "?" || Qe === "#"); + }, yt = function(he) { + var Qe = he.path, Ue = Qe.length; + Ue && (he.scheme != "file" || Ue != 1 || !Me(Qe[0], !0)) && Qe.pop(); + }, vt = function(he) { + return he === "." || he.toLowerCase() === "%2e"; + }, ze = function(he) { + return he = he.toLowerCase(), he === ".." || he === "%2e." || he === ".%2e" || he === "%2e%2e"; + }, bt = {}, _t = {}, $t = {}, fr = {}, _r = {}, ar = {}, or = {}, Tr = {}, tn = {}, rn = {}, qe = {}, Xe = {}, Ze = {}, st = {}, St = {}, tt = {}, Vr = {}, cn = {}, ct = {}, Re = {}, Br = {}, dr = function(he, Qe, Ue, Je) { + var at = Ue || bt, Dt = 0, It = "", qt = !1, Lr = !1, wr = !1, Nt, nt, Cn, ui; + for (Ue || (he.scheme = "", he.username = "", he.password = "", he.host = null, he.port = null, he.path = [], he.query = null, he.fragment = null, he.cannotBeABaseURL = !1, Qe = Qe.replace(se, "")), Qe = Qe.replace(te, ""), Nt = _(Qe); Dt <= Nt.length; ) { + switch (nt = Nt[Dt], at) { + case bt: + if (nt && ce.test(nt)) + It += nt.toLowerCase(), at = _t; + else { + if (Ue) + return G; + at = $t; + continue; + } + break; + case _t: + if (nt && (ne.test(nt) || nt == "+" || nt == "-" || nt == ".")) + It += nt.toLowerCase(); + else if (nt == ":") { + if (Ue && (_e(he) != d(ge, It) || It == "file" && (we(he) || he.port !== null) || he.scheme == "file" && !he.host)) + return; + if (he.scheme = It, Ue) { + _e(he) && ge[he.scheme] == he.port && (he.port = null); + return; + } + It = "", he.scheme == "file" ? at = st : _e(he) && Je && Je.scheme == he.scheme ? at = fr : _e(he) ? at = Tr : Nt[Dt + 1] == "/" ? (at = _r, Dt++) : (he.cannotBeABaseURL = !0, he.path.push(""), at = ct); + } else { + if (Ue) + return G; + It = "", at = $t, Dt = 0; + continue; + } + break; + case $t: + if (!Je || Je.cannotBeABaseURL && nt != "#") + return G; + if (Je.cannotBeABaseURL && nt == "#") { + he.scheme = Je.scheme, he.path = Je.path.slice(), he.query = Je.query, he.fragment = "", he.cannotBeABaseURL = !0, at = Br; + break; + } + at = Je.scheme == "file" ? st : ar; + continue; + case fr: + if (nt == "/" && Nt[Dt + 1] == "/") + at = tn, Dt++; + else { + at = ar; + continue; + } + break; + case _r: + if (nt == "/") { + at = rn; + break; + } else { + at = cn; + continue; + } + case ar: + if (he.scheme = Je.scheme, nt == pe) + he.username = Je.username, he.password = Je.password, he.host = Je.host, he.port = Je.port, he.path = Je.path.slice(), he.query = Je.query; + else if (nt == "/" || nt == "\\" && _e(he)) + at = or; + else if (nt == "?") + he.username = Je.username, he.password = Je.password, he.host = Je.host, he.port = Je.port, he.path = Je.path.slice(), he.query = "", at = Re; + else if (nt == "#") + he.username = Je.username, he.password = Je.password, he.host = Je.host, he.port = Je.port, he.path = Je.path.slice(), he.query = Je.query, he.fragment = "", at = Br; + else { + he.username = Je.username, he.password = Je.password, he.host = Je.host, he.port = Je.port, he.path = Je.path.slice(), he.path.pop(), at = cn; + continue; + } + break; + case or: + if (_e(he) && (nt == "/" || nt == "\\")) + at = tn; + else if (nt == "/") + at = rn; + else { + he.username = Je.username, he.password = Je.password, he.host = Je.host, he.port = Je.port, at = cn; + continue; + } + break; + case Tr: + if (at = tn, nt != "/" || It.charAt(Dt + 1) != "/") + continue; + Dt++; + break; + case tn: + if (nt != "/" && nt != "\\") { + at = rn; + continue; + } + break; + case rn: + if (nt == "@") { + qt && (It = "%40" + It), qt = !0, Cn = _(It); + for (var yn = 0; yn < Cn.length; yn++) { + var To = Cn[yn]; + if (To == ":" && !wr) { + wr = !0; + continue; + } + var ss = be(To, je); + wr ? he.password += ss : he.username += ss; + } + It = ""; + } else if (nt == pe || nt == "/" || nt == "?" || nt == "#" || nt == "\\" && _e(he)) { + if (qt && It == "") + return $; + Dt -= _(It).length + 1, It = "", at = qe; + } else + It += nt; + break; + case qe: + case Xe: + if (Ue && he.scheme == "file") { + at = tt; + continue; + } else if (nt == ":" && !Lr) { + if (It == "") + return Q; + if (ui = re(he, It), ui) + return ui; + if (It = "", at = Ze, Ue == Xe) + return; + } else if (nt == pe || nt == "/" || nt == "?" || nt == "#" || nt == "\\" && _e(he)) { + if (_e(he) && It == "") + return Q; + if (Ue && It == "" && (we(he) || he.port !== null)) + return; + if (ui = re(he, It), ui) + return ui; + if (It = "", at = Vr, Ue) + return; + continue; + } else + nt == "[" ? Lr = !0 : nt == "]" && (Lr = !1), It += nt; + break; + case Ze: + if (fe.test(nt)) + It += nt; + else if (nt == pe || nt == "/" || nt == "?" || nt == "#" || nt == "\\" && _e(he) || Ue) { + if (It != "") { + var Wn = parseInt(It, 10); + if (Wn > 65535) + return ee; + he.port = _e(he) && Wn === ge[he.scheme] ? null : Wn, It = ""; + } + if (Ue) + return; + at = Vr; + continue; + } else + return ee; + break; + case st: + if (he.scheme = "file", nt == "/" || nt == "\\") + at = St; + else if (Je && Je.scheme == "file") + if (nt == pe) + he.host = Je.host, he.path = Je.path.slice(), he.query = Je.query; + else if (nt == "?") + he.host = Je.host, he.path = Je.path.slice(), he.query = "", at = Re; + else if (nt == "#") + he.host = Je.host, he.path = Je.path.slice(), he.query = Je.query, he.fragment = "", at = Br; + else { + et(Nt.slice(Dt).join("")) || (he.host = Je.host, he.path = Je.path.slice(), yt(he)), at = cn; + continue; + } + else { + at = cn; + continue; + } + break; + case St: + if (nt == "/" || nt == "\\") { + at = tt; + break; + } + Je && Je.scheme == "file" && !et(Nt.slice(Dt).join("")) && (Me(Je.path[0], !0) ? he.path.push(Je.path[0]) : he.host = Je.host), at = cn; + continue; + case tt: + if (nt == pe || nt == "/" || nt == "\\" || nt == "?" || nt == "#") { + if (!Ue && Me(It)) + at = cn; + else if (It == "") { + if (he.host = "", Ue) + return; + at = Vr; + } else { + if (ui = re(he, It), ui) + return ui; + if (he.host == "localhost" && (he.host = ""), Ue) + return; + It = "", at = Vr; + } + continue; + } else + It += nt; + break; + case Vr: + if (_e(he)) { + if (at = cn, nt != "/" && nt != "\\") + continue; + } else if (!Ue && nt == "?") + he.query = "", at = Re; + else if (!Ue && nt == "#") + he.fragment = "", at = Br; + else if (nt != pe && (at = cn, nt != "/")) + continue; + break; + case cn: + if (nt == pe || nt == "/" || nt == "\\" && _e(he) || !Ue && (nt == "?" || nt == "#")) { + if (ze(It) ? (yt(he), nt != "/" && !(nt == "\\" && _e(he)) && he.path.push("")) : vt(It) ? nt != "/" && !(nt == "\\" && _e(he)) && he.path.push("") : (he.scheme == "file" && !he.path.length && Me(It) && (he.host && (he.host = ""), It = It.charAt(0) + ":"), he.path.push(It)), It = "", he.scheme == "file" && (nt == pe || nt == "?" || nt == "#")) + for (; he.path.length > 1 && he.path[0] === ""; ) + he.path.shift(); + nt == "?" ? (he.query = "", at = Re) : nt == "#" && (he.fragment = "", at = Br); + } else + It += be(nt, He); + break; + case ct: + nt == "?" ? (he.query = "", at = Re) : nt == "#" ? (he.fragment = "", at = Br) : nt != pe && (he.path[0] += be(nt, Te)); + break; + case Re: + !Ue && nt == "#" ? (he.fragment = "", at = Br) : nt != pe && (nt == "'" && _e(he) ? he.query += "%27" : nt == "#" ? he.query += "%23" : he.query += be(nt, Te)); + break; + case Br: + nt != pe && (he.fragment += be(nt, Ne)); + break; + } + Dt++; + } + }, ur = function(Qe) { + var Ue = p(this, ur, "URL"), Je = arguments.length > 1 ? arguments[1] : void 0, at = g(Qe), Dt = R(Ue, { type: "URL" }), It, qt; + if (Je !== void 0) { + if (Je instanceof ur) + It = N(Je); + else if (qt = dr(It = {}, g(Je)), qt) + throw TypeError(qt); + } + if (qt = dr(Dt, at, null, It), qt) + throw TypeError(qt); + var Lr = Dt.searchParams = new M(), wr = P(Lr); + wr.updateSearchParams(Dt.query), wr.updateURL = function() { + Dt.query = String(Lr) || null; + }, h || (Ue.href = vr.call(Ue), Ue.origin = Vt.call(Ue), Ue.protocol = wi.call(Ue), Ue.username = wt.call(Ue), Ue.password = pr.call(Ue), Ue.host = Fn.call(Ue), Ue.hostname = Ra.call(Ue), Ue.port = oo.call(Ue), Ue.pathname = Co.call(Ue), Ue.search = Wr.call(Ue), Ue.searchParams = Na.call(Ue), Ue.hash = jr.call(Ue)); + }, wn = ur.prototype, vr = function() { + var he = N(this), Qe = he.scheme, Ue = he.username, Je = he.password, at = he.host, Dt = he.port, It = he.path, qt = he.query, Lr = he.fragment, wr = Qe + ":"; + return at !== null ? (wr += "//", we(he) && (wr += Ue + (Je ? ":" + Je : "") + "@"), wr += Ae(at), Dt !== null && (wr += ":" + Dt)) : Qe == "file" && (wr += "//"), wr += he.cannotBeABaseURL ? It[0] : It.length ? "/" + It.join("/") : "", qt !== null && (wr += "?" + qt), Lr !== null && (wr += "#" + Lr), wr; + }, Vt = function() { + var he = N(this), Qe = he.scheme, Ue = he.port; + if (Qe == "blob") + try { + return new ur(Qe.path[0]).origin; + } catch (Je) { + return "null"; + } + return Qe == "file" || !_e(he) ? "null" : Qe + "://" + Ae(he.host) + (Ue !== null ? ":" + Ue : ""); + }, wi = function() { + return N(this).scheme + ":"; + }, wt = function() { + return N(this).username; + }, pr = function() { + return N(this).password; + }, Fn = function() { + var he = N(this), Qe = he.host, Ue = he.port; + return Qe === null ? "" : Ue === null ? Ae(Qe) : Ae(Qe) + ":" + Ue; + }, Ra = function() { + var he = N(this).host; + return he === null ? "" : Ae(he); + }, oo = function() { + var he = N(this).port; + return he === null ? "" : String(he); + }, Co = function() { + var he = N(this), Qe = he.path; + return he.cannotBeABaseURL ? Qe[0] : Qe.length ? "/" + Qe.join("/") : ""; + }, Wr = function() { + var he = N(this).query; + return he ? "?" + he : ""; + }, Na = function() { + return N(this).searchParams; + }, jr = function() { + var he = N(this).fragment; + return he ? "#" + he : ""; + }, Sr = function(he, Qe) { + return { get: he, set: Qe, configurable: !0, enumerable: !0 }; + }; + if (h && b(wn, { + // `URL.prototype.href` accessors pair + // https://url.spec.whatwg.org/#dom-url-href + href: Sr(vr, function(he) { + var Qe = N(this), Ue = g(he), Je = dr(Qe, Ue); + if (Je) + throw TypeError(Je); + P(Qe.searchParams).updateSearchParams(Qe.query); + }), + // `URL.prototype.origin` getter + // https://url.spec.whatwg.org/#dom-url-origin + origin: Sr(Vt), + // `URL.prototype.protocol` accessors pair + // https://url.spec.whatwg.org/#dom-url-protocol + protocol: Sr(wi, function(he) { + var Qe = N(this); + dr(Qe, g(he) + ":", bt); + }), + // `URL.prototype.username` accessors pair + // https://url.spec.whatwg.org/#dom-url-username + username: Sr(wt, function(he) { + var Qe = N(this), Ue = _(g(he)); + if (!Ie(Qe)) { + Qe.username = ""; + for (var Je = 0; Je < Ue.length; Je++) + Qe.username += be(Ue[Je], je); + } + }), + // `URL.prototype.password` accessors pair + // https://url.spec.whatwg.org/#dom-url-password + password: Sr(pr, function(he) { + var Qe = N(this), Ue = _(g(he)); + if (!Ie(Qe)) { + Qe.password = ""; + for (var Je = 0; Je < Ue.length; Je++) + Qe.password += be(Ue[Je], je); + } + }), + // `URL.prototype.host` accessors pair + // https://url.spec.whatwg.org/#dom-url-host + host: Sr(Fn, function(he) { + var Qe = N(this); + Qe.cannotBeABaseURL || dr(Qe, g(he), qe); + }), + // `URL.prototype.hostname` accessors pair + // https://url.spec.whatwg.org/#dom-url-hostname + hostname: Sr(Ra, function(he) { + var Qe = N(this); + Qe.cannotBeABaseURL || dr(Qe, g(he), Xe); + }), + // `URL.prototype.port` accessors pair + // https://url.spec.whatwg.org/#dom-url-port + port: Sr(oo, function(he) { + var Qe = N(this); + Ie(Qe) || (he = g(he), he == "" ? Qe.port = null : dr(Qe, he, Ze)); + }), + // `URL.prototype.pathname` accessors pair + // https://url.spec.whatwg.org/#dom-url-pathname + pathname: Sr(Co, function(he) { + var Qe = N(this); + Qe.cannotBeABaseURL || (Qe.path = [], dr(Qe, g(he), Vr)); + }), + // `URL.prototype.search` accessors pair + // https://url.spec.whatwg.org/#dom-url-search + search: Sr(Wr, function(he) { + var Qe = N(this); + he = g(he), he == "" ? Qe.query = null : (he.charAt(0) == "?" && (he = he.slice(1)), Qe.query = "", dr(Qe, he, Re)), P(Qe.searchParams).updateSearchParams(Qe.query); + }), + // `URL.prototype.searchParams` getter + // https://url.spec.whatwg.org/#dom-url-searchparams + searchParams: Sr(Na), + // `URL.prototype.hash` accessors pair + // https://url.spec.whatwg.org/#dom-url-hash + hash: Sr(jr, function(he) { + var Qe = N(this); + if (he = g(he), he == "") { + Qe.fragment = null; + return; + } + he.charAt(0) == "#" && (he = he.slice(1)), Qe.fragment = "", dr(Qe, he, Br); + }) + }), w(wn, "toJSON", function() { + return vr.call(this); + }, { enumerable: !0 }), w(wn, "toString", function() { + return vr.call(this); + }, { enumerable: !0 }), E) { + var $r = E.createObjectURL, Ct = E.revokeObjectURL; + $r && w(ur, "createObjectURL", function(Qe) { + return $r.apply(E, arguments); + }), Ct && w(ur, "revokeObjectURL", function(Qe) { + return Ct.apply(E, arguments); + }); + } + S(ur, "URL"), c({ global: !0, forced: !f, sham: !h }, { + URL: ur + }); + } + ), + /***/ + 9801: ( + /***/ + function() { + } + ), + /***/ + 3822: ( + /***/ + function(s, l, u) { + var c = u(2221); + s.exports = c; + } + ), + /***/ + 1434: ( + /***/ + function(s, l, u) { + var c = u(5078); + s.exports = c; + } + ), + /***/ + 6899: ( + /***/ + function(s, l, u) { + var c = u(98); + s.exports = c; + } + ), + /***/ + 7710: ( + /***/ + function(s, l, u) { + var c = u(5739); + u(162), s.exports = c; + } + ), + /***/ + 4486: ( + /***/ + function(s, l, u) { + var c = u(278); + s.exports = c; + } + ), + /***/ + 4877: ( + /***/ + function(s, l, u) { + var c = u(1484); + s.exports = c; + } + ), + /***/ + 7178: ( + /***/ + function(s, l, u) { + var c = u(7731); + s.exports = c; + } + ), + /***/ + 5603: ( + /***/ + function(s, l, u) { + var c = u(3669); + s.exports = c; + } + ), + /***/ + 1206: ( + /***/ + function(s, l, u) { + u(162); + var c = u(6899), h = u(4696), f = Array.prototype, v = { + DOMTokenList: !0, + NodeList: !0 + }; + s.exports = function(b) { + var w = b.forEach; + return b === f || b instanceof Array && w === f.forEach || v.hasOwnProperty(h(b)) ? c : w; + }; + } + ), + /***/ + 6174: ( + /***/ + function(s, l, u) { + var c = u(2604); + s.exports = c; + } + ), + /***/ + 57: ( + /***/ + function(s, l, u) { + var c = u(263); + s.exports = c; + } + ), + /***/ + 4741: ( + /***/ + function(s, l, u) { + var c = u(7663); + s.exports = c; + } + ), + /***/ + 8368: ( + /***/ + function(s, l, u) { + var c = u(5063); + s.exports = c; + } + ), + /***/ + 3739: ( + /***/ + function(s, l, u) { + var c = u(6813); + s.exports = c; + } + ), + /***/ + 172: ( + /***/ + function(s, l, u) { + var c = u(6285); + s.exports = c; + } + ), + /***/ + 4963: ( + /***/ + function(s, l, u) { + var c = u(3213); + s.exports = c; + } + ), + /***/ + 7820: ( + /***/ + function(s, l, u) { + var c = u(3512); + s.exports = c; + } + ), + /***/ + 8980: ( + /***/ + function(s, l, u) { + var c = u(8168); + s.exports = c; + } + ), + /***/ + 5636: ( + /***/ + function(s, l, u) { + var c = u(8651); + s.exports = c; + } + ), + /***/ + 6672: ( + /***/ + function(s, l, u) { + var c = u(3083); + s.exports = c; + } + ), + /***/ + 5059: ( + /***/ + function(s, l, u) { + var c = u(2987); + s.exports = c; + } + ), + /***/ + 3969: ( + /***/ + function(s, l, u) { + var c = u(2239); + s.exports = c; + } + ), + /***/ + 6618: ( + /***/ + function(s, l, u) { + var c = u(3154); + u(162), s.exports = c; + } + ), + /***/ + 5279: ( + /***/ + function(s, l, u) { + var c = u(6577); + s.exports = c; + } + ), + /***/ + 9562: ( + /***/ + function(s, l, u) { + u(2906); + var c = u(7545); + s.exports = c.setTimeout; + } + ), + /***/ + 2285: ( + /***/ + function(s, l, u) { + var c = u(5008); + u(162), s.exports = c; + } + ), + /***/ + 8535: ( + /***/ + function(s, l, u) { + var c = u(994); + u(162), s.exports = c; + } + ), + /***/ + 652: ( + /***/ + function(s, l, u) { + var c = u(5668); + s.exports = c; + } + ), + /***/ + 5668: ( + /***/ + function(s, l, u) { + u(4948), u(9801), u(9336); + var c = u(7545); + s.exports = c.URL; + } + ), + /***/ + 2534: ( + /***/ + function(s) { + s.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyBkaXNwbGF5PSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KPGRlZnMgaWQ9InR1aS1pbWFnZS1lZGl0b3Itc3ZnLWRlZmF1bHQtaWNvbnMiPgo8c3ltYm9sIGlkPSJpYy1hcHBseSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIHN0cm9rZT0ibm9uZSIgZmlsbD0ibm9uZSIvPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBkPSJNNCAxMi4wMTFsNSA1TDIwLjAxMSA2Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1jYW5jZWwiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiLz4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgZD0iTTYgNmwxMiAxMk0xOCA2TDYgMTgiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWNyb3AiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBzdHJva2U9Im5vbmUiIGZpbGw9Im5vbmUiIC8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik00IDBoMXYyMGExIDEgMCAwIDEtMS0xVjB6TTIwIDE3aC0xVjVoMXYxMnptMCAydjVoLTF2LTVoMXoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTUgMTloMTl2MUg1ek00Ljc2MiA0djFIMFY0aDQuNzYyek03IDRoMTJhMSAxIDAgMCAxIDEgMUg3VjR6Ii8+Cjwvc3ltYm9sPgo8IS0tIFRoaXMgaWNvbiBtYWRlIGJ5IFBpeGVsIHBlcmZlY3QgZnJvbSB3d3cuZmxhdGljb24uY29tIC0tPgo8c3ltYm9sIGlkPSJpYy1yZXNpemUiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgc3Ryb2tlPSJub25lIiBmaWxsPSJub25lIi8+CiAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNIDE4Ljk4ODI4MSAzLjAxMTcxOSBDIDE4LjgwMDc4MSAyLjgyNDIxOSAxOC41IDIuODI0MjE5IDE4LjMxMjUgMy4wMTE3MTkgTCAxMS42MjEwOTQgOS43MDcwMzEgQyAxMS40Mjk2ODggOS44OTQ1MzEgMTEuNDI5Njg4IDEwLjE5NTMxMiAxMS42MjEwOTQgMTAuMzc4OTA2IEMgMTEuNzEwOTM4IDEwLjQ3MjY1NiAxMS44MzU5MzggMTAuNTE5NTMxIDExLjk1NzAzMSAxMC41MTk1MzEgQyAxMi4wNzgxMjUgMTAuNTE5NTMxIDEyLjIwMzEyNSAxMC40NzI2NTYgMTIuMjkyOTY5IDEwLjM3ODkwNiBMIDE4Ljk4ODI4MSAzLjY4NzUgQyAxOS4xNzU3ODEgMy41IDE5LjE3NTc4MSAzLjE5OTIxOSAxOC45ODgyODEgMy4wMTE3MTkgWiBNIDE4Ljk4ODI4MSAzLjAxMTcxOSAiLz4KICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0gMTguNjUyMzQ0IDIuODY3MTg4IEMgMTguMzg2NzE5IDIuODY3MTg4IDE4LjE3MTg3NSAzLjA4MjAzMSAxOC4xNzE4NzUgMy4zNDc2NTYgTCAxOC4xNzE4NzUgOS4wODU5MzggQyAxOC4xNzE4NzUgOS4zNDc2NTYgMTguMzg2NzE5IDkuNTYyNSAxOC42NTIzNDQgOS41NjI1IEMgMTguOTE3OTY5IDkuNTYyNSAxOS4xMzI4MTIgOS4zNDc2NTYgMTkuMTMyODEyIDkuMDg1OTM4IEwgMTkuMTMyODEyIDMuMzQ3NjU2IEMgMTkuMTMyODEyIDMuMDgyMDMxIDE4LjkxNzk2OSAyLjg2NzE4OCAxOC42NTIzNDQgMi44NjcxODggWiBNIDE4LjY1MjM0NCAyLjg2NzE4OCAiLz4KICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0gMTguNjUyMzQ0IDIuODY3MTg4IEwgMTIuOTE0MDYyIDIuODY3MTg4IEMgMTIuNjUyMzQ0IDIuODY3MTg4IDEyLjQzNzUgMy4wODIwMzEgMTIuNDM3NSAzLjM0NzY1NiBDIDEyLjQzNzUgMy42MTMyODEgMTIuNjUyMzQ0IDMuODI4MTI1IDEyLjkxNDA2MiAzLjgyODEyNSBMIDE4LjY1MjM0NCAzLjgyODEyNSBDIDE4LjkxNzk2OSAzLjgyODEyNSAxOS4xMzI4MTIgMy42MTMyODEgMTkuMTMyODEyIDMuMzQ3NjU2IEMgMTkuMTMyODEyIDMuMDgyMDMxIDE4LjkxNzk2OSAyLjg2NzE4OCAxOC42NTIzNDQgMi44NjcxODggWiBNIDE4LjY1MjM0NCAyLjg2NzE4OCAiLz4KICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0gMTAuMzc4OTA2IDExLjYyMTA5NCBDIDEwLjE5NTMxMiAxMS40MzM1OTQgOS44OTA2MjUgMTEuNDMzNTk0IDkuNzAzMTI1IDExLjYyMTA5NCBMIDMuMDA3ODEyIDE4LjMxNjQwNiBDIDIuODIwMzEyIDE4LjUgMi44MjAzMTIgMTguODA0Njg4IDMuMDA3ODEyIDE4Ljk5MjE4OCBDIDMuMTA1NDY5IDE5LjA4NTkzOCAzLjIyNjU2MiAxOS4xMzI4MTIgMy4zNDc2NTYgMTkuMTMyODEyIEMgMy40Njg3NSAxOS4xMzI4MTIgMy41ODk4NDQgMTkuMDg1OTM4IDMuNjgzNTk0IDE4Ljk5MjE4OCBMIDEwLjM3ODkwNiAxMi4yOTY4NzUgQyAxMC41NjY0MDYgMTIuMTA5Mzc1IDEwLjU2NjQwNiAxMS44MDQ2ODggMTAuMzc4OTA2IDExLjYyMTA5NCBaIE0gMTAuMzc4OTA2IDExLjYyMTA5NCAiLz4KICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0gMy4zNDc2NTYgMTIuNDM3NSBDIDMuMDgyMDMxIDEyLjQzNzUgMi44NjcxODggMTIuNjUyMzQ0IDIuODY3MTg4IDEyLjkxNDA2MiBMIDIuODY3MTg4IDE4LjY1MjM0NCBDIDIuODY3MTg4IDE4LjkxNzk2OSAzLjA4MjAzMSAxOS4xMzI4MTIgMy4zNDc2NTYgMTkuMTMyODEyIEMgMy42MTMyODEgMTkuMTMyODEyIDMuODI4MTI1IDE4LjkxNzk2OSAzLjgyODEyNSAxOC42NTIzNDQgTCAzLjgyODEyNSAxMi45MTQwNjIgQyAzLjgyODEyNSAxMi42NTIzNDQgMy42MTMyODEgMTIuNDM3NSAzLjM0NzY1NiAxMi40Mzc1IFogTSAzLjM0NzY1NiAxMi40Mzc1ICIvPgogIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTSA5LjA4NTkzOCAxOC4xNzE4NzUgTCAzLjM0NzY1NiAxOC4xNzE4NzUgQyAzLjA4MjAzMSAxOC4xNzE4NzUgMi44NjcxODggMTguMzg2NzE5IDIuODY3MTg4IDE4LjY1MjM0NCBDIDIuODY3MTg4IDE4LjkxNzk2OSAzLjA4MjAzMSAxOS4xMzI4MTIgMy4zNDc2NTYgMTkuMTMyODEyIEwgOS4wODU5MzggMTkuMTMyODEyIEMgOS4zNDc2NTYgMTkuMTMyODEyIDkuNTYyNSAxOC45MTc5NjkgOS41NjI1IDE4LjY1MjM0NCBDIDkuNTYyNSAxOC4zODY3MTkgOS4zNDc2NTYgMTguMTcxODc1IDkuMDg1OTM4IDE4LjE3MTg3NSBaIE0gOS4wODU5MzggMTguMTcxODc1ICIvPgogIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTSAyMC41NjI1IDAgTCAxLjQzNzUgMCBDIDAuNjQ0NTMxIDAgMCAwLjY0NDUzMSAwIDEuNDM3NSBMIDAgMjAuNTYyNSBDIDAgMjEuMzU1NDY5IDAuNjQ0NTMxIDIyIDEuNDM3NSAyMiBMIDIwLjU2MjUgMjIgQyAyMS4zNTU0NjkgMjIgMjIgMjEuMzU1NDY5IDIyIDIwLjU2MjUgTCAyMiAxLjQzNzUgQyAyMiAwLjY0NDUzMSAyMS4zNTU0NjkgMCAyMC41NjI1IDAgWiBNIDIxLjA0Mjk2OSAyMC41NjI1IEMgMjEuMDQyOTY5IDIwLjgyODEyNSAyMC44MjgxMjUgMjEuMDQyOTY5IDIwLjU2MjUgMjEuMDQyOTY5IEwgMS40Mzc1IDIxLjA0Mjk2OSBDIDEuMTcxODc1IDIxLjA0Mjk2OSAwLjk1NzAzMSAyMC44MjgxMjUgMC45NTcwMzEgMjAuNTYyNSBMIDAuOTU3MDMxIDEuNDM3NSBDIDAuOTU3MDMxIDEuMTcxODc1IDEuMTcxODc1IDAuOTU3MDMxIDEuNDM3NSAwLjk1NzAzMSBMIDIwLjU2MjUgMC45NTcwMzEgQyAyMC44MjgxMjUgMC45NTcwMzEgMjEuMDQyOTY5IDEuMTcxODc1IDIxLjA0Mjk2OSAxLjQzNzUgWiBNIDIxLjA0Mjk2OSAyMC41NjI1ICIvPgo8L3N5bWJvbD4KPCEtLSAgLS0+CjxzeW1ib2wgaWQ9ImljLWRlbGV0ZS1hbGwiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik01IDIzSDNhMSAxIDAgMCAxLTEtMVY2aDF2MTZoMnYxem0xNi0xMGgtMVY2aDF2N3pNOSAxM0g4di0zaDF2M3ptMyAwaC0xdi0zaDF2M3ptMyAwaC0xdi0zaDF2M3pNMTQuNzk0IDMuNzk0TDEzIDJoLTNMOC4yMDYgMy43OTRBLjk2My45NjMgMCAwIDEgOCAyLjVsLjcwMy0xLjA1NUExIDEgMCAwIDEgOS41MzUgMWgzLjkzYTEgMSAwIDAgMSAuODMyLjQ0NUwxNSAyLjVhLjk2NS45NjUgMCAwIDEtLjIwNiAxLjI5NHpNMTQuMTk3IDRIOC44MDNoNS4zOTR6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0wIDNoMjN2MUgwek0xMS4yODYgMjFIOC43MTRMOCAyM0g3bDEtMi44VjIwaC4wNzFMOS41IDE2aDFsMS40MjkgNEgxMnYuMmwxIDIuOGgtMWwtLjcxNC0yem0tLjM1Ny0xTDEwIDE3LjQgOS4wNzEgMjBoMS44NTh6TTIwIDIyaDN2MWgtNHYtN2gxdjZ6bS01IDBoM3YxaC00di03aDF2NnoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWRlbGV0ZSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTMgNnYxNmgxN1Y2aDF2MTZhMSAxIDAgMCAxLTEgMUgzYTEgMSAwIDAgMS0xLTFWNmgxek0xNC43OTQgMy43OTRMMTMgMmgtM0w4LjIwNiAzLjc5NEEuOTYzLjk2MyAwIDAgMSA4IDIuNWwuNzAzLTEuMDU1QTEgMSAwIDAgMSA5LjUzNSAxaDMuOTNhMSAxIDAgMCAxIC44MzIuNDQ1TDE1IDIuNWEuOTY1Ljk2NSAwIDAgMS0uMjA2IDEuMjk0ek0xNC4xOTcgNEg4LjgwM2g1LjM5NHoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTAgM2gyM3YxSDB6TTggMTBoMXY2SDh2LTZ6bTMgMGgxdjZoLTF2LTZ6bTMgMGgxdjZoLTF2LTZ6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1kcmF3LWZyZWUiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIGQ9Ik0yLjUgMjAuOTI5QzIuNTk0IDEwLjk3NiA0LjMyMyA2IDcuNjg2IDZjNS44NzIgMCAyLjUyNCAxOSA3LjY5NyAxOXMxLjg5LTE0LjkyOSA2LjQxNC0xNC45MjkgMS4zNTcgMTAuODU4IDUuMTMgMTAuODU4YzEuODAyIDAgMi42NTctMi4yNjIgMi41NjYtNi43ODYiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWRyYXctbGluZSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgZD0iTTIgMTUuNWgyOCIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtZHJhdyIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgZD0iTTIuNSAyMS41SDVjLjI0NSAwIC40OC0uMDU4LjY5MS0uMTY4bC4xMjQtLjA2NS4xNC4wMWMuNDI5LjAyOC44NS0uMTI3IDEuMTYtLjQzN0wyMi41NSA1LjQwNWEuNS41IDAgMCAwIDAtLjcwN2wtMy4yNDYtMy4yNDVhLjUuNSAwIDAgMC0uNzA3IDBMMy4xNjIgMTYuODg4YTEuNDk1IDEuNDk1IDAgMCAwLS40MzcgMS4xNTVsLjAxLjE0LS4wNjUuMTIzYy0uMTExLjIxMi0uMTcuNDQ4LS4xNy42OTR2Mi41eiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMTYuNDE0IDMuNzA3bDMuODkgMy44OS0uNzA4LjcwNi0zLjg4OS0zLjg4OXoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWZpbHRlciIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTEyIDd2MUgyVjdoMTB6bTYgMGg0djFoLTRWN3pNMTIgMTZ2MWgxMHYtMUgxMnptLTYgMEgydjFoNHYtMXoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTguNSAyMGEzLjUgMy41IDAgMSAxIDAtNyAzLjUgMy41IDAgMCAxIDAgN3ptMC0xYTIuNSAyLjUgMCAxIDAgMC01IDIuNSAyLjUgMCAwIDAgMCA1ek0xNS41IDExYTMuNSAzLjUgMCAxIDEgMC03IDMuNSAzLjUgMCAwIDEgMCA3em0wLTFhMi41IDIuNSAwIDEgMCAwLTUgMi41IDIuNSAwIDAgMCAwIDV6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1mbGlwLXJlc2V0IiB2aWV3Qm94PSIwIDAgMzEgMzIiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBkPSJNMzEgMEgwdjMyaDMxeiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMjggMTZhOCA4IDAgMCAxLTggOEgzdi0xaDF2LTdIM2E4IDggMCAwIDEgOC04aDE3djFoLTF2N2gxek0xMSA5YTcgNyAwIDAgMC03IDd2N2gxNmE3IDcgMCAwIDAgNy03VjlIMTF6Ii8+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiIGQ9Ik0yNCA1bDMuNSAzLjVMMjQgMTJNNyAyMGwtMy41IDMuNUw3IDI3Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1mbGlwLXgiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGQ9Ik0zMiAzMkgwVjBoMzJ6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0xNyAzMmgtMVYwaDF6TTI3LjE2NyAxMWwuNSAzaC0xLjAzbC0uNTQ2LTNoMS4wNzZ6bS0uNS0zaC0xLjEyMkwyNSA1aC01VjRoNS4xNTNhMSAxIDAgMCAxIC45ODYuODM2TDI2LjY2NyA4em0xLjUgOWwuNSAzaC0uOTRsLS41NDUtM2guOTg1em0xIDZsLjYzOSAzLjgzNkExIDEgMCAwIDEgMjguODE5IDI4SDI2di0xaDNsLS43MjYtNGguODk0ek0yMyAyOGgtM3YtMWgzdjF6TTEzIDR2MUg3TDMgMjdoMTB2MUgzLjE4YTEgMSAwIDAgMS0uOTg2LTEuMTY0bDMuNjY2LTIyQTEgMSAwIDAgMSA2Ljg0NyA0SDEzeiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtZmxpcC15IiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBkPSJNMCAwdjMyaDMyVjB6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0wIDE2djFoMzJ2LTF6TTExIDI3LjE2N2wzIC41di0xLjAzbC0zLS41NDZ2MS4wNzZ6bS0zLS41di0xLjEyMkw1IDI1di01SDR2NS4xNTNhMSAxIDAgMCAwIC44MzYuOTg2TDggMjYuNjY3em05IDEuNWwzIC41di0uOTRsLTMtLjU0NXYuOTg1em02IDFsMy44MzYuNjM5QTEgMSAwIDAgMCAyOCAyOC44MlYyNmgtMXYzbC00LS43Mjd2Ljg5NHpNMjggMjN2LTNoLTF2M2gxek00IDEzaDFWN2wyMi00djEwaDFWMy4xOGExIDEgMCAwIDAtMS4xNjQtLjk4NmwtMjIgMy42NjdBMSAxIDAgMCAwIDQgNi44NDdWMTN6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1mbGlwIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiAvPgogICAgPHBhdGggZmlsbD0iaW5oZXJpdCIgc3Ryb2tlPSJub25lIiBkPSJNMTEgMGgxdjI0aC0xek0xOSAyMXYtMWgydi0yaDF2MmExIDEgMCAwIDEtMSAxaC0yem0tMiAwaC0zdi0xaDN2MXptNS01aC0xdi0zaDF2M3ptMC01aC0xVjhoMXYzem0wLTVoLTFWNGgtMlYzaDJhMSAxIDAgMCAxIDEgMXYyem0tNS0zdjFoLTNWM2gzek05IDN2MUgydjE2aDd2MUgyYTEgMSAwIDAgMS0xLTFWNGExIDEgMCAwIDEgMS0xaDd6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5IiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBkPSJNMCAwSDI0VjI0SDB6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNzQwIC0xNikgdHJhbnNsYXRlKDU0NyA4KSB0cmFuc2xhdGUoMTkzIDgpIi8+CiAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBzdHJva2U9Im5vbmUiIGQ9Ik0xMi41IDFDMTguMjk5IDEgMjMgNS43MDEgMjMgMTEuNVMxOC4yOTkgMjIgMTIuNSAyMmMtNS4yOSAwLTkuNjY1LTMuOTExLTEwLjM5NC04Ljk5OWgxLjAxMkMzLjgzOCAxNy41MzQgNy43NjQgMjEgMTIuNSAyMWM1LjI0NyAwIDkuNS00LjI1MyA5LjUtOS41UzE3Ljc0NyAyIDEyLjUgMkM4LjQ5IDIgNS4wNiA0LjQ4NSAzLjY2NiA4SDNoNHYxSDJWNGgxdjMuMDIyQzQuNjggMy40NjIgOC4zMDMgMSAxMi41IDF6bS41IDVsLS4wMDEgNS4yOTEgMi41MzcgMi41MzctLjcwOC43MDhMMTIuMjkyIDEySDEyVjZoMXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC03NDAgLTE2KSB0cmFuc2xhdGUoNTQ3IDgpIHRyYW5zbGF0ZSgxOTMgOCkiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWhpc3RvcnktY2hlY2siIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiID4KICAgICAgICA8cGF0aCBzdHJva2U9IiM1NTU1NTUiIGQ9Ik00LjUgLTFMMS41IDIgNi41IDciIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02MCAtODA0KSB0cmFuc2xhdGUoNjAgODA0KSB0cmFuc2xhdGUoMiAzKSByb3RhdGUoLTkwIDQgMykiIC8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LWNyb3AiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxwYXRoIGQ9Ik0wIDBIMTJWMTJIMHoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC04NCAtODA0KSB0cmFuc2xhdGUoODQgODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0yIDBoMXYxMGMtLjU1MiAwLTEtLjQ0OC0xLTFWMHpNMTAgOXYzSDlWOWgxek05IDJoMXY2SDlWMnoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC04NCAtODA0KSB0cmFuc2xhdGUoODQgODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0yIDlIMTJWMTBIMnpNOSAyYy41MTMgMCAuOTM2LjM4Ni45OTMuODgzTDEwIDNIM1YyaDZ6TTIgM0gwVjJoMnYxeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTg0IC04MDQpIHRyYW5zbGF0ZSg4NCA4MDQpIi8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8IS0tIFRoaXMgaWNvbiBtYWRlIGJ5IFBpeGVsIHBlcmZlY3QgZnJvbSB3d3cuZmxhdGljb24uY29tIC0tPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LXJlc2l6ZSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTSA5LjQ5MjE4OCAxLjUwNzgxMiBDIDkuMzk4NDM4IDEuNDE0MDYyIDkuMjUgMS40MTQwNjIgOS4xNTYyNSAxLjUwNzgxMiBMIDUuODEyNSA0Ljg1MTU2MiBDIDUuNzE0ODQ0IDQuOTQ1MzEyIDUuNzE0ODQ0IDUuMDk3NjU2IDUuODEyNSA1LjE4NzUgQyA1Ljg1NTQ2OSA1LjIzNDM3NSA1LjkxNzk2OSA1LjI1NzgxMiA1Ljk3NjU2MiA1LjI1NzgxMiBDIDYuMDM5MDYyIDUuMjU3ODEyIDYuMTAxNTYyIDUuMjM0Mzc1IDYuMTQ4NDM4IDUuMTg3NSBMIDkuNDkyMTg4IDEuODQzNzUgQyA5LjU4NTkzOCAxLjc1IDkuNTg1OTM4IDEuNjAxNTYyIDkuNDkyMTg4IDEuNTA3ODEyIFogTSA5LjQ5MjE4OCAxLjUwNzgxMiAiLz4KICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0gOS4zMjgxMjUgMS40MzM1OTQgQyA5LjE5NTMxMiAxLjQzMzU5NCA5LjA4NTkzOCAxLjUzOTA2MiA5LjA4NTkzOCAxLjY3MTg3NSBMIDkuMDg1OTM4IDQuNTQyOTY5IEMgOS4wODU5MzggNC42NzE4NzUgOS4xOTUzMTIgNC43ODEyNSA5LjMyODEyNSA0Ljc4MTI1IEMgOS40NjA5MzggNC43ODEyNSA5LjU2NjQwNiA0LjY3MTg3NSA5LjU2NjQwNiA0LjU0Mjk2OSBMIDkuNTY2NDA2IDEuNjcxODc1IEMgOS41NjY0MDYgMS41MzkwNjIgOS40NjA5MzggMS40MzM1OTQgOS4zMjgxMjUgMS40MzM1OTQgWiBNIDkuMzI4MTI1IDEuNDMzNTk0ICIvPgogICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTSA5LjMyODEyNSAxLjQzMzU5NCBMIDYuNDU3MDMxIDEuNDMzNTk0IEMgNi4zMjgxMjUgMS40MzM1OTQgNi4yMTg3NSAxLjUzOTA2MiA2LjIxODc1IDEuNjcxODc1IEMgNi4yMTg3NSAxLjgwNDY4OCA2LjMyODEyNSAxLjkxNDA2MiA2LjQ1NzAzMSAxLjkxNDA2MiBMIDkuMzI4MTI1IDEuOTE0MDYyIEMgOS40NjA5MzggMS45MTQwNjIgOS41NjY0MDYgMS44MDQ2ODggOS41NjY0MDYgMS42NzE4NzUgQyA5LjU2NjQwNiAxLjUzOTA2MiA5LjQ2MDkzOCAxLjQzMzU5NCA5LjMyODEyNSAxLjQzMzU5NCBaIE0gOS4zMjgxMjUgMS40MzM1OTQgIi8+CiAgICA8cGF0aCBmaWxsPSIjNDM0MzQzIiBkPSJNIDUuMTg3NSA1LjgxMjUgQyA1LjA5NzY1NiA1LjcxODc1IDQuOTQ1MzEyIDUuNzE4NzUgNC44NTE1NjIgNS44MTI1IEwgMS41MDM5MDYgOS4xNTYyNSBDIDEuNDEwMTU2IDkuMjUgMS40MTAxNTYgOS40MDIzNDQgMS41MDM5MDYgOS40OTYwOTQgQyAxLjU1NDY4OCA5LjU0Mjk2OSAxLjYxMzI4MSA5LjU2NjQwNiAxLjY3MTg3NSA5LjU2NjQwNiBDIDEuNzM0Mzc1IDkuNTY2NDA2IDEuNzk2ODc1IDkuNTQyOTY5IDEuODQzNzUgOS40OTYwOTQgTCA1LjE4NzUgNi4xNDg0MzggQyA1LjI4MTI1IDYuMDU0Njg4IDUuMjgxMjUgNS45MDIzNDQgNS4xODc1IDUuODEyNSBaIE0gNS4xODc1IDUuODEyNSAiLz4KICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0gMS42NzE4NzUgNi4yMTg3NSBDIDEuNTM5MDYyIDYuMjE4NzUgMS40MzM1OTQgNi4zMjgxMjUgMS40MzM1OTQgNi40NTcwMzEgTCAxLjQzMzU5NCA5LjMyODEyNSBDIDEuNDMzNTk0IDkuNDYwOTM4IDEuNTM5MDYyIDkuNTY2NDA2IDEuNjcxODc1IDkuNTY2NDA2IEMgMS44MDQ2ODggOS41NjY0MDYgMS45MTQwNjIgOS40NjA5MzggMS45MTQwNjIgOS4zMjgxMjUgTCAxLjkxNDA2MiA2LjQ1NzAzMSBDIDEuOTE0MDYyIDYuMzI4MTI1IDEuODA0Njg4IDYuMjE4NzUgMS42NzE4NzUgNi4yMTg3NSBaIE0gMS42NzE4NzUgNi4yMTg3NSAiLz4KICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0gNC41NDI5NjkgOS4wODU5MzggTCAxLjY3MTg3NSA5LjA4NTkzOCBDIDEuNTM5MDYyIDkuMDg1OTM4IDEuNDMzNTk0IDkuMTk1MzEyIDEuNDMzNTk0IDkuMzI4MTI1IEMgMS40MzM1OTQgOS40NjA5MzggMS41MzkwNjIgOS41NjY0MDYgMS42NzE4NzUgOS41NjY0MDYgTCA0LjU0Mjk2OSA5LjU2NjQwNiBDIDQuNjcxODc1IDkuNTY2NDA2IDQuNzgxMjUgOS40NjA5MzggNC43ODEyNSA5LjMyODEyNSBDIDQuNzgxMjUgOS4xOTUzMTIgNC42NzE4NzUgOS4wODU5MzggNC41NDI5NjkgOS4wODU5MzggWiBNIDQuNTQyOTY5IDkuMDg1OTM4ICIvPgogICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTSAxMC4yODEyNSAwIEwgMC43MTg3NSAwIEMgMC4zMjAzMTIgMCAwIDAuMzIwMzEyIDAgMC43MTg3NSBMIDAgMTAuMjgxMjUgQyAwIDEwLjY3OTY4OCAwLjMyMDMxMiAxMSAwLjcxODc1IDExIEwgMTAuMjgxMjUgMTEgQyAxMC42Nzk2ODggMTEgMTEgMTAuNjc5Njg4IDExIDEwLjI4MTI1IEwgMTEgMC43MTg3NSBDIDExIDAuMzIwMzEyIDEwLjY3OTY4OCAwIDEwLjI4MTI1IDAgWiBNIDEwLjUyMzQzOCAxMC4yODEyNSBDIDEwLjUyMzQzOCAxMC40MTQwNjIgMTAuNDE0MDYyIDEwLjUyMzQzOCAxMC4yODEyNSAxMC41MjM0MzggTCAwLjcxODc1IDEwLjUyMzQzOCBDIDAuNTg1OTM4IDEwLjUyMzQzOCAwLjQ3NjU2MiAxMC40MTQwNjIgMC40NzY1NjIgMTAuMjgxMjUgTCAwLjQ3NjU2MiAwLjcxODc1IEMgMC40NzY1NjIgMC41ODU5MzggMC41ODU5MzggMC40NzY1NjIgMC43MTg3NSAwLjQ3NjU2MiBMIDEwLjI4MTI1IDAuNDc2NTYyIEMgMTAuNDE0MDYyIDAuNDc2NTYyIDEwLjUyMzQzOCAwLjU4NTkzOCAxMC41MjM0MzggMC43MTg3NSBaIE0gMTAuNTIzNDM4IDEwLjI4MTI1ICIvPgogIDwvZz4KPC9zeW1ib2w+CjwhLS0gIC0tPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LWRyYXciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxwYXRoIGQ9Ik0wIDFIMTJWMTNIMHoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTgwNCkgdHJhbnNsYXRlKDE1NiA4MDMpIi8+CiAgICAgICAgPHBhdGggc3Ryb2tlPSIjNDM0MzQzIiBkPSJNOS42MjIgMS41ODRsMS44MzUgMS42NTgtOC4zMSA4LjQwN0wuNSAxMi41VjExbDkuMTIyLTkuNDE2eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1NiAtODA0KSB0cmFuc2xhdGUoMTU2IDgwMykiLz4KICAgICAgICA8cGF0aCBmaWxsPSIjNDM0MzQzIiBkPSJNNy42MjggMy43NTNMMTAuMzc4IDMuNzUzIDEwLjM3OCA0LjI1MyA3LjYyOCA0LjI1M3oiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTgwNCkgdHJhbnNsYXRlKDE1NiA4MDMpIHJvdGF0ZSg0NSA5LjAwMyA0LjAwMykiLz4KICAgIDwvZz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWhpc3RvcnktZmlsdGVyIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiID4KICAgICAgICA8cGF0aCBkPSJNMCAwSDEyVjEySDB6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjc2IC04MDQpIHRyYW5zbGF0ZSgyNzYgODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0xMiAzdjFIOVYzaDN6TTcgNEgwVjNoN3YxeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI3NiAtODA0KSB0cmFuc2xhdGUoMjc2IDgwNCkiLz4KICAgICAgICA8cGF0aCBmaWxsPSIjNDM0MzQzIiBkPSJNMTIgOHYxSDlWOGgzek03IDlIMFY4aDd2MXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNzYgLTgwNCkgdHJhbnNsYXRlKDI3NiA4MDQpIG1hdHJpeCgtMSAwIDAgMSAxMiAwKSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik04IDFjMS4xMDUgMCAyIC44OTUgMiAycy0uODk1IDItMiAyLTItLjg5NS0yLTIgLjg5NS0yIDItMnptMCAxYy0uNTUyIDAtMSAuNDQ4LTEgMXMuNDQ4IDEgMSAxIDEtLjQ0OCAxLTEtLjQ0OC0xLTEtMXpNNCA3YzEuMTA1IDAgMiAuODk1IDIgMnMtLjg5NSAyLTIgMi0yLS44OTUtMi0yIC44OTUtMiAyLTJ6bTAgMWMtLjU1MiAwLTEgLjQ0OC0xIDFzLjQ0OCAxIDEgMSAxLS40NDggMS0xLS40NDgtMS0xLTF6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjc2IC04MDQpIHRyYW5zbGF0ZSgyNzYgODA0KSIvPgogICAgPC9nPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaGlzdG9yeS1mbGlwIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiID4KICAgICAgICA8cGF0aCBkPSJNMCAwSDEyVjEySDB6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTA4IC04MDQpIHRyYW5zbGF0ZSgxMDggODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik02IDBMNyAwIDcgMTIgNiAxMnpNMTEgMTBWOWgxdjEuNWMwIC4yNzYtLjIyNC41LS41LjVIMTB2LTFoMXpNNSAxdjFIMXY4aDR2MUguNWMtLjI3NiAwLS41LS4yMjQtLjUtLjV2LTljMC0uMjc2LjIyNC0uNS41LS41SDV6bTcgNXYyaC0xVjZoMXptMC0zdjJoLTFWM2gxek05IDF2MUg3VjFoMnptMi41IDBjLjI3NiAwIC41LjIyNC41LjVWMmgtMlYxaDEuNXpNOSAxMUg3di0xaDJ2MXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMDggLTgwNCkgdHJhbnNsYXRlKDEwOCA4MDQpIi8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LWljb24iIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxwYXRoIGQ9Ik0wIDBIMTJWMTJIMHoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMDQgLTgwNCkgdHJhbnNsYXRlKDIwNCA4MDQpIi8+CiAgICAgICAgPHBhdGggc3Ryb2tlPSIjNDM0MzQzIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS4xIiBkPSJNNiA5LjU2OEwyLjYwMSAxMSAyLjk3NSA3LjQ2NyAwLjUgNC44MiA0LjEzIDQuMDY4IDYgMSA3Ljg3IDQuMDY4IDExLjUgNC44MiA5LjAyNSA3LjQ2NyA5LjM5OSAxMXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMDQgLTgwNCkgdHJhbnNsYXRlKDIwNCA4MDQpIi8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LW1hc2siIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNTIgLTgwNCkgdHJhbnNsYXRlKDI1MiA4MDQpIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAgMEgxMlYxMkgweiIvPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSI2IiBjeT0iNiIgcj0iMi41IiBzdHJva2U9IiM0NDQiLz4KICAgICAgICAgICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTTExLjUgMGMuMjc2IDAgLjUuMjI0LjUuNXYxMWMwIC4yNzYtLjIyNC41LS41LjVILjVjLS4yNzYgMC0uNS0uMjI0LS41LS41Vi41QzAgLjIyNC4yMjQgMCAuNSAwaDExek0xMSAxSDF2MTBoMTBWMXoiLz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oaXN0b3J5LXJvdGF0ZSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxkZWZzPgogICAgICAgIDxwYXRoIGlkPSJyZm40cnlsZmZhIiBkPSJNNyAxMmMtLjMzNSAwLS42NjMtLjAyNS0uOTgzLS4wNzRDMy4xNzEgMTEuNDkyIDEgOS4yMDUgMSA2LjQ0NGMwLTEuMzYzLjUzNC0yLjYxMyAxLjQxNS0zLjU4Ii8+CiAgICAgICAgPG1hc2sgaWQ9IjZmOWduMmR5c2IiIHdpZHRoPSI2IiBoZWlnaHQ9IjkuMTM2IiB4PSIwIiB5PSIwIiBtYXNrVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94Ij4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjcmZuNHJ5bGZmYSIgc3Ryb2tlPSI0MzQzNDMiLz4KICAgICAgICA8L21hc2s+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMzIgLTgwNCkgdHJhbnNsYXRlKDEzMiA4MDQpIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAgMC41SDEyVjEyLjVIMHoiLz4KICAgICAgICAgICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTTYuNSAxQzkuNTM4IDEgMTIgMy40NjIgMTIgNi41YzAgMi4zNy0xLjUgNC4zOS0zLjYgNS4xNjNsLS40MDctLjkxNkM5Ljc0NCAxMC4xMyAxMSA4LjQ2MiAxMSA2LjUgMTEgNC4wMTUgOC45ODUgMiA2LjUgMmMtLjc3NyAwLTEuNTA5LjE5Ny0yLjE0Ny41NDRMNCAxLjc1bC0uMjA1LS4wNEM0LjU5NCAxLjI1OCA1LjUxNyAxIDYuNSAxeiIvPgogICAgICAgICAgICA8dXNlIHN0cm9rZT0iIzQzNDM0MyIgc3Ryb2tlLWRhc2hhcnJheT0iMiAxLjI1IiBzdHJva2Utd2lkdGg9IjEiIG1hc2s9InVybCgjNmY5Z24yZHlzYikiIHhsaW5rOmhyZWY9IiNyZm40cnlsZmZhIi8+CiAgICAgICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik00LjI3OSAwTDYgMS43NSA0LjI1IDMuNTcxIDMuNTQzIDIuODY0IDQuNTg2IDEuNzUgMy41NzIgMC43MDd6IiB0cmFuc2Zvcm09Im1hdHJpeCgtMSAwIDAgMSA5LjU0MyAwKSIvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWhpc3Rvcnktc2hhcGUiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyBmaWxsPSJub25lIiBzdHJva2U9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgPgogICAgICAgIDxwYXRoIGQ9Ik0wIDBIMTJWMTJIMHoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xODAgLTgwNCkgdHJhbnNsYXRlKDE4MCA4MDQpIi8+CiAgICAgICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTTExLjUgNGMuMjc2IDAgLjUuMjI0LjUuNXY3YzAgLjI3Ni0uMjI0LjUtLjUuNWgtN2MtLjI3NiAwLS41LS4yMjQtLjUtLjVWOC44aDFWMTFoNlY1SDguMzQxbC0uNTY4LTFIMTEuNXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xODAgLTgwNCkgdHJhbnNsYXRlKDE4MCA4MDQpIi8+CiAgICAgICAgPHBhdGggc3Ryb2tlPSIjNDM0MzQzIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik00LjUgMC41TDguNSA3LjYxMSAwLjUgNy42MTF6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTgwIC04MDQpIHRyYW5zbGF0ZSgxODAgODA0KSIvPgogICAgPC9nPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaGlzdG9yeS10ZXh0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiID4KICAgICAgICA8cGF0aCBkPSJNMCAwSDEyVjEySDB6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjI4IC04MDQpIHRyYW5zbGF0ZSgyMjggODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0yIDFoOGMuNTUyIDAgMSAuNDQ4IDEgMUgxYzAtLjU1Mi40NDgtMSAxLTF6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjI4IC04MDQpIHRyYW5zbGF0ZSgyMjggODA0KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik0xIDFIMlYzSDF6TTEwIDFIMTFWM0gxMHpNNS41IDFMNi41IDEgNi41IDExIDUuNSAxMXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMjggLTgwNCkgdHJhbnNsYXRlKDIyOCA4MDQpIi8+CiAgICAgICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTTQgMTBIOFYxMUg0eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIyOCAtODA0KSB0cmFuc2xhdGUoMjI4IDgwNCkiLz4KICAgIDwvZz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWhpc3RvcnktbG9hZCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cGF0aCBkPSJNMCAwSDEyVjEySDB6IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzI0IC04MDUpIHRyYW5zbGF0ZSgzMjQgODA1KSIvPgogICAgICAgIDxwYXRoIGZpbGw9IiM0MzQzNDMiIGQ9Ik01IDBjLjU1MiAwIDEgLjQ0OCAxIDF2MWg1LjVjLjI3NiAwIC41LjIyNC41LjV2OGMwIC4yNzYtLjIyNC41LS41LjVILjVjLS4yNzYgMC0uNS0uMjI0LS41LS41VjFjMC0uNTUyLjQ0OC0xIDEtMWg0em0wIDFIMXY5aDEwVjNINVYxeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTMyNCAtODA1KSB0cmFuc2xhdGUoMzI0IDgwNSkiLz4KICAgICAgICA8cGF0aCBmaWxsPSIjNDM0MzQzIiBkPSJNMSAyTDUgMiA1IDMgMSAzeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTMyNCAtODA1KSB0cmFuc2xhdGUoMzI0IDgwNSkiLz4KICAgIDwvZz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWhpc3RvcnktZGVsZXRlIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGZpbGw9IiM0MzQzNDMiPgogICAgICAgICAgICA8cGF0aCBkPSJNMiA5aDhWMWgxdjguNWMwIC4yNzYtLjIyNC41LS41LjVoLTljLS4yNzYgMC0uNS0uMjI0LS41LS41VjFoMXY4ek0wIDBIMTJWMUgweiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTMwMCAtODA0KSB0cmFuc2xhdGUoMzAwIDgwNCkgdHJhbnNsYXRlKDAgMikiLz4KICAgICAgICAgICAgPHBhdGggZD0iTTQgM0g1VjdINHpNNyAzSDhWN0g3eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTMwMCAtODA0KSB0cmFuc2xhdGUoMzAwIDgwNCkgdHJhbnNsYXRlKDAgMikiLz4KICAgICAgICAgICAgPHBhdGggZD0iTTQgMWg0VjBoMXYxLjVjMCAuMjc2LS4yMjQuNS0uNS41aC01Yy0uMjc2IDAtLjUtLjIyNC0uNS0uNVYwaDF2MXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMDAgLTgwNCkgdHJhbnNsYXRlKDMwMCA4MDQpIG1hdHJpeCgxIDAgMCAtMSAwIDIpIi8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaGlzdG9yeS1ncm91cCIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxnIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzQ4IC04MDQpIHRyYW5zbGF0ZSgzNDggODA0KSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wIDBIMTJWMTJIMHoiLz4KICAgICAgICAgICAgPHBhdGggZmlsbD0iIzQzNDM0MyIgZD0iTTEgOXYyaDF2MUguNWMtLjI3NiAwLS41LS4yMjQtLjUtLjVWOWgxem0xMSAxdjEuNWMwIC4yNzYtLjIyNC41LS41LjVIOXYtMWgydi0xaDF6bS00IDF2MUg2di0xaDJ6bS0zIDB2MUgzdi0xaDJ6bTctNHYyaC0xVjdoMXpNMSA2djJIMFY2aDF6bTExLTJ2MmgtMVY0aDF6TTEgM3YySDBWM2gxem0xMC41LTNjLjI3NiAwIC41LjIyNC41LjVWM2gtMVYxaC0xVjBoMS41ek02IDB2MUg0VjBoMnptMyAwdjFIN1YwaDJ6TTAgLjVDMCAuMjI0LjIyNCAwIC41IDBIM3YxSDF2MUgwVi41ek05LjUgNGMuMjc2IDAgLjUuMjI0LjUuNXY1YzAgLjI3Ni0uMjI0LjUtLjUuNWgtNWMtLjI3NiAwLS41LS4yMjQtLjUtLjVWOC4zNTVjLjMxNy4wOTQuNjUyLjE0NSAxIC4xNDVWOWg0VjVoLS41YzAtLjM0OC0uMDUtLjY4My0uMTQ1LTFIOS41eiIvPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSI1IiBjeT0iNSIgcj0iMi41IiBzdHJva2U9IiM0MzQzNDMiLz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1pY29uLWFycm93LTIiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTIxLjc5MyAxOC41SDIuNXYtNWgxOC45MzVsLTcuNi04aDUuODcybDEwLjUgMTAuNS0xMC41IDEwLjVoLTUuOTE0bDgtOHoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWljb24tYXJyb3ctMyIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNMjUuMjg4IDE2LjQyTDE0LjIwOCAyNy41SDYuNzkybDExLjI5MS0xMS4yOTFMNi44MjYgNC41aDcuMzgxbDExLjY2MSAxMS42NjEtLjU4LjI1OHoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWljb24tYXJyb3ciIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIGQ9Ik0yLjUgMTEuNXY5aDE4djUuMjkzTDMwLjI5MyAxNiAyMC41IDYuMjA3VjExLjVoLTE4eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbi1idWJibGUiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTIyLjIwNyAyNC41TDE2LjUgMzAuMjA3VjI0LjVIOEE2LjUgNi41IDAgMCAxIDEuNSAxOFY5QTYuNSA2LjUgMCAwIDEgOCAyLjVoMTZBNi41IDYuNSAwIDAgMSAzMC41IDl2OWE2LjUgNi41IDAgMCAxLTYuNSA2LjVoLTEuNzkzeiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbi1oZWFydCIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBkPSJNMTUuOTk2IDMwLjY3NWwxLjk4MS0xLjc5YzcuODk4LTcuMTc3IDEwLjM2NS05LjcxOCAxMi4xMzUtMTMuMDEyLjkyMi0xLjcxNiAxLjM3Ny0zLjM3IDEuMzc3LTUuMDc2IDAtNC42NS0zLjY0Ny04LjI5Ny04LjI5Ny04LjI5Ny0yLjMzIDAtNC44NiAxLjUyNy02LjgxNyAzLjgyNGwtLjM4LjQ0Ny0uMzgxLS40NDdDMTMuNjU4IDQuMDI3IDExLjEyNiAyLjUgOC43OTcgMi41IDQuMTQ3IDIuNS41IDYuMTQ3LjUgMTAuNzk3YzAgMS43MTQuNDYgMy4zNzUgMS4zODkgNS4wOTggMS43NzUgMy4yODggNC4yNiA1Ljg0MyAxMi4xMjMgMTIuOTc0bDEuOTg0IDEuODA2eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbi1sb2FkIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xNy4zMTQgMTguODY3bDEuOTUxLTIuNTMgNCA1LjE4NGgtMTdsNi41LTguODQgNC41NDkgNi4xODZ6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0xOC4wMSA0YTExLjc5OCAxMS43OTggMCAwIDAgMCAxSDN2MjRoMjRWMTQuOTg2YTguNzM4IDguNzM4IDAgMCAwIDEgMFYyOWExIDEgMCAwIDEtMSAxSDNhMSAxIDAgMCAxLTEtMVY1YTEgMSAwIDAgMSAxLTFoMTUuMDF6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0yNSAzaDF2OWgtMXoiLz4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgZD0iTTIyIDZsMy41LTMuNUwyOSA2Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1pY29uLWxvY2F0aW9uIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBkPSJNMTYgMzEuMjhDMjMuNjc1IDIzLjMwMiAyNy41IDE3LjE4MSAyNy41IDEzYzAtNi4zNTEtNS4xNDktMTEuNS0xMS41LTExLjVTNC41IDYuNjQ5IDQuNSAxM2MwIDQuMTgxIDMuODI1IDEwLjMwMiAxMS41IDE4LjI4eiIvPgogICAgPGNpcmNsZSBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIGN4PSIxNiIgY3k9IjEzIiByPSI0LjUiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLWljb24tcG9seWdvbiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgZD0iTS41NzYgMTZMOC4yOSAyOS41aDE1LjQyTDMxLjQyNCAxNiAyMy43MSAyLjVIOC4yOUwuNTc2IDE2eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbi1zdGFyLTIiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIGQ9Ik0xOS40NDYgMzEuNTkybDIuMjY1LTMuMjcyIDMuOTQ2LjI1LjYzNi0zLjk0IDMuNjY1LTEuNTA1LTEuMTItMy44MzIgMi42NTUtMi45NjItMi42NTYtMi45NjIgMS4xMi0zLjgzMi0zLjY2NC0xLjUwNS0uNjM2LTMuOTQxLTMuOTQ2LjI1LTIuMjY1LTMuMjcxTDE2IDMuMDI0IDEyLjU1NCAxLjA3IDEwLjI4OSA0LjM0bC0zLjk0Ni0uMjUtLjYzNiAzLjk0MS0zLjY2NSAxLjUwNSAxLjEyIDMuODMyTC41MDggMTYuMzNsMi42NTYgMi45NjItMS4xMiAzLjgzMiAzLjY2NCAxLjUwNC42MzYgMy45NDIgMy45NDYtLjI1IDIuMjY1IDMuMjdMMTYgMjkuNjM4bDMuNDQ2IDEuOTU1eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbi1zdGFyIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBkPSJNMjUuMjkyIDI5Ljg3OGwtMS43NzUtMTAuMzQ2IDcuNTE3LTcuMzI3LTEwLjM4OC0xLjUxTDE2IDEuMjgybC00LjY0NiA5LjQxMy0xMC4zODggMS41MSA3LjUxNyA3LjMyNy0xLjc3NSAxMC4zNDZMMTYgMjQuOTkzbDkuMjkyIDQuODg1eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtaWNvbiIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNMTEuOTIzIDE5LjEzNkw1LjQyNCAyMmwuNzE1LTcuMDY1LTQuNzMxLTUuMjk2IDYuOTQtMS41MDNMMTEuOTIzIDJsMy41NzQgNi4xMzYgNi45NCAxLjUwMy00LjczMSA1LjI5NkwxOC40MiAyMnoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLW1hc2stbG9hZCIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMTguMDEgNGExMS43OTggMTEuNzk4IDAgMCAwIDAgMUgzdjI0aDI0VjE0Ljk4NmE4LjczOCA4LjczOCAwIDAgMCAxIDBWMjlhMSAxIDAgMCAxLTEgMUgzYTEgMSAwIDAgMS0xLTFWNWExIDEgMCAwIDEgMS0xaDE1LjAxek0xNSAyM2E2IDYgMCAxIDEgMC0xMiA2IDYgMCAwIDEgMCAxMnptMC0xYTUgNSAwIDEgMCAwLTEwIDUgNSAwIDAgMCAwIDEweiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMjUgM2gxdjloLTF6Ii8+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIGQ9Ik0yMiA2bDMuNS0zLjVMMjkgNiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtbWFzayIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjQuNSIgc3Ryb2tlPSJpbmhlcml0IiBmaWxsPSJub25lIi8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0yIDFoMjBhMSAxIDAgMCAxIDEgMXYyMGExIDEgMCAwIDEtMSAxSDJhMSAxIDAgMCAxLTEtMVYyYTEgMSAwIDAgMSAxLTF6bTAgMXYyMGgyMFYySDJ6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1yZWRvIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgb3BhY2l0eT0iLjUiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTIxIDZIOWE2IDYgMCAxIDAgMCAxMmgxMnYxSDlBNyA3IDAgMCAxIDkgNWgxMnYxeiIvPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIiBkPSJNMTkgM2wyLjUgMi41TDE5IDgiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXJlc2V0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgb3BhY2l0eT0iLjUiIHN0cm9rZT0ibm9uZSIgZmlsbD0ibm9uZSIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMiAxM3YtMWE3IDcgMCAwIDEgNy03aDEzdjFoLTF2NWgxdjFhNyA3IDAgMCAxLTcgN0gydi0xaDF2LTVIMnptNy03YTYgNiAwIDAgMC02IDZ2NmgxMmE2IDYgMCAwIDAgNi02VjZIOXoiLz4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0iaW5oZXJpdCIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgZD0iTTE5IDNsMi41IDIuNUwxOSA4TTUgMTZsLTIuNSAyLjVMNSAyMSIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtcm90YXRlLWNsb2Nrd2lzZSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTI5IDE3aC0uOTI0YzAgNi42MjctNS4zNzMgMTItMTIgMTItNi42MjggMC0xMi01LjM3My0xMi0xMkM0LjA3NiAxMC4zOTggOS40MDcgNS4wNDEgMTYgNVY0QzguODIgNCAzIDkuODIgMyAxN3M1LjgyIDEzIDEzIDEzIDEzLTUuODIgMTMtMTN6Ii8+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiIGQ9Ik0xNiAxLjVsNCAzLTQgMyIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik0xNiA0aDR2MWgtNHoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXJvdGF0ZS1jb3VudGVyY2xvY2t3aXNlIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBkPSJNMyAxN2guOTI0YzAgNi42MjcgNS4zNzMgMTIgMTIgMTIgNi42MjggMCAxMi01LjM3MyAxMi0xMiAwLTYuNjAyLTUuMzMxLTExLjk2LTExLjkyNC0xMlY0YzcuMTggMCAxMyA1LjgyIDEzIDEzcy01LjgyIDEzLTEzIDEzUzMgMjQuMTggMyAxN3oiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNMTIgNGg0djFoLTR6Ii8+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiIGQ9Ik0xNiAxLjVsLTQgMyA0IDMiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXJvdGF0ZSIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgLz4KICAgIDxwYXRoIGZpbGw9ImluaGVyaXQiIHN0cm9rZT0ibm9uZSIgZD0iTTguMzQ5IDIyLjI1NGExMC4wMDIgMTAuMDAyIDAgMCAxLTIuNzc4LTEuNzE5bC42NS0uNzZhOS4wMDIgOS4wMDIgMCAwIDAgMi40OTUgMS41NDhsLS4zNjcuOTMxem0yLjg3My43MDRsLjA3OC0uOTk3YTkgOSAwIDEgMC0uNTU3LTE3Ljg1MmwtLjE0LS45OUExMC4wNzYgMTAuMDc2IDAgMCAxIDEyLjE0NSAzYzUuNTIzIDAgMTAgNC40NzcgMTAgMTBzLTQuNDc3IDEwLTEwIDEwYy0uMzEyIDAtLjYyLS4wMTQtLjkyNC0uMDQyem0tNy41NTYtNC42NTVhOS45NDIgOS45NDIgMCAwIDEtMS4yNTMtMi45OTZsLjk3My0uMjM0YTguOTQ4IDguOTQ4IDAgMCAwIDEuMTI0IDIuNjkzbC0uODQ0LjUzN3ptLTEuNTAyLTUuOTFBOS45NDkgOS45NDkgMCAwIDEgMi44OCA5LjIzbC45MjUuMzgyYTguOTU0IDguOTU0IDAgMCAwLS42NDQgMi44NDRsLS45OTgtLjA2MnptMi4yMS01LjY4NmMuNjg3LS44NDggMS41MS0xLjU4IDIuNDM2LTIuMTY2bC41MjMuODUyYTkuMDQ4IDkuMDQ4IDAgMCAwLTIuMTg4IDEuOTVsLS43NzEtLjYzNnoiLz4KICAgIDxwYXRoIHN0cm9rZT0iaW5oZXJpdCIgZmlsbD0ibm9uZSIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSIgZD0iTTEzIDFsLTIuNSAyLjVMMTMgNiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtc2hhcGUtY2lyY2xlIiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTQuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1zaGFwZS1yZWN0YW5nbGUiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cmVjdCB3aWR0aD0iMjciIGhlaWdodD0iMjciIHg9IjIuNSIgeT0iMi41IiBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHJ4PSIxIi8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1zaGFwZS10cmlhbmdsZSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTE2IDIuNWwxNS41IDI3SC41eiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtc2hhcGUiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0xNC43MDYgOEgyMWExIDEgMCAwIDEgMSAxdjEyYTEgMSAwIDAgMS0xIDFIOWExIDEgMCAwIDEtMS0xdi00aDF2NGgxMlY5aC01LjcwNmwtLjU4OC0xeiIvPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik04LjUgMS41bDcuNSAxM0gxeiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtdGV4dC1hbGlnbi1jZW50ZXIiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9Im5vbmUiIGQ9Ik0wIDBoMzJ2MzJIMHoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTIgNWgyOHYxSDJ6TTggMTJoMTZ2MUg4ek0yIDE5aDI4djFIMnpNOCAyNmgxNnYxSDh6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy10ZXh0LWFsaWduLWxlZnQiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9Im5vbmUiIGQ9Ik0wIDBoMzJ2MzJIMHoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTIgNWgyOHYxSDJ6TTIgMTJoMTZ2MUgyek0yIDE5aDI4djFIMnpNMiAyNmgxNnYxSDJ6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy10ZXh0LWFsaWduLXJpZ2h0IiB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJub25lIiBkPSJNMCAwaDMydjMySDB6Ii8+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9ImluaGVyaXQiIGQ9Ik0yIDVoMjh2MUgyek0xNCAxMmgxNnYxSDE0ek0yIDE5aDI4djFIMnpNMTQgMjZoMTZ2MUgxNHoiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXRleHQtYm9sZCIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNNyAyaDJ2Mkg3ek03IDI4aDJ2Mkg3eiIvPgogICAgPHBhdGggZmlsbD0ibm9uZSIgc3Ryb2tlPSJpbmhlcml0IiBzdHJva2Utd2lkdGg9IjIiIGQ9Ik05IDN2MTJoOWE2IDYgMCAxIDAgMC0xMkg5ek05IDE1djE0aDEwYTcgNyAwIDAgMCAwLTE0SDl6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy10ZXh0LWl0YWxpYyIgdmlld0JveD0iMCAwIDMyIDMyIj4KICAgIDxwYXRoIGZpbGw9Im5vbmUiIHN0cm9rZT0ibm9uZSIgZD0iTTAgMGgzMnYzMkgweiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMTUgMmg1djFoLTV6TTExIDI5aDV2MWgtNXpNMTcgM2gxbC00IDI2aC0xeiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtdGV4dC11bmRlcmxpbmUiIHZpZXdCb3g9IjAgMCAzMiAzMiI+CiAgICA8cGF0aCBzdHJva2U9Im5vbmUiIGZpbGw9Im5vbmUiIGQ9Ik0wIDBoMzJ2MzJIMHoiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTggMnYxNGE4IDggMCAxIDAgMTYgMFYyaDF2MTRhOSA5IDAgMCAxLTE4IDBWMmgxek0zIDI5aDI2djFIM3oiLz4KICAgIDxwYXRoIHN0cm9rZT0ibm9uZSIgZmlsbD0iaW5oZXJpdCIgZD0iTTUgMmg1djFINXpNMjIgMmg1djFoLTV6Ii8+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy10ZXh0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNNCAzaDE1YTEgMSAwIDAgMSAxIDFIM2ExIDEgMCAwIDEgMS0xek0zIDRoMXYxSDN6TTE5IDRoMXYxaC0xeiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMTEgM2gxdjE4aC0xeiIvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMTAgMjBoM3YxaC0zeiIvPgo8L3N5bWJvbD4KPHN5bWJvbCBpZD0iaWMtdW5kbyIgdmlld0JveD0iMCAwIDI0IDI0Ij4KICAgIDxwYXRoIGQ9Ik0yNCAwSDB2MjRoMjR6IiBvcGFjaXR5PSIuNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJub25lIiAvPgogICAgPHBhdGggc3Ryb2tlPSJub25lIiBmaWxsPSJpbmhlcml0IiBkPSJNMyA2aDEyYTYgNiAwIDEgMSAwIDEySDN2MWgxMmE3IDcgMCAwIDAgMC0xNEgzdjF6Ii8+CiAgICA8cGF0aCBmaWxsPSJub25lIiBzdHJva2U9ImluaGVyaXQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiIGQ9Ik01IDNMMi41IDUuNSA1IDgiLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXpvb20taW4iIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjI5IC0yOTApIHRyYW5zbGF0ZSgyMjkgMjkwKSI+CiAgICAgICAgPGNpcmNsZSBjeD0iMTAuNSIgY3k9IjEwLjUiIHI9IjkiIHN0cm9rZT0iaW5oZXJpdCIgZmlsbD0ibm9uZSIvPgogICAgICAgIDxwYXRoIGZpbGw9ImluaGVyaXQiIGQ9Ik0xOC44MjggMTUuODI4SDE5LjgyOFYyMi44MjhIMTguODI4eiIgdHJhbnNmb3JtPSJyb3RhdGUoLTQ1IDE5LjMyOCAxOS4zMjgpIi8+CiAgICAgICAgPHBhdGggZmlsbD0iaW5oZXJpdCIgZD0iTTcgMTBIMTRWMTFIN3oiLz4KICAgICAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBkPSJNMTAgN0gxMVYxNEgxMHoiLz4KICAgIDwvZz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9ImljLXpvb20tb3V0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI2MyAtMjkwKSB0cmFuc2xhdGUoMjYzIDI5MCkiPgogICAgICAgIDxjaXJjbGUgY3g9IjEwLjUiIGN5PSIxMC41IiByPSI5IiBzdHJva2U9ImluaGVyaXQiIGZpbGw9Im5vbmUiLz4KICAgICAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBkPSJNMTguODI4IDE1LjgyOEgxOS44MjhWMjIuODI4SDE4LjgyOHoiIHRyYW5zZm9ybT0icm90YXRlKC00NSAxOS4zMjggMTkuMzI4KSIvPgogICAgICAgIDxwYXRoIGZpbGw9ImluaGVyaXQiIGQ9Ik03IDEwSDE0VjExSDd6Ii8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8c3ltYm9sIGlkPSJpYy1oYW5kIiB2aWV3Qm94PSIwIDAgMjQgMjQiPgogICAgPGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgICAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik04LjY3MiAzLjM2YzEuMzI4IDAgMi4xMTQuNzggMi4yOSAxLjg2OWwuMDE0LjEwMS4wMjMuMDA2djEuMDQybC0uNjM4LS4xODVjLS4xODctLjA1NS0uMzIzLS4yMTEtLjM1NC0uMzk5TDEwIDUuNzEzYzAtLjgyNS0uNDItMS4zNTMtMS4zMjgtMS4zNTNDNy42OTUgNC4zNiA3IDUuMDQxIDcgNS43MTN2Ny45NDFjMCAuNDM5LS41MjQuNjY1LS44NDMuMzY0bC0xLjg2OC0xLjc2MWMtLjU5NS0uNTI4LTEuMzE2LS42MTctMS45MTgtLjIxNi0uNTIyLjM0OC0uNTYyIDEuMjAzLS4xOCAxLjhMNy43MzggMjJoMTEuMDEzbC4yODUtLjUxOGMxLjI0Ny0yLjMyNiAxLjg5Ny00LjI1OSAxLjk2LTUuNzg1bC4wMDQtLjIzOVY4LjAzNWMwLS42NTYtLjUtMS4xNy0xLTEuMTctLjUwMyAwLTEgLjQ1Ni0xIDEuMTcgMCAuMzMzLS4zMi41NzMtLjY0LjQ4TDE4IDguNDFWNy4zNjhsLjA4Ni4wMjYuMDQyLS4xMzZjLjI3OS0uODA1Ljk3OC0xLjMzMiAxLjczOC0xLjM4OEwyMCA1Ljg2NWMxLjA1NyAwIDIgLjk2NyAyIDIuMTd2Ny40MjNjMCAxLjkyOS0uODQ1IDQuMzUyLTIuNTIxIDcuMjktLjA5LjE1Ni0uMjU1LjI1Mi0uNDM1LjI1Mkg3LjQ3NGMtLjE2NiAwLS4zMjEtLjA4Mi0uNDE0LS4yMTlsLTUuNzA0LTguMzljLS42NTMtMS4wMTktLjU4NC0yLjQ4Ni40Ni0zLjE4MiAxLS42NjYgMi4yMTYtLjUxNiAzLjE0OC4zMUw2IDEyLjQ5NVY1LjcxM2MwLTEuMTggMS4wNTgtMi4yNjMgMi40OS0yLjM0OHoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yOTcgLTI5MCkgdHJhbnNsYXRlKDI5NyAyOTApIi8+CiAgICAgICAgPHBhdGggZmlsbD0iaW5oZXJpdCIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNMTIuNSAxLjVjMS4zMjUgMCAyLjQxIDEuMDMyIDIuNDk1IDIuMzM2TDE1IDR2Ny4yMmgtMVY0YzAtLjgyOC0uNjcyLTEuNS0xLjUtMS41LS43OCAwLTEuNDIuNTk1LTEuNDkzIDEuMzU2TDExIDR2Ny4yMmgtMVY0YzAtMS4zOCAxLjEyLTIuNSAyLjUtMi41eiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI5NyAtMjkwKSB0cmFuc2xhdGUoMjk3IDI5MCkiLz4KICAgICAgICA8cGF0aCBmaWxsPSJpbmhlcml0IiBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik0xNi41IDMuNWMxLjMyNSAwIDIuNDEgMS4wMzIgMi40OTUgMi4zMzZMMTkgNnY2LjNoLTFWNmMwLS44MjgtLjY3Mi0xLjUtMS41LTEuNS0uNzggMC0xLjQyLjU5NS0xLjQ5MyAxLjM1NkwxNSA2djIuNDRoLTFWNmMwLTEuMzggMS4xMi0yLjUgMi41LTIuNXoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yOTcgLTI5MCkgdHJhbnNsYXRlKDI5NyAyOTApIi8+CiAgICA8L2c+Cjwvc3ltYm9sPgo8L2RlZnM+Cjwvc3ZnPgo="; + } + ), + /***/ + 4858: ( + /***/ + function(s) { + s.exports = t; + } + ), + /***/ + 4960: ( + /***/ + function() { + } + ), + /***/ + 6759: ( + /***/ + function() { + } + ), + /***/ + 6272: ( + /***/ + function() { + } + ) + /******/ + }, i = {}; + function a(s) { + var l = i[s]; + if (l !== void 0) + return l.exports; + var u = i[s] = { + /******/ + // no module.id needed + /******/ + // no module.loaded needed + /******/ + exports: {} + /******/ + }; + return n[s](u, u.exports, a), u.exports; + } + (function() { + a.n = function(s) { + var l = s && s.__esModule ? ( + /******/ + function() { + return s.default; + } + ) : ( + /******/ + function() { + return s; + } + ); + return a.d(l, { a: l }), l; + }; + })(), function() { + a.d = function(s, l) { + for (var u in l) + a.o(l, u) && !a.o(s, u) && Object.defineProperty(s, u, { enumerable: !0, get: l[u] }); + }; + }(), function() { + a.g = function() { + if (typeof globalThis == "object") + return globalThis; + try { + return this || new Function("return this")(); + } catch (s) { + if (typeof window == "object") + return window; + } + }(); + }(), function() { + a.o = function(s, l) { + return Object.prototype.hasOwnProperty.call(s, l); + }; + }(); + var o = {}; + return function() { + a.d(o, { + default: function() { + return ( + /* binding */ + u9 + ); + } + }); + var s = a(9131), l = /* @__PURE__ */ a.n(s), u = a(1899), c = /* @__PURE__ */ a.n(u), h = a(6562), f = /* @__PURE__ */ a.n(h), v = a(1734), b = /* @__PURE__ */ a.n(v), w = a(8005), p = /* @__PURE__ */ a.n(w), d = a(6065), m = /* @__PURE__ */ a.n(d), _ = a(4496), y = /* @__PURE__ */ a.n(_); + Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector), Element.prototype.closest || (Element.prototype.closest = function(V) { + var L = this; + do { + if (Element.prototype.matches.call(L, V)) + return L; + L = L.parentElement || L.parentNode; + } while (L !== null && L.nodeType === 1); + return null; + }); + /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */ + "document" in self && ((!("classList" in document.createElement("_")) || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g"))) && function(V) { + if ("Element" in V) { + var L = "classList", A = "prototype", D = V.Element[A], I = Object, k = l()(String[A]) || function() { + return this.replace(/^\s+|\s+$/g, ""); + }, B = c()(Array[A]) || function(Ce) { + for (var De = 0, Ee = this.length; De < Ee; De++) + if (De in this && this[De] === Ce) + return De; + return -1; + }, H = function(De, Ee) { + this.name = De, this.code = DOMException[De], this.message = Ee; + }, Y = function(De, Ee) { + if (Ee === "") + throw new H("SYNTAX_ERR", "The token must not be empty."); + if (/\s/.test(Ee)) + throw new H("INVALID_CHARACTER_ERR", "The token must not contain space characters."); + return B.call(De, Ee); + }, W = function(De) { + for (var Ee = k.call(De.getAttribute("class") || ""), Le = Ee ? Ee.split(/\s+/) : [], rt = 0, Pt = Le.length; rt < Pt; rt++) + this.push(Le[rt]); + this._updateClassName = function() { + De.setAttribute("class", this.toString()); + }; + }, q = W[A] = [], ie = function() { + return new W(this); + }; + if (H[A] = Error[A], q.item = function(Ce) { + return this[Ce] || null; + }, q.contains = function(Ce) { + return ~Y(this, Ce + ""); + }, q.add = function() { + var Ce = arguments, De = 0, Ee = Ce.length, Le, rt = !1; + do + Le = Ce[De] + "", ~Y(this, Le) || (this.push(Le), rt = !0); + while (++De < Ee); + rt && this._updateClassName(); + }, q.remove = function() { + var Ce = arguments, De = 0, Ee = Ce.length, Le, rt = !1, Pt; + do + for (Le = Ce[De] + "", Pt = Y(this, Le); ~Pt; ) { + var zt; + f()(zt = this).call(zt, Pt, 1), rt = !0, Pt = Y(this, Le); + } + while (++De < Ee); + rt && this._updateClassName(); + }, q.toggle = function(Ce, De) { + var Ee = this.contains(Ce), Le = Ee ? De !== !0 && "remove" : De !== !1 && "add"; + return Le && this[Le](Ce), De === !0 || De === !1 ? De : !Ee; + }, q.replace = function(Ce, De) { + var Ee = Y(Ce + ""); + if (~Ee) { + var Le; + f()(Le = this).call(Le, Ee, 1, De), this._updateClassName(); + } + }, q.toString = function() { + return this.join(" "); + }, b()) { + var Se = { + get: ie, + enumerable: !0, + configurable: !0 + }; + try { + b()(D, L, Se); + } catch (Ce) { + (Ce.number === void 0 || Ce.number === -2146823252) && (Se.enumerable = !1, b()(D, L, Se)); + } + } else + I[A].__defineGetter__ && D.__defineGetter__(L, ie); + } + }(self), function() { + var V = document.createElement("_"); + if (V.classList.add("c1", "c2"), !V.classList.contains("c2")) { + var L = function(I) { + var k = DOMTokenList.prototype[I]; + DOMTokenList.prototype[I] = function(B) { + var H, Y = arguments.length; + for (H = 0; H < Y; H++) + B = arguments[H], k.call(this, B); + }; + }; + L("add"), L("remove"); + } + if (V.classList.toggle("c3", !1), V.classList.contains("c3")) { + var A = DOMTokenList.prototype.toggle; + DOMTokenList.prototype.toggle = function(D, I) { + return 1 in arguments && !this.contains(D) == !I ? I : A.call(this, D); + }; + } + "replace" in document.createElement("_").classList || (DOMTokenList.prototype.replace = function(D, I) { + var k = this.toString().split(" "), B = c()(k).call(k, D + ""); + ~B && (k = p()(k).call(k, B), this.remove.apply(this, k), this.add(I), this.add.apply(this, p()(k).call(k, 1))); + }), V = null; + }()); + /*! + * @copyright Copyright (c) 2017 IcoMoon.io + * @license Licensed under MIT license + * See https://github.com/Keyamoon/svgxuse + * @version 1.2.6 + */ + (function() { + if (typeof window != "undefined" && window.addEventListener) { + var V = m()(null), L, A, D = function() { + clearTimeout(A), A = y()(L, 100); + }, I = function() { + }, k = function() { + var q; + window.addEventListener("resize", D, !1), window.addEventListener("orientationchange", D, !1), window.MutationObserver ? (q = new MutationObserver(D), q.observe(document.documentElement, { + childList: !0, + subtree: !0, + attributes: !0 + }), I = function() { + try { + q.disconnect(), window.removeEventListener("resize", D, !1), window.removeEventListener("orientationchange", D, !1); + } catch (Se) { + } + }) : (document.documentElement.addEventListener("DOMSubtreeModified", D, !1), I = function() { + document.documentElement.removeEventListener("DOMSubtreeModified", D, !1), window.removeEventListener("resize", D, !1), window.removeEventListener("orientationchange", D, !1); + }); + }, B = function(q) { + function ie(Ee) { + var Le; + return Ee.protocol !== void 0 ? Le = Ee : (Le = document.createElement("a"), Le.href = Ee), Le.protocol.replace(/:/g, "") + Le.host; + } + var Se, Ce, De; + return window.XMLHttpRequest && (Se = new XMLHttpRequest(), Ce = ie(location), De = ie(q), Se.withCredentials === void 0 && De !== "" && De !== Ce ? Se = XDomainRequest || void 0 : Se = XMLHttpRequest), Se; + }, H = "http://www.w3.org/1999/xlink"; + L = function() { + var q, ie, Se, Ce, De, Ee = 0, Le, rt, Pt, zt, Xt; + function dt() { + Ee -= 1, Ee === 0 && (I(), k()); + } + function on(oi) { + return function() { + V[oi.base] !== !0 && (oi.useEl.setAttributeNS(H, "xlink:href", "#" + oi.hash), oi.useEl.hasAttribute("href") && oi.useEl.setAttribute("href", "#" + oi.hash)); + }; + } + function Hi(oi) { + return function() { + var Ss = document.body, Ou = document.createElement("x"), Xa; + oi.onload = null, Ou.innerHTML = oi.responseText, Xa = Ou.getElementsByTagName("svg")[0], Xa && (Xa.setAttribute("aria-hidden", "true"), Xa.style.position = "absolute", Xa.style.width = 0, Xa.style.height = 0, Xa.style.overflow = "hidden", Ss.insertBefore(Xa, Ss.firstChild)), dt(); + }; + } + function Ya(oi) { + return function() { + oi.onerror = null, oi.ontimeout = null, dt(); + }; + } + for (I(), zt = document.getElementsByTagName("use"), De = 0; De < zt.length; De += 1) { + try { + ie = zt[De].getBoundingClientRect(); + } catch (oi) { + ie = !1; + } + Ce = zt[De].getAttribute("href") || zt[De].getAttributeNS(H, "href") || zt[De].getAttribute("xlink:href"), Ce && Ce.split ? Pt = Ce.split("#") : Pt = ["", ""], q = Pt[0], Se = Pt[1], Le = ie && ie.left === 0 && ie.right === 0 && ie.top === 0 && ie.bottom === 0, ie && ie.width === 0 && ie.height === 0 && !Le ? (zt[De].hasAttribute("href") && zt[De].setAttributeNS(H, "xlink:href", Ce), q.length && (Xt = V[q], Xt !== !0 && y()(on({ + useEl: zt[De], + base: q, + hash: Se + }), 0), Xt === void 0 && (rt = B(q), rt !== void 0 && (Xt = new rt(), V[q] = Xt, Xt.onload = Hi(Xt), Xt.onerror = Ya(Xt), Xt.ontimeout = Ya(Xt), Xt.open("GET", q), Xt.send(), Ee += 1)))) : Le ? q.length && V[q] && y()(on({ + useEl: zt[De], + base: q, + hash: Se + }), 0) : V[q] === void 0 ? V[q] = !0 : V[q].onload && (V[q].abort(), delete V[q].onload, V[q] = !0); + } + zt = "", Ee += 1, dt(); + }; + var Y; + Y = function() { + window.removeEventListener("load", Y, !1), A = y()(L, 0); + }, document.readyState !== "complete" ? window.addEventListener("load", Y, !1) : Y(); + } + })(); + var x = a(1845); + function g(V, L) { + (L == null || L > V.length) && (L = V.length); + for (var A = 0, D = new Array(L); A < L; A++) + D[A] = V[A]; + return D; + } + function S(V) { + if (x(V)) + return g(V); + } + var T = a(184), C = a(662), E = a(7172); + function M(V) { + if (typeof T != "undefined" && C(V) != null || V["@@iterator"] != null) + return E(V); + } + var P = a(711); + function R(V, L) { + var A; + if (V) { + if (typeof V == "string") + return g(V, L); + var D = P(A = Object.prototype.toString.call(V)).call(A, 8, -1); + if (D === "Object" && V.constructor && (D = V.constructor.name), D === "Map" || D === "Set") + return E(V); + if (D === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(D)) + return g(V, L); + } + } + function N() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function F(V) { + return S(V) || M(V) || R(V) || N(); + } + var U = a(7077); + function $(V, L, A) { + return L in V ? U(V, L, { + value: A, + enumerable: !0, + configurable: !0, + writable: !0 + }) : V[L] = A, V; + } + function G(V, L) { + if (!(V instanceof L)) + throw new TypeError("Cannot call a class as a function"); + } + function Q(V, L) { + for (var A = 0; A < L.length; A++) { + var D = L[A]; + D.enumerable = D.enumerable || !1, D.configurable = !0, "value" in D && (D.writable = !0), U(V, D.key, D); + } + } + function ee(V, L, A) { + return L && Q(V.prototype, L), A && Q(V, A), V; + } + var ce = a(4426), ne = /* @__PURE__ */ a.n(ce), fe = a(9406), K = /* @__PURE__ */ a.n(fe), Oe = a(8189), xe = /* @__PURE__ */ a.n(Oe), Ge = a(3972), oe = /* @__PURE__ */ a.n(Ge), de = a(2777), se = a(961), te = /* @__PURE__ */ a.n(se), pe = a(5695), re = /* @__PURE__ */ a.n(pe), ae = a(8592), le = /* @__PURE__ */ a.n(ae), ue = a(9052), Ae = /* @__PURE__ */ a.n(ue), Te = a(2560), Ne = /* @__PURE__ */ a.n(Te), He = a(2461), je = /* @__PURE__ */ a.n(He); + function be(V) { + if (x(V)) + return V; + } + function ge(V, L) { + var A = V == null ? null : typeof T != "undefined" && C(V) || V["@@iterator"]; + if (A != null) { + var D = [], I = !0, k = !1, B, H; + try { + for (A = A.call(V); !(I = (B = A.next()).done) && (D.push(B.value), !(L && D.length === L)); I = !0) + ; + } catch (Y) { + k = !0, H = Y; + } finally { + try { + !I && A.return != null && A.return(); + } finally { + if (k) + throw H; + } + } + return D; + } + } + function _e() { + throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); + } + function we(V, L) { + return be(V) || ge(V, L) || R(V, L) || _e(); + } + var Ie = a(6397), Me = /* @__PURE__ */ a.n(Ie), et = a(7636), yt = /* @__PURE__ */ a.n(et), vt = a(789), ze = /* @__PURE__ */ a.n(vt), bt = a(4729), _t = /* @__PURE__ */ a.n(bt), $t = a(1610), fr = /* @__PURE__ */ a.n($t), _r = a(3053), ar = /* @__PURE__ */ a.n(_r), or, Tr = ["zoomIn", "zoomOut", "hand"], tn = ["history", "undo", "redo", "reset"], rn = ["delete", "deleteAll"], qe = K()(or = []).call(or, Tr, tn, rn), Xe = { + FILTER: "filter", + COLOR: "color" + }, Ze = ["rect", "circle", "triangle"], st = { + CROPZONE: "cropzone" + }, St = { + VINTAGE: "vintage", + SEPIA2: "sepia2", + REMOVE_COLOR: "removeColor", + COLOR_FILTER: "colorFilter", + REMOVE_WHITE: "removeWhite", + BLEND_COLOR: "blendColor", + BLEND: "blend" + }, tt = It("IMAGE_LOADER", "CROPPER", "FLIP", "ROTATION", "FREE_DRAWING", "LINE", "TEXT", "ICON", "FILTER", "SHAPE", "ZOOM", "RESIZE"), Vr = { + lockSkewingX: !0, + lockSkewingY: !0, + bringForward: !0, + isRegular: !1 + }, cn = { + hasRotatingPoint: !1, + hasBorders: !1, + lockScalingFlip: !0, + lockRotation: !0, + lockSkewingX: !0, + lockSkewingY: !0 + }, ct = { + CLEAR_OBJECTS: "clearObjects", + LOAD_IMAGE: "loadImage", + FLIP_IMAGE: "flip", + ROTATE_IMAGE: "rotate", + ADD_OBJECT: "addObject", + REMOVE_OBJECT: "removeObject", + APPLY_FILTER: "applyFilter", + REMOVE_FILTER: "removeFilter", + ADD_ICON: "addIcon", + CHANGE_ICON_COLOR: "changeIconColor", + ADD_SHAPE: "addShape", + CHANGE_SHAPE: "changeShape", + ADD_TEXT: "addText", + CHANGE_TEXT: "changeText", + CHANGE_TEXT_STYLE: "changeTextStyle", + ADD_IMAGE_OBJECT: "addImageObject", + RESIZE_CANVAS_DIMENSION: "resizeCanvasDimension", + SET_OBJECT_PROPERTIES: "setObjectProperties", + SET_OBJECT_POSITION: "setObjectPosition", + CHANGE_SELECTION: "changeSelection", + RESIZE_IMAGE: "resize" + }, Re = { + OBJECT_ACTIVATED: "objectActivated", + OBJECT_MOVED: "objectMoved", + OBJECT_SCALED: "objectScaled", + OBJECT_CREATED: "objectCreated", + OBJECT_ROTATED: "objectRotated", + OBJECT_ADDED: "objectAdded", + OBJECT_MODIFIED: "objectModified", + TEXT_EDITING: "textEditing", + TEXT_CHANGED: "textChanged", + ICON_CREATE_RESIZE: "iconCreateResize", + ICON_CREATE_END: "iconCreateEnd", + ADD_TEXT: "addText", + ADD_OBJECT: "addObject", + ADD_OBJECT_AFTER: "addObjectAfter", + MOUSE_DOWN: "mousedown", + MOUSE_UP: "mouseup", + MOUSE_MOVE: "mousemove", + // UNDO/REDO Events + REDO_STACK_CHANGED: "redoStackChanged", + UNDO_STACK_CHANGED: "undoStackChanged", + SELECTION_CLEARED: "selectionCleared", + SELECTION_CREATED: "selectionCreated", + EXECUTE_COMMAND: "executeCommand", + AFTER_UNDO: "afterUndo", + AFTER_REDO: "afterRedo", + ZOOM_CHANGED: "zoomChanged", + HAND_STARTED: "handStarted", + HAND_STOPPED: "handStopped", + KEY_DOWN: "keydown", + KEY_UP: "keyup", + INPUT_BOX_EDITING_STARTED: "inputBoxEditingStarted", + INPUT_BOX_EDITING_STOPPED: "inputBoxEditingStopped", + FOCUS: "focus", + BLUR: "blur", + IMAGE_RESIZED: "imageResized" + }, Br = { + COLOR_PICKER_INPUT_BOX: ".tui-colorpicker-palette-hex" + }, dr = { + LOAD_IMAGE: "Load", + LOAD_MASK_IMAGE: "Mask", + ADD_MASK_IMAGE: "Mask", + ADD_IMAGE_OBJECT: "Mask", + CROP: "Crop", + RESIZE: "Resize", + APPLY_FILTER: "Filter", + REMOVE_FILTER: "Filter", + CHANGE_SHAPE: "Shape", + CHANGE_ICON_COLOR: "Icon", + ADD_TEXT: "Text", + CHANGE_TEXT_STYLE: "Text", + REMOVE_OBJECT: "Delete", + CLEAR_OBJECTS: "Delete" + }, ur = It("NORMAL", "CROPPER", "FREE_DRAWING", "LINE_DRAWING", "TEXT", "SHAPE", "ICON", "ZOOM", "RESIZE"), wn = { + TEXT: "text", + CROP: "crop", + RESIZE: "resize", + SHAPE: "shape", + ZOOM: "zoom" + }, vr = { + DEFAULT: "normal", + ZOOM: "zoom", + HAND: "hand" + }, Vt = { + Z: 90, + Y: 89, + C: 67, + V: 86, + SHIFT: 16, + BACKSPACE: 8, + DEL: 46, + ARROW_DOWN: 40, + ARROW_UP: 38, + SPACE: 32, + DIGIT_0: 48, + DIGIT_9: 57 + }, wi = { + SELECTION_STYLE: { + borderColor: "red", + cornerColor: "green", + cornerSize: 10, + originX: "center", + originY: "center", + transparentCorners: !1 + } + }, wt = { + addedObject: "The object is already added.", + flip: "The flipX and flipY setting values are not changed.", + invalidDrawingMode: "This operation is not supported in the drawing mode.", + invalidParameters: "Invalid parameters.", + isLock: "The executing command state is locked.", + loadImage: "The background image is empty.", + loadingImageFailed: "Invalid image loaded.", + noActiveObject: "There is no active object.", + noObject: "The object is not in canvas.", + redo: "The promise of redo command is reject.", + rotation: "The current angle is same the old angle.", + undo: "The promise of undo command is reject.", + unsupportedOperation: "Unsupported operation.", + unsupportedType: "Unsupported object type." + }, pr = { + "icon-arrow": "M40 12V0l24 24-24 24V36H0V12h40z", + "icon-arrow-2": "M49,32 H3 V22 h46 l-18,-18 h12 l23,23 L43,50 h-12 l18,-18 z ", + "icon-arrow-3": "M43.349998,27 L17.354,53 H1.949999 l25.996,-26 L1.949999,1 h15.404 L43.349998,27 z ", + "icon-star": "M35,54.557999 l-19.912001,10.468 l3.804,-22.172001 l-16.108,-15.7 l22.26,-3.236 L35,3.746 l9.956,20.172001 l22.26,3.236 l-16.108,15.7 l3.804,22.172001 z ", + "icon-star-2": "M17,31.212 l-7.194,4.08 l-4.728,-6.83 l-8.234,0.524 l-1.328,-8.226 l-7.644,-3.14 l2.338,-7.992 l-5.54,-6.18 l5.54,-6.176 l-2.338,-7.994 l7.644,-3.138 l1.328,-8.226 l8.234,0.522 l4.728,-6.83 L17,-24.312 l7.194,-4.08 l4.728,6.83 l8.234,-0.522 l1.328,8.226 l7.644,3.14 l-2.338,7.992 l5.54,6.178 l-5.54,6.178 l2.338,7.992 l-7.644,3.14 l-1.328,8.226 l-8.234,-0.524 l-4.728,6.83 z ", + "icon-polygon": "M3,31 L19,3 h32 l16,28 l-16,28 H19 z ", + "icon-location": "M24 62C8 45.503 0 32.837 0 24 0 10.745 10.745 0 24 0s24 10.745 24 24c0 8.837-8 21.503-24 38zm0-28c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10z", + "icon-heart": "M49.994999,91.349998 l-6.96,-6.333 C18.324001,62.606995 2.01,47.829002 2.01,29.690998 C2.01,14.912998 13.619999,3.299999 28.401001,3.299999 c8.349,0 16.362,5.859 21.594,12 c5.229,-6.141 13.242001,-12 21.591,-12 c14.778,0 26.390999,11.61 26.390999,26.390999 c0,18.138 -16.314001,32.916 -41.025002,55.374001 l-6.96,6.285 z ", + "icon-bubble": "M44 48L34 58V48H12C5.373 48 0 42.627 0 36V12C0 5.373 5.373 0 12 0h40c6.627 0 12 5.373 12 12v24c0 6.627-5.373 12-12 12h-8z" + }, Fn = { + realTimeEvent: !0, + min: -360, + max: 360, + value: 0 + }, Ra = { + min: 5, + max: 30, + value: 12 + }, oo = { + realTimeEvent: !0, + min: 2, + max: 300, + value: 3 + }, Co = { + realTimeEvent: !0, + min: 10, + max: 100, + value: 50 + }, Wr = { + tintOpacityRange: { + realTimeEvent: !0, + min: 0, + max: 1, + value: 0.7, + useDecimal: !0 + }, + removewhiteDistanceRange: { + realTimeEvent: !0, + min: 0, + max: 1, + value: 0.2, + useDecimal: !0 + }, + brightnessRange: { + realTimeEvent: !0, + min: -1, + max: 1, + value: 0, + useDecimal: !0 + }, + noiseRange: { + realTimeEvent: !0, + min: 0, + max: 1e3, + value: 100 + }, + pixelateRange: { + realTimeEvent: !0, + min: 2, + max: 20, + value: 4 + }, + colorfilterThresholdRange: { + realTimeEvent: !0, + min: 0, + max: 1, + value: 0.2, + useDecimal: !0 + }, + blurFilterRange: { + value: 0.1 + } + }, Na = { + LEFT: 0, + TOP: 0, + WIDTH: 0.5, + HEIGHT: 0.5 + }, jr = { + realTimeEvent: !0, + min: 32, + max: 4088, + value: 800 + }, Sr = 2, $r = "tui-image-editor-", Ct = Math.min, he = Math.max, Qe = !1, Ue = 0; + function Je(V) { + return V.__fe_id || (Ue += 1, V.__fe_id = Ue), V.__fe_id; + } + function at(V) { + return typeof V == "function"; + } + function Dt(V, L, A) { + if (L > A) { + var D = [A, L]; + L = D[0], A = D[1]; + } + return he(L, Ct(V, A)); + } + function It() { + for (var V = {}, L = arguments.length, A = new Array(L), D = 0; D < L; D++) + A[D] = arguments[D]; + return le()(A, function(I) { + V[I] = I; + }), V; + } + function qt(V, L) { + var A = {}, D = L.length, I = 0, k; + for (I = 0; I < D; I += 1) + k = L[I], A[k] = V[k]; + return A; + } + function Lr(V) { + return Me()(V, 10); + } + function wr(V) { + return V.replace(/-([a-z])/g, function(L, A) { + return A.toUpperCase(); + }); + } + function Nt() { + return !!(window.File && window.FileList && window.FileReader); + } + function nt(V, L) { + var A, D, I; + if (V.length === 4) { + var k; + V = K()(k = "".concat(V)).call(k, p()(V).call(V, 1, 4)); + } + var B = Me()(p()(V).call(V, 1, 3), 16), H = Me()(p()(V).call(V, 3, 5), 16), Y = Me()(p()(V).call(V, 5, 7), 16), W = L || 1; + return K()(A = K()(D = K()(I = "rgba(".concat(B, ", ")).call(I, H, ", ")).call(D, Y, ", ")).call(A, W, ")"); + } + function Cn() { + Qe || (Qe = !0, _t()("image-editor", "UA-129999381-1")); + } + function ui(V, L) { + var A = document.getElementsByTagName("head"), D = we(A, 1), I = D[0], k = document.createElement("link"), B = encodeURIComponent(V); + L && (k.id = L), k.setAttribute("rel", "stylesheet"), k.setAttribute("type", "text/css"), k.setAttribute("href", "data:text/css;charset=UTF-8,".concat(B)), I.appendChild(k); + } + function yn(V) { + return function(L) { + return V.querySelector(L); + }; + } + function To(V) { + var L = /data:(image\/.+);base64,/, A = "", D, I, k; + D = V.replace(L, function(H, Y) { + return A = Y, ""; + }), D = atob(D); + var B = D.length; + for (I = new Uint8Array(B), k = 0; k < B; k += 1) + I[k] = D.charCodeAt(k); + return new Blob([I], { + type: A + }); + } + function ss(V) { + return Number(V.toFixed(Sr)); + } + function Wn(V) { + le()(V, function(L, A) { + V[A] = null; + }); + } + function ci() { + var V, L = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", A = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; + if (L.charAt(0) === ".") { + var D; + return K()(D = ".".concat($r).concat(A)).call(D, p()(L).call(L, 1)); + } + return K()(V = "".concat($r).concat(A)).call(V, L); + } + function ya(V, L) { + var A = L.originX, D = L.originY, I = V.getPointByOrigin(A, D), k = I.x, B = I.y; + V.set({ + left: k, + top: B, + originX: A, + originY: D + }), V.setCoords(); + } + function fn(V) { + var L, A = {}; + return yt()(L = je()(V)).call(L, function(D) { + A[V[D]] = D; + }), A; + } + function Yn(V, L) { + V.customProps = V.customProps || {}, te()(V.customProps, L); + } + function Nn(V, L) { + var A = {}; + return Ne()(L) && (L = [L]), le()(L, function(D) { + A[D] = V.customProps[D]; + }), A; + } + function ls(V) { + return V.charAt(0).toUpperCase() + p()(V).call(V, 1); + } + function us(V, L) { + return c()(V).call(V, L) >= 0; + } + function ki() { + var V = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + return fr()(V, "type") || Xe.COLOR; + } + function Ki(V) { + var L = ze()(V), A = L === void 0 ? {} : L; + return A.source ? Xe.FILTER : Xe.COLOR; + } + function Qi(V) { + return ar()(V.get("type"), Ze) >= 0; + } + function Hr(V) { + if (us(Ze, V)) + return "Shape"; + switch (V) { + case "i-text": + return "Text"; + case "path": + case "line": + return "Draw"; + case "activeSelection": + return "Group"; + default: + return On(V); + } + } + function Io(V) { + var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, A = L.useAlpha, D = A === void 0 ? !0 : A, I = L.mode, k = St.VINTAGE, B = St.REMOVE_COLOR, H = St.BLEND_COLOR, Y = St.SEPIA2, W = St.COLOR_FILTER, q = St.REMOVE_WHITE, ie = St.BLEND, Se; + switch (V) { + case k: + Se = Y; + break; + case B: + Se = D ? W : q; + break; + case H: + Se = I === "add" ? ie : I; + break; + default: + Se = V; + } + return On(Se); + } + function qi(V) { + var L = ct.LOAD_IMAGE; + return typeof V == "string" ? L === V : L === V.name; + } + function Gr(V) { + var L, A, D = ct.FLIP_IMAGE, I = ct.ROTATE_IMAGE, k = ct.ADD_TEXT, B = ct.APPLY_FILTER, H = ct.REMOVE_FILTER, Y = ct.CHANGE_SHAPE, W = ct.CHANGE_ICON_COLOR, q = ct.CHANGE_TEXT_STYLE, ie = ct.CLEAR_OBJECTS, Se = ct.ADD_IMAGE_OBJECT, Ce = ct.REMOVE_OBJECT, De = ct.RESIZE_IMAGE, Ee = V.name, Le = V.args, rt; + switch (Ee) { + case D: + rt = { + name: Ee, + detail: Le[1] === "reset" ? Le[1] : p()(L = Le[1]).call(L, 4) + }; + break; + case I: + rt = { + name: Ee, + detail: Le[2] + }; + break; + case B: + rt = { + name: dr.APPLY_FILTER, + detail: Io(Le[1], Le[2]) + }; + break; + case H: + rt = { + name: dr.REMOVE_FILTER, + detail: "Remove" + }; + break; + case Y: + rt = { + name: dr.CHANGE_SHAPE, + detail: "Change" + }; + break; + case W: + rt = { + name: dr.CHANGE_ICON_COLOR, + detail: "Change" + }; + break; + case q: + rt = { + name: dr.CHANGE_TEXT_STYLE, + detail: "Change" + }; + break; + case Ce: + rt = { + name: dr.REMOVE_OBJECT, + detail: Le[2] + }; + break; + case ie: + rt = { + name: dr.CLEAR_OBJECTS, + detail: "All" + }; + break; + case Se: + rt = { + name: dr.ADD_IMAGE_OBJECT, + detail: "Add" + }; + break; + case k: + rt = { + name: dr.ADD_TEXT + }; + break; + case De: + rt = { + name: dr.RESIZE, + detail: K()(A = "".concat(~~Le[1].width, "x")).call(A, ~~Le[1].height) + }; + break; + default: + rt = { + name: Ee + }; + break; + } + return Le[1] === "mask" && (rt = { + name: dr.LOAD_MASK_IMAGE, + detail: "Apply" + }), rt; + } + function Oi(V) { + return V === "top" ? "bottom" : V === "left" ? "right" : V === "right" ? "left" : "top"; + } + function On(V) { + return V.replace(/[a-z]/, function(L) { + return L.toUpperCase(); + }); + } + function Tn(V) { + var L = V.left, A = V.top, D = V.width, I = V.height, k = Na.LEFT, B = Na.TOP, H = Na.WIDTH, Y = Na.HEIGHT; + return L === k && A === B && D === H && I === Y; + } + var za = It("UN_IMPLEMENTATION", "NO_COMPONENT_NAME"), Us = { + UN_IMPLEMENTATION: "Should implement a method: ", + NO_COMPONENT_NAME: "Should set a component name" + }, cs = { + UN_IMPLEMENTATION: function(L) { + return Us.UN_IMPLEMENTATION + L; + }, + NO_COMPONENT_NAME: function() { + return Us.NO_COMPONENT_NAME; + } + }, dn = { + types: te()({}, za), + create: function(L) { + L = L.toLowerCase(); + for (var A = cs[L], D = arguments.length, I = new Array(D > 1 ? D - 1 : 0), k = 1; k < D; k++) + I[k - 1] = arguments[k]; + return A.apply(void 0, I); + } + }, _i = dn.create, Li = dn.types, so = /* @__PURE__ */ function() { + function V(L, A) { + G(this, V), this.name = L.name, this.args = A, this.execute = L.execute, this.undo = L.undo, this.executeCallback = L.executeCallback || null, this.undoCallback = L.undoCallback || null, this.undoData = {}; + } + return ee(V, [{ + key: "execute", + value: function() { + throw new Error(_i(Li.UN_IMPLEMENTATION, "execute")); + } + /** + * Undo action + * @param {Object.} compMap - Components injection + * @abstract + */ + }, { + key: "undo", + value: function() { + throw new Error(_i(Li.UN_IMPLEMENTATION, "undo")); + } + /** + * command for redo if undoData exists + * @returns {boolean} isRedo + */ + }, { + key: "isRedo", + get: function() { + return je()(this.undoData).length > 0; + } + /** + * Set undoData action + * @param {Object} undoData - maked undo data + * @param {Object} cachedUndoDataForSilent - cached undo data + * @param {boolean} isSilent - is silent execution or not + * @returns {Object} cachedUndoDataForSilent + */ + }, { + key: "setUndoData", + value: function(A, D, I) { + return D && (A = D), I ? D || (D = A) : (te()(this.undoData, A), D = null), D; + } + /** + * Attach execute callabck + * @param {function} callback - Callback after execution + * @returns {Command} this + */ + }, { + key: "setExecuteCallback", + value: function(A) { + return this.executeCallback = A, this; + } + /** + * Attach undo callback + * @param {function} callback - Callback after undo + * @returns {Command} this + */ + }, { + key: "setUndoCallback", + value: function(A) { + return this.undoCallback = A, this; + } + }]), V; + }(), ei = so, _a = {}; + function du(V) { + var L = _a[V]; + if (L) { + for (var A = arguments.length, D = new Array(A > 1 ? A - 1 : 0), I = 1; I < A; I++) + D[I - 1] = arguments[I]; + return new ei(L, D); + } + return null; + } + function vu(V) { + _a[V.name] = V; + } + var Ir = { + create: du, + register: vu + }, hi = /* @__PURE__ */ function() { + function V() { + G(this, V), this._undoStack = [], this._redoStack = [], this._isLocked = !1, this._isSilent = !1; + } + return ee(V, [{ + key: "_invokeExecution", + value: function(A) { + var D = this, I = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; + this.lock(); + var k = A.args; + return k || (k = []), A.execute.apply(A, F(k)).then(function(B) { + return D._isSilent || (D.pushUndoStack(A), D.fire(I ? Re.AFTER_REDO : Re.EXECUTE_COMMAND, A)), D.unlock(), at(A.executeCallback) && A.executeCallback(B), B; + }).catch(function(B) { + return D.unlock(), xe().reject(B); + }); + } + /** + * Invoke command undo + * @param {Command} command - Command + * @returns {Promise} + * @private + */ + }, { + key: "_invokeUndo", + value: function(A) { + var D = this; + this.lock(); + var I = A.args; + return I || (I = []), A.undo.apply(A, F(I)).then(function(k) { + return D.pushRedoStack(A), D.fire(Re.AFTER_UNDO, A), D.unlock(), at(A.undoCallback) && A.undoCallback(k), k; + }).catch(function(k) { + return D.unlock(), xe().reject(k); + }); + } + /** + * fire REDO_STACK_CHANGED event + * @private + */ + }, { + key: "_fireRedoStackChanged", + value: function() { + this.fire(Re.REDO_STACK_CHANGED, this._redoStack.length); + } + /** + * fire UNDO_STACK_CHANGED event + * @private + */ + }, { + key: "_fireUndoStackChanged", + value: function() { + this.fire(Re.UNDO_STACK_CHANGED, this._undoStack.length); + } + /** + * Lock this invoker + */ + }, { + key: "lock", + value: function() { + this._isLocked = !0; + } + /** + * Unlock this invoker + */ + }, { + key: "unlock", + value: function() { + this._isLocked = !1; + } + }, { + key: "executeSilent", + value: function() { + var A = this; + this._isSilent = !0; + for (var D = arguments.length, I = new Array(D), k = 0; k < D; k++) + I[k] = arguments[k]; + return this.execute.apply(this, K()(I).call(I, [this._isSilent])).then(function() { + A._isSilent = !1; + }); + } + /** + * Invoke command + * Store the command to the undoStack + * Clear the redoStack + * @param {String} commandName - Command name + * @param {...*} args - Arguments for creating command + * @returns {Promise} + */ + }, { + key: "execute", + value: function() { + var A = this; + if (this._isLocked) + return xe().reject(wt.isLock); + for (var D = arguments.length, I = new Array(D), k = 0; k < D; k++) + I[k] = arguments[k]; + var B = I[0]; + return Ne()(B) && (B = Ir.create.apply(Ir, I)), this._invokeExecution(B).then(function(H) { + return A.clearRedoStack(), H; + }); + } + /** + * Undo command + * @returns {Promise} + */ + }, { + key: "undo", + value: function() { + var A = this._undoStack.pop(), D, I = ""; + if (A && this._isLocked && (this.pushUndoStack(A, !0), A = null), A) + this.isEmptyUndoStack() && this._fireUndoStackChanged(), D = this._invokeUndo(A); + else { + if (I = wt.undo, this._isLocked) { + var k; + I = K()(k = "".concat(I, " Because ")).call(k, wt.isLock); + } + D = xe().reject(I); + } + return D; + } + /** + * Redo command + * @returns {Promise} + */ + }, { + key: "redo", + value: function() { + var A = this._redoStack.pop(), D, I = ""; + if (A && this._isLocked && (this.pushRedoStack(A, !0), A = null), A) + this.isEmptyRedoStack() && this._fireRedoStackChanged(), D = this._invokeExecution(A, !0); + else { + if (I = wt.redo, this._isLocked) { + var k; + I = K()(k = "".concat(I, " Because ")).call(k, wt.isLock); + } + D = xe().reject(I); + } + return D; + } + /** + * Push undo stack + * @param {Command} command - command + * @param {boolean} [isSilent] - Fire event or not + */ + }, { + key: "pushUndoStack", + value: function(A, D) { + this._undoStack.push(A), D || this._fireUndoStackChanged(); + } + /** + * Push redo stack + * @param {Command} command - command + * @param {boolean} [isSilent] - Fire event or not + */ + }, { + key: "pushRedoStack", + value: function(A, D) { + this._redoStack.push(A), D || this._fireRedoStackChanged(); + } + /** + * Return whether the redoStack is empty + * @returns {boolean} + */ + }, { + key: "isEmptyRedoStack", + value: function() { + return this._redoStack.length === 0; + } + /** + * Return whether the undoStack is empty + * @returns {boolean} + */ + }, { + key: "isEmptyUndoStack", + value: function() { + return this._undoStack.length === 0; + } + /** + * Clear undoStack + */ + }, { + key: "clearUndoStack", + value: function() { + this.isEmptyUndoStack() || (this._undoStack = [], this._fireUndoStackChanged()); + } + /** + * Clear redoStack + */ + }, { + key: "clearRedoStack", + value: function() { + this.isEmptyRedoStack() || (this._redoStack = [], this._fireRedoStackChanged()); + } + }]), V; + }(); + Ae().mixin(hi); + var In = hi, Ar = a(5214), Ba = /* @__PURE__ */ a.n(Ar), lo = function(V) { + var L, A, D, I, k, B, H, Y = V.locale, W = V.biImage, q = V.commonStyle, ie = V.headerStyle, Se = V.loadButtonStyle, Ce = V.downloadButtonStyle, De = V.submenuStyle; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = ` +
    +
    + +
    +
    + `)).call(I, Y.localize("Load"), ` + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +`); + }, Ao = function(V) { + var L, A, D, I, k, B = V.locale, H = V.biImage, Y = V.loadButtonStyle, W = V.downloadButtonStyle, q = V.menuBarPosition; + return K()(L = K()(A = K()(D = K()(I = K()(k = ` +
      +
      + +
        + +
        +
        + `)).call(D, B.localize("Load"), ` + +
        + +
        +
        +`); + }, Mn = a(899), Er = /* @__PURE__ */ a.n(Mn), ja = function(V) { + var L, A, D, I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt, Pt, zt, Xt, dt, on, Hi, Ya, oi, Ss, Ou, Xa, Vv, Km = V.subMenuLabelActive, Qm = V.subMenuLabelNormal, qm = V.subMenuRangeTitle, ey = V.submenuPartitionVertical, ty = V.submenuPartitionHorizontal, ry = V.submenuCheckbox, ny = V.submenuRangePointer, iy = V.submenuRangeValue, ay = V.submenuColorpickerTitle, oy = V.submenuColorpickerButton, sy = V.submenuRangeBar, ly = V.submenuRangeSubbar, uy = V.submenuDisabledRangePointer, cy = V.submenuDisabledRangeBar, hy = V.submenuDisabledRangeSubbar, fy = V.submenuIconSize, dy = V.menuIconSize, vy = V.biSize, ws = V.menuIconStyle, Fc = V.submenuIconStyle; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = K()(ie = K()(Se = K()(Ce = K()(De = K()(Ee = K()(Le = K()(rt = K()(Pt = K()(zt = K()(Xt = K()(dt = K()(on = K()(Hi = K()(Ya = K()(oi = K()(Ss = K()(Ou = K()(Xa = K()(Vv = ` + .tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label, + .tie-icon-add-button.icon-heart .tui-image-editor-button[data-icontype="icon-heart"] label, + .tie-icon-add-button.icon-location .tui-image-editor-button[data-icontype="icon-location"] label, + .tie-icon-add-button.icon-polygon .tui-image-editor-button[data-icontype="icon-polygon"] label, + .tie-icon-add-button.icon-star .tui-image-editor-button[data-icontype="icon-star"] label, + .tie-icon-add-button.icon-star-2 .tui-image-editor-button[data-icontype="icon-star-2"] label, + .tie-icon-add-button.icon-arrow-3 .tui-image-editor-button[data-icontype="icon-arrow-3"] label, + .tie-icon-add-button.icon-arrow-2 .tui-image-editor-button[data-icontype="icon-arrow-2"] label, + .tie-icon-add-button.icon-arrow .tui-image-editor-button[data-icontype="icon-arrow"] label, + .tie-icon-add-button.icon-bubble .tui-image-editor-button[data-icontype="icon-bubble"] label, + .tie-draw-line-select-button.line .tui-image-editor-button.line label, + .tie-draw-line-select-button.free .tui-image-editor-button.free label, + .tie-flip-button.flipX .tui-image-editor-button.flipX label, + .tie-flip-button.flipY .tui-image-editor-button.flipY label, + .tie-flip-button.resetFlip .tui-image-editor-button.resetFlip label, + .tie-crop-button .tui-image-editor-button.apply.active label, + .tie-crop-preset-button .tui-image-editor-button.preset.active label, + .tie-resize-button .tui-image-editor-button.apply.active label, + .tie-resize-preset-button .tui-image-editor-button.preset.active label, + .tie-shape-button.rect .tui-image-editor-button.rect label, + .tie-shape-button.circle .tui-image-editor-button.circle label, + .tie-shape-button.triangle .tui-image-editor-button.triangle label, + .tie-text-effect-button .tui-image-editor-button.active label, + .tie-text-align-button.tie-text-align-left .tui-image-editor-button.left label, + .tie-text-align-button.tie-text-align-center .tui-image-editor-button.center label, + .tie-text-align-button.tie-text-align-right .tui-image-editor-button.right label, + .tie-mask-apply.apply.active .tui-image-editor-button.apply label, + .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button:hover > label, + .tui-image-editor-container .tui-image-editor-checkbox label > span { + `.concat(Km, ` + } + .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button > label, + .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label, + .tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label > span { + `)).call(Vv, Qm, ` + } + .tui-image-editor-container .tui-image-editor-range-wrap label > span { + `)).call(Xa, qm, ` + } + .tui-image-editor-container .tui-image-editor-partition > div { + `)).call(Ou, ey, ` + } + .tui-image-editor-container.left .tui-image-editor-submenu .tui-image-editor-partition > div, + .tui-image-editor-container.right .tui-image-editor-submenu .tui-image-editor-partition > div { + `)).call(Ss, ty, ` + } + .tui-image-editor-container .tui-image-editor-checkbox label > span:before { + `)).call(oi, ry, ` + } + .tui-image-editor-container .tui-image-editor-checkbox label > input:checked + span:before { + border: 0; + } + .tui-image-editor-container .tui-image-editor-virtual-range-pointer { + `)).call(Ya, ny, ` + } + .tui-image-editor-container .tui-image-editor-virtual-range-bar { + `)).call(Hi, sy, ` + } + .tui-image-editor-container .tui-image-editor-virtual-range-subbar { + `)).call(on, ly, ` + } + .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-pointer { + `)).call(dt, uy, ` + } + .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-subbar { + `)).call(Xt, hy, ` + } + .tui-image-editor-container .tui-image-editor-disabled .tui-image-editor-virtual-range-bar { + `)).call(zt, cy, ` + } + .tui-image-editor-container .tui-image-editor-range-value { + `)).call(Pt, iy, ` + } + .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value + label { + `)).call(rt, ay, ` + } + .tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button .color-picker-value { + `)).call(Le, oy, ` + } + .tui-image-editor-container .svg_ic-menu { + `)).call(Ee, dy, ` + } + .tui-image-editor-container .svg_ic-submenu { + `)).call(De, fy, ` + } + .tui-image-editor-container .tui-image-editor-controls-logo > img, + .tui-image-editor-container .tui-image-editor-header-logo > img { + `)).call(Ce, vy, ` + } + .tui-image-editor-menu use.normal.use-default, + .tui-image-editor-help-menu use.normal.use-default { + fill-rule: evenodd; + fill: `)).call(Se, ws.normal.color, `; + stroke: `)).call(ie, ws.normal.color, `; + } + .tui-image-editor-menu use.active.use-default, + .tui-image-editor-help-menu use.active.use-default { + fill-rule: evenodd; + fill: `)).call(q, ws.active.color, `; + stroke: `)).call(W, ws.active.color, `; + } + .tui-image-editor-menu use.hover.use-default, + .tui-image-editor-help-menu use.hover.use-default { + fill-rule: evenodd; + fill: `)).call(Y, ws.hover.color, `; + stroke: `)).call(H, ws.hover.color, `; + } + .tui-image-editor-menu use.disabled.use-default, + .tui-image-editor-help-menu use.disabled.use-default { + fill-rule: evenodd; + fill: `)).call(B, ws.disabled.color, `; + stroke: `)).call(k, ws.disabled.color, `; + } + .tui-image-editor-submenu use.normal.use-default { + fill-rule: evenodd; + fill: `)).call(I, Fc.normal.color, `; + stroke: `)).call(D, Fc.normal.color, `; + } + .tui-image-editor-submenu use.active.use-default { + fill-rule: evenodd; + fill: `)).call(A, Fc.active.color, `; + stroke: `)).call(L, Fc.active.color, `; + } +`); + }, ti = { + "common.bi.image": "https://uicdn.toast.com/toastui/img/tui-image-editor-bi.png", + "common.bisize.width": "251px", + "common.bisize.height": "21px", + "common.backgroundImage": "none", + "common.backgroundColor": "#1e1e1e", + "common.border": "0px", + // header + "header.backgroundImage": "none", + "header.backgroundColor": "transparent", + "header.border": "0px", + // load button + "loadButton.backgroundColor": "#fff", + "loadButton.border": "1px solid #ddd", + "loadButton.color": "#222", + "loadButton.fontFamily": "'Noto Sans', sans-serif", + "loadButton.fontSize": "12px", + // download button + "downloadButton.backgroundColor": "#fdba3b", + "downloadButton.border": "1px solid #fdba3b", + "downloadButton.color": "#fff", + "downloadButton.fontFamily": "'Noto Sans', sans-serif", + "downloadButton.fontSize": "12px", + // main icons + "menu.normalIcon.color": "#8a8a8a", + "menu.activeIcon.color": "#555555", + "menu.disabledIcon.color": "#434343", + "menu.hoverIcon.color": "#e9e9e9", + // submenu icons + "submenu.normalIcon.color": "#8a8a8a", + "submenu.activeIcon.color": "#e9e9e9", + "menu.iconSize.width": "24px", + "menu.iconSize.height": "24px", + "submenu.iconSize.width": "32px", + "submenu.iconSize.height": "32px", + // submenu primary color + "submenu.backgroundColor": "#1e1e1e", + "submenu.partition.color": "#3c3c3c", + // submenu labels + "submenu.normalLabel.color": "#8a8a8a", + "submenu.normalLabel.fontWeight": "lighter", + "submenu.activeLabel.color": "#fff", + "submenu.activeLabel.fontWeight": "lighter", + // checkbox style + "checkbox.border": "0px", + "checkbox.backgroundColor": "#fff", + // range style + "range.pointer.color": "#fff", + "range.bar.color": "#666", + "range.subbar.color": "#d1d1d1", + "range.disabledPointer.color": "#414141", + "range.disabledBar.color": "#282828", + "range.disabledSubbar.color": "#414141", + "range.value.color": "#fff", + "range.value.fontWeight": "lighter", + "range.value.fontSize": "11px", + "range.value.border": "1px solid #353535", + "range.value.backgroundColor": "#151515", + "range.title.color": "#fff", + "range.title.fontWeight": "lighter", + // colorpicker style + "colorpicker.button.border": "1px solid #1e1e1e", + "colorpicker.title.color": "#fff" + }, ri = a(2534), Xn = /* @__PURE__ */ function() { + function V(L) { + G(this, V), this.styles = this._changeToObject(te()({}, ti, L)), ui(this._styleMaker()), this._loadDefaultSvgIcon(); + } + return ee(V, [{ + key: "getStyle", + value: function(A) { + var D = null, I = A.replace(/\..+$/, ""), k = this.styles[A]; + switch (A) { + case "common.bi": + D = this.styles[A].image; + break; + case "menu.icon": + D = { + active: this.styles["".concat(I, ".activeIcon")], + normal: this.styles["".concat(I, ".normalIcon")], + hover: this.styles["".concat(I, ".hoverIcon")], + disabled: this.styles["".concat(I, ".disabledIcon")] + }; + break; + case "submenu.icon": + D = { + active: this.styles["".concat(I, ".activeIcon")], + normal: this.styles["".concat(I, ".normalIcon")] + }; + break; + case "submenu.label": + D = { + active: this._makeCssText(this.styles["".concat(I, ".activeLabel")]), + normal: this._makeCssText(this.styles["".concat(I, ".normalLabel")]) + }; + break; + case "submenu.partition": + D = { + vertical: this._makeCssText(te()({}, k, { + borderLeft: "1px solid ".concat(k.color) + })), + horizontal: this._makeCssText(te()({}, k, { + borderBottom: "1px solid ".concat(k.color) + })) + }; + break; + case "range.disabledPointer": + case "range.disabledBar": + case "range.disabledSubbar": + case "range.pointer": + case "range.bar": + case "range.subbar": + k.backgroundColor = k.color, D = this._makeCssText(k); + break; + default: + D = this._makeCssText(k); + break; + } + return D; + } + /** + * Make css resource + * @returns {string} - serialized css text + * @private + */ + }, { + key: "_styleMaker", + value: function() { + var A = this.getStyle("submenu.label"), D = this.getStyle("submenu.partition"); + return ja({ + subMenuLabelActive: A.active, + subMenuLabelNormal: A.normal, + submenuPartitionVertical: D.vertical, + submenuPartitionHorizontal: D.horizontal, + biSize: this.getStyle("common.bisize"), + subMenuRangeTitle: this.getStyle("range.title"), + submenuRangePointer: this.getStyle("range.pointer"), + submenuRangeBar: this.getStyle("range.bar"), + submenuRangeSubbar: this.getStyle("range.subbar"), + submenuDisabledRangePointer: this.getStyle("range.disabledPointer"), + submenuDisabledRangeBar: this.getStyle("range.disabledBar"), + submenuDisabledRangeSubbar: this.getStyle("range.disabledSubbar"), + submenuRangeValue: this.getStyle("range.value"), + submenuColorpickerTitle: this.getStyle("colorpicker.title"), + submenuColorpickerButton: this.getStyle("colorpicker.button"), + submenuCheckbox: this.getStyle("checkbox"), + menuIconSize: this.getStyle("menu.iconSize"), + submenuIconSize: this.getStyle("submenu.iconSize"), + menuIconStyle: this.getStyle("menu.icon"), + submenuIconStyle: this.getStyle("submenu.icon") + }); + } + /** + * Change to low dimensional object. + * @param {object} styleOptions - style object of user interface + * @returns {object} low level object for style apply + * @private + */ + }, { + key: "_changeToObject", + value: function(A) { + var D = {}; + return le()(A, function(I, k) { + var B = k.match(/^(.+)\.([a-z]+)$/i), H = we(B, 3), Y = H[1], W = H[2]; + D[Y] || (D[Y] = {}), D[Y][W] = I; + }), D; + } + /** + * Style object to Csstext serialize + * @param {object} styleObject - style object + * @returns {string} - css text string + * @private + */ + }, { + key: "_makeCssText", + value: function(A) { + var D = this, I = []; + return le()(A, function(k, B) { + var H, Y; + c()(H = ["backgroundImage"]).call(H, B) > -1 && k !== "none" && (k = "url(".concat(k, ")")), I.push(K()(Y = "".concat(D._toUnderScore(B), ": ")).call(Y, k)); + }), I.join(";"); + } + /** + * Camel key string to Underscore string + * @param {string} targetString - change target + * @returns {string} + * @private + */ + }, { + key: "_toUnderScore", + value: function(A) { + return A.replace(/([A-Z])/g, function(D, I) { + return "-".concat(I.toLowerCase()); + }); + } + /** + * Load default svg icon + * @private + */ + }, { + key: "_loadDefaultSvgIcon", + value: function() { + if (!document.getElementById("tui-image-editor-svg-default-icons")) { + var A = new DOMParser(), D = ri.replace(/data:image\/svg\+xml;base64,/, ""), I = A.parseFromString(atob(D), "text/xml"); + document.body.appendChild(I.documentElement); + } + } + /** + * Make className for svg icon + * @param {string} iconType - normal' or 'active' or 'hover' or 'disabled + * @param {boolean} isSubmenu - submenu icon or not. + * @returns {string} + * @private + */ + }, { + key: "_makeIconClassName", + value: function(A, D) { + var I = D ? this.getStyle("submenu.icon") : this.getStyle("menu.icon"), k = I[A], B = k.path, H = k.name; + return B && H ? A : "".concat(A, " use-default"); + } + /** + * Make svg use link path name + * @param {string} iconType - normal' or 'active' or 'hover' or 'disabled + * @param {boolean} isSubmenu - submenu icon or not. + * @returns {string} + * @private + */ + }, { + key: "_makeSvgIconPrefix", + value: function(A, D) { + var I, k = D ? this.getStyle("submenu.icon") : this.getStyle("menu.icon"), B = k[A], H = B.path, Y = B.name; + return H && Y ? K()(I = "".concat(H, "#")).call(I, Y, "-") : "#"; + } + /** + * Make svg use link path name + * @param {Array.} useIconTypes - normal' or 'active' or 'hover' or 'disabled + * @param {string} menuName - menu name + * @param {boolean} isSubmenu - submenu icon or not. + * @returns {string} + * @private + */ + }, { + key: "_makeSvgItem", + value: function(A, D, I) { + var k = this; + return Er()(A).call(A, function(B) { + var H, Y, W = k._makeSvgIconPrefix(B, I), q = k._toUnderScore(D), ie = k._makeIconClassName(B, I); + return K()(H = K()(Y = ''); + }).join(""); + } + /** + * Make svg icon set + * @param {Array.} useIconTypes - normal' or 'active' or 'hover' or 'disabled + * @param {string} menuName - menu name + * @param {boolean} isSubmenu - submenu icon or not. + * @returns {string} + */ + }, { + key: "makeMenSvgIconSet", + value: function(A, D) { + var I, k = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; + return K()(I = '')).call(I, this._makeSvgItem(A, D, k), ""); + } + }]), V; + }(), Ln = Xn, ni = a(9146), Ve = /* @__PURE__ */ a.n(ni), Fa = a(6623), Zn = a(4230); + function ea(V, L) { + return ea = Zn || function(D, I) { + return D.__proto__ = I, D; + }, ea(V, L); + } + function Gt(V, L) { + if (typeof L != "function" && L !== null) + throw new TypeError("Super expression must either be null or a function"); + V.prototype = Fa(L && L.prototype, { + constructor: { + value: V, + writable: !0, + configurable: !0 + } + }), L && ea(V, L); + } + var Mr = a(3742); + function $a(V) { + "@babel/helpers - typeof"; + return typeof T == "function" && typeof Mr == "symbol" ? $a = function(A) { + return typeof A; + } : $a = function(A) { + return A && typeof T == "function" && A.constructor === T && A !== T.prototype ? "symbol" : typeof A; + }, $a(V); + } + function Cr(V) { + if (V === void 0) + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return V; + } + function Yt(V, L) { + if (L && ($a(L) === "object" || typeof L == "function")) + return L; + if (L !== void 0) + throw new TypeError("Derived constructors may only return object or undefined"); + return Cr(V); + } + var bi = a(9856); + function At(V) { + return At = Zn ? bi : function(A) { + return A.__proto__ || bi(A); + }, At(V); + } + var Jn = a(6092), hn = /* @__PURE__ */ a.n(Jn), fi = a(4858), Ws = /* @__PURE__ */ a.n(fi), Eo = ["#000000", "#2a2a2a", "#545454", "#7e7e7e", "#a8a8a8", "#d2d2d2", "#ffffff", "", "#ff4040", "#ff6518", "#ffbb3b", "#03bd9e", "#00a9ff", "#515ce6", "#9e5fff", "#ff5583"], pu = /* @__PURE__ */ function() { + function V(L, A) { + var D = A.defaultColor, I = D === void 0 ? "#7e7e7e" : D, k = A.toggleDirection, B = k === void 0 ? "up" : k, H = A.usageStatistics; + G(this, V), this.colorpickerElement = L, this.usageStatistics = H, this._show = !1, this._colorpickerElement = L, this._toggleDirection = B, this._makePickerButtonElement(I), this._makePickerLayerElement(L, L.getAttribute("title")), this._color = I, this.picker = Ws().create({ + container: this.pickerElement, + preset: Eo, + color: I, + usageStatistics: this.usageStatistics + }), this._addEvent(); + } + return ee(V, [{ + key: "destroy", + value: function() { + var A = this; + this._removeEvent(), this.picker.destroy(), this.colorpickerElement.innerHTML = "", le()(this, function(D, I) { + A[I] = null; + }); + } + /** + * Get color + * @returns {Number} color value + */ + }, { + key: "color", + get: function() { + return this._color; + }, + set: function(A) { + this._color = A, this._changeColorElement(A); + } + /** + * Change color element + * @param {string} color color value + * #private + */ + }, { + key: "_changeColorElement", + value: function(A) { + A ? (this.colorElement.classList.remove("transparent"), this.colorElement.style.backgroundColor = A) : (this.colorElement.style.backgroundColor = "#fff", this.colorElement.classList.add("transparent")); + } + /** + * Make picker button element + * @param {string} defaultColor color value + * @private + */ + }, { + key: "_makePickerButtonElement", + value: function(A) { + this.colorpickerElement.classList.add("tui-image-editor-button"), this.colorElement = document.createElement("div"), this.colorElement.className = "color-picker-value", A ? this.colorElement.style.backgroundColor = A : this.colorElement.classList.add("transparent"); + } + /** + * Make picker layer element + * @param {HTMLElement} colorpickerElement color picker element + * @param {string} title picker title + * @private + */ + }, { + key: "_makePickerLayerElement", + value: function(A, D) { + var I = document.createElement("label"), k = document.createElement("div"); + this.pickerControl = document.createElement("div"), this.pickerControl.className = "color-picker-control", this.pickerElement = document.createElement("div"), this.pickerElement.className = "color-picker", I.innerHTML = D, k.className = "triangle", this.pickerControl.appendChild(this.pickerElement), this.pickerControl.appendChild(k), A.appendChild(this.pickerControl), A.appendChild(this.colorElement), A.appendChild(I); + } + /** + * Add event + * @private + */ + }, { + key: "_addEvent", + value: function() { + var A = this, D; + this.picker.on("selectColor", function(I) { + A._changeColorElement(I.color), A._color = I.color, A.fire("change", I.color); + }), this.eventHandler = { + pickerToggle: ne()(D = this._pickerToggleEventHandler).call(D, this), + pickerHide: function() { + return A.hide(); + } + }, this.colorpickerElement.addEventListener("click", this.eventHandler.pickerToggle), document.body.addEventListener("click", this.eventHandler.pickerHide); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this.colorpickerElement.removeEventListener("click", this.eventHandler.pickerToggle), document.body.removeEventListener("click", this.eventHandler.pickerHide), this.picker.off(); + } + /** + * Picker toggle event handler + * @param {object} event - change event + * @private + */ + }, { + key: "_pickerToggleEventHandler", + value: function(A) { + var D = A.target, I = D && this._isElementInColorPickerControl(D); + (!I || I && this._isPaletteButton(D)) && (this._show = !this._show, this.pickerControl.style.display = this._show ? "block" : "none", this._setPickerControlPosition(), this.fire("changeShow", this)), A.stopPropagation(); + } + /** + * Check hex input or not + * @param {Element} target - Event target element + * @returns {boolean} + * @private + */ + }, { + key: "_isPaletteButton", + value: function(A) { + return A.className === "tui-colorpicker-palette-button"; + } + /** + * Check given element is in pickerControl element + * @param {Element} element - element to check + * @returns {boolean} + * @private + */ + }, { + key: "_isElementInColorPickerControl", + value: function(A) { + for (var D = A; D !== document.body && D; ) { + if (D === this.pickerControl) + return !0; + D = D.parentNode; + } + return !1; + } + }, { + key: "hide", + value: function() { + this._show = !1, this.pickerControl.style.display = "none"; + } + /** + * Set picker control position + * @private + */ + }, { + key: "_setPickerControlPosition", + value: function() { + var A = this.pickerControl.style, D = this._colorpickerElement.clientWidth / 2 + 2, I = this.pickerControl.offsetWidth / 2 - D, k = (this.pickerControl.offsetHeight + 10) * -1; + this._toggleDirection === "down" && (k = 30), A.top = "".concat(k, "px"), A.left = "-".concat(I, "px"); + } + }]), V; + }(); + Ae().mixin(pu); + var nn = pu, Ys = /(-?)([0-9]*)[^0-9]*([0-9]*)/g, _n = /* @__PURE__ */ function() { + function V(L) { + var A, D, I, k, B, H, Y, W = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + G(this, V), this._value = W.value || 0, this.rangeElement = L.slider, this.rangeInputElement = L.input, this._drawRangeElement(), this.rangeWidth = this._getRangeWidth(), this._min = W.min || 0, this._max = W.max || 100, this._useDecimal = W.useDecimal, this._absMax = this._min * -1 + this._max, this.realTimeEvent = W.realTimeEvent || !1, this._userInputTimer = null, this.eventHandler = { + startChangingSlide: ne()(A = this._startChangingSlide).call(A, this), + stopChangingSlide: ne()(D = this._stopChangingSlide).call(D, this), + changeSlide: ne()(I = this._changeSlide).call(I, this), + changeSlideFinally: ne()(k = this._changeSlideFinally).call(k, this), + changeInput: ne()(B = this._changeInput).call(B, this), + changeInputFinally: ne()(H = this._changeValueWithInput).call(H, this, !0), + changeInputWithArrow: ne()(Y = this._changeValueWithInputKeyEvent).call(Y, this) + }, this._addClickEvent(), this._addDragEvent(), this._addInputEvent(), this.value = W.value, this.trigger("change"); + } + return ee(V, [{ + key: "destroy", + value: function() { + var A = this; + this._removeClickEvent(), this._removeDragEvent(), this._removeInputEvent(), this.rangeElement.innerHTML = "", le()(this, function(D, I) { + A[I] = null; + }); + } + }, { + key: "max", + get: function() { + return this._max; + }, + set: function(A) { + this._max = A, this._absMax = this._min * -1 + this._max, this.value = this._value; + } + }, { + key: "min", + get: function() { + return this._min; + }, + set: function(A) { + this._min = A, this.max = this._max; + } + /** + * Get range value + * @returns {Number} range value + */ + }, { + key: "value", + get: function() { + return this._value; + }, + set: function(A) { + A = this._useDecimal ? A : Lr(A); + var D = A - this._min, I = D * this.rangeWidth / this._absMax; + this.rangeWidth < I && (I = this.rangeWidth), this.pointer.style.left = "".concat(I, "px"), this.subbar.style.right = "".concat(this.rangeWidth - I, "px"), this._value = A, this.rangeInputElement && (this.rangeInputElement.value = A); + } + /** + * event trigger + * @param {string} type - type + */ + }, { + key: "trigger", + value: function(A) { + this.fire(A, this._value); + } + /** + * Calculate slider width + * @returns {number} - slider width + */ + }, { + key: "_getRangeWidth", + value: function() { + var A = function(I) { + return Lr(window.getComputedStyle(I, null).width); + }; + return A(this.rangeElement) - A(this.pointer); + } + /** + * Make range element + * @private + */ + }, { + key: "_drawRangeElement", + value: function() { + this.rangeElement.classList.add("tui-image-editor-range"), this.bar = document.createElement("div"), this.bar.className = "tui-image-editor-virtual-range-bar", this.subbar = document.createElement("div"), this.subbar.className = "tui-image-editor-virtual-range-subbar", this.pointer = document.createElement("div"), this.pointer.className = "tui-image-editor-virtual-range-pointer", this.bar.appendChild(this.subbar), this.bar.appendChild(this.pointer), this.rangeElement.appendChild(this.bar); + } + /** + * Add range input editing event + * @private + */ + }, { + key: "_addInputEvent", + value: function() { + this.rangeInputElement && (this.rangeInputElement.addEventListener("keydown", this.eventHandler.changeInputWithArrow), this.rangeInputElement.addEventListener("keydown", this.eventHandler.changeInput), this.rangeInputElement.addEventListener("blur", this.eventHandler.changeInputFinally)); + } + /** + * Remove range input editing event + * @private + */ + }, { + key: "_removeInputEvent", + value: function() { + this.rangeInputElement && (this.rangeInputElement.removeEventListener("keydown", this.eventHandler.changeInputWithArrow), this.rangeInputElement.removeEventListener("keydown", this.eventHandler.changeInput), this.rangeInputElement.removeEventListener("blur", this.eventHandler.changeInputFinally)); + } + /** + * change angle event + * @param {object} event - key event + * @private + */ + }, { + key: "_changeValueWithInputKeyEvent", + value: function(A) { + var D, I = A.keyCode, k = A.target; + if (!(c()(D = [Vt.ARROW_UP, Vt.ARROW_DOWN]).call(D, I) < 0)) { + var B = Number(k.value); + B = this._valueUpDownForKeyEvent(B, I); + var H = B < this._min || B > this._max; + if (!H) { + var Y = Dt(B, this._min, this.max); + this.value = Y, this.fire("change", Y, !1); + } + } + } + /** + * value up down for input + * @param {number} value - original value number + * @param {number} keyCode - input event key code + * @returns {number} value - changed value + * @private + */ + }, { + key: "_valueUpDownForKeyEvent", + value: function(A, D) { + var I = this._useDecimal ? 0.1 : 1; + return D === Vt.ARROW_UP ? A += I : D === Vt.ARROW_DOWN && (A -= I), A; + } + }, { + key: "_changeInput", + value: function(A) { + var D = this; + clearTimeout(this._userInputTimer); + var I = A.keyCode; + if (I < Vt.DIGIT_0 || I > Vt.DIGIT_9) { + A.preventDefault(); + return; + } + this._userInputTimer = y()(function() { + D._inputSetValue(A.target.value); + }, 350); + } + }, { + key: "_inputSetValue", + value: function(A) { + var D = this._useDecimal ? Number(A) : Lr(A); + D = Dt(D, this._min, this.max), this.value = D, this.fire("change", D, !0); + } + /** + * change angle event + * @param {boolean} isLast - Is last change + * @param {object} event - key event + * @private + */ + }, { + key: "_changeValueWithInput", + value: function(A, D) { + var I, k = D.keyCode, B = D.target; + if (!(c()(I = [Vt.ARROW_UP, Vt.ARROW_DOWN]).call(I, k) >= 0)) { + var H = this._filterForInputText(B.value), Y = !H || isNaN(H); + B.value = H, Y || this._inputSetValue(H); + } + } + /** + * Add Range click event + * @private + */ + }, { + key: "_addClickEvent", + value: function() { + this.rangeElement.addEventListener("click", this.eventHandler.changeSlideFinally); + } + /** + * Remove Range click event + * @private + */ + }, { + key: "_removeClickEvent", + value: function() { + this.rangeElement.removeEventListener("click", this.eventHandler.changeSlideFinally); + } + /** + * Add Range drag event + * @private + */ + }, { + key: "_addDragEvent", + value: function() { + this.pointer.addEventListener("mousedown", this.eventHandler.startChangingSlide); + } + /** + * Remove Range drag event + * @private + */ + }, { + key: "_removeDragEvent", + value: function() { + this.pointer.removeEventListener("mousedown", this.eventHandler.startChangingSlide); + } + /** + * change angle event + * @param {object} event - change event + * @private + */ + }, { + key: "_changeSlide", + value: function(A) { + var D = A.screenX, I = D - this.firstPosition, k = this.firstLeft + I; + k = k > this.rangeWidth ? this.rangeWidth : k, k = k < 0 ? 0 : k, this.pointer.style.left = "".concat(k, "px"), this.subbar.style.right = "".concat(this.rangeWidth - k, "px"); + var B = k / this.rangeWidth, H = this._absMax * B + this._min, Y = this._useDecimal ? H : Lr(H), W = this.value !== Y; + W && (this.value = Y, this.realTimeEvent && this.fire("change", this._value, !1)); + } + }, { + key: "_changeSlideFinally", + value: function(A) { + if (A.stopPropagation(), A.target.className === "tui-image-editor-range") { + var D = A.offsetX, I = D / this.rangeWidth, k = this._absMax * I + this._min; + this.pointer.style.left = "".concat(I * this.rangeWidth, "px"), this.subbar.style.right = "".concat((1 - I) * this.rangeWidth, "px"), this.value = k, this.fire("change", k, !0); + } + } + }, { + key: "_startChangingSlide", + value: function(A) { + this.firstPosition = A.screenX, this.firstLeft = Lr(this.pointer.style.left) || 0, document.addEventListener("mousemove", this.eventHandler.changeSlide), document.addEventListener("mouseup", this.eventHandler.stopChangingSlide); + } + /** + * stop change angle event + * @private + */ + }, { + key: "_stopChangingSlide", + value: function() { + this.fire("change", this._value, !0), document.removeEventListener("mousemove", this.eventHandler.changeSlide), document.removeEventListener("mouseup", this.eventHandler.stopChangingSlide); + } + /** + * Unnecessary string filtering. + * @param {string} inputValue - origin string of input + * @returns {string} filtered string + * @private + */ + }, { + key: "_filterForInputText", + value: function(A) { + return A.replace(Ys, "$1$2$3"); + } + }]), V; + }(); + Ae().mixin(_n); + var di = _n, ii = /* @__PURE__ */ function() { + function V(L, A) { + var D = A.locale, I = A.name, k = A.makeSvgIcon, B = A.menuBarPosition, H = A.templateHtml, Y = A.usageStatistics; + G(this, V), this.subMenuElement = L, this.menuBarPosition = B, this.toggleDirection = B === "top" ? "down" : "up", this.colorPickerControls = [], this.usageStatistics = Y, this.eventHandler = {}, this._makeSubMenuElement({ + locale: D, + name: I, + makeSvgIcon: k, + templateHtml: H + }); + } + return ee(V, [{ + key: "selector", + value: function(A) { + return this.subMenuElement.querySelector(A); + } + /** + * change show state change for colorpicker instance + * @param {Colorpicker} occurredControl - target Colorpicker Instance + */ + }, { + key: "colorPickerChangeShow", + value: function(A) { + var D; + yt()(D = this.colorPickerControls).call(D, function(I) { + A !== I && I.hide(); + }); + } + /** + * Get button type + * @param {HTMLElement} button - event target element + * @param {array} buttonNames - Array of button names + * @returns {string} - button type + */ + }, { + key: "getButtonType", + value: function(A, D) { + return A.className.match(RegExp("(".concat(D.join("|"), ")")))[0]; + } + /** + * Get button type + * @param {HTMLElement} target - event target element + * @param {string} removeClass - remove class name + * @param {string} addClass - add class name + */ + }, { + key: "changeClass", + value: function(A, D, I) { + A.classList.remove(D), A.classList.add(I); + } + /** + * Interface method whose implementation is optional. + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + } + /** + * Interface method whose implementation is optional. + * Executed when the menu starts. + */ + }, { + key: "changeStartMode", + value: function() { + } + /** + * Make submenu dom element + * @param {Locale} locale - translate text + * @param {string} name - submenu name + * @param {Object} iconStyle - icon style + * @param {*} templateHtml - template for SubMenuElement + * @private + */ + }, { + key: "_makeSubMenuElement", + value: function(A) { + var D = A.locale, I = A.name, k = A.iconStyle, B = A.makeSvgIcon, H = A.templateHtml, Y = document.createElement("div"); + Y.className = "tui-image-editor-menu-".concat(I), Y.innerHTML = H({ + locale: D, + iconStyle: k, + makeSvgIcon: B + }), this.subMenuElement.appendChild(Y); + } + }, { + key: "_onStartEditingInputBox", + value: function() { + this.fire(Re.INPUT_BOX_EDITING_STARTED); + } + }, { + key: "_onStopEditingInputBox", + value: function() { + this.fire(Re.INPUT_BOX_EDITING_STOPPED); + } + }]), V; + }(); + Ae().mixin(ii); + var vi = ii, hs = function(V) { + var L, A, D, I, k, B, H, Y, W = V.locale, q = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = ` +
          +
        • +
          +
          + `.concat(q(["normal", "active"], "shape-rectangle", !0), ` +
          + +
          +
          +
          + `)).call(H, q(["normal", "active"], "shape-circle", !0), ` +
          + +
          +
          +
          + `)).call(k, q(["normal", "active"], "shape-triangle", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
          +
        • +
        • +
          +
        • +
        • + +
          + +
        • +
        +`); + }; + function gu(V) { + var L = mt(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function mt() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Ha = { + stroke: "#ffbb3b", + fill: "", + strokeWidth: 3 + }, Fi = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = gu(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "shape", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: hs, + usageStatistics: W + }), k.type = null, k.options = Ha, k._els = { + shapeSelectButton: k.selector(".tie-shape-button"), + shapeColorButton: k.selector(".tie-shape-color-button"), + strokeRange: new di({ + slider: k.selector(".tie-stroke-range"), + input: k.selector(".tie-stroke-range-value") + }, oo), + fillColorpicker: new nn(k.selector(".tie-color-fill"), { + defaultColor: "", + toggleDirection: k.toggleDirection, + usageStatistics: k.usageStatistics + }), + strokeColorpicker: new nn(k.selector(".tie-color-stroke"), { + defaultColor: "#ffbb3b", + toggleDirection: k.toggleDirection, + usageStatistics: k.usageStatistics + }) + }, k.colorPickerControls.push(k._els.fillColorpicker), k.colorPickerControls.push(k._els.strokeColorpicker), k.colorPickerInputBoxes = [], k.colorPickerInputBoxes.push(k._els.fillColorpicker.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX)), k.colorPickerInputBoxes.push(k._els.strokeColorpicker.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX)), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._els.strokeRange.destroy(), this._els.fillColorpicker.destroy(), this._els.strokeColorpicker.destroy(), Wn(this); + } + /** + * Add event for shape + * @param {Object} actions - actions for shape + * @param {Function} actions.changeShape - change shape mode + * @param {Function} actions.setDrawingShape - set drawing shape + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y, W, q, ie = this; + this.eventHandler.shapeTypeSelected = ne()(k = this._changeShapeHandler).call(k, this), this.actions = I, this._els.shapeSelectButton.addEventListener("click", this.eventHandler.shapeTypeSelected), this._els.strokeRange.on("change", ne()(B = this._changeStrokeRangeHandler).call(B, this)), this._els.fillColorpicker.on("change", ne()(H = this._changeFillColorHandler).call(H, this)), this._els.strokeColorpicker.on("change", ne()(Y = this._changeStrokeColorHandler).call(Y, this)), this._els.fillColorpicker.on("changeShow", ne()(W = this.colorPickerChangeShow).call(W, this)), this._els.strokeColorpicker.on("changeShow", ne()(q = this.colorPickerChangeShow).call(q, this)), hn()(this.colorPickerInputBoxes, function(Se) { + var Ce, De; + Se.addEventListener(Re.FOCUS, ne()(Ce = ie._onStartEditingInputBox).call(Ce, ie)), Se.addEventListener(Re.BLUR, ne()(De = ie._onStopEditingInputBox).call(De, ie)); + }, this); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + var I = this; + this._els.shapeSelectButton.removeEventListener("click", this.eventHandler.shapeTypeSelected), this._els.strokeRange.off(), this._els.fillColorpicker.off(), this._els.strokeColorpicker.off(), hn()(this.colorPickerInputBoxes, function(k) { + var B, H; + k.removeEventListener(Re.FOCUS, ne()(B = I._onStartEditingInputBox).call(B, I)), k.removeEventListener(Re.BLUR, ne()(H = I._onStopEditingInputBox).call(H, I)); + }, this); + } + /** + * Set Shape status + * @param {Object} options - options of shape status + * @param {string} strokeWidth - stroke width + * @param {string} strokeColor - stroke color + * @param {string} fillColor - fill color + */ + }, { + key: "setShapeStatus", + value: function(I) { + var k = I.strokeWidth, B = I.strokeColor, H = I.fillColor; + this._els.strokeRange.value = k, this._els.strokeColorpicker.color = B, this._els.fillColorpicker.color = H, this.options.stroke = B, this.options.fill = H, this.options.strokeWidth = k, this.actions.setDrawingShape(this.type, { + strokeWidth: k + }); + } + /** + * Executed when the menu starts. + */ + }, { + key: "changeStartMode", + value: function() { + this.actions.stopDrawingMode(); + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.type = null, this.actions.changeSelectableAll(!0), this._els.shapeSelectButton.classList.remove("circle"), this._els.shapeSelectButton.classList.remove("triangle"), this._els.shapeSelectButton.classList.remove("rect"); + } + /** + * set range stroke max value + * @param {number} maxValue - expect max value for change + */ + }, { + key: "setMaxStrokeValue", + value: function(I) { + var k = I; + k <= 0 && (k = oo.max), this._els.strokeRange.max = k; + } + /** + * Set stroke value + * @param {number} value - expect value for strokeRange change + */ + }, { + key: "setStrokeValue", + value: function(I) { + this._els.strokeRange.value = I, this._els.strokeRange.trigger("change"); + } + /** + * Get stroke value + * @returns {number} - stroke range value + */ + }, { + key: "getStrokeValue", + value: function() { + return this._els.strokeRange.value; + } + /** + * Change icon color + * @param {object} event - add button event object + * @private + */ + }, { + key: "_changeShapeHandler", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"); + if (k) { + this.actions.stopDrawingMode(), this.actions.discardSelection(); + var B = this.getButtonType(k, ["circle", "triangle", "rect"]); + if (this.type === B) { + this.changeStandbyMode(); + return; + } + this.changeStandbyMode(), this.type = B, I.currentTarget.classList.add(B), this.actions.changeSelectableAll(!1), this.actions.modeChange("shape"); + } + } + /** + * Change stroke range + * @param {number} value - stroke range value + * @param {boolean} isLast - Is last change + * @private + */ + }, { + key: "_changeStrokeRangeHandler", + value: function(I, k) { + this.options.strokeWidth = Lr(I), this.actions.changeShape({ + strokeWidth: I + }, !k), this.actions.setDrawingShape(this.type, this.options); + } + /** + * Change shape color + * @param {string} color - fill color + * @private + */ + }, { + key: "_changeFillColorHandler", + value: function(I) { + I = I || "transparent", this.options.fill = I, this.actions.changeShape({ + fill: I + }); + } + /** + * Change shape stroke color + * @param {string} color - fill color + * @private + */ + }, { + key: "_changeStrokeColorHandler", + value: function(I) { + I = I || "transparent", this.options.stroke = I, this.actions.changeShape({ + stroke: I + }); + } + }]), A; + }(vi), fs = Fi, mu = function(V) { + var L, A, D, I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt, Pt = V.locale, zt = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = K()(ie = K()(Se = K()(Ce = K()(De = K()(Ee = K()(Le = K()(rt = ` +
          +
        • +
          +
          + `.concat(zt(["normal", "active"], "shape-rectangle", !0), ` +
          + +
          +
          +
          + `)).call(Le, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
          +
          + `)).call(De, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
          +
          + `)).call(Se, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
          +
          + `)).call(q, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
          +
          + `)).call(Y, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
          +
          + `)).call(B, zt(["normal", "active"], "crop", !0), ` +
          + +
          +
        • +
        • +
        • +
        • +
          +
        • +
        • +
          + `)).call(I, zt(["normal", "active"], "apply"), ` + +
          +
          + `)).call(A, zt(["normal", "active"], "cancel"), ` + +
          +
        • +
        +`); + }; + function Ec(V) { + var L = Pi(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Pi() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var yu = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Ec(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "crop", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: mu, + usageStatistics: W + }), k.status = "active", k._els = { + apply: k.selector(".tie-crop-button .apply"), + cancel: k.selector(".tie-crop-button .cancel"), + preset: k.selector(".tie-crop-preset-button") + }, k.defaultPresetButton = k._els.preset.querySelector(".preset-none"), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), Wn(this); + } + /** + * Add event for crop + * @param {Object} actions - actions for crop + * @param {Function} actions.crop - crop action + * @param {Function} actions.cancel - cancel action + * @param {Function} actions.preset - draw rectzone at a predefined ratio + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y = ne()(k = this._applyEventHandler).call(k, this), W = ne()(B = this._cancelEventHandler).call(B, this), q = ne()(H = this._cropzonePresetEventHandler).call(H, this); + this.eventHandler = { + apply: Y, + cancel: W, + cropzonePreset: q + }, this.actions = I, this._els.apply.addEventListener("click", Y), this._els.cancel.addEventListener("click", W), this._els.preset.addEventListener("click", q); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this._els.apply.removeEventListener("click", this.eventHandler.apply), this._els.cancel.removeEventListener("click", this.eventHandler.cancel), this._els.preset.removeEventListener("click", this.eventHandler.cropzonePreset); + } + }, { + key: "_applyEventHandler", + value: function() { + this.actions.crop(), this._els.apply.classList.remove("active"); + } + }, { + key: "_cancelEventHandler", + value: function() { + this.actions.cancel(), this._els.apply.classList.remove("active"); + } + }, { + key: "_cropzonePresetEventHandler", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button.preset"); + if (k) { + var B = k.className.match(/preset-[^\s]+/), H = we(B, 1), Y = H[0]; + this._setPresetButtonActive(k), this.actions.preset(Y); + } + } + /** + * Executed when the menu starts. + */ + }, { + key: "changeStartMode", + value: function() { + this.actions.modeChange("crop"); + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.actions.stopDrawingMode(), this._setPresetButtonActive(); + } + /** + * Change apply button status + * @param {Boolean} enableStatus - apply button status + */ + }, { + key: "changeApplyButtonStatus", + value: function(I) { + I ? this._els.apply.classList.add("active") : this._els.apply.classList.remove("active"); + } + /** + * Set preset button to active status + * @param {HTMLElement} button - event target element + * @private + */ + }, { + key: "_setPresetButtonActive", + value: function() { + var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.defaultPresetButton; + le()(this._els.preset.querySelectorAll(".preset"), function(k) { + k.classList.remove("active"); + }), I && I.classList.add("active"); + } + }]), A; + }(vi), _u = yu, bu = function(V) { + var L, A, D, I, k, B, H = V.locale, Y = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = ` +
          +
        • +
          + +
          + +
          + +
          + +
          +
        • +
        • +
        • +
          +
        • +
        • +
          +
          + +
          +
          +
        • +
        • +
        • +
          +
        • +
        • +
        • +
          + `)).call(I, Y(["normal", "active"], "apply"), ` + +
          +
          + `)).call(A, Y(["normal", "active"], "cancel"), ` + +
          +
        • +
        +`); + }; + function Mo(V) { + var L = ta(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function ta() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Do = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Mo(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "resize", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: bu, + usageStatistics: W + }), k.status = "active", k._lockState = !1, k._originalDimensions = null, k._els = { + widthRange: new di({ + slider: k.selector(".tie-width-range"), + input: k.selector(".tie-width-range-value") + }, jr), + heightRange: new di({ + slider: k.selector(".tie-height-range"), + input: k.selector(".tie-height-range-value") + }, jr), + lockAspectRatio: k.selector(".tie-lock-aspect-ratio"), + apply: k.selector(".tie-resize-button .apply"), + cancel: k.selector(".tie-resize-button .cancel") + }, k; + } + return ee(A, [{ + key: "changeStartMode", + value: function() { + this.actions.modeChange("resize"); + var I = this.actions.getCurrentDimensions(); + this._originalDimensions = I, this.setWidthValue(I.width), this.setHeightValue(I.height); + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.actions.stopDrawingMode(), this.actions.reset(!0); + } + /** + * Set dimension limits + * @param {object} limits - expect dimension limits for change + */ + }, { + key: "setLimit", + value: function(I) { + this._els.widthRange.min = this.calcMinValue(I.minWidth), this._els.heightRange.min = this.calcMinValue(I.minHeight), this._els.widthRange.max = this.calcMaxValue(I.maxWidth), this._els.heightRange.max = this.calcMaxValue(I.maxHeight); + } + /** + * Calculate max value + * @param {number} maxValue - max value + * @returns {number} + */ + }, { + key: "calcMaxValue", + value: function(I) { + return I <= 0 && (I = jr.max), I; + } + /** + * Calculate min value + * @param {number} minValue - min value + * @returns {number} + */ + }, { + key: "calcMinValue", + value: function(I) { + return I <= 0 && (I = jr.min), I; + } + /** + * Set width value + * @param {number} value - expect value for widthRange change + * @param {boolean} trigger - fire change event control + */ + }, { + key: "setWidthValue", + value: function(I) { + var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; + this._els.widthRange.value = I, k && this._els.widthRange.trigger("change"); + } + /** + * Set height value + * @param {number} value - expect value for heightRange change + * @param {boolean} trigger - fire change event control + */ + }, { + key: "setHeightValue", + value: function(I) { + var k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; + this._els.heightRange.value = I, k && this._els.heightRange.trigger("change"); + } + /** + * Destroys the instance. + */ + }, { + key: "destroy", + value: function() { + this._removeEvent(), Wn(this); + } + /** + * Add event for resize + * @param {Object} actions - actions for resize + * @param {Function} actions.resize - resize action + * @param {Function} actions.preview - preview action + * @param {Function} actions.getCurrentDimensions - Get current dimensions action + * @param {Function} actions.modeChange - change mode + * @param {Function} actions.stopDrawingMode - stop drawing mode + * @param {Function} actions.lockAspectRatio - lock aspect ratio + * @param {Function} actions.reset - reset action + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y, W; + this._els.widthRange.on("change", ne()(k = this._changeWidthRangeHandler).call(k, this)), this._els.heightRange.on("change", ne()(B = this._changeHeightRangeHandler).call(B, this)), this._els.lockAspectRatio.addEventListener("change", ne()(H = this._changeLockAspectRatio).call(H, this)); + var q = ne()(Y = this._applyEventHandler).call(Y, this), ie = ne()(W = this._cancelEventHandler).call(W, this); + this.eventHandler = { + apply: q, + cancel: ie + }, this.actions = I, this._els.apply.addEventListener("click", q), this._els.cancel.addEventListener("click", ie); + } + /** + * Change width + * @param {number} value - width range value + * @private + */ + }, { + key: "_changeWidthRangeHandler", + value: function(I) { + this.actions.preview("width", Lr(I), this._lockState); + } + /** + * Change height + * @param {number} value - height range value + * @private + */ + }, { + key: "_changeHeightRangeHandler", + value: function(I) { + this.actions.preview("height", Lr(I), this._lockState); + } + /** + * Change lock aspect ratio state + * @param {Event} event - aspect ratio check event + * @private + */ + }, { + key: "_changeLockAspectRatio", + value: function(I) { + this._lockState = I.target.checked, this.actions.lockAspectRatio(this._lockState, jr.min, jr.max); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this._els.apply.removeEventListener("click", this.eventHandler.apply), this._els.cancel.removeEventListener("click", this.eventHandler.cancel); + } + }, { + key: "_applyEventHandler", + value: function() { + this.actions.resize(), this._els.apply.classList.remove("active"); + } + }, { + key: "_cancelEventHandler", + value: function() { + this.actions.reset(), this._els.cancel.classList.remove("active"); + } + /** + * Change apply button status + * @param {Boolean} enableStatus - apply button status + */ + }, { + key: "changeApplyButtonStatus", + value: function(I) { + I ? this._els.apply.classList.add("active") : this._els.apply.classList.remove("active"); + } + }]), A; + }(vi), Fr = Do, ra = function(V) { + var L, A, D, I, k, B = V.locale, H = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = ` +
          +
        • +
          +
          + `.concat(H(["normal", "active"], "flip-x", !0), ` +
          + +
          +
          +
          + `)).call(I, H(["normal", "active"], "flip-y", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
          + `)).call(A, H(["normal", "active"], "flip-reset", !0), ` +
          + +
          +
        • +
        +`); + }; + function Va(V) { + var L = Xs(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Xs() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var xi = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Va(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "flip", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: ra, + usageStatistics: W + }), k.flipStatus = !1, k._els = { + flipButton: k.selector(".tie-flip-button") + }, k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), Wn(this); + } + /** + * Add event for flip + * @param {Object} actions - actions for flip + * @param {Function} actions.flip - flip action + */ + }, { + key: "addEvent", + value: function(I) { + var k; + this.eventHandler.changeFlip = ne()(k = this._changeFlip).call(k, this), this._actions = I, this._els.flipButton.addEventListener("click", this.eventHandler.changeFlip); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this._els.flipButton.removeEventListener("click", this.eventHandler.changeFlip); + } + /** + * change Flip status + * @param {object} event - change event + * @private + */ + }, { + key: "_changeFlip", + value: function(I) { + var k = this, B = I.target.closest(".tui-image-editor-button"); + if (B) { + var H = this.getButtonType(B, ["flipX", "flipY", "resetFlip"]); + if (!this.flipStatus && H === "resetFlip") + return; + this._actions.flip(H).then(function(Y) { + var W = k._els.flipButton.classList; + k.flipStatus = !1, W.remove("resetFlip"), le()(["flipX", "flipY"], function(q) { + W.remove(q), Y[q] && (W.add(q), W.add("resetFlip"), k.flipStatus = !0); + }); + }); + } + } + }]), A; + }(vi), kl = xi, ba = function(V) { + var L, A, D = V.locale, I = V.makeSvgIcon; + return K()(L = K()(A = ` +
          +
        • +
          +
          + `.concat(I(["normal", "active"], "rotate-clockwise", !0), ` +
          + +
          +
          +
          + `)).call(A, I(["normal", "active"], "rotate-counterclockwise", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • + +
          + +
        • +
        +`); + }; + function ko(V) { + var L = Ht(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Ht() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Nr = 30, gr = -30, z = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = ko(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "rotate", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: ba, + usageStatistics: W + }), k._value = 0, k._els = { + rotateButton: k.selector(".tie-rotate-button"), + rotateRange: new di({ + slider: k.selector(".tie-rotate-range"), + input: k.selector(".tie-rotate-range-value") + }, Fn) + }, k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._els.rotateRange.destroy(), Wn(this); + } + }, { + key: "setRangeBarAngle", + value: function(I, k) { + var B = k; + I === "rotate" && (B = Me()(this._els.rotateRange.value, 10) + k), this._setRangeBarRatio(B); + } + }, { + key: "_setRangeBarRatio", + value: function(I) { + this._els.rotateRange.value = I; + } + /** + * Add event for rotate + * @param {Object} actions - actions for crop + * @param {Function} actions.rotate - rotate action + * @param {Function} actions.setAngle - set angle action + */ + }, { + key: "addEvent", + value: function(I) { + var k, B; + this.eventHandler.rotationAngleChanged = ne()(k = this._changeRotateForButton).call(k, this), this.actions = I, this._els.rotateButton.addEventListener("click", this.eventHandler.rotationAngleChanged), this._els.rotateRange.on("change", ne()(B = this._changeRotateForRange).call(B, this)); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this._els.rotateButton.removeEventListener("click", this.eventHandler.rotationAngleChanged), this._els.rotateRange.off(); + } + /** + * Change rotate for range + * @param {number} value - angle value + * @param {boolean} isLast - Is last change + * @private + */ + }, { + key: "_changeRotateForRange", + value: function(I, k) { + var B = Lr(I); + this.actions.setAngle(B, !k), this._value = B; + } + /** + * Change rotate for button + * @param {object} event - add button event object + * @private + */ + }, { + key: "_changeRotateForButton", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"), B = this._els.rotateRange.value; + if (k) { + var H = this.getButtonType(k, ["counterclockwise", "clockwise"]), Y = { + clockwise: Nr, + counterclockwise: gr + }[H], W = Me()(B, 10) + Y, q = W >= -360 && W <= 360; + q && this.actions.rotate(Y); + } + } + }]), A; + }(vi), J = z, ve = function(V) { + var L, A, D, I, k, B, H, Y, W, q, ie, Se, Ce, De = V.locale, Ee = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = K()(ie = K()(Se = K()(Ce = ` +
          +
        • +
          +
          + `.concat(Ee(["normal", "active"], "text-bold", !0), ` +
          + +
          +
          +
          + `)).call(Se, Ee(["normal", "active"], "text-italic", !0), ` +
          + +
          +
          +
          + `)).call(q, Ee(["normal", "active"], "text-underline", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
          + `)).call(Y, Ee(["normal", "active"], "text-align-left", !0), ` +
          + +
          +
          +
          + `)).call(B, Ee(["normal", "active"], "text-align-center", !0), ` +
          + +
          +
          +
          + `)).call(I, Ee(["normal", "active"], "text-align-right", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
        • +
        • +
          +
        • +
        • + +
          + +
        • +
        +`); + }; + function ke(V) { + var L = it(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function it() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var ht = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = ke(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "text", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: ve, + usageStatistics: W + }), k.effect = { + bold: !1, + italic: !1, + underline: !1 + }, k.align = "tie-text-align-left", k._els = { + textEffectButton: k.selector(".tie-text-effect-button"), + textAlignButton: k.selector(".tie-text-align-button"), + textColorpicker: new nn(k.selector(".tie-text-color"), { + defaultColor: "#ffbb3b", + toggleDirection: k.toggleDirection, + usageStatistics: k.usageStatistics + }), + textRange: new di({ + slider: k.selector(".tie-text-range"), + input: k.selector(".tie-text-range-value") + }, Co) + }, k.colorPickerInputBox = k._els.textColorpicker.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._els.textColorpicker.destroy(), this._els.textRange.destroy(), Wn(this); + } + /** + * Add event for text + * @param {Object} actions - actions for text + * @param {Function} actions.changeTextStyle - change text style + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y, W, q, ie = ne()(k = this._setTextEffectHandler).call(k, this), Se = ne()(B = this._setTextAlignHandler).call(B, this); + this.eventHandler = { + setTextEffect: ie, + setTextAlign: Se + }, this.actions = I, this._els.textEffectButton.addEventListener("click", ie), this._els.textAlignButton.addEventListener("click", Se), this._els.textRange.on("change", ne()(H = this._changeTextRnageHandler).call(H, this)), this._els.textColorpicker.on("change", ne()(Y = this._changeColorHandler).call(Y, this)), this.colorPickerInputBox.addEventListener(Re.FOCUS, ne()(W = this._onStartEditingInputBox).call(W, this)), this.colorPickerInputBox.addEventListener(Re.BLUR, ne()(q = this._onStopEditingInputBox).call(q, this)); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + var I, k, B = this.eventHandler, H = B.setTextEffect, Y = B.setTextAlign; + this._els.textEffectButton.removeEventListener("click", H), this._els.textAlignButton.removeEventListener("click", Y), this._els.textRange.off(), this._els.textColorpicker.off(), this.colorPickerInputBox.removeEventListener(Re.FOCUS, ne()(I = this._onStartEditingInputBox).call(I, this)), this.colorPickerInputBox.removeEventListener(Re.BLUR, ne()(k = this._onStopEditingInputBox).call(k, this)); + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.actions.stopDrawingMode(); + } + /** + * Executed when the menu starts. + */ + }, { + key: "changeStartMode", + value: function() { + this.actions.modeChange("text"); + } + /** + * Get text color + * @returns {string} - text color + */ + }, { + key: "textColor", + get: function() { + return this._els.textColorpicker.color; + }, + set: function(I) { + this._els.textColorpicker.color = I; + } + /** + * Get text size + * @returns {string} - text size + */ + }, { + key: "fontSize", + get: function() { + return this._els.textRange.value; + }, + set: function(I) { + this._els.textRange.value = I; + } + /** + * get font style + * @returns {string} - font style + */ + }, { + key: "fontStyle", + get: function() { + return this.effect.italic ? "italic" : "normal"; + } + /** + * get font weight + * @returns {string} - font weight + */ + }, { + key: "fontWeight", + get: function() { + return this.effect.bold ? "bold" : "normal"; + } + /** + * get text underline text underline + * @returns {boolean} - true or false + */ + }, { + key: "underline", + get: function() { + return this.effect.underline; + } + }, { + key: "setTextStyleStateOnAction", + value: function() { + var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, k = ze()(I), B = I.fontSize, H = I.fontStyle, Y = I.fontWeight, W = I.textDecoration, q = I.textAlign; + this.textColor = k, this.fontSize = B, this.setEffectState("italic", H), this.setEffectState("bold", Y), this.setEffectState("underline", W), this.setAlignState("tie-text-align-".concat(q)); + } + }, { + key: "setEffectState", + value: function(I, k) { + var B = k === "italic" || k === "bold" || k === "underline", H = this._els.textEffectButton.querySelector(".tui-image-editor-button.".concat(I)); + this.effect[I] = B, H.classList[B ? "add" : "remove"]("active"); + } + }, { + key: "setAlignState", + value: function(I) { + var k = this._els.textAlignButton; + k.classList.remove(this.align), k.classList.add(I), this.align = I; + } + /** + * text effect set handler + * @param {object} event - add button event object + * @private + */ + }, { + key: "_setTextEffectHandler", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"); + if (k) { + var B = k.className.match(/(bold|italic|underline)/), H = we(B, 1), Y = H[0], W = { + bold: { + fontWeight: "bold" + }, + italic: { + fontStyle: "italic" + }, + underline: { + textDecoration: "underline" + } + }[Y]; + this.effect[Y] = !this.effect[Y], k.classList.toggle("active"), this.actions.changeTextStyle(W); + } + } + /** + * text effect set handler + * @param {object} event - add button event object + * @private + */ + }, { + key: "_setTextAlignHandler", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"); + if (k) { + var B = this.getButtonType(k, ["left", "center", "right"]), H = "tie-text-align-".concat(B); + I.currentTarget.classList.remove(this.align), this.align !== H && I.currentTarget.classList.add(H), this.actions.changeTextStyle({ + textAlign: B + }), this.align = H; + } + } + /** + * text align set handler + * @param {number} value - range value + * @param {boolean} isLast - Is last change + * @private + */ + }, { + key: "_changeTextRnageHandler", + value: function(I, k) { + this.actions.changeTextStyle({ + fontSize: I + }, !k); + } + /** + * change color handler + * @param {string} color - change color string + * @private + */ + }, { + key: "_changeColorHandler", + value: function(I) { + I = I || "transparent", this.actions.changeTextStyle({ + fill: I + }); + } + }]), A; + }(vi), Et = ht, Qt = function(V) { + var L, A, D, I = V.locale, k = V.makeSvgIcon; + return K()(L = K()(A = K()(D = ` +
          +
        • +
          +
          + + `.concat(k(["normal", "active"], "mask-load", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          + `)).call(A, k(["normal", "active"], "apply"), ` + +
          +
        • +
        +`); + }; + function lr(V) { + var L = zn(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function zn() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Bn = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = lr(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "mask", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: Qt, + usageStatistics: W + }), k._els = { + applyButton: k.selector(".tie-mask-apply"), + maskImageButton: k.selector(".tie-mask-image-file") + }, k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), Wn(this); + } + /** + * Add event for mask + * @param {Object} actions - actions for crop + * @param {Function} actions.loadImageFromURL - load image action + * @param {Function} actions.applyFilter - apply filter action + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H = ne()(k = this._loadMaskFile).call(k, this), Y = ne()(B = this._applyMask).call(B, this); + this.eventHandler = { + loadMaskFile: H, + applyMask: Y + }, this.actions = I, this._els.maskImageButton.addEventListener("change", H), this._els.applyButton.addEventListener("click", Y); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + this._els.maskImageButton.removeEventListener("change", this.eventHandler.loadMaskFile), this._els.applyButton.removeEventListener("click", this.eventHandler.applyMask); + } + /** + * Apply mask + * @private + */ + }, { + key: "_applyMask", + value: function() { + this.actions.applyFilter(), this._els.applyButton.classList.remove("active"); + } + /** + * Load mask file + * @param {object} event - File change event object + * @private + */ + }, { + key: "_loadMaskFile", + value: function(I) { + var k; + Nt() || alert("This browser does not support file-api"); + var B = we(I.target.files, 1), H = B[0]; + H && (k = oe().createObjectURL(H), this.actions.loadImageFromURL(k, H), this._els.applyButton.classList.add("active")); + } + }]), A; + }(vi), na = Bn, uo = function(V) { + var L, A, D, I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt, Pt, zt, Xt, dt = V.locale, on = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = K()(ie = K()(Se = K()(Ce = K()(De = K()(Ee = K()(Le = K()(rt = K()(Pt = K()(zt = K()(Xt = ` +
          +
        • +
          +
          + `.concat(on(["normal", "active"], "icon-arrow", !0), ` +
          + +
          +
          +
          + `)).call(zt, on(["normal", "active"], "icon-arrow-2", !0), ` +
          + +
          +
          +
          + `)).call(rt, on(["normal", "active"], "icon-arrow-3", !0), ` +
          + +
          +
          +
          + `)).call(Ee, on(["normal", "active"], "icon-star", !0), ` +
          + +
          +
          +
          + `)).call(Ce, on(["normal", "active"], "icon-star-2", !0), ` +
          + +
          + +
          +
          + `)).call(ie, on(["normal", "active"], "icon-polygon", !0), ` +
          + +
          + +
          +
          + `)).call(W, on(["normal", "active"], "icon-location", !0), ` +
          + +
          + +
          +
          + `)).call(H, on(["normal", "active"], "icon-heart", !0), ` +
          + +
          + +
          +
          + `)).call(k, on(["normal", "active"], "icon-bubble", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
          + + `)).call(D, on(["normal", "active"], "icon-load", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
        • +
        +`); + }; + function ds(V) { + var L = co(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function co() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Zs = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = ds(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "icon", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: uo, + usageStatistics: W + }), k.iconType = null, k._iconMap = {}, k._els = { + registerIconButton: k.selector(".tie-icon-image-file"), + addIconButton: k.selector(".tie-icon-add-button"), + iconColorpicker: new nn(k.selector(".tie-icon-color"), { + defaultColor: "#ffbb3b", + toggleDirection: k.toggleDirection, + usageStatistics: k.usageStatistics + }) + }, k.colorPickerInputBox = k._els.iconColorpicker.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._els.iconColorpicker.destroy(), Wn(this); + } + /** + * Add event for icon + * @param {Object} actions - actions for icon + * @param {Function} actions.registerCustomIcon - register icon + * @param {Function} actions.addIcon - add icon + * @param {Function} actions.changeColor - change icon color + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y, W, q = ne()(k = this._registerIconHandler).call(k, this), ie = ne()(B = this._addIconHandler).call(B, this); + this.eventHandler = { + registerIcon: q, + addIcon: ie + }, this.actions = I, this._els.iconColorpicker.on("change", ne()(H = this._changeColorHandler).call(H, this)), this._els.registerIconButton.addEventListener("change", q), this._els.addIconButton.addEventListener("click", ie), this.colorPickerInputBox.addEventListener(Re.FOCUS, ne()(Y = this._onStartEditingInputBox).call(Y, this)), this.colorPickerInputBox.addEventListener(Re.BLUR, ne()(W = this._onStopEditingInputBox).call(W, this)); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + var I, k; + this._els.iconColorpicker.off(), this._els.registerIconButton.removeEventListener("change", this.eventHandler.registerIcon), this._els.addIconButton.removeEventListener("click", this.eventHandler.addIcon), this.colorPickerInputBox.removeEventListener(Re.FOCUS, ne()(I = this._onStartEditingInputBox).call(I, this)), this.colorPickerInputBox.removeEventListener(Re.BLUR, ne()(k = this._onStopEditingInputBox).call(k, this)); + } + /** + * Clear icon type + */ + }, { + key: "clearIconType", + value: function() { + this._els.addIconButton.classList.remove(this.iconType), this.iconType = null; + } + /** + * Register default icon + */ + }, { + key: "registerDefaultIcon", + value: function() { + var I = this; + le()(pr, function(k, B) { + I.actions.registerDefaultIcons(B, k); + }); + } + /** + * Set icon picker color + * @param {string} iconColor - rgb color string + */ + }, { + key: "setIconPickerColor", + value: function(I) { + this._els.iconColorpicker.color = I; + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.clearIconType(), this.actions.cancelAddIcon(); + } + /** + * Change icon color + * @param {string} color - color for change + * @private + */ + }, { + key: "_changeColorHandler", + value: function(I) { + I = I || "transparent", this.actions.changeColor(I); + } + /** + * Change icon color + * @param {object} event - add button event object + * @private + */ + }, { + key: "_addIconHandler", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"); + if (k) { + var B = k.getAttribute("data-icontype"), H = this._els.iconColorpicker.color; + this.actions.discardSelection(), this.actions.changeSelectableAll(!1), this._els.addIconButton.classList.remove(this.iconType), this._els.addIconButton.classList.add(B), this.iconType === B ? this.changeStandbyMode() : (this.actions.addIcon(B, H), this.iconType = B); + } + } + /** + * register icon + * @param {object} event - file change event object + * @private + */ + }, { + key: "_registerIconHandler", + value: function(I) { + var k; + Nt || alert("This browser does not support file-api"); + var B = we(I.target.files, 1), H = B[0]; + H && (k = oe().createObjectURL(H), this.actions.registerCustomIcon(k, H)); + } + }]), A; + }(vi), vs = Zs, Ex = function(V) { + var L, A, D, I, k, B = V.locale, H = V.makeSvgIcon; + return K()(L = K()(A = K()(D = K()(I = K()(k = ` +
          +
        • +
          +
          + `.concat(H(["normal", "active"], "draw-free", !0), ` +
          + +
          +
          +
          + `)).call(I, H(["normal", "active"], "draw-line", !0), ` +
          + +
          +
        • +
        • +
          +
        • +
        • +
          +
        • +
        • +
          +
        • +
        • + +
          + +
        • +
        +`); + }; + function Mx(V) { + var L = Dx(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Dx() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var kx = 0.7, Ox = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Mx(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon, Y = I.menuBarPosition, W = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "draw", + makeSvgIcon: H, + menuBarPosition: Y, + templateHtml: Ex, + usageStatistics: W + }), k._els = { + lineSelectButton: k.selector(".tie-draw-line-select-button"), + drawColorPicker: new nn(k.selector(".tie-draw-color"), { + defaultColor: "#00a9ff", + toggleDirection: k.toggleDirection, + usageStatistics: k.usageStatistics + }), + drawRange: new di({ + slider: k.selector(".tie-draw-range"), + input: k.selector(".tie-draw-range-value") + }, Ra) + }, k.type = null, k.color = k._els.drawColorPicker.color, k.width = k._els.drawRange.value, k.colorPickerInputBox = k._els.drawColorPicker.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._els.drawColorPicker.destroy(), this._els.drawRange.destroy(), Wn(this); + } + /** + * Add event for draw + * @param {Object} actions - actions for crop + * @param {Function} actions.setDrawMode - set draw mode + */ + }, { + key: "addEvent", + value: function(I) { + var k, B, H, Y, W; + this.eventHandler.changeDrawType = ne()(k = this._changeDrawType).call(k, this), this.actions = I, this._els.lineSelectButton.addEventListener("click", this.eventHandler.changeDrawType), this._els.drawColorPicker.on("change", ne()(B = this._changeDrawColor).call(B, this)), this._els.drawRange.on("change", ne()(H = this._changeDrawRange).call(H, this)), this.colorPickerInputBox.addEventListener(Re.FOCUS, ne()(Y = this._onStartEditingInputBox).call(Y, this)), this.colorPickerInputBox.addEventListener(Re.BLUR, ne()(W = this._onStopEditingInputBox).call(W, this)); + } + /** + * Remove event + * @private + */ + }, { + key: "_removeEvent", + value: function() { + var I, k; + this._els.lineSelectButton.removeEventListener("click", this.eventHandler.changeDrawType), this._els.drawColorPicker.off(), this._els.drawRange.off(), this.colorPickerInputBox.removeEventListener(Re.FOCUS, ne()(I = this._onStartEditingInputBox).call(I, this)), this.colorPickerInputBox.removeEventListener(Re.BLUR, ne()(k = this._onStopEditingInputBox).call(k, this)); + } + /** + * set draw mode - action runner + */ + }, { + key: "setDrawMode", + value: function() { + this.actions.setDrawMode(this.type, { + width: this.width, + color: nt(this.color, kx) + }); + } + /** + * Returns the menu to its default state. + */ + }, { + key: "changeStandbyMode", + value: function() { + this.type = null, this.actions.stopDrawingMode(), this.actions.changeSelectableAll(!0), this._els.lineSelectButton.classList.remove("free"), this._els.lineSelectButton.classList.remove("line"); + } + /** + * Executed when the menu starts. + */ + }, { + key: "changeStartMode", + value: function() { + this.type = "free", this._els.lineSelectButton.classList.add("free"), this.setDrawMode(); + } + /** + * Change draw type event + * @param {object} event - line select event + * @private + */ + }, { + key: "_changeDrawType", + value: function(I) { + var k = I.target.closest(".tui-image-editor-button"); + if (k) { + var B = this.getButtonType(k, ["free", "line"]); + if (this.actions.discardSelection(), this.type === B) { + this.changeStandbyMode(); + return; + } + this.changeStandbyMode(), this.type = B, this._els.lineSelectButton.classList.add(B), this.setDrawMode(); + } + } + /** + * Change drawing color + * @param {string} color - select drawing color + * @private + */ + }, { + key: "_changeDrawColor", + value: function(I) { + this.color = I || "transparent", this.type ? this.setDrawMode() : this.changeStartMode(); + } + /** + * Change drawing Range + * @param {number} value - select drawing range + * @private + */ + }, { + key: "_changeDrawRange", + value: function(I) { + this.width = I, this.type ? this.setDrawMode() : this.changeStartMode(); + } + }]), A; + }(vi), Lx = Ox, Px = a(9886), wm = /* @__PURE__ */ a.n(Px), Rx = function(V) { + var L, A, D, I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt = V.locale; + return K()(L = K()(A = K()(D = K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = K()(ie = K()(Se = K()(Ce = K()(De = K()(Ee = K()(Le = ` +
          +
        • +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          +
          + +
          +
          +
        • +
        • +
          +
        • +
        • +
          +
          +
          + +
          +
          +
          + +
          +
          +
          +
          +
          + +
          +
          +
          +
          +
          +
          +
          + +
          +
          +
          +
          +
          +
        • +
        • +
          +
        • +
        • +
          +
          + +
          +
          +
          +
          +
          +
          +
          +
          + +
          +
          +
          + +
          +
          +
          +
        • +
        • +
          +
        • +
        • +
          +
          +
          + +
          +
          +
          +
          +
          + +
          +
          +
          +
          +
          + +
          +
          +
        • +
        +`); + }; + function Nx(V) { + var L = zx(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function zx() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Cm = "130px", Bx = ["add", "diff", "subtract", "multiply", "screen", "lighten", "darken"], Tm = ["grayscale", "invert", "sepia", "vintage", "blur", "sharpen", "emboss", "remove-white", "brightness", "noise", "pixelate", "color-filter", "tint", "multiply", "blend"], pv = { + grayscale: "grayscale", + invert: "invert", + sepia: "sepia", + blur: "blur", + sharpen: "sharpen", + emboss: "emboss", + removeWhite: "removeColor", + brightness: "brightness", + contrast: "contrast", + saturation: "saturation", + vintage: "vintage", + polaroid: "polaroid", + noise: "noise", + pixelate: "pixelate", + colorFilter: "removeColor", + tint: "blendColor", + multiply: "blendColor", + blend: "blendColor", + hue: "hue", + gamma: "gamma" + }, pf = ["removewhiteDistanceRange", "colorfilterThresholdRange", "pixelateRange", "noiseRange", "brightnessRange", "tintOpacity"], pi = ["filterBlendColor", "filterMultiplyColor", "filterTintColor"], Im = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Nx(A); + function A(D, I) { + var k, B = I.locale, H = I.menuBarPosition, Y = I.usageStatistics; + return G(this, A), k = L.call(this, D, { + locale: B, + name: "filter", + menuBarPosition: H, + templateHtml: Rx, + usageStatistics: Y + }), k.selectBoxShow = !1, k.checkedMap = {}, k._makeControlElement(), k; + } + return ee(A, [{ + key: "destroy", + value: function() { + this._removeEvent(), this._destroyToolInstance(), Wn(this); + } + /** + * Remove event for filter + */ + }, { + key: "_removeEvent", + value: function() { + var I = this, k; + le()(Tm, function(B) { + var H = I.selector(".tie-".concat(B)), Y = wr(B); + H.removeEventListener("change", I.eventHandler[Y]); + }), le()(K()(k = []).call(k, pf, pi), function(B) { + I._els[B].off(); + }), this._els.blendType.removeEventListener("change", this.eventHandler.changeBlendFilter), this._els.blendType.removeEventListener("click", this.eventHandler.changeBlendFilter), hn()(this.colorPickerInputBoxes, function(B) { + var H, Y; + B.removeEventListener(Re.FOCUS, ne()(H = I._onStartEditingInputBox).call(H, I)), B.removeEventListener(Re.BLUR, ne()(Y = I._onStopEditingInputBox).call(Y, I)); + }, this); + } + }, { + key: "_destroyToolInstance", + value: function() { + var I, k = this; + le()(K()(I = []).call(I, pf, pi), function(B) { + k._els[B].destroy(); + }); + } + /** + * Add event for filter + * @param {Object} actions - actions for crop + * @param {Function} actions.applyFilter - apply filter option + */ + }, { + key: "addEvent", + value: function(I) { + var k = this, B, H, Y, W = I.applyFilter, q = function(Ce) { + var De; + return ne()(De = k._changeFilterState).call(De, k, W, Ce); + }, ie = function(Ce) { + return function(De, Ee) { + return k._changeFilterState(W, Ce, Ee); + }; + }; + this.eventHandler = { + changeBlendFilter: q("blend"), + blandTypeClick: function(Ce) { + return Ce.stopPropagation(); + } + }, le()(Tm, function(Se) { + var Ce = k.selector(".tie-".concat(Se)), De = wr(Se); + k.checkedMap[De] = Ce, k.eventHandler[De] = q(De), Ce.addEventListener("change", k.eventHandler[De]); + }), this._els.removewhiteDistanceRange.on("change", ie("removeWhite")), this._els.colorfilterThresholdRange.on("change", ie("colorFilter")), this._els.pixelateRange.on("change", ie("pixelate")), this._els.noiseRange.on("change", ie("noise")), this._els.brightnessRange.on("change", ie("brightness")), this._els.filterBlendColor.on("change", this.eventHandler.changeBlendFilter), this._els.filterMultiplyColor.on("change", q("multiply")), this._els.filterTintColor.on("change", q("tint")), this._els.tintOpacity.on("change", ie("tint")), this._els.filterMultiplyColor.on("changeShow", ne()(B = this.colorPickerChangeShow).call(B, this)), this._els.filterTintColor.on("changeShow", ne()(H = this.colorPickerChangeShow).call(H, this)), this._els.filterBlendColor.on("changeShow", ne()(Y = this.colorPickerChangeShow).call(Y, this)), this._els.blendType.addEventListener("change", this.eventHandler.changeBlendFilter), this._els.blendType.addEventListener("click", this.eventHandler.blandTypeClick), hn()(this.colorPickerInputBoxes, function(Se) { + var Ce, De; + Se.addEventListener(Re.FOCUS, ne()(Ce = k._onStartEditingInputBox).call(Ce, k)), Se.addEventListener(Re.BLUR, ne()(De = k._onStopEditingInputBox).call(De, k)); + }, this); + } + /** + * Set filter for undo changed + * @param {Object} changedFilterInfos - changed command infos + * @param {string} type - filter type + * @param {string} action - add or remove + * @param {Object} options - filter options + */ + }, { + key: "setFilterState", + value: function(I) { + var k = I.type, B = I.options, H = I.action, Y = this._getFilterNameFromOptions(k, B), W = H === "remove"; + W || this._setFilterState(Y, B), this.checkedMap[Y].checked = !W; + } + /** + * Init all filter's checkbox to unchecked state + */ + }, { + key: "initFilterCheckBoxState", + value: function() { + le()(this.checkedMap, function(I) { + I.checked = !1; + }, this); + } + /** + * Set filter for undo changed + * @param {string} filterName - filter name + * @param {Object} options - filter options + * @private + */ + // eslint-disable-next-line complexity + }, { + key: "_setFilterState", + value: function(I, k) { + I === "colorFilter" ? this._els.colorfilterThresholdRange.value = k.distance : I === "removeWhite" ? this._els.removewhiteDistanceRange.value = k.distance : I === "pixelate" ? this._els.pixelateRange.value = k.blocksize : I === "brightness" ? this._els.brightnessRange.value = k.brightness : I === "noise" ? this._els.noiseRange.value = k.noise : I === "tint" ? (this._els.tintOpacity.value = k.alpha, this._els.filterTintColor.color = k.color) : I === "blend" ? this._els.filterBlendColor.color = k.color : I === "multiply" && (this._els.filterMultiplyColor.color = k.color); + } + /** + * Get filter name + * @param {string} type - filter type + * @param {Object} options - filter options + * @returns {string} filter name + * @private + */ + }, { + key: "_getFilterNameFromOptions", + value: function(I, k) { + var B = I; + return I === "removeColor" ? B = wm()(k.useAlpha) ? "removeWhite" : "colorFilter" : I === "blendColor" && (B = { + add: "blend", + multiply: "multiply", + tint: "tint" + }[k.mode]), B; + } + /** + * Add event for filter + * @param {Function} applyFilter - actions for firter + * @param {string} filterName - filter name + * @param {boolean} [isLast] - Is last change + */ + }, { + key: "_changeFilterState", + value: function(I, k) { + var B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, H = this.checkedMap[k].checked, Y = pv[k], W = this.checkedMap[k].closest(".tui-image-editor-checkbox-group"); + W && (H ? W.classList.remove("tui-image-editor-disabled") : W.classList.add("tui-image-editor-disabled")), I(H, Y, this._getFilterOption(k), !B); + } + /** + * Get filter option + * @param {String} type - filter type + * @returns {Object} filter option object + * @private + */ + // eslint-disable-next-line complexity + }, { + key: "_getFilterOption", + value: function(I) { + var k = {}; + switch (I) { + case "removeWhite": + k.color = "#FFFFFF", k.useAlpha = !1, k.distance = Ba()(this._els.removewhiteDistanceRange.value); + break; + case "colorFilter": + k.color = "#FFFFFF", k.distance = Ba()(this._els.colorfilterThresholdRange.value); + break; + case "pixelate": + k.blocksize = Lr(this._els.pixelateRange.value); + break; + case "noise": + k.noise = Lr(this._els.noiseRange.value); + break; + case "brightness": + k.brightness = Ba()(this._els.brightnessRange.value); + break; + case "blend": + k.mode = "add", k.color = this._els.filterBlendColor.color, k.mode = this._els.blendType.value; + break; + case "multiply": + k.mode = "multiply", k.color = this._els.filterMultiplyColor.color; + break; + case "tint": + k.mode = "tint", k.color = this._els.filterTintColor.color, k.alpha = this._els.tintOpacity.value; + break; + case "blur": + k.blur = this._els.blurRange.value; + break; + } + return k; + } + /** + * Make submenu range and colorpicker control + * @private + */ + }, { + key: "_makeControlElement", + value: function() { + this._els = { + removewhiteDistanceRange: new di({ + slider: this.selector(".tie-removewhite-distance-range") + }, Wr.removewhiteDistanceRange), + brightnessRange: new di({ + slider: this.selector(".tie-brightness-range") + }, Wr.brightnessRange), + noiseRange: new di({ + slider: this.selector(".tie-noise-range") + }, Wr.noiseRange), + pixelateRange: new di({ + slider: this.selector(".tie-pixelate-range") + }, Wr.pixelateRange), + colorfilterThresholdRange: new di({ + slider: this.selector(".tie-colorfilter-threshold-range") + }, Wr.colorfilterThresholdRange), + filterTintColor: new nn(this.selector(".tie-filter-tint-color"), { + defaultColor: "#03bd9e", + toggleDirection: this.toggleDirection, + usageStatistics: this.usageStatistics + }), + filterMultiplyColor: new nn(this.selector(".tie-filter-multiply-color"), { + defaultColor: "#515ce6", + toggleDirection: this.toggleDirection, + usageStatistics: this.usageStatistics + }), + filterBlendColor: new nn(this.selector(".tie-filter-blend-color"), { + defaultColor: "#ffbb3b", + toggleDirection: this.toggleDirection, + usageStatistics: this.usageStatistics + }), + blurRange: Wr.blurFilterRange + }, this._els.tintOpacity = this._pickerWithRange(this._els.filterTintColor.pickerControl), this._els.blendType = this._pickerWithSelectbox(this._els.filterBlendColor.pickerControl), this.colorPickerControls.push(this._els.filterTintColor), this.colorPickerControls.push(this._els.filterMultiplyColor), this.colorPickerControls.push(this._els.filterBlendColor), this.colorPickerInputBoxes = [], this.colorPickerInputBoxes.push(this._els.filterTintColor.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX)), this.colorPickerInputBoxes.push(this._els.filterMultiplyColor.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX)), this.colorPickerInputBoxes.push(this._els.filterBlendColor.colorpickerElement.querySelector(Br.COLOR_PICKER_INPUT_BOX)); + } + /** + * Make submenu control for picker & range mixin + * @param {HTMLElement} pickerControl - pickerControl dom element + * @returns {Range} + * @private + */ + }, { + key: "_pickerWithRange", + value: function(I) { + var k = document.createElement("div"), B = document.createElement("label"), H = document.createElement("div"); + return H.id = "tie-filter-tint-opacity", B.innerHTML = "Opacity", k.appendChild(B), k.appendChild(H), I.appendChild(k), I.style.height = Cm, new di({ + slider: H + }, Wr.tintOpacityRange); + } + /** + * Make submenu control for picker & selectbox + * @param {HTMLElement} pickerControl - pickerControl dom element + * @returns {HTMLElement} + * @private + */ + }, { + key: "_pickerWithSelectbox", + value: function(I) { + var k = document.createElement("div"), B = document.createElement("select"), H = document.createElement("ul"); + return k.className = "tui-image-editor-selectlist-wrap", H.className = "tui-image-editor-selectlist", k.appendChild(B), k.appendChild(H), this._makeSelectOptionList(B), I.appendChild(k), I.style.height = Cm, this._drawSelectOptionList(B, H), this._pickerWithSelectboxForAddEvent(B, H), B; + } + /** + * Make selectbox option list custom style + * @param {HTMLElement} selectlist - selectbox element + * @param {HTMLElement} optionlist - custom option list item element + * @private + */ + }, { + key: "_drawSelectOptionList", + value: function(I, k) { + var B = I.querySelectorAll("option"); + le()(B, function(H) { + var Y = document.createElement("li"); + Y.innerHTML = H.innerHTML, Y.setAttribute("data-item", H.value), k.appendChild(Y); + }); + } + /** + * custom selectbox custom event + * @param {HTMLElement} selectlist - selectbox element + * @param {HTMLElement} optionlist - custom option list item element + * @private + */ + }, { + key: "_pickerWithSelectboxForAddEvent", + value: function(I, k) { + var B = this; + k.addEventListener("click", function(H) { + var Y = H.target.getAttribute("data-item"), W = document.createEvent("HTMLEvents"); + I.querySelector('[value="'.concat(Y, '"]')).selected = !0, W.initEvent("change", !0, !0), I.dispatchEvent(W), B.selectBoxShow = !1, k.style.display = "none"; + }), I.addEventListener("mousedown", function(H) { + H.preventDefault(), B.selectBoxShow = !B.selectBoxShow, k.style.display = B.selectBoxShow ? "block" : "none", k.setAttribute("data-selectitem", I.value), k.querySelector("[data-item='".concat(I.value, "']")).classList.add("active"); + }); + } + /** + * Make option list for select control + * @param {HTMLElement} selectlist - blend option select list element + * @private + */ + }, { + key: "_makeSelectOptionList", + value: function(I) { + le()(Bx, function(k) { + var B = document.createElement("option"); + B.setAttribute("value", k), B.innerHTML = k.replace(/^[a-z]/, function(H) { + return H.toUpperCase(); + }), I.appendChild(B); + }); + } + }]), A; + }(vi), Am = Im, gf = a(4383), gv = /* @__PURE__ */ a.n(gf), mv = /* @__PURE__ */ function() { + function V(L, A) { + var D = A.name; + G(this, V), this.name = D, this.items = [], this.panelElement = this._makePanelElement(), this.listElement = this._makeListElement(), this.panelElement.appendChild(this.listElement), L.appendChild(this.panelElement); + } + return ee(V, [{ + key: "_makePanelElement", + value: function() { + var A = document.createElement("div"); + return A.className = "tie-panel-".concat(this.name), A; + } + /** + * Make list element + * @returns {HTMLElement} list element + * @private + */ + }, { + key: "_makeListElement", + value: function() { + var A = document.createElement("ol"); + return A.className = "".concat(this.name, "-list"), A; + } + /** + * Make list item element + * @param {string} html - history list item html + * @returns {HTMLElement} list item element + */ + }, { + key: "makeListItemElement", + value: function(A) { + var D = document.createElement("li"); + return D.innerHTML = A, D.className = "".concat(this.name, "-item"), D.setAttribute("data-index", this.items.length), D; + } + /** + * Push list item element + * @param {HTMLElement} item - list item element to add to the list + */ + }, { + key: "pushListItemElement", + value: function(A) { + this.listElement.appendChild(A), this.listElement.scrollTop += A.offsetHeight, this.items.push(A); + } + /** + * Delete list item element + * @param {number} start - start index to delete + * @param {number} end - end index to delete + */ + }, { + key: "deleteListItemElement", + value: function(A, D) { + for (var I = this.items, k = A; k < D; k += 1) + this.listElement.removeChild(I[k]); + f()(I).call(I, A, D - A + 1); + } + /** + * Get list's length + * @returns {number} + */ + }, { + key: "getListLength", + value: function() { + return this.items.length; + } + /** + * Add class name of item + * @param {number} index - index of item + * @param {string} className - class name to add + */ + }, { + key: "addClass", + value: function(A, D) { + this.items[A] && this.items[A].classList.add(D); + } + /** + * Remove class name of item + * @param {number} index - index of item + * @param {string} className - class name to remove + */ + }, { + key: "removeClass", + value: function(A, D) { + this.items[A] && this.items[A].classList.remove(D); + } + /** + * Toggle class name of item + * @param {number} index - index of item + * @param {string} className - class name to remove + */ + }, { + key: "toggleClass", + value: function(A, D) { + this.items[A] && this.items[A].classList.toggle(D); + } + }]), V; + }(), cr = mv, yv = function(V) { + var L, A, D, I = V.locale, k = V.makeSvgIcon, B = V.name, H = V.detail; + return K()(L = K()(A = K()(D = ` +
        +
        + `.concat(k(["normal", "active"], "history-".concat(B.toLowerCase()), !0), ` +
        + + `)).call(D, I.localize(B), ` + `)).call(A, H ? "(".concat(I.localize(H), ")") : "", ` + +
        + `)).call(L, k(["normal"], "history-check", !0), ` +
        +
        +`); + }; + function _v(V) { + var L = Em(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Em() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Mm = "history-item", Oo = "selected-item", Ci = "disabled-item", jx = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = _v(A); + function A(D, I) { + var k, B = I.locale, H = I.makeSvgIcon; + return G(this, A), k = L.call(this, D, { + name: "history" + }), D.classList.add("enabled"), k.locale = B, k.makeSvgIcon = H, k._eventHandler = {}, k._historyIndex = k.getListLength(), k; + } + return ee(A, [{ + key: "add", + value: function(I) { + var k = I.name, B = I.detail; + this._hasDisabledItem() && this.deleteListItemElement(this._historyIndex + 1, this.getListLength()); + var H = yv({ + locale: this.locale, + makeSvgIcon: this.makeSvgIcon, + name: k, + detail: B + }), Y = this.makeListItemElement(H); + this.pushListItemElement(Y), this._historyIndex = this.getListLength() - 1, this._selectItem(this._historyIndex); + } + /** + * Init history + */ + }, { + key: "init", + value: function() { + this.deleteListItemElement(1, this.getListLength()), this._historyIndex = 0, this._selectItem(this._historyIndex); + } + /** + * Clear history + */ + }, { + key: "clear", + value: function() { + this.deleteListItemElement(0, this.getListLength()), this._historyIndex = -1; + } + /** + * Select previous history of current selected history + */ + }, { + key: "prev", + value: function() { + this._historyIndex -= 1, this._selectItem(this._historyIndex); + } + /** + * Select next history of current selected history + */ + }, { + key: "next", + value: function() { + this._historyIndex += 1, this._selectItem(this._historyIndex); + } + /** + * Whether history menu has disabled item + * @returns {boolean} + */ + }, { + key: "_hasDisabledItem", + value: function() { + return this.getListLength() - 1 > this._historyIndex; + } + /** + * Add history menu event + * @private + */ + }, { + key: "_addHistoryEventListener", + value: function() { + var I = this; + this._eventHandler.history = function(k) { + return I._clickHistoryItem(k); + }, this.listElement.addEventListener("click", this._eventHandler.history); + } + /** + * Remove history menu event + * @private + */ + }, { + key: "_removeHistoryEventListener", + value: function() { + this.listElement.removeEventListener("click", this._eventHandler.history); + } + /** + * onClick history menu event listener + * @param {object} event - event object + * @private + */ + }, { + key: "_clickHistoryItem", + value: function(I) { + var k = I.target, B = k.closest(".".concat(Mm)); + if (B) { + var H = gv()(B.getAttribute("data-index"), 10); + if (H !== this._historyIndex) { + var Y = Math.abs(H - this._historyIndex); + H < this._historyIndex ? this._actions.undo(Y) : this._actions.redo(Y); + } + } + } + /** + * Change item's state to selected state + * @param {number} index - index of selected item + */ + }, { + key: "_selectItem", + value: function(I) { + for (var k = 0; k < this.getListLength(); k += 1) + this.removeClass(k, Oo), this.removeClass(k, Ci), k > I && this.addClass(k, Ci); + this.addClass(I, Oo); + } + /** + * Destroys the instance. + */ + }, { + key: "destroy", + value: function() { + this.removeEvent(), Wn(this); + } + /** + * Add event for history + * @param {Object} actions - actions for crop + * @param {Function} actions.undo - undo action + * @param {Function} actions.redo - redo action + */ + }, { + key: "addEvent", + value: function(I) { + this._actions = I, this._addHistoryEventListener(); + } + /** + * Remove event + * @private + */ + }, { + key: "removeEvent", + value: function() { + this._removeHistoryEventListener(); + } + }]), A; + }(cr), Mc = jx, bv = /* @__PURE__ */ function() { + function V(L) { + G(this, V), this._locale = L; + } + return ee(V, [{ + key: "localize", + value: function(A) { + return this._locale[A] || A; + } + }]), V; + }(), mf = bv, Fx = { + Shape: fs, + Crop: _u, + Resize: Fr, + Flip: kl, + Rotate: J, + Text: Et, + Mask: na, + Icon: vs, + Draw: Lx, + Filter: Am + }, Dm = "1300", ps = "history", Ol = "tie-panel-history", Ga = "on", xu = { + ZOOM_IN: "zoomIn", + HAND: "hand" + }, yf = /* @__PURE__ */ function() { + function V(L, A, D) { + G(this, V), this.options = this._initializeOption(A), this._actions = D, this.submenu = !1, this.imageSize = {}, this.uiSize = {}, this._locale = new mf(this.options.locale), this.theme = new Ln(this.options.theme), this.eventHandler = {}, this._submenuChangeTransection = !1, this._selectedElement = null, this._mainElement = null, this._editorElementWrap = null, this._editorElement = null, this._menuBarElement = null, this._subMenuElement = null, this._makeUiElement(L), this._setUiSize(), this._initMenuEvent = !1, this._makeSubMenu(), this._attachHistoryEvent(), this._attachZoomEvent(); + } + return ee(V, [{ + key: "destroy", + value: function() { + this._removeUiEvent(), this._destroyAllMenu(), this._selectedElement.innerHTML = "", Wn(this); + } + /** + * Set Default Selection for includeUI + * @param {Object} option - imageEditor options + * @returns {Object} - extends selectionStyle option + * @ignore + */ + }, { + key: "setUiDefaultSelectionStyle", + value: function(A) { + return te()({ + applyCropSelectionStyle: !0, + applyGroupSelectionStyle: !0, + selectionStyle: { + cornerStyle: "circle", + cornerSize: 16, + cornerColor: "#fff", + cornerStrokeColor: "#fff", + transparentCorners: !1, + lineWidth: 2, + borderColor: "#fff" + } + }, A); + } + /** + * Change editor size + * @param {Object} resizeInfo - ui & image size info + * @param {Object} [resizeInfo.uiSize] - image size dimension + * @param {string} resizeInfo.uiSize.width - ui width + * @param {string} resizeInfo.uiSize.height - ui height + * @param {Object} [resizeInfo.imageSize] - image size dimension + * @param {Number} resizeInfo.imageSize.oldWidth - old width + * @param {Number} resizeInfo.imageSize.oldHeight - old height + * @param {Number} resizeInfo.imageSize.newWidth - new width + * @param {Number} resizeInfo.imageSize.newHeight - new height + * @example + * // Change the image size and ui size, and change the affected ui state together. + * imageEditor.ui.resizeEditor({ + * imageSize: {oldWidth: 100, oldHeight: 100, newWidth: 700, newHeight: 700}, + * uiSize: {width: 1000, height: 1000} + * }); + * @example + * // Apply the ui state while preserving the previous attribute (for example, if responsive Ui) + * imageEditor.ui.resizeEditor(); + */ + }, { + key: "resizeEditor", + value: function() { + var A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, D = A.uiSize, I = A.imageSize, k = I === void 0 ? this.imageSize : I; + k !== this.imageSize && (this.imageSize = k), D && this._setUiSize(D); + var B = this._getCanvasMaxDimension(), H = B.width, Y = B.height, W = this._editorElement.style, q = this.options.menuBarPosition; + W.height = "".concat(Y, "px"), W.width = "".concat(H, "px"), this._setEditorPosition(q), this._editorElementWrap.style.bottom = "0px", this._editorElementWrap.style.top = "0px", this._editorElementWrap.style.left = "0px", this._editorElementWrap.style.width = "100%"; + var ie = this._selectedElement.classList; + q === "top" && this._selectedElement.offsetWidth < Dm ? ie.add("tui-image-editor-top-optimization") : ie.remove("tui-image-editor-top-optimization"); + } + /** + * Toggle zoom button status + * @param {string} type - type of zoom button + */ + }, { + key: "toggleZoomButtonStatus", + value: function(A) { + var D = this._buttonElements[A].classList; + D.toggle(Ga), A === xu.ZOOM_IN ? this._buttonElements[xu.HAND].classList.remove(Ga) : this._buttonElements[xu.ZOOM_IN].classList.remove(Ga); + } + /** + * Turn off zoom-in button status + */ + }, { + key: "offZoomInButtonStatus", + value: function() { + var A = this._buttonElements[xu.ZOOM_IN].classList; + A.remove(Ga); + } + /** + * Change hand button status + * @param {boolean} enabled - status to change + */ + }, { + key: "changeHandButtonStatus", + value: function(A) { + var D = this._buttonElements[xu.HAND].classList; + D[A ? "add" : "remove"](Ga); + } + /** + * Change help button status + * @param {string} buttonType - target button type + * @param {Boolean} enableStatus - enabled status + * @ignore + */ + }, { + key: "changeHelpButtonEnabled", + value: function(A, D) { + var I = this._buttonElements[A].classList; + I[D ? "add" : "remove"]("enabled"); + } + /** + * Change delete button status + * @param {Object} [options] - Ui setting options + * @param {object} [options.loadImage] - Init default load image + * @param {string} [options.initMenu] - Init start menu + * @param {string} [options.menuBarPosition=bottom] - Let + * @param {boolean} [options.applyCropSelectionStyle=false] - Let + * @param {boolean} [options.usageStatistics=false] - Send statistics ping or not + * @returns {Object} initialize option + * @private + */ + }, { + key: "_initializeOption", + value: function(A) { + return te()({ + loadImage: { + path: "", + name: "" + }, + locale: {}, + menuIconPath: "", + menu: ["resize", "crop", "flip", "rotate", "draw", "shape", "icon", "text", "mask", "filter"], + initMenu: "", + uiSize: { + width: "100%", + height: "100%" + }, + menuBarPosition: "bottom" + }, A); + } + /** + * Set ui container size + * @param {Object} uiSize - ui dimension + * @param {string} uiSize.width - css width property + * @param {string} uiSize.height - css height property + * @private + */ + }, { + key: "_setUiSize", + value: function() { + var A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.uiSize, D = this._selectedElement.style; + D.width = A.width, D.height = A.height; + } + /** + * Make submenu dom element + * @private + */ + }, { + key: "_makeSubMenu", + value: function() { + var A = this; + le()(this.options.menu, function(D) { + var I, k = Fx[D.replace(/^[a-z]/, function(B) { + return B.toUpperCase(); + })]; + A._makeMenuElement(D), A._buttonElements[D] = A._menuBarElement.querySelector(".tie-btn-".concat(D)), A[D] = new k(A._subMenuElement, { + locale: A._locale, + makeSvgIcon: ne()(I = A.theme.makeMenSvgIconSet).call(I, A.theme), + menuBarPosition: A.options.menuBarPosition, + usageStatistics: A.options.usageStatistics + }); + }); + } + /** + * Attach history event + * @private + */ + }, { + key: "_attachHistoryEvent", + value: function() { + var A, D, I; + this.on(Re.EXECUTE_COMMAND, ne()(A = this._addHistory).call(A, this)), this.on(Re.AFTER_UNDO, ne()(D = this._selectPrevHistory).call(D, this)), this.on(Re.AFTER_REDO, ne()(I = this._selectNextHistory).call(I, this)); + } + /** + * Attach zoom event + * @private + */ + }, { + key: "_attachZoomEvent", + value: function() { + var A = this; + this.on(Re.HAND_STARTED, function() { + A.offZoomInButtonStatus(), A.changeHandButtonStatus(!0); + }), this.on(Re.HAND_STOPPED, function() { + return A.changeHandButtonStatus(!1); + }); + } + /** + * Make primary ui dom element + * @param {string|HTMLElement} element - Wrapper's element or selector + * @private + */ + }, { + key: "_makeUiElement", + value: function(A) { + var D, I; + A.nodeType ? I = A : I = document.querySelector(A); + var k = yn(I); + I.classList.add("tui-image-editor-container"), I.innerHTML = Ao({ + locale: this._locale, + biImage: this.theme.getStyle("common.bi"), + loadButtonStyle: this.theme.getStyle("loadButton"), + downloadButtonStyle: this.theme.getStyle("downloadButton"), + menuBarPosition: this.options.menuBarPosition + }) + lo({ + locale: this._locale, + biImage: this.theme.getStyle("common.bi"), + commonStyle: this.theme.getStyle("common"), + headerStyle: this.theme.getStyle("header"), + loadButtonStyle: this.theme.getStyle("loadButton"), + downloadButtonStyle: this.theme.getStyle("downloadButton"), + submenuStyle: this.theme.getStyle("submenu") + }), this._selectedElement = I, this._selectedElement.classList.add(this.options.menuBarPosition), this._mainElement = k(".tui-image-editor-main"), this._editorElementWrap = k(".tui-image-editor-wrap"), this._editorElement = k(".tui-image-editor"), this._helpMenuBarElement = k(".tui-image-editor-help-menu"), this._menuBarElement = k(".tui-image-editor-menu"), this._subMenuElement = k(".tui-image-editor-submenu"), this._buttonElements = { + download: this._selectedElement.querySelectorAll(".tui-image-editor-download-btn"), + load: this._selectedElement.querySelectorAll(".tui-image-editor-load-btn") + }, this._addHelpMenus(), this._historyMenu = new Mc(this._buttonElements[ps], { + locale: this._locale, + makeSvgIcon: ne()(D = this.theme.makeMenSvgIconSet).call(D, this.theme) + }), this._activateZoomMenus(); + } + /** + * Activate help menus for zoom. + * @private + */ + }, { + key: "_activateZoomMenus", + value: function() { + var A = this; + le()(Tr, function(D) { + A.changeHelpButtonEnabled(D, !0); + }); + } + /** + * make array for help menu output, including partitions. + * @returns {Array} + * @private + */ + }, { + key: "_makeHelpMenuWithPartition", + value: function() { + var A; + return K()(A = []).call(A, F(Tr), [""], F(tn), [""], F(rn)); + } + /** + * Add help menu + * @private + */ + }, { + key: "_addHelpMenus", + value: function() { + var A = this, D = this._makeHelpMenuWithPartition(); + le()(D, function(I) { + I ? (A._makeMenuElement(I, ["normal", "disabled", "hover"], "help"), A._buttonElements[I] = A._helpMenuBarElement.querySelector(".tie-btn-".concat(I))) : A._makeMenuPartitionElement(); + }); + } + /** + * Make menu partition element + * @private + */ + }, { + key: "_makeMenuPartitionElement", + value: function() { + var A = document.createElement("li"), D = document.createElement("div"); + A.className = ci("item"), D.className = ci("icpartition"), A.appendChild(D), this._helpMenuBarElement.appendChild(A); + } + /** + * Make menu button element + * @param {string} menuName - menu name + * @param {Array} useIconTypes - Possible values are \['normal', 'active', 'hover', 'disabled'\] + * @param {string} menuType - 'normal' or 'help' + * @private + */ + }, { + key: "_makeMenuElement", + value: function(A) { + var D, I, k = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["normal", "active", "hover"], B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "normal", H = document.createElement("li"), Y = this.theme.makeMenSvgIconSet(k, A); + this._addTooltipAttribute(H, A), H.className = K()(D = K()(I = "tie-btn-".concat(A, " ")).call(I, ci("item"), " ")).call(D, B), H.innerHTML = Y, B === "normal" ? this._menuBarElement.appendChild(H) : this._helpMenuBarElement.appendChild(H); + } + /** + * Add help action event + * @private + */ + }, { + key: "_addHelpActionEvent", + value: function() { + var A = this; + le()(qe, function(D) { + A.eventHandler[D] = function(I) { + return A._actions.main[D](I); + }, A._buttonElements[D].addEventListener("click", A.eventHandler[D]); + }); + } + /** + * Remove help action event + * @private + */ + }, { + key: "_removeHelpActionEvent", + value: function() { + var A = this; + le()(qe, function(D) { + A._buttonElements[D].removeEventListener("click", A.eventHandler[D]); + }); + } + /** + * Add history + * @param {Command|string} command - command or command name + */ + }, { + key: "_addHistory", + value: function(A) { + if (!qi(A)) { + var D = typeof A == "string" ? { + name: A + } : Gr(A); + this._historyMenu.add(D); + } + } + /** + * Init history + */ + }, { + key: "initHistory", + value: function() { + this._historyMenu.init(); + } + /** + * Clear history + */ + }, { + key: "clearHistory", + value: function() { + this._historyMenu.clear(); + } + /** + * Select prev history + */ + }, { + key: "_selectPrevHistory", + value: function() { + this._historyMenu.prev(); + } + /** + * Select next history + */ + }, { + key: "_selectNextHistory", + value: function() { + this._historyMenu.next(); + } + /** + * Toggle history menu + * @param {object} event - event object + */ + }, { + key: "toggleHistoryMenu", + value: function(A) { + var D = A.target, I = D.closest(".".concat(Ol)); + if (!I) { + var k = this._buttonElements[ps].classList; + k.toggle("opened"); + } + } + /** + * Add attribute for menu tooltip + * @param {HTMLElement} element - menu element + * @param {string} tooltipName - tooltipName + * @private + */ + }, { + key: "_addTooltipAttribute", + value: function(A, D) { + A.setAttribute("tooltip-content", this._locale.localize(D.replace(/^[a-z]/g, function(I) { + return I.toUpperCase(); + }))); + } + /** + * Add download event + * @private + */ + }, { + key: "_addDownloadEvent", + value: function() { + var A = this; + this.eventHandler.download = function() { + return A._actions.main.download(); + }, le()(this._buttonElements.download, function(D) { + D.addEventListener("click", A.eventHandler.download); + }); + } + }, { + key: "_removeDownloadEvent", + value: function() { + var A = this; + le()(this._buttonElements.download, function(D) { + D.removeEventListener("click", A.eventHandler.download); + }); + } + /** + * Add load event + * @private + */ + }, { + key: "_addLoadEvent", + value: function() { + var A = this; + this.eventHandler.loadImage = function(D) { + return A._actions.main.load(D.target.files[0]); + }, le()(this._buttonElements.load, function(D) { + D.addEventListener("change", A.eventHandler.loadImage); + }); + } + /** + * Remove load event + * @private + */ + }, { + key: "_removeLoadEvent", + value: function() { + var A = this; + le()(this._buttonElements.load, function(D) { + D.removeEventListener("change", A.eventHandler.loadImage); + }); + } + /** + * Add menu event + * @param {string} menuName - menu name + * @private + */ + }, { + key: "_addMainMenuEvent", + value: function(A) { + var D = this; + this.eventHandler[A] = function() { + return D.changeMenu(A); + }, this._buttonElements[A].addEventListener("click", this.eventHandler[A]); + } + /** + * Add menu event + * @param {string} menuName - menu name + * @private + */ + }, { + key: "_addSubMenuEvent", + value: function(A) { + var D = this; + this[A].addEvent(this._actions[A]), this[A].on(Re.INPUT_BOX_EDITING_STARTED, function() { + return D.fire(Re.INPUT_BOX_EDITING_STARTED); + }), this[A].on(Re.INPUT_BOX_EDITING_STOPPED, function() { + return D.fire(Re.INPUT_BOX_EDITING_STOPPED); + }); + } + /** + * Add menu event + * @private + */ + }, { + key: "_addMenuEvent", + value: function() { + var A = this; + le()(this.options.menu, function(D) { + A._addMainMenuEvent(D), A._addSubMenuEvent(D); + }); + } + /** + * Remove menu event + * @private + */ + }, { + key: "_removeMainMenuEvent", + value: function() { + var A = this; + le()(this.options.menu, function(D) { + A._buttonElements[D].removeEventListener("click", A.eventHandler[D]), A[D].off(Re.INPUT_BOX_EDITING_STARTED), A[D].off(Re.INPUT_BOX_EDITING_STOPPED); + }); + } + /** + * Get editor area element + * @returns {HTMLElement} editor area html element + * @ignore + */ + }, { + key: "getEditorArea", + value: function() { + return this._editorElement; + } + /** + * Add event for menu items + * @ignore + */ + }, { + key: "activeMenuEvent", + value: function() { + this._initMenuEvent || (this._addHelpActionEvent(), this._addDownloadEvent(), this._addMenuEvent(), this._initMenu(), this._historyMenu.addEvent(this._actions.history), this._initMenuEvent = !0); + } + /** + * Remove ui event + * @private + */ + }, { + key: "_removeUiEvent", + value: function() { + this._removeHelpActionEvent(), this._removeDownloadEvent(), this._removeLoadEvent(), this._removeMainMenuEvent(), this._historyMenu.removeEvent(); + } + /** + * Destroy all menu instance + * @private + */ + }, { + key: "_destroyAllMenu", + value: function() { + var A = this; + le()(this.options.menu, function(D) { + A[D].destroy(); + }), this._historyMenu.destroy(); + } + /** + * Init canvas + * @ignore + */ + }, { + key: "initCanvas", + value: function() { + var A = this, D = this._getLoadImage(); + D.path && this._actions.main.initLoadImage(D.path, D.name).then(function() { + A.activeMenuEvent(); + }), this._addLoadEvent(); + var I = document.createElement("div"); + I.className = ci("grid-visual"); + var k = ` + + + +
        `; + I.innerHTML = k, this._editorContainerElement = this._editorElement.querySelector(".tui-image-editor-canvas-container"), this._editorContainerElement.appendChild(I); + } + /** + * get editor area element + * @returns {Object} load image option + * @private + */ + }, { + key: "_getLoadImage", + value: function() { + return this.options.loadImage; + } + /** + * change menu + * @param {string} menuName - menu name + * @param {boolean} toggle - whether toogle or not + * @param {boolean} discardSelection - discard selection + * @ignore + */ + }, { + key: "changeMenu", + value: function(A) { + var D = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, I = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0; + this._submenuChangeTransection || (this._submenuChangeTransection = !0, this._changeMenu(A, D, I), this._submenuChangeTransection = !1); + } + /** + * change menu + * @param {string} menuName - menu name + * @param {boolean} toggle - whether toggle or not + * @param {boolean} discardSelection - discard selection + * @private + */ + }, { + key: "_changeMenu", + value: function(A, D, I) { + this.submenu && (this._buttonElements[this.submenu].classList.remove("active"), this._mainElement.classList.remove("tui-image-editor-menu-".concat(this.submenu)), I && this._actions.main.discardSelection(), this._actions.main.changeSelectableAll(!0), this[this.submenu].changeStandbyMode()), this.submenu === A && D ? this.submenu = null : (this._buttonElements[A].classList.add("active"), this._mainElement.classList.add("tui-image-editor-menu-".concat(A)), this.submenu = A, this[this.submenu].changeStartMode()), this.resizeEditor(); + } + /** + * Init menu + * @private + */ + }, { + key: "_initMenu", + value: function() { + if (this.options.initMenu) { + var A = document.createEvent("MouseEvents"); + A.initEvent("click", !0, !1), this._buttonElements[this.options.initMenu].dispatchEvent(A); + } + this.icon && this.icon.registerDefaultIcon(); + } + /** + * Get canvas max Dimension + * @returns {Object} - width & height of editor + * @private + */ + }, { + key: "_getCanvasMaxDimension", + value: function() { + var A = this._editorContainerElement.style, D = A.maxWidth, I = A.maxHeight, k = Ba()(D), B = Ba()(I); + return { + width: k, + height: B + }; + } + /** + * Set editor position + * @param {string} menuBarPosition - top or right or bottom or left + * @private + */ + // eslint-disable-next-line complexity + }, { + key: "_setEditorPosition", + value: function(A) { + var D = this._getCanvasMaxDimension(), I = D.width, k = D.height, B = this._editorElement.style, H = 0, Y = 0; + this.submenu && (A === "bottom" ? k > this._editorElementWrap.scrollHeight - 150 ? H = (k - this._editorElementWrap.scrollHeight) / 2 : H = 150 / 2 * -1 : A === "top" ? k > this._editorElementWrap.offsetHeight - 150 ? H = 150 / 2 - (k - (this._editorElementWrap.offsetHeight - 150)) / 2 : H = 150 / 2 : A === "left" ? I > this._editorElementWrap.offsetWidth - 248 ? Y = 248 / 2 - (I - (this._editorElementWrap.offsetWidth - 248)) / 2 : Y = 248 / 2 : A === "right" && (I > this._editorElementWrap.scrollWidth - 248 ? Y = (I - this._editorElementWrap.scrollWidth) / 2 : Y = 248 / 2 * -1)), B.top = "".concat(H, "px"), B.left = "".concat(Y, "px"); + } + }]), V; + }(); + Ae().mixin(yf); + var xv = yf, $x = a(381), Ll = /* @__PURE__ */ a.n($x), Pn = /* @__PURE__ */ function() { + function V() { + G(this, V), this.versionnumber = "1.2.4", this.optionpresets = { + default: { + corsenabled: !1, + ltres: 1, + qtres: 1, + pathomit: 8, + rightangleenhance: !0, + colorsampling: 2, + numberofcolors: 16, + mincolorratio: 0, + colorquantcycles: 3, + layering: 0, + strokewidth: 1, + linefilter: !1, + scale: 1, + roundcoords: 1, + viewbox: !1, + desc: !1, + lcpr: 0, + qcpr: 0, + blurradius: 0, + blurdelta: 20 + }, + posterized1: { + colorsampling: 0, + numberofcolors: 2 + }, + posterized2: { + numberofcolors: 4, + blurradius: 5 + }, + curvy: { + ltres: 0.01, + linefilter: !0, + rightangleenhance: !1 + }, + sharp: { + qtres: 0.01, + linefilter: !1 + }, + detailed: { + pathomit: 0, + roundcoords: 2, + ltres: 0.5, + qtres: 0.5, + numberofcolors: 64 + }, + smoothed: { + blurradius: 5, + blurdelta: 64 + }, + grayscale: { + colorsampling: 0, + colorquantcycles: 1, + numberofcolors: 7 + }, + fixedpalette: { + colorsampling: 0, + colorquantcycles: 1, + numberofcolors: 27 + }, + randomsampling1: { + colorsampling: 1, + numberofcolors: 8 + }, + randomsampling2: { + colorsampling: 1, + numberofcolors: 64 + }, + artistic1: { + colorsampling: 0, + colorquantcycles: 1, + pathomit: 0, + blurradius: 5, + blurdelta: 64, + ltres: 0.01, + linefilter: !0, + numberofcolors: 16, + strokewidth: 2 + }, + artistic2: { + qtres: 0.01, + colorsampling: 0, + colorquantcycles: 1, + numberofcolors: 4, + strokewidth: 0 + }, + artistic3: { + qtres: 10, + ltres: 10, + numberofcolors: 8 + }, + artistic4: { + qtres: 10, + ltres: 10, + numberofcolors: 64, + blurradius: 5, + blurdelta: 256, + strokewidth: 2 + }, + posterized3: { + ltres: 1, + qtres: 1, + pathomit: 20, + rightangleenhance: !0, + colorsampling: 0, + numberofcolors: 3, + mincolorratio: 0, + colorquantcycles: 3, + blurradius: 3, + blurdelta: 20, + strokewidth: 0, + linefilter: !1, + roundcoords: 1, + pal: [{ + r: 0, + g: 0, + b: 100, + a: 255 + }, { + r: 255, + g: 255, + b: 255, + a: 255 + }] + } + }, this.pathscan_combined_lookup = [[[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, -1, -1]], [[0, 1, 0, -1], [-1, -1, -1, -1], [-1, -1, -1, -1], [0, 2, -1, 0]], [[-1, -1, -1, -1], [-1, -1, -1, -1], [0, 1, 0, -1], [0, 0, 1, 0]], [[0, 0, 1, 0], [-1, -1, -1, -1], [0, 2, -1, 0], [-1, -1, -1, -1]], [[-1, -1, -1, -1], [0, 0, 1, 0], [0, 3, 0, 1], [-1, -1, -1, -1]], [[13, 3, 0, 1], [13, 2, -1, 0], [7, 1, 0, -1], [7, 0, 1, 0]], [[-1, -1, -1, -1], [0, 1, 0, -1], [-1, -1, -1, -1], [0, 3, 0, 1]], [[0, 3, 0, 1], [0, 2, -1, 0], [-1, -1, -1, -1], [-1, -1, -1, -1]], [[0, 3, 0, 1], [0, 2, -1, 0], [-1, -1, -1, -1], [-1, -1, -1, -1]], [[-1, -1, -1, -1], [0, 1, 0, -1], [-1, -1, -1, -1], [0, 3, 0, 1]], [[11, 1, 0, -1], [14, 0, 1, 0], [14, 3, 0, 1], [11, 2, -1, 0]], [[-1, -1, -1, -1], [0, 0, 1, 0], [0, 3, 0, 1], [-1, -1, -1, -1]], [[0, 0, 1, 0], [-1, -1, -1, -1], [0, 2, -1, 0], [-1, -1, -1, -1]], [[-1, -1, -1, -1], [-1, -1, -1, -1], [0, 1, 0, -1], [0, 0, 1, 0]], [[0, 1, 0, -1], [-1, -1, -1, -1], [-1, -1, -1, -1], [0, 2, -1, 0]], [[-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, -1, -1], [-1, -1, -1, -1]]], this.gks = [[0.27901, 0.44198, 0.27901], [0.135336, 0.228569, 0.272192, 0.228569, 0.135336], [0.086776, 0.136394, 0.178908, 0.195843, 0.178908, 0.136394, 0.086776], [0.063327, 0.093095, 0.122589, 0.144599, 0.152781, 0.144599, 0.122589, 0.093095, 0.063327], [0.049692, 0.069304, 0.089767, 0.107988, 0.120651, 0.125194, 0.120651, 0.107988, 0.089767, 0.069304, 0.049692]], this.specpalette = [{ + r: 0, + g: 0, + b: 0, + a: 255 + }, { + r: 128, + g: 128, + b: 128, + a: 255 + }, { + r: 0, + g: 0, + b: 128, + a: 255 + }, { + r: 64, + g: 64, + b: 128, + a: 255 + }, { + r: 192, + g: 192, + b: 192, + a: 255 + }, { + r: 255, + g: 255, + b: 255, + a: 255 + }, { + r: 128, + g: 128, + b: 192, + a: 255 + }, { + r: 0, + g: 0, + b: 192, + a: 255 + }, { + r: 128, + g: 0, + b: 0, + a: 255 + }, { + r: 128, + g: 64, + b: 64, + a: 255 + }, { + r: 128, + g: 0, + b: 128, + a: 255 + }, { + r: 168, + g: 168, + b: 168, + a: 255 + }, { + r: 192, + g: 128, + b: 128, + a: 255 + }, { + r: 192, + g: 0, + b: 0, + a: 255 + }, { + r: 255, + g: 255, + b: 255, + a: 255 + }, { + r: 0, + g: 128, + b: 0, + a: 255 + }]; + } + return ee(V, [{ + key: "imageToSVG", + value: function(A, D, I) { + var k = this; + I = this.checkoptions(I), this.loadImage(A, function(B) { + D(k.imagedataToSVG(k.getImgdata(B), I)); + }, I); + } + }, { + key: "imagedataToSVG", + value: function(A, D) { + D = this.checkoptions(D); + var I = this.imagedataToTracedata(A, D); + return this.getsvgstring(I, D); + } + }, { + key: "imageToTracedata", + value: function(A, D, I) { + var k = this; + I = this.checkoptions(I), this.loadImage(A, function(B) { + D(k.imagedataToTracedata(k.getImgdata(B), I)); + }, I); + } + }, { + key: "imagedataToTracedata", + value: function(A, D) { + D = this.checkoptions(D); + var I = this.colorquantization(A, D), k; + if (D.layering === 0) { + k = { + layers: [], + palette: I.palette, + width: I.array[0].length - 2, + height: I.array.length - 2 + }; + for (var B = 0; B < I.palette.length; B += 1) { + var H = this.batchtracepaths(this.internodes(this.pathscan(this.layeringstep(I, B), D.pathomit), D), D.ltres, D.qtres); + k.layers.push(H); + } + } else { + var Y = this.layering(I); + D.layercontainerid && this.drawLayers(Y, this.specpalette, D.scale, D.layercontainerid); + var W = this.batchpathscan(Y, D.pathomit), q = this.batchinternodes(W, D); + k = { + layers: this.batchtracelayers(q, D.ltres, D.qtres), + palette: I.palette, + width: A.width, + height: A.height + }; + } + return k; + } + }, { + key: "checkoptions", + value: function(A) { + A = A || {}, typeof A == "string" && (A = A.toLowerCase(), this.optionpresets[A] ? A = this.optionpresets[A] : A = {}); + for (var D = je()(this.optionpresets.default), I = 0; I < D.length; I += 1) + A.hasOwnProperty(D[I]) || (A[D[I]] = this.optionpresets.default[D[I]]); + return A; + } + }, { + key: "colorquantization", + value: function(A, D) { + var I = [], k = 0, B, H, Y, W = [], q = A.width * A.height, ie, Se, Ce, De, Ee; + for (Se = 0; Se < A.height + 2; Se += 1) + for (I[Se] = [], ie = 0; ie < A.width + 2; ie += 1) + I[Se][ie] = -1; + for (D.pal ? Ee = D.pal : D.colorsampling === 0 ? Ee = this.generatepalette(D.numberofcolors) : D.colorsampling === 1 ? Ee = this.samplepalette(D.numberofcolors, A) : Ee = this.samplepalette2(D.numberofcolors, A), D.blurradius > 0 && (A = this.blur(A, D.blurradius, D.blurdelta)), De = 0; De < D.colorquantcycles; De += 1) { + if (De > 0) + for (Ce = 0; Ce < Ee.length; Ce += 1) + W[Ce].n > 0 && (Ee[Ce] = { + r: Math.floor(W[Ce].r / W[Ce].n), + g: Math.floor(W[Ce].g / W[Ce].n), + b: Math.floor(W[Ce].b / W[Ce].n), + a: Math.floor(W[Ce].a / W[Ce].n) + }), W[Ce].n / q < D.mincolorratio && De < D.colorquantcycles - 1 && (Ee[Ce] = { + r: Math.floor(Math.random() * 255), + g: Math.floor(Math.random() * 255), + b: Math.floor(Math.random() * 255), + a: Math.floor(Math.random() * 255) + }); + for (ie = 0; ie < Ee.length; ie += 1) + W[ie] = { + r: 0, + g: 0, + b: 0, + a: 0, + n: 0 + }; + for (Se = 0; Se < A.height; Se += 1) + for (ie = 0; ie < A.width; ie += 1) { + for (k = (Se * A.width + ie) * 4, Y = 0, H = 1024, Ce = 0; Ce < Ee.length; Ce += 1) + B = Math.abs(Ee[Ce].r - A.data[k]) + Math.abs(Ee[Ce].g - A.data[k + 1]) + Math.abs(Ee[Ce].b - A.data[k + 2]) + Math.abs(Ee[Ce].a - A.data[k + 3]), B < H && (H = B, Y = Ce); + W[Y].r += A.data[k], W[Y].g += A.data[k + 1], W[Y].b += A.data[k + 2], W[Y].a += A.data[k + 3], W[Y].n += 1, I[Se + 1][ie + 1] = Y; + } + } + return { + array: I, + palette: Ee + }; + } + }, { + key: "samplepalette", + value: function(A, D) { + for (var I, k = [], B = 0; B < A; B += 1) + I = Math.floor(Math.random() * D.data.length / 4) * 4, k.push({ + r: D.data[I], + g: D.data[I + 1], + b: D.data[I + 2], + a: D.data[I + 3] + }); + return k; + } + }, { + key: "samplepalette2", + value: function(A, D) { + for (var I, k = [], B = Math.ceil(Math.sqrt(A)), H = Math.ceil(A / B), Y = D.width / (B + 1), W = D.height / (H + 1), q = 0; q < H; q += 1) + for (var ie = 0; ie < B && k.length !== A; ie += 1) + I = Math.floor((q + 1) * W * D.width + (ie + 1) * Y) * 4, k.push({ + r: D.data[I], + g: D.data[I + 1], + b: D.data[I + 2], + a: D.data[I + 3] + }); + return k; + } + }, { + key: "generatepalette", + value: function(A) { + var D = [], I, k, B; + if (A < 8) + for (var H = Math.floor(255 / (A - 1)), Y = 0; Y < A; Y += 1) + D.push({ + r: Y * H, + g: Y * H, + b: Y * H, + a: 255 + }); + else { + var W = Math.floor(Math.pow(A, 0.3333333333333333)), q = Math.floor(255 / (W - 1)), ie = A - W * W * W; + for (I = 0; I < W; I += 1) + for (k = 0; k < W; k += 1) + for (B = 0; B < W; B += 1) + D.push({ + r: I * q, + g: k * q, + b: B * q, + a: 255 + }); + for (I = 0; I < ie; I += 1) + D.push({ + r: Math.floor(Math.random() * 255), + g: Math.floor(Math.random() * 255), + b: Math.floor(Math.random() * 255), + a: Math.floor(Math.random() * 255) + }); + } + return D; + } + }, { + key: "layering", + value: function(A) { + var D = [], I = 0, k = A.array.length, B = A.array[0].length, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt; + for (rt = 0; rt < A.palette.length; rt += 1) + for (D[rt] = [], Le = 0; Le < k; Le += 1) + for (D[rt][Le] = [], Ee = 0; Ee < B; Ee += 1) + D[rt][Le][Ee] = 0; + for (Le = 1; Le < k - 1; Le += 1) + for (Ee = 1; Ee < B - 1; Ee += 1) + I = A.array[Le][Ee], H = A.array[Le - 1][Ee - 1] === I ? 1 : 0, Y = A.array[Le - 1][Ee] === I ? 1 : 0, W = A.array[Le - 1][Ee + 1] === I ? 1 : 0, q = A.array[Le][Ee - 1] === I ? 1 : 0, ie = A.array[Le][Ee + 1] === I ? 1 : 0, Se = A.array[Le + 1][Ee - 1] === I ? 1 : 0, Ce = A.array[Le + 1][Ee] === I ? 1 : 0, De = A.array[Le + 1][Ee + 1] === I ? 1 : 0, D[I][Le + 1][Ee + 1] = 1 + ie * 2 + De * 4 + Ce * 8, q || (D[I][Le + 1][Ee] = 0 + 2 + Ce * 4 + Se * 8), Y || (D[I][Le][Ee + 1] = 0 + W * 2 + ie * 4 + 8), H || (D[I][Le][Ee] = 0 + Y * 2 + 4 + q * 8); + return D; + } + }, { + key: "layeringstep", + value: function(A, D) { + var I = [], k = A.array.length, B = A.array[0].length, H, Y; + for (Y = 0; Y < k; Y += 1) + for (I[Y] = [], H = 0; H < B; H += 1) + I[Y][H] = 0; + for (Y = 1; Y < k; Y += 1) + for (H = 1; H < B; H += 1) + I[Y][H] = (A.array[Y - 1][H - 1] === D ? 1 : 0) + (A.array[Y - 1][H] === D ? 2 : 0) + (A.array[Y][H - 1] === D ? 8 : 0) + (A.array[Y][H] === D ? 4 : 0); + return I; + } + }, { + key: "pathscan", + value: function(A, D) { + for (var I = [], k = 0, B = 0, H = 0, Y = 0, W = A[0].length, q = A.length, ie = 0, Se = !0, Ce = !1, De, Ee = 0; Ee < q; Ee += 1) + for (var Le = 0; Le < W; Le += 1) + if (A[Ee][Le] === 4 || A[Ee][Le] === 11) + for (H = Le, Y = Ee, I[k] = {}, I[k].points = [], I[k].boundingbox = [H, Y, H, Y], I[k].holechildren = [], Se = !1, B = 0, Ce = A[Ee][Le] === 11, ie = 1; !Se; ) { + if (I[k].points[B] = {}, I[k].points[B].x = H - 1, I[k].points[B].y = Y - 1, I[k].points[B].t = A[Y][H], H - 1 < I[k].boundingbox[0] && (I[k].boundingbox[0] = H - 1), H - 1 > I[k].boundingbox[2] && (I[k].boundingbox[2] = H - 1), Y - 1 < I[k].boundingbox[1] && (I[k].boundingbox[1] = Y - 1), Y - 1 > I[k].boundingbox[3] && (I[k].boundingbox[3] = Y - 1), De = this.pathscan_combined_lookup[A[Y][H]][ie], A[Y][H] = De[0], ie = De[1], H += De[2], Y += De[3], H - 1 === I[k].points[0].x && Y - 1 === I[k].points[0].y) + if (Se = !0, I[k].points.length < D) + I.pop(); + else { + if (I[k].isholepath = !!Ce, Ce) { + for (var rt = 0, Pt = [-1, -1, W + 1, q + 1], zt = 0; zt < k; zt++) + !I[zt].isholepath && this.boundingboxincludes(I[zt].boundingbox, I[k].boundingbox) && this.boundingboxincludes(Pt, I[zt].boundingbox) && (rt = zt, Pt = I[zt].boundingbox); + I[rt].holechildren.push(k); + } + k += 1; + } + B += 1; + } + return I; + } + }, { + key: "boundingboxincludes", + value: function(A, D) { + return A[0] < D[0] && A[1] < D[1] && A[2] > D[2] && A[3] > D[3]; + } + }, { + key: "batchpathscan", + value: function(A, D) { + var I = []; + for (var k in A) + A.hasOwnProperty(k) && (I[k] = this.pathscan(A[k], D)); + return I; + } + }, { + key: "internodes", + value: function(A, D) { + var I = [], k = 0, B = 0, H = 0, Y = 0, W = 0, q, ie; + for (q = 0; q < A.length; q += 1) + for (I[q] = {}, I[q].points = [], I[q].boundingbox = A[q].boundingbox, I[q].holechildren = A[q].holechildren, I[q].isholepath = A[q].isholepath, k = A[q].points.length, ie = 0; ie < k; ie += 1) + B = (ie + 1) % k, H = (ie + 2) % k, Y = (ie - 1 + k) % k, W = (ie - 2 + k) % k, D.rightangleenhance && this.testrightangle(A[q], W, Y, ie, B, H) && (I[q].points.length > 0 && (I[q].points[I[q].points.length - 1].linesegment = this.getdirection(I[q].points[I[q].points.length - 1].x, I[q].points[I[q].points.length - 1].y, A[q].points[ie].x, A[q].points[ie].y)), I[q].points.push({ + x: A[q].points[ie].x, + y: A[q].points[ie].y, + linesegment: this.getdirection(A[q].points[ie].x, A[q].points[ie].y, (A[q].points[ie].x + A[q].points[B].x) / 2, (A[q].points[ie].y + A[q].points[B].y) / 2) + })), I[q].points.push({ + x: (A[q].points[ie].x + A[q].points[B].x) / 2, + y: (A[q].points[ie].y + A[q].points[B].y) / 2, + linesegment: this.getdirection((A[q].points[ie].x + A[q].points[B].x) / 2, (A[q].points[ie].y + A[q].points[B].y) / 2, (A[q].points[B].x + A[q].points[H].x) / 2, (A[q].points[B].y + A[q].points[H].y) / 2) + }); + return I; + } + }, { + key: "testrightangle", + value: function(A, D, I, k, B, H) { + return A.points[k].x === A.points[D].x && A.points[k].x === A.points[I].x && A.points[k].y === A.points[B].y && A.points[k].y === A.points[H].y || A.points[k].y === A.points[D].y && A.points[k].y === A.points[I].y && A.points[k].x === A.points[B].x && A.points[k].x === A.points[H].x; + } + }, { + key: "getdirection", + value: function(A, D, I, k) { + var B = 8; + return A < I ? D < k ? B = 1 : D > k ? B = 7 : B = 0 : A > I ? D < k ? B = 3 : D > k ? B = 5 : B = 4 : D < k ? B = 2 : D > k ? B = 6 : B = 8, B; + } + }, { + key: "batchinternodes", + value: function(A, D) { + var I = []; + for (var k in A) + A.hasOwnProperty(k) && (I[k] = this.internodes(A[k], D)); + return I; + } + }, { + key: "tracepath", + value: function(A, D, I) { + var k = 0, B, H, Y, W = {}; + for (W.segments = [], W.boundingbox = A.boundingbox, W.holechildren = A.holechildren, W.isholepath = A.isholepath; k < A.points.length; ) { + var q; + for (B = A.points[k].linesegment, H = -1, Y = k + 1; (A.points[Y].linesegment === B || A.points[Y].linesegment === H || H === -1) && Y < A.points.length - 1; ) + A.points[Y].linesegment !== B && H === -1 && (H = A.points[Y].linesegment), Y += 1; + Y === A.points.length - 1 && (Y = 0), W.segments = K()(q = W.segments).call(q, this.fitseq(A, D, I, k, Y)), Y > 0 ? k = Y : k = A.points.length; + } + return W; + } + }, { + key: "fitseq", + value: function(A, D, I, k, B) { + var H; + if (B > A.points.length || B < 0) + return []; + var Y = k, W = 0, q = !0, ie, Se, Ce, De = B - k; + De < 0 && (De += A.points.length); + for (var Ee = (A.points[B].x - A.points[k].x) / De, Le = (A.points[B].y - A.points[k].y) / De, rt = (k + 1) % A.points.length, Pt; rt != B; ) + Pt = rt - k, Pt < 0 && (Pt += A.points.length), ie = A.points[k].x + Ee * Pt, Se = A.points[k].y + Le * Pt, Ce = (A.points[rt].x - ie) * (A.points[rt].x - ie) + (A.points[rt].y - Se) * (A.points[rt].y - Se), Ce > D && (q = !1), Ce > W && (Y = rt, W = Ce), rt = (rt + 1) % A.points.length; + if (q) + return [{ + type: "L", + x1: A.points[k].x, + y1: A.points[k].y, + x2: A.points[B].x, + y2: A.points[B].y + }]; + var zt = Y; + q = !0, W = 0; + var Xt = (zt - k) / De, dt = (1 - Xt) * (1 - Xt), on = 2 * (1 - Xt) * Xt, Hi = Xt * Xt, Ya = (dt * A.points[k].x + Hi * A.points[B].x - A.points[zt].x) / -on, oi = (dt * A.points[k].y + Hi * A.points[B].y - A.points[zt].y) / -on; + for (rt = k + 1; rt != B; ) + Xt = (rt - k) / De, dt = (1 - Xt) * (1 - Xt), on = 2 * (1 - Xt) * Xt, Hi = Xt * Xt, ie = dt * A.points[k].x + on * Ya + Hi * A.points[B].x, Se = dt * A.points[k].y + on * oi + Hi * A.points[B].y, Ce = (A.points[rt].x - ie) * (A.points[rt].x - ie) + (A.points[rt].y - Se) * (A.points[rt].y - Se), Ce > I && (q = !1), Ce > W && (Y = rt, W = Ce), rt = (rt + 1) % A.points.length; + if (q) + return [{ + type: "Q", + x1: A.points[k].x, + y1: A.points[k].y, + x2: Ya, + y2: oi, + x3: A.points[B].x, + y3: A.points[B].y + }]; + var Ss = zt; + return K()(H = this.fitseq(A, D, I, k, Ss)).call(H, this.fitseq(A, D, I, Ss, B)); + } + }, { + key: "batchtracepaths", + value: function(A, D, I) { + var k = []; + for (var B in A) + A.hasOwnProperty(B) && k.push(this.tracepath(A[B], D, I)); + return k; + } + }, { + key: "batchtracelayers", + value: function(A, D, I) { + var k = []; + for (var B in A) + A.hasOwnProperty(B) && (k[B] = this.batchtracepaths(A[B], D, I)); + return k; + } + }, { + key: "roundtodec", + value: function(A, D) { + return Number(A.toFixed(D)); + } + }, { + key: "svgpathstring", + value: function(A, D, I, k) { + var B, H, Y = A.layers[D], W = Y[I], q = "", ie; + if (k.linefilter && W.segments.length < 3) + return q; + if (q = K()(B = "= 0; ie--) { + var Ya; + if (q += "".concat(dt.segments[ie].type, " "), dt.segments[ie].hasOwnProperty("x3")) { + var oi; + q += K()(oi = "".concat(dt.segments[ie].x2 * k.scale, " ")).call(oi, dt.segments[ie].y2 * k.scale, " "); + } + q += K()(Ya = "".concat(dt.segments[ie].x1 * k.scale, " ")).call(Ya, dt.segments[ie].y1 * k.scale, " "); + } + } else { + if (dt.segments[dt.segments.length - 1].hasOwnProperty("x3")) { + var Ss; + q += K()(Ss = "M ".concat(this.roundtodec(dt.segments[dt.segments.length - 1].x3 * k.scale), " ")).call(Ss, this.roundtodec(dt.segments[dt.segments.length - 1].y3 * k.scale), " "); + } else { + var Ou; + q += K()(Ou = "M ".concat(this.roundtodec(dt.segments[dt.segments.length - 1].x2 * k.scale), " ")).call(Ou, this.roundtodec(dt.segments[dt.segments.length - 1].y2 * k.scale), " "); + } + for (ie = dt.segments.length - 1; ie >= 0; ie--) { + var Xa; + if (q += "".concat(dt.segments[ie].type, " "), dt.segments[ie].hasOwnProperty("x3")) { + var Vv; + q += K()(Vv = "".concat(this.roundtodec(dt.segments[ie].x2 * k.scale), " ")).call(Vv, this.roundtodec(dt.segments[ie].y2 * k.scale), " "); + } + q += K()(Xa = "".concat(this.roundtodec(dt.segments[ie].x1 * k.scale), " ")).call(Xa, this.roundtodec(dt.segments[ie].y1 * k.scale), " "); + } + } + q += "Z "; + } + if (q += '" />', k.lcpr || k.qcpr) { + for (ie = 0; ie < W.segments.length; ie++) { + if (W.segments[ie].hasOwnProperty("x3") && k.qcpr) { + var Km, Qm, qm, ey, ty, ry, ny, iy, ay, oy, sy, ly, uy, cy; + q += K()(Km = K()(Qm = K()(qm = ''), q += K()(ey = K()(ty = K()(ry = ''), q += K()(ny = K()(iy = K()(ay = K()(oy = ''), q += K()(sy = K()(ly = K()(uy = K()(cy = ''); + } + if (!W.segments[ie].hasOwnProperty("x3") && k.lcpr) { + var hy, fy, dy; + q += K()(hy = K()(fy = K()(dy = ''); + } + } + for (var Xt = 0; Xt < W.holechildren.length; Xt++) { + var dt = Y[W.holechildren[Xt]]; + for (ie = 0; ie < dt.segments.length; ie++) { + if (dt.segments[ie].hasOwnProperty("x3") && k.qcpr) { + var vy, ws, Fc, YM, XM, ZM, JM, KM, QM, qM, eD, tD, rD, nD; + q += K()(vy = K()(ws = K()(Fc = ''), q += K()(YM = K()(XM = K()(ZM = ''), q += K()(JM = K()(KM = K()(QM = K()(qM = ''), q += K()(eD = K()(tD = K()(rD = K()(nD = ''); + } + if (!dt.segments[ie].hasOwnProperty("x3") && k.lcpr) { + var iD, aD, oD; + q += K()(iD = K()(aD = K()(oD = ''); + } + } + } + } + return q; + } + }, { + key: "getsvgstring", + value: function(A, D) { + var I, k, B; + D = this.checkoptions(D); + for (var H = A.width * D.scale, Y = A.height * D.scale, W = K()(I = "'), q = 0; q < A.layers.length; q += 1) + for (var ie = 0; ie < A.layers[q].length; ie += 1) + A.layers[q][ie].isholepath || (W += this.svgpathstring(A, q, ie, D)); + return W += "", W; + } + }, { + key: "compareNumbers", + value: function(A, D) { + return A - D; + } + }, { + key: "torgbastr", + value: function(A) { + var D, I, k; + return K()(D = K()(I = K()(k = "rgba(".concat(A.r, ",")).call(k, A.g, ",")).call(I, A.b, ",")).call(D, A.a, ")"); + } + }, { + key: "tosvgcolorstr", + value: function(A, D) { + var I, k, B, H, Y, W, q; + return K()(I = K()(k = K()(B = K()(H = K()(Y = K()(W = K()(q = 'fill="rgb('.concat(A.r, ",")).call(q, A.g, ",")).call(W, A.b, ')" stroke="rgb(')).call(Y, A.r, ",")).call(H, A.g, ",")).call(B, A.b, ')" stroke-width="')).call(k, D.strokewidth, '" opacity="')).call(I, A.a / 255, '" '); + } + }, { + key: "appendSVGString", + value: function(A, D) { + var I; + D ? (I = document.getElementById(D), I || (I = document.createElement("div"), I.id = D, document.body.appendChild(I))) : (I = document.createElement("div"), document.body.appendChild(I)), I.innerHTML += A; + } + }, { + key: "blur", + value: function(A, D, I) { + var k, B, H, Y, W, q, ie, Se, Ce, De, Ee = { + width: A.width, + height: A.height, + data: [] + }; + if (D = Math.floor(D), D < 1) + return A; + D > 5 && (D = 5), I = Math.abs(I), I > 1024 && (I = 1024); + var Le = this.gks[D - 1]; + for (B = 0; B < A.height; B++) + for (k = 0; k < A.width; k++) { + for (q = 0, ie = 0, Se = 0, Ce = 0, De = 0, H = -D; H < D + 1; H++) + k + H > 0 && k + H < A.width && (W = (B * A.width + k + H) * 4, q += A.data[W] * Le[H + D], ie += A.data[W + 1] * Le[H + D], Se += A.data[W + 2] * Le[H + D], Ce += A.data[W + 3] * Le[H + D], De += Le[H + D]); + W = (B * A.width + k) * 4, Ee.data[W] = Math.floor(q / De), Ee.data[W + 1] = Math.floor(ie / De), Ee.data[W + 2] = Math.floor(Se / De), Ee.data[W + 3] = Math.floor(Ce / De); + } + var rt = new Uint8ClampedArray(Ee.data); + for (B = 0; B < A.height; B++) + for (k = 0; k < A.width; k++) { + for (q = 0, ie = 0, Se = 0, Ce = 0, De = 0, H = -D; H < D + 1; H++) + B + H > 0 && B + H < A.height && (W = ((B + H) * A.width + k) * 4, q += rt[W] * Le[H + D], ie += rt[W + 1] * Le[H + D], Se += rt[W + 2] * Le[H + D], Ce += rt[W + 3] * Le[H + D], De += Le[H + D]); + W = (B * A.width + k) * 4, Ee.data[W] = Math.floor(q / De), Ee.data[W + 1] = Math.floor(ie / De), Ee.data[W + 2] = Math.floor(Se / De), Ee.data[W + 3] = Math.floor(Ce / De); + } + for (B = 0; B < A.height; B++) + for (k = 0; k < A.width; k++) + W = (B * A.width + k) * 4, Y = Math.abs(Ee.data[W] - A.data[W]) + Math.abs(Ee.data[W + 1] - A.data[W + 1]) + Math.abs(Ee.data[W + 2] - A.data[W + 2]) + Math.abs(Ee.data[W + 3] - A.data[W + 3]), Y > I && (Ee.data[W] = A.data[W], Ee.data[W + 1] = A.data[W + 1], Ee.data[W + 2] = A.data[W + 2], Ee.data[W + 3] = A.data[W + 3]); + return Ee; + } + }, { + key: "loadImage", + value: function(A, D, I) { + var k = new Image(); + I && I.corsenabled && (k.crossOrigin = "Anonymous"), k.src = A, k.onload = function() { + var B = document.createElement("canvas"); + B.width = k.width, B.height = k.height; + var H = B.getContext("2d"); + H.drawImage(k, 0, 0), D(B); + }; + } + }, { + key: "getImgdata", + value: function(A) { + var D = A.getContext("2d"); + return D.getImageData(0, 0, A.width, A.height); + } + }, { + key: "drawLayers", + value: function(A, D, I, k) { + I = I || 1; + var B, H, Y, W, q, ie; + k ? (ie = document.getElementById(k), ie || (ie = document.createElement("div"), ie.id = k, document.body.appendChild(ie))) : (ie = document.createElement("div"), document.body.appendChild(ie)); + for (q in A) + if (A.hasOwnProperty(q)) { + B = A[q][0].length, H = A[q].length; + var Se = document.createElement("canvas"); + Se.width = B * I, Se.height = H * I; + var Ce = Se.getContext("2d"); + for (W = 0; W < H; W += 1) + for (Y = 0; Y < B; Y += 1) + Ce.fillStyle = this.torgbastr(D[A[q][W][Y] % D.length]), Ce.fillRect(Y * I, W * I, I, I); + ie.appendChild(Se); + } + } + }], [{ + key: "tracerDefaultOption", + value: function() { + return { + pathomit: 100, + ltres: 0.1, + qtres: 1, + scale: 1, + strokewidth: 5, + viewbox: !1, + linefilter: !0, + desc: !1, + rightangleenhance: !1, + pal: [{ + r: 0, + g: 0, + b: 0, + a: 255 + }, { + r: 255, + g: 255, + b: 255, + a: 255 + }] + }; + } + }]), V; + }(), ai = { + /** + * Get ui actions + * @returns {Object} actions for ui + * @private + */ + getActions: function() { + return { + main: this._mainAction(), + shape: this._shapeAction(), + crop: this._cropAction(), + resize: this._resizeAction(), + flip: this._flipAction(), + rotate: this._rotateAction(), + text: this._textAction(), + mask: this._maskAction(), + draw: this._drawAction(), + icon: this._iconAction(), + filter: this._filterAction(), + history: this._historyAction() + }; + }, + /** + * Main Action + * @returns {Object} actions for ui main + * @private + */ + _mainAction: function() { + var L = this, A = function() { + L.ui.submenu === "crop" && (L.stopDrawingMode(), L.ui.changeMenu("crop")); + }, D = function(q) { + L.ui.submenu === "rotate" && L.ui.rotate.setRangeBarAngle("setAngle", q); + }, I = function(q) { + L.ui.submenu === "filter" && Ll()(L.ui).setFilterState(q); + }, k = function(q) { + return D(q), I(q), q; + }, B = function() { + var q = L._graphics.getZoomMode(); + L.stopDrawingMode(), q !== vr.ZOOM ? (L.startDrawingMode(ur.ZOOM), L._graphics.startZoomInMode()) : L._graphics.endZoomInMode(); + }, H = function() { + var q = L._graphics.getZoomMode(); + L.stopDrawingMode(), q !== vr.HAND ? (L.startDrawingMode(ur.ZOOM), L._graphics.startHandMode()) : L._graphics.endHandMode(); + }, Y = function() { + Ll()(L.ui) && Ll()(L.ui).initFilterCheckBoxState(); + }; + return te()({ + initLoadImage: function(q, ie) { + return L.loadImageFromURL(q, ie).then(function(Se) { + A(), L.ui.initializeImgUrl = q, L.ui.resizeEditor({ + imageSize: Se + }), L.clearUndoStack(), L._invoker.fire(Re.EXECUTE_COMMAND, dr.LOAD_IMAGE); + }); + }, + undo: function() { + L.isEmptyUndoStack() || (A(), L.deactivateAll(), L.undo().then(k)); + }, + redo: function() { + L.isEmptyRedoStack() || (A(), L.deactivateAll(), L.redo().then(k)); + }, + reset: function() { + A(), L.loadImageFromURL(L.ui.initializeImgUrl, "resetImage").then(function(q) { + A(), Y(), L.ui.resizeEditor({ + imageSize: q + }), L.clearUndoStack(), L._initHistory(); + }); + }, + delete: function() { + L.ui.changeHelpButtonEnabled("delete", !1), A(), L.removeActiveObject(), L.activeObjectId = null; + }, + deleteAll: function() { + A(), L.clearObjects(), L.ui.changeHelpButtonEnabled("delete", !1), L.ui.changeHelpButtonEnabled("deleteAll", !1); + }, + load: function(q) { + Nt() || alert("This browser does not support file-api"), L.ui.initializeImgUrl = oe().createObjectURL(q), L.loadImageFromFile(q).then(function(ie) { + A(), Y(), L.clearUndoStack(), L.ui.activeMenuEvent(), L.ui.resizeEditor({ + imageSize: ie + }), L._clearHistory(), L._invoker.fire(Re.EXECUTE_COMMAND, dr.LOAD_IMAGE); + }).catch(function(ie) { + return xe().reject(ie); + }); + }, + download: function() { + var q = L.toDataURL(), ie = L.getImageName(), Se, Ce, De; + Nt() && window.saveAs ? (Se = To(q), Ce = Se.type.split("/")[1], ie.split(".").pop() !== Ce && (ie += ".".concat(Ce)), saveAs(Se, ie)) : (De = window.open(), De.document.body.innerHTML = "")); + }, + history: function(q) { + L.ui.toggleHistoryMenu(q); + }, + zoomIn: function() { + L.ui.toggleZoomButtonStatus("zoomIn"), L.deactivateAll(), B(); + }, + zoomOut: function() { + L._graphics.zoomOut(); + }, + hand: function() { + L.ui.offZoomInButtonStatus(), L.ui.toggleZoomButtonStatus("hand"), L.deactivateAll(), H(); + } + }, this._commonAction()); + }, + /** + * Icon Action + * @returns {Object} actions for ui icon + * @private + */ + _iconAction: function() { + var L = this; + return te()({ + changeColor: function(D) { + L.activeObjectId && L.changeIconColor(L.activeObjectId, D); + }, + addIcon: function(D, I) { + L.startDrawingMode("ICON"), L.setDrawingIcon(D, I); + }, + cancelAddIcon: function() { + L.ui.icon.clearIconType(), L.changeSelectableAll(!0), L.changeCursor("default"), L.stopDrawingMode(); + }, + registerDefaultIcons: function(D, I) { + var k = {}; + k[D] = I, L.registerIcons(k); + }, + registerCustomIcon: function(D, I) { + var k = new Pn(); + k.imageToSVG(D, function(B) { + var H = B.match(/path[^>]*d="([^"]*)"/), Y = we(H, 2), W = Y[1], q = {}; + q[I.name] = W, L.registerIcons(q), L.addIcon(I.name, { + left: 100, + top: 100 + }); + }, Pn.tracerDefaultOption()); + } + }, this._commonAction()); + }, + /** + * Draw Action + * @returns {Object} actions for ui draw + * @private + */ + _drawAction: function() { + var L = this; + return te()({ + setDrawMode: function(D, I) { + L.stopDrawingMode(), D === "free" ? L.startDrawingMode("FREE_DRAWING", I) : L.startDrawingMode("LINE_DRAWING", I); + }, + setColor: function(D) { + L.setBrush({ + color: D + }); + } + }, this._commonAction()); + }, + /** + * Mask Action + * @returns {Object} actions for ui mask + * @private + */ + _maskAction: function() { + var L = this; + return te()({ + loadImageFromURL: function(D, I) { + return L.loadImageFromURL(L.toDataURL(), "FilterImage").then(function() { + L.addImageObject(D).then(function() { + oe().revokeObjectURL(I); + }), L._invoker.fire(Re.EXECUTE_COMMAND, dr.LOAD_MASK_IMAGE); + }); + }, + applyFilter: function() { + L.applyFilter("mask", { + maskObjId: L.activeObjectId + }); + } + }, this._commonAction()); + }, + /** + * Text Action + * @returns {Object} actions for ui text + * @private + */ + _textAction: function() { + var L = this; + return te()({ + changeTextStyle: function(D, I) { + L.activeObjectId && L.changeTextStyle(L.activeObjectId, D, I); + } + }, this._commonAction()); + }, + /** + * Rotate Action + * @returns {Object} actions for ui rotate + * @private + */ + _rotateAction: function() { + var L = this; + return te()({ + rotate: function(D, I) { + L.rotate(D, I), L.ui.resizeEditor(), L.ui.rotate.setRangeBarAngle("rotate", D); + }, + setAngle: function(D, I) { + L.setAngle(D, I), L.ui.resizeEditor(), L.ui.rotate.setRangeBarAngle("setAngle", D); + } + }, this._commonAction()); + }, + /** + * Shape Action + * @returns {Object} actions for ui shape + * @private + */ + _shapeAction: function() { + var L = this; + return te()({ + changeShape: function(D, I) { + L.activeObjectId && L.changeShape(L.activeObjectId, D, I); + }, + setDrawingShape: function(D) { + L.setDrawingShape(D); + } + }, this._commonAction()); + }, + /** + * Crop Action + * @returns {Object} actions for ui crop + * @private + */ + _cropAction: function() { + var L = this; + return te()({ + crop: function() { + var D = L.getCropzoneRect(); + D && !Tn(D) && L.crop(D).then(function() { + L.stopDrawingMode(), L.ui.resizeEditor(), L.ui.changeMenu("crop"), L._invoker.fire(Re.EXECUTE_COMMAND, dr.CROP); + }).catch(function(I) { + return xe().reject(I); + }); + }, + cancel: function() { + L.stopDrawingMode(), L.ui.changeMenu("crop"); + }, + /* eslint-disable */ + preset: function(D) { + switch (D) { + case "preset-square": + L.setCropzoneRect(1 / 1); + break; + case "preset-3-2": + L.setCropzoneRect(3 / 2); + break; + case "preset-4-3": + L.setCropzoneRect(4 / 3); + break; + case "preset-5-4": + L.setCropzoneRect(5 / 4); + break; + case "preset-7-5": + L.setCropzoneRect(7 / 5); + break; + case "preset-16-9": + L.setCropzoneRect(16 / 9); + break; + default: + L.setCropzoneRect(), L.ui.crop.changeApplyButtonStatus(!1); + break; + } + } + }, this._commonAction()); + }, + /** + * Resize Action + * @returns {Object} actions for ui resize + * @private + */ + _resizeAction: function() { + var L = this; + return te()({ + getCurrentDimensions: function() { + return L._graphics.getCurrentDimensions(); + }, + preview: function(D, I, k) { + var B = L._graphics.getCurrentDimensions(), H = function() { + return B.width / B.height; + }, Y = {}; + switch (D) { + case "width": + Y.width = I, k ? Y.height = I / H() : Y.height = B.height; + break; + case "height": + Y.height = I, k ? Y.width = I * H() : Y.width = B.width; + break; + default: + Y = B; + } + L._graphics.resize(Y).then(function() { + L.ui.resizeEditor(); + }), k && (L.ui.resize.setWidthValue(Y.width), L.ui.resize.setHeightValue(Y.height)); + }, + lockAspectRatio: function(D, I, k) { + var B = L._graphics.getCurrentDimensions(), H = B.width, Y = B.height, W = H / Y; + if (D) + if (H > Y) { + var q = k / W, ie = I * W; + L.ui.resize.setLimit({ + minWidth: ie > I ? ie : I, + minHeight: I, + maxWidth: k, + maxHeight: q < k ? q : k + }); + } else { + var Se = k * W, Ce = I / W; + L.ui.resize.setLimit({ + minWidth: I, + minHeight: Ce > I ? Ce : I, + maxWidth: Se < k ? Se : k, + maxHeight: k + }); + } + else + L.ui.resize.setLimit({ + minWidth: I, + minHeight: I, + maxWidth: k, + maxHeight: k + }); + }, + resize: function() { + var D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + D || (D = L._graphics.getCurrentDimensions()), L.resize(D).then(function() { + L._graphics.setOriginalDimensions(D), L.stopDrawingMode(), L.ui.resizeEditor(), L.ui.changeMenu("resize"); + }).catch(function(I) { + return xe().reject(I); + }); + }, + reset: function() { + var D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, I = L._graphics.getOriginalDimensions(); + L.ui.resize.setWidthValue(I.width, !0), L.ui.resize.setHeightValue(I.height, !0), L._graphics.resize(I).then(function() { + D || (L.stopDrawingMode(), L.ui.resizeEditor(), L.ui.changeMenu("resize")); + }); + } + }, this._commonAction()); + }, + /** + * Flip Action + * @returns {Object} actions for ui flip + * @private + */ + _flipAction: function() { + var L = this; + return te()({ + flip: function(D) { + return L[D](); + } + }, this._commonAction()); + }, + /** + * Filter Action + * @returns {Object} actions for ui filter + * @private + */ + _filterAction: function() { + var L = this; + return te()({ + applyFilter: function(D, I, k, B) { + D ? L.applyFilter(I, k, B) : L.hasFilter(I) && L.removeFilter(I); + } + }, this._commonAction()); + }, + /** + * Image Editor Event Observer + */ + setReAction: function() { + var L = this; + this.on({ + undoStackChanged: function(D) { + D ? (L.ui.changeHelpButtonEnabled("undo", !0), L.ui.changeHelpButtonEnabled("reset", !0)) : (L.ui.changeHelpButtonEnabled("undo", !1), L.ui.changeHelpButtonEnabled("reset", !1)), L.ui.resizeEditor(); + }, + redoStackChanged: function(D) { + D ? L.ui.changeHelpButtonEnabled("redo", !0) : L.ui.changeHelpButtonEnabled("redo", !1), L.ui.resizeEditor(); + }, + /* eslint-disable complexity */ + objectActivated: function(D) { + var I, k; + L.activeObjectId = D.id, L.ui.changeHelpButtonEnabled("delete", !0), L.ui.changeHelpButtonEnabled("deleteAll", !0), D.type === "cropzone" ? L.ui.crop.changeApplyButtonStatus(!0) : c()(I = ["rect", "circle", "triangle"]).call(I, D.type) > -1 ? (L.stopDrawingMode(), L.ui.submenu !== "shape" && L.ui.changeMenu("shape", !1, !1), L.ui.shape.setShapeStatus({ + strokeColor: D.stroke, + strokeWidth: D.strokeWidth, + fillColor: ze()(D) + }), L.ui.shape.setMaxStrokeValue(Math.min(D.width, D.height))) : D.type === "path" || D.type === "line" ? L.ui.submenu !== "draw" && (L.ui.changeMenu("draw", !1, !1), L.ui.draw.changeStandbyMode()) : c()(k = ["i-text", "text"]).call(k, D.type) > -1 ? (L.ui.submenu !== "text" && L.ui.changeMenu("text", !1, !1), L.ui.text.setTextStyleStateOnAction(D)) : D.type === "icon" && (L.stopDrawingMode(), L.ui.submenu !== "icon" && L.ui.changeMenu("icon", !1, !1), L.ui.icon.setIconPickerColor(ze()(D))); + }, + /* eslint-enable complexity */ + addText: function(D) { + var I = L.ui.text, k = I.textColor, B = I.fontSize, H = I.fontStyle, Y = I.fontWeight, W = I.underline, q = "Noto Sans"; + L.addText("Double Click", { + position: D.originPosition, + styles: { + fill: k, + fontSize: B, + fontFamily: q, + fontStyle: H, + fontWeight: Y, + underline: W + } + }).then(function() { + L.changeCursor("default"); + }); + }, + addObjectAfter: function(D) { + var I; + D.type === "icon" ? L.ui.icon.changeStandbyMode() : c()(I = ["rect", "circle", "triangle"]).call(I, D.type) > -1 && (L.ui.shape.setMaxStrokeValue(Math.min(D.width, D.height)), L.ui.shape.changeStandbyMode()); + }, + objectScaled: function(D) { + var I, k; + if (c()(I = ["i-text", "text"]).call(I, D.type) > -1) + L.ui.text.fontSize = Lr(D.fontSize); + else if (c()(k = ["rect", "circle", "triangle"]).call(k, D.type) >= 0) { + var B = D.width, H = D.height, Y = L.ui.shape.getStrokeValue(); + B < Y && L.ui.shape.setStrokeValue(B), H < Y && L.ui.shape.setStrokeValue(H); + } + }, + selectionCleared: function() { + L.activeObjectId = null, L.ui.submenu === "text" ? L.changeCursor("text") : us(["draw", "crop", "resize"], L.ui.submenu) || L.stopDrawingMode(); + } + }); + }, + /** + * History Action + * @returns {Object} history actions for ui + * @private + */ + _historyAction: function() { + var L = this; + return { + undo: function(D) { + return L.undo(D); + }, + redo: function(D) { + return L.redo(D); + } + }; + }, + /** + * Common Action + * @returns {Object} common actions for ui + * @private + */ + _commonAction: function() { + var L = this, A, D, I, k, B = ur.TEXT, H = ur.CROPPER, Y = ur.SHAPE, W = ur.ZOOM, q = ur.RESIZE; + return { + modeChange: function(Se) { + switch (Se) { + case wn.TEXT: + L._changeActivateMode(B); + break; + case wn.CROP: + L.startDrawingMode(H); + break; + case wn.SHAPE: + L._changeActivateMode(Y), L.setDrawingShape(L.ui.shape.type, L.ui.shape.options); + break; + case wn.ZOOM: + L.startDrawingMode(W); + break; + case wn.RESIZE: + L.startDrawingMode(q); + break; + } + }, + deactivateAll: ne()(A = this.deactivateAll).call(A, this), + changeSelectableAll: ne()(D = this.changeSelectableAll).call(D, this), + discardSelection: ne()(I = this.discardSelection).call(I, this), + stopDrawingMode: ne()(k = this.stopDrawingMode).call(k, this) + }; + }, + /** + * Mixin + * @param {ImageEditor} ImageEditor instance + */ + mixin: function(L) { + te()(L.prototype, this); + } + }, Pl = a(602), Js = /* @__PURE__ */ a.n(Pl), Lo = a(5573), ho = /* @__PURE__ */ a.n(Lo), Sv = /* @__PURE__ */ function() { + function V(L, A) { + G(this, V), this.name = L, this.graphics = A; + } + return ee(V, [{ + key: "fire", + value: function() { + for (var A = this.graphics, D = arguments.length, I = new Array(D), k = 0; k < D; k++) + I[k] = arguments[k]; + return this.graphics.fire.apply(A, I); + } + /** + * Save image(background) of canvas + * @param {string} name - Name of image + * @param {fabric.Image} oImage - Fabric image instance + */ + }, { + key: "setCanvasImage", + value: function(A, D) { + this.graphics.setCanvasImage(A, D); + } + /** + * Returns canvas element of fabric.Canvas[[lower-canvas]] + * @returns {HTMLCanvasElement} + */ + }, { + key: "getCanvasElement", + value: function() { + return this.graphics.getCanvasElement(); + } + /** + * Get fabric.Canvas instance + * @returns {fabric.Canvas} + */ + }, { + key: "getCanvas", + value: function() { + return this.graphics.getCanvas(); + } + /** + * Get canvasImage (fabric.Image instance) + * @returns {fabric.Image} + */ + }, { + key: "getCanvasImage", + value: function() { + return this.graphics.getCanvasImage(); + } + /** + * Get image name + * @returns {string} + */ + }, { + key: "getImageName", + value: function() { + return this.graphics.getImageName(); + } + /** + * Get image editor + * @returns {ImageEditor} + */ + }, { + key: "getEditor", + value: function() { + return this.graphics.getEditor(); + } + /** + * Return component name + * @returns {string} + */ + }, { + key: "getName", + value: function() { + return this.name; + } + /** + * Set image properties + * @param {Object} setting - Image properties + * @param {boolean} [withRendering] - If true, The changed image will be reflected in the canvas + */ + }, { + key: "setImageProperties", + value: function(A, D) { + this.graphics.setImageProperties(A, D); + } + /** + * Set canvas dimension - css only + * @param {Object} dimension - Canvas css dimension + */ + }, { + key: "setCanvasCssDimension", + value: function(A) { + this.graphics.setCanvasCssDimension(A); + } + /** + * Set canvas dimension - css only + * @param {Object} dimension - Canvas backstore dimension + */ + }, { + key: "setCanvasBackstoreDimension", + value: function(A) { + this.graphics.setCanvasBackstoreDimension(A); + } + /** + * Adjust canvas dimension with scaling image + */ + }, { + key: "adjustCanvasDimension", + value: function() { + this.graphics.adjustCanvasDimension(); + } + }, { + key: "adjustCanvasDimensionBase", + value: function() { + this.graphics.adjustCanvasDimensionBase(); + } + }]), V; + }(), er = Sv; + function Kn(V) { + var L = Ks(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Ks() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var _f = { + padding: 0, + crossOrigin: "Anonymous" + }, Qs = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Kn(A); + function A(D) { + return G(this, A), L.call(this, tt.IMAGE_LOADER, D); + } + return ee(A, [{ + key: "load", + value: function(I, k) { + var B = this, H; + if (!I && !k) { + var Y = this.getCanvas(); + Y.backgroundImage = null, Y.renderAll(), H = new (xe())(function(W) { + B.setCanvasImage("", null), W(); + }); + } else + H = this._setBackgroundImage(k).then(function(W) { + return B.setCanvasImage(I, W), B.adjustCanvasDimension(), W; + }); + return H; + } + /** + * Set background image + * @param {?(fabric.Image|String)} img fabric.Image instance or URL of an image to set background to + * @returns {Promise} + * @private + */ + }, { + key: "_setBackgroundImage", + value: function(I) { + var k = this; + return I ? new (xe())(function(B, H) { + var Y = k.getCanvas(); + Y.setBackgroundImage(I, function() { + var W = Y.backgroundImage; + W && W.getElement() ? B(W) : H(wt.loadingImageFailed); + }, _f); + }) : xe().reject(wt.loadImage); + } + }]), A; + }(er), bf = Qs, Dc = "tl", wv = "tr", kc = "mt", fo = "ml", xf = "mr", Cv = "mb", Su = "bl", qs = "br", Sf = [Dc, wv, kc, fo, xf, Cv, Su, qs], Oc = function() { + }; + function km(V) { + return c()(Sf).call(Sf, V) >= 0; + } + function gs(V, L) { + return V > L ? "width" : "height"; + } + var Om = de.fabric.util.createClass( + de.fabric.Rect, + /** @lends Cropzone.prototype */ + { + /** + * Constructor + * @param {Object} canvas canvas + * @param {Object} options Options object + * @param {Object} extendsOptions object for extends "options" + * @override + */ + initialize: function(L, A, D) { + A = te()(A, D), A.type = "cropzone", this.callSuper("initialize", A), this._addEventHandler(), this.canvas = L, this.options = A; + }, + canvasEventDelegation: function(L) { + var A, D = "unregistered", I = this.canvasEventTrigger[L] !== Oc; + return I ? D = "registered" : c()(A = [Re.OBJECT_MOVED, Re.OBJECT_SCALED]).call(A, L) < 0 && (D = "none"), D; + }, + canvasEventRegister: function(L, A) { + this.canvasEventTrigger[L] = A; + }, + _addEventHandler: function() { + var L, A, D, I, k; + this.canvasEventTrigger = (L = {}, $(L, Re.OBJECT_MOVED, Oc), $(L, Re.OBJECT_SCALED, Oc), L), this.on({ + moving: ne()(A = this._onMoving).call(A, this), + scaling: ne()(D = this._onScaling).call(D, this) + }), de.fabric.util.addListener(document, "keydown", ne()(I = this._onKeyDown).call(I, this)), de.fabric.util.addListener(document, "keyup", ne()(k = this._onKeyUp).call(k, this)); + }, + _renderCropzone: function(L) { + var A = 7, D = 7, I = this.flipX ? -1 : 1, k = this.flipY ? -1 : 1, B = I / this.scaleX, H = k / this.scaleY; + L.scale(B, H), this._fillOuterRect(L, "rgba(0, 0, 0, 0.5)"), this.options.lineWidth ? (this._fillInnerRect(L), this._strokeBorder(L, "rgb(255, 255, 255)", { + lineWidth: this.options.lineWidth + })) : (this._strokeBorder(L, "rgb(0, 0, 0)", { + lineDashWidth: A + }), this._strokeBorder(L, "rgb(255, 255, 255)", { + lineDashWidth: A, + lineDashOffset: D + })), L.scale(1 / B, 1 / H); + }, + /** + * Render Crop-zone + * @private + * @override + */ + _render: function(L) { + this.callSuper("_render", L), this._renderCropzone(L); + }, + /** + * Cropzone-coordinates with outer rectangle + * + * x0 x1 x2 x3 + * y0 +--------------------------+ + * |///////|//////////|///////| // <--- "Outer-rectangle" + * |///////|//////////|///////| + * y1 +-------+----------+-------+ + * |///////| Cropzone |///////| Cropzone is the "Inner-rectangle" + * |///////| (0, 0) |///////| Center point (0, 0) + * y2 +-------+----------+-------+ + * |///////|//////////|///////| + * |///////|//////////|///////| + * y3 +--------------------------+ + * + * @typedef {{x: Array, y: Array}} cropzoneCoordinates + * @ignore + */ + /** + * Fill outer rectangle + * @param {CanvasRenderingContext2D} ctx - Context + * @param {string|CanvasGradient|CanvasPattern} fillStyle - Fill-style + * @private + */ + _fillOuterRect: function(L, A) { + var D = this._getCoordinates(), I = D.x, k = D.y; + L.save(), L.fillStyle = A, L.beginPath(), L.moveTo(I[0] - 1, k[0] - 1), L.lineTo(I[3] + 1, k[0] - 1), L.lineTo(I[3] + 1, k[3] + 1), L.lineTo(I[0] - 1, k[3] + 1), L.lineTo(I[0] - 1, k[0] - 1), L.closePath(), L.moveTo(I[1], k[1]), L.lineTo(I[1], k[2]), L.lineTo(I[2], k[2]), L.lineTo(I[2], k[1]), L.lineTo(I[1], k[1]), L.closePath(), ze()(L).call(L), L.restore(); + }, + /** + * Draw Inner grid line + * @param {CanvasRenderingContext2D} ctx - Context + * @private + */ + _fillInnerRect: function(L) { + var A = this._getCoordinates(), D = A.x, I = A.y, k = this._caculateInnerPosition(D, (D[2] - D[1]) / 3), B = this._caculateInnerPosition(I, (I[2] - I[1]) / 3); + L.save(), L.strokeStyle = "rgba(255, 255, 255, 0.7)", L.lineWidth = this.options.lineWidth, L.beginPath(), L.moveTo(k[0], B[1]), L.lineTo(k[3], B[1]), L.moveTo(k[0], B[2]), L.lineTo(k[3], B[2]), L.moveTo(k[1], B[0]), L.lineTo(k[1], B[3]), L.moveTo(k[2], B[0]), L.lineTo(k[2], B[3]), L.stroke(), L.closePath(), L.restore(); + }, + /** + * Calculate Inner Position + * @param {Array} outer - outer position + * @param {number} size - interval for calculate + * @returns {Array} - inner position + * @private + */ + _caculateInnerPosition: function(L, A) { + var D = []; + return D[0] = L[1], D[1] = L[1] + A, D[2] = L[1] + A * 2, D[3] = L[2], D; + }, + /** + * Get coordinates + * @returns {cropzoneCoordinates} - {@link cropzoneCoordinates} + * @private + */ + _getCoordinates: function() { + var L, A, D = this.canvas, I = this.width, k = this.height, B = this.left, H = this.top, Y = I / 2, W = k / 2, q = D.getHeight(), ie = D.getWidth(); + return { + x: Er()(L = [ + -(Y + B), + // x0 + -Y, + // x1 + Y, + // x2 + Y + (ie - B - I) + // x3 + ]).call(L, Math.ceil), + y: Er()(A = [ + -(W + H), + // y0 + -W, + // y1 + W, + // y2 + W + (q - H - k) + // y3 + ]).call(A, Math.ceil) + }; + }, + /** + * Stroke border + * @param {CanvasRenderingContext2D} ctx - Context + * @param {string|CanvasGradient|CanvasPattern} strokeStyle - Stroke-style + * @param {number} lineDashWidth - Dash width + * @param {number} [lineDashOffset] - Dash offset + * @param {number} [lineWidth] - line width + * @private + */ + _strokeBorder: function(L, A, D) { + var I = D.lineDashWidth, k = D.lineDashOffset, B = D.lineWidth, H = this.width / 2, Y = this.height / 2; + L.save(), L.strokeStyle = A, L.setLineDash && L.setLineDash([I, I]), k && (L.lineDashOffset = k), B && (L.lineWidth = B), L.beginPath(), L.moveTo(-H, -Y), L.lineTo(H, -Y), L.lineTo(H, Y), L.lineTo(-H, Y), L.lineTo(-H, -Y), L.stroke(), L.restore(); + }, + /** + * onMoving event listener + * @private + */ + _onMoving: function() { + var L = this.height, A = this.width, D = this.left, I = this.top, k = this.canvas.getWidth() - A, B = this.canvas.getHeight() - L; + this.left = Dt(D, 0, k), this.top = Dt(I, 0, B), this.canvasEventTrigger[Re.OBJECT_MOVED](this); + }, + /** + * onScaling event listener + * @param {{e: MouseEvent}} fEvent - Fabric event + * @private + */ + _onScaling: function(L) { + var A = L.transform.corner, D = this.canvas.getPointer(L.e), I = this._calcScalingSizeFromPointer(D, A); + this.scale(1).set(I), this.canvasEventTrigger[Re.OBJECT_SCALED](this); + }, + /** + * Calc scaled size from mouse pointer with selected corner + * @param {{x: number, y: number}} pointer - Mouse position + * @param {string} selectedCorner - selected corner type + * @returns {Object} Having left or(and) top or(and) width or(and) height. + * @private + */ + _calcScalingSizeFromPointer: function(L, A) { + var D = km(A); + return D && this._resizeCropZone(L, A); + }, + /** + * Align with cropzone ratio + * @param {number} width - cropzone width + * @param {number} height - cropzone height + * @param {number} maxWidth - limit max width + * @param {number} maxHeight - limit max height + * @param {number} scaleTo - cropzone ratio + * @returns {{width: number, height: number}} + * @private + */ + adjustRatioCropzoneSize: function(L) { + var A = L.width, D = L.height, I = L.leftMaker, k = L.topMaker, B = L.maxWidth, H = L.maxHeight, Y = L.scaleTo; + if (A = B ? Dt(A, 1, B) : A, D = H ? Dt(D, 1, H) : D, !this.presetRatio) + return this._withShiftKey && (A > D ? D = A : D > A && (A = D)), { + width: A, + height: D, + left: I(A), + top: k(D) + }; + Y === "width" ? D = A / this.presetRatio : A = D * this.presetRatio; + var W = Math.min(B / A, H / D); + if (W <= 1) { + var q, ie = Er()(q = [A, D]).call(q, function(Ce) { + return Ce * W; + }), Se = we(ie, 2); + A = Se[0], D = Se[1]; + } + return { + width: A, + height: D, + left: I(A), + top: k(D) + }; + }, + /** + * Get dimension last state cropzone + * @returns {{rectTop: number, rectLeft: number, rectWidth: number, rectHeight: number}} + * @private + */ + _getCropzoneRectInfo: function() { + var L = this.canvas, A = L.width, D = L.height, I = this.getBoundingRect(!1, !0), k = I.top, B = I.left, H = I.width, Y = I.height; + return { + rectTop: k, + rectLeft: B, + rectWidth: H, + rectHeight: Y, + rectRight: B + H, + rectBottom: k + Y, + canvasWidth: A, + canvasHeight: D + }; + }, + /** + * Calc scaling dimension + * @param {Object} position - Mouse position + * @param {string} corner - corner type + * @returns {{left: number, top: number, width: number, height: number}} + * @private + */ + _resizeCropZone: function(L, A) { + var D = L.x, I = L.y, k = this._getCropzoneRectInfo(), B = k.rectWidth, H = k.rectHeight, Y = k.rectTop, W = k.rectLeft, q = k.rectBottom, ie = k.rectRight, Se = k.canvasWidth, Ce = k.canvasHeight, De = { + tl: { + width: ie - D, + height: q - I, + leftMaker: function(Le) { + return ie - Le; + }, + topMaker: function(Le) { + return q - Le; + }, + maxWidth: ie, + maxHeight: q, + scaleTo: gs(W - D, Y - I) + }, + tr: { + width: D - W, + height: q - I, + leftMaker: function() { + return W; + }, + topMaker: function(Le) { + return q - Le; + }, + maxWidth: Se - W, + maxHeight: q, + scaleTo: gs(D - ie, Y - I) + }, + mt: { + width: B, + height: q - I, + leftMaker: function() { + return W; + }, + topMaker: function(Le) { + return q - Le; + }, + maxWidth: Se - W, + maxHeight: q, + scaleTo: "height" + }, + ml: { + width: ie - D, + height: H, + leftMaker: function(Le) { + return ie - Le; + }, + topMaker: function() { + return Y; + }, + maxWidth: ie, + maxHeight: Ce - Y, + scaleTo: "width" + }, + mr: { + width: D - W, + height: H, + leftMaker: function() { + return W; + }, + topMaker: function() { + return Y; + }, + maxWidth: Se - W, + maxHeight: Ce - Y, + scaleTo: "width" + }, + mb: { + width: B, + height: I - Y, + leftMaker: function() { + return W; + }, + topMaker: function() { + return Y; + }, + maxWidth: Se - W, + maxHeight: Ce - Y, + scaleTo: "height" + }, + bl: { + width: ie - D, + height: I - Y, + leftMaker: function(Le) { + return ie - Le; + }, + topMaker: function() { + return Y; + }, + maxWidth: ie, + maxHeight: Ce - Y, + scaleTo: gs(W - D, I - q) + }, + br: { + width: D - W, + height: I - Y, + leftMaker: function() { + return W; + }, + topMaker: function() { + return Y; + }, + maxWidth: Se - W, + maxHeight: Ce - Y, + scaleTo: gs(D - ie, I - q) + } + }; + return this.adjustRatioCropzoneSize(De[A]); + }, + /** + * Return the whether this cropzone is valid + * @returns {boolean} + */ + isValid: function() { + return this.left >= 0 && this.top >= 0 && this.width > 0 && this.height > 0; + }, + /** + * Keydown event handler + * @param {{number}} keyCode - Event keyCode + * @private + */ + _onKeyDown: function(L) { + var A = L.keyCode; + A === Vt.SHIFT && (this._withShiftKey = !0); + }, + /** + * Keyup event handler + * @param {{number}} keyCode - Event keyCode + * @private + */ + _onKeyUp: function(L) { + var A = L.keyCode; + A === Vt.SHIFT && (this._withShiftKey = !1); + } + } + ), Lm = Om; + function Tv(V) { + var L = Pm(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Pm() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Iv = 10, Po = { + presetRatio: null, + top: -10, + left: -10, + height: 1, + width: 1 + }, wf = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Tv(A); + function A(D) { + var I, k, B, H, Y, W; + return G(this, A), W = L.call(this, tt.CROPPER, D), W._cropzone = null, W._startX = null, W._startY = null, W._withShiftKey = !1, W._listeners = { + keydown: ne()(I = W._onKeyDown).call(I, Cr(W)), + keyup: ne()(k = W._onKeyUp).call(k, Cr(W)), + mousedown: ne()(B = W._onFabricMouseDown).call(B, Cr(W)), + mousemove: ne()(H = W._onFabricMouseMove).call(H, Cr(W)), + mouseup: ne()(Y = W._onFabricMouseUp).call(Y, Cr(W)) + }, W; + } + return ee(A, [{ + key: "start", + value: function() { + if (!this._cropzone) { + var I = this.getCanvas(); + I.forEachObject(function(k) { + k.evented = !1; + }), this._cropzone = new Lm(I, te()({ + left: 0, + top: 0, + width: 0.5, + height: 0.5, + strokeWidth: 0, + // {@link https://github.com/kangax/fabric.js/issues/2860} + cornerSize: 10, + cornerColor: "black", + fill: "transparent" + }, cn, this.graphics.cropSelectionStyle)), I.discardActiveObject(), I.add(this._cropzone), I.on("mouse:down", this._listeners.mousedown), I.selection = !1, I.defaultCursor = "crosshair", de.fabric.util.addListener(document, "keydown", this._listeners.keydown), de.fabric.util.addListener(document, "keyup", this._listeners.keyup); + } + } + /** + * End cropping + */ + }, { + key: "end", + value: function() { + var I = this.getCanvas(), k = this._cropzone; + k && (I.remove(k), I.selection = !0, I.defaultCursor = "default", I.off("mouse:down", this._listeners.mousedown), I.forEachObject(function(B) { + B.evented = !0; + }), this._cropzone = null, de.fabric.util.removeListener(document, "keydown", this._listeners.keydown), de.fabric.util.removeListener(document, "keyup", this._listeners.keyup)); + } + /** + * Change cropzone visible + * @param {boolean} visible - cropzone visible state + */ + }, { + key: "changeVisibility", + value: function(I) { + this._cropzone && this._cropzone.set({ + visible: I + }); + } + /** + * onMousedown handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onFabricMouseDown", + value: function(I) { + var k = this.getCanvas(); + if (!I.target) { + k.selection = !1; + var B = k.getPointer(I.e); + this._startX = B.x, this._startY = B.y, k.on({ + "mouse:move": this._listeners.mousemove, + "mouse:up": this._listeners.mouseup + }); + } + } + /** + * onMousemove handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onFabricMouseMove", + value: function(I) { + var k = this.getCanvas(), B = k.getPointer(I.e), H = B.x, Y = B.y, W = this._cropzone; + Math.abs(H - this._startX) + Math.abs(Y - this._startY) > Iv && (k.remove(W), W.set(this._calcRectDimensionFromPoint(H, Y, W.presetRatio)), k.add(W), k.setActiveObject(W)); + } + /** + * Get rect dimension setting from Canvas-Mouse-Position(x, y) + * @param {number} x - Canvas-Mouse-Position x + * @param {number} y - Canvas-Mouse-Position Y + * @param {number|null} presetRatio - fixed aspect ratio (width/height) of the cropzone (null if not set) + * @returns {{left: number, top: number, width: number, height: number}} + * @private + */ + }, { + key: "_calcRectDimensionFromPoint", + value: function(I, k) { + var B = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, H = this.getCanvas(), Y = H.getWidth(), W = H.getHeight(), q = this._startX, ie = this._startY, Se = Dt(I, 0, q), Ce = Dt(k, 0, ie), De = Dt(I, q, Y) - Se, Ee = Dt(k, ie, W) - Ce; + return this._withShiftKey && !B ? (De > Ee ? Ee = De : Ee > De && (De = Ee), q >= I && (Se = q - De), ie >= k && (Ce = ie - Ee)) : B && (Ee = De / B, q >= I && (Se = Dt(q - De, 0, Y)), ie >= k && (Ce = Dt(ie - Ee, 0, W)), Ce + Ee > W && (Ee = W - Ce, De = Ee * B, q >= I && (Se = Dt(q - De, 0, Y)), ie >= k && (Ce = Dt(ie - Ee, 0, W)))), { + left: Se, + top: Ce, + width: De, + height: Ee + }; + } + /** + * onMouseup handler in fabric canvas + * @private + */ + }, { + key: "_onFabricMouseUp", + value: function() { + var I = this._cropzone, k = this._listeners, B = this.getCanvas(); + B.setActiveObject(I), B.off({ + "mouse:move": k.mousemove, + "mouse:up": k.mouseup + }); + } + /** + * Get cropped image data + * @param {Object} cropRect cropzone rect + * @param {Number} cropRect.left left position + * @param {Number} cropRect.top top position + * @param {Number} cropRect.width width + * @param {Number} cropRect.height height + * @returns {?{imageName: string, url: string}} cropped Image data + */ + }, { + key: "getCroppedImageData", + value: function(I) { + var k = this.getCanvas(), B = k.contains(this._cropzone); + if (!I) + return null; + B && k.remove(this._cropzone); + var H = { + imageName: this.getImageName(), + url: k.toDataURL(I) + }; + return B && k.add(this._cropzone), H; + } + /** + * Get cropped rect + * @returns {Object} rect + */ + }, { + key: "getCropzoneRect", + value: function() { + var I = this._cropzone; + return I.isValid() ? { + left: I.left, + top: I.top, + width: I.width, + height: I.height + } : null; + } + /** + * Set a cropzone square + * @param {number} [presetRatio] - preset ratio + */ + }, { + key: "setCropzoneRect", + value: function(I) { + var k = this.getCanvas(), B = this._cropzone; + k.discardActiveObject(), k.selection = !1, k.remove(B), B.set(I ? this._getPresetPropertiesForCropSize(I) : Po), k.add(B), k.selection = !0, I && k.setActiveObject(B); + } + /** + * get a cropzone square info + * @param {number} presetRatio - preset ratio + * @returns {{presetRatio: number, left: number, top: number, width: number, height: number}} + * @private + */ + }, { + key: "_getPresetPropertiesForCropSize", + value: function(I) { + var k, B, H = this.getCanvas(), Y = H.getWidth(), W = H.getHeight(), q = Y >= W ? Y : W, ie = function(dt, on) { + return dt > on ? on / dt : 1; + }, Se = q * I, Ce = q, De = ie(Se, Y), Ee = Er()(k = [Se, Ce]).call(k, function(Xt) { + return Xt * De; + }), Le = we(Ee, 2); + Se = Le[0], Ce = Le[1]; + var rt = ie(Ce, W), Pt = Er()(B = [Se, Ce]).call(B, function(Xt) { + return ss(Xt * rt); + }), zt = we(Pt, 2); + return Se = zt[0], Ce = zt[1], { + presetRatio: I, + top: (W - Ce) / 2, + left: (Y - Se) / 2, + width: Se, + height: Ce + }; + } + /** + * Keydown event handler + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_onKeyDown", + value: function(I) { + I.keyCode === Vt.SHIFT && (this._withShiftKey = !0); + } + /** + * Keyup event handler + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_onKeyUp", + value: function(I) { + I.keyCode === Vt.SHIFT && (this._withShiftKey = !1); + } + }]), A; + }(er), Lc = wf; + function Av(V) { + var L = Ev(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Ev() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Pc = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Av(A); + function A(D) { + return G(this, A), L.call(this, tt.FLIP, D); + } + return ee(A, [{ + key: "getCurrentSetting", + value: function() { + var I = this.getCanvasImage(); + return { + flipX: I.flipX, + flipY: I.flipY + }; + } + /** + * Set flipX, flipY + * @param {{flipX: Boolean, flipY: Boolean}} newSetting - Flip setting + * @returns {Promise} + */ + }, { + key: "set", + value: function(I) { + var k = this.getCurrentSetting(), B = k.flipX !== I.flipX, H = k.flipY !== I.flipY; + return !B && !H ? xe().reject(wt.flip) : (te()(k, I), this.setImageProperties(k, !0), this._invertAngle(B, H), this._flipObjects(B, H), xe().resolve({ + flipX: k.flipX, + flipY: k.flipY, + angle: this.getCanvasImage().angle + })); + } + /** + * Invert image angle for flip + * @param {boolean} isChangingFlipX - Change flipX + * @param {boolean} isChangingFlipY - Change flipY + */ + }, { + key: "_invertAngle", + value: function(I, k) { + var B = this.getCanvasImage(), H = B.angle; + I && (H *= -1), k && (H *= -1), B.rotate(Ba()(H)).setCoords(); + } + /** + * Flip objects + * @param {boolean} isChangingFlipX - Change flipX + * @param {boolean} isChangingFlipY - Change flipY + * @private + */ + }, { + key: "_flipObjects", + value: function(I, k) { + var B = this.getCanvas(); + I && B.forEachObject(function(H) { + H.set({ + angle: Ba()(H.angle * -1), + // parseFloat for -0 to 0 + flipX: !H.flipX, + left: B.width - H.left + }).setCoords(); + }), k && B.forEachObject(function(H) { + H.set({ + angle: Ba()(H.angle * -1), + // parseFloat for -0 to 0 + flipY: !H.flipY, + top: B.height - H.top + }).setCoords(); + }), B.renderAll(); + } + /** + * Reset flip settings + * @returns {Promise} + */ + }, { + key: "reset", + value: function() { + return this.set({ + flipX: !1, + flipY: !1 + }); + } + /** + * Flip x + * @returns {Promise} + */ + }, { + key: "flipX", + value: function() { + var I = this.getCurrentSetting(); + return this.set({ + flipX: !I.flipX, + flipY: I.flipY + }); + } + /** + * Flip y + * @returns {Promise} + */ + }, { + key: "flipY", + value: function() { + var I = this.getCurrentSetting(); + return this.set({ + flipX: I.flipX, + flipY: !I.flipY + }); + } + }]), A; + }(er), Cf = Pc; + function Tf(V) { + var L = Rc(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Rc() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var wu = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Tf(A); + function A(D) { + return G(this, A), L.call(this, tt.ROTATION, D); + } + return ee(A, [{ + key: "getCurrentAngle", + value: function() { + return this.getCanvasImage().angle; + } + /** + * Set angle of the image + * + * Do not call "this.setImageProperties" for setting angle directly. + * Before setting angle, The originX,Y of image should be set to center. + * See "http://fabricjs.com/docs/fabric.Object.html#setAngle" + * + * @param {number} angle - Angle value + * @returns {Promise} + */ + }, { + key: "setAngle", + value: function(I) { + var k = this.getCurrentAngle() % 360; + I %= 360; + var B = this.getCanvasImage(), H = B.getCenterPoint(); + B.set({ + angle: I + }).setCoords(), this.adjustCanvasDimension(); + var Y = B.getCenterPoint(); + return this._rotateForEachObject(H, Y, I - k), xe().resolve(I); + } + /** + * Rotate for each object + * @param {fabric.Point} oldImageCenter - Image center point before rotation + * @param {fabric.Point} newImageCenter - Image center point after rotation + * @param {number} angleDiff - Image angle difference after rotation + * @private + */ + }, { + key: "_rotateForEachObject", + value: function(I, k, B) { + var H = this.getCanvas(), Y = { + x: I.x - k.x, + y: I.y - k.y + }; + H.forEachObject(function(W) { + var q = W.getCenterPoint(), ie = de.fabric.util.degreesToRadians(B), Se = de.fabric.util.rotatePoint(q, I, ie); + W.set({ + left: Se.x - Y.x, + top: Se.y - Y.y, + angle: (W.angle + B) % 360 + }), W.setCoords(); + }), H.renderAll(); + } + /** + * Rotate the image + * @param {number} additionalAngle - Additional angle + * @returns {Promise} + */ + }, { + key: "rotate", + value: function(I) { + var k = this.getCurrentAngle(); + return this.setAngle(k + I); + } + }]), A; + }(er), ms = wu; + function Nc(V) { + var L = Rl(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Rl() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var If = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Nc(A); + function A(D) { + var I; + return G(this, A), I = L.call(this, tt.FREE_DRAWING, D), I.width = 12, I.oColor = new de.fabric.Color("rgba(0, 0, 0, 0.5)"), I; + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = this.getCanvas(); + k.isDrawingMode = !0, this.setBrush(I); + } + /** + * Set brush + * @param {{width: ?number, color: ?string}} [setting] - Brush width & color + */ + }, { + key: "setBrush", + value: function(I) { + var k = this.getCanvas().freeDrawingBrush; + I = I || {}, this.width = I.width || this.width, I.color && (this.oColor = new de.fabric.Color(I.color)), k.width = this.width, k.color = this.oColor.toRgba(); + } + /** + * End free drawing mode + */ + }, { + key: "end", + value: function() { + var I = this.getCanvas(); + I.isDrawingMode = !1; + } + }]), A; + }(er), Mv = If, Cu = 30, Rm = 2.7, vo = 1.7, Af = 180, Dv = de.fabric.util.createClass( + de.fabric.Line, + /** @lends Convolute.prototype */ + { + /** + * Line type + * @param {String} type + * @default + */ + type: "line", + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + * @override + */ + initialize: function(L) { + var A = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + this.callSuper("initialize", L, A), this.arrowType = A.arrowType; + }, + /** + * Render ArrowLine + * @private + * @override + */ + _render: function(L) { + var A = this.calcLinePoints(), D = A.x1, I = A.y1, k = A.x2, B = A.y2, H = { + fromX: D, + fromY: I, + toX: k, + toY: B + }; + this.ctx = L, L.lineWidth = this.strokeWidth, this._renderBasicLinePath(H), this._drawDecoratorPath(H), this._renderStroke(L); + }, + /** + * Render Basic line path + * @param {Object} linePosition - line position + * @param {number} option.fromX - line start position x + * @param {number} option.fromY - line start position y + * @param {number} option.toX - line end position x + * @param {number} option.toY - line end position y + * @private + */ + _renderBasicLinePath: function(L) { + var A = L.fromX, D = L.fromY, I = L.toX, k = L.toY; + this.ctx.beginPath(), this.ctx.moveTo(A, D), this.ctx.lineTo(I, k); + }, + /** + * Render Arrow Head + * @param {Object} linePosition - line position + * @param {number} option.fromX - line start position x + * @param {number} option.fromY - line start position y + * @param {number} option.toX - line end position x + * @param {number} option.toY - line end position y + * @private + */ + _drawDecoratorPath: function(L) { + this._drawDecoratorPathType("head", L), this._drawDecoratorPathType("tail", L); + }, + /** + * Render Arrow Head + * @param {string} type - 'head' or 'tail' + * @param {Object} linePosition - line position + * @param {number} option.fromX - line start position x + * @param {number} option.fromY - line start position y + * @param {number} option.toX - line end position x + * @param {number} option.toY - line end position y + * @private + */ + _drawDecoratorPathType: function(L, A) { + switch (this.arrowType[L]) { + case "triangle": + this._drawTrianglePath(L, A); + break; + case "chevron": + this._drawChevronPath(L, A); + break; + } + }, + /** + * Render Triangle Head + * @param {string} type - 'head' or 'tail' + * @param {Object} linePosition - line position + * @param {number} option.fromX - line start position x + * @param {number} option.fromY - line start position y + * @param {number} option.toX - line end position x + * @param {number} option.toY - line end position y + * @private + */ + _drawTrianglePath: function(L, A) { + var D = this.ctx.lineWidth * vo; + this._drawChevronPath(L, A, D), this.ctx.closePath(); + }, + /** + * Render Chevron Head + * @param {string} type - 'head' or 'tail' + * @param {Object} linePosition - line position + * @param {number} option.fromX - line start position x + * @param {number} option.fromY - line start position y + * @param {number} option.toX - line end position x + * @param {number} option.toY - line end position y + * @param {number} decorateSize - decorate size + * @private + */ + _drawChevronPath: function(L, A, D) { + var I = this, k = A.fromX, B = A.fromY, H = A.toX, Y = A.toY, W = this.ctx; + D || (D = this.ctx.lineWidth * Rm); + var q = L === "head" ? [k, B] : [H, Y], ie = we(q, 2), Se = ie[0], Ce = ie[1], De = L === "head" ? [H, Y] : [k, B], Ee = we(De, 2), Le = Ee[0], rt = Ee[1], Pt = Math.atan2(rt - Ce, Le - Se) * Af / Math.PI, zt = function(dt) { + return I.getRotatePosition(D, dt, { + x: Se, + y: Ce + }); + }; + W.moveTo.apply(W, F(zt(Pt + Cu))), W.lineTo(Se, Ce), W.lineTo.apply(W, F(zt(Pt - Cu))); + }, + /** + * return position from change angle. + * @param {number} distance - change distance + * @param {number} angle - change angle + * @param {Object} referencePosition - reference position + * @returns {Array} + * @private + */ + getRotatePosition: function(L, A, D) { + var I = A * Math.PI / Af, k = D.x, B = D.y; + return [L * Math.cos(I) + k, L * Math.sin(I) + B]; + } + } + ), Tu = Dv; + function Nm(V) { + var L = zm(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function zm() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Iu = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Nm(A); + function A(D) { + var I, k, B, H; + return G(this, A), H = L.call(this, tt.LINE, D), H._width = 12, H._oColor = new de.fabric.Color("rgba(0, 0, 0, 0.5)"), H._listeners = { + mousedown: ne()(I = H._onFabricMouseDown).call(I, Cr(H)), + mousemove: ne()(k = H._onFabricMouseMove).call(k, Cr(H)), + mouseup: ne()(B = H._onFabricMouseUp).call(B, Cr(H)) + }, H; + } + return ee(A, [{ + key: "setHeadOption", + value: function(I) { + var k = I.arrowType, B = k === void 0 ? { + head: null, + tail: null + } : k; + this._arrowType = B; + } + /** + * Start drawing line mode + * @param {{width: ?number, color: ?string}} [setting] - Brush width & color + */ + }, { + key: "start", + value: function() { + var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, k = this.getCanvas(); + k.defaultCursor = "crosshair", k.selection = !1, this.setHeadOption(I), this.setBrush(I), k.forEachObject(function(B) { + B.set({ + evented: !1 + }); + }), k.on({ + "mouse:down": this._listeners.mousedown + }); + } + /** + * Set brush + * @param {{width: ?number, color: ?string}} [setting] - Brush width & color + */ + }, { + key: "setBrush", + value: function(I) { + var k = this.getCanvas().freeDrawingBrush; + I = I || {}, this._width = I.width || this._width, I.color && (this._oColor = new de.fabric.Color(I.color)), k.width = this._width, k.color = this._oColor.toRgba(); + } + /** + * End drawing line mode + */ + }, { + key: "end", + value: function() { + var I = this.getCanvas(); + I.defaultCursor = "default", I.selection = !0, I.forEachObject(function(k) { + k.set({ + evented: !0 + }); + }), I.off("mouse:down", this._listeners.mousedown); + } + /** + * Mousedown event handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseDown", + value: function(I) { + var k = this.getCanvas(), B = k.getPointer(I.e), H = B.x, Y = B.y, W = [H, Y, H, Y]; + this._line = new Tu(W, { + stroke: this._oColor.toRgba(), + strokeWidth: this._width, + arrowType: this._arrowType, + evented: !1 + }), this._line.set(wi.SELECTION_STYLE), k.add(this._line), k.on({ + "mouse:move": this._listeners.mousemove, + "mouse:up": this._listeners.mouseup + }), this.fire(Re.ADD_OBJECT, this._createLineEventObjectProperties()); + } + /** + * Mousemove event handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseMove", + value: function(I) { + var k = this.getCanvas(), B = k.getPointer(I.e); + this._line.set({ + x2: B.x, + y2: B.y + }), this._line.setCoords(), k.renderAll(); + } + /** + * Mouseup event handler in fabric canvas + * @private + */ + }, { + key: "_onFabricMouseUp", + value: function() { + var I = this.getCanvas(); + this.fire(Re.OBJECT_ADDED, this._createLineEventObjectProperties()), this._line = null, I.off({ + "mouse:move": this._listeners.mousemove, + "mouse:up": this._listeners.mouseup + }); + } + /** + * create line event object properties + * @returns {Object} properties line object + * @private + */ + }, { + key: "_createLineEventObjectProperties", + value: function() { + var I = this.graphics.createObjectProperties(this._line), k = this._line, B = k.x1, H = k.x2, Y = k.y1, W = k.y2; + return te()({}, I, { + startPosition: { + x: B, + y: Y + }, + endPosition: { + x: H, + y: W + } + }); + } + }]), A; + }(er), Ef = Iu; + function Bm(V) { + var L = kv(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function kv() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Au = { + fill: "#000000", + left: 0, + top: 0 + }, Ro = { + fill: "#000000", + fontStyle: "normal", + fontWeight: "normal", + textAlign: "tie-text-align-left", + underline: !1 + }, Hx = 500, Ov = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Bm(A); + function A(D) { + var I, k, B, H, Y, W; + return G(this, A), W = L.call(this, tt.TEXT, D), W._defaultStyles = Au, W._isSelected = !1, W._selectedObj = {}, W._editingObj = {}, W._listeners = { + mousedown: ne()(I = W._onFabricMouseDown).call(I, Cr(W)), + select: ne()(k = W._onFabricSelect).call(k, Cr(W)), + selectClear: ne()(B = W._onFabricSelectClear).call(B, Cr(W)), + scaling: ne()(H = W._onFabricScaling).call(H, Cr(W)), + textChanged: ne()(Y = W._onFabricTextChanged).call(Y, Cr(W)) + }, W._textarea = null, W._ratio = 1, W._lastClickTime = (/* @__PURE__ */ new Date()).getTime(), W._editingObjInfos = {}, W.isPrevEditing = !1, W; + } + return ee(A, [{ + key: "start", + value: function() { + var I = this, k = this.getCanvas(); + k.selection = !1, k.defaultCursor = "text", k.on({ + "mouse:down": this._listeners.mousedown, + "selection:created": this._listeners.select, + "selection:updated": this._listeners.select, + "before:selection:cleared": this._listeners.selectClear, + "object:scaling": this._listeners.scaling, + "text:changed": this._listeners.textChanged + }), k.forEachObject(function(B) { + B.type === "i-text" && I.adjustOriginPosition(B, "start"); + }), this.setCanvasRatio(); + } + /** + * End input text mode + */ + }, { + key: "end", + value: function() { + var I = this, k = this.getCanvas(); + k.selection = !0, k.defaultCursor = "default", k.forEachObject(function(B) { + B.type === "i-text" && (B.text === "" ? k.remove(B) : I.adjustOriginPosition(B, "end")); + }), k.off({ + "mouse:down": this._listeners.mousedown, + "selection:created": this._listeners.select, + "selection:updated": this._listeners.select, + "before:selection:cleared": this._listeners.selectClear, + "object:selected": this._listeners.select, + "object:scaling": this._listeners.scaling, + "text:changed": this._listeners.textChanged + }); + } + /** + * Adjust the origin position + * @param {fabric.Object} text - text object + * @param {string} editStatus - 'start' or 'end' + */ + }, { + key: "adjustOriginPosition", + value: function(I, k) { + var B = "center", H = "center"; + k === "start" && (B = "left", H = "top"); + var Y = I.getPointByOrigin(B, H), W = Y.x, q = Y.y; + I.set({ + left: W, + top: q, + originX: B, + originY: H + }), I.setCoords(); + } + /** + * Add new text on canvas image + * @param {string} text - Initial input text + * @param {Object} options - Options for generating text + * @param {Object} [options.styles] Initial styles + * @param {string} [options.styles.fill] Color + * @param {string} [options.styles.fontFamily] Font type for text + * @param {number} [options.styles.fontSize] Size + * @param {string} [options.styles.fontStyle] Type of inclination (normal / italic) + * @param {string} [options.styles.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [options.styles.textAlign] Type of text align (left / center / right) + * @param {string} [options.styles.textDecoration] Type of line (underline / line-through / overline) + * @param {{x: number, y: number}} [options.position] - Initial position + * @returns {Promise} + */ + }, { + key: "add", + value: function(I, k) { + var B = this; + return new (xe())(function(H) { + var Y, W = B.getCanvas(), q = null, ie = wi.SELECTION_STYLE, Se = B._defaultStyles; + B._setInitPos(k.position), k.styles && (Se = te()(Se, k.styles)), wm()(k.autofocus) || (k.autofocus = !0), q = new de.fabric.IText(I, Se), ie = te()({}, ie, { + originX: "left", + originY: "top" + }), q.set(ie), q.on({ + mouseup: ne()(Y = B._onFabricMouseUp).call(Y, B) + }), W.add(q), k.autofocus && (q.enterEditing(), q.selectAll()), W.getActiveObject() || W.setActiveObject(q), B.isPrevEditing = !0, H(B.graphics.createObjectProperties(q)); + }); + } + /** + * Change text of activate object on canvas image + * @param {Object} activeObj - Current selected text object + * @param {string} text - Changed text + * @returns {Promise} + */ + }, { + key: "change", + value: function(I, k) { + var B = this; + return new (xe())(function(H) { + I.set("text", k), B.getCanvas().renderAll(), H(); + }); + } + /** + * Set style + * @param {Object} activeObj - Current selected text object + * @param {Object} styleObj - Initial styles + * @param {string} [styleObj.fill] Color + * @param {string} [styleObj.fontFamily] Font type for text + * @param {number} [styleObj.fontSize] Size + * @param {string} [styleObj.fontStyle] Type of inclination (normal / italic) + * @param {string} [styleObj.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [styleObj.textAlign] Type of text align (left / center / right) + * @param {string} [styleObj.textDecoration] Type of line (underline / line-through / overline) + * @returns {Promise} + */ + }, { + key: "setStyle", + value: function(I, k) { + var B = this; + return new (xe())(function(H) { + le()(k, function(Y, W) { + I[W] === Y && W !== "fontSize" && (k[W] = Ro[W] || ""); + }, B), "textDecoration" in k && te()(k, B._getTextDecorationAdaptObject(k.textDecoration)), I.set(k), B.getCanvas().renderAll(), H(); + }); + } + /** + * Get the text + * @param {Object} activeObj - Current selected text object + * @returns {String} text + */ + }, { + key: "getText", + value: function(I) { + return I.text; + } + /** + * Set infos of the current selected object + * @param {fabric.Text} obj - Current selected text object + * @param {boolean} state - State of selecting + */ + }, { + key: "setSelectedInfo", + value: function(I, k) { + this._selectedObj = I, this._isSelected = k; + } + /** + * Whether object is selected or not + * @returns {boolean} State of selecting + */ + }, { + key: "isSelected", + value: function() { + return this._isSelected; + } + /** + * Get current selected text object + * @returns {fabric.Text} Current selected text object + */ + }, { + key: "getSelectedObj", + value: function() { + return this._selectedObj; + } + /** + * Set ratio value of canvas + */ + }, { + key: "setCanvasRatio", + value: function() { + var I = this.getCanvasElement(), k = Me()(I.style.maxWidth, 10), B = I.width; + this._ratio = B / k; + } + /** + * Get ratio value of canvas + * @returns {number} Ratio value + */ + }, { + key: "getCanvasRatio", + value: function() { + return this._ratio; + } + /** + * Get text decoration adapt object + * @param {string} textDecoration - text decoration option string + * @returns {object} adapt object for override + */ + }, { + key: "_getTextDecorationAdaptObject", + value: function(I) { + return { + underline: I === "underline", + linethrough: I === "line-through", + overline: I === "overline" + }; + } + /** + * Set initial position on canvas image + * @param {{x: number, y: number}} [position] - Selected position + * @private + */ + }, { + key: "_setInitPos", + value: function(I) { + I = I || this.getCanvasImage().getCenterPoint(), this._defaultStyles.left = I.x, this._defaultStyles.top = I.y; + } + /** + * Input event handler + * @private + */ + }, { + key: "_onInput", + value: function() { + var I = this.getCanvasRatio(), k = this._editingObj, B = this._textarea.style; + B.width = "".concat(Math.ceil(k.width / I), "px"), B.height = "".concat(Math.ceil(k.height / I), "px"); + } + /** + * Keydown event handler + * @private + */ + }, { + key: "_onKeyDown", + value: function() { + var I = this, k = this.getCanvasRatio(), B = this._editingObj, H = this._textarea.style; + y()(function() { + B.text(I._textarea.value), H.width = "".concat(Math.ceil(B.width / k), "px"), H.height = "".concat(Math.ceil(B.height / k), "px"); + }, 0); + } + /** + * Blur event handler + * @private + */ + }, { + key: "_onBlur", + value: function() { + var I = this.getCanvasRatio(), k = this._editingObj, B = this._editingObjInfos, H = this._textarea.value, Y = k.width / I - B.width / I, W = k.height / I - B.height / I; + if (I === 1 && (Y /= 2, W /= 2), this._textarea.style.display = "none", k.set({ + left: B.left + Y, + top: B.top + W + }), H.length) { + this.getCanvas().add(k); + var q = { + id: Je(k), + type: k.type, + text: H + }; + this.fire(Re.TEXT_CHANGED, q); + } + } + /** + * Scroll event handler + * @private + */ + }, { + key: "_onScroll", + value: function() { + this._textarea.scrollLeft = 0, this._textarea.scrollTop = 0; + } + /** + * Fabric scaling event handler + * @param {fabric.Event} fEvent - Current scaling event on selected object + * @private + */ + }, { + key: "_onFabricScaling", + value: function(I) { + var k = I.target; + k.fontSize = k.fontSize * k.scaleY, k.scaleX = 1, k.scaleY = 1; + } + /** + * textChanged event handler + * @param {{target: fabric.Object}} props - changed text object + * @private + */ + }, { + key: "_onFabricTextChanged", + value: function(I) { + this.fire(Re.TEXT_CHANGED, I.target); + } + /** + * onSelectClear handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onFabricSelectClear", + value: function(I) { + var k = this.getSelectedObj(); + this.isPrevEditing = !0, this.setSelectedInfo(I.target, !1), k && k.text === "" && this.getCanvas().remove(k); + } + /** + * onSelect handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onFabricSelect", + value: function(I) { + this.isPrevEditing = !0, this.setSelectedInfo(I.target, !0); + } + /** + * Fabric 'mousedown' event handler + * @param {fabric.Event} fEvent - Current mousedown event on selected object + * @private + */ + }, { + key: "_onFabricMouseDown", + value: function(I) { + var k = I.target; + if (!(k && !k.isType("text"))) { + if (this.isPrevEditing) { + this.isPrevEditing = !1; + return; + } + this._fireAddText(I); + } + } + /** + * Fire 'addText' event if object is not selected. + * @param {fabric.Event} fEvent - Current mousedown event on selected object + * @private + */ + }, { + key: "_fireAddText", + value: function(I) { + var k = I.target, B = I.e || {}, H = this.getCanvas().getPointer(B); + k || this.fire(Re.ADD_TEXT, { + originPosition: { + x: H.x, + y: H.y + }, + clientPosition: { + x: B.clientX || 0, + y: B.clientY || 0 + } + }); + } + /** + * Fabric mouseup event handler + * @param {fabric.Event} fEvent - Current mousedown event on selected object + * @private + */ + }, { + key: "_onFabricMouseUp", + value: function(I) { + var k = I.target, B = (/* @__PURE__ */ new Date()).getTime(); + this._isDoubleClick(B) && !k.isEditing && k.enterEditing(), k.isEditing && this.fire(Re.TEXT_EDITING), this._lastClickTime = B; + } + /** + * Get state of firing double click event + * @param {Date} newClickTime - Current clicked time + * @returns {boolean} Whether double clicked or not + * @private + */ + }, { + key: "_isDoubleClick", + value: function(I) { + return I - this._lastClickTime < Hx; + } + }]), A; + }(er), ia = Ov; + function zc(V) { + var L = ys(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function ys() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Lv = { + arrow: "M 0 90 H 105 V 120 L 160 60 L 105 0 V 30 H 0 Z", + cancel: "M 0 30 L 30 60 L 0 90 L 30 120 L 60 90 L 90 120 L 120 90 L 90 60 L 120 30 L 90 0 L 60 30 L 30 0 Z" + }, _s = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = zc(A); + function A(D) { + var I, k, B, H; + return G(this, A), H = L.call(this, tt.ICON, D), H._oColor = "#000000", H._pathMap = Lv, H._type = null, H._iconColor = null, H._handlers = { + mousedown: ne()(I = H._onFabricMouseDown).call(I, Cr(H)), + mousemove: ne()(k = H._onFabricMouseMove).call(k, Cr(H)), + mouseup: ne()(B = H._onFabricMouseUp).call(B, Cr(H)) + }, H; + } + return ee(A, [{ + key: "setStates", + value: function(I, k) { + this._type = I, this._iconColor = k; + } + /** + * Start to draw the icon on canvas + * @ignore + */ + }, { + key: "start", + value: function() { + var I = this.getCanvas(); + I.selection = !1, I.on("mouse:down", this._handlers.mousedown); + } + /** + * End to draw the icon on canvas + * @ignore + */ + }, { + key: "end", + value: function() { + var I = this.getCanvas(); + I.selection = !0, I.off({ + "mouse:down": this._handlers.mousedown + }); + } + /** + * Add icon + * @param {string} type - Icon type + * @param {Object} options - Icon options + * @param {string} [options.fill] - Icon foreground color + * @param {string} [options.left] - Icon x position + * @param {string} [options.top] - Icon y position + * @returns {Promise} + */ + }, { + key: "add", + value: function(I, k) { + var B = this; + return new (xe())(function(H, Y) { + var W = B.getCanvas(), q = B._pathMap[I], ie = wi.SELECTION_STYLE, Se = q ? B._createIcon(q) : null; + B._icon = Se, Se || Y(wt.invalidParameters), Se.set(te()({ + type: "icon", + fill: B._oColor + }, ie, k, B.graphics.controlStyle)), W.add(Se).setActiveObject(Se), H(B.graphics.createObjectProperties(Se)); + }); + } + /** + * Register icon paths + * @param {{key: string, value: string}} pathInfos - Path infos + */ + }, { + key: "registerPaths", + value: function(I) { + var k = this; + le()(I, function(B, H) { + k._pathMap[H] = B; + }, this); + } + /** + * Set icon object color + * @param {string} color - Color to set + * @param {fabric.Path}[obj] - Current activated path object + */ + }, { + key: "setColor", + value: function(I, k) { + this._oColor = I, k && k.get("type") === "icon" && (k.set({ + fill: this._oColor + }), this.getCanvas().renderAll()); + } + /** + * Get icon color + * @param {fabric.Path}[obj] - Current activated path object + * @returns {string} color + */ + }, { + key: "getColor", + value: function(I) { + return ze()(I); + } + /** + * Create icon object + * @param {string} path - Path value to create icon + * @returns {fabric.Path} Path object + */ + }, { + key: "_createIcon", + value: function(I) { + return new de.fabric.Path(I); + } + /** + * MouseDown event handler on canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseDown", + value: function(I) { + var k = this, B = this.getCanvas(); + this._startPoint = B.getPointer(I.e); + var H = this._startPoint, Y = H.x, W = H.y; + this.add(this._type, { + left: Y, + top: W, + fill: this._iconColor + }).then(function() { + k.fire(Re.ADD_OBJECT, k.graphics.createObjectProperties(k._icon)), B.on("mouse:move", k._handlers.mousemove), B.on("mouse:up", k._handlers.mouseup); + }); + } + /** + * MouseMove event handler on canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseMove", + value: function(I) { + var k = this.getCanvas(); + if (this._icon) { + var B = k.getPointer(I.e), H = (B.x - this._startPoint.x) / this._icon.width, Y = (B.y - this._startPoint.y) / this._icon.height; + this._icon.set({ + scaleX: Math.abs(H * 2), + scaleY: Math.abs(Y * 2) + }), this._icon.setCoords(), k.renderAll(); + } + } + /** + * MouseUp event handler on canvas + * @private + */ + }, { + key: "_onFabricMouseUp", + value: function() { + var I = this.getCanvas(); + this.fire(Re.OBJECT_ADDED, this.graphics.createObjectProperties(this._icon)), this._icon = null, I.off("mouse:down", this._handlers.mousedown), I.off("mouse:move", this._handlers.mousemove), I.off("mouse:up", this._handlers.mouseup); + } + }]), A; + }(er), $n = _s, Vx = de.fabric.util.createClass( + de.fabric.Image.filters.BlendImage, + /** @lends Mask.prototype */ + { + /** + * Apply filter to canvas element + * @param {Object} pipelineState - Canvas element to apply filter + * @override + */ + applyTo: function(L) { + if (this.mask) { + var A = L.canvasEl, D = A.width, I = A.height, k = this._createCanvasOfMask(D, I), B = A.getContext("2d"), H = k.getContext("2d"), Y = B.getImageData(0, 0, D, I); + this._drawMask(H, A, B), this._mapData(H, Y, D, I), L.imageData = Y; + } + }, + /** + * Create canvas of mask image + * @param {number} width - Width of main canvas + * @param {number} height - Height of main canvas + * @returns {HTMLElement} Canvas element + * @private + */ + _createCanvasOfMask: function(L, A) { + var D = de.fabric.util.createCanvasElement(); + return D.width = L, D.height = A, D; + }, + /** + * Draw mask image on canvas element + * @param {Object} maskCtx - Context of mask canvas + * @private + */ + _drawMask: function(L) { + var A = this.mask, D = A.getElement(), I = A.angle, k = A.left, B = A.scaleX, H = A.scaleY, Y = A.top; + L.save(), L.translate(k, Y), L.rotate(I * Math.PI / 180), L.scale(B, H), L.drawImage(D, -D.width / 2, -D.height / 2), L.restore(); + }, + /** + * Map mask image data to source image data + * @param {Object} maskCtx - Context of mask canvas + * @param {Object} imageData - Data of source image + * @param {number} width - Width of main canvas + * @param {number} height - Height of main canvas + * @private + */ + _mapData: function(L, A, D, I) { + for (var k = A.data, B = A.height, H = A.width, Y = k, W = H * B * 4, q = L.getImageData(0, 0, D, I).data, ie = 0; ie < W; ie += 4) + Y[ie + 3] = q[ie]; + } + } + ), Pv = Vx, jm = de.fabric.util.createClass( + de.fabric.Image.filters.Convolute, + /** @lends Convolute.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Sharpen", + /** + * constructor + * @override + */ + initialize: function() { + this.matrix = [0, -1, 0, -1, 5, -1, 0, -1, 0]; + } + } + ), Fm = jm, $m = de.fabric.util.createClass( + de.fabric.Image.filters.Convolute, + /** @lends Convolute.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "Emboss", + /** + * constructor + * @override + */ + initialize: function() { + this.matrix = [1, 1, 1, 1, 0.7, -1, -1, -1, -1]; + } + } + ), el = $m, xa = de.fabric.util.createClass( + de.fabric.Image.filters.BaseFilter, + /** @lends BaseFilter.prototype */ + { + /** + * Filter type + * @param {String} type + * @default + */ + type: "ColorFilter", + /** + * Constructor + * @member fabric.Image.filters.ColorFilter.prototype + * @param {Object} [options] Options object + * @param {Number} [options.color='#FFFFFF'] Value of color (0...255) + * @param {Number} [options.threshold=45] Value of threshold (0...255) + * @override + */ + initialize: function(L) { + L || (L = {}), this.color = L.color || "#FFFFFF", this.threshold = L.threshold || 45, this.x = L.x || null, this.y = L.y || null; + }, + /** + * Applies filter to canvas element + * @param {Object} canvas Canvas object passed by fabric + */ + // eslint-disable-next-line complexity + applyTo: function(L) { + var A = L.canvasEl, D = A.getContext("2d"), I = D.getImageData(0, 0, A.width, A.height), k = I.data, B = this.threshold, H = de.fabric.Color.sourceFromHex(this.color), Y, W; + for (this.x && this.y && (H = this._getColor(I, this.x, this.y)), Y = 0, W = k.length; Y < W; Y += 4) + this._isOutsideThreshold(k[Y], H[0], B) || this._isOutsideThreshold(k[Y + 1], H[1], B) || this._isOutsideThreshold(k[Y + 2], H[2], B) || (k[Y] = k[Y + 1] = k[Y + 2] = k[Y + 3] = 0); + D.putImageData(I, 0, 0); + }, + /** + * Check color if it is within threshold + * @param {Number} color1 source color + * @param {Number} color2 filtering color + * @param {Number} threshold threshold + * @returns {boolean} true if within threshold or false + */ + _isOutsideThreshold: function(L, A, D) { + var I = L - A; + return Math.abs(I) > D; + }, + /** + * Get color at (x, y) + * @param {Object} imageData of canvas + * @param {Number} x left position + * @param {Number} y top position + * @returns {Array} color array + */ + _getColor: function(L, A, D) { + var I = [0, 0, 0, 0], k = L.data, B = L.width, H = 4, Y = (B * D + A) * H; + return I[0] = k[Y], I[1] = k[Y + 1], I[2] = k[Y + 2], I[3] = k[Y + 3], I; + } + } + ), Mf = xa; + function Df(V) { + var L = Eu(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Eu() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var tl = de.fabric.Image.filters; + tl.Mask = Pv, tl.Sharpen = Fm, tl.Emboss = el, tl.ColorFilter = Mf; + var Rv = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Df(A); + function A(D) { + return G(this, A), L.call(this, tt.FILTER, D); + } + return ee(A, [{ + key: "add", + value: function(I, k) { + var B = this; + return new (xe())(function(H, Y) { + var W = B._getSourceImage(), q = B.getCanvas(), ie = B._getFilter(W, I); + ie || (ie = B._createFilter(W, I, k)), ie || Y(wt.invalidParameters), B._changeFilterValues(ie, k), B._apply(W, function() { + q.renderAll(), H({ + type: I, + action: "add", + options: k + }); + }); + }); + } + /** + * Remove filter to source image + * @param {string} type - Filter type + * @returns {Promise} + */ + }, { + key: "remove", + value: function(I) { + var k = this; + return new (xe())(function(B, H) { + var Y = k._getSourceImage(), W = k.getCanvas(), q = k.getOptions(I); + Y.filters.length || H(wt.unsupportedOperation), k._removeFilter(Y, I), k._apply(Y, function() { + W.renderAll(), B({ + type: I, + action: "remove", + options: q + }); + }); + }); + } + /** + * Whether this has the filter or not + * @param {string} type - Filter type + * @returns {boolean} true if it has the filter + */ + }, { + key: "hasFilter", + value: function(I) { + return !!this._getFilter(this._getSourceImage(), I); + } + /** + * Get a filter options + * @param {string} type - Filter type + * @returns {Object} filter options or null if there is no that filter + */ + }, { + key: "getOptions", + value: function(I) { + var k = this._getSourceImage(), B = this._getFilter(k, I); + return B ? te()({}, B.options) : null; + } + /** + * Change filter values + * @param {Object} imgFilter object of filter + * @param {Object} options object + * @private + */ + }, { + key: "_changeFilterValues", + value: function(I, k) { + le()(k, function(B, H) { + re()(I[H]) || (I[H] = B); + }), le()(I.options, function(B, H) { + re()(k[H]) || (I.options[H] = k[H]); + }); + } + /** + * Apply filter + * @param {fabric.Image} sourceImg - Source image to apply filter + * @param {function} callback - Executed function after applying filter + * @private + */ + }, { + key: "_apply", + value: function(I, k) { + I.filters.push(); + var B = I.applyFilters(); + B && k(); + } + /** + * Get source image on canvas + * @returns {fabric.Image} Current source image on canvas + * @private + */ + }, { + key: "_getSourceImage", + value: function() { + return this.getCanvasImage(); + } + /** + * Create filter instance + * @param {fabric.Image} sourceImg - Source image to apply filter + * @param {string} type - Filter type + * @param {Object} [options] - Options of filter + * @returns {Object} Fabric object of filter + * @private + */ + }, { + key: "_createFilter", + value: function(I, k, B) { + var H, Y = this._getFabricFilterType(k), W = de.fabric.Image.filters[Y]; + return W && (H = new W(B), H.options = B, I.filters.push(H)), H; + } + /** + * Get applied filter instance + * @param {fabric.Image} sourceImg - Source image to apply filter + * @param {string} type - Filter type + * @returns {Object} Fabric object of filter + * @private + */ + }, { + key: "_getFilter", + value: function(I, k) { + var B = null; + if (I) { + var H = this._getFabricFilterType(k), Y = I.filters.length, W, q; + for (q = 0; q < Y; q += 1) + if (W = I.filters[q], W.type === H) { + B = W; + break; + } + } + return B; + } + /** + * Remove applied filter instance + * @param {fabric.Image} sourceImg - Source image to apply filter + * @param {string} type - Filter type + * @private + */ + }, { + key: "_removeFilter", + value: function(I, k) { + var B, H = this._getFabricFilterType(k); + I.filters = Ll()(B = I.filters).call(B, function(Y) { + return Y.type !== H; + }); + } + /** + * Change filter class name to fabric's, especially capitalizing first letter + * @param {string} type - Filter type + * @example + * 'grayscale' -> 'Grayscale' + * @returns {string} Fabric filter class name + */ + }, { + key: "_getFabricFilterType", + value: function(I) { + return I.charAt(0).toUpperCase() + p()(I).call(I, 1); + } + }]), A; + }(er), Hm = Rv, kf = a(1801), No = /* @__PURE__ */ a.n(kf), Nv = { + pixelate: "blocksize", + blur: "blur" + }, bs = { + x: "width", + y: "height" + }, zv = fn(Nv), rl = null; + function Mu(V) { + var L = Nn(V, "patternSourceCanvas"), A = L.patternSourceCanvas, D = A.getObjects(), I = we(D, 1), k = I[0]; + return k; + } + function Vm(V) { + var L = V.angle, A = V.flipX, D = V.flipY, I = Mu(V), k = Wm(V), B = k.right, H = k.bottom, Y = k.width, W = k.height, q = (Y - V.width) / 2, ie = (W - V.height) / 2, Se = V.left - V.width / 2 - q, Ce = V.top - V.height / 2 - ie, De = Y / 2 - q, Ee = W / 2 - ie, Le = Math.max(Y, W) + Math.max(q, ie), rt = Bv({ + shapeObj: V, + left: De, + top: Ee, + width: Y, + height: W, + cropX: Se, + cropY: Ce, + flipX: A, + flipY: D, + right: B, + bottom: H + }), Pt = we(rt, 4); + De = Pt[0], Ee = Pt[1], Y = Pt[2], W = Pt[3], I.set({ + angle: A === D ? -L : L, + left: De, + top: Ee, + width: Y, + height: W, + cropX: Se, + cropY: Ce, + flipX: A, + flipY: D + }), Yn(I, { + fillImageMaxSize: Le + }); + } + function Of(V) { + var L; + return Er()(L = V.filters).call(L, function(A) { + var D = je()(A), I = we(D, 1), k = I[0]; + return $({}, zv[k], A[k]); + }); + } + function Bv(V) { + var L = V.shapeObj, A = V.left, D = V.top, I = V.width, k = V.height, B = V.cropX, H = V.cropY, Y = V.flipX, W = V.flipY, q = V.right, ie = V.bottom, Se = function(Xt, dt, on, Hi) { + return Nl({ + type: Xt, + outDistance: dt, + shapeObj: L, + flipX: Y, + flipY: W, + left: on, + top: Hi + }); + }, Ce = I, De = k, Ee = aa(Se, { + left: A, + top: D, + width: I, + height: k, + cropX: B, + cropY: H + }), Le = we(Ee, 4); + A = Le[0], D = Le[1], I = Le[2], k = Le[3]; + var rt = Du(Se, { + left: A, + top: D, + insideCanvasRealImageWidth: I, + insideCanvasRealImageHeight: k, + right: q, + bottom: ie, + cropX: B, + cropY: H, + originalWidth: Ce, + originalHeight: De + }), Pt = we(rt, 4); + return A = Pt[0], D = Pt[1], I = Pt[2], k = Pt[3], [A, D, I, k]; + } + function Du(V, L) { + var A = L.left, D = L.top, I = L.insideCanvasRealImageWidth, k = L.insideCanvasRealImageHeight, B = L.right, H = L.bottom, Y = L.cropX, W = L.cropY, q = L.originalWidth, ie = L.originalHeight, Se = I, Ce = k, De = rl, Ee = De.width, Le = De.height; + B > Ee && Y > 0 && (Se = q - Math.abs(B - Ee)), H > Le && W > 0 && (Ce = ie - Math.abs(H - Le)); + var rt = { + x: (I - Se) / 2, + y: (k - Ce) / 2 + }; + return le()(["x", "y"], function(Pt) { + var zt = rt[Pt]; + if (zt > 0) { + var Xt = V(Pt, zt, A, D), dt = we(Xt, 2); + A = dt[0], D = dt[1]; + } + }), [A, D, Se, Ce]; + } + function aa(V, L) { + var A = L.left, D = L.top, I = L.width, k = L.height, B = L.cropX, H = L.cropY, Y = { + width: I, + height: k + }; + return le()(["x", "y"], function(W) { + var q = W === "x" ? B : H, ie = Y[bs[W]], Se = rl[bs[W]]; + if (ie > Se) { + var Ce = (ie - Se) / 2; + Y[bs[W]] = Se; + var De = V(W, Ce, A, D), Ee = we(De, 2); + A = Ee[0], D = Ee[1]; + } + if (q < 0) { + var Le = V(W, q, A, D), rt = we(Le, 2); + A = rt[0], D = rt[1]; + } + }), [A, D, Y.width, Y.height]; + } + function Bc(V, L, A) { + var D = jc(V), I = $v(D, V.angle, L); + A.add(I); + var k = { + fill: new de.fabric.Pattern({ + source: A.getElement(), + repeat: "no-repeat" + }) + }; + return Yn(k, { + patternSourceCanvas: A + }), k; + } + function Gm(V) { + var L = V.getObjects(), A = we(L, 1), D = A[0], I = Nn(D, "fillImageMaxSize"), k = I.fillImageMaxSize; + k = Math.max(1, k), V.setDimensions({ + width: k, + height: k + }), V.renderAll(); + } + function jv(V, L) { + var A = Nn(V, "patternSourceCanvas"), D = A.patternSourceCanvas, I = D.getObjects(), k = we(I, 1), B = k[0], H = Of(B); + D.remove(B); + var Y = jc(L, !0), W = $v(Y, L.angle, H); + D.add(W); + } + function jc(V) { + var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; + return (!rl || L) && (rl = V.toCanvasElement()), rl; + } + function Nl(V) { + var L = V.type, A = V.shapeObj, D = V.outDistance, I = V.left, k = V.top, B = V.flipX, H = V.flipY, Y = oa(A), W = [[1, 2], [0, 3], [0, 3], [1, 2]], q = $i(L, Y, W), ie = Lf(L, Y, q), Se = q.startPointIndex, Ce = ku({ + outDistance: D, + startPointIndex: Se, + flipX: B, + flipY: H, + reatAngles: ie + }); + return [I + Ce.left, k + Ce.top]; + } + function ku(V) { + var L = V.outDistance, A = V.startPointIndex, D = V.flipX, I = V.flipY, k = V.reatAngles, B = L * Math.cos(k[0] * Math.PI / 180), H = L * Math.cos(k[1] * Math.PI / 180), Y = A === 2 || A === 3, W = { + top: Y ? B : H, + left: Y ? H : B + }; + return Fv(A, D, I) && (W.left = W.left * -1), Um(A, D, I) && (W.top = W.top * -1), W; + } + function $i(V, L, A) { + var D = 0, I = 0; + le()(L, function(Y, W) { + Y[V] < D && (D = Y[V], I = W); + }); + var k = we(A[I], 2), B = k[0], H = k[1]; + return { + startPointIndex: I, + endPointIndex1: B, + endPointIndex2: H + }; + } + function Lf(V, L, A) { + var D, I = A.startPointIndex, k = A.endPointIndex1, B = A.endPointIndex2, H = V === "x" ? 180 : 270; + return Er()(D = [k, B]).call(D, function(Y) { + var W = L[I], q = L[Y], ie = W.y - q.y, Se = W.x - q.x; + return Math.atan2(ie, Se) * 180 / Math.PI - H; + }); + } + function Fv(V, L, A) { + return (!L && A || !L && !A) && V === 0 || (L && A || L && !A) && V === 1 || (!L && !A || !L && A) && V === 2 || (L && !A || L && A) && V === 3; + } + function Um(V, L, A) { + return (L && !A || !L && !A) && V === 0 || (!L && !A || L && !A) && V === 1 || (L && A || !L && A) && V === 2 || (!L && A || L && A) && V === 3; + } + function oa(V) { + return [V.getPointByOrigin("left", "top"), V.getPointByOrigin("right", "top"), V.getPointByOrigin("left", "bottom"), V.getPointByOrigin("right", "bottom")]; + } + function Wm(V) { + var L = oa(V), A = we(L, 4), D = A[0], I = D.x, k = D.y, B = A[1], H = B.x, Y = B.y, W = A[2], q = W.x, ie = W.y, Se = A[3], Ce = Se.x, De = Se.y, Ee = Math.min(I, H, q, Ce), Le = Math.min(k, Y, ie, De), rt = Math.max(I, H, q, Ce), Pt = Math.max(k, Y, ie, De); + return { + left: Ee, + top: Le, + right: rt, + bottom: Pt, + width: rt - Ee, + height: Pt - Le + }; + } + function $v(V, L, A) { + var D, I = new de.fabric.Image(V); + return le()(te().apply(void 0, K()(D = [{}]).call(D, F(A))), function(k, B) { + var H = ls(B), Y = new de.fabric.Image.filters[H]($({}, Nv[B], k)); + I.filters.push(Y); + }), I.applyFilters(), Yn(I, { + originalAngle: L, + fillImageMaxSize: Math.max(I.width, I.height) + }), No().adjustOriginToCenter(I), I; + } + function zl(V) { + var L = tr(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function tr() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var pt = te()({ + strokeWidth: 1, + stroke: "#000000", + fill: "#ffffff", + width: 1, + height: 1, + rx: 0, + ry: 0 + }, Vr), sa = "rect", vn = 20, zo = 20; + function Ym(V, L, A) { + var D = ze()(V), I = ki(ze()(V)), k = D; + D.color && (k = D.color); + var B = null; + if (I === "filter") { + var H = A(); + B = Bc(L, Ll()(D), H); + } else + B = { + fill: k + }; + return te()({}, V, B); + } + var Xm = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = zl(A); + function A(D) { + var I, k, B, H, Y, W; + return G(this, A), W = L.call(this, tt.SHAPE, D), W._shapeObj = null, W._type = sa, W._options = te()({}, pt), W._isSelected = !1, W._startPoint = {}, W._withShiftKey = !1, W._handlers = { + mousedown: ne()(I = W._onFabricMouseDown).call(I, Cr(W)), + mousemove: ne()(k = W._onFabricMouseMove).call(k, Cr(W)), + mouseup: ne()(B = W._onFabricMouseUp).call(B, Cr(W)), + keydown: ne()(H = W._onKeyDown).call(H, Cr(W)), + keyup: ne()(Y = W._onKeyUp).call(Y, Cr(W)) + }, W; + } + return ee(A, [{ + key: "start", + value: function() { + var I = this.getCanvas(); + this._isSelected = !1, I.defaultCursor = "crosshair", I.selection = !1, I.uniformScaling = !0, I.on({ + "mouse:down": this._handlers.mousedown + }), de.fabric.util.addListener(document, "keydown", this._handlers.keydown), de.fabric.util.addListener(document, "keyup", this._handlers.keyup); + } + /** + * End to draw the shape on canvas + * @ignore + */ + }, { + key: "end", + value: function() { + var I = this.getCanvas(); + this._isSelected = !1, I.defaultCursor = "default", I.selection = !0, I.uniformScaling = !1, I.off({ + "mouse:down": this._handlers.mousedown + }), de.fabric.util.removeListener(document, "keydown", this._handlers.keydown), de.fabric.util.removeListener(document, "keyup", this._handlers.keyup); + } + /** + * Set states of the current drawing shape + * @ignore + * @param {string} type - Shape type (ex: 'rect', 'circle') + * @param {Object} [options] - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stoke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + */ + }, { + key: "setStates", + value: function(I, k) { + this._type = I, k && (this._options = te()(this._options, k)); + } + /** + * Add the shape + * @ignore + * @param {string} type - Shape type (ex: 'rect', 'circle') + * @param {Object} options - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - ShapeFillOption or Shape foreground color (ex: '#fff', 'transparent') or ShapeFillOption object + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.isRegular] - Whether scaling shape has 1:1 ratio or not + * @returns {Promise} + */ + }, { + key: "add", + value: function(I, k) { + var B = this; + return new (xe())(function(H) { + var Y = B.getCanvas(), W = B._extendOptions(k), q = B._createInstance(I, W), ie = B.graphics.createObjectProperties(q); + B._bindEventOnShape(q), Y.add(q).setActiveObject(q), B._resetPositionFillFilter(q), H(ie); + }); + } + /** + * Change the shape + * @ignore + * @param {fabric.Object} shapeObj - Selected shape object on canvas + * @param {Object} options - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.isRegular] - Whether scaling shape has 1:1 ratio or not + * @returns {Promise} + */ + }, { + key: "change", + value: function(I, k) { + var B = this; + return new (xe())(function(H, Y) { + Qi(I) || Y(wt.unsupportedType); + var W = ki(ze()(k)) === "filter", q = B.graphics, ie = q.canvasImage, Se = q.createStaticCanvas; + I.set(W ? Ym(k, ie, Se) : k), W && B._resetPositionFillFilter(I), B.getCanvas().renderAll(), H(); + }); + } + /** + * make fill property for user event + * @param {fabric.Object} shapeObj - fabric object + * @returns {Object} + */ + }, { + key: "makeFillPropertyForUserEvent", + value: function(I) { + var k = Ki(I), B = {}; + if (k === Xe.FILTER) { + var H = Mu(I), Y = Of(H); + B.type = k, B.filter = Y; + } else + B.type = Xe.COLOR, B.color = ze()(I) || "transparent"; + return B; + } + /** + * Copy object handling. + * @param {fabric.Object} shapeObj - Shape object + * @param {fabric.Object} originalShapeObj - Shape object + */ + }, { + key: "processForCopiedObject", + value: function(I, k) { + if (this._bindEventOnShape(I), Ki(I) === "filter") { + var B = Mu(k), H = Of(B), Y = this.graphics.createStaticCanvas(); + I.set(Bc(this.graphics.canvasImage, H, Y)), this._resetPositionFillFilter(I); + } + } + /** + * Create the instance of shape + * @param {string} type - Shape type + * @param {Object} options - Options to creat the shape + * @returns {fabric.Object} Shape instance + * @private + */ + }, { + key: "_createInstance", + value: function(I, k) { + var B; + switch (I) { + case "rect": + B = new de.fabric.Rect(k); + break; + case "circle": + B = new de.fabric.Ellipse(te()({ + type: "circle" + }, k)); + break; + case "triangle": + B = new de.fabric.Triangle(k); + break; + default: + B = {}; + } + return B; + } + /** + * Get the options to create the shape + * @param {Object} options - Options to creat the shape + * @returns {Object} Shape options + * @private + */ + }, { + key: "_extendOptions", + value: function(I) { + var k = wi.SELECTION_STYLE, B = this.graphics, H = B.canvasImage, Y = B.createStaticCanvas; + return I = te()({}, pt, this._options, k, I), Ym(I, H, Y); + } + /** + * Bind fabric events on the creating shape object + * @param {fabric.Object} shapeObj - Shape object + * @private + */ + }, { + key: "_bindEventOnShape", + value: function(I) { + var k = this, B = this.getCanvas(); + I.on({ + added: function() { + k._shapeObj = this, No().setOrigins(k._shapeObj); + }, + selected: function() { + k._isSelected = !0, k._shapeObj = this, B.uniformScaling = !0, B.defaultCursor = "default", No().setOrigins(k._shapeObj); + }, + deselected: function() { + k._isSelected = !1, k._shapeObj = null, B.defaultCursor = "crosshair", B.uniformScaling = !1; + }, + modified: function() { + var Y = k._shapeObj; + No().adjustOriginToCenter(Y), No().setOrigins(Y); + }, + modifiedInGroup: function(Y) { + k._fillFilterRePositionInGroupSelection(I, Y); + }, + moving: function() { + k._resetPositionFillFilter(this); + }, + rotating: function() { + k._resetPositionFillFilter(this); + }, + scaling: function(Y) { + var W = B.getPointer(Y.e), q = k._shapeObj; + B.setCursor("crosshair"), No().resize(q, W, !0), k._resetPositionFillFilter(this); + } + }); + } + /** + * MouseDown event handler on canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseDown", + value: function(I) { + if (I.target || (this._isSelected = !1, this._shapeObj = !1), !this._isSelected && !this._shapeObj) { + var k = this.getCanvas(); + this._startPoint = k.getPointer(I.e), k.on({ + "mouse:move": this._handlers.mousemove, + "mouse:up": this._handlers.mouseup + }); + } + } + /** + * MouseDown event handler on canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event object + * @private + */ + }, { + key: "_onFabricMouseMove", + value: function(I) { + var k = this, B = this.getCanvas(), H = B.getPointer(I.e), Y = this._startPoint.x, W = this._startPoint.y, q = Y - H.x, ie = W - H.y, Se = this._shapeObj; + Se ? (this._shapeObj.set({ + isRegular: this._withShiftKey + }), No().resize(Se, H), B.renderAll(), this._resetPositionFillFilter(Se)) : this.add(this._type, { + left: Y, + top: W, + width: q, + height: ie + }).then(function(Ce) { + k.fire(Re.ADD_OBJECT, Ce); + }); + } + /** + * MouseUp event handler on canvas + * @private + */ + }, { + key: "_onFabricMouseUp", + value: function() { + var I = this, k = this.getCanvas(), B = this._startPoint.x, H = this._startPoint.y, Y = this._shapeObj; + Y ? Y && (No().adjustOriginToCenter(Y), this.fire(Re.OBJECT_ADDED, this.graphics.createObjectProperties(Y))) : this.add(this._type, { + left: B, + top: H, + width: vn, + height: zo + }).then(function(W) { + I.fire(Re.ADD_OBJECT, W); + }), k.off({ + "mouse:move": this._handlers.mousemove, + "mouse:up": this._handlers.mouseup + }); + } + /** + * Keydown event handler on document + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_onKeyDown", + value: function(I) { + I.keyCode === Vt.SHIFT && (this._withShiftKey = !0, this._shapeObj && (this._shapeObj.isRegular = !0)); + } + /** + * Keyup event handler on document + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_onKeyUp", + value: function(I) { + I.keyCode === Vt.SHIFT && (this._withShiftKey = !1, this._shapeObj && (this._shapeObj.isRegular = !1)); + } + /** + * Reset shape position and internal proportions in the filter type fill area. + * @param {fabric.Object} shapeObj - Shape object + * @private + */ + }, { + key: "_resetPositionFillFilter", + value: function(I) { + if (Ki(I) === "filter") { + var k = Nn(I, "patternSourceCanvas"), B = k.patternSourceCanvas, H = Mu(I), Y = Nn(H, "originalAngle"), W = Y.originalAngle; + this.graphics.canvasImage.angle !== W && jv(I, this.graphics.canvasImage); + var q = I.originX, ie = I.originY; + No().adjustOriginToCenter(I), I.width *= I.scaleX, I.height *= I.scaleY, I.rx *= I.scaleX, I.ry *= I.scaleY, I.scaleX = 1, I.scaleY = 1, Vm(I), ya(I, { + originX: q, + originY: ie + }), Gm(B); + } + } + /** + * Reset filter area position within group selection. + * @param {fabric.Object} shapeObj - Shape object + * @param {fabric.ActiveSelection} activeSelection - Shape object + * @private + */ + }, { + key: "_fillFilterRePositionInGroupSelection", + value: function(I, k) { + (k.scaleX !== 1 || k.scaleY !== 1) && k.addWithUpdate(); + var B = I.angle, H = I.left, Y = I.top; + de.fabric.util.addTransformToObject(I, k.calcTransformMatrix()), this._resetPositionFillFilter(I), I.set({ + angle: B, + left: H, + top: Y + }); + } + }]), A; + }(er); + function Ua(V) { + var L = Pf(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function Pf() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var Bl = 10, Wa = { + left: 0, + top: 0, + width: 0, + height: 0, + stroke: "#000000", + strokeWidth: 0, + fill: "#000000", + opacity: 0.4, + evented: !1, + selectable: !1, + hoverCursor: "auto" + }, Rf = { + SIZE: 45e-4, + MARGIN: 3e-3, + BORDER_RADIUS: 3e-3 + }, nl = { + SIZE: 66e-4, + MARGIN: 44e-4, + BORDER_RADIUS: 3e-3 + }, O = 1, j = Re.ZOOM_CHANGED, Z = Re.ADD_TEXT, ye = Re.TEXT_EDITING, Be = Re.OBJECT_MODIFIED, lt = Re.KEY_DOWN, Lt = Re.KEY_UP, br = Re.HAND_STARTED, mr = Re.HAND_STOPPED, an = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = Ua(A); + function A(D) { + var I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le; + G(this, A), Le = L.call(this, tt.ZOOM, D), Le.zoomArea = null, Le._startPoint = null, Le._centerPoints = [], Le.zoomLevel = O, Le.zoomMode = vr.DEFAULT, Le._listeners = { + startZoom: ne()(I = Le._onMouseDownWithZoomMode).call(I, Cr(Le)), + moveZoom: ne()(k = Le._onMouseMoveWithZoomMode).call(k, Cr(Le)), + stopZoom: ne()(B = Le._onMouseUpWithZoomMode).call(B, Cr(Le)), + startHand: ne()(H = Le._onMouseDownWithHandMode).call(H, Cr(Le)), + moveHand: ne()(Y = Le._onMouseMoveWithHandMode).call(Y, Cr(Le)), + stopHand: ne()(W = Le._onMouseUpWithHandMode).call(W, Cr(Le)), + zoomChanged: ne()(q = Le._changeScrollState).call(q, Cr(Le)), + keydown: ne()(ie = Le._startHandModeWithSpaceBar).call(ie, Cr(Le)), + keyup: ne()(Se = Le._endHandModeWithSpaceBar).call(Se, Cr(Le)) + }; + var rt = Le.getCanvas(); + return Le.aspectRatio = rt.width / rt.height, Le._verticalScroll = new de.fabric.Rect(Wa), Le._horizontalScroll = new de.fabric.Rect(Wa), rt.on(j, Le._listeners.zoomChanged), Le.graphics.on(Z, ne()(Ce = Le._startTextEditingHandler).call(Ce, Cr(Le))), Le.graphics.on(ye, ne()(De = Le._startTextEditingHandler).call(De, Cr(Le))), Le.graphics.on(Be, ne()(Ee = Le._stopTextEditingHandler).call(Ee, Cr(Le))), Le; + } + return ee(A, [{ + key: "attachKeyboardZoomEvents", + value: function() { + de.fabric.util.addListener(document, lt, this._listeners.keydown), de.fabric.util.addListener(document, Lt, this._listeners.keyup); + } + /** + * Detach zoom keyboard events + */ + }, { + key: "detachKeyboardZoomEvents", + value: function() { + de.fabric.util.removeListener(document, lt, this._listeners.keydown), de.fabric.util.removeListener(document, Lt, this._listeners.keyup); + } + /** + * Handler when you started editing text + * @private + */ + }, { + key: "_startTextEditingHandler", + value: function() { + this.isTextEditing = !0; + } + /** + * Handler when you stopped editing text + * @private + */ + }, { + key: "_stopTextEditingHandler", + value: function() { + this.isTextEditing = !1; + } + /** + * Handler who turns on hand mode when the space bar is down + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_startHandModeWithSpaceBar", + value: function(I) { + this.withSpace || this.isTextEditing || I.keyCode === Vt.SPACE && (this.withSpace = !0, this.startHandMode()); + } + /** + * Handler who turns off hand mode when space bar is up + * @param {KeyboardEvent} e - Event object + * @private + */ + }, { + key: "_endHandModeWithSpaceBar", + value: function(I) { + I.keyCode === Vt.SPACE && (this.withSpace = !1, this.endHandMode()); + } + /** + * Start zoom-in mode + */ + }, { + key: "startZoomInMode", + value: function() { + if (!this.zoomArea) { + this.endHandMode(), this.zoomMode = vr.ZOOM; + var I = this.getCanvas(); + this._changeObjectsEventedState(!1), this.zoomArea = new de.fabric.Rect({ + left: 0, + top: 0, + width: 0.5, + height: 0.5, + stroke: "black", + strokeWidth: 1, + fill: "transparent", + hoverCursor: "zoom-in" + }), I.discardActiveObject(), I.add(this.zoomArea), I.on("mouse:down", this._listeners.startZoom), I.selection = !1, I.defaultCursor = "zoom-in"; + } + } + /** + * End zoom-in mode + */ + }, { + key: "endZoomInMode", + value: function() { + this.zoomMode = vr.DEFAULT; + var I = this.getCanvas(), k = this._listeners, B = k.startZoom, H = k.moveZoom, Y = k.stopZoom; + I.selection = !0, I.defaultCursor = "auto", I.off({ + "mouse:down": B, + "mouse:move": H, + "mouse:up": Y + }), this._changeObjectsEventedState(!0), I.remove(this.zoomArea), this.zoomArea = null; + } + /** + * Start zoom drawing mode + */ + }, { + key: "start", + value: function() { + this.zoomArea = null, this._startPoint = null, this._startHandPoint = null; + } + /** + * Stop zoom drawing mode + */ + }, { + key: "end", + value: function() { + this.endZoomInMode(), this.endHandMode(); + } + /** + * Start hand mode + */ + }, { + key: "startHandMode", + value: function() { + this.endZoomInMode(), this.zoomMode = vr.HAND; + var I = this.getCanvas(); + this._changeObjectsEventedState(!1), I.discardActiveObject(), I.off("mouse:down", this._listeners.startHand), I.on("mouse:down", this._listeners.startHand), I.selection = !1, I.defaultCursor = "grab", I.fire(br); + } + /** + * Stop hand mode + */ + }, { + key: "endHandMode", + value: function() { + this.zoomMode = vr.DEFAULT; + var I = this.getCanvas(); + this._changeObjectsEventedState(!0), I.off("mouse:down", this._listeners.startHand), I.selection = !0, I.defaultCursor = "auto", this._startHandPoint = null, I.fire(mr); + } + /** + * onMousedown handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onMouseDownWithZoomMode", + value: function(I) { + var k = I.target, B = I.e; + if (!k) { + var H = this.getCanvas(); + H.selection = !1, this._startPoint = H.getPointer(B), this.zoomArea.set({ + width: 0, + height: 0 + }); + var Y = this._listeners, W = Y.moveZoom, q = Y.stopZoom; + H.on({ + "mouse:move": W, + "mouse:up": q + }); + } + } + /** + * onMousemove handler in fabric canvas + * @param {{e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onMouseMoveWithZoomMode", + value: function(I) { + var k = I.e, B = this.getCanvas(), H = B.getPointer(k), Y = H.x, W = H.y, q = this.zoomArea, ie = this._startPoint, Se = Math.abs(Y - ie.x), Ce = Math.abs(W - ie.y); + Se + Ce > Bl && (B.remove(q), q.set(this._calcRectDimensionFromPoint(Y, W)), B.add(q)); + } + /** + * Get rect dimension setting from Canvas-Mouse-Position(x, y) + * @param {number} x - Canvas-Mouse-Position x + * @param {number} y - Canvas-Mouse-Position Y + * @returns {{left: number, top: number, width: number, height: number}} + * @private + */ + }, { + key: "_calcRectDimensionFromPoint", + value: function(I, k) { + var B = this.getCanvas(), H = B.getWidth(), Y = B.getHeight(), W = this._startPoint, q = W.x, ie = W.y, Se = Math.min, Ce = Se(q, I), De = Se(ie, k), Ee = Dt(I, q, H) - Ce, Le = Dt(k, ie, Y) - De; + return { + left: Ce, + top: De, + width: Ee, + height: Le + }; + } + /** + * onMouseup handler in fabric canvas + * @private + */ + }, { + key: "_onMouseUpWithZoomMode", + value: function() { + var I = this.zoomLevel, k = this.zoomArea, B = this._listeners, H = B.moveZoom, Y = B.stopZoom, W = this.getCanvas(), q = this._getCenterPoint(), ie = q.x, Se = q.y; + this._isMaxZoomLevel() || (this._centerPoints.push({ + x: ie, + y: Se, + prevZoomLevel: I, + zoomLevel: I + 1 + }), I += 1, W.zoomToPoint({ + x: ie, + y: Se + }, I), this._fireZoomChanged(W, I), this.zoomLevel = I), W.off({ + "mouse:move": H, + "mouse:up": Y + }), W.remove(k), this._startPoint = null; + } + /** + * Get center point + * @returns {{x: number, y: number}} + * @private + */ + }, { + key: "_getCenterPoint", + value: function() { + var I = this.zoomArea, k = I.left, B = I.top, H = I.width, Y = I.height, W = this._startPoint, q = W.x, ie = W.y, Se = this.aspectRatio; + return H < Bl && Y < Bl ? { + x: q, + y: ie + } : H > Y ? { + x: k + Se * Y / 2, + y: B + Y / 2 + } : { + x: k + H / 2, + y: B + H / Se / 2 + }; + } + /** + * Zoom the canvas + * @param {{x: number, y: number}} center - center of zoom + * @param {?number} zoomLevel - zoom level + */ + }, { + key: "zoom", + value: function(I) { + for (var k = I.x, B = I.y, H = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.zoomLevel, Y = this.getCanvas(), W = this._centerPoints, q = W.length - 1; q >= 0 && !(W[q].zoomLevel < H); q -= 1) { + var ie = W.pop(), Se = ie.x, Ce = ie.y, De = ie.prevZoomLevel; + Y.zoomToPoint({ + x: Se, + y: Ce + }, De), this.zoomLevel = De; + } + Y.zoomToPoint({ + x: k, + y: B + }, H), this._isDefaultZoomLevel(H) || this._centerPoints.push({ + x: k, + y: B, + zoomLevel: H, + prevZoomLevel: this.zoomLevel + }), this.zoomLevel = H, this._fireZoomChanged(Y, H); + } + /** + * Zoom out one step + */ + }, { + key: "zoomOut", + value: function() { + var I = this._centerPoints; + if (I.length) { + var k = this.getCanvas(), B = I.pop(), H = B.x, Y = B.y, W = B.prevZoomLevel; + this._isDefaultZoomLevel(W) ? k.setViewportTransform([1, 0, 0, 1, 0, 0]) : k.zoomToPoint({ + x: H, + y: Y + }, W), this.zoomLevel = W, this._fireZoomChanged(k, this.zoomLevel); + } + } + /** + * Zoom reset + */ + }, { + key: "resetZoom", + value: function() { + var I = this.getCanvas(); + I.setViewportTransform([1, 0, 0, 1, 0, 0]), this.zoomLevel = O, this._centerPoints = [], this._fireZoomChanged(I, this.zoomLevel); + } + /** + * Whether zoom level is max (5.0) + * @returns {boolean} + * @private + */ + }, { + key: "_isMaxZoomLevel", + value: function() { + return this.zoomLevel >= 5; + } + /** + * Move point of zoom + * @param {{x: number, y: number}} delta - move amount + * @private + */ + }, { + key: "_movePointOfZoom", + value: function(I) { + var k = I.x, B = I.y, H = this._centerPoints; + if (H.length) { + var Y = this.getCanvas(), W = this.zoomLevel, q = H.pop(), ie = q.x, Se = q.y, Ce = q.prevZoomLevel, De = ie - k, Ee = Se - B; + Y.zoomToPoint({ + x: ie, + y: Se + }, Ce), Y.zoomToPoint({ + x: De, + y: Ee + }, W), H.push({ + x: De, + y: Ee, + prevZoomLevel: Ce, + zoomLevel: W + }), this._fireZoomChanged(Y, W); + } + } + /** + * onMouseDown handler in fabric canvas + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onMouseDownWithHandMode", + value: function(I) { + var k = I.target, B = I.e; + if (!k) { + var H = this.getCanvas(); + if (!(this.zoomLevel <= O)) { + H.selection = !1, this._startHandPoint = H.getPointer(B); + var Y = this._listeners, W = Y.moveHand, q = Y.stopHand; + H.on({ + "mouse:move": W, + "mouse:up": q + }); + } + } + } + /** + * onMouseMove handler in fabric canvas + * @param {{e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onMouseMoveWithHandMode", + value: function(I) { + var k = I.e, B = this.getCanvas(), H = B.getPointer(k), Y = H.x, W = H.y, q = Y - this._startHandPoint.x, ie = W - this._startHandPoint.y; + this._movePointOfZoom({ + x: q, + y: ie + }); + } + /** + * onMouseUp handler in fabric canvas + * @private + */ + }, { + key: "_onMouseUpWithHandMode", + value: function() { + var I = this.getCanvas(), k = this._listeners, B = k.moveHand, H = k.stopHand; + I.off({ + "mouse:move": B, + "mouse:up": H + }), this._startHandPoint = null; + } + /** + * onChangeZoom handler in fabric canvas + * @private + */ + }, { + key: "_changeScrollState", + value: function(I) { + var k = I.viewport, B = I.zoomLevel, H = this.getCanvas(); + if (H.remove(this._verticalScroll), H.remove(this._horizontalScroll), !this._isDefaultZoomLevel(B)) { + var Y = H.width, W = H.height, q = k.tl, ie = k.tr, Se = k.bl, Ce = ie.x - q.x, De = Se.y - q.y, Ee = Ce * Ce / Y, Le = De * nl.SIZE, rt = Dt(q.x + q.x / Y * Ce, q.x, ie.x - Ee), Pt = De * nl.MARGIN, zt = De * nl.BORDER_RADIUS; + this._horizontalScroll.set({ + left: rt, + top: Se.y - Le - Pt, + width: Ee, + height: Le, + rx: zt, + ry: zt + }); + var Xt = Ce * Rf.SIZE, dt = De * De / W, on = Dt(q.y + q.y / W * De, ie.y, Se.y - dt), Hi = Ce * Rf.MARGIN, Ya = Ce * Rf.BORDER_RADIUS; + this._verticalScroll.set({ + left: ie.x - Xt - Hi, + top: on, + width: Xt, + height: dt, + rx: Ya, + ry: Ya + }), this._addScrollBar(); + } + } + /** + * Change objects 'evented' state + * @param {boolean} [evented=true] - objects 'evented' state + */ + }, { + key: "_changeObjectsEventedState", + value: function() { + var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, k = this.getCanvas(); + k.forEachObject(function(B) { + B.evented = I; + }); + } + /** + * Add scroll bar and set remove timer + */ + }, { + key: "_addScrollBar", + value: function() { + var I = this, k = this.getCanvas(); + k.add(this._horizontalScroll), k.add(this._verticalScroll), this.scrollBarTid && clearTimeout(this.scrollBarTid), this.scrollBarTid = y()(function() { + k.remove(I._horizontalScroll), k.remove(I._verticalScroll); + }, 3e3); + } + /** + * Check zoom level is default zoom level (1.0) + * @param {number} zoomLevel - zoom level + * @returns {boolean} - whether zoom level is 1.0 + */ + }, { + key: "_isDefaultZoomLevel", + value: function(I) { + return I === O; + } + /** + * Fire 'zoomChanged' event + * @param {fabric.Canvas} canvas - fabric canvas + * @param {number} zoomLevel - 'zoomChanged' event params + */ + }, { + key: "_fireZoomChanged", + value: function(I, k) { + I.fire(j, { + viewport: I.calcViewportBoundaries(), + zoomLevel: k + }); + } + /** + * Get zoom mode + */ + }, { + key: "mode", + get: function() { + return this.zoomMode; + } + }]), A; + }(er), Bo = an, il = dn.create, Hv = dn.types, Zm = /* @__PURE__ */ function() { + function V(L) { + G(this, V), this.name = L; + } + return ee(V, [{ + key: "getName", + value: function() { + return this.name; + } + /** + * start this drawing mode + * @param {Object} options - drawing mode options + * @abstract + */ + }, { + key: "start", + value: function() { + throw new Error(il(Hv.UN_IMPLEMENTATION, "start")); + } + /** + * stop this drawing mode + * @abstract + */ + }, { + key: "end", + value: function() { + throw new Error(il(Hv.UN_IMPLEMENTATION, "stop")); + } + }]), V; + }(), xs = Zm; + function LU(V) { + var L = PU(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function PU() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var RU = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = LU(A); + function A() { + return G(this, A), L.call(this, ur.CROPPER); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.CROPPER); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.CROPPER); + k.end(); + } + }]), A; + }(xs), NU = RU; + function zU(V) { + var L = BU(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function BU() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var jU = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = zU(A); + function A() { + return G(this, A), L.call(this, ur.FREE_DRAWING); + } + return ee(A, [{ + key: "start", + value: function(I, k) { + var B = I.getComponent(tt.FREE_DRAWING); + B.start(k); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.FREE_DRAWING); + k.end(); + } + }]), A; + }(xs), FU = jU; + function $U(V) { + var L = HU(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function HU() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var VU = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = $U(A); + function A() { + return G(this, A), L.call(this, ur.LINE_DRAWING); + } + return ee(A, [{ + key: "start", + value: function(I, k) { + var B = I.getComponent(tt.LINE); + B.start(k); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.LINE); + k.end(); + } + }]), A; + }(xs), GU = VU; + function UU(V) { + var L = WU(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function WU() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var YU = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = UU(A); + function A() { + return G(this, A), L.call(this, ur.SHAPE); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.SHAPE); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.SHAPE); + k.end(); + } + }]), A; + }(xs), XU = YU; + function ZU(V) { + var L = JU(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function JU() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var KU = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = ZU(A); + function A() { + return G(this, A), L.call(this, ur.TEXT); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.TEXT); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.TEXT); + k.end(); + } + }]), A; + }(xs), QU = KU; + function qU(V) { + var L = eW(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function eW() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var tW = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = qU(A); + function A() { + return G(this, A), L.call(this, ur.ICON); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.ICON); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.ICON); + k.end(); + } + }]), A; + }(xs), rW = tW; + function nW(V) { + var L = iW(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function iW() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var aW = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = nW(A); + function A() { + return G(this, A), L.call(this, ur.ZOOM); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.ZOOM); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.ZOOM); + k.end(); + } + }]), A; + }(xs), oW = aW, AM = null; + function EM(V) { + AM = V; + } + function sW() { + return AM; + } + function Gx(V, L) { + var A; + if (V.type === "activeSelection") { + var D; + A = Er()(D = V.getObjects()).call(D, function(I) { + var k = I.angle, B = I.left, H = I.top, Y = I.scaleX, W = I.scaleY, q = I.width, ie = I.height; + de.fabric.util.addTransformToObject(I, V.calcTransformMatrix()); + var Se = L(I); + return I.set({ + angle: k, + left: B, + top: H, + width: q, + height: ie, + scaleX: Y, + scaleY: W + }), Se; + }); + } else + A = [L(V)]; + return A; + } + function Ux(V, L, A) { + return A ? { + id: V, + width: L.width, + height: L.height, + top: L.top, + left: L.left, + angle: L.angle, + scaleX: L.scaleX, + scaleY: L.scaleY + } : te()({ + id: V + }, L); + } + function lW(V) { + var L = uW(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function uW() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var cW = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = lW(A); + function A(D) { + var I; + return G(this, A), I = L.call(this, tt.RESIZE, D), I._dimensions = null, I._originalDimensions = null, I; + } + return ee(A, [{ + key: "getCurrentDimensions", + value: function() { + var I = this.getCanvasImage(); + if (!this._dimensions && I) { + var k = I.width, B = I.height; + this._dimensions = { + width: k, + height: B + }; + } + return this._dimensions; + } + /** + * Get original dimensions + * @returns {object} + */ + }, { + key: "getOriginalDimensions", + value: function() { + return this._originalDimensions; + } + /** + * Set original dimensions + * @param {object} dimensions - Dimensions + */ + }, { + key: "setOriginalDimensions", + value: function(I) { + this._originalDimensions = I; + } + /** + * Resize Image + * @param {Object} dimensions - Resize dimensions + * @returns {Promise} + */ + }, { + key: "resize", + value: function(I) { + var k = this.getCanvasImage(), B = k.width, H = k.height, Y = k.scaleX, W = k.scaleY, q = I.width, ie = I.height, Se = { + scaleX: q ? q / B : Y, + scaleY: ie ? ie / H : W + }; + return (Y !== Se.scaleX || W !== Se.scaleY) && (k.set(Se).setCoords(), this._dimensions = { + width: k.width * k.scaleX, + height: k.height * k.scaleY + }), this.adjustCanvasDimensionBase(), xe().resolve(); + } + /** + * Start resizing + */ + }, { + key: "start", + value: function() { + var I = this.getCurrentDimensions(); + this.setOriginalDimensions(I); + } + /** + * End resizing + */ + }, { + key: "end", + value: function() { + } + }]), A; + }(er), hW = cW; + function fW(V) { + var L = dW(); + return function() { + var D = At(V), I; + if (L) { + var k = At(this).constructor; + I = Ve()(D, arguments, k); + } else + I = D.apply(this, arguments); + return Yt(this, I); + }; + } + function dW() { + if (typeof Reflect == "undefined" || !Ve() || Ve().sham) + return !1; + if (typeof Proxy == "function") + return !0; + try { + return Boolean.prototype.valueOf.call(Ve()(Boolean, [], function() { + })), !0; + } catch (V) { + return !1; + } + } + var vW = /* @__PURE__ */ function(V) { + Gt(A, V); + var L = fW(A); + function A() { + return G(this, A), L.call(this, ur.RESIZE); + } + return ee(A, [{ + key: "start", + value: function(I) { + var k = I.getComponent(tt.RESIZE); + k.start(); + } + /** + * stop this drawing mode + * @param {Graphics} graphics - Graphics instance + * @override + */ + }, { + key: "end", + value: function(I) { + var k = I.getComponent(tt.RESIZE); + k.end(); + } + }]), A; + }(xs), pW = vW, gW = 1e3, mW = 800, Jm = 10, yW = { + cssOnly: !0 + }, _W = { + backstoreOnly: !0 + }, MM = /* @__PURE__ */ function() { + function V(L) { + var A, D, I, k, B, H, Y, W, q, ie, Se, Ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, De = Ce.cssMaxWidth, Ee = Ce.cssMaxHeight; + G(this, V), this.canvasImage = null, this.cssMaxWidth = De || gW, this.cssMaxHeight = Ee || mW, this.cropSelectionStyle = {}, this.targetObjectForCopyPaste = null, this.imageName = "", this._objects = {}, this._canvas = null, this._drawingMode = ur.NORMAL, this._drawingModeMap = {}, this._componentMap = {}, this._handler = { + onMouseDown: ne()(A = this._onMouseDown).call(A, this), + onObjectAdded: ne()(D = this._onObjectAdded).call(D, this), + onObjectRemoved: ne()(I = this._onObjectRemoved).call(I, this), + onObjectMoved: ne()(k = this._onObjectMoved).call(k, this), + onObjectScaled: ne()(B = this._onObjectScaled).call(B, this), + onObjectModified: ne()(H = this._onObjectModified).call(H, this), + onObjectRotated: ne()(Y = this._onObjectRotated).call(Y, this), + onObjectSelected: ne()(W = this._onObjectSelected).call(W, this), + onPathCreated: ne()(q = this._onPathCreated).call(q, this), + onSelectionCleared: ne()(ie = this._onSelectionCleared).call(ie, this), + onSelectionCreated: ne()(Se = this._onSelectionCreated).call(Se, this) + }, this._setObjectCachingToFalse(), this._setCanvasElement(L), this._createDrawingModeInstances(), this._createComponents(), this._attachCanvasEvents(), this._attachZoomEvents(); + } + return ee(V, [{ + key: "destroy", + value: function() { + var A = this._canvas.wrapperEl; + this._canvas.clear(), A.parentNode.removeChild(A), this._detachZoomEvents(); + } + /** + * Attach zoom events + */ + }, { + key: "_attachZoomEvents", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.attachKeyboardZoomEvents(); + } + /** + * Detach zoom events + */ + }, { + key: "_detachZoomEvents", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.detachKeyboardZoomEvents(); + } + /** + * Deactivates all objects on canvas + * @returns {Graphics} this + */ + }, { + key: "deactivateAll", + value: function() { + return this._canvas.discardActiveObject(), this; + } + /** + * Renders all objects on canvas + * @returns {Graphics} this + */ + }, { + key: "renderAll", + value: function() { + return this._canvas.renderAll(), this; + } + /** + * Adds objects on canvas + * @param {Object|Array} objects - objects + */ + }, { + key: "add", + value: function(A) { + var D, I = []; + Js()(A) ? I = A : I.push(A), (D = this._canvas).add.apply(D, F(I)); + } + /** + * Removes the object or group + * @param {Object} target - graphics object or group + * @returns {boolean} true if contains or false + */ + }, { + key: "contains", + value: function(A) { + return this._canvas.contains(A); + } + /** + * Gets all objects or group + * @returns {Array} all objects, shallow copy + */ + }, { + key: "getObjects", + value: function() { + var A; + return p()(A = this._canvas.getObjects()).call(A); + } + /** + * Get an object by id + * @param {number} id - object id + * @returns {fabric.Object} object corresponding id + */ + }, { + key: "getObject", + value: function(A) { + return this._objects[A]; + } + /** + * Removes the object or group + * @param {Object} target - graphics object or group + */ + }, { + key: "remove", + value: function(A) { + this._canvas.remove(A); + } + /** + * Removes all object or group + * @param {boolean} includesBackground - remove the background image or not + * @returns {Array} all objects array which is removed + */ + }, { + key: "removeAll", + value: function(A) { + var D, I = this._canvas, k = p()(D = I.getObjects()).call(D); + return I.remove.apply(I, F(this._canvas.getObjects())), A && I.clear(), k; + } + /** + * Removes an object or group by id + * @param {number} id - object id + * @returns {Array} removed objects + */ + }, { + key: "removeObjectById", + value: function(A) { + var D = [], I = this._canvas, k = this.getObject(A), B = k && k.isType("group") && !k.isEmpty(); + return B ? (I.discardActiveObject(), k.forEachObject(function(H) { + D.push(H), I.remove(H); + })) : I.contains(k) && (D.push(k), I.remove(k)), D; + } + /** + * Get an id by object instance + * @param {fabric.Object} object object + * @returns {number} object id if it exists or null + */ + }, { + key: "getObjectId", + value: function(A) { + var D = null; + for (D in this._objects) + if (this._objects.hasOwnProperty(D) && A === this._objects[D]) + return D; + return null; + } + /** + * Gets an active object or group + * @returns {Object} active object or group instance + */ + }, { + key: "getActiveObject", + value: function() { + return this._canvas._activeObject; + } + /** + * Returns the object ID to delete the object. + * @returns {number} object id for remove + */ + }, { + key: "getActiveObjectIdForRemove", + value: function() { + var A = this.getActiveObject(), D = A.type, I = A.left, k = A.top, B = D === "activeSelection"; + if (B) { + var H = new de.fabric.Group(F(A.getObjects()), { + left: I, + top: k + }); + return this._addFabricObject(H); + } + return this.getObjectId(A); + } + /** + * Verify that you are ready to erase the object. + * @returns {boolean} ready for object remove + */ + }, { + key: "isReadyRemoveObject", + value: function() { + var A = this.getActiveObject(); + return A && !A.isEditing; + } + /** + * Gets an active group object + * @returns {Object} active group object instance + */ + }, { + key: "getActiveObjects", + value: function() { + var A = this._canvas._activeObject; + return A && A.type === "activeSelection" ? A : null; + } + /** + * Get Active object Selection from object ids + * @param {Array.} objects - fabric objects + * @returns {Object} target - target object group + */ + }, { + key: "getActiveSelectionFromObjects", + value: function(A) { + var D = this.getCanvas(); + return new de.fabric.ActiveSelection(A, { + canvas: D + }); + } + /** + * Activates an object or group + * @param {Object} target - target object or group + */ + }, { + key: "setActiveObject", + value: function(A) { + this._canvas.setActiveObject(A); + } + /** + * Set Crop selection style + * @param {Object} style - Selection styles + */ + }, { + key: "setCropSelectionStyle", + value: function(A) { + this.cropSelectionStyle = A; + } + /** + * Get component + * @param {string} name - Component name + * @returns {Component} + */ + }, { + key: "getComponent", + value: function(A) { + return this._componentMap[A]; + } + /** + * Get current drawing mode + * @returns {string} + */ + }, { + key: "getDrawingMode", + value: function() { + return this._drawingMode; + } + /** + * Start a drawing mode. If the current mode is not 'NORMAL', 'stopDrawingMode()' will be called first. + * @param {String} mode Can be one of 'CROPPER', 'FREE_DRAWING', 'LINE', 'TEXT', 'SHAPE' + * @param {Object} [option] parameters of drawing mode, it's available with 'FREE_DRAWING', 'LINE_DRAWING' + * @param {Number} [option.width] brush width + * @param {String} [option.color] brush color + * @returns {boolean} true if success or false + */ + }, { + key: "startDrawingMode", + value: function(A, D) { + if (this._isSameDrawingMode(A)) + return !0; + this.stopDrawingMode(); + var I = this._getDrawingModeInstance(A); + return I && I.start && (I.start(this, D), this._drawingMode = A), !!I; + } + /** + * Stop the current drawing mode and back to the 'NORMAL' mode + */ + }, { + key: "stopDrawingMode", + value: function() { + if (!this._isSameDrawingMode(ur.NORMAL)) { + var A = this._getDrawingModeInstance(this.getDrawingMode()); + A && A.end && A.end(this), this._drawingMode = ur.NORMAL; + } + } + /** + * Change zoom of canvas + * @param {{x: number, y: number}} center - center of zoom + * @param {number} zoomLevel - zoom level + */ + }, { + key: "zoom", + value: function(A, D) { + var I = A.x, k = A.y, B = this.getComponent(tt.ZOOM); + B.zoom({ + x: I, + y: k + }, D); + } + /** + * Get zoom mode + * @returns {string} + */ + }, { + key: "getZoomMode", + value: function() { + var A = this.getComponent(tt.ZOOM); + return A.mode; + } + /** + * Start zoom-in mode + */ + }, { + key: "startZoomInMode", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.startZoomInMode(); + } + /** + * Stop zoom-in mode + */ + }, { + key: "endZoomInMode", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.endZoomInMode(); + } + /** + * Zoom out one step + */ + }, { + key: "zoomOut", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.zoomOut(); + } + /** + * Start hand mode + */ + }, { + key: "startHandMode", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.startHandMode(); + } + /** + * Stop hand mode + */ + }, { + key: "endHandMode", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.endHandMode(); + } + /** + * Zoom reset + */ + }, { + key: "resetZoom", + value: function() { + var A = this.getComponent(tt.ZOOM); + A.resetZoom(); + } + /** + * To data url from canvas + * @param {Object} options - options for toDataURL + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in fabric v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in fabric v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in fabric v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in fabric v1.2.14 + * @returns {string} A DOMString containing the requested data URI. + */ + }, { + key: "toDataURL", + value: function(A) { + var D = this.getComponent(tt.CROPPER); + D.changeVisibility(!1); + var I = this._canvas && this._canvas.toDataURL(A); + return D.changeVisibility(!0), I; + } + /** + * Save image(background) of canvas + * @param {string} name - Name of image + * @param {?fabric.Image} canvasImage - Fabric image instance + */ + }, { + key: "setCanvasImage", + value: function(A, D) { + D && Je(D), this.imageName = A, this.canvasImage = D; + } + /** + * Set css max dimension + * @param {{width: number, height: number}} maxDimension - Max width & Max height + */ + }, { + key: "setCssMaxDimension", + value: function(A) { + this.cssMaxWidth = A.width || this.cssMaxWidth, this.cssMaxHeight = A.height || this.cssMaxHeight; + } + /** + * Adjust canvas dimension with scaling image + */ + }, { + key: "adjustCanvasDimension", + value: function() { + this.adjustCanvasDimensionBase(this.canvasImage.scale(1)); + } + }, { + key: "adjustCanvasDimensionBase", + value: function() { + var A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; + A || (A = this.canvasImage); + var D = A.getBoundingRect(), I = D.width, k = D.height, B = this._calcMaxDimension(I, k); + this.setCanvasCssDimension({ + width: "100%", + height: "100%", + // Set height '' for IE9 + "max-width": "".concat(B.width, "px"), + "max-height": "".concat(B.height, "px") + }), this.setCanvasBackstoreDimension({ + width: I, + height: k + }), this._canvas.centerObject(A); + } + /** + * Set canvas dimension - css only + * {@link http://fabricjs.com/docs/fabric.Canvas.html#setDimensions} + * @param {Object} dimension - Canvas css dimension + */ + }, { + key: "setCanvasCssDimension", + value: function(A) { + this._canvas.setDimensions(A, yW); + } + /** + * Set canvas dimension - backstore only + * {@link http://fabricjs.com/docs/fabric.Canvas.html#setDimensions} + * @param {Object} dimension - Canvas backstore dimension + */ + }, { + key: "setCanvasBackstoreDimension", + value: function(A) { + this._canvas.setDimensions(A, _W); + } + /** + * Set image properties + * {@link http://fabricjs.com/docs/fabric.Image.html#set} + * @param {Object} setting - Image properties + * @param {boolean} [withRendering] - If true, The changed image will be reflected in the canvas + */ + }, { + key: "setImageProperties", + value: function(A, D) { + var I = this.canvasImage; + I && (I.set(A).setCoords(), D && this._canvas.renderAll()); + } + /** + * Returns canvas element of fabric.Canvas[[lower-canvas]] + * @returns {HTMLCanvasElement} + */ + }, { + key: "getCanvasElement", + value: function() { + return this._canvas.getElement(); + } + /** + * Get fabric.Canvas instance + * @returns {fabric.Canvas} + */ + }, { + key: "getCanvas", + value: function() { + return this._canvas; + } + /** + * Get canvasImage (fabric.Image instance) + * @returns {fabric.Image} + */ + }, { + key: "getCanvasImage", + value: function() { + return this.canvasImage; + } + /** + * Get image name + * @returns {string} + */ + }, { + key: "getImageName", + value: function() { + return this.imageName; + } + /** + * Add image object on canvas + * @param {string} imgUrl - Image url to make object + * @returns {Promise} + */ + }, { + key: "addImageObject", + value: function(A) { + var D, I = this, k = ne()(D = this._callbackAfterLoadingImageObject).call(D, this); + return new (xe())(function(B) { + de.fabric.Image.fromURL(A, function(H) { + k(H), B(I.createObjectProperties(H)); + }, { + crossOrigin: "Anonymous" + }); + }); + } + /** + * Get center position of canvas + * @returns {Object} {left, top} + */ + }, { + key: "getCenter", + value: function() { + return this._canvas.getCenter(); + } + /** + * Get cropped rect + * @returns {Object} rect + */ + }, { + key: "getCropzoneRect", + value: function() { + return this.getComponent(tt.CROPPER).getCropzoneRect(); + } + /** + * Get cropped rect + * @param {number} [mode] cropzone rect mode + */ + }, { + key: "setCropzoneRect", + value: function(A) { + this.getComponent(tt.CROPPER).setCropzoneRect(A); + } + /** + * Get cropped image data + * @param {Object} cropRect cropzone rect + * @param {Number} cropRect.left left position + * @param {Number} cropRect.top top position + * @param {Number} cropRect.width width + * @param {Number} cropRect.height height + * @returns {?{imageName: string, url: string}} cropped Image data + */ + }, { + key: "getCroppedImageData", + value: function(A) { + return this.getComponent(tt.CROPPER).getCroppedImageData(A); + } + /** + * Set brush option + * @param {Object} option brush option + * @param {Number} option.width width + * @param {String} option.color color like 'FFFFFF', 'rgba(0, 0, 0, 0.5)' + */ + }, { + key: "setBrush", + value: function(A) { + var D = this._drawingMode, I = tt.FREE_DRAWING; + D === ur.LINE_DRAWING && (I = tt.LINE), this.getComponent(I).setBrush(A); + } + /** + * Set states of current drawing shape + * @param {string} type - Shape type (ex: 'rect', 'circle', 'triangle') + * @param {Object} [options] - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stoke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + */ + }, { + key: "setDrawingShape", + value: function(A, D) { + this.getComponent(tt.SHAPE).setStates(A, D); + } + /** + * Set style of current drawing icon + * @param {string} type - icon type (ex: 'icon-arrow', 'icon-star') + * @param {Object} [iconColor] - Icon color + */ + }, { + key: "setIconStyle", + value: function(A, D) { + this.getComponent(tt.ICON).setStates(A, D); + } + /** + * Register icon paths + * @param {Object} pathInfos - Path infos + * @param {string} pathInfos.key - key + * @param {string} pathInfos.value - value + */ + }, { + key: "registerPaths", + value: function(A) { + this.getComponent(tt.ICON).registerPaths(A); + } + /** + * Change cursor style + * @param {string} cursorType - cursor type + */ + }, { + key: "changeCursor", + value: function(A) { + var D = this.getCanvas(); + D.defaultCursor = A, D.renderAll(); + } + /** + * Whether it has the filter or not + * @param {string} type - Filter type + * @returns {boolean} true if it has the filter + */ + }, { + key: "hasFilter", + value: function(A) { + return this.getComponent(tt.FILTER).hasFilter(A); + } + /** + * Set selection style of fabric object by init option + * @param {Object} styles - Selection styles + */ + }, { + key: "setSelectionStyle", + value: function(A) { + te()(wi.SELECTION_STYLE, A); + } + /** + * Set object properties + * @param {number} id - object id + * @param {Object} props - props + * @param {string} [props.fill] Color + * @param {string} [props.fontFamily] Font type for text + * @param {number} [props.fontSize] Size + * @param {string} [props.fontStyle] Type of inclination (normal / italic) + * @param {string} [props.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [props.textAlign] Type of text align (left / center / right) + * @param {string} [props.textDecoration] Type of line (underline / line-through / overline) + * @returns {Object} applied properties + */ + }, { + key: "setObjectProperties", + value: function(A, D) { + var I = this.getObject(A), k = te()({}, D); + return I.set(k), I.setCoords(), this.getCanvas().renderAll(), k; + } + /** + * Get object properties corresponding key + * @param {number} id - object id + * @param {Array|ObjectProps|string} keys - property's key + * @returns {Object} properties + */ + }, { + key: "getObjectProperties", + value: function(A, D) { + var I = this.getObject(A), k = {}; + return Ne()(D) ? k[D] = I[D] : Js()(D) ? hn()(D, function(B) { + k[B] = I[B]; + }) : ho()(D, function(B, H) { + k[H] = I[H]; + }), k; + } + /** + * Get object position by originX, originY + * @param {number} id - object id + * @param {string} originX - can be 'left', 'center', 'right' + * @param {string} originY - can be 'top', 'center', 'bottom' + * @returns {Object} {{x:number, y: number}} position by origin if id is valid, or null + */ + }, { + key: "getObjectPosition", + value: function(A, D, I) { + var k = this.getObject(A); + return k ? k.getPointByOrigin(D, I) : null; + } + /** + * Set object position by originX, originY + * @param {number} id - object id + * @param {Object} posInfo - position object + * @param {number} posInfo.x - x position + * @param {number} posInfo.y - y position + * @param {string} posInfo.originX - can be 'left', 'center', 'right' + * @param {string} posInfo.originY - can be 'top', 'center', 'bottom' + * @returns {boolean} true if target id is valid or false + */ + }, { + key: "setObjectPosition", + value: function(A, D) { + var I = this.getObject(A), k = D.x, B = D.y, H = D.originX, Y = D.originY; + if (!I) + return !1; + var W = I.getPointByOrigin(H, Y), q = I.getPointByOrigin("center", "center"), ie = q.x - W.x, Se = q.y - W.y; + return I.set({ + left: k + ie, + top: B + Se + }), I.setCoords(), !0; + } + /** + * Get the canvas size + * @returns {Object} {{width: number, height: number}} image size + */ + }, { + key: "getCanvasSize", + value: function() { + var A = this.getCanvasImage(); + return { + width: A ? A.width : 0, + height: A ? A.height : 0 + }; + } + /** + * Create fabric static canvas + * @returns {Object} {{width: number, height: number}} image size + */ + }, { + key: "createStaticCanvas", + value: function() { + var A = new de.fabric.StaticCanvas(); + return A.set({ + enableRetinaScaling: !1 + }), A; + } + /** + * Get a DrawingMode instance + * @param {string} modeName - DrawingMode Class Name + * @returns {DrawingMode} DrawingMode instance + * @private + */ + }, { + key: "_getDrawingModeInstance", + value: function(A) { + return this._drawingModeMap[A]; + } + /** + * Set object caching to false. This brought many bugs when draw Shape & cropzone + * @see http://fabricjs.com/fabric-object-caching + * @private + */ + }, { + key: "_setObjectCachingToFalse", + value: function() { + de.fabric.Object.prototype.objectCaching = !1; + } + /** + * Set canvas element to fabric.Canvas + * @param {Element|string} element - Wrapper or canvas element or selector + * @private + */ + }, { + key: "_setCanvasElement", + value: function(A) { + var D, I; + A.nodeType ? D = A : D = document.querySelector(A), D.nodeName.toUpperCase() !== "CANVAS" && (I = document.createElement("canvas"), D.appendChild(I)), this._canvas = new de.fabric.Canvas(I, { + containerClass: "tui-image-editor-canvas-container", + enableRetinaScaling: !1 + }); + } + /** + * Creates DrawingMode instances + * @private + */ + }, { + key: "_createDrawingModeInstances", + value: function() { + this._register(this._drawingModeMap, new NU()), this._register(this._drawingModeMap, new FU()), this._register(this._drawingModeMap, new GU()), this._register(this._drawingModeMap, new XU()), this._register(this._drawingModeMap, new QU()), this._register(this._drawingModeMap, new rW()), this._register(this._drawingModeMap, new oW()), this._register(this._drawingModeMap, new pW()); + } + /** + * Create components + * @private + */ + }, { + key: "_createComponents", + value: function() { + this._register(this._componentMap, new bf(this)), this._register(this._componentMap, new Lc(this)), this._register(this._componentMap, new Cf(this)), this._register(this._componentMap, new ms(this)), this._register(this._componentMap, new Mv(this)), this._register(this._componentMap, new Ef(this)), this._register(this._componentMap, new ia(this)), this._register(this._componentMap, new $n(this)), this._register(this._componentMap, new Hm(this)), this._register(this._componentMap, new Xm(this)), this._register(this._componentMap, new Bo(this)), this._register(this._componentMap, new hW(this)); + } + /** + * Register component + * @param {Object} map - map object + * @param {Object} module - module which has getName method + * @private + */ + }, { + key: "_register", + value: function(A, D) { + A[D.getName()] = D; + } + /** + * Get the current drawing mode is same with given mode + * @param {string} mode drawing mode + * @returns {boolean} true if same or false + */ + }, { + key: "_isSameDrawingMode", + value: function(A) { + return this.getDrawingMode() === A; + } + /** + * Calculate max dimension of canvas + * The css-max dimension is dynamically decided with maintaining image ratio + * The css-max dimension is lower than canvas dimension (attribute of canvas, not css) + * @param {number} width - Canvas width + * @param {number} height - Canvas height + * @returns {{width: number, height: number}} - Max width & Max height + * @private + */ + }, { + key: "_calcMaxDimension", + value: function(A, D) { + var I = this.cssMaxWidth / A, k = this.cssMaxHeight / D, B = Math.min(A, this.cssMaxWidth), H = Math.min(D, this.cssMaxHeight); + return I < 1 && I < k ? (B = A * I, H = D * I) : k < 1 && k < I && (B = A * k, H = D * k), { + width: Math.floor(B), + height: Math.floor(H) + }; + } + /** + * Callback function after loading image + * @param {fabric.Image} obj - Fabric image object + * @private + */ + }, { + key: "_callbackAfterLoadingImageObject", + value: function(A) { + var D = this.getCanvasImage().getCenterPoint(); + A.set(wi.SELECTION_STYLE), A.set({ + left: D.x, + top: D.y, + crossOrigin: "Anonymous" + }), this.getCanvas().add(A).setActiveObject(A); + } + /** + * Attach canvas's events + */ + }, { + key: "_attachCanvasEvents", + value: function() { + var A = this._canvas, D = this._handler; + A.on({ + "mouse:down": D.onMouseDown, + "object:added": D.onObjectAdded, + "object:removed": D.onObjectRemoved, + "object:moving": D.onObjectMoved, + "object:scaling": D.onObjectScaled, + "object:modified": D.onObjectModified, + "object:rotating": D.onObjectRotated, + "path:created": D.onPathCreated, + "selection:cleared": D.onSelectionCleared, + "selection:created": D.onSelectionCreated, + "selection:updated": D.onObjectSelected + }); + } + /** + * "mouse:down" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onMouseDown", + value: function(A) { + var D = this, I = A.e, k = A.target, B = this._canvas.getPointer(I); + if (k) { + var H = k.type, Y = Gx(k, function(W) { + return Ux(D.getObjectId(W), W, H === "activeSelection"); + }); + EM(Y); + } + this.fire(Re.MOUSE_DOWN, I, B); + } + /** + * "object:added" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectAdded", + value: function(A) { + var D = A.target; + D.isType("cropzone") || this._addFabricObject(D); + } + /** + * "object:removed" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectRemoved", + value: function(A) { + var D = A.target; + this._removeFabricObject(Je(D)); + } + /** + * "object:moving" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectMoved", + value: function(A) { + var D = this; + this._lazyFire(Re.OBJECT_MOVED, function(I) { + return D.createObjectProperties(I); + }, A.target); + } + /** + * "object:scaling" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectScaled", + value: function(A) { + var D = this; + this._lazyFire(Re.OBJECT_SCALED, function(I) { + return D.createObjectProperties(I); + }, A.target); + } + /** + * "object:modified" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectModified", + value: function(A) { + var D = A.target; + if (D.type === "activeSelection") { + var I = D.getObjects(); + yt()(I).call(I, function(k) { + return k.fire("modifiedInGroup", D); + }); + } + this.fire(Re.OBJECT_MODIFIED, D, this.getObjectId(D)); + } + /** + * "object:rotating" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectRotated", + value: function(A) { + var D = this; + this._lazyFire(Re.OBJECT_ROTATED, function(I) { + return D.createObjectProperties(I); + }, A.target); + } + /** + * Lazy event emitter + * @param {string} eventName - event name + * @param {Function} paramsMaker - make param function + * @param {Object} [target] - Object of the event owner. + * @private + */ + }, { + key: "_lazyFire", + value: function(A, D, I) { + var k = this, B = I && I.canvasEventDelegation, H = B ? I.canvasEventDelegation(A) : "none"; + H === "unregistered" && I.canvasEventRegister(A, function(Y) { + k.fire(A, D(Y)); + }), H === "none" && this.fire(A, D(I)); + } + /** + * "object:selected" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onObjectSelected", + value: function(A) { + var D = A.target, I = this.createObjectProperties(D); + this.fire(Re.OBJECT_ACTIVATED, I); + } + /** + * "path:created" canvas event handler + * @param {{path: fabric.Path}} obj - Path object + * @private + */ + }, { + key: "_onPathCreated", + value: function(A) { + var D = A.path.getCenterPoint(), I = D.x, k = D.y; + A.path.set(te()({ + left: I, + top: k + }, wi.SELECTION_STYLE)); + var B = this.createObjectProperties(A.path); + this.fire(Re.ADD_OBJECT, B); + } + /** + * "selction:cleared" canvas event handler + * @private + */ + }, { + key: "_onSelectionCleared", + value: function() { + this.fire(Re.SELECTION_CLEARED); + } + /** + * "selction:created" canvas event handler + * @param {{target: fabric.Object, e: MouseEvent}} fEvent - Fabric event + * @private + */ + }, { + key: "_onSelectionCreated", + value: function(A) { + var D = A.target, I = this.createObjectProperties(D); + this.fire(Re.OBJECT_ACTIVATED, I), this.fire(Re.SELECTION_CREATED, A.target); + } + /** + * Canvas discard selection all + */ + }, { + key: "discardSelection", + value: function() { + this._canvas.discardActiveObject(), this._canvas.renderAll(); + } + /** + * Canvas Selectable status change + * @param {boolean} selectable - expect status + */ + }, { + key: "changeSelectableAll", + value: function(A) { + this._canvas.forEachObject(function(D) { + D.selectable = A, D.hoverCursor = A ? "move" : "crosshair"; + }); + } + /** + * Return object's properties + * @param {fabric.Object} obj - fabric object + * @returns {Object} properties object + */ + }, { + key: "createObjectProperties", + value: function(A) { + var D = ["left", "top", "width", "height", "fill", "stroke", "strokeWidth", "opacity", "angle"], I = { + id: Je(A), + type: A.type + }; + if (te()(I, qt(A, D)), us(["i-text", "text"], A.type)) + te()(I, this._createTextProperties(A, I)); + else if (us(["rect", "triangle", "circle"], A.type)) { + var k = this.getComponent(tt.SHAPE); + te()(I, { + fill: k.makeFillPropertyForUserEvent(A) + }); + } + return I; + } + /** + * Get text object's properties + * @param {fabric.Object} obj - fabric text object + * @param {Object} props - properties + * @returns {Object} properties object + */ + }, { + key: "_createTextProperties", + value: function(A) { + var D = ["text", "fontFamily", "fontSize", "fontStyle", "textAlign", "textDecoration", "fontWeight"], I = {}; + return te()(I, qt(A, D)), I; + } + /** + * Add object array by id + * @param {fabric.Object} obj - fabric object + * @returns {number} object id + */ + }, { + key: "_addFabricObject", + value: function(A) { + var D = Je(A); + return this._objects[D] = A, D; + } + /** + * Remove an object in array yb id + * @param {number} id - object id + */ + }, { + key: "_removeFabricObject", + value: function(A) { + delete this._objects[A]; + } + /** + * Reset targetObjectForCopyPaste value from activeObject + */ + }, { + key: "resetTargetObjectForCopyPaste", + value: function() { + var A = this.getActiveObject(); + A && (this.targetObjectForCopyPaste = A); + } + /** + * Paste fabric object + * @returns {Promise} + */ + }, { + key: "pasteObject", + value: function() { + var A = this; + if (!this.targetObjectForCopyPaste) + return xe().resolve([]); + var D = this.targetObjectForCopyPaste, I = D.type === "activeSelection", k = I ? D.getObjects() : [D], B = null; + return this.discardSelection(), this._cloneObject(k).then(function(H) { + if (H.length > 1) + B = A.getActiveSelectionFromObjects(H); + else { + var Y = we(H, 1); + B = Y[0]; + } + A.targetObjectForCopyPaste = B, A.setActiveObject(B); + }); + } + /** + * Clone object + * @param {fabric.Object} targetObjects - fabric object + * @returns {Promise} + * @private + */ + }, { + key: "_cloneObject", + value: function(A) { + var D = this, I = Er()(A).call(A, function(k) { + return D._cloneObjectItem(k); + }); + return xe().all(I); + } + /** + * Clone object one item + * @param {fabric.Object} targetObject - fabric object + * @returns {Promise} + * @private + */ + }, { + key: "_cloneObjectItem", + value: function(A) { + var D = this; + return this._copyFabricObjectForPaste(A).then(function(I) { + var k = D.createObjectProperties(I); + return D.add(I), D.fire(Re.ADD_OBJECT, k), I; + }); + } + /** + * Copy fabric object with Changed position for copy and paste + * @param {fabric.Object} targetObject - fabric object + * @returns {Promise} + * @private + */ + }, { + key: "_copyFabricObjectForPaste", + value: function(A) { + var D = this, I = function(B, H) { + return H ? B - Jm : B + Jm; + }; + return this._copyFabricObject(A).then(function(k) { + var B = k.left, H = k.top, Y = k.width, W = k.height, q = D.getCanvasSize(), ie = q.width, Se = q.height, Ce = B + Y / 2, De = H + W / 2; + return k.set(te()({ + left: I(B, Ce + Jm > ie), + top: I(H, De + Jm > Se) + }, wi.SELECTION_STYLE)), k; + }); + } + /** + * Copy fabric object + * @param {fabric.Object} targetObject - fabric object + * @returns {Promise} + * @private + */ + }, { + key: "_copyFabricObject", + value: function(A) { + var D = this; + return new (xe())(function(I) { + A.clone(function(k) { + var B = D.getComponent(tt.SHAPE); + Qi(k) && B.processForCopiedObject(k, A), I(k); + }); + }); + } + /** + * Get current dimensions + * @returns {object} + */ + }, { + key: "getCurrentDimensions", + value: function() { + var A = this.getComponent(tt.RESIZE); + return A.getCurrentDimensions(); + } + /** + * Get original dimensions + * @returns {object} + */ + }, { + key: "getOriginalDimensions", + value: function() { + var A = this.getComponent(tt.RESIZE); + return A.getOriginalDimensions(); + } + /** + * Set original dimensions + * @param {object} dimensions - Dimensions + */ + }, { + key: "setOriginalDimensions", + value: function(A) { + var D = this.getComponent(tt.RESIZE); + D.setOriginalDimensions(A); + } + /** + * Resize Image + * @param {Object} dimensions - Resize dimensions + * @returns {Promise} + */ + }, { + key: "resize", + value: function(A) { + var D = this.getComponent(tt.RESIZE); + return D.resize(A); + } + }]), V; + }(); + Ae().mixin(MM); + var bW = MM, xW = Re.MOUSE_DOWN, SW = Re.OBJECT_MOVED, wW = Re.OBJECT_SCALED, CW = Re.OBJECT_ACTIVATED, TW = Re.OBJECT_ROTATED, DM = Re.OBJECT_ADDED, IW = Re.OBJECT_MODIFIED, AW = Re.ADD_TEXT, EW = Re.ADD_OBJECT, MW = Re.TEXT_EDITING, DW = Re.TEXT_CHANGED, kW = Re.ICON_CREATE_RESIZE, OW = Re.ICON_CREATE_END, kM = Re.SELECTION_CLEARED, OM = Re.SELECTION_CREATED, LW = Re.ADD_OBJECT_AFTER, Wx = /* @__PURE__ */ function() { + function V(L, A) { + var D, I, k, B, H, Y, W, q, ie, Se, Ce, De, Ee, Le, rt, Pt; + if (G(this, V), A = te()({ + includeUI: !1, + usageStatistics: !0 + }, A), this.mode = null, this.activeObjectId = null, A.includeUI) { + var zt = A.includeUI; + zt.usageStatistics = A.usageStatistics, this.ui = new xv(L, zt, this.getActions()), A = this.ui.setUiDefaultSelectionStyle(A); + } + this._invoker = new In(), this._graphics = new bW(this.ui ? this.ui.getEditorArea() : L, { + cssMaxWidth: A.cssMaxWidth, + cssMaxHeight: A.cssMaxHeight + }), this._handlers = { + keydown: ne()(D = this._onKeyDown).call(D, this), + mousedown: ne()(I = this._onMouseDown).call(I, this), + objectActivated: ne()(k = this._onObjectActivated).call(k, this), + objectMoved: ne()(B = this._onObjectMoved).call(B, this), + objectScaled: ne()(H = this._onObjectScaled).call(H, this), + objectRotated: ne()(Y = this._onObjectRotated).call(Y, this), + objectAdded: ne()(W = this._onObjectAdded).call(W, this), + objectModified: ne()(q = this._onObjectModified).call(q, this), + createdPath: this._onCreatedPath, + addText: ne()(ie = this._onAddText).call(ie, this), + addObject: ne()(Se = this._onAddObject).call(Se, this), + textEditing: ne()(Ce = this._onTextEditing).call(Ce, this), + textChanged: ne()(De = this._onTextChanged).call(De, this), + iconCreateResize: ne()(Ee = this._onIconCreateResize).call(Ee, this), + iconCreateEnd: ne()(Le = this._onIconCreateEnd).call(Le, this), + selectionCleared: ne()(rt = this._selectionCleared).call(rt, this), + selectionCreated: ne()(Pt = this._selectionCreated).call(Pt, this) + }, this._attachInvokerEvents(), this._attachGraphicsEvents(), this._attachDomEvents(), this._setSelectionStyle(A.selectionStyle, { + applyCropSelectionStyle: A.applyCropSelectionStyle, + applyGroupSelectionStyle: A.applyGroupSelectionStyle + }), A.usageStatistics && Cn(), this.ui && (this.ui.initCanvas(), this.setReAction(), this._attachColorPickerInputBoxEvents()), de.fabric.enableGLFiltering = !1; + } + return ee(V, [{ + key: "_attachColorPickerInputBoxEvents", + value: function() { + var A = this; + this.ui.on(Re.INPUT_BOX_EDITING_STARTED, function() { + A.isColorPickerInputBoxEditing = !0; + }), this.ui.on(Re.INPUT_BOX_EDITING_STOPPED, function() { + A.isColorPickerInputBoxEditing = !1; + }); + } + }, { + key: "_detachColorPickerInputBoxEvents", + value: function() { + this.ui.off(Re.INPUT_BOX_EDITING_STARTED), this.ui.off(Re.INPUT_BOX_EDITING_STOPPED); + } + /** + * Set selection style by init option + * @param {Object} selectionStyle - Selection styles + * @param {Object} applyTargets - Selection apply targets + * @param {boolean} applyCropSelectionStyle - whether apply with crop selection style or not + * @param {boolean} applyGroupSelectionStyle - whether apply with group selection style or not + * @private + */ + }, { + key: "_setSelectionStyle", + value: function(A, D) { + var I = D.applyCropSelectionStyle, k = D.applyGroupSelectionStyle; + A && this._graphics.setSelectionStyle(A), I && this._graphics.setCropSelectionStyle(A), k && this.on("selectionCreated", function(B) { + B.type === "activeSelection" && B.set(A); + }); + } + /** + * Attach invoker events + * @private + */ + }, { + key: "_attachInvokerEvents", + value: function() { + var A, D, I = this, k = Re.UNDO_STACK_CHANGED, B = Re.REDO_STACK_CHANGED, H = Re.EXECUTE_COMMAND, Y = Re.AFTER_UNDO, W = Re.AFTER_REDO, q = Re.HAND_STARTED, ie = Re.HAND_STOPPED; + if (this._invoker.on(k, ne()(A = this.fire).call(A, this, k)), this._invoker.on(B, ne()(D = this.fire).call(D, this, B)), this.ui) { + var Se = this._graphics.getCanvas(); + this._invoker.on(H, function(Ce) { + return I.ui.fire(H, Ce); + }), this._invoker.on(Y, function(Ce) { + return I.ui.fire(Y, Ce); + }), this._invoker.on(W, function(Ce) { + return I.ui.fire(W, Ce); + }), Se.on(q, function() { + return I.ui.fire(q); + }), Se.on(ie, function() { + return I.ui.fire(ie); + }); + } + } + /** + * Attach canvas events + * @private + */ + }, { + key: "_attachGraphicsEvents", + value: function() { + var A; + this._graphics.on((A = {}, $(A, xW, this._handlers.mousedown), $(A, SW, this._handlers.objectMoved), $(A, wW, this._handlers.objectScaled), $(A, TW, this._handlers.objectRotated), $(A, CW, this._handlers.objectActivated), $(A, DM, this._handlers.objectAdded), $(A, IW, this._handlers.objectModified), $(A, AW, this._handlers.addText), $(A, EW, this._handlers.addObject), $(A, MW, this._handlers.textEditing), $(A, DW, this._handlers.textChanged), $(A, kW, this._handlers.iconCreateResize), $(A, OW, this._handlers.iconCreateEnd), $(A, kM, this._handlers.selectionCleared), $(A, OM, this._handlers.selectionCreated), A)); + } + /** + * Attach dom events + * @private + */ + }, { + key: "_attachDomEvents", + value: function() { + document.addEventListener("keydown", this._handlers.keydown); + } + /** + * Detach dom events + * @private + */ + }, { + key: "_detachDomEvents", + value: function() { + document.removeEventListener("keydown", this._handlers.keydown); + } + /** + * Keydown event handler + * @param {KeyboardEvent} e - Event object + * @private + */ + /* eslint-disable complexity */ + }, { + key: "_onKeyDown", + value: function(A) { + var D = A.ctrlKey, I = A.keyCode, k = A.metaKey, B = D || k; + B && (I === Vt.C ? this._graphics.resetTargetObjectForCopyPaste() : I === Vt.V ? (this._graphics.pasteObject(), this.clearRedoStack()) : I === Vt.Z ? this.undo().catch(function() { + }) : I === Vt.Y && this.redo().catch(function() { + })); + var H = I === Vt.BACKSPACE || I === Vt.DEL, Y = this._graphics.isReadyRemoveObject(); + !this.isColorPickerInputBoxEditing && Y && H && (A.preventDefault(), this.removeActiveObject()); + } + /** + * Remove Active Object + */ + }, { + key: "removeActiveObject", + value: function() { + var A = this._graphics.getActiveObjectIdForRemove(); + this.removeObject(A); + } + /** + * mouse down event handler + * @param {Event} event - mouse down event + * @param {Object} originPointer - origin pointer + * @param {Number} originPointer.x x position + * @param {Number} originPointer.y y position + * @private + */ + }, { + key: "_onMouseDown", + value: function(A, D) { + this.fire(Re.MOUSE_DOWN, A, D); + } + /** + * Add a 'addObject' command + * @param {Object} obj - Fabric object + * @private + */ + }, { + key: "_pushAddObjectCommand", + value: function(A) { + var D = Ir.create(ct.ADD_OBJECT, this._graphics, A); + this._invoker.pushUndoStack(D); + } + /** + * Add a 'changeSelection' command + * @param {fabric.Object} obj - selection object + * @private + */ + }, { + key: "_pushModifyObjectCommand", + value: function(A) { + var D = this, I = A.type, k = Gx(A, function(H) { + return Ux(D._graphics.getObjectId(H), H, I === "activeSelection"); + }), B = Ir.create(ct.CHANGE_SELECTION, this._graphics, k); + B.execute(this._graphics, k), this._invoker.pushUndoStack(B); + } + /** + * 'objectActivated' event handler + * @param {ObjectProps} props - object properties + * @private + */ + }, { + key: "_onObjectActivated", + value: function(A) { + this.fire(Re.OBJECT_ACTIVATED, A); + } + /** + * 'objectMoved' event handler + * @param {ObjectProps} props - object properties + * @private + */ + }, { + key: "_onObjectMoved", + value: function(A) { + this.fire(Re.OBJECT_MOVED, A); + } + /** + * 'objectScaled' event handler + * @param {ObjectProps} props - object properties + * @private + */ + }, { + key: "_onObjectScaled", + value: function(A) { + this.fire(Re.OBJECT_SCALED, A); + } + /** + * 'objectRotated' event handler + * @param {ObjectProps} props - object properties + * @private + */ + }, { + key: "_onObjectRotated", + value: function(A) { + this.fire(Re.OBJECT_ROTATED, A); + } + /** + * Get current drawing mode + * @returns {string} + * @example + * // Image editor drawing mode + * // + * // NORMAL: 'NORMAL' + * // CROPPER: 'CROPPER' + * // FREE_DRAWING: 'FREE_DRAWING' + * // LINE_DRAWING: 'LINE_DRAWING' + * // TEXT: 'TEXT' + * // + * if (imageEditor.getDrawingMode() === 'FREE_DRAWING') { + * imageEditor.stopDrawingMode(); + * } + */ + }, { + key: "getDrawingMode", + value: function() { + return this._graphics.getDrawingMode(); + } + /** + * Clear all objects + * @returns {Promise} + * @example + * imageEditor.clearObjects(); + */ + }, { + key: "clearObjects", + value: function() { + return this.execute(ct.CLEAR_OBJECTS); + } + /** + * Deactivate all objects + * @example + * imageEditor.deactivateAll(); + */ + }, { + key: "deactivateAll", + value: function() { + this._graphics.deactivateAll(), this._graphics.renderAll(); + } + /** + * discard selction + * @example + * imageEditor.discardSelection(); + */ + }, { + key: "discardSelection", + value: function() { + this._graphics.discardSelection(); + } + /** + * selectable status change + * @param {boolean} selectable - selectable status + * @example + * imageEditor.changeSelectableAll(false); // or true + */ + }, { + key: "changeSelectableAll", + value: function(A) { + this._graphics.changeSelectableAll(A); + } + /** + * Init history + */ + }, { + key: "_initHistory", + value: function() { + this.ui && this.ui.initHistory(); + } + /** + * Clear history + */ + }, { + key: "_clearHistory", + value: function() { + this.ui && this.ui.clearHistory(); + } + /** + * Invoke command + * @param {String} commandName - Command name + * @param {...*} args - Arguments for creating command + * @returns {Promise} + * @private + */ + }, { + key: "execute", + value: function(A) { + for (var D, I, k, B = arguments.length, H = new Array(B > 1 ? B - 1 : 0), Y = 1; Y < B; Y++) + H[Y - 1] = arguments[Y]; + var W = K()(D = [this._graphics]).call(D, H); + return (I = this._invoker).execute.apply(I, K()(k = [A]).call(k, F(W))); + } + /** + * Invoke command + * @param {String} commandName - Command name + * @param {...*} args - Arguments for creating command + * @returns {Promise} + * @private + */ + }, { + key: "executeSilent", + value: function(A) { + for (var D, I, k, B = arguments.length, H = new Array(B > 1 ? B - 1 : 0), Y = 1; Y < B; Y++) + H[Y - 1] = arguments[Y]; + var W = K()(D = [this._graphics]).call(D, H); + return (I = this._invoker).executeSilent.apply(I, K()(k = [A]).call(k, F(W))); + } + /** + * Undo + * @param {number} [iterationCount=1] - Iteration count of undo + * @returns {Promise} + * @example + * imageEditor.undo(); + */ + }, { + key: "undo", + value: function() { + for (var A = this, D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1, I = xe().resolve(), k = 0; k < D; k += 1) + I = I.then(function() { + return A._invoker.undo(); + }); + return I; + } + /** + * Redo + * @param {number} [iterationCount=1] - Iteration count of redo + * @returns {Promise} + * @example + * imageEditor.redo(); + */ + }, { + key: "redo", + value: function() { + for (var A = this, D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1, I = xe().resolve(), k = 0; k < D; k += 1) + I = I.then(function() { + return A._invoker.redo(); + }); + return I; + } + /** + * Zoom + * @param {number} x - x axis of center point for zoom + * @param {number} y - y axis of center point for zoom + * @param {number} zoomLevel - level of zoom(1.0 ~ 5.0) + */ + }, { + key: "zoom", + value: function(A) { + var D = A.x, I = A.y, k = A.zoomLevel; + this._graphics.zoom({ + x: D, + y: I + }, k); + } + /** + * Reset zoom. Change zoom level to 1.0 + */ + }, { + key: "resetZoom", + value: function() { + this._graphics.resetZoom(); + } + /** + * Load image from file + * @param {File} imgFile - Image file + * @param {string} [imageName] - imageName + * @returns {Promise} + * @example + * imageEditor.loadImageFromFile(file).then(result => { + * console.log('old : ' + result.oldWidth + ', ' + result.oldHeight); + * console.log('new : ' + result.newWidth + ', ' + result.newHeight); + * }); + */ + }, { + key: "loadImageFromFile", + value: function(A, D) { + if (!A) + return xe().reject(wt.invalidParameters); + var I = oe().createObjectURL(A); + return D = D || A.name, this.loadImageFromURL(I, D).then(function(k) { + return oe().revokeObjectURL(A), k; + }); + } + /** + * Load image from url + * @param {string} url - File url + * @param {string} imageName - imageName + * @returns {Promise} + * @example + * imageEditor.loadImageFromURL('http://url/testImage.png', 'lena').then(result => { + * console.log('old : ' + result.oldWidth + ', ' + result.oldHeight); + * console.log('new : ' + result.newWidth + ', ' + result.newHeight); + * }); + */ + }, { + key: "loadImageFromURL", + value: function(A, D) { + return !D || !A ? xe().reject(wt.invalidParameters) : this.execute(ct.LOAD_IMAGE, D, A); + } + /** + * Add image object on canvas + * @param {string} imgUrl - Image url to make object + * @returns {Promise} + * @example + * imageEditor.addImageObject('path/fileName.jpg').then(objectProps => { + * console.log(ojectProps.id); + * }); + */ + }, { + key: "addImageObject", + value: function(A) { + return A ? this.execute(ct.ADD_IMAGE_OBJECT, A) : xe().reject(wt.invalidParameters); + } + /** + * Start a drawing mode. If the current mode is not 'NORMAL', 'stopDrawingMode()' will be called first. + * @param {String} mode Can be one of 'CROPPER', 'FREE_DRAWING', 'LINE_DRAWING', 'TEXT', 'SHAPE' + * @param {Object} [option] parameters of drawing mode, it's available with 'FREE_DRAWING', 'LINE_DRAWING' + * @param {Number} [option.width] brush width + * @param {String} [option.color] brush color + * @param {Object} [option.arrowType] arrow decorate + * @param {string} [option.arrowType.tail] arrow decorate for tail. 'chevron' or 'triangle' + * @param {string} [option.arrowType.head] arrow decorate for head. 'chevron' or 'triangle' + * @returns {boolean} true if success or false + * @example + * imageEditor.startDrawingMode('FREE_DRAWING', { + * width: 10, + * color: 'rgba(255,0,0,0.5)' + * }); + * imageEditor.startDrawingMode('LINE_DRAWING', { + * width: 10, + * color: 'rgba(255,0,0,0.5)', + * arrowType: { + * tail: 'chevron' // triangle + * } + * }); + * + */ + }, { + key: "startDrawingMode", + value: function(A, D) { + return this._graphics.startDrawingMode(A, D); + } + /** + * Stop the current drawing mode and back to the 'NORMAL' mode + * @example + * imageEditor.stopDrawingMode(); + */ + }, { + key: "stopDrawingMode", + value: function() { + this._graphics.stopDrawingMode(); + } + /** + * Crop this image with rect + * @param {Object} rect crop rect + * @param {Number} rect.left left position + * @param {Number} rect.top top position + * @param {Number} rect.width width + * @param {Number} rect.height height + * @returns {Promise} + * @example + * imageEditor.crop(imageEditor.getCropzoneRect()); + */ + }, { + key: "crop", + value: function(A) { + var D = this._graphics.getCroppedImageData(A); + return D ? this.loadImageFromURL(D.url, D.imageName) : xe().reject(wt.invalidParameters); + } + /** + * Get the cropping rect + * @returns {Object} {{left: number, top: number, width: number, height: number}} rect + */ + }, { + key: "getCropzoneRect", + value: function() { + return this._graphics.getCropzoneRect(); + } + /** + * Set the cropping rect + * @param {number} [mode] crop rect mode [1, 1.5, 1.3333333333333333, 1.25, 1.7777777777777777] + */ + }, { + key: "setCropzoneRect", + value: function(A) { + this._graphics.setCropzoneRect(A); + } + /** + * Flip + * @returns {Promise} + * @param {string} type - 'flipX' or 'flipY' or 'reset' + * @returns {Promise} + * @private + */ + }, { + key: "_flip", + value: function(A) { + return this.execute(ct.FLIP_IMAGE, A); + } + /** + * Flip x + * @returns {Promise} + * @example + * imageEditor.flipX().then((status => { + * console.log('flipX: ', status.flipX); + * console.log('flipY: ', status.flipY); + * console.log('angle: ', status.angle); + * }).catch(message => { + * console.log('error: ', message); + * }); + */ + }, { + key: "flipX", + value: function() { + return this._flip("flipX"); + } + /** + * Flip y + * @returns {Promise} + * @example + * imageEditor.flipY().then(status => { + * console.log('flipX: ', status.flipX); + * console.log('flipY: ', status.flipY); + * console.log('angle: ', status.angle); + * }).catch(message => { + * console.log('error: ', message); + * }); + */ + }, { + key: "flipY", + value: function() { + return this._flip("flipY"); + } + /** + * Reset flip + * @returns {Promise} + * @example + * imageEditor.resetFlip().then(status => { + * console.log('flipX: ', status.flipX); + * console.log('flipY: ', status.flipY); + * console.log('angle: ', status.angle); + * }).catch(message => { + * console.log('error: ', message); + * });; + */ + }, { + key: "resetFlip", + value: function() { + return this._flip("reset"); + } + /** + * @param {string} type - 'rotate' or 'setAngle' + * @param {number} angle - angle value (degree) + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @private + */ + }, { + key: "_rotate", + value: function(A, D, I) { + var k = null; + return I ? k = this.executeSilent(ct.ROTATE_IMAGE, A, D) : k = this.execute(ct.ROTATE_IMAGE, A, D), k; + } + /** + * Rotate image + * @returns {Promise} + * @param {number} angle - Additional angle to rotate image + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @example + * imageEditor.rotate(10); // angle = 10 + * imageEditor.rotate(10); // angle = 20 + * imageEditor.rotate(5); // angle = 5 + * imageEditor.rotate(-95); // angle = -90 + * imageEditor.rotate(10).then(status => { + * console.log('angle: ', status.angle); + * })).catch(message => { + * console.log('error: ', message); + * }); + */ + }, { + key: "rotate", + value: function(A, D) { + return this._rotate("rotate", A, D); + } + /** + * Set angle + * @param {number} angle - Angle of image + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @example + * imageEditor.setAngle(10); // angle = 10 + * imageEditor.rotate(10); // angle = 20 + * imageEditor.setAngle(5); // angle = 5 + * imageEditor.rotate(50); // angle = 55 + * imageEditor.setAngle(-40); // angle = -40 + * imageEditor.setAngle(10).then(status => { + * console.log('angle: ', status.angle); + * })).catch(message => { + * console.log('error: ', message); + * }); + */ + }, { + key: "setAngle", + value: function(A, D) { + return this._rotate("setAngle", A, D); + } + /** + * Set drawing brush + * @param {Object} option brush option + * @param {Number} option.width width + * @param {String} option.color color like 'FFFFFF', 'rgba(0, 0, 0, 0.5)' + * @example + * imageEditor.startDrawingMode('FREE_DRAWING'); + * imageEditor.setBrush({ + * width: 12, + * color: 'rgba(0, 0, 0, 0.5)' + * }); + * imageEditor.setBrush({ + * width: 8, + * color: 'FFFFFF' + * }); + */ + }, { + key: "setBrush", + value: function(A) { + this._graphics.setBrush(A); + } + /** + * Set states of current drawing shape + * @param {string} type - Shape type (ex: 'rect', 'circle', 'triangle') + * @param {Object} [options] - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stoke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + * @example + * imageEditor.setDrawingShape('rect', { + * fill: 'red', + * width: 100, + * height: 200 + * }); + * @example + * imageEditor.setDrawingShape('rect', { + * fill: { + * type: 'filter', + * filter: [{blur: 0.3}, {pixelate: 20}] + * }, + * width: 100, + * height: 200 + * }); + * @example + * imageEditor.setDrawingShape('circle', { + * fill: 'transparent', + * stroke: 'blue', + * strokeWidth: 3, + * rx: 10, + * ry: 100 + * }); + * @example + * imageEditor.setDrawingShape('triangle', { // When resizing, the shape keep the 1:1 ratio + * width: 1, + * height: 1, + * isRegular: true + * }); + * @example + * imageEditor.setDrawingShape('circle', { // When resizing, the shape keep the 1:1 ratio + * rx: 10, + * ry: 10, + * isRegular: true + * }); + */ + }, { + key: "setDrawingShape", + value: function(A, D) { + this._graphics.setDrawingShape(A, D); + } + }, { + key: "setDrawingIcon", + value: function(A, D) { + this._graphics.setIconStyle(A, D); + } + /** + * Add shape + * @param {string} type - Shape type (ex: 'rect', 'circle', 'triangle') + * @param {Object} options - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.left] - Shape x position + * @param {number} [options.top] - Shape y position + * @param {boolean} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + * @returns {Promise} + * @example + * imageEditor.addShape('rect', { + * fill: 'red', + * stroke: 'blue', + * strokeWidth: 3, + * width: 100, + * height: 200, + * left: 10, + * top: 10, + * isRegular: true + * }); + * @example + * imageEditor.addShape('circle', { + * fill: 'red', + * stroke: 'blue', + * strokeWidth: 3, + * rx: 10, + * ry: 100, + * isRegular: false + * }).then(objectProps => { + * console.log(objectProps.id); + * }); + * @example + * imageEditor.addShape('rect', { + * fill: { + * type: 'filter', + * filter: [{blur: 0.3}, {pixelate: 20}] + * }, + * stroke: 'blue', + * strokeWidth: 3, + * rx: 10, + * ry: 100, + * isRegular: false + * }).then(objectProps => { + * console.log(objectProps.id); + * }); + */ + }, { + key: "addShape", + value: function(A, D) { + return D = D || {}, this._setPositions(D), this.execute(ct.ADD_SHAPE, A, D); + } + /** + * Change shape + * @param {number} id - object id + * @param {Object} options - Shape options + * @param {(ShapeFillOption | string)} [options.fill] - {@link ShapeFillOption} or + * Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {boolean} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @example + * // call after selecting shape object on canvas + * imageEditor.changeShape(id, { // change rectagle or triangle + * fill: 'red', + * stroke: 'blue', + * strokeWidth: 3, + * width: 100, + * height: 200 + * }); + * @example + * // call after selecting shape object on canvas + * imageEditor.changeShape(id, { // change circle + * fill: 'red', + * stroke: 'blue', + * strokeWidth: 3, + * rx: 10, + * ry: 100 + * }); + */ + }, { + key: "changeShape", + value: function(A, D, I) { + var k = I ? "executeSilent" : "execute"; + return this[k](ct.CHANGE_SHAPE, A, D); + } + /** + * Add text on image + * @param {string} text - Initial input text + * @param {Object} [options] Options for generating text + * @param {Object} [options.styles] Initial styles + * @param {string} [options.styles.fill] Color + * @param {string} [options.styles.fontFamily] Font type for text + * @param {number} [options.styles.fontSize] Size + * @param {string} [options.styles.fontStyle] Type of inclination (normal / italic) + * @param {string} [options.styles.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [options.styles.textAlign] Type of text align (left / center / right) + * @param {string} [options.styles.textDecoration] Type of line (underline / line-through / overline) + * @param {{x: number, y: number}} [options.position] - Initial position + * @param {boolean} [options.autofocus] - text autofocus, default is true + * @returns {Promise} + * @example + * imageEditor.addText('init text'); + * @example + * imageEditor.addText('init text', { + * styles: { + * fill: '#000', + * fontSize: 20, + * fontWeight: 'bold' + * }, + * position: { + * x: 10, + * y: 10 + * } + * }).then(objectProps => { + * console.log(objectProps.id); + * }); + */ + }, { + key: "addText", + value: function(A, D) { + return A = A || "", D = D || {}, this.execute(ct.ADD_TEXT, A, D); + } + /** + * Change contents of selected text object on image + * @param {number} id - object id + * @param {string} text - Changing text + * @returns {Promise} + * @example + * imageEditor.changeText(id, 'change text'); + */ + }, { + key: "changeText", + value: function(A, D) { + return D = D || "", this.execute(ct.CHANGE_TEXT, A, D); + } + /** + * Set style + * @param {number} id - object id + * @param {Object} styleObj - text styles + * @param {string} [styleObj.fill] Color + * @param {string} [styleObj.fontFamily] Font type for text + * @param {number} [styleObj.fontSize] Size + * @param {string} [styleObj.fontStyle] Type of inclination (normal / italic) + * @param {string} [styleObj.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [styleObj.textAlign] Type of text align (left / center / right) + * @param {string} [styleObj.textDecoration] Type of line (underline / line-through / overline) + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @example + * imageEditor.changeTextStyle(id, { + * fontStyle: 'italic' + * }); + */ + }, { + key: "changeTextStyle", + value: function(A, D, I) { + var k = I ? "executeSilent" : "execute"; + return this[k](ct.CHANGE_TEXT_STYLE, A, D); + } + /** + * change text mode + * @param {string} type - change type + * @private + */ + }, { + key: "_changeActivateMode", + value: function(A) { + A !== "ICON" && this.getDrawingMode() !== A && this.startDrawingMode(A); + } + /** + * 'textChanged' event handler + * @param {Object} target - changed text object + * @private + */ + }, { + key: "_onTextChanged", + value: function(A) { + this.fire(Re.TEXT_CHANGED, A); + } + /** + * 'iconCreateResize' event handler + * @param {Object} originPointer origin pointer + * @param {Number} originPointer.x x position + * @param {Number} originPointer.y y position + * @private + */ + }, { + key: "_onIconCreateResize", + value: function(A) { + this.fire(Re.ICON_CREATE_RESIZE, A); + } + /** + * 'iconCreateEnd' event handler + * @param {Object} originPointer origin pointer + * @param {Number} originPointer.x x position + * @param {Number} originPointer.y y position + * @private + */ + }, { + key: "_onIconCreateEnd", + value: function(A) { + this.fire(Re.ICON_CREATE_END, A); + } + /** + * 'textEditing' event handler + * @private + */ + }, { + key: "_onTextEditing", + value: function() { + this.fire(Re.TEXT_EDITING); + } + /** + * Mousedown event handler in case of 'TEXT' drawing mode + * @param {fabric.Event} event - Current mousedown event object + * @private + */ + }, { + key: "_onAddText", + value: function(A) { + this.fire(Re.ADD_TEXT, { + originPosition: A.originPosition, + clientPosition: A.clientPosition + }); + } + /** + * 'addObject' event handler + * @param {Object} objectProps added object properties + * @private + */ + }, { + key: "_onAddObject", + value: function(A) { + var D = this._graphics.getObject(A.id); + this._invoker.fire(Re.EXECUTE_COMMAND, Hr(D.type)), this._pushAddObjectCommand(D); + } + /** + * 'objectAdded' event handler + * @param {Object} objectProps added object properties + * @private + */ + }, { + key: "_onObjectAdded", + value: function(A) { + this.fire(DM, A), this.fire(LW, A); + } + /** + * 'objectModified' event handler + * @param {fabric.Object} obj - selection object + * @private + */ + }, { + key: "_onObjectModified", + value: function(A) { + A.type !== st.CROPZONE && (this._invoker.fire(Re.EXECUTE_COMMAND, Hr(A.type)), this._pushModifyObjectCommand(A)); + } + /** + * 'selectionCleared' event handler + * @private + */ + }, { + key: "_selectionCleared", + value: function() { + this.fire(kM); + } + /** + * 'selectionCreated' event handler + * @param {Object} eventTarget - Fabric object + * @private + */ + }, { + key: "_selectionCreated", + value: function(A) { + this.fire(OM, A); + } + /** + * Register custom icons + * @param {{iconType: string, pathValue: string}} infos - Infos to register icons + * @example + * imageEditor.registerIcons({ + * customIcon: 'M 0 0 L 20 20 L 10 10 Z', + * customArrow: 'M 60 0 L 120 60 H 90 L 75 45 V 180 H 45 V 45 L 30 60 H 0 Z' + * }); + */ + }, { + key: "registerIcons", + value: function(A) { + this._graphics.registerPaths(A); + } + /** + * Change canvas cursor type + * @param {string} cursorType - cursor type + * @example + * imageEditor.changeCursor('crosshair'); + */ + }, { + key: "changeCursor", + value: function(A) { + this._graphics.changeCursor(A); + } + /** + * Add icon on canvas + * @param {string} type - Icon type ('arrow', 'cancel', custom icon name) + * @param {Object} options - Icon options + * @param {string} [options.fill] - Icon foreground color + * @param {number} [options.left] - Icon x position + * @param {number} [options.top] - Icon y position + * @returns {Promise} + * @example + * imageEditor.addIcon('arrow'); // The position is center on canvas + * @example + * imageEditor.addIcon('arrow', { + * left: 100, + * top: 100 + * }).then(objectProps => { + * console.log(objectProps.id); + * }); + */ + }, { + key: "addIcon", + value: function(A, D) { + return D = D || {}, this._setPositions(D), this.execute(ct.ADD_ICON, A, D); + } + /** + * Change icon color + * @param {number} id - object id + * @param {string} color - Color for icon + * @returns {Promise} + * @example + * imageEditor.changeIconColor(id, '#000000'); + */ + }, { + key: "changeIconColor", + value: function(A, D) { + return this.execute(ct.CHANGE_ICON_COLOR, A, D); + } + /** + * Remove an object or group by id + * @param {number} id - object id + * @returns {Promise} + * @example + * imageEditor.removeObject(id); + */ + }, { + key: "removeObject", + value: function(A) { + var D = this._graphics.getObject(A), I = D.type; + return this.execute(ct.REMOVE_OBJECT, A, Hr(I)); + } + /** + * Whether it has the filter or not + * @param {string} type - Filter type + * @returns {boolean} true if it has the filter + */ + }, { + key: "hasFilter", + value: function(A) { + return this._graphics.hasFilter(A); + } + /** + * Remove filter on canvas image + * @param {string} type - Filter type + * @returns {Promise} + * @example + * imageEditor.removeFilter('Grayscale').then(obj => { + * console.log('filterType: ', obj.type); + * console.log('actType: ', obj.action); + * }).catch(message => { + * console.log('error: ', message); + * }); + */ + }, { + key: "removeFilter", + value: function(A) { + return this.execute(ct.REMOVE_FILTER, A); + } + /** + * Apply filter on canvas image + * @param {string} type - Filter type + * @param {object} options - Options to apply filter + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + * @example + * imageEditor.applyFilter('Grayscale'); + * @example + * imageEditor.applyFilter('mask', {maskObjId: id}).then(obj => { + * console.log('filterType: ', obj.type); + * console.log('actType: ', obj.action); + * }).catch(message => { + * console.log('error: ', message); + * });; + */ + }, { + key: "applyFilter", + value: function(A, D, I) { + var k = I ? "executeSilent" : "execute"; + return this[k](ct.APPLY_FILTER, A, D); + } + /** + * Get data url + * @param {Object} options - options for toDataURL + * @param {String} [options.format=png] The format of the output image. Either "jpeg" or "png" + * @param {Number} [options.quality=1] Quality level (0..1). Only used for jpeg. + * @param {Number} [options.multiplier=1] Multiplier to scale by + * @param {Number} [options.left] Cropping left offset. Introduced in fabric v1.2.14 + * @param {Number} [options.top] Cropping top offset. Introduced in fabric v1.2.14 + * @param {Number} [options.width] Cropping width. Introduced in fabric v1.2.14 + * @param {Number} [options.height] Cropping height. Introduced in fabric v1.2.14 + * @returns {string} A DOMString containing the requested data URI + * @example + * imgEl.src = imageEditor.toDataURL(); + * + * imageEditor.loadImageFromURL(imageEditor.toDataURL(), 'FilterImage').then(() => { + * imageEditor.addImageObject(imgUrl); + * }); + */ + }, { + key: "toDataURL", + value: function(A) { + return this._graphics.toDataURL(A); + } + /** + * Get image name + * @returns {string} image name + * @example + * console.log(imageEditor.getImageName()); + */ + }, { + key: "getImageName", + value: function() { + return this._graphics.getImageName(); + } + /** + * Clear undoStack + * @example + * imageEditor.clearUndoStack(); + */ + }, { + key: "clearUndoStack", + value: function() { + this._invoker.clearUndoStack(); + } + /** + * Clear redoStack + * @example + * imageEditor.clearRedoStack(); + */ + }, { + key: "clearRedoStack", + value: function() { + this._invoker.clearRedoStack(); + } + /** + * Whehter the undo stack is empty or not + * @returns {boolean} + * imageEditor.isEmptyUndoStack(); + */ + }, { + key: "isEmptyUndoStack", + value: function() { + return this._invoker.isEmptyUndoStack(); + } + /** + * Whehter the redo stack is empty or not + * @returns {boolean} + * imageEditor.isEmptyRedoStack(); + */ + }, { + key: "isEmptyRedoStack", + value: function() { + return this._invoker.isEmptyRedoStack(); + } + /** + * Resize canvas dimension + * @param {{width: number, height: number}} dimension - Max width & height + * @returns {Promise} + */ + }, { + key: "resizeCanvasDimension", + value: function(A) { + return A ? this.execute(ct.RESIZE_CANVAS_DIMENSION, A) : xe().reject(wt.invalidParameters); + } + /** + * Destroy + */ + }, { + key: "destroy", + value: function() { + var A = this; + this.stopDrawingMode(), this._detachDomEvents(), this._graphics.destroy(), this._graphics = null, this.ui && (this._detachColorPickerInputBoxEvents(), this.ui.destroy()), le()(this, function(D, I) { + A[I] = null; + }, this); + } + /** + * Set position + * @param {Object} options - Position options (left or top) + * @private + */ + }, { + key: "_setPositions", + value: function(A) { + var D = this._graphics.getCenter(); + re()(A.left) && (A.left = D.left), re()(A.top) && (A.top = D.top); + } + /** + * Set properties of active object + * @param {number} id - object id + * @param {Object} keyValue - key & value + * @returns {Promise} + * @example + * imageEditor.setObjectProperties(id, { + * left:100, + * top:100, + * width: 200, + * height: 200, + * opacity: 0.5 + * }); + */ + }, { + key: "setObjectProperties", + value: function(A, D) { + return this.execute(ct.SET_OBJECT_PROPERTIES, A, D); + } + /** + * Set properties of active object, Do not leave an invoke history. + * @param {number} id - object id + * @param {Object} keyValue - key & value + * @example + * imageEditor.setObjectPropertiesQuietly(id, { + * left:100, + * top:100, + * width: 200, + * height: 200, + * opacity: 0.5 + * }); + */ + }, { + key: "setObjectPropertiesQuietly", + value: function(A, D) { + this._graphics.setObjectProperties(A, D); + } + /** + * Get properties of active object corresponding key + * @param {number} id - object id + * @param {Array|ObjectProps|string} keys - property's key + * @returns {ObjectProps} properties if id is valid or null + * @example + * var props = imageEditor.getObjectProperties(id, 'left'); + * console.log(props); + * @example + * var props = imageEditor.getObjectProperties(id, ['left', 'top', 'width', 'height']); + * console.log(props); + * @example + * var props = imageEditor.getObjectProperties(id, { + * left: null, + * top: null, + * width: null, + * height: null, + * opacity: null + * }); + * console.log(props); + */ + }, { + key: "getObjectProperties", + value: function(A, D) { + var I = this._graphics.getObject(A); + return I ? this._graphics.getObjectProperties(A, D) : null; + } + /** + * Get the canvas size + * @returns {Object} {{width: number, height: number}} canvas size + * @example + * var canvasSize = imageEditor.getCanvasSize(); + * console.log(canvasSize.width); + * console.height(canvasSize.height); + */ + }, { + key: "getCanvasSize", + value: function() { + return this._graphics.getCanvasSize(); + } + /** + * Get object position by originX, originY + * @param {number} id - object id + * @param {string} originX - can be 'left', 'center', 'right' + * @param {string} originY - can be 'top', 'center', 'bottom' + * @returns {Object} {{x:number, y: number}} position by origin if id is valid, or null + * @example + * var position = imageEditor.getObjectPosition(id, 'left', 'top'); + * console.log(position); + */ + }, { + key: "getObjectPosition", + value: function(A, D, I) { + return this._graphics.getObjectPosition(A, D, I); + } + /** + * Set object position by originX, originY + * @param {number} id - object id + * @param {Object} posInfo - position object + * @param {number} posInfo.x - x position + * @param {number} posInfo.y - y position + * @param {string} posInfo.originX - can be 'left', 'center', 'right' + * @param {string} posInfo.originY - can be 'top', 'center', 'bottom' + * @returns {Promise} + * @example + * // align the object to 'left', 'top' + * imageEditor.setObjectPosition(id, { + * x: 0, + * y: 0, + * originX: 'left', + * originY: 'top' + * }); + * @example + * // align the object to 'right', 'top' + * var canvasSize = imageEditor.getCanvasSize(); + * imageEditor.setObjectPosition(id, { + * x: canvasSize.width, + * y: 0, + * originX: 'right', + * originY: 'top' + * }); + * @example + * // align the object to 'left', 'bottom' + * var canvasSize = imageEditor.getCanvasSize(); + * imageEditor.setObjectPosition(id, { + * x: 0, + * y: canvasSize.height, + * originX: 'left', + * originY: 'bottom' + * }); + * @example + * // align the object to 'right', 'bottom' + * var canvasSize = imageEditor.getCanvasSize(); + * imageEditor.setObjectPosition(id, { + * x: canvasSize.width, + * y: canvasSize.height, + * originX: 'right', + * originY: 'bottom' + * }); + */ + }, { + key: "setObjectPosition", + value: function(A, D) { + return this.execute(ct.SET_OBJECT_POSITION, A, D); + } + /** + * @param {object} dimensions - Image Dimensions + * @returns {Promise} + */ + }, { + key: "resize", + value: function(A) { + return this.execute(ct.RESIZE_IMAGE, A); + } + }]), V; + }(); + ai.mixin(Wx), Ae().mixin(Wx); + var PW = Wx, RW = tt.ICON, NW = { + name: ct.ADD_ICON, + /** + * Add an icon + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Icon type ('arrow', 'cancel', custom icon name) + * @param {Object} options - Icon options + * @param {string} [options.fill] - Icon foreground color + * @param {string} [options.left] - Icon x position + * @param {string} [options.top] - Icon y position + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = this, k = L.getComponent(RW); + return k.add(A, D).then(function(B) { + return I.undoData.object = L.getObject(B.id), B; + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.remove(this.undoData.object), xe().resolve(); + } + }; + Ir.register(NW); + var zW = { + name: ct.ADD_IMAGE_OBJECT, + /** + * Add an image object + * @param {Graphics} graphics - Graphics instance + * @param {string} imgUrl - Image url to make object + * @returns {Promise} + */ + execute: function(L, A) { + var D = this; + return L.addImageObject(A).then(function(I) { + return D.undoData.object = L.getObject(I.id), I; + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.remove(this.undoData.object), xe().resolve(); + } + }; + Ir.register(zW); + var BW = { + name: ct.ADD_OBJECT, + /** + * Add an object + * @param {Graphics} graphics - Graphics instance + * @param {Object} object - Fabric object + * @returns {Promise} + */ + execute: function(L, A) { + return new (xe())(function(D, I) { + L.contains(A) ? I(wt.addedObject) : (L.add(A), D(A)); + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @param {Object} object - Fabric object + * @returns {Promise} + */ + undo: function(L, A) { + return new (xe())(function(D, I) { + L.contains(A) ? (L.remove(A), D(A)) : I(wt.noObject); + }); + } + }; + Ir.register(BW); + var jW = tt.SHAPE, FW = { + name: ct.ADD_SHAPE, + /** + * Add a shape + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Shape type (ex: 'rect', 'circle', 'triangle') + * @param {Object} options - Shape options + * @param {string} [options.fill] - Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.left] - Shape x position + * @param {number} [options.top] - Shape y position + * @param {number} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = this, k = L.getComponent(jW); + return k.add(A, D).then(function(B) { + var H = B.id; + return I.undoData.object = L.getObject(H), B; + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.remove(this.undoData.object), xe().resolve(); + } + }; + Ir.register(FW); + var $W = tt.TEXT, HW = { + name: ct.ADD_TEXT, + /** + * Add a text object + * @param {Graphics} graphics - Graphics instance + * @param {string} text - Initial input text + * @param {Object} [options] Options for text styles + * @param {Object} [options.styles] Initial styles + * @param {string} [options.styles.fill] Color + * @param {string} [options.styles.fontFamily] Font type for text + * @param {number} [options.styles.fontSize] Size + * @param {string} [options.styles.fontStyle] Type of inclination (normal / italic) + * @param {string} [options.styles.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [options.styles.textAlign] Type of text align (left / center / right) + * @param {string} [options.styles.textDecoration] Type of line (underline / line-through / overline) + * @param {{x: number, y: number}} [options.position] - Initial position + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = this, k = L.getComponent($W); + if (this.undoData.object) { + var B = this.undoData.object; + return new (xe())(function(H, Y) { + L.contains(B) ? Y(wt.redo) : (L.add(B), H(B)); + }); + } + return k.add(A, D).then(function(H) { + var Y = H.id, W = L.getObject(Y); + return I.undoData.object = W, EM(Gx(W, function() { + return Ux(Y, W, !1); + })), H; + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.remove(this.undoData.object), xe().resolve(); + } + }; + Ir.register(HW); + var LM = tt.FILTER, PM = null; + function VW(V, L, A) { + var D = {}; + return V === "mask" && (D.object = A.mask), D.options = L, D; + } + var GW = { + name: ct.APPLY_FILTER, + /** + * Apply a filter into an image + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Filter type + * @param {Object} options - Filter options + * @param {number} options.maskObjId - masking image object id + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + */ + execute: function(L, A, D, I) { + var k = L.getComponent(LM); + if (A === "mask") { + var B = L.getObject(D.maskObjId); + if (!(B && B.isType("image"))) + return xe().reject(wt.invalidParameters); + te()(D, { + mask: B + }), L.remove(D.mask); + } + if (!this.isRedo) { + var H = k.getOptions(A), Y = VW(A, H, D); + PM = this.setUndoData(Y, PM, I); + } + return k.add(A, D); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Filter type + * @returns {Promise} + */ + undo: function(L, A) { + var D = L.getComponent(LM); + if (A === "mask") { + var I = this.undoData.object; + return L.add(I), L.setActiveObject(I), D.remove(A); + } + return this.undoData.options ? D.add(A, this.undoData.options) : D.remove(A); + } + }; + Ir.register(GW); + var RM = tt.ICON, UW = { + name: ct.CHANGE_ICON_COLOR, + /** + * Change icon color + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {string} color - Color for icon + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = this; + return new (xe())(function(k, B) { + var H = L.getComponent(RM), Y = L.getObject(A); + Y || B(wt.noObject), I.undoData.object = Y, I.undoData.color = H.getColor(Y), H.setColor(D, Y), k(); + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(RM), D = this.undoData, I = D.object, k = D.color; + return A.setColor(k, I), xe().resolve(); + } + }; + Ir.register(UW); + var NM = tt.SHAPE, zM = null; + function WW(V, L) { + var A = { + object: L, + options: {} + }; + return ho()(V, function(D, I) { + A.options[I] = L[I]; + }), A; + } + var YW = { + name: ct.CHANGE_SHAPE, + /** + * Change a shape + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {Object} options - Shape options + * @param {string} [options.fill] - Shape foreground color (ex: '#fff', 'transparent') + * @param {string} [options.stroke] - Shape outline color + * @param {number} [options.strokeWidth] - Shape outline width + * @param {number} [options.width] - Width value (When type option is 'rect', this options can use) + * @param {number} [options.height] - Height value (When type option is 'rect', this options can use) + * @param {number} [options.rx] - Radius x value (When type option is 'circle', this options can use) + * @param {number} [options.ry] - Radius y value (When type option is 'circle', this options can use) + * @param {number} [options.left] - Shape x position + * @param {number} [options.top] - Shape y position + * @param {number} [options.isRegular] - Whether resizing shape has 1:1 ratio or not + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + */ + execute: function(L, A, D, I) { + var k = L.getComponent(NM), B = L.getObject(A); + if (!B) + return xe().reject(wt.noObject); + if (!this.isRedo) { + var H = WW(D, B); + zM = this.setUndoData(H, zM, I); + } + return k.change(B, D); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(NM), D = this.undoData, I = D.object, k = D.options; + return A.change(I, k); + } + }; + Ir.register(YW); + var BM = tt.TEXT, XW = { + name: ct.CHANGE_TEXT, + /** + * Change a text + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {string} text - Changing text + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = L.getComponent(BM), k = L.getObject(A); + return k ? (this.undoData.object = k, this.undoData.text = I.getText(k), I.change(k, D)) : xe().reject(wt.noObject); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(BM), D = this.undoData, I = D.object, k = D.text; + return A.change(I, k); + } + }; + Ir.register(XW); + var jM = tt.TEXT, FM = null; + function ZW(V, L) { + var A = { + object: L, + styles: {} + }; + return ho()(V, function(D, I) { + var k = L[I]; + A.styles[I] = k; + }), A; + } + var JW = { + name: ct.CHANGE_TEXT_STYLE, + /** + * Change text styles + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {Object} styles - text styles + * @param {string} [styles.fill] Color + * @param {string} [styles.fontFamily] Font type for text + * @param {number} [styles.fontSize] Size + * @param {string} [styles.fontStyle] Type of inclination (normal / italic) + * @param {string} [styles.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [styles.textAlign] Type of text align (left / center / right) + * @param {string} [styles.textDecoration] Type of line (underline / line-through / overline) + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + */ + execute: function(L, A, D, I) { + var k = L.getComponent(jM), B = L.getObject(A); + if (!B) + return xe().reject(wt.noObject); + if (!this.isRedo) { + var H = ZW(D, B); + FM = this.setUndoData(H, FM, I); + } + return k.setStyle(B, D); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(jM), D = this.undoData, I = D.object, k = D.styles; + return A.setStyle(I, k); + } + }; + Ir.register(JW); + var KW = { + name: ct.CLEAR_OBJECTS, + /** + * Clear all objects without background (main) image + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + execute: function(L) { + var A = this; + return new (xe())(function(D) { + A.undoData.objects = L.removeAll(), D(); + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + * @ignore + */ + undo: function(L) { + return L.add(this.undoData.objects), xe().resolve(); + } + }; + Ir.register(KW); + var $M = tt.FLIP, QW = { + name: ct.FLIP_IMAGE, + /** + * flip an image + * @param {Graphics} graphics - Graphics instance + * @param {string} type - 'flipX' or 'flipY' or 'reset' + * @returns {Promise} + */ + execute: function(L, A) { + var D = L.getComponent($M); + return this.undoData.setting = D.getCurrentSetting(), D[A](); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent($M); + return A.set(this.undoData.setting); + } + }; + Ir.register(QW); + var HM = tt.IMAGE_LOADER, qW = { + name: ct.LOAD_IMAGE, + /** + * Load a background (main) image + * @param {Graphics} graphics - Graphics instance + * @param {string} imageName - Image name + * @param {string} imgUrl - Image Url + * @returns {Promise} + */ + execute: function(L, A, D) { + var I, k = L.getComponent(HM), B = k.getCanvasImage(), H = B ? B.width : 0, Y = B ? B.height : 0, W = Ll()(I = L.removeAll(!0)).call(I, function(q) { + return q.type !== "cropzone"; + }); + return yt()(W).call(W, function(q) { + q.evented = !0; + }), this.undoData = { + name: k.getImageName(), + image: B, + objects: W + }, k.load(A, D).then(function(q) { + return { + oldWidth: H, + oldHeight: Y, + newWidth: q.width, + newHeight: q.height + }; + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(HM), D = this.undoData, I = D.objects, k = D.name, B = D.image; + return L.removeAll(!0), L.add(I), A.load(k, B); + } + }; + Ir.register(qW); + var VM = tt.FILTER, e9 = { + name: ct.REMOVE_FILTER, + /** + * Remove a filter from an image + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Filter type + * @returns {Promise} + */ + execute: function(L, A) { + var D = L.getComponent(VM); + return this.undoData.options = D.getOptions(A), D.remove(A); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @param {string} type - Filter type + * @returns {Promise} + */ + undo: function(L, A) { + var D = L.getComponent(VM), I = this.undoData.options; + return D.add(A, I); + } + }; + Ir.register(e9); + var t9 = { + name: ct.REMOVE_OBJECT, + /** + * Remove an object + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @returns {Promise} + */ + execute: function(L, A) { + var D = this; + return new (xe())(function(I, k) { + D.undoData.objects = L.removeObjectById(A), D.undoData.objects.length ? I() : k(wt.noObject); + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.add(this.undoData.objects), xe().resolve(); + } + }; + Ir.register(t9); + var r9 = { + name: ct.RESIZE_CANVAS_DIMENSION, + /** + * resize the canvas with given dimension + * @param {Graphics} graphics - Graphics instance + * @param {{width: number, height: number}} dimension - Max width & height + * @returns {Promise} + */ + execute: function(L, A) { + var D = this; + return new (xe())(function(I) { + D.undoData.size = { + width: L.cssMaxWidth, + height: L.cssMaxHeight + }, L.setCssMaxDimension(A), L.adjustCanvasDimension(), I(); + }); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + return L.setCssMaxDimension(this.undoData.size), L.adjustCanvasDimension(), xe().resolve(); + } + }; + Ir.register(r9); + var GM = tt.ROTATION, UM = null; + function n9(V) { + return { + angle: V.getCurrentAngle() + }; + } + var i9 = { + name: ct.ROTATE_IMAGE, + /** + * Rotate an image + * @param {Graphics} graphics - Graphics instance + * @param {string} type - 'rotate' or 'setAngle' + * @param {number} angle - angle value (degree) + * @param {boolean} isSilent - is silent execution or not + * @returns {Promise} + */ + execute: function(L, A, D, I) { + var k = L.getComponent(GM); + if (!this.isRedo) { + var B = n9(k); + UM = this.setUndoData(B, UM, I); + } + return k[A](D); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(GM), D = we(this.args, 3), I = D[1], k = D[2]; + return I === "setAngle" ? A[I](this.undoData.angle) : A.rotate(-k); + } + }; + Ir.register(i9); + var a9 = { + name: ct.SET_OBJECT_PROPERTIES, + /** + * Set object properties + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {Object} props - properties + * @param {string} [props.fill] Color + * @param {string} [props.fontFamily] Font type for text + * @param {number} [props.fontSize] Size + * @param {string} [props.fontStyle] Type of inclination (normal / italic) + * @param {string} [props.fontWeight] Type of thicker or thinner looking (normal / bold) + * @param {string} [props.textAlign] Type of text align (left / center / right) + * @param {string} [props.textDecoration] Type of line (underline / line-through / overline) + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = this, k = L.getObject(A); + return k ? (this.undoData.props = {}, ho()(D, function(B, H) { + I.undoData.props[H] = k[H]; + }), L.setObjectProperties(A, D), xe().resolve()) : xe().reject(wt.noObject); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @returns {Promise} + */ + undo: function(L, A) { + var D = this.undoData.props; + return L.setObjectProperties(A, D), xe().resolve(); + } + }; + Ir.register(a9); + var o9 = { + name: ct.SET_OBJECT_POSITION, + /** + * Set object properties + * @param {Graphics} graphics - Graphics instance + * @param {number} id - object id + * @param {Object} posInfo - position object + * @param {number} posInfo.x - x position + * @param {number} posInfo.y - y position + * @param {string} posInfo.originX - can be 'left', 'center', 'right' + * @param {string} posInfo.originY - can be 'top', 'center', 'bottom' + * @returns {Promise} + */ + execute: function(L, A, D) { + var I = L.getObject(A); + return I ? (this.undoData.objectId = A, this.undoData.props = L.getObjectProperties(A, ["left", "top"]), L.setObjectPosition(A, D), L.renderAll(), xe().resolve()) : xe().reject(wt.noObject); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = this.undoData, D = A.objectId, I = A.props; + return L.setObjectProperties(D, I), L.renderAll(), xe().resolve(); + } + }; + Ir.register(o9); + var s9 = { + name: ct.CHANGE_SELECTION, + execute: function(L, A) { + return this.isRedo ? yt()(A).call(A, function(D) { + L.setObjectProperties(D.id, D); + }) : this.undoData = sW(), xe().resolve(); + }, + undo: function(L) { + var A; + return yt()(A = this.undoData).call(A, function(D) { + L.setObjectProperties(D.id, D); + }), xe().resolve(); + } + }; + Ir.register(s9); + var WM = tt.RESIZE, l9 = { + name: ct.RESIZE_IMAGE, + /** + * Resize an image + * @param {Graphics} graphics - Graphics instance + * @param {object} dimensions - Image Dimensions + * @returns {Promise} + */ + execute: function(L, A) { + var D = L.getComponent(WM), I = D.getOriginalDimensions(); + return I || (I = D.getCurrentDimensions()), this.undoData.dimensions = I, D.resize(A); + }, + /** + * @param {Graphics} graphics - Graphics instance + * @returns {Promise} + */ + undo: function(L) { + var A = L.getComponent(WM); + return A.resize(this.undoData.dimensions); + } + }; + Ir.register(l9); + var u9 = PW; + }(), o = o.default, o; + }() + ); + }); +})($V); +var h0e = $V.exports; +const GN = /* @__PURE__ */ xI(h0e); +class f0e extends $react.Component { + constructor(e) { + super(e), this.rootEl = $react.createRef(), this.props = e; + } + componentDidMount() { + this.rootEl.current !== null && (this.imageEditorInst = new GN(this.rootEl.current, sn({}, this.props))); + } + componentWillUnmount() { + this.imageEditorInst !== void 0 && (this.imageEditorInst.destroy(), this.imageEditorInst = void 0); + } + shouldComponentUpdate(e) { + return JSON.stringify([this.props.includeUI.menu, this.props.includeUI.loadImage]) !== JSON.stringify([e.includeUI.menu, e.includeUI.loadImage]) && (this.imageEditorInst = new GN(this.rootEl.current, sn({}, e))), !1; + } + getInstance() { + return this.imageEditorInst; + } + getRootElement() { + return this.rootEl.current; + } + render() { + return /* @__PURE__ */ Bt("div", { + ref: this.rootEl + }); + } +} +const d0e = { + src: $lowcoder_sdk.withDefault($lowcoder_sdk.StringStateControl, Ye("imageEditor.defaultSrc")), + name: $lowcoder_sdk.withDefault($lowcoder_sdk.StringStateControl, "Example"), + crop: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + flip: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + rotate: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + draw: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + shape: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + icon: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + text: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + mask: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + filter: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + dataURI: $lowcoder_sdk.stringExposingStateControl("dataURI"), + data: $lowcoder_sdk.stringExposingStateControl("data"), + onEvent: $lowcoder_sdk.eventHandlerControl([o0e]), + buttonText: $lowcoder_sdk.withDefault($lowcoder_sdk.StringStateControl, Ye("imageEditor.save")) +}, v0e = (r) => { + var l; + const e = $react.useRef(null), t = $react.useRef(null), n = ["crop", "flip", "rotate", "draw", "shape", "icon", "text", "mask", "filter"], i = /* @__PURE__ */ new Map(); + i.set("crop", r.crop), i.set("flip", r.flip), i.set("rotate", r.rotate), i.set("draw", r.draw), i.set("shape", r.shape), i.set("icon", r.icon), i.set("text", r.text), i.set("mask", r.mask), i.set("filter", r.filter); + let a = n.filter((u) => i.get(u)); + const o = () => { + const u = e.current, c = t.current; + u.imageEditorInst.ui.resizeEditor({ + uiSize: { + width: c == null ? void 0 : c.clientWidth, + height: c == null ? void 0 : c.clientHeight + } + }); + }, s = () => { + let c = e.current.imageEditorInst.toDataURL(); + r.dataURI.onChange(c), r.data.onChange(c.split(",")[1]); + }; + return /* @__PURE__ */ Rn(s0e, { + ref: t, + children: [/* @__PURE__ */ Bt(l0e, { + type: "primary", + onClick: () => { + s(), r.onEvent("save"); + }, + children: r.buttonText.value + }), /* @__PURE__ */ Bt(tj, { + onResize: o, + children: /* @__PURE__ */ Bt("div", { + style: { + width: "100%", + height: "100%" + }, + children: /* @__PURE__ */ Bt(f0e, { + ref: e, + includeUI: { + loadImage: { + path: r.src.value, + name: r.name.value + }, + menu: a, + theme: u0e, + uiSize: { + width: "100%", + height: "100%" + }, + menuBarPosition: "bottom", + locale: (l = Vg.imageEditorLocale) != null ? l : {} + }, + cssMaxWidth: document.documentElement.clientWidth, + cssMaxHeight: document.documentElement.clientHeight, + selectionStyle: { + cornerSize: 50, + rotatingPointOffset: 100 + }, + usageStatistics: !1 + }) + }) + })] + }); +}; +let WT = function() { + return new $lowcoder_sdk.UICompBuilder(d0e, (r) => /* @__PURE__ */ Bt(v0e, sn({}, r))).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.basic, + children: [r.src.propertyView({ + label: Ye("imageEditor.src"), + placeholder: "http://xxx.jpg" + }), r.name.propertyView({ + label: Ye("imageEditor.name") + }), r.buttonText.propertyView({ + label: Ye("imageEditor.buttonText") + })] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.interaction, + children: r.onEvent.getPropertyView() + }), /* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.advanced, + children: [r.crop.propertyView({ + label: "Crop" + }), r.flip.propertyView({ + label: "Flip" + }), r.rotate.propertyView({ + label: "Rotate" + }), r.draw.propertyView({ + label: "Draw" + }), r.shape.propertyView({ + label: "Shape" + }), r.icon.propertyView({ + label: "Icon" + }), r.text.propertyView({ + label: "Text" + }), r.mask.propertyView({ + label: "Mask" + }), r.filter.propertyView({ + label: "Filter" + })] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.layout, + children: $lowcoder_sdk.hiddenPropertyView(r) + })] + })).build(); +}(); +WT = class extends WT { + autoHeight() { + return !1; + } +}; +const p0e = $lowcoder_sdk.withExposingConfigs(WT, [new $lowcoder_sdk.NameConfig("src", Ye("imageEditor.srcDesc")), new $lowcoder_sdk.NameConfig("name", Ye("imageEditor.nameDesc")), new $lowcoder_sdk.NameConfig("dataURI", Ye("imageEditor.dataURIDesc")), new $lowcoder_sdk.NameConfig("data", Ye("imageEditor.dataDesc")), new $lowcoder_sdk.NameConfig("buttonText", Ye("imageEditor.buttonTextDesc")), $lowcoder_sdk.NameConfigHidden]); +var mx, nr, HV, Vd, Ch, UN, VV, GV, ib = {}, UV = [], g0e = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i; +function ec(r, e) { + for (var t in e) + r[t] = e[t]; + return r; +} +function WV(r) { + var e = r.parentNode; + e && e.removeChild(r); +} +function me(r, e, t) { + var n, i, a, o = {}; + for (a in e) + a == "key" ? n = e[a] : a == "ref" ? i = e[a] : o[a] = e[a]; + if (arguments.length > 2 && (o.children = arguments.length > 3 ? mx.call(arguments, 2) : t), typeof r == "function" && r.defaultProps != null) + for (a in r.defaultProps) + o[a] === void 0 && (o[a] = r.defaultProps[a]); + return J0(r, o, n, i, null); +} +function J0(r, e, t, n, i) { + var a = { type: r, props: e, key: t, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: i == null ? ++HV : i }; + return i == null && nr.vnode != null && nr.vnode(a), a; +} +function Da() { + return { current: null }; +} +function Dn(r) { + return r.children; +} +function m0e(r, e, t, n, i) { + var a; + for (a in t) + a === "children" || a === "key" || a in e || ab(r, a, null, t[a], n); + for (a in e) + i && typeof e[a] != "function" || a === "children" || a === "key" || a === "value" || a === "checked" || t[a] === e[a] || ab(r, a, e[a], t[a], n); +} +function WN(r, e, t) { + e[0] === "-" ? r.setProperty(e, t == null ? "" : t) : r[e] = t == null ? "" : typeof t != "number" || g0e.test(e) ? t : t + "px"; +} +function ab(r, e, t, n, i) { + var a; + e: + if (e === "style") + if (typeof t == "string") + r.style.cssText = t; + else { + if (typeof n == "string" && (r.style.cssText = n = ""), n) + for (e in n) + t && e in t || WN(r.style, e, ""); + if (t) + for (e in t) + n && t[e] === n[e] || WN(r.style, e, t[e]); + } + else if (e[0] === "o" && e[1] === "n") + a = e !== (e = e.replace(/Capture$/, "")), e = e.toLowerCase() in r ? e.toLowerCase().slice(2) : e.slice(2), r.l || (r.l = {}), r.l[e + a] = t, t ? n || r.addEventListener(e, a ? XN : YN, a) : r.removeEventListener(e, a ? XN : YN, a); + else if (e !== "dangerouslySetInnerHTML") { + if (i) + e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if (e !== "width" && e !== "height" && e !== "href" && e !== "list" && e !== "form" && e !== "tabIndex" && e !== "download" && e in r) + try { + r[e] = t == null ? "" : t; + break e; + } catch (o) { + } + typeof t == "function" || (t == null || t === !1 && e.indexOf("-") == -1 ? r.removeAttribute(e) : r.setAttribute(e, t)); + } +} +function YN(r) { + Vd = !0; + try { + return this.l[r.type + !1](nr.event ? nr.event(r) : r); + } finally { + Vd = !1; + } +} +function XN(r) { + Vd = !0; + try { + return this.l[r.type + !0](nr.event ? nr.event(r) : r); + } finally { + Vd = !1; + } +} +function bo(r, e) { + this.props = r, this.context = e; +} +function jg(r, e) { + if (e == null) + return r.__ ? jg(r.__, r.__.__k.indexOf(r) + 1) : null; + for (var t; e < r.__k.length; e++) + if ((t = r.__k[e]) != null && t.__e != null) + return t.__e; + return typeof r.type == "function" ? jg(r) : null; +} +function YV(r) { + var e, t; + if ((r = r.__) != null && r.__c != null) { + for (r.__e = r.__c.base = null, e = 0; e < r.__k.length; e++) + if ((t = r.__k[e]) != null && t.__e != null) { + r.__e = r.__c.base = t.__e; + break; + } + return YV(r); + } +} +function y0e(r) { + Vd ? setTimeout(r) : VV(r); +} +function YT(r) { + (!r.__d && (r.__d = !0) && Ch.push(r) && !ob.__r++ || UN !== nr.debounceRendering) && ((UN = nr.debounceRendering) || y0e)(ob); +} +function ob() { + var r, e, t, n, i, a, o, s; + for (Ch.sort(function(l, u) { + return l.__v.__b - u.__v.__b; + }); r = Ch.shift(); ) + r.__d && (e = Ch.length, n = void 0, i = void 0, o = (a = (t = r).__v).__e, (s = t.__P) && (n = [], (i = ec({}, a)).__v = a.__v + 1, XE(s, a, i, t.__n, s.ownerSVGElement !== void 0, a.__h != null ? [o] : null, n, o == null ? jg(a) : o, a.__h), QV(n, a), a.__e != o && YV(a)), Ch.length > e && Ch.sort(function(l, u) { + return l.__v.__b - u.__v.__b; + })); + ob.__r = 0; +} +function XV(r, e, t, n, i, a, o, s, l, u) { + var c, h, f, v, b, w, p, d = n && n.__k || UV, m = d.length; + for (t.__k = [], c = 0; c < e.length; c++) + if ((v = t.__k[c] = (v = e[c]) == null || typeof v == "boolean" ? null : typeof v == "string" || typeof v == "number" || typeof v == "bigint" ? J0(null, v, null, null, v) : Array.isArray(v) ? J0(Dn, { children: v }, null, null, null) : v.__b > 0 ? J0(v.type, v.props, v.key, v.ref ? v.ref : null, v.__v) : v) != null) { + if (v.__ = t, v.__b = t.__b + 1, (f = d[c]) === null || f && v.key == f.key && v.type === f.type) + d[c] = void 0; + else + for (h = 0; h < m; h++) { + if ((f = d[h]) && v.key == f.key && v.type === f.type) { + d[h] = void 0; + break; + } + f = null; + } + XE(r, v, f = f || ib, i, a, o, s, l, u), b = v.__e, (h = v.ref) && f.ref != h && (p || (p = []), f.ref && p.push(f.ref, null, v), p.push(h, v.__c || b, v)), b != null ? (w == null && (w = b), typeof v.type == "function" && v.__k === f.__k ? v.__d = l = ZV(v, l, r) : l = JV(r, v, f, d, b, l), typeof t.type == "function" && (t.__d = l)) : l && f.__e == l && l.parentNode != r && (l = jg(f)); + } + for (t.__e = w, c = m; c--; ) + d[c] != null && (typeof t.type == "function" && d[c].__e != null && d[c].__e == t.__d && (t.__d = KV(n).nextSibling), eG(d[c], d[c])); + if (p) + for (c = 0; c < p.length; c++) + qV(p[c], p[++c], p[++c]); +} +function ZV(r, e, t) { + for (var n, i = r.__k, a = 0; i && a < i.length; a++) + (n = i[a]) && (n.__ = r, e = typeof n.type == "function" ? ZV(n, e, t) : JV(t, n, n, i, n.__e, e)); + return e; +} +function sb(r, e) { + return e = e || [], r == null || typeof r == "boolean" || (Array.isArray(r) ? r.some(function(t) { + sb(t, e); + }) : e.push(r)), e; +} +function JV(r, e, t, n, i, a) { + var o, s, l; + if (e.__d !== void 0) + o = e.__d, e.__d = void 0; + else if (t == null || i != a || i.parentNode == null) + e: + if (a == null || a.parentNode !== r) + r.appendChild(i), o = null; + else { + for (s = a, l = 0; (s = s.nextSibling) && l < n.length; l += 1) + if (s == i) + break e; + r.insertBefore(i, a), o = a; + } + return o !== void 0 ? o : i.nextSibling; +} +function KV(r) { + var e, t, n; + if (r.type == null || typeof r.type == "string") + return r.__e; + if (r.__k) { + for (e = r.__k.length - 1; e >= 0; e--) + if ((t = r.__k[e]) && (n = KV(t))) + return n; + } + return null; +} +function XE(r, e, t, n, i, a, o, s, l) { + var u, c, h, f, v, b, w, p, d, m, _, y, x, g, S, T = e.type; + if (e.constructor !== void 0) + return null; + t.__h != null && (l = t.__h, s = e.__e = t.__e, e.__h = null, a = [s]), (u = nr.__b) && u(e); + try { + e: + if (typeof T == "function") { + if (p = e.props, d = (u = T.contextType) && n[u.__c], m = u ? d ? d.props.value : u.__ : n, t.__c ? w = (c = e.__c = t.__c).__ = c.__E : ("prototype" in T && T.prototype.render ? e.__c = c = new T(p, m) : (e.__c = c = new bo(p, m), c.constructor = T, c.render = b0e), d && d.sub(c), c.props = p, c.state || (c.state = {}), c.context = m, c.__n = n, h = c.__d = !0, c.__h = [], c._sb = []), c.__s == null && (c.__s = c.state), T.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = ec({}, c.__s)), ec(c.__s, T.getDerivedStateFromProps(p, c.__s))), f = c.props, v = c.state, c.__v = e, h) + T.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), c.componentDidMount != null && c.__h.push(c.componentDidMount); + else { + if (T.getDerivedStateFromProps == null && p !== f && c.componentWillReceiveProps != null && c.componentWillReceiveProps(p, m), !c.__e && c.shouldComponentUpdate != null && c.shouldComponentUpdate(p, c.__s, m) === !1 || e.__v === t.__v) { + for (e.__v !== t.__v && (c.props = p, c.state = c.__s, c.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(C) { + C && (C.__ = e); + }), _ = 0; _ < c._sb.length; _++) + c.__h.push(c._sb[_]); + c._sb = [], c.__h.length && o.push(c); + break e; + } + c.componentWillUpdate != null && c.componentWillUpdate(p, c.__s, m), c.componentDidUpdate != null && c.__h.push(function() { + c.componentDidUpdate(f, v, b); + }); + } + if (c.context = m, c.props = p, c.__P = r, y = nr.__r, x = 0, "prototype" in T && T.prototype.render) { + for (c.state = c.__s, c.__d = !1, y && y(e), u = c.render(c.props, c.state, c.context), g = 0; g < c._sb.length; g++) + c.__h.push(c._sb[g]); + c._sb = []; + } else + do + c.__d = !1, y && y(e), u = c.render(c.props, c.state, c.context), c.state = c.__s; + while (c.__d && ++x < 25); + c.state = c.__s, c.getChildContext != null && (n = ec(ec({}, n), c.getChildContext())), h || c.getSnapshotBeforeUpdate == null || (b = c.getSnapshotBeforeUpdate(f, v)), S = u != null && u.type === Dn && u.key == null ? u.props.children : u, XV(r, Array.isArray(S) ? S : [S], e, t, n, i, a, o, s, l), c.base = e.__e, e.__h = null, c.__h.length && o.push(c), w && (c.__E = c.__ = null), c.__e = !1; + } else + a == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = _0e(t.__e, e, t, n, i, a, o, l); + (u = nr.diffed) && u(e); + } catch (C) { + e.__v = null, (l || a != null) && (e.__e = s, e.__h = !!l, a[a.indexOf(s)] = null), nr.__e(C, e, t); + } +} +function QV(r, e) { + nr.__c && nr.__c(e, r), r.some(function(t) { + try { + r = t.__h, t.__h = [], r.some(function(n) { + n.call(t); + }); + } catch (n) { + nr.__e(n, t.__v); + } + }); +} +function _0e(r, e, t, n, i, a, o, s) { + var l, u, c, h = t.props, f = e.props, v = e.type, b = 0; + if (v === "svg" && (i = !0), a != null) { + for (; b < a.length; b++) + if ((l = a[b]) && "setAttribute" in l == !!v && (v ? l.localName === v : l.nodeType === 3)) { + r = l, a[b] = null; + break; + } + } + if (r == null) { + if (v === null) + return document.createTextNode(f); + r = i ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v, f.is && f), a = null, s = !1; + } + if (v === null) + h === f || s && r.data === f || (r.data = f); + else { + if (a = a && mx.call(r.childNodes), u = (h = t.props || ib).dangerouslySetInnerHTML, c = f.dangerouslySetInnerHTML, !s) { + if (a != null) + for (h = {}, b = 0; b < r.attributes.length; b++) + h[r.attributes[b].name] = r.attributes[b].value; + (c || u) && (c && (u && c.__html == u.__html || c.__html === r.innerHTML) || (r.innerHTML = c && c.__html || "")); + } + if (m0e(r, f, h, i, s), c) + e.__k = []; + else if (b = e.props.children, XV(r, Array.isArray(b) ? b : [b], e, t, n, i && v !== "foreignObject", a, o, a ? a[0] : t.__k && jg(t, 0), s), a != null) + for (b = a.length; b--; ) + a[b] != null && WV(a[b]); + s || ("value" in f && (b = f.value) !== void 0 && (b !== r.value || v === "progress" && !b || v === "option" && b !== h.value) && ab(r, "value", b, h.value, !1), "checked" in f && (b = f.checked) !== void 0 && b !== r.checked && ab(r, "checked", b, h.checked, !1)); + } + return r; +} +function qV(r, e, t) { + try { + typeof r == "function" ? r(e) : r.current = e; + } catch (n) { + nr.__e(n, t); + } +} +function eG(r, e, t) { + var n, i; + if (nr.unmount && nr.unmount(r), (n = r.ref) && (n.current && n.current !== r.__e || qV(n, null, e)), (n = r.__c) != null) { + if (n.componentWillUnmount) + try { + n.componentWillUnmount(); + } catch (a) { + nr.__e(a, e); + } + n.base = n.__P = null, r.__c = void 0; + } + if (n = r.__k) + for (i = 0; i < n.length; i++) + n[i] && eG(n[i], e, t || typeof r.type != "function"); + t || r.__e == null || WV(r.__e), r.__ = r.__e = r.__d = void 0; +} +function b0e(r, e, t) { + return this.constructor(r, t); +} +function Fg(r, e, t) { + var n, i, a; + nr.__ && nr.__(r, e), i = (n = typeof t == "function") ? null : t && t.__k || e.__k, a = [], XE(e, r = (!n && t || e).__k = me(Dn, null, [r]), i || ib, ib, e.ownerSVGElement !== void 0, !n && t ? [t] : i ? null : e.firstChild ? mx.call(e.childNodes) : null, a, !n && t ? t : i ? i.__e : e.firstChild, n), QV(a, r); +} +function x0e(r, e) { + var t = { __c: e = "__cC" + GV++, __: r, Consumer: function(n, i) { + return n.children(i); + }, Provider: function(n) { + var i, a; + return this.getChildContext || (i = [], (a = {})[e] = this, this.getChildContext = function() { + return a; + }, this.shouldComponentUpdate = function(o) { + this.props.value !== o.value && i.some(function(s) { + s.__e = !0, YT(s); + }); + }, this.sub = function(o) { + i.push(o); + var s = o.componentWillUnmount; + o.componentWillUnmount = function() { + i.splice(i.indexOf(o), 1), s && s.call(o); + }; + }), n.children; + } }; + return t.Provider.__ = t.Consumer.contextType = t; +} +mx = UV.slice, nr = { __e: function(r, e, t, n) { + for (var i, a, o; e = e.__; ) + if ((i = e.__c) && !i.__) + try { + if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(r)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(r, n || {}), o = i.__d), o) + return i.__E = i; + } catch (s) { + r = s; + } + throw r; +} }, HV = 0, Vd = !1, bo.prototype.setState = function(r, e) { + var t; + t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = ec({}, this.state), typeof r == "function" && (r = r(ec({}, t), this.props)), r && ec(t, r), r != null && this.__v && (e && this._sb.push(e), YT(this)); +}, bo.prototype.forceUpdate = function(r) { + this.__v && (this.__e = !0, r && this.__h.push(r), YT(this)); +}, bo.prototype.render = Dn, Ch = [], VV = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, ob.__r = 0, GV = 0; +var dl, AC, ZN, tG = [], EC = [], JN = nr.__b, KN = nr.__r, QN = nr.diffed, qN = nr.__c, ez = nr.unmount; +function S0e() { + for (var r; r = tG.shift(); ) + if (r.__P && r.__H) + try { + r.__H.__h.forEach(K0), r.__H.__h.forEach(XT), r.__H.__h = []; + } catch (e) { + r.__H.__h = [], nr.__e(e, r.__v); + } +} +nr.__b = function(r) { + dl = null, JN && JN(r); +}, nr.__r = function(r) { + KN && KN(r); + var e = (dl = r.__c).__H; + e && (AC === dl ? (e.__h = [], dl.__h = [], e.__.forEach(function(t) { + t.__N && (t.__ = t.__N), t.__V = EC, t.__N = t.i = void 0; + })) : (e.__h.forEach(K0), e.__h.forEach(XT), e.__h = [])), AC = dl; +}, nr.diffed = function(r) { + QN && QN(r); + var e = r.__c; + e && e.__H && (e.__H.__h.length && (tG.push(e) !== 1 && ZN === nr.requestAnimationFrame || ((ZN = nr.requestAnimationFrame) || w0e)(S0e)), e.__H.__.forEach(function(t) { + t.i && (t.__H = t.i), t.__V !== EC && (t.__ = t.__V), t.i = void 0, t.__V = EC; + })), AC = dl = null; +}, nr.__c = function(r, e) { + e.some(function(t) { + try { + t.__h.forEach(K0), t.__h = t.__h.filter(function(n) { + return !n.__ || XT(n); + }); + } catch (n) { + e.some(function(i) { + i.__h && (i.__h = []); + }), e = [], nr.__e(n, t.__v); + } + }), qN && qN(r, e); +}, nr.unmount = function(r) { + ez && ez(r); + var e, t = r.__c; + t && t.__H && (t.__H.__.forEach(function(n) { + try { + K0(n); + } catch (i) { + e = i; + } + }), t.__H = void 0, e && nr.__e(e, t.__v)); +}; +var tz = typeof requestAnimationFrame == "function"; +function w0e(r) { + var e, t = function() { + clearTimeout(n), tz && cancelAnimationFrame(e), setTimeout(r); + }, n = setTimeout(t, 100); + tz && (e = requestAnimationFrame(t)); +} +function K0(r) { + var e = dl, t = r.__c; + typeof t == "function" && (r.__c = void 0, t()), dl = e; +} +function XT(r) { + var e = dl; + r.__c = r.__(), dl = e; +} +function C0e(r, e) { + for (var t in e) + r[t] = e[t]; + return r; +} +function rz(r, e) { + for (var t in r) + if (t !== "__source" && !(t in e)) + return !0; + for (var n in e) + if (n !== "__source" && r[n] !== e[n]) + return !0; + return !1; +} +function nz(r) { + this.props = r; +} +(nz.prototype = new bo()).isPureReactComponent = !0, nz.prototype.shouldComponentUpdate = function(r, e) { + return rz(this.props, r) || rz(this.state, e); +}; +var iz = nr.__b; +nr.__b = function(r) { + r.type && r.type.__f && r.ref && (r.props.ref = r.ref, r.ref = null), iz && iz(r); +}; +var T0e = nr.__e; +nr.__e = function(r, e, t, n) { + if (r.then) { + for (var i, a = e; a = a.__; ) + if ((i = a.__c) && i.__c) + return e.__e == null && (e.__e = t.__e, e.__k = t.__k), i.__c(r, e); + } + T0e(r, e, t, n); +}; +var az = nr.unmount; +function rG(r, e, t) { + return r && (r.__c && r.__c.__H && (r.__c.__H.__.forEach(function(n) { + typeof n.__c == "function" && n.__c(); + }), r.__c.__H = null), (r = C0e({}, r)).__c != null && (r.__c.__P === t && (r.__c.__P = e), r.__c = null), r.__k = r.__k && r.__k.map(function(n) { + return rG(n, e, t); + })), r; +} +function nG(r, e, t) { + return r && (r.__v = null, r.__k = r.__k && r.__k.map(function(n) { + return nG(n, e, t); + }), r.__c && r.__c.__P === e && (r.__e && t.insertBefore(r.__e, r.__d), r.__c.__e = !0, r.__c.__P = t)), r; +} +function MC() { + this.__u = 0, this.t = null, this.__b = null; +} +function iG(r) { + var e = r.__.__c; + return e && e.__a && e.__a(r); +} +function x0() { + this.u = null, this.o = null; +} +nr.unmount = function(r) { + var e = r.__c; + e && e.__R && e.__R(), e && r.__h === !0 && (r.type = null), az && az(r); +}, (MC.prototype = new bo()).__c = function(r, e) { + var t = e.__c, n = this; + n.t == null && (n.t = []), n.t.push(t); + var i = iG(n.__v), a = !1, o = function() { + a || (a = !0, t.__R = null, i ? i(s) : s()); + }; + t.__R = o; + var s = function() { + if (!--n.__u) { + if (n.state.__a) { + var u = n.state.__a; + n.__v.__k[0] = nG(u, u.__c.__P, u.__c.__O); + } + var c; + for (n.setState({ __a: n.__b = null }); c = n.t.pop(); ) + c.forceUpdate(); + } + }, l = e.__h === !0; + n.__u++ || l || n.setState({ __a: n.__b = n.__v.__k[0] }), r.then(o, o); +}, MC.prototype.componentWillUnmount = function() { + this.t = []; +}, MC.prototype.render = function(r, e) { + if (this.__b) { + if (this.__v.__k) { + var t = document.createElement("div"), n = this.__v.__k[0].__c; + this.__v.__k[0] = rG(this.__b, t, n.__O = n.__P); + } + this.__b = null; + } + var i = e.__a && me(Dn, null, r.fallback); + return i && (i.__h = null), [me(Dn, null, e.__a ? null : r.children), i]; +}; +var oz = function(r, e, t) { + if (++t[1] === t[0] && r.o.delete(e), r.props.revealOrder && (r.props.revealOrder[0] !== "t" || !r.o.size)) + for (t = r.u; t; ) { + for (; t.length > 3; ) + t.pop()(); + if (t[1] < t[0]) + break; + r.u = t = t[2]; + } +}; +function I0e(r) { + return this.getChildContext = function() { + return r.context; + }, r.children; +} +function A0e(r) { + var e = this, t = r.i; + e.componentWillUnmount = function() { + Fg(null, e.l), e.l = null, e.i = null; + }, e.i && e.i !== t && e.componentWillUnmount(), r.__v ? (e.l || (e.i = t, e.l = { nodeType: 1, parentNode: t, childNodes: [], appendChild: function(n) { + this.childNodes.push(n), e.i.appendChild(n); + }, insertBefore: function(n, i) { + this.childNodes.push(n), e.i.appendChild(n); + }, removeChild: function(n) { + this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), e.i.removeChild(n); + } }), Fg(me(I0e, { context: e.context }, r.__v), e.l)) : e.l && e.componentWillUnmount(); +} +function E0e(r, e) { + var t = me(A0e, { __v: r, i: e }); + return t.containerInfo = e, t; +} +(x0.prototype = new bo()).__a = function(r) { + var e = this, t = iG(e.__v), n = e.o.get(r); + return n[0]++, function(i) { + var a = function() { + e.props.revealOrder ? (n.push(i), oz(e, r, n)) : i(); + }; + t ? t(a) : a(); + }; +}, x0.prototype.render = function(r) { + this.u = null, this.o = /* @__PURE__ */ new Map(); + var e = sb(r.children); + r.revealOrder && r.revealOrder[0] === "b" && e.reverse(); + for (var t = e.length; t--; ) + this.o.set(e[t], this.u = [1, 0, this.u]); + return r.children; +}, x0.prototype.componentDidUpdate = x0.prototype.componentDidMount = function() { + var r = this; + this.o.forEach(function(e, t) { + oz(r, t, e); + }); +}; +var M0e = typeof Symbol != "undefined" && Symbol.for && Symbol.for("react.element") || 60103, D0e = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, k0e = typeof document != "undefined", O0e = function(r) { + return (typeof Symbol != "undefined" && typeof Symbol() == "symbol" ? /fil|che|rad/i : /fil|che|ra/i).test(r); +}; +bo.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(r) { + Object.defineProperty(bo.prototype, r, { configurable: !0, get: function() { + return this["UNSAFE_" + r]; + }, set: function(e) { + Object.defineProperty(this, r, { configurable: !0, writable: !0, value: e }); + } }); +}); +var sz = nr.event; +function L0e() { +} +function P0e() { + return this.cancelBubble; +} +function R0e() { + return this.defaultPrevented; +} +nr.event = function(r) { + return sz && (r = sz(r)), r.persist = L0e, r.isPropagationStopped = P0e, r.isDefaultPrevented = R0e, r.nativeEvent = r; +}; +var lz = { configurable: !0, get: function() { + return this.class; +} }, uz = nr.vnode; +nr.vnode = function(r) { + var e = r.type, t = r.props, n = t; + if (typeof e == "string") { + var i = e.indexOf("-") === -1; + for (var a in n = {}, t) { + var o = t[a]; + k0e && a === "children" && e === "noscript" || a === "value" && "defaultValue" in t && o == null || (a === "defaultValue" && "value" in t && t.value == null ? a = "value" : a === "download" && o === !0 ? o = "" : /ondoubleclick/i.test(a) ? a = "ondblclick" : /^onchange(textarea|input)/i.test(a + e) && !O0e(t.type) ? a = "oninput" : /^onfocus$/i.test(a) ? a = "onfocusin" : /^onblur$/i.test(a) ? a = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(a) ? a = a.toLowerCase() : i && D0e.test(a) ? a = a.replace(/[A-Z0-9]/g, "-$&").toLowerCase() : o === null && (o = void 0), /^oninput$/i.test(a) && (a = a.toLowerCase(), n[a] && (a = "oninputCapture")), n[a] = o); + } + e == "select" && n.multiple && Array.isArray(n.value) && (n.value = sb(t.children).forEach(function(s) { + s.props.selected = n.value.indexOf(s.props.value) != -1; + })), e == "select" && n.defaultValue != null && (n.value = sb(t.children).forEach(function(s) { + s.props.selected = n.multiple ? n.defaultValue.indexOf(s.props.value) != -1 : n.defaultValue == s.props.value; + })), r.props = n, t.class != t.className && (lz.enumerable = "className" in t, t.className != null && (n.class = t.className), Object.defineProperty(n, "className", lz)); + } + r.$$typeof = M0e, uz && uz(r); +}; +var cz = nr.__r; +nr.__r = function(r) { + cz && cz(r), r.__c; +}; +const aG = [], ZT = /* @__PURE__ */ new Map(); +function yx(r) { + aG.push(r), ZT.forEach((e) => { + sG(e, r); + }); +} +function N0e(r) { + r.isConnected && oG(r.getRootNode()); +} +function oG(r) { + let e = ZT.get(r); + if (!e || !e.isConnected) { + if (e = r.querySelector("style[data-fullcalendar]"), !e) { + e = document.createElement("style"), e.setAttribute("data-fullcalendar", ""); + const t = B0e(); + t && (e.nonce = t); + const n = r === document ? document.head : r, i = r === document ? n.querySelector("script,link[rel=stylesheet],link[as=style],style") : n.firstChild; + n.insertBefore(e, i); + } + ZT.set(r, e), z0e(e); + } +} +function z0e(r) { + for (const e of aG) + sG(r, e); +} +function sG(r, e) { + const { sheet: t } = r, n = t.cssRules.length; + e.split("}").forEach((i, a) => { + i = i.trim(), i && t.insertRule(i + "}", n + a); + }); +} +let DC; +function B0e() { + return DC === void 0 && (DC = j0e()), DC; +} +function j0e() { + const r = document.querySelector('meta[name="csp-nonce"]'); + if (r && r.hasAttribute("content")) + return r.getAttribute("content"); + const e = document.querySelector("script[nonce]"); + return e && e.nonce || ""; +} +typeof document != "undefined" && oG(document); +var F0e = ':root{--fc-small-font-size:.85em;--fc-page-bg-color:#fff;--fc-neutral-bg-color:hsla(0,0%,82%,.3);--fc-neutral-text-color:grey;--fc-border-color:#ddd;--fc-button-text-color:#fff;--fc-button-bg-color:#2c3e50;--fc-button-border-color:#2c3e50;--fc-button-hover-bg-color:#1e2b37;--fc-button-hover-border-color:#1a252f;--fc-button-active-bg-color:#1a252f;--fc-button-active-border-color:#151e27;--fc-event-bg-color:#3788d8;--fc-event-border-color:#3788d8;--fc-event-text-color:#fff;--fc-event-selected-overlay-color:rgba(0,0,0,.25);--fc-more-link-bg-color:#d0d0d0;--fc-more-link-text-color:inherit;--fc-event-resizer-thickness:8px;--fc-event-resizer-dot-total-width:8px;--fc-event-resizer-dot-border-width:1px;--fc-non-business-color:hsla(0,0%,84%,.3);--fc-bg-event-color:#8fdf82;--fc-bg-event-opacity:0.3;--fc-highlight-color:rgba(188,232,241,.3);--fc-today-bg-color:rgba(255,220,40,.15);--fc-now-indicator-color:red}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc{display:flex;flex-direction:column;font-size:1em}.fc,.fc *,.fc :after,.fc :before{box-sizing:border-box}.fc table{border-collapse:collapse;border-spacing:0;font-size:1em}.fc th{text-align:center}.fc td,.fc th{padding:0;vertical-align:top}.fc a[data-navlink]{cursor:pointer}.fc a[data-navlink]:hover{text-decoration:underline}.fc-direction-ltr{direction:ltr;text-align:left}.fc-direction-rtl{direction:rtl;text-align:right}.fc-theme-standard td,.fc-theme-standard th{border:1px solid var(--fc-border-color)}.fc-liquid-hack td,.fc-liquid-hack th{position:relative}@font-face{font-family:fcicons;font-style:normal;font-weight:400;src:url("data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBfAAAAC8AAAAYGNtYXAXVtKNAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZgYydxIAAAF4AAAFNGhlYWQUJ7cIAAAGrAAAADZoaGVhB20DzAAABuQAAAAkaG10eCIABhQAAAcIAAAALGxvY2ED4AU6AAAHNAAAABhtYXhwAA8AjAAAB0wAAAAgbmFtZXsr690AAAdsAAABhnBvc3QAAwAAAAAI9AAAACAAAwPAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpBgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qb//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAWIAjQKeAskAEwAAJSc3NjQnJiIHAQYUFwEWMjc2NCcCnuLiDQ0MJAz/AA0NAQAMJAwNDcni4gwjDQwM/wANIwz/AA0NDCMNAAAAAQFiAI0CngLJABMAACUBNjQnASYiBwYUHwEHBhQXFjI3AZ4BAA0N/wAMJAwNDeLiDQ0MJAyNAQAMIw0BAAwMDSMM4uINIwwNDQAAAAIA4gC3Ax4CngATACcAACUnNzY0JyYiDwEGFB8BFjI3NjQnISc3NjQnJiIPAQYUHwEWMjc2NCcB87e3DQ0MIw3VDQ3VDSMMDQ0BK7e3DQ0MJAzVDQ3VDCQMDQ3zuLcMJAwNDdUNIwzWDAwNIwy4twwkDA0N1Q0jDNYMDA0jDAAAAgDiALcDHgKeABMAJwAAJTc2NC8BJiIHBhQfAQcGFBcWMjchNzY0LwEmIgcGFB8BBwYUFxYyNwJJ1Q0N1Q0jDA0Nt7cNDQwjDf7V1Q0N1QwkDA0Nt7cNDQwkDLfWDCMN1Q0NDCQMt7gMIw0MDNYMIw3VDQ0MJAy3uAwjDQwMAAADAFUAAAOrA1UAMwBoAHcAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMhMjY1NCYjISIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAAVYRGRkR/qoRGRkRA1UFBAUOCQkVDAsZDf2rDRkLDBUJCA4FBQUFBQUOCQgVDAsZDQJVDRkLDBUJCQ4FBAVVAgECBQMCBwQECAX9qwQJAwQHAwMFAQICAgIBBQMDBwQDCQQCVQUIBAQHAgMFAgEC/oAZEhEZGRESGQAAAAADAFUAAAOrA1UAMwBoAIkAABMiBgcOAQcOAQcOARURFBYXHgEXHgEXHgEzITI2Nz4BNz4BNz4BNRE0JicuAScuAScuASMFITIWFx4BFx4BFx4BFREUBgcOAQcOAQcOASMhIiYnLgEnLgEnLgE1ETQ2Nz4BNz4BNz4BMxMzFRQWMzI2PQEzMjY1NCYrATU0JiMiBh0BIyIGFRQWM9UNGAwLFQkJDgUFBQUFBQ4JCRULDBgNAlYNGAwLFQkJDgUFBQUFBQ4JCRULDBgN/aoCVgQIBAQHAwMFAQIBAQIBBQMDBwQECAT9qgQIBAQHAwMFAQIBAQIBBQMDBwQECASAgBkSEhmAERkZEYAZEhIZgBEZGREDVQUEBQ4JCRUMCxkN/asNGQsMFQkIDgUFBQUFBQ4JCBUMCxkNAlUNGQsMFQkJDgUEBVUCAQIFAwIHBAQIBf2rBAkDBAcDAwUBAgICAgEFAwMHBAMJBAJVBQgEBAcCAwUCAQL+gIASGRkSgBkSERmAEhkZEoAZERIZAAABAOIAjQMeAskAIAAAExcHBhQXFjI/ARcWMjc2NC8BNzY0JyYiDwEnJiIHBhQX4uLiDQ0MJAzi4gwkDA0N4uINDQwkDOLiDCQMDQ0CjeLiDSMMDQ3h4Q0NDCMN4uIMIw0MDOLiDAwNIwwAAAABAAAAAQAAa5n0y18PPPUACwQAAAAAANivOVsAAAAA2K85WwAAAAADqwNVAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAOrAAEAAAAAAAAAAAAAAAAAAAALBAAAAAAAAAAAAAAAAgAAAAQAAWIEAAFiBAAA4gQAAOIEAABVBAAAVQQAAOIAAAAAAAoAFAAeAEQAagCqAOoBngJkApoAAQAAAAsAigADAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAcAAAABAAAAAAACAAcAYAABAAAAAAADAAcANgABAAAAAAAEAAcAdQABAAAAAAAFAAsAFQABAAAAAAAGAAcASwABAAAAAAAKABoAigADAAEECQABAA4ABwADAAEECQACAA4AZwADAAEECQADAA4APQADAAEECQAEAA4AfAADAAEECQAFABYAIAADAAEECQAGAA4AUgADAAEECQAKADQApGZjaWNvbnMAZgBjAGkAYwBvAG4Ac1ZlcnNpb24gMS4wAFYAZQByAHMAaQBvAG4AIAAxAC4AMGZjaWNvbnMAZgBjAGkAYwBvAG4Ac2ZjaWNvbnMAZgBjAGkAYwBvAG4Ac1JlZ3VsYXIAUgBlAGcAdQBsAGEAcmZjaWNvbnMAZgBjAGkAYwBvAG4Ac0ZvbnQgZ2VuZXJhdGVkIGJ5IEljb01vb24uAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAEkAYwBvAE0AbwBvAG4ALgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") format("truetype")}.fc-icon{speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;font-family:fcicons!important;font-style:normal;font-variant:normal;font-weight:400;height:1em;line-height:1;text-align:center;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:1em}.fc-icon-chevron-left:before{content:"\\e900"}.fc-icon-chevron-right:before{content:"\\e901"}.fc-icon-chevrons-left:before{content:"\\e902"}.fc-icon-chevrons-right:before{content:"\\e903"}.fc-icon-minus-square:before{content:"\\e904"}.fc-icon-plus-square:before{content:"\\e905"}.fc-icon-x:before{content:"\\e906"}.fc .fc-button{border-radius:0;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none}.fc .fc-button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}.fc .fc-button{-webkit-appearance:button}.fc .fc-button:not(:disabled){cursor:pointer}.fc .fc-button{background-color:transparent;border:1px solid transparent;border-radius:.25em;display:inline-block;font-size:1em;font-weight:400;line-height:1.5;padding:.4em .65em;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle}.fc .fc-button:hover{text-decoration:none}.fc .fc-button:focus{box-shadow:0 0 0 .2rem rgba(44,62,80,.25);outline:0}.fc .fc-button:disabled{opacity:.65}.fc .fc-button-primary{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:hover{background-color:var(--fc-button-hover-bg-color);border-color:var(--fc-button-hover-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:disabled{background-color:var(--fc-button-bg-color);border-color:var(--fc-button-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button-primary:not(:disabled).fc-button-active,.fc .fc-button-primary:not(:disabled):active{background-color:var(--fc-button-active-bg-color);border-color:var(--fc-button-active-border-color);color:var(--fc-button-text-color)}.fc .fc-button-primary:not(:disabled).fc-button-active:focus,.fc .fc-button-primary:not(:disabled):active:focus{box-shadow:0 0 0 .2rem rgba(76,91,106,.5)}.fc .fc-button .fc-icon{font-size:1.5em;vertical-align:middle}.fc .fc-button-group{display:inline-flex;position:relative;vertical-align:middle}.fc .fc-button-group>.fc-button{flex:1 1 auto;position:relative}.fc .fc-button-group>.fc-button.fc-button-active,.fc .fc-button-group>.fc-button:active,.fc .fc-button-group>.fc-button:focus,.fc .fc-button-group>.fc-button:hover{z-index:1}.fc-direction-ltr .fc-button-group>.fc-button:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.fc-direction-ltr .fc-button-group>.fc-button:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.fc-direction-rtl .fc-button-group>.fc-button:not(:first-child){border-bottom-right-radius:0;border-top-right-radius:0;margin-right:-1px}.fc-direction-rtl .fc-button-group>.fc-button:not(:last-child){border-bottom-left-radius:0;border-top-left-radius:0}.fc .fc-toolbar{align-items:center;display:flex;justify-content:space-between}.fc .fc-toolbar.fc-header-toolbar{margin-bottom:1.5em}.fc .fc-toolbar.fc-footer-toolbar{margin-top:1.5em}.fc .fc-toolbar-title{font-size:1.75em;margin:0}.fc-direction-ltr .fc-toolbar>*>:not(:first-child){margin-left:.75em}.fc-direction-rtl .fc-toolbar>*>:not(:first-child){margin-right:.75em}.fc-direction-rtl .fc-toolbar-ltr{flex-direction:row-reverse}.fc .fc-scroller{-webkit-overflow-scrolling:touch;position:relative}.fc .fc-scroller-liquid{height:100%}.fc .fc-scroller-liquid-absolute{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-scroller-harness{direction:ltr;overflow:hidden;position:relative}.fc .fc-scroller-harness-liquid{height:100%}.fc-direction-rtl .fc-scroller-harness>.fc-scroller{direction:rtl}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--fc-border-color)}.fc .fc-scrollgrid,.fc .fc-scrollgrid table{table-layout:fixed;width:100%}.fc .fc-scrollgrid table{border-left-style:hidden;border-right-style:hidden;border-top-style:hidden}.fc .fc-scrollgrid{border-bottom-width:0;border-collapse:separate;border-right-width:0}.fc .fc-scrollgrid-liquid{height:100%}.fc .fc-scrollgrid-section,.fc .fc-scrollgrid-section table,.fc .fc-scrollgrid-section>td{height:1px}.fc .fc-scrollgrid-section-liquid>td{height:100%}.fc .fc-scrollgrid-section>*{border-left-width:0;border-top-width:0}.fc .fc-scrollgrid-section-footer>*,.fc .fc-scrollgrid-section-header>*{border-bottom-width:0}.fc .fc-scrollgrid-section-body table,.fc .fc-scrollgrid-section-footer table{border-bottom-style:hidden}.fc .fc-scrollgrid-section-sticky>*{background:var(--fc-page-bg-color);position:sticky;z-index:3}.fc .fc-scrollgrid-section-header.fc-scrollgrid-section-sticky>*{top:0}.fc .fc-scrollgrid-section-footer.fc-scrollgrid-section-sticky>*{bottom:0}.fc .fc-scrollgrid-sticky-shim{height:1px;margin-bottom:-1px}.fc-sticky{position:sticky}.fc .fc-view-harness{flex-grow:1;position:relative}.fc .fc-view-harness-active>.fc-view{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-col-header-cell-cushion{display:inline-block;padding:2px 4px}.fc .fc-bg-event,.fc .fc-highlight,.fc .fc-non-business{bottom:0;left:0;position:absolute;right:0;top:0}.fc .fc-non-business{background:var(--fc-non-business-color)}.fc .fc-bg-event{background:var(--fc-bg-event-color);opacity:var(--fc-bg-event-opacity)}.fc .fc-bg-event .fc-event-title{font-size:var(--fc-small-font-size);font-style:italic;margin:.5em}.fc .fc-highlight{background:var(--fc-highlight-color)}.fc .fc-cell-shaded,.fc .fc-day-disabled{background:var(--fc-neutral-bg-color)}a.fc-event,a.fc-event:hover{text-decoration:none}.fc-event.fc-event-draggable,.fc-event[href]{cursor:pointer}.fc-event .fc-event-main{position:relative;z-index:2}.fc-event-dragging:not(.fc-event-selected){opacity:.75}.fc-event-dragging.fc-event-selected{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-event .fc-event-resizer{display:none;position:absolute;z-index:4}.fc-event-selected .fc-event-resizer,.fc-event:hover .fc-event-resizer{display:block}.fc-event-selected .fc-event-resizer{background:var(--fc-page-bg-color);border-color:inherit;border-radius:calc(var(--fc-event-resizer-dot-total-width)/2);border-style:solid;border-width:var(--fc-event-resizer-dot-border-width);height:var(--fc-event-resizer-dot-total-width);width:var(--fc-event-resizer-dot-total-width)}.fc-event-selected .fc-event-resizer:before{bottom:-20px;content:"";left:-20px;position:absolute;right:-20px;top:-20px}.fc-event-selected,.fc-event:focus{box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event-selected:before,.fc-event:focus:before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:3}.fc-event-selected:after,.fc-event:focus:after{background:var(--fc-event-selected-overlay-color);bottom:-1px;content:"";left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fc-h-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-h-event .fc-event-main{color:var(--fc-event-text-color)}.fc-h-event .fc-event-main-frame{display:flex}.fc-h-event .fc-event-time{max-width:100%;overflow:hidden}.fc-h-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-width:0}.fc-h-event .fc-event-title{display:inline-block;left:0;max-width:100%;overflow:hidden;right:0;vertical-align:top}.fc-h-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-start),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-end){border-bottom-left-radius:0;border-left-width:0;border-top-left-radius:0}.fc-direction-ltr .fc-daygrid-block-event:not(.fc-event-end),.fc-direction-rtl .fc-daygrid-block-event:not(.fc-event-start){border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}.fc-h-event:not(.fc-event-selected) .fc-event-resizer{bottom:0;top:0;width:var(--fc-event-resizer-thickness)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end{cursor:w-resize;left:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-direction-ltr .fc-h-event:not(.fc-event-selected) .fc-event-resizer-end,.fc-direction-rtl .fc-h-event:not(.fc-event-selected) .fc-event-resizer-start{cursor:e-resize;right:calc(var(--fc-event-resizer-thickness)*-.5)}.fc-h-event.fc-event-selected .fc-event-resizer{margin-top:calc(var(--fc-event-resizer-dot-total-width)*-.5);top:50%}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-start,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-end{left:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc-direction-ltr .fc-h-event.fc-event-selected .fc-event-resizer-end,.fc-direction-rtl .fc-h-event.fc-event-selected .fc-event-resizer-start{right:calc(var(--fc-event-resizer-dot-total-width)*-.5)}.fc .fc-popover{box-shadow:0 2px 6px rgba(0,0,0,.15);position:absolute;z-index:9999}.fc .fc-popover-header{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:3px 4px}.fc .fc-popover-title{margin:0 2px}.fc .fc-popover-close{cursor:pointer;font-size:1.1em;opacity:.65}.fc-theme-standard .fc-popover{background:var(--fc-page-bg-color);border:1px solid var(--fc-border-color)}.fc-theme-standard .fc-popover-header{background:var(--fc-neutral-bg-color)}'; +yx(F0e); +function ZE(r) { + r.parentNode && r.parentNode.removeChild(r); +} +function da(r, e) { + if (r.closest) + return r.closest(e); + if (!document.documentElement.contains(r)) + return null; + do { + if ($0e(r, e)) + return r; + r = r.parentElement || r.parentNode; + } while (r !== null && r.nodeType === 1); + return null; +} +function $0e(r, e) { + return (r.matches || r.matchesSelector || r.msMatchesSelector).call(r, e); +} +function H0e(r, e) { + let t = r instanceof HTMLElement ? [r] : r, n = []; + for (let i = 0; i < t.length; i += 1) { + let a = t[i].querySelectorAll(e); + for (let o = 0; o < a.length; o += 1) + n.push(a[o]); + } + return n; +} +const V0e = /(top|left|right|bottom|width|height)$/i; +function qp(r, e) { + for (let t in e) + lG(r, t, e[t]); +} +function lG(r, e, t) { + t == null ? r.style[e] = "" : typeof t == "number" && V0e.test(e) ? r.style[e] = `${t}px` : r.style[e] = t; +} +function uG(r) { + var e, t; + return (t = (e = r.composedPath) === null || e === void 0 ? void 0 : e.call(r)[0]) !== null && t !== void 0 ? t : r.target; +} +let hz = 0; +function cc() { + return hz += 1, "fc-dom-" + hz; +} +function _x(r) { + r.preventDefault(); +} +function G0e(r, e) { + return (t) => { + let n = da(t.target, r); + n && e.call(n, t, n); + }; +} +function cG(r, e, t, n) { + let i = G0e(t, n); + return r.addEventListener(e, i), () => { + r.removeEventListener(e, i); + }; +} +function U0e(r, e, t, n) { + let i; + return cG(r, "mouseover", e, (a, o) => { + if (o !== i) { + i = o, t(a, o); + let s = (l) => { + i = null, n(l, o), o.removeEventListener("mouseleave", s); + }; + o.addEventListener("mouseleave", s); + } + }); +} +const fz = [ + "webkitTransitionEnd", + "otransitionend", + "oTransitionEnd", + "msTransitionEnd", + "transitionend" +]; +function W0e(r, e) { + let t = (n) => { + e(n), fz.forEach((i) => { + r.removeEventListener(i, t); + }); + }; + fz.forEach((n) => { + r.addEventListener(n, t); + }); +} +function hG(r) { + return Object.assign({ onClick: r }, fG(r)); +} +function fG(r) { + return { + tabIndex: 0, + onKeyDown(e) { + (e.key === "Enter" || e.key === " ") && (r(e), e.preventDefault()); + } + }; +} +let dz = 0; +function df() { + return dz += 1, String(dz); +} +function JE() { + document.body.classList.add("fc-not-allowed"); +} +function KE() { + document.body.classList.remove("fc-not-allowed"); +} +function Y0e(r) { + r.style.userSelect = "none", r.addEventListener("selectstart", _x); +} +function X0e(r) { + r.style.userSelect = "", r.removeEventListener("selectstart", _x); +} +function Z0e(r) { + r.addEventListener("contextmenu", _x); +} +function J0e(r) { + r.removeEventListener("contextmenu", _x); +} +function K0e(r) { + let e = [], t = [], n, i; + for (typeof r == "string" ? t = r.split(/\s*,\s*/) : typeof r == "function" ? t = [r] : Array.isArray(r) && (t = r), n = 0; n < t.length; n += 1) + i = t[n], typeof i == "string" ? e.push(i.charAt(0) === "-" ? { field: i.substring(1), order: -1 } : { field: i, order: 1 }) : typeof i == "function" && e.push({ func: i }); + return e; +} +function Q0e(r, e, t) { + let n, i; + for (n = 0; n < t.length; n += 1) + if (i = q0e(r, e, t[n]), i) + return i; + return 0; +} +function q0e(r, e, t) { + return t.func ? t.func(r, e) : e_e(r[t.field], e[t.field]) * (t.order || 1); +} +function e_e(r, e) { + return !r && !e ? 0 : e == null ? -1 : r == null ? 1 : typeof r == "string" || typeof e == "string" ? String(r).localeCompare(String(e)) : r - e; +} +function Id(r, e) { + let t = String(r); + return "000".substr(0, e - t.length) + t; +} +function eg(r, e, t) { + return typeof r == "function" ? r(...e) : typeof r == "string" ? e.reduce((n, i, a) => n.replace("$" + a, i || ""), r) : t; +} +function t_e(r, e) { + return r - e; +} +function Q0(r) { + return r % 1 === 0; +} +function r_e(r) { + let e = r.querySelector(".fc-scrollgrid-shrink-frame"), t = r.querySelector(".fc-scrollgrid-shrink-cushion"); + if (!e) + throw new Error("needs fc-scrollgrid-shrink-frame className"); + if (!t) + throw new Error("needs fc-scrollgrid-shrink-cushion className"); + return r.getBoundingClientRect().width - e.getBoundingClientRect().width + // the cell padding+border + t.getBoundingClientRect().width; +} +const vz = ["years", "months", "days", "milliseconds"], n_e = /^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/; +function Xr(r, e) { + return typeof r == "string" ? i_e(r) : typeof r == "object" && r ? pz(r) : typeof r == "number" ? pz({ [e || "milliseconds"]: r }) : null; +} +function i_e(r) { + let e = n_e.exec(r); + if (e) { + let t = e[1] ? -1 : 1; + return { + years: 0, + months: 0, + days: t * (e[2] ? parseInt(e[2], 10) : 0), + milliseconds: t * ((e[3] ? parseInt(e[3], 10) : 0) * 60 * 60 * 1e3 + // hours + (e[4] ? parseInt(e[4], 10) : 0) * 60 * 1e3 + // minutes + (e[5] ? parseInt(e[5], 10) : 0) * 1e3 + // seconds + (e[6] ? parseInt(e[6], 10) : 0)) + }; + } + return null; +} +function pz(r) { + let e = { + years: r.years || r.year || 0, + months: r.months || r.month || 0, + days: r.days || r.day || 0, + milliseconds: (r.hours || r.hour || 0) * 60 * 60 * 1e3 + // hours + (r.minutes || r.minute || 0) * 60 * 1e3 + // minutes + (r.seconds || r.second || 0) * 1e3 + // seconds + (r.milliseconds || r.millisecond || r.ms || 0) + // ms + }, t = r.weeks || r.week; + return t && (e.days += t * 7, e.specifiedWeeks = !0), e; +} +function a_e(r, e) { + return r.years === e.years && r.months === e.months && r.days === e.days && r.milliseconds === e.milliseconds; +} +function JT(r, e) { + return { + years: r.years + e.years, + months: r.months + e.months, + days: r.days + e.days, + milliseconds: r.milliseconds + e.milliseconds + }; +} +function o_e(r, e) { + return { + years: r.years - e.years, + months: r.months - e.months, + days: r.days - e.days, + milliseconds: r.milliseconds - e.milliseconds + }; +} +function s_e(r, e) { + return { + years: r.years * e, + months: r.months * e, + days: r.days * e, + milliseconds: r.milliseconds * e + }; +} +function l_e(r) { + return Ad(r) / 365; +} +function u_e(r) { + return Ad(r) / 30; +} +function Ad(r) { + return Ls(r) / 864e5; +} +function Ls(r) { + return r.years * (365 * 864e5) + r.months * (30 * 864e5) + r.days * 864e5 + r.milliseconds; +} +function QE(r, e) { + let t = null; + for (let n = 0; n < vz.length; n += 1) { + let i = vz[n]; + if (e[i]) { + let a = r[i] / e[i]; + if (!Q0(a) || t !== null && t !== a) + return null; + t = a; + } else if (r[i]) + return null; + } + return t; +} +function KT(r) { + let e = r.milliseconds; + if (e) { + if (e % 1e3 !== 0) + return { unit: "millisecond", value: e }; + if (e % (1e3 * 60) !== 0) + return { unit: "second", value: e / 1e3 }; + if (e % (1e3 * 60 * 60) !== 0) + return { unit: "minute", value: e / (1e3 * 60) }; + if (e) + return { unit: "hour", value: e / (1e3 * 60 * 60) }; + } + return r.days ? r.specifiedWeeks && r.days % 7 === 0 ? { unit: "week", value: r.days / 7 } : { unit: "day", value: r.days } : r.months ? { unit: "month", value: r.months } : r.years ? { unit: "year", value: r.years } : { unit: "millisecond", value: 0 }; +} +const { hasOwnProperty: lb } = Object.prototype; +function qE(r, e) { + let t = {}; + if (e) { + for (let n in e) + if (e[n] === _h) { + let i = []; + for (let a = r.length - 1; a >= 0; a -= 1) { + let o = r[a][n]; + if (typeof o == "object" && o) + i.unshift(o); + else if (o !== void 0) { + t[n] = o; + break; + } + } + i.length && (t[n] = qE(i)); + } + } + for (let n = r.length - 1; n >= 0; n -= 1) { + let i = r[n]; + for (let a in i) + a in t || (t[a] = i[a]); + } + return t; +} +function ef(r, e) { + let t = {}; + for (let n in r) + e(r[n], n) && (t[n] = r[n]); + return t; +} +function su(r, e) { + let t = {}; + for (let n in r) + t[n] = e(r[n], n); + return t; +} +function dG(r) { + let e = {}; + for (let t of r) + e[t] = !0; + return e; +} +function eM(r) { + let e = []; + for (let t in r) + e.push(r[t]); + return e; +} +function El(r, e) { + if (r === e) + return !0; + for (let t in r) + if (lb.call(r, t) && !(t in e)) + return !1; + for (let t in e) + if (lb.call(e, t) && r[t] !== e[t]) + return !1; + return !0; +} +const c_e = /^on[A-Z]/; +function h_e(r, e) { + const t = QT(r, e); + for (let n of t) + if (!c_e.test(n)) + return !1; + return !0; +} +function QT(r, e) { + let t = []; + for (let n in r) + lb.call(r, n) && (n in e || t.push(n)); + for (let n in e) + lb.call(e, n) && r[n] !== e[n] && t.push(n); + return t; +} +function kC(r, e, t = {}) { + if (r === e) + return !0; + for (let n in e) + if (!(n in r && f_e(r[n], e[n], t[n]))) + return !1; + for (let n in r) + if (!(n in e)) + return !1; + return !0; +} +function f_e(r, e, t) { + return r === e || t === !0 ? !0 : t ? t(r, e) : !1; +} +function d_e(r, e = 0, t, n = 1) { + let i = []; + t == null && (t = Object.keys(r).length); + for (let a = e; a < t; a += n) { + let o = r[a]; + o !== void 0 && i.push(o); + } + return i; +} +function _c(r, e, t) { + if (r === e) + return !0; + let n = r.length, i; + if (n !== e.length) + return !1; + for (i = 0; i < n; i += 1) + if (!(t ? t(r[i], e[i]) : r[i] === e[i])) + return !1; + return !0; +} +const v_e = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]; +function gz(r, e) { + let t = tc(r); + return t[2] += e * 7, ro(t); +} +function Bi(r, e) { + let t = tc(r); + return t[2] += e, ro(t); +} +function bc(r, e) { + let t = tc(r); + return t[6] += e, ro(t); +} +function p_e(r, e) { + return Ic(r, e) / 7; +} +function Ic(r, e) { + return (e.valueOf() - r.valueOf()) / (1e3 * 60 * 60 * 24); +} +function g_e(r, e) { + return (e.valueOf() - r.valueOf()) / (1e3 * 60 * 60); +} +function m_e(r, e) { + return (e.valueOf() - r.valueOf()) / (1e3 * 60); +} +function y_e(r, e) { + return (e.valueOf() - r.valueOf()) / 1e3; +} +function __e(r, e) { + let t = kn(r), n = kn(e); + return { + years: 0, + months: 0, + days: Math.round(Ic(t, n)), + milliseconds: e.valueOf() - n.valueOf() - (r.valueOf() - t.valueOf()) + }; +} +function b_e(r, e) { + let t = ub(r, e); + return t !== null && t % 7 === 0 ? t / 7 : null; +} +function ub(r, e) { + return rc(r) === rc(e) ? Math.round(Ic(r, e)) : null; +} +function kn(r) { + return ro([ + r.getUTCFullYear(), + r.getUTCMonth(), + r.getUTCDate() + ]); +} +function x_e(r) { + return ro([ + r.getUTCFullYear(), + r.getUTCMonth(), + r.getUTCDate(), + r.getUTCHours() + ]); +} +function S_e(r) { + return ro([ + r.getUTCFullYear(), + r.getUTCMonth(), + r.getUTCDate(), + r.getUTCHours(), + r.getUTCMinutes() + ]); +} +function w_e(r) { + return ro([ + r.getUTCFullYear(), + r.getUTCMonth(), + r.getUTCDate(), + r.getUTCHours(), + r.getUTCMinutes(), + r.getUTCSeconds() + ]); +} +function C_e(r, e, t) { + let n = r.getUTCFullYear(), i = OC(r, n, e, t); + if (i < 1) + return OC(r, n - 1, e, t); + let a = OC(r, n + 1, e, t); + return a >= 1 ? Math.min(i, a) : i; +} +function OC(r, e, t, n) { + let i = ro([e, 0, 1 + T_e(e, t, n)]), a = kn(r), o = Math.round(Ic(i, a)); + return Math.floor(o / 7) + 1; +} +function T_e(r, e, t) { + let n = 7 + e - t; + return -((7 + ro([r, 0, n]).getUTCDay() - e) % 7) + n - 1; +} +function mz(r) { + return [ + r.getFullYear(), + r.getMonth(), + r.getDate(), + r.getHours(), + r.getMinutes(), + r.getSeconds(), + r.getMilliseconds() + ]; +} +function yz(r) { + return new Date( + r[0], + r[1] || 0, + r[2] == null ? 1 : r[2], + // day of month + r[3] || 0, + r[4] || 0, + r[5] || 0 + ); +} +function tc(r) { + return [ + r.getUTCFullYear(), + r.getUTCMonth(), + r.getUTCDate(), + r.getUTCHours(), + r.getUTCMinutes(), + r.getUTCSeconds(), + r.getUTCMilliseconds() + ]; +} +function ro(r) { + return r.length === 1 && (r = r.concat([0])), new Date(Date.UTC(...r)); +} +function vG(r) { + return !isNaN(r.valueOf()); +} +function rc(r) { + return r.getUTCHours() * 1e3 * 60 * 60 + r.getUTCMinutes() * 1e3 * 60 + r.getUTCSeconds() * 1e3 + r.getUTCMilliseconds(); +} +function pG(r, e, t = !1) { + let n = r.toISOString(); + return n = n.replace(".000", ""), t && (n = n.replace("T00:00:00Z", "")), n.length > 10 && (e == null ? n = n.replace("Z", "") : e !== 0 && (n = n.replace("Z", tM(e, !0)))), n; +} +function ym(r) { + return r.toISOString().replace(/T.*$/, ""); +} +function I_e(r) { + return r.toISOString().match(/^\d{4}-\d{2}/)[0]; +} +function A_e(r) { + return Id(r.getUTCHours(), 2) + ":" + Id(r.getUTCMinutes(), 2) + ":" + Id(r.getUTCSeconds(), 2); +} +function tM(r, e = !1) { + let t = r < 0 ? "-" : "+", n = Math.abs(r), i = Math.floor(n / 60), a = Math.round(n % 60); + return e ? `${t + Id(i, 2)}:${Id(a, 2)}` : `GMT${t}${i}${a ? `:${Id(a, 2)}` : ""}`; +} +function rr(r, e, t) { + let n, i; + return function(...a) { + if (!n) + i = r.apply(this, a); + else if (!_c(n, a)) { + t && t(i); + let o = r.apply(this, a); + (!e || !e(o, i)) && (i = o); + } + return n = a, i; + }; +} +function q0(r, e, t) { + let n, i; + return (a) => { + if (!n) + i = r.call(this, a); + else if (!El(n, a)) { + t && t(i); + let o = r.call(this, a); + (!e || !e(o, i)) && (i = o); + } + return n = a, i; + }; +} +const _z = { + week: 3, + separator: 0, + omitZeroMinute: 0, + meridiem: 0, + omitCommas: 0 +}, cb = { + timeZoneName: 7, + era: 6, + year: 5, + month: 4, + day: 2, + weekday: 2, + hour: 1, + minute: 1, + second: 1 +}, S0 = /\s*([ap])\.?m\.?/i, E_e = /,/g, M_e = /\s+/g, D_e = /\u200e/g, k_e = /UTC|GMT/; +class O_e { + constructor(e) { + let t = {}, n = {}, i = 0; + for (let a in e) + a in _z ? (n[a] = e[a], i = Math.max(_z[a], i)) : (t[a] = e[a], a in cb && (i = Math.max(cb[a], i))); + this.standardDateProps = t, this.extendedSettings = n, this.severity = i, this.buildFormattingFunc = rr(bz); + } + format(e, t) { + return this.buildFormattingFunc(this.standardDateProps, this.extendedSettings, t)(e); + } + formatRange(e, t, n, i) { + let { standardDateProps: a, extendedSettings: o } = this, s = B_e(e.marker, t.marker, n.calendarSystem); + if (!s) + return this.format(e, n); + let l = s; + l > 1 && // the two dates are different in a way that's larger scale than time + (a.year === "numeric" || a.year === "2-digit") && (a.month === "numeric" || a.month === "2-digit") && (a.day === "numeric" || a.day === "2-digit") && (l = 1); + let u = this.format(e, n), c = this.format(t, n); + if (u === c) + return u; + let h = j_e(a, l), f = bz(h, o, n), v = f(e), b = f(t), w = F_e(u, v, c, b), p = o.separator || i || n.defaultSeparator || ""; + return w ? w.before + v + p + b + w.after : u + p + c; + } + getLargestUnit() { + switch (this.severity) { + case 7: + case 6: + case 5: + return "year"; + case 4: + return "month"; + case 3: + return "week"; + case 2: + return "day"; + default: + return "time"; + } + } +} +function bz(r, e, t) { + let n = Object.keys(r).length; + return n === 1 && r.timeZoneName === "short" ? (i) => tM(i.timeZoneOffset) : n === 0 && e.week ? (i) => z_e(t.computeWeekNumber(i.marker), t.weekText, t.weekTextLong, t.locale, e.week) : L_e(r, e, t); +} +function L_e(r, e, t) { + r = Object.assign({}, r), e = Object.assign({}, e), P_e(r, e), r.timeZone = "UTC"; + let n = new Intl.DateTimeFormat(t.locale.codes, r), i; + if (e.omitZeroMinute) { + let a = Object.assign({}, r); + delete a.minute, i = new Intl.DateTimeFormat(t.locale.codes, a); + } + return (a) => { + let { marker: o } = a, s; + i && !o.getUTCMinutes() ? s = i : s = n; + let l = s.format(o); + return R_e(l, a, r, e, t); + }; +} +function P_e(r, e) { + r.timeZoneName && (r.hour || (r.hour = "2-digit"), r.minute || (r.minute = "2-digit")), r.timeZoneName === "long" && (r.timeZoneName = "short"), e.omitZeroMinute && (r.second || r.millisecond) && delete e.omitZeroMinute; +} +function R_e(r, e, t, n, i) { + return r = r.replace(D_e, ""), t.timeZoneName === "short" && (r = N_e(r, i.timeZone === "UTC" || e.timeZoneOffset == null ? "UTC" : ( + // important to normalize for IE, which does "GMT" + tM(e.timeZoneOffset) + ))), n.omitCommas && (r = r.replace(E_e, "").trim()), n.omitZeroMinute && (r = r.replace(":00", "")), n.meridiem === !1 ? r = r.replace(S0, "").trim() : n.meridiem === "narrow" ? r = r.replace(S0, (a, o) => o.toLocaleLowerCase()) : n.meridiem === "short" ? r = r.replace(S0, (a, o) => `${o.toLocaleLowerCase()}m`) : n.meridiem === "lowercase" && (r = r.replace(S0, (a) => a.toLocaleLowerCase())), r = r.replace(M_e, " "), r = r.trim(), r; +} +function N_e(r, e) { + let t = !1; + return r = r.replace(k_e, () => (t = !0, e)), t || (r += ` ${e}`), r; +} +function z_e(r, e, t, n, i) { + let a = []; + return i === "long" ? a.push(t) : (i === "short" || i === "narrow") && a.push(e), (i === "long" || i === "short") && a.push(" "), a.push(n.simpleNumberFormat.format(r)), n.options.direction === "rtl" && a.reverse(), a.join(""); +} +function B_e(r, e, t) { + return t.getMarkerYear(r) !== t.getMarkerYear(e) ? 5 : t.getMarkerMonth(r) !== t.getMarkerMonth(e) ? 4 : t.getMarkerDay(r) !== t.getMarkerDay(e) ? 2 : rc(r) !== rc(e) ? 1 : 0; +} +function j_e(r, e) { + let t = {}; + for (let n in r) + (!(n in cb) || // not a date part prop (like timeZone) + cb[n] <= e) && (t[n] = r[n]); + return t; +} +function F_e(r, e, t, n) { + let i = 0; + for (; i < r.length; ) { + let a = r.indexOf(e, i); + if (a === -1) + break; + let o = r.substr(0, a); + i = a + e.length; + let s = r.substr(i), l = 0; + for (; l < t.length; ) { + let u = t.indexOf(n, l); + if (u === -1) + break; + let c = t.substr(0, u); + l = u + n.length; + let h = t.substr(l); + if (o === c && s === h) + return { + before: o, + after: s + }; + } + } + return null; +} +function xz(r, e) { + let t = e.markerToArray(r.marker); + return { + marker: r.marker, + timeZoneOffset: r.timeZoneOffset, + array: t, + year: t[0], + month: t[1], + day: t[2], + hour: t[3], + minute: t[4], + second: t[5], + millisecond: t[6] + }; +} +function hb(r, e, t, n) { + let i = xz(r, t.calendarSystem), a = e ? xz(e, t.calendarSystem) : null; + return { + date: i, + start: i, + end: a, + timeZone: t.timeZone, + localeCodes: t.locale.codes, + defaultSeparator: n || t.defaultSeparator + }; +} +class $_e { + constructor(e) { + this.cmdStr = e; + } + format(e, t, n) { + return t.cmdFormatter(this.cmdStr, hb(e, null, t, n)); + } + formatRange(e, t, n, i) { + return n.cmdFormatter(this.cmdStr, hb(e, t, n, i)); + } +} +class H_e { + constructor(e) { + this.func = e; + } + format(e, t, n) { + return this.func(hb(e, null, t, n)); + } + formatRange(e, t, n, i) { + return this.func(hb(e, t, n, i)); + } +} +function jn(r) { + return typeof r == "object" && r ? new O_e(r) : typeof r == "string" ? new $_e(r) : typeof r == "function" ? new H_e(r) : null; +} +const Sz = { + navLinkDayClick: $e, + navLinkWeekClick: $e, + duration: Xr, + bootstrapFontAwesome: $e, + buttonIcons: $e, + customButtons: $e, + defaultAllDayEventDuration: Xr, + defaultTimedEventDuration: Xr, + nextDayThreshold: Xr, + scrollTime: Xr, + scrollTimeReset: Boolean, + slotMinTime: Xr, + slotMaxTime: Xr, + dayPopoverFormat: jn, + slotDuration: Xr, + snapDuration: Xr, + headerToolbar: $e, + footerToolbar: $e, + defaultRangeSeparator: String, + titleRangeSeparator: String, + forceEventDuration: Boolean, + dayHeaders: Boolean, + dayHeaderFormat: jn, + dayHeaderClassNames: $e, + dayHeaderContent: $e, + dayHeaderDidMount: $e, + dayHeaderWillUnmount: $e, + dayCellClassNames: $e, + dayCellContent: $e, + dayCellDidMount: $e, + dayCellWillUnmount: $e, + initialView: String, + aspectRatio: Number, + weekends: Boolean, + weekNumberCalculation: $e, + weekNumbers: Boolean, + weekNumberClassNames: $e, + weekNumberContent: $e, + weekNumberDidMount: $e, + weekNumberWillUnmount: $e, + editable: Boolean, + viewClassNames: $e, + viewDidMount: $e, + viewWillUnmount: $e, + nowIndicator: Boolean, + nowIndicatorClassNames: $e, + nowIndicatorContent: $e, + nowIndicatorDidMount: $e, + nowIndicatorWillUnmount: $e, + showNonCurrentDates: Boolean, + lazyFetching: Boolean, + startParam: String, + endParam: String, + timeZoneParam: String, + timeZone: String, + locales: $e, + locale: $e, + themeSystem: String, + dragRevertDuration: Number, + dragScroll: Boolean, + allDayMaintainDuration: Boolean, + unselectAuto: Boolean, + dropAccept: $e, + eventOrder: K0e, + eventOrderStrict: Boolean, + handleWindowResize: Boolean, + windowResizeDelay: Number, + longPressDelay: Number, + eventDragMinDistance: Number, + expandRows: Boolean, + height: $e, + contentHeight: $e, + direction: String, + weekNumberFormat: jn, + eventResizableFromStart: Boolean, + displayEventTime: Boolean, + displayEventEnd: Boolean, + weekText: String, + weekTextLong: String, + progressiveEventRendering: Boolean, + businessHours: $e, + initialDate: $e, + now: $e, + eventDataTransform: $e, + stickyHeaderDates: $e, + stickyFooterScrollbar: $e, + viewHeight: $e, + defaultAllDay: Boolean, + eventSourceFailure: $e, + eventSourceSuccess: $e, + eventDisplay: String, + eventStartEditable: Boolean, + eventDurationEditable: Boolean, + eventOverlap: $e, + eventConstraint: $e, + eventAllow: $e, + eventBackgroundColor: String, + eventBorderColor: String, + eventTextColor: String, + eventColor: String, + eventClassNames: $e, + eventContent: $e, + eventDidMount: $e, + eventWillUnmount: $e, + selectConstraint: $e, + selectOverlap: $e, + selectAllow: $e, + droppable: Boolean, + unselectCancel: String, + slotLabelFormat: $e, + slotLaneClassNames: $e, + slotLaneContent: $e, + slotLaneDidMount: $e, + slotLaneWillUnmount: $e, + slotLabelClassNames: $e, + slotLabelContent: $e, + slotLabelDidMount: $e, + slotLabelWillUnmount: $e, + dayMaxEvents: $e, + dayMaxEventRows: $e, + dayMinWidth: Number, + slotLabelInterval: Xr, + allDayText: String, + allDayClassNames: $e, + allDayContent: $e, + allDayDidMount: $e, + allDayWillUnmount: $e, + slotMinWidth: Number, + navLinks: Boolean, + eventTimeFormat: jn, + rerenderDelay: Number, + moreLinkText: $e, + moreLinkHint: $e, + selectMinDistance: Number, + selectable: Boolean, + selectLongPressDelay: Number, + eventLongPressDelay: Number, + selectMirror: Boolean, + eventMaxStack: Number, + eventMinHeight: Number, + eventMinWidth: Number, + eventShortHeight: Number, + slotEventOverlap: Boolean, + plugins: $e, + firstDay: Number, + dayCount: Number, + dateAlignment: String, + dateIncrement: Xr, + hiddenDays: $e, + fixedWeekCount: Boolean, + validRange: $e, + visibleRange: $e, + titleFormat: $e, + eventInteractive: Boolean, + // only used by list-view, but languages define the value, so we need it in base options + noEventsText: String, + viewHint: $e, + navLinkHint: $e, + closeHint: String, + timeHint: String, + eventHint: String, + moreLinkClick: $e, + moreLinkClassNames: $e, + moreLinkContent: $e, + moreLinkDidMount: $e, + moreLinkWillUnmount: $e, + monthStartFormat: jn, + // for connectors + // (can't be part of plugin system b/c must be provided at runtime) + handleCustomRendering: $e, + customRenderingMetaMap: $e, + customRenderingReplacesEl: Boolean +}, tg = { + eventDisplay: "auto", + defaultRangeSeparator: " - ", + titleRangeSeparator: " – ", + defaultTimedEventDuration: "01:00:00", + defaultAllDayEventDuration: { day: 1 }, + forceEventDuration: !1, + nextDayThreshold: "00:00:00", + dayHeaders: !0, + initialView: "", + aspectRatio: 1.35, + headerToolbar: { + start: "title", + center: "", + end: "today prev,next" + }, + weekends: !0, + weekNumbers: !1, + weekNumberCalculation: "local", + editable: !1, + nowIndicator: !1, + scrollTime: "06:00:00", + scrollTimeReset: !0, + slotMinTime: "00:00:00", + slotMaxTime: "24:00:00", + showNonCurrentDates: !0, + lazyFetching: !0, + startParam: "start", + endParam: "end", + timeZoneParam: "timeZone", + timeZone: "local", + locales: [], + locale: "", + themeSystem: "standard", + dragRevertDuration: 500, + dragScroll: !0, + allDayMaintainDuration: !1, + unselectAuto: !0, + dropAccept: "*", + eventOrder: "start,-duration,allDay,title", + dayPopoverFormat: { month: "long", day: "numeric", year: "numeric" }, + handleWindowResize: !0, + windowResizeDelay: 100, + longPressDelay: 1e3, + eventDragMinDistance: 5, + expandRows: !1, + navLinks: !1, + selectable: !1, + eventMinHeight: 15, + eventMinWidth: 30, + eventShortHeight: 30, + monthStartFormat: { month: "long", day: "numeric" } +}, wz = { + datesSet: $e, + eventsSet: $e, + eventAdd: $e, + eventChange: $e, + eventRemove: $e, + windowResize: $e, + eventClick: $e, + eventMouseEnter: $e, + eventMouseLeave: $e, + select: $e, + unselect: $e, + loading: $e, + // internal + _unmount: $e, + _beforeprint: $e, + _afterprint: $e, + _noEventDrop: $e, + _noEventResize: $e, + _resize: $e, + _scrollRequest: $e +}, Cz = { + buttonText: $e, + buttonHints: $e, + views: $e, + plugins: $e, + initialEvents: $e, + events: $e, + eventSources: $e +}, yh = { + headerToolbar: _h, + footerToolbar: _h, + buttonText: _h, + buttonHints: _h, + buttonIcons: _h, + dateIncrement: _h, + plugins: w0, + events: w0, + eventSources: w0, + resources: w0 +}; +function _h(r, e) { + return typeof r == "object" && typeof e == "object" && r && e ? El(r, e) : r === e; +} +function w0(r, e) { + return Array.isArray(r) && Array.isArray(e) ? _c(r, e) : r === e; +} +const V_e = { + type: String, + component: $e, + buttonText: String, + buttonTextKey: String, + dateProfileGeneratorClass: $e, + usesMinMaxTime: Boolean, + classNames: $e, + content: $e, + didMount: $e, + willUnmount: $e +}; +function LC(r) { + return qE(r, yh); +} +function rM(r, e) { + let t = {}, n = {}; + for (let i in e) + i in r && (t[i] = e[i](r[i])); + for (let i in r) + i in e || (n[i] = r[i]); + return { refined: t, extra: n }; +} +function $e(r) { + return r; +} +function nM(r, e, t, n) { + return { + instanceId: df(), + defId: r, + range: e, + forcedStartTzo: t == null ? null : t, + forcedEndTzo: n == null ? null : n + }; +} +function G_e(r, e, t, n) { + for (let i = 0; i < n.length; i += 1) { + let a = n[i].parse(r, t); + if (a) { + let { allDay: o } = r; + return o == null && (o = e, o == null && (o = a.allDayGuess, o == null && (o = !1))), { + allDay: o, + duration: a.duration, + typeData: a.typeData, + typeId: i + }; + } + } + return null; +} +function tf(r, e, t) { + let { dateEnv: n, pluginHooks: i, options: a } = t, { defs: o, instances: s } = r; + s = ef(s, (l) => !o[l.defId].recurringDef); + for (let l in o) { + let u = o[l]; + if (u.recurringDef) { + let { duration: c } = u.recurringDef; + c || (c = u.allDay ? a.defaultAllDayEventDuration : a.defaultTimedEventDuration); + let h = U_e(u, c, e, n, i.recurringTypes); + for (let f of h) { + let v = nM(l, { + start: f, + end: n.add(f, c) + }); + s[v.instanceId] = v; + } + } + } + return { defs: o, instances: s }; +} +function U_e(r, e, t, n, i) { + let o = i[r.recurringDef.typeId].expand(r.recurringDef.typeData, { + start: n.subtract(t.start, e), + end: t.end + }, n); + return r.allDay && (o = o.map(kn)), o; +} +function $g(r, e, t, n, i, a) { + let o = xo(), s = oM(t); + for (let l of r) { + let u = yG(l, e, t, n, s, i, a); + u && qT(u, o); + } + return o; +} +function qT(r, e = xo()) { + return e.defs[r.def.defId] = r.def, r.instance && (e.instances[r.instance.instanceId] = r.instance), e; +} +function iM(r, e) { + let t = r.instances[e]; + if (t) { + let n = r.defs[t.defId], i = bx(r, (a) => W_e(n, a)); + return i.defs[n.defId] = n, i.instances[t.instanceId] = t, i; + } + return xo(); +} +function W_e(r, e) { + return !!(r.groupId && r.groupId === e.groupId); +} +function xo() { + return { defs: {}, instances: {} }; +} +function aM(r, e) { + return { + defs: Object.assign(Object.assign({}, r.defs), e.defs), + instances: Object.assign(Object.assign({}, r.instances), e.instances) + }; +} +function bx(r, e) { + let t = ef(r.defs, e), n = ef(r.instances, (i) => t[i.defId]); + return { defs: t, instances: n }; +} +function Y_e(r, e) { + let { defs: t, instances: n } = r, i = {}, a = {}; + for (let o in t) + e.defs[o] || (i[o] = t[o]); + for (let o in n) + !e.instances[o] && // not explicitly excluded + i[n[o].defId] && (a[o] = n[o]); + return { + defs: i, + instances: a + }; +} +function X_e(r, e) { + return Array.isArray(r) ? $g(r, null, e, !0) : typeof r == "object" && r ? $g([r], null, e, !0) : r != null ? String(r) : null; +} +function Tz(r) { + return Array.isArray(r) ? r : typeof r == "string" ? r.split(/\s+/) : []; +} +const fb = { + display: String, + editable: Boolean, + startEditable: Boolean, + durationEditable: Boolean, + constraint: $e, + overlap: $e, + allow: $e, + className: Tz, + classNames: Tz, + color: String, + backgroundColor: String, + borderColor: String, + textColor: String +}, Z_e = { + display: null, + startEditable: null, + durationEditable: null, + constraints: [], + overlap: null, + allows: [], + backgroundColor: "", + borderColor: "", + textColor: "", + classNames: [] +}; +function db(r, e) { + let t = X_e(r.constraint, e); + return { + display: r.display || null, + startEditable: r.startEditable != null ? r.startEditable : r.editable, + durationEditable: r.durationEditable != null ? r.durationEditable : r.editable, + constraints: t != null ? [t] : [], + overlap: r.overlap != null ? r.overlap : null, + allows: r.allow != null ? [r.allow] : [], + backgroundColor: r.backgroundColor || r.color || "", + borderColor: r.borderColor || r.color || "", + textColor: r.textColor || "", + classNames: (r.className || []).concat(r.classNames || []) + // join singular and plural + }; +} +function gG(r) { + return r.reduce(J_e, Z_e); +} +function J_e(r, e) { + return { + display: e.display != null ? e.display : r.display, + startEditable: e.startEditable != null ? e.startEditable : r.startEditable, + durationEditable: e.durationEditable != null ? e.durationEditable : r.durationEditable, + constraints: r.constraints.concat(e.constraints), + overlap: typeof e.overlap == "boolean" ? e.overlap : r.overlap, + allows: r.allows.concat(e.allows), + backgroundColor: e.backgroundColor || r.backgroundColor, + borderColor: e.borderColor || r.borderColor, + textColor: e.textColor || r.textColor, + classNames: r.classNames.concat(e.classNames) + }; +} +const e_ = { + id: String, + groupId: String, + title: String, + url: String, + interactive: Boolean +}, mG = { + start: $e, + end: $e, + date: $e, + allDay: Boolean +}, K_e = Object.assign(Object.assign(Object.assign({}, e_), mG), { extendedProps: $e }); +function yG(r, e, t, n, i = oM(t), a, o) { + let { refined: s, extra: l } = _G(r, t, i), u = q_e(e, t), c = G_e(s, u, t.dateEnv, t.pluginHooks.recurringTypes); + if (c) { + let f = eI(s, l, e ? e.sourceId : "", c.allDay, !!c.duration, t, a); + return f.recurringDef = { + typeId: c.typeId, + typeData: c.typeData, + duration: c.duration + }, { def: f, instance: null }; + } + let h = Q_e(s, u, t, n); + if (h) { + let f = eI(s, l, e ? e.sourceId : "", h.allDay, h.hasEnd, t, a), v = nM(f.defId, h.range, h.forcedStartTzo, h.forcedEndTzo); + return o && f.publicId && o[f.publicId] && (v.instanceId = o[f.publicId]), { def: f, instance: v }; + } + return null; +} +function _G(r, e, t = oM(e)) { + return rM(r, t); +} +function oM(r) { + return Object.assign(Object.assign(Object.assign({}, fb), K_e), r.pluginHooks.eventRefiners); +} +function eI(r, e, t, n, i, a, o) { + let s = { + title: r.title || "", + groupId: r.groupId || "", + publicId: r.id || "", + url: r.url || "", + recurringDef: null, + defId: (o && r.id ? o[r.id] : "") || df(), + sourceId: t, + allDay: n, + hasEnd: i, + interactive: r.interactive, + ui: db(r, a), + extendedProps: Object.assign(Object.assign({}, r.extendedProps || {}), e) + }; + for (let l of a.pluginHooks.eventDefMemberAdders) + Object.assign(s, l(r)); + return Object.freeze(s.ui.classNames), Object.freeze(s.extendedProps), s; +} +function Q_e(r, e, t, n) { + let { allDay: i } = r, a, o = null, s = !1, l, u = null, c = r.start != null ? r.start : r.date; + if (a = t.dateEnv.createMarkerMeta(c), a) + o = a.marker; + else if (!n) + return null; + return r.end != null && (l = t.dateEnv.createMarkerMeta(r.end)), i == null && (e != null ? i = e : i = (!a || a.isTimeUnspecified) && (!l || l.isTimeUnspecified)), i && o && (o = kn(o)), l && (u = l.marker, i && (u = kn(u)), o && u <= o && (u = null)), u ? s = !0 : n || (s = t.options.forceEventDuration || !1, u = t.dateEnv.add(o, i ? t.options.defaultAllDayEventDuration : t.options.defaultTimedEventDuration)), { + allDay: i, + hasEnd: s, + range: { start: o, end: u }, + forcedStartTzo: a ? a.forcedTzo : null, + forcedEndTzo: l ? l.forcedTzo : null + }; +} +function q_e(r, e) { + let t = null; + return r && (t = r.defaultAllDay), t == null && (t = e.options.defaultAllDay), t; +} +const ebe = { + startTime: "09:00", + endTime: "17:00", + daysOfWeek: [1, 2, 3, 4, 5], + display: "inverse-background", + classNames: "fc-non-business", + groupId: "_businessHours" + // so multiple defs get grouped +}; +function tbe(r, e) { + return $g(rbe(r), null, e); +} +function rbe(r) { + let e; + return r === !0 ? e = [{}] : Array.isArray(r) ? e = r.filter((t) => t.daysOfWeek) : typeof r == "object" && r ? e = [r] : e = [], e = e.map((t) => Object.assign(Object.assign({}, ebe), t)), e; +} +function bG(r) { + let e = Math.floor(Ic(r.start, r.end)) || 1, t = kn(r.start), n = Bi(t, e); + return { start: t, end: n }; +} +function sM(r, e = Xr(0)) { + let t = null, n = null; + if (r.end) { + n = kn(r.end); + let i = r.end.valueOf() - n.valueOf(); + i && i >= Ls(e) && (n = Bi(n, 1)); + } + return r.start && (t = kn(r.start), n && n <= t && (n = Bi(t, 1))), { start: t, end: n }; +} +function nbe(r) { + let e = sM(r); + return Ic(e.start, e.end) > 1; +} +function pd(r, e, t, n) { + return n === "year" ? Xr(t.diffWholeYears(r, e), "year") : n === "month" ? Xr(t.diffWholeMonths(r, e), "month") : __e(r, e); +} +function ibe(r, e) { + return r.left >= e.left && r.left < e.right && r.top >= e.top && r.top < e.bottom; +} +function xG(r, e) { + let t = { + left: Math.max(r.left, e.left), + right: Math.min(r.right, e.right), + top: Math.max(r.top, e.top), + bottom: Math.min(r.bottom, e.bottom) + }; + return t.left < t.right && t.top < t.bottom ? t : !1; +} +function abe(r, e) { + return { + left: Math.min(Math.max(r.left, e.left), e.right), + top: Math.min(Math.max(r.top, e.top), e.bottom) + }; +} +function obe(r) { + return { + left: (r.left + r.right) / 2, + top: (r.top + r.bottom) / 2 + }; +} +function sbe(r, e) { + return { + left: r.left - e.left, + top: r.top - e.top + }; +} +let PC; +function SG() { + return PC == null && (PC = lbe()), PC; +} +function lbe() { + if (typeof document == "undefined") + return !0; + let r = document.createElement("div"); + r.style.position = "absolute", r.style.top = "0px", r.style.left = "0px", r.innerHTML = "
        ", r.querySelector("table").style.height = "100px", r.querySelector("div").style.height = "100%", document.body.appendChild(r); + let t = r.querySelector("div").offsetHeight > 0; + return document.body.removeChild(r), t; +} +const RC = xo(); +class ube { + constructor() { + this.getKeysForEventDefs = rr(this._getKeysForEventDefs), this.splitDateSelection = rr(this._splitDateSpan), this.splitEventStore = rr(this._splitEventStore), this.splitIndividualUi = rr(this._splitIndividualUi), this.splitEventDrag = rr(this._splitInteraction), this.splitEventResize = rr(this._splitInteraction), this.eventUiBuilders = {}; + } + splitProps(e) { + let t = this.getKeyInfo(e), n = this.getKeysForEventDefs(e.eventStore), i = this.splitDateSelection(e.dateSelection), a = this.splitIndividualUi(e.eventUiBases, n), o = this.splitEventStore(e.eventStore, n), s = this.splitEventDrag(e.eventDrag), l = this.splitEventResize(e.eventResize), u = {}; + this.eventUiBuilders = su(t, (c, h) => this.eventUiBuilders[h] || rr(cbe)); + for (let c in t) { + let h = t[c], f = o[c] || RC, v = this.eventUiBuilders[c]; + u[c] = { + businessHours: h.businessHours || e.businessHours, + dateSelection: i[c] || null, + eventStore: f, + eventUiBases: v(e.eventUiBases[""], h.ui, a[c]), + eventSelection: f.instances[e.eventSelection] ? e.eventSelection : "", + eventDrag: s[c] || null, + eventResize: l[c] || null + }; + } + return u; + } + _splitDateSpan(e) { + let t = {}; + if (e) { + let n = this.getKeysForDateSpan(e); + for (let i of n) + t[i] = e; + } + return t; + } + _getKeysForEventDefs(e) { + return su(e.defs, (t) => this.getKeysForEventDef(t)); + } + _splitEventStore(e, t) { + let { defs: n, instances: i } = e, a = {}; + for (let o in n) + for (let s of t[o]) + a[s] || (a[s] = xo()), a[s].defs[o] = n[o]; + for (let o in i) { + let s = i[o]; + for (let l of t[s.defId]) + a[l] && (a[l].instances[o] = s); + } + return a; + } + _splitIndividualUi(e, t) { + let n = {}; + for (let i in e) + if (i) + for (let a of t[i]) + n[a] || (n[a] = {}), n[a][i] = e[i]; + return n; + } + _splitInteraction(e) { + let t = {}; + if (e) { + let n = this._splitEventStore(e.affectedEvents, this._getKeysForEventDefs(e.affectedEvents)), i = this._getKeysForEventDefs(e.mutatedEvents), a = this._splitEventStore(e.mutatedEvents, i), o = (s) => { + t[s] || (t[s] = { + affectedEvents: n[s] || RC, + mutatedEvents: a[s] || RC, + isEvent: e.isEvent + }); + }; + for (let s in n) + o(s); + for (let s in a) + o(s); + } + return t; + } +} +function cbe(r, e, t) { + let n = []; + r && n.push(r), e && n.push(e); + let i = { + "": gG(n) + }; + return t && Object.assign(i, t), i; +} +function hbe(r, e) { + let t = null, n = null; + return r.start && (t = e.createMarker(r.start)), r.end && (n = e.createMarker(r.end)), !t && !n || t && n && n < t ? null : { start: t, end: n }; +} +function Iz(r, e) { + let t = [], { start: n } = e, i, a; + for (r.sort(fbe), i = 0; i < r.length; i += 1) + a = r[i], a.start > n && t.push({ start: n, end: a.start }), a.end > n && (n = a.end); + return n < e.end && t.push({ start: n, end: e.end }), t; +} +function fbe(r, e) { + return r.start.valueOf() - e.start.valueOf(); +} +function xc(r, e) { + let { start: t, end: n } = r, i = null; + return e.start !== null && (t === null ? t = e.start : t = new Date(Math.max(t.valueOf(), e.start.valueOf()))), e.end != null && (n === null ? n = e.end : n = new Date(Math.min(n.valueOf(), e.end.valueOf()))), (t === null || n === null || t < n) && (i = { start: t, end: n }), i; +} +function dbe(r, e) { + return (r.start === null ? null : r.start.valueOf()) === (e.start === null ? null : e.start.valueOf()) && (r.end === null ? null : r.end.valueOf()) === (e.end === null ? null : e.end.valueOf()); +} +function lM(r, e) { + return (r.end === null || e.start === null || r.end > e.start) && (r.start === null || e.end === null || r.start < e.end); +} +function xx(r, e) { + return (r.start === null || e.start !== null && e.start >= r.start) && (r.end === null || e.end !== null && e.end <= r.end); +} +function Ql(r, e) { + return (r.start === null || e >= r.start) && (r.end === null || e < r.end); +} +function vbe(r, e) { + return e.start != null && r < e.start ? e.start : e.end != null && r >= e.end ? new Date(e.end.valueOf() - 1) : r; +} +function uM(r, e, t, n) { + return { + dow: r.getUTCDay(), + isDisabled: !!(n && !Ql(n.activeRange, r)), + isOther: !!(n && !Ql(n.currentRange, r)), + isToday: !!(e && Ql(e, r)), + isPast: !!(t ? r < t : e && r < e.start), + isFuture: !!(t ? r > t : e && r >= e.end) + }; +} +function Sx(r, e) { + let t = [ + "fc-day", + `fc-day-${v_e[r.dow]}` + ]; + return r.isDisabled ? t.push("fc-day-disabled") : (r.isToday && (t.push("fc-day-today"), t.push(e.getClass("today"))), r.isPast && t.push("fc-day-past"), r.isFuture && t.push("fc-day-future"), r.isOther && t.push("fc-day-other")), t; +} +const pbe = jn({ year: "numeric", month: "long", day: "numeric" }), gbe = jn({ week: "long" }); +function Gd(r, e, t = "day", n = !0) { + const { dateEnv: i, options: a, calendarApi: o } = r; + let s = i.format(e, t === "week" ? gbe : pbe); + if (a.navLinks) { + let l = i.toDate(e); + const u = (c) => { + let h = t === "day" ? a.navLinkDayClick : t === "week" ? a.navLinkWeekClick : null; + typeof h == "function" ? h.call(o, i.toDate(e), c) : (typeof h == "string" && (t = h), o.zoomTo(e, t)); + }; + return Object.assign({ title: eg(a.navLinkHint, [s, l], s), "data-navlink": "" }, n ? hG(u) : { onClick: u }); + } + return { "aria-label": s }; +} +let NC = null; +function mbe() { + return NC === null && (NC = ybe()), NC; +} +function ybe() { + let r = document.createElement("div"); + qp(r, { + position: "absolute", + top: -1e3, + left: 0, + border: 0, + padding: 0, + overflow: "scroll", + direction: "rtl" + }), r.innerHTML = "
        ", document.body.appendChild(r); + let t = r.firstChild.getBoundingClientRect().left > r.getBoundingClientRect().left; + return ZE(r), t; +} +let zC; +function _be() { + return zC || (zC = bbe()), zC; +} +function bbe() { + let r = document.createElement("div"); + r.style.overflow = "scroll", r.style.position = "absolute", r.style.top = "-9999px", r.style.left = "-9999px", document.body.appendChild(r); + let e = wG(r); + return document.body.removeChild(r), e; +} +function wG(r) { + return { + x: r.offsetHeight - r.clientHeight, + y: r.offsetWidth - r.clientWidth + }; +} +function xbe(r, e = !1) { + let t = window.getComputedStyle(r), n = parseInt(t.borderLeftWidth, 10) || 0, i = parseInt(t.borderRightWidth, 10) || 0, a = parseInt(t.borderTopWidth, 10) || 0, o = parseInt(t.borderBottomWidth, 10) || 0, s = wG(r), l = s.y - n - i, u = s.x - a - o, c = { + borderLeft: n, + borderRight: i, + borderTop: a, + borderBottom: o, + scrollbarBottom: u, + scrollbarLeft: 0, + scrollbarRight: 0 + }; + return mbe() && t.direction === "rtl" ? c.scrollbarLeft = l : c.scrollbarRight = l, e && (c.paddingLeft = parseInt(t.paddingLeft, 10) || 0, c.paddingRight = parseInt(t.paddingRight, 10) || 0, c.paddingTop = parseInt(t.paddingTop, 10) || 0, c.paddingBottom = parseInt(t.paddingBottom, 10) || 0), c; +} +function Sbe(r, e = !1, t) { + let n = t ? r.getBoundingClientRect() : cM(r), i = xbe(r, e), a = { + left: n.left + i.borderLeft + i.scrollbarLeft, + right: n.right - i.borderRight - i.scrollbarRight, + top: n.top + i.borderTop, + bottom: n.bottom - i.borderBottom - i.scrollbarBottom + }; + return e && (a.left += i.paddingLeft, a.right -= i.paddingRight, a.top += i.paddingTop, a.bottom -= i.paddingBottom), a; +} +function cM(r) { + let e = r.getBoundingClientRect(); + return { + left: e.left + window.pageXOffset, + top: e.top + window.pageYOffset, + right: e.right + window.pageXOffset, + bottom: e.bottom + window.pageYOffset + }; +} +function wbe(r) { + let e = CG(r), t = r.getBoundingClientRect(); + for (let n of e) { + let i = xG(t, n.getBoundingClientRect()); + if (i) + t = i; + else + return null; + } + return t; +} +function CG(r) { + let e = []; + for (; r instanceof HTMLElement; ) { + let t = window.getComputedStyle(r); + if (t.position === "fixed") + break; + /(auto|scroll)/.test(t.overflow + t.overflowY + t.overflowX) && e.push(r), r = r.parentNode; + } + return e; +} +function Cbe(r, e, t) { + let n = !1, i = function(s) { + n || (n = !0, e(s)); + }, a = function(s) { + n || (n = !0, t(s)); + }, o = r(i, a); + o && typeof o.then == "function" && o.then(i, a); +} +class Cx { + constructor() { + this.handlers = {}, this.thisContext = null; + } + setThisContext(e) { + this.thisContext = e; + } + setOptions(e) { + this.options = e; + } + on(e, t) { + Tbe(this.handlers, e, t); + } + off(e, t) { + Ibe(this.handlers, e, t); + } + trigger(e, ...t) { + let n = this.handlers[e] || [], i = this.options && this.options[e], a = [].concat(i || [], n); + for (let o of a) + o.apply(this.thisContext, t); + } + hasHandlers(e) { + return !!(this.handlers[e] && this.handlers[e].length || this.options && this.options[e]); + } +} +function Tbe(r, e, t) { + (r[e] || (r[e] = [])).push(t); +} +function Ibe(r, e, t) { + t ? r[e] && (r[e] = r[e].filter((n) => n !== t)) : delete r[e]; +} +class Ud { + constructor(e, t, n, i) { + this.els = t; + let a = this.originClientRect = e.getBoundingClientRect(); + n && this.buildElHorizontals(a.left), i && this.buildElVerticals(a.top); + } + // Populates the left/right internal coordinate arrays + buildElHorizontals(e) { + let t = [], n = []; + for (let i of this.els) { + let a = i.getBoundingClientRect(); + t.push(a.left - e), n.push(a.right - e); + } + this.lefts = t, this.rights = n; + } + // Populates the top/bottom internal coordinate arrays + buildElVerticals(e) { + let t = [], n = []; + for (let i of this.els) { + let a = i.getBoundingClientRect(); + t.push(a.top - e), n.push(a.bottom - e); + } + this.tops = t, this.bottoms = n; + } + // Given a left offset (from document left), returns the index of the el that it horizontally intersects. + // If no intersection is made, returns undefined. + leftToIndex(e) { + let { lefts: t, rights: n } = this, i = t.length, a; + for (a = 0; a < i; a += 1) + if (e >= t[a] && e < n[a]) + return a; + } + // Given a top offset (from document top), returns the index of the el that it vertically intersects. + // If no intersection is made, returns undefined. + topToIndex(e) { + let { tops: t, bottoms: n } = this, i = t.length, a; + for (a = 0; a < i; a += 1) + if (e >= t[a] && e < n[a]) + return a; + } + // Gets the width of the element at the given index + getWidth(e) { + return this.rights[e] - this.lefts[e]; + } + // Gets the height of the element at the given index + getHeight(e) { + return this.bottoms[e] - this.tops[e]; + } + similarTo(e) { + return C0(this.tops || [], e.tops || []) && C0(this.bottoms || [], e.bottoms || []) && C0(this.lefts || [], e.lefts || []) && C0(this.rights || [], e.rights || []); + } +} +function C0(r, e) { + const t = r.length; + if (t !== e.length) + return !1; + for (let n = 0; n < t; n++) + if (Math.round(r[n]) !== Math.round(e[n])) + return !1; + return !0; +} +class hM { + getMaxScrollTop() { + return this.getScrollHeight() - this.getClientHeight(); + } + getMaxScrollLeft() { + return this.getScrollWidth() - this.getClientWidth(); + } + canScrollVertically() { + return this.getMaxScrollTop() > 0; + } + canScrollHorizontally() { + return this.getMaxScrollLeft() > 0; + } + canScrollUp() { + return this.getScrollTop() > 0; + } + canScrollDown() { + return this.getScrollTop() < this.getMaxScrollTop(); + } + canScrollLeft() { + return this.getScrollLeft() > 0; + } + canScrollRight() { + return this.getScrollLeft() < this.getMaxScrollLeft(); + } +} +class Abe extends hM { + constructor(e) { + super(), this.el = e; + } + getScrollTop() { + return this.el.scrollTop; + } + getScrollLeft() { + return this.el.scrollLeft; + } + setScrollTop(e) { + this.el.scrollTop = e; + } + setScrollLeft(e) { + this.el.scrollLeft = e; + } + getScrollWidth() { + return this.el.scrollWidth; + } + getScrollHeight() { + return this.el.scrollHeight; + } + getClientHeight() { + return this.el.clientHeight; + } + getClientWidth() { + return this.el.clientWidth; + } +} +class Ebe extends hM { + getScrollTop() { + return window.pageYOffset; + } + getScrollLeft() { + return window.pageXOffset; + } + setScrollTop(e) { + window.scroll(window.pageXOffset, e); + } + setScrollLeft(e) { + window.scroll(e, window.pageYOffset); + } + getScrollWidth() { + return document.documentElement.scrollWidth; + } + getScrollHeight() { + return document.documentElement.scrollHeight; + } + getClientHeight() { + return document.documentElement.clientHeight; + } + getClientWidth() { + return document.documentElement.clientWidth; + } +} +class _m { + constructor(e) { + this.iconOverrideOption && this.setIconOverride(e[this.iconOverrideOption]); + } + setIconOverride(e) { + let t, n; + if (typeof e == "object" && e) { + t = Object.assign({}, this.iconClasses); + for (n in e) + t[n] = this.applyIconOverridePrefix(e[n]); + this.iconClasses = t; + } else + e === !1 && (this.iconClasses = {}); + } + applyIconOverridePrefix(e) { + let t = this.iconOverridePrefix; + return t && e.indexOf(t) !== 0 && (e = t + e), e; + } + getClass(e) { + return this.classes[e] || ""; + } + getIconClass(e, t) { + let n; + return t && this.rtlIconClasses ? n = this.rtlIconClasses[e] || this.iconClasses[e] : n = this.iconClasses[e], n ? `${this.baseIconClass} ${n}` : ""; + } + getCustomButtonIconClass(e) { + let t; + return this.iconOverrideCustomButtonOption && (t = e[this.iconOverrideCustomButtonOption], t) ? `${this.baseIconClass} ${this.applyIconOverridePrefix(t)}` : ""; + } +} +_m.prototype.classes = {}; +_m.prototype.iconClasses = {}; +_m.prototype.baseIconClass = ""; +_m.prototype.iconOverridePrefix = ""; +function Az(r) { + r(); + let e = nr.debounceRendering, t = []; + function n(i) { + t.push(i); + } + for (nr.debounceRendering = n, Fg(me(Mbe, {}), document.createElement("div")); t.length; ) + t.shift()(); + nr.debounceRendering = e; +} +class Mbe extends bo { + render() { + return me("div", {}); + } + componentDidMount() { + this.setState({}); + } +} +function TG(r) { + let e = x0e(r), t = e.Provider; + return e.Provider = function() { + let n = !this.getChildContext, i = t.apply(this, arguments); + if (n) { + let a = []; + this.shouldComponentUpdate = (o) => { + this.props.value !== o.value && a.forEach((s) => { + s.context = o.value, s.forceUpdate(); + }); + }, this.sub = (o) => { + a.push(o); + let s = o.componentWillUnmount; + o.componentWillUnmount = () => { + a.splice(a.indexOf(o), 1), s && s.call(o); + }; + }; + } + return i; + }, e; +} +class Dbe { + constructor(e, t, n, i) { + this.execFunc = e, this.emitter = t, this.scrollTime = n, this.scrollTimeReset = i, this.handleScrollRequest = (a) => { + this.queuedRequest = Object.assign({}, this.queuedRequest || {}, a), this.drain(); + }, t.on("_scrollRequest", this.handleScrollRequest), this.fireInitialScroll(); + } + detach() { + this.emitter.off("_scrollRequest", this.handleScrollRequest); + } + update(e) { + e && this.scrollTimeReset ? this.fireInitialScroll() : this.drain(); + } + fireInitialScroll() { + this.handleScrollRequest({ + time: this.scrollTime + }); + } + drain() { + this.queuedRequest && this.execFunc(this.queuedRequest) && (this.queuedRequest = null); + } +} +const fu = TG({}); +function kbe(r, e, t, n, i, a, o, s, l, u, c, h, f) { + return { + dateEnv: i, + options: t, + pluginHooks: o, + emitter: u, + dispatch: s, + getCurrentData: l, + calendarApi: c, + viewSpec: r, + viewApi: e, + dateProfileGenerator: n, + theme: a, + isRtl: t.direction === "rtl", + addResizeHandler(v) { + u.on("_resize", v); + }, + removeResizeHandler(v) { + u.off("_resize", v); + }, + createScrollResponder(v) { + return new Dbe(v, u, Xr(t.scrollTime), t.scrollTimeReset); + }, + registerInteractiveComponent: h, + unregisterInteractiveComponent: f + }; +} +class vf extends bo { + shouldComponentUpdate(e, t) { + return this.debug && console.log(QT(e, this.props), QT(t, this.state)), !kC(this.props, e, this.propEquality) || !kC(this.state, t, this.stateEquality); + } + // HACK for freakin' React StrictMode + safeSetState(e) { + kC(this.state, Object.assign(Object.assign({}, this.state), e), this.stateEquality) || this.setState(e); + } +} +vf.addPropsEquality = Obe; +vf.addStateEquality = Lbe; +vf.contextType = fu; +vf.prototype.propEquality = {}; +vf.prototype.stateEquality = {}; +class un extends vf { +} +un.contextType = fu; +function Obe(r) { + let e = Object.create(this.prototype.propEquality); + Object.assign(e, r), this.prototype.propEquality = e; +} +function Lbe(r) { + let e = Object.create(this.prototype.stateEquality); + Object.assign(e, r), this.prototype.stateEquality = e; +} +function lu(r, e) { + typeof r == "function" ? r(e) : r && (r.current = e); +} +class Vs extends un { + constructor() { + super(...arguments), this.uid = df(); + } + // Hit System + // ----------------------------------------------------------------------------------------------------------------- + prepareHits() { + } + queryHit(e, t, n, i) { + return null; + } + // Pointer Interaction Utils + // ----------------------------------------------------------------------------------------------------------------- + isValidSegDownEl(e) { + return !this.props.eventDrag && // HACK + !this.props.eventResize && // HACK + !da(e, ".fc-event-mirror"); + } + isValidDateDownEl(e) { + return !da(e, ".fc-event:not(.fc-bg-event)") && !da(e, ".fc-more-link") && // a "more.." link + !da(e, "a[data-navlink]") && // a clickable nav link + !da(e, ".fc-popover"); + } +} +function Pbe(r, e) { + switch (e.type) { + case "CHANGE_DATE": + return e.dateMarker; + default: + return r; + } +} +function Rbe(r, e) { + let t = r.initialDate; + return t != null ? e.createMarker(t) : bm(r.now, e); +} +function bm(r, e) { + return typeof r == "function" && (r = r()), r == null ? e.createNowMarker() : e.createMarker(r); +} +class IG { + constructor(e) { + this.props = e, this.nowDate = bm(e.nowInput, e.dateEnv), this.initHiddenDays(); + } + /* Date Range Computation + ------------------------------------------------------------------------------------------------------------------*/ + // Builds a structure with info about what the dates/ranges will be for the "prev" view. + buildPrev(e, t, n) { + let { dateEnv: i } = this.props, a = i.subtract( + i.startOf(t, e.currentRangeUnit), + // important for start-of-month + e.dateIncrement + ); + return this.build(a, -1, n); + } + // Builds a structure with info about what the dates/ranges will be for the "next" view. + buildNext(e, t, n) { + let { dateEnv: i } = this.props, a = i.add( + i.startOf(t, e.currentRangeUnit), + // important for start-of-month + e.dateIncrement + ); + return this.build(a, 1, n); + } + // Builds a structure holding dates/ranges for rendering around the given date. + // Optional direction param indicates whether the date is being incremented/decremented + // from its previous value. decremented = -1, incremented = 1 (default). + build(e, t, n = !0) { + let { props: i } = this, a, o, s, l, u, c; + return a = this.buildValidRange(), a = this.trimHiddenDays(a), n && (e = vbe(e, a)), o = this.buildCurrentRangeInfo(e, t), s = /^(year|month|week|day)$/.test(o.unit), l = this.buildRenderRange(this.trimHiddenDays(o.range), o.unit, s), l = this.trimHiddenDays(l), u = l, i.showNonCurrentDates || (u = xc(u, o.range)), u = this.adjustActiveRange(u), u = xc(u, a), c = lM(o.range, a), Ql(l, e) || (e = l.start), { + currentDate: e, + // constraint for where prev/next operations can go and where events can be dragged/resized to. + // an object with optional start and end properties. + validRange: a, + // range the view is formally responsible for. + // for example, a month view might have 1st-31st, excluding padded dates + currentRange: o.range, + // name of largest unit being displayed, like "month" or "week" + currentRangeUnit: o.unit, + isRangeAllDay: s, + // dates that display events and accept drag-n-drop + // will be `null` if no dates accept events + activeRange: u, + // date range with a rendered skeleton + // includes not-active days that need some sort of DOM + renderRange: l, + // Duration object that denotes the first visible time of any given day + slotMinTime: i.slotMinTime, + // Duration object that denotes the exclusive visible end time of any given day + slotMaxTime: i.slotMaxTime, + isValid: c, + // how far the current date will move for a prev/next operation + dateIncrement: this.buildDateIncrement(o.duration) + // pass a fallback (might be null) ^ + }; + } + // Builds an object with optional start/end properties. + // Indicates the minimum/maximum dates to display. + // not responsible for trimming hidden days. + buildValidRange() { + let e = this.props.validRangeInput, t = typeof e == "function" ? e.call(this.props.calendarApi, this.nowDate) : e; + return this.refineRange(t) || { start: null, end: null }; + } + // Builds a structure with info about the "current" range, the range that is + // highlighted as being the current month for example. + // See build() for a description of `direction`. + // Guaranteed to have `range` and `unit` properties. `duration` is optional. + buildCurrentRangeInfo(e, t) { + let { props: n } = this, i = null, a = null, o = null, s; + return n.duration ? (i = n.duration, a = n.durationUnit, o = this.buildRangeFromDuration(e, t, i, a)) : (s = this.props.dayCount) ? (a = "day", o = this.buildRangeFromDayCount(e, t, s)) : (o = this.buildCustomVisibleRange(e)) ? a = n.dateEnv.greatestWholeUnit(o.start, o.end).unit : (i = this.getFallbackDuration(), a = KT(i).unit, o = this.buildRangeFromDuration(e, t, i, a)), { duration: i, unit: a, range: o }; + } + getFallbackDuration() { + return Xr({ day: 1 }); + } + // Returns a new activeRange to have time values (un-ambiguate) + // slotMinTime or slotMaxTime causes the range to expand. + adjustActiveRange(e) { + let { dateEnv: t, usesMinMaxTime: n, slotMinTime: i, slotMaxTime: a } = this.props, { start: o, end: s } = e; + return n && (Ad(i) < 0 && (o = kn(o), o = t.add(o, i)), Ad(a) > 1 && (s = kn(s), s = Bi(s, -1), s = t.add(s, a))), { start: o, end: s }; + } + // Builds the "current" range when it is specified as an explicit duration. + // `unit` is the already-computed greatestDurationDenominator unit of duration. + buildRangeFromDuration(e, t, n, i) { + let { dateEnv: a, dateAlignment: o } = this.props, s, l, u; + if (!o) { + let { dateIncrement: h } = this.props; + h && Ls(h) < Ls(n) ? o = KT(h).unit : o = i; + } + Ad(n) <= 1 && this.isHiddenDay(s) && (s = this.skipHiddenDays(s, t), s = kn(s)); + function c() { + s = a.startOf(e, o), l = a.add(s, n), u = { start: s, end: l }; + } + return c(), this.trimHiddenDays(u) || (e = this.skipHiddenDays(e, t), c()), u; + } + // Builds the "current" range when a dayCount is specified. + buildRangeFromDayCount(e, t, n) { + let { dateEnv: i, dateAlignment: a } = this.props, o = 0, s = e, l; + a && (s = i.startOf(s, a)), s = kn(s), s = this.skipHiddenDays(s, t), l = s; + do + l = Bi(l, 1), this.isHiddenDay(l) || (o += 1); + while (o < n); + return { start: s, end: l }; + } + // Builds a normalized range object for the "visible" range, + // which is a way to define the currentRange and activeRange at the same time. + buildCustomVisibleRange(e) { + let { props: t } = this, n = t.visibleRangeInput, i = typeof n == "function" ? n.call(t.calendarApi, t.dateEnv.toDate(e)) : n, a = this.refineRange(i); + return a && (a.start == null || a.end == null) ? null : a; + } + // Computes the range that will represent the element/cells for *rendering*, + // but which may have voided days/times. + // not responsible for trimming hidden days. + buildRenderRange(e, t, n) { + return e; + } + // Compute the duration value that should be added/substracted to the current date + // when a prev/next operation happens. + buildDateIncrement(e) { + let { dateIncrement: t } = this.props, n; + return t || ((n = this.props.dateAlignment) ? Xr(1, n) : e || Xr({ days: 1 })); + } + refineRange(e) { + if (e) { + let t = hbe(e, this.props.dateEnv); + return t && (t = sM(t)), t; + } + return null; + } + /* Hidden Days + ------------------------------------------------------------------------------------------------------------------*/ + // Initializes internal variables related to calculating hidden days-of-week + initHiddenDays() { + let e = this.props.hiddenDays || [], t = [], n = 0, i; + for (this.props.weekends === !1 && e.push(0, 6), i = 0; i < 7; i += 1) + (t[i] = e.indexOf(i) !== -1) || (n += 1); + if (!n) + throw new Error("invalid hiddenDays"); + this.isHiddenDayHash = t; + } + // Remove days from the beginning and end of the range that are computed as hidden. + // If the whole range is trimmed off, returns null + trimHiddenDays(e) { + let { start: t, end: n } = e; + return t && (t = this.skipHiddenDays(t)), n && (n = this.skipHiddenDays(n, -1, !0)), t == null || n == null || t < n ? { start: t, end: n } : null; + } + // Is the current day hidden? + // `day` is a day-of-week index (0-6), or a Date (used for UTC) + isHiddenDay(e) { + return e instanceof Date && (e = e.getUTCDay()), this.isHiddenDayHash[e]; + } + // Incrementing the current day until it is no longer a hidden day, returning a copy. + // DOES NOT CONSIDER validRange! + // If the initial value of `date` is not a hidden day, don't do anything. + // Pass `isExclusive` as `true` if you are dealing with an end date. + // `inc` defaults to `1` (increment one day forward each time) + skipHiddenDays(e, t = 1, n = !1) { + for (; this.isHiddenDayHash[(e.getUTCDay() + (n ? t : 0) + 7) % 7]; ) + e = Bi(e, t); + return e; + } +} +function AG(r, e, t) { + t.emitter.trigger("select", Object.assign(Object.assign({}, fM(r, t)), { jsEvent: e ? e.origEvent : null, view: t.viewApi || t.calendarApi.view })); +} +function Nbe(r, e) { + e.emitter.trigger("unselect", { + jsEvent: r ? r.origEvent : null, + view: e.viewApi || e.calendarApi.view + }); +} +function fM(r, e) { + let t = {}; + for (let n of e.pluginHooks.dateSpanTransforms) + Object.assign(t, n(r, e)); + return Object.assign(t, Jbe(r, e.dateEnv)), t; +} +function Ez(r, e, t) { + let { dateEnv: n, options: i } = t, a = e; + return r ? (a = kn(a), a = n.add(a, i.defaultAllDayEventDuration)) : a = n.add(a, i.defaultTimedEventDuration), a; +} +function dM(r, e, t, n) { + let i = vb(r.defs, e), a = xo(); + for (let o in r.defs) { + let s = r.defs[o]; + a.defs[o] = zbe(s, i[o], t, n); + } + for (let o in r.instances) { + let s = r.instances[o], l = a.defs[s.defId]; + a.instances[o] = Bbe(s, l, i[s.defId], t, n); + } + return a; +} +function zbe(r, e, t, n) { + let i = t.standardProps || {}; + i.hasEnd == null && e.durationEditable && (t.startDelta || t.endDelta) && (i.hasEnd = !0); + let a = Object.assign(Object.assign(Object.assign({}, r), i), { ui: Object.assign(Object.assign({}, r.ui), i.ui) }); + t.extendedProps && (a.extendedProps = Object.assign(Object.assign({}, a.extendedProps), t.extendedProps)); + for (let o of n.pluginHooks.eventDefMutationAppliers) + o(a, t, n); + return !a.hasEnd && n.options.forceEventDuration && (a.hasEnd = !0), a; +} +function Bbe(r, e, t, n, i) { + let { dateEnv: a } = i, o = n.standardProps && n.standardProps.allDay === !0, s = n.standardProps && n.standardProps.hasEnd === !1, l = Object.assign({}, r); + return o && (l.range = bG(l.range)), n.datesDelta && t.startEditable && (l.range = { + start: a.add(l.range.start, n.datesDelta), + end: a.add(l.range.end, n.datesDelta) + }), n.startDelta && t.durationEditable && (l.range = { + start: a.add(l.range.start, n.startDelta), + end: l.range.end + }), n.endDelta && t.durationEditable && (l.range = { + start: l.range.start, + end: a.add(l.range.end, n.endDelta) + }), s && (l.range = { + start: l.range.start, + end: Ez(e.allDay, l.range.start, i) + }), e.allDay && (l.range = { + start: kn(l.range.start), + end: kn(l.range.end) + }), l.range.end < l.range.start && (l.range.end = Ez(e.allDay, l.range.start, i)), l; +} +class cd { + constructor(e, t) { + this.context = e, this.internalEventSource = t; + } + remove() { + this.context.dispatch({ + type: "REMOVE_EVENT_SOURCE", + sourceId: this.internalEventSource.sourceId + }); + } + refetch() { + this.context.dispatch({ + type: "FETCH_EVENT_SOURCES", + sourceIds: [this.internalEventSource.sourceId], + isRefetch: !0 + }); + } + get id() { + return this.internalEventSource.publicId; + } + get url() { + return this.internalEventSource.meta.url; + } + get format() { + return this.internalEventSource.meta.format; + } +} +class Gn { + // instance will be null if expressing a recurring event that has no current instances, + // OR if trying to validate an incoming external event that has no dates assigned + constructor(e, t, n) { + this._context = e, this._def = t, this._instance = n || null; + } + /* + TODO: make event struct more responsible for this + */ + setProp(e, t) { + if (e in mG) + console.warn("Could not set date-related prop 'name'. Use one of the date-related methods instead."); + else if (e === "id") + t = e_[e](t), this.mutate({ + standardProps: { publicId: t } + // hardcoded internal name + }); + else if (e in e_) + t = e_[e](t), this.mutate({ + standardProps: { [e]: t } + }); + else if (e in fb) { + let n = fb[e](t); + e === "color" ? n = { backgroundColor: t, borderColor: t } : e === "editable" ? n = { startEditable: t, durationEditable: t } : n = { [e]: t }, this.mutate({ + standardProps: { ui: n } + }); + } else + console.warn(`Could not set prop '${e}'. Use setExtendedProp instead.`); + } + setExtendedProp(e, t) { + this.mutate({ + extendedProps: { [e]: t } + }); + } + setStart(e, t = {}) { + let { dateEnv: n } = this._context, i = n.createMarker(e); + if (i && this._instance) { + let a = this._instance.range, o = pd(a.start, i, n, t.granularity); + t.maintainDuration ? this.mutate({ datesDelta: o }) : this.mutate({ startDelta: o }); + } + } + setEnd(e, t = {}) { + let { dateEnv: n } = this._context, i; + if (!(e != null && (i = n.createMarker(e), !i)) && this._instance) + if (i) { + let a = pd(this._instance.range.end, i, n, t.granularity); + this.mutate({ endDelta: a }); + } else + this.mutate({ standardProps: { hasEnd: !1 } }); + } + setDates(e, t, n = {}) { + let { dateEnv: i } = this._context, a = { allDay: n.allDay }, o = i.createMarker(e), s; + if (o && !(t != null && (s = i.createMarker(t), !s)) && this._instance) { + let l = this._instance.range; + n.allDay === !0 && (l = bG(l)); + let u = pd(l.start, o, i, n.granularity); + if (s) { + let c = pd(l.end, s, i, n.granularity); + a_e(u, c) ? this.mutate({ datesDelta: u, standardProps: a }) : this.mutate({ startDelta: u, endDelta: c, standardProps: a }); + } else + a.hasEnd = !1, this.mutate({ datesDelta: u, standardProps: a }); + } + } + moveStart(e) { + let t = Xr(e); + t && this.mutate({ startDelta: t }); + } + moveEnd(e) { + let t = Xr(e); + t && this.mutate({ endDelta: t }); + } + moveDates(e) { + let t = Xr(e); + t && this.mutate({ datesDelta: t }); + } + setAllDay(e, t = {}) { + let n = { allDay: e }, { maintainDuration: i } = t; + i == null && (i = this._context.options.allDayMaintainDuration), this._def.allDay !== e && (n.hasEnd = i), this.mutate({ standardProps: n }); + } + formatRange(e) { + let { dateEnv: t } = this._context, n = this._instance, i = jn(e); + return this._def.hasEnd ? t.formatRange(n.range.start, n.range.end, i, { + forcedStartTzo: n.forcedStartTzo, + forcedEndTzo: n.forcedEndTzo + }) : t.format(n.range.start, i, { + forcedTzo: n.forcedStartTzo + }); + } + mutate(e) { + let t = this._instance; + if (t) { + let n = this._def, i = this._context, { eventStore: a } = i.getCurrentData(), o = iM(a, t.instanceId); + o = dM(o, { + "": { + display: "", + startEditable: !0, + durationEditable: !0, + constraints: [], + overlap: null, + allows: [], + backgroundColor: "", + borderColor: "", + textColor: "", + classNames: [] + } + }, e, i); + let l = new Gn(i, n, t); + this._def = o.defs[n.defId], this._instance = o.instances[t.instanceId], i.dispatch({ + type: "MERGE_EVENTS", + eventStore: o + }), i.emitter.trigger("eventChange", { + oldEvent: l, + event: this, + relatedEvents: $h(o, i, t), + revert() { + i.dispatch({ + type: "RESET_EVENTS", + eventStore: a + // the ORIGINAL store + }); + } + }); + } + } + remove() { + let e = this._context, t = EG(this); + e.dispatch({ + type: "REMOVE_EVENTS", + eventStore: t + }), e.emitter.trigger("eventRemove", { + event: this, + relatedEvents: [], + revert() { + e.dispatch({ + type: "MERGE_EVENTS", + eventStore: t + }); + } + }); + } + get source() { + let { sourceId: e } = this._def; + return e ? new cd(this._context, this._context.getCurrentData().eventSources[e]) : null; + } + get start() { + return this._instance ? this._context.dateEnv.toDate(this._instance.range.start) : null; + } + get end() { + return this._instance && this._def.hasEnd ? this._context.dateEnv.toDate(this._instance.range.end) : null; + } + get startStr() { + let e = this._instance; + return e ? this._context.dateEnv.formatIso(e.range.start, { + omitTime: this._def.allDay, + forcedTzo: e.forcedStartTzo + }) : ""; + } + get endStr() { + let e = this._instance; + return e && this._def.hasEnd ? this._context.dateEnv.formatIso(e.range.end, { + omitTime: this._def.allDay, + forcedTzo: e.forcedEndTzo + }) : ""; + } + // computable props that all access the def + // TODO: find a TypeScript-compatible way to do this at scale + get id() { + return this._def.publicId; + } + get groupId() { + return this._def.groupId; + } + get allDay() { + return this._def.allDay; + } + get title() { + return this._def.title; + } + get url() { + return this._def.url; + } + get display() { + return this._def.ui.display || "auto"; + } + // bad. just normalize the type earlier + get startEditable() { + return this._def.ui.startEditable; + } + get durationEditable() { + return this._def.ui.durationEditable; + } + get constraint() { + return this._def.ui.constraints[0] || null; + } + get overlap() { + return this._def.ui.overlap; + } + get allow() { + return this._def.ui.allows[0] || null; + } + get backgroundColor() { + return this._def.ui.backgroundColor; + } + get borderColor() { + return this._def.ui.borderColor; + } + get textColor() { + return this._def.ui.textColor; + } + // NOTE: user can't modify these because Object.freeze was called in event-def parsing + get classNames() { + return this._def.ui.classNames; + } + get extendedProps() { + return this._def.extendedProps; + } + toPlainObject(e = {}) { + let t = this._def, { ui: n } = t, { startStr: i, endStr: a } = this, o = { + allDay: t.allDay + }; + return t.title && (o.title = t.title), i && (o.start = i), a && (o.end = a), t.publicId && (o.id = t.publicId), t.groupId && (o.groupId = t.groupId), t.url && (o.url = t.url), n.display && n.display !== "auto" && (o.display = n.display), e.collapseColor && n.backgroundColor && n.backgroundColor === n.borderColor ? o.color = n.backgroundColor : (n.backgroundColor && (o.backgroundColor = n.backgroundColor), n.borderColor && (o.borderColor = n.borderColor)), n.textColor && (o.textColor = n.textColor), n.classNames.length && (o.classNames = n.classNames), Object.keys(t.extendedProps).length && (e.collapseExtendedProps ? Object.assign(o, t.extendedProps) : o.extendedProps = t.extendedProps), o; + } + toJSON() { + return this.toPlainObject(); + } +} +function EG(r) { + let e = r._def, t = r._instance; + return { + defs: { [e.defId]: e }, + instances: t ? { [t.instanceId]: t } : {} + }; +} +function $h(r, e, t) { + let { defs: n, instances: i } = r, a = [], o = t ? t.instanceId : ""; + for (let s in i) { + let l = i[s], u = n[l.defId]; + l.instanceId !== o && a.push(new Gn(e, u, l)); + } + return a; +} +function tI(r, e, t, n) { + let i = {}, a = {}, o = {}, s = [], l = [], u = vb(r.defs, e); + for (let c in r.defs) { + let h = r.defs[c]; + u[h.defId].display === "inverse-background" && (h.groupId ? (i[h.groupId] = [], o[h.groupId] || (o[h.groupId] = h)) : a[c] = []); + } + for (let c in r.instances) { + let h = r.instances[c], f = r.defs[h.defId], v = u[f.defId], b = h.range, w = !f.allDay && n ? sM(b, n) : b, p = xc(w, t); + p && (v.display === "inverse-background" ? f.groupId ? i[f.groupId].push(p) : a[h.defId].push(p) : v.display !== "none" && (v.display === "background" ? s : l).push({ + def: f, + ui: v, + instance: h, + range: p, + isStart: w.start && w.start.valueOf() === p.start.valueOf(), + isEnd: w.end && w.end.valueOf() === p.end.valueOf() + })); + } + for (let c in i) { + let h = i[c], f = Iz(h, t); + for (let v of f) { + let b = o[c], w = u[b.defId]; + s.push({ + def: b, + ui: w, + instance: null, + range: v, + isStart: !1, + isEnd: !1 + }); + } + } + for (let c in a) { + let h = a[c], f = Iz(h, t); + for (let v of f) + s.push({ + def: r.defs[c], + ui: u[c], + instance: null, + range: v, + isStart: !1, + isEnd: !1 + }); + } + return { bg: s, fg: l }; +} +function jbe(r) { + return r.ui.display === "background" || r.ui.display === "inverse-background"; +} +function Mz(r, e) { + r.fcSeg = e; +} +function Wd(r) { + return r.fcSeg || r.parentNode.fcSeg || // for the harness + null; +} +function vb(r, e) { + return su(r, (t) => MG(t, e)); +} +function MG(r, e) { + let t = []; + return e[""] && t.push(e[""]), e[r.defId] && t.push(e[r.defId]), t.push(r.ui), gG(t); +} +function vM(r, e) { + let t = r.map(Fbe); + return t.sort((n, i) => Q0e(n, i, e)), t.map((n) => n._seg); +} +function Fbe(r) { + let { eventRange: e } = r, t = e.def, n = e.instance ? e.instance.range : e.range, i = n.start ? n.start.valueOf() : 0, a = n.end ? n.end.valueOf() : 0; + return Object.assign(Object.assign(Object.assign({}, t.extendedProps), t), { + id: t.publicId, + start: i, + end: a, + duration: a - i, + allDay: Number(t.allDay), + _seg: r + }); +} +function $be(r, e) { + let { pluginHooks: t } = e, n = t.isDraggableTransformers, { def: i, ui: a } = r.eventRange, o = a.startEditable; + for (let s of n) + o = s(o, i, a, e); + return o; +} +function Hbe(r, e) { + return r.isStart && r.eventRange.ui.durationEditable && e.options.eventResizableFromStart; +} +function Vbe(r, e) { + return r.isEnd && r.eventRange.ui.durationEditable; +} +function rg(r, e, t, n, i, a, o) { + let { dateEnv: s, options: l } = t, { displayEventTime: u, displayEventEnd: c } = l, h = r.eventRange.def, f = r.eventRange.instance; + u == null && (u = n !== !1), c == null && (c = i !== !1); + let v = f.range.start, b = f.range.end, w = a || r.start || r.eventRange.range.start, p = o || r.end || r.eventRange.range.end, d = kn(v).valueOf() === kn(w).valueOf(), m = kn(bc(b, -1)).valueOf() === kn(bc(p, -1)).valueOf(); + return u && !h.allDay && (d || m) ? (w = d ? v : w, p = m ? b : p, c && h.hasEnd ? s.formatRange(w, p, e, { + forcedStartTzo: a ? null : f.forcedStartTzo, + forcedEndTzo: o ? null : f.forcedEndTzo + }) : s.format(w, e, { + forcedTzo: a ? null : f.forcedStartTzo + // nooooo, same + })) : ""; +} +function ql(r, e, t) { + let n = r.eventRange.range; + return { + isPast: n.end < (t || e.start), + isFuture: n.start >= (t || e.end), + isToday: e && Ql(e, n.start) + }; +} +function Gbe(r) { + let e = ["fc-event"]; + return r.isMirror && e.push("fc-event-mirror"), r.isDraggable && e.push("fc-event-draggable"), (r.isStartResizable || r.isEndResizable) && e.push("fc-event-resizable"), r.isDragging && e.push("fc-event-dragging"), r.isResizing && e.push("fc-event-resizing"), r.isSelected && e.push("fc-event-selected"), r.isStart && e.push("fc-event-start"), r.isEnd && e.push("fc-event-end"), r.isPast && e.push("fc-event-past"), r.isToday && e.push("fc-event-today"), r.isFuture && e.push("fc-event-future"), e; +} +function DG(r) { + return r.instance ? r.instance.instanceId : `${r.def.defId}:${r.range.start.toISOString()}`; +} +function pM(r, e) { + let { def: t, instance: n } = r.eventRange, { url: i } = t; + if (i) + return { href: i }; + let { emitter: a, options: o } = e, { eventInteractive: s } = o; + return s == null && (s = t.interactive, s == null && (s = !!a.hasHandlers("eventClick"))), s ? fG((l) => { + a.trigger("eventClick", { + el: l.target, + event: new Gn(e, t, n), + jsEvent: l, + view: e.viewApi + }); + }) : {}; +} +const Ube = { + start: $e, + end: $e, + allDay: Boolean +}; +function Wbe(r, e, t) { + let n = Ybe(r, e), { range: i } = n; + if (!i.start) + return null; + if (!i.end) { + if (t == null) + return null; + i.end = e.add(i.start, t); + } + return n; +} +function Ybe(r, e) { + let { refined: t, extra: n } = rM(r, Ube), i = t.start ? e.createMarkerMeta(t.start) : null, a = t.end ? e.createMarkerMeta(t.end) : null, { allDay: o } = t; + return o == null && (o = i && i.isTimeUnspecified && (!a || a.isTimeUnspecified)), Object.assign({ range: { + start: i ? i.marker : null, + end: a ? a.marker : null + }, allDay: o }, n); +} +function Xbe(r, e) { + return dbe(r.range, e.range) && r.allDay === e.allDay && Zbe(r, e); +} +function Zbe(r, e) { + for (let t in e) + if (t !== "range" && t !== "allDay" && r[t] !== e[t]) + return !1; + for (let t in r) + if (!(t in e)) + return !1; + return !0; +} +function Jbe(r, e) { + return Object.assign(Object.assign({}, OG(r.range, e, r.allDay)), { allDay: r.allDay }); +} +function kG(r, e, t) { + return Object.assign(Object.assign({}, OG(r, e, t)), { timeZone: e.timeZone }); +} +function OG(r, e, t) { + return { + start: e.toDate(r.start), + end: e.toDate(r.end), + startStr: e.formatIso(r.start, { omitTime: t }), + endStr: e.formatIso(r.end, { omitTime: t }) + }; +} +function Kbe(r, e, t) { + let n = _G({ editable: !1 }, t), i = eI( + n.refined, + n.extra, + "", + // sourceId + r.allDay, + !0, + // hasEnd + t + ); + return { + def: i, + ui: MG(i, e), + instance: nM(i.defId, r.range), + range: r.range, + isStart: !0, + isEnd: !0 + }; +} +let LG = {}; +function Qbe(r, e) { + LG[r] = e; +} +function qbe(r) { + return new LG[r](); +} +class exe { + getMarkerYear(e) { + return e.getUTCFullYear(); + } + getMarkerMonth(e) { + return e.getUTCMonth(); + } + getMarkerDay(e) { + return e.getUTCDate(); + } + arrayToMarker(e) { + return ro(e); + } + markerToArray(e) { + return tc(e); + } +} +Qbe("gregory", exe); +const txe = /^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/; +function rxe(r) { + let e = txe.exec(r); + if (e) { + let t = new Date(Date.UTC(Number(e[1]), e[3] ? Number(e[3]) - 1 : 0, Number(e[5] || 1), Number(e[7] || 0), Number(e[8] || 0), Number(e[10] || 0), e[12] ? +`0.${e[12]}` * 1e3 : 0)); + if (vG(t)) { + let n = null; + return e[13] && (n = (e[15] === "-" ? -1 : 1) * (Number(e[16] || 0) * 60 + Number(e[18] || 0))), { + marker: t, + isTimeUnspecified: !e[6], + timeZoneOffset: n + }; + } + } + return null; +} +class nxe { + constructor(e) { + let t = this.timeZone = e.timeZone, n = t !== "local" && t !== "UTC"; + e.namedTimeZoneImpl && n && (this.namedTimeZoneImpl = new e.namedTimeZoneImpl(t)), this.canComputeOffset = !!(!n || this.namedTimeZoneImpl), this.calendarSystem = qbe(e.calendarSystem), this.locale = e.locale, this.weekDow = e.locale.week.dow, this.weekDoy = e.locale.week.doy, e.weekNumberCalculation === "ISO" && (this.weekDow = 1, this.weekDoy = 4), typeof e.firstDay == "number" && (this.weekDow = e.firstDay), typeof e.weekNumberCalculation == "function" && (this.weekNumberFunc = e.weekNumberCalculation), this.weekText = e.weekText != null ? e.weekText : e.locale.options.weekText, this.weekTextLong = (e.weekTextLong != null ? e.weekTextLong : e.locale.options.weekTextLong) || this.weekText, this.cmdFormatter = e.cmdFormatter, this.defaultSeparator = e.defaultSeparator; + } + // Creating / Parsing + createMarker(e) { + let t = this.createMarkerMeta(e); + return t === null ? null : t.marker; + } + createNowMarker() { + return this.canComputeOffset ? this.timestampToMarker((/* @__PURE__ */ new Date()).valueOf()) : ro(mz(/* @__PURE__ */ new Date())); + } + createMarkerMeta(e) { + if (typeof e == "string") + return this.parse(e); + let t = null; + return typeof e == "number" ? t = this.timestampToMarker(e) : e instanceof Date ? (e = e.valueOf(), isNaN(e) || (t = this.timestampToMarker(e))) : Array.isArray(e) && (t = ro(e)), t === null || !vG(t) ? null : { marker: t, isTimeUnspecified: !1, forcedTzo: null }; + } + parse(e) { + let t = rxe(e); + if (t === null) + return null; + let { marker: n } = t, i = null; + return t.timeZoneOffset !== null && (this.canComputeOffset ? n = this.timestampToMarker(n.valueOf() - t.timeZoneOffset * 60 * 1e3) : i = t.timeZoneOffset), { marker: n, isTimeUnspecified: t.isTimeUnspecified, forcedTzo: i }; + } + // Accessors + getYear(e) { + return this.calendarSystem.getMarkerYear(e); + } + getMonth(e) { + return this.calendarSystem.getMarkerMonth(e); + } + getDay(e) { + return this.calendarSystem.getMarkerDay(e); + } + // Adding / Subtracting + add(e, t) { + let n = this.calendarSystem.markerToArray(e); + return n[0] += t.years, n[1] += t.months, n[2] += t.days, n[6] += t.milliseconds, this.calendarSystem.arrayToMarker(n); + } + subtract(e, t) { + let n = this.calendarSystem.markerToArray(e); + return n[0] -= t.years, n[1] -= t.months, n[2] -= t.days, n[6] -= t.milliseconds, this.calendarSystem.arrayToMarker(n); + } + addYears(e, t) { + let n = this.calendarSystem.markerToArray(e); + return n[0] += t, this.calendarSystem.arrayToMarker(n); + } + addMonths(e, t) { + let n = this.calendarSystem.markerToArray(e); + return n[1] += t, this.calendarSystem.arrayToMarker(n); + } + // Diffing Whole Units + diffWholeYears(e, t) { + let { calendarSystem: n } = this; + return rc(e) === rc(t) && n.getMarkerDay(e) === n.getMarkerDay(t) && n.getMarkerMonth(e) === n.getMarkerMonth(t) ? n.getMarkerYear(t) - n.getMarkerYear(e) : null; + } + diffWholeMonths(e, t) { + let { calendarSystem: n } = this; + return rc(e) === rc(t) && n.getMarkerDay(e) === n.getMarkerDay(t) ? n.getMarkerMonth(t) - n.getMarkerMonth(e) + (n.getMarkerYear(t) - n.getMarkerYear(e)) * 12 : null; + } + // Range / Duration + greatestWholeUnit(e, t) { + let n = this.diffWholeYears(e, t); + return n !== null ? { unit: "year", value: n } : (n = this.diffWholeMonths(e, t), n !== null ? { unit: "month", value: n } : (n = b_e(e, t), n !== null ? { unit: "week", value: n } : (n = ub(e, t), n !== null ? { unit: "day", value: n } : (n = g_e(e, t), Q0(n) ? { unit: "hour", value: n } : (n = m_e(e, t), Q0(n) ? { unit: "minute", value: n } : (n = y_e(e, t), Q0(n) ? { unit: "second", value: n } : { unit: "millisecond", value: t.valueOf() - e.valueOf() })))))); + } + countDurationsBetween(e, t, n) { + let i; + return n.years && (i = this.diffWholeYears(e, t), i !== null) ? i / l_e(n) : n.months && (i = this.diffWholeMonths(e, t), i !== null) ? i / u_e(n) : n.days && (i = ub(e, t), i !== null) ? i / Ad(n) : (t.valueOf() - e.valueOf()) / Ls(n); + } + // Start-Of + // these DON'T return zoned-dates. only UTC start-of dates + startOf(e, t) { + return t === "year" ? this.startOfYear(e) : t === "month" ? this.startOfMonth(e) : t === "week" ? this.startOfWeek(e) : t === "day" ? kn(e) : t === "hour" ? x_e(e) : t === "minute" ? S_e(e) : t === "second" ? w_e(e) : null; + } + startOfYear(e) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(e) + ]); + } + startOfMonth(e) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(e), + this.calendarSystem.getMarkerMonth(e) + ]); + } + startOfWeek(e) { + return this.calendarSystem.arrayToMarker([ + this.calendarSystem.getMarkerYear(e), + this.calendarSystem.getMarkerMonth(e), + e.getUTCDate() - (e.getUTCDay() - this.weekDow + 7) % 7 + ]); + } + // Week Number + computeWeekNumber(e) { + return this.weekNumberFunc ? this.weekNumberFunc(this.toDate(e)) : C_e(e, this.weekDow, this.weekDoy); + } + // TODO: choke on timeZoneName: long + format(e, t, n = {}) { + return t.format({ + marker: e, + timeZoneOffset: n.forcedTzo != null ? n.forcedTzo : this.offsetForMarker(e) + }, this); + } + formatRange(e, t, n, i = {}) { + return i.isEndExclusive && (t = bc(t, -1)), n.formatRange({ + marker: e, + timeZoneOffset: i.forcedStartTzo != null ? i.forcedStartTzo : this.offsetForMarker(e) + }, { + marker: t, + timeZoneOffset: i.forcedEndTzo != null ? i.forcedEndTzo : this.offsetForMarker(t) + }, this, i.defaultSeparator); + } + /* + DUMB: the omitTime arg is dumb. if we omit the time, we want to omit the timezone offset. and if we do that, + might as well use buildIsoString or some other util directly + */ + formatIso(e, t = {}) { + let n = null; + return t.omitTimeZoneOffset || (t.forcedTzo != null ? n = t.forcedTzo : n = this.offsetForMarker(e)), pG(e, n, t.omitTime); + } + // TimeZone + timestampToMarker(e) { + return this.timeZone === "local" ? ro(mz(new Date(e))) : this.timeZone === "UTC" || !this.namedTimeZoneImpl ? new Date(e) : ro(this.namedTimeZoneImpl.timestampToArray(e)); + } + offsetForMarker(e) { + return this.timeZone === "local" ? -yz(tc(e)).getTimezoneOffset() : this.timeZone === "UTC" ? 0 : this.namedTimeZoneImpl ? this.namedTimeZoneImpl.offsetForArray(tc(e)) : null; + } + // Conversion + toDate(e, t) { + return this.timeZone === "local" ? yz(tc(e)) : this.timeZone === "UTC" ? new Date(e.valueOf()) : this.namedTimeZoneImpl ? new Date(e.valueOf() - this.namedTimeZoneImpl.offsetForArray(tc(e)) * 1e3 * 60) : new Date(e.valueOf() - (t || 0)); + } +} +class PG { + constructor() { + this.strictOrder = !1, this.allowReslicing = !1, this.maxCoord = -1, this.maxStackCnt = -1, this.levelCoords = [], this.entriesByLevel = [], this.stackCnts = {}; + } + addSegs(e) { + let t = []; + for (let n of e) + this.insertEntry(n, t); + return t; + } + insertEntry(e, t) { + let n = this.findInsertion(e); + return this.isInsertionValid(n, e) ? (this.insertEntryAt(e, n), 1) : this.handleInvalidInsertion(n, e, t); + } + isInsertionValid(e, t) { + return (this.maxCoord === -1 || e.levelCoord + t.thickness <= this.maxCoord) && (this.maxStackCnt === -1 || e.stackCnt < this.maxStackCnt); + } + // returns number of new entries inserted + handleInvalidInsertion(e, t, n) { + return this.allowReslicing && e.touchingEntry ? this.splitEntry(t, e.touchingEntry, n) : (n.push(t), 0); + } + splitEntry(e, t, n) { + let i = 0, a = [], o = e.span, s = t.span; + return o.start < s.start && (i += this.insertEntry({ + index: e.index, + thickness: e.thickness, + span: { start: o.start, end: s.start } + }, a)), o.end > s.end && (i += this.insertEntry({ + index: e.index, + thickness: e.thickness, + span: { start: s.end, end: o.end } + }, a)), i ? (n.push({ + index: e.index, + thickness: e.thickness, + span: gM(s, o) + // guaranteed to intersect + }, ...a), i) : (n.push(e), 0); + } + insertEntryAt(e, t) { + let { entriesByLevel: n, levelCoords: i } = this; + t.lateral === -1 ? (BC(i, t.level, t.levelCoord), BC(n, t.level, [e])) : BC(n[t.level], t.lateral, e), this.stackCnts[Hh(e)] = t.stackCnt; + } + findInsertion(e) { + let { levelCoords: t, entriesByLevel: n, strictOrder: i, stackCnts: a } = this, o = t.length, s = 0, l = -1, u = -1, c = null, h = 0; + for (let b = 0; b < o; b += 1) { + let w = t[b]; + if (!i && w >= s + e.thickness) + break; + let p = n[b], d, m = nI(p, e.span.start, rI), _ = m[0] + m[1]; + for ( + ; + // loop through entries that horizontally intersect + (d = p[_]) && // but not past the whole entry list + d.span.start < e.span.end; + ) { + let y = w + d.thickness; + y > s && (s = y, c = d, l = b, u = _), y === s && (h = Math.max(h, a[Hh(d)] + 1)), _ += 1; + } + } + let f = 0; + if (c) + for (f = l + 1; f < o && t[f] < s; ) + f += 1; + let v = -1; + return f < o && t[f] === s && (v = nI(n[f], e.span.end, rI)[0]), { + touchingLevel: l, + touchingLateral: u, + touchingEntry: c, + stackCnt: h, + levelCoord: s, + level: f, + lateral: v + }; + } + // sorted by levelCoord (lowest to highest) + toRects() { + let { entriesByLevel: e, levelCoords: t } = this, n = e.length, i = []; + for (let a = 0; a < n; a += 1) { + let o = e[a], s = t[a]; + for (let l of o) + i.push(Object.assign(Object.assign({}, l), { levelCoord: s })); + } + return i; + } +} +function rI(r) { + return r.span.end; +} +function Hh(r) { + return r.index + ":" + r.span.start; +} +function ixe(r) { + let e = []; + for (let t of r) { + let n = [], i = { + span: t.span, + entries: [t] + }; + for (let a of e) + gM(a.span, i.span) ? i = { + entries: a.entries.concat(i.entries), + span: axe(a.span, i.span) + } : n.push(a); + n.push(i), e = n; + } + return e; +} +function axe(r, e) { + return { + start: Math.min(r.start, e.start), + end: Math.max(r.end, e.end) + }; +} +function gM(r, e) { + let t = Math.max(r.start, e.start), n = Math.min(r.end, e.end); + return t < n ? { start: t, end: n } : null; +} +function BC(r, e, t) { + r.splice(e, 0, t); +} +function nI(r, e, t) { + let n = 0, i = r.length; + if (!i || e < t(r[n])) + return [0, 0]; + if (e > t(r[i - 1])) + return [i, 0]; + for (; n < i; ) { + let a = Math.floor(n + (i - n) / 2), o = t(r[a]); + if (e < o) + i = a; + else if (e > o) + n = a + 1; + else + return [a, 1]; + } + return [n, 0]; +} +class dv { + constructor(e) { + this.component = e.component, this.isHitComboAllowed = e.isHitComboAllowed || null; + } + destroy() { + } +} +function oxe(r, e) { + return { + component: r, + el: e.el, + useEventCenter: e.useEventCenter != null ? e.useEventCenter : !0, + isHitComboAllowed: e.isHitComboAllowed || null + }; +} +function mM(r) { + return { + [r.component.uid]: r + }; +} +const iI = {}; +class sxe { + constructor(e, t) { + this.emitter = new Cx(); + } + destroy() { + } + setMirrorIsVisible(e) { + } + setMirrorNeedsRevert(e) { + } + setAutoScrollEnabled(e) { + } +} +const yM = {}; +class lxe extends un { + constructor() { + super(...arguments), this.state = { + forPrint: !1 + }, this.handleBeforePrint = () => { + this.setState({ forPrint: !0 }); + }, this.handleAfterPrint = () => { + this.setState({ forPrint: !1 }); + }; + } + render() { + let { props: e } = this, { options: t } = e, { forPrint: n } = this.state, i = n || t.height === "auto" || t.contentHeight === "auto", a = !i && t.height != null ? t.height : "", o = [ + "fc", + n ? "fc-media-print" : "fc-media-screen", + `fc-direction-${t.direction}`, + e.theme.getClass("root") + ]; + return SG() || o.push("fc-liquid-hack"), e.children(o, a, i, n); + } + componentDidMount() { + let { emitter: e } = this.props; + e.on("_beforeprint", this.handleBeforePrint), e.on("_afterprint", this.handleAfterPrint); + } + componentWillUnmount() { + let { emitter: e } = this.props; + e.off("_beforeprint", this.handleBeforePrint), e.off("_afterprint", this.handleAfterPrint); + } +} +function uxe(r, e) { + return !r || e > 10 ? jn({ weekday: "short" }) : e > 1 ? jn({ weekday: "short", month: "numeric", day: "numeric", omitCommas: !0 }) : jn({ weekday: "long" }); +} +const RG = "fc-col-header-cell"; +function NG(r) { + return r.text; +} +class _M extends un { + constructor() { + super(...arguments), this.id = df(), this.queuedDomNodes = [], this.currentDomNodes = [], this.handleEl = (e) => { + this.props.elRef && lu(this.props.elRef, e); + }; + } + render() { + const { props: e, context: t } = this, { options: n } = t, { customGenerator: i, defaultGenerator: a, renderProps: o } = e, s = BG(e); + let l = !1, u, c = [], h; + if (i != null) { + const f = typeof i == "function" ? i(o, me) : i; + if (f === !0) + l = !0; + else { + const v = f && typeof f == "object"; + v && "html" in f ? s.dangerouslySetInnerHTML = { __html: f.html } : v && "domNodes" in f ? c = Array.prototype.slice.call(f.domNodes) : !v && typeof f != "function" ? u = f : h = f; + } + } else + l = !zG(e.generatorName, n); + return l && a && (u = a(o)), this.queuedDomNodes = c, this.currentGeneratorMeta = h, me(e.elTag, s, u); + } + componentDidMount() { + this.applyQueueudDomNodes(), this.triggerCustomRendering(!0); + } + componentDidUpdate() { + this.applyQueueudDomNodes(), this.triggerCustomRendering(!0); + } + componentWillUnmount() { + this.triggerCustomRendering(!1); + } + triggerCustomRendering(e) { + var t; + const { props: n, context: i } = this, { handleCustomRendering: a, customRenderingMetaMap: o } = i.options; + if (a) { + const s = (t = this.currentGeneratorMeta) !== null && t !== void 0 ? t : o == null ? void 0 : o[n.generatorName]; + s && a(Object.assign(Object.assign({ + id: this.id, + isActive: e, + containerEl: this.base, + reportNewContainerEl: this.handleEl, + // for customRenderingReplacesEl + generatorMeta: s + }, n), { elClasses: (n.elClasses || []).filter(cxe) })); + } + } + applyQueueudDomNodes() { + const { queuedDomNodes: e, currentDomNodes: t } = this, n = this.base; + if (!_c(e, t)) { + t.forEach(ZE); + for (let i of e) + n.appendChild(i); + this.currentDomNodes = e; + } + } +} +_M.addPropsEquality({ + elClasses: _c, + elStyle: El, + elAttrs: h_e, + renderProps: El +}); +function zG(r, e) { + var t; + return !!(e.handleCustomRendering && r && (!((t = e.customRenderingMetaMap) === null || t === void 0) && t[r])); +} +function BG(r, e) { + const t = Object.assign(Object.assign({}, r.elAttrs), { ref: r.elRef }); + return (r.elClasses || e) && (t.className = (r.elClasses || []).concat(e || []).concat(t.className || []).filter(Boolean).join(" ")), r.elStyle && (t.style = r.elStyle), t; +} +function cxe(r) { + return !!r; +} +const jG = TG(0); +class ma extends bo { + constructor() { + super(...arguments), this.InnerContent = hxe.bind(void 0, this), this.handleRootEl = (e) => { + this.rootEl = e, this.props.elRef && lu(this.props.elRef, e); + }; + } + render() { + const { props: e } = this, t = fxe(e.classNameGenerator, e.renderProps); + if (e.children) { + const n = BG(e, t), i = e.children(this.InnerContent, e.renderProps, n); + return e.elTag ? me(e.elTag, n, i) : i; + } else + return me(_M, Object.assign(Object.assign({}, e), { elRef: this.handleRootEl, elTag: e.elTag || "div", elClasses: (e.elClasses || []).concat(t), renderId: this.context })); + } + componentDidMount() { + var e, t; + (t = (e = this.props).didMount) === null || t === void 0 || t.call(e, Object.assign(Object.assign({}, this.props.renderProps), { el: this.rootEl || this.base })); + } + componentWillUnmount() { + var e, t; + (t = (e = this.props).willUnmount) === null || t === void 0 || t.call(e, Object.assign(Object.assign({}, this.props.renderProps), { el: this.rootEl || this.base })); + } +} +ma.contextType = jG; +function hxe(r, e) { + const t = r.props; + return me(_M, Object.assign({ renderProps: t.renderProps, generatorName: t.generatorName, customGenerator: t.customGenerator, defaultGenerator: t.defaultGenerator, renderId: r.context }, e)); +} +function fxe(r, e) { + const t = typeof r == "function" ? r(e) : r || []; + return typeof t == "string" ? [t] : t; +} +class dxe extends un { + render() { + let { dateEnv: e, options: t, theme: n, viewApi: i } = this.context, { props: a } = this, { date: o, dateProfile: s } = a, l = uM(o, a.todayRange, null, s), u = [RG].concat(Sx(l, n)), c = e.format(o, a.dayHeaderFormat), h = !l.isDisabled && a.colCnt > 1 ? Gd(this.context, o) : {}, f = Object.assign(Object.assign(Object.assign({ date: e.toDate(o), view: i }, a.extraRenderProps), { text: c }), l); + return me(ma, { elTag: "th", elClasses: u, elAttrs: Object.assign({ role: "columnheader", colSpan: a.colSpan, "data-date": l.isDisabled ? void 0 : ym(o) }, a.extraDataAttrs), renderProps: f, generatorName: "dayHeaderContent", customGenerator: t.dayHeaderContent, defaultGenerator: NG, classNameGenerator: t.dayHeaderClassNames, didMount: t.dayHeaderDidMount, willUnmount: t.dayHeaderWillUnmount }, (v) => me("div", { className: "fc-scrollgrid-sync-inner" }, !l.isDisabled && me(v, { elTag: "a", elAttrs: h, elClasses: [ + "fc-col-header-cell-cushion", + a.isSticky && "fc-sticky" + ] }))); + } +} +const vxe = jn({ weekday: "long" }); +class pxe extends un { + render() { + let { props: e } = this, { dateEnv: t, theme: n, viewApi: i, options: a } = this.context, o = Bi(/* @__PURE__ */ new Date(2592e5), e.dow), s = { + dow: e.dow, + isDisabled: !1, + isFuture: !1, + isPast: !1, + isToday: !1, + isOther: !1 + }, l = t.format(o, e.dayHeaderFormat), u = Object.assign(Object.assign(Object.assign(Object.assign({ + // TODO: make this public? + date: o + }, s), { view: i }), e.extraRenderProps), { text: l }); + return me(ma, { elTag: "th", elClasses: [ + RG, + ...Sx(s, n), + ...e.extraClassNames || [] + ], elAttrs: Object.assign({ role: "columnheader", colSpan: e.colSpan }, e.extraDataAttrs), renderProps: u, generatorName: "dayHeaderContent", customGenerator: a.dayHeaderContent, defaultGenerator: NG, classNameGenerator: a.dayHeaderClassNames, didMount: a.dayHeaderDidMount, willUnmount: a.dayHeaderWillUnmount }, (c) => me( + "div", + { className: "fc-scrollgrid-sync-inner" }, + me(c, { elTag: "a", elClasses: [ + "fc-col-header-cell-cushion", + e.isSticky && "fc-sticky" + ], elAttrs: { + "aria-label": t.format(o, vxe) + } }) + )); + } +} +class vv extends bo { + constructor(e, t) { + super(e, t), this.initialNowDate = bm(t.options.now, t.dateEnv), this.initialNowQueriedMs = (/* @__PURE__ */ new Date()).valueOf(), this.state = this.computeTiming().currentState; + } + render() { + let { props: e, state: t } = this; + return e.children(t.nowDate, t.todayRange); + } + componentDidMount() { + this.setTimeout(); + } + componentDidUpdate(e) { + e.unit !== this.props.unit && (this.clearTimeout(), this.setTimeout()); + } + componentWillUnmount() { + this.clearTimeout(); + } + computeTiming() { + let { props: e, context: t } = this, n = bc(this.initialNowDate, (/* @__PURE__ */ new Date()).valueOf() - this.initialNowQueriedMs), i = t.dateEnv.startOf(n, e.unit), a = t.dateEnv.add(i, Xr(1, e.unit)), o = a.valueOf() - n.valueOf(); + return o = Math.min(1e3 * 60 * 60 * 24, o), { + currentState: { nowDate: i, todayRange: Dz(i) }, + nextState: { nowDate: a, todayRange: Dz(a) }, + waitMs: o + }; + } + setTimeout() { + let { nextState: e, waitMs: t } = this.computeTiming(); + this.timeoutId = setTimeout(() => { + this.setState(e, () => { + this.setTimeout(); + }); + }, t); + } + clearTimeout() { + this.timeoutId && clearTimeout(this.timeoutId); + } +} +vv.contextType = fu; +function Dz(r) { + let e = kn(r), t = Bi(e, 1); + return { start: e, end: t }; +} +class FG extends un { + constructor() { + super(...arguments), this.createDayHeaderFormatter = rr(gxe); + } + render() { + let { context: e } = this, { dates: t, dateProfile: n, datesRepDistinctDays: i, renderIntro: a } = this.props, o = this.createDayHeaderFormatter(e.options.dayHeaderFormat, i, t.length); + return me(vv, { unit: "day" }, (s, l) => me( + "tr", + { role: "row" }, + a && a("day"), + t.map((u) => i ? me(dxe, { key: u.toISOString(), date: u, dateProfile: n, todayRange: l, colCnt: t.length, dayHeaderFormat: o }) : me(pxe, { key: u.getUTCDay(), dow: u.getUTCDay(), dayHeaderFormat: o })) + )); + } +} +function gxe(r, e, t) { + return r || uxe(e, t); +} +class $G { + constructor(e, t) { + let n = e.start, { end: i } = e, a = [], o = [], s = -1; + for (; n < i; ) + t.isHiddenDay(n) ? a.push(s + 0.5) : (s += 1, a.push(s), o.push(n)), n = Bi(n, 1); + this.dates = o, this.indices = a, this.cnt = o.length; + } + sliceRange(e) { + let t = this.getDateDayIndex(e.start), n = this.getDateDayIndex(Bi(e.end, -1)), i = Math.max(0, t), a = Math.min(this.cnt - 1, n); + return i = Math.ceil(i), a = Math.floor(a), i <= a ? { + firstIndex: i, + lastIndex: a, + isStart: t === i, + isEnd: n === a + } : null; + } + // Given a date, returns its chronolocial cell-index from the first cell of the grid. + // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets. + // If before the first offset, returns a negative number. + // If after the last offset, returns an offset past the last cell offset. + // Only works for *start* dates of cells. Will not work for exclusive end dates for cells. + getDateDayIndex(e) { + let { indices: t } = this, n = Math.floor(Ic(this.dates[0], e)); + return n < 0 ? t[0] - 1 : n >= t.length ? t[t.length - 1] + 1 : t[n]; + } +} +class HG { + constructor(e, t) { + let { dates: n } = e, i, a, o; + if (t) { + for (a = n[0].getUTCDay(), i = 1; i < n.length && n[i].getUTCDay() !== a; i += 1) + ; + o = Math.ceil(n.length / i); + } else + o = 1, i = n.length; + this.rowCnt = o, this.colCnt = i, this.daySeries = e, this.cells = this.buildCells(), this.headerDates = this.buildHeaderDates(); + } + buildCells() { + let e = []; + for (let t = 0; t < this.rowCnt; t += 1) { + let n = []; + for (let i = 0; i < this.colCnt; i += 1) + n.push(this.buildCell(t, i)); + e.push(n); + } + return e; + } + buildCell(e, t) { + let n = this.daySeries.dates[e * this.colCnt + t]; + return { + key: n.toISOString(), + date: n + }; + } + buildHeaderDates() { + let e = []; + for (let t = 0; t < this.colCnt; t += 1) + e.push(this.cells[0][t].date); + return e; + } + sliceRange(e) { + let { colCnt: t } = this, n = this.daySeries.sliceRange(e), i = []; + if (n) { + let { firstIndex: a, lastIndex: o } = n, s = a; + for (; s <= o; ) { + let l = Math.floor(s / t), u = Math.min((l + 1) * t, o + 1); + i.push({ + row: l, + firstCol: s % t, + lastCol: (u - 1) % t, + isStart: n.isStart && s === a, + isEnd: n.isEnd && u - 1 === o + }), s = u; + } + } + return i; + } +} +class VG { + constructor() { + this.sliceBusinessHours = rr(this._sliceBusinessHours), this.sliceDateSelection = rr(this._sliceDateSpan), this.sliceEventStore = rr(this._sliceEventStore), this.sliceEventDrag = rr(this._sliceInteraction), this.sliceEventResize = rr(this._sliceInteraction), this.forceDayIfListItem = !1; + } + sliceProps(e, t, n, i, ...a) { + let { eventUiBases: o } = e, s = this.sliceEventStore(e.eventStore, o, t, n, ...a); + return { + dateSelectionSegs: this.sliceDateSelection(e.dateSelection, t, n, o, i, ...a), + businessHourSegs: this.sliceBusinessHours(e.businessHours, t, n, i, ...a), + fgEventSegs: s.fg, + bgEventSegs: s.bg, + eventDrag: this.sliceEventDrag(e.eventDrag, o, t, n, ...a), + eventResize: this.sliceEventResize(e.eventResize, o, t, n, ...a), + eventSelection: e.eventSelection + }; + } + sliceNowDate(e, t, n, i, ...a) { + return this._sliceDateSpan( + { range: { start: e, end: bc(e, 1) }, allDay: !1 }, + // add 1 ms, protect against null range + t, + n, + {}, + i, + ...a + ); + } + _sliceBusinessHours(e, t, n, i, ...a) { + return e ? this._sliceEventStore(tf(e, T0(t, !!n), i), {}, t, n, ...a).bg : []; + } + _sliceEventStore(e, t, n, i, ...a) { + if (e) { + let o = tI(e, t, T0(n, !!i), i); + return { + bg: this.sliceEventRanges(o.bg, a), + fg: this.sliceEventRanges(o.fg, a) + }; + } + return { bg: [], fg: [] }; + } + _sliceInteraction(e, t, n, i, ...a) { + if (!e) + return null; + let o = tI(e.mutatedEvents, t, T0(n, !!i), i); + return { + segs: this.sliceEventRanges(o.fg, a), + affectedInstances: e.affectedEvents.instances, + isEvent: e.isEvent + }; + } + _sliceDateSpan(e, t, n, i, a, ...o) { + if (!e) + return []; + let s = T0(t, !!n), l = xc(e.range, s); + if (l) { + e = Object.assign(Object.assign({}, e), { range: l }); + let u = Kbe(e, i, a), c = this.sliceRange(e.range, ...o); + for (let h of c) + h.eventRange = u; + return c; + } + return []; + } + /* + "complete" seg means it has component and eventRange + */ + sliceEventRanges(e, t) { + let n = []; + for (let i of e) + n.push(...this.sliceEventRange(i, t)); + return n; + } + /* + "complete" seg means it has component and eventRange + */ + sliceEventRange(e, t) { + let n = e.range; + this.forceDayIfListItem && e.ui.display === "list-item" && (n = { + start: n.start, + end: Bi(n.start, 1) + }); + let i = this.sliceRange(n, ...t); + for (let a of i) + a.eventRange = e, a.isStart = e.isStart && a.isStart, a.isEnd = e.isEnd && a.isEnd; + return i; + } +} +function T0(r, e) { + let t = r.activeRange; + return e ? t : { + start: bc(t.start, r.slotMinTime.milliseconds), + end: bc(t.end, r.slotMaxTime.milliseconds - 864e5) + // 864e5 = ms in a day + }; +} +function mxe(r, e, t, n, i) { + switch (e.type) { + case "RECEIVE_EVENTS": + return yxe(r, t[e.sourceId], e.fetchId, e.fetchRange, e.rawEvents, i); + case "RESET_RAW_EVENTS": + return _xe(r, t[e.sourceId], e.rawEvents, n.activeRange, i); + case "ADD_EVENTS": + return bxe( + r, + e.eventStore, + // new ones + n ? n.activeRange : null, + i + ); + case "RESET_EVENTS": + return e.eventStore; + case "MERGE_EVENTS": + return aM(r, e.eventStore); + case "PREV": + case "NEXT": + case "CHANGE_DATE": + case "CHANGE_VIEW_TYPE": + return n ? tf(r, n.activeRange, i) : r; + case "REMOVE_EVENTS": + return Y_e(r, e.eventStore); + case "REMOVE_EVENT_SOURCE": + return UG(r, e.sourceId); + case "REMOVE_ALL_EVENT_SOURCES": + return bx(r, (a) => !a.sourceId); + case "REMOVE_ALL_EVENTS": + return xo(); + default: + return r; + } +} +function yxe(r, e, t, n, i, a) { + if (e && // not already removed + t === e.latestFetchId) { + let o = $g(GG(i, e, a), e, a); + return n && (o = tf(o, n, a)), aM(UG(r, e.sourceId), o); + } + return r; +} +function _xe(r, e, t, n, i) { + const { defIdMap: a, instanceIdMap: o } = Sxe(r); + let s = $g(GG(t, e, i), e, i, !1, a, o); + return tf(s, n, i); +} +function GG(r, e, t) { + let n = t.options.eventDataTransform, i = e ? e.eventDataTransform : null; + return i && (r = kz(r, i)), n && (r = kz(r, n)), r; +} +function kz(r, e) { + let t; + if (!e) + t = r; + else { + t = []; + for (let n of r) { + let i = e(n); + i ? t.push(i) : i == null && t.push(n); + } + } + return t; +} +function bxe(r, e, t, n) { + return t && (e = tf(e, t, n)), aM(r, e); +} +function Oz(r, e, t) { + let { defs: n } = r, i = su(r.instances, (a) => n[a.defId].allDay ? a : Object.assign(Object.assign({}, a), { range: { + start: t.createMarker(e.toDate(a.range.start, a.forcedStartTzo)), + end: t.createMarker(e.toDate(a.range.end, a.forcedEndTzo)) + }, forcedStartTzo: t.canComputeOffset ? null : a.forcedStartTzo, forcedEndTzo: t.canComputeOffset ? null : a.forcedEndTzo })); + return { defs: n, instances: i }; +} +function UG(r, e) { + return bx(r, (t) => t.sourceId !== e); +} +function xxe(r, e) { + return { + defs: r.defs, + instances: ef(r.instances, (t) => !e[t.instanceId]) + }; +} +function Sxe(r) { + const { defs: e, instances: t } = r, n = {}, i = {}; + for (let a in e) { + const o = e[a], { publicId: s } = o; + s && (n[s] = a); + } + for (let a in t) { + const o = t[a], s = e[o.defId], { publicId: l } = s; + l && (i[l] = a); + } + return { defIdMap: n, instanceIdMap: i }; +} +function WG(r, e, t) { + let { instances: n } = r.mutatedEvents; + for (let i in n) + if (!xx(e.validRange, n[i].range)) + return !1; + return YG({ eventDrag: r }, t); +} +function wxe(r, e, t) { + return xx(e.validRange, r.range) ? YG({ dateSelection: r }, t) : !1; +} +function YG(r, e) { + let t = e.getCurrentData(), n = Object.assign({ businessHours: t.businessHours, dateSelection: "", eventStore: t.eventStore, eventUiBases: t.eventUiBases, eventSelection: "", eventDrag: null, eventResize: null }, r); + return (e.pluginHooks.isPropsValid || Cxe)(n, e); +} +function Cxe(r, e, t = {}, n) { + return !(r.eventDrag && !Txe(r, e, t, n) || r.dateSelection && !Ixe(r, e, t, n)); +} +function Txe(r, e, t, n) { + let i = e.getCurrentData(), a = r.eventDrag, o = a.mutatedEvents, s = o.defs, l = o.instances, u = vb(s, a.isEvent ? r.eventUiBases : { "": i.selectionConfig }); + n && (u = su(u, n)); + let c = xxe(r.eventStore, a.affectedEvents.instances), h = c.defs, f = c.instances, v = vb(h, r.eventUiBases); + for (let b in l) { + let w = l[b], p = w.range, d = u[w.defId], m = s[w.defId]; + if (!XG(d.constraints, p, c, r.businessHours, e)) + return !1; + let { eventOverlap: _ } = e.options, y = typeof _ == "function" ? _ : null; + for (let g in f) { + let S = f[g]; + if (lM(p, S.range) && (v[S.defId].overlap === !1 && a.isEvent || d.overlap === !1 || y && !y( + new Gn(e, h[S.defId], S), + // still event + new Gn(e, m, w) + ))) + return !1; + } + let x = i.eventStore; + for (let g of d.allows) { + let S = Object.assign(Object.assign({}, t), { range: w.range, allDay: m.allDay }), T = x.defs[m.defId], C = x.instances[b], E; + if (T ? E = new Gn(e, T, C) : E = new Gn(e, m), !g(fM(S, e), E)) + return !1; + } + } + return !0; +} +function Ixe(r, e, t, n) { + let i = r.eventStore, a = i.defs, o = i.instances, s = r.dateSelection, l = s.range, { selectionConfig: u } = e.getCurrentData(); + if (n && (u = n(u)), !XG(u.constraints, l, i, r.businessHours, e)) + return !1; + let { selectOverlap: c } = e.options, h = typeof c == "function" ? c : null; + for (let f in o) { + let v = o[f]; + if (lM(l, v.range) && (u.overlap === !1 || h && !h(new Gn(e, a[v.defId], v), null))) + return !1; + } + for (let f of u.allows) { + let v = Object.assign(Object.assign({}, t), s); + if (!f(fM(v, e), null)) + return !1; + } + return !0; +} +function XG(r, e, t, n, i) { + for (let a of r) + if (!Exe(Axe(a, e, t, n, i), e)) + return !1; + return !0; +} +function Axe(r, e, t, n, i) { + return r === "businessHours" ? jC(tf(n, e, i)) : typeof r == "string" ? jC(bx(t, (a) => a.groupId === r)) : typeof r == "object" && r ? jC(tf(r, e, i)) : []; +} +function jC(r) { + let { instances: e } = r, t = []; + for (let n in e) + t.push(e[n].range); + return t; +} +function Exe(r, e) { + for (let t of r) + if (xx(t, e)) + return !0; + return !1; +} +class Lz extends Error { + constructor(e, t) { + super(e), this.response = t; + } +} +function Mxe(r, e, t) { + r = r.toUpperCase(); + const n = { + method: r + }; + return r === "GET" ? e += (e.indexOf("?") === -1 ? "?" : "&") + new URLSearchParams(t) : (n.body = new URLSearchParams(t), n.headers = { + "Content-Type": "application/x-www-form-urlencoded" + }), fetch(e, n).then((i) => { + if (i.ok) + return i.json().then((a) => [a, i], () => { + throw new Lz("Failure parsing JSON", i); + }); + throw new Lz("Request failed", i); + }); +} +class bM { + constructor(e) { + this.drainedOption = e, this.isRunning = !1, this.isDirty = !1, this.pauseDepths = {}, this.timeoutId = 0; + } + request(e) { + this.isDirty = !0, this.isPaused() || (this.clearTimeout(), e == null ? this.tryDrain() : this.timeoutId = setTimeout( + // NOT OPTIMAL! TODO: look at debounce + this.tryDrain.bind(this), + e + )); + } + pause(e = "") { + let { pauseDepths: t } = this; + t[e] = (t[e] || 0) + 1, this.clearTimeout(); + } + resume(e = "", t) { + let { pauseDepths: n } = this; + e in n && (t ? delete n[e] : (n[e] -= 1, n[e] <= 0 && delete n[e]), this.tryDrain()); + } + isPaused() { + return Object.keys(this.pauseDepths).length; + } + tryDrain() { + if (!this.isRunning && !this.isPaused()) { + for (this.isRunning = !0; this.isDirty; ) + this.isDirty = !1, this.drained(); + this.isRunning = !1; + } + } + clear() { + this.clearTimeout(), this.isDirty = !1, this.pauseDepths = {}; + } + clearTimeout() { + this.timeoutId && (clearTimeout(this.timeoutId), this.timeoutId = 0); + } + drained() { + this.drainedOption && this.drainedOption(); + } +} +const I0 = /^(visible|hidden)$/; +class ZG extends un { + constructor() { + super(...arguments), this.handleEl = (e) => { + this.el = e, lu(this.props.elRef, e); + }; + } + render() { + let { props: e } = this, { liquid: t, liquidIsAbsolute: n } = e, i = t && n, a = ["fc-scroller"]; + return t && (n ? a.push("fc-scroller-liquid-absolute") : a.push("fc-scroller-liquid")), me("div", { ref: this.handleEl, className: a.join(" "), style: { + overflowX: e.overflowX, + overflowY: e.overflowY, + left: i && -(e.overcomeLeft || 0) || "", + right: i && -(e.overcomeRight || 0) || "", + bottom: i && -(e.overcomeBottom || 0) || "", + marginLeft: !i && -(e.overcomeLeft || 0) || "", + marginRight: !i && -(e.overcomeRight || 0) || "", + marginBottom: !i && -(e.overcomeBottom || 0) || "", + maxHeight: e.maxHeight || "" + } }, e.children); + } + needsXScrolling() { + if (I0.test(this.props.overflowX)) + return !1; + let { el: e } = this, t = this.el.getBoundingClientRect().width - this.getYScrollbarWidth(), { children: n } = e; + for (let i = 0; i < n.length; i += 1) + if (n[i].getBoundingClientRect().width > t) + return !0; + return !1; + } + needsYScrolling() { + if (I0.test(this.props.overflowY)) + return !1; + let { el: e } = this, t = this.el.getBoundingClientRect().height - this.getXScrollbarWidth(), { children: n } = e; + for (let i = 0; i < n.length; i += 1) + if (n[i].getBoundingClientRect().height > t) + return !0; + return !1; + } + getXScrollbarWidth() { + return I0.test(this.props.overflowX) ? 0 : this.el.offsetHeight - this.el.clientHeight; + } + getYScrollbarWidth() { + return I0.test(this.props.overflowY) ? 0 : this.el.offsetWidth - this.el.clientWidth; + } +} +class Zl { + constructor(e) { + this.masterCallback = e, this.currentMap = {}, this.depths = {}, this.callbackMap = {}, this.handleValue = (t, n) => { + let { depths: i, currentMap: a } = this, o = !1, s = !1; + t !== null ? (o = n in a, a[n] = t, i[n] = (i[n] || 0) + 1, s = !0) : (i[n] -= 1, i[n] || (delete a[n], delete this.callbackMap[n], o = !0)), this.masterCallback && (o && this.masterCallback(null, String(n)), s && this.masterCallback(t, String(n))); + }; + } + createRef(e) { + let t = this.callbackMap[e]; + return t || (t = this.callbackMap[e] = (n) => { + this.handleValue(n, String(e)); + }), t; + } + // TODO: check callers that don't care about order. should use getAll instead + // NOTE: this method has become less valuable now that we are encouraged to map order by some other index + // TODO: provide ONE array-export function, buildArray, which fails on non-numeric indexes. caller can manipulate and "collect" + collect(e, t, n) { + return d_e(this.currentMap, e, t, n); + } + getAll() { + return eM(this.currentMap); + } +} +function Dxe(r) { + let e = H0e(r, ".fc-scrollgrid-shrink"), t = 0; + for (let n of e) + t = Math.max(t, r_e(n)); + return Math.ceil(t); +} +function JG(r, e) { + return r.liquid && e.liquid; +} +function kxe(r, e) { + return e.maxHeight != null || // if its possible for the height to max out, we might need scrollbars + JG(r, e); +} +function Oxe(r, e, t, n) { + let { expandRows: i } = t; + return typeof e.content == "function" ? e.content(t) : me("table", { + role: "presentation", + className: [ + e.tableClassName, + r.syncRowHeights ? "fc-scrollgrid-sync-table" : "" + ].join(" "), + style: { + minWidth: t.tableMinWidth, + width: t.clientWidth, + height: i ? t.clientHeight : "" + // css `height` on a serves as a min-height + } + }, t.tableColGroupNode, me(n ? "thead" : "tbody", { + role: "presentation" + }, typeof e.rowContent == "function" ? e.rowContent(t) : e.rowContent)); +} +function Lxe(r, e) { + return _c(r, e, El); +} +function Pxe(r, e) { + let t = []; + for (let n of r) { + let i = n.span || 1; + for (let a = 0; a < i; a += 1) + t.push(me("col", { style: { + width: n.width === "shrink" ? Rxe(e) : n.width || "", + minWidth: n.minWidth || "" + } })); + } + return me("colgroup", {}, ...t); +} +function Rxe(r) { + return r == null ? 4 : r; +} +function Nxe(r) { + for (let e of r) + if (e.width === "shrink") + return !0; + return !1; +} +function zxe(r, e) { + let t = [ + "fc-scrollgrid", + e.theme.getClass("table") + ]; + return r && t.push("fc-scrollgrid-liquid"), t; +} +function Bxe(r, e) { + let t = [ + "fc-scrollgrid-section", + `fc-scrollgrid-section-${r.type}`, + r.className + // used? + ]; + return e && r.liquid && r.maxHeight == null && t.push("fc-scrollgrid-section-liquid"), r.isSticky && t.push("fc-scrollgrid-section-sticky"), t; +} +function aI(r) { + return me("div", { className: "fc-scrollgrid-sticky-shim", style: { + width: r.clientWidth, + minWidth: r.tableMinWidth + } }); +} +function pb(r) { + let { stickyHeaderDates: e } = r; + return (e == null || e === "auto") && (e = r.height === "auto" || r.viewHeight === "auto"), e; +} +function KG(r) { + let { stickyFooterScrollbar: e } = r; + return (e == null || e === "auto") && (e = r.height === "auto" || r.viewHeight === "auto"), e; +} +class xM extends un { + constructor() { + super(...arguments), this.processCols = rr((e) => e, Lxe), this.renderMicroColGroup = rr(Pxe), this.scrollerRefs = new Zl(), this.scrollerElRefs = new Zl(this._handleScrollerEl.bind(this)), this.state = { + shrinkWidth: null, + forceYScrollbars: !1, + scrollerClientWidths: {}, + scrollerClientHeights: {} + }, this.handleSizing = () => { + this.safeSetState(Object.assign({ shrinkWidth: this.computeShrinkWidth() }, this.computeScrollerDims())); + }; + } + render() { + let { props: e, state: t, context: n } = this, i = e.sections || [], a = this.processCols(e.cols), o = this.renderMicroColGroup(a, t.shrinkWidth), s = zxe(e.liquid, n); + e.collapsibleWidth && s.push("fc-scrollgrid-collapsible"); + let l = i.length, u = 0, c, h = [], f = [], v = []; + for (; u < l && (c = i[u]).type === "header"; ) + h.push(this.renderSection(c, o, !0)), u += 1; + for (; u < l && (c = i[u]).type === "body"; ) + f.push(this.renderSection(c, o, !1)), u += 1; + for (; u < l && (c = i[u]).type === "footer"; ) + v.push(this.renderSection(c, o, !0)), u += 1; + let b = !SG(); + const w = { role: "rowgroup" }; + return me("table", { + role: "grid", + className: s.join(" "), + style: { height: e.height } + }, !!(!b && h.length) && me("thead", w, ...h), !!(!b && f.length) && me("tbody", w, ...f), !!(!b && v.length) && me("tfoot", w, ...v), b && me("tbody", w, ...h, ...f, ...v)); + } + renderSection(e, t, n) { + return "outerContent" in e ? me(Dn, { key: e.key }, e.outerContent) : me("tr", { key: e.key, role: "presentation", className: Bxe(e, this.props.liquid).join(" ") }, this.renderChunkTd(e, t, e.chunk, n)); + } + renderChunkTd(e, t, n, i) { + if ("outerContent" in n) + return n.outerContent; + let { props: a } = this, { forceYScrollbars: o, scrollerClientWidths: s, scrollerClientHeights: l } = this.state, u = kxe(a, e), c = JG(a, e), h = a.liquid ? o ? "scroll" : u ? "auto" : "hidden" : "visible", f = e.key, v = Oxe(e, n, { + tableColGroupNode: t, + tableMinWidth: "", + clientWidth: !a.collapsibleWidth && s[f] !== void 0 ? s[f] : null, + clientHeight: l[f] !== void 0 ? l[f] : null, + expandRows: e.expandRows, + syncRowHeights: !1, + rowSyncHeights: [], + reportRowHeightChange: () => { + } + }, i); + return me(i ? "th" : "td", { + ref: n.elRef, + role: "presentation" + }, me( + "div", + { className: `fc-scroller-harness${c ? " fc-scroller-harness-liquid" : ""}` }, + me(ZG, { ref: this.scrollerRefs.createRef(f), elRef: this.scrollerElRefs.createRef(f), overflowY: h, overflowX: a.liquid ? "hidden" : "visible", maxHeight: e.maxHeight, liquid: c, liquidIsAbsolute: !0 }, v) + )); + } + _handleScrollerEl(e, t) { + let n = jxe(this.props.sections, t); + n && lu(n.chunk.scrollerElRef, e); + } + componentDidMount() { + this.handleSizing(), this.context.addResizeHandler(this.handleSizing); + } + componentDidUpdate() { + this.handleSizing(); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleSizing); + } + computeShrinkWidth() { + return Nxe(this.props.cols) ? Dxe(this.scrollerElRefs.getAll()) : 0; + } + computeScrollerDims() { + let e = _be(), { scrollerRefs: t, scrollerElRefs: n } = this, i = !1, a = {}, o = {}; + for (let s in t.currentMap) { + let l = t.currentMap[s]; + if (l && l.needsYScrolling()) { + i = !0; + break; + } + } + for (let s of this.props.sections) { + let l = s.key, u = n.currentMap[l]; + if (u) { + let c = u.parentNode; + a[l] = Math.floor(c.getBoundingClientRect().width - (i ? e.y : 0)), o[l] = Math.floor(c.getBoundingClientRect().height); + } + } + return { forceYScrollbars: i, scrollerClientWidths: a, scrollerClientHeights: o }; + } +} +xM.addStateEquality({ + scrollerClientWidths: El, + scrollerClientHeights: El +}); +function jxe(r, e) { + for (let t of r) + if (t.key === e) + return t; + return null; +} +class Tx extends un { + constructor() { + super(...arguments), this.handleEl = (e) => { + this.el = e, e && Mz(e, this.props.seg); + }; + } + render() { + const { props: e, context: t } = this, { options: n } = t, { seg: i } = e, { eventRange: a } = i, { ui: o } = a, s = { + event: new Gn(t, a.def, a.instance), + view: t.viewApi, + timeText: e.timeText, + textColor: o.textColor, + backgroundColor: o.backgroundColor, + borderColor: o.borderColor, + isDraggable: !e.disableDragging && $be(i, t), + isStartResizable: !e.disableResizing && Hbe(i, t), + isEndResizable: !e.disableResizing && Vbe(i), + isMirror: !!(e.isDragging || e.isResizing || e.isDateSelecting), + isStart: !!i.isStart, + isEnd: !!i.isEnd, + isPast: !!e.isPast, + isFuture: !!e.isFuture, + isToday: !!e.isToday, + isSelected: !!e.isSelected, + isDragging: !!e.isDragging, + isResizing: !!e.isResizing + }; + return me(ma, Object.assign({}, e, { elRef: this.handleEl, elClasses: [ + ...Gbe(s), + ...i.eventRange.ui.classNames, + ...e.elClasses || [] + ], renderProps: s, generatorName: "eventContent", customGenerator: n.eventContent, defaultGenerator: e.defaultGenerator, classNameGenerator: n.eventClassNames, didMount: n.eventDidMount, willUnmount: n.eventWillUnmount })); + } + componentDidUpdate(e) { + this.el && this.props.seg !== e.seg && Mz(this.el, this.props.seg); + } +} +class QG extends un { + render() { + let { props: e, context: t } = this, { options: n } = t, { seg: i } = e, { ui: a } = i.eventRange, o = n.eventTimeFormat || e.defaultTimeFormat, s = rg(i, o, t, e.defaultDisplayEventTime, e.defaultDisplayEventEnd); + return me(Tx, Object.assign({}, e, { elTag: "a", elStyle: { + borderColor: a.borderColor, + backgroundColor: a.backgroundColor + }, elAttrs: pM(i, t), defaultGenerator: Fxe, timeText: s }), (l, u) => me( + Dn, + null, + me(l, { elTag: "div", elClasses: ["fc-event-main"], elStyle: { color: u.textColor } }), + !!u.isStartResizable && me("div", { className: "fc-event-resizer fc-event-resizer-start" }), + !!u.isEndResizable && me("div", { className: "fc-event-resizer fc-event-resizer-end" }) + )); + } +} +function Fxe(r) { + return me( + "div", + { className: "fc-event-main-frame" }, + r.timeText && me("div", { className: "fc-event-time" }, r.timeText), + me( + "div", + { className: "fc-event-title-container" }, + me("div", { className: "fc-event-title fc-sticky" }, r.event.title || me(Dn, null, " ")) + ) + ); +} +const SM = (r) => me(fu.Consumer, null, (e) => { + let { options: t } = e, n = { + isAxis: r.isAxis, + date: e.dateEnv.toDate(r.date), + view: e.viewApi + }; + return me(ma, Object.assign({}, r, { elTag: r.elTag || "div", renderProps: n, generatorName: "nowIndicatorContent", customGenerator: t.nowIndicatorContent, classNameGenerator: t.nowIndicatorClassNames, didMount: t.nowIndicatorDidMount, willUnmount: t.nowIndicatorWillUnmount })); +}), $xe = jn({ day: "numeric" }); +class wM extends un { + constructor() { + super(...arguments), this.refineRenderProps = q0(Hxe); + } + render() { + let { props: e, context: t } = this, { options: n } = t, i = this.refineRenderProps({ + date: e.date, + dateProfile: e.dateProfile, + todayRange: e.todayRange, + isMonthStart: e.isMonthStart || !1, + showDayNumber: e.showDayNumber, + extraRenderProps: e.extraRenderProps, + viewApi: t.viewApi, + dateEnv: t.dateEnv, + monthStartFormat: n.monthStartFormat + }); + return me(ma, Object.assign({}, e, { elClasses: [ + ...Sx(i, t.theme), + ...e.elClasses || [] + ], elAttrs: Object.assign(Object.assign({}, e.elAttrs), i.isDisabled ? {} : { "data-date": ym(e.date) }), renderProps: i, generatorName: "dayCellContent", customGenerator: n.dayCellContent, defaultGenerator: e.defaultGenerator, classNameGenerator: ( + // don't use custom classNames if disabled + i.isDisabled ? void 0 : n.dayCellClassNames + ), didMount: n.dayCellDidMount, willUnmount: n.dayCellWillUnmount })); + } +} +function CM(r) { + return !!(r.dayCellContent || zG("dayCellContent", r)); +} +function Hxe(r) { + let { date: e, dateEnv: t, dateProfile: n, isMonthStart: i } = r, a = uM(e, r.todayRange, null, n), o = r.showDayNumber ? t.format(e, i ? r.monthStartFormat : $xe) : ""; + return Object.assign(Object.assign(Object.assign({ date: t.toDate(e), view: r.viewApi }, a), { + isMonthStart: i, + dayNumberText: o + }), r.extraRenderProps); +} +class qG extends un { + render() { + let { props: e } = this, { seg: t } = e; + return me(Tx, { elTag: "div", elClasses: ["fc-bg-event"], elStyle: { backgroundColor: t.eventRange.ui.backgroundColor }, defaultGenerator: Vxe, seg: t, timeText: "", isDragging: !1, isResizing: !1, isDateSelecting: !1, isSelected: !1, isPast: e.isPast, isFuture: e.isFuture, isToday: e.isToday, disableDragging: !0, disableResizing: !0 }); + } +} +function Vxe(r) { + let { title: e } = r.event; + return e && me("div", { className: "fc-event-title" }, r.event.title); +} +function eU(r) { + return me("div", { className: `fc-${r}` }); +} +const tU = (r) => me(fu.Consumer, null, (e) => { + let { dateEnv: t, options: n } = e, { date: i } = r, a = n.weekNumberFormat || r.defaultFormat, o = t.computeWeekNumber(i), s = t.format(i, a); + return me( + ma, + Object.assign({}, r, { renderProps: { num: o, text: s, date: i }, generatorName: "weekNumberContent", customGenerator: n.weekNumberContent, defaultGenerator: Gxe, classNameGenerator: n.weekNumberClassNames, didMount: n.weekNumberDidMount, willUnmount: n.weekNumberWillUnmount }) + ); +}); +function Gxe(r) { + return r.text; +} +const FC = 10; +class Uxe extends un { + constructor() { + super(...arguments), this.state = { + titleId: cc() + }, this.handleRootEl = (e) => { + this.rootEl = e, this.props.elRef && lu(this.props.elRef, e); + }, this.handleDocumentMouseDown = (e) => { + const t = uG(e); + this.rootEl.contains(t) || this.handleCloseClick(); + }, this.handleDocumentKeyDown = (e) => { + e.key === "Escape" && this.handleCloseClick(); + }, this.handleCloseClick = () => { + let { onClose: e } = this.props; + e && e(); + }; + } + render() { + let { theme: e, options: t } = this.context, { props: n, state: i } = this, a = [ + "fc-popover", + e.getClass("popover") + ].concat(n.extraClassNames || []); + return E0e(me( + "div", + Object.assign({}, n.extraAttrs, { id: n.id, className: a.join(" "), "aria-labelledby": i.titleId, ref: this.handleRootEl }), + me( + "div", + { className: "fc-popover-header " + e.getClass("popoverHeader") }, + me("span", { className: "fc-popover-title", id: i.titleId }, n.title), + me("span", { className: "fc-popover-close " + e.getIconClass("close"), title: t.closeHint, onClick: this.handleCloseClick }) + ), + me("div", { className: "fc-popover-body " + e.getClass("popoverContent") }, n.children) + ), n.parentEl); + } + componentDidMount() { + document.addEventListener("mousedown", this.handleDocumentMouseDown), document.addEventListener("keydown", this.handleDocumentKeyDown), this.updateSize(); + } + componentWillUnmount() { + document.removeEventListener("mousedown", this.handleDocumentMouseDown), document.removeEventListener("keydown", this.handleDocumentKeyDown); + } + updateSize() { + let { isRtl: e } = this.context, { alignmentEl: t, alignGridTop: n } = this.props, { rootEl: i } = this, a = wbe(t); + if (a) { + let o = i.getBoundingClientRect(), s = n ? da(t, ".fc-scrollgrid").getBoundingClientRect().top : a.top, l = e ? a.right - o.width : a.left; + s = Math.max(s, FC), l = Math.min(l, document.documentElement.clientWidth - FC - o.width), l = Math.max(l, FC); + let u = i.offsetParent.getBoundingClientRect(); + qp(i, { + top: s - u.top, + left: l - u.left + }); + } + } +} +class Wxe extends Vs { + constructor() { + super(...arguments), this.handleRootEl = (e) => { + this.rootEl = e, e ? this.context.registerInteractiveComponent(this, { + el: e, + useEventCenter: !1 + }) : this.context.unregisterInteractiveComponent(this); + }; + } + render() { + let { options: e, dateEnv: t } = this.context, { props: n } = this, { startDate: i, todayRange: a, dateProfile: o } = n, s = t.format(i, e.dayPopoverFormat); + return me(wM, { elRef: this.handleRootEl, date: i, dateProfile: o, todayRange: a }, (l, u, c) => me( + Uxe, + { elRef: c.ref, id: n.id, title: s, extraClassNames: ["fc-more-popover"].concat(c.className || []), extraAttrs: c, parentEl: n.parentEl, alignmentEl: n.alignmentEl, alignGridTop: n.alignGridTop, onClose: n.onClose }, + CM(e) && me(l, { elTag: "div", elClasses: ["fc-more-popover-misc"] }), + n.children + )); + } + queryHit(e, t, n, i) { + let { rootEl: a, props: o } = this; + return e >= 0 && e < n && t >= 0 && t < i ? { + dateProfile: o.dateProfile, + dateSpan: Object.assign({ allDay: !o.forceTimed, range: { + start: o.startDate, + end: o.endDate + } }, o.extraDateSpan), + dayEl: a, + rect: { + left: 0, + top: 0, + right: n, + bottom: i + }, + layer: 1 + // important when comparing with hits from other components + } : null; + } +} +class rU extends un { + constructor() { + super(...arguments), this.state = { + isPopoverOpen: !1, + popoverId: cc() + }, this.handleLinkEl = (e) => { + this.linkEl = e, this.props.elRef && lu(this.props.elRef, e); + }, this.handleClick = (e) => { + let { props: t, context: n } = this, { moreLinkClick: i } = n.options, a = Pz(t).start; + function o(s) { + let { def: l, instance: u, range: c } = s.eventRange; + return { + event: new Gn(n, l, u), + start: n.dateEnv.toDate(c.start), + end: n.dateEnv.toDate(c.end), + isStart: s.isStart, + isEnd: s.isEnd + }; + } + typeof i == "function" && (i = i({ + date: a, + allDay: !!t.allDayDate, + allSegs: t.allSegs.map(o), + hiddenSegs: t.hiddenSegs.map(o), + jsEvent: e, + view: n.viewApi + })), !i || i === "popover" ? this.setState({ isPopoverOpen: !0 }) : typeof i == "string" && n.calendarApi.zoomTo(a, i); + }, this.handlePopoverClose = () => { + this.setState({ isPopoverOpen: !1 }); + }; + } + render() { + let { props: e, state: t } = this; + return me(fu.Consumer, null, (n) => { + let { viewApi: i, options: a, calendarApi: o } = n, { moreLinkText: s } = a, { moreCnt: l } = e, u = Pz(e), c = typeof s == "function" ? s.call(o, l) : `+${l} ${s}`, h = eg(a.moreLinkHint, [l], c), f = { + num: l, + shortText: `+${l}`, + text: c, + view: i + }; + return me( + Dn, + null, + !!e.moreCnt && me(ma, { elTag: e.elTag || "a", elRef: this.handleLinkEl, elClasses: [ + ...e.elClasses || [], + "fc-more-link" + ], elStyle: e.elStyle, elAttrs: Object.assign(Object.assign(Object.assign({}, e.elAttrs), hG(this.handleClick)), { title: h, "aria-expanded": t.isPopoverOpen, "aria-controls": t.isPopoverOpen ? t.popoverId : "" }), renderProps: f, generatorName: "moreLinkContent", customGenerator: a.moreLinkContent, defaultGenerator: e.defaultGenerator || Yxe, classNameGenerator: a.moreLinkClassNames, didMount: a.moreLinkDidMount, willUnmount: a.moreLinkWillUnmount }, e.children), + t.isPopoverOpen && me(Wxe, { id: t.popoverId, startDate: u.start, endDate: u.end, dateProfile: e.dateProfile, todayRange: e.todayRange, extraDateSpan: e.extraDateSpan, parentEl: this.parentEl, alignmentEl: e.alignmentElRef ? e.alignmentElRef.current : this.linkEl, alignGridTop: e.alignGridTop, forceTimed: e.forceTimed, onClose: this.handlePopoverClose }, e.popoverContent()) + ); + }); + } + componentDidMount() { + this.updateParentEl(); + } + componentDidUpdate() { + this.updateParentEl(); + } + updateParentEl() { + this.linkEl && (this.parentEl = da(this.linkEl, ".fc-view-harness")); + } +} +function Yxe(r) { + return r.text; +} +function Pz(r) { + if (r.allDayDate) + return { + start: r.allDayDate, + end: Bi(r.allDayDate, 1) + }; + let { hiddenSegs: e } = r; + return { + start: nU(e), + end: Zxe(e) + }; +} +function nU(r) { + return r.reduce(Xxe).eventRange.range.start; +} +function Xxe(r, e) { + return r.eventRange.range.start < e.eventRange.range.start ? r : e; +} +function Zxe(r) { + return r.reduce(Jxe).eventRange.range.end; +} +function Jxe(r, e) { + return r.eventRange.range.end > e.eventRange.range.end ? r : e; +} +class Hg extends un { + render() { + let { props: e, context: t } = this, { options: n } = t, i = { view: t.viewApi }; + return me(ma, Object.assign({}, e, { elTag: e.elTag || "div", elClasses: [ + ...iU(e.viewSpec), + ...e.elClasses || [] + ], renderProps: i, classNameGenerator: n.viewClassNames, generatorName: void 0, didMount: n.viewDidMount, willUnmount: n.viewWillUnmount }), () => e.children); + } +} +function iU(r) { + return [ + `fc-${r.type}-view`, + "fc-view" + ]; +} +const Kxe = { + id: String, + defaultAllDay: Boolean, + url: String, + format: String, + events: $e, + eventDataTransform: $e, + // for any network-related sources + success: $e, + failure: $e +}; +function aU(r, e, t = oU(e)) { + let n; + if (typeof r == "string" ? n = { url: r } : typeof r == "function" || Array.isArray(r) ? n = { events: r } : typeof r == "object" && r && (n = r), n) { + let { refined: i, extra: a } = rM(n, t), o = Qxe(i, e); + if (o) + return { + _raw: r, + isFetching: !1, + latestFetchId: "", + fetchRange: null, + defaultAllDay: i.defaultAllDay, + eventDataTransform: i.eventDataTransform, + success: i.success, + failure: i.failure, + publicId: i.id || "", + sourceId: df(), + sourceDefId: o.sourceDefId, + meta: o.meta, + ui: db(i, e), + extendedProps: a + }; + } + return null; +} +function oU(r) { + return Object.assign(Object.assign(Object.assign({}, fb), Kxe), r.pluginHooks.eventSourceRefiners); +} +function Qxe(r, e) { + let t = e.pluginHooks.eventSourceDefs; + for (let n = t.length - 1; n >= 0; n -= 1) { + let a = t[n].parseMeta(r); + if (a) + return { sourceDefId: n, meta: a }; + } + return null; +} +class qxe { + getCurrentData() { + return this.currentDataManager.getCurrentData(); + } + dispatch(e) { + this.currentDataManager.dispatch(e); + } + get view() { + return this.getCurrentData().viewApi; + } + batchRendering(e) { + e(); + } + updateSize() { + this.trigger("_resize", !0); + } + // Options + // ----------------------------------------------------------------------------------------------------------------- + setOption(e, t) { + this.dispatch({ + type: "SET_OPTION", + optionName: e, + rawOptionValue: t + }); + } + getOption(e) { + return this.currentDataManager.currentCalendarOptionsInput[e]; + } + getAvailableLocaleCodes() { + return Object.keys(this.getCurrentData().availableRawLocales); + } + // Trigger + // ----------------------------------------------------------------------------------------------------------------- + on(e, t) { + let { currentDataManager: n } = this; + n.currentCalendarOptionsRefiners[e] ? n.emitter.on(e, t) : console.warn(`Unknown listener name '${e}'`); + } + off(e, t) { + this.currentDataManager.emitter.off(e, t); + } + // not meant for public use + trigger(e, ...t) { + this.currentDataManager.emitter.trigger(e, ...t); + } + // View + // ----------------------------------------------------------------------------------------------------------------- + changeView(e, t) { + this.batchRendering(() => { + if (this.unselect(), t) + if (t.start && t.end) + this.dispatch({ + type: "CHANGE_VIEW_TYPE", + viewType: e + }), this.dispatch({ + type: "SET_OPTION", + optionName: "visibleRange", + rawOptionValue: t + }); + else { + let { dateEnv: n } = this.getCurrentData(); + this.dispatch({ + type: "CHANGE_VIEW_TYPE", + viewType: e, + dateMarker: n.createMarker(t) + }); + } + else + this.dispatch({ + type: "CHANGE_VIEW_TYPE", + viewType: e + }); + }); + } + // Forces navigation to a view for the given date. + // `viewType` can be a specific view name or a generic one like "week" or "day". + // needs to change + zoomTo(e, t) { + let n = this.getCurrentData(), i; + t = t || "day", i = n.viewSpecs[t] || this.getUnitViewSpec(t), this.unselect(), i ? this.dispatch({ + type: "CHANGE_VIEW_TYPE", + viewType: i.type, + dateMarker: e + }) : this.dispatch({ + type: "CHANGE_DATE", + dateMarker: e + }); + } + // Given a duration singular unit, like "week" or "day", finds a matching view spec. + // Preference is given to views that have corresponding buttons. + getUnitViewSpec(e) { + let { viewSpecs: t, toolbarConfig: n } = this.getCurrentData(), i = [].concat(n.header ? n.header.viewsWithButtons : [], n.footer ? n.footer.viewsWithButtons : []), a, o; + for (let s in t) + i.push(s); + for (a = 0; a < i.length; a += 1) + if (o = t[i[a]], o && o.singleUnit === e) + return o; + return null; + } + // Current Date + // ----------------------------------------------------------------------------------------------------------------- + prev() { + this.unselect(), this.dispatch({ type: "PREV" }); + } + next() { + this.unselect(), this.dispatch({ type: "NEXT" }); + } + prevYear() { + let e = this.getCurrentData(); + this.unselect(), this.dispatch({ + type: "CHANGE_DATE", + dateMarker: e.dateEnv.addYears(e.currentDate, -1) + }); + } + nextYear() { + let e = this.getCurrentData(); + this.unselect(), this.dispatch({ + type: "CHANGE_DATE", + dateMarker: e.dateEnv.addYears(e.currentDate, 1) + }); + } + today() { + let e = this.getCurrentData(); + this.unselect(), this.dispatch({ + type: "CHANGE_DATE", + dateMarker: bm(e.calendarOptions.now, e.dateEnv) + }); + } + gotoDate(e) { + let t = this.getCurrentData(); + this.unselect(), this.dispatch({ + type: "CHANGE_DATE", + dateMarker: t.dateEnv.createMarker(e) + }); + } + incrementDate(e) { + let t = this.getCurrentData(), n = Xr(e); + n && (this.unselect(), this.dispatch({ + type: "CHANGE_DATE", + dateMarker: t.dateEnv.add(t.currentDate, n) + })); + } + getDate() { + let e = this.getCurrentData(); + return e.dateEnv.toDate(e.currentDate); + } + // Date Formatting Utils + // ----------------------------------------------------------------------------------------------------------------- + formatDate(e, t) { + let { dateEnv: n } = this.getCurrentData(); + return n.format(n.createMarker(e), jn(t)); + } + // `settings` is for formatter AND isEndExclusive + formatRange(e, t, n) { + let { dateEnv: i } = this.getCurrentData(); + return i.formatRange(i.createMarker(e), i.createMarker(t), jn(n), n); + } + formatIso(e, t) { + let { dateEnv: n } = this.getCurrentData(); + return n.formatIso(n.createMarker(e), { omitTime: t }); + } + // Date Selection / Event Selection / DayClick + // ----------------------------------------------------------------------------------------------------------------- + select(e, t) { + let n; + t == null ? e.start != null ? n = e : n = { + start: e, + end: null + } : n = { + start: e, + end: t + }; + let i = this.getCurrentData(), a = Wbe(n, i.dateEnv, Xr({ days: 1 })); + a && (this.dispatch({ type: "SELECT_DATES", selection: a }), AG(a, null, i)); + } + unselect(e) { + let t = this.getCurrentData(); + t.dateSelection && (this.dispatch({ type: "UNSELECT_DATES" }), Nbe(e, t)); + } + // Public Events API + // ----------------------------------------------------------------------------------------------------------------- + addEvent(e, t) { + if (e instanceof Gn) { + let o = e._def, s = e._instance; + return this.getCurrentData().eventStore.defs[o.defId] || (this.dispatch({ + type: "ADD_EVENTS", + eventStore: qT({ def: o, instance: s }) + // TODO: better util for two args? + }), this.triggerEventAdd(e)), e; + } + let n = this.getCurrentData(), i; + if (t instanceof cd) + i = t.internalEventSource; + else if (typeof t == "boolean") + t && ([i] = eM(n.eventSources)); + else if (t != null) { + let o = this.getEventSourceById(t); + if (!o) + return console.warn(`Could not find an event source with ID "${t}"`), null; + i = o.internalEventSource; + } + let a = yG(e, i, n, !1); + if (a) { + let o = new Gn(n, a.def, a.def.recurringDef ? null : a.instance); + return this.dispatch({ + type: "ADD_EVENTS", + eventStore: qT(a) + }), this.triggerEventAdd(o), o; + } + return null; + } + triggerEventAdd(e) { + let { emitter: t } = this.getCurrentData(); + t.trigger("eventAdd", { + event: e, + relatedEvents: [], + revert: () => { + this.dispatch({ + type: "REMOVE_EVENTS", + eventStore: EG(e) + }); + } + }); + } + // TODO: optimize + getEventById(e) { + let t = this.getCurrentData(), { defs: n, instances: i } = t.eventStore; + e = String(e); + for (let a in n) { + let o = n[a]; + if (o.publicId === e) { + if (o.recurringDef) + return new Gn(t, o, null); + for (let s in i) { + let l = i[s]; + if (l.defId === o.defId) + return new Gn(t, o, l); + } + } + } + return null; + } + getEvents() { + let e = this.getCurrentData(); + return $h(e.eventStore, e); + } + removeAllEvents() { + this.dispatch({ type: "REMOVE_ALL_EVENTS" }); + } + // Public Event Sources API + // ----------------------------------------------------------------------------------------------------------------- + getEventSources() { + let e = this.getCurrentData(), t = e.eventSources, n = []; + for (let i in t) + n.push(new cd(e, t[i])); + return n; + } + getEventSourceById(e) { + let t = this.getCurrentData(), n = t.eventSources; + e = String(e); + for (let i in n) + if (n[i].publicId === e) + return new cd(t, n[i]); + return null; + } + addEventSource(e) { + let t = this.getCurrentData(); + if (e instanceof cd) + return t.eventSources[e.internalEventSource.sourceId] || this.dispatch({ + type: "ADD_EVENT_SOURCES", + sources: [e.internalEventSource] + }), e; + let n = aU(e, t); + return n ? (this.dispatch({ type: "ADD_EVENT_SOURCES", sources: [n] }), new cd(t, n)) : null; + } + removeAllEventSources() { + this.dispatch({ type: "REMOVE_ALL_EVENT_SOURCES" }); + } + refetchEvents() { + this.dispatch({ type: "FETCH_EVENT_SOURCES", isRefetch: !0 }); + } + // Scroll + // ----------------------------------------------------------------------------------------------------------------- + scrollToTime(e) { + let t = Xr(e); + t && this.trigger("_scrollRequest", { time: t }); + } +} +class eSe { + constructor() { + this.handlers = []; + } + set(e) { + this.currentValue = e; + for (let t of this.handlers) + t(e); + } + subscribe(e) { + this.handlers.push(e), this.currentValue !== void 0 && e(this.currentValue); + } +} +class tSe extends eSe { + constructor() { + super(...arguments), this.map = /* @__PURE__ */ new Map(); + } + // for consistent order + handle(e) { + const { map: t } = this; + let n = !1; + e.isActive ? (t.set(e.id, e), n = !0) : t.has(e.id) && (t.delete(e.id), n = !0), n && this.set(t); + } +} +const rSe = [], sU = { + code: "en", + week: { + dow: 0, + doy: 4 + // 4 days need to be within the year to be considered the first week + }, + direction: "ltr", + buttonText: { + prev: "prev", + next: "next", + prevYear: "prev year", + nextYear: "next year", + year: "year", + today: "today", + month: "month", + week: "week", + day: "day", + list: "list" + }, + weekText: "W", + weekTextLong: "Week", + closeHint: "Close", + timeHint: "Time", + eventHint: "Event", + allDayText: "all-day", + moreLinkText: "more", + noEventsText: "No events to display" +}, lU = Object.assign(Object.assign({}, sU), { + // Includes things we don't want other locales to inherit, + // things that derive from other translatable strings. + buttonHints: { + prev: "Previous $0", + next: "Next $0", + today(r, e) { + return e === "day" ? "Today" : `This ${r}`; + } + }, + viewHint: "$0 view", + navLinkHint: "Go to $0", + moreLinkHint(r) { + return `Show ${r} more event${r === 1 ? "" : "s"}`; + } +}); +function nSe(r) { + let e = r.length > 0 ? r[0].code : "en", t = rSe.concat(r), n = { + en: lU + }; + for (let i of t) + n[i.code] = i; + return { + map: n, + defaultCode: e + }; +} +function uU(r, e) { + return typeof r == "object" && !Array.isArray(r) ? cU(r.code, [r.code], r) : iSe(r, e); +} +function iSe(r, e) { + let t = [].concat(r || []), n = aSe(t, e) || lU; + return cU(r, t, n); +} +function aSe(r, e) { + for (let t = 0; t < r.length; t += 1) { + let n = r[t].toLocaleLowerCase().split("-"); + for (let i = n.length; i > 0; i -= 1) { + let a = n.slice(0, i).join("-"); + if (e[a]) + return e[a]; + } + } + return null; +} +function cU(r, e, t) { + let n = qE([sU, t], ["buttonText"]); + delete n.code; + let { week: i } = n; + return delete n.week, { + codeArg: r, + codes: e, + week: i, + simpleNumberFormat: new Intl.NumberFormat(r), + options: n + }; +} +function Gs(r) { + return { + id: df(), + name: r.name, + premiumReleaseDate: r.premiumReleaseDate ? new Date(r.premiumReleaseDate) : void 0, + deps: r.deps || [], + reducers: r.reducers || [], + isLoadingFuncs: r.isLoadingFuncs || [], + contextInit: [].concat(r.contextInit || []), + eventRefiners: r.eventRefiners || {}, + eventDefMemberAdders: r.eventDefMemberAdders || [], + eventSourceRefiners: r.eventSourceRefiners || {}, + isDraggableTransformers: r.isDraggableTransformers || [], + eventDragMutationMassagers: r.eventDragMutationMassagers || [], + eventDefMutationAppliers: r.eventDefMutationAppliers || [], + dateSelectionTransformers: r.dateSelectionTransformers || [], + datePointTransforms: r.datePointTransforms || [], + dateSpanTransforms: r.dateSpanTransforms || [], + views: r.views || {}, + viewPropsTransformers: r.viewPropsTransformers || [], + isPropsValid: r.isPropsValid || null, + externalDefTransforms: r.externalDefTransforms || [], + viewContainerAppends: r.viewContainerAppends || [], + eventDropTransformers: r.eventDropTransformers || [], + componentInteractions: r.componentInteractions || [], + calendarInteractions: r.calendarInteractions || [], + themeClasses: r.themeClasses || {}, + eventSourceDefs: r.eventSourceDefs || [], + cmdFormatter: r.cmdFormatter, + recurringTypes: r.recurringTypes || [], + namedTimeZonedImpl: r.namedTimeZonedImpl, + initialView: r.initialView || "", + elementDraggingImpl: r.elementDraggingImpl, + optionChangeHandlers: r.optionChangeHandlers || {}, + scrollGridImpl: r.scrollGridImpl || null, + listenerRefiners: r.listenerRefiners || {}, + optionRefiners: r.optionRefiners || {}, + propSetHandlers: r.propSetHandlers || {} + }; +} +function oSe(r, e) { + let t = {}, n = { + premiumReleaseDate: void 0, + reducers: [], + isLoadingFuncs: [], + contextInit: [], + eventRefiners: {}, + eventDefMemberAdders: [], + eventSourceRefiners: {}, + isDraggableTransformers: [], + eventDragMutationMassagers: [], + eventDefMutationAppliers: [], + dateSelectionTransformers: [], + datePointTransforms: [], + dateSpanTransforms: [], + views: {}, + viewPropsTransformers: [], + isPropsValid: null, + externalDefTransforms: [], + viewContainerAppends: [], + eventDropTransformers: [], + componentInteractions: [], + calendarInteractions: [], + themeClasses: {}, + eventSourceDefs: [], + cmdFormatter: null, + recurringTypes: [], + namedTimeZonedImpl: null, + initialView: "", + elementDraggingImpl: null, + optionChangeHandlers: {}, + scrollGridImpl: null, + listenerRefiners: {}, + optionRefiners: {}, + propSetHandlers: {} + }; + function i(a) { + for (let o of a) { + const s = o.name, l = t[s]; + l === void 0 ? (t[s] = o.id, i(o.deps), n = lSe(n, o)) : l !== o.id && console.warn(`Duplicate plugin '${s}'`); + } + } + return r && i(r), i(e), n; +} +function sSe() { + let r = [], e = [], t; + return (n, i) => ((!t || !_c(n, r) || !_c(i, e)) && (t = oSe(n, i)), r = n, e = i, t); +} +function lSe(r, e) { + return { + premiumReleaseDate: uSe(r.premiumReleaseDate, e.premiumReleaseDate), + reducers: r.reducers.concat(e.reducers), + isLoadingFuncs: r.isLoadingFuncs.concat(e.isLoadingFuncs), + contextInit: r.contextInit.concat(e.contextInit), + eventRefiners: Object.assign(Object.assign({}, r.eventRefiners), e.eventRefiners), + eventDefMemberAdders: r.eventDefMemberAdders.concat(e.eventDefMemberAdders), + eventSourceRefiners: Object.assign(Object.assign({}, r.eventSourceRefiners), e.eventSourceRefiners), + isDraggableTransformers: r.isDraggableTransformers.concat(e.isDraggableTransformers), + eventDragMutationMassagers: r.eventDragMutationMassagers.concat(e.eventDragMutationMassagers), + eventDefMutationAppliers: r.eventDefMutationAppliers.concat(e.eventDefMutationAppliers), + dateSelectionTransformers: r.dateSelectionTransformers.concat(e.dateSelectionTransformers), + datePointTransforms: r.datePointTransforms.concat(e.datePointTransforms), + dateSpanTransforms: r.dateSpanTransforms.concat(e.dateSpanTransforms), + views: Object.assign(Object.assign({}, r.views), e.views), + viewPropsTransformers: r.viewPropsTransformers.concat(e.viewPropsTransformers), + isPropsValid: e.isPropsValid || r.isPropsValid, + externalDefTransforms: r.externalDefTransforms.concat(e.externalDefTransforms), + viewContainerAppends: r.viewContainerAppends.concat(e.viewContainerAppends), + eventDropTransformers: r.eventDropTransformers.concat(e.eventDropTransformers), + calendarInteractions: r.calendarInteractions.concat(e.calendarInteractions), + componentInteractions: r.componentInteractions.concat(e.componentInteractions), + themeClasses: Object.assign(Object.assign({}, r.themeClasses), e.themeClasses), + eventSourceDefs: r.eventSourceDefs.concat(e.eventSourceDefs), + cmdFormatter: e.cmdFormatter || r.cmdFormatter, + recurringTypes: r.recurringTypes.concat(e.recurringTypes), + namedTimeZonedImpl: e.namedTimeZonedImpl || r.namedTimeZonedImpl, + initialView: r.initialView || e.initialView, + elementDraggingImpl: r.elementDraggingImpl || e.elementDraggingImpl, + optionChangeHandlers: Object.assign(Object.assign({}, r.optionChangeHandlers), e.optionChangeHandlers), + scrollGridImpl: e.scrollGridImpl || r.scrollGridImpl, + listenerRefiners: Object.assign(Object.assign({}, r.listenerRefiners), e.listenerRefiners), + optionRefiners: Object.assign(Object.assign({}, r.optionRefiners), e.optionRefiners), + propSetHandlers: Object.assign(Object.assign({}, r.propSetHandlers), e.propSetHandlers) + }; +} +function uSe(r, e) { + return r === void 0 ? e : e === void 0 ? r : new Date(Math.max(r.valueOf(), e.valueOf())); +} +class Ac extends _m { +} +Ac.prototype.classes = { + root: "fc-theme-standard", + tableCellShaded: "fc-cell-shaded", + buttonGroup: "fc-button-group", + button: "fc-button fc-button-primary", + buttonActive: "fc-button-active" +}; +Ac.prototype.baseIconClass = "fc-icon"; +Ac.prototype.iconClasses = { + close: "fc-icon-x", + prev: "fc-icon-chevron-left", + next: "fc-icon-chevron-right", + prevYear: "fc-icon-chevrons-left", + nextYear: "fc-icon-chevrons-right" +}; +Ac.prototype.rtlIconClasses = { + prev: "fc-icon-chevron-right", + next: "fc-icon-chevron-left", + prevYear: "fc-icon-chevrons-right", + nextYear: "fc-icon-chevrons-left" +}; +Ac.prototype.iconOverrideOption = "buttonIcons"; +Ac.prototype.iconOverrideCustomButtonOption = "icon"; +Ac.prototype.iconOverridePrefix = "fc-icon-"; +function cSe(r, e) { + let t = {}, n; + for (n in r) + oI(n, t, r, e); + for (n in e) + oI(n, t, r, e); + return t; +} +function oI(r, e, t, n) { + if (e[r]) + return e[r]; + let i = hSe(r, e, t, n); + return i && (e[r] = i), i; +} +function hSe(r, e, t, n) { + let i = t[r], a = n[r], o = (c) => i && i[c] !== null ? i[c] : a && a[c] !== null ? a[c] : null, s = o("component"), l = o("superType"), u = null; + if (l) { + if (l === r) + throw new Error("Can't have a custom view type that references itself"); + u = oI(l, e, t, n); + } + return !s && u && (s = u.component), s ? { + type: r, + component: s, + defaults: Object.assign(Object.assign({}, u ? u.defaults : {}), i ? i.rawOptions : {}), + overrides: Object.assign(Object.assign({}, u ? u.overrides : {}), a ? a.rawOptions : {}) + } : null; +} +function Rz(r) { + return su(r, fSe); +} +function fSe(r) { + let e = typeof r == "function" ? { component: r } : r, { component: t } = e; + return e.content ? t = Nz(e) : t && !(t.prototype instanceof un) && (t = Nz(Object.assign(Object.assign({}, e), { content: t }))), { + superType: e.type, + component: t, + rawOptions: e + // includes type and component too :( + }; +} +function Nz(r) { + return (e) => me(fu.Consumer, null, (t) => me(ma, { elTag: "div", elClasses: iU(t.viewSpec), renderProps: Object.assign(Object.assign({}, e), { nextDayThreshold: t.options.nextDayThreshold }), generatorName: void 0, customGenerator: r.content, classNameGenerator: r.classNames, didMount: r.didMount, willUnmount: r.willUnmount })); +} +function dSe(r, e, t, n) { + let i = Rz(r), a = Rz(e.views), o = cSe(i, a); + return su(o, (s) => vSe(s, a, e, t, n)); +} +function vSe(r, e, t, n, i) { + let a = r.overrides.duration || r.defaults.duration || n.duration || t.duration, o = null, s = "", l = "", u = {}; + if (a && (o = pSe(a), o)) { + let f = KT(o); + s = f.unit, f.value === 1 && (l = s, u = e[s] ? e[s].rawOptions : {}); + } + let c = (f) => { + let v = f.buttonText || {}, b = r.defaults.buttonTextKey; + return b != null && v[b] != null ? v[b] : v[r.type] != null ? v[r.type] : v[l] != null ? v[l] : null; + }, h = (f) => { + let v = f.buttonHints || {}, b = r.defaults.buttonTextKey; + return b != null && v[b] != null ? v[b] : v[r.type] != null ? v[r.type] : v[l] != null ? v[l] : null; + }; + return { + type: r.type, + component: r.component, + duration: o, + durationUnit: s, + singleUnit: l, + optionDefaults: r.defaults, + optionOverrides: Object.assign(Object.assign({}, u), r.overrides), + buttonTextOverride: c(n) || c(t) || // constructor-specified buttonText lookup hash takes precedence + r.overrides.buttonText, + buttonTextDefault: c(i) || r.defaults.buttonText || c(tg) || r.type, + // not DRY + buttonTitleOverride: h(n) || h(t) || r.overrides.buttonHint, + buttonTitleDefault: h(i) || r.defaults.buttonHint || h(tg) + // will eventually fall back to buttonText + }; +} +let zz = {}; +function pSe(r) { + let e = JSON.stringify(r), t = zz[e]; + return t === void 0 && (t = Xr(r), zz[e] = t), t; +} +function gSe(r, e) { + switch (e.type) { + case "CHANGE_VIEW_TYPE": + r = e.viewType; + } + return r; +} +function mSe(r, e) { + switch (e.type) { + case "SET_OPTION": + return Object.assign(Object.assign({}, r), { [e.optionName]: e.rawOptionValue }); + default: + return r; + } +} +function ySe(r, e, t, n) { + let i; + switch (e.type) { + case "CHANGE_VIEW_TYPE": + return n.build(e.dateMarker || t); + case "CHANGE_DATE": + return n.build(e.dateMarker); + case "PREV": + if (i = n.buildPrev(r, t), i.isValid) + return i; + break; + case "NEXT": + if (i = n.buildNext(r, t), i.isValid) + return i; + break; + } + return r; +} +function _Se(r, e, t) { + let n = e ? e.activeRange : null; + return fU({}, ISe(r, t), n, t); +} +function bSe(r, e, t, n) { + let i = t ? t.activeRange : null; + switch (e.type) { + case "ADD_EVENT_SOURCES": + return fU(r, e.sources, i, n); + case "REMOVE_EVENT_SOURCE": + return SSe(r, e.sourceId); + case "PREV": + case "NEXT": + case "CHANGE_DATE": + case "CHANGE_VIEW_TYPE": + return t ? dU(r, i, n) : r; + case "FETCH_EVENT_SOURCES": + return TM(r, e.sourceIds ? ( + // why no type? + dG(e.sourceIds) + ) : vU(r, n), i, e.isRefetch || !1, n); + case "RECEIVE_EVENTS": + case "RECEIVE_EVENT_ERROR": + return TSe(r, e.sourceId, e.fetchId, e.fetchRange); + case "REMOVE_ALL_EVENT_SOURCES": + return {}; + default: + return r; + } +} +function xSe(r, e, t) { + let n = e ? e.activeRange : null; + return TM(r, vU(r, t), n, !0, t); +} +function hU(r) { + for (let e in r) + if (r[e].isFetching) + return !0; + return !1; +} +function fU(r, e, t, n) { + let i = {}; + for (let a of e) + i[a.sourceId] = a; + return t && (i = dU(i, t, n)), Object.assign(Object.assign({}, r), i); +} +function SSe(r, e) { + return ef(r, (t) => t.sourceId !== e); +} +function dU(r, e, t) { + return TM(r, ef(r, (n) => wSe(n, e, t)), e, !1, t); +} +function wSe(r, e, t) { + return pU(r, t) ? !t.options.lazyFetching || !r.fetchRange || r.isFetching || // always cancel outdated in-progress fetches + e.start < r.fetchRange.start || e.end > r.fetchRange.end : !r.latestFetchId; +} +function TM(r, e, t, n, i) { + let a = {}; + for (let o in r) { + let s = r[o]; + e[o] ? a[o] = CSe(s, t, n, i) : a[o] = s; + } + return a; +} +function CSe(r, e, t, n) { + let { options: i, calendarApi: a } = n, o = n.pluginHooks.eventSourceDefs[r.sourceDefId], s = df(); + return o.fetch({ + eventSource: r, + range: e, + isRefetch: t, + context: n + }, (l) => { + let { rawEvents: u } = l; + i.eventSourceSuccess && (u = i.eventSourceSuccess.call(a, u, l.response) || u), r.success && (u = r.success.call(a, u, l.response) || u), n.dispatch({ + type: "RECEIVE_EVENTS", + sourceId: r.sourceId, + fetchId: s, + fetchRange: e, + rawEvents: u + }); + }, (l) => { + let u = !1; + i.eventSourceFailure && (i.eventSourceFailure.call(a, l), u = !0), r.failure && (r.failure(l), u = !0), u || console.warn(l.message, l), n.dispatch({ + type: "RECEIVE_EVENT_ERROR", + sourceId: r.sourceId, + fetchId: s, + fetchRange: e, + error: l + }); + }), Object.assign(Object.assign({}, r), { isFetching: !0, latestFetchId: s }); +} +function TSe(r, e, t, n) { + let i = r[e]; + return i && // not already removed + t === i.latestFetchId ? Object.assign(Object.assign({}, r), { [e]: Object.assign(Object.assign({}, i), { isFetching: !1, fetchRange: n }) }) : r; +} +function vU(r, e) { + return ef(r, (t) => pU(t, e)); +} +function ISe(r, e) { + let t = oU(e), n = [].concat(r.eventSources || []), i = []; + r.initialEvents && n.unshift(r.initialEvents), r.events && n.unshift(r.events); + for (let a of n) { + let o = aU(a, e, t); + o && i.push(o); + } + return i; +} +function pU(r, e) { + return !e.pluginHooks.eventSourceDefs[r.sourceDefId].ignoreRange; +} +function ASe(r, e) { + switch (e.type) { + case "UNSELECT_DATES": + return null; + case "SELECT_DATES": + return e.selection; + default: + return r; + } +} +function ESe(r, e) { + switch (e.type) { + case "UNSELECT_EVENT": + return ""; + case "SELECT_EVENT": + return e.eventInstanceId; + default: + return r; + } +} +function MSe(r, e) { + let t; + switch (e.type) { + case "UNSET_EVENT_DRAG": + return null; + case "SET_EVENT_DRAG": + return t = e.state, { + affectedEvents: t.affectedEvents, + mutatedEvents: t.mutatedEvents, + isEvent: t.isEvent + }; + default: + return r; + } +} +function DSe(r, e) { + let t; + switch (e.type) { + case "UNSET_EVENT_RESIZE": + return null; + case "SET_EVENT_RESIZE": + return t = e.state, { + affectedEvents: t.affectedEvents, + mutatedEvents: t.mutatedEvents, + isEvent: t.isEvent + }; + default: + return r; + } +} +function kSe(r, e, t, n, i) { + let a = r.headerToolbar ? Bz(r.headerToolbar, r, e, t, n, i) : null, o = r.footerToolbar ? Bz(r.footerToolbar, r, e, t, n, i) : null; + return { header: a, footer: o }; +} +function Bz(r, e, t, n, i, a) { + let o = {}, s = [], l = !1; + for (let u in r) { + let c = r[u], h = OSe(c, e, t, n, i, a); + o[u] = h.widgets, s.push(...h.viewsWithButtons), l = l || h.hasTitle; + } + return { sectionWidgets: o, viewsWithButtons: s, hasTitle: l }; +} +function OSe(r, e, t, n, i, a) { + let o = e.direction === "rtl", s = e.customButtons || {}, l = t.buttonText || {}, u = e.buttonText || {}, c = t.buttonHints || {}, h = e.buttonHints || {}, f = r ? r.split(" ") : [], v = [], b = !1; + return { widgets: f.map((p) => p.split(",").map((d) => { + if (d === "title") + return b = !0, { buttonName: d }; + let m, _, y, x, g, S; + if (m = s[d]) + y = (T) => { + m.click && m.click.call(T.target, T, T.target); + }, (x = n.getCustomButtonIconClass(m)) || (x = n.getIconClass(d, o)) || (g = m.text), S = m.hint || m.text; + else if (_ = i[d]) { + v.push(d), y = () => { + a.changeView(d); + }, (g = _.buttonTextOverride) || (x = n.getIconClass(d, o)) || (g = _.buttonTextDefault); + let T = _.buttonTextOverride || _.buttonTextDefault; + S = eg( + _.buttonTitleOverride || _.buttonTitleDefault || e.viewHint, + [T, d], + // view-name = buttonName + T + ); + } else if (a[d]) + if (y = () => { + a[d](); + }, (g = l[d]) || (x = n.getIconClass(d, o)) || (g = u[d]), d === "prevYear" || d === "nextYear") { + let T = d === "prevYear" ? "prev" : "next"; + S = eg(c[T] || h[T], [ + u.year || "year", + "year" + ], u[d]); + } else + S = (T) => eg(c[d] || h[d], [ + u[T] || T, + T + ], u[d]); + return { buttonName: d, buttonClick: y, buttonIcon: x, buttonText: g, buttonHint: S }; + })), viewsWithButtons: v, hasTitle: b }; +} +class LSe { + constructor(e, t, n) { + this.type = e, this.getCurrentData = t, this.dateEnv = n; + } + get calendar() { + return this.getCurrentData().calendarApi; + } + get title() { + return this.getCurrentData().viewTitle; + } + get activeStart() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start); + } + get activeEnd() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end); + } + get currentStart() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start); + } + get currentEnd() { + return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end); + } + getOption(e) { + return this.getCurrentData().options[e]; + } +} +let PSe = { + ignoreRange: !0, + parseMeta(r) { + return Array.isArray(r.events) ? r.events : null; + }, + fetch(r, e) { + e({ + rawEvents: r.eventSource.meta + }); + } +}; +const RSe = Gs({ + name: "array-event-source", + eventSourceDefs: [PSe] +}); +let NSe = { + parseMeta(r) { + return typeof r.events == "function" ? r.events : null; + }, + fetch(r, e, t) { + const { dateEnv: n } = r.context, i = r.eventSource.meta; + Cbe(i.bind(null, kG(r.range, n)), (a) => e({ rawEvents: a }), t); + } +}; +const zSe = Gs({ + name: "func-event-source", + eventSourceDefs: [NSe] +}), BSe = { + method: String, + extraParams: $e, + startParam: String, + endParam: String, + timeZoneParam: String +}; +let jSe = { + parseMeta(r) { + return r.url && (r.format === "json" || !r.format) ? { + url: r.url, + format: "json", + method: (r.method || "GET").toUpperCase(), + extraParams: r.extraParams, + startParam: r.startParam, + endParam: r.endParam, + timeZoneParam: r.timeZoneParam + } : null; + }, + fetch(r, e, t) { + const { meta: n } = r.eventSource, i = $Se(n, r.range, r.context); + Mxe(n.method, n.url, i).then(([a, o]) => { + e({ rawEvents: a, response: o }); + }, t); + } +}; +const FSe = Gs({ + name: "json-event-source", + eventSourceRefiners: BSe, + eventSourceDefs: [jSe] +}); +function $Se(r, e, t) { + let { dateEnv: n, options: i } = t, a, o, s, l, u = {}; + return a = r.startParam, a == null && (a = i.startParam), o = r.endParam, o == null && (o = i.endParam), s = r.timeZoneParam, s == null && (s = i.timeZoneParam), typeof r.extraParams == "function" ? l = r.extraParams() : l = r.extraParams || {}, Object.assign(u, l), u[a] = n.formatIso(e.start), u[o] = n.formatIso(e.end), n.timeZone !== "local" && (u[s] = n.timeZone), u; +} +const HSe = { + daysOfWeek: $e, + startTime: Xr, + endTime: Xr, + duration: Xr, + startRecur: $e, + endRecur: $e +}; +let VSe = { + parse(r, e) { + if (r.daysOfWeek || r.startTime || r.endTime || r.startRecur || r.endRecur) { + let t = { + daysOfWeek: r.daysOfWeek || null, + startTime: r.startTime || null, + endTime: r.endTime || null, + startRecur: r.startRecur ? e.createMarker(r.startRecur) : null, + endRecur: r.endRecur ? e.createMarker(r.endRecur) : null + }, n; + return r.duration && (n = r.duration), !n && r.startTime && r.endTime && (n = o_e(r.endTime, r.startTime)), { + allDayGuess: !r.startTime && !r.endTime, + duration: n, + typeData: t + // doesn't need endTime anymore but oh well + }; + } + return null; + }, + expand(r, e, t) { + let n = xc(e, { start: r.startRecur, end: r.endRecur }); + return n ? USe(r.daysOfWeek, r.startTime, n, t) : []; + } +}; +const GSe = Gs({ + name: "simple-recurring-event", + recurringTypes: [VSe], + eventRefiners: HSe +}); +function USe(r, e, t, n) { + let i = r ? dG(r) : null, a = kn(t.start), o = t.end, s = []; + for (; a < o; ) { + let l; + (!i || i[a.getUTCDay()]) && (e ? l = n.add(a, e) : l = a, s.push(l)), a = Bi(a, 1); + } + return s; +} +const WSe = Gs({ + name: "change-handler", + optionChangeHandlers: { + events(r, e) { + jz([r], e); + }, + eventSources: jz + } +}); +function jz(r, e) { + let t = eM(e.getCurrentData().eventSources); + if (t.length === 1 && r.length === 1 && Array.isArray(t[0]._raw) && Array.isArray(r[0])) { + e.dispatch({ + type: "RESET_RAW_EVENTS", + sourceId: t[0].sourceId, + rawEvents: r[0] + }); + return; + } + let n = []; + for (let i of r) { + let a = !1; + for (let o = 0; o < t.length; o += 1) + if (t[o]._raw === i) { + t.splice(o, 1), a = !0; + break; + } + a || n.push(i); + } + for (let i of t) + e.dispatch({ + type: "REMOVE_EVENT_SOURCE", + sourceId: i.sourceId + }); + for (let i of n) + e.calendarApi.addEventSource(i); +} +function YSe(r, e) { + e.emitter.trigger("datesSet", Object.assign(Object.assign({}, kG(r.activeRange, e.dateEnv)), { view: e.viewApi })); +} +function XSe(r, e) { + let { emitter: t } = e; + t.hasHandlers("eventsSet") && t.trigger("eventsSet", $h(r, e)); +} +const ZSe = [ + RSe, + zSe, + FSe, + GSe, + WSe, + Gs({ + name: "misc", + isLoadingFuncs: [ + (r) => hU(r.eventSources) + ], + propSetHandlers: { + dateProfile: YSe, + eventStore: XSe + } + }) +]; +class JSe { + constructor(e, t) { + this.runTaskOption = e, this.drainedOption = t, this.queue = [], this.delayedRunner = new bM(this.drain.bind(this)); + } + request(e, t) { + this.queue.push(e), this.delayedRunner.request(t); + } + pause(e) { + this.delayedRunner.pause(e); + } + resume(e, t) { + this.delayedRunner.resume(e, t); + } + drain() { + let { queue: e } = this; + for (; e.length; ) { + let t = [], n; + for (; n = e.shift(); ) + this.runTask(n), t.push(n); + this.drained(t); + } + } + runTask(e) { + this.runTaskOption && this.runTaskOption(e); + } + drained(e) { + this.drainedOption && this.drainedOption(e); + } +} +function KSe(r, e, t) { + let n; + return /^(year|month)$/.test(r.currentRangeUnit) ? n = r.currentRange : n = r.activeRange, t.formatRange(n.start, n.end, jn(e.titleFormat || QSe(r)), { + isEndExclusive: r.isRangeAllDay, + defaultSeparator: e.titleRangeSeparator + }); +} +function QSe(r) { + let { currentRangeUnit: e } = r; + if (e === "year") + return { year: "numeric" }; + if (e === "month") + return { year: "numeric", month: "long" }; + let t = ub(r.currentRange.start, r.currentRange.end); + return t !== null && t > 1 ? { year: "numeric", month: "short", day: "numeric" } : { year: "numeric", month: "long", day: "numeric" }; +} +class qSe { + constructor(e) { + this.computeCurrentViewData = rr(this._computeCurrentViewData), this.organizeRawLocales = rr(nSe), this.buildLocale = rr(uU), this.buildPluginHooks = sSe(), this.buildDateEnv = rr(ewe), this.buildTheme = rr(twe), this.parseToolbars = rr(kSe), this.buildViewSpecs = rr(dSe), this.buildDateProfileGenerator = q0(rwe), this.buildViewApi = rr(nwe), this.buildViewUiProps = q0(owe), this.buildEventUiBySource = rr(iwe, El), this.buildEventUiBases = rr(awe), this.parseContextBusinessHours = q0(swe), this.buildTitle = rr(KSe), this.emitter = new Cx(), this.actionRunner = new JSe(this._handleAction.bind(this), this.updateData.bind(this)), this.currentCalendarOptionsInput = {}, this.currentCalendarOptionsRefined = {}, this.currentViewOptionsInput = {}, this.currentViewOptionsRefined = {}, this.currentCalendarOptionsRefiners = {}, this.optionsForRefining = [], this.optionsForHandling = [], this.getCurrentData = () => this.data, this.dispatch = (f) => { + this.actionRunner.request(f); + }, this.props = e, this.actionRunner.pause(); + let t = {}, n = this.computeOptionsData(e.optionOverrides, t, e.calendarApi), i = n.calendarOptions.initialView || n.pluginHooks.initialView, a = this.computeCurrentViewData(i, n, e.optionOverrides, t); + e.calendarApi.currentDataManager = this, this.emitter.setThisContext(e.calendarApi), this.emitter.setOptions(a.options); + let o = Rbe(n.calendarOptions, n.dateEnv), s = a.dateProfileGenerator.build(o); + Ql(s.activeRange, o) || (o = s.currentRange.start); + let l = { + dateEnv: n.dateEnv, + options: n.calendarOptions, + pluginHooks: n.pluginHooks, + calendarApi: e.calendarApi, + dispatch: this.dispatch, + emitter: this.emitter, + getCurrentData: this.getCurrentData + }; + for (let f of n.pluginHooks.contextInit) + f(l); + let u = _Se(n.calendarOptions, s, l), c = { + dynamicOptionOverrides: t, + currentViewType: i, + currentDate: o, + dateProfile: s, + businessHours: this.parseContextBusinessHours(l), + eventSources: u, + eventUiBases: {}, + eventStore: xo(), + renderableEventStore: xo(), + dateSelection: null, + eventSelection: "", + eventDrag: null, + eventResize: null, + selectionConfig: this.buildViewUiProps(l).selectionConfig + }, h = Object.assign(Object.assign({}, l), c); + for (let f of n.pluginHooks.reducers) + Object.assign(c, f(null, null, h)); + $C(c, l) && this.emitter.trigger("loading", !0), this.state = c, this.updateData(), this.actionRunner.resume(); + } + resetOptions(e, t) { + let { props: n } = this; + t === void 0 ? n.optionOverrides = e : (n.optionOverrides = Object.assign(Object.assign({}, n.optionOverrides || {}), e), this.optionsForRefining.push(...t)), (t === void 0 || t.length) && this.actionRunner.request({ + type: "NOTHING" + }); + } + _handleAction(e) { + let { props: t, state: n, emitter: i } = this, a = mSe(n.dynamicOptionOverrides, e), o = this.computeOptionsData(t.optionOverrides, a, t.calendarApi), s = gSe(n.currentViewType, e), l = this.computeCurrentViewData(s, o, t.optionOverrides, a); + t.calendarApi.currentDataManager = this, i.setThisContext(t.calendarApi), i.setOptions(l.options); + let u = { + dateEnv: o.dateEnv, + options: o.calendarOptions, + pluginHooks: o.pluginHooks, + calendarApi: t.calendarApi, + dispatch: this.dispatch, + emitter: i, + getCurrentData: this.getCurrentData + }, { currentDate: c, dateProfile: h } = n; + this.data && this.data.dateProfileGenerator !== l.dateProfileGenerator && (h = l.dateProfileGenerator.build(c)), c = Pbe(c, e), h = ySe(h, e, c, l.dateProfileGenerator), (e.type === "PREV" || // TODO: move this logic into DateProfileGenerator + e.type === "NEXT" || // " + !Ql(h.currentRange, c)) && (c = h.currentRange.start); + let f = bSe(n.eventSources, e, h, u), v = mxe(n.eventStore, e, f, h, u), w = hU(f) && !l.options.progressiveEventRendering && n.renderableEventStore || v, { eventUiSingleBase: p, selectionConfig: d } = this.buildViewUiProps(u), m = this.buildEventUiBySource(f), _ = this.buildEventUiBases(w.defs, p, m), y = { + dynamicOptionOverrides: a, + currentViewType: s, + currentDate: c, + dateProfile: h, + eventSources: f, + eventStore: v, + renderableEventStore: w, + selectionConfig: d, + eventUiBases: _, + businessHours: this.parseContextBusinessHours(u), + dateSelection: ASe(n.dateSelection, e), + eventSelection: ESe(n.eventSelection, e), + eventDrag: MSe(n.eventDrag, e), + eventResize: DSe(n.eventResize, e) + }, x = Object.assign(Object.assign({}, u), y); + for (let T of o.pluginHooks.reducers) + Object.assign(y, T(n, e, x)); + let g = $C(n, u), S = $C(y, u); + !g && S ? i.trigger("loading", !0) : g && !S && i.trigger("loading", !1), this.state = y, t.onAction && t.onAction(e); + } + updateData() { + let { props: e, state: t } = this, n = this.data, i = this.computeOptionsData(e.optionOverrides, t.dynamicOptionOverrides, e.calendarApi), a = this.computeCurrentViewData(t.currentViewType, i, e.optionOverrides, t.dynamicOptionOverrides), o = this.data = Object.assign(Object.assign(Object.assign({ viewTitle: this.buildTitle(t.dateProfile, a.options, i.dateEnv), calendarApi: e.calendarApi, dispatch: this.dispatch, emitter: this.emitter, getCurrentData: this.getCurrentData }, i), a), t), s = i.pluginHooks.optionChangeHandlers, l = n && n.calendarOptions, u = i.calendarOptions; + if (l && l !== u) { + l.timeZone !== u.timeZone && (t.eventSources = o.eventSources = xSe(o.eventSources, t.dateProfile, o), t.eventStore = o.eventStore = Oz(o.eventStore, n.dateEnv, o.dateEnv), t.renderableEventStore = o.renderableEventStore = Oz(o.renderableEventStore, n.dateEnv, o.dateEnv)); + for (let c in s) + (this.optionsForHandling.indexOf(c) !== -1 || l[c] !== u[c]) && s[c](u[c], o); + } + this.optionsForHandling = [], e.onData && e.onData(o); + } + computeOptionsData(e, t, n) { + if (!this.optionsForRefining.length && e === this.stableOptionOverrides && t === this.stableDynamicOptionOverrides) + return this.stableCalendarOptionsData; + let { refinedOptions: i, pluginHooks: a, localeDefaults: o, availableLocaleData: s, extra: l } = this.processRawCalendarOptions(e, t); + Fz(l); + let u = this.buildDateEnv(i.timeZone, i.locale, i.weekNumberCalculation, i.firstDay, i.weekText, a, s, i.defaultRangeSeparator), c = this.buildViewSpecs(a.views, this.stableOptionOverrides, this.stableDynamicOptionOverrides, o), h = this.buildTheme(i, a), f = this.parseToolbars(i, this.stableOptionOverrides, h, c, n); + return this.stableCalendarOptionsData = { + calendarOptions: i, + pluginHooks: a, + dateEnv: u, + viewSpecs: c, + theme: h, + toolbarConfig: f, + localeDefaults: o, + availableRawLocales: s.map + }; + } + // always called from behind a memoizer + processRawCalendarOptions(e, t) { + let { locales: n, locale: i } = LC([ + tg, + e, + t + ]), a = this.organizeRawLocales(n), o = a.map, s = this.buildLocale(i || a.defaultCode, o).options, l = this.buildPluginHooks(e.plugins || [], ZSe), u = this.currentCalendarOptionsRefiners = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Sz), wz), Cz), l.listenerRefiners), l.optionRefiners), c = {}, h = LC([ + tg, + s, + e, + t + ]), f = {}, v = this.currentCalendarOptionsInput, b = this.currentCalendarOptionsRefined, w = !1; + for (let p in h) + this.optionsForRefining.indexOf(p) === -1 && (h[p] === v[p] || yh[p] && p in v && yh[p](v[p], h[p])) ? f[p] = b[p] : u[p] ? (f[p] = u[p](h[p]), w = !0) : c[p] = v[p]; + return w && (this.currentCalendarOptionsInput = h, this.currentCalendarOptionsRefined = f, this.stableOptionOverrides = e, this.stableDynamicOptionOverrides = t), this.optionsForHandling.push(...this.optionsForRefining), this.optionsForRefining = [], { + rawOptions: this.currentCalendarOptionsInput, + refinedOptions: this.currentCalendarOptionsRefined, + pluginHooks: l, + availableLocaleData: a, + localeDefaults: s, + extra: c + }; + } + _computeCurrentViewData(e, t, n, i) { + let a = t.viewSpecs[e]; + if (!a) + throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`); + let { refinedOptions: o, extra: s } = this.processRawViewOptions(a, t.pluginHooks, t.localeDefaults, n, i); + Fz(s); + let l = this.buildDateProfileGenerator({ + dateProfileGeneratorClass: a.optionDefaults.dateProfileGeneratorClass, + duration: a.duration, + durationUnit: a.durationUnit, + usesMinMaxTime: a.optionDefaults.usesMinMaxTime, + dateEnv: t.dateEnv, + calendarApi: this.props.calendarApi, + slotMinTime: o.slotMinTime, + slotMaxTime: o.slotMaxTime, + showNonCurrentDates: o.showNonCurrentDates, + dayCount: o.dayCount, + dateAlignment: o.dateAlignment, + dateIncrement: o.dateIncrement, + hiddenDays: o.hiddenDays, + weekends: o.weekends, + nowInput: o.now, + validRangeInput: o.validRange, + visibleRangeInput: o.visibleRange, + fixedWeekCount: o.fixedWeekCount + }), u = this.buildViewApi(e, this.getCurrentData, t.dateEnv); + return { viewSpec: a, options: o, dateProfileGenerator: l, viewApi: u }; + } + processRawViewOptions(e, t, n, i, a) { + let o = LC([ + tg, + e.optionDefaults, + n, + i, + e.optionOverrides, + a + ]), s = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Sz), wz), Cz), V_e), t.listenerRefiners), t.optionRefiners), l = {}, u = this.currentViewOptionsInput, c = this.currentViewOptionsRefined, h = !1, f = {}; + for (let v in o) + o[v] === u[v] || yh[v] && yh[v](o[v], u[v]) ? l[v] = c[v] : (o[v] === this.currentCalendarOptionsInput[v] || yh[v] && yh[v](o[v], this.currentCalendarOptionsInput[v]) ? v in this.currentCalendarOptionsRefined && (l[v] = this.currentCalendarOptionsRefined[v]) : s[v] ? l[v] = s[v](o[v]) : f[v] = o[v], h = !0); + return h && (this.currentViewOptionsInput = o, this.currentViewOptionsRefined = l), { + rawOptions: this.currentViewOptionsInput, + refinedOptions: this.currentViewOptionsRefined, + extra: f + }; + } +} +function ewe(r, e, t, n, i, a, o, s) { + let l = uU(e || o.defaultCode, o.map); + return new nxe({ + calendarSystem: "gregory", + timeZone: r, + namedTimeZoneImpl: a.namedTimeZonedImpl, + locale: l, + weekNumberCalculation: t, + firstDay: n, + weekText: i, + cmdFormatter: a.cmdFormatter, + defaultSeparator: s + }); +} +function twe(r, e) { + let t = e.themeClasses[r.themeSystem] || Ac; + return new t(r); +} +function rwe(r) { + let e = r.dateProfileGeneratorClass || IG; + return new e(r); +} +function nwe(r, e, t) { + return new LSe(r, e, t); +} +function iwe(r) { + return su(r, (e) => e.ui); +} +function awe(r, e, t) { + let n = { "": e }; + for (let i in r) { + let a = r[i]; + a.sourceId && t[a.sourceId] && (n[i] = t[a.sourceId]); + } + return n; +} +function owe(r) { + let { options: e } = r; + return { + eventUiSingleBase: db({ + display: e.eventDisplay, + editable: e.editable, + startEditable: e.eventStartEditable, + durationEditable: e.eventDurationEditable, + constraint: e.eventConstraint, + overlap: typeof e.eventOverlap == "boolean" ? e.eventOverlap : void 0, + allow: e.eventAllow, + backgroundColor: e.eventBackgroundColor, + borderColor: e.eventBorderColor, + textColor: e.eventTextColor, + color: e.eventColor + // classNames: options.eventClassNames // render hook will handle this + }, r), + selectionConfig: db({ + constraint: e.selectConstraint, + overlap: typeof e.selectOverlap == "boolean" ? e.selectOverlap : void 0, + allow: e.selectAllow + }, r) + }; +} +function $C(r, e) { + for (let t of e.pluginHooks.isLoadingFuncs) + if (t(r)) + return !0; + return !1; +} +function swe(r) { + return tbe(r.options.businessHours, r); +} +function Fz(r, e) { + for (let t in r) + console.warn(`Unknown option '${t}'` + (e ? ` for view '${e}'` : "")); +} +class lwe extends un { + render() { + let e = this.props.widgetGroups.map((t) => this.renderWidgetGroup(t)); + return me("div", { className: "fc-toolbar-chunk" }, ...e); + } + renderWidgetGroup(e) { + let { props: t } = this, { theme: n } = this.context, i = [], a = !0; + for (let o of e) { + let { buttonName: s, buttonClick: l, buttonText: u, buttonIcon: c, buttonHint: h } = o; + if (s === "title") + a = !1, i.push(me("h2", { className: "fc-toolbar-title", id: t.titleId }, t.title)); + else { + let f = s === t.activeButton, v = !t.isTodayEnabled && s === "today" || !t.isPrevEnabled && s === "prev" || !t.isNextEnabled && s === "next", b = [`fc-${s}-button`, n.getClass("button")]; + f && b.push(n.getClass("buttonActive")), i.push(me("button", { type: "button", title: typeof h == "function" ? h(t.navUnit) : h, disabled: v, "aria-pressed": f, className: b.join(" "), onClick: l }, u || (c ? me("span", { className: c }) : ""))); + } + } + if (i.length > 1) { + let o = a && n.getClass("buttonGroup") || ""; + return me("div", { className: o }, ...i); + } + return i[0]; + } +} +class $z extends un { + render() { + let { model: e, extraClassName: t } = this.props, n = !1, i, a, o = e.sectionWidgets, s = o.center; + return o.left ? (n = !0, i = o.left) : i = o.start, o.right ? (n = !0, a = o.right) : a = o.end, me( + "div", + { className: [ + t || "", + "fc-toolbar", + n ? "fc-toolbar-ltr" : "" + ].join(" ") }, + this.renderSection("start", i || []), + this.renderSection("center", s || []), + this.renderSection("end", a || []) + ); + } + renderSection(e, t) { + let { props: n } = this; + return me(lwe, { key: e, widgetGroups: t, title: n.title, navUnit: n.navUnit, activeButton: n.activeButton, isTodayEnabled: n.isTodayEnabled, isPrevEnabled: n.isPrevEnabled, isNextEnabled: n.isNextEnabled, titleId: n.titleId }); + } +} +class uwe extends un { + constructor() { + super(...arguments), this.state = { + availableWidth: null + }, this.handleEl = (e) => { + this.el = e, lu(this.props.elRef, e), this.updateAvailableWidth(); + }, this.handleResize = () => { + this.updateAvailableWidth(); + }; + } + render() { + let { props: e, state: t } = this, { aspectRatio: n } = e, i = [ + "fc-view-harness", + n || e.liquid || e.height ? "fc-view-harness-active" : "fc-view-harness-passive" + // let the view do the height + ], a = "", o = ""; + return n ? t.availableWidth !== null ? a = t.availableWidth / n : o = `${1 / n * 100}%` : a = e.height || "", me("div", { "aria-labelledby": e.labeledById, ref: this.handleEl, className: i.join(" "), style: { height: a, paddingBottom: o } }, e.children); + } + componentDidMount() { + this.context.addResizeHandler(this.handleResize); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleResize); + } + updateAvailableWidth() { + this.el && // needed. but why? + this.props.aspectRatio && this.setState({ availableWidth: this.el.offsetWidth }); + } +} +class cwe extends dv { + constructor(e) { + super(e), this.handleSegClick = (t, n) => { + let { component: i } = this, { context: a } = i, o = Wd(n); + if (o && // might be the
        surrounding the more link + i.isValidSegDownEl(t.target)) { + let s = da(t.target, ".fc-event-forced-url"), l = s ? s.querySelector("a[href]").href : ""; + a.emitter.trigger("eventClick", { + el: n, + event: new Gn(i.context, o.eventRange.def, o.eventRange.instance), + jsEvent: t, + view: a.viewApi + }), l && !t.defaultPrevented && (window.location.href = l); + } + }, this.destroy = cG( + e.el, + "click", + ".fc-event", + // on both fg and bg events + this.handleSegClick + ); + } +} +class hwe extends dv { + constructor(e) { + super(e), this.handleEventElRemove = (t) => { + t === this.currentSegEl && this.handleSegLeave(null, this.currentSegEl); + }, this.handleSegEnter = (t, n) => { + Wd(n) && (this.currentSegEl = n, this.triggerEvent("eventMouseEnter", t, n)); + }, this.handleSegLeave = (t, n) => { + this.currentSegEl && (this.currentSegEl = null, this.triggerEvent("eventMouseLeave", t, n)); + }, this.removeHoverListeners = U0e( + e.el, + ".fc-event", + // on both fg and bg events + this.handleSegEnter, + this.handleSegLeave + ); + } + destroy() { + this.removeHoverListeners(); + } + triggerEvent(e, t, n) { + let { component: i } = this, { context: a } = i, o = Wd(n); + (!t || i.isValidSegDownEl(t.target)) && a.emitter.trigger(e, { + el: n, + event: new Gn(a, o.eventRange.def, o.eventRange.instance), + jsEvent: t, + view: a.viewApi + }); + } +} +class fwe extends vf { + constructor() { + super(...arguments), this.buildViewContext = rr(kbe), this.buildViewPropTransformers = rr(vwe), this.buildToolbarProps = rr(dwe), this.headerRef = Da(), this.footerRef = Da(), this.interactionsStore = {}, this.state = { + viewLabelId: cc() + }, this.registerInteractiveComponent = (e, t) => { + let n = oxe(e, t), o = [ + cwe, + hwe + ].concat(this.props.pluginHooks.componentInteractions).map((s) => new s(n)); + this.interactionsStore[e.uid] = o, iI[e.uid] = n; + }, this.unregisterInteractiveComponent = (e) => { + let t = this.interactionsStore[e.uid]; + if (t) { + for (let n of t) + n.destroy(); + delete this.interactionsStore[e.uid]; + } + delete iI[e.uid]; + }, this.resizeRunner = new bM(() => { + this.props.emitter.trigger("_resize", !0), this.props.emitter.trigger("windowResize", { view: this.props.viewApi }); + }), this.handleWindowResize = (e) => { + let { options: t } = this.props; + t.handleWindowResize && e.target === window && this.resizeRunner.request(t.windowResizeDelay); + }; + } + /* + renders INSIDE of an outer div + */ + render() { + let { props: e } = this, { toolbarConfig: t, options: n } = e, i = this.buildToolbarProps( + e.viewSpec, + e.dateProfile, + e.dateProfileGenerator, + e.currentDate, + bm(e.options.now, e.dateEnv), + // TODO: use NowTimer???? + e.viewTitle + ), a = !1, o = "", s; + e.isHeightAuto || e.forPrint ? o = "" : n.height != null ? a = !0 : n.contentHeight != null ? o = n.contentHeight : s = Math.max(n.aspectRatio, 0.5); + let l = this.buildViewContext(e.viewSpec, e.viewApi, e.options, e.dateProfileGenerator, e.dateEnv, e.theme, e.pluginHooks, e.dispatch, e.getCurrentData, e.emitter, e.calendarApi, this.registerInteractiveComponent, this.unregisterInteractiveComponent), u = t.header && t.header.hasTitle ? this.state.viewLabelId : ""; + return me( + fu.Provider, + { value: l }, + t.header && me($z, Object.assign({ ref: this.headerRef, extraClassName: "fc-header-toolbar", model: t.header, titleId: u }, i)), + me( + uwe, + { liquid: a, height: o, aspectRatio: s, labeledById: u }, + this.renderView(e), + this.buildAppendContent() + ), + t.footer && me($z, Object.assign({ ref: this.footerRef, extraClassName: "fc-footer-toolbar", model: t.footer, titleId: "" }, i)) + ); + } + componentDidMount() { + let { props: e } = this; + this.calendarInteractions = e.pluginHooks.calendarInteractions.map((n) => new n(e)), window.addEventListener("resize", this.handleWindowResize); + let { propSetHandlers: t } = e.pluginHooks; + for (let n in t) + t[n](e[n], e); + } + componentDidUpdate(e) { + let { props: t } = this, { propSetHandlers: n } = t.pluginHooks; + for (let i in n) + t[i] !== e[i] && n[i](t[i], t); + } + componentWillUnmount() { + window.removeEventListener("resize", this.handleWindowResize), this.resizeRunner.clear(); + for (let e of this.calendarInteractions) + e.destroy(); + this.props.emitter.trigger("_unmount"); + } + buildAppendContent() { + let { props: e } = this, t = e.pluginHooks.viewContainerAppends.map((n) => n(e)); + return me(Dn, {}, ...t); + } + renderView(e) { + let { pluginHooks: t } = e, { viewSpec: n } = e, i = { + dateProfile: e.dateProfile, + businessHours: e.businessHours, + eventStore: e.renderableEventStore, + eventUiBases: e.eventUiBases, + dateSelection: e.dateSelection, + eventSelection: e.eventSelection, + eventDrag: e.eventDrag, + eventResize: e.eventResize, + isHeightAuto: e.isHeightAuto, + forPrint: e.forPrint + }, a = this.buildViewPropTransformers(t.viewPropsTransformers); + for (let s of a) + Object.assign(i, s.transform(i, e)); + let o = n.component; + return me(o, Object.assign({}, i)); + } +} +function dwe(r, e, t, n, i, a) { + let o = t.build(i, void 0, !1), s = t.buildPrev(e, n, !1), l = t.buildNext(e, n, !1); + return { + title: a, + activeButton: r.type, + navUnit: r.singleUnit, + isTodayEnabled: o.isValid && !Ql(e.currentRange, i), + isPrevEnabled: s.isValid, + isNextEnabled: l.isValid + }; +} +function vwe(r) { + return r.map((e) => new e()); +} +class pwe extends qxe { + constructor(e, t = {}) { + super(), this.isRendering = !1, this.isRendered = !1, this.currentClassNames = [], this.customContentRenderId = 0, this.handleAction = (n) => { + switch (n.type) { + case "SET_EVENT_DRAG": + case "SET_EVENT_RESIZE": + this.renderRunner.tryDrain(); + } + }, this.handleData = (n) => { + this.currentData = n, this.renderRunner.request(n.calendarOptions.rerenderDelay); + }, this.handleRenderRequest = () => { + if (this.isRendering) { + this.isRendered = !0; + let { currentData: n } = this; + Az(() => { + Fg(me(lxe, { options: n.calendarOptions, theme: n.theme, emitter: n.emitter }, (i, a, o, s) => (this.setClassNames(i), this.setHeight(a), me( + jG.Provider, + { value: this.customContentRenderId }, + me(fwe, Object.assign({ isHeightAuto: o, forPrint: s }, n)) + ))), this.el); + }); + } else + this.isRendered && (this.isRendered = !1, Fg(null, this.el), this.setClassNames([]), this.setHeight("")); + }, N0e(e), this.el = e, this.renderRunner = new bM(this.handleRenderRequest), new qSe({ + optionOverrides: t, + calendarApi: this, + onAction: this.handleAction, + onData: this.handleData + }); + } + render() { + let e = this.isRendering; + e ? this.customContentRenderId += 1 : this.isRendering = !0, this.renderRunner.request(), e && this.updateSize(); + } + destroy() { + this.isRendering && (this.isRendering = !1, this.renderRunner.request()); + } + updateSize() { + Az(() => { + super.updateSize(); + }); + } + batchRendering(e) { + this.renderRunner.pause("batchRendering"), e(), this.renderRunner.resume("batchRendering"); + } + pauseRendering() { + this.renderRunner.pause("pauseRendering"); + } + resumeRendering() { + this.renderRunner.resume("pauseRendering", !0); + } + resetOptions(e, t) { + this.currentDataManager.resetOptions(e, t); + } + setClassNames(e) { + if (!_c(e, this.currentClassNames)) { + let { classList: t } = this.el; + for (let n of this.currentClassNames) + t.remove(n); + for (let n of e) + t.add(n); + this.currentClassNames = e; + } + } + setHeight(e) { + lG(this.el, "height", e); + } +} +class gU extends $react.Component { + constructor() { + super(...arguments), this.elRef = $react.createRef(), this.isUpdating = !1, this.isUnmounting = !1, this.state = { + customRenderingMap: /* @__PURE__ */ new Map() + }, this.requestResize = () => { + this.isUnmounting || (this.cancelResize(), this.resizeId = requestAnimationFrame(() => { + this.doResize(); + })); + }; + } + render() { + const e = []; + for (const t of this.state.customRenderingMap.values()) + e.push(/* @__PURE__ */ Bt(gwe, { + customRendering: t + }, t.id)); + return /* @__PURE__ */ Bt("div", { + ref: this.elRef, + children: e + }); + } + componentDidMount() { + const e = new tSe(); + this.handleCustomRendering = e.handle.bind(e), this.calendar = new pwe(this.elRef.current, Object.assign(Object.assign({}, this.props), { + handleCustomRendering: this.handleCustomRendering + })), this.calendar.render(); + let t; + e.subscribe((n) => { + const i = Date.now(), a = !t; + (a || this.isUpdating || this.isUnmounting || i - t < 100 ? mU : $react_dom.flushSync)(() => { + this.setState({ + customRenderingMap: n + }, () => { + t = i, a ? this.doResize() : this.requestResize(); + }); + }); + }); + } + componentDidUpdate() { + this.isUpdating = !0, this.calendar.resetOptions(Object.assign(Object.assign({}, this.props), { + handleCustomRendering: this.handleCustomRendering + })), this.isUpdating = !1; + } + componentWillUnmount() { + this.isUnmounting = !0, this.cancelResize(), this.calendar.destroy(); + } + doResize() { + this.calendar.updateSize(); + } + cancelResize() { + this.resizeId !== void 0 && (cancelAnimationFrame(this.resizeId), this.resizeId = void 0); + } + getApi() { + return this.calendar; + } +} +gU.act = mU; +class gwe extends $react.PureComponent { + render() { + const { + customRendering: e + } = this.props, { + generatorMeta: t + } = e, n = typeof t == "function" ? t(e.renderProps) : t; + return $react_dom.createPortal(n, e.containerEl); + } +} +function mU(r) { + r(); +} +var mwe = ':root{--fc-daygrid-event-dot-width:8px}.fc-daygrid-day-events:after,.fc-daygrid-day-events:before,.fc-daygrid-day-frame:after,.fc-daygrid-day-frame:before,.fc-daygrid-event-harness:after,.fc-daygrid-event-harness:before{clear:both;content:"";display:table}.fc .fc-daygrid-body{position:relative;z-index:1}.fc .fc-daygrid-day.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-daygrid-day-frame{min-height:100%;position:relative}.fc .fc-daygrid-day-top{display:flex;flex-direction:row-reverse}.fc .fc-day-other .fc-daygrid-day-top{opacity:.3}.fc .fc-daygrid-day-number{padding:4px;position:relative;z-index:4}.fc .fc-daygrid-month-start{font-size:1.1em;font-weight:700}.fc .fc-daygrid-day-events{margin-top:1px}.fc .fc-daygrid-body-balanced .fc-daygrid-day-events{left:0;position:absolute;right:0}.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events{min-height:2em;position:relative}.fc .fc-daygrid-body-natural .fc-daygrid-day-events{margin-bottom:1em}.fc .fc-daygrid-event-harness{position:relative}.fc .fc-daygrid-event-harness-abs{left:0;position:absolute;right:0;top:0}.fc .fc-daygrid-bg-harness{bottom:0;position:absolute;top:0}.fc .fc-daygrid-day-bg .fc-non-business{z-index:1}.fc .fc-daygrid-day-bg .fc-bg-event{z-index:2}.fc .fc-daygrid-day-bg .fc-highlight{z-index:3}.fc .fc-daygrid-event{margin-top:1px;z-index:6}.fc .fc-daygrid-event.fc-event-mirror{z-index:7}.fc .fc-daygrid-day-bottom{font-size:.85em;margin:0 2px}.fc .fc-daygrid-day-bottom:after,.fc .fc-daygrid-day-bottom:before{clear:both;content:"";display:table}.fc .fc-daygrid-more-link{border-radius:3px;cursor:pointer;line-height:1;margin-top:1px;max-width:100%;overflow:hidden;padding:2px;position:relative;white-space:nowrap;z-index:4}.fc .fc-daygrid-more-link:hover{background-color:rgba(0,0,0,.1)}.fc .fc-daygrid-week-number{background-color:var(--fc-neutral-bg-color);color:var(--fc-neutral-text-color);min-width:1.5em;padding:2px;position:absolute;text-align:center;top:0;z-index:5}.fc .fc-more-popover .fc-popover-body{min-width:220px;padding:10px}.fc-direction-ltr .fc-daygrid-event.fc-event-start,.fc-direction-rtl .fc-daygrid-event.fc-event-end{margin-left:2px}.fc-direction-ltr .fc-daygrid-event.fc-event-end,.fc-direction-rtl .fc-daygrid-event.fc-event-start{margin-right:2px}.fc-direction-ltr .fc-daygrid-more-link{float:left}.fc-direction-ltr .fc-daygrid-week-number{border-radius:0 0 3px 0;left:0}.fc-direction-rtl .fc-daygrid-more-link{float:right}.fc-direction-rtl .fc-daygrid-week-number{border-radius:0 0 0 3px;right:0}.fc-liquid-hack .fc-daygrid-day-frame{position:static}.fc-daygrid-event{border-radius:3px;font-size:var(--fc-small-font-size);position:relative;white-space:nowrap}.fc-daygrid-block-event .fc-event-time{font-weight:700}.fc-daygrid-block-event .fc-event-time,.fc-daygrid-block-event .fc-event-title{padding:1px}.fc-daygrid-dot-event{align-items:center;display:flex;padding:2px 0}.fc-daygrid-dot-event .fc-event-title{flex-grow:1;flex-shrink:1;font-weight:700;min-width:0;overflow:hidden}.fc-daygrid-dot-event.fc-event-mirror,.fc-daygrid-dot-event:hover{background:rgba(0,0,0,.1)}.fc-daygrid-dot-event.fc-event-selected:before{bottom:-10px;top:-10px}.fc-daygrid-event-dot{border:calc(var(--fc-daygrid-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-daygrid-event-dot-width)/2);box-sizing:content-box;height:0;margin:0 4px;width:0}.fc-direction-ltr .fc-daygrid-event .fc-event-time{margin-right:3px}.fc-direction-rtl .fc-daygrid-event .fc-event-time{margin-left:3px}'; +yx(mwe); +function A0(r, e) { + let t = []; + for (let n = 0; n < e; n += 1) + t[n] = []; + for (let n of r) + t[n.row].push(n); + return t; +} +function E0(r, e) { + let t = []; + for (let n = 0; n < e; n += 1) + t[n] = []; + for (let n of r) + t[n.firstCol].push(n); + return t; +} +function Hz(r, e) { + let t = []; + if (r) { + for (let n = 0; n < e; n += 1) + t[n] = { + affectedInstances: r.affectedInstances, + isEvent: r.isEvent, + segs: [] + }; + for (let n of r.segs) + t[n.row].segs.push(n); + } else + for (let n = 0; n < e; n += 1) + t[n] = null; + return t; +} +const yU = jn({ + hour: "numeric", + minute: "2-digit", + omitZeroMinute: !0, + meridiem: "narrow" +}); +function _U(r) { + let { display: e } = r.eventRange.ui; + return e === "list-item" || e === "auto" && !r.eventRange.def.allDay && r.firstCol === r.lastCol && // can't be multi-day + r.isStart && // " + r.isEnd; +} +class bU extends un { + render() { + let { props: e } = this; + return me(QG, Object.assign({}, e, { elClasses: ["fc-daygrid-event", "fc-daygrid-block-event", "fc-h-event"], defaultTimeFormat: yU, defaultDisplayEventEnd: e.defaultDisplayEventEnd, disableResizing: !e.seg.eventRange.def.allDay })); + } +} +class xU extends un { + render() { + let { props: e, context: t } = this, { options: n } = t, { seg: i } = e, a = n.eventTimeFormat || yU, o = rg(i, a, t, !0, e.defaultDisplayEventEnd); + return me(Tx, Object.assign({}, e, { elTag: "a", elClasses: ["fc-daygrid-event", "fc-daygrid-dot-event"], elAttrs: pM(e.seg, t), defaultGenerator: ywe, timeText: o, isResizing: !1, isDateSelecting: !1 })); + } +} +function ywe(r) { + return me( + Dn, + null, + me("div", { className: "fc-daygrid-event-dot", style: { borderColor: r.borderColor || r.backgroundColor } }), + r.timeText && me("div", { className: "fc-event-time" }, r.timeText), + me("div", { className: "fc-event-title" }, r.event.title || me(Dn, null, " ")) + ); +} +class _we extends un { + constructor() { + super(...arguments), this.compileSegs = rr(bwe); + } + render() { + let { props: e } = this, { allSegs: t, invisibleSegs: n } = this.compileSegs(e.singlePlacements); + return me(rU, { elClasses: ["fc-daygrid-more-link"], dateProfile: e.dateProfile, todayRange: e.todayRange, allDayDate: e.allDayDate, moreCnt: e.moreCnt, allSegs: t, hiddenSegs: n, alignmentElRef: e.alignmentElRef, alignGridTop: e.alignGridTop, extraDateSpan: e.extraDateSpan, popoverContent: () => { + let i = (e.eventDrag ? e.eventDrag.affectedInstances : null) || (e.eventResize ? e.eventResize.affectedInstances : null) || {}; + return me(Dn, null, t.map((a) => { + let o = a.eventRange.instance.instanceId; + return me("div", { className: "fc-daygrid-event-harness", key: o, style: { + visibility: i[o] ? "hidden" : "" + } }, _U(a) ? me(xU, Object.assign({ seg: a, isDragging: !1, isSelected: o === e.eventSelection, defaultDisplayEventEnd: !1 }, ql(a, e.todayRange))) : me(bU, Object.assign({ seg: a, isDragging: !1, isResizing: !1, isDateSelecting: !1, isSelected: o === e.eventSelection, defaultDisplayEventEnd: !1 }, ql(a, e.todayRange)))); + })); + } }); + } +} +function bwe(r) { + let e = [], t = []; + for (let n of r) + e.push(n.seg), n.isVisible || t.push(n.seg); + return { allSegs: e, invisibleSegs: t }; +} +const xwe = jn({ week: "narrow" }); +class Swe extends Vs { + constructor() { + super(...arguments), this.rootElRef = Da(), this.state = { + dayNumberId: cc() + }, this.handleRootEl = (e) => { + lu(this.rootElRef, e), lu(this.props.elRef, e); + }; + } + render() { + let { context: e, props: t, state: n, rootElRef: i } = this, { options: a, dateEnv: o } = e, { date: s, dateProfile: l } = t; + const u = t.showDayNumber && Cwe(s, l.currentRange, o); + return me(wM, { elTag: "td", elRef: this.handleRootEl, elClasses: [ + "fc-daygrid-day", + ...t.extraClassNames || [] + ], elAttrs: Object.assign(Object.assign(Object.assign({}, t.extraDataAttrs), t.showDayNumber ? { "aria-labelledby": n.dayNumberId } : {}), { role: "gridcell" }), defaultGenerator: wwe, date: s, dateProfile: l, todayRange: t.todayRange, showDayNumber: t.showDayNumber, isMonthStart: u, extraRenderProps: t.extraRenderProps }, (c, h) => me( + "div", + { ref: t.innerElRef, className: "fc-daygrid-day-frame fc-scrollgrid-sync-inner", style: { minHeight: t.minHeight } }, + t.showWeekNumber && me(tU, { elTag: "a", elClasses: ["fc-daygrid-week-number"], elAttrs: Gd(e, s, "week"), date: s, defaultFormat: xwe }), + !h.isDisabled && (t.showDayNumber || CM(a) || t.forceDayTop) ? me( + "div", + { className: "fc-daygrid-day-top" }, + me(c, { elTag: "a", elClasses: [ + "fc-daygrid-day-number", + u && "fc-daygrid-month-start" + ], elAttrs: Object.assign(Object.assign({}, Gd(e, s)), { id: n.dayNumberId }) }) + ) : t.showDayNumber ? ( + // for creating correct amount of space (see issue #7162) + me( + "div", + { className: "fc-daygrid-day-top", style: { visibility: "hidden" } }, + me("a", { className: "fc-daygrid-day-number" }, " ") + ) + ) : void 0, + me( + "div", + { className: "fc-daygrid-day-events", ref: t.fgContentElRef }, + t.fgContent, + me( + "div", + { className: "fc-daygrid-day-bottom", style: { marginTop: t.moreMarginTop } }, + me(_we, { allDayDate: s, singlePlacements: t.singlePlacements, moreCnt: t.moreCnt, alignmentElRef: i, alignGridTop: !t.showDayNumber, extraDateSpan: t.extraDateSpan, dateProfile: t.dateProfile, eventSelection: t.eventSelection, eventDrag: t.eventDrag, eventResize: t.eventResize, todayRange: t.todayRange }) + ) + ), + me("div", { className: "fc-daygrid-day-bg" }, t.bgContent) + )); + } +} +function wwe(r) { + return r.dayNumberText || me(Dn, null, " "); +} +function Cwe(r, e, t) { + const { start: n, end: i } = e, a = bc(i, -1), o = t.getYear(n), s = t.getMonth(n), l = t.getYear(a), u = t.getMonth(a); + return !(o === l && s === u) && // first date in current view? + (r.valueOf() === n.valueOf() || // a month-start that's within the current range? + t.getDay(r) === 1 && r.valueOf() < i.valueOf()); +} +function Twe(r, e, t, n, i, a, o) { + let s = new Ewe(); + s.allowReslicing = !0, s.strictOrder = n, e === !0 || t === !0 ? (s.maxCoord = a, s.hiddenConsumes = !0) : typeof e == "number" ? s.maxStackCnt = e : typeof t == "number" && (s.maxStackCnt = t, s.hiddenConsumes = !0); + let l = [], u = []; + for (let d = 0; d < r.length; d += 1) { + let m = r[d], { instanceId: _ } = m.eventRange.instance, y = i[_]; + y != null ? l.push({ + index: d, + thickness: y, + span: { + start: m.firstCol, + end: m.lastCol + 1 + } + }) : u.push(m); + } + let c = s.addSegs(l), h = s.toRects(), { singleColPlacements: f, multiColPlacements: v, leftoverMargins: b } = Iwe(h, r, o), w = [], p = []; + for (let d of u) { + v[d.firstCol].push({ + seg: d, + isVisible: !1, + isAbsolute: !0, + absoluteTop: 0, + marginTop: 0 + }); + for (let m = d.firstCol; m <= d.lastCol; m += 1) + f[m].push({ + seg: Ed(d, m, m + 1, o), + isVisible: !1, + isAbsolute: !1, + absoluteTop: 0, + marginTop: 0 + }); + } + for (let d = 0; d < o.length; d += 1) + w.push(0); + for (let d of c) { + let m = r[d.index], _ = d.span; + v[_.start].push({ + seg: Ed(m, _.start, _.end, o), + isVisible: !1, + isAbsolute: !0, + absoluteTop: 0, + marginTop: 0 + }); + for (let y = _.start; y < _.end; y += 1) + w[y] += 1, f[y].push({ + seg: Ed(m, y, y + 1, o), + isVisible: !1, + isAbsolute: !1, + absoluteTop: 0, + marginTop: 0 + }); + } + for (let d = 0; d < o.length; d += 1) + p.push(b[d]); + return { singleColPlacements: f, multiColPlacements: v, moreCnts: w, moreMarginTops: p }; +} +function Iwe(r, e, t) { + let n = Awe(r, t.length), i = [], a = [], o = []; + for (let s = 0; s < t.length; s += 1) { + let l = n[s], u = [], c = 0, h = 0; + for (let v of l) { + let b = e[v.index]; + u.push({ + seg: Ed(b, s, s + 1, t), + isVisible: !0, + isAbsolute: !1, + absoluteTop: v.levelCoord, + marginTop: v.levelCoord - c + }), c = v.levelCoord + v.thickness; + } + let f = []; + c = 0, h = 0; + for (let v of l) { + let b = e[v.index], w = v.span.end - v.span.start > 1, p = v.span.start === s; + h += v.levelCoord - c, c = v.levelCoord + v.thickness, w ? (h += v.thickness, p && f.push({ + seg: Ed(b, v.span.start, v.span.end, t), + isVisible: !0, + isAbsolute: !0, + absoluteTop: v.levelCoord, + marginTop: 0 + })) : p && (f.push({ + seg: Ed(b, v.span.start, v.span.end, t), + isVisible: !0, + isAbsolute: !1, + absoluteTop: v.levelCoord, + marginTop: h + // claim the margin + }), h = 0); + } + i.push(u), a.push(f), o.push(h); + } + return { singleColPlacements: i, multiColPlacements: a, leftoverMargins: o }; +} +function Awe(r, e) { + let t = []; + for (let n = 0; n < e; n += 1) + t.push([]); + for (let n of r) + for (let i = n.span.start; i < n.span.end; i += 1) + t[i].push(n); + return t; +} +function Ed(r, e, t, n) { + if (r.firstCol === e && r.lastCol === t - 1) + return r; + let i = r.eventRange, a = i.range, o = xc(a, { + start: n[e].date, + end: Bi(n[t - 1].date, 1) + }); + return Object.assign(Object.assign({}, r), { firstCol: e, lastCol: t - 1, eventRange: { + def: i.def, + ui: Object.assign(Object.assign({}, i.ui), { durationEditable: !1 }), + instance: i.instance, + range: o + }, isStart: r.isStart && o.start.valueOf() === a.start.valueOf(), isEnd: r.isEnd && o.end.valueOf() === a.end.valueOf() }); +} +class Ewe extends PG { + constructor() { + super(...arguments), this.hiddenConsumes = !1, this.forceHidden = {}; + } + addSegs(e) { + const t = super.addSegs(e), { entriesByLevel: n } = this, i = (a) => !this.forceHidden[Hh(a)]; + for (let a = 0; a < n.length; a += 1) + n[a] = n[a].filter(i); + return t; + } + handleInvalidInsertion(e, t, n) { + const { entriesByLevel: i, forceHidden: a } = this, { touchingEntry: o, touchingLevel: s, touchingLateral: l } = e; + if (this.hiddenConsumes && o) { + const u = Hh(o); + if (!a[u]) + if (this.allowReslicing) { + const c = Object.assign(Object.assign({}, o), { span: gM(o.span, t.span) }), h = Hh(c); + a[h] = !0, i[s][l] = c, this.splitEntry(o, t, n); + } else + a[u] = !0, n.push(o); + } + return super.handleInvalidInsertion(e, t, n); + } +} +class SU extends Vs { + constructor() { + super(...arguments), this.cellElRefs = new Zl(), this.frameElRefs = new Zl(), this.fgElRefs = new Zl(), this.segHarnessRefs = new Zl(), this.rootElRef = Da(), this.state = { + framePositions: null, + maxContentHeight: null, + eventInstanceHeights: {} + }, this.handleResize = (e) => { + e && this.updateSizing(!0); + }; + } + render() { + let { props: e, state: t, context: n } = this, { options: i } = n, a = e.cells.length, o = E0(e.businessHourSegs, a), s = E0(e.bgEventSegs, a), l = E0(this.getHighlightSegs(), a), u = E0(this.getMirrorSegs(), a), { singleColPlacements: c, multiColPlacements: h, moreCnts: f, moreMarginTops: v } = Twe(vM(e.fgEventSegs, i.eventOrder), e.dayMaxEvents, e.dayMaxEventRows, i.eventOrderStrict, t.eventInstanceHeights, t.maxContentHeight, e.cells), b = ( + // TODO: messy way to compute this + e.eventDrag && e.eventDrag.affectedInstances || e.eventResize && e.eventResize.affectedInstances || {} + ); + return me( + "tr", + { ref: this.rootElRef, role: "row" }, + e.renderIntro && e.renderIntro(), + e.cells.map((w, p) => { + let d = this.renderFgSegs(p, e.forPrint ? c[p] : h[p], e.todayRange, b), m = this.renderFgSegs(p, Mwe(u[p], h), e.todayRange, {}, !!e.eventDrag, !!e.eventResize, !1); + return me(Swe, { key: w.key, elRef: this.cellElRefs.createRef(w.key), innerElRef: this.frameElRefs.createRef(w.key), dateProfile: e.dateProfile, date: w.date, showDayNumber: e.showDayNumbers, showWeekNumber: e.showWeekNumbers && p === 0, forceDayTop: e.showWeekNumbers, todayRange: e.todayRange, eventSelection: e.eventSelection, eventDrag: e.eventDrag, eventResize: e.eventResize, extraRenderProps: w.extraRenderProps, extraDataAttrs: w.extraDataAttrs, extraClassNames: w.extraClassNames, extraDateSpan: w.extraDateSpan, moreCnt: f[p], moreMarginTop: v[p], singlePlacements: c[p], fgContentElRef: this.fgElRefs.createRef(w.key), fgContent: ( + // Fragment scopes the keys + me( + Dn, + null, + me(Dn, null, d), + me(Dn, null, m) + ) + ), bgContent: ( + // Fragment scopes the keys + me( + Dn, + null, + this.renderFillSegs(l[p], "highlight"), + this.renderFillSegs(o[p], "non-business"), + this.renderFillSegs(s[p], "bg-event") + ) + ), minHeight: e.cellMinHeight }); + }) + ); + } + componentDidMount() { + this.updateSizing(!0), this.context.addResizeHandler(this.handleResize); + } + componentDidUpdate(e, t) { + let n = this.props; + this.updateSizing(!El(e, n)); + } + componentWillUnmount() { + this.context.removeResizeHandler(this.handleResize); + } + getHighlightSegs() { + let { props: e } = this; + return e.eventDrag && e.eventDrag.segs.length ? e.eventDrag.segs : e.eventResize && e.eventResize.segs.length ? e.eventResize.segs : e.dateSelectionSegs; + } + getMirrorSegs() { + let { props: e } = this; + return e.eventResize && e.eventResize.segs.length ? e.eventResize.segs : []; + } + renderFgSegs(e, t, n, i, a, o, s) { + let { context: l } = this, { eventSelection: u } = this.props, { framePositions: c } = this.state, h = this.props.cells.length === 1, f = a || o || s, v = []; + if (c) + for (let b of t) { + let { seg: w } = b, { instanceId: p } = w.eventRange.instance, d = p + ":" + e, m = b.isVisible && !i[p], _ = b.isAbsolute, y = "", x = ""; + _ && (l.isRtl ? (x = 0, y = c.lefts[w.lastCol] - c.lefts[w.firstCol]) : (y = 0, x = c.rights[w.firstCol] - c.rights[w.lastCol])), v.push(me("div", { className: "fc-daygrid-event-harness" + (_ ? " fc-daygrid-event-harness-abs" : ""), key: d, ref: f ? null : this.segHarnessRefs.createRef(d), style: { + visibility: m ? "" : "hidden", + marginTop: _ ? "" : b.marginTop, + top: _ ? b.absoluteTop : "", + left: y, + right: x + } }, _U(w) ? me(xU, Object.assign({ seg: w, isDragging: a, isSelected: p === u, defaultDisplayEventEnd: h }, ql(w, n))) : me(bU, Object.assign({ seg: w, isDragging: a, isResizing: o, isDateSelecting: s, isSelected: p === u, defaultDisplayEventEnd: h }, ql(w, n))))); + } + return v; + } + renderFillSegs(e, t) { + let { isRtl: n } = this.context, { todayRange: i } = this.props, { framePositions: a } = this.state, o = []; + if (a) + for (let s of e) { + let l = n ? { + right: 0, + left: a.lefts[s.lastCol] - a.lefts[s.firstCol] + } : { + left: 0, + right: a.rights[s.firstCol] - a.rights[s.lastCol] + }; + o.push(me("div", { key: DG(s.eventRange), className: "fc-daygrid-bg-harness", style: l }, t === "bg-event" ? me(qG, Object.assign({ seg: s }, ql(s, i))) : eU(t))); + } + return me(Dn, {}, ...o); + } + updateSizing(e) { + let { props: t, state: n, frameElRefs: i } = this; + if (!t.forPrint && t.clientWidth !== null) { + if (e) { + let l = t.cells.map((u) => i.currentMap[u.key]); + if (l.length) { + let u = this.rootElRef.current, c = new Ud( + u, + l, + !0, + // isHorizontal + !1 + ); + (!n.framePositions || !n.framePositions.similarTo(c)) && this.setState({ + framePositions: new Ud( + u, + l, + !0, + // isHorizontal + !1 + ) + }); + } + } + const a = this.state.eventInstanceHeights, o = this.queryEventInstanceHeights(), s = t.dayMaxEvents === !0 || t.dayMaxEventRows === !0; + this.safeSetState({ + // HACK to prevent oscillations of events being shown/hidden from max-event-rows + // Essentially, once you compute an element's height, never null-out. + // TODO: always display all events, as visibility:hidden? + eventInstanceHeights: Object.assign(Object.assign({}, a), o), + maxContentHeight: s ? this.computeMaxContentHeight() : null + }); + } + } + queryEventInstanceHeights() { + let e = this.segHarnessRefs.currentMap, t = {}; + for (let n in e) { + let i = Math.round(e[n].getBoundingClientRect().height), a = n.split(":")[0]; + t[a] = Math.max(t[a] || 0, i); + } + return t; + } + computeMaxContentHeight() { + let e = this.props.cells[0].key, t = this.cellElRefs.currentMap[e], n = this.fgElRefs.currentMap[e]; + return t.getBoundingClientRect().bottom - n.getBoundingClientRect().top; + } + getCellEls() { + let e = this.cellElRefs.currentMap; + return this.props.cells.map((t) => e[t.key]); + } +} +SU.addStateEquality({ + eventInstanceHeights: El +}); +function Mwe(r, e) { + if (!r.length) + return []; + let t = Dwe(e); + return r.map((n) => ({ + seg: n, + isVisible: !0, + isAbsolute: !0, + absoluteTop: t[n.eventRange.instance.instanceId], + marginTop: 0 + })); +} +function Dwe(r) { + let e = {}; + for (let t of r) + for (let n of t) + e[n.seg.eventRange.instance.instanceId] = n.absoluteTop; + return e; +} +class kwe extends Vs { + constructor() { + super(...arguments), this.splitBusinessHourSegs = rr(A0), this.splitBgEventSegs = rr(A0), this.splitFgEventSegs = rr(A0), this.splitDateSelectionSegs = rr(A0), this.splitEventDrag = rr(Hz), this.splitEventResize = rr(Hz), this.rowRefs = new Zl(); + } + render() { + let { props: e, context: t } = this, n = e.cells.length, i = this.splitBusinessHourSegs(e.businessHourSegs, n), a = this.splitBgEventSegs(e.bgEventSegs, n), o = this.splitFgEventSegs(e.fgEventSegs, n), s = this.splitDateSelectionSegs(e.dateSelectionSegs, n), l = this.splitEventDrag(e.eventDrag, n), u = this.splitEventResize(e.eventResize, n), c = n >= 7 && e.clientWidth ? e.clientWidth / t.options.aspectRatio / 6 : null; + return me(vv, { unit: "day" }, (h, f) => me(Dn, null, e.cells.map((v, b) => me(SU, { + ref: this.rowRefs.createRef(b), + key: v.length ? v[0].date.toISOString() : b, + showDayNumbers: n > 1, + showWeekNumbers: e.showWeekNumbers, + todayRange: f, + dateProfile: e.dateProfile, + cells: v, + renderIntro: e.renderRowIntro, + businessHourSegs: i[b], + eventSelection: e.eventSelection, + bgEventSegs: a[b].filter(Owe), + fgEventSegs: o[b], + dateSelectionSegs: s[b], + eventDrag: l[b], + eventResize: u[b], + dayMaxEvents: e.dayMaxEvents, + dayMaxEventRows: e.dayMaxEventRows, + clientWidth: e.clientWidth, + clientHeight: e.clientHeight, + cellMinHeight: c, + forPrint: e.forPrint + })))); + } + componentDidMount() { + const e = this.rowRefs.currentMap[0].getCellEls()[0]; + this.rootEl = e ? e.closest(".fc-daygrid-body") : null, this.rootEl && this.context.registerInteractiveComponent(this, { + el: this.rootEl, + isHitComboAllowed: this.props.isHitComboAllowed + }); + } + componentWillUnmount() { + this.rootEl && (this.context.unregisterInteractiveComponent(this), this.rootEl = null); + } + // Hit System + // ---------------------------------------------------------------------------------------------------- + prepareHits() { + this.rowPositions = new Ud( + this.rootEl, + this.rowRefs.collect().map((e) => e.getCellEls()[0]), + // first cell el in each row. TODO: not optimal + !1, + !0 + ), this.colPositions = new Ud( + this.rootEl, + this.rowRefs.currentMap[0].getCellEls(), + // cell els in first row + !0, + // horizontal + !1 + ); + } + queryHit(e, t) { + let { colPositions: n, rowPositions: i } = this, a = n.leftToIndex(e), o = i.topToIndex(t); + if (o != null && a != null) { + let s = this.props.cells[o][a]; + return { + dateProfile: this.props.dateProfile, + dateSpan: Object.assign({ range: this.getCellRange(o, a), allDay: !0 }, s.extraDateSpan), + dayEl: this.getCellEl(o, a), + rect: { + left: n.lefts[a], + right: n.rights[a], + top: i.tops[o], + bottom: i.bottoms[o] + }, + layer: 0 + }; + } + return null; + } + getCellEl(e, t) { + return this.rowRefs.currentMap[e].getCellEls()[t]; + } + getCellRange(e, t) { + let n = this.props.cells[e][t].date, i = Bi(n, 1); + return { start: n, end: i }; + } +} +function Owe(r) { + return r.eventRange.def.allDay; +} +class Lwe extends Vs { + constructor() { + super(...arguments), this.elRef = Da(), this.needsScrollReset = !1; + } + render() { + let { props: e } = this, { dayMaxEventRows: t, dayMaxEvents: n, expandRows: i } = e, a = n === !0 || t === !0; + a && !i && (a = !1, t = null, n = null); + let o = [ + "fc-daygrid-body", + a ? "fc-daygrid-body-balanced" : "fc-daygrid-body-unbalanced", + i ? "" : "fc-daygrid-body-natural" + // will height of one row depend on the others? + ]; + return me( + "div", + { ref: this.elRef, className: o.join(" "), style: { + // these props are important to give this wrapper correct dimensions for interactions + // TODO: if we set it here, can we avoid giving to inner tables? + width: e.clientWidth, + minWidth: e.tableMinWidth + } }, + me( + "table", + { role: "presentation", className: "fc-scrollgrid-sync-table", style: { + width: e.clientWidth, + minWidth: e.tableMinWidth, + height: i ? e.clientHeight : "" + } }, + e.colGroupNode, + me( + "tbody", + { role: "presentation" }, + me(kwe, { dateProfile: e.dateProfile, cells: e.cells, renderRowIntro: e.renderRowIntro, showWeekNumbers: e.showWeekNumbers, clientWidth: e.clientWidth, clientHeight: e.clientHeight, businessHourSegs: e.businessHourSegs, bgEventSegs: e.bgEventSegs, fgEventSegs: e.fgEventSegs, dateSelectionSegs: e.dateSelectionSegs, eventSelection: e.eventSelection, eventDrag: e.eventDrag, eventResize: e.eventResize, dayMaxEvents: n, dayMaxEventRows: t, forPrint: e.forPrint, isHitComboAllowed: e.isHitComboAllowed }) + ) + ) + ); + } + componentDidMount() { + this.requestScrollReset(); + } + componentDidUpdate(e) { + e.dateProfile !== this.props.dateProfile ? this.requestScrollReset() : this.flushScrollReset(); + } + requestScrollReset() { + this.needsScrollReset = !0, this.flushScrollReset(); + } + flushScrollReset() { + if (this.needsScrollReset && this.props.clientWidth) { + const e = Pwe(this.elRef.current, this.props.dateProfile); + if (e) { + const t = e.closest(".fc-daygrid-body"), n = t.closest(".fc-scroller"), i = e.getBoundingClientRect().top - t.getBoundingClientRect().top; + n.scrollTop = i ? i + 1 : 0; + } + this.needsScrollReset = !1; + } + } +} +function Pwe(r, e) { + let t; + return e.currentRangeUnit.match(/year|month/) && (t = r.querySelector(`[data-date="${I_e(e.currentDate)}-01"]`)), t || (t = r.querySelector(`[data-date="${ym(e.currentDate)}"]`)), t; +} +class Rwe extends VG { + constructor() { + super(...arguments), this.forceDayIfListItem = !0; + } + sliceRange(e, t) { + return t.sliceRange(e); + } +} +class wU extends Vs { + constructor() { + super(...arguments), this.slicer = new Rwe(), this.tableRef = Da(); + } + render() { + let { props: e, context: t } = this; + return me(Lwe, Object.assign({ ref: this.tableRef }, this.slicer.sliceProps(e, e.dateProfile, e.nextDayThreshold, t, e.dayTableModel), { dateProfile: e.dateProfile, cells: e.dayTableModel.cells, colGroupNode: e.colGroupNode, tableMinWidth: e.tableMinWidth, renderRowIntro: e.renderRowIntro, dayMaxEvents: e.dayMaxEvents, dayMaxEventRows: e.dayMaxEventRows, showWeekNumbers: e.showWeekNumbers, expandRows: e.expandRows, headerAlignElRef: e.headerAlignElRef, clientWidth: e.clientWidth, clientHeight: e.clientHeight, forPrint: e.forPrint })); + } +} +class Nwe extends IG { + // Computes the date range that will be rendered + buildRenderRange(e, t, n) { + let i = super.buildRenderRange(e, t, n), { props: a } = this; + return zwe({ + currentRange: i, + snapToWeek: /^(year|month)$/.test(t), + fixedWeekCount: a.fixedWeekCount, + dateEnv: a.dateEnv + }); + } +} +function zwe(r) { + let { dateEnv: e, currentRange: t } = r, { start: n, end: i } = t, a; + if (r.snapToWeek && (n = e.startOfWeek(n), a = e.startOfWeek(i), a.valueOf() !== i.valueOf() && (i = gz(a, 1))), r.fixedWeekCount) { + let o = e.startOfWeek(e.startOfMonth(Bi(t.end, -1))), s = Math.ceil( + // could be partial weeks due to hiddenDays + p_e(o, i) + ); + i = gz(i, 6 - s); + } + return { start: n, end: i }; +} +class Bwe extends Vs { + constructor() { + super(...arguments), this.headerElRef = Da(); + } + renderSimpleLayout(e, t) { + let { props: n, context: i } = this, a = [], o = pb(i.options); + return e && a.push({ + type: "header", + key: "header", + isSticky: o, + chunk: { + elRef: this.headerElRef, + tableClassName: "fc-col-header", + rowContent: e + } + }), a.push({ + type: "body", + key: "body", + liquid: !0, + chunk: { content: t } + }), me( + Hg, + { elClasses: ["fc-daygrid"], viewSpec: i.viewSpec }, + me(xM, { liquid: !n.isHeightAuto && !n.forPrint, collapsibleWidth: n.forPrint, cols: [], sections: a }) + ); + } + renderHScrollLayout(e, t, n, i) { + let a = this.context.pluginHooks.scrollGridImpl; + if (!a) + throw new Error("No ScrollGrid implementation"); + let { props: o, context: s } = this, l = !o.forPrint && pb(s.options), u = !o.forPrint && KG(s.options), c = []; + return e && c.push({ + type: "header", + key: "header", + isSticky: l, + chunks: [{ + key: "main", + elRef: this.headerElRef, + tableClassName: "fc-col-header", + rowContent: e + }] + }), c.push({ + type: "body", + key: "body", + liquid: !0, + chunks: [{ + key: "main", + content: t + }] + }), u && c.push({ + type: "footer", + key: "footer", + isSticky: !0, + chunks: [{ + key: "main", + content: aI + }] + }), me( + Hg, + { elClasses: ["fc-daygrid"], viewSpec: s.viewSpec }, + me(a, { liquid: !o.isHeightAuto && !o.forPrint, forPrint: o.forPrint, collapsibleWidth: o.forPrint, colGroups: [{ cols: [{ span: n, minWidth: i }] }], sections: c }) + ); + } +} +class jwe extends Bwe { + constructor() { + super(...arguments), this.buildDayTableModel = rr(Fwe), this.headerRef = Da(), this.tableRef = Da(); + } + render() { + let { options: e, dateProfileGenerator: t } = this.context, { props: n } = this, i = this.buildDayTableModel(n.dateProfile, t), a = e.dayHeaders && me(FG, { ref: this.headerRef, dateProfile: n.dateProfile, dates: i.headerDates, datesRepDistinctDays: i.rowCnt === 1 }), o = (s) => me(wU, { ref: this.tableRef, dateProfile: n.dateProfile, dayTableModel: i, businessHours: n.businessHours, dateSelection: n.dateSelection, eventStore: n.eventStore, eventUiBases: n.eventUiBases, eventSelection: n.eventSelection, eventDrag: n.eventDrag, eventResize: n.eventResize, nextDayThreshold: e.nextDayThreshold, colGroupNode: s.tableColGroupNode, tableMinWidth: s.tableMinWidth, dayMaxEvents: e.dayMaxEvents, dayMaxEventRows: e.dayMaxEventRows, showWeekNumbers: e.weekNumbers, expandRows: !n.isHeightAuto, headerAlignElRef: this.headerElRef, clientWidth: s.clientWidth, clientHeight: s.clientHeight, forPrint: n.forPrint }); + return e.dayMinWidth ? this.renderHScrollLayout(a, o, i.colCnt, e.dayMinWidth) : this.renderSimpleLayout(a, o); + } +} +function Fwe(r, e) { + let t = new $G(r.renderRange, e); + return new HG(t, /year|month|week/.test(r.currentRangeUnit)); +} +var $we = Gs({ + name: "@fullcalendar/daygrid", + initialView: "dayGridMonth", + views: { + dayGrid: { + component: jwe, + dateProfileGeneratorClass: Nwe + }, + dayGridDay: { + type: "dayGrid", + duration: { days: 1 } + }, + dayGridWeek: { + type: "dayGrid", + duration: { weeks: 1 } + }, + dayGridMonth: { + type: "dayGrid", + duration: { months: 1 }, + fixedWeekCount: !0 + }, + dayGridYear: { + type: "dayGrid", + duration: { years: 1 } + } + } +}), Hwe = '.fc-v-event{background-color:var(--fc-event-bg-color);border:1px solid var(--fc-event-border-color);display:block}.fc-v-event .fc-event-main{color:var(--fc-event-text-color);height:100%}.fc-v-event .fc-event-main-frame{display:flex;flex-direction:column;height:100%}.fc-v-event .fc-event-time{flex-grow:0;flex-shrink:0;max-height:100%;overflow:hidden}.fc-v-event .fc-event-title-container{flex-grow:1;flex-shrink:1;min-height:0}.fc-v-event .fc-event-title{bottom:0;max-height:100%;overflow:hidden;top:0}.fc-v-event:not(.fc-event-start){border-top-left-radius:0;border-top-right-radius:0;border-top-width:0}.fc-v-event:not(.fc-event-end){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:0}.fc-v-event.fc-event-selected:before{left:-10px;right:-10px}.fc-v-event .fc-event-resizer-start{cursor:n-resize}.fc-v-event .fc-event-resizer-end{cursor:s-resize}.fc-v-event:not(.fc-event-selected) .fc-event-resizer{height:var(--fc-event-resizer-thickness);left:0;right:0}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-start{top:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event:not(.fc-event-selected) .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-thickness)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer{left:50%;margin-left:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-start{top:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc-v-event.fc-event-selected .fc-event-resizer-end{bottom:calc(var(--fc-event-resizer-dot-total-width)/-2)}.fc .fc-timegrid .fc-daygrid-body{z-index:2}.fc .fc-timegrid-divider{padding:0 0 2px}.fc .fc-timegrid-body{min-height:100%;position:relative;z-index:1}.fc .fc-timegrid-axis-chunk{position:relative}.fc .fc-timegrid-axis-chunk>table,.fc .fc-timegrid-slots{position:relative;z-index:1}.fc .fc-timegrid-slot{border-bottom:0;height:1.5em}.fc .fc-timegrid-slot:empty:before{content:"\\00a0"}.fc .fc-timegrid-slot-minor{border-top-style:dotted}.fc .fc-timegrid-slot-label-cushion{display:inline-block;white-space:nowrap}.fc .fc-timegrid-slot-label{vertical-align:middle}.fc .fc-timegrid-axis-cushion,.fc .fc-timegrid-slot-label-cushion{padding:0 4px}.fc .fc-timegrid-axis-frame-liquid{height:100%}.fc .fc-timegrid-axis-frame{align-items:center;display:flex;justify-content:flex-end;overflow:hidden}.fc .fc-timegrid-axis-cushion{flex-shrink:0;max-width:60px}.fc-direction-ltr .fc-timegrid-slot-label-frame{text-align:right}.fc-direction-rtl .fc-timegrid-slot-label-frame{text-align:left}.fc-liquid-hack .fc-timegrid-axis-frame-liquid{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col.fc-day-today{background-color:var(--fc-today-bg-color)}.fc .fc-timegrid-col-frame{min-height:100%;position:relative}.fc-media-screen.fc-liquid-hack .fc-timegrid-col-frame{bottom:0;height:auto;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols{bottom:0;left:0;position:absolute;right:0;top:0}.fc-media-screen .fc-timegrid-cols>table{height:100%}.fc-media-screen .fc-timegrid-col-bg,.fc-media-screen .fc-timegrid-col-events,.fc-media-screen .fc-timegrid-now-indicator-container{left:0;position:absolute;right:0;top:0}.fc .fc-timegrid-col-bg{z-index:2}.fc .fc-timegrid-col-bg .fc-non-business{z-index:1}.fc .fc-timegrid-col-bg .fc-bg-event{z-index:2}.fc .fc-timegrid-col-bg .fc-highlight{z-index:3}.fc .fc-timegrid-bg-harness{left:0;position:absolute;right:0}.fc .fc-timegrid-col-events{z-index:3}.fc .fc-timegrid-now-indicator-container{bottom:0;overflow:hidden}.fc-direction-ltr .fc-timegrid-col-events{margin:0 2.5% 0 2px}.fc-direction-rtl .fc-timegrid-col-events{margin:0 2px 0 2.5%}.fc-timegrid-event-harness{position:absolute}.fc-timegrid-event-harness>.fc-timegrid-event{bottom:0;left:0;position:absolute;right:0;top:0}.fc-timegrid-event-harness-inset .fc-timegrid-event,.fc-timegrid-event.fc-event-mirror,.fc-timegrid-more-link{box-shadow:0 0 0 1px var(--fc-page-bg-color)}.fc-timegrid-event,.fc-timegrid-more-link{border-radius:3px;font-size:var(--fc-small-font-size)}.fc-timegrid-event{margin-bottom:1px}.fc-timegrid-event .fc-event-main{padding:1px 1px 0}.fc-timegrid-event .fc-event-time{font-size:var(--fc-small-font-size);margin-bottom:1px;white-space:nowrap}.fc-timegrid-event-short .fc-event-main-frame{flex-direction:row;overflow:hidden}.fc-timegrid-event-short .fc-event-time:after{content:"\\00a0-\\00a0"}.fc-timegrid-event-short .fc-event-title{font-size:var(--fc-small-font-size)}.fc-timegrid-more-link{background:var(--fc-more-link-bg-color);color:var(--fc-more-link-text-color);cursor:pointer;margin-bottom:1px;position:absolute;z-index:9999}.fc-timegrid-more-link-inner{padding:3px 2px;top:0}.fc-direction-ltr .fc-timegrid-more-link{right:0}.fc-direction-rtl .fc-timegrid-more-link{left:0}.fc .fc-timegrid-now-indicator-line{border-color:var(--fc-now-indicator-color);border-style:solid;border-width:1px 0 0;left:0;position:absolute;right:0;z-index:4}.fc .fc-timegrid-now-indicator-arrow{border-color:var(--fc-now-indicator-color);border-style:solid;margin-top:-5px;position:absolute;z-index:4}.fc-direction-ltr .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 0 5px 6px;left:0}.fc-direction-rtl .fc-timegrid-now-indicator-arrow{border-bottom-color:transparent;border-top-color:transparent;border-width:5px 6px 5px 0;right:0}'; +yx(Hwe); +class Vwe extends ube { + getKeyInfo() { + return { + allDay: {}, + timed: {} + }; + } + getKeysForDateSpan(e) { + return e.allDay ? ["allDay"] : ["timed"]; + } + getKeysForEventDef(e) { + return e.allDay ? jbe(e) ? ["timed", "allDay"] : ["allDay"] : ["timed"]; + } +} +const Gwe = jn({ + hour: "numeric", + minute: "2-digit", + omitZeroMinute: !0, + meridiem: "short" +}); +function CU(r) { + let e = [ + "fc-timegrid-slot", + "fc-timegrid-slot-label", + r.isLabeled ? "fc-scrollgrid-shrink" : "fc-timegrid-slot-minor" + ]; + return me(fu.Consumer, null, (t) => { + if (!r.isLabeled) + return me("td", { className: e.join(" "), "data-time": r.isoTimeStr }); + let { dateEnv: n, options: i, viewApi: a } = t, o = ( + // TODO: fully pre-parse + i.slotLabelFormat == null ? Gwe : Array.isArray(i.slotLabelFormat) ? jn(i.slotLabelFormat[0]) : jn(i.slotLabelFormat) + ), s = { + level: 0, + time: r.time, + date: n.toDate(r.date), + view: a, + text: n.format(r.date, o) + }; + return me(ma, { elTag: "td", elClasses: e, elAttrs: { + "data-time": r.isoTimeStr + }, renderProps: s, generatorName: "slotLabelContent", customGenerator: i.slotLabelContent, defaultGenerator: Uwe, classNameGenerator: i.slotLabelClassNames, didMount: i.slotLabelDidMount, willUnmount: i.slotLabelWillUnmount }, (l) => me( + "div", + { className: "fc-timegrid-slot-label-frame fc-scrollgrid-shrink-frame" }, + me(l, { elTag: "div", elClasses: [ + "fc-timegrid-slot-label-cushion", + "fc-scrollgrid-shrink-cushion" + ] }) + )); + }); +} +function Uwe(r) { + return r.text; +} +class Wwe extends un { + render() { + return this.props.slatMetas.map((e) => me( + "tr", + { key: e.key }, + me(CU, Object.assign({}, e)) + )); + } +} +const Ywe = jn({ week: "short" }), Xwe = 5; +class Zwe extends Vs { + constructor() { + super(...arguments), this.allDaySplitter = new Vwe(), this.headerElRef = Da(), this.rootElRef = Da(), this.scrollerElRef = Da(), this.state = { + slatCoords: null + }, this.handleScrollTopRequest = (e) => { + let t = this.scrollerElRef.current; + t && (t.scrollTop = e); + }, this.renderHeadAxis = (e, t = "") => { + let { options: n } = this.context, { dateProfile: i } = this.props, a = i.renderRange, s = Ic(a.start, a.end) === 1 ? Gd(this.context, a.start, "week") : {}; + return n.weekNumbers && e === "day" ? me(tU, { elTag: "th", elClasses: [ + "fc-timegrid-axis", + "fc-scrollgrid-shrink" + ], elAttrs: { + "aria-hidden": !0 + }, date: a.start, defaultFormat: Ywe }, (l) => me( + "div", + { className: [ + "fc-timegrid-axis-frame", + "fc-scrollgrid-shrink-frame", + "fc-timegrid-axis-frame-liquid" + ].join(" "), style: { height: t } }, + me(l, { elTag: "a", elClasses: [ + "fc-timegrid-axis-cushion", + "fc-scrollgrid-shrink-cushion", + "fc-scrollgrid-sync-inner" + ], elAttrs: s }) + )) : me( + "th", + { "aria-hidden": !0, className: "fc-timegrid-axis" }, + me("div", { className: "fc-timegrid-axis-frame", style: { height: t } }) + ); + }, this.renderTableRowAxis = (e) => { + let { options: t, viewApi: n } = this.context, i = { + text: t.allDayText, + view: n + }; + return ( + // TODO: make reusable hook. used in list view too + me(ma, { elTag: "td", elClasses: [ + "fc-timegrid-axis", + "fc-scrollgrid-shrink" + ], elAttrs: { + "aria-hidden": !0 + }, renderProps: i, generatorName: "allDayContent", customGenerator: t.allDayContent, defaultGenerator: Jwe, classNameGenerator: t.allDayClassNames, didMount: t.allDayDidMount, willUnmount: t.allDayWillUnmount }, (a) => me( + "div", + { className: [ + "fc-timegrid-axis-frame", + "fc-scrollgrid-shrink-frame", + e == null ? " fc-timegrid-axis-frame-liquid" : "" + ].join(" "), style: { height: e } }, + me(a, { elTag: "span", elClasses: [ + "fc-timegrid-axis-cushion", + "fc-scrollgrid-shrink-cushion", + "fc-scrollgrid-sync-inner" + ] }) + )) + ); + }, this.handleSlatCoords = (e) => { + this.setState({ slatCoords: e }); + }; + } + // rendering + // ---------------------------------------------------------------------------------------------------- + renderSimpleLayout(e, t, n) { + let { context: i, props: a } = this, o = [], s = pb(i.options); + return e && o.push({ + type: "header", + key: "header", + isSticky: s, + chunk: { + elRef: this.headerElRef, + tableClassName: "fc-col-header", + rowContent: e + } + }), t && (o.push({ + type: "body", + key: "all-day", + chunk: { content: t } + }), o.push({ + type: "body", + key: "all-day-divider", + outerContent: ( + // TODO: rename to cellContent so don't need to define
        ? + me( + "tr", + { role: "presentation", className: "fc-scrollgrid-section" }, + me("td", { className: "fc-timegrid-divider " + i.theme.getClass("tableCellShaded") }) + ) + ) + })), o.push({ + type: "body", + key: "body", + liquid: !0, + expandRows: !!i.options.expandRows, + chunk: { + scrollerElRef: this.scrollerElRef, + content: n + } + }), me( + Hg, + { elRef: this.rootElRef, elClasses: ["fc-timegrid"], viewSpec: i.viewSpec }, + me(xM, { liquid: !a.isHeightAuto && !a.forPrint, collapsibleWidth: a.forPrint, cols: [{ width: "shrink" }], sections: o }) + ); + } + renderHScrollLayout(e, t, n, i, a, o, s) { + let l = this.context.pluginHooks.scrollGridImpl; + if (!l) + throw new Error("No ScrollGrid implementation"); + let { context: u, props: c } = this, h = !c.forPrint && pb(u.options), f = !c.forPrint && KG(u.options), v = []; + e && v.push({ + type: "header", + key: "header", + isSticky: h, + syncRowHeights: !0, + chunks: [ + { + key: "axis", + rowContent: (w) => me("tr", { role: "presentation" }, this.renderHeadAxis("day", w.rowSyncHeights[0])) + }, + { + key: "cols", + elRef: this.headerElRef, + tableClassName: "fc-col-header", + rowContent: e + } + ] + }), t && (v.push({ + type: "body", + key: "all-day", + syncRowHeights: !0, + chunks: [ + { + key: "axis", + rowContent: (w) => me("tr", { role: "presentation" }, this.renderTableRowAxis(w.rowSyncHeights[0])) + }, + { + key: "cols", + content: t + } + ] + }), v.push({ + key: "all-day-divider", + type: "body", + outerContent: ( + // TODO: rename to cellContent so don't need to define ? + me( + "tr", + { role: "presentation", className: "fc-scrollgrid-section" }, + me("td", { colSpan: 2, className: "fc-timegrid-divider " + u.theme.getClass("tableCellShaded") }) + ) + ) + })); + let b = u.options.nowIndicator; + return v.push({ + type: "body", + key: "body", + liquid: !0, + expandRows: !!u.options.expandRows, + chunks: [ + { + key: "axis", + content: (w) => ( + // TODO: make this now-indicator arrow more DRY with TimeColsContent + me( + "div", + { className: "fc-timegrid-axis-chunk" }, + me( + "table", + { "aria-hidden": !0, style: { height: w.expandRows ? w.clientHeight : "" } }, + w.tableColGroupNode, + me( + "tbody", + null, + me(Wwe, { slatMetas: o }) + ) + ), + me( + "div", + { className: "fc-timegrid-now-indicator-container" }, + me(vv, { + unit: b ? "minute" : "day" + /* hacky */ + }, (p) => { + let d = b && s && s.safeComputeTop(p); + return typeof d == "number" ? me(SM, { elClasses: ["fc-timegrid-now-indicator-arrow"], elStyle: { top: d }, isAxis: !0, date: p }) : null; + }) + ) + ) + ) + }, + { + key: "cols", + scrollerElRef: this.scrollerElRef, + content: n + } + ] + }), f && v.push({ + key: "footer", + type: "footer", + isSticky: !0, + chunks: [ + { + key: "axis", + content: aI + }, + { + key: "cols", + content: aI + } + ] + }), me( + Hg, + { elRef: this.rootElRef, elClasses: ["fc-timegrid"], viewSpec: u.viewSpec }, + me(l, { liquid: !c.isHeightAuto && !c.forPrint, forPrint: c.forPrint, collapsibleWidth: !1, colGroups: [ + { width: "shrink", cols: [{ width: "shrink" }] }, + { cols: [{ span: i, minWidth: a }] } + ], sections: v }) + ); + } + /* Dimensions + ------------------------------------------------------------------------------------------------------------------*/ + getAllDayMaxEventProps() { + let { dayMaxEvents: e, dayMaxEventRows: t } = this.context.options; + return (e === !0 || t === !0) && (e = void 0, t = Xwe), { dayMaxEvents: e, dayMaxEventRows: t }; + } +} +function Jwe(r) { + return r.text; +} +class Kwe { + constructor(e, t, n) { + this.positions = e, this.dateProfile = t, this.slotDuration = n; + } + safeComputeTop(e) { + let { dateProfile: t } = this; + if (Ql(t.currentRange, e)) { + let n = kn(e), i = e.valueOf() - n.valueOf(); + if (i >= Ls(t.slotMinTime) && i < Ls(t.slotMaxTime)) + return this.computeTimeTop(Xr(i)); + } + return null; + } + // Computes the top coordinate, relative to the bounds of the grid, of the given date. + // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight. + computeDateTop(e, t) { + return t || (t = kn(e)), this.computeTimeTop(Xr(e.valueOf() - t.valueOf())); + } + // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration). + // This is a makeshify way to compute the time-top. Assumes all slatMetas dates are uniform. + // Eventually allow computation with arbirary slat dates. + computeTimeTop(e) { + let { positions: t, dateProfile: n } = this, i = t.els.length, a = (e.milliseconds - Ls(n.slotMinTime)) / Ls(this.slotDuration), o, s; + return a = Math.max(0, a), a = Math.min(i, a), o = Math.floor(a), o = Math.min(o, i - 1), s = a - o, t.tops[o] + t.getHeight(o) * s; + } +} +class Qwe extends un { + render() { + let { props: e, context: t } = this, { options: n } = t, { slatElRefs: i } = e; + return me("tbody", null, e.slatMetas.map((a, o) => { + let s = { + time: a.time, + date: t.dateEnv.toDate(a.date), + view: t.viewApi + }; + return me( + "tr", + { key: a.key, ref: i.createRef(a.key) }, + e.axis && me(CU, Object.assign({}, a)), + me(ma, { elTag: "td", elClasses: [ + "fc-timegrid-slot", + "fc-timegrid-slot-lane", + !a.isLabeled && "fc-timegrid-slot-minor" + ], elAttrs: { + "data-time": a.isoTimeStr + }, renderProps: s, generatorName: "slotLaneContent", customGenerator: n.slotLaneContent, classNameGenerator: n.slotLaneClassNames, didMount: n.slotLaneDidMount, willUnmount: n.slotLaneWillUnmount }) + ); + })); + } +} +class qwe extends un { + constructor() { + super(...arguments), this.rootElRef = Da(), this.slatElRefs = new Zl(); + } + render() { + let { props: e, context: t } = this; + return me( + "div", + { ref: this.rootElRef, className: "fc-timegrid-slots" }, + me( + "table", + { "aria-hidden": !0, className: t.theme.getClass("table"), style: { + minWidth: e.tableMinWidth, + width: e.clientWidth, + height: e.minHeight + } }, + e.tableColGroupNode, + me(Qwe, { slatElRefs: this.slatElRefs, axis: e.axis, slatMetas: e.slatMetas }) + ) + ); + } + componentDidMount() { + this.updateSizing(); + } + componentDidUpdate() { + this.updateSizing(); + } + componentWillUnmount() { + this.props.onCoords && this.props.onCoords(null); + } + updateSizing() { + let { context: e, props: t } = this; + t.onCoords && t.clientWidth !== null && this.rootElRef.current.offsetHeight && t.onCoords(new Kwe(new Ud(this.rootElRef.current, eCe(this.slatElRefs.currentMap, t.slatMetas), !1, !0), this.props.dateProfile, e.options.slotDuration)); + } +} +function eCe(r, e) { + return e.map((t) => r[t.key]); +} +function Sp(r, e) { + let t = [], n; + for (n = 0; n < e; n += 1) + t.push([]); + if (r) + for (n = 0; n < r.length; n += 1) + t[r[n].col].push(r[n]); + return t; +} +function Vz(r, e) { + let t = []; + if (r) { + for (let n = 0; n < e; n += 1) + t[n] = { + affectedInstances: r.affectedInstances, + isEvent: r.isEvent, + segs: [] + }; + for (let n of r.segs) + t[n.col].segs.push(n); + } else + for (let n = 0; n < e; n += 1) + t[n] = null; + return t; +} +class tCe extends un { + render() { + let { props: e } = this; + return me(rU, { elClasses: ["fc-timegrid-more-link"], elStyle: { + top: e.top, + bottom: e.bottom + }, allDayDate: null, moreCnt: e.hiddenSegs.length, allSegs: e.hiddenSegs, hiddenSegs: e.hiddenSegs, extraDateSpan: e.extraDateSpan, dateProfile: e.dateProfile, todayRange: e.todayRange, popoverContent: () => IU(e.hiddenSegs, e), defaultGenerator: rCe, forceTimed: !0 }, (t) => me(t, { elTag: "div", elClasses: ["fc-timegrid-more-link-inner", "fc-sticky"] })); + } +} +function rCe(r) { + return r.shortText; +} +function nCe(r, e, t) { + let n = new PG(); + e != null && (n.strictOrder = e), t != null && (n.maxStackCnt = t); + let i = n.addSegs(r), a = ixe(i), o = iCe(n); + return o = lCe(o, 1), { segRects: uCe(o), hiddenGroups: a }; +} +function iCe(r) { + const { entriesByLevel: e } = r, t = IM((n, i) => n + ":" + i, (n, i) => { + let a = sCe(r, n, i), o = Gz(a, t), s = e[n][i]; + return [ + Object.assign(Object.assign({}, s), { nextLevelNodes: o[0] }), + s.thickness + o[1] + // the pressure builds + ]; + }); + return Gz(e.length ? { level: 0, lateralStart: 0, lateralEnd: e[0].length } : null, t)[0]; +} +function Gz(r, e) { + if (!r) + return [[], 0]; + let { level: t, lateralStart: n, lateralEnd: i } = r, a = n, o = []; + for (; a < i; ) + o.push(e(t, a)), a += 1; + return o.sort(aCe), [ + o.map(oCe), + o[0][1] + // first item's pressure + ]; +} +function aCe(r, e) { + return e[1] - r[1]; +} +function oCe(r) { + return r[0]; +} +function sCe(r, e, t) { + let { levelCoords: n, entriesByLevel: i } = r, a = i[e][t], o = n[e] + a.thickness, s = n.length, l = e; + for (; l < s && n[l] < o; l += 1) + ; + for (; l < s; l += 1) { + let u = i[l], c, h = nI(u, a.span.start, rI), f = h[0] + h[1], v = f; + for ( + ; + // loop through entries that horizontally intersect + (c = u[v]) && // but not past the whole seg list + c.span.start < a.span.end; + ) + v += 1; + if (f < v) + return { level: l, lateralStart: f, lateralEnd: v }; + } + return null; +} +function lCe(r, e) { + const t = IM((n, i, a) => Hh(n), (n, i, a) => { + let { nextLevelNodes: o, thickness: s } = n, l = s + a, u = s / l, c, h = []; + if (!o.length) + c = e; + else + for (let v of o) + if (c === void 0) { + let b = t(v, i, l); + c = b[0], h.push(b[1]); + } else { + let b = t(v, c, 0); + h.push(b[1]); + } + let f = (c - i) * u; + return [c - f, Object.assign(Object.assign({}, n), { thickness: f, nextLevelNodes: h })]; + }); + return r.map((n) => t(n, 0, 0)[1]); +} +function uCe(r) { + let e = []; + const t = IM((i, a, o) => Hh(i), (i, a, o) => { + let s = Object.assign(Object.assign({}, i), { + levelCoord: a, + stackDepth: o, + stackForward: 0 + }); + return e.push(s), s.stackForward = n(i.nextLevelNodes, a + i.thickness, o + 1) + 1; + }); + function n(i, a, o) { + let s = 0; + for (let l of i) + s = Math.max(t(l, a, o), s); + return s; + } + return n(r, 0, 0), e; +} +function IM(r, e) { + const t = {}; + return (...n) => { + let i = r(...n); + return i in t ? t[i] : t[i] = e(...n); + }; +} +function Uz(r, e, t = null, n = 0) { + let i = []; + if (t) + for (let a = 0; a < r.length; a += 1) { + let o = r[a], s = t.computeDateTop(o.start, e), l = Math.max( + s + (n || 0), + // :( + t.computeDateTop(o.end, e) + ); + i.push({ + start: Math.round(s), + end: Math.round(l) + // + }); + } + return i; +} +function cCe(r, e, t, n) { + let i = [], a = []; + for (let u = 0; u < r.length; u += 1) { + let c = e[u]; + c ? i.push({ + index: u, + thickness: 1, + span: c + }) : a.push(r[u]); + } + let { segRects: o, hiddenGroups: s } = nCe(i, t, n), l = []; + for (let u of o) + l.push({ + seg: r[u.index], + rect: u + }); + for (let u of a) + l.push({ seg: u, rect: null }); + return { segPlacements: l, hiddenGroups: s }; +} +const hCe = jn({ + hour: "numeric", + minute: "2-digit", + meridiem: !1 +}); +class TU extends un { + render() { + return me(QG, Object.assign({}, this.props, { elClasses: [ + "fc-timegrid-event", + "fc-v-event", + this.props.isShort && "fc-timegrid-event-short" + ], defaultTimeFormat: hCe })); + } +} +class fCe extends un { + constructor() { + super(...arguments), this.sortEventSegs = rr(vM); + } + // TODO: memoize event-placement? + render() { + let { props: e, context: t } = this, { options: n } = t, i = n.selectMirror, a = ( + // yuck + e.eventDrag && e.eventDrag.segs || e.eventResize && e.eventResize.segs || i && e.dateSelectionSegs || [] + ), o = ( + // TODO: messy way to compute this + e.eventDrag && e.eventDrag.affectedInstances || e.eventResize && e.eventResize.affectedInstances || {} + ), s = this.sortEventSegs(e.fgEventSegs, n.eventOrder); + return me(wM, { elTag: "td", elRef: e.elRef, elClasses: [ + "fc-timegrid-col", + ...e.extraClassNames || [] + ], elAttrs: Object.assign({ role: "gridcell" }, e.extraDataAttrs), date: e.date, dateProfile: e.dateProfile, todayRange: e.todayRange, extraRenderProps: e.extraRenderProps }, (l) => me( + "div", + { className: "fc-timegrid-col-frame" }, + me( + "div", + { className: "fc-timegrid-col-bg" }, + this.renderFillSegs(e.businessHourSegs, "non-business"), + this.renderFillSegs(e.bgEventSegs, "bg-event"), + this.renderFillSegs(e.dateSelectionSegs, "highlight") + ), + me("div", { className: "fc-timegrid-col-events" }, this.renderFgSegs(s, o, !1, !1, !1)), + me("div", { className: "fc-timegrid-col-events" }, this.renderFgSegs(a, {}, !!e.eventDrag, !!e.eventResize, !!i, "mirror")), + me("div", { className: "fc-timegrid-now-indicator-container" }, this.renderNowIndicator(e.nowIndicatorSegs)), + CM(n) && me(l, { elTag: "div", elClasses: ["fc-timegrid-col-misc"] }) + )); + } + renderFgSegs(e, t, n, i, a, o) { + let { props: s } = this; + return s.forPrint ? IU(e, s) : this.renderPositionedFgSegs(e, t, n, i, a, o); + } + renderPositionedFgSegs(e, t, n, i, a, o) { + let { eventMaxStack: s, eventShortHeight: l, eventOrderStrict: u, eventMinHeight: c } = this.context.options, { date: h, slatCoords: f, eventSelection: v, todayRange: b, nowDate: w } = this.props, p = n || i || a, d = Uz(e, h, f, c), { segPlacements: m, hiddenGroups: _ } = cCe(e, d, u, s); + return me( + Dn, + null, + this.renderHiddenGroups(_, e), + m.map((y) => { + let { seg: x, rect: g } = y, S = x.eventRange.instance.instanceId, T = p || !!(!t[S] && g), C = HC(g && g.span), E = !p && g ? this.computeSegHStyle(g) : { left: 0, right: 0 }, M = !!g && g.stackForward > 0, P = !!g && g.span.end - g.span.start < l; + return me( + "div", + { className: "fc-timegrid-event-harness" + (M ? " fc-timegrid-event-harness-inset" : ""), key: o || S, style: Object.assign(Object.assign({ visibility: T ? "" : "hidden" }, C), E) }, + me(TU, Object.assign({ seg: x, isDragging: n, isResizing: i, isDateSelecting: a, isSelected: S === v, isShort: P }, ql(x, b, w))) + ); + }) + ); + } + // will already have eventMinHeight applied because segInputs already had it + renderHiddenGroups(e, t) { + let { extraDateSpan: n, dateProfile: i, todayRange: a, nowDate: o, eventSelection: s, eventDrag: l, eventResize: u } = this.props; + return me(Dn, null, e.map((c) => { + let h = HC(c.span), f = dCe(c.entries, t); + return me(tCe, { key: pG(nU(f)), hiddenSegs: f, top: h.top, bottom: h.bottom, extraDateSpan: n, dateProfile: i, todayRange: a, nowDate: o, eventSelection: s, eventDrag: l, eventResize: u }); + })); + } + renderFillSegs(e, t) { + let { props: n, context: i } = this, o = Uz(e, n.date, n.slatCoords, i.options.eventMinHeight).map((s, l) => { + let u = e[l]; + return me("div", { key: DG(u.eventRange), className: "fc-timegrid-bg-harness", style: HC(s) }, t === "bg-event" ? me(qG, Object.assign({ seg: u }, ql(u, n.todayRange, n.nowDate))) : eU(t)); + }); + return me(Dn, null, o); + } + renderNowIndicator(e) { + let { slatCoords: t, date: n } = this.props; + return t ? e.map((i, a) => me( + SM, + { + // key doesn't matter. will only ever be one + key: a, + elClasses: ["fc-timegrid-now-indicator-line"], + elStyle: { + top: t.computeDateTop(i.start, n) + }, + isAxis: !1, + date: n + } + )) : null; + } + computeSegHStyle(e) { + let { isRtl: t, options: n } = this.context, i = n.slotEventOverlap, a = e.levelCoord, o = e.levelCoord + e.thickness, s, l; + i && (o = Math.min(1, a + (o - a) * 2)), t ? (s = 1 - o, l = a) : (s = a, l = 1 - o); + let u = { + zIndex: e.stackDepth + 1, + left: s * 100 + "%", + right: l * 100 + "%" + }; + return i && !e.stackForward && (u[t ? "marginLeft" : "marginRight"] = 10 * 2), u; + } +} +function IU(r, { todayRange: e, nowDate: t, eventSelection: n, eventDrag: i, eventResize: a }) { + let o = (i ? i.affectedInstances : null) || (a ? a.affectedInstances : null) || {}; + return me(Dn, null, r.map((s) => { + let l = s.eventRange.instance.instanceId; + return me( + "div", + { key: l, style: { visibility: o[l] ? "hidden" : "" } }, + me(TU, Object.assign({ seg: s, isDragging: !1, isResizing: !1, isDateSelecting: !1, isSelected: l === n, isShort: !1 }, ql(s, e, t))) + ); + })); +} +function HC(r) { + return r ? { + top: r.start, + bottom: -r.end + } : { top: "", bottom: "" }; +} +function dCe(r, e) { + return r.map((t) => e[t.index]); +} +class vCe extends un { + constructor() { + super(...arguments), this.splitFgEventSegs = rr(Sp), this.splitBgEventSegs = rr(Sp), this.splitBusinessHourSegs = rr(Sp), this.splitNowIndicatorSegs = rr(Sp), this.splitDateSelectionSegs = rr(Sp), this.splitEventDrag = rr(Vz), this.splitEventResize = rr(Vz), this.rootElRef = Da(), this.cellElRefs = new Zl(); + } + render() { + let { props: e, context: t } = this, n = t.options.nowIndicator && e.slatCoords && e.slatCoords.safeComputeTop(e.nowDate), i = e.cells.length, a = this.splitFgEventSegs(e.fgEventSegs, i), o = this.splitBgEventSegs(e.bgEventSegs, i), s = this.splitBusinessHourSegs(e.businessHourSegs, i), l = this.splitNowIndicatorSegs(e.nowIndicatorSegs, i), u = this.splitDateSelectionSegs(e.dateSelectionSegs, i), c = this.splitEventDrag(e.eventDrag, i), h = this.splitEventResize(e.eventResize, i); + return me( + "div", + { className: "fc-timegrid-cols", ref: this.rootElRef }, + me( + "table", + { role: "presentation", style: { + minWidth: e.tableMinWidth, + width: e.clientWidth + } }, + e.tableColGroupNode, + me( + "tbody", + { role: "presentation" }, + me( + "tr", + { role: "row" }, + e.axis && me( + "td", + { "aria-hidden": !0, className: "fc-timegrid-col fc-timegrid-axis" }, + me( + "div", + { className: "fc-timegrid-col-frame" }, + me("div", { className: "fc-timegrid-now-indicator-container" }, typeof n == "number" && me(SM, { elClasses: ["fc-timegrid-now-indicator-arrow"], elStyle: { top: n }, isAxis: !0, date: e.nowDate })) + ) + ), + e.cells.map((f, v) => me(fCe, { key: f.key, elRef: this.cellElRefs.createRef(f.key), dateProfile: e.dateProfile, date: f.date, nowDate: e.nowDate, todayRange: e.todayRange, extraRenderProps: f.extraRenderProps, extraDataAttrs: f.extraDataAttrs, extraClassNames: f.extraClassNames, extraDateSpan: f.extraDateSpan, fgEventSegs: a[v], bgEventSegs: o[v], businessHourSegs: s[v], nowIndicatorSegs: l[v], dateSelectionSegs: u[v], eventDrag: c[v], eventResize: h[v], slatCoords: e.slatCoords, eventSelection: e.eventSelection, forPrint: e.forPrint })) + ) + ) + ) + ); + } + componentDidMount() { + this.updateCoords(); + } + componentDidUpdate() { + this.updateCoords(); + } + updateCoords() { + let { props: e } = this; + e.onColCoords && e.clientWidth !== null && e.onColCoords(new Ud( + this.rootElRef.current, + pCe(this.cellElRefs.currentMap, e.cells), + !0, + // horizontal + !1 + )); + } +} +function pCe(r, e) { + return e.map((t) => r[t.key]); +} +class gCe extends Vs { + constructor() { + super(...arguments), this.processSlotOptions = rr(mCe), this.state = { + slatCoords: null + }, this.handleRootEl = (e) => { + e ? this.context.registerInteractiveComponent(this, { + el: e, + isHitComboAllowed: this.props.isHitComboAllowed + }) : this.context.unregisterInteractiveComponent(this); + }, this.handleScrollRequest = (e) => { + let { onScrollTopRequest: t } = this.props, { slatCoords: n } = this.state; + if (t && n) { + if (e.time) { + let i = n.computeTimeTop(e.time); + i = Math.ceil(i), i && (i += 1), t(i); + } + return !0; + } + return !1; + }, this.handleColCoords = (e) => { + this.colCoords = e; + }, this.handleSlatCoords = (e) => { + this.setState({ slatCoords: e }), this.props.onSlatCoords && this.props.onSlatCoords(e); + }; + } + render() { + let { props: e, state: t } = this; + return me( + "div", + { className: "fc-timegrid-body", ref: this.handleRootEl, style: { + // these props are important to give this wrapper correct dimensions for interactions + // TODO: if we set it here, can we avoid giving to inner tables? + width: e.clientWidth, + minWidth: e.tableMinWidth + } }, + me(qwe, { axis: e.axis, dateProfile: e.dateProfile, slatMetas: e.slatMetas, clientWidth: e.clientWidth, minHeight: e.expandRows ? e.clientHeight : "", tableMinWidth: e.tableMinWidth, tableColGroupNode: e.axis ? e.tableColGroupNode : null, onCoords: this.handleSlatCoords }), + me(vCe, { cells: e.cells, axis: e.axis, dateProfile: e.dateProfile, businessHourSegs: e.businessHourSegs, bgEventSegs: e.bgEventSegs, fgEventSegs: e.fgEventSegs, dateSelectionSegs: e.dateSelectionSegs, eventSelection: e.eventSelection, eventDrag: e.eventDrag, eventResize: e.eventResize, todayRange: e.todayRange, nowDate: e.nowDate, nowIndicatorSegs: e.nowIndicatorSegs, clientWidth: e.clientWidth, tableMinWidth: e.tableMinWidth, tableColGroupNode: e.tableColGroupNode, slatCoords: t.slatCoords, onColCoords: this.handleColCoords, forPrint: e.forPrint }) + ); + } + componentDidMount() { + this.scrollResponder = this.context.createScrollResponder(this.handleScrollRequest); + } + componentDidUpdate(e) { + this.scrollResponder.update(e.dateProfile !== this.props.dateProfile); + } + componentWillUnmount() { + this.scrollResponder.detach(); + } + queryHit(e, t) { + let { dateEnv: n, options: i } = this.context, { colCoords: a } = this, { dateProfile: o } = this.props, { slatCoords: s } = this.state, { snapDuration: l, snapsPerSlot: u } = this.processSlotOptions(this.props.slotDuration, i.snapDuration), c = a.leftToIndex(e), h = s.positions.topToIndex(t); + if (c != null && h != null) { + let f = this.props.cells[c], v = s.positions.tops[h], b = s.positions.getHeight(h), w = (t - v) / b, p = Math.floor(w * u), d = h * u + p, m = this.props.cells[c].date, _ = JT(o.slotMinTime, s_e(l, d)), y = n.add(m, _), x = n.add(y, l); + return { + dateProfile: o, + dateSpan: Object.assign({ range: { start: y, end: x }, allDay: !1 }, f.extraDateSpan), + dayEl: a.els[c], + rect: { + left: a.lefts[c], + right: a.rights[c], + top: v, + bottom: v + b + }, + layer: 0 + }; + } + return null; + } +} +function mCe(r, e) { + let t = e || r, n = QE(r, t); + return n === null && (t = r, n = 1), { snapDuration: t, snapsPerSlot: n }; +} +class yCe extends VG { + sliceRange(e, t) { + let n = []; + for (let i = 0; i < t.length; i += 1) { + let a = xc(e, t[i]); + a && n.push({ + start: a.start, + end: a.end, + isStart: a.start.valueOf() === e.start.valueOf(), + isEnd: a.end.valueOf() === e.end.valueOf(), + col: i + }); + } + return n; + } +} +class _Ce extends Vs { + constructor() { + super(...arguments), this.buildDayRanges = rr(bCe), this.slicer = new yCe(), this.timeColsRef = Da(); + } + render() { + let { props: e, context: t } = this, { dateProfile: n, dayTableModel: i } = e, { nowIndicator: a, nextDayThreshold: o } = t.options, s = this.buildDayRanges(i, n, t.dateEnv); + return me(vv, { unit: a ? "minute" : "day" }, (l, u) => me(gCe, Object.assign({ ref: this.timeColsRef }, this.slicer.sliceProps(e, n, null, t, s), { forPrint: e.forPrint, axis: e.axis, dateProfile: n, slatMetas: e.slatMetas, slotDuration: e.slotDuration, cells: i.cells[0], tableColGroupNode: e.tableColGroupNode, tableMinWidth: e.tableMinWidth, clientWidth: e.clientWidth, clientHeight: e.clientHeight, expandRows: e.expandRows, nowDate: l, nowIndicatorSegs: a && this.slicer.sliceNowDate(l, n, o, t, s), todayRange: u, onScrollTopRequest: e.onScrollTopRequest, onSlatCoords: e.onSlatCoords }))); + } +} +function bCe(r, e, t) { + let n = []; + for (let i of r.headerDates) + n.push({ + start: t.add(i, e.slotMinTime), + end: t.add(i, e.slotMaxTime) + }); + return n; +} +const Wz = [ + { hours: 1 }, + { minutes: 30 }, + { minutes: 15 }, + { seconds: 30 }, + { seconds: 15 } +]; +function xCe(r, e, t, n, i) { + let a = /* @__PURE__ */ new Date(0), o = r, s = Xr(0), l = t || SCe(n), u = []; + for (; Ls(o) < Ls(e); ) { + let c = i.add(a, o), h = QE(s, l) !== null; + u.push({ + date: c, + time: o, + key: c.toISOString(), + isoTimeStr: A_e(c), + isLabeled: h + }), o = JT(o, n), s = JT(s, n); + } + return u; +} +function SCe(r) { + let e, t, n; + for (e = Wz.length - 1; e >= 0; e -= 1) + if (t = Xr(Wz[e]), n = QE(t, r), n !== null && n > 1) + return t; + return r; +} +class wCe extends Zwe { + constructor() { + super(...arguments), this.buildTimeColsModel = rr(CCe), this.buildSlatMetas = rr(xCe); + } + render() { + let { options: e, dateEnv: t, dateProfileGenerator: n } = this.context, { props: i } = this, { dateProfile: a } = i, o = this.buildTimeColsModel(a, n), s = this.allDaySplitter.splitProps(i), l = this.buildSlatMetas(a.slotMinTime, a.slotMaxTime, e.slotLabelInterval, e.slotDuration, t), { dayMinWidth: u } = e, c = !u, h = u, f = e.dayHeaders && me(FG, { dates: o.headerDates, dateProfile: a, datesRepDistinctDays: !0, renderIntro: c ? this.renderHeadAxis : null }), v = e.allDaySlot !== !1 && ((w) => me(wU, Object.assign({}, s.allDay, { dateProfile: a, dayTableModel: o, nextDayThreshold: e.nextDayThreshold, tableMinWidth: w.tableMinWidth, colGroupNode: w.tableColGroupNode, renderRowIntro: c ? this.renderTableRowAxis : null, showWeekNumbers: !1, expandRows: !1, headerAlignElRef: this.headerElRef, clientWidth: w.clientWidth, clientHeight: w.clientHeight, forPrint: i.forPrint }, this.getAllDayMaxEventProps()))), b = (w) => me(_Ce, Object.assign({}, s.timed, { dayTableModel: o, dateProfile: a, axis: c, slotDuration: e.slotDuration, slatMetas: l, forPrint: i.forPrint, tableColGroupNode: w.tableColGroupNode, tableMinWidth: w.tableMinWidth, clientWidth: w.clientWidth, clientHeight: w.clientHeight, onSlatCoords: this.handleSlatCoords, expandRows: w.expandRows, onScrollTopRequest: this.handleScrollTopRequest })); + return h ? this.renderHScrollLayout(f, v, b, o.colCnt, u, l, this.state.slatCoords) : this.renderSimpleLayout(f, v, b); + } +} +function CCe(r, e) { + let t = new $G(r.renderRange, e); + return new HG(t, !1); +} +const TCe = { + allDaySlot: Boolean +}; +var ICe = Gs({ + name: "@fullcalendar/timegrid", + initialView: "timeGridWeek", + optionRefiners: TCe, + views: { + timeGrid: { + component: wCe, + usesMinMaxTime: !0, + allDaySlot: !0, + slotDuration: "00:30:00", + slotEventOverlap: !0 + // a bad name. confused with overlap/constraint system + }, + timeGridDay: { + type: "timeGrid", + duration: { days: 1 } + }, + timeGridWeek: { + type: "timeGrid", + duration: { weeks: 1 } + } + } +}); +yM.touchMouseIgnoreWait = 500; +let sI = 0, gb = 0, lI = !1; +class AU { + constructor(e) { + this.subjectEl = null, this.selector = "", this.handleSelector = "", this.shouldIgnoreMove = !1, this.shouldWatchScroll = !0, this.isDragging = !1, this.isTouchDragging = !1, this.wasTouchScroll = !1, this.handleMouseDown = (t) => { + if (!this.shouldIgnoreMouse() && ACe(t) && this.tryStart(t)) { + let n = this.createEventFromMouse(t, !0); + this.emitter.trigger("pointerdown", n), this.initScrollWatch(n), this.shouldIgnoreMove || document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("mouseup", this.handleMouseUp); + } + }, this.handleMouseMove = (t) => { + let n = this.createEventFromMouse(t); + this.recordCoords(n), this.emitter.trigger("pointermove", n); + }, this.handleMouseUp = (t) => { + document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("mouseup", this.handleMouseUp), this.emitter.trigger("pointerup", this.createEventFromMouse(t)), this.cleanup(); + }, this.handleTouchStart = (t) => { + if (this.tryStart(t)) { + this.isTouchDragging = !0; + let n = this.createEventFromTouch(t, !0); + this.emitter.trigger("pointerdown", n), this.initScrollWatch(n); + let i = t.target; + this.shouldIgnoreMove || i.addEventListener("touchmove", this.handleTouchMove), i.addEventListener("touchend", this.handleTouchEnd), i.addEventListener("touchcancel", this.handleTouchEnd), window.addEventListener("scroll", this.handleTouchScroll, !0); + } + }, this.handleTouchMove = (t) => { + let n = this.createEventFromTouch(t); + this.recordCoords(n), this.emitter.trigger("pointermove", n); + }, this.handleTouchEnd = (t) => { + if (this.isDragging) { + let n = t.target; + n.removeEventListener("touchmove", this.handleTouchMove), n.removeEventListener("touchend", this.handleTouchEnd), n.removeEventListener("touchcancel", this.handleTouchEnd), window.removeEventListener("scroll", this.handleTouchScroll, !0), this.emitter.trigger("pointerup", this.createEventFromTouch(t)), this.cleanup(), this.isTouchDragging = !1, ECe(); + } + }, this.handleTouchScroll = () => { + this.wasTouchScroll = !0; + }, this.handleScroll = (t) => { + if (!this.shouldIgnoreMove) { + let n = window.pageXOffset - this.prevScrollX + this.prevPageX, i = window.pageYOffset - this.prevScrollY + this.prevPageY; + this.emitter.trigger("pointermove", { + origEvent: t, + isTouch: this.isTouchDragging, + subjectEl: this.subjectEl, + pageX: n, + pageY: i, + deltaX: n - this.origPageX, + deltaY: i - this.origPageY + }); + } + }, this.containerEl = e, this.emitter = new Cx(), e.addEventListener("mousedown", this.handleMouseDown), e.addEventListener("touchstart", this.handleTouchStart, { passive: !0 }), MCe(); + } + destroy() { + this.containerEl.removeEventListener("mousedown", this.handleMouseDown), this.containerEl.removeEventListener("touchstart", this.handleTouchStart, { passive: !0 }), DCe(); + } + tryStart(e) { + let t = this.querySubjectEl(e), n = e.target; + return t && (!this.handleSelector || da(n, this.handleSelector)) ? (this.subjectEl = t, this.isDragging = !0, this.wasTouchScroll = !1, !0) : !1; + } + cleanup() { + lI = !1, this.isDragging = !1, this.subjectEl = null, this.destroyScrollWatch(); + } + querySubjectEl(e) { + return this.selector ? da(e.target, this.selector) : this.containerEl; + } + shouldIgnoreMouse() { + return sI || this.isTouchDragging; + } + // can be called by user of this class, to cancel touch-based scrolling for the current drag + cancelTouchScroll() { + this.isDragging && (lI = !0); + } + // Scrolling that simulates pointermoves + // ---------------------------------------------------------------------------------------------------- + initScrollWatch(e) { + this.shouldWatchScroll && (this.recordCoords(e), window.addEventListener("scroll", this.handleScroll, !0)); + } + recordCoords(e) { + this.shouldWatchScroll && (this.prevPageX = e.pageX, this.prevPageY = e.pageY, this.prevScrollX = window.pageXOffset, this.prevScrollY = window.pageYOffset); + } + destroyScrollWatch() { + this.shouldWatchScroll && window.removeEventListener("scroll", this.handleScroll, !0); + } + // Event Normalization + // ---------------------------------------------------------------------------------------------------- + createEventFromMouse(e, t) { + let n = 0, i = 0; + return t ? (this.origPageX = e.pageX, this.origPageY = e.pageY) : (n = e.pageX - this.origPageX, i = e.pageY - this.origPageY), { + origEvent: e, + isTouch: !1, + subjectEl: this.subjectEl, + pageX: e.pageX, + pageY: e.pageY, + deltaX: n, + deltaY: i + }; + } + createEventFromTouch(e, t) { + let n = e.touches, i, a, o = 0, s = 0; + return n && n.length ? (i = n[0].pageX, a = n[0].pageY) : (i = e.pageX, a = e.pageY), t ? (this.origPageX = i, this.origPageY = a) : (o = i - this.origPageX, s = a - this.origPageY), { + origEvent: e, + isTouch: !0, + subjectEl: this.subjectEl, + pageX: i, + pageY: a, + deltaX: o, + deltaY: s + }; + } +} +function ACe(r) { + return r.button === 0 && !r.ctrlKey; +} +function ECe() { + sI += 1, setTimeout(() => { + sI -= 1; + }, yM.touchMouseIgnoreWait); +} +function MCe() { + gb += 1, gb === 1 && window.addEventListener("touchmove", EU, { passive: !1 }); +} +function DCe() { + gb -= 1, gb || window.removeEventListener("touchmove", EU, { passive: !1 }); +} +function EU(r) { + lI && r.preventDefault(); +} +class kCe { + constructor() { + this.isVisible = !1, this.sourceEl = null, this.mirrorEl = null, this.sourceElRect = null, this.parentNode = document.body, this.zIndex = 9999, this.revertDuration = 0; + } + start(e, t, n) { + this.sourceEl = e, this.sourceElRect = this.sourceEl.getBoundingClientRect(), this.origScreenX = t - window.pageXOffset, this.origScreenY = n - window.pageYOffset, this.deltaX = 0, this.deltaY = 0, this.updateElPosition(); + } + handleMove(e, t) { + this.deltaX = e - window.pageXOffset - this.origScreenX, this.deltaY = t - window.pageYOffset - this.origScreenY, this.updateElPosition(); + } + // can be called before start + setIsVisible(e) { + e ? this.isVisible || (this.mirrorEl && (this.mirrorEl.style.display = ""), this.isVisible = e, this.updateElPosition()) : this.isVisible && (this.mirrorEl && (this.mirrorEl.style.display = "none"), this.isVisible = e); + } + // always async + stop(e, t) { + let n = () => { + this.cleanup(), t(); + }; + e && this.mirrorEl && this.isVisible && this.revertDuration && // if 0, transition won't work + (this.deltaX || this.deltaY) ? this.doRevertAnimation(n, this.revertDuration) : setTimeout(n, 0); + } + doRevertAnimation(e, t) { + let n = this.mirrorEl, i = this.sourceEl.getBoundingClientRect(); + n.style.transition = "top " + t + "ms,left " + t + "ms", qp(n, { + left: i.left, + top: i.top + }), W0e(n, () => { + n.style.transition = "", e(); + }); + } + cleanup() { + this.mirrorEl && (ZE(this.mirrorEl), this.mirrorEl = null), this.sourceEl = null; + } + updateElPosition() { + this.sourceEl && this.isVisible && qp(this.getMirrorEl(), { + left: this.sourceElRect.left + this.deltaX, + top: this.sourceElRect.top + this.deltaY + }); + } + getMirrorEl() { + let e = this.sourceElRect, t = this.mirrorEl; + return t || (t = this.mirrorEl = this.sourceEl.cloneNode(!0), t.style.userSelect = "none", t.classList.add("fc-event-dragging"), qp(t, { + position: "fixed", + zIndex: this.zIndex, + visibility: "", + boxSizing: "border-box", + width: e.right - e.left, + height: e.bottom - e.top, + right: "auto", + bottom: "auto", + margin: 0 + }), this.parentNode.appendChild(t)), t; + } +} +class MU extends hM { + constructor(e, t) { + super(), this.handleScroll = () => { + this.scrollTop = this.scrollController.getScrollTop(), this.scrollLeft = this.scrollController.getScrollLeft(), this.handleScrollChange(); + }, this.scrollController = e, this.doesListening = t, this.scrollTop = this.origScrollTop = e.getScrollTop(), this.scrollLeft = this.origScrollLeft = e.getScrollLeft(), this.scrollWidth = e.getScrollWidth(), this.scrollHeight = e.getScrollHeight(), this.clientWidth = e.getClientWidth(), this.clientHeight = e.getClientHeight(), this.clientRect = this.computeClientRect(), this.doesListening && this.getEventTarget().addEventListener("scroll", this.handleScroll); + } + destroy() { + this.doesListening && this.getEventTarget().removeEventListener("scroll", this.handleScroll); + } + getScrollTop() { + return this.scrollTop; + } + getScrollLeft() { + return this.scrollLeft; + } + setScrollTop(e) { + this.scrollController.setScrollTop(e), this.doesListening || (this.scrollTop = Math.max(Math.min(e, this.getMaxScrollTop()), 0), this.handleScrollChange()); + } + setScrollLeft(e) { + this.scrollController.setScrollLeft(e), this.doesListening || (this.scrollLeft = Math.max(Math.min(e, this.getMaxScrollLeft()), 0), this.handleScrollChange()); + } + getClientWidth() { + return this.clientWidth; + } + getClientHeight() { + return this.clientHeight; + } + getScrollWidth() { + return this.scrollWidth; + } + getScrollHeight() { + return this.scrollHeight; + } + handleScrollChange() { + } +} +class DU extends MU { + constructor(e, t) { + super(new Abe(e), t); + } + getEventTarget() { + return this.scrollController.el; + } + computeClientRect() { + return Sbe(this.scrollController.el); + } +} +class OCe extends MU { + constructor(e) { + super(new Ebe(), e); + } + getEventTarget() { + return window; + } + computeClientRect() { + return { + left: this.scrollLeft, + right: this.scrollLeft + this.clientWidth, + top: this.scrollTop, + bottom: this.scrollTop + this.clientHeight + }; + } + // the window is the only scroll object that changes it's rectangle relative + // to the document's topleft as it scrolls + handleScrollChange() { + this.clientRect = this.computeClientRect(); + } +} +const Yz = typeof performance == "function" ? performance.now : Date.now; +class LCe { + constructor() { + this.isEnabled = !0, this.scrollQuery = [window, ".fc-scroller"], this.edgeThreshold = 50, this.maxVelocity = 300, this.pointerScreenX = null, this.pointerScreenY = null, this.isAnimating = !1, this.scrollCaches = null, this.everMovedUp = !1, this.everMovedDown = !1, this.everMovedLeft = !1, this.everMovedRight = !1, this.animate = () => { + if (this.isAnimating) { + let e = this.computeBestEdge(this.pointerScreenX + window.pageXOffset, this.pointerScreenY + window.pageYOffset); + if (e) { + let t = Yz(); + this.handleSide(e, (t - this.msSinceRequest) / 1e3), this.requestAnimation(t); + } else + this.isAnimating = !1; + } + }; + } + start(e, t, n) { + this.isEnabled && (this.scrollCaches = this.buildCaches(n), this.pointerScreenX = null, this.pointerScreenY = null, this.everMovedUp = !1, this.everMovedDown = !1, this.everMovedLeft = !1, this.everMovedRight = !1, this.handleMove(e, t)); + } + handleMove(e, t) { + if (this.isEnabled) { + let n = e - window.pageXOffset, i = t - window.pageYOffset, a = this.pointerScreenY === null ? 0 : i - this.pointerScreenY, o = this.pointerScreenX === null ? 0 : n - this.pointerScreenX; + a < 0 ? this.everMovedUp = !0 : a > 0 && (this.everMovedDown = !0), o < 0 ? this.everMovedLeft = !0 : o > 0 && (this.everMovedRight = !0), this.pointerScreenX = n, this.pointerScreenY = i, this.isAnimating || (this.isAnimating = !0, this.requestAnimation(Yz())); + } + } + stop() { + if (this.isEnabled) { + this.isAnimating = !1; + for (let e of this.scrollCaches) + e.destroy(); + this.scrollCaches = null; + } + } + requestAnimation(e) { + this.msSinceRequest = e, requestAnimationFrame(this.animate); + } + handleSide(e, t) { + let { scrollCache: n } = e, { edgeThreshold: i } = this, a = i - e.distance, o = ( + // the closer to the edge, the faster we scroll + a * a / (i * i) * // quadratic + this.maxVelocity * t + ), s = 1; + switch (e.name) { + case "left": + s = -1; + case "right": + n.setScrollLeft(n.getScrollLeft() + o * s); + break; + case "top": + s = -1; + case "bottom": + n.setScrollTop(n.getScrollTop() + o * s); + break; + } + } + // left/top are relative to document topleft + computeBestEdge(e, t) { + let { edgeThreshold: n } = this, i = null, a = this.scrollCaches || []; + for (let o of a) { + let s = o.clientRect, l = e - s.left, u = s.right - e, c = t - s.top, h = s.bottom - t; + l >= 0 && u >= 0 && c >= 0 && h >= 0 && (c <= n && this.everMovedUp && o.canScrollUp() && (!i || i.distance > c) && (i = { scrollCache: o, name: "top", distance: c }), h <= n && this.everMovedDown && o.canScrollDown() && (!i || i.distance > h) && (i = { scrollCache: o, name: "bottom", distance: h }), l <= n && this.everMovedLeft && o.canScrollLeft() && (!i || i.distance > l) && (i = { scrollCache: o, name: "left", distance: l }), u <= n && this.everMovedRight && o.canScrollRight() && (!i || i.distance > u) && (i = { scrollCache: o, name: "right", distance: u })); + } + return i; + } + buildCaches(e) { + return this.queryScrollEls(e).map((t) => t === window ? new OCe(!1) : new DU(t, !1)); + } + queryScrollEls(e) { + let t = []; + for (let n of this.scrollQuery) + typeof n == "object" ? t.push(n) : t.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(n))); + return t; + } +} +class xm extends sxe { + constructor(e, t) { + super(e), this.containerEl = e, this.delay = null, this.minDistance = 0, this.touchScrollAllowed = !0, this.mirrorNeedsRevert = !1, this.isInteracting = !1, this.isDragging = !1, this.isDelayEnded = !1, this.isDistanceSurpassed = !1, this.delayTimeoutId = null, this.onPointerDown = (i) => { + this.isDragging || (this.isInteracting = !0, this.isDelayEnded = !1, this.isDistanceSurpassed = !1, Y0e(document.body), Z0e(document.body), i.isTouch || i.origEvent.preventDefault(), this.emitter.trigger("pointerdown", i), this.isInteracting && // not destroyed via pointerdown handler + !this.pointer.shouldIgnoreMove && (this.mirror.setIsVisible(!1), this.mirror.start(i.subjectEl, i.pageX, i.pageY), this.startDelay(i), this.minDistance || this.handleDistanceSurpassed(i))); + }, this.onPointerMove = (i) => { + if (this.isInteracting) { + if (this.emitter.trigger("pointermove", i), !this.isDistanceSurpassed) { + let a = this.minDistance, o, { deltaX: s, deltaY: l } = i; + o = s * s + l * l, o >= a * a && this.handleDistanceSurpassed(i); + } + this.isDragging && (i.origEvent.type !== "scroll" && (this.mirror.handleMove(i.pageX, i.pageY), this.autoScroller.handleMove(i.pageX, i.pageY)), this.emitter.trigger("dragmove", i)); + } + }, this.onPointerUp = (i) => { + this.isInteracting && (this.isInteracting = !1, X0e(document.body), J0e(document.body), this.emitter.trigger("pointerup", i), this.isDragging && (this.autoScroller.stop(), this.tryStopDrag(i)), this.delayTimeoutId && (clearTimeout(this.delayTimeoutId), this.delayTimeoutId = null)); + }; + let n = this.pointer = new AU(e); + n.emitter.on("pointerdown", this.onPointerDown), n.emitter.on("pointermove", this.onPointerMove), n.emitter.on("pointerup", this.onPointerUp), t && (n.selector = t), this.mirror = new kCe(), this.autoScroller = new LCe(); + } + destroy() { + this.pointer.destroy(), this.onPointerUp({}); + } + startDelay(e) { + typeof this.delay == "number" ? this.delayTimeoutId = setTimeout(() => { + this.delayTimeoutId = null, this.handleDelayEnd(e); + }, this.delay) : this.handleDelayEnd(e); + } + handleDelayEnd(e) { + this.isDelayEnded = !0, this.tryStartDrag(e); + } + handleDistanceSurpassed(e) { + this.isDistanceSurpassed = !0, this.tryStartDrag(e); + } + tryStartDrag(e) { + this.isDelayEnded && this.isDistanceSurpassed && (!this.pointer.wasTouchScroll || this.touchScrollAllowed) && (this.isDragging = !0, this.mirrorNeedsRevert = !1, this.autoScroller.start(e.pageX, e.pageY, this.containerEl), this.emitter.trigger("dragstart", e), this.touchScrollAllowed === !1 && this.pointer.cancelTouchScroll()); + } + tryStopDrag(e) { + this.mirror.stop(this.mirrorNeedsRevert, this.stopDrag.bind(this, e)); + } + stopDrag(e) { + this.isDragging = !1, this.emitter.trigger("dragend", e); + } + // fill in the implementations... + setIgnoreMove(e) { + this.pointer.shouldIgnoreMove = e; + } + setMirrorIsVisible(e) { + this.mirror.setIsVisible(e); + } + setMirrorNeedsRevert(e) { + this.mirrorNeedsRevert = e; + } + setAutoScrollEnabled(e) { + this.autoScroller.isEnabled = e; + } +} +class PCe { + constructor(e) { + this.origRect = cM(e), this.scrollCaches = CG(e).map((t) => new DU(t, !0)); + } + destroy() { + for (let e of this.scrollCaches) + e.destroy(); + } + computeLeft() { + let e = this.origRect.left; + for (let t of this.scrollCaches) + e += t.origScrollLeft - t.getScrollLeft(); + return e; + } + computeTop() { + let e = this.origRect.top; + for (let t of this.scrollCaches) + e += t.origScrollTop - t.getScrollTop(); + return e; + } + isWithinClipping(e, t) { + let n = { left: e, top: t }; + for (let i of this.scrollCaches) + if (!RCe(i.getEventTarget()) && !ibe(n, i.clientRect)) + return !1; + return !0; + } +} +function RCe(r) { + let e = r.tagName; + return e === "HTML" || e === "BODY"; +} +class Ix { + constructor(e, t) { + this.useSubjectCenter = !1, this.requireInitial = !0, this.initialHit = null, this.movingHit = null, this.finalHit = null, this.handlePointerDown = (n) => { + let { dragging: i } = this; + this.initialHit = null, this.movingHit = null, this.finalHit = null, this.prepareHits(), this.processFirstCoord(n), this.initialHit || !this.requireInitial ? (i.setIgnoreMove(!1), this.emitter.trigger("pointerdown", n)) : i.setIgnoreMove(!0); + }, this.handleDragStart = (n) => { + this.emitter.trigger("dragstart", n), this.handleMove(n, !0); + }, this.handleDragMove = (n) => { + this.emitter.trigger("dragmove", n), this.handleMove(n); + }, this.handlePointerUp = (n) => { + this.releaseHits(), this.emitter.trigger("pointerup", n); + }, this.handleDragEnd = (n) => { + this.movingHit && this.emitter.trigger("hitupdate", null, !0, n), this.finalHit = this.movingHit, this.movingHit = null, this.emitter.trigger("dragend", n); + }, this.droppableStore = t, e.emitter.on("pointerdown", this.handlePointerDown), e.emitter.on("dragstart", this.handleDragStart), e.emitter.on("dragmove", this.handleDragMove), e.emitter.on("pointerup", this.handlePointerUp), e.emitter.on("dragend", this.handleDragEnd), this.dragging = e, this.emitter = new Cx(); + } + // sets initialHit + // sets coordAdjust + processFirstCoord(e) { + let t = { left: e.pageX, top: e.pageY }, n = t, i = e.subjectEl, a; + i instanceof HTMLElement && (a = cM(i), n = abe(n, a)); + let o = this.initialHit = this.queryHitForOffset(n.left, n.top); + if (o) { + if (this.useSubjectCenter && a) { + let s = xG(a, o.rect); + s && (n = obe(s)); + } + this.coordAdjust = sbe(n, t); + } else + this.coordAdjust = { left: 0, top: 0 }; + } + handleMove(e, t) { + let n = this.queryHitForOffset(e.pageX + this.coordAdjust.left, e.pageY + this.coordAdjust.top); + (t || !Ax(this.movingHit, n)) && (this.movingHit = n, this.emitter.trigger("hitupdate", n, !1, e)); + } + prepareHits() { + this.offsetTrackers = su(this.droppableStore, (e) => (e.component.prepareHits(), new PCe(e.el))); + } + releaseHits() { + let { offsetTrackers: e } = this; + for (let t in e) + e[t].destroy(); + this.offsetTrackers = {}; + } + queryHitForOffset(e, t) { + let { droppableStore: n, offsetTrackers: i } = this, a = null; + for (let o in n) { + let s = n[o].component, l = i[o]; + if (l && // wasn't destroyed mid-drag + l.isWithinClipping(e, t)) { + let u = l.computeLeft(), c = l.computeTop(), h = e - u, f = t - c, { origRect: v } = l, b = v.right - v.left, w = v.bottom - v.top; + if ( + // must be within the element's bounds + h >= 0 && h < b && f >= 0 && f < w + ) { + let p = s.queryHit(h, f, b, w); + p && // make sure the hit is within activeRange, meaning it's not a dead cell + xx(p.dateProfile.activeRange, p.dateSpan.range) && (!a || p.layer > a.layer) && (p.componentId = o, p.context = s.context, p.rect.left += u, p.rect.right += u, p.rect.top += c, p.rect.bottom += c, a = p); + } + } + } + return a; + } +} +function Ax(r, e) { + return !r && !e ? !0 : !!r != !!e ? !1 : Xbe(r.dateSpan, e.dateSpan); +} +function kU(r, e) { + let t = {}; + for (let n of e.pluginHooks.datePointTransforms) + Object.assign(t, n(r, e)); + return Object.assign(t, NCe(r, e.dateEnv)), t; +} +function NCe(r, e) { + return { + date: e.toDate(r.range.start), + dateStr: e.formatIso(r.range.start, { omitTime: r.allDay }), + allDay: r.allDay + }; +} +class zCe extends dv { + constructor(e) { + super(e), this.handlePointerDown = (n) => { + let { dragging: i } = this, a = n.origEvent.target; + i.setIgnoreMove(!this.component.isValidDateDownEl(a)); + }, this.handleDragEnd = (n) => { + let { component: i } = this, { pointer: a } = this.dragging; + if (!a.wasTouchScroll) { + let { initialHit: o, finalHit: s } = this.hitDragging; + if (o && s && Ax(o, s)) { + let { context: l } = i, u = Object.assign(Object.assign({}, kU(o.dateSpan, l)), { dayEl: o.dayEl, jsEvent: n.origEvent, view: l.viewApi || l.calendarApi.view }); + l.emitter.trigger("dateClick", u); + } + } + }, this.dragging = new xm(e.el), this.dragging.autoScroller.isEnabled = !1; + let t = this.hitDragging = new Ix(this.dragging, mM(e)); + t.emitter.on("pointerdown", this.handlePointerDown), t.emitter.on("dragend", this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } +} +class BCe extends dv { + constructor(e) { + super(e), this.dragSelection = null, this.handlePointerDown = (o) => { + let { component: s, dragging: l } = this, { options: u } = s.context, c = u.selectable && s.isValidDateDownEl(o.origEvent.target); + l.setIgnoreMove(!c), l.delay = o.isTouch ? jCe(s) : null; + }, this.handleDragStart = (o) => { + this.component.context.calendarApi.unselect(o); + }, this.handleHitUpdate = (o, s) => { + let { context: l } = this.component, u = null, c = !1; + if (o) { + let h = this.hitDragging.initialHit; + o.componentId === h.componentId && this.isHitComboAllowed && !this.isHitComboAllowed(h, o) || (u = FCe(h, o, l.pluginHooks.dateSelectionTransformers)), (!u || !wxe(u, o.dateProfile, l)) && (c = !0, u = null); + } + u ? l.dispatch({ type: "SELECT_DATES", selection: u }) : s || l.dispatch({ type: "UNSELECT_DATES" }), c ? JE() : KE(), s || (this.dragSelection = u); + }, this.handlePointerUp = (o) => { + this.dragSelection && (AG(this.dragSelection, o, this.component.context), this.dragSelection = null); + }; + let { component: t } = e, { options: n } = t.context, i = this.dragging = new xm(e.el); + i.touchScrollAllowed = !1, i.minDistance = n.selectMinDistance || 0, i.autoScroller.isEnabled = n.dragScroll; + let a = this.hitDragging = new Ix(this.dragging, mM(e)); + a.emitter.on("pointerdown", this.handlePointerDown), a.emitter.on("dragstart", this.handleDragStart), a.emitter.on("hitupdate", this.handleHitUpdate), a.emitter.on("pointerup", this.handlePointerUp); + } + destroy() { + this.dragging.destroy(); + } +} +function jCe(r) { + let { options: e } = r.context, t = e.selectLongPressDelay; + return t == null && (t = e.longPressDelay), t; +} +function FCe(r, e, t) { + let n = r.dateSpan, i = e.dateSpan, a = [ + n.range.start, + n.range.end, + i.range.start, + i.range.end + ]; + a.sort(t_e); + let o = {}; + for (let s of t) { + let l = s(r, e); + if (l === !1) + return null; + l && Object.assign(o, l); + } + return o.range = { start: a[0], end: a[3] }, o.allDay = n.allDay, o; +} +class Sm extends dv { + constructor(e) { + super(e), this.subjectEl = null, this.subjectSeg = null, this.isDragging = !1, this.eventRange = null, this.relevantEvents = null, this.receivingContext = null, this.validMutation = null, this.mutatedRelevantEvents = null, this.handlePointerDown = (o) => { + let s = o.origEvent.target, { component: l, dragging: u } = this, { mirror: c } = u, { options: h } = l.context, f = l.context; + this.subjectEl = o.subjectEl; + let v = this.subjectSeg = Wd(o.subjectEl), w = (this.eventRange = v.eventRange).instance.instanceId; + this.relevantEvents = iM(f.getCurrentData().eventStore, w), u.minDistance = o.isTouch ? 0 : h.eventDragMinDistance, u.delay = // only do a touch delay if touch and this event hasn't been selected yet + o.isTouch && w !== l.props.eventSelection ? HCe(l) : null, h.fixedMirrorParent ? c.parentNode = h.fixedMirrorParent : c.parentNode = da(s, ".fc"), c.revertDuration = h.dragRevertDuration; + let p = l.isValidSegDownEl(s) && !da(s, ".fc-event-resizer"); + u.setIgnoreMove(!p), this.isDragging = p && o.subjectEl.classList.contains("fc-event-draggable"); + }, this.handleDragStart = (o) => { + let s = this.component.context, l = this.eventRange, u = l.instance.instanceId; + o.isTouch ? u !== this.component.props.eventSelection && s.dispatch({ type: "SELECT_EVENT", eventInstanceId: u }) : s.dispatch({ type: "UNSELECT_EVENT" }), this.isDragging && (s.calendarApi.unselect(o), s.emitter.trigger("eventDragStart", { + el: this.subjectEl, + event: new Gn(s, l.def, l.instance), + jsEvent: o.origEvent, + view: s.viewApi + })); + }, this.handleHitUpdate = (o, s) => { + if (!this.isDragging) + return; + let l = this.relevantEvents, u = this.hitDragging.initialHit, c = this.component.context, h = null, f = null, v = null, b = !1, w = { + affectedEvents: l, + mutatedEvents: xo(), + isEvent: !0 + }; + if (o) { + h = o.context; + let p = h.options; + c === h || p.editable && p.droppable ? (f = $Ce(u, o, h.getCurrentData().pluginHooks.eventDragMutationMassagers), f && (v = dM(l, h.getCurrentData().eventUiBases, f, h), w.mutatedEvents = v, WG(w, o.dateProfile, h) || (b = !0, f = null, v = null, w.mutatedEvents = xo()))) : h = null; + } + this.displayDrag(h, w), b ? JE() : KE(), s || (c === h && // TODO: write test for this + Ax(u, o) && (f = null), this.dragging.setMirrorNeedsRevert(!f), this.dragging.setMirrorIsVisible(!o || !this.subjectEl.getRootNode().querySelector(".fc-event-mirror")), this.receivingContext = h, this.validMutation = f, this.mutatedRelevantEvents = v); + }, this.handlePointerUp = () => { + this.isDragging || this.cleanup(); + }, this.handleDragEnd = (o) => { + if (this.isDragging) { + let s = this.component.context, l = s.viewApi, { receivingContext: u, validMutation: c } = this, h = this.eventRange.def, f = this.eventRange.instance, v = new Gn(s, h, f), b = this.relevantEvents, w = this.mutatedRelevantEvents, { finalHit: p } = this.hitDragging; + if (this.clearDrag(), s.emitter.trigger("eventDragStop", { + el: this.subjectEl, + event: v, + jsEvent: o.origEvent, + view: l + }), c) { + if (u === s) { + let d = new Gn(s, w.defs[h.defId], f ? w.instances[f.instanceId] : null); + s.dispatch({ + type: "MERGE_EVENTS", + eventStore: w + }); + let m = { + oldEvent: v, + event: d, + relatedEvents: $h(w, s, f), + revert() { + s.dispatch({ + type: "MERGE_EVENTS", + eventStore: b + // the pre-change data + }); + } + }, _ = {}; + for (let y of s.getCurrentData().pluginHooks.eventDropTransformers) + Object.assign(_, y(c, s)); + s.emitter.trigger("eventDrop", Object.assign(Object.assign(Object.assign({}, m), _), { el: o.subjectEl, delta: c.datesDelta, jsEvent: o.origEvent, view: l })), s.emitter.trigger("eventChange", m); + } else if (u) { + let d = { + event: v, + relatedEvents: $h(b, s, f), + revert() { + s.dispatch({ + type: "MERGE_EVENTS", + eventStore: b + }); + } + }; + s.emitter.trigger("eventLeave", Object.assign(Object.assign({}, d), { draggedEl: o.subjectEl, view: l })), s.dispatch({ + type: "REMOVE_EVENTS", + eventStore: b + }), s.emitter.trigger("eventRemove", d); + let m = w.defs[h.defId], _ = w.instances[f.instanceId], y = new Gn(u, m, _); + u.dispatch({ + type: "MERGE_EVENTS", + eventStore: w + }); + let x = { + event: y, + relatedEvents: $h(w, u, _), + revert() { + u.dispatch({ + type: "REMOVE_EVENTS", + eventStore: w + }); + } + }; + u.emitter.trigger("eventAdd", x), o.isTouch && u.dispatch({ + type: "SELECT_EVENT", + eventInstanceId: f.instanceId + }), u.emitter.trigger("drop", Object.assign(Object.assign({}, kU(p.dateSpan, u)), { draggedEl: o.subjectEl, jsEvent: o.origEvent, view: p.context.viewApi })), u.emitter.trigger("eventReceive", Object.assign(Object.assign({}, x), { draggedEl: o.subjectEl, view: p.context.viewApi })); + } + } else + s.emitter.trigger("_noEventDrop"); + } + this.cleanup(); + }; + let { component: t } = this, { options: n } = t.context, i = this.dragging = new xm(e.el); + i.pointer.selector = Sm.SELECTOR, i.touchScrollAllowed = !1, i.autoScroller.isEnabled = n.dragScroll; + let a = this.hitDragging = new Ix(this.dragging, iI); + a.useSubjectCenter = e.useEventCenter, a.emitter.on("pointerdown", this.handlePointerDown), a.emitter.on("dragstart", this.handleDragStart), a.emitter.on("hitupdate", this.handleHitUpdate), a.emitter.on("pointerup", this.handlePointerUp), a.emitter.on("dragend", this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } + // render a drag state on the next receivingCalendar + displayDrag(e, t) { + let n = this.component.context, i = this.receivingContext; + i && i !== e && (i === n ? i.dispatch({ + type: "SET_EVENT_DRAG", + state: { + affectedEvents: t.affectedEvents, + mutatedEvents: xo(), + isEvent: !0 + } + }) : i.dispatch({ type: "UNSET_EVENT_DRAG" })), e && e.dispatch({ type: "SET_EVENT_DRAG", state: t }); + } + clearDrag() { + let e = this.component.context, { receivingContext: t } = this; + t && t.dispatch({ type: "UNSET_EVENT_DRAG" }), e !== t && e.dispatch({ type: "UNSET_EVENT_DRAG" }); + } + cleanup() { + this.subjectSeg = null, this.isDragging = !1, this.eventRange = null, this.relevantEvents = null, this.receivingContext = null, this.validMutation = null, this.mutatedRelevantEvents = null; + } +} +Sm.SELECTOR = ".fc-event-draggable, .fc-event-resizable"; +function $Ce(r, e, t) { + let n = r.dateSpan, i = e.dateSpan, a = n.range.start, o = i.range.start, s = {}; + n.allDay !== i.allDay && (s.allDay = i.allDay, s.hasEnd = e.context.options.allDayMaintainDuration, i.allDay && (a = kn(a))); + let l = pd(a, o, r.context.dateEnv, r.componentId === e.componentId ? r.largeUnit : null); + l.milliseconds && (s.allDay = !1); + let u = { + datesDelta: l, + standardProps: s + }; + for (let c of t) + c(u, r, e); + return u; +} +function HCe(r) { + let { options: e } = r.context, t = e.eventLongPressDelay; + return t == null && (t = e.longPressDelay), t; +} +class VCe extends dv { + constructor(e) { + super(e), this.draggingSegEl = null, this.draggingSeg = null, this.eventRange = null, this.relevantEvents = null, this.validMutation = null, this.mutatedRelevantEvents = null, this.handlePointerDown = (a) => { + let { component: o } = this, s = this.querySegEl(a), l = Wd(s), u = this.eventRange = l.eventRange; + this.dragging.minDistance = o.context.options.eventDragMinDistance, this.dragging.setIgnoreMove(!this.component.isValidSegDownEl(a.origEvent.target) || a.isTouch && this.component.props.eventSelection !== u.instance.instanceId); + }, this.handleDragStart = (a) => { + let { context: o } = this.component, s = this.eventRange; + this.relevantEvents = iM(o.getCurrentData().eventStore, this.eventRange.instance.instanceId); + let l = this.querySegEl(a); + this.draggingSegEl = l, this.draggingSeg = Wd(l), o.calendarApi.unselect(), o.emitter.trigger("eventResizeStart", { + el: l, + event: new Gn(o, s.def, s.instance), + jsEvent: a.origEvent, + view: o.viewApi + }); + }, this.handleHitUpdate = (a, o, s) => { + let { context: l } = this.component, u = this.relevantEvents, c = this.hitDragging.initialHit, h = this.eventRange.instance, f = null, v = null, b = !1, w = { + affectedEvents: u, + mutatedEvents: xo(), + isEvent: !0 + }; + a && (a.componentId === c.componentId && this.isHitComboAllowed && !this.isHitComboAllowed(c, a) || (f = GCe(c, a, s.subjectEl.classList.contains("fc-event-resizer-start"), h.range))), f && (v = dM(u, l.getCurrentData().eventUiBases, f, l), w.mutatedEvents = v, WG(w, a.dateProfile, l) || (b = !0, f = null, v = null, w.mutatedEvents = null)), v ? l.dispatch({ + type: "SET_EVENT_RESIZE", + state: w + }) : l.dispatch({ type: "UNSET_EVENT_RESIZE" }), b ? JE() : KE(), o || (f && Ax(c, a) && (f = null), this.validMutation = f, this.mutatedRelevantEvents = v); + }, this.handleDragEnd = (a) => { + let { context: o } = this.component, s = this.eventRange.def, l = this.eventRange.instance, u = new Gn(o, s, l), c = this.relevantEvents, h = this.mutatedRelevantEvents; + if (o.emitter.trigger("eventResizeStop", { + el: this.draggingSegEl, + event: u, + jsEvent: a.origEvent, + view: o.viewApi + }), this.validMutation) { + let f = new Gn(o, h.defs[s.defId], l ? h.instances[l.instanceId] : null); + o.dispatch({ + type: "MERGE_EVENTS", + eventStore: h + }); + let v = { + oldEvent: u, + event: f, + relatedEvents: $h(h, o, l), + revert() { + o.dispatch({ + type: "MERGE_EVENTS", + eventStore: c + // the pre-change events + }); + } + }; + o.emitter.trigger("eventResize", Object.assign(Object.assign({}, v), { el: this.draggingSegEl, startDelta: this.validMutation.startDelta || Xr(0), endDelta: this.validMutation.endDelta || Xr(0), jsEvent: a.origEvent, view: o.viewApi })), o.emitter.trigger("eventChange", v); + } else + o.emitter.trigger("_noEventResize"); + this.draggingSeg = null, this.relevantEvents = null, this.validMutation = null; + }; + let { component: t } = e, n = this.dragging = new xm(e.el); + n.pointer.selector = ".fc-event-resizer", n.touchScrollAllowed = !1, n.autoScroller.isEnabled = t.context.options.dragScroll; + let i = this.hitDragging = new Ix(this.dragging, mM(e)); + i.emitter.on("pointerdown", this.handlePointerDown), i.emitter.on("dragstart", this.handleDragStart), i.emitter.on("hitupdate", this.handleHitUpdate), i.emitter.on("dragend", this.handleDragEnd); + } + destroy() { + this.dragging.destroy(); + } + querySegEl(e) { + return da(e.subjectEl, ".fc-event"); + } +} +function GCe(r, e, t, n) { + let i = r.context.dateEnv, a = r.dateSpan.range.start, o = e.dateSpan.range.start, s = pd(a, o, i, r.largeUnit); + if (t) { + if (i.add(n.start, s) < n.end) + return { startDelta: s }; + } else if (i.add(n.end, s) > n.start) + return { endDelta: s }; + return null; +} +class UCe { + constructor(e) { + this.context = e, this.isRecentPointerDateSelect = !1, this.matchesCancel = !1, this.matchesEvent = !1, this.onSelect = (n) => { + n.jsEvent && (this.isRecentPointerDateSelect = !0); + }, this.onDocumentPointerDown = (n) => { + let i = this.context.options.unselectCancel, a = uG(n.origEvent); + this.matchesCancel = !!da(a, i), this.matchesEvent = !!da(a, Sm.SELECTOR); + }, this.onDocumentPointerUp = (n) => { + let { context: i } = this, { documentPointer: a } = this, o = i.getCurrentData(); + if (!a.wasTouchScroll) { + if (o.dateSelection && // an existing date selection? + !this.isRecentPointerDateSelect) { + let s = i.options.unselectAuto; + s && (!s || !this.matchesCancel) && i.calendarApi.unselect(n); + } + o.eventSelection && // an existing event selected? + !this.matchesEvent && i.dispatch({ type: "UNSELECT_EVENT" }); + } + this.isRecentPointerDateSelect = !1; + }; + let t = this.documentPointer = new AU(document); + t.shouldIgnoreMove = !0, t.shouldWatchScroll = !1, t.emitter.on("pointerdown", this.onDocumentPointerDown), t.emitter.on("pointerup", this.onDocumentPointerUp), e.emitter.on("select", this.onSelect); + } + destroy() { + this.context.emitter.off("select", this.onSelect), this.documentPointer.destroy(); + } +} +const WCe = { + fixedMirrorParent: $e +}, YCe = { + dateClick: $e, + eventDragStart: $e, + eventDragStop: $e, + eventDrop: $e, + eventResizeStart: $e, + eventResizeStop: $e, + eventResize: $e, + drop: $e, + eventReceive: $e, + eventLeave: $e +}; +yM.dataAttrPrefix = ""; +var XCe = Gs({ + name: "@fullcalendar/interaction", + componentInteractions: [zCe, BCe, Sm, VCe], + calendarInteractions: [UCe], + elementDraggingImpl: xm, + optionRefiners: WCe, + listenerRefiners: YCe +}), ZCe = ':root{--fc-list-event-dot-width:10px;--fc-list-event-hover-bg-color:#f5f5f5}.fc-theme-standard .fc-list{border:1px solid var(--fc-border-color)}.fc .fc-list-empty{align-items:center;background-color:var(--fc-neutral-bg-color);display:flex;height:100%;justify-content:center}.fc .fc-list-empty-cushion{margin:5em 0}.fc .fc-list-table{border-style:hidden;width:100%}.fc .fc-list-table tr>*{border-left:0;border-right:0}.fc .fc-list-sticky .fc-list-day>*{background:var(--fc-page-bg-color);position:sticky;top:0}.fc .fc-list-table thead{left:-10000px;position:absolute}.fc .fc-list-table tbody>tr:first-child th{border-top:0}.fc .fc-list-table th{padding:0}.fc .fc-list-day-cushion,.fc .fc-list-table td{padding:8px 14px}.fc .fc-list-day-cushion:after{clear:both;content:"";display:table}.fc-theme-standard .fc-list-day-cushion{background-color:var(--fc-neutral-bg-color)}.fc-direction-ltr .fc-list-day-text,.fc-direction-rtl .fc-list-day-side-text{float:left}.fc-direction-ltr .fc-list-day-side-text,.fc-direction-rtl .fc-list-day-text{float:right}.fc-direction-ltr .fc-list-table .fc-list-event-graphic{padding-right:0}.fc-direction-rtl .fc-list-table .fc-list-event-graphic{padding-left:0}.fc .fc-list-event.fc-event-forced-url{cursor:pointer}.fc .fc-list-event:hover td{background-color:var(--fc-list-event-hover-bg-color)}.fc .fc-list-event-graphic,.fc .fc-list-event-time{white-space:nowrap;width:1px}.fc .fc-list-event-dot{border:calc(var(--fc-list-event-dot-width)/2) solid var(--fc-event-border-color);border-radius:calc(var(--fc-list-event-dot-width)/2);box-sizing:content-box;display:inline-block;height:0;width:0}.fc .fc-list-event-title a{color:inherit;text-decoration:none}.fc .fc-list-event.fc-event-forced-url:hover a{text-decoration:underline}'; +yx(ZCe); +class JCe extends un { + constructor() { + super(...arguments), this.state = { + textId: cc() + }; + } + render() { + let { theme: e, dateEnv: t, options: n, viewApi: i } = this.context, { cellId: a, dayDate: o, todayRange: s } = this.props, { textId: l } = this.state, u = uM(o, s), c = n.listDayFormat ? t.format(o, n.listDayFormat) : "", h = n.listDaySideFormat ? t.format(o, n.listDaySideFormat) : "", f = Object.assign({ + date: t.toDate(o), + view: i, + textId: l, + text: c, + sideText: h, + navLinkAttrs: Gd(this.context, o), + sideNavLinkAttrs: Gd(this.context, o, "day", !1) + }, u); + return me(ma, { elTag: "tr", elClasses: [ + "fc-list-day", + ...Sx(u, e) + ], elAttrs: { + "data-date": ym(o) + }, renderProps: f, generatorName: "dayHeaderContent", customGenerator: n.dayHeaderContent, defaultGenerator: KCe, classNameGenerator: n.dayHeaderClassNames, didMount: n.dayHeaderDidMount, willUnmount: n.dayHeaderWillUnmount }, (v) => ( + // TODO: force-hide top border based on :first-child + me( + "th", + { scope: "colgroup", colSpan: 3, id: a, "aria-labelledby": l }, + me(v, { elTag: "div", elClasses: [ + "fc-list-day-cushion", + e.getClass("tableCellShaded") + ] }) + ) + )); + } +} +function KCe(r) { + return me( + Dn, + null, + r.text && me("a", Object.assign({ id: r.textId, className: "fc-list-day-text" }, r.navLinkAttrs), r.text), + r.sideText && /* not keyboard tabbable */ + me("a", Object.assign({ "aria-hidden": !0, className: "fc-list-day-side-text" }, r.sideNavLinkAttrs), r.sideText) + ); +} +const QCe = jn({ + hour: "numeric", + minute: "2-digit", + meridiem: "short" +}); +class qCe extends un { + render() { + let { props: e, context: t } = this, { options: n } = t, { seg: i, timeHeaderId: a, eventHeaderId: o, dateHeaderId: s } = e, l = n.eventTimeFormat || QCe; + return me(Tx, Object.assign({}, e, { elTag: "tr", elClasses: [ + "fc-list-event", + i.eventRange.def.url && "fc-event-forced-url" + ], defaultGenerator: () => e1e(i, t), seg: i, timeText: "", disableDragging: !0, disableResizing: !0 }), (u, c) => me( + Dn, + null, + t1e(i, l, t, a, s), + me( + "td", + { "aria-hidden": !0, className: "fc-list-event-graphic" }, + me("span", { className: "fc-list-event-dot", style: { + borderColor: c.borderColor || c.backgroundColor + } }) + ), + me(u, { elTag: "td", elClasses: ["fc-list-event-title"], elAttrs: { headers: `${o} ${s}` } }) + )); + } +} +function e1e(r, e) { + let t = pM(r, e); + return me("a", Object.assign({}, t), r.eventRange.def.title); +} +function t1e(r, e, t, n, i) { + let { options: a } = t; + if (a.displayEventTime !== !1) { + let o = r.eventRange.def, s = r.eventRange.instance, l = !1, u; + if (o.allDay ? l = !0 : nbe(r.eventRange.range) ? r.isStart ? u = rg(r, e, t, null, null, s.range.start, r.end) : r.isEnd ? u = rg(r, e, t, null, null, r.start, s.range.end) : l = !0 : u = rg(r, e, t), l) { + let c = { + text: t.options.allDayText, + view: t.viewApi + }; + return me(ma, { elTag: "td", elClasses: ["fc-list-event-time"], elAttrs: { + headers: `${n} ${i}` + }, renderProps: c, generatorName: "allDayContent", customGenerator: a.allDayContent, defaultGenerator: r1e, classNameGenerator: a.allDayClassNames, didMount: a.allDayDidMount, willUnmount: a.allDayWillUnmount }); + } + return me("td", { className: "fc-list-event-time" }, u); + } + return null; +} +function r1e(r) { + return r.text; +} +class n1e extends Vs { + constructor() { + super(...arguments), this.computeDateVars = rr(a1e), this.eventStoreToSegs = rr(this._eventStoreToSegs), this.state = { + timeHeaderId: cc(), + eventHeaderId: cc(), + dateHeaderIdRoot: cc() + }, this.setRootEl = (e) => { + e ? this.context.registerInteractiveComponent(this, { + el: e + }) : this.context.unregisterInteractiveComponent(this); + }; + } + render() { + let { props: e, context: t } = this, { dayDates: n, dayRanges: i } = this.computeDateVars(e.dateProfile), a = this.eventStoreToSegs(e.eventStore, e.eventUiBases, i); + return me( + Hg, + { elRef: this.setRootEl, elClasses: [ + "fc-list", + t.theme.getClass("table"), + t.options.stickyHeaderDates !== !1 ? "fc-list-sticky" : "" + ], viewSpec: t.viewSpec }, + me(ZG, { liquid: !e.isHeightAuto, overflowX: e.isHeightAuto ? "visible" : "hidden", overflowY: e.isHeightAuto ? "visible" : "auto" }, a.length > 0 ? this.renderSegList(a, n) : this.renderEmptyMessage()) + ); + } + renderEmptyMessage() { + let { options: e, viewApi: t } = this.context, n = { + text: e.noEventsText, + view: t + }; + return me(ma, { elTag: "div", elClasses: ["fc-list-empty"], renderProps: n, generatorName: "noEventsContent", customGenerator: e.noEventsContent, defaultGenerator: i1e, classNameGenerator: e.noEventsClassNames, didMount: e.noEventsDidMount, willUnmount: e.noEventsWillUnmount }, (i) => me(i, { elTag: "div", elClasses: ["fc-list-empty-cushion"] })); + } + renderSegList(e, t) { + let { theme: n, options: i } = this.context, { timeHeaderId: a, eventHeaderId: o, dateHeaderIdRoot: s } = this.state, l = o1e(e); + return me(vv, { unit: "day" }, (u, c) => { + let h = []; + for (let f = 0; f < l.length; f += 1) { + let v = l[f]; + if (v) { + let b = ym(t[f]), w = s + "-" + b; + h.push(me(JCe, { key: b, cellId: w, dayDate: t[f], todayRange: c })), v = vM(v, i.eventOrder); + for (let p of v) + h.push(me(qCe, Object.assign({ key: b + ":" + p.eventRange.instance.instanceId, seg: p, isDragging: !1, isResizing: !1, isDateSelecting: !1, isSelected: !1, timeHeaderId: a, eventHeaderId: o, dateHeaderId: w }, ql(p, c, u)))); + } + } + return me( + "table", + { className: "fc-list-table " + n.getClass("table") }, + me( + "thead", + null, + me( + "tr", + null, + me("th", { scope: "col", id: a }, i.timeHint), + me("th", { scope: "col", "aria-hidden": !0 }), + me("th", { scope: "col", id: o }, i.eventHint) + ) + ), + me("tbody", null, h) + ); + }); + } + _eventStoreToSegs(e, t, n) { + return this.eventRangesToSegs(tI(e, t, this.props.dateProfile.activeRange, this.context.options.nextDayThreshold).fg, n); + } + eventRangesToSegs(e, t) { + let n = []; + for (let i of e) + n.push(...this.eventRangeToSegs(i, t)); + return n; + } + eventRangeToSegs(e, t) { + let { dateEnv: n } = this.context, { nextDayThreshold: i } = this.context.options, a = e.range, o = e.def.allDay, s, l, u, c = []; + for (s = 0; s < t.length; s += 1) + if (l = xc(a, t[s]), l && (u = { + component: this, + eventRange: e, + start: l.start, + end: l.end, + isStart: e.isStart && l.start.valueOf() === a.start.valueOf(), + isEnd: e.isEnd && l.end.valueOf() === a.end.valueOf(), + dayIndex: s + }, c.push(u), !u.isEnd && !o && s + 1 < t.length && a.end < n.add(t[s + 1].start, i))) { + u.end = a.end, u.isEnd = !0; + break; + } + return c; + } +} +function i1e(r) { + return r.text; +} +function a1e(r) { + let e = kn(r.renderRange.start), t = r.renderRange.end, n = [], i = []; + for (; e < t; ) + n.push(e), i.push({ + start: e, + end: Bi(e, 1) + }), e = Bi(e, 1); + return { dayDates: n, dayRanges: i }; +} +function o1e(r) { + let e = [], t, n; + for (t = 0; t < r.length; t += 1) + n = r[t], (e[n.dayIndex] || (e[n.dayIndex] = [])).push(n); + return e; +} +const s1e = { + listDayFormat: Xz, + listDaySideFormat: Xz, + noEventsClassNames: $e, + noEventsContent: $e, + noEventsDidMount: $e, + noEventsWillUnmount: $e + // noEventsText is defined in base options +}; +function Xz(r) { + return r === !1 ? null : jn(r); +} +var l1e = Gs({ + name: "@fullcalendar/list", + optionRefiners: s1e, + views: { + list: { + component: n1e, + buttonTextKey: "list", + listDayFormat: { month: "long", day: "numeric", year: "numeric" } + // like "January 1, 2016" + }, + listDay: { + type: "list", + duration: { days: 1 }, + listDayFormat: { weekday: "long" } + // day-of-week is all we need. full date is probably in headerToolbar + }, + listWeek: { + type: "list", + duration: { weeks: 1 }, + listDayFormat: { weekday: "long" }, + listDaySideFormat: { month: "long", day: "numeric", year: "numeric" } + }, + listMonth: { + type: "list", + duration: { month: 1 }, + listDaySideFormat: { weekday: "long" } + // day-of-week is nice-to-have + }, + listYear: { + type: "list", + duration: { year: 1 }, + listDaySideFormat: { weekday: "long" } + // day-of-week is nice-to-have + } + } +}), u1e = { + code: "af", + week: { + dow: 1, + doy: 4 + // Die week wat die 4de Januarie bevat is die eerste week van die jaar. + }, + buttonText: { + prev: "Vorige", + next: "Volgende", + today: "Vandag", + year: "Jaar", + month: "Maand", + week: "Week", + day: "Dag", + list: "Agenda" + }, + allDayText: "Heeldag", + moreLinkText: "Addisionele", + noEventsText: "Daar is geen gebeurtenisse nie" +}, c1e = { + code: "ar-dz", + week: { + dow: 0, + doy: 4 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, h1e = { + code: "ar-kw", + week: { + dow: 0, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, f1e = { + code: "ar-ly", + week: { + dow: 6, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, d1e = { + code: "ar-ma", + week: { + dow: 6, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, v1e = { + code: "ar-sa", + week: { + dow: 0, + doy: 6 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, p1e = { + code: "ar-tn", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, g1e = { + code: "ar", + week: { + dow: 6, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "السابق", + next: "التالي", + today: "اليوم", + year: "سنة", + month: "شهر", + week: "أسبوع", + day: "يوم", + list: "أجندة" + }, + weekText: "أسبوع", + allDayText: "اليوم كله", + moreLinkText: "أخرى", + noEventsText: "أي أحداث لعرض" +}, m1e = { + code: "az", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Əvvəl", + next: "Sonra", + today: "Bu Gün", + year: "Il", + month: "Ay", + week: "Həftə", + day: "Gün", + list: "Gündəm" + }, + weekText: "Həftə", + allDayText: "Bütün Gün", + moreLinkText(r) { + return "+ daha çox " + r; + }, + noEventsText: "Göstərmək üçün hadisə yoxdur" +}, y1e = { + code: "bg", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "назад", + next: "напред", + today: "днес", + year: "година", + month: "Месец", + week: "Седмица", + day: "Ден", + list: "График" + }, + allDayText: "Цял ден", + moreLinkText(r) { + return "+още " + r; + }, + noEventsText: "Няма събития за показване" +}, _1e = { + code: "bn", + week: { + dow: 0, + doy: 6 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "পেছনে", + next: "সামনে", + today: "আজ", + year: "বছর", + month: "মাস", + week: "সপ্তাহ", + day: "দিন", + list: "তালিকা" + }, + weekText: "সপ্তাহ", + allDayText: "সারাদিন", + moreLinkText(r) { + return "+অন্যান্য " + r; + }, + noEventsText: "কোনো ইভেন্ট নেই" +}, b1e = { + code: "bs", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Prošli", + next: "Sljedeći", + today: "Danas", + year: "Godina", + month: "Mjesec", + week: "Sedmica", + day: "Dan", + list: "Raspored" + }, + weekText: "Sed", + allDayText: "Cijeli dan", + moreLinkText(r) { + return "+ još " + r; + }, + noEventsText: "Nema događaja za prikazivanje" +}, x1e = { + code: "ca", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Anterior", + next: "Següent", + today: "Avui", + year: "Curs", + month: "Mes", + week: "Setmana", + day: "Dia", + list: "Agenda" + }, + weekText: "Set", + allDayText: "Tot el dia", + moreLinkText: "més", + noEventsText: "No hi ha esdeveniments per mostrar" +}, S1e = { + code: "cs", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Dříve", + next: "Později", + today: "Nyní", + year: "Rok", + month: "Měsíc", + week: "Týden", + day: "Den", + list: "Agenda" + }, + weekText: "Týd", + allDayText: "Celý den", + moreLinkText(r) { + return "+další: " + r; + }, + noEventsText: "Žádné akce k zobrazení" +}, w1e = { + code: "cy", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Blaenorol", + next: "Nesaf", + today: "Heddiw", + year: "Blwyddyn", + month: "Mis", + week: "Wythnos", + day: "Dydd", + list: "Rhestr" + }, + weekText: "Wythnos", + allDayText: "Trwy'r dydd", + moreLinkText: "Mwy", + noEventsText: "Dim digwyddiadau" +}, C1e = { + code: "da", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Forrige", + next: "Næste", + today: "I dag", + year: "År", + month: "Måned", + week: "Uge", + day: "Dag", + list: "Agenda" + }, + weekText: "Uge", + allDayText: "Hele dagen", + moreLinkText: "flere", + noEventsText: "Ingen arrangementer at vise" +}; +function VC(r) { + return r === "Tag" || r === "Monat" ? "r" : r === "Jahr" ? "s" : ""; +} +var T1e = { + code: "de-at", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Zurück", + next: "Vor", + today: "Heute", + year: "Jahr", + month: "Monat", + week: "Woche", + day: "Tag", + list: "Terminübersicht" + }, + weekText: "KW", + weekTextLong: "Woche", + allDayText: "Ganztägig", + moreLinkText(r) { + return "+ weitere " + r; + }, + noEventsText: "Keine Ereignisse anzuzeigen", + buttonHints: { + prev(r) { + return `Vorherige${VC(r)} ${r}`; + }, + next(r) { + return `Nächste${VC(r)} ${r}`; + }, + today(r) { + return r === "Tag" ? "Heute" : `Diese${VC(r)} ${r}`; + } + }, + viewHint(r) { + return r + (r === "Woche" ? "n" : r === "Monat" ? "s" : "es") + "ansicht"; + }, + navLinkHint: "Gehe zu $0", + moreLinkHint(r) { + return "Zeige " + (r === 1 ? "ein weiteres Ereignis" : r + " weitere Ereignisse"); + }, + closeHint: "Schließen", + timeHint: "Uhrzeit", + eventHint: "Ereignis" +}; +function GC(r) { + return r === "Tag" || r === "Monat" ? "r" : r === "Jahr" ? "s" : ""; +} +var I1e = { + code: "de", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Zurück", + next: "Vor", + today: "Heute", + year: "Jahr", + month: "Monat", + week: "Woche", + day: "Tag", + list: "Terminübersicht" + }, + weekText: "KW", + weekTextLong: "Woche", + allDayText: "Ganztägig", + moreLinkText(r) { + return "+ weitere " + r; + }, + noEventsText: "Keine Ereignisse anzuzeigen", + buttonHints: { + prev(r) { + return `Vorherige${GC(r)} ${r}`; + }, + next(r) { + return `Nächste${GC(r)} ${r}`; + }, + today(r) { + return r === "Tag" ? "Heute" : `Diese${GC(r)} ${r}`; + } + }, + viewHint(r) { + return r + (r === "Woche" ? "n" : r === "Monat" ? "s" : "es") + "ansicht"; + }, + navLinkHint: "Gehe zu $0", + moreLinkHint(r) { + return "Zeige " + (r === 1 ? "ein weiteres Ereignis" : r + " weitere Ereignisse"); + }, + closeHint: "Schließen", + timeHint: "Uhrzeit", + eventHint: "Ereignis" +}, A1e = { + code: "el", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4st is the first week of the year. + }, + buttonText: { + prev: "Προηγούμενος", + next: "Επόμενος", + today: "Σήμερα", + year: "Ετος", + month: "Μήνας", + week: "Εβδομάδα", + day: "Ημέρα", + list: "Ατζέντα" + }, + weekText: "Εβδ", + allDayText: "Ολοήμερο", + moreLinkText: "περισσότερα", + noEventsText: "Δεν υπάρχουν γεγονότα προς εμφάνιση" +}, E1e = { + code: "en-au", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonHints: { + prev: "Previous $0", + next: "Next $0", + today: "This $0" + }, + viewHint: "$0 view", + navLinkHint: "Go to $0", + moreLinkHint(r) { + return `Show ${r} more event${r === 1 ? "" : "s"}`; + } +}, M1e = { + code: "en-gb", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonHints: { + prev: "Previous $0", + next: "Next $0", + today: "This $0" + }, + viewHint: "$0 view", + navLinkHint: "Go to $0", + moreLinkHint(r) { + return `Show ${r} more event${r === 1 ? "" : "s"}`; + } +}, D1e = { + code: "en-nz", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonHints: { + prev: "Previous $0", + next: "Next $0", + today: "This $0" + }, + viewHint: "$0 view", + navLinkHint: "Go to $0", + moreLinkHint(r) { + return `Show ${r} more event${r === 1 ? "" : "s"}`; + } +}, k1e = { + code: "eo", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Antaŭa", + next: "Sekva", + today: "Hodiaŭ", + year: "Jaro", + month: "Monato", + week: "Semajno", + day: "Tago", + list: "Tagordo" + }, + weekText: "Sm", + allDayText: "Tuta tago", + moreLinkText: "pli", + noEventsText: "Neniuj eventoj por montri" +}, O1e = { + code: "es", + week: { + dow: 0, + doy: 6 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Ant", + next: "Sig", + today: "Hoy", + year: "Año", + month: "Mes", + week: "Semana", + day: "Día", + list: "Agenda" + }, + weekText: "Sm", + allDayText: "Todo el día", + moreLinkText: "más", + noEventsText: "No hay eventos para mostrar" +}, L1e = { + code: "es", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Ant", + next: "Sig", + today: "Hoy", + year: "Año", + month: "Mes", + week: "Semana", + day: "Día", + list: "Agenda" + }, + buttonHints: { + prev: "$0 antes", + next: "$0 siguiente", + today(r) { + return r === "Día" ? "Hoy" : (r === "Semana" ? "Esta" : "Este") + " " + r.toLocaleLowerCase(); + } + }, + viewHint(r) { + return "Vista " + (r === "Semana" ? "de la" : "del") + " " + r.toLocaleLowerCase(); + }, + weekText: "Sm", + weekTextLong: "Semana", + allDayText: "Todo el día", + moreLinkText: "más", + moreLinkHint(r) { + return `Mostrar ${r} eventos más`; + }, + noEventsText: "No hay eventos para mostrar", + navLinkHint: "Ir al $0", + closeHint: "Cerrar", + timeHint: "La hora", + eventHint: "Evento" +}, P1e = { + code: "et", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Eelnev", + next: "Järgnev", + today: "Täna", + year: "Aasta", + month: "Kuu", + week: "Nädal", + day: "Päev", + list: "Päevakord" + }, + weekText: "näd", + allDayText: "Kogu päev", + moreLinkText(r) { + return "+ veel " + r; + }, + noEventsText: "Kuvamiseks puuduvad sündmused" +}, R1e = { + code: "eu", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Aur", + next: "Hur", + today: "Gaur", + year: "Urtea", + month: "Hilabetea", + week: "Astea", + day: "Eguna", + list: "Agenda" + }, + weekText: "As", + allDayText: "Egun osoa", + moreLinkText: "gehiago", + noEventsText: "Ez dago ekitaldirik erakusteko" +}, N1e = { + code: "fa", + week: { + dow: 6, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "قبلی", + next: "بعدی", + today: "امروز", + year: "سال", + month: "ماه", + week: "هفته", + day: "روز", + list: "برنامه" + }, + weekText: "هف", + allDayText: "تمام روز", + moreLinkText(r) { + return "بیش از " + r; + }, + noEventsText: "هیچ رویدادی به نمایش" +}, z1e = { + code: "fi", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Edellinen", + next: "Seuraava", + today: "Tänään", + year: "Vuosi", + month: "Kuukausi", + week: "Viikko", + day: "Päivä", + list: "Tapahtumat" + }, + weekText: "Vk", + allDayText: "Koko päivä", + moreLinkText: "lisää", + noEventsText: "Ei näytettäviä tapahtumia" +}, B1e = { + code: "fr", + buttonText: { + prev: "Précédent", + next: "Suivant", + today: "Aujourd'hui", + year: "Année", + month: "Mois", + week: "Semaine", + day: "Jour", + list: "Mon planning" + }, + weekText: "Sem.", + allDayText: "Toute la journée", + moreLinkText: "en plus", + noEventsText: "Aucun évènement à afficher" +}, j1e = { + code: "fr-ch", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Précédent", + next: "Suivant", + today: "Courant", + year: "Année", + month: "Mois", + week: "Semaine", + day: "Jour", + list: "Mon planning" + }, + weekText: "Sm", + allDayText: "Toute la journée", + moreLinkText: "en plus", + noEventsText: "Aucun évènement à afficher" +}, F1e = { + code: "fr", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Précédent", + next: "Suivant", + today: "Aujourd'hui", + year: "Année", + month: "Mois", + week: "Semaine", + day: "Jour", + list: "Planning" + }, + weekText: "Sem.", + weekTextLong: "Semaine", + allDayText: "Toute la journée", + moreLinkText: "en plus", + noEventsText: "Aucun évènement à afficher" +}, $1e = { + code: "gl", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Ant", + next: "Seg", + today: "Hoxe", + year: "Ano", + month: "Mes", + week: "Semana", + day: "Día", + list: "Axenda" + }, + buttonHints: { + prev: "$0 antes", + next: "$0 seguinte", + today(r) { + return r === "Día" ? "Hoxe" : (r === "Semana" ? "Esta" : "Este") + " " + r.toLocaleLowerCase(); + } + }, + viewHint(r) { + return "Vista " + (r === "Semana" ? "da" : "do") + " " + r.toLocaleLowerCase(); + }, + weekText: "Sm", + weekTextLong: "Semana", + allDayText: "Todo o día", + moreLinkText: "máis", + moreLinkHint(r) { + return `Amosar ${r} eventos máis`; + }, + noEventsText: "Non hai eventos para amosar", + navLinkHint: "Ir ao $0", + closeHint: "Pechar", + timeHint: "A hora", + eventHint: "Evento" +}, H1e = { + code: "he", + direction: "rtl", + buttonText: { + prev: "הקודם", + next: "הבא", + today: "היום", + year: "שנה", + month: "חודש", + week: "שבוע", + day: "יום", + list: "סדר יום" + }, + allDayText: "כל היום", + moreLinkText: "נוספים", + noEventsText: "אין אירועים להצגה", + weekText: "שבוע" +}, V1e = { + code: "hi", + week: { + dow: 0, + doy: 6 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "पिछला", + next: "अगला", + today: "आज", + year: "वर्ष", + month: "महीना", + week: "सप्ताह", + day: "दिन", + list: "कार्यसूची" + }, + weekText: "हफ्ता", + allDayText: "सभी दिन", + moreLinkText(r) { + return "+अधिक " + r; + }, + noEventsText: "कोई घटनाओं को प्रदर्शित करने के लिए" +}, G1e = { + code: "hr", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Prijašnji", + next: "Sljedeći", + today: "Danas", + year: "Godina", + month: "Mjesec", + week: "Tjedan", + day: "Dan", + list: "Raspored" + }, + weekText: "Tje", + allDayText: "Cijeli dan", + moreLinkText(r) { + return "+ još " + r; + }, + noEventsText: "Nema događaja za prikaz" +}, U1e = { + code: "hu", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "vissza", + next: "előre", + today: "ma", + year: "Év", + month: "Hónap", + week: "Hét", + day: "Nap", + list: "Lista" + }, + weekText: "Hét", + allDayText: "Egész nap", + moreLinkText: "további", + noEventsText: "Nincs megjeleníthető esemény" +}, W1e = { + code: "hy-am", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Նախորդ", + next: "Հաջորդ", + today: "Այսօր", + year: "Տարի", + month: "Ամիս", + week: "Շաբաթ", + day: "Օր", + list: "Օրվա ցուցակ" + }, + weekText: "Շաբ", + allDayText: "Ամբողջ օր", + moreLinkText(r) { + return "+ ևս " + r; + }, + noEventsText: "Բացակայում է իրադարձությունը ցուցադրելու" +}, Y1e = { + code: "id", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "mundur", + next: "maju", + today: "hari ini", + year: "Tahun", + month: "Bulan", + week: "Minggu", + day: "Hari", + list: "Agenda" + }, + weekText: "Mg", + allDayText: "Sehari penuh", + moreLinkText: "lebih", + noEventsText: "Tidak ada acara untuk ditampilkan" +}, X1e = { + code: "is", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Fyrri", + next: "Næsti", + today: "Í dag", + year: "Ár", + month: "Mánuður", + week: "Vika", + day: "Dagur", + list: "Dagskrá" + }, + weekText: "Vika", + allDayText: "Allan daginn", + moreLinkText: "meira", + noEventsText: "Engir viðburðir til að sýna" +}, Z1e = { + code: "it", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Prec", + next: "Succ", + today: "Oggi", + year: "Anno", + month: "Mese", + week: "Settimana", + day: "Giorno", + list: "Agenda" + }, + weekText: "Sm", + allDayText: "Tutto il giorno", + moreLinkText(r) { + return "+altri " + r; + }, + noEventsText: "Non ci sono eventi da visualizzare" +}, J1e = { + code: "ja", + buttonText: { + prev: "前", + next: "次", + today: "今日", + year: "年", + month: "月", + week: "週", + day: "日", + list: "予定リスト" + }, + weekText: "週", + allDayText: "終日", + moreLinkText(r) { + return "他 " + r + " 件"; + }, + noEventsText: "表示する予定はありません" +}, K1e = { + code: "ka", + week: { + dow: 1, + doy: 7 + }, + buttonText: { + prev: "წინა", + next: "შემდეგი", + today: "დღეს", + year: "წელიწადი", + month: "თვე", + week: "კვირა", + day: "დღე", + list: "დღის წესრიგი" + }, + weekText: "კვ", + allDayText: "მთელი დღე", + moreLinkText(r) { + return "+ კიდევ " + r; + }, + noEventsText: "ღონისძიებები არ არის" +}, Q1e = { + code: "kk", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Алдыңғы", + next: "Келесі", + today: "Бүгін", + year: "Жыл", + month: "Ай", + week: "Апта", + day: "Күн", + list: "Күн тәртібі" + }, + weekText: "Не", + allDayText: "Күні бойы", + moreLinkText(r) { + return "+ тағы " + r; + }, + noEventsText: "Көрсету үшін оқиғалар жоқ" +}, q1e = { + code: "km", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "មុន", + next: "បន្ទាប់", + today: "ថ្ងៃនេះ", + year: "ឆ្នាំ", + month: "ខែ", + week: "សប្តាហ៍", + day: "ថ្ងៃ", + list: "បញ្ជី" + }, + weekText: "សប្តាហ៍", + allDayText: "ពេញមួយថ្ងៃ", + moreLinkText: "ច្រើនទៀត", + noEventsText: "គ្មានព្រឹត្តិការណ៍ត្រូវបង្ហាញ" +}, eTe = { + code: "ko", + buttonText: { + prev: "이전달", + next: "다음달", + today: "오늘", + year: "년도", + month: "월", + week: "주", + day: "일", + list: "일정목록" + }, + weekText: "주", + allDayText: "종일", + moreLinkText: "개", + noEventsText: "일정이 없습니다" +}, tTe = { + code: "ku", + week: { + dow: 6, + doy: 12 + // The week that contains Jan 1st is the first week of the year. + }, + direction: "rtl", + buttonText: { + prev: "پێشتر", + next: "دواتر", + today: "ئەمڕو", + year: "ساڵ", + month: "مانگ", + week: "هەفتە", + day: "ڕۆژ", + list: "بەرنامە" + }, + weekText: "هەفتە", + allDayText: "هەموو ڕۆژەکە", + moreLinkText: "زیاتر", + noEventsText: "هیچ ڕووداوێك نیە" +}, rTe = { + code: "lb", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Zréck", + next: "Weider", + today: "Haut", + year: "Joer", + month: "Mount", + week: "Woch", + day: "Dag", + list: "Terminiwwersiicht" + }, + weekText: "W", + allDayText: "Ganzen Dag", + moreLinkText: "méi", + noEventsText: "Nee Evenementer ze affichéieren" +}, nTe = { + code: "lt", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Atgal", + next: "Pirmyn", + today: "Šiandien", + year: "Metai", + month: "Mėnuo", + week: "Savaitė", + day: "Diena", + list: "Darbotvarkė" + }, + weekText: "SAV", + allDayText: "Visą dieną", + moreLinkText: "daugiau", + noEventsText: "Nėra įvykių rodyti" +}, iTe = { + code: "lv", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Iepr.", + next: "Nāk.", + today: "Šodien", + year: "Gads", + month: "Mēnesis", + week: "Nedēļa", + day: "Diena", + list: "Dienas kārtība" + }, + weekText: "Ned.", + allDayText: "Visu dienu", + moreLinkText(r) { + return "+vēl " + r; + }, + noEventsText: "Nav notikumu" +}, aTe = { + code: "mk", + buttonText: { + prev: "претходно", + next: "следно", + today: "Денес", + year: "година", + month: "Месец", + week: "Недела", + day: "Ден", + list: "График" + }, + weekText: "Сед", + allDayText: "Цел ден", + moreLinkText(r) { + return "+повеќе " + r; + }, + noEventsText: "Нема настани за прикажување" +}, oTe = { + code: "ms", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Sebelum", + next: "Selepas", + today: "hari ini", + year: "Tahun", + month: "Bulan", + week: "Minggu", + day: "Hari", + list: "Agenda" + }, + weekText: "Mg", + allDayText: "Sepanjang hari", + moreLinkText(r) { + return "masih ada " + r + " acara"; + }, + noEventsText: "Tiada peristiwa untuk dipaparkan" +}, sTe = { + code: "nb", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Forrige", + next: "Neste", + today: "I dag", + year: "År", + month: "Måned", + week: "Uke", + day: "Dag", + list: "Agenda" + }, + weekText: "Uke", + weekTextLong: "Uke", + allDayText: "Hele dagen", + moreLinkText: "til", + noEventsText: "Ingen hendelser å vise", + buttonHints: { + prev: "Forrige $0", + next: "Neste $0", + today: "Nåværende $0" + }, + viewHint: "$0 visning", + navLinkHint: "Gå til $0", + moreLinkHint(r) { + return `Vis ${r} flere hendelse${r === 1 ? "" : "r"}`; + } +}, lTe = { + code: "ne", + week: { + dow: 7, + doy: 1 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "अघिल्लो", + next: "अर्को", + today: "आज", + year: "वर्ष", + month: "महिना", + week: "हप्ता", + day: "दिन", + list: "सूची" + }, + weekText: "हप्ता", + allDayText: "दिनभरि", + moreLinkText: "थप लिंक", + noEventsText: "देखाउनको लागि कुनै घटनाहरू छैनन्" +}, uTe = { + code: "nl", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Vorige", + next: "Volgende", + today: "Vandaag", + year: "Jaar", + month: "Maand", + week: "Week", + day: "Dag", + list: "Agenda" + }, + allDayText: "Hele dag", + moreLinkText: "extra", + noEventsText: "Geen evenementen om te laten zien" +}, cTe = { + code: "nn", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Førre", + next: "Neste", + today: "I dag", + year: "År", + month: "Månad", + week: "Veke", + day: "Dag", + list: "Agenda" + }, + weekText: "Veke", + allDayText: "Heile dagen", + moreLinkText: "til", + noEventsText: "Ingen hendelser å vise" +}, hTe = { + code: "pl", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Poprzedni", + next: "Następny", + today: "Dziś", + year: "Rok", + month: "Miesiąc", + week: "Tydzień", + day: "Dzień", + list: "Plan dnia" + }, + weekText: "Tydz", + allDayText: "Cały dzień", + moreLinkText: "więcej", + noEventsText: "Brak wydarzeń do wyświetlenia" +}, fTe = { + code: "pt-br", + buttonText: { + prev: "Anterior", + next: "Próximo", + prevYear: "Ano anterior", + nextYear: "Próximo ano", + year: "Ano", + today: "Hoje", + month: "Mês", + week: "Semana", + day: "Dia", + list: "Lista" + }, + buttonHints: { + prev: "$0 Anterior", + next: "Próximo $0", + today(r) { + return r === "Dia" ? "Hoje" : (r === "Semana" ? "Esta" : "Este") + " " + r.toLocaleLowerCase(); + } + }, + viewHint(r) { + return "Visualizar " + (r === "Semana" ? "a" : "o") + " " + r.toLocaleLowerCase(); + }, + weekText: "Sm", + weekTextLong: "Semana", + allDayText: "dia inteiro", + moreLinkText(r) { + return "mais +" + r; + }, + moreLinkHint(r) { + return `Mostrar mais ${r} eventos`; + }, + noEventsText: "Não há eventos para mostrar", + navLinkHint: "Ir para $0", + closeHint: "Fechar", + timeHint: "A hora", + eventHint: "Evento" +}, dTe = { + code: "pt", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Anterior", + next: "Seguinte", + today: "Hoje", + year: "Ano", + month: "Mês", + week: "Semana", + day: "Dia", + list: "Agenda" + }, + weekText: "Sem", + allDayText: "Todo o dia", + moreLinkText: "mais", + noEventsText: "Não há eventos para mostrar" +}, vTe = { + code: "ro", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "precedentă", + next: "următoare", + today: "Azi", + year: "An", + month: "Lună", + week: "Săptămână", + day: "Zi", + list: "Agendă" + }, + weekText: "Săpt", + allDayText: "Toată ziua", + moreLinkText(r) { + return "+alte " + r; + }, + noEventsText: "Nu există evenimente de afișat" +}, pTe = { + code: "ru", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Пред", + next: "След", + today: "Сегодня", + year: "Год", + month: "Месяц", + week: "Неделя", + day: "День", + list: "Повестка дня" + }, + weekText: "Нед", + allDayText: "Весь день", + moreLinkText(r) { + return "+ ещё " + r; + }, + noEventsText: "Нет событий для отображения" +}, gTe = { + code: "si-lk", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "පෙර", + next: "පසු", + today: "අද", + year: "අවුරුදු", + month: "මාසය", + week: "සතිය", + day: "දවස", + list: "ලැයිස්තුව" + }, + weekText: "සති", + allDayText: "සියලු", + moreLinkText: "තවත්", + noEventsText: "මුකුත් නැත" +}, mTe = { + code: "sk", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Predchádzajúci", + next: "Nasledujúci", + today: "Dnes", + year: "Rok", + month: "Mesiac", + week: "Týždeň", + day: "Deň", + list: "Rozvrh" + }, + weekText: "Ty", + allDayText: "Celý deň", + moreLinkText(r) { + return "+ďalšie: " + r; + }, + noEventsText: "Žiadne akcie na zobrazenie" +}, yTe = { + code: "sl", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Prejšnji", + next: "Naslednji", + today: "Trenutni", + year: "Leto", + month: "Mesec", + week: "Teden", + day: "Dan", + list: "Dnevni red" + }, + weekText: "Teden", + allDayText: "Ves dan", + moreLinkText: "več", + noEventsText: "Ni dogodkov za prikaz" +}, _Te = { + code: "sm", + buttonText: { + prev: "Talu ai", + next: "Mulimuli atu", + today: "Aso nei", + year: "Tausaga", + month: "Masina", + week: "Vaiaso", + day: "Aso", + list: "Faasologa" + }, + weekText: "Vaiaso", + allDayText: "Aso atoa", + moreLinkText: "sili atu", + noEventsText: "Leai ni mea na tutupu" +}, bTe = { + code: "sq", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "mbrapa", + next: "Përpara", + today: "Sot", + year: "Viti", + month: "Muaj", + week: "Javë", + day: "Ditë", + list: "Listë" + }, + weekText: "Ja", + allDayText: "Gjithë ditën", + moreLinkText(r) { + return "+më tepër " + r; + }, + noEventsText: "Nuk ka evente për të shfaqur" +}, xTe = { + code: "sr-cyrl", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Претходна", + next: "следећи", + today: "Данас", + year: "Година", + month: "Месец", + week: "Недеља", + day: "Дан", + list: "Планер" + }, + weekText: "Сед", + allDayText: "Цео дан", + moreLinkText(r) { + return "+ још " + r; + }, + noEventsText: "Нема догађаја за приказ" +}, STe = { + code: "sr", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Prethodna", + next: "Sledeći", + today: "Danas", + year: "Godina", + month: "Mеsеc", + week: "Nеdеlja", + day: "Dan", + list: "Planеr" + }, + weekText: "Sed", + allDayText: "Cеo dan", + moreLinkText(r) { + return "+ još " + r; + }, + noEventsText: "Nеma događaja za prikaz" +}, wTe = { + code: "sv", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Förra", + next: "Nästa", + today: "Idag", + year: "År", + month: "Månad", + week: "Vecka", + day: "Dag", + list: "Program" + }, + buttonHints: { + prev(r) { + return `Föregående ${r.toLocaleLowerCase()}`; + }, + next(r) { + return `Nästa ${r.toLocaleLowerCase()}`; + }, + today(r) { + return (r === "Program" ? "Detta" : "Denna") + " " + r.toLocaleLowerCase(); + } + }, + viewHint: "$0 vy", + navLinkHint: "Gå till $0", + moreLinkHint(r) { + return `Visa ytterligare ${r} händelse${r === 1 ? "" : "r"}`; + }, + weekText: "v.", + weekTextLong: "Vecka", + allDayText: "Heldag", + moreLinkText: "till", + noEventsText: "Inga händelser att visa", + closeHint: "Stäng", + timeHint: "Klockan", + eventHint: "Händelse" +}, CTe = { + code: "ta-in", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "முந்தைய", + next: "அடுத்தது", + today: "இன்று", + year: "ஆண்டு", + month: "மாதம்", + week: "வாரம்", + day: "நாள்", + list: "தினசரி அட்டவணை" + }, + weekText: "வாரம்", + allDayText: "நாள் முழுவதும்", + moreLinkText(r) { + return "+ மேலும் " + r; + }, + noEventsText: "காண்பிக்க நிகழ்வுகள் இல்லை" +}, TTe = { + code: "th", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "ก่อนหน้า", + next: "ถัดไป", + prevYear: "ปีก่อนหน้า", + nextYear: "ปีถัดไป", + year: "ปี", + today: "วันนี้", + month: "เดือน", + week: "สัปดาห์", + day: "วัน", + list: "กำหนดการ" + }, + weekText: "สัปดาห์", + allDayText: "ตลอดวัน", + moreLinkText: "เพิ่มเติม", + noEventsText: "ไม่มีกิจกรรมที่จะแสดง" +}, ITe = { + code: "tr", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "geri", + next: "ileri", + today: "bugün", + year: "Yıl", + month: "Ay", + week: "Hafta", + day: "Gün", + list: "Ajanda" + }, + weekText: "Hf", + allDayText: "Tüm gün", + moreLinkText: "daha fazla", + noEventsText: "Gösterilecek etkinlik yok" +}, ATe = { + code: "ug", + buttonText: { + prev: "ئالدىنقى", + next: "كېيىنكى", + today: "بۈگۈن", + year: "يىل", + month: "ئاي", + week: "ھەپتە", + day: "كۈن", + list: "كۈنتەرتىپ" + }, + allDayText: "پۈتۈن كۈن" +}, ETe = { + code: "uk", + week: { + dow: 1, + doy: 7 + // The week that contains Jan 1st is the first week of the year. + }, + buttonText: { + prev: "Попередній", + next: "далі", + today: "Сьогодні", + year: "рік", + month: "Місяць", + week: "Тиждень", + day: "День", + list: "Порядок денний" + }, + weekText: "Тиж", + allDayText: "Увесь день", + moreLinkText(r) { + return "+ще " + r + "..."; + }, + noEventsText: "Немає подій для відображення" +}, MTe = { + code: "uz-cy", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Олин", + next: "Кейин", + today: "Бугун", + month: "Ой", + week: "Ҳафта", + day: "Кун", + list: "Кун тартиби" + }, + weekText: "Ҳафта", + allDayText: "Кун бўйича", + moreLinkText(r) { + return "+ яна " + r; + }, + noEventsText: "Кўрсатиш учун воқеалар йўқ" +}, DTe = { + code: "uz", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Oldingi", + next: "Keyingi", + today: "Bugun", + year: "Yil", + month: "Oy", + week: "Xafta", + day: "Kun", + list: "Kun tartibi" + }, + allDayText: "Kun bo'yi", + moreLinkText(r) { + return "+ yana " + r; + }, + noEventsText: "Ko'rsatish uchun voqealar yo'q" +}, kTe = { + code: "vi", + week: { + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "Trước", + next: "Tiếp", + today: "Hôm nay", + year: "Năm", + month: "Tháng", + week: "Tuần", + day: "Ngày", + list: "Lịch biểu" + }, + weekText: "Tu", + allDayText: "Cả ngày", + moreLinkText(r) { + return "+ thêm " + r; + }, + noEventsText: "Không có sự kiện để hiển thị" +}, OTe = { + code: "zh-cn", + week: { + // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效 + dow: 1, + doy: 4 + // The week that contains Jan 4th is the first week of the year. + }, + buttonText: { + prev: "上月", + next: "下月", + today: "今天", + year: "年", + month: "月", + week: "周", + day: "日", + list: "日程" + }, + weekText: "周", + allDayText: "全天", + moreLinkText(r) { + return "另外 " + r + " 个"; + }, + noEventsText: "没有事件显示" +}, LTe = { + code: "zh-tw", + buttonText: { + prev: "上個", + next: "下個", + today: "今天", + year: "年", + month: "月", + week: "週", + day: "天", + list: "活動列表" + }, + weekText: "週", + allDayText: "整天", + moreLinkText: "顯示更多", + noEventsText: "沒有任何活動" +}, PTe = [ + u1e, + c1e, + h1e, + f1e, + d1e, + v1e, + p1e, + g1e, + m1e, + y1e, + _1e, + b1e, + x1e, + S1e, + w1e, + C1e, + T1e, + I1e, + A1e, + E1e, + M1e, + D1e, + k1e, + O1e, + L1e, + P1e, + R1e, + N1e, + z1e, + B1e, + j1e, + F1e, + $1e, + H1e, + V1e, + G1e, + U1e, + W1e, + Y1e, + X1e, + Z1e, + J1e, + K1e, + Q1e, + q1e, + eTe, + tTe, + rTe, + nTe, + iTe, + aTe, + oTe, + sTe, + lTe, + uTe, + cTe, + hTe, + fTe, + dTe, + vTe, + pTe, + gTe, + mTe, + yTe, + _Te, + bTe, + xTe, + STe, + wTe, + CTe, + TTe, + ITe, + ATe, + ETe, + MTe, + DTe, + kTe, + OTe, + LTe +]; +function UC(r, e, t, n) { + let i; + return e === "local" ? i = $moment(r) : e === "UTC" ? i = $moment.utc(r) : $moment.tz ? i = $moment.tz(r, e) : (i = $moment.utc(r), t != null && i.utcOffset(t)), i.locale(n), i; +} +function RTe(r, e) { + let t = OU(r); + if (e.end) { + let n = UC(e.start.array, e.timeZone, e.start.timeZoneOffset, e.localeCodes[0]), i = UC(e.end.array, e.timeZone, e.end.timeZoneOffset, e.localeCodes[0]); + return uI(t, Zz(n), Zz(i), e.defaultSeparator); + } + return UC(e.date.array, e.timeZone, e.date.timeZoneOffset, e.localeCodes[0]).format(t.whole); +} +function Zz(r) { + return (e) => e ? r.format(e) : ""; +} +function OU(r) { + let e = r.match(/^(.*?)\{(.*)\}(.*)$/); + if (e) { + let t = OU(e[2]); + return { + head: e[1], + middle: t, + tail: e[3], + whole: e[1] + t.whole + e[3] + }; + } + return { + head: null, + middle: null, + tail: null, + whole: r + }; +} +function uI(r, e, t, n) { + if (r.middle) { + let o = e(r.head), s = uI(r.middle, e, t, n), l = e(r.tail), u = t(r.head), c = uI(r.middle, e, t, n), h = t(r.tail); + if (o === u && l === h) + return o + (s === c ? s : s + n + c) + l; + } + let i = e(r.whole), a = t(r.whole); + return i === a ? i : i + n + a; +} +var NTe = Gs({ + name: "@fullcalendar/moment", + cmdFormatter: RTe +}); +const zTe = $styled_components.div` + position: relative; + height: 100%; + overflow: hidden; + color: ${(r) => r.$style.text}; + .fc-theme-standard .fc-list-day-cushion, + .fc .fc-timegrid-col.fc-day-today, + .fc .fc-daygrid-day.fc-day-today { + background-color: ${(r) => r.$style.background}; + } + .fc .fc-highlight { + background-color: ${(r) => r.$style.selectBackground}; + } + a { + color: ${(r) => r.$style.text}; + } + + .fc .fc-timegrid-slot { + height: 28px; + } + + // day + .fc-timeGridDay-view { + .fc-col-header-cell { + font-size: 20px; + font-weight: 500; + a { + line-height: 67px; + } + } + } + + // list + .fc-list { + .fc-list-table { + table-layout: fixed; + th { + background-color: ${(r) => r.$style.background}; + } + } + .fc-list-event-graphic { + display: none; + } + .fc-list-day-cushion { + font-size: 16px; + font-weight: 500; + line-height: 32px; + padding: 0 24px; + } + .fc-list-day-side-text { + float: left; + margin-left: 24px; + } + .fc-list-day { + th { + padding: 8px 0 3px 0; + } + > th { + border: none; + } + &:not(:nth-of-type(1)) .fc-list-day-cushion { + border-top: 1px solid + ${(r) => $lowcoder_sdk.toHex(r.$style.border) === "#D7D9E0" ? "#E1E3EB" : $lowcoder_sdk.lightenColor(r.$style.border, 0.03)}; + } + } + .fc-event + .fc-list-day th { + padding-top: 11px; + .fc-list-day-cushion { + padding-top: 8px; + } + } + .fc-event { + .fc-list-event-time, + .fc-list-event-title { + border: none; + } + &:hover .event { + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15); + border-width: 1px; + margin: 2px 5px; + height: 20px; + .event-title { + margin-left: 15px; + } + &::before { + left: 2px; + } + } + } + .fc-event { + font-size: 13px; + line-height: 20px; + display: flex; + align-items: center; + &.no-time { + padding-left: 19px; + } + } + .fc-list-event-time { + padding: 0px 16px 0 24px; + vertical-align: middle; + min-width: 87px; + width: 87px; + box-sizing: content-box; + } + .fc-list-event-title { + min-width: 266px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 0 14px 0 0; + cursor: pointer; + .event { + font-size: 13px; + height: 18px; + line-height: 18px; + margin: 3px 5px; + border-width: 0; + align-items: center; + &::before { + height: 14px; + top: 2px; + left: 3px; + } + .event-time { + display: none; + } + .event-title { + margin-left: 16px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .event-remove { + background-color: inherit; + } + } + } + .fc-event:hover td { + background-color: inherit; + } + } + + // month + .fc-dayGridMonth-view { + .fc-daygrid-day-frame { + min-height: 95px; + height: 100%; + } + .fc-col-header-cell { + font-size: 14px; + font-weight: 400; + text-align: left; + padding-left: 16px; + a { + padding: 0; + line-height: 39px; + } + } + .fc-daygrid-day-number { + font-size: 14px; + line-height: 22px; + font-weight: 500; + padding: 0 6px; + border-radius: 11px; + margin: 12px 0 0 10px; + } + .fc-daygrid-day-top { + flex-direction: inherit; + } + .fc-day-today .fc-daygrid-day-number { + background-color: ${(r) => r.theme.primary}; + color: ${(r) => $lowcoder_sdk.contrastText(r.theme.primary || "", r.theme.textDark, r.theme.textLight)}; + } + .fc-daygrid-day-events { + padding: 1px 0 5px 0; + min-height: unset; + .fc-event { + margin: 2px 4px 2px 12px; + padding: 0; + &:hover .event { + padding-right: 20px; + } + .event { + font-size: 13px; + line-height: 18px; + padding-right: 0; + .event-time { + display: none; + } + .event-title { + margin-left: 15px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + &::before { + height: 14px; + } + } + } + .fc-daygrid-day-bottom { + padding: 2px 2px 0 10px; + } + } + .fc-day-other { + color: ${(r) => r.$style.text}; + .fc-daygrid-day-top, + .fc-daygrid-day-events { + opacity: 0.35; + } + .event::before { + background-color: ${(r) => r.$style.text}; + } + } + } + // month drag event + .fc > .fc-event { + visibility: hidden; + } + + // more link + .fc-view-harness-active .fc-more-popover { + border-radius: 4px; + box-shadow: 0 0px 10px 4px rgba(0, 0, 0, 0.25); + overflow: hidden; + left: ${(r) => `min(${r.left}px, calc(100% - 210px)) !important`}; + .fc-popover-body { + padding: 4px 0; + min-width: 200px; + width: 200px; + .fc-daygrid-event-harness { + margin: 4px; + .fc-event { + margin: 0; + .event { + height: fit-content; + .event-title { + white-space: pre-wrap; + } + .event-time { + margin-top: 0; + } + } + } + } + } + .fc-popover-header, + .fc-popover-body { + background-color: ${(r) => r.$style.background}; + } + .fc-popover-header .fc-popover-close { + color: #8b8fa3; + &:hover { + color: #222; + } + } + } + + .fc-direction-ltr .fc-timegrid-more-link { + border: 1px solid ${(r) => r.$style.border}; + border-radius: 4px; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15); + font-size: 13px; + display: inline-block; + font-weight: 500; + background-color: ${(r) => $lowcoder_sdk.lightenColor(r.$style.background, 0.1)}; + } + + .fc-dayGridMonth-view .fc-more-link { + margin: 0 2px 2px 2px !important; + } + .fc-timeGridWeek-view .fc-more-link, + .fc-timeGridDay-view .fc-more-link { + margin: 2px !important; + } + .fc-daygrid-day-events { + margin: 0 !important; + padding: 2px 0; + .fc-event { + margin: 2px 4px; + } + .fc-daygrid-day-bottom { + line-height: 16px; + padding: 0; + .fc-more-link { + width: calc(100% - 4px); + border: 1px solid ${(r) => r.$style.border}; + border-radius: 4px; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15); + font-size: 13px; + display: inline-block; + height: 20px; + padding-left: 15px; + font-weight: 500; + background-color: ${(r) => $lowcoder_sdk.lightenColor(r.$style.background, 0.1)}; + } + } + } + + // on resize + .fc-media-screen { + height: 100% !important; + } + .fc-scroller { + overflow: hidden auto !important; + overflow: hidden overlay !important; + } + .fc-col-header, + .fc-scroller > div, + .fc-scroller > div > table, + .fc-scrollgrid-sync-table, + .fc-timegrid-cols > table, + .fc .fc-scrollgrid, + .fc .fc-scrollgrid table { + width: 100% !important; + } + + // event + .fc-timegrid-event .fc-event-main { + padding: 4px 0 4px 1px; + } + .fc-event { + position: relative; + height: 100%; + background-color: unset !important; + border: none !important; + box-shadow: none !important; + .event-remove { + color: ${(r) => r.$style.text}; + } + &:hover { + .event-remove { + opacity: ${(r) => r.editable && 1}; + } + } + } + + // left time + .time.past { + opacity: 0.35; + } + + .past .time { + opacity: 0.35; + } + + .future .time { + opacity: 1; + } + + .fc-scrollgrid-liquid > tbody { + & > tr:nth-of-type(2) { + display: ${(r) => r.allDay && 1}; + } + } + .fc .fc-timegrid-slot-label-cushion { + padding: 0 15px; + } + + // border-radius, bg + .fc-theme-standard .fc-list { + background-color: ${(r) => r.$style.background}; + border-radius: ${(r) => `0 0 ${r.$style.radius} ${r.$style.radius}`}; + border-color: ${(r) => r.$style.border}; + border-top-color: ${(r) => $lowcoder_sdk.toHex(r.$style.border) === "#D7D9E0" ? "#E1E3EB" : $lowcoder_sdk.lightenColor(r.$style.border, 0.03)}; + } + .fc-scrollgrid-liquid { + border-radius: ${(r) => `0 0 ${r.$style.radius} ${r.$style.radius}`}; + overflow: hidden; + border-right-width: 1px; + border-bottom-width: 1px; + border-color: ${(r) => r.$style.border}; + > thead, + > tbody > tr:nth-of-type(1), + .fc-scrollgrid-section-liquid > td { + background-color: ${(r) => r.$style.background}; + } + } + .fc-scrollgrid-section-liquid > td, + .fc-scrollgrid-liquid .fc-scrollgrid-section-header > th { + border: none; + } + .fc-scrollgrid-liquid > tbody > tr:nth-of-type(1) > td { + border-right: none; + } + .fc-theme-standard .fc-scrollgrid { + border-color: ${(r) => $lowcoder_sdk.toHex(r.$style.border) === "#D7D9E0" ? "#E1E3EB" : $lowcoder_sdk.lightenColor(r.$style.border, 0.03)}; + } + .fc .fc-scrollgrid { + border-bottom-width: 1px; + border-right-width: 1px; + } + + .fc-day-sat, + .fc-day-sun { + &.fc-timegrid-col, + &.fc-daygrid-day { + background-color: ${(r) => $lowcoder_sdk.isDarkColor(r.$style.background) ? $lowcoder_sdk.darkenColor(r.$style.background, 0.06) : $lowcoder_sdk.darkenColor(r.$style.background, 0.02)}; + } + } + .fc-theme-standard td, + .fc-theme-standard th { + border-color: ${(r) => $lowcoder_sdk.toHex(r.$style.border) === "#D7D9E0" ? "#E1E3EB" : $lowcoder_sdk.lightenColor(r.$style.border, 0.03)}; + } + + // header + .fc .fc-toolbar.fc-header-toolbar { + padding: 16px; + margin-bottom: 0; + border: 1px solid ${(r) => r.$style.border}; + border-bottom: none; + border-radius: ${(r) => `${r.$style.radius} ${r.$style.radius} 0 0`}; + background-color: ${(r) => r.$style.background}; + } + .fc-toolbar-title { + color: ${(r) => r.$style.title}; + font-size: 24px; + line-height: 24px; + display: inline-flex; + } + .fc-toolbar-chunk { + display: inline-flex; + align-items: center; + } + .fc .fc-toolbar-chunk .fc-button.fc-button-primary { + height: 28px; + display: flex; + align-items: center; + justify-content: center; + &:not(:disabled):not(.fc-button-active) { + &:hover, + &:active { + color: ${(r) => r.$style.btnText}; + background-color: ${(r) => $lowcoder_sdk.toHex(r.$style.headerBtnBackground) === "#FFFFFF" ? "#F5F5F6" : $lowcoder_sdk.genHoverColor(r.$style.headerBtnBackground)}; + border-color: ${(r) => $lowcoder_sdk.toHex(r.$style.headerBtnBackground) === "#FFFFFF" ? "#D7D9E0" : $lowcoder_sdk.backgroundToBorder($lowcoder_sdk.genHoverColor(r.$style.headerBtnBackground))}; + } + } + &:not(:disabled):focus { + box-shadow: none; + } + &:disabled { + cursor: not-allowed; + opacity: 1; + &, + &:hover { + background-color: ${(r) => r.$style.headerBtnBackground}; + border-color: ${(r) => $lowcoder_sdk.backgroundToBorder(r.$style.headerBtnBackground)}; + color: ${(r) => $lowcoder_sdk.toHex(r.$style.btnText) === "#222222" ? "#B8B9BF" : $lowcoder_sdk.contrastColor(r.$style.btnText)}; + } + } + } + .fc .fc-button-primary:not(:disabled).fc-button-active:focus, + .fc .fc-button-primary:not(:disabled):active:focus { + box-shadow: none; + } + .fc-toolbar-chunk:nth-of-type(3) .fc-button-primary { + height: 28px; + display: inline-flex; + font-size: 14px; + margin-left: 8px; + background-color: ${(r) => r.$style.headerBtnBackground}; + border-color: ${(r) => $lowcoder_sdk.backgroundToBorder(r.$style.headerBtnBackground)}; + color: ${(r) => r.$style.btnText}; + &.fc-today-button { + min-width: 52px; + } + &.fc-prev-button, + &.fc-next-button { + padding: 0; + width: 28px; + color: ${(r) => $lowcoder_sdk.lightenColor(r.$style.btnText, 0.4)}; + } + &.fc-prev-button { + margin-left: 12px; + } + } + .fc-toolbar-chunk:nth-of-type(3) .fc-button-group { + background-color: ${(r) => $lowcoder_sdk.toHex(r.$style.headerBtnBackground) === "#FFFFFF" ? "#EFEFF1" : $lowcoder_sdk.isDarkColor(r.$style.headerBtnBackground) ? r.$style.headerBtnBackground : $lowcoder_sdk.darkenColor(r.$style.headerBtnBackground, 0.1)}; + border-radius: 4px; + margin-left: 16px; + .fc-button-primary { + background-color: transparent; + min-width: 60px; + border-radius: 4px; + margin: 2px; + border: none; + color: ${(r) => $lowcoder_sdk.toHex(r.$style.btnText) === "#222222" ? "#8B8FA3" : $lowcoder_sdk.lightenColor(r.$style.btnText, 0.4)}; + font-weight: 500; + + &.fc-button-active { + background-color: ${(r) => $lowcoder_sdk.isDarkColor(r.$style.headerBtnBackground) ? $lowcoder_sdk.lightenColor(r.$style.headerBtnBackground, 0.1) : r.$style.headerBtnBackground}; + color: ${(r) => r.$style.btnText}; + } + } + } + + // week head + .fc-timeGridWeek-view { + .week-head { + display: flex; + flex-direction: column; + font-size: 14px; + font-weight: 400; + &.past span { + opacity: 0.35; + } + .week { + padding-bottom: 3px; + } + .day { + font-size: 20px; + font-weight: 500; + line-height: 22px; + } + } + .fc-day-today.fc-col-header-cell { + background-color: ${(r) => $lowcoder_sdk.isDarkColor(r.$style.background) ? "#ffffff19" : $lowcoder_sdk.toHex(r.theme.primary) + "19"}; + a { + color: ${(r) => !$lowcoder_sdk.isDarkColor(r.$style.background) && $lowcoder_sdk.darkenColor(r.theme.primary, 0.1)}; + } + } + .fc-col-header-cell-cushion { + padding: 8px 0 13px 0; + } + } + + // week left + .fc .fc-timegrid-axis-cushion { + min-width: 62px; + min-height: 52px; + max-width: none; + display: inline-flex; + align-items: center; + justify-content: center; + } + .fc-direction-ltr .fc-timegrid-slot-label-frame { + text-align: center; + } + .fc .fc-timegrid-slot-label { + border: none; + } + + // time can doubleClick + .fc-timegrid-bg-harness, + .fc-daygrid-day-bg { + pointer-events: none; + } +`, BTe = $styled_components.div` + position: absolute; + pointer-events: auto; + top: 0; + right: 0; + display: flex; + padding: 5px; + opacity: 0; + cursor: pointer; + &:hover { + g { + stroke: #315efb; + } + } +`, jTe = $styled_components.div` + height: 100%; + width: 100%; + pointer-events: none; + border-radius: 4px; + box-shadow: ${(r) => !r.isList && "0 0 5px 0 rgba(0, 0, 0, 0.15)"}; + border: 1px solid ${(r) => r.$style.border}; + display: ${(r) => r.isList && "flex"}; + background-color: ${(r) => !r.isList && $lowcoder_sdk.lightenColor(r.$style.background, 0.1)}; + overflow: hidden; + font-size: 13px; + line-height: 19px; + padding-right: 20px; + overflow: hidden; + position: relative; + &::before { + content: ""; + position: absolute; + display: block; + width: 5px; + height: calc(100% - 4px); + left: 2px; + top: 2px; + border-radius: 3px; + background-color: ${(r) => r.bg}; + } + + .event-time { + color: ${(r) => !r.isList && ($lowcoder_sdk.isDarkColor(r.$style.text) ? $lowcoder_sdk.lightenColor(r.$style.text, 0.2) : r.$style.text)}; + margin-left: 15px; + white-space: pre-wrap; + margin-top: 2px; + } + .event-title { + color: ${(r) => !r.isList && r.$style.text}; + font-weight: 500; + margin-left: 15px; + white-space: pre-wrap; + word-break: break-word; + } + + &.small { + height: 20px; + .event-time { + display: none; + } + .event-title { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + } + &.middle { + padding-top: 2px; + .event-time, + .event-title { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + } + &.large { + .event-time { + margin-top: 13px; + } + } + &.past { + background-color: ${(r) => $lowcoder_sdk.isDarkColor(r.$style.background) && r.$style.background}; + &::before { + background-color: ${(r) => $lowcoder_sdk.toHex(r.$style.text) === "#3C3C3C" ? "#8B8FA3" : $lowcoder_sdk.isDarkColor(r.$style.text) ? $lowcoder_sdk.lightenColor(r.$style.text, 0.3) : r.$style.text}; + } + &::before, + .event-title, + .event-time { + opacity: 0.35; + } + } +`, FTe = $styled_components($antd.Form)` + .ant-form-item-label { + width: 100px; + text-align: left; + line-height: 18px; + label:not(.ant-form-item-required) { + margin-left: 11px; + } + label span { + ${$lowcoder_sdk.UnderlineCss} + } + } +`; +var Gu = /* @__PURE__ */ ((r) => (r.MONTH = "dayGridMonth", r.WEEK = "timeGridWeek", r.DAY = "timeGridDay", r.LIST = "listWeek", r))(Gu || {}); +const $Te = [{ + label: Ye("calendar.month"), + value: "dayGridMonth" +}, { + label: Ye("calendar.week"), + value: "timeGridWeek" +}, { + label: Ye("calendar.day"), + value: "timeGridDay" +}, { + label: Ye("calendar.list"), + value: "listWeek" +}], HTe = [{ + label: Ye("calendar.monday"), + value: "1" +}, { + label: Ye("calendar.tuesday"), + value: "2" +}, { + label: Ye("calendar.wednesday"), + value: "3" +}, { + label: Ye("calendar.thursday"), + value: "4" +}, { + label: Ye("calendar.friday"), + value: "5" +}, { + label: Ye("calendar.saturday"), + value: "6" +}, { + label: Ye("calendar.sunday"), + value: "0" +}], VTe = [{ + id: "1", + title: "Coding", + start: $dayjs().hour(10).minute(0).second(0).format($lowcoder_sdk.DATE_TIME_FORMAT), + end: $dayjs().hour(11).minute(30).second(0).format($lowcoder_sdk.DATE_TIME_FORMAT), + color: "#079968" +}, { + id: "2", + title: "Rest", + start: $dayjs().hour(24).format($lowcoder_sdk.DATE_FORMAT), + end: $dayjs().hour(48).format($lowcoder_sdk.DATE_FORMAT), + allDay: !0 +}], GTe = { + today: Ye("calendar.today"), + month: Ye("calendar.month"), + week: Ye("calendar.week"), + day: Ye("calendar.day"), + list: Ye("calendar.list") +}, UTe = { + left: "title", + right: "prev today next dayGridMonth,timeGridWeek,timeGridDay,listWeek" +}, WTe = (r) => { + const e = r.text.split(" "); + return { + html: ` + ${e[0]} + ${e[1]} + ` + }; +}, Jz = (r) => { + let e = !1; + return r.view.type === "timeGridWeek" ? e = $dayjs().isAfter($dayjs($dayjs().format("YYYY MM DD " + r.text))) : r.view.type === "timeGridDay" && (e = $dayjs().isAfter($dayjs($dayjs(r.view.activeStart).format("YYYY MM DD " + r.text)))), { + html: `${r.text}` + }; +}, YTe = { + timeGridWeek: { + dayHeaderFormat: "ddd DD", + dayHeaderContent: (r) => WTe(r), + slotLabelContent: (r) => Jz(r) + }, + timeGridDay: { + slotLabelContent: (r) => Jz(r) + }, + listWeek: { + listDayFormat: { + weekday: "short" + } + } +}, XTe = [{ + hour: "2-digit", + minute: "2-digit" +}], ZTe = (r) => { + let e = ""; + return [ + "timeGridWeek", + "timeGridDay" + /* DAY */ + ].includes(r.view.type) && ($dayjs().isAfter(r.view.activeEnd) ? e = "past" : $dayjs().isBefore(r.view.activeStart) && (e = "future")), e; +}, JTe = { + events: $lowcoder_sdk.jsonValueExposingStateControl("events", VTe), + onEvent: $lowcoder_sdk.ChangeEventHandlerControl, + editable: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + defaultDate: $lowcoder_sdk.withDefault($lowcoder_sdk.StringControl, "{{ new Date() }}"), + defaultView: $lowcoder_sdk.dropdownControl($Te, "timeGridWeek"), + firstDay: $lowcoder_sdk.dropdownControl(HTe, "1"), + showEventTime: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + showWeekends: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + showAllDay: $lowcoder_sdk.withDefault($lowcoder_sdk.BoolControl, !0), + dayMaxEvents: $lowcoder_sdk.withDefault($lowcoder_sdk.NumberControl, 2), + eventMaxStack: $lowcoder_sdk.withDefault($lowcoder_sdk.NumberControl, 0), + style: $lowcoder_sdk.styleControl($lowcoder_sdk.CalendarStyle) +}; +let cI = function() { + return new $lowcoder_sdk.UICompBuilder(JTe, (r) => { + const e = $react.useContext($lowcoder_sdk.ThemeContext), t = $react.createRef(), n = $react.useRef(), [i] = $antd.Form.useForm(), [a, o] = $react.useState(void 0), s = r.events.value.map((S) => { + var T; + return sn({ + title: S.title, + id: S.id, + start: $dayjs(S.start, $lowcoder_sdk.DateParser).format(), + end: $dayjs(S.end, $lowcoder_sdk.DateParser).format(), + allDay: S.allDay, + color: $lowcoder_sdk.isValidColor(S.color || "") ? S.color : (T = e == null ? void 0 : e.theme) == null ? void 0 : T.primary + }, S.groupId ? { + groupId: S.groupId + } : null); + }), { + defaultDate: l, + defaultView: u, + showEventTime: c, + showWeekends: h, + showAllDay: f, + dayMaxEvents: v, + eventMaxStack: b, + style: w, + firstDay: p, + editable: d + } = r; + function m(S) { + const T = S.view.type === "listWeek"; + let C = ""; + if ([Gu.WEEK, Gu.DAY].includes(S.view.type)) { + const M = $dayjs(S.event.end).diff($dayjs(S.event.start), "minutes"); + M <= 30 || S.event.allDay ? C = "small" : M <= 60 ? C = "middle" : C = "large"; + } + const E = $dayjs().isAfter($dayjs(S.event.end)) && S.view.type !== Gu.MONTH ? "past" : ""; + return /* @__PURE__ */ Rn(jTe, { + className: `event ${C} ${E}`, + isList: T, + bg: S.backgroundColor, + theme: e == null ? void 0 : e.theme, + allDay: f, + $style: r.style, + children: [/* @__PURE__ */ Bt("div", { + className: "event-time", + children: S.timeText + }), /* @__PURE__ */ Bt("div", { + className: "event-title", + children: S.event.title + }), /* @__PURE__ */ Bt(BTe, { + isList: T, + className: "event-remove", + onClick: (M) => { + M.stopPropagation(), r.onEvent("change"); + const P = s.filter((R) => R.id !== S.event.id); + r.events.onChange(P); + }, + onMouseDown: (M) => { + M.stopPropagation(), M.preventDefault(); + }, + children: /* @__PURE__ */ Bt($lowcoder_sdk.CalendarDeleteIcon, {}) + })] + }); + } + const _ = () => { + const S = r.events.value.find((T) => { + var C; + return T.id === ((C = n.current) == null ? void 0 : C.id); + }); + if (!(!d || !n.current)) + if (S) { + const { + title: T, + groupId: C, + color: E, + id: M + } = S; + x({ + title: T, + groupId: C, + color: E, + id: M + }, !0); + } else + x(n.current, !1); + }, y = (S) => { + const T = { + allDay: S.allDay, + start: S.startStr, + end: S.endStr + }, C = S.view.type, E = $dayjs(S.end).diff($dayjs(S.start), "minutes"); + if (C === Gu.MONTH && E === 1440 || [Gu.WEEK, Gu.DAY].includes(C) && E === 30 || S.allDay && E === 1440) { + n.current = T, setTimeout(() => { + n.current = void 0; + }, 500); + return; + } + x(T, !1); + }, x = (S, T) => { + var M; + const C = Ye(T ? "calendar.editEvent" : "calendar.creatEvent"); + i && i.setFieldsValue(S); + const E = (M = n.current) == null ? void 0 : M.id; + $lowcoder_sdk.CustomModal.confirm({ + title: C, + content: /* @__PURE__ */ Rn(FTe, { + form: i, + children: [/* @__PURE__ */ Bt($antd.Form.Item, { + label: /* @__PURE__ */ Bt($lowcoder_sdk.Tooltip, { + title: Ye("calendar.eventIdTooltip"), + children: Ye("calendar.eventId") + }), + name: "id", + rules: [{ + required: !0, + message: Ye("calendar.eventIdRequire") + }], + children: /* @__PURE__ */ Bt($antd.Input, {}) + }), /* @__PURE__ */ Bt($antd.Form.Item, { + label: Ye("calendar.eventName"), + name: "title", + rules: [{ + required: !0, + message: Ye("calendar.eventNameRequire") + }], + children: /* @__PURE__ */ Bt($antd.Input, {}) + }), /* @__PURE__ */ Bt($antd.Form.Item, { + label: Ye("calendar.eventColor"), + name: "color", + children: /* @__PURE__ */ Bt($antd.Input, {}) + }), /* @__PURE__ */ Bt($antd.Form.Item, { + label: /* @__PURE__ */ Bt($lowcoder_sdk.Tooltip, { + title: Ye("calendar.groupIdTooltip"), + children: Ye("calendar.eventGroupId") + }), + name: "groupId", + children: /* @__PURE__ */ Bt($antd.Input, {}) + })] + }), + onConfirm: () => (i.submit(), i.validateFields().then(() => { + const { + id: P, + groupId: R, + color: N, + title: F = "" + } = i.getFieldsValue(); + if (r.events.value.findIndex(($) => $.id === P) > -1 && P !== E) + throw i.setFields([{ + name: "id", + errors: [Ye("calendar.eventIdExist")] + }]), new Error(); + if (T) { + const $ = r.events.value.map((G) => G.id === E ? sn(sn(Za(sn({}, G), { + title: F, + id: P + }), R !== void 0 ? { + groupId: R + } : null), N !== void 0 ? { + color: N + } : null) : G); + r.events.onChange($); + } else { + const $ = sn(sn({ + allDay: S.allDay, + start: S.start, + end: S.end, + id: P, + title: F + }, R !== void 0 ? { + groupId: R + } : null), N !== void 0 ? { + color: N + } : null); + r.events.onChange([...r.events.value, $]); + } + r.onEvent("change"), i.resetFields(); + })), + onCancel: () => { + i.resetFields(); + } + }); + }; + let g = l; + try { + g = new Date(l).toISOString(); + } catch (S) { + g = void 0; + } + return /* @__PURE__ */ Bt(zTe, { + ref: t, + editable: d, + $style: w, + theme: e == null ? void 0 : e.theme, + onDoubleClick: _, + left: a, + children: /* @__PURE__ */ Bt(gU, { + slotEventOverlap: !1, + events: s, + expandRows: !0, + height: "100%", + locale: d6(), + locales: PTe, + firstDay: Number(p), + plugins: [$we, ICe, XCe, l1e, NTe], + headerToolbar: UTe, + moreLinkClick: (S) => { + var E, M, P, R, N, F, U, $, G, Q; + let T = 0; + const C = S.jsEvent.target; + S.view.type === Gu.DAY ? S.allDay ? T = ((M = (E = C.offsetParent) == null ? void 0 : E.parentElement) == null ? void 0 : M.offsetLeft) || 0 : T = ((P = C.parentElement) == null ? void 0 : P.offsetLeft) || 0 : S.allDay ? T = ((F = (N = (R = C.offsetParent) == null ? void 0 : R.parentElement) == null ? void 0 : N.parentElement) == null ? void 0 : F.offsetLeft) || 0 : T = ((Q = (G = ($ = (U = C.offsetParent) == null ? void 0 : U.parentElement) == null ? void 0 : $.parentElement) == null ? void 0 : G.parentElement) == null ? void 0 : Q.offsetLeft) || 0, o(T); + }, + buttonText: GTe, + views: YTe, + eventClassNames: () => c ? "" : "no-time", + slotLabelFormat: XTe, + viewClassNames: ZTe, + moreLinkText: Ye("calendar.more"), + initialDate: g, + initialView: u, + editable: d, + selectable: d, + selectMirror: !1, + displayEventTime: c, + dayMaxEvents: v, + eventMaxStack: b || void 0, + weekends: h, + allDaySlot: f, + eventContent: m, + select: (S) => y(S), + eventClick: (S) => { + const T = s.find((C) => C.id === S.event.id); + n.current = T, setTimeout(() => { + n.current = void 0; + }, 500); + }, + eventsSet: (S) => { + let T = !1, C = []; + S.forEach((E) => { + const M = s.find((N) => N.id === E.id), P = $dayjs(E.start, $lowcoder_sdk.DateParser).format(), R = $dayjs(E.end, $lowcoder_sdk.DateParser).format(); + P !== (M == null ? void 0 : M.start) || R !== (M == null ? void 0 : M.end) || !!E.allDay != !!(M != null && M.allDay) ? (T = !0, C.push(Za(sn({}, M), { + allDay: E.allDay, + start: E.startStr, + end: E.endStr + }))) : C.push(M); + }), T && (r.events.onChange(C), r.onEvent("change")); + } + }) + }, g ? u + g : u); + }).setPropertyViewFn((r) => /* @__PURE__ */ Rn(Ni, { + children: [/* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.basic, + children: r.events.propertyView({}) + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.interaction, + children: r.onEvent.getPropertyView() + }), /* @__PURE__ */ Rn($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.advanced, + children: [r.editable.propertyView({ + label: Ye("calendar.editable") + }), r.defaultDate.propertyView({ + label: Ye("calendar.defaultDate"), + tooltip: Ye("calendar.defaultDateTooltip") + }), r.defaultView.propertyView({ + label: Ye("calendar.defaultView"), + tooltip: Ye("calendar.defaultViewTooltip") + }), r.firstDay.propertyView({ + label: Ye("calendar.startWeek") + }), r.showEventTime.propertyView({ + label: Ye("calendar.showEventTime"), + tooltip: Ye("calendar.showEventTimeTooltip") + }), r.showWeekends.propertyView({ + label: Ye("calendar.showWeekends") + }), r.showAllDay.propertyView({ + label: Ye("calendar.showAllDay"), + tooltip: Ye("calendar.showAllDayTooltip") + }), r.dayMaxEvents.propertyView({ + label: Ye("calendar.dayMaxEvents"), + tooltip: Ye("calendar.dayMaxEventsTooltip") + }), r.eventMaxStack.propertyView({ + label: Ye("calendar.eventMaxStack"), + tooltip: Ye("calendar.eventMaxStackTooltip") + })] + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.layout, + children: $lowcoder_sdk.hiddenPropertyView(r) + }), /* @__PURE__ */ Bt($lowcoder_sdk.Section, { + name: $lowcoder_sdk.sectionNames.style, + children: r.style.getPropertyView() + })] + })).build(); +}(); +cI = class extends cI { + autoHeight() { + return !1; + } +}; +const KTe = $lowcoder_sdk.withExposingConfigs(cI, [new $lowcoder_sdk.NameConfig("events", Ye("calendar.events")), $lowcoder_sdk.NameConfigHidden]), tIe = { + chart: a0e, + imageEditor: p0e, + calendar: KTe +}; +export { + tIe as default +}; diff --git a/client/packages/lowcoder-comps/package/package.json b/client/packages/lowcoder-comps/package/package.json new file mode 100644 index 000000000..3254348be --- /dev/null +++ b/client/packages/lowcoder-comps/package/package.json @@ -0,0 +1,68 @@ +{ + "name": "lowcoder-comps", + "version": "0.0.14", + "type": "module", + "license": "MIT", + "dependencies": { + "@fullcalendar/core": "^6.1.6", + "@fullcalendar/daygrid": "^6.1.6", + "@fullcalendar/interaction": "^6.1.6", + "@fullcalendar/list": "^6.1.6", + "@fullcalendar/moment": "^6.1.6", + "@fullcalendar/react": "^6.1.6", + "@fullcalendar/timegrid": "^6.1.6", + "@types/react": "17", + "@types/react-dom": "17", + "big.js": "^6.2.1", + "echarts-extension-gmap": "^1.6.0", + "lowcoder-cli": "workspace:^", + "lowcoder-sdk": "workspace:^", + "mermaid": "^10.2.4", + "react": "17", + "react-dom": "17", + "typescript": "4.8.4" + }, + "lowcoder": { + "description": "", + "comps": { + "chart": { + "name": "Chart", + "icon": "./icons/icon-chart.svg", + "layoutInfo": { + "w": 11, + "h": 35 + } + }, + "imageEditor": { + "name": "Image Editor", + "icon": "./icons/icon-chart.svg", + "layoutInfo": { + "w": 15, + "h": 60 + } + }, + "calendar": { + "name": "Calendar", + "icon": "./icons/icon-comp-calendar.svg", + "layoutInfo": { + "w": 15, + "h": 60 + } + } + }, + "entry": "index.js" + }, + "scripts": { + "start": "vite", + "build": "yarn test && lowcoder-cli build", + "build_only": "lowcoder-cli build", + "build_publish": "lowcoder-cli build --publish", + "test": "jest" + }, + "devDependencies": { + "jest": "29.3.0", + "jest-canvas-mock": "^2.5.2", + "vite": "^4.3.9", + "vite-tsconfig-paths": "^3.6.0" + } +} \ No newline at end of file diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx b/client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx index e0dcf03cc..671ccae7c 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx +++ b/client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx @@ -23,6 +23,7 @@ import { UICompBuilder, withDefault, withExposingConfigs, + withMethodExposing, withViewFn, ThemeContext, chartColorPalette, @@ -55,12 +56,14 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => { color: chartColorPalette, backgroundColor: "#fff", }; + let themeConfig = defaultChartTheme; try { themeConfig = theme?.theme.chart ? JSON.parse(theme?.theme.chart) : defaultChartTheme; } catch (error) { log.error('theme chart error: ', error); } + const onEvent = comp.children.onEvent.getView(); useEffect(() => { // bind events @@ -68,8 +71,8 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => { if (!echartsCompInstance) { return _.noop; } - echartsCompInstance.on("selectchanged", (param: any) => { - const option: any = echartsCompInstance.getOption(); + echartsCompInstance?.on("selectchanged", (param: any) => { + const option: any = echartsCompInstance?.getOption(); //log.log("chart select change", param); if (param.fromAction === "select") { comp.dispatch(changeChildAction("selectedPoints", getSelectedPoints(param, option))); @@ -80,7 +83,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => { } }); // unbind - return () => echartsCompInstance.off("selectchanged"); + return () => echartsCompInstance?.off("selectchanged"); }, [onEvent]); const echartsConfigChildren = _.omit(comp.children, echartsConfigOmitChildren); @@ -96,27 +99,34 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => { }, [mapScriptLoaded]) const loadGoogleMapsData = () => { - const echartsCompInstance = echartsCompRef?.current?.getEchartsInstance(); - if (!echartsCompInstance) { - return _.noop; - } - echartsCompInstance.getModel().getComponent("gmap").getGoogleMap(); + setTimeout(() => { + setMapScriptLoaded(true); + const echartsCompInstance = echartsCompRef?.current?.getEchartsInstance(); + if (!echartsCompInstance) { + return _.noop; + } + + const mapInstance = echartsCompInstance?.getModel()?.getComponent("gmap")?.getGoogleMap(); + comp.dispatch(changeChildAction("mapInstance", mapInstance)); + }, 500) } const apiKey = comp.children.mapApiKey.getView(); const mode = comp.children.mode.getView(); useEffect(() => { - if(mode === 'map') { - const gMapScript = loadGoogleMapsScript(''); - if(isMapScriptLoaded) { - loadGoogleMapsData(); - return; - } - gMapScript.addEventListener('load', function () { - setMapScriptLoaded(true); - loadGoogleMapsData(); - }); + if( mode !== 'map') { + comp.dispatch(changeChildAction("mapInstance", undefined)); + return; + } + + const gMapScript = loadGoogleMapsScript(apiKey); + if(isMapScriptLoaded) { + loadGoogleMapsData(); + return; } + gMapScript.addEventListener('load', function () { + loadGoogleMapsData(); + }); }, [mode, apiKey, option]) return ( @@ -142,6 +152,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => { opts={{ locale: getEchartsLocale() }} option={option} theme={mode !== 'map' ? themeConfig : undefined} + mode={mode} /> )} @@ -241,7 +252,7 @@ ChartTmpComp = class extends ChartTmpComp { } }; -const ChartComp = withExposingConfigs(ChartTmpComp, [ +let ChartComp = withExposingConfigs(ChartTmpComp, [ depsConfig({ name: "selectedPoints", desc: trans("chart.selectedPointsDesc"), @@ -266,6 +277,20 @@ const ChartComp = withExposingConfigs(ChartTmpComp, [ new NameConfig("title", trans("chart.titleDesc")), ]); +ChartComp = withMethodExposing(ChartTmpComp, [ + { + method: { + name: "getMapInstance", + }, + execute: (comp) => { + return new Promise((resolve) => { + console.log(comp.children.mapInstance.getView()) + resolve(comp.children.mapInstance.getView()) + }) + }, + }, +]) + export const ChartCompWithDefault = withDefault(ChartComp, { xAxisKey: "date", series: [ diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx b/client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx index ef8ada4b0..320bfc0c1 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx +++ b/client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx @@ -4,6 +4,6 @@ const echartsUrlLocale = language === "zh" ? "zh" : "en"; export const optionUrl = `https://echarts.apache.org/${echartsUrlLocale}/option.html`; export const examplesUrl = `https://echarts.apache.org/examples/${echartsUrlLocale}/index.html`; export const xAxisTypeUrl = `${optionUrl}#xAxis.type`; -export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js`; +export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js?v=3.exp`; export const mapOptionUrl = `https://github.com/plainheart/echarts-extension-gmap`; export const mapExamplesUrl = `https://codepen.io/plainheart/pen/VweLGbR`; \ No newline at end of file diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/chartConstants.tsx b/client/packages/lowcoder-comps/src/comps/chartComp/chartConstants.tsx index 52e53b2b6..a35b5bf31 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/chartConstants.tsx +++ b/client/packages/lowcoder-comps/src/comps/chartComp/chartConstants.tsx @@ -1,5 +1,5 @@ import { jsonControl, JSONObject, stateComp, toJSONObjectArray, toObject } from "lowcoder-sdk"; -import { withDefault, BooleanControl, StringControl, NumberControl, JSONObjectControl } from "lowcoder-sdk"; +import { withDefault, BooleanControl, StringControl, NumberControl, JSONObjectControl, FunctionControl } from "lowcoder-sdk"; import { dropdownControl } from "lowcoder-sdk"; import { eventHandlerControl } from "lowcoder-sdk"; import { valueComp, withType } from "lowcoder-sdk"; @@ -225,6 +225,8 @@ export const chartUiModeChildren = { }; const chartMapModeChildren = { + mapInstance: stateComp(), + getMapInstance: FunctionControl, mapApiKey: withDefault(StringControl, ''), mapZoomLevel: withDefault(NumberControl, 3), mapCenterLng: withDefault(NumberControl, 15.932644), diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts b/client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts index 14db6b7b8..489c9fd57 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts +++ b/client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts @@ -52,7 +52,7 @@ export function transformData( } const notAxisChartSet: Set = new Set(["pie"] as const); -export const echartsConfigOmitChildren = ["hidden", "selectedPoints", "onEvent"] as const; +export const echartsConfigOmitChildren = ["hidden", "selectedPoints", "onEvent", "mapInstance"] as const; type EchartsConfigProps = Omit; export function isAxisChart(type: CharOptionCompType) { @@ -141,7 +141,7 @@ export function getEchartsConfig(props: EchartsConfigProps, chartSize?: ChartSiz center: [mapCenterLng, mapCenterLat], zoom: mapZoomLevel, renderOnMoving: true, - // echartsLayerZIndex: 2019, + echartsLayerZIndex: 2019, roam: true }, ...echartsOption, @@ -261,12 +261,18 @@ export function getSelectedPoints(param: any, option: any) { } export function loadGoogleMapsScript(apiKey?: string) { - const mapsUrl = `${googleMapsApiUrl}?key=${apiKey}`; + const mapsUrl = `${googleMapsApiUrl}&key=${apiKey}`; const scripts = document.getElementsByTagName('script'); - const scriptIndex = _.findIndex(scripts, (script) => script.src === mapsUrl); + // is script already loaded + let scriptIndex = _.findIndex(scripts, (script) => script.src.endsWith(mapsUrl)); if(scriptIndex > -1) { return scripts[scriptIndex]; } + // is script loaded with diff api_key, remove the script and load again + scriptIndex = _.findIndex(scripts, (script) => script.src.startsWith(googleMapsApiUrl)); + if(scriptIndex > -1) { + scripts[scriptIndex].remove(); + } const script = document.createElement("script"); script.type = "text/javascript"; diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx b/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx index c90bd5b3d..1b5d9410a 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx +++ b/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx @@ -59,7 +59,8 @@ export default class EChartsReactCore extends PureComponent { !isEqual(prevProps.theme, this.props.theme) || !isEqual(prevProps.opts, this.props.opts) || !isEqual(prevProps.onEvents, this.props.onEvents) || - this.props.option.gmap + !isEqual(prevProps.mode, this.props.mode) + // this.props.option.gmap ) { this.dispose(); @@ -67,6 +68,11 @@ export default class EChartsReactCore extends PureComponent { return; } + if(this.props.mode === "json") { + this.updateEChartsOption(); + return; + } + // when these props are not isEqual, update echarts const pickKeys = ["option", "notMerge", "lazyUpdate", "showLoading", "loadingOption"]; if (!isEqual(_.pick(this.props, pickKeys), _.pick(prevProps, pickKeys))) { diff --git a/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/types.ts b/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/types.ts index b686408a4..2764d4b81 100644 --- a/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/types.ts +++ b/client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/types.ts @@ -69,4 +69,8 @@ export type EChartsReactProps = { * should update echarts options */ readonly shouldSetOption?: (prevProps: EChartsReactProps, props: EChartsReactProps) => boolean; + /** + * echarts mode: ui | json | map + */ + readonly mode?: 'ui' | 'json' | 'map' }; diff --git a/client/packages/lowcoder/package.json b/client/packages/lowcoder/package.json index 3e5579d0d..b9fd727cf 100644 --- a/client/packages/lowcoder/package.json +++ b/client/packages/lowcoder/package.json @@ -48,7 +48,7 @@ "cnchar": "^3.2.4", "copy-to-clipboard": "^3.3.3", "core-js": "^3.25.2", - "echarts": "^5.4.2", + "echarts": "^5.4.3", "echarts-wordcloud": "^2.1.0", "eslint4b-prebuilt-2": "^7.32.0", "file-saver": "^2.0.5", diff --git a/client/yarn.lock b/client/yarn.lock index 1ba2ab280..af6402202 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -6331,7 +6331,7 @@ __metadata: languageName: node linkType: hard -"color-name@npm:~1.1.4": +"color-name@npm:^1.1.4, color-name@npm:~1.1.4": version: 1.1.4 resolution: "color-name@npm:1.1.4" checksum: b0445859521eb4021cd0fb0cc1a75cecf67fceecae89b63f62b201cca8d345baf8b952c966862a9d9a2632987d4f6581f0ec8d957dfacece86f0a7919316f610 @@ -6839,6 +6839,13 @@ __metadata: languageName: node linkType: hard +"cssfontparser@npm:^1.2.1": + version: 1.2.1 + resolution: "cssfontparser@npm:1.2.1" + checksum: 952d487cddab591fb944f2a4c326a7736bc963784a6d92b6ad4051f3bf5ee49a732eff62e29a52ff085197cb07f5bd66525a2245ded7fd356113ac81be9238b9 + languageName: node + linkType: hard + "csso@npm:^4.2.0": version: 4.2.0 resolution: "csso@npm:4.2.0" @@ -7792,13 +7799,13 @@ __metadata: languageName: node linkType: hard -"echarts@npm:^5.4.2": - version: 5.4.2 - resolution: "echarts@npm:5.4.2" +"echarts@npm:^5.4.3": + version: 5.4.3 + resolution: "echarts@npm:5.4.3" dependencies: tslib: 2.3.0 - zrender: 5.4.3 - checksum: 933c28dada362314f7c7a5fd4243b44b24f75adb233f7c87541ac9a81734cb380a9683c3f56c8e559dacfddd363879e95a96f0047e33820123cd8f5b95b60f8f + zrender: 5.4.4 + checksum: f4f69becf1cf8f546f9488ffa3bffaa971dcfbd49f5d635f288cbc8c5177839154bd6c325d6ed72c2b822c89c9bba4947ac73400614fd23c6f2f7ace3c939132 languageName: node linkType: hard @@ -10546,6 +10553,16 @@ __metadata: languageName: node linkType: hard +"jest-canvas-mock@npm:^2.5.2": + version: 2.5.2 + resolution: "jest-canvas-mock@npm:2.5.2" + dependencies: + cssfontparser: ^1.2.1 + moo-color: ^1.0.2 + checksum: a3004d2e96473049045e49dcf98e5ea6011494048ab42b5422b3089d9ff406aaca8353e79587055d840fa145541668eb8f78613765f252ad5901a8217e91ea5d + languageName: node + linkType: hard + "jest-changed-files@npm:^29.5.0": version: 29.5.0 resolution: "jest-changed-files@npm:29.5.0" @@ -11836,6 +11853,7 @@ __metadata: echarts-extension-gmap: ^1.6.0 echarts-wordcloud: ^2.1.0 jest: 29.3.0 + jest-canvas-mock: ^2.5.2 lowcoder-cli: "workspace:^" lowcoder-sdk: "workspace:^" mermaid: ^10.2.4 @@ -12006,7 +12024,7 @@ __metadata: copy-to-clipboard: ^3.3.3 core-js: ^3.25.2 dotenv: ^16.0.3 - echarts: ^5.4.2 + echarts: ^5.4.3 echarts-wordcloud: ^2.1.0 eslint: ^8.0.0 eslint-config-react-app: ^7.0.1 @@ -13060,6 +13078,15 @@ __metadata: languageName: node linkType: hard +"moo-color@npm:^1.0.2": + version: 1.0.3 + resolution: "moo-color@npm:1.0.3" + dependencies: + color-name: ^1.1.4 + checksum: 02bf59b6bbd5e86641bc062e2dc0843e6e579e18ef67e1c8e93bfc01945df578f20e66ce16aa9632db2aa0e16806e0914a26eb345a804f45fff1ae12a8906a29 + languageName: node + linkType: hard + "mq-polyfill@npm:^1.1.8": version: 1.1.8 resolution: "mq-polyfill@npm:1.1.8" @@ -19300,12 +19327,12 @@ __metadata: languageName: node linkType: hard -"zrender@npm:5.4.3": - version: 5.4.3 - resolution: "zrender@npm:5.4.3" +"zrender@npm:5.4.4": + version: 5.4.4 + resolution: "zrender@npm:5.4.4" dependencies: tslib: 2.3.0 - checksum: ae89584fbe4256217e500a74183fd5870a2bed7e7b3234cd78fcbc0a1a82da8449596b2019105927069531b567ecf94425fb171abd6cedcbf517e52fdf438722 + checksum: 4b317346af8eca38e62ba029239c3a13e97eac4fa15b3ddadbae23442d8b373f0e937c255dee8080d6bb2fc79c9da54f1106415586ed8942bd8bc684b3890ea9 languageName: node linkType: hard