@visactor/vutils 0.15.10 → 0.15.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/math.d.ts +3 -0
- package/cjs/math.js +16 -2
- package/cjs/math.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.min.js +1 -1
- package/es/math.d.ts +3 -0
- package/es/math.js +13 -0
- package/es/math.js.map +1 -1
- package/package.json +1 -1
package/cjs/math.d.ts
CHANGED
|
@@ -64,3 +64,6 @@ export declare function crossProductPoint(dir1: {
|
|
|
64
64
|
export declare function fuzzyEqualNumber(a: number, b: number): boolean;
|
|
65
65
|
export declare function fuzzyEqualVec(a: vec2, b: vec2): boolean;
|
|
66
66
|
export declare function fixPrecision(num: number, precision?: number): number;
|
|
67
|
+
export declare function getDecimalPlaces(n: number): number;
|
|
68
|
+
export declare function precisionAdd(a: number, b: number): number;
|
|
69
|
+
export declare function precisionSub(a: number, b: number): number;
|
package/cjs/math.js
CHANGED
|
@@ -42,9 +42,22 @@ function fixPrecision(num, precision = 10) {
|
|
|
42
42
|
return Math.round(num * precision) / precision;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function getDecimalPlaces(n) {
|
|
46
|
+
const dStr = n.toString().split(/[eE]/), s = (dStr[0].split(".")[1] || "").length - (+dStr[1] || 0);
|
|
47
|
+
return s > 0 ? s : 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function precisionAdd(a, b) {
|
|
51
|
+
return fixPrecision(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function precisionSub(a, b) {
|
|
55
|
+
return fixPrecision(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
56
|
+
}
|
|
57
|
+
|
|
45
58
|
Object.defineProperty(exports, "__esModule", {
|
|
46
59
|
value: !0
|
|
47
|
-
}), exports.fixPrecision = exports.fuzzyEqualVec = exports.fuzzyEqualNumber = exports.crossProductPoint = exports.crossProduct = exports.lengthFromPointToLine = exports.pointAt = exports.asin = exports.acos = exports.pow = exports.sqrt = exports.sin = exports.min = exports.max = exports.cos = exports.atan2 = exports.abs = exports.pi2 = exports.SUBDIVISION_MAX_ITERATIONS = exports.SUBDIVISION_PRECISION = exports.NEWTON_MIN_SLOPE = exports.NEWTON_ITERATIONS = exports.tau = exports.halfPi = exports.pi = exports.epsilon = void 0,
|
|
60
|
+
}), exports.precisionSub = exports.precisionAdd = exports.getDecimalPlaces = exports.fixPrecision = exports.fuzzyEqualVec = exports.fuzzyEqualNumber = exports.crossProductPoint = exports.crossProduct = exports.lengthFromPointToLine = exports.pointAt = exports.asin = exports.acos = exports.pow = exports.sqrt = exports.sin = exports.min = exports.max = exports.cos = exports.atan2 = exports.abs = exports.pi2 = exports.SUBDIVISION_MAX_ITERATIONS = exports.SUBDIVISION_PRECISION = exports.NEWTON_MIN_SLOPE = exports.NEWTON_ITERATIONS = exports.tau = exports.halfPi = exports.pi = exports.epsilon = void 0,
|
|
48
61
|
exports.epsilon = 1e-12, exports.pi = Math.PI, exports.halfPi = exports.pi / 2,
|
|
49
62
|
exports.tau = 2 * exports.pi, exports.NEWTON_ITERATIONS = 4, exports.NEWTON_MIN_SLOPE = .001,
|
|
50
63
|
exports.SUBDIVISION_PRECISION = 1e-7, exports.SUBDIVISION_MAX_ITERATIONS = 10, exports.pi2 = 2 * Math.PI,
|
|
@@ -53,5 +66,6 @@ exports.min = Math.min, exports.sin = Math.sin, exports.sqrt = Math.sqrt, export
|
|
|
53
66
|
exports.acos = acos, exports.asin = asin, exports.pointAt = pointAt, exports.lengthFromPointToLine = lengthFromPointToLine,
|
|
54
67
|
exports.crossProduct = crossProduct, exports.crossProductPoint = crossProductPoint,
|
|
55
68
|
exports.fuzzyEqualNumber = fuzzyEqualNumber, exports.fuzzyEqualVec = fuzzyEqualVec,
|
|
56
|
-
exports.fixPrecision = fixPrecision
|
|
69
|
+
exports.fixPrecision = fixPrecision, exports.getDecimalPlaces = getDecimalPlaces,
|
|
70
|
+
exports.precisionAdd = precisionAdd, exports.precisionSub = precisionSub;
|
|
57
71
|
//# sourceMappingURL=math.js.map
|
package/cjs/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,KAAK,CAAC;AAChB,QAAA,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;AACb,QAAA,MAAM,GAAG,UAAE,GAAG,CAAC,CAAC;AAChB,QAAA,GAAG,GAAG,CAAC,GAAG,UAAE,CAAC;AACb,QAAA,iBAAiB,GAAG,CAAC,CAAC;AACtB,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAChC,QAAA,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AA2BlB,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACnB,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACjB,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAE5B,SAAgB,IAAI,CAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AA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export const NEWTON_ITERATIONS = 4;\nexport const NEWTON_MIN_SLOPE = 0.001;\nexport const SUBDIVISION_PRECISION = 0.0000001;\nexport const SUBDIVISION_MAX_ITERATIONS = 10;\nexport const pi2 = Math.PI * 2;\n\nexport type vec2 = [number, number] | Float32Array;\nexport type vec3 = [number, number, number] | Float32Array;\nexport type vec4 = [number, number, number, number] | Float32Array;\nexport type vec8 = [number, number, number, number, number, number, number, number] | Float32Array;\nexport type mat4 =\n | [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n ]\n | Float32Array;\n\nexport const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\nexport const pow = Math.pow;\n\nexport function acos(x: number) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x: number) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n\n/**\n * 根据比例获直线上的点\n * @param {number} x1 起始点 x\n * @param {number} y1 起始点 y\n * @param {number} x2 结束点 x\n * @param {number} y2 结束点 y\n * @param {number} t 指定比例\n * @return {object} 包含 x, y 的点\n */\nexport function pointAt(\n x1: number | null | undefined,\n y1: number | null | undefined,\n x2: number | null | undefined,\n y2: number | null | undefined,\n t: number\n): {\n x: undefined | number;\n y: undefined | number;\n} {\n let x: number | undefined;\n let y: number | undefined;\n if (typeof x1 === 'number' && typeof x2 === 'number') {\n x = (1 - t) * x1 + t * x2;\n }\n if (typeof y1 === 'number' && typeof y2 === 'number') {\n y = (1 - t) * y1 + t * y2;\n }\n return {\n x,\n y\n };\n}\n\nexport function lengthFromPointToLine(\n point: { x: number; y: number },\n point1: { x: number; y: number },\n point2: { x: number; y: number }\n): number {\n // 面积\n const dir1X = point2.x - point1.x;\n const dir1Y = point2.y - point1.y;\n const dir2X = point.x - point1.x;\n const dir2Y = point.y - point1.y;\n const s = Math.abs(dir1X * dir2Y - dir2X * dir1Y);\n const length = Math.sqrt(dir1X * dir1X + dir1Y * dir1Y);\n return s / length;\n}\n\nexport function crossProduct(dir1: vec2, dir2: vec2): number {\n return dir1[0] * dir2[1] - dir1[1] * dir2[0];\n}\n\nexport function crossProductPoint(dir1: { x: number; y: number }, dir2: { x: number; y: number }): number {\n return dir1.x * dir2.y - dir1.y * dir2.x;\n}\n\nexport function fuzzyEqualNumber(a: number, b: number): boolean {\n return abs(a - b) < epsilon;\n}\n\nexport function fuzzyEqualVec(a: vec2, b: vec2): boolean {\n return abs(a[0] - b[0]) + abs(a[1] - b[1]) < epsilon;\n}\n\nexport function fixPrecision(num: number, precision = 10) {\n return Math.round(num * precision) / precision;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/math.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,KAAK,CAAC;AAChB,QAAA,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;AACb,QAAA,MAAM,GAAG,UAAE,GAAG,CAAC,CAAC;AAChB,QAAA,GAAG,GAAG,CAAC,GAAG,UAAE,CAAC;AACb,QAAA,iBAAiB,GAAG,CAAC,CAAC;AACtB,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAChC,QAAA,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AA2BlB,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACnB,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AACf,QAAA,IA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,CAAC,CAAC,CAAC,GAAG,eAAO,CAAC;AACvD,CAAC;AAFD,sCAEC;AAED,SAAgB,YAAY,CAAC,GAAW,EAAE,SAAS,GAAG,EAAE;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AACjD,CAAC;AAFD,oCAEC;AAED,SAAgB,gBAAgB,CAAC,CAAS;IACxC,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAJD,4CAIC;AAED,SAAgB,YAAY,CAAC,CAAS,EAAE,CAAS;IAC/C,OAAO,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAFD,oCAEC;AAED,SAAgB,YAAY,CAAC,CAAS,EAAE,CAAS;IAC/C,OAAO,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAFD,oCAEC","file":"math.js","sourcesContent":["export const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\nexport const NEWTON_ITERATIONS = 4;\nexport const NEWTON_MIN_SLOPE = 0.001;\nexport const SUBDIVISION_PRECISION = 0.0000001;\nexport const SUBDIVISION_MAX_ITERATIONS = 10;\nexport const pi2 = Math.PI * 2;\n\nexport type vec2 = [number, number] | Float32Array;\nexport type vec3 = [number, number, number] | Float32Array;\nexport type vec4 = [number, number, number, number] | Float32Array;\nexport type vec8 = [number, number, number, number, number, number, number, number] | Float32Array;\nexport type mat4 =\n | [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n ]\n | Float32Array;\n\nexport const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\nexport const pow = Math.pow;\n\nexport function acos(x: number) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x: number) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n\n/**\n * 根据比例获直线上的点\n * @param {number} x1 起始点 x\n * @param {number} y1 起始点 y\n * @param {number} x2 结束点 x\n * @param {number} y2 结束点 y\n * @param {number} t 指定比例\n * @return {object} 包含 x, y 的点\n */\nexport function pointAt(\n x1: number | null | undefined,\n y1: number | null | undefined,\n x2: number | null | undefined,\n y2: number | null | undefined,\n t: number\n): {\n x: undefined | number;\n y: undefined | number;\n} {\n let x: number | undefined;\n let y: number | undefined;\n if (typeof x1 === 'number' && typeof x2 === 'number') {\n x = (1 - t) * x1 + t * x2;\n }\n if (typeof y1 === 'number' && typeof y2 === 'number') {\n y = (1 - t) * y1 + t * y2;\n }\n return {\n x,\n y\n };\n}\n\nexport function lengthFromPointToLine(\n point: { x: number; y: number },\n point1: { x: number; y: number },\n point2: { x: number; y: number }\n): number {\n // 面积\n const dir1X = point2.x - point1.x;\n const dir1Y = point2.y - point1.y;\n const dir2X = point.x - point1.x;\n const dir2Y = point.y - point1.y;\n const s = Math.abs(dir1X * dir2Y - dir2X * dir1Y);\n const length = Math.sqrt(dir1X * dir1X + dir1Y * dir1Y);\n return s / length;\n}\n\nexport function crossProduct(dir1: vec2, dir2: vec2): number {\n return dir1[0] * dir2[1] - dir1[1] * dir2[0];\n}\n\nexport function crossProductPoint(dir1: { x: number; y: number }, dir2: { x: number; y: number }): number {\n return dir1.x * dir2.y - dir1.y * dir2.x;\n}\n\nexport function fuzzyEqualNumber(a: number, b: number): boolean {\n return abs(a - b) < epsilon;\n}\n\nexport function fuzzyEqualVec(a: vec2, b: vec2): boolean {\n return abs(a[0] - b[0]) + abs(a[1] - b[1]) < epsilon;\n}\n\nexport function fixPrecision(num: number, precision = 10) {\n return Math.round(num * precision) / precision;\n}\n\nexport function getDecimalPlaces(n: number): number {\n const dStr = n.toString().split(/[eE]/);\n const s = (dStr[0].split('.')[1] || '').length - (+dStr[1] || 0);\n return s > 0 ? s : 0;\n}\n\nexport function precisionAdd(a: number, b: number) {\n return fixPrecision(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));\n}\n\nexport function precisionSub(a: number, b: number) {\n return fixPrecision(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1645,6 +1645,17 @@
|
|
|
1645
1645
|
function fixPrecision(num, precision = 10) {
|
|
1646
1646
|
return Math.round(num * precision) / precision;
|
|
1647
1647
|
}
|
|
1648
|
+
function getDecimalPlaces(n) {
|
|
1649
|
+
const dStr = n.toString().split(/[eE]/);
|
|
1650
|
+
const s = (dStr[0].split('.')[1] || '').length - (+dStr[1] || 0);
|
|
1651
|
+
return s > 0 ? s : 0;
|
|
1652
|
+
}
|
|
1653
|
+
function precisionAdd(a, b) {
|
|
1654
|
+
return fixPrecision(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
1655
|
+
}
|
|
1656
|
+
function precisionSub(a, b) {
|
|
1657
|
+
return fixPrecision(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
1658
|
+
}
|
|
1648
1659
|
|
|
1649
1660
|
class Point {
|
|
1650
1661
|
constructor(x = 0, y = 0, x1, y1) {
|
|
@@ -4772,6 +4783,7 @@
|
|
|
4772
4783
|
exports.getAngleByPoint = getAngleByPoint;
|
|
4773
4784
|
exports.getContainerSize = getContainerSize;
|
|
4774
4785
|
exports.getContextFont = getContextFont;
|
|
4786
|
+
exports.getDecimalPlaces = getDecimalPlaces;
|
|
4775
4787
|
exports.getElementAbsolutePosition = getElementAbsolutePosition;
|
|
4776
4788
|
exports.getElementRelativePosition = getElementRelativePosition;
|
|
4777
4789
|
exports.getFormatFromValue = getFormatFromValue;
|
|
@@ -4880,6 +4892,8 @@
|
|
|
4880
4892
|
exports.polygonContainPoint = polygonContainPoint;
|
|
4881
4893
|
exports.polygonIntersectPolygon = polygonIntersectPolygon;
|
|
4882
4894
|
exports.pow = pow;
|
|
4895
|
+
exports.precisionAdd = precisionAdd;
|
|
4896
|
+
exports.precisionSub = precisionSub;
|
|
4883
4897
|
exports.quantileSorted = quantileSorted;
|
|
4884
4898
|
exports.radianToDegree = radianToDegree;
|
|
4885
4899
|
exports.range = range;
|
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VUtils={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,u="~";function n(){}function D(t,e,u){this.fn=t,this.context=e,this.once=u||!1}function r(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new D(n,r||t,i),o=u?u+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],s]:t._events[o].push(s):(t._events[o]=s,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(u=!1)),s.prototype.eventNames=function(){var t,n,D=[];if(0===this._eventsCount)return D;for(n in t=this._events)e.call(t,n)&&D.push(u?n.slice(1):n);return Object.getOwnPropertySymbols?D.concat(Object.getOwnPropertySymbols(t)):D},s.prototype.listeners=function(t){var e=u?u+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var D=0,r=n.length,i=new Array(r);D<r;D++)i[D]=n[D].fn;return i},s.prototype.listenerCount=function(t){var e=u?u+t:t,n=this._events[e];return n?n.fn?1:n.length:0},s.prototype.emit=function(t,e,n,D,r,i){var s=u?u+t:t;if(!this._events[s])return!1;var o,a,h=this._events[s],l=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,D),!0;case 5:return h.fn.call(h.context,e,n,D,r),!0;case 6:return h.fn.call(h.context,e,n,D,r,i),!0}for(a=1,o=new Array(l-1);a<l;a++)o[a-1]=arguments[a];h.fn.apply(h.context,o)}else{var c,F=h.length;for(a=0;a<F;a++)switch(h[a].once&&this.removeListener(t,h[a].fn,void 0,!0),l){case 1:h[a].fn.call(h[a].context);break;case 2:h[a].fn.call(h[a].context,e);break;case 3:h[a].fn.call(h[a].context,e,n);break;case 4:h[a].fn.call(h[a].context,e,n,D);break;default:if(!o)for(c=1,o=new Array(l-1);c<l;c++)o[c-1]=arguments[c];h[a].fn.apply(h[a].context,o)}}return!0},s.prototype.on=function(t,e,u){return r(this,t,e,u,!1)},s.prototype.once=function(t,e,u){return r(this,t,e,u,!0)},s.prototype.removeListener=function(t,e,n,D){var r=u?u+t:t;if(!this._events[r])return this;if(!e)return i(this,r),this;var s=this._events[r];if(s.fn)s.fn!==e||D&&!s.once||n&&s.context!==n||i(this,r);else{for(var o=0,a=[],h=s.length;o<h;o++)(s[o].fn!==e||D&&!s[o].once||n&&s[o].context!==n)&&a.push(s[o]);a.length?this._events[r]=1===a.length?a[0]:a:i(this,r)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=u?u+t:t,this._events[e]&&i(this,e)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=u,s.EventEmitter=s,t.exports=s}(u);var n=e(u.exports);const D=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,r=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||D(t,"Boolean"),i=t=>"function"==typeof t,s=t=>null==t,o=t=>null!=t,a=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},h=t=>"object"==typeof t&&null!==t,l=function(t){if(!h(t)||!D(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},c=(t,e=!1)=>{const u=typeof t;return e?"string"===u:"string"===u||D(t,"String")},F=t=>Array.isArray?Array.isArray(t):D(t,"Array"),f=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},C=t=>D(t,"Date"),d=(t,e=!1)=>{const u=typeof t;return e?"number"===u:"number"===u||D(t,"Number")},g=t=>d(t)&&Number.isFinite(t),E=t=>D(t,"RegExp"),y=Object.prototype,m=Object.prototype.hasOwnProperty;const p=Object.prototype.hasOwnProperty;function x(t,e,u=!1){if(e){if(t===e)return;if(o(e)&&"object"==typeof e){const n=Object(e),D=[];for(const t in n)D.push(t);let{length:r}=D,i=-1;for(;r--;){const r=D[++i];o(n[r])&&"object"==typeof n[r]?B(t,e,r,u):b(t,r,n[r])}}}}function B(t,e,u,n=!1){const D=t[u],r=e[u];let i=e[u],s=!0;if(F(r)){if(n)i=[];else if(F(D))i=D;else if(f(D)){i=new Array(D.length);let t=-1;const e=D.length;for(;++t<e;)i[t]=D[t]}}else l(r)?(i=D,"function"!=typeof D&&"object"==typeof D||(i={})):s=!1;s&&x(i,r,n),b(t,u,i)}function b(t,e,u){(void 0!==u&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],u)||void 0===u&&!(e in t))&&(t[e]=u)}const M=Object.prototype.hasOwnProperty;function A(t){return Object.prototype.toString.call(t)}function v(t){return Object.keys(t)}function _(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function w(t){return F(t)?t.length:a(t)?Object.keys(t).length:0}function S(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const u in t)t.hasOwnProperty(u)&&e.push(u);return e}function T(t,e,u){const n=S(e);for(let D=0;D<n.length;D++){const r=n[D];(u?null!=e[r]:null==t[r])&&(t[r]=e[r])}return t}function N(t){return o(t)?F(t)?t:[t]:[]}function L(t){if(f(t)){return t[t.length-1]}}function O(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function H(t){return Number(t)}function I(t,e,u=H){const n=t.length;if(!n)return;if(e<=0||n<2)return u(t[0],0,t);if(e>=1)return u(t[n-1],n-1,t);const D=(n-1)*e,r=Math.floor(D),i=u(t[r],r,t);return i+(u(t[r+1],r+1,t)-i)*(D-r)}function U(t,e){let u,n=0,D=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(u=e-D,D+=u/++n,r+=u*(e-D));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(s=+s)>=s&&(u=s-D,D+=u/++n,r+=u*(s-D))}return n>1?r/(n-1):0}const R=Math.sqrt(50),k=Math.sqrt(10),P=Math.sqrt(2);const j=1e-10,z=1e-10;function Y(t,e,u=z,n=j){const D=n,r=u*Math.max(t,e);return Math.abs(t-e)<=Math.max(D,r)}const W=(t,e=0)=>{let u="",n=e-1;for(;n>=0;)u=`${u}${t}`,n-=1;return u},q=(t,e,u=" ",n="right")=>{const D=u,r=t+"",i=e-r.length;return i<=0?r:"left"===n?W(D,i)+r:"center"===n?W(D,Math.floor(i/2))+r+W(D,Math.ceil(i/2)):r+W(D,i)},V=function(t,e,u){return t<e?e:t>u?u:t};let X=!1;try{X="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){X=!1}function $(t,e,u){let n,D,r,i,s,o,h=0,l=!1,c=!1,F=!0;const f=!e&&0!==e&&X;if("function"!=typeof t)throw new TypeError("Expected a function");function C(e){const u=n,r=D;return n=D=void 0,h=e,i=t.apply(r,u),i}function d(t,e){return f?(cancelAnimationFrame(s),requestAnimationFrame(t)):setTimeout(t,e)}function E(t){const u=t-o;return void 0===o||u>=e||u<0||c&&t-h>=r}function y(){const t=Date.now();if(E(t))return m(t);s=d(y,function(t){const u=t-h,n=e-(t-o);return c?Math.min(n,r-u):n}(t))}function m(t){return s=void 0,F&&n?C(t):(n=D=void 0,i)}function p(...t){const u=Date.now(),r=E(u);if(n=t,D=this,o=u,r){if(void 0===s)return function(t){return h=t,s=d(y,e),l?C(t):i}(o);if(c)return s=d(y,e),C(o)}return void 0===s&&(s=d(y,e)),i}return e=+e||0,a(u)&&(l=!!u.leading,c="maxWait"in u,c&&(r=Math.max(g(u.maxWait)?u.maxWait:0,e)),F="trailing"in u?!!u.trailing:F),p.cancel=function(){void 0!==s&&function(t){if(f)return cancelAnimationFrame(t);clearTimeout(t)}(s),h=0,n=o=D=s=void 0},p.flush=function(){return void 0===s?i:m(Date.now())},p.pending=function(){return void 0!==s},p}function G(t,e){return u=>t*(1-u)+e*u}X=!1;const Z=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,K=new RegExp(Z.source,"g");const Q=/^(?:(\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 J(t){if(t instanceof Date)return t;if(c(t)){const e=Q.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let u=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(u-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,u,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return s(t)?new Date(NaN):new Date(Math.round(t))}class tt{}const et=1e-12,ut=Math.PI,nt=ut/2,Dt=2*ut,rt=2*Math.PI,it=Math.abs,st=Math.atan2,ot=Math.cos,at=Math.max,ht=Math.min,lt=Math.sin,ct=Math.sqrt,Ft=Math.pow;function ft(t,e,u){const n=u.x-e.x,D=u.y-e.y,r=t.x-e.x,i=t.y-e.y;return Math.abs(n*i-r*D)/Math.sqrt(n*n+D*D)}function Ct(t,e){return t[0]*e[1]-t[1]*e[0]}function dt(t,e){return t.x*e.y-t.y*e.x}function gt(t,e){return it(t[0]-e[0])+it(t[1]-e[1])<et}class Et{constructor(t=0,e=0,u,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=u,this.y1=n}clone(){return new Et(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return d(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return d(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class yt{constructor(t=0,e=0,u,n){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=u,this.theta1=n}clone(){return new yt(this.r,this.theta)}copyFrom(t){return this.r=t.r,this.theta=t.theta,this.r1=t.r1,this.theta1=t.theta1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.r=t,this.theta=e,this}}function mt(t,e,u){const{x1:n,y1:D,x2:r,y2:i}=e;return u.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(u.e,u.f),e):(t.clear(),t.add(u.a*n+u.c*D+u.e,u.b*n+u.d*D+u.f),t.add(u.a*r+u.c*D+u.e,u.b*r+u.d*D+u.f),t.add(u.a*r+u.c*i+u.e,u.b*r+u.d*i+u.f),t.add(u.a*n+u.c*i+u.e,u.b*n+u.d*i+u.f),e)}class pt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new pt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,u=0,n=0){return this.x1=t,this.y1=e,this.x2=u,this.y2=n,this}set(t=0,e=0,u=0,n=0){return u<t?(this.x2=t,this.x1=u):(this.x1=t,this.x2=u),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return F(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,u=0){const n=this.rotatedPoints(t,e,u);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,u=0,n=0){const D=this.scalePoints(t,e,u,n);return this.clear().add(D[0],D[1]).add(D[2],D[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return mt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,u){const{x1:n,y1:D,x2:r,y2:i}=this,s=Math.cos(t),o=Math.sin(t),a=e-e*s+u*o,h=u-e*o-u*s;return[s*n-o*D+a,o*n+s*D+h,s*n-o*i+a,o*n+s*i+h,s*r-o*D+a,o*r+s*D+h,s*r-o*i+a,o*r+s*i+h]}scalePoints(t,e,u,n){const{x1:D,y1:r,x2:i,y2:s}=this;return[t*D+(1-t)*u,e*r+(1-e)*n,t*i+(1-t)*u,e*s+(1-e)*n]}}function xt(t){return t*(Math.PI/180)}function Bt(t){return 180*t/Math.PI}const bt=(t=0)=>{if(t<0)for(;t<-Dt;)t+=Dt;else if(t>0)for(;t>Dt;)t-=Dt;return t},Mt=bt,At=(t=0)=>t>360||t<-360?t%360:t,vt=At;class _t{constructor(t=1,e=0,u=0,n=1,D=0,r=0){this.a=t,this.b=e,this.c=u,this.d=n,this.e=D,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,u,n,D,r){return!(this.e!==D||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==u)}setValue(t,e,u,n,D,r){return this.a=t,this.b=e,this.c=u,this.d=n,this.e=D,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,u=this.c,n=this.d,D=this.e,r=this.f,i=new _t,s=t*n-e*u;return i.a=n/s,i.b=-e/s,i.c=-u/s,i.d=t/s,i.e=(u*r-n*D)/s,i.f=-(t*r-e*D)/s,i}rotate(t){const e=Math.cos(t),u=Math.sin(t),n=this.a*e+this.c*u,D=this.b*e+this.d*u,r=this.a*-u+this.c*e,i=this.b*-u+this.d*e;return this.a=n,this.b=D,this.c=r,this.d=i,this}rotateByCenter(t,e,u){const n=Math.cos(t),D=Math.sin(t),r=(1-n)*e+D*u,i=(1-n)*u-D*e,s=n*this.a-D*this.b,o=D*this.a+n*this.b,a=n*this.c-D*this.d,h=D*this.c+n*this.d,l=n*this.e-D*this.f+r,c=D*this.e+n*this.f+i;return this.a=s,this.b=o,this.c=a,this.d=h,this.e=l,this.f=c,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,u,n,D,r){return this.multiply(t,e,u,n,D,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:u,d:n,e:D,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=u,this.e=r,this.f=D,this}multiply(t,e,u,n,D,r){const i=this.a,s=this.b,o=this.c,a=this.d,h=i*t+o*e,l=s*t+a*e,c=i*u+o*n,F=s*u+a*n,f=i*D+o*r+this.e,C=s*D+a*r+this.f;return this.a=h,this.b=l,this.c=c,this.d=F,this.e=f,this.f=C,this}interpolate(t,e){const u=new _t;return u.a=this.a+(t.a-this.a)*e,u.b=this.b+(t.b-this.b)*e,u.c=this.c+(t.c-this.c)*e,u.d=this.d+(t.d-this.d)*e,u.e=this.e+(t.e-this.e)*e,u.f=this.f+(t.f-this.f)*e,u}transformPoint(t,e){const{a:u,b:n,c:D,d:r,e:i,f:s}=this,o=u*r-n*D,a=r/o,h=-n/o,l=-D/o,c=u/o,F=(D*s-r*i)/o,f=-(u*s-n*i)/o,{x:C,y:d}=t;e.x=C*a+d*l+F,e.y=C*h+d*c+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new _t(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,u=this.c,n=this.d,D=t*n-e*u,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const i=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/i):-Math.acos(t/i),r.scaleX=i,r.scaleY=D/i,r.skewX=(t*u+e*n)/D,r.skewY=0}else if(0!==u||0!==n){const i=Math.sqrt(u*u+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-u/i):-Math.acos(u/i)),r.scaleX=D/i,r.scaleY=i,r.skewX=0,r.skewY=(t*u+e*n)/D}return r.rotateDeg=Bt(r.rotateDeg),r}}class wt{static clearCache(t,e){const{CLEAN_THRESHOLD:u=wt.CLEAN_THRESHOLD,L_TIME:n=wt.L_TIME,R_COUNT:D=wt.R_COUNT}=e;if(t.size<u)return 0;let r=0;const i=e=>{r++,t.delete(e)},s=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<D)return i(e);let u=0;for(;s-t.timestamp[t.timestamp.length-1-u]<n&&(u++,!(u>=D)););if(u<D)return i(e);for(;s-t.timestamp[0]>n;)t.timestamp.shift()})),r}static addLimitedTimestamp(t,e,u){const{R_TIMESTAMP_MAX_SIZE:n=wt.R_TIMESTAMP_MAX_SIZE}=u;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}static clearTimeStamp(t,e){const{L_TIME:u=wt.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>u;)t.timestamp.shift()}))}static clearItemTimestamp(t,e){const{L_TIME:u=wt.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>u;)t.timestamp.shift()}}function St(t,e,u){e/=100,u/=100;const n=(1-Math.abs(2*u-1))*e,D=n*(1-Math.abs(t/60%2-1)),r=u-n/2;let i=0,s=0,o=0;return 0<=t&&t<60?(i=n,s=D,o=0):60<=t&&t<120?(i=D,s=n,o=0):120<=t&&t<180?(i=0,s=n,o=D):180<=t&&t<240?(i=0,s=D,o=n):240<=t&&t<300?(i=D,s=0,o=n):300<=t&&t<360&&(i=n,s=0,o=D),i=Math.round(255*(i+r)),s=Math.round(255*(s+r)),o=Math.round(255*(o+r)),{r:i,g:s,b:o}}function Tt(t,e,u){t/=255,e/=255,u/=255;const n=Math.min(t,e,u),D=Math.max(t,e,u),r=D-n;let i=0,s=0,o=0;return i=0===r?0:D===t?(e-u)/r%6:D===e?(u-t)/r+2:(t-e)/r+4,i=Math.round(60*i),i<0&&(i+=360),o=(D+n)/2,s=0===r?0:r/(1-Math.abs(2*o-1)),s=+(100*s).toFixed(1),o=+(100*o).toFixed(1),{h:i,s:s,l:o}}wt.CLEAN_THRESHOLD=1e3,wt.L_TIME=1e3,wt.R_COUNT=1,wt.R_TIMESTAMP_MAX_SIZE=20;const Nt=/^#([0-9a-f]{3,8})$/,Lt={transparent:4294967040},Ot={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ht(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function It(t){return d(t)?new Rt(t>>16,t>>8&255,255&t,1):F(t)?new Rt(t[0],t[1],t[2]):new Rt(255,255,255)}class Ut{static Brighter(t,e=1){return 1===e?t:new Ut(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ut(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const u=t instanceof Ut?t:new Ut(t);switch(e){case"hsv":default:return u.getHSVBrightness();case"hsl":return u.getHSLBrightness();case"lum":return u.getLuminance();case"lum2":return u.getLuminance2();case"lum3":return u.getLuminance3()}}static parseColorString(t){if(o(Lt[t]))return function(t){return d(t)?new Rt(t>>>24,t>>>16&255,t>>>8&255,255&t):F(t)?new Rt(t[0],t[1],t[2],t[3]):new Rt(255,255,255,1)}(Lt[t]);if(o(Ot[t]))return It(Ot[t]);const e=`${t}`.trim().toLowerCase(),u=Nt.exec(e);if(u){const t=parseInt(u[1],16),e=u[1].length;return 3===e?new Rt((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?It(t):8===e?new Rt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Rt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),u=St(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Rt(u.r,u.g,u.b,parseFloat(t[3]))}}constructor(t){const e=Ut.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Rt(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(t=1){return this.color.opacity=t,this}brighter(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,u){const n=this.color.opacity,D=Tt(this.color.r,this.color.g,this.color.b),r=St(s(t)?D.h:V(t,0,360),s(e)?D.s:e>=0&&e<=1?100*e:e,s(u)?D.l:u<=1&&u>=0?100*u:u);return this.color=new Rt(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}}class Rt{constructor(t,e,u,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+u)?255:Math.max(0,Math.min(255,+u)),o(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Ht(this.r)+Ht(this.g)+Ht(this.b)+(1===this.opacity?"":Ht(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:u,l:n}=Tt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${u}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}var kt=Object.freeze({__proto__:null,Color:Ut,DEFAULT_COLORS:Ot,RGB:Rt,hexToRgb:function(t){let e="",u="",n="";const D="#"===t[0]?1:0;for(let r=D;r<t.length;r++)"#"!==t[r]&&(r<D+2?e+=t[r]:r<D+4?u+=t[r]:r<D+6&&(n+=t[r]));return[parseInt(e,16),parseInt(u,16),parseInt(n,16)]},hslToRgb:St,interpolateRgb:function(t,e){const u=t.r,n=e.r,D=t.g,r=e.g,i=t.b,s=e.b,o=t.opacity,a=e.opacity;return t=>{const e=Math.round(u*(1-t)+n*t),h=Math.round(D*(1-t)+r*t),l=Math.round(i*(1-t)+s*t);return new Rt(e,h,l,o*(1-t)+a*t)}},rgbToHex:function(t,e,u){return Number((1<<24)+(t<<16)+(e<<8)+u).toString(16).slice(1)},rgbToHsl:Tt});function Pt(t,e,u){t[0]=e[0]-u[0],t[1]=e[1]-u[1]}let jt,zt,Yt,Wt,qt,Vt,Xt,$t;function Gt(t,e,u,n){let D,r=t[0],i=e[0],s=u[0],o=n[0];return i<r&&(D=i,i=r,r=D),o<s&&(D=o,o=s,s=D),!(i<s||o<r)&&(r=t[1],i=e[1],s=u[1],o=n[1],i<r&&(D=i,i=r,r=D),o<s&&(D=o,o=s,s=D),!(i<s||o<r))}var Zt;function Kt(t,e,u){return!e||(u?(jt=e.x1,zt=e.x2,Yt=e.y1,Wt=e.y2,jt>zt&&([jt,zt]=[zt,jt]),Yt>Wt&&([Yt,Wt]=[Wt,Yt]),t.x>=jt&&t.x<=zt&&t.y>=Yt&&t.y<=Wt):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function Qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Jt({x:t,y:e},u,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(u)+(e-n.y)*Math.sin(u)+n.x,y:(t-n.x)*Math.sin(u)+(n.y-e)*Math.cos(u)+n.y}}function te(t){return t/180*Math.PI}function ee(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ue(t,e){const u=e?t.angle:te(t.angle),n=ee(t);return[Jt({x:t.x1,y:t.y1},u,n),Jt({x:t.x2,y:t.y1},u,n),Jt({x:t.x2,y:t.y2},u,n),Jt({x:t.x1,y:t.y2},u,n)]}let ne,De,re,ie,se,oe,ae,he,le,ce,Fe,fe;function Ce(t,e,u=3,n=!1){let D=t.x1,r=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,h=e.y1,l=e.y2;if(n){let t;D>r&&(t=D,D=r,r=t),i>s&&(t=i,i=s,s=t),o>a&&(t=o,o=a,a=t),h>l&&(t=h,h=l,l=t)}if(D>=a||r<=o||i>=l||s<=h)return[t,e];const c=(r-D+2*u)*(s-i+2*u),F=(a-o+2*u)*(l-h+2*u),f=Math.min(D,o),C=Math.min(i,h),d=Math.max(r,a),g=Math.max(s,l);return c+F>(d-f)*(g-C)?[{x1:f,x2:d,y1:C,y2:g}]:[t,e]}t.InnerBBox=void 0,(Zt=t.InnerBBox||(t.InnerBBox={}))[Zt.NONE=0]="NONE",Zt[Zt.BBOX1=1]="BBOX1",Zt[Zt.BBOX2=2]="BBOX2";const de={x:0,y:0},ge={x:0,y:0};function Ee(t,e,u,n){return ft(t,e,u)<=n/2&&xe(t,e,u)}const ye={x:0,y:0},me={x:0,y:0},pe={x:0,y:0};function xe(t,e,u){return ye.x=e.x-t.x,ye.y=e.y-t.y,me.x=u.x-t.x,me.y=u.y-t.y,pe.x=e.y-u.y,pe.y=u.x-e.x,dt(ye,pe)*dt(me,pe)<0}class Be{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:u,fontSize:n,fontFamily:D}){return(t?t+" ":"")+(e?e+" ":"")+(u?u+" ":"")+(n||12)+"px "+(D||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let u=0,n=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?u++:n++;return{width:~~(.8*u*e+n*e),height:e}}static getDefaultUtils(t){return Be.instance||(Be.instance=new Be(t)),Be.instance}}const be=1e-8;function Me(t,e,u,n,D){for(let r=0,i=D[D.length-1];r<D.length;r++){const s=D[r];if(Gt([t,e],[u,n],[s.x,s.y],[i.x,i.y]))return!0;i=s}return!1}function Ae(t,e,u){let n=0,D=t[0];if(!D)return!1;for(let r=1;r<t.length;r++){const i=t[r];n+=ve(D.x,D.y,i.x,i.y,e,u),D=i}const r=t[0];return _e(D.x,r.x)&&_e(D.y,r.y)||(n+=ve(D.x,D.y,r.x,r.y,e,u)),0!==n}function ve(t,e,u,n,D,r){if(r>e&&r>n||r<e&&r<n)return 0;if(n===e)return 0;const i=(r-e)/(n-e);let s=n<e?1:-1;1!==i&&0!==i||(s=n<e?.5:-.5);const o=i*(u-t)+t;return o===D?1/0:o>D?s:0}function _e(t,e){return Math.abs(t-e)<be}const we=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Se(),"")},Se=({onlyFirst:t=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")},Te=t=>{let e=t.charCodeAt(0),u=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=u&&u<=57343&&(e&=1023,u&=1023,n=e<<10|u,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},Ne=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\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DFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function Le(t,e={}){const{fontStyle:u=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:D=e.fontWeight,fontSize:r=e.fontSize,fontFamily:i=e.fontFamily}=t;return(u?u+" ":"")+(n?n+" ":"")+(D?D+" ":"")+r+"px "+(i||"sans-serif")}class Oe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),o(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=o(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(s(this._canvas)&&(o(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),s(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&o(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),s(this._context)&&o(this._canvas)){const t=this._canvas.getContext("2d");o(t)&&(t.save(),t.font=Le(this.textSpec),this._contextSaved=!0,this._context=t)}return!s(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,u;const{defaultFontParams:n={}}=this._option,{fontStyle:D=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:i=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:s=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:o=(null!==(u=n.fontFamily)&&void 0!==u?u:"sans-serif"),align:a,textAlign:h=(null!=a?a:"center"),baseline:l,textBaseline:c=(null!=l?l:"middle"),ellipsis:F,limit:f,lineHeight:C=s}=this._userSpec;return{fontStyle:D,fontVariant:r,fontFamily:o,fontSize:s,fontWeight:i,textAlign:h,textBaseline:c,ellipsis:F,limit:f,lineHeight:C}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(s(t))return{width:0,height:0};if(s(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:u,fontWeight:n,textAlign:D,textBaseline:r,ellipsis:i,limit:o,lineHeight:a}=this.textSpec;let h;try{const s=this._option.getTextBounds({text:t,fontFamily:e,fontSize:u,fontWeight:n,textAlign:D,textBaseline:r,ellipsis:!!i,maxLineWidth:o||1/0,lineHeight:a});h={width:s.width(),height:s.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:u,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:u}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let u=0;u<t.length;u++){const n=t[u];let D=this._measureSpecialChar(n);s(D)&&Oe.NUMBERS_CHAR_SET.includes(n)&&(D=this._measureNumberChar()),s(D)&&["F","W"].includes(Te(n))&&(D=this._measureFullSizeChar()),s(D)&&(D=this._measureLetterChar()),e.width+=D.width,e.height=Math.max(e.height,D.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){const e={width:0,height:0},{fontSize:u,lineHeight:n}=this.textSpec;for(let n=0;n<t.length;n++){const D=t[n],r=["F","W"].includes(Te(D))?1:.53;e.width+=r*u}return e.height=null!=n?n:u,e}_measureReduce(t,e){const{fontSize:u,lineHeight:n}=this.textSpec,D={width:0,height:0};if(s(t))return D;if(F(t)){const r=t.filter(o).map((t=>t.toString()));return 0===r.length?D:1===r.length?e(r[0]):{width:r.reduce(((t,u)=>Math.max(t,e(u).width)),0),height:r.length*((null!=n?n:u)+1)+1}}return e(t.toString())}_measureNumberChar(){if(s(this._numberCharSize)){const t=this._standardMethod(Oe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Oe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return s(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Oe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(s(this._letterCharSize)){const t=this._standardMethod(Oe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Oe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return o(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){o(this._canvas)&&(this._canvas=null),o(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Oe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Oe.NUMBERS_CHAR_SET="0123456789",Oe.FULL_SIZE_CHAR="字";const He=()=>ke.NUMBERS_CHAR_SET[Math.floor(Math.random()*ke.NUMBERS_CHAR_SET.length)],Ie=t=>Array(t).fill(0).map(He).join(""),Ue=()=>ke.ALPHABET_CHAR_SET[Math.floor(Math.random()*ke.ALPHABET_CHAR_SET.length)],Re=t=>Array(t).fill(0).map(Ue).join("");class ke extends Oe{test(t,e,u){const n=t=>(t=>t.reduce(((t,e)=>t+e),0))(t)/t.length,D=t=>{const e=n(t);return n(t.map((t=>Math.pow(t-e,2))))},r=null!=e?e:()=>`测试${Re(8)} ${Ie(4)}/${Ie(2)}-${Ie(2)}`,i=Array(null!=u?u:1e5).fill(0).map(r),o={vrender:this.fullMeasure.bind(this),canvas:this.measureWithNaiveCanvas.bind(this),simple:this.quickMeasureWithoutCanvas.bind(this),quick:this.quickMeasure.bind(this),old:t=>{if(s(t))return{width:0,height:0};const e=t.toString(),{fontSize:u}=this.textSpec;return{width:.8*u*e.length,height:u}}},a=null!=t?t:Object.keys(o),h={},l=performance.now(),c=i.map(this._standardMethod),F=performance.now()-l;return h.standard={time:F},a.forEach((t=>{const e=o[t];if(e){const u=performance.now(),r=i.map(e),s=performance.now()-u,o=i.map(((t,e)=>({width:r[e].width-c[e].width,height:r[e].height-c[e].height})));h[t]={errMean:{width:n(o.map((t=>t.width))),height:n(o.map((t=>t.height)))},errVar:{width:D(o.map((t=>t.width))),height:D(o.map((t=>t.height)))},time:s}}})),{report:h,textArr:i}}}const Pe="undefined"!=typeof console;function je(t,e,u){const n=[e].concat([].slice.call(u));Pe&&console[t].apply(console,n)}var ze;t.LoggerLevel=void 0,(ze=t.LoggerLevel||(t.LoggerLevel={}))[ze.None=0]="None",ze[ze.Error=1]="Error",ze[ze.Warn=2]="Warn",ze[ze.Info=3]="Info",ze[ze.Debug=4]="Debug";class Ye{static getInstance(t,e){return Ye._instance&&d(t)?Ye._instance.level(t):Ye._instance||(Ye._instance=new Ye(t,e)),Ye._instance}static setInstance(t){return Ye._instance=t}static setInstanceLevel(t){Ye._instance?Ye._instance.level(t):Ye._instance=new Ye(t)}static clearInstance(){Ye._instance=null}constructor(e=t.LoggerLevel.None,u){this._onErrorHandler=[],this._level=e,this._method=u}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=t.LoggerLevel.Info}canLogDebug(){return this._level>=t.LoggerLevel.Debug}canLogError(){return this._level>=t.LoggerLevel.Error}canLogWarn(){return this._level>=t.LoggerLevel.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...e){var u;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):je(null!==(u=this._method)&&void 0!==u?u:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&je(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&je(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&je(this._method||"log","DEBUG",e),this}}function We(t){return t?"getUTCFullYear":"getFullYear"}function qe(t){return t?"getUTCMonth":"getMonth"}function Ve(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ge(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}Ye._instance=null;const Ke=1e3,Qe=6e4,Je=36e5,tu=24*Je,eu=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),uu=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),nu=(t,e)=>e.getFullYear()-t.getFullYear(),Du=t=>t.getFullYear(),ru=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),iu=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),su=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ou=t=>t.getUTCFullYear(),au=t=>(t.setDate(1),t.setHours(0,0,0,0),t),hu=(t,e)=>(t.setMonth(t.getMonth()+e),t),lu=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),cu=t=>t.getMonth(),Fu=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),fu=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),Cu=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),du=t=>t.getUTCMonth(),gu=t=>(t.setHours(0,0,0,0),t),Eu=(t,e)=>(t.setDate(t.getDate()+e),t),yu=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Qe)/tu,mu=t=>t.getDate()-1,pu=t=>(t.setUTCHours(0,0,0,0),t),xu=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Bu=(t,e)=>(+e-+t)/tu,bu=t=>t.getUTCDate()-1,Mu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Ke-t.getMinutes()*Qe),t),Au=(t,e)=>(t.setHours(t.getHours()+e),t),vu=(t,e)=>(+e-+t)/Je,_u=t=>t.getHours(),wu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Ke-t.getUTCMinutes()*Qe),t),Su=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Tu=t=>t.getUTCHours(),Nu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Ke),t),Lu=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Ou=(t,e)=>(+e-+t)/Qe,Hu=t=>t.getMinutes(),Iu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Ke),t),Uu=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Ru=t=>t.getUTCMinutes(),ku=t=>(t.setTime(+t-t.getMilliseconds()),t),Pu=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),ju=(t,e)=>(+e-+t)/Ke,zu=t=>t.getSeconds(),Yu=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Wu=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),qu=t=>t.getUTCSeconds(),Vu=t=>t,Xu=(t,e)=>(t.setTime(+t+e),t),$u=(t,e)=>+e-+t,Gu=(t,e)=>u=>{const n=new Date(+u-1);return e(n,1),t(n),n},Zu=(t,e)=>(u,n)=>{const D=new Date,r=new Date;return D.setTime(+u),r.setTime(+n),t(D),t(r),Math.floor(e(D,r))};function Ku(t){const{x:e,y:u}=t.getBoundingClientRect();return{x:e,y:u}}const Qu=t=>t.getBoundingClientRect().width/t.offsetWidth,Ju=t=>t.getBoundingClientRect().height/t.offsetHeight;var tn=6371008.8,en={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*tn,kilometers:6371.0088,kilometres:6371.0088,meters:tn,metres:tn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:tn/1852,radians:1,yards:6967335.223679999};t.AABBBounds=class extends pt{},t.Bounds=pt,t.ColorUtil=kt,t.DAY=tu,t.EventEmitter=n,t.GraphicUtil=Be,t.HOUR=Je,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const u=new tt;u.key=t,u.value=e;let n=this.itemList.length;return this.has(t)&&(n=this.items[t].index),u.index=n,this.itemList[n]=u,this.items[t]=u,u}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const u=this.itemList.indexOf(e);this.items[t].index=u}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items){if(!1===t(e,this.items[e].value))return!1}return!0}foreachHashv(t){for(const e in this.items){if(!1===t(e,this.items[e]))return!1}return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,u){const n=new tt;n.index=t,n.key=u,n.value=e,this.itemList.splice(t,0,n),this.items[u]=n,this.resetIndex()}sort(t){return this.itemList.sort(((e,u)=>t(e.value,u.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=tt,t.LRU=wt,t.Logger=Ye,t.MINUTE=Qe,t.MONTH=26784e5,t.Matrix=_t,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.OBBBounds=class extends pt{},t.Point=Et,t.PointService=class{static distancePP(t,e){return ct(Ft(t.x-e.x,2)+Ft(t.y-e.y,2))}static distanceNN(t,e,u,n){return ct(Ft(t-u,2)+Ft(e-n,2))}static distancePN(t,e,u){return ct(Ft(e-t.x,2)+Ft(u-t.y,2))}static pointAtPP(t,e,u){return new Et((e.x-t.x)*u+t.x,(e.y-t.y)*u+t.y)}},t.PolarPoint=yt,t.SECOND=Ke,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TestTextMeasure=ke,t.TextMeasure=Oe,t.YEAR=31536e6,t.abs=it,t.acos=function(t){return t>1?0:t<-1?ut:Math.acos(t)},t.array=N,t.arrayEqual=function(t,e){if(!F(t)||!F(e))return!1;if(t.length!==e.length)return!1;for(let u=0;u<t.length;u++)if(t[u]!==e[u])return!1;return!0},t.ascending=O,t.asin=function(t){return t>=1?nt:t<=-1?-nt:Math.asin(t)},t.atan2=st,t.bisect=function(t,e,u=0,n){for(s(n)&&(n=t.length);u<n;){const D=u+n>>>1;O(t[D],e)>0?n=D:u=D+1}return u},t.clamp=V,t.clampAngleByDegree=vt,t.clampAngleByRadian=Mt,t.clampDegree=At,t.clampRadian=bt,t.clampRange=(t,e,u)=>{let[n,D]=t;D<n&&(n=t[1],D=t[0]);const r=D-n;return r>=u-e?[e,u]:(n=Math.min(Math.max(n,e),u-r),[n,n+r])},t.clamper=function(t,e){let u;return t>e&&(u=t,t=e,e=u),u=>Math.max(t,Math.min(e,u))},t.clone=function(t,e=!1,u=0,n=void 0){const D=[],r=[];return void 0===e&&(e=!0),void 0===u&&(u=1/0),function t(u,i){if(null===u)return null;if(0===i)return u;let s;if("object"!=typeof u)return u;if(F(u)?s=[]:E(u)?(s=new RegExp(u.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(u)),u.lastIndex&&(s.lastIndex=u.lastIndex)):s=C(u)?new Date(u.getTime()):void 0===n?Object.create(Object.getPrototypeOf(u)):Object.create(n),e){const t=D.indexOf(u);if(-1!==t)return r[t];D.push(u),r.push(s)}for(const e in u)s[e]=t(u[e],i-1);return s}(t,u)},t.cloneDeep=function t(e){let u;if(!o(e)||"object"!=typeof e)return e;const n=F(e),D=e.length;u=n?new Array(D):"object"==typeof e?{}:r(e)||d(e)||c(e)?e:C(e)?new Date(+e):void 0;const i=n?void 0:Object.keys(Object(e));let s=-1;if(u)for(;++s<(i||e).length;){const n=i?i[s]:s,D=e[n];u[n]=t(D)}return u},t.constant=t=>i(t)?t:()=>t,t.cos=ot,t.crossProduct=Ct,t.crossProductPoint=dt,t.dateGetterName=Ve,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=yu,t.dayField=mu,t.dayFloor=gu,t.dayOffset=Eu,t.debounce=$,t.defaults=T,t.degreeToRadian=xt,t.destination=function(t,e,u,n={}){const D=xt(t[0]),r=xt(t[1]),i=xt(u),s=function(t,e){void 0===e&&(e="kilometers");var u=en[e];if(!u)throw new Error(e+" units is invalid");return t/u}(e,n.units),o=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(i));return{x:Bt(D+Math.atan2(Math.sin(i)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(o))),y:Bt(o)}},t.deviation=function(t,e){const u=U(t,e);return u?Math.sqrt(u):u},t.eastAsianCharacterInfo=Te,t.epsilon=et,t.fixPrecision=function(t,e=10){return Math.round(t*e)/e},t.flattenArray=function t(e){if(!F(e))return[e];const u=[];for(const n of e)u.push(...t(n));return u},t.fullYearGetterName=We,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return it(t-e)<et},t.fuzzyEqualVec=gt,t.generateCeil=Gu,t.generateCount=Zu,t.generateStepInterval=(t,{floor:e,offset:u,field:n,count:D})=>{const r=Math.floor(t);if(!Number.isFinite(r)||r<=0)return null;if(r<=1)return{floor:e,offset:u,ceil:Gu(e,u)};const i=Zu(e,D),s=n?t=>n(t)%r==0:t=>i(0,t)%r==0,o=t=>{if(!Number.isNaN(+t))for(e(t);!s(t);)t.setTime(+t-1),e(t);return t},a=(t,e)=>{if(!Number.isNaN(+t))if(r<0)for(;++e<=0;)for(u(t,-1);!s(t);)u(t,-1);else for(;--e>=0;)for(u(t,1);!s(t);)u(t,1);return t};return{floor:o,offset:a,ceil:Gu(o,a)}},t.get=(t,e,u)=>{const n=c(e)?e.split("."):e;for(let e=0;e<n.length;e++)t=t?t[n[e]]:void 0;return void 0===t?u:t},t.getAABBFromPoints=function(t){return ne=1/0,De=1/0,re=-1/0,ie=-1/0,t.forEach((t=>{ne>t.x&&(ne=t.x),re<t.x&&(re=t.x),De>t.y&&(De=t.y),ie<t.y&&(ie=t.y)})),{x1:ne,y1:De,x2:re,y2:ie}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getContainerSize=function(t,e=0,u=0){if(!t)return{width:e,height:u};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const D=n(t),r=parseFloat(D.width)-parseFloat(D.paddingLeft)-parseFloat(D.paddingRight)||t.clientWidth-1,i=parseFloat(D.height)-parseFloat(D.paddingTop)-parseFloat(D.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:i<=0?u:i}},t.getContextFont=Le,t.getElementAbsolutePosition=Ku,t.getElementRelativePosition=function(t,e){const u=Ku(t),n=Ku(e);return{x:u.x-n.x,y:u.y-n.y}},t.getFormatFromValue=function(t,e){const u=J(t),n=u[qe(e)]()+1,D=u[Ve(e)](),r=u[Xe(e)](),i=u[$e(e)](),s=u[Ge(e)](),o=0===u[Ze(e)](),a=o&&0===s,h=a&&0===i,l=h&&0===r,c=l&&1===D;return c&&1===n?"YYYY":c?"YYYY-MM":l?"YYYY-MM-DD":h?"HH":a?"HH:mm":o?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,u,n){if(!Gt(t,e,u,n))return!1;const D=[0,0],r=[0,0],i=[0,0];if(Pt(D,e,t),Pt(r,n,u),gt(D,r))return!0;Pt(i,u,t);const s=Ct(i,r)/Ct(D,r);return s>=0&&s<=1&&[t[0]+D[0]*s,t[1]+D[1]*s]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:ru,offset:iu,count:su,field:ou}:"month"===t&&e?{floor:Fu,offset:fu,count:Cu,field:du}:"day"===t&&e?{floor:pu,offset:xu,count:Bu,field:bu}:"hour"===t&&e?{floor:wu,offset:Su,count:vu,field:Tu}:"minute"===t&&e?{floor:Iu,offset:Uu,count:Ou,field:Ru}:"second"===t&&e?{floor:Yu,offset:Wu,count:ju,field:qu}:"year"===t?{floor:eu,offset:uu,count:nu,field:Du}:"month"===t?{floor:au,offset:hu,count:lu,field:cu}:"day"===t?{floor:gu,offset:Eu,count:yu,field:mu}:"hour"===t?{floor:Mu,offset:Au,count:vu,field:_u}:"minute"===t?{floor:Nu,offset:Lu,count:Ou,field:Hu}:"second"===t?{floor:ku,offset:Pu,count:ju,field:zu}:{floor:Vu,offset:Xu,count:$u},t.getOBBFromLine=function(t,e,u){return se=e.x-t.x,oe=e.y-t.y,ae=oe,he=-se,Fe=le=Math.sqrt(ae*ae+he*he),fe=u,ae/=le,he/=le,ce=u/2,se=ce*ae,oe=ce*he,{point1:{x:t.x+se,y:t.y+oe},point2:{x:t.x-se,y:t.y-oe},point3:{x:e.x+se,y:e.y+oe},point4:{x:e.x-se,y:e.y-oe},width:Fe,height:fe,left:Math.min(t.x,e.x)-Math.abs(se),top:Math.min(t.y,e.y)-Math.abs(oe)}},t.getRectIntersect=function(t,e,u){return null===t?e:null===e?t:(jt=t.x1,zt=t.x2,Yt=t.y1,Wt=t.y2,qt=e.x1,Vt=e.x2,Xt=e.y1,$t=e.y2,u&&(jt>zt&&([jt,zt]=[zt,jt]),Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt])),jt>=Vt||zt<=qt||Yt>=$t||Wt<=Xt?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(jt,qt),y1:Math.max(Yt,Xt),x2:Math.min(zt,Vt),y2:Math.min(Wt,$t)})},t.getScale=t=>t.offsetWidth>0?Qu(t):Ju(t),t.getScaleX=Qu,t.getScaleY=Ju,t.getScrollLeft=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTestNumbers=Ie,t.getTestWord=Re,t.getTimeFormatter=function(t,e){return u=>{const n=J(u),D=n[We(e)](),r=n[qe(e)]()+1,i=Math.floor((r-1)/3)+1,s=n[Ve(e)](),o=n["get"+(e?"UTC":"")+"Day"](),a=n[Xe(e)](),h=(a-1)%12+1,l=n[$e(e)](),c=n[Ge(e)](),F=n[Ze(e)]();return(t||"").replace(/YYYY/g,q(D+"",4,"0","left")).replace(/yyyy/g,D+"").replace(/yy/g,D%100+"").replace(/Q/g,i+"").replace(/MM/g,q(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,q(s,2,"0","left")).replace(/d/g,s+"").replace(/e/g,o+"").replace(/HH/g,q(a,2,"0","left")).replace(/H/g,a+"").replace(/hh/g,q(h+"",2,"0","left")).replace(/h/g,h+"").replace(/mm/g,q(l,2,"0","left")).replace(/m/g,l+"").replace(/ss/g,q(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,q(F,3,"0","left")).replace(/S/g,F+"")}},t.halfPi=nt,t.has=(t,e)=>null!=t&&p.call(t,e),t.hasParentElement=function(t,e){let u=t.parentNode;for(;null!==u;){if(u===e)return!0;u=u.parentNode}return!1},t.hourCount=vu,t.hourField=_u,t.hourFloor=Mu,t.hourOffset=Au,t.hoursGetterName=Xe,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.interpolateDate=function(t,e){const u=t.valueOf(),n=e.valueOf(),D=new Date;return t=>(D.setTime(u*(1-t)+n*t),D)},t.interpolateNumber=G,t.interpolateNumberRound=function(t,e){return function(u){return Math.round(t*(1-u)+e*u)}},t.interpolateString=function(t,e){let u,n,D,r=Z.lastIndex=K.lastIndex=0,i=-1;const s=[],o=[];for(t+="",e+="";(u=Z.exec(t))&&(n=K.exec(e));)(D=n.index)>r&&(D=e.slice(r,D),s[i]?s[i]+=D:s[++i]=D),(u=u[0])===(n=n[0])?s[i]?s[i]+=n:s[++i]=n:(s[++i]=null,o.push({i:i,x:G(u,n)})),r=K.lastIndex;return r<e.length&&(D=e.slice(r),s[i]?s[i]+=D:s[++i]=D),s.length<2?o[0]?function(t){return function(e){return t(e)+""}}(o[0].x):function(t){return function(){return t}}(e):(e=o.length,function(t){for(let u,n=0;n<e;++n)s[(u=o[n]).i]=u.x(t);return s.join("")})},t.isArray=F,t.isArrayLike=f,t.isBase64=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=r,t.isDate=C,t.isEmpty=function(t){if(s(t))return!0;if(f(t))return!t.length;const e=(t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")))(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||y)}(t))return!Object.keys(t).length;for(const e in t)if(m.call(t,e))return!1;return!0},t.isEqual=function t(e,u){if(e===u)return!0;if(typeof e!=typeof u)return!1;if(null==e||null==u)return!1;if(Number.isNaN(e)&&Number.isNaN(u))return!0;if(A(e)!==A(u))return!1;if(i(e))return!1;if("object"!=typeof e)return!1;if(F(e)){if(e.length!==u.length)return!1;for(let n=e.length-1;n>=0;n--)if(!t(e[n],u[n]))return!1;return!0}if(!l(e))return!1;const n=v(e),D=v(u);if(n.length!==D.length)return!1;n.sort(),D.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=D[t])return!1;for(let D=n.length-1;D>=0;D--){const r=n[D];if(!t(e[r],u[r]))return!1}return!0},t.isFunction=i,t.isGreater=function(t,e,u,n){return t>e&&!Y(t,e,u,n)},t.isIntersect=Gt,t.isLess=function(t,e,u,n){return t<e&&!Y(t,e,u,n)},t.isNil=s,t.isNull=t=>null===t,t.isNumber=d,t.isNumberClose=Y,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=a,t.isObjectLike=h,t.isPlainObject=l,t.isPointInLine=ve,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const u="Feature"===(n=e).type?n.geometry:n;var n;const D=u.type,r=e.bbox;let i=u.coordinates;if(r&&!0===Kt(t,{x1:r[0],x2:r[1],y1:r[1],y2:r[3]},!0))return!1;"Polygon"===D&&(i=[i]);let s=!1;for(let e=0;e<i.length;++e)for(let u=0;u<i[e].length;++u){if(Ae(i[e][u].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return s=!0,s}return s},t.isRectIntersect=function(t,e,u){return!t||!e||(u?(jt=t.x1,zt=t.x2,Yt=t.y1,Wt=t.y2,qt=e.x1,Vt=e.x2,Xt=e.y1,$t=e.y2,jt>zt&&([jt,zt]=[zt,jt]),Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt]),!(jt>Vt||zt<qt||Yt>$t||Wt<Xt)):!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1))},t.isRegExp=E,t.isRotateAABBIntersect=function(t,e,u=!1,n){const D=ue(t,u),r=ue(e,u),i=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,D.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const s=ee(t),o=ee(e);n&&n.fillRect(s.x,s.y,2,2),n&&n.fillRect(o.x,o.y,2,2);const a=i(s,o),h=i(D[0],D[1]),l=i(D[1],D[2]),c=i(r[0],r[1]),F=i(r[1],r[2]),f=u?t.angle:te(t.angle);let C=u?t.angle+nt:te(90-t.angle);const d=u?e.angle:te(e.angle);let g=u?e.angle+nt:te(90-e.angle);C>rt&&(C-=rt),g>rt&&(g-=rt);const E=(t,e,u,n)=>{const D=[Math.cos(e),Math.sin(e)];return t+(Qt(D,u)+Qt(D,n))/2>Qt(D,a)};return E((t.x2-t.x1)/2,f,c,F)&&E((t.y2-t.y1)/2,C,c,F)&&E((e.x2-e.x1)/2,d,h,l)&&E((e.y2-e.y1)/2,g,h,l)},t.isShallowEqual=function(t,e){if(_(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(F(t)!==F(e))return!1;if(w(t)!==w(e))return!1;let u=!0;return Object.keys(t).forEach((n=>!!_(t[n],e[n])||(u=!1,u))),u},t.isString=c,t.isType=D,t.isUndefined=t=>void 0===t,t.isValid=o,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.keys=S,t.last=L,t.lengthFromPointToLine=ft,t.lineIntersectPolygon=Me,t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=at,t.maxInArray=function(t){if(t&&F(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)},t.median=(t,e)=>{let u=t;return!0!==e&&(u=t.sort(O)),I(u,.5)},t.memoize=t=>{let e=null,u=null;return(...n)=>(e&&n.every(((t,u)=>t===e[u]))||(e=n,u=t(...n)),u)},t.merge=function(t,...e){let u=-1;const n=e.length;for(;++u<n;){x(t,e[u],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(u,n){const D=[];n.forEach((t=>{let e;(e=Ce(u,t)).length>1?D.push(t):u=e[0]})),e.push(u),D.length&&t(D[0],D.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=$u,t.millisecondsFloor=Vu,t.millisecondsGetterName=Ze,t.millisecondsOffset=Xu,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=ht,t.minInArray=function(t){if(t&&F(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)},t.minuteCount=Ou,t.minuteField=Hu,t.minuteFloor=Nu,t.minuteOffset=Lu,t.minutesGetterName=$e,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,u=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let D=0;D<n.length;D++){const r=n[D];"constructor"!==r&&(u?null!=e[r]:null==t[r])&&(t[r]=e[r])}}else T(t,e,u)},t.monthCount=lu,t.monthField=cu,t.monthFloor=au,t.monthGetterName=qe,t.monthOffset=hu,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.normalTransform=function(t,e,u,n,D,r,i,s){const o=e.a,a=e.b,h=e.c,l=e.d,c=e.e,F=e.f,f=ot(i),C=lt(i);let d,g;s?(d=s[0],g=s[1]):(d=u,g=n);const E=d-u,y=g-n,m=o*f+h*C,p=a*f+l*C,x=h*f-o*C,B=l*f-a*C;t.a=D*m,t.b=D*p,t.c=r*x,t.d=r*B,t.e=c+o*d+h*g-m*E-x*y,t.f=F+a*d+l*g-p*E-B*y},t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(F(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,u]=t;return[e,u,e,u]}if(3===e){const[e,u,n]=t;return[e,u,n,u]}if(4===e)return t}if(a(t)){const{top:e=0,right:u=0,bottom:n=0,left:D=0}=t;return[e,u,n,D]}return[0,0,0,0]},t.pad=q,t.parseUint8ToImageData=(t,e,u)=>{const n=new Uint8ClampedArray(t),D=new Uint8ClampedArray(t.length);for(let t=u-1;t>=0;t--)for(let r=0;r<e;r++){const i=t*e*4+4*r,s=(u-t)*e*4+4*r;D[s]=n[i],D[s+1]=n[i+1],D[s+2]=n[i+2],D[s+3]=n[i+3]}return new ImageData(D,e,u)},t.pi=ut,t.pi2=rt,t.pick=function(t,e){if(!t||!l(t))return t;const u={};return e.forEach((e=>{M.call(t,e)&&(u[e]=t[e])})),u},t.pickWithout=function(t,e){if(!t||!l(t))return t;const u={};return Object.keys(t).forEach((n=>{const D=t[n];let r=!1;e.forEach((t=>{(c(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(u[n]=D)})),u},t.pointAt=function(t,e,u,n,D){let r,i;return"number"==typeof t&&"number"==typeof u&&(r=(1-D)*t+D*u),"number"==typeof e&&"number"==typeof n&&(i=(1-D)*e+D*n),{x:r,y:i}},t.pointBetweenLine=xe,t.pointInAABB=function(t,e){return Kt(t,e,!1)},t.pointInLine=Ee,t.pointInOBB=function(t,e){return de.x=(e.point1.x+e.point2.x)/2,de.y=(e.point1.y+e.point2.y)/2,ge.x=(e.point3.x+e.point4.x)/2,ge.y=(e.point3.y+e.point4.y)/2,Ee(t,de,ge,e.height)},t.pointInRect=Kt,t.polarToCartesian=function(t,e,u){return{x:t.x+e*Math.cos(u),y:t.y+e*Math.sin(u)}},t.polygonContainPoint=Ae,t.polygonIntersectPolygon=function(t,e){for(let u=0;u<e.length;u++){if(Ae(t,e[u].x,e[u].y))return!0;if(u>0&&Me(e[u-1].x,e[u-1].y,e[u].x,e[u].y,t))return!0}return!1},t.pow=Ft,t.quantileSorted=I,t.radianToDegree=Bt,t.range=function(t,e,u){o(e)||(e=t,t=0),o(u)||(u=1);let n=-1;const D=0|Math.max(0,Math.ceil((e-t)/u)),r=new Array(D);for(;++n<D;)r[n]=t+n*u;return r},t.rectInsideAnotherRect=function(e,u,n){return e&&u?(jt=e.x1,zt=e.x2,Yt=e.y1,Wt=e.y2,qt=u.x1,Vt=u.x2,Xt=u.y1,$t=u.y2,n&&(jt>zt&&([jt,zt]=[zt,jt]),Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt])),jt>qt&&zt<Vt&&Yt>Xt&&Wt<$t?t.InnerBBox.BBOX1:qt>jt&&Vt<zt&&Xt>Yt&&$t<Wt?t.InnerBBox.BBOX2:t.InnerBBox.NONE):t.InnerBBox.NONE},t.secondCount=ju,t.secondField=zu,t.secondFloor=ku,t.secondOffset=Pu,t.secondsGetterName=Ge,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.shuffleArray=function(t,e=Math.random){let u,n,D=t.length;for(;D;)u=Math.floor(e()*D),n=t[--D],t[D]=t[u],t[u]=n;return t},t.sin=lt,t.span=t=>t.length<=1?0:L(t)-t[0],t.sqrt=ct,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=we(t)).length)return 0;t=t.replace(Ne()," ");const u=e?1:2;let n=0;for(const e of t){const t=e.codePointAt(0);if(t<=31||t>=127&&t<=159)continue;if(t>=768&&t<=879)continue;switch(Te(e)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n},t.tau=Dt,t.throttle=function(t,e,u){let n=!0,D=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(u)&&(n="leading"in u?!!u.leading:n,D="trailing"in u?!!u.trailing:D),$(t,e,{leading:n,trailing:D,maxWait:e})},t.tickStep=function(t,e,u){const n=Math.abs(e-t)/Math.max(0,u);let D=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/D;return r>=R?D*=10:r>=k?D*=5:r>=P&&(D*=2),e<t?-D:D},t.toDate=J,t.toNumber=H,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,u,n,D,r,i){if(!(it(n)<=et||it(D)<=et)){if(1!==n&&t.scaleX(n),1!==D&&t.scaleY(D),isFinite(r)&&Math.abs(r)>et){let e=0,u=0;void 0!==i&&(e=i[0],u=i[1]),t.rotate(r,e,u)}t.translate(e,u)}},t.transformBoundsWithMatrix=mt,t.truncate=(t,e,u="right",n)=>{const D=s(n)?"…":n,r=t+"",i=r.length,o=Math.max(0,e-D.length);return i<=e?r:"left"===u?D+r.slice(i-o):"center"===u?r.slice(0,Math.ceil(o/2))+D+r.slice(i-Math.floor(o/2)):r.slice(0,o)+D},t.unionAABB=Ce,t.uniqArray=function(t){return t&&F(t)?Array.from(new Set(N(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=Bu,t.utcDayField=bu,t.utcDayFloor=pu,t.utcDayOffset=xu,t.utcHourField=Tu,t.utcHourFloor=wu,t.utcHourOffset=Su,t.utcMinuteField=Ru,t.utcMinuteFloor=Iu,t.utcMinuteOffset=Uu,t.utcMonthCount=Cu,t.utcMonthField=du,t.utcMonthFloor=Fu,t.utcMonthOffset=fu,t.utcSecondField=qu,t.utcSecondFloor=Yu,t.utcSecondOffset=Wu,t.utcYearCount=su,t.utcYearField=ou,t.utcYearFloor=ru,t.utcYearOffset=iu,t.uuid=(t,e)=>{const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];let D;if(e=e||u.length,t)for(D=0;D<t;D++)n[D]=u[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",D=0;D<36;D++)n[D]||(t=0|16*Math.random(),n[D]=u[19===D?3&t|8:t])}return n.join("")},t.variance=U,t.yearCount=nu,t.yearField=Du,t.yearFloor=eu,t.yearOffset=uu}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VUtils={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,u="~";function n(){}function D(t,e,u){this.fn=t,this.context=e,this.once=u||!1}function r(t,e,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new D(n,r||t,i),o=u?u+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],s]:t._events[o].push(s):(t._events[o]=s,t._eventsCount++),t}function i(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(u=!1)),s.prototype.eventNames=function(){var t,n,D=[];if(0===this._eventsCount)return D;for(n in t=this._events)e.call(t,n)&&D.push(u?n.slice(1):n);return Object.getOwnPropertySymbols?D.concat(Object.getOwnPropertySymbols(t)):D},s.prototype.listeners=function(t){var e=u?u+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var D=0,r=n.length,i=new Array(r);D<r;D++)i[D]=n[D].fn;return i},s.prototype.listenerCount=function(t){var e=u?u+t:t,n=this._events[e];return n?n.fn?1:n.length:0},s.prototype.emit=function(t,e,n,D,r,i){var s=u?u+t:t;if(!this._events[s])return!1;var o,a,h=this._events[s],l=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,n),!0;case 4:return h.fn.call(h.context,e,n,D),!0;case 5:return h.fn.call(h.context,e,n,D,r),!0;case 6:return h.fn.call(h.context,e,n,D,r,i),!0}for(a=1,o=new Array(l-1);a<l;a++)o[a-1]=arguments[a];h.fn.apply(h.context,o)}else{var c,F=h.length;for(a=0;a<F;a++)switch(h[a].once&&this.removeListener(t,h[a].fn,void 0,!0),l){case 1:h[a].fn.call(h[a].context);break;case 2:h[a].fn.call(h[a].context,e);break;case 3:h[a].fn.call(h[a].context,e,n);break;case 4:h[a].fn.call(h[a].context,e,n,D);break;default:if(!o)for(c=1,o=new Array(l-1);c<l;c++)o[c-1]=arguments[c];h[a].fn.apply(h[a].context,o)}}return!0},s.prototype.on=function(t,e,u){return r(this,t,e,u,!1)},s.prototype.once=function(t,e,u){return r(this,t,e,u,!0)},s.prototype.removeListener=function(t,e,n,D){var r=u?u+t:t;if(!this._events[r])return this;if(!e)return i(this,r),this;var s=this._events[r];if(s.fn)s.fn!==e||D&&!s.once||n&&s.context!==n||i(this,r);else{for(var o=0,a=[],h=s.length;o<h;o++)(s[o].fn!==e||D&&!s[o].once||n&&s[o].context!==n)&&a.push(s[o]);a.length?this._events[r]=1===a.length?a[0]:a:i(this,r)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=u?u+t:t,this._events[e]&&i(this,e)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=u,s.EventEmitter=s,t.exports=s}(u);var n=e(u.exports);const D=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,r=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||D(t,"Boolean"),i=t=>"function"==typeof t,s=t=>null==t,o=t=>null!=t,a=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},h=t=>"object"==typeof t&&null!==t,l=function(t){if(!h(t)||!D(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},c=(t,e=!1)=>{const u=typeof t;return e?"string"===u:"string"===u||D(t,"String")},F=t=>Array.isArray?Array.isArray(t):D(t,"Array"),f=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},C=t=>D(t,"Date"),d=(t,e=!1)=>{const u=typeof t;return e?"number"===u:"number"===u||D(t,"Number")},g=t=>d(t)&&Number.isFinite(t),E=t=>D(t,"RegExp"),y=Object.prototype,m=Object.prototype.hasOwnProperty;const p=Object.prototype.hasOwnProperty;function x(t,e,u=!1){if(e){if(t===e)return;if(o(e)&&"object"==typeof e){const n=Object(e),D=[];for(const t in n)D.push(t);let{length:r}=D,i=-1;for(;r--;){const r=D[++i];o(n[r])&&"object"==typeof n[r]?B(t,e,r,u):M(t,r,n[r])}}}}function B(t,e,u,n=!1){const D=t[u],r=e[u];let i=e[u],s=!0;if(F(r)){if(n)i=[];else if(F(D))i=D;else if(f(D)){i=new Array(D.length);let t=-1;const e=D.length;for(;++t<e;)i[t]=D[t]}}else l(r)?(i=D,"function"!=typeof D&&"object"==typeof D||(i={})):s=!1;s&&x(i,r,n),M(t,u,i)}function M(t,e,u){(void 0!==u&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],u)||void 0===u&&!(e in t))&&(t[e]=u)}const b=Object.prototype.hasOwnProperty;function A(t){return Object.prototype.toString.call(t)}function v(t){return Object.keys(t)}function _(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function w(t){return F(t)?t.length:a(t)?Object.keys(t).length:0}function S(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const u in t)t.hasOwnProperty(u)&&e.push(u);return e}function T(t,e,u){const n=S(e);for(let D=0;D<n.length;D++){const r=n[D];(u?null!=e[r]:null==t[r])&&(t[r]=e[r])}return t}function N(t){return o(t)?F(t)?t:[t]:[]}function L(t){if(f(t)){return t[t.length-1]}}function O(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function H(t){return Number(t)}function I(t,e,u=H){const n=t.length;if(!n)return;if(e<=0||n<2)return u(t[0],0,t);if(e>=1)return u(t[n-1],n-1,t);const D=(n-1)*e,r=Math.floor(D),i=u(t[r],r,t);return i+(u(t[r+1],r+1,t)-i)*(D-r)}function U(t,e){let u,n=0,D=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(u=e-D,D+=u/++n,r+=u*(e-D));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(s=+s)>=s&&(u=s-D,D+=u/++n,r+=u*(s-D))}return n>1?r/(n-1):0}const R=Math.sqrt(50),k=Math.sqrt(10),P=Math.sqrt(2);const j=1e-10,z=1e-10;function Y(t,e,u=z,n=j){const D=n,r=u*Math.max(t,e);return Math.abs(t-e)<=Math.max(D,r)}const W=(t,e=0)=>{let u="",n=e-1;for(;n>=0;)u=`${u}${t}`,n-=1;return u},q=(t,e,u=" ",n="right")=>{const D=u,r=t+"",i=e-r.length;return i<=0?r:"left"===n?W(D,i)+r:"center"===n?W(D,Math.floor(i/2))+r+W(D,Math.ceil(i/2)):r+W(D,i)},V=function(t,e,u){return t<e?e:t>u?u:t};let X=!1;try{X="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){X=!1}function $(t,e,u){let n,D,r,i,s,o,h=0,l=!1,c=!1,F=!0;const f=!e&&0!==e&&X;if("function"!=typeof t)throw new TypeError("Expected a function");function C(e){const u=n,r=D;return n=D=void 0,h=e,i=t.apply(r,u),i}function d(t,e){return f?(cancelAnimationFrame(s),requestAnimationFrame(t)):setTimeout(t,e)}function E(t){const u=t-o;return void 0===o||u>=e||u<0||c&&t-h>=r}function y(){const t=Date.now();if(E(t))return m(t);s=d(y,function(t){const u=t-h,n=e-(t-o);return c?Math.min(n,r-u):n}(t))}function m(t){return s=void 0,F&&n?C(t):(n=D=void 0,i)}function p(...t){const u=Date.now(),r=E(u);if(n=t,D=this,o=u,r){if(void 0===s)return function(t){return h=t,s=d(y,e),l?C(t):i}(o);if(c)return s=d(y,e),C(o)}return void 0===s&&(s=d(y,e)),i}return e=+e||0,a(u)&&(l=!!u.leading,c="maxWait"in u,c&&(r=Math.max(g(u.maxWait)?u.maxWait:0,e)),F="trailing"in u?!!u.trailing:F),p.cancel=function(){void 0!==s&&function(t){if(f)return cancelAnimationFrame(t);clearTimeout(t)}(s),h=0,n=o=D=s=void 0},p.flush=function(){return void 0===s?i:m(Date.now())},p.pending=function(){return void 0!==s},p}function G(t,e){return u=>t*(1-u)+e*u}X=!1;const Z=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,K=new RegExp(Z.source,"g");const Q=/^(?:(\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 J(t){if(t instanceof Date)return t;if(c(t)){const e=Q.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let u=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(u-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,u,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return s(t)?new Date(NaN):new Date(Math.round(t))}class tt{}const et=1e-12,ut=Math.PI,nt=ut/2,Dt=2*ut,rt=2*Math.PI,it=Math.abs,st=Math.atan2,ot=Math.cos,at=Math.max,ht=Math.min,lt=Math.sin,ct=Math.sqrt,Ft=Math.pow;function ft(t,e,u){const n=u.x-e.x,D=u.y-e.y,r=t.x-e.x,i=t.y-e.y;return Math.abs(n*i-r*D)/Math.sqrt(n*n+D*D)}function Ct(t,e){return t[0]*e[1]-t[1]*e[0]}function dt(t,e){return t.x*e.y-t.y*e.x}function gt(t,e){return it(t[0]-e[0])+it(t[1]-e[1])<et}function Et(t,e=10){return Math.round(t*e)/e}function yt(t){const e=t.toString().split(/[eE]/),u=(e[0].split(".")[1]||"").length-(+e[1]||0);return u>0?u:0}class mt{constructor(t=0,e=0,u,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=u,this.y1=n}clone(){return new mt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return d(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return d(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class pt{constructor(t=0,e=0,u,n){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=u,this.theta1=n}clone(){return new pt(this.r,this.theta)}copyFrom(t){return this.r=t.r,this.theta=t.theta,this.r1=t.r1,this.theta1=t.theta1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.r=t,this.theta=e,this}}function xt(t,e,u){const{x1:n,y1:D,x2:r,y2:i}=e;return u.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(u.e,u.f),e):(t.clear(),t.add(u.a*n+u.c*D+u.e,u.b*n+u.d*D+u.f),t.add(u.a*r+u.c*D+u.e,u.b*r+u.d*D+u.f),t.add(u.a*r+u.c*i+u.e,u.b*r+u.d*i+u.f),t.add(u.a*n+u.c*i+u.e,u.b*n+u.d*i+u.f),e)}class Bt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Bt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,u=0,n=0){return this.x1=t,this.y1=e,this.x2=u,this.y2=n,this}set(t=0,e=0,u=0,n=0){return u<t?(this.x2=t,this.x1=u):(this.x1=t,this.x2=u),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return F(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,u=0){const n=this.rotatedPoints(t,e,u);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,u=0,n=0){const D=this.scalePoints(t,e,u,n);return this.clear().add(D[0],D[1]).add(D[2],D[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return xt(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,u){const{x1:n,y1:D,x2:r,y2:i}=this,s=Math.cos(t),o=Math.sin(t),a=e-e*s+u*o,h=u-e*o-u*s;return[s*n-o*D+a,o*n+s*D+h,s*n-o*i+a,o*n+s*i+h,s*r-o*D+a,o*r+s*D+h,s*r-o*i+a,o*r+s*i+h]}scalePoints(t,e,u,n){const{x1:D,y1:r,x2:i,y2:s}=this;return[t*D+(1-t)*u,e*r+(1-e)*n,t*i+(1-t)*u,e*s+(1-e)*n]}}function Mt(t){return t*(Math.PI/180)}function bt(t){return 180*t/Math.PI}const At=(t=0)=>{if(t<0)for(;t<-Dt;)t+=Dt;else if(t>0)for(;t>Dt;)t-=Dt;return t},vt=At,_t=(t=0)=>t>360||t<-360?t%360:t,wt=_t;class St{constructor(t=1,e=0,u=0,n=1,D=0,r=0){this.a=t,this.b=e,this.c=u,this.d=n,this.e=D,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,u,n,D,r){return!(this.e!==D||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==u)}setValue(t,e,u,n,D,r){return this.a=t,this.b=e,this.c=u,this.d=n,this.e=D,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,u=this.c,n=this.d,D=this.e,r=this.f,i=new St,s=t*n-e*u;return i.a=n/s,i.b=-e/s,i.c=-u/s,i.d=t/s,i.e=(u*r-n*D)/s,i.f=-(t*r-e*D)/s,i}rotate(t){const e=Math.cos(t),u=Math.sin(t),n=this.a*e+this.c*u,D=this.b*e+this.d*u,r=this.a*-u+this.c*e,i=this.b*-u+this.d*e;return this.a=n,this.b=D,this.c=r,this.d=i,this}rotateByCenter(t,e,u){const n=Math.cos(t),D=Math.sin(t),r=(1-n)*e+D*u,i=(1-n)*u-D*e,s=n*this.a-D*this.b,o=D*this.a+n*this.b,a=n*this.c-D*this.d,h=D*this.c+n*this.d,l=n*this.e-D*this.f+r,c=D*this.e+n*this.f+i;return this.a=s,this.b=o,this.c=a,this.d=h,this.e=l,this.f=c,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,u,n,D,r){return this.multiply(t,e,u,n,D,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:u,d:n,e:D,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=u,this.e=r,this.f=D,this}multiply(t,e,u,n,D,r){const i=this.a,s=this.b,o=this.c,a=this.d,h=i*t+o*e,l=s*t+a*e,c=i*u+o*n,F=s*u+a*n,f=i*D+o*r+this.e,C=s*D+a*r+this.f;return this.a=h,this.b=l,this.c=c,this.d=F,this.e=f,this.f=C,this}interpolate(t,e){const u=new St;return u.a=this.a+(t.a-this.a)*e,u.b=this.b+(t.b-this.b)*e,u.c=this.c+(t.c-this.c)*e,u.d=this.d+(t.d-this.d)*e,u.e=this.e+(t.e-this.e)*e,u.f=this.f+(t.f-this.f)*e,u}transformPoint(t,e){const{a:u,b:n,c:D,d:r,e:i,f:s}=this,o=u*r-n*D,a=r/o,h=-n/o,l=-D/o,c=u/o,F=(D*s-r*i)/o,f=-(u*s-n*i)/o,{x:C,y:d}=t;e.x=C*a+d*l+F,e.y=C*h+d*c+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new St(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,u=this.c,n=this.d,D=t*n-e*u,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const i=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/i):-Math.acos(t/i),r.scaleX=i,r.scaleY=D/i,r.skewX=(t*u+e*n)/D,r.skewY=0}else if(0!==u||0!==n){const i=Math.sqrt(u*u+n*n);r.rotateDeg=Math.PI/2-(n>0?Math.acos(-u/i):-Math.acos(u/i)),r.scaleX=D/i,r.scaleY=i,r.skewX=0,r.skewY=(t*u+e*n)/D}return r.rotateDeg=bt(r.rotateDeg),r}}class Tt{static clearCache(t,e){const{CLEAN_THRESHOLD:u=Tt.CLEAN_THRESHOLD,L_TIME:n=Tt.L_TIME,R_COUNT:D=Tt.R_COUNT}=e;if(t.size<u)return 0;let r=0;const i=e=>{r++,t.delete(e)},s=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<D)return i(e);let u=0;for(;s-t.timestamp[t.timestamp.length-1-u]<n&&(u++,!(u>=D)););if(u<D)return i(e);for(;s-t.timestamp[0]>n;)t.timestamp.shift()})),r}static addLimitedTimestamp(t,e,u){const{R_TIMESTAMP_MAX_SIZE:n=Tt.R_TIMESTAMP_MAX_SIZE}=u;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}static clearTimeStamp(t,e){const{L_TIME:u=Tt.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>u;)t.timestamp.shift()}))}static clearItemTimestamp(t,e){const{L_TIME:u=Tt.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>u;)t.timestamp.shift()}}function Nt(t,e,u){e/=100,u/=100;const n=(1-Math.abs(2*u-1))*e,D=n*(1-Math.abs(t/60%2-1)),r=u-n/2;let i=0,s=0,o=0;return 0<=t&&t<60?(i=n,s=D,o=0):60<=t&&t<120?(i=D,s=n,o=0):120<=t&&t<180?(i=0,s=n,o=D):180<=t&&t<240?(i=0,s=D,o=n):240<=t&&t<300?(i=D,s=0,o=n):300<=t&&t<360&&(i=n,s=0,o=D),i=Math.round(255*(i+r)),s=Math.round(255*(s+r)),o=Math.round(255*(o+r)),{r:i,g:s,b:o}}function Lt(t,e,u){t/=255,e/=255,u/=255;const n=Math.min(t,e,u),D=Math.max(t,e,u),r=D-n;let i=0,s=0,o=0;return i=0===r?0:D===t?(e-u)/r%6:D===e?(u-t)/r+2:(t-e)/r+4,i=Math.round(60*i),i<0&&(i+=360),o=(D+n)/2,s=0===r?0:r/(1-Math.abs(2*o-1)),s=+(100*s).toFixed(1),o=+(100*o).toFixed(1),{h:i,s:s,l:o}}Tt.CLEAN_THRESHOLD=1e3,Tt.L_TIME=1e3,Tt.R_COUNT=1,Tt.R_TIMESTAMP_MAX_SIZE=20;const Ot=/^#([0-9a-f]{3,8})$/,Ht={transparent:4294967040},It={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ut(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Rt(t){return d(t)?new Pt(t>>16,t>>8&255,255&t,1):F(t)?new Pt(t[0],t[1],t[2]):new Pt(255,255,255)}class kt{static Brighter(t,e=1){return 1===e?t:new kt(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new kt(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const u=t instanceof kt?t:new kt(t);switch(e){case"hsv":default:return u.getHSVBrightness();case"hsl":return u.getHSLBrightness();case"lum":return u.getLuminance();case"lum2":return u.getLuminance2();case"lum3":return u.getLuminance3()}}static parseColorString(t){if(o(Ht[t]))return function(t){return d(t)?new Pt(t>>>24,t>>>16&255,t>>>8&255,255&t):F(t)?new Pt(t[0],t[1],t[2],t[3]):new Pt(255,255,255,1)}(Ht[t]);if(o(It[t]))return Rt(It[t]);const e=`${t}`.trim().toLowerCase(),u=Ot.exec(e);if(u){const t=parseInt(u[1],16),e=u[1].length;return 3===e?new Pt((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Rt(t):8===e?new Pt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Pt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),u=Nt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Pt(u.r,u.g,u.b,parseFloat(t[3]))}}constructor(t){const e=kt.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Pt(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(t=1){return this.color.opacity=t,this}brighter(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,u){const n=this.color.opacity,D=Lt(this.color.r,this.color.g,this.color.b),r=Nt(s(t)?D.h:V(t,0,360),s(e)?D.s:e>=0&&e<=1?100*e:e,s(u)?D.l:u<=1&&u>=0?100*u:u);return this.color=new Pt(r.r,r.g,r.b,n),this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}}class Pt{constructor(t,e,u,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+u)?255:Math.max(0,Math.min(255,+u)),o(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${Ut(this.r)+Ut(this.g)+Ut(this.b)+(1===this.opacity?"":Ut(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:u,l:n}=Lt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${u}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}var jt=Object.freeze({__proto__:null,Color:kt,DEFAULT_COLORS:It,RGB:Pt,hexToRgb:function(t){let e="",u="",n="";const D="#"===t[0]?1:0;for(let r=D;r<t.length;r++)"#"!==t[r]&&(r<D+2?e+=t[r]:r<D+4?u+=t[r]:r<D+6&&(n+=t[r]));return[parseInt(e,16),parseInt(u,16),parseInt(n,16)]},hslToRgb:Nt,interpolateRgb:function(t,e){const u=t.r,n=e.r,D=t.g,r=e.g,i=t.b,s=e.b,o=t.opacity,a=e.opacity;return t=>{const e=Math.round(u*(1-t)+n*t),h=Math.round(D*(1-t)+r*t),l=Math.round(i*(1-t)+s*t);return new Pt(e,h,l,o*(1-t)+a*t)}},rgbToHex:function(t,e,u){return Number((1<<24)+(t<<16)+(e<<8)+u).toString(16).slice(1)},rgbToHsl:Lt});function zt(t,e,u){t[0]=e[0]-u[0],t[1]=e[1]-u[1]}let Yt,Wt,qt,Vt,Xt,$t,Gt,Zt;function Kt(t,e,u,n){let D,r=t[0],i=e[0],s=u[0],o=n[0];return i<r&&(D=i,i=r,r=D),o<s&&(D=o,o=s,s=D),!(i<s||o<r)&&(r=t[1],i=e[1],s=u[1],o=n[1],i<r&&(D=i,i=r,r=D),o<s&&(D=o,o=s,s=D),!(i<s||o<r))}var Qt;function Jt(t,e,u){return!e||(u?(Yt=e.x1,Wt=e.x2,qt=e.y1,Vt=e.y2,Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),t.x>=Yt&&t.x<=Wt&&t.y>=qt&&t.y<=Vt):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function te(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ee({x:t,y:e},u,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(u)+(e-n.y)*Math.sin(u)+n.x,y:(t-n.x)*Math.sin(u)+(n.y-e)*Math.cos(u)+n.y}}function ue(t){return t/180*Math.PI}function ne(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function De(t,e){const u=e?t.angle:ue(t.angle),n=ne(t);return[ee({x:t.x1,y:t.y1},u,n),ee({x:t.x2,y:t.y1},u,n),ee({x:t.x2,y:t.y2},u,n),ee({x:t.x1,y:t.y2},u,n)]}let re,ie,se,oe,ae,he,le,ce,Fe,fe,Ce,de;function ge(t,e,u=3,n=!1){let D=t.x1,r=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,h=e.y1,l=e.y2;if(n){let t;D>r&&(t=D,D=r,r=t),i>s&&(t=i,i=s,s=t),o>a&&(t=o,o=a,a=t),h>l&&(t=h,h=l,l=t)}if(D>=a||r<=o||i>=l||s<=h)return[t,e];const c=(r-D+2*u)*(s-i+2*u),F=(a-o+2*u)*(l-h+2*u),f=Math.min(D,o),C=Math.min(i,h),d=Math.max(r,a),g=Math.max(s,l);return c+F>(d-f)*(g-C)?[{x1:f,x2:d,y1:C,y2:g}]:[t,e]}t.InnerBBox=void 0,(Qt=t.InnerBBox||(t.InnerBBox={}))[Qt.NONE=0]="NONE",Qt[Qt.BBOX1=1]="BBOX1",Qt[Qt.BBOX2=2]="BBOX2";const Ee={x:0,y:0},ye={x:0,y:0};function me(t,e,u,n){return ft(t,e,u)<=n/2&&Me(t,e,u)}const pe={x:0,y:0},xe={x:0,y:0},Be={x:0,y:0};function Me(t,e,u){return pe.x=e.x-t.x,pe.y=e.y-t.y,xe.x=u.x-t.x,xe.y=u.y-t.y,Be.x=e.y-u.y,Be.y=u.x-e.x,dt(pe,Be)*dt(xe,Be)<0}class be{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:u,fontSize:n,fontFamily:D}){return(t?t+" ":"")+(e?e+" ":"")+(u?u+" ":"")+(n||12)+"px "+(D||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let u=0,n=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?u++:n++;return{width:~~(.8*u*e+n*e),height:e}}static getDefaultUtils(t){return be.instance||(be.instance=new be(t)),be.instance}}const Ae=1e-8;function ve(t,e,u,n,D){for(let r=0,i=D[D.length-1];r<D.length;r++){const s=D[r];if(Kt([t,e],[u,n],[s.x,s.y],[i.x,i.y]))return!0;i=s}return!1}function _e(t,e,u){let n=0,D=t[0];if(!D)return!1;for(let r=1;r<t.length;r++){const i=t[r];n+=we(D.x,D.y,i.x,i.y,e,u),D=i}const r=t[0];return Se(D.x,r.x)&&Se(D.y,r.y)||(n+=we(D.x,D.y,r.x,r.y,e,u)),0!==n}function we(t,e,u,n,D,r){if(r>e&&r>n||r<e&&r<n)return 0;if(n===e)return 0;const i=(r-e)/(n-e);let s=n<e?1:-1;1!==i&&0!==i||(s=n<e?.5:-.5);const o=i*(u-t)+t;return o===D?1/0:o>D?s:0}function Se(t,e){return Math.abs(t-e)<Ae}const Te=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Ne(),"")},Ne=({onlyFirst:t=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")},Le=t=>{let e=t.charCodeAt(0),u=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=u&&u<=57343&&(e&=1023,u&=1023,n=e<<10|u,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},Oe=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uD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DD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function He(t,e={}){const{fontStyle:u=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:D=e.fontWeight,fontSize:r=e.fontSize,fontFamily:i=e.fontFamily}=t;return(u?u+" ":"")+(n?n+" ":"")+(D?D+" ":"")+r+"px "+(i||"sans-serif")}class Ie{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),o(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=o(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(s(this._canvas)&&(o(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),s(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&o(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),s(this._context)&&o(this._canvas)){const t=this._canvas.getContext("2d");o(t)&&(t.save(),t.font=He(this.textSpec),this._contextSaved=!0,this._context=t)}return!s(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,u;const{defaultFontParams:n={}}=this._option,{fontStyle:D=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:i=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:s=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:o=(null!==(u=n.fontFamily)&&void 0!==u?u:"sans-serif"),align:a,textAlign:h=(null!=a?a:"center"),baseline:l,textBaseline:c=(null!=l?l:"middle"),ellipsis:F,limit:f,lineHeight:C=s}=this._userSpec;return{fontStyle:D,fontVariant:r,fontFamily:o,fontSize:s,fontWeight:i,textAlign:h,textBaseline:c,ellipsis:F,limit:f,lineHeight:C}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(s(t))return{width:0,height:0};if(s(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:u,fontWeight:n,textAlign:D,textBaseline:r,ellipsis:i,limit:o,lineHeight:a}=this.textSpec;let h;try{const s=this._option.getTextBounds({text:t,fontFamily:e,fontSize:u,fontWeight:n,textAlign:D,textBaseline:r,ellipsis:!!i,maxLineWidth:o||1/0,lineHeight:a});h={width:s.width(),height:s.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:u,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:u}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let u=0;u<t.length;u++){const n=t[u];let D=this._measureSpecialChar(n);s(D)&&Ie.NUMBERS_CHAR_SET.includes(n)&&(D=this._measureNumberChar()),s(D)&&["F","W"].includes(Le(n))&&(D=this._measureFullSizeChar()),s(D)&&(D=this._measureLetterChar()),e.width+=D.width,e.height=Math.max(e.height,D.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){const e={width:0,height:0},{fontSize:u,lineHeight:n}=this.textSpec;for(let n=0;n<t.length;n++){const D=t[n],r=["F","W"].includes(Le(D))?1:.53;e.width+=r*u}return e.height=null!=n?n:u,e}_measureReduce(t,e){const{fontSize:u,lineHeight:n}=this.textSpec,D={width:0,height:0};if(s(t))return D;if(F(t)){const r=t.filter(o).map((t=>t.toString()));return 0===r.length?D:1===r.length?e(r[0]):{width:r.reduce(((t,u)=>Math.max(t,e(u).width)),0),height:r.length*((null!=n?n:u)+1)+1}}return e(t.toString())}_measureNumberChar(){if(s(this._numberCharSize)){const t=this._standardMethod(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return s(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(s(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return o(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){o(this._canvas)&&(this._canvas=null),o(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const Ue=()=>je.NUMBERS_CHAR_SET[Math.floor(Math.random()*je.NUMBERS_CHAR_SET.length)],Re=t=>Array(t).fill(0).map(Ue).join(""),ke=()=>je.ALPHABET_CHAR_SET[Math.floor(Math.random()*je.ALPHABET_CHAR_SET.length)],Pe=t=>Array(t).fill(0).map(ke).join("");class je extends Ie{test(t,e,u){const n=t=>(t=>t.reduce(((t,e)=>t+e),0))(t)/t.length,D=t=>{const e=n(t);return n(t.map((t=>Math.pow(t-e,2))))},r=null!=e?e:()=>`测试${Pe(8)} ${Re(4)}/${Re(2)}-${Re(2)}`,i=Array(null!=u?u:1e5).fill(0).map(r),o={vrender:this.fullMeasure.bind(this),canvas:this.measureWithNaiveCanvas.bind(this),simple:this.quickMeasureWithoutCanvas.bind(this),quick:this.quickMeasure.bind(this),old:t=>{if(s(t))return{width:0,height:0};const e=t.toString(),{fontSize:u}=this.textSpec;return{width:.8*u*e.length,height:u}}},a=null!=t?t:Object.keys(o),h={},l=performance.now(),c=i.map(this._standardMethod),F=performance.now()-l;return h.standard={time:F},a.forEach((t=>{const e=o[t];if(e){const u=performance.now(),r=i.map(e),s=performance.now()-u,o=i.map(((t,e)=>({width:r[e].width-c[e].width,height:r[e].height-c[e].height})));h[t]={errMean:{width:n(o.map((t=>t.width))),height:n(o.map((t=>t.height)))},errVar:{width:D(o.map((t=>t.width))),height:D(o.map((t=>t.height)))},time:s}}})),{report:h,textArr:i}}}const ze="undefined"!=typeof console;function Ye(t,e,u){const n=[e].concat([].slice.call(u));ze&&console[t].apply(console,n)}var We;t.LoggerLevel=void 0,(We=t.LoggerLevel||(t.LoggerLevel={}))[We.None=0]="None",We[We.Error=1]="Error",We[We.Warn=2]="Warn",We[We.Info=3]="Info",We[We.Debug=4]="Debug";class qe{static getInstance(t,e){return qe._instance&&d(t)?qe._instance.level(t):qe._instance||(qe._instance=new qe(t,e)),qe._instance}static setInstance(t){return qe._instance=t}static setInstanceLevel(t){qe._instance?qe._instance.level(t):qe._instance=new qe(t)}static clearInstance(){qe._instance=null}constructor(e=t.LoggerLevel.None,u){this._onErrorHandler=[],this._level=e,this._method=u}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=t.LoggerLevel.Info}canLogDebug(){return this._level>=t.LoggerLevel.Debug}canLogError(){return this._level>=t.LoggerLevel.Error}canLogWarn(){return this._level>=t.LoggerLevel.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...e){var u;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):Ye(null!==(u=this._method)&&void 0!==u?u:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&Ye(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&Ye(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&Ye(this._method||"log","DEBUG",e),this}}function Ve(t){return t?"getUTCFullYear":"getFullYear"}function Xe(t){return t?"getUTCMonth":"getMonth"}function $e(t){return t?"getUTCDate":"getDate"}function Ge(t){return t?"getUTCHours":"getHours"}function Ze(t){return t?"getUTCMinutes":"getMinutes"}function Ke(t){return t?"getUTCSeconds":"getSeconds"}function Qe(t){return t?"getUTCMilliseconds":"getMilliseconds"}qe._instance=null;const Je=1e3,tu=6e4,eu=36e5,uu=24*eu,nu=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),Du=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ru=(t,e)=>e.getFullYear()-t.getFullYear(),iu=t=>t.getFullYear(),su=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ou=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),au=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),hu=t=>t.getUTCFullYear(),lu=t=>(t.setDate(1),t.setHours(0,0,0,0),t),cu=(t,e)=>(t.setMonth(t.getMonth()+e),t),Fu=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),fu=t=>t.getMonth(),Cu=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),du=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),gu=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Eu=t=>t.getUTCMonth(),yu=t=>(t.setHours(0,0,0,0),t),mu=(t,e)=>(t.setDate(t.getDate()+e),t),pu=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*tu)/uu,xu=t=>t.getDate()-1,Bu=t=>(t.setUTCHours(0,0,0,0),t),Mu=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),bu=(t,e)=>(+e-+t)/uu,Au=t=>t.getUTCDate()-1,vu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Je-t.getMinutes()*tu),t),_u=(t,e)=>(t.setHours(t.getHours()+e),t),wu=(t,e)=>(+e-+t)/eu,Su=t=>t.getHours(),Tu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Je-t.getUTCMinutes()*tu),t),Nu=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Lu=t=>t.getUTCHours(),Ou=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Je),t),Hu=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Iu=(t,e)=>(+e-+t)/tu,Uu=t=>t.getMinutes(),Ru=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Je),t),ku=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Pu=t=>t.getUTCMinutes(),ju=t=>(t.setTime(+t-t.getMilliseconds()),t),zu=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Yu=(t,e)=>(+e-+t)/Je,Wu=t=>t.getSeconds(),qu=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Vu=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Xu=t=>t.getUTCSeconds(),$u=t=>t,Gu=(t,e)=>(t.setTime(+t+e),t),Zu=(t,e)=>+e-+t,Ku=(t,e)=>u=>{const n=new Date(+u-1);return e(n,1),t(n),n},Qu=(t,e)=>(u,n)=>{const D=new Date,r=new Date;return D.setTime(+u),r.setTime(+n),t(D),t(r),Math.floor(e(D,r))};function Ju(t){const{x:e,y:u}=t.getBoundingClientRect();return{x:e,y:u}}const tn=t=>t.getBoundingClientRect().width/t.offsetWidth,en=t=>t.getBoundingClientRect().height/t.offsetHeight;var un=6371008.8,nn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*un,kilometers:6371.0088,kilometres:6371.0088,meters:un,metres:un,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:un/1852,radians:1,yards:6967335.223679999};t.AABBBounds=class extends Bt{},t.Bounds=Bt,t.ColorUtil=jt,t.DAY=uu,t.EventEmitter=n,t.GraphicUtil=be,t.HOUR=eu,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const u=new tt;u.key=t,u.value=e;let n=this.itemList.length;return this.has(t)&&(n=this.items[t].index),u.index=n,this.itemList[n]=u,this.items[t]=u,u}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const u=this.itemList.indexOf(e);this.items[t].index=u}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items){if(!1===t(e,this.items[e].value))return!1}return!0}foreachHashv(t){for(const e in this.items){if(!1===t(e,this.items[e]))return!1}return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,u){const n=new tt;n.index=t,n.key=u,n.value=e,this.itemList.splice(t,0,n),this.items[u]=n,this.resetIndex()}sort(t){return this.itemList.sort(((e,u)=>t(e.value,u.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=tt,t.LRU=Tt,t.Logger=qe,t.MINUTE=tu,t.MONTH=26784e5,t.Matrix=St,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.OBBBounds=class extends Bt{},t.Point=mt,t.PointService=class{static distancePP(t,e){return ct(Ft(t.x-e.x,2)+Ft(t.y-e.y,2))}static distanceNN(t,e,u,n){return ct(Ft(t-u,2)+Ft(e-n,2))}static distancePN(t,e,u){return ct(Ft(e-t.x,2)+Ft(u-t.y,2))}static pointAtPP(t,e,u){return new mt((e.x-t.x)*u+t.x,(e.y-t.y)*u+t.y)}},t.PolarPoint=pt,t.SECOND=Je,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TestTextMeasure=je,t.TextMeasure=Ie,t.YEAR=31536e6,t.abs=it,t.acos=function(t){return t>1?0:t<-1?ut:Math.acos(t)},t.array=N,t.arrayEqual=function(t,e){if(!F(t)||!F(e))return!1;if(t.length!==e.length)return!1;for(let u=0;u<t.length;u++)if(t[u]!==e[u])return!1;return!0},t.ascending=O,t.asin=function(t){return t>=1?nt:t<=-1?-nt:Math.asin(t)},t.atan2=st,t.bisect=function(t,e,u=0,n){for(s(n)&&(n=t.length);u<n;){const D=u+n>>>1;O(t[D],e)>0?n=D:u=D+1}return u},t.clamp=V,t.clampAngleByDegree=wt,t.clampAngleByRadian=vt,t.clampDegree=_t,t.clampRadian=At,t.clampRange=(t,e,u)=>{let[n,D]=t;D<n&&(n=t[1],D=t[0]);const r=D-n;return r>=u-e?[e,u]:(n=Math.min(Math.max(n,e),u-r),[n,n+r])},t.clamper=function(t,e){let u;return t>e&&(u=t,t=e,e=u),u=>Math.max(t,Math.min(e,u))},t.clone=function(t,e=!1,u=0,n=void 0){const D=[],r=[];return void 0===e&&(e=!0),void 0===u&&(u=1/0),function t(u,i){if(null===u)return null;if(0===i)return u;let s;if("object"!=typeof u)return u;if(F(u)?s=[]:E(u)?(s=new RegExp(u.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(u)),u.lastIndex&&(s.lastIndex=u.lastIndex)):s=C(u)?new Date(u.getTime()):void 0===n?Object.create(Object.getPrototypeOf(u)):Object.create(n),e){const t=D.indexOf(u);if(-1!==t)return r[t];D.push(u),r.push(s)}for(const e in u)s[e]=t(u[e],i-1);return s}(t,u)},t.cloneDeep=function t(e){let u;if(!o(e)||"object"!=typeof e)return e;const n=F(e),D=e.length;u=n?new Array(D):"object"==typeof e?{}:r(e)||d(e)||c(e)?e:C(e)?new Date(+e):void 0;const i=n?void 0:Object.keys(Object(e));let s=-1;if(u)for(;++s<(i||e).length;){const n=i?i[s]:s,D=e[n];u[n]=t(D)}return u},t.constant=t=>i(t)?t:()=>t,t.cos=ot,t.crossProduct=Ct,t.crossProductPoint=dt,t.dateGetterName=$e,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=pu,t.dayField=xu,t.dayFloor=yu,t.dayOffset=mu,t.debounce=$,t.defaults=T,t.degreeToRadian=Mt,t.destination=function(t,e,u,n={}){const D=Mt(t[0]),r=Mt(t[1]),i=Mt(u),s=function(t,e){void 0===e&&(e="kilometers");var u=nn[e];if(!u)throw new Error(e+" units is invalid");return t/u}(e,n.units),o=Math.asin(Math.sin(r)*Math.cos(s)+Math.cos(r)*Math.sin(s)*Math.cos(i));return{x:bt(D+Math.atan2(Math.sin(i)*Math.sin(s)*Math.cos(r),Math.cos(s)-Math.sin(r)*Math.sin(o))),y:bt(o)}},t.deviation=function(t,e){const u=U(t,e);return u?Math.sqrt(u):u},t.eastAsianCharacterInfo=Le,t.epsilon=et,t.fixPrecision=Et,t.flattenArray=function t(e){if(!F(e))return[e];const u=[];for(const n of e)u.push(...t(n));return u},t.fullYearGetterName=Ve,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return it(t-e)<et},t.fuzzyEqualVec=gt,t.generateCeil=Ku,t.generateCount=Qu,t.generateStepInterval=(t,{floor:e,offset:u,field:n,count:D})=>{const r=Math.floor(t);if(!Number.isFinite(r)||r<=0)return null;if(r<=1)return{floor:e,offset:u,ceil:Ku(e,u)};const i=Qu(e,D),s=n?t=>n(t)%r==0:t=>i(0,t)%r==0,o=t=>{if(!Number.isNaN(+t))for(e(t);!s(t);)t.setTime(+t-1),e(t);return t},a=(t,e)=>{if(!Number.isNaN(+t))if(r<0)for(;++e<=0;)for(u(t,-1);!s(t);)u(t,-1);else for(;--e>=0;)for(u(t,1);!s(t);)u(t,1);return t};return{floor:o,offset:a,ceil:Ku(o,a)}},t.get=(t,e,u)=>{const n=c(e)?e.split("."):e;for(let e=0;e<n.length;e++)t=t?t[n[e]]:void 0;return void 0===t?u:t},t.getAABBFromPoints=function(t){return re=1/0,ie=1/0,se=-1/0,oe=-1/0,t.forEach((t=>{re>t.x&&(re=t.x),se<t.x&&(se=t.x),ie>t.y&&(ie=t.y),oe<t.y&&(oe=t.y)})),{x1:re,y1:ie,x2:se,y2:oe}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getContainerSize=function(t,e=0,u=0){if(!t)return{width:e,height:u};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const D=n(t),r=parseFloat(D.width)-parseFloat(D.paddingLeft)-parseFloat(D.paddingRight)||t.clientWidth-1,i=parseFloat(D.height)-parseFloat(D.paddingTop)-parseFloat(D.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:i<=0?u:i}},t.getContextFont=He,t.getDecimalPlaces=yt,t.getElementAbsolutePosition=Ju,t.getElementRelativePosition=function(t,e){const u=Ju(t),n=Ju(e);return{x:u.x-n.x,y:u.y-n.y}},t.getFormatFromValue=function(t,e){const u=J(t),n=u[Xe(e)]()+1,D=u[$e(e)](),r=u[Ge(e)](),i=u[Ze(e)](),s=u[Ke(e)](),o=0===u[Qe(e)](),a=o&&0===s,h=a&&0===i,l=h&&0===r,c=l&&1===D;return c&&1===n?"YYYY":c?"YYYY-MM":l?"YYYY-MM-DD":h?"HH":a?"HH:mm":o?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,u,n){if(!Kt(t,e,u,n))return!1;const D=[0,0],r=[0,0],i=[0,0];if(zt(D,e,t),zt(r,n,u),gt(D,r))return!0;zt(i,u,t);const s=Ct(i,r)/Ct(D,r);return s>=0&&s<=1&&[t[0]+D[0]*s,t[1]+D[1]*s]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:su,offset:ou,count:au,field:hu}:"month"===t&&e?{floor:Cu,offset:du,count:gu,field:Eu}:"day"===t&&e?{floor:Bu,offset:Mu,count:bu,field:Au}:"hour"===t&&e?{floor:Tu,offset:Nu,count:wu,field:Lu}:"minute"===t&&e?{floor:Ru,offset:ku,count:Iu,field:Pu}:"second"===t&&e?{floor:qu,offset:Vu,count:Yu,field:Xu}:"year"===t?{floor:nu,offset:Du,count:ru,field:iu}:"month"===t?{floor:lu,offset:cu,count:Fu,field:fu}:"day"===t?{floor:yu,offset:mu,count:pu,field:xu}:"hour"===t?{floor:vu,offset:_u,count:wu,field:Su}:"minute"===t?{floor:Ou,offset:Hu,count:Iu,field:Uu}:"second"===t?{floor:ju,offset:zu,count:Yu,field:Wu}:{floor:$u,offset:Gu,count:Zu},t.getOBBFromLine=function(t,e,u){return ae=e.x-t.x,he=e.y-t.y,le=he,ce=-ae,Ce=Fe=Math.sqrt(le*le+ce*ce),de=u,le/=Fe,ce/=Fe,fe=u/2,ae=fe*le,he=fe*ce,{point1:{x:t.x+ae,y:t.y+he},point2:{x:t.x-ae,y:t.y-he},point3:{x:e.x+ae,y:e.y+he},point4:{x:e.x-ae,y:e.y-he},width:Ce,height:de,left:Math.min(t.x,e.x)-Math.abs(ae),top:Math.min(t.y,e.y)-Math.abs(he)}},t.getRectIntersect=function(t,e,u){return null===t?e:null===e?t:(Yt=t.x1,Wt=t.x2,qt=t.y1,Vt=t.y2,Xt=e.x1,$t=e.x2,Gt=e.y1,Zt=e.y2,u&&(Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt]),Gt>Zt&&([Gt,Zt]=[Zt,Gt])),Yt>=$t||Wt<=Xt||qt>=Zt||Vt<=Gt?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Yt,Xt),y1:Math.max(qt,Gt),x2:Math.min(Wt,$t),y2:Math.min(Vt,Zt)})},t.getScale=t=>t.offsetWidth>0?tn(t):en(t),t.getScaleX=tn,t.getScaleY=en,t.getScrollLeft=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTestNumbers=Re,t.getTestWord=Pe,t.getTimeFormatter=function(t,e){return u=>{const n=J(u),D=n[Ve(e)](),r=n[Xe(e)]()+1,i=Math.floor((r-1)/3)+1,s=n[$e(e)](),o=n["get"+(e?"UTC":"")+"Day"](),a=n[Ge(e)](),h=(a-1)%12+1,l=n[Ze(e)](),c=n[Ke(e)](),F=n[Qe(e)]();return(t||"").replace(/YYYY/g,q(D+"",4,"0","left")).replace(/yyyy/g,D+"").replace(/yy/g,D%100+"").replace(/Q/g,i+"").replace(/MM/g,q(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,q(s,2,"0","left")).replace(/d/g,s+"").replace(/e/g,o+"").replace(/HH/g,q(a,2,"0","left")).replace(/H/g,a+"").replace(/hh/g,q(h+"",2,"0","left")).replace(/h/g,h+"").replace(/mm/g,q(l,2,"0","left")).replace(/m/g,l+"").replace(/ss/g,q(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,q(F,3,"0","left")).replace(/S/g,F+"")}},t.halfPi=nt,t.has=(t,e)=>null!=t&&p.call(t,e),t.hasParentElement=function(t,e){let u=t.parentNode;for(;null!==u;){if(u===e)return!0;u=u.parentNode}return!1},t.hourCount=wu,t.hourField=Su,t.hourFloor=vu,t.hourOffset=_u,t.hoursGetterName=Ge,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.interpolateDate=function(t,e){const u=t.valueOf(),n=e.valueOf(),D=new Date;return t=>(D.setTime(u*(1-t)+n*t),D)},t.interpolateNumber=G,t.interpolateNumberRound=function(t,e){return function(u){return Math.round(t*(1-u)+e*u)}},t.interpolateString=function(t,e){let u,n,D,r=Z.lastIndex=K.lastIndex=0,i=-1;const s=[],o=[];for(t+="",e+="";(u=Z.exec(t))&&(n=K.exec(e));)(D=n.index)>r&&(D=e.slice(r,D),s[i]?s[i]+=D:s[++i]=D),(u=u[0])===(n=n[0])?s[i]?s[i]+=n:s[++i]=n:(s[++i]=null,o.push({i:i,x:G(u,n)})),r=K.lastIndex;return r<e.length&&(D=e.slice(r),s[i]?s[i]+=D:s[++i]=D),s.length<2?o[0]?function(t){return function(e){return t(e)+""}}(o[0].x):function(t){return function(){return t}}(e):(e=o.length,function(t){for(let u,n=0;n<e;++n)s[(u=o[n]).i]=u.x(t);return s.join("")})},t.isArray=F,t.isArrayLike=f,t.isBase64=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=r,t.isDate=C,t.isEmpty=function(t){if(s(t))return!0;if(f(t))return!t.length;const e=(t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")))(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||y)}(t))return!Object.keys(t).length;for(const e in t)if(m.call(t,e))return!1;return!0},t.isEqual=function t(e,u){if(e===u)return!0;if(typeof e!=typeof u)return!1;if(null==e||null==u)return!1;if(Number.isNaN(e)&&Number.isNaN(u))return!0;if(A(e)!==A(u))return!1;if(i(e))return!1;if("object"!=typeof e)return!1;if(F(e)){if(e.length!==u.length)return!1;for(let n=e.length-1;n>=0;n--)if(!t(e[n],u[n]))return!1;return!0}if(!l(e))return!1;const n=v(e),D=v(u);if(n.length!==D.length)return!1;n.sort(),D.sort();for(let t=n.length-1;t>=0;t--)if(n[t]!=D[t])return!1;for(let D=n.length-1;D>=0;D--){const r=n[D];if(!t(e[r],u[r]))return!1}return!0},t.isFunction=i,t.isGreater=function(t,e,u,n){return t>e&&!Y(t,e,u,n)},t.isIntersect=Kt,t.isLess=function(t,e,u,n){return t<e&&!Y(t,e,u,n)},t.isNil=s,t.isNull=t=>null===t,t.isNumber=d,t.isNumberClose=Y,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=a,t.isObjectLike=h,t.isPlainObject=l,t.isPointInLine=we,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const u="Feature"===(n=e).type?n.geometry:n;var n;const D=u.type,r=e.bbox;let i=u.coordinates;if(r&&!0===Jt(t,{x1:r[0],x2:r[1],y1:r[1],y2:r[3]},!0))return!1;"Polygon"===D&&(i=[i]);let s=!1;for(let e=0;e<i.length;++e)for(let u=0;u<i[e].length;++u){if(_e(i[e][u].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return s=!0,s}return s},t.isRectIntersect=function(t,e,u){return!t||!e||(u?(Yt=t.x1,Wt=t.x2,qt=t.y1,Vt=t.y2,Xt=e.x1,$t=e.x2,Gt=e.y1,Zt=e.y2,Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt]),Gt>Zt&&([Gt,Zt]=[Zt,Gt]),!(Yt>$t||Wt<Xt||qt>Zt||Vt<Gt)):!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1))},t.isRegExp=E,t.isRotateAABBIntersect=function(t,e,u=!1,n){const D=De(t,u),r=De(e,u),i=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,D.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const s=ne(t),o=ne(e);n&&n.fillRect(s.x,s.y,2,2),n&&n.fillRect(o.x,o.y,2,2);const a=i(s,o),h=i(D[0],D[1]),l=i(D[1],D[2]),c=i(r[0],r[1]),F=i(r[1],r[2]),f=u?t.angle:ue(t.angle);let C=u?t.angle+nt:ue(90-t.angle);const d=u?e.angle:ue(e.angle);let g=u?e.angle+nt:ue(90-e.angle);C>rt&&(C-=rt),g>rt&&(g-=rt);const E=(t,e,u,n)=>{const D=[Math.cos(e),Math.sin(e)];return t+(te(D,u)+te(D,n))/2>te(D,a)};return E((t.x2-t.x1)/2,f,c,F)&&E((t.y2-t.y1)/2,C,c,F)&&E((e.x2-e.x1)/2,d,h,l)&&E((e.y2-e.y1)/2,g,h,l)},t.isShallowEqual=function(t,e){if(_(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(F(t)!==F(e))return!1;if(w(t)!==w(e))return!1;let u=!0;return Object.keys(t).forEach((n=>!!_(t[n],e[n])||(u=!1,u))),u},t.isString=c,t.isType=D,t.isUndefined=t=>void 0===t,t.isValid=o,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.keys=S,t.last=L,t.lengthFromPointToLine=ft,t.lineIntersectPolygon=ve,t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=at,t.maxInArray=function(t){if(t&&F(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)},t.median=(t,e)=>{let u=t;return!0!==e&&(u=t.sort(O)),I(u,.5)},t.memoize=t=>{let e=null,u=null;return(...n)=>(e&&n.every(((t,u)=>t===e[u]))||(e=n,u=t(...n)),u)},t.merge=function(t,...e){let u=-1;const n=e.length;for(;++u<n;){x(t,e[u],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(u,n){const D=[];n.forEach((t=>{let e;(e=ge(u,t)).length>1?D.push(t):u=e[0]})),e.push(u),D.length&&t(D[0],D.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=Zu,t.millisecondsFloor=$u,t.millisecondsGetterName=Qe,t.millisecondsOffset=Gu,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=ht,t.minInArray=function(t){if(t&&F(t))return t.reduce(((t,e)=>Math.min(t,e)),1/0)},t.minuteCount=Iu,t.minuteField=Uu,t.minuteFloor=Ou,t.minuteOffset=Hu,t.minutesGetterName=Ze,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,u=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let D=0;D<n.length;D++){const r=n[D];"constructor"!==r&&(u?null!=e[r]:null==t[r])&&(t[r]=e[r])}}else T(t,e,u)},t.monthCount=Fu,t.monthField=fu,t.monthFloor=lu,t.monthGetterName=Xe,t.monthOffset=cu,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.normalTransform=function(t,e,u,n,D,r,i,s){const o=e.a,a=e.b,h=e.c,l=e.d,c=e.e,F=e.f,f=ot(i),C=lt(i);let d,g;s?(d=s[0],g=s[1]):(d=u,g=n);const E=d-u,y=g-n,m=o*f+h*C,p=a*f+l*C,x=h*f-o*C,B=l*f-a*C;t.a=D*m,t.b=D*p,t.c=r*x,t.d=r*B,t.e=c+o*d+h*g-m*E-x*y,t.f=F+a*d+l*g-p*E-B*y},t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(F(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,u]=t;return[e,u,e,u]}if(3===e){const[e,u,n]=t;return[e,u,n,u]}if(4===e)return t}if(a(t)){const{top:e=0,right:u=0,bottom:n=0,left:D=0}=t;return[e,u,n,D]}return[0,0,0,0]},t.pad=q,t.parseUint8ToImageData=(t,e,u)=>{const n=new Uint8ClampedArray(t),D=new Uint8ClampedArray(t.length);for(let t=u-1;t>=0;t--)for(let r=0;r<e;r++){const i=t*e*4+4*r,s=(u-t)*e*4+4*r;D[s]=n[i],D[s+1]=n[i+1],D[s+2]=n[i+2],D[s+3]=n[i+3]}return new ImageData(D,e,u)},t.pi=ut,t.pi2=rt,t.pick=function(t,e){if(!t||!l(t))return t;const u={};return e.forEach((e=>{b.call(t,e)&&(u[e]=t[e])})),u},t.pickWithout=function(t,e){if(!t||!l(t))return t;const u={};return Object.keys(t).forEach((n=>{const D=t[n];let r=!1;e.forEach((t=>{(c(t)&&t===n||t instanceof RegExp&&n.match(t))&&(r=!0)})),r||(u[n]=D)})),u},t.pointAt=function(t,e,u,n,D){let r,i;return"number"==typeof t&&"number"==typeof u&&(r=(1-D)*t+D*u),"number"==typeof e&&"number"==typeof n&&(i=(1-D)*e+D*n),{x:r,y:i}},t.pointBetweenLine=Me,t.pointInAABB=function(t,e){return Jt(t,e,!1)},t.pointInLine=me,t.pointInOBB=function(t,e){return Ee.x=(e.point1.x+e.point2.x)/2,Ee.y=(e.point1.y+e.point2.y)/2,ye.x=(e.point3.x+e.point4.x)/2,ye.y=(e.point3.y+e.point4.y)/2,me(t,Ee,ye,e.height)},t.pointInRect=Jt,t.polarToCartesian=function(t,e,u){return{x:t.x+e*Math.cos(u),y:t.y+e*Math.sin(u)}},t.polygonContainPoint=_e,t.polygonIntersectPolygon=function(t,e){for(let u=0;u<e.length;u++){if(_e(t,e[u].x,e[u].y))return!0;if(u>0&&ve(e[u-1].x,e[u-1].y,e[u].x,e[u].y,t))return!0}return!1},t.pow=Ft,t.precisionAdd=function(t,e){return Et(t+e,10**Math.max(yt(t),yt(e)))},t.precisionSub=function(t,e){return Et(t-e,10**Math.max(yt(t),yt(e)))},t.quantileSorted=I,t.radianToDegree=bt,t.range=function(t,e,u){o(e)||(e=t,t=0),o(u)||(u=1);let n=-1;const D=0|Math.max(0,Math.ceil((e-t)/u)),r=new Array(D);for(;++n<D;)r[n]=t+n*u;return r},t.rectInsideAnotherRect=function(e,u,n){return e&&u?(Yt=e.x1,Wt=e.x2,qt=e.y1,Vt=e.y2,Xt=u.x1,$t=u.x2,Gt=u.y1,Zt=u.y2,n&&(Yt>Wt&&([Yt,Wt]=[Wt,Yt]),qt>Vt&&([qt,Vt]=[Vt,qt]),Xt>$t&&([Xt,$t]=[$t,Xt]),Gt>Zt&&([Gt,Zt]=[Zt,Gt])),Yt>Xt&&Wt<$t&&qt>Gt&&Vt<Zt?t.InnerBBox.BBOX1:Xt>Yt&&$t<Wt&&Gt>qt&&Zt<Vt?t.InnerBBox.BBOX2:t.InnerBBox.NONE):t.InnerBBox.NONE},t.secondCount=Yu,t.secondField=Wu,t.secondFloor=ju,t.secondOffset=zu,t.secondsGetterName=Ke,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.shuffleArray=function(t,e=Math.random){let u,n,D=t.length;for(;D;)u=Math.floor(e()*D),n=t[--D],t[D]=t[u],t[u]=n;return t},t.sin=lt,t.span=t=>t.length<=1?0:L(t)-t[0],t.sqrt=ct,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Te(t)).length)return 0;t=t.replace(Oe()," ");const u=e?1:2;let n=0;for(const e of t){const t=e.codePointAt(0);if(t<=31||t>=127&&t<=159)continue;if(t>=768&&t<=879)continue;switch(Le(e)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n},t.tau=Dt,t.throttle=function(t,e,u){let n=!0,D=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(u)&&(n="leading"in u?!!u.leading:n,D="trailing"in u?!!u.trailing:D),$(t,e,{leading:n,trailing:D,maxWait:e})},t.tickStep=function(t,e,u){const n=Math.abs(e-t)/Math.max(0,u);let D=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/D;return r>=R?D*=10:r>=k?D*=5:r>=P&&(D*=2),e<t?-D:D},t.toDate=J,t.toNumber=H,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,u,n,D,r,i){if(!(it(n)<=et||it(D)<=et)){if(1!==n&&t.scaleX(n),1!==D&&t.scaleY(D),isFinite(r)&&Math.abs(r)>et){let e=0,u=0;void 0!==i&&(e=i[0],u=i[1]),t.rotate(r,e,u)}t.translate(e,u)}},t.transformBoundsWithMatrix=xt,t.truncate=(t,e,u="right",n)=>{const D=s(n)?"…":n,r=t+"",i=r.length,o=Math.max(0,e-D.length);return i<=e?r:"left"===u?D+r.slice(i-o):"center"===u?r.slice(0,Math.ceil(o/2))+D+r.slice(i-Math.floor(o/2)):r.slice(0,o)+D},t.unionAABB=ge,t.uniqArray=function(t){return t&&F(t)?Array.from(new Set(N(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=bu,t.utcDayField=Au,t.utcDayFloor=Bu,t.utcDayOffset=Mu,t.utcHourField=Lu,t.utcHourFloor=Tu,t.utcHourOffset=Nu,t.utcMinuteField=Pu,t.utcMinuteFloor=Ru,t.utcMinuteOffset=ku,t.utcMonthCount=gu,t.utcMonthField=Eu,t.utcMonthFloor=Cu,t.utcMonthOffset=du,t.utcSecondField=Xu,t.utcSecondFloor=qu,t.utcSecondOffset=Vu,t.utcYearCount=au,t.utcYearField=hu,t.utcYearFloor=su,t.utcYearOffset=ou,t.uuid=(t,e)=>{const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];let D;if(e=e||u.length,t)for(D=0;D<t;D++)n[D]=u[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",D=0;D<36;D++)n[D]||(t=0|16*Math.random(),n[D]=u[19===D?3&t|8:t])}return n.join("")},t.variance=U,t.yearCount=ru,t.yearField=iu,t.yearFloor=nu,t.yearOffset=Du}));
|
package/es/math.d.ts
CHANGED
|
@@ -64,3 +64,6 @@ export declare function crossProductPoint(dir1: {
|
|
|
64
64
|
export declare function fuzzyEqualNumber(a: number, b: number): boolean;
|
|
65
65
|
export declare function fuzzyEqualVec(a: vec2, b: vec2): boolean;
|
|
66
66
|
export declare function fixPrecision(num: number, precision?: number): number;
|
|
67
|
+
export declare function getDecimalPlaces(n: number): number;
|
|
68
|
+
export declare function precisionAdd(a: number, b: number): number;
|
|
69
|
+
export declare function precisionSub(a: number, b: number): number;
|
package/es/math.js
CHANGED
|
@@ -73,4 +73,17 @@ export function fuzzyEqualVec(a, b) {
|
|
|
73
73
|
export function fixPrecision(num, precision = 10) {
|
|
74
74
|
return Math.round(num * precision) / precision;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
export function getDecimalPlaces(n) {
|
|
78
|
+
const dStr = n.toString().split(/[eE]/), s = (dStr[0].split(".")[1] || "").length - (+dStr[1] || 0);
|
|
79
|
+
return s > 0 ? s : 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function precisionAdd(a, b) {
|
|
83
|
+
return fixPrecision(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function precisionSub(a, b) {
|
|
87
|
+
return fixPrecision(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
88
|
+
}
|
|
76
89
|
//# sourceMappingURL=math.js.map
|
package/es/math.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC;AAC7B,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,CAA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AAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAA8B,EAAE,IAA8B;IAC9F,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,CAAO,EAAE,CAAO;IAC5C,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,SAAS,GAAG,EAAE;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AACjD,CAAC","file":"math.js","sourcesContent":["export const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\nexport const NEWTON_ITERATIONS = 4;\nexport const NEWTON_MIN_SLOPE = 0.001;\nexport const SUBDIVISION_PRECISION = 0.0000001;\nexport const SUBDIVISION_MAX_ITERATIONS = 10;\nexport const pi2 = Math.PI * 2;\n\nexport type vec2 = [number, number] | Float32Array;\nexport type vec3 = [number, number, number] | Float32Array;\nexport type vec4 = [number, number, number, number] | Float32Array;\nexport type vec8 = [number, number, number, number, number, number, number, number] | Float32Array;\nexport type mat4 =\n | [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n ]\n | Float32Array;\n\nexport const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\nexport const pow = Math.pow;\n\nexport function acos(x: number) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x: number) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n\n/**\n * 根据比例获直线上的点\n * @param {number} x1 起始点 x\n * @param {number} y1 起始点 y\n * @param {number} x2 结束点 x\n * @param {number} y2 结束点 y\n * @param {number} t 指定比例\n * @return {object} 包含 x, y 的点\n */\nexport function pointAt(\n x1: number | null | undefined,\n y1: number | null | undefined,\n x2: number | null | undefined,\n y2: number | null | undefined,\n t: number\n): {\n x: undefined | number;\n y: undefined | number;\n} {\n let x: number | undefined;\n let y: number | undefined;\n if (typeof x1 === 'number' && typeof x2 === 'number') {\n x = (1 - t) * x1 + t * x2;\n }\n if (typeof y1 === 'number' && typeof y2 === 'number') {\n y = (1 - t) * y1 + t * y2;\n }\n return {\n x,\n y\n };\n}\n\nexport function lengthFromPointToLine(\n point: { x: number; y: number },\n point1: { x: number; y: number },\n point2: { x: number; y: number }\n): number {\n // 面积\n const dir1X = point2.x - point1.x;\n const dir1Y = point2.y - point1.y;\n const dir2X = point.x - point1.x;\n const dir2Y = point.y - point1.y;\n const s = Math.abs(dir1X * dir2Y - dir2X * dir1Y);\n const length = Math.sqrt(dir1X * dir1X + dir1Y * dir1Y);\n return s / length;\n}\n\nexport function crossProduct(dir1: vec2, dir2: vec2): number {\n return dir1[0] * dir2[1] - dir1[1] * dir2[0];\n}\n\nexport function crossProductPoint(dir1: { x: number; y: number }, dir2: { x: number; y: number }): number {\n return dir1.x * dir2.y - dir1.y * dir2.x;\n}\n\nexport function fuzzyEqualNumber(a: number, b: number): boolean {\n return abs(a - b) < epsilon;\n}\n\nexport function fuzzyEqualVec(a: vec2, b: vec2): boolean {\n return abs(a[0] - b[0]) + abs(a[1] - b[1]) < epsilon;\n}\n\nexport function fixPrecision(num: number, precision = 10) {\n return Math.round(num * precision) / precision;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/math.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC;AAC7B,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;AAC1B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAC/C,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;AA2B/B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAC5B,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAE5B,MAAM,UAAU,IA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S,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,CAAS;IAC/C,OAAO,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,CAAS;IAC/C,OAAO,YAAY,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC","file":"math.js","sourcesContent":["export const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\nexport const NEWTON_ITERATIONS = 4;\nexport const NEWTON_MIN_SLOPE = 0.001;\nexport const SUBDIVISION_PRECISION = 0.0000001;\nexport const SUBDIVISION_MAX_ITERATIONS = 10;\nexport const pi2 = Math.PI * 2;\n\nexport type vec2 = [number, number] | Float32Array;\nexport type vec3 = [number, number, number] | Float32Array;\nexport type vec4 = [number, number, number, number] | Float32Array;\nexport type vec8 = [number, number, number, number, number, number, number, number] | Float32Array;\nexport type mat4 =\n | [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n ]\n | Float32Array;\n\nexport const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\nexport const pow = Math.pow;\n\nexport function acos(x: number) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x: number) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n\n/**\n * 根据比例获直线上的点\n * @param {number} x1 起始点 x\n * @param {number} y1 起始点 y\n * @param {number} x2 结束点 x\n * @param {number} y2 结束点 y\n * @param {number} t 指定比例\n * @return {object} 包含 x, y 的点\n */\nexport function pointAt(\n x1: number | null | undefined,\n y1: number | null | undefined,\n x2: number | null | undefined,\n y2: number | null | undefined,\n t: number\n): {\n x: undefined | number;\n y: undefined | number;\n} {\n let x: number | undefined;\n let y: number | undefined;\n if (typeof x1 === 'number' && typeof x2 === 'number') {\n x = (1 - t) * x1 + t * x2;\n }\n if (typeof y1 === 'number' && typeof y2 === 'number') {\n y = (1 - t) * y1 + t * y2;\n }\n return {\n x,\n y\n };\n}\n\nexport function lengthFromPointToLine(\n point: { x: number; y: number },\n point1: { x: number; y: number },\n point2: { x: number; y: number }\n): number {\n // 面积\n const dir1X = point2.x - point1.x;\n const dir1Y = point2.y - point1.y;\n const dir2X = point.x - point1.x;\n const dir2Y = point.y - point1.y;\n const s = Math.abs(dir1X * dir2Y - dir2X * dir1Y);\n const length = Math.sqrt(dir1X * dir1X + dir1Y * dir1Y);\n return s / length;\n}\n\nexport function crossProduct(dir1: vec2, dir2: vec2): number {\n return dir1[0] * dir2[1] - dir1[1] * dir2[0];\n}\n\nexport function crossProductPoint(dir1: { x: number; y: number }, dir2: { x: number; y: number }): number {\n return dir1.x * dir2.y - dir1.y * dir2.x;\n}\n\nexport function fuzzyEqualNumber(a: number, b: number): boolean {\n return abs(a - b) < epsilon;\n}\n\nexport function fuzzyEqualVec(a: vec2, b: vec2): boolean {\n return abs(a[0] - b[0]) + abs(a[1] - b[1]) < epsilon;\n}\n\nexport function fixPrecision(num: number, precision = 10) {\n return Math.round(num * precision) / precision;\n}\n\nexport function getDecimalPlaces(n: number): number {\n const dStr = n.toString().split(/[eE]/);\n const s = (dStr[0].split('.')[1] || '').length - (+dStr[1] || 0);\n return s > 0 ? s : 0;\n}\n\nexport function precisionAdd(a: number, b: number) {\n return fixPrecision(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));\n}\n\nexport function precisionSub(a: number, b: number) {\n return fixPrecision(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));\n}\n"]}
|