@visactor/vutils 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/common/ecdf.d.ts +10 -0
- package/cjs/common/ecdf.js +52 -0
- package/cjs/common/ecdf.js.map +1 -0
- package/cjs/common/index.d.ts +5 -0
- package/cjs/common/index.js +4 -2
- package/cjs/common/index.js.map +1 -1
- package/cjs/common/interpolate.js +2 -1
- package/cjs/common/isPlainObject.js +1 -2
- package/cjs/common/isPrototype.js +2 -1
- package/cjs/common/isValidNumber.js +1 -1
- package/cjs/common/kde.d.ts +21 -0
- package/cjs/common/kde.js +126 -0
- package/cjs/common/kde.js.map +1 -0
- package/cjs/common/regression-linear.d.ts +31 -6
- package/cjs/common/regression-linear.js +97 -20
- package/cjs/common/regression-linear.js.map +1 -1
- package/cjs/common/regression-logistic.d.ts +20 -0
- package/cjs/common/regression-logistic.js +110 -0
- package/cjs/common/regression-logistic.js.map +1 -0
- package/cjs/common/regression-lowess.d.ts +21 -0
- package/cjs/common/regression-lowess.js +141 -0
- package/cjs/common/regression-lowess.js.map +1 -0
- package/cjs/common/regression-polynomial.d.ts +21 -0
- package/cjs/common/regression-polynomial.js +143 -0
- package/cjs/common/regression-polynomial.js.map +1 -0
- package/cjs/common/regression-utils.d.ts +20 -0
- package/cjs/common/regression-utils.js +76 -0
- package/cjs/common/regression-utils.js.map +1 -0
- package/dist/index.js +937 -36
- package/dist/index.min.js +1 -1
- package/es/common/ecdf.d.ts +10 -0
- package/es/common/ecdf.js +48 -0
- package/es/common/ecdf.js.map +1 -0
- package/es/common/index.d.ts +5 -0
- package/es/common/index.js +10 -1
- package/es/common/index.js.map +1 -1
- package/es/common/interpolate.js +2 -1
- package/es/common/isPlainObject.js +1 -2
- package/es/common/isPrototype.js +2 -1
- package/es/common/isValidNumber.js +1 -1
- package/es/common/kde.d.ts +21 -0
- package/es/common/kde.js +117 -0
- package/es/common/kde.js.map +1 -0
- package/es/common/regression-linear.d.ts +31 -6
- package/es/common/regression-linear.js +97 -18
- package/es/common/regression-linear.js.map +1 -1
- package/es/common/regression-logistic.d.ts +20 -0
- package/es/common/regression-logistic.js +105 -0
- package/es/common/regression-logistic.js.map +1 -0
- package/es/common/regression-lowess.d.ts +21 -0
- package/es/common/regression-lowess.js +136 -0
- package/es/common/regression-lowess.js.map +1 -0
- package/es/common/regression-polynomial.d.ts +21 -0
- package/es/common/regression-polynomial.js +134 -0
- package/es/common/regression-polynomial.js.map +1 -0
- package/es/common/regression-utils.d.ts +20 -0
- package/es/common/regression-utils.js +63 -0
- package/es/common/regression-utils.js.map +1 -0
- package/package.json +3 -3
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VUtils={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,u="~";function n(){}function r(t,e,u){this.fn=t,this.context=e,this.once=u||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new r(n,i||t,s),D=u?u+e:e;return t._events[D]?t._events[D].fn?t._events[D]=[t._events[D],o]:t._events[D].push(o):(t._events[D]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(u=!1)),o.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(u?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=u?u+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,s=new Array(i);r<i;r++)s[r]=n[r].fn;return s},o.prototype.listenerCount=function(t){var e=u?u+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,r,i,s){var o=u?u+t:t;if(!this._events[o])return!1;var D,a,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,n),!0;case 4:return h.fn.call(h.context,e,n,r),!0;case 5:return h.fn.call(h.context,e,n,r,i),!0;case 6:return h.fn.call(h.context,e,n,r,i,s),!0}for(a=1,D=new Array(l-1);a<l;a++)D[a-1]=arguments[a];h.fn.apply(h.context,D)}else{var c,f=h.length;for(a=0;a<f;a++)switch(h[a].once&&this.removeListener(t,h[a].fn,void 0,!0),l){case 1:h[a].fn.call(h[a].context);break;case 2:h[a].fn.call(h[a].context,e);break;case 3:h[a].fn.call(h[a].context,e,n);break;case 4:h[a].fn.call(h[a].context,e,n,r);break;default:if(!D)for(c=1,D=new Array(l-1);c<l;c++)D[c-1]=arguments[c];h[a].fn.apply(h[a].context,D)}}return!0},o.prototype.on=function(t,e,u){return i(this,t,e,u,!1)},o.prototype.once=function(t,e,u){return i(this,t,e,u,!0)},o.prototype.removeListener=function(t,e,n,r){var i=u?u+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||n&&o.context!==n||s(this,i);else{for(var D=0,a=[],h=o.length;D<h;D++)(o[D].fn!==e||r&&!o[D].once||n&&o[D].context!==n)&&a.push(o[D]);a.length?this._events[i]=1===a.length?a[0]:a:s(this,i)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=u?u+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=u,o.EventEmitter=o,t.exports=o}(u);var n=e(u.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,D=t=>null!=t,a=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},h=t=>"object"==typeof t&&null!==t,l=function(t){if(!h(t)||!r(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},c=(t,e=!1)=>{const u=typeof t;return e?"string"===u:"string"===u||r(t,"String")},f=t=>Array.isArray?Array.isArray(t):r(t,"Array"),F=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},d=t=>r(t,"Date"),g=(t,e=!1)=>{const u=typeof t;return e?"number"===u:"number"===u||r(t,"Number")},m=t=>g(t)&&Number.isFinite(t),C=t=>r(t,"RegExp"),y=Object.prototype,p=Object.prototype.hasOwnProperty;const x=(t,e,u)=>{const n=c(e)?e.split("."):e;for(let e=0;e<n.length;e++)t=t?t[n[e]]:void 0;return void 0===t?u:t},E=Object.prototype.hasOwnProperty;function M(t,e,u=!1,n=!1){if(e){if(t===e)return;if(D(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];!D(r[s])||"object"!=typeof r[s]||n&&f(t[s])?b(t,s,r[s]):B(t,e,s,u,n)}}}}function B(t,e,u,n=!1,r=!1){const i=t[u],s=e[u];let o=e[u],D=!0;if(f(s)){if(n)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={})):D=!1;D&&M(o,s,n,r),b(t,u,o)}function b(t,e,u){(void 0!==u&&!function(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t[e],u)||void 0===u&&!(e in t))&&(t[e]=u)}const 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:a(t)?Object.keys(t).length:0}function _(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const u in t)t.hasOwnProperty(u)&&e.push(u);return e}function L(t,e,u){const n=_(e);for(let r=0;r<n.length;r++){const i=n[r];(u?null!=e[i]:null==t[i])&&(t[i]=e[i])}return t}function N(t){return D(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 H(t,e,u=U){const n=t.length;if(!n)return;if(e<=0||n<2)return u(t[0],0,t);if(e>=1)return u(t[n-1],n-1,t);const r=(n-1)*e,i=Math.floor(r),s=u(t[i],i,t);return s+(u(t[i+1],i+1,t)-s)*(r-i)}const O="undefined"!=typeof console;function R(t,e,u){const n=[e].concat([].slice.call(u));O&&console[t].apply(console,n)}var P;t.LoggerLevel=void 0,(P=t.LoggerLevel||(t.LoggerLevel={}))[P.None=0]="None",P[P.Error=1]="Error",P[P.Warn=2]="Warn",P[P.Info=3]="Info",P[P.Debug=4]="Debug";class W{static getInstance(t,e){return W._instance&&g(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,u){this._onErrorHandler=[],this._level=e,this._method=u}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=t.LoggerLevel.Info}canLogDebug(){return this._level>=t.LoggerLevel.Debug}canLogError(){return this._level>=t.LoggerLevel.Error}canLogWarn(){return this._level>=t.LoggerLevel.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...e){var u;return this._level>=t.LoggerLevel.Error&&(this._onErrorHandler.length?this.callErrorHandler(...e):R(null!==(u=this._method)&&void 0!==u?u:"error","ERROR",e)),this}warn(...e){return this._level>=t.LoggerLevel.Warn&&R(this._method||"warn","WARN",e),this}info(...e){return this._level>=t.LoggerLevel.Info&&R(this._method||"log","INFO",e),this}debug(...e){return this._level>=t.LoggerLevel.Debug&&R(this._method||"log","DEBUG",e),this}}W._instance=null;const z=(t,e,u)=>{let n=t,r=e;for(;n<r;){const t=Math.floor((n+r)/2);u(t)>=0?r=t:n=t+1}return n};function j(t,e){let u,n=0,r=0,i=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(u=e-r,r+=u/++n,i+=u*(e-r));else{let s=-1;for(let o of t)null!=(o=e(o,++s,t))&&(o=+o)>=o&&(u=o-r,r+=u/++n,i+=u*(o-r))}return n>1?i/(n-1):0}const Y=Math.sqrt(50),q=Math.sqrt(10),G=Math.sqrt(2);const V=1e-10,$=1e-10;function X(t,e,u=$,n=V){const r=n,i=u*Math.max(t,e);return Math.abs(t-e)<=Math.max(r,i)}const Z=(t,e=0)=>{let u="",n=e-1;for(;n>=0;)u=`${u}${t}`,n-=1;return u},J=(t,e,u=" ",n="right")=>{const r=u,i=t+"",s=e-i.length;return s<=0?i:"left"===n?Z(r,s)+i:"center"===n?Z(r,Math.floor(s/2))+i+Z(r,Math.ceil(s/2)):i+Z(r,s)},Q=function(t,e,u){return t<e?e:t>u?u:t};let K=!1;try{K="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){K=!1}function tt(t,e,u){let n,r,i,s,o,D,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 u=n,i=r;return n=r=void 0,h=e,s=t.apply(i,u),s}function g(t,e){return F?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function C(t){const u=t-D;return void 0===D||u>=e||u<0||c&&t-h>=i}function y(){const t=Date.now();if(C(t))return p(t);o=g(y,function(t){const u=t-h,n=e-(t-D);return c?Math.min(n,i-u):n}(t))}function p(t){return o=void 0,f&&n?d(t):(n=r=void 0,s)}function x(...t){const u=Date.now(),i=C(u);if(n=t,r=this,D=u,i){if(void 0===o)return function(t){return h=t,o=g(y,e),l?d(t):s}(D);if(c)return o=g(y,e),d(D)}return void 0===o&&(o=g(y,e)),s}return e=+e||0,a(u)&&(l=!!u.leading,c="maxWait"in u,c&&(i=Math.max(m(u.maxWait)?u.maxWait:0,e)),f="trailing"in u?!!u.trailing:f),x.cancel=function(){void 0!==o&&function(t){if(F)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,n=D=r=o=void 0},x.flush=function(){return void 0===o?s:p(Date.now())},x.pending=function(){return void 0!==o},x}function et(t,e){return u=>t*(1-u)+e*u}K=!1;const ut=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nt=new RegExp(ut.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 u=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(u-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,u,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return o(t)?new Date(NaN):new Date(Math.round(t))}const st=4294967296;const ot=t=>e=>x(e,t),Dt=(t,e={})=>{if(s(t))return t;const u=[t];return(e&&e.get||ot)(u)};function at(t,e,u,n){const r=n-t*t,i=Math.abs(r)<1e-24?0:(u-t*e)/r;return[e-i*t,i]}function ht(t,e,u,n){let r,i,s=-1;t.forEach((t=>{r=e(t),i=u(t),!o(r)&&(r=+r)>=r&&!o(i)&&(i=+i)>=i&&n(r,i,++s)}))}function lt(t,e,u,n,r){let i=0,s=0;return ht(t,e,u,((t,e)=>{const u=e-r(t),o=e-n;i+=u*u,s+=o*o})),1-i/s}class ct{}const ft=1e-12,Ft=Math.PI,dt=Ft/2,gt=2*Ft,mt=2*Math.PI,Ct=Math.abs,yt=Math.atan2,pt=Math.cos,xt=Math.max,Et=Math.min,Mt=Math.sin,Bt=Math.sqrt,bt=Math.pow;function vt(t,e,u){const n=u.x-e.x,r=u.y-e.y,i=t.x-e.x,s=t.y-e.y;return Math.abs(n*s-i*r)/Math.sqrt(n*n+r*r)}function At(t,e){return t[0]*e[1]-t[1]*e[0]}function wt(t,e){return t.x*e.y-t.y*e.x}function St(t,e){let u=0;for(let n=0;n<t.length;++n)u+=t[n]*e[n];return u}function Tt(t,e){return Ct(t[0]-e[0])+Ct(t[1]-e[1])<ft}function _t(t,e=10){return Math.round(t*e)/e}function Lt(t){const e=t.toString().split(/[eE]/),u=(e[0].split(".")[1]||"").length-(+e[1]||0);return u>0?u:0}class Nt{constructor(t=0,e=0,u,n){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=u,this.y1=n}clone(){return new Nt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return g(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return g(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class kt{static distancePP(t,e){return Bt(bt(t.x-e.x,2)+bt(t.y-e.y,2))}static distanceNN(t,e,u,n){return Bt(bt(t-u,2)+bt(e-n,2))}static distancePN(t,e,u){return Bt(bt(e-t.x,2)+bt(u-t.y,2))}static pointAtPP(t,e,u){return new Nt((e.x-t.x)*u+t.x,(e.y-t.y)*u+t.y)}}class It{constructor(t=0,e=0,u,n){this.r=0,this.theta=0,this.r=t,this.theta=e,this.r1=u,this.theta1=n}clone(){return new It(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 Ut(t){return t*(Math.PI/180)}function Ht(t){return 180*t/Math.PI}const Ot=(t=0)=>{if(t<0)for(;t<-gt;)t+=gt;else if(t>0)for(;t>gt;)t-=gt;return t},Rt=Ot,Pt=(t=0)=>t>360||t<-360?t%360:t,Wt=Pt;function zt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function jt(t,e){const u=Math.abs(e-t);if(u>=2*Math.PI||2*Math.PI-u<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const n=zt(Math.min(t,e)),r=n+u,i=[n,r];let s=Math.floor(n/Math.PI)*Math.PI/2;for(;s<r;)s>n&&i.push(s),s+=Math.PI/2;return i}function Yt(t,e,u){t[0]=e[0]-u[0],t[1]=e[1]-u[1]}function qt(t,e,u,n){let r=t[0],i=e[0],s=u[0],o=n[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=u[1],o=n[1],i<r&&([r,i]=[i,r]),o<s&&([o,s]=[s,o]),!(i<s||o<r))}var Gt;t.InnerBBox=void 0,(Gt=t.InnerBBox||(t.InnerBBox={}))[Gt.NONE=0]="NONE",Gt[Gt.BBOX1=1]="BBOX1",Gt[Gt.BBOX2=2]="BBOX2";const Vt=(t,e,u)=>{let n=t.x1,r=t.x2,i=t.y1,s=t.y2,o=e.x1,D=e.x2,a=e.y1,h=e.y2;return u&&(n>r&&([n,r]=[r,n]),i>s&&([i,s]=[s,i]),o>D&&([o,D]=[D,o]),a>h&&([a,h]=[h,a])),{x11:n,x12:r,y11:i,y12:s,x21:o,x22:D,y21:a,y22:h}};function $t(t,e,u){if(!e)return!0;if(!u)return t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let n=e.x1,r=e.x2,i=e.y1,s=e.y2;return n>r&&([n,r]=[r,n]),i>s&&([i,s]=[s,i]),t.x>=n&&t.x<=r&&t.y>=i&&t.y<=s}function Xt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},u,n={x:0,y:0}){return{x:(t-n.x)*Math.cos(u)-(e-n.y)*Math.sin(u)+n.x,y:(t-n.x)*Math.sin(u)+(e-n.y)*Math.cos(u)+n.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const u=e?Ut(t.angle):t.angle,n=Jt(t);return[Zt({x:t.x1,y:t.y1},u,n),Zt({x:t.x2,y:t.y1},u,n),Zt({x:t.x2,y:t.y2},u,n),Zt({x:t.x1,y:t.y2},u,n)]}function Kt(t,e,u=!1){const n=Qt(t,u),r=Qt(e,u),i=(t,e)=>[e.x-t.x,e.y-t.y],s=i(Jt(t),Jt(e)),o=i(n[0],n[1]),D=i(n[1],n[2]),a=i(r[0],r[1]),h=i(r[1],r[2]),l=u?Ut(t.angle):t.angle;let c=u?Ut(90-t.angle):t.angle+dt;const f=u?Ut(e.angle):e.angle;let F=u?Ut(90-e.angle):e.angle+dt;c>mt&&(c-=mt),F>mt&&(F-=mt);const d=(t,e,u,n)=>{const r=[Math.cos(e),Math.sin(e)];return t+(Xt(r,u)+Xt(r,n))/2>Xt(r,s)};return d((t.x2-t.x1)/2,l,a,h)&&d((t.y2-t.y1)/2,c,a,h)&&d((e.x2-e.x1)/2,f,o,D)&&d((e.y2-e.y1)/2,F,o,D)}let te,ee,ue,ne,re,ie,se,oe,De,ae,he,le;function ce(t,e,u=3,n=!1){let r=t.x1,i=t.x2,s=t.y1,o=t.y2,D=e.x1,a=e.x2,h=e.y1,l=e.y2;if(n){let t;r>i&&(t=r,r=i,i=t),s>o&&(t=s,s=o,o=t),D>a&&(t=D,D=a,a=t),h>l&&(t=h,h=l,l=t)}if(r>=a||i<=D||s>=l||o<=h)return[t,e];const c=(i-r+2*u)*(o-s+2*u),f=(a-D+2*u)*(l-h+2*u),F=Math.min(r,D),d=Math.min(s,h),g=Math.max(i,a),m=Math.max(o,l);return c+f>(g-F)*(m-d)?[{x1:F,x2:g,y1:d,y2:m}]:[t,e]}const fe={x:0,y:0},Fe={x:0,y:0};function de(t,e,u,n){return vt(t,e,u)<=n/2&&ye(t,e,u)}const ge={x:0,y:0},me={x:0,y:0},Ce={x:0,y:0};function ye(t,e,u){return ge.x=e.x-t.x,ge.y=e.y-t.y,me.x=u.x-t.x,me.y=u.y-t.y,Ce.x=e.y-u.y,Ce.y=u.x-e.x,wt(ge,Ce)*wt(me,Ce)<0}class pe{constructor(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}setCanvas(t){this.canvas=t,t&&(this.ctx=t.getContext("2d"))}measureText(t){return this.canvas?this.measureTextByCanvas(t):(console.warn("[warn] no canvas, measureText might be not accurate"),this.estimate(t))}measureTextByCanvas(t){return this.ctx?(this.ctx.font=function({fontStyle:t,fontVariant:e,fontWeight:u,fontSize:n,fontFamily:r}){return(t?t+" ":"")+(e?e+" ":"")+(u?u+" ":"")+(n||12)+"px "+(r||"sans-serif")}(t),{width:this.ctx.measureText(t.text).width,height:t.fontSize}):(console.error("[error!!!]measureTextByCanvas can not be called without canvas"),{width:-1,height:t.fontSize})}estimate({text:t,fontSize:e}){let u=0,n=0;for(let e=0;e<t.length;e++)t.charCodeAt(e)<128?u++:n++;return{width:~~(.8*u*e+n*e),height:e}}static getDefaultUtils(t){return pe.instance||(pe.instance=new pe(t)),pe.instance}}const xe=1e-8;function Ee(t,e,u,n,r){for(let i=0,s=r[r.length-1];i<r.length;i++){const o=r[i];if(qt([t,e],[u,n],[o.x,o.y],[s.x,s.y]))return!0;s=o}return!1}function Me(t,e,u){let n=0,r=t[0];if(!r)return!1;for(let i=1;i<t.length;i++){const s=t[i];n+=Be(r.x,r.y,s.x,s.y,e,u),r=s}const i=t[0];return be(r.x,i.x)&&be(r.y,i.y)||(n+=Be(r.x,r.y,i.x,i.y,e,u)),0!==n}function Be(t,e,u,n,r,i){if(i>e&&i>n||i<e&&i<n)return 0;if(n===e)return 0;const s=(i-e)/(n-e);let o=n<e?1:-1;1!==s&&0!==s||(o=n<e?.5:-.5);const D=s*(u-t)+t;return D===r?1/0:D>r?o:0}function be(t,e){return Math.abs(t-e)<xe}const ve=t=>{if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Ae(),"")},Ae=({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")},we=t=>{let e=t.charCodeAt(0),u=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=u&&u<=57343&&(e&=1023,u&=1023,n=e<<10|u,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},Se=()=>/[#*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 Te(t,e={},u){u||(u=1);const{fontStyle:n=e.fontStyle,fontVariant:r=e.fontVariant,fontWeight:i=e.fontWeight,fontSize:s=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(r?r+" ":"")+(i?i+" ":"")+s*u+"px "+(o||"sans-serif")}class _e{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(),D(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=D(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(o(this._canvas)&&(D(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),o(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&D(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),o(this._context)&&D(this._canvas)){const t=this._canvas.getContext("2d");D(t)&&(t.save(),t.font=Te(this.textSpec),this._contextSaved=!0,this._context=t)}return!o(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,u;const{defaultFontParams:n={}}=this._option,{fontStyle:r=n.fontStyle,fontVariant:i=n.fontVariant,fontWeight:s=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:D=(null!==(u=n.fontFamily)&&void 0!==u?u:"sans-serif"),align:a,textAlign:h=(null!=a?a:"center"),baseline:l,textBaseline:f=(null!=l?l:"middle"),ellipsis:F,limit:d}=this._userSpec;let{lineHeight:g=o}=this._userSpec;if(c(g)&&"%"===g[g.length-1]){const t=Number.parseFloat(g.substring(0,g.length-1))/100;g=o*t}return{fontStyle:r,fontVariant:i,fontFamily:D,fontSize:o,fontWeight:s,textAlign:h,textBaseline:f,ellipsis:F,limit:d,lineHeight:g}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(o(t))return{width:0,height:0};if(o(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:u,fontWeight:n,textAlign:r,textBaseline:i,ellipsis:s,limit:D,lineHeight:a}=this.textSpec;let h;try{const o=this._option.getTextBounds({text:t,fontFamily:e,fontSize:u,fontWeight:n,textAlign:r,textBaseline:i,ellipsis:!!s,maxLineWidth:D||1/0,lineHeight:a});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 u=this._context.measureText(t),{fontSize:n,lineHeight:r}=this.textSpec;return{width:u.width,height:null!==(e=r)&&void 0!==e?e:n,fontBoundingBoxAscent:u.fontBoundingBoxAscent,fontBoundingBoxDescent:u.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let u=0;u<t.length;u++){const n=t[u];let r=this._measureSpecialChar(n);o(r)&&_e.NUMBERS_CHAR_SET.includes(n)&&(r=this._measureNumberChar()),o(r)&&["F","W"].includes(we(n))&&(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 u={width:0,height:0},{fontSize:n,lineHeight:r}=this.textSpec;for(let e=0;e<t.length;e++){const r=t[e],i=["F","W"].includes(we(r))?1:.53;u.width+=i*n}return u.height=null!==(e=r)&&void 0!==e?e:n,u}_measureReduce(t,e){var u;const{fontSize:n,lineHeight:r}=this.textSpec,i={width:0,height:0};if(o(t))return i;if(f(t)){const s=t.filter(D).map((t=>t.toString()));return 0===s.length?i:1===s.length?e(s[0]):{width:s.reduce(((t,u)=>Math.max(t,e(u).width)),0),height:s.length*((null!==(u=r)&&void 0!==u?u:n)+1)+1}}return e(t.toString())}_measureNumberChar(){if(o(this._numberCharSize)){const t=this._standardMethod(_e.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/_e.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(_e.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(o(this._letterCharSize)){const t=this._standardMethod(_e.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/_e.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return D(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){D(this._canvas)&&(this._canvas=null),D(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}_e.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",_e.NUMBERS_CHAR_SET="0123456789",_e.FULL_SIZE_CHAR="字";function Le(t,e,u){const{x1:n,y1:r,x2:i,y2:s}=e;return u.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(u.e,u.f),e):(t.clear(),t.add(u.a*n+u.c*r+u.e,u.b*n+u.d*r+u.f),t.add(u.a*i+u.c*r+u.e,u.b*i+u.d*r+u.f),t.add(u.a*i+u.c*s+u.e,u.b*i+u.d*s+u.f),t.add(u.a*n+u.c*s+u.e,u.b*n+u.d*s+u.f),e)}class Ne{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ne(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(t=0,e=0,u=0,n=0){return this.x1=t,this.y1=e,this.x2=u,this.y2=n,this}set(t=0,e=0,u=0,n=0){return u<t?(this.x2=t,this.x1=u):(this.x1=t,this.x2=u),n<e?(this.y2=e,this.y1=n):(this.y1=e,this.y2=n),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return f(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,u=0){const n=this.rotatedPoints(t,e,u);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(t=0,e=0,u=0,n=0){const r=this.scalePoints(t,e,u,n);return this.clear().add(r[0],r[1]).add(r[2],r[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Le(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,u){const{x1:n,y1:r,x2:i,y2:s}=this,o=Math.cos(t),D=Math.sin(t),a=e-e*o+u*D,h=u-e*D-u*o;return[o*n-D*r+a,D*n+o*r+h,o*n-D*s+a,D*n+o*s+h,o*i-D*r+a,D*i+o*r+h,o*i-D*s+a,D*i+o*s+h]}scalePoints(t,e,u,n){const{x1:r,y1:i,x2:s,y2:o}=this;return[t*r+(1-t)*u,e*i+(1-e)*n,t*s+(1-t)*u,e*o+(1-e)*n]}}class ke extends Ne{constructor(t,e=0){var u;super(t),t&&(this.angle=null!==(u=t.angle)&&void 0!==u?u:e)}intersects(t){return Kt(this,t)}setValue(t=0,e=0,u=0,n=0,r=0){return super.setValue(t,e,u,n),this.angle=r,this}clone(){return new ke(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class Ie{constructor(t=1,e=0,u=0,n=1,r=0,i=0){this.a=t,this.b=e,this.c=u,this.d=n,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,u,n,r,i){return!(this.e!==r||this.f!==i||this.a!==t||this.d!==n||this.b!==e||this.c!==u)}setValue(t,e,u,n,r,i){return this.a=t,this.b=e,this.c=u,this.d=n,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,u=this.c,n=this.d,r=this.e,i=this.f,s=new Ie,o=t*n-e*u;return s.a=n/o,s.b=-e/o,s.c=-u/o,s.d=t/o,s.e=(u*i-n*r)/o,s.f=-(t*i-e*r)/o,s}rotate(t){const e=Math.cos(t),u=Math.sin(t),n=this.a*e+this.c*u,r=this.b*e+this.d*u,i=this.a*-u+this.c*e,s=this.b*-u+this.d*e;return this.a=n,this.b=r,this.c=i,this.d=s,this}rotateByCenter(t,e,u){const n=Math.cos(t),r=Math.sin(t),i=(1-n)*e+r*u,s=(1-n)*u-r*e,o=n*this.a-r*this.b,D=r*this.a+n*this.b,a=n*this.c-r*this.d,h=r*this.c+n*this.d,l=n*this.e-r*this.f+i,c=r*this.e+n*this.f+s;return this.a=o,this.b=D,this.c=a,this.d=h,this.e=l,this.f=c,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,u,n,r,i){return this.multiply(t,e,u,n,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:u,d:n,e:r,f:i}=this;return this.a=e,this.b=t,this.c=n,this.d=u,this.e=i,this.f=r,this}multiply(t,e,u,n,r,i){const s=this.a,o=this.b,D=this.c,a=this.d,h=s*t+D*e,l=o*t+a*e,c=s*u+D*n,f=o*u+a*n,F=s*r+D*i+this.e,d=o*r+a*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 u=new Ie;return u.a=this.a+(t.a-this.a)*e,u.b=this.b+(t.b-this.b)*e,u.c=this.c+(t.c-this.c)*e,u.d=this.d+(t.d-this.d)*e,u.e=this.e+(t.e-this.e)*e,u.f=this.f+(t.f-this.f)*e,u}transformPoint(t,e){const{a:u,b:n,c:r,d:i,e:s,f:o}=this,D=u*i-n*r,a=i/D,h=-n/D,l=-r/D,c=u/D,f=(r*o-i*s)/D,F=-(u*o-n*s)/D,{x:d,y:g}=t;e.x=d*a+g*l+f,e.y=d*h+g*c+F}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ie(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,u=this.c,n=this.d,r=t*n-e*u,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*u+e*n)/r,i.skewY=0}else if(0!==u||0!==n){const s=Math.sqrt(u*u+n*n);i.rotateDeg=Math.PI/2-(n>0?Math.acos(-u/s):-Math.acos(u/s)),i.scaleX=r/s,i.scaleY=s,i.skewX=0,i.skewY=(t*u+e*n)/r}return i.rotateDeg=Ht(i.rotateDeg),i}}function Ue(t,e,u){e/=100,u/=100;const n=(1-Math.abs(2*u-1))*e,r=n*(1-Math.abs(t/60%2-1)),i=u-n/2;let s=0,o=0,D=0;return 0<=t&&t<60?(s=n,o=r,D=0):60<=t&&t<120?(s=r,o=n,D=0):120<=t&&t<180?(s=0,o=n,D=r):180<=t&&t<240?(s=0,o=r,D=n):240<=t&&t<300?(s=r,o=0,D=n):300<=t&&t<360&&(s=n,o=0,D=r),s=Math.round(255*(s+i)),o=Math.round(255*(o+i)),D=Math.round(255*(D+i)),{r:s,g:o,b:D}}function He(t,e,u){t/=255,e/=255,u/=255;const n=Math.min(t,e,u),r=Math.max(t,e,u),i=r-n;let s=0,o=0,D=0;return s=0===i?0:r===t?(e-u)/i%6:r===e?(u-t)/i+2:(t-e)/i+4,s=Math.round(60*s),s<0&&(s+=360),D=(r+n)/2,o=0===i?0:i/(1-Math.abs(2*D-1)),o=+(100*o).toFixed(1),D=+(100*D).toFixed(1),{h:s,s:o,l:D}}const Oe=/^#([0-9a-f]{3,8})$/,Re={transparent:4294967040},Pe={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ze(t){return g(t)?new Ve(t>>16,t>>8&255,255&t,1):f(t)?new Ve(t[0],t[1],t[2]):new Ve(255,255,255)}function je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ye(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const qe=(t,e)=>{const u=Oe.exec(t);if(e||u){const t=parseInt(u[1],16),e=u[1].length;return 3===e?new Ve((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ze(t):8===e?new Ve(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ge{static Brighter(t,e=1){return 1===e?t:new Ge(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ge(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const u=t instanceof Ge?t:new Ge(t);switch(e){case"hsv":default:return u.getHSVBrightness();case"hsl":return u.getHSLBrightness();case"lum":return u.getLuminance();case"lum2":return u.getLuminance2();case"lum3":return u.getLuminance3();case"wcag":return u.getLuminanceWCAG()}}static parseColorString(t){if(D(Re[t]))return function(t){return g(t)?new Ve(t>>>24,t>>>16&255,t>>>8&255,255&t):f(t)?new Ve(t[0],t[1],t[2],t[3]):new Ve(255,255,255,1)}(Re[t]);if(D(Pe[t]))return ze(Pe[t]);const e=`${t}`.trim().toLowerCase(),u=qe(e);if(void 0!==u)return u;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ve(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),u=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ve(u.r,u.g,u.b,parseFloat(t[3]))}}constructor(t){const e=Ge.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Ve(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t))),this}add(t){const{r:e,g:u,b:n}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,u+t.color.g),this.color.b+=Math.min(255,n+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:u,b:n}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(u*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(n*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,u){const n=this.color.opacity,r=He(this.color.r,this.color.g,this.color.b),i=Ue(o(t)?r.h:Q(t,0,360),o(e)?r.s:e>=0&&e<=1?100*e:e,o(u)?r.l:u<=1&&u>=0?100*u:u);return this.color=new Ve(i.r,i.g,i.b,n),this}setRGB(t,e,u){return!o(t)&&(this.color.r=t),!o(e)&&(this.color.g=e),!o(u)&&(this.color.b=u),this}setHex(t){const e=`${t}`.trim().toLowerCase(),u=qe(e,!0);return null!=u?u:this}setColorName(t){const e=Pe[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,u=this.color.b/255;let n,r,i;n=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=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return.2126*n+.7152*r+.0722*i}clone(){return new Ge(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const u=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,u),this.color.g=Math.pow(t.color.g,u),this.color.b=Math.pow(t.color.b,u),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=je(t.color.r),this.color.g=je(t.color.g),this.color.b=je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ve{constructor(t,e,u,n){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),this.b=isNaN(+u)?255:Math.max(0,Math.min(255,+u)),D(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:u,l:n}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${u}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function $e(t){let e="",u="",n="";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?u+=t[i]:i<r+6&&(n+=t[i]));return[parseInt(e,16),parseInt(u,16),parseInt(n,16)]}function Xe(t,e,u){return Number((1<<24)+(t<<16)+(e<<8)+u).toString(16).slice(1)}function Ze(t,e){const u=t.r,n=e.r,r=t.g,i=e.g,s=t.b,o=e.b,D=t.opacity,a=e.opacity;return t=>{const e=Math.round(u*(1-t)+n*t),h=Math.round(r*(1-t)+i*t),l=Math.round(s*(1-t)+o*t);return new Ve(e,h,l,D*(1-t)+a*t)}}var Je=Object.freeze({__proto__:null,Color:Ge,DEFAULT_COLORS:Pe,RGB:Ve,hexToRgb:$e,hslToRgb:Ue,interpolateRgb:Ze,rgbToHex:Xe,rgbToHsl:He});function Qe(t){return t?"getUTCFullYear":"getFullYear"}function Ke(t){return t?"getUTCMonth":"getMonth"}function tu(t){return t?"getUTCDate":"getDate"}function eu(t){return t?"getUTCHours":"getHours"}function uu(t){return t?"getUTCMinutes":"getMinutes"}function nu(t){return t?"getUTCSeconds":"getSeconds"}function ru(t){return t?"getUTCMilliseconds":"getMilliseconds"}const iu=1e3,su=6e4,ou=36e5,Du=24*ou,au=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),hu=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),lu=(t,e)=>e.getFullYear()-t.getFullYear(),cu=t=>t.getFullYear(),fu=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),Fu=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),du=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),gu=t=>t.getUTCFullYear(),mu=t=>(t.setDate(1),t.setHours(0,0,0,0),t),Cu=(t,e)=>(t.setMonth(t.getMonth()+e),t),yu=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),pu=t=>t.getMonth(),xu=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),Eu=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),Mu=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),Bu=t=>t.getUTCMonth(),bu=t=>(t.setHours(0,0,0,0),t),vu=(t,e)=>(t.setDate(t.getDate()+e),t),Au=(t,e)=>(+e-+t-(e.getTimezoneOffset()-t.getTimezoneOffset())*su)/Du,wu=t=>t.getDate()-1,Su=t=>(t.setUTCHours(0,0,0,0),t),Tu=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),_u=(t,e)=>(+e-+t)/Du,Lu=t=>t.getUTCDate()-1,Nu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*iu-t.getMinutes()*su),t),ku=(t,e)=>(t.setHours(t.getHours()+e),t),Iu=(t,e)=>(+e-+t)/ou,Uu=t=>t.getHours(),Hu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*iu-t.getUTCMinutes()*su),t),Ou=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Ru=t=>t.getUTCHours(),Pu=t=>(t.setTime(+t-t.getMilliseconds()-t.getSeconds()*iu),t),Wu=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zu=(t,e)=>(+e-+t)/su,ju=t=>t.getMinutes(),Yu=t=>(t.setTime(+t-t.getUTCMilliseconds()-t.getUTCSeconds()*iu),t),qu=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Gu=t=>t.getUTCMinutes(),Vu=t=>(t.setTime(+t-t.getMilliseconds()),t),$u=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Xu=(t,e)=>(+e-+t)/iu,Zu=t=>t.getSeconds(),Ju=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),Qu=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ku=t=>t.getUTCSeconds(),tn=t=>t,en=(t,e)=>(t.setTime(+t+e),t),un=(t,e)=>+e-+t,nn=(t,e)=>u=>{const n=new Date(+u-1);return e(n,1),t(n),n},rn=(t,e)=>(u,n)=>{const r=new Date,i=new Date;return r.setTime(+u),i.setTime(+n),t(r),t(i),Math.floor(e(r,i))};function sn(t){const{x:e,y:u}=t.getBoundingClientRect();return{x:e,y:u}}const on=t=>t.getBoundingClientRect().width/t.offsetWidth,Dn=t=>t.getBoundingClientRect().height/t.offsetHeight;var an=6371008.8,hn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*an,kilometers:6371.0088,kilometres:6371.0088,meters:an,metres:an,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:an/1852,radians:1,yards:6967335.223679999};const ln=1e-10;function cn(t,e){for(let u=0;u<e.length;++u)if(kt.distancePP(t,e[u])>e[u].radius+ln)return!1;return!0}function fn(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function Fn(t,e){const u=kt.distancePP(t,e),n=t.radius,r=e.radius;if(u>=n+r||u<=Math.abs(n-r))return[];const i=(n*n-r*r+u*u)/(2*u),s=Math.sqrt(n*n-i*i),o=t.x+i*(e.x-t.x)/u,D=t.y+i*(e.y-t.y)/u,a=-(e.y-t.y)*(s/u),h=-(e.x-t.x)*(s/u);return[{x:o+a,y:D-h},{x:o-a,y:D+h}]}function dn(t){const e={x:0,y:0};for(let u=0;u<t.length;++u)e.x+=t[u].x,e.y+=t[u].y;return e.x/=t.length,e.y/=t.length,e}class gn{static getInstance(){return gn.instance||(gn.instance=new gn),gn.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,u)=>{const n=this.shortWeekdayRe.exec(e.slice(u));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),u+n[0].length):-1},this.parseWeekday=(t,e,u)=>{const n=this.weekdayRe.exec(e.slice(u));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),u+n[0].length):-1},this.parseShortMonth=(t,e,u)=>{const n=this.shortMonthRe.exec(e.slice(u));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),u+n[0].length):-1},this.parseMonth=(t,e,u)=>{const n=this.monthRe.exec(e.slice(u));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),u+n[0].length):-1},this.parseDayOfMonth=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+2));return n?(t.d=+n[0],u+n[0].length):-1},this.parseHour24=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+2));return n?(t.H=+n[0],u+n[0].length):-1},this.parseMilliseconds=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+3));return n?(t.L=+n[0],u+n[0].length):-1},this.parseMonthNumber=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+2));return n?(t.m=n-1,u+n[0].length):-1},this.parseMinutes=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+2));return n?(t.M=+n[0],u+n[0].length):-1},this.parsePeriod=(t,e,u)=>{const n=this.periodRe.exec(e.slice(u));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),u+n[0].length):-1},this.parseSeconds=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+2));return n?(t.S=+n[0],u+n[0].length):-1},this.parseFullYear=(t,e,u)=>{const n=this.numberRe.exec(e.slice(u,u+4));return n?(t.y=+n[0],u+n[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,u){return{y:t,m:e,d:u,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,u){const n=t<0?"-":"",r=(n?-t:t)+"",i=r.length;return n+(i<u?new Array(u-i+1).join(e)+r:r)}parseSpecifier(t,e,u,n){let r=0;const i=e.length,s=u.length;let o,D;for(;r<i;){if(n>=s)return-1;if(o=e.charCodeAt(r++),37===o){if(o=e.charAt(r++),D=this.parses[o in this.pads?e.charAt(r++):o],!D||(n=D(t,u,n))<0)return-1}else if(o!==u.charCodeAt(n++))return-1}return n}newParse(t,e){const u=this;return function(n){const r=u.newDate(1900,void 0,1);return u.parseSpecifier(r,t,n+="",0)!==n.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,u.utcDate(r)):u.localDate(r))}}newFormat(t,e){const u=this;return function(n){const r=[];let i=-1,s=0;const o=t.length;let D,a,h;for(n instanceof Date||(n=new Date(+n));++i<o;)37===t.charCodeAt(i)&&(r.push(t.slice(s,i)),(a=u.pads[D=t.charAt(++i)])?D=t.charAt(++i):a="e"===D?" ":"0",h=e[D],D=h(n,a),r.push(D),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 mn(t,e){const u=e?t.toExponential(e-1):t.toExponential(),n=u.indexOf("e");if(n<0)return null;const r=u.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+u.slice(n+1)]}let Cn;function yn(t,e){const u=mn(t,e);if(!u)return t+"";const n=u[0],r=u[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}class pn{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 xn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function En(t){let e;if(e=xn.exec(t))return new pn({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 Mn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Bn{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(u,n){let r=u.length;const i=[];let s=0,o=t[0],D=0;for(;r>0&&o>0&&(D+o+1>n&&(o=Math.max(1,n-D)),i.push(u.substring(r-=o,r+o)),!((D+=o+1)>n));)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:An([...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 Bn.instance||(Bn.instance=new Bn),Bn.instance}newFormat(t){const e=En(t);let u=e.fill,n=e.align;const r=e.sign,i=e.symbol;let s=e.zero;const o=e.width;let D=e.comma,a=e.precision,h=e.trim,l=e.type;"n"===l?(D=!0,l="g"):bn[l]||(void 0===a&&(a=12),h=!0,l="g"),(s||"0"===u&&"="===n)&&(s=!0,u="0",n="=");const c="$"===i?this.currencyPrefix:"#"===i&&/[boxX]/.test(l)?"0"+l.toLowerCase():"",f="$"===i?this.currencySuffix:/[%p]/.test(l)?this.percent:"",F=bn[l],d=/[defgprstz%]/.test(l);a=void 0===a?6:/[gprs]/.test(l)?Math.max(1,Math.min(21,a)):Math.max(0,Math.min(20,a));const{nan:g,minus:m,decimal:C,group:y,numerals:p}=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)?g:F(Math.abs(B),a),h&&(B=function(t){const e=t.length;let u,n=-1;t:for(let r=1;r<e;++r)switch(t[r]){case".":n=u=r;break;case"0":0===n&&(n=r),u=r;break;default:if(!+t[r])break t;n>0&&(n=0)}return n>0?t.slice(0,n)+t.slice(u+1):t}(B)),t&&0==+B&&"+"!==r&&(t=!1),E=(t?"("===r?r:m:"-"===r||"("===r?"":r)+E,M=("s"===l?Mn[8+Cn/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?C+B.slice(e+1):B.slice(e))+M,B=B.slice(0,e);break}}D&&!s&&(B=y(B,1/0));let b=E.length+B.length+M.length,v=b<o?new Array(o-b+1).join(u):"";switch(D&&s&&(B=y(v+B,v.length?o-M.length:1/0),v=""),n){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 p(B)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const u=En(t);u.type="f";const n=this.newFormat(u.toString()),r=3*Math.max(-8,Math.min(8,Math.floor(vn(e)/3))),i=Math.pow(10,-r),s=Mn[8+r/3];return function(t){return n(i*t)+s}}}const bn={"%":(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)=>yn(100*t,e),r:yn,s:function(t,e){const u=mn(t,e);if(!u)return t+"";const n=u[0],r=u[1],i=r-(Cn=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,s=n.length;return i===s?n:i>s?n+new Array(i-s+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+mn(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 vn(t){const e=mn(Math.abs(t));return e?e[1]:NaN}function An(t){return function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}}function wn(t){const e=new Array(t);for(let u=0;u<t;++u)e[u]=0;return e}function Sn(t){return Math.sqrt(St(t,t))}function Tn(t,e,u){for(let n=0;n<e.length;++n)t[n]=e[n]*u}function _n(t,e,u,n,r){for(let i=0;i<t.length;++i)t[i]=e*u[i]+n*r[i]}function Ln(t,e,u,n,r,i,s){const o=u.fx,D=St(u.fxprime,e);let a=o,h=o,l=D,c=0;function f(h,c,f){for(let F=0;F<16;++F)if(r=(h+c)/2,_n(n.x,1,u.x,r,e),a=n.fx=t(n.x,n.fxprime),l=St(n.fxprime,e),a>o+i*r*D||a>=f)c=r;else{if(Math.abs(l)<=-s*D)return r;l*(c-h)>=0&&(c=h),h=r,f=a}return 0}r=r||1,i=i||1e-6,s=s||.1;for(let F=0;F<10;++F){if(_n(n.x,1,u.x,r,e),a=n.fx=t(n.x,n.fxprime),l=St(n.fxprime,e),a>o+i*r*D||F&&a>=h)return f(c,r,h);if(Math.abs(l)<=-s*D)return r;if(l>=0)return f(r,c,a);h=a,c=r,r*=2}return r}t.AABBBounds=class extends Ne{},t.Bounds=Ne,t.Color=Ge,t.ColorUtil=Je,t.DAY=Du,t.DEFAULT_COLORS=Pe,t.EventEmitter=n,t.FormatSpecifier=pn,t.GraphicUtil=pe,t.HOUR=ou,t.HashTable=class{constructor(){this.items={},this.itemList=[]}get type(){return"xhHashTable"}set(t,e){const u=new ct;u.key=t,u.value=e;let n=this.itemList.length;return this.has(t)&&(n=this.items[t].index),u.index=n,this.itemList[n]=u,this.items[t]=u,u}clear(){this.items={},this.itemList=[]}del(t){if(this.has(t)){const e=this.items[t].index;e>-1&&this.itemList.splice(e,1),delete this.items[t],this.resetIndex()}}delFrom(t){for(let e=t+1;e<this.count();e++){const t=this.itemList[e].key;delete this.items[t]}this.itemList.splice(t+1,this.count()-t),this.resetIndex()}resetIndex(){this.foreachHashv(((t,e)=>{const u=this.itemList.indexOf(e);this.items[t].index=u}))}has(t){return t in this.items}get(t){return this.has(t)?this.items[t].value:null}count(){return this.itemList.length}all(){return this.itemList.map((t=>t.value))}first(){return this.itemList[0].value}last(){return this.itemList[this.itemList.length-1].value}getByIndex(t){return this.itemList[t].value}getKeyByIndex(t){return this.itemList[t].key}foreach(t){for(const e in this.items){if(!1===t(e,this.items[e].value))return!1}return!0}foreachHashv(t){for(const e in this.items){if(!1===t(e,this.items[e]))return!1}return!0}hasValue(t){for(const e in this.items)if(this.items[e].value===t)return!0;return!1}indexOf(t){return this.has(t)?this.items[t].index:-1}insertAt(t,e,u){const n=new ct;n.index=t,n.key=u,n.value=e,this.itemList.splice(t,0,n),this.items[u]=n,this.resetIndex()}sort(t){return this.itemList.sort(((e,u)=>t(e.value,u.value)))}toArray(){return this.itemList.slice(0,this.itemList.length).map((t=>t.value))}push(t){t.foreach(((t,e)=>{this.set(t,e)}))}mapKey(){const t=[];for(const e in this.items)t.push(e);return t}toImmutableMap(){}},t.HashValue=ct,t.LRU=class{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:u=this.CLEAN_THRESHOLD,L_TIME:n=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<u)return 0;let 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 u=0;for(;o-t.timestamp[t.timestamp.length-1-u]<n&&(u++,!(u>=r)););if(u<r)return s(e);for(;o-t.timestamp[0]>n;)t.timestamp.shift()})),i}addLimitedTimestamp(t,e,u){const{R_TIMESTAMP_MAX_SIZE:n=this.R_TIMESTAMP_MAX_SIZE}=u;t.timestamp.length>n&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();t.forEach((t=>{for(;n-t.timestamp[0]>u;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:u=this.L_TIME}=e,n=Date.now();for(;n-t.timestamp[0]>u;)t.timestamp.shift()}},t.Logger=W,t.MINUTE=su,t.MONTH=26784e5,t.Matrix=Ie,t.NEWTON_ITERATIONS=4,t.NEWTON_MIN_SLOPE=.001,t.NumberUtil=Bn,t.OBBBounds=ke,t.Point=Nt,t.PointService=kt,t.PolarPoint=It,t.RGB=Ve,t.SECOND=iu,t.SMALL=ln,t.SUBDIVISION_MAX_ITERATIONS=10,t.SUBDIVISION_PRECISION=1e-7,t.TextMeasure=_e,t.TimeUtil=gn,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=Ct,t.acos=function(t){return t>1?0:t<-1?Ft:Math.acos(t)},t.array=N,t.arrayEqual=function(t,e){if(!f(t)||!f(e))return!1;if(t.length!==e.length)return!1;for(let u=0;u<t.length;u++)if(t[u]!==e[u])return!1;return!0},t.ascending=I,t.asin=function(t){return t>=1?dt:t<=-1?-dt:Math.asin(t)},t.atan2=yt,t.baseMerge=M,t.binaryFuzzySearch=(t,e)=>z(0,t.length,(u=>e(t[u]))),t.binaryFuzzySearchInNumberRange=z,t.bisect=function(t,e,u=0,n){for(o(n)&&(n=t.length);u<n;){const r=u+n>>>1;I(t[r],e)>0?n=r:u=r+1}return u},t.calculateAnchorOfArc=(t,e)=>{const{startAngle:u,endAngle:n,innerRadius:r,outerRadius:i}=t;let s=(u+n)/2,o=(r+i)/2;switch(e){case"inner-start":s=u,o=r;break;case"outer-start":s=u,o=i;break;case"inner-end":s=n,o=r;break;case"outer-end":s=n,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:u,x2:n,y1:r,y2:i}=t,s=Math.abs(n-u),o=Math.abs(i-r);let D=(u+n)/2,a=(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 D+=h*s,a+=l*o,{x:D,y:a}},t.calculateMaxRadius=function(t,e,u,n){const{x:r,y:i}=e,s=jt(u,n),{width:o,height:D}=t,a=[];return s.forEach((t=>{const e=Math.sin(t),u=Math.cos(t);1===e?a.push(D-i):-1===e?a.push(i):1===u?a.push(o-r):-1===u?a.push(r):(e>0?a.push(Math.abs((D-i)/e)):a.push(Math.abs(i/e)),u>0?a.push(Math.abs((o-r)/u)):a.push(Math.abs(r/u)))})),Math.min.apply(null,a)},t.cartesianToPolar=function(t,e={x:0,y:0},u=0,n=2*Math.PI){const{x:r,y:i}=t,{x:s,y:o}=e;let D=r-s,a=i-o;const h=Math.sqrt(D*D+a*a);if(0===h)return{radius:0,angle:0};D/=h,a/=h;let l=Math.atan2(a,D);if(l<u)for(;l<=u;)l+=2*Math.PI;if(l>n)for(;l>=n;)l-=2*Math.PI;return{radius:h,angle:l}},t.circleArea=fn,t.circleCircleIntersection=Fn,t.circleOverlap=function(t,e,u){if(u>=t+e)return 0;if(u<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const n=e-(u*u-t*t+e*e)/(2*u);return fn(t,t-(u*u-e*e+t*t)/(2*u))+fn(e,n)},t.clamp=Q,t.clampAngleByDegree=Wt,t.clampAngleByRadian=Rt,t.clampDegree=Pt,t.clampRadian=Ot,t.clampRange=(t,e,u)=>{let[n,r]=t;r<n&&(n=t[1],r=t[0]);const i=r-n;return i>=u-e?[e,u]:(n=Math.min(Math.max(n,e),u-i),[n,n+i])},t.clamper=function(t,e){let u;return t>e&&(u=t,t=e,e=u),u=>Math.max(t,Math.min(e,u))},t.clone=function(t,e=!1,u=0,n=void 0){const r=[],i=[];return void 0===e&&(e=!0),void 0===u&&(u=1/0),function t(u,s){if(null===u)return null;if(0===s)return u;let o;if("object"!=typeof u)return u;if(f(u)?o=[]:C(u)?(o=new RegExp(u.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(u)),u.lastIndex&&(o.lastIndex=u.lastIndex)):o=d(u)?new Date(u.getTime()):void 0===n?Object.create(Object.getPrototypeOf(u)):Object.create(n),e){const t=r.indexOf(u);if(-1!==t)return i[t];r.push(u),i.push(o)}for(const e in u)o[e]=t(u[e],s-1);return o}(t,u)},t.cloneDeep=function t(e,u,n){let r;if(!D(e)||"object"!=typeof e||u&&u(e))return e;const s=f(e),o=e.length;r=s?new Array(o):"object"==typeof e?{}:i(e)||g(e)||c(e)?e:d(e)?new Date(+e):void 0;const a=s?void 0:Object.keys(Object(e));let h=-1;if(r)for(;++h<(a||e).length;){const i=a?a[h]:h,s=e[i];n&&n.includes(i.toString())?r[i]=s:r[i]=t(s,u,n)}return r},t.computeQuadrant=function(t){return(t=zt(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,u){let n={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 D=(u=u||{}).maxIterations||20*e.length;n.fx=t(n.x,n.fxprime);const a=n.fxprime.slice();Tn(a,n.fxprime,-1);for(let e=0;e<D;++e){if(o=Ln(t,a,n,r,o),u.history&&u.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:o}),o){_n(i,1,r.fxprime,-1,n.fxprime);const t=St(n.fxprime,n.fxprime);_n(a,Math.max(0,St(i,r.fxprime)/t),a,-1,r.fxprime),s=n,n=r,r=s}else Tn(a,n.fxprime,-1);if(Sn(n.fxprime)<=1e-5)break}return u.history&&u.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:o}),n},t.constant=t=>s(t)?t:()=>t,t.containedInCircles=cn,t.cos=pt,t.crossProduct=At,t.crossProductPoint=wt,t.dateGetterName=tu,t.dateSetterName=function(t){return t?"setUTCDate":"setDate"},t.dayCount=Au,t.dayField=wu,t.dayFloor=bu,t.dayOffset=vu,t.debounce=tt,t.defaults=L,t.degreeToRadian=Ut,t.destination=function(t,e,u,n={}){const r=Ut(t[0]),i=Ut(t[1]),s=Ut(u),o=function(t,e){void 0===e&&(e="kilometers");var u=hn[e];if(!u)throw new Error(e+" units is invalid");return t/u}(e,n.units),D=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(s));return{x:Ht(r+Math.atan2(Math.sin(s)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(D))),y:Ht(D)}},t.deviation=function(t,e){const u=j(t,e);return u?Math.sqrt(u):u},t.dotProduct=St,t.eastAsianCharacterInfo=we,t.epsilon=ft,t.exponent=vn,t.extent=(t,e)=>{const u=s(e)?e:t=>t;let n,r;if(t&&t.length){const e=t.length;for(let i=0;i<e;i+=1){let e=u(t[i]);o(e)||!g(e=+e)||Number.isNaN(e)||(o(n)?(n=e,r=e):(n=Math.min(n,e),r=Math.max(r,e)))}return[n,r]}return[n,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 u=t.map((t=>Dt(t,e)));return t=>u.map((e=>e(t)))}return Dt(t,e)},t.findBoundaryAngles=jt,t.findZeroOfFunction=function(t,e,u,n){var r,i;const s=null!==(r=null==n?void 0:n.maxIterations)&&void 0!==r?r:100,o=null!==(i=null==n?void 0:n.tolerance)&&void 0!==i?i:1e-10,D=t(e),a=t(u);let h=u-e;if(D*a>0){return W.getInstance().error("Initial bisect points must have opposite signs"),NaN}if(0===D)return e;if(0===a)return u;for(let u=0;u<s;++u){h/=2;const u=e+h,n=t(u);if(n*D>=0&&(e=u),Math.abs(h)<o||0===n)return u}return e+h},t.fixPrecision=_t,t.flattenArray=function t(e){if(!f(e))return[e];const u=[];for(const n of e)u.push(...t(n));return u},t.formatNumerals=An,t.formatSpecifier=En,t.formatTypes=bn,t.fullYearGetterName=Qe,t.fullYearSetterName=function(t){return t?"setUTCFullYear":"setFullYear"},t.fuzzyEqualNumber=function(t,e){return Ct(t-e)<ft},t.fuzzyEqualVec=Tt,t.gemv=function(t,e,u){for(let n=0;n<t.length;++n)t[n]=St(e[n],u)},t.generateCeil=nn,t.generateCount=rn,t.generateStepInterval=(t,{floor:e,offset:u,field:n,count:r})=>{const i=Math.floor(t);if(!Number.isFinite(i)||i<=0)return null;if(i<=1)return{floor:e,offset:u,ceil:nn(e,u)};const s=rn(e,r),o=n?t=>n(t)%i==0:t=>s(0,t)%i==0,D=t=>{if(!Number.isNaN(+t))for(e(t);!o(t);)t.setTime(+t-1),e(t);return t},a=(t,e)=>{if(!Number.isNaN(+t))if(i<0)for(;++e<=0;)for(u(t,-1);!o(t);)u(t,-1);else for(;--e>=0;)for(u(t,1);!o(t);)u(t,1);return t};return{floor:D,offset:a,ceil:nn(D,a)}},t.get=x,t.getAABBFromPoints=function(t){return te=1/0,ee=1/0,ue=-1/0,ne=-1/0,t.forEach((t=>{te>t.x&&(te=t.x),ue<t.x&&(ue=t.x),ee>t.y&&(ee=t.y),ne<t.y&&(ne=t.y)})),{x1:te,y1:ee,x2:ue,y2:ne}},t.getAngleByPoint=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},t.getCenter=dn,t.getContainerSize=function(t,e=0,u=0){if(!t)return{width:e,height:u};let n;try{n=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){n=()=>({})}const r=n(t);if(/^(\d*\.?\d+)(px)$/.exec(r.width)){const n=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:n<=0?e:n,height:i<=0?u:i}}return{width:e,height:u}},t.getContextFont=Te,t.getDecimalPlaces=Lt,t.getElementAbsolutePosition=sn,t.getElementRelativePosition=function(t,e){const u=sn(t),n=sn(e);return{x:u.x-n.x,y:u.y-n.y}},t.getFormatFromValue=function(t,e){const u=it(t),n=u[Ke(e)]()+1,r=u[tu(e)](),i=u[eu(e)](),s=u[uu(e)](),o=u[nu(e)](),D=0===u[ru(e)](),a=D&&0===o,h=a&&0===s,l=h&&0===i,c=l&&1===r;return c&&1===n?"YYYY":c?"YYYY-MM":l?"YYYY-MM-DD":h?"HH":a?"HH:mm":D?"HH:mm:ss":"HH:mm:ss SSS"},t.getIntersectPoint=function(t,e,u,n){if(!qt(t,e,u,n))return!1;const r=[0,0],i=[0,0],s=[0,0];if(Yt(r,e,t),Yt(i,n,u),Tt(r,i))return!0;Yt(s,u,t);const o=At(s,i)/At(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:fu,offset:Fu,count:du,field:gu}:"month"===t&&e?{floor:xu,offset:Eu,count:Mu,field:Bu}:"day"===t&&e?{floor:Su,offset:Tu,count:_u,field:Lu}:"hour"===t&&e?{floor:Hu,offset:Ou,count:Iu,field:Ru}:"minute"===t&&e?{floor:Yu,offset:qu,count:zu,field:Gu}:"second"===t&&e?{floor:Ju,offset:Qu,count:Xu,field:Ku}:"year"===t?{floor:au,offset:hu,count:lu,field:cu}:"month"===t?{floor:mu,offset:Cu,count:yu,field:pu}:"day"===t?{floor:bu,offset:vu,count:Au,field:wu}:"hour"===t?{floor:Nu,offset:ku,count:Iu,field:Uu}:"minute"===t?{floor:Pu,offset:Wu,count:zu,field:ju}:"second"===t?{floor:Vu,offset:$u,count:Xu,field:Zu}:{floor:tn,offset:en,count:un},t.getOBBFromLine=function(t,e,u){return re=e.x-t.x,ie=e.y-t.y,se=ie,oe=-re,he=De=Math.sqrt(se*se+oe*oe),le=u,se/=De,oe/=De,ae=u/2,re=ae*se,ie=ae*oe,{point1:{x:t.x+re,y:t.y+ie},point2:{x:t.x-re,y:t.y-ie},point3:{x:e.x+re,y:e.y+ie},point4:{x:e.x-re,y:e.y-ie},width:he,height:le,left:Math.min(t.x,e.x)-Math.abs(re),top:Math.min(t.y,e.y)-Math.abs(ie)}},t.getRectIntersect=function(t,e,u){if(null===t)return e;if(null===e)return t;const{x11:n,x12:r,y11:i,y12:s,x21:o,x22:D,y21:a,y22:h}=Vt(t,e,u);return n>=D||r<=o||i>=h||s<=a?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(n,o),y1:Math.max(i,a),x2:Math.min(r,D),y2:Math.min(s,h)}},t.getScale=t=>t.offsetWidth>0?on(t):Dn(t),t.getScaleX=on,t.getScaleY=Dn,t.getScrollLeft=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollLeft)||t.scrollLeft:"html"===t.tagName.toLowerCase()?0:t.scrollLeft},t.getScrollTop=t=>{var e,u,n;return t===(null===(e=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===e?void 0:e.body)?(null===(n=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.documentElement)||void 0===n?void 0:n.scrollTop)||t.scrollTop:"html"===t.tagName.toLowerCase()?0:t.scrollTop},t.getTimeFormatter=function(t,e){return u=>{const n=it(u),r=n[Qe(e)](),i=n[Ke(e)]()+1,s=Math.floor((i-1)/3)+1,o=n[tu(e)](),D=n["get"+(e?"UTC":"")+"Day"](),a=n[eu(e)](),h=(a-1)%12+1,l=n[uu(e)](),c=n[nu(e)](),f=n[ru(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,D+"").replace(/HH/g,J(a,2,"0","left")).replace(/H/g,a+"").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=dt,t.has=(t,e)=>null!=t&&E.call(t,e),t.hasParentElement=function(t,e){let u=t.parentNode;for(;null!==u;){if(u===e)return!0;u=u.parentNode}return!1},t.hexToRgb=$e,t.hourCount=Iu,t.hourField=Uu,t.hourFloor=Nu,t.hourOffset=ku,t.hoursGetterName=eu,t.hoursSetterName=function(t){return t?"setUTCHours":"setHours"},t.hslToRgb=Ue,t.interpolateDate=function(t,e){const u=t.valueOf(),n=e.valueOf(),r=new Date;return t=>(r.setTime(u*(1-t)+n*t),r)},t.interpolateNumber=et,t.interpolateNumberRound=function(t,e){return function(u){return Math.round(t*(1-u)+e*u)}},t.interpolateRgb=Ze,t.interpolateString=function(t,e){let u,n,r,i=ut.lastIndex=nt.lastIndex=0,s=-1;const o=[],D=[];for(t+="",e+="";(u=ut.exec(t))&&(n=nt.exec(e));)(r=n.index)>i&&(r=e.slice(i,r),o[s]?o[s]+=r:o[++s]=r),(u=u[0])===(n=n[0])?o[s]?o[s]+=n:o[++s]=n:(o[++s]=null,D.push({i:s,x:et(u,n)})),i=nt.lastIndex;return i<e.length&&(r=e.slice(i),o[s]?o[s]+=r:o[++s]=r),o.length<2?D[0]?function(t){return function(e){return t(e)+""}}(D[0].x):function(t){return function(){return t}}(e):(e=D.length,function(t){for(let u,n=0;n<e;++n)o[(u=D[n]).i]=u.x(t);return o.join("")})},t.intersectionArea=function(t,e){const u=function(t){const e=[];for(let u=0;u<t.length;++u)for(let n=u+1;n<t.length;++n){const r=Fn(t[u],t[n]);for(let t=0;t<r.length;++t){const i=r[t];i.parentIndex=[u,n],e.push(i)}}return e}(t),n=u.filter((function(e){return cn(e,t)}));let r=0,i=0;const s=[];if(n.length>1){const e=dn(n);for(let t=0;t<n.length;++t){const u=n[t];u.angle=Math.atan2(u.x-e.x,u.y-e.y)}n.sort((function(t,e){return e.angle-t.angle}));let u=n[n.length-1];for(let e=0;e<n.length;++e){const o=n[e];i+=(u.x+o.x)*(o.y-u.y);const D={x:(o.x+u.x)/2,y:(o.y+u.y)/2};let a=null;for(let e=0;e<o.parentIndex.length;++e)if(u.parentIndex.indexOf(o.parentIndex[e])>-1){const n=t[o.parentIndex[e]],r=Math.atan2(o.x-n.x,o.y-n.y),i=Math.atan2(u.x-n.x,u.y-n.y);let s=i-r;s<0&&(s+=2*Math.PI);const h=i-s/2;let l=kt.distancePP(D,{x:n.x+n.radius*Math.sin(h),y:n.y+n.radius*Math.cos(h)});l>2*n.radius&&(l=2*n.radius),(null===a||a.width>l)&&(a={circle:n,width:l,p1:o,p2:u})}null!==a&&(s.push(a),r+=fn(a.circle.radius,a.width),u=o)}}else{let e=t[0];for(let u=1;u<t.length;++u)t[u].radius<e.radius&&(e=t[u]);let u=!1;for(let n=0;n<t.length;++n)if(kt.distancePP(t[n],e)>Math.abs(e.radius-t[n].radius)){u=!0;break}u?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-ln,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=n,e.intersectionPoints=u),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(p.call(t,e))return!1;return!0},t.isEqual=function t(e,u,n){if(e===u)return!0;if(typeof e!=typeof u)return!1;if(null==e||null==u)return!1;if(Number.isNaN(e)&&Number.isNaN(u))return!0;if(A(e)!==A(u))return!1;if(s(e))return!!(null==n?void 0:n.skipFunction);if("object"!=typeof e)return!1;if(f(e)){if(e.length!==u.length)return!1;for(let r=e.length-1;r>=0;r--)if(!t(e[r],u[r],n))return!1;return!0}if(!l(e))return!1;const r=w(e),i=w(u);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],u[s],n))return!1}return!0},t.isFunction=s,t.isGreater=function(t,e,u,n){return t>e&&!X(t,e,u,n)},t.isHTMLElement=function(t){try{return t instanceof Element}catch(e){const u=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return u.every((t=>n.includes(t)))}},t.isIntersect=qt,t.isLess=function(t,e,u,n){return t<e&&!X(t,e,u,n)},t.isNil=o,t.isNull=t=>null===t,t.isNumber=g,t.isNumberClose=X,t.isNumeric=t=>"string"==typeof t&&(!isNaN(Number(t))&&!isNaN(parseFloat(t))),t.isObject=a,t.isObjectLike=h,t.isPlainObject=l,t.isPointInLine=Be,t.isPointInPolygon=function(t,e){if(!t)return!1;if(!e)return!1;const u="Feature"===(n=e).type?n.geometry:n;var n;const r=u.type,i=e.bbox;let s=u.coordinates;if(i&&!0===$t(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 u=0;u<s[e].length;++u){if(Me(s[e][u].map((t=>({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o}return o},t.isRectIntersect=function(t,e,u){if(t&&e){if(!u)return!(t.x1>e.x2||t.x2<e.x1||t.y1>e.y2||t.y2<e.y1);const{x11:n,x12:r,y11:i,y12:s,x21:o,x22:D,y21:a,y22:h}=Vt(t,e,!0);return!(n>D||r<o||i>h||s<a)}return!0},t.isRegExp=C,t.isRotateAABBIntersect=Kt,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 u=!0;return Object.keys(t).forEach((n=>!!S(t[n],e[n])||(u=!1,u))),u},t.isString=c,t.isType=r,t.isUndefined=t=>void 0===t,t.isValid=D,t.isValidNumber=m,t.isValidUrl=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),t.keys=_,t.last=k,t.lengthFromPointToLine=vt,t.lineIntersectPolygon=Ee,t.lowerCamelCaseToMiddle=t=>t.replace(/([A-Z])/g,"-$1").toLowerCase(),t.lowerFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},t.max=xt,t.maxInArray=(t,e)=>{var u;if(0===t.length)return;let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];(null!==(u=null==e?void 0:e(i,n))&&void 0!==u?u:i-n)>0&&(n=i)}return n},t.median=(t,e)=>{let u=t;return!0!==e&&(u=t.sort(I)),H(u,.5)},t.memoize=t=>{let e=null,u=null;return(...n)=>(e&&n.every(((t,u)=>t===e[u]))||(e=n,u=t(...n)),u)},t.merge=function(t,...e){let u=-1;const n=e.length;for(;++u<n;){M(t,e[u],!0)}return t},t.mergeAABB=function(t){const e=[];return function t(u,n){const r=[];n.forEach((t=>{let e;(e=ce(u,t)).length>1?r.push(t):u=e[0]})),e.push(u),r.length&&t(r[0],r.slice(1))}(t[0],t.slice(1)),e},t.millisecondsCount=un,t.millisecondsFloor=tn,t.millisecondsGetterName=ru,t.millisecondsOffset=en,t.millisecondsSetterName=function(t){return t?"setUTCMilliseconds":"setMilliseconds"},t.min=Et,t.minInArray=(t,e)=>{var u;if(0===t.length)return;let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];(null!==(u=null==e?void 0:e(i,n))&&void 0!==u?u:i-n)<0&&(n=i)}return n},t.minuteCount=zu,t.minuteField=ju,t.minuteFloor=Pu,t.minuteOffset=Wu,t.minutesGetterName=uu,t.minutesSetterName=function(t){return t?"setUTCMinutes":"setMinutes"},t.mixin=function(t,e,u=!0){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let r=0;r<n.length;r++){const i=n[r];"constructor"!==i&&(u?null!=e[i]:null==t[i])&&(t[i]=e[i])}}else L(t,e,u)},t.monthCount=yu,t.monthField=pu,t.monthFloor=mu,t.monthGetterName=Ke,t.monthOffset=Cu,t.monthSetterName=function(t){return t?"setUTCMonth":"setMonth"},t.nelderMead=function(t,e,u){const n=(u=u||{}).maxIterations||200*e.length,r=u.nonZeroDelta||1.05,i=u.zeroDelta||.001,s=u.minErrorDelta||1e-6,o=u.minErrorDelta||1e-5,D=void 0!==u.rho?u.rho:1,a=void 0!==u.chi?u.chi:2,h=void 0!==u.psi?u.psi:-.5,l=void 0!==u.sigma?u.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 u=0;u<f;++u){const n=e.slice();n[u]=n[u]?n[u]*r:i,F[u+1]=n,F[u+1].fx=t(n),F[u+1].id=u+1}function d(t){for(let e=0;e<t.length;e++)F[f][e]=t[e];F[f].fx=t.fx}const g=function(t,e){return t.fx-e.fx},m=e.slice(),C=e.slice(),y=e.slice(),p=e.slice();for(let e=0;e<n;++e){if(F.sort(g),u.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})),u.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){m[t]=0;for(let e=0;e<f;++e)m[t]+=F[e][t];m[t]/=f}const e=F[f];if(_n(C,1+D,m,-D,e),C.fx=t(C),C.fx<F[0].fx)_n(p,1+a,m,-a,e),p.fx=t(p),p.fx<C.fx?d(p):d(C);else if(C.fx>=F[f-1].fx){let u=!1;if(C.fx>e.fx?(_n(y,1+h,m,-h,e),y.fx=t(y),y.fx<e.fx?d(y):u=!0):(_n(y,1-h*D,m,h*D,e),y.fx=t(y),y.fx<C.fx?d(y):u=!0),u){if(l>=1)break;for(let e=1;e<F.length;++e)_n(F[e],1-l,F[0],l,F[e]),F[e].fx=t(F[e])}}else d(C)}return F.sort(g),{fx:F[0].fx,x:F[0]}},t.norm2=Sn,t.normalTransform=function(t,e,u,n,r,i,s,o){const D=e.a,a=e.b,h=e.c,l=e.d,c=e.e,f=e.f,F=pt(s),d=Mt(s);let g,m;o?(g=o[0],m=o[1]):(g=u,m=n);const C=g-u,y=m-n,p=D*F+h*d,x=a*F+l*d,E=h*F-D*d,M=l*F-a*d;t.a=r*p,t.b=r*x,t.c=i*E,t.d=i*M,t.e=c+D*g+h*m-p*C-E*y,t.f=f+a*g+l*m-x*C-M*y},t.normalizeAngle=zt,t.normalizePadding=function(t){if(m(t))return[t,t,t,t];if(f(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,u]=t;return[e,u,e,u]}if(3===e){const[e,u,n]=t;return[e,u,n,u]}if(4===e)return t}if(a(t)){const{top:e=0,right:u=0,bottom:n=0,left:r=0}=t;return[e,u,n,r]}return[0,0,0,0]},t.numberSpecifierReg=xn,t.obbSeparation=(t,e)=>{const u=[{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 n(t,e,u){const n=t.getRotatedCorners().map((t=>t.x*e+t.y*u));return{min:Math.min(...n),max:Math.max(...n)}}let r=0;for(const i of u){const u=n(t,i.x,i.y),s=n(e,i.x,i.y);let o;o=u.max<s.min?s.min-u.max:s.max<u.min?u.min-s.max:0,r=Math.max(r,o)}return r},t.ordinaryLeastSquares=at,t.pad=J,t.parseUint8ToImageData=(t,e,u)=>{const n=new Uint8ClampedArray(t),r=new Uint8ClampedArray(t.length);for(let t=u-1;t>=0;t--)for(let i=0;i<e;i++){const s=t*e*4+4*i,o=(u-t)*e*4+4*i;r[o]=n[s],r[o+1]=n[s+1],r[o+2]=n[s+2],r[o+3]=n[s+3]}return new ImageData(r,e,u)},t.pi=Ft,t.pi2=mt,t.pick=function(t,e){if(!t||!l(t))return t;const u={};return e.forEach((e=>{v.call(t,e)&&(u[e]=t[e])})),u},t.pickWithout=function(t,e){if(!t||!l(t))return t;const u={};return Object.keys(t).forEach((n=>{const r=t[n];let i=!1;e.forEach((t=>{(c(t)&&t===n||t instanceof RegExp&&n.match(t))&&(i=!0)})),i||(u[n]=r)})),u},t.pointAt=function(t,e,u,n,r){let i=u,s=n;return"number"==typeof t&&"number"==typeof u&&(i=(1-r)*t+r*u),"number"==typeof e&&"number"==typeof n&&(s=(1-r)*e+r*n),{x:i,y:s}},t.pointBetweenLine=ye,t.pointInAABB=function(t,e){return $t(t,e,!1)},t.pointInLine=de,t.pointInOBB=function(t,e){return fe.x=(e.point1.x+e.point2.x)/2,fe.y=(e.point1.y+e.point2.y)/2,Fe.x=(e.point3.x+e.point4.x)/2,Fe.y=(e.point3.y+e.point4.y)/2,de(t,fe,Fe,e.height)},t.pointInRect=$t,t.polarToCartesian=function(t,e,u){return e?{x:t.x+e*Math.cos(u),y:t.y+e*Math.sin(u)}:{x:t.x,y:t.y}},t.polygonContainPoint=Me,t.polygonIntersectPolygon=function(t,e){for(let u=0;u<e.length;u++){if(Me(t,e[u].x,e[u].y))return!0;if(u>0&&Ee(e[u-1].x,e[u-1].y,e[u].x,e[u].y,t))return!0}return!1},t.pow=bt,t.precisionAdd=function(t,e){return _t(t+e,10**Math.max(Lt(t),Lt(e)))},t.precisionSub=function(t,e){return _t(t-e,10**Math.max(Lt(t),Lt(e)))},t.quantileSorted=H,t.rSquared=lt,t.radianToDegree=Ht,t.randomLCG=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%st)/st},t.range=function(t,e,u){D(e)||(e=t,t=0),D(u)||(u=1);let n=-1;const r=0|Math.max(0,Math.ceil((e-t)/u)),i=new Array(r);for(;++n<r;)i[n]=t+n*u;return i},t.rectInsideAnotherRect=function(e,u,n){if(!e||!u)return t.InnerBBox.NONE;const{x11:r,x12:i,y11:s,y12:o,x21:D,x22:a,y21:h,y22:l}=Vt(e,u,n);return r>D&&i<a&&s>h&&o<l?t.InnerBBox.BBOX1:D>r&&a<i&&h>s&&l<o?t.InnerBBox.BBOX2:t.InnerBBox.NONE},t.regressionLinear=function(t,e=(t=>t.x),u=(t=>t.y)){let n=0,r=0,i=0,s=0,o=0;ht(t,e,u,((t,e)=>{++o,n+=(t-n)/o,r+=(e-r)/o,i+=(t*e-i)/o,s+=(t*t-s)/o}));const D=at(n,r,i,s),a=t=>D[0]+D[1]*t;return{coef:D,predict:a,rSquared:lt(t,e,u,r,a)}},t.rgbToHex=Xe,t.rgbToHsl=He,t.rotatePoint=Zt,t.scale=Tn,t.secondCount=Xu,t.secondField=Zu,t.secondFloor=Vu,t.secondOffset=$u,t.secondsGetterName=nu,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 u,n,r=t.length;for(;r;)u=Math.floor(e()*r),n=t[--r],t[r]=t[u],t[u]=n;return t},t.simpleField=t=>t?"string"==typeof t||"number"==typeof t?()=>t:s(t)?t:e=>e[t.field]:null,t.sin=Mt,t.span=t=>t.length<=1?0:k(t)-t[0],t.sqrt=Bt,t.stringWidth=function(t,e=!0){if("string"!=typeof t||0===t.length)return 0;if(0===(t=ve(t)).length)return 0;t=t.replace(Se()," ");const u=e?1:2;let n=0;for(const e of t){const t=e.codePointAt(0);if(t<=31||t>=127&&t<=159)continue;if(t>=768&&t<=879)continue;switch(we(e)){case"F":case"W":n+=2;break;case"A":n+=u;break;default:n+=1}}return n},t.styleStringToObject=(t="")=>{const e={};return t.split(";").forEach((t=>{if(t){const u=t.split(":");if(2===u.length){const t=u[0].trim(),n=u[1].trim();t&&n&&(e[t]=n)}}})),e},t.substitute=function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,((t,u)=>"\\"===t.charAt(0)?t.slice(1):void 0===e[u]?"":e[u])):t},t.tau=gt,t.throttle=function(t,e,u){let n=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return a(u)&&(n="leading"in u?!!u.leading:n,r="trailing"in u?!!u.trailing:r),tt(t,e,{leading:n,trailing:r,maxWait:e})},t.tickStep=function(t,e,u){const n=Math.abs(e-t)/Math.max(0,u);let r=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const i=n/r;return i>=Y?r*=10:i>=q?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(m(t))return t;const e=+t;return m(e)?e:0},t.transformBounds=function(t,e,u,n,r,i,s){if(!(Ct(n)<=ft||Ct(r)<=ft)){if(1!==n&&t.scaleX(n),1!==r&&t.scaleY(r),isFinite(i)&&Math.abs(i)>ft){let e=0,u=0;void 0!==s&&(e=s[0],u=s[1]),t.rotate(i,e,u)}t.translate(e,u)}},t.transformBoundsWithMatrix=Le,t.truncate=(t,e,u="right",n)=>{const r=o(n)?"…":n,i=t+"",s=i.length,D=Math.max(0,e-r.length);return s<=e?i:"left"===u?r+i.slice(s-D):"center"===u?i.slice(0,Math.ceil(D/2))+r+i.slice(s-Math.floor(D/2)):i.slice(0,D)+r},t.unionAABB=ce,t.uniqArray=function(t){return t&&f(t)?Array.from(new Set(N(t))):t},t.upperFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},t.utcDayCount=_u,t.utcDayField=Lu,t.utcDayFloor=Su,t.utcDayOffset=Tu,t.utcHourField=Ru,t.utcHourFloor=Hu,t.utcHourOffset=Ou,t.utcMinuteField=Gu,t.utcMinuteFloor=Yu,t.utcMinuteOffset=qu,t.utcMonthCount=Mu,t.utcMonthField=Bu,t.utcMonthFloor=xu,t.utcMonthOffset=Eu,t.utcSecondField=Ku,t.utcSecondFloor=Ju,t.utcSecondOffset=Qu,t.utcYearCount=du,t.utcYearField=gu,t.utcYearFloor=fu,t.utcYearOffset=Fu,t.uuid=(t,e)=>{const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];let r;if(e=e||u.length,t)for(r=0;r<t;r++)n[r]=u[0|Math.random()*e];else{let t;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(t=0|16*Math.random(),n[r]=u[19===r?3&t|8:t])}return n.join("")},t.variance=j,t.visitPoints=ht,t.weightedSum=_n,t.yearCount=lu,t.yearField=cu,t.yearFloor=au,t.yearOffset=hu,t.zero=t=>0,t.zeros=wn,t.zerosM=function(t,e){return wn(t).map((function(){return wn(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 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)){let u=0,r=0,i=0,s=0,o=0;ft(t,e,n,((t,e)=>{u++,r+=(t-r)/u,i+=(e-i)/u,s+=(t*e-s)/u,o+=(t*t-o)/u}));const{a:a,b:D}=ct(r,i,s,o),h=t=>a+D*t,l=ht(t,e,n,h);return{coef:{a:a,b:D},predict:h,rSquared:Ft(t,e,n,i,h),evaluateGrid:function(t){const e=[];if(0===l.n||t<=0)return e;if(l.min===l.max){for(let n=0;n<t;n++)e.push({x:l.min,y:h(l.min)});return e}const n=(l.max-l.min)/(t-1);for(let u=0;u<t;u++){const r=u===t-1?l.max:l.min+n*u;e.push({x:r,y:h(r)})}return e},confidenceInterval:function(t=50,e=.05){const n=[];if(0===l.n||t<=0)return n;const u=Dt(1-e/2);if(l.min===l.max){const e=h(l.min),r=lt(l.min,l);for(let i=0;i<t;i++)n.push({x:l.min,mean:e,lower:e-u*r.seMean,upper:e+u*r.seMean,predLower:e-u*r.sePred,predUpper:e+u*r.sePred});return n}const r=(l.max-l.min)/(t-1);for(let e=0;e<t;e++){const i=e===t-1?l.max:l.min+r*e,s=h(i),o=lt(i,l);n.push({x:i,mean:s,lower:s-u*o.seMean,upper:s+u*o.seMean,predLower:s-u*o.sePred,predUpper:s+u*o.sePred})}return n}}},t.regressionLogistic=function(t,e=(t=>t.x),n=(t=>t.y),u){var r,i;const s=null!==(r=null==u?void 0:u.maxIteration)&&void 0!==r?r:25,o=null!==(i=null==u?void 0:u.tol)&&void 0!==i?i:1e-6,a=[],D=[];ft(t,e,n,((t,e)=>{a.push(t),D.push(e?1:0)}));const h=a.length;if(0===h)return{coef:[0,0],predict:t=>0,evaluateGrid:t=>[],confidenceInterval:(t=50)=>[]};let l=0,c=0;for(let t=0;t<s;t++){const t=new Array(h);let e=!0;for(let e=0;e<h;e++){const n=l+c*a[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<h;e++){const o=t[e]*(1-t[e]),h=D[e]-t[e];n+=h,u+=h*a[e],r+=o,i+=o*a[e],s+=o*a[e]*a[e]}const f=r*s-i*i;if(Math.abs(f)<1e-12)break;const F=(s*n-i*u)/f,d=(-i*n+r*u)/f;if(l+=F,c+=d,(Math.abs(F)>o||Math.abs(d)>o)&&(e=!1),e)break}const f=t=>{const e=l+c*t;return 1/(1+Math.exp(-e))};return{coef:[l,c],predict:f,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=f(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:f(e)})}return r},confidenceInterval:function(u=50,r=.05){const i=[];if(u<=0)return i;const s=ht(t,e,n,f);if(0===s.n)return i;const o=Math.abs(Dt(1-r/2));if(s.min===s.max){const t=f(s.min),e=lt(s.min,s);for(let n=0;n<u;n++)i.push({x:s.min,mean:t,lower:t-o*e.seMean,upper:t+o*e.seMean,predLower:t-o*e.sePred,predUpper:t+o*e.sePred});return i}const a=(s.max-s.min)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?s.max:s.min+a*t,n=f(e),r=lt(e,s);i.push({x:e,mean:n,lower:n-o*r.seMean,upper:n+o*r.seMean,predLower:n-o*r.sePred,predUpper:n+o*r.sePred})}return i}}},t.regressionLowess=function(t,e=(t=>t.x),n=(t=>t.y),u={}){const r=u.span||.3,i=0===u.degree?0:1,s=null==u.iterations?2:u.iterations,o=[],a=[];ft(t,e,n,((t,e)=>{o.push(t),a.push(e)}));const D=o.length;function h(t,e){if(0===D)return 0;const n=[];for(let e=0;e<D;e++)n.push({idx:e,dist:Math.abs(o[e]-t)});n.sort(((t,e)=>t.dist-e.dist));const u=Math.max(2,Math.min(D,Math.floor(r*D))),s=n[u-1].dist||0,h=new Array(u);let l=0;for(let t=0;t<u;t++){const u=n[t].idx;let r=dt(0===s?0:n[t].dist/s);e&&null!=e[u]&&(r*=e[u]),h[t]=r,l+=r}if(0===l)return a[n[0].idx];if(0===i){let t=0;for(let e=0;e<u;e++)t+=h[e]*a[n[e].idx];return t/l}let c=0,f=0,F=0,d=0,m=0;for(let t=0;t<u;t++){const e=n[t].idx,u=o[e],r=a[e],i=h[t];c+=i,f+=i*u,F+=i*r,d+=i*u*u,m+=i*u*r}const g=f/c,p=F/c,y=d-f*g,C=Math.abs(y)<1e-12?0:(m-f*p)/y;return p-C*g+C*t}function l(t){if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++)e.push(h(t[n]));return e}return h(t)}return{predict:l,evaluate:l,evaluateGrid:function(t){const e=[];if(t<=0)return e;if(0===D)return e;let n=1/0,u=-1/0;for(let t=0;t<D;t++)o[t]<n&&(n=o[t]),o[t]>u&&(u=o[t]);if(n===u){const u=h(n);for(let r=0;r<t;r++)e.push({x:n,y:u});return e}const r=(u-n)/(t-1);let i;for(let t=0;t<s;t++){const t=[];for(let e=0;e<D;e++)t.push(h(o[e],i));const e=[];for(let n=0;n<D;n++)e.push(Math.abs(a[n]-t[n]));const n=e.slice().sort(((t,e)=>t-e)),u=n[Math.floor(D/2)]||0;i=new Array(D);for(let t=0;t<D;t++){const n=0===u?0:e[t]/(6*u),r=Math.abs(n)>=1?0:(1-n*n)*(1-n*n);i[t]=r}}for(let s=0;s<t;s++){const o=s===t-1?u:n+r*s;e.push({x:o,y:h(o,i)})}return e},confidenceInterval:function(u=50,r=.05){const i=[];if(u<=0)return i;if(0===D)return i;let s=1/0,a=-1/0;for(let t=0;t<D;t++)o[t]<s&&(s=o[t]),o[t]>a&&(a=o[t]);if(s===1/0||a===-1/0)return i;const l=ht(t,e,n,(t=>h(t)));if(0===l.n)return i;const c=Math.abs(Dt(1-r/2));if(l.min===l.max){const t=h(l.min),e=lt(l.min,l);for(let n=0;n<u;n++)i.push({x:l.min,mean:t,lower:t-c*e.seMean,upper:t+c*e.seMean,predLower:t-c*e.sePred,predUpper:t+c*e.sePred});return i}const f=(a-s)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?a:s+f*t,n=h(e),r=lt(e,l);i.push({x:e,mean:n,lower:n-c*r.seMean,upper:n+c*r.seMean,predLower:n-c*r.sePred,predUpper:n+c*r.sePred})}return i}}},t.regressionPolynomial=function(t,e=(t=>t.x),n=(t=>t.y),u={}){var r;let i=null!==(r=u.degree)&&void 0!==r?r:0;i<0&&(i=0);const s=i+1,a=new Array(2*i+1).fill(0);ft(t,e,n,((t,e)=>{let n=1;for(let e=0;e<a.length;e++)a[e]+=n,n*=t}));const D=new Array(s);for(let t=0;t<s;t++){D[t]=new Array(s).fill(0);for(let e=0;e<s;e++)D[t][e]=a[t+e]}const h=new Array(s).fill(0);ft(t,e,n,((t,e)=>{let n=1;for(let u=0;u<s;u++)h[u]+=e*n,n*=t}));const l=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}(D,h),c=t=>{let e=1,n=0;for(let u=0;u<l.length;u++)n+=l[u]*e,e*=t;return n};return{degree:i,coef:l,predict:c,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})(),c),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=c(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:c(e)})}return r},confidenceInterval(u=50,r=.05){const i=[];if(u<=0)return i;const s=ht(t,e,n,c);if(0===s.n)return i;const o=Math.abs(Dt(1-r/2));if(s.min===s.max){const t=c(s.min),e=lt(s.min,s);for(let n=0;n<u;n++)i.push({x:s.min,mean:t,lower:t-o*e.seMean,upper:t+o*e.seMean,predLower:t-o*e.sePred,predUpper:t+o*e.sePred});return i}const a=(s.max-s.min)/(u-1);for(let t=0;t<u;t++){const e=t===u-1?s.max:s.min+a*t,n=c(e),r=lt(e,s);i.push({x:e,mean:n,lower:n-o*r.seMean,upper:n+o*r.seMean,predLower:n-o*r.sePred,predUpper:n+o*r.sePred})}return i}}},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)}))}}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function ecdf(data) {
|
|
2
|
+
const n = data.length, sorted = data.slice().sort(((a, b) => a - b));
|
|
3
|
+
function evaluateSingle(x) {
|
|
4
|
+
if (0 === n) return 0;
|
|
5
|
+
let lo = 0, hi = n;
|
|
6
|
+
for (;lo < hi; ) {
|
|
7
|
+
const mid = lo + hi >>> 1;
|
|
8
|
+
sorted[mid] <= x ? lo = mid + 1 : hi = mid;
|
|
9
|
+
}
|
|
10
|
+
return lo / n;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
evaluate: function(x) {
|
|
14
|
+
if (Array.isArray(x)) {
|
|
15
|
+
const out = [];
|
|
16
|
+
for (let i = 0; i < x.length; i++) out.push(evaluateSingle(x[i]));
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
return evaluateSingle(x);
|
|
20
|
+
},
|
|
21
|
+
evaluateGrid: function(N) {
|
|
22
|
+
const out = [];
|
|
23
|
+
if (N <= 0) return out;
|
|
24
|
+
if (0 === n) return out;
|
|
25
|
+
const min = sorted[0], max = sorted[n - 1];
|
|
26
|
+
if (min === max) {
|
|
27
|
+
for (let i = 0; i < N; i++) out.push({
|
|
28
|
+
x: min,
|
|
29
|
+
y: 1
|
|
30
|
+
});
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
const step = (max - min) / (N - 1);
|
|
34
|
+
for (let i = 0; i < N; i++) {
|
|
35
|
+
const x = i === N - 1 ? max : min + step * i;
|
|
36
|
+
out.push({
|
|
37
|
+
x: x,
|
|
38
|
+
y: evaluateSingle(x)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
},
|
|
43
|
+
n: n
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default ecdf;
|
|
48
|
+
//# sourceMappingURL=ecdf.js.map
|