UNPKG

ag-charts-community

Version:

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

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