ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
5 lines • 123 kB
JavaScript
var Qi=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,b=(e,t,i,n)=>{for(var s=n>1?void 0:n?tn(t,i):t,r=e.length-1,a;r>=0;r--)(a=e[r])&&(s=(n?a(t,i,s):a(s))||s);return n&&s&&Qi(t,i,s),s};import{createId as en}from"ag-charts-core";import{Logger as nn,createId as sn,createSvgElement as Ke}from"ag-charts-core";import*as rn from"ag-charts-core";var Je=Symbol("BREAK"),At="__decorator_config",Bt="__decorator_accessors";function an(e,t){re(e,t).optional=!0}function re(e,t){if(Object.getOwnPropertyDescriptor(e,At)==null&&Object.defineProperty(e,At,{value:{}}),Object.getOwnPropertyDescriptor(e,Bt)==null){const l=Object.getPrototypeOf(e)?.[Bt]?.slice()??[];Object.defineProperty(e,Bt,{value:l})}const i=e[At],n=t.toString();if(i[n]!=null)return i[n];i[n]={setters:[],getters:[],observers:[]};const s=Object.getOwnPropertyDescriptor(e,t);let r=s?.get,a=s?.set;if(r==null||a==null){const h=e[Bt];let l=h.indexOf(t);l===-1&&(l=h.push(t)-1),r??(r=function(){let d=this.__accessors;return d==null&&(d=h.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:d})),d[l]}),a??(a=function(d){let u=this.__accessors;u==null&&(u=h.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:u})),u[l]=d})}return Object.defineProperty(e,t,{set:function(h){const{setters:l,observers:d}=i[n];let u;l.some(f=>f.length>2)&&(u=r.call(this));for(const f of l)if(h=f(this,t,h,u),h===Je)return;a.call(this,h);for(const f of d)f(this,h,u)},get:function(){let h=r.call(this);for(const l of i[n].getters)if(h=l(this,t,h),h===Je)return;return h},enumerable:!0,configurable:!1}),i[n]}function on(e,t,i){return(n,s)=>{const r=re(n,s);r.setters.push(e),t&&r.getters.unshift(t),i&&Object.assign(r,i)}}function cn(e){return(t,i)=>{re(t,i).observers.push(e)}}function Ze(e){return typeof e<"u"&&At in e}function ae(e){const t=new Set;for(;Ze(e);)t.add(e?.[At]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(i=>Object.keys(i))}var{entries:mr,isArray:yr,isObject:hn,isPlainObject:_t}=rn;function ht(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((i,n)=>ht(i,t[n])):_t(e)?_t(t)?ln(e,t,ht):!1:e===t}function ln(e,t,i){if(Object.is(e,t))return!0;for(const n of Object.keys(t))if(!(n in e))return!1;for(const n of Object.keys(e))if(!(n in t)||!i(e[n],t[n]))return!1;return!0}function Qe(...e){const t={};for(const i of e){if(!hn(i))continue;const n=Ze(i)?ae(i):Object.keys(i);for(const s of n)_t(t[s])&&_t(i[s])?t[s]=Qe(t[s],i[s]):s in t||(t[s]??(t[s]=i[s]))}return t}import{boxContains as un,boxesEqual as dn,clamp as gt}from"ag-charts-core";var ti=Symbol("interpolate");function fn(e,t,i,n=1/0){const s={nearest:void 0,distanceSquared:n};for(const r of i){const a=r.distanceSquared(e,t);if(a===0)return{nearest:r,distanceSquared:0};a<s.distanceSquared&&(s.nearest=r,s.distanceSquared=a)}return s}var kt=class vt{constructor(t,i,n,s){this.x=t,this.y=i,this.width=n,this.height=s}static fromDOMRect({x:t,y:i,width:n,height:s}){return new vt(t,i,n,s)}static merge(t){let i=1/0,n=1/0,s=-1/0,r=-1/0;for(const a of t)a.x<i&&(i=a.x),a.y<n&&(n=a.y),a.x+a.width>s&&(s=a.x+a.width),a.y+a.height>r&&(r=a.y+a.height);return new vt(i,n,s-i,r-n)}static nearestBox(t,i,n){return fn(t,i,n)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:this.x+this.width,bottom:this.y+this.height,toJSON(){return{}}}}clone(){const{x:t,y:i,width:n,height:s}=this;return new vt(t,i,n,s)}equals(t){return dn(this,t)}containsPoint(t,i){return un(this,t,i)}intersection(t){if(!this.collidesBBox(t))return;const i=gt(t.x,this.x,t.x+t.width),n=gt(t.y,this.y,t.y+t.height),s=gt(t.x,this.x+this.width,t.x+t.width),r=gt(t.y,this.y+this.height,t.y+t.height);return new vt(i,n,s-i,r-n)}collidesBBox(t){return this.x<t.x+t.width&&this.x+this.width>t.x&&this.y<t.y+t.height&&this.y+this.height>t.y}computeCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}isFinite(){return Number.isFinite(this.x)&&Number.isFinite(this.y)&&Number.isFinite(this.width)&&Number.isFinite(this.height)}distanceSquared(t,i){if(this.containsPoint(t,i))return 0;const n=t-gt(this.x,t,this.x+this.width),s=i-gt(this.y,i,this.y+this.height);return n*n+s*s}shrink(t,i){if(typeof t=="number")this.applyMargin(t,i);else for(const n of Object.keys(t)){const s=t[n];typeof s=="number"&&this.applyMargin(s,n)}return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(t,i){if(typeof t=="number")this.applyMargin(-t,i);else for(const n of Object.keys(t)){const s=t[n];typeof s=="number"&&this.applyMargin(-s,n)}return this}applyMargin(t,i){switch(i){case"top":this.y+=t;case"bottom":this.height-=t;break;case"left":this.x+=t;case"right":this.width-=t;break;case"vertical":this.y+=t,this.height-=t*2;break;case"horizontal":this.x+=t,this.width-=t*2;break;case void 0:this.x+=t,this.y+=t,this.width-=t*2,this.height-=t*2;break}}translate(t,i){return this.x+=t,this.y+=i,this}[ti](t,i){return new vt(this.x*(1-i)+t.x*i,this.y*(1-i)+t.y*i,this.width*(1-i)+t.width*i,this.height*(1-i)+t.height*i)}};kt.zero=Object.freeze(new kt(0,0,0,0)),kt.NaN=Object.freeze(new kt(NaN,NaN,NaN,NaN));var W=kt;import{arraysEqual as pn}from"ag-charts-core";var oe=(e,t)=>e===t;function M(e){return function(t,i){const n=`__${i}`;t[i]||mn(t,i,n,e)}}function tt(e){return M(e)}function gn(e){const t=e??{};return t.equals=pn,M(e)}function mn(e,t,i,n){const{changeCb:s,convertor:r,checkDirtyOnAssignment:a=!1}=n??{},c={changeCb:s,checkDirtyOnAssignment:a,convertor:r},o=xn(i,bn(yn(Mn(i,c),c),c),c);Object.defineProperty(e,t,{set:o,get:function(){return this[i]},enumerable:!0,configurable:!0})}function yn(e,t){const{convertor:i}=t;return i?function(n){e.call(this,i(n))}:e}var ei=Symbol("no-change");function bn(e,t){const{changeCb:i}=t;return i?function(n){const s=e.call(this,n);return s!==ei&&i.call(this,this),s}:e}function xn(e,t,i){const{checkDirtyOnAssignment:n}=i;return n?function(s){const r=t.call(this,s);return s?._dirty===!0&&this.markDirty(e),r}:t}function Mn(e,t){const{equals:i=oe}=t;return function(n){const s=this[e];return i(n,s)?ei:(this[e]=n,this.onChangeDetection(e),n)}}var ce=(e,t)=>Math.sign(e-t);function vn(e,t){if(typeof e=="number"&&typeof t=="number")return ce(e,t);const i=typeof e=="number"?[e]:e,n=typeof t=="number"?[t]:t,s=Math.min(i.length,n.length);for(let r=0;r<s;r+=1){const a=ce(i[r],n[r]);if(a!==0)return a}return ce(i.length,n.length)}var Sn=5,Dt=class qe{constructor(t){this.serialNumber=qe._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=sn(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??NaN,this.zIndex=t?.zIndex??0,(t?.debugDirty??qe._debugEnabled)&&(this._debugDirtyProperties=new Map([["__first__",[]]]))}static toSVG(t,i,n){const s=t?.toSVG();if(s==null||!s.elements.length&&!s.defs?.length)return;const r=Ke("svg");if(r.setAttribute("width",String(i)),r.setAttribute("height",String(n)),r.setAttribute("viewBox",`0 0 ${i} ${n}`),s.defs?.length){const a=Ke("defs");a.append(...s.defs),r.append(a)}return r.append(...s.elements),r.outerHTML}static*extractBBoxes(t,i){for(const n of t)if(!i||n.visible&&!n.transitionOut){const s=n.getBBox();s&&(yield s)}}get datum(){return this._datum}set datum(t){this._datum!==t&&(this._previousDatum=this._datum,this._datum=t)}get previousDatum(){return this._previousDatum}get layerManager(){return this.scene?.layersManager}get imageLoader(){return this.scene?.imageLoader}closestDatum(){for(const{datum:t}of this.traverseUp(!0))if(t!=null)return t}preRender(t,i=1){if(this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i,this.batchLevel>0||this.batchDirty)throw new Error("AG Charts - illegal rendering state; batched update in progress");return this.childNodeCounts}isolatedRender(t){t.ctx.save();try{this.render(t)}catch(i){const n=i.errorCount??1;if(n>=Sn)throw i.errorCount=n,i;nn.warnOnce("Error during rendering",i,i.stack)}finally{t.ctx.restore()}}render(t){const{stats:i}=t;if(this.debugDirtyProperties(),t.debugNodeSearch){const n=this.name??this.id;t.debugNodeSearch.some(s=>typeof s=="string"?s===n:s.test(n))&&(t.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}setScene(t){this.scene=t}*traverseUp(t){let i=this;for(t&&(yield i);i=i.parentNode;)yield i}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?.removeChild(this)}batchedUpdate(t){this.batchLevel++,t(),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1)}setProperties(t){return this.batchLevel++,Object.assign(this,t),this.batchLevel--,this.batchLevel===0&&this.batchDirty&&(this.markDirty(),this.batchDirty=!1),this}containsPoint(t,i){return!1}pickNode(t,i){if(this.containsPoint(t,i))return this}pickNodes(t,i,n=[]){return this.containsPoint(t,i)&&n.push(this),n}getBBox(){return this.cachedBBox==null&&(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}onChangeDetection(t){this.markDirty(t)}markDirtyChildrenOrder(){this.cachedBBox=void 0}markDirty(t){if(this.batchLevel>0){this.batchDirty=!0;return}t!=null&&this._debugDirtyProperties&&this.markDebugProperties(t),this.cachedBBox=void 0,this.parentNode?.markDirty()}markDebugProperties(t){const i=this._debugDirtyProperties?.get(t)??[],n=new Error().stack?.split(`
`).filter(s=>s!=="Error"&&!s.includes(".markDebugProperties")&&!s.includes(".markDirty")&&!s.includes("Object.assign ")&&!s.includes(`${this.constructor.name}.`))??"unknown";i.push(n[0].replace(" at ","").trim()),this._debugDirtyProperties?.set(t,i)}debugDirtyProperties(){this._debugDirtyProperties!=null&&(this._debugDirtyProperties.has("__first__")||this._debugDirtyProperties.forEach((t,i)=>{t.length>1&&(console.groupCollapsed(`Property changed multiple times before render: ${this.constructor.name}.${i} (${t.length}x)`),t.forEach(n=>console.log(n)),console.groupEnd())}),this._debugDirtyProperties.clear())}onZIndexChange(){this.parentNode?.markDirtyChildrenOrder()}toSVG(){}};Dt._nextSerialNumber=0,Dt._debugEnabled=!1,b([M()],Dt.prototype,"visible",2),b([tt({equals:ht,changeCb:e=>e.onZIndexChange()})],Dt.prototype,"zIndex",2);var Ft=Dt;import{createSvgElement as Cn,isDefined as wn}from"ag-charts-core";import{Logger as he,getWindow as Pn,toArray as ii}from"ag-charts-core";var An=2e3,ni=Date.now(),kn=()=>{const e=Date.now()-ni;if(e>An){const t=(Math.floor(e/100)/10).toFixed(1);he.log(`**** ${t}s since last log message ****`)}ni=Date.now()},j={create(...e){return Object.assign((...i)=>{j.check(...e)&&(typeof i[0]=="function"&&(i=ii(i[0]())),kn(),he.log(...i))},{check:()=>j.check(...e),group:(i,n)=>j.check(...e)?he.logGroup(i,n):n()})},check(...e){return e.length===0&&e.push(!0),ii(Pn("agChartsDebug")).some(i=>e.includes(i))},inDevelopmentMode(e){if(j.check("dev"))return e()}};function Dn(e=0,t=0){return new OffscreenCanvas(e,t).getContext("2d")}var si=class{constructor(e=5){this.maxCacheSize=e,this.store=new Map}get(e){if(!this.store.has(e))return;const t=this.store.get(e);return this.store.delete(e),this.store.set(e,t),t}has(e){return this.store.has(e)}set(e,t){if(this.store.set(e,t),this.store.size>this.maxCacheSize){const i=this.store.keys();let n=this.store.size-this.maxCacheSize;for(;n>0;){const s=i.next();s.done||this.store.delete(s.value),n--}}return t}clear(){this.store.clear()}},le=class{static measureText(e,t){return this.getMeasurer(t).measureText(e)}static measureLines(e,t){return this.getMeasurer(t).measureLines(e)}static getMeasurer(e){const t=L.toFontString(e.font),i=`${t}-${e.textAlign??"start"}-${e.textBaseline??"top"}`;return this.instanceMap.get(i)??this.createFontMeasurer(t,e,i)}static clear(){this.instanceMap.clear()}static createFontMeasurer(e,t,i){const n=Dn();n.font=e,n.textAlign=t.textAlign??"start",n.textBaseline=t.textBaseline??"top";const s=new Fn(n,t);return this.instanceMap.set(i,s),s}};le.instanceMap=new si(10);var Fn=class{constructor(e,t){this.ctx=e,this.measureMap=new si(100),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline),e.font=L.toFontString(t.font),this.textMeasurer=new ri(i=>this.cachedCtxMeasureText(i),t.textBaseline??"alphabetic")}textWidth(e,t){return this.textMeasurer.textWidth(e,t)}measureText(e){return this.textMeasurer.measureText(e)}measureLines(e){return this.textMeasurer.measureLines(e)}cachedCtxMeasureText(e){if(!this.measureMap.has(e)){const t=this.ctx.measureText(e);this.measureMap.set(e,{actualBoundingBoxAscent:t.actualBoundingBoxAscent,emHeightAscent:t.emHeightAscent,emHeightDescent:t.emHeightDescent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,actualBoundingBoxLeft:t.actualBoundingBoxLeft,actualBoundingBoxRight:t.actualBoundingBoxRight,alphabeticBaseline:t.alphabeticBaseline,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent,hangingBaseline:t.hangingBaseline,ideographicBaseline:t.ideographicBaseline,width:t.width})}return this.measureMap.get(e)}},L=class{static toFontString({fontSize:e=10,fontStyle:t,fontWeight:i,fontFamily:n}){let s="";return t&&t!=="normal"&&(s+=`${t} `),i&&i!=="normal"&&i!==400&&(s+=`${i} `),s+=`${e}px`,s+=` ${n}`,s.trim()}static getLineHeight(e){return Math.ceil(e*this.defaultLineHeight)}static getHorizontalModifier(e){switch(e){case"left":case"start":return 0;case"center":return .5;case"right":case"end":return 1;default:return 0}}static getVerticalModifier(e){switch(e){case"hanging":case"top":return 0;case"middle":return .5;case"alphabetic":case"bottom":case"ideographic":default:return 1}}};L.EllipsisChar="\u2026",L.defaultLineHeight=1.15,L.lineSplitter=/\r?\n/g;var ri=class{constructor(e,t="alphabetic"){this.measureTextFn=e,this.textBaseline=t,this.charMap=new Map}getMetrics(e){const t=this.measureTextFn(e);return t.fontBoundingBoxAscent??(t.fontBoundingBoxAscent=t.emHeightAscent),t.fontBoundingBoxDescent??(t.fontBoundingBoxDescent=t.emHeightDescent),{width:t.width,height:t.actualBoundingBoxAscent+t.actualBoundingBoxDescent,lineHeight:t.fontBoundingBoxAscent+t.fontBoundingBoxDescent}}getMultilineMetrics(e){let t=0,i=0,n=0,s=0,r=0,a=0;const c=L.getVerticalModifier(this.textBaseline),o=[];let h=0;const l=e.length;for(const d of e){const u=this.measureTextFn(d);u.fontBoundingBoxAscent??(u.fontBoundingBoxAscent=u.emHeightAscent),u.fontBoundingBoxDescent??(u.fontBoundingBoxDescent=u.emHeightDescent),t<u.width&&(t=u.width),s<u.actualBoundingBoxLeft&&(s=u.actualBoundingBoxLeft),h===0?(i+=u.actualBoundingBoxAscent,n+=u.actualBoundingBoxAscent,a=u.alphabeticBaseline):r+=u.fontBoundingBoxAscent,h===l-1?i+=u.actualBoundingBoxDescent:r+=u.fontBoundingBoxDescent,o.push({text:d,width:u.width,height:u.actualBoundingBoxAscent+u.actualBoundingBoxDescent,lineHeight:u.fontBoundingBoxAscent+u.fontBoundingBoxDescent,offsetTop:u.actualBoundingBoxAscent,offsetLeft:u.actualBoundingBoxLeft}),h++}return i+=r,n+=r*c,{width:t,height:i,offsetTop:n,offsetLeft:s,alphabeticBaseline:a,lineMetrics:o}}textWidth(e,t){if(t){let i=0;for(let n=0;n<e.length;n++)i+=this.textWidth(e.charAt(n));return i}return e.length>1?this.measureTextFn(e).width:this.charMap.get(e)??this.charWidth(e)}measureText(e){return this.getMetrics(e)}measureLines(e){const t=typeof e=="string"?e.split(L.lineSplitter):e;return this.getMultilineMetrics(t)}charWidth(e){const{width:t}=this.measureTextFn(e);return this.charMap.set(e,t),t}};import{Logger as ue,getWindow as Tn,isString as Rn,toArray as In}from"ag-charts-core";import{clamp as On,toIterable as Nn}from"ag-charts-core";function ai({context:e,pixelRatio:t,width:i,height:n}){e.save();try{e.resetTransform(),e.clearRect(0,0,Math.ceil(i*t),Math.ceil(n*t))}finally{e.restore()}}function oi(e){if(j.check("canvas")){const t=e.save.bind(e),i=e.restore.bind(e);let n=0;Object.assign(e,{save(){t(),n++},restore(){if(n===0)throw new Error("AG Charts - Unable to restore() past depth 0");i(),n--},verifyDepthZero(){if(n!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${n}`)}})}}function ci(e,t,i){return[Math.floor(e*i),Math.floor(t*i)]}var de=class{constructor(e){const{width:t,height:i,pixelRatio:n,willReadFrequently:s=!1}=e;this.width=t,this.height=i,this.pixelRatio=n;const[r,a]=ci(t,i,n);this.canvas=new OffscreenCanvas(r,a),this.context=this.canvas.getContext("2d",{willReadFrequently:s}),this.context.setTransform(n,0,0,n,0,0),oi(this.context)}drawImage(e,t=0,i=0){return e.drawImage(this.canvas,t,i)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(e,t,i){if(!(e>0&&t>0))return;const{canvas:n,context:s}=this;if(e!==this.width||t!==this.height||i!==this.pixelRatio){const[r,a]=ci(e,t,i);n.width=r,n.height=a}s.setTransform(i,0,0,i,0,0),this.width=e,this.height=t,this.pixelRatio=i}clear(){ai(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{boxesEqual as En,clamp as Ln,generateUUID as fe}from"ag-charts-core";import{createSvgElement as Bn}from"ag-charts-core";var lt=Math.PI*2,Ar=Math.PI/2;function G(e){return e%=lt,e+=lt,e%=lt,e}function hi(e){return e%=lt,e<-Math.PI?e+=lt:e>=Math.PI&&(e-=lt),e}function zt(e,t,i){const n=G(e),s=G(t),r=G(i);return s<r?s<=n&&n<=r:s>r?s<=n||n<=r:!0}function J(e){return e/180*Math.PI}function pe(e,t){return e=G(e),t=G(t),t-e+(e>t?lt:0)}function Gt(e){return e?G(J(e)):0}import{createSvgElement as _n}from"ag-charts-core";import{Logger as ge,clamp as zn}from"ag-charts-core";import{clamp as et}from"ag-charts-core";var ut=(e,t,i)=>e*(1-i)+t*i,me=e=>{const t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4},ye=e=>{const t=e<0?-1:1,i=Math.abs(e);return i>.0031308?t*(1.055*i**(1/2.4)-.055):12.92*e},li=class F{constructor(t,i,n,s=1){this.r=et(0,t||0,1),this.g=et(0,i||0,1),this.b=et(0,n||0,1),this.a=et(0,s||0,1)}static validColorString(t){return t.indexOf("#")>=0?!!F.parseHex(t):t.indexOf("rgb")>=0?!!F.stringToRgba(t):F.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.indexOf("#")>=0)return F.fromHexString(t);const i=F.nameToHex.get(t.toLowerCase());if(i)return F.fromHexString(i);if(t.indexOf("rgb")>=0)return F.fromRgbaString(t);throw new Error(`Invalid color string: '${t}'`)}static parseHex(t){t=t.replace(/ /g,"").slice(1);let i;switch(t.length){case 6:case 8:i=[];for(let n=0;n<t.length;n+=2)i.push(parseInt(`${t[n]}${t[n+1]}`,16));break;case 3:case 4:i=t.split("").map(n=>parseInt(n,16)).map(n=>n+n*16);break}if(i?.length>=3&&i.every(n=>n>=0))return i.length===3&&i.push(255),i}static fromHexString(t){const i=F.parseHex(t);if(i){const[n,s,r,a]=i;return new F(n/255,s/255,r/255,a/255)}throw new Error(`Malformed hexadecimal color string: '${t}'`)}static stringToRgba(t){let i=-1,n=-1;for(let c=0;c<t.length;c++){const o=t[c];if(i===-1&&o==="(")i=c;else if(o===")"){n=c;break}}if(i===-1||n===-1)return;const r=t.substring(i+1,n).split(","),a=[];for(let c=0;c<r.length;c++){const o=r[c];let h=parseFloat(o);if(!Number.isFinite(h))return;o.indexOf("%")>=0?(h=et(0,h,100),h/=100):c===3?h=et(0,h,1):(h=et(0,h,255),h/=255),a.push(h)}return a}static fromRgbaString(t){const i=F.stringToRgba(t);if(i){if(i.length===3)return new F(i[0],i[1],i[2]);if(i.length===4)return new F(i[0],i[1],i[2],i[3])}throw new Error(`Malformed rgb/rgba color string: '${t}'`)}static fromArray(t){if(t.length===4)return new F(t[0],t[1],t[2],t[3]);if(t.length===3)return new F(t[0],t[1],t[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(t,i,n,s=1){const r=F.HSBtoRGB(t,i,n);return new F(r[0],r[1],r[2],s)}static fromHSL(t,i,n,s=1){const r=F.HSLtoRGB(t,i,n);return new F(r[0],r[1],r[2],s)}static fromOKLCH(t,i,n,s=1){const r=F.OKLCHtoRGB(t,i,n);return new F(r[0],r[1],r[2],s)}static padHex(t){return t.length===1?"0"+t:t}toHexString(){let t="#"+F.padHex(Math.round(this.r*255).toString(16))+F.padHex(Math.round(this.g*255).toString(16))+F.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(t+=F.padHex(Math.round(this.a*255).toString(16))),t}toRgbaString(t=3){const i=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)],n=Math.pow(10,t);return this.a!==1?(i.push(Math.round(this.a*n)/n),`rgba(${i.join(", ")})`):`rgb(${i.join(", ")})`}toString(){return this.a===1?this.toHexString():this.toRgbaString()}toHSB(){return F.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(t,i,n){const s=me(t),r=me(i),a=me(n),c=Math.cbrt(.4122214708*s+.5363325363*r+.0514459929*a),o=Math.cbrt(.2119034982*s+.6806995451*r+.1073969566*a),h=Math.cbrt(.0883024619*s+.2817188376*r+.6299787005*a),l=.2104542553*c+.793617785*o-.0040720468*h,d=1.9779984951*c-2.428592205*o+.4505937099*h,u=.0259040371*c+.7827717662*o-.808675766*h,f=Math.atan2(u,d)*180/Math.PI,p=l,y=Math.hypot(d,u),g=f>=0?f:f+360;return[p,y,g]}static OKLCHtoRGB(t,i,n){const s=t,r=i*Math.cos(n*Math.PI/180),a=i*Math.sin(n*Math.PI/180),c=(s+.3963377774*r+.2158037573*a)**3,o=(s-.1055613458*r-.0638541728*a)**3,h=(s-.0894841775*r-1.291485548*a)**3,l=4.0767416621*c-3.3077115913*o+.2309699292*h,d=-1.2684380046*c+2.6097574011*o-.3413193965*h,u=-.0041960863*c-.7034186147*o+1.707614701*h,f=ye(l),p=ye(d),y=ye(u);return[f,p,y]}static RGBtoHSL(t,i,n){const s=Math.min(t,i,n),r=Math.max(t,i,n),a=(r+s)/2;let c,o;if(r===s)c=0,o=0;else{const h=r-s;o=a>.5?h/(2-r-s):h/(r+s),r===t?c=(i-n)/h+(i<n?6:0):r===i?c=(n-t)/h+2:c=(t-i)/h+4,c*=360/6}return[c,o,a]}static HSLtoRGB(t,i,n){if(t=(t%360+360)%360,i===0)return[n,n,n];const s=n<.5?n*(1+i):n+i-n*i,r=2*n-s;function a(l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?r+(s-r)*6*l:l<1/2?s:l<2/3?r+(s-r)*(2/3-l)*6:r}const c=a(t/360+1/3),o=a(t/360),h=a(t/360-1/3);return[c,o,h]}static RGBtoHSB(t,i,n){const s=Math.min(t,i,n),r=Math.max(t,i,n),a=r===0?0:(r-s)/r;let c=0;if(s!==r){const o=r-s,h=(r-t)/o,l=(r-i)/o,d=(r-n)/o;t===r?c=d-l:i===r?c=2+h-d:c=4+l-h,c/=6,c<0&&(c=c+1)}return[c*360,a,r]}static HSBtoRGB(t,i,n){t=(t%360+360)%360/360;let s=0,r=0,a=0;if(i===0)s=r=a=n;else{const c=(t-Math.floor(t))*6,o=c-Math.floor(c),h=n*(1-i),l=n*(1-i*o),d=n*(1-i*(1-o));switch(c>>0){case 0:s=n,r=d,a=h;break;case 1:s=l,r=n,a=h;break;case 2:s=h,r=n,a=d;break;case 3:s=h,r=l,a=n;break;case 4:s=d,r=h,a=n;break;case 5:s=n,r=h,a=l;break}}return[s,r,a]}static mix(t,i,n){return new F(ut(t.r,i.r,n),ut(t.g,i.g,n),ut(t.b,i.b,n),ut(t.a,i.a,n))}static lighten(t,i){const n=F.RGBtoOKLCH(t.r,t.g,t.b);return F.fromOKLCH(et(0,n[0]+i,1),n[1],n[2])}static darken(t,i){const n=F.RGBtoOKLCH(t.r,t.g,t.b);return F.fromOKLCH(et(0,n[0]-i,1),n[1],n[2])}static interpolate(t,i){const n=1/(t.length-1),s=t.map(r=>F.RGBtoOKLCH(r.r,r.g,r.b));return Array.from({length:i},(r,a)=>{const c=a/(i-1),o=t.length<=2?0:Math.min(Math.floor(c*(t.length-1)),t.length-2),h=(c-o*n)/n,l=s[o],d=s[o+1];return F.fromOKLCH(ut(l[0],d[0],h),ut(l[1],d[1],h),ut(l[2],d[2],h))})}};li.nameToHex=new Map([["aliceblue","#F0F8FF"],["antiquewhite","#FAEBD7"],["aqua","#00FFFF"],["aquamarine","#7FFFD4"],["azure","#F0FFFF"],["beige","#F5F5DC"],["bisque","#FFE4C4"],["black","#000000"],["blanchedalmond","#FFEBCD"],["blue","#0000FF"],["blueviolet","#8A2BE2"],["brown","#A52A2A"],["burlywood","#DEB887"],["cadetblue","#5F9EA0"],["chartreuse","#7FFF00"],["chocolate","#D2691E"],["coral","#FF7F50"],["cornflowerblue","#6495ED"],["cornsilk","#FFF8DC"],["crimson","#DC143C"],["cyan","#00FFFF"],["darkblue","#00008B"],["darkcyan","#008B8B"],["darkgoldenrod","#B8860B"],["darkgray","#A9A9A9"],["darkgreen","#006400"],["darkgrey","#A9A9A9"],["darkkhaki","#BDB76B"],["darkmagenta","#8B008B"],["darkolivegreen","#556B2F"],["darkorange","#FF8C00"],["darkorchid","#9932CC"],["darkred","#8B0000"],["darksalmon","#E9967A"],["darkseagreen","#8FBC8F"],["darkslateblue","#483D8B"],["darkslategray","#2F4F4F"],["darkslategrey","#2F4F4F"],["darkturquoise","#00CED1"],["darkviolet","#9400D3"],["deeppink","#FF1493"],["deepskyblue","#00BFFF"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1E90FF"],["firebrick","#B22222"],["floralwhite","#FFFAF0"],["forestgreen","#228B22"],["fuchsia","#FF00FF"],["gainsboro","#DCDCDC"],["ghostwhite","#F8F8FF"],["gold","#FFD700"],["goldenrod","#DAA520"],["gray","#808080"],["green","#008000"],["greenyellow","#ADFF2F"],["grey","#808080"],["honeydew","#F0FFF0"],["hotpink","#FF69B4"],["indianred","#CD5C5C"],["indigo","#4B0082"],["ivory","#FFFFF0"],["khaki","#F0E68C"],["lavender","#E6E6FA"],["lavenderblush","#FFF0F5"],["lawngreen","#7CFC00"],["lemonchiffon","#FFFACD"],["lightblue","#ADD8E6"],["lightcoral","#F08080"],["lightcyan","#E0FFFF"],["lightgoldenrodyellow","#FAFAD2"],["lightgray","#D3D3D3"],["lightgreen","#90EE90"],["lightgrey","#D3D3D3"],["lightpink","#FFB6C1"],["lightsalmon","#FFA07A"],["lightseagreen","#20B2AA"],["lightskyblue","#87CEFA"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#B0C4DE"],["lightyellow","#FFFFE0"],["lime","#00FF00"],["limegreen","#32CD32"],["linen","#FAF0E6"],["magenta","#FF00FF"],["maroon","#800000"],["mediumaquamarine","#66CDAA"],["mediumblue","#0000CD"],["mediumorchid","#BA55D3"],["mediumpurple","#9370DB"],["mediumseagreen","#3CB371"],["mediumslateblue","#7B68EE"],["mediumspringgreen","#00FA9A"],["mediumturquoise","#48D1CC"],["mediumvioletred","#C71585"],["midnightblue","#191970"],["mintcream","#F5FFFA"],["mistyrose","#FFE4E1"],["moccasin","#FFE4B5"],["navajowhite","#FFDEAD"],["navy","#000080"],["oldlace","#FDF5E6"],["olive","#808000"],["olivedrab","#6B8E23"],["orange","#FFA500"],["orangered","#FF4500"],["orchid","#DA70D6"],["palegoldenrod","#EEE8AA"],["palegreen","#98FB98"],["paleturquoise","#AFEEEE"],["palevioletred","#DB7093"],["papayawhip","#FFEFD5"],["peachpuff","#FFDAB9"],["peru","#CD853F"],["pink","#FFC0CB"],["plum","#DDA0DD"],["powderblue","#B0E0E6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#FF0000"],["rosybrown","#BC8F8F"],["royalblue","#4169E1"],["saddlebrown","#8B4513"],["salmon","#FA8072"],["sandybrown","#F4A460"],["seagreen","#2E8B57"],["seashell","#FFF5EE"],["sienna","#A0522D"],["silver","#C0C0C0"],["skyblue","#87CEEB"],["slateblue","#6A5ACD"],["slategray","#708090"],["slategrey","#708090"],["snow","#FFFAFA"],["springgreen","#00FF7F"],["steelblue","#4682B4"],["tan","#D2B48C"],["teal","#008080"],["thistle","#D8BFD8"],["tomato","#FF6347"],["transparent","#00000000"],["turquoise","#40E0D0"],["violet","#EE82EE"],["wheat","#F5DEB3"],["white","#FFFFFF"],["whitesmoke","#F5F5F5"],["yellow","#FFFF00"],["yellowgreen","#9ACD32"]]);var be=li,xe=class{ticks(e,t,i){}niceDomain(e,t=this.domain){return t}get bandwidth(){}get step(){}get inset(){}},qt=(e,t)=>{const i=Symbol(String(t));e[i]=void 0,Object.defineProperty(e,t,{get(){return this[i]},set(n){this[i]!==n&&(this[i]=n,this.invalid=!0)},enumerable:!0,configurable:!1})},ui=e=>{const t=be.fromString(e),[i,n,s]=be.RGBtoOKLCH(t.r,t.g,t.b);return{l:i,c:n,h:s,a:t.a}},Me=1e-6,di=e=>e.c<Me||e.l<Me||e.l>1-Me,Gn=(e,t,i)=>{i=zn(0,i,1);let n;if(di(e))n=t.h;else if(di(t))n=e.h;else{const c=e.h;let o=t.h;const h=t.h-e.h;h>180?o-=360:h<-180&&(o+=360),n=c*(1-i)+o*i}const s=e.c*(1-i)+t.c*i,r=e.l*(1-i)+t.l*i,a=e.a*(1-i)+t.a*i;return be.fromOKLCH(r,s,n,a)},Wt=class extends xe{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(ui)}update(){const{domain:e,range:t}=this;e.length<2&&(ge.warnOnce("`colorDomain` should have at least 2 values."),e.length===0?e.push(0,1):e.length===1&&e.push(e[0]+1));for(let i=1;i<e.length;i++){const n=e[i-1],s=e[i];if(n>=s){ge.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((r,a)=>r-a);break}}if(t.length<e.length)for(let i=t.length;i<e.length;i++)t.push(t.length>0?t[0]:"black");this.parsedRange=this.range.map(ui)}normalizeDomains(...e){return{domain:e.flat(),animatable:!0}}toDomain(){}convert(e){this.refresh();const{domain:t,range:i,parsedRange:n}=this,s=t[0],r=t.at(-1),a=i[0],c=i[i.length-1];if(e<=s)return a;if(e>=r)return c;let o,h;if(t.length===2){const u=(e-s)/(r-s),f=1/(i.length-1);o=i.length<=2?0:Math.min(Math.floor(u*(i.length-1)),i.length-2),h=(u-o*f)/f}else{for(o=0;o<t.length-2&&!(e<t[o+1]);o++);const u=t[o],f=t[o+1];h=(e-u)/(f-u)}const l=n[o],d=n[o+1];return Gn(l,d,h).toRgbaString()}invert(){}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&ge.warnOnce("Expected update to not invalidate scale"))}};b([qt],Wt.prototype,"domain",2),b([qt],Wt.prototype,"range",2);var ve=class{constructor(e,t=[],i){this.colorSpace=e,this.stops=t,this.bbox=i,this._cache=void 0}createGradient(e,t,i){const n=this.bbox??t;if(!n.isFinite())return;if(this._cache!=null&&this._cache.ctx===e&&this._cache.bbox.equals(n))return this._cache.gradient;const{stops:s,colorSpace:r}=this;if(s.length===0)return;if(s.length===1)return s[0].color;let a=this.createCanvasGradient(e,n,i);if(a==null)return;const c=r==="oklch",o=.05;let h=s[0];a.addColorStop(h.stop,h.color);for(let l=1;l<s.length;l+=1){const d=s[l];if(c){const u=new Wt;u.domain=[h.stop,d.stop],u.range=[h.color,d.color];for(let f=h.stop+o;f<d.stop;f+=o)a.addColorStop(f,u.convert(f))}a.addColorStop(d.stop,d.color),h=d}return"createPattern"in a&&(a=a.createPattern()),this._cache={ctx:e,bbox:n,gradient:a},a}toSvg(e){const t=this.bbox??e,i=this.createSvgGradient(t);return this.stops.forEach(({stop:n,color:s})=>{const r=_n("stop");r.setAttribute("offset",`${n}`),r.setAttribute("stop-color",`${s}`),i.appendChild(r)}),i}},qn=class extends ve{constructor(e,t,i=0,n){super(e,t,n),this.angle=i}createCanvasGradient(e,t,i){const{angle:s}=this,r=Gt(s+-90),a=i?.centerX??t.x+t.width*.5,c=i?.centerY??t.y+t.height*.5;return e.createConicGradient(r,a,c)}createSvgGradient(e){return Bn("linearGradient")}};import{createSvgElement as Wn}from"ag-charts-core";var Hn=class extends ve{constructor(e,t,i=0,n){super(e,t,n),this.angle=i}getGradientPoints(e){const{angle:i}=this,n=Gt(i+90),s=Math.cos(n),r=Math.sin(n),a=e.width,c=e.height,o=e.x+a*.5,h=e.y+c*.5,l=Math.sqrt(c*c+a*a)/2,d=Math.atan2(c,a);let u;n<Math.PI/2?u=n:n<Math.PI?u=Math.PI-n:n<1.5*Math.PI?u=n-Math.PI:u=2*Math.PI-n;const f=l*Math.abs(Math.cos(u-d));return{x0:o+s*f,y0:h+r*f,x1:o-s*f,y1:h-r*f}}createCanvasGradient(e,t){const{x0:i,y0:n,x1:s,y1:r}=this.getGradientPoints(t);if(!(isNaN(i)||isNaN(n)||isNaN(s)||isNaN(r)))return e.createLinearGradient(i,n,s,r)}createSvgGradient(e){const{x0:t,y0:i,x1:n,y1:s}=this.getGradientPoints(e),r=Wn("linearGradient");return r.setAttribute("x1",String(t)),r.setAttribute("y1",String(i)),r.setAttribute("x2",String(n)),r.setAttribute("y2",String(s)),r.setAttribute("gradientUnits","userSpaceOnUse"),r}};import{createSvgElement as $n}from"ag-charts-core";var jn=class extends ve{constructor(e,t,i){super(e,t,i)}createCanvasGradient(e,t,i){const n=i?.centerX??t.x+t.width*.5,s=i?.centerY??t.y+t.height*.5,r=i?.innerRadius??0,a=i?.outerRadius??Math.hypot(t.width*.5,t.height*.5)/Math.SQRT2;return e.createRadialGradient(n,s,r,n,s,a)}createSvgGradient(e){const t=e.x+e.width*.5,i=e.y+e.height*.5,n=$n("radialGradient");return n.setAttribute("cx",String(t)),n.setAttribute("cy",String(i)),n.setAttribute("r",String(Math.hypot(e.width*.5,e.height*.5)/Math.SQRT2)),n.setAttribute("gradientUnits","userSpaceOnUse"),n}};import{Logger as Yn}from"ag-charts-core";import{Logger as Se,isArray as Xn,isPlainObject as Un}from"ag-charts-core";var H=an,Ce=class{handleUnknownProperties(e,t){}set(e){const{className:t=this.constructor.name}=this.constructor;if(typeof e!="object")return Se.warn(`unable to set ${t} - expecting a properties object`),this;const i=new Set(Object.keys(e));for(const n of ae(this))if(i.has(n)){const s=e[n],r=this;if(pi(r[n]))if(r[n]instanceof fi){const a=r[n].reset(s);a!=null?r[n]=a:Se.warn(`unable to set [${n}] - expecting a properties array`)}else r[n].set(s);else Un(s)?r[n]=Qe(s,r[n]??{}):r[n]=s;i.delete(n)}this.handleUnknownProperties(i,e);for(const n of i)Se.warn(`unable to set [${n}] in ${t} - property is unknown`);return this}toJson(){return ae(this).reduce((e,t)=>{const i=this[t];return e[t]=pi(i)?i.toJson():i,e},{})}},fi=class Ki extends Array{constructor(t,...i){super(i.length);const s=(r=>!!r?.prototype?.constructor?.name)(t)?r=>new t().set(r):t;Object.defineProperty(this,"itemFactory",{value:s,enumerable:!1,configurable:!1}),this.set(i)}set(t){if(Xn(t)){this.length=t.length;for(let i=0;i<t.length;i++)this[i]=this.itemFactory(t[i])}return this}reset(t){if(Array.isArray(t))return new Ki(this.itemFactory,...t)}toJson(){return this.map(t=>t?.toJson?.()??t)}};function pi(e){return e instanceof Ce||e instanceof fi}var gi=class extends Ce{constructor(){super(...arguments),this.color="black"}};b([H],gi.prototype,"stop",2),b([H],gi.prototype,"color",2);function Vn(e){let t;for(const i of e)if(i?.stop!=null){if(t!=null&&i.stop<t)return!1;t=i.stop}return!0}function mi(e){return e.flatMap((t,i)=>{const{stop:n}=t,s=e.at(i+1)?.color;return s!=null?[t,{stop:n,color:s}]:[t]})}function Kn(e,t){const i=t==="discrete"?1:0,n=e.map((s,r,{length:a})=>({stop:(r+i)/(a-1+i),color:s}));return t==="discrete"?mi(n):n}function Jn(e,t,i,n="continuous"){const s=e.map(p=>typeof p=="string"?{color:p}:p);if(s.length===0)return Kn(t,n);if(!Vn(s))return Yn.warnOnce("[fills] must have the stops defined in ascending order"),[];const r=Math.min(...i),a=Math.max(...i),c=n==="discrete",o=new Float64Array(s.length);let h=0,l=-1;for(let p=0;p<s.length;p+=1){const y=s[p];if(p>=l){l=s.length-1;for(let m=p+1;m<s.length;m+=1)if(s[m]?.stop!=null){l=m;break}}let g=y?.stop;if(g==null){const m=s[h]?.stop,x=s[l]?.stop,w=m??r,P=x??a,k=c&&m==null?1:0;g=w+(P-w)*(p-h+k)/(l-h+k)}else h=p;o[p]=Math.max(0,Math.min(1,(g-r)/(a-r)))}let d=s.find(p=>p.color!=null)?.color,u;const f=s.map((p,y)=>{let g=p?.color;const m=o[y];return g!=null?d=g:d!=null?g=d:(u==null&&(u=new Wt,u.domain=[0,1],u.range=t),g=u.convert(m)),{stop:m,color:g}});return n==="discrete"?mi(f):f}import{Logger as Zn,createSvgElement as we}from"ag-charts-core";var Qn=class{constructor(e,t){this.imageLoader=e,this._cache=void 0,this.url=t.url,this.backgroundFill=t.backgroundFill??"black",this.backgroundFillOpacity=t.backgroundFillOpacity??1,this.repeat=t.repeat??"no-repeat",this.width=t.width,this.height=t.height,this.fit=t.fit??"stretch",this.rotation=t.rotation??0}createCanvasImage(e,t,i,n){if(!t)return null;const[s,r]=this.getSize(t.width,t.height,i,n);return s<1||r<1?(Zn.warnOnce("Image fill is too small to render, ignoring."),null):e.createPattern(t,this.repeat)}getSize(e,t,i,n){const{fit:s}=this;let r=e,a=t,c=1;const o=i/n,h=e/t;return s==="stretch"||e===0||t===0?(r=i,a=n):s==="contain"?c=h>o?i/e:n/t:s==="cover"&&(c=h>o?n/t:i/e),[Math.max(1,r*c),Math.max(1,a*c)]}setImageTransform(e,t){if(typeof e=="string")return;const{url:i,rotation:n,width:s,height:r}=this,a=this.imageLoader?.loadImage(i);if(!a)return;const c=Gt(n),o=Math.cos(c),h=Math.sin(c),[l,d]=this.getSize(a.width,a.height,s??t.width,r??t.height),u=l/a.width,f=d/a.height,p=t.x+t.width/2,y=t.y+t.height/2,g=o*l-h*d,m=h*l+o*d,x=g/2,w=m/2;e?.setTransform(new DOMMatrix([o*u,h*f,-h*u,o*f,p-x,y-w]))}createPattern(e,t,i,n){const s=this.width??t,r=this.height??i,a=this._cache;if(a!=null&&a.ctx===e&&a.width===s&&a.height===r)return a.pattern;const c=this.imageLoader?.loadImage(this.url,n),o=this.createCanvasImage(e,c,s,r);return o==null?this.backgroundFill:(this._cache={ctx:e,pattern:o,width:s,height:r},o)}toSvg(e,t){const{url:i,rotation:n,backgroundFill:s,backgroundFillOpacity:r}=this,{x:a,y:c,width:o,height:h}=e,l=we("pattern");l.setAttribute("viewBox",`0 0 ${o} ${h}`),l.setAttribute("x",String(a)),l.setAttribute("y",String(c)),l.setAttribute("width",String(o)),l.setAttribute("height",String(h)),l.setAttribute("patternUnits","userSpaceOnUse");const d=we("rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(o)),d.setAttribute("height",String(h)),d.setAttribute("fill",s),d.setAttribute("fill-opacity",String(r)),l.appendChild(d);const u=we("image");return u.setAttribute("href",i),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(o)),u.setAttribute("height",String(h)),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("transform",`scale(${1/t}) rotate(${n}, ${o/2}, ${h/2})`),l.appendChild(u),l}};import{Logger as ts,createSvgElement as Pe}from"ag-charts-core";function yi(e,t,i,n){const s=e-i,r=t-n;return s*s+r*r}function Ae(e,t,i,n,s,r,a){if(i===s&&n===r)return Math.min(a,yi(e,t,i,n));const c=s-i,o=r-n,h=Math.max(0,Math.min(1,((e-i)*c+(t-n)*o)/(c*c+o*o))),l=i+h*c,d=n+h*o;return Math.min(a,yi(e,t,l,d))}import{Logger as bi}from"ag-charts-core";var es=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,T=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,is=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,xi=/^[01]/,ns={z:[],h:[T],v:[T],m:[T,T],l:[T,T],t:[T,T],s:[T,T,T,T],q:[T,T,T,T],c:[T,T,T,T,T,T],a:[T,T,T,xi,xi,T,T]};function ss(e){if(!e)return;const t=[];let i=0,n;for(;i<e.length;){const s=es.exec(e.slice(i));let r;if(s==null){if(!n){bi.warnOnce(`Invalid SVG path, error at index ${i}: Missing command.`);return}r=n}else r=s[1],i+=s[0].length;const a=rs(r,e,i);if(!a)return;i=a[0],n=r,t.push(a[1])}return t}function rs(e,t,i){const n=ns[e.toLocaleLowerCase()],s={command:e,params:[]};for(const r of n){const a=t.slice(i),c=r.exec(a);if(c!=null){s.params.push(parseFloat(c[0])),i+=c[0].length;const o=is.exec(a.slice(c[0].length));o!=null&&(i+=o[0].length)}else{if(s.params.length===1)return[i,s];bi.warnOnce(`Invalid SVG path, error at index ${i}: No path segment parameters for command [${e}]`);return}}return[i,s]}function as(e,t){const i=-t/e;return e!==0&&i>=0&&i<=1?[i]:[]}function os(e,t,i,n=1e-6){if(Math.abs(e)<n)return as(t,i);const s=t*t-4*e*i,r=[];if(Math.abs(s)<n){const a=-t/(2*e);a>=0&&a<=1&&r.push(a)}else if(s>0){const a=Math.sqrt(s),c=(-t-a)/(2*e),o=(-t+a)/(2*e);c>=0&&c<=1&&r.push(c),o>=0&&o<=1&&r.push(o)}return r}function cs(e,t,i,n,s=1e-6){if(Math.abs(e)<s)return os(t,i,n,s);const r=t/e,a=i/e,c=n/e,o=(3*a-r*r)/9,h=(9*r*a-27*c-2*r*r*r)/54,l=o*o*o+h*h,d=1/3,u=[];if(l>=0){const f=Math.sqrt(l),p=Math.sign(h+f)*Math.pow(Math.abs(h+f),d),y=Math.sign(h-f)*Math.pow(Math.abs(h-f),d),g=Math.abs(Math.sqrt(3)*(p-y)/2),m=-d*r+(p+y);if(m>=0&&m<=1&&u.push(m),Math.abs(g)<s){const x=-d*r-(p+y)/2;x>=0&&x<=1&&u.push(x)}}else{const f=Math.acos(h/Math.sqrt(-o*o*o)),p=d*r,y=2*Math.sqrt(-o),g=y*Math.cos(d*f)-p,m=y*Math.cos(d*(f+2*Math.PI))-p,x=y*Math.cos(d*(f+4*Math.PI))-p;g>=0&&g<=1&&u.push(g),m>=0&&m<=1&&u.push(m),x>=0&&x<=1&&u.push(x)}return u}function ke(e,t,i,n,s,r,a,c){const o=(i-e)*(c-r)-(n-t)*(a-s);if(o===0)return 0;const h=((a-s)*(t-r)-(e-s)*(c-r))/o,l=((i-e)*(t-r)-(n-t)*(e-s))/o;return h>=0&&h<=1&&l>=0&&l<=1?1:0}function hs(e,t,i,n,s,r,a,c,o,h,l,d){let u=0;const f=h-d,p=l-o,y=o*(d-h)-h*(l-o),g=Mi(e,i,s,a),m=Mi(t,n,r,c),x=f*g[0]+p*m[0],w=f*g[1]+p*m[1],P=f*g[2]+p*m[2],k=f*g[3]+p*m[3]+y,A=cs(x,w,P,k);for(const v of A){const S=v*v,C=v*S,D=g[0]*C+g[1]*S+g[2]*v+g[3],R=m[0]*C+m[1]*S+m[2]*v+m[3];let N;o===l?N=(R-h)/(d-h):N=(D-o)/(l-o),N>=0&&N<=1&&u++}return u}function Mi(e,t,i,n){return[-e+3*t-3*i+n,3*e-6*t+3*i,-3*e+3*t,e]}import{insertListItemsSorted as ls}from"ag-charts-core";function Ht(e,t,i,n,s){return(1-s)**3*e+3*(1-s)**2*s*t+3*(1-s)*s**2*i+s**3*n}function us(e,t,i,n,s,r,a,c,o){const h=(1-o)*e+o*i,l=(1-o)*t+o*n,d=(1-o)*i+o*s,u=(1-o)*n+o*r,f=(1-o)*s+o*a,p=(1-o)*r+o*c,y=(1-o)*h+o*d,g=(1-o)*l+o*u,m=(1-o)*d+o*f,x=(1-o)*u+o*p,w=(1-o)*y+o*m,P=(1-o)*g+o*x;return[[{x:e,y:t},{x:h,y:l},{x:y,y:g},{x:w,y:P}],[{x:w,y:P},{x:m,y:x},{x:f,y:p},{x:a,y:c}]]}function vi(e,t,i,n){const s=-e+3*t-3*i+n,r=2*(e-2*t+i),a=-e+t;if(s===0){if(r!==0){const o=-a/r;if(o>0&&o<1)return[o]}return[]}const c=r*r-4*s*a;if(c>=0){const o=Math.sqrt(c),h=(-r+o)/(2*s),l=(-r-o)/(2*s);return[h,l].filter(d=>d>0&&d<1)}return[]}function ds(e,t,i,n,s,r,a,c){const o=vi(e,i,s,a),h=vi(t,n,r,c);return[...o,...h]}function De(e,t,i){const n=Ht(e[0].x,e[1].x,e[2].x,e[3].x,.5),s=Ht(e[0].y,e[1].y,e[2].y,e[3].y,.5),r=Math.hypot(n-t,s-i),a=Math.min(Math.hypot(e[0].x-t,e[0].y-i),Math.hypot(e[1].x-t,e[1].y-i),Math.hypot(e[2].x-t,e[2].y-i),Math.hypot(e[3].x-t,e[3].y-i));return{points:e,distance:r,minDistance:a}}function fs(e,t,i,n,s,r,a,c,o,h,l=1){let u={value:De([{x:e,y:t},{x:i,y:n},{x:s,y:r},{x:a,y:c}],o,h),next:null},f;for(;u!=null;){const{points:p,distance:y,minDistance:g}=u.value;if(u=u.next,(f==null||y<f.distance)&&(f={distance:y,minDistance:g}),f!=null&&f.distance-g<=l)continue;const[m,x]=us(p[0].x,p[0].y,p[1].x,p[1].y,p[2].x,p[2].y,p[3].x,p[3].y,.5),w=[De(m,o,h),De(x,o,h)].sort(Si);u=ls(u,w,Si)}return f?.distance??1/0}var Si=(e,t)=>t.minDistance-e.minDistance,Tt=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.cx=NaN,this.cy=NaN,this.sx=NaN,this.sy=NaN,this.openedPath=!1,this.closedPath=!1}isEmpty(){return this.commands.length===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commands.length||this.previousParams.length!==this.params.length||this.previousCommands.toString()!==this.commands.toString()||this.previousParams.toString()!==this.params.toString()}getPath2D(){return this.path2d}moveTo(e,t){this.openedPath=!0,this.sx=e,this.sy=t,this.cx=e,this.cy=t,this.path2d.moveTo(e,t),this.commands.push(0),this.params.push(e,t)}lineTo(e,t){this.openedPath?(this.cx=e,this.cy=t,this.path2d.lineTo(e,t),this.commands.push(1),this.params.push(e,t)):this.moveTo(e,t)}cubicCurveTo(e,t,i,n,s,r){this.openedPath||this.moveTo(e,t),this.path2d.bezierCurveTo(e,t,i,n,s,r),this.commands.push(2),this.params.push(e,t,i,n,s,r)}closePath(){this.openedPath&&(this.cx=this.sx,this.cy=this.sy,this.sx=NaN,this.sy=NaN,this.path2d.closePath(),this.commands.push(3),this.openedPath=!1,this.closedPath=!0)}rect(e,t,i,n){this.moveTo(e,t),this.lineTo(e+i,t),this.lineTo(e+i,t+n),this.lineTo(e,t+n),this.closePath()}roundRect(e,t,i,n,s){s=Math.min(s,i/2,n/2),this.moveTo(e,t+s),this.arc(e+s,t+s,s,Math.PI,1.5*Math.PI),this.lineTo(e+s,t),this.lineTo(e+i-s,t),this.arc(e+i-s,t+s,s,1.5*Math.PI,2*Math.PI),this.lineTo(e+i,t+s),this.lineTo(e+i,t+n-s),this.arc(e+i-s,t+n-s,s,0,Math.PI/2),this.lineTo(e+i-s,t+n),this.lineTo(e+s,t+n),this.arc(e+ +s,t+n-s,s,Math.PI/2,Math.PI),this.lineTo(e,t+n-s),this.closePath()}ellipse(e,t,i,n,s,r,a,c=!1){const o=i,h=n/i,l=Math.cos(s),d=Math.sin(s),u=-h*d,f=h*l,p=o*Math.cos(r),y=o*Math.sin(r),g=e+l*p+u*y,m=t+d*p+f*y,x=(g-this.cx)**2+(m-this.cy)**2;this.openedPath?x>1e-6&&this.lineTo(g,m):this.moveTo(g,m);let w=c?-G(r-a):G(a-r);Math.abs(Math.abs(a-r)-2*Math.PI)<1e-6&&w<2*Math.PI&&(w+=2*Math.PI*(c?-1:1));const P=Math.max(Math.ceil(Math.abs(w)/(Math.PI/2)),1),k=w/P,A=4/3*Math.tan(k/4);for(let v=0;v<P;v+=1){const S=r+k*(v+0),C=r+k*(v+1),D=o*Math.sin(S),R=o*Math.cos(S),N=o*Math.sin(C),z=o*Math.cos(C),ft=R-A*D,pt=D+A*R,St=z+A*N,Ct=N-A*z,wt=z,Pt=N;this.cubicCurveTo(e+l*ft+u*pt,t+d*ft+f*pt,e+l*St+u*Ct,t+d*St+f*Ct,e+l*wt+u*Pt,t+d*wt+f*Pt)}}arc(e,t,i,n,s,r){this.ellipse(e,t,i,i,0,n,s,r)}appendSvg(e){const t=ss(e);if(t==null)return!1;let i=0,n=0,s,r,a=0,c=0;for(const{command:o,params:h}of t){s??(s=h[0]),r??(r=h[1]);const l=o===o.toLowerCase(),d=l?s:0,u=l?r:0;switch(o.toLowerCase()){case"m":this.moveTo(d+h[0],u+h[1]),s=d+h[0],r=u+h[1],i=s,n=r;break;case"c":this.cubicCurveTo(d+h[0],u+h[1],d+h[2],u+h[3],d+h[4],u+h[5]),a=d+h[2],c=u+h[3],s=d+h[4],r=u+h[5];break;case"s":this.cubicCurveTo(s+s-a,r+r-c,d+h[0],u+h[1],d+h[2],u+h[3]),a=d+h[0],c=u+h[1],s=d+h[2],r=u+h[3];break;case"q":this.cubicCurveTo((d+2*h[0])/3,(u+2*h[1])/3,(2*h[0]+h[2])/3,(2*h[1]+h[3])/3,h[2],h[3]),a=h[0],c=h[1],s=h[2],r=h[3];break;case"t":this.cubicCurveTo((s+2*(s+s-a))/3,(r+2*(r+r-c))/3,(2*(s+s-a)+h[0])/3,(2*(r+r-c)+h[1])/3,h[0],h[1]),a=s+s-a,c=r+r-c,s=h[0],r=h[1];break;case"a":this.svgEllipse(s,r,h[0],h[1],h[2]*Math.PI/180,h[3],h[4],d+h[5],u+h[6]),s=d+h[5],r=u+h[6];break;case"h":this.lineTo(d+h[0],r),s=d+h[0];break;case"l":this.lineTo(d+h[0],u+h[1]),s=d+h[0],r=u+h[1];break;case"v":this.lineTo(s,u+h[0]),r=u+h[0];break;case"z":this.closePath(),s=i,r=n;break;default:throw new Error(`Could not translate command '${o}' with '${h.join(" ")}'`)}}return!0}svgEllipse(e,t,i,n,s,r,a,c,o){i=Math.abs(i),n=Math.abs(n);const h=(e-c)/2,l=(t-o)/2,d=Math.sin(s),u=Math.cos(s),f=u*h+d*l,p=-d*h+u*l,y=f/i,g=p/n;let m=y*y+g*g,x=(e+c)/2,w=(t+o)/2,P=0,k=0;m>=1?(m=Math.sqrt(m),i*=m,n*=m):(m=Math.sqrt(1/m-1),r===a&&(m=-m),P=m*i*g,k=-m*n*y,x+=u*P-d*k,w+=d*P+u*k);const A=Math.atan2((p-k)/n,(f-P)/i),v=Math.atan2((-p-k)/n,(-f-P)/i)-A,S=A+v,C=!!(1-a);this.ellipse(x,w,i,n,s,A,S,C)}clear(e){e&&(this.previousCommands=this.commands,this.previousParams=this.params,this.previousClosedPath=this.closedPath),this.path2d=new Path2D,this.openedPath=!1,this.closedPath=!1,this.commands=[],this.params=[]}isPointInPath(e,t){const i=this.commands,n=this.params,s=i.length,r=-1e4,a=-1e4;let c=NaN,o=NaN,h=0,l=0,d=0;for(let u=0,f=0;u<s;u++)switch(i[u]){case 0:d+=ke(c,o,h,l,r,a,e,t),h=n[f++],c=h,l=n[f++],o=l;break;case 1:d+=ke(h,l,n[f++],n[f++],r,a,e,t),h=n[f-2],l=n[f-1];break;case 2:d+=hs(h,l,n[f++],n[f++],n[f++],n[f++],n[f++],n[f++],r,a,e,t),h=n[f-2],l=n[f-1];break;case 3:d+=ke(c,o,h,l,r,a,e,t);break}return d%2===1}distanceSquared(e,t){let i=1/0;const n=this.commands,s=this.params,r=n.length;let a=NaN,c=NaN,o=0,h=0;for(let l=0,d=0;l<r;l++)switch(n[l]){case 0:o=a=s[d++],h=c=s[d++];break;case 1:{const x=o,w=h;o=s[d++],h=s[d++],i=Ae(e,t,x,w,o,h,i);break}case 2:const u=o,f=h,p=s[d++],y=s[d++],g=s[d++],m=s[d++];o=s[d++],h=s[d++],i=fs(u,f,p,y,g,m,o,h,e,t)**2;break;case 3:i=Ae(e,t,o,h,a,c,i);break}return i}toSVG(e=(t,i)=>({x:t,y:i})){const t=[],{commands:i,params:n}=this,s=(a,c)=>{t.push(a);for(let o=0;o<c;o+=2){const{x:h,y:l}=e(n[r++],n[r++]);t.push(h,l)}};let r=0;for(const a of i)switch(a){case 0:s("M",2);break;case 1:s("L",2);break;case 2:s("C",6);break;case 3:s("Z",0);break}return t.join(" ")}computeBBox(){const{commands:e,params:t}=this;let[i,n,s,r]=[1/0,1/0,-1/0,-1/0],[a,c]=[NaN,NaN],[o,h]=[NaN,NaN];const l=(u,f)=>{i=Math.min(f,i),n=Math.min(u,n),s=Math.max(u,s),r=Math.max(f,r),a=u,c=f};let d=0;for(const u of e)switch(u){case 0:l(t[d++],t[d++]),o=a,h=c;break;case 1:l(t[d++],t[d++]);break;case 2:{const f=a,p=c,y=t[d++],g=t[d++],m=t[d++],x=t[d++],w=t[d++],P=t[d++];ds(f,p,y,g,m,x,w,P).forEach(A=>{const v=Ht(f,y,m,w,A),S=Ht(p,g,x,P,A);l(v,S)}),l(w,P);break}case 3:l(o,h),o=NaN,h=NaN;break}return new W(n,i,s-n,r-i)}};function B(e,t,i){const n=Math.round(t*e)/e;return i==null?n:i===0?0:i<1?Math.ceil(i*e)/e:Math.round((i+t)*e)/e-n}function Ci(e,t){return Math.floor(t*e)/e}function Fe(e,t,i){const{width:n,height:s,padding:r,strokeWidth:a}=t,c=n/2,o=s/2,h=Math.max(1,n-r-a/2),l=Math.max(1,s-r-a/2);let d=!1;for(const[u,f]of i){const p=c+(u-.5)*h,y=o+(f-.5)*l;d?e.lineTo(p,y):e.moveTo(p,y),d=!0}e.closePath()}var wi={circles(e,{width:t,strokeWidth:i,padding:n}){const s=t/2,r=Math.max(1,s-n-i/2);e.arc(s,s,r,0,Math.PI*2)},squares(e,{width:t,height:i,pixelRatio:n,padding:s,strokeWidth:r}){const a=s+r/2;e.moveTo(B(n,a),B(n,a)),e.lineTo(B(n,t-a),B(n,a)),e.lineTo(B(n,t-a),B(n,i-a)),e.lineTo(B(n,a),B(n,i-a)),e.closePath()},triangles(e,t){Fe(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){Fe(e,t,[[.5,0],[1,.5],[.5,1],[0,.5]])},stars(e,{width:t,height:i,padding:n}){const r=Math.max(1,(t-n)/2),a=r/2,c=Math.PI/2;for(let o=0;o<5*2;o++){const h=o%2===0?r:a,l=o*Math.PI/5-c,d=t/2+Math.cos(l)*h,u=i/2+Math.sin(l)*h;e.lineTo(d,u)}e.closePath()},hearts(e,{width:t,height:i,padding:n}){const s=Math.max(1,t/4-n/2),r=t/2,a=i/2+s/2;e.arc(r-s,a-s,s,J(130),J(330)),e.arc(r+s,a-s,s,J(220),J(50)),e.lineTo(r,a+s),e.closePath()},crosses(e,t){Fe(e,t,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},"vertical-lines"(e,{width:t,height:i,pixelRatio:n,strokeWidth:s}){const r=B(n,t/2)-s%2/2;e.moveTo(r,0),e.lineTo(r,i)},"horizontal-lines"(e,{width:t,height:i,pixelRatio:n,strokeWidth:s}){const r=B(n,i/2)-s%2/2;e.moveTo(0,r),e.lineTo(t,r)},"forward-slanted-lines"(e,{width:t,height:i,strokeWidth:n}){const s=Math.atan2(i,t),r=n*Math.cos(s),a=n*Math.sin(s);e.moveTo(-r,a),e.lineTo(r,-a),e.moveTo(-r,i+a),e.lineTo(t+r,-a),e.moveTo(t-r,i+a),e.lineTo(t+r,i-a)},"backward-slanted-lines"(e,{width:t,height:i,strokeWidth:n}){const s=Math.atan2(i,t),r=n*Math.cos(s),a=n*Math.sin(s);e.moveTo(t-r,-a),e.lineTo(t+r,a),e.moveTo(-r,-a),e.lineTo(t+r,i+a),e.moveTo(-r,i-a),e.lineTo(r,i+a)}},ps=class{constructor(e){this._cache=void 0,this.width=Math.max(e?.width??10,1),this.height=Math.max(e?.height??10,1),this.fill=e.fill??"none",this.fillOpacity=e.fillOpacity??1,this.backgroundFill=e.backgroundFill??"none",this.backgroundFillOpacity=e.backgroundFillOpacity??1,this.stroke=e.stroke??"black",this.strokeOpacity=e.strokeOpacity??1,this.strokeWidth=e.strokeWidth??1,this.padding=e.padding??1,this.pattern=e.pattern??"forward-slanted-lines",this.rotation=e.rotation??0,this.scale=e.scale??1,this.path=e.path}getPath(e){const{pattern:t,width:i,height:n,padding:s,strokeWidth:r,path:a}=this,c=new Tt;let o=wi[t]!=null;return a&&o&&(o=!c.appendSvg(a)),o&&wi[t](c,{width:i,height:n,pixelRatio:e,strokeWidth:r,padding:s}),c}renderStroke(e,t){const{stroke:i,strokeWidth:n,strokeOpacity:s}=this;n&&(t.strokeStyle=i,t.lineWidth=n,t.globalAlpha=s,t.stroke(e))}renderFill(e,t){const{fill:i,fillOpacity:n}=this;i!=="none"&&(t.fillStyle=i,t.globalAlpha=n,t.fill(e))}createCanvasPattern(e,t){const{width:i,height:n,scale:s,backgroundFill:r,backgroundFillOpacity:a}=this;if(i*s<1||n*s<1)return ts.warnOnce("Pattern fill is too small to render, ignoring."),null;const c=new de({width:i,height:n,pixelRatio:t*s}),o=c.context;r!=="none"&&(o.fillStyle=r,o.globalAlpha=a,o.fillRect(0,0,i,n));const h=this.getPath(t).getPath2D();this.renderFill(h,o),this.renderStroke(h,o);const l=e.createPattern(c.canvas,"repeat");return this.setPatternTransform(l,t),c.destroy(),l}setPatternTransform(e,t,i=0,n=0){if(e==null)return;const s=Gt(this.rotation),r=1/t,a=Math.cos(s)*r,c=Math.sin(s)*r;e.setTransform(new DOMMatrix([a,c,-c,a,i,n]))}createPattern(e,t){if(this._cache!=null&&this._cache.ctx===e&&this._cache.pixelRatio===t)return this._cache.pattern;const i=this.createCanvasPattern(e,t);if(i!=null)return this._cache={ctx:e,pattern:i,pixelRatio:t},i}toSvg(){const{width:e,height:t,fill:i,fillOpacity:n,backgroundFill:s,backgroundFillOpacity:r,stroke:a,strokeWidth:c,strokeOpacity:o,rotation:h,scale:l}=this,d=Pe("pattern");d.setAttribute("viewBox",`0 0 ${e} ${t}`),d.setAttribute("width",String(e)),d.setAttribute("height",String(t)),d.setAttribute("patternUnits","userSpaceOnUse");const u=Pe("rect");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(e)),u.setAttribute("height",String(t)),u.setAttribute("fill",s),u.setAttribute("fill-opacity",String(r)),d.appendChild(u);const f=Pe("path");return f.setAttribute("fill",i),f.setAttribute("fill-opacity",String(n)),f.setAttribute("stroke-opacity",String(o)),f.setAttribute("stroke",a),f.setAttribute("stroke-width",String(c)),f.setAttribute("transform",`rotate(${h}) scale(${l})`),f.setAttribute("d",this.getPath(1).toSVG()),d.appendChild(f),d}};import"ag-charts-core";import*as gs from"ag-charts-core";var{isArray:zr,isObject:Te}=gs;function Pi(e){return Te(e)&&e.type=="gradient"}function Ai(e){return e!==null&&Te(e)&&e.type=="pattern"}function ki(e){return e!==null&&Te(e)&&e.type=="image"}var _=class extends Ft{constructor(){super(...arguments),this.fillOpacity=1,this.strokeOpacity=1,this.fill="black",this.strokeWidth=0,this.lineDashOffset=0,this.opacity=1}getGradient(e){if(Pi(e))return this.createGradient(e)}createGradient(e){const{colorSpace:t="rgb",gradient:i="linear",colorStops:n,rotation:s=0,reverse:r=!1}=e;if(n==null)return;let a=Jn(n,["black"],[0,1]);switch(r&&(a=a.map(c=>({color:c.color,stop:1-c.stop})).reverse()),i){case"linear":return new Hn(t,a,s);case"radial":return new jn(t,a);case"conic":return new qn(t,a,s)}}getPattern(e){if(Ai(e))return this.createPattern(e)}createPattern(e){return new ps(e)}getImage(e){if(ki(e))return this.createImage(e)}createImage(e){return new Qn(this.imageLoader,e)}onFillChange(){typeof this.fill=="object"&&ht(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(e,t){return B(this.layerManager?.canvas?.pixelRatio??1,e,t)}markDirty(e){super.markDirty(e),this.cachedDefaultGradientFillBBox=void 0}fillStroke(e,t){this.renderFill(e,t),this.renderStroke(e,t)}renderFill(e,t){const{fill:i,fillImage:n}=this;if(i&&i!=="none"){const{globalAlpha:s}=e;n&&(e.globalAlpha=n.backgroundFillOpacity,e.fillStyle=n.backgroundFill,this.executeFill(e,t),e.globalAlpha=s),this.applyFillAndAlpha(e),this.applyShadow(e),this.executeFill(e,t),e.globalAlpha=s}e.shadowColor="rgba(0, 0, 0, 0)"}executeFill(e,t){t?e.fill(t):e.fill()}applyFillAndAlpha(e){const{fill:t,fillGradient:i,fillPattern:n,fillImage:s,fillOpacity:r=1,opacity:a=1}=this;if(e.globalAlpha*=a*r,i){const{fillBBox:c=this.getDefaultGradientFillBBox()??this.getBBox(),fillParams:o}=this;e.fillStyle=i.createGradient(e,c,o)??"black"}else if(n){const{x:c,y:o}=this.getBBox(),h=this.layerManager?.canvas?.pixelRatio??1,l=n.createPattern(e,h);n.setPatternTransform(l,h,c,o),l?e.fillStyle=l:(e.fillStyle=n.fill,e.globalAlpha*=n.fillOpacity)}else if(s){const c=this.getBBox(),o=s.createPattern(e,c.width,c.height,this);s.setImageTransform(o,c),e.fillStyle=o??"transparent"}else e.fillStyle=typeof t=="string"?t:"black"}applyStrokeAndAlpha(e){const{stroke:t,strokeOpacity:i=1,strokeGradient:n,opacity:s=1}=this;e.strokeStyle=n?.createGradient(e,this.getBBox())??(typeof t=="string"?t:void 0)??"black",e.globalAlpha*=s*i}applyShadow(e){const t=this.layerManager?.canvas.pixelRatio??1,i=this.fillShadow;i?.enabled&&(e.shadowColor=i.color,e.shadowOffsetX=i.xOffset*t,e.shadowOffsetY=i.yOffset*t,e.shadowBlur=i.blur*t)}renderStroke(e,t){const{stroke:i,strokeWidth:n,lineDash:s,lineDashOffset:r,lineCap:a,lineJoin:c,miterLimit:o}=this;if(i&&n){const{globalAlpha:h}=e;this.applyStrokeAndAlpha(e),e.lineWidth=n,s&&e.setLineDash(s),r&&(e.lineDashOffset=r),a&&(e.lineCap=a),c&&(e.lineJoin=c),o!=null&&(e.miterLimit=o),this.executeStroke(e,t),e.globalAlpha=h}}executeStroke(e,t){t?e.stroke(t):e.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox==null&&(this.cachedDefaultGradientFillBBox=Object.freeze(this.computeDefaultGradientFillBBox())),this.cachedDefaultGradientFillBBox}computeDefaultGradientFillBBox(){}containsPoint(e,t){return this.isPointInPath(e,t)}applySvgFillAttributes(e,t){const{fill:i,fillOpacity:n}=this;if(typeof i=="string")e.setAttribute("fill",i);else if(Pi(i)&&this.fillGradient){t??(t=[]);const s=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),r=fe();s.setAttribute("id",r),t.push(s),e.setAttribute("fill",`url(#${r})`)}else if(Ai(i)&&this.fillPattern){t??(t=[]);const s=this.fillPattern.toSvg(),r=fe();s.setAttribute("id",r),t.push(s),e.setAttribute("fill",`url(#${r})`)}else if(ki(i)&&this.fillImage){t??(t=[]);const s=this.layerManager?.canvas?.pixelRatio??1,r=this.fillImage.toSvg(this.getBBox(),s),a=fe();r.setAttribute("id",a),t.push(r),e.setAttribute("fill",`url(#${a})`)}else e.setAttribute("fill","none");return e.setAttribute("fill-opacity",String(n)),t}applySvgStrokeAttributes(e){const{stroke:t,strokeOpacity:i,strokeWidth:n,lineDash:s,lineDashOffset:r}=this;if(t!=null&&(e.setAttribute("stroke",typeof t=="string"?t:"none"),e.setAttribute("stroke-opacity",String(i)),e.setAttribute("stroke-width",String(n))),s?.some(a=>a!==0)===!0){const a=s.length%2===1?[...s,...s]:s;e.setAttribute("stroke-dasharray",a.join(" ")),e.setAttribute("stroke-dashoffset",String(r))}}};b([M()],_.prototype,"fillOpacity",2),b([M()],_.prototype,"strokeOpacity",2),b([tt({equals:ht,changeCb:e=>e.onFillChange()})],_.prototype,"fill",2),b([tt({equals:ht,changeCb:e=>e.onStrokeChange()})],_.prototype,"stroke",2),b([M()],_.prototype,"strokeWidth",2),b([gn()],_.prototype,"lineDash",2),b([M()],_.prototype,"lineDashOffset",2),b([M()],_.prototype,"lineCap",2),b([M()],_.prototype,"lineJoin",2),b([M()],_.prototype,"miterLimit",2),b([M({convertor:e=>Ln(0,e??1,1)})],_.prototype,"opacity",2),b([tt({equals:oe,checkDirtyOnAssignment:!0})],_.prototype,"fillShadow",2),b([tt({equals:En,changeCb:e=>e.onFillChange()})],_.prototype,"fillBBox",2),b([tt({equals:ht,changeCb:e=>e.onFillChange()})],_.prototype,"fillParams",2);import{createSvgElement as ms}from"ag-charts-core";import{isNumberEqual as mt}from"ag-charts-core";var Di=[1,0,0,1,0,0],dt=class ne{get e(){return[...this.elements]}constructor(t=Di){this.elements=[...t]}setElements(t){const i=this.elements;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],this}get identity(){const t=this.elements;return mt(t[0],1)&&mt(t[1],0)&&mt(t[2],0)&&mt(t[3],1)&&mt(t[4],0)&&mt(t[5],0)}AxB(t,i,n){const s=t[0]*i[0]+t[2]*i[1],r=t[1]*i[0]+t[3]*i[1],a=t[0]*i[2]+t[2]*i[3],c=t[1]*i[2]+t[3]*i[3],o=t[0]*i[4]+t[2]*i[5]+t[4],h=t[1]*i[4]+t[3]*i[5]+t[5];n=n??t,n[0]=s,n[1]=r,n[2]=a,n[3]=c,n[4]=o,n[5]=h}multiplySelf(t){return this.AxB(this.elements,t.elements),this}multiply(t){const i=new Array(6);return t instanceof ne?this.AxB(this.elements,t.elements,i):this.AxB(this.elements,[t.a,t.b,t.c,t.d,t.e,t.f],i),new ne(i)}preMultiplySelf(t){return this.AxB(t.elements,this.elements,this.elements),this}inverse(){const t=this.elements;let i=t[0],n=t[1],s=t[2],r=t[3];const a=t[4],c=t[5],o=1/(i*r-n*s);return i*=o,n*=o,s*=o,r*=o,new ne([r,-n,-s,i,s*c-r*a,n*a-i*c])}invertSelf(){const t=this.elements;let i=t[0],n=t[1],s=t[2],r=t[3];const a=t[4],c=t[5],o=1/(i*r-n*s);return i*=o,n*=o,s*=o,r*=o,t[0]=r,t[1]=-n,t[2]=-s,t[3]=i,t[4]=s*c-r*a,t[5]=n*a-i*c,this}transformPoint(t,i){const n=this.elements;return{x:t*n[0]+i*n[2]+n[4],y:t*n[1]+i*n[3]+n[5]}}transformBBox(t,i){const n=this.elements,s=n[0],r=n[1],a=n[2],c=n[3],o=t.width*.5,h=t.height*.5,l=t.x+o,d=t.y+h,u=Math.abs(o*s)+Math.abs(h*a),f=Math.abs(o*r)+Math.abs(h*c);return i??(i=new W(0,0,0,0)),i.x=l*s+d*a+n[4]-u,i.y=l*r+d*c+n[5]-f,i.width=u+u,i.height=f+f,i}toContext(t){if(this.identity)return;const i=this.elements;t.transform(i[0],i[1],i[2],i[3],i[4],i[5])}static updateTransformMatrix(t,i,n,s,r,a,c){const o=i,h=n;let l,d;o===1&&h===1?(l=0,d=0):(l=c?.scalingCenterX??0,d=c?.scalingCenterY??0);const u=s,f=Math.cos(u),p=Math.sin(u);let y,g;u===0?(y=0,g=0):(y=c?.rotationCenterX??0,g=c?.rotationCenterY??0);const m=r,x=a,w=l*(1-o)-y,P=d*(1-h)-g;return t.setElements([f*o,p*o,-p*h,f*h,f*w-p*P+y+m,p*w+f*P+g+x]),t}};function st(e){return Ti(e.constructor)}var Fi=Symbol("isMatrixTransform");function Ti(e){return e[Fi]===!0}function Re(e){var t,i;const n=e;if(Ti(e))return e;const s=Symbol("matrix_combined_transform");class r extends n{constructor(){super(...arguments),this[i]=new dt,this._dirtyTransform=!0}onChangeDetection(c){super.onChangeDetection(c),this._dirtyTransform=!0,!(this.batchLevel>0)&&this.markDirty("transform")}updateMatrix(c){}computeTransformMatrix(){this._dirtyTransform&&(this[s].setElements(Di),this.updateMatrix(this[s]),this._dirtyTransform=!1)}toParent(c){return this.computeTransformMatrix(),this[s].identity?c.clone():this[s].transformBBox(c)}toParentPoint(c,o){return this.computeTransformMatrix(),this[s].identity?{x:c,y:o}:this[s].transformPoint(c,o)}fromParent(c){return this.computeTransformMatrix(),this[s].identity?c.clone():this[s].inverse().transformBBox(c)}fromParentPoint(c,o){return this.computeTransformMatrix(),this[s].identity?{x:c,y:o}:this[s].inverse().transformPoint(c,o)}computeBBox(){const c=super.computeBBox();return c&&this.toParent(c)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(c,o){return{x:c,y:o}=this.fromParentPoint(c,o),super.pickNode(c,o)}pickNodes(c,o,h){return{x:c,y:o}=this.fromParentPoint(c,o),super.pickNodes(c,o,h)}render(c){this.computeTransformMatrix();const{ctx:o}=c,h=this[s];let l=!1;try{h.identity||(o.save(),l=!0,h.toContext(o)),super.render(c)}finally{l&&o.restore()}}toSVG(){this.computeTransformMatrix();const c=super.toSVG(),o=this[s];if(o.identity||c==null)return c;const h=ms("g");h.append(...c.elements);const[l,d,u,f,p,y]=o.e;return h.setAttribute("transform",`matrix(${l} ${d} ${u} ${f} ${p} ${y})`),{elements:[h],defs:c.defs}}}return t=Fi,i=s,r[t]=!0,r}function Rt(e){var t;const i=e,n=Symbol("matrix_rotation");class s extends Re(i){constructor(){super(...arguments),this[t]=new dt,this.rotationCenterX=0,this.rotationCenterY=0,this.rotation=0}updateMatrix(a){super.updateMatrix(a);const{rotation:c,rotationCenterX:o,rotationCenterY:h}=this;c!==0&&(dt.updateTransformMatrix(this[n],1,1,c,0,0,{rotationCenterX:o,rotationCenterY:h}),a.multiplySelf(this[n]))}}return t=n,b([M()],s.prototype,"rotationCenterX",2),b([M()],s.prototype,"rotationCenterY",2),b([M()],s.prototype,"rotation",2),s}function Ri(e){var t;const i=e,n=Symbol("matrix_scale");class s extends Re(i){constructor(){super(...arguments),this[t]=new dt,this.scalingX=1,this.scalingY=1,this.scalingCenterX=0,this.scalingCenterY=0}updateMatrix(a){super.updateMatrix(a);const{scalingX:c,scalingY:o,scalingCenterX:h,scalingCenterY:l}=this;c===1&&o===1||(dt.updateTransformMatrix(this[n],c,o,0,0,0,{scalingCenterX:h,scalingCenterY:l}),a.multiplySelf(this[n]))}}return t=n,b([M()],s.prototype,"scalingX",2),b([M()],s.prototype,"scalingY",2),b([M()],s.prototype,"scalingCenterX",2),b([M()],s.prototype,"scalingCenterY",2),s}function $t(e){var t;const i=e,n=Symbol("matrix_translation");class s extends Re(i){constructor(){super(...arguments),this[t]=new dt,this.translationX=0,this.translationY=0}updateMatrix(a){super.updateMatrix(a);const{translationX:c,translationY:o}=this;c===0&&o===0||(dt.updateTransformMatrix(this[n],1,1,0,c,o),a.multiplySelf(this[n]))}}return t=n,b([M()],s.prototype,"translationX",2),b([M()],s.prototype,"translationY",2),s}var yt=class{static fromCanvas(e,t){const i=[];for(const n of e.traverseUp())st(n)&&i.unshift(n);for(const n of i)t=n.fromParent(t);return st(e)&&(t=e.fromParent(t)),t}static toCanvas(e,t){t==null?t=e.getBBox():st(e)&&(t=e.toParent(t));for(const i of e.traverseUp())st(i)&&(t=i.toParent(t));return t}static fromCanvasPoint(e,t,i){const n=[];for(const s of e.traverseUp())st(s)&&n.unshift(s);for(const s of n)({x:t,y:i}=s.fromParentPoint(t,i));return st(e)&&({x:t,y:i}=e.fromParentPoint(t,i)),{x:t,y:i}}static toCanvasPoint(e,t,i){st(e)&&({x:t,y:i}=e.toParentPoint(t,i));for(const n of e.traverseUp())st(n)&&({x:t,y:i}=n.toParentPoint(t,i));return{x:t,y:i}}},It,Ie=class Et extends Ft{constructor(t){super(t),this.childNodes=new Set,this.dirty=!1,this.dirtyZIndex=!1,this.clipRect=void 0,this.opacity=1,this.renderToOffscreenCanvas=!1,this.optimizeForInfrequentRedraws=!1,this.layer=void 0,this.image=void 0,this._lastWidth=NaN,this._lastHeight=NaN,this._lastDevicePixelRatio=NaN,this.isContainerNode=!0,this.renderToOffscreenCanvas=t?.renderToOffscreenCanvas===!0}static is(t){return t instanceof Et}static computeChildrenBBox(t,i=!0){return W.merge(Ft.extractBBoxes(t,i))}static compareChildren(t,i){return vn(t.zIndex,i.zIndex)||t.serialNumber-i.serialNumber}containsPoint(t,i){return!0}computeBBox(){return Et.computeChildrenBBox(this.children())}computeSafeClippingBBox(t){const i=this.computeBBox();if(i?.isFinite()!==!0)return;let n=0;const s=4;for(const u of this.descendants())u instanceof _&&(n=Math.max(n,u.strokeWidth));const r=Math.max(1,n/2*s),{x:a,y:c}=yt.toCanvasPoint(this,0,0),o=Ci(t,a+i.x-r)-a,h=Ci(t,c+i.y-r)-c,l=Math.ceil(i.x+i.width-o+r),d=Math.ceil(i.y+i.height-h+r);return new W(o,h,l,d)}prepareSharedCanvas(t,i,n){return It==null||It.pixelRatio!==n?It=new de({width:t,height:i,pixelRatio:n}):It.resize(t,i,n),It}setScene(t){super.setScene(t),this.layer&&(this.scene?.layersManager.removeLayer(this.layer),this.layer=void 0);for(const i of this.children())i.setScene(t)}markDirty(t){this.dirty=!0,super.markDirty(t)}markDirtyChildrenOrder(){super.markDirtyChildrenOrder(),this.dirtyZIndex=!0,this.markDirty()}append(t){for(const i of Nn(t))i.parentNode?.removeChild(i),this.childNodes.add(i),i.parentNode=this,i.setScene(this.scene);this.markDirtyChildrenOrder(),this.markDirty()}appendChild(t){return this.append(t),t}removeChild(t){if(!this.childNodes?.delete(t))throw new Error(`AG Charts - internal error, unknown child node ${t.name??t.id} in $${this.name??this.id}`);t.parentNode=void 0,t.setScene(),this.markDirtyChildrenOrder(),this.markDirty()}clear(){for(const t of this.children())delete t.parentNode,t.setScene();this.childNodes?.clear(),this.markDirty()}pickNode(t,i){if(!(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))){if(this.childNodes!=null&&this.childNodes.size!==0){const n=[...this.children()];for(let s=n.length-1;s>=0;s--){const a=n[s].pickNode(t,i);if(a!=null)return a}}else if(!this.isContainerNode)return this}}pickNodes(t,i,n=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return n;this.isContainerNode||n.push(this);for(const s of this.children())s.pickNodes(t,i,n);return n}isDirty(t){const{width:i,height:n,devicePixelRatio:s}=t,{dirty:r,layer:a}=this,c=a!=null&&(this._lastWidth!==i||this._lastHeight!==n),o=this._lastDevicePixelRatio!==s;return this._lastWidth=i,this._lastHeight=n,this._lastDevicePixelRatio=s,r||c||o}preRender(t){let i;if(this.dirty){i=super.preRender(t,0);for(const n of this.children()){const s=n.preRender(t);i.groups+=s.groups,i.nonGroups+=s.nonGroups,i.complexity+=s.complexity}i.groups+=1,i.nonGroups-=1}else i=this.childNodeCounts;return this.renderToOffscreenCanvas&&!this.optimizeForInfrequentRedraws&&i.nonGroups>0&&this.getVisibility()?this.layer??(this.layer=this.layerManager?.addLayer({name:this.name})):this.layer!=null&&(this.layerManager?.removeLayer(this.layer),this.layer=void 0),i}render(t){const{layer:i,renderToOffscreenCanvas:n}=this,s={...t},r=this.isDirty(t);if(this.dirty=!1,!n){this.renderInContext(s),super.render(s);return}const{ctx:a,stats:c,devicePixelRatio:o}=t;let{image:h}=this;if(r){h?.bitmap.close(),h=void 0;const d=i?void 0:this.computeSafeClippingBBox(o),u=(f,...p)=>{const y=f.context;s.ctx=y,f.clear(),y.save();try{y.setTransform(...p),y.globalAlpha=1,this.renderInContext(s)}finally{y.restore(),y.verifyDepthZero?.()}};if(i)u(i,a.getTransform());else if(d){const{x:f,y:p,width:y,height:g}=d,m=this.prepareSharedCanvas(y,g,o);u(m,o,0,0,o,-f*o,-p*o),h={bitmap:m.transferToImageBitmap(),x:f,y:p,width:y,height:g}}this.image=h,c&&c.layersRendered++}else c&&c.layersSkipped++;const{globalAlpha:l}=a;if(a.globalAlpha=l*this.opacity,i){a.save();try{a.resetTransform(),i.drawImage(a)}finally{a.restore()}}else if(h){const{bitmap:d,x:u,y:f,width:p,height:y}=h;a.drawImage(d,0,0,p*o,y*o,u,f,p,y)}a.globalAlpha=l,super.render(s)}applyClip(t,i){const{x:n,y:s,width:r,height:a}=i;t.beginPath(),t.rect(n,s,r,a),t.clip()}renderInContext(t){const{ctx:i,stats:n}=t;this.dirtyZIndex&&(this.sortChildren(Et.compareChildren),this.dirtyZIndex=!1),i.save();try{i.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(i,this.clipRect),t.clipBBox=yt.toCanvas(this,this.clipRect));for(const s of this.children()){if(!s.visible){n&&(n.nodesSkipped+=s.childNodeCounts.nonGroups+s.childNodeCounts.groups,n.opsSkipped+=s.childNodeCounts.complexity);continue}s.isolatedRender(t)}}finally{i.restore()}}sortChildren(t){if(!this.childNodes)return;const i=[...this.childNodes].sort(t);this.childNodes.clear();for(const n of i)this.childNodes.add(n)}*children(){yield*this.childNodes}*descendants(){for(const t of this.children())yield t,t instanceof Et&&(yield*t.descendants())}setClipRect(t){this.clipRect=t?yt.fromCanvas(this,t):void 0}setClipRectCanvasSpace(t){this.clipRect=t}getVisibility(){for(const t of this.traverseUp(!0))if(!t.visible)return!1;return!0}toSVG(){if(!this.visible)return;const t=[],i=[];for(const n of this.children()){const s=n.toSVG();s!=null&&(i.push(...s.elements),s.defs!=null&&t.push(...s.defs))}return{elements:i,defs:t}}};Ie.className="Group",b([M({convertor:e=>On(0,e,1)})],Ie.prototype,"opacity",2);var U=Ie,Wr=class extends Ri(U){},Hr=class extends Rt(U){},ys=class extends $t(U){},$r=class extends Rt($t(U)){};function bs(e){for(const t of["B","KB","MB","GB"]){if(e<1536)return`${e.toFixed(1)}${t}`;e/=1024}return`${e.toFixed(1)}TB}`}function xs(){if(!("memory"in performance))return;const{totalJSHeapSize:e,usedJSHeapSize:t,jsHeapSizeLimit:i}=performance.memory,n=[];for(const s of[t,e,i])typeof s=="number"&&n.push(bs(s));return`Heap ${n.join(" / ")}`}function Ii(e,t,i,n,s={},r=W.zero){if(!j.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:a=0,layersSkipped:c=0,nodesRendered:o=0,nodesSkipped:h=0,opsPerformed:l=0,opsSkipped:d=0}=n??{},u=performance.now(),{start:f,...p}=t,y=Object.entries(p).map(([C,D])=>Ni(C,D)).filter(C=>C!=null).join(" + "),g=Object.entries(s).map(([C,D])=>`${C}: ${JSON.stringify(D)}`).join(" ; "),m=j.check("scene:stats:verbose"),x=xs(),w=[`${Ni("\u23F1\uFE0F",f,u)} (${y})`,`${g}`,`Layers: ${m?Oe(a,c):e.size}`,m?`Nodes: ${Oe(o,h)}`:null,m?`Ops: ${Oe(l,d)}`:null,m&&x?x:null].filter(Rn),P=new ri(C=>i.measureText(C)),k=new Map(w.map(C=>[C,P.measureLines(C)])),A=Math.max(...Array.from(k.values(),C=>C.width)),v=Ps(k.values(),C=>C.height),S=2+r.x;i.save();try{i.fillStyle="white",i.fillRect(S,0,A,v),i.fillStyle="black";let C=0;for(const[D,R]of k.entries())C+=R.height,i.fillText(D,S,C)}catch(C){ue.warnOnce("Error during debug stats rendering",C)}finally{i.restore()}}function Ms(e){const t=In(Tn("agChartsSceneDebug")),i=[];for(const n of t)n==="layout"?i.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):i.push(n);e.debugNodeSearch=i}function vs(e,t){e.save();try{for(const[i,n]of Object.entries(t)){const s=yt.toCanvas(n);if(!s){ue.log(`Scene.render() - no bbox for debugged node [${i}].`);continue}e.globalAlpha=.8,e.strokeStyle="red",e.lineWidth=1,e.strokeRect(s.x,s.y,s.width,s.height),e.fillStyle="red",e.strokeStyle="white",e.font="16px sans-serif",e.textBaseline="top",e.textAlign="left",e.lineWidth=2,e.strokeText(i,s.x,s.y,s.width),e.fillText(i,s.x,s.y,s.width)}}catch(i){ue.warnOnce("Error during debug rendering",i)}finally{e.restore()}}var Ss=new Set,Cs=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function ws(e){const{...t}=e;for(const i of Object.keys(t))Cs.has(i)||typeof t[i]!="number"&&typeof t[i]!="string"&&typeof t[i]!="boolean"&&(Ss.add(i),delete t[i]);return t}function jt(e,t){if(!j.check(!0,"scene"))return{};let i=0;return{node:t==="json"?ws(e):e,name:e.name??e.id,dirty:e instanceof U?e.dirty:void 0,...Array.from(e instanceof U?e.children():[],n=>jt(n,t)).reduce((n,s)=>{let{name:r}=s;const{node:{visible:a,opacity:c,zIndex:o,translationX:h,translationY:l,rotation:d,scalingX:u,scalingY:f},node:p}=s;(!a||c<=0)&&(r=`(${r})`),U.is(p)&&p.renderToOffscreenCanvas&&(r=`*${r}*`);const y=Array.isArray(o)?`(${o.join(", ")})`:o,g=[`${(i++).toString().padStart(3,"0")}|`,`${r??"<unknown>"}`,`z: ${y}`,h&&`x: ${h}`,l&&`y: ${l}`,d&&`r: ${d}`,u!=null&&u!==1&&`sx: ${u}`,f!=null&&f!==1&&`sy: ${f}`].filter(w=>!!w).join(" ");let m=g,x=1;for(;n[m]!=null&&x<100;)m=`${g} (${x++})`;return n[m]=s,n},{})}}function Oi(e){const t=e instanceof U?e.dirty:void 0;if(!t)return{dirtyTree:{},paths:[]};const i=Array.from(e instanceof U?e.children():[],r=>Oi(r)).filter(r=>r.paths.length>0),n=U.is(e)?e.name??e.id:e.id,s=i.length?i.flatMap(r=>r.paths).map(r=>`${n}.${r}`):[n];return{dirtyTree:{name:n,node:e,dirty:t,...i.map(r=>r.dirtyTree).filter(r=>r.dirty!=null).reduce((r,a)=>(r[a.name??"<unknown>"]=a,r),{})},paths:s}}function Oe(e,t){const i=e+t;return`${e} / ${i} (${Math.round(100*e/i)}%)`}function Ni(e,t,i){const n=i!=null?i-t:t;return`${e}: ${Math.round(n*100)/100}ms`}function Ps(e,t){let i=0;for(const n of e)i+=t(n);return i}var Ne=!1,X=class Lt extends _{constructor(){super(...arguments),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontSize=Lt.defaultFontSize,this.fontFamily="sans-serif",this.textAlign="start",this.textBaseline="alphabetic"}onTextChange(){this.lines=this.text?.split(`
`).map(t=>t.trim())??[]}static computeBBox(t,i,n,s,r=!0){const{font:a,font:{fontSize:c},textAlign:o,textBaseline:h="alphabetic",lineHeight:l=r?L.getLineHeight(c):void 0}=s,{width:d,alphabeticBaseline:u,offsetLeft:f,offsetTop:p,height:y}=le.measureLines(t,r?{font:a,lineHeight:l,textAlign:"start",textBaseline:"top"}:s),g=l==null?y:l*t.length;let m;l==null?m=p:h==="alphabetic"?m=(l-c)/2-u:m=L.getVerticalModifier(h)*g;const x=r?d*L.getHorizontalModifier(o):f;return new W(i-x,n-m,d,g)}computeBBox(t=Ne){const{x:i,y:n,lines:s,textBaseline:r,textAlign:a,lineHeight:c}=this;return Lt.computeBBox(s,i,n,{font:this,textBaseline:r,textAlign:a,lineHeight:c},t)}getBBox(t=!0){if(t){Ne=!0;const i=this.computeBBox(!0);return Ne=!1,i}return super.getBBox()}getTextMeasureBBox(){return this.computeBBox()}isPointInPath(t,i){const n=this.getBBox();return n?n.containsPoint(t,i):!1}render(t){const{ctx:i,stats:n}=t;if(!this.lines.length||!this.layerManager)return n&&(n.nodesSkipped+=1),super.render(t);const{fill:s,stroke:r,strokeWidth:a}=this,{globalAlpha:c}=i,{pixelRatio:o}=this.layerManager.canvas;if(!s&&!(r!=null&&a>0))return super.render(t);const h=L.toFontString(this);i.font!==h&&(i.font=h);const{fontSize:l,lineHeight:d=L.getLineHeight(l),textAlign:u,textBaseline:f}=this,p=this.lines.length,y=f==="alphabetic"?0:-L.getVerticalModifier(f)*d*(p-1);if(i.textAlign=u,i.textBaseline=f,s){this.applyFillAndAlpha(i);const{fillShadow:g}=this;g?.enabled&&(i.shadowColor=g.color,i.shadowOffsetX=g.xOffset*o,i.shadowOffsetY=g.yOffset*o,i.shadowBlur=g.blur*o),this.renderLines(y,d,(m,x,w)=>i.fillText(m,x,w)),i.globalAlpha=c}if(r&&a){this.applyStrokeAndAlpha(i),i.lineWidth=a;const{lineDash:g,lineDashOffset:m,lineCap:x,lineJoin:w}=this;g&&i.setLineDash([...g]),m&&(i.lineDashOffset=m),x&&(i.lineCap=x),w&&(i.lineJoin=w),this.renderLines(y,d,(P,k,A)=>i.strokeText(P,k,A)),i.globalAlpha=c}if(Lt.debug.check()){const g=this.getBBox(!0);i.strokeStyle="red",i.lineWidth=1,i.strokeRect(g.x,g.y,g.width,g.height)}super.render(t)}renderLines(t,i,n){const{lines:s,x:r,y:a}=this;if(!(!Number.isFinite(r)||!Number.isFinite(a)||!Number.isFinite(t)||!Number.isFinite(i)))for(const c of s)n(c,r,a+t),t+=i}setFont(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize??Lt.defaultFontSize,this.fontStyle=t.fontStyle,this.fontWeight=t.fontWeight}setAlign(t){this.textAlign=t.textAlign,this.textBaseline=t.textBaseline}toSVG(){if(!this.visible||!this.text)return;const t=Cn("text");return this.applySvgFillAttributes(t),t.setAttribute("font-family",this.fontFamily?.split(",")[0]??""),t.setAttribute("font-size",String(this.fontSize)),t.setAttribute("font-style",this.fontStyle??""),t.setAttribute("font-weight",String(this.fontWeight??"")),t.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),t.setAttribute("alignment-baseline",{alphabetic:"alphabetic",top:"top",bottom:"bottom",hanging:"hanging",middle:"middle",ideographic:"ideographic"}[this.textBaseline??"alphabetic"]),t.setAttribute("x",String(this.x)),t.setAttribute("y",String(this.y)),t.textContent=this.text??"",{elements:[t]}}};X.className="Text",X.debug=j.create(!0,"scene:text"),X.defaultFontSize=10,b([M()],X.prototype,"x",2),b([M()],X.prototype,"y",2),b([M({convertor:e=>wn(e)?String(e):e,changeCb:e=>e.onTextChange()})],X.prototype,"text",2),b([M()],X.prototype,"fontStyle",2),b([M()],X.prototype,"fontWeight",2),b([M()],X.prototype,"fontSize",2),b([M()],X.prototype,"fontFamily",2),b([M()],X.prototype,"textAlign",2),b([M()],X.prototype,"textBaseline",2),b([M()],X.prototype,"lineHeight",2);var Ei=X,As=class extends Rt(Ei){},jr=class extends Rt($t(Ei)){};import"ag-charts-core";function rt(e,t){return on((i,n,s)=>i[e][t??n]=s)}function ks(e){return cn(e)}var Ds=class{static wrapText(e,t){return this.wrapLines(e,t).join(`
`)}static wrapLines(e,t){const i=this.textWrap(e,t);return t.overflow==="hide"&&i.some(n=>n.endsWith(L.EllipsisChar))?[]:i}static appendEllipsis(e){return e.replace(/[.,]{1,5}$/,"")+L.EllipsisChar}static truncateLine(e,t,i,n){const s=t.textWidth(L.EllipsisChar);let r=0,a=0;for(;a<e.length;a++){const c=t.textWidth(e.charAt(a));if(r+c>i)break;r+=c}if(e.length===a&&(!n||r+s<=i))return n?e+L.EllipsisChar:e;for(e=e.slice(0,a).trimEnd();e.length&&t.textWidth(e)+s>i;)e=e.slice(0,-1).trimEnd();return e+L.EllipsisChar}static textWrap(e,t){const i=e.split(L.lineSplitter),n=le.getMeasurer(t);if(t.textWrap==="never")return i.map(c=>this.truncateLine(c.trimEnd(),n,t.maxWidth));const s=[],r=t.textWrap==="hyphenate",a=t.textWrap==null||t.textWrap==="on-space";for(const c of i){let o=c.trimEnd();if(o===""){s.push(o);continue}let h=0,l=0,d=0;for(;h<o.length;){const u=o.charAt(h);if(l+=n.textWidth(u),u===" "&&(d=h),l>t.maxWidth){if(h===0)break;const f=n.textWidth(o.slice(0,h+1));if(f<=t.maxWidth){l=f,h++;continue}if(d){const g=this.getWordAt(o,d+1),m=n.textWidth(g);if(m<=t.maxWidth){s.push(o.slice(0,d).trimEnd()),o=o.slice(d).trimStart(),h=0,l=0,d=0;continue}else a&&m>t.maxWidth&&s.push(o.slice(0,d).trimEnd(),this.truncateLine(o.slice(d).trimStart(),n,t.maxWidth,!0))}else a&&s.push(this.truncateLine(o,n,t.maxWidth,!0));if(a){o="";break}const p=r?"-":"";let y=o.slice(0,h).trim();for(;y.length&&n.textWidth(y+p)>t.maxWidth;)y=y.slice(0,-1).trimEnd();if(s.push(y+p),!y.length){o="";break}o=o.slice(y.length).trimStart(),h=-1,l=0,d=0}h++}o&&s.push(o)}return this.avoidOrphans(s,n,t),this.clipLines(s,n,t)}static getWordAt(e,t){const i=e.indexOf(" ",t);return i===-1?e.slice(t):e.slice(t,i)}static clipLines(e,t,i){if(!i.maxHeight)return e;const{height:n,lineMetrics:s}=t.measureLines(e);if(n<=i.maxHeight)return e;for(let r=0,a=0;r<s.length;r++){const{lineHeight:c}=s[r];if(a+=c,a>i.maxHeight){if(i.overflow==="hide")return[];const o=e.slice(0,r||1),h=o.pop();return o.concat(this.truncateLine(h,t,i.maxWidth,!0))}}return e}static avoidOrphans(e,t,i){if(i.avoidOrphans===!1||e.length<2)return;const{length:n}=e,s=e[n-1],r=e[n-2];if(r.length<s.length)return;const a=r.lastIndexOf(" ");if(a===-1||a===r.indexOf(" ")||s.includes(" "))return;const c=r.slice(a+1);t.textWidth(s+c)<=i.maxWidth&&(e[n-2]=r.slice(0,a),e[n-1]=c+" "+s)}},$=class extends Ce{constructor(){super(...arguments),this.id=en(this),this.node=new As({zIndex:1}).setProperties({textAlign:"center",pointerEvents:1}),this.enabled=!1,this.textAlign="center",this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always",this.padding=0,this.layoutStyle="block",this.truncated=!1}registerInteraction(e,t){return e.eventsHub.on("layout:complete",()=>this.updateA11yText(e,t))}computeTextWrap(e,t){const{text:i,padding:n,wrapping:s}=this,r=Math.min(this.maxWidth??1/0,e)-n*2,a=this.maxHeight??t-n*2;if(!isFinite(r)&&!isFinite(a)){this.node.text=i;return}const c=Ds.wrapText(i??"",{maxWidth:r,maxHeight:a,font:this,textWrap:s});this.node.text=c,this.truncated=c.includes(L.EllipsisChar)}updateA11yText(e,t){const{proxyInteractionService:i}=e;if(this.enabled&&this.text){const n=yt.toCanvas(this.node);if(n){const{id:s}=this;this.proxyText??(this.proxyText=i.createProxyElement({type:"text",domManagerId:s,where:t})),this.proxyText.textContent=this.text,this.proxyText.setBounds(n),this.proxyText.addListener("mousemove",r=>this.handleMouseMove(e,r)),this.proxyText.addListener("mouseleave",r=>this.handleMouseLeave(e,r))}}else this.proxyText?.destroy(),this.proxyText=void 0}handleMouseMove(e,t){if(t!=null&&this.enabled&&this.node.visible&&this.truncated){const{x:i,y:n}=yt.toCanvas(this.node),s=t.sourceEvent.offsetX+i,r=t.sourceEvent.offsetY+n;e.tooltipManager.updateTooltip(this.id,{canvasX:s,canvasY:r,showArrow:!1},[{type:"structured",title:this.text}])}}handleMouseLeave(e,t){e.tooltipManager.removeTooltip(this.id)}};$.SMALL_PADDING=10,b([H,rt("node","visible")],$.prototype,"enabled",2),b([H,rt("node")],$.prototype,"text",2),b([H,rt("node")],$.prototype,"textAlign",2),b([H,rt("node")],$.prototype,"fontStyle",2),b([H,rt("node")],$.prototype,"fontWeight",2),b([H,rt("node")],$.prototype,"fontSize",2),b([H,rt("node")],$.prototype,"fontFamily",2),b([H,rt("node","fill")],$.prototype,"color",2),b([H],$.prototype,"spacing",2),b([H],$.prototype,"maxWidth",2),b([H],$.prototype,"maxHeight",2),b([H],$.prototype,"wrapping",2),b([H],$.prototype,"padding",2),b([H],$.prototype,"layoutStyle",2);import{createSvgElement as Fs}from"ag-charts-core";var Z=class extends _{constructor(){super(...arguments),this.path=new Tt,this._clipX=NaN,this._clipY=NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=NaN}set clipX(e){this._clipX=e,this.dirtyPath=!0}set clipY(e){this._clipY=e,this.dirtyPath=!0}set dirtyPath(e){this._dirtyPath!==e&&(this._dirtyPath=e,e&&this.markDirty("path"))}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}resetPathDirty(){this.path.clear(!0),this._dirtyPath=!1}isPathDirty(){return this.path.isDirty()}onChangeDetection(e){this._dirtyPath||(this._dirtyPath=!0,super.onChangeDetection(e))}computeBBox(){return this.updatePathIfDirty(),this.path.computeBBox()}isPointInPath(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)}distanceSquared(e,t){return this.distanceSquaredTransformedPoint(e,t)}svgPathData(e){return this.updatePathIfDirty(),this.path.toSVG(e)}distanceSquaredTransformedPoint(e,t){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(e,t)?0:this.path.distanceSquared(e,t)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(e){return e.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=e.devicePixelRatio,this.updatePathIfDirty(),super.preRender(e,this.path.commands.length)}render(e){const{ctx:t}=e;if(this.clip&&!isNaN(this._clipX)&&!isNaN(this._clipY)){t.save();try{const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new Tt),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),t.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(t)}finally{t.restore()}}else this._clipPath=void 0,this.drawPath(t);this.fillShadow?.markClean(),super.render(e)}drawPath(e){this.fillStroke(e,this.path.getPath2D())}toSVG(){if(!this.visible)return;const e=Fs("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};Z.className="Path",b([M()],Z.prototype,"clip",2),b([M()],Z.prototype,"clipX",1),b([M()],Z.prototype,"clipY",1);function Yt(e,t){const{path:i,size:n}=e,{x:s,y:r}=e;i.clear();let a=!1;for(const[c,o]of t){const h=s+(c-.5)*n,l=r+(o-.5)*n;a?i.lineTo(h,l):i.moveTo(h,l),a=!0}i.closePath()}var Ts={circle({path:e,x:t,y:i,size:n}){const s=n/2;e.arc(t,i,s,0,Math.PI*2),e.closePath()},cross(e){Yt(e,[[.25,0],[.5,.25],[.75,0],[1,.25],[.75,.5],[1,.75],[.75,1],[.5,.75],[.25,1],[0,.75],[.25,.5],[0,.25]])},diamond(e){Yt(e,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:e,x:t,y:i,size:n}){const s=n/4;i=i+s/2,e.arc(t-s,i-s,s,J(130),J(330)),e.arc(t+s,i-s,s,J(220),J(50)),e.lineTo(t,i+s),e.closePath()},pin({path:e,x:t,y:i,size:n}){e.moveTo(t+(.15625-.5)*n,i+(.34375-.5)*n),e.cubicCurveTo(t+(.15625-.5)*n,i+(.151491-.5)*n,t+(.307741-.5)*n,i+(0-.5)*n,t+(.5-.5)*n,i+(0-.5)*n),e.cubicCurveTo(t+(.692259-.5)*n,i+(0-.5)*n,t+(.84375-.5)*n,i+(.151491-.5)*n,t+(.84375-.5)*n,i+(.34375-.5)*n),e.cubicCurveTo(t+(.84375-.5)*n,i+(.493824-.5)*n,t+(.784625-.5)*n,i+(.600181-.5)*n,t+(.716461-.5)*n,i+(.695393-.5)*n),e.cubicCurveTo(t+(.699009-.5)*n,i+(.719769-.5)*n,t+(.681271-.5)*n,i+(.743104-.5)*n,t+(.663785-.5)*n,i+(.766105-.5)*n),e.cubicCurveTo(t+(.611893-.5)*n,i+(.834367-.5)*n,t+(.562228-.5)*n,i+(.899699-.5)*n,t+(.528896-.5)*n,i+(.980648-.5)*n),e.cubicCurveTo(t+(.524075-.5)*n,i+(.992358-.5)*n,t+(.512663-.5)*n,i+(1-.5)*n,t+(.5-.5)*n,i+(1-.5)*n),e.cubicCurveTo(t+(.487337-.5)*n,i+(1-.5)*n,t+(.475925-.5)*n,i+(.992358-.5)*n,t+(.471104-.5)*n,i+(.980648-.5)*n),e.cubicCurveTo(t+(.487337-.5)*n,i+(1-.5)*n,t+(.475925-.5)*n,i+(.992358-.5)*n,t+(.471104-.5)*n,i+(.980648-.5)*n),e.cubicCurveTo(t+(.437772-.5)*n,i+(.899699-.5)*n,t+(.388107-.5)*n,i+(.834367-.5)*n,t+(.336215-.5)*n,i+(.766105-.5)*n),e.cubicCurveTo(t+(.318729-.5)*n,i+(.743104-.5)*n,t+(.300991-.5)*n,i+(.719769-.5)*n,t+(.283539-.5)*n,i+(.695393-.5)*n),e.cubicCurveTo(t+(.215375-.5)*n,i+(.600181-.5)*n,t+(.15625-.5)*n,i+(.493824-.5)*n,t+(.15625-.5)*n,i+(.34375-.5)*n),e.closePath()},plus(e){Yt(e,[[1/3,0],[2/3,0],[2/3,1/3],[1,1/3],[1,2/3],[2/3,2/3],[2/3,1],[1/3,1],[1/3,2/3],[0,2/3],[0,1/3],[1/3,1/3]])},square({path:e,x:t,y:i,size:n,pixelRatio:s}){const r=n/2;e.moveTo(B(s,t-r),B(s,i-r)),e.lineTo(B(s,t+r),B(s,i-r)),e.lineTo(B(s,t+r),B(s,i+r)),e.lineTo(B(s,t-r),B(s,i+r)),e.closePath()},star({path:e,x:t,y:i,size:n}){const r=n/2,a=r/2,c=Math.PI/2;for(let o=0;o<5*2;o++){const h=o%2===0?r:a,l=o*Math.PI/5-c,d=t+Math.cos(l)*h,u=i+Math.sin(l)*h;e.lineTo(d,u)}e.closePath()},triangle(e){Yt(e,[[.5,0],[1,.87],[0,.87]])}},Ot=class extends Z{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}isPointInPath(e,t){return this.distanceSquared(e,t)<=0}distanceSquared(e,t){const i=Xt.anchor(this.shape);return Math.max(Math.hypot(e-this.x+(i.x-.5)*this.size,t-this.y+(i.y-.5)*this.size)-this.size/2,0)}updatePath(){const{path:e,shape:t,x:i,y:n,size:s}=this,r=this.layerManager?.canvas?.pixelRatio??1,a=Xt.anchor(t),c={path:e,x:i-(a.x-.5)*s,y:n-(a.y-.5)*s,size:s,pixelRatio:r};e.clear(),typeof t=="string"?Ts[t](c):typeof t=="function"&&t(c)}computeBBox(){const{x:e,y:t,size:i}=this,n=Xt.anchor(this.shape);return new W(e-i*n.x,t-i*n.y,i,i)}executeFill(e,t){if(t)return super.executeFill(e,t)}executeStroke(e,t){if(t)return super.executeStroke(e,t)}};b([tt({equals:oe})],Ot.prototype,"shape",2),b([M()],Ot.prototype,"x",2),b([M()],Ot.prototype,"y",2),b([M({convertor:Math.abs})],Ot.prototype,"size",2);var Xt=class extends Rt(Ri($t(Ot))){static anchor(e){return e==="pin"?{x:.5,y:1}:typeof e=="function"&&"anchor"in e?e.anchor:{x:.5,y:.5}}constructor(e){super(e),e?.shape!=null&&(this.shape=e.shape)}};import"ag-charts-core";function Rs(e){if(e.length===0)return[];const t=[1/0,-1/0];for(const i of e)i<t[0]&&(t[0]=i),i>t[1]&&(t[1]=i);return t}var Ut=1e3,bt=Ut*60,Vt=bt*60,Nt=Vt*24,Is=Nt*7,Li=Nt*30,Os=Nt*365,xt=new Date().getTimezoneOffset()*bt,Ns={millisecond:{milliseconds:1,hierarchy:"day",encode(e){return e.getTime()},decode(e){return new Date(e)}},second:{milliseconds:Ut,hierarchy:"day",encode(e,t){const i=t?0:xt;return Math.floor((e.getTime()-i)/Ut)},decode(e,t){const i=t?0:xt;return new Date(i+e*Ut)}},minute:{milliseconds:bt,hierarchy:"day",encode(e,t){const i=t?0:xt;return Math.floor((e.getTime()-i)/bt)},decode(e,t){const i=t?0:xt;return new Date(i+e*bt)}},hour:{milliseconds:Vt,hierarchy:"day",encode(e,t){const i=t?0:xt;return Math.floor((e.getTime()-i)/Vt)},decode(e,t){const i=t?0:xt;return new Date(i+e*Vt)}},day:{milliseconds:Nt,hierarchy:"month",encode(e,t){const i=t?0:e.getTimezoneOffset()*bt;return Math.floor((e.getTime()-i)/Nt)},decode(e,t){let i;return t?(i=new Date(0),i.setUTCDate(i.getUTCDate()+e),i.setUTCHours(0,0,0,0)):(i=new Date(1970,0,1),i.setDate(i.getDate()+e)),i}},month:{milliseconds:Li,hierarchy:"year",encode(e,t){return t?e.getUTCFullYear()*12+e.getUTCMonth():e.getFullYear()*12+e.getMonth()},decode(e,t){if(t){const i=Math.floor(e/12),n=e-i*12;return new Date(Date.UTC(i,n,1))}else{const i=Math.floor(e/12),n=e-i*12;return new Date(i,n,1)}}},year:{milliseconds:Os,hierarchy:void 0,encode(e,t){return t?e.getUTCFullYear():e.getFullYear()},decode(e,t){const i=new Date;return t?(i.setUTCFullYear(e),i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):(i.setFullYear(e),i.setMonth(0,1),i.setHours(0,0,0,0)),i}}};function Es(e){return typeof e=="string"?e:e.unit}function Ls(e){return typeof e=="string"?1:e.step??1}function Bs(e){return Ls(e)*Ns[Es(e)].milliseconds}function Ee(e){return e instanceof Date?e.getTime():e}import{Logger as _s,clamp as Kt}from"ag-charts-core";var Le=class Ji extends xe{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 Ji}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=Kt(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=Kt(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=Kt(0,t,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&_s.warnOnce("Expected update to not invalidate scale"))}convert(t,i){this.refresh();const n=this.findIndex(t);return n==null||n<0||n>=this.bands.length?NaN:this.ordinalRange(n)}invertNearestIndex(t){this.refresh();const i=this.bands.length;if(i===0)return-1;let n=0,s=i-1,r=1/0,a=0;for(;n<=s;){const c=(s+n)/2|0,o=this.ordinalRange(c),h=Math.abs(o-t);if(h===0)return c;h<r&&(r=h,a=c),o<t?n=c+1:s=c-1}return a}update(){const[t,i]=this.range;let{_paddingInner:n}=this;const{_paddingOuter:s,round:r,bands:a}=this,c=a.length;if(c===0)return;const o=i-t;let h;c===1?(n=0,h=o*(1-s*2)):h=o/Math.max(1,c-n+s*2);const l=r?Math.floor(h):h;let d=t+(o-l*(c-n))/2,u=l*(1-n);r&&(d=Math.round(d),u=Math.round(u)),this._step=l,this._inset=d,this._bandwidth=u,this._rawBandwidth=h*(1-n)}ordinalRange(t){const{_inset:i,_step:n,range:s}=this,r=Math.min(s[0],s[1]),a=Math.max(s[0],s[1]);return Kt(r,i+n*t,a)}};b([qt],Le.prototype,"range",2),b([qt],Le.prototype,"round",2);var zs=Le;import{clamp as Bi}from"ag-charts-core";function Gs(e,t,i){if(i==null||i[0]===0&&i[1]===1)return{ticks:e,count:e.length};const n=Bi(0,Math.floor(i[0]*e.length),e.length),s=Bi(0,Math.ceil(i[1]*e.length),e.length),r=t?e.length-s:n,a=t?e.length-n:s;return{ticks:e.slice(r,a),count:e.length}}var qs=class Zi extends zs{constructor(){super(...arguments),this.type="band",this.defaultTickCount=0,this.index=new Map,this.indexInitialised=!1,this._domain=[]}static is(t){return t instanceof Zi}set domain(t){this._domain!==t&&(this.invalid=!0,this._domain=t,this.index.clear(),this.indexInitialised=!1)}get domain(){return this._domain}get bands(){return this._domain}normalizeDomains(...t){let i;const n=new Set;let s=!0;for(const r of t)n.has(r)||(n.add(r),i==null?i=_i(r):(s&&(s=Ws(r,i)),i=_i([...i,...r])));return i??(i=[]),{domain:i,animatable:s}}toDomain(t){}invert(t,i=!1){this.refresh();const n=i?this.bandwidth/2:0,s=this.invertNearestIndex(Math.max(0,t-n));return i||t===this.ordinalRange(s)?this.domain[s]:void 0}ticks(t,i=this.domain,n){return Gs(i,!1,n)}findIndex(t){const{index:i,indexInitialised:n}=this;if(!n){const{domain:s}=this;for(let r=0;r<s.length;r++)i.set(Ee(s[r]),r);this.indexInitialised=!0}return i.get(Ee(t))}};function _i(e){let t;const i=new Set;for(const n of e){const s=Ee(n),r=i.size;i.add(s),i.size!==r?t?.push(n):t??(t=e.slice(0,i.size))}return t??e}function Ws(e,t){let i=-1;for(const n of e){const s=t.indexOf(n);if(s===-1)i=1/0;else{if(s<=i)return!1;i=s}}return!0}import{Logger as Hs,clamp as $s,countFractionDigits as js}from"ag-charts-core";var O=(e,t)=>({duration:Bs(e)*t,timeInterval:e,step:t}),ia=[O({unit:"second"},1),O({unit:"second"},5),O({unit:"second"},15),O({unit:"second"},30),O({unit:"minute"},1),O({unit:"minute"},5),O({unit:"minute"},15),O({unit:"minute"},30),O({unit:"hour"},1),O({unit:"hour"},3),O({unit:"hour"},6),O({unit:"hour"},12),O({unit:"day"},1),O({unit:"day"},2),O({unit:"day",step:7},1),O({unit:"day",step:7},2),O({unit:"day",step:7},3),O({unit:"month"},1),O({unit:"month"},2),O({unit:"month"},3),O({unit:"month"},4),O({unit:"month"},6),O({unit:"year"},1)],zi=[1,2,5,10];function Gi(e,t){return Math.abs(Math.round(e)-e)<t}function qi(e,t,i){return Math.abs(t-e)>=i?Math.abs(t-e)/i+1:1}function Ys(e,t,i,n,s,r){if(e===t)return{ticks:[e],count:1};if(i<2)return{ticks:[e,t],count:2};const a=Wi(e,t,i,n,s);if(!Number.isFinite(a))return{ticks:[],count:0};let c=e,o=t;if(Gi(c/a,1e-12)||(c=Math.ceil(c/a)*a),Gi(o/a,1e-12)||(o=Math.floor(o/a)*a),r!=null){const l=o-c,d=t-e,u=e+d*r[0],f=e+d*r[1];r=[(u-c)/l,(f-c)/l]}const{ticks:h}=Hi(c,o,a,r);return{ticks:h,count:qi(e,t,a)}}var na=Math.floor(2*Is/Li*10)/10;function Wi(e,t,i,n=0,s=1/0){if(e===t)return $s(1,n,s);if(i<1)return NaN;const r=Math.abs(t-e),a=10**Math.floor(Math.log10(r/i));let c=NaN,o=1/0,h=!1;for(const l of zi){const d=Math.ceil(r/(l*a)),u=d>=n&&d<=s;if(h&&!u)continue;const f=Math.abs(d-i);(o>f||h!==u)&&(h||(h=u),o=f,c=l)}return c*a}function Hi(e,t,i,n){if(!Number.isFinite(i)||i<=0)return{ticks:[],count:0};if(e===t)return{ticks:[e],count:1};const s=10**js(i),r=Math.min(e,t),a=Math.max(e,t);let c,o;if(n!=null&&(n[0]!==0||n[1]!==1)){const l=t-e,d=e+l*n[0],u=t-l*(1-n[1]);c=Math.min(d,u),o=Math.max(d,u)}else c=r,o=a;c=Math.floor(c*s)/s,o=Math.ceil(o*s)/s;const h=[];for(let l=0;;l+=1){const d=Math.round((r+i*l)*s)/s;if(d>a)break;d>=c&&d<=o&&h.push(d)}return{ticks:h,count:qi(r,a,i)}}function Xs(e,t){return e>=t?(Hs.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function Us(e,t){const i=Math.abs(t-e),n=10**Math.floor(Math.log10(i));let s=1/0,r=[e,t];for(const a of zi){const c=a*n,o=Math.floor(e/c)*c,h=Math.ceil(t/c)*c,l=1-i/Math.abs(h-o);s>l&&(s=l,r=[o,h])}return r}var $i=class We extends xe{constructor(t=[],i=[]){super(),this.domain=t,this.range=i,this.defaultTickCount=We.defaultTickCount,this.defaultClamp=!1}static is(t){return t instanceof We}normalizeDomains(...t){return Vs(...t)}calcBandwidth(t=1,i=1){const{domain:n}=this,s=this.getPixelRange();if(n.length===0)return s;let a=Math.abs(n[1].valueOf()-n[0].valueOf())/t+1;if(i!==0){const c=Math.floor(s);a=Math.min(a,c)}return s/Math.max(1,a)}convert(t,i){const{domain:n}=this;if(!n||n.length<2||t==null)return NaN;const{range:s}=this,r=i?.clamp??this.defaultClamp;let a=n[0].valueOf(),c=n[1].valueOf(),o=t.valueOf();if(this.transform&&(a=this.transform(a),c=this.transform(c),o=this.transform(o)),r){const[l,d]=Rs([a,c]);if(o<l)return s[0];if(o>d)return s[1]}if(a===c)return(s[0]+s[1])/2;if(o===a)return s[0];if(o===c)return s[1];const h=s[0];return h+(o-a)/(c-a)*(s[1]-h)}invert(t,i){const{domain:n}=this;if(n.length<2)return;let s=n[0].valueOf(),r=n[1].valueOf();this.transform&&(s=this.transform(s),r=this.transform(r));const{range:a}=this,[c,o]=a;let h;return c===o?h=this.toDomain((s+r)/2):h=this.toDomain(s+(t-c)/(o-c)*(r-s)),this.transformInvert?this.transformInvert(h):h}getPixelRange(){const[t,i]=this.range;return Math.abs(i-t)}};$i.defaultTickCount=5;var Jt=$i;function Vs(...e){let t,i=1/0,n,s=-1/0;for(const r of e)for(const a of r){const c=a.valueOf();c<i&&(i=c,t=a),c>s&&(s=c,n=a)}return t!=null&&n!=null?{domain:[t,n],animatable:!0}:{domain:[],animatable:!1}}var Ks=class He extends Jt{constructor(){super([0,1],[0,1]),this.type="number"}static is(t){return t instanceof He}static getTickStep(t,i,n){const{interval:s,tickCount:r=Jt.defaultTickCount,minTickCount:a,maxTickCount:c}=n;return s??Wi(t,i,r,a,c)}toDomain(t){return t}ticks({interval:t,tickCount:i=Jt.defaultTickCount,minTickCount:n,maxTickCount:s},r=this.domain,a){if(!r||r.length<2||i<1||!r.every(isFinite))return{ticks:[],count:0};const[c,o]=r;if(t){const h=Math.abs(t);if(!Xs((o-c)/h,this.getPixelRange()))return Hi(c,o,h,a)}return Ys(c,o,i,n,s,a)}niceDomain(t,i=this.domain){if(i.length<2)return[];const{tickCount:n=Jt.defaultTickCount}=t;let[s,r]=i;if(n===1)[s,r]=Us(s,r);else if(n>1){const a=s>r?Math.ceil:Math.floor,c=s>r?Math.floor:Math.ceil,o=4;for(let h=0;h<o;h++){const l=s,d=r,u=He.getTickStep(s,r,t),[f,p]=i;if(s=a(f/u)*u,r=c(p/u)*u,s===l&&r===d)break}}return[s,r]}};import{CleanupRegistry as Js,EventEmitter as Zs,Logger as Qs,createId as tr,downloadUrl as er}from"ag-charts-core";import{createElement as ir,getWindow as nr}from"ag-charts-core";var ji=class{constructor(e){this.enabled=!0,this.width=600,this.height=300;const{width:t,height:i,canvasElement:n,willReadFrequently:s=!1}=e;this.pixelRatio=e.pixelRatio??nr("devicePixelRatio")??1,this.element=n??ir("canvas"),this.element.style.display="block",this.element.style.width=(t??this.width)+"px",this.element.style.height=(i??this.height)+"px",this.element.width=Math.round((t??this.width)*this.pixelRatio),this.element.height=Math.round((i??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:s}),this.onEnabledChange(),this.resize(t??0,i??0,this.pixelRatio),oi(this.context)}drawImage(e,t=0,i=0){return e.drawImage(this.context.canvas,t,i)}toDataURL(e){return this.element.toDataURL(e)}resize(e,t,i){if(!(e>0&&t>0))return;const{element:n,context:s}=this;n.width=Math.round(e*i),n.height=Math.round(t*i),s.setTransform(i,0,0,i,0,0),n.style.width=e+"px",n.style.height=t+"px",this.width=e,this.height=t,this.pixelRatio=i}clear(){ai(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")}};b([ks(e=>e.onEnabledChange())],ji.prototype,"enabled",2);import{EventEmitter as sr}from"ag-charts-core";var rr=class extends sr{constructor(){super(...arguments),this.cache=new Map,this.imageLoadingCount=0}loadImage(e,t){const i=this.cache.get(e);if(i?.image)return i.image;if(i!=null&&t){i.nodes.add(t);return}if(!t)return;const n={image:void 0,nodes:new Set([t])},s=new Image;return this.imageLoadingCount++,s.onload=()=>{n.image=s;for(const r of n.nodes)r.markDirty();n.nodes.clear(),this.imageLoadingCount--,this.emit("image-loaded",{uri:e})},s.onerror=()=>{this.imageLoadingCount--,n.nodes.clear(),this.emit("image-error",{uri:e})},s.src=e,this.cache.set(e,n),n.image}waitingToLoad(){return this.imageLoadingCount>0}destroy(){this.cache.forEach(e=>{e.nodes.clear()}),this.cache.clear()}},ar=class{constructor(e){this.canvas=e,this.debug=j.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(e,t,i){this.canvas.resize(e,t,i),this.layersMap.forEach(({canvas:n})=>n.resize(e,t,i))}addLayer(e){const{width:t,height:i,pixelRatio:n}=this.canvas,{name:s}=e,r=new de({width:t,height:i,pixelRatio:n});return this.layersMap.set(r,{id:this.nextLayerId++,name:s,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(e){this.layersMap.has(e)&&(this.layersMap.delete(e),e.destroy(),this.debug("Scene.removeLayer() - layers",this.layersMap))}clear(){for(const e of this.layersMap.values())e.canvas.destroy();this.layersMap.clear()}},Yi=class extends Zs{constructor(e){super(),this.debug=j.create(!0,"scene"),this.id=tr(this),this.imageLoader=new rr,this.root=null,this.pendingSize=null,this.isDirty=!1,this.cleanup=new Js,this.updateDebugFlags(),this.canvas=new ji(e),this.layersManager=new ar(this.canvas),this.cleanup.register(this.imageLoader.on("image-loaded",()=>{this.emit("scene-changed",{})}),this.imageLoader.on("image-error",({uri:t})=>{Qs.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(e){const{element:t}=this.canvas;return t.parentElement?.removeChild(t),e.appendChild(t),this}setRoot(e){return this.root===e?this:(this.isDirty=!0,this.root?.setScene(),this.root=e,e&&(e.visible=!0,e.setScene(this)),this)}updateDebugFlags(){j.inDevelopmentMode(()=>Ft._debugEnabled=!0)}clearCanvas(){this.canvas.clear()}attachNode(e){return this.appendChild(e),()=>this.removeChild(e)}appendChild(e){return this.root?.appendChild(e),this}removeChild(e){return this.root?.removeChild(e),this}download(e,t){er(this.canvas.toDataURL(t),e?.trim()??"image")}getDataURL(e){return this.canvas.toDataURL(e)}resize(e,t,i){return e=Math.round(e),t=Math.round(t),i??(i=this.pixelRatio),e>0&&t>0&&(e!==this.width||t!==this.height||i!==this.pixelRatio)?(this.pendingSize=[e,t,i],this.isDirty=!0,!0):!1}render(e){const{debugSplitTimes:t={start:performance.now()},extraDebugStats:i,seriesRect:n}=e??{},{canvas:s,canvas:{context:r}={},root:a,pendingSize:c,width:o,height:h,pixelRatio:l}=this;if(!r)return;const d=performance.now();let u=!1;if(c&&(u=!0,this.layersManager.resize(...c),this.pendingSize=null),a&&!a.visible){this.isDirty=!1;return}let f;if(a instanceof U&&(f=a.dirty),a!=null&&f===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:jt(a,"console")}),Ii(this.layersManager,t,r,void 0,i,n);return}const p={ctx:r,width:o,height:h,devicePixelRatio:l,debugNodes:{}};j.check("scene:stats:verbose")&&(p.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),Ms(p);let y=!1;if((f!==!1||u)&&(y=!0,s.clear()),a&&j.check("scene:dirtyTree")){const{dirtyTree:g,paths:m}=Oi(a);j.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:g,paths:m})}if(a&&y){if(a.visible&&a.preRender(p),this.debug.check()){const g=jt(a,"console");this.debug("Scene.render() - before",{canvasCleared:y,tree:g})}if(a.visible)try{r.save(),a.render(p),r.restore()}catch(g){throw this.canvas.reset(),g}}t["\u270D\uFE0F"]=performance.now()-d,r.verifyDepthZero?.(),this.isDirty=!1,Ii(this.layersManager,t,r,p.stats,i,n),vs(r,p.debugNodes),a&&this.debug.check()&&this.debug("Scene.render() - after",{tree:jt(a,"console"),canvasCleared:y})}toSVG(){const{root:e,width:t,height:i}=this;if(e!=null)return Ft.toSVG(e,t,i)}strip(){const{context:e,pixelRatio:t}=this.canvas;e.setTransform(t,0,0,t,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1,this.clear()}destroy(){this.strip(),this.canvas.destroy(),this.imageLoader.destroy(),this.cleanup.flush(),Object.assign(this,{canvas:void 0})}};Yi.className="Scene";import{isNumberEqual as or}from"ag-charts-core";var it=class extends Z{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 or(G(this.startAngle),G(this.endAngle))}updatePath(){const e=this.path;e.clear(),e.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?e.closePath():this.type===2&&!this.fullPie&&(e.lineTo(this.centerX,this.centerY),e.closePath())}computeBBox(){return new W(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(e,t){const i=this.getBBox();return this.type!==0&&i.containsPoint(e,t)&&this.path.isPointInPath(e,t)}};it.className="Arc",b([M()],it.prototype,"centerX",2),b([M()],it.prototype,"centerY",2),b([M()],it.prototype,"radius",2),b([M()],it.prototype,"startAngle",2),b([M()],it.prototype,"endAngle",2),b([M()],it.prototype,"counterClockwise",2),b([M()],it.prototype,"type",2);import{createSvgElement as cr}from"ag-charts-core";var Mt=class extends _{constructor(e={}){super(e),this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.fill=void 0,this.strokeWidth=1}set x(e){this.x1=e,this.x2=e}set y(e){this.y1=e,this.y2=e}get midPoint(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}}computeBBox(){return new W(Math.min(this.x1,this.x2),Math.min(this.y1,this.y2),Math.abs(this.x2-this.x1),Math.abs(this.y2-this.y1))}isPointInPath(e,t){return this.x1===this.x2||this.y1===this.y2?this.getBBox().clone().grow(this.strokeWidth/2).containsPoint(e,t):!1}distanceSquared(e,t){const{x1:i,y1:n,x2:s,y2:r}=this;return Ae(e,t,i,n,s,r,1/0)}render(e){const{ctx:t,devicePixelRatio:i}=e;let{x1:n,y1:s,x2:r,y2:a}=this;if(n===r){const{strokeWidth:c}=this,o=Math.round(n*i)/i+Math.trunc(c*i)%2/(i*2);n=o,r=o}else if(s===a){const{strokeWidth:c}=this,o=Math.round(s*i)/i+Math.trunc(c*i)%2/(i*2);s=o,a=o}t.beginPath(),t.moveTo(n,s),t.lineTo(r,a),this.fillStroke(t),this.fillShadow?.markClean(),super.render(e)}toSVG(){if(!this.visible)return;const e=cr("line");return e.setAttribute("x1",String(this.x1)),e.setAttribute("y1",String(this.y1)),e.setAttribute("x2",String(this.x2)),e.setAttribute("y2",String(this.y2)),this.applySvgStrokeAttributes(e),{elements:[e]}}};Mt.className="Line",b([M()],Mt.prototype,"x1",2),b([M()],Mt.prototype,"y1",2),b([M()],Mt.prototype,"x2",2),b([M()],Mt.prototype,"y2",2);import{isNumberEqual as Be}from"ag-charts-core";function _e(e,t,i){const n=Math.sqrt(e**2+t**2),r=Math.atan2(t,e)+i;return{x:Math.cos(r)*n,y:Math.sin(r)*n}}var K=class extends Z{constructor(){super(...arguments),this.isBeveled=!0,this.columnWidth=0,this.startAngle=0,this.endAngle=0,this.outerRadius=0,this.innerRadius=0,this.axisInnerRadius=0,this.axisOuterRadius=0,this.isRadiusAxisReversed=!1}set cornerRadius(e){}computeBBox(){const{innerRadius:e,outerRadius:t,columnWidth:i}=this,n=this.getRotation(),s=-i/2,r=i/2,a=-t,c=-e;let o=1/0,h=1/0,l=-1/0,d=-1/0;for(let u=0;u<4;u+=1){const{x:f,y:p}=_e(u%2===0?s:r,u<2?a:c,n);o=Math.min(f,o),h=Math.min(p,h),l=Math.max(f,l),d=Math.max(p,d)}return new W(o,h,l-o,d-h)}getRotation(){const{startAngle:e,endAngle:t}=this,i=pe(e,t);return G(e+i/2+Math.PI/2)}updatePath(){const{isBeveled:e}=this;e?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:e,innerRadius:t,outerRadius:i,path:n}=this,s=-e/2,r=e/2,a=-i,c=-t,o=this.getRotation(),h=[[s,c],[s,a],[r,a],[r,c]].map(([l,d])=>_e(l,d,o));n.clear(!0),n.moveTo(h[0].x,h[0].y),n.lineTo(h[1].x,h[1].y),n.lineTo(h[2].x,h[2].y),n.lineTo(h[3].x,h[3].y),n.closePath()}updateBeveledPath(){const{columnWidth:e,path:t,outerRadius:i,innerRadius:n,axisInnerRadius:s,axisOuterRadius:r,isRadiusAxisReversed:a}=this,c=Be(n,s),o=Math.asin(e/2/n),h=this.getRotation(),l=(S,C)=>_e(S,C,h),d=(S,C)=>Math.sqrt(S**2+C**2),u=(S,C)=>C>S?0:Math.sqrt(S**2-C**2),f=(S,C,D)=>D?S<C:S>C,p=c&&!isNaN(o)&&o<Math.PI/6;let y=-e/2,g=e/2;const m=-i,x=-n*(p?Math.cos(o):1),w=f(r,d(n,e/2),!a);if(w){const S=u(r,n);y=-S,g=S}t.clear(!0);const P=l(y,x);t.moveTo(P.x,P.y);const k=Be(n,i),A=f(r,d(i,e/2),!a);if(k&&p)t.arc(0,0,n,G(-o-Math.PI/2)+h,G(o-Math.PI/2)+h,!1);else if(A){const S=-u(r,e/2),C=u(r,i);if(!w){const D=l(y,S);t.lineTo(D.x,D.y)}if(t.arc(0,0,r,Math.atan2(S,y)+h,Math.atan2(m,-C)+h,!1),!Be(C,0)){const D=l(C,m);t.lineTo(D.x,D.y)}t.arc(0,0,r,Math.atan2(m,C)+h,Math.atan2(S,g)+h,!1)}else{const S=l(y,m),C=l(g,m);t.lineTo(S.x,S.y),t.lineTo(C.x,C.y)}const v=l(g,x);if(t.lineTo(v.x,v.y),p)t.arc(0,0,n,G(o-Math.PI/2)+h,G(-o-Math.PI/2)+h,!0);else{const S=l(y,x);t.lineTo(S.x,S.y)}t.closePath()}};K.className="RadialColumnShape",b([M()],K.prototype,"isBeveled",2),b([M()],K.prototype,"columnWidth",2),b([M()],K.prototype,"startAngle",2),b([M()],K.prototype,"endAngle",2),b([M()],K.prototype,"outerRadius",2),b([M()],K.prototype,"innerRadius",2),b([M()],K.prototype,"axisInnerRadius",2),b([M()],K.prototype,"axisOuterRadius",2),b([M()],K.prototype,"isRadiusAxisReversed",2);function hr(e,t,i,n,s){const r=pe(e,t),a=r*(1-n)/2;if(e+=a,t-=a,r<.001)return 2*i*s;if(r>=2*Math.PI){const f=e+r/2;e=f-Math.PI,t=f+Math.PI}const c=i*Math.cos(e),o=i*Math.sin(e),h=i*Math.cos(t),l=i*Math.sin(t),d=Math.floor(Math.sqrt((c-h)**2+(o-l)**2)),u=2*i*s;return Math.max(1,Math.min(u,d))}import{boxesEqual as lr}from"ag-charts-core";var Zt=(e,{x0:t,y0:i,x1:n,y1:s,cx:r,cy:a},c,o)=>{if(o&&e.moveTo(t,i),t!==n||i!==s){const h=Math.atan2(i-a,t-r),l=Math.atan2(s-a,n-r);e.arc(r,a,c,h,l)}else e.lineTo(t,i)},Xi=1e-6,Qt=(e,t,i,n,s)=>{let r=!1,a=!1,c=n-Math.sqrt(Math.max(s**2-i**2,0)),o=0,h=0,l=i-Math.sqrt(Math.max(s**2-n**2,0));return c>e?(r=!0,c=e,o=i-Math.sqrt(Math.max(s**2-(n-e)**2))):c<Xi&&(c=0),l>t?(a=!0,h=n-Math.sqrt(Math.max(s**2-(i-t)**2)),l=t):l<Xi&&(l=0),{leading0:c,leading1:o,trailing0:h,trailing1:l,leadingClipped:r,trailingClipped:a}},ze=(e,t,i,n,s,r,a)=>{let{topLeft:c,topRight:o,bottomRight:h,bottomLeft:l}=r;const d=Math.max(c+l,o+h),u=Math.max(c+o,l+h);if(d<=0&&u<=0){a==null?e.rect(t,i,n,s):e.rect(a.x,a.y,a.width,a.height);return}else if(a==null&&c===o&&c===h&&c===l){e.roundRect(t,i,n,s,c);return}if(n<0&&(t+=n,n=Math.abs(n)),s<0&&(i+=s,s=Math.abs(s)),n<=0||s<=0)return;if(a==null)a=new W(t,i,n,s);else{const v=Math.max(t,a.x),S=Math.min(t+n,a.x+a.width),C=Math.max(i,a.y),D=Math.min(i+s,a.y+a.height);a=new W(v,C,S-v,D-C)}const f=Math.max(d/s,u/n,1);f>1&&(c/=f,o/=f,h/=f,l/=f);let p=!0,y=!0,g=!0,m=!0,x,w,P,k;if(p){const v=Qt(a.height,a.width,Math.max(t+c-a.x,0),Math.max(i+c-a.y,0),c);v.leadingClipped&&(m=!1),v.trailingClipped&&(y=!1);const S=Math.max(a.x+v.leading1,a.x),C=Math.max(a.y+v.leading0,a.y),D=Math.max(a.x+v.trailing1,a.x),R=Math.max(a.y+v.trailing0,a.y),N=t+c,z=i+c;x={x0:S,y0:C,x1:D,y1:R,cx:N,cy:z}}if(y){const v=Qt(a.width,a.height,Math.max(i+o-a.y,0),Math.max(a.x+a.width-(t+n-o),0),o);v.leadingClipped&&(p=!1),v.trailingClipped&&(g=!1);const S=Math.min(a.x+a.width-v.leading0,a.x+a.width),C=Math.max(a.y+v.leading1,a.y),D=Math.min(a.x+a.width-v.trailing0,a.x+a.width),R=Math.max(a.y+v.trailing1,a.y),N=t+n-o,z=i+o;w={x0:S,y0:C,x1:D,y1:R,cx:N,cy:z}}if(g){const v=Qt(a.height,a.width,Math.max(a.x+a.width-(t+n-h),0),Math.max(a.y+a.height-(i+s-h),0),h);v.leadingClipped&&(y=!1),v.trailingClipped&&(m=!1);const S=Math.min(a.x+a.width-v.leading1,a.x+a.width),C=Math.min(a.y+a.height-v.leading0,a.y+a.height),D=Math.min(a.x+a.width-v.trailing1,a.x+a.width),R=Math.min(a.y+a.height-v.trailing0,a.y+a.height),N=t+n-h,z=i+s-h;P={x0:S,y0:C,x1:D,y1:R,cx:N,cy:z}}if(m){const v=Qt(a.width,a.height,Math.max(a.y+a.height-(i+s-l),0),Math.max(t+l-a.x,0),l);v.leadingClipped&&(g=!1),v.trailingClipped&&(p=!1);const S=Math.max(a.x+v.leading0,a.x),C=Math.min(a.y+a.height-v.leading1,a.y+a.height),D=Math.max(a.x+v.trailing0,a.x),R=Math.min(a.y+a.height-v.trailing1,a.y+a.height),N=t+l,z=i+s-l;k={x0:S,y0:C,x1:D,y1:R,cx:N,cy:z}}let A=!1;p&&x!=null&&(Zt(e,x,c,!A),A||(A=!0)),y&&w!=null&&(Zt(e,w,o,!A),A||(A=!0)),g&&P!=null&&(Zt(e,P,h,!A),A||(A=!0)),m&&k!=null&&Zt(e,k,l,!A),e.closePath()},V=class extends Z{constructor(){super(...arguments),this.borderPath=new Tt,this.x=0,this.y=0,this.width=10,this.height=10,this.topLeftCornerRadius=0,this.topRightCornerRadius=0,this.bottomRightCornerRadius=0,this.bottomLeftCornerRadius=0,this.clipBBox=void 0,this.crisp=!1,this.lastUpdatePathStrokeWidth=this.strokeWidth,this.effectiveStrokeWidth=this.strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(e){this.topLeftCornerRadius=e,this.topRightCornerRadius=e,this.bottomRightCornerRadius=e,this.bottomLeftCornerRadius=e}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:e,borderPath:t,crisp:i,topLeftCornerRadius:n,topRightCornerRadius:s,bottomRightCornerRadius:r,bottomLeftCornerRadius:a}=this;let{x:c,y:o,width:h,height:l,strokeWidth:d,clipBBox:u}=this;const p=1/(this.layerManager?.canvas.pixelRatio??1);let y=1;if(e.clear(!0),t.clear(!0),i&&(h<=p&&(y*=h/p),l<=p&&(y*=l/p),h=this.align(c,h),l=this.align(o,l),c=this.align(c),o=this.align(o),u=u!=null?new W(this.align(u.x),this.align(u.y),this.align(u.x,u.width),this.align(u.y,u.height)):void 0),d)if(h<p){const g=c+p/2;t.moveTo(g,o),t.lineTo(g,o+l),d=p,this.borderClipPath=void 0}else if(l<p){const g=o+p/2;t.moveTo(c,g),t.lineTo(c+h,g),d=p,this.borderClipPath=void 0}else if(d<h&&d<l){const g=d/2;c+=g,o+=g,h-=d,l-=d;const m=u?.clone().shrink(g),x={topLeft:n>0?n-d:0,topRight:s>0?s-d:0,bottomRight:r>0?r-d:0,bottomLeft:a>0?a-d:0};this.borderClipPath=void 0,h>0&&l>0&&(m==null||m?.width>0&&m?.height>0)&&(ze(e,c,o,h,l,x,m),ze(t,c,o,h,l,x,m))}else this.borderClipPath=this.borderClipPath??new Tt,this.borderClipPath.clear(!0),this.borderClipPath.rect(c,o,h,l),t.rect(c,o,h,l);else{const g={topLeft:n,topRight:s,bottomRight:r,bottomLeft:a};this.borderClipPath=void 0,ze(e,c,o,h,l,g,u)}if([n,s,r,a].every(g=>g===0)){const g=this.getBBox();this.hittester=g.containsPoint.bind(g),this.distanceSquared=(m,x)=>this.getBBox().distanceSquared(m,x)}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=d,this.lastUpdatePathStrokeWidth=d,this.microPixelEffectOpacity=y}computeBBox(){const{x:e,y:t,width:i,height:n,clipBBox:s}=this;return s?.clone()??new W(e,t,i,n)}isPointInPath(e,t){return this.hittester(e,t)}get midPoint(){return{x:this.x+this.width/2,y:this.y+this.height/2}}distanceSquared(e,t){return this.distanceCalculator(e,t)}applyFillAndAlpha(e){super.applyFillAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}applyStrokeAndAlpha(e){super.applyStrokeAndAlpha(e),e.globalAlpha*=this.microPixelEffectOpacity}renderStroke(e){const{stroke:t,effectiveStrokeWidth:i}=this;if(t&&i){const{globalAlpha:n}=e,{lineDash:s,lineDashOffset:r,lineCap:a,lineJoin:c,borderPath:o,borderClipPath:h}=this;h&&e.clip(h.getPath2D()),this.applyStrokeAndAlpha(e),e.lineWidth=i,s&&e.setLineDash(s),r&&(e.lineDashOffset=r),a&&(e.lineCap=a),c&&(e.lineJoin=c),e.stroke(o.getPath2D()),e.globalAlpha=n}}};V.className="Rect",b([M()],V.prototype,"x",2),b([M()],V.prototype,"y",2),b([M()],V.prototype,"width",2),b([M()],V.prototype,"height",2),b([M()],V.prototype,"topLeftCornerRadius",2),b([M()],V.prototype,"topRightCornerRadius",2),b([M()],V.prototype,"bottomRightCornerRadius",2),b([M()],V.prototype,"bottomLeftCornerRadius",2),b([tt({equals:lr})],V.prototype,"clipBBox",2),b([M()],V.prototype,"crisp",2);var ur=class $e{constructor(t,i,n,s){this.startAngle=t,this.endAngle=i,this.innerRadius=n,this.outerRadius=s}clone(){const{startAngle:t,endAngle:i,innerRadius:n,outerRadius:s}=this;return new $e(t,i,n,s)}equals(t){return this.startAngle===t.startAngle&&this.endAngle===t.endAngle&&this.innerRadius===t.innerRadius&&this.outerRadius===t.outerRadius}[ti](t,i){return new $e(this.startAngle*(1-i)+t.startAngle*i,this.endAngle*(1-i)+t.endAngle*i,this.innerRadius*(1-i)+t.innerRadius*i,this.outerRadius*(1-i)+t.outerRadius*i)}};function dr({startAngle:e,endAngle:t,innerRadius:i,outerRadius:n}){let s=1/0,r=1/0,a=-1/0,c=-1/0;const o=(h,l)=>{s=Math.min(h,s),r=Math.min(l,r),a=Math.max(h,a),c=Math.max(l,c)};return o(i*Math.cos(e),i*Math.sin(e)),o(i*Math.cos(t),i*Math.sin(t)),o(n*Math.cos(e),n*Math.sin(e)),o(n*Math.cos(t),n*Math.sin(t)),zt(0,e,t)&&o(n,0),zt(Math.PI*.5,e,t)&&o(0,n),zt(Math.PI,e,t)&&o(-n,0),zt(Math.PI*1.5,e,t)&&o(0,-n),new W(s,r,a-s,c-r)}function Ui(e,t,i){const n=Math.sqrt(Math.pow(e,2)+Math.pow(t,2)),{innerRadius:s,outerRadius:r}=i;if(i.startAngle===i.endAngle||n<Math.min(s,r)||n>Math.max(s,r))return!1;const a=hi(i.startAngle),c=hi(i.endAngle),o=Math.atan2(t,e);return a<c?o<=c&&o>=a:o<=c&&o>=-Math.PI||o>=a&&o<=Math.PI}function Vi(e,t,i,n){if(i===0&&n===0)return 0;if(Math.asin(Math.abs(1*i)/(e+1*i))+Math.asin(Math.abs(1*n)/(e+1*n))-t<0)return 1;let r=0,a=1;for(let c=0;c<8;c+=1){const o=(r+a)/2;Math.asin(Math.abs(o*i)/(e+o*i))+Math.asin(Math.abs(o*n)/(e+o*n))-t<0?r=o:a=o}return r}var fr=1e-6;function at(e,t){return pe(e,t)<fr?t:G(e-t)+t}function te(e,t,i=0){const s=Math.abs(t-e)>=2*Math.PI?2*Math.PI:G(t-e);return e=at(e,i),t=e+s,{startAngle:e,endAngle:t}}function ee(e,t,i,n,s,r){const a=Math.sin(r),c=Math.cos(r),o=e**2+t**2-i**2;let h,l,d,u;if(c>.5){const w=a/c,P=1+w**2,k=-2*(e+t*w),A=k**2-4*P*o;if(A<0)return;const v=(-k+Math.sqrt(A))/(2*P),S=(-k-Math.sqrt(A))/(2*P);h=v,l=v*w,d=S,u=S*w}else{const w=c/a,P=1+w**2,k=-2*(t+e*w),A=k**2-4*P*o;if(A<0)return;const v=(-k+Math.sqrt(A))/(2*P),S=(-k-Math.sqrt(A))/(2*P);h=v*w,l=v,d=S*w,u=S}const f=c,p=a,y=h*f+l*p,g=d*f+u*p,m=y>0?at(Math.atan2(l-t,h-e),n):NaN,x=g>0?at(Math.atan2(u-t,d-e),n):NaN;if(m>=n&&m<=s)return m;if(x>=n&&x<=s)return x}function ie(e,t,i,n,s,r){const a=Math.hypot(e,t),c=(a**2-i**2+r**2)/(2*a),o=a-c,h=Math.atan2(t,e),l=Math.acos(-o/i),d=at(h+l,n),u=at(h-l,n);if(d>=n&&d<=s)return d;if(u>=n&&u<=s)return u}var Ge=class{constructor(e,t,i,n,s){this.cx=e,this.cy=t,this.r=i,this.a0=n,this.a1=s,this.a0>=this.a1&&(this.a0=NaN,this.a1=NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(e){return{x:this.cx+this.r*Math.cos(e),y:this.cy+this.r*Math.sin(e)}}clipStart(e){e==null||!this.isValid()||e<this.a0||(this.a0=e,(Number.isNaN(e)||this.a0>=this.a1)&&(this.a0=NaN,this.a1=NaN))}clipEnd(e){e==null||!this.isValid()||e>this.a1||(this.a1=e,(Number.isNaN(e)||this.a0>=this.a1)&&(this.a0=NaN,this.a1=NaN))}},Y=class extends Z{constructor(){super(...arguments),this.centerX=0,this.centerY=0,this.innerRadius=10,this.outerRadius=20,this.startAngle=0,this.endAngle=Math.PI*2,this.clipSector=void 0,this.concentricEdgeInset=0,this.radialEdgeInset=0,this.startOuterCornerRadius=0,this.endOuterCornerRadius=0,this.startInnerCornerRadius=0,this.endInnerCornerRadius=0}set inset(e){this.concentricEdgeInset=e,this.radialEdgeInset=e}set cornerRadius(e){this.startOuterCornerRadius=e,this.endOuterCornerRadius=e,this.startInnerCornerRadius=e,this.endInnerCornerRadius=e}computeBBox(){return dr(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:e}=this;let{innerRadius:t,outerRadius:i}=this;return t=t>0?t+e:0,i=Math.max(i-e,0),{innerRadius:t,outerRadius:i}}normalizedClipSector(){const{clipSector:e}=this;if(e==null)return;const{startAngle:t,endAngle:i}=te(this.startAngle,this.endAngle),{innerRadius:n,outerRadius:s}=this.normalizedRadii(),r=te(e.startAngle,e.endAngle,t);return new ur(Math.max(t,r.startAngle),Math.min(i,r.endAngle),Math.max(n,e.innerRadius),Math.min(s,e.outerRadius))}getAngleOffset(e){return e>0?this.radialEdgeInset/e:0}arc(e,t,i,n,s,r,a,c){if(e<=0)return;const{startAngle:o,endAngle:h}=te(this.startAngle,this.endAngle),{innerRadius:l,outerRadius:d}=this.normalizedRadii(),u=this.normalizedClipSector();if(c&&l<=0)return;const f=c?this.getAngleOffset(l+e):this.getAngleOffset(d-e),p=a?o+f+t:h-f-t,y=c?l+e:d-e,g=y*Math.cos(p),m=y*Math.sin(p);if(u!=null&&(!a&&!(p>=o-1e-6&&p<=u.endAngle-1e-6)||a&&!(p>=u.startAngle+1e-6&&p<=h-1e-6)||c&&y<u.innerRadius-1e-6||!c&&y>u.outerRadius+1e-6))return;const x=new Ge(g,m,e,i,n);if(u!=null){c?(x.clipStart(ee(g,m,e,i,n,u.endAngle)),x.clipEnd(ee(g,m,e,i,n,u.startAngle))):(x.clipStart(ee(g,m,e,i,n,u.startAngle)),x.clipEnd(ee(g,m,e,i,n,u.endAngle)));let v,S;if(a?(v=ie(g,m,e,i,n,u.innerRadius),S=ie(g,m,e,i,n,u.outerRadius)):(v=ie(g,m,e,i,n,u.outerRadius),S=ie(g,m,e,i,n,u.innerRadius)),x.clipStart(v),x.clipEnd(S),v!=null){const{x:C,y:D}=x.pointAt(v),R=at(Math.atan2(D,C),o);a?r?.clipStart(R):s.clipEnd(R)}if(S!=null){const{x:C,y:D}=x.pointAt(S),R=at(Math.atan2(D,C),o);a?s.clipStart(R):r?.clipEnd(R)}}if(u!=null){const{x:v,y:S}=x.pointAt((x.a0+x.a1)/2);if(!Ui(v,S,u))return}const{x:w,y:P}=x.pointAt(a===c?x.a0:x.a1),k=at(Math.atan2(P,w),o),A=c?r:s;return a?A?.clipStart(k):A?.clipEnd(k),x}updatePath(){const{path:t,centerX:i,centerY:n,concentricEdgeInset:s,radialEdgeInset:r}=this;let{startOuterCornerRadius:a,endOuterCornerRadius:c,startInnerCornerRadius:o,endInnerCornerRadius:h}=this;const{startAngle:l,endAngle:d}=te(this.startAngle,this.endAngle),{innerRadius:u,outerRadius:f}=this.normalizedRadii(),p=this.normalizedClipSector(),y=d-l,g=y>=2*Math.PI-1e-6;if(t.clear(),u===0&&f===0||u>f)return;if((p?.startAngle??l)===(p?.endAngle??d))return;if(g&&this.clipSector==null&&a===0&&c===0&&o===0&&h===0){t.moveTo(i+f*Math.cos(l),n+f*Math.sin(l)),t.arc(i,n,f,l,d),u>s&&(t.moveTo(i+u*Math.cos(d),n+u*Math.sin(d)),t.arc(i,n,u,d,l,!0)),t.closePath();return}else if(this.clipSector==null&&Math.abs(u-f)<1e-6){t.arc(i,n,f,l,d,!1),t.arc(i,n,f,d,l,!0),t.closePath();return}const m=this.getAngleOffset(u),x=this.getAngleOffset(f);if(y<2*x)return;const P=(p?.innerRadius??u)>s,k=u<s||y<2*m,A=f-u,v=Math.max(a,o,c,h),S=v>0?Math.min(A/v,1):1;a*=S,c*=S,o*=S,h*=S;const C=Vi(f,y-2*x,-a,-c);if(a*=C,c*=C,!k&&P){const I=Vi(u,y-2*m,o,h);o*=I,h*=I}else o=0,h=0;const D=Math.max(a+o,c+h),R=D>0?Math.min(A/D,1):1;a*=R,c*=R,o*=R,h*=R;let N=0,z=0;const ft=a/(f-a),pt=c/(f-c);if(ft>=0&&ft<1-1e-6)N=Math.asin(ft);else{N=y/2;const I=f/(1/Math.sin(N)+1);a=Math.min(I,a)}if(pt>=0&&pt<1-1e-6)z=Math.asin(pt);else{z=y/2;const I=f/(1/Math.sin(z)+1);c=Math.min(I,c)}const St=Math.asin(o/(u+o)),Ct=Math.asin(h/(u+h)),wt=p?.outerRadius??f,Pt=this.getAngleOffset(wt),nt=new Ge(0,0,wt,l+Pt,d-Pt),je=p?.innerRadius??u,Ye=this.getAngleOffset(je),Q=P?new Ge(0,0,je,l+Ye,d-Ye):void 0;p!=null&&(nt.clipStart(p.startAngle),nt.clipEnd(p.endAngle),Q?.clipStart(p.startAngle),Q?.clipEnd(p.endAngle));const Xe=this.arc(a,N,l-Math.PI*.5,l+N,nt,Q,!0,!1),Ue=this.arc(c,z,d-z,d+Math.PI*.5,nt,Q,!1,!1),Ve=this.arc(h,Ct,d+Math.PI*.5,d+Math.PI-Ct,nt,Q,!1,!0),se=this.arc(o,St,l+Math.PI+St,l+Math.PI*1.5,nt,Q,!0,!0);if(k){const I=y<Math.PI*.5?r*(1+Math.cos(y))/Math.sin(y):NaN;let E;I>0&&I<f?E=Math.max(Math.hypot(r,I),u):E=r,E=Math.max(E,u);const q=l+y*.5;t.moveTo(i+E*Math.cos(q),n+E*Math.sin(q))}else if(!(se?.isValid()===!0||Q?.isValid()===!0)){const I=l+y/2,E=u*Math.cos(I),q=u*Math.sin(I);t.moveTo(i+E,n+q)}if(Xe?.isValid()===!0){const{cx:I,cy:E,r:q,a0:ot,a1:ct}=Xe;t.arc(i+I,n+E,q,ot,ct)}if(nt.isValid()){const{r:I,a0:E,a1:q}=nt;t.arc(i,n,I,E,q)}if(Ue?.isValid()===!0){const{cx:I,cy:E,r:q,a0:ot,a1:ct}=Ue;t.arc(i+I,n+E,q,ot,ct)}if(!k){if(Ve?.isValid()===!0){const{cx:I,cy:E,r:q,a0:ot,a1:ct}=Ve;t.arc(i+I,n+E,q,ot,ct)}if(Q?.isValid()===!0){const{r:I,a0:E,a1:q}=Q;t.arc(i,n,I,q,E,!0)}if(se?.isValid()===!0){const{cx:I,cy:E,r:q,a0:ot,a1:ct}=se;t.arc(i+I,n+E,q,ot,ct)}}t.closePath()}isPointInPath(e,t){const{startAngle:i,endAngle:n,innerRadius:s,outerRadius:r}=this.clipSector??this;return Ui(e-this.centerX,t-this.centerY,{startAngle:i,endAngle:n,innerRadius:Math.min(s,r),outerRadius:Math.max(s,r)})}};Y.className="Sector",b([M()],Y.prototype,"centerX",2),b([M()],Y.prototype,"centerY",2),b([M()],Y.prototype,"innerRadius",2),b([M()],Y.prototype,"outerRadius",2),b([M()],Y.prototype,"startAngle",2),b([M()],Y.prototype,"endAngle",2),b([tt({equals:(e,t)=>e.equals(t)})],Y.prototype,"clipSector",2),b([M()],Y.prototype,"concentricEdgeInset",2),b([M()],Y.prototype,"radialEdgeInset",2),b([M()],Y.prototype,"startOuterCornerRadius",2),b([M()],Y.prototype,"endOuterCornerRadius",2),b([M()],Y.prototype,"startInnerCornerRadius",2),b([M()],Y.prototype,"endInnerCornerRadius",2);export{it as Arc,W as BBox,$ as Caption,qs as CategoryScale,U as Group,Mt as Line,Ks as LinearScale,Xt as Marker,Z as Path,K as RadialColumnShape,V as Rect,Yi as Scene,Y as Sector,_ as Shape,ys as TranslatableGroup,hr as getRadialColumnWidth,J as toRadians};