Files
sigpro-grid/node_modules/ag-charts-community/dist/package/integrated-charts-scene.esm.min.mjs
2026-03-17 08:44:54 +01:00

3 lines
108 KiB
JavaScript
Executable File

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