80*s){n=h=t[0],o=a=t[1];for(var x=s;xh&&(h=c),d>a&&(a=d);g=0!==(g=Math.max(h-n,a-o))?32767/g:0}return r(m,S,s,n,o,g,0),S}function i(t,e,i,s,r){var n,o;if(r===E(t,e,i,s)>0)for(n=e;n=e;n-=s)o=A(n,t[n],t[n+1],o);return o&&m(o,o.next)&&(w(o),o=o.next),o}function s(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!m(s,s.next)&&0!==p(s.prev,s,s.next))s=s.next;else{if(w(s),(s=e=s.prev)===s.next)break;i=!0}}while(i||s!==e);return e}function r(t,e,i,l,u,c,f){if(t){!f&&c&&function(t,e,i,s){var r=t;do{0===r.z&&(r.z=d(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,s,r,n,o,h,a,l=1;do{for(i=t,t=null,n=null,o=0;i;){for(o++,s=i,h=0,e=0;e0||a>0&&s;)0!==h&&(0===a||!s||i.z<=s.z)?(r=i,i=i.nextZ,h--):(r=s,s=s.nextZ,a--),n?n.nextZ=r:t=r,r.prevZ=n,n=r;i=s}n.nextZ=null,l*=2}while(o>1)}(r)}(t,l,u,c);for(var g,y,p=t;t.prev!==t.next;)if(g=t.prev,y=t.next,c?o(t,l,u,c):n(t))e.push(g.i/i|0),e.push(t.i/i|0),e.push(y.i/i|0),w(t),t=y.next,p=y.next;else if((t=y)===p){f?1===f?r(t=h(s(t),e,i),e,i,l,u,c,2):2===f&&a(t,e,i,l,u,c):r(s(t),e,i,l,u,c,1);break}}}function n(t){var e=t.prev,i=t,s=t.next;if(p(e,i,s)>=0)return!1;for(var r=e.x,n=i.x,o=s.x,h=e.y,a=i.y,l=s.y,u=rn?r>o?r:o:n>o?n:o,f=h>a?h>l?h:l:a>l?a:l,y=s.next;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=c&&y.y<=f&&g(r,h,n,a,o,l,y.x,y.y)&&p(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function o(t,e,i,s){var r=t.prev,n=t,o=t.next;if(p(r,n,o)>=0)return!1;for(var h=r.x,a=n.x,l=o.x,u=r.y,c=n.y,f=o.y,y=ha?h>l?h:l:a>l?a:l,x=u>c?u>f?u:f:c>f?c:f,b=d(y,m,e,i,s),v=d(S,x,e,i,s),M=t.prevZ,A=t.nextZ;M&&M.z>=b&&A&&A.z<=v;){if(M.x>=y&&M.x<=S&&M.y>=m&&M.y<=x&&M!==r&&M!==o&&g(h,u,a,c,l,f,M.x,M.y)&&p(M.prev,M,M.next)>=0)return!1;if(M=M.prevZ,A.x>=y&&A.x<=S&&A.y>=m&&A.y<=x&&A!==r&&A!==o&&g(h,u,a,c,l,f,A.x,A.y)&&p(A.prev,A,A.next)>=0)return!1;A=A.nextZ}for(;M&&M.z>=b;){if(M.x>=y&&M.x<=S&&M.y>=m&&M.y<=x&&M!==r&&M!==o&&g(h,u,a,c,l,f,M.x,M.y)&&p(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;A&&A.z<=v;){if(A.x>=y&&A.x<=S&&A.y>=m&&A.y<=x&&A!==r&&A!==o&&g(h,u,a,c,l,f,A.x,A.y)&&p(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function h(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!m(n,o)&&S(n,r,r.next,o)&&v(n,o)&&v(o,n)&&(e.push(n.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),w(r),w(r.next),r=t=o),r=r.next}while(r!==t);return s(r)}function a(t,e,i,n,o,h){var a=t;do{for(var l=a.next.next;l!==a.prev;){if(a.i!==l.i&&y(a,l)){var u=M(a,l);return a=s(a,a.next),u=s(u,u.next),r(a,e,i,n,o,h,0),void r(u,e,i,n,o,h,0)}l=l.next}a=a.next}while(a!==t)}function l(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,s=e,r=t.x,n=t.y,o=-1/0;do{if(n<=s.y&&n>=s.next.y&&s.next.y!==s.y){var h=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(h<=r&&h>o&&(o=h,i=s.x=s.x&&s.x>=u&&r!==s.x&&g(ni.x||s.x===i.x&&c(i,s)))&&(i=s,f=a)),s=s.next}while(s!==l);return i}(t,e);if(!i)return e;var r=M(i,t);return s(r,r.next),s(i,i.next)}function c(t,e){return p(t.prev,t,e.prev)<0&&p(e.next,t,t.next)<0}function d(t,e,i,s,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,i=t;do{(e.x=(t-o)*(n-h)&&(t-o)*(s-h)>=(i-o)*(e-h)&&(i-o)*(n-h)>=(r-o)*(s-h)}function y(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&S(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(v(t,e)&&v(e,t)&&function(t,e){var i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==t);return s}(t,e)&&(p(t.prev,t,e.prev)||p(t,e.prev,e))||m(t,e)&&p(t.prev,t,t.next)>0&&p(e.prev,e,e.next)>0)}function p(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function m(t,e){return t.x===e.x&&t.y===e.y}function S(t,e,i,s){var r=b(p(t,e,i)),n=b(p(t,e,s)),o=b(p(i,s,t)),h=b(p(i,s,e));return r!==n&&o!==h||!(0!==r||!x(t,i,e))||!(0!==n||!x(t,s,e))||!(0!==o||!x(i,t,s))||!(0!==h||!x(i,e,s))}function x(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function b(t){return t>0?1:t<0?-1:0}function v(t,e){return p(t.prev,t,t.next)<0?p(t,e,t.next)>=0&&p(t,t.prev,e)>=0:p(t,e,t.prev)<0||p(t,t.next,e)<0}function M(t,e){var i=new T(t.i,t.x,t.y),s=new T(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function A(t,e,i,s){var r=new T(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function T(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,i,s){for(var r=0,n=e,o=i-s;n0&&(s+=t[r-1].length,i.holes.push(s))}return i}},369:(t,e,i)=>{i.r(e),i.d(e,{Collection:()=>T,Iterable:()=>Is,List:()=>ai,Map:()=>Re,OrderedMap:()=>Mi,OrderedSet:()=>ls,PairSorting:()=>gs,Range:()=>Yi,Record:()=>ys,Repeat:()=>Ms,Seq:()=>Z,Set:()=>Vi,Stack:()=>Ci,default:()=>Cs,fromJS:()=>As,get:()=>ae,getIn:()=>ji,has:()=>he,hasIn:()=>$i,hash:()=>mt,is:()=>ft,isAssociative:()=>w,isCollection:()=>x,isImmutable:()=>_,isIndexed:()=>A,isKeyed:()=>v,isList:()=>hi,isMap:()=>ut,isOrdered:()=>D,isOrderedMap:()=>ct,isOrderedSet:()=>Di,isPlainObject:()=>re,isRecord:()=>B,isSeq:()=>k,isSet:()=>Li,isStack:()=>Ii,isValueObject:()=>dt,merge:()=>we,mergeDeep:()=>Ee,mergeDeepWith:()=>Ie,mergeWith:()=>Te,remove:()=>ue,removeIn:()=>pe,set:()=>ce,setIn:()=>ge,update:()=>Se,updateIn:()=>de,version:()=>Es});var s="delete",r=5,n=1<>>0;if(""+i!==e||4294967295===i)return NaN;e=i}return e<0?u(t)+e:e}function d(){return!0}function f(t,e,i){return(0===t&&!m(t)||void 0!==i&&t<=-i)&&(void 0===e||void 0!==i&&e>=i)}function g(t,e){return p(t,e,0)}function y(t,e){return p(t,e,e)}function p(t,e,i){return void 0===t?i:m(t)?e===1/0?e:0|Math.max(0,e+t):void 0===e||e===t?t:0|Math.min(e,t)}function m(t){return t<0||0===t&&1/t==-1/0}var S="@@__IMMUTABLE_ITERABLE__@@";function x(t){return Boolean(t&&t[S])}var b="@@__IMMUTABLE_KEYED__@@";function v(t){return Boolean(t&&t[b])}var M="@@__IMMUTABLE_INDEXED__@@";function A(t){return Boolean(t&&t[M])}function w(t){return v(t)||A(t)}var T=function(t){return x(t)?t:Z(t)},E=function(t){function e(t){return v(t)?t:K(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(T),I=function(t){function e(t){return A(t)?t:Q(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(T),C=function(t){function e(t){return x(t)&&!w(t)?t:tt(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(T);T.Keyed=E,T.Indexed=I,T.Set=C;var P="@@__IMMUTABLE_SEQ__@@";function k(t){return Boolean(t&&t[P])}var F="@@__IMMUTABLE_RECORD__@@";function B(t){return Boolean(t&&t[F])}function _(t){return x(t)||B(t)}var L="@@__IMMUTABLE_ORDERED__@@";function D(t){return Boolean(t&&t[L])}var z=0,O=1,R=2,V="function"==typeof Symbol&&Symbol.iterator,N="@@iterator",G=V||N,H=function(t){this.next=t};function U(t,e,i,s){var r=0===t?e:1===t?i:[e,i];return s?s.value=r:s={value:r,done:!1},s}function W(){return{value:void 0,done:!0}}function X(t){return!!Array.isArray(t)||!!J(t)}function Y(t){return t&&"function"==typeof t.next}function j(t){var e=J(t);return e&&e.call(t)}function J(t){var e=t&&(V&&t[V]||t[N]);if("function"==typeof e)return e}H.prototype.toString=function(){return"[Iterator]"},H.KEYS=z,H.VALUES=O,H.ENTRIES=R,H.prototype.inspect=H.prototype.toSource=function(){return this.toString()},H.prototype[G]=function(){return this};var $=Object.prototype.hasOwnProperty;function q(t){return!(!Array.isArray(t)&&"string"!=typeof t)||t&&"object"==typeof t&&Number.isInteger(t.length)&&t.length>=0&&(0===t.length?1===Object.keys(t).length:t.hasOwnProperty(t.length-1))}var Z=function(t){function e(t){return null==t?nt():_(t)?t.toSeq():function(t){var e,i,s=at(t);if(s)return(i=J(e=t))&&i===e.entries?s.fromEntrySeq():function(t){var e=J(t);return e&&e===t.keys}(t)?s.toSetSeq():s;if("object"==typeof t)return new it(t);throw new TypeError("Expected Array or collection object of values, or keyed object: "+t)}(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq {","}")},e.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},e.prototype.__iterate=function(t,e){var i=this._cache;if(i){for(var s=i.length,r=0;r!==s;){var n=i[e?s-++r:r++];if(!1===t(n[1],n[0],this))break}return r}return this.__iterateUncached(t,e)},e.prototype.__iterator=function(t,e){var i=this._cache;if(i){var s=i.length,r=0;return new H((function(){if(r===s)return{value:void 0,done:!0};var n=i[e?s-++r:r++];return U(t,n[0],n[1])}))}return this.__iteratorUncached(t,e)},e}(T),K=function(t){function e(t){return null==t?nt().toKeyedSeq():x(t)?v(t)?t.toSeq():t.fromEntrySeq():B(t)?t.toSeq():ot(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toKeyedSeq=function(){return this},e}(Z),Q=function(t){function e(t){return null==t?nt():x(t)?v(t)?t.entrySeq():t.toIndexedSeq():B(t)?t.toSeq().entrySeq():ht(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toIndexedSeq=function(){return this},e.prototype.toString=function(){return this.__toString("Seq [","]")},e}(Z),tt=function(t){function e(t){return(x(t)&&!w(t)?t:Q(t)).toSetSeq()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return e(arguments)},e.prototype.toSetSeq=function(){return this},e}(Z);Z.isSeq=k,Z.Keyed=K,Z.Set=tt,Z.Indexed=Q,Z.prototype[P]=!0;var et=function(t){function e(t){this._array=t,this.size=t.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return this.has(t)?this._array[c(this,t)]:e},e.prototype.__iterate=function(t,e){for(var i=this._array,s=i.length,r=0;r!==s;){var n=e?s-++r:r++;if(!1===t(i[n],n,this))break}return r},e.prototype.__iterator=function(t,e){var i=this._array,s=i.length,r=0;return new H((function(){if(r===s)return{value:void 0,done:!0};var n=e?s-++r:r++;return U(t,n,i[n])}))},e}(Q),it=function(t){function e(t){var e=Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]);this._object=t,this._keys=e,this.size=e.length}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},e.prototype.has=function(t){return $.call(this._object,t)},e.prototype.__iterate=function(t,e){for(var i=this._object,s=this._keys,r=s.length,n=0;n!==r;){var o=s[e?r-++n:n++];if(!1===t(i[o],o,this))break}return n},e.prototype.__iterator=function(t,e){var i=this._object,s=this._keys,r=s.length,n=0;return new H((function(){if(n===r)return{value:void 0,done:!0};var o=s[e?r-++n:n++];return U(t,o,i[o])}))},e}(K);it.prototype[L]=!0;var st,rt=function(t){function e(t){this._collection=t,this.size=t.length||t.size}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var i=j(this._collection),s=0;if(Y(i))for(var r;!(r=i.next()).done&&!1!==t(r.value,s++,this););return s},e.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var i=j(this._collection);if(!Y(i))return new H(W);var s=0;return new H((function(){var e=i.next();return e.done?e:U(t,s++,e.value)}))},e}(Q);function nt(){return st||(st=new et([]))}function ot(t){var e=at(t);if(e)return e.fromEntrySeq();if("object"==typeof t)return new it(t);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+t)}function ht(t){var e=at(t);if(e)return e;throw new TypeError("Expected Array or collection object of values: "+t)}function at(t){return q(t)?new et(t):X(t)?new rt(t):void 0}var lt="@@__IMMUTABLE_MAP__@@";function ut(t){return Boolean(t&&t[lt])}function ct(t){return ut(t)&&D(t)}function dt(t){return Boolean(t&&"function"==typeof t.equals&&"function"==typeof t.hashCode)}function ft(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!!(dt(t)&&dt(e)&&t.equals(e))}var gt="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var i=65535&(t|=0),s=65535&(e|=0);return i*s+((t>>>16)*s+i*(e>>>16)<<16>>>0)|0};function yt(t){return t>>>1&1073741824|3221225471&t}var pt=Object.prototype.valueOf;function mt(t){if(null==t)return St(t);if("function"==typeof t.hashCode)return yt(t.hashCode(t));var e,i,s,r=(e=t).valueOf!==pt&&"function"==typeof e.valueOf?e.valueOf(e):e;if(null==r)return St(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(t){if(t!=t||t===1/0)return 0;var e=0|t;for(e!==t&&(e^=4294967295*t);t>4294967295;)e^=t/=4294967295;return yt(e)}(r);case"string":return r.length>Ct?(void 0===(s=Ft[i=r])&&(s=xt(i),kt===Pt&&(kt=0,Ft={}),kt++,Ft[i]=s),s):xt(r);case"object":case"function":return function(t){var e;if(wt&&void 0!==(e=At.get(t)))return e;if(void 0!==(e=t[It]))return e;if(!vt){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[It]))return e;if(void 0!==(e=function(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}(t)))return e}if(e=Mt(),wt)At.set(t,e);else{if(void 0!==bt&&!1===bt(t))throw new Error("Non-extensible objects are not allowed as keys.");if(vt)Object.defineProperty(t,It,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[It]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[It]=e}}return e}(r);case"symbol":return function(t){var e=Tt[t];return void 0!==e||(e=Mt(),Tt[t]=e),e}(r);default:if("function"==typeof r.toString)return xt(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function St(t){return null===t?1108378658:1108378659}function xt(t){for(var e=0,i=0;i=0&&(l.get=function(e,i){return(e=c(this,e))>=0&&eh)return{value:void 0,done:!0};var t=r.next();return s||e===O||t.done?t:U(e,a-1,e===z?void 0:t.value[1],t)}))},l}function Gt(t,e,i,s){var r=qt(t);return r.__iterateUncached=function(r,n){var o=this;if(n)return this.cacheResult().__iterate(r,n);var h=!0,a=0;return t.__iterate((function(t,n,l){if(!h||!(h=e.call(i,t,n,l)))return a++,r(t,s?n:a-1,o)})),a},r.__iteratorUncached=function(r,n){var o=this;if(n)return this.cacheResult().__iterator(r,n);var h=t.__iterator(R,n),a=!0,l=0;return new H((function(){var t,n,u;do{if((t=h.next()).done)return s||r===O?t:U(r,l++,r===z?void 0:t.value[1],t);var c=t.value;n=c[0],u=c[1],a&&(a=e.call(i,u,n,o))}while(a);return r===R?t:U(r,n,u,t)}))},r}function Ht(t,e,i){var s=qt(t);return s.__iterateUncached=function(r,n){if(n)return this.cacheResult().__iterate(r,n);var o=0,h=!1;return function t(a,l){a.__iterate((function(n,a){return(!e||l0}function Yt(t,e,i,s){var r=qt(t),n=new et(i).map((function(t){return t.size}));return r.size=s?n.max():n.min(),r.__iterate=function(t,e){for(var i,s=this.__iterator(O,e),r=0;!(i=s.next()).done&&!1!==t(i.value,r++,this););return r},r.__iteratorUncached=function(t,r){var n=i.map((function(t){return t=T(t),j(r?t.reverse():t)})),o=0,h=!1;return new H((function(){var i;return h||(i=n.map((function(t){return t.next()})),h=s?i.every((function(t){return t.done})):i.some((function(t){return t.done}))),h?{value:void 0,done:!0}:U(t,o++,e.apply(null,i.map((function(t){return t.value}))))}))},r}function jt(t,e){return t===e?t:k(t)?e:t.constructor(e)}function Jt(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function $t(t){return v(t)?E:A(t)?I:C}function qt(t){return Object.create((v(t)?K:A(t)?Q:tt).prototype)}function Zt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Z.prototype.cacheResult.call(this)}function Kt(t,e){return void 0===t&&void 0===e?0:void 0===t?1:void 0===e?-1:t>e?1:t0;)e[i]=arguments[i+1];if("function"!=typeof t)throw new TypeError("Invalid merger function: "+t);return Ae(this,e,t)}function Ae(t,e,i){for(var s=[],r=0;r0;)e[i]=arguments[i+1];return Pe(t,e)}function Te(t,e){for(var i=[],s=arguments.length-2;s-- >0;)i[s]=arguments[s+2];return Pe(e,i,t)}function Ee(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return Ce(t,e)}function Ie(t,e){for(var i=[],s=arguments.length-2;s-- >0;)i[s]=arguments[s+2];return Ce(e,i,t)}function Ce(t,e,i){return Pe(t,e,function(t){return function e(i,s,r){return ne(i)&&ne(s)&&(n=s,o=Z(i),h=Z(n),A(o)===A(h)&&v(o)===v(h))?Pe(i,[s],e):t?t(i,s,r):s;var n,o,h}}(i))}function Pe(t,e,i){if(!ne(t))throw new TypeError("Cannot merge into non-data-structure value: "+t);if(_(t))return"function"==typeof i&&t.mergeWith?t.mergeWith.apply(t,[i].concat(e)):t.merge?t.merge.apply(t,e):t.concat.apply(t,e);for(var s=Array.isArray(t),r=t,n=s?I:E,o=s?function(e){r===t&&(r=le(r)),r.push(e)}:function(e,s){var n=$.call(r,s),o=n&&i?i(r[s],e,s):e;n&&o===r[s]||(r===t&&(r=le(r)),r[s]=o)},h=0;h0;)e[i]=arguments[i+1];return Ce(this,e,t)}function Be(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return de(this,t,qe(),(function(t){return Pe(t,e)}))}function _e(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];return de(this,t,qe(),(function(t){return Ce(t,e)}))}function Le(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this}function De(){return this.__ownerID?this:this.__ensureOwner(new l)}function ze(){return this.__ensureOwner()}function Oe(){return this.__altered}var Re=function(t){function e(e){return null==e?qe():ut(e)&&!D(e)?e:qe().withMutations((function(i){var s=t(e);ee(s.size),s.forEach((function(t,e){return i.set(e,t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return qe().withMutations((function(e){for(var i=0;i=t.length)throw new Error("Missing value for key: "+t[i]);e.set(t[i],t[i+1])}}))},e.prototype.toString=function(){return this.__toString("Map {","}")},e.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},e.prototype.set=function(t,e){return Ze(this,t,e)},e.prototype.remove=function(t){return Ze(this,t,h)},e.prototype.deleteAll=function(t){var e=T(t);return 0===e.size?this:this.withMutations((function(t){e.forEach((function(e){return t.remove(e)}))}))},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):qe()},e.prototype.sort=function(t){return Mi(Ut(this,t))},e.prototype.sortBy=function(t,e){return Mi(Ut(this,e,t))},e.prototype.map=function(t,e){var i=this;return this.withMutations((function(s){s.forEach((function(r,n){s.set(n,t.call(e,r,n,i))}))}))},e.prototype.__iterator=function(t,e){return new Ye(this,t,e)},e.prototype.__iterate=function(t,e){var i=this,s=0;return this._root&&this._root.iterate((function(e){return s++,t(e[1],e[0],i)}),e),s},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?$e(this.size,this._root,t,this.__hash):0===this.size?qe():(this.__ownerID=t,this.__altered=!1,this)},e}(E);Re.isMap=ut;var Ve=Re.prototype;Ve[lt]=!0,Ve[s]=Ve.remove,Ve.removeAll=Ve.deleteAll,Ve.setIn=ye,Ve.removeIn=Ve.deleteIn=me,Ve.update=xe,Ve.updateIn=be,Ve.merge=Ve.concat=ve,Ve.mergeWith=Me,Ve.mergeDeep=ke,Ve.mergeDeepWith=Fe,Ve.mergeIn=Be,Ve.mergeDeepIn=_e,Ve.withMutations=Le,Ve.wasAltered=Oe,Ve.asImmutable=ze,Ve["@@transducer/init"]=Ve.asMutable=De,Ve["@@transducer/step"]=function(t,e){return t.set(e[0],e[1])},Ve["@@transducer/result"]=function(t){return t.asImmutable()};var Ne=function(t,e){this.ownerID=t,this.entries=e};Ne.prototype.get=function(t,e,i,s){for(var r=this.entries,n=0,o=r.length;n=si)return function(t,e,i,s){t||(t=new l);for(var r=new We(t,mt(i),[i,s]),n=0;n>>t)&o),h=this.bitmap;return 0==(h&n)?s:this.nodes[ei(h&n-1)].get(t+r,e,i,s)},Ge.prototype.update=function(t,e,i,s,a,l,u){void 0===i&&(i=mt(s));var c=(0===e?i:i>>>e)&o,d=1<=ri)return function(t,e,i,s,r){for(var o=0,h=new Array(n),a=0;0!==i;a++,i>>>=1)h[a]=1&i?e[o++]:void 0;return h[s]=r,new He(t,o+1,h)}(t,p,f,c,S);if(g&&!S&&2===p.length&&Qe(p[1^y]))return p[1^y];if(g&&S&&1===p.length&&Qe(S))return S;var x=t&&t===this.ownerID,b=g?S?f:f^d:f|d,v=g?S?ii(p,y,S,x):function(t,e,i){var s=t.length-1;if(i&&e===s)return t.pop(),t;for(var r=new Array(s),n=0,o=0;o>>t)&o,h=this.nodes[n];return h?h.get(t+r,e,i,s):s},He.prototype.update=function(t,e,i,s,n,a,l){void 0===i&&(i=mt(s));var u=(0===e?i:i>>>e)&o,c=n===h,d=this.nodes,f=d[u];if(c&&!f)return this;var g=Ke(f,t,e+r,i,s,n,a,l);if(g===f)return this;var y=this.count;if(f){if(!g&&--y>>i)&o,l=(0===i?s:s>>>i)&o,u=a===l?[ti(t,e,i+r,s,n)]:(h=new We(e,s,n),a>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,127&(t+=t>>8)+(t>>16)}function ii(t,e,i,s){var r=s?t:Qt(t);return r[e]=i,r}var si=n/4,ri=n/2,ni=n/4,oi="@@__IMMUTABLE_LIST__@@";function hi(t){return Boolean(t&&t[oi])}var ai=function(t){function e(e){var i=yi();if(null==e)return i;if(hi(e))return e;var s=t(e),o=s.size;return 0===o?i:(ee(o),o>0&&o=0&&t=t.size||e<0)return t.withMutations((function(t){e<0?xi(t,e).set(0,i):xi(t,0,e+1).set(e,i)}));e+=t._origin;var s=t._tail,r=t._root,n={value:!1};return e>=bi(t._capacity)?s=pi(s,t.__ownerID,0,e,i,n):r=pi(r,t.__ownerID,t._level,e,i,n),n.value?t.__ownerID?(t._root=r,t._tail=s,t.__hash=void 0,t.__altered=!0,t):gi(t._origin,t._capacity,t._level,r,s):t}(this,t,e)},e.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},e.prototype.insert=function(t,e){return this.splice(t,0,e)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=r,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):yi()},e.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(i){xi(i,0,e+t.length);for(var s=0;s>>e&o;if(s>=this.array.length)return new ui([],t);var n,h=0===s;if(e>0){var a=this.array[s];if((n=a&&a.removeBefore(t,e-r,i))===a&&h)return this}if(h&&!n)return this;var l=mi(this,t);if(!h)for(var u=0;u>>e&o;if(n>=this.array.length)return this;if(e>0){var h=this.array[n];if((s=h&&h.removeAfter(t,e-r,i))===h&&n===this.array.length-1)return this}var a=mi(this,t);return a.array.splice(n+1),s&&(a.array[n]=s),a};var ci,di={};function fi(t,e){var i=t._origin,s=t._capacity,o=bi(s),h=t._tail;return function t(a,l,u){return 0===l?function(t,r){var a=r===o?h&&h.array:t&&t.array,l=r>i?0:i-r,u=s-r;return u>n&&(u=n),function(){if(l===u)return di;var t=e?--u:l++;return a&&a[t]}}(a,u):function(o,h,a){var l,u=o&&o.array,c=a>i?0:i-a>>h,d=1+(s-a>>h);return d>n&&(d=n),function(){for(;;){if(l){var i=l();if(i!==di)return i;l=null}if(c===d)return di;var s=e?--d:c++;l=t(u&&u[s],h-r,a+(s<>>i&o,c=t&&u0){var d=t&&t.array[u],f=pi(d,e,i-r,s,n,h);return f===d?t:((l=mi(t,e)).array[u]=f,l)}return c&&t.array[u]===n?t:(h&&a(h),l=mi(t,e),void 0===n&&u===l.array.length-1?l.array.pop():l.array[u]=n,l)}function mi(t,e){return e&&t&&e===t.ownerID?t:new ui(t?t.array.slice():[],e)}function Si(t,e){if(e>=bi(t._capacity))return t._tail;if(e<1<0;)i=i.array[e>>>s&o],s-=r;return i}}function xi(t,e,i){void 0!==e&&(e|=0),void 0!==i&&(i|=0);var s=t.__ownerID||new l,n=t._origin,h=t._capacity,a=n+e,u=void 0===i?h:i<0?h+i:n+i;if(a===n&&u===h)return t;if(a>=u)return t.clear();for(var c=t._level,d=t._root,f=0;a+f<0;)d=new ui(d&&d.array.length?[void 0,d]:[],s),f+=1<<(c+=r);f&&(a+=f,n+=f,u+=f,h+=f);for(var g=bi(h),y=bi(u);y>=1<g?new ui([],s):p;if(p&&y>g&&ar;x-=r){var b=g>>>x&o;S=S.array[b]=mi(S.array[b],s)}S.array[g>>>r&o]=p}if(u=y)a-=y,u-=y,c=r,d=null,m=m&&m.removeBefore(s,0,a);else if(a>n||y>>c&o;if(v!==y>>>c&o)break;v&&(f+=(1<n&&(d=d.removeBefore(s,c,a-f)),d&&y>>r<=n&&a.size>=2*o.size?(s=(r=a.filter((function(t,e){return void 0!==t&&l!==e}))).toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(s.__ownerID=r.__ownerID=t.__ownerID)):(s=o.remove(e),r=l===a.size-1?a.pop():a.set(l,void 0))}else if(u){if(i===a.get(l)[1])return t;s=o,r=a.set(l,[e,i])}else s=o.set(e,a.size),r=a.set(a.size,[e,i]);return t.__ownerID?(t.size=s.size,t._map=s,t._list=r,t.__hash=void 0,t.__altered=!0,t):Ai(s,r)}Mi.isOrderedMap=ct,Mi.prototype[L]=!0,Mi.prototype[s]=Mi.prototype.remove;var Ei="@@__IMMUTABLE_STACK__@@";function Ii(t){return Boolean(t&&t[Ei])}var Ci=function(t){function e(t){return null==t?Bi():Ii(t)?t:Bi().pushAll(t)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.prototype.toString=function(){return this.__toString("Stack [","]")},e.prototype.get=function(t,e){var i=this._head;for(t=c(this,t);i&&t--;)i=i.next;return i?i.value:e},e.prototype.peek=function(){return this._head&&this._head.value},e.prototype.push=function(){var t=arguments;if(0===arguments.length)return this;for(var e=this.size+arguments.length,i=this._head,s=arguments.length-1;s>=0;s--)i={value:t[s],next:i};return this.__ownerID?(this.size=e,this._head=i,this.__hash=void 0,this.__altered=!0,this):Fi(e,i)},e.prototype.pushAll=function(e){if(0===(e=t(e)).size)return this;if(0===this.size&&Ii(e))return e;ee(e.size);var i=this.size,s=this._head;return e.__iterate((function(t){i++,s={value:t,next:s}}),!0),this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Fi(i,s)},e.prototype.pop=function(){return this.slice(1)},e.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Bi()},e.prototype.slice=function(e,i){if(f(e,i,this.size))return this;var s=g(e,this.size);if(y(i,this.size)!==this.size)return t.prototype.slice.call(this,e,i);for(var r=this.size-s,n=this._head;s--;)n=n.next;return this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):Fi(r,n)},e.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Fi(this.size,this._head,t,this.__hash):0===this.size?Bi():(this.__ownerID=t,this.__altered=!1,this)},e.prototype.__iterate=function(t,e){var i=this;if(e)return new et(this.toArray()).__iterate((function(e,s){return t(e,s,i)}),e);for(var s=0,r=this._head;r&&!1!==t(r.value,s++,this);)r=r.next;return s},e.prototype.__iterator=function(t,e){if(e)return new et(this.toArray()).__iterator(t,e);var i=0,s=this._head;return new H((function(){if(s){var e=s.value;return s=s.next,U(t,i++,e)}return{value:void 0,done:!0}}))},e}(I);Ci.isStack=Ii;var Pi,ki=Ci.prototype;function Fi(t,e,i,s){var r=Object.create(ki);return r.size=t,r._head=e,r.__ownerID=i,r.__hash=s,r.__altered=!1,r}function Bi(){return Pi||(Pi=Fi(0))}ki[Ei]=!0,ki.shift=ki.pop,ki.unshift=ki.push,ki.unshiftAll=ki.pushAll,ki.withMutations=Le,ki.wasAltered=Oe,ki.asImmutable=ze,ki["@@transducer/init"]=ki.asMutable=De,ki["@@transducer/step"]=function(t,e){return t.unshift(e)},ki["@@transducer/result"]=function(t){return t.asImmutable()};var _i="@@__IMMUTABLE_SET__@@";function Li(t){return Boolean(t&&t[_i])}function Di(t){return Li(t)&&D(t)}function zi(t,e){if(t===e)return!0;if(!x(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||v(t)!==v(e)||A(t)!==A(e)||D(t)!==D(e))return!1;if(0===t.size&&0===e.size)return!0;var i=!w(t);if(D(t)){var s=t.entries();return e.every((function(t,e){var r=s.next().value;return r&&ft(r[1],t)&&(i||ft(r[0],e))}))&&s.next().done}var r=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{r=!0;var n=t;t=e,e=n}var o=!0,a=e.__iterate((function(e,s){if(i?!t.has(e):r?!ft(e,t.get(s,h)):!ft(t.get(s,h),e))return o=!1,!1}));return o&&t.size===a}function Oi(t,e){var i=function(i){t.prototype[i]=e[i]};return Object.keys(e).forEach(i),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(i),t}function Ri(t){if(!t||"object"!=typeof t)return t;if(!x(t)){if(!ne(t))return t;t=Z(t)}if(v(t)){var e={};return t.__iterate((function(t,i){e[i]=Ri(t)})),e}var i=[];return t.__iterate((function(t){i.push(Ri(t))})),i}var Vi=function(t){function e(e){return null==e?Wi():Li(e)&&!D(e)?e:Wi().withMutations((function(i){var s=t(e);ee(s.size),s.forEach((function(t){return i.add(t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(E(t).keySeq())},e.intersect=function(t){return(t=T(t).toArray()).length?Gi.intersect.apply(e(t.pop()),t):Wi()},e.union=function(t){return(t=T(t).toArray()).length?Gi.union.apply(e(t.pop()),t):Wi()},e.prototype.toString=function(){return this.__toString("Set {","}")},e.prototype.has=function(t){return this._map.has(t)},e.prototype.add=function(t){return Hi(this,this._map.set(t,t))},e.prototype.remove=function(t){return Hi(this,this._map.remove(t))},e.prototype.clear=function(){return Hi(this,this._map.clear())},e.prototype.map=function(t,e){var i=this,s=!1,r=Hi(this,this._map.mapEntries((function(r){var n=r[1],o=t.call(e,n,n,i);return o!==n&&(s=!0),[o,o]}),e));return s?r:this},e.prototype.union=function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];return 0===(e=e.filter((function(t){return 0!==t.size}))).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations((function(i){for(var s=0;s=0&&e=0&&i>>-15,461845907),e=gt(e<<13|e>>>-13,5),e=gt((e=(e+3864292196|0)^t)^e>>>16,2246822507),e=yt((e=gt(e^e>>>13,3266489909))^e>>>16)}(t.__iterate(i?e?function(t,e){s=31*s+as(mt(t),mt(e))|0}:function(t,e){s=s+as(mt(t),mt(e))|0}:e?function(t){s=31*s+mt(t)|0}:function(t){s=s+mt(t)|0}),s)}(this))}});var Zi=T.prototype;Zi[S]=!0,Zi[G]=Zi.values,Zi.toJSON=Zi.toArray,Zi.__toStringMapper=oe,Zi.inspect=Zi.toSource=function(){return this.toString()},Zi.chain=Zi.flatMap,Zi.contains=Zi.includes,Oi(E,{flip:function(){return jt(this,zt(this))},mapEntries:function(t,e){var i=this,s=0;return jt(this,this.toSeq().map((function(r,n){return t.call(e,[n,r],s++,i)})).fromEntrySeq())},mapKeys:function(t,e){var i=this;return jt(this,this.toSeq().flip().map((function(s,r){return t.call(e,s,r,i)})).flip())}});var Ki=E.prototype;Ki[b]=!0,Ki[G]=Zi.entries,Ki.toJSON=qi,Ki.__toStringMapper=function(t,e){return oe(e)+": "+oe(t)},Oi(I,{toKeyedSeq:function(){return new Bt(this,!1)},filter:function(t,e){return jt(this,Vt(this,t,e,!1))},findIndex:function(t,e){var i=this.findEntry(t,e);return i?i[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return jt(this,Rt(this,!1))},slice:function(t,e){return jt(this,Nt(this,t,e,!1))},splice:function(t,e){var i=arguments.length;if(e=Math.max(e||0,0),0===i||2===i&&!e)return this;t=g(t,t<0?this.count():this.size);var s=this.slice(0,t);return jt(this,1===i?s:s.concat(Qt(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var i=this.findLastEntry(t,e);return i?i[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return jt(this,Ht(this,t,!1))},get:function(t,e){return(t=c(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find((function(e,i){return i===t}),void 0,e)},has:function(t){return(t=c(this,t))>=0&&(void 0!==this.size?this.size===1/0||te?-1:0}function as(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}ts.has=Zi.includes,ts.contains=ts.includes,ts.keys=ts.values,Oi(K,Ki),Oi(Q,Qi),Oi(tt,ts);var ls=function(t){function e(t){return null==t?fs():Di(t)?t:fs().withMutations((function(e){var i=C(t);ee(i.size),i.forEach((function(t){return e.add(t)}))}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.of=function(){return this(arguments)},e.fromKeys=function(t){return this(E(t).keySeq())},e.prototype.toString=function(){return this.__toString("OrderedSet {","}")},e}(Vi);ls.isOrderedSet=Di;var us,cs=ls.prototype;function ds(t,e){var i=Object.create(cs);return i.size=t?t.size:0,i._map=t,i.__ownerID=e,i}function fs(){return us||(us=ds(wi()))}cs[L]=!0,cs.zip=Qi.zip,cs.zipWith=Qi.zipWith,cs.zipAll=Qi.zipAll,cs.__empty=fs,cs.__make=ds;var gs={LeftThenRight:-1,RightThenLeft:1},ys=function(t,e){var i;!function(t){if(B(t))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(_(t))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===t||"object"!=typeof t)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(t);var s=function(n){var o=this;if(n instanceof s)return n;if(!(this instanceof s))return new s(n);if(!i){i=!0;var h=Object.keys(t),a=r._indices={};r._name=e,r._keys=h,r._defaultValues=t;for(var l=0;l2?[]:void 0,{"":t})}function ws(t,e,i,s,r,n){if("string"!=typeof i&&!_(i)&&(q(i)||X(i)||re(i))){if(~t.indexOf(i))throw new TypeError("Cannot convert circular structure to Immutable");t.push(i),r&&""!==s&&r.push(s);var o=e.call(n,s,Z(i).map((function(s,n){return ws(t,e,s,n,r,i)})),r&&r.slice());return t.pop(),r&&r.pop(),o}return i}function Ts(t,e){return A(e)?e.toList():v(e)?e.toMap():e.toSet()}var Es="4.3.2",Is=T;const Cs={version:Es,Collection:T,Iterable:T,Seq:Z,Map:Re,OrderedMap:Mi,List:ai,Stack:Ci,Set:Vi,OrderedSet:ls,PairSorting:gs,Record:ys,Range:Yi,Repeat:Ms,is:ft,fromJS:As,hash:mt,isImmutable:_,isCollection:x,isKeyed:v,isIndexed:A,isAssociative:w,isOrdered:D,isValueObject:dt,isPlainObject:re,isSeq:k,isList:hi,isMap:ut,isOrderedMap:ct,isStack:Ii,isSet:Li,isOrderedSet:Di,isRecord:B,get:ae,getIn:ji,has:he,hasIn:$i,merge:we,mergeDeep:Ee,mergeWith:Te,mergeDeepWith:Ie,remove:ue,removeIn:pe,set:ce,setIn:ge,update:Se,updateIn:de}},475:(t,e,i)=>{Object.defineProperty(e,"i",{value:!0});var s=i(369),r=i(102),n=i(187),o=function(t){if(t&&t.i)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}(s),h=function(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}(n);class a{constructor(){this.o=!0}l(){return this.o}}class l extends a{constructor(t,e){super(),this.u=t,this.o=e}S(t){return t!==this.u&&(this.u=t,this.o=!0),this}M(){return this.u}l(){return super.l()}}const u=(t,e)=>({x:t,y:e}),c=(t,e)=>({x:t,y:e}),d=(t,e,i)=>({position:t,high:e,low:i}),f=(t,e,i)=>({x:t,y:e,z:i}),g=t=>{const e=Array(0),i=Array(0);return t.length>0&&t.forEach((t=>{e.push(u(t.position,t.high)),i.push(u(t.position,t.low))})),[e,i]},y=(t,e)=>({min:t,max:e}),p=(t,e,i,s)=>({x:Math.ceil(t),y:Math.ceil(e),width:Math.ceil(i),height:Math.ceil(s)}),m=(t,e=!0)=>new l(t,e),S=(t=0,e=0,i=0,s=0)=>({left:t,top:e,right:i,bottom:s}),x=S,b=(t,e)=>({left:void 0!==e.left?e.left:t.left,top:void 0!==e.top?e.top:t.top,right:void 0!==e.right?e.right:t.right,bottom:void 0!==e.bottom?e.bottom:t.bottom}),v=s.Record({type:"color",r:1,g:1,b:1,a:1});class M extends v{constructor(t){super(t)}toString(){return`color:${this.r},${this.g},${this.b},${this.a}`}setA(t){return this.set("a",t/255)}setR(t){return this.set("r",t/255)}setG(t){return this.set("g",t/255)}setB(t){return this.set("b",t/255)}getA(){return 255*this.get("a")}getR(){return 255*this.get("r")}getG(){return 255*this.get("g")}getB(){return 255*this.get("b")}getHighlight(){return this._||(this._=new M({r:this.r+.45*(1-this.r),g:this.g+.45*(1-this.g),b:this.b+.45*(1-this.b),a:this.a<1?this.a+.45*(1-this.a):1})),this._}getLighter(){return this.C||(this.C=new M({r:this.r+.4*(1-this.r),g:this.g+.4*(1-this.g),b:this.b+.4*(1-this.b),a:this.a})),this.C}getDarker(){return this.T||(this.T=new M({r:this.r-.4*(1-this.r),g:this.g-.4*(1-this.g),b:this.b-.4*(1-this.b),a:this.a})),this.T}toRGBAString(){return`rgba( ${255*this.r}, ${255*this.g}, ${255*this.b}, ${255*this.a} )`}}const A=t=>!(!t||"object"!=typeof t||!("type"in t)||"color"!==t.type),w=(t,e,i,s=255)=>new M({r:t/255,g:e/255,b:i/255,a:s/255}),T=t=>{const e=t.startsWith("#")?t.substring(1):t.startsWith("0x")?t.substr(2):t;switch(e.length){case 8:return new M({r:Number(`0x${e.substring(0,2)}`)/255,g:Number(`0x${e.substring(2,4)}`)/255,b:Number(`0x${e.substring(4,6)}`)/255,a:Number(`0x${e.substring(6,8)}`)/255});case 6:return new M({r:Number(`0x${e.substring(0,2)}`)/255,g:Number(`0x${e.substring(2,4)}`)/255,b:Number(`0x${e.substring(4,6)}`)/255});case 4:return new M({r:Number(`0x${e.charAt(0)}${e.charAt(0)}`)/255,g:Number(`0x${e.charAt(1)}${e.charAt(1)}`)/255,b:Number(`0x${e.charAt(2)}${e.charAt(2)}`)/255,a:Number(`0x${e.charAt(3)}${e.charAt(3)}`)/255});case 3:return new M({r:Number(`0x${e.charAt(0)}${e.charAt(0)}`)/255,g:Number(`0x${e.charAt(1)}${e.charAt(1)}`)/255,b:Number(`0x${e.charAt(2)}${e.charAt(2)}`)/255});default:throw new Error(`ColorHEX parsing error | input: ${t}`)}},E=(t,e=1,i=1)=>{let s,r,n;t/=360;const o=Math.floor(6*t),h=6*t-o,a=i*(1-e),l=i*(1-h*e),u=i*(1-(1-h)*e);switch(o%6){case 0:s=i,r=u,n=a;break;case 1:s=l,r=i,n=a;break;case 2:s=a,r=i,n=u;break;case 3:s=a,r=l,n=i;break;case 4:s=u,r=a,n=i;break;default:s=i,r=a,n=l}return new M({r:s,g:r,b:n})},I={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},C=new M({}),P=w(0,0,0,0),k=(t,e)=>t.value-e.value,F=s.Record({type:"lut",steps:[],title:"",units:"",interpolate:!0,color:w(0,0,0,255),length:0,min:0,max:0,subranges:[],isValid:!1}),B=t=>{const{steps:e}=t,i=e.length;e.sort(k);const[s,r]=i>0?[e[0].value,e[i-1].value]:[0,0],n=i>0?i-1:0,o=Array(n);for(let t=0;t0&&s!==r}};class _ extends F{constructor(t){super(((t,e)=>({steps:t.steps,title:t.title,units:t.units,interpolate:t.interpolate,color:t.color,length:e.length,min:e.min,max:e.max,subranges:e.subranges,isValid:e.isValid}))(t,B(t)))}toString(){return`LUT:interpolate=${this.interpolate},steps=${this.steps.map((t=>`${t.value},${t.color.toString()}`)).join(",")}`}setSteps(t){return this.merge(B({...this,steps:t}))}getSteps(){return this.get("steps")}setTitle(t){return this.set("title",t)}getTitle(){return this.get("title")}setUnits(t){return this.set("units",t)}getUnits(){return this.get("units")}setInterpolation(t){return this.set("interpolate",t)}getInterpolation(){return this.get("interpolate")}setFallbackColor(t){return this.set("color",t)}getFallbackColor(){return this.get("color")}getColors(t){if(Array.isArray(t)){if(Array.isArray(t[0])){const e=t,i=e.length,s=e[0].length,r=[...Array(i)].map((()=>Array(s)));for(let t=0;t=a&&t<=l){if(a===l)return i.color;const e=(t-i.value)/(h.value-i.value);return s=i.color,r=h.color,n=e,new M({r:s.r+(r.r-s.r)*n,g:s.g+(r.g-s.g)*n,b:s.b+(r.b-s.b)*n,a:s.a+(r.a-s.a)*n})}}return t=0;s-=1)if(t>=e[s].value)return e[s].color;return e[0].color}}const L=s.Record({type:"fillstyle",fillType:"empty"});class D extends L{toString(){return"emptyFill"}}const z=new D,O=s.Record({type:"fillstyle",fillType:"solid",color:w(255,255,255)});class R extends O{}class V extends R{constructor(t){super({...t,fillType:"solid"})}toString(){return`solidFill:${this.color.toString()}`}setColor(t){return A(t)?this.set("color",t):this.set("color",t(this.get("color")))}getColor(){return this.get("color")}setA(t){return this.setColor(this.getColor().setA(t))}setR(t){return this.setColor(this.getColor().setR(t))}setG(t){return this.setColor(this.getColor().setG(t))}setB(t){return this.setColor(this.getColor().setB(t))}}const N=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"solid"===t.fillType);class G extends R{constructor(t){super({...t,fillType:"individual"})}toString(){return`individualPointFill:${this.color.toString()}`}setFallbackColor(t){return A(t)?this.set("color",t):this.set("color",t(this.get("color")))}getFallbackColor(){return this.get("color")}}const H=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"individual"===t.fillType),U=s.Record({type:"fillstyle",fillType:"palette",lut:new _({steps:[]}),lookUpProperty:"value"}),W=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"palette"===t.fillType),X={linear:(t,e,i)=>{const s=e-t;return r=>rs=>ss=>ss=>s{const e=se(t);return(i,s,r)=>{const n=e(i),o=e(s);return e=>e(this.delta===this.duration||this.I)&&0===this.nextAnimations.length,this.values=t,this.action=e,this.duration=i,this.easing=s,this.D=n,this.eases=t.map((([t,e])=>s(t,e,i)))}O(){this.P.emit("start")}start(){return this.D.includes(this)||this.D.push(this),this}addNextAnimations(t){return t instanceof Array?t.forEach((t=>this.nextAnimations.push(t))):this.nextAnimations.push(t),this}NextAnimation(t,e,i=this.duration,s=this.easing){const r=new Y(t,e,i,s,this.D);return this.nextAnimations.push(r),r}onAnimationStart(t,e){return this.P.on("start",t,e)}onAnimationEnd(t,e){return this.P.on("end",t,e)}onEveryAnimationEnd(t,e){return this.P.on("everyEnd",t,e)}onAllAnimationEnd(t,e){return this.P.on("allEnd",t,e)}allOffAnimationEnd(){return this.P.topicOff("end"),this}allOffEveryAnimationEnd(){return this.P.topicOff("everyEnd"),this}allOffAllAnimationEnd(){return this.P.topicOff("allEnd"),this}offAnimationEnd(t){return this.P.off(t,"end")}offEveryAnimationEnd(t){return this.P.off(t,"everyEnd")}offAllAnimationEnd(t){return this.P.off(t,"allEnd")}finish(t=!0){if(this.I=!0,this.D.splice(this.D.indexOf(this),1),this.nextAnimations.length>0){const e=this.nextAnimations[0];return t&&(this.P.listeners("allEnd").forEach(((t,i)=>e.onAllAnimationEnd(t,i))),this.P.listeners("everyEnd").forEach(((t,i)=>e.onEveryAnimationEnd(t,i)))),e.addNextAnimations(this.nextAnimations.slice(1)),e.start(),t&&(this.P.emit("end",e),this.P.emit("everyEnd",e)),e}t&&(this.P.emit("end",void 0),this.P.emit("everyEnd",void 0),this.P.emit("allEnd"))}finishAll(t=!0){let e=this;for(;e;)e=e.finish(t)}getFinalValues(){return this.nextAnimations.length>0?this.nextAnimations[this.nextAnimations.length-1].values.map(wt):this.values.map(wt)}getTimeUntilFinish(){let t=this.duration-this.delta;for(let e=0;e{e>60&&console.log("Note: Animator FPS is usually capped at 60 by the browser!");const i=[];let s,r,n=0;const o=()=>{s=void 0;const h=Date.now();r=r||h,n=h-r,n/1e3>=1/e&&(r=Date.now()-n%(1e3/e),i.forEach((t=>{0===t.delta&&t.O(),t.delta+=n-n%(1e3/e),t.delta>t.duration&&(t.delta=t.duration),t.action(t.eases.map((e=>e(t.delta)))),t.delta===t.duration&&t.finish()})),t()),i.length>0?s=xt.requestAnimationFrame(o):(s=void 0,r=void 0)};return(t=1e3,e=X.linear)=>(r,n,h=t)=>{const a=new Y(r,n,h,e,i).start();return s||(s=xt.requestAnimationFrame(o)),a}};var J,$;e.GradientShape=void 0,(J=e.GradientShape||(e.GradientShape={})).circle="circle",J.ellipse="ellipse",e.GradientExtent=void 0,($=e.GradientExtent||(e.GradientExtent={})).closestSide="closest-side",$.closestCorner="closest-corner",$.farthestSide="farthest-side",$.farthestCorner="farthest-corner";const q=s.Record({type:"fillstyle",fillType:"radial-gradient",stops:[{color:T("#f00"),offset:0},{color:T("#0f0"),offset:1}],position:u(.5,.5),shape:e.GradientShape.ellipse,extent:e.GradientExtent.farthestCorner});class Z extends q{constructor(t){if(super(t),null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("RadialGradientFill requires minimum two color stops to be defined.")}toString(){return`radialGradientFill:${this.shape},${this.extent},${this.position.x},${this.position.y},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");return this.set("stops",t)}getColorStops(){return this.get("stops")}setPosition(t){return this.set("position",t)}getPosition(){return this.get("position")}setShape(t){return this.set("shape",t)}getShape(){return this.get("shape")}setExtent(t){return this.set("extent",t)}getExtent(){return this.get("extent")}}const K=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"radial-gradient"===t.fillType),Q=s.Record({type:"fillstyle",fillType:"linear-gradient",stops:[{color:T("#f00"),offset:0},{color:T("#0f0"),offset:1}],angle:0});class tt extends Q{constructor(t){if(super(t),null===t||t&&null===t.stops||t&&t.stops&&!Array.isArray(t.stops)||t&&t.stops&&Array.isArray(t.stops)&&t.stops.length<2)throw new Error("LinearGradientFill requires minimum two color stops to be defined.")}toString(){return`linearGradientFill:${this.angle},${this.stops.map((t=>`${t.offset},${t.color.toString()}`)).join(",")}`}setColorStops(t){if(t.length<2)throw new Error("Minimum of two color stops required");const e=t.sort(((t,e)=>t.offset-e.offset));return this.set("stops",e)}getColorStops(){return this.get("stops")}setAngle(t,e){return this.set("angle",e?fi(t):t)}getAngle(t){return t?di(this.get("angle")):this.get("angle")}}const et=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"linear-gradient"===t.fillType),it=s.Record({type:"linestyle",lineType:"empty"}),st=new class extends it{constructor(){super(...arguments),this.thickness=0}setThickness(t){return this}getThickness(){return 0}L(){return 0}setFillStyle(t){return this}getFillStyle(){return z}};class rt{constructor(t,e,i,s){this.cellIndex=t,this.cellSpan=e,this.cellsAmount=i,this.observedAmount=s,this.x=new nt,this.y=new nt,this.z=new nt,this.P=new r.Eventer;const n={...t},o={...e};if(s){const t=t=>{this.cellsAmount.x=t.reduce(Oe,0),this.cellIndex.x=t.reduce(((t,e,i)=>i>=n.x?t:t+e),0),this.cellSpan.x=t.reduce(((t,e,i)=>i>=n.x&&i{this.cellsAmount.y=t.reduce(Oe,0),this.cellIndex.y=t.reduce(((t,e,i)=>i>=n.y?t:t+e),0),this.cellSpan.y=t.reduce(((t,e,i)=>i>=n.y&&i{s.x.N(e),s.y.N(r)}}}G(){return this.V&&(this.V(),this.V=void 0),this}W(t){return this.P.on("cell-resize",t)}H(t){return this.P.off(t,"cell-resize")}}class nt extends a{constructor(){super(...arguments),this.U=0,this.$=10,this.j=1}Y(){return this.o=!1,this}X(){return this.o=!0,this}getInnerStart(){return this.U}getInnerEnd(){return this.$}getInnerInterval(){return Math.abs(this.getInnerEnd()-this.getInnerStart())}Z(t,e){return this.U=t,this.$=e,this.K(),this}q(t){return this.j=t,this.K(),this}J(t){return t/this.j}K(){const t=this.J(this.$-this.U),e=this.j;void 0!==this.tt&&!1!==It(t,this.tt)||(this.o=!0,this.it=e,this.tt=t)}st(){return this.tt}et(){return this.it}ht(){return this.$new t.scale1DConstructor(0,1,1,void 0),d2:t=>(new t.scaleXYConstructor).nt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0),d3:()=>new rt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0)},ht=(t,e,i)=>e===i?t:i.ot(e.ut(t)),at=(t,e,i)=>{if(e===i)return t;const s=e instanceof Bi?e.x:e.x instanceof Bi?e.x.x:e.x.ct,r=e instanceof Bi?e.y:e.y instanceof Bi?e.y.y:e.y.ct,n=i instanceof Bi?i.x:i.x instanceof Bi?i.x.x:i.x.ct,o=i instanceof Bi?i.y:i.y instanceof Bi?i.y.y:i.y.ct;return{...t,x:ht(t.x,s,n),y:ht(t.y,r,o)}},lt=(...t)=>{if(0===t.length)return{remove:Et};let e=!1;const i=t.map((i=>i.onIntervalChange(((s,r,n)=>((i,s,r)=>{e||(e=!0,t.filter((t=>t!==i)).forEach((t=>t.dt(s,r,!1,!1,"synchronizedAxis"))),e=!1)})(i,r,n)))));let s=!1;const r=t.map((e=>e.onStoppedStateChanged(((i,r)=>((e,i)=>{s||(s=!0,t.filter((t=>t!==e)).forEach((t=>t.setStopped(i))),s=!1)})(e,r)))));return{remove:()=>{t.forEach(((t,e)=>{t.offIntervalChange(i[e]),t.offStoppedStateChanged(r[e])}))}}};class ut{constructor(t){this.ft=t,this.yt=new Map}St(t){const e=this.yt.get(t);return e&&e.length>0?e[0]:void 0}xt(t){let e=this.yt.get(t.lut);e?e.push(t):(e=[t],this.yt.set(t.lut,e))}bt(t){const e=this.yt.get(t.lut);if(e){const i=e.indexOf(t);i>=0&&e.splice(i,1),0===e.length&&(this.ft.deleteTexture(t.texture),this.yt.delete(t.lut))}}vt(){this.yt.forEach((t=>{var e;const i=null===(e=t[0])||void 0===e?void 0:e.texture;i&&this.ft.deleteTexture(i)})),this.yt.clear()}}const ct=t=>new ut(t);class dt extends Error{constructor(t,e){super(`ChartError: ${t} ${e?`in ${e.constructor.name}`:""}`),Object.setPrototypeOf(this,dt.prototype)}}class ft extends Error{constructor(t,e,i=!1){const s=`EngineError: ${t} ${e?`in ${e.constructor.name}`:""}`;super(s),i&&xt.alert(s),Object.setPrototypeOf(this,ft.prototype)}}class gt extends ft{constructor(t){super(t),Object.setPrototypeOf(this,gt.prototype)}}var yt,pt,mt,St;e.UISpace=void 0,(yt=e.UISpace||(e.UISpace={}))[yt.Content=0]="Content",yt[yt.PaddedContent=1]="PaddedContent",yt[yt.PaddedBackground=2]="PaddedBackground",yt[yt.Everything=3]="Everything",e.UIVisibilityModes=void 0,(pt=e.UIVisibilityModes||(e.UIVisibilityModes={}))[pt.never=0]="never",pt[pt.always=1]="always",pt[pt.whenHovered=2]="whenHovered",pt[pt.whenDragged=3]="whenDragged",pt[pt.whenNotDragged=4]="whenNotDragged",pt[pt.whenHoveredOrDragged=5]="whenHoveredOrDragged",e.UIDraggingModes=void 0,(mt=e.UIDraggingModes||(e.UIDraggingModes={}))[mt.notDraggable=0]="notDraggable",mt[mt.draggable=1]="draggable",mt[mt.onlyHorizontal=2]="onlyHorizontal",mt[mt.onlyVertical=3]="onlyVertical",e.UIDirections=void 0,(St=e.UIDirections||(e.UIDirections={}))[St.Up=0]="Up",St[St.Right=1]="Right",St[St.Down=2]="Down",St[St.Left=3]="Left";const xt="undefined"!=typeof window?window:void 0!==i.g&&i.g._lcjs?i.g._lcjs:{},bt=(t,e)=>t.x===e.x&&t.y===e.y,vt=t=>t!==Pe&&t!==ke&&!Number.isNaN(t)&&Number.isFinite(t)&&t!==1/0&&t!==-1/0,Mt=(t,e)=>Math.min(t,e.y),At=(t,e)=>Math.max(t,e.y),wt=t=>t[1],Tt=t=>t.dispose(),Et=()=>{},It=(t,e)=>t===e,Ct=(t,e,i)=>i>e?Math.min(Math.max(t,e),i):Math.min(Math.max(t,i),e),Pt=t=>Array.prototype.concat.apply([],t),kt=(t,e)=>{const{x:i,y:s}={x:t[0].length,y:t.length},{column:r,row:n}=e,o=Math.max(0,r.start),h=Math.min(i,r.end),a=Math.max(0,n.start),l=Math.min(s,n.end),u=h-o,c=l-a,d=Array.from(Array(c)).map((()=>Array(u)));for(let e=a,i=0;e{const i=e&&void 0!==e.row.start?e.row.start:0,s=e&&void 0!==e.row.end?e.row.end:t.y,r=e&&void 0!==e.column.start?e.column.start:0,n=e&&void 0!==e.column.end?e.column.end:t.x;return[Math.min(i,s),Math.max(i,s),Math.min(r,n),Math.max(r,n)]},Bt=(t,e)=>{for(;e;)t.push(t.shift()),e-=1},_t=t=>{const e=[];for(const i of t)e.push(i.slice());return e},Lt=(t,e)=>void 0!==t?t:e,Dt=t=>t.Mt(),zt=t=>t._t(),Ot=t=>t.At(),Rt=t=>t.wt(),Vt=t=>t.min.x,Nt=t=>t.max.x,Gt=t=>t.min.y,Ht=t=>t.max.y,Ut=(t,e,i,s,r)=>{if(t.length>0){let n=r?s(r):void 0;for(let s=0;st.position===e.position&&t.high===e.high&&t.low===e.low,Xt=u(0,1),Yt=u(1,0),jt=u(0,-1),Jt=u(-1,0),$t=u(0,0),qt=t=>{switch(t){case e.UIDirections.Up:return Xt;case e.UIDirections.Right:return Yt;case e.UIDirections.Down:return jt;case e.UIDirections.Left:return Jt;default:return $t}},Zt=t=>t===e.UIDirections.Left||t===e.UIDirections.Right,Kt=t=>{t.stopPropagation(),t.preventDefault()},Qt=(t,e)=>{if(!e){const e=t.length,i=new Float32Array(2*e);let s=0;for(let r=0;r{const e=t.length,i=new Float32Array(3*e);let s=0;for(let r=0;re=>{const i=t.indexOf(e);i>=0&&t.splice(i,1)},ie=t=>{let e=t.length;for(let i=0;i{const e=Math.log(t);return t=>Math.log(t)/e},re=se(Math.E),ne=(t,e)=>{const i=e[t];return i?i():void 0},oe=(t,e)=>{let i;if(e)i=e;else{const e={x:0,y:0};for(let i=0;igi(ni(t,i))-gi(ni(e,i))))},he=(t,e,i)=>{if(0===t.length)return!1===i.canReturnB?e.slice():e;const s=e.length;if(s<1e5)return t.push.apply(t,e),t;for(let i=0;ii<0?t:i>1?e:w(t.getR()+i*(e.getR()-t.getR()),t.getG()+i*(e.getG()-t.getG()),t.getB()+i*(e.getB()-t.getB()),t.getA()+i*(e.getA()-t.getA())),le=t=>255===t.getA()?t:t.setA(255),ue=(()=>{const t=w(0,0,0);return i=>(i=le(i),new Z({shape:e.GradientShape.circle,extent:e.GradientExtent.farthestCorner,position:{x:.2,y:.8},stops:[{offset:0,color:i},{offset:1,color:ae(i,t,.5)}]}))})(),ce=(()=>{const t=t=>{var e;if(t){if(N(t)){if(0===t.getColor().getA())return;return t.getColor()}if(K(t)||et(t)){const i=t.getColorStops();return 3===i.length?i[1].color:null===(e=i[0])||void 0===e?void 0:e.color}W(t)}};return(e,i,s)=>{const r=[];if(s.fill&&r.push(s.fill),s.fill2&&r.push(s.fill2),s.stroke){const t=s.stroke.getFillStyle();t!==z&&r.push(t)}if(s.point3D){const t=s.point3D;r.push(t.getFillStyle())}let n;if(s.behavior&&!0===s.behavior.colorStep){const[e,s]=r.reduce(((e,i)=>{if(e[0]&&e[1])return e;const s=t(i);return s&&(void 0===e[0]?e[0]=s:e[1]=s),e}),[void 0,void 0]);n=e&&s?(o=e)===(h=s)||o.getR()===h.getR()&&o.getG()===h.getG()&&o.getB()===h.getB()?ue(o):(o=le(o),h=le(h),new tt({angle:0,stops:[{offset:0,color:h},{offset:.5,color:h},{offset:.5,color:o},{offset:1,color:o}]})):i.uiButtonFillStyle}else{const e=r.reduce(((e,i)=>e||t(i)),void 0);n=e?ue(e):i.uiButtonFillStyle}var o,h;e.setButtonOffFillStyle(new V({color:w(255,255,255,0)})).setButtonOffStrokeStyle(i.uiButtonStrokeStyle).setButtonOnFillStyle(n).setButtonOnStrokeStyle(st)}})(),de=t=>{const e=t;if(W(e))return{lut:e.getPalette(),lookUpProperty:e.getLookUpProperty()}},fe=t=>{let e=0;return()=>(e+=1,`${t}-${e}`)},ge=(t,e)=>{let i="string"==typeof t?t:String(t);const s=i.indexOf(".");let r=s>=0?s:i.length;for(;r"function"==typeof t?t(e):t,pe=t=>t.ctrlKey?Math.sign(t.deltaY)*Math.min(.05*Math.abs(t.deltaY),1):Math.sign(t.deltaY),me=(t,e)=>e(),Se=()=>new Error("LightningChart JS encountered an unexpected error.\nPlease report this issue to https://lightningchart.com/js-charts/docs/contact");new V({color:w(255,255,255,1)});const xe=t=>t===Fe||t.min.x===Fe.min.x&&t.max.x===Fe.max.x&&t.min.y===Fe.min.y&&t.max.y===Fe.max.y,be=t=>Array.from(new Set(t)),ve=t=>"boolean"==typeof t?t?1:0:t>1?1:t<0?0:t,Me=(t,e)=>{throw new Error(e)},Ae=()=>{const t=j((()=>{}));let e;return(i,s,r,n)=>{const o=null==n?void 0:n.onStart,h=null==n?void 0:n.onCompleted,a=(null==n?void 0:n.easing)||X.ease,l=(null==n?void 0:n.durationMs)||1e3;let u;if(e)if(0===e.nextAnimations.length){const t=e.NextAnimation([[i,s]],(([i])=>{e=t,r(i)}),l,a);u=t}else{i=e.nextAnimations.pop().values[0][0];const t=e.NextAnimation([[i,s]],(([i])=>{e=t,r(i)}),l,a);u=t}else u=t(l,a)([[i,s]],(([t])=>{r(t)})),e=u;u.onAnimationEnd((()=>{e=void 0})),o&&u.onAnimationStart(o),h&&u.onAnimationEnd(h)}},we=t=>{let e;return()=>e||(e=t(),e)},Te=t=>{if(t===st)return 0;const e=t.getThickness();return e<0?1:1*e},Ee=(t,e,i,s)=>{const r=`LightningChart JS Resources not found.\nresourcesBaseUrl: "${t}"\ninitiator: ${i}\nresource url: ${e}\nFor more information, please find the FAQ from API documentation at below link:\nhttps://lightningchart.com/js-charts/api-documentation/\nand read section "What is LightningChart JS Resources not found error?"`;if(s.shouldCrash)throw xt.alert(r),new Error(r);xt.console.warn(r)},Ie={left:0,right:0,top:0,bottom:0},Ce={add:(t,e)=>f(t.x+e,t.y+e,t.z+e),addVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x+=t.x,i.y+=t.y,i.z+=t.z;return i},subtract:(t,e)=>f(t.x-e,t.y-e,t.z-e),subtractVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x-=t.x,i.y-=t.y,i.z-=t.z;return i},multiply:(t,e)=>f(t.x*e,t.y*e,t.z*e),divide:(t,e)=>f(t.x/e,t.y/e,t.z/e),multiplyVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x*=t.x,i.y*=t.y,i.z*=t.z;return i},divideVec(t,...e){const i={x:t.x,y:t.y,z:t.z};for(const t of e)i.x/=t.x,i.y/=t.y,i.z/=t.z;return i},length:t=>Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z),normalize:t=>Ce.divide(t,Ce.length(t)),dot:(t,e)=>t.x*e.x+t.y*e.y+t.z*e.z,cross:(t,e)=>f(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z,t.x*e.y-t.y*e.x),angle:(t,e)=>Math.acos(Ce.dot(t,e)/(Ce.length(t)*Ce.length(e))),rotateAroundAxis(t,e,i){const s=Math.cos(i),r=Math.sin(i),n=Ce.dot(e,t),o=Ce.cross(e,t);return Ce.addVec(Ce.multiply(t,s),Ce.addVec(Ce.multiply(e,(1-s)*n),Ce.multiply(o,r)))},lerp:(t,e,i)=>(i=Ct(i,0,1),Ce.addVec(Ce.multiply(t,1-i),Ce.multiply(e,i))),equals:(t,e)=>It(t.x,e.x)&&It(t.y,e.y)&&It(t.z,e.z),abs:t=>({x:Math.abs(t.x),y:Math.abs(t.y),z:Math.abs(t.z)}),sign:t=>({x:Math.sign(t.x),y:Math.sign(t.y),z:Math.sign(t.z)})},Pe=Number.MAX_SAFE_INTEGER,ke=-Number.MAX_SAFE_INTEGER,Fe=y(u(Pe,Pe),u(ke,ke)),Be=y(f(Pe,Pe,Pe),f(ke,ke,ke)),_e=(t,e)=>{const i=Math.log(t)/Math.log(e);return Math.floor((t=>(Math.ceil(t)-t<1e-4?t=Math.ceil(t):t-Math.floor(t)<1e-4&&(t=Math.floor(t)),t))(i))},Le=(t,e)=>!(e.min.x>t.max.x||e.max.xt.max.y||e.max.y!(t[1].xe[1].x||t[3].ye[3].y),ze=(t,e)=>y(u(Math.max(Math.min(t[0].x,t[2].x),Math.min(e[0].x,e[2].x)),Math.max(Math.min(t[0].y,t[2].y),Math.min(e[0].y,e[2].y))),u(Math.min(Math.max(t[0].x,t[2].x),Math.max(e[0].x,e[2].x)),Math.min(Math.max(t[0].y,t[2].y),Math.max(e[0].y,e[2].y)))),Oe=(t,e)=>e+t,Re=(t,e,i)=>{const s=ni(e,t),r=s.x*s.x+s.y*s.y;if(0===r)return t;const n=ni(i,t),o=(n.x*s.x+n.y*s.y)/r;return o<=0?t:o>=1?e:u(t.x+o*s.x,t.y+o*s.y)},Ve=(t,e,i)=>i>e?t>=e&&t<=i:t>=i&&t<=e,Ne=(t,e)=>{const i=t.x-e.x,s=t.y-e.y;return Math.sqrt(i*i+s*s)},Ge=(t,e)=>{const i=t.x-e.x,s=t.y-e.y;return i*i+s*s},He=(t,e,i)=>{const s=Ge(e,i);if(0===s)return[Ge(t,e),e];let r=li(ni(t,e),ni(i,e))/s;r=Math.max(0,Math.min(1,r));const n=u(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y));return[Ge(t,n),n]},Ue=(t,e,i)=>ri(t,si(ni(e,t),i)),We=(t,e,i)=>Ce.addVec(t,Ce.multiply(Ce.subtractVec(e,t),i));function Xe(t){const e=t.length;if(e>0){let i=t[0].x,s=t[0].x,r=t[0].y,n=t[0].y;for(let o=0;oi&&(i=e.x),e.xr&&(r=e.y),e.y0){let i=t[0].x,s=t[0].x,r=t[0].y,n=t[0].y,o=t[0].z,h=t[0].z;for(let a=0;ai&&(i=e.x),e.xr&&(r=e.y),e.yo&&(o=e.z),e.z{const e={min:{x:Pe,y:Pe},max:{x:ke,y:ke}};for(const i of t)e.min.x=e.min.xi.max.x?e.max.x:i.max.x,e.min.y=e.min.yi.max.y?e.max.y:i.max.y;return e},Je=(t,e)=>y(f(t.min.xe.max.x?t.max.x:e.max.x,t.max.y>e.max.y?t.max.y:e.max.y,t.max.z>e.max.z?t.max.z:e.max.z));function $e(t,e,i,s){const r=t.x-s.x,n=t.y-s.y,o=s.x-i.x,h=i.y-s.y,a=h*r+o*n,l=(s.y-e.y)*r+(e.x-s.x)*n,u=h*(e.x-s.x)+o*(e.y-s.y);return u<0?a<=0&&l<=0&&a+l>=u:a>=0&&l>=0&&a+l<=u}const qe=(t,e,i,s)=>u((t.x+e.x+i.x+s.x)/4,(t.y+e.y+i.y+s.y)/4),Ze=(t,e,i,s,r)=>{if(e.x>i.x)if(e.x>s.x)if(e.x>r.x){if(t.x>e.x)return!1;if(r.xr.x)return!1;if(s.xr.x){if(t.x>s.x)return!1;if(r.xr.x)return!1;if(t.xs.x)if(i.x>r.x){if(t.x>i.x)return!1;if(r.xr.x)return!1;if(s.xr.x){if(t.x>s.x)return!1;if(r.xr.x)return!1;if(s.xi.y)if(e.y>s.y)if(e.y>r.y){if(t.y>e.y)return!1;if(r.yr.y)return!1;if(s.yr.y){if(t.y>s.y)return!1;if(r.yr.y)return!1;if(t.ys.y)if(i.y>r.y){if(t.y>i.y)return!1;if(r.yr.y)return!1;if(s.yr.y){if(t.y>s.y)return!1;if(r.yr.y)return!1;if(s.y{const s=(i.y-e.y)/(i.x-e.x),r=e.y+(t-e.x)*s;return u(t,r)},ci=(t,e,i)=>{const s=(i.y-e.y)/(i.x-e.x),r=e.x+(t-e.y)/s;return u(r,t)};function di(t){return t*Math.PI/180}function fi(t){return 180*t/Math.PI}function gi(t){return 180*Math.atan2(t.y,t.x)/Math.PI}function yi(t){return u(Math.cos(t),Math.sin(t))}function pi(t){let e=-1;const i=Math.cos(t),s=Math.sin(t);return i>0&&i<1&&s>0&&s<1?e=1:i<0&&i>-1&&s>0&&s<1?e=2:i<0&&i>-1&&s<0&&s>-1?e=3:i>0&&i<1&&s<0&&s>-1&&(e=4),e}const mi=(t,e,i,s)=>{let r,n,o,h;if(e.x-t.x!=0||s.x-i.x!=0)return e.x-t.x==0?(o=e.x,n=(s.y-i.y)/(s.x-i.x),h=n*(o-i.x)+i.y):s.x-i.x==0?(o=s.x,r=(e.y-t.y)/(e.x-t.x),h=r*(o-t.x)+t.y):(r=(e.y-t.y)/(e.x-t.x),n=(s.y-i.y)/(s.x-i.x),o=(i.y-n*i.x+r*t.x-t.y)/(r-n),h=r*(o-t.x)+t.y),u(o,h)},Si=(t,e)=>{const i=t.length,s=e.length,r=new Uint16Array(i+s);return r.set(t,0),r.set(e,i),r};class xi{constructor(){this.kt=!0}getInnerStart(){return this.U}getInnerEnd(){return this.$}getInnerInterval(){return Math.abs(this.$-this.U)}Z(t,e){return this.U=t,this.$=e,this}Y(){return this.kt=!1,this}X(){return this.kt=!0,this}}class bi extends xi{constructor(t,e,i,s){if(super(),this.Ct=!0,this.Tt=!0,this.Ft=[0,0],this.It=!0,this.Pt=t,this.Dt=e,this.Bt=i,this.Ot=t,this.Lt=e,s){const t=s.R(this.Rt.bind(this));this.Rt(s.M()),this.Et=()=>s.N(t)}}q(t){return this.j=t,this.Tt=!0,this}zt(t){return this.Ft=t.map(Math.abs),this.It=!0,this}Vt(){return this.Pt/this.Bt*this.j+this.Ft[0]}Nt(){return(this.Pt+this.Dt)/this.Bt*this.j-this.Ft[1]}Gt(){return this.getCellSize()-this.Wt()}Ht(){return this.j}getCellSize(){return this.Ut(this.j)}Wt(){return this.Ft[0]+this.Ft[1]}$t(){return this.Ft}Rt(t){this.Bt=t.reduce(Oe,0),this.Pt=t.reduce(((t,e,i)=>i>=this.Ot?t:t+e),0),this.Dt=t.reduce(((t,e,i)=>i>=this.Ot&&iTi;return!n&&!o||!!r&&(e>t?{start:n?wi:t,end:o?Ti:e}:{start:o?Ti:t,end:n?wi:e})}ut(t){const e=this.Vt(),i=this.Nt(),s=Math.max(t,wi);return e+(this.Yt.function(s)-this.Xt.scaleStartLog)/this.Xt.scaleIntervalLog*(i-e)}ot(t){const e=this.Vt(),i=(t-e)/(this.Nt()-e),s=this.Xt.scaleStartLog+i*this.Xt.scaleIntervalLog;return this.Yt.number**s}jt(){this.Yt&&this.Zt()}Z(t,e){return super.Z(t,e),this.Yt&&this.Zt(),this}zt(t){return super.zt(t),this.Yt&&this.Zt(),this}q(t){return super.q(t),this.Yt&&this.Zt(),this}Kt(t){return this.Yt={internal:t,function:Mi(t),number:Ai(t)},this}qt(){return this.Yt.internal}Jt(t,e){const i=this.ut(t)+e;return this.ot(i)}Qt(){return this.Tt||this.kt||this.It||this.Ct}Zt(){const t=this.Yt.function(this.U),e=this.Yt.function(this.$)-t,i=2*this.Vt()/this.j-1,s=2*this.Nt()/this.j-1-i;return this.Xt={scaleStartLog:t,scaleIntervalLog:e,viewportStart:i,viewportSize:s},this.Xt}ti(){return this.Xt}}const Mi=t=>"e"===t?re:se(t),Ai=t=>"e"===t?Math.E:t,wi=.9*1e-9,Ti=1.1*10**32,Ei=[{prefix:"T",unit:10**12},{prefix:"B",unit:10**9},{prefix:"M",unit:1e6},{prefix:"K",unit:1e3}],Ii=(t,e,i)=>{const s=Math.abs(i-e),r=Math.max(2-_e(s,10),0);return t.toFixed(r)},Ci={Numeric:(t,e)=>Ii(t,e.getInnerStart(),e.getInnerEnd()),NumericUnits:(t,e)=>{const i=Math.abs(e.getInnerEnd()-e.getInnerStart()),s=t<0;t=Math.abs(t);let r="",n="";if(i>=1e3&&t>1e3){let e="";for(const i of Ei){const s=Math.round(1e3*t/i.unit)/1e3;if(s>=1){e=s.toString(),n=i.prefix;break}}r=(s?"-":"")+e}else{let e=String(Math.floor(t));const n=_e(t,1e3);for(let t=1;t<=n;t+=1){const i=e.length-(3*t+(t-1));e=`${e.substring(0,i)} ${e.substring(i,e.length)}`}r=(s?"-":"")+e+(i<=10?((t,e)=>{if(0===e)return"";let i=(Math.abs(t)-Math.abs(Math.floor(t))).toString().substring(1);return i.length>e&&(i=i.substring(0,e+1)),i})(t,2-_e(i,10)):"")}return r+=n,r}},Pi=(t,e)=>{const i=Mi(e);return"e"===e?t?(t,e)=>`${Math.floor(i(t))}e`:()=>"":(t,e)=>{const s=t.toString();if(t>1)return s;const r=Math.floor(i(t));return t.toFixed(Math.abs(r))}};class ki extends bi{constructor(t,e,i,s){super(t,e,i,s),this.ii=!1,this.si=!1,this.ei=0,this.j=1e3,this.Z(0,10),this.K()}Qt(){return this.si}rt(t,e,i,s,r){if(t===e)return!1;const n=Math.abs(s-i),o=Math.abs(e-t);if(!this.ii){const i=((t,e,i)=>{const s=((t,e)=>{if(eke&&tke){const i=Math.abs(t/2**23),s=Math.abs(e/2**23),r=Math.min(i,s);return 10**Math.floor(Math.log10(r))}})(t,e);if(void 0!==s)return s*i})(t,e,this.getCellSize());if(void 0===i)return!1;if(o>i)return!0;const s=(e+t)/2,h=(r?i/2:n/2)*(t>e?-1:1);return{start:s-h,end:s+h}}const h=10**-(12-Math.log10(Math.max(Math.abs(t),1)));if(o>h)return!0;const a=(e+t)/2,l=(r?h/2:n/2)*(t>e?-1:1);return{start:a-l,end:a+l}}jt(){this.K()}ut(t){return this.Vt()+(t-this.U)/(this.$-this.U)*(this.Nt()-this.Vt())}ot(t){return this.U+(t-this.Vt())/(this.Nt()-this.Vt())*(this.$-this.U)}Z(t,e){return super.Z(t,e),this.K(),this}zt(t){return super.zt(t),this.K(),this}q(t){return super.q(t),this.hi=Fi(this.$-this.U,this.Ft,this.j,this.Dt,this.Bt),this.K(),this}ri(){return this.ii=!0,this}ni(){return this.ii}oi(){return Math.abs(this.ai)}li(){return this.oi()/this.hi}ui(){return this.ci}di(){return this.fi}getPixelSize(){return this.hi}ti(){return this.Xt}X(){return super.X(),this.si=!0,this}Y(){return super.Y(),this.si=!1,this}gi(t,e=Ci.Numeric){return e(t,this)}pi(){const t=Math.abs(this.getInnerEnd()).toString().length,e=Math.abs(this.getInnerStart()).toString().length;return t>e?t:e}mi(t){return Fi(t,this.Ft,this.j,this.Dt,this.Bt)}K(){let t=this.U,e=this.$,i=0;this.ii&&(t=0,e=this.$-this.U,i=this.U);const s=e-t,r=Fi(s,this.Ft,this.j,this.Dt,this.Bt);this.fi=t-this.Ft[0]*r,this.ci=e+this.Ft[1]*r;const n=this.ci-this.fi,o=n-this.ai,h=Math.abs(o/r),a=s-this.ei,l=Math.abs(a/r);(!this.Xt||h>=.4||l>=.4)&&(this.ei=s,this.ai=n,this.hi=r,this.si=!0);const u=this.ai*this.Bt/(2*this.Dt),c=-(this.fi-this.ai*this.Pt/this.Dt)-u,d=2*this.Vt()/this.j-1,f=2*this.Nt()/this.j-1-d;this.Xt={displacement:c,scaling:u,highPrecisionOffset:i,viewportStart:d,viewportSize:f,scaleStartLog:0,scaleIntervalLog:0}}Jt(t,e){return t+this.hi*e}}const Fi=(t,e,i,s=1,r=1)=>t/(i*s/r-(e[0]+e[1]));class Bi{yi(t,e){return"x"in t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e),this}Y(){return this.x.Y(),this.y.Y(),this}X(){return this.x.X(),this.y.X(),this}q(t,e){return"object"==typeof t?(this.x.q(t.x),this.y.q(t.y)):(this.x.q(t),this.y.q(e)),this}Ht(){return u(this.x.Ht(),this.y.Ht())}Si(t){return this.x.zt(t),this}xi(t){return this.y.zt(t),this}Wt(){return u(this.x.Wt(),this.y.Wt())}bi(t,e){return this.x.Z(t,e),this}vi(t,e){return this.y.Z(t,e),this}getInnerIntervalPixels(){const t=this.x.getCellSize(),e=this.y.getCellSize();return{x:t-this.x.Wt(),y:e-this.y.Wt()}}Mi(){return this.x.Qt()||this.y.Qt()}}class _i extends Bi{constructor(){super(...arguments),this._i="LinearScaleXY"}nt(t,e,i,s){return this.x=new ki(t.x,e.x,i.x,s?s.x:void 0),this.y=new ki(t.y,e.y,i.y,s?s.y:void 0),this}ni(){return this.x.ni()||this.y.ni()}Ai(){return u(this.x.getPixelSize(),this.y.getPixelSize())}ti(){return{x:this.x.ti(),y:this.y.ti()}}Jt(t,e){const i=this.Ai();return{x:t.x+e.x*i.x,y:t.y+e.y*i.y}}wi(t,e,i,s){const r=this.Ai(),n=ei(t,e);return n.x*=s,n.y*=s,{x:t.x+i*r.x*n.x,y:t.y+i*r.y*n.y}}}class Li extends Bi{constructor(){super(...arguments),this._i="MixedScaleXY"}ni(){return!1}Jt(t,e){const i=this.x.ut(t.x),s=this.y.ut(t.y),r={x:i+e.x,y:s+e.y};return{x:this.x.ot(r.x),y:this.y.ot(r.y)}}wi(t,e,i,s){const r={x:this.x.ut(t.x),y:this.y.ut(t.y)},n={x:this.x.ut(e.x),y:this.y.ut(e.y)},o=ti(ni(n,r)),h=ei(n,r),a={x:r.x+o.x*s+h.x*i,y:r.y+o.y*s+h.y*i};return{x:this.x.ot(a.x),y:this.y.ot(a.y)}}ti(){const t=this.x.ti(),e=this.y.ti();return{uScaleStart:[this.x.U,this.y.U],uScaleInterval:[this.x.getInnerInterval(),this.y.getInnerInterval()],uScaleStartLog:[t.scaleStartLog,e.scaleStartLog],uScaleIntervalLog:[t.scaleIntervalLog,e.scaleIntervalLog],uViewportStart:[t.viewportStart,e.viewportStart],uViewportSize:[t.viewportSize,e.viewportSize]}}}const Di=(t,e)=>t instanceof vi||e instanceof vi?(new Li).yi(t,e):(new _i).yi(t,e),zi=t=>"client"===t,Oi=t=>!!(t&&"object"==typeof t&&"clientX"in t&&"number"==typeof t.clientX&&"clientY"in t&&"number"==typeof t.clientY),Ri=t=>"relative"===t,Vi=t=>!!(t&&"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y);var Ni;e.HighlightModes=void 0,(Ni=e.HighlightModes||(e.HighlightModes={}))[Ni.noHighlighting=0]="noHighlighting",Ni[Ni.onHover=1]="onHover";class Gi{constructor(t,i,s,n){this.ki=!0,this.Ci=e.HighlightModes.onHover,this.Ti=!1,this.Fi=!0,this.Ii=!1,this.P=new r.Eventer,this.Pi=[],this.Di=[],this.Bi=(t,e)=>{this.setVisible(e)},this.Oi=()=>this.setHighlight(1),this.Li=()=>this.setHighlight(0),this.onMouseEnter=t=>this.P.on("mouseEnter",t),this.onMouseLeave=t=>this.P.on("mouseLeave",t),this.onMouseClick=t=>this.P.on("mouseClick",t),this.onMouseDoubleClick=t=>this.P.on("mouseDoubleClick",t),this.onMouseDown=t=>this.P.on("mouseDown",t),this.onMouseUp=t=>this.P.on("mouseUp",t),this.onMouseMove=t=>this.P.on("mouseMove",t),this.offMouseEnter=t=>this.P.off(t,"mouseEnter"),this.offMouseLeave=t=>this.P.off(t,"mouseLeave"),this.offMouseClick=t=>this.P.off(t,"mouseClick"),this.offMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClick"),this.offMouseDown=t=>this.P.off(t,"mouseDown"),this.offMouseUp=t=>this.P.off(t,"mouseUp"),this.offMouseMove=t=>this.P.off(t,"mouseMove"),this.offMouseDragStart=t=>this.P.off(t,"mouseDragStart"),this.offMouseDrag=t=>this.P.off(t,"mouseDrag"),this.offMouseDragStop=t=>this.P.off(t,"mouseDragStop"),this.offMouseWheel=t=>this.P.off(t,"mouseWheel"),this.Ri=(t,i,s)=>{this.P.emit("mouseEnter",this,i),this.Ii=!0,this.Ci===e.HighlightModes.onHover&&this.setHighlight(!0)},this.Ei=(t,i,s)=>{this.P.emit("mouseLeave",this,i),this.Ii=!1,this.Ci===e.HighlightModes.onHover&&this.setHighlight(!1)},this.zi=(t,e,i)=>{this.P.emit("mouseMove",this,e)},this.Vi=(t,e,i)=>this.P.emit("mouseClick",this,e),this.Ni=(t,e,i)=>this.P.emit("mouseDoubleClick",this,e),this.Gi=(t,e,i)=>this.P.emit("mouseDown",this,e),this.Wi=(t,e,i)=>this.P.emit("mouseUp",this,e),this.Hi=(t,e,i,s)=>{this.P.emit("mouseDragStart",this,e,i)},this.Ui=(t,e,i,s,r,n)=>{this.P.emit("mouseDrag",this,e,i,s,r)},this.$i=(t,e,i,s,r)=>{this.P.emit("mouseDragStop",this,e,i,s)},this.ji=(t,e,i)=>{this.P.emit("mouseWheel",this,e)},this.Yi=(t,i,s)=>{this.P.emit("touchStart",this,i),this.Ii=!0,this.Ci===e.HighlightModes.onHover&&this.setHighlight(!0)},this.Xi=(t,e,i)=>{this.P.emit("touchMove",this,e)},this.Zi=(t,i,s)=>{this.P.emit("touchEnd",this,i),this.Ii=!1,this.Ci===e.HighlightModes.onHover&&this.setHighlight(!1)},this.Ki=t,this.qi=i,this.Ji=s,this.Qi=new Map,this.ts=n,this.ss=this.ts.es(this,{hs:{themeEffectEnabled:this.Ji.effectsText},rs:{}}),this.Ki.ls.os.ns(this,(t=>{this.Qi.forEach(((e,i)=>i.us(t))),this.Di.forEach((e=>e.setHighlight(t))),this.Pi.forEach((e=>e.us(t)))}),{animationEnabled:this.Ki.getAnimationsEnabled()})}cs(t,e){const i=void 0===(null==e?void 0:e.setEventHandlers)||e.setEventHandlers,s=void 0!==(null==e?void 0:e.isText)&&e.isText;this.Qi.set(t,{isText:s});const r=Array.from(this.Qi);this.ss.hs.ds(r.filter((t=>t[1].isText)).map((t=>t[0]))),this.ss.rs.ds(r.filter((t=>!t[1].isText)).map((t=>t[0]))),t.setMouseInteractions(this.ki).setVisible(this.Fi).us(this.Ki.ls.os.fs(this,!0)),i&&t.setMouseEnterEventHandler(this.Ri).setMouseLeaveEventHandler(this.Ei).setMouseClickEventHandler(this.Vi).setMouseDoubleClickEventHandler(this.Ni).setMouseDownEventHandler(this.Gi).setMouseUpEventHandler(this.Wi).setMouseMoveEventHandler(this.zi).setMouseDragStartEventHandler(this.Hi).setMouseDragEventHandler(this.Ui).setMouseDragStopEventHandler(this.$i).setMouseWheelEventHandler(this.ji).setTouchStartEventHandler(this.Yi).setTouchMoveEventHandler(this.Xi).setTouchEndEventHandler(this.Zi);const n=t.onDispose((()=>{t.offDispose(n),this.Qi.delete(t)}))}gs(t){this.Pi=t;const e=this.Ki.ls.os.fs(this,!0);t.forEach((t=>{t.us(e).ps(this.Fi)}))}setEffect(t){return this.ss.hs.ys(t&&this.Ji.effectsText),this.ss.rs.ys(t),this.Ki.ls.Ss(),this}getEffect(){return this.ss.hs.xs()||this.ss.rs.xs()}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setName(t){return this.bs=t,this.Di.forEach((t=>t.setText(this.bs))),this}getName(){return this.bs}dispose(){return this.Ti||(this.Ti=!0,this.Qi.forEach(((t,e)=>e.dispose())),this.qi(this),this.Di.forEach((t=>{t.dispose()})),this.Di.length=0,this.P.emit("dispose",this),this.Ki.ls.Ss()),this}setVisible(t){return t===this.Fi||(this.Fi=t,this.Qi.forEach(((e,i)=>i.setVisible(t))),this.Pi.forEach((e=>e.ps(t))),this.Di.forEach((e=>e.setOn(t))),this.P.emit("visibleStateChanged",this,this.Fi),this.Ki.ls.Ss()),this}getVisible(){return this.Fi}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}setHighlight(t){return this.Ki.ls.os.vs(this,t),this.P.emit("highlight",t),this}getHighlight(){return this.Ki.ls.os.fs(this)}setAnimationHighlight(t){return this.Ki.ls.os.Ms(this,t),this}getAnimationHighlight(){return this.Ki.ls.os._s(this)}setMouseInteractions(t){return this.ki=t,this.Qi.forEach(((e,i)=>i.setMouseInteractions(t))),this.Ki.ls.Ss(),this}getMouseInteractions(){return this.ki}getIsUnderMouse(){return this.Ii}setHighlightOnHover(t){return this.Ci=t?e.HighlightModes.onHover:e.HighlightModes.noHighlighting,!1===t&&this.getHighlight()>0&&this.setHighlight(!1),this}getHighlightOnHover(){return this.Ci!==e.HighlightModes.noHighlighting}attach(t,e=!0){t.setText(this.bs),t.setButtonOffStrokeStyle(t.getButtonOffStrokeStyle().setThickness(1)),t.setButtonOnStrokeStyle(t.getButtonOnStrokeStyle().setThickness(1));const i=t.getLocked();return t.setLocked(!1).setOn(this.getVisible()).setLocked(i),e&&t.onSwitch(this.Bi),t.setLocked(!e),t.onMouseEnter(this.Oi),t.onMouseLeave(this.Li),this.onMouseEnter((()=>t.setHighlight(!0))),this.onMouseLeave((()=>t.setHighlight(!1))),this.onTouchStart((()=>t.setHighlight(!0))),this.onTouchEnd((()=>t.setHighlight(!1))),this.Di.push(t),this}onMouseDragStart(t){return this.P.on("mouseDragStart",t)}onMouseDrag(t){return this.P.on("mouseDrag",t)}onMouseDragStop(t){return this.P.on("mouseDragStop",t)}onMouseWheel(t){return this.P.on("mouseWheel",t)}onTouchStart(t){return this.P.on("touchStart",t)}onTouchMove(t){return this.P.on("touchMove",t)}onTouchEnd(t){return this.P.on("touchEnd",t)}onDispose(t){return this.P.on("dispose",t)}offTouchStart(t){return this.P.off(t,"touchStart")}offTouchMove(t){return this.P.off(t,"touchMove")}offTouchEnd(t){return this.P.off(t,"touchEnd")}offDispose(t){return this.P.off(t,"dispose")}}class Hi extends Gi{constructor(t,e,i,s,r,n,o,h){super(e,i,o,h),this.As=t,this.axis=s,this.ct=r,this.ws=n,this.ks()}}const Ui=t=>{const e=t.length;if(e>0){let i=0,s=0;for(let r=0;r{const e=t.length,i=new Array(e).fill(!1),s=(s,r)=>{for(let n=0;n=this.Ps?(this.Is.splice(t,1),t-=1):this.Is[t].state&&(s=!0);return this.Fs?0===e.interactions.length&&(this.Is.push({state:!1,time:i}),this.Fs=!1):1===e.interactions.length&&"pointerdown"===e.type&&(this.Is.push({state:!0,time:i}),s=!0,this.Fs=!0),s}Ts(t,e,i){if(i){const i=this.Is.reduce(((t,e)=>(e.state?t.on+=1:t.off+=1,t)),{on:0,off:0});i.on>=2&&i.off>=1&&(this.Ds(t,e),this.Is.length=0)}}},Yi=class{constructor(t,e,i,s=1,r=100){this.Bs=t,this.Os=e,this.Ls=i,this.Rs=s,this.Es=r}Cs(t,e){const i=e.interactions.length;if(i===this.Rs){if(void 0!==this.zs)return!0;if("pointerdown"===e.type&&(1===i||(t=>{const e=t.length;if(e>0){const i=Ui(t);let s=0;for(let r=0;r!(!t||"object"!=typeof t||!("lineType"in t)||"solid"!==t.lineType);class Zi{constructor(t,e){this.Hs=t,this.Us=e,this.$s=e.rows*Is,this.js=e.columns*Cs}}var Ki,Qi;e.OnScreenMenuButtonType=void 0,(Ki=e.OnScreenMenuButtonType||(e.OnScreenMenuButtonType={}))[Ki.ZoomIn=0]="ZoomIn",Ki[Ki.ZoomInX=1]="ZoomInX",Ki[Ki.ZoomInY=2]="ZoomInY",Ki[Ki.ZoomOut=3]="ZoomOut",Ki[Ki.ZoomOutX=4]="ZoomOutX",Ki[Ki.ZoomOutY=5]="ZoomOutY",Ki[Ki.ZoomToFit=6]="ZoomToFit",Ki[Ki.ToggleAnimations=7]="ToggleAnimations",e.OnScreenMenuButtonShape=void 0,(Qi=e.OnScreenMenuButtonShape||(e.OnScreenMenuButtonShape={}))[Qi.Circle=0]="Circle",Qi[Qi.Rectangle=1]="Rectangle",Qi[Qi.RoundedRectangle=2]="RoundedRectangle";const ts={x:-43,y:0},es={x:-65,y:0},is={x:-86,y:0},ss={x:-107,y:-1},rs={x:-128,y:-3},ns={x:-150,y:0},os={x:-171,y:0},hs={x:-276,y:0},as={x:-298,y:0},ls={x:0,y:0},us={x:-21,y:0};class cs extends Zi{constructor(t,e,i,s){super(t,i),this.Ys=xt.document.createElement("button"),this.Xs=xt.document.createElement("div"),this.Zs=xt.document.createElement("label"),this.Us=i,this.Ks=e,this.Ki=s}qs(t,e,i,s){this.Js(t,s),this.Qs(),this.te(e),this.ie(),this.Zs.textContent=i||"";const r=xt.document.createElement("div");this.se(r),this.Ys.onclick=this.onClick.bind(this),r.appendChild(this.Xs),r.appendChild(this.Zs),this.Ys.appendChild(r)}ie(){this.Ys.style.cursor="pointer"}se(t){t.style.display="flex",t.style.justifyContent="center",t.style.alignContent="center",t.style.flexDirection="column"}te(t){"string"==typeof t?(this.Xs.style.backgroundImage=`url(${t})`,this.Xs.style.backgroundSize="100%",this.Xs.style.backgroundRepeat="no-repeat",this.Xs.style.backgroundPosition="center",this.Xs.style.width="20px",this.Xs.style.height="20px"):this.applyStyleForSprite(t),this.Xs.style.margin="auto"}Qs(){switch(this.Ks){case e.OnScreenMenuButtonShape.RoundedRectangle:this.Ys.style.borderRadius="10px";break;case e.OnScreenMenuButtonShape.Rectangle:this.Ys.style.borderRadius="0px";break;case e.OnScreenMenuButtonShape.Circle:default:this.Ys.style.borderRadius="31px"}}Js(t,e){this.Ys.style.width=`${this.js.toString()}px`,this.Ys.style.height=`${this.$s.toString()}px`,this.Ys.style.backgroundColor=t,this.Ys.style.opacity=e||Ps,this.Ys.style.alignItems="center",this.Ys.style.border="2px solid #707070",this.Ys.style.transition="background-color .8s ease"}applyStyleForSprite(t){this.Xs.style.backgroundImage=`url(${this.Hs}/${ks})`,this.Xs.style.backgroundPositionX=`${t.x}px`,this.Xs.style.backgroundPositionY=`${t.y}px`,this.Xs.style.backgroundSize="1600%",this.Xs.style.backgroundRepeat="no-repeat",this.Xs.style.width="20px",this.Xs.style.height="20px"}ee(t){return t.appendChild(this.Ys),t}he(){return this.Ys}}class ds extends cs{constructor(t,e,i,s){super(t,e,i,s),this.re="",this.ne="",this.oe=!1,this.Ki=s}ae(){this.le(),this.onToggledStateAction()}ue(){this.ce(),this.onInitialStateAction()}ce(){this.de(this.re)}le(){this.de(this.ne)}de(t){"string"==typeof t?this.Xs.style.background=t:(this.Xs.style.backgroundImage=`url(${this.Hs}/${ks})`,this.Xs.style.backgroundPositionX=`${t.x}px`,this.Xs.style.backgroundPositionY=`${t.y}px`)}onClick(){this.oe?this.ue():this.ae(),this.oe=!this.oe}}class fs extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),ts)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:-1,y:-1})}}class gs extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),ss)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:-1,y:0})}}class ys extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),ns)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:0,y:-1})}}class ps extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),es)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:1,y:1})}}class ms extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),rs)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:1,y:0})}}class Ss extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),os)}onClick(){const t=this.Ki.fe();t&&this.Ki.zoom(t,{x:0,y:1})}}class xs extends ds{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.re=hs,this.ne=as,this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),this.re)}onToggledStateAction(){this.Ki.setAnimationsEnabled(!1)}onInitialStateAction(){this.Ki.setAnimationsEnabled(!0)}}class bs extends cs{constructor(t,e,i){super(t,i,{rows:1,columns:1},e),this.Ki=e;const s=this.Ki.getTheme();this.qs(s.onScreenMenuBackgroundColor.toRGBAString(),is)}onClick(){this.Ki.forEachAxis((t=>{t.fit(!0)}))}}class vs extends cs{constructor(t,e,i){super(t,e.shape||Fs,e.dimensions||{rows:1,columns:1},i);const s=i.getTheme(),r=e.color||s.onScreenMenuBackgroundColor.toRGBAString(),n=e.icon||"",o=e.label||"",h=e.opacity||"";this.qs(r,n,o,h),this.ge=e.action}onClick(){this.ge(this.Ki)}}class Ms extends ds{constructor(t,e,i,s){super(t,e,{rows:1,columns:1},i),this.Ki=i,this.pe=s,this.re=us,this.ne=ls,this.qs(Bs,this.re)}ce(){this.de(this.re),this.Ys.style.backgroundColor=Bs,this.Ys.style.border="2px solid #707070",this.Ys.style.margin="0px"}le(){this.de(this.ne),this.Ys.style.background="#FECC00 0% 0% no-repeat padding-box",this.Ys.style.border="10px solid #BCBCBC12",this.Ys.style.margin="1px"}onToggledStateAction(){var t;null===(t=this.pe)||void 0===t||t.style.setProperty("display","block")}onInitialStateAction(){var t;null===(t=this.pe)||void 0===t||t.style.setProperty("display","none")}}var As;e.MouseStyles=void 0,(As=e.MouseStyles||(e.MouseStyles={})).Move="move",As.ResizeColumn="col-resize",As.ResizeRow="row-resize",As.Horizontal="ew-resize",As.Vertical="ns-resize",As.NorthWest="nw-resize",As.NorthEast="ne-resize",As.Copy="copy",As.CrossHair="crosshair",As.Default="default",As.Help="help",As.Restricted="not-allowed",As.None="none",As.Point="pointer",As.Text="text",As.Wait="wait",As.ZoomIn="zoom-in",As.ZoomOut="zoom-out";const ws={LeftBottom:u(-1,-1),CenterBottom:u(0,-1),RightBottom:u(1,-1),LeftCenter:u(-1,0),Center:u(0,0),RightCenter:u(1,0),LeftTop:u(-1,1),CenterTop:u(0,1),RightTop:u(1,1)},Ts=new V({color:w(255,255,255,0)}),Es=new $i({thickness:1,fillStyle:Ts}),Is=60,Cs=60,Ps="1.0",ks="osm/osm-sprite-transparent.png",Fs=e.OnScreenMenuButtonShape.Circle,Bs="#363636";var _s;e.OSMPosition=void 0,(_s=e.OSMPosition||(e.OSMPosition={}))[_s.TopRight=0]="TopRight",_s[_s.TopLeft=1]="TopLeft",_s[_s.BottomLeft=2]="BottomLeft",_s[_s.BottomRight=3]="BottomRight";class Ls extends Hi{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,n,o,h),this.bs="Band",this.me=0,this.ye=0,this.Se=this.Ji.bandFillStyle,this.xe=this.Ji.bandStrokeStyle,this.be=this.As._e(this.ct).Me(this.Se).ve(this.xe).us(this.getHighlight()),this.cs(this.be)}setValueStart(t){return this.me=t,this.P.emit("valueChange",this,this.me,this.ye),this.As.Ss(),this}getValueStart(){return this.me}setValueEnd(t){return this.ye=t,this.P.emit("valueChange",this,this.me,this.ye),this.As.Ss(),this}getValueEnd(){return this.ye}setFillStyle(t){this.Se="function"==typeof t?t(this.Se):t;const e=this.Se;return this.be.Me(e),this.As.Ss(),this}getFillStyle(){return this.Se}setStrokeStyle(t){this.xe="function"==typeof t?t(this.xe):t;const e=this.xe;return this.be.ve(e),this.As.Ss(),this}getStrokeStyle(){return this.xe}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}Ae(){return this.be.we(this.ws.toVec2(this.me,this.ws.getHeight(this.ct).getInnerStart())).q(this.ws.toVec2(this.ye-this.me,this.ws.getHeight(this.ct).getInnerInterval())),this}attach(t,e){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se,stroke:this.xe}),this}ke(t,e){t.us(e),this.As.Ss()}ks(){let t,i;const s=(e,s)=>{const r=at(this.As.ls.Ce(s.x,s.y),this.As.ls.ct,this.ct),n=this.ws.getWidth(r),o=this.axis.ct.ut(this.me),h=this.axis.ct.ut(this.ye),a=(this.axis.ct.ut(n)-o)/(h-o);t=!(a<.1||a>.9),!1===t&&(i=a<.5)},r=(e,s,r,n,o)=>{const h=this.ws.getWidth(n);t?(this.me=this.axis.ct.Jt(this.me,h),this.ye=this.axis.ct.Jt(this.ye,h)):i?this.me=this.axis.ct.Jt(this.me,h):this.ye=this.axis.ct.Jt(this.ye,h),Kt(o),this.P.emit("valueChange",this,this.me,this.ye),this.As.Ss()};this.onMouseMove(((i,r)=>{s(0,u(r.clientX,r.clientY));const n=t?e.MouseStyles.Point:this.ws.getWidth({x:e.MouseStyles.Horizontal,y:e.MouseStyles.Vertical});this.Te=this.Ki.engine.setMouseStyle(n,this.Te)})),this.onMouseLeave((()=>{this.Ki.engine.restoreMouseStyle(this.Te),this.Te=void 0})),this.onMouseDrag(((t,e,i,s,n)=>{0===i&&r(0,0,0,n,e)}));const n=Wi(new Yi(s,r));this.onTouchStart(n.onTouchStart),this.onTouchMove(n.onTouchMove),this.onTouchEnd(n.onTouchEnd)}}class Ds extends Hi{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,n,o,h),this.bs="Constant Line",this.u=0,this.xe=this.Ji.constantLineStrokeStyle,this.Fe=!0,this.Ie=this.As.De(this.ct).Pe(this.xe).us(this.getHighlight()),this.cs(this.Ie)}setValue(t){return this.u=t,this.P.emit("valueChange",this,this.u),this.As.Ss(),this}getValue(){return this.u}setStrokeStyle(t){this.xe="function"==typeof t?t(this.xe):t;const e=this.xe;return this.Ie.Pe(e),this.As.Ss(),this}getStrokeStyle(){return this.xe}setInteractionMoveByDragging(t){return this.Fe=t,this}getInteractionMoveByDragging(){return this.Fe}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}Ae(){return this.Ie.Oe(this.ws.toVec2(this.u,this.ws.getHeight(this.ct).getInnerStart())).Be(this.ws.toVec2(this.u,this.ws.getHeight(this.ct).getInnerEnd())),this}attach(t,e){return super.attach(t,e),ce(t,this.Ji,{stroke:this.xe}),this}ke(t,e){t.us(e),this.As.Ss()}ks(){const t=(t,e)=>{this.Fe&&(this.u=this.axis.ct.Jt(this.u,this.ws.getWidth(e)),this.P.emit("valueChange",this,this.u),this.As.Ss(),Kt(t))};this.onMouseMove((()=>{if(this.Fe){const t=this.ws.getWidth({x:e.MouseStyles.Horizontal,y:e.MouseStyles.Vertical});this.Te=this.Ki.engine.setMouseStyle(t,this.Te)}})),this.onMouseLeave((()=>{this.Fe&&(this.Ki.engine.restoreMouseStyle(this.Te),this.Te=void 0)})),this.onMouseDrag(((e,i,s,r,n)=>{this.Fe&&0===s&&t(i,n)}));const i=Wi(new Yi(void 0,((e,i,s,r,n)=>t(n,r))));this.onTouchStart(i.onTouchStart),this.onTouchMove(i.onTouchMove),this.onTouchEnd(i.onTouchEnd)}}const zs={fitting:{start:(t,e,i,s)=>e>=t?i:s,end:(t,e,i,s)=>e>=t?s:i},expansion:{start:(t,e,i,s)=>e>=t?it?s:t,end:(t,e,i,s)=>e>=t?s>e?s:e:ie>t?zs.progressive.end(t,e,i,s)+(t-e):s>t?s:t,end:(t,e,i,s)=>e>t?s>e?s:e:zs.progressive.start(t,e,i,s)+(e-t)},regressive:{start:(t,e,i,s)=>e>t?ie>t?zs.regressive.start(t,e,i,s)+(e-t):ivoid 0!==t.Le,Vs=t=>void 0!==t.Re,Ns={Ee:Ci.Numeric},Gs=(t,e)=>[t,e],Hs=(t,e,i,s)=>{const r=[],n=Math.round(Math.abs((t-e)/i));for(let o=1;o{It(t,0)&&(t=0),It(e,0)&&(e=0);const n=[];let o=void 0!==s?((t,e,i)=>t-(t-i)%e)(t,i,s):t;if(i<=0)throw new Error(`_getRegularGreatKeyValues unit less than or equal to 0, unit: ${i}`);for(;o{const r=[];let n=i(t),o=0;for(;n1e3)throw new Error("Infinite loop in Axis tick key values logic.");return r.push(n),r},Xs=(t,...e)=>{const i=e.length>0?e.length:t?1:0;return(s,r,n,o,h,a)=>{if(r>=i)return;const l=e[r]||1;let u=!1,c=!1,d=1;return t&&(u="ignore"in t?"first"===t.ignore||"both"===t.ignore:u,c="ignore"in t?"last"===t.ignore||"both"===t.ignore:c,d="offset"in t&&void 0!==t.offset?t.offset:d),((t,e,i,s,r)=>(i&&(t=t.filter(((t,e)=>e>0))),s&&(t=t.filter(((e,i)=>i(i+r)%e==0))))(s,l,u,c,d)}},Ys=(...t)=>{const e=t.length>0?t.length:0;return(i,s,r,n,o,h)=>{if(s>=e)return;const a=t[s]||1;return i.filter(((t,e)=>e%a==0))}},js=(t,e)=>{if(e.has(t))return e.get(t);const i=Xe(t.Ve.ze());return e.set(t,i),i},Js=t=>{const e=new Map;if(t!==Ns){for(const i of t.Ne)e.set(i,new Map);for(const i of t.Ge)e.set(i,new Map)}return e};class $s{constructor(t,e,i,s,n,o,h){this.P=new r.Eventer,this.We=Ns,this.He=Os.Empty,this.Ue=new Map,this.$e=new Map,this.je=zs.fitting,this.Ye=!0,this.Xe=j((()=>this.chart.ls.Ss()))(300,X.linear),this.Ze=!0,this.Fi=!0,this.Ke=!1,this.qe=ke,this.Je=!1,this.Qe=!1,this.th=ke,this.ih=ke,this.sh=ke,this.eh={},this.hh=(t,e,i,s,r,n)=>{const o=[],h=[];for(const a of t){if(as){o.push(a);continue}const t=this.Ue.get(e),l=(t?t.get(a):void 0)||this.rh(a,e);l.oh=!1;const u=this.ah(l,r);n.set(l,u),o.push(a),h.push(l)}return{displayedKeyValues:o,createdTicks:h}},this.lh=(t,e,i,s,r,n,o,h,a,l,u)=>{const c=[];for(let d=0;dvoid 0!==t)).filter((e=>e.dh!==i||!!t.find((t=>t===e)))).map((t=>Le(e,js(t,a))?t:void 0)),y=m.some((t=>void 0!==t))}else y=!1;if(y){let t=!0;const e=m.filter((t=>void 0!==t));if(t&&i.fh&&e.every((t=>Rs(t.dh)))&&(t=!1),t&&i.fh&&i.fh.gh&&!1===i.fh.gh(g,s,r,n,o,h)&&(t=!1),!1===t)continue;return!0}c.push(f)}return c},this.formatValue=t=>this.We.Ee(t,this.ct),this.ph=([t,e])=>{this.mh(t,e)},this.chart=t,this.yh=e,this.Ji=s,this.Sh=o,this.ct=i,this.xh=h,"logarithmic"===h.type&&this.setAnimationZoom(X.logarithmic(Ai(h.base))),this.bh=o.numeric,this.Mh("Numeric"),this._h=i.getInnerStart(),this.Ah=i.getInnerEnd(),n&&this.setAnimationsEnabled(!1)}getTitle(){return this.kh.wh()}setTitle(t){return this.kh.Ch(t),this.chart.ls.Ss(),this}getTitleFillStyle(){return this.kh.Th()}setTitleFillStyle(t){return this.kh.Me(t),this.chart.ls.Ss(),this}getTitleFont(){return this.kh.Fh()}setTitleFont(t){return this.kh.Ih(t),this.chart.ls.Ss(),this}setTitleRotation(t){return this.kh.Ph(t),this.chart.ls.Ss(),this}getTitleRotation(){return this.kh.Dh()}setTitleEffect(t){return this.Bh.ys(t),this.chart.ls.Ss(),this}getTitleEffect(){return this.Bh.xs()}Mh(t,e){if(this.Ue.size>0&&this.Oh(),"Empty"===t)this.We=Ns,this.He=t;else if("Numeric"===t){"Numeric"!==this.He&&(this.bh=this.Sh.numeric);const i=e||(t=>t);this.bh=i(this.bh),this.We=this.bh.Lh(this.xh),this.He=t}else if("DateTime"===t){"DateTime"!==this.He&&(this.bh=this.Sh.datetime);const i=e||(t=>t);this.bh=i(this.bh),this.We=this.bh.Lh(this.xh),this.He=t}else if("Time"===t){"Time"!==this.He&&(this.bh=this.Sh.time);const i=e||(t=>t);this.bh=i(this.bh),this.We=this.bh.Lh(this.xh),this.He=t}return this.$e.forEach((t=>Array.from(t.values()).forEach((t=>t.dispose())))),this.$e=Js(this.We),this.chart.ls.Ss(),this}Rh(){return this.We}Eh(t){this.We=t,this.$e.forEach((t=>Array.from(t.values()).forEach((t=>t.dispose())))),this.$e=Js(this.We),this.chart.ls.Ss()}setInterval(t){const{start:e,end:i,animate:s,stopAxisAfter:r}=t;return this.dt(void 0!==e?e:this._h,void 0!==i?i:this.Ah,void 0!==s&&s,void 0===r||r,"userSetInterval"),this}dt(t,e,i=!1,s=!0,r){let n={start:t,end:e};const o=Math.abs(e-t);if(Math.abs(this.Ah-this._h),void 0!==this.We.zh&&this.We.zh>o){const i=(e+t)/2,s=this.We.zh/2*(t>e?-1:1);n={start:i-s,end:i+s}}if(void 0!==this.We.Vh&&this.We.Vhe?-1:1);n={start:i-s,end:i+s}}const h=this.ct.rt(n.start,n.end,this._h,this.Ah,!0);if(!1===h)return this;let a;switch(!0===h||(n=h),r){case"userSetInterval":case"userFit":case"interactionSetInterval":case"interactionZoom":a=!0;break;case"zoomBandChart":case"synchronizedAxis":a=!1;break;default:return Me(0,""),this}if(this.Nh&&this.Nh.finishAll(!1),this.Xe&&(!0===i||i>0)){this.setStopped(!0);const t=!0===i?void 0:i,e=!this.Nh||this.Nh.isOver()?this.Xe:this.Nh.NextAnimation.bind(this);this.Nh=e([[this._h,n.start],[this.Ah,n.end]],this.ph,t),this.Nh.onAnimationEnd((()=>{this.Nh=void 0,a&&(this.sh=xt.performance.now())})),this.Nh.onAnimationEnd((()=>this.setStopped(s)))}else this.mh(n.start,n.end),s&&this.setStopped(!0),a&&(this.sh=xt.performance.now());return this}getInterval(){return{start:this._h,end:this.Ah}}setStopped(t){return t===this.Ke||(t&&(this.Nh&&this.Nh.finishAll(!1),this.Nh=void 0),this.Ke=t,this.P.emit("stoppedStateChanged",this,this.Ke),this.qe=xt.performance.now(),this.chart.ls.Ss()),this}getStopped(){return this.Ke}onStoppedStateChanged(t){return this.P.on("stoppedStateChanged",t)}offStoppedStateChanged(t){return this.P.off(t,"stoppedStateChanged")}fit(t,e=!1){const i=this.Gh();if(i){const s=this.Ah>=this._h,r=s?i.min:i.max,n=s?i.max:i.min;this.dt(r,n,t,e,"userFit")}return this}setScrollStrategy(t){return this.je=t,this.chart.ls.Ss(),this}getScrollStrategy(){return this.je}setAnimationScroll(t){return this.Ye=Boolean(t),this.chart.ls.Ss(),this}setAnimationZoom(t,e=300){return this.Nh&&(this.Nh.finishAll(!1),this.Nh=void 0),this.Xe=t?j((()=>this.chart.ls.Ss()))(e,t):void 0,this}setAnimationsEnabled(t){return this.Ze=t,t?(this.setAnimationScroll(!0),this.setAnimationZoom(X.ease,void 0)):(this.setAnimationScroll(void 0),this.setAnimationZoom(void 0)),this}getAnimationsEnabled(){return this.Ze}setVisible(t){const e=this.Fi!==t;return this.Fi=t,this.kh.setVisible(t),this.Wh((e=>{e.Ve.setVisible(t)})),e&&this.P.emit("visibleStateChanged",this,this.Fi),this}getVisible(){return this.Fi}onIntervalChange(t){return this.P.on("scaleChange",t)}offIntervalChange(t){return this.P.off(t,"scaleChange")}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}Hh(t,e){const i=new Map;if(this.We===Ns||!this.Fi)return this.Oh(),i;e=e||new Map;const s=this.Uh(),r=s.min,n=s.max,o=n-r,h=t.physicalAxisSize;this.eh.physicalAxisSize=h;const a=Zs(this.We,r,n,this._h,this.Ah,h),l=[];if(this.$h(),l.push(...this.jh(this.We,r,n,a,e,t,i)),this.Yh(this.We,r,n,a,e,t,l,i),this.Xh(),a)for(const[t,e]of this.$e){const i=a.get(t);if(void 0!==i)for(const[t,s]of e)i.includes(t)||(null==s||s.dispose(),e.delete(t))}return this.eh.min=r,this.eh.max=n,this.eh.scaleInterval=o,this.eh.physicalAxisSize=h,i}Zh(t){const e=t.dh.Kh;t.Ve.Ch(e(t.u,this.ct)).Ts()}qh(t,e){const i=e.Jh;t.Ve.Me(i.getLabelFillStyle()).Ih(i.getLabelFont()).Ph(i.getLabelRotation())}rh(t,e){const i=this.$e.get(e);let s=i.get(t);s?(i.delete(t),s.dh=e,s.ps(!0)):s=this.Qh(t,e);const r=this.Ue.get(e)||new Map;return r.set(t,s),this.Ue.set(e,r),this.qh(s,e),s}ah(t,e){const i=this.tr(t,e);return this.Zh(t),i}jh(t,e,i,s,r,n,o){const h=[];for(const a of t.Ne){const t=s.get(a);for(const s of t){if(si)continue;const t=this.Ue.get(a),l=(t?t.get(s):void 0)||this.rh(s,a),u=this.ah(l,n),c=js(l,r);h.find((t=>Le(c,js(t,r))))&&l.Ve.setVisible(!1),l.oh=!1,o.set(l,u),h.push(l)}}return h}Yh(t,e,i,s,r,n,o,h){let a,l=[];for(const u of t.Ge){const t=s.get(u);if(!t)break;let c;if(void 0===a)c=[{start:e,end:i,keyValues:t}];else{c=[];for(let e=0;e=i&&e0){if(void 0===u.fh){m=!1;break}const t=u.fh.ir;if(a=t(a,d-1,n,h,e,i),void 0===a)break}const p=this.lh(y.filter((t=>a.some((e=>It(t.u,e))))),g,u,d,n,h,e,i,r,o,l);!0!==p?t=t.concat(p):(d+=1,f=-1,t=[])}p=t,y.forEach((e=>{t.find((t=>t===e))||this.sr(e)}))}if(l=p,!m)break}}sr(t){const e=this.Ue.get(t.dh);null==e||e.delete(t.u);const i=this.$e.get(t.dh);i&&i.has(t.u)?t.dispose():i&&(t.ps(!1),i.set(t.u,t))}Wh(t){for(const e of this.Ue.values())for(const i of e.values())t(i)}er(t,e){for(const i of this.Ue.values())for(const s of i.values())e=t(e,s);return e}Oh(){this.Ue.forEach(((t,e)=>{t.forEach((t=>this.sr(t)))})),this.Ue.clear()}$h(){for(const t of this.Ue.values())for(const e of t.values())e.oh=!0}Xh(){for(const t of this.Ue.values())for(const[e,i]of t.entries())i.oh&&(i.dispose(),t.delete(e))}Uh(){const t=this.ct.getInnerStart()this.ct.getInnerStart()?this.ct.getInnerEnd():this.ct.getInnerStart();return y(t,e)}uh(t,e){return!(t.oh||0===t.Ve.wh().length||Rs(e)&&!0!==e.hr)}rr(t,e){return this.We===Ns||(this.We.Ne.forEach((i=>{e=t(e,i.Jh)})),this.We.Ge.forEach((i=>{(t=>void 0!==t.Kh)(i)&&(e=t(e,i.Jh))}))),e}Gh(){let t=this.yh.nr();const e=this.yh.ar();let i;if(void 0!==t&&vt(t)&&void 0!==e&&vt(e)&&("logarithmic"===this.xh.type&&(0===t&&(t=Math.min(1,e)),Math.sign(t)!==Math.sign(e)&&(t=Math.min(1,e-.1))),i?(i.min=Math.min(i.min,t),i.max=Math.max(i.max,e)):i=y(t,e)),i&&vt(i.min)&&vt(i.max))return It(i.min,i.max)?{min:i.min-1,max:i.max+1}:i}lr(){let t=0;const e=this.yh.ur();return e&&(t=Math.max(t,e)),t}cr(){const t=this.Je;let e=!1;if(this.je&&!this.Ke){const t=this.Gh();if(t){const i=this._h,s=this.Ah;let r=this.je.start(i,s,t.min,t.max),n=this.je.end(i,s,t.min,t.max);const o=!1===It(i,r),h=!1===It(s,n);if(r=o?r:i,n=h?n:s,o||h){let t=!1;if(this.Ye)if(this.Ye){t=!0;const a=o?this.dr(i,r):i,l=h?this.dr(s,n):s;if(!0===this.mh(a,l,{allowClamping:!1})&&(o&&!1===It(a,r)||h&&!1===It(l,n))){this.chart.ls.Ss(!0),e=!0;let t=Math.abs(n-r)/Math.abs(a-l);t<1&&(t=1/t),this.Qe=t>=1.4}}else t=!1;t||this.mh(r,n)}}}e?(this.Je!==e&&(this.Je=e,this.th=xt.performance.now()),this.gr&&(clearTimeout(this.gr),this.gr=void 0)):!0===t&&void 0===this.gr&&(this.Qe=!1,this.gr=setTimeout((()=>{!1!==this.Je&&(this.Je=!1,this.th=xt.performance.now()),this.gr=void 0,this.chart.ls.Ss()}),200))}mh(t,e,i){const s=!i||!("allowClamping"in i)||void 0===i.allowClamping||i.allowClamping;let r={start:t,end:e},n=!0;const o=Math.abs(e-t),h=Math.abs(this.Ah-this._h);if(void 0!==this.We.zh&&this.We.zh>o){const i=(e+t)/2,o=(s?this.We.zh/2:h/2)*(t>e?-1:1);r={start:i-o,end:i+o},n=!1}if(void 0!==this.We.Vh&&this.We.Vhe?-1:1);r={start:i-o,end:i+o},n=!1}let a=this.ct.rt(r.start,r.end,this._h,this.Ah,s);if(!1===a)return!1;!0!==a&&(r=a);const l=this.lr(),u=this.pr(Math.min(r.start,r.end),Math.max(r.start,r.end),l);return a=this.ct.rt(r.end>r.start?u.min:u.max,r.end>r.start?u.max:u.min,this._h,this.Ah,!1),!!a&&(!0===a?this.ct.Z(r.end>r.start?u.min:u.max,r.end>r.start?u.max:u.min):this.ct.Z(r.start,r.end),this._h=r.start,this.Ah=r.end,this.P.emit("scaleChange",this,r.start,r.end),this.ih=xt.performance.now(),this.chart.ls.Ss(),n)}mr(){return this.Je}yr(){return void 0!==this.Nh}}class qs{constructor(t,e,i,s,r=i.Sr(s).setMouseInteractions(!1)){this.oh=!1,this.Ti=!1,this.Qi=[],this.dh=t,this.u=e,this.br=i,this.vr=s,this.Ve=r,this.Qi.push(r)}ps(t){this.Qi.forEach((e=>e.setVisible(t)))}dispose(){return this.Ti||(this.Ti=!0,this.Qi.forEach((t=>t.dispose()))),this}}const Zs=(t,e,i,s,r,n)=>{const o=new Map;for(const n of t.Ne){let t=n.Mr(e,i,s,r);t=Ks(t),o.set(n,t)}let h;for(const s of t.Ge){let t;if(void 0===h)t=s.Mr(e,i,e,i);else{let r=[];const o=h.filter((t=>e<=t&&t<=i)).length;if(o>0){const t=n/(o-1);if(void 0!==s._r&&s._r>t)break}for(let t=0;t(t=(t=>{const e={},i=[],s=t.length;let r=0;for(let n=0;nt-e)),Qs=s.Record({type:"font",size:14,family:"Arial",weight:"normal",style:"normal",variant:!1});class tr extends Qs{constructor(t){super(t)}setSize(t){return this.set("size",t)}setFamily(t){return this.set("family",t)}setWeight(t){return this.set("weight",t)}setStyle(t){return this.set("style",t)}setVariant(t){return this.set("variant",t)}getSize(){return this.get("size")}getFamily(){return this.get("family")}getWeight(){return this.get("weight")}getStyle(){return this.get("style")}getVariant(){return this.get("variant")}}const er=t=>!(!t||"object"!=typeof t||!("type"in t)||"font"!==t.type),ir=new tr,sr=new class{},rr=s.Record({type:"triangulated-points-3d",shape:"sphere",size:10,fillStyle:new V,wireframeStyle:st});class nr extends rr{constructor(t){super(t)}setSize(t){return this.set("size",t)}getSize(){return this.get("size")}setFillStyle(t){return"function"==typeof t?this.set("fillStyle",t(this.get("fillStyle"))):this.set("fillStyle",t)}getFillStyle(){return this.get("fillStyle")}setWireframeStyle(t){return"function"==typeof t?this.set("wireframeStyle",t(this.get("wireframeStyle"))):this.set("wireframeStyle",t)}getWireframeStyle(){return this.get("wireframeStyle")}setShape(t){return this.set("shape",t)}getShape(){return this.get("shape")}}const or=t=>!(!t||"object"!=typeof t||!("type"in t)||"triangulated-points-3d"!==t.type),hr=s.Record({type:"pixelated-points-3d",size:5,fillStyle:new V});class ar extends hr{constructor(t){super(t)}setSize(t){return this.set("size",t)}getSize(){return this.get("size")}setFillStyle(t){return"function"==typeof t?this.set("fillStyle",t(this.get("fillStyle"))):this.set("fillStyle",t)}getFillStyle(){return this.get("fillStyle")}}const lr=t=>!(!t||"object"!=typeof t||!("type"in t)||"pixelated-points-3d"!==t.type),ur={Triangulated:nr,Pixelated:ar};class cr{constructor(t){this.Ar=new Map,this.ls=t}ns(t,e,i){const s=i.animationEnabled;this.Ar.set(t,{applyHighlight:e,curUnanimatedHighlightValue:0,curAnimationPositionMillis:0,animationEnabled:s,curAnimatedHighlightValue:0});const r=t.onDispose((()=>{this.Ar.delete(t),t.offDispose(r)}))}wr(t,e){const i=e.animationEnabled,s=[],r=t.onDispose((()=>{s.forEach((t=>{this.Ar.delete(t)})),t.offDispose(r)}));return{kr:(t,e)=>{const r={applyHighlight:e,curUnanimatedHighlightValue:0,curAnimationPositionMillis:0,animationEnabled:i,curAnimatedHighlightValue:0};s.push(t),this.Ar.set(t,r)}}}vs(t,e){const i=this.Ar.get(t);i&&(i.curUnanimatedHighlightValue=ve(e),this.ls.Ss())}fs(t,e=!1){const i=this.Ar.get(t);return i?e?i.curAnimatedHighlightValue:i.curUnanimatedHighlightValue:0}Ms(t,e){const i=this.Ar.get(t);i&&(i.animationEnabled=e)}_s(t){const e=this.Ar.get(t);return!!e&&e.animationEnabled}Ts(t){let e=!1;this.Ar.forEach(((i,s)=>{let r;if(i.animationEnabled){const s=1e3;if(i.curUnanimatedHighlightValue>0){const n=i.curAnimationPositionMillis/s;r=i.curUnanimatedHighlightValue*Math.abs(Math.sin(n*Math.PI/2+.5));const o=0===i.curAnimatedHighlightValue?1:t;i.curAnimationPositionMillis+=o,e=!0}else i.curAnimatedHighlightValue>0&&0===i.curUnanimatedHighlightValue?(r=Math.max(i.curAnimatedHighlightValue-t/s,0),e=e||r>0):r=0,i.curAnimationPositionMillis=0}else r=i.curUnanimatedHighlightValue;r!==i.curAnimatedHighlightValue&&(i.applyHighlight(r),i.curAnimatedHighlightValue=r)})),e&&this.ls.Ss(!0)}}const dr=new Map,fr=t=>{const e=t.getSize(),i=t.getFamily(),s=t.getWeight(),r=t.getStyle(),n=t.getVariant(),o=`${r} ${n?"small-caps":"normal"} ${s} ${e}px ${i}`;let h=dr.get(o);return h||(h=((t,e)=>({font:t,properties:e}))(o,{type:"font",size:e,family:i,style:r,variant:n,weight:s}),dr.set(o,h)),h};var gr,yr;!function(t){t[t.click=0]="click",t[t.dbclick=1]="dbclick",t[t.mouseDown=2]="mouseDown",t[t.mouseUp=3]="mouseUp",t[t.contextmenu=4]="contextmenu",t[t.wheel=5]="wheel"}(gr||(gr={})),function(t){t[t.touchStart=0]="touchStart",t[t.touchMove=1]="touchMove",t[t.touchEnd=2]="touchEnd"}(yr||(yr={}));const pr=t=>({container:t.Cr,scale:t.ct,setMouseStyle:(e,i)=>t.Tr(e,i),restoreMouseStyle:e=>t.Fr(e),clientLocation2Engine:(e,i)=>t.Ce(e,i),engineLocation2Client:(e,i)=>t.Ir(e,i),captureFrame:(e,i)=>t.Pr(e,i),renderFrame:(e,i,s=!1)=>t.Dr(e,i,s),layout:()=>{t.Br(),t.Or()},setBackgroundFillStyle(e){return t.setBackgroundFillStyle(e),this},setBackgroundStrokeStyle(e){return t.setBackgroundStrokeStyle(e),this},getBackgroundFillStyle:()=>t.getBackgroundFillStyle(),getBackgroundStrokeStyle:()=>t.getBackgroundStrokeStyle(),addCustomIcon:(e,i)=>t.Lr(e,i)}),mr=[];let Sr;const xr=()=>{if(void 0!==Sr){const t=xt.getComputedStyle(xt.document.body),e=Number(t.getPropertyValue("margin-top").replace("px",""))+Number(t.getPropertyValue("margin-bottom").replace("px",""));Sr.style.height=xt.innerHeight-e+"px",(()=>{for(let t=0;tthis.Ss()),60),this.zr=u(0,0),this.Vr=void 0,this.Nr=Et,this.Gr=()=>{},this.Wr=[],this.Hr=-1,this.Ur=[],this.$r=!0,this.Ti=!1,this.Or=()=>{const{bottom:t,left:e}=this.jr().getBoundingClientRect();return this.zr=u(Math.floor(e),Math.floor(t)),this},this.Br=()=>{this.Yr&&this.Yr()},this.Tr=(t,e)=>{if(!e){this.Cr.style.cursor=t;const e=this.Hr;return this.Hr+=1,this.Ur.push([e,t]),e}return this.Fr(e),this.Tr(t)},this.Fr=t=>{const e=t?this.Ur.findIndex((e=>e[0]===t)):-1;e>=0?(this.Ur.splice(e,1),this.Ur.length>0?this.Cr.style.cursor=this.Ur[this.Ur.length-1][1]:this.Cr.style.cursor="default"):(this.Ur.push([0,"default"]),this.Cr.style.cursor="default")},this.Xr=t=>(this.Zr.S(t),this),this.Kr=()=>this.Zr.M(),this.qr=()=>{this.Nr&&this.Nr(1e3/60),this.Jr(),this.Qr(),this.Gr&&this.Gr()},this.tn=t=>(this.Rr.set(t.sn(),t),this.Rr=new Map([...this.Rr.entries()].sort(((t,e)=>t[0]-e[0]))),t),this.en=t=>(this.Rr.delete(t),this),this.Y=()=>(this.Zr.o=!1,this),this.X=()=>(this.Zr.o=!0,this),this.hn=t=>{if(!this.$r)return;const e=this.rn,i=e&&e.clientX===t.clientX&&e.clientY===t.clientY,s=this.Ce(t.clientX,t.clientY),r=this.nn(t,{x:t.clientX,y:t.clientY});if(this.an&&((null==r?void 0:r.entity)!==this.an.entity||r.collectionMember!==this.an.collectionMember)&&!this.ln){this.an.entity.Ii=!1;const e=this.an.entity.un;e&&e(this.an.entity,t,this.an.collectionMember)}if(r&&r.entity.getMouseInteractions()&&!this.ln)if(r.entity.Ii){if(!i){const e=r.entity.cn;e&&e(r.entity,t,r.collectionMember)}}else{r.entity.Ii=!0;const e=r.entity.dn;e&&e(r.entity,t,r.collectionMember)}if(this.ln){const i=this.ln.entity.fn,s=e?u(t.clientX-e.clientX,e.clientY-t.clientY):{x:0,y:0};!i||0===s.x&&0===s.y||i(this.ln.entity,t,this.ln.button,this.ln.startLocation,s,this.ln.collectionMember)}this.gn=t,this.rn=t,this.pn=s,this.an=r},this.mn=t=>{if(this.$r=!1,this.pn=void 0,this.gn=t,this.rn=void 0,this.ln){const e=this.ln.entity.yn;e&&e(this.ln.entity,t,this.ln.button,this.ln.startLocation,this.ln.collectionMember),this.ln.entity.Ii=!1;const i=this.ln.entity.un;i&&i(this.ln.entity,t,this.ln.collectionMember),this.ln=void 0}if(this.Sn){const e=this.Sn.entity.xn;e&&e(this.Sn.entity,t,this.Sn.collectionMember),this.Sn=void 0}if(this.an){this.an.entity.Ii=!1;const e=this.an.entity.un;e&&e(this.an.entity,t,this.an.collectionMember),this.an=void 0}},this.bn=t=>{this.$r=!0,this.gn=t},this.vn=()=>this.pn,this.Ji=t.theme,this.Mn=e.Mn,this._n={An:e.An,wn:e.wn,kn:e.kn,Cn:e.Cn,Tn:e.Tn,Fn:e.Fn,In:t&&t.overrideInteractionMouseButtons?t.overrideInteractionMouseButtons:void 0,Hs:t&&void 0!==t.resourcesBaseUrl&&null!==t.resourcesBaseUrl?t.resourcesBaseUrl:`${xt.location.origin}/resources`,Pn:!t||!("warnings"in t)||"boolean"!=typeof t.warnings||t.warnings,Dn:(()=>{const e=null==t?void 0:t.pickingPrecision;if("string"==typeof e){const t=e.toLowerCase();if("best"===t)return 1;if("high"===t)return.5;if("low"===t)return 1/8}return 1/4})(),Bn:void 0===(null==t?void 0:t.interactable)||t.interactable,On:void 0===t.textPixelSnappingEnabled||t.textPixelSnappingEnabled};const i=t?t.container:void 0;if(i){if("string"==typeof i){const t=xt.document.getElementById(i);if(!t)throw new Error(`Container "${i}" doesn't exist.`);this.Cr=t}else this.Cr=i;xt.addEventListener("resize",this.Br),this.Wr.push((()=>{xt.removeEventListener("resize",this.Br)}))}else{if(void 0===Sr){const t=xt.document.createElement("div");t.id="lcjs-auto-flexbox",t.style.position="relative",t.style.width="100%",t.style.display="flex",t.style.flexDirection="column",xt.document.body.appendChild(t),Sr=t,xt.addEventListener("resize",xr)}let t=1;for(;null!==xt.document.getElementById(`chart-${t}`);)t+=1;this.Cr=xt.document.createElement("div"),this.Cr.id=`chart-${t}`,this.Cr.style.flex="1",Sr.appendChild(this.Cr),xr(),mr.push(this.Br),this.Wr.push((()=>{Sr&&Sr.removeChild(this.Cr),mr.includes(this.Br)&&mr.splice(mr.indexOf(this.Br),1),0===mr.length&&Sr&&(xt.document.body.removeChild(Sr),Sr=void 0,xt.removeEventListener("resize",xr))}))}if(xt.ResizeObserver){const t=t=>{for(const e of t)e.target===this.Cr&&this.Br()};this.Ln=new xt.ResizeObserver(t.bind(this)),this.Ln.observe(this.Cr)}""===this.Cr.style.position&&(this.Cr.style.position="relative"),this.Cr.style.boxSizing="content-box",this.Cr.addEventListener("fullscreenchange",this.Br),this.Cr.addEventListener("webkitfullscreenchange",this.Br);const s=t?t.maxFps:void 0;this.Rn=s?-1===s?-1:0!==s?1e3/s:0:0;const n=new Map;let o=!1;const h=(t,e)=>i=>{const s=function(t){return{x:t.clientX,y:t.clientY}}(i);switch(i.type){case"pointerover":case"pointerenter":case"pointermove":case"pointerdown":n.set(i.pointerId,s);break;default:n.delete(i.pointerId),o=!1}switch(i.interactions=Array.from(n.values()),i.pointerType){case"pen":case"mouse":default:t&&t(i);break;case"touch":e&&e(i)}i.defaultPrevented&&(o=!0)};if(this.Cr.onwheel=this.En(gr.wheel),this.Cr.oncontextmenu=this.En(gr.contextmenu),this.Cr.onclick=this.En(gr.click),this.Cr.ondblclick=this.En(gr.dbclick),this.Cr.onlostpointercapture=()=>{o=!1},this.Cr.ontouchmove=t=>{o&&t.preventDefault()},this.Cr.onpointerover=h(),this.Cr.onpointerenter=h(this.bn),this.Cr.onpointerdown=h(this.En(gr.mouseDown),this.zn(yr.touchStart)),this.Cr.onpointermove=h(this.hn,this.zn(yr.touchMove)),this.Cr.onpointerup=h(this.En(gr.mouseUp),this.zn(yr.touchEnd)),this.Cr.onpointercancel=h(),this.Cr.onpointerout=h(),this.Cr.onpointerleave=h(this.mn,this.zn(yr.touchEnd)),!xt.requestAnimationFrame||!xt.cancelAnimationFrame)throw new Error("LightningChart JS depends on requestAnimationFrame. Make sure to load a polyfill in older browsers.");xt.addEventListener("scroll",this.Or),this.Zr=m(new M({r:0,g:0,b:0,a:0})),this.os=new cr(this)}Vn(){return this.Nn}Gn(){return this.Wn}setBackgroundFillStyle(t){return this.Hn.Me(t),this}getBackgroundFillStyle(){return this.Hn.Th()}setBackgroundStrokeStyle(t){return this.Hn.ve(t),this}getBackgroundStrokeStyle(){return this.Hn.Un()}$n(t){return this.Gr=t,this}jn(t){return this.Nr=t,this}Yn(t){return this.Rr.get(t)}Xn(){return Array.from(this.Rr.keys()).reverse().reduce(((t,e)=>e!==Number.MAX_SAFE_INTEGER&&e>t?e:t),0)+1}En(t){return e=>this.Zn(t,e)}Zn(t,e){if(!this.$r)return;t===gr.contextmenu&&Kt(e);const i=this.Ce(e.clientX,e.clientY),s=this.nn(e,{x:e.clientX,y:e.clientY});if(t===gr.mouseUp){if(this.ln){const t=this.ln.entity.yn;if(t&&t(this.ln.entity,e,this.ln.button,this.ln.startLocation,this.ln.collectionMember),(null==s?void 0:s.entity)!==this.ln.entity||s.collectionMember!==this.ln.collectionMember){this.ln.entity.Ii=!1;const t=this.ln.entity.un;t&&t(this.ln.entity,e,this.ln.collectionMember)}this.ln=void 0}if(this.Sn){const t=this.Sn.entity.getMouseInteractions()&&this.Sn.entity.xn;t&&t(this.Sn.entity,e,this.Sn.collectionMember),this.Sn=void 0}}else if(s&&s.entity.getMouseInteractions()){const i=t===gr.click?s.entity.Kn:t===gr.dbclick?s.entity.qn:t===gr.mouseDown?s.entity.Jn:t===gr.wheel?s.entity.Qn:t===gr.contextmenu?s.entity.io:void 0;if(i&&i(s.entity,e,s.collectionMember),t===gr.mouseDown){this.Sn={entity:s.entity,collectionMember:s.collectionMember,event:e};const t=this.Sn.event.button,i=s.entity.so;i&&i(s.entity,e,t,s.collectionMember),this.ln={entity:s.entity,collectionMember:s.collectionMember,button:t,startLocation:u(e.clientX,e.clientY)}}}this.gn=e,this.pn=i,this.an=s}zn(t){return e=>this.eo(t,e)}eo(t,e){const i=e.interactions.length;if(this.ho=e,this.ro){const s=t===yr.touchMove?this.ro.entity.no:t===yr.touchEnd?this.ro.entity.oo:t===yr.touchStart?this.ro.entity.ao:void 0;s&&s(this.ro.entity,e,this.ro.collectionMember),t===yr.touchEnd&&0===i&&(this.ro.entity.Ii=!1,this.ro=void 0)}else if(t===yr.touchStart){for(let t=0;t{t()})),this.Wr.length=0,this.Vr&&xt.cancelAnimationFrame(this.Vr)}Ce(t,e){return u(t-this.zr.x,this.zr.y-e)}Ir(t,e){return u(t+this.zr.x,this.zr.y-e)}do(t){const e=this.Ce(t.clientX,t.clientY);return{engineX:e.x,engineY:e.y}}fo(t){const e=this.Ir(t.engineX,t.engineY);return{clientX:e.x,clientY:e.y}}}const Ar=(t=1)=>({type:"horizontalProgressive",packager:(e,i,s)=>{if(e.length>1){const r=si(i,s*t),n=Math.abs(r.x),o=e.length,h=[];let a=0,l=0,c=e[0].x+n;for(;ls&&(s=e[l].y),e[l].y({type:"horizontalRegressive",packager:(e,i,s)=>{if(e.length>1){const r=si(i,s*t),n=Math.abs(r.x),o=e.length,h=[];let a=0,l=0,c=e[0].x-n;for(;lc&&l=c;)e[l].y>s&&(s=e[l].y),e[l].y({type:"verticalProgressive",packager:(e,i,s)=>{if(e.length>1){const r=si(i,s*t),n=Math.abs(r.y),o=e.length,h=[];let a=0,l=0,c=e[0].y+n;for(;ls&&(s=e[l].x),e[l].x({type:"verticalRegressive",packager:(e,i,s)=>{if(e.length>1){const r=si(i,s*t),n=Math.abs(r.y),o=e.length,h=[];let a=0,l=0,c=e[0].y-n;for(;lc&&l=c;)e[l].x>s&&(s=e[l].x),e[l].x{const e="nearest"===t?Cr.Nearest:"nearest-x"===t?Cr.NearestX:"nearest-y"===t?Cr.NearestY:void 0;return void 0!==e?e:Cr.NearestX},kr=(t,e,i,s,r,n,o,h,a,l)=>{const u=t.length;if(0===u)return;const c=s?1:0,d=u-(r?2:1);if(i===Cr.Nearest)return Fr(t,e,n,o,c,d);if(i===Cr.NearestX||i===Cr.NearestY){if("boolean"==typeof l&&("x"===a&&i===Cr.NearestX||"y"===a&&i===Cr.NearestY))return Lr(t,at(e,o,n),a,l,c,d);if(i===Cr.NearestX)return Br(t,at(e,o,n),h,c,d);if(i===Cr.NearestY)return _r(t,at(e,o,n),h,c,d)}},Fr=(t,e,i,s,r,n)=>{let o,h=Number.MAX_VALUE;for(let a=r;a<=n;a+=1){const r=t[a];if(!Number.isNaN(r.x)&&!Number.isNaN(r.y)){const t=at(r,i,s),n=(t.x-e.x)**2+(t.y-e.y)**2;n{if(e.xi.max.x)return;let n,o=Number.MAX_VALUE;for(let i=s;i<=r;i+=1){const s=t[i],r=s.x>e.x?s.x-e.x:e.x-s.x;r{if(e.yi.max.y)return;let n,o=Number.MAX_VALUE;for(let i=s;i<=r;i+=1){const s=t[i],r=s.y>e.y?s.y-e.y:e.y-s.y;r{const o="x"===i,h=o?e.x:e.y,a=t[r],l=t[n],u=a.xl.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(o&&(hd)||!o&&(hf))return;let g=r,y=Math.floor((r+n)/2),p=n,m=-1;for(;;){const e=h-(o?t[y].x:t[y].y);if(e*(s?-1:1)>0)g=Math.min(y+1,p),m=Math.floor((g+p)/2);else{if(0===Math.abs(e))return y;p=Math.max(y-1,g),m=Math.floor((g+p)/2)}if(m===y){const i=y>r?Math.abs(h-(o?t[y-1].x:t[y-1].y)):Pe,s=y{const o="x"===i,h=o?e.x:e.y,a=t[r],l=t[n],u=a.xl.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(o&&(hd)||!o&&(hf))return;let g=r,y=Math.floor((r+n)/2),p=n,m=-1;for(;;){const i=h-(o?t[y].x:t[y].y);if(i*(s?-1:1)>0)g=Math.min(y+1,p),m=Math.floor((g+p)/2);else{if(0===Math.abs(i))return{a:y,b:y,lerpAmount:0};p=Math.max(y-1,g),m=Math.floor((g+p)/2)}if(m===y){if(i*(s?-1:1)<0&&y>r){const i=t[y-1],s=t[y];return{a:y-1,b:y,lerpAmount:o?(e.x-i.x)/(s.x-i.x):(e.y-i.y)/(s.y-i.y)}}if(ythis.P.on("dispose",t),this.offDispose=t=>this.P.off(t,"dispose"),this.ls=t,this.bo=e,this.vo=i,this.Mo=zr,zr+=1,this._o=t.Ji.highlightColorOffset}Ao(t){return void 0!==this.vo.find((e=>e.type===t))}wo(t,e){var i;return!!this.Ao(t)&&!0===e(null===(i=this.vo.find((e=>e.type===t)))||void 0===i?void 0:i.args)}dispose(){return this.Ti||(this.Ii&&this.un&&this.un(this,void 0,void 0),this.Ti=!0,this.bo(this),this.P.emit("dispose",this)),this}setVisible(t){const e=this.Fi;return this.Fi=t,!t&&e&&(this.Ii&&this.un&&this.un(this,void 0,void 0),this.Ii=!1),this}getVisible(){return this.Fi}setMouseInteractions(t){const e=this.po.M();return this.po.S(t),t||(e&&this.Ii&&this.un&&this.un(this,void 0,void 0),this.Ii=!1),this}getMouseInteractions(){return this.po.M()}getIsUnderMouse(){return this.Ii}getIsGrabbed(){return this.yo}setMouseMoveEventHandler(t){return this.cn=t,this}setMouseEnterEventHandler(t){return this.dn=t,this}setMouseLeaveEventHandler(t){return this.un=t,this}setMouseClickEventHandler(t){return this.Kn=t,this}setMouseDoubleClickEventHandler(t){return this.qn=t,this}setMouseDownEventHandler(t){return this.Jn=t,this}setMouseUpEventHandler(t){return this.xn=t,this}setMouseWheelEventHandler(t){return this.Qn=t,this}setMouseContextMenuEventHandler(t){return this.io=t,this}setMouseDragEventHandler(t){return this.fn=t,this}setMouseDragStartEventHandler(t){return this.so=t,this}setMouseDragStopEventHandler(t){return this.yn=t,this}setTouchStartEventHandler(t){return this.ao=t,this}setTouchMoveEventHandler(t){return this.no=t,this}setTouchEndEventHandler(t){return this.oo=t,this}ko(t){return this.So=t,this}Co(){return this.So?this.So:Rr}us(t){return this.xo=t,this}To(){return this.xo}Fo(t){return this._o=t,this}Io(){return this._o}}const Rr=y(u(0,0),u(0,0));class Vr extends Or{constructor(t,e,i,s){super(t,i,s),this.Po=0,this.As=e,this.As.Do=!0}Bo(t){return this.Po===t||(this.Po=t,this.As.Do=!0),this}Oo(){return this.Po}}class Nr extends Vr{constructor(t,e,i,s,r){super(t,e,s,r),this.Lo=!0,this.ct=i}}const Gr=(t,e,i)=>{if(i instanceof _i){const s=i.Ai(),r=oi(e,{x:Math.abs(s.x),y:Math.abs(s.y)});return y(u(t.min.x-r.x,t.min.y-r.y),u(t.max.x+r.x,t.max.y+r.y))}return y(i.Jt(u(t.min.x,t.min.y),si(e,-1)),i.Jt(u(t.max.x,t.max.y),e))},Hr=(t,e)=>"function"==typeof e?e(t):e,Ur=(t,e)=>!t||t!==e,Wr=(t,e)=>t===z&&e!==z,Xr=t=>t!==z;class Yr extends Nr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.Se=vr.fillStyle,this.ls=t}Me(t){return this.Se=Hr(this.Se,t),this}Th(){return this.Se}Ro(){return Ur(this.Eo,this.Se)}zo(){return Wr(this.Eo,this.Se)}Vo(){return Xr(this.Se)}No(t){this.Eo=t}}class jr extends Yr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.xe=vr.lineStyle,this.ls=t}ve(t){return this.xe="function"==typeof t?t(this.xe):t,this}Un(){return this.xe}Go(){return!this.Wo||this.Wo!==this.xe}Ho(t){return!this.Wo||this.Wo.getThickness()!==t}Vo(){return this.xe!==st||super.Vo()}zo(){return(this.xe!==st||this.Se!==z)&&this.Wo===st&&this.Eo===z}Uo(t){this.Wo=t}}class Jr extends Yr{constructor(t,e,i,s,r,n=m(5)){super(t,e,i,s,r),this.size=m(5),this.size=n}q(t){return this.size.S(t),this}}class $r extends Yr{constructor(t,e,i,s,r,n=m(vr.font)){super(t,e,i,s,r),this.$o=m(""),this.jo=m(u(0,0)),this.Yo=m(0),this.Xo=m(0),this.Zo=m(u(0,0)),this.Ko=m(0),this.qo=m(ir),this.Jo=u(0,0),this.Ft=m(S(1,1,1,1)),this.Qo=m(x(4,4,4,4)),this.font=m(vr.font),this.ta=!1,this.font=n}Vo(){return Xr(this.Se)&&this.$o.M().length>0}zo(){return!1===this.ta&&this.Vo()}Ch(t){return this.$o.S(t),this}wh(){return this.$o.M()}Ih(t){return er(t)?this.qo.S(t):this.qo.S(t(this.qo.M())),this}Fh(){return this.qo.M()}ia(t){return this.qo.S(this.qo.M().setFamily(t)),this}sa(){return this.qo.M().getFamily()}ea(t){return this.qo.S(this.qo.M().setSize(t)),this}ha(){return this.qo.M().getSize()}ra(t){return this.qo.S(this.qo.M().setWeight(t)),this}na(){return this.qo.M().getWeight()}oa(t){return this.qo.S(this.qo.M().setStyle(t)),this}aa(){return this.qo.M().getStyle()}la(t){return this.qo.S(this.qo.M().setVariant(t)),this}ua(){return this.qo.M().getVariant()}we(t){return this.jo.S(t),this}ca(){return this.jo.M()}Ph(t){return this.Ko.S(t),this}Dh(){return this.Ko.M()}da(t,e){return this.Zo.S(u(t,e)),this}fa(){return this.Zo.M()}ga(t){return this.Xo.S(t),this}pa(){return this.Xo.M()}ma(t){return this.Yo.S(t),this}ya(){return this.Yo.M()}Sa(t){return this.Xo.S(t.x),this.Yo.S(t.y),this}xa(t){return this.Ft.S(t),this}ba(){return this.Ft.M()}va(t){return this.Qo.S(t),this}Ma(){return this.Qo.M()}}class qr extends Jr{constructor(t,i,s,r,n,o=5){super(t,i,s,r,n,m(o)),this._a=[],this.Aa=m(e.PointShape.Square),this.Ko=m(0),this.wa=m(!1),this.ka=m(!1),this.Ca=m(!1),this.Ta=Fe,this.Fa=0,this.Ia=[],this.Pa=0,this.Da=Fe,this.Ba=Cr.Nearest,this.Oa=!1}La(t){return this.Ba=t,this}Ra(){return this.Ia}Ea(){return this._a}za(t){return this.Aa.S(t),this}Ph(t){return this.Ko.S(t),this}Va(t){return this.wa.S(t),this}Na(t){return this.ka.S(t),this}Ga(t){return this.Ca.S(t),this}Wa(t,e){return Array.isArray(t)||(t=[t]),this.Pa+=t.length,this.Ia=he(this.Ia,t,{canReturnB:!0}),this.Da&&(this.Da=e?je(this.Da,e):void 0),this}Ha(){return this.Oa=!0,this._a.length=0,this.Fa=0,this.Ta=Fe,this.Ia=[],this.Pa=0,this}Ua(){return this.Fa}$a(){return this.Pa}}class Zr extends jr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.jo=m(u(0,0)),this.j=m(u(100,100)),this.Ko=m(0),this.Jo=m(u(0,0)),this.ja=!1}Ts(){return this.Ya(),this}we(t){const e=this.jo.M();return t.x===e.x&&t.y===e.y||(this.jo.S(t),this.Ya()),this}ca(){return this.jo.M()}Xa(t){const e=this.jo.M();return t!==e.x&&(this.jo.S(u(t,e.y)),this.Ya()),this}Za(t){const e=this.jo.M();return t!==e.y&&(this.jo.S(u(e.x,t)),this.Ya()),this}q(t){const e=this.j.M();return t.x===e.x&&t.y===e.y||(this.j.S(u(t.x,t.y)),this.Ya()),this}Ht(){return this.j.M()}Ka(t){const e=this.j.M();return t!==e.x&&(this.j.S(u(t,e.y)),this.Ya()),this}qa(t){const e=this.j.M();return t!==e.x&&(this.j.S(u(e.x,t)),this.Ya()),this}Ph(t){return this.Ko.S(t),this}Dh(){return this.Ko.M()}Ja(t){const e=this.Jo.M();return t===e&&e.x===t.x&&e.y===t.y||(void 0===t?(this.ja=!1,this.Ya()):(this.ja=!0,this.Jo.S(t))),this}Ya(){if(!this.ja){const t=this.jo.M(),e=this.j.M(),i=u(t.x+e.x/2,t.y+e.y/2),s=this.Jo.M();i.x===s.x&&i.y===s.y||this.Jo.S(i)}}}class Kr extends jr{constructor(){super(...arguments),this._a=[],this.jo=m(u(0,0)),this.Ta=Fe,this.Qa=!1}tl(t){return t=ie(t),this._a=t,this.Qa=!0,this}il(){return this._a}_t(){return this.Ta.max.x}Mt(){return this.Ta.min.x}wt(){return this.Ta.max.y}At(){return this.Ta.min.y}sl(){return 0}el(){return 0}}class Qr extends Kr{}class tn extends Yr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.hl=new Array,this.rl=new Array,this.nl=m({type:"disabled",packager:(t,e,i)=>t.slice()}),this.Ta=Fe,this.ol=0,this.al=!1,this.Ia=[Array(),Array()],this.ll=!1,this.ul=(new V).setColor(w(42,171,240)),this.Oa=!1,this.cl=!1,this.dl=!1}Wa(t,e){const i=this.ol-1,s=i>0&&!this.ll;let[r,n]=s?[[this.hl[i]],[this.rl[i]]]:[[],[]];if(t instanceof Array){const[e,i]=g(t);r=he(r,e,{canReturnB:!0}),n=he(n,i,{canReturnB:!0})}else{const e=t.position;r.push(u(e,t.high)),n.push(u(e,t.low))}return this.ll?(this.Ia[0]=he(this.Ia[0],r,{canReturnB:!0}),this.Ia[1]=he(this.Ia[1],n,{canReturnB:!0})):(this.Ia=[r,n],this.ll=!0),this.Ta=je(this.Ta,e||je(Xe(r),Xe(n))),this}Ha(){return this.Oa=!0,this.hl.length=0,this.rl.length=0,this.ol=0,this.Ta=Fe,this}Ea(){return[this.hl,this.rl]}Ra(){return[this.Ia[0],this.Ia[1]]}fl(t){return this.nl.S(t),this}pl(){return this.nl.M()}ml(t){return this.ul="function"==typeof t?t(this.ul):t,this}yl(){return this.ul}Ua(){return this.ol-(Number(this.cl)+Number(this.dl))}$a(){return this.Ia.length}Sl(t){return this.cl=t,this}xl(){return this.cl}bl(t){return this.dl=t,this}vl(){return this.dl}zo(){return this.Eo===z&&this.Ml===z&&(this.Se!==z||this.ul!==z)}_l(t){this.Ml=t}Vo(){return this.ul!==z||super.Vo()}Ro(){return super.Ro()||!this.Ml||this.Ml!==this.ul}}class en extends jr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.jo=m(u(0,0)),this.Al=m(0),this.ci=m(360),this.wl=m(100),this.kl=m(100),this.Cl=m(0),this.Tl=m(void 0),this.Fl=u(0,0),this.Il=u(0,0),this.Pl=u(0,0)}Dl(){return this.wl.M()}Bl(){return this.kl.M()}ca(){return this.jo.M()}Ol(){return this.Al.M()}ui(){return this.ci.M()}Ll(){return this.Cl.M()}Rl(){return this.Tl.M()}El(){return this.Fl}zl(){return this.Il}Vl(){return this.Pl}we(t){return this.jo.S(t),this}Nl(t){return this.Al.S(t),this}Be(t){return this.ci.S(t),this}Gl(t){return this.kl.S(t),this.wl.S(t),this}Wl(t){return this.wl.S(t),this}Hl(t){return this.kl.S(t),this}Ul(t){return this.Cl.S(t<0?0:t),this}$l(t){return this.Tl.S(void 0!==t&&t<=0?void 0:t),this}}var sn;!function(t){t[t.Complex=0]="Complex",t[t.Simple=1]="Simple"}(sn||(sn={}));class rn extends Nr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.jl=vr.lineStyle,this.engine=t}Pe(t){return this.jl=((t,e)=>"function"==typeof e?e(t):e)(this.jl,t),this}Yl(){return this.jl}Go(){return((t,e)=>!t||t!==e)(this.Xl,this.jl)}Zl(t){return((t,e)=>!t||t.getThickness()!==e)(this.Xl,t)}zo(){return((t,e)=>t===st&&e!==st)(this.Xl,this.jl)}Vo(){return(t=>t!==st&&t.getFillStyle()!==z)(this.jl)}Kl(t){this.Xl=t}}class nn extends rn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fi=u(0,0),this.ci=u(0,0),this.ql=!1}S({min:t,max:e}){return t.x===this.fi.x&&t.y===this.fi.y&&e.x===this.ci.x&&e.y===this.ci.y||(this.ql=!0,this.fi=t,this.ci=e),this}di(){return this.fi}ui(){return this.ci}Oe(t){return t.x===this.fi.x&&t.y===this.fi.y||(this.ql=!0,this.fi=t),this}Be(t){return t.x===this.ci.x&&t.y===this.ci.y||(this.ql=!0,this.ci=t),this}}class on extends rn{constructor(t,e,i,s,r){super(t,e,i,s,r)}}class hn extends rn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.Jl=[],this.Ta=Fe,this.Ia=new Array,this.Fa=0,this.Ba=Cr.NearestX,this.Oa=!1,this.Ql=m(void 0),this.cl=!1,this.dl=!1}tu(t){return this.Ql.S(t),this}iu(){return this.Ql.M()}Ra(){return this.Ia}Ea(){return this.Jl}La(t){return this.Ba=t,this}Ha(){return this.Oa=!0,this.Jl.length=0,this.Fa=0,this.Ia=[],this.Ta=Fe,this}Ua(){return this.Fa-(Number(this.cl)+Number(this.dl))}$a(){return this.Ia.length}Sl(t){return this.cl=t,this}xl(){return this.cl}bl(t){return this.dl=t,this}vl(){return this.dl}}class an extends Yr{constructor(t,e,i,s,r){super(t,e,i,s,r),this.ol=0,this.su=0,this.j=m({x:0,y:0}),this.eu=m({x:0,y:0}),this.hu=m({x:0,y:0}),this.fi={x:0,y:0},this.ci={x:0,y:0},this.ru=!0,this.nu=!0,this.ou=!0,this.Ta=Fe,this.au=!0,this.lu=z}uu(t){return this.lu=Hr(this.lu,t),this}cu(){return this.lu}S(t){return ln.S(this,t,((t,e)=>({x:t,y:e}))),this}du(){return ln.du(this)}fu(){return ln.fu(this)}ca(){return ln.ca(this)}$a(){return ln.$a(this)}gu(t,e,i){return ln.gu(this,t,e,i),this}pu(t,e,i){return ln.pu(this,t,e,i),this}mu(t,e){return ln.mu(this,t,e),this}yu(t,e){return ln.yu(this,t,e),this}Su(t,e){return ln.Su(this,t,e),this}Ha(){return ln.Ha(this,((t,e)=>({x:t,y:e}))),this}xu(){return ln.xu(this)}bu(){return ln.bu(this)}vu(){return ln.vu(this)}Ua(){return ln.Ua(this)}zo(){return ln.zo(this)}Vo(){return ln.Vo(this)}Mu(){return this._u}Au(){return this.wu}}const ln={S(t,e,i){t.ru=!0,t.nu=!0,t.ou=!0;const{start:s}=e,{end:r}=e,{rows:n}=e,{columns:o}=e;t.au=e.pixelate;const h={x:e.pixelate&&o>=1||!e.pixelate&&o>1?o:0,y:e.pixelate&&n>=1||!e.pixelate&&n>1?n:0};t.eu.S(h),t.fi={...s},t.ci={...r},t.j.S(ni(r,s)),ln.ku(t,i)},ku(t,e){const i=t.eu.M();if(i.x>0&&i.y>0){t._u?t._u.length=0:t._u=[];const s=t.au?ri(i,{x:1,y:1}):{x:i.x,y:i.y};t.hu.S(s),t._u=Array.from(Array(s.y)).map((()=>Array(s.x))),t.wu=Array.from(Array(i.y)).map((()=>Array(i.x))),ln.Cu(t,i,s,e),t.ol=s.x*s.y,t.su=i.x*i.y}else t._u=void 0,t.hu.S({x:0,y:0})},Cu(t,e,i,s){const r=t.fi,n=t.ci,o=t._u,h=t.wu;if(o){const e=i.x,h=i.y,{x:a,y:l}=t.j.M(),u={x:a/(e-1),y:l/(h-1)};for(let t=0;tt.eu.o||t.hu.o,fu(t){const e=t.eu.M();return{columns:e.x,rows:e.y}},ca(t){const e=t.fi,i=t.ci;return{start:{x:e.x,y:e.y},end:{x:i.x,y:i.y}}},$a(t){throw new Error("Method not implemented.")},gu(t,e,i,s){const r="geometry"===i||"y"===i?t._u:t.wu;if(r){const n=t.hu.M();if("y"===i){const t=_t(r);for(let i=0;iBt(t,e)));const o=r===t._u?t.hu.M():t.eu.M(),h={column:{start:o.x-e,end:o.x},row:{start:0,end:o.y}},a=(t=>{const e=t.length,i=e>0?t[0].length:0,s=Array.from(Array(i)).map((()=>Array(e)));for(let r=0;r0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;a0?e[0].length:0;for(let a=r,l=0;at.ol,Ua:t=>t.su,zo:t=>Wr(t.Eo,t.Se)||Wr(t.Iu,t.lu),Vo:t=>Xr(t.Se)||Xr(t.lu)},un=t=>{const i=t.getDraggingMode();return void 0!==i&&i!==e.UIDraggingModes.notDraggable?i===e.UIDraggingModes.draggable?e.MouseStyles.Move:i===e.UIDraggingModes.onlyHorizontal?e.MouseStyles.Horizontal:e.MouseStyles.Vertical:void 0};class cn{constructor(){this.Fi=!0,this.P=new r.Eventer,this.Pu=0,this.Du=(t,e)=>{0===this.Pu&&this.P.emit("mouseEnter",this,e),this.Pu+=1},this.Bu=(t,e)=>{this.Pu-=1,this.Pu<1&&(this.P.emit("mouseLeave",this,e),this.Pu=0)},this.Ou=(t,e)=>{this.P.emit("mouseClick",this,e)},this.Lu=(t,e)=>{this.P.emit("mouseDoubleClick",this,e)},this.Ru=(t,e)=>{this.P.emit("mouseDown",this,e)},this.Eu=(t,e)=>{this.P.emit("mouseUp",this,e)},this.zu=(t,e)=>{this.P.emit("mouseMove",this,e)},this.Vu=(t,e,i)=>{this.P.emit("mouseDragStart",this,e,i)},this.Nu=(t,e,i,s,r)=>{this.P.emit("mouseDrag",this,e,i,s,r)},this.Gu=(t,e,i,s)=>{this.P.emit("mouseDragStop",this,e,i,s)},this.Wu=(t,e)=>{this.P.emit("mouseWheel",this,e)},this.Hu=(t,e)=>{this.Pu+=1,this.P.emit("touchStart",this,e)},this.Uu=(t,e)=>{this.P.emit("touchMove",this,e)},this.$u=(t,e)=>{this.Pu-=1,this.P.emit("touchEnd",this,e)},this.ju=t=>(t instanceof Nr?t.setMouseEnterEventHandler(this.Du).setMouseLeaveEventHandler(this.Bu).setMouseClickEventHandler(this.Ou).setMouseDoubleClickEventHandler(this.Lu).setMouseDownEventHandler(this.Ru).setMouseUpEventHandler(this.Eu).setMouseMoveEventHandler(this.zu).setMouseDragEventHandler(this.Nu).setMouseDragStartEventHandler(this.Vu).setMouseDragStopEventHandler(this.Gu).setMouseWheelEventHandler(this.Wu).setTouchStartEventHandler(this.Hu).setTouchMoveEventHandler(this.Uu).setTouchEndEventHandler(this.$u):(t.onMouseEnter(this.Du),t.onMouseLeave(this.Bu),t.onMouseClick(this.Ou),t.onMouseDoubleClick(this.Lu),t.onMouseDown(this.Ru),t.onMouseUp(this.Eu),t.onMouseMove(this.zu),t.onMouseDrag(this.Nu),t.onMouseDragStart(this.Vu),t.onMouseDragStop(this.Gu),t.onMouseWheel(this.Wu),t.onTouchStart(this.Hu),t.onTouchMove(this.Uu),t.onTouchEnd(this.$u)),t)}onMouseEnter(t){return this.P.on("mouseEnter",t)}onMouseLeave(t){return this.P.on("mouseLeave",t)}onMouseClick(t){return this.P.on("mouseClick",t)}onMouseDoubleClick(t){return this.P.on("mouseDoubleClick",t)}onMouseDown(t){return this.P.on("mouseDown",t)}onMouseUp(t){return this.P.on("mouseUp",t)}onMouseMove(t){return this.P.on("mouseMove",t)}onMouseDragStart(t){return this.P.on("mouseDragStart",t)}onMouseDrag(t){return this.P.on("mouseDrag",t)}onMouseDragStop(t){return this.P.on("mouseDragStop",t)}onMouseWheel(t){return this.P.on("mouseWheel",t)}onTouchStart(t){return this.P.on("touchStart",t)}onTouchMove(t){return this.P.on("touchMove",t)}onTouchEnd(t){return this.P.on("touchEnd",t)}offMouseEnter(t){return this.P.off(t,"mouseEnter")}offMouseLeave(t){return this.P.off(t,"mouseLeave")}offMouseClick(t){return this.P.off(t,"mouseClick")}offMouseDoubleClick(t){return this.P.off(t,"mouseDoubleClick")}offMouseDown(t){return this.P.off(t,"mouseDown")}offMouseUp(t){return this.P.off(t,"mouseUp")}offMouseMove(t){return this.P.off(t,"mouseMove")}offMouseDragStart(t){return this.P.off(t,"mouseDragStart")}offMouseDrag(t){return this.P.off(t,"mouseDrag")}offMouseDragStop(t){return this.P.off(t,"mouseDragStop")}offMouseWheel(t){return this.P.off(t,"mouseWheel")}offTouchStart(t){return this.P.off(t,"touchStart")}offTouchMove(t){return this.P.off(t,"touchMove")}offTouchEnd(t){return this.P.off(t,"touchEnd")}getIsUnderMouse(){return this.Pu>0}setVisible(t){const e=this.Fi!==t;return this.Fi=t,e&&this.P.emit("visibleStateChanged",this,this.Fi),this}getVisible(){return this.Fi}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}}const dn=(t,i,s)=>{const r=t.getDraggingMode();if(r!==e.UIDraggingModes.notDraggable){const n=t.scale.Jt(t.getPosition(),{x:r!==e.UIDraggingModes.onlyVertical?i.x:0,y:r!==e.UIDraggingModes.onlyHorizontal?i.y:0}),o=t.scale,h=t.getSize(),a=t.getOrigin(),l=o.Jt({x:o.x.getInnerStart(),y:o.y.getInnerStart()},oi({x:(1+a.x)/2,y:(1+a.y)/2},h)),u=o.Jt({x:o.x.getInnerEnd(),y:o.y.getInnerEnd()},oi({x:(a.x-1)/2,y:(a.y-1)/2},h)),c={x:Math.min(Math.max(n.x,l.x),u.x),y:Math.min(Math.max(n.y,l.y),u.y)};t.setPosition(c),Kt(s)}},fn=(t,e,i,s,r)=>{dn(t,r,e)},gn=(t,e,i,s,r)=>{dn(t,s,r)};class yn extends cn{constructor(t,e,i,s,r){super(),this.position=u(50,50),this.origin=u(0,0),this.size=u(0,0),this.Ti=!1,this.Yu=void 0,this.Xu=void 0,this.Zu=un,this.Ku=void 0,this.qu=()=>{const t="function"==typeof this.Zu?this.Zu(this):this.Zu;t&&(this.Xu=this.As.ls.Tr(t))},this.Ju=()=>{this.As.ls.Fr(this.Xu)},this.Ft=S(0,0,0,0),this.As=t,this.renderingScale=e,this.scale=i,this.bo=s,this.Ji=r,this.As.Ss(),this.onMouseEnter(this.qu),this.onMouseLeave(this.Ju),this.onMouseDrag(fn);const n=Wi(new Yi(Et,gn,Et));this.onTouchStart(n.onTouchStart),this.onTouchMove(n.onTouchMove),this.onTouchEnd(n.onTouchEnd),this.Ji=r}setEffect(t){return this.ss=this.ss||this.As.ls.ss.es(this,{Qu:{shapes:this.tc()}}),this.ss.Qu.ys(t),this}getEffect(){return!!this.ss&&this.ss.Qu.xs()}setAutoDispose(t){return this.Ku=t,this.As.Ss(),this}getAutoDispose(){return this.Ku}getSize(t=e.UISpace.Everything){return t===e.UISpace.Everything?u(this.size.x+(this.Ft.left+this.Ft.right),this.size.y+(this.Ft.bottom+this.Ft.top)):this.size}setContentSize(t){this.size=t}setMargin(t){return this.Ft="object"==typeof t?b(this.Ft,t):{left:t,top:t,right:t,bottom:t},this.As.Ss(),this}getMargin(){return this.Ft}Ae(){if(this.Ku){const t=this.size,e=this.renderingScale.Ht(),i={x:t.x/e.x,y:t.y/e.y};("max-width"===this.Ku.type&&i.x>=this.Ku.maxWidth||"max-height"===this.Ku.type&&i.y>=this.Ku.maxHeight)&&this.dispose()}return this}Ts(){return this}dispose(){return this.Ti||(this.As.Ss(),this.Ti=!0,this.bo(this),this.P.emit("dispose",this)),this}setVisible(t){return super.setVisible(t),this.As.Ss(),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setPosition(t){return this.position=t,this.As.Ss(),this}getPosition(t=this.origin,i=e.UISpace.Everything){const s=this.getSize(e.UISpace.Everything),r=this.scale.Jt(this.position,oi({x:-(this.origin.x+1)/2,y:-(this.origin.y+1)/2},s));if(i===e.UISpace.Everything)return this.scale.Jt(r,oi({x:(t.x+1)/2,y:(t.y+1)/2},s));const n=this.scale.Jt(r,{x:this.Ft.left,y:this.Ft.bottom}),o=this.getSize(e.UISpace.Content);return this.scale.Jt(n,oi({x:(t.x+1)/2,y:(t.y+1)/2},o))}setOrigin(t){return this.origin=t,this.As.Ss(),this}getOrigin(){return this.origin}setDraggingMode(t=e.UIDraggingModes.notDraggable){return this.Yu=t,this.As.Ss(),this}getDraggingMode(){return void 0!==this.Yu?this.Yu:e.UIDraggingModes.notDraggable}setMouseStyle(t){return this.Zu=t,this}getMouseStyle(){return this.Zu}}class pn extends yn{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.Qo=S(),this.ic=0,this.As=t,this.sc=s,this.backgroundElement=new this.sc(this.As,this.renderingScale,this.scale,Et,n),this.ju(this.backgroundElement)}tc(){return this.backgroundElement.tc()}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setBackground(t){return t(this.backgroundElement),this}getBackground(){return this.backgroundElement}Ae(){return super.Ae(),this.Ti||this.backgroundElement.setOrigin(this.origin).setPosition(this.getPosition(this.origin,e.UISpace.PaddedBackground)).Ae(),this}Ts(){const t=this.getSize(e.UISpace.PaddedContent);return this.backgroundElement.hc(t).Ts(),super.Ts()}dispose(){return super.dispose(),this.backgroundElement.dispose(),this}setVisible(t){return super.setVisible(t),this.backgroundElement.setVisible(t),this}setPadding(t){return this.Qo="object"==typeof t?b(this.Qo,t):{left:t,top:t,right:t,bottom:t},this.As.Ss(),this}getPadding(){return this.Qo}getSize(t=e.UISpace.Everything){let i=super.getSize(t);return t>=e.UISpace.PaddedContent&&(i=u(i.x+this.Qo.left+this.Qo.right,i.y+this.Qo.bottom+this.Qo.top)),t>=e.UISpace.PaddedBackground&&(i=u(i.x+this.backgroundElement.rc()+this.backgroundElement.nc(),i.y+this.backgroundElement.oc()+this.backgroundElement.ac())),i}getPosition(t=this.origin,i=e.UISpace.Everything){if(i===e.UISpace.Everything)return super.getPosition(t,i);const s=super.getPosition(u(-1,-1),e.UISpace.Everything),r=this.getMargin(),n=this.scale.Jt(s,{x:r.left,y:r.bottom});if(i===e.UISpace.PaddedBackground){const i=this.getSize(e.UISpace.PaddedBackground);return this.scale.Jt(n,oi({x:(t.x+1)/2,y:(t.y+1)/2},i))}const o=this.scale.Jt(n,{x:this.backgroundElement.rc(),y:this.backgroundElement.oc()});if(i===e.UISpace.PaddedContent){const i=this.getSize(e.UISpace.PaddedContent);return this.scale.Jt(o,oi({x:(t.x+1)/2,y:(t.y+1)/2},i))}const h=this.getPadding(),a=this.scale.Jt(o,{x:h.left,y:h.bottom}),l=this.getSize(e.UISpace.Content);return this.scale.Jt(a,oi({x:(t.x+1)/2,y:(t.y+1)/2},l))}setMouseInteractions(t){return this.backgroundElement.setMouseInteractions(t),this}getMouseInteractions(){return this.backgroundElement.getMouseInteractions()}getHighlight(){return this.ic}setHighlight(t){return this.ic=ve(t),this.backgroundElement.setHighlight(t),this.P.emit("highlight",t),this}}const mn=t=>"setBackground"in t;class Sn extends cn{constructor(t,e,i,s,r,n,o,h,a,l,u){super(),this.u=0,this.lc=1,this.uc=!0,this.cc=new tr,this.dc=!0,this.Ti=!1,this.axisScale=s,this.renderingScale=r,this.fc=o,this.gc=h,this.mc=a,this.bo=l,this.yc=e,this.Sc=i,this.xc=this.ju(this.yc.De(this.renderingScale)),this.Ji=u,this.bc=this.ju(this.mc.vc(this.Sc,this.renderingScale,n,Et,this.Ji,!1).setOrigin(qt(this.gc)).setDirection(this.gc)),this.axis=t,this.setMouseInteractions(!1),"major"===this.bc.Mc?this.xc.Pe(u.xAxisNumericTicks.majorTickStyle.gridStrokeStyle):"minor"===this.bc.Mc?this.xc.Pe(u.xAxisNumericTicks.minorTickStyle.gridStrokeStyle):"other"===this.bc.Mc&&this.xc.Pe(u.cursorGridStrokeStyleX)}setValue(t){return this.u=t,this.Sc.Ss(),this.P.emit("valueChange",this.u),this}getValue(){return this.u}setTextFormatter(t){return this._c=t,this.Sc.Ss(),this}setTickLength(t){return this.bc.setPointerLength(t),this.yc.Ss(),this}getTickLength(){return this.bc.getPointerLength()}setTickLabelPadding(t){return this.bc.setTickLabelPadding(t),this.yc.Ss(),this}setTickLabelRotation(t){return this.bc.setTextRotation(t),this.yc.Ss(),this}getTickLabelRotation(){return this.bc.getTextRotation()}getTickLabelPadding(){return this.bc.getTickLabelPadding()}setGridStrokeLength(t){return this.lc=t,this.yc.Ss(),this}getGridStrokeLength(){return this.lc}setGridStrokeStyle(t){return this.xc.Pe(t),this.yc.Ss(),this}getGridStrokeStyle(){return this.xc.Yl()}dispose(){return this.Ti||(this.Ti=!0,this.xc.dispose(),this.bc.dispose(),this.bo(this),this.yc.ls.Ss(),this.P.emit("dispose",this)),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setMarkerVisible(t){return this.uc=t,this.Sc.Ss(),this}getMarkerVisible(){return this.uc}setMarker(t){return t(this.bc),this.Sc.Ss(),this}getMarker(){return this.bc}setMouseInteractions(t){return this.bc.setMouseInteractions(t),this.xc.setMouseInteractions(t),this}getMouseInteractions(){return this.xc.getMouseInteractions()}setAllocatesAxisSpace(t){return this.dc=t,this.Sc.Ss(),this}getAllocatesAxisSpace(){return this.dc}isInScale(){return Ve(this.u,this.axisScale.getInnerStart(),this.axisScale.getInnerEnd())}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}}class xn extends Sn{constructor(t,e,i,s,r,n,o,h,a,l,u){super(t,e,i,s,r,n,o,h,u,a,l),this.Ac=!1,this.bo=a,this.yc=e,this.Sc=i}dispose(){return this.Ac=!1,super.dispose()}update(){return this}plot(t,e,i,s){if(this.isInScale()&&this.getVisible()){this.Ac=!1;const r=ht(this.u,this.axisScale,this.fc.getWidth(this.renderingScale));this.xc.setVisible(!0).Oe(this.fc.toPoint(r,t)).Be(this.fc.toPoint(r,t-(i+e*this.lc))),this.uc?(this._c&&this.bc.setText(this._c(this.u,this)),this.bc.setVisible(!0).setPosition(this.fc.toPoint(r,s))):this.bc.setVisible(!1)}else this.xc.setVisible(!1),this.bc.setVisible(!1);return this.bc.Ts().Ae(),this}wc(){const t=this.bc.Ts().getSize();return this.fc.getHeight(t)}}const bn=(t,e)=>t.setTextFillStyle(e.uiTextFillStyle).setTextFont(e.uiTextFont),vn=(t,e)=>(ce(t.setButtonOffSize(e.uiButtonSize).setButtonOnSize(e.uiButtonSize),e,{fill:e.uiButtonFillStyle}),t),Mn=(t,e,i)=>{i&&mn(t)&&t.setBackground((t=>t.setFillStyle(e.uiBackgroundFillStyle).setStrokeStyle(e.uiBackgroundStrokeStyle))).setEffect(!0)},An={uiElement:void 0,stylers:o.List(),addStyler(t){return{...this,stylers:this.stylers.push(t)}},applyStylers(t,e){return this.stylers.forEach((i=>void 0!==i?i(t,e):void 0)),t}},wn={background:void 0,setBackground(t){return{...this,background:t}}},Tn={vc(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,s,r),r);return Mn(o,r,n),o}},En={vc(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,this.background,s,r),r);return Mn(o,r,n),o}};class In extends yn{constructor(){super(...arguments),this.kc=!0}Ae(){return super.Ae(),this}setMouseInteractions(t){return this.kc=t,this}getMouseInteractions(){return this.kc}tc(){return[]}}class Cn extends In{onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}hc(t){return this.size=t,this}rc(){return 0}nc(){return 0}ac(){return 0}oc(){return 0}setHighlight(t){return this}getHighlight(){return 0}setFillStyle(){return this}getFillStyle(){return z}setStrokeStyle(){return this}getStrokeStyle(){return st}setStrokeThickness(){return this}getStrokeThickness(){return 0}}class Pn extends Cn{constructor(){super(...arguments),this.setSize=this.hc.bind(this)}}class kn extends yn{constructor(){super(...arguments),this.Se=z,this.P=new r.Eventer,this.ic=0}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}tc(){return[this.Aa]}setFillStyle(t){return this.Se="function"==typeof t?t(this.Se):t,this.Aa.Me(this.Se),this.As.Ss(),this}getFillStyle(){return this.Se}getHighlight(){return this.ic}setHighlight(t){return this.ic=t,this.Aa.us(t),this.P.emit("highlight",t),this.As.Ss(),this}setMouseInteractions(t){return this.Aa.setMouseInteractions(t),this}getMouseInteractions(){return this.Aa.getMouseInteractions()}dispose(){return super.dispose(),this.Aa.dispose(),this}setVisible(t){return super.setVisible(t),this.Aa.setVisible(t),this}}class Fn extends kn{constructor(){super(...arguments),this.xe=st}setStrokeStyle(t){return this.xe="function"==typeof t?t(this.xe):t,this.Aa.ve(this.xe),this.As.Ss(),this}getStrokeStyle(){return this.xe}}class Bn extends Fn{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.As=t,this.Aa=this.As.Cc(this.renderingScale,sn.Simple).ve(this.getStrokeStyle()).Me(this.getFillStyle()).setVisible(!1),this.ju(this.Aa)}Tc(){const t=this.Fc();if(t.length>2){const e=Xe(t),i=u(e.max.x-e.min.x,e.max.y-e.min.y);this.setContentSize(i);const s=t.map((t=>{const s=ri(t,si(e.min,-1));return this.scale.Jt(this.position,ri(s,oi(si(ri(this.origin,u(1,1)),-.5),i)))})).map((t=>at(t,this.scale,this.renderingScale)));this.Aa.tl(s).setVisible(this.getVisible()).setVisible(this.getVisible())}else this.Aa&&this.Aa.setVisible(!1),this.setContentSize(u(0,0))}Ae(){return super.Ae(),this.Ti||this.Tc(),this}Ts(){return this.Tc(),super.Ts()}setVisible(t){return super.setVisible(t),this.Aa.setVisible(t),this}}class _n extends kn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.$o="label",this.Aa=this.As.Sr(this.renderingScale).Me(this.Se).Ch(this.$o),this.ju(this.Aa)}Ae(){const t=this.getPosition(u(0,0),e.UISpace.Content),i=at(t,this.scale,this.renderingScale);return this.Aa.we(i),this}Ts(){this.Aa.Ts();const t=0===this.$o.length?u(0,0):this.Aa.Ic();return this.setContentSize(t),super.Ts()}setText(t){return this.$o=t,this.Aa.Ch(this.$o),this.As.Ss(),this}getText(){return this.$o}setFont(t){return this.Aa.Ih(t),this.As.Ss(),this}getFont(){return this.Aa.Fh()}setTextRotation(t){return this.Aa.Ph(t),this.As.Ss(),this}getTextRotation(){return this.Aa.Dh()}}const Ln={...An,...Tn,uiElement:_n};class Dn extends Fn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.fitTo=this.hc.bind(this),this.setSize=this.fitTo,this.Aa=this.As._e(e).Me(this.Se).ve(this.getStrokeStyle()),this.ju(this.Aa)}Ae(){const t=Xe([this.getPosition(u(-1,-1),e.UISpace.Content),this.getPosition(u(1,1),e.UISpace.Content)].map((t=>at(t,this.scale,this.renderingScale)))),i={x:t.max.x-t.min.x,y:t.max.y-t.min.y};return this.Aa.q(i).we(at(this.getPosition(u(-1,-1),e.UISpace.Content),this.scale,this.renderingScale)),this}hc(t){return this.setContentSize(t),this.As.Ss(),this}rc(){return 0}nc(){return 0}ac(){return 0}oc(){return 0}}class zn extends Fn{constructor(t,e,i,s,r){super(t,e,i,s,r),this.Pc=u(0,0),this.setSize=this.fitTo.bind(this),this.Aa=t.Dc(e).Nl(0).Be(360).Me(this.Se).ve(this.getStrokeStyle()),this.ju(this.Aa)}Ae(){const t=this.getSize(e.UISpace.Content).x/2;return this.Aa.Wl(t*this.renderingScale.Ai().x).Hl(t*this.renderingScale.Ai().y).we(at(this.getPosition(u(0,0),e.UISpace.Content),this.scale,this.renderingScale)).$l(255).Ts(),this}hc(t){const e=Math.sqrt(t.x*t.x/4+t.y*t.y/4);return this.setContentSize(u(2*e,2*e)),this.Pc=t,this.As.Ss(),this}rc(){return(this.getSize(e.UISpace.Content).x-this.Pc.x)/2}nc(){return(this.getSize(e.UISpace.Content).x-this.Pc.x)/2}ac(){return(this.getSize(e.UISpace.Content).y-this.Pc.y)/2}oc(){return(this.getSize(e.UISpace.Content).y-this.Pc.y)/2}fitTo(t){const e=Math.min(t.x,t.y);return this.setContentSize(u(e,e)),this.Pc=t,this}}class On extends Bn{constructor(t,e,i,s,r){super(t,e,i,sn.Simple,s,r),this.Bc=m(u(0,0)),this.Oc=!1,this.setSize=this.fitTo.bind(this),this.As=t,this.Tc()}Fc(){const t=this.Bc.M();if(this.Oc){const e=Math.min(t.x,t.y);return[u(0,0),u(e/2,e/2),u(0,e),u(-e/2,e/2)]}const e=2*Math.sqrt(this.Bc.M().x*this.Bc.M().x/4+this.Bc.M().y*this.Bc.M().y/4),i=u(Math.cos(Math.PI/4)*e,0),s=u(0,Math.sin(Math.PI/4)*e),r=u(0,0),n=ri(r,ri(i,s)),o=ri(n,ri(s,si(i,-1)));return[r,n,o,ni(o,ri(i,s))]}hc(t){return this.Bc.S(t),this.Oc=!1,this.As.Ss(),this}rc(){return this.Oc?0:(this.getSize(e.UISpace.Content).x-this.Bc.M().x)/2}nc(){return this.Oc?0:(this.getSize(e.UISpace.Content).x-this.Bc.M().x)/2}ac(){return this.Oc?0:(this.getSize(e.UISpace.Content).y-this.Bc.M().y)/2}oc(){return this.Oc?0:(this.getSize(e.UISpace.Content).y-this.Bc.M().y)/2}fitTo(t){return this.Bc.S(t),this.Oc=!0,this.As.Ss(),this}}class Rn extends Bn{constructor(t,i,s,r,n){super(t,i,s,sn.Simple,r,n),this.Lc=m(u(0,0)),this.Rc=m(10),this.Ec=m(void 0),this.gc=m(e.UIDirections.Right),this.Tc()}setDirection(t){return this.gc.S(t),this.As.Ss(),this}getDirection(){return this.gc.M()}setPointerLength(t){return this.Rc.S(t),this.As.Ss(),this}getPointerLength(){return this.Rc.M()}setPointerAngle(t){return this.Ec.S(t),this.As.Ss(),this}getPointerAngle(){let t=this.Ec.M();if(void 0===t){const e=this.zc();if(0===e)return 0;t=0!==e?180*Math.atan(2*this.getPointerLength()/e)/Math.PI:0}return Math.min(Math.max(t,1),89)}hc(t){return this.Lc.S(t),this.As.Ss(),this}Vc(){const t=this.getPointerAngle();return 0===t?0:2*this.getPointerLength()/Math.tan(t*Math.PI/180)}Nc(){return Zt(this.gc.M())?this.Lc.M().x:this.Lc.M().y}zc(){return Zt(this.gc.M())?this.Lc.M().y:this.Lc.M().x}rc(){switch(this.gc.M()){case e.UIDirections.Right:return 0;case e.UIDirections.Left:return this.getPointerLength();case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Vc()-this.zc());default:return 0}}nc(){switch(this.gc.M()){case e.UIDirections.Right:return this.getPointerLength();case e.UIDirections.Left:return 0;case e.UIDirections.Up:case e.UIDirections.Down:return Math.max(0,this.Vc()-this.zc());default:return 0}}ac(){switch(this.gc.M()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Vc()-this.zc());case e.UIDirections.Up:return this.getPointerLength();case e.UIDirections.Down:default:return 0}}oc(){switch(this.gc.M()){case e.UIDirections.Right:case e.UIDirections.Left:return Math.max(0,this.Vc()-this.zc());case e.UIDirections.Up:return 0;case e.UIDirections.Down:return this.getPointerLength();default:return 0}}Fc(){const t=qt(this.gc.M()),e=ei(u(0,0),t),i=this.getPointerLength(),s=this.Vc(),r=this.Nc(),n=this.zc();if(!(0!==i&&0!==s||0!==r&&0!==n))return[];const o=u(0,0),h=ri(ri(o,si(t,-i)),si(e,s/2)),a=ri(h,si(e,(n-s)/2)),l=ri(a,si(t,-r)),c=ri(ri(o,si(t,-i)),si(e,-s/2)),d=ri(c,si(e,-(n-s)/2)),f=ri(d,si(t,-r));let g;return g=0===r||0===n?[o,h,c]:0===i||0===s?[a,l,f,d]:It(n,s)?[o,h,l,f,c]:[o,h,a,l,f,d,c],g}}class Vn extends In{setSize(t){return this.setContentSize(t),this.As.Ss(),this}}class Nn extends pn{constructor(){super(...arguments),this.Gc=[],this.Wc=0,this.Hc=t=>{const e=this.Gc.indexOf(t);e>=0&&this.Gc.splice(e,1)}}getMembers(){return this.Gc}getMemberCount(){return this.Gc.length}setMinimumSize(t){return this.Uc=t,this.As.Ss(),this}getMinimumSize(){return this.Uc}addElement(t,e=-1){const i=t.vc(this.As,this.renderingScale,this.scale,this.Hc,this.Ji,!1);return i.setMouseInteractions(this.getMouseInteractions()),e>=0?this.Gc.splice(e,0,i):this.Gc.push(i),i.setVisible(this.getVisible()),this.ju(i),this.Ti&&(me(0,(()=>{})),i.dispose()),i}dispose(){return super.dispose(),this.Gc.slice().forEach(Tt),this}setVisible(t){return super.setVisible(t),this.Gc.forEach((e=>e.setVisible(t))),this}setMouseInteractions(t){super.setMouseInteractions(t);for(let e=0;et+ +(e instanceof Vn)),0),s=i>0?(this.size.x-this.Wc)/i:0;return this.Gc.reduce(((e,i)=>i instanceof Vn?this.scale.Jt({x:e,y:t.y},{x:s+i.getSize().x,y:0}).x:i.setOrigin(u(-1,1)).setPosition(u(e,t.y)).Ae().getPosition(u(1,0)).x),t.x),this}Ts(){for(let t=0;tt+ +(e instanceof Vn)),0),s=i>0?(this.size.y-this.Wc)/i:0;return this.Gc.reduce(((e,i)=>i instanceof Vn?this.scale.Jt({x:t.x,y:e},{x:0,y:-(s+i.getSize().y)}).y:i.setOrigin(u(-1,1)).setPosition(u(t.x,e)).Ae().getPosition(u(0,-1)).y),t.y),this}Ts(){for(let t=0;t{const i={},s=`stylable${t}s`;return i[s]=e,i[`set${t}FillStyle`]=function(t){return this[s].forEach((e=>e.setFillStyle(t))),this},i[`get${t}FillStyle`]=function(){return this[s][0].getFillStyle()},i[`set${t}Font`]=function(t){return this[s].forEach((e=>e.setFont(t))),this},i[`get${t}Font`]=function(){return this[s][0].getFont()},i[`set${t}Rotation`]=function(t){return this[s].forEach((e=>e.setTextRotation(t))),this},i[`get${t}Rotation`]=function(){return this[s][0].getTextRotation()},i},qn=$n("Text",[]),Zn={button:void 0,isLocked:!1,setOn(t){if(!this.isLocked){const e=this.button.getOn()!==t;this.button.setOn(t),e&&this.P.emit("switch",t)}return this},getOn(){return this.button.getOn()},setLocked(t){return this.isLocked=t,this},getLocked(){return this.isLocked},onSwitch(t){return this.P.on("switch",(e=>t(this,e)))},offSwitch(t){return this.P.off(t,"switch")},setButtonOffFillStyle(t){return this.button.setOffFillStyle(t),this},getButtonOffFillStyle(){return this.button.getOffFillStyle()},setButtonOffStrokeStyle(t){return this.button.setOffStrokeStyle(t),this},getButtonOffStrokeStyle(){return this.button.getOffStrokeStyle()},setButtonOffSize(t){return this.button.setOffSize(t),this},getButtonOffSize(){return this.button.getOffSize()},setButtonOnFillStyle(t){return this.button.setOnFillStyle(t),this},getButtonOnFillStyle(){return this.button.getOnFillStyle()},setButtonOnStrokeStyle(t){return this.button.setOnStrokeStyle(t),this},getButtonOnStrokeStyle(){return this.button.getOnStrokeStyle()},setButtonOnSize(t){return this.button.setOnSize(t),this},getButtonOnSize(){return this.button.getOnSize()}},Kn={pointable:void 0,setDirection(t){return this.pointable.setDirection(t),this},getDirection(){return this.pointable.getDirection()},setPointerLength(t){return this.pointable.setPointerLength(t),this},getPointerLength(){return this.pointable.getPointerLength()}},Qn={...An,...wn,background:Dn,vc(t,e,i,s,r,n){const o=new Gn(t,e,i,this.background,s,r),h=o.addElement(Ln,void 0),a=Object.assign(o,Jn,{setTextLabel:h},qn,{stylableTexts:[h]});return Mn(a,r,n),this.applyStylers(a,r)}}.addStyler(bn),to={...An,...wn,background:Rn,vc(t,i,s,r,n,o){const h=new Gn(t,i,s,this.background,r,n),a=h.addElement(Ln,void 0),l=h.getBackground(),u=Object.assign(h,Jn,{setTextLabel:a},qn,{stylableTexts:[a]},Kn,{pointable:l},{setTickLabelPadding(t){return this.getDirection()===e.UIDirections.Up?this.setPadding({top:t}):this.getDirection()===e.UIDirections.Down?this.setPadding({bottom:t}):this.getDirection()===e.UIDirections.Right?this.setPadding({right:t}):this.getDirection()===e.UIDirections.Left&&this.setPadding({left:t}),this},getTickLabelPadding(){return this.getDirection()===e.UIDirections.Up?this.getPadding().top:this.getDirection()===e.UIDirections.Down?this.getPadding().bottom:this.getDirection()===e.UIDirections.Right?this.getPadding().right:this.getPadding().left}});return u.Mc="other",u.setPointerLength(n.xAxisNumericTicks.majorTickStyle.getTickLength()).setTickLabelPadding(n.xAxisNumericTicks.majorTickStyle.getTickPadding()).setTextFont(n.uiTextFont).setTextFillStyle(n.uiTextFillStyle).setBackground((t=>t.setFillStyle(n.uiBackgroundFillStyle).setStrokeStyle(n.uiBackgroundStrokeStyle))),Mn(u,n,o),this.applyStylers(u,n)}};class eo extends yn{constructor(t,e,i,s,n,o,h){super(t,e,i,o,h),this.Fs=!1,this.P=new r.Eventer,this.getOn=()=>this.Fs,this.jc=this.ju(new s(this.As,this.renderingScale,this.scale,Et,h)),this.Yc=this.ju(new n(this.As,this.renderingScale,this.scale,Et,h))}tc(){return[...this.jc.tc(),...this.Yc.tc()]}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}setOn(t){return this.Fs=t,this.As.Ss(),this}setOffFillStyle(t){return this.jc.setFillStyle(t),this}getOffFillStyle(){return this.jc.getFillStyle()}setOffStrokeStyle(t){return this.jc.setStrokeStyle(t),this}getOffStrokeStyle(){return this.jc.getStrokeStyle()}setOffSize(t){return this.jc.fitTo("number"==typeof t?u(t,t):t),this}getOffSize(){return this.jc.getSize()}setOnFillStyle(t){return this.Yc.setFillStyle(t),this}getOnFillStyle(){return this.Yc.getFillStyle()}setOnStrokeStyle(t){return this.Yc.setStrokeStyle(t),this}getOnStrokeStyle(){return this.Yc.getStrokeStyle()}setOnSize(t){return this.Yc.fitTo("number"==typeof t?u(t,t):t),this}getOnSize(){return this.Yc.getSize()}Ae(){return super.Ae(),this.Fs?(this.jc.setVisible(!1),this.Yc.setVisible(this.getVisible()).setPosition(this.getPosition(u(0,0),e.UISpace.Content)).Ae()):(this.jc.setVisible(this.getVisible()).setPosition(this.getPosition(u(0,0),e.UISpace.Content)).Ae(),this.Yc.setVisible(!1)),this}Ts(){const t=this.jc.Ts().getSize(),e=this.Yc.Ts().getSize();return this.setContentSize(u(Math.max(t.x,e.x),Math.max(t.y,e.y))),super.Ts()}dispose(){return super.dispose(),this.jc.dispose(),this.Yc.dispose(),this}setMouseInteractions(t){return this.Yc.setMouseInteractions(t),this.jc.setMouseInteractions(t),this}getMouseInteractions(){return this.Yc.getMouseInteractions()}setHighlight(t){const e=ve(t);return this.Yc.setHighlight(e),this.jc.setHighlight(e),this.P.emit("highlight",t),this.As.Ss(),this}getHighlight(){return this.Yc.getHighlight()}}const io={...An,uiElement:eo,pictureOff:zn,pictureOn:zn,setPictureOff(t){return{...this,pictureOff:t}},setPictureOn(t){return{...this,pictureOn:t}},vc(t,e,i,s,r,n){const o=this.applyStylers(new this.uiElement(t,e,i,this.pictureOff,this.pictureOn,s,r),r);return Mn(o,r,n),o}},so={...An,...wn,background:Dn,buttonBuilder:io,setPictureOff(t){return{...this,buttonBuilder:this.buttonBuilder.setPictureOff(t)}},setPictureOn(t){return{...this,buttonBuilder:this.buttonBuilder.setPictureOn(t)}},vc(t,i,s,r,n,o){const h=new Gn(t,i,s,this.background,r,n),a=h.addElement(Yn);a.addGap();const l=a.addElement(this.buttonBuilder);a.addGap();const u=h.addElement(Yn);u.addGap();const c=u.addElement(Ln);u.addGap(),h.addGap();const d=Object.assign(h,Jn,{setTextLabel:c},qn,{stylableTexts:[c]},Zn,{button:l});return d.onMouseClick(((t,e)=>{d.setOn(!d.getOn())})),d.onMouseEnter((()=>d.setHighlight(!0))),d.onMouseLeave((()=>d.setHighlight(!1))),d.setMouseStyle(e.MouseStyles.Point),d.setPadding({left:6}),Mn(d,n,o),this.applyStylers(d,n)}}.addStyler(bn).addStyler(vn);class ro extends yn{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.Xc=[],this.Zc=2,this.Kc="",this.qc=(t,e)=>void 0!==t.label?t.label:Ii(t.value,e.min,e.max),this.Jc=0,this.Qc=0,this.td=!1,this.As=t,this.sd=n,this.ed=this.ju(t._e(e).ve(st)),this.hd=this.ju(t.Sr(e).Me(r.uiTextFillStyle).Ih(r.uiTextFont).setMouseInteractions(!1)),"vertical"===n?(this.rd=140,this.nd=25):(this.rd=160,this.nd=15)}tc(){return[this.ed,this.hd]}od(t){this.ad=t;const e=ho(t,"vertical"===this.sd?0:90,this.td);return this.ed.Me(e),this.As.Ss(),this}ld(){return this.ad}ud(t){return this.rd=t,this.As.Ss(),this}dd(){return this.rd}fd(t){return this.nd=t,this.As.Ss(),this}gd(){return this.nd}pd(t){return this.Kc=t,this.As.Ss(),this}md(){return this.Kc}yd(t){return this.qc=t,this.As.Ss(),this}setLUTDisplayProportionalSteps(t){if(this.td=t,this.ad){const t=ho(this.ad,"vertical"===this.sd?0:90,this.td);this.ed.Me(t)}return this.As.Ss(),this}getLUTDisplayProportionalSteps(){return this.td}setFillStyle(t){return this.hd.Me(t),this.As.Ss(),this}getFillStyle(){return this.hd.Th()}setFont(t){return this.hd.Ih(t),this.As.Ss(),this}getFont(){return this.hd.Fh()}setTextRotation(t){return this.Qc=t,this.hd.Ph(t),this.As.Ss(),this}getTextRotation(){return this.hd.Dh()}Ae(){var t,i,s,r;if(super.Ae(),this.Ti)return this;const n=this.ad;if(n){const o=this.renderingScale.Ai(),h=n.min,a=n.max;if("vertical"===this.sd){const s=this.getPosition({x:-1,y:-1},e.UISpace.Content),r=ri(s,{x:this.ed.Ht().x+this.Zc*o.x,y:0}),l={x:r.x,y:r.y+(this.Kc.length>0?this.Jc*o.y+this.hd.Ht().y:0)+.5*((null===(t=this.Xc[0])||void 0===t?void 0:t.Ht().y)||0)},u={x:l.x,y:this.getPosition({x:-1,y:1},e.UISpace.Content).y-.5*((null===(i=this.Xc[this.Xc.length-1])||void 0===i?void 0:i.Ht().y)||0)};this.ed.we({x:s.x,y:l.y}),this.hd.Sa({x:-1,y:-1}).we(r),n.getSteps().forEach(((t,e)=>{const i=Ue(l,u,this.td?!0===n.getInterpolation()?(t.value-h)/(a-h):.9*(t.value-h)/(a-h):!0===n.getInterpolation()?e/(n.getSteps().length-1):e/n.getSteps().length);this.Xc[e].Sa({x:-1,y:0}).we(i)}))}else{const t=this.getPosition({x:-1,y:-1},e.UISpace.Content),i=this.getPosition({x:1,y:1},e.UISpace.Content),l=this.Xc.reduce(((t,e)=>Math.max(t,e.Ht().y)),0),u=ri(t,{x:.5*((null===(s=this.Xc[0])||void 0===s?void 0:s.Ht().x)||0),y:l}),c={x:i.x,y:u.y},d={x:c.x-(.5*((null===(r=this.Xc[this.Xc.length-1])||void 0===r?void 0:r.Ht().x)||0)+(this.Kc.length>0?this.Jc*o.x+this.hd.Ht().x:0)),y:u.y},f={x:u.x,y:u.y+this.Zc*o.y};this.ed.we(f),this.hd.Sa({x:1,y:1}).we(c),n.getSteps().forEach(((t,e)=>{const i=Ue(u,d,this.td?!0===n.getInterpolation()?(t.value-h)/(a-h):.9*(t.value-h)/(a-h):!0===n.getInterpolation()?e/(n.getSteps().length-1):e/n.getSteps().length);this.Xc[e].Sa({x:0,y:1}).we(i)}))}}return this}Ts(){if(this.ad&&this.getVisible()){const t=this.ad.getSteps();for(let e=this.Xc.length;eMath.max(t,e.Ts().Ic().x)),0),this.hd.Ts().Ic().x),s=(this.Kc.length>0?this.Jc+this.hd.Ts().Ic().y:0)+e+.5*this.Xc[0].Ts().Ic().y+.5*this.Xc[this.Xc.length-1].Ts().Ic().y;this.setContentSize({x:i,y:s})}else{const t=this.rd,e=this.nd;this.ed.q({x:t*this.renderingScale.x.getPixelSize(),y:e*this.renderingScale.y.getPixelSize()});const i=Math.max(this.Kc.length>0?this.Jc+this.hd.Ts().Ic().x:0,.5*this.Xc[this.Xc.length-1].Ts().Ic().x),s=t+.5*this.Xc[0].Ts().Ic().x+i,r=e+this.Zc+this.Xc.reduce(((t,e)=>Math.max(t,e.Ts().Ic().y)),0);this.setContentSize({x:s,y:r})}}else this.Xc.forEach((t=>t.dispose())),this.Xc.length=0,this.hd.setVisible(!1),this.ed.setVisible(!1),this.setContentSize({x:0,y:0});return super.Ts()}dispose(){return super.dispose(),this.ed.dispose(),this.Xc.forEach(Tt),this.hd.dispose(),this}setMouseInteractions(t){return this.ed.setMouseInteractions(t),this}getMouseInteractions(){return this.ed.getMouseInteractions()}}const no={lutElement:{},setLUT(t){return this.lutElement.od(t),this},getLUT(){return this.lutElement.ld()},setLUTLength(t){return this.lutElement.ud(t),this},getLUTLength(){return this.lutElement.dd()},setLUTThickness(t){return this.lutElement.fd(t),this},getLUTThickness(){return this.lutElement.gd()},setLookUpUnit(t){return this.lutElement.pd(t),this},getLookUpUnit(){return this.lutElement.md()},setLUTStepValueFormatter(t){return this.lutElement.yd(t),this},setLUTDisplayProportionalSteps(t){return this.lutElement.setLUTDisplayProportionalSteps(t),this},getLUTDisplayProportionalSteps(){return this.lutElement.getLUTDisplayProportionalSteps()}},oo={...An,...wn,background:Dn,alignment:"horizontal",setAlignment(t){return{...this,alignment:t}},vc(t,e,i,s,r,n){const o=new Hn(t,e,i,this.background,s,r),h=o.addElement({vc:()=>new ro(t,e,i,Et,r,this.alignment)}),a=Object.assign(o,qn,{stylableTexts:[h]},no,{lutElement:h});return Mn(a,r,n),this.applyStylers(a,r)}}.addStyler(bn),ho=(t,e,i)=>{const s=t.getSteps(),r=t.min,n=t.max-r;if(!0===t.getInterpolation())return new tt({angle:e,stops:s.map(((e,o)=>({offset:i?(e.value-r)/n:o/(s.length-1),color:e.color||t.color})))});const o=[];for(let e=0;enew ro(t,i,s,Et,n,this.alignment)});"vertical"===this.alignment&&d.setMargin({left:n.uiButtonSize+6});const f=Object.assign(o,Jn,{setTextLabel:c},qn,{stylableTexts:[c,d]},$n("LUTText",[d]),Zn,{button:l},no,{lutElement:d});return f.onMouseClick((()=>{f.setOn(!f.getOn())})),f.onMouseEnter((()=>f.setHighlight(!0))),f.onMouseLeave((()=>f.setHighlight(!1))),f.setMouseStyle(e.MouseStyles.Point),f.setPadding({left:6}),this.applyStylers(f,n)}}.addStyler(bn).addStyler(vn),lo={alignment:null,title:null,entryStylers:null,legendBoxDisposed:null,entries:[],add(t,e){const i=!e||"object"!=typeof e||void 0===e.toggleVisibilityOnClick||e.toggleVisibilityOnClick,s=e&&"object"==typeof e&&void 0!==e.builder?e.builder:void 0;return this.legendBoxDisposed()||(t instanceof Vh?this.addChart(t,i,s):"attach"in t?this.addAttachable(t,i,s):t&&this.addDashboard(t,i,s)),this},addAttachable(t,e,i){const s=t.ld&&t.ld();let r=i;r||(r=s?ao.setAlignment(this.alignment):so);const n=this.addElement(r);if(s&&"setLUT"in n){n.setLUT(s.lut);const t=s.lut.getUnits(),e=s.lookUpProperty,i=t.length>0?t:"x"===e?"x":"y"===e?"y":"z"===e?"z":"";n.setLookUpUnit(i)}return this.entryStylers.forEach((t=>t(n))),this.entries.push({entry:n,component:t}),t.attach(n,e),this},addChart(t,e,i){return t.Sd().forEach((t=>this.addAttachable(t,e,i))),this},addDashboard(t,e,i){return t.getCells().filter((t=>t.panel instanceof Vh)).forEach((t=>this.addChart(t.panel,e,i))),this},setTitle(t){return this.title.setText(t),this},getTitle(){return this.title.getText()},setTitleFillStyle(t){return this.title.setTextFillStyle(t),this},getTitleFillStyle(){return this.title.getTextFillStyle()},setTitleFont(t){return this.title.setTextFont(t),this},getTitleFont(){return this.title.getTextFont()},setTitleRotation(t){return this.title.setTextRotation(t),this},getTitleRotation(){return this.title.getTextRotation()},setEntries(t){return this.entries.forEach((e=>t(e.entry,e.component))),this}},uo={alignment:"vertical",layoutBuilder:Yn,setAlignment(t){return{...this,alignment:t,layoutBuilder:"horizontal"===t?jn:Yn}},getAlignment(){return this.alignment},titleBuilder:Qn,styleTitle(t){return{...this,titleBuilder:this.titleBuilder.addStyler(t)}},entryStylers:[],styleEntries(t){return{...this,entryStylers:[...this.entryStylers,t]}}},co={...An,...wn,...uo,background:Dn,vc(t,e,i,s,r,n){const o=this.layoutBuilder.setBackground(this.background).vc(t,e,i,s,r,!1);let h=Object.assign(o,lo,{alignment:this.alignment,entryStylers:this.entryStylers,legendBoxDisposed:()=>o.Ti});h.entries=[];const a=h.addElement("horizontal"===this.alignment?Yn:jn),l=a.addElement(this.titleBuilder).setText("Legend").setTextFillStyle(r.legendTitleFillStyle).setTextFont(r.legendTitleFont);return a.addGap(),h=Object.assign(h,{title:l}),"horizontal"===this.alignment&&l.setMargin({right:6}),Mn(h,r,n),this.applyStylers(h,r)}}.addStyler(((t,e)=>t.setPadding(5)));class fo extends yn{constructor(t,i,s,r,n){super(t,i,s,r,n),this.xd=10,this.bd=e.UIDirections.Up,this.vd=0,this.Mc="major",this.$o=this.ju(t.Sr(this.renderingScale)),this.Ie=this.ju(t.De(this.renderingScale))}tc(){return[this.$o]}Ae(){if(super.Ae(),this.Ti)return this;const t=at(this.getPosition(),this.scale,this.renderingScale),i=this.renderingScale.Jt(t,{x:this.bd===e.UIDirections.Right?-this.xd:this.bd===e.UIDirections.Left?this.xd:0,y:this.bd===e.UIDirections.Up?-this.xd:this.bd===e.UIDirections.Down?this.xd:0}),s=this.renderingScale.Jt(i,{x:this.bd===e.UIDirections.Right?-this.vd:this.bd===e.UIDirections.Left?this.vd:0,y:this.bd===e.UIDirections.Up?-this.vd:this.bd===e.UIDirections.Down?this.vd:0});return this.Ie.Oe(t).Be(i),this.$o.we(s).Sa(this.bd===e.UIDirections.Up?{x:0,y:1}:this.bd===e.UIDirections.Down?{x:0,y:-1}:this.bd===e.UIDirections.Right?{x:1,y:0}:{x:-1,y:0}),this}Ts(){const t=this.Ie.Yl().getThickness();return this.size=this.bd===e.UIDirections.Left||this.bd===e.UIDirections.Right?{x:this.xd+this.vd+this.$o.Ts().Ic().x,y:t}:{y:this.xd+this.vd+this.$o.Ts().Ic().y,x:t},super.Ts()}dispose(){return super.dispose(),this.$o.dispose(),this.Ie.dispose(),this}setVisible(t){return super.setVisible(t),this.$o.setVisible(t),this.Ie.setVisible(t),this}setMouseInteractions(t){return this.$o.setMouseInteractions(t),this.Ie.setMouseInteractions(t),this}getMouseInteractions(){return this.$o.getMouseInteractions()}getText(){return this.$o.wh()}setTextFillStyle(t){return this.$o.Me(t),this.As.Ss(),this}getTextFillStyle(){return this.$o.Th()}setTextFont(t){return this.$o.Ih(t),this}setTextRotation(t){return this.$o.Ph(t),this}getTextRotation(){return this.$o.Dh()}getTextFont(){return this.$o.Fh()}setText(t){return this.$o.Ch(t),this.As.Ss(),this}setDirection(t){return this.bd=t,this.As.Ss(),this}getDirection(){return this.bd}setPointerLength(t){return this.xd=t,this.As.Ss(),this}getPointerLength(){return this.xd}setTickLabelPadding(t){return this.vd=t,this.As.Ss(),this}getTickLabelPadding(){return this.vd}setTickStyle(t){return this.Ie.Pe(t),this.As.Ss(),this}getTickStyle(){return this.Ie.Yl()}}const go={...An,vc(t,e,i,s,r,n){const o=new fo(t,e,i,s,r);return Mn(o,r,n),this.applyStylers(o,r)}}.addStyler(bn),yo=go.addStyler(((t,e)=>(t.Mc="major",t.setPointerLength(e.xAxisNumericTicks.majorTickStyle.tickLength).setTickLabelPadding(e.xAxisNumericTicks.majorTickStyle.tickPadding).setTickStyle(e.xAxisNumericTicks.majorTickStyle.tickStyle).setTextFont(e.xAxisNumericTicks.majorTickStyle.labelFont).setTextFillStyle(e.xAxisNumericTicks.majorTickStyle.labelFillStyle)))),po=go.addStyler(((t,e)=>(t.Mc="minor",t.setPointerLength(e.xAxisNumericTicks.minorTickStyle.tickLength).setTickLabelPadding(e.xAxisNumericTicks.minorTickStyle.tickPadding).setTickStyle(e.xAxisNumericTicks.minorTickStyle.tickStyle).setTextFont(e.xAxisNumericTicks.minorTickStyle.labelFont).setTextFillStyle(e.xAxisNumericTicks.minorTickStyle.labelFillStyle)))),mo=so.addStyler((t=>t.onSwitch(((e,i)=>!0===i?setTimeout((()=>t.setOn(!1)),300):void 0)))),So=co.setAlignment("horizontal"),xo=co.setAlignment("vertical"),bo={TextBox:Qn,CheckBox:so,ButtonBox:mo,PointableTextBox:to,AxisTickMajor:yo,AxisTickMinor:po,LUTRange:oo},vo={HorizontalLegendBox:So,VerticalLegendBox:xo},Mo=(t,e,i)=>t*(1-i)+e*i,Ao=(t,e,i,s,r)=>{if(void 0===e.value||void 0===i.value||void 0===s.value||void 0===r.value)return;const n=(t.x-i.point.x)/(r.point.x-i.point.x),o=(r.point.y-i.point.y)*n+i.point.y,h=(t.x-e.point.x)/(s.point.x-e.point.x),a=(s.point.y-e.point.y)*h+e.point.y,l=(t.y-a)/(o-a),u=Mo(i.value,r.value,n),c=Mo(e.value,s.value,h);return Mo(c,u,l)},wo={warm:t=>e=>E(60/(t-1)*e,.8,.8),cold:t=>e=>E(60/(t-1)*e+180,.8,.8),fullSpectrum:t=>e=>E(360/t*e,.8,.8),reverseSpectrum:t=>e=>E(360/t*(t-e),.8,.8),flatUI:t=>e=>E(360/t*e+8,.8,.8-.15/t*e),arction:t=>e=>{const i=1-.2/t*e;return E(360/t*e+51,i,i)},arctionWarm:t=>e=>{const i=t-1,s=1-.2/i*e;return E(46-46/i*e+4,s,s)},sunset:t=>e=>{const i=[170,320];return E(e%2?i[0]:i[1],.8,.5+.5/(t-1)*e)},dynamic:t=>e=>{const i=e%2,s=[234,346];return E(i?s[0]:s[1],i?.3:.9,.5+.5/(t-1)*e)},magenta:t=>e=>{const i=[.9,.6];return E(354,e%2?i[0]:i[1],.5+.5/(t-1)*e)},greyscale:t=>e=>E(0,0,.25+.5/(t-1)*e),frozen:t=>e=>{const i=[.8,.6];return E(160+80/(t-1)*e,.6,e%2?i[0]:i[1])},retro:t=>e=>{const i=[6,183];return E(e%2?i[0]:i[1],.7,.5+.5/(t-1)*e)},crayons:t=>e=>{let i=180+230/(t-1)*e;return i>360&&(i-=360),E(i,.9,.8)},custom:(t,e)=>i=>{const s=.25+.5/(t-1)*i;if(!e)return E(0,0,s);const r=e.getR()/255,n=e.getG()/255,o=e.getB()/255,h=Math.max(r,n,o),a=Math.min(r,n,o);let l=0;if(h!==a){const t=h-a;switch(h){case r:l=(n-o)/t+(nr=>n=>E(t+(e-t)/r*n,i,s),auroraBorealis:t=>e=>To([{value:0,hex:"#23FF7A"},{value:1/9,hex:"#03E65D"},{value:2/9,hex:"#04D155"},{value:3/9,hex:"#00B849"},{value:4/9,hex:"#00A869"},{value:5/9,hex:"#008F68"},{value:6/9,hex:"#00815E"},{value:7/9,hex:"#017153"},{value:8/9,hex:"#704A85"},{value:1,hex:"#743A70"}],t,e),blueSciFi:t=>e=>To([{value:0,hex:"#FFFFFF"},{value:1/9,hex:"#E2E7FF"},{value:2/9,hex:"#ACB9F8"},{value:3/9,hex:"#889DFF"},{value:4/9,hex:"#547EEF"},{value:5/9,hex:"#4068D8"},{value:6/9,hex:"#2B50B7"},{value:7/9,hex:"#1B3E9F"},{value:8/9,hex:"#8D1395"},{value:1,hex:"#780A74"}],t,e),light:t=>e=>To([{value:0,hex:"#FECC00"},{value:1/9,hex:"#F7B300"},{value:2/9,hex:"#EF9900"},{value:3/9,hex:"#E88000"},{value:4/9,hex:"#E06600"},{value:5/9,hex:"#DD5A00"},{value:6/9,hex:"#D94D00"},{value:7/9,hex:"#D13300"},{value:8/9,hex:"#C91A00"},{value:1,hex:"#C10000"}],t,e),monochrome:t=>e=>To([{value:0,hex:"#FFFFFF"},{value:1/9,hex:"#EEEEEE"},{value:2/9,hex:"#DCDCDC"},{value:3/9,hex:"#C1C1C1"},{value:4/9,hex:"#A4A2A2"},{value:5/9,hex:"#8B8B8B"},{value:6/9,hex:"#787878"},{value:7/9,hex:"#656565"},{value:8/9,hex:"#565555"},{value:1,hex:"#434343"}],t,e),night:t=>e=>To([{value:0,hex:"#F0F9E0"},{value:1/9,hex:"#C9DFA4"},{value:2/9,hex:"#B5C796"},{value:3/9,hex:"#8998B7"},{value:4/9,hex:"#6E7E9E"},{value:5/9,hex:"#5C6D8F"},{value:6/9,hex:"#47587A"},{value:7/9,hex:"#374B72"},{value:8/9,hex:"#273C65"},{value:1,hex:"#192847"}],t,e),sunset2:t=>e=>To([{value:0,hex:"#22334D"},{value:1/9,hex:"#82062C"},{value:2/9,hex:"#AB001D"},{value:3/9,hex:"#D80428"},{value:4/9,hex:"#CF5D1B"},{value:5/9,hex:"#CF8229"},{value:6/9,hex:"#CF9D29"},{value:7/9,hex:"#C4BE25"},{value:8/9,hex:"#E1DC49"},{value:1,hex:"#FFFA67"}],t,e)},To=(t,e,i)=>{const s=Io(e,i),[r,n]=Co(s,t),o=Eo(t[r]),h=Eo(t[n]),a=0!==o.value?(h.value-s)/o.value:0,l={value:a,h:Mo(o.h,h.h,a),s:Mo(o.s,h.s,a),v:Mo(o.v,h.v,a)};return E(l.h,l.s,l.v)},Eo=t=>{const e=(t=>{const e=t.r,i=t.g,s=t.b,r=Math.max(e,i,s),n=Math.min(e,i,s);let o=0;const h=r,a=r-n,l=0===r?0:a/r;if(r===n)o=0;else{switch(r){case e:o=(i-s)/a+(i{const i=e/t;return i<0?0:i>1?1:i},Co=(t,e)=>{if(e.length<2)throw new Error("Invalid palette size");for(let i=0;i!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"image"===t.fillType),Ro={Dotted:[1,3],DottedDense:[1,1],Dashed:[3,1],DashedEqual:[2,2],DashedLoose:[2,4],DashDotted:[3,2,1,2]},Vo=s.Record({type:"linestyle",lineType:"dashed",pattern:Ro.DashedEqual,fillStyle:new V({color:w(255,255,255)}),thickness:1,patternScale:3}),No=t=>!(!t||"object"!=typeof t||!("lineType"in t)||"dashed"!==t.lineType),Go=s.Record({type:"icon",width:void 0,height:void 0,Md:void 0,_d:Et,Ad:Et});class Ho extends Go{constructor(t,e,i,s){super({...s,Md:t,_d:e,Ad:i})}dispose(){return this.Ad(this),this}setWidth(t){const e=this.set("width",t);return this._d(e),e}getWidth(){return this.get("width")}setHeight(t){const e=this.set("height",t);return this._d(e),e}getHeight(){return this.get("height")}setSize(t,e){const i=this.withMutations((i=>{i.set("width",t).set("height",e)}));return this._d(i),i}Ht(){if(!this.Md)return{x:0,y:0};const t=this.Md.width,e=this.Md.height,i=this.width,s=this.height;return"number"==typeof i&&"number"==typeof s?{x:i,y:s}:"number"==typeof i?{x:i,y:e*i/t}:"number"==typeof s?{x:t*s/e,y:s}:{x:t,y:e}}}const Uo=t=>!(!t||"object"!=typeof t||!("type"in t)||"icon"!==t.type),Wo=s.Record({type:"glow",color:w(255,255,255,50),spread:1,blur:4,offset:{x:0,y:0}});class Xo extends Wo{constructor(t){super(t)}setSpread(t){return this.set("spread","function"==typeof t?t(this.get("spread")):t)}getSpread(){return this.get("spread")}setBlur(t){return this.set("blur","function"==typeof t?t(this.get("blur")):t)}getBlur(){return this.get("blur")}setColor(t){return this.set("color","function"==typeof t?t(this.get("color")):t)}getColor(){return this.get("color")}setOffset(t){return this.set("offset","function"==typeof t?t(this.get("offset")):t)}getOffset(){return this.get("offset")}}const Yo=(t,e)=>{if(Oi(t)){const i=e.do(t);return{x:i.engineX,y:i.engineY}}return t},jo=t=>{let e=!1,i={type:"linear"};if(t&&(void 0!==t.opposite&&(e=t.opposite),t.type&&"linear-highPrecision"===t.type&&(i={type:"linear-highPrecision"}),t.type&&"logarithmic"===t.type)){let s=10;if(t.base)if("E"===t.base||"e"===t.base||"natural"===t.base)s="e";else if("number"==typeof t.base)s=t.base;else if("string"==typeof t.base)try{s=Number(t.base)}catch(e){console.warn(`Unidentified logarithmic base "${t.base}"`)}i={base:s,type:"logarithmic"}}return{opposite:e,type:i}},Jo=(t,e,i,s=1)=>Ct(t+.1*s*(e-t)+.5*s*i.getPixelSize()*Math.sign(e-t),t,e),$o=(t,e,i,s=1)=>{const r=i.ut(t),n=i.ut(e);return Ct(i.ot(r+.1*s*(n-r)+.5*s*Math.sign(n-r)),t,e)};class qo extends qs{constructor(t,e,i,s,r,n,o){super(t,e,i,s,o),this.wd=r,this.kd=n}}class Zo extends $s{constructor(t,i,s,n,o,h,a,l,c,d,f,g,y,p,m,S,x){var b;super(f,d,l,m,S,{numeric:d.getWidth({x:m.xAxisNumericTicks,y:m.yAxisNumericTicks}),datetime:d.getWidth({x:m.xAxisDateTimeTicks,y:m.yAxisDateTimeTicks}),time:d.getWidth({x:m.xAxisTimeTicks,y:m.yAxisTimeTicks})},x),this.Cd=new Map,this.Td=void 0,this.Fd=0,this.Id=[],this.Pd=[],this.je=zs.fitting,this.Dd=!0,this.Bd=0,this.Od=8,this.Ld=void 0,this.Rd=void 0,this.Ed=20,this.zd=1,this.Vd=!0,this.Nd=!0,this.Gd=!0,this.Wd=!0,this.Hd=!0,this.Ud=!0,this.$d=!0,this.jd=!0,this.Yd=!0,this.Xd=!0,this.Zd=this.yh.defaultDragMouseStyle,this.Kd=this.yh.defaultDragMouseStyle,this.qd=this.yh.defaultDragMouseStyle,this.Jd=this.yh.defaultDragMouseStyle,this.Qd=this.yh.defaultDragMouseStyle,this.P=new r.Eventer,this.tf=[],this.if=t=>{const e=this.Pd.indexOf(t);e>=0&&this.Pd.splice(e,1)},this.sf=t=>(this.Pd.indexOf(t)<0&&this.Pd.push(t),this.if),this.Yi=(t,e)=>this.P.emit("axisAreaTouch",this,e),this.ef=ee(this.tf),this.onAxisInteractionAreaMouseClick=t=>this.P.on("axisAreaMouseClick",t),this.onAxisInteractionAreaMouseDoubleClick=t=>this.P.on("axisAreaDoubleClick",t),this.onAxisInteractionAreaMouseDown=t=>this.P.on("axisAreaMouseDown",t),this.onAxisInteractionAreaMouseUp=t=>this.P.on("axisAreaMouseUp",t),this.onAxisInteractionAreaMouseEnter=t=>this.P.on("axisAreaMouseEnter",t),this.onAxisInteractionAreaMouseLeave=t=>this.P.on("axisAreaMouseLeave",t),this.onAxisInteractionAreaMouseMove=t=>this.P.on("axisAreaMouseMove",t),this.onAxisInteractionAreaMouseWheel=t=>this.P.on("axisAreaMouseWheel",t),this.onAxisInteractionAreaMouseDragStart=t=>this.P.on("axisAreaMouseDragStart",t),this.onAxisInteractionAreaMouseDrag=t=>this.P.on("axisAreaMouseDrag",t),this.onAxisInteractionAreaMouseDragStop=t=>this.P.on("axisAreaMouseDragStop",t),this.onAxisInteractionAreaTouchStart=t=>this.P.on("axisAreaTouchStart",t),this.onAxisInteractionAreaTouch=t=>this.P.on("axisAreaTouch",t),this.onAxisInteractionAreaTouchStop=t=>this.P.on("axisAreaTouchEnd",t),this.offAxisInteractionAreaMouseClick=t=>this.P.off(t,"axisAreaMouseClick"),this.offAxisInteractionAreaMouseDoubleClick=t=>this.P.off(t,"axisAreaDoubleClick"),this.offAxisInteractionAreaMouseDown=t=>this.P.off(t,"axisAreaMouseDown"),this.offAxisInteractionAreaMouseUp=t=>this.P.off(t,"axisAreaMouseUp"),this.offAxisInteractionAreaMouseEnter=t=>this.P.off(t,"axisAreaMouseEnter"),this.offAxisInteractionAreaMouseLeave=t=>this.P.off(t,"axisAreaMouseLeave"),this.offAxisInteractionAreaMouseMove=t=>this.P.off(t,"axisAreaMouseMove"),this.offAxisInteractionAreaMouseWheel=t=>this.P.off(t,"axisAreaMouseWheel"),this.offAxisInteractionAreaMouseDragStart=t=>this.P.off(t,"axisAreaMouseDragStart"),this.offAxisInteractionAreaMouseDrag=t=>this.P.off(t,"axisAreaMouseDrag"),this.offAxisInteractionAreaMouseDragStop=t=>this.P.off(t,"axisAreaMouseDragStop"),this.offAxisInteractionAreaTouchStart=t=>this.P.off(t,"axisAreaTouchStart"),this.offAxisInteractionAreaTouch=t=>this.P.off(t,"axisAreaTouch"),this.offAxisInteractionAreaTouchStop=t=>this.P.off(t,"axisAreaTouchEnd"),this.hf=(t,e)=>e.getAllocatesAxisSpace()?Math.max(t,e.update().wc()):t,this.rf=t=>{const e=this.Id.indexOf(t);-1!==e&&this.Id.splice(e,1)},this.nf=(t,e)=>{this.P.emit("axisAreaDoubleClick",this,e),this.Wd&&(this.setStopped(!1),Kt(e))},this.af=t=>{this.P.emit("axisAreaMouseEnter",this),(this.Nd||this.Vd||this.Gd||this.Wd)&&this.lf(t)},this.uf=t=>{this.cf(t),this.P.emit("axisAreaMouseLeave",this)},this.df=(t,e,i)=>{var s,r;this.P.emit("axisAreaMouseDragStart",this,e,i);const n=Lt(null===(s=this.chart.ff.In)||void 0===s?void 0:s.axisXYZoomMouseButton,0),o=Lt(null===(r=this.chart.ff.In)||void 0===r?void 0:r.axisXYPanMouseButton,2),h=u(e.clientX,e.clientY);i===o&&this.Nd?(this.gf(t),Kt(e)):i===n&&this.Vd&&(this.pf(t,h),Kt(e))},this.mf=(t,e,i,s,r)=>{var n,o;this.P.emit("axisAreaMouseDrag",this,e,i,s,r);const h=Lt(null===(n=this.chart.ff.In)||void 0===n?void 0:n.axisXYZoomMouseButton,0),a=Lt(null===(o=this.chart.ff.In)||void 0===o?void 0:o.axisXYPanMouseButton,2),l=u(e.clientX,e.clientY);i===a&&this.Nd?(this.yf(t,r),Kt(e)):i===h&&this.Vd&&(this.Sf(t,s,l,r),Kt(e))},this.xf=(t,e,i,s)=>{var r,n;this.P.emit("axisAreaMouseDragStop",this,e,i,s);const o=Lt(null===(r=this.chart.ff.In)||void 0===r?void 0:r.axisXYZoomMouseButton,0),h=Lt(null===(n=this.chart.ff.In)||void 0===n?void 0:n.axisXYPanMouseButton,2),a=u(e.clientX,e.clientY);i===h&&this.Nd?(this.bf(t),Kt(e)):i===o&&this.Vd&&(this.vf(t,s,a),Kt(e)),t.getIsUnderMouse()&&(this.Nd||this.Vd||this.Gd||this.Wd)&&this.lf(t)},this.Mf=(t,e)=>{if(this.P.emit("axisAreaMouseWheel",this,e),this.Gd){this.setStopped(!0);const t=this.yh.getWidth(this._f.ls.Ce(e.clientX,e.clientY)),i=this.ct.ot(t);this.zoom(i,pe(e)),Kt(e)}},this.Af=(t,e)=>this.P.emit("axisAreaMouseClick",this,e),this.wf=(t,e)=>this.P.emit("axisAreaMouseDown",this,e),this.kf=(t,e)=>this.P.emit("axisAreaMouseUp",this,e),this.Cf=(t,e)=>this.P.emit("axisAreaMouseMove",this,e),this.Tf=(t,e,i)=>{this.P.emit("axisAreaTouchStart",this,i),this.Vd&&(this.lf(t),this.pf(t,e),Kt(i))},this.Ff=(t,e,i,s,r)=>{this.P.emit("axisAreaTouch",this,r),this.Vd&&(this.Sf(t,e,i,s),Kt(r))},this.If=(t,e,i,s)=>{this.P.emit("axisAreaTouchEnd",this,s),this.Vd&&(this.vf(t,e,i),this.cf(t),Kt(s))},this.Pf=(t,e,i,s)=>{(this.Nd||this.Gd)&&(this.lf(t),this.gf(t),Kt(s))},this.Df=(t,e,i,s,r,n)=>{if(this.Nd){const e=u((s.x+r.x)/2,(s.y+r.y)/2);this.yf(t,e),Kt(n)}if(this.Gd){const t=this._f.ls.Ce(e.x,e.y),o=this._f.ls.Ce(i.x,i.y),h=Math.abs(this.yh.getWidth(ni(t,s))-this.yh.getWidth(ni(o,r)))-Math.abs(this.yh.getWidth(t)-this.yh.getWidth(o)),a=this.ct.Jt(this._h,-h),l=this.ct.Jt(this.Ah,h);this.mh(a,l),Kt(n)}},this.Bf=(t,e,i,s)=>{(this.Nd||this.Gd)&&(this.bf(t),this.cf(t),Kt(s))},this.Of=(t,e)=>{(this.Hd||this.Ud)&&this.Lf(t)},this.Rf=(t,e)=>{this.Ef(t)},this.zf=(t,e,i)=>{const s=u(e.clientX,e.clientY);this.Hd&&this.Vf(t,s)},this.Nf=(t,e,i,s,r)=>{const n=u(e.clientX,e.clientY);this.Hd&&this.Gf(t,n,s,r)},this.Wf=(t,e,i,s,r)=>{const n=u(e.clientX,e.clientY);this.Hd&&this.Hf(t,n,s,r)},this.Uf=(t,e,i,s)=>{const r=u(e.clientX,e.clientY);(this.Hd||this.Ud)&&this.$f(t,r,s),(this.Hd||this.Ud)&&this.Lf(t)},this.jf=(t,e)=>{this.Ud&&(this.setStopped(!0),this.zoom(this._h,pe(e)),Kt(e))},this.Yf=(t,e)=>{this.Ud&&(this.setStopped(!0),this.zoom(this.Ah,pe(e)),Kt(e))},this.Xf=(t,e,i)=>{this.Hd&&(this.Lf(t),this.Vf(t,e),Kt(i))},this.Zf=(t,e,i,s,r)=>{this.Hd&&(this.Gf(t,e,i,s),Kt(r))},this.Kf=(t,e,i,s,r)=>{this.Hd&&(this.Hf(t,e,i,s),Kt(r))},this.qf=(t,e,i,s)=>{this.Hd&&(this.$f(t,e,i),this.Ef(t),Kt(s))},this.wd=t,this.Jf=i,this._f=s,this.Qf=o,this.tg=h,this.chart=f,this.ig=y,this.sg=n,this.ts=a,p(this,this.sf),l.eg=this,this.hg=g,this.rg=this.hg>50?1:-1,this.ng=(b=this.yh.toPoint(0,-this.rg),Math.abs(b.x)>=Math.abs(b.y)?b.x>=0?e.UIDirections.Right:e.UIDirections.Left:b.y>=0?e.UIDirections.Up:e.UIDirections.Down),this.og=c,this.ag=this.ct instanceof ki?(new _i).yi(this.yh.toVec2(this.ct,this.og)):(new Li).yi(this.yh.toVec2(this.ct,this.og)),this.lg=this.chart.pixelScale,this.ug=(new _i).yi(this.yh.toVec2(this.yh.getWidth(this.lg),this.og)),this.cg=this._f.De(this.ag).setMouseInteractions(!1),this.dg=this._f.De(this.ag).setMouseInteractions(!1),this.gg=this._f.De(this.ag).setMouseInteractions(!1),this.pg=this.sg._e(this.lg).Me(d.getWidth({x:m.xAxisOverlayStyle,y:m.yAxisOverlayStyle})).ve(st).Fo(m.highlightColorOffsetAxisOverlay||m.highlightColorOffset),this.mg=this.sg._e(this.lg).Me(d.getWidth({x:m.xAxisZoomingBandFillStyle,y:m.yAxisZoomingBandFillStyle})).ve(d.getWidth({x:m.xAxisZoomingBandStrokeStyle,y:m.yAxisZoomingBandStrokeStyle})),this.yg=this.sg._e(this.lg).Me(d.getWidth({x:m.xAxisOverlayStyle,y:m.yAxisOverlayStyle})).ve(st).Fo(m.highlightColorOffsetAxisOverlay||m.highlightColorOffset),this.Sg=this.sg._e(this.lg).Me(d.getWidth({x:m.xAxisOverlayStyle,y:m.yAxisOverlayStyle})).ve(st).Fo(m.highlightColorOffsetAxisOverlay||m.highlightColorOffset),this.kh=this.sg.Sr(this.ag).setMouseInteractions(!1).Ph(this.yh.getTitleTextRotation(this.rg)),this.chart.ls.os.ns(this.pg,(t=>this.pg.us(t)),{animationEnabled:this.Ze}),this.chart.ls.os.ns(this.yg,(t=>this.yg.us(t)),{animationEnabled:this.Ze}),this.chart.ls.os.ns(this.Sg,(t=>this.Sg.us(t)),{animationEnabled:this.Ze});const v=Wi(new Yi(this.Tf,this.Ff,this.If,1),new ji(this.Pf,this.Df,this.Bf),new Xi(this.nf)),M=Wi(new Yi(this.Xf,this.Zf,this.qf)),A=Wi(new Yi(this.Xf,this.Kf,this.qf));this.pg.setMouseEnterEventHandler(this.af).setMouseLeaveEventHandler(this.uf).setMouseDragStartEventHandler(this.df).setMouseDragEventHandler(this.mf).setMouseDragStopEventHandler(this.xf).setMouseWheelEventHandler(this.Mf).setMouseDoubleClickEventHandler(this.nf).setMouseClickEventHandler(this.Af).setMouseDownEventHandler(this.wf).setMouseUpEventHandler(this.kf).setMouseMoveEventHandler(this.Cf).setTouchStartEventHandler(v.onTouchStart).setTouchMoveEventHandler(v.onTouchMove).setTouchEndEventHandler(v.onTouchEnd),this.yg.setMouseEnterEventHandler(this.Of).setMouseLeaveEventHandler(this.Rf).setMouseDragStartEventHandler(this.zf).setMouseDragEventHandler(this.Nf).setMouseDragStopEventHandler(this.Uf).setMouseWheelEventHandler(this.jf).setTouchStartEventHandler(M.onTouchStart).setTouchMoveEventHandler(M.onTouchMove).setTouchEndEventHandler(M.onTouchEnd),this.Sg.setMouseEnterEventHandler(this.Of).setMouseLeaveEventHandler(this.Rf).setMouseDragStartEventHandler(this.zf).setMouseDragEventHandler(this.Wf).setMouseDragStopEventHandler(this.Uf).setMouseWheelEventHandler(this.Yf).setTouchStartEventHandler(A.onTouchStart).setTouchMoveEventHandler(A.onTouchMove).setTouchEndEventHandler(A.onTouchEnd),this.cg.Pe(d.getWidth({x:m.xAxisStrokeStyle,y:m.yAxisStrokeStyle})),this.dg.Pe(d.getWidth({x:m.xAxisNibStyle,y:m.yAxisNibStyle})),this.gg.Pe(d.getWidth({x:m.xAxisNibStyle,y:m.yAxisNibStyle})),this.kh.Me(d.getWidth({x:m.xAxisTitleFillStyle,y:m.yAxisTitleFillStyle})).Ih(d.getWidth({x:m.xAxisTitleFont,y:m.yAxisTitleFont})),this.ss=a.es(this,{}),this.Bh=this.ss.xg([this.kh]).ys(m.effectsText)}mr(){return this.Je}yr(){return void 0!==this.Nh}setTickStrategy(t,e){return super.Mh(t,e)}getTickStrategy(){return this.He}addBand(t=!0){const e=t?this.tg:this.Qf,i=new Ls(e,this.chart,this.ef,this,this.ag,this.yh,this.Ji,this.ts);return this.tf.push(i),i}addConstantLine(t=!0){const e=t?this.tg:this.Qf,i=new Ds(e,this.chart,this.ef,this,this.ag,this.yh,this.Ji,this.ts);return this.tf.push(i),i}bg(t){this.tf.forEach(t)}vg(t){return this.tf.map(t)}getHighlighters(){return this.tf}setThickness(t){return"number"==typeof t?(this.Mg=t,this._g=t):"object"==typeof t&&(this.Mg=t.min,this._g=t.max),this.wd.Ss(),this}getThickness(){return{min:this.Mg,max:this._g}}setMouseInteractions(t){return this.setAxisInteractionPanByDragging(t).setAxisInteractionReleaseByDoubleClicking(t).setAxisInteractionZoomByDragging(t).setAxisInteractionZoomByWheeling(t).setNibInteractionScaleByDragging(t).setNibInteractionScaleByWheeling(t)}Ag(){return this.Pd}Qh(t,e){return new qo(e,t,this._f,this.ag,this.wd,this.ag)}Oh(){if(this.Cd){for(const t of this.Cd)t[1].grid.dispose(),t[1].tick.dispose();this.Cd.clear()}super.Oh()}tr(t,e){const{tickStart:i}=e,s=t.dh.Jh,r=i+s.getTickLength()*this.rg+s.getTickPadding()*this.rg;t.Ve.we(this.yh.toPoint(t.u,r)).Sa(this.yh.toPoint(s.getLabelAlignment(),-this.rg)).Ph(s.labelRotation).setVisible(this.getVisible())}wg(t,e){const{startPosition:i,gridStrokeLen:s,gridStrokeStart:r,tickStart:n}=e,o=t.dh.Jh,h=i-s*o.getGridStrokeLength(),a=n+o.getTickLength()*this.rg;return{gridStroke:{start:this.yh.toPoint(t.u,r),end:this.yh.toPoint(t.u,h)},tickStroke:{start:this.yh.toPoint(t.u,n),end:this.yh.toPoint(t.u,a)}}}kg(t,e,i,s){return this.wd.De(this.ag).Pe(new $i({fillStyle:new V({color:E(360*(1-s))}),thickness:5})).Oe(this.yh.toVec2(t,0)).Be(this.yh.toVec2(t,this.rg*(50*s)))}dr(t,e){return"linear"===this.xh.type?Jo(t,e,this.ct):$o(t,e,this.ct)}Cg(t,e){return e instanceof ki?Jo:$o}pr(t,e,i){if("logarithmic"!==this.xh.type){const s=this.ct.mi(e-t);return{min:t-i*s,max:e+i*s}}const s=this.ct;return{min:s.Jt(t,-i),max:s.Jt(e,i)}}Ae(t,e,i){const s=this.cg.Yl(),r=this.ct.getInnerStart()this.ct.getInnerStart()?this.ct.getInnerEnd():this.ct.getInnerStart(),o=this.ct.Gt(),h=this.og.getInnerInterval(),a=s.getThickness()*this.rg/2,l=this.hg/100*h,u=l+t,c=u+a,d=h*this.rg,f=c+a,g=this.Id.reduce(this.hf,0);let y,p=0;if(this.Fi||this.Oh(),this.We!==Ns&&this.Fi){const t=this.ct.Gt();this.Hh({physicalAxisSize:t,startPosition:l,gridStrokeLen:d,gridStrokeStart:u,tickStart:f});for(const[e,i]of this.Ue){let s=this.Cd.get(e);if(!s)if(e.Le)s={grid:this.wd.Tg(this.ag).setMouseInteractions(!1),tick:this.wd.Tg(this.ag).setMouseInteractions(!1)};else if("Fg"in e){const t=Array.from(this.Ue.keys()).filter((t=>"Fg"in t)).reverse().indexOf(e),i=this.Jf[t];if(!i)throw new Error("Not enough tick layers. This is an internal LCJS error - if you see this, please contact Arction support.");s={grid:i.Tg(this.ag).setMouseInteractions(!1),tick:i.Tg(this.ag).setMouseInteractions(!1)}}if(s){s.grid.Ha(),s.tick.Ha();for(const[e,r]of i){const e=this.wg(r,{physicalAxisSize:t,startPosition:l,gridStrokeLen:d,gridStrokeStart:u,tickStart:f});s.grid.kr().Ig(e.gridStroke.start,e.gridStroke.end),s.tick.kr().Ig(e.tickStroke.start,e.tickStroke.end)}s.grid.Pe(e.Jh.getGridStrokeStyle()),s.tick.Pe(e.Jh.getTickStyle()),this.Cd.set(e,s)}}for(const t of this.Ue.values()){let e=ke;for(const i of t.values()){const t=i.dh.Jh,s=this.yh.getHeight(i.Ve.Ht()),r=t.getTickLength()+t.getTickPadding()+s+t.getLabelPadding();e=Math.max(e,r)}p=Math.max(p,e)}y=f+Math.max(p,g)*this.rg}else p=0,y=f+g*this.rg;this.cg.Oe(this.yh.toPoint(r,c)).Be(this.yh.toPoint(n,c)),this.dg.Oe(this.yh.toPoint(this.ct.Jt(this.ct.getInnerStart(),this.Od),c)).Be(this.yh.toPoint(this.ct.getInnerStart(),c)),this.gg.Oe(this.yh.toPoint(this.ct.Jt(this.ct.getInnerEnd(),-this.Od),c)).Be(this.yh.toPoint(this.ct.getInnerEnd(),c));const m=this.kh&&this.kh.wh().length>0?this.yh.getHeight(this.kh.Ts().Ht()):0,S=y+.5*m*this.rg;this.kh.we(this.yh.toPoint(this.ct.Jt(this.ct.getInnerStart(),o/2),S));const x=f,b=x+this.rg*this.Fd,v=this.Hd||this.Ud?Math.min(this.Ed,.25*o):0,M={start:this.yh.toVec2(this.ct.Jt(this.ct.getInnerStart(),v),x),end:this.yh.toVec2(this.ct.Jt(this.ct.getInnerEnd(),-v),b)};if(this.Td){const e=this.hg/100*h+t,i=-this.rg*h-t,s={start:this.yh.toVec2(this.Td.min,f+this.rg*this.Fd),end:this.yh.toVec2(this.Td.max,e+i)},r=at(s.start,this.ag,this.lg),n=at(s.end,this.ag,this.lg);this.mg.we(r).q(ni(n,r)).setVisible(!0)}else this.mg.setVisible(!1);const A=at(this.yh.toVec2(this.ct.getInnerStart(),b),this.ag,this.lg),w=at(M.start,this.ag,this.lg),T=at(M.end,this.ag,this.lg),E=at(this.yh.toVec2(this.ct.getInnerEnd(),x),this.ag,this.lg);this.pg.we(w).q(ni(T,w)),this.yg.we(A).q(ni(w,A)),this.Sg.we(T).q(ni(E,T));for(const e of this.Id)e.update().plot(u,d,t,f);for(const t of this.tf)t.Ae();const I=s.getThickness()+Math.max(p,g)+(this.kh&&this.kh.wh().length>0?m+this.Bd:0);return this.Fd=Ct(I,void 0!==this.Mg?this.Mg:0,void 0!==this._g?this._g:Pe),this}Pg(t){const e=this.cg.Yl().getThickness()*this.rg/2,i=this.og.getInnerInterval(),s=this.hg/100*i+t,r=s+e,n=i*this.rg,o=r+e;for(const e of this.Id)e.update().plot(s,n,t,o);for(const t of this.tf)t.Ae()}Dg(){return this.Fd}Bg(t,e){e=e||bo.AxisTickMajor;const i=new xn(this,t?this.wd:this.sg,this.sg,this.ct,this.ug,this.ug,this.yh,this.ng,this.rf,this.Ji,e).setTextFormatter(this.formatValue);return this.Id.push(i),i}lf(t){this.chart.ls.os.vs(t,1),this.Ld=t.ls.Tr(this.Zd,this.Ld)}cf(t){this.chart.ls.os.vs(t,0),t.ls.Fr(this.Ld)}gf(t){this.setStopped(!0),t.ls.Fr(this.Ld)}yf(t,e){const i=-this.yh.getWidth(e);this.pan(i),this.Ld=t.ls.Tr(this.Kd,this.Ld)}pan(t){const e=this._h,i=this.Ah,s=this.ct.Jt(e,t),r=this.ct.Jt(i,t);this.mh(s,r,{allowClamping:!1})}zoom(t,e){const i=this.ct.ut(this._h),s=this.ct.ut(this.Ah),r=this.ct.ut(t),n=Ct((r-i)/(s-i),0,1),o=.2*this.ct.Gt(),h=n*this.zd*o*-e,a=(1-n)*this.zd*o*e,l=this.ct.Jt(this._h,h),u=this.ct.Jt(this.Ah,a);this.mh(l,u)}bf(t){this.Td=void 0,t.ls.Fr(this.Ld)}pf(t,e){this.setStopped(!0),t.ls.Fr(this.Ld),this.chart.ls.os.vs(this.pg,0)}Sf(t,e,i,s){const r=at(this._f.ls.Ce(i.x,i.y),this._f.ls.ct,this.ag),n=Ct(this.yh.getWidth(r),this._h,this.Ah),o=this.yh.getWidth(at(this._f.ls.Ce(e.x,e.y),this._f.ls.ct,this.ag)),h=Ve(this.yh.getHeight(r),this.yh.getHeight(at(this.pg.ca(),this.lg,this.ag)),this.yh.getHeight(at(ri(this.pg.ca(),this.pg.Ht()),this.lg,this.ag)));Math.abs(this.ct.ut(n)-this.ct.ut(o))>10&&h?(this.Td=y(Math.min(n,o),Math.max(n,o)),this.Ld=t.ls.Tr(this.qd,this.Ld)):(this.Td=void 0,this.Ld=t.ls.Tr(this.Zd,this.Ld)),this._f.Ss()}vf(t,e,i){if(this.Td){const t=this.Td.min,e=this.Td.max,i=this.Ah{e.ps(t)}));for(const e of this.Cd.values())e.grid.setVisible(t),e.tick.setVisible(t);return super.setVisible(t),this.wd.Ss(),this}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.setAnimationHighlight(this.Ze),this}}const Ko={getWidth:t=>t.x,getHeight:t=>t.y,toVec2:(t,e)=>({x:t,y:e}),toPoint:(t,e)=>u(t,e)},Qo={getWidth:t=>t.y,getHeight:t=>t.x,toVec2:(t,e)=>({x:e,y:t}),toPoint:(t,e)=>u(e,t)},th=t=>!!(t&&"object"==typeof t&&"x"in t&&t.x instanceof Zo&&"y"in t&&t.y instanceof Zo),eh=s.Record({type:"visible-ticks",gridStrokeLength:1,gridStrokeStyle:new $i,tickLength:7,tickStyle:new $i,tickPadding:0,labelFont:new tr,labelFillStyle:new V,labelPadding:0,labelAlignment:0,labelRotation:0});class ih extends eh{}class sh extends ih{constructor(t){super(t)}setGridStrokeLength(t){return this.set("gridStrokeLength",t)}getGridStrokeLength(){return this.get("gridStrokeLength")}setGridStrokeStyle(t){return this.set("gridStrokeStyle","function"==typeof t?t(this.get("gridStrokeStyle")):t)}getGridStrokeStyle(){return this.get("gridStrokeStyle")}setTickLength(t){return this.set("tickLength",t)}getTickLength(){return this.get("tickLength")}setTickStyle(t){return this.set("tickStyle","function"==typeof t?t(this.get("tickStyle")):t)}getTickStyle(){return this.get("tickStyle")}setTickPadding(t){return this.set("tickPadding",t)}getTickPadding(){return this.get("tickPadding")}setLabelFillStyle(t){return this.set("labelFillStyle","function"==typeof t?t(this.get("labelFillStyle")):t)}getLabelFillStyle(){return this.get("labelFillStyle")}setLabelFont(t){return this.set("labelFont","function"==typeof t?t(this.get("labelFont")):t)}getLabelFont(){return this.get("labelFont")}setLabelPadding(t){return this.set("labelPadding",t)}getLabelPadding(){return this.get("labelPadding")}setLabelAlignment(t){return this.set("labelAlignment",t)}getLabelAlignment(){return this.get("labelAlignment")}setLabelRotation(t){return this.set("labelRotation",t)}getLabelRotation(){return this.get("labelRotation")}}const rh=t=>!(!t||"object"!=typeof t||!("type"in t)||"visible-ticks"!==t.type),nh=Object.assign(Object.create(new class extends ih{}({type:"empty-ticks"})),{}),oh=(t,e,i,s,r)=>n=>o=>{const h=new Date(o+n),a={year:h.getFullYear(),monthIndex:h.getMonth(),day:h.getDate(),hours:h.getHours(),minutes:h.getMinutes(),seconds:h.getSeconds(),millis:h.getMilliseconds()},l=s?s(a):void 0;if(0===t&&!0===l)return o;const u=a[e];r.includes("year")&&(a.year=Math.floor(a.year/i)*i),r.includes("monthIndex")&&(a.monthIndex=0),r.includes("day")&&(a.day=1),r.includes("hours")&&(a.hours=0),r.includes("minutes")&&(a.minutes=0),r.includes("seconds")&&(a.seconds=0),r.includes("millis")&&(a.millis=0);let c=(0===t?1:t)*i;return-1===t&&!1===l&&(c=0),0!==c&&(a[e]=i*(c>0?Math.floor((u+c)/i):Math.ceil((u+c)/i))),new Date(a.year,a.monthIndex,a.day,a.hours,a.minutes,a.seconds,a.millis).getTime()-n},hh=(t,e,i,...s)=>oh(-1,t,e,i,s),ah=(t,e,i,...s)=>oh(-1,t,e,i,s),lh=(t,e,i,...s)=>oh(0,t,e,i,s),uh=(t,e,...i)=>oh(1,t,e,void 0,i),ch=t=>e=>i=>{const s=new Date(i+e),r=s.getDay(),n=1===r&&0===s.getHours()&&0===s.getMinutes()&&0===s.getSeconds()&&0===s.getMilliseconds();if(0===t&&!0===n)return i;let o=s.getDate();return-1===t&&1===r&&!1===n||(-1===t?o-=r>=2?r-1:r+6:o+=r>0?8-r:1),new Date(s.getFullYear(),s.getMonth(),o,0,0,0,0).getTime()-e},dh=[{label:"MilliSecond100",unit:100,irregular:!1,greatTicks:void 0,majorTicks:{fitFunction:Xs({ignore:"first"},2,5)},minorTicks:{amount:4,fitFunction:Xs(void 0,2)}},{label:"Second",unit:1e3,irregular:!1,greatTicks:{getReferenceKeyValue:hh("seconds",1,(t=>0===t.millis),"millis")},majorTicks:{fitFunction:Ys(5,10,15,30)},minorTicks:{amount:4,fitFunction:Xs(void 0,2)}},{label:"Minute",unit:6e4,irregular:!1,greatTicks:{getReferenceKeyValue:hh("minutes",1,(t=>0===t.seconds&&0===t.millis),"seconds","millis")},majorTicks:{fitFunction:Ys(5,10,15,30)},minorTicks:{amount:12,fitFunction:Xs(void 0,3,6)}},{label:"Hour",unit:36e5,irregular:!1,greatTicks:{getReferenceKeyValue:hh("hours",1,(t=>0===t.minutes&&0===t.seconds&&0===t.millis),"minutes","seconds","millis")},majorTicks:{fitFunction:Ys(3,6,12)},minorTicks:{amount:8,fitFunction:Xs(void 0,2,4)}},{label:"Day",unit:864e5,irregular:!1,greatTicks:{getReferenceKeyValue:hh("day",1,(t=>0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"hours","minutes","seconds","millis")},majorTicks:{fitFunction:Xs({ignore:"last"},2,4)},minorTicks:{amount:7,fitFunction:Xs({ignore:"last"},2,3)}},{label:"Week",unit:6048e5,irregular:!0,getPrevKeyValue:ch(-1),getNextKeyValueIncludingRef:ch(0),getNextKeyValue:ch(1),greatTicks:!0,majorTicks:{fitFunction:Xs(void 0,2)},minorTicks:{fitFunction:void 0}},{label:"Month",unit:2592e6,irregular:!0,getPrevKeyValue:ah("monthIndex",1,(t=>1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"day","hours","minutes","seconds","millis"),getNextKeyValueIncludingRef:lh("monthIndex",1,(t=>1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"day","hours","minutes","seconds","millis"),getNextKeyValue:uh("monthIndex",1,"day","hours","minutes","seconds","millis"),greatTicks:!0,majorTicks:{fitFunction:Xs(void 0,2,3)},minorTicks:{fitFunction:Xs(void 0,2,4,6)}},{label:"Year",unit:31536e6,irregular:!0,getPrevKeyValue:ah("year",1,(t=>1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValueIncludingRef:lh("year",1,(t=>1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValue:uh("year",1,"monthIndex","day","hours","minutes","seconds","millis"),greatTicks:!0,majorTicks:{fitFunction:Xs({ignore:"first"},2,5)},minorTicks:{fitFunction:Xs(void 0,2,5)}},{label:"Decade",unit:31536e7,irregular:!0,getPrevKeyValue:ah("year",10,(t=>t.year%10==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValueIncludingRef:lh("year",10,(t=>t.year%10==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValue:uh("year",10,"year","monthIndex","day","hours","minutes","seconds","millis"),greatTicks:!0,majorTicks:{fitFunction:Xs(void 0,2,4)},minorTicks:{fitFunction:Xs(void 0,2,5)}},{label:"Century",unit:316224e7,irregular:!0,getPrevKeyValue:ah("year",100,(t=>t.year%100==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValueIncludingRef:lh("year",100,(t=>t.year%100==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValue:uh("year",100,"year","monthIndex","day","hours","minutes","seconds","millis"),greatTicks:!0,majorTicks:{fitFunction:void 0},minorTicks:void 0},{label:"Millennium",unit:316224e8,irregular:!0,getPrevKeyValue:ah("year",1e3,(t=>t.year%1e3==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValueIncludingRef:lh("year",1e3,(t=>t.year%1e3==0&&1===t.day&&0===t.hours&&0===t.minutes&&0===t.seconds&&0===t.millis),"year","monthIndex","day","hours","minutes","seconds","millis"),getNextKeyValue:uh("year",1e3,"year","monthIndex","day","hours","minutes","seconds","millis"),greatTicks:!0,majorTicks:{fitFunction:void 0},minorTicks:void 0}],fh=(t,e,i)=>{let s=((t,e,i,s,r)=>{const n=e-t;let o;for(let t=0;t(i,s,r,n)=>{const o=fh("great",i,s);if(void 0===o)return[];if("Decade"===o.label||"Century"===o.label||"Millennium"===o.label)return[];const h=n>r?i:s,a=(i+s)/2,l=n>r?s:i;if(dh.indexOf(o)<=dh.findIndex((t=>"Hour"===t.label)))return"left"===e?[h]:[];let u;if(!0===o.irregular)u=Ws(i,s,o.getPrevKeyValue(t),o.getNextKeyValue(t));else{const e=o.greatTicks.getReferenceKeyValue(t)(i);u=Us(i,s,o.unit,e,1)}const c=((t,e,i)=>{for(const s of i)if(s>=t&&s<=e)return s})(i,s,u);return"left"===e?void 0===c||Ve(c,a,l)?[h]:[c]:void 0!==c&&Ve(c,a,l)?[c]:[l]},yh=(t,e)=>(i,s,r,n)=>{const o=fh(t,r,n);let h;if(void 0===o)return[];if("great"===t&&void 0!==o.greatTicks)if(!0===o.irregular)h=Ws(i,s,o.getPrevKeyValue(e),o.getNextKeyValue(e));else{const t=o.greatTicks.getReferenceKeyValue(e)(i);h=Us(i,s,o.unit,t,1)}else if("major"===t&&void 0!==o.majorTicks)h=!0===o.irregular?((t,e,i,s)=>{const r=[];let n=i(t),o=0;for(;n1e3)throw new Error("Infinite loop in Axis tick key values logic.");return r.push(n),r})(i,s,o.getPrevKeyValue(e),o.getNextKeyValue(e)):((t,e,i)=>{const s=[];let r=t,n=0;for(;r1e3)throw new Error("Infinite loop in Axis tick key values logic.");return s.push(r),s})(i,s,o.unit);else{if("minor"!==t||void 0===o.minorTicks)return[];if(!0===o.irregular)h=((t,e,i,s)=>{const r=[];let n=i(t),o=0;for(;n1e3)throw new Error("Infinite loop in Axis tick key values logic.");return r})(i,s,o.getNextKeyValueIncludingRef(e),o.getNextKeyValue(e));else{const t=(t=>{if(void 0!==t)return dh[dh.indexOf(t)+1]})(o);if(void 0===t)return[];h=Hs(i,s,t.unit/o.minorTicks.amount,1)}}return h},ph=t=>(e,i,s,r,n,o)=>{const h=fh(t,n,o);if(void 0===h)return;let a;return"major"===t?a=h.majorTicks.fitFunction:h.minorTicks&&(a=h.minorTicks.fitFunction),a?a(e,i,s,r,n,o):void 0},mh=s.Record({type:"date-time-ticks",locale:void 0,dateOrigin:void 0,cursorFormatter:void 0,greatTickStyle:new sh,majorTickStyle:new sh,minorTickStyle:new sh,formatOptionsMajorCentury:{year:"numeric"},formatOptionsMinorDecade:{year:"numeric"},formatOptionsMajorDecade:{year:"numeric"},formatOptionsMinorYear:{year:"numeric"},formatOptionsMajorYear:{year:"numeric"},formatOptionsMinorMonth:{month:"short"},formatOptionsGreatYear:{year:"numeric"},formatOptionsMajorMonth:{month:"long"},formatOptionsMinorWeek:{day:"numeric"},formatOptionsGreatMonth:{year:"numeric",month:"long"},formatOptionsMajorWeek:{day:"numeric",weekday:"short"},formatOptionsMinorDay:{day:"numeric",weekday:"short"},formatOptionsGreatWeek:(t,e,i)=>{const s=new Date(t),r=(t=>{const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));e.setUTCDate(e.getUTCDate()+4-(e.getUTCDay()||7));const i=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-i.getTime())/864e5+1)/7)})(s);return`${new Intl.DateTimeFormat(i,{year:"numeric",month:"long"}).format(s)} Week ${r}`},formatOptionsMajorDay:{weekday:"long",day:"numeric"},formatOptionsMinorHour:{hour:"2-digit",minute:"2-digit"},formatOptionsGreatDay:{year:"numeric",month:"long",day:"numeric"},formatOptionsMajorHour:{hour:"2-digit",minute:"2-digit"},formatOptionsMinorMinute:{hour:"2-digit",minute:"2-digit"},formatOptionsGreatHour:{year:"numeric",month:"long",day:"numeric"},formatOptionsMajorMinute:{hour:"2-digit",minute:"2-digit"},formatOptionsMinorSecond:{hour:"2-digit",minute:"2-digit",second:"2-digit"},formatOptionsGreatMinute:{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"},formatOptionsMajorSecond:{second:"2-digit"},formatOptionsMinorMillisecond:t=>{const e=new Date(t);return`${(e.getSeconds()+e.getUTCMilliseconds()/1e3).toFixed(2)}`},formatOptionsGreatSecond:{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"},formatOptionsMajorMilliSecond:t=>{const e=new Date(t);return`${(e.getSeconds()+e.getUTCMilliseconds()/1e3).toFixed(1)}`}});class Sh extends mh{Lh(t){const e=void 0!==this.dateOrigin?this.dateOrigin.getTime():0,i=t=>dh.map((e=>{const i=((t,e,i)=>{switch(i.label){case"MilliSecond100":return"Great"===e?void 0:"Major"===e?t.formatOptionsMajorMilliSecond:t.formatOptionsMinorMillisecond;case"Second":return"Great"===e?t.formatOptionsGreatSecond:"Major"===e?t.formatOptionsMajorSecond:t.formatOptionsMinorSecond;case"Minute":return"Great"===e?t.formatOptionsGreatMinute:"Major"===e?t.formatOptionsMajorMinute:t.formatOptionsMinorMinute;default:case"Hour":return"Great"===e?t.formatOptionsGreatHour:"Major"===e?t.formatOptionsMajorHour:t.formatOptionsMinorHour;case"Day":return"Great"===e?t.formatOptionsGreatDay:"Major"===e?t.formatOptionsMajorDay:t.formatOptionsMinorDay;case"Week":return"Great"===e?t.formatOptionsGreatWeek:"Major"===e?t.formatOptionsMajorWeek:t.formatOptionsMinorWeek;case"Month":return"Great"===e?t.formatOptionsGreatMonth:"Major"===e?t.formatOptionsMajorMonth:t.formatOptionsMinorMonth;case"Year":return"Great"===e?t.formatOptionsGreatYear:"Major"===e?t.formatOptionsMajorYear:t.formatOptionsMinorYear;case"Decade":return"Great"===e?void 0:"Major"===e?t.formatOptionsMajorDecade:t.formatOptionsMinorDecade;case"Century":return"Great"===e?void 0:"Major"===e?t.formatOptionsMajorCentury:void 0;case"Millennium":return}})(this,t,e);if("object"!=typeof i)return i;try{return new Intl.DateTimeFormat(this.locale,i)}catch(t){let e="";for(const t in i)e+=` ${t}: ${i[t]},`;xt.console.error(`Invalid Intl.DateTimeFormat ( locale: ${this.locale}, formatOptions {${e}} )`)}})),s=new Map;s.set("great",i("Great")),s.set("major",i("Major")),s.set("minor",i("Minor"));const r=t=>String(t),n=(t,i)=>(n,o)=>{let h=n+e;const a=o.getInnerStart(),l=o.getInnerEnd(),u=a>l,c=fh(t,u?l:a,u?a:l);if(void 0===c)return r(h);if("great"===t){const t=It(n,"left"===i?a:l);let s;if(s=!1===t?n:!1===c.irregular?"left"===i&&!1===u||"right"===i&&!0===u?c.greatTicks.getReferenceKeyValue(e)(n):c.greatTicks.getReferenceKeyValue(e)(n+1*c.unit):"left"===i&&!1===u||"right"===i&&!0===u?c.getPrevKeyValue(e)(n):c.getNextKeyValue(e)(n),h=s+e,"right"===i&&!0===t)return""}const d=s.get(t);if(void 0===d)return r(h);const f=d[dh.indexOf(c)];return void 0===f?"":"function"==typeof f?f(h,o,this.locale):f.format(h)},o=[],h=[{Ve:"Great ticks (directive)",Fg:0,Re:!0,Mr:yh("great",e),_r:void 0},{Ve:"Major ticks",Fg:1,Jh:this.majorTickStyle,Kh:n("major"),Mr:yh("major",e),fh:{ir:ph("major")},_r:void 0}];this.greatTickStyle!==nh&&(o.push({Ve:"Great ticks (left)",Jh:this.greatTickStyle.setLabelAlignment(-1),Kh:n("great","left"),Mr:gh(e,"left"),Le:!0,hr:!1}),o.push({Ve:"Great ticks (right)",Jh:this.greatTickStyle.setLabelAlignment(1),Kh:n("great","right"),Mr:gh(e,"right"),Le:!0,hr:!1})),this.minorTickStyle!==nh&&h.push({Ve:"Minor ticks",Fg:2,Jh:this.minorTickStyle,Kh:n("minor"),Mr:yh("minor",e),fh:{ir:ph("minor"),gh:(t,e,i,s,r,n)=>{const o=fh("minor",r,n);return!o||"Week"!==o.label}},_r:void 0});const a=this.cursorFormatter;return{Ne:o,Ge:h,Ee:a?(t,i,s)=>a(e+t,i,s):(t,i,s)=>{const r=new Date(e+t);return`${new Intl.DateTimeFormat(s,{year:"numeric",month:"numeric",day:"numeric",minute:"2-digit",hour:"2-digit"}).format(r)} `},zh:1e3,Vh:31536e9}}setCursorFormatter(t){return this.set("cursorFormatter",t)}getCursorFormatter(){return this.get("cursorFormatter")}setGreatTickStyle(t){if("function"==typeof t){const e=this.get("greatTickStyle");return e!==nh?this.set("greatTickStyle",t(e)):this}return this.set("greatTickStyle",t)}getGreatTickStyle(){return this.get("greatTickStyle")}setMajorTickStyle(t){return"function"==typeof t?this.set("majorTickStyle",t(this.get("majorTickStyle"))):this.set("majorTickStyle",t)}getMajorTickStyle(){return this.get("majorTickStyle")}setMinorTickStyle(t){if("function"==typeof t){const e=this.get("minorTickStyle");return e!==nh?this.set("minorTickStyle",t(e)):this}return this.set("minorTickStyle",t)}getMinorTickStyle(){return this.get("minorTickStyle")}setLocale(t){return this.set("locale",t)}getLocale(){return this.get("locale")}setDateOrigin(t){return this.set("dateOrigin",t)}getDateOrigin(){return this.get("dateOrigin")}setFormatting(t,e,i){return this.withMutations((s=>s.set("formatOptionsGreatYear",t||this.formatOptionsGreatYear).set("formatOptionsGreatMonth",t||this.formatOptionsGreatMonth).set("formatOptionsGreatWeek",t||this.formatOptionsGreatWeek).set("formatOptionsGreatDay",t||this.formatOptionsGreatDay).set("formatOptionsGreatHour",t||this.formatOptionsGreatHour).set("formatOptionsGreatMinute",t||this.formatOptionsGreatMinute).set("formatOptionsGreatSecond",t||this.formatOptionsGreatSecond).set("formatOptionsMajorCentury",e||this.formatOptionsMajorCentury).set("formatOptionsMajorDecade",e||this.formatOptionsMajorDecade).set("formatOptionsMajorYear",e||this.formatOptionsMajorYear).set("formatOptionsMajorMonth",e||this.formatOptionsMajorMonth).set("formatOptionsMajorWeek",e||this.formatOptionsMajorWeek).set("formatOptionsMajorDay",e||this.formatOptionsMajorDay).set("formatOptionsMajorHour",e||this.formatOptionsMajorHour).set("formatOptionsMajorMinute",e||this.formatOptionsMajorMinute).set("formatOptionsMajorSecond",e||this.formatOptionsMajorSecond).set("formatOptionsMajorMilliSecond",e||this.formatOptionsMajorMilliSecond).set("formatOptionsMinorDecade",i||this.formatOptionsMinorDecade).set("formatOptionsMinorYear",i||this.formatOptionsMinorYear).set("formatOptionsMinorMonth",i||this.formatOptionsMinorMonth).set("formatOptionsMinorWeek",i||this.formatOptionsMinorWeek).set("formatOptionsMinorDay",i||this.formatOptionsMinorDay).set("formatOptionsMinorHour",i||this.formatOptionsMinorHour).set("formatOptionsMinorMinute",i||this.formatOptionsMinorMinute).set("formatOptionsMinorSecond",i||this.formatOptionsMinorSecond)))}setFormattingDecade(t,e){return this.withMutations((i=>(t&&(i=i.set("formatOptionsMajorDecade",t)),e&&(i=i.set("formatOptionsMinorYear",e)),i)))}setFormattingYear(t,e){return this.withMutations((i=>(t&&(i=i.set("formatOptionsMajorYear",t)),e&&(i=i.set("formatOptionsMinorMonth",e)),i)))}setFormattingMonth(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatYear",t)),e&&(s=s.set("formatOptionsMajorMonth",e)),i&&(s=s.set("formatOptionsMinorWeek",i)),s)))}setFormattingWeek(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatMonth",t)),e&&(s=s.set("formatOptionsMajorWeek",e)),i&&(s=s.set("formatOptionsMinorDay",i)),s)))}setFormattingDay(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatWeek",t)),e&&(s=s.set("formatOptionsMajorDay",e)),i&&(s=s.set("formatOptionsMinorHour",i)),s)))}setFormattingHour(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatDay",t)),e&&(s=s.set("formatOptionsMajorHour",e)),i&&(s=s.set("formatOptionsMinorMinute",i)),s)))}setFormattingMinute(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatHour",t)),e&&(s=s.set("formatOptionsMajorMinute",e)),i&&(s=s.set("formatOptionsMinorSecond",i)),s)))}setFormattingSecond(t,e,i){return this.withMutations((s=>(t&&(s=s.set("formatOptionsGreatMinute",t)),e&&(s=s.set("formatOptionsMajorSecond",e)),i&&(s=s.set("formatOptionsMinorMillisecond",i)),s)))}setFormattingMilliSecond(t,e){return this.withMutations((i=>(t&&(i=i.set("formatOptionsGreatSecond",t)),e&&(i=i.set("formatOptionsMajorMilliSecond",e)),i)))}}const xh=(t,e)=>(i,s)=>{const r=s-i;if(e){const e=Math.log10(r/2);let n=10**Math.floor(e-t);const o=1/n;n=Math.round(n*o)/o;const h=Math.round(Math.floor(i/(10*n))*n*10*o)/o;return Us(h,s,n,void 0,o)}const n=Math.log10(r);let o=10**Math.round(n-t);const h=1/o;return o=Math.round(o*h)/h,Hs(i,s,o,h)},bh=(t,e,i,s,r,n)=>0===e?t.filter(((t,e)=>e%2==0)):1===e?t.filter(((t,e)=>e%5==0)):void 0,vh=Xs(void 0,2,5),Mh=(t,e,i,s,r,n)=>0===e?[t[1],t[3],t[5]]:1===e?[t[0],t[3]]:2===e?[t[1]]:void 0,Ah=(t,e)=>{const i=Mi(t),s=Ai(t);if(e)return(t,e)=>{const r=[],n=Math.floor(i(t)),o=Math.ceil(i(e));for(let t=n-1;t<=o+1;t+=1){const e=s**t;r.push(e)}return r};const r=10===t?9:4;return(t,e)=>{const n=Math.round(i(t)),o=Math.round(i(e)),h=[],a=s**n,l=(s**o-a)/r;for(let i=1;i<=r;i+=1){const s=a+l*i;s>t&&si(e+t,s,r),Mr:Gs,Le:!0,hr:!0}),o.push({Ve:"Major ticks",Fg:0,Jh:this.majorTickStyle,Kh:void 0===e?s:(t,i,r)=>s(e+t,i,r),Mr:"logarithmic"===t.type?Ah(t.base,!0):xh(0,!0),fh:"logarithmic"===t.type?void 0:{ir:bh},_r:void 0}),this.minorTickStyle!==nh&&o.push({Ve:"Minor ticks",Fg:1,Jh:this.minorTickStyle,Kh:void 0===e?r:(t,i,s)=>r(e+t,i,s),Mr:"logarithmic"===t.type?Ah(t.base,!1):xh(1,!1),fh:"logarithmic"===t.type?{ir:Mh}:{ir:vh},_r:50});const h=this.cursorFormatter?this.cursorFormatter:Ci.Numeric;return{Ne:n,Ge:o,Ee:void 0===e?h:(t,i,s)=>h(e+t,i,s),zh:1e-9,Vh:void 0}}setCursorFormatter(t){return this.set("cursorFormatter",t)}getCursorFormatter(){return this.get("cursorFormatter")}setExtremeTickStyle(t){if("function"==typeof t){const e=this.get("extremeTickStyle");return e!==nh?this.set("extremeTickStyle",t(e)):this}return this.set("extremeTickStyle",t)}getExtremeTickStyle(){return this.get("extremeTickStyle")}setFormattingOffset(t){return this.set("formattingOffset",t)}getFormattingOffset(){return this.get("formattingOffset")}setMajorTickStyle(t){return"function"==typeof t?this.set("majorTickStyle",t(this.get("majorTickStyle"))):this.set("majorTickStyle",t)}getMajorTickStyle(){return this.get("majorTickStyle")}setMinorTickStyle(t){if("function"==typeof t){const e=this.get("minorTickStyle");return e!==nh?this.set("minorTickStyle",t(e)):this}return this.set("minorTickStyle",t)}getMinorTickStyle(){return this.get("minorTickStyle")}setFormattingFunction(t){return this.withMutations((e=>e.set("extremeFormattingFunction",t).set("majorFormattingFunction",t).set("minorFormattingFunction",t).set("cursorFormatter",t)))}getExtremeFormattingFunction(){return this.get("extremeFormattingFunction")}setExtremeFormattingFunction(t){return this.set("extremeFormattingFunction",t)}getMajorFormattingFunction(){return this.get("majorFormattingFunction")}setMajorFormattingFunction(t){return this.set("majorFormattingFunction",t)}getMinorFormattingFunction(){return this.get("minorFormattingFunction")}setMinorFormattingFunction(t){return this.set("minorFormattingFunction",t)}}const Eh=s.Record({type:"time-ticks",cursorFormatter:void 0,timeOrigin:void 0,majorTickStyle:new sh,minorTickStyle:new sh,majorFormattingFunction:void 0,minorFormattingFunction:void 0}),Ih=(t,e)=>{const i=e-t;return i>=864e5?"MajorHours12":i>=36e5?"MajorHours":i>=6e5?"MajorMinutes15":i>=6e4?"MajorMinutes":i>=1e4?"MajorSeconds15":i>=1e3?"MajorSeconds":i>=100?"MajorMilliseconds100":i>=10?"MajorMilliseconds10":i>=1?"MajorMilliseconds":i>=.1?"MajorMicroseconds100":i>=.01?"MajorMicroseconds10":i>=.001?"MajorMicroseconds":i<=.001?"MajorNanoseconds100":"Unknown"},Ch={hhmmss:t=>{let e=Math.abs(t);const i=t>=0?"":"-",s=Math.floor(e/36e5);e%=36e5;const r=Math.floor(e/6e4);e%=6e4;const n=Math.floor(e/1e3);return`${i}${ge(s,2)}:${ge(r,2)}:${ge(n,2)}`},hhmmssmmm:t=>{let e=Math.abs(t);const i=t>=0?"":"-",s=Math.floor(e/36e5);e%=36e5;const r=Math.floor(e/6e4);e%=6e4;const n=Math.floor(e/1e3);e%=1e3;const o=Math.floor(e/1);return`${i}${ge(s,2)}:${ge(r,2)}:${ge(n,2)}.${ge(o,3)}`},hhmmssmmmuuu:t=>{const e=Math.abs(t),i=t>=0?"":"-",s=Math.floor(e/36e5),r=Math.floor(e/6e4)%60,n=Math.floor(e/1e3)%60,o=Math.floor(e/1)%1e3,h=t.toLocaleString("en-US",{minimumFractionDigits:3,maximumFractionDigits:3}).split(".")[1];return`${i}${ge(s,2)}:${ge(r,2)}:${ge(n,2)}.${ge(o,3)}${h}`},hhmmssmmmuuunnn:t=>{const e=Math.abs(t),i=t>=0?"":"-",s=Math.floor(e/36e5),r=Math.floor(e/6e4)%60,n=Math.floor(e/1e3)%60,o=Math.floor(e/1)%1e3,h=t.toLocaleString("en-US",{minimumFractionDigits:6,maximumFractionDigits:6}).split(".")[1];return`${i}${ge(s,2)}:${ge(r,2)}:${ge(n,2)}.${ge(o,3)}${h}`}},Ph={MajorHours12:{major:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>{const r=432e5;return t=Math.floor(t/(4*r))*r*4,Us(t,e,r,void 0,1e6)},fitKeyValues:Xs({ignore:"first"},2,4)},minor:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>Hs(t,e,36e5,1e6),fitKeyValues:Xs({},2,3,4,6)},defaultValueFormatter:Ch.hhmmss},MajorHours:{major:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>{const r=36e5;return t=Math.floor(t/(12*r))*r*12,Us(t,e,r,void 0,1e6)},fitKeyValues:Xs({ignore:"first"},2,6,12)},minor:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>Hs(t,e,3e5,1e6),fitKeyValues:Xs({},2,4,6)},defaultValueFormatter:Ch.hhmmss},MajorMinutes15:{major:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>(t=36e5*Math.floor(t/36e5),Us(t,e,9e5,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2)},minor:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>Hs(t,e,6e4,1e6),fitKeyValues:Xs({},3,5)},defaultValueFormatter:Ch.hhmmss},MajorMinutes:{major:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>(t=6e4*Math.floor(t/6e5)*10,Us(t,e,6e4,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>Hs(t,e,5e3,1e6),fitKeyValues:Xs({},2,3,4,6)},defaultValueFormatter:Ch.hhmmss},MajorSeconds15:{major:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>(t=15e3*Math.floor(t/6e4)*4,Us(t,e,15e3,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,4)},minor:{format:Ch.hhmmss,getKeyValues:(t,e,i,s)=>Hs(t,e,1e3,1e6),fitKeyValues:Xs({},3,5)},defaultValueFormatter:Ch.hhmmss},MajorSeconds:{major:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>(t=1e3*Math.floor(t/1e4)*10,Us(t,e,1e3,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>Hs(t,e,100,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmm},MajorMilliseconds100:{major:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>(t=100*Math.floor(t/1e3)*10,Us(t,e,100,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>Hs(t,e,10,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmm},MajorMilliseconds10:{major:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>(t=10*Math.floor(t/100)*10,Us(t,e,10,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmm,getKeyValues:(t,e,i,s)=>Hs(t,e,1,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmm},MajorMilliseconds:{major:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>(t=1*Math.floor(t/10)*10,Us(t,e,1,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>Hs(t,e,.1,1e6),fitKeyValues:Xs({},2)},defaultValueFormatter:Ch.hhmmssmmmuuu},MajorMicroseconds100:{major:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>(t=.1*Math.floor(t/1)*10,Us(t,e,.1,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>Hs(t,e,.01,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmmuuu},MajorMicroseconds10:{major:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>(t=.01*Math.floor(t/.1)*10,Us(t,e,.01,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmmuuu,getKeyValues:(t,e,i,s)=>Hs(t,e,.001,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmmuuu},MajorMicroseconds:{major:{format:Ch.hhmmssmmmuuunnn,getKeyValues:(t,e,i,s)=>(t=.001*Math.floor(t/.01)*10,Us(t,e,.001,void 0,1e6)),fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmmuuunnn,getKeyValues:(t,e,i,s)=>Hs(t,e,100*1e-6,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmmuuunnn},MajorNanoseconds100:{major:{format:Ch.hhmmssmmmuuunnn,getKeyValues:(t,e,i,s)=>{const r=100*1e-6;return t=Math.floor(t/.001)*r*10,Us(t,e,r,void 0,1e6)},fitKeyValues:Xs({ignore:"first"},2,5)},minor:{format:Ch.hhmmssmmmuuunnn,getKeyValues:(t,e,i,s)=>Hs(t,e,10*1e-6,1e6),fitKeyValues:Xs({},2,3,5)},defaultValueFormatter:Ch.hhmmssmmmuuunnn},Unknown:{major:{format:(t,e,i)=>"",getKeyValues:(t,e,i,s)=>[],fitKeyValues:void 0},minor:{format:(t,e,i)=>"",getKeyValues:(t,e,i,s)=>[],fitKeyValues:void 0},defaultValueFormatter:(t,e,i)=>""}};class kh extends Eh{Lh(t){const e=this.timeOrigin||0,i=[{Ve:"Major ticks",Fg:0,Jh:this.majorTickStyle,Kh:this.majorFormattingFunction?this.majorFormattingFunction:(t,i,s)=>{const r=Ih(Math.min(i.getInnerStart(),i.getInnerEnd()),Math.max(i.getInnerStart(),i.getInnerEnd()));return(0,Ph[r].major.format)(t+e,i,s)},Mr:(t,e,i,s)=>{const r=Ih(i,s);return(0,Ph[r].major.getKeyValues)(t,e,i,s)},fh:{ir:(t,e,i,s,r,n)=>{const o=Ih(r,n),h=Ph[o].major.fitKeyValues;if(h)return h(t,e,i,s,r,n)}},_r:void 0}];return rh(this.minorTickStyle)&&i.push({Ve:"Minor ticks",Fg:1,Jh:this.minorTickStyle,Kh:this.minorFormattingFunction?this.minorFormattingFunction:(t,i,s)=>{const r=Ih(Math.min(i.getInnerStart(),i.getInnerEnd()),Math.max(i.getInnerStart(),i.getInnerEnd()));return(0,Ph[r].minor.format)(t+e,i,s)},Mr:(t,e,i,s)=>{const r=Ih(i,s);return(0,Ph[r].minor.getKeyValues)(t,e,i,s)},fh:{ir:(t,e,i,s,r,n)=>{const o=Ih(r,n),h=Ph[o].minor.fitKeyValues;if(h)return h(t,e,i,s,r,n)}},_r:void 0}),{Ne:[],Ge:i,Ee:this.cursorFormatter||((t,i,s)=>{const r=Ih(Math.min(i.getInnerStart(),i.getInnerEnd()),Math.max(i.getInnerStart(),i.getInnerEnd()));return Ph[r].defaultValueFormatter(t+e,i,s)}),zh:1e-4,Vh:864e6}}setMajorTickStyle(t){return"function"==typeof t?this.set("majorTickStyle",t(this.get("majorTickStyle"))):this.set("majorTickStyle",t)}getMajorTickStyle(){return this.get("majorTickStyle")}setMinorTickStyle(t){if("function"==typeof t){const e=this.get("minorTickStyle");return e!==nh?this.set("minorTickStyle",t(e)):this}return this.set("minorTickStyle",t)}getMinorTickStyle(){return this.get("minorTickStyle")}setCursorFormatter(t){return this.set("cursorFormatter",t)}getCursorFormatter(){return this.get("cursorFormatter")}setTimeOrigin(t){return this.set("timeOrigin",t)}getTimeOrigin(){return this.get("timeOrigin")}setFormattingFunction(t){return this.withMutations((e=>e.set("majorFormattingFunction",t).set("minorFormattingFunction",t).set("cursorFormatter",t)))}getMajorFormattingFunction(){return this.get("majorFormattingFunction")}setMajorFormattingFunction(t){return this.set("majorFormattingFunction",t)}getMinorFormattingFunction(){return this.get("minorFormattingFunction")}setMinorFormattingFunction(t){return this.set("minorFormattingFunction",t)}}const Fh=(t,e,i="image/png",s)=>{e+=`.${i.slice(i.indexOf("image/")+6)}`;const r=t.captureFrame(i,s);if("image/png"!==i&&r.type.includes("image/png"))throw new Error(`saveToFile | type not supported by browser: ${i}\nCheck support table for HTMLCanvasElement.toDataURL`);if(xt.navigator.msSaveBlob)xt.navigator.msSaveBlob(r,e);else{const t=xt.document.createElement("a");xt.document.body.appendChild(t);const i=xt.URL.createObjectURL(r);t.href=i,t.download=e,t.click(),setTimeout((()=>{xt.URL.revokeObjectURL(i),xt.document.body.removeChild(t)}),0)}},Bh=(t,i,s,r,n,o)=>{const h=t.vc(i,s,r,n,o,!0);return h.setDraggingMode(e.UIDraggingModes.draggable),h},_h=(t,e)=>{if("relative"===t)return e;if(t instanceof Bi)return t;const i=t.x instanceof $s?t.x.ct:t.x.x,s=t.y instanceof $s?t.y.ct:t.y.y;return Di(i,s)},Lh=(t,e,i,s,r)=>{if(i){const n=t,o=e,h=th(o)?o:Ri(o)?s:void 0;if(h&&zi(i)){const t=at(n,h,r.ct);return r.fo({engineX:t.x,engineY:t.y})}if(h&&Ri(i))return at(n,h,s);if(h&&th(i))return at(n,h,i)}else{const i=t;if(Ri(e)){const t=r.do(i);return at({x:t.engineX,y:t.engineY},r.ct,s)}if(th(e)){const t=e,s=r.do(i);return at({x:s.engineX,y:s.engineY},r.ct,t)}}throw new Error("translateCoordinate unexpected error. Input or target coordinate system not recognized.")};class Dh{constructor(t,e,i,s,n,o,h,a){this.coordsRelative="relative",this.coordsClient="client",this.Og=[],this.Lg=[],this.P=new r.Eventer,this.Rg=void 0,this.Eg=void 0,this.zg=void 0,this.Ft=S(0,0,0,0),this.Ti=!1,this.Vg=()=>{this.Ng=!0,this.Gg.Ss()},this.Wg=t=>e=>{const i=this.Og.indexOf(e);-1!==i&&this.Og.splice(i,1),this.ls.Ss(),t.G()},this.Hg=t=>{const e=this.Lg.indexOf(t);-1!==e&&this.Lg.splice(e,1),this.ls.Ss()},this.Ng=!0,this.ff=t,this.Ug=i,this.Gg=s,this.removePanel=n,this.Ji=e.ls.Ji;const l=e.ls.Ht();if(this.uiScale=i.d2({scaleXYConstructor:_i}).bi(0,100).vi(0,100).q(l),this.pixelScale=i.d2({scaleXYConstructor:_i}).bi(0,this.uiScale.x.getCellSize()).vi(0,this.uiScale.y.getCellSize()).q(l),this.engine=e.ls.$g,this.ls=e.ls.jg,this.ss=this.ls.ss.es(this,{}),this.Yg=()=>e.Xg("unidentified ui"),this.Zg=e.Kg(),this.qg=this.Gg._e(this.uiScale).we(u(0,0)).q(u(100,100)).Me(o).ve(h).setMouseMoveEventHandler(((t,e)=>this.P.emit("mouseMovePanelBackground",this,e))).setMouseEnterEventHandler(((t,e)=>this.P.emit("mouseEnterPanelBackground",this,e))).setMouseLeaveEventHandler(((t,e)=>this.P.emit("mouseLeavePanelBackground",this,e))).setMouseDownEventHandler(((t,e)=>this.P.emit("mouseDownPanelBackground",this,e))).setMouseUpEventHandler(((t,e)=>this.P.emit("mouseUpPanelBackground",this,e))).setMouseClickEventHandler(((t,e)=>this.P.emit("mouseClickPanelBackground",this,e))).setMouseDoubleClickEventHandler(((t,e)=>this.P.emit("mouseDoubleClickPanelBackground",this,e))).setMouseWheelEventHandler(((t,e)=>this.P.emit("mouseWheelPanelBackground",this,e))).setMouseDragStartEventHandler(((t,e,i)=>this.P.emit("mouseDragStartPanelBackground",this,e,i))).setMouseDragEventHandler(((t,e,i,s,r)=>this.P.emit("mouseDragPanelBackground",this,e,i,s,r))).setMouseDragStopEventHandler(((t,e,i,s)=>this.P.emit("mouseDragStopPanelBackground",this,e,i,s))).setTouchStartEventHandler(((t,e)=>this.P.emit("touchStartPanelBackground",this,e))).setTouchMoveEventHandler(((t,e)=>this.P.emit("touchMovePanelBackground",this,e))).setTouchEndEventHandler(((t,e)=>this.P.emit("touchEndPanelBackground",this,e))),a){const t=a.on(this.Vg);this.Jg=()=>a.off(t)}else{const t=e.ls.lo(this.Vg);this.Qg=e.ls.uo.bind(e.ls,t)}this.Rg=n}getTheme(){return this.Ji}getSizePixels(){return this.pixelScale.getInnerIntervalPixels()}setBackgroundFillStyle(t){return this.qg.Me(t),this.Gg.Ss(),this}getBackgroundFillStyle(){return this.qg.Th()}setBackgroundStrokeStyle(t){return this.qg.ve(t),this.Gg.Ss(),this}getBackgroundStrokeStyle(){return this.qg.Un()}translateCoordinate(t,e,i){return Lh(t,e,i,this.pixelScale,this.ls)}tp(t){return this.Og.push(t),this.ls.Ss(),t}ip(t){return this.Lg.push(t),this.ls.Ss(),t}addUIElement(t=Qn,e=this.uiScale){e=_h(e,this.pixelScale);const i=this.Yg();return this.tp(Bh(t,i,this.uiScale,e,this.Wg(i),this.Ji))}addLegendBox(t=co,i=this.uiScale){i=_h(i,this.pixelScale);const s=this.ip(Bh(t,this.Zg,this.uiScale,i,this.Hg,this.Ji));return s.setDraggingMode(e.UIDraggingModes.notDraggable),void 0!==i&&i!==this.uiScale||(void 0===t||"vertical"===t.getAlignment()?s.setOrigin(ws.RightCenter).setPosition({x:100,y:50}):s.setOrigin(ws.CenterBottom).setPosition(this.uiScale.Jt({x:50,y:0},{x:0,y:3}))),s}dispose(){return this.Ti||(this.Ti=!0,this.Qg&&this.Qg(),this.Jg&&this.Jg(),zh(this.uiScale),zh(this.pixelScale),this.Eg&&this.Eg(),this.Gg.G(),this.Zg.G(),this.Og.slice().forEach((t=>{t.dispose()})),this.Lg.slice().forEach((t=>{t.dispose()})),this.ls.Ss(),this.Rg&&this.Rg(this),this.P.emit("dispose",this)),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}saveToFile(t,e,i){return Fh(this.engine,t,e,i),this}xa(t){this.Ft=t,this.Vg()}Y(){return this.pixelScale.Y(),this.uiScale.Y(),this}X(){return this.pixelScale.X(),this.uiScale.X(),this}Ae(t){if(this.Ng){const t=this.Gg.ls.Ht(),e=t.x,i=t.y;this.uiScale.q(e,i),this.pixelScale.q(e,i);const s=[this.Ft.left,this.Ft.right],r=[this.Ft.bottom,this.Ft.top];this.uiScale.Si(s),this.uiScale.xi(r);const n=this.uiScale.getInnerIntervalPixels();this.pixelScale.bi(0,n.x).Si(s).vi(0,n.y).xi(r),this.P.emit("resize",this,n.x,n.y,e,i)}this.Ng=!1}sp(){for(let t=0;t{t.Et&&t.Et()};class Oh extends Dh{constructor(t,e,i,s,r,n){super(t,e,i,e.hp("uipanel bg",0),s,e.ls.Ji.uiPanelBackgroundFillStyle,e.ls.Ji.uiPanelBackgroundStrokeStyle,n),this.ep(r,this.pixelScale)}setMinimumSize(t){return this.Uc=t,this.ls.Ss(),this}getMinimumSize(){return this.Uc}Ae(t){super.Ae(t),super.sp()}}const Rh=S(10,10,10,10);class Vh extends Dh{constructor(t,e,i,s,r,n,o,h,a,l){super(t,e,i,s,r,n,o,l),this.rp={},this.Qo=Rh,this.Ze=!0,this.np=e.op("chart internal ui",0),this.ap=this.np.Sr(this.uiScale).Ch("Chart").we(u(50,100)).Sa(u(0,1)).Ih(h).Me(a).setMouseInteractions(!1),this.lp=this.ss.xg([this.ap]).ys(this.Ji.effectsText)}setAnimationsEnabled(t){return this.Ze=t,this}getAnimationsEnabled(){return this.Ze}setTitle(t){return this.ap.Ch(t),this.ls.Ss(),this}getTitle(){return this.ap.wh()}getTitleSize(){return this.ap.Ts().Ic()}setTitleFillStyle(t){return this.ap.Me(t),this.Vg(),this}getTitleFillStyle(){return this.ap.Th()}setTitleFont(t){return this.ap.Ih(t),this.Vg(),this}getTitleFont(){return this.ap.Fh()}setTitleRotation(t){return this.ap.Ph(t),this.ls.Ss(),this}getTitleRotation(){return this.ap.Dh()}setTitleEffect(t){return this.lp.ys(t),this.ls.Ss(),this}getTitleEffect(){return this.lp.xs()}setTitleMargin(t){var e,i;return this.rp="object"==typeof t?this.rp?(e=this.rp,{left:void 0!==(i=t).left?i.left:e.left,top:void 0!==i.top?i.top:e.top,right:void 0!==i.right?i.right:e.right,bottom:void 0!==i.bottom?i.bottom:e.bottom}):t:{left:t,top:t,right:t,bottom:t},this.Vg(),this}getTitleMargin(){return this.rp}setPadding(t){return this.Qo="object"==typeof t?b(this.Qo,t):{left:t,top:t,right:t,bottom:t},this.Vg(),this}getPadding(){return this.Qo}up(t){const e=t.cp(),i=null==e?void 0:e.height,s=null==e?void 0:e.width;if(void 0!==i&&void 0!==s)return{x:i/2,y:s/2}}dispose(){return super.dispose(),this.np.G(),this}}const Nh={dp:(t,e)=>t.Th()!==z&&0!==t.wh().length&&t.getVisible()?t.Ts().Ic().y:0,fp(t,e){t.we(u(50,100)).xa({top:void 0!==e.top?e.top:10,right:e.right||0,left:e.left||0,bottom:e.bottom||0})}};var Gh;e.SliceLabelIndices=void 0,(Gh=e.SliceLabelIndices||(e.SliceLabelIndices={}))[Gh.LabelsInsideSlices=0]="LabelsInsideSlices",Gh[Gh.LabelsOnSides=1]="LabelsOnSides";const Hh={SortByName:(t,e)=>t.getName().localeCompare(e.getName(),void 0,{numeric:!0}),SortByValueAscending:(t,e)=>t.getAnimatedValue()-e.getAnimatedValue(),SortByValueDescending:(t,e)=>e.getAnimatedValue()-t.getAnimatedValue(),None:()=>0},Uh={Name:t=>`${t.getName()}`,NamePlusValue:t=>`${t.getName()}: ${Math.round(t.getAnimatedValue())}`,NamePlusRelativeValue:(t,e)=>`${t.getName()}: ${(100*e).toFixed(2)}%`};class Wh extends Gi{constructor(){super(...arguments),this.bs="Slice",this.u=0}}const Xh=(t,e)=>{Kt(e),t.setExploded(!t.getExploded())};class Yh extends Wh{}class jh extends Yh{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.gp=!1,this.pp=z,this.mp=z,this.yp=this.u,this.Sp=this.gp?1:0,this.xp=this.getVisible(),this.bp=j((()=>this.Ki.ls.Ss())),this.vp=j((()=>this.Ki.ls.Ss())),this.Mp=()=>{this._p=void 0},this.Ap=()=>{this.wp=void 0},this.index=t,this.Ki=s,this.scale=r,this.qi=n,this.kp=e.Dc(r).us(this.getHighlight()),this.cs(this.kp),this.Ve=i.Sr(r).us(this.getHighlight()),this.cs(this.Ve,{isText:!0}),this.onMouseClick(Xh),this.onTouchEnd(Xh)}setValue(t){return this.Ki.getAnimationsEnabled()?this.xp&&this.Cp(this.yp,t):this.yp=t,this.u=t,this.Ki.ls.Ss(),this}getValue(){return this.u}setExploded(t){if(t&&!1===this.Ki.getMultipleSliceExplosion()){const t=this.Ki.getSlices();for(let e=0;e{this.Sp=t,this.Ki.ls.Ss()})),this.wp.onEveryAnimationEnd(this.Ap),this.gp=!this.gp):!1!==this.Ki.getMultipleSliceExplosion()||t?(this.Sp=this.gp?0:1,this.gp=!this.gp):(this.Sp=0,this.gp=!this.gp),this.Ki.ls.Ss(),this}getExploded(){return this.gp}setVisible(t){return this.xp=t,!1===t?this.Ki.getAnimationsEnabled()&&this.yp>0?(this._p&&(this._p.finish(!1),this._p=void 0),this.Cp(this.yp,0,(()=>super.setVisible(!1)))):(this.yp=0,super.setVisible(!1)):this.Ki.getAnimationsEnabled()?(this._p&&(this._p.finish(!1),this._p=void 0),super.setVisible(!0),this.Cp(this.yp,this.u)):(this.yp=this.u,super.setVisible(!0)),this}Cp(t,e,i){this._p=this.bp(300,X.ease)([[t,e]],(([t])=>{this.yp=t,this.Ki.ls.Ss()})),this._p.onEveryAnimationEnd(this.Mp),i&&this._p.onAnimationEnd(i)}setStyle(t,e,i,s){this.pp=t,this.mp=i,this.kp.Me(this.pp).ve(e),this.Ve.Me(this.mp).Ih(s);for(let t=0;tri(e,si(yi(.5*(t.Ol()+t.ui())*Math.PI/180),i)),$h=(t,e,i,s,r,n)=>{const o=t.length;let h=90;for(let a=0;a{const e=t.getSlices();for(let t=0;t{const e=this.Tp.indexOf(t);e>=0&&(this.Tp.splice(e,1),this.Gp())},this.ff.wn||this.ff.An||this.ls.Mn(7),this.Wp=e.Hp("pieChart bottom",0),this.$p=e.Hp("pieChart top",1),this.ap.Ch("Pie Chart"),this.ep(r,this.pixelScale),this.onBackgroundMouseDoubleClick(qh);const h=Wi(new Xi(qh));this.onBackgroundTouchStart(h.onTouchStart),this.onBackgroundTouchMove(h.onTouchMove),this.onBackgroundTouchEnd(h.onTouchEnd),o&&this.setAnimationsEnabled(!1)}addSlice(t,e){const i=new jh(this.Lp,this.Wp,this.$p,this,this.pixelScale,this.Np,this.Ji,this.ls.ss);this.Lp+=1,i.setName(t);const s=this.Ze;return this.Ze=!1,i.setValue(e),this.Ze=s,i.setEffect(this.zp),this.jp(i),this.Tp.push(i),this.Gp(),i.setHighlightOnHover(this.Dp),i}addSlices(t){const e=[];for(let i=0;ie.ss.rs.ys(t))),this.ls.Ss(),this}getSliceEffect(){return this.zp}setSliceSorter(t){return this.Fp=t,this.Tp=this.Tp.sort(this.Fp),this.ls.Ss(),this}getSliceSorter(){return this.Fp}setLabelFillStyle(t){this.Op="function"==typeof t?t(this.Op):t;for(let t=0;te.ss.hs.ys(t))),this.ls.Ss(),this}getLabelEffect(){return this.Vp}setLabelFormatter(t){return this.Yp=t,this.ls.Ss(),this}getLabelFormatter(){return this.Yp}setSliceHighlightOnHover(t){return this.Dp=t,this.Tp.forEach((e=>e.setHighlightOnHover(t))),this}Ae(t){super.Ae(t),Nh.fp(this.ap,this.rp),super.sp();const e=Nh.dp(this.ap,this.rp),i=u(this.pixelScale.x.getInnerInterval()-(this.Qo.left+this.Qo.right),this.pixelScale.y.getInnerInterval()-(this.Qo.bottom+this.Qo.top+e)),s=u(this.Qo.left+i.x/2,this.Qo.bottom+i.y/2);if(this.ad){const t=this.ad;this.Tp.forEach((e=>{this.jp(e,new V({color:t.getColors(e.getAnimatedValue())}))}))}for(let t=0;t0;this.Tp[t].kp.setVisible(e),this.Tp[t].Ve.setVisible(e)}this.Tp=this.Tp.sort(this.Fp);const r=this.Tp.filter((t=>t.getAnimatedValue()>0));let n=0;for(let t=0;t0?h/n:0);var h;for(let t=0;tt.dispose())),this}}const Kh={UserSeries:{type:"ApplicationType",args:{type:"UserSeries"}},InternalUI:{type:"ApplicationType",args:{type:"InternalUI"}}},Qh=(...t)=>{const e=[];return t.forEach((t=>{var i;t&&"object"==typeof(i=t)&&i&&"pattern"in i&&e.push({type:"DataPattern",args:t})})),e};var ta;!function(t){t[t.TopRight=0]="TopRight",t[t.TopLeft=1]="TopLeft",t[t.BottomLeft=2]="BottomLeft",t[t.BottomRight=3]="BottomRight"}(ta||(ta={}));const ea=(t,e,i,s,r,n,o,h,a)=>{if(0===t.length)return;const l=s.x+e*r.x*.5,c=1===i?Math.max:Math.min;let d;for(let r=0;r{const o=r*t.getAnimatedExplosion(),h=t.kp,a=t.Ve,l=Jh(h,i,s+n+o),c=ci(a.ca().y,l,i),d=u(a.ca().x-e*(n+a.Ht().x),c.y);return-1===e&&c.xd.x?[l,d]:[l,c,d]},sa=(...t)=>e=>{const i=(t=>{let e=.5*(t.kp.Ol()+t.kp.ui());for(e%=360;e<0;)e+=360;return e<=90?ta.TopRight:e<180?ta.TopLeft:e<270?ta.BottomLeft:ta.BottomRight})(e);return t.includes(i)},ra=sa(ta.BottomLeft,ta.TopLeft),na=sa(ta.BottomRight,ta.TopRight),oa=sa(ta.TopLeft,ta.TopRight),ha=sa(ta.BottomLeft,ta.BottomRight);class aa extends Zh{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.Yp=Uh.NamePlusValue,this.Zp=5,this.Kp=5,this.qp=[],this.Jp=this.Ji.pieChartConnectorStrokeStyle,this.setPadding({bottom:50})}setLabelConnectorStyle(t){this.Jp=t;for(let t=0;t{if(qi(t)){const e=t.getThickness(),i=t.getFillStyle();if(N(i))return 1===e?sr:new nr({size:e,fillStyle:i,shape:"sphere"})}return sr};class da{constructor(t,e,i,s){this.sm=[],this.hm=t,this.rm=e,this.nm=i,this.om=s}am(){this.sm.forEach((t=>t.Ha())),this.nm&&this.nm();const t=[];return{add:(e,i)=>{t.push({instanceUniqueProperties:e,instanceSharedProperties:i})},finishPlot:()=>{const e=[];t.forEach((t=>{const i=e.find((e=>((t,e)=>{const i=Object.keys(t);for(const s of i)if(t[s]!==e[s])return!1;return!0})(e.sharedProperties,t.instanceSharedProperties)));i?i.instances.push(t.instanceUniqueProperties):e.push({sharedProperties:t.instanceSharedProperties,instances:[t.instanceUniqueProperties]})}));const i=this.sm.slice();e.forEach((t=>{let e=i.pop();e||(e=this.hm(),this.sm.push(e)),this.rm(e,t.instances,t.sharedProperties)})),i.forEach((t=>{t.dispose();const e=this.sm.indexOf(t);e<0?me(0,(()=>{})):this.sm.splice(e,1)})),this.om&&this.om(this.sm)}}}lm(){this.sm.forEach((t=>{t.dispose()})),this.sm.length=0}}class fa{constructor(t){this.um=[],this.dm=t}am(){return this.fm(),{add:()=>this.gm(),finishPlot:()=>{this.pm()}}}gm(){let t=this.um.find((t=>t.isFree));return t||(t={isFree:!1,shape:this.dm()},this.um.push(t)),t.isFree=!1,t.shape}fm(){this.um.forEach((t=>{t.isFree=!0}))}pm(){this.um.filter((t=>t.isFree)).forEach((t=>{t.shape.dispose(),this.um.splice(this.um.indexOf(t),1)}))}lm(){this.um.forEach((t=>t.shape.dispose())),this.um.length=0}}class ga{constructor(t,e,i,s,n,o,h,a,l,u){this.P=new r.Eventer,this.u=0,this.Fi=!0,this.Ti=!1,this.Ss=t,this.ym=e,this.Sm=i,this.xm=s,this.bm=n,this.vm=o,this.Qc=h,this.Mm=a,this._m=l,this._c=u}setValue(t){return t===this.u||(this.u=t,this.Ss(),this.P.emit("valueChange",this.u)),this}getValue(){return this.u}setTickStyle(t){return this.Sm="function"==typeof t?t(this.Sm):t,this.Ss(),this}getTickStyle(){return this.Sm}setTickLength(t){return this.xm=t,this.Ss(),this}getTickLength(){return this.xm}setGridStrokeStyle(t){return this.bm="function"==typeof t?t(this.bm):t,this.Ss(),this}getGridStrokeStyle(){return this.bm}setTextPadding(t){return this.vm=t,this.Ss(),this}getTextPadding(){return this.vm}setTextRotation(t){return this.Qc=t,this.Ss(),this}getTextRotation(){return this.Qc}setTextFillStyle(t){return this.Mm="function"==typeof t?t(this.Mm):t,this.Ss(),this}getTextFillStyle(){return this.Mm}setTextFont(t){return this._m="function"==typeof t?t(this._m):t,this.Ss(),this}getTextFont(){return this._m}setTextFormatter(t){return this._c=t,this.Ss(),this}onValueChange(t){return this.P.on("valueChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}dispose(){return this.Ti||(this.Ti=!0,this.ym(),this.Ss(),this.P.emit("dispose",this)),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setVisible(t){const e=this.Fi!==t;return this.Fi=t,e&&(this.P.emit("visibleStateChanged",this,this.Fi),this.Ss()),this}getVisible(){return this.Fi}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}}class ya extends $s{constructor(t,e,i,s,r,n,o,h,a){super(t,e,i,s,h,{numeric:e.Am({x:t.ls.Ji.xAxis3DNumericTicks,y:t.ls.Ji.yAxis3DNumericTicks,z:t.ls.Ji.zAxis3DNumericTicks}),datetime:e.Am({x:t.ls.Ji.xAxis3DDateTimeTicks,y:t.ls.Ji.yAxis3DDateTimeTicks,z:t.ls.Ji.zAxis3DDateTimeTicks}),time:e.Am({x:t.ls.Ji.xAxis3DTimeTicks,y:t.ls.Ji.yAxis3DTimeTicks,z:t.ls.Ji.zAxis3DTimeTicks})},{type:"linear"}),this.Id=[],this.wm=()=>{},this.km=()=>{},this.Cm=()=>{},this.Tm=()=>{},this.chart=t,this.Fm=r,this.Im=n,this.Pm=o,this.Dm=this.Fm.ct;const l=this.yh.Am({x:this.Ji.xAxis3DStrokeStyle,y:this.Ji.yAxis3DStrokeStyle,z:this.Ji.zAxis3DStrokeStyle});this.Bm=this.Fm.tm([Kh.InternalUI]).Pe(l).Om(ca(l)).setMouseInteractions(!1),this.kh=this.Im.Sr(this.Pm).setMouseInteractions(!1).Me(e.Am({x:t.ls.Ji.xAxis3DTitleFillStyle,y:t.ls.Ji.yAxis3DTitleFillStyle,z:t.ls.Ji.zAxis3DTitleFillStyle})).Ih(e.Am({x:t.ls.Ji.xAxis3DTitleFont,y:t.ls.Ji.yAxis3DTitleFont,z:t.ls.Ji.zAxis3DTitleFont})),this.Lm=new fa((()=>this.Im.Sr(this.Pm))),this.Rm=new da((()=>this.Fm.Tg().setMouseInteractions(!1)),((t,e,i)=>{t.Ha().Pe(i.lineStyle),e.forEach((({positions:e})=>t.Wa(e)))})),this.ss=a,this.Bh=this.ss.xg([this.kh]).ys(s.effectsText),this.Bm.setMouseEnterEventHandler(this.wm).setMouseLeaveEventHandler(this.km).setMouseDragEventHandler(this.Cm).setMouseDragStopEventHandler(this.Tm),i.eg=this}setTickStrategy(t,e){return super.Mh(t,e)}getTickStrategy(){return this.He}addCustomTick(){const t=new ga((()=>this.chart.ls.Ss()),(()=>{const e=this.Id.indexOf(t);e>=0&&this.Id.splice(e,1)}),this.Ji.xAxis3DNumericTicks.majorTickStyle.tickStyle,this.Ji.xAxis3DNumericTicks.majorTickStyle.tickLength,this.Ji.xAxis3DNumericTicks.majorTickStyle.gridStrokeStyle,this.Ji.xAxis3DNumericTicks.majorTickStyle.tickPadding,this.Ji.xAxis3DNumericTicks.majorTickStyle.labelRotation,this.Ji.xAxis3DNumericTicks.majorTickStyle.labelFillStyle,this.Ji.xAxis3DNumericTicks.majorTickStyle.labelFont,(t=>this.formatValue(t)));return this.Id.push(t),this.chart.ls.Ss(),t}setStrokeStyle(t){return this.Bm.Pe(t).Om(ca(this.Bm.Yl())),this.chart.ls.Ss(),this}getStrokeStyle(){return this.Bm.Yl()}setMouseInteractions(t){return this}setVisible(t){return super.setVisible(t),this.Bm.setVisible(t),!1===t&&(this.Rm.lm(),this.Lm.lm()),this.Im.Ss(),this}Ag(){return this.chart.getSeries()}Em(t){return Math.abs(this.ct.J(t)*this.Fm.zm(1))}pr(t,e,i){const s=Math.abs(this.ct.J(e-t)*this.Fm.zm(1));return{min:t-i*s,max:e+i*s}}Qh(t,e){return new pa(e,t,this.Im,this.Pm,this.Fm)}tr(t,e){const i=this.Vm(e,t.u,t.dh.Jh.tickLength,t.dh.Jh.tickPadding);return t.Ve.we(i.labelPosition).Sa(i.labelAlignment),i}Vm(t,e,i,s){const{wuSize:r,start:n,end:o,tickDirection3D:h,tickDirection2D:a}=t,l=(e-this.ct.getInnerStart())/(this.ct.getInnerEnd()-this.ct.getInnerStart()),c=Ce.addVec(We(n,o,l),Ce.multiplyVec(Ce.multiply(h,this.Fm.zm(.5*this.Bm.Yl().getThickness())),r)),d=Ce.addVec(c,Ce.multiplyVec(Ce.multiply(h,this.Fm.zm(i)),r)),f=this.Fm.Nm(d)||u(0,0);return{labelPosition:ri(at(f,this.chart.engine.scale,this.Pm),si(a,s)),labelAlignment:{x:-a.x,y:-a.y},posTickEnd3D:d,posTickStart3D:c,tickPositionRelative:l}}kg(t,e,i){const{wuSize:s,start:r,end:n,tickDirection3D:o}=e,h=(t-this.ct.getInnerStart())/(this.ct.getInnerEnd()-this.ct.getInnerStart()),a=Ce.addVec(We(r,n,h),Ce.multiplyVec(Ce.multiply(o,this.Fm.zm(.5*this.Bm.Yl().getThickness())),s)),l=Ce.addVec(a,Ce.multiplyVec(Ce.multiply(o,this.Fm.zm(10)),s)),c=this.Fm.Nm(a)||u(0,0),d=this.Fm.Nm(l)||u(0,0);return this.Im.De(this.Pm).Oe(c).Be(d).Pe(new $i({fillStyle:new V({color:E(120*i)}),thickness:1}))}dr(t,e){return ma(t,e,this.ct)}Ae(t){if(!this.Fi)return;const e=Math.min(this._h,this.Ah),i=Math.max(this._h,this.Ah),s=this.Dm,r=f(s.x.st(),s.y.st(),s.z.st());let n,o;this.Gm()?(n=f(s.x.getInnerEnd(),s.y.getInnerStart(),s.z.getInnerStart()),o=f(s.x.getInnerEnd(),s.y.getInnerStart(),s.z.getInnerEnd())):(n=f(s.x.getInnerStart(),s.y.getInnerStart(),s.z.getInnerStart()),o=this.yh.Wm(f(s.x.getInnerEnd(),s.y.getInnerEnd(),s.z.getInnerEnd()),n));const h=this.yh.bd,a=this.Fm.Nm(n)||u(0,0),l=this.Fm.Nm(o)||u(0,0),c=We(n,o,.5),d=Ce.addVec(c,Ce.multiplyVec(Ce.multiply(h,-1),r)),g=this.Fm.Nm(c)||u(0,0),y=this.Fm.Nm(d)||u(0,0),p=ti(ni(at(g,this.chart.engine.scale,this.Pm),at(y,this.chart.engine.scale,this.Pm)));this.Bm.Ha().Wa([n,o]);const{gridlinePositionA:m,gridlinePositionB:S,gridlinePositionC:x}=this.yh.Hm(t),b=t=>({x:-1===t.x?this.Dm.x.getInnerStart():1===t.x?this.Dm.x.getInnerEnd():0,y:-1===t.y?this.Dm.y.getInnerStart():1===t.y?this.Dm.y.getInnerEnd():0,z:-1===t.z?this.Dm.z.getInnerStart():1===t.z?this.Dm.z.getInnerEnd():0}),v=b(m),M=b(S),A=b(x),w={physicalAxisSize:ii(ni(a,l)),wuSize:r,start:n,end:o,tickDirection3D:h,tickDirection2D:p,gridlinePositionA:v,gridlinePositionB:M,gridlinePositionC:A},T=this.Hh(w),E=this.Rm.am();for(const[t,e]of this.Ue)for(const[,i]of e){const e=T.get(i);if(!e)continue;const s=this.Um(w,e);E.add({positions:[s.tickStroke.start,s.tickStroke.end]},{lineStyle:t.Jh.tickStyle}),s.gridStroke&&E.add({positions:s.gridStroke},{lineStyle:t.Jh.gridStrokeStyle})}const I=this.Lm.am(),C={x:0,y:0};this.Id.forEach((t=>{if(!t.Fi||t.ui)return;const s=this.Vm(w,t.u,t.xm,t.vm),r=this.Um(w,s),n=I.add().we(s.labelPosition).Sa(s.labelAlignment).Me(t.Mm).Ih(t._m).Ch(t._c(t.u)).Ph(t.Qc).Ts().Ht();C.x=Math.max(C.x,n.x),C.y=Math.max(C.y,n.y),E.add({positions:[r.tickStroke.start,r.tickStroke.end]},{lineStyle:t.Sm}),r.gridStroke&&E.add({positions:r.gridStroke},{lineStyle:t.bm})})),I.finishPlot(),E.finishPlot();const P=this.er(((t,e)=>{const i=e.Ve.Ht();return t.x=Math.max(t.x,i.x),t.y=Math.max(t.y,i.y),t}),{x:C.x,y:C.y}),k=Math.atan((l.y-a.y)/(l.x-a.x));this.kh.Sa({x:0,y:0}).Ph(180*-k/Math.PI);const F=Ce.addVec(c,Ce.multiplyVec(Ce.multiply(h,this.Fm.zm(.5*this.Bm.Yl().getThickness()+this.rr(((t,e)=>Math.max(t,e.tickLength)),0))),r)),B=this.Fm.Nm(F)||u(0,0),_=ri(at(B,this.chart.engine.scale,this.Pm),ri(ri(oi(P,p),si(p,this.rr(((t,e)=>Math.max(t,e.labelPadding)),0))),oi(si(this.kh.Ts().Ht(),.5),p)));this.kh.we(_),this.Bm.$m={overrideFollowing:!1,skipMousePicking:!1}}Um(t,e){const{gridlinePositionA:i,gridlinePositionB:s,gridlinePositionC:r}=t,n=e.posTickStart3D,o=e.posTickEnd3D,h=e.tickPositionRelative;let a;return It(h,0)||It(h,1)||(a=[this.jm()?{...i,x:n.x}:this.Ym()?{...i,y:n.y}:this.Gm()?{...i,z:n.z}:{x:0,y:0,z:0},this.jm()?{...s,x:n.x}:this.Ym()?{...s,y:n.y}:this.Gm()?{...s,z:n.z}:{x:0,y:0,z:0},this.jm()?{...r,x:n.x}:this.Ym()?{...r,y:n.y}:this.Gm()?{...r,z:n.z}:{x:0,y:0,z:0}]),{gridStroke:a,tickStroke:{start:n,end:o}}}Oh(){super.Oh(),this.Rm.lm(),this.Lm.lm()}jm(){return this.yh.jm()}Ym(){return this.yh.Ym()}Gm(){return this.yh.Gm()}}class pa extends qs{constructor(t,e,i,s,r,n){super(t,e,i,s,n),this.wd=r}}const ma=(t,e,i)=>Ct(t+.1*(e-t)+Math.abs(i.st())/100*Math.sign(e-t),Math.min(t,e),Math.max(t,e)),Sa=(t,e,i,s)=>({nr:()=>{const i=t();let s;for(const t of i){if(!t.Xm())continue;const i=e(t);s=void 0===i?s:void 0!==s?Math.min(s,i):i}return s},ar:()=>{const e=t();let s;for(const t of e){if(!t.Xm())continue;const e=i(t);s=void 0===e?s:void 0!==s?Math.max(s,e):e}return s},ur:()=>{const e=t();let i;for(const t of e){if(!t.Xm())continue;const e=s(t);i=void 0===e?i:void 0!==i?Math.max(i,e):e}return i}}),xa=t=>({...Sa(t,(t=>t.getYMin()),(t=>t.getYMax()),(t=>t.ur().y)),Am:t=>t.y,Wm:(t,e)=>({x:e.x,y:t.y,z:e.z}),bd:f(-1,0,0),Hm:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(e.x,0,e.z),gridlinePositionB:f(e.x,0,-e.z),gridlinePositionC:f(-e.x,0,-e.z)}},jm:()=>!1,Ym:()=>!0,Gm:()=>!1}),ba=t=>({...Sa(t,(t=>t.getZMin()),(t=>t.getZMax()),(t=>t.ur().z)),Am:t=>t.z,Wm:(t,e)=>({x:e.x,y:e.y,z:t.z}),bd:f(1,0,0),Hm:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(e.x,-e.y,0),gridlinePositionB:f(e.x,e.y,0),gridlinePositionC:f(-e.x,e.y,0)}},jm:()=>!1,Ym:()=>!1,Gm:()=>!0});class va extends Gi{constructor(t,e,i,s,r){super(t,e,s,r),this.Zm=Bo,this.Km=!0,this.qm=!0,this.Ki=t,this.Fm=i,this.Qi=new Map,this.onMouseWheel(this.Ki.Jm),this.onMouseDrag(this.Ki.Qm),this.onTouchStart(this.Ki.ty.onTouchStart),this.onTouchMove(this.Ki.ty.onTouchMove),this.onTouchEnd(this.Ki.ty.onTouchEnd)}setAutoScrollingEnabled(t){return this.Km=t,this.Ki.ls.Ss(),this}getAutoScrollingEnabled(){return this.Km}setColorShadingStyle(t){return this.Zm=t,this.Qi.forEach(((e,i)=>i.iy(t))),this.Fm.Ss(),this}getColorShadingStyle(){return this.Zm}setDepthTestEnabled(t){return this.qm=t,this.Qi.forEach(((e,i)=>i.sy(t))),this.Fm.Ss(),this}getDepthTestEnabled(){return this.qm}ey(){}Ae(){}om(){}getXMax(){const t=this.Aa;return t?t._t():void 0}getXMin(){const t=this.Aa;return t?t.Mt():void 0}getYMax(){const t=this.Aa;return t?t.wt():void 0}getYMin(){const t=this.Aa;return t?t.At():void 0}getZMax(){const t=this.Aa;return t?t.hy():void 0}getZMin(){const t=this.Aa;return t?t.ny():void 0}ur(){const t=this.Aa;return t?f(t.sl(),t.el(),t.oy()):f(0,0,0)}}class Ma extends va{constructor(t,e,i,s,r,n){super(t,e,i,s,n),this.bs="Box Series 3D",this.ly=.25,this.ld=()=>de(this.Se),this.Se=ye(this.Ji.boxSeries3DFillStyle,r),this.Aa=this.Fm.gy().sy(this.qm).Me(this.Se).uy(this.ly).us(this.getHighlight()),this.cs(this.Aa)}invalidateData(t){const e=t.length;if(0===e)return this;const i=t[0];if(!i)return this;let s;if("xMin"in i||"yMin"in i||"zMin"in i||"xMax"in i||"yMax"in i||"zMax"in i){s=[];for(let i=0;ide(this.jl.getFillStyle())}setStrokeStyle(t){this.jl="function"==typeof t?t(this.jl):t;const e=this.jl;return this.Aa.Pe(e),this.Fm.Ss(),this}getStrokeStyle(){return this.jl}add(t){return(t=Array.isArray(t)?t:[t])?(this.Aa.Wa(t.slice()),this.Fm.Ss(),this):this}clear(){return this.Aa.Ha(),this}getPointAmount(){const t=this.Aa;return t.Ua()+t.$a()}Xm(){return this.Km&&this.getPointAmount()>0&&this.getVisible()}ke(t,e){t.us(e),this.Fm.Ss()}attach(t,e){return super.attach(t,e),ce(t,this.Ji,{stroke:this.jl}),this}}class wa extends Aa{constructor(t,e,i,s,r,n){super(t,e,i,s,n),this.bs="Line Series 3D",this.jl=ye(s.lineSeries3DStrokeStyle,r),this.my=vr.pointStyle3D,this.yy(this.jl),this.Aa=this.Fm.tm([Kh.UserSeries]).sy(this.qm).Pe(this.jl).Om(this.my).us(this.getHighlight()),this.cs(this.Aa)}setStrokeStyle(t){super.setStrokeStyle(t),this.yy(this.jl);const e=this.my;return this.Aa.Om(e),this}yy(t){const e=new ur.Triangulated({shape:"sphere",fillStyle:t.getFillStyle(),size:t.getThickness()});this.my=e}}class Ta extends Aa{constructor(t,e,i,s,r,n){super(t,e,i,s,n),this.bs="Point Line Series 3D",this.ld=()=>de(this.jl.getFillStyle())||de(this.my.getFillStyle()),this.my=ye(s.pointLineSeries3DPointStyle,r),this.jl=ye(s.lineSeries3DStrokeStyle,r),this.Sy(),this.Aa=this.Fm.tm([Kh.UserSeries]).sy(this.qm).Pe(this.jl).Om(this.my).us(this.getHighlight()),this.cs(this.Aa)}setPointStyle(t){return this.my="function"==typeof t?t(this.my):t,this.Sy(),this.Aa.Om(this.my),this.Fm.Ss(),this}getPointStyle(){return this.my}setStrokeStyle(t){super.setStrokeStyle(t);const e=this.jl,i=Math.abs(e.getThickness()),s=this.my;i>s.getSize()&&(this.my=s.setSize(i)),this.Sy();const r=this.my;return this.Aa.Om(r),this.Fm.Ss(),this}Sy(){const t=this.my,e=t.getSize();this.my=t.setSize(e)}ke(t,e){t.us(e),this.Fm.Ss()}}class Ea extends va{constructor(t,e,i,s,r,n){super(t,e,i,s,r)}add(t){return(t=Array.isArray(t)?t:[t])?(this.Aa.Wa(t.slice()),this.Fm.Ss(),this):this}clear(){return this.Aa.Ha(),this}getPointAmount(){const t=this.Aa;return t.Ua()+t.$a()}Xm(){return this.Km&&this.getPointAmount()>0&&this.getVisible()}ke(t,e){t.us(e),this.Fm.Ss()}attach(t,e){return super.attach(t,e),ce(t,this.Ji,{point3D:this.xy}),this}}class Ia extends Ea{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.bs="Point Series 3D",this.ld=()=>de(this.xy.getFillStyle());const o=void 0!==(null==n?void 0:n.automaticColorIndex)?n.automaticColorIndex:this.Ki.getSeries().length;this.xy=ye(s.pointSeries3DPointStyle,o);const h={individualPointColorEnabled:!1,individualPointSizeEnabled:!1,individualLookupValuesEnabled:!1,individualPointSizeAxisEnabled:!1,...n};this.Aa=this.Fm.vy(h).sy(this.qm).by(this.xy).us(this.getHighlight()),this.cs(this.Aa)}setPointStyle(t){this.xy="function"==typeof t?t(this.xy):t;const e=this.xy;return this.Aa.by(e),this.Fm.Ss(),this}getPointStyle(){return this.xy}}class Ca extends Ea{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.bs="Point Cloud Series 3D",this.ld=()=>de(this.xy.getFillStyle());const o=this.Ki.getSeries().length;this.xy=ye(s.pointCloudSeries3DPointStyle,o);const h={individualPointColorEnabled:!1,individualPointSizeEnabled:!1,individualLookupValuesEnabled:!1,individualPointSizeAxisEnabled:!1,...n};this.Aa=this.Fm.vy(h).by(this.xy).us(this.getHighlight()),this.cs(this.Aa)}setPointStyle(t){this.xy="function"==typeof t?t(this.xy):t;const e=this.xy;return this.Aa.by(e),this.Fm.Ss(),this}getPointStyle(){return this.xy}}const Pa={Triangulated:Ia,Pixelated:Ca};class ka extends Vh{constructor(t,e,i,s,r,n,o,h,a,l){super(t,e,i,s,r,n,o,h,a,l),this.My=[],this._y=0,this.Ay=t=>{const e=this.My.indexOf(t);e>=0&&(this.My.splice(e,1),this.P.emit("seriesDispose",this,t))},this.wy=()=>{this._y+=1},this.ky=()=>{this._y-=1},this.onSeriesBackgroundMouseEnter=t=>this.P.on("mouseEnterSeriesBackground",t),this.onSeriesBackgroundMouseLeave=t=>this.P.on("mouseLeaveSeriesBackground",t),this.onSeriesBackgroundMouseMove=t=>this.P.on("mouseMoveSeriesBackground",t),this.onSeriesBackgroundMouseDown=t=>this.P.on("mouseDownSeriesBackground",t),this.onSeriesBackgroundMouseUp=t=>this.P.on("mouseUpSeriesBackground",t),this.onSeriesBackgroundMouseClick=t=>this.P.on("mouseClickSeriesBackground",t),this.onSeriesBackgroundMouseDoubleClick=t=>this.P.on("mouseDoubleClickSeriesBackground",t),this.onSeriesBackgroundMouseDragStart=t=>this.P.on("mouseDragStartSeriesBackground",t),this.onSeriesBackgroundMouseDrag=t=>this.P.on("mouseDragSeriesBackground",t),this.onSeriesBackgroundMouseDragStop=t=>this.P.on("mouseDragStopSeriesBackground",t),this.onSeriesBackgroundMouseWheel=t=>this.P.on("mouseWheelSeriesBackground",t),this.onSeriesBackgroundTouchStart=t=>this.P.on("touchStartSeriesBackground",t),this.onSeriesBackgroundTouchMove=t=>this.P.on("touchMoveSeriesBackground",t),this.onSeriesBackgroundTouchEnd=t=>this.P.on("touchEndSeriesBackground",t),this.offSeriesBackgroundMouseEnter=t=>this.P.off(t,"mouseEnterSeriesBackground"),this.offSeriesBackgroundMouseLeave=t=>this.P.off(t,"mouseLeaveSeriesBackground"),this.offSeriesBackgroundMouseMove=t=>this.P.off(t,"mouseMoveSeriesBackground"),this.offSeriesBackgroundMouseDown=t=>this.P.off(t,"mouseDownSeriesBackground"),this.offSeriesBackgroundMouseUp=t=>this.P.off(t,"mouseUpSeriesBackground"),this.offSeriesBackgroundMouseClick=t=>this.P.off(t,"mouseClickSeriesBackground"),this.offSeriesBackgroundMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClickSeriesBackground"),this.offSeriesBackgroundMouseDragStart=t=>this.P.off(t,"mouseDragStartSeriesBackground"),this.offSeriesBackgroundMouseDrag=t=>this.P.off(t,"mouseDragSeriesBackground"),this.offSeriesBackgroundMouseDragStop=t=>this.P.off(t,"mouseDragStopSeriesBackground"),this.offSeriesBackgroundMouseWheel=t=>this.P.off(t,"mouseWheelSeriesBackground"),this.offSeriesBackgroundTouchStart=t=>this.P.off(t,"touchStartSeriesBackground"),this.offSeriesBackgroundTouchMove=t=>this.P.off(t,"touchMoveSeriesBackground"),this.offSeriesBackgroundTouchEnd=t=>this.P.off(t,"touchEndSeriesBackground"),this.Cy=this.ss.xg()}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.My.forEach((e=>e.setAnimationHighlight(t))),this}Ty(t,e){this.Cy.ds([e]),t.setMouseMoveEventHandler(((t,e)=>{this.P.emit("mouseMoveSeriesBackground",this,e)})).setMouseEnterEventHandler(((t,e)=>{this.P.emit("mouseEnterSeriesBackground",this,e)})).setMouseLeaveEventHandler(((t,e)=>{this.P.emit("mouseLeaveSeriesBackground",this,e)})).setMouseDownEventHandler(((t,e)=>this.P.emit("mouseDownSeriesBackground",this,e))).setMouseUpEventHandler(((t,e)=>this.P.emit("mouseUpSeriesBackground",this,e))).setMouseClickEventHandler(((t,e)=>this.P.emit("mouseClickSeriesBackground",this,e))).setMouseDoubleClickEventHandler(((t,e)=>this.P.emit("mouseDoubleClickSeriesBackground",this,e))).setMouseWheelEventHandler(((t,e)=>this.P.emit("mouseWheelSeriesBackground",this,e))).setMouseDragStartEventHandler(((t,e,i)=>this.P.emit("mouseDragStartSeriesBackground",this,e,i))).setMouseDragEventHandler(((t,e,i,s,r)=>this.P.emit("mouseDragSeriesBackground",this,e,i,s,r))).setMouseDragStopEventHandler(((t,e,i,s)=>this.P.emit("mouseDragStopSeriesBackground",this,e,i,s))).setTouchStartEventHandler(((t,e)=>{this.P.emit("touchStartSeriesBackground",this,e)})).setTouchMoveEventHandler(((t,e)=>{this.P.emit("touchMoveSeriesBackground",this,e)})).setTouchEndEventHandler(((t,e)=>{this.P.emit("touchEndSeriesBackground",this,e)}))}setSeriesBackgroundFillStyle(t){return this.Fy.Me(t),this.ls.Ss(),this}getSeriesBackgroundFillStyle(){return this.Fy.Th()}setSeriesBackgroundStrokeStyle(t){return this.Iy.ve(t),this.ls.Ss(),this}getSeriesBackgroundStrokeStyle(){return this.Iy.Un()}setSeriesBackgroundEffect(t){return this.Cy.ys(t),this.ls.Ss(),this}getSeriesBackgroundEffect(){return this.Cy.xs()}Py(t){this.My.push(t),t.onMouseEnter(this.wy),t.onMouseLeave(this.ky),void 0!==this.Dy&&t.setHighlightOnHover(this.Dy),this.P.emit("seriesAdded",this,t)}Sd(){return this.My}By(){return this._y}setSeriesHighlightOnHover(t){return this.Dy=t,this.My.forEach((e=>e.setHighlightOnHover(t))),this}dispose(){return this.My.slice().forEach(Tt),super.dispose()}}const Fa=Ce.normalize({x:-.5610788649579117,y:-.35242840511865414,z:-1.1349149375849081});class Ba{constructor(t,e,i,s){this.Oy=!0,this.Ly=!0,this.Ry=2*-Math.PI/2160,this.Ey=2*Math.PI/2160,this.zy=.1,this.Vy=1*Math.PI/180,this.Ny=t,this.Gy=e,this.Wy=i,this.Nm=s}getDefaultCameraConfiguration(t){const e={direction:Fa,location:Ce.multiply(Fa,-1)};return this.cameraLocationChanged({boundingBox:t,cameraDirection:e.direction,cameraLocation:e.location})||e}applyCameraInteractions(t,e){let i={direction:t.cameraDirection,location:t.cameraLocation};return e.forEach((t=>{"rotate"===t.type?i=this.Hy(i,t):"wheel-zoom"===t.type?i=this.Uy(i,t):"rotate+zoom"===t.type?i=this.$y(i,t):"fixed-rotate"===t.type?i=this.jy(i,t):"move"===t.type&&(i=this.Yy(i,t))})),this.Oy?i=this.Xy(t.boundingBox,i):this.Ly&&(i=this.Zy(t.boundingBox,i)),i}Hy(t,e){const{rotation:i}=e,s=t.location,r=Ce.multiply(Ce.normalize(t.location),-1),{Right:n,Up:o}=this.Ky(r);let h=s;const a=this.qy(r),l=i.x*this.Ry*a;h=Ce.rotateAroundAxis(h,o,l);const u=(i.y>0?1:-1)*Math.min(Math.abs(i.y)*this.Ey,a-this.Vy);return 0!==u&&(h=Ce.rotateAroundAxis(h,n,u)),{location:h,direction:Ce.multiply(Ce.normalize(h),-1)}}Uy(t,e){const{deltaY:i}=e;this.Oy&&this.Jy(!1);const s=t.location,r=Ce.multiply(Ce.normalize(s),-1),n=i*this.zy,o=Ce.length(s)*-n;return{direction:r,location:Ce.addVec(s,Ce.multiply(r,o))}}$y(t,e){const{rotation:i,cameraDistance:s}=e;this.Oy&&this.Jy(!1);let r=this.Hy(t,{type:"rotate",rotation:i});const n=r.location,o=Ce.multiply(Ce.normalize(n),-1),h=Ce.multiply(o,-s);return r={direction:Ce.multiply(Ce.normalize(h),-1),location:h},r}jy(t,e){this.Oy&&this.Jy(!1);const{rotation:i}=e,s=t.location,r=t.direction,{Right:n,Up:o}=this.Ky(r),h=i.x*this.Ry;let a=Ce.normalize(Ce.rotateAroundAxis(r,o,h));const l=i.y*this.Ey;return a=Ce.normalize(Ce.rotateAroundAxis(a,n,l)),{location:s,direction:a}}Yy(t,e){this.Oy&&this.Jy(!1),this.Ly=!1;const{amountRight:i,amountForward:s}=e,r=t.location,n=t.direction,{Right:o}=this.Ky(n);return{location:Ce.addVec(r,Ce.multiply(n,.01*s),Ce.multiply(o,.01*i)),direction:n}}boundingBoxChanged(t){const e={location:t.cameraLocation,direction:Ce.multiply(Ce.normalize(t.cameraLocation),-1)};return this.Oy?this.Xy(t.boundingBox,e):this.Zy(t.boundingBox,e)}cameraLocationChanged(t){const e={location:t.cameraLocation,direction:Ce.multiply(Ce.normalize(t.cameraLocation),-1)};return this.Oy?this.Xy(t.boundingBox,e):this.Zy(t.boundingBox,e)}viewportChanged(t){const e={location:t.cameraLocation,direction:Ce.multiply(Ce.normalize(t.cameraLocation),-1)};if(this.Oy)return this.Xy(t.boundingBox,e)}Xy(t,e,i){let s=e;i=void 0!==i?i:0,s=this.Qy(t,s,100,20,1,i,5);const r=this.qy(s.direction);return s=this.tS(s,this.iS(t,s,100,1),r),s}Qy(t,e,i,s,r,n,o){return _a(n,o,(t=>({direction:e.direction,location:Ce.multiply(e.direction,-t)})),(e=>this.sS(t,e)),i,r,"linear",s)}iS(t,e,i,s){const{Right:r,Left:n,Up:o,Down:h}=this.Ky(e.direction),a=this.eS(t,!1,e);let l=e;const u=s,c=.1;return Math.abs(a.bottom-a.top)>u&&(l=a.bottom({location:l.location,direction:Ce.normalize(Ce.lerp(l.direction,h,t))})),(e=>this.hS(t,e)),0,u,!0,i):La(0,c,(t=>({location:l.location,direction:Ce.normalize(Ce.lerp(l.direction,o,t))})),(e=>this.hS(t,e)),0,u,!0,i)),Math.abs(a.left-a.right)>u&&(l=a.left({location:l.location,direction:Ce.normalize(Ce.lerp(l.direction,n,t))})),(e=>this.rS(t,e)),0,u,!0,i):La(0,c,(t=>({location:l.location,direction:Ce.normalize(Ce.lerp(l.direction,r,t))})),(e=>this.rS(t,e)),0,u,!0,i)),l}sS(t,e){const i=this.eS(t,!0,e);return Math.min(i.left+i.right,i.top+i.bottom)}rS(t,e){const i=this.eS(t,!1,e);return Math.abs(i.left-i.right)}hS(t,e){const i=this.eS(t,!1,e);return Math.abs(i.top-i.bottom)}eS(t,e,i){const s=Xe(this.nS(t,e,i).map((t=>at(t,this.Ny,this.Gy))));return{left:s.min.x,right:this.Gy.x.getInnerEnd()-s.max.x,top:this.Gy.y.getInnerEnd()-s.max.y,bottom:s.min.y}}nS(t,e,i){const s=this.Wy,r=f(s.x.getInnerStart(),s.y.getInnerStart(),s.z.getInnerStart()),n=f(s.x.getInnerEnd(),s.y.getInnerEnd(),s.z.getInnerEnd()),o=[],h=e?16:4,a=(r.x+n.x)/2,l=(r.z+n.z)/2,u=Math.sqrt(2)*(n.x-a),c=Math.sqrt(2)*(n.z-l);return[r.y,n.y].forEach((t=>{for(let e=0;ethis.Nm(t,i))).filter((t=>void 0!==t))}Zy(t,e){const i=Ce.length(e.location),s=this.oS(t);return i{let a,l=0,u=(e+t)/2;do{const h=i(u);if(a={value:u,result:h,score:s(h)},Math.abs(a.score-r)<=n)break;const c=a.score>r;c&&"linear"===o||!c&&"reversed"===o?(u=(a.value+t)/2,e=a.value):(u=(a.value+e)/2,t=a.value),l+=1}while(l{let a,l=0,u=t;do{const c=i(u),d=s(c);if(void 0===a||Math.abs(d-r)de(this.Se),this.Zm=ko;const o=void 0!==(null==s?void 0:s.automaticColorIndex)?s.automaticColorIndex:this.Ki.getSeries().length;this.Se=ye(this.Ji.surfaceGridSeries3DFillStyle,o),this.lu=ye(this.Ji.surfaceGridSeries3DWireframeStyle,o);const h=s.start||{x:0,z:0},a=s.end?{x:(s.end.x-h.x)/s.columns,z:(s.end.z-h.z)/s.rows}:s.step||{x:1,z:1},l={heatmapDataType:"intensity",dataOrder:s.dataOrder||"columns",columns:s.columns,rows:s.rows,start:h,step:a};this._n=l,this.Aa=this.Fm.lS(l).Me(this.Se).uu(this.lu).iy(this.Zm).us(this.getHighlight()),this.cs(this.Aa)}setFillStyle(t){return this.Se="function"==typeof t?t(this.Se):t,this.Aa.Me(this.Se),this.Fm.Ss(),this}getFillStyle(){return this.Se}setWireframeStyle(t){return this.lu="function"==typeof t?t(this.lu):t,this.Aa.uu(this.lu),this.Fm.Ss(),this}getWireframeStyle(){return this.Aa.cu()}setIntensityInterpolation(t){return t=t||"disabled",this.Aa.uS(t),this.Fm.Ss(),this}getIntensityInterpolation(){return this.Aa.cS()}invalidateIntensityValues(t){if(Array.isArray(t)){if(0===t.length||0===t[0].length)return this;const e={x:t.length,y:t[0].length,columns:"columns"===this._n.dataOrder?t.length:t[0].length,rows:"rows"===this._n.dataOrder?t.length:t[0].length},i="columns"===this._n.dataOrder?this._n.columns:this._n.rows,s="columns"===this._n.dataOrder?this._n.rows:this._n.columns;if(e.x>i||e.y>s){if(!0===this.Ki.ff.Pn){const t=`SurfaceGridSeries3D.invalidateIntensityValues intensity matrix overflow.\n Grid ${this._n.columns}x${this._n.rows}, input ${e.columns}x${e.rows}.\n Excess data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(t)}const r=[];for(let e=0;eo||n>h){if(!0===this.Ki.ff.Pn){const i=`SurfaceGridSeries3D.invalidateIntensityValues intensity matrix overflow.\n Grid ${this._n.columns}x${this._n.rows}, input ${e.columns}x${e.rows} starting at [${t.iColumn},${t.iRow}].\n Out of bounds data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(i)}const a=Math.max(-i,0),l=Math.max(-r,0),u=Math.max(s-o,0),c=Math.max(n-h,0),d=e.primary-(a+u),f=[];if(0===l&&0===c)for(let e=0;ei||e.y>s){if(!0===this.Ki.ff.Pn){const t=`SurfaceGridSeries3D.invalidateHeightMap height matrix overflow.\n Grid ${this._n.columns}x${this._n.rows}, input ${e.columns}x${e.rows}.\n Excess data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(t)}const r=[];for(let e=0;eo||n>h){if(!0===this.Ki.ff.Pn){const i=`SurfaceGridSeries3D.invalidateHeightMap height matrix overflow.\n Grid ${this._n.columns}x${this._n.rows}, input ${e.columns}x${e.rows} starting at [${t.iColumn},${t.iRow}].\n Out of bounds data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(i)}const a=Math.max(-i,0),l=Math.max(-r,0),u=Math.max(s-o,0),c=Math.max(n-h,0),d=e.primary-(a+u),f=[];if(0===l&&0===c)for(let e=0;ede(this.Se),this.Zm=ko;const o=void 0!==(null==s?void 0:s.automaticColorIndex)?s.automaticColorIndex:this.Ki.getSeries().length;this.Se=ye(this.Ji.surfaceScrollingGridSeries3DFillStyle,o),this.lu=ye(this.Ji.surfaceScrollingGridSeries3DWireframeStyle,o);const h=s.start||{x:0,z:0},a=s.step||{x:1,z:1},l={heatmapDataType:"intensity",scrollDimension:s.scrollDimension||"columns",columns:s.columns,rows:s.rows,start:h,step:a};this._n=l,this.Aa=this.Fm.mS(l).Me(this.Se).uu(this.lu).iy(this.Zm).us(this.getHighlight()),this.cs(this.Aa)}setFillStyle(t){return this.Se="function"==typeof t?t(this.Se):t,this.Aa.Me(this.Se),this.Fm.Ss(),this}getFillStyle(){return this.Se}setWireframeStyle(t){return this.lu="function"==typeof t?t(this.lu):t,this.Aa.uu(this.lu),this.Fm.Ss(),this}getWireframeStyle(){return this.Aa.cu()}setIntensityInterpolation(t){return t=t||"disabled",this.Aa.uS(t),this.Fm.Ss(),this}getIntensityInterpolation(){return this.Aa.cS()}clear(){return this.Aa.Ha(),this.Fm.Ss(),this}addValues(t){if(!t)return this;let e=t.yValues,i=t.intensityValues;if(!e&&!i)return this;if(e&&0===e.length&&(e=void 0),i&&0===i.length&&(i=void 0),e){const t=e[0].length,i=0+t-1,s="columns"===this._n.scrollDimension?this._n.rows:this._n.columns;if(i>s-1){if(!0===this.Ki.ff.Pn){const e=`SurfaceScrollingGridSeries3D.addValues input yValues overflow.\nGrid was created with ${s} ${"columns"===this._n.scrollDimension?"rows":"columns"}, input yValues have ${t}.\nExcess data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(e)}const i=[];for(let t=0;ts-1){if(!0===this.Ki.ff.Pn){const e=`SurfaceScrollingGridSeries3D.addValues intensityValues overflow.\nGrid was created with ${s} ${"columns"===this._n.scrollDimension?"rows":"columns"}, input intensityValues have ${t}.\nExcess data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(e)}const e=[];for(let t=0;ts?e=e.slice(0,s):i=i.slice(0,t)}}const s=e?e.length:null==i?void 0:i.length,r=e?e[0].length:null==i?void 0:i[0].length;return this.Aa.yS({startPrimary:0,startSecondary:0,lengthPrimary:s,lengthSecondary:r,heightMapValues:e,intensityValues:i}),this.Fm.Ss(),this}setCullMode(t){return this.Aa.gS("boolean"==typeof t?t?"cull-back":"disabled":t),this}getCullMode(){return this.Aa.pS()}ey(){}Ae(){}om(){}Xm(){return this.Km&&this.getVisible()}ke(t,e){t.us(e),this.Fm.Ss()}}const Oa=t=>!!(t&&"object"==typeof t&&"id"in t&&"chart"in t&&t.chart instanceof Va),Ra=t=>!!(t&&"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y&&"z"in t&&"number"==typeof t.z);class Va extends ka{constructor(t,e,i,s,r,n,o){var h;let a;super(t,e,i,e.hp("chart3D bg",0),s,e.ls.Ji.chart3DBackgroundFillStyle,e.ls.Ji.chart3DBackgroundStrokeStyle,e.ls.Ji.chart3DTitleFont,e.ls.Ji.chart3DTitleFillStyle,n),this.SS=1,this.xS=[],this.bS=2,this.vS=!0,this.MS=!0,this._S=!0,this.AS=0,this.coordsAxis={id:"axes",chart:this},this.coordsWorld={id:"world",chart:this},this.axes={id:"axes",chart:this},this.world={id:"world",chart:this},this.Wr=[],this.Yr=()=>{const t=this.Fm.wS();this.CS.kS(t),this.TS.kS(t);const e=this.FS.viewportChanged(this.IS());e&&this.PS(e),this.ls.Ss()},this.Qm=(t,e,i,s,r)=>{if(this._S){const t=r;this.xS.push({type:"rotate",rotation:t}),this.ls.Ss(),Kt(e)}},this.Jm=(t,e)=>{if(this.MS){if(this.vS)Math.sign(this.AS)!==Math.sign(e.deltaY)?this.AS=pe(e):this.AS+=pe(e);else{const t=pe(e);this.xS.push({type:"wheel-zoom",deltaY:t})}this.ls.Ss(),Kt(e)}},this.ff.wn||this.ff.An||this.ls.Mn(1),this.ap.Ch("Chart3D"),this.DS=i.d3(),this.DS.x.Z(-1,1),this.DS.y.Z(-1,1),this.DS.z.Z(-1,1),this.Fm=e.BS("chart3D layer3D",0,this.DS),this.CS=e.OS("chart3D series bg",0),this.TS=e.Hp("chart3D axis ui",1),this.LS={x:new ya(this,(h=()=>this.My,{...Sa(h,(t=>t.getXMin()),(t=>t.getXMax()),(t=>t.ur().x)),Am:t=>t.x,Wm:(t,e)=>({x:t.x,y:e.y,z:e.z}),bd:f(0,-1,0),Hm:t=>{const e={x:t.x>=0?1:-1,y:t.y>=0?1:-1,z:t.z>=0?1:-1};return{gridlinePositionA:f(0,e.y,e.z),gridlinePositionB:f(0,e.y,-e.z),gridlinePositionC:f(0,-e.y,-e.z)}},jm:()=>!0,Ym:()=>!1,Gm:()=>!1}),this.DS.x,this.Ji,this.Fm,this.TS,this.pixelScale,!1,this.ss),y:new ya(this,xa((()=>this.My)),this.DS.y,this.Ji,this.Fm,this.TS,this.pixelScale,!1,this.ss),z:new ya(this,ba((()=>this.My)),this.DS.z,this.Ji,this.Fm,this.TS,this.pixelScale,!1,this.ss)},this.RS=this.Fm.tm([Kh.InternalUI]).setMouseInteractions(!1),this.setBoundingBoxStrokeStyle(this.Ji.chart3DBoundingBoxStrokeStyle),this.Fy=this.CS.Cc(this.engine.scale,sn.Simple).Me(this.Ji.chart3DSeriesBackgroundFillStyle).ve(st).setMouseInteractions(!0),this.Iy=this.CS.Cc(this.engine.scale,sn.Simple).Me(z).ve(this.Ji.chart3DSeriesBackgroundStrokeStyle).setMouseInteractions(!1),super.Ty(this.Fy,this.Iy),this.ES({x:1,y:1,z:1},!0),this.FS=new Ba(this.engine.scale,this.pixelScale,this.DS,((t,e)=>(e&&this.PS(e),this.Fm.Nm(t)))),this.zS=this.FS.getDefaultCameraConfiguration(this.VS(this.NS)),this.PS(this.zS),this.ty=Wi(new ji(((t,e,i)=>{a={locationOne:e,locationTwo:i,cameraLocation:this.Fm.getCameraLocation()}}),((t,e,i,s,r,n)=>{if(!this._S&&!this.MS)return;const o=(a.locationOne.x-a.locationTwo.x)**2+(a.locationOne.y-a.locationTwo.y)**2,h=(e.x-i.x)**2+(e.y-i.y)**2,l=Ce.length(a.cameraLocation),c=o/h*l,d=u((s.x+r.x)/2,(s.y+r.y)/2);this.xS.push({type:"rotate+zoom",rotation:this._S?d:{x:0,y:0},cameraDistance:this.MS?c:l}),this.ls.Ss(),Kt(n)}),(t=>{})),new Yi((t=>{}),((t,e,i,s,r)=>{if(this._S){const t=s;this.xS.push({type:"rotate",rotation:t}),this.ls.Ss(),Kt(r)}}),(t=>{}))),this.onBackgroundTouchStart(this.ty.onTouchStart),this.onBackgroundTouchMove(this.ty.onTouchMove),this.onBackgroundTouchEnd(this.ty.onTouchEnd),this.onSeriesBackgroundTouchStart(this.ty.onTouchStart),this.onSeriesBackgroundTouchMove(this.ty.onTouchMove),this.onSeriesBackgroundTouchEnd(this.ty.onTouchEnd),this.onBackgroundMouseDrag(this.Qm),this.onBackgroundMouseWheel(this.Jm),this.onBackgroundMouseDown(((t,e)=>{Kt(e)})),this.onSeriesBackgroundMouseDrag(this.Qm),this.onSeriesBackgroundMouseWheel(this.Jm),this.onSeriesBackgroundMouseDown(((t,e)=>{Kt(e)})),o&&!0===o.disableAnimations&&this.setAnimationsEnabled(!1),this.onResize(this.Yr),this.Yr(),this.ep(r,this.pixelScale)}addPointSeries(t){const e=new(t&&t.type||Ia)(this,this.Ay,this.Fm,this.Ji,this.ls.ss,t);return this.Py(e),e}addLineSeries(t){const e=new wa(this,this.Ay,this.Fm,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addPointLineSeries(t){const e=new Ta(this,this.Ay,this.Fm,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addSurfaceGridSeries(t){const e=new Da(this,this.Ay,this.Fm,t,this.Ji,this.ls.ss);return this.Py(e),e}addSurfaceScrollingGridSeries(t){const e=new za(this,this.Ay,this.Fm,t,this.Ji,this.ls.ss);return this.Py(e),e}addBoxSeries(t){const e=new Ma(this,this.Ay,this.Fm,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}translateCoordinate(t,e,i){if(Oa(e)||Oa(i)||Ra(t)){if(Oa(e)&&Oa(i)&&Ra(t)){if("axes"===e.id&&"world"===i.id)return this.Fm.GS(t);if("world"===e.id&&"axes"===i.id)return this.Fm.WS(t);if(e.id===i.id)return t}throw new Error("translateCoordinate unexpected error. Input or target coordinate system not recognized.")}return Lh(t,e,i,this.pixelScale,this.ls)}getDefaultAxisX(){return this.LS.x}getDefaultAxisY(){return this.LS.y}getDefaultAxisZ(){return this.LS.z}getDefaultAxes(){return[this.LS.x,this.LS.y,this.LS.z]}setCameraLocation(t){let e={location:t,direction:Ce.normalize(Ce.multiply(t,-1))};const i=this.FS.cameraLocationChanged(this.IS(e));return i&&(e=i),this.PS(e),this.ls.Ss(),this}getCameraLocation(){return this.Fm.getCameraLocation()}getCameraDirection(){return this.Fm.getCameraDirection()}setCameraAutomaticFittingEnabled(t){this.FS.Jy(t);const e=this.FS.cameraLocationChanged(this.IS());return e&&this.PS(e),this}getCameraAutomaticFittingEnabled(){return this.FS.aS()}onCameraChange(t){return this.P.on("cameraChange",t)}offCameraChange(t){return this.P.off(t,"cameraChange")}setBoundingBoxStrokeStyle(t){return this.RS.Pe(t).Om(ca(this.RS.Yl())),this.Fm.Ss(),this}getBoundingBoxStrokeStyle(){return this.RS.Yl()}setBoundingBox(t){return this.ES(t,!1),this}ES(t,e){this.NS=t;const i=this.VS(t);if(this.DS.x.q(i.x),this.DS.y.q(i.y),this.DS.z.q(-i.z),!e){const t=this.FS.boundingBoxChanged(this.IS());t&&this.PS(t)}this.ls.Ss()}getBoundingBox(){return this.NS}Ae(t){if(Nh.fp(this.ap,this.rp),0!==this.AS){const e=this.AS*t*.006;this.xS.push({type:"wheel-zoom",deltaY:e}),this.AS=Math.sign(this.AS)*Math.max(Math.abs(this.AS)-.01*t,0),0!==this.AS&&this.ls.Ss(!0)}const e=this.getCameraDirection();if(this.xS.length>0){const t=this.FS.applyCameraInteractions(this.IS(),this.xS);t&&this.PS(t),this.xS.length=0}this.HS&&Ce.equals(this.HS.location,this.zS.location)&&Ce.equals(this.HS.direction,this.zS.direction)||this.P.emit("cameraChange",this,this.getCameraLocation()),this.HS=this.zS,super.Ae(t);for(let t=0;tthis.Fm.Nm(t))),o=this.Fm.Nm(f((s.x+r.x)/2,(s.y+r.y)/2,(s.z+r.z)/2)),h=oe(n,o),a=[];for(let t=0;t0?t-1:h.length-1],h[t{t()})),this.Wr.length=0,this.DS.G(),this.Fm.G(),this.TS.G(),this.CS.G(),super.dispose()}Y(){return this.DS.x.Y(),this.DS.y.Y(),this.DS.z.Y(),super.Y()}X(){return super.X()}PS(t){this.Fm.setCameraLocation(t.location).setCameraDirection(t.direction).setLightLocation(Ce.addVec(t.location,Ce.multiply(t.direction,-this.bS))),this.zS=t,this.ls.Ss()}VS(t){return Ce.divide(t,Ce.length(t)/this.SS)}IS(t=this.zS){return{boundingBox:this.VS(this.NS),cameraLocation:t.location,cameraDirection:t.direction}}setMouseInteractions(t){return this.setMouseInteractionZoom(t).setMouseInteractionRotate(t)}setMouseInteractionZoom(t){return this.MS=t,this}getMouseInteractionZoom(){return this.MS}setMouseInteractionRotate(t){return this._S=t,this}getMouseInteractionRotate(){return this._S}forEachAxis(t){return t(this.LS.x),t(this.LS.y),t(this.LS.z),this}getSeries(){return this.My}getMinimumSize(){}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.setAnimationZoom(t),this.forEachAxis((e=>e.setAnimationsEnabled(t))),this}setAnimationZoom(t){return this.vS=!!t,this}getAnimationZoom(){return this.vS}}const Na={Column:Yn,Row:jn};class Ga extends Oh{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n),this.US=new Map,this.$S=this.addUIElement(Na.Row).setPosition({x:0,y:100}).setOrigin(ws.LeftTop).setBackground((t=>t.setFillStyle(z).setStrokeStyle(st)))}add(t,e){return(t instanceof Vh?[t]:t instanceof Vf?t.getCells().filter((t=>t.panel instanceof Vh)).map((t=>t.panel)):[]).forEach((t=>{const i=this.$S.addElement(vo.VerticalLegendBox).setBackground((t=>t.setFillStyle(z).setStrokeStyle(st))).add(t,e).setTitle(t.getTitle());this.US.set(t,i)})),this.ls.Ss(),this}setLegendBoxes(t){return this.US.forEach(((e,i)=>t(e,i))),this}getMinimumSize(){return super.getMinimumSize()||this.$S.getSize()}}class Ha{constructor(t,e){this.jS=t,this.YS=e}alter(t){this.XS=void 0!==this.XS?this.XS:this.YS(),this.ZS=t,this.jS(t)}resetValue(){void 0!==this.ZS&&(void 0!==this.XS&&this.isAltered()&&this.jS(this.XS),this.XS=void 0,this.ZS=void 0)}getNormalValue(){return void 0!==this.XS?this.XS:this.YS()}isAltered(){return void 0!==this.ZS&&this.YS()===this.ZS}}class Ua{constructor(t,e){this.KS=[],this.qS=t,this.ct=e}update(){return this.qS.getVisible()?!(this.JS()&&(!this.QS()||(this.resetTable(),this.qS.Ts(),this.JS()))&&(this.tx(),this.qS.Ts(),this.JS()&&(this.resetTable(),this.qS.Ts(),1))):(this.QS()&&this.resetTable(),!0)}QS(){for(let t=0;t{const s=at(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=at(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.xi.x.getInnerEnd()||s.yi.y.getInnerEnd()})(this.qS,this.ct)}ix(){return((t,i)=>{const s=at(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=at(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.xi.x.getInnerEnd()})(this.qS,this.ct)}sx(){return((t,i)=>{const s=at(t.getPosition(u(-1,-1),e.UISpace.PaddedBackground),t.scale,i),r=at(t.getPosition(u(1,1),e.UISpace.PaddedBackground),t.scale,i);return s.yi.y.getInnerEnd()})(this.qS,this.ct)}hx(t){return this.KS.push(t),t}}class Wa extends Ua{constructor(){super(...arguments),this.Jo=this.hx(new Ha((t=>this.qS.setOrigin(t)),(()=>this.qS.getOrigin())))}tx(){const t=this.Jo.getNormalValue(),e=u(this.ix()?-t.x:t.x,this.sx()?-t.y:t.y);this.Jo.alter(e)}}class Xa extends Ua{constructor(t,e,i,s){super(t,e),this.nx=this.hx(new Ha((t=>this.qS.setTextFont((e=>e.setSize(t)))),(()=>this.qS.getTextFont().getSize()))),this.ox=i,this.lx=s}tx(){const t=this.nx.getNormalValue(),e=this.ox;if(enew Wa(t,e),FontSize:(t=5,e=5)=>(i,s)=>new Xa(i,s,t,e)};class ja{constructor(){this.ux=[]}addRow(...t){return this.ux.push(t),this}}class Ja extends ja{vc(){const t=this.ux;return this.ux=[],t}gx(){return this.ux.length=0,this}}class $a extends Wn{constructor(){super(...arguments),this.cc=this.Ji.cursorResultTableTextFont,this.Qc=0,this.Mm=this.Ji.cursorResultTableTextFillStyle}setContent(t){for(let e=0;e=e)this.getMembers()[s].dispose(),s-=1,i-=1;else{const e=t[s].length;let i=r.getMembers().length;for(let n=0;n=e)r.getMembers()[n].dispose(),n-=1,i-=1;else if(void 0!==o&&o.length>0){for(let t=h.length;t=h.length)t=r.addElement(Ln,void 0);else{const e=h[n];e instanceof Vn?(r.getMembers()[n].dispose(),t=r.addElement(Ln,n)):t=e}t.setFont(this.cc).setFillStyle(this.Mm).setText(o).setTextRotation(this.Qc)}else{for(let t=h.length;t=h.length?r.addGap(void 0,void 0):h[n]instanceof _n&&(r.getMembers()[n].dispose(),r.addGap(void 0,n))}}}}return this.As.Ss(),this}setTextFillStyle(t){this.Mm="function"==typeof t?t(this.Mm):t;for(let t=0;tt.setFillStyle(n.cursorResultTableFillStyle).setStrokeStyle(n.cursorResultTableStrokeStyle))).setTextFillStyle(n.cursorResultTableTextFillStyle).setTextFont(n.cursorResultTableTextFont),this._x=Ya.Flip(this.qS,this.scale)}dispose(){return this.Mx.dispose(),this.qS.dispose(),this}pointAt(t){return this.jo=t.scale===this.scale?t.location:at(t.location,t.scale,this.scale),this.Mx.setPosition(this.jo),this.qS.setPosition(this.jo).setContent(t.resultTableContent),this.As.Ss(),this}getPosition(){return this.jo}setVisible(t){return this.Fi=t,this.As.Ss(),this}getVisible(){return this.Fi}setPointMarkerVisible(t){return this.yx=t,this.As.Ss(),this}getPointMarkerVisible(){return this.yx}setPointMarker(t){return t(this.Mx),this.As.Ss(),this}getPointMarker(){return this.Mx}setResultTableVisible(t){return this.Sx=t,this.As.Ss(),this}getResultTableVisible(){return this.Sx}setResultTable(t){return t(this.qS),this.As.Ss(),this}getResultTable(){return this.qS}setAutoFitStrategy(t){return this._x&&this._x.resetTable(),this._x=t?t(this.qS,this.As.ls.ct):void 0,this.As.Ss(),this}getAutoFitStrategy(){return void 0!==this._x}Ae(){return this._x&&this._x.update(),this.qS.setVisible(this.xx&&this.Fi&&this.Sx),this.Mx.setVisible(this.xx&&this.Fi&&this.yx),this.Mx.Ae(),this.qS.Ae(),this}Ts(){return this.Mx.Ts(),this.qS.Ts(),this.xx=((t,e,i=e)=>{const s=e!==i?at(t,e,i):t;return s.x>=i.x.getInnerStart()&&s.x<=i.x.getInnerEnd()&&s.y>=i.y.getInnerStart()&&s.y<=i.y.getInnerEnd()})(this.jo,this.scale),this}}class Za extends qa{constructor(){super(...arguments),this.Ax=!1}pointAt(t){return this.wx(t.fillStyle),super.pointAt(t)}wx(t){t&&this.Ax&&this.qS.setTextFillStyle(t)}setResultTableAutoTextStyle(t){return this.Ax=t,this.As.Ss(),this}getResultTableAutoTextStyle(){return this.Ax}}class Ka extends qa{setPosition(t){return this.jo=t,this.Mx.setPosition(t),this.qS.setPosition(t),this.As.Ss(),this}}class Qa{constructor(t,e,i=[]){this.kx=[],this.Cx=(t,e)=>(this.kx.forEach((i=>i(t,e))),t),this.bx=t,this.vx=e,this.kx=i}}class tl extends Qa{constructor(){super(...arguments),this.Tx=(t,e,i,s)=>this.Cx(new Za(t,e,i,this.bx,this.vx,s),s),this.addStyler=t=>new tl(this.bx,this.vx,this.kx.map((t=>t)).concat(t)),this.setPointMarker=t=>new tl(t,this.vx,this.kx.map((t=>t))),this.setResultTableBackground=t=>new tl(this.bx,t,this.kx.map((t=>t)))}}class el extends Qa{constructor(){super(...arguments),this.Fx=(t,e,i,s)=>this.Cx(new Ka(t,e,i,this.bx,this.vx,s),s),this.addStyler=t=>new el(this.bx,this.vx,this.kx.map((t=>t)).concat(t)),this.setPointMarker=t=>new el(t,this.vx,this.kx.map((t=>t))),this.setResultTableBackground=t=>new el(this.bx,t,this.kx.map((t=>t)))}}const il=t=>t.setPointMarker((t=>t.setSize(u(5,5)).setOrigin(u(0,0)))).setResultTable((t=>t.setEffect(!0).setOrigin(u(-1,-1)).setMargin(5))),sl=(t,e)=>t.setPointMarker((t=>t.setFillStyle(e.chartMarkerPointMarkerFillStyle).setStrokeStyle(e.chartMarkerPointMarkerStrokeStyle).setSize(u(20,20)).setOrigin(u(0,0)))).setResultTable((t=>t.setEffect(!0).setBackground((t=>t)).setOrigin(u(-1,-1)).setMargin(10))),rl=new tl(Dn,Dn,[il]),nl=new tl(Dn,Rn,[il,t=>t.setPointMarkerVisible(!1).setResultTable((t=>t.setOrigin(u(0,-1)).setMargin(0).setBackground((t=>{t instanceof Rn&&t.setDirection(e.UIDirections.Down).setPointerLength(10).setPointerAngle(60)}))))]),ol=rl,hl=nl;new el(On,Dn,[sl,t=>t.setResultTableVisible(!1)]);const al=new el(Pn,Dn,[sl,t=>t.setResultTable((t=>t.setOrigin(ws.LeftBottom)))]),ll=(t,e,i,s,r)=>({location:t,scale:e,resultTableContent:i,series:s,fillStyle:r}),ul={World:"World",USA:"USA",NorthAmerica:"NorthAmerica",SouthAmerica:"SouthAmerica",Canada:"Canada",Europe:"Europe",Asia:"Asia",Africa:"Africa",Australia:"Australia"},cl=(t,e)=>!(!e.name||t.name.toLowerCase()!==e.name.toLowerCase())||"ISO_A3"in t&&"ISO_A3"in e&&t.ISO_A3.toLowerCase()===e.ISO_A3.toLowerCase(),dl=(t,e)=>{let i=e.geometry;return i=fl(t,e,i),i=gl(t,e,i),i},fl=(t,e,i)=>{if(t===ul.Asia){const t=[];for(let e=0;e{const s=e.name.toLowerCase();let r;if(t===ul.USA&&("alaska"===s?r={translate:{x:55,y:-25},scale:{x:.16,y:.16}}:"hawaii"===s&&(r={translate:{x:48,y:7},scale:{x:1,y:1}})),r){const{translate:t,scale:n}=r,o=Xe(Pt(i)),h=[];for(let e=0;e{this.My.includes(t)||(this.My.push(t),this.P.emit("seriesAdded",this,t))},this.Dx=i.Bx();const c=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()},d=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()},f=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()},g=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()},y=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()},p=()=>{this.Ix!==e.AutoCursorModes.disabled&&this.ls.Ss()};this.onSeriesBackgroundMouseEnter(c),this.onSeriesBackgroundMouseMove(d),this.onSeriesBackgroundMouseLeave(f),this.onSeriesBackgroundTouchStart(g),this.onSeriesBackgroundTouchMove(y),this.onSeriesBackgroundTouchEnd(p),this.Ox(((t,e)=>{const i=e.onMouseEnter(c),s=e.onMouseMove(d),r=e.onMouseLeave(f),n=e.onTouchStart(g),o=e.onTouchMove(y),h=e.onTouchEnd(p),a=this.Lx(((t,l)=>{l===e&&(e.offMouseEnter(i),e.offMouseMove(s),e.offMouseLeave(r),e.offTouchStart(n),e.offTouchMove(o),e.offTouchEnd(h)),this.Rx(a)}))}))}setAutoCursor(t){return this.Ex&&t(this.Ex),this.ls.Ss(),this}getAutoCursor(){return this.Ex}setAutoCursorMode(t){return this.Ix=t,this.ls.Ss(),this}getAutoCursorMode(){return this.Ix}zx(t){if(t.xthis.uiScale.x.Nt()||t.ythis.uiScale.y.Nt())return;let e,i=Number.MAX_VALUE;for(const s of this.My)if(s.getCursorEnabled()&&s.getVisible()){const r=s.zx(t,!1);if(r){const s=at(r.location,r.scale,this.engine.scale),n=Ne(t,s);Number.isNaN(n)||e&&!(nt.getIsUnderMouse())),r=this.Fy.getIsUnderMouse();this.Ix===e.AutoCursorModes.snapToClosest?(r||void 0!==s)&&(i=t&&this.zx(t)):this.Ix===e.AutoCursorModes.onHover&&void 0!==s&&s.getCursorEnabled()&&(i=t&&s.zx(t,!0))}i?this.Ex.pointAt(i).setVisible(!0):this.Ex.setVisible(!1),this.Ex.Ts().Ae()}Ox(t){return this.P.on("seriesAdded",t)}Nx(t){return this.P.off(t)}Lx(t){return this.P.on("seriesDispose",t)}Rx(t){return this.P.off(t)}dispose(){return this.Dx.G(),this.Ex.dispose(),super.dispose()}}class xl extends Vh{constructor(t,i,s,r,n,o,h){super(t,i,s,i.hp("mapChart bg",0),r,i.ls.Ji.mapChartBackgroundFillStyle,i.ls.Ji.mapChartBackgroundStrokeStyle,i.ls.Ji.mapChartTitleFont,i.ls.Ji.mapChartTitleFillStyle,h),this.Gx=[],this.ct=this.Ug.d2({scaleXYConstructor:_i}),this.ki=!0,this.Wx=this.Ji.mapChartSeparateRegionFillStyle,this.Hx=this.Ji.mapChartSeparateRegionStrokeStyle,this.Ux=e.AutoCursorModes.onHover,this.$x=bl,this.Ze=!0,this.jx=0,this.Yx=!0,this.Xx=new Map,this.onMouseEnter=t=>this.P.on("mouseEnter",t),this.onMouseLeave=t=>this.P.on("mouseLeave",t),this.onMouseClick=t=>this.P.on("mouseClick",t),this.onMouseDoubleClick=t=>this.P.on("mouseDoubleClick",t),this.onMouseDown=t=>this.P.on("mouseDown",t),this.onMouseUp=t=>this.P.on("mouseUp",t),this.onMouseMove=t=>this.P.on("mouseMove",t),this.offMouseEnter=t=>this.P.off(t,"mouseEnter"),this.offMouseLeave=t=>this.P.off(t,"mouseLeave"),this.offMouseClick=t=>this.P.off(t,"mouseClick"),this.offMouseDoubleClick=t=>this.P.off(t,"mouseDoubleClick"),this.offMouseDown=t=>this.P.off(t,"mouseDown"),this.offMouseUp=t=>this.P.off(t,"mouseUp"),this.offMouseMove=t=>this.P.off(t,"mouseMove"),this.offMouseDragStart=t=>this.P.off(t,"mouseDragStart"),this.offMouseDrag=t=>this.P.off(t,"mouseDrag"),this.offMouseDragStop=t=>this.P.off(t,"mouseDragStop"),this.offMouseWheel=t=>this.P.off(t,"mouseWheel"),this.onMapDataReady=t=>{const e=this.P.on("mapDataReady",t);return this.Zx&&xt.setTimeout((()=>t())),e},this.onViewChange=t=>this.P.on("viewChange",t),this.Kx=(t,e,i,s,r)=>{this.ct.x.q(s).zt([this.Ft.left+this.Qo.left,this.Ft.right+this.Qo.right]),this.ct.y.q(r).zt([this.Ft.bottom+this.Qo.bottom,this.Ft.top+this.Qo.top+Nh.dp(this.ap,this.rp)]),this.qx&&this.Jx(this.Qx,this.ct,this.qx)},this.Ri=(t,i)=>{const s=i;if(!s||!this.Zx)return;const{iRegion:r,region:n}=this.tb(this.Zx,s);this.Ux!==e.AutoCursorModes.disabled&&(this.ib(n,r),Kt(t)),this.Yx&&this.ls.os.vs(n,!0),this.P.emit("mouseEnter",this,t)},this.Ei=(t,e)=>{const i=e;if(!i||!this.Zx)return;const{iRegion:s,region:r}=this.tb(this.Zx,i);this.sb(r,s),this.Yx&&this.ls.os.vs(r,!1),this.P.emit("mouseLeave",this,t),t&&Kt(t)},this.zi=(t,i)=>{const s=i;if(!s||!this.Zx)return;const{iRegion:r,region:n}=this.tb(this.Zx,s);this.Ux!==e.AutoCursorModes.disabled&&(this.ib(n,r),Kt(t)),this.P.emit("mouseMove",this,t)},this.Vi=(t,e)=>this.P.emit("mouseClick",this,t),this.Ni=(t,e)=>this.P.emit("mouseDoubleClick",this,t),this.Gi=(t,e)=>this.P.emit("mouseDown",this,t),this.Wi=(t,e)=>this.P.emit("mouseUp",this,t),this.Hi=(t,e,i)=>{this.P.emit("mouseDragStart",this,t,e)},this.Ui=(t,e,i,s,r)=>{this.P.emit("mouseDrag",this,t,e,i,s)},this.$i=(t,e,i,s)=>{this.P.emit("mouseDragStop",this,t,e,i)},this.ji=(t,e)=>{this.P.emit("mouseWheel",this,t)},this.Yi=(t,e)=>{const i=e;if(!i||!this.Zx)return;const{iRegion:s,region:r}=this.tb(this.Zx,i);this.eb=this.engine.clientLocation2Engine(t.clientX,t.clientY),this.ib(r,s),this.Yx&&this.ls.os.vs(r,!0),this.P.emit("touchStart",this,t),Kt(t)},this.Xi=(t,e)=>{const i=e;if(!i||!this.Zx)return;const{iRegion:s,region:r}=this.tb(this.Zx,i);this.eb=this.engine.clientLocation2Engine(t.clientX,t.clientY),this.ib(r,s),this.P.emit("touchMove",this,t),Kt(t)},this.Zi=(t,e)=>{const i=e;if(!i||!this.Zx)return;const{iRegion:s,region:r}=this.tb(this.Zx,i);this.eb=void 0,this.sb(r,s),this.Yx&&this.ls.os.vs(r,!1),this.P.emit("touchEnd",this,t),Kt(t)},this.ff.wn||this.ff.An||this.ls.Mn(3),(null==o?void 0:o.disableAnimations)&&(this.Ze=!1),this.hb=i.Hp("mapChart plotting",0),this.onResize(this.Kx),this.ap.Ch("Map Chart");const a=Lt(o?o.autoCursorBuilder:void 0,al);this.rb=a.Fx(i.Bx(),this.ct,this.ct,this.Ji).setVisible(!1),this.nb=this.ss.xg(),this.ep(n,this.uiScale),this.ob=this.hb.ab(this.ct).setMouseInteractions(this.ki).setMouseEnterEventHandler(((t,e,i)=>this.Ri(e,i))).setMouseLeaveEventHandler(((t,e,i)=>this.Ei(e,i))).setMouseClickEventHandler(((t,e,i)=>this.Vi(e,i))).setMouseDoubleClickEventHandler(((t,e,i)=>this.Ni(e,i))).setMouseDownEventHandler(((t,e,i)=>this.Gi(e,i))).setMouseUpEventHandler(((t,e,i)=>this.Wi(e,i))).setMouseMoveEventHandler(((t,e,i)=>this.zi(e,i))).setMouseDragStartEventHandler(((t,e,i,s)=>this.Hi(e,i,s))).setMouseDragEventHandler(((t,e,i,s,r,n)=>this.Ui(e,i,s,r,n))).setMouseDragStopEventHandler(((t,e,i,s,r)=>this.$i(e,i,s,r))).setMouseWheelEventHandler(((t,e,i)=>this.ji(e,i))).setTouchStartEventHandler(((t,e,i)=>this.Yi(e,i))).setTouchMoveEventHandler(((t,e,i)=>this.Xi(e,i))).setTouchEndEventHandler(((t,e,i)=>this.Zi(e,i))).Me(this.Ji.mapChartFillStyle).ve(this.Ji.mapChartStrokeStyle),this.lb=this.hb.ab(this.ct).setMouseInteractions(this.ki).Me(this.Ji.mapChartOutlierRegionFillStyle).ve(this.Ji.mapChartOutlierRegionStrokeStyle);const l=Lt(o&&o.type,ul.World);this.Qx=l,this.ub(l).then((()=>{this.P.emit("mapDataReady")}))}setFillStyle(t){return this.ob.Me(t),this.ls.Ss(),this}getFillStyle(){return this.ob.Th()}setStrokeStyle(t){return this.ob.ve(t),this.ls.Ss(),this}getStrokeStyle(){return this.ob.Un()}setEffect(t){return this.nb.ys(t),this.ls.Ss(),this}getEffect(){return this.nb.xs()}setOutlierRegionFillStyle(t){return this.lb.Me(t),this.ls.Ss(),this}getOutlierRegionFillStyle(){return this.lb.Th()}setOutlierRegionStrokeStyle(t){return this.lb.ve(t),this.ls.Ss(),this}getOutlierRegionStrokeStyle(){return this.lb.Un()}setSeparateRegionFillStyle(t){return this.Wx="function"==typeof t?t(this.Wx):t,this.Gx.forEach((t=>t.Me(this.Wx))),this.ls.Ss(),this}getSeparateRegionFillStyle(){return this.Wx}setSeparateRegionStrokeStyle(t){return this.Hx="function"==typeof t?t(this.Hx):t,this.Gx.forEach((t=>t.ve(this.Hx))),this.ls.Ss(),this}getSeparateRegionStrokeStyle(){return this.Hx}invalidateRegionValues(t){if(!this.Zx||!this.cb)return this.fb=this.fb||[],this.fb.push(t),this;if("function"==typeof t)for(let e=0;e{t.gb(r)}))}}else for(const e of t)if(e)for(let t=0;t{t.gb(e.value)}))}}return this.ls.Ss(),this}setAutoCursor(t){return this.rb&&t(this.rb),this.ls.Ss(),this}getAutoCursor(){return this.rb}setAutoCursorMode(t){return this.Ux=t,this.ls.Ss(),this}getAutoCursorMode(){return this.Ux}setCursorResultTableFormatter(t){return this.$x=t,this.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}onMouseDragStart(t){return this.P.on("mouseDragStart",t)}onMouseDrag(t){return this.P.on("mouseDrag",t)}onMouseDragStop(t){return this.P.on("mouseDragStop",t)}onMouseWheel(t){return this.P.on("mouseWheel",t)}onTouchStart(t){return this.P.on("touchStart",t)}onTouchMove(t){return this.P.on("touchMove",t)}onTouchEnd(t){return this.P.on("touchEnd",t)}offTouchStart(t){return this.P.off(t,"touchStart")}offTouchMove(t){return this.P.off(t,"touchMove")}offTouchEnd(t){return this.P.off(t,"touchEnd")}setMouseInteractions(t){return this.ki=t,this.ob.setMouseInteractions(t),this}getMouseInteractions(){return this.ki}setHighlight(t){var e;return t=ve(t),this.jx=t,null===(e=this.Zx)||void 0===e||e.regions.forEach((e=>{this.ls.os.vs(e,t)})),this.P.emit("highlight",t),this}getHighlight(){return this.jx}setAnimationHighlight(t){var e;return null===(e=this.Zx)||void 0===e||e.regions.forEach((e=>{this.ls.os.Ms(e,t)})),this}getAnimationHighlight(){var t;return this.ls.os._s(null===(t=this.Zx)||void 0===t?void 0:t.regions[0])}setHighlightOnHover(t){return this.Yx=t,!1===t&&this.getHighlight()>0&&this.setHighlight(!1),this}getHighlightOnHover(){return this.Yx}onHighlight(t){return this.P.on("highlight",t)}offHighlight(t){return this.P.off(t)}offMapDataReady(t){return this.P.off(t,"mapDataReady")}offViewChange(t){return this.P.off(t,"viewChange")}async ub(t){const e=await((t,e)=>{let i;if(t===ul.World)i="countries_world.json";else if(t===ul.NorthAmerica)i="countries_northAmerica.json";else if(t===ul.SouthAmerica)i="countries_southAmerica.json";else if(t===ul.Africa)i="countries_africa.json";else if(t===ul.Europe)i="countries_europe.json";else if(t===ul.Asia)i="countries_asia.json";else if(t===ul.USA)i="states_usa.json";else if(t===ul.Canada)i="territoriesProvinces_canada.json";else{if(t!==ul.Australia){const e=`LCJS MapChart unidentified \`type\`: ${t}`;throw xt.alert(e),new Error(e)}i="territories_australia.json"}const s=`${e}/maps/${i}`;return xt.fetch(s).then((t=>t.json())).catch((t=>{Ee(e,s,"Map Chart",{shouldCrash:!0})}))})(t,this.ff.Hs);this.cb=new Array(e.regions.length).map((t=>{})).fill(void 0);const i=yl[t];if(!i)throw new Error("Unidentified map type.");for(const t of e.outliers)for(const e of t.geometry)this.lb.kr().tl(e);if(t===ul.USA){const t=25.8,e=29.7;this.Gx.push(this.hb._e(this.ct).setMouseInteractions(!1).Me(this.Wx).ve(this.Hx).we({x:-126,y:t}).q({x:10,y:e-t}),this.hb._e(this.ct).setMouseInteractions(!1).Me(this.Wx).ve(this.Hx).we({x:-113,y:t}).q({x:7,y:e-t}))}const s=this.ls.os.wr(this.ob,{animationEnabled:this.Ze});for(let i=0;i{o.forEach((e=>e.us(t)))}))}if(this.nb.ds([this.ob]),this.qx=i,this.Jx(t,this.ct,i),this.Zx=e,this.fb){for(const t of this.fb)this.invalidateRegionValues(t);this.fb=void 0}this.ls.Ss()}Jx(t,e,i){const s=pl[t],r=e.x.getCellSize(),n=e.y.getCellSize()/r,o={min:{x:i.min.x,y:i.min.y},max:{x:i.max.x,y:i.max.y}};if(ns){const t=(o.max.y-o.min.y)*(n/s-1);o.min.y-=t/2,o.max.y+=t/2}e.x.Z(o.min.x,o.max.x),e.y.Z(o.min.y,o.max.y);const h=this.ct.x.$t(),a=this.ct.y.$t();this.P.emit("viewChange",{latitudeRange:{start:o.min.y,end:o.max.y},longitudeRange:{start:o.min.x,end:o.max.x},margin:{top:a[1],bottom:a[0],left:h[0],right:h[1]}})}ib(t,e){this.pb={region:t,iRegion:e},this.ls.Ss()}sb(t,e){this.pb&&t===this.pb.region&&(this.pb=void 0,this.ls.Ss())}tb(t,e){const i=Array.from(this.Xx.entries()).findIndex((([t,i])=>i.includes(e)));return{iRegion:i,region:null==t?void 0:t.regions[i]}}setAnimationsEnabled(t){return this.Ze=!t,this}getAnimationsEnabled(){return this.Ze}getMinimumSize(){}Sd(){return[this]}Ae(t){super.Ae(t),super.sp(),Nh.fp(this.ap,this.rp);const e=p(this.ct.x.Vt(),this.ct.y.Vt(),this.ct.x.Gt(),this.ct.y.Gt());this.hb.kS(e);const i=this.ls.vn()||this.eb;if(this.pb&&i){const t=this.cb&&this.cb[this.pb.iRegion];let e=at(i,this.engine.scale,this.ct);e={x:Ct(e.x,this.ct.x.getInnerStart(),this.ct.x.getInnerEnd()),y:Ct(e.y,this.ct.y.getInnerStart(),this.ct.y.getInnerEnd())};let s=e.x,r=e.y;const n=this.pb.region.transform;this.pb.region.outlier&&n&&(s=(s-n.translate.x-n.vertexBoundaries.min.x)/n.scale.x+n.vertexBoundaries.min.x,r=(r-n.translate.y-n.vertexBoundaries.min.y)/n.scale.y+n.vertexBoundaries.min.y),this.rb.setPosition(e).setVisible(!0).getResultTable().setContent(this.$x(new Ja,this.pb.region,t,s,r,this).vc())}else this.rb.setVisible(!1);return this.rb.Ts().Ae(),this}dispose(){return this.hb.G(),this.rb.dispose(),zh(this.ct),super.dispose()}Y(){return super.Y(),this.ct.Y(),this}X(){return super.X(),this.ct.X(),this}ld(){return de(this.getFillStyle())}attach(t,e){return t.setText(this.getTitle()),t.setButtonOffStrokeStyle(t.getButtonOffStrokeStyle().setThickness(1)),t.setButtonOnStrokeStyle(t.getButtonOnStrokeStyle().setThickness(1)),t.setOn(!0).setLocked(!0),t.onMouseEnter((()=>{this.setHighlight(!0)})),t.onMouseLeave((()=>{this.setHighlight(!1)})),this.onMouseEnter((()=>t.setHighlight(!0))),this.onMouseLeave((()=>t.setHighlight(!1))),this.onTouchStart((()=>t.setHighlight(!0))),this.onTouchEnd((()=>t.setHighlight(!1))),ce(t,this.Ji,{fill:this.getFillStyle()}),this}}const bl=(t,e,i,s,r,n)=>(t.addRow(`${e.name}`).addRow(vl(s,r)),void 0!==i&&t.addRow(`Region value: ${i.toFixed(1)}`),t),vl=(t,e)=>{const i=t>0,s=e>0;return`${[ge(Math.abs(0|t),2),"° ",ge(Math.abs(0|(t<0?t=-t:t)%1*60),2),"' "].join("")+(i?"E":"W")}, ${[ge(Math.abs(0|e),2),"° ",ge(Math.abs(0|(e<0?e=-e:e)%1*60),2),"' "].join("")+(s?"N":"S")}`};class Ml extends $s{constructor(t,e,i,s,r,n,o,h,a){super(t,e,e.mb(i),s,r,{numeric:e.yb({amplitude:s.polarAmplitudeAxisNumericTicks,radial:s.polarAmplitudeAxisNumericTicks}),datetime:e.yb({amplitude:s.polarAmplitudeAxisDateTimeTicks,radial:s.polarAmplitudeAxisDateTimeTicks}),time:e.yb({amplitude:s.polarAmplitudeAxisTimeTicks,radial:s.polarAmplitudeAxisTimeTicks})},{type:"linear"}),this.Sb=n,this.xb=o,this.bb=h,this.ss=a,this.vb=i,this.Mb=e.yb({amplitude:s.polarAmplitudeAxisStrokeStyle,radial:s.polarRadialAxisStrokeStyle}),this.kh=h.Sr(i).setMouseInteractions(!1).Ih(e.yb({amplitude:s.polarAmplitudeAxisTitleFont,radial:s.polarRadialAxisTitleFont})).Me(e.yb({amplitude:s.polarAmplitudeAxisTitleFillStyle,radial:s.polarRadialAxisTitleFillStyle})),this.Bh=this.ss.xg([this.kh]).ys(s.effectsText)}setTickStrategy(t,e){return super.Mh(t,e)}setStrokeStyle(t){return this.Mb="function"==typeof t?t(this.Mb):t,this.xb.Ss(),this}getStrokeStyle(){return this.Mb}Qh(t,e){return new Al(e,t,this.vb,this.bb,this.bb,this._b(this.Sb,this.vb),this.bb.De(this.vb).setMouseInteractions(!1))}tr(t,e){const i=this.Ab(this.vb,t);this.wb&&!1===this.wb(t)?t.Ve.setVisible(!1):t.Ve.setVisible(!0).we(ri(this.kb(this.vb,t.u),i.padding)).Sa(i.alignment).Ph(i.rotation).da(i.offset.x,i.offset.y),this.Cb(this.vb,t.Tb,t.Fb,t)}setMouseInteractions(t){return this}Ae(){this.Hh({physicalAxisSize:0});const t=this.er(((t,e)=>{const i=e.dh.Jh,s=.5*this.Mb.getThickness()+i.tickLength+i.tickPadding+Math.abs(e.Ve.Ts().Ht().y/this.vb.Ai().y)+i.labelPadding;return Math.max(t,s)}),0);return this.Ib(this.vb,this.Mb,t),this.Pb(this.vb,this.kh,t),t}}class Al extends qo{constructor(t,e,i,s,r,n,o,h){super(t,e,s,i,r,i,h),this.Tb=n,this.Fb=o,n.setMouseInteractions(!1),this.Qi.push(n,o)}}class wl extends Ml{constructor(t,e,i,s,r,n,o,h,a){super(t,Tl((()=>this.Ag())),e,i,s,r,n,o,h),this.Bm=this.xb.De(this.vb).setMouseInteractions(!1),this.Db=a,this.setScrollStrategy(zs.expansion),this.setTickStrategy(Os.Numeric),this.setTitle("Amplitude")}Ag(){return this.Db()}dr(t,e){return Jo(t,e,this.vb.y)}pr(t,e,i){const s=2*(e-t),r=this.vb.x.mi(s);return{min:t-i*r,max:e+i*r}}kb(t,e){return{x:t.Bb()?e-t.Ob().start:t.Ob().start-e,y:0}}_b(t,e){return t.Dc(e)}Cb(t,e,i,s){const r=s.dh.Jh,n=t.Bb()?s.u-t.Ob().start:t.Ob().start-s.u;It(s.u,t.Ob().start)||It(s.u,t.Ob().end)?e.setVisible(!1):e.setVisible(!0).Nl(0).Be(360).$l(void 0).Ul(0).Gl(n).$l(60).Me(z).ve(r.gridStrokeStyle);const o=.5*this.Mb.getThickness();i.Oe({x:n,y:-o*t.Ai().y}).Be({x:n,y:-(o+r.tickLength)*t.Ai().y}).Pe(r.tickStyle)}Ab(t,e){const i=e.dh.Jh;return{alignment:{x:0,y:1},padding:{x:0,y:t.Ai().y*-(.5*this.Mb.getThickness()+i.tickLength+i.tickPadding)},rotation:0,offset:{x:0,y:0}}}Ib(t,e,i){const s=t.Bb()?t.Ob().end-t.Ob().start:t.Ob().start-t.Ob().end;this.Bm.Oe({x:0,y:0}).Be({x:s,y:0}).Pe(e)}Pb(t,e,i){const s=t.Bb()?(t.Ob().start+t.Ob().end)/2-t.Ob().start:t.Ob().start-(t.Ob().start+t.Ob().end)/2;e.Sa({x:0,y:1}).we({x:s,y:-i*t.Ai().y})}}const Tl=t=>({...Sa(t,(t=>t.getAmplitudeMin()),(t=>t.getAmplitudeMax()),(t=>{})),mb:t=>({getInnerStart:()=>t.Ob().start,getInnerEnd:()=>t.Ob().end,Z:(e,i)=>t.Lb(e,i),rt:(e,i,s,r,n)=>t.y.rt(e,i,s,r,n)}),yb:t=>t.amplitude});class El extends Ml{constructor(t,e,i,s,r,n,o,h){super(t,Cl,e,i,s,r,n,o,h),this.Rb=90,this.Eb=12,this.zb=Il,this.Bm=this.xb.Dc(this.vb).setMouseInteractions(!1),this.wb=t=>{let e=180*(t.u-this.vb.Vb())/Math.PI%360;for(;e<0;)e+=360;for(;e>360;)e-=360;if(e>=0&&e<=20||e>=340&&e<=360)return!1},this.je=void 0,this.setTickStyle(i.polarRadialAxisTickStyle),this.setTitle("Degrees"),this.setNorth(this.Rb)}setTickStyle(t){return this.Nb="function"==typeof t?t(this.Nb):t,this.Gb(),this.xb.Ss(),this}getTickStyle(){return this.Nb}setTickFormattingFunction(t){return this.zb=t,this.Gb(),this.xb.Ss(),this}getTickFormattingFunction(){return this.zb}setClockwise(t){this.vb.Wb(t);const e=this.Rb*Math.PI/180;return t?this.vb.Hb(e+Math.PI/2):this.vb.Hb(e-Math.PI/2),this.xb.Ss(),this}getClockwise(){return!this.vb.Ub()}setNorth(t){for(;t<0;)t+=360;t%=360,this.Rb=t;const e=t*Math.PI/180;return this.getClockwise()?this.vb.Hb(e+Math.PI/2):this.vb.Hb(e-Math.PI/2),this.xb.Ss(),this}getNorth(){return 180*this.vb.Vb()/Math.PI}setDivision(t){return this.Eb=t,this.Gb(),this.xb.Ss(),this}getDivision(){return this.Eb}Ag(){return[]}dr(t,e){return e}pr(t,e,i){return{min:t,max:e}}kb(t,e){const i=t.Ub()?1:-1,s=t.Vb(),r=t.Bb()?t.Ob().end-t.Ob().start:t.Ob().start-t.Ob().end;return{x:Math.cos((e-s)*i)*r,y:Math.sin((e-s)*i)*r}}_b(t,e){return t.De(e)}Cb(t,e,i,s){const r=this.Nb,n=t.Ub()?1:-1,o=t.Vb(),h=(s.u-o)*n,a=Math.cos(h),l=Math.sin(h),u=t.Bb()?t.Ob().end-t.Ob().start:t.Ob().start-t.Ob().end,c={x:a*u,y:l*u};e.Oe({x:0,y:0}).Be(c);const d={x:c.x+a*r.tickLength*t.Ai().x,y:c.y+l*r.tickLength*t.Ai().y};i.Oe(c).Be(d),e.Pe(r.gridStrokeStyle),i.Pe(r.tickStyle)}Ab(t,e){const i=this.Nb,s=t.Ub()?1:-1,r=t.Vb();let n,o=(e.u-r)*s;for(;o<0;)o+=2*Math.PI;for(;o>=2*Math.PI;)o-=2*Math.PI;n=o>0&&o<=Math.PI?-o+Math.PI/2:-o-Math.PI/2;const h=i.tickLength+i.tickPadding,a=Math.cos(o)*h*t.Ai().x,l=Math.sin(o)*h*t.Ai().y;return{alignment:{x:0,y:0},padding:{x:a,y:l},rotation:180*n/Math.PI,offset:{x:a,y:l}}}Ib(t,e,i){const s=t.Bb()?t.Ob().end-t.Ob().start:t.Ob().start-t.Ob().end;this.Bm.Nl(0).Be(360).Ul(0).Gl(s+.5*e.getThickness()*t.Ai().x).$l(360).Me(z).ve(e)}Pb(t,e,i){const s=t.Vb(),r=this.Ab(t,{u:0+s}),n=t.Bb()?t.Ob().end-t.Ob().start:t.Ob().start-t.Ob().end;e.Sa(r.alignment).Ph(r.rotation).da(r.offset.x,r.offset.y).we(ri({x:n,y:0},r.padding))}Gb(){this.Eh({Ne:[],Ge:[{Ve:"Radial ticks",Fg:0,Jh:this.Nb,Kh:this.zb,Mr:(t,e,i,s)=>{const r=[],n=2*Math.PI/this.Eb;for(let t=0;t<2*Math.PI;t+=n)r.push(t);return r},fh:{ir:()=>{},gh:()=>!1},_r:void 0}],Ee:Il,zh:void 0,Vh:void 0})}}const Il=(t,e,i)=>(180*t/Math.PI).toFixed(0),Cl={nr:()=>{},ar:()=>{},ur:()=>{},mb:t=>({getInnerStart:()=>0,getInnerEnd:()=>2*Math.PI,Z:(t,e)=>{},rt:(e,i,s,r,n)=>t.x.rt(e,i,s,r,n)}),yb:t=>t.radial},Pl=t=>!!(t&&"object"==typeof t&&"axisAmplitude"in t&&"axisRadial"in t),kl=t=>!!(t&&"object"==typeof t&&"angle"in t&&"number"==typeof t.angle&&"amplitude"in t&&"number"==typeof t.amplitude);class Fl extends Gi{constructor(t,e,i,s,r,n){super(e,i,r,n),this.bs="Sector",this.$b=0,this.jb=1*Math.PI/2,this.Yb=void 0,this.Xb=void 0,this.As=t,this.vb=s,this.kp=this.As.Dc(this.vb).us(this.getHighlight()),this.cs(this.kp),this.Se=r.polarSectorFillStyle,this.xe=r.polarSectorStrokeStyle,this.setMouseInteractions(!1)}setAngleStart(t){return this.$b=Ct(t,0,360),this.As.Ss(),this}getAngleStart(){return this.$b}setAngleEnd(t){return this.jb=Ct(t,0,360),this.As.Ss(),this}getAngleEnd(){return this.jb}setAmplitudeStart(t){return this.Yb=t,this.As.Ss(),this}getAmplitudeStart(){return this.Yb}setAmplitudeEnd(t){return this.Xb=t,this.As.Ss(),this}getAmplitudeEnd(){return this.Xb}setFillStyle(t){return this.Se="function"==typeof t?t(this.Se):t,this.As.Ss(),this}getFillStyle(){return this.Se}setStrokeStyle(t){return this.xe="function"==typeof t?t(this.xe):t,this.As.Ss(),this}getStrokeStyle(){return this.xe}Ae(){const t=this.vb.Ob(),e=180*this.vb.Vb()/Math.PI,i=void 0!==this.Yb?Ct(this.Yb,t.start,t.end):t.start,s=void 0!==this.Xb?Ct(this.Xb,t.start,t.end):t.end,r=this.vb.Bb()?i-t.start:t.start-i,n=this.vb.Bb()?s-t.start:t.start-s,o=Math.min(r,n),h=Math.max(r,n),a=this.vb.Ub()?1:-1,l=Math.abs(this.jb-this.$b);this.kp.Nl((this.$b-e)*a).Be((this.jb-e)*a).Ul(100*o/h).Gl(h).Me(this.Se).ve(this.xe).$l(Math.ceil(l/2))}ke(t,e){t.us(e),this.As.Ss()}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se,stroke:this.xe}),this}}class Bl extends Gi{constructor(){super(...arguments),this.Km=!0,this.Zb=!0}setAutoScrollingEnabled(t){return this.Km=t,this.Ki.ls.Ss(),this}getAutoScrollingEnabled(){return this.Km}ey(){}Ae(){}om(){}setCursorEnabled(t){return this.Zb=t,this}getCursorEnabled(){return this.Zb}}class _l extends Bl{constructor(t,e,i,s,r,n){super(e,i,r,n),this.As=t,this.Ki=e,this.scale=s}getAmplitudeMin(){return this.Kb?this.Kb.min:void 0}getAmplitudeMax(){return this.Kb?this.Kb.max:void 0}}const Ll=(t,e,i,s,r)=>t.addRow(e.getName()).addRow("Angle:","",Math.round(i).toString()).addRow("Amplitude","",r(s)),Dl=(t,e)=>{const i=[],s=e.Ob().start,r=e.Ob().end,n=e.Bb(),o=e.Ub()?1:-1,h=e.Vb(),a=Math.abs(r-s),l=Math.min(s,r)+.001*a,u=Math.max(s,r)-.001*a;for(const e of t){const t=Ct(e.amplitude,l,u),r=e.angle*Math.PI/180-h,a=Math.cos(r*o)*(n?t-s:s-t),c=Math.sin(r*o)*(n?t-s:s-t),d=e.color;i.push({x:a,y:c,color:d})}return i},zl=t=>{const e={min:Pe,max:ke};for(const i of t)e.min=Math.min(e.min,i.amplitude),e.max=Math.max(e.max,i.amplitude);return e},Ol=t=>t.slice().map((t=>t.angle>=0&&t.angle<=360?t:{...t,angle:t.angle%360})),Rl=(t,e)=>{let i=gi(t);for(e.Ub()||(i*=-1),i+=180*e.Vb()/Math.PI;i<0;)i+=360;i%=360;const s=ii(t),r=e.Ob(),n=Math.abs(r.end-r.start);return{angle:i,amplitude:Mo(r.start,r.end,s/n)}};class Vl extends _l{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n),this.bs="Heatmap Series",this.qb=!0,this.$x=Nl,this.ld=()=>de(this.Se);const h=this.Ki.getSeries().length;this.Se=ye(this.Ji.polarHeatmapSeriesFillStyle||this.Ji.heatmapGridSeriesFillStyle,h);const a=o.amplitudeStart||0,l=o.amplitudeEnd?(o.amplitudeEnd-a)/(o.annuli-1):o.amplitudeStep||1,u={sectors:o.sectors,annuli:o.annuli,amplitudeStart:a,amplitudeStep:l,heatmapDataType:"intensity",dataOrder:o.dataOrder||"annuli"};this._n=u,this.Jb=t.Qb(s,[],u).Me(this.Se).us(this.getHighlight()),this.cs(this.Jb);const c=Math.min(u.amplitudeStart,u.amplitudeStart+(u.annuli-1)*u.amplitudeStep),d=Math.max(u.amplitudeStart,u.amplitudeStart+(u.annuli-1)*u.amplitudeStep);this.Kb={min:c,max:d},this.setHighlightOnHover(!1)}invalidateIntensityValues(t){if(Array.isArray(t)){if(0===t.length||0===t[0].length)return this;const e={x:t.length,y:t[0].length,sectors:"annuli"===this._n.dataOrder?t[0].length:t.length,annuli:"annuli"===this._n.dataOrder?t.length:t[0].length},i="annuli"===this._n.dataOrder?this._n.annuli:this._n.sectors,s="annuli"===this._n.dataOrder?this._n.sectors:this._n.annuli;if(e.x>i||e.y>s){if(!0===this.Ki.ff.Pn){const t=`PolarHeatmapSeries.invalidateIntensityValues intensity matrix overflow.\nHeatmap ${i}x${s}, input ${e.x}x${e.y}.\nExcess data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(t)}const r=[];for(let e=0;eo||n>h){if(!0===this.Ki.ff.Pn){const t=`PolarHeatmapSeries.invalidateIntensityValues intensity matrix overflow.\nMax indexes ${o}x${h}, input ${e.primary}x${e.secondary} starting at [${i},${r}].\nOut of bounds data will be automatically clipped. This can result in sub-optimal performance.`;xt.console.warn(t)}const a=Math.max(s-o,0),l=e.primary-a,u=Math.max(n-h,0),c=[];for(let e=0;e0?-u:void 0);if(0===(t={iSector:t.iSector,iAnnulus:t.iAnnulus,values:c}).values.length||0===t.values[0].length)return this}this.Jb.dS({type:"intensity",lengthPrimary:t.values.length,lengthSecondary:t.values[0].length,startPrimary:i,startSecondary:r,values:t.values})}return this.As.Ss(),this}setFillStyle(t){return this.Se="function"==typeof t?t(this.Se):t,this.Jb.Me(this.Se),this.As.Ss(),this}getFillStyle(){return this.Se}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}clear(){return this.Jb.Ha(),this.As.Ss(),this}setCursorInterpolationEnabled(t){return this.qb=t,this.As.ls.Ss(),this}getCursorInterpolationEnabled(){return this.qb}setCursorEnabled(t){return super.setCursorEnabled(t)}setIntensityInterpolation(t){return t=t||"disabled",this.Jb.uS(t),this.As.Ss(),this}getIntensityInterpolation(){return this.Jb.cS()}Xm(){return this.Km&&this.getVisible()}ke(t,e){t.us(e),this.As.Ss()}zx(t,e){const i=at(t,this.Ki.engine.scale,this.scale),s=Rl(i,this.scale),r=this.qb?this.Jb.tv(s):this.Jb.zx(s);if(r)return ll(Dl([r],this.scale)[0],this.scale,this.$x(new Ja,this,{angleDeg:r.angle,amplitude:r.amplitude,intensity:r.cellValue,iAnnulus:r.iAnnulus,iSector:r.iSector},this.Ki.getAmplitudeAxis().formatValue).vc(),this,this.Se)}solveNearestFromScreen(t){return this.zx(Yo(t,this.Ki.ls),!1)}Ae(){}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se}),this}}const Nl=(t,e,i,s)=>t.addRow(e.getName()).addRow("Angle:","",Math.round(i.angleDeg).toString()).addRow("Amplitude","",s(i.amplitude)).addRow("Intensity","",i.intensity.toFixed(1));class Gl extends _l{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,o),this.bs="Line Series",this.sv=[],this.ev=!1,this.hv=!1,this.$x=Ll,this.jl=ye(this.Ji.polarLineSeriesStrokeStyle,n),this.rv=t.tm(s,void 0,[Kh.UserSeries]).Pe(this.jl).us(this.getHighlight()).La(Cr.Nearest),this.cs(this.rv)}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}setData(t){return this.sv=Ol(t),this.ev=!0,this.Kb=zl(this.sv),this.As.Ss(),this}setStrokeStyle(t){this.jl="function"==typeof t?t(this.jl):t;const e=this.jl;return this.rv.Pe(e),this.As.Ss(),this}getStrokeStyle(){return this.jl}setConnectDataAutomaticallyEnabled(t){return this.hv=t,this.As.Ss(),this}getConnectDataAutomaticallyEnabled(){return this.hv}Xm(){return this.Km&&this.sv.length>0&&this.getVisible()}ke(t,e){t.us(e),this.As.Ss()}zx(t,e){return this.nv(t,this.rv)}solveNearestFromScreen(t){return this.nv(Yo(t,this.Ki.ls),this.rv)}nv(t,e){const i=e.ov(t);if(!i)return;const{angle:s,amplitude:r}=Rl(i,this.scale);return ll(i,this.scale,this.$x(new Ja,this,s,r,this.Ki.getAmplitudeAxis().formatValue).vc(),this,this.jl.getFillStyle())}Ae(){if(this.ev||this.scale.av()){const t=Dl(this.sv,this.scale),e=Xe(t);this.hv?(t.push({...t[0]}),this.rv.bl(!0)):this.rv.bl(!1),this.rv.Ha().Wa(t).ko(e),this.ev=!1,this.rv.Ts()}}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{stroke:this.jl}),this}}class Hl extends _l{constructor(t,i,s,r,n,o,h){super(t,i,s,r,n,h),this.bs="Point Line Series",this.sv=[],this.ev=!1,this.hv=!1,this.lv=3,this.Ko=0,this.uv=e.PointShape.Circle,this.$x=Ll,this.Se=ye(this.Ji.polarPointLineSeriesFillStyle,o),this.jl=ye(this.Ji.polarPointLineSeriesStrokeStyle,o),this.rv=t.tm(r,void 0,[Kh.UserSeries]).Pe(this.jl).us(this.getHighlight()).La(Cr.Nearest),this.cs(this.rv),this.cv=t.vy(r).Me(this.Se).za(this.uv).q(this.lv).us(this.getHighlight()).La(Cr.Nearest),this.cs(this.cv)}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}setData(t){return this.sv=Ol(t),this.ev=!0,this.Kb=zl(this.sv),this.As.Ss(),this}setStrokeStyle(t){this.jl="function"==typeof t?t(this.jl):t;const e=this.jl;return this.rv.Pe(e),this.As.Ss(),this}getStrokeStyle(){return this.jl}setPointFillStyle(t){this.Se="function"==typeof t?t(this.Se):t;const e=this.Se;return this.cv.Me(e),this.As.Ss(),this}getPointFillStyle(){return this.Se}setPointSize(t){return this.lv=t,this.cv.q(t),this.As.Ss(),this}getPointSize(){return this.lv}setPointShape(t){return this.uv=t,this.cv.za(this.uv),this}getPointShape(){return this.uv}setPointRotation(t){return this.Ko=t,this.cv.Ph(t),this.As.Ss(),this}getPointRotation(){return this.Ko}setConnectDataAutomaticallyEnabled(t){return this.hv=t,this.As.Ss(),this}getConnectDataAutomaticallyEnabled(){return this.hv}Xm(){return this.Km&&this.sv.length>0&&this.getVisible()}ke(t,e){t.us(e),this.As.Ss()}zx(t,e){return this.nv(t,this.rv)}solveNearestFromScreen(t){return this.nv(Yo(t,this.Ki.ls),this.rv)}nv(t,e){const i=e instanceof qr?e.zx(t):e.ov(t);if(!i)return;const{angle:s,amplitude:r}=Rl(i,this.scale);return ll(i,this.scale,this.$x(new Ja,this,s,r,this.Ki.getAmplitudeAxis().formatValue).vc(),this,"color"in i&&H(this.Se)?new V({color:i.color}):this.Se)}Ae(){if(this.ev||this.scale.av()){const t=Dl(this.sv,this.scale),e=Xe(t);this.hv?(t.push({...t[0]}),this.rv.bl(!0)):this.rv.bl(!1),this.rv.Ha().Wa(t).ko(e),this.cv.Ha().Wa(t).ko(e),this.ev=!1,this.rv.Ts(),this.cv.Ts()}}}class Ul extends _l{constructor(t,i,s,r,n,o,h){super(t,i,s,r,n,h),this.bs="Point Series",this.sv=[],this.ev=!1,this.lv=3,this.Ko=0,this.uv=e.PointShape.Circle,this.$x=Ll,this.Se=ye(this.Ji.polarPointSeriesFillStyle,o),this.cv=t.vy(r).Me(this.Se).za(this.uv).q(this.lv).us(this.getHighlight()).La(Cr.Nearest),this.cs(this.cv)}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}setData(t){return this.sv=Ol(t),this.ev=!0,this.Kb=zl(this.sv),this.As.Ss(),this}setPointFillStyle(t){this.Se="function"==typeof t?t(this.Se):t;const e=this.Se;return this.cv.Me(e),this.As.Ss(),this}getPointFillStyle(){return this.Se}setPointSize(t){return this.lv=t,this.cv.q(t),this.As.Ss(),this}getPointSize(){return this.lv}setPointShape(t){return this.uv=t,this.cv.za(this.uv),this}getPointShape(){return this.uv}setPointRotation(t){return this.Ko=t,this.cv.Ph(t),this.As.Ss(),this}getPointRotation(){return this.Ko}Xm(){return this.Km&&this.sv.length>0&&this.getVisible()}ke(t,e){t.us(e),this.As.Ss()}zx(t,e){const i=this.cv.zx(t);if(!i)return;const{angle:s,amplitude:r}=Rl(i,this.scale);return ll(i,this.scale,this.$x(new Ja,this,s,r,this.Ki.getAmplitudeAxis().formatValue).vc(),this,"color"in i&&H(this.Se)?new V({color:i.color}):this.Se)}solveNearestFromScreen(t){return this.zx(Yo(t,this.Ki.ls),!1)}Ae(){if(this.ev||this.scale.av()){const t=Dl(this.sv,this.scale),e=Xe(t);this.cv.Ha().Wa(t).ko(e),this.ev=!1,this.cv.Ts()}}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se}),this}}class Wl{constructor(t,e,i,s){this.P=new r.Eventer,this.dv=!1,this.Ki=t,this.fv=e,this.My=i,this.Aa=s}setGeometry(t){return this.gv=t,this.dv=!0,this.Ki.ls.Ss(),this}getGeometry(){return this.gv}setMouseInteractions(t){return this.Aa.setMouseInteractions(t),this}dispose(){return this.Aa.dispose(),this.fv(this),this.P.emit("dispose",this),this}onDispose(t){return this.P.on("dispose",t)}offDispose(t){return this.P.off(t,"dispose")}setVisible(t){const e=this.Aa.getVisible()!==t;return this.Aa.setVisible(t),e&&this.P.emit("visibleStateChanged",this,t),this.Ki.ls.Ss(),this}getVisible(){return this.Aa.getVisible()}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}}const Xl=(t,e,i)=>{const s=e.ct,r=i.ct;let n=(t.x-s.getInnerStart())/(s.getInnerEnd()-s.getInnerStart()),o=(t.y-r.getInnerStart())/(r.getInnerEnd()-r.getInnerStart());return 1===i.rg&&(n=1-n),1===e.rg&&(o=1-o),u(o,n)};class Yl extends Ka{constructor(t,e,i,s,r,n,o,h,a){super(t,e,Di(i.ct,s.ct),r,n,a),this.pv=!1,this.mv=!1,this.yv=!0,this.Sv=!0,this.xv=!1,this.bv=!1,this.setGridStrokeYStyle=t=>(this.vv.setGridStrokeStyle(t),this),this.getGridStrokeYStyle=()=>this.vv.getGridStrokeStyle(),this.axisX=i,this.axisY=s,this.Mv=o,this._v=h,this.Av=this.axisX.Bg(!1,this.Mv).setMouseInteractions(!1).setAllocatesAxisSpace(!1),this.vv=this.axisY.Bg(!1,this._v).setMouseInteractions(!1).setAllocatesAxisSpace(!1)}dispose(){return super.dispose(),this.Av.dispose(),this.vv.dispose(),this}pointAt(t){return super.pointAt(t),this.setPosition(at(t.location,t.scale,this.scale)),this}setPosition(t){super.setPosition(t),this.Av.setValue(t.x),this.vv.setValue(t.y);const e=Xl(u(this.Av.getValue(),this.vv.getValue()),this.axisX,this.axisY);return this.Av.setGridStrokeLength(this.xv?e.x:1),this.vv.setGridStrokeLength(this.bv?e.y:1),this}Ae(){this.Av.setVisible(this.Fi&&this.xx).setMarkerVisible(this.Fi&&this.xx&&this.pv),this.vv.setVisible(this.Fi&&this.xx).setMarkerVisible(this.Fi&&this.xx&&this.mv);const t=Xl(u(this.Av.getValue(),this.vv.getValue()),this.axisX,this.axisY);return this.Av.setGridStrokeLength(this.xv?t.x:1),this.vv.setGridStrokeLength(this.bv?t.y:1),super.Ae()}setGridStrokeXCut(t){return this.xv=t,this.As.Ss(),this}getGridStrokeXCut(){return this.xv}setGridStrokeYCut(t){return this.bv=t,this.As.Ss(),this}getGridStrokeYCut(){return this.bv}setGridStrokeXStyle(t){return this.Av.setGridStrokeStyle(t),this}getGridStrokeXStyle(){return this.Av.getGridStrokeStyle()}setTickMarkerXVisible(t){return this.pv=t,this.As.Ss(),this}getTickMarkerXVisible(){return this.pv}setTickMarkerYVisible(t){return this.mv=t,this.As.Ss(),this}getTickMarkerYVisible(){return this.mv}setTickMarkerX(t){return this.Av.setMarker(t),this}setTickMarkerY(t){return this.vv.setMarker(t),this}getTickMarkerX(){return this.Av.getMarker()}getTickMarkerY(){return this.vv.getMarker()}}class jl extends Za{constructor(t,e,i,s,r,n,o,h){super(t,e,i,s,r,h),this.xv=!1,this.bv=!1,this.wv=!1,this.kv=!1,this.Cv=new Map,this.Tv=new Map,this.pv=!0,this.mv=!0,this.bx=s,this.vx=r,this.Mv=n,this._v=o,this.Fv=h.cursorGridStrokeStyleX,this.Iv=h.cursorGridStrokeStyleY}dispose(){return super.dispose(),this.Cv.forEach((t=>t.dispose())),this.Tv.forEach((t=>t.dispose())),this.Pv=void 0,this.Dv=void 0,this}Ae(){return this.Pv&&this.Pv.setVisible(this.Fi&&this.xx).setMarkerVisible(this.Fi&&this.xx&&this.pv),this.Dv&&this.Dv.setVisible(this.Fi&&this.xx).setMarkerVisible(this.Fi&&this.xx&&this.mv),super.Ae()}pointAt(t){const{location:e}=t,{series:i}=t,{axisX:s}=i,{axisY:r}=i,n=this.rh(s,!0),o=this.rh(r,!1);n!==this.Pv&&this.Pv&&this.Pv.setVisible(!1),o!==this.Dv&&this.Dv&&this.Dv.setVisible(!1),n.setValue(e.x),o.setValue(e.y);const h=Xl(u(e.x,e.y),s,r);return n.setGridStrokeLength(this.xv?h.x:1),o.setGridStrokeLength(this.bv?h.y:1),this.Pv=n,this.Dv=o,super.pointAt(t)}wx(t){if(super.wx(t),t){const e=e=>e.setTextFillStyle(t);this.Pv&&this.wv&&this.Pv.setMarker(e),this.Dv&&this.kv&&this.Dv.setMarker(e)}}rh(t,e){let i=(e?this.Cv:this.Tv).get(t);return i||(e?(i=t.Bg(!1,this.Mv),this.Cv.set(t,i)):(i=t.Bg(!1,this._v),this.Tv.set(t,i)),this.qh(i,e),i.setMouseInteractions(!1).setAllocatesAxisSpace(!1)),i}qh(t,e){const i=e?this.Fv:this.Iv;return t.setGridStrokeStyle(i),t.setMouseInteractions(!1),(e?this.pv:this.mv)?t.setMarkerVisible(!0):t.setMarkerVisible(!1),t}setGridStrokeXCut(t){return this.xv=t,this.As.Ss(),this}getGridStrokeXCut(){return this.xv}setGridStrokeYCut(t){return this.bv=t,this.As.Ss(),this}getGridStrokeYCut(){return this.bv}setGridStrokeXStyle(t){return this.Fv=t instanceof Function?t(this.getGridStrokeXStyle()):t,this.Cv.forEach((t=>t.setGridStrokeStyle(this.Fv))),this}getGridStrokeXStyle(){return this.Fv}setGridStrokeYStyle(t){return this.Iv=t instanceof Function?t(this.getGridStrokeYStyle()):t,this.Tv.forEach((t=>t.setGridStrokeStyle(this.Iv))),this}getGridStrokeYStyle(){return this.Iv}setTickMarkerXVisible(t){return this.pv=t,this.As.Ss(),this}getTickMarkerXVisible(){return this.pv}setTickMarkerYVisible(t){return this.mv=t,this.As.Ss(),this}getTickMarkerYVisible(){return this.mv}setTickMarkerX(t){return this.Cv.forEach((e=>e.setMarker(t))),this.Mv=this.Mv.addStyler(t),this.As.Ss(),this}setTickMarkerY(t){return this.Tv.forEach((e=>e.setMarker(t))),this._v=this._v.addStyler(t),this.As.Ss(),this}setTickMarkerXAutoTextStyle(t){return this.wv=t,this.As.Ss(),this}getTickMarkerXAutoTextStyle(){return this.wv}setTickMarkerYAutoTextStyle(t){return this.kv=t,this.As.Ss(),this}getTickMarkerYAutoTextStyle(){return this.kv}}class Jl extends Qa{constructor(t,e,i,s,r){super(t,e,r),this.bx=t,this.vx=e,this.Mv=i,this._v=s,this.kx=r}}class $l extends Jl{constructor(){super(...arguments),this.Tx=(t,e,i,s)=>this.Cx(new jl(t,e,i,this.bx,this.vx,this.Mv,this._v,s),s),this.addStyler=t=>new $l(this.bx,this.vx,this.Mv,this._v,this.kx.map((t=>t)).concat(t)),this.setPointMarker=t=>new $l(t,this.vx,this.Mv,this._v,this.kx.map((t=>t))),this.setResultTableBackground=t=>new $l(this.bx,t,this.Mv,this._v,this.kx.map((t=>t)))}}class ql extends Jl{constructor(){super(...arguments),this.Fx=(t,e,i,s,r)=>this.Cx(new Yl(t,e,i,s,this.bx,this.vx,this.Mv,this._v,r),r),this.addStyler=t=>new ql(this.bx,this.vx,this.Mv,this._v,this.kx.map((t=>t)).concat(t)),this.setPointMarker=t=>new ql(t,this.vx,this.Mv,this._v,this.kx.map((t=>t))),this.setResultTableBackground=t=>new ql(this.bx,t,this.Mv,this._v,this.kx.map((t=>t)))}}const Zl=new $l(Dn,Dn,bo.PointableTextBox,bo.PointableTextBox,[(t,e)=>{il(t),t.setTickMarkerX((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerXTextFont).setTextFillStyle(e.cursorTickMarkerXTextFillStyle),mn(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerXBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerXBackgroundStrokeStyle)))})),t.setTickMarkerY((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerYTextFont).setTextFillStyle(e.cursorTickMarkerYTextFillStyle),mn(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerYBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerYBackgroundStrokeStyle)))}))}]),Kl=new ql(On,Dn,bo.PointableTextBox,bo.PointableTextBox,[(t,e)=>{sl(t,e),t.setTickMarkerX((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerXTextFont).setTextFillStyle(e.cursorTickMarkerXTextFillStyle),mn(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerXBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerXBackgroundStrokeStyle)))})),t.setTickMarkerY((t=>{t.setEffect(!0).setTextFont(e.cursorTickMarkerYTextFont).setTextFillStyle(e.cursorTickMarkerYTextFillStyle),mn(t)&&t.setBackground((t=>t.setFillStyle(e.cursorTickMarkerYBackgroundFillStyle).setStrokeStyle(e.cursorTickMarkerYBackgroundStrokeStyle)))}))}]),Ql=(t,i,s)=>{switch(t){case e.UIVisibilityModes.always:return!0;case e.UIVisibilityModes.never:return!1;case e.UIVisibilityModes.whenDragged:return s;case e.UIVisibilityModes.whenHovered:return i&&!s;case e.UIVisibilityModes.whenHoveredOrDragged:return s||i;case e.UIVisibilityModes.whenNotDragged:return!s;default:return!1}},tu=(t,e)=>Math.min(Math.max(t,e.getInnerStart()),e.getInnerEnd());class eu{constructor(t,i,s,n,o,h){this.Bv=e.UIVisibilityModes.always,this.Ov=e.UIVisibilityModes.always,this.po=!0,this.Ti=!1,this.Lv=!1,this.Rv=!1,this.jo=u(0,0),this.Yu=e.UIDraggingModes.draggable,this.Xu=void 0,this.P=new r.Eventer,this.Fi=!0,this.Ev=(t,i,s)=>{this.Lv=!0,this.As.Ss();const r=this.Yu===e.UIDraggingModes.notDraggable?this.Yu:s||this.Yu;this.Xu=this.As.ls.Tr(r===e.UIDraggingModes.notDraggable?e.MouseStyles.Restricted:r===e.UIDraggingModes.draggable?e.MouseStyles.Move:r===e.UIDraggingModes.onlyHorizontal?e.MouseStyles.Horizontal:e.MouseStyles.Vertical)},this.zv=()=>{this.Lv=!1,this.As.Ss(),this.As.ls.Fr(this.Xu)},this.Vv=(t,e)=>{this.Rv=!0,Kt(e),this.As.Ss()},this.Nv=(t,i)=>{if(this.Yu!==e.UIDraggingModes.notDraggable){const s=i||this.Yu,r=at(this.As.ls.Ce(t.x,t.y),this.As.ls.ct,this.scale),n=u(s!==e.UIDraggingModes.onlyVertical?tu(r.x,this.scale.x):this.jo.x,s!==e.UIDraggingModes.onlyHorizontal?tu(r.y,this.scale.y):this.jo.y);return this.setPosition(n),!0}return!1},this.Gv=(t,e)=>{this.Rv=!1,Kt(e),this.As.Ss()},this.onDispose=t=>this.P.on("dispose",t),this.offDispose=t=>this.P.off(t,"dispose"),this.As=t,this.renderingScale=i,this.scale=s,this.rb=n,this.Wv=o,this.Ji=h;const a=n.getPointMarker().setMouseInteractions(!0);a.onMouseEnter(((t,e)=>this.Ev(t,e))),a.onMouseLeave(this.zv),a.onMouseDragStart(this.Vv),a.onMouseDrag(((t,e)=>this.Nv(u(e.clientX,e.clientY))&&Kt(e))),a.onMouseDragStop(this.Gv),a.onTouchStart(this.Vv),a.onTouchMove(((t,e)=>this.Nv(u(e.clientX,e.clientY))&&Kt(e))),a.onTouchEnd(this.Gv),n.getResultTable().setMouseInteractions(!0),this.setPosition(this.jo)}setPosition(t){return this.jo=t,this.rb.setPosition(t),this.P.emit("positionChange",this,this.jo),this}getPosition(){return this.jo}onPositionChange(t){return this.P.on("positionChange",t)}offPositionChange(t){return this.P.off(t,"positionChange")}setPointMarkerVisibility(t){return this.Bv=t,this.As.Ss(),this}getPointMarkerVisibility(){return this.Bv}setResultTableVisibility(t){return this.Ov=t,this.As.Ss(),this}getResultTableVisibility(){return this.Ov}setMouseInteractions(t){return this.po=t,this.rb.getPointMarker().setMouseInteractions(t),this.rb.getResultTable().setMouseInteractions(t),this}getMouseInteractions(){return this.po}setAutoFitStrategy(t){return this.rb.setAutoFitStrategy(t),this}getAutoFitStrategy(){return this.rb.getAutoFitStrategy()}isAttached(){return!0}Ae(){const t=this.isAttached();return Ql(this.Bv,this.Lv,this.Rv)?this.rb.setPointMarkerVisible(!0):this.rb.setPointMarkerVisible(!1),t&&Ql(this.Ov,this.Lv,this.Rv)?this.rb.setResultTableVisible(!0):this.rb.setResultTableVisible(!1),this.rb.Ae(),this}Ts(){return this.rb.Ts(),this}pointAt(t){return this.rb.pointAt(t),this}dispose(){return this.Ti||(this.Ti=!0,this.Wv(this),this.rb.dispose(),this.P.emit("dispose")),this}setVisible(t){const e=this.Fi!==t;return this.Fi=t,this.rb.setVisible(t),e&&this.P.emit("visibleStateChanged",this,this.Fi),this}getVisible(){return this.Fi}onVisibleStateChanged(t){return this.P.on("visibleStateChanged",t)}offVisibleStateChanged(t){return this.P.off(t,"visibleStateChanged")}setPointMarker(t){return this.rb.setPointMarker(t),this}getPointMarker(){return this.rb.getPointMarker()}setResultTable(t){return this.rb.setResultTable(t),this}getResultTable(){return this.rb.getResultTable()}setDraggingMode(t=e.UIDraggingModes.notDraggable){return this.Yu=t,this.As.Ss(),this}getDraggingMode(){return this.Yu}}class iu extends eu{constructor(t,i,s,r,n,o,h){super(t,i,Di(s.ct,r.ct),n.Fx(t,i,s,r,h),o,h),this.Hv=e.UIVisibilityModes.always,this.Uv=e.UIVisibilityModes.always,this.$v=e.UIVisibilityModes.always,this.jv=e.UIVisibilityModes.always,this.gridStrokeStyleX=this.rb.getGridStrokeXStyle(),this.gridStrokeStyleY=this.rb.getGridStrokeYStyle(),this.As=t,this.axisX=s,this.axisY=r,this.Wv=o;const a=this.rb.getTickMarkerX().setMouseInteractions(!0);a.onMouseEnter(((t,i)=>this.Ev(t,i,e.UIDraggingModes.onlyHorizontal))),a.onMouseLeave(this.zv),a.onMouseDragStart(this.Vv),a.onMouseDrag(((t,i)=>this.Nv(u(i.clientX,i.clientY),e.UIDraggingModes.onlyHorizontal)&&Kt(i))),a.onMouseDragStop(this.Gv),a.onTouchStart(this.Vv),a.onTouchMove(((t,i)=>this.Nv(u(i.clientX,i.clientY),e.UIDraggingModes.onlyHorizontal)&&Kt(i)));const l=this.rb.getTickMarkerY().setMouseInteractions(!0);l.onMouseEnter(((t,i)=>this.Ev(t,i,e.UIDraggingModes.onlyVertical))),l.onMouseLeave(this.zv),l.onMouseDragStart(this.Vv),l.onMouseDrag(((t,i)=>this.Nv(u(i.clientX,i.clientY),e.UIDraggingModes.onlyVertical)&&Kt(i))),l.onMouseDragStop(this.Gv),l.onTouchStart(this.Vv),l.onTouchMove(((t,i)=>this.Nv(u(i.clientX,i.clientY),e.UIDraggingModes.onlyVertical)&&Kt(i)))}Ae(){const t=this.isAttached();return this.Fi&&t&&Ql(this.$v,this.Lv,this.Rv)?this.rb.setTickMarkerXVisible(!0):this.rb.setTickMarkerXVisible(!1),this.Fi&&t&&Ql(this.jv,this.Lv,this.Rv)?this.rb.setTickMarkerYVisible(!0):this.rb.setTickMarkerYVisible(!1),this.rb.setGridStrokeXStyle(this.Fi&&t&&Ql(this.Hv,this.Lv,this.Rv)?this.gridStrokeStyleX:st),this.rb.setGridStrokeYStyle(this.Fi&&t&&Ql(this.Uv,this.Lv,this.Rv)?this.gridStrokeStyleY:st),super.Ae()}setGridStrokeXVisibility(t){return this.Hv=t,this.As.Ss(),this}getGridStrokeXVisibility(){return this.Hv}setGridStrokeYVisibility(t){return this.Uv=t,this.As.Ss(),this}getGridStrokeYVisibility(){return this.Uv}setTickMarkerXVisibility(t){return this.$v=t,this.As.Ss(),this}getTickMarkerXVisibility(){return this.$v}setTickMarkerYVisibility(t){return this.jv=t,this.As.Ss(),this}getTickMarkerYVisibility(){return this.jv}setGridStrokeXCut(t){return this.rb.setGridStrokeXCut(t),this}getGridStrokeXCut(){return this.rb.getGridStrokeXCut()}setGridStrokeYCut(t){return this.rb.setGridStrokeYCut(t),this}getGridStrokeYCut(){return this.rb.getGridStrokeYCut()}setGridStrokeXStyle(t){return this.gridStrokeStyleX="function"==typeof t?t(this.gridStrokeStyleX):t,this}getGridStrokeXStyle(){return this.rb.getGridStrokeXStyle()}setGridStrokeYStyle(t){return this.gridStrokeStyleY="function"==typeof t?t(this.gridStrokeStyleY):t,this}getGridStrokeYStyle(){return this.rb.getGridStrokeYStyle()}setTickMarkerX(t){return this.rb.setTickMarkerX(t),this}getTickMarkerX(){return this.rb.getTickMarkerX()}setTickMarkerY(t){return this.rb.setTickMarkerY(t),this}getTickMarkerY(){return this.rb.getTickMarkerY()}setMouseInteractions(t){return super.setMouseInteractions(t),this.rb.getTickMarkerX().setMouseInteractions(t),this.rb.getTickMarkerY().setMouseInteractions(t),this}}class su extends iu{}class ru extends su{constructor(t,e,i,s,r,n){super(t,e,i.axisX,i.axisY,s,r,n),this.Yv=!1,this.As=t,this.owningSeries=i}setPosition(t){return super.setPosition(t),this.Yv=!1,this.As.Ss(),this}Ts(){if(!this.Yv){const t=this.owningSeries.solveNearestFromScreen(at(this.jo,this.scale,this.As.ls.ct));t?(this.jo=at(t.location,this.owningSeries.scale,this.scale),this.rb.pointAt(t),this.Yv=!0):this.rb.setPosition(this.jo)}return super.Ts()}isAttached(){return this.Yv}}class nu extends Bl{constructor(t,e,i,s,r,n,o,h,a,l){super(t,e,a,l),this.Xv=[],this.addMarker=(t=Kl)=>{const e=new ru(this.Zv(),this.Ki.uiScale,this,t,this.removeMarker,this.Ji);return this.Xv.push(e),e},this.removeMarker=t=>{const e=this.Xv.indexOf(t);-1!==e&&this.Xv.splice(e,1)},this.Qi=new Map,this.chart=t,this.As=i,this.axisX=s,this.axisY=r,this.axisXAttachHandler=n,this.axisYAttachHandler=o,this.Zv=h,this.scale=Di(s.ct,r.ct),this.Kv=t.qv,t.qv+=1,this.Jv(this.scale),this.attacheAxis(),this.onMouseEnter(this.chart.Qv),this.onMouseLeave(this.chart.tM),this.onMouseWheel(this.chart.Jm),this.onMouseDragStart(this.chart.iM),this.onMouseDrag(this.chart.Qm),this.onMouseDragStop(this.chart.sM),this.onTouchStart(this.chart.ty.onTouchStart),this.onTouchMove(this.chart.ty.onTouchMove),this.onTouchEnd(this.chart.ty.onTouchEnd)}attacheAxis(){this.eM=this.axisXAttachHandler(this),this.hM=this.axisYAttachHandler(this)}Ae(){super.Ae();for(let t=0;t{e.Bo(this.Kv)})),this.Ki.ls.Ss(),this}dispose(){return super.dispose(),this.Xv.slice().forEach((t=>t.dispose())),this.eM(this),this.hM(this),this}rM(){for(let t=0;t{const r=t.length;let n=0;if(void 0!==e){const r=i-e;if(r>0){const e=t.slice(n,r);n+=r,s(e,!0)}}for(;nt))=>{const i=[];let s;for(let r=0;r{const s=void 0!==i?i:0,r=new Array(t.length);for(let i=0;it.addRow(e.getName()).addRow("X","",e.axisX.formatValue(i)).addRow("Y","",e.axisY.formatValue(s));class uu extends nu{constructor(t,i,s,r,n,o,h,a,l,u,c){super(t,i,s,r,n,o,h,a,u,c),this.nM=[],this.Jl=[],this.oM=0,this.Ii=!1,this.Ci=e.HighlightModes.onHover,this.$x=lu,this.aM=l}setDataCleaning(t){const e=t&&t.minDataPointCount;return this.oM=void 0!==e&&e>0?e:0,this.As.Ss(),this}add(t){if(Array.isArray(t)?this.lM(t):this.lM([t]),this.Jl.length>0){const t=this.Jl[this.Jl.length-1];this.uM={x:t.x,y:t.y}}return this}addArrayX(t,e=1,i){let s=i;return s||(s=this.uM?this.uM.y+e:0),this.add(((t,e=1,i)=>{const s=void 0!==i?i:0,r=new Array(t.length);for(let i=0;i{const i=new Array(t.length);for(let s=0;st+e.Ua()+e.$a()),this.Jl.length)}clear(){this.cM=void 0;for(let t=0;t0&&this.getVisible()}getXMax(){return this.aM.getXMax(this.nM,this.cM)||0}getXMin(){return this.aM.getXMin(this.nM,this.cM)||0}getYMax(){return this.aM.getYMax(this.nM,this.cM)||0}getYMin(){return this.aM.getYMin(this.nM,this.cM)||0}ur(){const t=u(0,0);for(const e of this.nM)t.x=Math.max(t.x,e.sl()),t.y=Math.max(t.y,e.el());return t}dM(t,e,i,s){this.aM.dM(t,e,i,s,this.scale,(t=>{}))}ey(){super.ey();const t=this.nM.length;this.fM&&this.dM(this.nM,this.getPointAmount(),this.fM,this.oM),t!==this.nM.length&&this.rM()}Ae(){super.Ae();const t=this.getBoundaries();this.Jl.length>0&&(this.gM(this.Jl),this.Jl=[]);for(const e of this.nM)e.ko(t);return super.Ae()}om(){super.om(),this.cM=void 0,this.Jl.length=0}lM(t){0!==t.length&&(this.cM?this.cM=je(this.cM,Xe(t)):this.cM=Xe(t),this.P.emit("dataAdd",this,t,this.cM),this.Jl=he(this.Jl,t,{canReturnB:!1}),this.As.Ss())}pM(){return hu(this.nM)}mM(t){return this.P.on("dataAdd",t)}yM(t){return this.P.off(t)}SM(t){return this.P.on("dataClear",t)}xM(t){return this.P.off(t)}}const cu=(t,e,i,s)=>{let r,n,o=Number.MAX_VALUE;for(let h=0;h{const e=this.vM.indexOf(t);e>=0&&this.vM.splice(e,1);const i=this.bM.findIndex((e=>e===t.Aa));i>=0&&this.bM.splice(i,1),this.As.Ss()},this.Se=ye(this.Ji.polarPolygonSeriesFillStyle,n),this.xe=ye(this.Ji.polarPolygonSeriesStrokeStyle,n)}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}addPolygon(){const t=new Wl(this.Ki,this.MM,this,this._M());return this.vM.push(t),t}setFillStyle(t){this.Se="function"==typeof t?t(this.Se):t;const e=this.Se;for(const t of this.bM)t.Me(e);return this.As.Ss(),this}getFillStyle(){return this.Se}setStrokeStyle(t){this.xe="function"==typeof t?t(this.xe):t;const e=this.xe;for(const t of this.bM)t.ve(e);return this.As.Ss(),this}getStrokeStyle(){return this.xe}Xm(){return this.Km&&void 0!==this.vM.find((t=>void 0!==t.AM))&&this.getVisible()}Ae(){this.vM.forEach((t=>{(t.dv||this.scale.av())&&t.wM&&(t.Aa.tl(Dl(t.wM,this.scale)),t.dv=!1,t.Aa.Ts())}))}ey(){super.ey();const t=y(Pe,ke);this.vM.forEach((e=>{if(!e.gv)return;const i=!e.dv&&e.wM?e.wM:Ol(e.gv);e.wM=i;const s=!e.dv&&e.AM?e.AM:zl(i);e.AM=s,t.min=Math.min(t.min,s.min),t.max=Math.max(t.max,s.max)})),this.Kb=t}ke(t,e){t.us(e),this.As.Ss()}zx(t,e){const i=cu(t,this.bM,((t,e)=>{const i=t.zx(e);if(i)return at(i,this.scale,t.ls.ct)}),Ne);if(!i)return;const s=at(i[0],i[1].ls.ct,this.scale),r=this.kM(i[1]);if(!r)return;const{angle:n,amplitude:o}=Rl(s,this.scale);return{location:s,scale:this.scale,resultTableContent:this.$x(new Ja,this,n,o,this.Ki.getAmplitudeAxis().formatValue).vc(),series:this,fillStyle:this.Se,polarPolygon:r}}solveNearestFromScreen(t){return this.zx(Yo(t,this.Ki.ls),!1)}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se,stroke:this.xe}),this}_M(){const t=this.As.Cc(this.scale,sn.Simple).Me(this.Se).ve(this.xe).us(this.getHighlight());return this.bM.push(t),this.cs(t),t}kM(t){return this.vM.find((e=>e.Aa===t))}}class fu extends _l{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,o),this.bs="Area Series",this.sv=[],this.ev=!1,this.hv=!1,this.CM=!1,this.$x=Ll,this.Se=ye(this.Ji.polarAreaSeriesFillStyle,n),this.xe=ye(this.Ji.polarAreaSeriesStrokeStyle,n)}setCursorResultTableFormatter(t){return this.$x=t,this.Ki.ls.Ss(),this}getCursorResultTableFormatter(){return this.$x}setData(t){const e=(t=>{const e=[];let i,s,r=!1;for(let n=0;n0&&this.getVisible()}attach(t,e=!0){return super.attach(t,e),ce(t,this.Ji,{fill:this.Se,stroke:this.xe}),this}}class gu extends fu{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.TM=this.As.Cc(this.scale,sn.Simple).us(this.getHighlight()),this.cs(this.TM)}Ae(){if(this.ev||this.scale.av()){const t=this.sv,e=!0===this.hv?Dl(t.concat((t=>{if(0===t.length)return t;const e=t[0],i=t[t.length-1];if(It(e.angle,i.angle))return t;const s=1*Math.sign(i.angle-e.angle);let r=0;const n=[];for(let t=i.angle+s;!It(t%360,e.angle%360);t+=s)if(n.push({angle:t,amplitude:0}),r+=1,r>360)return[];for(let t=0;t=this.FM.start}Wb(t){this.IM=t,this.LM=!0}Ub(){return!1===this.IM}Hb(t){this.PM=t,this.LM=!0}Vb(){return this.PM}Qt(){return this.si}ni(){return!1}nt(t,e,i,s){return this.x=new ki(t.x,e.x,i.x,s?s.x:void 0),this.y=new ki(t.y,e.y,i.y,s?s.y:void 0),this}ti(){return this.Xt}av(){return this.OM}zM(){return this.LM}Ai(){return this.RM}Y(){return this.o=!1,this.si=!1,this.OM=!1,this.LM=!1,this}X(){return this.o=!0,this.si=!0,this.OM=!0,this.LM=!0,this}q(t,e){return"object"==typeof t?(this.j.x=t.x,this.j.y=t.y):(this.j.x=t,this.j.y=e),this.EM(),this}Si(t){return this.DM=t,this.EM(),this}xi(t){return this.BM=t,this.EM(),this}Wt(){return u(this.DM[0]+this.DM[1],this.BM[0]+this.BM[1])}Ht(){return this.j}EM(){const t=this.FM,e=u(this.x.Ut(this.j.x),this.y.Ut(this.j.y)),i=this.DM[0]+this.DM[1],s=this.BM[0]+this.BM[1],r=Math.max(e.x-i,0),n=Math.max(e.y-s,0),o=.5*(r>n?n:r),h=[this.DM[0]+Math.max((r-2*o)/2,0),this.DM[1]+Math.max((r-2*o)/2,0)],a=[this.BM[0]+Math.max((n-2*o)/2,0),this.BM[1]+Math.max((n-2*o)/2,0)],l=Math.abs(t.end-t.start);this.x.q(this.j.x).zt(h).Z(-l,l),this.y.q(this.j.y).zt(a).Z(-l,l),this.RM={x:this.x.getPixelSize(),y:this.y.getPixelSize()},this.Xt={x:this.x.ti(),y:this.y.ti()},this.X()}Jt(t,e){const i=this.Ai();return{x:t.x+e.x*i.x,y:t.y+e.y*i.y}}wi(t,e,i,s){const r=this.Ai(),n=ei(t,e);return n.x*=s,n.y*=s,{x:t.x+i*r.x*n.x,y:t.y+i*r.y*n.y}}}class pu extends Sl{constructor(t,i,s,r,n,o,h){super(t,i,s,i.hp("polarChart bg",0),r,i.ls.Ji.polarChartBackgroundFillStyle,i.ls.Ji.polarChartBackgroundStrokeStyle,i.ls.Ji.polarChartTitleFont,i.ls.Ji.polarChartTitleFillStyle,h),this.coordsClient="client",this.Ix=e.AutoCursorModes.snapToClosest,this.tf=[],this.po=!0,this.VM=(t,e,i,s,r)=>{this.vb.q(s,r)},this.ef=ee(this.tf),this.NM=t=>{this.tf.push(t)},this.GM=()=>this.My,this.ff.wn||this.ff.An||this.ls.Mn(4),this.WM=i.OS("polarChart series bg",0),this.HM=i.Hp("polarChart axis gridlines",0),this.UM=i.Hp("polarChart series",1),this.$M=i.Hp("polarChart axis lines",2),this.jM=i.Hp("polarChart axis ticks",3),this.vb=s.d2({scaleXYConstructor:yu}),this.onResize(this.VM),this.ap.Ch("Polar Chart");const a=Lt(o?o.autoCursorBuilder:void 0,hl);this.Ex=a.Tx(this.Dx,this.uiScale,this.uiScale,this.Ji),this.Fy=this.WM.Dc(this.vb).Me(this.Ji.polarChartSeriesBackgroundFillStyle).ve(st).Nl(0).Be(360).Ul(0),this.Iy=this.WM.Dc(this.vb).Me(z).ve(this.Ji.polarChartSeriesBackgroundStrokeStyle).Nl(0).Be(360).Ul(0),super.Ty(this.Fy,this.Iy),this.ep(n,this.pixelScale),this.YM=new wl(this,this.vb,this.Ji,!(!o||!0!==o.disableAnimations),this.HM,this.$M,this.jM,this.ss,this.GM),this.XM=new El(this,this.vb,this.Ji,!(!o||!0!==o.disableAnimations),this.HM,this.$M,this.jM,this.ss),this.coordsAxis={axisAmplitude:this.YM,axisRadial:this.XM},o&&!0===o.disableAnimations&&this.setAnimationsEnabled(!1)}getSeries(){return this.My}translateCoordinate(t,e,i){if(i){const e=t,s=this.pixelScale,r=i;if(zi(r)){const t=at(e,s,this.engine.scale);return this.ls.fo({engineX:t.x,engineY:t.y})}if(Ri(r))return e;if(Pl(r)){const t=at(e,s,this.vb);return Rl(t,this.vb)}}else{const i=t,s=e;if(Oi(i)){if(Pl(s)){const t=this.ls.do(i),e=at({x:t.engineX,y:t.engineY},this.engine.scale,this.vb);return Rl(e,this.vb)}if(zi(s))return i;if(Ri(s)){const t=this.ls.do(i);return at({x:t.engineX,y:t.engineY},this.ls.ct,this.pixelScale)}}else if(kl(i)){if(Pl(s))return i;const t=Dl([i],this.vb)[0];if(zi(s)){const e=at(t,this.vb,this.engine.scale),i={engineX:e.x,engineY:e.y};return this.ls.fo(i)}if(Ri(s))return at(t,this.vb,this.pixelScale)}}throw new Error("translateCoordinate unexpected error. Input or target coordinate system not recognized.")}addLineSeries(t){const e=new Gl(this.UM,this,this.Ay,this.vb,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addPointSeries(t){const e=new Ul(this.UM,this,this.Ay,this.vb,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addPointLineSeries(t){const e=new Hl(this.UM,this,this.Ay,this.vb,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addAreaSeries(t){const e=new gu(this.UM,this,this.Ay,this.vb,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addPolygonSeries(t){const e=new du(this.UM,this,this.Ay,this.vb,this.Ji,void 0!==(null==t?void 0:t.automaticColorIndex)?t.automaticColorIndex:this.My.length,this.ls.ss);return this.Py(e),e}addHeatmapSeries(t){const e=new Vl(this.UM,this,this.Ay,this.vb,this.Ji,this.ls.ss,t);return this.Py(e),e}addSector(){const t=new Fl(this.UM,this,this.ef,this.vb,this.Ji,this.ls.ss);return this.NM(t),t}getAmplitudeAxis(){return this.YM}getRadialAxis(){return this.XM}Ae(t){var e,i;super.Ae(t),Nh.fp(this.ap,this.rp);for(const t of this.My)t.ey();this.YM.cr(),this.XM.cr();for(const t of this.My)t.Ae();for(let t=1;t<=2;t+=1){const e=this.YM.Ae(),i=this.XM.Ae(),s=Nh.dp(this.ap,this.rp),r=[this.Qo.left+i,this.Qo.right+i],n=[this.Qo.bottom+i,this.Qo.top+i+s];this.vb.Si(r).xi(n);const o=4;if(!(!this.ZM||Math.abs(this.ZM.amplitude-e)>=o||Math.abs(this.ZM.radial-i)>=o)||1!==t){this.ZM={amplitude:e,radial:i};break}}const s=this.vb.Ob().start,r=this.vb.Ob().end,n=this.vb.Bb()?((null===(e=this.ZM)||void 0===e?void 0:e.radial)||0)*this.vb.x.getPixelSize()+r-s:((null===(i=this.ZM)||void 0===i?void 0:i.radial)||0)*this.vb.x.getPixelSize()+s-r;this.Fy.Gl(n).$l(360),this.Iy.Gl(n).$l(360);for(const t of this.tf)t.Ae();this.Vx(!1);for(const t of this.My)t.om();return super.sp(),this.KM(),this}setAnimationsEnabled(t){return super.setAnimationsEnabled(t),this.YM.setAnimationsEnabled(t),this.XM.setAnimationsEnabled(t),this}setMouseInteractions(t){return this.po=t,this}getMouseInteractions(){return this.po}getMinimumSize(){return u(mu,mu)}KM(){}forEachAxis(t){return t(this.YM),t(this.XM),this}dispose(){return this.WM.G(),this.HM.G(),this.UM.G(),this.$M.G(),this.jM.G(),this.tf.slice().forEach((t=>t.dispose())),super.dispose()}Sd(){return[...this.My,...this.tf]}}const mu=300;class Su extends Wh{}class xu extends Su{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.bs="Slice",this.u=0,this.gp=!1,this.qM=z,this.mp=z,this.yp=this.u,this.bp=j((()=>this.Ki.ls.Ss())),this.Mp=()=>{this._p=void 0},this.index=t,this.Ki=s,this.scale=r,this.qi=n,this.TM=e.Cc(r,sn.Simple).us(this.getHighlight()),this.cs(this.TM),this.Ve=i.Sr(r).us(this.getHighlight()),this.cs(this.Ve,{isText:!0})}setValue(t){return this.Ki.getAnimationsEnabled()?this.getVisible()&&this.Cp(this.yp,t):this.yp=t,this.u=t,this.Ki.ls.Ss(),this}getValue(){return this.u}setVisible(t){return!1===t?this.Ki.getAnimationsEnabled()&&this.yp>0?(this._p&&(this._p.finish(!1),this._p=void 0),this.Cp(this.yp,0,(()=>super.setVisible(!1)))):(this.yp=0,super.setVisible(!1)):this.Ki.getAnimationsEnabled()?(this._p&&(this._p.finish(!1),this._p=void 0),super.setVisible(!0),this.Cp(this.yp,this.u)):(this.yp=this.u,super.setVisible(!0)),this}Cp(t,e,i){this._p=this.bp(300,X.ease)([[t,e]],(([t])=>{this.yp=t,this.Ki.ls.Ss()})),this._p.onEveryAnimationEnd(this.Mp),i&&this._p.onAnimationEnd(i)}setStyle(t,e,i,s){this.qM=t,this.mp=i,this.TM.Me(this.qM).ve(e),this.Ve.Me(this.mp).Ih(s);for(let t=0;t{let i=100;return t<=0?t=0:(i=t>=100?100:t,t=e*(i/100)),t},Mu=(t,i,s,r,n,o=0,h=e.FunnelSliceModes.VariableHeight,a)=>{i=vu(i,r.x),s=vu(s,r.x);const l=t.length;let u=0,c=0;u=t.reduce(((t,e)=>t+e.getAnimatedValue()),0);let d={x:a-i/2,y:r.y+n.bottom},f={x:a+i/2,y:r.y+n.bottom},g={x:0,y:n.bottom},y={x:0,y:n.bottom},p=0,m=0;if(o)for(let i=0;i0&&(d={x:g.x+S*o,y:g.y-o},f={x:y.x-S*o,y:y.y-o}),b=(i+c/u*(s-i))/2,g={x:a-b,y:parseInt(`${h===e.FunnelSliceModes.VariableWidth?d.y-x:x}`,10)},y={x:a+b,y:parseInt(`${h===e.FunnelSliceModes.VariableWidth?f.y-x:x}`,10)},f.x>=d.x&&y.x>g.x&&m.TM.tl([g,d,f,y])}};class Au extends Vh{constructor(t,i,s,r,n,o,h){super(t,i,s,i.hp("funnelChart bg",0),r,i.ls.Ji.funnelChartBackgroundFillStyle,i.ls.Ji.funnelChartBackgroundStrokeStyle,i.ls.Ji.funnelChartTitleFont,i.ls.Ji.funnelChartTitleFillStyle,o),this.Tp=[],this.Fp=Hh.None,this.Dp=!0,this.Lp=0,this.JM=80,this.QM=20,this.t_=0,this.i_=e.FunnelSliceModes.VariableHeight,this.zp=!0,this.Np=t=>{const e=this.Tp.indexOf(t);e>=0&&(this.Tp.splice(e,1),this.Gp())},this.ff.wn||this.ff.An||this.ls.Mn(5),this.Vp=this.Ji.effectsText,this.Wp=i.Hp("funnelChart bottom",0),this.$p=i.Hp("funnelChart top",1),this.ap.Ch("Funnel Chart"),this.Ip=this.Ji.funnelChartSliceFillStylePalette,this.Pp=this.Ji.funnelChartSliceStrokeStyle,this.Bp=this.Ji.funnelChartSliceLabelFont,this.Op=this.Ji.funnelChartSliceLabelFillStyle,h&&this.setAnimationsEnabled(!1),this.ep(n,this.pixelScale)}addSlice(t,e){const i=new xu(this.Lp,this.Wp,this.$p,this,this.pixelScale,this.Np,this.Ji,this.ls.ss);return this.Lp+=1,i.setName(t),i.setValue(e),i.ss.hs.ys(this.Vp),i.ss.rs.ys(this.zp),this.Tp.push(i),this.ls.Ss(),i.setHighlightOnHover(this.Dp),i}addSlices(t){const e=[];for(let i=0;ie.ss.rs.ys(t))),this.ls.Ss(),this}getSliceEffect(){return this.zp}setSliceSorter(t){return this.Fp=t,this.Tp=this.Tp.sort(this.Fp),this.ls.Ss(),this}getSliceSorter(){return this.Fp}setLabelFillStyle(t){return this.Op="function"==typeof t?t(this.Op):t,this.ls.Ss(),this}getLabelFillStyle(){return this.Op}setLabelFont(t){return this.Bp="function"==typeof t?t(this.Bp):t,this.ls.Ss(),this}getLabelFont(){return this.Bp}setLabelEffect(t){return this.Vp=t,this.Tp.forEach((e=>e.ss.hs.ys(t))),this.ls.Ss(),this}getLabelEffect(){return this.Vp}setLabelFormatter(t){return this.Yp=t,this.ls.Ss(),this}getLabelFormatter(){return this.Yp}setSliceHighlightOnHover(t){return this.Dp=t,this.Tp.forEach((e=>e.setHighlightOnHover(t))),this}Ae(t){super.Ae(t),Nh.fp(this.ap,this.rp),super.sp();const e=Nh.dp(this.ap,this.rp),i=u(this.pixelScale.x.getInnerInterval()-(this.Qo.left+this.Qo.right),this.pixelScale.y.getInnerInterval()-(this.Qo.bottom+this.Qo.top+e)),s=u(this.Qo.left+i.x/2,this.Qo.bottom+i.y/2);this.Tp=this.Tp.sort(this.Fp);for(let t=0,{length:e}=this.Tp;tt.getAnimatedValue()>0));let n=0;for(let t=0;t0?h/n:0);var h;for(let t=0;tt.dispose())),super.dispose()}}const wu=(t,i,s)=>{const r=t.il();if(r.length>0){let t;const n=(r[1].y-r[0].y)/2+r[0].y;return t=i===e.FunnelLabelSide.Left?(r[0].x-r[1].x)/2+r[1].x-s:(r[2].x-(4===r.length?r[3].x:r[1].x))/2+(4===r.length?r[3].x:r[1].x)+s,{x:t,y:n}}},Tu=t=>{const e=t.il();if(e.length>0)return{x:(e[2].x-e[1].x)/2+e[1].x,y:(e[1].y-e[0].y)/2+e[0].y}};class Eu extends Au{constructor(){super(...arguments),this.Yp=Uh.NamePlusValue,this.Zp=10,this.s_=e.FunnelLabelSide.Left,this.e_=e.SliceLabelIndices.LabelsOnSides,this.qp=[],this.Jp=this.Ji.funnelChartConnectorStrokeStyle}setLabelConnectorStyle(t){this.Jp=t;for(let t=0;t{const e=this.Tp.indexOf(t);e>=0&&this.Tp.splice(e,1)},this.ff.wn||this.ff.An||this.ls.Mn(6),this.As=e.Hp("gaugeChart layer",0),this.$p=e.Hp("gaugeChart top layer",1),this.ap.Ch("Gauge Chart"),this.ep(r,this.pixelScale);const h=Wi();this.onBackgroundTouchStart(h.onTouchStart),this.onBackgroundTouchMove(h.onTouchMove),this.onBackgroundTouchEnd(h.onTouchEnd),o&&this.setAnimationsEnabled(!1)}dispose(){return this.As.G(),this.$p.G(),this.Tp.slice().forEach((t=>t.dispose())),super.dispose()}}class Bu extends Fu{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.Il=90,this.Pl=-270,this.n_={min:this.Il,max:this.Pl},this.o_=j((()=>this.As.Ss())),this.a_=()=>{this.l_=void 0},this.u_=e.Hp("radialGaugeChart bg arc",2),this.c_=this.As.Dc(this.pixelScale).Me(this.Ji.gaugeChartEmptyGaugeFillStyle).ve(this.Ji.gaugeChartEmptyGaugeStrokeStyle)}setAngleInterval(t,e){t===e?e-=360:Math.abs(e-t)>360&&(e-=(e-t)%360);const i=this.Il,s=this.Pl,r=this.n_;return this.getAnimationsEnabled()?this.d_(r,{min:t,max:e}):(r.min=t,r.max=e,this.Il=t,this.Pl=e),this.P.emit("angleIntervalChange",this,{min:i,max:s},{min:t,max:e}),this.ls.Ss(),this}getAngleInterval(){return{min:this.Il,max:this.Pl}}setGaugeFillStyle(t){return this.c_.Me(t),this.ls.Ss(),this}setGaugeStrokeStyle(t){return this.c_.ve(t),this.ls.Ss(),this}d_(t,e,i){this.l_=this.o_(1e3,X.ease)([[t.min,e.min],[t.max,e.max]],(([t,e])=>{this.n_={min:t,max:e},this.Il=t,this.Pl=e,this.As.Ss()})),this.l_.onEveryAnimationEnd(this.a_),i&&this.l_.onAnimationEnd(i)}onAngleIntervalChange(t){return this.P.on("angleIntervalChange",t)}offAngleIntervalChange(t){return this.P.off(t,"angleIntervalChange")}dispose(){return super.dispose(),this.u_.G(),this}}class _u extends Wh{f_(t){return this.P.on("valueChange",t)}g_(t){return this.P.on("valueIntervalChange",t)}offValueChange(t){return this.P.off(t,"valueChange")}offIntervalChange(t){return this.P.off(t,"valueIntervalChange")}attach(t,e=!0){return super.attach(t,e),this.styleAttachedEntry(t),this}styleAttachedEntry(t){ce(t,this.Ji,{fill:this.p_})}}class Lu extends _u{onValueChange(t){return this.f_(t)}onIntervalChange(t){return this.g_(t)}}class Du extends Lu{constructor(t,e,i,s,r,n,o){super(i,r,n,o),this.Il=0,this.Pl=0,this.m_=0,this.y_=0,this.S_=0,this.x_=100,this.b_=!0,this.yp=this.u,this.xp=this.getVisible(),this.bp=Ae(),this.v_=t=>{this.yp=t,this.Ki.ls.Ss()},this.M_=t,this.br=e,this.Ki=i,this.scale=s,this.p_=this.Ji.gaugeChartGaugeFillStyle,this.kp=t.Dc(s).Me(this.p_).ve(st).us(this.getHighlight()),this.cs(this.kp),this.__=e.Sr(s).us(this.getHighlight()),this.cs(this.__,{isText:!0}),this.A_=e.Sr(s).us(this.getHighlight()),this.cs(this.A_,{isText:!0}),this.Ve=e.Sr(s).us(this.getHighlight()),this.cs(this.Ve,{isText:!0}),this.__.Me(n.gaugeChartIntervalLabelsFillStyle).Ih(n.gaugeChartIntervalLabelsFont),this.A_.Me(n.gaugeChartIntervalLabelsFillStyle).Ih(n.gaugeChartIntervalLabelsFont),this.Ve.Me(n.gaugeChartValueLabelFillStyle).Ih(n.gaugeChartValueLabelFont),this.setName("Gauge Slice")}Ae(){const t=this.Ki.getDataLabelFormatter(),e=this.Il/90r&&(i=r);const n=this.Pl-e*this.y_,o=this.Il+e*this.m_,h=this.x_-this.S_,a=(0!==h?(n-o)/h:1/0)*(i-this.S_);this.kp.Nl(o).Be(o+a);const l="function"==typeof t?t(i,{getInnerStart:()=>s,getInnerEnd:()=>r}):t.format(i);this.Ve.Ch(l)}w_(){const t=this.Ki.getIntervalLabelFormatter(),e="function"==typeof t?t(this.S_,{getInnerStart:()=>this.S_,getInnerEnd:()=>this.x_}):t.format(this.S_);return this.__.Ch(e).Ts(),this.__.Ht()}k_(){const t=this.Ki.getIntervalLabelFormatter(),e="function"==typeof t?t(this.x_,{getInnerStart:()=>this.S_,getInnerEnd:()=>this.x_}):t.format(this.x_);return this.A_.Ch(e).Ts(),this.A_.Ht()}setName(t){return super.setName(t),this.Ki.ls.Ss(),this}setValue(t){const e=this.u;return this.Ki.getAnimationsEnabled()?this.xp&&this.bp(e,t,this.v_):this.yp=t,this.u=t,this.P.emit("valueChange",this,e,t),this.Ki.ls.Ss(),this}getValue(){return this.u}setVisible(t){return this.xp=t,!1===t?this.Ki.getAnimationsEnabled()&&this.yp>0?this.bp(this.yp,0,this.v_,{onCompleted:()=>super.setVisible(!1)}):(this.yp=0,super.setVisible(!1)):this.Ki.getAnimationsEnabled()?(super.setVisible(!0),this.bp(this.yp,this.u,this.v_)):(this.yp=this.u,super.setVisible(!0)),this}setInterval(t,e){const i=this.S_,s=this.x_;return this.P.emit("valueIntervalChange",this,{min:i,max:s},{min:t,max:e}),this.S_=t,this.x_=e,this.Ki.ls.Ss(),this}setIntervalLabelsFont(t){return this.__.Ih(t),this.A_.Ih(t),this.Ki.ls.Ss(),this}getIntervalLabelsFont(){return this.__.Fh()}setIntervalLabelsFillStyle(t){return this.__.Me(t),this.A_.Me(t),this.Ki.ls.Ss(),this}getIntervalLabelsFillStyle(){return this.__.Th()}setIntervalLabelsVisible(t){return t?(this.__.setVisible(!0),this.A_.setVisible(!0)):(this.__.setVisible(!1),this.A_.setVisible(!1)),this.b_=t,this}getIntervalLabelsVisible(){return this.b_}setAngleInterval(t,e){return this.Il=t,this.Pl=e,this.Ki.ls.Ss(),this}setMinAngle(t){return this.Il=t,this.Ki.ls.Ss(),this}setMaxAngle(t){return this.Pl=t,this.Ki.ls.Ss(),this}setMarginInDegrees(t=this.m_,e=this.y_){return t!==this.m_&&(this.m_=t),e!==this.y_&&(this.y_=e),this.Ki.ls.Ss(),this}setFillStyle(t){this.p_="function"==typeof t?t(this.p_):t;const e=this.p_;this.kp.Me(e);for(let t=0;tr?25*s:25*r))){const o=Array(n+2),h=Math.PI;let a=0,l=0;const c=e*h/180,d=(i*h/180-c)/n;for(o[a]=u(t.x,t.y),a+=1;a<=n+1;)o[a]=u(t.x+s*Math.cos(c+l*d),t.y+r*Math.sin(c+l*d)),a+=1,l+=1;return[o,n]}class Ou extends Bu{constructor(t,e,i,s,r,n,o){super(t,e,i,s,r,n,o),this.nd=20,this.F_=new Intl.NumberFormat,this.I_=new Intl.NumberFormat,this.P_=!1,this.D_=5;const h=new Du(this.As,this.$p,this,this.pixelScale,this.Np,this.Ji,this.ls.ss);this.B_=h,this.Tp.push(h),this.setPadding(10)}Ae(t){super.Ae(t),Nh.fp(this.ap,this.rp),super.sp();const e=Nh.dp(this.ap,this.rp),i=Xe([this.B_.w_(),this.B_.k_()]),s=u(this.pixelScale.x.getInnerInterval()-(this.Qo.left+this.Qo.right+2*i.max.x),this.pixelScale.y.getInnerInterval()-(this.Qo.bottom+this.Qo.top+1*i.max.y+e)),r=Math.max(.5*Math.min(s.x,s.y),0),n=u(this.Qo.left+i.max.x+.5*s.x,this.Qo.bottom+i.max.y+.5*s.y),o=this.P_?this.O_(n,r):n,h=this.c_.xe.getThickness(),a=r-.5*h,l=r-this.nd;let c=l/r*100;c=c>100||c<0?99:c;const d=100*(1-(this.nd-h)/r);this.L_(o,l)&&(this.c_.Gl(r).Ul(c),this.B_.kp.Gl(a).Ul(d));const f=.5*(g=r,(y=this.Pl-this.Il)/(2*Math.PI*g*(y/360))*h);var g,y;this.c_.Nl(this.Il).Be(this.Pl).we(o),this.B_.kp.we(o),this.B_.Ve.we(o),this.ad&&this.B_.setFillStyle(new V({color:this.ad.getColors(this.B_.getAnimatedValue())})),this.B_.setMinAngle(this.Il).setMaxAngle(this.Pl).setMarginInDegrees(f,f).Ae();const p=this.c_.Dl();if(this.B_.getIntervalLabelsVisible()){this.R_(this.Il,this.Pl,o,p+this.D_);const t=this.B_.__.Ts().ze(),e=this.B_.A_.Ts().ze();De(t,e)&&this.E_(t,e,o,p+this.D_)}}L_(t,e){const i=si(this.B_.Ve.Ts().Ht(),.5),s=t.x+e,r=t.x-e,n=t.y+e,o=t.y-e;return!(t.x+i.x>s||t.x-i.xn||t.y-i.y=0?i=-s:s=-i),[i,s]}O_(t,e){const[i]=zu(t,this.Il,this.Pl,e,e),s=Xe(i),r=.5*(s.max.x-s.min.x),n=.5*(s.max.y-s.min.y);return ri(ni(t,u(s.min.x+r,s.min.y+n)),t)}R_(t,e,i,s){const r=di(t),n=di(e);this.B_.__.we(Ke(u(i.x+s,i.y),i,-r)),this.B_.A_.we(Ke(u(i.x+s,i.y),i,-n)),this.B_.__.Sa(u(-Math.cos(r),-Math.sin(r))),this.B_.A_.Sa(u(-Math.cos(n),-Math.sin(n)))}getDefaultSlice(){return this.B_}setAutoScaling(t){return this.P_=t,this.ls.Ss(),this}getAutoScaling(){return this.P_}setDataLabelFormatter(t){return this.I_=t,this.ls.Ss(),this}getDataLabelFormatter(){return this.I_}setIntervalLabelFormatter(t){return this.F_=t,this.ls.Ss(),this}getIntervalLabelFormatter(){return this.F_}setIntervalLabelPadding(t){return this.D_=t,this.ls.Ss(),this}getIntervalLabelPadding(){return this.D_}setThickness(t){return this.nd=t,this}setLUT(t){return this.ad=t,this.ls.Ss(),this}setDataLabelFont(t){return this.B_.Ve.Ih(t),this.ls.Ss(),this}getDataLabelFont(){return this.B_.Ve.Fh()}getMinimumSize(){return u(500,300)}setDataLabelFillStyle(t){return this.B_.C_(t),this.ls.Ss(),this}getDataLabelFillStyle(){return this.B_.T_()}Sd(){return this.Tp}dispose(){return this.B_.dispose(),super.dispose()}}class Ru extends Wh{}class Vu extends Ru{constructor(t,e,i,s,r,n,o,h){super(s,n,o,h),this.bs="Slice",this.u=0,this.gp=!1,this.qM=z,this.mp=z,this.yp=this.u,this.bp=j((()=>this.Ki.ls.Ss())),this.Mp=()=>{this._p=void 0},this.index=t,this.Ki=s,this.scale=r,this.qi=n,this.TM=e.Cc(r,sn.Simple).us(this.getHighlight()),this.cs(this.TM),this.Ve=i.Sr(r).us(this.getHighlight()),this.cs(this.Ve,{isText:!0})}setValue(t){return this.Ki.getAnimationsEnabled()?this.getVisible()&&this.Cp(this.yp,t):this.yp=t,this.u=t,this.Ki.ls.Ss(),this}getValue(){return this.u}setVisible(t){return!1===t?this.Ki.getAnimationsEnabled()&&this.yp>0?(this._p&&(this._p.finish(!1),this._p=void 0),this.Cp(this.yp,0,(()=>super.setVisible(!1)))):(this.yp=0,super.setVisible(!1)):this.Ki.getAnimationsEnabled()?(this._p&&(this._p.finish(!1),this._p=void 0),super.setVisible(!0),this.Cp(this.yp,this.u)):(this.yp=this.u,super.setVisible(!0)),this}Cp(t,e,i){this._p=this.bp(300,X.ease)([[t,e]],(([t])=>{this.yp=t,this.Ki.ls.Ss()})),this._p.onEveryAnimationEnd(this.Mp),i&&this._p.onAnimationEnd(i)}setStyle(t,e,i,s){this.qM=t,this.mp=i,this.TM.Me(this.qM).ve(e),this.Ve.Me(this.mp).Ih(s);for(let t=0;t{let i=100;return t<=0?t=0:(i=t>=100?100:t,t=e*(i/100)),t},Gu=(t,i,s,r,n,o=0,h=e.PyramidSliceModes.VariableHeight,a)=>{i=Nu(i,r.x),s=Nu(s,r.x);const l=t.length;let u=0,c=0;u=t.reduce(((t,e)=>t+e.getAnimatedValue()),0);let d={x:a-i/2,y:r.y+n.bottom},f={x:a+i/2,y:r.y+n.bottom},g={x:0,y:n.bottom},y={x:0,y:n.bottom},p=0,m=0;if(o)for(let i=0;i0&&(d={x:g.x+S*o,y:g.y-o},f={x:y.x-S*o,y:y.y-o}),b=(i+c/u*(s-i))/2,g={x:a-b,y:parseInt(`${h===e.PyramidSliceModes.VariableWidth?d.y-x:x}`,10)},y={x:a+b,y:parseInt(`${h===e.PyramidSliceModes.VariableWidth?f.y-x:x}`,10)},f.x>=d.x&&y.x>=g.x&&m.TM.tl([g,d,f,y])}};class Hu extends Vh{constructor(t,i,s,r,n,o,h){super(t,i,s,i.hp("pyramidChart bg",0),r,i.ls.Ji.pyramidChartBackgroundFillStyle,i.ls.Ji.pyramidChartBackgroundStrokeStyle,i.ls.Ji.pyramidChartTitleFont,i.ls.Ji.pyramidChartTitleFillStyle,o),this.Tp=[],this.Fp=Hh.None,this.Ip=this.Ji.pyramidChartSliceFillStylePalette,this.Pp=this.Ji.pyramidChartSliceStrokeStyle,this.Dp=!0,this.Bp=this.Ji.pyramidChartSliceLabelFont,this.Op=this.Ji.pyramidChartSliceLabelFillStyle,this.Lp=0,this.JM=0,this.QM=80,this.t_=0,this.i_=e.PyramidSliceModes.VariableHeight,this.zp=!0,this.Np=t=>{const e=this.Tp.indexOf(t);e>=0&&(this.Tp.splice(e,1),this.Gp())},this.ff.wn||this.ff.An||this.ls.Mn(8),this.Vp=this.Ji.effectsText,this.Wp=i.Hp("pyramidChart bottom",0),this.$p=i.Hp("pyramidChart top",1),this.ap.Ch("Pyramid Chart"),h&&this.setAnimationsEnabled(!1),this.ep(n,this.pixelScale)}addSlice(t,e){const i=new Vu(this.Lp,this.Wp,this.$p,this,this.pixelScale,this.Np,this.Ji,this.ls.ss);return this.Lp+=1,i.setName(t),i.setValue(e),i.ss.hs.ys(this.Vp),i.ss.rs.ys(this.zp),this.Tp.push(i),this.ls.Ss(),i}addSlices(t){const e=[];for(let i=0;ie.ss.rs.ys(t))),this.ls.Ss(),this}getSliceEffect(){return this.zp}setSliceSorter(t){return this.Fp=t,this.Tp=this.Tp.sort(this.Fp),this.ls.Ss(),this}getSliceSorter(){return this.Fp}setLabelFillStyle(t){return this.Op="function"==typeof t?t(this.Op):t,this.ls.Ss(),this}getLabelFillStyle(){return this.Op}setLabelFont(t){return this.Bp="function"==typeof t?t(this.Bp):t,this.ls.Ss(),this}getLabelFont(){return this.Bp}setLabelEffect(t){return this.Vp=t,this.Tp.forEach((e=>e.ss.hs.ys(t))),this.ls.Ss(),this}getLabelEffect(){return this.Vp}setLabelFormatter(t){return this.Yp=t,this.ls.Ss(),this}getLabelFormatter(){return this.Yp}setSliceHighlightOnHover(t){return this.Dp=t,this.Tp.forEach((e=>e.setHighlightOnHover(t))),this}Ae(t){super.Ae(t),Nh.fp(this.ap,this.rp),super.sp();const e=Nh.dp(this.ap,this.rp),i=u(this.pixelScale.x.getInnerInterval()-(this.Qo.left+this.Qo.right),this.pixelScale.y.getInnerInterval()-(this.Qo.bottom+this.Qo.top+e)),s=u(this.Qo.left+i.x/2,this.Qo.bottom+i.y/2);this.Tp=this.Tp.sort(this.Fp);for(let t=0,{length:e}=this.Tp;tt.getAnimatedValue()>0));let n=0;for(let t=0;t0?h/n:0);var h;for(let t=0;tt.dispose())),super.dispose()}}const Uu=(t,i,s)=>{const r=t.il();if(r.length>0){let t;const n=(r[1].y-r[0].y)/2+r[0].y;return t=i===e.PyramidLabelSide.Left?(r[0].x-r[1].x)/2+r[1].x-s:(r[2].x-(4===r.length?r[3].x:r[1].x))/2+(4===r.length?r[3].x:r[1].x)+s,{x:t,y:n}}},Wu=t=>{const e=t.il();if(e.length>0)return{x:(e[2].x-e[1].x)/2+e[1].x,y:(e[1].y-e[0].y)/2+e[0].y}};class Xu extends Hu{constructor(){super(...arguments),this.Yp=Uh.NamePlusValue,this.Zp=10,this.s_=e.PyramidLabelSide.Left,this.e_=e.SliceLabelIndices.LabelsOnSides,this.qp=[],this.Jp=this.Ji.pyramidChartConnectorStrokeStyle}setLabelConnectorStyle(t){this.Jp=t;for(let t=0;t(t.alignmentX=(r+Math.PI/2)%(2*Math.PI)<=Math.PI?-1:1,t.alignmentY=r%(2*Math.PI)<=Math.PI?-1:1,t.paddingX=Math.cos(r)*n,t.paddingY=Math.sin(r)*n,t),qu=(t,e,i,s,r,n,o,h)=>{if(0===e)return t.paddingX=h,t.alignmentX=-1,t};var Zu;e.SpiderWebMode=void 0,(Zu=e.SpiderWebMode||(e.SpiderWebMode={}))[Zu.Normal=0]="Normal",Zu[Zu.Circle=1]="Circle";class Ku{constructor(t,e,i,s,n,o,h,a){this.P=new r.Eventer,this.V_=t,this.br=e,this.scale=i,this.chart=s,this.tag=n,this.axisScale=o,this.N_=h,this.G_=a,this.W_=this.V_.De(this.scale).setMouseInteractions(!1),this.H_=this.br.Sr(this.scale).Ch(this.tag).setMouseInteractions(!1),this.U_=this.N_(this,this.br.tm(this.scale,void 0,[Kh.InternalUI])).Pe(this.chart.getNibStyle()),this.G_.ds([this.H_])}Xp(t,i,s,r,n,o,h){const a=i.length,l=i[s>0?s-1:a-1],c=i[s],d=i[s{const n=s/i,o=[];for(let h=-s/2;h<=s/2;h+=r){const r=n*(h/s)+e,a=u(t.x+Math.cos(r)*i,t.y+Math.sin(r)*i);o.push(a)}return o})(t,r,n,f)),h?this.H_.setVisible(!0).we(ri(c,u(h.paddingX,h.paddingY))).ga(h.alignmentX).ma(h.alignmentY):this.H_.setVisible(!1)}getLabelSize(){return this.H_.Ih(this.chart.getAxisLabelFont()).Me(this.chart.getAxisLabelStyle()).Ts().Ht()}dispose(){this.W_&&this.W_.dispose(),this.H_&&this.H_.dispose(),this.U_&&this.U_.dispose()}}const Qu=(t,e,i,s,r)=>t.addRow(e.getName()).addRow("Axis:","",s).addRow("Value:","",r(i));class tc extends Bl{constructor(t,i,s,r,n,o,h,a,l,u,c,d){super(t,l,u,d),this.bs="Spider Series",this.Jl=new Map,this.Ci=e.HighlightModes.onHover,this.$x=Qu,this.lv=8,this.Ko=0,this.j_=Ae(),this.Y_={},this.X_={},this.xp=this.getVisible(),this.Z_=1,this.K_=((t,e)=>{const i=j((()=>{}));let s,r,n=1;return(o,h,a)=>{if(o===r)return;r=o;const l=(null==a?void 0:a.easing)||X.ease,u=(null==a?void 0:a.durationMs)||1e3;s&&(s.finish(!1),s=void 0),!1===o?h&&n?(s=i(u,l)([[n,0]],(([e])=>{n=e,t(n)})),s.onAnimationEnd((()=>{s=void 0,e(!1)}))):(n=0,e(!1)):h?(e(!0),s=i(u,l)([[n,1]],(([e])=>{n=e,t(n)})),s.onAnimationEnd((()=>{s=void 0}))):(n=1,e(!0))}})((t=>{this.Z_=t,this.As.ls.Ss()}),(t=>{super.setVisible(t)})),this.Ki=t,this.As=i,this.uv=r,this.q_=n,this.LS=o,this.J_=h,this.Q_=a,this.scale=s,this.tA=ye(u.spiderSeriesFillStyle,c),this.iA=ye(u.spiderSeriesStrokeStyle,c),this.sA=ye(u.spiderSeriesPointFillStyle,c)}Xm(){return this.Km&&this.Jl.size>0&&this.getVisible()}addPoints(...t){t=t.filter((t=>void 0!==t.axis));for(let e=0;ee.set(t.axis,t.value))),this.j_(0,1,(t=>{e.forEach(((e,s)=>{const r=(null==i?void 0:i.get(s))||0;this.Jl.set(s,r+t*(e-r)),this.As.ls.Ss()}))}),{easing:this.Y_.easing,durationMs:this.Y_.durationMs,onStart:()=>{i=new Map(this.Jl)}})}else for(let e=0;e