UNPKG

@lightningchart/lcjs

Version:

A high-performance charting library.

2 lines 1.37 MB
/* LightningChart JS v7.1.1 */ "use strict";Object.defineProperty(exports,"o",{value:!0});var t=require("immutable"),i=require("earcut");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function e(t){if(t&&t.o)return t;var i=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var e=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,e.get?e:{enumerable:!0,get:function(){return t[s]}})}})),i.default=t,Object.freeze(i)}var h=e(t),r=s(i);class n{constructor(){this.u=!0}S(){return this.u}}class o extends n{constructor(t,i){super(),this.M=t,this._=t,this.u=i}C(t){return t!==this.M&&(this._=this.M,this.M=t,this.u=!0),this}T(){return this.M}S(){return super.S()}}const a=(t,i)=>({x:t,y:i}),l=(t,i)=>({x:t,y:i}),c=(t,i,s)=>({position:t,high:i,low:s}),u=(t,i,s)=>({x:t,y:i,z:s}),d=t=>{const i=Array(0),s=Array(0);return t.length>0&&t.forEach((t=>{i.push(a(t.position,t.high)),s.push(a(t.position,t.low))})),[i,s]},f=(t,i)=>({min:t,max:i}),A=(t,i,s,e)=>({x:t,y:i,width:s,height:e}),g=(t,i=!0)=>new o(t,i),p=(t=0,i=0,s=0,e=0)=>({left:t,top:i,right:s,bottom:e}),v=p,y=(t,i)=>({left:void 0!==i.left?i.left:t.left,top:void 0!==i.top?i.top:t.top,right:void 0!==i.right?i.right:t.right,bottom:void 0!==i.bottom?i.bottom:t.bottom}),m=t.Record({type:"color",r:1,g:1,b:1,a:1});class x extends m{constructor(t){super(t)}toUint32(){return void 0!==this.F||(this.F=F(this.getR(),this.getG(),this.getB(),this.getA())),this.F}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.I||(this.I=new x({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.I}getLighter(){return this.P||(this.P=new x({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.P}getDarker(){return this.L||(this.L=new x({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.L}toRGBAString(){return`rgba(${(255*this.r).toFixed(0)},${(255*this.g).toFixed(0)},${(255*this.b).toFixed(0)},${this.a})`}}const S=t=>!(!t||"object"!=typeof t||!("type"in t)||"color"!==t.type),b=(t,i,s,e=255)=>new x({r:t/255,g:i/255,b:s/255,a:e/255}),M=t=>{const i=t.startsWith("#")?t.substring(1):t.startsWith("0x")?t.substr(2):t;switch(i.length){case 8:return new x({r:Number(`0x${i.substring(0,2)}`)/255,g:Number(`0x${i.substring(2,4)}`)/255,b:Number(`0x${i.substring(4,6)}`)/255,a:Number(`0x${i.substring(6,8)}`)/255});case 6:return new x({r:Number(`0x${i.substring(0,2)}`)/255,g:Number(`0x${i.substring(2,4)}`)/255,b:Number(`0x${i.substring(4,6)}`)/255});case 4:return new x({r:Number(`0x${i.charAt(0)}${i.charAt(0)}`)/255,g:Number(`0x${i.charAt(1)}${i.charAt(1)}`)/255,b:Number(`0x${i.charAt(2)}${i.charAt(2)}`)/255,a:Number(`0x${i.charAt(3)}${i.charAt(3)}`)/255});case 3:return new x({r:Number(`0x${i.charAt(0)}${i.charAt(0)}`)/255,g:Number(`0x${i.charAt(1)}${i.charAt(1)}`)/255,b:Number(`0x${i.charAt(2)}${i.charAt(2)}`)/255});default:throw new Error(`ColorHEX parsing error | input: ${t}`)}},w=(t,i=1,s=1)=>{let e,h,r;t/=360;const n=Math.floor(6*t),o=6*t-n,a=s*(1-i),l=s*(1-o*i),c=s*(1-(1-o)*i);switch(n%6){case 0:e=s,h=c,r=a;break;case 1:e=l,h=s,r=a;break;case 2:e=a,h=s,r=c;break;case 3:e=a,h=l,r=s;break;case 4:e=c,h=a,r=s;break;default:e=s,h=a,r=l}return new x({r:e,g:h,b:r})},_=t=>b(255&t,255&(t>>=8),255&(t>>=8),255&(t>>=8)),C={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"},k=new x({}),T=b(0,0,0,0),F=(t,i,s,e=255)=>(e<<24|s<<16|i<<8|t)>>>0,I=(t,i)=>t.value-i.value,P=t.Record({type:"lut",steps:[],title:"",units:"",interpolate:!0,color:b(0,0,0,255),length:0,min:0,max:0,subranges:[],isValid:!1,percentageValues:!1}),L=t=>{const{steps:i}=t,s=i.length;i.sort(I);const[e,h]=s>0?[i[0].value,i[s-1].value]:[0,0],r=s>0?s-1:0,n=Array(r);for(let t=0;t<r;t+=1)n[t]={min:i[t],max:i[t+1]};return{min:e,max:h,length:s,steps:i,subranges:n,isValid:s>0&&e!==h}};class B extends P{constructor(t){super(((t,i)=>({steps:t.steps,title:t.title,units:t.units,interpolate:t.interpolate,percentageValues:t.percentageValues,color:t.color,length:i.length,min:i.min,max:i.max,subranges:i.subranges,isValid:i.isValid}))(t,L(t)))}toString(){return`LUT:interpolate=${this.interpolate},steps=${this.steps.length},percentage=${this.percentageValues}`}setSteps(t){return this.merge(L({...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")}setPercentageValues(t){return this.set("percentageValues",t)}getPercentageValues(){return this.get("percentageValues")}getColors(t,i){if(Array.isArray(t)){if(Array.isArray(t[0])){const s=t,e=s.length,h=s[0].length,r=[...Array(e)].map((()=>Array(h)));for(let t=0;t<e;t+=1)for(let e=0;e<h;e+=1)r[t][e]=this.D(s[t][e],i);return r}const s=t,e=s.length,h=Array(e);for(let t=0;t<e;t+=1)h[t]=this.D(s[t],i);return h}return this.D(t,i)}D(t,i){const{steps:s}=this,e=s.length;if(0===e)return this.getFallbackColor();if(1===e)return s[0].color||this.color;if(this.percentageValues,this.percentageValues&&i&&(t=Math.max(Math.min((t-i.min)/(i.max-i.min),1),0)),this.interpolate){for(let i=0;i<e-1;i+=1){const e=s[i],o=s[i+1],a=Math.min(e.value,o.value),l=Math.max(e.value,o.value);if(t>=a&&t<=l){if(a===l)return e.color;const i=(t-e.value)/(o.value-e.value);return h=e.color,r=o.color,n=i,new x({r:h.r+(r.r-h.r)*n,g:h.g+(r.g-h.g)*n,b:h.b+(r.b-h.b)*n,a:h.a+(r.a-h.a)*n})}}return t<s[0].value?s[0].color:s[e-1].color}var h,r,n;for(let i=e-1;i>=0;i-=1)if(t>=s[i].value)return s[i].color;return s[0].color}}const D=t.Record({type:"fillstyle",fillType:"empty"});class E extends D{toString(){return"emptyFill"}}const R=new E,z=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"empty"===t.fillType),O=t.Record({type:"fillstyle",fillType:"solid",color:b(255,255,255)});class V extends O{}class N extends V{constructor(t){super({...t,fillType:"solid"})}toString(){return`solidFill:${this.color.toString()}`}setColor(t){return S(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 G=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"solid"===t.fillType);class U extends V{constructor(t){super({...t,fillType:"individual"})}toString(){return`individualPointFill:${this.color.toString()}`}setFallbackColor(t){return S(t)?this.set("color",t):this.set("color",t(this.get("color")))}getFallbackColor(){return this.get("color")}}const $=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"individual"===t.fillType),Y=t.Record({type:"fillstyle",fillType:"palette",lut:new B({steps:[]}),lookUpProperty:"value"});class H extends Y{constructor(t){super({...t,fillType:"palette"})}toString(){return`palettedFill:lut=${this.lut.toString()},lookUpProperty=${this.lookUpProperty}`}getPalette(){return this.get("lut")}setLookUpProperty(t){return"function"==typeof t?this.set("lookUpProperty",t(this.get("lookUpProperty"))):this.set("lookUpProperty",t)}getLookUpProperty(){return this.get("lookUpProperty")}}const X=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"palette"===t.fillType);var W,j;exports.GradientShape=void 0,(W=exports.GradientShape||(exports.GradientShape={})).circle="circle",W.ellipse="ellipse",exports.GradientExtent=void 0,(j=exports.GradientExtent||(exports.GradientExtent={})).closestSide="closest-side",j.closestCorner="closest-corner",j.farthestSide="farthest-side",j.farthestCorner="farthest-corner";const Z=t.Record({type:"fillstyle",fillType:"radial-gradient",ditheringEnabled:!0,stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],position:a(.5,.5),shape:exports.GradientShape.ellipse,extent:exports.GradientExtent.farthestCorner});class Q extends Z{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.ditheringEnabled},${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")}setDitheringEnabled(t){return this.set("ditheringEnabled",t)}getDitheringEnabled(){return this.get("ditheringEnabled")}}const J=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"radial-gradient"===t.fillType),K=t.Record({type:"fillstyle",fillType:"linear-gradient",stops:[{color:M("#f00"),offset:0},{color:M("#0f0"),offset:1}],angle:0});class q extends K{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 i=t.sort(((t,i)=>t.offset-i.offset));return this.set("stops",i)}getColorStops(){return this.get("stops")}setAngle(t,i){return this.set("angle",i?function(t){return 180*t/Math.PI}(t):t)}getAngle(t){return t?Gs(this.get("angle")):this.get("angle")}}const tt=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"linear-gradient"===t.fillType);class it{constructor(t,i,s,e){this.R=new bt,this.cellIndex=t,this.cellSpan=i,this.cellsAmount=s,this.observedAmount=e,this.x=new st,this.y=new st,this.z=new st;const h={...t},r={...i};if(e){const t=t=>{const i=t.value;this.cellsAmount.x=i.reduce(gs,0),this.cellIndex.x=i.reduce(((t,i,s)=>s>=h.x?t:t+i),0),this.cellSpan.x=i.reduce(((t,i,s)=>s>=h.x&&s<h.x+r.x?t+i:t),0),this.R.O("cellresize",{})};e.x.V("change",t),t({value:e.x.T()});const i=t=>{const i=t.value;this.cellsAmount.y=i.reduce(gs,0),this.cellIndex.y=i.reduce(((t,i,s)=>s>=h.y?t:t+i),0),this.cellSpan.y=i.reduce(((t,i,s)=>s>=h.y&&s<h.y+r.y?t+i:t),0),this.R.O("cellresize",{})};e.y.V("change",i),i({value:e.y.T()}),this.N=()=>{e.x.G("change",t),e.y.G("change",i)}}}U(){return this.N&&(this.N(),this.N=void 0),this}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}removeEventListener(t,i){this.R.removeEventListener(t,i)}}class st extends n{constructor(){super(...arguments),this.$=0,this.Y=10,this.H=1}X(){return this.u=!1,this}W(){return this.u=!0,this}getInnerStart(){return this.$}getInnerEnd(){return this.Y}getInnerInterval(){return Math.abs(this.getInnerEnd()-this.getInnerStart())}j(t,i){return this.$=t,this.Y=i,this.Z(),this}J(t){return this.H=t,this.Z(),this}K(t){return t/this.H}Z(){const t=this.K(this.Y-this.$),i=this.H;void 0!==this.q&&!1!==Jt(t,this.q)||(this.u=!0,this.tt=i,this.q=t)}it(){return this.q}st(){return this.tt}et(){return this.Y<this.$}ht(t,i){return!0}}const et={d1:t=>new t.scale1DConstructor(0,1,1,void 0),d2:t=>(new t.scaleXYConstructor).rt({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0),d3:()=>new it({x:0,y:0},{x:1,y:1},{x:1,y:1},void 0)},ht=(t,i,s)=>i===s?t:s.nt(i.ot(t)),rt=(t,i,s)=>{if(i===s)return t;const e=i instanceof re?i.x:i.x instanceof re?i.x.x:i.x.ct,h=i instanceof re?i.y:i.y instanceof re?i.y.y:i.y.ct,r=s instanceof re?s.x:s.x instanceof re?s.x.x:s.x.ct,n=s instanceof re?s.y:s.y instanceof re?s.y.y:s.y.ct;return{...t,x:ht(t.x,e,r),y:ht(t.y,h,n)}},nt=(...t)=>{if(0===t.length)return{remove:Qt};let i=!1;const s=t.map((s=>{const e=e=>{((s,e,h)=>{i||(i=!0,t.filter((t=>t!==s)).forEach((t=>t.ut(e,h,!1,s.getStopped(),"synchronizedAxis"))),i=!1)})(s,e.start,e.end)};return s.addEventListener("intervalchange",e),e}));let e=!1;const h=t.map((i=>{const s=s=>{((i,s)=>{e||(e=!0,t.filter((t=>t!==i)).forEach((t=>t.setStopped(s))),e=!1)})(i,s.isStopped)};return i.addEventListener("stoppedchange",s),s}));return{remove:()=>{t.forEach(((t,i)=>{t.removeEventListener("intervalchange",s[i]),t.removeEventListener("stoppedchange",h[i])}))}}},ot=t=>t&&"object"==typeof t&&"column"in t&&"row"in t,at=t=>t&&"object"==typeof t&&"z"in t&&"column"in t&&"row"in t,lt=t=>t&&"object"==typeof t&&"annulus"in t&&"sector"in t,ct=t=>t&&"object"==typeof t&&"index"in t;var ut;!function(t){t[t.Nearest=0]="Nearest",t[t.NearestX=1]="NearestX",t[t.NearestY=2]="NearestY"}(ut||(ut={}));const dt=(t,i,s,e,h,r,n,o,a,l)=>{const c=t.length;if(0===c)return;const u=e?1:0,d=c-(h?2:1);if(s===ut.Nearest)return ft(t,i,r,n,u,d);if(s===ut.NearestX||s===ut.NearestY){if("boolean"==typeof l&&("x"===a&&s===ut.NearestX||"y"===a&&s===ut.NearestY))return pt(t,rt(i,n,r),a,l,u,d);if(s===ut.NearestX)return At(t,rt(i,n,r),o,u,d);if(s===ut.NearestY)return gt(t,rt(i,n,r),o,u,d)}},ft=(t,i,s,e,h,r)=>{let n,o=Number.MAX_VALUE;for(let a=h;a<=r;a+=1){const h=t[a];if(!Number.isNaN(h.x)&&!Number.isNaN(h.y)){const t=rt(h,s,e),r=(t.x-i.x)**2+(t.y-i.y)**2;r<o&&(o=r,n=a)}}return n},At=(t,i,s,e,h)=>{if(i.x<s.min.x||i.x>s.max.x)return;let r,n=Number.MAX_VALUE;for(let s=e;s<=h;s+=1){const e=t[s],h=e.x>i.x?e.x-i.x:i.x-e.x;h<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=h,r=s)}return r},gt=(t,i,s,e,h)=>{if(i.y<s.min.y||i.y>s.max.y)return;let r,n=Number.MAX_VALUE;for(let s=e;s<=h;s+=1){const e=t[s],h=e.y>i.y?e.y-i.y:i.y-e.y;h<n&&!Number.isNaN(e.x)&&!Number.isNaN(e.y)&&(n=h,r=s)}return r},pt=(t,i,s,e,h,r)=>{const n="x"===s,o=n?i.x:i.y,a=t[h],l=t[r],c=a.x<l.x?a.x:l.x,u=a.y<l.y?a.y:l.y,d=a.x>l.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(n&&(o<c||o>d)||!n&&(o<u||o>f))return;let A=h,g=Math.floor((h+r)/2),p=r,v=-1;for(;;){const i=o-(n?t[g].x:t[g].y);if(i*(e?-1:1)>0)A=Math.min(g+1,p),v=Math.floor((A+p)/2);else{if(0===Math.abs(i))return g;p=Math.max(g-1,A),v=Math.floor((A+p)/2)}if(v===g){const s=g>h?Math.abs(o-(n?t[g-1].x:t[g-1].y)):ns,e=g<r?Math.abs(o-(n?t[g+1].x:t[g+1].y)):ns,a=Math.abs(i);switch(Math.min(a,s,e)){case s:return g-1;case e:return g+1;default:return g}}else g=v}},vt=(t,i,s,e,h,r)=>{const n="x"===s,o=n?i.x:i.y,a=t[h],l=t[r],c=a.x<l.x?a.x:l.x,u=a.y<l.y?a.y:l.y,d=a.x>l.x?a.x:l.x,f=a.y>l.y?a.y:l.y;if(n&&(o<c||o>d)||!n&&(o<u||o>f))return;let A=h,g=Math.floor((h+r)/2),p=r,v=-1;for(;;){const s=o-(n?t[g].x:t[g].y);if(s*(e?-1:1)>0)A=Math.min(g+1,p),v=Math.floor((A+p)/2);else{if(0===Math.abs(s))return{a:g,b:g,lerpAmount:0};p=Math.max(g-1,A),v=Math.floor((A+p)/2)}if(v===g){if(s*(e?-1:1)<0&&g>h){const s=t[g-1],e=t[g];return{a:g-1,b:g,lerpAmount:n?(i.x-s.x)/(e.x-s.x):(i.y-s.y)/(e.y-s.y)}}if(g<r){const s=t[g],e=t[g+1];return{a:g,b:g+1,lerpAmount:n?(i.x-s.x)/(e.x-s.x):(i.y-s.y)/(e.y-s.y)}}return{a:g,b:g,lerpAmount:0}}g=v}};let yt=0;class mt{constructor(t,i,s){this.dt=g(!0),this.ft=!1,this.At=!0,this.vt=!1,this.yt=void 0,this.xt=0,this.R=new bt,this.St=t,this.bt=i,this.Mt=s,this.wt=yt,yt+=1,this._t=t.Ct.highlightColorOffset}kt(){let t;return this.Tt("DataPattern",(i=>(t=i.pattern,!0))),"ProgressiveX"===t||"RegressiveX"===t?ut.NearestX:"ProgressiveY"===t||"RegressiveY"===t?ut.NearestY:ut.Nearest}Ft(){}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}O(t,i,s,e){this.R.O(t,i,{collectionMember:s,info:e})}removeEventListener(t,i){this.R.removeEventListener(t,i)}It(t){return void 0!==this.Mt.find((i=>i.type===t))}Tt(t,i){var s;return!!this.It(t)&&!0===i(null===(s=this.Mt.find((i=>i.type===t)))||void 0===s?void 0:s.args)}dispose(){return this.ft||(this.St.Pt(this),this.ft=!0,this.bt(this),this.R.O("dispose",{})),this}isDisposed(){return this.ft}setVisible(t){const i=this.At;return this.At=t,!t&&i&&this.dt.T()&&this.St.Pt(this),this}getVisible(){return this.At}setPointerEvents(t){const i=this.dt.T();return this.dt.C(t),t||i&&this.St.Pt(this),this}getPointerEvents(){return this.dt.T()}Lt(t){return this.yt=t,this}Bt(){return this.yt?this.yt:xt}Dt(t){return this.xt=t,this}Et(){return this.xt}Rt(t){return this._t=t,this}zt(){return this._t}}const xt=f(a(0,0),a(0,0)),St={click:!0,contextmenu:!0,dblclick:!0,gotpointercapture:!0,lostpointercapture:!0,pointercancel:!0,pointerdown:!0,pointerenter:!0,pointerleave:!0,pointermove:!0,pointerout:!0,pointerover:!0,pointerup:!0,touchcancel:!0,touchend:!0,touchmove:!0,touchstart:!0,wheel:!0,drag:!0,dragend:!0,dragenter:!0,dragleave:!0,dragover:!0,dragstart:!0,drop:!0};class bt{constructor(){this.Ot=new Array,this.Vt=[],this.dt=!0,this.Nt=!1}setPointerEvents(t){this.dt=t,this.Vt.forEach((i=>i.setPointerEvents(t)))}getPointerEvents(){return this.dt}addEventListener(t,i,s){this.Ot.push({listener:i,key:t,options:s||{}})}removeEventListener(t,i){const s=this.Ot.findIndex((t=>t.listener===i));s>=0&&this.Ot.splice(s,1)}set draggable(t){this.Nt=t,this.Vt.forEach((i=>{i.vt=t}))}get draggable(){return this.Nt}O(t,i,s=void 0){this.Ot.slice().reverse().forEach((e=>{e.key===t&&(e.listener(i,s),!0===e.options.once&&this.removeEventListener(t,e.listener))}))}Gt(t,i){Object.keys(St).forEach((s=>{t.addEventListener(s,((t,e)=>{const h=Mt(t)?{clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY}:t,r=(null==i?void 0:i.getExtraData)&&void 0!==h.clientX?i.getExtraData(h,e.collectionMember,e.info):{};this.O(s,t,r),!t.defaultPrevented&&(null==i?void 0:i.continueIfNotPrevented)&&i.continueIfNotPrevented(s,t,r)}))})),this.Vt.push(t),t.addEventListener("dispose",(()=>{const i=this.Vt.indexOf(t);i>=0&&this.Vt.splice(i,1)})),t.vt=this.Nt,t.setPointerEvents(this.dt)}Ut(t,i){Object.keys(St).forEach((s=>{t.addEventListener(s,((t,e)=>{const h=i(e.collectionMember);h&&this.O(s,t,h)}))})),this.Vt.push(t),t.addEventListener("dispose",(()=>{const i=this.Vt.indexOf(t);i>=0&&this.Vt.splice(i,1)})),t.setPointerEvents(this.dt),t.vt=this.Nt}$t(t){Object.keys(St).forEach((i=>{t.addEventListener(i,((t,s)=>{this.O(i,t,s)}))})),t.setPointerEvents(this.dt),t.draggable=this.Nt}}const Mt=t=>!(!t||"object"!=typeof t||!("touches"in t)),wt={linear:(t,i,s)=>{const e=i-t;return h=>h<s?t+e/s*h:i},easeIn:(t,i,s)=>e=>e<s?t+Math.abs(2*(Math.sqrt(.5)*e/s)**2)*(i-t):i,easeOut:(t,i,s)=>e=>e<s?t+Math.abs(1-2*(Math.sqrt(.5)*(1-e/s))**2)*(i-t):i,ease:(t,i,s)=>e=>e<s?t+(e<s/2?.5*(e/s*2)**2.5:.5+.5*(1-(1-2*(e/s-.5))**2.5))*(i-t):i,logarithmic:t=>{const i=wi(t);return(s,e,h)=>{const r=i(s),n=i(e);return i=>i<h?t**(r+Math.abs(1-2*(Math.sqrt(.5)*(1-i/h))**2)*(n-r)):e}}};class _t{constructor(t,i,s,e=wt.linear,h){this.delta=0,this.nextAnimations=new Array,this.Yt=!1,this.easing=wt.linear,this.isOver=()=>(this.delta===this.duration||this.Yt)&&0===this.nextAnimations.length,this.R=new bt,this.values=t,this.action=i,this.duration=s,this.easing=e,this.Ht=h,this.eases=t.map((([t,i])=>e(t,i,s)))}Xt(){this.R.O("start",{})}start(){return this.Ht.includes(this)||this.Ht.push(this),this}addNextAnimations(t){return t instanceof Array?t.forEach((t=>this.nextAnimations.push(t))):this.nextAnimations.push(t),this}NextAnimation(t,i,s=this.duration,e=this.easing){const h=new _t(t,i,s,e,this.Ht);return this.nextAnimations.push(h),h}finish(t=!0){if(this.Yt=!0,this.Ht.splice(this.Ht.indexOf(this),1),this.nextAnimations.length>0){const i=this.nextAnimations[0];return t&&this.R.Ot.forEach((t=>{"allAnimationEnd"===t.key&&i.addEventListener("allAnimationEnd",t.listener),"everyAnimationEnd"===t.key&&i.addEventListener("everyAnimationEnd",t.listener)})),i.addNextAnimations(this.nextAnimations.slice(1)),i.start(),t&&(this.R.O("end",{nextAnimation:i}),this.R.O("everyAnimationEnd",{nextAnimation:i})),i}t&&(this.R.O("end",{nextAnimation:void 0}),this.R.O("everyAnimationEnd",{nextAnimation:void 0}),this.R.O("allAnimationEnd",{}))}finishAll(t=!0){let i=this;for(;i;)i=i.finish(t)}getFinalValues(){return this.nextAnimations.length>0?this.nextAnimations[this.nextAnimations.length-1].values.map(jt):this.values.map(jt)}getTimeUntilFinish(){let t=this.duration-this.delta;for(let i=0;i<this.nextAnimations.length;i+=1)t+=this.nextAnimations[i].duration-this.nextAnimations[i].delta;return t}addEventListener(t,i,s){this.R.addEventListener(t,i,s)}removeEventListener(t,i){this.R.removeEventListener(t,i)}}const Ct=(t,i=60)=>{i>60&&console.log("Note: Animator FPS is usually capped at 60 by the browser!");const s=[];let e,h,r=0;const n=()=>{e=void 0;const o=Date.now();h=h||o,r=o-h,r/1e3>=1/i&&(h=Date.now()-r%(1e3/i),s.forEach((t=>{0===t.delta&&t.Xt(),t.delta+=r-r%(1e3/i),t.delta>t.duration&&(t.delta=t.duration),t.action(t.eases.map((i=>i(t.delta)))),t.delta===t.duration&&t.finish()})),t()),s.length>0?e=Ht.requestAnimationFrame(n):(e=void 0,h=void 0)};return(t=1e3,i=wt.linear)=>(h,r,o=t)=>{const a=new _t(h,r,o,i,s).start();return e||(e=Ht.requestAnimationFrame(n)),a}};var kt;exports.ImageFitMode=void 0,(kt=exports.ImageFitMode||(exports.ImageFitMode={}))[kt.Fill=0]="Fill",kt[kt.Fit=1]="Fit",kt[kt.Stretch=2]="Stretch",kt[kt.Center=3]="Center",kt[kt.Tile=4]="Tile";const Tt=t.Record({type:"fillstyle",fillType:"image",source:void 0,surroundingColor:b(0,0,0,0),sourceMissingColor:b(0,0,0,0),fitMode:exports.ImageFitMode.Fill});class Ft extends Tt{constructor(t){super(t)}setSource(t){return this.set("source",t)}getSource(){return this.get("source")}setSurroundingColor(t){return S(t)?this.set("surroundingColor",t):this.set("surroundingColor",t(this.get("surroundingColor")))}getSurroundingColor(){return this.get("surroundingColor")}setSourceMissingColor(t){return S(t)?this.set("sourceMissingColor",t):this.set("sourceMissingColor",t(this.get("sourceMissingColor")))}getSourceMissingColor(){return this.get("sourceMissingColor")}setFitMode(t){return this.set("fitMode",t)}getFitMode(){return this.get("fitMode")}toString(){return`imagefill:${this.fitMode}`}}const It=t=>!!(t&&"object"==typeof t&&"type"in t&&"fillstyle"===t.type&&"fillType"in t&&"image"===t.fillType),Pt=t.Record({type:"linestyle",lineType:"empty"}),Lt=new class extends Pt{constructor(){super(...arguments),this.thickness=0}setThickness(t){return this}getThickness(){return 0}Wt(){return 0}setFillStyle(t){return this}getFillStyle(){return R}},Bt=t=>!(!t||"object"!=typeof t||!("lineType"in t)||"empty"!==t.lineType),Dt=-34028234663852886e22,Et="-340282346638528859811704183484516925440.0";class Rt extends Error{constructor(t,i){super(`ChartError: ${t} ${i?`in ${i.constructor.name}`:""}`),Object.setPrototypeOf(this,Rt.prototype)}}class zt extends Error{constructor(t,i,s=!1){const e=`EngineError: ${t} ${i?`in ${i.constructor.name}`:""}`;super(e),s&&Ht.alert(e),Object.setPrototypeOf(this,zt.prototype)}}class Ot extends zt{constructor(t){super(t),Object.setPrototypeOf(this,Ot.prototype)}}var Vt,Nt,Gt,Ut;exports.UISpace=void 0,(Vt=exports.UISpace||(exports.UISpace={}))[Vt.Content=0]="Content",Vt[Vt.PaddedContent=1]="PaddedContent",Vt[Vt.PaddedBackground=2]="PaddedBackground",Vt[Vt.Everything=3]="Everything",exports.UIVisibilityModes=void 0,(Nt=exports.UIVisibilityModes||(exports.UIVisibilityModes={}))[Nt.never=0]="never",Nt[Nt.always=1]="always",Nt[Nt.whenHovered=2]="whenHovered",Nt[Nt.whenDragged=3]="whenDragged",Nt[Nt.whenNotDragged=4]="whenNotDragged",Nt[Nt.whenHoveredOrDragged=5]="whenHoveredOrDragged",exports.UIDraggingModes=void 0,(Gt=exports.UIDraggingModes||(exports.UIDraggingModes={}))[Gt.notDraggable=0]="notDraggable",Gt[Gt.draggable=1]="draggable",Gt[Gt.onlyHorizontal=2]="onlyHorizontal",Gt[Gt.onlyVertical=3]="onlyVertical",exports.UIDirections=void 0,(Ut=exports.UIDirections||(exports.UIDirections={}))[Ut.Up=0]="Up",Ut[Ut.Right=1]="Right",Ut[Ut.Down=2]="Down",Ut[Ut.Left=3]="Left";const $t=(...t)=>{const i=t=>t&&"object"==typeof t&&!Array.isArray(t);return t.reduce(((t,s)=>s?(Object.keys(s).forEach((e=>{const h=t[e],r=s[e];i(h)&&i(r)?t[e]=$t(h,r):t[e]=r})),t):t),{})},Yt=t=>{if(t.resourcesBaseUrl){const i=t.styleFactory(t.resourcesBaseUrl),s=It(i)&&i.getSource(),e=s&&s instanceof Image?s:void 0;return null==e||e.addEventListener("error",(()=>{Wi(t.resourcesBaseUrl,e.src,"Theme resource",{shouldCrash:!1})})),i}const i=`${Ht.location.origin}/resources`,s=t.styleFactory(i);if(It(s)){const i=s.getSource();i instanceof Image&&i.addEventListener("error",(()=>{const s=t.styleFactory("https://lcjs-resources.lightningchart.com/v1"),e=It(s)&&s.getSource(),h=e&&e instanceof Image?e:void 0;Ht.console.warn("LightningChart JS warning | fallbacking to publicly hosted asset resources.\nFor more information, please see https://lightningchart.com/js-charts/docs/troubleshooting/warning-using-publicly-hosted-resources/"),null==h||h.addEventListener("load",(()=>{t.apply(s)})),null==h||h.addEventListener("error",(()=>{Wi(t.resourcesBaseUrl,i.src,"Theme resource",{shouldCrash:!1})}))}))}return s},Ht="undefined"!=typeof window?window:"undefined"!=typeof global&&global._lcjs?global._lcjs:{},Xt=(t,i)=>t.x===i.x&&t.y===i.y,Wt=t=>t!==ns&&t!==os&&!Number.isNaN(t)&&Number.isFinite(t)&&t!==1/0&&t!==-1/0,jt=t=>t[1],Zt=t=>t.dispose(),Qt=()=>{},Jt=(t,i)=>t===i,Kt=(t,i,s)=>s>i?Math.min(Math.max(t,i),s):Math.min(Math.max(t,s),i),qt=t=>Array.prototype.concat.apply([],t),ti=(t,i)=>void 0===t||Number.isNaN(t)?i:t,ii=t=>t.jt(),si=t=>t.Zt(),ei=t=>t.Qt(),hi=t=>t.Jt(),ri=t=>t.min.x,ni=t=>t.max.x,oi=t=>t.min.y,ai=t=>t.max.y,li=(t,i,s,e,h)=>{if(t.length>0){let r=h?e(h):void 0;for(let e=0;e<t.length;e+=1){const h=i(t[e]);void 0!==h&&(r=void 0!==r?s(r,h):h)}return r}if(h)return e(h)},ci=(t,i)=>t.position===i.position&&t.high===i.high&&t.low===i.low,ui=a(0,1),di=a(1,0),fi=a(0,-1),Ai=a(-1,0),gi=a(0,0),pi=t=>{switch(t){case exports.UIDirections.Up:return ui;case exports.UIDirections.Right:return di;case exports.UIDirections.Down:return fi;case exports.UIDirections.Left:return Ai;default:return gi}},vi=t=>t===exports.UIDirections.Left||t===exports.UIDirections.Right,yi=t=>{t.stopPropagation(),t.preventDefault()},mi=(t,i)=>{if(!i)return t;const s=t.length,e=new Float32Array(2*s);let h=0;for(let i=0;i<s;i+=1){const s=t[i],r=Math.fround(s);e[h+0]=r,e[h+1]=s-r,h+=2}return e},xi=(t,i,s=Float32Array)=>{if(!i){const i=t.length,e=new s(2*i);let h=0;for(let s=0;s<i;s+=1){const i=t[s];e[h+0]=i.x,e[h+1]=i.y,h+=2}return e}const e=t.length,h=new s(4*e);let r=0;for(let i=0;i<e;i+=1){const s=t[i],e=Math.fround(s.x),n=Math.fround(s.y);h[r+0]=e,h[r+1]=n,h[r+2]=s.x-e,h[r+3]=s.y-n,r+=4}return h},Si=t=>{const i=t.length,s=new Float32Array(3*i);let e=0;for(let h=0;h<i;h+=1){const i=t[h];s[e+0]=i.x,s[e+1]=i.y,s[e+2]=i.z,e+=3}return s},bi=t=>i=>{const s=t.indexOf(i);s>=0&&t.splice(s,1)},Mi=t=>{let i=t.length;for(let s=0;s<i-1;s+=1)t[s].x===t[s+1].x&&t[s].y===t[s+1].y&&(t.splice(s,1),s-=1,i-=1);return t},wi=t=>{const i=Math.log(t);return t=>Math.log(t)/i},_i=wi(Math.E),Ci=(t,i)=>{const s=i[t];return s?s():void 0},ki=(t,i)=>{let s;if(i)s=i;else{const i={x:0,y:0};for(let s=0;s<t.length;s+=1)i.x+=t[s].x/t.length,i.y+=t[s].y/t.length;s=i}return t.sort(((t,i)=>Us(Ds(t,s))-Us(Ds(i,s))))},Ti=(t,i,s)=>{if(0===t.length)return!1===s.canReturnB?i.slice():i;const e=i.length;if(e<1e5)return t.push.apply(t,i),t;for(let s=0;s<e;s+=1)t.push(i[s]);return t},Fi=(t,i,s)=>s<0?t:s>1?i:b(t.getR()+s*(i.getR()-t.getR()),t.getG()+s*(i.getG()-t.getG()),t.getB()+s*(i.getB()-t.getB()),t.getA()+s*(i.getA()-t.getA())),Ii=t=>255===t.getA()?t:t.setA(255),Pi=(()=>{const t=b(0,0,0);return i=>(i=Ii(i),new q({angle:180,stops:[{offset:0,color:i},{offset:1,color:Fi(i,t,.5)}]}))})(),Li=(()=>{const t=t=>{var i;if(t){if(G(t)){if(0===t.getColor().getA())return;return t.getColor()}if(J(t)||tt(t)){const s=t.getColorStops();return 3===s.length?s[1].color:null===(i=s[0])||void 0===i?void 0:i.color}X(t)}};return(i,s,e,h)=>{var r;const n=[];if(h.fill&&n.push(h.fill),h.fill2&&n.push(h.fill2),h.stroke){const t=h.stroke.getFillStyle();t!==R&&("stroke"===(null===(r=h.behavior)||void 0===r?void 0:r.priority)?n.unshift(t):n.push(t))}if(h.point3D){const t=h.point3D;n.push(t.getFillStyle())}let o;if(h.behavior&&!0===h.behavior.colorStep){const[i,e]=n.reduce(((i,s)=>{if(i[0]&&i[1])return i;const e=t(s);return e&&(void 0===i[0]?i[0]=e:i[1]=e),i}),[void 0,void 0]);o=i&&e?(a=i)===(l=e)||a.getR()===l.getR()&&a.getG()===l.getG()&&a.getB()===l.getB()?Pi(a):(a=Ii(a),l=Ii(l),new q({angle:0,stops:[{offset:0,color:l},{offset:.5,color:l},{offset:.5,color:a},{offset:1,color:a}]})):s.uiButtonFillStyle}else{const i=n.reduce(((i,s)=>i||t(s)),void 0);o=i?e?new N({color:i}):Pi(i):s.uiButtonFillStyle}var a,l;i.setButtonOnFillStyle(o)}})(),Bi=(t,i)=>{const s=t;if(X(s))return{lut:s.getPalette(),lookUpProperty:s.getLookUpProperty(),valueRange:i}},Di=t=>{let i=0;return()=>(i+=1,`${t}-${i}`)},Ei=(t,i)=>{let s="string"==typeof t?t:String(t);const e=s.indexOf(".");let h=e>=0?e:s.length;for(;h<i;h+=1)s=`0${s}`;return s},Ri=(t,i)=>"function"==typeof t?t(i):t,zi=(t,i)=>i(),Oi=()=>new Error("LightningChart JS encountered an unexpected error.\nPlease report this issue to https://lightningchart.com/js-charts/docs/contact");new N({color:b(255,255,255,1)});const Vi=t=>t===as||t.min.x===as.min.x&&t.max.x===as.max.x&&t.min.y===as.min.y&&t.max.y===as.max.y,Ni=t=>Array.from(new Set(t)),Gi=t=>t.filter((t=>void 0!==t)),Ui=t=>"boolean"==typeof t?t?1:0:t>1?1:t<0?0:t,$i=(t,i,s)=>{i.length<=0||(t.setText(s.label).setOn(i[0].getVisible()),s.style&&t.setButtonOnFillStyle(s.style),s.toggleVisibilityOnClick&&t.addEventListener("switch",(t=>{i.forEach((i=>i.setVisible(t.state)))})),t.addEventListener("pointerenter",(()=>{i.forEach((t=>t.setHighlight(!0)))})),t.addEventListener("pointerleave",(()=>{i.forEach((t=>t.setHighlight(!1)))})),i.forEach((i=>i.addEventListener("pointerenter",(()=>t.setHighlight(!0))))),i.forEach((i=>i.addEventListener("pointerleave",(()=>t.setHighlight(!1))))))},Yi=(t,i)=>{throw new Error(i)},Hi=t=>{let i;return()=>i||(i=t(),i)},Xi=t=>{if(t===Lt)return 0;const i=t.getThickness();return i<0?1:1*i},Wi=(t,i,s,e)=>{const h=`LightningChart JS Resources not found.\nresourcesBaseUrl: "${t}"\ninitiator: ${s}\nresource url: ${i}\nFor more information, please see https://lightningchart.com/js-charts/docs/troubleshooting/error-resources-not-found/`;if(e.shouldCrash)throw Ht.alert(h),new Error(h);Ht.console.warn(h)},ji=(t,i,s,e=0)=>{if(t<s(e)||s(i)<t)return;const h=i;for(;e!==i;){const h=Math.ceil((e+i)/2);t<s(h)?i=h-1:e=h}const r=Math.abs(t-s(e));return e<h&&Math.abs(t-s(e+1))<r?e+1:e},Zi=()=>{const t=new Map;return{Kt:i=>(Object.keys(St).forEach((s=>{i.addEventListener(s,((i,e)=>{const h=e.collectionMember&&t.get(e.collectionMember);if(!h)return;const r=Mt(i)?{clientX:i.changedTouches[0].clientX,clientY:i.changedTouches[0].clientY}:i,n=h.qt(e.info,r);h.R.O(s,i,n)}))})),i),ti:(i,s)=>{t.set(i,s)},ii:()=>{t.clear()}}},Qi={left:0,right:0,top:0,bottom:0},Ji=()=>Math.round(Math.random()*Number.MAX_SAFE_INTEGER),Ki=(t,i,s)=>{i&&i.si();const e=s();return Object.keys(e).forEach((i=>{const s=i,h=e[s];t.addEventListener(s,h)})),{ei:t,si:()=>{Object.entries(e).forEach((([i,s])=>{const e=i,h=s;t.removeEventListener(e,h)}))}}},qi=(t,i,s)=>{let e;const h=()=>(e=s(),e),r={...t,resolve:()=>e||h()};for(const t of Object.keys(i))Object.defineProperty(r,t,{get:function(){return e?e[t]:h()[t]}});return r},ts=t=>{if(t)return"resolve"in t?t.resolve():t},is=t=>{let i=t;return{hi:t=>{const s=i;return i=s+t,[s,t]}}},ss=t=>{Ht.document.body.addEventListener(t,(t=>{t.stopPropagation(),t.preventDefault()}),{once:!0,capture:!0})},es=()=>{const t=Ht.performance.now();Ht.document.body.addEventListener("contextmenu",(i=>{Ht.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},hs=()=>{const t=Ht.performance.now();Ht.document.body.addEventListener("touchstart",(i=>{Ht.performance.now()-t>5e3||i.preventDefault()}),{once:!0})},rs={add:(t,i)=>u(t.x+i,t.y+i,t.z+i),addVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x+=t.x,s.y+=t.y,s.z+=t.z;return s},subtract:(t,i)=>u(t.x-i,t.y-i,t.z-i),subtractVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x-=t.x,s.y-=t.y,s.z-=t.z;return s},multiply:(t,i)=>u(t.x*i,t.y*i,t.z*i),divide:(t,i)=>u(t.x/i,t.y/i,t.z/i),multiplyVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x*=t.x,s.y*=t.y,s.z*=t.z;return s},divideVec(t,...i){const s={x:t.x,y:t.y,z:t.z};for(const t of i)s.x/=t.x,s.y/=t.y,s.z/=t.z;return s},length:t=>Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z),normalize:t=>rs.divide(t,rs.length(t)),dot:(t,i)=>t.x*i.x+t.y*i.y+t.z*i.z,cross:(t,i)=>u(t.y*i.z-t.z*i.y,t.z*i.x-t.x*i.z,t.x*i.y-t.y*i.x),angle:(t,i)=>Math.acos(rs.dot(t,i)/(rs.length(t)*rs.length(i))),rotateAroundAxis(t,i,s){const e=Math.cos(s),h=Math.sin(s),r=rs.dot(i,t),n=rs.cross(i,t);return rs.addVec(rs.multiply(t,e),rs.addVec(rs.multiply(i,(1-e)*r),rs.multiply(n,h)))},lerp:(t,i,s)=>(s=Kt(s,0,1),rs.addVec(rs.multiply(t,1-s),rs.multiply(i,s))),equals:(t,i)=>Jt(t.x,i.x)&&Jt(t.y,i.y)&&Jt(t.z,i.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)})},ns=Number.MAX_VALUE,os=-Number.MAX_VALUE,as=f(a(ns,ns),a(os,os)),ls=f(u(ns,ns,ns),u(os,os,os)),cs=(t,i)=>{const s=Math.log(t)/Math.log(i);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))(s))},us=(t,i)=>!(i.min.x>t.max.x||i.max.x<t.min.x||i.min.y>t.max.y||i.max.y<t.min.y),ds=(t,i)=>!(t[1].x<i[0].x||t[0].x>i[1].x||t[3].y<i[0].y||t[0].y>i[3].y),fs=(t,i)=>({min:{x:Math.min(t[0].x,i[0].x),y:Math.min(t[0].y,i[0].y)},max:{x:Math.max(t[2].x,i[2].x),y:Math.max(t[2].y,i[2].y)}}),As=t=>{const i=t.length;for(let s=0;s<i;s+=1)for(let e=s+1;e<i;e+=1)if(us(t[s],t[e]))return!0;return!1},gs=(t,i)=>i+t,ps=(t,i,s)=>{const e=Ds(i,t),h=e.x*e.x+e.y*e.y;if(0===h)return t;const r=Ds(s,t),n=(r.x*e.x+r.y*e.y)/h;return n<=0?t:n>=1?i:a(t.x+n*e.x,t.y+n*e.y)},vs=(t,i,s)=>s>i?t>=i&&t<=s:t>=s&&t<=i,ys=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return Math.sqrt(s*s+e*e)},ms=(t,i)=>{const s=t.x-i.x,e=t.y-i.y;return s*s+e*e},xs=(t,i,s)=>Bs(t,Ls(Ds(i,t),s)),Ss=(t,i,s)=>rs.addVec(t,rs.multiply(rs.subtractVec(i,t),s));function bs(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,h=t[0].y,r=t[0].y;for(let n=1;n<i;n+=1){const i=t[n];i.x>s&&(s=i.x),i.x<e&&(e=i.x),i.y>h&&(h=i.y),i.y<r&&(r=i.y)}return f(a(e,r),a(s,h))}return as}function Ms(t){const i=t.length;if(i>0){let s=t[0].x,e=t[0].x,h=t[0].y,r=t[0].y,n=t[0].z,o=t[0].z;for(let a=0;a<i;a+=1){const i=t[a];i.x>s&&(s=i.x),i.x<e&&(e=i.x),i.y>h&&(h=i.y),i.y<r&&(r=i.y),i.z>n&&(n=i.z),i.z<o&&(o=i.z)}return f(u(e,r,o),u(s,h,n))}return ls}const ws=(...t)=>{const i={min:{x:ns,y:ns},max:{x:os,y:os}};for(const s of t)i.min.x=i.min.x<s.min.x?i.min.x:s.min.x,i.max.x=i.max.x>s.max.x?i.max.x:s.max.x,i.min.y=i.min.y<s.min.y?i.min.y:s.min.y,i.max.y=i.max.y>s.max.y?i.max.y:s.max.y;return i},_s=(t,i)=>f(u(t.min.x<i.min.x?t.min.x:i.min.x,t.min.y<i.min.y?t.min.y:i.min.y,t.min.z<i.min.z?t.min.z:i.min.z),u(t.max.x>i.max.x?t.max.x:i.max.x,t.max.y>i.max.y?t.max.y:i.max.y,t.max.z>i.max.z?t.max.z:i.max.z));function Cs(t,i,s,e){const h=t.x-e.x,r=t.y-e.y,n=e.x-s.x,o=s.y-e.y,a=o*h+n*r,l=(e.y-i.y)*h+(i.x-e.x)*r,c=o*(i.x-e.x)+n*(i.y-e.y);return c<0?a<=0&&l<=0&&a+l>=c:a>=0&&l>=0&&a+l<=c}function ks(t,i,s){return a(Math.cos(s)*(t.x-i.x)+Math.sin(s)*(t.y-i.y)+i.x,-Math.sin(s)*(t.x-i.x)+Math.cos(s)*(t.y-i.y)+i.y)}function Ts(t,i){return a(t.x-i.x,t.y-i.y)}function Fs(t){const i=Ps(t);return 0===i?a(0,0):a(t.x/i,t.y/i)}function Is(t,i){let s={x:i.x-t.x,y:i.y-t.y};s=Fs(s);const e=Math.PI/2,h=s.x;return s.x=-Math.sin(e)*s.y,s.y=h*Math.sin(e),s}function Ps(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function Ls(t,i){return a(t.x*i,t.y*i)}function Bs(t,i){return a(t.x+i.x,t.y+i.y)}function Ds(t,i){return a(t.x-i.x,t.y-i.y)}function Es(t,i){return a(t.x*i.x,t.y*i.y)}function Rs(t,i){return a(t.x/i.x,t.y/i.y)}function zs(t){return Ls(t,-1)}function Os(t,i){return t.x*i.x+t.y*i.y}const Vs=(t,i,s)=>{const e=(s.y-i.y)/(s.x-i.x),h=i.y+(t-i.x)*e;return a(t,h)},Ns=(t,i,s)=>{const e=(s.y-i.y)/(s.x-i.x),h=i.x+(t-i.y)/e;return a(h,t)};function Gs(t){return t*Math.PI/180}function Us(t){return 180*Math.atan2(t.y,t.x)/Math.PI}function $s(t){return a(Math.cos(t),Math.sin(t))}const Ys=(t,i,s,e)=>{let h,r,n,o;if(i.x-t.x!=0||e.x-s.x!=0)return i.x-t.x==0?(n=i.x,r=(e.y-s.y)/(e.x-s.x),o=r*(n-s.x)+s.y):e.x-s.x==0?(n=e.x,h=(i.y-t.y)/(i.x-t.x),o=h*(n-t.x)+t.y):(h=(i.y-t.y)/(i.x-t.x),r=(e.y-s.y)/(e.x-s.x),n=(s.y-r*s.x+h*t.x-t.y)/(h-r),o=h*(n-t.x)+t.y),a(n,o)},Hs=(t,i)=>{const s=t.length,e=i.length,h=new Uint16Array(s+e);return h.set(t,0),h.set(i,s),h};class Xs{constructor(){this.ri=!0}getInnerStart(){return this.$}getInnerEnd(){return this.Y}getInnerInterval(){return Math.abs(this.Y-this.$)}j(t,i){return this.ri=t!==this.$||i!==this.Y,this.$=t,this.Y=i,this}X(){return this.ri=!1,this}W(){return this.ri=!0,this}}class Ws extends Xs{constructor(t,i,s,e){if(super(),this.ni=!0,this.oi=!0,this.ai=[0,0],this.li=!0,this.ci=t,this.ui=i,this.di=s,this.fi=t,this.Ai=i,e){const t=t=>{this.gi(t.value)};e.V("change",t),this.gi(e.T()),this.pi=()=>e.G("change",t)}}J(t){return this.H=t,this.oi=!0,this}yi(t){return this.ai=t.map(Math.abs),this.li=!0,this}mi(){return this.ci/this.di*this.H+this.ai[0]}xi(){return(this.ci+this.ui)/this.di*this.H-this.ai[1]}Si(){return this.getCellSize()-this.bi()}Mi(){return this.H}getCellSize(){return this.wi(this.H)}bi(){return this.ai[0]+this.ai[1]}_i(){return this.ai}gi(t){this.di=t.reduce(gs,0),this.ci=t.reduce(((t,i,s)=>s>=this.fi?t:t+i),0),this.ui=t.reduce(((t,i,s)=>s>=this.fi&&s<this.fi+this.Ai?t+i:t),0),this.ni=!0,this.Ci()}wi(t){return t*this.ui/this.di}X(){return super.X(),this.oi=!1,this.li=!1,this.ni=!1,this}W(){return super.W(),this.oi=!0,this.li=!0,this.ni=!0,this}}class js extends Ws{constructor(t,i,s,e){super(t,i,s,e),this.ki={internal:10,function:Zs(10),number:10},this.H=1e3,this.j(1,1e3),this.Ti=this.Fi()}ht(t,i,s,e,h){if(t===i)return!1;const r=Math.min(t,i)<Js,n=Math.max(t,i)>Ks;return!r&&!n||!!h&&(i>t?{start:r?Js:t,end:n?Ks:i}:{start:n?Ks:t,end:r?Js:i})}ot(t){const i=this.mi(),s=this.xi(),e=Math.max(t,Js);return i+(this.ki.function(e)-this.Ti.scaleStartLog)/this.Ti.scaleIntervalLog*(s-i)}nt(t){const i=this.mi(),s=(t-i)/(this.xi()-i),e=this.Ti.scaleStartLog+s*this.Ti.scaleIntervalLog;return this.ki.number**e}Ci(){this.ki&&this.Fi()}j(t,i){return super.j(t,i),this.ki&&this.Fi(),this}yi(t){return super.yi(t),this.ki&&this.Fi(),this}J(t){return super.J(t),this.ki&&this.Fi(),this}Ii(t){return this.ki={internal:t,function:Zs(t),number:Qs(t)},this}Pi(){return this.ki.internal}Li(t,i){const s=this.ot(t)+i;return this.nt(s)}Bi(){return this.oi||this.ri||this.li||this.ni}Fi(){const t=this.ki.function(this.$),i=this.ki.function(this.Y)-t,s=2*this.mi()/this.H-1,e=2*this.xi()/this.H-1-s;return this.Ti={scaleStartLog:t,scaleIntervalLog:i,viewportStart:s,viewportSize:e},this.Ti}Di(){return this.Ti}}const Zs=t=>"e"===t?_i:wi(t),Qs=t=>"e"===t?Math.E:t,Js=.9*10**-20,Ks=1.1*10**25,qs=[{prefix:"T",unit:10**12},{prefix:"B",unit:10**9},{prefix:"M",unit:1e6},{prefix:"K",unit:1e3}],te=(t,i,s)=>{const e=Math.abs(s-i);if(0===e)return t.toFixed(0);const h=Math.max(2-cs(e,10),0);return t.toFixed(h)},ie={Numeric:(t,i)=>{const{start:s,end:e}=i;return te(t,s,e)},NumericUnits:(t,i)=>{const{start:s,end:e}=i,h=Math.abs(e-s),r=t<0;t=Math.abs(t);let n="",o="";if(h>=1e3&&t>1e3){let i="";for(const s of qs){const e=Math.round(1e3*t/s.unit)/1e3;if(e>=1){i=e.toString(),o=s.prefix;break}}n=(r?"-":"")+i}else{let i=String(Math.floor(t));const s=cs(t,1e3);for(let t=1;t<=s;t+=1){const s=i.length-(3*t+(t-1));i=`${i.substring(0,s)} ${i.substring(s,i.length)}`}n=(r?"-":"")+i+(h<=10?((t,i)=>{if(0===i)return"";let s=(Math.abs(t)-Math.abs(Math.floor(t))).toString().substring(1);return s.length>i&&(s=s.substring(0,i+1)),s})(t,2-cs(h,10)):"")}return n+=o,n},LogarithmicExponentsRounded:(t,i,s,e=10)=>{const h=Zs(e)(t);return`${e}${se(h)}`},LogarithmicExponents:(t,i,s,e=10)=>{const h=Zs(e),r=Math.floor(h(t)),n=t/Qs(e)**r;return`${Math.round(n)}×${e}${se(r)}`},LogarithmicExtreme:(t,i,s,e=10)=>{const h=Zs(e),r=Math.floor(h(t));return`${(t/Qs(e)**r).toFixed(2)}×${e}${se(r)}`},LogarithmicNoExponents:(t,i,s,e=10)=>{const h=Zs(e);if("e"===e)return`${Math.floor(h(t))}e`;const r=t.toString();if(t>1)return r;const n=Math.floor(h(t));return t.toFixed(Math.abs(n))},Scientific:(t,i)=>{const{start:s,end:e}=i,h=Math.max(Math.abs(s),Math.abs(e)),r=Math.floor(Math.log10(h));return 0===t?`0.00e${r<0?"":"+"}${r}`:t.toExponential(2)}},se=t=>Math.round(t).toString().split("").map((t=>{switch(t){case"0":return"⁰";case"1":return"¹";case"2":return"²";case"3":return"³";case"4":return"⁴";case"5":return"⁵";case"6":return"⁶";case"7":return"⁷";case"8":return"⁸";case"9":return"⁹";case"-":return"⁻";default:return t}})).join("");class ee extends Ws{constructor(t,i,s,e){super(t,i,s,e),this.Ei=!1,this.Ri=!1,this.zi=0,this.H=1e3,this.j(0,10),this.Z()}Bi(){return this.Ri}ht(t,i,s,e,h){if(t===i)return!1;const r=Math.abs(e-s),n=Math.abs(i-t);if(!this.Ei){const s=((t,i,s)=>{const e=((t,i)=>{if(i<ns&&i>os&&t<ns&&t>os){const s=Math.abs(t/2**23),e=Math.abs(i/2**23),h=Math.min(s,e);return 10**Math.floor(Math.log10(h))}})(t,i);if(void 0!==e)return e*s})(t,i,this.getCellSize());if(void 0===s)return!1;if(n>s)return!0;const e=(i+t)/2,o=(h?s/2:r/2)*(t>i?-1:1);return{start:e-o,end:e+o}}const o=10**-(12-Math.log10(Math.max(Math.abs(t),1)));if(n>o)return!0;const a=(i+t)/2,l=(h?o/2:r/2)*(t>i?-1:1);return{start:a-l,end:a+l}}Ci(){this.Z()}ot(t){return this.mi()+(t-this.$)/(this.Y-this.$)*(this.xi()-this.mi())}nt(t){return this.$+(t-this.mi())/(this.xi()-this.mi())*(this.Y-this.$)}j(t,i){return super.j(t,i),this.Z(),this}yi(t){return super.yi(t),this.Z(),this}J(t){return super.J(t),this.Oi=he(this.Y-this.$,this.ai,this.H,this.ui,this.di),this.Z(),this}Vi(){return this.Ei=!0,this}Ni(){return this.Ei}Gi(){return Math.abs(this.Ui)}$i(){return this.Gi()/this.Oi}Yi(){return this.Hi}Xi(){return this.Wi}getPixelSize(){return this.Oi}Di(){return this.Ti}W(){return super.W(),this.Ri=!0,this}X(){return super.X(),this.Ri=!1,this}ji(t,i=ie.Numeric){return i(t,{start:this.$,end:this.Y})}Zi(){const t=Math.abs(this.getInnerEnd()).toString().length,i=Math.abs(this.getInnerStart()).toString().length;return t>i?t:i}Qi(t){return he(t,this.ai,this.H,this.ui,this.di)}Z(){let t=this.$,i=this.Y,s=0;this.Ei&&(t=0,i=this.Y-this.$,s=this.$);const e=i-t,h=he(e,this.ai,this.H,this.ui,this.di);this.Wi=t-this.ai[0]*h,this.Hi=i+this.ai[1]*h;const r=this.Hi-this.Wi,n=r-this.Ui,o=Math.abs(n/h),a=e-this.zi,l=Math.abs(a/h);(!this.Ti||o>=.4||l>=.4)&&(this.zi=e,this.Ui=r,this.Oi=h,this.Ri=!0);const c=this.Ui*this.di/(2*this.ui),u=-(this.Wi-this.Ui*this.ci/this.ui)-c,d=2*this.mi()/this.H-1,f=2*this.xi()/this.H-1-d;this.Ti={displacement:u,scaling:c,highPrecisionOffset:s,viewportStart:d,viewportSize:f,scaleStartLog:0,scaleIntervalLog:0}}Li(t,i){return t+this.Oi*i}}const he=(t,i,s,e=1,h=1)=>t/(s*e/h-(i[0]+i[1]));class re{Ji(t,i){return"x"in t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=i),this}X(){return this.x.X(),this.y.X(),this}W(){return this.x.W(),this.y.W(),this}J(t,i){return"object"==typeof t?(this.x.J(t.x),this.y.J(t.y)):(this.x.J(t),this.y.J(i)),this}Mi(){return a(this.x.Mi(),this.y.Mi())}Ki(t){return this.x.yi(t),this}qi(t){return this.y.yi(t),this}bi(){return a(this.x.bi(),this.y.bi())}ts(t,i){return this.x.j(t,i),this}ss(t,i){return this.y.j(t,i),this}getInnerIntervalPixels(){const t=this.x.getCellSize(),i=this.y.getCellSize();return{x:t-this.x.bi(),y:i-this.y.bi()}}es(){return this.x.Bi()||this.y.Bi()}}class ne extends re{constructor(){super(...arguments),this.hs="LinearScaleXY"}rt(t,i,s,e){return this.x=new ee(t.x,i.x,s.x,e?e.x:void 0),this.y=new ee(t.y,i.y,s.y,e?e.y:void 0),this}Ni(){return this.x.Ni()||this.y.Ni()}rs(){return a(this.x.getPixelSize(),this.y.getPixelSize())}Di(){return{x:this.x.Di(),y:this.y.Di()}}Li(t,i){const s=this.rs();return{x:t.x+i.x*s.x,y:t.y+i.y*s.y}}ns(t,i,s,e){const h=this.rs(),r=Is(t,i);return r.x*=e,r.y*=e,{x:t.x+s*h.x*r.x,y:t.y+s*h.y*r.y}}}class oe extends re{constructor(){super(...arguments),this.hs="MixedScaleXY"}Ni(){return!1}Li(t,i){const s=this.x.ot(t.x),e=this.y.ot(t.y),h={x:s+i.x,y:e+i.y};return{x:this.x.nt(h.x),y:this.y.nt(h.y)}}ns(t,i,s,e){const h={x:this.x.ot(t.x),y:this.y.ot(t.y)},r={x:this.x.ot(i.x),y:this.y.ot(i.y)},n=Fs(Ds(r,h)),o=Is(r,h),a={x:h.x+n.x*e+o.x*s,y:h.y+n.y*e+o.y*s};return{x:this.x.nt(a.x),y:this.y.nt(a.y)}}Di(){const t=this.x.Di(),i=this.y.Di();return{uScaleStart:[this.x.$,this.y.$],uScaleInterval:[this.x.getInnerInterval(),this.y.getInnerInterval()],uScaleStartLog:[t.scaleStartLog,i.scaleStartLog],uScaleIntervalLog:[t.scaleIntervalLog,i.scaleIntervalLog],uViewportStart:[t.viewportStart,i.viewportStart],uViewportSize:[t.viewportSize,i.viewportSize]}}}const ae=(t,i)=>t instanceof js||i instanceof js?(new oe).Ji(t,i):(new ne).Ji(t,i),le=t=>"client"===t,ce=t=>!!(t&&"object"==typeof t&&"clientX"in t&&"number"==typeof t.clientX&&"clientY"in t&&"number"==typeof t.clientY),ue=t=>"relative"===t,de=t=>!!(t&&"object"==typeof t&&"x"in t&&"number"==typeof t.x&&"y"in t&&"number"==typeof t.y),fe=(t,i,s,e,h,r)=>{if(!t)return;let n=t;const o="button"in s?s:void 0;if(o)if(0===o.button){if(!1===t.lmb)return;void 0!==t.lmb&&(n=$t(n,t.lmb))}else if(1===o.button){if(!1===t.mmb)return;void 0!==t.mmb&&(n=$t(n,t.mmb))}else if(2===o.button){if(!1===t.rmb)return;void 0!==t.rmb&&(n=$t(n,t.rmb))}if(e){if(!1===t.shift)return;n=$t(n,t.shift)}if(h){if(!1===t.ctrl)return;n=$t(n,t.ctrl)}if(r){if(!1===t.alt)return;n=$t(n,t.alt)}if(!i)return n;const a=n[i];return a?!0===a?n:$t(n,a):void 0},Ae=t=>{const i=[];return{push:t=>{i.push(t)},end:()=>{i.length>1&&t&&Ht.console.warn("LightningChart JS warning | event handler triggered more than 1 interaction.\nThis likely means that your `chart.setUserInteractions` configuration either enables conflicting interactions or more likely doesn't disable conflicting default interactions."),i.forEach((t=>t()))}}},ge=(t,i,s)=>{if(t){const t={x:s.x.mi(),y:s.y.mi(),width:s.x.Si(),height:s.y.Si()};i.forEach((i=>{i.ls=t}))}else i.forEach((t=>{t.ls=void 0}))},pe=(t,i)=>{var s;return i?"string"==typeof i?`${t} ${i}`:!1!==(null===(s=i.cs)||void 0===s?void 0:s.displayInCursor)&&i.getUnits()?`${t} ${i.getUnits()}`:t:t},ve=t=>{let i=!1,s={type:"linear"};if(t&&(void 0!==t.opposite&&(i=t.opposite),t.type&&"linear-highPrecision"===t.type&&(s={type:"linear-highPrecision"}),t.type&&"logarithmic"===t.type)){let i=10;if(t.base)if("E"===t.base||"e"===t.base||"natural"===t.base)i="e";else if("number"==typeof t.base)i=t.base;else if("string"==typeof t.base)try{i=Number(t.base)}catch(i){console.warn(`Unidentified logarithmic base "${t.base}"`)}s={base:i,type:"logarithmic"}}return{opp