UNPKG

ag-charts-community

Version:

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

3 lines 114 kB
var Oi=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,p=(s,e,t,i)=>{for(var n=i>1?void 0:i?Li(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Oi(e,t,n),n};import{BaseProperties as Ae,FONT_SIZE as Fi,Property as F,ProxyPropertyOnWrite as Q,callWithContext as Ei,createId as zi,isArray as $i,isSegmentTruncated as qi,isTextTruncated as Bi,toPlainText as Re,toTextString as Ie,wrapText as Gi,wrapTextSegments as Wi}from"ag-charts-core";import{DeclaredSceneChangeDetection as Oe,Logger as jt,createId as Xi,createSvgElement as Le,objectsEqual as Yi}from"ag-charts-core";import{boxContains as ji,boxesEqual as Vi,clamp as Fe,nearestSquared as Ui}from"ag-charts-core";var Ee=Symbol("interpolate"),Hi=(()=>{var s=class mt{constructor(t,i,n,r){this.x=t,this.y=i,this.width=n,this.height=r}static fromObject({x:t,y:i,width:n,height:r}){return new mt(t,i,n,r)}static merge(t){let i=1/0,n=1/0,r=-1/0,a=-1/0;for(const o of t)o.x<i&&(i=o.x),o.y<n&&(n=o.y),B(o.x,o.width)>r&&(r=B(o.x,o.width)),B(o.y,o.height)>a&&(a=B(o.y,o.height));return new mt(i,n,r-i,a-n)}static nearestBox(t,i,n){return Ui(t,i,n)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:B(this.x,this.width),bottom:B(this.y,this.height),toJSON(){return{}}}}clone(){const{x:t,y:i,width:n,height:r}=this;return new mt(t,i,n,r)}equals(t){return Vi(this,t)}containsPoint(t,i){return ji(this,t,i)}intersectsWith(t){return!(this.x+this.width<=t.x||t.x+t.width<=this.x||this.y+this.height<=t.y||t.y+t.height<=this.y)}intersection(t){const i=Math.max(this.x,t.x),n=Math.max(this.y,t.y),r=Math.min(B(this.x,this.width),B(t.x,t.width)),a=Math.min(B(this.y,this.height),B(t.y,t.height));if(!(i>r||n>a))return new mt(i,n,r-i,a-n)}collidesBBox(t){return this.x<B(t.x,t.width)&&B(this.x,this.width)>t.x&&this.y<B(t.y,t.height)&&B(this.y,this.height)>t.y}computeCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)&&Number.isFinite(this.width)&&Number.isFinite(this.height)}distanceSquared(t,i){if(this.containsPoint(t,i))return 0;const n=t-Fe(this.x,t,B(this.x,this.width)),r=i-Fe(this.y,i,B(this.y,this.height));return n*n+r*r}shrink(t,i){if(typeof t=="number")this.applyMargin(t,i);else for(const n of Object.keys(t)){const r=t[n];typeof r=="number"&&this.applyMargin(r,n)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,i){if(typeof t=="number")this.applyMargin(-t,i);else for(const n of Object.keys(t)){const r=t[n];typeof r=="number"&&this.applyMargin(-r,n)}return this}applyMargin(t,i){switch(i){case"top":this.y+=t;case"bottom":this.height-=t;break;case"left":this.x+=t;case"right":this.width-=t;break;case"vertical":this.y+=t,this.height-=t*2;break;case"horizontal":this.x+=t,this.width-=t*2;break;case void 0:this.x+=t,this.y+=t,this.width-=t*2,this.height-=t*2;break}}translate(t,i){return this.x+=t,this.y+=i,this}[Ee](t,i){return new mt(this.x*(1-i)+t.x*i,this.y*(1-i)+t.y*i,this.width*(1-i)+t.width*i,this.height*(1-i)+t.height*i)}};return s.zero=Object.freeze(new s(0,0,0,0)),s.NaN=Object.freeze(new s(Number.NaN,Number.NaN,Number.NaN,Number.NaN)),s})(),L=Hi;function B(s,e){return s===-1/0&&e===1/0?1/0:s+e}var Vt=(s,e)=>Math.sign(s-e);function Zi(s,e){if(typeof s=="number"&&typeof e=="number")return Vt(s,e);const t=typeof s=="number"?[s]:s,i=typeof e=="number"?[e]:e,n=Math.min(t.length,i.length);for(let r=0;r<n;r+=1){const a=Vt(t[r],i[r]);if(a!==0)return a}return Vt(t.length,i.length)}import{SceneChangeDetection as I}from"ag-charts-core";var Ji=5,Qi=(()=>{var s=class be{constructor(t){this.serialNumber=be._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=Xi(this),this.name=void 0,this.transitionOut=void 0,this.pointerEvents=0,this._datum=void 0,this._previousDatum=void 0,this.scene=void 0,this._debugDirtyProperties=void 0,this.parentNode=void 0,this.cachedBBox=void 0,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.batchLevel=0,this.batchDirty=!1,this.name=t?.name,this.tag=t?.tag??Number.NaN,this.zIndex=t?.zIndex??0,this.scene=t?.scene,(t?.debugDirty??be._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,i,n){const r=t?.toSVG();if(r==null||!r.elements.length&&!r.defs?.length)return;const a=Le("svg");if(a.setAttribute("width",String(i)),a.setAttribute("height",String(n)),a.setAttribute("viewBox",`0 0 ${i} ${n}`),a.setAttribute("overflow","visible"),r.defs?.length){const o=Le("defs");o.append(...r.defs),a.append(o)}return a.append(...r.elements),a.outerHTML}static*extractBBoxes(t,i){for(const n of t)if(!i||n.visible&&!n.transitionOut){const r=n.getBBox();r&&(yield r)}}get datum(){return this._datum}set datum(t){this._datum!==t&&(this._previousDatum=this._datum,this._datum=t)}get previousDatum(){return this._previousDatum}get unsafeNonNullDatum(){return this.datum}get unsafeDatum(){return this.datum}set unsafeDatum(t){this.datum=t}get unsafePreviousDatum(){return this.previousDatum}get layerManager(){return this.scene?.layersManager}get imageLoader(){return this.scene?.imageLoader}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}unsafeClosestDatum(){return this.closestDatum()}preRender(t,i=1){if(this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i,this.batchLevel>0||this.batchDirty)throw new Error("AG Charts - illegal rendering state; batched update in progress");return this.childNodeCounts}isolatedRender(t){t.ctx.save();try{this.render(t)}catch(i){const n=i.errorCount??1;if(n>=Ji)throw i.errorCount=n,i;jt.warnOnce("Error during rendering",i,i.stack)}finally{t.ctx.restore()}}render(t){const{stats:i}=t;if(this.debugDirtyProperties(),t.debugNodeSearch){const n=this.name??this.id;t.debugNodeSearch.some(r=>typeof r=="string"?r===n:r.test(n))&&(t.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}setScene(t){this.scene=t}*traverseUp(t){t&&(yield this);let i=this.parentNode;for(;i;)yield i,i=i.parentNode}isRoot(){return!this.parentNode}removeChild(t){throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`)}remove(){this.parentNode?.removeChild(this)}destroy(){this.parentNode&&this.remove()}batchedUpdate(t){this.batchLevel++;try{t()}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}}setProperties(t){this.batchLevel++;try{const i=this,n=t,r=Object.keys(n);for(let a=0,o=r.length;a<o;a++){const h=r[a];i[h]=n[h]}}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}return this}setPropertiesWithKeys(t,i){this.batchLevel++;try{const n=this,r=t;for(let a=0,o=i.length;a<o;a++){const h=i[a];n[h]=r[h]}}finally{this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}return this}containsPoint(t,i){return!1}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1)&&this.containsPoint(t,i))return this}pickNodes(t,i,n=[]){return!this.visible||this.pointerEvents===1||this.containsPoint(t,i)&&n.push(this),n}getBBox(){return this.cachedBBox??(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirtyChildrenOrder(){this.cachedBBox=void 0}markDirty(t){if(this.batchLevel>0){this.batchDirty=!0;return}t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),this.cachedBBox=void 0,this.parentNode?.markDirty()}markDebugProperties(t){const i=this._debugDirtyProperties?.get(t)??[],n=new Error("Stack trace for property change tracking").stack?.split(`
`).filter(r=>r!=="Error"&&!r.includes(".markDebugProperties")&&!r.includes(".markDirty")&&!r.includes("Object.assign ")&&!r.includes(`${this.constructor.name}.`))??"unknown";i.push(n[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,i)}debugDirtyProperties(){if(this._debugDirtyProperties!=null){if(!this._debugDirtyProperties.has("__first__"))for(const[t,i]of this._debugDirtyProperties.entries())i.length>1&&jt.logGroup(`Property changed multiple times before render: ${this.constructor.name}.${t} (${i.length}x)`,()=>{for(const n of i)jt.log(n)});this._debugDirtyProperties.clear()}}static handleNodeZIndexChange(t){t.onZIndexChange()}onZIndexChange(){this.parentNode?.markDirtyChildrenOrder()}resolveFont(){}toSVG(){}};return s.className="AbstractNode",s._nextSerialNumber=0,s._debugEnabled=!1,p([Oe()],s.prototype,"visible",2),p([Oe({equals:Yi,changeCb:s.handleNodeZIndexChange})],s.prototype,"zIndex",2),s})(),bt=Qi;import{Debug as Ki,LineSplitter as Ut,SceneRefChangeDetection as ts,cachedTextMeasurer as Ht,createSvgElement as ze,isArray as rt,measureTextSegments as Pt,toFontString as es,toPlainText as is,toTextString as ut}from"ag-charts-core";import{clamp as ss,toIterable as ns}from"ag-charts-core";import{getOffscreenCanvas as $e}from"ag-charts-core";import{Debug as rs}from"ag-charts-core";function qe({context:s,pixelRatio:e,width:t,height:i}){s.save();try{s.resetTransform(),s.clearRect(0,0,Math.ceil(t*e),Math.ceil(i*e))}finally{s.restore()}}function Be(s){if(rs.check("canvas")){const e=s.save.bind(s),t=s.restore.bind(s);let i=0;Object.assign(s,{save(){e(),i++},restore(){if(i===0)throw new Error("AG Charts - Unable to restore() past depth 0");t(),i--},verifyDepthZero(){if(i!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${i}`)}})}}function Ge(s,e,t){return[Math.floor(s*t),Math.floor(e*t)]}var Zt;function as(){const s=$e();return Zt??(Zt=new s(1,1)),Zt}var Jt=class{constructor(s){const{width:e,height:t,pixelRatio:i,willReadFrequently:n=!1}=s;this.width=e,this.height=t,this.pixelRatio=i;const[r,a]=Ge(e,t,i),o=$e();this.canvas=new o(r,a),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(i,0,0,i,0,0),Be(this.context)}drawImage(s,e=0,t=0){return s.drawImage(this.canvas,e,t)}transferToImageBitmap(){return this.canvas.width<1||this.canvas.height<1?as().transferToImageBitmap():this.canvas.transferToImageBitmap()}resize(s,e,t){if(!(s>0&&e>0))return;const{canvas:i,context:n}=this;if(s!==this.width||e!==this.height||t!==this.pixelRatio){const[r,a]=Ge(s,e,t);i.width=r,i.height=a}n.setTransform(t,0,0,t,0,0),this.width=s,this.height=e,this.pixelRatio=t}clear(){qe(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{DeclaredSceneChangeDetection as Z,DeclaredSceneObjectChangeDetection as Qt,SceneArrayChangeDetection as os,SceneObjectChangeDetection as We,TRIPLE_EQ as hs,boxesEqual as cs,clamp as ls,generateUUID as Kt,isGradientFill as te,isImageFill as Xe,isPatternFill as Ye,isString as us,objectsEqual as _t}from"ag-charts-core";import{createSvgElement as ds,normalizeAngle360FromDegrees as fs}from"ag-charts-core";import{createSvgElement as ps}from"ag-charts-core";import{Color as ee,Logger as ie,clamp as gs}from"ag-charts-core";var se=class{ticks(s,e,t){}niceDomain(s,e=this.domain){return e}get bandwidth(){}get step(){}get inset(){}},xt=(s,e)=>{const t=Symbol(String(e));s[t]=void 0,Object.defineProperty(s,e,{get(){return this[t]},set(i){this[t]!==i&&(this[t]=i,this.invalid=!0)},enumerable:!0,configurable:!1})};import{clamp as je,readIntegratedWrappedValue as Ve}from"ag-charts-core";function ms(s,e,t){if(t==null||t[0]===0&&t[1]===1)return;const i=je(0,Math.floor(t[0]*s.length),s.length),n=je(0,Math.ceil(t[1]*s.length),s.length),r=e?s.length-n:i,a=e?s.length-i:n;return[r,a]}function ys(s,e,t){const i=ms(s,e,t);if(i==null)return{ticks:s,count:s.length,firstTickIndex:0};const[n,r]=i;return{ticks:s.slice(n,r),count:s.length,firstTickIndex:n}}function ne(s){const e=Ve(s.at(0)),t=Ve(s.at(-1));return e!=null&&t!=null?[e,t]:[void 0,void 0]}var Ue=s=>{const e=ee.fromString(s),[t,i,n]=ee.RGBtoOKLCH(e.r,e.g,e.b);return{l:t,c:i,h:n,a:e.a}},re=1e-6,He=s=>s.c<re||s.l<re||s.l>1-re,bs=(s,e,t)=>{t=gs(0,t,1);let i;if(He(s))i=e.h;else if(He(e))i=s.h;else{const o=s.h;let h=e.h;const c=e.h-s.h;c>180?h-=360:c<-180&&(h+=360),i=o*(1-t)+h*t}const n=s.c*(1-t)+e.c*t,r=s.l*(1-t)+e.l*t,a=s.a*(1-t)+e.a*t;return ee.fromOKLCH(r,n,i,a)},Ze=(()=>{var s=class extends se{constructor(){super(...arguments),this.type="color",this.defaultTickCount=0,this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.mode="continuous",this.parsedRange=this.range.map(Ue)}update(){const{domain:e,range:t}=this;e.length<2&&(ie.warnOnce("`colorDomain` should have at least 2 values."),e.length===0?e.push(0,1):e.length===1&&e.push(e[0]+1));for(let n=1;n<e.length;n++){const r=e[n-1],a=e[n];if(r>a){ie.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((o,h)=>o-h);break}}const i=this.mode==="discrete"?e.length-1:e.length;if(t.length<i)for(let n=t.length;n<i;n++)t.push(t.length>0?t[0]:"black");this.parsedRange=this.range.map(Ue)}normalizeDomains(...e){return{domain:e.map(t=>t.domain).flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const{domain:t,range:i,parsedRange:n}=this,r=t[0],a=t.at(-1),o=i[0],h=i.at(-1);if(e<=r)return o;if(e>=a)return h;let c,l;if(t.length===2){const f=(e-r)/(a-r),g=1/(i.length-1);c=i.length<=2?0:Math.min(Math.floor(f*(i.length-1)),i.length-2),l=(f-c*g)/g}else{for(c=0;c<t.length-2&&!(e<t[c+1]);c++);const f=t[c],g=t[c+1];l=(e-f)/(g-f)}if(this.mode==="discrete")return i[c];const u=n[c],d=n[c+1];return bs(u,d,l).toRgbaString()}invert(){}getDomainMinMax(){return ne(this.domain)}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&ie.warnOnce("Expected update to not invalidate scale"))}};return p([xt],s.prototype,"domain",2),p([xt],s.prototype,"range",2),p([xt],s.prototype,"mode",2),s})(),ae=class{constructor(s,e=[],t){this.colorSpace=s,this.stops=e,this.bbox=t,this._cache=void 0}createGradient(s,e,t){const i=this.bbox??e;if(!i.isFinite())return;if(this._cache?.ctx===s&&this._cache.bbox.equals(i))return this._cache.gradient;const{stops:n,colorSpace:r}=this;if(n.length===0)return;if(n.length===1)return n[0].color;let a=this.createCanvasGradient(s,i,t);if(a==null)return;const o=r==="oklch",h=.05;let c=n[0];a.addColorStop(c.stop,c.color);for(let l=1;l<n.length;l+=1){const u=n[l];if(o){const d=new Ze;d.domain=[c.stop,u.stop],d.range=[c.color,u.color];for(let f=c.stop+h;f<u.stop;f+=h)a.addColorStop(f,d.convert(f)??"transparent")}a.addColorStop(u.stop,u.color),c=u}return"createPattern"in a&&(a=a.createPattern()),this._cache={ctx:s,bbox:i,gradient:a},a}toSvg(s){const e=this.bbox??s,t=this.createSvgGradient(e);for(const{stop:i,color:n}of this.stops){const r=ps("stop");r.setAttribute("offset",`${i}`),r.setAttribute("stop-color",`${n}`),t.appendChild(r)}return t}},xs=class extends ae{constructor(s,e,t=0,i){super(s,e,i),this.angle=t}createCanvasGradient(s,e,t){const{angle:n}=this,r=fs(n+-90),a=t?.centerX??e.x+e.width*.5,o=t?.centerY??e.y+e.height*.5;return s.createConicGradient(r,a,o)}createSvgGradient(s){return ds("linearGradient")}};import{createSvgElement as vs,normalizeAngle360FromDegrees as Ms}from"ag-charts-core";var Ss=class extends ae{constructor(s,e,t=0,i){super(s,e,i),this.angle=t}getGradientPoints(s){const{angle:t}=this,i=Ms(t+90),n=Math.cos(i),r=Math.sin(i),a=s.width,o=s.height,h=s.x+a*.5,c=s.y+o*.5,l=Math.hypot(o,a)/2,u=Math.atan2(o,a);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:h+n*f,y0:c+r*f,x1:h-n*f,y1:c-r*f}}createCanvasGradient(s,e){const{x0:t,y0:i,x1:n,y1:r}=this.getGradientPoints(e);if(!(Number.isNaN(t)||Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(r)))return s.createLinearGradient(t,i,n,r)}createSvgGradient(s){const{x0:e,y0:t,x1:i,y1:n}=this.getGradientPoints(s),r=vs("linearGradient");return r.setAttribute("x1",String(e)),r.setAttribute("y1",String(t)),r.setAttribute("x2",String(i)),r.setAttribute("y2",String(n)),r.setAttribute("gradientUnits","userSpaceOnUse"),r}};import{createSvgElement as Cs}from"ag-charts-core";var Ps=class extends ae{constructor(s,e,t){super(s,e,t)}createCanvasGradient(s,e,t){const i=t?.centerX??e.x+e.width*.5,n=t?.centerY??e.y+e.height*.5,r=t?.innerRadius??0,a=t?.outerRadius??Math.hypot(e.width*.5,e.height*.5)/Math.SQRT2;return s.createRadialGradient(i,n,r,i,n,a)}createSvgGradient(s){const e=s.x+s.width*.5,t=s.y+s.height*.5,i=Cs("radialGradient");return i.setAttribute("cx",String(e)),i.setAttribute("cy",String(t)),i.setAttribute("r",String(Math.hypot(s.width*.5,s.height*.5)/Math.SQRT2)),i.setAttribute("gradientUnits","userSpaceOnUse"),i}};import{BaseProperties as Je,PropertiesArray as _s,Property as at,discreteColorStops as Qe,resolveStopPositions as ws}from"ag-charts-core";var Ts=(()=>{var s=class extends Je{constructor(){super(...arguments),this.color="black"}};return p([at],s.prototype,"stop",2),p([at],s.prototype,"color",2),p([at],s.prototype,"name",2),s})(),Ir=(()=>{var s=class extends Je{constructor(){super(...arguments),this.fills=new _s(Ts),this.mode="continuous"}};return p([at],s.prototype,"fills",2),p([at],s.prototype,"domain",2),p([at],s.prototype,"mode",2),p([at],s.prototype,"missingDataFill",2),s})();function ks(s,e){const t=e==="discrete"?1:0,i=s.map((n,r,{length:a})=>({stop:(r+t)/(a-1+t),color:n}));return e==="discrete"?Qe(i):i}function Ds(s,e,t,i="continuous"){const n=s.map(d=>typeof d=="string"?{color:d}:d);if(n.length===0)return ks(e,i);const r=Math.min(...t),a=Math.max(...t),h=ws(n,r,a,i==="discrete");let c=n.find(d=>d.color!=null)?.color,l;const u=n.map((d,f)=>{let g=d?.color;const m=Math.max(0,Math.min(1,(h[f]-r)/(a-r)));return g!=null?c=g:c==null?(l==null&&(l=new Ze,l.domain=[0,1],l.range=e),g=l.convert(m)):g=c,{stop:m,color:g}});return i==="discrete"?Qe(u):u}import{Logger as Ns,createSvgElement as oe,getDOMMatrix as As,normalizeAngle360FromDegrees as Rs}from"ag-charts-core";var Is=class{constructor(s,e){this.imageLoader=s,this._cache=void 0,this.url=e.url,this.backgroundFill=e.backgroundFill??"black",this.backgroundFillOpacity=e.backgroundFillOpacity??1,this.repeat=e.repeat??"no-repeat",this.width=e.width,this.height=e.height,this.fit=e.fit??"stretch",this.rotation=e.rotation??0}createCanvasImage(s,e,t,i){if(!e)return null;const[n,r]=this.getSize(e.width,e.height,t,i);return n<1||r<1?(Ns.warnOnce("Image fill is too small to render, ignoring."),null):s.createPattern(e,this.repeat)}getSize(s,e,t,i){const{fit:n}=this;let r=s,a=e,o=1;const h=t/i,c=s/e;return n==="stretch"||s===0||e===0?(r=t,a=i):n==="contain"?o=c>h?t/s:i/e:n==="cover"&&(o=c>h?i/e:t/s),[Math.max(1,r*o),Math.max(1,a*o)]}setImageTransform(s,e){if(typeof s=="string")return;const{url:t,rotation:i,width:n,height:r}=this,a=this.imageLoader?.loadImage(t);if(!a)return;const o=Rs(i),h=Math.cos(o),c=Math.sin(o),[l,u]=this.getSize(a.width,a.height,n??e.width,r??e.height),d=l/a.width,f=u/a.height,g=e.x+e.width/2,m=e.y+e.height/2,y=h*l-c*u,b=c*l+h*u,x=y/2,v=b/2,S=As();s?.setTransform(new S([h*d,c*f,-c*d,h*f,g-x,m-v]))}createPattern(s,e,t,i){const n=this.width??e,r=this.height??t,a=this._cache;if(a?.ctx===s&&a.width===n&&a.height===r)return a.pattern;const o=this.imageLoader?.loadImage(this.url,i),h=this.createCanvasImage(s,o,n,r);if(h!=null)return this._cache={ctx:s,pattern:h,width:n,height:r},h}toSvg(s,e){const{url:t,rotation:i,backgroundFill:n,backgroundFillOpacity:r}=this,{x:a,y:o,width:h,height:c}=s,l=oe("pattern");l.setAttribute("viewBox",`0 0 ${h} ${c}`),l.setAttribute("x",String(a)),l.setAttribute("y",String(o)),l.setAttribute("width",String(h)),l.setAttribute("height",String(c)),l.setAttribute("patternUnits","userSpaceOnUse");const u=oe("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(h)),u.setAttribute("height",String(c)),u.setAttribute("fill",n),u.setAttribute("fill-opacity",String(r)),l.appendChild(u);const d=oe("image");return d.setAttribute("href",t),d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(h)),d.setAttribute("height",String(c)),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("transform",`scale(${1/e}) rotate(${i}, ${h/2}, ${c/2})`),l.appendChild(d),l}};import{Logger as Os,createSvgElement as he,getDOMMatrix as Ls,normalizeAngle360FromDegrees as Fs}from"ag-charts-core";import{bezier2DDistance as Es,bezier2DExtrema as zs,evaluateBezier as Ke,getPath2D as ti,lineDistanceSquared as ei,normalizeAngle360 as ii}from"ag-charts-core";import{Logger as si}from"ag-charts-core";var $s=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,D=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,qs=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,ni=/^[01]/,Bs={z:[],h:[D],v:[D],m:[D,D],l:[D,D],t:[D,D],s:[D,D,D,D],q:[D,D,D,D],c:[D,D,D,D,D,D],a:[D,D,D,ni,ni,D,D]};function Gs(s){if(!s)return;const e=[];let t=0,i;for(;t<s.length;){const n=$s.exec(s.slice(t));let r;if(n==null){if(!i){si.warnOnce(`Invalid SVG path, error at index ${t}: Missing command.`);return}r=i}else r=n[1],t+=n[0].length;const a=Ws(r,s,t);if(!a)return;t=a[0],i=r,e.push(a[1])}return e}function Ws(s,e,t){const i=Bs[s.toLocaleLowerCase()],n={command:s,params:[]};for(const r of i){const a=e.slice(t),o=r.exec(a);if(o!=null){n.params.push(Number.parseFloat(o[0])),t+=o[0].length;const h=qs.exec(a.slice(o[0].length));h!=null&&(t+=h[0].length)}else{if(n.params.length===1)return[t,n];si.warnOnce(`Invalid SVG path, error at index ${t}: No path segment parameters for command [${s}]`);return}}return[t,n]}function Xs(s,e){const t=-e/s;return s!==0&&t>=0&&t<=1?[t]:[]}function Ys(s,e,t,i=1e-6){if(Math.abs(s)<i)return Xs(e,t);const n=e*e-4*s*t,r=[];if(Math.abs(n)<i){const a=-e/(2*s);a>=0&&a<=1&&r.push(a)}else if(n>0){const a=Math.sqrt(n),o=(-e-a)/(2*s),h=(-e+a)/(2*s);o>=0&&o<=1&&r.push(o),h>=0&&h<=1&&r.push(h)}return r}function js(s,e,t,i,n=1e-6){if(Math.abs(s)<n)return Ys(e,t,i,n);const r=e/s,a=t/s,o=i/s,h=(3*a-r*r)/9,c=(9*r*a-27*o-2*r*r*r)/54,l=h*h*h+c*c,u=1/3,d=[];if(l>=0){const f=Math.sqrt(l),g=Math.sign(c+f)*Math.pow(Math.abs(c+f),u),m=Math.sign(c-f)*Math.pow(Math.abs(c-f),u),y=Math.abs(Math.sqrt(3)*(g-m)/2),b=-u*r+(g+m);if(b>=0&&b<=1&&d.push(b),Math.abs(y)<n){const x=-u*r-(g+m)/2;x>=0&&x<=1&&d.push(x)}}else{const f=Math.acos(c/Math.sqrt(-h*h*h)),g=u*r,m=2*Math.sqrt(-h),y=m*Math.cos(u*f)-g,b=m*Math.cos(u*(f+2*Math.PI))-g,x=m*Math.cos(u*(f+4*Math.PI))-g;y>=0&&y<=1&&d.push(y),b>=0&&b<=1&&d.push(b),x>=0&&x<=1&&d.push(x)}return d}function ce(s,e,t,i,n,r,a,o){const h=(t-s)*(o-r)-(i-e)*(a-n);if(h===0)return 0;const c=((a-n)*(e-r)-(s-n)*(o-r))/h,l=((t-s)*(e-r)-(i-e)*(s-n))/h;return c>=0&&c<=1&&l>=0&&l<=1?1:0}function Vs(s,e,t,i,n,r,a,o,h,c,l,u){let d=0;const f=c-u,g=l-h,m=h*(u-c)-c*(l-h),y=ri(s,t,n,a),b=ri(e,i,r,o),x=f*y[0]+g*b[0],v=f*y[1]+g*b[1],S=f*y[2]+g*b[2],_=f*y[3]+g*b[3]+m,P=js(x,v,S,_);for(const M of P){const C=M*M,w=M*C,N=y[0]*w+y[1]*C+y[2]*M+y[3],R=b[0]*w+b[1]*C+b[2]*M+b[3];let k;h===l?k=(R-c)/(u-c):k=(N-h)/(l-h),k>=0&&k<=1&&d++}return d}function ri(s,e,t,i){return[-s+3*e-3*t+i,3*s-6*e+3*t,-3*s+3*e,s]}var vt=class{constructor(){this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.commandsLength=0,this.paramsLength=0,this.cx=Number.NaN,this.cy=Number.NaN,this.sx=Number.NaN,this.sy=Number.NaN,this.openedPath=!1,this.closedPath=!1;const s=ti();this.path2d=new s}isEmpty(){return this.commandsLength===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commandsLength||this.previousParams.length!==this.paramsLength||this.previousCommands.toString()!==this.commands.slice(0,this.commandsLength).toString()||this.previousParams.toString()!==this.params.slice(0,this.paramsLength).toString()}getPath2D(){return this.path2d}moveTo(s,e){this.openedPath=!0,this.sx=s,this.sy=e,this.cx=s,this.cy=e,this.path2d.moveTo(s,e),this.commands[this.commandsLength++]=0,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e}lineTo(s,e){this.openedPath?(this.cx=s,this.cy=e,this.path2d.lineTo(s,e),this.commands[this.commandsLength++]=1,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e):this.moveTo(s,e)}cubicCurveTo(s,e,t,i,n,r){this.openedPath||this.moveTo(s,e),this.path2d.bezierCurveTo(s,e,t,i,n,r),this.commands[this.commandsLength++]=2,this.params[this.paramsLength++]=s,this.params[this.paramsLength++]=e,this.params[this.paramsLength++]=t,this.params[this.paramsLength++]=i,this.params[this.paramsLength++]=n,this.params[this.paramsLength++]=r}closePath(){this.openedPath&&(this.cx=this.sx,this.cy=this.sy,this.sx=Number.NaN,this.sy=Number.NaN,this.path2d.closePath(),this.commands[this.commandsLength++]=3,this.openedPath=!1,this.closedPath=!0)}rect(s,e,t,i){this.moveTo(s,e),this.lineTo(s+t,e),this.lineTo(s+t,e+i),this.lineTo(s,e+i),this.closePath()}roundRect(s,e,t,i,n){n=Math.min(n,t/2,i/2),this.moveTo(s,e+n),this.arc(s+n,e+n,n,Math.PI,1.5*Math.PI),this.lineTo(s+n,e),this.lineTo(s+t-n,e),this.arc(s+t-n,e+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(s+t,e+n),this.lineTo(s+t,e+i-n),this.arc(s+t-n,e+i-n,n,0,Math.PI/2),this.lineTo(s+t-n,e+i),this.lineTo(s+n,e+i),this.arc(s+ +n,e+i-n,n,Math.PI/2,Math.PI),this.lineTo(s,e+i-n),this.closePath()}ellipse(s,e,t,i,n,r,a,o=!1){const h=t,c=i/t,l=Math.cos(n),u=Math.sin(n),d=-c*u,f=c*l,g=h*Math.cos(r),m=h*Math.sin(r),y=s+l*g+d*m,b=e+u*g+f*m,x=(y-this.cx)**2+(b-this.cy)**2;this.openedPath?x>1e-6&&this.lineTo(y,b):this.moveTo(y,b);let v=o?-ii(r-a):ii(a-r);Math.abs(Math.abs(a-r)-2*Math.PI)<1e-6&&v<2*Math.PI&&(v+=2*Math.PI*(o?-1:1));const S=Math.max(Math.ceil(Math.abs(v)/(Math.PI/2)),1),_=v/S,P=4/3*Math.tan(_/4);for(let M=0;M<S;M+=1){const C=r+_*(M+0),w=r+_*(M+1),N=h*Math.sin(C),R=h*Math.cos(C),k=h*Math.sin(w),z=h*Math.cos(w),V=R-P*N,it=N+P*R,U=z+P*k,Y=k-P*z,T=z,$=k;this.cubicCurveTo(s+l*V+d*it,e+u*V+f*it,s+l*U+d*Y,e+u*U+f*Y,s+l*T+d*$,e+u*T+f*$)}}arc(s,e,t,i,n,r){this.ellipse(s,e,t,t,0,i,n,r)}appendSvg(s){const e=Gs(s);if(e==null)return!1;let t=0,i=0,n,r,a=0,o=0;for(const{command:h,params:c}of e){n??(n=c[0]),r??(r=c[1]);const l=h===h.toLowerCase(),u=l?n:0,d=l?r:0;switch(h.toLowerCase()){case"m":this.moveTo(u+c[0],d+c[1]),n=u+c[0],r=d+c[1],t=n,i=r;break;case"c":this.cubicCurveTo(u+c[0],d+c[1],u+c[2],d+c[3],u+c[4],d+c[5]),a=u+c[2],o=d+c[3],n=u+c[4],r=d+c[5];break;case"s":this.cubicCurveTo(n+n-a,r+r-o,u+c[0],d+c[1],u+c[2],d+c[3]),a=u+c[0],o=d+c[1],n=u+c[2],r=d+c[3];break;case"q":this.cubicCurveTo((u+2*c[0])/3,(d+2*c[1])/3,(2*c[0]+c[2])/3,(2*c[1]+c[3])/3,c[2],c[3]),a=c[0],o=c[1],n=c[2],r=c[3];break;case"t":this.cubicCurveTo((n+2*(n+n-a))/3,(r+2*(r+r-o))/3,(2*(n+n-a)+c[0])/3,(2*(r+r-o)+c[1])/3,c[0],c[1]),a=n+n-a,o=r+r-o,n=c[0],r=c[1];break;case"a":this.svgEllipse(n,r,c[0],c[1],c[2]*Math.PI/180,c[3],c[4],u+c[5],d+c[6]),n=u+c[5],r=d+c[6];break;case"h":this.lineTo(u+c[0],r),n=u+c[0];break;case"l":this.lineTo(u+c[0],d+c[1]),n=u+c[0],r=d+c[1];break;case"v":this.lineTo(n,d+c[0]),r=d+c[0];break;case"z":this.closePath(),n=t,r=i;break;default:throw new Error(`Could not translate command '${h}' with '${c.join(" ")}'`)}}return!0}svgEllipse(s,e,t,i,n,r,a,o,h){t=Math.abs(t),i=Math.abs(i);const c=(s-o)/2,l=(e-h)/2,u=Math.sin(n),d=Math.cos(n),f=d*c+u*l,g=-u*c+d*l,m=f/t,y=g/i;let b=m*m+y*y,x=(s+o)/2,v=(e+h)/2,S=0,_=0;b>=1?(b=Math.sqrt(b),t*=b,i*=b):(b=Math.sqrt(1/b-1),r===a&&(b=-b),S=b*t*y,_=-b*i*m,x+=d*S-u*_,v+=u*S+d*_);const P=Math.atan2((g-_)/i,(f-S)/t),M=Math.atan2((-g-_)/i,(-f-S)/t)-P,C=P+M,w=!!(1-a);this.ellipse(x,v,t,i,n,P,C,w)}clear(s){s?(this.previousCommands=this.commands.slice(0,this.commandsLength),this.previousParams=this.params.slice(0,this.paramsLength),this.previousClosedPath=this.closedPath,this.commands=[],this.params=[],this.commandsLength=0,this.paramsLength=0):(this.commandsLength=0,this.paramsLength=0);const e=ti();this.path2d=new e,this.openedPath=!1,this.closedPath=!1}isPointInPath(s,e){const t=this.commands,i=this.params,n=this.commandsLength,r=-1e4,a=-1e4;let o=Number.NaN,h=Number.NaN,c=0,l=0,u=0;for(let d=0,f=0;d<n;d++)switch(t[d]){case 0:u+=ce(o,h,c,l,r,a,s,e),c=i[f++],o=c,l=i[f++],h=l;break;case 1:u+=ce(c,l,i[f++],i[f++],r,a,s,e),c=i[f-2],l=i[f-1];break;case 2:u+=Vs(c,l,i[f++],i[f++],i[f++],i[f++],i[f++],i[f++],r,a,s,e),c=i[f-2],l=i[f-1];break;case 3:u+=ce(o,h,c,l,r,a,s,e);break}return u%2===1}distanceSquared(s,e){let t=1/0;const i=this.commands,n=this.params,r=this.commandsLength;let a=Number.NaN,o=Number.NaN,h=0,c=0;for(let l=0,u=0;l<r;l++)switch(i[l]){case 0:h=a=n[u++],c=o=n[u++];break;case 1:{const d=h,f=c;h=n[u++],c=n[u++],t=ei(s,e,d,f,h,c,t);break}case 2:{const d=h,f=c,g=n[u++],m=n[u++],y=n[u++],b=n[u++];h=n[u++],c=n[u++],t=Es(d,f,g,m,y,b,h,c,s,e)**2;break}case 3:t=ei(s,e,h,c,a,o,t);break}return t}toSVG(s=(e,t)=>({x:e,y:t})){const e=[],{commands:t,params:i}=this,n=(a,o)=>{e.push(a);for(let h=0;h<o;h+=2){const{x:c,y:l}=s(i[r++],i[r++]);e.push(c,l)}};let r=0;for(let a=0;a<this.commandsLength;a++)switch(t[a]){case 0:n("M",2);break;case 1:n("L",2);break;case 2:n("C",6);break;case 3:n("Z",0);break}return e.join(" ")}computeBBox(){const{commands:s,params:e}=this;let[t,i,n,r]=[1/0,1/0,-1/0,-1/0],[a,o]=[Number.NaN,Number.NaN],[h,c]=[Number.NaN,Number.NaN];const l=(d,f)=>{t=Math.min(f,t),i=Math.min(d,i),n=Math.max(d,n),r=Math.max(f,r),a=d,o=f};let u=0;for(let d=0;d<this.commandsLength;d++)switch(s[d]){case 0:l(e[u++],e[u++]),h=a,c=o;break;case 1:l(e[u++],e[u++]);break;case 2:{const g=a,m=o,y=e[u++],b=e[u++],x=e[u++],v=e[u++],S=e[u++],_=e[u++],P=zs(g,m,y,b,x,v,S,_);for(const M of P){const C=Ke(g,y,x,S,M),w=Ke(m,b,v,_,M);l(C,w)}l(S,_);break}case 3:l(h,c),h=Number.NaN,c=Number.NaN;break}return new L(i,t,n-i,r-t)}};import{toRadians as wt}from"ag-charts-core";var ai=1e-8;function oi(s,e){const t=e*s,i=t-Math.floor(t),n=Math.abs(i-.5)<ai?t+ai:t;return Math.round(n)/s}function E(s,e,t){const i=oi(s,e);return t==null?i:t===0?0:t<1?Us(s,t):oi(s,t+e)-i}function hi(s,e){return Math.floor(e*s)/s}function Us(s,e){return Math.ceil(e*s)/s}function le(s,e,t){const{width:i,height:n,padding:r,strokeWidth:a}=e,o=i/2,h=n/2,c=Math.max(1,i-r-a/2),l=Math.max(1,n-r-a/2);let u=!1;for(const[d,f]of t){const g=o+(d-.5)*c,m=h+(f-.5)*l;u?s.lineTo(g,m):s.moveTo(g,m),u=!0}s.closePath()}var ci={circles(s,{width:e,strokeWidth:t,padding:i}){const n=e/2,r=Math.max(1,n-i-t/2);s.arc(n,n,r,0,Math.PI*2)},squares(s,{width:e,height:t,pixelRatio:i,padding:n,strokeWidth:r}){const a=n+r/2;s.moveTo(E(i,a),E(i,a)),s.lineTo(E(i,e-a),E(i,a)),s.lineTo(E(i,e-a),E(i,t-a)),s.lineTo(E(i,a),E(i,t-a)),s.closePath()},triangles(s,e){le(s,e,[[.5,0],[1,1],[0,1]])},diamonds(s,e){le(s,e,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(s,{width:e,height:t,padding:i}){const r=Math.max(1,(e-i)/2),a=r/2,o=Math.PI/2;for(let h=0;h<5*2;h++){const c=h%2===0?r:a,l=h*Math.PI/5-o,u=e/2+Math.cos(l)*c,d=t/2+Math.sin(l)*c;s.lineTo(u,d)}s.closePath()},hearts(s,{width:e,height:t,padding:i}){const n=Math.max(1,e/4-i/2),r=e/2,a=t/2+n/2;s.arc(r-n,a-n,n,wt(130),wt(330)),s.arc(r+n,a-n,n,wt(220),wt(50)),s.lineTo(r,a+n),s.closePath()},crosses(s,e){le(s,e,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},"vertical-lines"(s,{width:e,height:t,pixelRatio:i,strokeWidth:n}){const r=E(i,e/2)-n%2/2;s.moveTo(r,0),s.lineTo(r,t)},"horizontal-lines"(s,{width:e,height:t,pixelRatio:i,strokeWidth:n}){const r=E(i,t/2)-n%2/2;s.moveTo(0,r),s.lineTo(e,r)},"forward-slanted-lines"(s,{width:e,height:t,strokeWidth:i}){const n=Math.atan2(t,e),r=i*Math.cos(n),a=i*Math.sin(n);s.moveTo(-r,a),s.lineTo(r,-a),s.moveTo(-r,t+a),s.lineTo(e+r,-a),s.moveTo(e-r,t+a),s.lineTo(e+r,t-a)},"backward-slanted-lines"(s,{width:e,height:t,strokeWidth:i}){const n=Math.atan2(t,e),r=i*Math.cos(n),a=i*Math.sin(n);s.moveTo(e-r,-a),s.lineTo(e+r,a),s.moveTo(-r,-a),s.lineTo(e+r,t+a),s.moveTo(-r,t-a),s.lineTo(r,t+a)}},Hs=class{constructor(s){this._cache=void 0,this.width=Math.max(s?.width??10,1),this.height=Math.max(s?.height??10,1),this.fill=s.fill??"none",this.fillOpacity=s.fillOpacity??1,this.backgroundFill=s.backgroundFill??"none",this.backgroundFillOpacity=s.backgroundFillOpacity??1,this.stroke=s.stroke??"black",this.strokeOpacity=s.strokeOpacity??1,this.strokeWidth=s.strokeWidth??1,this.padding=s.padding??1,this.pattern=s.pattern??"forward-slanted-lines",this.rotation=s.rotation??0,this.scale=s.scale??1,this.path=s.path}getPath(s){const{pattern:e,width:t,height:i,padding:n,strokeWidth:r,path:a}=this,o=new vt;let h=ci[e]!=null;return a&&h&&(h=!o.appendSvg(a)),h&&ci[e](o,{width:t,height:i,pixelRatio:s,strokeWidth:r,padding:n}),o}renderStroke(s,e){const{stroke:t,strokeWidth:i,strokeOpacity:n}=this;i&&(e.strokeStyle=t,e.lineWidth=i,e.globalAlpha=n,e.stroke(s))}renderFill(s,e){const{fill:t,fillOpacity:i}=this;t!=="none"&&(e.fillStyle=t,e.globalAlpha=i,e.fill(s))}createCanvasPattern(s,e){const{width:t,height:i,scale:n,backgroundFill:r,backgroundFillOpacity:a}=this;if(t*n<1||i*n<1)return Os.warnOnce("Pattern fill is too small to render, ignoring."),null;const o=new Jt({width:t,height:i,pixelRatio:e*n}),h=o.context;r!=="none"&&(h.fillStyle=r,h.globalAlpha=a,h.fillRect(0,0,t,i));const c=this.getPath(e).getPath2D();this.renderFill(c,h),this.renderStroke(c,h);const l=s.createPattern(o.canvas,"repeat");return this.setPatternTransform(l,e),o.destroy(),l}setPatternTransform(s,e,t=0,i=0){if(s==null)return;const n=Fs(this.rotation),r=1/e,a=Math.cos(n)*r,o=Math.sin(n)*r,h=Ls();s.setTransform(new h([a,o,-o,a,t,i]))}createPattern(s,e){if(this._cache?.ctx===s&&this._cache.pixelRatio===e)return this._cache.pattern;const t=this.createCanvasPattern(s,e);if(t!=null)return this._cache={ctx:s,pattern:t,pixelRatio:e},t}toSvg(){const{width:s,height:e,fill:t,fillOpacity:i,backgroundFill:n,backgroundFillOpacity:r,stroke:a,strokeWidth:o,strokeOpacity:h,rotation:c,scale:l}=this,u=he("pattern");u.setAttribute("viewBox",`0 0 ${s} ${e}`),u.setAttribute("width",String(s)),u.setAttribute("height",String(e)),u.setAttribute("patternUnits","userSpaceOnUse");const d=he("rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(s)),d.setAttribute("height",String(e)),d.setAttribute("fill",n),d.setAttribute("fill-opacity",String(r)),u.appendChild(d);const f=he("path");return f.setAttribute("fill",t),f.setAttribute("fill-opacity",String(i)),f.setAttribute("stroke-opacity",String(h)),f.setAttribute("stroke",a),f.setAttribute("stroke-width",String(o)),f.setAttribute("transform",`rotate(${c}) scale(${l})`),f.setAttribute("d",this.getPath(1).toSVG()),u.appendChild(f),u}};function li(s,e){const{fontStyle:t,fontWeight:i,fontSize:n,fontFamily:r}=e;t&&s.setAttribute("font-style",t),i&&s.setAttribute("font-weight",String(i)),n!=null&&s.setAttribute("font-size",String(n)),r&&s.setAttribute("font-family",r)}function Zs(s,e){const{stroke:t,strokeWidth:i,strokeOpacity:n}=e;t&&s.setAttribute("stroke",t),i!=null&&s.setAttribute("stroke-width",String(i)),n!=null&&s.setAttribute("stroke-opacity",String(n))}function Js(s,e){const{lineDash:t,lineDashOffset:i}=e;if(t?.some(n=>n!==0)){const n=t.length%2===1?[...t,...t]:t;s.setAttribute("stroke-dasharray",n.join(" ")),i!=null&&s.setAttribute("stroke-dashoffset",String(i))}}var Qs=(()=>{var s=class extends bt{constructor(){super(...arguments),this.drawingMode="overlay",this.fillOpacity=1,this.strokeOpacity=1,this.fill="black",this.strokeWidth=0,this.lineDashOffset=0,this.opacity=1}getGradient(t){if(te(t))return this.createGradient(t)}createGradient(t){const{colorSpace:i="rgb",gradient:n="linear",colorStops:r,rotation:a=0,reverse:o=!1}=t;if(r==null)return;let h=Ds(r,["black"],[0,1]);switch(o&&(h=h.map(c=>({color:c.color,stop:1-c.stop})).reverse()),n){case"linear":return new Ss(i,h,a);case"radial":return new Ps(i,h);case"conic":return new xs(i,h,a)}}getPattern(t){if(Ye(t))return this.createPattern(t)}createPattern(t){return new Hs(t)}getImage(t){if(Xe(t))return this.createImage(t)}createImage(t){return new Is(this.imageLoader,t)}onFillChange(){typeof this.fill=="object"&&_t(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,i){return E(this.layerManager?.canvas?.pixelRatio??1,t,i)}markDirty(t){super.markDirty(t),this.cachedDefaultGradientFillBBox=void 0}fillStroke(t,i){this.__drawingMode==="cutout"&&(t.globalCompositeOperation="destination-out",this.executeFill(t,i),t.globalCompositeOperation="source-over"),this.renderFill(t,i),this.renderStroke(t,i)}renderFill(t,i){const{__fill:n,__fillOpacity:r=1,fillImage:a}=this;if(n!=null&&n!=="none"&&r>0){const o=t.globalAlpha;a&&(t.globalAlpha=a.backgroundFillOpacity,t.fillStyle=a.backgroundFill,this.executeFill(t,i),t.globalAlpha=o),this.applyFillAndAlpha(t),this.applyShadow(t),this.executeFill(t,i),t.globalAlpha=o,this.fillShadow?.enabled&&(t.shadowColor="rgba(0, 0, 0, 0)")}}executeFill(t,i){i?t.fill(i):t.fill()}applyFillAndAlpha(t){const{__fill:i,fillGradient:n,fillPattern:r,fillImage:a,__fillOpacity:o=1,__opacity:h=1}=this,c=h*o;if(c!==1&&(t.globalAlpha*=c),n){const{fillBBox:l=this.getDefaultGradientFillBBox()??this.getBBox(),fillParams:u}=this;t.fillStyle=n.createGradient(t,l,u)??"black"}else if(r){const{x:l,y:u}=this.getBBox(),d=this.layerManager?.canvas?.pixelRatio??1,f=r.createPattern(t,d);r.setPatternTransform(f,d,l,u),f?t.fillStyle=f:(t.fillStyle=r.fill,t.globalAlpha*=r.fillOpacity)}else if(a){const l=this.getBBox(),u=a.createPattern(t,l.width,l.height,this);a.setImageTransform(u,l),t.fillStyle=u??"transparent"}else t.fillStyle=typeof i=="string"?i:"black"}applyStrokeAndAlpha(t){const{__stroke:i,__strokeOpacity:n=1,strokeGradient:r,__opacity:a=1}=this;t.strokeStyle=r?.createGradient(t,this.getBBox())??(typeof i=="string"?i:void 0)??"black";const o=a*n;o!==1&&(t.globalAlpha*=o)}applyShadow(t){const i=this.layerManager?.canvas.pixelRatio??1,{__fillShadow:n}=this;n?.enabled&&(t.shadowColor=n.color,t.shadowOffsetX=n.xOffset*i,t.shadowOffsetY=n.yOffset*i,t.shadowBlur=n.blur*i)}renderStroke(t,i){const{__stroke:n,__strokeWidth:r=0,__strokeOpacity:a=1,__lineDash:o,__lineDashOffset:h,__lineCap:c,__lineJoin:l,__miterLimit:u}=this;if(n!=null&&n!=="none"&&r>0&&a>0){const{globalAlpha:d}=t;this.applyStrokeAndAlpha(t),t.lineWidth=r,o&&t.setLineDash(o),h&&(t.lineDashOffset=h),c&&(t.lineCap=c),l&&(t.lineJoin=l),u!=null&&(t.miterLimit=u),this.executeStroke(t,i),t.globalAlpha=d}}executeStroke(t,i){i?t.stroke(i):t.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox??(this.cachedDefaultGradientFillBBox=Object.freeze(this.computeDefaultGradientFillBBox())),this.cachedDefaultGradientFillBBox}computeDefaultGradientFillBBox(){}containsPoint(t,i){return this.isPointInPath(t,i)}applySvgFillAttributes(t,i){const{fill:n,fillOpacity:r}=this;if(typeof n=="string")t.setAttribute("fill",n);else if(te(n)&&this.fillGradient){i??(i=[]);const a=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),o=Kt();a.setAttribute("id",o),i.push(a),t.setAttribute("fill",`url(#${o})`)}else if(Ye(n)&&this.fillPattern){i??(i=[]);const a=this.fillPattern.toSvg(),o=Kt();a.setAttribute("id",o),i.push(a),t.setAttribute("fill",`url(#${o})`)}else if(Xe(n)&&this.fillImage){i??(i=[]);const a=this.layerManager?.canvas?.pixelRatio??1,o=this.fillImage.toSvg(this.getBBox(),a),h=Kt();o.setAttribute("id",h),i.push(o),t.setAttribute("fill",`url(#${h})`)}else t.setAttribute("fill","none");return t.setAttribute("fill-opacity",String(r)),i}applySvgStrokeAttributes(t){const{stroke:i,strokeOpacity:n,strokeWidth:r,lineDash:a,lineDashOffset:o}=this;Zs(t,{stroke:us(i)?i:void 0,strokeOpacity:n,strokeWidth:r}),Js(t,{lineDash:a,lineDashOffset:o})}static handleFillChange(t){t.onFillChange()}static handleStrokeChange(t){t.onStrokeChange()}setStyleProperties(t,i,n){const r=t?.opacity??1,a=t?.fill,o=(t?.fillOpacity??1)*r,h=(t?.strokeOpacity??1)*r,c=t?.strokeWidth??0,l=t?.lineDashOffset??0;let u=!1;this.__fillOpacity!==o&&(this.__fillOpacity=o,u=!0),this.__strokeOpacity!==h&&(this.__strokeOpacity=h,u=!0),this.__strokeWidth!==c&&(this.__strokeWidth=c,u=!0),this.__lineDashOffset!==l&&(this.__lineDashOffset=l,u=!0),this.__lineDash!==t?.lineDash&&(this.__lineDash=t?.lineDash,u=!0),this.setFillProperties(a,i,n),a!==this.fill&&(this.fill=a),t?.stroke!==this.stroke&&(this.stroke=t?.stroke),u&&this.markDirty()}setFillProperties(t,i,n){const r=i==null||!te(t)||t.bounds==null||t.bounds==="item"?void 0:i[t.bounds];let a=!1;this.__fillBBox!==r&&(this.__fillBBox=r,a=!0),this.__fillParams!==n&&(this.__fillParams=n,a=!0),a&&(this.onFillChange(),this.markDirty())}};return p([Z()],s.prototype,"drawingMode",2),p([Z()],s.prototype,"fillOpacity",2),p([Z()],s.prototype,"strokeOpacity",2),p([Qt({equals:_t,changeCb:s.handleFillChange})],s.prototype,"fill",2),p([We({equals:_t,changeCb:s.handleStrokeChange})],s.prototype,"stroke",2),p([Z()],s.prototype,"strokeWidth",2),p([os()],s.prototype,"lineDash",2),p([Z()],s.prototype,"lineDashOffset",2),p([Z()],s.prototype,"lineCap",2),p([Z()],s.prototype,"lineJoin",2),p([Z()],s.prototype,"miterLimit",2),p([Z({convertor:e=>ls(0,e??1,1)})],s.prototype,"opacity",2),p([We({equals:hs,checkDirtyOnAssignment:!0})],s.prototype,"fillShadow",2),p([Qt({equals:cs,changeCb:e=>e.onFillChange()})],s.prototype,"fillBBox",2),p([Qt({equals:_t,changeCb:e=>e.onFillChange()})],s.prototype,"fillParams",2),s})(),Mt=Qs;import{createSvgElement as Ks}from"ag-charts-core";import{isNumberEqual as dt}from"ag-charts-core";var ui=[1,0,0,1,0,0],ot=class Xt{get e(){return[...this.elements]}constructor(e=ui){this.elements=[...e]}setElements(e){const t=this.elements;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],this}get identity(){const e=this.elements;return dt(e[0],1)&&dt(e[1],0)&&dt(e[2],0)&&dt(e[3],1)&&dt(e[4],0)&&dt(e[5],0)}AxB(e,t,i){const n=e[0]*t[0]+e[2]*t[1],r=e[1]*t[0]+e[3]*t[1],a=e[0]*t[2]+e[2]*t[3],o=e[1]*t[2]+e[3]*t[3],h=e[0]*t[4]+e[2]*t[5]+e[4],c=e[1]*t[4]+e[3]*t[5]+e[5];i=i??e,i[0]=n,i[1]=r,i[2]=a,i[3]=o,i[4]=h,i[5]=c}multiplySelf(e){return this.AxB(this.elements,e.elements),this}multiply(e){const t=[Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN,Number.NaN];return e instanceof Xt?this.AxB(this.elements,e.elements,t):this.AxB(this.elements,[e.a,e.b,e.c,e.d,e.e,e.f],t),new Xt(t)}preMultiplySelf(e){return this.AxB(e.elements,this.elements,this.elements),this}inverse(){const e=this.elements;let t=e[0],i=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],h=1/(t*r-i*n);return t*=h,i*=h,n*=h,r*=h,new Xt([r,-i,-n,t,n*o-r*a,i*a-t*o])}invertSelf(){const e=this.elements;let t=e[0],i=e[1],n=e[2],r=e[3];const a=e[4],o=e[5],h=1/(t*r-i*n);return t*=h,i*=h,n*=h,r*=h,e[0]=r,e[1]=-i,e[2]=-n,e[3]=t,e[4]=n*o-r*a,e[5]=i*a-t*o,this}transformPoint(e,t){const i=this.elements;return{x:e*i[0]+t*i[2]+i[4],y:e*i[1]+t*i[3]+i[5]}}transformBBox(e,t){const i=this.elements,n=i[0],r=i[1],a=i[2],o=i[3],h=e.width*.5,c=e.height*.5,l=e.x+h,u=e.y+c,d=Math.abs(h*n)+Math.abs(c*a),f=Math.abs(h*r)+Math.abs(c*o);return t??(t=new L(0,0,0,0)),t.x=l*n+u*a+i[4]-d,t.y=l*r+u*o+i[5]-f,t.width=d+d,t.height=f+f,t}toContext(e){if(this.identity)return;const t=this.elements;e.transform(t[0],t[1],t[2],t[3],t[4],t[5])}static updateTransformMatrix(e,t,i,n,r,a,o){const h=t,c=i;let l,u;h===1&&c===1?(l=0,u=0):(l=o?.scalingCenterX??0,u=o?.scalingCenterY??0);const d=n,f=Math.cos(d),g=Math.sin(d);let m,y;d===0?(m=0,y=0):(m=o?.rotationCenterX??0,y=o?.rotationCenterY??0);const b=r,x=a,v=l*(1-h)-m,S=u*(1-c)-y;return e.setElements([f*h,g*h,-g*c,f*c,f*v-g*S+m+b,g*v+f*S+y+x]),e}};function K(s){return fi(s.constructor)}var di=Symbol("isMatrixTransform");function fi(s){return s[di]===!0}function ue(s){var e,t;const i=s;if(fi(s))return s;const n=Symbol("matrix_combined_transform");class r extends i{constructor(){super(...arguments),this[t]=new ot,this._dirtyTransform=!0}onChangeDetection(o){super.onChangeDetection(o),this._dirtyTransform=!0,!(this.batchLevel>0)&&this.markDirty("transform")}updateMatrix(o){}computeTransformMatrix(){this._dirtyTransform&&(this[n].setElements(ui),this.updateMatrix(this[n]),this._dirtyTransform=!1)}toParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].transformBBox(o)}toParentPoint(o,h){return this.computeTransformMatrix(),this[n].identity?{x:o,y:h}:this[n].transformPoint(o,h)}fromParent(o){return this.computeTransformMatrix(),this[n].identity?o.clone():this[n].inverse().transformBBox(o)}fromParentPoint(o,h){return this.computeTransformMatrix(),this[n].identity?{x:o,y:h}:this[n].inverse().transformPoint(o,h)}computeBBox(){const o=super.computeBBox();return o&&this.toParent(o)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(o,h){return{x:o,y:h}=this.fromParentPoint(o,h),super.pickNode(o,h)}pickNodes(o,h,c){return{x:o,y:h}=this.fromParentPoint(o,h),super.pickNodes(o,h,c)}render(o){this.computeTransformMatrix();const{ctx:h}=o,c=this[n];let l=!1;try{c.identity||(h.save(),l=!0,c.toContext(h)),super.render(o)}finally{l&&h.restore()}}toSVG(){this.computeTransformMatrix();const o=super.toSVG(),h=this[n];if(h.identity||o==null)return o;const c=Ks("g");c.append(...o.elements);const[l,u,d,f,g,m]=h.e;return c.setAttribute("transform",`matrix(${l} ${u} ${d} ${f} ${g} ${m})`),{elements:[c],defs:o.defs}}}return e=di,t=n,r[e]=!0,r}function St(s){var e;const t=s,i=Symbol("matrix_rotation");class n extends ue(t){constructor(){super(...arguments),this[e]=new ot,this.rotationCenterX=0,this.rotationCenterY=0,this.rotation=0}updateMatrix(a){super.updateMatrix(a);const{rotation:o,rotationCenterX:h,rotationCenterY:c}=this;o!==0&&(ot.updateTransformMatrix(this[i],1,1,o,0,0,{rotationCenterX:h,rotationCenterY:c}),a.multiplySelf(this[i]))}}return e=i,p([I()],n.prototype,"rotationCenterX",2),p([I()],n.prototype,"rotationCenterY",2),p([I()],n.prototype,"rotation",2),n}function pi(s){var e;const t=s,i=Symbol("matrix_scale");class n extends ue(t){constructor(){super(...arguments),this[e]=new ot,this.scalingX=1,this.scalingY=1,this.scalingCenterX=0,this.scalingCenterY=0}updateMatrix(a){super.updateMatrix(a);const{scalingX:o,scalingY:h,scalingCenterX:c,scalingCenterY:l}=this;o===1&&h===1||(ot.updateTransformMatrix(this[i],o,h,0,0,0,{scalingCenterX:c,scalingCenterY:l}),a.multiplySelf(this[i]))}resetScalingProperties(a,o,h,c){this.__scalingX=a,this.__scalingY=o,this.__scalingCenterX=h,this.__scalingCenterY=c,this.onChangeDetection("scaling")}}return e=i,p([I()],n.prototype,"scalingX",2),p([I()],n.prototype,"scalingY",2),p([I()],n.prototype,"scalingCenterX",2),p([I()],n.prototype,"scalingCenterY",2),n}function Tt(s){var e;const t=s,i=Symbol("matrix_translation");class n extends ue(t){constructor(){super(...arguments),this[e]=new ot,this.translationX=0,this.translationY=0}updateMatrix(a){super.updateMatrix(a);const{translationX:o,translationY:h}=this;o===0&&h===0||(ot.updateTransformMatrix(this[i],1,1,0,o,h),a.multiplySelf(this[i]))}}return e=i,p([I()],n.prototype,"translationX",2),p([I()],n.prototype,"translationY",2),n}var ht=class{static fromCanvas(s,e){const t=[];for(const i of s.traverseUp())K(i)&&t.unshift(i);for(const i of t)e=i.fromParent(e);return K(s)&&(e=s.fromParent(e)),e}static toCanvas(s,e){e==null?e=s.getBBox():K(s)&&(e=s.toParent(e));for(const t of s.traverseUp())K(t)&&(e=t.toParent(e));return e}static fromCanvasPoint(s,e,t){const i=[];for(const n of s.traverseUp())K(n)&&i.unshift(n);for(const n of i)({x:e,y:t}=n.fromParentPoint(e,t));return K(s)&&({x:e,y:t}=s.fromParentPoint(e,t)),{x:e,y:t}}static toCanvasPoint(s,e,t){K(s)&&({x:e,y:t}=s.toParentPoint(e,t));for(const i of s.traverseUp())K(i)&&({x:e,y:t}=i.toParentPoint(e,t));return{x:e,y:t}}},kt,tn=(()=>{var s=class Ct extends bt{constructor(t){super(t),this.childNodes=new Set,this.dirty=!1,this.dirtyZIndex=!1,this.clipRect=void 0,this.opacity=1,this._childFontDirty=!0,this.layer=void 0,this.image=void 0,this._lastWidth=Number.NaN,this._lastHeight=Number.NaN,this._lastDevicePixelRatio=Number.NaN,this.isContainerNode=!0,this.renderToOffscreenCanvas=t?.renderToOffscreenCanvas===!0,this.optimizeForInfrequentRedraws=t?.optimizeForInfrequentRedraws===!0}static is(t){return t instanceof Ct}static computeChildrenBBox(t,i=!0){return L.merge(bt.extractBBoxes(t,i))}static compareChildren(t,i){return Zi(t.__zIndex,i.__zIndex)||t.serialNumber-i.serialNumber}containsPoint(t,i){return!0}computeBBox(){return Ct.computeChildrenBBox(this.children())}computeSafeClippingBBox(t){const i=this.computeBBox();if(i?.isFinite()!==!0)return;let n=0;const r=4;for(const f of this.descendants())f instanceof Mt&&(n=Math.max(n,f.strokeWidth));const a=Math.max(1,n/2*r),{x:o,y:h}=ht.toCanvasPoint(this,0,0),c=hi(t,o+i.x-a)-o,l=hi(t,h+i.y-a)-h,u=Math.ceil(i.x+i.width-c+a),d=Math.ceil(i.y+i.height-l+a);return new L(c,l,u,d)}prepareSharedCanvas(t,i,n){return kt?.pixelRatio===n?kt.resize(t,i,n):kt=new Jt({width:t,height:i,pixelRatio:n}),kt}setScene(t){const i=this.scene;super.setScene(t),this.layer&&i&&i!==t&&(i.layersManager.removeLayer(this.layer),this.layer=void 0);for(const n of this.children())n.setScene(t)}resolveFont(){if(!this.renderToOffscreenCanvas)return this.resolveChildFont()}resolveChildFont(){if(this._childFontDirty){this._cachedChildFont=void 0;for(const t of this.children()){const i=t.resolveFont();if(i!=null){this._cachedChildFont=i;break}}this._childFontDirty=!1}return this._cachedChildFont}markDirty(t){this.dirty=!0,this._childFontDirty=!0,super.markDirty(t)}markDirtyChildrenOrder(){super.markDirtyChildrenOrder(),this.dirtyZIndex=!0,this.markDirty()}append(t){for(const i of ns(t))i.remove(),this.childNodes.add(i),i.parentNode=this,i.setScene(this.scene);this.markDirtyChildrenOrder(),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}`);t.parentNode=void 0,t.setScene(),this.markDirtyChildrenOrder(),this.markDirty()}clear(){for(const t of this.children())delete t.parentNode,t.setScene();this.childNodes?.clear(),this.markDirty()}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))){if(this.childNodes!=null&&this.childNodes.size!==0){const n=[...this.children()];for(let r=n.length-1;r>=0;r--){const o=n[r].pickNode(t,i);if(o!=null)return o}}else if(!this.isContainerNode)return this}}pickNodes(t,i,n=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return n;this.isContainerNode||n.push(this);for(const r of this.children())r.pickNodes(t,i,n);return n}isDirty(t){const{width:i,height:n,devicePixelRatio:r}=t,{dirty:a,layer:o}=this,h=o!=null&&(this._lastWidth!==i||this._lastHeight!==n),c=this._lastDevicePixelRatio!==r;return this._lastWidth=i,this._lastHeight=n,this._lastDevicePixelRatio=r,a||h||c}preRender(t){let i;if(this.dirty){i=super.preRender(t,0);for(const n of this.children()){const r=n.preRender(t);i.groups+=r.groups,i.nonGroups+=r.nonGroups,i.complexity+=r.complexity}i.groups+=1,i.nonGroups-=1}else i=this.childNodeCounts;return this.renderToOffscreenCanvas&&!this.optimizeForInfrequentRedraws&&i.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),i}render(t){const{layer:i,renderToOffscreenCanvas:n}=this,r={...t},a=this.isDirty(t);if(this.dirty=!1,!n){this.renderInContext(r),super.render(r);return}const{ctx:o,stats:h,devicePixelRatio:c}=t;let{image:l}=this;if(a){l?.bitmap.close(),l=void 0;const d=i?void 0:this.computeSafeClippingBBox(c),f=(g,...m)=>{const y=g.context;y.direction=r.direction,r.ctx=y,g.clear(),y.save();try{y.setTransform(...m),y.globalAlpha=1,this.renderInContext(r)}finally{y.restore(),y.verifyDepthZero?.()}};if(i)f(i,o.getTransform());else if(d){const{x:g,y:m,width:y,height:b}=d,x=Math.floor(y*c),v=Math.floor(b*c);if(x>0&&v>0){const S=this.prepareSharedCanvas(y,b,c);f(S,c,0,0,c,-g*c,-m*c),l={bitmap:S.transferToImageBitmap(),x:g,y:m,width:y,height:b}}}this.image=l,h&&h.layersRendered++}else h&&h.layersSkipped++;const{globalAlpha:u}=o;if(o.globalAlpha=u*this.opacity,i){o.save();try{o.resetTransform(),i.drawImage(o)}finally{o.restore()}}else if(l){const{bitmap:d,x:f,y:g,width:m,height:y}=l;o.drawImage(d,0,0,m*c,y*c,f,g,m,y)}o.globalAlpha=u,super.render(r)}applyClip(t,i){const{x:n,y:r,width:a,height:o}=i;t.beginPath(),t.rect(n,r,a,o),t.clip()}renderInContext(t){const{ctx:i,stats:n}=t;this.dirtyZIndex&&(this.sortChildren(Ct.compareChildren),this.dirtyZIndex=!1),i.save();try{i.globalAlpha*=this.opacity;const r=this.resolveChildFont();r!=null&&i.font!==r&&(i.font=r),this.clipRect!=null&&(this.applyClip(i,this.clipRect),t.clipBBox=ht.toCanvas(this,this.clipRect));for(const a of this.children()){if(!a.visible){n&&(n.nodesSkipped+=a.childNodeCounts.nonGroups+a.childNodeCounts.groups,n.opsSkipped+=a.childNodeCounts.complexity);continue}a.isolatedRender(t)}}finally{i.restore()}}sortChildren(t){if(!this.childNodes)return;const i=[...this.childNodes].sort(t);this.childNodes.clear();for(const n of i)this.childNodes.add(n)}*children(){yield*this.childNodes}*excludeChildren(t){for(const i of this.children())(t.instance&&!(i instanceof t.instance)||t.name&&i.name!==t.name)&&(yield i)}*descendants(){for(const t of this.children())yield t,t instanceof Ct&&(yield*t.descendants())}setClipRect(t){this.clipRect=t?ht.fromCanvas(this,t):void 0}setClipRectCanvasSpace(t){this.clipRect=t}getVisibility(){for(const t of this.traverseUp(!0))if(!t.visible)return!1;return!0}toSVG(){if(!this.visible)return;const t=[],i=[];for(const n of this.children()){const r=n.toSVG();r!=null&&(i.push(...r.elements),r.defs!=null&&t.push(...r.defs))}return{elements:i,defs:t}}};return s.className="Group",p([I({convertor:e=>ss(0,e,1)})],s.prototype,"opacity",2),s})(),W=tn,Gr=pi(W),Wr=St(W),en=Tt(W),Xr=St(Tt(W));import{Debug as Dt,DebugMetrics as sn,Logger as Nt,TextMeasurer as nn,getWindow as rn,isString as an,toArray as on}from"ag-charts-core";var hn=class{constructor(){this.stats=new Map,this.lastLogTime=Date.now(),this.LOG_INTERVAL_MS=1e4,this.startPeriodicLogging()}startPeriodicLogging(){Dt.check("scene:stats","scene:stats:verbose")&&(this.stopPeriodicLogging(),this.intervalId=setInterval(()=>{this.logAccumulatedStats()},this.LOG_INTERVAL_MS))}stopPeriodicLogging(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0)}recordTiming(s,e){const t=this.stats.get(s);t?(t.min=Math.min(t.min,e),t.max=Math.max(t.max,e),t.sum+=e,t.count+=1):this.stats.set(s,{min:e,max:e,sum:e,count:1})}recordTimings(s){for(const[e,t]of Object.entries(s))e!=="start"&&typeof t=="number"&&this.recordTiming(e,t)}logAccumulatedStats(){if(this.stats.size===0)return;const s=(Date.now()-this.lastLogTime)/1e3,e=Array.from(this.stats.keys()).sort((r,a)=>r==="\u23F1\uFE0F"?-1:a==="\u23F1\uFE0F"?1:r.localeCompare(a)),t=[];for(const r of e){const a=this.stats.get(r),o=a.sum/a.count;t.push(`${r}[${a.min.toFixed(1)}/${o.toFixed(1)}/${a.max.toFixed(1)}]ms`)}const n=this.stats.get("\u23F1\uFE0F")?.count??0;Nt.log(`\u{1F4CA} Stats (${s.toFixed(0)}s, ${n} renders): ${t.join(" ")}`),this.stats.clear(),this.lastLogTime=Date.now()}destroy(){this.stopPeriodicLogging(),this.stats.clear()}},ft,ct=0;function cn(){return ft??(ft=new hn),ft}function ln(){ct++;let s=!1;return()=>{s||ct===0||(s=!0,ct--,ct===0&&bi())}}function un(s){for(const e of["B","KB","MB","GB"]){if(s<1536)return`${s.toFixed(1)}${e}`;s/=1024}return`${s.toFixed(1)}TB}`}function dn(){if(!("memory"in performance))return;const{totalJSHeapSize:s,usedJSHeapSize:e,jsHeapSizeLimit:t}=performance.memory,i=[];for(const n of[e,s,t])typeof n=="number"&&i.push(un(n));return`Heap ${i.join(" / ")}`}function gi(s,e,t,i,n={},r=L.zero,a){if(!Dt.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:o=0,layersSkipped:h=0,nodesRendered:c=0,nodesSkipped:l=0,opsPerformed:u=0,opsSkipped:d=0}=i??{},f=performance.now(),{start:g,...m}=e,y=f-g,b=cn();b.recordTimings(m),b.recordTiming("\u23F1\uFE0F",y);const x=Object.entries(m).map(([T,$])=>yi(T,$)).filter(T=>T!=null).join(" + "),v=Object.entries(n).map(([T,$])=>`${T}: ${JSON.stringify($)}`).join(" ; "),S=Dt.check("scene:stats:verbose"),_=S?dn():null,P=S?sn.flush():{},M=Object.entries(P),C=[],w=[];for(const[T,$]of M)T.endsWith(":aggregation")&&Array.isArray($)?C.push(`${T.replace(":aggregation","")}(${$.join(",")})`):T.endsWith(":nodeData")&&typeof $=="number"&&w.push(`${T.replace(":nodeData","")}(${$})`);const N=C.length>0?`Aggregation: ${C.join(", ")}`:null,R=w.length>0?`NodeData: ${w.join(", ")}`:null,k=[`${yi("\u23F1\uFE0F",g,f)} (${x})`,`${v}`,N,R,`Layers: ${S?de(o,h):s.size}`,S?`Nodes: ${de(c,l)}`:null,S?`Ops: ${de(u,d)}`:null,_].filter(an),z=new nn(t),V=new Map(k.map(T=>[T,z.measureText(T)])),it=Math.max(...Array.from(V.values(),T=>T.width)),U=bn(V.values(),T=>T.height),Y=2+r.x;t.save();try{t.fillStyle=a?.background??"white",t.fillRect(Y,0,it,U),t.fillStyle=a?.foreground??"black";let T=0;for(const[$,yt]of V.entries())T+=yt.height,t.fillText($,Y,T)}catch(T){Nt.warnOnce("Error during debug stats rendering",T)}finally{t.restore()}}function fn(s){const e=on(rn("agChartsSceneDebug")),t=[];for(const i of e)i==="layout"?t.push("seriesRoot","legend","root",/Axis-\d+-axis/):t.push(i);s.debugNodeSearch=t}function pn(s,e){s.save();try{for(const[t,i]of Object.entries(e)){const n=ht.toCanvas(i);if(!n){Nt.log(`Scene.render() - no bbox for debugged node [${t}].`);continue}s.globalAlpha=.8,s.strokeStyle="red",s.lineWidth=1,s.strokeRect(n.x,n.y,n.width,n.height),s.fillStyle="red",s.strokeStyle="white",s.font="16px sans-serif",s.textBaseline="top",s.textAlign="left",s.lineWidth=2,s.strokeText(t,n.x,n.y,n.width),s.fillText(t,n.x,n.y,n.width)}}catch(t){Nt.warnOnce("Error during debug rendering",t)}finally{s.restore()}}var gn=new Set,mn=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function yn(s){const{...e}=s;for(const t of Object.keys(e))mn.has(t)||typeof e[t]!="number"&&typeof e[t]!="string"&&typeof e[t]!="boolean"&&(gn.add(t),delete e[t]);return e}function At(s,e){if(!Dt.check(!0,"scene"))return{};let t=0;return{node:e==="json"?yn(s):s,name:s.name??s.id,dirty:s instanceof W?s.dirty:void 0,...Array.from(s instanceof W?s.children():[],i=>At(i,e)).reduce((i,n)=>{let{name:r}=n;const{node:{visible:a,opacity:o,zIndex:h,translationX:c,translationY:l,rotation:u,scalingX:d,scalingY:f},node:g}=n;(!a||o<=0)&&(r=`(${r})`),W.is(g)&&g.renderToOffscreenCanvas&&(r=`*${r}*`);const m=Array.isArray(h)?`(${h.join(", ")})`:h,y=[`${(t++).toString().padStart(3,"0")}|`,`${r??"<unknown>"}`,`z: ${m}`,c&&`x: ${c}`,l&&`y: ${l}`,u&&`r: ${u}`,d!=null&&d!==1&&`sx: ${d}`,f!=null&&f!==1&&`sy: ${f}`].filter(v=>!!v).join(" ");let b=y,x=1;for(;i[b]!=null&&x<100;)b=`${y} (${x++})`;return i[b]=n,i},{})}}function mi(s){const e=s instanceof W?s.dirty:void 0;if(!e)return{dirtyTree:{},paths:[]};const t=Array.from(s instanceof W?s.children():[],r=>mi(r)).filter(r=>r.paths.length>0),i=W.is(s)?s.name??s.id:s.id,n=t.length?t.flatMap(r=>r.paths).map(r=>`${i}.${r}`):[i];return{dirtyTree:{name:i,node:s,dirty:e,...t.map(r=>r.dirtyTree).filter(r=>r.dirty!=null).reduce((r,a)=>(r[a.name??"<unknown>"]=a,r),{})},paths:n}}function de(s,e){const t=s+e;return`${s} / ${t} (${Math.round(100*s/t)}%)`}function yi(s,e,t){const i=t==null?e:t-e;return`${s}: ${Math.round(i*100)/100}ms`}function bn(s,e){let t=0;for(const i of s)t+=e(i);return t}function bi(s=!1){if(!ft){s&&(ct=0);return}!s&&ct>0||(ft.destroy(),ft=void 0,s&&(ct=0))}import{DeclaredSceneChangeDetection as j,boxesEqual as xn,isNumberEqual as xi}from"ag-charts-core";var Rt=(s,{x0:e,y0:t,x1:i,y1:n,cx:r,cy:a},o,h)=>{if(h&&s.moveTo(e,t),e!==i||t!==n){const c=Math.atan2(t-a,e-r),l=Math.atan2(n-a,i-r);s.arc(r,a,o,c,l)}else s.lineTo(e,t)};import{SceneChangeDetection as fe,createSvgElement as vn}from"ag-charts-core";var pt=(()=>{var s=class extends Mt{constructor(){super(...arguments),this.path=new vt,this._clipX=Number.NaN,this._clipY=Number.NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=Number.NaN}set clipX(e){this._clipX=e,this.dirtyPath=!0}set clipY(e){this._clipY=e,this.dirtyPath=!0}set dirtyPath(e){this._dirtyPath!==e&&(this._dirtyPath=e,e&&this.markDirty("path"))}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}resetPathDirty(){this.path.clear(!0),this._dirtyPath=!1}isPathDirty(){return this.path.isDirty()}onChangeDetection(e){this._dirtyPath=!0,super.onChangeDetection(e)}computeBBox(){return this.updatePathIfDirty(),this.path.computeBBox()}isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}distanceSquared(e,t){return this.distanceSquaredTransformedPoint(e,t)}svgPathData(e){return this.updatePathIfDirty(),this.path.toSVG(e)}distanceSquaredTransformedPoint(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)?0:this.path.distanceSquared(e,t)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(e){return e.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=e.devicePixelRatio,this.updatePathIfDirty(),super.preRender(e,this.path.commands.length)}render(e){const{ctx:t}=e;if(this.clip&&!Number.isNaN(this._clipX)&&!Number.isNaN(this._clipY)){t.save();try{const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new vt),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),t.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(t)}finally{t.restore()}}else this._clipPath=void 0,this.drawPath(t);this.fillShadow?.markClean(),super.render(e)}drawPath(e){this.fillStroke(e,this.path.getPath2D())}toSVG(){if(!this.visible)return;const e=vn("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};return s.className="_c$7",p([fe()],s.prototype,"clip",2),p([fe()],s.prototype,"clipX",1),p([fe()],s.prototype,"clipY",1),s})();function It(s,e,t,i,n){let r=!1,a=!1,o=i-Math.sqrt(Math.max(n**2-t**2,0)),h=0,c=0,l=t-Math.sqrt(Math.max(n**2-i**2,0));return o>s?(r=!0,o=s,h=t-Math.sqrt(Math.max(n**2-(i-s)**2))):xi(o,0)&&(o=0),l>e?(a=!0,c=i-Math.sqrt(Math.max(n**2-(t-e)**2)),l=e):xi(l,0)&&(l=0),{leading0:o,leading1:h,trailing0:c,trailing1:l,leadingClipped:r,trailingClipped:a}}function pe(s,e,t,i,n,r,a){let{topLeft:o,topRight:h,bottomRight:c,bottomLeft:l}=r;const u=Math.max(o+l,h+c),d=Math.max(o+h,l+c);if(u<=0&&d<=0){if(a==null)s.rect(e,t,i,n);else{const M=Math.max(e,a.x),C=Math.min(e+i,a.x+a.width),w=Math.max(t,a.y),N=Math.min(t+n,a.y+a.height);s.rect(M,w,C-M,N-w)}return}else if(a==null&&o===h&&o===c&&o===l){s.roundRect(e,t,i,n,o);return}if(i<0&&(e+=i,i=Math.abs(i)),n<0&&(t+=n,n=Math.abs(n)),i<=0||n<=0)return;if(a==null)a=new L(e,t,i,n);else{const M=Math.max(e,a.x),C=Math.min(e+i,a.x+a.width),w=Math.max(t,a.y),N=Math.min(t+n,a.y+a.height);a=new L(M,w,C-M,N-w)}const f=Math.max(u/n,d/i,1);f>1&&(o/=f,h/=f,c/=f,l/=f);let g=!0,m=!0,y=!0,b=!0,x,v,S,_;if(g){const M=It(a.height,a.width,Math.max(e+o-a.x,0),Math.max(t+o-a.y,0),o);M.leadingClipped&&(b=!1),M.trailingClipped&&(m=!1);const C=Math.max(a.x+M.leading1,a.x),w=Math.max(a.y+M.leading0,a.y),N=Math.max(a.x+M.trailing1,a.x),R=Math.max(a.y+M.trailing0,a.y),k=e+o,z=t+o;x={x0:C,y0:w,x1:N,y1:R,cx:k,cy:z}}if(m){const M=It(a.width,a.height,Math.max(t+h-a.y,0),Math.max(a.x+a.width-(e+i-h),0),h);M.leadingClipped&&(g=!1),M.trailingClipped&&(y=!1);const C=Math.min(a.x+a.width-M.leading0,a.x+a.width),w=Math.max(a.y+M.leading1,a.y),N=Math.min(a.x+a.width-M.trailing0,a.x+a.width),R=Math.max(a.y+M.trailing1,a.y),k=e+i-h,z=t+h;v={x0:C,y0:w,x1:N,y1:R,cx:k,cy:z}}if(y){const M=It(a.height,a.width,Math.max(a.x+a.width-(e+i-c),0),Math.max(a.y+a.height-(t+n-c),0),c);M.leadingClipped&&(m=!1),M.trailingClipped&&(b=!1);const C=Math.min(a.x+a.width-M.leading1,a.x+a.width),w=Math.min(a.y+a.height-M.leading0,a.y+a.height),N=Math.min(a.x+a.width-M.trailing1,a.x+a.width),R=Math.min(a.y+a.height-M.trailing0,a.y+a.height),k=e+i-c,z=t+n-c;S={x0:C,y0:w,x1:N,y1:R,cx:k,cy:z}}if(b){const M=It(a.width,a.height,Math.max(a.y+a.height-(t+n-l),0),Math.max(e+l-a.x,0),l);M.leadingClipped&&(y=!1),M.trailingClipped&&(g=!1);const C=Math.max(a.x+M.leading0,a.x),w=Math.min(a.y+a.height-M.leading1,a.y+a.height),N=Math.max(a.x+M.trailing0,a.x),R=Math.min(a.y+a.height-M.trailing1,a.y+a.height),k=e+l,z=t+n-l;_={x0:C,y0:w,x1:N,y1:R,cx:k,cy:z}}let P=!1;g&&x!=null&&(Rt(s,x,o,!P),P||(P=!0)),m&&v!=null&&(Rt(s,v,h,!P),P||(P=!0)),y&&S!=null&&(Rt(s,S,c,!P),P||(P=!0)),b&&_!=null&&Rt(s,_,l,!P),s.closePath()}var vi=(()=>{var s=class extends pt{constructor(){super(...arguments),this.borderPath=new vt,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=this.__strokeWidth,this.effectiveStrokeWidth=this.__strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(e){this.topLeftCornerRadius=e,this.topRightCornerRadius=e,this.bottomRightCornerRadius=e,this.bottomLeftCornerRadius=e}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.__strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:e,borderPath:t,__crisp:i,__topLeftCornerRadius:n,__topRightCornerRadius:r,__bottomRightCornerRadius:a,__bottomLeftCornerRadius:o}=this;let{__x:h,__y:c,__width:l,__height:u,__strokeWidth:d,__clipBBox:f}=this;const m=1/(this.layerManager?.canvas.pixelRatio??1);let y=1;if(e.clear(),t.clear(),l===0||u===0){this.effectiveStrokeWidth=0,this.lastUpdatePathStrokeWidth=0,this.microPixelEffectOpacity=0;return}if(i&&(l<=m&&(y*=l/m),u<=m&&(y*=u/m),l=this.align(h,l),u=this.align(c,u),h=this.align(h),c=this.align(c),f=f==null?void 0:new L(this.align(f.x),this.align(f.y),this.align(f.x,f.width),this.align(f.y,f.height))),d)if(l<m){const x=h+m/2;t.moveTo(x,c),t.lineTo(x,c+u),d=m,this.borderClipPath=void 0}else if(u<m){const x=c+m/2;t.moveTo(h,x),t.lineTo(h+l,x),d=m,this.borderClipPath=void 0}else if(d<l&&d<u){const x=d/2;h+=x,c+=x,l-=d,u-=d;const v=f?.clone().shrink(x),S={topLeft:n>0?n-d:0,topRight:r>0?r-d:0,bottomRight:a>0?a-d:0,bottomLeft:o>0?o-d:0};this.borderClipPath=void 0,l>0&&u>0&&(v==null||v?.width>0&&v?.height>0)&&(pe(e,h,c,l,u,S,v),pe(t,h,c,l,u,S,v))}else this.borderClipPath=this.borderClipPath??new vt,this.borderClipPath.clear(),this.borderClipPath.rect(h,c,l,u),t.rect(h,c,l,u);else{const x={topLeft:n,topRight:r,bottomRight:a,bottomLeft:o};this.borderClipPath=void 0,pe(e,h,c,l,u,x,f)}if([n,r,a,o].every(Mn)){let x=function(_,P){return S.getBBox().distanceSquared(_,P)};var b=x;const v=this.getBBox();this.hittester=v.containsPoint.bind(v);const S=this;this.distanceSquared=x}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=d,this.lastUpdatePathStrokeWidth=d,this.microPixelEffectOpacity=y}computeBBox(){const{__x:e,__y:t,__width:i,__height:n,__clipBBox:r}=this;return r?.clone()??new L(e,t,i,n)}isPointInPath(e,t){return this.hittester(e,t)}get midPoint(){return{x:this.__x+this.__width/2,y:this.__y+this.__height/2}}setStaticProperties(e,t,i,n,r,a,o,h){this.__drawingMode=e,this.__topLeftCornerRadius=t,this.__topRightCornerRadius=i,this.__bottomRightCornerRadius=n,this.__bottomLeftCornerRadius=r,this.__visible=a,this.__crisp=o,this.__fillShadow=h,this.dirtyPath=!0,this.markDirty()}resetAnimationProperties(e,t,i,n,r,a){this.__x=e,this.__y=t,this.__width=i,this.__height=n,this.__opacity=r,this.__clipBBox=a,this.dirtyPath=!0,this.markDirty()}distanceSquared(e,t){return this.distanceCalculator(e,t)}applyFillAndAlpha(e){super.applyFillAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}applyStrokeAndAlpha(e){super.applyStrokeAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}renderStroke(e){const{stroke:t,effectiveStrokeWidth:i}=this;if(t&&i){const{globalAlpha:n}=e,{lineDash:r,lineDashOffset:a,lineCap:o,lineJoin:h,borderPath:c,borderClipPath:l}=this;l&&e.clip(l.getPath2D()),this.applyStrokeAndAlpha(e),e.lineWidth=i,r&&e.setLineDash(r),a&&(e.lineDashOffset=a),o&&(e.lineCap=o),h&&(e.lineJoin=h),e.stroke(c.getPath2D()),e.globalAlpha=n}}};return s.className="_c$8",p([j()],s.prototype,"x",2),p([j()],s.prototype,"y",2),p([j()],s.prototype,"width",2),p([j()],s.prototype,"height",2),p([j()],s.prototype,"topLeftCornerRadius",2),p([j()],s.prototype,"topRightCornerRadius",2),p([j()],s.prototype,"bottomRightCornerRadius",2),p([j()],s.prototype,"bottomLeftCornerRadius",2),p([j({equals:xn})],s.prototype,"clipBBox",2),p([j()],s.prototype,"crisp",2),s})();function Mn(s){return s===0}var Sn=(()=>{var s=class G extends Mt{constructor(t){super(t),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontCache=void 0,this.fontSize=G.defaultFontSize,this.fontFamily="sans-serif",this.textAlign="start",this.textBaseline="alphabetic",this.boxPadding=0,this.trimText=t?.trimText??!0}onTextChange(){if(this.richText?.clear(),this.textMap?.clear(),rt(this.text))this.lines=[],this.richText??(this.richText=new W),this.richText.setScene(this.scene),this.richText.append(this.text.flatMap(t=>ut(t.text).split(Ut)).filter(Boolean).map(()=>new G({trimText:!1})));else{const t=ut(this.text).split(Ut);this.lines=this.trimText?t.map(i=>i.trim()):t}}get font(){return this.fontCache??(this.fontCache=es(this)),this.fontCache}resolveFont(){if(this.hasRenderableText())return this.font}static measureBBox(t,i,n,r){if(rt(t)){const{font:a,lineHeight:o,textAlign:h,textBaseline:c}=r,{width:l,height:u,lineMetrics:d}=Pt(t,a),f=o?o*d.length:u,g=G.calcTopOffset(f,d[0],c),m=G.calcLeftOffset(l,h);return new L(i-m,n-g,l,f)}else return G.computeBBox(ut(t).split(Ut),i,n,r)}static computeBBox(t,i,n,r){const{font:a,lineHeight:o,textAlign:h,textBaseline:c,isRtl:l}=r,{width:u,height:d,lineMetrics:f}=Ht(a).measureLines(t),g=o?o*f.length:d,m=G.calcTopOffset(g,f[0],c),y=G.calcLeftOffset(u,h,l);return new L(i-y,n-m,u,g)}static calcTopOffset(t,i,n){switch(n){case"alphabetic":return i?.ascent??0;case"middle":return t/2;case"bottom":return t;default:return 0}}static calcSegmentedTopOffset(t,i,n){switch(n){case"alphabetic":return i[0]?.ascent??0;case"middle":return i.length===1?i[0].ascent+i[0].segments.reduce((r,a)=>Math.min(r,Ht(a).baselineDistance("middle")),0):t/2;case"bottom":return t;default:return 0}}static calcLeftOffset(t,i,n){let r=0;switch(i){case"center":r=.5;break;case"right":case(n?"start":"end"):r=1}return t*r}getBBox(){const t=super.getBBox();if(!this.textMap?.size||!rt(this.text))return t;const{height:i,lineMetrics:n}=Pt(this.text,this),r=G.calcSegmentedTopOffset(i,n,this.textBaseline),a=this.y-r;return t.y===a?t:new L(t.x,a,t.width,t.height)}computeBBox(){if(!this.hasRenderableText())return new L(this.x,this.y,0,0);if(this.generateTextMap(),this.textMap?.size){const c=L.merge(this.textMap.values());return c.x=this.x-G.calcLeftOffset(c.width,this.textAlign),c.y=this.y,c}const t=this.scene?.isRtl,{x:i,y:n,lines:r,textBaseline:a,textAlign:o}=this,h=G.computeBBox(r,i,n,{font:this,textBaseline:a,textAlign:o,isRtl:t});return this.boxing!=null&&h.grow(this.boxPadding),h}getTextMeasureBBox(){return this.computeBBox()}getPlainText(){return is(this.text)}isPointInPath(t,i){return this.getBBox()?.containsPoint(t,i)??!1}setScene(t){this.richText?.setScene(t),super.setScene(t)}generateTextMap(){if(!rt(this.text)||this.textMap?.size)return;this.textMap??(this.textMap=new Map);let t=0;const i=this.richText.children();for(const{width:n,height:r,ascent:a,segments:o}of Pt(this.text,this).lineMetrics){let h=0;for(const{color:c,textMetrics:l,...u}of o){const d=i.next().value;d.x=this.x-n/2+h,d.y=a+t,d.setProperties({...u,fill:c??this.fill});const f=d.getBBox();this.textMap.set(d,f),h+=l.width}t+=r}}render(t){const{ctx:i,stats:n}=t;if(!this.layerManager||!this.hasRenderableText()){n&&(n.nodesSkipped+=1);return}if(rt(this.text)&&this.richText){this.generateTextMap();const r=this.richText.getBBox(),{width:a,height:o,lineMetrics:h}=Pt(this.text,this);let c=0;switch(this.textAlign){case"left":case"start":c=a/2;break;case"right":case"end":c=a/-2}const l=this.y-G.calcSegmentedTopOffset(o,h,this.textBaseline);this.renderBoxing(t,r.clone().translate(c,l)),i.save(),i.translate(c,l),this.richText.opacity=this.opacity,this.richText.render(t),i.restore()}else this.renderText(t);if(G.debug.check()){const r=this.getBBox();i.lineWidth=this.textMap?.size?2:1,i.strokeStyle=this.textMap?.size?"blue":"red",i.strokeRect(r.x,r.y,r.width,r.height)}super.render(t)}markDirty(t){return this.textMap?.clear(),super.markDirty(t)}renderText(t){const{fill:i,stroke:n,strokeWidth:r,font:a,textAlign:o}=this;if(!i&&!(n&&r)||!this.layerManager)return super.render(t);const{ctx:h}=t;h.font!==a&&(h.font=a),h.textAlign=o,this.renderBoxing(t),this.fillStroke(h)}renderBoxing(t,i){if(!this.boxing)return;const n=i??G.computeBBox(this.lines,this.x,this.y,this);if(n.width===0||n.height===0)return;const{x:r,y:a,width:o,height:h}=n.grow(this.boxPadding);this.boxing.opacity=this.opacity,this.boxing.x=r,this.boxing.y=a,this.boxing.width=o,this.boxing.height=h,this.boxing.preRender(t),this.boxing.render(t)}executeFill(t){this.renderLines((i,n,r)=>t.fillText(i,n,r))}executeStroke(t){this.renderLines((i,n,r)=>t.strokeText(i,n,r))}renderLines(t){const{x:i,y:n,lines:r}=this;if(!Number.isFinite(i)||!Number.isFinite(n))return;const a=Ht(this),{lineMetrics:o}=a.measureLines(r),{textBaseline:h,lineHeight:c=a.lineHeight()}=this;let l=0;h==="top"?l=o[0].ascent:(h==="middle"||h==="bottom")&&(l=c*(1-r.length),h==="middle"?(l/=2,l-=a.baselineDistance(h)):l-=o[0].descent);for(const u of o)t(u.text,i,n+l),l+=c}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}setBoxing(t){const i=t.border?.enabled?t.border?.stroke:void 0;t.fill!=null||i!=null?(this.boxing??(this.boxing=new vi({scene:this.scene})),this.boxing.fill=t.fill,this.boxing.fillOpacity=t.fillOpacity??1,this.boxing.cornerRadius=t.cornerRadius??0,this.boxing.stroke=i,this.boxing.strokeWidth=t.border?.strokeWidth??0,this.boxing.strokeOpacity=t.border?.strokeOpacity??1,this.boxPadding=t.padding??0):this.boxing&&(this.boxing.destroy(),this.boxing=void 0)}hasBoxing(){return this.boxing!=null}getBoxingProperties(){const{fill:t,fillOpacity:i,cornerRadius:n,stroke:r,strokeWidth:a,strokeOpacity:o}=this.boxing??{};return{border:{enabled:r!=null,stroke:r,strokeWidth:a,strokeOpacity:o},cornerRadius:n,fill:t,fillOpacity:i,padding:this.boxPadding}}toSVG(){if(!this.visible||!this.hasRenderableText())return;const t=this.text;if(t==null)return;const i=ze("text");if(rt(t))for(const n of t){const r=ze("tspan");li(r,{fontSize:n.fontSize??this.fontSize,fontFamily:n.fontFamily??this.fontFamily,fontWeight:n.fontWeight??this.fontWeight,fontStyle:n.fontStyle??this.fontStyle}),this.applySvgFillAttributes(r),r.textContent=ut(n.text),i.append(r)}else this.applySvgFillAttributes(i),li(i,this),i.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),i.setAttribute("alignment-baseline",this.textBaseline),i.setAttribute("x",String(this.x)),i.setAttribute("y",String(this.y)),i.textContent=ut(t);return{elements:[i]}}hasRenderableText(){const{text:t}=this;return t==null?!1:rt(t)?!0:ut(t)!==""}};return s.className="Text",s.debug=Ki.create(!0,"scene:text"),s.defaultFontSize=10,p([I()],s.prototype,"x",2),p([I()],s.prototype,"y",2),p([ts({changeCb:e=>e.onTextChange()})],s.prototype,"text",2),p([I({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontStyle",2),p([I({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontWeight",2),p([I({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontSize",2),p([I({changeCb:e=>{e.fontCache=void 0}})],s.prototype,"fontFamily",2),p([I()],s.prototype,"textAlign",2),p([I()],s.prototype,"textBaseline",2),p([I()],s.prototype,"lineHeight",2),s})(),Mi=Sn,Cn=St(Mi),Ur=St(Tt(Mi)),Pn=(()=>{var s=class extends Ae{};return p([F],s.prototype,"visible",2),p([F],s.prototype,"text",2),p([F],s.prototype,"renderer",2),s})(),_n=(()=>{var s=class extends Ae{constructor(){super(...arguments),this.id=zi(this),this.node=new Cn({zIndex:1}).setProperties({textAlign:"center",pointerEvents:1}),this.enabled=!1,this.textAlign="center",this.fontSize=Fi.SMALLER,this.fontFamily="sans-serif",this.wrapping="always",this.truncate=!0,this.padding=0,this.layoutStyle="block",this.tooltip=new Pn,this.truncated=!1}registerInteraction(e,t){return e.eventsHub.on("layout:complete",()=>this.updateA11yText(e,t))}computeTextWrap(e,t){const{text:i,padding:n,wrapping:r,truncate:a}=this,o=a?e:1/0,h=a?t:1/0,c=Math.min(this.maxWidth??1/0,o)-n*2,l=this.maxHeight??h-n*2,u={maxWidth:c,maxHeight:l,font:this,textWrap:r};if(!Number.isFinite(c)&&!Number.isFinite(l)){this.node.text=i;return}let d;$i(i)?(d=Wi(i,u),this.truncated=d.some(qi)):(d=Gi(Ie(i),u),this.truncated=Bi(d)),this.node.text=d}updateA11yText(e,t){const{proxyInteractionService:i}=e;if(!this.enabled||!this.text){this.destroyProxyText();return}const n=ht.toCanvas(this.node);if(!n)return;const{id:r}=this;this.proxyText==null&&(this.proxyText=i.createProxyElement({type:"text",domManagerId:r,where:t}),this.proxyTextListeners=[this.proxyText.addListener("mousemove",h=>this.handleMouseMove(e,h)),this.proxyText.addListener("mouseleave",()=>this.handleTooltipHide(e)),this.proxyText.addListener("focus",()=>this.handleFocus(e)),this.proxyText.addListener("blur",()=>this.handleTooltipHide(e))]);const a=Re(this.text);a!==this.lastProxyTextContent&&(this.proxyText.textContent=a,this.lastProxyTextContent=a);const{lastProxyBBox:o}=this;(o==null||n.x!==o.x||n.y!==o.y||n.width!==o.width||n.height!==o.height)&&(this.proxyText.setBounds(n),this.lastProxyBBox={x:n.x,y:n.y,width:n.width,height:n.height})}getEffectiveTooltipVisible(){const{visible:e,text:t,renderer:i}=this.tooltip;return e??(t!=null||i!=null?"always":"auto")}getTooltipContent(e){const t=Re(this.text),{renderer:i,text:n}=this.tooltip;if(i!=null){const a={text:t},o=Ei(e.chartService,i,a);if(o==="")return;if(o!=null)return{type:"raw",rawHtmlString:Ie(o)}}return{type:"structured",title:n??t}}showTooltip(e,t,i){if(!this.enabled)return;const n=this.getEffectiveTooltipVisible();if(n==="never"||n==="auto"&&!this.truncated)return;const r=this.getTooltipContent(e);r!=null&&e.tooltipManager.updateTooltip(this.id,{canvasX:t,canvasY:i,showArrow:!1},[r])}handleMouseMove(e,t){if(t==null)return;const{x:i,y:n}=ht.toCanvas(this.node),r=t.sourceEvent.offsetX+i,a=t.sourceEvent.offsetY+n;this.showTooltip(e,r,a)}handleFocus(e){const t=ht.toCanvas(this.node);if(!t)return;const i=t.x+t.width/2,n=t.y+t.height/2;this.showTooltip(e,i,n)}handleTooltipHide(e){e.tooltipManager.removeTooltip(this.id,void 0,!0)}destroy(){this.destroyProxyText()}destroyProxyText(){if(this.proxyText!=null){for(const e of this.proxyTextListeners??[])e();this.proxyTextListeners=void 0,this.proxyText.destroy(),this.proxyText=void 0,this.lastProxyTextContent=void 0,this.lastProxyBBox=void 0}}};return s.className="_c$11",p([F,Q("node","visible")],s.prototype,"enabled",2),p([F,Q("node")],s.prototype,"text",2),p([F,Q("node")],s.prototype,"textAlign",2),p([F,Q("node")],s.prototype,"fontStyle",2),p([F,Q("node")],s.prototype,"fontWeight",2),p([F,Q("node")],s.prototype,"fontSize",2),p([F,Q("node")],s.prototype,"fontFamily",2),p([F,Q("node","fill")],s.prototype,"color",2),p([F],s.prototype,"spacing",2),p([F],s.prototype,"maxWidth",2),p([F],s.prototype,"maxHeight",2),p([F],s.prototype,"wrapping",2),p([F],s.prototype,"truncate",2),p([F],s.prototype,"padding",2),p([F],s.prototype,"layoutStyle",2),p([F],s.prototype,"tooltip",2),s})();import{DeclaredSceneChangeDetection as ge,DeclaredSceneObjectChangeDetection as wn,TRIPLE_EQ as Tn}from"ag-charts-core";import{toRadians as Ot}from"ag-charts-core";function Lt(s,e){const{path:t,size:i}=s,{x:n,y:r}=s;t.clear();let a=!1;for(const[o,h]of e){const c=n+(o-.5)*i,l=r+(h-.5)*i;a?t.lineTo(c,l):t.moveTo(c,l),a=!0}t.closePath()}var kn={circle({path:s,x:e,y:t,size:i}){const n=i/2;s.arc(e,t,n,0,Math.PI*2),s.closePath()},cross(s){Lt(s,[[.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(s){Lt(s,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:s,x:e,y:t,size:i}){const n=i/4;t=t+n/2,s.arc(e-n,t-n,n,Ot(130),Ot(330)),s.arc(e+n,t-n,n,Ot(220),Ot(50)),s.lineTo(e,t+n),s.closePath()},pin({path:s,x:e,y:t,size:i}){s.moveTo(e+(.891-.5)*i,t+(.391-.5)*i),s.cubicCurveTo(e+(.891-.5)*i,t+(.606-.5)*i,e+(.5-.5)*i,t+(1-.5)*i,e+(.5-.5)*i,t+(1-.5)*i),s.cubicCurveTo(e+(.5-.5)*i,t+(1-.5)*i,e+(.109-.5)*i,t+(.606-.5)*i,e+(.109-.5)*i,t+(.391-.5)*i),s.cubicCurveTo(e+(.109-.5)*i,t+(.175-.5)*i,e+(.284-.5)*i,t+(0-.5)*i,e+(.5-.5)*i,t+(0-.5)*i),s.cubicCurveTo(e+(.716-.5)*i,t+(0-.5)*i,e+(.891-.5)*i,t+(.175-.5)*i,e+(.891-.5)*i,t+(.391-.5)*i),s.closePath()},plus(s){Lt(s,[[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:s,x:e,y:t,size:i,pixelRatio:n}){const r=i/2;s.moveTo(E(n,e-r),E(n,t-r)),s.lineTo(E(n,e+r),E(n,t-r)),s.lineTo(E(n,e+r),E(n,t+r)),s.lineTo(E(n,e-r),E(n,t+r)),s.closePath()},star({path:s,x:e,y:t,size:i}){const r=i/2,a=r/2,o=Math.PI/2;for(let h=0;h<5*2;h++){const c=h%2===0?r:a,l=h*Math.PI/5-o,u=e+Math.cos(l)*c,d=t+Math.sin(l)*c;s.lineTo(u,d)}s.closePath()},triangle(s){Lt(s,[[.5,0],[1,.87],[0,.87]])}},Dn=(()=>{var s=class extends pt{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}isPointInPath(e,t){return this.distanceSquared(e,t)<=0}get midPoint(){return{x:this.x,y:this.y}}distanceSquared(e,t){const i=Ft.anchor(this.shape),n=e-this.x+(i.x-.5)*this.size,r=t-this.y+(i.y-.5)*this.size,a=this.size/2;return Math.max(n*n+r*r-a*a,0)}updatePath(){const{path:e,shape:t,x:i,y:n,size:r}=this,a=this.layerManager?.canvas?.pixelRatio??1,o=Ft.anchor(t),h={path:e,x:i-(o.x-.5)*r,y:n-(o.y-.5)*r,size:r,pixelRatio:a};e.clear(),typeof t=="string"?kn[t](h):typeof t=="function"&&t(h)}computeBBox(){const{x:e,y:t,size:i}=this,n=Ft.anchor(this.shape);return new L(e-i*n.x,t-i*n.y,i,i)}executeFill(e,t){if(t)return super.executeFill(e,t)}executeStroke(e,t){if(t)return super.executeStroke(e,t)}};return p([wn({equals:Tn})],s.prototype,"shape",2),p([ge()],s.prototype,"x",2),p([ge()],s.prototype,"y",2),p([ge({convertor:Math.abs})],s.prototype,"size",2),s})(),Ft=class extends St(pi(Tt(Dn))){get datum(){return super.datum}set datum(s){super.datum=s}get previousDatum(){return super.previousDatum}static anchor(s){return s==="pin"?{x:.5,y:1}:typeof s=="function"&&"anchor"in s?s.anchor:{x:.5,y:.5}}constructor(s){super(s),s?.shape!=null&&(this.shape=s.shape)}resetAnimationProperties(s,e,t,i,n,r){this.__x=s,this.__y=e,this.__size=t,this.__opacity=i,this.resetScalingProperties(n,r,s,e),this.dirtyPath=!0,this.markDirty()}setVisibilityAndPosition(s,e,t,i){let n=!1;this.__visible!==s&&(this.__visible=s,n=!0),this.__shape!==e&&(this.__shape=e,n=!0);const r=Math.abs(t);if(this.__size!==r&&(this.__size=r,n=!0),i){const{x:a,y:o}=i;this.__x!==a&&(this.__x=a,n=!0),this.__y!==o&&(this.__y=o,n=!0),this.__scalingCenterX!==a&&(this.__scalingCenterX=a,n=!0),this.__scalingCenterY!==o&&(this.__scalingCenterY=o,n=!0)}n&&(this.dirtyPath=!0,this.markDirty())}};import{clamp as Si,dateToNumber as me,previousPowerOf2 as Ci}from"ag-charts-core";import{Logger as Nn,clamp as Et}from"ag-charts-core";var An=(()=>{var s=class Ri extends se{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 Ri}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=Et(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=Et(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=Et(0,t,1)}get paddingOuter(){return this._paddingOuter}getBandCountForUpdate(){return this.bands.length}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&Nn.warnOnce("Expected update to not invalidate scale"))}convert(t,i){this.refresh();const n=this.findIndex(t,i?.alignment,i?.alignmentExclusive);return n==null||n<0||n>=this.getBandCountForUpdate()?Number.NaN:this.ordinalRange(n)}getDomainMinMax(){return ne(this.domain)}invertNearestIndex(t){this.refresh();const i=this.getBandCountForUpdate();if(i===0)return-1;let n=0,r=i-1,a=1/0,o=0;for(;n<=r;){const h=Math.trunc((r+n)/2),c=this.ordinalRange(h),l=Math.abs(c-t);if(l===0)return h;l<a&&(a=l,o=h),c<t?n=h+1:r=h-1}return o}update(){const[t,i]=this.range;let{_paddingInner:n}=this;const{_paddingOuter:r}=this,a=this.getBandCountForUpdate();if(a===0)return;const o=i-t;let h;a===1?(n=0,h=o*(1-r*2)):h=o/Math.max(1,a-n+r*2);const c=this.round&&Math.floor(h)>0,l=c?Math.floor(h):h;let u=t+(o-l*(a-n))/2,d=l*(1-n);c&&(u=Math.round(u),d=Math.round(d)),this._step=l,this._inset=u,this._bandwidth=d,this._rawBandwidth=h*(1-n)}ordinalRange(t){const{_inset:i,_step:n,range:r}=this,a=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return Et(a,i+n*t,o)}};return p([xt],s.prototype,"range",2),p([xt],s.prototype,"round",2),s})(),Rn=An,In=class Ii extends Rn{constructor(){super(...arguments),this.type="category",this.defaultTickCount=0,this.index=new Map,this.indexInitialized=!1,this._domain=[]}static is(e){return e instanceof Ii}set domain(e){this._domain!==e&&(this.invalid=!0,this._domain=e,this.index.clear(),this.indexInitialized=!1)}get domain(){return this._domain}get bands(){return this._domain}normalizeDomains(...e){let t;const i=new Set;let n=!0;for(const r of e){const a=r.domain;i.has(a)||(i.add(a),t==null?t=Pi(a):(n&&(n=On(a,t)),t=Pi([...t,...a])))}return t??(t=[]),{domain:t,animatable:n}}toDomain(e){}invert(e,t=!1){this.refresh();const i=t?this.bandwidth/2:0,n=this.invertNearestIndex(Math.max(0,e-i));return t||e===this.ordinalRange(n)?this.domain[n]:void 0}ticks(e,t=this.domain,i){const{bands:n}=this;let{tickCount:r}=e;if(r===0){const m=n.length>1?1:0;return{ticks:n[m]?[n[m]]:[],count:void 0,firstTickIndex:m}}let a=r!=null&&r!==0?Math.trunc(n.length/r):1;if(a=Ci(a),a<=1)return ys(t,!1,i);r=Math.trunc(n.length/a);const o=a*r,h=Ci(Math.trunc((n.length-o)/2)),c=Si(0,Math.floor((i?.[0]??0)*n.length),n.length),l=Si(0,Math.ceil((i?.[1]??1)*n.length),n.length),u=Math.floor((c-h)/a)*a+h,d=Math.ceil((l-h)/a)*a+h,f=[];for(let m=u;m<d;m+=a)m>=0&&m<n.length&&f.push(n[m]);let g=f.length>0?this.findIndex(f[0]):void 0;return g!=null&&(g=Math.floor((g-h)/a)),{ticks:f,count:void 0,firstTickIndex:g}}findIndex(e){const{index:t,indexInitialized:i}=this;if(!i){const{domain:n}=this;for(let r=0;r<n.length;r++)t.set(me(n[r]),r);this.indexInitialized=!0}return t.get(me(e))}};function Pi(s){let e;const t=new Set;for(const i of s){const n=me(i),r=t.size;t.add(n),t.size!==r?e?.push(i):e??(e=s.slice(0,t.size))}return e??s}function On(s,e){let t=-1;for(const i of s){const n=e.indexOf(i);if(n===-1)t=1/0;else{if(n<=t)return!1;t=n}}return!0}import{createTicks as Ln,isDenseInterval as Fn,niceTicksDomain as En,range as zn,tickStep as $n}from"ag-charts-core";import{findMinMax as qn}from"ag-charts-core";var Bn=(()=>{var s=class xe extends se{constructor(t=[],i=[]){super(),this.range=i,this.defaultTickCount=xe.defaultTickCount,this.defaultClamp=!1,this._domain=[],this.domainNeedsValueOf=!0,this.d0Cache=Number.NaN,this.d1Cache=Number.NaN,this.domain=t}static is(t){return t instanceof xe}get domain(){return this._domain}set domain(t){if(this._domain=t,t&&t.length>=2){const i=t[0];this.domainNeedsValueOf=i!=null&&typeof i=="object",this.domainNeedsValueOf?(this.d0Cache=t[0].valueOf(),this.d1Cache=t[1].valueOf()):(this.d0Cache=t[0],this.d1Cache=t[1])}else this.d0Cache=Number.NaN,this.d1Cache=Number.NaN}normalizeDomains(...t){return Gn(...t)}calcBandwidth(t=1,i=1){const{domain:n}=this,r=this.getPixelRange();if(n.length===0)return r;let o=Math.abs(this.d1Cache-this.d0Cache)/t+1;if(i!==0){const h=Math.floor(r);o=Math.min(o,h)}return r/Math.max(1,o)}convert(t,i){const{domain:n}=this;if(!n||n.length<2||t==null)return Number.NaN;const{range:r}=this,a=i?.clamp??this.defaultClamp;let o=this.d0Cache,h=this.d1Cache,c=typeof t=="number"?t:t.valueOf();if(this.transform&&(o=this.transform(o),h=this.transform(h),c=this.transform(c)),a){const[u,d]=qn([o,h]);if(c<u)return r[0];if(c>d)return r[1]}if(o===h)return(r[0]+r[1])/2;if(c===o)return r[0];if(c===h)return r[1];const l=r[0];return l+(c-o)/(h-o)*(r[1]-l)}invert(t,i){const{domain:n}=this;if(n.length<2)return;let r=this.d0Cache,a=this.d1Cache;this.transform&&(r=this.transform(r),a=this.transform(a));const{range:o}=this,[h,c]=o;let l;return h===c?l=this.toDomain((r+a)/2):l=this.toDomain(r+(t-h)/(c-h)*(a-r)),this.transformInvert?this.transformInvert(l):l}getDomainMinMax(){return ne(this.domain)}getPixelRange(){const[t,i]=this.range;return Math.abs(i-t)}};return s.defaultTickCount=5,s})(),zt=Bn;function Gn(...s){let e,t=1/0,i,n=-1/0;for(const r of s){const a=r.domain;for(const o of a){const h=o.valueOf();h<t&&(t=h,e=o),h>n&&(n=h,i=o)}}return e!=null&&i!=null?{domain:[e,i],animatable:!0}:{domain:[],animatable:!1}}var Wn=class ve extends zt{constructor(){super([0,1],[0,1]),this.type="number"}static is(e){return e instanceof ve}static getTickStep(e,t,i){const{interval:n,tickCount:r=zt.defaultTickCount,minTickCount:a,maxTickCount:o}=i;return n??$n(e,t,r,a,o)}toDomain(e){return e}ticks({interval:e,tickCount:t=zt.defaultTickCount,minTickCount:i,maxTickCount:n},r=this.domain,a){if(!r||r.length<2||t<1||!r.every(Number.isFinite))return{ticks:[],count:0,firstTickIndex:0};const[o,h]=r;if(e){const c=Math.abs(e);if(!Fn((h-o)/c,this.getPixelRange()))return zn(o,h,c,a)}return Ln(o,h,t,i,n,a)}niceDomain(e,t=this.domain){if(t.length<2)return[];const{tickCount:i=zt.defaultTickCount}=e;let[n,r]=t;if(i===1)[n,r]=En(n,r);else if(i>1){const a=n>r?Math.ceil:Math.floor,o=n>r?Math.floor:Math.ceil,h=4;for(let c=0;c<h;c++){const l=n,u=r,d=ve.getTickStep(n,r,e),[f,g]=t;if(n=a(f/d)*d,r=o(g/d)*d,n===l&&r===u)break}}return[e.nice[0]?n:t[0],e.nice[1]?r:t[1]]}};import{CleanupRegistry as Xn,Debug as gt,EventEmitter as Yn,Logger as jn,createId as Vn,downloadUrl as Un}from"ag-charts-core";var Hn=class{constructor(s){this.width=600,this.height=300,this.direction="ltr";const{width:e,height:t,willReadFrequently:i=!1}=s;this.element=s.canvasElement,this.pixelRatio=s.pixelRatio,this.element.style.display="block",this.element.style.width=(e??this.width)+"px",this.element.style.height=(t??this.height)+"px",this.element.width=Math.round((e??this.width)*this.pixelRatio),this.element.height=Math.round((t??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:i}),this.context.direction=this.direction,this.resize(e??0,t??0,this.pixelRatio),Be(this.context)}drawImage(s,e=0,t=0){return s.drawImage(this.context.canvas,e,t)}toDataURL(s){return this.element.toDataURL(s)}resize(s,e,t){if(!(s>0&&e>0))return;const{element:i,context:n}=this;i.width=Math.round(s*t),i.height=Math.round(e*t),n.setTransform(t,0,0,t,0,0),i.style.width=s+"px",i.style.height=e+"px",this.width=s,this.height=e,this.pixelRatio=t}setDirection(s){this.direction=s?"rtl":"ltr",this.element.dir=this.direction,this.context.direction=this.direction}clear(){qe(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.reset(),this.context.verifyDepthZero?.(),this.context.direction=this.direction}};import{EventEmitter as Zn,getImage as Jn}from"ag-charts-core";var Qn=class extends Zn{constructor(){super(...arguments),this.cache=new Map,this.imageLoadingCount=0}loadImage(s,e){const t=this.cache.get(s);if(t?.image)return t.image;if(t!=null&&e){t.nodes.add(e);return}if(!e)return;const i={image:void 0,nodes:new Set([e])},n=Jn(),r=new n;return this.imageLoadingCount++,r.onload=()=>{i.image=r;for(const a of i.nodes)a.markDirty();i.nodes.clear(),this.imageLoadingCount--,this.emit("image-loaded",{uri:s})},r.onerror=()=>{this.imageLoadingCount--,i.nodes.clear(),this.emit("image-error",{uri:s})},r.src=s,this.cache.set(s,i),i.image}waitingToLoad(){return this.imageLoadingCount>0}destroy(){for(const s of this.cache.values())s.nodes.clear();this.cache.clear()}};import{Debug as Kn}from"ag-charts-core";var tr=class{constructor(s){this.canvas=s,this.debug=Kn.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(s,e,t){this.canvas.resize(s,e,t);for(const{canvas:i}of this.layersMap.values())i.resize(s,e,t)}addLayer(s){const{width:e,height:t,pixelRatio:i}=this.canvas,{name:n}=s,r=new Jt({width:e,height:t,pixelRatio:i});return this.layersMap.set(r,{id:this.nextLayerId++,name:n,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(s){this.layersMap.has(s)&&(this.layersMap.delete(s),s.destroy(),this.debug("Scene.removeLayer() -  layers",this.layersMap))}clear(){for(const s of this.layersMap.values())s.canvas.destroy();this.layersMap.clear()}},er=(()=>{var s=class extends Yn{constructor(e){super(),this.debug=gt.create(!0,"scene"),this.id=Vn(this),this.imageLoader=new Qn,this.root=null,this.pendingSize=null,this.isDirty=!1,this.direction="ltr",this.cleanup=new Xn,this.updateDebugFlags(),this.canvas=new Hn(e),this.layersManager=new tr(this.canvas),this.cleanup.register(this.imageLoader.on("image-loaded",()=>{this.emit("scene-changed",{})}),this.imageLoader.on("image-error",({uri:t})=>{jn.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}get isRtl(){return this.direction==="rtl"}setContainer(e){const{element:t}=this.canvas;return t.remove(),e.appendChild(t),this}setRoot(e){return this.root===e?this:(this.isDirty=!0,this.root?.setScene(),this.root=e,e&&(e.visible=!0,e.setScene(this)),this)}updateDebugFlags(){gt.inDevelopmentMode(()=>bt._debugEnabled=!0)}clearCanvas(){this.canvas.clear()}attachNode(e){return this.appendChild(e),()=>e.remove()}appendChild(e){return this.root?.appendChild(e),this}removeChild(e){return e.remove(),this}download(e,t){Un(this.canvas.toDataURL(t),e?.trim()??"image")}getDataURL(e){return this.canvas.toDataURL(e)}resize(e,t,i){return e=Math.round(e),t=Math.round(t),i??(i=this.pixelRatio),e>0&&t>0&&(e!==this.width||t!==this.height||i!==this.pixelRatio)?(this.pendingSize=[e,t,i],this.isDirty=!0,!0):!1}setDirection(e){this.direction=e?"rtl":"ltr",this.canvas.setDirection(e)}updateBaseFont(){const e=this.root?.resolveFont();e!=null&&e!==this._baseFont&&(this._baseFont=e,this.canvas.context.font=e)}applyPendingResize(){return this.pendingSize?(this.layersManager.resize(...this.pendingSize),this.pendingSize=null,this._baseFont!=null&&(this.canvas.context.font=this._baseFont),!0):!1}render(e){const{debugSplitTimes:t={start:performance.now()},extraDebugStats:i,seriesRect:n,debugColors:r}=e??{},{canvas:a,canvas:{context:o}={},root:h,width:c,height:l,pixelRatio:u}=this;if(!o)return;const d=gt.check("scene:stats","scene:stats:verbose");d&&this.ensureDebugStatsRegistration();const f=performance.now(),g=this.applyPendingResize();if(h&&!h.visible){this.isDirty=!1;return}let m;if(h instanceof W&&(m=h.dirty),h!=null&&m===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:At(h,"console")}),d&&gi(this.layersManager,t,o,void 0,i,n,r);return}const y={ctx:o,direction:this.direction,width:c,height:l,devicePixelRatio:u,debugNodes:{}};gt.check("scene:stats:verbose")&&(y.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),fn(y);let b=!1;if((m!==!1||g)&&(b=!0,a.clear()),h&&gt.check("scene:dirtyTree")){const{dirtyTree:x,paths:v}=mi(h);gt.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:x,paths:v})}if(h&&b){if(h.visible&&h.preRender(y),this.debug.check()){const x=At(h,"console");this.debug("Scene.render() - before",{canvasCleared:b,tree:x})}if(h.visible)try{o.save(),h.render(y),o.restore()}catch(x){throw this.canvas.reset(),x}}t["\u270D\uFE0F"]=performance.now()-f,o.verifyDepthZero?.(),this.isDirty=!1,d&&gi(this.layersManager,t,o,y.stats,i,n,r),pn(o,y.debugNodes),h&&this.debug.check()&&this.debug("Scene.render() - after",{tree:At(h,"console"),canvasCleared:b})}ensureDebugStatsRegistration(){if(this.releaseDebugStats)return;const e=ln(),t=()=>{e(),this.releaseDebugStats=void 0};this.releaseDebugStats=t,this.cleanup.register(t)}toSVG(){const{root:e,width:t,height:i}=this;if(e!=null)return bt.toSVG(e,t,i)}strip(){const{context:e,pixelRatio:t}=this.canvas;e.setTransform(t,0,0,t,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1,this.clear()}destroy(){this.canvas!=null&&(this.strip(),this.canvas.destroy(),this.imageLoader.destroy(),this.cleanup.flush(),bi(),Object.assign(this,{canvas:void 0}))}};return s.className="_c$15",s})();import{SceneChangeDetection as lt,isNumberEqual as ir,normalizeAngle360 as _i}from"ag-charts-core";var sr=(()=>{var s=class extends pt{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.radius=10,this.startAngle=0,this.endAngle=Math.PI*2,this.counterClockwise=!1,this.type=0}get fullPie(){return ir(_i(this.startAngle),_i(this.endAngle))}updatePath(){const e=this.path;e.clear(),e.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?e.closePath():this.type===2&&!this.fullPie&&(e.lineTo(this.centerX,this.centerY),e.closePath())}computeBBox(){return new L(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(e,t){const i=this.getBBox();return this.type!==0&&i.containsPoint(e,t)&&this.path.isPointInPath(e,t)}};return s.className="_c$16",p([lt()],s.prototype,"centerX",2),p([lt()],s.prototype,"centerY",2),p([lt()],s.prototype,"radius",2),p([lt()],s.prototype,"startAngle",2),p([lt()],s.prototype,"endAngle",2),p([lt()],s.prototype,"counterClockwise",2),p([lt()],s.prototype,"type",2),s})();import{createSvgElement as nr,lineDistanceSquared as rr}from"ag-charts-core";var ar=(()=>{var s=class extends Mt{constructor(e={}){super(e),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.fill=void 0,this.strokeWidth=1}set x(e){this.x1=e,this.x2=e}set y(e){this.y1=e,this.y2=e}get midPoint(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}}computeBBox(){return new L(Math.min(this.x1,this.x2),Math.min(this.y1,this.y2),Math.abs(this.x2-this.x1),Math.abs(this.y2-this.y1))}isPointInPath(e,t){return this.x1===this.x2||this.y1===this.y2?this.getBBox().clone().grow(this.strokeWidth/2).containsPoint(e,t):!1}distanceSquared(e,t){const{x1:i,y1:n,x2:r,y2:a}=this;return rr(e,t,i,n,r,a,1/0)}render(e){const{ctx:t,devicePixelRatio:i}=e;let{x1:n,y1:r,x2:a,y2:o}=this;if(n===a){const{strokeWidth:h}=this,c=Math.round(n*i)/i+Math.trunc(h*i)%2/(i*2);n=c,a=c}else if(r===o){const{strokeWidth:h}=this,c=Math.round(r*i)/i+Math.trunc(h*i)%2/(i*2);r=c,o=c}t.beginPath(),t.moveTo(n,r),t.lineTo(a,o),this.fillStroke(t),this.fillShadow?.markClean(),super.render(e)}toSVG(){if(!this.visible)return;const e=nr("line");return e.setAttribute("x1",String(this.x1)),e.setAttribute("y1",String(this.y1)),e.setAttribute("x2",String(this.x2)),e.setAttribute("y2",String(this.y2)),this.applySvgStrokeAttributes(e),{elements:[e]}}};return s.className="_c$17",p([I()],s.prototype,"x1",2),p([I()],s.prototype,"y1",2),p([I()],s.prototype,"x2",2),p([I()],s.prototype,"y2",2),s})();import{SceneChangeDetection as tt,angleBetween as wi,isNumberEqual as Ti,normalizeAngle360 as or}from"ag-charts-core";function $t(s,e,t){const i=Math.hypot(s,e),r=Math.atan2(e,s)+t;return{x:Math.cos(r)*i,y:Math.sin(r)*i}}var hr=(()=>{var s=class extends pt{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}set cornerRadius(e){}computeBBox(){const{columnWidth:e}=this,[t,i]=this.normalizeRadii(this.innerRadius,this.outerRadius),n=this.getRotation(),r=-e/2,a=e/2,o=-i,h=-t;let c=1/0,l=1/0,u=-1/0,d=-1/0;for(let f=0;f<4;f+=1){const{x:g,y:m}=$t(f%2===0?r:a,f<2?o:h,n);c=Math.min(g,c),l=Math.min(m,l),u=Math.max(g,u),d=Math.max(m,d)}return new L(c,l,u-c,d-l)}getRotation(){const{startAngle:e,endAngle:t}=this,i=wi(e,t);return or(e+i/2+Math.PI/2)}normalizeRadii(e,t){return e>t?[t,e]:[e,t]}updatePath(){const{isBeveled:e}=this;e?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:e,path:t}=this,[i,n]=this.normalizeRadii(this.innerRadius,this.outerRadius),r=-e/2,a=e/2,o=-n,h=-i,c=this.getRotation(),l=[[r,h],[r,o],[a,o],[a,h]].map(([u,d])=>$t(u,d,c));t.clear(!0),t.moveTo(l[0].x,l[0].y),t.lineTo(l[1].x,l[1].y),t.lineTo(l[2].x,l[2].y),t.lineTo(l[3].x,l[3].y),t.closePath()}calculateCircleIntersection(e,t){const i=e*e;if(t<i)return null;const n=-Math.sqrt(t-i),r=Math.atan2(n,e);return{y:n,angle:r}}calculateBothIntersections(e,t,i){const n=i*i,r=this.calculateCircleIntersection(e,n),a=this.calculateCircleIntersection(t,n);return!r||!a?null:{left:r,right:a}}calculateAxisOuterIntersections(e,t,i){const n=i*i,r=this.calculateCircleIntersection(e,n),a=this.calculateCircleIntersection(t,n);return!r||!a?null:{left:r,right:a,radiusSquared:n}}moveToRotated(e,t,i){const n=$t(e,t,i);this.path.moveTo(n.x,n.y)}lineToRotated(e,t,i){const n=$t(e,t,i);this.path.lineTo(n.x,n.y)}renderTopWithCornerClipping(e,t,i){const{path:n}=this,{right:r,top:a,rotation:o}=i,h=a*a,c=t.radiusSquared-h;if(c<=0)this.lineToRotated(r,t.right.y,o),n.arc(0,0,e,o+t.right.angle,o+t.left.angle,!0);else{const l=Math.sqrt(c),u=Math.atan2(a,l),d=Math.atan2(a,-l);this.lineToRotated(r,t.right.y,o),n.arc(0,0,e,o+t.right.angle,o+u,!0),this.lineToRotated(-l,a,o),n.arc(0,0,e,o+d,o+t.left.angle,!0)}}updateBeveledPath(){const{columnWidth:e,path:t,axisInnerRadius:i,axisOuterRadius:n}=this,[r,a]=this.normalizeRadii(this.innerRadius,this.outerRadius),o=-e/2,h=e/2,c=-a,l=-r,u=this.getRotation(),d=Ti(r,i),f=Ti(a,n),g=Math.hypot(o,c)>n||Math.hypot(h,c)>n;if(!d&&!f&&!g){this.updateRectangularPath();return}const m=d?this.calculateBothIntersections(o,h,r):null,y=f?this.calculateBothIntersections(o,h,a):null,b=g?this.calculateAxisOuterIntersections(o,h,n):null;if(d&&!m||f&&!y||g&&!b){this.updateRectangularPath();return}t.clear(!0);const x={left:o,right:h,top:c,bottom:l,rotation:u};m?this.moveToRotated(o,m.left.y,u):this.moveToRotated(o,l,u),m?t.arc(0,0,r,u+m.left.angle,u+m.right.angle,!1):this.lineToRotated(h,l,u),y?(this.lineToRotated(h,y.right.y,u),t.arc(0,0,a,u+y.right.angle,u+y.left.angle,!0)):b?this.renderTopWithCornerClipping(n,b,x):(this.lineToRotated(h,c,u),this.lineToRotated(o,c,u)),t.closePath()}};return s.className="_c$18",p([tt()],s.prototype,"isBeveled",2),p([tt()],s.prototype,"columnWidth",2),p([tt()],s.prototype,"startAngle",2),p([tt()],s.prototype,"endAngle",2),p([tt()],s.prototype,"outerRadius",2),p([tt()],s.prototype,"innerRadius",2),p([tt()],s.prototype,"axisInnerRadius",2),p([tt()],s.prototype,"axisOuterRadius",2),s})();function cr(s,e,t,i,n){const r=wi(s,e),a=r*(1-i)/2;if(s+=a,e-=a,r<.001)return 2*t*n;if(r>=2*Math.PI){const f=s+r/2;s=f-Math.PI,e=f+Math.PI}const o=t*Math.cos(s),h=t*Math.sin(s),c=t*Math.cos(e),l=t*Math.sin(e),u=Math.floor(Math.hypot(o-c,h-l)),d=2*t*n;return Math.max(1,Math.min(d,u))}import{SceneChangeDetection as X,SceneObjectChangeDetection as lr}from"ag-charts-core";var ur=class Me{constructor(e,t,i,n){this.startAngle=e,this.endAngle=t,this.innerRadius=i,this.outerRadius=n}clone(){const{startAngle:e,endAngle:t,innerRadius:i,outerRadius:n}=this;return new Me(e,t,i,n)}equals(e){return this.startAngle===e.startAngle&&this.endAngle===e.endAngle&&this.innerRadius===e.innerRadius&&this.outerRadius===e.outerRadius}[Ee](e,t){return new Me(this.startAngle*(1-t)+e.startAngle*t,this.endAngle*(1-t)+e.endAngle*t,this.innerRadius*(1-t)+e.innerRadius*t,this.outerRadius*(1-t)+e.outerRadius*t)}};import{angleBetween as dr,isBetweenAngles as qt,normalizeAngle180 as ki,normalizeAngle360 as Di}from"ag-charts-core";function fr({startAngle:s,endAngle:e,innerRadius:t,outerRadius:i}){let n=1/0,r=1/0,a=-1/0,o=-1/0;const h=(c,l)=>{n=Math.min(c,n),r=Math.min(l,r),a=Math.max(c,a),o=Math.max(l,o)};return h(t*Math.cos(s),t*Math.sin(s)),h(t*Math.cos(e),t*Math.sin(e)),h(i*Math.cos(s),i*Math.sin(s)),h(i*Math.cos(e),i*Math.sin(e)),qt(0,s,e)&&h(i,0),qt(Math.PI*.5,s,e)&&h(0,i),qt(Math.PI,s,e)&&h(-i,0),qt(Math.PI*1.5,s,e)&&h(0,-i),new L(n,r,a-n,o-r)}function Ni(s,e,t){const i=Math.sqrt(Math.pow(s,2)+Math.pow(e,2)),{innerRadius:n,outerRadius:r}=t;if(t.startAngle===t.endAngle||i<Math.min(n,r)||i>Math.max(n,r))return!1;const a=ki(t.startAngle),o=ki(t.endAngle),h=Math.atan2(e,s);return a<o?h<=o&&h>=a:h<=o&&h>=-Math.PI||h>=a&&h<=Math.PI}function Ai(s,e,t,i){if(t===0&&i===0)return 0;if(Math.asin(Math.abs(1*t)/(s+1*t))+Math.asin(Math.abs(1*i)/(s+1*i))-e<0)return 1;let r=0,a=1;for(let o=0;o<8;o+=1){const h=(r+a)/2;Math.asin(Math.abs(h*t)/(s+h*t))+Math.asin(Math.abs(h*i)/(s+h*i))-e<0?r=h:a=h}return r}var pr=1e-6;function et(s,e){return dr(s,e)<pr?e:Di(s-e)+e}function Bt(s,e,t=0){const n=Math.abs(e-s)>=2*Math.PI?2*Math.PI:Di(e-s);return s=et(s,t),e=s+n,{startAngle:s,endAngle:e}}function Gt(s,e,t,i,n,r){const a=Math.sin(r),o=Math.cos(r),h=s**2+e**2-t**2;let c,l,u,d;if(o>.5){const v=a/o,S=1+v**2,_=-2*(s+e*v),P=_**2-4*S*h;if(P<0)return;const M=(-_+Math.sqrt(P))/(2*S),C=(-_-Math.sqrt(P))/(2*S);c=M,l=M*v,u=C,d=C*v}else{const v=o/a,S=1+v**2,_=-2*(e+s*v),P=_**2-4*S*h;if(P<0)return;const M=(-_+Math.sqrt(P))/(2*S),C=(-_-Math.sqrt(P))/(2*S);c=M*v,l=M,u=C*v,d=C}const f=o,g=a,m=c*f+l*g,y=u*f+d*g,b=m>0?et(Math.atan2(l-e,c-s),i):Number.NaN,x=y>0?et(Math.atan2(d-e,u-s),i):Number.NaN;if(b>=i&&b<=n)return b;if(x>=i&&x<=n)return x}function Wt(s,e,t,i,n,r){const a=Math.hypot(s,e),o=(a**2-t**2+r**2)/(2*a),h=a-o,c=Math.atan2(e,s),l=Math.acos(-h/t),u=et(c+l,i),d=et(c-l,i);if(u>=i&&u<=n)return u;if(d>=i&&d<=n)return d}var ye=class{constructor(s,e,t,i,n){this.cx=s,this.cy=e,this.r=t,this.a0=i,this.a1=n,this.a0>=this.a1&&(this.a0=Number.NaN,this.a1=Number.NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(s){return{x:this.cx+this.r*Math.cos(s),y:this.cy+this.r*Math.sin(s)}}clipStart(s){s==null||!this.isValid()||s<this.a0||(this.a0=s,(Number.isNaN(s)||this.a0>=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}clipEnd(s){s==null||!this.isValid()||s>this.a1||(this.a1=s,(Number.isNaN(s)||this.a0>=this.a1)&&(this.a0=Number.NaN,this.a1=Number.NaN))}},gr=(()=>{var s=class extends pt{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.innerRadius=10,this.outerRadius=20,this.startAngle=0,this.endAngle=Math.PI*2,this.clipSector=void 0,this.concentricEdgeInset=0,this.radialEdgeInset=0,this.startOuterCornerRadius=0,this.endOuterCornerRadius=0,this.startInnerCornerRadius=0,this.endInnerCornerRadius=0}set inset(e){this.concentricEdgeInset=e,this.radialEdgeInset=e}set cornerRadius(e){this.startOuterCornerRadius=e,this.endOuterCornerRadius=e,this.startInnerCornerRadius=e,this.endInnerCornerRadius=e}computeBBox(){return fr(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:e}=this;let{innerRadius:t,outerRadius:i}=this;return t=t>0?t+e:0,i=Math.max(i-e,0),{innerRadius:t,outerRadius:i}}normalizedClipSector(){const{clipSector:e}=this;if(e==null)return;const{startAngle:t,endAngle:i}=Bt(this.startAngle,this.endAngle),{innerRadius:n,outerRadius:r}=this.normalizedRadii(),a=Bt(e.startAngle,e.endAngle,t);return new ur(Math.max(t,a.startAngle),Math.min(i,a.endAngle),Math.max(n,e.innerRadius),Math.min(r,e.outerRadius))}getAngleOffset(e){return e>0?this.radialEdgeInset/e:0}arc(e,t,i,n,r,a,o,h){if(e<=0)return;const{startAngle:c,endAngle:l}=Bt(this.startAngle,this.endAngle),{innerRadius:u,outerRadius:d}=this.normalizedRadii(),f=this.normalizedClipSector();if(h&&u<=0)return;const g=h?this.getAngleOffset(u+e):this.getAngleOffset(d-e),m=o?c+g+t:l-g-t,y=h?u+e:d-e,b=y*Math.cos(m),x=y*Math.sin(m);if(f!=null&&(!o&&!(m>=c-1e-6&&m<=f.endAngle-1e-6)||o&&!(m>=f.startAngle+1e-6&&m<=l-1e-6)||h&&y<f.innerRadius-1e-6||!h&&y>f.outerRadius+1e-6))return;const v=new ye(b,x,e,i,n);if(f!=null){h?(v.clipStart(Gt(b,x,e,i,n,f.endAngle)),v.clipEnd(Gt(b,x,e,i,n,f.startAngle))):(v.clipStart(Gt(b,x,e,i,n,f.startAngle)),v.clipEnd(Gt(b,x,e,i,n,f.endAngle)));let C,w;if(o?(C=Wt(b,x,e,i,n,f.innerRadius),w=Wt(b,x,e,i,n,f.outerRadius)):(C=Wt(b,x,e,i,n,f.outerRadius),w=Wt(b,x,e,i,n,f.innerRadius)),v.clipStart(C),v.clipEnd(w),C!=null){const{x:N,y:R}=v.pointAt(C),k=et(Math.atan2(R,N),c);o?a?.clipStart(k):r.clipEnd(k)}if(w!=null){const{x:N,y:R}=v.pointAt(w),k=et(Math.atan2(R,N),c);o?r.clipStart(k):a?.clipEnd(k)}}if(f!=null){const{x:C,y:w}=v.pointAt((v.a0+v.a1)/2);if(!Ni(C,w,f))return}const{x:S,y:_}=v.pointAt(o===h?v.a0:v.a1),P=et(Math.atan2(_,S),c),M=h?a:r;return o?M?.clipStart(P):M?.clipEnd(P),v}updatePath(){const{path:t,centerX:i,centerY:n,concentricEdgeInset:r,radialEdgeInset:a}=this;let{startOuterCornerRadius:o,endOuterCornerRadius:h,startInnerCornerRadius:c,endInnerCornerRadius:l}=this;const{startAngle:u,endAngle:d}=Bt(this.startAngle,this.endAngle),{innerRadius:f,outerRadius:g}=this.normalizedRadii(),m=this.normalizedClipSector(),y=d-u,b=y>=2*Math.PI-1e-6;t.clear();const x=this.getAngleOffset(f),v=y-2*x,S=g-f,_=f>0&&v>0?2*f*Math.sin(v/2):0,P=g>0&&v>0?2*g*Math.sin(v/2):0;if(o=Math.floor(Math.max(0,Math.min(o,P/2,S/2))),h=Math.floor(Math.max(0,Math.min(h,P/2,S/2))),c=Math.floor(Math.max(0,Math.min(c,_/2,S/2))),l=Math.floor(Math.max(0,Math.min(l,_/2,S/2))),f===0&&g===0||f>g||_<0||P<=0)return;if((m?.startAngle??u)===(m?.endAngle??d))return;if(b&&this.clipSector==null&&o===0&&h===0&&c===0&&l===0){t.moveTo(i+g*Math.cos(u),n+g*Math.sin(u)),t.arc(i,n,g,u,d),f>r&&(t.moveTo(i+f*Math.cos(d),n+f*Math.sin(d)),t.arc(i,n,f,d,u,!0)),t.closePath();return}else if(this.clipSector==null&&Math.abs(f-g)<1e-6){t.arc(i,n,g,u,d,!1),t.arc(i,n,g,d,u,!0),t.closePath();return}const C=this.getAngleOffset(g);if(y<2*C)return;const N=(m?.innerRadius??f)>r,R=f<r||y<2*x,k=Math.max(o,c,h,l),z=k>0?Math.min(S/k,1):1;o*=z,h*=z,c*=z,l*=z;const V=Ai(g,y-2*C,-o,-h);if(o*=V,h*=V,!R&&N){const A=Ai(f,y-2*x,c,l);c*=A,l*=A}else c=0,l=0;const it=Math.max(o+c,h+l),U=it>0?Math.min(S/it,1):1;o*=U,h*=U,c*=U,l*=U;let Y=0,T=0;const $=o/(g-o),yt=h/(g-h);if($>=0&&$<.999999)Y=Math.asin($);else{Y=y/2;const A=g/(1/Math.sin(Y)+1);o=Math.min(A,o)}if(yt>=0&&yt<.999999)T=Math.asin(yt);else{T=y/2;const A=g/(1/Math.sin(T)+1);h=Math.min(A,h)}const Se=Math.asin(c/(f+c)),Ce=Math.asin(l/(f+l)),Pe=m?.outerRadius??g,_e=this.getAngleOffset(Pe),J=new ye(0,0,Pe,u+_e,d-_e),we=m?.innerRadius??f,Te=this.getAngleOffset(we),H=N?new ye(0,0,we,u+Te,d-Te):void 0;m!=null&&(J.clipStart(m.startAngle),J.clipEnd(m.endAngle),H?.clipStart(m.startAngle),H?.clipEnd(m.endAngle));const ke=this.arc(o,Y,u-Math.PI*.5,u+Y,J,H,!0,!1),De=this.arc(h,T,d-T,d+Math.PI*.5,J,H,!1,!1),Ne=this.arc(l,Ce,d+Math.PI*.5,d+Math.PI-Ce,J,H,!1,!0),Yt=this.arc(c,Se,u+Math.PI+Se,u+Math.PI*1.5,J,H,!0,!0);if(!(R&&N)){if(R){const A=y<Math.PI*.5?a*(1+Math.cos(y))/Math.sin(y):Number.NaN;let O;A>0&&A<g?O=Math.max(Math.hypot(a,A),f):O=a,O=Math.max(O,f);const q=u+y*.5;t.moveTo(i+O*Math.cos(q),n+O*Math.sin(q))}else if(!(Yt?.isValid()===!0||H?.isValid()===!0)){const A=u+y/2,O=f*Math.cos(A),q=f*Math.sin(A);t.moveTo(i+O,n+q)}}if(ke?.isValid()===!0){const{cx:A,cy:O,r:q,a0:st,a1:nt}=ke;t.arc(i+A,n+O,q,st,nt)}if(J.isValid()){const{r:A,a0:O,a1:q}=J;t.arc(i,n,A,O,q)}if(De?.isValid()===!0){const{cx:A,cy:O,r:q,a0:st,a1:nt}=De;t.arc(i+A,n+O,q,st,nt)}if(!R){if(Ne?.isValid()===!0){const{cx:A,cy:O,r:q,a0:st,a1:nt}=Ne;t.arc(i+A,n+O,q,st,nt)}if(H?.isValid()===!0){const{r:A,a0:O,a1:q}=H;t.arc(i,n,A,q,O,!0)}if(Yt?.isValid()===!0){const{cx:A,cy:O,r:q,a0:st,a1:nt}=Yt;t.arc(i+A,n+O,q,st,nt)}}t.closePath()}isPointInPath(e,t){const{startAngle:i,endAngle:n,innerRadius:r,outerRadius:a}=this.clipSector??this;return Ni(e-this.centerX,t-this.centerY,{startAngle:i,endAngle:n,innerRadius:Math.min(r,a),outerRadius:Math.max(r,a)})}};return s.className="_c$19",p([X()],s.prototype,"centerX",2),p([X()],s.prototype,"centerY",2),p([X()],s.prototype,"innerRadius",2),p([X()],s.prototype,"outerRadius",2),p([X()],s.prototype,"startAngle",2),p([X()],s.prototype,"endAngle",2),p([lr({equals:(e,t)=>e.equals(t)})],s.prototype,"clipSector",2),p([X()],s.prototype,"concentricEdgeInset",2),p([X()],s.prototype,"radialEdgeInset",2),p([X()],s.prototype,"startOuterCornerRadius",2),p([X()],s.prototype,"endOuterCornerRadius",2),p([X()],s.prototype,"startInnerCornerRadius",2),p([X()],s.prototype,"endInnerCornerRadius",2),s})();import{toRadians as mr}from"ag-charts-core";export{sr as Arc,L as BBox,_n as Caption,In as CategoryScale,W as Group,ar as Line,Wn as LinearScale,Ft as Marker,pt as Path,hr as RadialColumnShape,vi as Rect,er as Scene,gr as Sector,Mt as Shape,en as TranslatableGroup,cr as getRadialColumnWidth,mr as toRadians};