ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
2 lines • 920 kB
JavaScript
var by=Object.defineProperty,DA=Object.getOwnPropertyDescriptor,hs=(e,t)=>{for(var i in t)by(e,i,{get:t[i],enumerable:!0})},f=(e,t,i,s)=>{for(var n=s>1?void 0:s?DA(t,i):t,a=e.length-1,r;a>=0;a--)(r=e[a])&&(n=(s?r(t,i,n):r(n))||n);return s&&n&&by(t,i,n),n};import{ModuleRegistry as Zc}from"ag-charts-core";import{AsyncAwaitQueue as xy,CleanupRegistry as IA,Logger as Ln,createId as AA,entries as LA,getWindow as CA,groupBy as kA,isFiniteNumber as vy,pause as My}from"ag-charts-core";import{CleanupRegistry as wA}from"ag-charts-core";var Xc=class{constructor(){this.cleanup=new wA}destroy(){this.cleanup.flush()}},TA=class{constructor(){this.modules=[],this.dependencies=new Map,this.modulesByOptionKey=new Map}register(...e){for(const t of e){this.registerDependencies(t);const i=this.modules.find(s=>t.type===s.type&&("optionsKey"in t&&"optionsKey"in s?t.optionsKey===s.optionsKey:!0)&&t.identifier===s.identifier);if(i){if(t.packageType==="enterprise"&&i.packageType==="community"){const s=this.modules.indexOf(i);this.modules.splice(s,1,t),"optionsKey"in t&&this.modulesByOptionKey.set(t.optionsKey,t)}}else this.modules.push(t),"optionsKey"in t&&this.modulesByOptionKey.set(t.optionsKey,t)}}hasEnterpriseModules(){return this.modules.some(e=>e.packageType==="enterprise")}*byType(...e){const t=new Set,i=this.modules.filter(a=>e.includes(a.type)),s=a=>{const r=this.dependencies.get(a);return r?.flatMap(s).concat(r)??[]},n=[];for(const a of i){const r="optionsKey"in a?a.optionsKey:a.contextKey;if(!t.has(r)){for(const o of s(r)){if(t.has(o))continue;const l=this.modulesByOptionKey.get(o);if(!l){n.push(o);continue}e.includes(l.type)&&(yield l,t.add(o))}yield a,t.add(r)}}if(n.length>0)throw new Error(`Could not resolve module dependencies: ${n}`)}registerDependencies(e){if(e.dependencies==null||e.dependencies.length===0)return;const t="optionsKey"in e?e.optionsKey:e.contextKey;this.dependencies.set(t,e.dependencies)}},us=new TA;import{boxContains as NA,boxesEqual as EA,clamp as Ir}from"ag-charts-core";var qc=Symbol("interpolate"),Qc=e=>e[qc]!=null;function Jc(e,t,i,s=1/0){const n={nearest:void 0,distanceSquared:s};for(const a of i){const r=a.distanceSquared(e,t);if(r===0)return{nearest:a,distanceSquared:0};r<n.distanceSquared&&(n.nearest=a,n.distanceSquared=r)}return n}function OA(e,t,i,s=1/0){const{x:n=e,y:a=t}=i.transformPoint?.(e,t)??{},r={nearest:void 0,distanceSquared:s};for(const o of i.children){const{nearest:l,distanceSquared:c}=o.nearestSquared(n,a,r.distanceSquared);if(c===0)return{nearest:l,distanceSquared:c};c<r.distanceSquared&&(r.nearest=l,r.distanceSquared=c)}return r}var Yo=class Wo{constructor(t,i,s,n){this.x=t,this.y=i,this.width=s,this.height=n}static fromDOMRect({x:t,y:i,width:s,height:n}){return new Wo(t,i,s,n)}static merge(t){let i=1/0,s=1/0,n=-1/0,a=-1/0;for(const r of t)r.x<i&&(i=r.x),r.y<s&&(s=r.y),r.x+r.width>n&&(n=r.x+r.width),r.y+r.height>a&&(a=r.y+r.height);return new Wo(i,s,n-i,a-s)}static nearestBox(t,i,s){return Jc(t,i,s)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:this.x+this.width,bottom:this.y+this.height,toJSON(){return{}}}}clone(){const{x:t,y:i,width:s,height:n}=this;return new Wo(t,i,s,n)}equals(t){return EA(this,t)}containsPoint(t,i){return NA(this,t,i)}intersection(t){if(!this.collidesBBox(t))return;const i=Ir(t.x,this.x,t.x+t.width),s=Ir(t.y,this.y,t.y+t.height),n=Ir(t.x,this.x+this.width,t.x+t.width),a=Ir(t.y,this.y+this.height,t.y+t.height);return new Wo(i,s,n-i,a-s)}collidesBBox(t){return this.x<t.x+t.width&&this.x+this.width>t.x&&this.y<t.y+t.height&&this.y+this.height>t.y}computeCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)&&Number.isFinite(this.width)&&Number.isFinite(this.height)}distanceSquared(t,i){if(this.containsPoint(t,i))return 0;const s=t-Ir(this.x,t,this.x+this.width),n=i-Ir(this.y,i,this.y+this.height);return s*s+n*n}shrink(t,i){if(typeof t=="number")this.applyMargin(t,i);else for(const s of Object.keys(t)){const n=t[s];typeof n=="number"&&this.applyMargin(n,s)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,i){if(typeof t=="number")this.applyMargin(-t,i);else for(const s of Object.keys(t)){const n=t[s];typeof n=="number"&&this.applyMargin(-n,s)}return this}applyMargin(t,i){switch(i){case"top":this.y+=t;case"bottom":this.height-=t;break;case"left":this.x+=t;case"right":this.width-=t;break;case"vertical":this.y+=t,this.height-=t*2;break;case"horizontal":this.x+=t,this.width-=t*2;break;case void 0:this.x+=t,this.y+=t,this.width-=t*2,this.height-=t*2;break}}translate(t,i){return this.x+=t,this.y+=i,this}[qc](t,i){return new Wo(this.x*(1-i)+t.x*i,this.y*(1-i)+t.y*i,this.width*(1-i)+t.width*i,this.height*(1-i)+t.height*i)}};Yo.zero=Object.freeze(new Yo(0,0,0,0)),Yo.NaN=Object.freeze(new Yo(NaN,NaN,NaN,NaN));var z=Yo;import{clamp as PA,toIterable as RA}from"ag-charts-core";import{Logger as Pd,getWindow as zA,toArray as Sy}from"ag-charts-core";var FA=2e3,Dy=Date.now(),jA=()=>{const e=Date.now()-Dy;if(e>FA){const t=(Math.floor(e/100)/10).toFixed(1);Pd.log(`**** ${t}s since last log message ****`)}Dy=Date.now()},le={create(...e){return Object.assign((...i)=>{le.check(...e)&&(typeof i[0]=="function"&&(i=Sy(i[0]())),jA(),Pd.log(...i))},{check:()=>le.check(...e),group:(i,s)=>le.check(...e)?Pd.logGroup(i,s):s()})},check(...e){return e.length===0&&e.push(!0),Sy(zA("agChartsDebug")).some(i=>e.includes(i))},inDevelopmentMode(e){if(le.check("dev"))return e()}};function Iy({context:e,pixelRatio:t,width:i,height:s}){e.save();try{e.resetTransform(),e.clearRect(0,0,Math.ceil(i*t),Math.ceil(s*t))}finally{e.restore()}}function Ay(e){if(le.check("canvas")){const t=e.save.bind(e),i=e.restore.bind(e);let s=0;Object.assign(e,{save(){t(),s++},restore(){if(s===0)throw new Error("AG Charts - Unable to restore() past depth 0");i(),s--},verifyDepthZero(){if(s!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${s}`)}})}}function Ly(e,t,i){return[Math.floor(e*i),Math.floor(t*i)]}var Rd=class{constructor(e){const{width:t,height:i,pixelRatio:s,willReadFrequently:n=!1}=e;this.width=t,this.height=i,this.pixelRatio=s;const[a,r]=Ly(t,i,s);this.canvas=new OffscreenCanvas(a,r),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(s,0,0,s,0,0),Ay(this.context)}drawImage(e,t=0,i=0){return e.drawImage(this.canvas,t,i)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(e,t,i){if(!(e>0&&t>0))return;const{canvas:s,context:n}=this;if(e!==this.width||t!==this.height||i!==this.pixelRatio){const[a,r]=Ly(e,t,i);s.width=a,s.height=r}n.setTransform(i,0,0,i,0,0),this.width=e,this.height=t,this.pixelRatio=i}clear(){Iy(this)}destroy(){this.canvas.width=0,this.canvas.height=0,this.context.clearRect(0,0,0,0),this.canvas=null,this.context=null,Object.freeze(this)}};import{Logger as BA,createId as VA,createSvgElement as Cy}from"ag-charts-core";import*as GA from"ag-charts-core";var zd=Symbol("BREAK"),$o="__decorator_config",eh="__decorator_accessors";function _A(e,t){Fd(e,t).optional=!0}function Fd(e,t){if(Object.getOwnPropertyDescriptor(e,$o)==null&&Object.defineProperty(e,$o,{value:{}}),Object.getOwnPropertyDescriptor(e,eh)==null){const h=Object.getPrototypeOf(e)?.[eh]?.slice()??[];Object.defineProperty(e,eh,{value:h})}const i=e[$o],s=t.toString();if(i[s]!=null)return i[s];i[s]={setters:[],getters:[],observers:[]};const n=Object.getOwnPropertyDescriptor(e,t);let a=n?.get,r=n?.set;if(a==null||r==null){const c=e[eh];let h=c.indexOf(t);h===-1&&(h=c.push(t)-1),a??(a=function(){let u=this.__accessors;return u==null&&(u=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:u})),u[h]}),r??(r=function(u){let d=this.__accessors;d==null&&(d=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:d})),d[h]=u})}return Object.defineProperty(e,t,{set:function(c){const{setters:h,observers:u}=i[s];let d;h.some(p=>p.length>2)&&(d=a.call(this));for(const p of h)if(c=p(this,t,c,d),c===zd)return;r.call(this,c);for(const p of u)p(this,c,d)},get:function(){let c=a.call(this);for(const h of i[s].getters)if(c=h(this,t,c),c===zd)return;return c},enumerable:!0,configurable:!1}),i[s]}function ha(e,t,i){return(s,n)=>{const a=Fd(s,n);a.setters.push(e),t&&a.getters.unshift(t),i&&Object.assign(a,i)}}function ky(e){return(t,i)=>{Fd(t,i).observers.push(e)}}function th(e){return typeof e<"u"&&$o in e}function ua(e){const t=new Set;for(;th(e);)t.add(e?.[$o]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(i=>Object.keys(i))}function wy(e){return ua(e).reduce((t,i)=>(t[i]=e[i]??null,t),{})}var{entries:HA,isArray:jd,isObject:Ty,isPlainObject:Cn}=GA;function nt(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((i,s)=>nt(i,t[s])):Cn(e)?Cn(t)?Bd(e,t,nt):!1:e===t}function Bd(e,t,i){if(Object.is(e,t))return!0;for(const s of Object.keys(t))if(!(s in e))return!1;for(const s of Object.keys(e))if(!(s in t)||!i(e[s],t[s]))return!1;return!0}function ye(...e){const t={};for(const i of e){if(!Ty(i))continue;const s=th(i)?ua(i):Object.keys(i);for(const n of s)Cn(t[n])&&Cn(i[n])?t[n]=ye(t[n],i[n]):t[n]??(t[n]=i[n])}return t}function Ko(...e){const t={};for(const i of e){if(!Ty(i))continue;const s=th(i)?ua(i):Object.keys(i);for(const n of s)Cn(t[n])&&Cn(i[n])?t[n]=Ko(t[n],i[n]):n in t||(t[n]??(t[n]=i[n]))}return t}function Ny(e,...t){return t&&jd(e)?e.map(i=>ye(i,...t)):e}function Ey(e,t){const i={};for(const[s,n]of HA(e))i[s]=t(n,s,e);return i}function O(e,t){const i={...e};for(const s of t)delete i[s];return i}function Vd(e,t){if(e==null)return;const i={};for(const s of t)Object.hasOwn(e,s)&&(i[s]=e[s]);return i}function Gd(e,t){return(jd(t)?t:t.split(".")).reduce((s,n)=>s[n],e)}var _d=new Set(["__proto__","constructor","prototype"]);function Hd(e,t,i){const s=jd(t)?t.slice():t.split("."),n=s.pop();if(s.some(r=>_d.has(r)))return;const a=s.reduce((r,o)=>r[o],e);return a[n]=i,a[n]}function Ud(e,t,i){if(i===void 0)return t;for(const s of e){const n=i[s];n!==void 0&&(t[s]=n)}return t}function js(e){return e==null||typeof e!="object"||!Cn(e)||(Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t];i!==null&&(typeof i=="object"||typeof i=="function")&&!Object.isFrozen(i)&&js(i)})),e}function Oy(e,t){return Cn(e)&&t in e}function UA(e,t){return Oy(e,t)&&typeof e[t]=="string"}import{arraysEqual as WA}from"ag-charts-core";var Ar=(e,t)=>e===t;function N(e){return function(t,i){const s=`__${i}`;t[i]||YA(t,i,s,e)}}function ui(e){return N(e)}function Wd(e){const t=e??{};return t.equals=WA,N(e)}function YA(e,t,i,s){const{changeCb:n,convertor:a,checkDirtyOnAssignment:r=!1}=s??{},o={changeCb:n,checkDirtyOnAssignment:r,convertor:a},l=ZA(i,KA($A(XA(i,o),o),o),o);Object.defineProperty(e,t,{set:l,get:function(){return this[i]},enumerable:!0,configurable:!0})}function $A(e,t){const{convertor:i}=t;return i?function(s){e.call(this,i(s))}:e}var Py=Symbol("no-change");function KA(e,t){const{changeCb:i}=t;return i?function(s){const n=e.call(this,s);return n!==Py&&i.call(this,this),n}:e}function ZA(e,t,i){const{checkDirtyOnAssignment:s}=i;return s?function(n){const a=t.call(this,n);return n?._dirty===!0&&this.markDirty(e),a}:t}function XA(e,t){const{equals:i=Ar}=t;return function(s){const n=this[e];return i(s,n)?Py:(this[e]=s,this.onChangeDetection(e),s)}}var Yd=(e,t)=>Math.sign(e-t);function Ry(e,t){if(typeof e=="number"&&typeof t=="number")return Yd(e,t);const i=typeof e=="number"?[e]:e,s=typeof t=="number"?[t]:t,n=Math.min(i.length,s.length);for(let a=0;a<n;a+=1){const r=Yd(i[a],s[a]);if(r!==0)return r}return Yd(i.length,s.length)}var zy=(e=>(e[e.All=0]="All",e[e.None=1]="None",e))(zy||{}),qA=5,Zo=class dy{constructor(t){this.serialNumber=dy._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=VA(this),this.name=void 0,this.transitionOut=void 0,this.pointerEvents=0,this._datum=void 0,this._previousDatum=void 0,this.scene=void 0,this._debugDirtyProperties=void 0,this.parentNode=void 0,this.cachedBBox=void 0,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.batchLevel=0,this.batchDirty=!1,this.name=t?.name,this.tag=t?.tag??NaN,this.zIndex=t?.zIndex??0,(t?.debugDirty??dy._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,i,s){const n=t?.toSVG();if(n==null||!n.elements.length&&!n.defs?.length)return;const a=Cy("svg");if(a.setAttribute("width",String(i)),a.setAttribute("height",String(s)),a.setAttribute("viewBox",`0 0 ${i} ${s}`),n.defs?.length){const r=Cy("defs");r.append(...n.defs),a.append(r)}return a.append(...n.elements),a.outerHTML}static*extractBBoxes(t,i){for(const s of t)if(!i||s.visible&&!s.transitionOut){const n=s.getBBox();n&&(yield n)}}get datum(){return this._datum}set datum(t){this._datum!==t&&(this._previousDatum=this._datum,this._datum=t)}get previousDatum(){return this._previousDatum}get layerManager(){return this.scene?.layersManager}get imageLoader(){return this.scene?.imageLoader}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}preRender(t,i=1){if(this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i,this.batchLevel>0||this.batchDirty)throw new Error("AG Charts - illegal rendering state; batched update in progress");return this.childNodeCounts}isolatedRender(t){t.ctx.save();try{this.render(t)}catch(i){const s=i.errorCount??1;if(s>=qA)throw i.errorCount=s,i;BA.warnOnce("Error during rendering",i,i.stack)}finally{t.ctx.restore()}}render(t){const{stats:i}=t;if(this.debugDirtyProperties(),t.debugNodeSearch){const s=this.name??this.id;t.debugNodeSearch.some(n=>typeof n=="string"?n===s:n.test(s))&&(t.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}setScene(t){this.scene=t}*traverseUp(t){let i=this;for(t&&(yield i);i=i.parentNode;)yield i}isRoot(){return!this.parentNode}removeChild(t){throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`)}remove(){this.parentNode?.removeChild(this)}destroy(){this.parentNode?.removeChild(this)}batchedUpdate(t){this.batchLevel++,t(),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}setProperties(t){return this.batchLevel++,Object.assign(this,t),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1),this}containsPoint(t,i){return!1}pickNode(t,i){if(this.containsPoint(t,i))return this}pickNodes(t,i,s=[]){return this.containsPoint(t,i)&&s.push(this),s}getBBox(){return this.cachedBBox==null&&(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirtyChildrenOrder(){this.cachedBBox=void 0}markDirty(t){if(this.batchLevel>0){this.batchDirty=!0;return}t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),this.cachedBBox=void 0,this.parentNode?.markDirty()}markDebugProperties(t){const i=this._debugDirtyProperties?.get(t)??[],s=new Error().stack?.split(`
`).filter(n=>n!=="Error"&&!n.includes(".markDebugProperties")&&!n.includes(".markDirty")&&!n.includes("Object.assign ")&&!n.includes(`${this.constructor.name}.`))??"unknown";i.push(s[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,i)}debugDirtyProperties(){this._debugDirtyProperties!=null&&(this._debugDirtyProperties.has("__first__")||this._debugDirtyProperties.forEach((t,i)=>{t.length>1&&(console.groupCollapsed(`Property changed multiple times before render: ${this.constructor.name}.${i} (${t.length}x)`),t.forEach(s=>console.log(s)),console.groupEnd())}),this._debugDirtyProperties.clear())}onZIndexChange(){this.parentNode?.markDirtyChildrenOrder()}toSVG(){}};Zo._nextSerialNumber=0,Zo._debugEnabled=!1,f([N()],Zo.prototype,"visible",2),f([ui({equals:nt,changeCb:e=>e.onZIndexChange()})],Zo.prototype,"zIndex",2);var Bs=Zo;import{boxesEqual as QA,clamp as JA,generateUUID as $d}from"ag-charts-core";import{createSvgElement as eL}from"ag-charts-core";var Li=Math.PI*2,Xo=Math.PI/2;function et(e){return e%=Li,e+=Li,e%=Li,e}function tL(e){return e%=Li,e+=Li,e!==Li&&(e%=Li),e}function qo(e){return e%=Li,e<-Math.PI?e+=Li:e>=Math.PI&&(e-=Li),e}function da(e,t,i){const s=et(e),n=et(t),a=et(i);return n<a?n<=s&&s<=a:n>a?n<=s||s<=a:!0}function at(e){return e/180*Math.PI}function iL(e){return e/Math.PI*180}function ih(e,t){return e=et(e),t=et(t),t-e+(e>t?Li:0)}function Fy(e){const t=et(e);return t<=Xo?t/Xo:t<=Math.PI?(Math.PI-t)/Xo:t<=1.5*Math.PI?(t-Math.PI)/Xo:(Li-t)/Xo}function Kd(e,t,i){const s=Fy(i);return e*s+t*Math.abs(1-s)}function Vs(e){return e?et(at(e)):0}import{createSvgElement as sL}from"ag-charts-core";import{Logger as Zd,clamp as nL}from"ag-charts-core";import{clamp as Gs}from"ag-charts-core";var pa=(e,t,i)=>e*(1-i)+t*i,Xd=e=>{const t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4},qd=e=>{const t=e<0?-1:1,i=Math.abs(e);return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e},jy=class Se{constructor(t,i,s,n=1){this.r=Gs(0,t||0,1),this.g=Gs(0,i||0,1),this.b=Gs(0,s||0,1),this.a=Gs(0,n||0,1)}static validColorString(t){return t.indexOf("#")>=0?!!Se.parseHex(t):t.indexOf("rgb")>=0?!!Se.stringToRgba(t):Se.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.indexOf("#")>=0)return Se.fromHexString(t);const i=Se.nameToHex.get(t.toLowerCase());if(i)return Se.fromHexString(i);if(t.indexOf("rgb")>=0)return Se.fromRgbaString(t);throw new Error(`Invalid color string: '${t}'`)}static parseHex(t){t=t.replace(/ /g,"").slice(1);let i;switch(t.length){case 6:case 8:i=[];for(let s=0;s<t.length;s+=2)i.push(parseInt(`${t[s]}${t[s+1]}`,16));break;case 3:case 4:i=t.split("").map(s=>parseInt(s,16)).map(s=>s+s*16);break}if(i?.length>=3&&i.every(s=>s>=0))return i.length===3&&i.push(255),i}static fromHexString(t){const i=Se.parseHex(t);if(i){const[s,n,a,r]=i;return new Se(s/255,n/255,a/255,r/255)}throw new Error(`Malformed hexadecimal color string: '${t}'`)}static stringToRgba(t){let i=-1,s=-1;for(let o=0;o<t.length;o++){const l=t[o];if(i===-1&&l==="(")i=o;else if(l===")"){s=o;break}}if(i===-1||s===-1)return;const a=t.substring(i+1,s).split(","),r=[];for(let o=0;o<a.length;o++){const l=a[o];let c=parseFloat(l);if(!Number.isFinite(c))return;l.indexOf("%")>=0?(c=Gs(0,c,100),c/=100):o===3?c=Gs(0,c,1):(c=Gs(0,c,255),c/=255),r.push(c)}return r}static fromRgbaString(t){const i=Se.stringToRgba(t);if(i){if(i.length===3)return new Se(i[0],i[1],i[2]);if(i.length===4)return new Se(i[0],i[1],i[2],i[3])}throw new Error(`Malformed rgb/rgba color string: '${t}'`)}static fromArray(t){if(t.length===4)return new Se(t[0],t[1],t[2],t[3]);if(t.length===3)return new Se(t[0],t[1],t[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(t,i,s,n=1){const a=Se.HSBtoRGB(t,i,s);return new Se(a[0],a[1],a[2],n)}static fromHSL(t,i,s,n=1){const a=Se.HSLtoRGB(t,i,s);return new Se(a[0],a[1],a[2],n)}static fromOKLCH(t,i,s,n=1){const a=Se.OKLCHtoRGB(t,i,s);return new Se(a[0],a[1],a[2],n)}static padHex(t){return t.length===1?"0"+t:t}toHexString(){let t="#"+Se.padHex(Math.round(this.r*255).toString(16))+Se.padHex(Math.round(this.g*255).toString(16))+Se.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(t+=Se.padHex(Math.round(this.a*255).toString(16))),t}toRgbaString(t=3){const i=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)],s=Math.pow(10,t);return this.a!==1?(i.push(Math.round(this.a*s)/s),`rgba(${i.join(", ")})`):`rgb(${i.join(", ")})`}toString(){return this.a===1?this.toHexString():this.toRgbaString()}toHSB(){return Se.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(t,i,s){const n=Xd(t),a=Xd(i),r=Xd(s),o=Math.cbrt(.4122214708*n+.5363325363*a+.0514459929*r),l=Math.cbrt(.2119034982*n+.6806995451*a+.1073969566*r),c=Math.cbrt(.0883024619*n+.2817188376*a+.6299787005*r),h=.2104542553*o+.793617785*l-.0040720468*c,u=1.9779984951*o-2.428592205*l+.4505937099*c,d=.0259040371*o+.7827717662*l-.808675766*c,p=Math.atan2(d,u)*180/Math.PI,g=h,y=Math.hypot(u,d),b=p>=0?p:p+360;return[g,y,b]}static OKLCHtoRGB(t,i,s){const n=t,a=i*Math.cos(s*Math.PI/180),r=i*Math.sin(s*Math.PI/180),o=(n+.3963377774*a+.2158037573*r)**3,l=(n-.1055613458*a-.0638541728*r)**3,c=(n-.0894841775*a-1.291485548*r)**3,h=4.0767416621*o-3.3077115913*l+.2309699292*c,u=-1.2684380046*o+2.6097574011*l-.3413193965*c,d=-.0041960863*o-.7034186147*l+1.707614701*c,p=qd(h),g=qd(u),y=qd(d);return[p,g,y]}static RGBtoHSL(t,i,s){const n=Math.min(t,i,s),a=Math.max(t,i,s),r=(a+n)/2;let o,l;if(a===n)o=0,l=0;else{const c=a-n;l=r>.5?c/(2-a-n):c/(a+n),a===t?o=(i-s)/c+(i<s?6:0):a===i?o=(s-t)/c+2:o=(t-i)/c+4,o*=360/6}return[o,l,r]}static HSLtoRGB(t,i,s){if(t=(t%360+360)%360,i===0)return[s,s,s];const n=s<.5?s*(1+i):s+i-s*i,a=2*s-n;function r(h){return h<0&&(h+=1),h>1&&(h-=1),h<1/6?a+(n-a)*6*h:h<1/2?n:h<2/3?a+(n-a)*(2/3-h)*6:a}const o=r(t/360+1/3),l=r(t/360),c=r(t/360-1/3);return[o,l,c]}static RGBtoHSB(t,i,s){const n=Math.min(t,i,s),a=Math.max(t,i,s),r=a===0?0:(a-n)/a;let o=0;if(n!==a){const l=a-n,c=(a-t)/l,h=(a-i)/l,u=(a-s)/l;t===a?o=u-h:i===a?o=2+c-u:o=4+h-c,o/=6,o<0&&(o=o+1)}return[o*360,r,a]}static HSBtoRGB(t,i,s){t=(t%360+360)%360/360;let n=0,a=0,r=0;if(i===0)n=a=r=s;else{const o=(t-Math.floor(t))*6,l=o-Math.floor(o),c=s*(1-i),h=s*(1-i*l),u=s*(1-i*(1-l));switch(o>>0){case 0:n=s,a=u,r=c;break;case 1:n=h,a=s,r=c;break;case 2:n=c,a=s,r=u;break;case 3:n=c,a=h,r=s;break;case 4:n=u,a=c,r=s;break;case 5:n=s,a=c,r=h;break}}return[n,a,r]}static mix(t,i,s){return new Se(pa(t.r,i.r,s),pa(t.g,i.g,s),pa(t.b,i.b,s),pa(t.a,i.a,s))}static lighten(t,i){const s=Se.RGBtoOKLCH(t.r,t.g,t.b);return Se.fromOKLCH(Gs(0,s[0]+i,1),s[1],s[2])}static darken(t,i){const s=Se.RGBtoOKLCH(t.r,t.g,t.b);return Se.fromOKLCH(Gs(0,s[0]-i,1),s[1],s[2])}static interpolate(t,i){const s=1/(t.length-1),n=t.map(a=>Se.RGBtoOKLCH(a.r,a.g,a.b));return Array.from({length:i},(a,r)=>{const o=r/(i-1),l=t.length<=2?0:Math.min(Math.floor(o*(t.length-1)),t.length-2),c=(o-l*s)/s,h=n[l],u=n[l+1];return Se.fromOKLCH(pa(h[0],u[0],c),pa(h[1],u[1],c),pa(h[2],u[2],c))})}};jy.nameToHex=new Map([["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"],["darkgrey","#A9A9A9"],["darkkhaki","#BDB76B"],["darkmagenta","#8B008B"],["darkolivegreen","#556B2F"],["darkorange","#FF8C00"],["darkorchid","#9932CC"],["darkred","#8B0000"],["darksalmon","#E9967A"],["darkseagreen","#8FBC8F"],["darkslateblue","#483D8B"],["darkslategray","#2F4F4F"],["darkslategrey","#2F4F4F"],["darkturquoise","#00CED1"],["darkviolet","#9400D3"],["deeppink","#FF1493"],["deepskyblue","#00BFFF"],["dimgray","#696969"],["dimgrey","#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"],["grey","#808080"],["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"],["lightgray","#D3D3D3"],["lightgreen","#90EE90"],["lightgrey","#D3D3D3"],["lightpink","#FFB6C1"],["lightsalmon","#FFA07A"],["lightseagreen","#20B2AA"],["lightskyblue","#87CEFA"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#B0C4DE"],["lightyellow","#FFFFE0"],["lime","#00FF00"],["limegreen","#32CD32"],["linen","#FAF0E6"],["magenta","#FF00FF"],["maroon","#800000"],["mediumaquamarine","#66CDAA"],["mediumblue","#0000CD"],["mediumorchid","#BA55D3"],["mediumpurple","#9370DB"],["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","#DB7093"],["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"],["slategrey","#708090"],["snow","#FFFAFA"],["springgreen","#00FF7F"],["steelblue","#4682B4"],["tan","#D2B48C"],["teal","#008080"],["thistle","#D8BFD8"],["tomato","#FF6347"],["transparent","#00000000"],["turquoise","#40E0D0"],["violet","#EE82EE"],["wheat","#F5DEB3"],["white","#FFFFFF"],["whitesmoke","#F5F5F5"],["yellow","#FFFF00"],["yellowgreen","#9ACD32"]]);var Ne=jy,sh=class{ticks(e,t,i){}niceDomain(e,t=this.domain){return t}get bandwidth(){}get step(){}get inset(){}},Qo=(e,t)=>{const i=Symbol(String(t));e[i]=void 0,Object.defineProperty(e,t,{get(){return this[i]},set(s){this[i]!==s&&(this[i]=s,this.invalid=!0)},enumerable:!0,configurable:!1})},By=e=>{const t=Ne.fromString(e),[i,s,n]=Ne.RGBtoOKLCH(t.r,t.g,t.b);return{l:i,c:s,h:n,a:t.a}},Qd=1e-6,Vy=e=>e.c<Qd||e.l<Qd||e.l>1-Qd,aL=(e,t,i)=>{i=nL(0,i,1);let s;if(Vy(e))s=t.h;else if(Vy(t))s=e.h;else{const o=e.h;let l=t.h;const c=t.h-e.h;c>180?l-=360:c<-180&&(l+=360),s=o*(1-i)+l*i}const n=e.c*(1-i)+t.c*i,a=e.l*(1-i)+t.l*i,r=e.a*(1-i)+t.a*i;return Ne.fromOKLCH(a,n,s,r)},Lr=class extends sh{constructor(){super(...arguments),this.type="color",this.defaultTickCount=0,this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(By)}update(){const{domain:e,range:t}=this;e.length<2&&(Zd.warnOnce("`colorDomain` should have at least 2 values."),e.length===0?e.push(0,1):e.length===1&&e.push(e[0]+1));for(let i=1;i<e.length;i++){const s=e[i-1],n=e[i];if(s>=n){Zd.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((a,r)=>a-r);break}}if(t.length<e.length)for(let i=t.length;i<e.length;i++)t.push(t.length>0?t[0]:"black");this.parsedRange=this.range.map(By)}normalizeDomains(...e){return{domain:e.flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const{domain:t,range:i,parsedRange:s}=this,n=t[0],a=t.at(-1),r=i[0],o=i[i.length-1];if(e<=n)return r;if(e>=a)return o;let l,c;if(t.length===2){const d=(e-n)/(a-n),p=1/(i.length-1);l=i.length<=2?0:Math.min(Math.floor(d*(i.length-1)),i.length-2),c=(d-l*p)/p}else{for(l=0;l<t.length-2&&!(e<t[l+1]);l++);const d=t[l],p=t[l+1];c=(e-d)/(p-d)}const h=s[l],u=s[l+1];return aL(h,u,c).toRgbaString()}invert(){}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&Zd.warnOnce("Expected update to not invalidate scale"))}};f([Qo],Lr.prototype,"domain",2),f([Qo],Lr.prototype,"range",2);var nh=class{constructor(e,t=[],i){this.colorSpace=e,this.stops=t,this.bbox=i,this._cache=void 0}createGradient(e,t,i){const s=this.bbox??t;if(!s.isFinite())return;if(this._cache!=null&&this._cache.ctx===e&&this._cache.bbox.equals(s))return this._cache.gradient;const{stops:n,colorSpace:a}=this;if(n.length===0)return;if(n.length===1)return n[0].color;let r=this.createCanvasGradient(e,s,i);if(r==null)return;const o=a==="oklch",l=.05;let c=n[0];r.addColorStop(c.stop,c.color);for(let h=1;h<n.length;h+=1){const u=n[h];if(o){const d=new Lr;d.domain=[c.stop,u.stop],d.range=[c.color,u.color];for(let p=c.stop+l;p<u.stop;p+=l)r.addColorStop(p,d.convert(p))}r.addColorStop(u.stop,u.color),c=u}return"createPattern"in r&&(r=r.createPattern()),this._cache={ctx:e,bbox:s,gradient:r},r}toSvg(e){const t=this.bbox??e,i=this.createSvgGradient(t);return this.stops.forEach(({stop:s,color:n})=>{const a=sL("stop");a.setAttribute("offset",`${s}`),a.setAttribute("stop-color",`${n}`),i.appendChild(a)}),i}},Gy=class extends nh{constructor(e,t,i=0,s){super(e,t,s),this.angle=i}createCanvasGradient(e,t,i){const{angle:n}=this,a=Vs(n+-90),r=i?.centerX??t.x+t.width*.5,o=i?.centerY??t.y+t.height*.5;return e.createConicGradient(a,r,o)}createSvgGradient(e){return eL("linearGradient")}};import{createSvgElement as rL}from"ag-charts-core";var _y=class extends nh{constructor(e,t,i=0,s){super(e,t,s),this.angle=i}getGradientPoints(e){const{angle:i}=this,s=Vs(i+90),n=Math.cos(s),a=Math.sin(s),r=e.width,o=e.height,l=e.x+r*.5,c=e.y+o*.5,h=Math.sqrt(o*o+r*r)/2,u=Math.atan2(o,r);let d;s<Math.PI/2?d=s:s<Math.PI?d=Math.PI-s:s<1.5*Math.PI?d=s-Math.PI:d=2*Math.PI-s;const p=h*Math.abs(Math.cos(d-u));return{x0:l+n*p,y0:c+a*p,x1:l-n*p,y1:c-a*p}}createCanvasGradient(e,t){const{x0:i,y0:s,x1:n,y1:a}=this.getGradientPoints(t);if(!(isNaN(i)||isNaN(s)||isNaN(n)||isNaN(a)))return e.createLinearGradient(i,s,n,a)}createSvgGradient(e){const{x0:t,y0:i,x1:s,y1:n}=this.getGradientPoints(e),a=rL("linearGradient");return a.setAttribute("x1",String(t)),a.setAttribute("y1",String(i)),a.setAttribute("x2",String(s)),a.setAttribute("y2",String(n)),a.setAttribute("gradientUnits","userSpaceOnUse"),a}};import{createSvgElement as oL}from"ag-charts-core";var lL=class extends nh{constructor(e,t,i){super(e,t,i)}createCanvasGradient(e,t,i){const s=i?.centerX??t.x+t.width*.5,n=i?.centerY??t.y+t.height*.5,a=i?.innerRadius??0,r=i?.outerRadius??Math.hypot(t.width*.5,t.height*.5)/Math.SQRT2;return e.createRadialGradient(s,n,a,s,n,r)}createSvgGradient(e){const t=e.x+e.width*.5,i=e.y+e.height*.5,s=oL("radialGradient");return s.setAttribute("cx",String(t)),s.setAttribute("cy",String(i)),s.setAttribute("r",String(Math.hypot(e.width*.5,e.height*.5)/Math.SQRT2)),s.setAttribute("gradientUnits","userSpaceOnUse"),s}};import{Logger as cL}from"ag-charts-core";import{Logger as Jd,isArray as hL,isPlainObject as uL}from"ag-charts-core";var x=_A,Q=class{handleUnknownProperties(e,t){}set(e){const{className:t=this.constructor.name}=this.constructor;if(typeof e!="object")return Jd.warn(`unable to set ${t} - expecting a properties object`),this;const i=new Set(Object.keys(e));for(const s of ua(this))if(i.has(s)){const n=e[s],a=this;if(Cr(a[s]))if(a[s]instanceof Jo){const r=a[s].reset(n);r!=null?a[s]=r:Jd.warn(`unable to set [${s}] - expecting a properties array`)}else a[s].set(n);else uL(n)?a[s]=Ko(n,a[s]??{}):a[s]=n;i.delete(s)}this.handleUnknownProperties(i,e);for(const s of i)Jd.warn(`unable to set [${s}] in ${t} - property is unknown`);return this}toJson(){return ua(this).reduce((e,t)=>{const i=this[t];return e[t]=Cr(i)?i.toJson():i,e},{})}},Jo=class tA extends Array{constructor(t,...i){super(i.length);const n=(a=>!!a?.prototype?.constructor?.name)(t)?a=>new t().set(a):t;Object.defineProperty(this,"itemFactory",{value:n,enumerable:!1,configurable:!1}),this.set(i)}set(t){if(hL(t)){this.length=t.length;for(let i=0;i<t.length;i++)this[i]=this.itemFactory(t[i])}return this}reset(t){if(Array.isArray(t))return new tA(this.itemFactory,...t)}toJson(){return this.map(t=>t?.toJson?.()??t)}};function Cr(e){return e instanceof Q||e instanceof Jo}var ep=class extends Q{constructor(){super(...arguments),this.color="black"}};f([x],ep.prototype,"stop",2),f([x],ep.prototype,"color",2);function dL(e){let t;for(const i of e)if(i?.stop!=null){if(t!=null&&i.stop<t)return!1;t=i.stop}return!0}function Hy(e){return e.flatMap((t,i)=>{const{stop:s}=t,n=e.at(i+1)?.color;return n!=null?[t,{stop:s,color:n}]:[t]})}function pL(e,t){const i=t==="discrete"?1:0,s=e.map((n,a,{length:r})=>({stop:(a+i)/(r-1+i),color:n}));return t==="discrete"?Hy(s):s}function Uy(e,t,i,s="continuous"){const n=e.map(g=>typeof g=="string"?{color:g}:g);if(n.length===0)return pL(t,s);if(!dL(n))return cL.warnOnce("[fills] must have the stops defined in ascending order"),[];const a=Math.min(...i),r=Math.max(...i),o=s==="discrete",l=new Float64Array(n.length);let c=0,h=-1;for(let g=0;g<n.length;g+=1){const y=n[g];if(g>=h){h=n.length-1;for(let m=g+1;m<n.length;m+=1)if(n[m]?.stop!=null){h=m;break}}let b=y?.stop;if(b==null){const m=n[c]?.stop,v=n[h]?.stop,M=m??a,S=v??r,D=o&&m==null?1:0;b=M+(S-M)*(g-c+D)/(h-c+D)}else c=g;l[g]=Math.max(0,Math.min(1,(b-a)/(r-a)))}let u=n.find(g=>g.color!=null)?.color,d;const p=n.map((g,y)=>{let b=g?.color;const m=l[y];return b!=null?u=b:u!=null?b=u:(d==null&&(d=new Lr,d.domain=[0,1],d.range=t),b=d.convert(m)),{stop:m,color:b}});return s==="discrete"?Hy(p):p}import{Logger as gL,createSvgElement as tp}from"ag-charts-core";var fL=class{constructor(e,t){this.imageLoader=e,this._cache=void 0,this.url=t.url,this.backgroundFill=t.backgroundFill??"black",this.backgroundFillOpacity=t.backgroundFillOpacity??1,this.repeat=t.repeat??"no-repeat",this.width=t.width,this.height=t.height,this.fit=t.fit??"stretch",this.rotation=t.rotation??0}createCanvasImage(e,t,i,s){if(!t)return null;const[n,a]=this.getSize(t.width,t.height,i,s);return n<1||a<1?(gL.warnOnce("Image fill is too small to render, ignoring."),null):e.createPattern(t,this.repeat)}getSize(e,t,i,s){const{fit:n}=this;let a=e,r=t,o=1;const l=i/s,c=e/t;return n==="stretch"||e===0||t===0?(a=i,r=s):n==="contain"?o=c>l?i/e:s/t:n==="cover"&&(o=c>l?s/t:i/e),[Math.max(1,a*o),Math.max(1,r*o)]}setImageTransform(e,t){if(typeof e=="string")return;const{url:i,rotation:s,width:n,height:a}=this,r=this.imageLoader?.loadImage(i);if(!r)return;const o=Vs(s),l=Math.cos(o),c=Math.sin(o),[h,u]=this.getSize(r.width,r.height,n??t.width,a??t.height),d=h/r.width,p=u/r.height,g=t.x+t.width/2,y=t.y+t.height/2,b=l*h-c*u,m=c*h+l*u,v=b/2,M=m/2;e?.setTransform(new DOMMatrix([l*d,c*p,-c*d,l*p,g-v,y-M]))}createPattern(e,t,i,s){const n=this.width??t,a=this.height??i,r=this._cache;if(r!=null&&r.ctx===e&&r.width===n&&r.height===a)return r.pattern;const o=this.imageLoader?.loadImage(this.url,s),l=this.createCanvasImage(e,o,n,a);return l==null?this.backgroundFill:(this._cache={ctx:e,pattern:l,width:n,height:a},l)}toSvg(e,t){const{url:i,rotation:s,backgroundFill:n,backgroundFillOpacity:a}=this,{x:r,y:o,width:l,height:c}=e,h=tp("pattern");h.setAttribute("viewBox",`0 0 ${l} ${c}`),h.setAttribute("x",String(r)),h.setAttribute("y",String(o)),h.setAttribute("width",String(l)),h.setAttribute("height",String(c)),h.setAttribute("patternUnits","userSpaceOnUse");const u=tp("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(l)),u.setAttribute("height",String(c)),u.setAttribute("fill",n),u.setAttribute("fill-opacity",String(a)),h.appendChild(u);const d=tp("image");return d.setAttribute("href",i),d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(l)),d.setAttribute("height",String(c)),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("transform",`scale(${1/t}) rotate(${s}, ${l/2}, ${c/2})`),h.appendChild(d),h}};import{Logger as mL,createSvgElement as ip}from"ag-charts-core";function Wy(e,t,i,s){const n=e-i,a=t-s;return n*n+a*a}function ah(e,t,i,s,n,a,r){if(i===n&&s===a)return Math.min(r,Wy(e,t,i,s));const o=n-i,l=a-s,c=Math.max(0,Math.min(1,((e-i)*o+(t-s)*l)/(o*o+l*l))),h=i+c*o,u=s+c*l;return Math.min(r,Wy(e,t,h,u))}import{Logger as Yy}from"ag-charts-core";var yL=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,Re=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,bL=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,$y=/^[01]/,xL={z:[],h:[Re],v:[Re],m:[Re,Re],l:[Re,Re],t:[Re,Re],s:[Re,Re,Re,Re],q:[Re,Re,Re,Re],c:[Re,Re,Re,Re,Re,Re],a:[Re,Re,Re,$y,$y,Re,Re]};function vL(e){if(!e)return;const t=[];let i=0,s;for(;i<e.length;){const n=yL.exec(e.slice(i));let a;if(n==null){if(!s){Yy.warnOnce(`Invalid SVG path, error at index ${i}: Missing command.`);return}a=s}else a=n[1],i+=n[0].length;const r=ML(a,e,i);if(!r)return;i=r[0],s=a,t.push(r[1])}return t}function ML(e,t,i){const s=xL[e.toLocaleLowerCase()],n={command:e,params:[]};for(const a of s){const r=t.slice(i),o=a.exec(r);if(o!=null){n.params.push(parseFloat(o[0])),i+=o[0].length;const l=bL.exec(r.slice(o[0].length));l!=null&&(i+=l[0].length)}else{if(n.params.length===1)return[i,n];Yy.warnOnce(`Invalid SVG path, error at index ${i}: No path segment parameters for command [${e}]`);return}}return[i,n]}function SL(e,t){const i=-t/e;return e!==0&&i>=0&&i<=1?[i]:[]}function DL(e,t,i,s=1e-6){if(Math.abs(e)<s)return SL(t,i);const n=t*t-4*e*i,a=[];if(Math.abs(n)<s){const r=-t/(2*e);r>=0&&r<=1&&a.push(r)}else if(n>0){const r=Math.sqrt(n),o=(-t-r)/(2*e),l=(-t+r)/(2*e);o>=0&&o<=1&&a.push(o),l>=0&&l<=1&&a.push(l)}return a}function IL(e,t,i,s,n=1e-6){if(Math.abs(e)<n)return DL(t,i,s,n);const a=t/e,r=i/e,o=s/e,l=(3*r-a*a)/9,c=(9*a*r-27*o-2*a*a*a)/54,h=l*l*l+c*c,u=1/3,d=[];if(h>=0){const p=Math.sqrt(h),g=Math.sign(c+p)*Math.pow(Math.abs(c+p),u),y=Math.sign(c-p)*Math.pow(Math.abs(c-p),u),b=Math.abs(Math.sqrt(3)*(g-y)/2),m=-u*a+(g+y);if(m>=0&&m<=1&&d.push(m),Math.abs(b)<n){const v=-u*a-(g+y)/2;v>=0&&v<=1&&d.push(v)}}else{const p=Math.acos(c/Math.sqrt(-l*l*l)),g=u*a,y=2*Math.sqrt(-l),b=y*Math.cos(u*p)-g,m=y*Math.cos(u*(p+2*Math.PI))-g,v=y*Math.cos(u*(p+4*Math.PI))-g;b>=0&&b<=1&&d.push(b),m>=0&&m<=1&&d.push(m),v>=0&&v<=1&&d.push(v)}return d}function el(e,t,i,s,n,a,r,o){const l=(i-e)*(o-a)-(s-t)*(r-n);if(l===0)return 0;const c=((r-n)*(t-a)-(e-n)*(o-a))/l,h=((i-e)*(t-a)-(s-t)*(e-n))/l;return c>=0&&c<=1&&h>=0&&h<=1?1:0}function AL(e,t,i,s,n,a,r,o,l,c,h,u){let d=0;const p=c-u,g=h-l,y=l*(u-c)-c*(h-l),b=Ky(e,i,n,r),m=Ky(t,s,a,o),v=p*b[0]+g*m[0],M=p*b[1]+g*m[1],S=p*b[2]+g*m[2],D=p*b[3]+g*m[3]+y,A=IL(v,M,S,D);for(const I of A){const L=I*I,C=I*L,k=b[0]*C+b[1]*L+b[2]*I+b[3],w=m[0]*C+m[1]*L+m[2]*I+m[3];let E;l===h?E=(w-c)/(u-c):E=(k-l)/(h-l),E>=0&&E<=1&&d++}return d}function Ky(e,t,i,s){return[-e+3*t-3*i+s,3*e-6*t+3*i,-3*e+3*t,e]}import{insertListItemsSorted as LL}from"ag-charts-core";function kr(e,t,i,s,n){return(1-n)**3*e+3*(1-n)**2*n*t+3*(1-n)*n**2*i+n**3*s}function rh(e,t,i,s,n){if(n<=Math.min(e,s))return e<s?0:1;if(n>=Math.max(e,s))return e<s?1:0;let a=0,r=1,o=NaN;for(let l=0;l<12;l+=1)o=(a+r)/2,kr(e,t,i,s,o)<n?a=o:r=o;return o}function tl(e,t,i,s,n,a,r,o,l){const c=(1-l)*e+l*i,h=(1-l)*t+l*s,u=(1-l)*i+l*n,d=(1-l)*s+l*a,p=(1-l)*n+l*r,g=(1-l)*a+l*o,y=(1-l)*c+l*u,b=(1-l)*h+l*d,m=(1-l)*u+l*p,v=(1-l)*d+l*g,M=(1-l)*y+l*m,S=(1-l)*b+l*v;return[[{x:e,y:t},{x:c,y:h},{x:y,y:b},{x:M,y:S}],[{x:M,y:S},{x:m,y:v},{x:p,y:g},{x:r,y:o}]]}function Zy(e,t,i,s){const n=-e+3*t-3*i+s,a=2*(e-2*t+i),r=-e+t;if(n===0){if(a!==0){const l=-r/a;if(l>0&&l<1)return[l]}return[]}const o=a*a-4*n*r;if(o>=0){const l=Math.sqrt(o),c=(-a+l)/(2*n),h=(-a-l)/(2*n);return[c,h].filter(u=>u>0&&u<1)}return[]}function Xy(e,t,i,s,n,a,r,o){const l=Zy(e,i,n,r),c=Zy(t,s,a,o);return[...l,...c]}function sp(e,t,i){const s=kr(e[0].x,e[1].x,e[2].x,e[3].x,.5),n=kr(e[0].y,e[1].y,e[2].y,e[3].y,.5),a=Math.hypot(s-t,n-i),r=Math.min(Math.hypot(e[0].x-t,e[0].y-i),Math.hypot(e[1].x-t,e[1].y-i),Math.hypot(e[2].x-t,e[2].y-i),Math.hypot(e[3].x-t,e[3].y-i));return{points:e,distance:a,minDistance:r}}function qy(e,t,i,s,n,a,r,o,l,c,h=1){let d={value:sp([{x:e,y:t},{x:i,y:s},{x:n,y:a},{x:r,y:o}],l,c),next:null},p;for(;d!=null;){const{points:g,distance:y,minDistance:b}=d.value;if(d=d.next,(p==null||y<p.distance)&&(p={distance:y,minDistance:b}),p!=null&&p.distance-b<=h)continue;const[m,v]=tl(g[0].x,g[0].y,g[1].x,g[1].y,g[2].x,g[2].y,g[3].x,g[3].y,.5),M=[sp(m,l,c),sp(v,l,c)].sort(Qy);d=LL(d,M,Qy)}return p?.distance??1/0}var Qy=(e,t)=>t.minDistance-e.minDistance,wr=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.cx=NaN,this.cy=NaN,this.sx=NaN,this.sy=NaN,this.openedPath=!1,this.closedPath=!1}isEmpty(){return this.commands.length===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commands.length||this.previousParams.length!==this.params.length||this.previousCommands.toString()!==this.commands.toString()||this.previousParams.toString()!==this.params.toString()}getPath2D(){return this.path2d}moveTo(e,t){this.openedPath=!0,this.sx=e,this.sy=t,this.cx=e,this.cy=t,this.path2d.moveTo(e,t),this.commands.push(0),this.params.push(e,t)}lineTo(e,t){this.openedPath?(this.cx=e,this.cy=t,this.path2d.lineTo(e,t),this.commands.push(1),this.params.push(e,t)):this.moveTo(e,t)}cubicCurveTo(e,t,i,s,n,a){this.openedPath||this.moveTo(e,t),this.path2d.bezierCurveTo(e,t,i,s,n,a),this.commands.push(2),this.params.push(e,t,i,s,n,a)}closePath(){this.openedPath&&(this.cx=this.sx,this.cy=this.sy,this.sx=NaN,this.sy=NaN,this.path2d.closePath(),this.commands.push(3),this.openedPath=!1,this.closedPath=!0)}rect(e,t,i,s){this.moveTo(e,t),this.lineTo(e+i,t),this.lineTo(e+i,t+s),this.lineTo(e,t+s),this.closePath()}roundRect(e,t,i,s,n){n=Math.min(n,i/2,s/2),this.moveTo(e,t+n),this.arc(e+n,t+n,n,Math.PI,1.5*Math.PI),this.lineTo(e+n,t),this.lineTo(e+i-n,t),this.arc(e+i-n,t+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(e+i,t+n),this.lineTo(e+i,t+s-n),this.arc(e+i-n,t+s-n,n,0,Math.PI/2),this.lineTo(e+i-n,t+s),this.lineTo(e+n,t+s),this.arc(e+ +n,t+s-n,n,Math.PI/2,Math.PI),this.lineTo(e,t+s-n),this.closePath()}ellipse(e,t,i,s,n,a,r,o=!1){const l=i,c=s/i,h=Math.cos(n),u=Math.sin(n),d=-c*u,p=c*h,g=l*Math.cos(a),y=l*Math.sin(a),b=e+h*g+d*y,m=t+u*g+p*y,v=(b-this.cx)**2+(m-this.cy)**2;this.openedPath?v>1e-6&&this.lineTo(b,m):this.moveTo(b,m);let M=o?-et(a-r):et(r-a);Math.abs(Math.abs(r-a)-2*Math.PI)<1e-6&&M<2*Math.PI&&(M+=2*Math.PI*(o?-1:1));const S=Math.max(Math.ceil(Math.abs(M)/(Math.PI/2)),1),D=M/S,A=4/3*Math.tan(D/4);for(let I=0;I<S;I+=1){const L=a+D*(I+0),C=a+D*(I+1),k=l*Math.sin(L),w=l*Math.cos(L),E=l*Math.sin(C),T=l*Math.cos(C),V=w-A*k,$=k+A*w,q=T+A*E,he=E-A*T,ne=T,ce=E;this.cubicCurveTo(e+h*V+d*$,t+u*V+p*$,e+h*q+d*he,t+u*q+p*he,e+h*ne+d*ce,t+u*ne+p*ce)}}arc(e,t,i,s,n,a){this.ellipse(e,t,i,i,0,s,n,a)}appendSvg(e){const t=vL(e);if(t==null)return!1;let i=0,s=0,n,a,r=0,o=0;for(const{command:l,params:c}of t){n??(n=c[0]),a??(a=c[1]);const h=l===l.toLowerCase(),u=h?n:0,d=h?a:0;switch(l.toLowerCase()){case"m":this.moveTo(u+c[0],d+c[1]),n=u+c[0],a=d+c[1],i=n,s=a;break;case"c":this.cubicCurveTo(u+c[0],d+c[1],u+c[2],d+c[3],u+c[4],d+c[5]),r=u+c[2],o=d+c[3],n=u+c[4],a=d+c[5];break;case"s":this.cubicCurveTo(n+n-r,a+a-o,u+c[0],d+c[1],u+c[2],d+c[3]),r=u+c[0],o=d+c[1],n=u+c[2],a=d+c[3];break;case"q":this.cubicCurveTo((u+2*c[0])/3,(d+2*c[1])/3,(2*c[0]+c[2])/3,(2*c[1]+c[3])/3,c[2],c[3]),r=c[0],o=c[1],n=c[2],a=c[3];break;case"t":this.cubicCurveTo((n+2*(n+n-r))/3,(a+2*(a+a-o))/3,(2*(n+n-r)+c[0])/3,(2*(a+a-o)+c[1])/3,c[0],c[1]),r=n+n-r,o=a+a-o,n=c[0],a=c[1];break;case"a":this.svgEllipse(n,a,c[0],c[1],c[2]*Math.PI/180,c[3],c[4],u+c[5],d+c[6]),n=u+c[5],a=d+c[6];break;case"h":this.lineTo(u+c[0],a),n=u+c[0];break;case"l":this.lineTo(u+c[0],d+c[1]),n=u+c[0],a=d+c[1];break;case"v":this.lineTo(n,d+c[0]),a=d+c[0];break;case"z":this.closePath(),n=i,a=s;break;default:throw new Error(`Could not translate command '${l}' with '${c.join(" ")}'`)}}return!0}svgEllipse(e,t,i,s,n,a,r,o,l){i=Math.abs(i),s=Math.abs(s);const c=(e-o)/2,h=(t-l)/2,u=Math.sin(n),d=Math.cos(n),p=d*c+u*h,g=-u*c+d*h,y=p/i,b=g/s;let m=y*y+b*b,v=(e+o)/2,M=(t+l)/2,S=0,D=0;m>=1?(m=Math.sqrt(m),i*=m,s*=m):(m=Math.sqrt(1/m-1),a===r&&(m=-m),S=m*i*b,D=-m*s*y,v+=d*S-u*D,M+=u*S+d*D);const A=Math.atan2((g-D)/s,(p-S)/i),I=Math.atan2((-g-D)/s,(-p-S)/i)-A,L=A+I,C=!!(1-r);this.ellipse(v,M,i,s,n,A,L,C)}clear(e){e&&(this.previousCommands=this.commands,this.previousParams=this.params,this.previousClosedPath=this.closedPath),this.path2d=new Path2D,this.openedPath=!1,this.closedPath=!1,this.commands=[],this.params=[]}isPointInPath(e,t){const i=this.commands,s=this.params,n=i.length,a=-1e4,r=-1e4;let o=NaN,l=NaN,c=0,h=0,u=0;for(let d=0,p=0;d<n;d++)switch(i[d]){case 0:u+=el(o,l,c,h,a,r,e,t),c=s[p++],o=c,h=s[p++],l=h;break;case 1:u+=el(c,h,s[p++],s[p++],a,r,e,t),c=s[p-2],h=s[p-1];break;case 2:u+=AL(c,h,s[p++],s[p++],s[p++],s[p++],s[p++],s[p++],a,r,e,t),c=s[p-2],h=s[p-1];break;case 3:u+=el(o,l,c,h,a,r,e,t);break}return u%2===1}distanceSquared(e,t){let i=1/0;const s=this.commands,n=this.params,a=s.length;let r=NaN,o=NaN,l=0,c=0;for(let h=0,u=0;h<a;h++)switch(s[h]){case 0:l=r=n[u++],c=o=n[u++];break;case 1:{const v=l,M=c;l=n[u++],c=n[u++],i=ah(e,t,v,M,l,c,i);break}case 2:const d=l,p=c,g=n[u++],y=n[u++],b=n[u++],m=n[u++];l=n[u++],c=n[u++],i=qy(d,p,g,y,b,m,l,c,e,t)**2;break;case 3:i=ah(e,t,l,c,r,o,i);break}return i}toSVG(e=(t,i)=>({x:t,y:i})){const t=[],{commands:i,params:s}=this,n=(r,o)=>{t.push(r);for(let l=0;l<o;l+=2){const{x:c,y:h}=e(s[a++],s[a++]);t.push(c,h)}};let a=0;for(const r of i)switch(r){case 0:n("M",2);break;case 1:n("L",2);break;case 2:n("C",6);break;case 3:n("Z",0);break}return t.join(" ")}computeBBox(){const{commands:e,params:t}=this;let[i,s,n,a]=[1/0,1/0,-1/0,-1/0],[r,o]=[NaN,NaN],[l,c]=[NaN,NaN];const h=(d,p)=>{i=Math.min(p,i),s=Math.min(d,s),n=Math.max(d,n),a=Math.max(p,a),r=d,o=p};let u=0;for(const d of e)switch(d){case 0:h(t[u++],t[u++]),l=r,c=o;break;case 1:h(t[u++],t[u++]);break;case 2:{const p=r,g=o,y=t[u++],b=t[u++],m=t[u++],v=t[u++],M=t[u++],S=t[u++];Xy(p,g,y,b,m,v,M,S).forEach(A=>{const I=kr(p,y,m,M,A),L=kr(g,b,v,S,A);h(I,L)}),h(M,S);break}case 3:h(l,c),l=NaN,c=NaN;break}return new z(s,i,n-s,a-i)}};function ft(e,t,i){const s=Math.round(t*e)/e;return i==null?s:i===0?0:i<1?Math.ceil(i*e)/e:Math.round((i+t)*e)/e-s}function Jy(e,t){return Math.floor(t*e)/e}function np(e,t,i){const{width:s,height:n,padding:a,strokeWidth:r}=t,o=s/2,l=n/2,c=Math.max(1,s-a-r/2),h=Math.max(1,n-a-r/2);let u=!1;for(const[d,p]of i){const g=o+(d-.5)*c,y=l+(p-.5)*h;u?e.lineTo(g,y):e.moveTo(g,y),u=!0}e.closePath()}var eb={circles(e,{width:t,strokeWidth:i,padding:s}){const n=t/2,a=Math.max(1,n-s-i/2);e.arc(n,n,a,0,Math.PI*2)},squares(e,{width:t,height:i,pixelRatio:s,padding:n,strokeWidth:a}){const r=n+a/2;e.moveTo(ft(s,r),ft(s,r)),e.lineTo(ft(s,t-r),ft(s,r)),e.lineTo(ft(s,t-r),ft(s,i-r)),e.lineTo(ft(s,r),ft(s,i-r)),e.closePath()},triangles(e,t){np(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){np(e,t,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(e,{width:t,height:i,padding:s}){const a=Math.max(1,(t-s)/2),r=a/2,o=Math.PI/2;for(let l=0;l<5*2;l++){const c=l%2===0?a:r,h=l*Math.PI/5-o,u=t/2+Math.cos(h)*c,d=i/2+Math.sin(h)*c;e.lineTo(u,d)}e.closePath()},hearts(e,{width:t,height:i,padding:s}){const n=Math.max(1,t/4-s/2),a=t/2,r=i/2+n/2;e.arc(a-n,r-n,n,at(130),at(330)),e.arc(a+n,r-n,n,at(220),at(50)),e.lineTo(a,r+n),e.closePath()},crosses(e,t){np(e,t,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},"vertical-lines"(e,{width:t,height:i,pixelRatio:s,strokeWidth:n}){const a=ft(s,t/2)-n%2/2;e.moveTo(a,0),e.lineTo(a,i)},"horizontal-lines"(e,{width:t,height:i,pixelRatio:s,strokeWidth:n}){const a=ft(s,i/2)-n%2/2;e.moveTo(0,a),e.lineTo(t,a)},"forward-slanted-lines"(e,{width:t,height:i,strokeWidth:s}){const n=Math.atan2(i,t),a=s*Math.cos(n),r=s*Math.sin(n);e.moveTo(-a,r),e.lineTo(a,-r),e.moveTo(-a,i+r),e.lineTo(t+a,-r),e.moveTo(t-a,i+r),e.lineTo(t+a,i-r)},"backward-slanted-lines"(e,{width:t,height:i,strokeWidth:s}){const n=Math.atan2(i,t),a=s*Math.cos(n),r=s*Math.sin(n);e.moveTo(t-a,-r),e.lineTo(t+a,r),e.moveTo(-a,-r),e.lineTo(t+a,i+r),e.moveTo(-a,i-r),e.lineTo(a,i+r)}},CL=class{constructor(e){this._cache=void 0,this.width=Math.max(e?.width??10,1),this.height=Math.max(e?.height??10,1),this.fill=e.fill??"none",this.fillOpacity=e.fillOpacity??1,this.backgroundFill=e.backgroundFill??"none",this.backgroundFillOpacity=e.backgroundFillOpacity??1,this.stroke=e.stroke??"black",this.strokeOpacity=e.strokeOpacity??1,this.strokeWidth=e.strokeWidth??1,this.padding=e.padding??1,this.pattern=e.pattern??"forward-slanted-lines",this.rotation=e.rotation??0,this.scale=e.scale??1,this.path=e.path}getPath(e){const{pattern:t,width:i,height:s,padding:n,strokeWidth:a,path:r}=this,o=new wr;let l=eb[t]!=null;return r&&l&&(l=!o.appendSvg(r)),l&&eb[t](o,{width:i,height:s,pixelRatio:e,strokeWidth:a,padding:n}),o}renderStroke(e,t){const{stroke:i,strokeWidth:s,strokeOpacity:n}=this;s&&(t.strokeStyle=i,t.lineWidth=s,t.globalAlpha=n,t.stroke(e))}renderFill(e,t){const{fill:i,fillOpacity:s}=this;i!=="none"&&(t.fillStyle=i,t.globalAlpha=s,t.fill(e))}createCanvasPattern(e,t){const{width:i,height:s,scale:n,backgroundFill:a,backgroundFillOpacity:r}=this;if(i*n<1||s*n<1)return mL.warnOnce("Pattern fill is too small to render, ignoring."),null;const o=new Rd({width:i,height:s,pixelRatio:t*n}),l=o.context;a!=="none"&&(l.fillStyle=a,l.globalAlpha=r,l.fillRect(0,0,i,s));const c=this.getPath(t).getPath2D();this.renderFill(c,l),this.renderStroke(c,l);const h=e.createPattern(o.canvas,"repeat");return this.setPatternTransform(h,t),o.destroy(),h}setPatternTransform(e,t,i=0,s=0){if(e==null)return;const n=Vs(this.rotation),a=1/t,r=Math.cos(n)*a,o=Math.sin(n)*a;e.setTransform(new DOMMatrix([r,o,-o,r,i,s]))}createPattern(e,t){if(this._cache!=null&&this._cache.ctx===e&&this._cache.pixelRatio===t)return this._cache.pattern;const i=this.createCanvasPattern(e,t);if(i!=null)return this._cache={ctx:e,pattern:i,pixelRatio:t},i}toSvg(){const{width:e,height:t,fill:i,fillOpacity:s,backgroundFill:n,backgroundFillOpacity:a,stroke:r,strokeWidth:o,strokeOpacity:l,rotation:c,scale:h}=this,u=ip("pattern");u.setAttribute("viewBox",`0 0 ${e} ${t}`),u.setAt