ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
2 lines • 890 kB
JavaScript
var zm=Object.defineProperty,yI=Object.getOwnPropertyDescriptor,Bi=(e,t)=>{for(var i in t)zm(e,i,{get:t[i],enumerable:!0})},g=(e,t,i,s)=>{for(var n=s>1?void 0:s?yI(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&&zm(t,i,n),n};import{ModuleRegistry as gc}from"ag-charts-core";import{AsyncAwaitQueue as Fm,Logger as gn,createId as bI,entries as xI,groupBy as vI,isFiniteNumber as jm,isFunction as MI,pause as Bm}from"ag-charts-core";var fc=class{constructor(){this.destroyFns=[]}destroy(){for(const e of this.destroyFns)e()}},SI=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)}},as=new SI;import{clamp as nr}from"ag-charts-core";var Qn={containsPoint:DI,equals:II,isEmpty:AI,normalize:LI};function DI(e,t,i){return t>=e.x&&t<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function II(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function AI(e){return e==null||e.height===0||e.width===0||isNaN(e.height)||isNaN(e.width)}function LI(e){let{x:t,y:i,width:s,height:n}=e;return(s==null||s>0)&&(n==null||n>0)?e:(t!=null&&s!=null&&s<0&&(s=-s,t=t-s),i!=null&&n!=null&&n<0&&(n=-n,i=i-n),{x:t,y:i,width:s,height:n})}var mc=Symbol("interpolate"),yc=e=>e[mc]!=null;function bc(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 CI(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 So=class Mo{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 Mo(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 Mo(i,s,n-i,a-s)}static nearestBox(t,i,s){return bc(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 Mo(t,i,s,n)}equals(t){return Qn.equals(this,t)}containsPoint(t,i){return Qn.containsPoint(this,t,i)}intersection(t){if(!this.collidesBBox(t))return;const i=nr(t.x,this.x,t.x+t.width),s=nr(t.y,this.y,t.y+t.height),n=nr(t.x,this.x+this.width,t.x+t.width),a=nr(t.y,this.y+this.height,t.y+t.height);return new Mo(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-nr(this.x,t,this.x+this.width),n=i-nr(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}[mc](t,i){return new Mo(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)}};So.zero=Object.freeze(new So(0,0,0,0)),So.NaN=Object.freeze(new So(NaN,NaN,NaN,NaN));var R=So;import{clamp as kI}from"ag-charts-core";import{Logger as ad,getWindow as wI,toArray as Gm}from"ag-charts-core";var TI=2e3,_m=Date.now(),NI=()=>{const e=Date.now()-_m;if(e>TI){const t=(Math.floor(e/100)/10).toFixed(1);ad.log(`**** ${t}s since last log message ****`)}_m=Date.now()},me={create(...e){return Object.assign((...i)=>{me.check(...e)&&(typeof i[0]=="function"&&(i=Gm(i[0]())),NI(),ad.log(...i))},{check:()=>me.check(...e),group:(i,s)=>me.check(...e)?ad.logGroup(i,s):s()})},check(...e){return e.length===0&&e.push(!0),Gm(wI("agChartsDebug")).some(i=>e.includes(i))},inDevelopmentMode(e){if(me.check("dev"))return e()}};function Vm({context:e,pixelRatio:t,width:i,height:s}){e.save(),e.resetTransform(),e.clearRect(0,0,Math.ceil(i*t),Math.ceil(s*t)),e.restore()}function Um(e){if(me.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 Wm(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]=Wm(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),Um(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]=Wm(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(){Vm(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{createId as EI,createSvgElement as Ym,toIterable as OI}from"ag-charts-core";import{entries as RI,isArray as od,isObject as Hm,isPlainObject as fn}from"ag-charts-core";var ld=Symbol("BREAK"),Do="__decorator_config",xc="__decorator_accessors";function PI(e,t){cd(e,t).optional=!0}function cd(e,t){if(Object.getOwnPropertyDescriptor(e,Do)==null&&Object.defineProperty(e,Do,{value:{}}),Object.getOwnPropertyDescriptor(e,xc)==null){const h=Object.getPrototypeOf(e)?.[xc]?.slice()??[];Object.defineProperty(e,xc,{value:h})}const i=e[Do],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[xc];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===ld)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===ld)return;return c},enumerable:!0,configurable:!1}),i[s]}function Jn(e,t,i){return(s,n)=>{const a=cd(s,n);a.setters.push(e),t&&a.getters.unshift(t),i&&Object.assign(a,i)}}function $m(e){return(t,i)=>{cd(t,i).observers.push(e)}}function vc(e){return typeof e<"u"&&Do in e}function ea(e){const t=new Set;for(;vc(e);)t.add(e?.[Do]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(i=>Object.keys(i))}function Km(e){return ea(e).reduce((t,i)=>(t[i]=e[i]??null,t),{})}function Xt(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((i,s)=>Xt(i,t[s])):fn(e)?fn(t)?hd(e,t,Xt):!1:e===t}function hd(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 ce(...e){const t={};for(const i of e){if(!Hm(i))continue;const s=vc(i)?ea(i):Object.keys(i);for(const n of s)fn(t[n])&&fn(i[n])?t[n]=ce(t[n],i[n]):t[n]??(t[n]=i[n])}return t}function Io(...e){const t={};for(const i of e){if(!Hm(i))continue;const s=vc(i)?ea(i):Object.keys(i);for(const n of s)fn(t[n])&&fn(i[n])?t[n]=Io(t[n],i[n]):n in t||(t[n]??(t[n]=i[n]))}return t}function Mc(e,...t){return t&&od(e)?e.map(i=>ce(i,...t)):e}function Zm(e,t){const i={};for(const[s,n]of RI(e))i[s]=t(n,s,e);return i}function z(e,t){const i={...e};for(const s of t)delete i[s];return i}function ar(e,t){return(od(t)?t:t.split(".")).reduce((s,n)=>s[n],e)}var ud=new Set(["__proto__","constructor","prototype"]);function dd(e,t,i){const s=od(t)?t.slice():t.split("."),n=s.pop();if(s.some(r=>ud.has(r)))return;const a=s.reduce((r,o)=>r[o],e);return a[n]=i,a[n]}function pd(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 ta(e){return e==null||typeof e!="object"||!fn(e)||(Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const i=e[t];i!==null&&(typeof i=="object"||typeof i=="function")&&!Object.isFrozen(i)&&ta(i)})),e}function Xm(e,t){return fn(e)&&t in e}function zI(e,t){return Xm(e,t)&&typeof e[t]=="string"}import{arraysEqual as FI}from"ag-charts-core";var rr=(e,t)=>e===t;function T(e){return function(t,i){const s=`__${i}`;t[i]||jI(t,i,s,e)}}function gi(e){return T(e)}function gd(e){const t=e??{};return t.equals=FI,T(e)}function jI(e,t,i,s){const{changeCb:n,convertor:a,checkDirtyOnAssignment:r=!1}=s??{},o={changeCb:n,checkDirtyOnAssignment:r,convertor:a},l=_I(i,GI(BI(VI(i,o),o),o),o);Object.defineProperty(e,t,{set:l,get:function(){return this[i]},enumerable:!0,configurable:!0})}function BI(e,t){const{convertor:i}=t;return i?function(s){e.call(this,i(s))}:e}var qm=Symbol("no-change");function GI(e,t){const{changeCb:i}=t;return i?function(s){const n=e.call(this,s);return n!==qm&&i.call(this,this),n}:e}function _I(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 VI(e,t){const{equals:i=rr}=t;return function(s){const n=this[e];return i(s,n)?qm:(this[e]=s,this.onChangeDetection(e),s)}}var Qm=(e=>(e[e.All=0]="All",e[e.None=1]="None",e))(Qm||{}),Ao=class km{constructor(t){this.serialNumber=km._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=EI(this),this.pointerEvents=0,this.scene=void 0,this._dirty=!0,this.dirtyZIndex=!1,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.name=t?.name,this.tag=t?.tag??NaN,this.zIndex=t?.zIndex??0,(t?.debugDirty??km._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=Ym("svg");if(a.setAttribute("width",String(i)),a.setAttribute("height",String(s)),a.setAttribute("viewBox",`0 0 ${i} ${s}`),n.defs?.length){const r=Ym("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}get dirty(){return this._dirty}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}preRender(t,i=1){this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i;for(const s of this.children()){const n=s.preRender(t);this.childNodeCounts.groups+=n.groups,this.childNodeCounts.nonGroups+=n.nonGroups,this.childNodeCounts.complexity+=n.complexity}return this.childNodeCounts}render(t){const{stats:i}=t;if(this._dirty=!1,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,this._debug=t?.layersManager?.debug;for(const i of this.children())i.setScene(t)}sortChildren(t){if(this.dirtyZIndex=!1,!this.childNodes)return;const i=[...this.childNodes].sort(t);this.childNodes.clear();for(const s of i)this.childNodes.add(s)}*traverseUp(t){let i=this;for(t&&(yield i);i=i.parentNode;)yield i}*children(){if(this.childNodes)for(const t of this.childNodes)yield t}*descendants(){for(const t of this.children())yield t,yield*t.descendants()}isLeaf(){return!this.childNodes?.size}isRoot(){return!this.parentNode}append(t){this.childNodes??(this.childNodes=new Set);for(const i of OI(t))i.parentNode?.removeChild(i),this.childNodes.add(i),i.parentNode=this,i.setScene(this.scene);this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty()}appendChild(t){return this.append(t),t}removeChild(t){if(!this.childNodes?.delete(t))throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`);delete t.parentNode,t.setScene(),this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty()}remove(){this.parentNode?.removeChild(this)}clear(){for(const t of this.children())delete t.parentNode,t.setScene();this.childNodes?.clear(),this.invalidateCachedBBox()}destroy(){this.parentNode?.removeChild(this)}setProperties(t,i){if(i)for(const s of i)this[s]=t[s];else Object.assign(this,t);return this}containsPoint(t,i){return!1}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))){if(this.childNodes!=null&&this.childNodes.size!==0){const s=[...this.children()];for(let n=s.length-1;n>=0;n--){const a=s[n].pickNode(t,i);if(a)return a}}else if(!this.isContainerNode)return this}}pickNodes(t,i,s=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return s;this.isContainerNode||s.push(this);for(const n of this.children())n.pickNodes(t,i,s);return s}invalidateCachedBBox(){this.cachedBBox!=null&&(this.cachedBBox=void 0,this.parentNode?.invalidateCachedBBox())}getBBox(){return this.cachedBBox==null&&(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirty(t){const{_dirty:i}=this;t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),!(this.cachedBBox==null&&i)&&(this.invalidateCachedBBox(),this._dirty=!0,this.parentNode&&this.parentNode.markDirty())}markClean(){if(this._dirty){this._dirty=!1,this.debugDirtyProperties();for(const t of this.children())t.markClean()}}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(){const{parentNode:t}=this;t&&(t.dirtyZIndex=!0)}toSVG(){}};Ao._nextSerialNumber=0,Ao._debugEnabled=!1,g([T()],Ao.prototype,"visible",2),g([gi({equals:Xt,changeCb:e=>e.onZIndexChange()})],Ao.prototype,"zIndex",2);var ws=Ao;import{clamp as UI,generateUUID as fd}from"ag-charts-core";import{createSvgElement as WI}from"ag-charts-core";var Ii=Math.PI*2,Lo=Math.PI/2;function Xe(e){return e%=Ii,e+=Ii,e%=Ii,e}function YI(e){return e%=Ii,e+=Ii,e!==Ii&&(e%=Ii),e}function Co(e){return e%=Ii,e<-Math.PI?e+=Ii:e>=Math.PI&&(e-=Ii),e}function mn(e,t,i){const s=Xe(e),n=Xe(t),a=Xe(i);return n<a?n<=s&&s<=a:n>a?n<=s||s<=a:!0}function nt(e){return e/180*Math.PI}function HI(e){return e/Math.PI*180}function Sc(e,t){return e=Xe(e),t=Xe(t),t-e+(e>t?Ii:0)}function Jm(e){const t=Xe(e);return t<=Lo?t/Lo:t<=Math.PI?(Math.PI-t)/Lo:t<=1.5*Math.PI?(t-Math.PI)/Lo:(Ii-t)/Lo}function md(e,t,i){const s=Jm(i);return e*s+t*Math.abs(1-s)}function Ts(e){return e?Xe(nt(e)):0}import{createSvgElement as $I}from"ag-charts-core";import{Logger as yd,clamp as KI}from"ag-charts-core";import{clamp as Ns}from"ag-charts-core";var ia=(e,t,i)=>e*(1-i)+t*i,bd=e=>{const t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4},xd=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},ey=class ve{constructor(t,i,s,n=1){this.r=Ns(0,t||0,1),this.g=Ns(0,i||0,1),this.b=Ns(0,s||0,1),this.a=Ns(0,n||0,1)}static validColorString(t){return t.indexOf("#")>=0?!!ve.parseHex(t):t.indexOf("rgb")>=0?!!ve.stringToRgba(t):ve.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.indexOf("#")>=0)return ve.fromHexString(t);const i=ve.nameToHex.get(t.toLowerCase());if(i)return ve.fromHexString(i);if(t.indexOf("rgb")>=0)return ve.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=ve.parseHex(t);if(i){const[s,n,a,r]=i;return new ve(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=Ns(0,c,100),c/=100):o===3?c=Ns(0,c,1):(c=Ns(0,c,255),c/=255),r.push(c)}return r}static fromRgbaString(t){const i=ve.stringToRgba(t);if(i){if(i.length===3)return new ve(i[0],i[1],i[2]);if(i.length===4)return new ve(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 ve(t[0],t[1],t[2],t[3]);if(t.length===3)return new ve(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=ve.HSBtoRGB(t,i,s);return new ve(a[0],a[1],a[2],n)}static fromHSL(t,i,s,n=1){const a=ve.HSLtoRGB(t,i,s);return new ve(a[0],a[1],a[2],n)}static fromOKLCH(t,i,s,n=1){const a=ve.OKLCHtoRGB(t,i,s);return new ve(a[0],a[1],a[2],n)}static padHex(t){return t.length===1?"0"+t:t}toHexString(){let t="#"+ve.padHex(Math.round(this.r*255).toString(16))+ve.padHex(Math.round(this.g*255).toString(16))+ve.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(t+=ve.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 ve.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(t,i,s){const n=bd(t),a=bd(i),r=bd(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,f=h,y=Math.hypot(u,d),b=p>=0?p:p+360;return[f,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=xd(h),f=xd(u),y=xd(d);return[p,f,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 ve(ia(t.r,i.r,s),ia(t.g,i.g,s),ia(t.b,i.b,s),ia(t.a,i.a,s))}static lighten(t,i){const s=ve.RGBtoOKLCH(t.r,t.g,t.b);return ve.fromOKLCH(Ns(0,s[0]+i,1),s[1],s[2])}static darken(t,i){const s=ve.RGBtoOKLCH(t.r,t.g,t.b);return ve.fromOKLCH(Ns(0,s[0]-i,1),s[1],s[2])}static interpolate(t,i){const s=1/(t.length-1),n=t.map(a=>ve.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 ve.fromOKLCH(ia(h[0],u[0],c),ia(h[1],u[1],c),ia(h[2],u[2],c))})}};ey.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 Me=ey,Dc=class{ticks(e,t,i){}niceDomain(e,t=this.domain){return t}tickFormatter(e){}datumFormatter(e){}get bandwidth(){}get step(){}get inset(){}},ko=(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})},ty=e=>{const t=Me.fromString(e),[i,s,n]=Me.RGBtoOKLCH(t.r,t.g,t.b);return{l:i,c:s,h:n,a:t.a}},vd=1e-6,iy=e=>e.c<vd||e.l<vd||e.l>1-vd,ZI=(e,t,i)=>{i=KI(0,i,1);let s;if(iy(e))s=t.h;else if(iy(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 Me.fromOKLCH(a,n,s,r)},or=class extends Dc{constructor(){super(...arguments),this.type="color",this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(ty)}update(){const{domain:e,range:t}=this;e.length<2&&(yd.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){yd.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(ty)}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 ZI(h,u,c).toRgbaString()}invert(){}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&yd.warnOnce("Expected update to not invalidate scale"))}};g([ko],or.prototype,"domain",2),g([ko],or.prototype,"range",2);var Ic=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(isNaN(s.x)||isNaN(s.y))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 or;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=$I("stop");a.setAttribute("offset",`${s}`),a.setAttribute("stop-color",`${n}`),i.appendChild(a)}),i}},sy=class extends Ic{constructor(e,t,i=0,s){super(e,t,s),this.angle=i}createCanvasGradient(e,t,i){const{angle:n}=this,a=Ts(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 WI("linearGradient")}};import{createSvgElement as XI}from"ag-charts-core";var ny=class extends Ic{constructor(e,t,i=0,s){super(e,t,s),this.angle=i}getGradientPoints(e){const{angle:i}=this,s=Ts(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=XI("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 qI}from"ag-charts-core";var QI=class extends Ic{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=qI("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 JI}from"ag-charts-core";import{Logger as Md,isArray as eA,isPlainObject as tA}from"ag-charts-core";var x=PI,q=class{handleUnknownProperties(e,t){}set(e){const{className:t=this.constructor.name}=this.constructor;if(typeof e!="object")return Md.warn(`unable to set ${t} - expecting a properties object`),this;const i=new Set(Object.keys(e));for(const s of ea(this))if(i.has(s)){const n=e[s],a=this;if(lr(a[s]))if(a[s]instanceof wo){const r=a[s].reset(n);r!=null?a[s]=r:Md.warn(`unable to set [${s}] - expecting a properties array`)}else a[s].set(n);else tA(n)?a[s]=Io(n,a[s]??{}):a[s]=n;i.delete(s)}this.handleUnknownProperties(i,e);for(const s of i)Md.warn(`unable to set [${s}] in ${t} - property is unknown`);return this}toJson(){return ea(this).reduce((e,t)=>{const i=this[t];return e[t]=lr(i)?i.toJson():i,e},{})}},wo=class qD 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(eA(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 qD(this.itemFactory,...t)}toJson(){return this.map(t=>t?.toJson?.()??t)}};function lr(e){return e instanceof q||e instanceof wo}var Sd=class extends q{constructor(){super(...arguments),this.color="black"}};g([x],Sd.prototype,"stop",2),g([x],Sd.prototype,"color",2);function iA(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 ay(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 sA(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"?ay(s):s}function ry(e,t,i,s="continuous"){const n=e.map(f=>typeof f=="string"?{color:f}:f);if(n.length===0)return sA(t,s);if(!iA(n))return JI.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 f=0;f<n.length;f+=1){const y=n[f];if(f>=h){h=n.length-1;for(let m=f+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)*(f-c+D)/(h-c+D)}else c=f;l[f]=Math.max(0,Math.min(1,(b-a)/(r-a)))}let u=n.find(f=>f.color!=null)?.color,d;const p=n.map((f,y)=>{let b=f?.color;const m=l[y];return b!=null?u=b:u!=null?b=u:(d==null&&(d=new or,d.domain=[0,1],d.range=t),b=d.convert(m)),{stop:m,color:b}});return s==="discrete"?ay(p):p}import{Logger as nA,createSvgElement as Dd}from"ag-charts-core";var aA=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?(nA.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=Ts(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,f=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,f-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=Dd("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=Dd("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=Dd("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 rA,createSvgElement as Id}from"ag-charts-core";import{Logger as oy}from"ag-charts-core";var oA=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,Ne=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,lA=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,ly=/^[01]/,cA={z:[],h:[Ne],v:[Ne],m:[Ne,Ne],l:[Ne,Ne],t:[Ne,Ne],s:[Ne,Ne,Ne,Ne],q:[Ne,Ne,Ne,Ne],c:[Ne,Ne,Ne,Ne,Ne,Ne],a:[Ne,Ne,Ne,ly,ly,Ne,Ne]};function hA(e){if(!e)return;const t=[];let i=0,s;for(;i<e.length;){const n=oA.exec(e.slice(i));let a;if(n==null){if(!s){oy.warnOnce(`Invalid SVG path, error at index ${i}: Missing command.`);return}a=s}else a=n[1],i+=n[0].length;const r=uA(a,e,i);if(!r)return;i=r[0],s=a,t.push(r[1])}return t}function uA(e,t,i){const s=cA[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=lA.exec(r.slice(o[0].length));l!=null&&(i+=l[0].length)}else{if(n.params.length===1)return[i,n];oy.warnOnce(`Invalid SVG path, error at index ${i}: No path segment parameters for command [${e}]`);return}}return[i,n]}import{Logger as dA}from"ag-charts-core";function To(e,t,i,s){const n=e-i,a=t-s;return n*n+a*a}function No(e,t,i,s,n,a,r){if(i===n&&s===a)return Math.min(r,To(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,To(e,t,h,u))}function pA(e,t,i,s,n,a,r,o,l){o&&([r,a]=[a,r]);const c=Math.atan2(t-s,e-i);if(!mn(c,a,r)){const u=i+Math.cos(a)*n,d=s+Math.sin(a)*n,p=i+Math.cos(a)*n,f=s+Math.sin(a)*n;return Math.min(l,To(e,t,u,d),To(e,t,p,f))}const h=n-Math.sqrt(To(e,t,i,s));return Math.min(l,h*h)}function gA(e,t){const i=-t/e;return e!==0&&i>=0&&i<=1?[i]:[]}function fA(e,t,i){if(e===0)return gA(t,i);const s=t*t-4*e*i,n=[];if(s===0){const a=-t/(2*e);a>=0&&a<=1&&n.push(a)}else if(s>0){const a=Math.sqrt(s),r=(-t-a)/(2*e),o=(-t+a)/(2*e);r>=0&&r<=1&&n.push(r),o>=0&&o<=1&&n.push(o)}return n}function mA(e,t,i,s){if(e===0)return fA(t,i,s);const n=t/e,a=i/e,r=s/e,o=(3*a-n*n)/9,l=(9*n*a-27*r-2*n*n*n)/54,c=o*o*o+l*l,h=1/3,u=[];if(c>=0){const d=Math.sqrt(c),p=Math.sign(l+d)*Math.pow(Math.abs(l+d),h),f=Math.sign(l-d)*Math.pow(Math.abs(l-d),h),y=Math.abs(Math.sqrt(3)*(p-f)/2),b=-h*n+(p+f);if(b>=0&&b<=1&&u.push(b),y===0){const m=-h*n-(p+f)/2;m>=0&&m<=1&&u.push(m)}}else{const d=Math.acos(l/Math.sqrt(-o*o*o)),p=h*n,f=2*Math.sqrt(-o),y=f*Math.cos(h*d)-p,b=f*Math.cos(h*(d+2*Math.PI))-p,m=f*Math.cos(h*(d+4*Math.PI))-p;y>=0&&y<=1&&u.push(y),b>=0&&b<=1&&u.push(b),m>=0&&m<=1&&u.push(m)}return u}function cr(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 yA(e,t,i,s,n,a,r,o,l,c,h,u){let d=0;const p=c-u,f=h-l,y=l*(u-c)-c*(h-l),b=cy(e,i,n,r),m=cy(t,s,a,o),v=p*b[0]+f*m[0],M=p*b[1]+f*m[1],S=p*b[2]+f*m[2],D=p*b[3]+f*m[3]+y,L=mA(v,M,S,D);for(const A of L){const I=A*A,C=A*I,k=b[0]*C+b[1]*I+b[2]*A+b[3],w=m[0]*C+m[1]*I+m[2]*A+m[3];let E;l===h?E=(w-c)/(u-c):E=(k-l)/(h-l),E>=0&&E<=1&&d++}return d}function cy(e,t,i,s){return[-e+3*t-3*i+s,3*e-6*t+3*i,-3*e+3*t,e]}function hy(e,t,i,s,n,a,r,o,l,c){if(isNaN(e)||isNaN(t))return 0;a&&([n,s]=[s,n]);const h=(c-o)/(l-r),u=o-h*r,d=Math.pow(h,2)+1,p=2*(h*(u-t)-e),f=Math.pow(e,2)+Math.pow(u-t,2)-Math.pow(i,2),y=Math.pow(p,2)-4*d*f;if(y<0)return 0;const b=(-p+Math.sqrt(y))/2/d,m=(-p-Math.sqrt(y))/2/d;let v=0;return[b,m].forEach(M=>{if(!(M>=Math.min(r,l)&&M<=Math.max(r,l)))return;const D=h*M+u,L=M-e,A=D-t,I=Math.atan2(A,L);mn(I,s,n)&&v++}),v}function Ac(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 Lc(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,Ac(e,t,i,s,o)<n?a=o:r=o;return o}function Cc(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,f=(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*f,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:f},{x:r,y:o}]]}function Ad(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 uy(e,t,i,s,n,a,r,o){const l=Ad(e,i,n,r),c=Ad(t,s,a,o);return[...l,...c]}var hr=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],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.path2d.moveTo(e,t),this.commands.push(0),this.params.push(e,t)}lineTo(e,t){this.openedPath?(this.path2d.lineTo(e,t),this.commands.push(1),this.params.push(e,t)):this.moveTo(e,t)}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()}appendSvg(e){let t=0,i=0,s,n,a=0,r=0;for(const{command:o,params:l}of e){s??(s=l[0]),n??(n=l[1]);const c=o===o.toLowerCase(),h=c?s:0,u=c?n:0;switch(o.toLowerCase()){case"m":this.moveTo(h+l[0],u+l[1]),s=h+l[0],n=u+l[1],t=s,i=n;break;case"c":this.cubicCurveTo(h+l[0],u+l[1],h+l[2],u+l[3],h+l[4],u+l[5]),a=h+l[2],r=u+l[3],s=h+l[4],n=u+l[5];break;case"s":this.cubicCurveTo(s+s-a,n+n-r,h+l[0],u+l[1],h+l[2],u+l[3]),a=h+l[0],r=u+l[1],s=h+l[2],n=u+l[3];break;case"q":this.cubicCurveTo((h+2*l[0])/3,(u+2*l[1])/3,(2*l[0]+l[2])/3,(2*l[1]+l[3])/3,l[2],l[3]),a=l[0],r=l[1],s=l[2],n=l[3];break;case"t":this.cubicCurveTo((s+2*(s+s-a))/3,(n+2*(n+n-r))/3,(2*(s+s-a)+l[0])/3,(2*(n+n-r)+l[1])/3,l[0],l[1]),a=s+s-a,r=n+n-r,s=l[0],n=l[1];break;case"a":this.ellipse(s,n,l[0],l[1],l[2]*Math.PI/180,l[3],l[4],h+l[5],u+l[6]),s=h+l[5],n=u+l[6];break;case"h":this.lineTo(h+l[0],n),s=h+l[0];break;case"l":this.lineTo(h+l[0],u+l[1]),s=h+l[0],n=u+l[1];break;case"v":this.lineTo(s,u+l[0]),n=u+l[0];break;case"z":this.closePath(),s=t,n=i;break;default:throw new Error(`Could not translate command '${o}' with '${l.join(" ")}'`)}}}ellipse(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,f=-u*c+d*h,y=p/i,b=f/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 L=Math.atan2((f-D)/s,(p-S)/i),A=Math.atan2((-f-D)/s,(-p-S)/i)-L,I=L+A,C=!!(1-r);this.ellipticalArc(v,M,i,s,n,L,I,C)}ellipticalArc(e,t,i,s,n,a,r,o){o&&([a,r]=[r,a]);const l=[],c=.5522847498307935,h=Math.sin(a),u=Math.cos(a),d=Math.sin(n),p=Math.cos(n);let f=p*u*i-d*h*s,y=d*u*i+p*h*s,b=-p*h*i-d*u*s,m=-d*h*i+p*u*s;l.push(f+e,y+t),r-=a,r=Xe(r);const v=Math.PI/2,M=Math.floor(r/v),S=r%v;for(let D=0;D<M;D++)l.push(f+b*c+e,y+m*c+t,f*c+b+e,y*c+m+t,b+e,m+t),[f,b]=[b,-f],[y,m]=[m,-y];if(S>0){const D=Math.sin(S),L=Math.cos(S),A=Math.tan(S/4)*(4/3),I=L+A*D,C=D-A*L;l.push(f+b*A+e,y+m*A+t,f*I+b*C+e,y*I+m*C+t,f*L+b*D+e,y*L+m*D+t)}if(o)for(let D=0,L=l.length-2;D<L;D+=2,L-=2)[l[D],l[L]]=[l[L],l[D]],[l[D+1],l[L+1]]=[l[L+1],l[D+1]];for(let D=2;D<l.length;D+=6){const[L,A,I,C,k,w]=l.slice(D,D+6);this.cubicCurveTo(L,A,I,C,k,w)}}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()}arc(e,t,i,s,n,a){this.openedPath=!0,this.path2d.arc(e,t,i,s,n,a),this.commands.push(2),this.params.push(e,t,i,s,n,a?1:0)}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(3),this.params.push(e,t,i,s,n,a)}closePath(){this.openedPath&&(this.path2d.closePath(),this.commands.push(4),this.openedPath=!1,this.closedPath=!0)}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+=cr(o,l,c,h,a,r,e,t),c=s[p++],o=c,h=s[p++],l=h;break;case 1:u+=cr(c,h,s[p++],s[p++],a,r,e,t),c=s[p-2],h=s[p-1];break;case 3:u+=yA(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 2:{const f=s[p++],y=s[p++],b=s[p++],m=s[p++],v=s[p++],M=!!s[p++];if(u+=hy(f,y,b,m,v,M,a,r,e,t),!isNaN(o)){const S=f+Math.cos(m)*b,D=y+Math.sin(m)*b;u+=cr(c,h,S,D,a,r,e,t)}c=f+Math.cos(v)*b,h=y+Math.sin(v)*b;break}case 4:u+=cr(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 d=n[u++],p=n[u++];i=No(e,t,l,c,d,p,i);break}case 3:dA.error("Command.Curve distanceSquare not implemented");break;case 2:{const d=n[u++],p=n[u++],f=n[u++],y=n[u++],b=n[u++],m=d+Math.cos(y)*f,v=p+Math.sin(y)*f,M=!!n[u++];i=No(e,t,l,c,m,v,i),i=pA(e,t,d,p,f,y,b,M,i),l=d+Math.cos(b)*f,c=p+Math.sin(b)*f;break}case 4:i=No(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.length;l+=2){const{x:c,y:h}=e(o[l],o[l+1]);t.push(c,h)}};let a=0;for(const r of i)switch(r){case 0:n("M",s[a++],s[a++]);break;case 1:n("L",s[a++],s[a++]);break;case 3:n("C",s[a++],s[a++],s[a++],s[a++],s[a++],s[a++]);break;case 2:{const o=s[a++],l=s[a++],c=s[a++],h=s[a++],u=s[a++],d=s[a++];let p=d?h-u:u-h;p<0&&(p+=Math.ceil(-p/(2*Math.PI))*2*Math.PI),d&&(p=-p);const f=Math.max(Math.ceil(Math.abs(p)/(Math.PI/2)),1),y=p/f,b=4/3*Math.tan(y/4),m=t.length===0?"M":"L";n(m,o+Math.cos(h)*c,l+Math.sin(h)*c);for(let v=0;v<f;v+=1){const M=h+y*(v+0),S=h+y*(v+1),D=c*Math.sin(M),L=c*Math.cos(M),A=c*Math.sin(S),I=c*Math.cos(S);n("C",o+L-b*D,l+D+b*L,o+I+b*A,l+A-b*I,o+I,l+A)}break}case 4:t.push("Z");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=(p,f,y)=>{i=Math.min(f,i),s=Math.min(p,s),n=Math.max(p,n),a=Math.max(f,a),y&&([r,o]=[p,f])},u=(p,f,y,b,m)=>{const v=p+y*Math.cos(b),M=f+y*Math.sin(b);h(v,M,m)};let d=0;for(const p of e)switch(p){case 0:h(t[d++],t[d++],!0),[l,c]=[r,o];break;case 1:h(t[d++],t[d++],!0);break;case 3:{const f=t[d++],y=t[d++],b=t[d++],m=t[d++],v=t[d++],M=t[d++];uy(r,o,f,y,b,m,v,M).forEach(D=>{const L=Ac(r,f,b,v,D),A=Ac(o,y,m,M,D);h(L,A)}),h(v,M,!0);break}case 2:{const f=t[d++],y=t[d++],b=t[d++],m=Xe(t[d++]),v=Xe(t[d++]),M=t[d++];u(f,y,b,m);const S=[0,Math.PI/2,Math.PI,3*Math.PI/2],[D,L]=M?[v,m]:[m,v];for(const A of S)(D<L&&D<=A&&A<=L||D>L&&(D<=A||A<=L))&&u(f,y,b,A);u(f,y,b,v,!0);break}case 4:[r,o]=[l,c];break}return new R(s,i,n-s,a-i)}};function pt(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 dy(e,t){return Math.floor(t*e)/e}function Ld(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 f=o+(d-.5)*c,y=l+(p-.5)*h;u?e.lineTo(f,y):e.moveTo(f,y),u=!0}e.closePath()}var bA={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(pt(s,r),pt(s,r)),e.lineTo(pt(s,t-r),pt(s,r)),e.lineTo(pt(s,t-r),pt(s,i-r)),e.lineTo(pt(s,r),pt(s,i-r)),e.closePath()},triangles(e,t){Ld(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){Ld(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,nt(130),nt(330)),e.arc(a+n,r-n,n,nt(220),nt(50)),e.lineTo(a,r+n),e.closePath()},crosses(e,t){Ld(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=pt(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=pt(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