UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

5 lines 122 kB
var Ti=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,m=(e,t,n,i)=>{for(var s=i>1?void 0:i?Di(t,n):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(i?o(t,n,s):o(s))||s);return i&&s&&Ti(t,n,s),s};import{createSvgElement as mn,toIterable as Fi}from"ag-charts-core";var yn=new Map;function Ce(e){const t=e.constructor,n=Object.hasOwn(t,"className")?t.className:t.name;if(!n)throw new Error(`The ${t} is missing the 'className' property.`);const i=(yn.get(n)??0)+1;return yn.set(n,i),`${n}-${i}`}function Mn(){return crypto.randomUUID?.()??Ni()}function Ni(){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)(n===4||n===6||n===8||n===10)&&(t+="-"),t+=e[n].toString(16).padStart(2,"0");return t}import{clamp as Pt}from"ag-charts-core";var Ii={containsPoint:Oi,isEmpty:Ei,normalize:Bi};function Oi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Ei(e){return e==null||e.height===0||e.width===0||isNaN(e.height)||isNaN(e.width)}function Bi(e){let{x:t,y:n,width:i,height:s}=e;return(i==null||i>0)&&(s==null||s>0)?e:(t!=null&&i!=null&&i<0&&(i=-i,t=t-i),n!=null&&s!=null&&s<0&&(s=-s,n=n-s),{x:t,y:n,width:i,height:s})}var bn=Symbol("interpolate");function Li(e,t,n,i=1/0){const s={nearest:void 0,distanceSquared:i};for(const r of n){const o=r.distanceSquared(e,t);if(o===0)return{nearest:r,distanceSquared:0};o<s.distanceSquared&&(s.nearest=r,s.distanceSquared=o)}return s}var Ot=class It{constructor(t,n,i,s){this.x=t,this.y=n,this.width=i,this.height=s}static fromDOMRect({x:t,y:n,width:i,height:s}){return new It(t,n,i,s)}static merge(t){let n=1/0,i=1/0,s=-1/0,r=-1/0;for(const o of t)o.x<n&&(n=o.x),o.y<i&&(i=o.y),o.x+o.width>s&&(s=o.x+o.width),o.y+o.height>r&&(r=o.y+o.height);return new It(n,i,s-n,r-i)}static nearestBox(t,n,i){return Li(t,n,i)}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:n,width:i,height:s}=this;return new It(t,n,i,s)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}containsPoint(t,n){return Ii.containsPoint(this,t,n)}intersection(t){if(!this.collidesBBox(t))return;const n=Pt(t.x,this.x,t.x+t.width),i=Pt(t.y,this.y,t.y+t.height),s=Pt(t.x,this.x+this.width,t.x+t.width),r=Pt(t.y,this.y+this.height,t.y+t.height);return new It(n,i,s-n,r-i)}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,n){if(this.containsPoint(t,n))return 0;const i=t-Pt(this.x,t,this.x+this.width),s=n-Pt(this.y,n,this.y+this.height);return i*i+s*s}shrink(t,n){if(typeof t=="number")this.applyMargin(t,n);else for(const i of Object.keys(t)){const s=t[i];typeof s=="number"&&this.applyMargin(s,i)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,n){if(typeof t=="number")this.applyMargin(-t,n);else for(const i of Object.keys(t)){const s=t[i];typeof s=="number"&&this.applyMargin(-s,i)}return this}applyMargin(t,n){switch(n){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,n){return this.x+=t,this.y+=n,this}[bn](t,n){return new It(this.x*(1-n)+t.x*n,this.y*(1-n)+t.y*n,this.width*(1-n)+t.width*n,this.height*(1-n)+t.height*n)}};Ot.zero=Object.freeze(new Ot(0,0,0,0)),Ot.NaN=Object.freeze(new Ot(NaN,NaN,NaN,NaN));var $=Ot;function k(e){return function(t,n){const i=`__${n}`;t[n]||_i(t,n,i,e)}}function _i(e,t,n,i){const{type:s="normal",changeCb:r,convertor:o,checkDirtyOnAssignment:c=!1}=i??{},a={type:s,changeCb:r,checkDirtyOnAssignment:c,convertor:o};let h;switch(s){case"normal":h=zi(n,a);break;case"transform":h=Hi(n);break;case"path":h=ji(n);break}h=$i(n,Wi(Gi(h,a),a),a),Object.defineProperty(e,t,{set:h,get:function(){return this[n]},enumerable:!0,configurable:!0})}function Gi(e,t){const{convertor:n}=t;return n?function(i){e.call(this,n(i))}:e}var Xt=Symbol("no-change");function Wi(e,t){const{changeCb:n}=t;return n?function(i){const s=e.call(this,i);return s!==Xt&&n.call(this,this),s}:e}function $i(e,t,n){const{checkDirtyOnAssignment:i}=n;return i?function(s){const r=t.call(this,s);return s?._dirty===!0&&this.markDirty(e),r}:t}function zi(e,t){const{changeCb:n}=t;return function(i){const s=this[e];return i!==s?(this[e]=i,this.markDirty(e),n?.(this),i):Xt}}function Hi(e){return function(t){const n=this[e];return t!==n?(this[e]=t,this.markDirtyTransform(),t):Xt}}function ji(e){return function(t){const n=this[e];return t!==n?(this[e]=t,this._dirtyPath||(this._dirtyPath=!0,this.markDirty(e)),t):Xt}}var Et=class rn{constructor(t){this.serialNumber=rn._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=Ce(this),this.pointerEvents=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??rn._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,n,i){const s=t?.toSVG();if(s==null||!s.elements.length&&!s.defs?.length)return;const r=mn("svg");if(r.setAttribute("width",String(n)),r.setAttribute("height",String(i)),r.setAttribute("viewBox",`0 0 ${n} ${i}`),s.defs?.length){const o=mn("defs");o.append(...s.defs),r.append(o)}return r.append(...s.elements),r.outerHTML}static*extractBBoxes(t,n){for(const i of t)if(!n||i.visible&&!i.transitionOut){const s=i.getBBox();s&&(yield s)}}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._layerManager}get dirty(){return this._dirty}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}preRender(t,n=1){this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=n,this.childNodeCounts.thisComplexity=n;for(const i of this.children()){const s=i.preRender(t);this.childNodeCounts.groups+=s.groups,this.childNodeCounts.nonGroups+=s.nonGroups,this.childNodeCounts.complexity+=s.complexity}return this.childNodeCounts}render(t){const{stats:n}=t;if(this._dirty=!1,this.debugDirtyProperties(),t.debugNodeSearch){const i=this.name??this.id;t.debugNodeSearch.some(s=>typeof s=="string"?s===i:s.test(i))&&(t.debugNodes[this.name??this.id]=this)}n&&(n.nodesRendered++,n.opsPerformed+=this.childNodeCounts.thisComplexity)}_setLayerManager(t){this._layerManager=t,this._debug=t?.debug;for(const n of this.children())n._setLayerManager(t)}sortChildren(t){if(this.dirtyZIndex=!1,!this.childNodes)return;const n=[...this.childNodes].sort(t);this.childNodes.clear();for(const i of n)this.childNodes.add(i)}*traverseUp(t){let n=this;for(t&&(yield n);n=n.parentNode;)yield n}*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 n of Fi(t))n.parentNode?.removeChild(n),this.childNodes.add(n),n.parentNode=this,n._setLayerManager(this.layerManager);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._setLayerManager(),this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty()}remove(){this.parentNode?.removeChild(this)}clear(){for(const t of this.children())delete t.parentNode,t._setLayerManager();this.childNodes?.clear(),this.invalidateCachedBBox()}destroy(){this.parentNode?.removeChild(this)}setProperties(t,n){if(n)for(const i of n)this[i]=t[i];else Object.assign(this,t);return this}containsPoint(t,n){return!1}pickNode(t,n){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,n))){if(this.childNodes!=null&&this.childNodes.size!==0){const i=[...this.children()];for(let s=i.length-1;s>=0;s--){const r=i[s].pickNode(t,n);if(r)return r}}else if(!this.isContainerNode)return this}}pickNodes(t,n,i=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,n))return i;this.isContainerNode||i.push(this);for(const s of this.children())s.pickNodes(t,n,i);return i}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(){}markDirty(t){const{_dirty:n}=this;t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),!(this.cachedBBox==null&&n)&&(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 n=this._debugDirtyProperties?.get(t)??[],i=new Error().stack?.split(`
`).filter(s=>s!=="Error"&&!s.includes(".markDebugProperties")&&!s.includes(".markDirty")&&!s.includes("Object.assign ")&&!s.includes(`${this.constructor.name}.`))??"unknown";n.push(i[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,n)}debugDirtyProperties(){this._debugDirtyProperties!=null&&(this._debugDirtyProperties.has("__first__")||this._debugDirtyProperties.forEach((t,n)=>{t.length>1&&(console.groupCollapsed(`Property changed multiple times before render: ${this.constructor.name}.${n} (${t.length}x)`),t.forEach(i=>console.log(i)),console.groupEnd())}),this._debugDirtyProperties.clear())}onZIndexChange(){const{parentNode:t}=this;t&&(t.dirtyZIndex=!0)}toSVG(){}};Et._nextSerialNumber=0,Et._debugEnabled=!1,m([k()],Et.prototype,"visible",2),m([k({changeCb:e=>e.onZIndexChange()})],Et.prototype,"zIndex",2);var Bt=Et;import{createSvgElement as qi}from"ag-charts-core";function Yi(e=0,t=0){return new OffscreenCanvas(e,t).getContext("2d")}var vn=class{constructor(e=5){this.maxCacheSize=e,this.store=new Map}get(e){if(!this.store.has(e))return;const t=this.store.get(e);return this.store.delete(e),this.store.set(e,t),t}has(e){return this.store.has(e)}set(e,t){if(this.store.set(e,t),this.store.size>this.maxCacheSize){const n=this.store.keys();let i=this.store.size-this.maxCacheSize;for(;i>0;){const s=n.next();s.done||this.store.delete(s.value),i--}}return t}clear(){this.store.clear()}},Pe=class{static measureText(e,t){return this.getMeasurer(t).measureText(e)}static measureLines(e,t){return this.getMeasurer(t).measureLines(e)}static getMeasurer(e){const t=typeof e.font=="string"?e.font:G.toFontString(e.font),n=`${t}-${e.textAlign??"start"}-${e.textBaseline??"alphabetic"}`;return this.instanceMap.get(n)??this.createFontMeasurer(t,e,n)}static createFontMeasurer(e,t,n){const i=Yi();i.font=e,i.textAlign=t.textAlign??"start",i.textBaseline=t.textBaseline??"alphabetic";const s=new Xi(i,t);return this.instanceMap.set(n,s),s}};Pe.instanceMap=new vn(10);var Xi=class{constructor(e,t){this.ctx=e,this.measureMap=new vn(100),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline),e.font=typeof t.font=="string"?t.font:G.toFontString(t.font),this.textMeasurer=new xn(n=>this.cachedCtxMeasureText(n),t.textBaseline??"alphabetic")}textWidth(e,t){return this.textMeasurer.textWidth(e,t)}measureText(e){return this.textMeasurer.measureText(e)}measureLines(e){return this.textMeasurer.measureLines(e)}cachedCtxMeasureText(e){if(!this.measureMap.has(e)){const t=this.ctx.measureText(e);this.measureMap.set(e,{actualBoundingBoxAscent:t.actualBoundingBoxAscent,emHeightAscent:t.emHeightAscent,emHeightDescent:t.emHeightDescent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,actualBoundingBoxLeft:t.actualBoundingBoxLeft,actualBoundingBoxRight:t.actualBoundingBoxRight,alphabeticBaseline:t.alphabeticBaseline,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent,hangingBaseline:t.hangingBaseline,ideographicBaseline:t.ideographicBaseline,width:t.width})}return this.measureMap.get(e)}},G=class{static toFontString({fontSize:e=10,fontStyle:t,fontWeight:n,fontFamily:i,lineHeight:s}){let r="";return t&&(r+=`${t} `),n&&(r+=`${n} `),r+=`${e}px`,s&&(r+=`/${s}px`),r+=` ${i}`,r.trim()}static getLineHeight(e){return Math.ceil(e*this.defaultLineHeight)}static getVerticalModifier(e){switch(e){case"hanging":case"top":return 0;case"middle":return .5;case"alphabetic":case"bottom":case"ideographic":default:return 1}}};G.EllipsisChar="\u2026",G.defaultLineHeight=1.15,G.lineSplitter=/\r?\n/g;var xn=class{constructor(e,t="alphabetic"){this.measureTextFn=e,this.textBaseline=t,this.charMap=new Map}getMetrics(e){const t=this.measureTextFn(e);return t.fontBoundingBoxAscent??(t.fontBoundingBoxAscent=t.emHeightAscent),t.fontBoundingBoxDescent??(t.fontBoundingBoxDescent=t.emHeightDescent),{width:t.width,height:t.actualBoundingBoxAscent+t.actualBoundingBoxDescent,lineHeight:t.fontBoundingBoxAscent+t.fontBoundingBoxDescent,offsetTop:t.actualBoundingBoxAscent,offsetLeft:t.actualBoundingBoxLeft}}getMultilineMetrics(e){let t=0,n=0,i=0,s=0,r=0;const o=G.getVerticalModifier(this.textBaseline),c=[];let a=0;const h=e.length;for(const l of e){const u=this.measureTextFn(l);u.fontBoundingBoxAscent??(u.fontBoundingBoxAscent=u.emHeightAscent),u.fontBoundingBoxDescent??(u.fontBoundingBoxDescent=u.emHeightDescent),t<u.width&&(t=u.width),s<u.actualBoundingBoxLeft&&(s=u.actualBoundingBoxLeft),a===0?(n+=u.actualBoundingBoxAscent,i+=u.actualBoundingBoxAscent):r+=u.fontBoundingBoxAscent,a===h-1?n+=u.actualBoundingBoxDescent:r+=u.fontBoundingBoxDescent,c.push({text:l,width:u.width,height:u.actualBoundingBoxAscent+u.actualBoundingBoxDescent,lineHeight:u.fontBoundingBoxAscent+u.fontBoundingBoxDescent,offsetTop:u.actualBoundingBoxAscent,offsetLeft:u.actualBoundingBoxLeft}),a++}return n+=r,i+=r*o,{width:t,height:n,offsetTop:i,offsetLeft:s,lineMetrics:c}}textWidth(e,t){if(t){let n=0;for(let i=0;i<e.length;i++)n+=this.textWidth(e.charAt(i));return n}return e.length>1?this.measureTextFn(e).width:this.charMap.get(e)??this.charWidth(e)}measureText(e){return this.getMetrics(e)}measureLines(e){const t=typeof e=="string"?e.split(G.lineSplitter):e;return this.getMultilineMetrics(t)}charWidth(e){const{width:t}=this.measureTextFn(e);return this.charMap.set(e,t),t}};import{createSvgElement as Vi}from"ag-charts-core";import{isNumberEqual as At}from"ag-charts-core";var Sn=[1,0,0,1,0,0],pt=class be{get e(){return[...this.elements]}constructor(t=Sn){this.elements=[...t]}setElements(t){const n=this.elements;return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],this}get identity(){const t=this.elements;return At(t[0],1)&&At(t[1],0)&&At(t[2],0)&&At(t[3],1)&&At(t[4],0)&&At(t[5],0)}AxB(t,n,i){const s=t[0]*n[0]+t[2]*n[1],r=t[1]*n[0]+t[3]*n[1],o=t[0]*n[2]+t[2]*n[3],c=t[1]*n[2]+t[3]*n[3],a=t[0]*n[4]+t[2]*n[5]+t[4],h=t[1]*n[4]+t[3]*n[5]+t[5];i=i??t,i[0]=s,i[1]=r,i[2]=o,i[3]=c,i[4]=a,i[5]=h}multiplySelf(t){return this.AxB(this.elements,t.elements),this}multiply(t){const n=new Array(6);return t instanceof be?this.AxB(this.elements,t.elements,n):this.AxB(this.elements,[t.a,t.b,t.c,t.d,t.e,t.f],n),new be(n)}preMultiplySelf(t){return this.AxB(t.elements,this.elements,this.elements),this}inverse(){const t=this.elements;let n=t[0],i=t[1],s=t[2],r=t[3];const o=t[4],c=t[5],a=1/(n*r-i*s);return n*=a,i*=a,s*=a,r*=a,new be([r,-i,-s,n,s*c-r*o,i*o-n*c])}invertSelf(){const t=this.elements;let n=t[0],i=t[1],s=t[2],r=t[3];const o=t[4],c=t[5],a=1/(n*r-i*s);return n*=a,i*=a,s*=a,r*=a,t[0]=r,t[1]=-i,t[2]=-s,t[3]=n,t[4]=s*c-r*o,t[5]=i*o-n*c,this}transformPoint(t,n){const i=this.elements;return{x:t*i[0]+n*i[2]+i[4],y:t*i[1]+n*i[3]+i[5]}}transformBBox(t,n){const i=this.elements,s=i[0],r=i[1],o=i[2],c=i[3],a=t.width*.5,h=t.height*.5,l=t.x+a,u=t.y+h,d=Math.abs(a*s)+Math.abs(h*o),f=Math.abs(a*r)+Math.abs(h*c);return n??(n=new $(0,0,0,0)),n.x=l*s+u*o+i[4]-d,n.y=l*r+u*c+i[5]-f,n.width=d+d,n.height=f+f,n}toContext(t){if(this.identity)return;const n=this.elements;t.transform(n[0],n[1],n[2],n[3],n[4],n[5])}static updateTransformMatrix(t,n,i,s,r,o,c){const a=n,h=i;let l,u;a===1&&h===1?(l=0,u=0):(l=c?.scalingCenterX??0,u=c?.scalingCenterY??0);const d=s,f=Math.cos(d),p=Math.sin(d);let y,g;d===0?(y=0,g=0):(y=c?.rotationCenterX??0,g=c?.rotationCenterY??0);const M=r,v=o,S=l*(1-a)-y,R=u*(1-h)-g;return t.setElements([f*a,p*a,-p*h,f*h,f*S-p*R+y+M,p*S+f*R+g+v]),t}};function ct(e){return Cn(e.constructor)}var wn=Symbol("isMatrixTransform");function Cn(e){return e[wn]===!0}function Ae(e){var t,n;const i=e;if(Cn(e))return e;const s=Symbol("matrix_combined_transform");class r extends i{constructor(){super(...arguments),this[n]=new pt,this._dirtyTransform=!0}markDirtyTransform(){this._dirtyTransform=!0,super.markDirty()}updateMatrix(c){}computeTransformMatrix(){this._dirtyTransform&&(this[s].setElements(Sn),this.updateMatrix(this[s]),this._dirtyTransform=!1)}toParent(c){return this.computeTransformMatrix(),this[s].identity?c.clone():this[s].transformBBox(c)}toParentPoint(c,a){return this.computeTransformMatrix(),this[s].identity?{x:c,y:a}:this[s].transformPoint(c,a)}fromParent(c){return this.computeTransformMatrix(),this[s].identity?c.clone():this[s].inverse().transformBBox(c)}fromParentPoint(c,a){return this.computeTransformMatrix(),this[s].identity?{x:c,y:a}:this[s].inverse().transformPoint(c,a)}computeBBox(){const c=super.computeBBox();return c&&this.toParent(c)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(c,a){return{x:c,y:a}=this.fromParentPoint(c,a),super.pickNode(c,a)}pickNodes(c,a,h){return{x:c,y:a}=this.fromParentPoint(c,a),super.pickNodes(c,a,h)}render(c){this.computeTransformMatrix();const{ctx:a}=c,h=this[s];let l=!1;h.identity||(a.save(),l=!0,h.toContext(a)),super.render(c),l&&a.restore()}toSVG(){this.computeTransformMatrix();const c=super.toSVG(),a=this[s];if(a.identity||c==null)return c;const h=Vi("g");h.append(...c.elements);const[l,u,d,f,p,y]=a.e;return h.setAttribute("transform",`matrix(${l} ${u} ${d} ${f} ${p} ${y})`),{elements:[h],defs:c.defs}}}return t=wn,n=s,r[t]=!0,r}function Lt(e){var t;const n=e,i=Symbol("matrix_rotation");class s extends Ae(n){constructor(){super(...arguments),this[t]=new pt,this.rotationCenterX=null,this.rotationCenterY=null,this.rotation=0}updateMatrix(o){super.updateMatrix(o);const{rotation:c,rotationCenterX:a,rotationCenterY:h}=this;c!==0&&(pt.updateTransformMatrix(this[i],1,1,c,0,0,{rotationCenterX:a,rotationCenterY:h}),o.multiplySelf(this[i]))}}return t=i,m([k({type:"transform"})],s.prototype,"rotationCenterX",2),m([k({type:"transform"})],s.prototype,"rotationCenterY",2),m([k({type:"transform"})],s.prototype,"rotation",2),s}function Pn(e){var t;const n=e,i=Symbol("matrix_scale");class s extends Ae(n){constructor(){super(...arguments),this[t]=new pt,this.scalingX=1,this.scalingY=1,this.scalingCenterX=null,this.scalingCenterY=null}updateMatrix(o){super.updateMatrix(o);const{scalingX:c,scalingY:a,scalingCenterX:h,scalingCenterY:l}=this;c===1&&a===1||(pt.updateTransformMatrix(this[i],c,a,0,0,0,{scalingCenterX:h,scalingCenterY:l}),o.multiplySelf(this[i]))}}return t=i,m([k({type:"transform"})],s.prototype,"scalingX",2),m([k({type:"transform"})],s.prototype,"scalingY",2),m([k({type:"transform"})],s.prototype,"scalingCenterX",2),m([k({type:"transform"})],s.prototype,"scalingCenterY",2),s}function Vt(e){var t;const n=e,i=Symbol("matrix_translation");class s extends Ae(n){constructor(){super(...arguments),this[t]=new pt,this.translationX=0,this.translationY=0}updateMatrix(o){super.updateMatrix(o);const{translationX:c,translationY:a}=this;c===0&&a===0||(pt.updateTransformMatrix(this[i],1,1,0,c,a),o.multiplySelf(this[i]))}}return t=i,m([k({type:"transform"})],s.prototype,"translationX",2),m([k({type:"transform"})],s.prototype,"translationY",2),s}var kt=class{static fromCanvas(e,t){const n=[];for(const i of e.traverseUp())ct(i)&&n.unshift(i);for(const i of n)t=i.fromParent(t);return ct(e)&&(t=e.fromParent(t)),t}static toCanvas(e,t){t==null?t=e.getBBox():ct(e)&&(t=e.toParent(t));for(const n of e.traverseUp())ct(n)&&(t=n.toParent(t));return t}static fromCanvasPoint(e,t,n){const i=[];for(const s of e.traverseUp())ct(s)&&i.unshift(s);for(const s of i)({x:t,y:n}=s.fromParentPoint(t,n));return ct(e)&&({x:t,y:n}=e.fromParentPoint(t,n)),{x:t,y:n}}static toCanvasPoint(e,t,n){ct(e)&&({x:t,y:n}=e.toParentPoint(t,n));for(const i of e.traverseUp())ct(i)&&({x:t,y:n}=i.toParentPoint(t,n));return{x:t,y:n}}};import{clamp as Ui}from"ag-charts-core";import{isObject as Ji,isPlainObject as Ut}from"ag-charts-core";var An=Symbol("BREAK"),Rt="__decorator_config";function Ki(e,t){ke(e,t).optional=!0}function ke(e,t){Object.getOwnPropertyDescriptor(e,Rt)==null&&Object.defineProperty(e,Rt,{value:{}});const n=e[Rt],i=t.toString();if(typeof n[i]<"u")return n[i];const s=new WeakMap;n[i]={setters:[],getters:[],observers:[],valuesMap:s};const r=Object.getOwnPropertyDescriptor(e,t),o=r?.set,c=r?.get;return Object.defineProperty(e,t,{set:function(l){const{setters:u,observers:d}=n[i];let f;u.some(p=>p.length>2)&&(f=c?c.call(this):s.get(this));for(const p of u)if(l=p(this,t,l,f),l===An)return;o?o.call(this,l):s.set(this,l);for(const p of d)p(this,l,f)},get:function(){let l=c?c.call(this):s.get(this);for(const u of n[i].getters)if(l=u(this,t,l),l===An)return;return l},enumerable:!0,configurable:!1}),n[i]}function kn(e,t,n){return(i,s)=>{const r=ke(i,s);r.setters.push(e),t&&r.getters.unshift(t),n&&Object.assign(r,n)}}function Zi(e){return(t,n)=>{ke(t,n).observers.push(e)}}function Re(e){return typeof e<"u"&&Rt in e}function Jt(e){const t=new Set;for(;Re(e);)t.add(e?.[Rt]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(n=>Object.keys(n))}function Qi(e,t){const n=t.toString();for(;Re(e);){const i=e[Rt];if(Object.hasOwn(i,n))return i[n];e=Object.getPrototypeOf(e)}}function Te(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((n,i)=>Te(n,t[i])):Ut(e)?Ut(t)?ts(e,t,Te):!1:e===t}function ts(e,t,n){for(const i of Object.keys(t))if(!(i in e))return!1;for(const i of Object.keys(e))if(!(i in t)||!n(e[i],t[i]))return!1;return!0}function Rn(...e){const t={};for(const n of e){if(!Ji(n))continue;const i=Re(n)?Jt(n):Object.keys(n);for(const s of i)Ut(t[s])&&Ut(n[s])?t[s]=Rn(t[s],n[s]):s in t||(t[s]??(t[s]=n[s]))}return t}import{createSvgElement as es}from"ag-charts-core";var gt=Math.PI*2,ho=Math.PI/2;function B(e){return e%=gt,e+=gt,e%=gt,e}function Tn(e){return e%=gt,e<-Math.PI?e+=gt:e>=Math.PI&&(e-=gt),e}function Tt(e,t,n){const i=B(e),s=B(t),r=B(n);return s<r?s<=i&&i<=r:s>r?s<=i||i<=r:!0}function J(e){return e/180*Math.PI}function De(e,t){return e=B(e),t=B(t),t-e+(e>t?gt:0)}import{createSvgElement as ns}from"ag-charts-core";import{Logger as Fe,clamp as is}from"ag-charts-core";import{clamp as it}from"ag-charts-core";var mt=(e,t,n)=>e*(1-n)+t*n,Ne=e=>{const t=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4},Ie=e=>{const t=e<0?-1:1,n=Math.abs(e);return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e},Dn=class D{constructor(t,n,i,s=1){this.r=it(0,t||0,1),this.g=it(0,n||0,1),this.b=it(0,i||0,1),this.a=it(0,s||0,1)}static validColorString(t){return t.indexOf("#")>=0?!!D.parseHex(t):t.indexOf("rgb")>=0?!!D.stringToRgba(t):D.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.indexOf("#")>=0)return D.fromHexString(t);const n=D.nameToHex.get(t.toLowerCase());if(n)return D.fromHexString(n);if(t.indexOf("rgb")>=0)return D.fromRgbaString(t);throw new Error(`Invalid color string: '${t}'`)}static parseHex(t){t=t.replace(/ /g,"").slice(1);let n;switch(t.length){case 6:case 8:n=[];for(let i=0;i<t.length;i+=2)n.push(parseInt(`${t[i]}${t[i+1]}`,16));break;case 3:case 4:n=t.split("").map(i=>parseInt(i,16)).map(i=>i+i*16);break}if(n?.length>=3&&n.every(i=>i>=0))return n.length===3&&n.push(255),n}static fromHexString(t){const n=D.parseHex(t);if(n){const[i,s,r,o]=n;return new D(i/255,s/255,r/255,o/255)}throw new Error(`Malformed hexadecimal color string: '${t}'`)}static stringToRgba(t){let n=-1,i=-1;for(let c=0;c<t.length;c++){const a=t[c];if(n===-1&&a==="(")n=c;else if(a===")"){i=c;break}}if(n===-1||i===-1)return;const r=t.substring(n+1,i).split(","),o=[];for(let c=0;c<r.length;c++){const a=r[c];let h=parseFloat(a);if(!Number.isFinite(h))return;a.indexOf("%")>=0?(h=it(0,h,100),h/=100):c===3?h=it(0,h,1):(h=it(0,h,255),h/=255),o.push(h)}return o}static fromRgbaString(t){const n=D.stringToRgba(t);if(n){if(n.length===3)return new D(n[0],n[1],n[2]);if(n.length===4)return new D(n[0],n[1],n[2],n[3])}throw new Error(`Malformed rgb/rgba color string: '${t}'`)}static fromArray(t){if(t.length===4)return new D(t[0],t[1],t[2],t[3]);if(t.length===3)return new D(t[0],t[1],t[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(t,n,i,s=1){const r=D.HSBtoRGB(t,n,i);return new D(r[0],r[1],r[2],s)}static fromHSL(t,n,i,s=1){const r=D.HSLtoRGB(t,n,i);return new D(r[0],r[1],r[2],s)}static fromOKLCH(t,n,i,s=1){const r=D.OKLCHtoRGB(t,n,i);return new D(r[0],r[1],r[2],s)}static padHex(t){return t.length===1?"0"+t:t}toHexString(){let t="#"+D.padHex(Math.round(this.r*255).toString(16))+D.padHex(Math.round(this.g*255).toString(16))+D.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(t+=D.padHex(Math.round(this.a*255).toString(16))),t}toRgbaString(t=3){const n=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)],i=Math.pow(10,t);return this.a!==1?(n.push(Math.round(this.a*i)/i),`rgba(${n.join(", ")})`):`rgb(${n.join(", ")})`}toString(){return this.a===1?this.toHexString():this.toRgbaString()}toHSB(){return D.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(t,n,i){const s=Ne(t),r=Ne(n),o=Ne(i),c=Math.cbrt(.4122214708*s+.5363325363*r+.0514459929*o),a=Math.cbrt(.2119034982*s+.6806995451*r+.1073969566*o),h=Math.cbrt(.0883024619*s+.2817188376*r+.6299787005*o),l=.2104542553*c+.793617785*a-.0040720468*h,u=1.9779984951*c-2.428592205*a+.4505937099*h,d=.0259040371*c+.7827717662*a-.808675766*h,f=Math.atan2(d,u)*180/Math.PI,p=l,y=Math.hypot(u,d),g=f>=0?f:f+360;return[p,y,g]}static OKLCHtoRGB(t,n,i){const s=t,r=n*Math.cos(i*Math.PI/180),o=n*Math.sin(i*Math.PI/180),c=(s+.3963377774*r+.2158037573*o)**3,a=(s-.1055613458*r-.0638541728*o)**3,h=(s-.0894841775*r-1.291485548*o)**3,l=4.0767416621*c-3.3077115913*a+.2309699292*h,u=-1.2684380046*c+2.6097574011*a-.3413193965*h,d=-.0041960863*c-.7034186147*a+1.707614701*h,f=Ie(l),p=Ie(u),y=Ie(d);return[f,p,y]}static RGBtoHSL(t,n,i){const s=Math.min(t,n,i),r=Math.max(t,n,i),o=(r+s)/2;let c,a;if(r===s)c=0,a=0;else{const h=r-s;a=o>.5?h/(2-r-s):h/(r+s),r===t?c=(n-i)/h+(n<i?6:0):r===n?c=(i-t)/h+2:c=(t-n)/h+4,c*=360/6}return[c,a,o]}static HSLtoRGB(t,n,i){if(t=(t%360+360)%360,n===0)return[i,i,i];const s=i<.5?i*(1+n):i+n-i*n,r=2*i-s;function o(l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?r+(s-r)*6*l:l<1/2?s:l<2/3?r+(s-r)*(2/3-l)*6:r}const c=o(t/360+1/3),a=o(t/360),h=o(t/360-1/3);return[c,a,h]}static RGBtoHSB(t,n,i){const s=Math.min(t,n,i),r=Math.max(t,n,i),o=r===0?0:(r-s)/r;let c=0;if(s!==r){const a=r-s,h=(r-t)/a,l=(r-n)/a,u=(r-i)/a;t===r?c=u-l:n===r?c=2+h-u:c=4+l-h,c/=6,c<0&&(c=c+1)}return[c*360,o,r]}static HSBtoRGB(t,n,i){t=(t%360+360)%360/360;let s=0,r=0,o=0;if(n===0)s=r=o=i;else{const c=(t-Math.floor(t))*6,a=c-Math.floor(c),h=i*(1-n),l=i*(1-n*a),u=i*(1-n*(1-a));switch(c>>0){case 0:s=i,r=u,o=h;break;case 1:s=l,r=i,o=h;break;case 2:s=h,r=i,o=u;break;case 3:s=h,r=l,o=i;break;case 4:s=u,r=h,o=i;break;case 5:s=i,r=h,o=l;break}}return[s,r,o]}static mix(t,n,i){return new D(mt(t.r,n.r,i),mt(t.g,n.g,i),mt(t.b,n.b,i),mt(t.a,n.a,i))}static lighten(t,n){const i=D.RGBtoOKLCH(t.r,t.g,t.b);return D.fromOKLCH(it(0,i[0]+n,1),i[1],i[2])}static darken(t,n){const i=D.RGBtoOKLCH(t.r,t.g,t.b);return D.fromOKLCH(it(0,i[0]-n,1),i[1],i[2])}static interpolate(t,n){const i=1/(t.length-1),s=t.map(r=>D.RGBtoOKLCH(r.r,r.g,r.b));return Array.from({length:n},(r,o)=>{const c=o/(n-1),a=t.length<=2?0:Math.min(Math.floor(c*(t.length-1)),t.length-2),h=(c-a*i)/i,l=s[a],u=s[a+1];return D.fromOKLCH(mt(l[0],u[0],h),mt(l[1],u[1],h),mt(l[2],u[2],h))})}};Dn.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 Oe=Dn,Ee=class{ticks(e,t,n){}niceDomain(e,t=this.domain){return t}tickFormatter(e){}datumFormatter(e){}get bandwidth(){}get step(){}get inset(){}},_t=(e,t)=>{const n=Symbol(String(t));e[n]=void 0,Object.defineProperty(e,t,{get(){return this[n]},set(i){this[n]!==i&&(this[n]=i,this.invalid=!0)},enumerable:!0,configurable:!1})},Fn=e=>{const t=Oe.fromString(e),[n,i,s]=Oe.RGBtoOKLCH(t.r,t.g,t.b);return{l:n,c:i,h:s,a:t.a}},Be=1e-6,Nn=e=>e.c<Be||e.l<Be||e.l>1-Be,ss=(e,t,n)=>{n=is(0,n,1);let i;if(Nn(e))i=t.h;else if(Nn(t))i=e.h;else{const c=e.h;let a=t.h;const h=t.h-e.h;h>180?a-=360:h<-180&&(a+=360),i=c*(1-n)+a*n}const s=e.c*(1-n)+t.c*n,r=e.l*(1-n)+t.l*n,o=e.a*(1-n)+t.a*n;return Oe.fromOKLCH(r,s,i,o)},Kt=class extends Ee{constructor(){super(...arguments),this.type="color",this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(Fn)}update(){const{domain:e,range:t}=this;e.length<2&&(Fe.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 n=1;n<e.length;n++){const i=e[n-1],s=e[n];if(i>=s){Fe.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((r,o)=>r-o);break}}if(t.length<e.length)for(let n=t.length;n<e.length;n++)t.push(t.length>0?t[0]:"black");this.parsedRange=this.range.map(Fn)}normalizeDomains(...e){return{domain:e.flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const{domain:t,range:n,parsedRange:i}=this,s=t[0],r=t.at(-1),o=n[0],c=n[n.length-1];if(e<=s)return o;if(e>=r)return c;let a,h;if(t.length===2){const d=(e-s)/(r-s),f=1/(n.length-1);a=n.length<=2?0:Math.min(Math.floor(d*(n.length-1)),n.length-2),h=(d-a*f)/f}else{for(a=0;a<t.length-2&&!(e<t[a+1]);a++);const d=t[a],f=t[a+1];h=(e-d)/(f-d)}const l=i[a],u=i[a+1];return ss(l,u,h).toRgbaString()}invert(){}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&Fe.warnOnce("Expected update to not invalidate scale"))}};m([_t],Kt.prototype,"domain",2),m([_t],Kt.prototype,"range",2);var Le=class{constructor(e,t=[],n){this.colorSpace=e,this.stops=t,this.bbox=n,this._cache=void 0}createGradient(e,t,n){const i=this.bbox??t;if(isNaN(i.x)||isNaN(i.y))return;if(this._cache!=null&&this._cache.ctx===e&&this._cache.bbox.equals(i))return this._cache.gradient;const{stops:s,colorSpace:r}=this;if(s.length===0)return;if(s.length===1)return s[0].color;let o=this.createCanvasGradient(e,i,n);if(o==null)return;const c=r==="oklch",a=.05;let h=s[0];o.addColorStop(h.stop,h.color);for(let l=1;l<s.length;l+=1){const u=s[l];if(c){const d=new Kt;d.domain=[h.stop,u.stop],d.range=[h.color,u.color];for(let f=h.stop+a;f<u.stop;f+=a)o.addColorStop(f,d.convert(f))}o.addColorStop(u.stop,u.color),h=u}return"createPattern"in o&&(o=o.createPattern()),this._cache={ctx:e,bbox:i,gradient:o},o}toSvg(e){const t=this.bbox??e,n=this.createSvgGradient(t);return this.stops.forEach(({stop:i,color:s})=>{const r=ns("stop");r.setAttribute("offset",`${i}`),r.setAttribute("stop-color",`${s}`),n.appendChild(r)}),n}},rs=class extends Le{constructor(e,t,n=0,i){super(e,t,i),this.angle=n}createCanvasGradient(e,t,n){const{angle:s}=this,r=B(J(s+-90)),o=n?.centerX??t.x+t.width*.5,c=n?.centerY??t.y+t.height*.5;return e.createConicGradient(r,o,c)}createSvgGradient(e){return es("linearGradient")}};import{createSvgElement as os}from"ag-charts-core";var as=class extends Le{constructor(e,t,n=0,i){super(e,t,i),this.angle=n}getGradientPoints(e){const{angle:n}=this,i=B(J(n+90)),s=Math.cos(i),r=Math.sin(i),o=e.width,c=e.height,a=e.x+o*.5,h=e.y+c*.5,l=Math.sqrt(c*c+o*o)/2,u=Math.atan2(c,o);let d;i<Math.PI/2?d=i:i<Math.PI?d=Math.PI-i:i<1.5*Math.PI?d=i-Math.PI:d=2*Math.PI-i;const f=l*Math.abs(Math.cos(d-u));return{x0:a+s*f,y0:h+r*f,x1:a-s*f,y1:h-r*f}}createCanvasGradient(e,t){const{x0:n,y0:i,x1:s,y1:r}=this.getGradientPoints(t);return e.createLinearGradient(n,i,s,r)}createSvgGradient(e){const{x0:t,y0:n,x1:i,y1:s}=this.getGradientPoints(e),r=os("linearGradient");return r.setAttribute("x1",String(t)),r.setAttribute("y1",String(n)),r.setAttribute("x2",String(i)),r.setAttribute("y2",String(s)),r.setAttribute("gradientUnits","userSpaceOnUse"),r}};import{createSvgElement as cs}from"ag-charts-core";var hs=class extends Le{constructor(e,t,n){super(e,t,n)}createCanvasGradient(e,t,n){const i=n?.centerX??t.x+t.width*.5,s=n?.centerY??t.y+t.height*.5,r=n?.innerRadius??0,o=n?.outerRadius??Math.hypot(t.width*.5,t.height*.5)/Math.SQRT2;return e.createRadialGradient(i,s,r,i,s,o)}createSvgGradient(e){const t=e.x+e.width*.5,n=e.y+e.height*.5,i=cs("radialGradient");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(n)),i.setAttribute("r",String(Math.hypot(e.width*.5,e.height*.5)/Math.SQRT2)),i.setAttribute("gradientUnits","userSpaceOnUse"),i}};import{Logger as ls}from"ag-charts-core";import{Logger as Zt,isArray as us,isPlainObject as ds}from"ag-charts-core";var _e=class{handleUnknownProperties(e,t){}set(e){const{className:t=this.constructor.name}=this.constructor;if(typeof e!="object")return Zt.warn(`unable to set ${t} - expecting a properties object`),this;const n=new Set(Object.keys(e));for(const i of Jt(this))if(n.has(i)){const s=e[i],r=this;if(Dt(r[i]))if(r[i]instanceof In){const o=r[i].reset(s);o!=null?r[i]=o:Zt.warn(`unable to set [${i}] - expecting a properties array`)}else r[i].set(s);else ds(s)?r[i]=Rn(s,r[i]??{}):r[i]=s;n.delete(i)}this.handleUnknownProperties(n,e);for(const i of n)Zt.warn(`unable to set [${i}] in ${t} - property is unknown`);return this}isValid(e){return Jt(this).every(t=>{const n=Qi(this,t);if(n==null)return!0;const i=n.optional===!0||typeof this[t]<"u";return i||Zt.warnOnce(`${e??""}[${t}] is required.`),i})}toJson(){return Jt(this).reduce((e,t)=>{const n=this[t];return e[t]=Dt(n)?n.toJson():n,e},{})}},In=class Pi extends Array{constructor(t,...n){super(n.length);const s=(r=>!!r?.prototype?.constructor?.name)(t)?r=>new t().set(r):t;Object.defineProperty(this,"itemFactory",{value:s,enumerable:!1,configurable:!1}),this.set(n)}set(t){if(us(t)){this.length=t.length;for(let n=0;n<t.length;n++)this[n]=this.itemFactory(t[n])}return this}reset(t){if(Array.isArray(t))return new Pi(this.itemFactory,...t)}toJson(){return this.map(t=>t?.toJson?.()??t)}};function Dt(e){return e instanceof _e||e instanceof In}import{Logger as On,isArray as Ge,isBoolean as fs,isColor as ps,isFiniteNumber as We,isFunction as En,isNumber as ht,isObject as Qt,isString as gs,isValidDate as Bn,stringifyValue as ms}from"ag-charts-core";var ys=!1,z=ys?(e,t={})=>{const{optional:n=!1}=t;return kn((i,s,r)=>{const o={...t,target:i,property:s};if(n&&typeof r>"u"||e(r,o)){if(Dt(i[s])&&!Dt(r))return i[s].set(r),i[s]}else{const c=ms(r,50),a=String(s).replace(/^_*/,""),h=i.constructor.className??i.constructor.name.replace(/Properties$/,""),l=e.message?`; expecting ${Gt(e,o)}`:"";On.warn(`TempValidation!!! Property [${a}] of [${h}] cannot be set to [${c}]${l}, ignoring.`)}return r},void 0,{optional:n})}:()=>Ki,Ln=(...e)=>{const t=[];return N((n,i)=>(t.length=0,e.every(s=>{const r=s(n,i);return r||t.push(Gt(s,i)),r})),()=>t.filter(Boolean).join(" AND "))},Ft=(...e)=>N((t,n)=>e.some(i=>i(t,n)),t=>e.map(ks(t)).filter(Boolean).join(" OR ")),Ms=ne(N((e,t)=>Dt(e)||Qt(e)&&Dt(t.target[t.property]),"a properties object")),bo=ne(N(e=>Qt(e),"an object")),_n=N(fs,"a boolean"),vo=N(En,"a function"),te=N(gs,"a string"),st=Ts(N(We,"a number")),xo=N(e=>ht(e)&&!isNaN(e),"a real number"),$e=N(e=>ht(e)&&isNaN(e),"NaN"),yt=st.restrict({min:0}),So=st.restrict({min:0,max:1}),wo=Ft(st,$e),bs=Rs(N(Ge,"an array")),Mt=(e,t)=>N((n,i)=>Ge(n)&&n.every(s=>e(s,i)),n=>{const i=Gt(bs,n)??"";return typeof t=="function"?`${i} of ${t(n)}`:t?`${i} of ${t}`:i}),ee=e=>We(e)||Bn(e),vs=e=>N((t,n)=>!ee(t)||!ee(n.target[e])||t<n.target[e],`to be less than ${e}`),xs=e=>N((t,n)=>!ee(t)||!ee(n.target[e])||t>n.target[e],`to be greater than ${e}`),Gn=N(Bn,"Date object"),Co=Ft(Gn,yt),Wn="A color string can be in one of the following formats to be valid: #rgb, #rrggbb, rgb(r, g, b), rgba(r, g, b, a) or a CSS color name such as 'white', 'orange', 'cyan', etc",ze=N(ps,`color string. ${Wn}`),Po=ne(N(e=>Qt(e)&&e.type==="gradient","a color gradient object")),Ao=ne(N(e=>Qt(e)&&e.type==="pattern","a color pattern object")),ko=N(Mt(ze),`color strings. ${Wn}`),Ro=Mt(_n,"boolean values"),To=Mt(st,"numbers"),Do=Mt(te,"strings"),Fo=N(Mt(Gn),"Date objects"),No=N(Mt(Ms),"objects"),Io=Y(["butt","round","square"],"a line cap"),Oo=Y(["round","bevel","miter"],"a line join"),Eo=Y(["solid","dashed","dotted"],"a line style"),Bo=N(Mt(yt),"numbers specifying the length in pixels of alternating dashes and gaps, for example, [6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels."),Lo=Y(["top","right","bottom","left"],"a position"),Ss=Y(["normal","italic","oblique"],"a font style"),ws=Ft(Y(["normal","bold","bolder","lighter"],"a font weight"),st.restrict({min:1,max:1e3})),Cs=Y(["never","always","hyphenate","on-space"],"a text wrap strategy"),Ps=Y(["left","center","right"],"a text align"),_o=Y(["top","middle","bottom"],"a vertical align"),Go=Y(["ellipsis","hide"],"an overflow strategy"),Wo=Y(["horizontal","vertical"],"a direction"),$o=Y(["inside","outside"],"a placement"),zo=Ft(Y(["exact","nearest"],"interaction range"),st),Ho=Y(["top","bottom","left","right"]);function Y(e,t="a"){return N((n,i)=>{const s=e.find(r=>{const o=typeof r=="string"?r:r.value;return n===o});if(s==null)return!1;if(typeof s!="string"&&(s.deprecated===!0||s.deprecatedTo!=null)){const r=[`Property [%s] with value '${s.value}' is deprecated.`];s.deprecatedTo&&r.push(`Use ${s.deprecatedTo} instead.`),On.warnOnce(r.join(" "),i.property)}return!0},`${t} keyword such as ${As(e)}`)}var jo=Ft(Ln(st.restrict({min:1}),vs("maxSpacing")),$e),qo=Ft(Ln(st.restrict({min:1}),xs("minSpacing")),$e);function N(e,t){return e.message=t,e}function As(e){const t=e.filter(i=>typeof i=="string"||i.undocumented!==!0).map(i=>`'${typeof i=="string"?i:i.value}'`);if(t.length===1)return t[0];const n=t.pop();return`${t.join(", ")} or ${n}`}function Gt(e,t){return En(e.message)?e.message(t):e.message}function ks(e){return t=>Gt(t,e)}function Rs(e){return Object.assign(e,{restrict({length:t,minLength:n}={}){let i="an array";return ht(n)&&n>0?i="a non-empty array":ht(t)&&(i=`an array of length ${t}`),N(s=>Ge(s)&&(ht(t)?s.length===t:!0)&&(ht(n)?s.length>=n:!0),i)}})}function Ts(e){return Object.assign(e,{restrict({min:t,max:n}={}){const i=["a number"],s=ht(t),r=ht(n);return s&&r?i.push(`between ${t} and ${n} inclusive`):s?i.push(`greater than or equal to ${t}`):r&&i.push(`less than or equal to ${n}`),N(o=>We(o)&&(s?o>=t:!0)&&(r?o<=n:!0),i.join(" "))}})}function ne(e){return Object.assign(e,{restrict(t){return N(n=>n instanceof t,n=>Gt(e,n)??`an instance of ${t.name}`)}})}var $n=class extends _e{constructor(){super(...arguments),this.color="black"}};m([z(st,{optional:!0})],$n.prototype,"stop",2),m([z(ze,{optional:!0})],$n.prototype,"color",2);function Ds(e){let t;for(const n of e)if(n?.stop!=null){if(t!=null&&n.stop<t)return!1;t=n.stop}return!0}function zn(e){return e.flatMap((t,n)=>{const{stop:i}=t,s=e.at(n+1)?.color;return s!=null?[t,{stop:i,color:s}]:[t]})}function Fs(e,t){const n=t==="discrete"?1:0,i=e.map((s,r,{length:o})=>({stop:(r+n)/(o-1+n),color:s}));return t==="discrete"?zn(i):i}function Ns(e,t,n,i="continuous"){const s=e.map(p=>typeof p=="string"?{color:p}:p);if(s.length===0)return Fs(t,i);if(!Ds(s))return ls.warnOnce("[fills] must have the stops defined in ascending order"),[];const r=Math.min(...n),o=Math.max(...n),c=i==="discrete",a=new Float64Array(s.length);let h=0,l=-1;for(let p=0;p<s.length;p+=1){const y=s[p];if(p>=l){l=s.length-1;for(let M=p+1;M<s.length;M+=1)if(s[M]?.stop!=null){l=M;break}}let g=y?.stop;if(g==null){const M=s[h]?.stop,v=s[l]?.stop,S=M??r,R=v??o,w=c&&M==null?1:0;g=S+(R-S)*(p-h+w)/(l-h+w)}else h=p;a[p]=Math.max(0,Math.min(1,(g-r)/(o-r)))}let u=s.find(p=>p.color!=null)?.color,d;const f=s.map((p,y)=>{let g=p?.color;const M=a[y];return g!=null?u=g:u!=null?g=u:(d==null&&(d=new Kt,d.domain=[0,1],d.range=t),g=d.convert(M)),{stop:M,color:g}});return i==="discrete"?zn(f):f}import{createSvgElement as He}from"ag-charts-core";import{Logger as je,getWindow as Is,toArray as Hn}from"ag-charts-core";var Os=2e3,jn=Date.now(),Es=()=>{const e=Date.now()-jn;if(e>Os){const t=(Math.floor(e/100)/10).toFixed(1);je.log(`**** ${t}s since last log message ****`)}jn=Date.now()},X={create(...e){return Object.assign((...n)=>{X.check(...e)&&(typeof n[0]=="function"&&(n=Hn(n[0]())),Es(),je.log(...n))},{check:()=>X.check(...e),group:(n,i)=>X.check(...e)?je.logGroup(n,i):i()})},check(...e){return e.length===0&&e.push(!0),Hn(Is("agChartsDebug")).some(n=>e.includes(n))},inDevelopmentMode(e){if(X.check("dev"))return e()}};function qn({context:e,pixelRatio:t,width:n,height:i}){e.save(),e.resetTransform(),e.clearRect(0,0,Math.ceil(n*t),Math.ceil(i*t)),e.restore()}function Yn(e){if(X.check("canvas")){const t=e.save.bind(e),n=e.restore.bind(e);let i=0;Object.assign(e,{save(){t(),i++},restore(){if(i===0)throw new Error("AG Charts - Unable to restore() past depth 0");n(),i--},verifyDepthZero(){if(i!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${i}`)}})}}function Xn(e,t,n){return[Math.floor(e*n),Math.floor(t*n)]}var qe=class{constructor(e){const{width:t,height:n,pixelRatio:i,willReadFrequently:s=!1}=e;this.width=t,this.height=n,this.pixelRatio=i;const[r,o]=Xn(t,n,i);this.canvas=new OffscreenCanvas(r,o),this.context=this.canvas.getContext("2d",{willReadFrequently:s}),this.context.setTransform(i,0,0,i,0,0),Yn(this.context)}drawImage(e,t=0,n=0){return e.drawImage(this.canvas,t,n)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(e,t,n){if(!(e>0&&t>0))return;const{canvas:i,context:s}=this;if(e!==this.width||t!==this.height||n!==this.pixelRatio){const[r,o]=Xn(e,t,n);i.width=r,i.height=o}s.setTransform(n,0,0,n,0,0),this.width=e,this.height=t,this.pixelRatio=n}clear(){qn(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 Bs}from"ag-charts-core";function Wt(e,t,n,i){const s=e-n,r=t-i;return s*s+r*r}function ie(e,t,n,i,s,r,o){if(n===s&&i===r)return Math.min(o,Wt(e,t,n,i));const c=s-n,a=r-i,h=Math.max(0,Math.min(1,((e-n)*c+(t-i)*a)/(c*c+a*a))),l=n+h*c,u=i+h*a;return Math.min(o,Wt(e,t,l,u))}function Ls(e,t,n,i,s,r,o,c,a){c&&([o,r]=[r,o]);const h=Math.atan2(t-i,e-n);if(!Tt(h,r,o)){const u=n+Math.cos(r)*s,d=i+Math.sin(r)*s,f=n+Math.cos(r)*s,p=i+Math.sin(r)*s;return Math.min(a,Wt(e,t,u,d),Wt(e,t,f,p))}const l=s-Math.sqrt(Wt(e,t,n,i));return Math.min(a,l*l)}function _s(e,t){const n=-t/e;return e!==0&&n>=0&&n<=1?[n]:[]}function Gs(e,t,n){if(e===0)return _s(t,n);const i=t*t-4*e*n,s=[];if(i===0){const r=-t/(2*e);r>=0&&r<=1&&s.push(r)}else if(i>0){const r=Math.sqrt(i),o=(-t-r)/(2*e),c=(-t+r)/(2*e);o>=0&&o<=1&&s.push(o),c>=0&&c<=1&&s.push(c)}return s}function Ws(e,t,n,i){if(e===0)return Gs(t,n,i);const s=t/e,r=n/e,o=i/e,c=(3*r-s*s)/9,a=(9*s*r-27*o-2*s*s*s)/54,h=c*c*c+a*a,l=1/3,u=[];if(h>=0){const d=Math.sqrt(h),f=Math.sign(a+d)*Math.pow(Math.abs(a+d),l),p=Math.sign(a-d)*Math.pow(Math.abs(a-d),l),y=Math.abs(Math.sqrt(3)*(f-p)/2),g=-l*s+(f+p);if(g>=0&&g<=1&&u.push(g),y===0){const M=-l*s-(f+p)/2;M>=0&&M<=1&&u.push(M)}}else{const d=Math.acos(a/Math.sqrt(-c*c*c)),f=l*s,p=2*Math.sqrt(-c),y=p*Math.cos(l*d)-f,g=p*Math.cos(l*(d+2*Math.PI))-f,M=p*Math.cos(l*(d+4*Math.PI))-f;y>=0&&y<=1&&u.push(y),g>=0&&g<=1&&u.push(g),M>=0&&M<=1&&u.push(M)}return u}function se(e,t,n,i,s,r,o,c){const a=(n-e)*(c-r)-(i-t)*(o-s);if(a===0)return 0;const h=((o-s)*(t-r)-(e-s)*(c-r))/a,l=((n-e)*(t-r)-(i-t)*(e-s))/a;return h>=0&&h<=1&&l>=0&&l<=1?1:0}function $s(e,t,n,i,s,r,o,c,a,h,l,u){let d=0;const f=h-u,p=l-a,y=a*(u-h)-h*(l-a),g=Vn(e,n,s,o),M=Vn(t,i,r,c),v=f*g[0]+p*M[0],S=f*g[1]+p*M[1],R=f*g[2]+p*M[2],w=f*g[3]+p*M[3]+y,T=Ws(v,S,R,w);for(const b of T){const x=b*b,A=b*x,P=g[0]*A+g[1]*x+g[2]*b+g[3],F=M[0]*A+M[1]*x+M[2]*b+M[3];let _;a===l?_=(F-h)/(u-h):_=(P-a)/(l-a),_>=0&&_<=1&&d++}return d}function Vn(e,t,n,i){return[-e+3*t-3*n+i,3*e-6*t+3*n,-3*e+3*t,e]}function zs(e,t,n,i,s,r,o,c,a,h){if(isNaN(e)||isNaN(t))return 0;r&&([s,i]=[i,s]);const l=(h-c)/(a-o),u=c-l*o,d=Math.pow(l,2)+1,f=2*(l*(u-t)-e),p=Math.pow(e,2)+Math.pow(u-t,2)-Math.pow(n,2),y=Math.pow(f,2)-4*d*p;if(y<0)return 0;const g=(-f+Math.sqrt(y))/2/d,M=(-f-Math.sqrt(y))/2/d;let v=0;return[g,M].forEach(S=>{if(!(S>=Math.min(o,a)&&S<=Math.max(o,a)))return;const w=l*S+u,T=S-e,b=w-t,x=Math.atan2(b,T);Tt(x,i,s)&&v++}),v}function Un(e,t,n,i,s){return(1-s)**3*e+3*(1-s)**2*s*t+3*(1-s)*s**2*n+s**3*i}function Jn(e,t,n,i){const s=-e+3*t-3*n+i,r=3*e-6*t+3*n,o=-3*e+3*t;if(s===0){if(r!==0){const a=-o/r;if(a>0&&a<1)return[a]}return[]}const c=r*r-4*s*o;if(c>=0){const a=Math.sqrt(c),h=(-r+a)/(2*s),l=(-r-a)/(2*s);return[h,l].filter(u=>u>0&&u<1)}return[]}function Hs(e,t,n,i,s,r,o,c){const a=Jn(e,n,s,o),h=Jn(t,i,r,c);return[...a,...h]}var $t=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,n,i){this.moveTo(e,t),this.lineTo(e+n,t),this.lineTo(e+n,t+i),this.lineTo(e,t+i),this.closePath()}roundRect(e,t,n,i,s){s=Math.min(s,n/2,i/2),this.moveTo(e,t+s),this.arc(e+s,t+s,s,Math.PI,1.5*Math.PI),this.lineTo(e+s,t),this.lineTo(e+n-s,t),this.arc(e+n-s,t+s,s,1.5*Math.PI,2*Math.PI),this.lineTo(e+n,t+s),this.lineTo(e+n,t+i-s),this.arc(e+n-s,t+i-s,s,0,Math.PI/2),this.lineTo(e+n-s,t+i),this.lineTo(e+s,t+i),this.arc(e+ +s,t+i-s,s,Math.PI/2,Math.PI),this.lineTo(e,t+i-s),this.closePath()}arc(e,t,n,i,s,r){this.openedPath=!0,this.path2d.arc(e,t,n,i,s,r),this.commands.push(2),this.params.push(e,t,n,i,s,r?1:0)}cubicCurveTo(e,t,n,i,s,r){this.openedPath||this.moveTo(e,t),this.path2d.bezierCurveTo(e,t,n,i,s,r),this.commands.push(3),this.params.push(e,t,n,i,s,r)}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 n=this.commands,i=this.params,s=n.length,r=-1e4,o=-1e4;let c=NaN,a=NaN,h=0,l=0,u=0;for(let d=0,f=0;d<s;d++)switch(n[d]){case 0:u+=se(c,a,h,l,r,o,e,t),h=i[f++],c=h,l=i[f++],a=l;break;case 1:u+=se(h,l,i[f++],i[f++],r,o,e,t),h=i[f-2],l=i[f-1];break;case 3:u+=$s(h,l,i[f++],i[f++],i[f++],i[f++],i[f++],i[f++],r,o,e,t),h=i[f-2],l=i[f-1];break;case 2:{const p=i[f++],y=i[f++],g=i[f++],M=i[f++],v=i[f++],S=!!i[f++];if(u+=zs(p,y,g,M,v,S,r,o,e,t),!isNaN(c)){const R=p+Math.cos(M)*g,w=y+Math.sin(M)*g;u+=se(h,l,R,w,r,o,e,t)}h=p+Math.cos(v)*g,l=y+Math.sin(v)*g;break}case 4:u+=se(c,a,h,l,r,o,e,t);break}return u%2===1}distanceSquared(e,t){let n=1/0;const i=this.commands,s=this.params,r=i.length;let o=NaN,c=NaN,a=0,h=0;for(let l=0,u=0;l<r;l++)switch(i[l]){case 0:a=o=s[u++],h=c=s[u++];break;case 1:{const d=s[u++],f=s[u++];n=ie(e,t,a,h,d,f,n);break}case 3:Bs.error("Command.Curve distanceSquare not implemented");break;case 2:{const d=s[u++],f=s[u++],p=s[u++],y=s[u++],g=s[u++],M=d+Math.cos(y)*p,v=f+Math.sin(y)*p,S=!!s[u++];n=ie(e,t,a,h,M,v,n),n=Ls(e,t,d,f,p,y,g,S,n),a=d+Math.cos(g)*p,h=f+Math.sin(g)*p;break}case 4:n=ie(e,t,a,h,o,c,n);break}return n}toSVG(e=(t,n)=>({x:t,y:n})){const t=[],{commands:n,params:i}=this,s=(o,...c)=>{t.push(o);for(let a=0;a<c.length;a+=2){const{x:h,y:l}=e(c[a],c[a+1]);t.push(h,l)}};let r=0;for(const o of n)switch(o){case 0:s("M",i[r++],i[r++]);break;case 1:s("L",i[r++],i[r++]);break;case 3:s("C",i[r++],i[r++],i[r++],i[r++],i[r++],i[r++]);break;case 2:{const c=i[r++],a=i[r++],h=i[r++],l=i[r++],u=i[r++],d=i[r++];let f=d?l-u:u-l;f<0&&(f+=Math.ceil(-f/(2*Math.PI))*2*Math.PI),d&&(f=-f);const p=Math.max(Math.ceil(Math.abs(f)/(Math.PI/2)),1),y=f/p,g=4/3*Math.tan(y/4),M=t.length===0?"M":"L";s(M,c+Math.cos(l)*h,a+Math.sin(l)*h);for(let v=0;v<p;v+=1){const S=l+y*(v+0),R=l+y*(v+1),w=h*Math.sin(S),T=h*Math.cos(S),b=h*Math.sin(R),x=h*Math.cos(R);s("C",c+T-g*w,a+w+g*T,c+x+g*b,a+b-g*x,c+x,a+b)}break}case 4:t.push("Z");break}return t.join(" ")}computeBBox(){const{commands:e,params:t}=this;let[n,i,s,r]=[1/0,1/0,-1/0,-1/0],[o,c]=[NaN,NaN],[a,h]=[NaN,NaN];const l=(d,f,p)=>{n=Math.min(f,n),i=Math.min(d,i),s=Math.max(d,s),r=Math.max(f,r),p&&([o,c]=[d,f])};let u=0;for(const d of e)switch(d){case 0:l(t[u++],t[u++],!0),[a,h]=[o,c];break;case 1:l(t[u++],t[u++],!0);break;case 3:{const f=t[u++],p=t[u++],y=t[u++],g=t[u++],M=t[u++],v=t[u++];l(M,v,!0),Hs(o,c,f,p,y,g,M,v).forEach(R=>{const w=Un(o,f,y,M,R),T=Un(c,p,g,v,R);l(w,T)});break}case 2:{const f=t[u++],p=t[u++],y=t[u++];let g=B(t[u++]),M=B(t[u++]);t[u++]&&([g,M]=[M,g]);const S=(w,T)=>{const b=f+y*Math.cos(w),x=p+y*Math.sin(w);l(b,x,T)};S(g),S(M,!0);const R=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const w of R)(g<M&&g<=w&&w<=M||g>M&&(g<=w||w<=M))&&S(w);break}case 4:[o,c]=[a,h];break}return new $(i,n,s-i,r-n)}};function L(e,t,n){const i=Math.round(t*e)/e;return n==null?i:n===0?0:n<1?Math.ceil(n*e)/e:Math.round((n+t)*e)/e-i}function Kn(e,t){return Math.floor(t*e)/e}function Ye(e,t,n){const{width:i,height:s,padding:r,strokeWidth:o}=t,c=i/2,a=s/2,h=Math.max(1,i-r-o/2),l=Math.max(1,s-r-o/2);let u=!1;for(const[d,f]of n){const p=c+(d-.5)*h,y=a+(f-.5)*l;u?e.lineTo(p,y):e.moveTo(p,y),u=!0}e.closePath()}var js={circles(e,{width:t,strokeWidth:n,padding:i}){const s=t/2,r=Math.max(1,s-i-n/2);e.arc(s,s,r,0,Math.PI*2)},squares(e,{width:t,height:n,pixelRatio:i,padding:s,strokeWidth:r}){const o=s+r/2;e.moveTo(L(i,o),L(i,o)),e.lineTo(L(i,t-o),L(i,o)),e.lineTo(L(i,t-o),L(i,n-o)),e.lineTo(L(i,o),L(i,n-o)),e.closePath()},triangles(e,t){Ye(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){Ye(e,t,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(e,{width:t,height:n,padding:i}){const r=Math.max(1,(t-i)/2),o=r/2,c=Math.PI/2;for(let a=0;a<5*2;a++){const h=a%2===0?r:o,l=a*Math.PI/5-c,u=t/2+Math.cos(l)*h,d=n/2+Math.sin(l)*h;e.lineTo(u,d)}e.closePath()},hearts(e,{width:t,height:n,padding:i}){const s=Math.max(1,t/4-i/2),r=t/2,o=n/2+s/2;e.arc(r-s,o-s,s,J(130),J(330)),e.arc(r+s,o-s,s,J(220),J(50)),e.lineTo(r,o+s),e.closePath()},crosses(e,t){Ye(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:n,pixelRatio:i,strokeWidth:s}){const r=L(i,t/2)-s%2/2;e.moveTo(r,0),e.lineTo(r,n)},"horizontal-lines"(e,{width:t,height:n,pixelRatio:i,strokeWidth:s}){const r=L(i,n/2)-s%2/2;e.moveTo(0,r),e.lineTo(t,r)},"forward-slanted-lines"(e,{width:t,height:n,strokeWidth:i}){const s=Math.atan2(n,t),r=i*Math.cos(s),o=i*Math.sin(s);e.moveTo(-r,o),e.lineTo(r,-o),e.moveTo(-r,n+o),e.lineTo(t+r,-o),e.moveTo(t-r,n+o),e.lineTo(t+r,n-o)},"backward-slanted-lines"(e,{width:t,height:n,strokeWidth:i}){const s=Math.atan2(n,t),r=i*Math.cos(s),o=i*Math.sin(s);e.moveTo(t-r,-o),e.lineTo(t+r,o),e.moveTo(-r,-o),e.lineTo(t+r,n+o),e.moveTo(-r,n-o),e.lineTo(r,n+o)}},qs=class{constructor(e,t=1){this.pixelRatio=t,this._cache=void 0,this.width=Math.max(e?.width??10,1),this.height=Math.max(e?.height??10,1),this.fill=e.fill??"transparent",this.fillOpacity=e.fillOpacity??1,this.backgroundFill=e.backgroundFill??"transparent",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}getPath(){const{pattern:e,width:t,height:n,padding:i,strokeWidth:s,pixelRatio:r}=this,o=new $t;return js[e](o,{width:t,height:n,pixelRatio:r,strokeWidth:s,padding:i}),o}renderStroke(e,t){const{stroke:n,strokeWidth:i,strokeOpacity:s}=this;i&&(t.strokeStyle=n,t.lineWidth=i,t.globalAlpha=s,t.stroke(e))}renderFill(e,t){const{fill:n,fillOpacity:i}=this;t.fillStyle=n,t.globalAlpha=i,t.fill(e)}createCanvasPattern(e){const{width:t,height:n,backgroundFill:i,backgroundFillOpacity:s,pixelRatio:r,rotation:o}=this,c=new qe({width:t,height:n,pixelRatio:r}),a=c.context;a.fillStyle=i,a.globalAlpha=s,a.fillRect(0,0,t,n);const h=this.getPath().getPath2D();this.renderFill(h,a),this.renderStroke(h,a);const l=e.createPattern(c.canvas,"repeat"),u=B(J(o)),d=1/r,f=Math.cos(u)*d,p=Math.sin(u)*d;return l?.setTransform(new DOMMatrix([f,p,-p,f,0,0])),c.destroy(),l}createPattern(e){if(this._cache!=null&&this._cache.ctx===e)return this._cache.pattern;const t=this.createCanvasPattern(e);if(t!=null)return this._cache={ctx:e,pattern:t},t}toSvg(){const{width:e,height:t,fill:n,fillOpacity:i,backgroundFill:s,backgroundFillOpacity:r,stroke:o,strokeWidth:c,strokeOpacity:a,rotation:h}=this,l=He("pattern");l.setAttribute("viewBox",`0 0 ${e} ${t}`),l.setAttribute("width",String(e)),l.setAttribute("height",String(t)),l.setAttribute("patternUnits","userSpaceOnUse");const u=He("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(e)),u.setAttribute("height",String(t)),u.setAttribute("fill",s),u.setAttribute("fill-opacity",String(r)),l.appendChild(u);const d=He("path");return d.setAttribute("fill",n),d.setAttribute("fill-opacity",String(i)),d.setAttribute("stroke-opacity",String(a)),d.setAttribute("stroke",o),d.setAttribute("stroke-width",String(c)),d.setAttribute("transform",`rotate(${h})`),d.setAttribute("d",this.getPath().toSVG()),l.appendChild(d),l}};import{isObject as Zn}from"ag-charts-core";function Qn(e){return Zn(e)&&e.type=="gradient"}function ti(e){return e!==null&&Zn(e)&&e.type=="pattern"}var H=class et extends Bt{constructor(){super(...arguments),this.fillOpacity=1,this.strokeOpacity=1,this.fill=et.defaultStyles.fill,this.stroke=et.defaultStyles.stroke,this.strokeWidth=et.defaultStyles.strokeWidth,this.lineDash=et.defaultStyles.lineDash,this.lineDashOffset=et.defaultStyles.lineDashOffset,this.lineCap=et.defaultStyles.lineCap,this.lineJoin=et.defaultStyles.lineJoin,this.miterLimit=void 0,this.opacity=et.defaultStyles.opacity,this.fillShadow=et.defaultStyles.fillShadow}restoreOwnStyles(){const{defaultStyles:t}=this.constructor;Object.assign(this,t)}getGradient(t){if(Qn(t))return this.createGradient(t)}createGradient(t){const{colorSpace:n="rgb",gradient:i="linear",colorStops:s,rotation:r=0,reverse:o=!1}=t;if(s==null)return;let c=Ns(s,["black"],[0,1]);switch(o&&(c=c.map(a=>({color:a.color,stop:1-a.stop})).reverse()),i){case"linear":return new as(n,c,r);case"radial":return new hs(n,c);case"conic":return new rs(n,c,r)}}getPattern(t){if(ti(t))return this.createPattern(t)}createPattern(t){const n=this.layerManager?.canvas?.pixelRatio??1;return new qs(t,n)}onFillChange(){typeof this.fill=="object"&&Te(this._cachedFill??{},this.fill)||(this.fillGradient=this.getGradient(this.fill),this.fillPattern=this.getPattern(this.fill),this._cachedFill=this.fill)}onStrokeChange(){this.strokeGradient=this.getGradient(this.stroke)}align(t,n){return L(this.layerManager?.canvas?.pixelRatio??1,t,n)}preRender(t,n){return this.dirty&&(this.cachedDefaultGradientFillBBox=void 0),super.preRender(t,n)}fillStroke(t,n){this.renderFill(t,n),this.renderStroke(t,n)}renderFill(t,n){if(this.fill){const{globalAlpha:i}=t;this.applyFill(t),this.applyFillAlpha(t),this.applyShadow(t),this.executeFill(t,n),t.globalAlpha=i}t.shadowColor="rgba(0, 0, 0, 0)"}executeFill(t,n){n?t.fill(n):t.fill()}applyFill(t){const{fill:n,fillGradient:i,fillBBox:s=this.getDefaultGradientFillBBox()??this.getBBox(),fillParams:r}=this,o=s?i?.createGradient(t,s,r):void 0,c=this.fillPattern?.createPattern(t);t.fillStyle=c??o??(typeof n=="string"?n:void 0)??"black"}applyStroke(t){t.strokeStyle=this.strokeGradient?.createGradient(t,this.getBBox())??(typeof this.stroke=="string"?this.stroke:void 0)??"black"}applyFillAlpha(t){t.globalAlpha*=this.opacity*this.fillOpacity}applyShadow(t){const n=this.layerManager?.canvas.pixelRatio??1,i=this.fillShadow;i?.enabled&&(t.shadowColor=i.color,t.shadowOffsetX=i.xOffset*n,t.shadowOffsetY=i.yOffset*n,t.shadowBlur=i.blur*n)}renderStroke(t,n){if(this.stroke&&this.strokeWidth){const{globalAlpha:i}=t;this.applyStroke(t),t.globalAlpha*=this.opacity*this.strokeOpacity,t.lineWidth=this.strokeWidth,this.lineDash&&t.setLineDash(this.lineDash),this.lineDashOffset&&(t.lineDashOffset=this.lineDashOffset),this.lineCap&&(t.lineCap=this.lineCap),this.lineJoin&&(t.lineJoin=this.lineJoin),this.miterLimit!=null&&(t.miterLimit=this.miterLimit),this.executeStroke(t,n),t.globalAlpha=i}}executeStroke(t,n){n?t.stroke(n):t.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox==null&&(this.cachedDefaultGradientFillBBox=Object.freeze(this.computeDefaultGradientFillBBox())),this.cachedDefaultGradientFillBBox}computeDefaultGradientFillBBox(){}containsPoint(t,n){return this.isPointInPath(t,n)}applySvgFillAttributes(t,n){const{fill:i,fillOpacity:s}=this;if(typeof i=="string")t.setAttribute("fill",i);else if(Qn(i)&&this.fillGradient){n??(n=[]);const r=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),o=Mn();r.setAttribute("id",o),n.push(r),t.setAttribute("fill",`url(#${o})`)}else if(ti(i)&&this.fillPattern){n??(n=[]);const r=this.fillPattern.toSvg(),o=Mn();r.setAttribute("id",o),n.push(r),t.setAttribute("fill",`url(#${o})`)}else t.setAttribute("fill","none");return t.setAttribute("fill-opacity",String(s)),n}applySvgStrokeAttributes(t){const{stroke:n,strokeOpacity:i,strokeWidth:s,lineDash:r,lineDashOffset:o}=this;if(n!=null&&(t.setAttribute("stroke",typeof n=="string"?n:"none"),t.setAttribute("stroke-opacity",String(i)),t.setAttribute("stroke-width",String(s))),r?.some(c=>c!==0)===!0){const c=r.length%2===1?[...r,...r]:r;t.setAttribute("stroke-dasharray",c.join(" ")),t.setAttribute("stroke-dashoffset",String(o))}}};H.defaultStyles={fill:"black",stroke:void 0,strokeWidth:0,lineDash:void 0,lineDashOffset:0,lineCap:void 0,lineJoin:void 0,opacity:1,fillShadow:void 0},m([k()],H.prototype,"fillOpacity",2),m([k()],H.prototype,"strokeOpacity",2),m([k({changeCb:e=>e.onFillChange()})],H.prototype,"fill",2),m([k({changeCb:e=>e.onStrokeChange()})],H.prototype,"stroke",2),m([k()],H.prototype,"strokeWidth",2),m([k()],H.prototype,"lineDash",2),m([k()],H.prototype,"lineDashOffset",2),m([k()],H.prototype,"lineCap",2),m([k()],H.prototype,"lineJoin",2),m([k()],H.prototype,"miterLimit",2),m([k({convertor:e=>Ui(0,e,1)})],H.prototype,"opacity",2),m([k({checkDirtyOnAssignment:!0})],H.prototype,"fillShadow",2),m([k({changeCb:e=>e.onFillChange()})],H.prototype,"fillBBox",2),m([k({changeCb:e=>e.onFillChange()})],H.prototype,"fillParams",2);var rt=H,U=class ve extends rt{constructor(){super(...arguments),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontSize=10,this.fontFamily="sans-serif",this.textAlign=ve.defaultStyles.textAlign,this.textBaseline=ve.defaultStyles.textBaseline}onTextChange(){this.lines=this.text?.split(`
`).map(t=>t.trim())??[]}static computeBBox(t,n,i,s){const{offsetTop:r,offsetLeft:o,width:c,height:a}=Pe.measureLines(t,s);return new $(n-o,i-r,c,a)}computeBBox(){const{x:t,y:n,lines:i,textBaseline:s,textAlign:r}=this;return ve.computeBBox(i,t,n,{font:this,textBaseline:s,textAlign:r})}isPointInPath(t,n){const i=this.getBBox();return i?i.containsPoint(t,n):!1}render(t){const{ctx:n,stats:i}=t;if(!this.lines.length||!this.layerManager)return i&&(i.nodesSkipped+=1),super.render(t);const{fill:s,stroke:r,strokeWidth:o}=this,{pixelRatio:c}=this.layerManager.canvas;if(!s&&!(r!=null&&o>0))return super.render(t);const a=G.toFontString(this);if(n.font!==a&&(n.font=a),n.textAlign=this.textAlign,n.textBaseline=this.textBaseline,s){this.applyFill(n),n.globalAlpha*=this.opacity*this.fillOpacity;const{fillShadow:h}=this;h?.enabled&&(n.shadowColor=h.color,n.shadowOffsetX=h.xOffset*c,n.shadowOffsetY=h.yOffset*c,n.shadowBlur=h.blur*c),this.renderLines((l,u,d)=>n.fillText(l,u,d))}if(r&&o){this.applyStroke(n),n.lineWidth=o,n.globalAlpha*=this.opacity*this.strokeOpacity;const{lineDash:h,lineDashOffset:l,lineCap:u,lineJoin:d}=this;h&&n.setLineDash(h),l&&(n.lineDashOffset=l),u&&(n.lineCap=u),d&&(n.lineJoin=d),this.renderLines((f,p,y)=>n.strokeText(f,p,y))}super.render(t)}renderLines(t){const{lines:n,x:i,y:s}=this,r=this.lineHeight??G.getLineHeight(this.fontSize);let o=(r-r*n.length)*G.getVerticalModifier(this.textBaseline);for(const c of n)t(c,i,s+o),o+=r}setFont(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.fontStyle=t.fontStyle,this.fontWeight=t.fontWeight}setAlign(t){this.textAlign=t.textAlign,this.textBaseline=t.textBaseline}toSVG(){if(!this.visible||!this.text)return;const t=qi("text");return this.applySvgFillAttributes(t),t.setAttribute("font-family",this.fontFamily?.split(",")[0]??""),t.setAttribute("font-size",String(this.fontSize)),t.setAttribute("font-style",this.fontStyle??""),t.setAttribute("font-weight",String(this.fontWeight??"")),t.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),t.setAttribute("alignment-baseline",{alphabetic:"alphabetic",top:"top",bottom:"bottom",hanging:"hanging",middle:"middle",ideographic:"ideographic"}[this.textBaseline??"alphabetic"]),t.setAttribute("x",String(this.x)),t.setAttribute("y",String(this.y)),t.textContent=this.text??"",{elements:[t]}}};U.className="Text",U.defaultStyles={...rt.defaultStyles,textAlign:"start",fontStyle:void 0,fontWeight:void 0,fontSize:10,fontFamily:"sans-serif",textBaseline:"alphabetic"},m([k()],U.prototype,"x",2),m([k()],U.prototype,"y",2),m([k({changeCb:e=>e.onTextChange()})],U.prototype,"text",2),m([k()],U.prototype,"fontStyle",2),m([k()],U.prototype,"fontWeight",2),m([k()],U.prototype,"fontSize",2),m([k()],U.prototype,"fontFamily",2),m([k()],U.prototype,"textAlign",2),m([k()],U.prototype,"textBaseline",2),m([k()],U.prototype,"lineHeight",2);var ei=U,Ys=class extends Lt(ei){},Ko=class extends Lt(Vt(ei)){};import"ag-charts-core";function lt(e,t){return kn((n,i,s)=>n[e][t??i]=s)}function Xs(e){return Zi(e)}var Vs=class{static wrapText(e,t){return this.wrapLines(e,t).join(`
`)}static wrapLines(e,t){const n=this.textWrap(e,t);return t.overflow==="hide"&&n.some(i=>i.endsWith(G.EllipsisChar))?[]:n}static appendEllipsis(e){return e.replace(/[.,]{1,5}$/,"")+G.EllipsisChar}static truncateLine(e,t,n,i){const s=t.textWidth(G.EllipsisChar);let r=0,o=0;for(;o<e.length;o++){const c=t.textWidth(e.charAt(o));if(r+c>n)break;r+=c}if(e.length===o&&(!i||r+s<=n))return i?e+G.EllipsisChar:e;for(e=e.slice(0,o).trimEnd();e.length&&t.textWidth(e)+s>n;)e=e.slice(0,-1).trimEnd();return e+G.EllipsisChar}static textWrap(e,t){const n=e.split(G.lineSplitter),i=Pe.getMeasurer(t);if(t.textWrap==="never")return n.map(c=>this.truncateLine(c.trimEnd(),i,t.maxWidth));const s=[],r=t.textWrap==="hyphenate",o=t.textWrap==null||t.textWrap==="on-space";for(const c of n){let a=c.trimEnd();if(a===""){s.push(a);continue}let h=0,l=0,u=0;for(;h<a.length;){const d=a.charAt(h);if(l+=i.textWidth(d),d===" "&&(u=h),l>t.maxWidth){if(h===0)break;const f=i.textWidth(a.slice(0,h+1));if(f<=t.maxWidth){l=f,h++;continue}if(u){const g=this.getWordAt(a,u+1),M=i.textWidth(g);if(M<=t.maxWidth){s.push(a.slice(0,u).trimEnd()),a=a.slice(u).trimStart(),h=0,l=0,u=0;continue}else o&&M>t.maxWidth&&s.push(a.slice(0,u).trimEnd(),this.truncateLine(a.slice(u).trimStart(),i,t.maxWidth,!0))}else o&&s.push(this.truncateLine(a,i,t.maxWidth,!0));if(o){a="";break}const p=r?"-":"";let y=a.slice(0,h).trim();for(;y.length&&i.textWidth(y+p)>t.maxWidth;)y=y.slice(0,-1).trimEnd();if(s.push(y+p),!y.length){a="";break}a=a.slice(y.length).trimStart(),h=-1,l=0,u=0}h++}a&&s.push(a)}return this.avoidOrphans(s,i,t),this.clipLines(s,i,t)}static getWordAt(e,t){const n=e.indexOf(" ",t);return n===-1?e.slice(t):e.slice(t,n)}static clipLines(e,t,n){if(!n.maxHeight)return e;const{height:i,lineMetrics:s}=t.measureLines(e);if(i<=n.maxHeight)return e;for(let r=0,o=0;r<s.length;r++){const{lineHeight:c}=s[r];if(o+=c,o>n.maxHeight){if(n.overflow==="hide")return[];const a=e.slice(0,r||1),h=a.pop();return a.concat(this.truncateLine(h,t,n.maxWidth,!0))}}return e}static avoidOrphans(e,t,n){if(n.avoidOrphans===!1||e.length<2)return;const{length:i}=e,s=e[i-1],r=e[i-2];if(r.length<s.length)return;const o=r.lastIndexOf(" ");if(o===-1||o===r.indexOf(" ")||s.includes(" "))return;const c=r.slice(o+1);t.textWidth(s+c)<=n.maxWidth&&(e[i-2]=r.slice(0,o),e[i-1]=c+" "+s)}},j=class extends _e{constructor(){super(...arguments),this.id=Ce(this),this.node=new Ys({zIndex:1}).setProperties({textAlign:"center",pointerEvents:1}),this.enabled=!1,this.textAlign="center",this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always",this.padding=0,this.layoutStyle="block",this.truncated=!1}registerInteraction(e,t){return e.layoutManager.addListener("layout:complete",()=>this.updateA11yText(e,t))}computeTextWrap(e,t){const{text:n,padding:i,wrapping:s}=this,r=Math.min(this.maxWidth??1/0,e)-i*2,o=this.maxHeight??t-i*2;if(!isFinite(r)&&!isFinite(o)){this.node.text=n;return}const c=Vs.wrapText(n??"",{maxWidth:r,maxHeight:o,font:this,textWrap:s});this.node.text=c,this.truncated=c.includes(G.EllipsisChar)}updateA11yText(e,t){const{proxyInteractionService:n}=e;if(this.enabled&&this.text){const i=kt.toCanvas(this.node);if(i){const{id:s}=this;this.proxyText??(this.proxyText=n.createProxyElement({type:"text",domManagerId:s,where:t})),this.proxyText.textContent=this.text,this.proxyText.setBounds(i),this.proxyText.addListener("mousemove",r=>this.handleMouseMove(e,r)),this.proxyText.addListener("mouseleave",r=>this.handleMouseLeave(e,r))}}else this.proxyText?.destroy(),this.proxyText=void 0}handleMouseMove(e,t){if(t!=null&&this.enabled&&this.node.visible&&this.truncated){const{x:n,y:i}=kt.toCanvas(this.node),s=t.sourceEvent.offsetX+n,r=t.sourceEvent.offsetY+i;e.tooltipManager.updateTooltip(this.id,{canvasX:s,canvasY:r,showArrow:!1},[{type:"structured",title:this.text}])}}handleMouseLeave(e,t){e.tooltipManager.removeTooltip(this.id)}};j.SMALL_PADDING=10,m([z(_n),lt("node","visible")],j.prototype,"enabled",2),m([z(te,{optional:!0}),lt("node")],j.prototype,"text",2),m([z(Ps,{optional:!0}),lt("node")],j.prototype,"textAlign",2),m([z(Ss,{optional:!0}),lt("node")],j.prototype,"fontStyle",2),m([z(ws,{optional:!0}),lt("node")],j.prototype,"fontWeight",2),m([z(yt),lt("node")],j.prototype,"fontSize",2),m([z(te),lt("node")],j.prototype,"fontFamily",2),m([z(ze,{optional:!0}),lt("node","fill")],j.prototype,"color",2),m([z(yt,{optional:!0})],j.prototype,"spacing",2),m([z(yt,{optional:!0})],j.prototype,"maxWidth",2),m([z(yt,{optional:!0})],j.prototype,"maxHeight",2),m([z(Cs)],j.prototype,"wrapping",2),m([z(yt)],j.prototype,"padding",2),m([z(te)],j.prototype,"layoutStyle",2);import{createSvgElement as Us}from"ag-charts-core";function C(e){const{changeCb:t,convertor:n}=e??{};return k({type:"path",convertor:n,changeCb:t})}var tt=class extends rt{constructor(){super(...arguments),this.path=new $t,this._clipX=NaN,this._clipY=NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=NaN}set clipX(e){this._clipX=e,this.dirtyPath=!0}set clipY(e){this._clipY=e,this.dirtyPath=!0}set dirtyPath(e){this._dirtyPath!==e&&(this._dirtyPath=e,e&&this.markDirty("path"))}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}computeBBox(){return this.updatePathIfDirty(),this.path.computeBBox()}isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}distanceSquared(e,t){return this.distanceSquaredTransformedPoint(e,t)}svgPathData(e){return this.updatePathIfDirty(),this.path.toSVG(e)}distanceSquaredTransformedPoint(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)?0:this.path.distanceSquared(e,t)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(e){return e.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=e.devicePixelRatio,this.updatePathIfDirty(),super.preRender(e,this.path.commands.length)}render(e){const{ctx:t}=e;if(this.clip&&!isNaN(this._clipX)&&!isNaN(this._clipY)){t.save();const n=this.strokeWidth/2;this._clipPath??(this._clipPath=new $t),this._clipPath.clear(),this._clipPath.rect(-n,-n,this._clipX+n,this._clipY+n+n),t.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(t),t.restore()}else this._clipPath=void 0,this.drawPath(t);this.fillShadow?.markClean(),super.render(e)}drawPath(e){this.fillStroke(e,this.path.getPath2D())}toSVG(){if(!this.visible)return;const e=Us("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};tt.className="Path",m([C()],tt.prototype,"clip",2),m([C()],tt.prototype,"clipX",1),m([C()],tt.prototype,"clipY",1);function re(e,t){const{path:n,size:i}=e,{x:s,y:r}=e;n.clear();let o=!1;for(const[c,a]of t){const h=s+(c-.5)*i,l=r+(a-.5)*i;o?n.lineTo(h,l):n.moveTo(h,l),o=!0}n.closePath()}var Js={circle({path:e,x:t,y:n,size:i}){const s=i/2;e.clear(),e.arc(t,n,s,0,Math.PI*2),e.closePath()},cross(e){re(e,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},diamond(e){re(e,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:e,x:t,y:n,size:i}){const s=i/4;n=n+s/2,e.clear(),e.arc(t-s,n-s,s,J(130),J(330)),e.arc(t+s,n-s,s,J(220),J(50)),e.lineTo(t,n+s),e.closePath()},pin({path:e,x:t,y:n,size:i}){e.moveTo(t+(.15625-.5)*i,n+(.34375-.5)*i),e.cubicCurveTo(t+(.15625-.5)*i,n+(.151491-.5)*i,t+(.307741-.5)*i,n+(0-.5)*i,t+(.5-.5)*i,n+(0-.5)*i),e.cubicCurveTo(t+(.692259-.5)*i,n+(0-.5)*i,t+(.84375-.5)*i,n+(.151491-.5)*i,t+(.84375-.5)*i,n+(.34375-.5)*i),e.cubicCurveTo(t+(.84375-.5)*i,n+(.493824-.5)*i,t+(.784625-.5)*i,n+(.600181-.5)*i,t+(.716461-.5)*i,n+(.695393-.5)*i),e.cubicCurveTo(t+(.699009-.5)*i,n+(.719769-.5)*i,t+(.681271-.5)*i,n+(.743104-.5)*i,t+(.663785-.5)*i,n+(.766105-.5)*i),e.cubicCurveTo(t+(.611893-.5)*i,n+(.834367-.5)*i,t+(.562228-.5)*i,n+(.899699-.5)*i,t+(.528896-.5)*i,n+(.980648-.5)*i),e.cubicCurveTo(t+(.524075-.5)*i,n+(.992358-.5)*i,t+(.512663-.5)*i,n+(1-.5)*i,t+(.5-.5)*i,n+(1-.5)*i),e.cubicCurveTo(t+(.487337-.5)*i,n+(1-.5)*i,t+(.475925-.5)*i,n+(.992358-.5)*i,t+(.471104-.5)*i,n+(.980648-.5)*i),e.cubicCurveTo(t+(.487337-.5)*i,n+(1-.5)*i,t+(.475925-.5)*i,n+(.992358-.5)*i,t+(.471104-.5)*i,n+(.980648-.5)*i),e.cubicCurveTo(t+(.437772-.5)*i,n+(.899699-.5)*i,t+(.388107-.5)*i,n+(.834367-.5)*i,t+(.336215-.5)*i,n+(.766105-.5)*i),e.cubicCurveTo(t+(.318729-.5)*i,n+(.743104-.5)*i,t+(.300991-.5)*i,n+(.719769-.5)*i,t+(.283539-.5)*i,n+(.695393-.5)*i),e.cubicCurveTo(t+(.215375-.5)*i,n+(.600181-.5)*i,t+(.15625-.5)*i,n+(.493824-.5)*i,t+(.15625-.5)*i,n+(.34375-.5)*i),e.closePath()},plus(e){re(e,[[1/3,0],[2/3,0],[2/3,1/3],[1,1/3],[1,2/3],[2/3,2/3],[2/3,1],[1/3,1],[1/3,2/3],[0,2/3],[0,1/3],[1/3,1/3]])},square({path:e,x:t,y:n,size:i,pixelRatio:s}){const r=i/2;e.clear(),e.moveTo(L(s,t-r),L(s,n-r)),e.lineTo(L(s,t+r),L(s,n-r)),e.lineTo(L(s,t+r),L(s,n+r)),e.lineTo(L(s,t-r),L(s,n+r)),e.closePath()},star({path:e,x:t,y:n,size:i}){const r=i/2,o=r/2,c=Math.PI/2;for(let a=0;a<5*2;a++){const h=a%2===0?r:o,l=a*Math.PI/5-c,u=t+Math.cos(l)*h,d=n+Math.sin(l)*h;e.lineTo(u,d)}e.closePath()},triangle(e){re(e,[[.5,0],[1,.87],[0,.87]])}},zt=class extends tt{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}updatePath(){const{path:e,shape:t,x:n,y:i,size:s}=this,r=this.layerManager?.canvas?.pixelRatio??1,o=Xe.anchor(t),c={path:e,x:n-(o.x-.5)*s,y:i-(o.y-.5)*s,size:s,pixelRatio:r};e.clear(),typeof t=="string"?Js[t](c):typeof t=="function"&&t(c)}computeBBox(){const{x:e,y:t,size:n}=this,i=Xe.anchor(this.shape);return new $(e-n*i.x,t-n*i.y,n,n)}executeFill(e,t){if(t)return super.executeFill(e,t)}executeStroke(e,t){if(t)return super.executeStroke(e,t)}};m([C()],zt.prototype,"shape",2),m([C()],zt.prototype,"x",2),m([C()],zt.prototype,"y",2),m([C({convertor:Math.abs})],zt.prototype,"size",2);var Xe=class extends Lt(Pn(Vt(zt))){static anchor(e){return e==="pin"?{x:.5,y:1}:typeof e=="function"&&"anchor"in e?e.anchor:{x:.5,y:.5}}constructor(e){super(e),e?.shape!=null&&(this.shape=e.shape)}};import"ag-charts-core";function Ks(e){if(e.length===0)return[];const t=[1/0,-1/0];for(const n of e)n<t[0]&&(t[0]=n),n>t[1]&&(t[1]=n);return t}import{Logger as Zs}from"ag-charts-core";var ni=class{constructor(e,t,n){this._encode=e,this._decode=t,this._rangeCallback=n}floor(e){const t=new Date(e),n=this._encode(t);return this._decode(n)}ceil(e){const t=new Date(Number(e)-1),n=this._encode(t);return this._decode(n+1)}range(e,t,{extend:n=!1,visibleRange:i=[0,1]}={}){let s=!1;e.getTime()>t.getTime()&&([e,t]=[t,e],s=!0);const r=this._rangeCallback?.(e,t),o=this._encode(n?this.floor(e):this.ceil(e)),c=this._encode(n?this.ceil(t):this.floor(t));if(c<o)return[];const a=c-o;let h,l;s?(h=Math.ceil(o+(1-i[1])*a),l=Math.floor(o+(1-i[0])*a)):(h=Math.floor(o+i[0]*a),l=Math.ceil(o+i[1]*a));const u=[];for(let d=h;d<=l;d+=1){const f=this._decode(d);u.push(f)}return r?.(),u}},bt=class extends ni{getOffset(e,t){return Math.floor(this._encode(new Date(e)))%t}every(e,t){let n=0,i;const s=e;e=Math.max(1,Math.round(e)),s!==e&&Zs.warnOnce(`interval step of [${s}] rounded to [${e}].`);const{snapTo:r="start"}=t??{};if(typeof r=="string"){const a=n;i=(h,l)=>{const u=r==="start"?h:l;return n=this.getOffset(u,e),()=>n=a}}else typeof r=="number"?n=this.getOffset(new Date(r),e):r instanceof Date&&(n=this.getOffset(r,e));const o=a=>Math.floor((this._encode(a)-n)/e),c=a=>this._decode(a*e+n);return new ni(o,c,i)}},vt=1e3,K=vt*60,xt=K*60,Nt=xt*24,oe=Nt*7,Ht=Nt*30,Qs=Nt*365,ii=new Date().getTimezoneOffset()*K;function tr(e){return Math.floor((e.getTime()-ii)/vt)}function er(e){return new Date(ii+e*vt)}var ae=new bt(tr,er),si=new Date().getTimezoneOffset()*K;function nr(e){return Math.floor((e.getTime()-si)/K)}function ir(e){return new Date(si+e*K)}var ce=new bt(nr,ir),ri=new Date().getTimezoneOffset()*K;function sr(e){return Math.floor((e.getTime()-ri)/xt)}function rr(e){return new Date(ri+e*xt)}var he=new bt(sr,rr);function or(e){const t=e.getTimezoneOffset()*K;return Math.floor((e.getTime()-t)/Nt)}function ar(e){const t=new Date(1970,0,1);return t.setDate(t.getDate()+e),t}var oi=new bt(or,ar);function St(e){const n=(7+e-4)%7;function i(r){const o=r.getTimezoneOffset()*K;return Math.floor((r.getTime()-o)/oe-n/7)}function s(r){const o=new Date(1970,0,1);return o.setDate(o.getDate()+r*7+n),o}return new bt(i,s)}var Ve=St(0),sa=St(1),ra=St(2),oa=St(3),aa=St(4),ca=St(5),ha=St(6);function cr(e){return e.getFullYear()*12+e.getMonth()}function hr(e){const t=Math.floor(e/12),n=e-t*12;return new Date(t,n,1)}var jt=new bt(cr,hr);function lr(e){return e.getFullYear()}function ur(e){const t=new Date;return t.setFullYear(e),t.setMonth(0,1),t.setHours(0,0,0,0),t}var dr=new bt(lr,ur);function Ue(e){return e instanceof Date?e.getTime():e}import{Logger as fr,clamp as le}from"ag-charts-core";import{clamp as ai}from"ag-charts-core";function pr(e,t,n){if(n==null||n[0]===0&&n[1]===1)return e;const i=ai(0,Math.floor(n[0]*e.length),e.length),s=ai(0,Math.ceil(n[1]*e.length),e.length),r=t?e.length-s:i,o=t?e.length-i:s;return e.slice(r,o)}var ue=class Ai extends Ee{constructor(){super(...arguments),this.invalid=!0,this.range=[0,1],this.round=!1,this.interval=void 0,this._bandwidth=1,this._step=1,this._inset=1,this._rawBandwidth=1,this._paddingInner=0,this._paddingOuter=0}static is(t){return t instanceof Ai}get bandwidth(){return this.refresh(),this._bandwidth}get step(){return this.refresh(),this._step}get inset(){return this.refresh(),this._inset}get rawBandwidth(){return this.refresh(),this._rawBandwidth}set padding(t){t=le(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=le(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=le(0,t,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&fr.warnOnce("Expected update to not invalidate scale"))}ticks(t,n=this.domain,i){return pr(n,!1,i)}convert(t,n){this.refresh();const i=this.getIndex(t);return i==null||i<0||i>=this.domain.length?NaN:this.ordinalRange(i)}invertNearestIndex(t){this.refresh();const{domain:n}=this;if(n.length===0)return-1;let i=0,s=n.length-1,r=1/0,o=0;for(;i<=s;){const c=(s+i)/2|0,a=this.ordinalRange(c),h=Math.abs(a-t);if(h===0)return c;h<r&&(r=h,o=c),a<t?i=c+1:s=c-1}return o}update(){const t=this.domain.length;if(t===0)return;const[n,i]=this.range;let{_paddingInner:s}=this;const{_paddingOuter:r,round:o}=this,c=i-n;let a;t===1?(s=0,a=c*(1-r*2)):a=c/Math.max(1,t-s+r*2);const h=o?Math.floor(a):a;let l=n+(c-h*(t-s))/2,u=h*(1-s);o&&(l=Math.round(l),u=Math.round(u)),this._step=h,this._inset=l,this._bandwidth=u,this._rawBandwidth=a*(1-s)}ordinalRange(t){const{_inset:n,_step:i,range:s}=this,r=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return le(r,n+i*t,o)}};m([_t],ue.prototype,"range",2),m([_t],ue.prototype,"round",2),m([_t],ue.prototype,"interval",2);var gr=ue,mr=class extends gr{constructor(){super(...arguments),this.type="band",this.index=void 0,this._domain=[]}set domain(e){this._domain!==e&&(this.invalid=!0,this._domain=e,this.index=void 0)}get domain(){return this._domain}normalizeDomains(...e){let t;const n=new Set;let i=!0;for(const s of e)n.has(s)||(n.add(s),t==null?t=ci(s):(i&&(i=yr(s,t)),t=ci([...t,...s])));return t??(t=[]),{domain:t,animatable:i}}toDomain(e){}invert(e,t=!1){this.refresh();const n=t?this.bandwidth/2:0,i=this.invertNearestIndex(Math.max(0,e-n));return t||e===this.ordinalRange(i)?this.domain[i]:void 0}getIndex(e){let{index:t}=this;if(t==null){const{domain:n}=this;t=new Map;for(let i=0;i<n.length;i++)t.set(Ue(n[i]),i);this.index=t}return t.get(Ue(e))}};function ci(e){let t;const n=new Set;for(const i of e){const s=Ue(i),r=n.size;n.add(s),n.size!==r?t?.push(i):t??(t=e.slice(0,n.size))}return t??e}function yr(e,t){let n=-1;for(const i of e){const s=t.indexOf(i);if(s===-1)n=1/0;else{if(s<=n)return!1;n=s}}return!0}var da=new Intl.NumberFormat("en-US",{style:"percent"});function hi(e,t=2){return typeof e=="number"?Mr(e,t):typeof e=="string"?e:String(e??"")}var li=new Map().set(2,new Intl.NumberFormat("en-US",{maximumFractionDigits:2,useGrouping:!1}));function Mr(e,t){let n=li.get(t);return n||(n=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),li.set(t,n)),n.format(e)}import{Logger as br,clamp as vr,countFractionDigits as xr,createNumberFormatter as Sr,parseNumberFormat as wr}from"ag-charts-core";var O=(e,t,n)=>({duration:t*n,timeInterval:e,step:n}),pa=[O(ae,vt,1),O(ae,vt,5),O(ae,vt,15),O(ae,vt,30),O(ce,K,1),O(ce,K,5),O(ce,K,15),O(ce,K,30),O(he,xt,1),O(he,xt,3),O(he,xt,6),O(he,xt,12),O(oi,Nt,1),O(oi,Nt,2),O(Ve,oe,1),O(Ve,oe,2),O(Ve,oe,3),O(jt,Ht,1),O(jt,Ht,2),O(jt,Ht,3),O(jt,Ht,4),O(jt,Ht,6),O(dr,Qs,1)],ui=[1,2,5,10];function di(e,t){return Math.abs(Math.round(e)-e)<t}function Cr(e,t,n,i,s,r){if(n<2)return[e,t];const o=fi(e,t,n,i,s);if(!Number.isFinite(o))return[];if(di(e/o,1e-12)||(e=Math.ceil(e/o)*o),di(t/o,1e-12)||(t=Math.floor(t/o)*o),r!=null&&r[0]!==0&&r[1]!==1){const c=t-e,a=e+c*r[0],h=t-c*(1-r[1]);return Je(a-a%o,h+h%o,o)}return Je(e,t,o)}function fi(e,t,n,i=0,s=1/0){if(e===t)return vr(1,i,s);if(n<1)return NaN;const r=Math.abs(t-e),o=10**Math.floor(Math.log10(r/n));let c=NaN,a=1/0,h=!1;for(const l of ui){const u=Math.ceil(r/(l*o)),d=u>=i&&u<=s;if(h&&!d)continue;const f=Math.abs(u-n);(a>f||h!==d)&&(h||(h=d),a=f,c=l)}return c*o}function pi(e){for(let t=e.length-1;t>=0;t-=1)if(e[t]!=="0")return t+1;return 0}function gi(e,t){const n=wr(t??",f");(n.precision==null||isNaN(n.precision))&&(!n.type||"eEFgGnprs".includes(n.type)?n.precision=Math.max(...e.map(s=>{if(!Number.isFinite(s))return 0;const[r,o]=s.toExponential((n.type?6:12)-1).split(/[.e]/g);return(r!=="1"&&r!=="-1"?1:0)+pi(o)+1})):"f%".includes(n.type)&&(n.precision=Math.max(...e.map(s=>{if(!Number.isFinite(s)||s===0)return 0;const r=Math.floor(Math.log10(Math.abs(s))),o=n.type?6:12,c=s.toExponential(o-1).split(/[.e]/g)[1],a=pi(c);return Math.max(0,a-r)}))));const i=Sr(n);return s=>i(Number(s))}function Je(e,t,n){if(!Number.isFinite(n)||n<=0)return[];const i=10**xr(n),s=Math.min(e,t),r=Math.max(e,t),o=[];for(let c=0;;c+=1){const a=Math.round((s+n*c)*i)/i;if(a>r)break;o.push(a)}return o}function Pr(e,t){return e>=t?(br.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function Ar(e,t){const n=Math.abs(t-e),i=10**Math.floor(Math.log10(n));let s=1/0,r=[e,t];for(const o of ui){const c=o*i,a=Math.floor(e/c)*c,h=Math.ceil(t/c)*c,l=1-n/Math.abs(h-a);s>l&&(s=l,r=[a,h])}return r}var mi=class ki extends Ee{constructor(t=[],n=[]){super(),this.domain=t,this.range=n,this.defaultClamp=!1}static is(t){return t instanceof ki}normalizeDomains(...t){let n,i=1/0,s,r=-1/0;for(const o of t)for(const c of o){const a=c.valueOf();a<i&&(i=a,n=c),a>r&&(r=a,s=c)}return n!=null&&s!=null?{domain:[n,s],animatable:!0}:{domain:[],animatable:!1}}transform(t){return t}transformInvert(t){return t}calcBandwidth(t=1){const{domain:n}=this,i=this.getPixelRange();if(n.length===0)return i;const s=Math.abs(n[1].valueOf()-n[0].valueOf())/t+1,r=Math.floor(i),o=Math.min(s,r);return i/Math.max(1,o)}convert(t,n=this.defaultClamp){const{domain:i}=this;if(!i||i.length<2)return NaN;const s=Number(this.transform(i[0])),r=Number(this.transform(i[1])),o=Number(this.transform(t)),{range:c}=this,[a,h]=c;if(n){const[l,u]=Ks([s,r]);if(o<l)return a;if(o>u)return h}return s===r?(a+h)/2:o===s?a:o===r?h:a+(o-s)/(r-s)*(h-a)}invert(t,n){const i=this.domain.map(l=>this.transform(l)),[s,r]=i,{range:o}=this,[c,a]=o;let h;return c===a?h=this.toDomain((Number(s)+Number(r))/2):h=this.toDomain(Number(s)+(t-c)/(a-c)*(Number(r)-Number(s))),this.transformInvert(h)}getPixelRange(){const[t,n]=this.range;return Math.abs(n-t)}};mi.defaultTickCount=5;var de=mi,kr=class Ri extends de{constructor(){super([0,1],[0,1]),this.type="number"}static getTickStep(t,n,i){const{interval:s,tickCount:r=de.defaultTickCount,minTickCount:o,maxTickCount:c}=i;return s??fi(t,n,r,o,c)}toDomain(t){return t}ticks({interval:t,tickCount:n=de.defaultTickCount,minTickCount:i,maxTickCount:s},r=this.domain,o){if(!r||r.length<2||n<1||!r.every(isFinite))return[];const[c,a]=r;if(t){const h=Math.abs(t);if(!Pr((a-c)/h,this.getPixelRange()))return Je(c,a,h)}return Cr(c,a,n,i,s,o)}niceDomain(t,n=this.domain){if(n.length<2)return[];const{tickCount:i=de.defaultTickCount}=t;let[s,r]=n;if(i===1)[s,r]=Ar(s,r);else if(i>1){const o=s>r?Math.ceil:Math.floor,c=s>r?Math.floor:Math.ceil,a=4;for(let h=0;h<a;h++){const l=s,u=r,d=Ri.getTickStep(s,r,t),[f,p]=n;if(s=o(f/d)*d,r=c(p/d)*d,s===l&&r===u)break}}return[s,r]}tickFormatter({ticks:t,fractionDigits:n,specifier:i}){return i!=null?gi(t,i):s=>hi(s,n)}datumFormatter({ticks:t,fractionDigits:n,specifier:i}){return i!=null?gi(t,i):s=>hi(s,n+1)}};import{clamp as Rr}from"ag-charts-core";var Ke=(e,t)=>Math.sign(e-t);function Tr(e,t){if(typeof e=="number"&&typeof t=="number")return Ke(e,t);const n=typeof e=="number"?[e]:e,i=typeof t=="number"?[t]:t,s=Math.min(n.length,i.length);for(let r=0;r<s;r+=1){const o=Ke(n[r],i[r]);if(o!==0)return o}return Ke(n.length,i.length)}var qt,Ze=class Yt extends Bt{constructor(t){super(t),this.opacity=1,this.renderToOffscreenCanvas=!1,this.optimizeForInfrequentRedraws=!1,this.layer=void 0,this.image=void 0,this._lastWidth=NaN,this._lastHeight=NaN,this._lastDevicePixelRatio=NaN,this.isContainerNode=!0,this.renderToOffscreenCanvas=t?.renderToOffscreenCanvas===!0}static is(t){return t instanceof Yt}static computeChildrenBBox(t,n=!0){return $.merge(Bt.extractBBoxes(t,n))}static compareChildren(t,n){return Tr(t.zIndex,n.zIndex)||t.serialNumber-n.serialNumber}containsPoint(t,n){return!0}computeBBox(){return Yt.computeChildrenBBox(this.children())}computeSafeClippingBBox(t){const n=this.computeBBox();if(!n.isFinite())return;let i=0;const s=4;for(const d of this.descendants())d instanceof rt&&(i=Math.max(i,d.strokeWidth));const r=Math.max(1,i/2*s),{x:o,y:c}=kt.toCanvasPoint(this,0,0),a=Kn(t,o+n.x-r)-o,h=Kn(t,c+n.y-r)-c,l=Math.ceil(n.x+n.width-a+r),u=Math.ceil(n.y+n.height-h+r);return new $(a,h,l,u)}prepareSharedCanvas(t,n,i){return qt==null||qt.pixelRatio!==i?qt=new qe({width:t,height:n,pixelRatio:i}):qt.resize(t,n,i),qt}isDirty(t){const{width:n,height:i,devicePixelRatio:s}=t,{dirty:r,dirtyZIndex:o,layer:c}=this,a=c!=null&&(this._lastWidth!==n||this._lastHeight!==i),h=this._lastDevicePixelRatio!==s;if(this._lastWidth=n,this._lastHeight=i,this._lastDevicePixelRatio=s,r||o||a||h)return!0;for(const l of this.children())if(l.dirty)return!0;return!1}preRender(t){const n=super.preRender(t,0);return n.groups+=1,n.nonGroups-=1,this.renderToOffscreenCanvas&&!this.optimizeForInfrequentRedraws&&n.nonGroups>0&&this.getVisibility()?this.layer??(this.layer=this._layerManager?.addLayer({name:this.name})):this.layer!=null&&(this._layerManager?.removeLayer(this.layer),this.layer=void 0),n}render(t){const{layer:n,renderToOffscreenCanvas:i}=this,s={...t};if(!i){this.renderInContext(s),super.render(s);return}const{ctx:r,stats:o,devicePixelRatio:c}=t;let{image:a}=this;if(this.isDirty(t)){a?.bitmap.close(),a=void 0;const l=n?void 0:this.computeSafeClippingBBox(c),u=(d,...f)=>{const p=d.context;s.ctx=p,d.clear(),p.save(),p.setTransform(...f),p.globalAlpha=1,this.renderInContext(s),p.restore(),p.verifyDepthZero?.()};if(n)u(n,r.getTransform());else if(l){const{x:d,y:f,width:p,height:y}=l,g=this.prepareSharedCanvas(p,y,c);u(g,c,0,0,c,-d*c,-f*c),a={bitmap:g.transferToImageBitmap(),x:d,y:f,width:p,height:y}}else this.dirtyZIndex&&this.sortChildren(Yt.compareChildren);this.image=a,o&&o.layersRendered++}else this.skipRender(s),o&&o.layersSkipped++;const{globalAlpha:h}=r;if(r.globalAlpha=h*this.opacity,n)r.save(),r.resetTransform(),n.drawImage(r),r.restore();else if(a){const{bitmap:l,x:u,y:d,width:f,height:p}=a;r.drawImage(l,0,0,f*c,p*c,u,d,f,p)}r.globalAlpha=h,super.render(s)}skipRender(t){const{stats:n}=t;for(const i of this.children())i.markClean(),n&&(n.nodesSkipped+=this.childNodeCounts.groups+this.childNodeCounts.nonGroups,n.opsSkipped+=this.childNodeCounts.complexity)}applyClip(t,n){const{x:i,y:s,width:r,height:o}=n;t.beginPath(),t.rect(i,s,r,o),t.clip()}renderInContext(t){const{ctx:n,stats:i}=t;this.dirtyZIndex&&this.sortChildren(Yt.compareChildren),n.save(),n.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(n,this.clipRect),t.clipBBox=kt.toCanvas(this,this.clipRect));for(const s of this.children()){if(!s.visible){s.markClean(),i&&(i.nodesSkipped+=s.childNodeCounts.nonGroups+s.childNodeCounts.groups,i.opsSkipped+=s.childNodeCounts.complexity);continue}n.save(),s.render(t),n.restore()}n.restore()}setClipRect(t){this.clipRect=t?kt.fromCanvas(this,t):void 0}setClipRectCanvasSpace(t){this.clipRect=t}_setLayerManager(t){this.layer&&(this._layerManager?.removeLayer(this.layer),this.layer=void 0),super._setLayerManager(t)}getVisibility(){for(const t of this.traverseUp(!0))if(!t.visible)return!1;return!0}toSVG(){if(!this.visible)return;const t=[],n=[];for(const i of this.children()){const s=i.toSVG();s!=null&&(n.push(...s.elements),s.defs!=null&&t.push(...s.defs))}return{elements:n,defs:t}}};Ze.className="Group",m([k({convertor:e=>Rr(0,e,1)})],Ze.prototype,"opacity",2);var wt=Ze,ma=class extends Pn(wt){},ya=class extends Lt(wt){},Dr=class extends Vt(wt){},Ma=class extends Lt(Vt(wt)){};import{downloadUrl as Fr}from"ag-charts-core";import{createElement as Nr,getWindow as Ir}from"ag-charts-core";var yi=class{constructor(e){this.enabled=!0,this.width=600,this.height=300;const{width:t,height:n,canvasElement:i,willReadFrequently:s=!1}=e;this.pixelRatio=e.pixelRatio??Ir("devicePixelRatio")??1,this.element=i??Nr("canvas"),this.element.style.display="block",this.element.style.width=(t??this.width)+"px",this.element.style.height=(n??this.height)+"px",this.element.width=Math.round((t??this.width)*this.pixelRatio),this.element.height=Math.round((n??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:s}),this.onEnabledChange(),this.resize(t??0,n??0,this.pixelRatio),Yn(this.context)}drawImage(e,t=0,n=0){return e.drawImage(this.context.canvas,t,n)}toDataURL(e){return this.element.toDataURL(e)}resize(e,t,n){if(!(e>0&&t>0))return;const{element:i,context:s}=this;i.width=Math.round(e*n),i.height=Math.round(t*n),s.setTransform(n,0,0,n,0,0),i.style.width=e+"px",i.style.height=t+"px",this.width=e,this.height=t,this.pixelRatio=n}clear(){qn(this)}destroy(){this.element.remove(),this.element.width=0,this.element.height=0,this.context.clearRect(0,0,0,0),Object.freeze(this)}onEnabledChange(){this.element&&(this.element.style.display=this.enabled?"":"none")}};m([Xs(e=>e.onEnabledChange())],yi.prototype,"enabled",2);var Or=class{constructor(e){this.canvas=e,this.debug=X.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(e,t,n){this.canvas.resize(e,t,n),this.layersMap.forEach(({canvas:i})=>i.resize(e,t,n))}addLayer(e){const{width:t,height:n,pixelRatio:i}=this.canvas,{name:s}=e,r=new qe({width:t,height:n,pixelRatio:i});return this.layersMap.set(r,{id:this.nextLayerId++,name:s,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(e){this.layersMap.has(e)&&(this.layersMap.delete(e),e.destroy(),this.debug("Scene.removeLayer() -  layers",this.layersMap))}clear(){for(const e of this.layersMap.values())e.canvas.destroy();this.layersMap.clear()}};import{Logger as Er,getWindow as Br,isString as Lr,toArray as _r}from"ag-charts-core";function Gr(e){for(const t of["B","KB","MB","GB"]){if(e<1536)return`${e.toFixed(1)}${t}`;e/=1024}return`${e.toFixed(1)}TB}`}function Wr(){if(!("memory"in performance))return;const{totalJSHeapSize:e,usedJSHeapSize:t,jsHeapSizeLimit:n}=performance.memory,i=[];for(const s of[t,e,n])typeof s=="number"&&i.push(Gr(s));return`Heap ${i.join(" / ")}`}function Mi(e,t,n,i,s={},r=$.zero){if(!X.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:o=0,layersSkipped:c=0,nodesRendered:a=0,nodesSkipped:h=0,opsPerformed:l=0,opsSkipped:u=0}=i??{},d=performance.now(),{start:f,...p}=t,y=Object.entries(p).map(([P,F])=>vi(P,F)).filter(P=>P!=null).join(" + "),g=Object.entries(s).map(([P,F])=>`${P}: ${JSON.stringify(F)}`).join(" ; "),M=X.check("scene:stats:verbose"),v=Wr(),S=[`${vi("\u23F1\uFE0F",f,d)} (${y})`,`${g}`,`Layers: ${M?Qe(o,c):e.size}`,M?`Nodes: ${Qe(a,h)}`:null,M?`Ops: ${Qe(l,u)}`:null,M&&v?v:null].filter(Lr),R=new xn(P=>n.measureText(P)),w=new Map(S.map(P=>[P,R.measureLines(P)])),T=Math.max(...Array.from(w.values(),P=>P.width)),b=Yr(w.values(),P=>P.height),x=2+r.x;n.save(),n.fillStyle="white",n.fillRect(x,0,T,b),n.fillStyle="black";let A=0;for(const[P,F]of w.entries())A+=F.height,n.fillText(P,x,A);n.restore()}function $r(e){const t=_r(Br("agChartsSceneDebug")),n=[];for(const i of t)i==="layout"?n.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):n.push(i);e.debugNodeSearch=n}function zr(e,t){e.save();for(const[n,i]of Object.entries(t)){const s=kt.toCanvas(i);if(!s){Er.log(`Scene.render() - no bbox for debugged node [${n}].`);continue}e.globalAlpha=.8,e.strokeStyle="red",e.lineWidth=1,e.strokeRect(s.x,s.y,s.width,s.height),e.fillStyle="red",e.strokeStyle="white",e.font="16px sans-serif",e.textBaseline="top",e.textAlign="left",e.lineWidth=2,e.strokeText(n,s.x,s.y,s.width),e.fillText(n,s.x,s.y,s.width)}e.restore()}var Hr=new Set,jr=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function qr(e){const{...t}=e;for(const n of Object.keys(t))jr.has(n)||typeof t[n]!="number"&&typeof t[n]!="string"&&typeof t[n]!="boolean"&&(Hr.add(n),delete t[n]);return t}function fe(e,t){if(!X.check(!0,"scene"))return{};let n=0;return{node:t==="json"?qr(e):e,name:e.name??e.id,dirty:e.dirty,...Array.from(e.children(),i=>fe(i,t)).reduce((i,s)=>{let{name:r}=s;const{node:{visible:o,opacity:c,zIndex:a,translationX:h,translationY:l,rotation:u,scalingX:d,scalingY:f},node:p}=s;(!o||c<=0)&&(r=`(${r})`),wt.is(p)&&p.renderToOffscreenCanvas&&(r=`*${r}*`);const y=Array.isArray(a)?`(${a.join(", ")})`:a,g=[`${(n++).toString().padStart(3,"0")}|`,`${r??"<unknown>"}`,`z: ${y}`,h&&`x: ${h}`,l&&`y: ${l}`,u&&`r: ${u}`,d!=null&&d!==1&&`sx: ${d}`,f!=null&&f!==1&&`sy: ${f}`].filter(S=>!!S).join(" ");let M=g,v=1;for(;i[M]!=null&&v<100;)M=`${g} (${v++})`;return i[M]=s,i},{})}}function bi(e){if(!e.dirty)return{dirtyTree:{},paths:[]};const t=Array.from(e.children(),s=>bi(s)).filter(s=>s.paths.length>0),n=wt.is(e)?e.name??e.id:e.id,i=t.length?t.flatMap(s=>s.paths).map(s=>`${n}.${s}`):[n];return{dirtyTree:{name:n,node:e,dirty:e.dirty,...t.map(s=>s.dirtyTree).filter(s=>s.dirty!=null).reduce((s,r)=>(s[r.name??"<unknown>"]=r,s),{})},paths:i}}function Qe(e,t){const n=e+t;return`${e} / ${n} (${Math.round(100*e/n)}%)`}function vi(e,t,n){const i=n!=null?n-t:t;return`${e}: ${Math.round(i*100)/100}ms`}function Yr(e,t){let n=0;for(const i of e)n+=t(i);return n}var xi=class{constructor(e){this.debug=X.create(!0,"scene"),this.id=Ce(this),this.root=null,this.pendingSize=null,this.isDirty=!1,this.updateDebugFlags(),this.canvas=new yi(e),this.layersManager=new Or(this.canvas)}get width(){return this.pendingSize?.[0]??this.canvas.width}get height(){return this.pendingSize?.[1]??this.canvas.height}get pixelRatio(){return this.pendingSize?.[2]??this.canvas.pixelRatio}setContainer(e){const{element:t}=this.canvas;return t.parentElement?.removeChild(t),e.appendChild(t),this}setRoot(e){return this.root===e?this:(this.isDirty=!0,this.root?._setLayerManager(),this.root=e,e&&(e.visible=!0,e._setLayerManager(this.layersManager)),this)}updateDebugFlags(){X.inDevelopmentMode(()=>Bt._debugEnabled=!0)}clear(){this.canvas.clear()}attachNode(e){return this.appendChild(e),()=>this.removeChild(e)}appendChild(e){return this.root?.appendChild(e),this}removeChild(e){return this.root?.removeChild(e),this}download(e,t){Fr(this.canvas.toDataURL(t),e?.trim()??"image")}getDataURL(e){return this.canvas.toDataURL(e)}resize(e,t,n){return e=Math.round(e),t=Math.round(t),n??(n=this.pixelRatio),e>0&&t>0&&(e!==this.width||t!==this.height||n!==this.pixelRatio)?(this.pendingSize=[e,t,n],this.isDirty=!0,!0):!1}render(e){const{debugSplitTimes:t={start:performance.now()},extraDebugStats:n,seriesRect:i}=e??{},{canvas:s,canvas:{context:r}={},root:o,pendingSize:c,width:a,height:h,pixelRatio:l}=this;if(!r)return;const u=performance.now();let d=!1;if(c&&(d=!0,this.layersManager.resize(...c),this.pendingSize=null),o&&!o.visible){this.isDirty=!1;return}if(o?.dirty===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:fe(o,"console")}),Mi(this.layersManager,t,r,void 0,n,i);return}const f={ctx:r,width:a,height:h,devicePixelRatio:l,debugNodes:{}};X.check("scene:stats:verbose")&&(f.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),$r(f);let p=!1;if((o?.dirty!==!1||d)&&(p=!0,s.clear()),o&&X.check("scene:dirtyTree")){const{dirtyTree:y,paths:g}=bi(o);X.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:y,paths:g})}if(o&&p){if(o.visible&&o.preRender(f),this.debug.check()){const y=fe(o,"console");this.debug("Scene.render() - before",{canvasCleared:p,tree:y})}o.visible&&(r.save(),o.render(f),r.restore())}t["\u270D\uFE0F"]=performance.now()-u,r.verifyDepthZero?.(),this.isDirty=!1,Mi(this.layersManager,t,r,f.stats,n,i),zr(r,f.debugNodes),o&&this.debug.check()&&this.debug("Scene.render() - after",{tree:fe(o,"console"),canvasCleared:p})}toSVG(){const{root:e,width:t,height:n}=this;if(e!=null)return Bt.toSVG(e,t,n)}strip(){const{context:e,pixelRatio:t}=this.canvas;e.setTransform(t,0,0,t,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1}destroy(){this.strip(),this.canvas.destroy(),Object.assign(this,{canvas:void 0})}};xi.className="Scene";import{isNumberEqual as Xr}from"ag-charts-core";var ot=class extends tt{constructor(){super(),this.centerX=0,this.centerY=0,this.radius=10,this.startAngle=0,this.endAngle=Math.PI*2,this.counterClockwise=!1,this.type=0,this.restoreOwnStyles()}get fullPie(){return Xr(B(this.startAngle),B(this.endAngle))}updatePath(){const e=this.path;e.clear(),e.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?e.closePath():this.type===2&&!this.fullPie&&(e.lineTo(this.centerX,this.centerY),e.closePath())}computeBBox(){return new $(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(e,t){const n=this.getBBox();return this.type!==0&&n.containsPoint(e,t)&&this.path.isPointInPath(e,t)}};ot.className="Arc",m([C()],ot.prototype,"centerX",2),m([C()],ot.prototype,"centerY",2),m([C()],ot.prototype,"radius",2),m([C()],ot.prototype,"startAngle",2),m([C()],ot.prototype,"endAngle",2),m([C()],ot.prototype,"counterClockwise",2),m([C()],ot.prototype,"type",2);import{createSvgElement as Vr}from"ag-charts-core";var Ct=class extends rt{constructor(e={}){super(e),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.restoreOwnStyles()}set x(e){this.x1=e,this.x2=e}set y(e){this.y1=e,this.y2=e}get midPoint(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}}computeBBox(){return new $(Math.min(this.x1,this.x2),Math.min(this.y1,this.y2),Math.abs(this.x2-this.x1),Math.abs(this.y2-this.y1))}isPointInPath(e,t){return this.x1===this.x2||this.y1===this.y2?this.getBBox().clone().grow(this.strokeWidth/2).containsPoint(e,t):!1}distanceSquared(e,t){const{x1:n,y1:i,x2:s,y2:r}=this;return ie(e,t,n,i,s,r,1/0)}render(e){const{ctx:t,devicePixelRatio:n}=e;let{x1:i,y1:s,x2:r,y2:o}=this;if(i===r){const{strokeWidth:c}=this,a=Math.round(i*n)/n+Math.trunc(c*n)%2/(n*2);i=a,r=a}else if(s===o){const{strokeWidth:c}=this,a=Math.round(s*n)/n+Math.trunc(c*n)%2/(n*2);s=a,o=a}t.beginPath(),t.moveTo(i,s),t.lineTo(r,o),this.fillStroke(t),this.fillShadow?.markClean(),super.render(e)}toSVG(){if(!this.visible)return;const e=Vr("line");return e.setAttribute("x1",String(this.x1)),e.setAttribute("y1",String(this.y1)),e.setAttribute("x2",String(this.x2)),e.setAttribute("y2",String(this.y2)),this.applySvgStrokeAttributes(e),{elements:[e]}}};Ct.className="Line",Ct.defaultStyles={...rt.defaultStyles,fill:void 0,strokeWidth:1},m([k()],Ct.prototype,"x1",2),m([k()],Ct.prototype,"y1",2),m([k()],Ct.prototype,"x2",2),m([k()],Ct.prototype,"y2",2);import{isNumberEqual as tn}from"ag-charts-core";function en(e,t,n){const i=Math.sqrt(e**2+t**2),r=Math.atan2(t,e)+n;return{x:Math.cos(r)*i,y:Math.sin(r)*i}}var Q=class extends tt{constructor(){super(...arguments),this.isBeveled=!0,this.columnWidth=0,this.startAngle=0,this.endAngle=0,this.outerRadius=0,this.innerRadius=0,this.axisInnerRadius=0,this.axisOuterRadius=0,this.isRadiusAxisReversed=!1}set cornerRadius(e){}computeBBox(){const{innerRadius:e,outerRadius:t,columnWidth:n}=this,i=this.getRotation(),s=-n/2,r=n/2,o=-t,c=-e;let a=1/0,h=1/0,l=-1/0,u=-1/0;for(let d=0;d<4;d+=1){const{x:f,y:p}=en(d%2===0?s:r,d<2?o:c,i);a=Math.min(f,a),h=Math.min(p,h),l=Math.max(f,l),u=Math.max(p,u)}return new $(a,h,l-a,u-h)}getRotation(){const{startAngle:e,endAngle:t}=this,n=De(e,t);return B(e+n/2+Math.PI/2)}updatePath(){const{isBeveled:e}=this;e?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:e,innerRadius:t,outerRadius:n,path:i}=this,s=-e/2,r=e/2,o=-n,c=-t,a=this.getRotation(),h=[[s,c],[s,o],[r,o],[r,c]].map(([l,u])=>en(l,u,a));i.clear(!0),i.moveTo(h[0].x,h[0].y),i.lineTo(h[1].x,h[1].y),i.lineTo(h[2].x,h[2].y),i.lineTo(h[3].x,h[3].y),i.closePath()}updateBeveledPath(){const{columnWidth:e,path:t,outerRadius:n,innerRadius:i,axisInnerRadius:s,axisOuterRadius:r,isRadiusAxisReversed:o}=this,c=tn(i,s),a=Math.asin(e/2/i),h=this.getRotation(),l=(x,A)=>en(x,A,h),u=(x,A)=>Math.sqrt(x**2+A**2),d=(x,A)=>A>x?0:Math.sqrt(x**2-A**2),f=(x,A,P)=>P?x<A:x>A,p=c&&!isNaN(a)&&a<Math.PI/6;let y=-e/2,g=e/2;const M=-n,v=-i*(p?Math.cos(a):1),S=f(r,u(i,e/2),!o);if(S){const x=d(r,i);y=-x,g=x}t.clear(!0);const R=l(y,v);t.moveTo(R.x,R.y);const w=tn(i,n),T=f(r,u(n,e/2),!o);if(w&&p)t.arc(0,0,i,B(-a-Math.PI/2)+h,B(a-Math.PI/2)+h,!1);else if(T){const x=-d(r,e/2),A=d(r,n);if(!S){const P=l(y,x);t.lineTo(P.x,P.y)}if(t.arc(0,0,r,Math.atan2(x,y)+h,Math.atan2(M,-A)+h,!1),!tn(A,0)){const P=l(A,M);t.lineTo(P.x,P.y)}t.arc(0,0,r,Math.atan2(M,A)+h,Math.atan2(x,g)+h,!1)}else{const x=l(y,M),A=l(g,M);t.lineTo(x.x,x.y),t.lineTo(A.x,A.y)}const b=l(g,v);if(t.lineTo(b.x,b.y),p)t.arc(0,0,i,B(a-Math.PI/2)+h,B(-a-Math.PI/2)+h,!0);else{const x=l(y,v);t.lineTo(x.x,x.y)}t.closePath()}};Q.className="RadialColumnShape",m([C()],Q.prototype,"isBeveled",2),m([C()],Q.prototype,"columnWidth",2),m([C()],Q.prototype,"startAngle",2),m([C()],Q.prototype,"endAngle",2),m([C()],Q.prototype,"outerRadius",2),m([C()],Q.prototype,"innerRadius",2),m([C()],Q.prototype,"axisInnerRadius",2),m([C()],Q.prototype,"axisOuterRadius",2),m([C()],Q.prototype,"isRadiusAxisReversed",2);function Ur(e,t,n,i,s){const r=De(e,t),o=r*(1-i)/2;if(e+=o,t-=o,r<.001)return 2*n*s;if(r>=2*Math.PI){const f=e+r/2;e=f-Math.PI,t=f+Math.PI}const c=n*Math.cos(e),a=n*Math.sin(e),h=n*Math.cos(t),l=n*Math.sin(t),u=Math.floor(Math.sqrt((c-h)**2+(a-l)**2)),d=2*n*s;return Math.max(1,Math.min(d,u))}var pe=(e,{x0:t,y0:n,x1:i,y1:s,cx:r,cy:o},c,a)=>{if(a&&e.moveTo(t,n),t!==i||n!==s){const h=Math.atan2(n-o,t-r),l=Math.atan2(s-o,i-r);e.arc(r,o,c,h,l)}else e.lineTo(t,n)},Si=1e-6,ge=(e,t,n,i,s)=>{let r=!1,o=!1,c=i-Math.sqrt(Math.max(s**2-n**2,0)),a=0,h=0,l=n-Math.sqrt(Math.max(s**2-i**2,0));return c>e?(r=!0,c=e,a=n-Math.sqrt(Math.max(s**2-(i-e)**2))):c<Si&&(c=0),l>t?(o=!0,h=i-Math.sqrt(Math.max(s**2-(n-t)**2)),l=t):l<Si&&(l=0),{leading0:c,leading1:a,trailing0:h,trailing1:l,leadingClipped:r,trailingClipped:o}},nn=(e,t,n,i,s,r,o)=>{let{topLeft:c,topRight:a,bottomRight:h,bottomLeft:l}=r;const u=Math.max(c+l,a+h),d=Math.max(c+a,l+h);if(u<=0&&d<=0){o==null?e.rect(t,n,i,s):e.rect(o.x,o.y,o.width,o.height);return}else if(o==null&&c===a&&c===h&&c===l){e.roundRect(t,n,i,s,c);return}if(i<0&&(t+=i,i=Math.abs(i)),s<0&&(n+=s,s=Math.abs(s)),i<=0||s<=0)return;if(o==null)o=new $(t,n,i,s);else{const b=Math.max(t,o.x),x=Math.min(t+i,o.x+o.width),A=Math.max(n,o.y),P=Math.min(n+s,o.y+o.height);o=new $(b,A,x-b,P-A)}const f=Math.max(u/s,d/i,1);f>1&&(c/=f,a/=f,h/=f,l/=f);let p=!0,y=!0,g=!0,M=!0,v,S,R,w;if(p){const b=ge(o.height,o.width,Math.max(t+c-o.x,0),Math.max(n+c-o.y,0),c);b.leadingClipped&&(M=!1),b.trailingClipped&&(y=!1);const x=Math.max(o.x+b.leading1,o.x),A=Math.max(o.y+b.leading0,o.y),P=Math.max(o.x+b.trailing1,o.x),F=Math.max(o.y+b.trailing0,o.y),_=t+c,V=n+c;v={x0:x,y0:A,x1:P,y1:F,cx:_,cy:V}}if(y){const b=ge(o.width,o.height,Math.max(n+a-o.y,0),Math.max(o.x+o.width-(t+i-a),0),a);b.leadingClipped&&(p=!1),b.trailingClipped&&(g=!1);const x=Math.min(o.x+o.width-b.leading0,o.x+o.width),A=Math.max(o.y+b.leading1,o.y),P=Math.min(o.x+o.width-b.trailing0,o.x+o.width),F=Math.max(o.y+b.trailing1,o.y),_=t+i-a,V=n+a;S={x0:x,y0:A,x1:P,y1:F,cx:_,cy:V}}if(g){const b=ge(o.height,o.width,Math.max(o.x+o.width-(t+i-h),0),Math.max(o.y+o.height-(n+s-h),0),h);b.leadingClipped&&(y=!1),b.trailingClipped&&(M=!1);const x=Math.min(o.x+o.width-b.leading1,o.x+o.width),A=Math.min(o.y+o.height-b.leading0,o.y+o.height),P=Math.min(o.x+o.width-b.trailing1,o.x+o.width),F=Math.min(o.y+o.height-b.trailing0,o.y+o.height),_=t+i-h,V=n+s-h;R={x0:x,y0:A,x1:P,y1:F,cx:_,cy:V}}if(M){const b=ge(o.width,o.height,Math.max(o.y+o.height-(n+s-l),0),Math.max(t+l-o.x,0),l);b.leadingClipped&&(g=!1),b.trailingClipped&&(p=!1);const x=Math.max(o.x+b.leading0,o.x),A=Math.min(o.y+o.height-b.leading1,o.y+o.height),P=Math.max(o.x+b.trailing0,o.x),F=Math.min(o.y+o.height-b.trailing1,o.y+o.height),_=t+l,V=n+s-l;w={x0:x,y0:A,x1:P,y1:F,cx:_,cy:V}}let T=!1;p&&v!=null&&(pe(e,v,c,!T),T||(T=!0)),y&&S!=null&&(pe(e,S,a,!T),T||(T=!0)),g&&R!=null&&(pe(e,R,h,!T),T||(T=!0)),M&&w!=null&&pe(e,w,l,!T),e.closePath()},Z=class extends tt{constructor(){super(...arguments),this.borderPath=new $t,this.x=0,this.y=0,this.width=10,this.height=10,this.topLeftCornerRadius=0,this.topRightCornerRadius=0,this.bottomRightCornerRadius=0,this.bottomLeftCornerRadius=0,this.clipBBox=void 0,this.crisp=!1,this.lastUpdatePathStrokeWidth=rt.defaultStyles.strokeWidth,this.effectiveStrokeWidth=rt.defaultStyles.strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(e){this.topLeftCornerRadius=e,this.topRightCornerRadius=e,this.bottomRightCornerRadius=e,this.bottomLeftCornerRadius=e}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:e,borderPath:t,crisp:n,topLeftCornerRadius:i,topRightCornerRadius:s,bottomRightCornerRadius:r,bottomLeftCornerRadius:o}=this;let{x:c,y:a,width:h,height:l,strokeWidth:u,clipBBox:d}=this;const p=1/(this.layerManager?.canvas.pixelRatio??1);let y=1;if(e.clear(!0),t.clear(!0),n&&(h<=p&&(y*=h/p),l<=p&&(y*=l/p),h=this.align(c,h),l=this.align(a,l),c=this.align(c),a=this.align(a),d=d!=null?new $(this.align(d.x),this.align(d.y),this.align(d.x,d.width),this.align(d.y,d.height)):void 0),u)if(h<p){const g=c+p/2;t.moveTo(g,a),t.lineTo(g,a+l),u=p,this.borderClipPath=void 0}else if(l<p){const g=a+p/2;t.moveTo(c,g),t.lineTo(c+h,g),u=p,this.borderClipPath=void 0}else if(u<h&&u<l){const g=u/2;c+=g,a+=g,h-=u,l-=u;const M=d?.clone().shrink(g),v={topLeft:i>0?i-u:0,topRight:s>0?s-u:0,bottomRight:r>0?r-u:0,bottomLeft:o>0?o-u:0};this.borderClipPath=void 0,h>0&&l>0&&(M==null||M?.width>0&&M?.height>0)&&(nn(e,c,a,h,l,v,M),nn(t,c,a,h,l,v,M))}else this.borderClipPath=this.borderClipPath??new $t,this.borderClipPath.clear(!0),this.borderClipPath.rect(c,a,h,l),t.rect(c,a,h,l);else{const g={topLeft:i,topRight:s,bottomRight:r,bottomLeft:o};this.borderClipPath=void 0,nn(e,c,a,h,l,g,d)}if([i,s,r,o].every(g=>g===0)){const g=this.getBBox();this.hittester=g.containsPoint.bind(g),this.distanceSquared=(M,v)=>this.getBBox().distanceSquared(M,v)}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=u,this.lastUpdatePathStrokeWidth=u,this.microPixelEffectOpacity=y}computeBBox(){const{x:e,y:t,width:n,height:i,clipBBox:s}=this;return s?.clone()??new $(e,t,n,i)}isPointInPath(e,t){return this.hittester(e,t)}get midPoint(){return{x:this.x+this.width/2,y:this.y+this.height/2}}distanceSquared(e,t){return this.distanceCalculator(e,t)}applyFillAlpha(e){const{fillOpacity:t,microPixelEffectOpacity:n,opacity:i}=this;e.globalAlpha*=i*t*n}renderStroke(e){const{stroke:t,effectiveStrokeWidth:n}=this;if(t&&n){const{globalAlpha:i}=e,{strokeOpacity:s,lineDash:r,lineDashOffset:o,lineCap:c,lineJoin:a,borderPath:h,borderClipPath:l,opacity:u,microPixelEffectOpacity:d}=this;l&&e.clip(l.getPath2D()),this.applyStroke(e),e.globalAlpha*=u*s*d,e.lineWidth=n,r&&e.setLineDash(r),o&&(e.lineDashOffset=o),c&&(e.lineCap=c),a&&(e.lineJoin=a),e.stroke(h.getPath2D()),e.globalAlpha=i}}};Z.className="Rect",m([C()],Z.prototype,"x",2),m([C()],Z.prototype,"y",2),m([C()],Z.prototype,"width",2),m([C()],Z.prototype,"height",2),m([C()],Z.prototype,"topLeftCornerRadius",2),m([C()],Z.prototype,"topRightCornerRadius",2),m([C()],Z.prototype,"bottomRightCornerRadius",2),m([C()],Z.prototype,"bottomLeftCornerRadius",2),m([C()],Z.prototype,"clipBBox",2),m([C()],Z.prototype,"crisp",2);var Jr=class on{constructor(t,n,i,s){this.startAngle=t,this.endAngle=n,this.innerRadius=i,this.outerRadius=s}clone(){const{startAngle:t,endAngle:n,innerRadius:i,outerRadius:s}=this;return new on(t,n,i,s)}equals(t){return this.startAngle===t.startAngle&&this.endAngle===t.endAngle&&this.innerRadius===t.innerRadius&&this.outerRadius===t.outerRadius}[bn](t,n){return new on(this.startAngle*(1-n)+t.startAngle*n,this.endAngle*(1-n)+t.endAngle*n,this.innerRadius*(1-n)+t.innerRadius*n,this.outerRadius*(1-n)+t.outerRadius*n)}};function Kr({startAngle:e,endAngle:t,innerRadius:n,outerRadius:i}){let s=1/0,r=1/0,o=-1/0,c=-1/0;const a=(h,l)=>{s=Math.min(h,s),r=Math.min(l,r),o=Math.max(h,o),c=Math.max(l,c)};return a(n*Math.cos(e),n*Math.sin(e)),a(n*Math.cos(t),n*Math.sin(t)),a(i*Math.cos(e),i*Math.sin(e)),a(i*Math.cos(t),i*Math.sin(t)),Tt(0,e,t)&&a(i,0),Tt(Math.PI*.5,e,t)&&a(0,i),Tt(Math.PI,e,t)&&a(-i,0),Tt(Math.PI*1.5,e,t)&&a(0,-i),new $(s,r,o-s,c-r)}function wi(e,t,n){const i=Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),{innerRadius:s,outerRadius:r}=n;if(n.startAngle===n.endAngle||i<Math.min(s,r)||i>Math.max(s,r))return!1;const o=Tn(n.startAngle),c=Tn(n.endAngle),a=Math.atan2(t,e);return o<c?a<=c&&a>=o:a<=c&&a>=-Math.PI||a>=o&&a<=Math.PI}function Ci(e,t,n,i){if(n===0&&i===0)return 0;if(Math.asin(Math.abs(1*n)/(e+1*n))+Math.asin(Math.abs(1*i)/(e+1*i))-t<0)return 1;let r=0,o=1;for(let c=0;c<8;c+=1){const a=(r+o)/2;Math.asin(Math.abs(a*n)/(e+a*n))+Math.asin(Math.abs(a*i)/(e+a*i))-t<0?r=a:o=a}return r}var Zr=1e-6;function ut(e,t){return De(e,t)<Zr?t:B(e-t)+t}function me(e,t,n=0){const s=Math.abs(t-e)>=2*Math.PI?2*Math.PI:B(t-e);return e=ut(e,n),t=e+s,{startAngle:e,endAngle:t}}function ye(e,t,n,i,s,r){const o=Math.sin(r),c=Math.cos(r),a=e**2+t**2-n**2;let h,l,u,d;if(c>.5){const S=o/c,R=1+S**2,w=-2*(e+t*S),T=w**2-4*R*a;if(T<0)return;const b=(-w+Math.sqrt(T))/(2*R),x=(-w-Math.sqrt(T))/(2*R);h=b,l=b*S,u=x,d=x*S}else{const S=c/o,R=1+S**2,w=-2*(t+e*S),T=w**2-4*R*a;if(T<0)return;const b=(-w+Math.sqrt(T))/(2*R),x=(-w-Math.sqrt(T))/(2*R);h=b*S,l=b,u=x*S,d=x}const f=c,p=o,y=h*f+l*p,g=u*f+d*p,M=y>0?ut(Math.atan2(l-t,h-e),i):NaN,v=g>0?ut(Math.atan2(d-t,u-e),i):NaN;if(M>=i&&M<=s)return M;if(v>=i&&v<=s)return v}function Me(e,t,n,i,s,r){const o=Math.hypot(e,t),c=(o**2-n**2+r**2)/(2*o),a=o-c,h=Math.atan2(t,e),l=Math.acos(-a/n),u=ut(h+l,i),d=ut(h-l,i);if(u>=i&&u<=s)return u;if(d>=i&&d<=s)return d}var sn=class{constructor(e,t,n,i,s){this.cx=e,this.cy=t,this.r=n,this.a0=i,this.a1=s,this.a0>=this.a1&&(this.a0=NaN,this.a1=NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(e){return{x:this.cx+this.r*Math.cos(e),y:this.cy+this.r*Math.sin(e)}}clipStart(e){e==null||!this.isValid()||e<this.a0||(this.a0=e,(Number.isNaN(e)||this.a0>=this.a1)&&(this.a0=NaN,this.a1=NaN))}clipEnd(e){e==null||!this.isValid()||e>this.a1||(this.a1=e,(Number.isNaN(e)||this.a0>=this.a1)&&(this.a0=NaN,this.a1=NaN))}},q=class extends tt{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.innerRadius=10,this.outerRadius=20,this.startAngle=0,this.endAngle=Math.PI*2,this.clipSector=void 0,this.concentricEdgeInset=0,this.radialEdgeInset=0,this.startOuterCornerRadius=0,this.endOuterCornerRadius=0,this.startInnerCornerRadius=0,this.endInnerCornerRadius=0}set inset(e){this.concentricEdgeInset=e,this.radialEdgeInset=e}set cornerRadius(e){this.startOuterCornerRadius=e,this.endOuterCornerRadius=e,this.startInnerCornerRadius=e,this.endInnerCornerRadius=e}computeBBox(){return Kr(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:e}=this;let{innerRadius:t,outerRadius:n}=this;return t=t>0?t+e:0,n=Math.max(n-e,0),{innerRadius:t,outerRadius:n}}normalizedClipSector(){const{clipSector:e}=this;if(e==null)return;const{startAngle:t,endAngle:n}=me(this.startAngle,this.endAngle),{innerRadius:i,outerRadius:s}=this.normalizedRadii(),r=me(e.startAngle,e.endAngle,t);return new Jr(Math.max(t,r.startAngle),Math.min(n,r.endAngle),Math.max(i,e.innerRadius),Math.min(s,e.outerRadius))}getAngleOffset(e){return e>0?this.radialEdgeInset/e:0}arc(e,t,n,i,s,r,o,c){if(e<=0)return;const{startAngle:a,endAngle:h}=me(this.startAngle,this.endAngle),{innerRadius:l,outerRadius:u}=this.normalizedRadii(),d=this.normalizedClipSector();if(c&&l<=0)return;const f=c?this.getAngleOffset(l+e):this.getAngleOffset(u-e),p=o?a+f+t:h-f-t,y=c?l+e:u-e,g=y*Math.cos(p),M=y*Math.sin(p);if(d!=null&&(!o&&!(p>=a-1e-6&&p<=d.endAngle-1e-6)||o&&!(p>=d.startAngle+1e-6&&p<=h-1e-6)||c&&y<d.innerRadius-1e-6||!c&&y>d.outerRadius+1e-6))return;const v=new sn(g,M,e,n,i);if(d!=null){c?(v.clipStart(ye(g,M,e,n,i,d.endAngle)),v.clipEnd(ye(g,M,e,n,i,d.startAngle))):(v.clipStart(ye(g,M,e,n,i,d.startAngle)),v.clipEnd(ye(g,M,e,n,i,d.endAngle)));let b,x;if(o?(b=Me(g,M,e,n,i,d.innerRadius),x=Me(g,M,e,n,i,d.outerRadius)):(b=Me(g,M,e,n,i,d.outerRadius),x=Me(g,M,e,n,i,d.innerRadius)),v.clipStart(b),v.clipEnd(x),b!=null){const{x:A,y:P}=v.pointAt(b),F=ut(Math.atan2(P,A),a);o?r?.clipStart(F):s.clipEnd(F)}if(x!=null){const{x:A,y:P}=v.pointAt(x),F=ut(Math.atan2(P,A),a);o?s.clipStart(F):r?.clipEnd(F)}}if(d!=null){const{x:b,y:x}=v.pointAt((v.a0+v.a1)/2);if(!wi(b,x,d))return}const{x:S,y:R}=v.pointAt(o===c?v.a0:v.a1),w=ut(Math.atan2(R,S),a),T=c?r:s;return o?T?.clipStart(w):T?.clipEnd(w),v}updatePath(){const{path:t,centerX:n,centerY:i,concentricEdgeInset:s,radialEdgeInset:r}=this;let{startOuterCornerRadius:o,endOuterCornerRadius:c,startInnerCornerRadius:a,endInnerCornerRadius:h}=this;const{startAngle:l,endAngle:u}=me(this.startAngle,this.endAngle),{innerRadius:d,outerRadius:f}=this.normalizedRadii(),p=this.normalizedClipSector(),y=u-l,g=y>=2*Math.PI-1e-6;if(t.clear(),d===0&&f===0||d>f)return;if((p?.startAngle??l)===(p?.endAngle??u))return;if(g&&this.clipSector==null&&o===0&&c===0&&a===0&&h===0){t.moveTo(n+f*Math.cos(l),i+f*Math.sin(l)),t.arc(n,i,f,l,u),d>s&&(t.moveTo(n+d*Math.cos(u),i+d*Math.sin(u)),t.arc(n,i,d,u,l,!0)),t.closePath();return}else if(this.clipSector==null&&Math.abs(d-f)<1e-6){t.arc(n,i,f,l,u,!1),t.arc(n,i,f,u,l,!0),t.closePath();return}const M=this.getAngleOffset(d),v=this.getAngleOffset(f);if(y<2*v)return;const R=(p?.innerRadius??d)>s,w=d<s||y<2*M,T=f-d,b=Math.max(o,a,c,h),x=b>0?Math.min(T/b,1):1;o*=x,c*=x,a*=x,h*=x;const A=Ci(f,y-2*v,-o,-c);if(o*=A,c*=A,!w&&R){const I=Ci(d,y-2*M,a,h);a*=I,h*=I}else a=0,h=0;const P=Math.max(o+a,c+h),F=P>0?Math.min(T/P,1):1;o*=F,c*=F,a*=F,h*=F;let _=0,V=0;const xe=o/(f-o),Se=c/(f-c);if(xe>=0&&xe<1-1e-6)_=Math.asin(xe);else{_=y/2;const I=f/(1/Math.sin(_)+1);o=Math.min(I,o)}if(Se>=0&&Se<1-1e-6)V=Math.asin(Se);else{V=y/2;const I=f/(1/Math.sin(V)+1);c=Math.min(I,c)}const an=Math.asin(a/(d+a)),cn=Math.asin(h/(d+h)),hn=p?.outerRadius??f,ln=this.getAngleOffset(hn),at=new sn(0,0,hn,l+ln,u-ln),un=p?.innerRadius??d,dn=this.getAngleOffset(un),nt=R?new sn(0,0,un,l+dn,u-dn):void 0;p!=null&&(at.clipStart(p.startAngle),at.clipEnd(p.endAngle),nt?.clipStart(p.startAngle),nt?.clipEnd(p.endAngle));const fn=this.arc(o,_,l-Math.PI*.5,l+_,at,nt,!0,!1),pn=this.arc(c,V,u-V,u+Math.PI*.5,at,nt,!1,!1),gn=this.arc(h,cn,u+Math.PI*.5,u+Math.PI-cn,at,nt,!1,!0),we=this.arc(a,an,l+Math.PI+an,l+Math.PI*1.5,at,nt,!0,!0);if(w){const I=y<Math.PI*.5?r*(1+Math.cos(y))/Math.sin(y):NaN;let E;I>0&&I<f?E=Math.max(Math.hypot(r,I),d):E=r,E=Math.max(E,d);const W=l+y*.5;t.moveTo(n+E*Math.cos(W),i+E*Math.sin(W))}else if(!(we?.isValid()===!0||nt?.isValid()===!0)){const I=l+y/2,E=d*Math.cos(I),W=d*Math.sin(I);t.moveTo(n+E,i+W)}if(fn?.isValid()===!0){const{cx:I,cy:E,r:W,a0:dt,a1:ft}=fn;t.arc(n+I,i+E,W,dt,ft)}if(at.isValid()){const{r:I,a0:E,a1:W}=at;t.arc(n,i,I,E,W)}if(pn?.isValid()===!0){const{cx:I,cy:E,r:W,a0:dt,a1:ft}=pn;t.arc(n+I,i+E,W,dt,ft)}if(!w){if(gn?.isValid()===!0){const{cx:I,cy:E,r:W,a0:dt,a1:ft}=gn;t.arc(n+I,i+E,W,dt,ft)}if(nt?.isValid()===!0){const{r:I,a0:E,a1:W}=nt;t.arc(n,i,I,W,E,!0)}if(we?.isValid()===!0){const{cx:I,cy:E,r:W,a0:dt,a1:ft}=we;t.arc(n+I,i+E,W,dt,ft)}}t.closePath()}isPointInPath(e,t){const{startAngle:n,endAngle:i,innerRadius:s,outerRadius:r}=this.clipSector??this;return wi(e-this.centerX,t-this.centerY,{startAngle:n,endAngle:i,innerRadius:Math.min(s,r),outerRadius:Math.max(s,r)})}};q.className="Sector",m([C()],q.prototype,"centerX",2),m([C()],q.prototype,"centerY",2),m([C()],q.prototype,"innerRadius",2),m([C()],q.prototype,"outerRadius",2),m([C()],q.prototype,"startAngle",2),m([C()],q.prototype,"endAngle",2),m([C()],q.prototype,"clipSector",2),m([C()],q.prototype,"concentricEdgeInset",2),m([C()],q.prototype,"radialEdgeInset",2),m([C()],q.prototype,"startOuterCornerRadius",2),m([C()],q.prototype,"endOuterCornerRadius",2),m([C()],q.prototype,"startInnerCornerRadius",2),m([C()],q.prototype,"endInnerCornerRadius",2);export{ot as Arc,$ as BBox,j as Caption,mr as CategoryScale,wt as Group,Ct as Line,kr as LinearScale,Xe as Marker,tt as Path,Q as RadialColumnShape,Z as Rect,xi as Scene,q as Sector,rt as Shape,Dr as TranslatableGroup,Ur as getRadialColumnWidth,J as toRadians};