@visactor/vmind
Version:
<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu
1,149 lines (1,076 loc) • 6.58 MB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('util'), require('stream'), require('path'), require('http'), require('https'), require('url'), require('fs'), require('crypto'), require('assert'), require('tty'), require('os'), require('zlib'), require('events'), require('react-native-fs'), require('punycode'), require('react-native-fetch-blob'), require('net')) :
typeof define === 'function' && define.amd ? define(['exports', 'util', 'stream', 'path', 'http', 'https', 'url', 'fs', 'crypto', 'assert', 'tty', 'os', 'zlib', 'events', 'react-native-fs', 'punycode', 'react-native-fetch-blob', 'net'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VMind = {}, global.require$$1$1, global.Stream$3, global.require$$1$2, global.http$2, global.https$2, global.Url, global.require$$0$2, global.crypto, global.require$$4$1, global.require$$0$3, global.require$$0$4, global.zlib, global.events$1, global.require$$3, global.require$$0$5, global.require$$5$1, global.require$$4$2));
})(this, (function (exports, require$$1$1, Stream$3, require$$1$2, http$2, https$2, Url, require$$0$2, crypto, require$$4$1, require$$0$3, require$$0$4, zlib, events$1, require$$3, require$$0$5, require$$5$1, require$$4$2) { 'use strict';
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function getAugmentedNamespace(n) {
if (n.__esModule) return n;
var f = n.default;
if (typeof f == "function") {
var a = function a () {
if (this instanceof a) {
var args = [null];
args.push.apply(args, arguments);
var Ctor = Function.bind.apply(f, args);
return new Ctor();
}
return f.apply(this, arguments);
};
a.prototype = f.prototype;
} else a = {};
Object.defineProperty(a, '__esModule', {value: true});
Object.keys(n).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(n, k);
Object.defineProperty(a, k, d.get ? d : {
enumerable: true,
get: function () {
return n[k];
}
});
});
return a;
}
var eventemitter3 = {exports: {}};
(function (module) {
var has = Object.prototype.hasOwnProperty,
prefix = '~';
/**
* Constructor to create a storage for our `EE` objects.
* An `Events` instance is a plain object whose properties are event names.
*
* @constructor
* @private
*/
function Events() {}
//
// We try to not inherit from `Object.prototype`. In some engines creating an
// instance in this way is faster than calling `Object.create(null)` directly.
// If `Object.create(null)` is not supported we prefix the event names with a
// character to make sure that the built-in object properties are not
// overridden or used as an attack vector.
//
if (Object.create) {
Events.prototype = Object.create(null);
//
// This hack is needed because the `__proto__` property is still inherited in
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
//
if (!new Events().__proto__) prefix = false;
}
/**
* Representation of a single event listener.
*
* @param {Function} fn The listener function.
* @param {*} context The context to invoke the listener with.
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
* @constructor
* @private
*/
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
}
/**
* Add a listener for a given event.
*
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} context The context to invoke the listener with.
* @param {Boolean} once Specify if the listener is a one-time listener.
* @returns {EventEmitter}
* @private
*/
function addListener(emitter, event, fn, context, once) {
if (typeof fn !== 'function') {
throw new TypeError('The listener must be a function');
}
var listener = new EE(fn, context || emitter, once),
evt = prefix ? prefix + event : event;
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
return emitter;
}
/**
* Clear event by name.
*
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
* @param {(String|Symbol)} evt The Event name.
* @private
*/
function clearEvent(emitter, evt) {
if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
}
/**
* Minimal `EventEmitter` interface that is molded against the Node.js
* `EventEmitter` interface.
*
* @constructor
* @public
*/
function EventEmitter() {
this._events = new Events();
this._eventsCount = 0;
}
/**
* Return an array listing the events for which the emitter has registered
* listeners.
*
* @returns {Array}
* @public
*/
EventEmitter.prototype.eventNames = function eventNames() {
var names = [],
events,
name;
if (this._eventsCount === 0) return names;
for (name in events = this._events) {
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
}
if (Object.getOwnPropertySymbols) {
return names.concat(Object.getOwnPropertySymbols(events));
}
return names;
};
/**
* Return the listeners registered for a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Array} The registered listeners.
* @public
*/
EventEmitter.prototype.listeners = function listeners(event) {
var evt = prefix ? prefix + event : event,
handlers = this._events[evt];
if (!handlers) return [];
if (handlers.fn) return [handlers.fn];
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
ee[i] = handlers[i].fn;
}
return ee;
};
/**
* Return the number of listeners listening to a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Number} The number of listeners.
* @public
*/
EventEmitter.prototype.listenerCount = function listenerCount(event) {
var evt = prefix ? prefix + event : event,
listeners = this._events[evt];
if (!listeners) return 0;
if (listeners.fn) return 1;
return listeners.length;
};
/**
* Calls each of the listeners registered for a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Boolean} `true` if the event had listeners, else `false`.
* @public
*/
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return false;
var listeners = this._events[evt],
len = arguments.length,
args,
i;
if (listeners.fn) {
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
switch (len) {
case 1:
return listeners.fn.call(listeners.context), true;
case 2:
return listeners.fn.call(listeners.context, a1), true;
case 3:
return listeners.fn.call(listeners.context, a1, a2), true;
case 4:
return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5:
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6:
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len - 1); i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length,
j;
for (i = 0; i < length; i++) {
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
switch (len) {
case 1:
listeners[i].fn.call(listeners[i].context);
break;
case 2:
listeners[i].fn.call(listeners[i].context, a1);
break;
case 3:
listeners[i].fn.call(listeners[i].context, a1, a2);
break;
case 4:
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
break;
default:
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
/**
* Add a listener for a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} [context=this] The context to invoke the listener with.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.on = function on(event, fn, context) {
return addListener(this, event, fn, context, false);
};
/**
* Add a one-time listener for a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} [context=this] The context to invoke the listener with.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.once = function once(event, fn, context) {
return addListener(this, event, fn, context, true);
};
/**
* Remove the listeners of a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn Only remove the listeners that match this function.
* @param {*} context Only remove the listeners that have this context.
* @param {Boolean} once Only remove one-time listeners.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return this;
if (!fn) {
clearEvent(this, evt);
return this;
}
var listeners = this._events[evt];
if (listeners.fn) {
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
clearEvent(this, evt);
}
} else {
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
events.push(listeners[i]);
}
}
//
// Reset the array, or remove it completely if we have no more listeners.
//
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
}
return this;
};
/**
* Remove all listeners, or those of the specified event.
*
* @param {(String|Symbol)} [event] The event name.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
var evt;
if (event) {
evt = prefix ? prefix + event : event;
if (this._events[evt]) clearEvent(this, evt);
} else {
this._events = new Events();
this._eventsCount = 0;
}
return this;
};
//
// Alias methods names because people roll like that.
//
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
//
// Expose the prefix.
//
EventEmitter.prefixed = prefix;
//
// Allow `EventEmitter` to be imported as module namespace.
//
EventEmitter.EventEmitter = EventEmitter;
//
// Expose the module.
//
{
module.exports = EventEmitter;
}
})(eventemitter3);
var eventemitter3Exports = eventemitter3.exports;
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
var isType$1 = isType;
const isBoolean$1 = function (value) {
let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
};
var isBoolean$2 = isBoolean$1;
const isFunction$2 = value => "function" == typeof value;
var isFunction$3 = isFunction$2;
const isNil = value => null == value;
var isNil$1 = isNil;
const isValid = value => null != value;
var isValid$1 = isValid;
const isObject$1 = value => {
const type = typeof value;
return null !== value && "object" === type || "function" === type;
};
var isObject$2 = isObject$1;
const isObjectLike = value => "object" == typeof value && null !== value;
var isObjectLike$1 = isObjectLike;
const isPlainObject$1 = function (value) {
if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
if (null === Object.getPrototypeOf(value)) return !0;
let proto = value;
for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
return Object.getPrototypeOf(value) === proto;
};
var isPlainObject$2 = isPlainObject$1;
const isUndefined$1 = value => void 0 === value;
var isUndefined$2 = isUndefined$1;
const isString$6 = function (value) {
let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
const type = typeof value;
return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
};
var isString$7 = isString$6;
const isArray$2 = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
var isArray$3 = isArray$2;
const isArrayLike = function (value) {
return null !== value && "function" != typeof value && Number.isFinite(value.length);
};
var isArrayLike$1 = isArrayLike;
const isDate$1 = value => isType$1(value, "Date");
var isDate$2 = isDate$1;
const isNumber$4 = function (value) {
let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
const type = typeof value;
return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
};
var isNumber$5 = isNumber$4;
const isValidNumber = value => isNumber$5(value) && Number.isFinite(value);
var isValidNumber$1 = isValidNumber;
const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
var isValidUrl$1 = isValidUrl;
const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
var isBase64$1 = isBase64;
const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
var getType$1 = getType;
const objectProto = Object.prototype,
isPrototype = function (value) {
const Ctor = value && value.constructor;
return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
};
var isPrototype$1 = isPrototype;
const hasOwnProperty$3 = Object.prototype.hasOwnProperty;
function isEmpty(value) {
if (isNil$1(value)) return !0;
if (isArrayLike$1(value)) return !value.length;
const type = getType$1(value);
if ("Map" === type || "Set" === type) return !value.size;
if (isPrototype$1(value)) return !Object.keys(value).length;
for (const key in value) if (hasOwnProperty$3.call(value, key)) return !1;
return !0;
}
const get$1 = (obj, path, defaultValue) => {
const paths = isString$7(path) ? path.split(".") : path;
for (let p = 0; p < paths.length; p++) obj = obj ? obj[paths[p]] : void 0;
return void 0 === obj ? defaultValue : obj;
};
var get$2 = get$1;
const hasOwnProperty$2 = Object.prototype.hasOwnProperty,
has$1 = (object, key) => null != object && hasOwnProperty$2.call(object, key);
var has$2 = has$1;
function cloneDeep(value, ignoreWhen, excludeKeys) {
let result;
if (!isValid$1(value) || "object" != typeof value || ignoreWhen && ignoreWhen(value)) return value;
const isArr = isArray$3(value),
length = value.length;
result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean$2(value) || isNumber$5(value) || isString$7(value) ? value : isDate$2(value) ? new Date(+value) : void 0;
const props = isArr ? void 0 : Object.keys(Object(value));
let index = -1;
if (result) for (; ++index < (props || value).length;) {
const key = props ? props[index] : index,
subValue = value[key];
excludeKeys && excludeKeys.includes(key.toString()) ? result[key] = subValue : result[key] = cloneDeep(subValue, ignoreWhen, excludeKeys);
}
return result;
}
function baseMerge(target, source) {
let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
if (source) {
if (target === source) return;
if (isValid$1(source) && "object" == typeof source) {
const iterable = Object(source),
props = [];
for (const key in iterable) props.push(key);
let {
length: length
} = props,
propIndex = -1;
for (; length--;) {
const key = props[++propIndex];
!isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$3(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
}
}
}
}
function baseMergeDeep(target, source, key) {
let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
const objValue = target[key],
srcValue = source[key];
let newValue = source[key],
isCommon = !0;
if (isArray$3(srcValue)) {
if (shallowArray) newValue = [];else if (isArray$3(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
newValue = new Array(objValue.length);
let index = -1;
const length = objValue.length;
for (; ++index < length;) newValue[index] = objValue[index];
}
} else isPlainObject$2(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
}
function assignMergeValue(target, key, value) {
(void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
}
function eq(value, other) {
return value === other || Number.isNaN(value) && Number.isNaN(other);
}
function merge$1(target) {
let sourceIndex = -1;
const length = arguments.length <= 1 ? 0 : arguments.length - 1;
for (; ++sourceIndex < length;) {
baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
}
return target;
}
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
function pick(obj, keys) {
if (!obj || !isPlainObject$2(obj)) return obj;
const result = {};
return keys.forEach(k => {
hasOwnProperty$1.call(obj, k) && (result[k] = obj[k]);
}), result;
}
function pickWithout(obj, keys) {
if (!obj || !isPlainObject$2(obj)) return obj;
const result = {};
return Object.keys(obj).forEach(k => {
const v = obj[k];
let match = !1;
keys.forEach(itKey => {
(isString$7(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
}), match || (result[k] = v);
}), result;
}
function objToString(obj) {
return Object.prototype.toString.call(obj);
}
function objectKeys(obj) {
return Object.keys(obj);
}
function isEqual(a, b, options) {
if (a === b) return !0;
if (typeof a != typeof b) return !1;
if (null == a || null == b) return !1;
if (Number.isNaN(a) && Number.isNaN(b)) return !0;
if (objToString(a) !== objToString(b)) return !1;
if (isFunction$3(a)) return !!(null == options ? void 0 : options.skipFunction);
if ("object" != typeof a) return !1;
if (isArray$3(a)) {
if (a.length !== b.length) return !1;
for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
return !0;
}
if (!isPlainObject$2(a)) return !1;
const ka = objectKeys(a),
kb = objectKeys(b);
if (ka.length !== kb.length) return !1;
ka.sort(), kb.sort();
for (let i = ka.length - 1; i >= 0; i--) if (ka[i] != kb[i]) return !1;
for (let i = ka.length - 1; i >= 0; i--) {
const key = ka[i];
if (!isEqual(a[key], b[key], options)) return !1;
}
return !0;
}
function array(arr) {
return isValid$1(arr) ? isArray$3(arr) ? arr : [arr] : [];
}
const maxInArray = (arr, compareFn) => {
var _a;
if (0 === arr.length) return;
let max = arr[0];
for (let i = 1; i < arr.length; i++) {
const value = arr[i];
(null !== (_a = null == compareFn ? void 0 : compareFn(value, max)) && void 0 !== _a ? _a : value - max) > 0 && (max = value);
}
return max;
};
const minInArray = (arr, compareFn) => {
var _a;
if (0 === arr.length) return;
let min = arr[0];
for (let i = 1; i < arr.length; i++) {
const value = arr[i];
(null !== (_a = null == compareFn ? void 0 : compareFn(value, min)) && void 0 !== _a ? _a : value - min) < 0 && (min = value);
}
return min;
};
function arrayEqual(a, b) {
if (!isArray$3(a) || !isArray$3(b)) return !1;
if (a.length !== b.length) return !1;
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
return !0;
}
function uniqArray(arr) {
return arr && isArray$3(arr) ? Array.from(new Set(array(arr))) : arr;
}
function range$1(start, stop, step) {
isValid$1(stop) || (stop = start, start = 0), isValid$1(step) || (step = 1);
let i = -1;
const n = 0 | Math.max(0, Math.ceil((stop - start) / step)),
range = new Array(n);
for (; ++i < n;) range[i] = start + i * step;
return range;
}
function ascending$1(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function toNumber(a) {
return Number(a);
}
const hasConsole = "undefined" != typeof console;
function log(method, level, input) {
const args = [level].concat([].slice.call(input));
hasConsole && console[method].apply(console, args);
}
var LoggerLevel;
!function (LoggerLevel) {
LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
}(LoggerLevel || (LoggerLevel = {}));
class Logger {
static getInstance(level, method) {
return Logger._instance && isNumber$5(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
}
static setInstance(logger) {
return Logger._instance = logger;
}
static setInstanceLevel(level) {
Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
}
static clearInstance() {
Logger._instance = null;
}
constructor() {
let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
let method = arguments.length > 1 ? arguments[1] : undefined;
this._onErrorHandler = [], this._level = level, this._method = method;
}
addErrorHandler(handler) {
this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
}
removeErrorHandler(handler) {
const index = this._onErrorHandler.findIndex(h => h === handler);
index < 0 || this._onErrorHandler.splice(index, 1);
}
callErrorHandler() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
this._onErrorHandler.forEach(h => h(...args));
}
canLogInfo() {
return this._level >= LoggerLevel.Info;
}
canLogDebug() {
return this._level >= LoggerLevel.Debug;
}
canLogError() {
return this._level >= LoggerLevel.Error;
}
canLogWarn() {
return this._level >= LoggerLevel.Warn;
}
level(levelValue) {
return arguments.length ? (this._level = +levelValue, this) : this._level;
}
error() {
var _a;
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
}
warn() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
}
info() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
}
debug() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
}
}
Logger._instance = null;
function bisect(a, x) {
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let hi = arguments.length > 3 ? arguments[3] : undefined;
for (isNil$1(hi) && (hi = a.length); lo < hi;) {
const mid = lo + hi >>> 1;
ascending$1(a[mid], x) > 0 ? hi = mid : lo = mid + 1;
}
return lo;
}
function findZeroOfFunction(f, a, b, parameters) {
var _a, _b;
const maxIterations = null !== (_a = null == parameters ? void 0 : parameters.maxIterations) && void 0 !== _a ? _a : 100,
tolerance = null !== (_b = null == parameters ? void 0 : parameters.tolerance) && void 0 !== _b ? _b : 1e-10,
fA = f(a),
fB = f(b);
let delta = b - a;
if (fA * fB > 0) {
return Logger.getInstance().error("Initial bisect points must have opposite signs"), NaN;
}
if (0 === fA) return a;
if (0 === fB) return b;
for (let i = 0; i < maxIterations; ++i) {
delta /= 2;
const mid = a + delta,
fMid = f(mid);
if (fMid * fA >= 0 && (a = mid), Math.abs(delta) < tolerance || 0 === fMid) return mid;
}
return a + delta;
}
const DEFAULT_ABSOLUTE_TOLERATE = 1e-10,
DEFAULT_RELATIVE_TOLERATE = 1e-10;
function isNumberClose(a, b) {
let relTol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_RELATIVE_TOLERATE;
let absTol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_ABSOLUTE_TOLERATE;
const abs = absTol,
rel = relTol * Math.max(a, b);
return Math.abs(a - b) <= Math.max(abs, rel);
}
function isGreater(a, b, relTol, absTol) {
return a > b && !isNumberClose(a, b, relTol, absTol);
}
function isLess(a, b, relTol, absTol) {
return a < b && !isNumberClose(a, b, relTol, absTol);
}
const memoize = func => {
let lastArgs = null,
lastResult = null;
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return lastArgs && args.every((val, i) => val === lastArgs[i]) || (lastArgs = args, lastResult = func(...args)), lastResult;
};
};
const clamp = function (input, min, max) {
return input < min ? min : input > max ? max : input;
};
var clamp$1 = clamp;
function clamper(a, b) {
let t;
return a > b && (t = a, a = b, b = t), x => Math.max(a, Math.min(b, x));
}
let hasRaf = !1;
try {
hasRaf = "function" == typeof requestAnimationFrame && "function" == typeof cancelAnimationFrame;
} catch (err) {
hasRaf = !1;
}
function debounce(func, wait, options) {
let lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = !1,
maxing = !1,
trailing = !0;
const useRAF = !wait && 0 !== wait && hasRaf;
if ("function" != typeof func) throw new TypeError("Expected a function");
function invokeFunc(time) {
const args = lastArgs,
thisArg = lastThis;
return lastArgs = lastThis = void 0, lastInvokeTime = time, result = func.apply(thisArg, args), result;
}
function startTimer(pendingFunc, wait) {
return useRAF ? (cancelAnimationFrame(timerId), requestAnimationFrame(pendingFunc)) : setTimeout(pendingFunc, wait);
}
function shouldInvoke(time) {
const timeSinceLastCall = time - lastCallTime;
return void 0 === lastCallTime || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && time - lastInvokeTime >= maxWait;
}
function timerExpired() {
const time = Date.now();
if (shouldInvoke(time)) return trailingEdge(time);
timerId = startTimer(timerExpired, function (time) {
const timeSinceLastInvoke = time - lastInvokeTime,
timeWaiting = wait - (time - lastCallTime);
return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}(time));
}
function trailingEdge(time) {
return timerId = void 0, trailing && lastArgs ? invokeFunc(time) : (lastArgs = lastThis = void 0, result);
}
function debounced() {
const time = Date.now(),
isInvoking = shouldInvoke(time);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (lastArgs = args, lastThis = this, lastCallTime = time, isInvoking) {
if (void 0 === timerId) return function (time) {
return lastInvokeTime = time, timerId = startTimer(timerExpired, wait), leading ? invokeFunc(time) : result;
}(lastCallTime);
if (maxing) return timerId = startTimer(timerExpired, wait), invokeFunc(lastCallTime);
}
return void 0 === timerId && (timerId = startTimer(timerExpired, wait)), result;
}
return wait = +wait || 0, isObject$2(options) && (leading = !!options.leading, maxing = "maxWait" in options, maxing && (maxWait = Math.max(isValidNumber$1(options.maxWait) ? options.maxWait : 0, wait)), trailing = "trailing" in options ? !!options.trailing : trailing), debounced.cancel = function () {
void 0 !== timerId && function (id) {
if (useRAF) return cancelAnimationFrame(id);
clearTimeout(id);
}(timerId), lastInvokeTime = 0, lastArgs = lastCallTime = lastThis = timerId = void 0;
}, debounced.flush = function () {
return void 0 === timerId ? result : trailingEdge(Date.now());
}, debounced.pending = function () {
return void 0 !== timerId;
}, debounced;
}
hasRaf = !1;
function interpolateNumber(a, b) {
return t => a * (1 - t) + b * t;
}
function interpolateNumberRound(a, b) {
return function (t) {
return Math.round(a * (1 - t) + b * t);
};
}
function interpolateDate(a, b) {
const aVal = a.valueOf(),
bVal = b.valueOf(),
d = new Date();
return t => (d.setTime(aVal * (1 - t) + bVal * t), d);
}
function seedRandom(seed) {
return parseFloat("0." + Math.sin(seed).toString().substring(6));
}
const epsilon = 1e-12;
const pi = Math.PI;
const halfPi$1 = pi / 2;
const tau = 2 * pi;
const pi2 = 2 * Math.PI;
const abs$E = Math.abs;
const atan2 = Math.atan2;
const cos$4 = Math.cos;
const max$c = Math.max;
const min$b = Math.min;
const sin$7 = Math.sin;
const sqrt$q = Math.sqrt;
const pow$v = Math.pow;
function acos$2(x) {
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
}
function asin$4(x) {
return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
}
function pointAt(x1, y1, x2, y2, t) {
let x = x2,
y = y2;
return "number" == typeof x1 && "number" == typeof x2 && (x = (1 - t) * x1 + t * x2), "number" == typeof y1 && "number" == typeof y2 && (y = (1 - t) * y1 + t * y2), {
x: x,
y: y
};
}
function crossProduct(dir1, dir2) {
return dir1[0] * dir2[1] - dir1[1] * dir2[0];
}
function dotProduct(a, b) {
let ret = 0;
for (let i = 0; i < a.length; ++i) ret += a[i] * b[i];
return ret;
}
function getDecimalPlaces(n) {
const dStr = n.toString().split(/[eE]/),
s = (dStr[0].split(".")[1] || "").length - (+dStr[1] || 0);
return s > 0 ? s : 0;
}
class Point {
constructor() {
let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let x1 = arguments.length > 2 ? arguments[2] : undefined;
let y1 = arguments.length > 3 ? arguments[3] : undefined;
this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
}
clone() {
return new Point(this.x, this.y);
}
copyFrom(p) {
return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
}
set(x, y) {
return this.x = x, this.y = y, this;
}
add(point) {
return isNumber$5(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
}
sub(point) {
return isNumber$5(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
}
multi(point) {
throw new Error("暂不支持");
}
div(point) {
throw new Error("暂不支持");
}
}
class PointService {
static distancePP(p1, p2) {
return sqrt$q(pow$v(p1.x - p2.x, 2) + pow$v(p1.y - p2.y, 2));
}
static distanceNN(x, y, x1, y1) {
return sqrt$q(pow$v(x - x1, 2) + pow$v(y - y1, 2));
}
static distancePN(point, x, y) {
return sqrt$q(pow$v(x - point.x, 2) + pow$v(y - point.y, 2));
}
static pointAtPP(p1, p2, t) {
return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
}
}
function degreeToRadian(degree) {
return degree * (Math.PI / 180);
}
function radianToDegree(radian) {
return 180 * radian / Math.PI;
}
const clampRadian = function () {
let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
return angle;
};
const clampAngleByRadian = clampRadian;
function polarToCartesian(center, radius, angleInRadian) {
return radius ? {
x: center.x + radius * Math.cos(angleInRadian),
y: center.y + radius * Math.sin(angleInRadian)
} : {
x: center.x,
y: center.y
};
}
function normalizeAngle(angle) {
for (; angle < 0;) angle += 2 * Math.PI;
for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
return angle;
}
function computeQuadrant(angle) {
return (angle = normalizeAngle(angle)) > 0 && angle <= Math.PI / 2 ? 2 : angle > Math.PI / 2 && angle <= Math.PI ? 3 : angle > Math.PI && angle <= 3 * Math.PI / 2 ? 4 : 1;
}
function getRectIntersect(bbox1, bbox2, format) {
if (null === bbox1) return bbox2;
if (null === bbox2) return bbox1;
const {
x11: x11,
x12: x12,
y11: y11,
y12: y12,
x21: x21,
x22: x22,
y21: y21,
y22: y22
} = formatTwoBBox(bbox1, bbox2, format);
return x11 >= x22 || x12 <= x21 || y11 >= y22 || y12 <= y21 ? {
x1: 0,
y1: 0,
x2: 0,
y2: 0
} : {
x1: Math.max(x11, x21),
y1: Math.max(y11, y21),
x2: Math.min(x12, x22),
y2: Math.min(y12, y22)
};
}
var InnerBBox;
!function (InnerBBox) {
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
}(InnerBBox || (InnerBBox = {}));
const formatTwoBBox = (bbox1, bbox2, format) => {
let x11 = bbox1.x1,
x12 = bbox1.x2,
y11 = bbox1.y1,
y12 = bbox1.y2,
x21 = bbox2.x1,
x22 = bbox2.x2,
y21 = bbox2.y1,
y22 = bbox2.y2;
return format && (x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), x21 > x22 && ([x21, x22] = [x22, x21]), y21 > y22 && ([y21, y22] = [y22, y21])), {
x11: x11,
x12: x12,
y11: y11,
y12: y12,
x21: x21,
x22: x22,
y21: y21,
y22: y22
};
};
function isRectIntersect(bbox1, bbox2, format) {
if (bbox1 && bbox2) {
if (!format) return !(bbox1.x1 > bbox2.x2 || bbox1.x2 < bbox2.x1 || bbox1.y1 > bbox2.y2 || bbox1.y2 < bbox2.y1);
const {
x11: x11,
x12: x12,
y11: y11,
y12: y12,
x21: x21,
x22: x22,
y21: y21,
y22: y22
} = formatTwoBBox(bbox1, bbox2, !0);
return !(x11 > x22 || x12 < x21 || y11 > y22 || y12 < y21);
}
return !0;
}
function pointInRect(point, bbox, format) {
if (!bbox) return !0;
if (!format) return point.x >= bbox.x1 && point.x <= bbox.x2 && point.y >= bbox.y1 && point.y <= bbox.y2;
let x11 = bbox.x1,
x12 = bbox.x2,
y11 = bbox.y1,
y12 = bbox.y2;
return x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), point.x >= x11 && point.x <= x12 && point.y >= y11 && point.y <= y12;
}
function getProjectionRadius(checkAxis, axis) {
return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
}
function rotatePoint(_ref, rad) {
let {
x: x,
y: y
} = _ref;
let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
x: 0,
y: 0
};
return {
x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
};
}
function getCenterPoint(box) {
return {
x: (box.x1 + box.x2) / 2,
y: (box.y1 + box.y2) / 2
};
}
function toRect(box, isDeg) {
const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
cp = getCenterPoint(box);
return [rotatePoint({
x: box.x1,
y: box.y1
}, deg, cp), rotatePoint({
x: box.x2,
y: box.y1
}, deg, cp), rotatePoint({
x: box.x2,
y: box.y2
}, deg, cp), rotatePoint({
x: box.x1,
y: box.y2
}, deg, cp)];
}
function isRotateAABBIntersect(box1, box2) {
let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
const rect1 = toRect(box1, isDeg),
rect2 = toRect(box2, isDeg),
vector = (start, end) => [end.x - start.x, end.y - start.y],
vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
AB = vector(rect1[0], rect1[1]),
BC = vector(rect1[1], rect1[2]),
A1B1 = vector(rect2[0], rect2[1]),
B1C1 = vector(rect2[1], rect2[2]),
deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
const checkAxis = [Math.cos(deg), Math.sin(deg)];
return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
};
return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
}
const eastAsianCharacterInfo = character => {
let x = character.charCodeAt(0),
y = 2 === character.length ? character.charCodeAt(1) : 0,
codePoint = x;
return 55296 <= x && x <= 56319 && 56320 <= y && y <= 57343 && (x &= 1023, y &= 1023, codePoint = x << 10 | y, codePoint += 65536), 12288 === codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 ? "F" : 8361 === codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518 ? "H" : 4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? "W" : 32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 === codePoint || 175 === codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630 ? "Na" : 161 === codePoint || 164 === codePoint || 167 <= codePoint && codePoint <= 168 || 170 === codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 === codePoint || 208 === codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 === codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 === codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 === codePoint || 254 === codePoint || 257 === codePoint || 273 === codePoint || 275 === codePoint || 283 === codePoint || 294 <= codePoint && codePoint <= 295 || 299 === codePoint || 305 <= codePoint && codePoint <= 307 || 312 === codePoint || 319 <= codePoint && codePoint <= 322 || 324 === codePoint || 328 <= codePoint && codePoint <= 331 || 333 === codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 === codePoint || 462 === codePoint || 464 === codePoint || 466 === codePoint || 468 === codePoint || 470 === codePoint || 472 === codePoint || 474 === codePoint || 476 === codePoint || 593 === codePoint || 609 === codePoint || 708 === codePoint || 711 === codePoint || 713 <= codePoint && codePoint <= 715 || 717 === codePoint || 720 === codePoint || 728 <= codePoint && codePoint <= 731 || 733 === codePoint || 735 === codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 === codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 === codePoint || 8208 === codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 === codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 === codePoint || 8251 === codePoint || 8254 === codePoint || 8308 === codePoint || 8319 === codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 === codePoint || 8451 === codePoint || 8453 === codePoint || 8457 === codePoint || 8467 === codePoint || 8470 === codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 === codePoint || 8491 === codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 === codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 === codePoint || 8660 === codePoint || 8679 === codePoint || 8704 === codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 === codePoint || 8719 === codePoint || 8721 === codePoint || 8725 === codePoint || 8730 === codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 === codePoint || 8741 === codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 === codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 === codePoint || 8780 === codePoint || 8786 === codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 === codePoint || 8857 === codePoint || 8869 === codePoint || 8895 === codePoint || 8978 === codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 === codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 === codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 === codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 === codePoint || 9758 === codePoint || 9792 === codePoint || 9794 === codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 === codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 === codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 === codePoint || 10071 === codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 === codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109 ? "A" : "N";
};
function getContextFont(text) {
let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
fontSizeScale || (fontSizeScale = 1);
const {
fontStyle = defaultAttr.fontStyle,
fontVariant = defaultAttr.fontVariant,
fontWeight = defaultAttr.fontWeight,
fontSize = defaultAttr.fontSize,
fontFamily = defaultAttr.fontFamily
} = text;
return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
}
class TextMeasure {
constructor(option, textSpec) {
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 = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$1(option.specialCharSet) && (this.specialCharSet = option.specialCharSet), this._standardMethod = isValid$1(option.getTextBoun