@visactor/vutils 0.17.0-alpha.0 → 0.17.0
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/common/array.d.ts +2 -2
- package/cjs/common/array.js +26 -9
- package/cjs/common/array.js.map +1 -1
- package/dist/index.js +24 -8
- package/dist/index.min.js +1 -1
- package/es/common/array.d.ts +2 -2
- package/es/common/array.js +20 -6
- package/es/common/array.js.map +1 -1
- package/package.json +4 -4
package/cjs/common/array.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare function array<T>(arr?: T | T[]): T[];
|
|
2
2
|
export declare function last<T>(val: T | T[]): T | undefined;
|
|
3
3
|
export declare const span: (arr: number[]) => number;
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare const maxInArray: <T>(arr: T[], compareFn?: (a: T, b: T) => number) => T;
|
|
5
|
+
export declare const minInArray: <T>(arr: T[], compareFn?: (a: T, b: T) => number) => T;
|
|
6
6
|
export declare function arrayEqual(a: any, b: any): boolean;
|
|
7
7
|
export declare function uniqArray<T>(arr: T | T[]): T | T[];
|
|
8
8
|
export declare function shuffleArray<T>(arr: T[], random?: () => number): T[];
|
package/cjs/common/array.js
CHANGED
|
@@ -26,13 +26,31 @@ exports.array = array, exports.last = last;
|
|
|
26
26
|
|
|
27
27
|
const span = arr => arr.length <= 1 ? 0 : last(arr) - arr[0];
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
if (arr && (0, isArray_1.default)(arr)) return arr.reduce(((prev, curr) => Math.max(prev, curr)), -1 / 0);
|
|
31
|
-
}
|
|
29
|
+
exports.span = span;
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const maxInArray = (arr, compareFn) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (0 === arr.length) return;
|
|
34
|
+
let max = arr[0];
|
|
35
|
+
for (let i = 1; i < arr.length; i++) {
|
|
36
|
+
const value = arr[i];
|
|
37
|
+
(null !== (_a = null == compareFn ? void 0 : compareFn(value, max)) && void 0 !== _a ? _a : value - max > 0) && (max = value);
|
|
38
|
+
}
|
|
39
|
+
return max;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.maxInArray = maxInArray;
|
|
43
|
+
|
|
44
|
+
const minInArray = (arr, compareFn) => {
|
|
45
|
+
var _a;
|
|
46
|
+
if (0 === arr.length) return;
|
|
47
|
+
let min = arr[0];
|
|
48
|
+
for (let i = 1; i < arr.length; i++) {
|
|
49
|
+
const value = arr[i];
|
|
50
|
+
(null !== (_a = null == compareFn ? void 0 : compareFn(value, min)) && void 0 !== _a ? _a : value - min < 0) && (min = value);
|
|
51
|
+
}
|
|
52
|
+
return min;
|
|
53
|
+
};
|
|
36
54
|
|
|
37
55
|
function arrayEqual(a, b) {
|
|
38
56
|
if (!(0, isArray_1.default)(a) || !(0, isArray_1.default)(b)) return !1;
|
|
@@ -58,7 +76,6 @@ function flattenArray(arr) {
|
|
|
58
76
|
return result;
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
63
|
-
exports.flattenArray = flattenArray;
|
|
79
|
+
exports.minInArray = minInArray, exports.arrayEqual = arrayEqual, exports.uniqArray = uniqArray,
|
|
80
|
+
exports.shuffleArray = shuffleArray, exports.flattenArray = flattenArray;
|
|
64
81
|
//# sourceMappingURL=array.js.map
|
package/cjs/common/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/array.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,gEAAwC;AACxC,wDAAgC;AAOhC,SAAgB,KAAK,CAAI,GAAa;IACpC,IAAI,IAAA,iBAAO,EAAC,GAAG,CAAC,EAAE;QAChB,OAAO,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AALD,sBAKC;AAOD,SAAgB,IAAI,CAAI,GAAY;IAClC,IAAI,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE;QACpB,MAAM,GAAG,GAAG,GAAqB,CAAC;QAClC,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC5B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAND,oBAMC;AAOM,MAAM,IAAI,GAAG,CAAC,GAAa,EAAE,EAAE;IACpC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;QACnB,OAAO,CAAC,CAAC;KACV;IACD,OAAQ,IAAI,CAAC,GAAG,CAAY,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AALW,QAAA,IAAI,QAKf;
|
|
1
|
+
{"version":3,"sources":["../src/common/array.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,gEAAwC;AACxC,wDAAgC;AAOhC,SAAgB,KAAK,CAAI,GAAa;IACpC,IAAI,IAAA,iBAAO,EAAC,GAAG,CAAC,EAAE;QAChB,OAAO,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AALD,sBAKC;AAOD,SAAgB,IAAI,CAAI,GAAY;IAClC,IAAI,IAAA,qBAAW,EAAC,GAAG,CAAC,EAAE;QACpB,MAAM,GAAG,GAAG,GAAqB,CAAC;QAClC,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC5B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAND,oBAMC;AAOM,MAAM,IAAI,GAAG,CAAC,GAAa,EAAE,EAAE;IACpC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;QACnB,OAAO,CAAC,CAAC;KACV;IACD,OAAQ,IAAI,CAAC,GAAG,CAAY,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AALW,QAAA,IAAI,QAKf;AAQK,MAAM,UAAU,GAAG,CAAI,GAAQ,EAAE,SAAkC,EAAiB,EAAE;;IAC3F,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,KAAK,EAAE,GAAG,CAAC,mCAAK,KAAgB,GAAI,GAAc,GAAG,CAAC,EAAE;YACtE,GAAG,GAAG,KAAK,CAAC;SACb;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAQK,MAAM,UAAU,GAAG,CAAI,GAAQ,EAAE,SAAkC,EAAiB,EAAE;;IAC3F,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,KAAK,EAAE,GAAG,CAAC,mCAAK,KAAgB,GAAI,GAAc,GAAG,CAAC,EAAE;YACtE,GAAG,GAAG,KAAK,CAAC;SACb;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAQF,SAAgB,UAAU,CAAC,CAAM,EAAE,CAAM;IACvC,IAAI,CAAC,IAAA,iBAAO,EAAC,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAO,EAAC,CAAC,CAAC,EAAE;QAC9B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,gCAaC;AAOD,SAAgB,SAAS,CAAI,GAAY;IACvC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAA,iBAAO,EAAC,GAAG,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AALD,8BAKC;AAGD,SAAgB,YAAY,CAAI,GAAQ,EAAE,SAAuB,IAAI,CAAC,MAAM;IAC1E,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7B,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAChB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACZ;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAZD,oCAYC;AAOD,SAAgB,YAAY,CAAC,GAAQ;IACnC,IAAI,CAAC,IAAA,iBAAO,EAAC,GAAG,CAAC,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,CAAC;KACd;IACD,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;KACrC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,oCASC","file":"array.js","sourcesContent":["import isArray from './isArray';\nimport isArrayLike from './isArrayLike';\nimport isValid from './isValid';\n\n/**\n * 将传入数据转换为数组格式\n * @param arr 入参。\n * @returns 数组\n */\nexport function array<T>(arr?: T | T[]): T[] {\n if (isValid(arr)) {\n return isArray(arr) ? arr : [arr];\n }\n return [];\n}\n\n/**\n * 获取数组的最后一个值,如果传入的参数为非数组,则返回 undefined\n * @param val any\n * @returns\n */\nexport function last<T>(val: T | T[]): T | undefined {\n if (isArrayLike(val)) {\n const arr = val as ArrayLike<any>;\n return arr[arr.length - 1];\n }\n return undefined;\n}\n\n/**\n * 获取数组第一项与最后一项的差值,如果数组为空\b则返回 0\n * @param arr\n * @returns\n */\nexport const span = (arr: number[]) => {\n if (arr.length <= 1) {\n return 0;\n }\n return (last(arr) as number) - arr[0];\n};\n\n/**\n * 获取数组中的最大值\n * @param arr 数组\n * @param compareFn 比较函数,返回正数表示 a > b,返回负数表示 a < b,返回 0 表示相等\n * @returns\n */\nexport const maxInArray = <T>(arr: T[], compareFn?: (a: T, b: T) => number): T | undefined => {\n if (arr.length === 0) {\n return undefined;\n }\n let max = arr[0];\n for (let i = 1; i < arr.length; i++) {\n const value = arr[i];\n if (compareFn?.(value, max) ?? (value as number) - (max as number) > 0) {\n max = value;\n }\n }\n return max;\n};\n\n/**\n * 获取数组中的最小值\n * @param arr 数组\n * @param compareFn 比较函数,返回正数表示 a > b,返回负数表示 a < b,返回 0 表示相等\n * @returns\n */\nexport const minInArray = <T>(arr: T[], compareFn?: (a: T, b: T) => number): T | undefined => {\n if (arr.length === 0) {\n return undefined;\n }\n let min = arr[0];\n for (let i = 1; i < arr.length; i++) {\n const value = arr[i];\n if (compareFn?.(value, min) ?? (value as number) - (min as number) < 0) {\n min = value;\n }\n }\n return min;\n};\n\n/**\n * 判断两个数组是否相同\n * @param a\n * @param b\n * @returns\n */\nexport function arrayEqual(a: any, b: any): boolean {\n if (!isArray(a) || !isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * 封装并返回无重复的数组\n * @param arr\n * @returns\n */\nexport function uniqArray<T>(arr: T | T[]): T | T[] {\n if (!arr || !isArray(arr)) {\n return arr;\n }\n return Array.from(new Set(array(arr)));\n}\n\n// Based on http://jsfromhell.com/array/shuffle\nexport function shuffleArray<T>(arr: T[], random: () => number = Math.random): T[] {\n let j;\n let x;\n let i = arr.length;\n\n while (i) {\n j = Math.floor(random() * i);\n x = arr[--i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n}\n\n/**\n * 展开多层数组,非数组内容将变为 [input]\n * @param arr\n * @returns\n */\nexport function flattenArray(arr: any): any[] {\n if (!isArray(arr)) {\n return [arr];\n }\n const result = [];\n for (const value of arr) {\n result.push(...flattenArray(value));\n }\n return result;\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -860,18 +860,34 @@
|
|
|
860
860
|
}
|
|
861
861
|
return last(arr) - arr[0];
|
|
862
862
|
};
|
|
863
|
-
|
|
864
|
-
|
|
863
|
+
const maxInArray = (arr, compareFn) => {
|
|
864
|
+
var _a;
|
|
865
|
+
if (arr.length === 0) {
|
|
865
866
|
return undefined;
|
|
866
867
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
868
|
+
let max = arr[0];
|
|
869
|
+
for (let i = 1; i < arr.length; i++) {
|
|
870
|
+
const value = arr[i];
|
|
871
|
+
if ((_a = compareFn === null || compareFn === void 0 ? void 0 : compareFn(value, max)) !== null && _a !== void 0 ? _a : value - max > 0) {
|
|
872
|
+
max = value;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return max;
|
|
876
|
+
};
|
|
877
|
+
const minInArray = (arr, compareFn) => {
|
|
878
|
+
var _a;
|
|
879
|
+
if (arr.length === 0) {
|
|
871
880
|
return undefined;
|
|
872
881
|
}
|
|
873
|
-
|
|
874
|
-
|
|
882
|
+
let min = arr[0];
|
|
883
|
+
for (let i = 1; i < arr.length; i++) {
|
|
884
|
+
const value = arr[i];
|
|
885
|
+
if ((_a = compareFn === null || compareFn === void 0 ? void 0 : compareFn(value, min)) !== null && _a !== void 0 ? _a : value - min < 0) {
|
|
886
|
+
min = value;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return min;
|
|
890
|
+
};
|
|
875
891
|
function arrayEqual(a, b) {
|
|
876
892
|
if (!isArray(a) || !isArray(b)) {
|
|
877
893
|
return false;
|
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 r(t,e,u){this.fn=t,this.context=e,this.once=u||!1}function D(t,e,n,D,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,D||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,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(u?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},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 r=0,D=n.length,i=new Array(D);r<D;r++)i[r]=n[r].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,r,D,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,r),!0;case 5:return h.fn.call(h.context,e,n,r,D),!0;case 6:return h.fn.call(h.context,e,n,r,D,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,r);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 D(this,t,e,u,!1)},s.prototype.once=function(t,e,u){return D(this,t,e,u,!0)},s.prototype.removeListener=function(t,e,n,r){var D=u?u+t:t;if(!this._events[D])return this;if(!e)return i(this,D),this;var s=this._events[D];if(s.fn)s.fn!==e||r&&!s.once||n&&s.context!==n||i(this,D);else{for(var o=0,a=[],h=s.length;o<h;o++)(s[o].fn!==e||r&&!s[o].once||n&&s[o].context!==n)&&a.push(s[o]);a.length?this._events[D]=1===a.length?a[0]:a:i(this,D)}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 r=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,D=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||r(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)||!r(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||r(t,"String")},F=t=>Array.isArray?Array.isArray(t):r(t,"Array"),f=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},C=t=>r(t,"Date"),g=(t,e=!1)=>{const u=typeof t;return e?"number"===u:"number"===u||r(t,"Number")},d=t=>g(t)&&Number.isFinite(t),E=t=>r(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),r=[];for(const t in n)r.push(t);let{length:D}=r,i=-1;for(;D--;){const D=r[++i];o(n[D])&&"object"==typeof n[D]?B(t,e,D,u):b(t,D,n[D])}}}}function B(t,e,u,n=!1){const r=t[u],D=e[u];let i=e[u],s=!0;if(F(D)){if(n)i=[];else if(F(r))i=r;else if(f(r)){i=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)i[t]=r[t]}}else l(D)?(i=r,"function"!=typeof r&&"object"==typeof r||(i={})):s=!1;s&&x(i,D,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 v(t){return Object.prototype.toString.call(t)}function A(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 T(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 S(t,e,u){const n=T(e);for(let r=0;r<n.length;r++){const D=n[r];(u?null!=e[D]:null==t[D])&&(t[D]=e[D])}return t}function L(t){return o(t)?F(t)?t:[t]:[]}function N(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 I(t){return Number(t)}function H(t,e,u=I){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 r=(n-1)*e,D=Math.floor(r),i=u(t[D],D,t);return i+(u(t[D+1],D+1,t)-i)*(r-D)}function R(t,e){let u,n=0,r=0,D=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(u=e-r,r+=u/++n,D+=u*(e-r));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(s=+s)>=s&&(u=s-r,r+=u/++n,D+=u*(s-r))}return n>1?D/(n-1):0}const U=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 r=n,D=u*Math.max(t,e);return Math.abs(t-e)<=Math.max(r,D)}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 r=u,D=t+"",i=e-D.length;return i<=0?D:"left"===n?W(r,i)+D:"center"===n?W(r,Math.floor(i/2))+D+W(r,Math.ceil(i/2)):D+W(r,i)},V=function(t,e,u){return t<e?e:t>u?u:t};let G=!1;try{G="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){G=!1}function X(t,e,u){let n,r,D,i,s,o,h=0,l=!1,c=!1,F=!0;const f=!e&&0!==e&&G;if("function"!=typeof t)throw new TypeError("Expected a function");function C(e){const u=n,D=r;return n=r=void 0,h=e,i=t.apply(D,u),i}function g(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>=D}function y(){const t=Date.now();if(E(t))return m(t);s=g(y,function(t){const u=t-h,n=e-(t-o);return c?Math.min(n,D-u):n}(t))}function m(t){return s=void 0,F&&n?C(t):(n=r=void 0,i)}function p(...t){const u=Date.now(),D=E(u);if(n=t,r=this,o=u,D){if(void 0===s)return function(t){return h=t,s=g(y,e),l?C(t):i}(o);if(c)return s=g(y,e),C(o)}return void 0===s&&(s=g(y,e)),i}return e=+e||0,a(u)&&(l=!!u.leading,c="maxWait"in u,c&&(D=Math.max(d(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=r=s=void 0},p.flush=function(){return void 0===s?i:m(Date.now())},p.pending=function(){return void 0!==s},p}function $(t,e){return u=>t*(1-u)+e*u}G=!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,rt=2*ut,Dt=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,r=u.y-e.y,D=t.x-e.x,i=t.y-e.y;return Math.abs(n*i-D*r)/Math.sqrt(n*n+r*r)}function Ct(t,e){return t[0]*e[1]-t[1]*e[0]}function gt(t,e){return t.x*e.y-t.y*e.x}function dt(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 g(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return g(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:r,x2:D,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*r+u.e,u.b*n+u.d*r+u.f),t.add(u.a*D+u.c*r+u.e,u.b*D+u.d*r+u.f),t.add(u.a*D+u.c*i+u.e,u.b*D+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 r=this.scalePoints(t,e,u,n);return this.clear().add(r[0],r[1]).add(r[2],r[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:r,x2:D,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*r+a,o*n+s*r+h,s*n-o*i+a,o*n+s*i+h,s*D-o*r+a,o*D+s*r+h,s*D-o*i+a,o*D+s*i+h]}scalePoints(t,e,u,n){const{x1:r,y1:D,x2:i,y2:s}=this;return[t*r+(1-t)*u,e*D+(1-e)*n,t*i+(1-t)*u,e*s+(1-e)*n]}}function bt(t){return t*(Math.PI/180)}function Mt(t){return 180*t/Math.PI}const vt=(t=0)=>{if(t<0)for(;t<-rt;)t+=rt;else if(t>0)for(;t>rt;)t-=rt;return t},At=vt,_t=(t=0)=>t>360||t<-360?t%360:t,wt=_t;class Tt{constructor(t=1,e=0,u=0,n=1,r=0,D=0){this.a=t,this.b=e,this.c=u,this.d=n,this.e=r,this.f=D}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,r,D){return!(this.e!==r||this.f!==D||this.a!==t||this.d!==n||this.b!==e||this.c!==u)}setValue(t,e,u,n,r,D){return this.a=t,this.b=e,this.c=u,this.d=n,this.e=r,this.f=D,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,r=this.e,D=this.f,i=new Tt,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*D-n*r)/s,i.f=-(t*D-e*r)/s,i}rotate(t){const e=Math.cos(t),u=Math.sin(t),n=this.a*e+this.c*u,r=this.b*e+this.d*u,D=this.a*-u+this.c*e,i=this.b*-u+this.d*e;return this.a=n,this.b=r,this.c=D,this.d=i,this}rotateByCenter(t,e,u){const n=Math.cos(t),r=Math.sin(t),D=(1-n)*e+r*u,i=(1-n)*u-r*e,s=n*this.a-r*this.b,o=r*this.a+n*this.b,a=n*this.c-r*this.d,h=r*this.c+n*this.d,l=n*this.e-r*this.f+D,c=r*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,r,D){return this.multiply(t,e,u,n,r,D),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:r,f:D}=this;return this.a=e,this.b=t,this.c=n,this.d=u,this.e=D,this.f=r,this}multiply(t,e,u,n,r,D){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*r+o*D+this.e,C=s*r+a*D+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 Tt;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:r,d:D,e:i,f:s}=this,o=u*D-n*r,a=D/o,h=-n/o,l=-r/o,c=u/o,F=(r*s-D*i)/o,f=-(u*s-n*i)/o,{x:C,y:g}=t;e.x=C*a+g*l+F,e.y=C*h+g*c+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Tt(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,r=t*n-e*u,D={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);D.rotateDeg=e>0?Math.acos(t/i):-Math.acos(t/i),D.scaleX=i,D.scaleY=r/i,D.skewX=(t*u+e*n)/r,D.skewY=0}else if(0!==u||0!==n){const i=Math.sqrt(u*u+n*n);D.rotateDeg=Math.PI/2-(n>0?Math.acos(-u/i):-Math.acos(u/i)),D.scaleX=r/i,D.scaleY=i,D.skewX=0,D.skewY=(t*u+e*n)/r}return D.rotateDeg=Mt(D.rotateDeg),D}}function St(t,e,u){e/=100,u/=100;const n=(1-Math.abs(2*u-1))*e,r=n*(1-Math.abs(t/60%2-1)),D=u-n/2;let i=0,s=0,o=0;return 0<=t&&t<60?(i=n,s=r,o=0):60<=t&&t<120?(i=r,s=n,o=0):120<=t&&t<180?(i=0,s=n,o=r):180<=t&&t<240?(i=0,s=r,o=n):240<=t&&t<300?(i=r,s=0,o=n):300<=t&&t<360&&(i=n,s=0,o=r),i=Math.round(255*(i+D)),s=Math.round(255*(s+D)),o=Math.round(255*(o+D)),{r:i,g:s,b:o}}function Lt(t,e,u){t/=255,e/=255,u/=255;const n=Math.min(t,e,u),r=Math.max(t,e,u),D=r-n;let i=0,s=0,o=0;return i=0===D?0:r===t?(e-u)/D%6:r===e?(u-t)/D+2:(t-e)/D+4,i=Math.round(60*i),i<0&&(i+=360),o=(r+n)/2,s=0===D?0:D/(1-Math.abs(2*o-1)),s=+(100*s).toFixed(1),o=+(100*o).toFixed(1),{h:i,s:s,l:o}}const Nt=/^#([0-9a-f]{3,8})$/,Ot={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 Ht(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Rt(t){return g(t)?new jt(t>>16,t>>8&255,255&t,1):F(t)?new jt(t[0],t[1],t[2]):new jt(255,255,255)}function Ut(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function kt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Pt{static Brighter(t,e=1){return 1===e?t:new Pt(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Pt(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const u=t instanceof Pt?t:new Pt(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(Ot[t]))return function(t){return g(t)?new jt(t>>>24,t>>>16&255,t>>>8&255,255&t):F(t)?new jt(t[0],t[1],t[2],t[3]):new jt(255,255,255,1)}(Ot[t]);if(o(It[t]))return Rt(It[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 jt((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 jt(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 jt(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 jt(u.r,u.g,u.b,parseFloat(t[3]))}}constructor(t){const e=Pt.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new jt(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}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}add(t){const{r:e,g:u,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,u+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),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,r=Lt(this.color.r,this.color.g,this.color.b),D=St(s(t)?r.h:V(t,0,360),s(e)?r.s:e>=0&&e<=1?100*e:e,s(u)?r.l:u<=1&&u>=0?100*u:u);return this.color=new jt(D.r,D.g,D.b,n),this}setRGB(t,e,u){return!s(t)&&(this.color.r=t),!s(e)&&(this.color.g=e),!s(u)&&(this.color.b=u),this}setHex(t){const e=`${t}`.trim().toLowerCase(),u=Nt.exec(e),n=parseInt(u[1],16),r=u[1].length;return 3===r?new jt((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):6===r?Rt(n):8===r?new jt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):this}setColorName(t){const e=It[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,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}clone(){return new Pt(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const u=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,u),this.color.g=Math.pow(t.color.g,u),this.color.b=Math.pow(t.color.b,u),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ut(t.color.r),this.color.g=Ut(t.color.g),this.color.b=Ut(t.color.b),this}copyLinearToSRGB(t){return this.color.r=kt(t.color.r),this.color.g=kt(t.color.g),this.color.b=kt(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class jt{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}=Lt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${u}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function zt(t){let e="",u="",n="";const r="#"===t[0]?1:0;for(let D=r;D<t.length;D++)"#"!==t[D]&&(D<r+2?e+=t[D]:D<r+4?u+=t[D]:D<r+6&&(n+=t[D]));return[parseInt(e,16),parseInt(u,16),parseInt(n,16)]}function Yt(t,e,u){return Number((1<<24)+(t<<16)+(e<<8)+u).toString(16).slice(1)}function Wt(t,e){const u=t.r,n=e.r,r=t.g,D=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(r*(1-t)+D*t),l=Math.round(i*(1-t)+s*t);return new jt(e,h,l,o*(1-t)+a*t)}}var qt=Object.freeze({__proto__:null,Color:Pt,DEFAULT_COLORS:It,RGB:jt,hexToRgb:zt,hslToRgb:St,interpolateRgb:Wt,rgbToHex:Yt,rgbToHsl:Lt});function Vt(t,e,u){t[0]=e[0]-u[0],t[1]=e[1]-u[1]}let Gt,Xt,$t,Zt,Kt,Qt,Jt,te;function ee(t,e,u,n){let r,D=t[0],i=e[0],s=u[0],o=n[0];return i<D&&(r=i,i=D,D=r),o<s&&(r=o,o=s,s=r),!(i<s||o<D)&&(D=t[1],i=e[1],s=u[1],o=n[1],i<D&&(r=i,i=D,D=r),o<s&&(r=o,o=s,s=r),!(i<s||o<D))}var ue;function ne(t,e,u){return!e||(u?(Gt=e.x1,Xt=e.x2,$t=e.y1,Zt=e.y2,Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),t.x>=Gt&&t.x<=Xt&&t.y>=$t&&t.y<=Zt):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function re(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function De({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 ie(t){return t/180*Math.PI}function se(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function oe(t,e){const u=e?t.angle:ie(t.angle),n=se(t);return[De({x:t.x1,y:t.y1},u,n),De({x:t.x2,y:t.y1},u,n),De({x:t.x2,y:t.y2},u,n),De({x:t.x1,y:t.y2},u,n)]}let ae,he,le,ce,Fe,fe,Ce,ge,de,Ee,ye,me;function pe(t,e,u=3,n=!1){let r=t.x1,D=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,h=e.y1,l=e.y2;if(n){let t;r>D&&(t=r,r=D,D=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(r>=a||D<=o||i>=l||s<=h)return[t,e];const c=(D-r+2*u)*(s-i+2*u),F=(a-o+2*u)*(l-h+2*u),f=Math.min(r,o),C=Math.min(i,h),g=Math.max(D,a),d=Math.max(s,l);return c+F>(g-f)*(d-C)?[{x1:f,x2:g,y1:C,y2:d}]:[t,e]}t.InnerBBox=void 0,(ue=t.InnerBBox||(t.InnerBBox={}))[ue.NONE=0]="NONE",ue[ue.BBOX1=1]="BBOX1",ue[ue.BBOX2=2]="BBOX2";const xe={x:0,y:0},Be={x:0,y:0};function be(t,e,u,n){return ft(t,e,u)<=n/2&&_e(t,e,u)}const Me={x:0,y:0},ve={x:0,y:0},Ae={x:0,y:0};function _e(t,e,u){return Me.x=e.x-t.x,Me.y=e.y-t.y,ve.x=u.x-t.x,ve.y=u.y-t.y,Ae.x=e.y-u.y,Ae.y=u.x-e.x,gt(Me,Ae)*gt(ve,Ae)<0}class we{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:r}){return(t?t+" ":"")+(e?e+" ":"")+(u?u+" ":"")+(n||12)+"px "+(r||"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 we.instance||(we.instance=new we(t)),we.instance}}const Te=1e-8;function Se(t,e,u,n,r){for(let D=0,i=r[r.length-1];D<r.length;D++){const s=r[D];if(ee([t,e],[u,n],[s.x,s.y],[i.x,i.y]))return!0;i=s}return!1}function Le(t,e,u){let n=0,r=t[0];if(!r)return!1;for(let D=1;D<t.length;D++){const i=t[D];n+=Ne(r.x,r.y,i.x,i.y,e,u),r=i}const D=t[0];return Oe(r.x,D.x)&&Oe(r.y,D.y)||(n+=Ne(r.x,r.y,D.x,D.y,e,u)),0!==n}function Ne(t,e,u,n,r,D){if(D>e&&D>n||D<e&&D<n)return 0;if(n===e)return 0;const i=(D-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===r?1/0:o>r?s:0}function Oe(t,e){return Math.abs(t-e)<Te}const Ie=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(He(),"")},He=({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")},Re=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"},Ue=()=>/[#*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\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\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 ke(t,e={}){const{fontStyle:u=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:D=e.fontSize,fontFamily:i=e.fontFamily}=t;return(u?u+" ":"")+(n?n+" ":"")+(r?r+" ":"")+D+"px "+(i||"sans-serif")}class Pe{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=ke(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:r=n.fontStyle,fontVariant:D=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:F=(null!=l?l:"middle"),ellipsis:f,limit:C}=this._userSpec;let{lineHeight:g=s}=this._userSpec;if(c(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=s*t}return{fontStyle:r,fontVariant:D,fontFamily:o,fontSize:s,fontWeight:i,textAlign:h,textBaseline:F,ellipsis:f,limit:C,lineHeight:g}}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:r,textBaseline:D,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:r,textBaseline:D,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){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const u=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:u.width,height:null!==(e=r)&&void 0!==e?e:n}}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 r=this._measureSpecialChar(n);s(r)&&Pe.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),s(r)&&["F","W"].includes(Re(n))&&(r=this._measureFullSizeChar()),s(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const u={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],D=["F","W"].includes(Re(r))?1:.53;u.width+=D*n}return u.height=null!==(e=r)&&void 0!==e?e:n,u}_measureReduce(t,e){var u;const{fontSize:n,lineHeight:r}=this.textSpec,D={width:0,height:0};if(s(t))return D;if(F(t)){const i=t.filter(o).map((t=>t.toString()));return 0===i.length?D:1===i.length?e(i[0]):{width:i.reduce(((t,u)=>Math.max(t,e(u).width)),0),height:i.length*((null!==(u=r)&&void 0!==u?u:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(s(this._numberCharSize)){const t=this._standardMethod(Pe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Pe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return s(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Pe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(s(this._letterCharSize)){const t=this._standardMethod(Pe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Pe.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)}}Pe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Pe.NUMBERS_CHAR_SET="0123456789",Pe.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function ze(t,e,u){const n=[e].concat([].slice.call(u));je&&console[t].apply(console,n)}var Ye;t.LoggerLevel=void 0,(Ye=t.LoggerLevel||(t.LoggerLevel={}))[Ye.None=0]="None",Ye[Ye.Error=1]="Error",Ye[Ye.Warn=2]="Warn",Ye[Ye.Info=3]="Info",Ye[Ye.Debug=4]="Debug";class We{static getInstance(t,e){return We._instance&&g(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._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):ze(null!==(u=this._method)&&void 0!==u?u:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&ze(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&ze(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&ze(this._method||"log","DEBUG",e),this}}function qe(t){return t?"getUTCFullYear":"getFullYear"}function Ve(t){return t?"getUTCMonth":"getMonth"}function Ge(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ze(t){return t?"getUTCSeconds":"getSeconds"}function Ke(t){return t?"getUTCMilliseconds":"getMilliseconds"}We._instance=null;const Qe=1e3,Je=6e4,tu=36e5,eu=24*tu,uu=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),nu=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ru=(t,e)=>e.getFullYear()-t.getFullYear(),Du=t=>t.getFullYear(),iu=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),su=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),ou=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),au=t=>t.getUTCFullYear(),hu=t=>(t.setDate(1),t.setHours(0,0,0,0),t),lu=(t,e)=>(t.setMonth(t.getMonth()+e),t),cu=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),Fu=t=>t.getMonth(),fu=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),Cu=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),gu=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),du=t=>t.getUTCMonth(),Eu=t=>(t.setHours(0,0,0,0),t),yu=(t,e)=>(t.setDate(t.getDate()+e),t),mu=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/eu,pu=t=>t.getDate()-1,xu=t=>(t.setUTCHours(0,0,0,0),t),Bu=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),bu=(t,e)=>(+e-+t)/eu,Mu=t=>t.getUTCDate()-1,vu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Qe-t.getMinutes()*Je),t),Au=(t,e)=>(t.setHours(t.getHours()+e),t),_u=(t,e)=>(+e-+t)/tu,wu=t=>t.getHours(),Tu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Qe-t.getUTCMinutes()*Je),t),Su=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Lu=t=>t.getUTCHours(),Nu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Qe),t),Ou=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Iu=(t,e)=>(+e-+t)/Je,Hu=t=>t.getMinutes(),Ru=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Qe),t),Uu=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),ku=t=>t.getUTCMinutes(),Pu=t=>(t.setTime(+t-t.getMilliseconds()),t),ju=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),zu=(t,e)=>(+e-+t)/Qe,Yu=t=>t.getSeconds(),Wu=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),qu=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Vu=t=>t.getUTCSeconds(),Gu=t=>t,Xu=(t,e)=>(t.setTime(+t+e),t),$u=(t,e)=>+e-+t,Zu=(t,e)=>u=>{const n=new Date(+u-1);return e(n,1),t(n),n},Ku=(t,e)=>(u,n)=>{const r=new Date,D=new Date;return r.setTime(+u),D.setTime(+n),t(r),t(D),Math.floor(e(r,D))};function Qu(t){const{x:e,y:u}=t.getBoundingClientRect();return{x:e,y:u}}const Ju=t=>t.getBoundingClientRect().width/t.offsetWidth,tn=t=>t.getBoundingClientRect().height/t.offsetHeight;var en=6371008.8,un={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*en,kilometers:6371.0088,kilometres:6371.0088,meters:en,metres:en,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:en/1852,radians:1,yards:6967335.223679999};t.AABBBounds=class extends Bt{},t.Bounds=Bt,t.Color=Pt,t.ColorUtil=qt,t.DAY=eu,t.DEFAULT_COLORS=It,t.EventEmitter=n,t.GraphicUtil=we,t.HOUR=tu,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=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:u=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<u)return 0;let D=0;const i=e=>{D++,t.delete(e)},s=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<r)return i(e);let u=0;for(;s-t.timestamp[t.timestamp.length-1-u]<n&&(u++,!(u>=r)););if(u<r)return i(e);for(;s-t.timestamp[0]>n;)t.timestamp.shift()})),D}addLimitedTimestamp(t,e,u){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=u;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>u;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>u;)t.timestamp.shift()}},t.Logger=We,t.MINUTE=Je,t.MONTH=26784e5,t.Matrix=Tt,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.RGB=jt,t.SECOND=Qe,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=Pe,t.YEAR=31536e6,t.abs=it,t.acos=function(t){return t>1?0:t<-1?ut:Math.acos(t)},t.array=L,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 r=u+n>>>1;O(t[r],e)>0?n=r:u=r+1}return u},t.clamp=V,t.clampAngleByDegree=wt,t.clampAngleByRadian=At,t.clampDegree=_t,t.clampRadian=vt,t.clampRange=(t,e,u)=>{let[n,r]=t;r<n&&(n=t[1],r=t[0]);const D=r-n;return D>=u-e?[e,u]:(n=Math.min(Math.max(n,e),u-D),[n,n+D])},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 r=[],D=[];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=r.indexOf(u);if(-1!==t)return D[t];r.push(u),D.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),r=e.length;u=n?new Array(r):"object"==typeof e?{}:D(e)||g(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,r=e[n];u[n]=t(r)}return u},t.constant=t=>i(t)?t:()=>t,t.cos=ot,t.crossProduct=Ct,t.crossProductPoint=gt,t.dateGetterName=Ge,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=mu,t.dayField=pu,t.dayFloor=Eu,t.dayOffset=yu,t.debounce=X,t.defaults=S,t.degreeToRadian=bt,t.destination=function(t,e,u,n={}){const r=bt(t[0]),D=bt(t[1]),i=bt(u),s=function(t,e){void 0===e&&(e="kilometers");var u=un[e];if(!u)throw new Error(e+" units is invalid");return t/u}(e,n.units),o=Math.asin(Math.sin(D)*Math.cos(s)+Math.cos(D)*Math.sin(s)*Math.cos(i));return{x:Mt(r+Math.atan2(Math.sin(i)*Math.sin(s)*Math.cos(D),Math.cos(s)-Math.sin(D)*Math.sin(o))),y:Mt(o)}},t.deviation=function(t,e){const u=R(t,e);return u?Math.sqrt(u):u},t.eastAsianCharacterInfo=Re,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=qe,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return it(t-e)<et},t.fuzzyEqualVec=dt,t.generateCeil=Zu,t.generateCount=Ku,t.generateStepInterval=(t,{floor:e,offset:u,field:n,count:r})=>{const D=Math.floor(t);if(!Number.isFinite(D)||D<=0)return null;if(D<=1)return{floor:e,offset:u,ceil:Zu(e,u)};const i=Ku(e,r),s=n?t=>n(t)%D==0:t=>i(0,t)%D==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(D<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:Zu(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 ae=1/0,he=1/0,le=-1/0,ce=-1/0,t.forEach((t=>{ae>t.x&&(ae=t.x),le<t.x&&(le=t.x),he>t.y&&(he=t.y),ce<t.y&&(ce=t.y)})),{x1:ae,y1:he,x2:le,y2:ce}},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 r=n(t),D=parseFloat(r.width)-parseFloat(r.paddingLeft)-parseFloat(r.paddingRight)||t.clientWidth-1,i=parseFloat(r.height)-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom)||t.clientHeight-1;return{width:D<=0?e:D,height:i<=0?u:i}},t.getContextFont=ke,t.getDecimalPlaces=yt,t.getElementAbsolutePosition=Qu,t.getElementRelativePosition=function(t,e){const u=Qu(t),n=Qu(e);return{x:u.x-n.x,y:u.y-n.y}},t.getFormatFromValue=function(t,e){const u=J(t),n=u[Ve(e)]()+1,r=u[Ge(e)](),D=u[Xe(e)](),i=u[$e(e)](),s=u[Ze(e)](),o=0===u[Ke(e)](),a=o&&0===s,h=a&&0===i,l=h&&0===D,c=l&&1===r;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(!ee(t,e,u,n))return!1;const r=[0,0],D=[0,0],i=[0,0];if(Vt(r,e,t),Vt(D,n,u),dt(r,D))return!0;Vt(i,u,t);const s=Ct(i,D)/Ct(r,D);return s>=0&&s<=1&&[t[0]+r[0]*s,t[1]+r[1]*s]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:iu,offset:su,count:ou,field:au}:"month"===t&&e?{floor:fu,offset:Cu,count:gu,field:du}:"day"===t&&e?{floor:xu,offset:Bu,count:bu,field:Mu}:"hour"===t&&e?{floor:Tu,offset:Su,count:_u,field:Lu}:"minute"===t&&e?{floor:Ru,offset:Uu,count:Iu,field:ku}:"second"===t&&e?{floor:Wu,offset:qu,count:zu,field:Vu}:"year"===t?{floor:uu,offset:nu,count:ru,field:Du}:"month"===t?{floor:hu,offset:lu,count:cu,field:Fu}:"day"===t?{floor:Eu,offset:yu,count:mu,field:pu}:"hour"===t?{floor:vu,offset:Au,count:_u,field:wu}:"minute"===t?{floor:Nu,offset:Ou,count:Iu,field:Hu}:"second"===t?{floor:Pu,offset:ju,count:zu,field:Yu}:{floor:Gu,offset:Xu,count:$u},t.getOBBFromLine=function(t,e,u){return Fe=e.x-t.x,fe=e.y-t.y,Ce=fe,ge=-Fe,ye=de=Math.sqrt(Ce*Ce+ge*ge),me=u,Ce/=de,ge/=de,Ee=u/2,Fe=Ee*Ce,fe=Ee*ge,{point1:{x:t.x+Fe,y:t.y+fe},point2:{x:t.x-Fe,y:t.y-fe},point3:{x:e.x+Fe,y:e.y+fe},point4:{x:e.x-Fe,y:e.y-fe},width:ye,height:me,left:Math.min(t.x,e.x)-Math.abs(Fe),top:Math.min(t.y,e.y)-Math.abs(fe)}},t.getRectIntersect=function(t,e,u){return null===t?e:null===e?t:(Gt=t.x1,Xt=t.x2,$t=t.y1,Zt=t.y2,Kt=e.x1,Qt=e.x2,Jt=e.y1,te=e.y2,u&&(Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt])),Gt>=Qt||Xt<=Kt||$t>=te||Zt<=Jt?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Gt,Kt),y1:Math.max($t,Jt),x2:Math.min(Xt,Qt),y2:Math.min(Zt,te)})},t.getScale=t=>t.offsetWidth>0?Ju(t):tn(t),t.getScaleX=Ju,t.getScaleY=tn,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.getTimeFormatter=function(t,e){return u=>{const n=J(u),r=n[qe(e)](),D=n[Ve(e)]()+1,i=Math.floor((D-1)/3)+1,s=n[Ge(e)](),o=n["get"+(e?"UTC":"")+"Day"](),a=n[Xe(e)](),h=(a-1)%12+1,l=n[$e(e)](),c=n[Ze(e)](),F=n[Ke(e)]();return(t||"").replace(/YYYY/g,q(r+"",4,"0","left")).replace(/yyyy/g,r+"").replace(/yy/g,r%100+"").replace(/Q/g,i+"").replace(/MM/g,q(D,2,"0","left")).replace(/M/g,D+"").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.hexToRgb=zt,t.hourCount=_u,t.hourField=wu,t.hourFloor=vu,t.hourOffset=Au,t.hoursGetterName=Xe,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=St,t.interpolateDate=function(t,e){const u=t.valueOf(),n=e.valueOf(),r=new Date;return t=>(r.setTime(u*(1-t)+n*t),r)},t.interpolateNumber=$,t.interpolateNumberRound=function(t,e){return function(u){return Math.round(t*(1-u)+e*u)}},t.interpolateRgb=Wt,t.interpolateString=function(t,e){let u,n,r,D=Z.lastIndex=K.lastIndex=0,i=-1;const s=[],o=[];for(t+="",e+="";(u=Z.exec(t))&&(n=K.exec(e));)(r=n.index)>D&&(r=e.slice(D,r),s[i]?s[i]+=r:s[++i]=r),(u=u[0])===(n=n[0])?s[i]?s[i]+=n:s[++i]=n:(s[++i]=null,o.push({i:i,x:$(u,n)})),D=K.lastIndex;return D<e.length&&(r=e.slice(D),s[i]?s[i]+=r:s[++i]=r),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|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=D,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,n){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(v(e)!==v(u))return!1;if(i(e))return!!(null==n?void 0:n.skipFunction);if("object"!=typeof e)return!1;if(F(e)){if(e.length!==u.length)return!1;for(let r=e.length-1;r>=0;r--)if(!t(e[r],u[r],n))return!1;return!0}if(!l(e))return!1;const r=A(e),D=A(u);if(r.length!==D.length)return!1;r.sort(),D.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=D[t])return!1;for(let D=r.length-1;D>=0;D--){const i=r[D];if(!t(e[i],u[i],n))return!1}return!0},t.isFunction=i,t.isGreater=function(t,e,u,n){return t>e&&!Y(t,e,u,n)},t.isIntersect=ee,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=g,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=Ne,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 r=u.type,D=e.bbox;let i=u.coordinates;if(D&&!0===ne(t,{x1:D[0],x2:D[1],y1:D[1],y2:D[3]},!0))return!1;"Polygon"===r&&(i=[i]);let s=!1;for(let e=0;e<i.length;++e)for(let u=0;u<i[e].length;++u){if(Le(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?(Gt=t.x1,Xt=t.x2,$t=t.y1,Zt=t.y2,Kt=e.x1,Qt=e.x2,Jt=e.y1,te=e.y2,Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt]),!(Gt>Qt||Xt<Kt||$t>te||Zt<Jt)):!(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 r=oe(t,u),D=oe(e,u),i=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",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(),n.save(),n.fillStyle="green",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());const s=se(t),o=se(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(r[0],r[1]),l=i(r[1],r[2]),c=i(D[0],D[1]),F=i(D[1],D[2]),f=u?t.angle:ie(t.angle);let C=u?t.angle+nt:ie(90-t.angle);const g=u?e.angle:ie(e.angle);let d=u?e.angle+nt:ie(90-e.angle);C>Dt&&(C-=Dt),d>Dt&&(d-=Dt);const E=(t,e,u,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(re(r,u)+re(r,n))/2>re(r,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,g,h,l)&&E((e.y2-e.y1)/2,d,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=r,t.isUndefined=t=>void 0===t,t.isValid=o,t.isValidNumber=d,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.keys=T,t.last=N,t.lengthFromPointToLine=ft,t.lineIntersectPolygon=Se,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)),H(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 r=[];n.forEach((t=>{let e;(e=pe(u,t)).length>1?r.push(t):u=e[0]})),e.push(u),r.length&&t(r[0],r.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=$u,t.millisecondsFloor=Gu,t.millisecondsGetterName=Ke,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=Iu,t.minuteField=Hu,t.minuteFloor=Nu,t.minuteOffset=Ou,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 r=0;r<n.length;r++){const D=n[r];"constructor"!==D&&(u?null!=e[D]:null==t[D])&&(t[D]=e[D])}}else S(t,e,u)},t.monthCount=cu,t.monthField=Fu,t.monthFloor=hu,t.monthGetterName=Ve,t.monthOffset=lu,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.normalTransform=function(t,e,u,n,r,D,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 g,d;s?(g=s[0],d=s[1]):(g=u,d=n);const E=g-u,y=d-n,m=o*f+h*C,p=a*f+l*C,x=h*f-o*C,B=l*f-a*C;t.a=r*m,t.b=r*p,t.c=D*x,t.d=D*B,t.e=c+o*g+h*d-m*E-x*y,t.f=F+a*g+l*d-p*E-B*y},t.normalizePadding=function(t){if(d(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:r=0}=t;return[e,u,n,r]}return[0,0,0,0]},t.pad=q,t.parseUint8ToImageData=(t,e,u)=>{const n=new Uint8ClampedArray(t),r=new Uint8ClampedArray(t.length);for(let t=u-1;t>=0;t--)for(let D=0;D<e;D++){const i=t*e*4+4*D,s=(u-t)*e*4+4*D;r[s]=n[i],r[s+1]=n[i+1],r[s+2]=n[i+2],r[s+3]=n[i+3]}return new ImageData(r,e,u)},t.pi=ut,t.pi2=Dt,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 r=t[n];let D=!1;e.forEach((t=>{(c(t)&&t===n||t instanceof RegExp&&n.match(t))&&(D=!0)})),D||(u[n]=r)})),u},t.pointAt=function(t,e,u,n,r){let D,i;return"number"==typeof t&&"number"==typeof u&&(D=(1-r)*t+r*u),"number"==typeof e&&"number"==typeof n&&(i=(1-r)*e+r*n),{x:D,y:i}},t.pointBetweenLine=_e,t.pointInAABB=function(t,e){return ne(t,e,!1)},t.pointInLine=be,t.pointInOBB=function(t,e){return xe.x=(e.point1.x+e.point2.x)/2,xe.y=(e.point1.y+e.point2.y)/2,Be.x=(e.point3.x+e.point4.x)/2,Be.y=(e.point3.y+e.point4.y)/2,be(t,xe,Be,e.height)},t.pointInRect=ne,t.polarToCartesian=function(t,e,u){return{x:t.x+e*Math.cos(u),y:t.y+e*Math.sin(u)}},t.polygonContainPoint=Le,t.polygonIntersectPolygon=function(t,e){for(let u=0;u<e.length;u++){if(Le(t,e[u].x,e[u].y))return!0;if(u>0&&Se(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=H,t.radianToDegree=Mt,t.range=function(t,e,u){o(e)||(e=t,t=0),o(u)||(u=1);let n=-1;const r=0|Math.max(0,Math.ceil((e-t)/u)),D=new Array(r);for(;++n<r;)D[n]=t+n*u;return D},t.rectInsideAnotherRect=function(e,u,n){return e&&u?(Gt=e.x1,Xt=e.x2,$t=e.y1,Zt=e.y2,Kt=u.x1,Qt=u.x2,Jt=u.y1,te=u.y2,n&&(Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt])),Gt>Kt&&Xt<Qt&&$t>Jt&&Zt<te?t.InnerBBox.BBOX1:Kt>Gt&&Qt<Xt&&Jt>$t&&te<Zt?t.InnerBBox.BBOX2:t.InnerBBox.NONE):t.InnerBBox.NONE},t.rgbToHex=Yt,t.rgbToHsl=Lt,t.secondCount=zu,t.secondField=Yu,t.secondFloor=Pu,t.secondOffset=ju,t.secondsGetterName=Ze,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.shuffleArray=function(t,e=Math.random){let u,n,r=t.length;for(;r;)u=Math.floor(e()*r),n=t[--r],t[r]=t[u],t[u]=n;return t},t.sin=lt,t.span=t=>t.length<=1?0:N(t)-t[0],t.sqrt=ct,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ie(t)).length)return 0;t=t.replace(Ue()," ");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(Re(e)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,u)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[u]?"":e[u])):t},t.tau=rt,t.throttle=function(t,e,u){let n=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(u)&&(n="leading"in u?!!u.leading:n,r="trailing"in u?!!u.trailing:r),X(t,e,{leading:n,trailing:r,maxWait:e})},t.tickStep=function(t,e,u){const n=Math.abs(e-t)/Math.max(0,u);let r=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const D=n/r;return D>=U?r*=10:D>=k?r*=5:D>=P&&(r*=2),e<t?-r:r},t.toDate=J,t.toNumber=I,t.toValidNumber=function(t){if(d(t))return t;const e=+t;return d(e)?e:0},t.transformBounds=function(t,e,u,n,r,D,i){if(!(it(n)<=et||it(r)<=et)){if(1!==n&&t.scaleX(n),1!==r&&t.scaleY(r),isFinite(D)&&Math.abs(D)>et){let e=0,u=0;void 0!==i&&(e=i[0],u=i[1]),t.rotate(D,e,u)}t.translate(e,u)}},t.transformBoundsWithMatrix=xt,t.truncate=(t,e,u="right",n)=>{const r=s(n)?"…":n,D=t+"",i=D.length,o=Math.max(0,e-r.length);return i<=e?D:"left"===u?r+D.slice(i-o):"center"===u?D.slice(0,Math.ceil(o/2))+r+D.slice(i-Math.floor(o/2)):D.slice(0,o)+r},t.unionAABB=pe,t.uniqArray=function(t){return t&&F(t)?Array.from(new Set(L(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=bu,t.utcDayField=Mu,t.utcDayFloor=xu,t.utcDayOffset=Bu,t.utcHourField=Lu,t.utcHourFloor=Tu,t.utcHourOffset=Su,t.utcMinuteField=ku,t.utcMinuteFloor=Ru,t.utcMinuteOffset=Uu,t.utcMonthCount=gu,t.utcMonthField=du,t.utcMonthFloor=fu,t.utcMonthOffset=Cu,t.utcSecondField=Vu,t.utcSecondFloor=Wu,t.utcSecondOffset=qu,t.utcYearCount=ou,t.utcYearField=au,t.utcYearFloor=iu,t.utcYearOffset=su,t.uuid=(t,e)=>{const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];let r;if(e=e||u.length,t)for(r=0;r<t;r++)n[r]=u[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(t=0|16*Math.random(),n[r]=u[19===r?3&t|8:t])}return n.join("")},t.variance=R,t.yearCount=ru,t.yearField=Du,t.yearFloor=uu,t.yearOffset=nu}));
|
|
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 r(t,e,u){this.fn=t,this.context=e,this.once=u||!1}function D(t,e,n,D,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,D||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,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(u?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},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 r=0,D=n.length,i=new Array(D);r<D;r++)i[r]=n[r].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,r,D,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,r),!0;case 5:return h.fn.call(h.context,e,n,r,D),!0;case 6:return h.fn.call(h.context,e,n,r,D,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,r);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 D(this,t,e,u,!1)},s.prototype.once=function(t,e,u){return D(this,t,e,u,!0)},s.prototype.removeListener=function(t,e,n,r){var D=u?u+t:t;if(!this._events[D])return this;if(!e)return i(this,D),this;var s=this._events[D];if(s.fn)s.fn!==e||r&&!s.once||n&&s.context!==n||i(this,D);else{for(var o=0,a=[],h=s.length;o<h;o++)(s[o].fn!==e||r&&!s[o].once||n&&s[o].context!==n)&&a.push(s[o]);a.length?this._events[D]=1===a.length?a[0]:a:i(this,D)}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 r=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,D=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||r(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)||!r(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||r(t,"String")},F=t=>Array.isArray?Array.isArray(t):r(t,"Array"),f=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},C=t=>r(t,"Date"),g=(t,e=!1)=>{const u=typeof t;return e?"number"===u:"number"===u||r(t,"Number")},d=t=>g(t)&&Number.isFinite(t),E=t=>r(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),r=[];for(const t in n)r.push(t);let{length:D}=r,i=-1;for(;D--;){const D=r[++i];o(n[D])&&"object"==typeof n[D]?B(t,e,D,u):b(t,D,n[D])}}}}function B(t,e,u,n=!1){const r=t[u],D=e[u];let i=e[u],s=!0;if(F(D)){if(n)i=[];else if(F(r))i=r;else if(f(r)){i=new Array(r.length);let t=-1;const e=r.length;for(;++t<e;)i[t]=r[t]}}else l(D)?(i=r,"function"!=typeof r&&"object"==typeof r||(i={})):s=!1;s&&x(i,D,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 v(t){return Object.prototype.toString.call(t)}function A(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 T(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 S(t,e,u){const n=T(e);for(let r=0;r<n.length;r++){const D=n[r];(u?null!=e[D]:null==t[D])&&(t[D]=e[D])}return t}function L(t){return o(t)?F(t)?t:[t]:[]}function N(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 I(t){return Number(t)}function H(t,e,u=I){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 r=(n-1)*e,D=Math.floor(r),i=u(t[D],D,t);return i+(u(t[D+1],D+1,t)-i)*(r-D)}function R(t,e){let u,n=0,r=0,D=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(u=e-r,r+=u/++n,D+=u*(e-r));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(s=+s)>=s&&(u=s-r,r+=u/++n,D+=u*(s-r))}return n>1?D/(n-1):0}const U=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 r=n,D=u*Math.max(t,e);return Math.abs(t-e)<=Math.max(r,D)}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 r=u,D=t+"",i=e-D.length;return i<=0?D:"left"===n?W(r,i)+D:"center"===n?W(r,Math.floor(i/2))+D+W(r,Math.ceil(i/2)):D+W(r,i)},V=function(t,e,u){return t<e?e:t>u?u:t};let G=!1;try{G="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){G=!1}function X(t,e,u){let n,r,D,i,s,o,h=0,l=!1,c=!1,F=!0;const f=!e&&0!==e&&G;if("function"!=typeof t)throw new TypeError("Expected a function");function C(e){const u=n,D=r;return n=r=void 0,h=e,i=t.apply(D,u),i}function g(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>=D}function y(){const t=Date.now();if(E(t))return m(t);s=g(y,function(t){const u=t-h,n=e-(t-o);return c?Math.min(n,D-u):n}(t))}function m(t){return s=void 0,F&&n?C(t):(n=r=void 0,i)}function p(...t){const u=Date.now(),D=E(u);if(n=t,r=this,o=u,D){if(void 0===s)return function(t){return h=t,s=g(y,e),l?C(t):i}(o);if(c)return s=g(y,e),C(o)}return void 0===s&&(s=g(y,e)),i}return e=+e||0,a(u)&&(l=!!u.leading,c="maxWait"in u,c&&(D=Math.max(d(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=r=s=void 0},p.flush=function(){return void 0===s?i:m(Date.now())},p.pending=function(){return void 0!==s},p}function $(t,e){return u=>t*(1-u)+e*u}G=!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,rt=2*ut,Dt=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,r=u.y-e.y,D=t.x-e.x,i=t.y-e.y;return Math.abs(n*i-D*r)/Math.sqrt(n*n+r*r)}function Ct(t,e){return t[0]*e[1]-t[1]*e[0]}function gt(t,e){return t.x*e.y-t.y*e.x}function dt(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 g(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return g(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:r,x2:D,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*r+u.e,u.b*n+u.d*r+u.f),t.add(u.a*D+u.c*r+u.e,u.b*D+u.d*r+u.f),t.add(u.a*D+u.c*i+u.e,u.b*D+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 r=this.scalePoints(t,e,u,n);return this.clear().add(r[0],r[1]).add(r[2],r[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:r,x2:D,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*r+a,o*n+s*r+h,s*n-o*i+a,o*n+s*i+h,s*D-o*r+a,o*D+s*r+h,s*D-o*i+a,o*D+s*i+h]}scalePoints(t,e,u,n){const{x1:r,y1:D,x2:i,y2:s}=this;return[t*r+(1-t)*u,e*D+(1-e)*n,t*i+(1-t)*u,e*s+(1-e)*n]}}function bt(t){return t*(Math.PI/180)}function Mt(t){return 180*t/Math.PI}const vt=(t=0)=>{if(t<0)for(;t<-rt;)t+=rt;else if(t>0)for(;t>rt;)t-=rt;return t},At=vt,_t=(t=0)=>t>360||t<-360?t%360:t,wt=_t;class Tt{constructor(t=1,e=0,u=0,n=1,r=0,D=0){this.a=t,this.b=e,this.c=u,this.d=n,this.e=r,this.f=D}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,r,D){return!(this.e!==r||this.f!==D||this.a!==t||this.d!==n||this.b!==e||this.c!==u)}setValue(t,e,u,n,r,D){return this.a=t,this.b=e,this.c=u,this.d=n,this.e=r,this.f=D,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,r=this.e,D=this.f,i=new Tt,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*D-n*r)/s,i.f=-(t*D-e*r)/s,i}rotate(t){const e=Math.cos(t),u=Math.sin(t),n=this.a*e+this.c*u,r=this.b*e+this.d*u,D=this.a*-u+this.c*e,i=this.b*-u+this.d*e;return this.a=n,this.b=r,this.c=D,this.d=i,this}rotateByCenter(t,e,u){const n=Math.cos(t),r=Math.sin(t),D=(1-n)*e+r*u,i=(1-n)*u-r*e,s=n*this.a-r*this.b,o=r*this.a+n*this.b,a=n*this.c-r*this.d,h=r*this.c+n*this.d,l=n*this.e-r*this.f+D,c=r*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,r,D){return this.multiply(t,e,u,n,r,D),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:r,f:D}=this;return this.a=e,this.b=t,this.c=n,this.d=u,this.e=D,this.f=r,this}multiply(t,e,u,n,r,D){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*r+o*D+this.e,C=s*r+a*D+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 Tt;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:r,d:D,e:i,f:s}=this,o=u*D-n*r,a=D/o,h=-n/o,l=-r/o,c=u/o,F=(r*s-D*i)/o,f=-(u*s-n*i)/o,{x:C,y:g}=t;e.x=C*a+g*l+F,e.y=C*h+g*c+f}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Tt(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,r=t*n-e*u,D={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);D.rotateDeg=e>0?Math.acos(t/i):-Math.acos(t/i),D.scaleX=i,D.scaleY=r/i,D.skewX=(t*u+e*n)/r,D.skewY=0}else if(0!==u||0!==n){const i=Math.sqrt(u*u+n*n);D.rotateDeg=Math.PI/2-(n>0?Math.acos(-u/i):-Math.acos(u/i)),D.scaleX=r/i,D.scaleY=i,D.skewX=0,D.skewY=(t*u+e*n)/r}return D.rotateDeg=Mt(D.rotateDeg),D}}function St(t,e,u){e/=100,u/=100;const n=(1-Math.abs(2*u-1))*e,r=n*(1-Math.abs(t/60%2-1)),D=u-n/2;let i=0,s=0,o=0;return 0<=t&&t<60?(i=n,s=r,o=0):60<=t&&t<120?(i=r,s=n,o=0):120<=t&&t<180?(i=0,s=n,o=r):180<=t&&t<240?(i=0,s=r,o=n):240<=t&&t<300?(i=r,s=0,o=n):300<=t&&t<360&&(i=n,s=0,o=r),i=Math.round(255*(i+D)),s=Math.round(255*(s+D)),o=Math.round(255*(o+D)),{r:i,g:s,b:o}}function Lt(t,e,u){t/=255,e/=255,u/=255;const n=Math.min(t,e,u),r=Math.max(t,e,u),D=r-n;let i=0,s=0,o=0;return i=0===D?0:r===t?(e-u)/D%6:r===e?(u-t)/D+2:(t-e)/D+4,i=Math.round(60*i),i<0&&(i+=360),o=(r+n)/2,s=0===D?0:D/(1-Math.abs(2*o-1)),s=+(100*s).toFixed(1),o=+(100*o).toFixed(1),{h:i,s:s,l:o}}const Nt=/^#([0-9a-f]{3,8})$/,Ot={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 Ht(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Rt(t){return g(t)?new jt(t>>16,t>>8&255,255&t,1):F(t)?new jt(t[0],t[1],t[2]):new jt(255,255,255)}function Ut(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function kt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Pt{static Brighter(t,e=1){return 1===e?t:new Pt(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Pt(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const u=t instanceof Pt?t:new Pt(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(Ot[t]))return function(t){return g(t)?new jt(t>>>24,t>>>16&255,t>>>8&255,255&t):F(t)?new jt(t[0],t[1],t[2],t[3]):new jt(255,255,255,1)}(Ot[t]);if(o(It[t]))return Rt(It[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 jt((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 jt(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 jt(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 jt(u.r,u.g,u.b,parseFloat(t[3]))}}constructor(t){const e=Pt.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new jt(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}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}add(t){const{r:e,g:u,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,u+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),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,r=Lt(this.color.r,this.color.g,this.color.b),D=St(s(t)?r.h:V(t,0,360),s(e)?r.s:e>=0&&e<=1?100*e:e,s(u)?r.l:u<=1&&u>=0?100*u:u);return this.color=new jt(D.r,D.g,D.b,n),this}setRGB(t,e,u){return!s(t)&&(this.color.r=t),!s(e)&&(this.color.g=e),!s(u)&&(this.color.b=u),this}setHex(t){const e=`${t}`.trim().toLowerCase(),u=Nt.exec(e),n=parseInt(u[1],16),r=u[1].length;return 3===r?new jt((n>>8&15)+((n>>8&15)<<4),(n>>4&15)+((n>>4&15)<<4),(15&n)+((15&n)<<4),1):6===r?Rt(n):8===r?new jt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):this}setColorName(t){const e=It[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,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}clone(){return new Pt(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const u=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,u),this.color.g=Math.pow(t.color.g,u),this.color.b=Math.pow(t.color.b,u),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ut(t.color.r),this.color.g=Ut(t.color.g),this.color.b=Ut(t.color.b),this}copyLinearToSRGB(t){return this.color.r=kt(t.color.r),this.color.g=kt(t.color.g),this.color.b=kt(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class jt{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}=Lt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${u}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function zt(t){let e="",u="",n="";const r="#"===t[0]?1:0;for(let D=r;D<t.length;D++)"#"!==t[D]&&(D<r+2?e+=t[D]:D<r+4?u+=t[D]:D<r+6&&(n+=t[D]));return[parseInt(e,16),parseInt(u,16),parseInt(n,16)]}function Yt(t,e,u){return Number((1<<24)+(t<<16)+(e<<8)+u).toString(16).slice(1)}function Wt(t,e){const u=t.r,n=e.r,r=t.g,D=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(r*(1-t)+D*t),l=Math.round(i*(1-t)+s*t);return new jt(e,h,l,o*(1-t)+a*t)}}var qt=Object.freeze({__proto__:null,Color:Pt,DEFAULT_COLORS:It,RGB:jt,hexToRgb:zt,hslToRgb:St,interpolateRgb:Wt,rgbToHex:Yt,rgbToHsl:Lt});function Vt(t,e,u){t[0]=e[0]-u[0],t[1]=e[1]-u[1]}let Gt,Xt,$t,Zt,Kt,Qt,Jt,te;function ee(t,e,u,n){let r,D=t[0],i=e[0],s=u[0],o=n[0];return i<D&&(r=i,i=D,D=r),o<s&&(r=o,o=s,s=r),!(i<s||o<D)&&(D=t[1],i=e[1],s=u[1],o=n[1],i<D&&(r=i,i=D,D=r),o<s&&(r=o,o=s,s=r),!(i<s||o<D))}var ue;function ne(t,e,u){return!e||(u?(Gt=e.x1,Xt=e.x2,$t=e.y1,Zt=e.y2,Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),t.x>=Gt&&t.x<=Xt&&t.y>=$t&&t.y<=Zt):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}function re(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function De({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 ie(t){return t/180*Math.PI}function se(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function oe(t,e){const u=e?t.angle:ie(t.angle),n=se(t);return[De({x:t.x1,y:t.y1},u,n),De({x:t.x2,y:t.y1},u,n),De({x:t.x2,y:t.y2},u,n),De({x:t.x1,y:t.y2},u,n)]}let ae,he,le,ce,Fe,fe,Ce,ge,de,Ee,ye,me;function pe(t,e,u=3,n=!1){let r=t.x1,D=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,h=e.y1,l=e.y2;if(n){let t;r>D&&(t=r,r=D,D=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(r>=a||D<=o||i>=l||s<=h)return[t,e];const c=(D-r+2*u)*(s-i+2*u),F=(a-o+2*u)*(l-h+2*u),f=Math.min(r,o),C=Math.min(i,h),g=Math.max(D,a),d=Math.max(s,l);return c+F>(g-f)*(d-C)?[{x1:f,x2:g,y1:C,y2:d}]:[t,e]}t.InnerBBox=void 0,(ue=t.InnerBBox||(t.InnerBBox={}))[ue.NONE=0]="NONE",ue[ue.BBOX1=1]="BBOX1",ue[ue.BBOX2=2]="BBOX2";const xe={x:0,y:0},Be={x:0,y:0};function be(t,e,u,n){return ft(t,e,u)<=n/2&&_e(t,e,u)}const Me={x:0,y:0},ve={x:0,y:0},Ae={x:0,y:0};function _e(t,e,u){return Me.x=e.x-t.x,Me.y=e.y-t.y,ve.x=u.x-t.x,ve.y=u.y-t.y,Ae.x=e.y-u.y,Ae.y=u.x-e.x,gt(Me,Ae)*gt(ve,Ae)<0}class we{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:r}){return(t?t+" ":"")+(e?e+" ":"")+(u?u+" ":"")+(n||12)+"px "+(r||"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 we.instance||(we.instance=new we(t)),we.instance}}const Te=1e-8;function Se(t,e,u,n,r){for(let D=0,i=r[r.length-1];D<r.length;D++){const s=r[D];if(ee([t,e],[u,n],[s.x,s.y],[i.x,i.y]))return!0;i=s}return!1}function Le(t,e,u){let n=0,r=t[0];if(!r)return!1;for(let D=1;D<t.length;D++){const i=t[D];n+=Ne(r.x,r.y,i.x,i.y,e,u),r=i}const D=t[0];return Oe(r.x,D.x)&&Oe(r.y,D.y)||(n+=Ne(r.x,r.y,D.x,D.y,e,u)),0!==n}function Ne(t,e,u,n,r,D){if(D>e&&D>n||D<e&&D<n)return 0;if(n===e)return 0;const i=(D-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===r?1/0:o>r?s:0}function Oe(t,e){return Math.abs(t-e)<Te}const Ie=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(He(),"")},He=({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")},Re=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"},Ue=()=>/[#*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\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\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 ke(t,e={}){const{fontStyle:u=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:D=e.fontSize,fontFamily:i=e.fontFamily}=t;return(u?u+" ":"")+(n?n+" ":"")+(r?r+" ":"")+D+"px "+(i||"sans-serif")}class Pe{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=ke(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:r=n.fontStyle,fontVariant:D=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:F=(null!=l?l:"middle"),ellipsis:f,limit:C}=this._userSpec;let{lineHeight:g=s}=this._userSpec;if(c(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=s*t}return{fontStyle:r,fontVariant:D,fontFamily:o,fontSize:s,fontWeight:i,textAlign:h,textBaseline:F,ellipsis:f,limit:C,lineHeight:g}}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:r,textBaseline:D,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:r,textBaseline:D,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){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const u=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:u.width,height:null!==(e=r)&&void 0!==e?e:n}}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 r=this._measureSpecialChar(n);s(r)&&Pe.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),s(r)&&["F","W"].includes(Re(n))&&(r=this._measureFullSizeChar()),s(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const u={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],D=["F","W"].includes(Re(r))?1:.53;u.width+=D*n}return u.height=null!==(e=r)&&void 0!==e?e:n,u}_measureReduce(t,e){var u;const{fontSize:n,lineHeight:r}=this.textSpec,D={width:0,height:0};if(s(t))return D;if(F(t)){const i=t.filter(o).map((t=>t.toString()));return 0===i.length?D:1===i.length?e(i[0]):{width:i.reduce(((t,u)=>Math.max(t,e(u).width)),0),height:i.length*((null!==(u=r)&&void 0!==u?u:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(s(this._numberCharSize)){const t=this._standardMethod(Pe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Pe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return s(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Pe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(s(this._letterCharSize)){const t=this._standardMethod(Pe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Pe.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)}}Pe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Pe.NUMBERS_CHAR_SET="0123456789",Pe.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function ze(t,e,u){const n=[e].concat([].slice.call(u));je&&console[t].apply(console,n)}var Ye;t.LoggerLevel=void 0,(Ye=t.LoggerLevel||(t.LoggerLevel={}))[Ye.None=0]="None",Ye[Ye.Error=1]="Error",Ye[Ye.Warn=2]="Warn",Ye[Ye.Info=3]="Info",Ye[Ye.Debug=4]="Debug";class We{static getInstance(t,e){return We._instance&&g(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._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):ze(null!==(u=this._method)&&void 0!==u?u:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&ze(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&ze(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&ze(this._method||"log","DEBUG",e),this}}function qe(t){return t?"getUTCFullYear":"getFullYear"}function Ve(t){return t?"getUTCMonth":"getMonth"}function Ge(t){return t?"getUTCDate":"getDate"}function Xe(t){return t?"getUTCHours":"getHours"}function $e(t){return t?"getUTCMinutes":"getMinutes"}function Ze(t){return t?"getUTCSeconds":"getSeconds"}function Ke(t){return t?"getUTCMilliseconds":"getMilliseconds"}We._instance=null;const Qe=1e3,Je=6e4,tu=36e5,eu=24*tu,uu=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),nu=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),ru=(t,e)=>e.getFullYear()-t.getFullYear(),Du=t=>t.getFullYear(),iu=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),su=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),ou=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),au=t=>t.getUTCFullYear(),hu=t=>(t.setDate(1),t.setHours(0,0,0,0),t),lu=(t,e)=>(t.setMonth(t.getMonth()+e),t),cu=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),Fu=t=>t.getMonth(),fu=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),Cu=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),gu=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),du=t=>t.getUTCMonth(),Eu=t=>(t.setHours(0,0,0,0),t),yu=(t,e)=>(t.setDate(t.getDate()+e),t),mu=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/eu,pu=t=>t.getDate()-1,xu=t=>(t.setUTCHours(0,0,0,0),t),Bu=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),bu=(t,e)=>(+e-+t)/eu,Mu=t=>t.getUTCDate()-1,vu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Qe-t.getMinutes()*Je),t),Au=(t,e)=>(t.setHours(t.getHours()+e),t),_u=(t,e)=>(+e-+t)/tu,wu=t=>t.getHours(),Tu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Qe-t.getUTCMinutes()*Je),t),Su=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Lu=t=>t.getUTCHours(),Nu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*Qe),t),Ou=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Iu=(t,e)=>(+e-+t)/Je,Hu=t=>t.getMinutes(),Ru=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*Qe),t),Uu=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),ku=t=>t.getUTCMinutes(),Pu=t=>(t.setTime(+t-t.getMilliseconds()),t),ju=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),zu=(t,e)=>(+e-+t)/Qe,Yu=t=>t.getSeconds(),Wu=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),qu=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Vu=t=>t.getUTCSeconds(),Gu=t=>t,Xu=(t,e)=>(t.setTime(+t+e),t),$u=(t,e)=>+e-+t,Zu=(t,e)=>u=>{const n=new Date(+u-1);return e(n,1),t(n),n},Ku=(t,e)=>(u,n)=>{const r=new Date,D=new Date;return r.setTime(+u),D.setTime(+n),t(r),t(D),Math.floor(e(r,D))};function Qu(t){const{x:e,y:u}=t.getBoundingClientRect();return{x:e,y:u}}const Ju=t=>t.getBoundingClientRect().width/t.offsetWidth,tn=t=>t.getBoundingClientRect().height/t.offsetHeight;var en=6371008.8,un={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*en,kilometers:6371.0088,kilometres:6371.0088,meters:en,metres:en,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:en/1852,radians:1,yards:6967335.223679999};t.AABBBounds=class extends Bt{},t.Bounds=Bt,t.Color=Pt,t.ColorUtil=qt,t.DAY=eu,t.DEFAULT_COLORS=It,t.EventEmitter=n,t.GraphicUtil=we,t.HOUR=tu,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=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:u=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<u)return 0;let D=0;const i=e=>{D++,t.delete(e)},s=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<r)return i(e);let u=0;for(;s-t.timestamp[t.timestamp.length-1-u]<n&&(u++,!(u>=r)););if(u<r)return i(e);for(;s-t.timestamp[0]>n;)t.timestamp.shift()})),D}addLimitedTimestamp(t,e,u){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=u;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>u;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>u;)t.timestamp.shift()}},t.Logger=We,t.MINUTE=Je,t.MONTH=26784e5,t.Matrix=Tt,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.RGB=jt,t.SECOND=Qe,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=Pe,t.YEAR=31536e6,t.abs=it,t.acos=function(t){return t>1?0:t<-1?ut:Math.acos(t)},t.array=L,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 r=u+n>>>1;O(t[r],e)>0?n=r:u=r+1}return u},t.clamp=V,t.clampAngleByDegree=wt,t.clampAngleByRadian=At,t.clampDegree=_t,t.clampRadian=vt,t.clampRange=(t,e,u)=>{let[n,r]=t;r<n&&(n=t[1],r=t[0]);const D=r-n;return D>=u-e?[e,u]:(n=Math.min(Math.max(n,e),u-D),[n,n+D])},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 r=[],D=[];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=r.indexOf(u);if(-1!==t)return D[t];r.push(u),D.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),r=e.length;u=n?new Array(r):"object"==typeof e?{}:D(e)||g(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,r=e[n];u[n]=t(r)}return u},t.constant=t=>i(t)?t:()=>t,t.cos=ot,t.crossProduct=Ct,t.crossProductPoint=gt,t.dateGetterName=Ge,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=mu,t.dayField=pu,t.dayFloor=Eu,t.dayOffset=yu,t.debounce=X,t.defaults=S,t.degreeToRadian=bt,t.destination=function(t,e,u,n={}){const r=bt(t[0]),D=bt(t[1]),i=bt(u),s=function(t,e){void 0===e&&(e="kilometers");var u=un[e];if(!u)throw new Error(e+" units is invalid");return t/u}(e,n.units),o=Math.asin(Math.sin(D)*Math.cos(s)+Math.cos(D)*Math.sin(s)*Math.cos(i));return{x:Mt(r+Math.atan2(Math.sin(i)*Math.sin(s)*Math.cos(D),Math.cos(s)-Math.sin(D)*Math.sin(o))),y:Mt(o)}},t.deviation=function(t,e){const u=R(t,e);return u?Math.sqrt(u):u},t.eastAsianCharacterInfo=Re,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=qe,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return it(t-e)<et},t.fuzzyEqualVec=dt,t.generateCeil=Zu,t.generateCount=Ku,t.generateStepInterval=(t,{floor:e,offset:u,field:n,count:r})=>{const D=Math.floor(t);if(!Number.isFinite(D)||D<=0)return null;if(D<=1)return{floor:e,offset:u,ceil:Zu(e,u)};const i=Ku(e,r),s=n?t=>n(t)%D==0:t=>i(0,t)%D==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(D<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:Zu(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 ae=1/0,he=1/0,le=-1/0,ce=-1/0,t.forEach((t=>{ae>t.x&&(ae=t.x),le<t.x&&(le=t.x),he>t.y&&(he=t.y),ce<t.y&&(ce=t.y)})),{x1:ae,y1:he,x2:le,y2:ce}},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 r=n(t),D=parseFloat(r.width)-parseFloat(r.paddingLeft)-parseFloat(r.paddingRight)||t.clientWidth-1,i=parseFloat(r.height)-parseFloat(r.paddingTop)-parseFloat(r.paddingBottom)||t.clientHeight-1;return{width:D<=0?e:D,height:i<=0?u:i}},t.getContextFont=ke,t.getDecimalPlaces=yt,t.getElementAbsolutePosition=Qu,t.getElementRelativePosition=function(t,e){const u=Qu(t),n=Qu(e);return{x:u.x-n.x,y:u.y-n.y}},t.getFormatFromValue=function(t,e){const u=J(t),n=u[Ve(e)]()+1,r=u[Ge(e)](),D=u[Xe(e)](),i=u[$e(e)](),s=u[Ze(e)](),o=0===u[Ke(e)](),a=o&&0===s,h=a&&0===i,l=h&&0===D,c=l&&1===r;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(!ee(t,e,u,n))return!1;const r=[0,0],D=[0,0],i=[0,0];if(Vt(r,e,t),Vt(D,n,u),dt(r,D))return!0;Vt(i,u,t);const s=Ct(i,D)/Ct(r,D);return s>=0&&s<=1&&[t[0]+r[0]*s,t[1]+r[1]*s]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:iu,offset:su,count:ou,field:au}:"month"===t&&e?{floor:fu,offset:Cu,count:gu,field:du}:"day"===t&&e?{floor:xu,offset:Bu,count:bu,field:Mu}:"hour"===t&&e?{floor:Tu,offset:Su,count:_u,field:Lu}:"minute"===t&&e?{floor:Ru,offset:Uu,count:Iu,field:ku}:"second"===t&&e?{floor:Wu,offset:qu,count:zu,field:Vu}:"year"===t?{floor:uu,offset:nu,count:ru,field:Du}:"month"===t?{floor:hu,offset:lu,count:cu,field:Fu}:"day"===t?{floor:Eu,offset:yu,count:mu,field:pu}:"hour"===t?{floor:vu,offset:Au,count:_u,field:wu}:"minute"===t?{floor:Nu,offset:Ou,count:Iu,field:Hu}:"second"===t?{floor:Pu,offset:ju,count:zu,field:Yu}:{floor:Gu,offset:Xu,count:$u},t.getOBBFromLine=function(t,e,u){return Fe=e.x-t.x,fe=e.y-t.y,Ce=fe,ge=-Fe,ye=de=Math.sqrt(Ce*Ce+ge*ge),me=u,Ce/=de,ge/=de,Ee=u/2,Fe=Ee*Ce,fe=Ee*ge,{point1:{x:t.x+Fe,y:t.y+fe},point2:{x:t.x-Fe,y:t.y-fe},point3:{x:e.x+Fe,y:e.y+fe},point4:{x:e.x-Fe,y:e.y-fe},width:ye,height:me,left:Math.min(t.x,e.x)-Math.abs(Fe),top:Math.min(t.y,e.y)-Math.abs(fe)}},t.getRectIntersect=function(t,e,u){return null===t?e:null===e?t:(Gt=t.x1,Xt=t.x2,$t=t.y1,Zt=t.y2,Kt=e.x1,Qt=e.x2,Jt=e.y1,te=e.y2,u&&(Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt])),Gt>=Qt||Xt<=Kt||$t>=te||Zt<=Jt?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(Gt,Kt),y1:Math.max($t,Jt),x2:Math.min(Xt,Qt),y2:Math.min(Zt,te)})},t.getScale=t=>t.offsetWidth>0?Ju(t):tn(t),t.getScaleX=Ju,t.getScaleY=tn,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.getTimeFormatter=function(t,e){return u=>{const n=J(u),r=n[qe(e)](),D=n[Ve(e)]()+1,i=Math.floor((D-1)/3)+1,s=n[Ge(e)](),o=n["get"+(e?"UTC":"")+"Day"](),a=n[Xe(e)](),h=(a-1)%12+1,l=n[$e(e)](),c=n[Ze(e)](),F=n[Ke(e)]();return(t||"").replace(/YYYY/g,q(r+"",4,"0","left")).replace(/yyyy/g,r+"").replace(/yy/g,r%100+"").replace(/Q/g,i+"").replace(/MM/g,q(D,2,"0","left")).replace(/M/g,D+"").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.hexToRgb=zt,t.hourCount=_u,t.hourField=wu,t.hourFloor=vu,t.hourOffset=Au,t.hoursGetterName=Xe,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=St,t.interpolateDate=function(t,e){const u=t.valueOf(),n=e.valueOf(),r=new Date;return t=>(r.setTime(u*(1-t)+n*t),r)},t.interpolateNumber=$,t.interpolateNumberRound=function(t,e){return function(u){return Math.round(t*(1-u)+e*u)}},t.interpolateRgb=Wt,t.interpolateString=function(t,e){let u,n,r,D=Z.lastIndex=K.lastIndex=0,i=-1;const s=[],o=[];for(t+="",e+="";(u=Z.exec(t))&&(n=K.exec(e));)(r=n.index)>D&&(r=e.slice(D,r),s[i]?s[i]+=r:s[++i]=r),(u=u[0])===(n=n[0])?s[i]?s[i]+=n:s[++i]=n:(s[++i]=null,o.push({i:i,x:$(u,n)})),D=K.lastIndex;return D<e.length&&(r=e.slice(D),s[i]?s[i]+=r:s[++i]=r),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|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t),t.isBoolean=D,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,n){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(v(e)!==v(u))return!1;if(i(e))return!!(null==n?void 0:n.skipFunction);if("object"!=typeof e)return!1;if(F(e)){if(e.length!==u.length)return!1;for(let r=e.length-1;r>=0;r--)if(!t(e[r],u[r],n))return!1;return!0}if(!l(e))return!1;const r=A(e),D=A(u);if(r.length!==D.length)return!1;r.sort(),D.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=D[t])return!1;for(let D=r.length-1;D>=0;D--){const i=r[D];if(!t(e[i],u[i],n))return!1}return!0},t.isFunction=i,t.isGreater=function(t,e,u,n){return t>e&&!Y(t,e,u,n)},t.isIntersect=ee,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=g,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=Ne,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 r=u.type,D=e.bbox;let i=u.coordinates;if(D&&!0===ne(t,{x1:D[0],x2:D[1],y1:D[1],y2:D[3]},!0))return!1;"Polygon"===r&&(i=[i]);let s=!1;for(let e=0;e<i.length;++e)for(let u=0;u<i[e].length;++u){if(Le(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?(Gt=t.x1,Xt=t.x2,$t=t.y1,Zt=t.y2,Kt=e.x1,Qt=e.x2,Jt=e.y1,te=e.y2,Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt]),!(Gt>Qt||Xt<Kt||$t>te||Zt<Jt)):!(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 r=oe(t,u),D=oe(e,u),i=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",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(),n.save(),n.fillStyle="green",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());const s=se(t),o=se(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(r[0],r[1]),l=i(r[1],r[2]),c=i(D[0],D[1]),F=i(D[1],D[2]),f=u?t.angle:ie(t.angle);let C=u?t.angle+nt:ie(90-t.angle);const g=u?e.angle:ie(e.angle);let d=u?e.angle+nt:ie(90-e.angle);C>Dt&&(C-=Dt),d>Dt&&(d-=Dt);const E=(t,e,u,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(re(r,u)+re(r,n))/2>re(r,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,g,h,l)&&E((e.y2-e.y1)/2,d,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=r,t.isUndefined=t=>void 0===t,t.isValid=o,t.isValidNumber=d,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.keys=T,t.last=N,t.lengthFromPointToLine=ft,t.lineIntersectPolygon=Se,t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=at,t.maxInArray=(t,e)=>{var u;if(0===t.length)return;let n=t[0];for(let r=1;r<t.length;r++){const D=t[r];(null!==(u=null==e?void 0:e(D,n))&&void 0!==u?u:D-n>0)&&(n=D)}return n},t.median=(t,e)=>{let u=t;return!0!==e&&(u=t.sort(O)),H(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 r=[];n.forEach((t=>{let e;(e=pe(u,t)).length>1?r.push(t):u=e[0]})),e.push(u),r.length&&t(r[0],r.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=$u,t.millisecondsFloor=Gu,t.millisecondsGetterName=Ke,t.millisecondsOffset=Xu,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=ht,t.minInArray=(t,e)=>{var u;if(0===t.length)return;let n=t[0];for(let r=1;r<t.length;r++){const D=t[r];(null!==(u=null==e?void 0:e(D,n))&&void 0!==u?u:D-n<0)&&(n=D)}return n},t.minuteCount=Iu,t.minuteField=Hu,t.minuteFloor=Nu,t.minuteOffset=Ou,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 r=0;r<n.length;r++){const D=n[r];"constructor"!==D&&(u?null!=e[D]:null==t[D])&&(t[D]=e[D])}}else S(t,e,u)},t.monthCount=cu,t.monthField=Fu,t.monthFloor=hu,t.monthGetterName=Ve,t.monthOffset=lu,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.normalTransform=function(t,e,u,n,r,D,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 g,d;s?(g=s[0],d=s[1]):(g=u,d=n);const E=g-u,y=d-n,m=o*f+h*C,p=a*f+l*C,x=h*f-o*C,B=l*f-a*C;t.a=r*m,t.b=r*p,t.c=D*x,t.d=D*B,t.e=c+o*g+h*d-m*E-x*y,t.f=F+a*g+l*d-p*E-B*y},t.normalizePadding=function(t){if(d(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:r=0}=t;return[e,u,n,r]}return[0,0,0,0]},t.pad=q,t.parseUint8ToImageData=(t,e,u)=>{const n=new Uint8ClampedArray(t),r=new Uint8ClampedArray(t.length);for(let t=u-1;t>=0;t--)for(let D=0;D<e;D++){const i=t*e*4+4*D,s=(u-t)*e*4+4*D;r[s]=n[i],r[s+1]=n[i+1],r[s+2]=n[i+2],r[s+3]=n[i+3]}return new ImageData(r,e,u)},t.pi=ut,t.pi2=Dt,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 r=t[n];let D=!1;e.forEach((t=>{(c(t)&&t===n||t instanceof RegExp&&n.match(t))&&(D=!0)})),D||(u[n]=r)})),u},t.pointAt=function(t,e,u,n,r){let D,i;return"number"==typeof t&&"number"==typeof u&&(D=(1-r)*t+r*u),"number"==typeof e&&"number"==typeof n&&(i=(1-r)*e+r*n),{x:D,y:i}},t.pointBetweenLine=_e,t.pointInAABB=function(t,e){return ne(t,e,!1)},t.pointInLine=be,t.pointInOBB=function(t,e){return xe.x=(e.point1.x+e.point2.x)/2,xe.y=(e.point1.y+e.point2.y)/2,Be.x=(e.point3.x+e.point4.x)/2,Be.y=(e.point3.y+e.point4.y)/2,be(t,xe,Be,e.height)},t.pointInRect=ne,t.polarToCartesian=function(t,e,u){return{x:t.x+e*Math.cos(u),y:t.y+e*Math.sin(u)}},t.polygonContainPoint=Le,t.polygonIntersectPolygon=function(t,e){for(let u=0;u<e.length;u++){if(Le(t,e[u].x,e[u].y))return!0;if(u>0&&Se(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=H,t.radianToDegree=Mt,t.range=function(t,e,u){o(e)||(e=t,t=0),o(u)||(u=1);let n=-1;const r=0|Math.max(0,Math.ceil((e-t)/u)),D=new Array(r);for(;++n<r;)D[n]=t+n*u;return D},t.rectInsideAnotherRect=function(e,u,n){return e&&u?(Gt=e.x1,Xt=e.x2,$t=e.y1,Zt=e.y2,Kt=u.x1,Qt=u.x2,Jt=u.y1,te=u.y2,n&&(Gt>Xt&&([Gt,Xt]=[Xt,Gt]),$t>Zt&&([$t,Zt]=[Zt,$t]),Kt>Qt&&([Kt,Qt]=[Qt,Kt]),Jt>te&&([Jt,te]=[te,Jt])),Gt>Kt&&Xt<Qt&&$t>Jt&&Zt<te?t.InnerBBox.BBOX1:Kt>Gt&&Qt<Xt&&Jt>$t&&te<Zt?t.InnerBBox.BBOX2:t.InnerBBox.NONE):t.InnerBBox.NONE},t.rgbToHex=Yt,t.rgbToHsl=Lt,t.secondCount=zu,t.secondField=Yu,t.secondFloor=Pu,t.secondOffset=ju,t.secondsGetterName=Ze,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.shuffleArray=function(t,e=Math.random){let u,n,r=t.length;for(;r;)u=Math.floor(e()*r),n=t[--r],t[r]=t[u],t[u]=n;return t},t.sin=lt,t.span=t=>t.length<=1?0:N(t)-t[0],t.sqrt=ct,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ie(t)).length)return 0;t=t.replace(Ue()," ");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(Re(e)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,u)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[u]?"":e[u])):t},t.tau=rt,t.throttle=function(t,e,u){let n=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(u)&&(n="leading"in u?!!u.leading:n,r="trailing"in u?!!u.trailing:r),X(t,e,{leading:n,trailing:r,maxWait:e})},t.tickStep=function(t,e,u){const n=Math.abs(e-t)/Math.max(0,u);let r=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const D=n/r;return D>=U?r*=10:D>=k?r*=5:D>=P&&(r*=2),e<t?-r:r},t.toDate=J,t.toNumber=I,t.toValidNumber=function(t){if(d(t))return t;const e=+t;return d(e)?e:0},t.transformBounds=function(t,e,u,n,r,D,i){if(!(it(n)<=et||it(r)<=et)){if(1!==n&&t.scaleX(n),1!==r&&t.scaleY(r),isFinite(D)&&Math.abs(D)>et){let e=0,u=0;void 0!==i&&(e=i[0],u=i[1]),t.rotate(D,e,u)}t.translate(e,u)}},t.transformBoundsWithMatrix=xt,t.truncate=(t,e,u="right",n)=>{const r=s(n)?"…":n,D=t+"",i=D.length,o=Math.max(0,e-r.length);return i<=e?D:"left"===u?r+D.slice(i-o):"center"===u?D.slice(0,Math.ceil(o/2))+r+D.slice(i-Math.floor(o/2)):D.slice(0,o)+r},t.unionAABB=pe,t.uniqArray=function(t){return t&&F(t)?Array.from(new Set(L(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=bu,t.utcDayField=Mu,t.utcDayFloor=xu,t.utcDayOffset=Bu,t.utcHourField=Lu,t.utcHourFloor=Tu,t.utcHourOffset=Su,t.utcMinuteField=ku,t.utcMinuteFloor=Ru,t.utcMinuteOffset=Uu,t.utcMonthCount=gu,t.utcMonthField=du,t.utcMonthFloor=fu,t.utcMonthOffset=Cu,t.utcSecondField=Vu,t.utcSecondFloor=Wu,t.utcSecondOffset=qu,t.utcYearCount=ou,t.utcYearField=au,t.utcYearFloor=iu,t.utcYearOffset=su,t.uuid=(t,e)=>{const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];let r;if(e=e||u.length,t)for(r=0;r<t;r++)n[r]=u[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(t=0|16*Math.random(),n[r]=u[19===r?3&t|8:t])}return n.join("")},t.variance=R,t.yearCount=ru,t.yearField=Du,t.yearFloor=uu,t.yearOffset=nu}));
|
package/es/common/array.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare function array<T>(arr?: T | T[]): T[];
|
|
2
2
|
export declare function last<T>(val: T | T[]): T | undefined;
|
|
3
3
|
export declare const span: (arr: number[]) => number;
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare const maxInArray: <T>(arr: T[], compareFn?: (a: T, b: T) => number) => T;
|
|
5
|
+
export declare const minInArray: <T>(arr: T[], compareFn?: (a: T, b: T) => number) => T;
|
|
6
6
|
export declare function arrayEqual(a: any, b: any): boolean;
|
|
7
7
|
export declare function uniqArray<T>(arr: T | T[]): T | T[];
|
|
8
8
|
export declare function shuffleArray<T>(arr: T[], random?: () => number): T[];
|
package/es/common/array.js
CHANGED
|
@@ -16,13 +16,27 @@ export function last(val) {
|
|
|
16
16
|
|
|
17
17
|
export const span = arr => arr.length <= 1 ? 0 : last(arr) - arr[0];
|
|
18
18
|
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const maxInArray = (arr, compareFn) => {
|
|
20
|
+
var _a;
|
|
21
|
+
if (0 === arr.length) return;
|
|
22
|
+
let max = arr[0];
|
|
23
|
+
for (let i = 1; i < arr.length; i++) {
|
|
24
|
+
const value = arr[i];
|
|
25
|
+
(null !== (_a = null == compareFn ? void 0 : compareFn(value, max)) && void 0 !== _a ? _a : value - max > 0) && (max = value);
|
|
26
|
+
}
|
|
27
|
+
return max;
|
|
28
|
+
};
|
|
22
29
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
export const minInArray = (arr, compareFn) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (0 === arr.length) return;
|
|
33
|
+
let min = arr[0];
|
|
34
|
+
for (let i = 1; i < arr.length; i++) {
|
|
35
|
+
const value = arr[i];
|
|
36
|
+
(null !== (_a = null == compareFn ? void 0 : compareFn(value, min)) && void 0 !== _a ? _a : value - min < 0) && (min = value);
|
|
37
|
+
}
|
|
38
|
+
return min;
|
|
39
|
+
};
|
|
26
40
|
|
|
27
41
|
export function arrayEqual(a, b) {
|
|
28
42
|
if (!isArray(a) || !isArray(b)) return !1;
|
package/es/common/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/array.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,OAAO,MAAM,WAAW,CAAC;AAOhC,MAAM,UAAU,KAAK,CAAI,GAAa;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAChB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAOD,MAAM,UAAU,IAAI,CAAI,GAAY;IAClC,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;QACpB,MAAM,GAAG,GAAG,GAAqB,CAAC;QAClC,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC5B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAOD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAa,EAAE,EAAE;IACpC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;QACnB,OAAO,CAAC,CAAC;KACV;IACD,OAAQ,IAAI,CAAC,GAAG,CAAY,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/common/array.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,OAAO,MAAM,WAAW,CAAC;AAOhC,MAAM,UAAU,KAAK,CAAI,GAAa;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAChB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAOD,MAAM,UAAU,IAAI,CAAI,GAAY;IAClC,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE;QACpB,MAAM,GAAG,GAAG,GAAqB,CAAC;QAClC,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC5B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAOD,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAa,EAAE,EAAE;IACpC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;QACnB,OAAO,CAAC,CAAC;KACV;IACD,OAAQ,IAAI,CAAC,GAAG,CAAY,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,GAAQ,EAAE,SAAkC,EAAiB,EAAE;;IAC3F,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,KAAK,EAAE,GAAG,CAAC,mCAAK,KAAgB,GAAI,GAAc,GAAG,CAAC,EAAE;YACtE,GAAG,GAAG,KAAK,CAAC;SACb;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,GAAQ,EAAE,SAAkC,EAAiB,EAAE;;IAC3F,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,KAAK,EAAE,GAAG,CAAC,mCAAK,KAAgB,GAAI,GAAc,GAAG,CAAC,EAAE;YACtE,GAAG,GAAG,KAAK,CAAC;SACb;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAQF,MAAM,UAAU,UAAU,CAAC,CAAM,EAAE,CAAM;IACvC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC9B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;QACzB,OAAO,KAAK,CAAC;KACd;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAOD,MAAM,UAAU,SAAS,CAAI,GAAY;IACvC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAGD,MAAM,UAAU,YAAY,CAAI,GAAQ,EAAE,SAAuB,IAAI,CAAC,MAAM;IAC1E,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7B,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACb,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAChB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACZ;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAOD,MAAM,UAAU,YAAY,CAAC,GAAQ;IACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,CAAC;KACd;IACD,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE;QACvB,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;KACrC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","file":"array.js","sourcesContent":["import isArray from './isArray';\nimport isArrayLike from './isArrayLike';\nimport isValid from './isValid';\n\n/**\n * 将传入数据转换为数组格式\n * @param arr 入参。\n * @returns 数组\n */\nexport function array<T>(arr?: T | T[]): T[] {\n if (isValid(arr)) {\n return isArray(arr) ? arr : [arr];\n }\n return [];\n}\n\n/**\n * 获取数组的最后一个值,如果传入的参数为非数组,则返回 undefined\n * @param val any\n * @returns\n */\nexport function last<T>(val: T | T[]): T | undefined {\n if (isArrayLike(val)) {\n const arr = val as ArrayLike<any>;\n return arr[arr.length - 1];\n }\n return undefined;\n}\n\n/**\n * 获取数组第一项与最后一项的差值,如果数组为空\b则返回 0\n * @param arr\n * @returns\n */\nexport const span = (arr: number[]) => {\n if (arr.length <= 1) {\n return 0;\n }\n return (last(arr) as number) - arr[0];\n};\n\n/**\n * 获取数组中的最大值\n * @param arr 数组\n * @param compareFn 比较函数,返回正数表示 a > b,返回负数表示 a < b,返回 0 表示相等\n * @returns\n */\nexport const maxInArray = <T>(arr: T[], compareFn?: (a: T, b: T) => number): T | undefined => {\n if (arr.length === 0) {\n return undefined;\n }\n let max = arr[0];\n for (let i = 1; i < arr.length; i++) {\n const value = arr[i];\n if (compareFn?.(value, max) ?? (value as number) - (max as number) > 0) {\n max = value;\n }\n }\n return max;\n};\n\n/**\n * 获取数组中的最小值\n * @param arr 数组\n * @param compareFn 比较函数,返回正数表示 a > b,返回负数表示 a < b,返回 0 表示相等\n * @returns\n */\nexport const minInArray = <T>(arr: T[], compareFn?: (a: T, b: T) => number): T | undefined => {\n if (arr.length === 0) {\n return undefined;\n }\n let min = arr[0];\n for (let i = 1; i < arr.length; i++) {\n const value = arr[i];\n if (compareFn?.(value, min) ?? (value as number) - (min as number) < 0) {\n min = value;\n }\n }\n return min;\n};\n\n/**\n * 判断两个数组是否相同\n * @param a\n * @param b\n * @returns\n */\nexport function arrayEqual(a: any, b: any): boolean {\n if (!isArray(a) || !isArray(b)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * 封装并返回无重复的数组\n * @param arr\n * @returns\n */\nexport function uniqArray<T>(arr: T | T[]): T | T[] {\n if (!arr || !isArray(arr)) {\n return arr;\n }\n return Array.from(new Set(array(arr)));\n}\n\n// Based on http://jsfromhell.com/array/shuffle\nexport function shuffleArray<T>(arr: T[], random: () => number = Math.random): T[] {\n let j;\n let x;\n let i = arr.length;\n\n while (i) {\n j = Math.floor(random() * i);\n x = arr[--i];\n arr[i] = arr[j];\n arr[j] = x;\n }\n return arr;\n}\n\n/**\n * 展开多层数组,非数组内容将变为 [input]\n * @param arr\n * @returns\n */\nexport function flattenArray(arr: any): any[] {\n if (!isArray(arr)) {\n return [arr];\n }\n const result = [];\n for (const value of arr) {\n result.push(...flattenArray(value));\n }\n return result;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vutils",
|
|
3
|
-
"version": "0.17.0
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@types/jest": "~29.5.0",
|
|
28
28
|
"typescript": "4.9.5",
|
|
29
29
|
"@types/node": "*",
|
|
30
|
-
"@internal/
|
|
30
|
+
"@internal/jest-config": "0.0.1",
|
|
31
31
|
"@internal/ts-config": "0.0.1",
|
|
32
|
-
"@internal/
|
|
33
|
-
"@internal/
|
|
32
|
+
"@internal/bundler": "0.0.1",
|
|
33
|
+
"@internal/eslint-config": "0.0.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"eventemitter3": "^4.0.7",
|