@visactor/vutils 1.0.24 → 1.0.26
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/README.zh-CN.md +12 -0
- package/REGRESSION.md +36 -0
- package/cjs/angle.d.ts +61 -0
- package/cjs/angle.js +73 -7
- package/cjs/angle.js.map +1 -1
- package/cjs/color/Color.d.ts +3 -0
- package/cjs/color/Color.js +64 -10
- package/cjs/color/Color.js.map +1 -1
- package/cjs/color/hexToRgb.d.ts +5 -0
- package/cjs/color/hexToRgb.js +5 -0
- package/cjs/color/hexToRgb.js.map +1 -1
- package/cjs/color/rgbToHsl.js +5 -1
- package/cjs/color/rgbToHsl.js.map +1 -1
- package/cjs/common/array.d.ts +43 -0
- package/cjs/common/array.js +44 -0
- package/cjs/common/array.js.map +1 -1
- package/cjs/common/bisect.d.ts +21 -0
- package/cjs/common/bisect.js +29 -0
- package/cjs/common/bisect.js.map +1 -1
- package/cjs/common/bootstrap.d.ts +5 -0
- package/cjs/common/bootstrap.js +22 -0
- package/cjs/common/bootstrap.js.map +1 -0
- package/cjs/common/clone.js +6 -0
- package/cjs/common/clone.js.map +1 -1
- package/cjs/common/cloneDeep.js +4 -1
- package/cjs/common/cloneDeep.js.map +1 -1
- package/cjs/common/correlation.d.ts +3 -0
- package/cjs/common/correlation.js +83 -0
- package/cjs/common/correlation.js.map +1 -0
- package/cjs/common/debounce.js +22 -4
- package/cjs/common/debounce.js.map +1 -1
- package/cjs/common/deviation.js +1 -2
- package/cjs/common/ecdf.d.ts +8 -0
- package/cjs/common/ecdf.js +11 -2
- package/cjs/common/ecdf.js.map +1 -1
- package/cjs/common/extent.d.ts +4 -0
- package/cjs/common/extent.js +4 -2
- package/cjs/common/extent.js.map +1 -1
- package/cjs/common/field.d.ts +6 -0
- package/cjs/common/field.js +3 -0
- package/cjs/common/field.js.map +1 -1
- package/cjs/common/has.d.ts +17 -0
- package/cjs/common/has.js +18 -1
- package/cjs/common/has.js.map +1 -1
- package/cjs/common/index.d.ts +5 -0
- package/cjs/common/index.js +34 -6
- package/cjs/common/index.js.map +1 -1
- package/cjs/common/interpolate.js +16 -3
- package/cjs/common/interpolate.js.map +1 -1
- package/cjs/common/isBase64.d.ts +6 -0
- package/cjs/common/isBase64.js +6 -0
- package/cjs/common/isBase64.js.map +1 -1
- package/cjs/common/isBoolean.d.ts +13 -0
- package/cjs/common/isBoolean.js +13 -1
- package/cjs/common/isBoolean.js.map +1 -1
- package/cjs/common/isEmpty.js +11 -1
- package/cjs/common/isEmpty.js.map +1 -1
- package/cjs/common/isEqual.js +19 -7
- package/cjs/common/isEqual.js.map +1 -1
- package/cjs/common/isFunction.d.ts +25 -0
- package/cjs/common/isFunction.js +27 -2
- package/cjs/common/isFunction.js.map +1 -1
- package/cjs/common/isNull.js +2 -1
- package/cjs/common/isNumber.d.ts +23 -0
- package/cjs/common/isNumber.js +23 -1
- package/cjs/common/isNumber.js.map +1 -1
- package/cjs/common/isNumeric.d.ts +25 -0
- package/cjs/common/isNumeric.js +25 -0
- package/cjs/common/isNumeric.js.map +1 -1
- package/cjs/common/isObject.d.ts +21 -0
- package/cjs/common/isObject.js +22 -0
- package/cjs/common/isObject.js.map +1 -1
- package/cjs/common/isObjectLike.d.ts +20 -0
- package/cjs/common/isObjectLike.js +21 -0
- package/cjs/common/isObjectLike.js.map +1 -1
- package/cjs/common/isPlainObject.d.ts +25 -0
- package/cjs/common/isPlainObject.js.map +1 -1
- package/cjs/common/isPrototype.js +1 -1
- package/cjs/common/isRegExp.js +1 -1
- package/cjs/common/isShallowEqual.js +1 -0
- package/cjs/common/isShallowEqual.js.map +1 -1
- package/cjs/common/isString.d.ts +13 -0
- package/cjs/common/isString.js +13 -1
- package/cjs/common/isString.js.map +1 -1
- package/cjs/common/isType.d.ts +6 -0
- package/cjs/common/isType.js +6 -0
- package/cjs/common/isType.js.map +1 -1
- package/cjs/common/isValidNumber.js.map +1 -1
- package/cjs/common/isValidUrl.js.map +1 -1
- package/cjs/common/kde.d.ts +28 -0
- package/cjs/common/kde.js +29 -5
- package/cjs/common/kde.js.map +1 -1
- package/cjs/common/mean.d.ts +2 -0
- package/cjs/common/mean.js +25 -0
- package/cjs/common/mean.js.map +1 -0
- package/cjs/common/merge.js +20 -4
- package/cjs/common/merge.js.map +1 -1
- package/cjs/common/mixin.js +14 -3
- package/cjs/common/mixin.js.map +1 -1
- package/cjs/common/normalQuantile.d.ts +5 -0
- package/cjs/common/normalQuantile.js +21 -0
- package/cjs/common/normalQuantile.js.map +1 -0
- package/cjs/common/number.d.ts +24 -0
- package/cjs/common/number.js +24 -1
- package/cjs/common/number.js.map +1 -1
- package/cjs/common/pad.d.ts +21 -0
- package/cjs/common/pad.js +21 -1
- package/cjs/common/pad.js.map +1 -1
- package/cjs/common/random.d.ts +3 -0
- package/cjs/common/random.js +13 -0
- package/cjs/common/random.js.map +1 -1
- package/cjs/common/regression-bootstrap.d.ts +14 -0
- package/cjs/common/regression-bootstrap.js +37 -0
- package/cjs/common/regression-bootstrap.js.map +1 -0
- package/cjs/common/regression-linear.d.ts +5 -0
- package/cjs/common/regression-linear.js +28 -39
- package/cjs/common/regression-linear.js.map +1 -1
- package/cjs/common/regression-logistic.d.ts +6 -0
- package/cjs/common/regression-logistic.js +25 -14
- package/cjs/common/regression-logistic.js.map +1 -1
- package/cjs/common/regression-lowess.d.ts +11 -1
- package/cjs/common/regression-lowess.js +125 -118
- package/cjs/common/regression-lowess.js.map +1 -1
- package/cjs/common/regression-polynomial.d.ts +1 -0
- package/cjs/common/regression-polynomial.js +24 -94
- package/cjs/common/regression-polynomial.js.map +1 -1
- package/cjs/common/regression-solver.d.ts +26 -0
- package/cjs/common/regression-solver.js +180 -0
- package/cjs/common/regression-solver.js.map +1 -0
- package/cjs/common/regression-utils.d.ts +13 -1
- package/cjs/common/regression-utils.js +27 -12
- package/cjs/common/regression-utils.js.map +1 -1
- package/cjs/common/throttle.js +3 -0
- package/cjs/common/throttle.js.map +1 -1
- package/cjs/common/toDate.js +22 -3
- package/cjs/common/toDate.js.map +1 -1
- package/cjs/common/uuid.d.ts +7 -0
- package/cjs/common/uuid.js +15 -1
- package/cjs/common/uuid.js.map +1 -1
- package/cjs/data-structure/bounds.d.ts +101 -0
- package/cjs/data-structure/bounds.js +74 -7
- package/cjs/data-structure/bounds.js.map +1 -1
- package/cjs/data-structure/hashTable.d.ts +4 -0
- package/cjs/data-structure/hashTable.js +11 -2
- package/cjs/data-structure/hashTable.js.map +1 -1
- package/cjs/data-structure/index.js +6 -2
- package/cjs/data-structure/index.js.map +1 -1
- package/cjs/data-structure/matrix.d.ts +91 -0
- package/cjs/data-structure/matrix.js +52 -4
- package/cjs/data-structure/matrix.js.map +1 -1
- package/cjs/data-structure/point.d.ts +3 -0
- package/cjs/data-structure/point.js +5 -1
- package/cjs/data-structure/point.js.map +1 -1
- package/cjs/dom.d.ts +36 -0
- package/cjs/dom.js +43 -1
- package/cjs/dom.js.map +1 -1
- package/cjs/fmin/blas1.js +10 -1
- package/cjs/fmin/blas1.js.map +1 -1
- package/cjs/fmin/conjugate-gradient.js +18 -3
- package/cjs/fmin/conjugate-gradient.js.map +1 -1
- package/cjs/fmin/linesearch.js +15 -1
- package/cjs/fmin/linesearch.js.map +1 -1
- package/cjs/fmin/nelder-mead.d.ts +1 -0
- package/cjs/fmin/nelder-mead.js +30 -10
- package/cjs/fmin/nelder-mead.js.map +1 -1
- package/cjs/format/number/formatDecimal.js +9 -1
- package/cjs/format/number/formatDecimal.js.map +1 -1
- package/cjs/format/number/formatGroup.js +7 -0
- package/cjs/format/number/formatGroup.js.map +1 -1
- package/cjs/format/number/formatPrefixAuto.js +8 -0
- package/cjs/format/number/formatPrefixAuto.js.map +1 -1
- package/cjs/format/number/formatRounded.js +7 -0
- package/cjs/format/number/formatRounded.js.map +1 -1
- package/cjs/format/number/formatTrim.js +7 -0
- package/cjs/format/number/formatTrim.js.map +1 -1
- package/cjs/format/number/number.js +39 -9
- package/cjs/format/number/number.js.map +1 -1
- package/cjs/format/time.js +23 -6
- package/cjs/format/time.js.map +1 -1
- package/cjs/geo/circle-intersection.d.ts +12 -0
- package/cjs/geo/circle-intersection.js +54 -9
- package/cjs/geo/circle-intersection.js.map +1 -1
- package/cjs/geo/constant.js +8 -1
- package/cjs/geo/constant.js.map +1 -1
- package/cjs/geo/invariant.d.ts +22 -0
- package/cjs/geo/invariant.js +24 -1
- package/cjs/geo/invariant.js.map +1 -1
- package/cjs/graphics/algorithm/aabb.js +7 -3
- package/cjs/graphics/algorithm/aabb.js.map +1 -1
- package/cjs/graphics/algorithm/intersect.d.ts +48 -0
- package/cjs/graphics/algorithm/intersect.js +75 -7
- package/cjs/graphics/algorithm/intersect.js.map +1 -1
- package/cjs/graphics/bounds-util.js +4 -2
- package/cjs/graphics/bounds-util.js.map +1 -1
- package/cjs/graphics/graph-util.js +4 -0
- package/cjs/graphics/graph-util.js.map +1 -1
- package/cjs/graphics/index.js +7 -4
- package/cjs/graphics/index.js.map +1 -1
- package/cjs/graphics/polygon.d.ts +12 -0
- package/cjs/graphics/polygon.js +28 -5
- package/cjs/graphics/polygon.js.map +1 -1
- package/cjs/graphics/text/measure/interface.d.ts +12 -0
- package/cjs/graphics/text/measure/textMeasure.d.ts +23 -0
- package/cjs/graphics/text/measure/textMeasure.js +50 -22
- package/cjs/graphics/text/measure/textMeasure.js.map +1 -1
- package/cjs/graphics/text/measure/util.js +1 -0
- package/cjs/graphics/text/measure/util.js.map +1 -1
- package/cjs/graphics/text/stringWidth.js +7 -3
- package/cjs/graphics/text/stringWidth.js.map +1 -1
- package/cjs/index.d.ts +6 -0
- package/cjs/index.js +19 -4
- package/cjs/index.js.map +1 -1
- package/cjs/logger.js +12 -2
- package/cjs/logger.js.map +1 -1
- package/cjs/lru.js +14 -6
- package/cjs/lru.js.map +1 -1
- package/cjs/math.d.ts +9 -0
- package/cjs/math.js +10 -0
- package/cjs/math.js.map +1 -1
- package/cjs/padding.d.ts +5 -0
- package/cjs/padding.js +5 -0
- package/cjs/padding.js.map +1 -1
- package/cjs/time/formatUtils.d.ts +6 -0
- package/cjs/time/formatUtils.js +7 -0
- package/cjs/time/formatUtils.js.map +1 -1
- package/dist/index.js +2035 -411
- package/dist/index.min.js +128 -1
- package/es/angle.d.ts +61 -0
- package/es/angle.js +66 -10
- package/es/angle.js.map +1 -1
- package/es/color/Color.d.ts +3 -0
- package/es/color/Color.js +64 -9
- package/es/color/Color.js.map +1 -1
- package/es/color/hexToRgb.d.ts +5 -0
- package/es/color/hexToRgb.js +5 -0
- package/es/color/hexToRgb.js.map +1 -1
- package/es/color/rgbToHsl.js +5 -1
- package/es/color/rgbToHsl.js.map +1 -1
- package/es/common/array.d.ts +43 -0
- package/es/common/array.js +44 -8
- package/es/common/array.js.map +1 -1
- package/es/common/bisect.d.ts +21 -0
- package/es/common/bisect.js +29 -4
- package/es/common/bisect.js.map +1 -1
- package/es/common/bootstrap.d.ts +5 -0
- package/es/common/bootstrap.js +14 -0
- package/es/common/bootstrap.js.map +1 -0
- package/es/common/clone.js +6 -0
- package/es/common/clone.js.map +1 -1
- package/es/common/cloneDeep.js +4 -1
- package/es/common/cloneDeep.js.map +1 -1
- package/es/common/correlation.d.ts +3 -0
- package/es/common/correlation.js +77 -0
- package/es/common/correlation.js.map +1 -0
- package/es/common/debounce.js +22 -4
- package/es/common/debounce.js.map +1 -1
- package/es/common/deviation.js +1 -2
- package/es/common/ecdf.d.ts +8 -0
- package/es/common/ecdf.js +11 -1
- package/es/common/ecdf.js.map +1 -1
- package/es/common/extent.d.ts +4 -0
- package/es/common/extent.js +8 -3
- package/es/common/extent.js.map +1 -1
- package/es/common/field.d.ts +6 -0
- package/es/common/field.js +3 -1
- package/es/common/field.js.map +1 -1
- package/es/common/has.d.ts +17 -0
- package/es/common/has.js +18 -1
- package/es/common/has.js.map +1 -1
- package/es/common/index.d.ts +5 -0
- package/es/common/index.js +24 -0
- package/es/common/index.js.map +1 -1
- package/es/common/interpolate.js +16 -3
- package/es/common/interpolate.js.map +1 -1
- package/es/common/isBase64.d.ts +6 -0
- package/es/common/isBase64.js +6 -0
- package/es/common/isBase64.js.map +1 -1
- package/es/common/isBoolean.d.ts +13 -0
- package/es/common/isBoolean.js +13 -1
- package/es/common/isBoolean.js.map +1 -1
- package/es/common/isEmpty.js +11 -1
- package/es/common/isEmpty.js.map +1 -1
- package/es/common/isEqual.js +19 -7
- package/es/common/isEqual.js.map +1 -1
- package/es/common/isFunction.d.ts +25 -0
- package/es/common/isFunction.js +27 -2
- package/es/common/isFunction.js.map +1 -1
- package/es/common/isNull.js +2 -1
- package/es/common/isNumber.d.ts +23 -0
- package/es/common/isNumber.js +23 -1
- package/es/common/isNumber.js.map +1 -1
- package/es/common/isNumeric.d.ts +25 -0
- package/es/common/isNumeric.js +25 -0
- package/es/common/isNumeric.js.map +1 -1
- package/es/common/isObject.d.ts +21 -0
- package/es/common/isObject.js +22 -0
- package/es/common/isObject.js.map +1 -1
- package/es/common/isObjectLike.d.ts +20 -0
- package/es/common/isObjectLike.js +21 -0
- package/es/common/isObjectLike.js.map +1 -1
- package/es/common/isPlainObject.d.ts +25 -0
- package/es/common/isPlainObject.js +26 -0
- package/es/common/isPlainObject.js.map +1 -1
- package/es/common/isPrototype.js +1 -1
- package/es/common/isRegExp.js +1 -1
- package/es/common/isShallowEqual.js +1 -0
- package/es/common/isShallowEqual.js.map +1 -1
- package/es/common/isString.d.ts +13 -0
- package/es/common/isString.js +13 -1
- package/es/common/isString.js.map +1 -1
- package/es/common/isType.d.ts +6 -0
- package/es/common/isType.js +6 -0
- package/es/common/isType.js.map +1 -1
- package/es/common/isValidNumber.js.map +1 -1
- package/es/common/isValidUrl.js.map +1 -1
- package/es/common/kde.d.ts +28 -0
- package/es/common/kde.js +29 -7
- package/es/common/kde.js.map +1 -1
- package/es/common/mean.d.ts +2 -0
- package/es/common/mean.js +19 -0
- package/es/common/mean.js.map +1 -0
- package/es/common/merge.js +22 -5
- package/es/common/merge.js.map +1 -1
- package/es/common/mixin.js +14 -3
- package/es/common/mixin.js.map +1 -1
- package/es/common/normalQuantile.d.ts +5 -0
- package/es/common/normalQuantile.js +15 -0
- package/es/common/normalQuantile.js.map +1 -0
- package/es/common/number.d.ts +24 -0
- package/es/common/number.js +24 -2
- package/es/common/number.js.map +1 -1
- package/es/common/pad.d.ts +21 -0
- package/es/common/pad.js +21 -1
- package/es/common/pad.js.map +1 -1
- package/es/common/random.d.ts +3 -0
- package/es/common/random.js +13 -1
- package/es/common/random.js.map +1 -1
- package/es/common/regression-bootstrap.d.ts +14 -0
- package/es/common/regression-bootstrap.js +31 -0
- package/es/common/regression-bootstrap.js.map +1 -0
- package/es/common/regression-linear.d.ts +5 -0
- package/es/common/regression-linear.js +25 -39
- package/es/common/regression-linear.js.map +1 -1
- package/es/common/regression-logistic.d.ts +6 -0
- package/es/common/regression-logistic.js +24 -16
- package/es/common/regression-logistic.js.map +1 -1
- package/es/common/regression-lowess.d.ts +11 -1
- package/es/common/regression-lowess.js +120 -118
- package/es/common/regression-lowess.js.map +1 -1
- package/es/common/regression-polynomial.d.ts +1 -0
- package/es/common/regression-polynomial.js +21 -89
- package/es/common/regression-polynomial.js.map +1 -1
- package/es/common/regression-solver.d.ts +26 -0
- package/es/common/regression-solver.js +168 -0
- package/es/common/regression-solver.js.map +1 -0
- package/es/common/regression-utils.d.ts +13 -1
- package/es/common/regression-utils.js +18 -9
- package/es/common/regression-utils.js.map +1 -1
- package/es/common/throttle.js +3 -0
- package/es/common/throttle.js.map +1 -1
- package/es/common/toDate.js +23 -3
- package/es/common/toDate.js.map +1 -1
- package/es/common/uuid.d.ts +7 -0
- package/es/common/uuid.js +15 -1
- package/es/common/uuid.js.map +1 -1
- package/es/data-structure/bounds.d.ts +101 -0
- package/es/data-structure/bounds.js +74 -8
- package/es/data-structure/bounds.js.map +1 -1
- package/es/data-structure/hashTable.d.ts +4 -0
- package/es/data-structure/hashTable.js +11 -2
- package/es/data-structure/hashTable.js.map +1 -1
- package/es/data-structure/index.js +2 -0
- package/es/data-structure/index.js.map +1 -1
- package/es/data-structure/matrix.d.ts +91 -0
- package/es/data-structure/matrix.js +52 -5
- package/es/data-structure/matrix.js.map +1 -1
- package/es/data-structure/point.d.ts +3 -0
- package/es/data-structure/point.js +5 -1
- package/es/data-structure/point.js.map +1 -1
- package/es/dom.d.ts +36 -0
- package/es/dom.js +43 -8
- package/es/dom.js.map +1 -1
- package/es/fmin/blas1.js +10 -0
- package/es/fmin/blas1.js.map +1 -1
- package/es/fmin/conjugate-gradient.js +18 -2
- package/es/fmin/conjugate-gradient.js.map +1 -1
- package/es/fmin/linesearch.js +15 -0
- package/es/fmin/linesearch.js.map +1 -1
- package/es/fmin/nelder-mead.d.ts +1 -0
- package/es/fmin/nelder-mead.js +29 -9
- package/es/fmin/nelder-mead.js.map +1 -1
- package/es/format/number/formatDecimal.js +9 -1
- package/es/format/number/formatDecimal.js.map +1 -1
- package/es/format/number/formatGroup.js +7 -0
- package/es/format/number/formatGroup.js.map +1 -1
- package/es/format/number/formatPrefixAuto.js +8 -0
- package/es/format/number/formatPrefixAuto.js.map +1 -1
- package/es/format/number/formatRounded.js +7 -0
- package/es/format/number/formatRounded.js.map +1 -1
- package/es/format/number/formatTrim.js +7 -0
- package/es/format/number/formatTrim.js.map +1 -1
- package/es/format/number/number.js +40 -8
- package/es/format/number/number.js.map +1 -1
- package/es/format/time.js +23 -5
- package/es/format/time.js.map +1 -1
- package/es/geo/circle-intersection.d.ts +12 -0
- package/es/geo/circle-intersection.js +54 -14
- package/es/geo/circle-intersection.js.map +1 -1
- package/es/geo/constant.js +8 -0
- package/es/geo/constant.js.map +1 -1
- package/es/geo/invariant.d.ts +22 -0
- package/es/geo/invariant.js +24 -0
- package/es/geo/invariant.js.map +1 -1
- package/es/graphics/algorithm/aabb.js +7 -3
- package/es/graphics/algorithm/aabb.js.map +1 -1
- package/es/graphics/algorithm/intersect.d.ts +48 -0
- package/es/graphics/algorithm/intersect.js +75 -12
- package/es/graphics/algorithm/intersect.js.map +1 -1
- package/es/graphics/bounds-util.js +4 -2
- package/es/graphics/bounds-util.js.map +1 -1
- package/es/graphics/graph-util.js +4 -0
- package/es/graphics/graph-util.js.map +1 -1
- package/es/graphics/index.js +2 -0
- package/es/graphics/index.js.map +1 -1
- package/es/graphics/polygon.d.ts +12 -0
- package/es/graphics/polygon.js +28 -6
- package/es/graphics/polygon.js.map +1 -1
- package/es/graphics/text/measure/interface.d.ts +12 -0
- package/es/graphics/text/measure/textMeasure.d.ts +23 -0
- package/es/graphics/text/measure/textMeasure.js +46 -21
- package/es/graphics/text/measure/textMeasure.js.map +1 -1
- package/es/graphics/text/measure/util.js +1 -0
- package/es/graphics/text/measure/util.js.map +1 -1
- package/es/graphics/text/stringWidth.js +7 -3
- package/es/graphics/text/stringWidth.js.map +1 -1
- package/es/index.d.ts +6 -0
- package/es/index.js +15 -1
- package/es/index.js.map +1 -1
- package/es/logger.js +12 -1
- package/es/logger.js.map +1 -1
- package/es/lru.js +14 -6
- package/es/lru.js.map +1 -1
- package/es/math.d.ts +9 -0
- package/es/math.js +10 -1
- package/es/math.js.map +1 -1
- package/es/padding.d.ts +5 -0
- package/es/padding.js +5 -1
- package/es/padding.js.map +1 -1
- package/es/time/formatUtils.d.ts +6 -0
- package/es/time/formatUtils.js +7 -1
- package/es/time/formatUtils.js.map +1 -1
- package/package.json +4 -3
package/dist/index.min.js
CHANGED
|
@@ -1 +1,128 @@
|
|
|
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 n={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function u(){}function r(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,u,i,s){if("function"!=typeof u)throw new TypeError("The listener must be a function");var o=new r(u,i||t,s),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new u:delete t._events[e]}function o(){this._events=new u,this._eventsCount=0}Object.create&&(u.prototype=Object.create(null),(new u).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,u,r=[];if(0===this._eventsCount)return r;for(u in t=this._events)e.call(t,u)&&r.push(n?u.slice(1):u);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=n?n+t:t,u=this._events[e];if(!u)return[];if(u.fn)return[u.fn];for(var r=0,i=u.length,s=new Array(i);r<i;r++)s[r]=u[r].fn;return s},o.prototype.listenerCount=function(t){var e=n?n+t:t,u=this._events[e];return u?u.fn?1:u.length:0},o.prototype.emit=function(t,e,u,r,i,s){var o=n?n+t:t;if(!this._events[o])return!1;var a,D,h=this._events[o],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,u),!0;case 4:return h.fn.call(h.context,e,u,r),!0;case 5:return h.fn.call(h.context,e,u,r,i),!0;case 6:return h.fn.call(h.context,e,u,r,i,s),!0}for(D=1,a=new Array(l-1);D<l;D++)a[D-1]=arguments[D];h.fn.apply(h.context,a)}else{var c,f=h.length;for(D=0;D<f;D++)switch(h[D].once&&this.removeListener(t,h[D].fn,void 0,!0),l){case 1:h[D].fn.call(h[D].context);break;case 2:h[D].fn.call(h[D].context,e);break;case 3:h[D].fn.call(h[D].context,e,u);break;case 4:h[D].fn.call(h[D].context,e,u,r);break;default:if(!a)for(c=1,a=new Array(l-1);c<l;c++)a[c-1]=arguments[c];h[D].fn.apply(h[D].context,a)}}return!0},o.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,u,r){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||r&&!o.once||u&&o.context!==u||s(this,i);else{for(var a=0,D=[],h=o.length;a<h;a++)(o[a].fn!==e||r&&!o[a].once||u&&o[a].context!==u)&&D.push(o[a]);D.length?this._events[i]=1===D.length?D[0]:D:s(this,i)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new u,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(n);var u=e(n.exports);const r=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,i=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||r(t,"Boolean"),s=t=>"function"==typeof t,o=t=>null==t,a=t=>null!=t,D=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 n=typeof t;return e?"string"===n:"string"===n||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)},d=t=>r(t,"Date"),m=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||r(t,"Number")},g=t=>m(t)&&Number.isFinite(t),p=t=>r(t,"RegExp"),y=Object.prototype,C=Object.prototype.hasOwnProperty;const x=(t,e,n)=>{const u=c(e)?e.split("."):e;for(let e=0;e<u.length;e++)t=t?t[u[e]]:void 0;return void 0===t?n:t},E=Object.prototype.hasOwnProperty;function M(t,e,n=!1,u=!1){if(e){if(t===e)return;if(a(e)&&"object"==typeof e){const r=Object(e),i=[];for(const t in r)i.push(t);let{length:s}=i,o=-1;for(;s--;){const s=i[++o];!a(r[s])||"object"!=typeof r[s]||u&&f(t[s])?B(t,s,r[s]):b(t,e,s,n,u)}}}}function b(t,e,n,u=!1,r=!1){const i=t[n],s=e[n];let o=e[n],a=!0;if(f(s)){if(u)o=[];else if(f(i))o=i;else if(F(i)){o=new Array(i.length);let t=-1;const e=i.length;for(;++t<e;)o[t]=i[t]}}else l(s)?(o=null!=i?i:{},"function"!=typeof i&&"object"==typeof i||(o={})):a=!1;a&&M(o,s,u,r),B(t,n,o)}function B(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}const v=Object.prototype.hasOwnProperty;function A(t){return Object.prototype.toString.call(t)}function w(t){return Object.keys(t)}function S(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function T(t){return f(t)?t.length:D(t)?Object.keys(t).length:0}function _(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push(n);return e}function L(t,e,n){const u=_(e);for(let r=0;r<u.length;r++){const i=u[r];(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}return t}function N(t){return a(t)?f(t)?t:[t]:[]}function k(t){if(F(t)){return t[t.length-1]}}function I(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function U(t){return Number(t)}function P(t,e,n=U){const u=t.length;if(!u)return;if(e<=0||u<2)return n(t[0],0,t);if(e>=1)return n(t[u-1],u-1,t);const r=(u-1)*e,i=Math.floor(r),s=n(t[i],i,t);return s+(n(t[i+1],i+1,t)-s)*(r-i)}const O="undefined"!=typeof console;function H(t,e,n){const u=[e].concat([].slice.call(n));O&&console[t].apply(console,u)}var R;t.LoggerLevel=void 0,(R=t.LoggerLevel||(t.LoggerLevel={}))[R.None=0]="None",R[R.Error=1]="Error",R[R.Warn=2]="Warn",R[R.Info=3]="Info",R[R.Debug=4]="Debug";class W{static getInstance(t,e){return W._instance&&m(t)?W._instance.level(t):W._instance||(W._instance=new W(t,e)),W._instance}static setInstance(t){return W._instance=t}static setInstanceLevel(t){W._instance?W._instance.level(t):W._instance=new W(t)}static clearInstance(){W._instance=null}constructor(e=t.LoggerLevel.None,n){this._onErrorHandler=[],this._level=e,this._method=n}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 n;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):H(null!==(n=this._method)&&void 0!==n?n:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&H(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&H(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&H(this._method||"log","DEBUG",e),this}}W._instance=null;const z=(t,e,n)=>{let u=t,r=e;for(;u<r;){const t=Math.floor((u+r)/2);n(t)>=0?r=t:u=t+1}return u};function j(t,e){let n,u=0,r=0,i=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-r,r+=n/++u,i+=n*(e-r));else{let s=-1;for(let o of t)null!=(o=e(o,++s,t))&&(o=+o)>=o&&(n=o-r,r+=n/++u,i+=n*(o-r))}return u>1?i/(u-1):0}const q=Math.sqrt(50),Y=Math.sqrt(10),G=Math.sqrt(2);const V=1e-10,$=1e-10;function X(t,e,n=$,u=V){const r=u,i=n*Math.max(t,e);return Math.abs(t-e)<=Math.max(r,i)}const Z=(t,e=0)=>{let n="",u=e-1;for(;u>=0;)n=`${n}${t}`,u-=1;return n},J=(t,e,n=" ",u="right")=>{const r=n,i=t+"",s=e-i.length;return s<=0?i:"left"===u?Z(r,s)+i:"center"===u?Z(r,Math.floor(s/2))+i+Z(r,Math.ceil(s/2)):i+Z(r,s)},Q=function(t,e,n){return t<e?e:t>n?n:t};let K=!1;try{K="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){K=!1}function tt(t,e,n){let u,r,i,s,o,a,h=0,l=!1,c=!1,f=!0;const F=!e&&0!==e&&K;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){const n=u,i=r;return u=r=void 0,h=e,s=t.apply(i,n),s}function m(t,e){return F?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function p(t){const n=t-a;return void 0===a||n>=e||n<0||c&&t-h>=i}function y(){const t=Date.now();if(p(t))return C(t);o=m(y,function(t){const n=t-h,u=e-(t-a);return c?Math.min(u,i-n):u}(t))}function C(t){return o=void 0,f&&u?d(t):(u=r=void 0,s)}function x(...t){const n=Date.now(),i=p(n);if(u=t,r=this,a=n,i){if(void 0===o)return function(t){return h=t,o=m(y,e),l?d(t):s}(a);if(c)return o=m(y,e),d(a)}return void 0===o&&(o=m(y,e)),s}return e=+e||0,D(n)&&(l=!!n.leading,c="maxWait"in n,c&&(i=Math.max(g(n.maxWait)?n.maxWait:0,e)),f="trailing"in n?!!n.trailing:f),x.cancel=function(){void 0!==o&&function(t){if(F)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,u=a=r=o=void 0},x.flush=function(){return void 0===o?s:C(Date.now())},x.pending=function(){return void 0!==o},x}function et(t,e){return n=>t*(1-n)+e*n}K=!1;const nt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ut=new RegExp(nt.source,"g");const rt=/^(?:(\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 it(t){if(t instanceof Date)return t;if(c(t)){const e=rt.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 n=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return o(t)?new Date(NaN):new Date(Math.round(t))}const st=4294967296;const ot=t=>e=>x(e,t),at=(t,e={})=>{if(s(t))return t;const n=[t];return(e&&e.get||ot)(n)};function Dt(t){if(t<=0||t>=1)return 0;const e=-.00778489400243029,n=-.322396458041136,u=-2.40075827716184,r=-2.54973253934373,i=4.37466414146497,s=2.93816398269878,o=.00778469570904146,a=.32246712907004,D=2.445134137143,h=3.75440866190742,l=.02425;let c,f;return t<l?(c=Math.sqrt(-2*Math.log(t)),(((((e*c+n)*c+u)*c+r)*c+i)*c+s)/((((o*c+a)*c+D)*c+h)*c+1)):t<=.97575?(c=t-.5,f=c*c,(((((-39.6968302866538*f+220.946098424521)*f-275.928510446969)*f+138.357751867269)*f-30.6647980661472)*f+2.50662827745924)*c/(((((-54.4760987982241*f+161.585836858041)*f-155.698979859887)*f+66.8013118877197)*f-13.2806815528857)*f+1)):(c=Math.sqrt(-2*Math.log(1-t)),-(((((e*c+n)*c+u)*c+r)*c+i)*c+s)/((((o*c+a)*c+D)*c+h)*c+1))}function ht(t,e,n,u){let r=1/0,i=-1/0,s=0,a=0;for(let u=0;u<t.length;u++){const D=t[u];let h=e(D),l=n(D);!o(h)&&(h=+h)>=h&&!o(l)&&(l=+l)>=l&&(h<r&&(r=h),h>i&&(i=h),s++,a+=h)}if(0===s)return{min:r,max:i,n:s,X:0,SSE:0,Sxx:0};const D=a/s;let h=0,l=0;for(let r=0;r<t.length;r++){const i=t[r];let s=e(i),a=n(i);if(!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a){const t=a-u(s);h+=t*t;const e=s-D;l+=e*e}}return{min:r,max:i,n:s,X:D,SSE:h,Sxx:l}}function lt(t,e){const{n:n,X:u,Sxx:r,SSE:i}=e,s=n>2?i/(n-2):0;return{seMean:r>0?Math.sqrt(s*(1/n+(t-u)*(t-u)/r)):Math.sqrt(s/n),sePred:Math.sqrt(s*(1+1/n+(r>0?(t-u)*(t-u)/r:0)))}}function ct(t,e,n,u){const r=u-t*t;if(Math.abs(r)<Number.EPSILON)return{a:e,b:0};const i=(n-t*e)/r;return{a:e-i*t,b:i}}function ft(t,e,n,u){for(let r=0;r<t.length;r++){const i=t[r];let s=e(i),a=n(i);!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a&&u(s,a,r)}}function Ft(t,e,n,u,r){let i=0,s=0;for(let a=0;a<t.length;a++){const D=t[a];let h=n(D);if(!o(h)&&(h=+h)>=h){const t=h-r(e(D));i+=t*t;const n=h-u;s+=n*n}}return 0===s?0:1-i/s}function dt(t){const e=Math.abs(t);if(e>=1)return 0;const n=1-e*e*e;return n*n*n}const mt=t=>1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t);function gt(t,e,n=1){return t<=0||0===e?0:e*Math.pow(t,-1/(n+4))}function pt(t,e,n=1){if(t<=0||0===e)return 0;return Math.pow(4/(n+2),1/(n+4))*e*Math.pow(t,-1/(n+4))}class yt{}const Ct=1e-12,xt=Math.PI,Et=xt/2,Mt=2*xt,bt=2*Math.PI,Bt=Math.abs,vt=Math.atan2,At=Math.cos,wt=Math.max,St=Math.min,Tt=Math.sin,_t=Math.sqrt,Lt=Math.pow;function Nt(t,e,n){const u=n.x-e.x,r=n.y-e.y,i=t.x-e.x,s=t.y-e.y;return Math.abs(u*s-i*r)/Math.sqrt(u*u+r*r)}function kt(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t,e){return t.x*e.y-t.y*e.x}function Ut(t,e){let n=0;for(let u=0;u<t.length;++u)n+=t[u]*e[u];return n}function Pt(t,e){return Bt(t[0]-e[0])+Bt(t[1]-e[1])<Ct}function Ot(t,e=10){return Math.round(t*e)/e}function Ht(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-(+e[1]||0);return n>0?n:0}class Rt{constructor(t=0,e=0,n,u){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=n,this.y1=u}clone(){return new Rt(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 m(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return m(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 Wt{static distancePP(t,e){return _t(Lt(t.x-e.x,2)+Lt(t.y-e.y,2))}static distanceNN(t,e,n,u){return _t(Lt(t-n,2)+Lt(e-u,2))}static distancePN(t,e,n){return _t(Lt(e-t.x,2)+Lt(n-t.y,2))}static pointAtPP(t,e,n){return new Rt((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y)}}class zt{constructor(t=0,e=0,n,u){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=n,this.theta1=u}clone(){return new zt(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 jt(t){return t*(Math.PI/180)}function qt(t){return 180*t/Math.PI}const Yt=(t=0)=>{if(t<0)for(;t<-Mt;)t+=Mt;else if(t>0)for(;t>Mt;)t-=Mt;return t},Gt=Yt,Vt=(t=0)=>t>360||t<-360?t%360:t,$t=Vt;function Xt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Zt(t,e){const n=Math.abs(e-t);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const u=Xt(Math.min(t,e)),r=u+n,i=[u,r];let s=Math.floor(u/Math.PI)*Math.PI/2;for(;s<r;)s>u&&i.push(s),s+=Math.PI/2;return i}function Jt(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1]}function Qt(t,e,n,u){let r=t[0],i=e[0],s=n[0],o=u[0];return i<r&&([r,i]=[i,r]),o<s&&([o,s]=[s,o]),!(i<s||o<r)&&(r=t[1],i=e[1],s=n[1],o=u[1],i<r&&([r,i]=[i,r]),o<s&&([o,s]=[s,o]),!(i<s||o<r))}var Kt;t.InnerBBox=void 0,(Kt=t.InnerBBox||(t.InnerBBox={}))[Kt.NONE=0]="NONE",Kt[Kt.BBOX1=1]="BBOX1",Kt[Kt.BBOX2=2]="BBOX2";const te=(t,e,n)=>{let u=t.x1,r=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,D=e.y1,h=e.y2;return n&&(u>r&&([u,r]=[r,u]),i>s&&([i,s]=[s,i]),o>a&&([o,a]=[a,o]),D>h&&([D,h]=[h,D])),{x11:u,x12:r,y11:i,y12:s,x21:o,x22:a,y21:D,y22:h}};function ee(t,e,n){if(!e)return!0;if(!n)return t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let u=e.x1,r=e.x2,i=e.y1,s=e.y2;return u>r&&([u,r]=[r,u]),i>s&&([i,s]=[s,i]),t.x>=u&&t.x<=r&&t.y>=i&&t.y<=s}function ne(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ue({x:t,y:e},n,u={x:0,y:0}){return{x:(t-u.x)*Math.cos(n)-(e-u.y)*Math.sin(n)+u.x,y:(t-u.x)*Math.sin(n)+(e-u.y)*Math.cos(n)+u.y}}function re(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ie(t,e){const n=e?jt(t.angle):t.angle,u=re(t);return[ue({x:t.x1,y:t.y1},n,u),ue({x:t.x2,y:t.y1},n,u),ue({x:t.x2,y:t.y2},n,u),ue({x:t.x1,y:t.y2},n,u)]}function se(t,e,n=!1){const u=ie(t,n),r=ie(e,n),i=(t,e)=>[e.x-t.x,e.y-t.y],s=i(re(t),re(e)),o=i(u[0],u[1]),a=i(u[1],u[2]),D=i(r[0],r[1]),h=i(r[1],r[2]),l=n?jt(t.angle):t.angle;let c=n?jt(90-t.angle):t.angle+Et;const f=n?jt(e.angle):e.angle;let F=n?jt(90-e.angle):e.angle+Et;c>bt&&(c-=bt),F>bt&&(F-=bt);const d=(t,e,n,u)=>{const r=[Math.cos(e),Math.sin(e)];return t+(ne(r,n)+ne(r,u))/2>ne(r,s)};return d((t.x2-t.x1)/2,l,D,h)&&d((t.y2-t.y1)/2,c,D,h)&&d((e.x2-e.x1)/2,f,o,a)&&d((e.y2-e.y1)/2,F,o,a)}let oe,ae,De,he,le,ce,fe,Fe,de,me,ge,pe;function ye(t,e,n=3,u=!1){let r=t.x1,i=t.x2,s=t.y1,o=t.y2,a=e.x1,D=e.x2,h=e.y1,l=e.y2;if(u){let t;r>i&&(t=r,r=i,i=t),s>o&&(t=s,s=o,o=t),a>D&&(t=a,a=D,D=t),h>l&&(t=h,h=l,l=t)}if(r>=D||i<=a||s>=l||o<=h)return[t,e];const c=(i-r+2*n)*(o-s+2*n),f=(D-a+2*n)*(l-h+2*n),F=Math.min(r,a),d=Math.min(s,h),m=Math.max(i,D),g=Math.max(o,l);return c+f>(m-F)*(g-d)?[{x1:F,x2:m,y1:d,y2:g}]:[t,e]}const Ce={x:0,y:0},xe={x:0,y:0};function Ee(t,e,n,u){return Nt(t,e,n)<=u/2&&ve(t,e,n)}const Me={x:0,y:0},be={x:0,y:0},Be={x:0,y:0};function ve(t,e,n){return Me.x=e.x-t.x,Me.y=e.y-t.y,be.x=n.x-t.x,be.y=n.y-t.y,Be.x=e.y-n.y,Be.y=n.x-e.x,It(Me,Be)*It(be,Be)<0}class Ae{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:n,fontSize:u,fontFamily:r}){return(t?t+" ":"")+(e?e+" ":"")+(n?n+" ":"")+(u||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 n=0,u=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:u++;return{width:~~(.8*n*e+u*e),height:e}}static getDefaultUtils(t){return Ae.instance||(Ae.instance=new Ae(t)),Ae.instance}}const we=1e-8;function Se(t,e,n,u,r){for(let i=0,s=r[r.length-1];i<r.length;i++){const o=r[i];if(Qt([t,e],[n,u],[o.x,o.y],[s.x,s.y]))return!0;s=o}return!1}function Te(t,e,n){let u=0,r=t[0];if(!r)return!1;for(let i=1;i<t.length;i++){const s=t[i];u+=_e(r.x,r.y,s.x,s.y,e,n),r=s}const i=t[0];return Le(r.x,i.x)&&Le(r.y,i.y)||(u+=_e(r.x,r.y,i.x,i.y,e,n)),0!==u}function _e(t,e,n,u,r,i){if(i>e&&i>u||i<e&&i<u)return 0;if(u===e)return 0;const s=(i-e)/(u-e);let o=u<e?1:-1;1!==s&&0!==s||(o=u<e?.5:-.5);const a=s*(n-t)+t;return a===r?1/0:a>r?o:0}function Le(t,e){return Math.abs(t-e)<we}const Ne=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ke(),"")},ke=({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")},Ie=t=>{let e=t.charCodeAt(0),n=2===t.length?t.charCodeAt(1):0,u=e;return 55296<=e&&e<=56319&&56320<=n&&n<=57343&&(e&=1023,n&=1023,u=e<<10|n,u+=65536),12288===u||65281<=u&&u<=65376||65504<=u&&u<=65510?"F":8361===u||65377<=u&&u<=65470||65474<=u&&u<=65479||65482<=u&&u<=65487||65490<=u&&u<=65495||65498<=u&&u<=65500||65512<=u&&u<=65518?"H":4352<=u&&u<=4447||4515<=u&&u<=4519||4602<=u&&u<=4607||9001<=u&&u<=9002||11904<=u&&u<=11929||11931<=u&&u<=12019||12032<=u&&u<=12245||12272<=u&&u<=12283||12289<=u&&u<=12350||12353<=u&&u<=12438||12441<=u&&u<=12543||12549<=u&&u<=12589||12593<=u&&u<=12686||12688<=u&&u<=12730||12736<=u&&u<=12771||12784<=u&&u<=12830||12832<=u&&u<=12871||12880<=u&&u<=13054||13056<=u&&u<=19903||19968<=u&&u<=42124||42128<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||55216<=u&&u<=55238||55243<=u&&u<=55291||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65106||65108<=u&&u<=65126||65128<=u&&u<=65131||110592<=u&&u<=110593||127488<=u&&u<=127490||127504<=u&&u<=127546||127552<=u&&u<=127560||127568<=u&&u<=127569||131072<=u&&u<=194367||177984<=u&&u<=196605||196608<=u&&u<=262141?"W":32<=u&&u<=126||162<=u&&u<=163||165<=u&&u<=166||172===u||175===u||10214<=u&&u<=10221||10629<=u&&u<=10630?"Na":161===u||164===u||167<=u&&u<=168||170===u||173<=u&&u<=174||176<=u&&u<=180||182<=u&&u<=186||188<=u&&u<=191||198===u||208===u||215<=u&&u<=216||222<=u&&u<=225||230===u||232<=u&&u<=234||236<=u&&u<=237||240===u||242<=u&&u<=243||247<=u&&u<=250||252===u||254===u||257===u||273===u||275===u||283===u||294<=u&&u<=295||299===u||305<=u&&u<=307||312===u||319<=u&&u<=322||324===u||328<=u&&u<=331||333===u||338<=u&&u<=339||358<=u&&u<=359||363===u||462===u||464===u||466===u||468===u||470===u||472===u||474===u||476===u||593===u||609===u||708===u||711===u||713<=u&&u<=715||717===u||720===u||728<=u&&u<=731||733===u||735===u||768<=u&&u<=879||913<=u&&u<=929||931<=u&&u<=937||945<=u&&u<=961||963<=u&&u<=969||1025===u||1040<=u&&u<=1103||1105===u||8208===u||8211<=u&&u<=8214||8216<=u&&u<=8217||8220<=u&&u<=8221||8224<=u&&u<=8226||8228<=u&&u<=8231||8240===u||8242<=u&&u<=8243||8245===u||8251===u||8254===u||8308===u||8319===u||8321<=u&&u<=8324||8364===u||8451===u||8453===u||8457===u||8467===u||8470===u||8481<=u&&u<=8482||8486===u||8491===u||8531<=u&&u<=8532||8539<=u&&u<=8542||8544<=u&&u<=8555||8560<=u&&u<=8569||8585===u||8592<=u&&u<=8601||8632<=u&&u<=8633||8658===u||8660===u||8679===u||8704===u||8706<=u&&u<=8707||8711<=u&&u<=8712||8715===u||8719===u||8721===u||8725===u||8730===u||8733<=u&&u<=8736||8739===u||8741===u||8743<=u&&u<=8748||8750===u||8756<=u&&u<=8759||8764<=u&&u<=8765||8776===u||8780===u||8786===u||8800<=u&&u<=8801||8804<=u&&u<=8807||8810<=u&&u<=8811||8814<=u&&u<=8815||8834<=u&&u<=8835||8838<=u&&u<=8839||8853===u||8857===u||8869===u||8895===u||8978===u||9312<=u&&u<=9449||9451<=u&&u<=9547||9552<=u&&u<=9587||9600<=u&&u<=9615||9618<=u&&u<=9621||9632<=u&&u<=9633||9635<=u&&u<=9641||9650<=u&&u<=9651||9654<=u&&u<=9655||9660<=u&&u<=9661||9664<=u&&u<=9665||9670<=u&&u<=9672||9675===u||9678<=u&&u<=9681||9698<=u&&u<=9701||9711===u||9733<=u&&u<=9734||9737===u||9742<=u&&u<=9743||9748<=u&&u<=9749||9756===u||9758===u||9792===u||9794===u||9824<=u&&u<=9825||9827<=u&&u<=9829||9831<=u&&u<=9834||9836<=u&&u<=9837||9839===u||9886<=u&&u<=9887||9918<=u&&u<=9919||9924<=u&&u<=9933||9935<=u&&u<=9953||9955===u||9960<=u&&u<=9983||10045===u||10071===u||10102<=u&&u<=10111||11093<=u&&u<=11097||12872<=u&&u<=12879||57344<=u&&u<=63743||65024<=u&&u<=65039||65533===u||127232<=u&&u<=127242||127248<=u&&u<=127277||127280<=u&&u<=127337||127344<=u&&u<=127386||917760<=u&&u<=917999||983040<=u&&u<=1048573||1048576<=u&&u<=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 Pe(t,e={},n){n||(n=1);const{fontStyle:u=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:i=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(u?u+" ":"")+(r?r+" ":"")+(i?i+" ":"")+s*n+"px "+(o||"sans-serif")}class Oe{constructor(t,e){this._numberCharSize=null,this._fullCharSize=null,this._letterCharSize=null,this._specialCharSizeMap={},this._canvas=null,this._context=null,this._contextSaved=!1,this._notSupportCanvas=!1,this._notSupportVRender=!1,this._userSpec={},this.specialCharSet="-/: .,@%'\"~",this._option=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),a(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=a(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(o(this._canvas)&&(a(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),o(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&a(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),o(this._context)&&a(this._canvas)){const t=this._canvas.getContext("2d");a(t)&&(t.save(),t.font=Pe(this.textSpec),this._contextSaved=!0,this._context=t)}return!o(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,n;const{defaultFontParams:u={}}=this._option,{fontStyle:r=u.fontStyle,fontVariant:i=u.fontVariant,fontWeight:s=(null!==(t=u.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=u.fontSize)&&void 0!==e?e:12),fontFamily:a=(null!==(n=u.fontFamily)&&void 0!==n?n:"sans-serif"),align:D,textAlign:h=(null!=D?D:"center"),baseline:l,textBaseline:f=(null!=l?l:"middle"),ellipsis:F,limit:d}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(c(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:r,fontVariant:i,fontFamily:a,fontSize:o,fontWeight:s,textAlign:h,textBaseline:f,ellipsis:F,limit:d,lineHeight:m}}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(o(t))return{width:0,height:0};if(o(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:n,fontWeight:u,textAlign:r,textBaseline:i,ellipsis:s,limit:a,lineHeight:D}=this.textSpec;let h;try{const o=this._option.getTextBounds({text:t,fontFamily:e,fontSize:n,fontWeight:u,textAlign:r,textBaseline:i,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:D});h={width:o.width(),height:o.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 n=this._context.measureText(t),{fontSize:u,lineHeight:r}=this.textSpec;return{width:n.width,height:null!==(e=r)&&void 0!==e?e:u,fontBoundingBoxAscent:n.fontBoundingBoxAscent,fontBoundingBoxDescent:n.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let n=0;n<t.length;n++){const u=t[n];let r=this._measureSpecialChar(u);o(r)&&Oe.NUMBERS_CHAR_SET.includes(u)&&(r=this._measureNumberChar()),o(r)&&["F","W"].includes(Ie(u))&&(r=this._measureFullSizeChar()),o(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height),!o(r.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=r.fontBoundingBoxAscent),!o(r.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=r.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const n={width:0,height:0},{fontSize:u,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],i=["F","W"].includes(Ie(r))?1:.53;n.width+=i*u}return n.height=null!==(e=r)&&void 0!==e?e:u,n}_measureReduce(t,e){var n;const{fontSize:u,lineHeight:r}=this.textSpec,i={width:0,height:0};if(o(t))return i;if(f(t)){const s=t.filter(a).map((t=>t.toString()));return 0===s.length?i:1===s.length?e(s[0]):{width:s.reduce(((t,n)=>Math.max(t,e(n).width)),0),height:s.length*((null!==(n=r)&&void 0!==n?n:u)+1)+1}}return e(t.toString())}_measureNumberChar(){if(o(this._numberCharSize)){const t=this._standardMethod(Oe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Oe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return o(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Oe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(o(this._letterCharSize)){const t=this._standardMethod(Oe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Oe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return a(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){a(this._canvas)&&(this._canvas=null),a(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Oe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Oe.NUMBERS_CHAR_SET="0123456789",Oe.FULL_SIZE_CHAR="字";function He(t,e,n){const{x1:u,y1:r,x2:i,y2:s}=e;return n.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(n.e,n.f),e):(t.clear(),t.add(n.a*u+n.c*r+n.e,n.b*u+n.d*r+n.f),t.add(n.a*i+n.c*r+n.e,n.b*i+n.d*r+n.f),t.add(n.a*i+n.c*s+n.e,n.b*i+n.d*s+n.f),t.add(n.a*u+n.c*s+n.e,n.b*u+n.d*s+n.f),e)}class Re{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Re(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,n=0,u=0){return this.x1=t,this.y1=e,this.x2=n,this.y2=u,this}set(t=0,e=0,n=0,u=0){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),u<e?(this.y2=e,this.y1=u):(this.y1=e,this.y2=u),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,n=0){const u=this.rotatedPoints(t,e,n);return this.clear().add(u[0],u[1]).add(u[2],u[3]).add(u[4],u[5]).add(u[6],u[7])}scale(t=0,e=0,n=0,u=0){const r=this.scalePoints(t,e,n,u);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 He(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,n){const{x1:u,y1:r,x2:i,y2:s}=this,o=Math.cos(t),a=Math.sin(t),D=e-e*o+n*a,h=n-e*a-n*o;return[o*u-a*r+D,a*u+o*r+h,o*u-a*s+D,a*u+o*s+h,o*i-a*r+D,a*i+o*r+h,o*i-a*s+D,a*i+o*s+h]}scalePoints(t,e,n,u){const{x1:r,y1:i,x2:s,y2:o}=this;return[t*r+(1-t)*n,e*i+(1-e)*u,t*s+(1-t)*n,e*o+(1-e)*u]}}class We extends Re{constructor(t,e=0){var n;super(t),t&&(this.angle=null!==(n=t.angle)&&void 0!==n?n:e)}intersects(t){return se(this,t)}setValue(t=0,e=0,n=0,u=0,r=0){return super.setValue(t,e,n,u),this.angle=r,this}clone(){return new We(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ue({x:this.x1,y:this.y1},this.angle,t),ue({x:this.x2,y:this.y1},this.angle,t),ue({x:this.x1,y:this.y2},this.angle,t),ue({x:this.x2,y:this.y2},this.angle,t)]}}class ze{constructor(t=1,e=0,n=0,u=1,r=0,i=0){this.a=t,this.b=e,this.c=n,this.d=u,this.e=r,this.f=i}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,n,u,r,i){return!(this.e!==r||this.f!==i||this.a!==t||this.d!==u||this.b!==e||this.c!==n)}setValue(t,e,n,u,r,i){return this.a=t,this.b=e,this.c=n,this.d=u,this.e=r,this.f=i,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,n=this.c,u=this.d,r=this.e,i=this.f,s=new ze,o=t*u-e*n;return s.a=u/o,s.b=-e/o,s.c=-n/o,s.d=t/o,s.e=(n*i-u*r)/o,s.f=-(t*i-e*r)/o,s}rotate(t){const e=Math.cos(t),n=Math.sin(t),u=this.a*e+this.c*n,r=this.b*e+this.d*n,i=this.a*-n+this.c*e,s=this.b*-n+this.d*e;return this.a=u,this.b=r,this.c=i,this.d=s,this}rotateByCenter(t,e,n){const u=Math.cos(t),r=Math.sin(t),i=(1-u)*e+r*n,s=(1-u)*n-r*e,o=u*this.a-r*this.b,a=r*this.a+u*this.b,D=u*this.c-r*this.d,h=r*this.c+u*this.d,l=u*this.e-r*this.f+i,c=r*this.e+u*this.f+s;return this.a=o,this.b=a,this.c=D,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,n,u,r,i){return this.multiply(t,e,n,u,r,i),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:n,d:u,e:r,f:i}=this;return this.a=e,this.b=t,this.c=u,this.d=n,this.e=i,this.f=r,this}multiply(t,e,n,u,r,i){const s=this.a,o=this.b,a=this.c,D=this.d,h=s*t+a*e,l=o*t+D*e,c=s*n+a*u,f=o*n+D*u,F=s*r+a*i+this.e,d=o*r+D*i+this.f;return this.a=h,this.b=l,this.c=c,this.d=f,this.e=F,this.f=d,this}interpolate(t,e){const n=new ze;return n.a=this.a+(t.a-this.a)*e,n.b=this.b+(t.b-this.b)*e,n.c=this.c+(t.c-this.c)*e,n.d=this.d+(t.d-this.d)*e,n.e=this.e+(t.e-this.e)*e,n.f=this.f+(t.f-this.f)*e,n}transformPoint(t,e){const{a:n,b:u,c:r,d:i,e:s,f:o}=this,a=n*i-u*r,D=i/a,h=-u/a,l=-r/a,c=n/a,f=(r*o-i*s)/a,F=-(n*o-u*s)/a,{x:d,y:m}=t;e.x=d*D+m*l+f,e.y=d*h+m*c+F}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ze(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,n=this.c,u=this.d,r=t*u-e*n,i={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);i.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),i.scaleX=s,i.scaleY=r/s,i.skewX=(t*n+e*u)/r,i.skewY=0}else if(0!==n||0!==u){const s=Math.sqrt(n*n+u*u);i.rotateDeg=Math.PI/2-(u>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=r/s,i.scaleY=s,i.skewX=0,i.skewY=(t*n+e*u)/r}return i.rotateDeg=qt(i.rotateDeg),i}}function je(t,e,n){e/=100,n/=100;const u=(1-Math.abs(2*n-1))*e,r=u*(1-Math.abs(t/60%2-1)),i=n-u/2;let s=0,o=0,a=0;return 0<=t&&t<60?(s=u,o=r,a=0):60<=t&&t<120?(s=r,o=u,a=0):120<=t&&t<180?(s=0,o=u,a=r):180<=t&&t<240?(s=0,o=r,a=u):240<=t&&t<300?(s=r,o=0,a=u):300<=t&&t<360&&(s=u,o=0,a=r),s=Math.round(255*(s+i)),o=Math.round(255*(o+i)),a=Math.round(255*(a+i)),{r:s,g:o,b:a}}function qe(t,e,n){t/=255,e/=255,n/=255;const u=Math.min(t,e,n),r=Math.max(t,e,n),i=r-u;let s=0,o=0,a=0;return s=0===i?0:r===t?(e-n)/i%6:r===e?(n-t)/i+2:(t-e)/i+4,s=Math.round(60*s),s<0&&(s+=360),a=(r+u)/2,o=0===i?0:i/(1-Math.abs(2*a-1)),o=+(100*o).toFixed(1),a=+(100*a).toFixed(1),{h:s,s:o,l:a}}const Ye=/^#([0-9a-f]{3,8})$/,Ge={transparent:4294967040},Ve={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 $e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Xe(t){return m(t)?new tn(t>>16,t>>8&255,255&t,1):f(t)?new tn(t[0],t[1],t[2]):new tn(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const n=Ye.exec(t);if(e||n){const t=parseInt(n[1],16),e=n[1].length;return 3===e?new tn((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Xe(t):8===e?new tn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t,e=1){return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const n=t instanceof Ke?t:new Ke(t);switch(e){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3();case"wcag":return n.getLuminanceWCAG()}}static parseColorString(t){if(a(Ge[t]))return function(t){return m(t)?new tn(t>>>24,t>>>16&255,t>>>8&255,255&t):f(t)?new tn(t[0],t[1],t[2],t[3]):new tn(255,255,255,1)}(Ge[t]);if(a(Ve[t]))return Xe(Ve[t]);const e=`${t}`.trim().toLowerCase(),n=Qe(e);if(void 0!==n)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new tn(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(","),n=je(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new tn(n.r,n.g,n.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new tn(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:n,b:u}=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(n*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(u*t))),this}add(t){const{r:e,g:n,b:u}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,n+t.color.g),this.color.b+=Math.min(255,u+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:n,b:u}=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(n*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(u*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,n){const u=this.color.opacity,r=qe(this.color.r,this.color.g,this.color.b),i=je(o(t)?r.h:Q(t,0,360),o(e)?r.s:e>=0&&e<=1?100*e:e,o(n)?r.l:n<=1&&n>=0?100*n:n);return this.color=new tn(i.r,i.g,i.b,u),this}setRGB(t,e,n){return!o(t)&&(this.color.r=t),!o(e)&&(this.color.g=e),!o(n)&&(this.color.b=n),this}setHex(t){const e=`${t}`.trim().toLowerCase(),n=Qe(e,!0);return null!=n?n:this}setColorName(t){const e=Ve[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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,n=this.color.b/255;let u,r,i;u=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),r=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),i=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*u+.7152*r+.0722*i}clone(){return new Ke(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 n=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,n),this.color.g=Math.pow(t.color.g,n),this.color.b=Math.pow(t.color.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class tn{constructor(t,e,n,u){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(+n)?255:Math.max(0,Math.min(255,+n)),a(u)?this.opacity=isNaN(+u)?1:Math.max(0,Math.min(1,+u)):this.opacity=1}formatHex(){return`#${$e(this.r)+$e(this.g)+$e(this.b)+(1===this.opacity?"":$e(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:n,l:u}=qe(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${n}%,${u}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function en(t){let e="",n="",u="";const r="#"===t[0]?1:0;for(let i=r;i<t.length;i++)"#"!==t[i]&&(i<r+2?e+=t[i]:i<r+4?n+=t[i]:i<r+6&&(u+=t[i]));return[parseInt(e,16),parseInt(n,16),parseInt(u,16)]}function nn(t,e,n){return Number((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}function un(t,e){const n=t.r,u=e.r,r=t.g,i=e.g,s=t.b,o=e.b,a=t.opacity,D=e.opacity;return t=>{const e=Math.round(n*(1-t)+u*t),h=Math.round(r*(1-t)+i*t),l=Math.round(s*(1-t)+o*t);return new tn(e,h,l,a*(1-t)+D*t)}}var rn=Object.freeze({__proto__:null,Color:Ke,DEFAULT_COLORS:Ve,RGB:tn,hexToRgb:en,hslToRgb:je,interpolateRgb:un,rgbToHex:nn,rgbToHsl:qe});function sn(t){return t?"getUTCFullYear":"getFullYear"}function on(t){return t?"getUTCMonth":"getMonth"}function an(t){return t?"getUTCDate":"getDate"}function Dn(t){return t?"getUTCHours":"getHours"}function hn(t){return t?"getUTCMinutes":"getMinutes"}function ln(t){return t?"getUTCSeconds":"getSeconds"}function cn(t){return t?"getUTCMilliseconds":"getMilliseconds"}const fn=1e3,Fn=6e4,dn=36e5,mn=24*dn,gn=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),pn=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),yn=(t,e)=>e.getFullYear()-t.getFullYear(),Cn=t=>t.getFullYear(),xn=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),En=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Mn=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),bn=t=>t.getUTCFullYear(),Bn=t=>(t.setDate(1),t.setHours(0,0,0,0),t),vn=(t,e)=>(t.setMonth(t.getMonth()+e),t),An=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),wn=t=>t.getMonth(),Sn=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),Tn=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),_n=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Ln=t=>t.getUTCMonth(),Nn=t=>(t.setHours(0,0,0,0),t),kn=(t,e)=>(t.setDate(t.getDate()+e),t),In=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fn)/mn,Un=t=>t.getDate()-1,Pn=t=>(t.setUTCHours(0,0,0,0),t),On=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Hn=(t,e)=>(+e-+t)/mn,Rn=t=>t.getUTCDate()-1,Wn=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*fn-t.getMinutes()*Fn),t),zn=(t,e)=>(t.setHours(t.getHours()+e),t),jn=(t,e)=>(+e-+t)/dn,qn=t=>t.getHours(),Yn=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*fn-t.getUTCMinutes()*Fn),t),Gn=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Vn=t=>t.getUTCHours(),$n=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*fn),t),Xn=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Zn=(t,e)=>(+e-+t)/Fn,Jn=t=>t.getMinutes(),Qn=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*fn),t),Kn=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),tu=t=>t.getUTCMinutes(),eu=t=>(t.setTime(+t-t.getMilliseconds()),t),nu=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),uu=(t,e)=>(+e-+t)/fn,ru=t=>t.getSeconds(),iu=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),su=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),ou=t=>t.getUTCSeconds(),au=t=>t,Du=(t,e)=>(t.setTime(+t+e),t),hu=(t,e)=>+e-+t,lu=(t,e)=>n=>{const u=new Date(+n-1);return e(u,1),t(u),u},cu=(t,e)=>(n,u)=>{const r=new Date,i=new Date;return r.setTime(+n),i.setTime(+u),t(r),t(i),Math.floor(e(r,i))};function fu(t){const{x:e,y:n}=t.getBoundingClientRect();return{x:e,y:n}}const Fu=t=>t.getBoundingClientRect().width/t.offsetWidth,du=t=>t.getBoundingClientRect().height/t.offsetHeight;var mu=6371008.8,gu={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*mu,kilometers:6371.0088,kilometres:6371.0088,meters:mu,metres:mu,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:mu/1852,radians:1,yards:6967335.223679999};const pu=1e-10;function yu(t,e){for(let n=0;n<e.length;++n)if(Wt.distancePP(t,e[n])>e[n].radius+pu)return!1;return!0}function Cu(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function xu(t,e){const n=Wt.distancePP(t,e),u=t.radius,r=e.radius;if(n>=u+r||n<=Math.abs(u-r))return[];const i=(u*u-r*r+n*n)/(2*n),s=Math.sqrt(u*u-i*i),o=t.x+i*(e.x-t.x)/n,a=t.y+i*(e.y-t.y)/n,D=-(e.y-t.y)*(s/n),h=-(e.x-t.x)*(s/n);return[{x:o+D,y:a-h},{x:o-D,y:a+h}]}function Eu(t){const e={x:0,y:0};for(let n=0;n<t.length;++n)e.x+=t[n].x,e.y+=t[n].y;return e.x/=t.length,e.y/=t.length,e}class Mu{static getInstance(){return Mu.instance||(Mu.instance=new Mu),Mu.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,n)=>{const u=this.shortWeekdayRe.exec(e.slice(n));return u?(t.w=this.shortWeekdayLookup.get(u[0].toLowerCase()),n+u[0].length):-1},this.parseWeekday=(t,e,n)=>{const u=this.weekdayRe.exec(e.slice(n));return u?(t.w=this.weekdayLookup.get(u[0].toLowerCase()),n+u[0].length):-1},this.parseShortMonth=(t,e,n)=>{const u=this.shortMonthRe.exec(e.slice(n));return u?(t.m=this.shortMonthLookup.get(u[0].toLowerCase()),n+u[0].length):-1},this.parseMonth=(t,e,n)=>{const u=this.monthRe.exec(e.slice(n));return u?(t.m=this.monthLookup.get(u[0].toLowerCase()),n+u[0].length):-1},this.parseDayOfMonth=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+2));return u?(t.d=+u[0],n+u[0].length):-1},this.parseHour24=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+2));return u?(t.H=+u[0],n+u[0].length):-1},this.parseMilliseconds=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+3));return u?(t.L=+u[0],n+u[0].length):-1},this.parseMonthNumber=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+2));return u?(t.m=u-1,n+u[0].length):-1},this.parseMinutes=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+2));return u?(t.M=+u[0],n+u[0].length):-1},this.parsePeriod=(t,e,n)=>{const u=this.periodRe.exec(e.slice(n));return u?(t.p=this.periodLookup.get(u[0].toLowerCase()),n+u[0].length):-1},this.parseSeconds=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+2));return u?(t.S=+u[0],n+u[0].length):-1},this.parseFullYear=(t,e,n)=>{const u=this.numberRe.exec(e.slice(n,n+4));return u?(t.y=+u[0],n+u[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,n){const u=t<0?"-":"",r=(u?-t:t)+"",i=r.length;return u+(i<n?new Array(n-i+1).join(e)+r:r)}parseSpecifier(t,e,n,u){let r=0;const i=e.length,s=n.length;let o,a;for(;r<i;){if(u>=s)return-1;if(o=e.charCodeAt(r++),37===o){if(o=e.charAt(r++),a=this.parses[o in this.pads?e.charAt(r++):o],!a||(u=a(t,n,u))<0)return-1}else if(o!==n.charCodeAt(u++))return-1}return u}newParse(t,e){const n=this;return function(u){const r=n.newDate(1900,void 0,1);return n.parseSpecifier(r,t,u+="",0)!==u.length?null:"Q"in r?new Date(r.Q):"s"in r?new Date(1e3*r.s+("L"in r?r.L:0)):(e&&!("Z"in r)&&(r.Z=0),"p"in r&&(r.H=r.H%12+12*r.p),void 0===r.m&&(r.m="q"in r?r.q:0),"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,n.utcDate(r)):n.localDate(r))}}newFormat(t,e){const n=this;return function(u){const r=[];let i=-1,s=0;const o=t.length;let a,D,h;for(u instanceof Date||(u=new Date(+u));++i<o;)37===t.charCodeAt(i)&&(r.push(t.slice(s,i)),(D=n.pads[a=t.charAt(++i)])?a=t.charAt(++i):D="e"===a?" ":"0",h=e[a],a=h(u,D),r.push(a),s=i+1);return r.push(t.slice(s,i)),r.join("")}}getFullTimeStamp(t){const e=parseInt(t+"",10);return 10===String(e).length?1e3*e:e}}function bu(t,e){const n=e?t.toExponential(e-1):t.toExponential(),u=n.indexOf("e");if(u<0)return null;const r=n.slice(0,u);return[r.length>1?r[0]+r.slice(2):r,+n.slice(u+1)]}let Bu;function vu(t,e){const n=bu(t,e);if(!n)return t+"";const u=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+u:u.length>r+1?u.slice(0,r+1)+"."+u.slice(r+1):u+new Array(r-u.length+2).join("0")}class Au{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const wu=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Su(t){let e;if(e=wu.exec(t))return new Au({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});W.getInstance().error("invalid format: "+t)}const Tu=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class _u{constructor(){var t,e;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(t=[...this.locale.grouping].map(Number),e=`${this.locale.thousands}`,function(n,u){let r=n.length;const i=[];let s=0,o=t[0],a=0;for(;r>0&&o>0&&(a+o+1>u&&(o=Math.max(1,u-a)),i.push(n.substring(r-=o,r+o)),!((a+=o+1)>u));)o=t[s=(s+1)%t.length];return i.reverse().join(e)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:ku([...this.locale.numerals].map(String)),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return _u.instance||(_u.instance=new _u),_u.instance}newFormat(t){const e=Su(t);let n=e.fill,u=e.align;const r=e.sign,i=e.symbol;let s=e.zero;const o=e.width;let a=e.comma,D=e.precision,h=e.trim,l=e.type;"n"===l?(a=!0,l="g"):Lu[l]||(void 0===D&&(D=12),h=!0,l="g"),(s||"0"===n&&"="===u)&&(s=!0,n="0",u="=");const c="$"===i?this.currencyPrefix:"#"===i&&/[boxX]/.test(l)?"0"+l.toLowerCase():"",f="$"===i?this.currencySuffix:/[%p]/.test(l)?this.percent:"",F=Lu[l],d=/[defgprstz%]/.test(l);D=void 0===D?6:/[gprs]/.test(l)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));const{nan:m,minus:g,decimal:p,group:y,numerals:C}=this;function x(t){let e,i,x,E=c,M=f,b=t;if("c"===l)M=F(b)+M,b="";else{b=+b;let t=b<0||1/b<0;if(b=isNaN(b)?m:F(Math.abs(b),D),h&&(b=function(t){const e=t.length;let n,u=-1;t:for(let r=1;r<e;++r)switch(t[r]){case".":u=n=r;break;case"0":0===u&&(u=r),n=r;break;default:if(!+t[r])break t;u>0&&(u=0)}return u>0?t.slice(0,u)+t.slice(n+1):t}(b)),t&&0==+b&&"+"!==r&&(t=!1),E=(t?"("===r?r:g:"-"===r||"("===r?"":r)+E,M=("s"===l?Tu[8+Bu/3]:"")+M+(t&&"("===r?")":""),d)for(e=-1,i=b.length;++e<i;)if(x=b.charCodeAt(e),48>x||x>57){M=(46===x?p+b.slice(e+1):b.slice(e))+M,b=b.slice(0,e);break}}a&&!s&&(b=y(b,1/0));let B=E.length+b.length+M.length,v=B<o?new Array(o-B+1).join(n):"";switch(a&&s&&(b=y(v+b,v.length?o-M.length:1/0),v=""),u){case"<":b=E+b+M+v;break;case"=":b=E+v+b+M;break;case"^":b=v.slice(0,B=v.length>>1)+E+b+M+v.slice(B);break;default:b=v+E+b+M}return C(b)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const n=Su(t);n.type="f";const u=this.newFormat(n.toString()),r=3*Math.max(-8,Math.min(8,Math.floor(Nu(e)/3))),i=Math.pow(10,-r),s=Tu[8+r/3];return function(t){return u(i*t)+s}}}const Lu={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>vu(100*t,e),r:vu,s:function(t,e){const n=bu(t,e);if(!n)return t+"";const u=n[0],r=n[1],i=r-(Bu=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,s=u.length;return i===s?u:i>s?u+new Array(i-s+1).join("0"):i>0?u.slice(0,i)+"."+u.slice(i):"0."+new Array(1-i).join("0")+bu(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Nu(t){const e=bu(Math.abs(t));return e?e[1]:NaN}function ku(t){return function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}}function Iu(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function Uu(t){return Math.sqrt(Ut(t,t))}function Pu(t,e,n){for(let u=0;u<e.length;++u)t[u]=e[u]*n}function Ou(t,e,n,u,r){for(let i=0;i<t.length;++i)t[i]=e*n[i]+u*r[i]}function Hu(t,e,n,u,r,i,s){const o=n.fx,a=Ut(n.fxprime,e);let D=o,h=o,l=a,c=0;function f(h,c,f){for(let F=0;F<16;++F)if(r=(h+c)/2,Ou(u.x,1,n.x,r,e),D=u.fx=t(u.x,u.fxprime),l=Ut(u.fxprime,e),D>o+i*r*a||D>=f)c=r;else{if(Math.abs(l)<=-s*a)return r;l*(c-h)>=0&&(c=h),h=r,f=D}return 0}r=r||1,i=i||1e-6,s=s||.1;for(let F=0;F<10;++F){if(Ou(u.x,1,n.x,r,e),D=u.fx=t(u.x,u.fxprime),l=Ut(u.fxprime,e),D>o+i*r*a||F&&D>=h)return f(c,r,h);if(Math.abs(l)<=-s*a)return r;if(l>=0)return f(r,c,D);h=D,c=r,r*=2}return r}t.AABBBounds=class extends Re{},t.Bounds=Re,t.Color=Ke,t.ColorUtil=rn,t.DAY=mn,t.DEFAULT_COLORS=Ve,t.EventEmitter=u,t.FormatSpecifier=Au,t.GraphicUtil=Ae,t.HOUR=dn,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const n=new yt;n.key=t,n.value=e;let u=this.itemList.length;return this.has(t)&&(u=this.items[t].index),n.index=u,this.itemList[u]=n,this.items[t]=n,n}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 n=this.itemList.indexOf(e);this.items[t].index=n}))}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,n){const u=new yt;u.index=t,u.key=n,u.value=e,this.itemList.splice(t,0,u),this.items[n]=u,this.resetIndex()}sort(t){return this.itemList.sort(((e,n)=>t(e.value,n.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=yt,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:n=this.CLEAN_THRESHOLD,L_TIME:u=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<n)return 0;let i=0;const s=e=>{i++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<r)return s(e);let n=0;for(;o-t.timestamp[t.timestamp.length-1-n]<u&&(n++,!(n>=r)););if(n<r)return s(e);for(;o-t.timestamp[0]>u;)t.timestamp.shift()})),i}addLimitedTimestamp(t,e,n){const{R_TIMESTAMP_MAX_SIZE:u=this.R_TIMESTAMP_MAX_SIZE}=n;t.timestamp.length>u&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:n=this.L_TIME}=e,u=Date.now();t.forEach((t=>{for(;u-t.timestamp[0]>n;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:n=this.L_TIME}=e,u=Date.now();for(;u-t.timestamp[0]>n;)t.timestamp.shift()}},t.Logger=W,t.MINUTE=Fn,t.MONTH=26784e5,t.Matrix=ze,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=_u,t.OBBBounds=We,t.Point=Rt,t.PointService=Wt,t.PolarPoint=zt,t.RGB=tn,t.SECOND=fn,t.SMALL=pu,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=Oe,t.TimeUtil=Mu,t.YEAR=31536e6,t.aabbSeparation=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),t.abs=Bt,t.acos=function(t){return t>1?0:t<-1?xt:Math.acos(t)},t.array=N,t.arrayEqual=function(t,e){if(!f(t)||!f(e))return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},t.ascending=I,t.asin=function(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)},t.atan2=vt,t.baseMerge=M,t.binaryFuzzySearch=(t,e)=>z(0,t.length,(n=>e(t[n]))),t.binaryFuzzySearchInNumberRange=z,t.bisect=function(t,e,n=0,u){for(o(u)&&(u=t.length);n<u;){const r=n+u>>>1;I(t[r],e)>0?u=r:n=r+1}return n},t.calculateAnchorOfArc=(t,e)=>{const{startAngle:n,endAngle:u,innerRadius:r,outerRadius:i}=t;let s=(n+u)/2,o=(r+i)/2;switch(e){case"inner-start":s=n,o=r;break;case"outer-start":s=n,o=i;break;case"inner-end":s=u,o=r;break;case"outer-end":s=u,o=i;break;case"inner-middle":o=r;break;case"outer-middle":o=i}return{angle:s,radius:o}},t.calculateAnchorOfBounds=(t,e)=>{const{x1:n,x2:u,y1:r,y2:i}=t,s=Math.abs(u-n),o=Math.abs(i-r);let a=(n+u)/2,D=(r+i)/2,h=0,l=0;switch(e){case"top":case"inside-top":l=-.5;break;case"bottom":case"inside-bottom":l=.5;break;case"left":case"inside-left":h=-.5;break;case"right":case"inside-right":h=.5;break;case"top-right":h=.5,l=-.5;break;case"top-left":h=-.5,l=-.5;break;case"bottom-right":h=.5,l=.5;break;case"bottom-left":h=-.5,l=.5}return a+=h*s,D+=l*o,{x:a,y:D}},t.calculateMaxRadius=function(t,e,n,u){const{x:r,y:i}=e,s=Zt(n,u),{width:o,height:a}=t,D=[];return s.forEach((t=>{const e=Math.sin(t),n=Math.cos(t);1===e?D.push(a-i):-1===e?D.push(i):1===n?D.push(o-r):-1===n?D.push(r):(e>0?D.push(Math.abs((a-i)/e)):D.push(Math.abs(i/e)),n>0?D.push(Math.abs((o-r)/n)):D.push(Math.abs(r/n)))})),Math.min.apply(null,D)},t.cartesianToPolar=function(t,e={x:0,y:0},n=0,u=2*Math.PI){const{x:r,y:i}=t,{x:s,y:o}=e;let a=r-s,D=i-o;const h=Math.sqrt(a*a+D*D);if(0===h)return{radius:0,angle:0};a/=h,D/=h;let l=Math.atan2(D,a);if(l<n)for(;l<=n;)l+=2*Math.PI;if(l>u)for(;l>=u;)l-=2*Math.PI;return{radius:h,angle:l}},t.circleArea=Cu,t.circleCircleIntersection=xu,t.circleOverlap=function(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const u=e-(n*n-t*t+e*e)/(2*n);return Cu(t,t-(n*n-e*e+t*t)/(2*n))+Cu(e,u)},t.clamp=Q,t.clampAngleByDegree=$t,t.clampAngleByRadian=Gt,t.clampDegree=Vt,t.clampRadian=Yt,t.clampRange=(t,e,n)=>{let[u,r]=t;r<u&&(u=t[1],r=t[0]);const i=r-u;return i>=n-e?[e,n]:(u=Math.min(Math.max(u,e),n-i),[u,u+i])},t.clamper=function(t,e){let n;return t>e&&(n=t,t=e,e=n),n=>Math.max(t,Math.min(e,n))},t.clone=function(t,e=!1,n=0,u=void 0){const r=[],i=[];return void 0===e&&(e=!0),void 0===n&&(n=1/0),function t(n,s){if(null===n)return null;if(0===s)return n;let o;if("object"!=typeof n)return n;if(f(n)?o=[]:p(n)?(o=new RegExp(n.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(n)),n.lastIndex&&(o.lastIndex=n.lastIndex)):o=d(n)?new Date(n.getTime()):void 0===u?Object.create(Object.getPrototypeOf(n)):Object.create(u),e){const t=r.indexOf(n);if(-1!==t)return i[t];r.push(n),i.push(o)}for(const e in n)o[e]=t(n[e],s-1);return o}(t,n)},t.cloneDeep=function t(e,n,u){let r;if(!a(e)||"object"!=typeof e||n&&n(e))return e;const s=f(e),o=e.length;r=s?new Array(o):"object"==typeof e?{}:i(e)||m(e)||c(e)?e:d(e)?new Date(+e):void 0;const D=s?void 0:Object.keys(Object(e));let h=-1;if(r)for(;++h<(D||e).length;){const i=D?D[h]:h,s=e[i];u&&u.includes(i.toString())?r[i]=s:r[i]=t(s,n,u)}return r},t.computeQuadrant=function(t){return(t=Xt(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1},t.conjugateGradient=function(t,e,n){let u={x:e.slice(),fx:0,fxprime:e.slice()},r={x:e.slice(),fx:0,fxprime:e.slice()};const i=e.slice();let s,o=1;const a=(n=n||{}).maxIterations||20*e.length;u.fx=t(u.x,u.fxprime);const D=u.fxprime.slice();Pu(D,u.fxprime,-1);for(let e=0;e<a;++e){if(o=Hu(t,D,u,r,o),n.history&&n.history.push({x:u.x.slice(),fx:u.fx,fxprime:u.fxprime.slice(),alpha:o}),o){Ou(i,1,r.fxprime,-1,u.fxprime);const t=Ut(u.fxprime,u.fxprime);Ou(D,Math.max(0,Ut(i,r.fxprime)/t),D,-1,r.fxprime),s=u,u=r,r=s}else Pu(D,u.fxprime,-1);if(Uu(u.fxprime)<=1e-5)break}return n.history&&n.history.push({x:u.x.slice(),fx:u.fx,fxprime:u.fxprime.slice(),alpha:o}),u},t.constant=t=>s(t)?t:()=>t,t.containedInCircles=yu,t.cos=At,t.crossProduct=kt,t.crossProductPoint=It,t.dateGetterName=an,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=In,t.dayField=Un,t.dayFloor=Nn,t.dayOffset=kn,t.debounce=tt,t.defaults=L,t.degreeToRadian=jt,t.destination=function(t,e,n,u={}){const r=jt(t[0]),i=jt(t[1]),s=jt(n),o=function(t,e){void 0===e&&(e="kilometers");var n=gu[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,u.units),a=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(s));return{x:qt(r+Math.atan2(Math.sin(s)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(a))),y:qt(a)}},t.deviation=function(t,e){const n=j(t,e);return n?Math.sqrt(n):n},t.dotProduct=Ut,t.eastAsianCharacterInfo=Ie,t.ecdf=function(t){const e=t.length,n=t.slice().sort(((t,e)=>t-e));function u(t){if(0===e)return 0;let u=0,r=e;for(;u<r;){const e=u+r>>>1;n[e]<=t?u=e+1:r=e}return u/e}return{evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(u(t[n]));return e}return u(t)},evaluateGrid:function(t){const r=[];if(t<=0)return r;if(0===e)return r;const i=n[0],s=n[e-1];if(i===s){for(let e=0;e<t;e++)r.push({x:i,y:1});return r}const o=(s-i)/(t-1);for(let e=0;e<t;e++){const n=e===t-1?s:i+o*e;r.push({x:n,y:u(n)})}return r},n:e}},t.epanechnikov=t=>Math.abs(t)<=1?.75*(1-t*t):0,t.epsilon=Ct,t.exponent=Nu,t.extent=(t,e)=>{const n=s(e)?e:t=>t;let u,r;if(t&&t.length){const e=t.length;for(let i=0;i<e;i+=1){let e=n(t[i]);o(e)||!m(e=+e)||Number.isNaN(e)||(o(u)?(u=e,r=e):(u=Math.min(u,e),r=Math.max(r,e)))}return[u,r]}return[u,r]},t.fakeRandom=()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])},t.field=(t,e={})=>{if(f(t)){const n=t.map((t=>at(t,e)));return t=>n.map((e=>e(t)))}return at(t,e)},t.findBoundaryAngles=Zt,t.findZeroOfFunction=function(t,e,n,u){var r,i;const s=null!==(r=null==u?void 0:u.maxIterations)&&void 0!==r?r:100,o=null!==(i=null==u?void 0:u.tolerance)&&void 0!==i?i:1e-10,a=t(e),D=t(n);let h=n-e;if(a*D>0){return W.getInstance().error("Initial bisect points must have opposite signs"),NaN}if(0===a)return e;if(0===D)return n;for(let n=0;n<s;++n){h/=2;const n=e+h,u=t(n);if(u*a>=0&&(e=n),Math.abs(h)<o||0===u)return n}return e+h},t.fixPrecision=Ot,t.flattenArray=function t(e){if(!f(e))return[e];const n=[];for(const u of e)n.push(...t(u));return n},t.formatNumerals=ku,t.formatSpecifier=Su,t.formatTypes=Lu,t.fullYearGetterName=sn,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return Bt(t-e)<Ct},t.fuzzyEqualVec=Pt,t.gaussian=mt,t.gemv=function(t,e,n){for(let u=0;u<t.length;++u)t[u]=Ut(e[u],n)},t.generateCeil=lu,t.generateCount=cu,t.generateStepInterval=(t,{floor:e,offset:n,field:u,count:r})=>{const i=Math.floor(t);if(!Number.isFinite(i)||i<=0)return null;if(i<=1)return{floor:e,offset:n,ceil:lu(e,n)};const s=cu(e,r),o=u?t=>u(t)%i==0:t=>s(0,t)%i==0,a=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},D=(t,e)=>{if(!Number.isNaN(+t))if(i<0)for(;++e<=0;)for(n(t,-1);!o(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!o(t);)n(t,1);return t};return{floor:a,offset:D,ceil:lu(a,D)}},t.get=x,t.getAABBFromPoints=function(t){return oe=1/0,ae=1/0,De=-1/0,he=-1/0,t.forEach((t=>{oe>t.x&&(oe=t.x),De<t.x&&(De=t.x),ae>t.y&&(ae=t.y),he<t.y&&(he=t.y)})),{x1:oe,y1:ae,x2:De,y2:he}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getCenter=Eu,t.getContainerSize=function(t,e=0,n=0){if(!t)return{width:e,height:n};let u;try{u=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){u=()=>({})}const r=u(t);if(/^(\d*\.?\d+)(px)$/.exec(r.width)){const u=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:u<=0?e:u,height:i<=0?n:i}}return{width:e,height:n}},t.getContextFont=Pe,t.getDecimalPlaces=Ht,t.getElementAbsolutePosition=fu,t.getElementRelativePosition=function(t,e){const n=fu(t),u=fu(e);return{x:n.x-u.x,y:n.y-u.y}},t.getFormatFromValue=function(t,e){const n=it(t),u=n[on(e)]()+1,r=n[an(e)](),i=n[Dn(e)](),s=n[hn(e)](),o=n[ln(e)](),a=0===n[cn(e)](),D=a&&0===o,h=D&&0===s,l=h&&0===i,c=l&&1===r;return c&&1===u?"YYYY":c?"YYYY-MM":l?"YYYY-MM-DD":h?"HH":D?"HH:mm":a?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,n,u){if(!Qt(t,e,n,u))return!1;const r=[0,0],i=[0,0],s=[0,0];if(Jt(r,e,t),Jt(i,u,n),Pt(r,i))return!0;Jt(s,n,t);const o=kt(s,i)/kt(r,i);return o>=0&&o<=1&&[t[0]+r[0]*o,t[1]+r[1]*o]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:xn,offset:En,count:Mn,field:bn}:"month"===t&&e?{floor:Sn,offset:Tn,count:_n,field:Ln}:"day"===t&&e?{floor:Pn,offset:On,count:Hn,field:Rn}:"hour"===t&&e?{floor:Yn,offset:Gn,count:jn,field:Vn}:"minute"===t&&e?{floor:Qn,offset:Kn,count:Zn,field:tu}:"second"===t&&e?{floor:iu,offset:su,count:uu,field:ou}:"year"===t?{floor:gn,offset:pn,count:yn,field:Cn}:"month"===t?{floor:Bn,offset:vn,count:An,field:wn}:"day"===t?{floor:Nn,offset:kn,count:In,field:Un}:"hour"===t?{floor:Wn,offset:zn,count:jn,field:qn}:"minute"===t?{floor:$n,offset:Xn,count:Zn,field:Jn}:"second"===t?{floor:eu,offset:nu,count:uu,field:ru}:{floor:au,offset:Du,count:hu},t.getOBBFromLine=function(t,e,n){return le=e.x-t.x,ce=e.y-t.y,fe=ce,Fe=-le,ge=de=Math.sqrt(fe*fe+Fe*Fe),pe=n,fe/=de,Fe/=de,me=n/2,le=me*fe,ce=me*Fe,{point1:{x:t.x+le,y:t.y+ce},point2:{x:t.x-le,y:t.y-ce},point3:{x:e.x+le,y:e.y+ce},point4:{x:e.x-le,y:e.y-ce},width:ge,height:pe,left:Math.min(t.x,e.x)-Math.abs(le),top:Math.min(t.y,e.y)-Math.abs(ce)}},t.getRectIntersect=function(t,e,n){if(null===t)return e;if(null===e)return t;const{x11:u,x12:r,y11:i,y12:s,x21:o,x22:a,y21:D,y22:h}=te(t,e,n);return u>=a||r<=o||i>=h||s<=D?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(u,o),y1:Math.max(i,D),x2:Math.min(r,a),y2:Math.min(s,h)}},t.getScale=t=>t.offsetWidth>0?Fu(t):du(t),t.getScaleX=Fu,t.getScaleY=du,t.getScrollLeft=t=>{var e,n,u;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(u=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===u?void 0:u.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,n,u;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(u=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===u?void 0:u.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTimeFormatter=function(t,e){return n=>{const u=it(n),r=u[sn(e)](),i=u[on(e)]()+1,s=Math.floor((i-1)/3)+1,o=u[an(e)](),a=u["get"+(e?"UTC":"")+"Day"](),D=u[Dn(e)](),h=(D-1)%12+1,l=u[hn(e)](),c=u[ln(e)](),f=u[cn(e)]();return(t||"").replace(/YYYY/g,J(r+"",4,"0","left")).replace(/yyyy/g,r+"").replace(/yy/g,r%100+"").replace(/Q/g,s+"").replace(/MM/g,J(i,2,"0","left")).replace(/M/g,i+"").replace(/dd/g,J(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,a+"").replace(/HH/g,J(D,2,"0","left")).replace(/H/g,D+"").replace(/hh/g,J(h+"",2,"0","left")).replace(/h/g,h+"").replace(/mm/g,J(l,2,"0","left")).replace(/m/g,l+"").replace(/ss/g,J(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,J(f,3,"0","left")).replace(/S/g,f+"")}},t.getter=ot,t.halfPi=Et,t.has=(t,e)=>null!=t&&E.call(t,e),t.hasParentElement=function(t,e){let n=t.parentNode;for(;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},t.hexToRgb=en,t.hourCount=jn,t.hourField=qn,t.hourFloor=Wn,t.hourOffset=zn,t.hoursGetterName=Dn,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=je,t.interpolateDate=function(t,e){const n=t.valueOf(),u=e.valueOf(),r=new Date;return t=>(r.setTime(n*(1-t)+u*t),r)},t.interpolateNumber=et,t.interpolateNumberRound=function(t,e){return function(n){return Math.round(t*(1-n)+e*n)}},t.interpolateRgb=un,t.interpolateString=function(t,e){let n,u,r,i=nt.lastIndex=ut.lastIndex=0,s=-1;const o=[],a=[];for(t+="",e+="";(n=nt.exec(t))&&(u=ut.exec(e));)(r=u.index)>i&&(r=e.slice(i,r),o[s]?o[s]+=r:o[++s]=r),(n=n[0])===(u=u[0])?o[s]?o[s]+=u:o[++s]=u:(o[++s]=null,a.push({i:s,x:et(n,u)})),i=ut.lastIndex;return i<e.length&&(r=e.slice(i),o[s]?o[s]+=r:o[++s]=r),o.length<2?a[0]?function(t){return function(e){return t(e)+""}}(a[0].x):function(t){return function(){return t}}(e):(e=a.length,function(t){for(let n,u=0;u<e;++u)o[(n=a[u]).i]=n.x(t);return o.join("")})},t.intersectionArea=function(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let u=n+1;u<t.length;++u){const r=xu(t[n],t[u]);for(let t=0;t<r.length;++t){const i=r[t];i.parentIndex=[n,u],e.push(i)}}return e}(t),u=n.filter((function(e){return yu(e,t)}));let r=0,i=0;const s=[];if(u.length>1){const e=Eu(u);for(let t=0;t<u.length;++t){const n=u[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}u.sort((function(t,e){return e.angle-t.angle}));let n=u[u.length-1];for(let e=0;e<u.length;++e){const o=u[e];i+=(n.x+o.x)*(o.y-n.y);const a={x:(o.x+n.x)/2,y:(o.y+n.y)/2};let D=null;for(let e=0;e<o.parentIndex.length;++e)if(n.parentIndex.indexOf(o.parentIndex[e])>-1){const u=t[o.parentIndex[e]],r=Math.atan2(o.x-u.x,o.y-u.y),i=Math.atan2(n.x-u.x,n.y-u.y);let s=i-r;s<0&&(s+=2*Math.PI);const h=i-s/2;let l=Wt.distancePP(a,{x:u.x+u.radius*Math.sin(h),y:u.y+u.radius*Math.cos(h)});l>2*u.radius&&(l=2*u.radius),(null===D||D.width>l)&&(D={circle:u,width:l,p1:o,p2:n})}null!==D&&(s.push(D),r+=Cu(D.circle.radius,D.width),n=o)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let u=0;u<t.length;++u)if(Wt.distancePP(t[u],e)>Math.abs(e.radius-t[u].radius)){n=!0;break}n?r=i=0:(r=e.radius*e.radius*Math.PI,s.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-pu,y:e.y+e.radius},width:2*e.radius}))}return i/=2,e&&(e.area=r+i,e.arcArea=r,e.polygonArea=i,e.arcs=s,e.innerPoints=u,e.intersectionPoints=n),r+i},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=i,t.isDate=d,t.isEmpty=function(t){if(o(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(C.call(t,e))return!1;return!0},t.isEqual=function t(e,n,u){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(null==e||null==n)return!1;if(Number.isNaN(e)&&Number.isNaN(n))return!0;if(A(e)!==A(n))return!1;if(s(e))return!!(null==u?void 0:u.skipFunction);if("object"!=typeof e)return!1;if(f(e)){if(e.length!==n.length)return!1;for(let r=e.length-1;r>=0;r--)if(!t(e[r],n[r],u))return!1;return!0}if(!l(e))return!1;const r=w(e),i=w(n);if(r.length!==i.length)return!1;r.sort(),i.sort();for(let t=r.length-1;t>=0;t--)if(r[t]!=i[t])return!1;for(let i=r.length-1;i>=0;i--){const s=r[i];if(!t(e[s],n[s],u))return!1}return!0},t.isFunction=s,t.isGreater=function(t,e,n,u){return t>e&&!X(t,e,n,u)},t.isHTMLElement=function(t){try{return t instanceof Element}catch(e){const n=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],u=Object.keys(t);return n.every((t=>u.includes(t)))}},t.isIntersect=Qt,t.isLess=function(t,e,n,u){return t<e&&!X(t,e,n,u)},t.isNil=o,t.isNull=t=>null===t,t.isNumber=m,t.isNumberClose=X,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=D,t.isObjectLike=h,t.isPlainObject=l,t.isPointInLine=_e,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const n="Feature"===(u=e).type?u.geometry:u;var u;const r=n.type,i=e.bbox;let s=n.coordinates;if(i&&!0===ee(t,{x1:i[0],x2:i[1],y1:i[1],y2:i[3]},!0))return!1;"Polygon"===r&&(s=[s]);let o=!1;for(let e=0;e<s.length;++e)for(let n=0;n<s[e].length;++n){if(Te(s[e][n].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o}return o},t.isRectIntersect=function(t,e,n){if(t&&e){if(!n)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:u,x12:r,y11:i,y12:s,x21:o,x22:a,y21:D,y22:h}=te(t,e,!0);return!(u>a||r<o||i>h||s<D)}return!0},t.isRegExp=p,t.isRotateAABBIntersect=se,t.isShallowEqual=function(t,e){if(S(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(T(t)!==T(e))return!1;let n=!0;return Object.keys(t).forEach((u=>!!S(t[u],e[u])||(n=!1,n))),n},t.isString=c,t.isType=r,t.isUndefined=t=>void 0===t,t.isValid=a,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.kde=function(t,e={}){const n=t.length,u=e.kernel||mt;let r=e.bandwidth;if(!r||r<=0){const u=function(t){const e=t.length;if(0===e)return 0;let n=0;for(let u=0;u<e;u++)n+=t[u];n/=e;let u=0;for(let r=0;r<e;r++){const e=t[r]-n;u+=e*e}return Math.sqrt(u/e)}(t)||0,i=e.bandwidthMethod||"scott";r="silverman"===i?pt(n,u,1):gt(n,u,1)}if(!r||r<=0){const e=e=>{const u=[];if(e<=0)return u;let r=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<r&&(r=n),n>i&&(i=n)}if(r===1/0||i===-1/0){for(let t=0;t<e;t++)u.push({x:0,y:0});return u}for(let t=0;t<e;t++)u.push({x:r,y:0});return u};return{bandwidth:0,kernel:u,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(0);return e}return 0},evaluateGrid:e}}const i=1/(n*r);function s(e){let s=0;for(let i=0;i<n;i++)s+=u((e-t[i])/r);return s*i}return{bandwidth:r,kernel:u,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(s(t[n]));return e}return s(t)},evaluateGrid(e){const u=[];if(e<=0)return u;let r=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<r&&(r=n),n>i&&(i=n)}if(r===1/0||i===-1/0)return u;if(r===i){for(let t=0;t<e;t++)u.push({x:r,y:s(r)});return u}const o=(i-r)/(e-1);for(let t=0;t<e;t++){const n=t===e-1?i:r+o*t;u.push({x:n,y:s(n)})}return u}}},t.keys=_,t.last=k,t.lengthFromPointToLine=Nt,t.lineIntersectPolygon=Se,t.lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=wt,t.maxInArray=(t,e)=>{var n;if(0===t.length)return;let u=t[0];for(let r=1;r<t.length;r++){const i=t[r];(null!==(n=null==e?void 0:e(i,u))&&void 0!==n?n:i-u)>0&&(u=i)}return u},t.median=(t,e)=>{let n=t;return!0!==e&&(n=t.sort(I)),P(n,.5)},t.memoize=t=>{let e=null,n=null;return(...u)=>(e&&u.every(((t,n)=>t===e[n]))||(e=u,n=t(...u)),n)},t.merge=function(t,...e){let n=-1;const u=e.length;for(;++n<u;){M(t,e[n],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(n,u){const r=[];u.forEach((t=>{let e;(e=ye(n,t)).length>1?r.push(t):n=e[0]})),e.push(n),r.length&&t(r[0],r.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=hu,t.millisecondsFloor=au,t.millisecondsGetterName=cn,t.millisecondsOffset=Du,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=St,t.minInArray=(t,e)=>{var n;if(0===t.length)return;let u=t[0];for(let r=1;r<t.length;r++){const i=t[r];(null!==(n=null==e?void 0:e(i,u))&&void 0!==n?n:i-u)<0&&(u=i)}return u},t.minuteCount=Zn,t.minuteField=Jn,t.minuteFloor=$n,t.minuteOffset=Xn,t.minutesGetterName=hn,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,n=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const u=Object.getOwnPropertyNames(e);for(let r=0;r<u.length;r++){const i=u[r];"constructor"!==i&&(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}}else L(t,e,n)},t.monthCount=An,t.monthField=wn,t.monthFloor=Bn,t.monthGetterName=on,t.monthOffset=vn,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=function(t,e,n){const u=(n=n||{}).maxIterations||200*e.length,r=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,s=n.minErrorDelta||1e-6,o=n.minErrorDelta||1e-5,a=void 0!==n.rho?n.rho:1,D=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,l=void 0!==n.sigma?n.sigma:.5;let c;const f=e.length,F=new Array(f+1);F[0]=e,F[0].fx=t(e),F[0].id=0;for(let n=0;n<f;++n){const u=e.slice();u[n]=u[n]?u[n]*r:i,F[n+1]=u,F[n+1].fx=t(u),F[n+1].id=n+1}function d(t){for(let e=0;e<t.length;e++)F[f][e]=t[e];F[f].fx=t.fx}const m=function(t,e){return t.fx-e.fx},g=e.slice(),p=e.slice(),y=e.slice(),C=e.slice();for(let e=0;e<u;++e){if(F.sort(m),n.history){const t=F.map((function(t){const e=t.slice();return e.fx=t.fx,e.id=t.id,e}));t.sort((function(t,e){return t.id-e.id})),n.history.push({x:F[0].slice(),fx:F[0].fx,simplex:t})}c=0;for(let t=0;t<f;++t)c=Math.max(c,Math.abs(F[0][t]-F[1][t]));if(Math.abs(F[0].fx-F[f].fx)<s&&c<o)break;for(let t=0;t<f;++t){g[t]=0;for(let e=0;e<f;++e)g[t]+=F[e][t];g[t]/=f}const e=F[f];if(Ou(p,1+a,g,-a,e),p.fx=t(p),p.fx<F[0].fx)Ou(C,1+D,g,-D,e),C.fx=t(C),C.fx<p.fx?d(C):d(p);else if(p.fx>=F[f-1].fx){let n=!1;if(p.fx>e.fx?(Ou(y,1+h,g,-h,e),y.fx=t(y),y.fx<e.fx?d(y):n=!0):(Ou(y,1-h*a,g,h*a,e),y.fx=t(y),y.fx<p.fx?d(y):n=!0),n){if(l>=1)break;for(let e=1;e<F.length;++e)Ou(F[e],1-l,F[0],l,F[e]),F[e].fx=t(F[e])}}else d(p)}return F.sort(m),{fx:F[0].fx,x:F[0]}},t.norm2=Uu,t.normalTransform=function(t,e,n,u,r,i,s,o){const a=e.a,D=e.b,h=e.c,l=e.d,c=e.e,f=e.f,F=At(s),d=Tt(s);let m,g;o?(m=o[0],g=o[1]):(m=n,g=u);const p=m-n,y=g-u,C=a*F+h*d,x=D*F+l*d,E=h*F-a*d,M=l*F-D*d;t.a=r*C,t.b=r*x,t.c=i*E,t.d=i*M,t.e=c+a*m+h*g-C*p-E*y,t.f=f+D*m+l*g-x*p-M*y},t.normalizeAngle=Xt,t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(f(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,n]=t;return[e,n,e,n]}if(3===e){const[e,n,u]=t;return[e,n,u,n]}if(4===e)return t}if(D(t)){const{top:e=0,right:n=0,bottom:u=0,left:r=0}=t;return[e,n,u,r]}return[0,0,0,0]},t.numberSpecifierReg=wu,t.obbSeparation=(t,e)=>{const n=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function u(t,e,n){const u=t.getRotatedCorners().map((t=>t.x*e+t.y*n));return{min:Math.min(...u),max:Math.max(...u)}}let r=0;for(const i of n){const n=u(t,i.x,i.y),s=u(e,i.x,i.y);let o;o=n.max<s.min?s.min-n.max:s.max<n.min?n.min-s.max:0,r=Math.max(r,o)}return r},t.ordinaryLeastSquares=ct,t.pad=J,t.parseUint8ToImageData=(t,e,n)=>{const u=new Uint8ClampedArray(t),r=new Uint8ClampedArray(t.length);for(let t=n-1;t>=0;t--)for(let i=0;i<e;i++){const s=t*e*4+4*i,o=(n-t)*e*4+4*i;r[o]=u[s],r[o+1]=u[s+1],r[o+2]=u[s+2],r[o+3]=u[s+3]}return new ImageData(r,e,n)},t.pi=xt,t.pi2=bt,t.pick=function(t,e){if(!t||!l(t))return t;const n={};return e.forEach((e=>{v.call(t,e)&&(n[e]=t[e])})),n},t.pickWithout=function(t,e){if(!t||!l(t))return t;const n={};return Object.keys(t).forEach((u=>{const r=t[u];let i=!1;e.forEach((t=>{(c(t)&&t===u||t instanceof RegExp&&u.match(t))&&(i=!0)})),i||(n[u]=r)})),n},t.pointAt=function(t,e,n,u,r){let i=n,s=u;return"number"==typeof t&&"number"==typeof n&&(i=(1-r)*t+r*n),"number"==typeof e&&"number"==typeof u&&(s=(1-r)*e+r*u),{x:i,y:s}},t.pointBetweenLine=ve,t.pointInAABB=function(t,e){return ee(t,e,!1)},t.pointInLine=Ee,t.pointInOBB=function(t,e){return Ce.x=(e.point1.x+e.point2.x)/2,Ce.y=(e.point1.y+e.point2.y)/2,xe.x=(e.point3.x+e.point4.x)/2,xe.y=(e.point3.y+e.point4.y)/2,Ee(t,Ce,xe,e.height)},t.pointInRect=ee,t.polarToCartesian=function(t,e,n){return e?{x:t.x+e*Math.cos(n),y:t.y+e*Math.sin(n)}:{x:t.x,y:t.y}},t.polygonContainPoint=Te,t.polygonIntersectPolygon=function(t,e){for(let n=0;n<e.length;n++){if(Te(t,e[n].x,e[n].y))return!0;if(n>0&&Se(e[n-1].x,e[n-1].y,e[n].x,e[n].y,t))return!0}return!1},t.pow=Lt,t.precisionAdd=function(t,e){return Ot(t+e,10**Math.max(Ht(t),Ht(e)))},t.precisionSub=function(t,e){return Ot(t-e,10**Math.max(Ht(t),Ht(e)))},t.quantileSorted=P,t.rSquared=Ft,t.radianToDegree=qt,t.randomLCG=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%st)/st},t.range=function(t,e,n){a(e)||(e=t,t=0),a(n)||(n=1);let u=-1;const r=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(r);for(;++u<r;)i[u]=t+u*n;return i},t.rectInsideAnotherRect=function(e,n,u){if(!e||!n)return t.InnerBBox.NONE;const{x11:r,x12:i,y11:s,y12:o,x21:a,x22:D,y21:h,y22:l}=te(e,n,u);return r>a&&i<D&&s>h&&o<l?t.InnerBBox.BBOX1:a>r&&D<i&&h>s&&l<o?t.InnerBBox.BBOX2:t.InnerBBox.NONE},t.regressionLinear=function(t,e=(t=>t.x),n=(t=>t.y),u){var r;const i=null!==(r=null==u?void 0:u.alpha)&&void 0!==r?r:.05;let s=0,o=0,a=0,D=0,h=0;ft(t,e,n,((t,e)=>{s++,o+=(t-o)/s,a+=(e-a)/s,D+=(t*e-D)/s,h+=(t*t-h)/s}));const{a:l,b:c}=ct(o,a,D,h),f=t=>l+c*t,F=ht(t,e,n,f);return{coef:{a:l,b:c},predict:f,rSquared:Ft(t,e,n,a,f),evaluateGrid:function(t){const e=[];if(0===F.n||t<=0)return e;if(F.min===F.max){for(let n=0;n<t;n++)e.push({x:F.min,y:f(F.min)});return e}const n=(F.max-F.min)/(t-1);for(let u=0;u<t;u++){const r=u===t-1?F.max:F.min+n*u;e.push({x:r,y:f(r)})}return e},confidenceInterval:function(t=50){const e=[];if(0===F.n||t<=0)return e;const n=Dt(1-i/2);if(F.min===F.max){const u=f(F.min),r=lt(F.min,F);for(let i=0;i<t;i++)e.push({x:F.min,mean:u,lower:u-n*r.seMean,upper:u+n*r.seMean,predLower:u-n*r.sePred,predUpper:u+n*r.sePred});return e}const u=(F.max-F.min)/(t-1);for(let r=0;r<t;r++){const i=r===t-1?F.max:F.min+u*r,s=f(i),o=lt(i,F);e.push({x:i,mean:s,lower:s-n*o.seMean,upper:s+n*o.seMean,predLower:s-n*o.sePred,predUpper:s+n*o.sePred})}return e}}},t.regressionLogistic=function(t,e=(t=>t.x),n=(t=>t.y),u){var r,i,s;const o=null!==(r=null==u?void 0:u.maxIteration)&&void 0!==r?r:25,a=null!==(i=null==u?void 0:u.tol)&&void 0!==i?i:1e-6,D=null!==(s=null==u?void 0:u.alpha)&&void 0!==s?s:.05,h=[],l=[];ft(t,e,n,((t,e)=>{h.push(t),l.push(e?1:0)}));const c=h.length;if(0===c)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let f=0,F=0;for(let t=0;t<o;t++){const t=new Array(c);let e=!0;for(let e=0;e<c;e++){const n=f+F*h[e],u=1/(1+Math.exp(-n));t[e]=u}let n=0,u=0,r=0,i=0,s=0;for(let e=0;e<c;e++){const o=t[e]*(1-t[e]),a=l[e]-t[e];n+=a,u+=a*h[e],r+=o,i+=o*h[e],s+=o*h[e]*h[e]}const o=r*s-i*i;if(Math.abs(o)<1e-12)break;const D=(s*n-i*u)/o,d=(-i*n+r*u)/o;if(f+=D,F+=d,(Math.abs(D)>a||Math.abs(d)>a)&&(e=!1),e)break}const d=t=>{const e=f+F*t;return 1/(1+Math.exp(-e))};return{coef:[f,F],predict:d,evaluateGrid:function(u){const r=[];if(u<=0)return r;let i=1/0,s=-1/0;if(ft(t,e,n,(t=>{t<i&&(i=t),t>s&&(s=t)})),i===1/0||s===-1/0)return r;if(i===s){const t=d(i);for(let e=0;e<u;e++)r.push({x:i,y:t});return r}const o=(s-i)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?s:i+o*t;r.push({x:e,y:d(e)})}return r},confidenceInterval:function(u=50){const r=[];if(u<=0)return r;const i=ht(t,e,n,d);if(0===i.n)return r;const s=Math.abs(Dt(1-D/2));if(i.min===i.max){const t=d(i.min),e=lt(i.min,i);for(let n=0;n<u;n++)r.push({x:i.min,mean:t,lower:t-s*e.seMean,upper:t+s*e.seMean,predLower:t-s*e.sePred,predUpper:t+s*e.sePred});return r}const o=(i.max-i.min)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?i.max:i.min+o*t,n=d(e),a=lt(e,i);r.push({x:e,mean:n,lower:n-s*a.seMean,upper:n+s*a.seMean,predLower:n-s*a.sePred,predUpper:n+s*a.sePred})}return r}}},t.regressionLowess=function(t,e=(t=>t.x),n=(t=>t.y),u={}){var r;const i=u.span||.3,s=0===u.degree?0:1,o=null!==(r=u.alpha)&&void 0!==r?r:.05,a=null==u.iterations?2:u.iterations,D=u.maxSamples||1e3,h=[];ft(t,e,n,((t,e,n)=>{h.push({x:t,y:e,index:n})})),h.sort(((t,e)=>t.x-e.x));const l=function(t,e){const n=t.length;if(n<=e)return t;const u=[],r=n/e;for(let i=0;i<e;i++){const e=Math.min(Math.floor(i*r),n-1);u.push(t[e])}return u}(h,D),c=l.length,f=new Array(c),F=new Array(c);for(let t=0;t<c;t++)f[t]=l[t].x,F[t]=l[t].y;function d(t,e){if(0===c)return 0;let n=0,u=c;for(;n<u;){const e=n+u>>1;f[e]<t?n=e+1:u=e}const r=Math.min(c,Math.max(2,Math.floor(i*c)));let o=n-1,a=n;for(let e=0;e<r;e++)o>=0&&(a>=c||t-f[o]<=f[a]-t)?o--:a++;const D=o+1,h=a;let d=0;const m=h-D,g=new Array(m);for(let e=D;e<h;e++){const n=Math.abs(f[e]-t);g[e-D]=n,n>d&&(d=n)}let p=0;const y=new Array(m);for(let t=0;t<m;t++){let n=dt(0===d?0:g[t]/d);e&&null!=e[D+t]&&(n*=e[D+t]),y[t]=n,p+=n}if(0===p){let e=0,n=Math.abs(f[0]-t);for(let u=1;u<c;u++){const r=Math.abs(f[u]-t);(r<n||r===n&&l[u].index<l[e].index)&&(e=u,n=r)}return F[e]}if(0===s){let t=0;for(let e=0;e<y.length;e++)t+=y[e]*F[D+e];return t/p}let C=0,x=0,E=0,M=0,b=0;for(let t=D;t<h;t++){const e=t-D,n=f[t],u=F[t],r=y[e];C+=r,x+=r*n,E+=r*u,M+=r*n*n,b+=r*n*u}const B=x/C,v=E/C,A=M-x*B,w=Math.abs(A)<1e-12?0:(b-x*v)/A;return v-w*B+w*t}function m(t){if(Array.isArray(t)){const e=t.length,n=new Array(e);for(let u=0;u<e;u++)n[u]=d(t[u]);return n}return d(t)}return{predict:m,evaluate:m,evaluateGrid:function(t){if(t<=0)return[];if(0===c)return[];const e=new Array(t),n=f[0],r=f[c-1];if(n===r){const u=d(n);for(let r=0;r<t;r++)e[r]={x:n,y:u};return e}const i=(r-n)/(t-1);let s;const o=null!=u.iterations?a:c>500?0:a;if(o>0)for(let t=0;t<o;t++){const t=new Array(c),e=new Array(c);for(let n=0;n<c;n++)t[n]=d(f[n],s),e[n]=Math.abs(F[n]-t[n]);const n=e.slice().sort(((t,e)=>t-e)),u=n[Math.floor(c/2)]||0;s=new Array(c);for(let t=0;t<c;t++){const n=0===u?0:e[t]/(6*u),r=Math.abs(n)>=1?0:(1-n*n)*(1-n*n);s[t]=r}}for(let u=0;u<t;u++){const o=u===t-1?r:n+i*u;e[u]={x:o,y:d(o,s)}}return e},confidenceInterval:function(u=50){const r=[];if(u<=0)return r;if(0===c)return r;const i=f[0],s=f[c-1];if(void 0===i||void 0===s||i===1/0||s===-1/0)return r;const a=ht(t,e,n,(t=>d(t)));if(0===a.n)return r;const D=Math.abs(Dt(1-o/2));if(a.min===a.max){const t=d(a.min),e=lt(a.min,a);for(let n=0;n<u;n++)r.push({x:a.min,mean:t,lower:t-D*e.seMean,upper:t+D*e.seMean,predLower:t-D*e.sePred,predUpper:t+D*e.sePred});return r}const h=(s-i)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?s:i+h*t,n=d(e),o=lt(e,a);r.push({x:e,mean:n,lower:n-D*o.seMean,upper:n+D*o.seMean,predLower:n-D*o.sePred,predUpper:n+D*o.sePred})}return r}}},t.regressionPolynomial=function(t,e=(t=>t.x),n=(t=>t.y),u={}){var r,i;let s=null!==(r=u.degree)&&void 0!==r?r:0;s<0&&(s=0);const a=null!==(i=u.alpha)&&void 0!==i?i:.05,D=s+1,h=new Array(2*s+1).fill(0);ft(t,e,n,((t,e)=>{let n=1;for(let e=0;e<h.length;e++)h[e]+=n,n*=t}));const l=new Array(D);for(let t=0;t<D;t++){l[t]=new Array(D).fill(0);for(let e=0;e<D;e++)l[t][e]=h[t+e]}const c=new Array(D).fill(0);ft(t,e,n,((t,e)=>{let n=1;for(let u=0;u<D;u++)c[u]+=e*n,n*=t}));const f=function(t,e){const n=e.length,u=new Array(n);for(let r=0;r<n;r++)u[r]=t[r].slice(),u[r].push(e[r]);for(let t=0;t<n;t++){let e=t,r=Math.abs(u[t][t]);for(let i=t+1;i<n;i++){const n=Math.abs(u[i][t]);n>r&&(r=n,e=i)}if(e!==t){const n=u[t];u[t]=u[e],u[e]=n}if(Math.abs(u[t][t])<1e-12)return new Array(n).fill(0);for(let e=t+1;e<=n;e++)u[t][e]=u[t][e]/u[t][t];u[t][t]=1;for(let e=0;e<n;e++){if(e===t)continue;const r=u[e][t];if(0!==r){for(let i=t+1;i<=n;i++)u[e][i]-=r*u[t][i];u[e][t]=0}}}const r=new Array(n);for(let t=0;t<n;t++)r[t]=u[t][n];return r}(l,c),F=t=>{let e=1,n=0;for(let u=0;u<f.length;u++)n+=f[u]*e,e*=t;return n};return{degree:s,coef:f,predict:F,rSquared:Ft(t,e,n,(()=>{let u=0,r=0;return ft(t,e,n,((t,e)=>{u+=e,r++})),0===r?0:u/r})(),F),evaluateGrid(u){const r=[];if(u<=0)return r;let i=1/0,s=-1/0;if(ft(t,e,n,(t=>{o(t)||(t<i&&(i=t),t>s&&(s=t))})),i===1/0||s===-1/0)return r;if(i===s){const t=F(i);for(let e=0;e<u;e++)r.push({x:i,y:t});return r}const a=(s-i)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?s:i+a*t;r.push({x:e,y:F(e)})}return r},confidenceInterval(u=50){const r=[];if(u<=0)return r;const i=ht(t,e,n,F);if(0===i.n)return r;const s=Math.abs(Dt(1-a/2));if(i.min===i.max){const t=F(i.min),e=lt(i.min,i);for(let n=0;n<u;n++)r.push({x:i.min,mean:t,lower:t-s*e.seMean,upper:t+s*e.seMean,predLower:t-s*e.sePred,predUpper:t+s*e.sePred});return r}const o=(i.max-i.min)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?i.max:i.min+o*t,n=F(e),a=lt(e,i);r.push({x:e,mean:n,lower:n-s*a.seMean,upper:n+s*a.seMean,predLower:n-s*a.sePred,predUpper:n+s*a.sePred})}return r}}},t.rgbToHex=nn,t.rgbToHsl=qe,t.rotatePoint=ue,t.scale=Pu,t.scott=gt,t.secondCount=uu,t.secondField=ru,t.secondFloor=eu,t.secondOffset=nu,t.secondsGetterName=ln,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=function(t){return parseFloat("0."+Math.sin(t).toString().substring(6))},t.shuffleArray=function(t,e=Math.random){let n,u,r=t.length;for(;r;)n=Math.floor(e()*r),u=t[--r],t[r]=t[n],t[n]=u;return t},t.silverman=pt,t.simpleField=t=>t?"string"==typeof t||"number"==typeof t?()=>t:s(t)?t:e=>e[t.field]:null,t.sin=Tt,t.span=t=>t.length<=1?0:k(t)-t[0],t.sqrt=_t,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ne(t)).length)return 0;t=t.replace(Ue()," ");const n=e?1:2;let u=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(Ie(e)){case"F":case"W":u+=2;break;case"A":u+=n;break;default:u+=1}}return u},t.styleStringToObject=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const n=t.split(":");if(2===n.length){const t=n[0].trim(),u=n[1].trim();t&&u&&(e[t]=u)}}})),e},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,n)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n])):t},t.tau=Mt,t.throttle=function(t,e,n){let u=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return D(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),tt(t,e,{leading:u,trailing:r,maxWait:e})},t.tickStep=function(t,e,n){const u=Math.abs(e-t)/Math.max(0,n);let r=Math.pow(10,Math.floor(Math.log(u)/Math.LN10));const i=u/r;return i>=q?r*=10:i>=Y?r*=5:i>=G&&(r*=2),e<t?-r:r},t.toCamelCase=function(t){return t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()))},t.toDate=it,t.toNumber=U,t.toPercent=(t,e)=>o(t)?e:c(t)?e*parseFloat(t)/100:t,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,n,u,r,i,s){if(!(Bt(u)<=Ct||Bt(r)<=Ct)){if(1!==u&&t.scaleX(u),1!==r&&t.scaleY(r),isFinite(i)&&Math.abs(i)>Ct){let e=0,n=0;void 0!==s&&(e=s[0],n=s[1]),t.rotate(i,e,n)}t.translate(e,n)}},t.transformBoundsWithMatrix=He,t.truncate=(t,e,n="right",u)=>{const r=o(u)?"…":u,i=t+"",s=i.length,a=Math.max(0,e-r.length);return s<=e?i:"left"===n?r+i.slice(s-a):"center"===n?i.slice(0,Math.ceil(a/2))+r+i.slice(s-Math.floor(a/2)):i.slice(0,a)+r},t.unionAABB=ye,t.uniqArray=function(t){return t&&f(t)?Array.from(new Set(N(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=Hn,t.utcDayField=Rn,t.utcDayFloor=Pn,t.utcDayOffset=On,t.utcHourField=Vn,t.utcHourFloor=Yn,t.utcHourOffset=Gn,t.utcMinuteField=tu,t.utcMinuteFloor=Qn,t.utcMinuteOffset=Kn,t.utcMonthCount=_n,t.utcMonthField=Ln,t.utcMonthFloor=Sn,t.utcMonthOffset=Tn,t.utcSecondField=ou,t.utcSecondFloor=iu,t.utcSecondOffset=su,t.utcYearCount=Mn,t.utcYearField=bn,t.utcYearFloor=xn,t.utcYearOffset=En,t.uuid=(t,e)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),u=[];let r;if(e=e||n.length,t)for(r=0;r<t;r++)u[r]=n[0|Math.random()*e];else{let t;for(u[8]=u[13]=u[18]=u[23]="-",u[14]="4",r=0;r<36;r++)u[r]||(t=0|16*Math.random(),u[r]=n[19===r?3&t|8:t])}return u.join("")},t.variance=j,t.visitPoints=ft,t.weightedSum=Ou,t.yearCount=yn,t.yearField=Cn,t.yearFloor=gn,t.yearOffset=pn,t.zero=t=>0,t.zeros=Iu,t.zerosM=function(t,e){return Iu(t).map((function(){return Iu(e)}))}}));
|
|
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 n={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function u(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new u(r,i||t,s),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],o]:t._events[a].push(o):(t._events[a]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),o.prototype.eventNames=function(){var t,r,u=[];if(0===this._eventsCount)return u;for(r in t=this._events)e.call(t,r)&&u.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(t)):u},o.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var u=0,i=r.length,s=new Array(i);u<i;u++)s[u]=r[u].fn;return s},o.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},o.prototype.emit=function(t,e,r,u,i,s){var o=n?n+t:t;if(!this._events[o])return!1;var a,D,l=this._events[o],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,u),!0;case 5:return l.fn.call(l.context,e,r,u,i),!0;case 6:return l.fn.call(l.context,e,r,u,i,s),!0}for(D=1,a=new Array(h-1);D<h;D++)a[D-1]=arguments[D];l.fn.apply(l.context,a)}else{var c,f=l.length;for(D=0;D<f;D++)switch(l[D].once&&this.removeListener(t,l[D].fn,void 0,!0),h){case 1:l[D].fn.call(l[D].context);break;case 2:l[D].fn.call(l[D].context,e);break;case 3:l[D].fn.call(l[D].context,e,r);break;case 4:l[D].fn.call(l[D].context,e,r,u);break;default:if(!a)for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];l[D].fn.apply(l[D].context,a)}}return!0},o.prototype.on=function(t,e,n){return i(this,t,e,n,!1)},o.prototype.once=function(t,e,n){return i(this,t,e,n,!0)},o.prototype.removeListener=function(t,e,r,u){var i=n?n+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var o=this._events[i];if(o.fn)o.fn!==e||u&&!o.once||r&&o.context!==r||s(this,i);else{for(var a=0,D=[],l=o.length;a<l;a++)(o[a].fn!==e||u&&!o[a].once||r&&o[a].context!==r)&&D.push(o[a]);D.length?this._events[i]=1===D.length?D[0]:D:s(this,i)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&s(this,e)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o}(n);var r=e(n.exports);const u=(t,e)=>Object.prototype.toString.call(t)===`[object ${e}]`,i=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||u(t,"Boolean"),s=t=>"function"==typeof t,o=t=>null==t,a=t=>null!=t,D=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},l=t=>"object"==typeof t&&null!==t,h=function(t){if(!l(t)||!u(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 n=typeof t;return e?"string"===n:"string"===n||u(t,"String")},f=t=>Array.isArray?Array.isArray(t):u(t,"Array"),F=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},d=t=>u(t,"Date"),m=(t,e=!1)=>{const n=typeof t;return e?"number"===n:"number"===n||u(t,"Number")},g=t=>m(t)&&Number.isFinite(t),p=t=>u(t,"RegExp"),y=Object.prototype,x=Object.prototype.hasOwnProperty;const C=(t,e,n)=>{const r=c(e)?e.split("."):e;for(let e=0;e<r.length;e++)t=t?t[r[e]]:void 0;return void 0===t?n:t},E=Object.prototype.hasOwnProperty;function M(t,e,n=!1,r=!1){if(e){if(t===e)return;if(a(e)&&"object"==typeof e){const u=Object(e),i=[];for(const t in u)i.push(t);let{length:s}=i,o=-1;for(;s--;){const s=i[++o];!a(u[s])||"object"!=typeof u[s]||r&&f(t[s])?B(t,s,u[s]):b(t,e,s,n,r)}}}}function b(t,e,n,r=!1,u=!1){const i=t[n],s=e[n];let o=e[n],a=!0;if(f(s)){if(r)o=[];else if(f(i))o=i;else if(F(i)){o=new Array(i.length);let t=-1;const e=i.length;for(;++t<e;)o[t]=i[t]}}else h(s)?(o=null!=i?i:{},"function"!=typeof i&&"object"==typeof i||(o={})):a=!1;a&&M(o,s,r,u),B(t,n,o)}function B(t,e,n){(void 0!==n&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],n)||void 0===n&&!(e in t))&&(t[e]=n)}const v=Object.prototype.hasOwnProperty;function w(t){return Object.prototype.toString.call(t)}function A(t){return Object.keys(t)}function S(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!=t&&e!=e}function T(t){return f(t)?t.length:D(t)?Object.keys(t).length:0}function _(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const n in t)t.hasOwnProperty(n)&&e.push(n);return e}function N(t,e,n){const r=_(e);for(let u=0;u<r.length;u++){const i=r[u];(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}return t}function L(t){return a(t)?f(t)?t:[t]:[]}function k(t){if(F(t)){return t[t.length-1]}}function I(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function U(t){return Number(t)}function R(t,e,n=U){const r=t.length;if(!r)return;if(e<=0||r<2)return n(t[0],0,t);if(e>=1)return n(t[r-1],r-1,t);const u=(r-1)*e,i=Math.floor(u),s=n(t[i],i,t);return s+(n(t[i+1],i+1,t)-s)*(u-i)}function O(t){if(0===t)return-1/0;if(1===t)return 1/0;if(!Number.isFinite(t)||t<0||t>1)return NaN;const e=-.00778489400243029,n=-.322396458041136,r=-2.40075827716184,u=-2.54973253934373,i=4.37466414146497,s=2.93816398269878,o=.00778469570904146,a=.32246712907004,D=2.445134137143,l=3.75440866190742,h=.02425;let c,f;return t<h?(c=Math.sqrt(-2*Math.log(t)),(((((e*c+n)*c+r)*c+u)*c+i)*c+s)/((((o*c+a)*c+D)*c+l)*c+1)):t<=.97575?(c=t-.5,f=c*c,(((((-39.6968302866538*f+220.946098424521)*f-275.928510446969)*f+138.357751867269)*f-30.6647980661472)*f+2.50662827745924)*c/(((((-54.4760987982241*f+161.585836858041)*f-155.698979859887)*f+66.8013118877197)*f-13.2806815528857)*f+1)):(c=Math.sqrt(-2*Math.log(1-t)),-(((((e*c+n)*c+r)*c+u)*c+i)*c+s)/((((o*c+a)*c+D)*c+l)*c+1))}
|
|
2
|
+
/* Adapted from vega by University of Washington Interactive Data Lab
|
|
3
|
+
* https://vega.github.io/vega/
|
|
4
|
+
* Licensed under the BSD-3-Clause
|
|
5
|
+
|
|
6
|
+
* url: https://github.com/vega/vega/blob/main/packages/vega-util/src/logger.js
|
|
7
|
+
* License: https://github.com/vega/vega/blob/main/LICENSE
|
|
8
|
+
* @license
|
|
9
|
+
*/const P="undefined"!=typeof console;function H(t,e,n){const r=[e].concat([].slice.call(n));P&&console[t].apply(console,r)}var q;t.LoggerLevel=void 0,(q=t.LoggerLevel||(t.LoggerLevel={}))[q.None=0]="None",q[q.Error=1]="Error",q[q.Warn=2]="Warn",q[q.Info=3]="Info",q[q.Debug=4]="Debug";class W{static getInstance(t,e){return W._instance&&m(t)?W._instance.level(t):W._instance||(W._instance=new W(t,e)),W._instance}static setInstance(t){return W._instance=t}static setInstanceLevel(t){W._instance?W._instance.level(t):W._instance=new W(t)}static clearInstance(){W._instance=null}constructor(e=t.LoggerLevel.None,n){this._onErrorHandler=[],this._level=e,this._method=n}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 n;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):H(null!==(n=this._method)&&void 0!==n?n:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&H(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&H(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&H(this._method||"log","DEBUG",e),this}}W._instance=null;const z=(t,e,n)=>{let r=t,u=e;for(;r<u;){const t=Math.floor((r+u)/2);n(t)>=0?u=t:r=t+1}return r};function j(t,e){let n,r=0,u=0,i=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-u,u+=n/++r,i+=n*(e-u));else{let s=-1;for(let o of t)null!=(o=e(o,++s,t))&&(o=+o)>=o&&(n=o-u,u+=n/++r,i+=n*(o-u))}return r>1?i/(r-1):0}const Y=(t,e)=>{let n=t;return!0!==e&&(n=t.sort(I)),R(n,.5)},G=Math.sqrt(50),V=Math.sqrt(10),$=Math.sqrt(2);const X=1e-10,Z=1e-10;function J(t,e,n=Z,r=X){const u=r,i=n*Math.max(t,e);return Math.abs(t-e)<=Math.max(u,i)}const Q=(t,e=0)=>{let n="",r=e-1;for(;r>=0;)n=`${n}${t}`,r-=1;return n},K=(t,e,n=" ",r="right")=>{const u=n,i=t+"",s=e-i.length;return s<=0?i:"left"===r?Q(u,s)+i:"center"===r?Q(u,Math.floor(s/2))+i+Q(u,Math.ceil(s/2)):i+Q(u,s)},tt=function(t,e,n){return t<e?e:t>n?n:t};let et=!1;try{et="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){et=!1}function nt(t,e,n){let r,u,i,s,o,a,l=0,h=!1,c=!1,f=!0;const F=!e&&0!==e&&et;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){const n=r,i=u;return r=u=void 0,l=e,s=t.apply(i,n),s}function m(t,e){return F?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function p(t){const n=t-a;return void 0===a||n>=e||n<0||c&&t-l>=i}function y(){const t=Date.now();if(p(t))return x(t);o=m(y,function(t){const n=t-l,r=e-(t-a);return c?Math.min(r,i-n):r}(t))}function x(t){return o=void 0,f&&r?d(t):(r=u=void 0,s)}function C(...t){const n=Date.now(),i=p(n);if(r=t,u=this,a=n,i){if(void 0===o)return function(t){return l=t,o=m(y,e),h?d(t):s}(a);if(c)return o=m(y,e),d(a)}return void 0===o&&(o=m(y,e)),s}return e=+e||0,D(n)&&(h=!!n.leading,c="maxWait"in n,c&&(i=Math.max(g(n.maxWait)?n.maxWait:0,e)),f="trailing"in n?!!n.trailing:f),C.cancel=function(){void 0!==o&&function(t){if(F)return cancelAnimationFrame(t);clearTimeout(t)}(o),l=0,r=a=u=o=void 0},C.flush=function(){return void 0===o?s:x(Date.now())},C.pending=function(){return void 0!==o},C}function rt(t,e){return n=>t*(1-n)+e*n}et=!1;const ut=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,it=new RegExp(ut.source,"g");const st=/^(?:(\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 ot(t){if(t instanceof Date)return t;if(c(t)){const e=st.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 n=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(n-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,n,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return o(t)?new Date(NaN):new Date(Math.round(t))}
|
|
10
|
+
/* Adapted from vega by University of Washington Interactive Data Lab
|
|
11
|
+
* https://vega.github.io/vega/
|
|
12
|
+
* Licensed under the BSD-3-Clause
|
|
13
|
+
|
|
14
|
+
* url: https://github.com/vega/vega/blob/main/packages/vega-statistics/src/lcg.js
|
|
15
|
+
* License: https://github.com/vega/vega/blob/main/LICENSE
|
|
16
|
+
* @license
|
|
17
|
+
*/
|
|
18
|
+
const at=1664525,Dt=1013904223,lt=4294967296;function ht(t=1){let e=t;return()=>(e=(at*e+Dt)%lt)/lt}const ct=t=>e=>C(e,t),ft=(t,e={})=>{if(s(t))return t;const n=[t];return(e&&e.get||ct)(n)};function Ft(t,e,n){const r=[];return t.forEach((t=>{const u=e(t),i=n(t);null!=u&&null!=i&&Number.isFinite(+u)&&Number.isFinite(+i)&&r.push({x:+u,y:+i})})),r}function dt(t,e,n){const r=t-e;return Number.isFinite(r)?r/n:t/n-e/n}function mt(t){let e=1/0,n=-1/0,r=1/0,u=-1/0;for(const i of t)e=Math.min(e,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),u=Math.max(u,i.y);if(!t.length)return{xCenter:0,xScale:1,yCenter:0,yScale:1};const i=e/2+n/2,s=r/2+u/2;return{xCenter:i,yCenter:s,xScale:Math.max(Math.abs(e-i),Math.abs(n-i))||1,yScale:Math.max(Math.abs(r-s),Math.abs(u-s))||1}}function gt(t,e,n=mt(t)){const r=e+1;if(1===e){let e=0,r=0,u=0;for(const i of t)u++,e+=(dt(i.x,n.xCenter,n.xScale)-e)/u,r+=(dt(i.y,n.yCenter,n.yScale)-r)/u;let i=0,s=0;for(const u of t){const t=dt(u.x,n.xCenter,n.xScale)-e;i+=t*t,s+=t*(dt(u.y,n.yCenter,n.yScale)-r)}const o=0===i?0:s/i;return{coef:0===i?[r/(1+e*e),e*r/(1+e*e)]:[r-o*e,o],rank:0===u?0:0===i?1:2,basis:n}}const u=Array.from({length:r},(()=>new Array(r).fill(0))),i=new Array(r).fill(0),s=new Array(r);for(const e of t){const t=dt(e.x,n.xCenter,n.xScale);s[0]=1;for(let e=1;e<r;e++)s[e]=s[e-1]*t;let o=dt(e.y,n.yCenter,n.yScale);for(let t=0;t<r;t++){const e=Math.hypot(u[t][t],s[t]);if(0===e)continue;const n=u[t][t]/e,a=s[t]/e;u[t][t]=e;for(let e=t+1;e<r;e++){const r=u[t][e];u[t][e]=n*r+a*s[e],s[e]=-a*r+n*s[e]}const D=i[t];i[t]=n*D+a*o,o=-a*D+n*o}}const o=Math.max(...u.map(((t,e)=>Math.abs(t[e]))))*Number.EPSILON*r*64;if(u.some(((t,e)=>Math.abs(t[e])<=o)))return Object.assign(Object.assign({},function(t,e){const n=e.length,r=t.map((t=>t.slice())),u=Array.from({length:n},((t,e)=>Array.from({length:n},((t,n)=>+(e===n)))));for(let t=0;t<50;t++){let t=!1;for(let e=0;e<n-1;e++)for(let i=e+1;i<n;i++){let s=0,o=0,a=0;for(let t=0;t<n;t++)s+=r[t][e]**2,o+=r[t][i]**2,a+=r[t][e]*r[t][i];if(Math.abs(a)<=8*Number.EPSILON*Math.sqrt(s*o))continue;t=!0;const D=(o-s)/(2*a),l=(D>=0?1:-1)/(Math.abs(D)+Math.hypot(1,D)),h=1/Math.hypot(1,l),c=h*l;for(let t=0;t<n;t++){const n=r[t][e],s=r[t][i],o=u[t][e],a=u[t][i];r[t][e]=h*n-c*s,r[t][i]=c*n+h*s,u[t][e]=h*o-c*a,u[t][i]=c*o+h*a}}if(!t)break}const i=Array.from({length:n},((t,e)=>Math.hypot(...r.map((t=>t[e]))))),s=Math.max(...i)*Number.EPSILON*n*64,o=new Array(n).fill(0);let a=0;for(let t=0;t<n;t++){if(i[t]<=s)continue;a++;let D=0;for(let u=0;u<n;u++)D+=r[u][t]*e[u];D/=i[t]**2;for(let e=0;e<n;e++)o[e]+=u[e][t]*D}return{coef:o,rank:a}}(u,i)),{basis:n});const a=new Array(r);for(let t=r-1;t>=0;t--){let e=i[t];for(let n=t+1;n<r;n++)e-=u[t][n]*a[n];a[t]=e/u[t][t]}return{coef:a,rank:r,basis:n}}function pt(t,e){const n=dt(e,t.basis.xCenter,t.basis.xScale);let r=0;for(let e=t.coef.length-1;e>=0;e--)r=r*n+t.coef[e];return t.basis.yCenter+t.basis.yScale*r}function yt(t){let e=[t.coef[t.coef.length-1]];const n=-t.basis.xCenter/t.basis.xScale,r=1/t.basis.xScale;for(let u=t.coef.length-2;u>=0;u--){const i=new Array(e.length+1).fill(0);e.forEach(((t,e)=>{i[e]+=n*t,i[e+1]+=r*t})),i[0]+=t.coef[u],e=i}if(e=e.map((e=>e*t.basis.yScale)),e[0]+=t.basis.yCenter,e.some((t=>!Number.isFinite(t))))throw new RangeError("Regression coefficients are not finite");return e}function xt(t,e,n,r){if(!Number.isInteger(n)||n<=0||!Number.isFinite(t)||!Number.isFinite(e))return[];const u=e-t,i=1===n?0:u/(n-1);return Array.from({length:n},((s,o)=>{const a=1===n?0:o/(n-1),D=0===o?t:o===n-1?e:Number.isFinite(u)?t+o*i:(1-a)*t+a*e;return{x:D,y:r(D)}}))}function Ct(t){return!Number.isFinite(t)||t<0||t>1?NaN:-O(t/2)}function Et(t,e){return Number.isNaN(t)?NaN:0===e?0:t*e}function Mt(t,e,n,r){let u=1/0,i=-1/0,s=0,a=0;for(let r=0;r<t.length;r++){const D=t[r];let l=e(D),h=n(D);!o(l)&&(l=+l)>=l&&!o(h)&&(h=+h)>=h&&(l<u&&(u=l),l>i&&(i=l),s++,a+=l)}if(0===s)return{min:u,max:i,n:s,X:0,SSE:0,Sxx:0};const D=a/s;let l=0,h=0;for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);if(!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a){const t=a-r(s);l+=t*t;const e=s-D;h+=e*e}}return{min:u,max:i,n:s,X:D,SSE:l,Sxx:h}}function bt(t,e){const{n:n,X:r,Sxx:u,SSE:i}=e,s=n>2?i/(n-2):0;return{seMean:u>0?Math.sqrt(s*(1/n+(t-r)*(t-r)/u)):Math.sqrt(s/n),sePred:Math.sqrt(s*(1+1/n+(u>0?(t-r)*(t-r)/u:0)))}}function Bt(t,e,n,r){for(let u=0;u<t.length;u++){const i=t[u];let s=e(i),a=n(i);!o(s)&&(s=+s)>=s&&!o(a)&&(a=+a)>=a&&r(s,a,u)}}function vt(t,e,n,r,u){let i=0,s=0;for(let a=0;a<t.length;a++){const D=t[a];let l=n(D);if(!o(l)&&(l=+l)>=l){const t=l-u(e(D));i+=t*t;const n=l-r;s+=n*n}}return 0===s?0:1-i/s}const wt=t=>1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t);function At(t,e,n=1){return t<=0||0===e?0:e*Math.pow(t,-1/(n+4))}function St(t,e,n=1){if(t<=0||0===e)return 0;return Math.pow(4/(n+2),1/(n+4))*e*Math.pow(t,-1/(n+4))}function Tt(t,e){let n=0,r=0;for(let u=0;u<t.length;u++)n=Math.max(n,Math.abs(t[u])),r=Math.max(r,Math.abs(e[u]));if(!n||!r)return;let u=0,i=0,s=0,o=0;for(let a=0;a<t.length;a++){const D=t[a]/n-s,l=e[a]/r-o,h=u+D,c=i+l;s=h-u-D,o=c-i-l,u=h,i=c}u/=t.length,i/=t.length;let a=0,D=0,l=0;for(let s=0;s<t.length;s++){const o=t[s]/n-u,h=e[s]/r-i;a+=o*o,D+=h*h,l+=o*h}if(0===a||0===D)return;const h=l/Math.sqrt(a*D);return Math.abs(h)>1&&Math.abs(h)<=1+8*Number.EPSILON?Math.sign(h):h}function _t(t){const e=t.map(((t,e)=>({value:t,index:e}))).sort(((t,e)=>t.value-e.value)),n=new Array(t.length);for(let t=0;t<e.length;){let r=t+1;for(;r<e.length&&e[r].value===e[t].value;)r++;const u=(t+r+1)/2;for(let i=t;i<r;i++)n[e[i].index]=u;t=r}return n}class Nt{}const Lt=1e-12,kt=Math.PI,It=kt/2,Ut=2*kt,Rt=2*Math.PI,Ot=Math.abs,Pt=Math.atan2,Ht=Math.cos,qt=Math.max,Wt=Math.min,zt=Math.sin,jt=Math.sqrt,Yt=Math.pow;function Gt(t,e,n){const r=n.x-e.x,u=n.y-e.y,i=t.x-e.x,s=t.y-e.y;return Math.abs(r*s-i*u)/Math.sqrt(r*r+u*u)}function Vt(t,e){return t[0]*e[1]-t[1]*e[0]}function $t(t,e){return t.x*e.y-t.y*e.x}function Xt(t,e){let n=0;for(let r=0;r<t.length;++r)n+=t[r]*e[r];return n}function Zt(t,e){return Ot(t[0]-e[0])+Ot(t[1]-e[1])<Lt}function Jt(t,e=10){return Math.round(t*e)/e}function Qt(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-(+e[1]||0);return n>0?n:0}class Kt{constructor(t=0,e=0,n,r){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=n,this.y1=r}clone(){return new Kt(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 m(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return m(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 te{static distancePP(t,e){return jt(Yt(t.x-e.x,2)+Yt(t.y-e.y,2))}static distanceNN(t,e,n,r){return jt(Yt(t-n,2)+Yt(e-r,2))}static distancePN(t,e,n){return jt(Yt(e-t.x,2)+Yt(n-t.y,2))}static pointAtPP(t,e,n){return new Kt((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y)}}class ee{constructor(t=0,e=0,n,r){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=n,this.theta1=r}clone(){return new ee(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 ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ue=(t=0)=>{if(t<0)for(;t<-Ut;)t+=Ut;else if(t>0)for(;t>Ut;)t-=Ut;return t},ie=ue,se=(t=0)=>t>360||t<-360?t%360:t,oe=se;function ae(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function De(t,e){const n=Math.abs(e-t);if(n>=2*Math.PI||2*Math.PI-n<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const r=ae(Math.min(t,e)),u=r+n,i=[r,u];let s=Math.floor(r/Math.PI)*Math.PI/2;for(;s<u;)s>r&&i.push(s),s+=Math.PI/2;return i}function le(t,e,n){t[0]=e[0]-n[0],t[1]=e[1]-n[1]}function he(t,e,n,r){let u=t[0],i=e[0],s=n[0],o=r[0];return i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u)&&(u=t[1],i=e[1],s=n[1],o=r[1],i<u&&([u,i]=[i,u]),o<s&&([o,s]=[s,o]),!(i<s||o<u))}var ce;t.InnerBBox=void 0,(ce=t.InnerBBox||(t.InnerBBox={}))[ce.NONE=0]="NONE",ce[ce.BBOX1=1]="BBOX1",ce[ce.BBOX2=2]="BBOX2";const fe=(t,e,n)=>{let r=t.x1,u=t.x2,i=t.y1,s=t.y2,o=e.x1,a=e.x2,D=e.y1,l=e.y2;return n&&(r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),o>a&&([o,a]=[a,o]),D>l&&([D,l]=[l,D])),{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}};function Fe(t,e,n){if(!e)return!0;if(!n)return t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let r=e.x1,u=e.x2,i=e.y1,s=e.y2;return r>u&&([r,u]=[u,r]),i>s&&([i,s]=[s,i]),t.x>=r&&t.x<=u&&t.y>=i&&t.y<=s}function de(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me({x:t,y:e},n,r={x:0,y:0}){return{x:(t-r.x)*Math.cos(n)-(e-r.y)*Math.sin(n)+r.x,y:(t-r.x)*Math.sin(n)+(e-r.y)*Math.cos(n)+r.y}}function ge(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function pe(t,e){const n=e?ne(t.angle):t.angle,r=ge(t);return[me({x:t.x1,y:t.y1},n,r),me({x:t.x2,y:t.y1},n,r),me({x:t.x2,y:t.y2},n,r),me({x:t.x1,y:t.y2},n,r)]}function ye(t,e,n=!1){const r=pe(t,n),u=pe(e,n),i=(t,e)=>[e.x-t.x,e.y-t.y],s=i(ge(t),ge(e)),o=i(r[0],r[1]),a=i(r[1],r[2]),D=i(u[0],u[1]),l=i(u[1],u[2]),h=n?ne(t.angle):t.angle;let c=n?ne(90-t.angle):t.angle+It;const f=n?ne(e.angle):e.angle;let F=n?ne(90-e.angle):e.angle+It;c>Rt&&(c-=Rt),F>Rt&&(F-=Rt);const d=(t,e,n,r)=>{const u=[Math.cos(e),Math.sin(e)];return t+(de(u,n)+de(u,r))/2>de(u,s)};return d((t.x2-t.x1)/2,h,D,l)&&d((t.y2-t.y1)/2,c,D,l)&&d((e.x2-e.x1)/2,f,o,a)&&d((e.y2-e.y1)/2,F,o,a)}let xe,Ce,Ee,Me,be,Be,ve,we,Ae,Se,Te,_e;function Ne(t,e,n=3,r=!1){let u=t.x1,i=t.x2,s=t.y1,o=t.y2,a=e.x1,D=e.x2,l=e.y1,h=e.y2;if(r){let t;u>i&&(t=u,u=i,i=t),s>o&&(t=s,s=o,o=t),a>D&&(t=a,a=D,D=t),l>h&&(t=l,l=h,h=t)}if(u>=D||i<=a||s>=h||o<=l)return[t,e];const c=(i-u+2*n)*(o-s+2*n),f=(D-a+2*n)*(h-l+2*n),F=Math.min(u,a),d=Math.min(s,l),m=Math.max(i,D),g=Math.max(o,h);return c+f>(m-F)*(g-d)?[{x1:F,x2:m,y1:d,y2:g}]:[t,e]}const Le={x:0,y:0},ke={x:0,y:0};function Ie(t,e,n,r){return Gt(t,e,n)<=r/2&&Pe(t,e,n)}const Ue={x:0,y:0},Re={x:0,y:0},Oe={x:0,y:0};function Pe(t,e,n){return Ue.x=e.x-t.x,Ue.y=e.y-t.y,Re.x=n.x-t.x,Re.y=n.y-t.y,Oe.x=e.y-n.y,Oe.y=n.x-e.x,$t(Ue,Oe)*$t(Re,Oe)<0}class He{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:n,fontSize:r,fontFamily:u}){return(t?t+" ":"")+(e?e+" ":"")+(n?n+" ":"")+(r||12)+"px "+(u||"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 n=0,r=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?n++:r++;return{width:~~(.8*n*e+r*e),height:e}}static getDefaultUtils(t){return He.instance||(He.instance=new He(t)),He.instance}}const qe=1e-8;function We(t,e,n,r,u){for(let i=0,s=u[u.length-1];i<u.length;i++){const o=u[i];if(he([t,e],[n,r],[o.x,o.y],[s.x,s.y]))return!0;s=o}return!1}function ze(t,e,n){let r=0,u=t[0];if(!u)return!1;for(let i=1;i<t.length;i++){const s=t[i];r+=je(u.x,u.y,s.x,s.y,e,n),u=s}const i=t[0];return Ye(u.x,i.x)&&Ye(u.y,i.y)||(r+=je(u.x,u.y,i.x,i.y,e,n)),0!==r}function je(t,e,n,r,u,i){if(i>e&&i>r||i<e&&i<r)return 0;if(r===e)return 0;const s=(i-e)/(r-e);let o=r<e?1:-1;1!==s&&0!==s||(o=r<e?.5:-.5);const a=s*(n-t)+t;return a===u?1/0:a>u?o:0}function Ye(t,e){return Math.abs(t-e)<qe}const Ge=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Ve(),"")},Ve=({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")},$e=t=>{let e=t.charCodeAt(0),n=2===t.length?t.charCodeAt(1):0,r=e;return 55296<=e&&e<=56319&&56320<=n&&n<=57343&&(e&=1023,n&=1023,r=e<<10|n,r+=65536),12288===r||65281<=r&&r<=65376||65504<=r&&r<=65510?"F":8361===r||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?"H":4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?"W":32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||172===r||175===r||10214<=r&&r<=10221||10629<=r&&r<=10630?"Na":161===r||164===r||167<=r&&r<=168||170===r||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||198===r||208===r||215<=r&&r<=216||222<=r&&r<=225||230===r||232<=r&&r<=234||236<=r&&r<=237||240===r||242<=r&&r<=243||247<=r&&r<=250||252===r||254===r||257===r||273===r||275===r||283===r||294<=r&&r<=295||299===r||305<=r&&r<=307||312===r||319<=r&&r<=322||324===r||328<=r&&r<=331||333===r||338<=r&&r<=339||358<=r&&r<=359||363===r||462===r||464===r||466===r||468===r||470===r||472===r||474===r||476===r||593===r||609===r||708===r||711===r||713<=r&&r<=715||717===r||720===r||728<=r&&r<=731||733===r||735===r||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||1025===r||1040<=r&&r<=1103||1105===r||8208===r||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||8240===r||8242<=r&&r<=8243||8245===r||8251===r||8254===r||8308===r||8319===r||8321<=r&&r<=8324||8364===r||8451===r||8453===r||8457===r||8467===r||8470===r||8481<=r&&r<=8482||8486===r||8491===r||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||8585===r||8592<=r&&r<=8601||8632<=r&&r<=8633||8658===r||8660===r||8679===r||8704===r||8706<=r&&r<=8707||8711<=r&&r<=8712||8715===r||8719===r||8721===r||8725===r||8730===r||8733<=r&&r<=8736||8739===r||8741===r||8743<=r&&r<=8748||8750===r||8756<=r&&r<=8759||8764<=r&&r<=8765||8776===r||8780===r||8786===r||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||8853===r||8857===r||8869===r||8895===r||8978===r||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||9675===r||9678<=r&&r<=9681||9698<=r&&r<=9701||9711===r||9733<=r&&r<=9734||9737===r||9742<=r&&r<=9743||9748<=r&&r<=9749||9756===r||9758===r||9792===r||9794===r||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||9839===r||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||9955===r||9960<=r&&r<=9983||10045===r||10071===r||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||65533===r||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?"A":"N"},Xe=()=>/[#*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 Ze(t,e={},n){n||(n=1);const{fontStyle:r=e.fontStyle,fontVariant:u=e.fontVariant,fontWeight:i=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(r?r+" ":"")+(u?u+" ":"")+(i?i+" ":"")+s*n+"px "+(o||"sans-serif")}class Je{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(),a(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=a(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(o(this._canvas)&&(a(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),o(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&a(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),o(this._context)&&a(this._canvas)){const t=this._canvas.getContext("2d");a(t)&&(t.save(),t.font=Ze(this.textSpec),this._contextSaved=!0,this._context=t)}return!o(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,n;const{defaultFontParams:r={}}=this._option,{fontStyle:u=r.fontStyle,fontVariant:i=r.fontVariant,fontWeight:s=(null!==(t=r.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=r.fontSize)&&void 0!==e?e:12),fontFamily:a=(null!==(n=r.fontFamily)&&void 0!==n?n:"sans-serif"),align:D,textAlign:l=(null!=D?D:"center"),baseline:h,textBaseline:f=(null!=h?h:"middle"),ellipsis:F,limit:d}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(c(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:u,fontVariant:i,fontFamily:a,fontSize:o,fontWeight:s,textAlign:l,textBaseline:f,ellipsis:F,limit:d,lineHeight:m}}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(o(t))return{width:0,height:0};if(o(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:s,limit:a,lineHeight:D}=this.textSpec;let l;try{const o=this._option.getTextBounds({text:t,fontFamily:e,fontSize:n,fontWeight:r,textAlign:u,textBaseline:i,ellipsis:!!s,maxLineWidth:a||1/0,lineHeight:D});l={width:o.width(),height:o.height()}}catch(e){this._notSupportVRender=!0,l=this.measureWithNaiveCanvas(t)}return l}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const n=this._context.measureText(t),{fontSize:r,lineHeight:u}=this.textSpec;return{width:n.width,height:null!==(e=u)&&void 0!==e?e:r,fontBoundingBoxAscent:n.fontBoundingBoxAscent,fontBoundingBoxDescent:n.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let n=0;n<t.length;n++){const r=t[n];let u=this._measureSpecialChar(r);o(u)&&Je.NUMBERS_CHAR_SET.includes(r)&&(u=this._measureNumberChar()),o(u)&&["F","W"].includes($e(r))&&(u=this._measureFullSizeChar()),o(u)&&(u=this._measureLetterChar()),e.width+=u.width,e.height=Math.max(e.height,u.height),!o(u.fontBoundingBoxAscent)&&(e.fontBoundingBoxAscent=u.fontBoundingBoxAscent),!o(u.fontBoundingBoxDescent)&&(e.fontBoundingBoxDescent=u.fontBoundingBoxDescent)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const n={width:0,height:0},{fontSize:r,lineHeight:u}=this.textSpec;for(let e=0;e<t.length;e++){const u=t[e],i=["F","W"].includes($e(u))?1:.53;n.width+=i*r}return n.height=null!==(e=u)&&void 0!==e?e:r,n}_measureReduce(t,e){var n;const{fontSize:r,lineHeight:u}=this.textSpec,i={width:0,height:0};if(o(t))return i;if(f(t)){const s=t.filter(a).map((t=>t.toString()));return 0===s.length?i:1===s.length?e(s[0]):{width:s.reduce(((t,n)=>Math.max(t,e(n).width)),0),height:s.length*((null!==(n=u)&&void 0!==n?n:r)+1)+1}}return e(t.toString())}_measureNumberChar(){if(o(this._numberCharSize)){const t=this._standardMethod(Je.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Je.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return o(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Je.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(o(this._letterCharSize)){const t=this._standardMethod(Je.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Je.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return a(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){a(this._canvas)&&(this._canvas=null),a(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Je.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Je.NUMBERS_CHAR_SET="0123456789",Je.FULL_SIZE_CHAR="字";function Qe(t,e,n){const{x1:r,y1:u,x2:i,y2:s}=e;return n.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(n.e,n.f),e):(t.clear(),t.add(n.a*r+n.c*u+n.e,n.b*r+n.d*u+n.f),t.add(n.a*i+n.c*u+n.e,n.b*i+n.d*u+n.f),t.add(n.a*i+n.c*s+n.e,n.b*i+n.d*s+n.f),t.add(n.a*r+n.c*s+n.e,n.b*r+n.d*s+n.f),e)}class Ke{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ke(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,n=0,r=0){return this.x1=t,this.y1=e,this.x2=n,this.y2=r,this}set(t=0,e=0,n=0,r=0){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),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,n=0){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])}scale(t=0,e=0,n=0,r=0){const u=this.scalePoints(t,e,n,r);return this.clear().add(u[0],u[1]).add(u[2],u[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 Qe(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,n){const{x1:r,y1:u,x2:i,y2:s}=this,o=Math.cos(t),a=Math.sin(t),D=e-e*o+n*a,l=n-e*a-n*o;return[o*r-a*u+D,a*r+o*u+l,o*r-a*s+D,a*r+o*s+l,o*i-a*u+D,a*i+o*u+l,o*i-a*s+D,a*i+o*s+l]}scalePoints(t,e,n,r){const{x1:u,y1:i,x2:s,y2:o}=this;return[t*u+(1-t)*n,e*i+(1-e)*r,t*s+(1-t)*n,e*o+(1-e)*r]}}class tn extends Ke{constructor(t,e=0){var n;super(t),t&&(this.angle=null!==(n=t.angle)&&void 0!==n?n:e)}intersects(t){return ye(this,t)}setValue(t=0,e=0,n=0,r=0,u=0){return super.setValue(t,e,n,r),this.angle=u,this}clone(){return new tn(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[me({x:this.x1,y:this.y1},this.angle,t),me({x:this.x2,y:this.y1},this.angle,t),me({x:this.x1,y:this.y2},this.angle,t),me({x:this.x2,y:this.y2},this.angle,t)]}}class en{constructor(t=1,e=0,n=0,r=1,u=0,i=0){this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i}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,n,r,u,i){return!(this.e!==u||this.f!==i||this.a!==t||this.d!==r||this.b!==e||this.c!==n)}setValue(t,e,n,r,u,i){return this.a=t,this.b=e,this.c=n,this.d=r,this.e=u,this.f=i,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,n=this.c,r=this.d,u=this.e,i=this.f,s=new en,o=t*r-e*n;return s.a=r/o,s.b=-e/o,s.c=-n/o,s.d=t/o,s.e=(n*i-r*u)/o,s.f=-(t*i-e*u)/o,s}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.a*e+this.c*n,u=this.b*e+this.d*n,i=this.a*-n+this.c*e,s=this.b*-n+this.d*e;return this.a=r,this.b=u,this.c=i,this.d=s,this}rotateByCenter(t,e,n){const r=Math.cos(t),u=Math.sin(t),i=(1-r)*e+u*n,s=(1-r)*n-u*e,o=r*this.a-u*this.b,a=u*this.a+r*this.b,D=r*this.c-u*this.d,l=u*this.c+r*this.d,h=r*this.e-u*this.f+i,c=u*this.e+r*this.f+s;return this.a=o,this.b=a,this.c=D,this.d=l,this.e=h,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,n,r,u,i){return this.multiply(t,e,n,r,u,i),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:n,d:r,e:u,f:i}=this;return this.a=e,this.b=t,this.c=r,this.d=n,this.e=i,this.f=u,this}multiply(t,e,n,r,u,i){const s=this.a,o=this.b,a=this.c,D=this.d,l=s*t+a*e,h=o*t+D*e,c=s*n+a*r,f=o*n+D*r,F=s*u+a*i+this.e,d=o*u+D*i+this.f;return this.a=l,this.b=h,this.c=c,this.d=f,this.e=F,this.f=d,this}interpolate(t,e){const n=new en;return n.a=this.a+(t.a-this.a)*e,n.b=this.b+(t.b-this.b)*e,n.c=this.c+(t.c-this.c)*e,n.d=this.d+(t.d-this.d)*e,n.e=this.e+(t.e-this.e)*e,n.f=this.f+(t.f-this.f)*e,n}transformPoint(t,e){const{a:n,b:r,c:u,d:i,e:s,f:o}=this,a=n*i-r*u,D=i/a,l=-r/a,h=-u/a,c=n/a,f=(u*o-i*s)/a,F=-(n*o-r*s)/a,{x:d,y:m}=t;e.x=d*D+m*h+f,e.y=d*l+m*c+F}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new en(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,n=this.c,r=this.d,u=t*r-e*n,i={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const s=Math.sqrt(t*t+e*e);i.rotateDeg=e>0?Math.acos(t/s):-Math.acos(t/s),i.scaleX=s,i.scaleY=u/s,i.skewX=(t*n+e*r)/u,i.skewY=0}else if(0!==n||0!==r){const s=Math.sqrt(n*n+r*r);i.rotateDeg=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),i.scaleX=u/s,i.scaleY=s,i.skewX=0,i.skewY=(t*n+e*r)/u}return i.rotateDeg=re(i.rotateDeg),i}}function nn(t,e,n){e/=100,n/=100;const r=(1-Math.abs(2*n-1))*e,u=r*(1-Math.abs(t/60%2-1)),i=n-r/2;let s=0,o=0,a=0;return 0<=t&&t<60?(s=r,o=u,a=0):60<=t&&t<120?(s=u,o=r,a=0):120<=t&&t<180?(s=0,o=r,a=u):180<=t&&t<240?(s=0,o=u,a=r):240<=t&&t<300?(s=u,o=0,a=r):300<=t&&t<360&&(s=r,o=0,a=u),s=Math.round(255*(s+i)),o=Math.round(255*(o+i)),a=Math.round(255*(a+i)),{r:s,g:o,b:a}}function rn(t,e,n){t/=255,e/=255,n/=255;const r=Math.min(t,e,n),u=Math.max(t,e,n),i=u-r;let s=0,o=0,a=0;return s=0===i?0:u===t?(e-n)/i%6:u===e?(n-t)/i+2:(t-e)/i+4,s=Math.round(60*s),s<0&&(s+=360),a=(u+r)/2,o=0===i?0:i/(1-Math.abs(2*a-1)),o=+(100*o).toFixed(1),a=+(100*a).toFixed(1),{h:s,s:o,l:a}}const un=/^#([0-9a-f]{3,8})$/,sn={transparent:4294967040},on={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 an(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Dn(t){return m(t)?new Fn(t>>16,t>>8&255,255&t,1):f(t)?new Fn(t[0],t[1],t[2]):new Fn(255,255,255)}function ln(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function hn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const cn=(t,e)=>{const n=un.exec(t);if(e||n){const t=parseInt(n[1],16),e=n[1].length;return 3===e?new Fn((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Dn(t):8===e?new Fn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class fn{static Brighter(t,e=1){return 1===e?t:new fn(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new fn(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const n=t instanceof fn?t:new fn(t);switch(e){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3();case"wcag":return n.getLuminanceWCAG()}}static parseColorString(t){if(a(sn[t]))return function(t){return m(t)?new Fn(t>>>24,t>>>16&255,t>>>8&255,255&t):f(t)?new Fn(t[0],t[1],t[2],t[3]):new Fn(255,255,255,1)}(sn[t]);if(a(on[t]))return Dn(on[t]);const e=`${t}`.trim().toLowerCase(),n=cn(e);if(void 0!==n)return n;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Fn(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(","),n=nn(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Fn(n.r,n.g,n.b,parseFloat(t[3]))}}constructor(t){const e=fn.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Fn(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:n,b:r}=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(n*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*t))),this}add(t){const{r:e,g:n,b:r}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,n+t.color.g),this.color.b+=Math.min(255,r+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:n,b:r}=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(n*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(r*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,n){const r=this.color.opacity,u=rn(this.color.r,this.color.g,this.color.b),i=nn(o(t)?u.h:tt(t,0,360),o(e)?u.s:e>=0&&e<=1?100*e:e,o(n)?u.l:n<=1&&n>=0?100*n:n);return this.color=new Fn(i.r,i.g,i.b,r),this}setRGB(t,e,n){return!o(t)&&(this.color.r=t),!o(e)&&(this.color.g=e),!o(n)&&(this.color.b=n),this}setHex(t){const e=`${t}`.trim().toLowerCase(),n=cn(e,!0);return null!=n?n:this}setColorName(t){const e=on[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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,n=this.color.b/255;let r,u,i;r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),u=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),i=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4);return.2126*r+.7152*u+.0722*i}clone(){return new fn(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 n=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,n),this.color.g=Math.pow(t.color.g,n),this.color.b=Math.pow(t.color.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=ln(t.color.r),this.color.g=ln(t.color.g),this.color.b=ln(t.color.b),this}copyLinearToSRGB(t){return this.color.r=hn(t.color.r),this.color.g=hn(t.color.g),this.color.b=hn(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Fn{constructor(t,e,n,r){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(+n)?255:Math.max(0,Math.min(255,+n)),a(r)?this.opacity=isNaN(+r)?1:Math.max(0,Math.min(1,+r)):this.opacity=1}formatHex(){return`#${an(this.r)+an(this.g)+an(this.b)+(1===this.opacity?"":an(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:n,l:r}=rn(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${n}%,${r}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function dn(t){let e="",n="",r="";const u="#"===t[0]?1:0;for(let i=u;i<t.length;i++)"#"!==t[i]&&(i<u+2?e+=t[i]:i<u+4?n+=t[i]:i<u+6&&(r+=t[i]));return[parseInt(e,16),parseInt(n,16),parseInt(r,16)]}function mn(t,e,n){return Number((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}function gn(t,e){const n=t.r,r=e.r,u=t.g,i=e.g,s=t.b,o=e.b,a=t.opacity,D=e.opacity;return t=>{const e=Math.round(n*(1-t)+r*t),l=Math.round(u*(1-t)+i*t),h=Math.round(s*(1-t)+o*t);return new Fn(e,l,h,a*(1-t)+D*t)}}var pn=Object.freeze({__proto__:null,Color:fn,DEFAULT_COLORS:on,RGB:Fn,hexToRgb:dn,hslToRgb:nn,interpolateRgb:gn,rgbToHex:mn,rgbToHsl:rn});function yn(t){return t?"getUTCFullYear":"getFullYear"}function xn(t){return t?"getUTCMonth":"getMonth"}function Cn(t){return t?"getUTCDate":"getDate"}function En(t){return t?"getUTCHours":"getHours"}function Mn(t){return t?"getUTCMinutes":"getMinutes"}function bn(t){return t?"getUTCSeconds":"getSeconds"}function Bn(t){return t?"getUTCMilliseconds":"getMilliseconds"}const vn=1e3,wn=6e4,An=36e5,Sn=24*An,Tn=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),_n=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),Nn=(t,e)=>e.getFullYear()-t.getFullYear(),Ln=t=>t.getFullYear(),kn=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),In=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),Un=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),Rn=t=>t.getUTCFullYear(),On=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Pn=(t,e)=>(t.setMonth(t.getMonth()+e),t),Hn=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),qn=t=>t.getMonth(),Wn=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),zn=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),jn=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Yn=t=>t.getUTCMonth(),Gn=t=>(t.setHours(0,0,0,0),t),Vn=(t,e)=>(t.setDate(t.getDate()+e),t),$n=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*wn)/Sn,Xn=t=>t.getDate()-1,Zn=t=>(t.setUTCHours(0,0,0,0),t),Jn=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Qn=(t,e)=>(+e-+t)/Sn,Kn=t=>t.getUTCDate()-1,tr=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*vn-t.getMinutes()*wn),t),er=(t,e)=>(t.setHours(t.getHours()+e),t),nr=(t,e)=>(+e-+t)/An,rr=t=>t.getHours(),ur=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*vn-t.getUTCMinutes()*wn),t),ir=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),sr=t=>t.getUTCHours(),or=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*vn),t),ar=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),Dr=(t,e)=>(+e-+t)/wn,lr=t=>t.getMinutes(),hr=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*vn),t),cr=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),fr=t=>t.getUTCMinutes(),Fr=t=>(t.setTime(+t-t.getMilliseconds()),t),dr=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),mr=(t,e)=>(+e-+t)/vn,gr=t=>t.getSeconds(),pr=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),yr=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),xr=t=>t.getUTCSeconds(),Cr=t=>t,Er=(t,e)=>(t.setTime(+t+e),t),Mr=(t,e)=>+e-+t,br=(t,e)=>n=>{const r=new Date(+n-1);return e(r,1),t(r),r},Br=(t,e)=>(n,r)=>{const u=new Date,i=new Date;return u.setTime(+n),i.setTime(+r),t(u),t(i),Math.floor(e(u,i))};function vr(t){const{x:e,y:n}=t.getBoundingClientRect();return{x:e,y:n}}const wr=t=>t.getBoundingClientRect().width/t.offsetWidth,Ar=t=>t.getBoundingClientRect().height/t.offsetHeight;var Sr=6371008.8,Tr={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*Sr,kilometers:6371.0088,kilometres:6371.0088,meters:Sr,metres:Sr,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Sr/1852,radians:1,yards:6967335.223679999};
|
|
19
|
+
/* Adapted from venn.js by Ben Frederickson
|
|
20
|
+
* https://github.com/benfred/venn.js
|
|
21
|
+
* Licensed under the MIT
|
|
22
|
+
|
|
23
|
+
* url: https://github.com/benfred/venn.js/blob/master/src/circleintersection.js
|
|
24
|
+
* License: https://github.com/benfred/venn.js/blob/master/LICENSE
|
|
25
|
+
* @license
|
|
26
|
+
*/
|
|
27
|
+
const _r=1e-10;
|
|
28
|
+
/* Adapted from venn.js by Ben Frederickson
|
|
29
|
+
* https://github.com/benfred/venn.js
|
|
30
|
+
* Licensed under the MIT
|
|
31
|
+
|
|
32
|
+
* url: https://github.com/benfred/venn.js/blob/master/src/circleintersection.js
|
|
33
|
+
* License: https://github.com/benfred/venn.js/blob/master/LICENSE
|
|
34
|
+
* @license
|
|
35
|
+
*/function Nr(t,e){for(let n=0;n<e.length;++n)if(te.distancePP(t,e[n])>e[n].radius+_r)return!1;return!0}function Lr(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function kr(t,e){const n=te.distancePP(t,e),r=t.radius,u=e.radius;if(n>=r+u||n<=Math.abs(r-u))return[];const i=(r*r-u*u+n*n)/(2*n),s=Math.sqrt(r*r-i*i),o=t.x+i*(e.x-t.x)/n,a=t.y+i*(e.y-t.y)/n,D=-(e.y-t.y)*(s/n),l=-(e.x-t.x)*(s/n);return[{x:o+D,y:a-l},{x:o-D,y:a+l}]}function Ir(t){const e={x:0,y:0};for(let n=0;n<t.length;++n)e.x+=t[n].x,e.y+=t[n].y;return e.x/=t.length,e.y/=t.length,e}
|
|
36
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
37
|
+
* https://github.com/d3/d3-time-format
|
|
38
|
+
* Licensed under the ISC
|
|
39
|
+
|
|
40
|
+
* url: https://github.com/d3/d3-time-format/blob/d6feb945baa4b7a45898a9ca926ebca044e20657/src/locale.js
|
|
41
|
+
* License: https://github.com/d3/d3-time-format/blob/main/LICENSE
|
|
42
|
+
* @license
|
|
43
|
+
*/class Ur{static getInstance(){return Ur.instance||(Ur.instance=new Ur),Ur.instance}constructor(){this.locale_shortWeekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.locale_periods=["AM","PM"],this.locale_weekdays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.locale_shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.numberRe=/^\s*\d+/,this.pads={"-":"",_:" ",0:"0"},this.requoteRe=/[\\^$*+?|[\]().{}]/g,this.locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"],this.formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4),this.formats={a:this.formatShortWeekday,A:this.formatWeekday,b:this.formatShortMonth,B:this.formatMonth,d:this.formatDayOfMonth,e:this.formatDayOfMonth,H:this.formatHour24,I:this.formatHour12,L:this.formatMilliseconds,m:this.formatMonthNumber,M:this.formatMinutes,p:this.formatPeriod,S:this.formatSeconds,Y:this.formatFullYear},this.utcFormats={a:this.formatUTCShortWeekday,A:this.formatUTCWeekday,b:this.formatUTCShortMonth,B:this.formatUTCMonth,d:this.formatUTCDayOfMonth,e:this.formatUTCDayOfMonth,H:this.formatUTCHour24,I:this.formatUTCHour12,L:this.formatUTCMilliseconds,m:this.formatUTCMonthNumber,M:this.formatUTCMinutes,p:this.formatUTCPeriod,S:this.formatUTCSeconds,Y:this.formatUTCFullYear},this.parseShortWeekday=(t,e,n)=>{const r=this.shortWeekdayRe.exec(e.slice(n));return r?(t.w=this.shortWeekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseWeekday=(t,e,n)=>{const r=this.weekdayRe.exec(e.slice(n));return r?(t.w=this.weekdayLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseShortMonth=(t,e,n)=>{const r=this.shortMonthRe.exec(e.slice(n));return r?(t.m=this.shortMonthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseMonth=(t,e,n)=>{const r=this.monthRe.exec(e.slice(n));return r?(t.m=this.monthLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseDayOfMonth=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1},this.parseHour24=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1},this.parseMilliseconds=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1},this.parseMonthNumber=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+2));return r?(t.m=r-1,n+r[0].length):-1},this.parseMinutes=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1},this.parsePeriod=(t,e,n)=>{const r=this.periodRe.exec(e.slice(n));return r?(t.p=this.periodLookup.get(r[0].toLowerCase()),n+r[0].length):-1},this.parseSeconds=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1},this.parseFullYear=(t,e,n)=>{const r=this.numberRe.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1},this.parses={a:this.parseShortWeekday,A:this.parseWeekday,b:this.parseShortMonth,B:this.parseMonth,d:this.parseDayOfMonth,e:this.parseDayOfMonth,H:this.parseHour24,I:this.parseHour24,L:this.parseMilliseconds,m:this.parseMonthNumber,M:this.parseMinutes,p:this.parsePeriod,S:this.parseSeconds,Y:this.parseFullYear},this.timeFormat=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),this.requoteF=this.requote.bind(this),this.periodRe=this.formatRe(this.locale_periods),this.periodLookup=this.formatLookup(this.locale_periods),this.weekdayRe=this.formatRe(this.locale_weekdays),this.weekdayLookup=this.formatLookup(this.locale_weekdays),this.shortWeekdayRe=this.formatRe(this.locale_shortWeekdays),this.shortWeekdayLookup=this.formatLookup(this.locale_shortWeekdays),this.monthRe=this.formatRe(this.locale_months),this.monthLookup=this.formatLookup(this.locale_months),this.shortMonthRe=this.formatRe(this.locale_shortMonths),this.shortMonthLookup=this.formatLookup(this.locale_shortMonths)}requote(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,n){const r=t<0?"-":"",u=(r?-t:t)+"",i=u.length;return r+(i<n?new Array(n-i+1).join(e)+u:u)}parseSpecifier(t,e,n,r){let u=0;const i=e.length,s=n.length;let o,a;for(;u<i;){if(r>=s)return-1;if(o=e.charCodeAt(u++),37===o){if(o=e.charAt(u++),a=this.parses[o in this.pads?e.charAt(u++):o],!a||(r=a(t,n,r))<0)return-1}else if(o!==n.charCodeAt(r++))return-1}return r}newParse(t,e){const n=this;return function(r){const u=n.newDate(1900,void 0,1);return n.parseSpecifier(u,t,r+="",0)!==r.length?null:"Q"in u?new Date(u.Q):"s"in u?new Date(1e3*u.s+("L"in u?u.L:0)):(e&&!("Z"in u)&&(u.Z=0),"p"in u&&(u.H=u.H%12+12*u.p),void 0===u.m&&(u.m="q"in u?u.q:0),"Z"in u?(u.H+=u.Z/100|0,u.M+=u.Z%100,n.utcDate(u)):n.localDate(u))}}newFormat(t,e){const n=this;return function(r){const u=[];let i=-1,s=0;const o=t.length;let a,D,l;for(r instanceof Date||(r=new Date(+r));++i<o;)37===t.charCodeAt(i)&&(u.push(t.slice(s,i)),(D=n.pads[a=t.charAt(++i)])?a=t.charAt(++i):D="e"===a?" ":"0",l=e[a],a=l(r,D),u.push(a),s=i+1);return u.push(t.slice(s,i)),u.join("")}}getFullTimeStamp(t){const e=parseInt(t+"",10);return 10===String(e).length?1e3*e:e}}
|
|
44
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
45
|
+
* https://github.com/d3/d3-format
|
|
46
|
+
* Licensed under the ISC
|
|
47
|
+
|
|
48
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
49
|
+
* @license
|
|
50
|
+
*/function Rr(t,e){const n=e?t.toExponential(e-1):t.toExponential(),r=n.indexOf("e");if(r<0)return null;const u=n.slice(0,r);return[u.length>1?u[0]+u.slice(2):u,+n.slice(r+1)]}
|
|
51
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
52
|
+
* https://github.com/d3/d3-format
|
|
53
|
+
* Licensed under the ISC
|
|
54
|
+
|
|
55
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
56
|
+
* @license
|
|
57
|
+
*/
|
|
58
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
59
|
+
* https://github.com/d3/d3-format
|
|
60
|
+
* Licensed under the ISC
|
|
61
|
+
|
|
62
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
63
|
+
* @license
|
|
64
|
+
*/
|
|
65
|
+
let Or;
|
|
66
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
67
|
+
* https://github.com/d3/d3-format
|
|
68
|
+
* Licensed under the ISC
|
|
69
|
+
|
|
70
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
71
|
+
* @license
|
|
72
|
+
*/
|
|
73
|
+
function Pr(t,e){const n=Rr(t,e);if(!n)return t+"";const r=n[0],u=n[1];return u<0?"0."+new Array(-u).join("0")+r:r.length>u+1?r.slice(0,u+1)+"."+r.slice(u+1):r+new Array(u-r.length+2).join("0")}
|
|
74
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
75
|
+
* https://github.com/d3/d3-format
|
|
76
|
+
* Licensed under the ISC
|
|
77
|
+
|
|
78
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
79
|
+
* @license
|
|
80
|
+
*/class Hr{constructor(t={}){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const qr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Wr(t){let e;if(e=qr.exec(t))return new Hr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});W.getInstance().error("invalid format: "+t)}
|
|
81
|
+
/* Adapted from d3-time-format by Mike Bostock
|
|
82
|
+
* https://github.com/d3/d3-format
|
|
83
|
+
* Licensed under the ISC
|
|
84
|
+
|
|
85
|
+
* License: https://github.com/d3/d3-format/blob/main/LICENSE
|
|
86
|
+
* @license
|
|
87
|
+
*/const zr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class jr{constructor(){var t,e;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(t=[...this.locale.grouping].map(Number),e=`${this.locale.thousands}`,function(n,r){let u=n.length;const i=[];let s=0,o=t[0],a=0;for(;u>0&&o>0&&(a+o+1>r&&(o=Math.max(1,r-a)),i.push(n.substring(u-=o,u+o)),!((a+=o+1)>r));)o=t[s=(s+1)%t.length];return i.reverse().join(e)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:Vr([...this.locale.numerals].map(String)),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return jr.instance||(jr.instance=new jr),jr.instance}newFormat(t){const e=Wr(t);let n=e.fill,r=e.align;const u=e.sign,i=e.symbol;let s=e.zero;const o=e.width;let a=e.comma,D=e.precision,l=e.trim,h=e.type;"n"===h?(a=!0,h="g"):Yr[h]||(void 0===D&&(D=12),l=!0,h="g"),(s||"0"===n&&"="===r)&&(s=!0,n="0",r="=");const c="$"===i?this.currencyPrefix:"#"===i&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",f="$"===i?this.currencySuffix:/[%p]/.test(h)?this.percent:"",F=Yr[h],d=/[defgprstz%]/.test(h);D=void 0===D?6:/[gprs]/.test(h)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));const{nan:m,minus:g,decimal:p,group:y,numerals:x}=this;function C(t){let e,i,C,E=c,M=f,b=t;if("c"===h)M=F(b)+M,b="";else{b=+b;let t=b<0||1/b<0;if(b=isNaN(b)?m:F(Math.abs(b),D),l&&(b=function(t){const e=t.length;let n,r=-1;t:for(let u=1;u<e;++u)switch(t[u]){case".":r=n=u;break;case"0":0===r&&(r=u),n=u;break;default:if(!+t[u])break t;r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(n+1):t}(b)),t&&0==+b&&"+"!==u&&(t=!1),E=(t?"("===u?u:g:"-"===u||"("===u?"":u)+E,M=("s"===h?zr[8+Or/3]:"")+M+(t&&"("===u?")":""),d)for(e=-1,i=b.length;++e<i;)if(C=b.charCodeAt(e),48>C||C>57){M=(46===C?p+b.slice(e+1):b.slice(e))+M,b=b.slice(0,e);break}}a&&!s&&(b=y(b,1/0));let B=E.length+b.length+M.length,v=B<o?new Array(o-B+1).join(n):"";switch(a&&s&&(b=y(v+b,v.length?o-M.length:1/0),v=""),r){case"<":b=E+b+M+v;break;case"=":b=E+v+b+M;break;case"^":b=v.slice(0,B=v.length>>1)+E+b+M+v.slice(B);break;default:b=v+E+b+M}return x(b)}return C.toString=function(){return t+""},C}_formatPrefix(t,e){const n=Wr(t);n.type="f";const r=this.newFormat(n.toString()),u=3*Math.max(-8,Math.min(8,Math.floor(Gr(e)/3))),i=Math.pow(10,-u),s=zr[8+u/3];return function(t){return r(i*t)+s}}}const Yr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Pr(100*t,e),r:Pr,s:function(t,e){const n=Rr(t,e);if(!n)return t+"";const r=n[0],u=n[1],i=u-(Or=3*Math.max(-8,Math.min(8,Math.floor(u/3))))+1,s=r.length;return i===s?r:i>s?r+new Array(i-s+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Rr(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function Gr(t){const e=Rr(Math.abs(t));return e?e[1]:NaN}function Vr(t){return function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}}
|
|
88
|
+
/* Adapted from fmin by Ben Frederickson
|
|
89
|
+
* https://github.com/benfred/fmin
|
|
90
|
+
* Licensed under the BSD-3-Clause
|
|
91
|
+
|
|
92
|
+
* url: https://github.com/benfred/fmin/blob/master/src/blas1.js
|
|
93
|
+
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
94
|
+
* @license
|
|
95
|
+
*/function $r(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function Xr(t){return Math.sqrt(Xt(t,t))}function Zr(t,e,n){for(let r=0;r<e.length;++r)t[r]=e[r]*n}function Jr(t,e,n,r,u){for(let i=0;i<t.length;++i)t[i]=e*n[i]+r*u[i]}
|
|
96
|
+
/* Adapted from fmin by Ben Frederickson
|
|
97
|
+
* https://github.com/benfred/fmin
|
|
98
|
+
* Licensed under the BSD-3-Clause
|
|
99
|
+
|
|
100
|
+
* url: https://github.com/benfred/fmin/blob/master/src/linesearch.js
|
|
101
|
+
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
102
|
+
* @license
|
|
103
|
+
*/
|
|
104
|
+
function Qr(t,e,n,r,u,i,s){const o=n.fx,a=Xt(n.fxprime,e);let D=o,l=o,h=a,c=0;function f(l,c,f){for(let F=0;F<16;++F)if(u=(l+c)/2,Jr(r.x,1,n.x,u,e),D=r.fx=t(r.x,r.fxprime),h=Xt(r.fxprime,e),D>o+i*u*a||D>=f)c=u;else{if(Math.abs(h)<=-s*a)return u;h*(c-l)>=0&&(c=l),l=u,f=D}return 0}u=u||1,i=i||1e-6,s=s||.1;for(let F=0;F<10;++F){if(Jr(r.x,1,n.x,u,e),D=r.fx=t(r.x,r.fxprime),h=Xt(r.fxprime,e),D>o+i*u*a||F&&D>=l)return f(c,u,l);if(Math.abs(h)<=-s*a)return u;if(h>=0)return f(u,c,D);l=D,c=u,u*=2}return u}
|
|
105
|
+
/* Adapted from fmin by Ben Frederickson
|
|
106
|
+
* https://github.com/benfred/fmin
|
|
107
|
+
* Licensed under the BSD-3-Clause
|
|
108
|
+
|
|
109
|
+
* url: https://github.com/benfred/fmin/blob/master/src/conjugateGradient.js
|
|
110
|
+
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
111
|
+
* @license
|
|
112
|
+
*/t.AABBBounds=class extends Ke{},t.Bounds=Ke,t.Color=fn,t.ColorUtil=pn,t.DAY=Sn,t.DEFAULT_COLORS=on,t.EventEmitter=r,t.FormatSpecifier=Hr,t.GraphicUtil=He,t.HOUR=An,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const n=new Nt;n.key=t,n.value=e;let r=this.itemList.length;return this.has(t)&&(r=this.items[t].index),n.index=r,this.itemList[r]=n,this.items[t]=n,n}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 n=this.itemList.indexOf(e);this.items[t].index=n}))}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,n){const r=new Nt;r.index=t,r.key=n,r.value=e,this.itemList.splice(t,0,r),this.items[n]=r,this.resetIndex()}sort(t){return this.itemList.sort(((e,n)=>t(e.value,n.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=Nt,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:n=this.CLEAN_THRESHOLD,L_TIME:r=this.L_TIME,R_COUNT:u=this.R_COUNT}=e;if(t.size<n)return 0;let i=0;const s=e=>{i++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length<u)return s(e);let n=0;for(;o-t.timestamp[t.timestamp.length-1-n]<r&&(n++,!(n>=u)););if(n<u)return s(e);for(;o-t.timestamp[0]>r;)t.timestamp.shift()})),i}addLimitedTimestamp(t,e,n){const{R_TIMESTAMP_MAX_SIZE:r=this.R_TIMESTAMP_MAX_SIZE}=n;t.timestamp.length>r&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:n=this.L_TIME}=e,r=Date.now();t.forEach((t=>{for(;r-t.timestamp[0]>n;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:n=this.L_TIME}=e,r=Date.now();for(;r-t.timestamp[0]>n;)t.timestamp.shift()}},t.Logger=W,t.MINUTE=wn,t.MONTH=26784e5,t.Matrix=en,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=jr,t.OBBBounds=tn,t.Point=Kt,t.PointService=te,t.PolarPoint=ee,t.RGB=Fn,t.SECOND=vn,t.SMALL=_r,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=Je,t.TimeUtil=Ur,t.YEAR=31536e6,t.aabbSeparation=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),t.abs=Ot,t.acos=function(t){return t>1?0:t<-1?kt: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 n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0},t.ascending=I,t.asin=function(t){return t>=1?It:t<=-1?-It:Math.asin(t)},t.atan2=Pt,t.baseMerge=M,t.binaryFuzzySearch=(t,e)=>z(0,t.length,(n=>e(t[n]))),t.binaryFuzzySearchInNumberRange=z,t.bisect=function(t,e,n=0,r){for(o(r)&&(r=t.length);n<r;){const u=n+r>>>1;I(t[u],e)>0?r=u:n=u+1}return n}
|
|
113
|
+
/* Adapted from fmin by Ben Frederickson
|
|
114
|
+
* https://github.com/benfred/fmin
|
|
115
|
+
* Licensed under the BSD-3-Clause
|
|
116
|
+
|
|
117
|
+
* url: https://github.com/benfred/fmin/blob/master/src/bisect.js
|
|
118
|
+
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
119
|
+
* @license
|
|
120
|
+
*/,t.bootstrapEstimate=function(t,e,n){if(!t.length||t.some((t=>!Number.isFinite(t)))||!Number.isInteger(n.resamples)||n.resamples<1||!Number.isInteger(n.seed)||n.seed<0||n.seed>4294967295)throw new RangeError("bootstrap requires finite observations, positive resamples and a uint32 seed");const r=ht(n.seed),u=new Array(t.length),i=new Array(n.resamples);for(let s=0;s<n.resamples;s++){for(let e=0;e<u.length;e++)u[e]=t[Math.floor(r()*t.length)];const n=e(u);if(!Number.isFinite(n))throw new RangeError("bootstrap estimator must return a finite number");i[s]=n}return i},t.calculateAnchorOfArc=(t,e)=>{const{startAngle:n,endAngle:r,innerRadius:u,outerRadius:i}=t;let s=(n+r)/2,o=(u+i)/2;switch(e){case"inner-start":s=n,o=u;break;case"outer-start":s=n,o=i;break;case"inner-end":s=r,o=u;break;case"outer-end":s=r,o=i;break;case"inner-middle":o=u;break;case"outer-middle":o=i}return{angle:s,radius:o}},t.calculateAnchorOfBounds=(t,e)=>{const{x1:n,x2:r,y1:u,y2:i}=t,s=Math.abs(r-n),o=Math.abs(i-u);let a=(n+r)/2,D=(u+i)/2,l=0,h=0;switch(e){case"top":case"inside-top":h=-.5;break;case"bottom":case"inside-bottom":h=.5;break;case"left":case"inside-left":l=-.5;break;case"right":case"inside-right":l=.5;break;case"top-right":l=.5,h=-.5;break;case"top-left":l=-.5,h=-.5;break;case"bottom-right":l=.5,h=.5;break;case"bottom-left":l=-.5,h=.5}return a+=l*s,D+=h*o,{x:a,y:D}},t.calculateMaxRadius=function(t,e,n,r){const{x:u,y:i}=e,s=De(n,r),{width:o,height:a}=t,D=[];return s.forEach((t=>{const e=Math.sin(t),n=Math.cos(t);1===e?D.push(a-i):-1===e?D.push(i):1===n?D.push(o-u):-1===n?D.push(u):(e>0?D.push(Math.abs((a-i)/e)):D.push(Math.abs(i/e)),n>0?D.push(Math.abs((o-u)/n)):D.push(Math.abs(u/n)))})),Math.min.apply(null,D)},t.cartesianToPolar=function(t,e={x:0,y:0},n=0,r=2*Math.PI){const{x:u,y:i}=t,{x:s,y:o}=e;let a=u-s,D=i-o;const l=Math.sqrt(a*a+D*D);if(0===l)return{radius:0,angle:0};a/=l,D/=l;let h=Math.atan2(D,a);if(h<n)for(;h<=n;)h+=2*Math.PI;if(h>r)for(;h>=r;)h-=2*Math.PI;return{radius:l,angle:h}},t.circleArea=Lr,t.circleCircleIntersection=kr,t.circleOverlap=function(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const r=e-(n*n-t*t+e*e)/(2*n);return Lr(t,t-(n*n-e*e+t*t)/(2*n))+Lr(e,r)},t.clamp=tt,t.clampAngleByDegree=oe,t.clampAngleByRadian=ie,t.clampDegree=se,t.clampRadian=ue,t.clampRange=(t,e,n)=>{let[r,u]=t;u<r&&(r=t[1],u=t[0]);const i=u-r;return i>=n-e?[e,n]:(r=Math.min(Math.max(r,e),n-i),[r,r+i])},t.clamper=function(t,e){let n;return t>e&&(n=t,t=e,e=n),n=>Math.max(t,Math.min(e,n))},t.clone=function(t,e=!1,n=0,r=void 0){const u=[],i=[];return void 0===e&&(e=!0),void 0===n&&(n=1/0),function t(n,s){if(null===n)return null;if(0===s)return n;let o;if("object"!=typeof n)return n;if(f(n)?o=[]:p(n)?(o=new RegExp(n.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(n)),n.lastIndex&&(o.lastIndex=n.lastIndex)):o=d(n)?new Date(n.getTime()):void 0===r?Object.create(Object.getPrototypeOf(n)):Object.create(r),e){const t=u.indexOf(n);if(-1!==t)return i[t];u.push(n),i.push(o)}for(const e in n)o[e]=t(n[e],s-1);return o}(t,n)},t.cloneDeep=function t(e,n,r){let u;if(!a(e)||"object"!=typeof e||n&&n(e))return e;const s=f(e),o=e.length;u=s?new Array(o):"object"==typeof e?{}:i(e)||m(e)||c(e)?e:d(e)?new Date(+e):void 0;const D=s?void 0:Object.keys(Object(e));let l=-1;if(u)for(;++l<(D||e).length;){const i=D?D[l]:l,s=e[i];r&&r.includes(i.toString())?u[i]=s:u[i]=t(s,n,r)}return u},t.computeQuadrant=function(t){return(t=ae(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1},t.conjugateGradient=function(t,e,n){let r={x:e.slice(),fx:0,fxprime:e.slice()},u={x:e.slice(),fx:0,fxprime:e.slice()};const i=e.slice();let s,o=1;const a=(n=n||{}).maxIterations||20*e.length;r.fx=t(r.x,r.fxprime);const D=r.fxprime.slice();Zr(D,r.fxprime,-1);for(let e=0;e<a;++e){if(o=Qr(t,D,r,u,o),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:o}),o){Jr(i,1,u.fxprime,-1,r.fxprime);const t=Xt(r.fxprime,r.fxprime);Jr(D,Math.max(0,Xt(i,u.fxprime)/t),D,-1,u.fxprime),s=r,r=u,u=s}else Zr(D,r.fxprime,-1);if(Xr(r.fxprime)<=1e-5)break}return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:o}),r},t.constant=t=>s(t)?t:()=>t,t.containedInCircles=Nr,t.correlation=function(t,e,n="pearson"){if(t.length!==e.length||!["pearson","spearman","kendall"].includes(n)||t.some((t=>!Number.isFinite(t)))||e.some((t=>!Number.isFinite(t))))throw new RangeError("correlation requires equal finite arrays and a supported method");if(!(t.length<2))return"kendall"===n?function(t,e){const n=t.map(((t,n)=>({x:t,y:e[n]}))).sort(((t,e)=>t.x-e.x||t.y-e.y)),r=[...e].sort(((t,e)=>t-e)),u=new Map;let i=0;for(let t=0;t<r.length;){let e=t+1;for(;e<r.length&&r[e]===r[t];)e++;i+=(e-t)*(e-t-1)/2,u.set(r[t],u.size+1),t=e}const s=new Float64Array(u.size+1);let o=0,a=0,D=0;for(let t=0;t<n.length;){let e=t+1;for(;e<n.length&&n[e].x===n[t].x;)e++;o+=(e-t)*(e-t-1)/2;for(let r=t;r<e;){let t=r+1;for(;t<e&&n[t].y===n[r].y;)t++;a+=(t-r)*(t-r-1)/2,r=t}for(let r=t;r<e;r++){let e=0;for(let t=u.get(n[r].y);t>0;t-=t&-t)e+=s[t];D+=t-e}for(let r=t;r<e;r++)for(let t=u.get(n[r].y);t<s.length;t+=t&-t)s[t]++;t=e}const l=t.length*(t.length-1)/2;if(l!==o&&l!==i)return(l-o-i+a-2*D)/Math.sqrt((l-o)*(l-i))}(t,e):"spearman"===n?Tt(_t(t),_t(e)):Tt(t,e)},t.cos=Ht,t.crossProduct=Vt,t.crossProductPoint=$t,t.dateGetterName=Cn,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=$n,t.dayField=Xn,t.dayFloor=Gn,t.dayOffset=Vn,t.debounce=nt,t.defaults=N,t.degreeToRadian=ne,t.destination=function(t,e,n,r={}){const u=ne(t[0]),i=ne(t[1]),s=ne(n),o=function(t,e){void 0===e&&(e="kilometers");var n=Tr[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),a=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(s));return{x:re(u+Math.atan2(Math.sin(s)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(a))),y:re(a)}},t.deviation=function(t,e){const n=j(t,e);return n?Math.sqrt(n):n},t.dotProduct=Xt,t.eastAsianCharacterInfo=$e,t.ecdf=function(t){const e=t.length,n=t.slice().sort(((t,e)=>t-e));function r(t){if(0===e)return 0;let r=0,u=e;for(;r<u;){const e=r+u>>>1;n[e]<=t?r=e+1:u=e}return r/e}return{evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(r(t[n]));return e}return r(t)},evaluateGrid:function(t){const u=[];if(t<=0)return u;if(0===e)return u;const i=n[0],s=n[e-1];if(i===s){for(let e=0;e<t;e++)u.push({x:i,y:1});return u}const o=(s-i)/(t-1);for(let e=0;e<t;e++){const n=e===t-1?s:i+o*e;u.push({x:n,y:r(n)})}return u},n:e}},t.epanechnikov=t=>Math.abs(t)<=1?.75*(1-t*t):0,t.epsilon=Lt,t.exponent=Gr,t.extent=(t,e)=>{const n=s(e)?e:t=>t;let r,u;if(t&&t.length){const e=t.length;for(let i=0;i<e;i+=1){let e=n(t[i]);o(e)||!m(e=+e)||Number.isNaN(e)||(o(r)?(r=e,u=e):(r=Math.min(r,e),u=Math.max(u,e)))}return[r,u]}return[r,u]},t.fakeRandom=()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])},t.field=(t,e={})=>{if(f(t)){const n=t.map((t=>ft(t,e)));return t=>n.map((e=>e(t)))}return ft(t,e)},t.findBoundaryAngles=De,t.findZeroOfFunction=function(t,e,n,r){var u,i;const s=null!==(u=null==r?void 0:r.maxIterations)&&void 0!==u?u:100,o=null!==(i=null==r?void 0:r.tolerance)&&void 0!==i?i:1e-10,a=t(e),D=t(n);let l=n-e;if(a*D>0){return W.getInstance().error("Initial bisect points must have opposite signs"),NaN}if(0===a)return e;if(0===D)return n;for(let n=0;n<s;++n){l/=2;const n=e+l,r=t(n);if(r*a>=0&&(e=n),Math.abs(l)<o||0===r)return n}return e+l},t.fixPrecision=Jt,t.flattenArray=function t(e){if(!f(e))return[e];const n=[];for(const r of e)n.push(...t(r));return n},t.formatNumerals=Vr,t.formatSpecifier=Wr,t.formatTypes=Yr,t.fullYearGetterName=yn,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return Ot(t-e)<Lt},t.fuzzyEqualVec=Zt,t.gaussian=wt,t.gemv=function(t,e,n){for(let r=0;r<t.length;++r)t[r]=Xt(e[r],n)}
|
|
121
|
+
/* Adapted from fmin by Ben Frederickson
|
|
122
|
+
* https://github.com/benfred/fmin
|
|
123
|
+
* Licensed under the BSD-3-Clause
|
|
124
|
+
|
|
125
|
+
* url: https://github.com/benfred/fmin/blob/master/src/nelderMead.js
|
|
126
|
+
* License: https://github.com/benfred/fmin/blob/master/LICENSE
|
|
127
|
+
* @license
|
|
128
|
+
*/,t.generateCeil=br,t.generateCount=Br,t.generateStepInterval=(t,{floor:e,offset:n,field:r,count:u})=>{const i=Math.floor(t);if(!Number.isFinite(i)||i<=0)return null;if(i<=1)return{floor:e,offset:n,ceil:br(e,n)};const s=Br(e,u),o=r?t=>r(t)%i==0:t=>s(0,t)%i==0,a=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},D=(t,e)=>{if(!Number.isNaN(+t))if(i<0)for(;++e<=0;)for(n(t,-1);!o(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!o(t);)n(t,1);return t};return{floor:a,offset:D,ceil:br(a,D)}},t.get=C,t.getAABBFromPoints=function(t){return xe=1/0,Ce=1/0,Ee=-1/0,Me=-1/0,t.forEach((t=>{xe>t.x&&(xe=t.x),Ee<t.x&&(Ee=t.x),Ce>t.y&&(Ce=t.y),Me<t.y&&(Me=t.y)})),{x1:xe,y1:Ce,x2:Ee,y2:Me}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getCenter=Ir,t.getContainerSize=function(t,e=0,n=0){if(!t)return{width:e,height:n};let r;try{r=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){r=()=>({})}const u=r(t);if(/^(\d*\.?\d+)(px)$/.exec(u.width)){const r=parseFloat(u.width)-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight)||t.clientWidth-1,i=parseFloat(u.height)-parseFloat(u.paddingTop)-parseFloat(u.paddingBottom)||t.clientHeight-1;return{width:r<=0?e:r,height:i<=0?n:i}}return{width:e,height:n}},t.getContextFont=Ze,t.getDecimalPlaces=Qt,t.getElementAbsolutePosition=vr,t.getElementRelativePosition=function(t,e){const n=vr(t),r=vr(e);return{x:n.x-r.x,y:n.y-r.y}},t.getFormatFromValue=function(t,e){const n=ot(t),r=n[xn(e)]()+1,u=n[Cn(e)](),i=n[En(e)](),s=n[Mn(e)](),o=n[bn(e)](),a=0===n[Bn(e)](),D=a&&0===o,l=D&&0===s,h=l&&0===i,c=h&&1===u;return c&&1===r?"YYYY":c?"YYYY-MM":h?"YYYY-MM-DD":l?"HH":D?"HH:mm":a?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,n,r){if(!he(t,e,n,r))return!1;const u=[0,0],i=[0,0],s=[0,0];if(le(u,e,t),le(i,r,n),Zt(u,i))return!0;le(s,n,t);const o=Vt(s,i)/Vt(u,i);return o>=0&&o<=1&&[t[0]+u[0]*o,t[1]+u[1]*o]},t.getIntervalOptions=(t,e)=>"year"===t&&e?{floor:kn,offset:In,count:Un,field:Rn}:"month"===t&&e?{floor:Wn,offset:zn,count:jn,field:Yn}:"day"===t&&e?{floor:Zn,offset:Jn,count:Qn,field:Kn}:"hour"===t&&e?{floor:ur,offset:ir,count:nr,field:sr}:"minute"===t&&e?{floor:hr,offset:cr,count:Dr,field:fr}:"second"===t&&e?{floor:pr,offset:yr,count:mr,field:xr}:"year"===t?{floor:Tn,offset:_n,count:Nn,field:Ln}:"month"===t?{floor:On,offset:Pn,count:Hn,field:qn}:"day"===t?{floor:Gn,offset:Vn,count:$n,field:Xn}:"hour"===t?{floor:tr,offset:er,count:nr,field:rr}:"minute"===t?{floor:or,offset:ar,count:Dr,field:lr}:"second"===t?{floor:Fr,offset:dr,count:mr,field:gr}:{floor:Cr,offset:Er,count:Mr},t.getOBBFromLine=function(t,e,n){return be=e.x-t.x,Be=e.y-t.y,ve=Be,we=-be,Te=Ae=Math.sqrt(ve*ve+we*we),_e=n,ve/=Ae,we/=Ae,Se=n/2,be=Se*ve,Be=Se*we,{point1:{x:t.x+be,y:t.y+Be},point2:{x:t.x-be,y:t.y-Be},point3:{x:e.x+be,y:e.y+Be},point4:{x:e.x-be,y:e.y-Be},width:Te,height:_e,left:Math.min(t.x,e.x)-Math.abs(be),top:Math.min(t.y,e.y)-Math.abs(Be)}},t.getRectIntersect=function(t,e,n){if(null===t)return e;if(null===e)return t;const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=fe(t,e,n);return r>=a||u<=o||i>=l||s<=D?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(r,o),y1:Math.max(i,D),x2:Math.min(u,a),y2:Math.min(s,l)}},t.getScale=t=>t.offsetWidth>0?wr(t):Ar(t),t.getScaleX=wr,t.getScaleY=Ar,t.getScrollLeft=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,n,r;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(r=null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===n?void 0:n.documentElement)||void 0===r?void 0:r.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTimeFormatter=function(t,e){return n=>{const r=ot(n),u=r[yn(e)](),i=r[xn(e)]()+1,s=Math.floor((i-1)/3)+1,o=r[Cn(e)](),a=r["get"+(e?"UTC":"")+"Day"](),D=r[En(e)](),l=(D-1)%12+1,h=r[Mn(e)](),c=r[bn(e)](),f=r[Bn(e)]();return(t||"").replace(/YYYY/g,K(u+"",4,"0","left")).replace(/yyyy/g,u+"").replace(/yy/g,u%100+"").replace(/Q/g,s+"").replace(/MM/g,K(i,2,"0","left")).replace(/M/g,i+"").replace(/dd/g,K(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,a+"").replace(/HH/g,K(D,2,"0","left")).replace(/H/g,D+"").replace(/hh/g,K(l+"",2,"0","left")).replace(/h/g,l+"").replace(/mm/g,K(h,2,"0","left")).replace(/m/g,h+"").replace(/ss/g,K(c,2,"0","left")).replace(/s/g,c+"").replace(/SSS/g,K(f,3,"0","left")).replace(/S/g,f+"")}},t.getter=ct,t.halfPi=It,t.has=(t,e)=>null!=t&&E.call(t,e),t.hasParentElement=function(t,e){let n=t.parentNode;for(;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},t.hexToRgb=dn,t.hourCount=nr,t.hourField=rr,t.hourFloor=tr,t.hourOffset=er,t.hoursGetterName=En,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=nn,t.interpolateDate=function(t,e){const n=t.valueOf(),r=e.valueOf(),u=new Date;return t=>(u.setTime(n*(1-t)+r*t),u)},t.interpolateNumber=rt,t.interpolateNumberRound=function(t,e){return function(n){return Math.round(t*(1-n)+e*n)}},t.interpolateRgb=gn,t.interpolateString=function(t,e){let n,r,u,i=ut.lastIndex=it.lastIndex=0,s=-1;const o=[],a=[];for(t+="",e+="";(n=ut.exec(t))&&(r=it.exec(e));)(u=r.index)>i&&(u=e.slice(i,u),o[s]?o[s]+=u:o[++s]=u),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,a.push({i:s,x:rt(n,r)})),i=it.lastIndex;return i<e.length&&(u=e.slice(i),o[s]?o[s]+=u:o[++s]=u),o.length<2?a[0]?function(t){return function(e){return t(e)+""}}(a[0].x):function(t){return function(){return t}}(e):(e=a.length,function(t){for(let n,r=0;r<e;++r)o[(n=a[r]).i]=n.x(t);return o.join("")})},t.intersectionArea=function(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let r=n+1;r<t.length;++r){const u=kr(t[n],t[r]);for(let t=0;t<u.length;++t){const i=u[t];i.parentIndex=[n,r],e.push(i)}}return e}(t),r=n.filter((function(e){return Nr(e,t)}));let u=0,i=0;const s=[];if(r.length>1){const e=Ir(r);for(let t=0;t<r.length;++t){const n=r[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}r.sort((function(t,e){return e.angle-t.angle}));let n=r[r.length-1];for(let e=0;e<r.length;++e){const o=r[e];i+=(n.x+o.x)*(o.y-n.y);const a={x:(o.x+n.x)/2,y:(o.y+n.y)/2};let D=null;for(let e=0;e<o.parentIndex.length;++e)if(n.parentIndex.indexOf(o.parentIndex[e])>-1){const r=t[o.parentIndex[e]],u=Math.atan2(o.x-r.x,o.y-r.y),i=Math.atan2(n.x-r.x,n.y-r.y);let s=i-u;s<0&&(s+=2*Math.PI);const l=i-s/2;let h=te.distancePP(a,{x:r.x+r.radius*Math.sin(l),y:r.y+r.radius*Math.cos(l)});h>2*r.radius&&(h=2*r.radius),(null===D||D.width>h)&&(D={circle:r,width:h,p1:o,p2:n})}null!==D&&(s.push(D),u+=Lr(D.circle.radius,D.width),n=o)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let r=0;r<t.length;++r)if(te.distancePP(t[r],e)>Math.abs(e.radius-t[r].radius)){n=!0;break}n?u=i=0:(u=e.radius*e.radius*Math.PI,s.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-_r,y:e.y+e.radius},width:2*e.radius}))}return i/=2,e&&(e.area=u+i,e.arcArea=u,e.polygonArea=i,e.arcs=s,e.innerPoints=r,e.intersectionPoints=n),u+i},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=i,t.isDate=d,t.isEmpty=function(t){if(o(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(x.call(t,e))return!1;return!0},t.isEqual=function t(e,n,r){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(null==e||null==n)return!1;if(Number.isNaN(e)&&Number.isNaN(n))return!0;if(w(e)!==w(n))return!1;if(s(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if(f(e)){if(e.length!==n.length)return!1;for(let u=e.length-1;u>=0;u--)if(!t(e[u],n[u],r))return!1;return!0}if(!h(e))return!1;const u=A(e),i=A(n);if(u.length!==i.length)return!1;u.sort(),i.sort();for(let t=u.length-1;t>=0;t--)if(u[t]!=i[t])return!1;for(let i=u.length-1;i>=0;i--){const s=u[i];if(!t(e[s],n[s],r))return!1}return!0},t.isFunction=s,t.isGreater=function(t,e,n,r){return t>e&&!J(t,e,n,r)},t.isHTMLElement=function(t){try{return t instanceof Element}catch(e){const n=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],r=Object.keys(t);return n.every((t=>r.includes(t)))}},t.isIntersect=he,t.isLess=function(t,e,n,r){return t<e&&!J(t,e,n,r)},t.isNil=o,t.isNull=t=>null===t,t.isNumber=m,t.isNumberClose=J,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=D,t.isObjectLike=l,t.isPlainObject=h,t.isPointInLine=je,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const n="Feature"===(r=e).type?r.geometry:r;var r;const u=n.type,i=e.bbox;let s=n.coordinates;if(i&&!0===Fe(t,{x1:i[0],x2:i[1],y1:i[1],y2:i[3]},!0))return!1;"Polygon"===u&&(s=[s]);let o=!1;for(let e=0;e<s.length;++e)for(let n=0;n<s[e].length;++n){if(ze(s[e][n].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o}return o},t.isRectIntersect=function(t,e,n){if(t&&e){if(!n)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:r,x12:u,y11:i,y12:s,x21:o,x22:a,y21:D,y22:l}=fe(t,e,!0);return!(r>a||u<o||i>l||s<D)}return!0},t.isRegExp=p,t.isRotateAABBIntersect=ye,t.isShallowEqual=function(t,e){if(S(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(T(t)!==T(e))return!1;let n=!0;return Object.keys(t).forEach((r=>!!S(t[r],e[r])||(n=!1,n))),n},t.isString=c,t.isType=u,t.isUndefined=t=>void 0===t,t.isValid=a,t.isValidNumber=g,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.kde=function(t,e={}){const n=t.length,r=e.kernel||wt;let u=e.bandwidth;if(!u||u<=0){const r=function(t){const e=t.length;if(0===e)return 0;let n=0;for(let r=0;r<e;r++)n+=t[r];n/=e;let r=0;for(let u=0;u<e;u++){const e=t[u]-n;r+=e*e}return Math.sqrt(r/e)}(t)||0,i=e.bandwidthMethod||"scott";u="silverman"===i?St(n,r,1):At(n,r,1)}if(!u||u<=0){const e=e=>{const r=[];if(e<=0)return r;let u=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<u&&(u=n),n>i&&(i=n)}if(u===1/0||i===-1/0){for(let t=0;t<e;t++)r.push({x:0,y:0});return r}for(let t=0;t<e;t++)r.push({x:u,y:0});return r};return{bandwidth:0,kernel:r,evaluate:t=>{if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(0);return e}return 0},evaluateGrid:e}}const i=1/(n*u);function s(e){let s=0;for(let i=0;i<n;i++)s+=r((e-t[i])/u);return s*i}return{bandwidth:u,kernel:r,evaluate:function(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(s(t[n]));return e}return s(t)},evaluateGrid(e){const r=[];if(e<=0)return r;let u=1/0,i=-1/0;for(let e=0;e<n;e++){const n=t[e];n<u&&(u=n),n>i&&(i=n)}if(u===1/0||i===-1/0)return r;if(u===i){for(let t=0;t<e;t++)r.push({x:u,y:s(u)});return r}const o=(i-u)/(e-1);for(let t=0;t<e;t++){const n=t===e-1?i:u+o*t;r.push({x:n,y:s(n)})}return r}}},t.keys=_,t.last=k,t.lengthFromPointToLine=Gt,t.lineIntersectPolygon=We,t.lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=qt,t.maxInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)>0&&(r=i)}return r},t.mean=function(t){if(!t.length)return;let e=0;for(const n of t){if(!Number.isFinite(n))throw new RangeError("mean requires finite numbers");e=Math.max(e,Math.abs(n))}if(0===e)return 0;let n=0,r=0;for(const u of t){const t=u/e,i=n+t;r+=Math.abs(n)>=Math.abs(t)?n-i+t:t-i+n,n=i}return(n+r)/t.length*e},t.median=Y,t.memoize=t=>{let e=null,n=null;return(...r)=>(e&&r.every(((t,n)=>t===e[n]))||(e=r,n=t(...r)),n)},t.merge=function(t,...e){let n=-1;const r=e.length;for(;++n<r;){M(t,e[n],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(n,r){const u=[];r.forEach((t=>{let e;(e=Ne(n,t)).length>1?u.push(t):n=e[0]})),e.push(n),u.length&&t(u[0],u.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=Mr,t.millisecondsFloor=Cr,t.millisecondsGetterName=Bn,t.millisecondsOffset=Er,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=Wt,t.minInArray=(t,e)=>{var n;if(0===t.length)return;let r=t[0];for(let u=1;u<t.length;u++){const i=t[u];(null!==(n=null==e?void 0:e(i,r))&&void 0!==n?n:i-r)<0&&(r=i)}return r},t.minuteCount=Dr,t.minuteField=lr,t.minuteFloor=or,t.minuteOffset=ar,t.minutesGetterName=Mn,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,n=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const r=Object.getOwnPropertyNames(e);for(let u=0;u<r.length;u++){const i=r[u];"constructor"!==i&&(n?null!=e[i]:null==t[i])&&(t[i]=e[i])}}else N(t,e,n)},t.monthCount=Hn,t.monthField=qn,t.monthFloor=On,t.monthGetterName=xn,t.monthOffset=Pn,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=function(t,e,n){const r=(n=n||{}).maxIterations||200*e.length,u=n.nonZeroDelta||1.05,i=n.zeroDelta||.001,s=n.minErrorDelta||1e-6,o=n.minErrorDelta||1e-5,a=void 0!==n.rho?n.rho:1,D=void 0!==n.chi?n.chi:2,l=void 0!==n.psi?n.psi:-.5,h=void 0!==n.sigma?n.sigma:.5;let c;const f=e.length,F=new Array(f+1);F[0]=e,F[0].fx=t(e),F[0].id=0;for(let n=0;n<f;++n){const r=e.slice();r[n]=r[n]?r[n]*u:i,F[n+1]=r,F[n+1].fx=t(r),F[n+1].id=n+1}function d(t){for(let e=0;e<t.length;e++)F[f][e]=t[e];F[f].fx=t.fx}const m=function(t,e){return t.fx-e.fx},g=e.slice(),p=e.slice(),y=e.slice(),x=e.slice();for(let e=0;e<r;++e){if(F.sort(m),n.history){const t=F.map((function(t){const e=t.slice();return e.fx=t.fx,e.id=t.id,e}));t.sort((function(t,e){return t.id-e.id})),n.history.push({x:F[0].slice(),fx:F[0].fx,simplex:t})}c=0;for(let t=0;t<f;++t)c=Math.max(c,Math.abs(F[0][t]-F[1][t]));if(Math.abs(F[0].fx-F[f].fx)<s&&c<o)break;for(let t=0;t<f;++t){g[t]=0;for(let e=0;e<f;++e)g[t]+=F[e][t];g[t]/=f}const e=F[f];if(Jr(p,1+a,g,-a,e),p.fx=t(p),p.fx<F[0].fx)Jr(x,1+D,g,-D,e),x.fx=t(x),x.fx<p.fx?d(x):d(p);else if(p.fx>=F[f-1].fx){let n=!1;if(p.fx>e.fx?(Jr(y,1+l,g,-l,e),y.fx=t(y),y.fx<e.fx?d(y):n=!0):(Jr(y,1-l*a,g,l*a,e),y.fx=t(y),y.fx<p.fx?d(y):n=!0),n){if(h>=1)break;for(let e=1;e<F.length;++e)Jr(F[e],1-h,F[0],h,F[e]),F[e].fx=t(F[e])}}else d(p)}return F.sort(m),{fx:F[0].fx,x:F[0]}},t.norm2=Xr,t.normalQuantile=O,t.normalTransform=function(t,e,n,r,u,i,s,o){const a=e.a,D=e.b,l=e.c,h=e.d,c=e.e,f=e.f,F=Ht(s),d=zt(s);let m,g;o?(m=o[0],g=o[1]):(m=n,g=r);const p=m-n,y=g-r,x=a*F+l*d,C=D*F+h*d,E=l*F-a*d,M=h*F-D*d;t.a=u*x,t.b=u*C,t.c=i*E,t.d=i*M,t.e=c+a*m+l*g-x*p-E*y,t.f=f+D*m+h*g-C*p-M*y},t.normalizeAngle=ae,t.normalizePadding=function(t){if(g(t))return[t,t,t,t];if(f(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,n]=t;return[e,n,e,n]}if(3===e){const[e,n,r]=t;return[e,n,r,n]}if(4===e)return t}if(D(t)){const{top:e=0,right:n=0,bottom:r=0,left:u=0}=t;return[e,n,r,u]}return[0,0,0,0]},t.numberSpecifierReg=qr,t.obbSeparation=(t,e)=>{const n=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function r(t,e,n){const r=t.getRotatedCorners().map((t=>t.x*e+t.y*n));return{min:Math.min(...r),max:Math.max(...r)}}let u=0;for(const i of n){const n=r(t,i.x,i.y),s=r(e,i.x,i.y);let o;o=n.max<s.min?s.min-n.max:s.max<n.min?n.min-s.max:0,u=Math.max(u,o)}return u},t.ordinaryLeastSquares=function(t,e,n,r){const u=r-t*t;if(Math.abs(u)<Number.EPSILON)return{a:e,b:0};const i=(n-t*e)/u;return{a:e-i*t,b:i}},t.pad=K,t.parseUint8ToImageData=(t,e,n)=>{const r=new Uint8ClampedArray(t),u=new Uint8ClampedArray(t.length);for(let t=n-1;t>=0;t--)for(let i=0;i<e;i++){const s=t*e*4+4*i,o=(n-t)*e*4+4*i;u[o]=r[s],u[o+1]=r[s+1],u[o+2]=r[s+2],u[o+3]=r[s+3]}return new ImageData(u,e,n)},t.pi=kt,t.pi2=Rt,t.pick=function(t,e){if(!t||!h(t))return t;const n={};return e.forEach((e=>{v.call(t,e)&&(n[e]=t[e])})),n},t.pickWithout=function(t,e){if(!t||!h(t))return t;const n={};return Object.keys(t).forEach((r=>{const u=t[r];let i=!1;e.forEach((t=>{(c(t)&&t===r||t instanceof RegExp&&r.match(t))&&(i=!0)})),i||(n[r]=u)})),n},t.pointAt=function(t,e,n,r,u){let i=n,s=r;return"number"==typeof t&&"number"==typeof n&&(i=(1-u)*t+u*n),"number"==typeof e&&"number"==typeof r&&(s=(1-u)*e+u*r),{x:i,y:s}},t.pointBetweenLine=Pe,t.pointInAABB=function(t,e){return Fe(t,e,!1)},t.pointInLine=Ie,t.pointInOBB=function(t,e){return Le.x=(e.point1.x+e.point2.x)/2,Le.y=(e.point1.y+e.point2.y)/2,ke.x=(e.point3.x+e.point4.x)/2,ke.y=(e.point3.y+e.point4.y)/2,Ie(t,Le,ke,e.height)},t.pointInRect=Fe,t.polarToCartesian=function(t,e,n){return e?{x:t.x+e*Math.cos(n),y:t.y+e*Math.sin(n)}:{x:t.x,y:t.y}},t.polygonContainPoint=ze,t.polygonIntersectPolygon=function(t,e){for(let n=0;n<e.length;n++){if(ze(t,e[n].x,e[n].y))return!0;if(n>0&&We(e[n-1].x,e[n-1].y,e[n].x,e[n].y,t))return!0}return!1},t.pow=Yt,t.precisionAdd=function(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))},t.precisionSub=function(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))},t.quantileSorted=R,t.rSquared=vt,t.radianToDegree=re,t.randomLCG=ht,t.range=function(t,e,n){a(e)||(e=t,t=0),a(n)||(n=1);let r=-1;const u=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(u);for(;++r<u;)i[r]=t+r*n;return i},t.rectInsideAnotherRect=function(e,n,r){if(!e||!n)return t.InnerBBox.NONE;const{x11:u,x12:i,y11:s,y12:o,x21:a,x22:D,y21:l,y22:h}=fe(e,n,r);return u>a&&i<D&&s>l&&o<h?t.InnerBBox.BBOX1:a>u&&D<i&&l>s&&h<o?t.InnerBBox.BBOX2:t.InnerBBox.NONE},t.regressionBootstrap=function(t,e){var n;const r="linear"===e.method?1:null!==(n=e.degree)&&void 0!==n?n:NaN;if("linear"!==e.method&&"polynomial"!==e.method||!Number.isInteger(r)||r<1||!t.length||t.some((t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)))||e.grid.some((t=>!Number.isFinite(t)))||!(e.level>0&&e.level<1)||!Number.isInteger(e.resamples)||e.resamples<1||!Number.isInteger(e.seed)||e.seed<0||e.seed>4294967295)throw new RangeError("Invalid paired regression bootstrap inputs");if(t.length<=r+1)throw new RangeError("Regression bootstrap requires positive residual degrees of freedom");const u=t.slice().sort(((t,e)=>t.x-e.x||t.y-e.y)),i=mt(u);if(gt(u,r,i).rank<r+1)throw new RangeError("Original regression design is rank deficient");const s=ht(e.seed),o=new Array(u.length),a=e.grid.map((()=>new Array(e.resamples)));for(let t=0;t<e.resamples;t++){for(let t=0;t<o.length;t++)o[t]=u[Math.floor(s()*u.length)];const n=gt(o,r,i);for(let r=0;r<e.grid.length;r++){const u=pt(n,e.grid[r]);if(!Number.isFinite(u))throw new RangeError("Regression bootstrap prediction is not finite");a[r][t]=u}}const D=(1-e.level)/2;return e.grid.map(((t,e)=>(a[e].sort(((t,e)=>t-e)),{x:t,lower:R(a[e],D),upper:R(a[e],1-D)})))},t.regressionLinear=function(t,e=(t=>t.x),n=(t=>t.y),r){var u;const i=null!==(u=null==r?void 0:r.alpha)&&void 0!==u?u:.05,s=Ft(t,e,n),o=gt(s,1),a=yt(o),D=a[0],l=a[1],h=t=>pt(o,t),c=Mt(t,e,n,h);let f=0;return s.forEach(((t,e)=>{f+=(t.y-f)/(e+1)})),{coef:{a:D,b:l},rank:o.rank,predict:h,rSquared:vt(t,e,n,f,h),evaluateGrid:function(t){return xt(c.min,c.max,t,h)},confidenceInterval:function(t=50){const e=[];if(0===c.n||t<=0)return e;const n=Ct(i);if(c.min===c.max){const r=h(c.min),u=bt(c.min,c),i=Et(n,u.seMean),s=Et(n,u.sePred);for(let n=0;n<t;n++)e.push({x:c.min,mean:r,lower:r-i,upper:r+i,predLower:r-s,predUpper:r+s});return e}const r=(c.max-c.min)/(t-1);for(let u=0;u<t;u++){const i=u===t-1?c.max:c.min+r*u,s=h(i),o=bt(i,c),a=Et(n,o.seMean),D=Et(n,o.sePred);e.push({x:i,mean:s,lower:s-a,upper:s+a,predLower:s-D,predUpper:s+D})}return e}}},t.regressionLogistic=function(t,e=(t=>t.x),n=(t=>t.y),r){var u,i,s;const o=null!==(u=null==r?void 0:r.maxIteration)&&void 0!==u?u:25,a=null!==(i=null==r?void 0:r.tol)&&void 0!==i?i:1e-6,D=null!==(s=null==r?void 0:r.alpha)&&void 0!==s?s:.05,l=[],h=[];Bt(t,e,n,((t,e)=>{l.push(t),h.push(e?1:0)}));const c=l.length;if(0===c)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let f=0,F=0;for(let t=0;t<o;t++){const t=new Array(c);let e=!0;for(let e=0;e<c;e++){const n=f+F*l[e],r=1/(1+Math.exp(-n));t[e]=r}let n=0,r=0,u=0,i=0,s=0;for(let e=0;e<c;e++){const o=t[e]*(1-t[e]),a=h[e]-t[e];n+=a,r+=a*l[e],u+=o,i+=o*l[e],s+=o*l[e]*l[e]}const o=u*s-i*i;if(Math.abs(o)<1e-12)break;const D=(s*n-i*r)/o,d=(-i*n+u*r)/o;if(f+=D,F+=d,(Math.abs(D)>a||Math.abs(d)>a)&&(e=!1),e)break}const d=t=>{const e=f+F*t;return 1/(1+Math.exp(-e))};return{coef:[f,F],predict:d,evaluateGrid:function(r){const u=[];if(r<=0)return u;let i=1/0,s=-1/0;if(Bt(t,e,n,(t=>{t<i&&(i=t),t>s&&(s=t)})),i===1/0||s===-1/0)return u;if(i===s){const t=d(i);for(let e=0;e<r;e++)u.push({x:i,y:t});return u}const o=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+o*t;u.push({x:e,y:d(e)})}return u},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,d);if(0===i.n)return u;const s=Ct(D);if(i.min===i.max){const t=d(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const o=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+o*t,n=d(e),a=bt(e,i),D=Et(s,a.seMean),l=Et(s,a.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.regressionLowess=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i,s,o,a;const D=null!==(u=r.span)&&void 0!==u?u:2/3,l=null!==(i=r.degree)&&void 0!==i?i:1,h=null!==(s=r.iterations)&&void 0!==s?s:3,c=null!==(o=r.delta)&&void 0!==o?o:0,f=null!==(a=r.alpha)&&void 0!==a?a:.05;if(!(D>0&&D<=1)||!Number.isInteger(h)||h<0||!Number.isFinite(c)||c<0||0!==l&&1!==l||null!=r.maxSamples&&(!Number.isInteger(r.maxSamples)||r.maxSamples<2))throw new RangeError("Invalid LOWESS span, degree, iterations, delta or maxSamples");let F=Ft(t,e,n).sort(((t,e)=>t.x-e.x||t.y-e.y));if(null!=r.maxSamples&&F.length>r.maxSamples){const t=F,e=r.maxSamples;F=Array.from({length:e},((n,r)=>t[Math.floor(r*(t.length-1)/(e-1))]))}const d=F.length,m=F.map((t=>t.x)),g=F.map((t=>t.y)),p=mt(F),y=m.map((t=>dt(t,p.xCenter,p.xScale))),x=g.map((t=>dt(t,p.yCenter,p.yScale))),C=Math.min(d,Math.max(2,Math.floor(D*d+1e-10)));let E;function M(t){if(!d)return 0;const e=dt(t,p.xCenter,p.xScale);let n=0,r=d-C;for(;n<r;){const u=n+r>>>1,i=t-m[u],s=m[u+C]-t;(Number.isFinite(i)&&Number.isFinite(s)?i>s:e-y[u]>y[u+C]-e)?n=u+1:r=u}let u=n,i=n+C;if(m[u]===m[i-1]){for(;u>0&&m[u-1]===m[u];)u--;for(;i<d&&m[i]===m[u];)i++}const s=Math.max(Math.abs(m[u]-t),Math.abs(m[i-1]-t)),o=!Number.isFinite(s),a=o?Math.max(Math.abs(y[u]-e),Math.abs(y[i-1]-e)):s;let D=1/0,h=-1/0;for(let t=u;t<i;t++)D=Math.min(D,g[t]),h=Math.max(h,g[t]);const c=D/2+h/2,f=Math.max(Math.abs(D-c),Math.abs(h-c))||1;let F=0,x=0,M=0,b=0,B=0;for(let n=u;n<i;n++){const r=0===a?0:(o?y[n]-e:m[n]-t)/a,u=Math.abs(r),i=u>=1?0:1-u*u*u,s=i*i*i*(E?E[n]:1);F+=s,x+=s*r;const D=dt(g[n],c,f);M+=s*D,b+=s*r*r,B+=s*r*D}if(0===F){let n=1/0,r=0,u=0;for(let i=0;i<d;i++){const s=E?E[i]:1;if(0===s)continue;const a=Math.abs(o?y[i]-e:m[i]-t);a<n?(n=a,r=s,u=g[i]):a===n&&(u=u*(r/(r+s))+g[i]*(s/(r+s)),r+=s)}if(0===r)throw new RangeError("LOWESS has no effective local observations");return u}const v=x/F,w=M/F,A=b/F-v*v;return c+f*(w-(0===l||A<=32*Number.EPSILON?0:(B/F-v*w)/A)*v)}const b=[];for(let t=0;t<d&&(b.push(t),t!==d-1);){let e=t+1;if(c>0)for(;e+1<d&&m[e+1]-m[t]<=c;)e++;for(;e+1<d&&m[e+1]===m[e];)e++;t=e}let B=new Array(d);function v(){const t=new Array(d);for(let e=0;e<b.length;e++){const n=b[e];if(t[n]=M(m[n]),0===e)continue;const r=b[e-1],u=m[n]-m[r],i=Number.isFinite(u)?u:y[n]-y[r];for(let e=r+1;e<n;e++){const s=0===i?0:(Number.isFinite(u)?m[e]-m[r]:y[e]-y[r])/i;t[e]=t[r]*(1-s)+t[n]*s}}return t}for(let t=0;t<=h&&(B=v(),t!==h);t++){const t=B.map(((t,e)=>{const n=g[e]-t;return Number.isFinite(n)?Math.abs(n/p.yScale):Math.abs(x[e]-dt(t,p.yCenter,p.yScale))})),e=Y(t.slice()),n=B;E=t.map(((t,r)=>{if(0===e){return t<=64*Number.EPSILON*(Math.max(Math.abs(g[r]),Math.abs(n[r]))/p.yScale)?1:0}const u=t/(6*e);return u>=1?0:(1-u*u)**2}))}function w(t){if(0===c||d<2||t<m[0]||t>m[d-1])return M(t);let e=0,n=d-1;for(;n-e>1;){const r=e+n>>>1;m[r]<=t?e=r:n=r}if(m[n]===m[e])return B[e];const r=m[n]-m[e],u=Number.isFinite(r)?(t-m[e])/r:(dt(t,p.xCenter,p.xScale)-y[e])/(y[n]-y[e]);return B[e]*(1-u)+B[n]*u}function A(t){return Array.isArray(t)?t.map(w):w(t)}return{predict:A,evaluate:A,evaluateGrid:function(t){return xt(m[0],m[d-1],t,w)},confidenceInterval:function(r=50){const u=[];if(r<=0)return u;if(0===d)return u;const i=m[0],s=m[d-1];if(void 0===i||void 0===s||i===1/0||s===-1/0)return u;const o=Mt(t,e,n,(t=>w(t)));if(0===o.n)return u;const a=Ct(f);if(o.min===o.max){const t=w(o.min),e=bt(o.min,o),n=Et(a,e.seMean),i=Et(a,e.sePred);for(let e=0;e<r;e++)u.push({x:o.min,mean:t,lower:t-n,upper:t+n,predLower:t-i,predUpper:t+i});return u}const D=(s-i)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?s:i+D*t,n=w(e),l=bt(e,o),h=Et(a,l.seMean),c=Et(a,l.sePred);u.push({x:e,mean:n,lower:n-h,upper:n+h,predLower:n-c,predUpper:n+c})}return u},fitted:F.map(((t,e)=>({x:t.x,y:B[e]})))}},t.regressionPolynomial=function(t,e=(t=>t.x),n=(t=>t.y),r={}){var u,i;const s=null!==(u=r.degree)&&void 0!==u?u:0;if(!Number.isInteger(s)||s<0)throw new RangeError("Polynomial degree must be an nonnegative integer");const o=null!==(i=r.alpha)&&void 0!==i?i:.05,a=Ft(t,e,n),D=gt(a,s),l=yt(D),h=t=>pt(D,t);return{degree:s,rank:D.rank,coef:l,predict:h,rSquared:vt(t,e,n,(()=>{let r=0,u=0;return Bt(t,e,n,((t,e)=>{r+=e,u++})),0===u?0:r/u})(),h),evaluateGrid(t){let e=1/0,n=-1/0;return a.forEach((t=>{e=Math.min(e,t.x),n=Math.max(n,t.x)})),xt(e,n,t,h)},confidenceInterval(r=50){const u=[];if(r<=0)return u;const i=Mt(t,e,n,h);if(0===i.n)return u;const s=Ct(o);if(i.min===i.max){const t=h(i.min),e=bt(i.min,i),n=Et(s,e.seMean),o=Et(s,e.sePred);for(let e=0;e<r;e++)u.push({x:i.min,mean:t,lower:t-n,upper:t+n,predLower:t-o,predUpper:t+o});return u}const a=(i.max-i.min)/(r-1);for(let t=0;t<r;t++){const e=t===r-1?i.max:i.min+a*t,n=h(e),o=bt(e,i),D=Et(s,o.seMean),l=Et(s,o.sePred);u.push({x:e,mean:n,lower:n-D,upper:n+D,predLower:n-l,predUpper:n+l})}return u}}},t.rgbToHex=mn,t.rgbToHsl=rn,t.rotatePoint=me,t.scale=Zr,t.scott=At,t.secondCount=mr,t.secondField=gr,t.secondFloor=Fr,t.secondOffset=dr,t.secondsGetterName=bn,t.secondsSetterName=function(t){return t?"setUTCSeconds":"setSeconds"},t.seedRandom=function(t){return parseFloat("0."+Math.sin(t).toString().substring(6))},t.shuffleArray=function(t,e=Math.random){let n,r,u=t.length;for(;u;)n=Math.floor(e()*u),r=t[--u],t[u]=t[n],t[n]=r;return t},t.silverman=St,t.simpleField=t=>t?"string"==typeof t||"number"==typeof t?()=>t:s(t)?t:e=>e[t.field]:null,t.sin=zt,t.span=t=>t.length<=1?0:k(t)-t[0],t.sqrt=jt,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=Ge(t)).length)return 0;t=t.replace(Xe()," ");const n=e?1:2;let r=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($e(e)){case"F":case"W":r+=2;break;case"A":r+=n;break;default:r+=1}}return r},t.styleStringToObject=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const n=t.split(":");if(2===n.length){const t=n[0].trim(),r=n[1].trim();t&&r&&(e[t]=r)}}})),e},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,n)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n])):t},t.tau=Ut,t.throttle=function(t,e,n){let r=!0,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return D(n)&&(r="leading"in n?!!n.leading:r,u="trailing"in n?!!n.trailing:u),nt(t,e,{leading:r,trailing:u,maxWait:e})},t.tickStep=function(t,e,n){const r=Math.abs(e-t)/Math.max(0,n);let u=Math.pow(10,Math.floor(Math.log(r)/Math.LN10));const i=r/u;return i>=G?u*=10:i>=V?u*=5:i>=$&&(u*=2),e<t?-u:u},t.toCamelCase=function(t){return t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase()))},t.toDate=ot,t.toNumber=U,t.toPercent=(t,e)=>o(t)?e:c(t)?e*parseFloat(t)/100:t,t.toValidNumber=function(t){if(g(t))return t;const e=+t;return g(e)?e:0},t.transformBounds=function(t,e,n,r,u,i,s){if(!(Ot(r)<=Lt||Ot(u)<=Lt)){if(1!==r&&t.scaleX(r),1!==u&&t.scaleY(u),isFinite(i)&&Math.abs(i)>Lt){let e=0,n=0;void 0!==s&&(e=s[0],n=s[1]),t.rotate(i,e,n)}t.translate(e,n)}},t.transformBoundsWithMatrix=Qe,t.truncate=(t,e,n="right",r)=>{const u=o(r)?"…":r,i=t+"",s=i.length,a=Math.max(0,e-u.length);return s<=e?i:"left"===n?u+i.slice(s-a):"center"===n?i.slice(0,Math.ceil(a/2))+u+i.slice(s-Math.floor(a/2)):i.slice(0,a)+u},t.unionAABB=Ne,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=Qn,t.utcDayField=Kn,t.utcDayFloor=Zn,t.utcDayOffset=Jn,t.utcHourField=sr,t.utcHourFloor=ur,t.utcHourOffset=ir,t.utcMinuteField=fr,t.utcMinuteFloor=hr,t.utcMinuteOffset=cr,t.utcMonthCount=jn,t.utcMonthField=Yn,t.utcMonthFloor=Wn,t.utcMonthOffset=zn,t.utcSecondField=xr,t.utcSecondFloor=pr,t.utcSecondOffset=yr,t.utcYearCount=Un,t.utcYearField=Rn,t.utcYearFloor=kn,t.utcYearOffset=In,t.uuid=(t,e)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];let u;if(e=e||n.length,t)for(u=0;u<t;u++)r[u]=n[0|Math.random()*e];else{let t;for(r[8]=r[13]=r[18]=r[23]="-",r[14]="4",u=0;u<36;u++)r[u]||(t=0|16*Math.random(),r[u]=n[19===u?3&t|8:t])}return r.join("")},t.variance=j,t.visitPoints=Bt,t.weightedSum=Jr,t.yearCount=Nn,t.yearField=Ln,t.yearFloor=Tn,t.yearOffset=_n,t.zero=t=>0,t.zeros=$r,t.zerosM=function(t,e){return $r(t).map((function(){return $r(e)}))}}));
|