You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by yu...@apache.org on 2021/04/16 11:34:05 UTC
[echarts] 01/01: feat(gauge): Add data index and series index for
indexing the data by element
This is an automated email from the ASF dual-hosted git repository.
yufeng04 pushed a commit to branch feat-14655
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit ddf639b8d4fffc4326cac7d220a769c6c3f00eef
Author: yufeng04 <74...@qq.com>
AuthorDate: Fri Apr 16 19:26:52 2021 +0800
feat(gauge): Add data index and series index for indexing the data by element
---
dist/echarts.js | 156746 +++++++++++++++++-----------------------
dist/echarts.js.map | 8 +-
i18n/langCS-obj.js | 172 +
i18n/langCS.js | 168 +
i18n/langFR-obj.js | 47 +-
i18n/langFR.js | 47 +-
src/chart/gauge/GaugeView.ts | 7 +
src/data/List.ts | 30 +-
src/util/innerStore.ts | 25 +
9 files changed, 67761 insertions(+), 89489 deletions(-)
diff --git a/dist/echarts.js b/dist/echarts.js
index 4bb4ce1..e96a7ab 100644
--- a/dist/echarts.js
+++ b/dist/echarts.js
@@ -1,90225 +1,68137 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.echarts = {}));
-}(this, (function (exports) { 'use strict';
-
- /*! *****************************************************************************
- 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.
- ***************************************************************************** */
- /* global Reflect, Promise */
-
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
-
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
-
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
-
- function __spreadArrays() {
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
- r[k] = a[j];
- return r;
- }
-
- var Browser = (function () {
- function Browser() {
- this.firefox = false;
- this.ie = false;
- this.edge = false;
- this.newEdge = false;
- this.weChat = false;
- }
- return Browser;
- }());
- var Env = (function () {
- function Env() {
- this.browser = new Browser();
- this.node = false;
- this.wxa = false;
- this.worker = false;
- this.canvasSupported = false;
- this.svgSupported = false;
- this.touchEventsSupported = false;
- this.pointerEventsSupported = false;
- this.domSupported = false;
- }
- return Env;
- }());
- var env = new Env();
- if (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {
- env.wxa = true;
- env.canvasSupported = true;
- env.touchEventsSupported = true;
- }
- else if (typeof document === 'undefined' && typeof self !== 'undefined') {
- env.worker = true;
- env.canvasSupported = true;
- }
- else if (typeof navigator === 'undefined') {
- env.node = true;
- env.canvasSupported = true;
- env.svgSupported = true;
- }
- else {
- detect(navigator.userAgent, env);
- }
- function detect(ua, env) {
- var browser = env.browser;
- var firefox = ua.match(/Firefox\/([\d.]+)/);
- var ie = ua.match(/MSIE\s([\d.]+)/)
- || ua.match(/Trident\/.+?rv:(([\d.]+))/);
- var edge = ua.match(/Edge?\/([\d.]+)/);
- var weChat = (/micromessenger/i).test(ua);
- if (firefox) {
- browser.firefox = true;
- browser.version = firefox[1];
- }
- if (ie) {
- browser.ie = true;
- browser.version = ie[1];
- }
- if (edge) {
- browser.edge = true;
- browser.version = edge[1];
- browser.newEdge = +edge[1].split('.')[0] > 18;
- }
- if (weChat) {
- browser.weChat = true;
- }
- env.canvasSupported = !!document.createElement('canvas').getContext;
- env.svgSupported = typeof SVGRect !== 'undefined';
- env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;
- env.pointerEventsSupported = 'onpointerdown' in window
- && (browser.edge || (browser.ie && +browser.version >= 11));
- env.domSupported = typeof document !== 'undefined';
- }
-
- var BUILTIN_OBJECT = {
- '[object Function]': true,
- '[object RegExp]': true,
- '[object Date]': true,
- '[object Error]': true,
- '[object CanvasGradient]': true,
- '[object CanvasPattern]': true,
- '[object Image]': true,
- '[object Canvas]': true
+// ------------- WRAPPED UMD --------------- //
+(function (root, factory) {
+ window.__DEV__ = true;
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['exports'], factory);
+ } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+ // CommonJS
+ factory(exports);
+ } else {
+ // Browser globals
+ factory((root.echarts = {}));
+ }
+}(typeof self !== 'undefined' ? self : this, function (exports, b) {
+
+var __defProp = Object.defineProperty;
+var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
+var __export = (target, all) => {
+ __markAsModule(target);
+ for (var name in all)
+ __defProp(target, name, {get: all[name], enumerable: true});
+};
+
+// src/echarts.all.ts
+__export(exports, {
+ Axis: () => Axis_default,
+ ChartView: () => Chart_default,
+ ComponentModel: () => Component_default,
+ ComponentView: () => Component_default2,
+ List: () => List_default,
+ Model: () => Model_default,
+ PRIORITY: () => PRIORITY,
+ SeriesModel: () => Series_default,
+ color: () => color_exports,
+ connect: () => connect,
+ dataTool: () => dataTool,
+ dependencies: () => dependencies,
+ disConnect: () => disConnect,
+ disconnect: () => disconnect,
+ dispose: () => dispose2,
+ env: () => env_default,
+ extendChartView: () => extendChartView,
+ extendComponentModel: () => extendComponentModel,
+ extendComponentView: () => extendComponentView,
+ extendSeriesModel: () => extendSeriesModel,
+ format: () => format_exports,
+ getCoordinateSystemDimensions: () => getCoordinateSystemDimensions,
+ getInstanceByDom: () => getInstanceByDom,
+ getInstanceById: () => getInstanceById,
+ getMap: () => getMap,
+ graphic: () => graphic_exports2,
+ helper: () => helper_exports,
+ init: () => init2,
+ innerDrawElementOnCanvas: () => brushSingle,
+ matrix: () => matrix_exports,
+ number: () => number_exports,
+ parseGeoJSON: () => parseGeoJSON,
+ parseGeoJson: () => parseGeoJSON,
+ registerAction: () => registerAction,
+ registerCoordinateSystem: () => registerCoordinateSystem,
+ registerLayout: () => registerLayout,
+ registerLoading: () => registerLoading,
+ registerLocale: () => registerLocale,
+ registerMap: () => registerMap,
+ registerPostInit: () => registerPostInit,
+ registerPostUpdate: () => registerPostUpdate,
+ registerPreprocessor: () => registerPreprocessor,
+ registerProcessor: () => registerProcessor,
+ registerTheme: () => registerTheme,
+ registerTransform: () => registerTransform,
+ registerVisual: () => registerVisual,
+ setCanvasCreator: () => setCanvasCreator,
+ throttle: () => throttle,
+ time: () => time_exports,
+ use: () => use,
+ util: () => util_exports2,
+ vector: () => vector_exports,
+ version: () => version2,
+ zrUtil: () => util_exports,
+ zrender: () => zrender_exports
+});
+
+// ../zrender/src/zrender.ts
+var zrender_exports = {};
+__export(zrender_exports, {
+ dispose: () => dispose,
+ disposeAll: () => disposeAll,
+ getInstance: () => getInstance,
+ init: () => init,
+ registerPainter: () => registerPainter,
+ version: () => version
+});
+
+// ../zrender/src/core/env.ts
+var Browser = class {
+ constructor() {
+ this.firefox = false;
+ this.ie = false;
+ this.edge = false;
+ this.newEdge = false;
+ this.weChat = false;
+ }
+};
+var Env = class {
+ constructor() {
+ this.browser = new Browser();
+ this.node = false;
+ this.wxa = false;
+ this.worker = false;
+ this.canvasSupported = false;
+ this.svgSupported = false;
+ this.touchEventsSupported = false;
+ this.pointerEventsSupported = false;
+ this.domSupported = false;
+ this.transformSupported = false;
+ this.transform3dSupported = false;
+ }
+};
+var env = new Env();
+if (typeof wx === "object" && typeof wx.getSystemInfoSync === "function") {
+ env.wxa = true;
+ env.canvasSupported = true;
+ env.touchEventsSupported = true;
+} else if (typeof document === "undefined" && typeof self !== "undefined") {
+ env.worker = true;
+ env.canvasSupported = true;
+} else if (typeof navigator === "undefined") {
+ env.node = true;
+ env.canvasSupported = true;
+ env.svgSupported = true;
+} else {
+ detect(navigator.userAgent, env);
+}
+function detect(ua, env2) {
+ const browser = env2.browser;
+ const firefox = ua.match(/Firefox\/([\d.]+)/);
+ const ie = ua.match(/MSIE\s([\d.]+)/) || ua.match(/Trident\/.+?rv:(([\d.]+))/);
+ const edge = ua.match(/Edge?\/([\d.]+)/);
+ const weChat = /micromessenger/i.test(ua);
+ if (firefox) {
+ browser.firefox = true;
+ browser.version = firefox[1];
+ }
+ if (ie) {
+ browser.ie = true;
+ browser.version = ie[1];
+ }
+ if (edge) {
+ browser.edge = true;
+ browser.version = edge[1];
+ browser.newEdge = +edge[1].split(".")[0] > 18;
+ }
+ if (weChat) {
+ browser.weChat = true;
+ }
+ env2.canvasSupported = !!document.createElement("canvas").getContext;
+ env2.svgSupported = typeof SVGRect !== "undefined";
+ env2.touchEventsSupported = "ontouchstart" in window && !browser.ie && !browser.edge;
+ env2.pointerEventsSupported = "onpointerdown" in window && (browser.edge || browser.ie && +browser.version >= 11);
+ env2.domSupported = typeof document !== "undefined";
+ const style = document.documentElement.style;
+ env2.transform3dSupported = (browser.ie && "transition" in style || browser.edge || "WebKitCSSMatrix" in window && "m11" in new WebKitCSSMatrix() || "MozPerspective" in style) && !("OTransition" in style);
+ env2.transformSupported = env2.transform3dSupported || browser.ie && +browser.version >= 9;
+}
+var env_default = env;
+
+// ../zrender/src/core/util.ts
+var util_exports = {};
+__export(util_exports, {
+ $override: () => $override,
+ HashMap: () => HashMap,
+ assert: () => assert,
+ bind: () => bind,
+ clone: () => clone,
+ concatArray: () => concatArray,
+ createCanvas: () => createCanvas,
+ createHashMap: () => createHashMap,
+ createObject: () => createObject,
+ curry: () => curry,
+ defaults: () => defaults,
+ each: () => each,
+ eqNaN: () => eqNaN,
+ extend: () => extend,
+ filter: () => filter,
+ find: () => find,
+ guid: () => guid,
+ hasOwn: () => hasOwn,
+ indexOf: () => indexOf,
+ inherits: () => inherits,
+ isArray: () => isArray,
+ isArrayLike: () => isArrayLike,
+ isBuiltInObject: () => isBuiltInObject,
+ isDom: () => isDom,
+ isFunction: () => isFunction,
+ isGradientObject: () => isGradientObject,
+ isNumber: () => isNumber,
+ isObject: () => isObject,
+ isPatternObject: () => isPatternObject,
+ isPrimitive: () => isPrimitive,
+ isRegExp: () => isRegExp,
+ isString: () => isString,
+ isStringSafe: () => isStringSafe,
+ isTypedArray: () => isTypedArray,
+ keys: () => keys,
+ logError: () => logError,
+ map: () => map,
+ merge: () => merge,
+ mergeAll: () => mergeAll,
+ mixin: () => mixin,
+ noop: () => noop,
+ normalizeCssArray: () => normalizeCssArray,
+ reduce: () => reduce,
+ retrieve: () => retrieve,
+ retrieve2: () => retrieve2,
+ retrieve3: () => retrieve3,
+ setAsPrimitive: () => setAsPrimitive,
+ slice: () => slice,
+ trim: () => trim
+});
+var BUILTIN_OBJECT = {
+ "[object Function]": true,
+ "[object RegExp]": true,
+ "[object Date]": true,
+ "[object Error]": true,
+ "[object CanvasGradient]": true,
+ "[object CanvasPattern]": true,
+ "[object Image]": true,
+ "[object Canvas]": true
+};
+var TYPED_ARRAY = {
+ "[object Int8Array]": true,
+ "[object Uint8Array]": true,
+ "[object Uint8ClampedArray]": true,
+ "[object Int16Array]": true,
+ "[object Uint16Array]": true,
+ "[object Int32Array]": true,
+ "[object Uint32Array]": true,
+ "[object Float32Array]": true,
+ "[object Float64Array]": true
+};
+var objToString = Object.prototype.toString;
+var arrayProto = Array.prototype;
+var nativeForEach = arrayProto.forEach;
+var nativeFilter = arrayProto.filter;
+var nativeSlice = arrayProto.slice;
+var nativeMap = arrayProto.map;
+var ctorFunction = function() {
+}.constructor;
+var protoFunction = ctorFunction ? ctorFunction.prototype : null;
+var methods = {};
+function $override(name, fn) {
+ methods[name] = fn;
+}
+var idStart = 2311;
+function guid() {
+ return idStart++;
+}
+function logError(...args) {
+ if (typeof console !== "undefined") {
+ console.error.apply(console, args);
+ }
+}
+function clone(source) {
+ if (source == null || typeof source !== "object") {
+ return source;
+ }
+ let result = source;
+ const typeStr = objToString.call(source);
+ if (typeStr === "[object Array]") {
+ if (!isPrimitive(source)) {
+ result = [];
+ for (let i = 0, len2 = source.length; i < len2; i++) {
+ result[i] = clone(source[i]);
+ }
+ }
+ } else if (TYPED_ARRAY[typeStr]) {
+ if (!isPrimitive(source)) {
+ const Ctor = source.constructor;
+ if (Ctor.from) {
+ result = Ctor.from(source);
+ } else {
+ result = new Ctor(source.length);
+ for (let i = 0, len2 = source.length; i < len2; i++) {
+ result[i] = clone(source[i]);
+ }
+ }
+ }
+ } else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
+ result = {};
+ for (let key in source) {
+ if (source.hasOwnProperty(key)) {
+ result[key] = clone(source[key]);
+ }
+ }
+ }
+ return result;
+}
+function merge(target, source, overwrite) {
+ if (!isObject(source) || !isObject(target)) {
+ return overwrite ? clone(source) : target;
+ }
+ for (let key in source) {
+ if (source.hasOwnProperty(key)) {
+ const targetProp = target[key];
+ const sourceProp = source[key];
+ if (isObject(sourceProp) && isObject(targetProp) && !isArray(sourceProp) && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) && !isBuiltInObject(sourceProp) && !isBuiltInObject(targetProp) && !isPrimitive(sourceProp) && !isPrimitive(targetProp)) {
+ merge(targetProp, sourceProp, overwrite);
+ } else if (overwrite || !(key in target)) {
+ target[key] = clone(source[key]);
+ }
+ }
+ }
+ return target;
+}
+function mergeAll(targetAndSources, overwrite) {
+ let result = targetAndSources[0];
+ for (let i = 1, len2 = targetAndSources.length; i < len2; i++) {
+ result = merge(result, targetAndSources[i], overwrite);
+ }
+ return result;
+}
+function extend(target, source) {
+ if (Object.assign) {
+ Object.assign(target, source);
+ } else {
+ for (let key in source) {
+ if (source.hasOwnProperty(key)) {
+ target[key] = source[key];
+ }
+ }
+ }
+ return target;
+}
+function defaults(target, source, overlay) {
+ const keysArr = keys(source);
+ for (let i = 0; i < keysArr.length; i++) {
+ let key = keysArr[i];
+ if (overlay ? source[key] != null : target[key] == null) {
+ target[key] = source[key];
+ }
+ }
+ return target;
+}
+var createCanvas = function() {
+ return methods.createCanvas();
+};
+methods.createCanvas = function() {
+ return document.createElement("canvas");
+};
+function indexOf(array, value) {
+ if (array) {
+ if (array.indexOf) {
+ return array.indexOf(value);
+ }
+ for (let i = 0, len2 = array.length; i < len2; i++) {
+ if (array[i] === value) {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+function inherits(clazz, baseClazz) {
+ const clazzPrototype = clazz.prototype;
+ function F() {
+ }
+ F.prototype = baseClazz.prototype;
+ clazz.prototype = new F();
+ for (let prop in clazzPrototype) {
+ if (clazzPrototype.hasOwnProperty(prop)) {
+ clazz.prototype[prop] = clazzPrototype[prop];
+ }
+ }
+ clazz.prototype.constructor = clazz;
+ clazz.superClass = baseClazz;
+}
+function mixin(target, source, override) {
+ target = "prototype" in target ? target.prototype : target;
+ source = "prototype" in source ? source.prototype : source;
+ if (Object.getOwnPropertyNames) {
+ const keyList = Object.getOwnPropertyNames(source);
+ for (let i = 0; i < keyList.length; i++) {
+ const key = keyList[i];
+ if (key !== "constructor") {
+ if (override ? source[key] != null : target[key] == null) {
+ target[key] = source[key];
+ }
+ }
+ }
+ } else {
+ defaults(target, source, override);
+ }
+}
+function isArrayLike(data) {
+ if (!data) {
+ return false;
+ }
+ if (typeof data === "string") {
+ return false;
+ }
+ return typeof data.length === "number";
+}
+function each(arr, cb, context) {
+ if (!(arr && cb)) {
+ return;
+ }
+ if (arr.forEach && arr.forEach === nativeForEach) {
+ arr.forEach(cb, context);
+ } else if (arr.length === +arr.length) {
+ for (let i = 0, len2 = arr.length; i < len2; i++) {
+ cb.call(context, arr[i], i, arr);
+ }
+ } else {
+ for (let key in arr) {
+ if (arr.hasOwnProperty(key)) {
+ cb.call(context, arr[key], key, arr);
+ }
+ }
+ }
+}
+function map(arr, cb, context) {
+ if (!arr) {
+ return [];
+ }
+ if (!cb) {
+ return slice(arr);
+ }
+ if (arr.map && arr.map === nativeMap) {
+ return arr.map(cb, context);
+ } else {
+ const result = [];
+ for (let i = 0, len2 = arr.length; i < len2; i++) {
+ result.push(cb.call(context, arr[i], i, arr));
+ }
+ return result;
+ }
+}
+function reduce(arr, cb, memo, context) {
+ if (!(arr && cb)) {
+ return;
+ }
+ for (let i = 0, len2 = arr.length; i < len2; i++) {
+ memo = cb.call(context, memo, arr[i], i, arr);
+ }
+ return memo;
+}
+function filter(arr, cb, context) {
+ if (!arr) {
+ return [];
+ }
+ if (!cb) {
+ return slice(arr);
+ }
+ if (arr.filter && arr.filter === nativeFilter) {
+ return arr.filter(cb, context);
+ } else {
+ const result = [];
+ for (let i = 0, len2 = arr.length; i < len2; i++) {
+ if (cb.call(context, arr[i], i, arr)) {
+ result.push(arr[i]);
+ }
+ }
+ return result;
+ }
+}
+function find(arr, cb, context) {
+ if (!(arr && cb)) {
+ return;
+ }
+ for (let i = 0, len2 = arr.length; i < len2; i++) {
+ if (cb.call(context, arr[i], i, arr)) {
+ return arr[i];
+ }
+ }
+}
+function keys(obj) {
+ if (!obj) {
+ return [];
+ }
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+ let keyList = [];
+ for (let key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ keyList.push(key);
+ }
+ }
+ return keyList;
+}
+function bindPolyfill(func, context, ...args) {
+ return function() {
+ return func.apply(context, args.concat(nativeSlice.call(arguments)));
+ };
+}
+var bind = protoFunction && isFunction(protoFunction.bind) ? protoFunction.call.bind(protoFunction.bind) : bindPolyfill;
+function curry(func, ...args) {
+ return function() {
+ return func.apply(this, args.concat(nativeSlice.call(arguments)));
+ };
+}
+function isArray(value) {
+ if (Array.isArray) {
+ return Array.isArray(value);
+ }
+ return objToString.call(value) === "[object Array]";
+}
+function isFunction(value) {
+ return typeof value === "function";
+}
+function isString(value) {
+ return typeof value === "string";
+}
+function isStringSafe(value) {
+ return objToString.call(value) === "[object String]";
+}
+function isNumber(value) {
+ return typeof value === "number";
+}
+function isObject(value) {
+ const type = typeof value;
+ return type === "function" || !!value && type === "object";
+}
+function isBuiltInObject(value) {
+ return !!BUILTIN_OBJECT[objToString.call(value)];
+}
+function isTypedArray(value) {
+ return !!TYPED_ARRAY[objToString.call(value)];
+}
+function isDom(value) {
+ return typeof value === "object" && typeof value.nodeType === "number" && typeof value.ownerDocument === "object";
+}
+function isGradientObject(value) {
+ return value.colorStops != null;
+}
+function isPatternObject(value) {
+ return value.image != null;
+}
+function isRegExp(value) {
+ return objToString.call(value) === "[object RegExp]";
+}
+function eqNaN(value) {
+ return value !== value;
+}
+function retrieve(...args) {
+ for (let i = 0, len2 = args.length; i < len2; i++) {
+ if (args[i] != null) {
+ return args[i];
+ }
+ }
+}
+function retrieve2(value0, value1) {
+ return value0 != null ? value0 : value1;
+}
+function retrieve3(value0, value1, value2) {
+ return value0 != null ? value0 : value1 != null ? value1 : value2;
+}
+function slice(arr, ...args) {
+ return nativeSlice.apply(arr, args);
+}
+function normalizeCssArray(val) {
+ if (typeof val === "number") {
+ return [val, val, val, val];
+ }
+ const len2 = val.length;
+ if (len2 === 2) {
+ return [val[0], val[1], val[0], val[1]];
+ } else if (len2 === 3) {
+ return [val[0], val[1], val[2], val[1]];
+ }
+ return val;
+}
+function assert(condition, message) {
+ if (!condition) {
+ throw new Error(message);
+ }
+}
+function trim(str) {
+ if (str == null) {
+ return null;
+ } else if (typeof str.trim === "function") {
+ return str.trim();
+ } else {
+ return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
+ }
+}
+var primitiveKey = "__ec_primitive__";
+function setAsPrimitive(obj) {
+ obj[primitiveKey] = true;
+}
+function isPrimitive(obj) {
+ return obj[primitiveKey];
+}
+var HashMap = class {
+ constructor(obj) {
+ this.data = {};
+ const isArr = isArray(obj);
+ this.data = {};
+ const thisMap = this;
+ obj instanceof HashMap ? obj.each(visit) : obj && each(obj, visit);
+ function visit(value, key) {
+ isArr ? thisMap.set(value, key) : thisMap.set(key, value);
+ }
+ }
+ get(key) {
+ return this.data.hasOwnProperty(key) ? this.data[key] : null;
+ }
+ set(key, value) {
+ return this.data[key] = value;
+ }
+ each(cb, context) {
+ for (let key in this.data) {
+ if (this.data.hasOwnProperty(key)) {
+ cb.call(context, this.data[key], key);
+ }
+ }
+ }
+ keys() {
+ return keys(this.data);
+ }
+ removeKey(key) {
+ delete this.data[key];
+ }
+};
+function createHashMap(obj) {
+ return new HashMap(obj);
+}
+function concatArray(a, b) {
+ const newArray = new a.constructor(a.length + b.length);
+ for (let i = 0; i < a.length; i++) {
+ newArray[i] = a[i];
+ }
+ const offset = a.length;
+ for (let i = 0; i < b.length; i++) {
+ newArray[i + offset] = b[i];
+ }
+ return newArray;
+}
+function createObject(proto2, properties) {
+ let obj;
+ if (Object.create) {
+ obj = Object.create(proto2);
+ } else {
+ const StyleCtor = function() {
};
- var TYPED_ARRAY = {
- '[object Int8Array]': true,
- '[object Uint8Array]': true,
- '[object Uint8ClampedArray]': true,
- '[object Int16Array]': true,
- '[object Uint16Array]': true,
- '[object Int32Array]': true,
- '[object Uint32Array]': true,
- '[object Float32Array]': true,
- '[object Float64Array]': true
+ StyleCtor.prototype = proto2;
+ obj = new StyleCtor();
+ }
+ if (properties) {
+ extend(obj, properties);
+ }
+ return obj;
+}
+function hasOwn(own, prop) {
+ return own.hasOwnProperty(prop);
+}
+function noop() {
+}
+
+// ../zrender/src/core/vector.ts
+var vector_exports = {};
+__export(vector_exports, {
+ add: () => add,
+ applyTransform: () => applyTransform,
+ clone: () => clone2,
+ copy: () => copy,
+ create: () => create,
+ dist: () => dist,
+ distSquare: () => distSquare,
+ distance: () => distance,
+ distanceSquare: () => distanceSquare,
+ div: () => div,
+ dot: () => dot,
+ len: () => len,
+ lenSquare: () => lenSquare,
+ length: () => length,
+ lengthSquare: () => lengthSquare,
+ lerp: () => lerp,
+ max: () => max,
+ min: () => min,
+ mul: () => mul,
+ negate: () => negate,
+ normalize: () => normalize,
+ scale: () => scale,
+ scaleAndAdd: () => scaleAndAdd,
+ set: () => set,
+ sub: () => sub
+});
+function create(x, y) {
+ if (x == null) {
+ x = 0;
+ }
+ if (y == null) {
+ y = 0;
+ }
+ return [x, y];
+}
+function copy(out2, v) {
+ out2[0] = v[0];
+ out2[1] = v[1];
+ return out2;
+}
+function clone2(v) {
+ return [v[0], v[1]];
+}
+function set(out2, a, b) {
+ out2[0] = a;
+ out2[1] = b;
+ return out2;
+}
+function add(out2, v12, v22) {
+ out2[0] = v12[0] + v22[0];
+ out2[1] = v12[1] + v22[1];
+ return out2;
+}
+function scaleAndAdd(out2, v12, v22, a) {
+ out2[0] = v12[0] + v22[0] * a;
+ out2[1] = v12[1] + v22[1] * a;
+ return out2;
+}
+function sub(out2, v12, v22) {
+ out2[0] = v12[0] - v22[0];
+ out2[1] = v12[1] - v22[1];
+ return out2;
+}
+function len(v) {
+ return Math.sqrt(lenSquare(v));
+}
+var length = len;
+function lenSquare(v) {
+ return v[0] * v[0] + v[1] * v[1];
+}
+var lengthSquare = lenSquare;
+function mul(out2, v12, v22) {
+ out2[0] = v12[0] * v22[0];
+ out2[1] = v12[1] * v22[1];
+ return out2;
+}
+function div(out2, v12, v22) {
+ out2[0] = v12[0] / v22[0];
+ out2[1] = v12[1] / v22[1];
+ return out2;
+}
+function dot(v12, v22) {
+ return v12[0] * v22[0] + v12[1] * v22[1];
+}
+function scale(out2, v, s) {
+ out2[0] = v[0] * s;
+ out2[1] = v[1] * s;
+ return out2;
+}
+function normalize(out2, v) {
+ const d = len(v);
+ if (d === 0) {
+ out2[0] = 0;
+ out2[1] = 0;
+ } else {
+ out2[0] = v[0] / d;
+ out2[1] = v[1] / d;
+ }
+ return out2;
+}
+function distance(v12, v22) {
+ return Math.sqrt((v12[0] - v22[0]) * (v12[0] - v22[0]) + (v12[1] - v22[1]) * (v12[1] - v22[1]));
+}
+var dist = distance;
+function distanceSquare(v12, v22) {
+ return (v12[0] - v22[0]) * (v12[0] - v22[0]) + (v12[1] - v22[1]) * (v12[1] - v22[1]);
+}
+var distSquare = distanceSquare;
+function negate(out2, v) {
+ out2[0] = -v[0];
+ out2[1] = -v[1];
+ return out2;
+}
+function lerp(out2, v12, v22, t) {
+ out2[0] = v12[0] + t * (v22[0] - v12[0]);
+ out2[1] = v12[1] + t * (v22[1] - v12[1]);
+ return out2;
+}
+function applyTransform(out2, v, m2) {
+ const x = v[0];
+ const y = v[1];
+ out2[0] = m2[0] * x + m2[2] * y + m2[4];
+ out2[1] = m2[1] * x + m2[3] * y + m2[5];
+ return out2;
+}
+function min(out2, v12, v22) {
+ out2[0] = Math.min(v12[0], v22[0]);
+ out2[1] = Math.min(v12[1], v22[1]);
+ return out2;
+}
+function max(out2, v12, v22) {
+ out2[0] = Math.max(v12[0], v22[0]);
+ out2[1] = Math.max(v12[1], v22[1]);
+ return out2;
+}
+
+// ../zrender/src/mixin/Draggable.ts
+var Param = class {
+ constructor(target, e2) {
+ this.target = target;
+ this.topTarget = e2 && e2.topTarget;
+ }
+};
+var Draggable = class {
+ constructor(handler) {
+ this.handler = handler;
+ handler.on("mousedown", this._dragStart, this);
+ handler.on("mousemove", this._drag, this);
+ handler.on("mouseup", this._dragEnd, this);
+ }
+ _dragStart(e2) {
+ let draggingTarget = e2.target;
+ while (draggingTarget && !draggingTarget.draggable) {
+ draggingTarget = draggingTarget.parent;
+ }
+ if (draggingTarget) {
+ this._draggingTarget = draggingTarget;
+ draggingTarget.dragging = true;
+ this._x = e2.offsetX;
+ this._y = e2.offsetY;
+ this.handler.dispatchToElement(new Param(draggingTarget, e2), "dragstart", e2.event);
+ }
+ }
+ _drag(e2) {
+ const draggingTarget = this._draggingTarget;
+ if (draggingTarget) {
+ const x = e2.offsetX;
+ const y = e2.offsetY;
+ const dx = x - this._x;
+ const dy = y - this._y;
+ this._x = x;
+ this._y = y;
+ draggingTarget.drift(dx, dy, e2);
+ this.handler.dispatchToElement(new Param(draggingTarget, e2), "drag", e2.event);
+ const dropTarget = this.handler.findHover(x, y, draggingTarget).target;
+ const lastDropTarget = this._dropTarget;
+ this._dropTarget = dropTarget;
+ if (draggingTarget !== dropTarget) {
+ if (lastDropTarget && dropTarget !== lastDropTarget) {
+ this.handler.dispatchToElement(new Param(lastDropTarget, e2), "dragleave", e2.event);
+ }
+ if (dropTarget && dropTarget !== lastDropTarget) {
+ this.handler.dispatchToElement(new Param(dropTarget, e2), "dragenter", e2.event);
+ }
+ }
+ }
+ }
+ _dragEnd(e2) {
+ const draggingTarget = this._draggingTarget;
+ if (draggingTarget) {
+ draggingTarget.dragging = false;
+ }
+ this.handler.dispatchToElement(new Param(draggingTarget, e2), "dragend", e2.event);
+ if (this._dropTarget) {
+ this.handler.dispatchToElement(new Param(this._dropTarget, e2), "drop", e2.event);
+ }
+ this._draggingTarget = null;
+ this._dropTarget = null;
+ }
+};
+var Draggable_default = Draggable;
+
+// ../zrender/src/core/Eventful.ts
+var Eventful = class {
+ constructor(eventProcessors) {
+ if (eventProcessors) {
+ this._$eventProcessor = eventProcessors;
+ }
+ }
+ on(event, query, handler, context) {
+ if (!this._$handlers) {
+ this._$handlers = {};
+ }
+ const _h = this._$handlers;
+ if (typeof query === "function") {
+ context = handler;
+ handler = query;
+ query = null;
+ }
+ if (!handler || !event) {
+ return this;
+ }
+ const eventProcessor = this._$eventProcessor;
+ if (query != null && eventProcessor && eventProcessor.normalizeQuery) {
+ query = eventProcessor.normalizeQuery(query);
+ }
+ if (!_h[event]) {
+ _h[event] = [];
+ }
+ for (let i = 0; i < _h[event].length; i++) {
+ if (_h[event][i].h === handler) {
+ return this;
+ }
+ }
+ const wrap = {
+ h: handler,
+ query,
+ ctx: context || this,
+ callAtLast: handler.zrEventfulCallAtLast
};
- var objToString = Object.prototype.toString;
- var arrayProto = Array.prototype;
- var nativeForEach = arrayProto.forEach;
- var nativeFilter = arrayProto.filter;
- var nativeSlice = arrayProto.slice;
- var nativeMap = arrayProto.map;
- var ctorFunction = function () { }.constructor;
- var protoFunction = ctorFunction ? ctorFunction.prototype : null;
- var methods = {};
- function $override(name, fn) {
- methods[name] = fn;
- }
- var idStart = 0x0907;
- function guid() {
- return idStart++;
- }
- function logError() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- if (typeof console !== 'undefined') {
- console.error.apply(console, args);
- }
- }
- function clone(source) {
- if (source == null || typeof source !== 'object') {
- return source;
- }
- var result = source;
- var typeStr = objToString.call(source);
- if (typeStr === '[object Array]') {
- if (!isPrimitive(source)) {
- result = [];
- for (var i = 0, len = source.length; i < len; i++) {
- result[i] = clone(source[i]);
- }
- }
+ const lastIndex = _h[event].length - 1;
+ const lastWrap = _h[event][lastIndex];
+ lastWrap && lastWrap.callAtLast ? _h[event].splice(lastIndex, 0, wrap) : _h[event].push(wrap);
+ return this;
+ }
+ isSilent(eventName) {
+ const _h = this._$handlers;
+ return !_h || !_h[eventName] || !_h[eventName].length;
+ }
+ off(eventType, handler) {
+ const _h = this._$handlers;
+ if (!_h) {
+ return this;
+ }
+ if (!eventType) {
+ this._$handlers = {};
+ return this;
+ }
+ if (handler) {
+ if (_h[eventType]) {
+ const newList = [];
+ for (let i = 0, l = _h[eventType].length; i < l; i++) {
+ if (_h[eventType][i].h !== handler) {
+ newList.push(_h[eventType][i]);
+ }
+ }
+ _h[eventType] = newList;
+ }
+ if (_h[eventType] && _h[eventType].length === 0) {
+ delete _h[eventType];
+ }
+ } else {
+ delete _h[eventType];
+ }
+ return this;
+ }
+ trigger(eventType, ...args) {
+ if (!this._$handlers) {
+ return this;
+ }
+ const _h = this._$handlers[eventType];
+ const eventProcessor = this._$eventProcessor;
+ if (_h) {
+ const argLen = args.length;
+ const len2 = _h.length;
+ for (let i = 0; i < len2; i++) {
+ const hItem = _h[i];
+ if (eventProcessor && eventProcessor.filter && hItem.query != null && !eventProcessor.filter(eventType, hItem.query)) {
+ continue;
}
- else if (TYPED_ARRAY[typeStr]) {
- if (!isPrimitive(source)) {
- var Ctor = source.constructor;
- if (Ctor.from) {
- result = Ctor.from(source);
- }
- else {
- result = new Ctor(source.length);
- for (var i = 0, len = source.length; i < len; i++) {
- result[i] = clone(source[i]);
- }
- }
- }
+ switch (argLen) {
+ case 0:
+ hItem.h.call(hItem.ctx);
+ break;
+ case 1:
+ hItem.h.call(hItem.ctx, args[0]);
+ break;
+ case 2:
+ hItem.h.call(hItem.ctx, args[0], args[1]);
+ break;
+ default:
+ hItem.h.apply(hItem.ctx, args);
+ break;
}
- else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
- result = {};
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- result[key] = clone(source[key]);
- }
- }
+ }
+ }
+ eventProcessor && eventProcessor.afterTrigger && eventProcessor.afterTrigger(eventType);
+ return this;
+ }
+ triggerWithContext(type) {
+ if (!this._$handlers) {
+ return this;
+ }
+ const _h = this._$handlers[type];
+ const eventProcessor = this._$eventProcessor;
+ if (_h) {
+ const args = arguments;
+ const argLen = args.length;
+ const ctx = args[argLen - 1];
+ const len2 = _h.length;
+ for (let i = 0; i < len2; i++) {
+ const hItem = _h[i];
+ if (eventProcessor && eventProcessor.filter && hItem.query != null && !eventProcessor.filter(type, hItem.query)) {
+ continue;
}
- return result;
+ switch (argLen) {
+ case 0:
+ hItem.h.call(ctx);
+ break;
+ case 1:
+ hItem.h.call(ctx, args[0]);
+ break;
+ case 2:
+ hItem.h.call(ctx, args[0], args[1]);
+ break;
+ default:
+ hItem.h.apply(ctx, args.slice(1, argLen - 1));
+ break;
+ }
+ }
}
- function merge(target, source, overwrite) {
- if (!isObject(source) || !isObject(target)) {
- return overwrite ? clone(source) : target;
- }
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- var targetProp = target[key];
- var sourceProp = source[key];
- if (isObject(sourceProp)
- && isObject(targetProp)
- && !isArray(sourceProp)
- && !isArray(targetProp)
- && !isDom(sourceProp)
- && !isDom(targetProp)
- && !isBuiltInObject(sourceProp)
- && !isBuiltInObject(targetProp)
- && !isPrimitive(sourceProp)
- && !isPrimitive(targetProp)) {
- merge(targetProp, sourceProp, overwrite);
- }
- else if (overwrite || !(key in target)) {
- target[key] = clone(source[key]);
- }
- }
+ eventProcessor && eventProcessor.afterTrigger && eventProcessor.afterTrigger(type);
+ return this;
+ }
+};
+var Eventful_default = Eventful;
+
+// ../zrender/src/core/fourPointsTransform.ts
+var LN2 = Math.log(2);
+function determinant(rows, rank, rowStart, rowMask, colMask, detCache) {
+ const cacheKey = rowMask + "-" + colMask;
+ const fullRank = rows.length;
+ if (detCache.hasOwnProperty(cacheKey)) {
+ return detCache[cacheKey];
+ }
+ if (rank === 1) {
+ const colStart = Math.round(Math.log((1 << fullRank) - 1 & ~colMask) / LN2);
+ return rows[rowStart][colStart];
+ }
+ const subRowMask = rowMask | 1 << rowStart;
+ let subRowStart = rowStart + 1;
+ while (rowMask & 1 << subRowStart) {
+ subRowStart++;
+ }
+ let sum2 = 0;
+ for (let j = 0, colLocalIdx = 0; j < fullRank; j++) {
+ const colTag = 1 << j;
+ if (!(colTag & colMask)) {
+ sum2 += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j] * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);
+ colLocalIdx++;
+ }
+ }
+ detCache[cacheKey] = sum2;
+ return sum2;
+}
+function buildTransformer(src, dest) {
+ const mA = [
+ [src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]],
+ [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]],
+ [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]],
+ [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]],
+ [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]],
+ [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]],
+ [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]],
+ [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]
+ ];
+ const detCache = {};
+ const det = determinant(mA, 8, 0, 0, 0, detCache);
+ if (det === 0) {
+ return;
+ }
+ const vh = [];
+ for (let i = 0; i < 8; i++) {
+ for (let j = 0; j < 8; j++) {
+ vh[j] == null && (vh[j] = 0);
+ vh[j] += ((i + j) % 2 ? -1 : 1) * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache) / det * dest[i];
+ }
+ }
+ return function(out2, srcPointX, srcPointY) {
+ const pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;
+ out2[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;
+ out2[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;
+ };
+}
+
+// ../zrender/src/core/dom.ts
+var EVENT_SAVED_PROP = "___zrEVENTSAVED";
+var _calcOut = [];
+function transformLocalCoord(out2, elFrom, elTarget, inX, inY) {
+ return transformCoordWithViewport(_calcOut, elFrom, inX, inY, true) && transformCoordWithViewport(out2, elTarget, _calcOut[0], _calcOut[1]);
+}
+function transformCoordWithViewport(out2, el, inX, inY, inverse) {
+ if (el.getBoundingClientRect && env_default.domSupported && !isCanvasEl(el)) {
+ const saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
+ const markers = prepareCoordMarkers(el, saved);
+ const transformer = preparePointerTransformer(markers, saved, inverse);
+ if (transformer) {
+ transformer(out2, inX, inY);
+ return true;
+ }
+ }
+ return false;
+}
+function prepareCoordMarkers(el, saved) {
+ let markers = saved.markers;
+ if (markers) {
+ return markers;
+ }
+ markers = saved.markers = [];
+ const propLR = ["left", "right"];
+ const propTB = ["top", "bottom"];
+ for (let i = 0; i < 4; i++) {
+ const marker = document.createElement("div");
+ const stl = marker.style;
+ const idxLR = i % 2;
+ const idxTB = (i >> 1) % 2;
+ stl.cssText = [
+ "position: absolute",
+ "visibility: hidden",
+ "padding: 0",
+ "margin: 0",
+ "border-width: 0",
+ "user-select: none",
+ "width:0",
+ "height:0",
+ propLR[idxLR] + ":0",
+ propTB[idxTB] + ":0",
+ propLR[1 - idxLR] + ":auto",
+ propTB[1 - idxTB] + ":auto",
+ ""
+ ].join("!important;");
+ el.appendChild(marker);
+ markers.push(marker);
+ }
+ return markers;
+}
+function preparePointerTransformer(markers, saved, inverse) {
+ const transformerName = inverse ? "invTrans" : "trans";
+ const transformer = saved[transformerName];
+ const oldSrcCoords = saved.srcCoords;
+ const srcCoords = [];
+ const destCoords = [];
+ let oldCoordTheSame = true;
+ for (let i = 0; i < 4; i++) {
+ const rect = markers[i].getBoundingClientRect();
+ const ii = 2 * i;
+ const x = rect.left;
+ const y = rect.top;
+ srcCoords.push(x, y);
+ oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
+ destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
+ }
+ return oldCoordTheSame && transformer ? transformer : (saved.srcCoords = srcCoords, saved[transformerName] = inverse ? buildTransformer(destCoords, srcCoords) : buildTransformer(srcCoords, destCoords));
+}
+function isCanvasEl(el) {
+ return el.nodeName.toUpperCase() === "CANVAS";
+}
+
+// ../zrender/src/core/event.ts
+var isDomLevel2 = typeof window !== "undefined" && !!window.addEventListener;
+var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
+var _calcOut2 = [];
+function clientToLocal(el, e2, out2, calculate) {
+ out2 = out2 || {};
+ if (calculate || !env_default.canvasSupported) {
+ calculateZrXY(el, e2, out2);
+ } else if (env_default.browser.firefox && e2.layerX != null && e2.layerX !== e2.offsetX) {
+ out2.zrX = e2.layerX;
+ out2.zrY = e2.layerY;
+ } else if (e2.offsetX != null) {
+ out2.zrX = e2.offsetX;
+ out2.zrY = e2.offsetY;
+ } else {
+ calculateZrXY(el, e2, out2);
+ }
+ return out2;
+}
+function calculateZrXY(el, e2, out2) {
+ if (env_default.domSupported && el.getBoundingClientRect) {
+ const ex = e2.clientX;
+ const ey = e2.clientY;
+ if (isCanvasEl(el)) {
+ const box2 = el.getBoundingClientRect();
+ out2.zrX = ex - box2.left;
+ out2.zrY = ey - box2.top;
+ return;
+ } else {
+ if (transformCoordWithViewport(_calcOut2, el, ex, ey)) {
+ out2.zrX = _calcOut2[0];
+ out2.zrY = _calcOut2[1];
+ return;
+ }
+ }
+ }
+ out2.zrX = out2.zrY = 0;
+}
+function getNativeEvent(e2) {
+ return e2 || window.event;
+}
+function normalizeEvent(el, e2, calculate) {
+ e2 = getNativeEvent(e2);
+ if (e2.zrX != null) {
+ return e2;
+ }
+ const eventType = e2.type;
+ const isTouch = eventType && eventType.indexOf("touch") >= 0;
+ if (!isTouch) {
+ clientToLocal(el, e2, e2, calculate);
+ const wheelDelta = getWheelDeltaMayPolyfill(e2);
+ e2.zrDelta = wheelDelta ? wheelDelta / 120 : -(e2.detail || 0) / 3;
+ } else {
+ const touch = eventType !== "touchend" ? e2.targetTouches[0] : e2.changedTouches[0];
+ touch && clientToLocal(el, touch, e2, calculate);
+ }
+ const button = e2.button;
+ if (e2.which == null && button !== void 0 && MOUSE_EVENT_REG.test(e2.type)) {
+ e2.which = button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;
+ }
+ return e2;
+}
+function getWheelDeltaMayPolyfill(e2) {
+ const rawWheelDelta = e2.wheelDelta;
+ if (rawWheelDelta) {
+ return rawWheelDelta;
+ }
+ const deltaX = e2.deltaX;
+ const deltaY = e2.deltaY;
+ if (deltaX == null || deltaY == null) {
+ return rawWheelDelta;
+ }
+ const delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);
+ const sign = deltaY > 0 ? -1 : deltaY < 0 ? 1 : deltaX > 0 ? -1 : 1;
+ return 3 * delta * sign;
+}
+function addEventListener(el, name, handler, opt) {
+ if (isDomLevel2) {
+ el.addEventListener(name, handler, opt);
+ } else {
+ el.attachEvent("on" + name, handler);
+ }
+}
+function removeEventListener(el, name, handler, opt) {
+ if (isDomLevel2) {
+ el.removeEventListener(name, handler, opt);
+ } else {
+ el.detachEvent("on" + name, handler);
+ }
+}
+var stop = isDomLevel2 ? function(e2) {
+ e2.preventDefault();
+ e2.stopPropagation();
+ e2.cancelBubble = true;
+} : function(e2) {
+ e2.returnValue = false;
+ e2.cancelBubble = true;
+};
+function isMiddleOrRightButtonOnMouseUpDown(e2) {
+ return e2.which === 2 || e2.which === 3;
+}
+
+// ../zrender/src/core/GestureMgr.ts
+var GestureMgr = class {
+ constructor() {
+ this._track = [];
+ }
+ recognize(event, target, root) {
+ this._doTrack(event, target, root);
+ return this._recognize(event);
+ }
+ clear() {
+ this._track.length = 0;
+ return this;
+ }
+ _doTrack(event, target, root) {
+ const touches = event.touches;
+ if (!touches) {
+ return;
+ }
+ const trackItem = {
+ points: [],
+ touches: [],
+ target,
+ event
+ };
+ for (let i = 0, len2 = touches.length; i < len2; i++) {
+ const touch = touches[i];
+ const pos = clientToLocal(root, touch, {});
+ trackItem.points.push([pos.zrX, pos.zrY]);
+ trackItem.touches.push(touch);
+ }
+ this._track.push(trackItem);
+ }
+ _recognize(event) {
+ for (let eventName in recognizers) {
+ if (recognizers.hasOwnProperty(eventName)) {
+ const gestureInfo = recognizers[eventName](this._track, event);
+ if (gestureInfo) {
+ return gestureInfo;
+ }
+ }
+ }
+ }
+};
+function dist2(pointPair) {
+ const dx = pointPair[1][0] - pointPair[0][0];
+ const dy = pointPair[1][1] - pointPair[0][1];
+ return Math.sqrt(dx * dx + dy * dy);
+}
+function center(pointPair) {
+ return [
+ (pointPair[0][0] + pointPair[1][0]) / 2,
+ (pointPair[0][1] + pointPair[1][1]) / 2
+ ];
+}
+var recognizers = {
+ pinch: function(tracks, event) {
+ const trackLen = tracks.length;
+ if (!trackLen) {
+ return;
+ }
+ const pinchEnd = (tracks[trackLen - 1] || {}).points;
+ const pinchPre = (tracks[trackLen - 2] || {}).points || pinchEnd;
+ if (pinchPre && pinchPre.length > 1 && pinchEnd && pinchEnd.length > 1) {
+ let pinchScale = dist2(pinchEnd) / dist2(pinchPre);
+ !isFinite(pinchScale) && (pinchScale = 1);
+ event.pinchScale = pinchScale;
+ const pinchCenter = center(pinchEnd);
+ event.pinchX = pinchCenter[0];
+ event.pinchY = pinchCenter[1];
+ return {
+ type: "pinch",
+ target: tracks[0].target,
+ event
+ };
+ }
+ }
+};
+
+// ../zrender/src/Handler.ts
+var SILENT = "silent";
+function makeEventPacket(eveType, targetInfo, event) {
+ return {
+ type: eveType,
+ event,
+ target: targetInfo.target,
+ topTarget: targetInfo.topTarget,
+ cancelBubble: false,
+ offsetX: event.zrX,
+ offsetY: event.zrY,
+ gestureEvent: event.gestureEvent,
+ pinchX: event.pinchX,
+ pinchY: event.pinchY,
+ pinchScale: event.pinchScale,
+ wheelDelta: event.zrDelta,
+ zrByTouch: event.zrByTouch,
+ which: event.which,
+ stop: stopEvent
+ };
+}
+function stopEvent() {
+ stop(this.event);
+}
+var EmptyProxy = class extends Eventful_default {
+ constructor() {
+ super(...arguments);
+ this.handler = null;
+ }
+ dispose() {
+ }
+ setCursor() {
+ }
+};
+var HoveredResult = class {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+};
+var handlerNames = [
+ "click",
+ "dblclick",
+ "mousewheel",
+ "mouseout",
+ "mouseup",
+ "mousedown",
+ "mousemove",
+ "contextmenu"
+];
+var Handler = class extends Eventful_default {
+ constructor(storage2, painter, proxy, painterRoot) {
+ super();
+ this._hovered = new HoveredResult(0, 0);
+ this.storage = storage2;
+ this.painter = painter;
+ this.painterRoot = painterRoot;
+ proxy = proxy || new EmptyProxy();
+ this.proxy = null;
+ this.setHandlerProxy(proxy);
+ this._draggingMgr = new Draggable_default(this);
+ }
+ setHandlerProxy(proxy) {
+ if (this.proxy) {
+ this.proxy.dispose();
+ }
+ if (proxy) {
+ each(handlerNames, function(name) {
+ proxy.on && proxy.on(name, this[name], this);
+ }, this);
+ proxy.handler = this;
+ }
+ this.proxy = proxy;
+ }
+ mousemove(event) {
+ const x = event.zrX;
+ const y = event.zrY;
+ const isOutside = isOutsideBoundary(this, x, y);
+ let lastHovered = this._hovered;
+ let lastHoveredTarget = lastHovered.target;
+ if (lastHoveredTarget && !lastHoveredTarget.__zr) {
+ lastHovered = this.findHover(lastHovered.x, lastHovered.y);
+ lastHoveredTarget = lastHovered.target;
+ }
+ const hovered = this._hovered = isOutside ? new HoveredResult(x, y) : this.findHover(x, y);
+ const hoveredTarget = hovered.target;
+ const proxy = this.proxy;
+ proxy.setCursor && proxy.setCursor(hoveredTarget ? hoveredTarget.cursor : "default");
+ if (lastHoveredTarget && hoveredTarget !== lastHoveredTarget) {
+ this.dispatchToElement(lastHovered, "mouseout", event);
+ }
+ this.dispatchToElement(hovered, "mousemove", event);
+ if (hoveredTarget && hoveredTarget !== lastHoveredTarget) {
+ this.dispatchToElement(hovered, "mouseover", event);
+ }
+ }
+ mouseout(event) {
+ const eventControl = event.zrEventControl;
+ if (eventControl !== "only_globalout") {
+ this.dispatchToElement(this._hovered, "mouseout", event);
+ }
+ if (eventControl !== "no_globalout") {
+ this.trigger("globalout", {type: "globalout", event});
+ }
+ }
+ resize() {
+ this._hovered = new HoveredResult(0, 0);
+ }
+ dispatch(eventName, eventArgs) {
+ const handler = this[eventName];
+ handler && handler.call(this, eventArgs);
+ }
+ dispose() {
+ this.proxy.dispose();
+ this.storage = null;
+ this.proxy = null;
+ this.painter = null;
+ }
+ setCursorStyle(cursorStyle) {
+ const proxy = this.proxy;
+ proxy.setCursor && proxy.setCursor(cursorStyle);
+ }
+ dispatchToElement(targetInfo, eventName, event) {
+ targetInfo = targetInfo || {};
+ let el = targetInfo.target;
+ if (el && el.silent) {
+ return;
+ }
+ const eventKey = "on" + eventName;
+ const eventPacket = makeEventPacket(eventName, targetInfo, event);
+ while (el) {
+ el[eventKey] && (eventPacket.cancelBubble = !!el[eventKey].call(el, eventPacket));
+ el.trigger(eventName, eventPacket);
+ el = el.__hostTarget ? el.__hostTarget : el.parent;
+ if (eventPacket.cancelBubble) {
+ break;
+ }
+ }
+ if (!eventPacket.cancelBubble) {
+ this.trigger(eventName, eventPacket);
+ if (this.painter && this.painter.eachOtherLayer) {
+ this.painter.eachOtherLayer(function(layer) {
+ if (typeof layer[eventKey] === "function") {
+ layer[eventKey].call(layer, eventPacket);
+ }
+ if (layer.trigger) {
+ layer.trigger(eventName, eventPacket);
+ }
+ });
+ }
+ }
+ }
+ findHover(x, y, exclude) {
+ const list = this.storage.getDisplayList();
+ const out2 = new HoveredResult(x, y);
+ for (let i = list.length - 1; i >= 0; i--) {
+ let hoverCheckResult;
+ if (list[i] !== exclude && !list[i].ignore && (hoverCheckResult = isHover(list[i], x, y))) {
+ !out2.topTarget && (out2.topTarget = list[i]);
+ if (hoverCheckResult !== SILENT) {
+ out2.target = list[i];
+ break;
}
- return target;
+ }
}
- function mergeAll(targetAndSources, overwrite) {
- var result = targetAndSources[0];
- for (var i = 1, len = targetAndSources.length; i < len; i++) {
- result = merge(result, targetAndSources[i], overwrite);
+ return out2;
+ }
+ processGesture(event, stage) {
+ if (!this._gestureMgr) {
+ this._gestureMgr = new GestureMgr();
+ }
+ const gestureMgr = this._gestureMgr;
+ stage === "start" && gestureMgr.clear();
+ const gestureInfo = gestureMgr.recognize(event, this.findHover(event.zrX, event.zrY, null).target, this.proxy.dom);
+ stage === "end" && gestureMgr.clear();
+ if (gestureInfo) {
+ const type = gestureInfo.type;
+ event.gestureEvent = type;
+ let res = new HoveredResult();
+ res.target = gestureInfo.target;
+ this.dispatchToElement(res, type, gestureInfo.event);
+ }
+ }
+};
+each(["click", "mousedown", "mouseup", "mousewheel", "dblclick", "contextmenu"], function(name) {
+ Handler.prototype[name] = function(event) {
+ const x = event.zrX;
+ const y = event.zrY;
+ const isOutside = isOutsideBoundary(this, x, y);
+ let hovered;
+ let hoveredTarget;
+ if (name !== "mouseup" || !isOutside) {
+ hovered = this.findHover(x, y);
+ hoveredTarget = hovered.target;
+ }
+ if (name === "mousedown") {
+ this._downEl = hoveredTarget;
+ this._downPoint = [event.zrX, event.zrY];
+ this._upEl = hoveredTarget;
+ } else if (name === "mouseup") {
+ this._upEl = hoveredTarget;
+ } else if (name === "click") {
+ if (this._downEl !== this._upEl || !this._downPoint || dist(this._downPoint, [event.zrX, event.zrY]) > 4) {
+ return;
+ }
+ this._downPoint = null;
+ }
+ this.dispatchToElement(hovered, name, event);
+ };
+});
+function isHover(displayable, x, y) {
+ if (displayable[displayable.rectHover ? "rectContain" : "contain"](x, y)) {
+ let el = displayable;
+ let isSilent;
+ let ignoreClip = false;
+ while (el) {
+ if (el.ignoreClip) {
+ ignoreClip = true;
+ }
+ if (!ignoreClip) {
+ let clipPath = el.getClipPath();
+ if (clipPath && !clipPath.contain(x, y)) {
+ return false;
}
- return result;
+ if (el.silent) {
+ isSilent = true;
+ }
+ }
+ const hostEl = el.__hostTarget;
+ el = hostEl ? hostEl : el.parent;
+ }
+ return isSilent ? SILENT : true;
+ }
+ return false;
+}
+function isOutsideBoundary(handlerInstance, x, y) {
+ const painter = handlerInstance.painter;
+ return x < 0 || x > painter.getWidth() || y < 0 || y > painter.getHeight();
+}
+var Handler_default = Handler;
+
+// ../zrender/src/core/matrix.ts
+var matrix_exports = {};
+__export(matrix_exports, {
+ clone: () => clone3,
+ copy: () => copy2,
+ create: () => create2,
+ identity: () => identity,
+ invert: () => invert,
+ mul: () => mul2,
+ rotate: () => rotate,
+ scale: () => scale2,
+ translate: () => translate
+});
+function create2() {
+ return [1, 0, 0, 1, 0, 0];
+}
+function identity(out2) {
+ out2[0] = 1;
+ out2[1] = 0;
+ out2[2] = 0;
+ out2[3] = 1;
+ out2[4] = 0;
+ out2[5] = 0;
+ return out2;
+}
+function copy2(out2, m2) {
+ out2[0] = m2[0];
+ out2[1] = m2[1];
+ out2[2] = m2[2];
+ out2[3] = m2[3];
+ out2[4] = m2[4];
+ out2[5] = m2[5];
+ return out2;
+}
+function mul2(out2, m1, m2) {
+ const out0 = m1[0] * m2[0] + m1[2] * m2[1];
+ const out1 = m1[1] * m2[0] + m1[3] * m2[1];
+ const out22 = m1[0] * m2[2] + m1[2] * m2[3];
+ const out3 = m1[1] * m2[2] + m1[3] * m2[3];
+ const out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
+ const out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
+ out2[0] = out0;
+ out2[1] = out1;
+ out2[2] = out22;
+ out2[3] = out3;
+ out2[4] = out4;
+ out2[5] = out5;
+ return out2;
+}
+function translate(out2, a, v) {
+ out2[0] = a[0];
+ out2[1] = a[1];
+ out2[2] = a[2];
+ out2[3] = a[3];
+ out2[4] = a[4] + v[0];
+ out2[5] = a[5] + v[1];
+ return out2;
+}
+function rotate(out2, a, rad) {
+ const aa = a[0];
+ const ac = a[2];
+ const atx = a[4];
+ const ab = a[1];
+ const ad = a[3];
+ const aty = a[5];
+ const st = Math.sin(rad);
+ const ct = Math.cos(rad);
+ out2[0] = aa * ct + ab * st;
+ out2[1] = -aa * st + ab * ct;
+ out2[2] = ac * ct + ad * st;
+ out2[3] = -ac * st + ct * ad;
+ out2[4] = ct * atx + st * aty;
+ out2[5] = ct * aty - st * atx;
+ return out2;
+}
+function scale2(out2, a, v) {
+ const vx = v[0];
+ const vy = v[1];
+ out2[0] = a[0] * vx;
+ out2[1] = a[1] * vy;
+ out2[2] = a[2] * vx;
+ out2[3] = a[3] * vy;
+ out2[4] = a[4] * vx;
+ out2[5] = a[5] * vy;
+ return out2;
+}
+function invert(out2, a) {
+ const aa = a[0];
+ const ac = a[2];
+ const atx = a[4];
+ const ab = a[1];
+ const ad = a[3];
+ const aty = a[5];
+ let det = aa * ad - ab * ac;
+ if (!det) {
+ return null;
+ }
+ det = 1 / det;
+ out2[0] = ad * det;
+ out2[1] = -ab * det;
+ out2[2] = -ac * det;
+ out2[3] = aa * det;
+ out2[4] = (ac * aty - ad * atx) * det;
+ out2[5] = (ab * atx - aa * aty) * det;
+ return out2;
+}
+function clone3(a) {
+ const b = create2();
+ copy2(b, a);
+ return b;
+}
+
+// ../zrender/src/core/Transformable.ts
+var mIdentity = identity;
+var EPSILON = 5e-5;
+function isNotAroundZero(val) {
+ return val > EPSILON || val < -EPSILON;
+}
+var scaleTmp = [];
+var tmpTransform = [];
+var originTransform = create2();
+var abs = Math.abs;
+var Transformable2 = class {
+ setPosition(arr) {
+ this.x = arr[0];
+ this.y = arr[1];
+ }
+ setScale(arr) {
+ this.scaleX = arr[0];
+ this.scaleY = arr[1];
+ }
+ setOrigin(arr) {
+ this.originX = arr[0];
+ this.originY = arr[1];
+ }
+ needLocalTransform() {
+ return isNotAroundZero(this.rotation) || isNotAroundZero(this.x) || isNotAroundZero(this.y) || isNotAroundZero(this.scaleX - 1) || isNotAroundZero(this.scaleY - 1);
+ }
+ updateTransform() {
+ const parent = this.parent;
+ const parentHasTransform = parent && parent.transform;
+ const needLocalTransform = this.needLocalTransform();
+ let m2 = this.transform;
+ if (!(needLocalTransform || parentHasTransform)) {
+ m2 && mIdentity(m2);
+ return;
+ }
+ m2 = m2 || create2();
+ if (needLocalTransform) {
+ this.getLocalTransform(m2);
+ } else {
+ mIdentity(m2);
+ }
+ if (parentHasTransform) {
+ if (needLocalTransform) {
+ mul2(m2, parent.transform, m2);
+ } else {
+ copy2(m2, parent.transform);
+ }
+ }
+ this.transform = m2;
+ this._resolveGlobalScaleRatio(m2);
+ }
+ _resolveGlobalScaleRatio(m2) {
+ const globalScaleRatio = this.globalScaleRatio;
+ if (globalScaleRatio != null && globalScaleRatio !== 1) {
+ this.getGlobalScale(scaleTmp);
+ const relX = scaleTmp[0] < 0 ? -1 : 1;
+ const relY = scaleTmp[1] < 0 ? -1 : 1;
+ const sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;
+ const sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;
+ m2[0] *= sx;
+ m2[1] *= sx;
+ m2[2] *= sy;
+ m2[3] *= sy;
+ }
+ this.invTransform = this.invTransform || create2();
+ invert(this.invTransform, m2);
+ }
+ getLocalTransform(m2) {
+ return Transformable2.getLocalTransform(this, m2);
+ }
+ getComputedTransform() {
+ let transformNode = this;
+ const ancestors = [];
+ while (transformNode) {
+ ancestors.push(transformNode);
+ transformNode = transformNode.parent;
+ }
+ while (transformNode = ancestors.pop()) {
+ transformNode.updateTransform();
+ }
+ return this.transform;
+ }
+ setLocalTransform(m2) {
+ if (!m2) {
+ return;
+ }
+ let sx = m2[0] * m2[0] + m2[1] * m2[1];
+ let sy = m2[2] * m2[2] + m2[3] * m2[3];
+ if (isNotAroundZero(sx - 1)) {
+ sx = Math.sqrt(sx);
+ }
+ if (isNotAroundZero(sy - 1)) {
+ sy = Math.sqrt(sy);
+ }
+ if (m2[0] < 0) {
+ sx = -sx;
+ }
+ if (m2[3] < 0) {
+ sy = -sy;
+ }
+ this.rotation = Math.atan2(-m2[1] / sy, m2[0] / sx);
+ if (sx < 0 && sy < 0) {
+ this.rotation += Math.PI;
+ sx = -sx;
+ sy = -sy;
+ }
+ this.x = m2[4];
+ this.y = m2[5];
+ this.scaleX = sx;
+ this.scaleY = sy;
+ }
+ decomposeTransform() {
+ if (!this.transform) {
+ return;
+ }
+ const parent = this.parent;
+ let m2 = this.transform;
+ if (parent && parent.transform) {
+ mul2(tmpTransform, parent.invTransform, m2);
+ m2 = tmpTransform;
+ }
+ const ox = this.originX;
+ const oy = this.originY;
+ if (ox || oy) {
+ originTransform[4] = ox;
+ originTransform[5] = oy;
+ mul2(tmpTransform, m2, originTransform);
+ tmpTransform[4] -= ox;
+ tmpTransform[5] -= oy;
+ m2 = tmpTransform;
+ }
+ this.setLocalTransform(m2);
+ }
+ getGlobalScale(out2) {
+ const m2 = this.transform;
+ out2 = out2 || [];
+ if (!m2) {
+ out2[0] = 1;
+ out2[1] = 1;
+ return out2;
+ }
+ out2[0] = Math.sqrt(m2[0] * m2[0] + m2[1] * m2[1]);
+ out2[1] = Math.sqrt(m2[2] * m2[2] + m2[3] * m2[3]);
+ if (m2[0] < 0) {
+ out2[0] = -out2[0];
+ }
+ if (m2[3] < 0) {
+ out2[1] = -out2[1];
+ }
+ return out2;
+ }
+ transformCoordToLocal(x, y) {
+ const v22 = [x, y];
+ const invTransform = this.invTransform;
+ if (invTransform) {
+ applyTransform(v22, v22, invTransform);
+ }
+ return v22;
+ }
+ transformCoordToGlobal(x, y) {
+ const v22 = [x, y];
+ const transform2 = this.transform;
+ if (transform2) {
+ applyTransform(v22, v22, transform2);
+ }
+ return v22;
+ }
+ getLineScale() {
+ const m2 = this.transform;
+ return m2 && abs(m2[0] - 1) > 1e-10 && abs(m2[3] - 1) > 1e-10 ? Math.sqrt(abs(m2[0] * m2[3] - m2[2] * m2[1])) : 1;
+ }
+ static getLocalTransform(target, m2) {
+ m2 = m2 || [];
+ mIdentity(m2);
+ const ox = target.originX || 0;
+ const oy = target.originY || 0;
+ const sx = target.scaleX;
+ const sy = target.scaleY;
+ const rotation = target.rotation || 0;
+ const x = target.x;
+ const y = target.y;
+ m2[4] -= ox;
+ m2[5] -= oy;
+ m2[0] *= sx;
+ m2[1] *= sy;
+ m2[2] *= sx;
+ m2[3] *= sy;
+ m2[4] *= sx;
+ m2[5] *= sy;
+ if (rotation) {
+ rotate(m2, m2, rotation);
+ }
+ m2[4] += ox;
+ m2[5] += oy;
+ m2[4] += x;
+ m2[5] += y;
+ return m2;
+ }
+};
+var Transformable = Transformable2;
+Transformable.initDefaultProps = function() {
+ const proto2 = Transformable2.prototype;
+ proto2.x = 0;
+ proto2.y = 0;
+ proto2.scaleX = 1;
+ proto2.scaleY = 1;
+ proto2.originX = 0;
+ proto2.originY = 0;
+ proto2.rotation = 0;
+ proto2.globalScaleRatio = 1;
+}();
+var Transformable_default = Transformable;
+
+// ../zrender/src/animation/easing.ts
+var easing = {
+ linear(k) {
+ return k;
+ },
+ quadraticIn(k) {
+ return k * k;
+ },
+ quadraticOut(k) {
+ return k * (2 - k);
+ },
+ quadraticInOut(k) {
+ if ((k *= 2) < 1) {
+ return 0.5 * k * k;
+ }
+ return -0.5 * (--k * (k - 2) - 1);
+ },
+ cubicIn(k) {
+ return k * k * k;
+ },
+ cubicOut(k) {
+ return --k * k * k + 1;
+ },
+ cubicInOut(k) {
+ if ((k *= 2) < 1) {
+ return 0.5 * k * k * k;
+ }
+ return 0.5 * ((k -= 2) * k * k + 2);
+ },
+ quarticIn(k) {
+ return k * k * k * k;
+ },
+ quarticOut(k) {
+ return 1 - --k * k * k * k;
+ },
+ quarticInOut(k) {
+ if ((k *= 2) < 1) {
+ return 0.5 * k * k * k * k;
+ }
+ return -0.5 * ((k -= 2) * k * k * k - 2);
+ },
+ quinticIn(k) {
+ return k * k * k * k * k;
+ },
+ quinticOut(k) {
+ return --k * k * k * k * k + 1;
+ },
+ quinticInOut(k) {
+ if ((k *= 2) < 1) {
+ return 0.5 * k * k * k * k * k;
+ }
+ return 0.5 * ((k -= 2) * k * k * k * k + 2);
+ },
+ sinusoidalIn(k) {
+ return 1 - Math.cos(k * Math.PI / 2);
+ },
+ sinusoidalOut(k) {
+ return Math.sin(k * Math.PI / 2);
+ },
+ sinusoidalInOut(k) {
+ return 0.5 * (1 - Math.cos(Math.PI * k));
+ },
+ exponentialIn(k) {
+ return k === 0 ? 0 : Math.pow(1024, k - 1);
+ },
+ exponentialOut(k) {
+ return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
+ },
+ exponentialInOut(k) {
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if ((k *= 2) < 1) {
+ return 0.5 * Math.pow(1024, k - 1);
+ }
+ return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
+ },
+ circularIn(k) {
+ return 1 - Math.sqrt(1 - k * k);
+ },
+ circularOut(k) {
+ return Math.sqrt(1 - --k * k);
+ },
+ circularInOut(k) {
+ if ((k *= 2) < 1) {
+ return -0.5 * (Math.sqrt(1 - k * k) - 1);
+ }
+ return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
+ },
+ elasticIn(k) {
+ let s;
+ let a = 0.1;
+ let p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p * Math.asin(1 / a) / (2 * Math.PI);
+ }
+ return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
+ },
+ elasticOut(k) {
+ let s;
+ let a = 0.1;
+ let p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p * Math.asin(1 / a) / (2 * Math.PI);
+ }
+ return a * Math.pow(2, -10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1;
+ },
+ elasticInOut(k) {
+ let s;
+ let a = 0.1;
+ let p = 0.4;
+ if (k === 0) {
+ return 0;
+ }
+ if (k === 1) {
+ return 1;
+ }
+ if (!a || a < 1) {
+ a = 1;
+ s = p / 4;
+ } else {
+ s = p * Math.asin(1 / a) / (2 * Math.PI);
+ }
+ if ((k *= 2) < 1) {
+ return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
+ }
+ return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
+ },
+ backIn(k) {
+ let s = 1.70158;
+ return k * k * ((s + 1) * k - s);
+ },
+ backOut(k) {
+ let s = 1.70158;
+ return --k * k * ((s + 1) * k + s) + 1;
+ },
+ backInOut(k) {
+ let s = 1.70158 * 1.525;
+ if ((k *= 2) < 1) {
+ return 0.5 * (k * k * ((s + 1) * k - s));
+ }
+ return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
+ },
+ bounceIn(k) {
+ return 1 - easing.bounceOut(1 - k);
+ },
+ bounceOut(k) {
+ if (k < 1 / 2.75) {
+ return 7.5625 * k * k;
+ } else if (k < 2 / 2.75) {
+ return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75;
+ } else if (k < 2.5 / 2.75) {
+ return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375;
+ } else {
+ return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375;
+ }
+ },
+ bounceInOut(k) {
+ if (k < 0.5) {
+ return easing.bounceIn(k * 2) * 0.5;
+ }
+ return easing.bounceOut(k * 2 - 1) * 0.5 + 0.5;
+ }
+};
+var easing_default = easing;
+
+// ../zrender/src/animation/Clip.ts
+var Clip = class {
+ constructor(opts) {
+ this._initialized = false;
+ this._startTime = 0;
+ this._pausedTime = 0;
+ this._paused = false;
+ this._life = opts.life || 1e3;
+ this._delay = opts.delay || 0;
+ this.loop = opts.loop == null ? false : opts.loop;
+ this.gap = opts.gap || 0;
+ this.easing = opts.easing || "linear";
+ this.onframe = opts.onframe;
+ this.ondestroy = opts.ondestroy;
+ this.onrestart = opts.onrestart;
+ }
+ step(globalTime, deltaTime) {
+ if (!this._initialized) {
+ this._startTime = globalTime + this._delay;
+ this._initialized = true;
+ }
+ if (this._paused) {
+ this._pausedTime += deltaTime;
+ return;
+ }
+ let percent = (globalTime - this._startTime - this._pausedTime) / this._life;
+ if (percent < 0) {
+ percent = 0;
+ }
+ percent = Math.min(percent, 1);
+ const easing2 = this.easing;
+ const easingFunc = typeof easing2 === "string" ? easing_default[easing2] : easing2;
+ const schedule = typeof easingFunc === "function" ? easingFunc(percent) : percent;
+ this.onframe && this.onframe(schedule);
+ if (percent === 1) {
+ if (this.loop) {
+ this._restart(globalTime);
+ this.onrestart && this.onrestart();
+ } else {
+ return true;
+ }
}
- function extend(target, source) {
- if (Object.assign) {
- Object.assign(target, source);
+ return false;
+ }
+ _restart(globalTime) {
+ const remainder = (globalTime - this._startTime - this._pausedTime) % this._life;
+ this._startTime = globalTime - remainder + this.gap;
+ this._pausedTime = 0;
+ }
+ pause() {
+ this._paused = true;
+ }
+ resume() {
+ this._paused = false;
+ }
+};
+var Clip_default = Clip;
+
+// ../zrender/src/tool/color.ts
+var color_exports = {};
+__export(color_exports, {
+ fastLerp: () => fastLerp,
+ fastMapToColor: () => fastMapToColor,
+ lerp: () => lerp2,
+ lift: () => lift,
+ lum: () => lum,
+ mapToColor: () => mapToColor,
+ modifyAlpha: () => modifyAlpha,
+ modifyHSL: () => modifyHSL,
+ parse: () => parse,
+ random: () => random,
+ stringify: () => stringify,
+ toHex: () => toHex
+});
+
+// ../zrender/src/core/LRU.ts
+var Entry = class {
+ constructor(val) {
+ this.value = val;
+ }
+};
+var LinkedList = class {
+ constructor() {
+ this._len = 0;
+ }
+ insert(val) {
+ const entry = new Entry(val);
+ this.insertEntry(entry);
+ return entry;
+ }
+ insertEntry(entry) {
+ if (!this.head) {
+ this.head = this.tail = entry;
+ } else {
+ this.tail.next = entry;
+ entry.prev = this.tail;
+ entry.next = null;
+ this.tail = entry;
+ }
+ this._len++;
+ }
+ remove(entry) {
+ const prev = entry.prev;
+ const next = entry.next;
+ if (prev) {
+ prev.next = next;
+ } else {
+ this.head = next;
+ }
+ if (next) {
+ next.prev = prev;
+ } else {
+ this.tail = prev;
+ }
+ entry.next = entry.prev = null;
+ this._len--;
+ }
+ len() {
+ return this._len;
+ }
+ clear() {
+ this.head = this.tail = null;
+ this._len = 0;
+ }
+};
+var LRU = class {
+ constructor(maxSize) {
+ this._list = new LinkedList();
+ this._maxSize = 10;
+ this._map = {};
+ this._maxSize = maxSize;
+ }
+ put(key, value) {
+ const list = this._list;
+ const map3 = this._map;
+ let removed = null;
+ if (map3[key] == null) {
+ const len2 = list.len();
+ let entry = this._lastRemovedEntry;
+ if (len2 >= this._maxSize && len2 > 0) {
+ const leastUsedEntry = list.head;
+ list.remove(leastUsedEntry);
+ delete map3[leastUsedEntry.key];
+ removed = leastUsedEntry.value;
+ this._lastRemovedEntry = leastUsedEntry;
+ }
+ if (entry) {
+ entry.value = value;
+ } else {
+ entry = new Entry(value);
+ }
+ entry.key = key;
+ list.insertEntry(entry);
+ map3[key] = entry;
+ }
+ return removed;
+ }
+ get(key) {
+ const entry = this._map[key];
+ const list = this._list;
+ if (entry != null) {
+ if (entry !== list.tail) {
+ list.remove(entry);
+ list.insertEntry(entry);
+ }
+ return entry.value;
+ }
+ }
+ clear() {
+ this._list.clear();
+ this._map = {};
+ }
+ len() {
+ return this._list.len();
+ }
+};
+var LRU_default = LRU;
+
+// ../zrender/src/tool/color.ts
+var kCSSColorTable = {
+ 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 clampCssByte(i) {
+ i = Math.round(i);
+ return i < 0 ? 0 : i > 255 ? 255 : i;
+}
+function clampCssAngle(i) {
+ i = Math.round(i);
+ return i < 0 ? 0 : i > 360 ? 360 : i;
+}
+function clampCssFloat(f) {
+ return f < 0 ? 0 : f > 1 ? 1 : f;
+}
+function parseCssInt(val) {
+ let str = val;
+ if (str.length && str.charAt(str.length - 1) === "%") {
+ return clampCssByte(parseFloat(str) / 100 * 255);
+ }
+ return clampCssByte(parseInt(str, 10));
+}
+function parseCssFloat(val) {
+ let str = val;
+ if (str.length && str.charAt(str.length - 1) === "%") {
+ return clampCssFloat(parseFloat(str) / 100);
+ }
+ return clampCssFloat(parseFloat(str));
+}
+function cssHueToRgb(m1, m2, h) {
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ if (h * 6 < 1) {
+ return m1 + (m2 - m1) * h * 6;
+ }
+ if (h * 2 < 1) {
+ return m2;
+ }
+ if (h * 3 < 2) {
+ return m1 + (m2 - m1) * (2 / 3 - h) * 6;
+ }
+ return m1;
+}
+function lerpNumber(a, b, p) {
+ return a + (b - a) * p;
+}
+function setRgba(out2, r, g, b, a) {
+ out2[0] = r;
+ out2[1] = g;
+ out2[2] = b;
+ out2[3] = a;
+ return out2;
+}
+function copyRgba(out2, a) {
+ out2[0] = a[0];
+ out2[1] = a[1];
+ out2[2] = a[2];
+ out2[3] = a[3];
+ return out2;
+}
+var colorCache = new LRU_default(20);
+var lastRemovedArr = null;
+function putToCache(colorStr, rgbaArr) {
+ if (lastRemovedArr) {
+ copyRgba(lastRemovedArr, rgbaArr);
+ }
+ lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || rgbaArr.slice());
+}
+function parse(colorStr, rgbaArr) {
+ if (!colorStr) {
+ return;
+ }
+ rgbaArr = rgbaArr || [];
+ let cached = colorCache.get(colorStr);
+ if (cached) {
+ return copyRgba(rgbaArr, cached);
+ }
+ colorStr = colorStr + "";
+ let str = colorStr.replace(/ /g, "").toLowerCase();
+ if (str in kCSSColorTable) {
+ copyRgba(rgbaArr, kCSSColorTable[str]);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ }
+ const strLen = str.length;
+ if (str.charAt(0) === "#") {
+ if (strLen === 4 || strLen === 5) {
+ const iv = parseInt(str.slice(1, 4), 16);
+ if (!(iv >= 0 && iv <= 4095)) {
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
+ }
+ setRgba(rgbaArr, (iv & 3840) >> 4 | (iv & 3840) >> 8, iv & 240 | (iv & 240) >> 4, iv & 15 | (iv & 15) << 4, strLen === 5 ? parseInt(str.slice(4), 16) / 15 : 1);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ } else if (strLen === 7 || strLen === 9) {
+ const iv = parseInt(str.slice(1, 7), 16);
+ if (!(iv >= 0 && iv <= 16777215)) {
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
+ }
+ setRgba(rgbaArr, (iv & 16711680) >> 16, (iv & 65280) >> 8, iv & 255, strLen === 9 ? parseInt(str.slice(7), 16) / 255 : 1);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ }
+ return;
+ }
+ let op = str.indexOf("(");
+ let ep = str.indexOf(")");
+ if (op !== -1 && ep + 1 === strLen) {
+ let fname = str.substr(0, op);
+ let params = str.substr(op + 1, ep - (op + 1)).split(",");
+ let alpha = 1;
+ switch (fname) {
+ case "rgba":
+ if (params.length !== 4) {
+ return params.length === 3 ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1) : setRgba(rgbaArr, 0, 0, 0, 1);
+ }
+ alpha = parseCssFloat(params.pop());
+ case "rgb":
+ if (params.length !== 3) {
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
}
- else {
- for (var key in source) {
- if (source.hasOwnProperty(key)) {
- target[key] = source[key];
- }
- }
+ setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ case "hsla":
+ if (params.length !== 4) {
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
}
- return target;
- }
- function defaults(target, source, overlay) {
- var keysArr = keys(source);
- for (var i = 0; i < keysArr.length; i++) {
- var key = keysArr[i];
- if ((overlay ? source[key] != null : target[key] == null)) {
- target[key] = source[key];
- }
+ params[3] = parseCssFloat(params[3]);
+ hsla2rgba(params, rgbaArr);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ case "hsl":
+ if (params.length !== 3) {
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
}
- return target;
+ hsla2rgba(params, rgbaArr);
+ putToCache(colorStr, rgbaArr);
+ return rgbaArr;
+ default:
+ return;
}
- var createCanvas = function () {
- return methods.createCanvas();
- };
- methods.createCanvas = function () {
- return document.createElement('canvas');
- };
- function indexOf(array, value) {
- if (array) {
- if (array.indexOf) {
- return array.indexOf(value);
- }
- for (var i = 0, len = array.length; i < len; i++) {
- if (array[i] === value) {
- return i;
- }
- }
- }
- return -1;
+ }
+ setRgba(rgbaArr, 0, 0, 0, 1);
+ return;
+}
+function hsla2rgba(hsla, rgba) {
+ const h = (parseFloat(hsla[0]) % 360 + 360) % 360 / 360;
+ const s = parseCssFloat(hsla[1]);
+ const l = parseCssFloat(hsla[2]);
+ const m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
+ const m1 = l * 2 - m2;
+ rgba = rgba || [];
+ setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1);
+ if (hsla.length === 4) {
+ rgba[3] = hsla[3];
+ }
+ return rgba;
+}
+function rgba2hsla(rgba) {
+ if (!rgba) {
+ return;
+ }
+ const R = rgba[0] / 255;
+ const G = rgba[1] / 255;
+ const B = rgba[2] / 255;
+ const vMin = Math.min(R, G, B);
+ const vMax = Math.max(R, G, B);
+ const delta = vMax - vMin;
+ const L = (vMax + vMin) / 2;
+ let H;
+ let S;
+ if (delta === 0) {
+ H = 0;
+ S = 0;
+ } else {
+ if (L < 0.5) {
+ S = delta / (vMax + vMin);
+ } else {
+ S = delta / (2 - vMax - vMin);
+ }
+ const deltaR = ((vMax - R) / 6 + delta / 2) / delta;
+ const deltaG = ((vMax - G) / 6 + delta / 2) / delta;
+ const deltaB = ((vMax - B) / 6 + delta / 2) / delta;
+ if (R === vMax) {
+ H = deltaB - deltaG;
+ } else if (G === vMax) {
+ H = 1 / 3 + deltaR - deltaB;
+ } else if (B === vMax) {
+ H = 2 / 3 + deltaG - deltaR;
+ }
+ if (H < 0) {
+ H += 1;
+ }
+ if (H > 1) {
+ H -= 1;
+ }
+ }
+ const hsla = [H * 360, S, L];
+ if (rgba[3] != null) {
+ hsla.push(rgba[3]);
+ }
+ return hsla;
+}
+function lift(color2, level) {
+ const colorArr = parse(color2);
+ if (colorArr) {
+ for (let i = 0; i < 3; i++) {
+ if (level < 0) {
+ colorArr[i] = colorArr[i] * (1 - level) | 0;
+ } else {
+ colorArr[i] = (255 - colorArr[i]) * level + colorArr[i] | 0;
+ }
+ if (colorArr[i] > 255) {
+ colorArr[i] = 255;
+ } else if (colorArr[i] < 0) {
+ colorArr[i] = 0;
+ }
+ }
+ return stringify(colorArr, colorArr.length === 4 ? "rgba" : "rgb");
+ }
+}
+function toHex(color2) {
+ const colorArr = parse(color2);
+ if (colorArr) {
+ return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + +colorArr[2]).toString(16).slice(1);
+ }
+}
+function fastLerp(normalizedValue, colors, out2) {
+ if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) {
+ return;
+ }
+ out2 = out2 || [];
+ const value = normalizedValue * (colors.length - 1);
+ const leftIndex = Math.floor(value);
+ const rightIndex = Math.ceil(value);
+ const leftColor = colors[leftIndex];
+ const rightColor = colors[rightIndex];
+ const dv = value - leftIndex;
+ out2[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));
+ out2[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));
+ out2[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));
+ out2[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));
+ return out2;
+}
+var fastMapToColor = fastLerp;
+function lerp2(normalizedValue, colors, fullOutput) {
+ if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) {
+ return;
+ }
+ const value = normalizedValue * (colors.length - 1);
+ const leftIndex = Math.floor(value);
+ const rightIndex = Math.ceil(value);
+ const leftColor = parse(colors[leftIndex]);
+ const rightColor = parse(colors[rightIndex]);
+ const dv = value - leftIndex;
+ const color2 = stringify([
+ clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),
+ clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),
+ clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),
+ clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))
+ ], "rgba");
+ return fullOutput ? {
+ color: color2,
+ leftIndex,
+ rightIndex,
+ value
+ } : color2;
+}
+var mapToColor = lerp2;
+function modifyHSL(color2, h, s, l) {
+ let colorArr = parse(color2);
+ if (color2) {
+ colorArr = rgba2hsla(colorArr);
+ h != null && (colorArr[0] = clampCssAngle(h));
+ s != null && (colorArr[1] = parseCssFloat(s));
+ l != null && (colorArr[2] = parseCssFloat(l));
+ return stringify(hsla2rgba(colorArr), "rgba");
+ }
+}
+function modifyAlpha(color2, alpha) {
+ const colorArr = parse(color2);
+ if (colorArr && alpha != null) {
+ colorArr[3] = clampCssFloat(alpha);
+ return stringify(colorArr, "rgba");
+ }
+}
+function stringify(arrColor, type) {
+ if (!arrColor || !arrColor.length) {
+ return;
+ }
+ let colorStr = arrColor[0] + "," + arrColor[1] + "," + arrColor[2];
+ if (type === "rgba" || type === "hsva" || type === "hsla") {
+ colorStr += "," + arrColor[3];
+ }
+ return type + "(" + colorStr + ")";
+}
+function lum(color2, backgroundLum) {
+ const arr = parse(color2);
+ return arr ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255 + (1 - arr[3]) * backgroundLum : 0;
+}
+function random() {
+ let r = Math.round(Math.random() * 255);
+ let g = Math.round(Math.random() * 255);
+ let b = Math.round(Math.random() * 255);
+ return "rgb(" + r + "," + g + "," + b + ")";
+}
+
+// ../zrender/src/animation/Animator.ts
+var arraySlice = Array.prototype.slice;
+function interpolateNumber(p0, p1, percent) {
+ return (p1 - p0) * percent + p0;
+}
+function step(p0, p1, percent) {
+ return percent > 0.5 ? p1 : p0;
+}
+function interpolate1DArray(out2, p0, p1, percent) {
+ const len2 = p0.length;
+ for (let i = 0; i < len2; i++) {
+ out2[i] = interpolateNumber(p0[i], p1[i], percent);
+ }
+}
+function interpolate2DArray(out2, p0, p1, percent) {
+ const len2 = p0.length;
+ const len22 = len2 && p0[0].length;
+ for (let i = 0; i < len2; i++) {
+ if (!out2[i]) {
+ out2[i] = [];
+ }
+ for (let j = 0; j < len22; j++) {
+ out2[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);
+ }
+ }
+}
+function add1DArray(out2, p0, p1, sign) {
+ const len2 = p0.length;
+ for (let i = 0; i < len2; i++) {
+ out2[i] = p0[i] + p1[i] * sign;
+ }
+ return out2;
+}
+function add2DArray(out2, p0, p1, sign) {
+ const len2 = p0.length;
+ const len22 = len2 && p0[0].length;
+ for (let i = 0; i < len2; i++) {
+ if (!out2[i]) {
+ out2[i] = [];
+ }
+ for (let j = 0; j < len22; j++) {
+ out2[i][j] = p0[i][j] + p1[i][j] * sign;
+ }
+ }
+ return out2;
+}
+function fillArray(val0, val1, arrDim) {
+ let arr0 = val0;
+ let arr1 = val1;
+ if (!arr0.push || !arr1.push) {
+ return;
+ }
+ const arr0Len = arr0.length;
+ const arr1Len = arr1.length;
+ if (arr0Len !== arr1Len) {
+ const isPreviousLarger = arr0Len > arr1Len;
+ if (isPreviousLarger) {
+ arr0.length = arr1Len;
+ } else {
+ for (let i = arr0Len; i < arr1Len; i++) {
+ arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));
+ }
+ }
+ }
+ const len2 = arr0[0] && arr0[0].length;
+ for (let i = 0; i < arr0.length; i++) {
+ if (arrDim === 1) {
+ if (isNaN(arr0[i])) {
+ arr0[i] = arr1[i];
+ }
+ } else {
+ for (let j = 0; j < len2; j++) {
+ if (isNaN(arr0[i][j])) {
+ arr0[i][j] = arr1[i][j];
+ }
+ }
+ }
+ }
+}
+function is1DArraySame(arr0, arr1) {
+ const len2 = arr0.length;
+ if (len2 !== arr1.length) {
+ return false;
+ }
+ for (let i = 0; i < len2; i++) {
+ if (arr0[i] !== arr1[i]) {
+ return false;
}
- function inherits(clazz, baseClazz) {
- var clazzPrototype = clazz.prototype;
- function F() { }
- F.prototype = baseClazz.prototype;
- clazz.prototype = new F();
- for (var prop in clazzPrototype) {
- if (clazzPrototype.hasOwnProperty(prop)) {
- clazz.prototype[prop] = clazzPrototype[prop];
- }
+ }
+ return true;
+}
+function catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
+ const v0 = (p2 - p0) * 0.5;
+ const v12 = (p3 - p1) * 0.5;
+ return (2 * (p1 - p2) + v0 + v12) * t3 + (-3 * (p1 - p2) - 2 * v0 - v12) * t2 + v0 * t + p1;
+}
+function catmullRomInterpolate1DArray(out2, p0, p1, p2, p3, t, t2, t3) {
+ const len2 = p0.length;
+ for (let i = 0; i < len2; i++) {
+ out2[i] = catmullRomInterpolate(p0[i], p1[i], p2[i], p3[i], t, t2, t3);
+ }
+}
+function catmullRomInterpolate2DArray(out2, p0, p1, p2, p3, t, t2, t3) {
+ const len2 = p0.length;
+ const len22 = p0[0].length;
+ for (let i = 0; i < len2; i++) {
+ if (!out2[i]) {
+ out2[1] = [];
+ }
+ for (let j = 0; j < len22; j++) {
+ out2[i][j] = catmullRomInterpolate(p0[i][j], p1[i][j], p2[i][j], p3[i][j], t, t2, t3);
+ }
+ }
+}
+function cloneValue(value) {
+ if (isArrayLike(value)) {
+ const len2 = value.length;
+ if (isArrayLike(value[0])) {
+ const ret = [];
+ for (let i = 0; i < len2; i++) {
+ ret.push(arraySlice.call(value[i]));
+ }
+ return ret;
+ }
+ return arraySlice.call(value);
+ }
+ return value;
+}
+function rgba2String(rgba) {
+ rgba[0] = Math.floor(rgba[0]);
+ rgba[1] = Math.floor(rgba[1]);
+ rgba[2] = Math.floor(rgba[2]);
+ return "rgba(" + rgba.join(",") + ")";
+}
+function guessArrayDim(value) {
+ return isArrayLike(value && value[0]) ? 2 : 1;
+}
+var tmpRgba = [0, 0, 0, 0];
+var Track = class {
+ constructor(propName) {
+ this.keyframes = [];
+ this.maxTime = 0;
+ this.arrDim = 0;
+ this.interpolable = true;
+ this._needsSort = false;
+ this._isAllValueEqual = true;
+ this._lastFrame = 0;
+ this._lastFramePercent = 0;
+ this.propName = propName;
+ }
+ isFinished() {
+ return this._finished;
+ }
+ setFinished() {
+ this._finished = true;
+ if (this._additiveTrack) {
+ this._additiveTrack.setFinished();
+ }
+ }
+ needsAnimate() {
+ return !this._isAllValueEqual && this.keyframes.length >= 2 && this.interpolable;
+ }
+ getAdditiveTrack() {
+ return this._additiveTrack;
+ }
+ addKeyframe(time, value) {
+ if (time >= this.maxTime) {
+ this.maxTime = time;
+ } else {
+ this._needsSort = true;
+ }
+ let keyframes = this.keyframes;
+ let len2 = keyframes.length;
+ if (this.interpolable) {
+ if (isArrayLike(value)) {
+ let arrayDim = guessArrayDim(value);
+ if (len2 > 0 && this.arrDim !== arrayDim) {
+ this.interpolable = false;
+ return;
}
- clazz.prototype.constructor = clazz;
- clazz.superClass = baseClazz;
- }
- function mixin(target, source, override) {
- target = 'prototype' in target ? target.prototype : target;
- source = 'prototype' in source ? source.prototype : source;
- if (Object.getOwnPropertyNames) {
- var keyList = Object.getOwnPropertyNames(source);
- for (var i = 0; i < keyList.length; i++) {
- var key = keyList[i];
- if (key !== 'constructor') {
- if ((override ? source[key] != null : target[key] == null)) {
- target[key] = source[key];
- }
- }
+ if (arrayDim === 1 && typeof value[0] !== "number" || arrayDim === 2 && typeof value[0][0] !== "number") {
+ this.interpolable = false;
+ return;
+ }
+ if (len2 > 0) {
+ let lastFrame = keyframes[len2 - 1];
+ if (this._isAllValueEqual) {
+ if (arrayDim === 1) {
+ if (!is1DArraySame(value, lastFrame.value)) {
+ this._isAllValueEqual = false;
+ }
+ } else {
+ this._isAllValueEqual = false;
}
+ }
}
- else {
- defaults(target, source, override);
+ this.arrDim = arrayDim;
+ } else {
+ if (this.arrDim > 0) {
+ this.interpolable = false;
+ return;
}
- }
- function isArrayLike(data) {
- if (!data) {
- return false;
+ if (typeof value === "string") {
+ const colorArray = parse(value);
+ if (colorArray) {
+ value = colorArray;
+ this.isValueColor = true;
+ } else {
+ this.interpolable = false;
+ }
+ } else if (typeof value !== "number" || isNaN(value)) {
+ this.interpolable = false;
+ return;
}
- if (typeof data === 'string') {
- return false;
+ if (this._isAllValueEqual && len2 > 0) {
+ let lastFrame = keyframes[len2 - 1];
+ if (this.isValueColor && !is1DArraySame(lastFrame.value, value)) {
+ this._isAllValueEqual = false;
+ } else if (lastFrame.value !== value) {
+ this._isAllValueEqual = false;
+ }
}
- return typeof data.length === 'number';
+ }
}
- function each(arr, cb, context) {
- if (!(arr && cb)) {
- return;
+ const kf = {
+ time,
+ value,
+ percent: 0
+ };
+ this.keyframes.push(kf);
+ return kf;
+ }
+ prepare(additiveTrack) {
+ let kfs = this.keyframes;
+ if (this._needsSort) {
+ kfs.sort(function(a, b) {
+ return a.time - b.time;
+ });
+ }
+ const arrDim = this.arrDim;
+ const kfsLen = kfs.length;
+ const lastKf = kfs[kfsLen - 1];
+ for (let i = 0; i < kfsLen; i++) {
+ kfs[i].percent = kfs[i].time / this.maxTime;
+ if (arrDim > 0 && i !== kfsLen - 1) {
+ fillArray(kfs[i].value, lastKf.value, arrDim);
+ }
+ }
+ if (additiveTrack && this.needsAnimate() && additiveTrack.needsAnimate() && arrDim === additiveTrack.arrDim && this.isValueColor === additiveTrack.isValueColor && !additiveTrack._finished) {
+ this._additiveTrack = additiveTrack;
+ const startValue = kfs[0].value;
+ for (let i = 0; i < kfsLen; i++) {
+ if (arrDim === 0) {
+ if (this.isValueColor) {
+ kfs[i].additiveValue = add1DArray([], kfs[i].value, startValue, -1);
+ } else {
+ kfs[i].additiveValue = kfs[i].value - startValue;
+ }
+ } else if (arrDim === 1) {
+ kfs[i].additiveValue = add1DArray([], kfs[i].value, startValue, -1);
+ } else if (arrDim === 2) {
+ kfs[i].additiveValue = add2DArray([], kfs[i].value, startValue, -1);
+ }
+ }
+ }
+ }
+ step(target, percent) {
+ if (this._finished) {
+ return;
+ }
+ if (this._additiveTrack && this._additiveTrack._finished) {
+ this._additiveTrack = null;
+ }
+ const isAdditive = this._additiveTrack != null;
+ const valueKey = isAdditive ? "additiveValue" : "value";
+ const keyframes = this.keyframes;
+ const kfsNum = this.keyframes.length;
+ const propName = this.propName;
+ const arrDim = this.arrDim;
+ const isValueColor = this.isValueColor;
+ let frameIdx;
+ if (percent < 0) {
+ frameIdx = 0;
+ } else if (percent < this._lastFramePercent) {
+ const start2 = Math.min(this._lastFrame + 1, kfsNum - 1);
+ for (frameIdx = start2; frameIdx >= 0; frameIdx--) {
+ if (keyframes[frameIdx].percent <= percent) {
+ break;
}
- if (arr.forEach && arr.forEach === nativeForEach) {
- arr.forEach(cb, context);
+ }
+ frameIdx = Math.min(frameIdx, kfsNum - 2);
+ } else {
+ for (frameIdx = this._lastFrame; frameIdx < kfsNum; frameIdx++) {
+ if (keyframes[frameIdx].percent > percent) {
+ break;
}
- else if (arr.length === +arr.length) {
- for (var i = 0, len = arr.length; i < len; i++) {
- cb.call(context, arr[i], i, arr);
- }
+ }
+ frameIdx = Math.min(frameIdx - 1, kfsNum - 2);
+ }
+ let nextFrame = keyframes[frameIdx + 1];
+ let frame = keyframes[frameIdx];
+ if (!(frame && nextFrame)) {
+ return;
+ }
+ this._lastFrame = frameIdx;
+ this._lastFramePercent = percent;
+ const range = nextFrame.percent - frame.percent;
+ if (range === 0) {
+ return;
+ }
+ const w = (percent - frame.percent) / range;
+ let targetArr = isAdditive ? this._additiveValue : isValueColor ? tmpRgba : target[propName];
+ if ((arrDim > 0 || isValueColor) && !targetArr) {
+ targetArr = this._additiveValue = [];
+ }
+ if (this.useSpline) {
+ const p1 = keyframes[frameIdx][valueKey];
+ const p0 = keyframes[frameIdx === 0 ? frameIdx : frameIdx - 1][valueKey];
+ const p2 = keyframes[frameIdx > kfsNum - 2 ? kfsNum - 1 : frameIdx + 1][valueKey];
+ const p3 = keyframes[frameIdx > kfsNum - 3 ? kfsNum - 1 : frameIdx + 2][valueKey];
+ if (arrDim > 0) {
+ arrDim === 1 ? catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w) : catmullRomInterpolate2DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);
+ } else if (isValueColor) {
+ catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);
+ if (!isAdditive) {
+ target[propName] = rgba2String(targetArr);
}
- else {
- for (var key in arr) {
- if (arr.hasOwnProperty(key)) {
- cb.call(context, arr[key], key, arr);
- }
- }
+ } else {
+ let value;
+ if (!this.interpolable) {
+ value = p2;
+ } else {
+ value = catmullRomInterpolate(p0, p1, p2, p3, w, w * w, w * w * w);
}
- }
- function map(arr, cb, context) {
- if (!arr) {
- return [];
+ if (isAdditive) {
+ this._additiveValue = value;
+ } else {
+ target[propName] = value;
}
- if (!cb) {
- return slice(arr);
+ }
+ } else {
+ if (arrDim > 0) {
+ arrDim === 1 ? interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w) : interpolate2DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);
+ } else if (isValueColor) {
+ interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);
+ if (!isAdditive) {
+ target[propName] = rgba2String(targetArr);
}
- if (arr.map && arr.map === nativeMap) {
- return arr.map(cb, context);
+ } else {
+ let value;
+ if (!this.interpolable) {
+ value = step(frame[valueKey], nextFrame[valueKey], w);
+ } else {
+ value = interpolateNumber(frame[valueKey], nextFrame[valueKey], w);
}
- else {
- var result = [];
- for (var i = 0, len = arr.length; i < len; i++) {
- result.push(cb.call(context, arr[i], i, arr));
- }
- return result;
+ if (isAdditive) {
+ this._additiveValue = value;
+ } else {
+ target[propName] = value;
}
+ }
}
- function reduce(arr, cb, memo, context) {
- if (!(arr && cb)) {
- return;
- }
- for (var i = 0, len = arr.length; i < len; i++) {
- memo = cb.call(context, memo, arr[i], i, arr);
- }
- return memo;
+ if (isAdditive) {
+ this._addToTarget(target);
}
- function filter(arr, cb, context) {
- if (!arr) {
- return [];
- }
- if (!cb) {
- return slice(arr);
+ }
+ _addToTarget(target) {
+ const arrDim = this.arrDim;
+ const propName = this.propName;
+ const additiveValue = this._additiveValue;
+ if (arrDim === 0) {
+ if (this.isValueColor) {
+ parse(target[propName], tmpRgba);
+ add1DArray(tmpRgba, tmpRgba, additiveValue, 1);
+ target[propName] = rgba2String(tmpRgba);
+ } else {
+ target[propName] = target[propName] + additiveValue;
+ }
+ } else if (arrDim === 1) {
+ add1DArray(target[propName], target[propName], additiveValue, 1);
+ } else if (arrDim === 2) {
+ add2DArray(target[propName], target[propName], additiveValue, 1);
+ }
+ }
+};
+var Animator = class {
+ constructor(target, loop, additiveTo) {
+ this._tracks = {};
+ this._trackKeys = [];
+ this._delay = 0;
+ this._maxTime = 0;
+ this._paused = false;
+ this._started = 0;
+ this._clip = null;
+ this._target = target;
+ this._loop = loop;
+ if (loop && additiveTo) {
+ logError("Can' use additive animation on looped animation.");
+ return;
+ }
+ this._additiveAnimators = additiveTo;
+ }
+ getTarget() {
+ return this._target;
+ }
+ changeTarget(target) {
+ this._target = target;
+ }
+ when(time, props) {
+ return this.whenWithKeys(time, props, keys(props));
+ }
+ whenWithKeys(time, props, propNames) {
+ const tracks = this._tracks;
+ for (let i = 0; i < propNames.length; i++) {
+ const propName = propNames[i];
+ let track = tracks[propName];
+ if (!track) {
+ track = tracks[propName] = new Track(propName);
+ let initialValue;
+ const additiveTrack = this._getAdditiveTrack(propName);
+ if (additiveTrack) {
+ const lastFinalKf = additiveTrack.keyframes[additiveTrack.keyframes.length - 1];
+ initialValue = lastFinalKf && lastFinalKf.value;
+ if (additiveTrack.isValueColor && initialValue) {
+ initialValue = rgba2String(initialValue);
+ }
+ } else {
+ initialValue = this._target[propName];
}
- if (arr.filter && arr.filter === nativeFilter) {
- return arr.filter(cb, context);
+ if (initialValue == null) {
+ continue;
}
- else {
- var result = [];
- for (var i = 0, len = arr.length; i < len; i++) {
- if (cb.call(context, arr[i], i, arr)) {
- result.push(arr[i]);
- }
+ if (time !== 0) {
+ track.addKeyframe(0, cloneValue(initialValue));
+ }
+ this._trackKeys.push(propName);
+ }
+ track.addKeyframe(time, cloneValue(props[propName]));
+ }
+ this._maxTime = Math.max(this._maxTime, time);
+ return this;
+ }
+ pause() {
+ this._clip.pause();
+ this._paused = true;
+ }
+ resume() {
+ this._clip.resume();
+ this._paused = false;
+ }
+ isPaused() {
+ return !!this._paused;
+ }
+ _doneCallback() {
+ this._setTracksFinished();
+ this._clip = null;
+ const doneList = this._doneList;
+ if (doneList) {
+ const len2 = doneList.length;
+ for (let i = 0; i < len2; i++) {
+ doneList[i].call(this);
+ }
+ }
+ }
+ _abortedCallback() {
+ this._setTracksFinished();
+ const animation = this.animation;
+ const abortedList = this._abortedList;
+ if (animation) {
+ animation.removeClip(this._clip);
+ }
+ this._clip = null;
+ if (abortedList) {
+ for (let i = 0; i < abortedList.length; i++) {
+ abortedList[i].call(this);
+ }
+ }
+ }
+ _setTracksFinished() {
+ const tracks = this._tracks;
+ const tracksKeys = this._trackKeys;
+ for (let i = 0; i < tracksKeys.length; i++) {
+ tracks[tracksKeys[i]].setFinished();
+ }
+ }
+ _getAdditiveTrack(trackName) {
+ let additiveTrack;
+ const additiveAnimators = this._additiveAnimators;
+ if (additiveAnimators) {
+ for (let i = 0; i < additiveAnimators.length; i++) {
+ const track = additiveAnimators[i].getTrack(trackName);
+ if (track) {
+ additiveTrack = track;
+ }
+ }
+ }
+ return additiveTrack;
+ }
+ start(easing2, forceAnimate) {
+ if (this._started > 0) {
+ return;
+ }
+ this._started = 1;
+ const self2 = this;
+ let tracks = [];
+ for (let i = 0; i < this._trackKeys.length; i++) {
+ const propName = this._trackKeys[i];
+ const track = this._tracks[propName];
+ const additiveTrack = this._getAdditiveTrack(propName);
+ const kfs = track.keyframes;
+ track.prepare(additiveTrack);
+ if (track.needsAnimate()) {
+ tracks.push(track);
+ } else if (!track.interpolable) {
+ const lastKf = kfs[kfs.length - 1];
+ if (lastKf) {
+ self2._target[track.propName] = lastKf.value;
+ }
+ }
+ }
+ if (tracks.length || forceAnimate) {
+ const clip2 = new Clip_default({
+ life: this._maxTime,
+ loop: this._loop,
+ delay: this._delay,
+ onframe(percent) {
+ self2._started = 2;
+ const additiveAnimators = self2._additiveAnimators;
+ if (additiveAnimators) {
+ let stillHasAdditiveAnimator = false;
+ for (let i = 0; i < additiveAnimators.length; i++) {
+ if (additiveAnimators[i]._clip) {
+ stillHasAdditiveAnimator = true;
+ break;
+ }
+ }
+ if (!stillHasAdditiveAnimator) {
+ self2._additiveAnimators = null;
+ }
+ }
+ for (let i = 0; i < tracks.length; i++) {
+ tracks[i].step(self2._target, percent);
+ }
+ const onframeList = self2._onframeList;
+ if (onframeList) {
+ for (let i = 0; i < onframeList.length; i++) {
+ onframeList[i](self2._target, percent);
}
- return result;
+ }
+ },
+ ondestroy() {
+ self2._doneCallback();
}
+ });
+ this._clip = clip2;
+ if (this.animation) {
+ this.animation.addClip(clip2);
+ }
+ if (easing2 && easing2 !== "spline") {
+ clip2.easing = easing2;
+ }
+ } else {
+ this._doneCallback();
+ }
+ return this;
+ }
+ stop(forwardToLast) {
+ if (!this._clip) {
+ return;
+ }
+ const clip2 = this._clip;
+ if (forwardToLast) {
+ clip2.onframe(1);
+ }
+ this._abortedCallback();
+ }
+ delay(time) {
+ this._delay = time;
+ return this;
+ }
+ during(cb) {
+ if (cb) {
+ if (!this._onframeList) {
+ this._onframeList = [];
+ }
+ this._onframeList.push(cb);
+ }
+ return this;
+ }
+ done(cb) {
+ if (cb) {
+ if (!this._doneList) {
+ this._doneList = [];
+ }
+ this._doneList.push(cb);
+ }
+ return this;
+ }
+ aborted(cb) {
+ if (cb) {
+ if (!this._abortedList) {
+ this._abortedList = [];
+ }
+ this._abortedList.push(cb);
+ }
+ return this;
+ }
+ getClip() {
+ return this._clip;
+ }
+ getTrack(propName) {
+ return this._tracks[propName];
+ }
+ stopTracks(propNames, forwardToLast) {
+ if (!propNames.length || !this._clip) {
+ return true;
}
- function find(arr, cb, context) {
- if (!(arr && cb)) {
- return;
+ const tracks = this._tracks;
+ const tracksKeys = this._trackKeys;
+ for (let i = 0; i < propNames.length; i++) {
+ const track = tracks[propNames[i]];
+ if (track) {
+ if (forwardToLast) {
+ track.step(this._target, 1);
+ } else if (this._started === 1) {
+ track.step(this._target, 0);
+ }
+ track.setFinished();
+ }
+ }
+ let allAborted = true;
+ for (let i = 0; i < tracksKeys.length; i++) {
+ if (!tracks[tracksKeys[i]].isFinished()) {
+ allAborted = false;
+ break;
+ }
+ }
+ if (allAborted) {
+ this._abortedCallback();
+ }
+ return allAborted;
+ }
+ saveFinalToTarget(target, trackKeys) {
+ if (!target) {
+ return;
+ }
+ trackKeys = trackKeys || this._trackKeys;
+ for (let i = 0; i < trackKeys.length; i++) {
+ const propName = trackKeys[i];
+ const track = this._tracks[propName];
+ if (!track || track.isFinished()) {
+ continue;
+ }
+ const kfs = track.keyframes;
+ const lastKf = kfs[kfs.length - 1];
+ if (lastKf) {
+ let val = cloneValue(lastKf.value);
+ if (track.isValueColor) {
+ val = rgba2String(val);
+ }
+ target[propName] = val;
+ }
+ }
+ }
+ __changeFinalValue(finalProps, trackKeys) {
+ trackKeys = trackKeys || keys(finalProps);
+ for (let i = 0; i < trackKeys.length; i++) {
+ const propName = trackKeys[i];
+ const track = this._tracks[propName];
+ if (!track) {
+ continue;
+ }
+ const kfs = track.keyframes;
+ if (kfs.length > 1) {
+ const lastKf = kfs.pop();
+ track.addKeyframe(lastKf.time, finalProps[propName]);
+ track.prepare(track.getAdditiveTrack());
+ }
+ }
+ }
+};
+var Animator_default = Animator;
+
+// ../zrender/src/core/Point.ts
+var Point = class {
+ constructor(x, y) {
+ this.x = x || 0;
+ this.y = y || 0;
+ }
+ copy(other) {
+ this.x = other.x;
+ this.y = other.y;
+ return this;
+ }
+ clone() {
+ return new Point(this.x, this.y);
+ }
+ set(x, y) {
+ this.x = x;
+ this.y = y;
+ return this;
+ }
+ equal(other) {
+ return other.x === this.x && other.y === this.y;
+ }
+ add(other) {
+ this.x += other.x;
+ this.y += other.y;
+ return this;
+ }
+ scale(scalar) {
+ this.x *= scalar;
+ this.y *= scalar;
+ }
+ scaleAndAdd(other, scalar) {
+ this.x += other.x * scalar;
+ this.y += other.y * scalar;
+ }
+ sub(other) {
+ this.x -= other.x;
+ this.y -= other.y;
+ return this;
+ }
+ dot(other) {
+ return this.x * other.x + this.y * other.y;
+ }
+ len() {
+ return Math.sqrt(this.x * this.x + this.y * this.y);
+ }
+ lenSquare() {
+ return this.x * this.x + this.y * this.y;
+ }
+ normalize() {
+ const len2 = this.len();
+ this.x /= len2;
+ this.y /= len2;
+ return this;
+ }
+ distance(other) {
+ const dx = this.x - other.x;
+ const dy = this.y - other.y;
+ return Math.sqrt(dx * dx + dy * dy);
+ }
+ distanceSquare(other) {
+ const dx = this.x - other.x;
+ const dy = this.y - other.y;
+ return dx * dx + dy * dy;
+ }
+ negate() {
+ this.x = -this.x;
+ this.y = -this.y;
+ return this;
+ }
+ transform(m2) {
+ if (!m2) {
+ return;
+ }
+ const x = this.x;
+ const y = this.y;
+ this.x = m2[0] * x + m2[2] * y + m2[4];
+ this.y = m2[1] * x + m2[3] * y + m2[5];
+ return this;
+ }
+ toArray(out2) {
+ out2[0] = this.x;
+ out2[1] = this.y;
+ return out2;
+ }
+ fromArray(input) {
+ this.x = input[0];
+ this.y = input[1];
+ }
+ static set(p, x, y) {
+ p.x = x;
+ p.y = y;
+ }
+ static copy(p, p2) {
+ p.x = p2.x;
+ p.y = p2.y;
+ }
+ static len(p) {
+ return Math.sqrt(p.x * p.x + p.y * p.y);
+ }
+ static lenSquare(p) {
+ return p.x * p.x + p.y * p.y;
+ }
+ static dot(p0, p1) {
+ return p0.x * p1.x + p0.y * p1.y;
+ }
+ static add(out2, p0, p1) {
+ out2.x = p0.x + p1.x;
+ out2.y = p0.y + p1.y;
+ }
+ static sub(out2, p0, p1) {
+ out2.x = p0.x - p1.x;
+ out2.y = p0.y - p1.y;
+ }
+ static scale(out2, p0, scalar) {
+ out2.x = p0.x * scalar;
+ out2.y = p0.y * scalar;
+ }
+ static scaleAndAdd(out2, p0, p1, scalar) {
+ out2.x = p0.x + p1.x * scalar;
+ out2.y = p0.y + p1.y * scalar;
+ }
+ static lerp(out2, p0, p1, t) {
+ const onet = 1 - t;
+ out2.x = onet * p0.x + t * p1.x;
+ out2.y = onet * p0.y + t * p1.y;
+ }
+};
+var Point_default = Point;
+
+// ../zrender/src/core/BoundingRect.ts
+var mathMin = Math.min;
+var mathMax = Math.max;
+var lt = new Point_default();
+var rb = new Point_default();
+var lb = new Point_default();
+var rt = new Point_default();
+var minTv = new Point_default();
+var maxTv = new Point_default();
+var BoundingRect = class {
+ constructor(x, y, width, height) {
+ if (width < 0 && isFinite(width)) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0 && isFinite(height)) {
+ y = y + height;
+ height = -height;
+ }
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
+ union(other) {
+ const x = mathMin(other.x, this.x);
+ const y = mathMin(other.y, this.y);
+ if (isFinite(this.x) && isFinite(this.width)) {
+ this.width = mathMax(other.x + other.width, this.x + this.width) - x;
+ } else {
+ this.width = other.width;
+ }
+ if (isFinite(this.y) && isFinite(this.height)) {
+ this.height = mathMax(other.y + other.height, this.y + this.height) - y;
+ } else {
+ this.height = other.height;
+ }
+ this.x = x;
+ this.y = y;
+ }
+ applyTransform(m2) {
+ BoundingRect.applyTransform(this, this, m2);
+ }
+ calculateTransform(b) {
+ const a = this;
+ const sx = b.width / a.width;
+ const sy = b.height / a.height;
+ const m2 = create2();
+ translate(m2, m2, [-a.x, -a.y]);
+ scale2(m2, m2, [sx, sy]);
+ translate(m2, m2, [b.x, b.y]);
+ return m2;
+ }
+ intersect(b, mtv) {
+ if (!b) {
+ return false;
+ }
+ if (!(b instanceof BoundingRect)) {
+ b = BoundingRect.create(b);
+ }
+ const a = this;
+ const ax0 = a.x;
+ const ax1 = a.x + a.width;
+ const ay0 = a.y;
+ const ay1 = a.y + a.height;
+ const bx0 = b.x;
+ const bx1 = b.x + b.width;
+ const by0 = b.y;
+ const by1 = b.y + b.height;
+ let overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
+ if (mtv) {
+ let dMin = Infinity;
+ let dMax = 0;
+ const d0 = Math.abs(ax1 - bx0);
+ const d1 = Math.abs(bx1 - ax0);
+ const d2 = Math.abs(ay1 - by0);
+ const d3 = Math.abs(by1 - ay0);
+ const dx = Math.min(d0, d1);
+ const dy = Math.min(d2, d3);
+ if (ax1 < bx0 || bx1 < ax0) {
+ if (dx > dMax) {
+ dMax = dx;
+ if (d0 < d1) {
+ Point_default.set(maxTv, -d0, 0);
+ } else {
+ Point_default.set(maxTv, d1, 0);
+ }
}
- for (var i = 0, len = arr.length; i < len; i++) {
- if (cb.call(context, arr[i], i, arr)) {
- return arr[i];
- }
+ } else {
+ if (dx < dMin) {
+ dMin = dx;
+ if (d0 < d1) {
+ Point_default.set(minTv, d0, 0);
+ } else {
+ Point_default.set(minTv, -d1, 0);
+ }
}
- }
- function keys(obj) {
- if (!obj) {
- return [];
+ }
+ if (ay1 < by0 || by1 < ay0) {
+ if (dy > dMax) {
+ dMax = dy;
+ if (d2 < d3) {
+ Point_default.set(maxTv, 0, -d2);
+ } else {
+ Point_default.set(maxTv, 0, d3);
+ }
}
- if (Object.keys) {
- return Object.keys(obj);
+ } else {
+ if (dx < dMin) {
+ dMin = dx;
+ if (d2 < d3) {
+ Point_default.set(minTv, 0, d2);
+ } else {
+ Point_default.set(minTv, 0, -d3);
+ }
+ }
+ }
+ }
+ if (mtv) {
+ Point_default.copy(mtv, overlap ? minTv : maxTv);
+ }
+ return overlap;
+ }
+ contain(x, y) {
+ const rect = this;
+ return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
+ }
+ clone() {
+ return new BoundingRect(this.x, this.y, this.width, this.height);
+ }
+ copy(other) {
+ BoundingRect.copy(this, other);
+ }
+ plain() {
+ return {
+ x: this.x,
+ y: this.y,
+ width: this.width,
+ height: this.height
+ };
+ }
+ isFinite() {
+ return isFinite(this.x) && isFinite(this.y) && isFinite(this.width) && isFinite(this.height);
+ }
+ isZero() {
+ return this.width === 0 || this.height === 0;
+ }
+ static create(rect) {
+ return new BoundingRect(rect.x, rect.y, rect.width, rect.height);
+ }
+ static copy(target, source) {
+ target.x = source.x;
+ target.y = source.y;
+ target.width = source.width;
+ target.height = source.height;
+ }
+ static applyTransform(target, source, m2) {
+ if (!m2) {
+ if (target !== source) {
+ BoundingRect.copy(target, source);
+ }
+ return;
+ }
+ if (m2[1] < 1e-5 && m2[1] > -1e-5 && m2[2] < 1e-5 && m2[2] > -1e-5) {
+ const sx = m2[0];
+ const sy = m2[3];
+ const tx = m2[4];
+ const ty = m2[5];
+ target.x = source.x * sx + tx;
+ target.y = source.y * sy + ty;
+ target.width = source.width * sx;
+ target.height = source.height * sy;
+ if (target.width < 0) {
+ target.x += target.width;
+ target.width = -target.width;
+ }
+ if (target.height < 0) {
+ target.y += target.height;
+ target.height = -target.height;
+ }
+ return;
+ }
+ lt.x = lb.x = source.x;
+ lt.y = rt.y = source.y;
+ rb.x = rt.x = source.x + source.width;
+ rb.y = lb.y = source.y + source.height;
+ lt.transform(m2);
+ rt.transform(m2);
+ rb.transform(m2);
+ lb.transform(m2);
+ target.x = mathMin(lt.x, rb.x, lb.x, rt.x);
+ target.y = mathMin(lt.y, rb.y, lb.y, rt.y);
+ const maxX = mathMax(lt.x, rb.x, lb.x, rt.x);
+ const maxY = mathMax(lt.y, rb.y, lb.y, rt.y);
+ target.width = maxX - target.x;
+ target.height = maxY - target.y;
+ }
+};
+var BoundingRect_default = BoundingRect;
+
+// ../zrender/src/contain/text.ts
+var textWidthCache = {};
+var DEFAULT_FONT = "12px sans-serif";
+var _ctx;
+var _cachedFont;
+function defaultMeasureText(text, font) {
+ if (!_ctx) {
+ _ctx = createCanvas().getContext("2d");
+ }
+ if (_cachedFont !== font) {
+ _cachedFont = _ctx.font = font || DEFAULT_FONT;
+ }
+ return _ctx.measureText(text);
+}
+var methods2 = {
+ measureText: defaultMeasureText
+};
+function getWidth(text, font) {
+ font = font || DEFAULT_FONT;
+ let cacheOfFont = textWidthCache[font];
+ if (!cacheOfFont) {
+ cacheOfFont = textWidthCache[font] = new LRU_default(500);
+ }
+ let width = cacheOfFont.get(text);
+ if (width == null) {
+ width = methods2.measureText(text, font).width;
+ cacheOfFont.put(text, width);
+ }
+ return width;
+}
+function innerGetBoundingRect(text, font, textAlign, textBaseline) {
+ const width = getWidth(text, font);
+ const height = getLineHeight(font);
+ const x = adjustTextX(0, width, textAlign);
+ const y = adjustTextY(0, height, textBaseline);
+ const rect = new BoundingRect_default(x, y, width, height);
+ return rect;
+}
+function getBoundingRect(text, font, textAlign, textBaseline) {
+ const textLines = ((text || "") + "").split("\n");
+ const len2 = textLines.length;
+ if (len2 === 1) {
+ return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);
+ } else {
+ const uniondRect = new BoundingRect_default(0, 0, 0, 0);
+ for (let i = 0; i < textLines.length; i++) {
+ const rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);
+ i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);
+ }
+ return uniondRect;
+ }
+}
+function adjustTextX(x, width, textAlign) {
+ if (textAlign === "right") {
+ x -= width;
+ } else if (textAlign === "center") {
+ x -= width / 2;
+ }
+ return x;
+}
+function adjustTextY(y, height, verticalAlign) {
+ if (verticalAlign === "middle") {
+ y -= height / 2;
+ } else if (verticalAlign === "bottom") {
+ y -= height;
+ }
+ return y;
+}
+function getLineHeight(font) {
+ return getWidth("\u56FD", font);
+}
+function parsePercent(value, maxValue) {
+ if (typeof value === "string") {
+ if (value.lastIndexOf("%") >= 0) {
+ return parseFloat(value) / 100 * maxValue;
+ }
+ return parseFloat(value);
+ }
+ return value;
+}
+function calculateTextPosition(out2, opts, rect) {
+ const textPosition = opts.position || "inside";
+ const distance2 = opts.distance != null ? opts.distance : 5;
+ const height = rect.height;
+ const width = rect.width;
+ const halfHeight = height / 2;
+ let x = rect.x;
+ let y = rect.y;
+ let textAlign = "left";
+ let textVerticalAlign = "top";
+ if (textPosition instanceof Array) {
+ x += parsePercent(textPosition[0], rect.width);
+ y += parsePercent(textPosition[1], rect.height);
+ textAlign = null;
+ textVerticalAlign = null;
+ } else {
+ switch (textPosition) {
+ case "left":
+ x -= distance2;
+ y += halfHeight;
+ textAlign = "right";
+ textVerticalAlign = "middle";
+ break;
+ case "right":
+ x += distance2 + width;
+ y += halfHeight;
+ textVerticalAlign = "middle";
+ break;
+ case "top":
+ x += width / 2;
+ y -= distance2;
+ textAlign = "center";
+ textVerticalAlign = "bottom";
+ break;
+ case "bottom":
+ x += width / 2;
+ y += height + distance2;
+ textAlign = "center";
+ break;
+ case "inside":
+ x += width / 2;
+ y += halfHeight;
+ textAlign = "center";
+ textVerticalAlign = "middle";
+ break;
+ case "insideLeft":
+ x += distance2;
+ y += halfHeight;
+ textVerticalAlign = "middle";
+ break;
+ case "insideRight":
+ x += width - distance2;
+ y += halfHeight;
+ textAlign = "right";
+ textVerticalAlign = "middle";
+ break;
+ case "insideTop":
+ x += width / 2;
+ y += distance2;
+ textAlign = "center";
+ break;
+ case "insideBottom":
+ x += width / 2;
+ y += height - distance2;
+ textAlign = "center";
+ textVerticalAlign = "bottom";
+ break;
+ case "insideTopLeft":
+ x += distance2;
+ y += distance2;
+ break;
+ case "insideTopRight":
+ x += width - distance2;
+ y += distance2;
+ textAlign = "right";
+ break;
+ case "insideBottomLeft":
+ x += distance2;
+ y += height - distance2;
+ textVerticalAlign = "bottom";
+ break;
+ case "insideBottomRight":
+ x += width - distance2;
+ y += height - distance2;
+ textAlign = "right";
+ textVerticalAlign = "bottom";
+ break;
+ }
+ }
+ out2 = out2 || {};
+ out2.x = x;
+ out2.y = y;
+ out2.align = textAlign;
+ out2.verticalAlign = textVerticalAlign;
+ return out2;
+}
+
+// ../zrender/src/config.ts
+var dpr = 1;
+if (typeof window !== "undefined") {
+ dpr = Math.max(window.devicePixelRatio || window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI || 1, 1);
+}
+var devicePixelRatio = dpr;
+var DARK_MODE_THRESHOLD = 0.4;
+var DARK_LABEL_COLOR = "#333";
+var LIGHT_LABEL_COLOR = "#ccc";
+var LIGHTER_LABEL_COLOR = "#eee";
+
+// ../zrender/src/Element.ts
+var PRESERVED_NORMAL_STATE = "__zr_normal__";
+var PRIMARY_STATES_KEYS = ["x", "y", "scaleX", "scaleY", "originX", "originY", "rotation", "ignore"];
+var DEFAULT_ANIMATABLE_MAP = {
+ x: true,
+ y: true,
+ scaleX: true,
+ scaleY: true,
+ originX: true,
+ originY: true,
+ rotation: true,
+ ignore: false
+};
+var tmpTextPosCalcRes = {};
+var tmpBoundingRect = new BoundingRect_default(0, 0, 0, 0);
+var Element2 = class {
+ constructor(props) {
+ this.id = guid();
+ this.animators = [];
+ this.currentStates = [];
+ this.states = {};
+ this._init(props);
+ }
+ _init(props) {
+ this.attr(props);
+ }
+ drift(dx, dy, e2) {
+ switch (this.draggable) {
+ case "horizontal":
+ dy = 0;
+ break;
+ case "vertical":
+ dx = 0;
+ break;
+ }
+ let m2 = this.transform;
+ if (!m2) {
+ m2 = this.transform = [1, 0, 0, 1, 0, 0];
+ }
+ m2[4] += dx;
+ m2[5] += dy;
+ this.decomposeTransform();
+ this.markRedraw();
+ }
+ beforeUpdate() {
+ }
+ afterUpdate() {
+ }
+ update() {
+ this.updateTransform();
+ if (this.__dirty) {
+ this.updateInnerText();
+ }
+ }
+ updateInnerText(forceUpdate) {
+ const textEl = this._textContent;
+ if (textEl && (!textEl.ignore || forceUpdate)) {
+ if (!this.textConfig) {
+ this.textConfig = {};
+ }
+ const textConfig = this.textConfig;
+ const isLocal = textConfig.local;
+ const attachedTransform = textEl.attachedTransform;
+ let textAlign;
+ let textVerticalAlign;
+ let textStyleChanged = false;
+ if (isLocal) {
+ attachedTransform.parent = this;
+ } else {
+ attachedTransform.parent = null;
+ }
+ let innerOrigin = false;
+ attachedTransform.x = textEl.x;
+ attachedTransform.y = textEl.y;
+ attachedTransform.originX = textEl.originX;
+ attachedTransform.originY = textEl.originY;
+ attachedTransform.rotation = textEl.rotation;
+ attachedTransform.scaleX = textEl.scaleX;
+ attachedTransform.scaleY = textEl.scaleY;
+ if (textConfig.position != null) {
+ let layoutRect = tmpBoundingRect;
+ if (textConfig.layoutRect) {
+ layoutRect.copy(textConfig.layoutRect);
+ } else {
+ layoutRect.copy(this.getBoundingRect());
}
- var keyList = [];
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- keyList.push(key);
- }
+ if (!isLocal) {
+ layoutRect.applyTransform(this.transform);
}
- return keyList;
- }
- function bindPolyfill(func, context) {
- var args = [];
- for (var _i = 2; _i < arguments.length; _i++) {
- args[_i - 2] = arguments[_i];
+ if (this.calculateTextPosition) {
+ this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
+ } else {
+ calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
+ }
+ attachedTransform.x = tmpTextPosCalcRes.x;
+ attachedTransform.y = tmpTextPosCalcRes.y;
+ textAlign = tmpTextPosCalcRes.align;
+ textVerticalAlign = tmpTextPosCalcRes.verticalAlign;
+ const textOrigin = textConfig.origin;
+ if (textOrigin && textConfig.rotation != null) {
+ let relOriginX;
+ let relOriginY;
+ if (textOrigin === "center") {
+ relOriginX = layoutRect.width * 0.5;
+ relOriginY = layoutRect.height * 0.5;
+ } else {
+ relOriginX = parsePercent(textOrigin[0], layoutRect.width);
+ relOriginY = parsePercent(textOrigin[1], layoutRect.height);
+ }
+ innerOrigin = true;
+ attachedTransform.originX = -attachedTransform.x + relOriginX + (isLocal ? 0 : layoutRect.x);
+ attachedTransform.originY = -attachedTransform.y + relOriginY + (isLocal ? 0 : layoutRect.y);
}
- return function () {
- return func.apply(context, args.concat(nativeSlice.call(arguments)));
- };
- }
- var bind = (protoFunction && isFunction(protoFunction.bind))
- ? protoFunction.call.bind(protoFunction.bind)
- : bindPolyfill;
- function curry(func) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
+ }
+ if (textConfig.rotation != null) {
+ attachedTransform.rotation = textConfig.rotation;
+ }
+ const textOffset = textConfig.offset;
+ if (textOffset) {
+ attachedTransform.x += textOffset[0];
+ attachedTransform.y += textOffset[1];
+ if (!innerOrigin) {
+ attachedTransform.originX = -textOffset[0];
+ attachedTransform.originY = -textOffset[1];
}
- return function () {
- return func.apply(this, args.concat(nativeSlice.call(arguments)));
- };
- }
- function isArray(value) {
- if (Array.isArray) {
- return Array.isArray(value);
+ }
+ const isInside = textConfig.inside == null ? typeof textConfig.position === "string" && textConfig.position.indexOf("inside") >= 0 : textConfig.inside;
+ const innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});
+ let textFill;
+ let textStroke;
+ let autoStroke;
+ if (isInside && this.canBeInsideText()) {
+ textFill = textConfig.insideFill;
+ textStroke = textConfig.insideStroke;
+ if (textFill == null || textFill === "auto") {
+ textFill = this.getInsideTextFill();
}
- return objToString.call(value) === '[object Array]';
- }
- function isFunction(value) {
- return typeof value === 'function';
- }
- function isString(value) {
- return typeof value === 'string';
- }
- function isStringSafe(value) {
- return objToString.call(value) === '[object String]';
- }
- function isNumber(value) {
- return typeof value === 'number';
- }
- function isObject(value) {
- var type = typeof value;
- return type === 'function' || (!!value && type === 'object');
- }
- function isBuiltInObject(value) {
- return !!BUILTIN_OBJECT[objToString.call(value)];
- }
- function isTypedArray(value) {
- return !!TYPED_ARRAY[objToString.call(value)];
- }
- function isDom(value) {
- return typeof value === 'object'
- && typeof value.nodeType === 'number'
- && typeof value.ownerDocument === 'object';
- }
- function isGradientObject(value) {
- return value.colorStops != null;
- }
- function isPatternObject(value) {
- return value.image != null;
- }
- function isRegExp(value) {
- return objToString.call(value) === '[object RegExp]';
- }
- function eqNaN(value) {
- return value !== value;
- }
- function retrieve() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
+ if (textStroke == null || textStroke === "auto") {
+ textStroke = this.getInsideTextStroke(textFill);
+ autoStroke = true;
}
- for (var i = 0, len = args.length; i < len; i++) {
- if (args[i] != null) {
- return args[i];
- }
+ } else {
+ textFill = textConfig.outsideFill;
+ textStroke = textConfig.outsideStroke;
+ if (textFill == null || textFill === "auto") {
+ textFill = this.getOutsideFill();
+ }
+ if (textStroke == null || textStroke === "auto") {
+ textStroke = this.getOutsideStroke(textFill);
+ autoStroke = true;
+ }
+ }
+ textFill = textFill || "#000";
+ if (textFill !== innerTextDefaultStyle.fill || textStroke !== innerTextDefaultStyle.stroke || autoStroke !== innerTextDefaultStyle.autoStroke || textAlign !== innerTextDefaultStyle.align || textVerticalAlign !== innerTextDefaultStyle.verticalAlign) {
+ textStyleChanged = true;
+ innerTextDefaultStyle.fill = textFill;
+ innerTextDefaultStyle.stroke = textStroke;
+ innerTextDefaultStyle.autoStroke = autoStroke;
+ innerTextDefaultStyle.align = textAlign;
+ innerTextDefaultStyle.verticalAlign = textVerticalAlign;
+ textEl.setDefaultTextStyle(innerTextDefaultStyle);
+ }
+ if (textStyleChanged) {
+ textEl.dirtyStyle();
+ }
+ textEl.markRedraw();
+ }
+ }
+ canBeInsideText() {
+ return true;
+ }
+ getInsideTextFill() {
+ return "#fff";
+ }
+ getInsideTextStroke(textFill) {
+ return "#000";
+ }
+ getOutsideFill() {
+ return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;
+ }
+ getOutsideStroke(textFill) {
+ const backgroundColor2 = this.__zr && this.__zr.getBackgroundColor();
+ let colorArr = typeof backgroundColor2 === "string" && parse(backgroundColor2);
+ if (!colorArr) {
+ colorArr = [255, 255, 255, 1];
+ }
+ const alpha = colorArr[3];
+ const isDark = this.__zr.isDarkMode();
+ for (let i = 0; i < 3; i++) {
+ colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);
+ }
+ colorArr[3] = 1;
+ return stringify(colorArr, "rgba");
+ }
+ traverse(cb, context) {
+ }
+ attrKV(key, value) {
+ if (key === "textConfig") {
+ this.setTextConfig(value);
+ } else if (key === "textContent") {
+ this.setTextContent(value);
+ } else if (key === "clipPath") {
+ this.setClipPath(value);
+ } else if (key === "extra") {
+ this.extra = this.extra || {};
+ extend(this.extra, value);
+ } else {
+ this[key] = value;
+ }
+ }
+ hide() {
+ this.ignore = true;
+ this.markRedraw();
+ }
+ show() {
+ this.ignore = false;
+ this.markRedraw();
+ }
+ attr(keyOrObj, value) {
+ if (typeof keyOrObj === "string") {
+ this.attrKV(keyOrObj, value);
+ } else if (isObject(keyOrObj)) {
+ let obj = keyOrObj;
+ let keysArr = keys(obj);
+ for (let i = 0; i < keysArr.length; i++) {
+ let key = keysArr[i];
+ this.attrKV(key, keyOrObj[key]);
+ }
+ }
+ this.markRedraw();
+ return this;
+ }
+ saveCurrentToNormalState(toState) {
+ this._innerSaveToNormal(toState);
+ const normalState = this._normalState;
+ for (let i = 0; i < this.animators.length; i++) {
+ const animator = this.animators[i];
+ const fromStateTransition = animator.__fromStateTransition;
+ if (fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {
+ continue;
+ }
+ const targetName = animator.targetName;
+ const target = targetName ? normalState[targetName] : normalState;
+ animator.saveFinalToTarget(target);
+ }
+ }
+ _innerSaveToNormal(toState) {
+ let normalState = this._normalState;
+ if (!normalState) {
+ normalState = this._normalState = {};
+ }
+ if (toState.textConfig && !normalState.textConfig) {
+ normalState.textConfig = this.textConfig;
+ }
+ this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);
+ }
+ _savePrimaryToNormal(toState, normalState, primaryKeys) {
+ for (let i = 0; i < primaryKeys.length; i++) {
+ let key = primaryKeys[i];
+ if (toState[key] != null && !(key in normalState)) {
+ normalState[key] = this[key];
+ }
+ }
+ }
+ hasState() {
+ return this.currentStates.length > 0;
+ }
+ getState(name) {
+ return this.states[name];
+ }
+ ensureState(name) {
+ const states = this.states;
+ if (!states[name]) {
+ states[name] = {};
+ }
+ return states[name];
+ }
+ clearStates(noAnimation) {
+ this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);
+ }
+ useState(stateName, keepCurrentStates, noAnimation) {
+ const toNormalState = stateName === PRESERVED_NORMAL_STATE;
+ const hasStates = this.hasState();
+ if (!hasStates && toNormalState) {
+ return;
+ }
+ const currentStates = this.currentStates;
+ const animationCfg = this.stateTransition;
+ if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {
+ return;
+ }
+ let state;
+ if (this.stateProxy && !toNormalState) {
+ state = this.stateProxy(stateName);
+ }
+ if (!state) {
+ state = this.states && this.states[stateName];
+ }
+ if (!state && !toNormalState) {
+ logError(`State ${stateName} not exists.`);
+ return;
+ }
+ if (!toNormalState) {
+ this.saveCurrentToNormalState(state);
+ }
+ const useHoverLayer = !!(state && state.hoverLayer);
+ if (useHoverLayer) {
+ this._toggleHoverLayerFlag(true);
+ }
+ this._applyStateObj(stateName, state, this._normalState, keepCurrentStates, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);
+ if (this._textContent) {
+ this._textContent.useState(stateName, keepCurrentStates);
+ }
+ if (this._textGuide) {
+ this._textGuide.useState(stateName, keepCurrentStates);
+ }
+ if (toNormalState) {
+ this.currentStates = [];
+ this._normalState = {};
+ } else {
+ if (!keepCurrentStates) {
+ this.currentStates = [stateName];
+ } else {
+ this.currentStates.push(stateName);
+ }
+ }
+ this._updateAnimationTargets();
+ this.markRedraw();
+ if (!useHoverLayer && this.__inHover) {
+ this._toggleHoverLayerFlag(false);
+ this.__dirty &= ~Element2.REDARAW_BIT;
+ }
+ return state;
+ }
+ useStates(states, noAnimation) {
+ if (!states.length) {
+ this.clearStates();
+ } else {
+ const stateObjects = [];
+ const currentStates = this.currentStates;
+ const len2 = states.length;
+ let notChange = len2 === currentStates.length;
+ if (notChange) {
+ for (let i = 0; i < len2; i++) {
+ if (states[i] !== currentStates[i]) {
+ notChange = false;
+ break;
+ }
}
- }
- function retrieve2(value0, value1) {
- return value0 != null
- ? value0
- : value1;
- }
- function retrieve3(value0, value1, value2) {
- return value0 != null
- ? value0
- : value1 != null
- ? value1
- : value2;
- }
- function slice(arr) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
+ }
+ if (notChange) {
+ return;
+ }
+ for (let i = 0; i < len2; i++) {
+ const stateName = states[i];
+ let stateObj;
+ if (this.stateProxy) {
+ stateObj = this.stateProxy(stateName, states);
+ }
+ if (!stateObj) {
+ stateObj = this.states[stateName];
+ }
+ if (stateObj) {
+ stateObjects.push(stateObj);
+ }
+ }
+ const useHoverLayer = !!(stateObjects[len2 - 1] && stateObjects[len2 - 1].hoverLayer);
+ if (useHoverLayer) {
+ this._toggleHoverLayerFlag(true);
+ }
+ const mergedState = this._mergeStates(stateObjects);
+ const animationCfg = this.stateTransition;
+ this.saveCurrentToNormalState(mergedState);
+ this._applyStateObj(states.join(","), mergedState, this._normalState, false, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);
+ if (this._textContent) {
+ this._textContent.useStates(states);
+ }
+ if (this._textGuide) {
+ this._textGuide.useStates(states);
+ }
+ this._updateAnimationTargets();
+ this.currentStates = states.slice();
+ this.markRedraw();
+ if (!useHoverLayer && this.__inHover) {
+ this._toggleHoverLayerFlag(false);
+ this.__dirty &= ~Element2.REDARAW_BIT;
+ }
+ }
+ }
+ _updateAnimationTargets() {
+ for (let i = 0; i < this.animators.length; i++) {
+ const animator = this.animators[i];
+ if (animator.targetName) {
+ animator.changeTarget(this[animator.targetName]);
+ }
+ }
+ }
+ removeState(state) {
+ const idx = indexOf(this.currentStates, state);
+ if (idx >= 0) {
+ const currentStates = this.currentStates.slice();
+ currentStates.splice(idx, 1);
+ this.useStates(currentStates);
+ }
+ }
+ replaceState(oldState, newState, forceAdd) {
+ const currentStates = this.currentStates.slice();
+ const idx = indexOf(currentStates, oldState);
+ const newStateExists = indexOf(currentStates, newState) >= 0;
+ if (idx >= 0) {
+ if (!newStateExists) {
+ currentStates[idx] = newState;
+ } else {
+ currentStates.splice(idx, 1);
+ }
+ } else if (forceAdd && !newStateExists) {
+ currentStates.push(newState);
+ }
+ this.useStates(currentStates);
+ }
+ toggleState(state, enable) {
+ if (enable) {
+ this.useState(state, true);
+ } else {
+ this.removeState(state);
+ }
+ }
+ _mergeStates(states) {
+ const mergedState = {};
+ let mergedTextConfig;
+ for (let i = 0; i < states.length; i++) {
+ const state = states[i];
+ extend(mergedState, state);
+ if (state.textConfig) {
+ mergedTextConfig = mergedTextConfig || {};
+ extend(mergedTextConfig, state.textConfig);
+ }
+ }
+ if (mergedTextConfig) {
+ mergedState.textConfig = mergedTextConfig;
+ }
+ return mergedState;
+ }
+ _applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg) {
+ const needsRestoreToNormal = !(state && keepCurrentStates);
+ if (state && state.textConfig) {
+ this.textConfig = extend({}, keepCurrentStates ? this.textConfig : normalState.textConfig);
+ extend(this.textConfig, state.textConfig);
+ } else if (needsRestoreToNormal) {
+ if (normalState.textConfig) {
+ this.textConfig = normalState.textConfig;
+ }
+ }
+ const transitionTarget = {};
+ let hasTransition = false;
+ for (let i = 0; i < PRIMARY_STATES_KEYS.length; i++) {
+ const key = PRIMARY_STATES_KEYS[i];
+ const propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];
+ if (state && state[key] != null) {
+ if (propNeedsTransition) {
+ hasTransition = true;
+ transitionTarget[key] = state[key];
+ } else {
+ this[key] = state[key];
+ }
+ } else if (needsRestoreToNormal) {
+ if (normalState[key] != null) {
+ if (propNeedsTransition) {
+ hasTransition = true;
+ transitionTarget[key] = normalState[key];
+ } else {
+ this[key] = normalState[key];
+ }
+ }
+ }
+ }
+ if (!transition) {
+ for (let i = 0; i < this.animators.length; i++) {
+ const animator = this.animators[i];
+ const targetName = animator.targetName;
+ animator.__changeFinalValue(targetName ? (state || normalState)[targetName] : state || normalState);
+ }
+ }
+ if (hasTransition) {
+ this._transitionState(stateName, transitionTarget, animationCfg);
+ }
+ }
+ _attachComponent(componentEl) {
+ if (componentEl.__zr && !componentEl.__hostTarget) {
+ throw new Error("Text element has been added to zrender.");
+ }
+ if (componentEl === this) {
+ throw new Error("Recursive component attachment.");
+ }
+ const zr = this.__zr;
+ if (zr) {
+ componentEl.addSelfToZr(zr);
+ }
+ componentEl.__zr = zr;
+ componentEl.__hostTarget = this;
+ }
+ _detachComponent(componentEl) {
+ if (componentEl.__zr) {
+ componentEl.removeSelfFromZr(componentEl.__zr);
+ }
+ componentEl.__zr = null;
+ componentEl.__hostTarget = null;
+ }
+ getClipPath() {
+ return this._clipPath;
+ }
+ setClipPath(clipPath) {
+ if (this._clipPath && this._clipPath !== clipPath) {
+ this.removeClipPath();
+ }
+ this._attachComponent(clipPath);
+ this._clipPath = clipPath;
+ this.markRedraw();
+ }
+ removeClipPath() {
+ const clipPath = this._clipPath;
+ if (clipPath) {
+ this._detachComponent(clipPath);
+ this._clipPath = null;
+ this.markRedraw();
+ }
+ }
+ getTextContent() {
+ return this._textContent;
+ }
+ setTextContent(textEl) {
+ const previousTextContent = this._textContent;
+ if (previousTextContent === textEl) {
+ return;
+ }
+ if (previousTextContent && previousTextContent !== textEl) {
+ this.removeTextContent();
+ }
+ if (textEl.__zr && !textEl.__hostTarget) {
+ throw new Error("Text element has been added to zrender.");
+ }
+ textEl.attachedTransform = new Transformable_default();
+ this._attachComponent(textEl);
+ this._textContent = textEl;
+ this.markRedraw();
+ }
+ setTextConfig(cfg) {
+ if (!this.textConfig) {
+ this.textConfig = {};
+ }
+ extend(this.textConfig, cfg);
+ this.markRedraw();
+ }
+ removeTextContent() {
+ const textEl = this._textContent;
+ if (textEl) {
+ textEl.attachedTransform = null;
+ this._detachComponent(textEl);
+ this._textContent = null;
+ this._innerTextDefaultStyle = null;
+ this.markRedraw();
+ }
+ }
+ getTextGuideLine() {
+ return this._textGuide;
+ }
+ setTextGuideLine(guideLine) {
+ if (this._textGuide && this._textGuide !== guideLine) {
+ this.removeTextGuideLine();
+ }
+ this._attachComponent(guideLine);
+ this._textGuide = guideLine;
+ this.markRedraw();
+ }
+ removeTextGuideLine() {
+ const textGuide = this._textGuide;
+ if (textGuide) {
+ this._detachComponent(textGuide);
+ this._textGuide = null;
+ this.markRedraw();
+ }
+ }
+ markRedraw() {
+ this.__dirty |= Element2.REDARAW_BIT;
+ const zr = this.__zr;
+ if (zr) {
+ if (this.__inHover) {
+ zr.refreshHover();
+ } else {
+ zr.refresh();
+ }
+ }
+ if (this.__hostTarget) {
+ this.__hostTarget.markRedraw();
+ }
+ }
+ dirty() {
+ this.markRedraw();
+ }
+ _toggleHoverLayerFlag(inHover) {
+ this.__inHover = inHover;
+ const textContent = this._textContent;
+ const textGuide = this._textGuide;
+ if (textContent) {
+ textContent.__inHover = inHover;
+ }
+ if (textGuide) {
+ textGuide.__inHover = inHover;
+ }
+ }
+ addSelfToZr(zr) {
+ this.__zr = zr;
+ const animators = this.animators;
+ if (animators) {
+ for (let i = 0; i < animators.length; i++) {
+ zr.animation.addAnimator(animators[i]);
+ }
+ }
+ if (this._clipPath) {
+ this._clipPath.addSelfToZr(zr);
+ }
+ if (this._textContent) {
+ this._textContent.addSelfToZr(zr);
+ }
+ if (this._textGuide) {
+ this._textGuide.addSelfToZr(zr);
+ }
+ }
+ removeSelfFromZr(zr) {
+ this.__zr = null;
+ const animators = this.animators;
+ if (animators) {
+ for (let i = 0; i < animators.length; i++) {
+ zr.animation.removeAnimator(animators[i]);
+ }
+ }
+ if (this._clipPath) {
+ this._clipPath.removeSelfFromZr(zr);
+ }
+ if (this._textContent) {
+ this._textContent.removeSelfFromZr(zr);
+ }
+ if (this._textGuide) {
+ this._textGuide.removeSelfFromZr(zr);
+ }
+ }
+ animate(key, loop) {
+ let target = key ? this[key] : this;
+ if (!target) {
+ logError('Property "' + key + '" is not existed in element ' + this.id);
+ return;
+ }
+ const animator = new Animator_default(target, loop);
+ this.addAnimator(animator, key);
+ return animator;
+ }
+ addAnimator(animator, key) {
+ const zr = this.__zr;
+ const el = this;
+ animator.during(function() {
+ el.updateDuringAnimation(key);
+ }).done(function() {
+ const animators = el.animators;
+ const idx = indexOf(animators, animator);
+ if (idx >= 0) {
+ animators.splice(idx, 1);
+ }
+ });
+ this.animators.push(animator);
+ if (zr) {
+ zr.animation.addAnimator(animator);
+ }
+ zr && zr.wakeUp();
+ }
+ updateDuringAnimation(key) {
+ this.markRedraw();
+ }
+ stopAnimation(scope, forwardToLast) {
+ const animators = this.animators;
+ const len2 = animators.length;
+ const leftAnimators = [];
+ for (let i = 0; i < len2; i++) {
+ const animator = animators[i];
+ if (!scope || scope === animator.scope) {
+ animator.stop(forwardToLast);
+ } else {
+ leftAnimators.push(animator);
+ }
+ }
+ this.animators = leftAnimators;
+ return this;
+ }
+ animateTo(target, cfg, animationProps) {
+ animateTo(this, target, cfg, animationProps);
+ }
+ animateFrom(target, cfg, animationProps) {
+ animateTo(this, target, cfg, animationProps, true);
+ }
+ _transitionState(stateName, target, cfg, animationProps) {
+ const animators = animateTo(this, target, cfg, animationProps);
+ for (let i = 0; i < animators.length; i++) {
+ animators[i].__fromStateTransition = stateName;
+ }
+ }
+ getBoundingRect() {
+ return null;
+ }
+ getPaintRect() {
+ return null;
+ }
+};
+var Element = Element2;
+Element.REDARAW_BIT = 1;
+Element.initDefaultProps = function() {
+ const elProto = Element2.prototype;
+ elProto.type = "element";
+ elProto.name = "";
+ elProto.ignore = false;
+ elProto.silent = false;
+ elProto.isGroup = false;
+ elProto.draggable = false;
+ elProto.dragging = false;
+ elProto.ignoreClip = false;
+ elProto.__inHover = false;
+ elProto.__dirty = Element2.REDARAW_BIT;
+ const logs = {};
+ function logDeprecatedError(key, xKey, yKey) {
+ if (!logs[key + xKey + yKey]) {
+ console.warn(`DEPRECATED: '${key}' has been deprecated. use '${xKey}', '${yKey}' instead`);
+ logs[key + xKey + yKey] = true;
+ }
+ }
+ function createLegacyProperty(key, privateKey, xKey, yKey) {
+ Object.defineProperty(elProto, key, {
+ get() {
+ logDeprecatedError(key, xKey, yKey);
+ if (!this[privateKey]) {
+ const pos = this[privateKey] = [];
+ enhanceArray(this, pos);
+ }
+ return this[privateKey];
+ },
+ set(pos) {
+ logDeprecatedError(key, xKey, yKey);
+ this[xKey] = pos[0];
+ this[yKey] = pos[1];
+ this[privateKey] = pos;
+ enhanceArray(this, pos);
+ }
+ });
+ function enhanceArray(self2, pos) {
+ Object.defineProperty(pos, 0, {
+ get() {
+ return self2[xKey];
+ },
+ set(val) {
+ self2[xKey] = val;
+ }
+ });
+ Object.defineProperty(pos, 1, {
+ get() {
+ return self2[yKey];
+ },
+ set(val) {
+ self2[yKey] = val;
}
- return nativeSlice.apply(arr, args);
+ });
}
- function normalizeCssArray(val) {
- if (typeof (val) === 'number') {
- return [val, val, val, val];
+ }
+ if (Object.defineProperty && (!env_default.browser.ie || env_default.browser.version > 8)) {
+ createLegacyProperty("position", "_legacyPos", "x", "y");
+ createLegacyProperty("scale", "_legacyScale", "scaleX", "scaleY");
+ createLegacyProperty("origin", "_legacyOrigin", "originX", "originY");
+ }
+}();
+mixin(Element, Eventful_default);
+mixin(Element, Transformable_default);
+function animateTo(animatable, target, cfg, animationProps, reverse2) {
+ cfg = cfg || {};
+ const animators = [];
+ animateToShallow(animatable, "", animatable, target, cfg, animationProps, animators, reverse2);
+ let finishCount = animators.length;
+ let doneHappened = false;
+ const cfgDone = cfg.done;
+ const cfgAborted = cfg.aborted;
+ const doneCb = () => {
+ doneHappened = true;
+ finishCount--;
+ if (finishCount <= 0) {
+ doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
+ }
+ };
+ const abortedCb = () => {
+ finishCount--;
+ if (finishCount <= 0) {
+ doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
+ }
+ };
+ if (!finishCount) {
+ cfgDone && cfgDone();
+ }
+ if (animators.length > 0 && cfg.during) {
+ animators[0].during((target2, percent) => {
+ cfg.during(percent);
+ });
+ }
+ for (let i = 0; i < animators.length; i++) {
+ const animator = animators[i];
+ if (doneCb) {
+ animator.done(doneCb);
+ }
+ if (abortedCb) {
+ animator.aborted(abortedCb);
+ }
+ animator.start(cfg.easing, cfg.force);
+ }
+ return animators;
+}
+function copyArrShallow(source, target, len2) {
+ for (let i = 0; i < len2; i++) {
+ source[i] = target[i];
+ }
+}
+function is2DArray(value) {
+ return isArrayLike(value[0]);
+}
+function copyValue(target, source, key) {
+ if (isArrayLike(source[key])) {
+ if (!isArrayLike(target[key])) {
+ target[key] = [];
+ }
+ if (isTypedArray(source[key])) {
+ const len2 = source[key].length;
+ if (target[key].length !== len2) {
+ target[key] = new source[key].constructor(len2);
+ copyArrShallow(target[key], source[key], len2);
+ }
+ } else {
+ const sourceArr = source[key];
+ const targetArr = target[key];
+ const len0 = sourceArr.length;
+ if (is2DArray(sourceArr)) {
+ const len1 = sourceArr[0].length;
+ for (let i = 0; i < len0; i++) {
+ if (!targetArr[i]) {
+ targetArr[i] = Array.prototype.slice.call(sourceArr[i]);
+ } else {
+ copyArrShallow(targetArr[i], sourceArr[i], len1);
+ }
}
- var len = val.length;
- if (len === 2) {
- return [val[0], val[1], val[0], val[1]];
+ } else {
+ copyArrShallow(targetArr, sourceArr, len0);
+ }
+ targetArr.length = sourceArr.length;
+ }
+ } else {
+ target[key] = source[key];
+ }
+}
+function animateToShallow(animatable, topKey, source, target, cfg, animationProps, animators, reverse2) {
+ const animatableKeys = [];
+ const changedKeys = [];
+ const targetKeys = keys(target);
+ const duration = cfg.duration;
+ const delay = cfg.delay;
+ const additive = cfg.additive;
+ const setToFinal = cfg.setToFinal;
+ const animateAll = !isObject(animationProps);
+ for (let k = 0; k < targetKeys.length; k++) {
+ const innerKey = targetKeys[k];
+ if (source[innerKey] != null && target[innerKey] != null && (animateAll || animationProps[innerKey])) {
+ if (isObject(target[innerKey]) && !isArrayLike(target[innerKey])) {
+ if (topKey) {
+ if (!reverse2) {
+ source[innerKey] = target[innerKey];
+ animatable.updateDuringAnimation(topKey);
+ }
+ continue;
}
- else if (len === 3) {
- return [val[0], val[1], val[2], val[1]];
+ animateToShallow(animatable, innerKey, source[innerKey], target[innerKey], cfg, animationProps && animationProps[innerKey], animators, reverse2);
+ } else {
+ animatableKeys.push(innerKey);
+ changedKeys.push(innerKey);
+ }
+ } else if (!reverse2) {
+ source[innerKey] = target[innerKey];
+ animatable.updateDuringAnimation(topKey);
+ changedKeys.push(innerKey);
+ }
+ }
+ const keyLen = animatableKeys.length;
+ if (keyLen > 0 || cfg.force && !animators.length) {
+ const existsAnimators = animatable.animators;
+ let existsAnimatorsOnSameTarget = [];
+ for (let i = 0; i < existsAnimators.length; i++) {
+ if (existsAnimators[i].targetName === topKey) {
+ existsAnimatorsOnSameTarget.push(existsAnimators[i]);
+ }
+ }
+ if (!additive && existsAnimatorsOnSameTarget.length) {
+ for (let i = 0; i < existsAnimatorsOnSameTarget.length; i++) {
+ const allAborted = existsAnimatorsOnSameTarget[i].stopTracks(changedKeys);
+ if (allAborted) {
+ const idx = indexOf(existsAnimators, existsAnimatorsOnSameTarget[i]);
+ existsAnimators.splice(idx, 1);
+ }
+ }
+ }
+ let revertedSource;
+ let reversedTarget;
+ let sourceClone;
+ if (reverse2) {
+ reversedTarget = {};
+ if (setToFinal) {
+ revertedSource = {};
+ }
+ for (let i = 0; i < keyLen; i++) {
+ const innerKey = animatableKeys[i];
+ reversedTarget[innerKey] = source[innerKey];
+ if (setToFinal) {
+ revertedSource[innerKey] = target[innerKey];
+ } else {
+ source[innerKey] = target[innerKey];
+ }
+ }
+ } else if (setToFinal) {
+ sourceClone = {};
+ for (let i = 0; i < keyLen; i++) {
+ const innerKey = animatableKeys[i];
+ sourceClone[innerKey] = cloneValue(source[innerKey]);
+ copyValue(source, target, innerKey);
+ }
+ }
+ const animator = new Animator_default(source, false, additive ? existsAnimatorsOnSameTarget : null);
+ animator.targetName = topKey;
+ if (cfg.scope) {
+ animator.scope = cfg.scope;
+ }
+ if (setToFinal && revertedSource) {
+ animator.whenWithKeys(0, revertedSource, animatableKeys);
+ }
+ if (sourceClone) {
+ animator.whenWithKeys(0, sourceClone, animatableKeys);
+ }
+ animator.whenWithKeys(duration == null ? 500 : duration, reverse2 ? reversedTarget : target, animatableKeys).delay(delay || 0);
+ animatable.addAnimator(animator, topKey);
+ animators.push(animator);
+ }
+}
+var Element_default = Element;
+
+// ../zrender/src/core/timsort.ts
+var DEFAULT_MIN_MERGE = 32;
+var DEFAULT_MIN_GALLOPING = 7;
+var DEFAULT_TMP_STORAGE_LENGTH = 256;
+function minRunLength(n) {
+ var r = 0;
+ while (n >= DEFAULT_MIN_MERGE) {
+ r |= n & 1;
+ n >>= 1;
+ }
+ return n + r;
+}
+function makeAscendingRun(array, lo, hi, compare2) {
+ var runHi = lo + 1;
+ if (runHi === hi) {
+ return 1;
+ }
+ if (compare2(array[runHi++], array[lo]) < 0) {
+ while (runHi < hi && compare2(array[runHi], array[runHi - 1]) < 0) {
+ runHi++;
+ }
+ reverseRun(array, lo, runHi);
+ } else {
+ while (runHi < hi && compare2(array[runHi], array[runHi - 1]) >= 0) {
+ runHi++;
+ }
+ }
+ return runHi - lo;
+}
+function reverseRun(array, lo, hi) {
+ hi--;
+ while (lo < hi) {
+ var t = array[lo];
+ array[lo++] = array[hi];
+ array[hi--] = t;
+ }
+}
+function binaryInsertionSort(array, lo, hi, start2, compare2) {
+ if (start2 === lo) {
+ start2++;
+ }
+ for (; start2 < hi; start2++) {
+ var pivot = array[start2];
+ var left = lo;
+ var right = start2;
+ var mid;
+ while (left < right) {
+ mid = left + right >>> 1;
+ if (compare2(pivot, array[mid]) < 0) {
+ right = mid;
+ } else {
+ left = mid + 1;
+ }
+ }
+ var n = start2 - left;
+ switch (n) {
+ case 3:
+ array[left + 3] = array[left + 2];
+ case 2:
+ array[left + 2] = array[left + 1];
+ case 1:
+ array[left + 1] = array[left];
+ break;
+ default:
+ while (n > 0) {
+ array[left + n] = array[left + n - 1];
+ n--;
+ }
+ }
+ array[left] = pivot;
+ }
+}
+function gallopLeft(value, array, start2, length2, hint, compare2) {
+ var lastOffset = 0;
+ var maxOffset = 0;
+ var offset = 1;
+ if (compare2(value, array[start2 + hint]) > 0) {
+ maxOffset = length2 - hint;
+ while (offset < maxOffset && compare2(value, array[start2 + hint + offset]) > 0) {
+ lastOffset = offset;
+ offset = (offset << 1) + 1;
+ if (offset <= 0) {
+ offset = maxOffset;
+ }
+ }
+ if (offset > maxOffset) {
+ offset = maxOffset;
+ }
+ lastOffset += hint;
+ offset += hint;
+ } else {
+ maxOffset = hint + 1;
+ while (offset < maxOffset && compare2(value, array[start2 + hint - offset]) <= 0) {
+ lastOffset = offset;
+ offset = (offset << 1) + 1;
+ if (offset <= 0) {
+ offset = maxOffset;
+ }
+ }
+ if (offset > maxOffset) {
+ offset = maxOffset;
+ }
+ var tmp = lastOffset;
+ lastOffset = hint - offset;
+ offset = hint - tmp;
+ }
+ lastOffset++;
+ while (lastOffset < offset) {
+ var m2 = lastOffset + (offset - lastOffset >>> 1);
+ if (compare2(value, array[start2 + m2]) > 0) {
+ lastOffset = m2 + 1;
+ } else {
+ offset = m2;
+ }
+ }
+ return offset;
+}
+function gallopRight(value, array, start2, length2, hint, compare2) {
+ var lastOffset = 0;
+ var maxOffset = 0;
+ var offset = 1;
+ if (compare2(value, array[start2 + hint]) < 0) {
+ maxOffset = hint + 1;
+ while (offset < maxOffset && compare2(value, array[start2 + hint - offset]) < 0) {
+ lastOffset = offset;
+ offset = (offset << 1) + 1;
+ if (offset <= 0) {
+ offset = maxOffset;
+ }
+ }
+ if (offset > maxOffset) {
+ offset = maxOffset;
+ }
+ var tmp = lastOffset;
+ lastOffset = hint - offset;
+ offset = hint - tmp;
+ } else {
+ maxOffset = length2 - hint;
+ while (offset < maxOffset && compare2(value, array[start2 + hint + offset]) >= 0) {
+ lastOffset = offset;
+ offset = (offset << 1) + 1;
+ if (offset <= 0) {
+ offset = maxOffset;
+ }
+ }
+ if (offset > maxOffset) {
+ offset = maxOffset;
+ }
+ lastOffset += hint;
+ offset += hint;
+ }
+ lastOffset++;
+ while (lastOffset < offset) {
+ var m2 = lastOffset + (offset - lastOffset >>> 1);
+ if (compare2(value, array[start2 + m2]) < 0) {
+ offset = m2;
+ } else {
+ lastOffset = m2 + 1;
+ }
+ }
+ return offset;
+}
+function TimSort(array, compare2) {
+ let minGallop = DEFAULT_MIN_GALLOPING;
+ let length2 = 0;
+ let tmpStorageLength = DEFAULT_TMP_STORAGE_LENGTH;
+ let stackLength = 0;
+ let runStart;
+ let runLength;
+ let stackSize = 0;
+ length2 = array.length;
+ if (length2 < 2 * DEFAULT_TMP_STORAGE_LENGTH) {
+ tmpStorageLength = length2 >>> 1;
+ }
+ var tmp = [];
+ stackLength = length2 < 120 ? 5 : length2 < 1542 ? 10 : length2 < 119151 ? 19 : 40;
+ runStart = [];
+ runLength = [];
+ function pushRun(_runStart, _runLength) {
+ runStart[stackSize] = _runStart;
+ runLength[stackSize] = _runLength;
+ stackSize += 1;
+ }
+ function mergeRuns() {
+ while (stackSize > 1) {
+ var n = stackSize - 2;
+ if (n >= 1 && runLength[n - 1] <= runLength[n] + runLength[n + 1] || n >= 2 && runLength[n - 2] <= runLength[n] + runLength[n - 1]) {
+ if (runLength[n - 1] < runLength[n + 1]) {
+ n--;
+ }
+ } else if (runLength[n] > runLength[n + 1]) {
+ break;
+ }
+ mergeAt(n);
+ }
+ }
+ function forceMergeRuns() {
+ while (stackSize > 1) {
+ var n = stackSize - 2;
+ if (n > 0 && runLength[n - 1] < runLength[n + 1]) {
+ n--;
+ }
+ mergeAt(n);
+ }
+ }
+ function mergeAt(i) {
+ var start1 = runStart[i];
+ var length1 = runLength[i];
+ var start2 = runStart[i + 1];
+ var length22 = runLength[i + 1];
+ runLength[i] = length1 + length22;
+ if (i === stackSize - 3) {
+ runStart[i + 1] = runStart[i + 2];
+ runLength[i + 1] = runLength[i + 2];
+ }
+ stackSize--;
+ var k = gallopRight(array[start2], array, start1, length1, 0, compare2);
+ start1 += k;
+ length1 -= k;
+ if (length1 === 0) {
+ return;
+ }
+ length22 = gallopLeft(array[start1 + length1 - 1], array, start2, length22, length22 - 1, compare2);
+ if (length22 === 0) {
+ return;
+ }
+ if (length1 <= length22) {
+ mergeLow(start1, length1, start2, length22);
+ } else {
+ mergeHigh(start1, length1, start2, length22);
+ }
+ }
+ function mergeLow(start1, length1, start2, length22) {
+ var i = 0;
+ for (i = 0; i < length1; i++) {
+ tmp[i] = array[start1 + i];
+ }
+ var cursor1 = 0;
+ var cursor2 = start2;
+ var dest = start1;
+ array[dest++] = array[cursor2++];
+ if (--length22 === 0) {
+ for (i = 0; i < length1; i++) {
+ array[dest + i] = tmp[cursor1 + i];
+ }
+ return;
+ }
+ if (length1 === 1) {
+ for (i = 0; i < length22; i++) {
+ array[dest + i] = array[cursor2 + i];
+ }
+ array[dest + length22] = tmp[cursor1];
+ return;
+ }
+ var _minGallop = minGallop;
+ var count1;
+ var count2;
+ var exit;
+ while (1) {
+ count1 = 0;
+ count2 = 0;
+ exit = false;
+ do {
+ if (compare2(array[cursor2], tmp[cursor1]) < 0) {
+ array[dest++] = array[cursor2++];
+ count2++;
+ count1 = 0;
+ if (--length22 === 0) {
+ exit = true;
+ break;
+ }
+ } else {
+ array[dest++] = tmp[cursor1++];
+ count1++;
+ count2 = 0;
+ if (--length1 === 1) {
+ exit = true;
+ break;
+ }
}
- return val;
- }
- function assert(condition, message) {
- if (!condition) {
- throw new Error(message);
+ } while ((count1 | count2) < _minGallop);
+ if (exit) {
+ break;
+ }
+ do {
+ count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare2);
+ if (count1 !== 0) {
+ for (i = 0; i < count1; i++) {
+ array[dest + i] = tmp[cursor1 + i];
+ }
+ dest += count1;
+ cursor1 += count1;
+ length1 -= count1;
+ if (length1 <= 1) {
+ exit = true;
+ break;
+ }
}
- }
- function trim(str) {
- if (str == null) {
- return null;
+ array[dest++] = array[cursor2++];
+ if (--length22 === 0) {
+ exit = true;
+ break;
}
- else if (typeof str.trim === 'function') {
- return str.trim();
+ count2 = gallopLeft(tmp[cursor1], array, cursor2, length22, 0, compare2);
+ if (count2 !== 0) {
+ for (i = 0; i < count2; i++) {
+ array[dest + i] = array[cursor2 + i];
+ }
+ dest += count2;
+ cursor2 += count2;
+ length22 -= count2;
+ if (length22 === 0) {
+ exit = true;
+ break;
+ }
}
- else {
- return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
+ array[dest++] = tmp[cursor1++];
+ if (--length1 === 1) {
+ exit = true;
+ break;
}
- }
- var primitiveKey = '__ec_primitive__';
- function setAsPrimitive(obj) {
- obj[primitiveKey] = true;
- }
- function isPrimitive(obj) {
- return obj[primitiveKey];
- }
- var HashMap = (function () {
- function HashMap(obj) {
- this.data = {};
- var isArr = isArray(obj);
- this.data = {};
- var thisMap = this;
- (obj instanceof HashMap)
- ? obj.each(visit)
- : (obj && each(obj, visit));
- function visit(value, key) {
- isArr ? thisMap.set(value, key) : thisMap.set(key, value);
- }
+ _minGallop--;
+ } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
+ if (exit) {
+ break;
+ }
+ if (_minGallop < 0) {
+ _minGallop = 0;
+ }
+ _minGallop += 2;
+ }
+ minGallop = _minGallop;
+ minGallop < 1 && (minGallop = 1);
+ if (length1 === 1) {
+ for (i = 0; i < length22; i++) {
+ array[dest + i] = array[cursor2 + i];
+ }
+ array[dest + length22] = tmp[cursor1];
+ } else if (length1 === 0) {
+ throw new Error();
+ } else {
+ for (i = 0; i < length1; i++) {
+ array[dest + i] = tmp[cursor1 + i];
+ }
+ }
+ }
+ function mergeHigh(start1, length1, start2, length22) {
+ var i = 0;
+ for (i = 0; i < length22; i++) {
+ tmp[i] = array[start2 + i];
+ }
+ var cursor1 = start1 + length1 - 1;
+ var cursor2 = length22 - 1;
+ var dest = start2 + length22 - 1;
+ var customCursor = 0;
+ var customDest = 0;
+ array[dest--] = array[cursor1--];
+ if (--length1 === 0) {
+ customCursor = dest - (length22 - 1);
+ for (i = 0; i < length22; i++) {
+ array[customCursor + i] = tmp[i];
+ }
+ return;
+ }
+ if (length22 === 1) {
+ dest -= length1;
+ cursor1 -= length1;
+ customDest = dest + 1;
+ customCursor = cursor1 + 1;
+ for (i = length1 - 1; i >= 0; i--) {
+ array[customDest + i] = array[customCursor + i];
+ }
+ array[dest] = tmp[cursor2];
+ return;
+ }
+ var _minGallop = minGallop;
+ while (true) {
+ var count1 = 0;
+ var count2 = 0;
+ var exit = false;
+ do {
+ if (compare2(tmp[cursor2], array[cursor1]) < 0) {
+ array[dest--] = array[cursor1--];
+ count1++;
+ count2 = 0;
+ if (--length1 === 0) {
+ exit = true;
+ break;
+ }
+ } else {
+ array[dest--] = tmp[cursor2--];
+ count2++;
+ count1 = 0;
+ if (--length22 === 1) {
+ exit = true;
+ break;
+ }
}
- HashMap.prototype.get = function (key) {
- return this.data.hasOwnProperty(key) ? this.data[key] : null;
- };
- HashMap.prototype.set = function (key, value) {
- return (this.data[key] = value);
- };
- HashMap.prototype.each = function (cb, context) {
- for (var key in this.data) {
- if (this.data.hasOwnProperty(key)) {
- cb.call(context, this.data[key], key);
- }
- }
- };
- HashMap.prototype.keys = function () {
- return keys(this.data);
- };
- HashMap.prototype.removeKey = function (key) {
- delete this.data[key];
- };
- return HashMap;
- }());
- function createHashMap(obj) {
- return new HashMap(obj);
- }
- function concatArray(a, b) {
- var newArray = new a.constructor(a.length + b.length);
- for (var i = 0; i < a.length; i++) {
- newArray[i] = a[i];
- }
- var offset = a.length;
- for (var i = 0; i < b.length; i++) {
- newArray[i + offset] = b[i];
- }
- return newArray;
- }
- function createObject(proto, properties) {
- var obj;
- if (Object.create) {
- obj = Object.create(proto);
- }
- else {
- var StyleCtor = function () { };
- StyleCtor.prototype = proto;
- obj = new StyleCtor();
- }
- if (properties) {
- extend(obj, properties);
- }
- return obj;
- }
- function hasOwn(own, prop) {
- return own.hasOwnProperty(prop);
- }
- function noop() { }
-
- var util = /*#__PURE__*/Object.freeze({
- __proto__: null,
- $override: $override,
- guid: guid,
- logError: logError,
- clone: clone,
- merge: merge,
- mergeAll: mergeAll,
- extend: extend,
- defaults: defaults,
- createCanvas: createCanvas,
- indexOf: indexOf,
- inherits: inherits,
- mixin: mixin,
- isArrayLike: isArrayLike,
- each: each,
- map: map,
- reduce: reduce,
- filter: filter,
- find: find,
- keys: keys,
- bind: bind,
- curry: curry,
- isArray: isArray,
- isFunction: isFunction,
- isString: isString,
- isStringSafe: isStringSafe,
- isNumber: isNumber,
- isObject: isObject,
- isBuiltInObject: isBuiltInObject,
- isTypedArray: isTypedArray,
- isDom: isDom,
- isGradientObject: isGradientObject,
- isPatternObject: isPatternObject,
- isRegExp: isRegExp,
- eqNaN: eqNaN,
- retrieve: retrieve,
- retrieve2: retrieve2,
- retrieve3: retrieve3,
- slice: slice,
- normalizeCssArray: normalizeCssArray,
- assert: assert,
- trim: trim,
- setAsPrimitive: setAsPrimitive,
- isPrimitive: isPrimitive,
- HashMap: HashMap,
- createHashMap: createHashMap,
- concatArray: concatArray,
- createObject: createObject,
- hasOwn: hasOwn,
- noop: noop
- });
-
- function create(x, y) {
- if (x == null) {
- x = 0;
- }
- if (y == null) {
- y = 0;
- }
- return [x, y];
- }
- function copy(out, v) {
- out[0] = v[0];
- out[1] = v[1];
- return out;
- }
- function clone$1(v) {
- return [v[0], v[1]];
- }
- function set(out, a, b) {
- out[0] = a;
- out[1] = b;
- return out;
- }
- function add(out, v1, v2) {
- out[0] = v1[0] + v2[0];
- out[1] = v1[1] + v2[1];
- return out;
- }
- function scaleAndAdd(out, v1, v2, a) {
- out[0] = v1[0] + v2[0] * a;
- out[1] = v1[1] + v2[1] * a;
- return out;
- }
- function sub(out, v1, v2) {
- out[0] = v1[0] - v2[0];
- out[1] = v1[1] - v2[1];
- return out;
- }
- function len(v) {
- return Math.sqrt(lenSquare(v));
- }
- var length = len;
- function lenSquare(v) {
- return v[0] * v[0] + v[1] * v[1];
- }
- var lengthSquare = lenSquare;
- function mul(out, v1, v2) {
- out[0] = v1[0] * v2[0];
- out[1] = v1[1] * v2[1];
- return out;
- }
- function div(out, v1, v2) {
- out[0] = v1[0] / v2[0];
- out[1] = v1[1] / v2[1];
- return out;
- }
- function dot(v1, v2) {
- return v1[0] * v2[0] + v1[1] * v2[1];
- }
- function scale(out, v, s) {
- out[0] = v[0] * s;
- out[1] = v[1] * s;
- return out;
- }
- function normalize(out, v) {
- var d = len(v);
- if (d === 0) {
- out[0] = 0;
- out[1] = 0;
- }
- else {
- out[0] = v[0] / d;
- out[1] = v[1] / d;
- }
- return out;
- }
- function distance(v1, v2) {
- return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0])
- + (v1[1] - v2[1]) * (v1[1] - v2[1]));
- }
- var dist = distance;
- function distanceSquare(v1, v2) {
- return (v1[0] - v2[0]) * (v1[0] - v2[0])
- + (v1[1] - v2[1]) * (v1[1] - v2[1]);
- }
- var distSquare = distanceSquare;
- function negate(out, v) {
- out[0] = -v[0];
- out[1] = -v[1];
- return out;
- }
- function lerp(out, v1, v2, t) {
- out[0] = v1[0] + t * (v2[0] - v1[0]);
- out[1] = v1[1] + t * (v2[1] - v1[1]);
- return out;
- }
- function applyTransform(out, v, m) {
- var x = v[0];
- var y = v[1];
- out[0] = m[0] * x + m[2] * y + m[4];
- out[1] = m[1] * x + m[3] * y + m[5];
- return out;
- }
- function min(out, v1, v2) {
- out[0] = Math.min(v1[0], v2[0]);
- out[1] = Math.min(v1[1], v2[1]);
- return out;
- }
- function max(out, v1, v2) {
- out[0] = Math.max(v1[0], v2[0]);
- out[1] = Math.max(v1[1], v2[1]);
- return out;
- }
-
- var vector = /*#__PURE__*/Object.freeze({
- __proto__: null,
- create: create,
- copy: copy,
- clone: clone$1,
- set: set,
- add: add,
- scaleAndAdd: scaleAndAdd,
- sub: sub,
- len: len,
- length: length,
- lenSquare: lenSquare,
- lengthSquare: lengthSquare,
- mul: mul,
- div: div,
- dot: dot,
- scale: scale,
- normalize: normalize,
- distance: distance,
- dist: dist,
- distanceSquare: distanceSquare,
- distSquare: distSquare,
- negate: negate,
- lerp: lerp,
- applyTransform: applyTransform,
- min: min,
- max: max
- });
-
- var Param = (function () {
- function Param(target, e) {
- this.target = target;
- this.topTarget = e && e.topTarget;
- }
- return Param;
- }());
- var Draggable = (function () {
- function Draggable(handler) {
- this.handler = handler;
- handler.on('mousedown', this._dragStart, this);
- handler.on('mousemove', this._drag, this);
- handler.on('mouseup', this._dragEnd, this);
- }
- Draggable.prototype._dragStart = function (e) {
- var draggingTarget = e.target;
- while (draggingTarget && !draggingTarget.draggable) {
- draggingTarget = draggingTarget.parent;
- }
- if (draggingTarget) {
- this._draggingTarget = draggingTarget;
- draggingTarget.dragging = true;
- this._x = e.offsetX;
- this._y = e.offsetY;
- this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragstart', e.event);
- }
- };
- Draggable.prototype._drag = function (e) {
- var draggingTarget = this._draggingTarget;
- if (draggingTarget) {
- var x = e.offsetX;
- var y = e.offsetY;
- var dx = x - this._x;
- var dy = y - this._y;
- this._x = x;
- this._y = y;
- draggingTarget.drift(dx, dy, e);
- this.handler.dispatchToElement(new Param(draggingTarget, e), 'drag', e.event);
- var dropTarget = this.handler.findHover(x, y, draggingTarget).target;
- var lastDropTarget = this._dropTarget;
- this._dropTarget = dropTarget;
- if (draggingTarget !== dropTarget) {
- if (lastDropTarget && dropTarget !== lastDropTarget) {
- this.handler.dispatchToElement(new Param(lastDropTarget, e), 'dragleave', e.event);
- }
- if (dropTarget && dropTarget !== lastDropTarget) {
- this.handler.dispatchToElement(new Param(dropTarget, e), 'dragenter', e.event);
- }
- }
- }
- };
- Draggable.prototype._dragEnd = function (e) {
- var draggingTarget = this._draggingTarget;
- if (draggingTarget) {
- draggingTarget.dragging = false;
- }
- this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragend', e.event);
- if (this._dropTarget) {
- this.handler.dispatchToElement(new Param(this._dropTarget, e), 'drop', e.event);
- }
- this._draggingTarget = null;
- this._dropTarget = null;
- };
- return Draggable;
- }());
-
- var Eventful = (function () {
- function Eventful(eventProcessors) {
- if (eventProcessors) {
- this._$eventProcessor = eventProcessors;
- }
+ } while ((count1 | count2) < _minGallop);
+ if (exit) {
+ break;
+ }
+ do {
+ count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare2);
+ if (count1 !== 0) {
+ dest -= count1;
+ cursor1 -= count1;
+ length1 -= count1;
+ customDest = dest + 1;
+ customCursor = cursor1 + 1;
+ for (i = count1 - 1; i >= 0; i--) {
+ array[customDest + i] = array[customCursor + i];
+ }
+ if (length1 === 0) {
+ exit = true;
+ break;
+ }
}
- Eventful.prototype.on = function (event, query, handler, context) {
- if (!this._$handlers) {
- this._$handlers = {};
- }
- var _h = this._$handlers;
- if (typeof query === 'function') {
- context = handler;
- handler = query;
- query = null;
- }
- if (!handler || !event) {
- return this;
- }
- var eventProcessor = this._$eventProcessor;
- if (query != null && eventProcessor && eventProcessor.normalizeQuery) {
- query = eventProcessor.normalizeQuery(query);
- }
- if (!_h[event]) {
- _h[event] = [];
- }
- for (var i = 0; i < _h[event].length; i++) {
- if (_h[event][i].h === handler) {
- return this;
- }
- }
- var wrap = {
- h: handler,
- query: query,
- ctx: (context || this),
- callAtLast: handler.zrEventfulCallAtLast
- };
- var lastIndex = _h[event].length - 1;
- var lastWrap = _h[event][lastIndex];
- (lastWrap && lastWrap.callAtLast)
- ? _h[event].splice(lastIndex, 0, wrap)
- : _h[event].push(wrap);
- return this;
- };
- Eventful.prototype.isSilent = function (eventName) {
- var _h = this._$handlers;
- return !_h || !_h[eventName] || !_h[eventName].length;
- };
- Eventful.prototype.off = function (eventType, handler) {
- var _h = this._$handlers;
- if (!_h) {
- return this;
- }
- if (!eventType) {
- this._$handlers = {};
- return this;
- }
- if (handler) {
- if (_h[eventType]) {
- var newList = [];
- for (var i = 0, l = _h[eventType].length; i < l; i++) {
- if (_h[eventType][i].h !== handler) {
- newList.push(_h[eventType][i]);
- }
- }
- _h[eventType] = newList;
- }
- if (_h[eventType] && _h[eventType].length === 0) {
- delete _h[eventType];
- }
- }
- else {
- delete _h[eventType];
- }
- return this;
- };
- Eventful.prototype.trigger = function (eventType) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- if (!this._$handlers) {
- return this;
- }
- var _h = this._$handlers[eventType];
- var eventProcessor = this._$eventProcessor;
- if (_h) {
- var argLen = args.length;
- var len = _h.length;
- for (var i = 0; i < len; i++) {
- var hItem = _h[i];
- if (eventProcessor
- && eventProcessor.filter
- && hItem.query != null
- && !eventProcessor.filter(eventType, hItem.query)) {
- continue;
- }
- switch (argLen) {
- case 0:
- hItem.h.call(hItem.ctx);
- break;
- case 1:
- hItem.h.call(hItem.ctx, args[0]);
- break;
- case 2:
- hItem.h.call(hItem.ctx, args[0], args[1]);
- break;
- default:
- hItem.h.apply(hItem.ctx, args);
- break;
- }
- }
- }
- eventProcessor && eventProcessor.afterTrigger
- && eventProcessor.afterTrigger(eventType);
- return this;
- };
- Eventful.prototype.triggerWithContext = function (type) {
- if (!this._$handlers) {
- return this;
- }
- var _h = this._$handlers[type];
- var eventProcessor = this._$eventProcessor;
- if (_h) {
- var args = arguments;
- var argLen = args.length;
- var ctx = args[argLen - 1];
- var len = _h.length;
- for (var i = 0; i < len; i++) {
- var hItem = _h[i];
- if (eventProcessor
- && eventProcessor.filter
- && hItem.query != null
- && !eventProcessor.filter(type, hItem.query)) {
- continue;
- }
- switch (argLen) {
- case 0:
- hItem.h.call(ctx);
- break;
- case 1:
- hItem.h.call(ctx, args[0]);
- break;
- case 2:
- hItem.h.call(ctx, args[0], args[1]);
- break;
- default:
- hItem.h.apply(ctx, args.slice(1, argLen - 1));
- break;
- }
- }
- }
- eventProcessor && eventProcessor.afterTrigger
- && eventProcessor.afterTrigger(type);
- return this;
- };
- return Eventful;
- }());
-
- var LN2 = Math.log(2);
- function determinant(rows, rank, rowStart, rowMask, colMask, detCache) {
- var cacheKey = rowMask + '-' + colMask;
- var fullRank = rows.length;
- if (detCache.hasOwnProperty(cacheKey)) {
- return detCache[cacheKey];
- }
- if (rank === 1) {
- var colStart = Math.round(Math.log(((1 << fullRank) - 1) & ~colMask) / LN2);
- return rows[rowStart][colStart];
- }
- var subRowMask = rowMask | (1 << rowStart);
- var subRowStart = rowStart + 1;
- while (rowMask & (1 << subRowStart)) {
- subRowStart++;
- }
- var sum = 0;
- for (var j = 0, colLocalIdx = 0; j < fullRank; j++) {
- var colTag = 1 << j;
- if (!(colTag & colMask)) {
- sum += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j]
- * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);
- colLocalIdx++;
- }
+ array[dest--] = tmp[cursor2--];
+ if (--length22 === 1) {
+ exit = true;
+ break;
}
- detCache[cacheKey] = sum;
- return sum;
- }
- function buildTransformer(src, dest) {
- var mA = [
- [src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]],
- [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]],
- [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]],
- [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]],
- [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]],
- [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]],
- [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]],
- [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]
- ];
- var detCache = {};
- var det = determinant(mA, 8, 0, 0, 0, detCache);
- if (det === 0) {
- return;
+ count2 = length22 - gallopLeft(array[cursor1], tmp, 0, length22, length22 - 1, compare2);
+ if (count2 !== 0) {
+ dest -= count2;
+ cursor2 -= count2;
+ length22 -= count2;
+ customDest = dest + 1;
+ customCursor = cursor2 + 1;
+ for (i = 0; i < count2; i++) {
+ array[customDest + i] = tmp[customCursor + i];
+ }
+ if (length22 <= 1) {
+ exit = true;
+ break;
+ }
}
- var vh = [];
- for (var i = 0; i < 8; i++) {
- for (var j = 0; j < 8; j++) {
- vh[j] == null && (vh[j] = 0);
- vh[j] += ((i + j) % 2 ? -1 : 1)
- * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache)
- / det * dest[i];
- }
+ array[dest--] = array[cursor1--];
+ if (--length1 === 0) {
+ exit = true;
+ break;
}
- return function (out, srcPointX, srcPointY) {
- var pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;
- out[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;
- out[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;
- };
+ _minGallop--;
+ } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
+ if (exit) {
+ break;
+ }
+ if (_minGallop < 0) {
+ _minGallop = 0;
+ }
+ _minGallop += 2;
+ }
+ minGallop = _minGallop;
+ if (minGallop < 1) {
+ minGallop = 1;
+ }
+ if (length22 === 1) {
+ dest -= length1;
+ cursor1 -= length1;
+ customDest = dest + 1;
+ customCursor = cursor1 + 1;
+ for (i = length1 - 1; i >= 0; i--) {
+ array[customDest + i] = array[customCursor + i];
+ }
+ array[dest] = tmp[cursor2];
+ } else if (length22 === 0) {
+ throw new Error();
+ } else {
+ customCursor = dest - (length22 - 1);
+ for (i = 0; i < length22; i++) {
+ array[customCursor + i] = tmp[i];
+ }
+ }
+ }
+ return {
+ mergeRuns,
+ forceMergeRuns,
+ pushRun
+ };
+}
+function sort(array, compare2, lo, hi) {
+ if (!lo) {
+ lo = 0;
+ }
+ if (!hi) {
+ hi = array.length;
+ }
+ var remaining = hi - lo;
+ if (remaining < 2) {
+ return;
+ }
+ var runLength = 0;
+ if (remaining < DEFAULT_MIN_MERGE) {
+ runLength = makeAscendingRun(array, lo, hi, compare2);
+ binaryInsertionSort(array, lo, hi, lo + runLength, compare2);
+ return;
+ }
+ var ts = TimSort(array, compare2);
+ var minRun = minRunLength(remaining);
+ do {
+ runLength = makeAscendingRun(array, lo, hi, compare2);
+ if (runLength < minRun) {
+ var force = remaining;
+ if (force > minRun) {
+ force = minRun;
+ }
+ binaryInsertionSort(array, lo, lo + force, lo + runLength, compare2);
+ runLength = force;
+ }
+ ts.pushRun(lo, runLength);
+ ts.mergeRuns();
+ remaining -= runLength;
+ lo += runLength;
+ } while (remaining !== 0);
+ ts.forceMergeRuns();
+}
+
+// ../zrender/src/Storage.ts
+var invalidZErrorLogged = false;
+function logInvalidZError() {
+ if (invalidZErrorLogged) {
+ return;
+ }
+ invalidZErrorLogged = true;
+ console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors");
+}
+function shapeCompareFunc(a, b) {
+ if (a.zlevel === b.zlevel) {
+ if (a.z === b.z) {
+ return a.z2 - b.z2;
+ }
+ return a.z - b.z;
+ }
+ return a.zlevel - b.zlevel;
+}
+var Storage = class {
+ constructor() {
+ this._roots = [];
+ this._displayList = [];
+ this._displayListLen = 0;
+ this.displayableSortFunc = shapeCompareFunc;
+ }
+ traverse(cb, context) {
+ for (let i = 0; i < this._roots.length; i++) {
+ this._roots[i].traverse(cb, context);
+ }
+ }
+ getDisplayList(update, includeIgnore) {
+ includeIgnore = includeIgnore || false;
+ const displayList = this._displayList;
+ if (update || !displayList.length) {
+ this.updateDisplayList(includeIgnore);
+ }
+ return displayList;
+ }
+ updateDisplayList(includeIgnore) {
+ this._displayListLen = 0;
+ const roots2 = this._roots;
+ const displayList = this._displayList;
+ for (let i = 0, len2 = roots2.length; i < len2; i++) {
+ this._updateAndAddDisplayable(roots2[i], null, includeIgnore);
+ }
+ displayList.length = this._displayListLen;
+ env_default.canvasSupported && sort(displayList, shapeCompareFunc);
+ }
+ _updateAndAddDisplayable(el, clipPaths, includeIgnore) {
+ if (el.ignore && !includeIgnore) {
+ return;
+ }
+ el.beforeUpdate();
+ el.update();
+ el.afterUpdate();
+ const userSetClipPath = el.getClipPath();
+ if (el.ignoreClip) {
+ clipPaths = null;
+ } else if (userSetClipPath) {
+ if (clipPaths) {
+ clipPaths = clipPaths.slice();
+ } else {
+ clipPaths = [];
+ }
+ let currentClipPath = userSetClipPath;
+ let parentClipPath = el;
+ while (currentClipPath) {
+ currentClipPath.parent = parentClipPath;
+ currentClipPath.updateTransform();
+ clipPaths.push(currentClipPath);
+ parentClipPath = currentClipPath;
+ currentClipPath = currentClipPath.getClipPath();
+ }
+ }
+ if (el.childrenRef) {
+ const children = el.childrenRef();
+ for (let i = 0; i < children.length; i++) {
+ const child = children[i];
+ if (el.__dirty) {
+ child.__dirty |= Element_default.REDARAW_BIT;
+ }
+ this._updateAndAddDisplayable(child, clipPaths, includeIgnore);
+ }
+ el.__dirty = 0;
+ } else {
+ const disp = el;
+ if (clipPaths && clipPaths.length) {
+ disp.__clipPaths = clipPaths;
+ } else if (disp.__clipPaths && disp.__clipPaths.length > 0) {
+ disp.__clipPaths = [];
+ }
+ if (isNaN(disp.z)) {
+ logInvalidZError();
+ disp.z = 0;
+ }
+ if (isNaN(disp.z2)) {
+ logInvalidZError();
+ disp.z2 = 0;
+ }
+ if (isNaN(disp.zlevel)) {
+ logInvalidZError();
+ disp.zlevel = 0;
+ }
+ this._displayList[this._displayListLen++] = disp;
+ }
+ const decalEl = el.getDecalElement && el.getDecalElement();
+ if (decalEl) {
+ this._updateAndAddDisplayable(decalEl, clipPaths, includeIgnore);
+ }
+ const textGuide = el.getTextGuideLine();
+ if (textGuide) {
+ this._updateAndAddDisplayable(textGuide, clipPaths, includeIgnore);
+ }
+ const textEl = el.getTextContent();
+ if (textEl) {
+ this._updateAndAddDisplayable(textEl, clipPaths, includeIgnore);
+ }
+ }
+ addRoot(el) {
+ if (el.__zr && el.__zr.storage === this) {
+ return;
+ }
+ this._roots.push(el);
+ }
+ delRoot(el) {
+ if (el instanceof Array) {
+ for (let i = 0, l = el.length; i < l; i++) {
+ this.delRoot(el[i]);
+ }
+ return;
+ }
+ const idx = indexOf(this._roots, el);
+ if (idx >= 0) {
+ this._roots.splice(idx, 1);
+ }
+ }
+ delAllRoots() {
+ this._roots = [];
+ this._displayList = [];
+ this._displayListLen = 0;
+ return;
+ }
+ getRoots() {
+ return this._roots;
+ }
+ dispose() {
+ this._displayList = null;
+ this._roots = null;
+ }
+};
+var Storage_default = Storage;
+
+// ../zrender/src/animation/requestAnimationFrame.ts
+var requestAnimationFrame;
+requestAnimationFrame = typeof window !== "undefined" && (window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window) || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame) || function(func) {
+ return setTimeout(func, 16);
+};
+var requestAnimationFrame_default = requestAnimationFrame;
+
+// ../zrender/src/animation/Animation.ts
+var Animation = class extends Eventful_default {
+ constructor(opts) {
+ super();
+ this._running = false;
+ this._time = 0;
+ this._pausedTime = 0;
+ this._pauseStart = 0;
+ this._paused = false;
+ opts = opts || {};
+ this.stage = opts.stage || {};
+ this.onframe = opts.onframe || function() {
+ };
+ }
+ addClip(clip2) {
+ if (clip2.animation) {
+ this.removeClip(clip2);
+ }
+ if (!this._clipsHead) {
+ this._clipsHead = this._clipsTail = clip2;
+ } else {
+ this._clipsTail.next = clip2;
+ clip2.prev = this._clipsTail;
+ clip2.next = null;
+ this._clipsTail = clip2;
+ }
+ clip2.animation = this;
+ }
+ addAnimator(animator) {
+ animator.animation = this;
+ const clip2 = animator.getClip();
+ if (clip2) {
+ this.addClip(clip2);
+ }
+ }
+ removeClip(clip2) {
+ if (!clip2.animation) {
+ return;
+ }
+ const prev = clip2.prev;
+ const next = clip2.next;
+ if (prev) {
+ prev.next = next;
+ } else {
+ this._clipsHead = next;
+ }
+ if (next) {
+ next.prev = prev;
+ } else {
+ this._clipsTail = prev;
+ }
+ clip2.next = clip2.prev = clip2.animation = null;
+ }
+ removeAnimator(animator) {
+ const clip2 = animator.getClip();
+ if (clip2) {
+ this.removeClip(clip2);
+ }
+ animator.animation = null;
+ }
+ update(notTriggerFrameAndStageUpdate) {
+ const time = new Date().getTime() - this._pausedTime;
+ const delta = time - this._time;
+ let clip2 = this._clipsHead;
+ while (clip2) {
+ const nextClip = clip2.next;
+ let finished = clip2.step(time, delta);
+ if (finished) {
+ clip2.ondestroy && clip2.ondestroy();
+ this.removeClip(clip2);
+ clip2 = nextClip;
+ } else {
+ clip2 = nextClip;
+ }
+ }
+ this._time = time;
+ if (!notTriggerFrameAndStageUpdate) {
+ this.onframe(delta);
+ this.trigger("frame", delta);
+ this.stage.update && this.stage.update();
+ }
+ }
+ _startLoop() {
+ const self2 = this;
+ this._running = true;
+ function step2() {
+ if (self2._running) {
+ requestAnimationFrame_default(step2);
+ !self2._paused && self2.update();
+ }
+ }
+ requestAnimationFrame_default(step2);
+ }
+ start() {
+ if (this._running) {
+ return;
+ }
+ this._time = new Date().getTime();
+ this._pausedTime = 0;
+ this._startLoop();
+ }
+ stop() {
+ this._running = false;
+ }
+ pause() {
+ if (!this._paused) {
+ this._pauseStart = new Date().getTime();
+ this._paused = true;
+ }
+ }
+ resume() {
+ if (this._paused) {
+ this._pausedTime += new Date().getTime() - this._pauseStart;
+ this._paused = false;
+ }
+ }
+ clear() {
+ let clip2 = this._clipsHead;
+ while (clip2) {
+ let nextClip = clip2.next;
+ clip2.prev = clip2.next = clip2.animation = null;
+ clip2 = nextClip;
+ }
+ this._clipsHead = this._clipsTail = null;
+ }
+ isFinished() {
+ return this._clipsHead == null;
+ }
+ animate(target, options) {
+ options = options || {};
+ this.start();
+ const animator = new Animator_default(target, options.loop);
+ this.addAnimator(animator);
+ return animator;
+ }
+};
+var Animation_default = Animation;
+
+// ../zrender/src/dom/HandlerProxy.ts
+var TOUCH_CLICK_DELAY = 300;
+var globalEventSupported = env_default.domSupported;
+var localNativeListenerNames = function() {
+ const mouseHandlerNames = [
+ "click",
+ "dblclick",
+ "mousewheel",
+ "wheel",
+ "mouseout",
+ "mouseup",
+ "mousedown",
+ "mousemove",
+ "contextmenu"
+ ];
+ const touchHandlerNames = [
+ "touchstart",
+ "touchend",
+ "touchmove"
+ ];
+ const pointerEventNameMap = {
+ pointerdown: 1,
+ pointerup: 1,
+ pointermove: 1,
+ pointerout: 1
+ };
+ const pointerHandlerNames = map(mouseHandlerNames, function(name) {
+ const nm = name.replace("mouse", "pointer");
+ return pointerEventNameMap.hasOwnProperty(nm) ? nm : name;
+ });
+ return {
+ mouse: mouseHandlerNames,
+ touch: touchHandlerNames,
+ pointer: pointerHandlerNames
+ };
+}();
+var globalNativeListenerNames = {
+ mouse: ["mousemove", "mouseup"],
+ pointer: ["pointermove", "pointerup"]
+};
+var wheelEventSupported = false;
+function isPointerFromTouch(event) {
+ const pointerType = event.pointerType;
+ return pointerType === "pen" || pointerType === "touch";
+}
+function setTouchTimer(scope) {
+ scope.touching = true;
+ if (scope.touchTimer != null) {
+ clearTimeout(scope.touchTimer);
+ scope.touchTimer = null;
+ }
+ scope.touchTimer = setTimeout(function() {
+ scope.touching = false;
+ scope.touchTimer = null;
+ }, 700);
+}
+function markTouch(event) {
+ event && (event.zrByTouch = true);
+}
+function normalizeGlobalEvent(instance, event) {
+ return normalizeEvent(instance.dom, new FakeGlobalEvent(instance, event), true);
+}
+function isLocalEl(instance, el) {
+ let elTmp = el;
+ let isLocal = false;
+ while (elTmp && elTmp.nodeType !== 9 && !(isLocal = elTmp.domBelongToZr || elTmp !== el && elTmp === instance.painterRoot)) {
+ elTmp = elTmp.parentNode;
+ }
+ return isLocal;
+}
+var FakeGlobalEvent = class {
+ constructor(instance, event) {
+ this.stopPropagation = noop;
+ this.stopImmediatePropagation = noop;
+ this.preventDefault = noop;
+ this.type = event.type;
+ this.target = this.currentTarget = instance.dom;
+ this.pointerType = event.pointerType;
+ this.clientX = event.clientX;
+ this.clientY = event.clientY;
+ }
+};
+var localDOMHandlers = {
+ mousedown(event) {
+ event = normalizeEvent(this.dom, event);
+ this.__mayPointerCapture = [event.zrX, event.zrY];
+ this.trigger("mousedown", event);
+ },
+ mousemove(event) {
+ event = normalizeEvent(this.dom, event);
+ const downPoint = this.__mayPointerCapture;
+ if (downPoint && (event.zrX !== downPoint[0] || event.zrY !== downPoint[1])) {
+ this.__togglePointerCapture(true);
+ }
+ this.trigger("mousemove", event);
+ },
+ mouseup(event) {
+ event = normalizeEvent(this.dom, event);
+ this.__togglePointerCapture(false);
+ this.trigger("mouseup", event);
+ },
+ mouseout(event) {
+ event = normalizeEvent(this.dom, event);
+ const element = event.toElement || event.relatedTarget;
+ if (!isLocalEl(this, element)) {
+ if (this.__pointerCapturing) {
+ event.zrEventControl = "no_globalout";
+ }
+ this.trigger("mouseout", event);
+ }
+ },
+ wheel(event) {
+ wheelEventSupported = true;
+ event = normalizeEvent(this.dom, event);
+ this.trigger("mousewheel", event);
+ },
+ mousewheel(event) {
+ if (wheelEventSupported) {
+ return;
+ }
+ event = normalizeEvent(this.dom, event);
+ this.trigger("mousewheel", event);
+ },
+ touchstart(event) {
+ event = normalizeEvent(this.dom, event);
+ markTouch(event);
+ this.__lastTouchMoment = new Date();
+ this.handler.processGesture(event, "start");
+ localDOMHandlers.mousemove.call(this, event);
+ localDOMHandlers.mousedown.call(this, event);
+ },
+ touchmove(event) {
+ event = normalizeEvent(this.dom, event);
+ markTouch(event);
+ this.handler.processGesture(event, "change");
+ localDOMHandlers.mousemove.call(this, event);
+ },
+ touchend(event) {
+ event = normalizeEvent(this.dom, event);
+ markTouch(event);
+ this.handler.processGesture(event, "end");
+ localDOMHandlers.mouseup.call(this, event);
+ if (+new Date() - +this.__lastTouchMoment < TOUCH_CLICK_DELAY) {
+ localDOMHandlers.click.call(this, event);
+ }
+ },
+ pointerdown(event) {
+ localDOMHandlers.mousedown.call(this, event);
+ },
+ pointermove(event) {
+ if (!isPointerFromTouch(event)) {
+ localDOMHandlers.mousemove.call(this, event);
+ }
+ },
+ pointerup(event) {
+ localDOMHandlers.mouseup.call(this, event);
+ },
+ pointerout(event) {
+ if (!isPointerFromTouch(event)) {
+ localDOMHandlers.mouseout.call(this, event);
+ }
+ }
+};
+each(["click", "dblclick", "contextmenu"], function(name) {
+ localDOMHandlers[name] = function(event) {
+ event = normalizeEvent(this.dom, event);
+ this.trigger(name, event);
+ };
+});
+var globalDOMHandlers = {
+ pointermove: function(event) {
+ if (!isPointerFromTouch(event)) {
+ globalDOMHandlers.mousemove.call(this, event);
+ }
+ },
+ pointerup: function(event) {
+ globalDOMHandlers.mouseup.call(this, event);
+ },
+ mousemove: function(event) {
+ this.trigger("mousemove", event);
+ },
+ mouseup: function(event) {
+ const pointerCaptureReleasing = this.__pointerCapturing;
+ this.__togglePointerCapture(false);
+ this.trigger("mouseup", event);
+ if (pointerCaptureReleasing) {
+ event.zrEventControl = "only_globalout";
+ this.trigger("mouseout", event);
+ }
+ }
+};
+function mountLocalDOMEventListeners(instance, scope) {
+ const domHandlers = scope.domHandlers;
+ if (env_default.pointerEventsSupported) {
+ each(localNativeListenerNames.pointer, function(nativeEventName) {
+ mountSingleDOMEventListener(scope, nativeEventName, function(event) {
+ domHandlers[nativeEventName].call(instance, event);
+ });
+ });
+ } else {
+ if (env_default.touchEventsSupported) {
+ each(localNativeListenerNames.touch, function(nativeEventName) {
+ mountSingleDOMEventListener(scope, nativeEventName, function(event) {
+ domHandlers[nativeEventName].call(instance, event);
+ setTouchTimer(scope);
+ });
+ });
+ }
+ each(localNativeListenerNames.mouse, function(nativeEventName) {
+ mountSingleDOMEventListener(scope, nativeEventName, function(event) {
+ event = getNativeEvent(event);
+ if (!scope.touching) {
+ domHandlers[nativeEventName].call(instance, event);
+ }
+ });
+ });
+ }
+}
+function mountGlobalDOMEventListeners(instance, scope) {
+ if (env_default.pointerEventsSupported) {
+ each(globalNativeListenerNames.pointer, mount);
+ } else if (!env_default.touchEventsSupported) {
+ each(globalNativeListenerNames.mouse, mount);
+ }
+ function mount(nativeEventName) {
+ function nativeEventListener(event) {
+ event = getNativeEvent(event);
+ if (!isLocalEl(instance, event.target)) {
+ event = normalizeGlobalEvent(instance, event);
+ scope.domHandlers[nativeEventName].call(instance, event);
+ }
+ }
+ mountSingleDOMEventListener(scope, nativeEventName, nativeEventListener, {capture: true});
+ }
+}
+function mountSingleDOMEventListener(scope, nativeEventName, listener, opt) {
+ scope.mounted[nativeEventName] = listener;
+ scope.listenerOpts[nativeEventName] = opt;
+ addEventListener(scope.domTarget, nativeEventName, listener, opt);
+}
+function unmountDOMEventListeners(scope) {
+ const mounted = scope.mounted;
+ for (let nativeEventName in mounted) {
+ if (mounted.hasOwnProperty(nativeEventName)) {
+ removeEventListener(scope.domTarget, nativeEventName, mounted[nativeEventName], scope.listenerOpts[nativeEventName]);
+ }
+ }
+ scope.mounted = {};
+}
+var DOMHandlerScope = class {
+ constructor(domTarget, domHandlers) {
+ this.mounted = {};
+ this.listenerOpts = {};
+ this.touching = false;
+ this.domTarget = domTarget;
+ this.domHandlers = domHandlers;
+ }
+};
+var HandlerDomProxy = class extends Eventful_default {
+ constructor(dom, painterRoot) {
+ super();
+ this.__pointerCapturing = false;
+ this.dom = dom;
+ this.painterRoot = painterRoot;
+ this._localHandlerScope = new DOMHandlerScope(dom, localDOMHandlers);
+ if (globalEventSupported) {
+ this._globalHandlerScope = new DOMHandlerScope(document, globalDOMHandlers);
+ }
+ mountLocalDOMEventListeners(this, this._localHandlerScope);
+ }
+ dispose() {
+ unmountDOMEventListeners(this._localHandlerScope);
+ if (globalEventSupported) {
+ unmountDOMEventListeners(this._globalHandlerScope);
+ }
+ }
+ setCursor(cursorStyle) {
+ this.dom.style && (this.dom.style.cursor = cursorStyle || "default");
+ }
+ __togglePointerCapture(isPointerCapturing) {
+ this.__mayPointerCapture = null;
+ if (globalEventSupported && +this.__pointerCapturing ^ +isPointerCapturing) {
+ this.__pointerCapturing = isPointerCapturing;
+ const globalHandlerScope = this._globalHandlerScope;
+ isPointerCapturing ? mountGlobalDOMEventListeners(this, globalHandlerScope) : unmountDOMEventListeners(globalHandlerScope);
+ }
+ }
+};
+var HandlerProxy_default = HandlerDomProxy;
+
+// ../zrender/src/graphic/Group.ts
+var Group = class extends Element_default {
+ constructor(opts) {
+ super();
+ this.isGroup = true;
+ this._children = [];
+ this.attr(opts);
+ }
+ childrenRef() {
+ return this._children;
+ }
+ children() {
+ return this._children.slice();
+ }
+ childAt(idx) {
+ return this._children[idx];
+ }
+ childOfName(name) {
+ const children = this._children;
+ for (let i = 0; i < children.length; i++) {
+ if (children[i].name === name) {
+ return children[i];
+ }
+ }
+ }
+ childCount() {
+ return this._children.length;
+ }
+ add(child) {
+ if (child) {
+ if (child !== this && child.parent !== this) {
+ this._children.push(child);
+ this._doAdd(child);
+ }
+ if (child.__hostTarget) {
+ throw "This elemenet has been used as an attachment";
+ }
+ }
+ return this;
+ }
+ addBefore(child, nextSibling) {
+ if (child && child !== this && child.parent !== this && nextSibling && nextSibling.parent === this) {
+ const children = this._children;
+ const idx = children.indexOf(nextSibling);
+ if (idx >= 0) {
+ children.splice(idx, 0, child);
+ this._doAdd(child);
+ }
+ }
+ return this;
+ }
+ replaceAt(child, index) {
+ const children = this._children;
+ const old = children[index];
+ if (child && child !== this && child.parent !== this && child !== old) {
+ children[index] = child;
+ old.parent = null;
+ const zr = this.__zr;
+ if (zr) {
+ old.removeSelfFromZr(zr);
+ }
+ this._doAdd(child);
+ }
+ return this;
+ }
+ _doAdd(child) {
+ if (child.parent) {
+ child.parent.remove(child);
+ }
+ child.parent = this;
+ const zr = this.__zr;
+ if (zr && zr !== child.__zr) {
+ child.addSelfToZr(zr);
+ }
+ zr && zr.refresh();
+ }
+ remove(child) {
+ const zr = this.__zr;
+ const children = this._children;
+ const idx = indexOf(children, child);
+ if (idx < 0) {
+ return this;
+ }
+ children.splice(idx, 1);
+ child.parent = null;
+ if (zr) {
+ child.removeSelfFromZr(zr);
+ }
+ zr && zr.refresh();
+ return this;
+ }
+ removeAll() {
+ const children = this._children;
+ const zr = this.__zr;
+ for (let i = 0; i < children.length; i++) {
+ const child = children[i];
+ if (zr) {
+ child.removeSelfFromZr(zr);
+ }
+ child.parent = null;
+ }
+ children.length = 0;
+ return this;
+ }
+ eachChild(cb, context) {
+ const children = this._children;
+ for (let i = 0; i < children.length; i++) {
+ const child = children[i];
+ cb.call(context, child, i);
+ }
+ return this;
+ }
+ traverse(cb, context) {
+ for (let i = 0; i < this._children.length; i++) {
+ const child = this._children[i];
+ const stopped = cb.call(context, child);
+ if (child.isGroup && !stopped) {
+ child.traverse(cb, context);
+ }
+ }
+ return this;
+ }
+ addSelfToZr(zr) {
+ super.addSelfToZr(zr);
+ for (let i = 0; i < this._children.length; i++) {
+ const child = this._children[i];
+ child.addSelfToZr(zr);
+ }
+ }
+ removeSelfFromZr(zr) {
+ super.removeSelfFromZr(zr);
+ for (let i = 0; i < this._children.length; i++) {
+ const child = this._children[i];
+ child.removeSelfFromZr(zr);
+ }
+ }
+ getBoundingRect(includeChildren) {
+ const tmpRect2 = new BoundingRect_default(0, 0, 0, 0);
+ const children = includeChildren || this._children;
+ const tmpMat = [];
+ let rect = null;
+ for (let i = 0; i < children.length; i++) {
+ const child = children[i];
+ if (child.ignore || child.invisible) {
+ continue;
+ }
+ const childRect = child.getBoundingRect();
+ const transform2 = child.getLocalTransform(tmpMat);
+ if (transform2) {
+ BoundingRect_default.applyTransform(tmpRect2, childRect, transform2);
+ rect = rect || tmpRect2.clone();
+ rect.union(tmpRect2);
+ } else {
+ rect = rect || childRect.clone();
+ rect.union(childRect);
+ }
}
+ return rect || tmpRect2;
+ }
+};
+Group.prototype.type = "group";
+var Group_default = Group;
- var EVENT_SAVED_PROP = '___zrEVENTSAVED';
- var _calcOut = [];
- function transformLocalCoord(out, elFrom, elTarget, inX, inY) {
- return transformCoordWithViewport(_calcOut, elFrom, inX, inY, true)
- && transformCoordWithViewport(out, elTarget, _calcOut[0], _calcOut[1]);
+// ../zrender/src/zrender.ts
+/*!
+* 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 useVML = !env_default.canvasSupported;
+var painterCtors = {};
+var instances = {};
+function delInstance(id) {
+ delete instances[id];
+}
+function isDarkMode(backgroundColor2) {
+ if (!backgroundColor2) {
+ return false;
+ }
+ if (typeof backgroundColor2 === "string") {
+ return lum(backgroundColor2, 1) < DARK_MODE_THRESHOLD;
+ } else if (backgroundColor2.colorStops) {
+ const colorStops = backgroundColor2.colorStops;
+ let totalLum = 0;
+ const len2 = colorStops.length;
+ for (let i = 0; i < len2; i++) {
+ totalLum += lum(colorStops[i].color, 1);
+ }
+ totalLum /= len2;
+ return totalLum < DARK_MODE_THRESHOLD;
+ }
+ return false;
+}
+var ZRender = class {
+ constructor(id, dom, opts) {
+ this._sleepAfterStill = 10;
+ this._stillFrameAccum = 0;
+ this._needsRefresh = true;
+ this._needsRefreshHover = true;
+ this._darkMode = false;
+ opts = opts || {};
+ this.dom = dom;
+ this.id = id;
+ const storage2 = new Storage_default();
+ let rendererType = opts.renderer || "canvas";
+ if (useVML) {
+ throw new Error("IE8 support has been dropped since 5.0");
+ }
+ if (!painterCtors[rendererType]) {
+ rendererType = keys(painterCtors)[0];
+ }
+ if (!painterCtors[rendererType]) {
+ throw new Error(`Renderer '${rendererType}' is not imported. Please import it first.`);
+ }
+ opts.useDirtyRect = opts.useDirtyRect == null ? false : opts.useDirtyRect;
+ const painter = new painterCtors[rendererType](dom, storage2, opts, id);
+ this.storage = storage2;
+ this.painter = painter;
+ const handerProxy = !env_default.node && !env_default.worker ? new HandlerProxy_default(painter.getViewportRoot(), painter.root) : null;
+ this.handler = new Handler_default(storage2, painter, handerProxy, painter.root);
+ this.animation = new Animation_default({
+ stage: {
+ update: () => this._flush(true)
+ }
+ });
+ this.animation.start();
+ }
+ add(el) {
+ if (!el) {
+ return;
+ }
+ this.storage.addRoot(el);
+ el.addSelfToZr(this);
+ this.refresh();
+ }
+ remove(el) {
+ if (!el) {
+ return;
+ }
+ this.storage.delRoot(el);
+ el.removeSelfFromZr(this);
+ this.refresh();
+ }
+ configLayer(zLevel, config) {
+ if (this.painter.configLayer) {
+ this.painter.configLayer(zLevel, config);
+ }
+ this.refresh();
+ }
+ setBackgroundColor(backgroundColor2) {
+ if (this.painter.setBackgroundColor) {
+ this.painter.setBackgroundColor(backgroundColor2);
+ }
+ this.refresh();
+ this._backgroundColor = backgroundColor2;
+ this._darkMode = isDarkMode(backgroundColor2);
+ }
+ getBackgroundColor() {
+ return this._backgroundColor;
+ }
+ setDarkMode(darkMode) {
+ this._darkMode = darkMode;
+ }
+ isDarkMode() {
+ return this._darkMode;
+ }
+ refreshImmediately(fromInside) {
+ if (!fromInside) {
+ this.animation.update(true);
+ }
+ this._needsRefresh = false;
+ this.painter.refresh();
+ this._needsRefresh = false;
+ }
+ refresh() {
+ this._needsRefresh = true;
+ this.animation.start();
+ }
+ flush() {
+ this._flush(false);
+ }
+ _flush(fromInside) {
+ let triggerRendered;
+ const start2 = new Date().getTime();
+ if (this._needsRefresh) {
+ triggerRendered = true;
+ this.refreshImmediately(fromInside);
+ }
+ if (this._needsRefreshHover) {
+ triggerRendered = true;
+ this.refreshHoverImmediately();
+ }
+ const end2 = new Date().getTime();
+ if (triggerRendered) {
+ this._stillFrameAccum = 0;
+ this.trigger("rendered", {
+ elapsedTime: end2 - start2
+ });
+ } else if (this._sleepAfterStill > 0) {
+ this._stillFrameAccum++;
+ if (this._stillFrameAccum > this._sleepAfterStill) {
+ this.animation.stop();
+ }
+ }
+ }
+ setSleepAfterStill(stillFramesCount) {
+ this._sleepAfterStill = stillFramesCount;
+ }
+ wakeUp() {
+ this.animation.start();
+ this._stillFrameAccum = 0;
+ }
+ addHover(el) {
+ }
+ removeHover(el) {
+ }
+ clearHover() {
+ }
+ refreshHover() {
+ this._needsRefreshHover = true;
+ }
+ refreshHoverImmediately() {
+ this._needsRefreshHover = false;
+ if (this.painter.refreshHover && this.painter.getType() === "canvas") {
+ this.painter.refreshHover();
+ }
+ }
+ resize(opts) {
+ opts = opts || {};
+ this.painter.resize(opts.width, opts.height);
+ this.handler.resize();
+ }
+ clearAnimation() {
+ this.animation.clear();
+ }
+ getWidth() {
+ return this.painter.getWidth();
+ }
+ getHeight() {
+ return this.painter.getHeight();
+ }
+ pathToImage(e2, dpr2) {
+ if (this.painter.pathToImage) {
+ return this.painter.pathToImage(e2, dpr2);
+ }
+ }
+ setCursorStyle(cursorStyle) {
+ this.handler.setCursorStyle(cursorStyle);
+ }
+ findHover(x, y) {
+ return this.handler.findHover(x, y);
+ }
+ on(eventName, eventHandler, context) {
+ this.handler.on(eventName, eventHandler, context);
+ return this;
+ }
+ off(eventName, eventHandler) {
+ this.handler.off(eventName, eventHandler);
+ }
+ trigger(eventName, event) {
+ this.handler.trigger(eventName, event);
+ }
+ clear() {
+ const roots2 = this.storage.getRoots();
+ for (let i = 0; i < roots2.length; i++) {
+ if (roots2[i] instanceof Group_default) {
+ roots2[i].removeSelfFromZr(this);
+ }
+ }
+ this.storage.delAllRoots();
+ this.painter.clear();
+ }
+ dispose() {
+ this.animation.stop();
+ this.clear();
+ this.storage.dispose();
+ this.painter.dispose();
+ this.handler.dispose();
+ this.animation = this.storage = this.painter = this.handler = null;
+ delInstance(this.id);
+ }
+};
+function init(dom, opts) {
+ const zr = new ZRender(guid(), dom, opts);
+ instances[zr.id] = zr;
+ return zr;
+}
+function dispose(zr) {
+ zr.dispose();
+}
+function disposeAll() {
+ for (let key in instances) {
+ if (instances.hasOwnProperty(key)) {
+ instances[key].dispose();
+ }
+ }
+ instances = {};
+}
+function getInstance(id) {
+ return instances[id];
+}
+function registerPainter(name, Ctor) {
+ painterCtors[name] = Ctor;
+}
+var version = "5.0.4";
+
+// src/util/number.ts
+var RADIAN_EPSILON = 1e-4;
+function _trim(str) {
+ return str.replace(/^\s+|\s+$/g, "");
+}
+function linearMap(val, domain, range, clamp2) {
+ const subDomain = domain[1] - domain[0];
+ const subRange = range[1] - range[0];
+ if (subDomain === 0) {
+ return subRange === 0 ? range[0] : (range[0] + range[1]) / 2;
+ }
+ if (clamp2) {
+ if (subDomain > 0) {
+ if (val <= domain[0]) {
+ return range[0];
+ } else if (val >= domain[1]) {
+ return range[1];
+ }
+ } else {
+ if (val >= domain[0]) {
+ return range[0];
+ } else if (val <= domain[1]) {
+ return range[1];
+ }
+ }
+ } else {
+ if (val === domain[0]) {
+ return range[0];
+ }
+ if (val === domain[1]) {
+ return range[1];
+ }
+ }
+ return (val - domain[0]) / subDomain * subRange + range[0];
+}
+function parsePercent2(percent, all) {
+ switch (percent) {
+ case "center":
+ case "middle":
+ percent = "50%";
+ break;
+ case "left":
+ case "top":
+ percent = "0%";
+ break;
+ case "right":
+ case "bottom":
+ percent = "100%";
+ break;
+ }
+ if (typeof percent === "string") {
+ if (_trim(percent).match(/%$/)) {
+ return parseFloat(percent) / 100 * all;
+ }
+ return parseFloat(percent);
+ }
+ return percent == null ? NaN : +percent;
+}
+function round(x, precision, returnStr) {
+ if (precision == null) {
+ precision = 10;
+ }
+ precision = Math.min(Math.max(0, precision), 20);
+ x = (+x).toFixed(precision);
+ return returnStr ? x : +x;
+}
+function asc(arr) {
+ arr.sort(function(a, b) {
+ return a - b;
+ });
+ return arr;
+}
+function getPrecision(val) {
+ val = +val;
+ if (isNaN(val)) {
+ return 0;
+ }
+ let e2 = 1;
+ let count2 = 0;
+ while (Math.round(val * e2) / e2 !== val) {
+ e2 *= 10;
+ count2++;
+ }
+ return count2;
+}
+function getPrecisionSafe(val) {
+ const str = val.toString();
+ const eIndex = str.indexOf("e");
+ if (eIndex > 0) {
+ const precision = +str.slice(eIndex + 1);
+ return precision < 0 ? -precision : 0;
+ } else {
+ const dotIndex = str.indexOf(".");
+ return dotIndex < 0 ? 0 : str.length - 1 - dotIndex;
+ }
+}
+function getPixelPrecision(dataExtent, pixelExtent) {
+ const log = Math.log;
+ const LN10 = Math.LN10;
+ const dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);
+ const sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10);
+ const precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);
+ return !isFinite(precision) ? 20 : precision;
+}
+function getPercentWithPrecision(valueList, idx, precision) {
+ if (!valueList[idx]) {
+ return 0;
+ }
+ const sum2 = reduce(valueList, function(acc, val) {
+ return acc + (isNaN(val) ? 0 : val);
+ }, 0);
+ if (sum2 === 0) {
+ return 0;
+ }
+ const digits = Math.pow(10, precision);
+ const votesPerQuota = map(valueList, function(val) {
+ return (isNaN(val) ? 0 : val) / sum2 * digits * 100;
+ });
+ const targetSeats = digits * 100;
+ const seats = map(votesPerQuota, function(votes) {
+ return Math.floor(votes);
+ });
+ let currentSum = reduce(seats, function(acc, val) {
+ return acc + val;
+ }, 0);
+ const remainder = map(votesPerQuota, function(votes, idx2) {
+ return votes - seats[idx2];
+ });
+ while (currentSum < targetSeats) {
+ let max3 = Number.NEGATIVE_INFINITY;
+ let maxId = null;
+ for (let i = 0, len2 = remainder.length; i < len2; ++i) {
+ if (remainder[i] > max3) {
+ max3 = remainder[i];
+ maxId = i;
+ }
+ }
+ ++seats[maxId];
+ remainder[maxId] = 0;
+ ++currentSum;
+ }
+ return seats[idx] / digits;
+}
+var MAX_SAFE_INTEGER = 9007199254740991;
+function remRadian(radian) {
+ const pi2 = Math.PI * 2;
+ return (radian % pi2 + pi2) % pi2;
+}
+function isRadianAroundZero(val) {
+ return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
+}
+var TIME_REG = /^(?:(\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 parseDate(value) {
+ if (value instanceof Date) {
+ return value;
+ } else if (typeof value === "string") {
+ const match = TIME_REG.exec(value);
+ if (!match) {
+ return new Date(NaN);
+ }
+ if (!match[8]) {
+ return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, +match[7] || 0);
+ } else {
+ let hour = +match[4] || 0;
+ if (match[8].toUpperCase() !== "Z") {
+ hour -= +match[8].slice(0, 3);
+ }
+ return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, +match[7] || 0));
+ }
+ } else if (value == null) {
+ return new Date(NaN);
+ }
+ return new Date(Math.round(value));
+}
+function quantity(val) {
+ return Math.pow(10, quantityExponent(val));
+}
+function quantityExponent(val) {
+ if (val === 0) {
+ return 0;
+ }
+ let exp = Math.floor(Math.log(val) / Math.LN10);
+ if (val / Math.pow(10, exp) >= 10) {
+ exp++;
+ }
+ return exp;
+}
+function nice(val, round6) {
+ const exponent = quantityExponent(val);
+ const exp10 = Math.pow(10, exponent);
+ const f = val / exp10;
+ let nf;
+ if (round6) {
+ if (f < 1.5) {
+ nf = 1;
+ } else if (f < 2.5) {
+ nf = 2;
+ } else if (f < 4) {
+ nf = 3;
+ } else if (f < 7) {
+ nf = 5;
+ } else {
+ nf = 10;
+ }
+ } else {
+ if (f < 1) {
+ nf = 1;
+ } else if (f < 2) {
+ nf = 2;
+ } else if (f < 3) {
+ nf = 3;
+ } else if (f < 5) {
+ nf = 5;
+ } else {
+ nf = 10;
+ }
+ }
+ val = nf * exp10;
+ return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;
+}
+function quantile(ascArr, p) {
+ const H = (ascArr.length - 1) * p + 1;
+ const h = Math.floor(H);
+ const v = +ascArr[h - 1];
+ const e2 = H - h;
+ return e2 ? v + e2 * (ascArr[h] - v) : v;
+}
+function reformIntervals(list) {
+ list.sort(function(a, b) {
+ return littleThan2(a, b, 0) ? -1 : 1;
+ });
+ let curr = -Infinity;
+ let currClose = 1;
+ for (let i = 0; i < list.length; ) {
+ const interval = list[i].interval;
+ const close = list[i].close;
+ for (let lg = 0; lg < 2; lg++) {
+ if (interval[lg] <= curr) {
+ interval[lg] = curr;
+ close[lg] = !lg ? 1 - currClose : 1;
+ }
+ curr = interval[lg];
+ currClose = close[lg];
+ }
+ if (interval[0] === interval[1] && close[0] * close[1] !== 1) {
+ list.splice(i, 1);
+ } else {
+ i++;
+ }
+ }
+ return list;
+ function littleThan2(a, b, lg) {
+ return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan2(a, b, 1));
+ }
+}
+function numericToNumber(val) {
+ const valFloat = parseFloat(val);
+ return valFloat == val && (valFloat !== 0 || typeof val !== "string" || val.indexOf("x") <= 0) ? valFloat : NaN;
+}
+function isNumeric(val) {
+ return !isNaN(numericToNumber(val));
+}
+function getRandomIdBase() {
+ return Math.round(Math.random() * 9);
+}
+function getGreatestCommonDividor(a, b) {
+ if (b === 0) {
+ return a;
+ }
+ return getGreatestCommonDividor(b, a % b);
+}
+function getLeastCommonMultiple(a, b) {
+ if (a == null) {
+ return b;
+ }
+ if (b == null) {
+ return a;
+ }
+ return a * b / getGreatestCommonDividor(a, b);
+}
+
+// src/util/log.ts
+var ECHARTS_PREFIX = "[ECharts] ";
+var storedLogs = {};
+var hasConsole = typeof console !== "undefined" && console.warn && console.log;
+function warn(str) {
+ if (hasConsole) {
+ console.warn(ECHARTS_PREFIX + str);
+ }
+}
+function error(str) {
+ if (hasConsole) {
+ console.error(ECHARTS_PREFIX + str);
+ }
+}
+function deprecateLog(str) {
+ if (__DEV__) {
+ if (storedLogs[str]) {
+ return;
+ }
+ if (hasConsole) {
+ storedLogs[str] = true;
+ console.warn(ECHARTS_PREFIX + "DEPRECATED: " + str);
+ }
+ }
+}
+function deprecateReplaceLog(oldOpt, newOpt, scope) {
+ if (__DEV__) {
+ deprecateLog((scope ? `[${scope}]` : "") + `${oldOpt} is deprecated, use ${newOpt} instead.`);
+ }
+}
+function consoleLog(...args) {
+ if (__DEV__) {
+ if (typeof console !== "undefined" && console.log) {
+ console.log.apply(console, args);
+ }
+ }
+}
+function makePrintable(...hintInfo) {
+ let msg = "";
+ if (__DEV__) {
+ const makePrintableStringIfPossible = (val) => {
+ return val === void 0 ? "undefined" : val === Infinity ? "Infinity" : val === -Infinity ? "-Infinity" : eqNaN(val) ? "NaN" : val instanceof Date ? "Date(" + val.toISOString() + ")" : isFunction(val) ? "function () { ... }" : isRegExp(val) ? val + "" : null;
+ };
+ msg = map(hintInfo, (arg) => {
+ if (isString(arg)) {
+ return arg;
+ } else {
+ const printableStr = makePrintableStringIfPossible(arg);
+ if (printableStr != null) {
+ return printableStr;
+ } else if (typeof JSON !== "undefined" && JSON.stringify) {
+ try {
+ return JSON.stringify(arg, function(n, val) {
+ const printableStr2 = makePrintableStringIfPossible(val);
+ return printableStr2 == null ? val : printableStr2;
+ });
+ } catch (err) {
+ return "?";
+ }
+ } else {
+ return "?";
+ }
+ }
+ }).join(" ");
+ }
+ return msg;
+}
+function throwError(msg) {
+ throw new Error(msg);
+}
+
+// src/util/model.ts
+var DUMMY_COMPONENT_NAME_PREFIX = "series\0";
+var INTERNAL_COMPONENT_ID_PREFIX = "\0_ec_\0";
+function normalizeToArray(value) {
+ return value instanceof Array ? value : value == null ? [] : [value];
+}
+function defaultEmphasis(opt, key, subOpts) {
+ if (opt) {
+ opt[key] = opt[key] || {};
+ opt.emphasis = opt.emphasis || {};
+ opt.emphasis[key] = opt.emphasis[key] || {};
+ for (let i = 0, len2 = subOpts.length; i < len2; i++) {
+ const subOptName = subOpts[i];
+ if (!opt.emphasis[key].hasOwnProperty(subOptName) && opt[key].hasOwnProperty(subOptName)) {
+ opt.emphasis[key][subOptName] = opt[key][subOptName];
+ }
+ }
+ }
+}
+var TEXT_STYLE_OPTIONS = [
+ "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 getDataItemValue(dataItem) {
+ return isObject(dataItem) && !isArray(dataItem) && !(dataItem instanceof Date) ? dataItem.value : dataItem;
+}
+function isDataItemOption(dataItem) {
+ return isObject(dataItem) && !(dataItem instanceof Array);
+}
+function mappingToExists(existings, newCmptOptions, mode) {
+ const isNormalMergeMode = mode === "normalMerge";
+ const isReplaceMergeMode = mode === "replaceMerge";
+ const isReplaceAllMode = mode === "replaceAll";
+ existings = existings || [];
+ newCmptOptions = (newCmptOptions || []).slice();
+ const existingIdIdxMap = createHashMap();
+ each(newCmptOptions, function(cmptOption, index) {
+ if (!isObject(cmptOption)) {
+ newCmptOptions[index] = null;
+ return;
+ }
+ if (__DEV__) {
+ if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {
+ warnInvalidateIdOrName(cmptOption.id);
+ }
+ if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {
+ warnInvalidateIdOrName(cmptOption.name);
+ }
+ }
+ });
+ const result = prepareResult(existings, existingIdIdxMap, mode);
+ if (isNormalMergeMode || isReplaceMergeMode) {
+ mappingById(result, existings, existingIdIdxMap, newCmptOptions);
+ }
+ if (isNormalMergeMode) {
+ mappingByName(result, newCmptOptions);
+ }
+ if (isNormalMergeMode || isReplaceMergeMode) {
+ mappingByIndex(result, newCmptOptions, isReplaceMergeMode);
+ } else if (isReplaceAllMode) {
+ mappingInReplaceAllMode(result, newCmptOptions);
+ }
+ makeIdAndName(result);
+ return result;
+}
+function prepareResult(existings, existingIdIdxMap, mode) {
+ const result = [];
+ if (mode === "replaceAll") {
+ return result;
+ }
+ for (let index = 0; index < existings.length; index++) {
+ const existing = existings[index];
+ if (existing && existing.id != null) {
+ existingIdIdxMap.set(existing.id, index);
+ }
+ result.push({
+ existing: mode === "replaceMerge" || isComponentIdInternal(existing) ? null : existing,
+ newOption: null,
+ keyInfo: null,
+ brandNew: null
+ });
+ }
+ return result;
+}
+function mappingById(result, existings, existingIdIdxMap, newCmptOptions) {
+ each(newCmptOptions, function(cmptOption, index) {
+ if (!cmptOption || cmptOption.id == null) {
+ return;
+ }
+ const optionId = makeComparableKey(cmptOption.id);
+ const existingIdx = existingIdIdxMap.get(optionId);
+ if (existingIdx != null) {
+ const resultItem = result[existingIdx];
+ assert(!resultItem.newOption, 'Duplicated option on id "' + optionId + '".');
+ resultItem.newOption = cmptOption;
+ resultItem.existing = existings[existingIdx];
+ newCmptOptions[index] = null;
+ }
+ });
+}
+function mappingByName(result, newCmptOptions) {
+ each(newCmptOptions, function(cmptOption, index) {
+ if (!cmptOption || cmptOption.name == null) {
+ return;
+ }
+ for (let i = 0; i < result.length; i++) {
+ const existing = result[i].existing;
+ if (!result[i].newOption && existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual("name", existing, cmptOption)) {
+ result[i].newOption = cmptOption;
+ newCmptOptions[index] = null;
+ return;
+ }
}
- function transformCoordWithViewport(out, el, inX, inY, inverse) {
- if (el.getBoundingClientRect && env.domSupported && !isCanvasEl(el)) {
- var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
- var markers = prepareCoordMarkers(el, saved);
- var transformer = preparePointerTransformer(markers, saved, inverse);
- if (transformer) {
- transformer(out, inX, inY);
- return true;
- }
- }
- return false;
+ });
+}
+function mappingByIndex(result, newCmptOptions, brandNew) {
+ each(newCmptOptions, function(cmptOption) {
+ if (!cmptOption) {
+ return;
+ }
+ let resultItem;
+ let nextIdx = 0;
+ while ((resultItem = result[nextIdx]) && (resultItem.newOption || isComponentIdInternal(resultItem.existing) || resultItem.existing && cmptOption.id != null && !keyExistAndEqual("id", cmptOption, resultItem.existing))) {
+ nextIdx++;
+ }
+ if (resultItem) {
+ resultItem.newOption = cmptOption;
+ resultItem.brandNew = brandNew;
+ } else {
+ result.push({
+ newOption: cmptOption,
+ brandNew,
+ existing: null,
+ keyInfo: null
+ });
}
- function prepareCoordMarkers(el, saved) {
- var markers = saved.markers;
- if (markers) {
- return markers;
- }
- markers = saved.markers = [];
- var propLR = ['left', 'right'];
- var propTB = ['top', 'bottom'];
- for (var i = 0; i < 4; i++) {
- var marker = document.createElement('div');
- var stl = marker.style;
- var idxLR = i % 2;
- var idxTB = (i >> 1) % 2;
- stl.cssText = [
- 'position: absolute',
- 'visibility: hidden',
- 'padding: 0',
- 'margin: 0',
- 'border-width: 0',
- 'user-select: none',
- 'width:0',
- 'height:0',
- propLR[idxLR] + ':0',
- propTB[idxTB] + ':0',
- propLR[1 - idxLR] + ':auto',
- propTB[1 - idxTB] + ':auto',
- ''
- ].join('!important;');
- el.appendChild(marker);
- markers.push(marker);
- }
- return markers;
- }
- function preparePointerTransformer(markers, saved, inverse) {
- var transformerName = inverse ? 'invTrans' : 'trans';
- var transformer = saved[transformerName];
- var oldSrcCoords = saved.srcCoords;
- var srcCoords = [];
- var destCoords = [];
- var oldCoordTheSame = true;
- for (var i = 0; i < 4; i++) {
- var rect = markers[i].getBoundingClientRect();
- var ii = 2 * i;
- var x = rect.left;
- var y = rect.top;
- srcCoords.push(x, y);
- oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
- destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
- }
- return (oldCoordTheSame && transformer)
- ? transformer
- : (saved.srcCoords = srcCoords,
- saved[transformerName] = inverse
- ? buildTransformer(destCoords, srcCoords)
- : buildTransformer(srcCoords, destCoords));
- }
- function isCanvasEl(el) {
- return el.nodeName.toUpperCase() === 'CANVAS';
- }
-
- var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;
- var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
- var _calcOut$1 = [];
- function clientToLocal(el, e, out, calculate) {
- out = out || {};
- if (calculate || !env.canvasSupported) {
- calculateZrXY(el, e, out);
- }
- else if (env.browser.firefox
- && e.layerX != null
- && e.layerX !== e.offsetX) {
- out.zrX = e.layerX;
- out.zrY = e.layerY;
- }
- else if (e.offsetX != null) {
- out.zrX = e.offsetX;
- out.zrY = e.offsetY;
- }
- else {
- calculateZrXY(el, e, out);
- }
- return out;
- }
- function calculateZrXY(el, e, out) {
- if (env.domSupported && el.getBoundingClientRect) {
- var ex = e.clientX;
- var ey = e.clientY;
- if (isCanvasEl(el)) {
- var box = el.getBoundingClientRect();
- out.zrX = ex - box.left;
- out.zrY = ey - box.top;
- return;
- }
- else {
- if (transformCoordWithViewport(_calcOut$1, el, ex, ey)) {
- out.zrX = _calcOut$1[0];
- out.zrY = _calcOut$1[1];
- return;
- }
- }
+ nextIdx++;
+ });
+}
+function mappingInReplaceAllMode(result, newCmptOptions) {
+ each(newCmptOptions, function(cmptOption) {
+ result.push({
+ newOption: cmptOption,
+ brandNew: true,
+ existing: null,
+ keyInfo: null
+ });
+ });
+}
+function makeIdAndName(mapResult) {
+ const idMap = createHashMap();
+ each(mapResult, function(item) {
+ const existing = item.existing;
+ existing && idMap.set(existing.id, item);
+ });
+ each(mapResult, function(item) {
+ const opt = item.newOption;
+ assert(!opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item, "id duplicates: " + (opt && opt.id));
+ opt && opt.id != null && idMap.set(opt.id, item);
+ !item.keyInfo && (item.keyInfo = {});
+ });
+ each(mapResult, function(item, index) {
+ const existing = item.existing;
+ const opt = item.newOption;
+ const keyInfo = item.keyInfo;
+ if (!isObject(opt)) {
+ return;
+ }
+ keyInfo.name = opt.name != null ? makeComparableKey(opt.name) : existing ? existing.name : DUMMY_COMPONENT_NAME_PREFIX + index;
+ if (existing) {
+ keyInfo.id = makeComparableKey(existing.id);
+ } else if (opt.id != null) {
+ keyInfo.id = makeComparableKey(opt.id);
+ } else {
+ let idNum = 0;
+ do {
+ keyInfo.id = "\0" + keyInfo.name + "\0" + idNum++;
+ } while (idMap.get(keyInfo.id));
+ }
+ idMap.set(keyInfo.id, item);
+ });
+}
+function keyExistAndEqual(attr2, obj1, obj2) {
+ const key1 = convertOptionIdName(obj1[attr2], null);
+ const key2 = convertOptionIdName(obj2[attr2], null);
+ return key1 != null && key2 != null && key1 === key2;
+}
+function makeComparableKey(val) {
+ if (__DEV__) {
+ if (val == null) {
+ throw new Error();
+ }
+ }
+ return convertOptionIdName(val, "");
+}
+function convertOptionIdName(idOrName, defaultValue) {
+ if (idOrName == null) {
+ return defaultValue;
+ }
+ const type = typeof idOrName;
+ return type === "string" ? idOrName : type === "number" || isStringSafe(idOrName) ? idOrName + "" : defaultValue;
+}
+function warnInvalidateIdOrName(idOrName) {
+ if (__DEV__) {
+ warn("`" + idOrName + "` is invalid id or name. Must be a string or number.");
+ }
+}
+function isValidIdOrName(idOrName) {
+ return isStringSafe(idOrName) || isNumeric(idOrName);
+}
+function isNameSpecified(componentModel) {
+ const name = componentModel.name;
+ return !!(name && name.indexOf(DUMMY_COMPONENT_NAME_PREFIX));
+}
+function isComponentIdInternal(cmptOption) {
+ return cmptOption && cmptOption.id != null && makeComparableKey(cmptOption.id).indexOf(INTERNAL_COMPONENT_ID_PREFIX) === 0;
+}
+function makeInternalComponentId(idSuffix) {
+ return INTERNAL_COMPONENT_ID_PREFIX + idSuffix;
+}
+function setComponentTypeToKeyInfo(mappingResult, mainType, componentModelCtor) {
+ each(mappingResult, function(item) {
+ const newOption = item.newOption;
+ if (isObject(newOption)) {
+ item.keyInfo.mainType = mainType;
+ item.keyInfo.subType = determineSubType(mainType, newOption, item.existing, componentModelCtor);
+ }
+ });
+}
+function determineSubType(mainType, newCmptOption, existComponent, componentModelCtor) {
+ const subType = newCmptOption.type ? newCmptOption.type : existComponent ? existComponent.subType : componentModelCtor.determineSubType(mainType, newCmptOption);
+ return subType;
+}
+function compressBatches(batchA, batchB) {
+ const mapA = {};
+ const mapB = {};
+ makeMap(batchA || [], mapA);
+ makeMap(batchB || [], mapB, mapA);
+ return [mapToArray(mapA), mapToArray(mapB)];
+ function makeMap(sourceBatch, map3, otherMap) {
+ for (let i = 0, len2 = sourceBatch.length; i < len2; i++) {
+ const seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);
+ if (seriesId == null) {
+ return;
+ }
+ const dataIndices = normalizeToArray(sourceBatch[i].dataIndex);
+ const otherDataIndices = otherMap && otherMap[seriesId];
+ for (let j = 0, lenj = dataIndices.length; j < lenj; j++) {
+ const dataIndex = dataIndices[j];
+ if (otherDataIndices && otherDataIndices[dataIndex]) {
+ otherDataIndices[dataIndex] = null;
+ } else {
+ (map3[seriesId] || (map3[seriesId] = {}))[dataIndex] = 1;
}
- out.zrX = out.zrY = 0;
- }
- function getNativeEvent(e) {
- return e
- || window.event;
+ }
}
- function normalizeEvent(el, e, calculate) {
- e = getNativeEvent(e);
- if (e.zrX != null) {
- return e;
+ }
+ function mapToArray(map3, isData) {
+ const result = [];
+ for (const i in map3) {
+ if (map3.hasOwnProperty(i) && map3[i] != null) {
+ if (isData) {
+ result.push(+i);
+ } else {
+ const dataIndices = mapToArray(map3[i], true);
+ dataIndices.length && result.push({seriesId: i, dataIndex: dataIndices});
+ }
+ }
+ }
+ return result;
+ }
+}
+function queryDataIndex(data, payload) {
+ if (payload.dataIndexInside != null) {
+ return payload.dataIndexInside;
+ } else if (payload.dataIndex != null) {
+ return isArray(payload.dataIndex) ? map(payload.dataIndex, function(value) {
+ return data.indexOfRawIndex(value);
+ }) : data.indexOfRawIndex(payload.dataIndex);
+ } else if (payload.name != null) {
+ return isArray(payload.name) ? map(payload.name, function(value) {
+ return data.indexOfName(value);
+ }) : data.indexOfName(payload.name);
+ }
+}
+function makeInner() {
+ const key = "__ec_inner_" + innerUniqueIndex++;
+ return function(hostObj) {
+ return hostObj[key] || (hostObj[key] = {});
+ };
+}
+var innerUniqueIndex = getRandomIdBase();
+function parseFinder(ecModel, finderInput, opt) {
+ const {mainTypeSpecified, queryOptionMap, others} = preParseFinder(finderInput, opt);
+ const result = others;
+ const defaultMainType = opt ? opt.defaultMainType : null;
+ if (!mainTypeSpecified && defaultMainType) {
+ queryOptionMap.set(defaultMainType, {});
+ }
+ queryOptionMap.each(function(queryOption, mainType) {
+ const queryResult = queryReferringComponents(ecModel, mainType, queryOption, {
+ useDefault: defaultMainType === mainType,
+ enableAll: opt && opt.enableAll != null ? opt.enableAll : true,
+ enableNone: opt && opt.enableNone != null ? opt.enableNone : true
+ });
+ result[mainType + "Models"] = queryResult.models;
+ result[mainType + "Model"] = queryResult.models[0];
+ });
+ return result;
+}
+function preParseFinder(finderInput, opt) {
+ let finder;
+ if (isString(finderInput)) {
+ const obj = {};
+ obj[finderInput + "Index"] = 0;
+ finder = obj;
+ } else {
+ finder = finderInput;
+ }
+ const queryOptionMap = createHashMap();
+ const others = {};
+ let mainTypeSpecified = false;
+ each(finder, function(value, key) {
+ if (key === "dataIndex" || key === "dataIndexInside") {
+ others[key] = value;
+ return;
+ }
+ const parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || [];
+ const mainType = parsedKey[1];
+ const queryType = (parsedKey[2] || "").toLowerCase();
+ if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {
+ return;
+ }
+ mainTypeSpecified = mainTypeSpecified || !!mainType;
+ const queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});
+ queryOption[queryType] = value;
+ });
+ return {mainTypeSpecified, queryOptionMap, others};
+}
+var SINGLE_REFERRING = {useDefault: true, enableAll: false, enableNone: false};
+var MULTIPLE_REFERRING = {useDefault: false, enableAll: true, enableNone: true};
+function queryReferringComponents(ecModel, mainType, userOption, opt) {
+ opt = opt || SINGLE_REFERRING;
+ let indexOption = userOption.index;
+ let idOption = userOption.id;
+ let nameOption = userOption.name;
+ const result = {
+ models: null,
+ specified: indexOption != null || idOption != null || nameOption != null
+ };
+ if (!result.specified) {
+ let firstCmpt;
+ result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];
+ return result;
+ }
+ if (indexOption === "none" || indexOption === false) {
+ assert(opt.enableNone, '`"none"` or `false` is not a valid value on index option.');
+ result.models = [];
+ return result;
+ }
+ if (indexOption === "all") {
+ assert(opt.enableAll, '`"all"` is not a valid value on index option.');
+ indexOption = idOption = nameOption = null;
+ }
+ result.models = ecModel.queryComponents({
+ mainType,
+ index: indexOption,
+ id: idOption,
+ name: nameOption
+ });
+ return result;
+}
+function setAttribute(dom, key, value) {
+ dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;
+}
+function getAttribute(dom, key) {
+ return dom.getAttribute ? dom.getAttribute(key) : dom[key];
+}
+function getTooltipRenderMode(renderModeOption) {
+ if (renderModeOption === "auto") {
+ return env_default.domSupported ? "html" : "richText";
+ } else {
+ return renderModeOption || "html";
+ }
+}
+function groupData(array, getKey2) {
+ const buckets = createHashMap();
+ const keys2 = [];
+ each(array, function(item) {
+ const key = getKey2(item);
+ (buckets.get(key) || (keys2.push(key), buckets.set(key, []))).push(item);
+ });
+ return {
+ keys: keys2,
+ buckets
+ };
+}
+function interpolateRawValues(data, precision, sourceValue, targetValue, percent) {
+ const isAutoPrecision = precision == null || precision === "auto";
+ if (targetValue == null) {
+ return targetValue;
+ }
+ if (typeof targetValue === "number") {
+ const value = interpolateNumber(sourceValue || 0, targetValue, percent);
+ return round(value, isAutoPrecision ? Math.max(getPrecisionSafe(sourceValue || 0), getPrecisionSafe(targetValue)) : precision);
+ } else if (typeof targetValue === "string") {
+ return percent < 1 ? sourceValue : targetValue;
+ } else {
+ const interpolated = [];
+ const leftArr = sourceValue;
+ const rightArr = targetValue;
+ const length2 = Math.max(leftArr ? leftArr.length : 0, rightArr.length);
+ for (let i = 0; i < length2; ++i) {
+ const info = data.getDimensionInfo(i);
+ if (info.type === "ordinal") {
+ interpolated[i] = (percent < 1 && leftArr ? leftArr : rightArr)[i];
+ } else {
+ const leftVal = leftArr && leftArr[i] ? leftArr[i] : 0;
+ const rightVal = rightArr[i];
+ const value = interpolateNumber(leftVal, rightVal, percent);
+ interpolated[i] = round(value, isAutoPrecision ? Math.max(getPrecisionSafe(leftVal), getPrecisionSafe(rightVal)) : precision);
+ }
+ }
+ return interpolated;
+ }
+}
+
+// src/util/clazz.ts
+var TYPE_DELIMITER = ".";
+var IS_CONTAINER = "___EC__COMPONENT__CONTAINER___";
+var IS_EXTENDED_CLASS = "___EC__EXTENDED_CLASS___";
+function parseClassType(componentType) {
+ const ret = {main: "", sub: ""};
+ if (componentType) {
+ const typeArr = componentType.split(TYPE_DELIMITER);
+ ret.main = typeArr[0] || "";
+ ret.sub = typeArr[1] || "";
+ }
+ return ret;
+}
+function checkClassType(componentType) {
+ assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType "' + componentType + '" illegal');
+}
+function isExtendedClass(clz) {
+ return !!(clz && clz[IS_EXTENDED_CLASS]);
+}
+function enableClassExtend(rootClz, mandatoryMethods) {
+ rootClz.$constructor = rootClz;
+ rootClz.extend = function(proto2) {
+ if (__DEV__) {
+ each(mandatoryMethods, function(method) {
+ if (!proto2[method]) {
+ console.warn("Method `" + method + "` should be implemented" + (proto2.type ? " in " + proto2.type : "") + ".");
}
- var eventType = e.type;
- var isTouch = eventType && eventType.indexOf('touch') >= 0;
- if (!isTouch) {
- clientToLocal(el, e, e, calculate);
- var wheelDelta = getWheelDeltaMayPolyfill(e);
- e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;
+ });
+ }
+ const superClass = this;
+ function ExtendedClass(...args) {
+ if (!proto2.$constructor) {
+ if (!isESClass(superClass)) {
+ superClass.apply(this, arguments);
+ } else {
+ const ins = createObject(ExtendedClass.prototype, new superClass(...args));
+ return ins;
}
- else {
- var touch = eventType !== 'touchend'
- ? e.targetTouches[0]
- : e.changedTouches[0];
- touch && clientToLocal(el, touch, e, calculate);
+ } else {
+ proto2.$constructor.apply(this, arguments);
+ }
+ }
+ ExtendedClass[IS_EXTENDED_CLASS] = true;
+ extend(ExtendedClass.prototype, proto2);
+ ExtendedClass.extend = this.extend;
+ ExtendedClass.superCall = superCall;
+ ExtendedClass.superApply = superApply;
+ inherits(ExtendedClass, this);
+ ExtendedClass.superClass = superClass;
+ return ExtendedClass;
+ };
+}
+function isESClass(fn) {
+ return typeof fn === "function" && /^class\s/.test(Function.prototype.toString.call(fn));
+}
+function mountExtend(SubClz, SupperClz) {
+ SubClz.extend = SupperClz.extend;
+}
+var classBase = Math.round(Math.random() * 10);
+function enableClassCheck(target) {
+ const classAttr = ["__\0is_clz", classBase++].join("_");
+ target.prototype[classAttr] = true;
+ if (__DEV__) {
+ assert(!target.isInstance, 'The method "is" can not be defined.');
+ }
+ target.isInstance = function(obj) {
+ return !!(obj && obj[classAttr]);
+ };
+}
+function superCall(context, methodName, ...args) {
+ return this.superClass.prototype[methodName].apply(context, args);
+}
+function superApply(context, methodName, args) {
+ return this.superClass.prototype[methodName].apply(context, args);
+}
+function enableClassManagement(target) {
+ const storage2 = {};
+ target.registerClass = function(clz) {
+ const componentFullType = clz.type || clz.prototype.type;
+ if (componentFullType) {
+ checkClassType(componentFullType);
+ clz.prototype.type = componentFullType;
+ const componentTypeInfo = parseClassType(componentFullType);
+ if (!componentTypeInfo.sub) {
+ if (__DEV__) {
+ if (storage2[componentTypeInfo.main]) {
+ console.warn(componentTypeInfo.main + " exists.");
+ }
+ }
+ storage2[componentTypeInfo.main] = clz;
+ } else if (componentTypeInfo.sub !== IS_CONTAINER) {
+ const container = makeContainer(componentTypeInfo);
+ container[componentTypeInfo.sub] = clz;
+ }
+ }
+ return clz;
+ };
+ target.getClass = function(mainType, subType, throwWhenNotFound) {
+ let clz = storage2[mainType];
+ if (clz && clz[IS_CONTAINER]) {
+ clz = subType ? clz[subType] : null;
+ }
+ if (throwWhenNotFound && !clz) {
+ throw new Error(!subType ? mainType + ".type should be specified." : "Component " + mainType + "." + (subType || "") + " is used but not imported.");
+ }
+ return clz;
+ };
+ target.getClassesByMainType = function(componentType) {
+ const componentTypeInfo = parseClassType(componentType);
+ const result = [];
+ const obj = storage2[componentTypeInfo.main];
+ if (obj && obj[IS_CONTAINER]) {
+ each(obj, function(o, type) {
+ type !== IS_CONTAINER && result.push(o);
+ });
+ } else {
+ result.push(obj);
+ }
+ return result;
+ };
+ target.hasClass = function(componentType) {
+ const componentTypeInfo = parseClassType(componentType);
+ return !!storage2[componentTypeInfo.main];
+ };
+ target.getAllClassMainTypes = function() {
+ const types = [];
+ each(storage2, function(obj, type) {
+ types.push(type);
+ });
+ return types;
+ };
+ target.hasSubTypes = function(componentType) {
+ const componentTypeInfo = parseClassType(componentType);
+ const obj = storage2[componentTypeInfo.main];
+ return obj && obj[IS_CONTAINER];
+ };
+ function makeContainer(componentTypeInfo) {
+ let container = storage2[componentTypeInfo.main];
+ if (!container || !container[IS_CONTAINER]) {
+ container = storage2[componentTypeInfo.main] = {};
+ container[IS_CONTAINER] = true;
+ }
+ return container;
+ }
+}
+
+// src/model/mixin/makeStyleMapper.ts
+function makeStyleMapper(properties, ignoreParent) {
+ for (let i = 0; i < properties.length; i++) {
+ if (!properties[i][1]) {
+ properties[i][1] = properties[i][0];
+ }
+ }
+ ignoreParent = ignoreParent || false;
+ return function(model, excludes, includes) {
+ const style = {};
+ for (let i = 0; i < properties.length; i++) {
+ const propName = properties[i][1];
+ if (excludes && indexOf(excludes, propName) >= 0 || includes && indexOf(includes, propName) < 0) {
+ continue;
+ }
+ const val = model.getShallow(propName, ignoreParent);
+ if (val != null) {
+ style[properties[i][0]] = val;
+ }
+ }
+ return style;
+ };
+}
+
+// src/model/mixin/areaStyle.ts
+var AREA_STYLE_KEY_MAP = [
+ ["fill", "color"],
+ ["shadowBlur"],
+ ["shadowOffsetX"],
+ ["shadowOffsetY"],
+ ["opacity"],
+ ["shadowColor"]
+];
+var getAreaStyle = makeStyleMapper(AREA_STYLE_KEY_MAP);
+var AreaStyleMixin = class {
+ getAreaStyle(excludes, includes) {
+ return getAreaStyle(this, excludes, includes);
+ }
+};
+
+// ../zrender/src/graphic/helper/image.ts
+var globalImageCache = new LRU_default(50);
+function findExistImage(newImageOrSrc) {
+ if (typeof newImageOrSrc === "string") {
+ const cachedImgObj = globalImageCache.get(newImageOrSrc);
+ return cachedImgObj && cachedImgObj.image;
+ } else {
+ return newImageOrSrc;
+ }
+}
+function createOrUpdateImage(newImageOrSrc, image, hostEl, onload, cbPayload) {
+ if (!newImageOrSrc) {
+ return image;
+ } else if (typeof newImageOrSrc === "string") {
+ if (image && image.__zrImageSrc === newImageOrSrc || !hostEl) {
+ return image;
+ }
+ const cachedImgObj = globalImageCache.get(newImageOrSrc);
+ const pendingWrap = {hostEl, cb: onload, cbPayload};
+ if (cachedImgObj) {
+ image = cachedImgObj.image;
+ !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);
+ } else {
+ image = new Image();
+ image.onload = image.onerror = imageOnLoad;
+ globalImageCache.put(newImageOrSrc, image.__cachedImgObj = {
+ image,
+ pending: [pendingWrap]
+ });
+ image.src = image.__zrImageSrc = newImageOrSrc;
+ }
+ return image;
+ } else {
+ return newImageOrSrc;
+ }
+}
+function imageOnLoad() {
+ const cachedImgObj = this.__cachedImgObj;
+ this.onload = this.onerror = this.__cachedImgObj = null;
+ for (let i = 0; i < cachedImgObj.pending.length; i++) {
+ const pendingWrap = cachedImgObj.pending[i];
+ const cb = pendingWrap.cb;
+ cb && cb(this, pendingWrap.cbPayload);
+ pendingWrap.hostEl.dirty();
+ }
+ cachedImgObj.pending.length = 0;
+}
+function isImageReady(image) {
+ return image && image.width && image.height;
+}
+
+// ../zrender/src/graphic/helper/parseText.ts
+var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
+function truncateText(text, containerWidth, font, ellipsis, options) {
+ if (!containerWidth) {
+ return "";
+ }
+ const textLines = (text + "").split("\n");
+ options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
+ for (let i = 0, len2 = textLines.length; i < len2; i++) {
+ textLines[i] = truncateSingleLine(textLines[i], options);
+ }
+ return textLines.join("\n");
+}
+function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
+ options = options || {};
+ let preparedOpts = extend({}, options);
+ preparedOpts.font = font;
+ ellipsis = retrieve2(ellipsis, "...");
+ preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);
+ const minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);
+ preparedOpts.cnCharWidth = getWidth("\u56FD", font);
+ const ascCharWidth = preparedOpts.ascCharWidth = getWidth("a", font);
+ preparedOpts.placeholder = retrieve2(options.placeholder, "");
+ let contentWidth = containerWidth = Math.max(0, containerWidth - 1);
+ for (let i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {
+ contentWidth -= ascCharWidth;
+ }
+ let ellipsisWidth = getWidth(ellipsis, font);
+ if (ellipsisWidth > contentWidth) {
+ ellipsis = "";
+ ellipsisWidth = 0;
+ }
+ contentWidth = containerWidth - ellipsisWidth;
+ preparedOpts.ellipsis = ellipsis;
+ preparedOpts.ellipsisWidth = ellipsisWidth;
+ preparedOpts.contentWidth = contentWidth;
+ preparedOpts.containerWidth = containerWidth;
+ return preparedOpts;
+}
+function truncateSingleLine(textLine, options) {
+ const containerWidth = options.containerWidth;
+ const font = options.font;
+ const contentWidth = options.contentWidth;
+ if (!containerWidth) {
+ return "";
+ }
+ let lineWidth = getWidth(textLine, font);
+ if (lineWidth <= containerWidth) {
+ return textLine;
+ }
+ for (let j = 0; ; j++) {
+ if (lineWidth <= contentWidth || j >= options.maxIterations) {
+ textLine += options.ellipsis;
+ break;
+ }
+ const subLength = j === 0 ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth) : lineWidth > 0 ? Math.floor(textLine.length * contentWidth / lineWidth) : 0;
+ textLine = textLine.substr(0, subLength);
+ lineWidth = getWidth(textLine, font);
+ }
+ if (textLine === "") {
+ textLine = options.placeholder;
+ }
+ return textLine;
+}
+function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {
+ let width = 0;
+ let i = 0;
+ for (let len2 = text.length; i < len2 && width < contentWidth; i++) {
+ const charCode = text.charCodeAt(i);
+ width += 0 <= charCode && charCode <= 127 ? ascCharWidth : cnCharWidth;
+ }
+ return i;
+}
+function parsePlainText(text, style) {
+ text != null && (text += "");
+ const overflow = style.overflow;
+ const padding = style.padding;
+ const font = style.font;
+ const truncate = overflow === "truncate";
+ const calculatedLineHeight = getLineHeight(font);
+ const lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
+ const truncateLineOverflow = style.lineOverflow === "truncate";
+ let width = style.width;
+ let lines;
+ if (width != null && overflow === "break" || overflow === "breakAll") {
+ lines = text ? wrapText(text, style.font, width, overflow === "breakAll", 0).lines : [];
+ } else {
+ lines = text ? text.split("\n") : [];
+ }
+ const contentHeight = lines.length * lineHeight;
+ const height = retrieve2(style.height, contentHeight);
+ if (contentHeight > height && truncateLineOverflow) {
+ const lineCount = Math.floor(height / lineHeight);
+ lines = lines.slice(0, lineCount);
+ }
+ let outerHeight = height;
+ let outerWidth = width;
+ if (padding) {
+ outerHeight += padding[0] + padding[2];
+ if (outerWidth != null) {
+ outerWidth += padding[1] + padding[3];
+ }
+ }
+ if (text && truncate && outerWidth != null) {
+ const options = prepareTruncateOptions(width, font, style.ellipsis, {
+ minChar: style.truncateMinChar,
+ placeholder: style.placeholder
+ });
+ for (let i = 0; i < lines.length; i++) {
+ lines[i] = truncateSingleLine(lines[i], options);
+ }
+ }
+ if (width == null) {
+ let maxWidth = 0;
+ for (let i = 0; i < lines.length; i++) {
+ maxWidth = Math.max(getWidth(lines[i], font), maxWidth);
+ }
+ width = maxWidth;
+ }
+ return {
+ lines,
+ height,
+ outerHeight,
+ lineHeight,
+ calculatedLineHeight,
+ contentHeight,
+ width
+ };
+}
+var RichTextToken = class {
+};
+var RichTextLine = class {
+ constructor(tokens) {
+ this.tokens = [];
+ if (tokens) {
+ this.tokens = tokens;
+ }
+ }
+};
+var RichTextContentBlock = class {
+ constructor() {
+ this.width = 0;
+ this.height = 0;
+ this.contentWidth = 0;
+ this.contentHeight = 0;
+ this.outerWidth = 0;
+ this.outerHeight = 0;
+ this.lines = [];
+ }
+};
+function parseRichText(text, style) {
+ const contentBlock = new RichTextContentBlock();
+ text != null && (text += "");
+ if (!text) {
+ return contentBlock;
+ }
+ const topWidth = style.width;
+ const topHeight = style.height;
+ const overflow = style.overflow;
+ let wrapInfo = (overflow === "break" || overflow === "breakAll") && topWidth != null ? {width: topWidth, accumWidth: 0, breakAll: overflow === "breakAll"} : null;
+ let lastIndex = STYLE_REG.lastIndex = 0;
+ let result;
+ while ((result = STYLE_REG.exec(text)) != null) {
+ const matchedIndex = result.index;
+ if (matchedIndex > lastIndex) {
+ pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);
+ }
+ pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);
+ lastIndex = STYLE_REG.lastIndex;
+ }
+ if (lastIndex < text.length) {
+ pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);
+ }
+ let pendingList = [];
+ let calculatedHeight = 0;
+ let calculatedWidth = 0;
+ const stlPadding = style.padding;
+ const truncate = overflow === "truncate";
+ const truncateLine = style.lineOverflow === "truncate";
+ function finishLine(line2, lineWidth, lineHeight) {
+ line2.width = lineWidth;
+ line2.lineHeight = lineHeight;
+ calculatedHeight += lineHeight;
+ calculatedWidth = Math.max(calculatedWidth, lineWidth);
+ }
+ outer:
+ for (let i = 0; i < contentBlock.lines.length; i++) {
+ const line2 = contentBlock.lines[i];
+ let lineHeight = 0;
+ let lineWidth = 0;
+ for (let j = 0; j < line2.tokens.length; j++) {
+ const token = line2.tokens[j];
+ const tokenStyle = token.styleName && style.rich[token.styleName] || {};
+ const textPadding = token.textPadding = tokenStyle.padding;
+ const paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;
+ const font = token.font = tokenStyle.font || style.font;
+ token.contentHeight = getLineHeight(font);
+ let tokenHeight = retrieve2(tokenStyle.height, token.contentHeight);
+ token.innerHeight = tokenHeight;
+ textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
+ token.height = tokenHeight;
+ token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);
+ token.align = tokenStyle && tokenStyle.align || style.align;
+ token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || "middle";
+ if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
+ if (j > 0) {
+ line2.tokens = line2.tokens.slice(0, j);
+ finishLine(line2, lineWidth, lineHeight);
+ contentBlock.lines = contentBlock.lines.slice(0, i + 1);
+ } else {
+ contentBlock.lines = contentBlock.lines.slice(0, i);
+ }
+ break outer;
}
- var button = e.button;
- if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {
- e.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
+ let styleTokenWidth = tokenStyle.width;
+ let tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === "auto";
+ if (typeof styleTokenWidth === "string" && styleTokenWidth.charAt(styleTokenWidth.length - 1) === "%") {
+ token.percentWidth = styleTokenWidth;
+ pendingList.push(token);
+ token.contentWidth = getWidth(token.text, font);
+ } else {
+ if (tokenWidthNotSpecified) {
+ const textBackgroundColor = tokenStyle.backgroundColor;
+ let bgImg = textBackgroundColor && textBackgroundColor.image;
+ if (bgImg) {
+ bgImg = findExistImage(bgImg);
+ if (isImageReady(bgImg)) {
+ token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);
+ }
+ }
+ }
+ const remainTruncWidth = truncate && topWidth != null ? topWidth - lineWidth : null;
+ if (remainTruncWidth != null && remainTruncWidth < token.width) {
+ if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {
+ token.text = "";
+ token.width = token.contentWidth = 0;
+ } else {
+ token.text = truncateText(token.text, remainTruncWidth - paddingH, font, style.ellipsis, {minChar: style.truncateMinChar});
+ token.width = token.contentWidth = getWidth(token.text, font);
+ }
+ } else {
+ token.contentWidth = getWidth(token.text, font);
+ }
+ }
+ token.width += paddingH;
+ lineWidth += token.width;
+ tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));
+ }
+ finishLine(line2, lineWidth, lineHeight);
+ }
+ contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);
+ contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);
+ contentBlock.contentHeight = calculatedHeight;
+ contentBlock.contentWidth = calculatedWidth;
+ if (stlPadding) {
+ contentBlock.outerWidth += stlPadding[1] + stlPadding[3];
+ contentBlock.outerHeight += stlPadding[0] + stlPadding[2];
+ }
+ for (let i = 0; i < pendingList.length; i++) {
+ const token = pendingList[i];
+ const percentWidth = token.percentWidth;
+ token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;
+ }
+ return contentBlock;
+}
+function pushTokens(block, str, style, wrapInfo, styleName) {
+ const isEmptyStr = str === "";
+ const tokenStyle = styleName && style.rich[styleName] || {};
+ const lines = block.lines;
+ const font = tokenStyle.font || style.font;
+ let newLine = false;
+ let strLines;
+ let linesWidths;
+ if (wrapInfo) {
+ const tokenPadding = tokenStyle.padding;
+ let tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;
+ if (tokenStyle.width != null && tokenStyle.width !== "auto") {
+ const outerWidth = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;
+ if (lines.length > 0) {
+ if (outerWidth + wrapInfo.accumWidth > wrapInfo.width) {
+ strLines = str.split("\n");
+ newLine = true;
+ }
+ }
+ wrapInfo.accumWidth = outerWidth;
+ } else {
+ const res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);
+ wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;
+ linesWidths = res.linesWidths;
+ strLines = res.lines;
+ }
+ } else {
+ strLines = str.split("\n");
+ }
+ for (let i = 0; i < strLines.length; i++) {
+ const text = strLines[i];
+ const token = new RichTextToken();
+ token.styleName = styleName;
+ token.text = text;
+ token.isLineHolder = !text && !isEmptyStr;
+ if (typeof tokenStyle.width === "number") {
+ token.width = tokenStyle.width;
+ } else {
+ token.width = linesWidths ? linesWidths[i] : getWidth(text, font);
+ }
+ if (!i && !newLine) {
+ const tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;
+ const tokensLen = tokens.length;
+ tokensLen === 1 && tokens[0].isLineHolder ? tokens[0] = token : (text || !tokensLen || isEmptyStr) && tokens.push(token);
+ } else {
+ lines.push(new RichTextLine([token]));
+ }
+ }
+}
+function isLatin(ch) {
+ let code = ch.charCodeAt(0);
+ return code >= 33 && code <= 255;
+}
+var breakCharMap = reduce(",&?/;] ".split(""), function(obj, ch) {
+ obj[ch] = true;
+ return obj;
+}, {});
+function isWordBreakChar(ch) {
+ if (isLatin(ch)) {
+ if (breakCharMap[ch]) {
+ return true;
+ }
+ return false;
+ }
+ return true;
+}
+function wrapText(text, font, lineWidth, isBreakAll, lastAccumWidth) {
+ let lines = [];
+ let linesWidths = [];
+ let line2 = "";
+ let currentWord = "";
+ let currentWordWidth = 0;
+ let accumWidth = 0;
+ for (let i = 0; i < text.length; i++) {
+ const ch = text.charAt(i);
+ if (ch === "\n") {
+ if (currentWord) {
+ line2 += currentWord;
+ accumWidth += currentWordWidth;
+ }
+ lines.push(line2);
+ linesWidths.push(accumWidth);
+ line2 = "";
+ currentWord = "";
+ currentWordWidth = 0;
+ accumWidth = 0;
+ continue;
+ }
+ const chWidth = getWidth(ch, font);
+ const inWord = isBreakAll ? false : !isWordBreakChar(ch);
+ if (!lines.length ? lastAccumWidth + accumWidth + chWidth > lineWidth : accumWidth + chWidth > lineWidth) {
+ if (!accumWidth) {
+ if (inWord) {
+ lines.push(currentWord);
+ linesWidths.push(currentWordWidth);
+ currentWord = ch;
+ currentWordWidth = chWidth;
+ } else {
+ lines.push(ch);
+ linesWidths.push(chWidth);
+ }
+ } else if (line2 || currentWord) {
+ if (inWord) {
+ if (!line2) {
+ line2 = currentWord;
+ currentWord = "";
+ currentWordWidth = 0;
+ accumWidth = currentWordWidth;
+ }
+ lines.push(line2);
+ linesWidths.push(accumWidth - currentWordWidth);
+ currentWord += ch;
+ currentWordWidth += chWidth;
+ line2 = "";
+ accumWidth = currentWordWidth;
+ } else {
+ if (currentWord) {
+ line2 += currentWord;
+ accumWidth += currentWordWidth;
+ currentWord = "";
+ currentWordWidth = 0;
+ }
+ lines.push(line2);
+ linesWidths.push(accumWidth);
+ line2 = ch;
+ accumWidth = chWidth;
+ }
+ }
+ continue;
+ }
+ accumWidth += chWidth;
+ if (inWord) {
+ currentWord += ch;
+ currentWordWidth += chWidth;
+ } else {
+ if (currentWord) {
+ line2 += currentWord;
+ currentWord = "";
+ currentWordWidth = 0;
+ }
+ line2 += ch;
+ }
+ }
+ if (!lines.length && !line2) {
+ line2 = text;
+ currentWord = "";
+ currentWordWidth = 0;
+ }
+ if (currentWord) {
+ line2 += currentWord;
+ }
+ if (line2) {
+ lines.push(line2);
+ linesWidths.push(accumWidth);
+ }
+ if (lines.length === 1) {
+ accumWidth += lastAccumWidth;
+ }
+ return {
+ accumWidth,
+ lines,
+ linesWidths
+ };
+}
+
+// ../zrender/src/graphic/Displayable.ts
+var STYLE_MAGIC_KEY = "__zr_style_" + Math.round(Math.random() * 10);
+var DEFAULT_COMMON_STYLE = {
+ shadowBlur: 0,
+ shadowOffsetX: 0,
+ shadowOffsetY: 0,
+ shadowColor: "#000",
+ opacity: 1,
+ blend: "source-over"
+};
+var DEFAULT_COMMON_ANIMATION_PROPS = {
+ style: {
+ shadowBlur: true,
+ shadowOffsetX: true,
+ shadowOffsetY: true,
+ shadowColor: true,
+ opacity: true
+ }
+};
+DEFAULT_COMMON_STYLE[STYLE_MAGIC_KEY] = true;
+var PRIMARY_STATES_KEYS2 = ["z", "z2", "invisible"];
+var Displayable2 = class extends Element_default {
+ constructor(props) {
+ super(props);
+ }
+ _init(props) {
+ const keysArr = keys(props);
+ for (let i = 0; i < keysArr.length; i++) {
+ const key = keysArr[i];
+ if (key === "style") {
+ this.useStyle(props[key]);
+ } else {
+ super.attrKV(key, props[key]);
+ }
+ }
+ if (!this.style) {
+ this.useStyle({});
+ }
+ }
+ beforeBrush() {
+ }
+ afterBrush() {
+ }
+ innerBeforeBrush() {
+ }
+ innerAfterBrush() {
+ }
+ shouldBePainted(viewWidth, viewHeight, considerClipPath, considerAncestors) {
+ const m2 = this.transform;
+ if (this.ignore || this.invisible || this.style.opacity === 0 || this.culling && isDisplayableCulled(this, viewWidth, viewHeight) || m2 && !m2[0] && !m2[3]) {
+ return false;
+ }
+ if (considerClipPath && this.__clipPaths) {
+ for (let i = 0; i < this.__clipPaths.length; ++i) {
+ if (this.__clipPaths[i].isZeroArea()) {
+ return false;
}
- return e;
+ }
}
- function getWheelDeltaMayPolyfill(e) {
- var rawWheelDelta = e.wheelDelta;
- if (rawWheelDelta) {
- return rawWheelDelta;
+ if (considerAncestors && this.parent) {
+ let parent = this.parent;
+ while (parent) {
+ if (parent.ignore) {
+ return false;
}
- var deltaX = e.deltaX;
- var deltaY = e.deltaY;
- if (deltaX == null || deltaY == null) {
- return rawWheelDelta;
+ parent = parent.parent;
+ }
+ }
+ return true;
+ }
+ contain(x, y) {
+ return this.rectContain(x, y);
+ }
+ traverse(cb, context) {
+ cb.call(context, this);
+ }
+ rectContain(x, y) {
+ const coord = this.transformCoordToLocal(x, y);
+ const rect = this.getBoundingRect();
+ return rect.contain(coord[0], coord[1]);
+ }
+ getPaintRect() {
+ let rect = this._paintRect;
+ if (!this._paintRect || this.__dirty) {
+ const transform2 = this.transform;
+ const elRect = this.getBoundingRect();
+ const style = this.style;
+ const shadowSize = style.shadowBlur || 0;
+ const shadowOffsetX = style.shadowOffsetX || 0;
+ const shadowOffsetY = style.shadowOffsetY || 0;
+ rect = this._paintRect || (this._paintRect = new BoundingRect_default(0, 0, 0, 0));
+ if (transform2) {
+ BoundingRect_default.applyTransform(rect, elRect, transform2);
+ } else {
+ rect.copy(elRect);
+ }
+ if (shadowSize || shadowOffsetX || shadowOffsetY) {
+ rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);
+ rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);
+ rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);
+ rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);
+ }
+ const tolerance = this.dirtyRectTolerance;
+ if (!rect.isZero()) {
+ rect.x = Math.floor(rect.x - tolerance);
+ rect.y = Math.floor(rect.y - tolerance);
+ rect.width = Math.ceil(rect.width + 1 + tolerance * 2);
+ rect.height = Math.ceil(rect.height + 1 + tolerance * 2);
+ }
+ }
+ return rect;
+ }
+ setPrevPaintRect(paintRect) {
+ if (paintRect) {
+ this._prevPaintRect = this._prevPaintRect || new BoundingRect_default(0, 0, 0, 0);
+ this._prevPaintRect.copy(paintRect);
+ } else {
+ this._prevPaintRect = null;
+ }
+ }
+ getPrevPaintRect() {
+ return this._prevPaintRect;
+ }
+ animateStyle(loop) {
+ return this.animate("style", loop);
+ }
+ updateDuringAnimation(targetKey) {
+ if (targetKey === "style") {
+ this.dirtyStyle();
+ } else {
+ this.markRedraw();
+ }
+ }
+ attrKV(key, value) {
+ if (key !== "style") {
+ super.attrKV(key, value);
+ } else {
+ if (!this.style) {
+ this.useStyle(value);
+ } else {
+ this.setStyle(value);
+ }
+ }
+ }
+ setStyle(keyOrObj, value) {
+ if (typeof keyOrObj === "string") {
+ this.style[keyOrObj] = value;
+ } else {
+ extend(this.style, keyOrObj);
+ }
+ this.dirtyStyle();
+ return this;
+ }
+ dirtyStyle() {
+ this.markRedraw();
+ this.__dirty |= Displayable2.STYLE_CHANGED_BIT;
+ if (this._rect) {
+ this._rect = null;
+ }
+ }
+ dirty() {
+ this.dirtyStyle();
+ }
+ styleChanged() {
+ return !!(this.__dirty & Displayable2.STYLE_CHANGED_BIT);
+ }
+ styleUpdated() {
+ this.__dirty &= ~Displayable2.STYLE_CHANGED_BIT;
+ }
+ createStyle(obj) {
+ return createObject(DEFAULT_COMMON_STYLE, obj);
+ }
+ useStyle(obj) {
+ if (!obj[STYLE_MAGIC_KEY]) {
+ obj = this.createStyle(obj);
+ }
+ if (this.__inHover) {
+ this.__hoverStyle = obj;
+ } else {
+ this.style = obj;
+ }
+ this.dirtyStyle();
+ }
+ isStyleObject(obj) {
+ return obj[STYLE_MAGIC_KEY];
+ }
+ _innerSaveToNormal(toState) {
+ super._innerSaveToNormal(toState);
+ const normalState = this._normalState;
+ if (toState.style && !normalState.style) {
+ normalState.style = this._mergeStyle(this.createStyle(), this.style);
+ }
+ this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS2);
+ }
+ _applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg) {
+ super._applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg);
+ const needsRestoreToNormal = !(state && keepCurrentStates);
+ let targetStyle;
+ if (state && state.style) {
+ if (transition) {
+ if (keepCurrentStates) {
+ targetStyle = state.style;
+ } else {
+ targetStyle = this._mergeStyle(this.createStyle(), normalState.style);
+ this._mergeStyle(targetStyle, state.style);
}
- var delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);
- var sign = deltaY > 0 ? -1
- : deltaY < 0 ? 1
- : deltaX > 0 ? -1
- : 1;
- return 3 * delta * sign;
- }
- function addEventListener(el, name, handler, opt) {
- if (isDomLevel2) {
- el.addEventListener(name, handler, opt);
+ } else {
+ targetStyle = this._mergeStyle(this.createStyle(), keepCurrentStates ? this.style : normalState.style);
+ this._mergeStyle(targetStyle, state.style);
+ }
+ } else if (needsRestoreToNormal) {
+ targetStyle = normalState.style;
+ }
+ if (targetStyle) {
+ if (transition) {
+ const sourceStyle = this.style;
+ this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);
+ if (needsRestoreToNormal) {
+ const changedKeys = keys(sourceStyle);
+ for (let i = 0; i < changedKeys.length; i++) {
+ const key = changedKeys[i];
+ if (key in targetStyle) {
+ targetStyle[key] = targetStyle[key];
+ this.style[key] = sourceStyle[key];
+ }
+ }
+ }
+ const targetKeys = keys(targetStyle);
+ for (let i = 0; i < targetKeys.length; i++) {
+ const key = targetKeys[i];
+ this.style[key] = this.style[key];
+ }
+ this._transitionState(stateName, {
+ style: targetStyle
+ }, animationCfg, this.getAnimationStyleProps());
+ } else {
+ this.useStyle(targetStyle);
+ }
+ }
+ for (let i = 0; i < PRIMARY_STATES_KEYS2.length; i++) {
+ let key = PRIMARY_STATES_KEYS2[i];
+ if (state && state[key] != null) {
+ this[key] = state[key];
+ } else if (needsRestoreToNormal) {
+ if (normalState[key] != null) {
+ this[key] = normalState[key];
+ }
+ }
+ }
+ }
+ _mergeStates(states) {
+ const mergedState = super._mergeStates(states);
+ let mergedStyle;
+ for (let i = 0; i < states.length; i++) {
+ const state = states[i];
+ if (state.style) {
+ mergedStyle = mergedStyle || {};
+ this._mergeStyle(mergedStyle, state.style);
+ }
+ }
+ if (mergedStyle) {
+ mergedState.style = mergedStyle;
+ }
+ return mergedState;
+ }
+ _mergeStyle(targetStyle, sourceStyle) {
+ extend(targetStyle, sourceStyle);
+ return targetStyle;
+ }
+ getAnimationStyleProps() {
+ return DEFAULT_COMMON_ANIMATION_PROPS;
+ }
+};
+var Displayable = Displayable2;
+Displayable.STYLE_CHANGED_BIT = 2;
+Displayable.initDefaultProps = function() {
+ const dispProto = Displayable2.prototype;
+ dispProto.type = "displayable";
+ dispProto.invisible = false;
+ dispProto.z = 0;
+ dispProto.z2 = 0;
+ dispProto.zlevel = 0;
+ dispProto.culling = false;
+ dispProto.cursor = "pointer";
+ dispProto.rectHover = false;
+ dispProto.incremental = false;
+ dispProto._rect = null;
+ dispProto.dirtyRectTolerance = 0;
+ dispProto.__dirty = Element_default.REDARAW_BIT | Displayable2.STYLE_CHANGED_BIT;
+}();
+var tmpRect = new BoundingRect_default(0, 0, 0, 0);
+var viewRect = new BoundingRect_default(0, 0, 0, 0);
+function isDisplayableCulled(el, width, height) {
+ tmpRect.copy(el.getBoundingRect());
+ if (el.transform) {
+ tmpRect.applyTransform(el.transform);
+ }
+ viewRect.width = width;
+ viewRect.height = height;
+ return !tmpRect.intersect(viewRect);
+}
+var Displayable_default = Displayable;
+
+// ../zrender/src/core/curve.ts
+var mathPow = Math.pow;
+var mathSqrt = Math.sqrt;
+var EPSILON2 = 1e-8;
+var EPSILON_NUMERIC = 1e-4;
+var THREE_SQRT = mathSqrt(3);
+var ONE_THIRD = 1 / 3;
+var _v0 = create();
+var _v1 = create();
+var _v2 = create();
+function isAroundZero(val) {
+ return val > -EPSILON2 && val < EPSILON2;
+}
+function isNotAroundZero2(val) {
+ return val > EPSILON2 || val < -EPSILON2;
+}
+function cubicAt(p0, p1, p2, p3, t) {
+ const onet = 1 - t;
+ return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
+}
+function cubicDerivativeAt(p0, p1, p2, p3, t) {
+ const onet = 1 - t;
+ return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet + (p3 - p2) * t * t);
+}
+function cubicRootAt(p0, p1, p2, p3, val, roots2) {
+ const a = p3 + 3 * (p1 - p2) - p0;
+ const b = 3 * (p2 - p1 * 2 + p0);
+ const c = 3 * (p1 - p0);
+ const d = p0 - val;
+ const A = b * b - 3 * a * c;
+ const B = b * c - 9 * a * d;
+ const C = c * c - 3 * b * d;
+ let n = 0;
+ if (isAroundZero(A) && isAroundZero(B)) {
+ if (isAroundZero(b)) {
+ roots2[0] = 0;
+ } else {
+ const t1 = -c / b;
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ }
+ } else {
+ const disc = B * B - 4 * A * C;
+ if (isAroundZero(disc)) {
+ const K = B / A;
+ const t1 = -b / a + K;
+ const t2 = -K / 2;
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ if (t2 >= 0 && t2 <= 1) {
+ roots2[n++] = t2;
+ }
+ } else if (disc > 0) {
+ const discSqrt = mathSqrt(disc);
+ let Y1 = A * b + 1.5 * a * (-B + discSqrt);
+ let Y2 = A * b + 1.5 * a * (-B - discSqrt);
+ if (Y1 < 0) {
+ Y1 = -mathPow(-Y1, ONE_THIRD);
+ } else {
+ Y1 = mathPow(Y1, ONE_THIRD);
+ }
+ if (Y2 < 0) {
+ Y2 = -mathPow(-Y2, ONE_THIRD);
+ } else {
+ Y2 = mathPow(Y2, ONE_THIRD);
+ }
+ const t1 = (-b - (Y1 + Y2)) / (3 * a);
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ } else {
+ const T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));
+ const theta = Math.acos(T) / 3;
+ const ASqrt = mathSqrt(A);
+ const tmp = Math.cos(theta);
+ const t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
+ const t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);
+ const t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ if (t2 >= 0 && t2 <= 1) {
+ roots2[n++] = t2;
+ }
+ if (t3 >= 0 && t3 <= 1) {
+ roots2[n++] = t3;
+ }
+ }
+ }
+ return n;
+}
+function cubicExtrema(p0, p1, p2, p3, extrema2) {
+ const b = 6 * p2 - 12 * p1 + 6 * p0;
+ const a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
+ const c = 3 * p1 - 3 * p0;
+ let n = 0;
+ if (isAroundZero(a)) {
+ if (isNotAroundZero2(b)) {
+ const t1 = -c / b;
+ if (t1 >= 0 && t1 <= 1) {
+ extrema2[n++] = t1;
+ }
+ }
+ } else {
+ const disc = b * b - 4 * a * c;
+ if (isAroundZero(disc)) {
+ extrema2[0] = -b / (2 * a);
+ } else if (disc > 0) {
+ const discSqrt = mathSqrt(disc);
+ const t1 = (-b + discSqrt) / (2 * a);
+ const t2 = (-b - discSqrt) / (2 * a);
+ if (t1 >= 0 && t1 <= 1) {
+ extrema2[n++] = t1;
+ }
+ if (t2 >= 0 && t2 <= 1) {
+ extrema2[n++] = t2;
+ }
+ }
+ }
+ return n;
+}
+function cubicSubdivide(p0, p1, p2, p3, t, out2) {
+ const p01 = (p1 - p0) * t + p0;
+ const p12 = (p2 - p1) * t + p1;
+ const p23 = (p3 - p2) * t + p2;
+ const p012 = (p12 - p01) * t + p01;
+ const p123 = (p23 - p12) * t + p12;
+ const p0123 = (p123 - p012) * t + p012;
+ out2[0] = p0;
+ out2[1] = p01;
+ out2[2] = p012;
+ out2[3] = p0123;
+ out2[4] = p0123;
+ out2[5] = p123;
+ out2[6] = p23;
+ out2[7] = p3;
+}
+function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out2) {
+ let t;
+ let interval = 5e-3;
+ let d = Infinity;
+ let prev;
+ let next;
+ let d1;
+ let d2;
+ _v0[0] = x;
+ _v0[1] = y;
+ for (let _t = 0; _t < 1; _t += 0.05) {
+ _v1[0] = cubicAt(x0, x1, x2, x3, _t);
+ _v1[1] = cubicAt(y0, y1, y2, y3, _t);
+ d1 = distSquare(_v0, _v1);
+ if (d1 < d) {
+ t = _t;
+ d = d1;
+ }
+ }
+ d = Infinity;
+ for (let i = 0; i < 32; i++) {
+ if (interval < EPSILON_NUMERIC) {
+ break;
+ }
+ prev = t - interval;
+ next = t + interval;
+ _v1[0] = cubicAt(x0, x1, x2, x3, prev);
+ _v1[1] = cubicAt(y0, y1, y2, y3, prev);
+ d1 = distSquare(_v1, _v0);
+ if (prev >= 0 && d1 < d) {
+ t = prev;
+ d = d1;
+ } else {
+ _v2[0] = cubicAt(x0, x1, x2, x3, next);
+ _v2[1] = cubicAt(y0, y1, y2, y3, next);
+ d2 = distSquare(_v2, _v0);
+ if (next <= 1 && d2 < d) {
+ t = next;
+ d = d2;
+ } else {
+ interval *= 0.5;
+ }
+ }
+ }
+ if (out2) {
+ out2[0] = cubicAt(x0, x1, x2, x3, t);
+ out2[1] = cubicAt(y0, y1, y2, y3, t);
+ }
+ return mathSqrt(d);
+}
+function cubicLength(x0, y0, x1, y1, x2, y2, x3, y3, iteration) {
+ let px = x0;
+ let py = y0;
+ let d = 0;
+ const step2 = 1 / iteration;
+ for (let i = 1; i <= iteration; i++) {
+ let t = i * step2;
+ const x = cubicAt(x0, x1, x2, x3, t);
+ const y = cubicAt(y0, y1, y2, y3, t);
+ const dx = x - px;
+ const dy = y - py;
+ d += Math.sqrt(dx * dx + dy * dy);
+ px = x;
+ py = y;
+ }
+ return d;
+}
+function quadraticAt(p0, p1, p2, t) {
+ const onet = 1 - t;
+ return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
+}
+function quadraticDerivativeAt(p0, p1, p2, t) {
+ return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
+}
+function quadraticRootAt(p0, p1, p2, val, roots2) {
+ const a = p0 - 2 * p1 + p2;
+ const b = 2 * (p1 - p0);
+ const c = p0 - val;
+ let n = 0;
+ if (isAroundZero(a)) {
+ if (isNotAroundZero2(b)) {
+ const t1 = -c / b;
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ }
+ } else {
+ const disc = b * b - 4 * a * c;
+ if (isAroundZero(disc)) {
+ const t1 = -b / (2 * a);
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ } else if (disc > 0) {
+ const discSqrt = mathSqrt(disc);
+ const t1 = (-b + discSqrt) / (2 * a);
+ const t2 = (-b - discSqrt) / (2 * a);
+ if (t1 >= 0 && t1 <= 1) {
+ roots2[n++] = t1;
+ }
+ if (t2 >= 0 && t2 <= 1) {
+ roots2[n++] = t2;
+ }
+ }
+ }
+ return n;
+}
+function quadraticExtremum(p0, p1, p2) {
+ const divider = p0 + p2 - 2 * p1;
+ if (divider === 0) {
+ return 0.5;
+ } else {
+ return (p0 - p1) / divider;
+ }
+}
+function quadraticSubdivide(p0, p1, p2, t, out2) {
+ const p01 = (p1 - p0) * t + p0;
+ const p12 = (p2 - p1) * t + p1;
+ const p012 = (p12 - p01) * t + p01;
+ out2[0] = p0;
+ out2[1] = p01;
+ out2[2] = p012;
+ out2[3] = p012;
+ out2[4] = p12;
+ out2[5] = p2;
+}
+function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out2) {
+ let t;
+ let interval = 5e-3;
+ let d = Infinity;
+ _v0[0] = x;
+ _v0[1] = y;
+ for (let _t = 0; _t < 1; _t += 0.05) {
+ _v1[0] = quadraticAt(x0, x1, x2, _t);
+ _v1[1] = quadraticAt(y0, y1, y2, _t);
+ const d1 = distSquare(_v0, _v1);
+ if (d1 < d) {
+ t = _t;
+ d = d1;
+ }
+ }
+ d = Infinity;
+ for (let i = 0; i < 32; i++) {
+ if (interval < EPSILON_NUMERIC) {
+ break;
+ }
+ const prev = t - interval;
+ const next = t + interval;
+ _v1[0] = quadraticAt(x0, x1, x2, prev);
+ _v1[1] = quadraticAt(y0, y1, y2, prev);
+ const d1 = distSquare(_v1, _v0);
+ if (prev >= 0 && d1 < d) {
+ t = prev;
+ d = d1;
+ } else {
+ _v2[0] = quadraticAt(x0, x1, x2, next);
+ _v2[1] = quadraticAt(y0, y1, y2, next);
+ const d2 = distSquare(_v2, _v0);
+ if (next <= 1 && d2 < d) {
+ t = next;
+ d = d2;
+ } else {
+ interval *= 0.5;
+ }
+ }
+ }
+ if (out2) {
+ out2[0] = quadraticAt(x0, x1, x2, t);
+ out2[1] = quadraticAt(y0, y1, y2, t);
+ }
+ return mathSqrt(d);
+}
+function quadraticLength(x0, y0, x1, y1, x2, y2, iteration) {
+ let px = x0;
+ let py = y0;
+ let d = 0;
+ const step2 = 1 / iteration;
+ for (let i = 1; i <= iteration; i++) {
+ let t = i * step2;
+ const x = quadraticAt(x0, x1, x2, t);
+ const y = quadraticAt(y0, y1, y2, t);
+ const dx = x - px;
+ const dy = y - py;
+ d += Math.sqrt(dx * dx + dy * dy);
+ px = x;
+ py = y;
+ }
+ return d;
+}
+
+// ../zrender/src/core/bbox.ts
+var mathMin2 = Math.min;
+var mathMax2 = Math.max;
+var mathSin = Math.sin;
+var mathCos = Math.cos;
+var PI2 = Math.PI * 2;
+var start = create();
+var end = create();
+var extremity = create();
+function fromPoints(points4, min3, max3) {
+ if (points4.length === 0) {
+ return;
+ }
+ let p = points4[0];
+ let left = p[0];
+ let right = p[0];
+ let top = p[1];
+ let bottom = p[1];
+ for (let i = 1; i < points4.length; i++) {
+ p = points4[i];
+ left = mathMin2(left, p[0]);
+ right = mathMax2(right, p[0]);
+ top = mathMin2(top, p[1]);
+ bottom = mathMax2(bottom, p[1]);
+ }
+ min3[0] = left;
+ min3[1] = top;
+ max3[0] = right;
+ max3[1] = bottom;
+}
+function fromLine(x0, y0, x1, y1, min3, max3) {
+ min3[0] = mathMin2(x0, x1);
+ min3[1] = mathMin2(y0, y1);
+ max3[0] = mathMax2(x0, x1);
+ max3[1] = mathMax2(y0, y1);
+}
+var xDim = [];
+var yDim = [];
+function fromCubic(x0, y0, x1, y1, x2, y2, x3, y3, min3, max3) {
+ const cubicExtrema2 = cubicExtrema;
+ const cubicAt2 = cubicAt;
+ let n = cubicExtrema2(x0, x1, x2, x3, xDim);
+ min3[0] = Infinity;
+ min3[1] = Infinity;
+ max3[0] = -Infinity;
+ max3[1] = -Infinity;
+ for (let i = 0; i < n; i++) {
+ const x = cubicAt2(x0, x1, x2, x3, xDim[i]);
+ min3[0] = mathMin2(x, min3[0]);
+ max3[0] = mathMax2(x, max3[0]);
+ }
+ n = cubicExtrema2(y0, y1, y2, y3, yDim);
+ for (let i = 0; i < n; i++) {
+ const y = cubicAt2(y0, y1, y2, y3, yDim[i]);
+ min3[1] = mathMin2(y, min3[1]);
+ max3[1] = mathMax2(y, max3[1]);
+ }
+ min3[0] = mathMin2(x0, min3[0]);
+ max3[0] = mathMax2(x0, max3[0]);
+ min3[0] = mathMin2(x3, min3[0]);
+ max3[0] = mathMax2(x3, max3[0]);
+ min3[1] = mathMin2(y0, min3[1]);
+ max3[1] = mathMax2(y0, max3[1]);
+ min3[1] = mathMin2(y3, min3[1]);
+ max3[1] = mathMax2(y3, max3[1]);
+}
+function fromQuadratic(x0, y0, x1, y1, x2, y2, min3, max3) {
+ const quadraticExtremum2 = quadraticExtremum;
+ const quadraticAt3 = quadraticAt;
+ const tx = mathMax2(mathMin2(quadraticExtremum2(x0, x1, x2), 1), 0);
+ const ty = mathMax2(mathMin2(quadraticExtremum2(y0, y1, y2), 1), 0);
+ const x = quadraticAt3(x0, x1, x2, tx);
+ const y = quadraticAt3(y0, y1, y2, ty);
+ min3[0] = mathMin2(x0, x2, x);
+ min3[1] = mathMin2(y0, y2, y);
+ max3[0] = mathMax2(x0, x2, x);
+ max3[1] = mathMax2(y0, y2, y);
+}
+function fromArc(x, y, rx, ry, startAngle, endAngle, anticlockwise, min3, max3) {
+ const vec2Min = min;
+ const vec2Max = max;
+ const diff2 = Math.abs(startAngle - endAngle);
+ if (diff2 % PI2 < 1e-4 && diff2 > 1e-4) {
+ min3[0] = x - rx;
+ min3[1] = y - ry;
+ max3[0] = x + rx;
+ max3[1] = y + ry;
+ return;
+ }
+ start[0] = mathCos(startAngle) * rx + x;
+ start[1] = mathSin(startAngle) * ry + y;
+ end[0] = mathCos(endAngle) * rx + x;
+ end[1] = mathSin(endAngle) * ry + y;
+ vec2Min(min3, start, end);
+ vec2Max(max3, start, end);
+ startAngle = startAngle % PI2;
+ if (startAngle < 0) {
+ startAngle = startAngle + PI2;
+ }
+ endAngle = endAngle % PI2;
+ if (endAngle < 0) {
+ endAngle = endAngle + PI2;
+ }
+ if (startAngle > endAngle && !anticlockwise) {
+ endAngle += PI2;
+ } else if (startAngle < endAngle && anticlockwise) {
+ startAngle += PI2;
+ }
+ if (anticlockwise) {
+ const tmp = endAngle;
+ endAngle = startAngle;
+ startAngle = tmp;
+ }
+ for (let angle = 0; angle < endAngle; angle += Math.PI / 2) {
+ if (angle > startAngle) {
+ extremity[0] = mathCos(angle) * rx + x;
+ extremity[1] = mathSin(angle) * ry + y;
+ vec2Min(min3, extremity, min3);
+ vec2Max(max3, extremity, max3);
+ }
+ }
+}
+
+// ../zrender/src/core/PathProxy.ts
+var CMD = {
+ M: 1,
+ L: 2,
+ C: 3,
+ Q: 4,
+ A: 5,
+ Z: 6,
+ R: 7
+};
+var tmpOutX = [];
+var tmpOutY = [];
+var min2 = [];
+var max2 = [];
+var min22 = [];
+var max22 = [];
+var mathMin3 = Math.min;
+var mathMax3 = Math.max;
+var mathCos2 = Math.cos;
+var mathSin2 = Math.sin;
+var mathSqrt2 = Math.sqrt;
+var mathAbs = Math.abs;
+var PI = Math.PI;
+var PI22 = PI * 2;
+var hasTypedArray = typeof Float32Array !== "undefined";
+var tmpAngles = [];
+function modPI2(radian) {
+ const n = Math.round(radian / PI * 1e8) / 1e8;
+ return n % 2 * PI;
+}
+function normalizeArcAngles(angles, anticlockwise) {
+ let newStartAngle = modPI2(angles[0]);
+ if (newStartAngle < 0) {
+ newStartAngle += PI22;
+ }
+ let delta = newStartAngle - angles[0];
+ let newEndAngle = angles[1];
+ newEndAngle += delta;
+ if (!anticlockwise && newEndAngle - newStartAngle >= PI22) {
+ newEndAngle = newStartAngle + PI22;
+ } else if (anticlockwise && newStartAngle - newEndAngle >= PI22) {
+ newEndAngle = newStartAngle - PI22;
+ } else if (!anticlockwise && newStartAngle > newEndAngle) {
+ newEndAngle = newStartAngle + (PI22 - modPI2(newStartAngle - newEndAngle));
+ } else if (anticlockwise && newStartAngle < newEndAngle) {
+ newEndAngle = newStartAngle - (PI22 - modPI2(newEndAngle - newStartAngle));
+ }
+ angles[0] = newStartAngle;
+ angles[1] = newEndAngle;
+}
+var PathProxy2 = class {
+ constructor(notSaveData) {
+ this.dpr = 1;
+ this._version = 0;
+ this._xi = 0;
+ this._yi = 0;
+ this._x0 = 0;
+ this._y0 = 0;
+ this._len = 0;
+ if (notSaveData) {
+ this._saveData = false;
+ }
+ if (this._saveData) {
+ this.data = [];
+ }
+ }
+ increaseVersion() {
+ this._version++;
+ }
+ getVersion() {
+ return this._version;
+ }
+ setScale(sx, sy, segmentIgnoreThreshold) {
+ segmentIgnoreThreshold = segmentIgnoreThreshold || 0;
+ if (segmentIgnoreThreshold > 0) {
+ this._ux = mathAbs(segmentIgnoreThreshold / devicePixelRatio / sx) || 0;
+ this._uy = mathAbs(segmentIgnoreThreshold / devicePixelRatio / sy) || 0;
+ }
+ }
+ setDPR(dpr2) {
+ this.dpr = dpr2;
+ }
+ setContext(ctx) {
+ this._ctx = ctx;
+ }
+ getContext() {
+ return this._ctx;
+ }
+ beginPath() {
+ this._ctx && this._ctx.beginPath();
+ this.reset();
+ return this;
+ }
+ reset() {
+ if (this._saveData) {
+ this._len = 0;
+ }
+ if (this._lineDash) {
+ this._lineDash = null;
+ this._dashOffset = 0;
+ }
+ if (this._pathSegLen) {
+ this._pathSegLen = null;
+ this._pathLen = 0;
+ }
+ this._version++;
+ }
+ moveTo(x, y) {
+ this.addData(CMD.M, x, y);
+ this._ctx && this._ctx.moveTo(x, y);
+ this._x0 = x;
+ this._y0 = y;
+ this._xi = x;
+ this._yi = y;
+ return this;
+ }
+ lineTo(x, y) {
+ const exceedUnit = mathAbs(x - this._xi) > this._ux || mathAbs(y - this._yi) > this._uy || this._len < 5;
+ this.addData(CMD.L, x, y);
+ if (this._ctx && exceedUnit) {
+ this._needsDash ? this._dashedLineTo(x, y) : this._ctx.lineTo(x, y);
+ }
+ if (exceedUnit) {
+ this._xi = x;
+ this._yi = y;
+ }
+ return this;
+ }
+ bezierCurveTo(x1, y1, x2, y2, x3, y3) {
+ this.addData(CMD.C, x1, y1, x2, y2, x3, y3);
+ if (this._ctx) {
+ this._needsDash ? this._dashedBezierTo(x1, y1, x2, y2, x3, y3) : this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
+ }
+ this._xi = x3;
+ this._yi = y3;
+ return this;
+ }
+ quadraticCurveTo(x1, y1, x2, y2) {
+ this.addData(CMD.Q, x1, y1, x2, y2);
+ if (this._ctx) {
+ this._needsDash ? this._dashedQuadraticTo(x1, y1, x2, y2) : this._ctx.quadraticCurveTo(x1, y1, x2, y2);
+ }
+ this._xi = x2;
+ this._yi = y2;
+ return this;
+ }
+ arc(cx, cy, r, startAngle, endAngle, anticlockwise) {
+ tmpAngles[0] = startAngle;
+ tmpAngles[1] = endAngle;
+ normalizeArcAngles(tmpAngles, anticlockwise);
+ startAngle = tmpAngles[0];
+ endAngle = tmpAngles[1];
+ let delta = endAngle - startAngle;
+ this.addData(CMD.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1);
+ this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);
+ this._xi = mathCos2(endAngle) * r + cx;
... 148321 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org