ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
5 lines • 128 kB
JavaScript
var cn=Object.defineProperty,hn=Object.getOwnPropertyDescriptor,x=(e,t,i,n)=>{for(var s=n>1?void 0:n?hn(t,i):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(s=(n?o(t,i,s):o(s))||s);return n&&s&&cn(t,i,s),s};import{createId as ln,isArray as un,toPlainText as Qe}from"ag-charts-core";import{Logger as dn,createId as fn,createSvgElement as ti}from"ag-charts-core";import{isObject as ei,isPlainObject as pt}from"ag-charts-core";var ii=Symbol("BREAK"),Tt="__decorator_config",zt="__decorator_accessors";function gn(e,t){oe(e,t).optional=!0}function oe(e,t){if(Object.getOwnPropertyDescriptor(e,Tt)==null&&Object.defineProperty(e,Tt,{value:{}}),Object.getOwnPropertyDescriptor(e,zt)==null){const l=Object.getPrototypeOf(e)?.[zt]?.slice()??[];Object.defineProperty(e,zt,{value:l})}const i=e[Tt],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,o=s?.set;if(r==null||o==null){const c=e[zt];let l=c.indexOf(t);l===-1&&(l=c.push(t)-1),r??(r=function(){let d=this.__accessors;return d==null&&(d=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:d})),d[l]}),o??(o=function(d){let u=this.__accessors;u==null&&(u=c.slice().fill(void 0),Object.defineProperty(this,"__accessors",{value:u})),u[l]=d})}return Object.defineProperty(e,t,{set:function(c){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(c=f(this,t,c,u),c===ii)return;o.call(this,c);for(const f of d)f(this,c,u)},get:function(){let c=r.call(this);for(const l of i[n].getters)if(c=l(this,t,c),c===ii)return;return c},enumerable:!0,configurable:!1}),i[n]}function pn(e,t,i){return(n,s)=>{const r=oe(n,s);r.setters.push(e),t&&r.getters.unshift(t),i&&Object.assign(r,i)}}function mn(e){return(t,i)=>{oe(t,i).observers.push(e)}}function ae(e){return typeof e<"u"&&Tt in e}function Dt(e){const t=new Set;for(;ae(e);)t.add(e?.[Tt]),e=Object.getPrototypeOf(e);return Array.from(t).flatMap(i=>Object.keys(i))}function ht(e,t){return Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:e.every((i,n)=>ht(i,t[n])):pt(e)?pt(t)?yn(e,t,ht):!1:e===t}function yn(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 ni(...e){const t={};for(const i of e){if(!ei(i))continue;const n=ae(i)?Dt(i):Object.keys(i);for(const s of n)pt(t[s])&&pt(i[s])?t[s]=ni(t[s],i[s]):t[s]??(t[s]=i[s])}return t}function si(...e){const t={};for(const i of e){if(!ei(i))continue;const n=ae(i)?Dt(i):Object.keys(i);for(const s of n)pt(t[s])&&pt(i[s])?t[s]=si(t[s],i[s]):s in t||(t[s]??(t[s]=i[s]))}return t}import{boxContains as xn,boxesEqual as bn,clamp as mt}from"ag-charts-core";var ri=Symbol("interpolate");function Mn(e,t,i,n=1/0){const s={nearest:void 0,distanceSquared:n};for(const r of i){const o=r.distanceSquared(e,t);if(o===0)return{nearest:r,distanceSquared:0};o<s.distanceSquared&&(s.nearest=r,s.distanceSquared=o)}return s}var Ft=class St{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 St(t,i,n,s)}static merge(t){let i=1/0,n=1/0,s=-1/0,r=-1/0;for(const o of t)o.x<i&&(i=o.x),o.y<n&&(n=o.y),o.x+o.width>s&&(s=o.x+o.width),o.y+o.height>r&&(r=o.y+o.height);return new St(i,n,s-i,r-n)}static nearestBox(t,i,n){return Mn(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 St(t,i,n,s)}equals(t){return bn(this,t)}containsPoint(t,i){return xn(this,t,i)}intersection(t){if(!this.collidesBBox(t))return;const i=mt(t.x,this.x,t.x+t.width),n=mt(t.y,this.y,t.y+t.height),s=mt(t.x,this.x+this.width,t.x+t.width),r=mt(t.y,this.y+this.height,t.y+t.height);return new St(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-mt(this.x,t,this.x+this.width),s=i-mt(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}[ri](t,i){return new St(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)}};Ft.zero=Object.freeze(new Ft(0,0,0,0)),Ft.NaN=Object.freeze(new Ft(NaN,NaN,NaN,NaN));var W=Ft;import{arraysEqual as vn}from"ag-charts-core";var ce=(e,t)=>e===t;function b(e){return function(t,i){const n=`__${i}`;t[i]||wn(t,i,n,e)}}function Sn(e){return b(e)}function tt(e){return b(e)}function Cn(e){const t=e??{};return t.equals=vn,b(e)}function wn(e,t,i,n){const{changeCb:s,convertor:r,checkDirtyOnAssignment:o=!1}=n??{},h={changeCb:s,checkDirtyOnAssignment:o,convertor:r},a=An(i,kn(Pn(Tn(i,h),h),h),h);Object.defineProperty(e,t,{set:a,get:function(){return this[i]},enumerable:!0,configurable:!0})}function Pn(e,t){const{convertor:i}=t;return i?function(n){e.call(this,i(n))}:e}var oi=Symbol("no-change");function kn(e,t){const{changeCb:i}=t;return i?function(n){const s=e.call(this,n);return s!==oi&&i.call(this,this),s}:e}function An(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 Tn(e,t){const{equals:i=ce}=t;return function(n){const s=this[e];return i(n,s)?oi:(this[e]=n,this.onChangeDetection(e),n)}}var he=(e,t)=>Math.sign(e-t);function Dn(e,t){if(typeof e=="number"&&typeof t=="number")return he(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 o=he(i[r],n[r]);if(o!==0)return o}return he(i.length,n.length)}var Fn=5,Rt=class $e{constructor(t){this.serialNumber=$e._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=fn(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,this.scene=t?.scene,(t?.debugDirty??$e._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=ti("svg");if(r.setAttribute("width",String(i)),r.setAttribute("height",String(n)),r.setAttribute("viewBox",`0 0 ${i} ${n}`),r.setAttribute("overflow","visible"),s.defs?.length){const o=ti("defs");o.append(...s.defs),r.append(o)}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>=Fn)throw i.errorCount=n,i;dn.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??(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(){}};Rt._nextSerialNumber=0,Rt._debugEnabled=!1,x([b()],Rt.prototype,"visible",2),x([tt({equals:ht,changeCb:e=>e.onZIndexChange()})],Rt.prototype,"zIndex",2);var It=Rt;import{createSvgElement as ai,isArray as le,isString as Rn,toPlainText as In}from"ag-charts-core";import{Logger as ue,getWindow as On,toArray as ci}from"ag-charts-core";var Bn=2e3,hi=Date.now(),Nn=()=>{const e=Date.now()-hi;if(e>Bn){const t=(Math.floor(e/100)/10).toFixed(1);ue.log(`**** ${t}s since last log message ****`)}hi=Date.now()},j={create(...e){return Object.assign((...i)=>{j.check(...e)&&(typeof i[0]=="function"&&(i=ci(i[0]())),Nn(),ue.log(...i))},{check:()=>j.check(...e),group:(i,n)=>j.check(...e)?ue.logGroup(i,n):n()})},check(...e){return e.length===0&&e.push(!0),ci(On("agChartsDebug")).some(i=>e.includes(i))},inDevelopmentMode(e){if(j.check("dev"))return e()}};function En(e=0,t=0){return new OffscreenCanvas(e,t).getContext("2d")}var li=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()}},de=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=O.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=En();n.font=e,n.textAlign=t.textAlign??"start",n.textBaseline=t.textBaseline??"top";const s=new Ln(n,t);return this.instanceMap.set(i,s),s}};de.instanceMap=new li(10);var Ln=class{constructor(e,t){this.ctx=e,this.measureMap=new li(100),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline),e.font=O.toFontString(t.font),this.textMeasurer=new ui(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)}},O=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}}};O.EllipsisChar="\u2026",O.defaultLineHeight=1.15,O.lineSplitter=/\r?\n/g;var ui=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,o=0;const h=O.getVerticalModifier(this.textBaseline),a=[];let c=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),c===0?(i+=u.actualBoundingBoxAscent,n+=u.actualBoundingBoxAscent,o=u.alphabeticBaseline):r+=u.fontBoundingBoxAscent,c===l-1?i+=u.actualBoundingBoxDescent:r+=u.fontBoundingBoxDescent,a.push({text:d,width:u.width,height:u.actualBoundingBoxAscent+u.actualBoundingBoxDescent,lineHeight:u.fontBoundingBoxAscent+u.fontBoundingBoxDescent,offsetTop:u.actualBoundingBoxAscent,offsetLeft:u.actualBoundingBoxLeft}),c++}return i+=r,n+=r*h,{width:t,height:i,offsetTop:n,offsetLeft:s,alphabeticBaseline:o,lineMetrics:a}}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(O.lineSplitter):e;return this.getMultilineMetrics(t)}charWidth(e){const{width:t}=this.measureTextFn(e);return this.charMap.set(e,t),t}};import{clamp as _n,toIterable as zn}from"ag-charts-core";function di({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 fi(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 gi(e,t,i){return[Math.floor(e*i),Math.floor(t*i)]}var fe=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,o]=gi(t,i,n);this.canvas=new OffscreenCanvas(r,o),this.context=this.canvas.getContext("2d",{willReadFrequently:s}),this.context.setTransform(n,0,0,n,0,0),fi(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,o]=gi(e,t,i);n.width=r,n.height=o}s.setTransform(i,0,0,i,0,0),this.width=e,this.height=t,this.pixelRatio=i}clear(){di(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 Wn,clamp as Gn,generateUUID as ge,isString as qn}from"ag-charts-core";import{createSvgElement as Hn}from"ag-charts-core";var lt=Math.PI*2,Er=Math.PI/2;function G(e){return e%=lt,e+=lt,e%=lt,e}function pi(e){return e%=lt,e<-Math.PI?e+=lt:e>=Math.PI&&(e-=lt),e}function Wt(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:t!==i}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 me,clamp as jn}from"ag-charts-core";import{clamp as et}from"ag-charts-core";var ut=(e,t,i)=>e*(1-i)+t*i,ye=e=>{const t=e<0?-1:1,i=Math.abs(e);return i<=.04045?e/12.92:t*((i+.055)/1.055)**2.4},xe=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},mi=class D{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?!!D.parseHex(t):t.indexOf("rgb")>=0?!!D.stringToRgba(t):D.nameToHex.has(t.toLowerCase())}static fromString(t){if(t.indexOf("#")>=0)return D.fromHexString(t);const i=D.nameToHex.get(t.toLowerCase());if(i)return D.fromHexString(i);if(t.indexOf("rgb")>=0)return D.fromRgbaString(t);throw new Error(`Invalid color string: '${t}'`)}static parseHex(t){t=t.replace(/ /g,"").slice(1);let 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=D.parseHex(t);if(i){const[n,s,r,o]=i;return new D(n/255,s/255,r/255,o/255)}throw new Error(`Malformed hexadecimal color string: '${t}'`)}static stringToRgba(t){let i=-1,n=-1;for(let h=0;h<t.length;h++){const a=t[h];if(i===-1&&a==="(")i=h;else if(a===")"){n=h;break}}if(i===-1||n===-1)return;const r=t.substring(i+1,n).split(","),o=[];for(let h=0;h<r.length;h++){const a=r[h];let c=parseFloat(a);if(!Number.isFinite(c))return;a.indexOf("%")>=0?(c=et(0,c,100),c/=100):h===3?c=et(0,c,1):(c=et(0,c,255),c/=255),o.push(c)}return o}static fromRgbaString(t){const i=D.stringToRgba(t);if(i){if(i.length===3)return new D(i[0],i[1],i[2]);if(i.length===4)return new D(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 D(t[0],t[1],t[2],t[3]);if(t.length===3)return new D(t[0],t[1],t[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(t,i,n,s=1){const r=D.HSBtoRGB(t,i,n);return new D(r[0],r[1],r[2],s)}static fromHSL(t,i,n,s=1){const r=D.HSLtoRGB(t,i,n);return new D(r[0],r[1],r[2],s)}static fromOKLCH(t,i,n,s=1){const r=D.OKLCHtoRGB(t,i,n);return new D(r[0],r[1],r[2],s)}static padHex(t){return t.length===1?"0"+t:t}toHexString(){let t="#"+D.padHex(Math.round(this.r*255).toString(16))+D.padHex(Math.round(this.g*255).toString(16))+D.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(t+=D.padHex(Math.round(this.a*255).toString(16))),t}toRgbaString(t=3){const 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 D.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(t,i,n){const s=ye(t),r=ye(i),o=ye(n),h=Math.cbrt(.4122214708*s+.5363325363*r+.0514459929*o),a=Math.cbrt(.2119034982*s+.6806995451*r+.1073969566*o),c=Math.cbrt(.0883024619*s+.2817188376*r+.6299787005*o),l=.2104542553*h+.793617785*a-.0040720468*c,d=1.9779984951*h-2.428592205*a+.4505937099*c,u=.0259040371*h+.7827717662*a-.808675766*c,f=Math.atan2(u,d)*180/Math.PI,g=l,p=Math.hypot(d,u),y=f>=0?f:f+360;return[g,p,y]}static OKLCHtoRGB(t,i,n){const s=t,r=i*Math.cos(n*Math.PI/180),o=i*Math.sin(n*Math.PI/180),h=(s+.3963377774*r+.2158037573*o)**3,a=(s-.1055613458*r-.0638541728*o)**3,c=(s-.0894841775*r-1.291485548*o)**3,l=4.0767416621*h-3.3077115913*a+.2309699292*c,d=-1.2684380046*h+2.6097574011*a-.3413193965*c,u=-.0041960863*h-.7034186147*a+1.707614701*c,f=xe(l),g=xe(d),p=xe(u);return[f,g,p]}static RGBtoHSL(t,i,n){const s=Math.min(t,i,n),r=Math.max(t,i,n),o=(r+s)/2;let h,a;if(r===s)h=0,a=0;else{const c=r-s;a=o>.5?c/(2-r-s):c/(r+s),r===t?h=(i-n)/c+(i<n?6:0):r===i?h=(n-t)/c+2:h=(t-i)/c+4,h*=360/6}return[h,a,o]}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 o(l){return l<0&&(l+=1),l>1&&(l-=1),l<1/6?r+(s-r)*6*l:l<1/2?s:l<2/3?r+(s-r)*(2/3-l)*6:r}const h=o(t/360+1/3),a=o(t/360),c=o(t/360-1/3);return[h,a,c]}static RGBtoHSB(t,i,n){const s=Math.min(t,i,n),r=Math.max(t,i,n),o=r===0?0:(r-s)/r;let h=0;if(s!==r){const a=r-s,c=(r-t)/a,l=(r-i)/a,d=(r-n)/a;t===r?h=d-l:i===r?h=2+c-d:h=4+l-c,h/=6,h<0&&(h=h+1)}return[h*360,o,r]}static HSBtoRGB(t,i,n){t=(t%360+360)%360/360;let s=0,r=0,o=0;if(i===0)s=r=o=n;else{const h=(t-Math.floor(t))*6,a=h-Math.floor(h),c=n*(1-i),l=n*(1-i*a),d=n*(1-i*(1-a));switch(h>>0){case 0:s=n,r=d,o=c;break;case 1:s=l,r=n,o=c;break;case 2:s=c,r=n,o=d;break;case 3:s=c,r=l,o=n;break;case 4:s=d,r=c,o=n;break;case 5:s=n,r=c,o=l;break}}return[s,r,o]}static mix(t,i,n){return new D(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=D.RGBtoOKLCH(t.r,t.g,t.b);return D.fromOKLCH(et(0,n[0]+i,1),n[1],n[2])}static darken(t,i){const n=D.RGBtoOKLCH(t.r,t.g,t.b);return D.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=>D.RGBtoOKLCH(r.r,r.g,r.b));return Array.from({length:i},(r,o)=>{const h=o/(i-1),a=t.length<=2?0:Math.min(Math.floor(h*(t.length-1)),t.length-2),c=(h-a*n)/n,l=s[a],d=s[a+1];return D.fromOKLCH(ut(l[0],d[0],c),ut(l[1],d[1],c),ut(l[2],d[2],c))})}};mi.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=mi,Me=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})},yi=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}},ve=1e-6,xi=e=>e.c<ve||e.l<ve||e.l>1-ve,Yn=(e,t,i)=>{i=jn(0,i,1);let n;if(xi(e))n=t.h;else if(xi(t))n=e.h;else{const h=e.h;let a=t.h;const c=t.h-e.h;c>180?a-=360:c<-180&&(a+=360),n=h*(1-i)+a*i}const s=e.c*(1-i)+t.c*i,r=e.l*(1-i)+t.l*i,o=e.a*(1-i)+t.a*i;return be.fromOKLCH(r,s,n,o)},Ht=class extends Me{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(yi)}update(){const{domain:e,range:t}=this;e.length<2&&(me.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){me.warnOnce("`colorDomain` values should be supplied in ascending order."),e.sort((r,o)=>r-o);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(yi)}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),o=i[0],h=i[i.length-1];if(e<=s)return o;if(e>=r)return h;let a,c;if(t.length===2){const u=(e-s)/(r-s),f=1/(i.length-1);a=i.length<=2?0:Math.min(Math.floor(u*(i.length-1)),i.length-2),c=(u-a*f)/f}else{for(a=0;a<t.length-2&&!(e<t[a+1]);a++);const u=t[a],f=t[a+1];c=(e-u)/(f-u)}const l=n[a],d=n[a+1];return Yn(l,d,c).toRgbaString()}invert(){}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&me.warnOnce("Expected update to not invalidate scale"))}};x([qt],Ht.prototype,"domain",2),x([qt],Ht.prototype,"range",2);var Se=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 o=this.createCanvasGradient(e,n,i);if(o==null)return;const h=r==="oklch",a=.05;let c=s[0];o.addColorStop(c.stop,c.color);for(let l=1;l<s.length;l+=1){const d=s[l];if(h){const u=new Ht;u.domain=[c.stop,d.stop],u.range=[c.color,d.color];for(let f=c.stop+a;f<d.stop;f+=a)o.addColorStop(f,u.convert(f))}o.addColorStop(d.stop,d.color),c=d}return"createPattern"in o&&(o=o.createPattern()),this._cache={ctx:e,bbox:n,gradient:o},o}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}},Xn=class extends Se{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),o=i?.centerX??t.x+t.width*.5,h=i?.centerY??t.y+t.height*.5;return e.createConicGradient(r,o,h)}createSvgGradient(e){return Hn("linearGradient")}};import{createSvgElement as Un}from"ag-charts-core";var Vn=class extends Se{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),o=e.width,h=e.height,a=e.x+o*.5,c=e.y+h*.5,l=Math.sqrt(h*h+o*o)/2,d=Math.atan2(h,o);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:a+s*f,y0:c+r*f,x1:a-s*f,y1:c-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=Un("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 Kn}from"ag-charts-core";var Jn=class extends Se{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,o=i?.outerRadius??Math.hypot(t.width*.5,t.height*.5)/Math.SQRT2;return e.createRadialGradient(n,s,r,n,s,o)}createSvgGradient(e){const t=e.x+e.width*.5,i=e.y+e.height*.5,n=Kn("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 Zn}from"ag-charts-core";import{Logger as Ce,isArray as Qn,isPlainObject as ts}from"ag-charts-core";var H=gn,we=class{handleUnknownProperties(e,t){}set(e){const{className:t=this.constructor.name}=this.constructor;if(e==null)return this.clear(),this;if(typeof e!="object")return Ce.warn(`unable to set ${t} - expecting a properties object`),this;const i=new Set(Object.keys(e));for(const n of Dt(this))if(i.has(n)){const s=e[n],r=this;if(Pe(r[n]))if(r[n]instanceof bi){const o=r[n].reset(s);o==null?Ce.warn(`unable to set [${String(n)}] - expecting a properties array`):r[n]=o}else r[n].set(s);else ts(s)?r[n]=si(s,r[n]??{}):r[n]=s;i.delete(n)}this.handleUnknownProperties(i,e);for(const n of i)Ce.warn(`unable to set [${String(n)}] in ${t} - property is unknown`);return this}clear(){for(const e of Dt(this)){const t=this[e];Pe(t)?t.clear():this[e]=void 0}return this}toJson(){return Dt(this).reduce((e,t)=>{const i=this[t];return e[String(t)]=Pe(i)?i.toJson():i,e},{})}},bi=class rn 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(Qn(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 rn(this.itemFactory,...t)}toJson(){return this.map(t=>t?.toJson?.()??t)}};function Pe(e){return e instanceof we||e instanceof bi}var Mi=class extends we{constructor(){super(...arguments),this.color="black"}};x([H],Mi.prototype,"stop",2),x([H],Mi.prototype,"color",2);function es(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 vi(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 is(e,t){const i=t==="discrete"?1:0,n=e.map((s,r,{length:o})=>({stop:(r+i)/(o-1+i),color:s}));return t==="discrete"?vi(n):n}function ns(e,t,i,n="continuous"){const s=e.map(g=>typeof g=="string"?{color:g}:g);if(s.length===0)return is(t,n);if(!es(s))return Zn.warnOnce("[fills] must have the stops defined in ascending order"),[];const r=Math.min(...i),o=Math.max(...i),h=n==="discrete",a=new Float64Array(s.length);let c=0,l=-1;for(let g=0;g<s.length;g+=1){const p=s[g];if(g>=l){l=s.length-1;for(let m=g+1;m<s.length;m+=1)if(s[m]?.stop!=null){l=m;break}}let y=p?.stop;if(y==null){const m=s[c]?.stop,M=s[l]?.stop,w=m??r,P=M??o,A=h&&m==null?1:0;y=w+(P-w)*(g-c+A)/(l-c+A)}else c=g;a[g]=Math.max(0,Math.min(1,(y-r)/(o-r)))}let d=s.find(g=>g.color!=null)?.color,u;const f=s.map((g,p)=>{let y=g?.color;const m=a[p];return y!=null?d=y:d!=null?y=d:(u==null&&(u=new Ht,u.domain=[0,1],u.range=t),y=u.convert(m)),{stop:m,color:y}});return n==="discrete"?vi(f):f}import{Logger as ss,createSvgElement as ke}from"ag-charts-core";var rs=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?(ss.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,o=t,h=1;const a=i/n,c=e/t;return s==="stretch"||e===0||t===0?(r=i,o=n):s==="contain"?h=c>a?i/e:n/t:s==="cover"&&(h=c>a?n/t:i/e),[Math.max(1,r*h),Math.max(1,o*h)]}setImageTransform(e,t){if(typeof e=="string")return;const{url:i,rotation:n,width:s,height:r}=this,o=this.imageLoader?.loadImage(i);if(!o)return;const h=Gt(n),a=Math.cos(h),c=Math.sin(h),[l,d]=this.getSize(o.width,o.height,s??t.width,r??t.height),u=l/o.width,f=d/o.height,g=t.x+t.width/2,p=t.y+t.height/2,y=a*l-c*d,m=c*l+a*d,M=y/2,w=m/2;e?.setTransform(new DOMMatrix([a*u,c*f,-c*u,a*f,g-M,p-w]))}createPattern(e,t,i,n){const s=this.width??t,r=this.height??i,o=this._cache;if(o!=null&&o.ctx===e&&o.width===s&&o.height===r)return o.pattern;const h=this.imageLoader?.loadImage(this.url,n),a=this.createCanvasImage(e,h,s,r);if(a!=null)return this._cache={ctx:e,pattern:a,width:s,height:r},a}toSvg(e,t){const{url:i,rotation:n,backgroundFill:s,backgroundFillOpacity:r}=this,{x:o,y:h,width:a,height:c}=e,l=ke("pattern");l.setAttribute("viewBox",`0 0 ${a} ${c}`),l.setAttribute("x",String(o)),l.setAttribute("y",String(h)),l.setAttribute("width",String(a)),l.setAttribute("height",String(c)),l.setAttribute("patternUnits","userSpaceOnUse");const d=ke("rect");d.setAttribute("x","0"),d.setAttribute("y","0"),d.setAttribute("width",String(a)),d.setAttribute("height",String(c)),d.setAttribute("fill",s),d.setAttribute("fill-opacity",String(r)),l.appendChild(d);const u=ke("image");return u.setAttribute("href",i),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("width",String(a)),u.setAttribute("height",String(c)),u.setAttribute("preserveAspectRatio","none"),u.setAttribute("transform",`scale(${1/t}) rotate(${n}, ${a/2}, ${c/2})`),l.appendChild(u),l}};import{Logger as os,createSvgElement as Ae}from"ag-charts-core";function Si(e,t,i,n){const s=e-i,r=t-n;return s*s+r*r}function Te(e,t,i,n,s,r,o){if(i===s&&n===r)return Math.min(o,Si(e,t,i,n));const h=s-i,a=r-n,c=Math.max(0,Math.min(1,((e-i)*h+(t-n)*a)/(h*h+a*a))),l=i+c*h,d=n+c*a;return Math.min(o,Si(e,t,l,d))}import{Logger as Ci}from"ag-charts-core";var as=/^[\t\n\f\r ]*([achlmqstvz])[\t\n\f\r ]*/i,F=/^[+-]?((\d*\.\d+)|(\d+\.)|(\d+))(e[+-]?\d+)?/i,cs=/[\t\n\f\r ]*,?[\t\n\f\r ]*/,wi=/^[01]/,hs={z:[],h:[F],v:[F],m:[F,F],l:[F,F],t:[F,F],s:[F,F,F,F],q:[F,F,F,F],c:[F,F,F,F,F,F],a:[F,F,F,wi,wi,F,F]};function ls(e){if(!e)return;const t=[];let i=0,n;for(;i<e.length;){const s=as.exec(e.slice(i));let r;if(s==null){if(!n){Ci.warnOnce(`Invalid SVG path, error at index ${i}: Missing command.`);return}r=n}else r=s[1],i+=s[0].length;const o=us(r,e,i);if(!o)return;i=o[0],n=r,t.push(o[1])}return t}function us(e,t,i){const n=hs[e.toLocaleLowerCase()],s={command:e,params:[]};for(const r of n){const o=t.slice(i),h=r.exec(o);if(h!=null){s.params.push(parseFloat(h[0])),i+=h[0].length;const a=cs.exec(o.slice(h[0].length));a!=null&&(i+=a[0].length)}else{if(s.params.length===1)return[i,s];Ci.warnOnce(`Invalid SVG path, error at index ${i}: No path segment parameters for command [${e}]`);return}}return[i,s]}function ds(e,t){const i=-t/e;return e!==0&&i>=0&&i<=1?[i]:[]}function fs(e,t,i,n=1e-6){if(Math.abs(e)<n)return ds(t,i);const s=t*t-4*e*i,r=[];if(Math.abs(s)<n){const o=-t/(2*e);o>=0&&o<=1&&r.push(o)}else if(s>0){const o=Math.sqrt(s),h=(-t-o)/(2*e),a=(-t+o)/(2*e);h>=0&&h<=1&&r.push(h),a>=0&&a<=1&&r.push(a)}return r}function gs(e,t,i,n,s=1e-6){if(Math.abs(e)<s)return fs(t,i,n,s);const r=t/e,o=i/e,h=n/e,a=(3*o-r*r)/9,c=(9*r*o-27*h-2*r*r*r)/54,l=a*a*a+c*c,d=1/3,u=[];if(l>=0){const f=Math.sqrt(l),g=Math.sign(c+f)*Math.pow(Math.abs(c+f),d),p=Math.sign(c-f)*Math.pow(Math.abs(c-f),d),y=Math.abs(Math.sqrt(3)*(g-p)/2),m=-d*r+(g+p);if(m>=0&&m<=1&&u.push(m),Math.abs(y)<s){const M=-d*r-(g+p)/2;M>=0&&M<=1&&u.push(M)}}else{const f=Math.acos(c/Math.sqrt(-a*a*a)),g=d*r,p=2*Math.sqrt(-a),y=p*Math.cos(d*f)-g,m=p*Math.cos(d*(f+2*Math.PI))-g,M=p*Math.cos(d*(f+4*Math.PI))-g;y>=0&&y<=1&&u.push(y),m>=0&&m<=1&&u.push(m),M>=0&&M<=1&&u.push(M)}return u}function De(e,t,i,n,s,r,o,h){const a=(i-e)*(h-r)-(n-t)*(o-s);if(a===0)return 0;const c=((o-s)*(t-r)-(e-s)*(h-r))/a,l=((i-e)*(t-r)-(n-t)*(e-s))/a;return c>=0&&c<=1&&l>=0&&l<=1?1:0}function ps(e,t,i,n,s,r,o,h,a,c,l,d){let u=0;const f=c-d,g=l-a,p=a*(d-c)-c*(l-a),y=Pi(e,i,s,o),m=Pi(t,n,r,h),M=f*y[0]+g*m[0],w=f*y[1]+g*m[1],P=f*y[2]+g*m[2],A=f*y[3]+g*m[3]+p,k=gs(M,w,P,A);for(const v of k){const S=v*v,C=v*S,T=y[0]*C+y[1]*S+y[2]*v+y[3],R=m[0]*C+m[1]*S+m[2]*v+m[3];let N;a===l?N=(R-c)/(d-c):N=(T-a)/(l-a),N>=0&&N<=1&&u++}return u}function Pi(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 ms}from"ag-charts-core";function $t(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 ys(e,t,i,n,s,r,o,h,a){const c=(1-a)*e+a*i,l=(1-a)*t+a*n,d=(1-a)*i+a*s,u=(1-a)*n+a*r,f=(1-a)*s+a*o,g=(1-a)*r+a*h,p=(1-a)*c+a*d,y=(1-a)*l+a*u,m=(1-a)*d+a*f,M=(1-a)*u+a*g,w=(1-a)*p+a*m,P=(1-a)*y+a*M;return[[{x:e,y:t},{x:c,y:l},{x:p,y},{x:w,y:P}],[{x:w,y:P},{x:m,y:M},{x:f,y:g},{x:o,y:h}]]}function ki(e,t,i,n){const s=-e+3*t-3*i+n,r=2*(e-2*t+i),o=-e+t;if(s===0){if(r!==0){const a=-o/r;if(a>0&&a<1)return[a]}return[]}const h=r*r-4*s*o;if(h>=0){const a=Math.sqrt(h),c=(-r+a)/(2*s),l=(-r-a)/(2*s);return[c,l].filter(d=>d>0&&d<1)}return[]}function xs(e,t,i,n,s,r,o,h){const a=ki(e,i,s,o),c=ki(t,n,r,h);return[...a,...c]}function Fe(e,t,i){const n=$t(e[0].x,e[1].x,e[2].x,e[3].x,.5),s=$t(e[0].y,e[1].y,e[2].y,e[3].y,.5),r=Math.hypot(n-t,s-i),o=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:o}}function bs(e,t,i,n,s,r,o,h,a,c,l=1){let u={value:Fe([{x:e,y:t},{x:i,y:n},{x:s,y:r},{x:o,y:h}],a,c),next:null},f;for(;u!=null;){const{points:g,distance:p,minDistance:y}=u.value;if(u=u.next,(f==null||p<f.distance)&&(f={distance:p,minDistance:y}),f!=null&&f.distance-y<=l)continue;const[m,M]=ys(g[0].x,g[0].y,g[1].x,g[1].y,g[2].x,g[2].y,g[3].x,g[3].y,.5),w=[Fe(m,a,c),Fe(M,a,c)].sort(Ai);u=ms(u,w,Ai)}return f?.distance??1/0}var Ai=(e,t)=>t.minDistance-e.minDistance,Ot=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,o,h=!1){const a=i,c=n/i,l=Math.cos(s),d=Math.sin(s),u=-c*d,f=c*l,g=a*Math.cos(r),p=a*Math.sin(r),y=e+l*g+u*p,m=t+d*g+f*p,M=(y-this.cx)**2+(m-this.cy)**2;this.openedPath?M>1e-6&&this.lineTo(y,m):this.moveTo(y,m);let w=h?-G(r-o):G(o-r);Math.abs(Math.abs(o-r)-2*Math.PI)<1e-6&&w<2*Math.PI&&(w+=2*Math.PI*(h?-1:1));const P=Math.max(Math.ceil(Math.abs(w)/(Math.PI/2)),1),A=w/P,k=4/3*Math.tan(A/4);for(let v=0;v<P;v+=1){const S=r+A*(v+0),C=r+A*(v+1),T=a*Math.sin(S),R=a*Math.cos(S),N=a*Math.sin(C),z=a*Math.cos(C),ft=R-k*T,gt=T+k*R,wt=z+k*N,Pt=N-k*z,kt=z,At=N;this.cubicCurveTo(e+l*ft+u*gt,t+d*ft+f*gt,e+l*wt+u*Pt,t+d*wt+f*Pt,e+l*kt+u*At,t+d*kt+f*At)}}arc(e,t,i,n,s,r){this.ellipse(e,t,i,i,0,n,s,r)}appendSvg(e){const t=ls(e);if(t==null)return!1;let i=0,n=0,s,r,o=0,h=0;for(const{command:a,params:c}of t){s??(s=c[0]),r??(r=c[1]);const l=a===a.toLowerCase(),d=l?s:0,u=l?r:0;switch(a.toLowerCase()){case"m":this.moveTo(d+c[0],u+c[1]),s=d+c[0],r=u+c[1],i=s,n=r;break;case"c":this.cubicCurveTo(d+c[0],u+c[1],d+c[2],u+c[3],d+c[4],u+c[5]),o=d+c[2],h=u+c[3],s=d+c[4],r=u+c[5];break;case"s":this.cubicCurveTo(s+s-o,r+r-h,d+c[0],u+c[1],d+c[2],u+c[3]),o=d+c[0],h=u+c[1],s=d+c[2],r=u+c[3];break;case"q":this.cubicCurveTo((d+2*c[0])/3,(u+2*c[1])/3,(2*c[0]+c[2])/3,(2*c[1]+c[3])/3,c[2],c[3]),o=c[0],h=c[1],s=c[2],r=c[3];break;case"t":this.cubicCurveTo((s+2*(s+s-o))/3,(r+2*(r+r-h))/3,(2*(s+s-o)+c[0])/3,(2*(r+r-h)+c[1])/3,c[0],c[1]),o=s+s-o,h=r+r-h,s=c[0],r=c[1];break;case"a":this.svgEllipse(s,r,c[0],c[1],c[2]*Math.PI/180,c[3],c[4],d+c[5],u+c[6]),s=d+c[5],r=u+c[6];break;case"h":this.lineTo(d+c[0],r),s=d+c[0];break;case"l":this.lineTo(d+c[0],u+c[1]),s=d+c[0],r=u+c[1];break;case"v":this.lineTo(s,u+c[0]),r=u+c[0];break;case"z":this.closePath(),s=i,r=n;break;default:throw new Error(`Could not translate command '${a}' with '${c.join(" ")}'`)}}return!0}svgEllipse(e,t,i,n,s,r,o,h,a){i=Math.abs(i),n=Math.abs(n);const c=(e-h)/2,l=(t-a)/2,d=Math.sin(s),u=Math.cos(s),f=u*c+d*l,g=-d*c+u*l,p=f/i,y=g/n;let m=p*p+y*y,M=(e+h)/2,w=(t+a)/2,P=0,A=0;m>=1?(m=Math.sqrt(m),i*=m,n*=m):(m=Math.sqrt(1/m-1),r===o&&(m=-m),P=m*i*y,A=-m*n*p,M+=u*P-d*A,w+=d*P+u*A);const k=Math.atan2((g-A)/n,(f-P)/i),v=Math.atan2((-g-A)/n,(-f-P)/i)-k,S=k+v,C=!!(1-o);this.ellipse(M,w,i,n,s,k,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,o=-1e4;let h=NaN,a=NaN,c=0,l=0,d=0;for(let u=0,f=0;u<s;u++)switch(i[u]){case 0:d+=De(h,a,c,l,r,o,e,t),c=n[f++],h=c,l=n[f++],a=l;break;case 1:d+=De(c,l,n[f++],n[f++],r,o,e,t),c=n[f-2],l=n[f-1];break;case 2:d+=ps(c,l,n[f++],n[f++],n[f++],n[f++],n[f++],n[f++],r,o,e,t),c=n[f-2],l=n[f-1];break;case 3:d+=De(h,a,c,l,r,o,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 o=NaN,h=NaN,a=0,c=0;for(let l=0,d=0;l<r;l++)switch(n[l]){case 0:a=o=s[d++],c=h=s[d++];break;case 1:{const M=a,w=c;a=s[d++],c=s[d++],i=Te(e,t,M,w,a,c,i);break}case 2:const u=a,f=c,g=s[d++],p=s[d++],y=s[d++],m=s[d++];a=s[d++],c=s[d++],i=bs(u,f,g,p,y,m,a,c,e,t)**2;break;case 3:i=Te(e,t,a,c,o,h,i);break}return i}toSVG(e=(t,i)=>({x:t,y:i})){const t=[],{commands:i,params:n}=this,s=(o,h)=>{t.push(o);for(let a=0;a<h;a+=2){const{x:c,y:l}=e(n[r++],n[r++]);t.push(c,l)}};let r=0;for(const o of i)switch(o){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],[o,h]=[NaN,NaN],[a,c]=[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),o=u,h=f};let d=0;for(const u of e)switch(u){case 0:l(t[d++],t[d++]),a=o,c=h;break;case 1:l(t[d++],t[d++]);break;case 2:{const f=o,g=h,p=t[d++],y=t[d++],m=t[d++],M=t[d++],w=t[d++],P=t[d++];xs(f,g,p,y,m,M,w,P).forEach(k=>{const v=$t(f,p,m,w,k),S=$t(g,y,M,P,k);l(v,S)}),l(w,P);break}case 3:l(a,c),a=NaN,c=NaN;break}return new W(n,i,s-n,r-i)}};function L(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 Ti(e,t){return Math.floor(t*e)/e}function Re(e,t,i){const{width:n,height:s,padding:r,strokeWidth:o}=t,h=n/2,a=s/2,c=Math.max(1,n-r-o/2),l=Math.max(1,s-r-o/2);let d=!1;for(const[u,f]of i){const g=h+(u-.5)*c,p=a+(f-.5)*l;d?e.lineTo(g,p):e.moveTo(g,p),d=!0}e.closePath()}var Di={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 o=s+r/2;e.moveTo(L(n,o),L(n,o)),e.lineTo(L(n,t-o),L(n,o)),e.lineTo(L(n,t-o),L(n,i-o)),e.lineTo(L(n,o),L(n,i-o)),e.closePath()},triangles(e,t){Re(e,t,[[.5,0],[1,1],[0,1]])},diamonds(e,t){Re(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),o=r/2,h=Math.PI/2;for(let a=0;a<5*2;a++){const c=a%2===0?r:o,l=a*Math.PI/5-h,d=t/2+Math.cos(l)*c,u=i/2+Math.sin(l)*c;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,o=i/2+s/2;e.arc(r-s,o-s,s,J(130),J(330)),e.arc(r+s,o-s,s,J(220),J(50)),e.lineTo(r,o+s),e.closePath()},crosses(e,t){Re(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=L(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=L(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),o=n*Math.sin(s);e.moveTo(-r,o),e.lineTo(r,-o),e.moveTo(-r,i+o),e.lineTo(t+r,-o),e.moveTo(t-r,i+o),e.lineTo(t+r,i-o)},"backward-slanted-lines"(e,{width:t,height:i,strokeWidth:n}){const s=Math.atan2(i,t),r=n*Math.cos(s),o=n*Math.sin(s);e.moveTo(t-r,-o),e.lineTo(t+r,o),e.moveTo(-r,-o),e.lineTo(t+r,i+o),e.moveTo(-r,i-o),e.lineTo(r,i+o)}},Ms=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:o}=this,h=new Ot;let a=Di[t]!=null;return o&&a&&(a=!h.appendSvg(o)),a&&Di[t](h,{width:i,height:n,pixelRatio:e,strokeWidth:r,padding:s}),h}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:o}=this;if(i*s<1||n*s<1)return os.warnOnce("Pattern fill is too small to render, ignoring."),null;const h=new fe({width:i,height:n,pixelRatio:t*s}),a=h.context;r!=="none"&&(a.fillStyle=r,a.globalAlpha=o,a.fillRect(0,0,i,n));const c=this.getPath(t).getPath2D();this.renderFill(c,a),this.renderStroke(c,a);const l=e.createPattern(h.canvas,"repeat");return this.setPatternTransform(l,t),h.destroy(),l}setPatternTransform(e,t,i=0,n=0){if(e==null)return;const s=Gt(this.rotation),r=1/t,o=Math.cos(s)*r,h=Math.sin(s)*r;e.setTransform(new DOMMatrix([o,h,-h,o,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:o,strokeWidth:h,strokeOpacity:a,rotation:c,scale:l}=this,d=Ae("pattern");d.setAttribute("viewBox",`0 0 ${e} ${t}`),d.setAttribute("width",String(e)),d.setAttribute("height",String(t)),d.setAttribute("patternUnits","userSpaceOnUse");const u=Ae("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=Ae("path");return f.setAttribute("fill",i),f.setAttribute("fill-opacity",String(n)),f.setAttribute("stroke-opacity",String(a)),f.setAttribute("stroke",o),f.setAttribute("stroke-width",String(h)),f.setAttribute("transform",`rotate(${c}) scale(${l})`),f.setAttribute("d",this.getPath(1).toSVG()),d.appendChild(f),d}};import{isObject as Ie}from"ag-charts-core";function Fi(e){return Ie(e)&&e.type=="gradient"}function Ri(e){return e!==null&&Ie(e)&&e.type=="pattern"}function Ii(e){return e!==null&&Ie(e)&&e.type=="image"}function Oi(e,t){const{fontStyle:i,fontWeight:n,fontSize:s,fontFamily:r}=t;i&&e.setAttribute("font-style",i),n&&e.setAttribute("font-weight",String(n)),s!=null&&e.setAttribute("font-size",String(s)),r&&e.setAttribute("font-family",r)}function vs(e,t){const{stroke:i,strokeWidth:n,strokeOpacity:s}=t;i&&e.setAttribute("stroke",i),n!=null&&e.setAttribute("stroke-width",String(n)),s!=null&&e.setAttribute("stroke-opacity",String(s))}function Ss(e,t){const{lineDash:i,lineDashOffset:n}=t;if(i?.some(s=>s!==0)){const s=i.length%2===1?[...i,...i]:i;e.setAttribute("stroke-dasharray",s.join(" ")),n!=null&&e.setAttribute("stroke-dashoffset",String(n))}}var _=class extends It{constructor(){super(...arguments),this.fillOpacity=1,this.strokeOpacity=1,this.fill="black",this.strokeWidth=0,this.lineDashOffset=0,this.opacity=1}getGradient(e){if(Fi(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 o=ns(n,["black"],[0,1]);switch(r&&(o=o.map(h=>({color:h.color,stop:1-h.stop})).reverse()),i){case"linear":return new Vn(t,o,s);case"radial":return new Jn(t,o);case"conic":return new Xn(t,o,s)}}getPattern(e){if(Ri(e))return this.createPattern(e)}createPattern(e){return new Ms(e)}getImage(e){if(Ii(e))return this.createImage(e)}createImage(e){return new rs(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 L(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,fillOpacity:n,fillImage:s}=this;if(i!=null&&i!=="none"&&n>0){const{globalAlpha:r}=e;s&&(e.globalAlpha=s.backgroundFillOpacity,e.fillStyle=s.backgroundFill,this.executeFill(e,t),e.globalAlpha=r),this.applyFillAndAlpha(e),this.applyShadow(e),this.executeFill(e,t),e.globalAlpha=r,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:o=1}=this;if(e.globalAlpha*=o*r,i){const{fillBBox:h=this.getDefaultGradientFillBBox()??this.getBBox(),fillParams:a}=this;e.fillStyle=i.createGradient(e,h,a)??"black"}else if(n){const{x:h,y:a}=this.getBBox(),c=this.layerManager?.canvas?.pixelRatio??1,l=n.createPattern(e,c);n.setPatternTransform(l,c,h,a),l?e.fillStyle=l:(e.fillStyle=n.fill,e.globalAlpha*=n.fillOpacity)}else if(s){const h=this.getBBox(),a=s.createPattern(e,h.width,h.height,this);s.setImageTransform(a,h),e.fillStyle=a??"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,strokeOpacity:s,lineDash:r,lineDashOffset:o,lineCap:h,lineJoin:a,miterLimit:c}=this;if(i!=null&&i!=="none"&&n>0&&s>0){const{globalAlpha:l}=e;this.applyStrokeAndAlpha(e),e.lineWidth=n,r&&e.setLineDash(r),o&&(e.lineDashOffset=o),h&&(e.lineCap=h),a&&(e.lineJoin=a),c!=null&&(e.miterLimit=c),this.executeStroke(e,t),e.globalAlpha=l}}executeStroke(e,t){t?e.stroke(t):e.stroke()}getDefaultGradientFillBBox(){return this.cachedDefaultGradientFillBBox??(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(Fi(i)&&this.fillGradient){t??(t=[]);const s=this.fillGradient.toSvg(this.fillBBox??this.getBBox()),r=ge();s.setAttribute("id",r),t.push(s),e.setAttribute("fill",`url(#${r})`)}else if(Ri(i)&&this.fillPattern){t??(t=[]);const s=this.fillPattern.toSvg(),r=ge();s.setAttribute("id",r),t.push(s),e.setAttribute("fill",`url(#${r})`)}else if(Ii(i)&&this.fillImage){t??(t=[]);const s=this.layerManager?.canvas?.pixelRatio??1,r=this.fillImage.toSvg(this.getBBox(),s),o=ge();r.setAttribute("id",o),t.push(r),e.setAttribute("fill",`url(#${o})`)}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;vs(e,{stroke:qn(t)?t:void 0,strokeOpacity:i,strokeWidth:n}),Ss(e,{lineDash:s,lineDashOffset:r})}};x([b()],_.prototype,"fillOpacity",2),x([b()],_.prototype,"strokeOpacity",2),x([tt({equals:ht,changeCb:e=>e.onFillChange()})],_.prototype,"fill",2),x([tt({equals:ht,changeCb:e=>e.onStrokeChange()})],_.prototype,"stroke",2),x([b()],_.prototype,"strokeWidth",2),x([Cn()],_.prototype,"lineDash",2),x([b()],_.prototype,"lineDashOffset",2),x([b()],_.prototype,"lineCap",2),x([b()],_.prototype,"lineJoin",2),x([b()],_.prototype,"miterLimit",2),x([b({convertor:e=>Gn(0,e??1,1)})],_.prototype,"opacity",2),x([tt({equals:ce,checkDirtyOnAssignment:!0})],_.prototype,"fillShadow",2),x([tt({equals:Wn,changeCb:e=>e.onFillChange()})],_.prototype,"fillBBox",2),x([tt({equals:ht,changeCb:e=>e.onFillChange()})],_.prototype,"fillParams",2);import{createSvgElement as Cs}from"ag-charts-core";import{isNumberEqual as yt}from"ag-charts-core";var Bi=[1,0,0,1,0,0],dt=class se{get e(){return[...this.elements]}constructor(t=Bi){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 yt(t[0],1)&&yt(t[1],0)&&yt(t[2],0)&&yt(t[3],1)&&yt(t[4],0)&&yt(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],o=t[0]*i[2]+t[2]*i[3],h=t[1]*i[2]+t[3]*i[3],a=t[0]*i[4]+t[2]*i[5]+t[4],c=t[1]*i[4]+t[3]*i[5]+t[5];n=n??t,n[0]=s,n[1]=r,n[2]=o,n[3]=h,n[4]=a,n[5]=c}multiplySelf(t){return this.AxB(this.elements,t.elements),this}multiply(t){const i=new Array(6);return t instanceof se?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 se(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 o=t[4],h=t[5],a=1/(i*r-n*s);return i*=a,n*=a,s*=a,r*=a,new se([r,-n,-s,i,s*h-r*o,n*o-i*h])}invertSelf(){const t=this.elements;let i=t[0],n=t[1],s=t[2],r=t[3];const o=t[4],h=t[5],a=1/(i*r-n*s);return i*=a,n*=a,s*=a,r*=a,t[0]=r,t[1]=-n,t[2]=-s,t[3]=i,t[4]=s*h-r*o,t[5]=n*o-i*h,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],o=n[2],h=n[3],a=t.width*.5,c=t.height*.5,l=t.x+a,d=t.y+c,u=Math.abs(a*s)+Math.abs(c*o),f=Math.abs(a*r)+Math.abs(c*h);return i??(i=new W(0,0,0,0)),i.x=l*s+d*o+n[4]-u,i.y=l*r+d*h+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,o,h){const a=i,c=n;let l,d;a===1&&c===1?(l=0,d=0):(l=h?.scalingCenterX??0,d=h?.scalingCenterY??0);const u=s,f=Math.cos(u),g=Math.sin(u);let p,y;u===0?(p=0,y=0):(p=h?.rotationCenterX??0,y=h?.rotationCenterY??0);const m=r,M=o,w=l*(1-a)-p,P=d*(1-c)-y;return t.setElements([f*a,g*a,-g*c,f*c,f*w-g*P+p+m,g*w+f*P+y+M]),t}};function st(e){return Ei(e.constructor)}var Ni=Symbol("isMatrixTransform");function Ei(e){return e[Ni]===!0}function Oe(e){var t,i;const n=e;if(Ei(e))return e;const s=Symbol("matrix_combined_transform");class r extends n{constructor(){super(...arguments),this[i]=new dt,this._dirtyTransform=!0}onChangeDetection(h){super.onChangeDetection(h),this._dirtyTransform=!0,!(this.batchLevel>0)&&this.markDirty("transform")}updateMatrix(h){}computeTransformMatrix(){this._dirtyTransform&&(this[s].setElements(Bi),this.updateMatrix(this[s]),this._dirtyTransform=!1)}toParent(h){return this.computeTransformMatrix(),this[s].identity?h.clone():this[s].transformBBox(h)}toParentPoint(h,a){return this.computeTransformMatrix(),this[s].identity?{x:h,y:a}:this[s].transformPoint(h,a)}fromParent(h){return this.computeTransformMatrix(),this[s].identity?h.clone():this[s].inverse().transformBBox(h)}fromParentPoint(h,a){return this.computeTransformMatrix(),this[s].identity?{x:h,y:a}:this[s].inverse().transformPoint(h,a)}computeBBox(){const h=super.computeBBox();return h&&this.toParent(h)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(h,a){return{x:h,y:a}=this.fromParentPoint(h,a),super.pickNode(h,a)}pickNodes(h,a,c){return{x:h,y:a}=this.fromParentPoint(h,a),super.pickNodes(h,a,c)}render(h){this.computeTransformMatrix();const{ctx:a}=h,c=this[s];let l=!1;try{c.identity||(a.save(),l=!0,c.toContext(a)),super.render(h)}finally{l&&a.restore()}}toSVG(){this.computeTransformMatrix();const h=super.toSVG(),a=this[s];if(a.identity||h==null)return h;const c=Cs("g");c.append(...h.elements);const[l,d,u,f,g,p]=a.e;return c.setAttribute("transform",`matrix(${l} ${d} ${u} ${f} ${g} ${p})`),{elements:[c],defs:h.defs}}}return t=Ni,i=s,r[t]=!0,r}function Bt(e){var t;const i=e,n=Symbol("matrix_rotation");class s extends Oe(i){constructor(){super(...arguments),this[t]=new dt,this.rotationCenterX=0,this.rotationCenterY=0,this.rotation=0}updateMatrix(o){super.updateMatrix(o);const{rotation:h,rotationCenterX:a,rotationCenterY:c}=this;h!==0&&(dt.updateTransformMatrix(this[n],1,1,h,0,0,{rotationCenterX:a,rotationCenterY:c}),o.multiplySelf(this[n]))}}return t=n,x([b()],s.prototype,"rotationCenterX",2),x([b()],s.prototype,"rotationCenterY",2),x([b()],s.prototype,"rotation",2),s}function Li(e){var t;const i=e,n=Symbol("matrix_scale");class s extends Oe(i){constructor(){super(...arguments),this[t]=new dt,this.scalingX=1,this.scalingY=1,this.scalingCenterX=0,this.scalingCenterY=0}updateMatrix(o){super.updateMatrix(o);const{scalingX:h,scalingY:a,scalingCenterX:c,scalingCenterY:l}=this;h===1&&a===1||(dt.updateTransformMatrix(this[n],h,a,0,0,0,{scalingCenterX:c,scalingCenterY:l}),o.multiplySelf(this[n]))}}return t=n,x([b()],s.prototype,"scalingX",2),x([b()],s.prototype,"scalingY",2),x([b()],s.prototype,"scalingCenterX",2),x([b()],s.prototype,"scalingCenterY",2),s}function jt(e){var t;const i=e,n=Symbol("matrix_translation");class s extends Oe(i){constructor(){super(...arguments),this[t]=new dt,this.translationX=0,this.translationY=0}updateMatrix(o){super.updateMatrix(o);const{translationX:h,translationY:a}=this;h===0&&a===0||(dt.updateTransformMatrix(this[n],1,1,0,h,a),o.multiplySelf(this[n]))}}return t=n,x([b()],s.prototype,"translationX",2),x([b()],s.prototype,"translationY",2),s}var xt=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}}},Nt,Be=class _t extends It{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 _t}static computeChildrenBBox(t,i=!0){return W.merge(It.extractBBoxes(t,i))}static compareChildren(t,i){return Dn(t.zIndex,i.zIndex)||t.serialNumber-i.serialNumber}containsPoint(t,i){return!0}computeBBox(){return _t.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:o,y:h}=xt.toCanvasPoint(this,0,0),a=Ti(t,o+i.x-r)-o,c=Ti(t,h+i.y-r)-h,l=Math.ceil(i.x+i.width-a+r),d=Math.ceil(i.y+i.height-c+r);return new W(a,c,l,d)}prepareSharedCanvas(t,i,n){return Nt==null||Nt.pixelRatio!==n?Nt=new fe({width:t,height:i,pixelRatio:n}):Nt.resize(t,i,n),Nt}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 zn(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 o=n[s].pickNode(t,i);if(o!=null)return o}}else if(!this.isContainerNode)return this}}pickNodes(t,i,n=[]){if(!this.visible||this.pointerEvents===1||!this.containsPoint(t,i))return n;this.isContainerNode||n.push(this);for(const s of this.children())s.pickNodes(t,i,n);return n}isDirty(t){const{width:i,height:n,devicePixelRatio:s}=t,{dirty:r,layer:o}=this,h=o!=null&&(this._lastWidth!==i||this._lastHeight!==n),a=this._lastDevicePixelRatio!==s;return this._lastWidth=i,this._lastHeight=n,this._lastDevicePixelRatio=s,r||h||a}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:o,stats:h,devicePixelRatio:a}=t;let{image:c}=this;if(r){c?.bitmap.close(),c=void 0;const d=i?void 0:this.computeSafeClippingBBox(a),u=(f,...g)=>{const p=f.context;s.ctx=p,f.clear(),p.save();try{p.setTransform(...g),p.globalAlpha=1,this.renderInContext(s)}finally{p.restore(),p.verifyDepthZero?.()}};if(i)u(i,o.getTransform());else if(d){const{x:f,y:g,width:p,height:y}=d,m=this.prepareSharedCanvas(p,y,a);u(m,a,0,0,a,-f*a,-g*a),c={bitmap:m.transferToImageBitmap(),x:f,y:g,width:p,height:y}}this.image=c,h&&h.layersRendered++}else h&&h.layersSkipped++;const{globalAlpha:l}=o;if(o.globalAlpha=l*this.opacity,i){o.save();try{o.resetTransform(),i.drawImage(o)}finally{o.restore()}}else if(c){const{bitmap:d,x:u,y:f,width:g,height:p}=c;o.drawImage(d,0,0,g*a,p*a,u,f,g,p)}o.globalAlpha=l,super.render(s)}applyClip(t,i){const{x:n,y:s,width:r,height:o}=i;t.beginPath(),t.rect(n,s,r,o),t.clip()}renderInContext(t){const{ctx:i,stats:n}=t;this.dirtyZIndex&&(this.sortChildren(_t.compareChildren),this.dirtyZIndex=!1),i.save();try{i.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(i,this.clipRect),t.clipBBox=xt.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}*excludeChildren(t){for(const i of this.children())(t.instance&&!(i instanceof t.instance)||t.name&&i.name!==t.name)&&(yield i)}*descendants(){for(const t of this.children())yield t,t instanceof _t&&(yield*t.descendants())}setClipRect(t){this.clipRect=t?xt.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}}};Be.className="Group",x([b({convertor:e=>_n(0,e,1)})],Be.prototype,"opacity",2);var U=Be,Zr=class extends Li(U){},Qr=class extends Bt(U){},ws=class extends jt(U){},to=class extends Bt(jt(U)){};import{Logger as Ne,getWindow as Ps,isString as ks,toArray as As}from"ag-charts-core";function Ts(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 Ds(){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(Ts(s));return`Heap ${n.join(" / ")}`}function _i(e,t,i,n,s={},r=W.zero){if(!j.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:o=0,layersSkipped:h=0,nodesRendered:a=0,nodesSkipped:c=0,opsPerformed:l=0,opsSkipped:d=0}=n??{},u=performance.now(),{start:f,...g}=t,p=Object.entries(g).map(([C,T])=>Wi(C,T)).filter(C=>C!=null).join(" + "),y=Object.entries(s).map(([C,T])=>`${C}: ${JSON.stringify(T)}`).join(" ; "),m=j.check("scene:stats:verbose"),M=Ds(),w=[`${Wi("\u23F1\uFE0F",f,u)} (${p})`,`${y}`,`Layers: ${m?Ee(o,h):e.size}`,m?`Nodes: ${Ee(a,c)}`:null,m?`Ops: ${Ee(l,d)}`:null,m&&M?M:null].filter(ks),P=new ui(C=>i.measureText(C)),A=new Map(w.map(C=>[C,P.measureLines(C)])),k=Math.max(...Array.from(A.values(),C=>C.width)),v=Ns(A.values(),C=>C.height),S=2+r.x;i.save();try{i.fillStyle="white",i.fillRect(S,0,k,v),i.fillStyle="black";let C=0;for(const[T,R]of A.entries())C+=R.height,i.fillText(T,S,C)}catch(C){Ne.warnOnce("Error during debug stats rendering",C)}finally{i.restore()}}function Fs(e){const t=As(Ps("agChartsSceneDebug")),i=[];for(const n of t)n==="layout"?i.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):i.push(n);e.debugNodeSearch=i}function Rs(e,t){e.save();try{for(const[i,n]of Object.entries(t)){const s=xt.toCanvas(n);if(!s){Ne.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){Ne.warnOnce("Error during debug rendering",i)}finally{e.restore()}}var Is=new Set,Os=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function Bs(e){const{...t}=e;for(const i of Object.keys(t))Os.has(i)||typeof t[i]!="number"&&typeof t[i]!="string"&&typeof t[i]!="boolean"&&(Is.add(i),delete t[i]);return t}function Yt(e,t){if(!j.check(!0,"scene"))return{};let i=0;return{node:t==="json"?Bs(e):e,name:e.name??e.id,dirty:e instanceof U?e.dirty:void 0,...Array.from(e instanceof U?e.children():[],n=>Yt(n,t)).reduce((n,s)=>{let{name:r}=s;const{node:{visible:o,opacity:h,zIndex:a,translationX:c,translationY:l,rotation:d,scalingX:u,scalingY:f},node:g}=s;(!o||h<=0)&&(r=`(${r})`),U.is(g)&&g.renderToOffscreenCanvas&&(r=`*${r}*`);const p=Array.isArray(a)?`(${a.join(", ")})`:a,y=[`${(i++).toString().padStart(3,"0")}|`,`${r??"<unknown>"}`,`z: ${p}`,c&&`x: ${c}`,l&&`y: ${l}`,d&&`r: ${d}`,u!=null&&u!==1&&`sx: ${u}`,f!=null&&f!==1&&`sy: ${f}`].filter(w=>!!w).join(" ");let m=y,M=1;for(;n[m]!=null&&M<100;)m=`${y} (${M++})`;return n[m]=s,n},{})}}function zi(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=>zi(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,o)=>(r[o.name??"<unknown>"]=o,r),{})},paths:s}}function Ee(e,t){const i=e+t;return`${e} / ${i} (${Math.round(100*e/i)}%)`}function Wi(e,t,i){const n=i!=null?i-t:t;return`${e}: ${Math.round(n*100)/100}ms`}function Ns(e,t){let i=0;for(const n of e)i+=t(n);return i}import{boxesEqual as Es}from"ag-charts-core";var Xt=(e,{x0:t,y0:i,x1:n,y1:s,cx:r,cy:o},h,a)=>{if(a&&e.moveTo(t,i),t!==n||i!==s){const c=Math.atan2(i-o,t-r),l=Math.atan2(s-o,n-r);e.arc(r,o,h,c,l)}else e.lineTo(t,i)};import{createSvgElement as Ls}from"ag-charts-core";var Z=class extends _{constructor(){super(...arguments),this.path=new Ot,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 Ot),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=Ls("path");e.setAttribute("d",this.svgPathData());const t=this.applySvgFillAttributes(e,[]);return this.applySvgStrokeAttributes(e),{elements:[e],defs:t}}};Z.className="Path",x([b()],Z.prototype,"clip",2),x([b()],Z.prototype,"clipX",1),x([b()],Z.prototype,"clipY",1);var Gi=1e-6,Ut=(e,t,i,n,s)=>{let r=!1,o=!1,h=n-Math.sqrt(Math.max(s**2-i**2,0)),a=0,c=0,l=i-Math.sqrt(Math.max(s**2-n**2,0));return h>e?(r=!0,h=e,a=i-Math.sqrt(Math.max(s**2-(n-e)**2))):h<Gi&&(h=0),l>t?(o=!0,c=n-Math.sqrt(Math.max(s**2-(i-t)**2)),l=t):l<Gi&&(l=0),{leading0:h,leading1:a,trailing0:c,trailing1:l,leadingClipped:r,trailingClipped:o}},Le=(e,t,i,n,s,r,o)=>{let{topLeft:h,topRight:a,bottomRight:c,bottomLeft:l}=r;const d=Math.max(h+l,a+c),u=Math.max(h+a,l+c);if(d<=0&&u<=0){o==null?e.rect(t,i,n,s):e.rect(o.x,o.y,o.width,o.height);return}else if(o==null&&h===a&&h===c&&h===l){e.roundRect(t,i,n,s,h);return}if(n<0&&(t+=n,n=Math.abs(n)),s<0&&(i+=s,s=Math.abs(s)),n<=0||s<=0)return;if(o==null)o=new W(t,i,n,s);else{const v=Math.max(t,o.x),S=Math.min(t+n,o.x+o.width),C=Math.max(i,o.y),T=Math.min(i+s,o.y+o.height);o=new W(v,C,S-v,T-C)}const f=Math.max(d/s,u/n,1);f>1&&(h/=f,a/=f,c/=f,l/=f);let g=!0,p=!0,y=!0,m=!0,M,w,P,A;if(g){const v=Ut(o.height,o.width,Math.max(t+h-o.x,0),Math.max(i+h-o.y,0),h);v.leadingClipped&&(m=!1),v.trailingClipped&&(p=!1);const S=Math.max(o.x+v.leading1,o.x),C=Math.max(o.y+v.leading0,o.y),T=Math.max(o.x+v.trailing1,o.x),R=Math.max(o.y+v.trailing0,o.y),N=t+h,z=i+h;M={x0:S,y0:C,x1:T,y1:R,cx:N,cy:z}}if(p){const v=Ut(o.width,o.height,Math.max(i+a-o.y,0),Math.max(o.x+o.width-(t+n-a),0),a);v.leadingClipped&&(g=!1),v.trailingClipped&&(y=!1);const S=Math.min(o.x+o.width-v.leading0,o.x+o.width),C=Math.max(o.y+v.leading1,o.y),T=Math.min(o.x+o.width-v.trailing0,o.x+o.width),R=Math.max(o.y+v.trailing1,o.y),N=t+n-a,z=i+a;w={x0:S,y0:C,x1:T,y1:R,cx:N,cy:z}}if(y){const v=Ut(o.height,o.width,Math.max(o.x+o.width-(t+n-c),0),Math.max(o.y+o.height-(i+s-c),0),c);v.leadingClipped&&(p=!1),v.trailingClipped&&(m=!1);const S=Math.min(o.x+o.width-v.leading1,o.x+o.width),C=Math.min(o.y+o.height-v.leading0,o.y+o.height),T=Math.min(o.x+o.width-v.trailing1,o.x+o.width),R=Math.min(o.y+o.height-v.trailing0,o.y+o.height),N=t+n-c,z=i+s-c;P={x0:S,y0:C,x1:T,y1:R,cx:N,cy:z}}if(m){const v=Ut(o.width,o.height,Math.max(o.y+o.height-(i+s-l),0),Math.max(t+l-o.x,0),l);v.leadingClipped&&(y=!1),v.trailingClipped&&(g=!1);const S=Math.max(o.x+v.leading0,o.x),C=Math.min(o.y+o.height-v.leading1,o.y+o.height),T=Math.max(o.x+v.trailing0,o.x),R=Math.min(o.y+o.height-v.trailing1,o.y+o.height),N=t+l,z=i+s-l;A={x0:S,y0:C,x1:T,y1:R,cx:N,cy:z}}let k=!1;g&&M!=null&&(Xt(e,M,h,!k),k||(k=!0)),p&&w!=null&&(Xt(e,w,a,!k),k||(k=!0)),y&&P!=null&&(Xt(e,P,c,!k),k||(k=!0)),m&&A!=null&&Xt(e,A,l,!k),e.closePath()},V=class extends Z{constructor(){super(...arguments),this.borderPath=new Ot,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:o}=this;let{x:h,y:a,width:c,height:l,strokeWidth:d,clipBBox:u}=this;const g=1/(this.layerManager?.canvas.pixelRatio??1);let p=1;if(e.clear(!0),t.clear(!0),c===0||l===0){this.effectiveStrokeWidth=0,this.lastUpdatePathStrokeWidth=0,this.microPixelEffectOpacity=0;return}if(i&&(c<=g&&(p*=c/g),l<=g&&(p*=l/g),c=this.align(h,c),l=this.align(a,l),h=this.align(h),a=this.align(a),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(c<g){const y=h+g/2;t.moveTo(y,a),t.lineTo(y,a+l),d=g,this.borderClipPath=void 0}else if(l<g){const y=a+g/2;t.moveTo(h,y),t.lineTo(h+c,y),d=g,this.borderClipPath=void 0}else if(d<c&&d<l){const y=d/2;h+=y,a+=y,c-=d,l-=d;const m=u?.clone().shrink(y),M={topLeft:n>0?n-d:0,topRight:s>0?s-d:0,bottomRight:r>0?r-d:0,bottomLeft:o>0?o-d:0};this.borderClipPath=void 0,c>0&&l>0&&(m==null||m?.width>0&&m?.height>0)&&(Le(e,h,a,c,l,M,m),Le(t,h,a,c,l,M,m))}else this.borderClipPath=this.borderClipPath??new Ot,this.borderClipPath.clear(!0),this.borderClipPath.rect(h,a,c,l),t.rect(h,a,c,l);else{const y={topLeft:n,topRight:s,bottomRight:r,bottomLeft:o};this.borderClipPath=void 0,Le(e,h,a,c,l,y,u)}if([n,s,r,o].every(y=>y===0)){const y=this.getBBox();this.hittester=y.containsPoint.bind(y),this.distanceSquared=(m,M)=>this.getBBox().distanceSquared(m,M)}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=d,this.lastUpdatePathStrokeWidth=d,this.microPixelEffectOpacity=p}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:o,lineJoin:h,borderPath:a,borderClipPath:c}=this;c&&e.clip(c.getPath2D()),this.applyStrokeAndAlpha(e),e.lineWidth=i,s&&e.setLineDash(s),r&&(e.lineDashOffset=r),o&&(e.lineCap=o),h&&(e.lineJoin=h),e.stroke(a.getPath2D()),e.globalAlpha=n}}};V.className="Rect",x([b()],V.prototype,"x",2),x([b()],V.prototype,"y",2),x([b()],V.prototype,"width",2),x([b()],V.prototype,"height",2),x([b()],V.prototype,"topLeftCornerRadius",2),x([b()],V.prototype,"topRightCornerRadius",2),x([b()],V.prototype,"bottomRightCornerRadius",2),x([b()],V.prototype,"bottomLeftCornerRadius",2),x([tt({equals:Es})],V.prototype,"clipBBox",2),x([b()],V.prototype,"crisp",2);var _e=!1,X=class Ct extends _{constructor(t){super(t),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontSize=Ct.defaultFontSize,this.fontFamily="sans-serif",this.textAlign="start",this.textBaseline="alphabetic",this.boxPadding=0,this.trimText=t?.trimText??!0}onTextChange(){if(this.richText?.clear(),this.textMap?.clear(),le(this.text))this.lines=[],this.richText??(this.richText=new U),this.richText.setScene(this.scene),this.richText.append(this.text.map(()=>new Ct({trimText:!1})));else{const t=this.text?.split(`
`)??[];this.lines=this.trimText?t.map(i=>i.trim()):t}}static computeBBox(t,i,n,s,r=!0){const{font:o,font:{fontSize:h},textAlign:a,textBaseline:c,lineHeight:l=r?O.getLineHeight(h):void 0}=s,{width:d,alphabeticBaseline:u,offsetLeft:f,offsetTop:g,height:p}=de.measureLines(t,r?{font:o,lineHeight:l,textAlign:"start",textBaseline:"top"}:s),y=l==null?p:l*t.length;let m;l==null?m=g:c==="alphabetic"?m=(l-h)/2-u:m=O.getVerticalModifier(c)*y;const M=r?d*O.getHorizontalModifier(a):f;return new W(i-M,n-m,d,y)}computeBBox(t=_e){if(this.generateTextMap(),this.textMap?.size){const c=W.merge(this.textMap.values());return c.x=this.x,c.y=this.y,c}const{x:i,y:n,lines:s,textBaseline:r,textAlign:o,lineHeight:h}=this,a=Ct.computeBBox(s,i,n,{font:this,textBaseline:r,textAlign:o,lineHeight:h},t);return this.boxing!=null&&a.grow(this.boxPadding),a}getBBox(t=!0){if(t){_e=!0;const i=this.computeBBox(!0);return _e=!1,i}return super.getBBox()}getPlainText(){return In(this.text)}getTextMeasureBBox(){return this.computeBBox()}isPointInPath(t,i){return this.getBBox()?.containsPoint(t,i)??!1}setScene(t){this.richText?.setScene(t),super.setScene(t)}generateTextMap(){if(!le(this.text)||this.textMap?.size)return;this.textMap??(this.textMap=new Map);let t=0,i=0,n=0;const s={fill:this.fill,fontSize:this.fontSize,fontFamily:this.fontFamily,fontStyle:this.fontStyle,fontWeight:this.fontWeight};for(const o of this.richText.children()){const{color:h,...a}=this.text[t++];o.x=0,o.y=0,o.setProperties(ni({fill:h},a,s));const c=o.getBBox();this.textMap.set(o,c),n=Math.max(n,c.y+c.height/2+(o.lineHeight??O.getLineHeight(o.fontSize))),i+=c.x+c.width}let r=this.x-i/2;for(const[o,h]of this.textMap)o.x+=r,o.y+=n,r+=h.width}render(t){const{ctx:i,stats:n}=t;if(!this.text||!this.layerManager)return n&&(n.nodesSkipped+=1),super.render(t);if(le(this.text)){this.generateTextMap();const{width:s}=this.richText.getBBox();let r=0;switch(this.textAlign){case"left":case"start":r=s/2;break;case"right":case"end":r=s/-2}i.save(),i.translate(r,this.y),this.richText.render(t),i.restore()}else this.renderText(t);if(Ct.debug.check()&&!this.textMap?.size){const s=this.getBBox(!0);i.strokeStyle="red",i.lineWidth=1,i.strokeRect(s.x,s.y,s.width,s.height)}super.render(t)}markDirty(t){return this.textMap?.clear(),super.markDirty(t)}renderText(t){const{fill:i,stroke:n,strokeWidth:s}=this;if(!i&&!(n&&s)||!this.layerManager)return super.render(t);const{ctx:r}=t,o=O.toFontString(this);r.font!==o&&(r.font=o);const{fontSize:h,lineHeight:a=O.getLineHeight(h),textAlign:c,textBaseline:l}=this;if(r.textAlign=c,r.textBaseline=l,this.boxing){const d={font:this,textBaseline:l,textAlign:c,lineHeight:a},u=Ct.computeBBox(this.lines,this.x,this.y,d);if(u.width!==0&&u.height!==0){const{x:f,y:g,width:p,height:y}=u.grow(this.boxPadding);this.boxing.opacity=this.opacity,this.boxing.x=f,this.boxing.y=g,this.boxing.width=p,this.boxing.height=y,this.boxing.preRender(t),this.boxing.render(t)}}this.fillStroke(r)}executeFill(t){const{fontSize:i,lineHeight:n=O.getLineHeight(i),textBaseline:s,lines:r}=this,o=s==="alphabetic"?0:O.getVerticalModifier(s)*n*(1-r.length);this.renderLines(o,n,(h,a,c)=>t.fillText(h,a,c))}executeStroke(t){const{fontSize:i,lineHeight:n=O.getLineHeight(i),textBaseline:s,lines:r}=this,o=s==="alphabetic"?0:O.getVerticalModifier(s)*n*(1-r.length);this.renderLines(o,n,(h,a,c)=>t.strokeText(h,a,c))}renderLines(t,i,n){const{lines:s,x:r,y:o}=this;if(!(!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(t)||!Number.isFinite(i)))for(const h of s)n(h,r,o+t),t+=i}setFont(t){this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,this.fontStyle=t.fontStyle,this.fontWeight=t.fontWeight}setAlign(t){this.textAlign=t.textAlign,this.textBaseline=t.textBaseline}setBoxing(t){const i=t.border?.enabled?t.border?.stroke:void 0;t.fill!=null||i!=null?(this.boxing??(this.boxing=new V({scene:this.scene})),this.boxing.fill=t.fill,this.boxing.fillOpacity=t.fillOpacity??1,this.boxing.cornerRadius=t.cornerRadius??0,this.boxing.stroke=i,this.boxing.strokeWidth=t.border?.strokeWidth??0,this.boxing.strokeOpacity=t.border?.strokeOpacity??1,this.boxPadding=t.padding??0):this.boxing&&(this.boxing.destroy(),this.boxing=void 0)}getBoxingProperties(){const{fill:t,fillOpacity:i,cornerRadius:n,stroke:s,strokeWidth:r,strokeOpacity:o}=this.boxing??{};return{border:{enabled:s!=null,stroke:s,strokeWidth:r,strokeOpacity:o},cornerRadius:n,fill:t,fillOpacity:i,padding:this.boxPadding}}toSVG(){if(!this.visible||!this.text)return;const t=ai("text");if(Rn(this.text))this.applySvgFillAttributes(t),Oi(t,this),t.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),t.setAttribute("alignment-baseline",this.textBaseline),t.setAttribute("x",String(this.x)),t.setAttribute("y",String(this.y)),t.textContent=this.text;else for(const i of this.text){const n=ai("tspan");Oi(n,{fontSize:i.fontSize??this.fontSize,fontFamily:i.fontFamily??this.fontFamily,fontWeight:i.fontWeight??this.fontWeight,fontStyle:i.fontStyle??this.fontStyle}),this.applySvgFillAttributes(n),n.textContent=i.text,t.append(n)}return{elements:[t]}}};X.className="Text",X.debug=j.create(!0,"scene:text"),X.defaultFontSize=10,x([b()],X.prototype,"x",2),x([b()],X.prototype,"y",2),x([Sn({changeCb:e=>e.onTextChange()})],X.prototype,"text",2),x([b()],X.prototype,"fontStyle",2),x([b()],X.prototype,"fontWeight",2),x([b()],X.prototype,"fontSize",2),x([b()],X.prototype,"fontFamily",2),x([b()],X.prototype,"textAlign",2),x([b()],X.prototype,"textBaseline",2),x([b()],X.prototype,"lineHeight",2);var qi=X,_s=class extends Bt(qi){},so=class extends Bt(jt(qi)){};import"ag-charts-core";function rt(e,t){return pn((i,n,s)=>i[e][t??n]=s)}function zs(e){return mn(e)}var Ws=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(O.EllipsisChar))?[]:i}static appendEllipsis(e){return e.replace(/[.,]{1,5}$/,"")+O.EllipsisChar}static truncateLine(e,t,i,n){const s=t.textWidth(O.EllipsisChar);let r=0,o=0;for(;o<e.length;o++){const h=t.textWidth(e.charAt(o));if(r+h>i)break;r+=h}if(e.length===o&&(!n||r+s<=i))return n?e+O.EllipsisChar:e;for(e=e.slice(0,o).trimEnd();e.length&&t.textWidth(e)+s>i;)e=e.slice(0,-1).trimEnd();return e+O.EllipsisChar}static textWrap(e,t){const i=e.split(O.lineSplitter),n=de.getMeasurer(t);if(t.textWrap==="never")return i.map(h=>this.truncateLine(h.trimEnd(),n,t.maxWidth));const s=[],r=t.textWrap==="hyphenate",o=t.textWrap==null||t.textWrap==="on-space";for(const h of i){let a=h.trimEnd();if(a===""){s.push(a);continue}let c=0,l=0,d=0;for(;c<a.length;){const u=a.charAt(c);if(l+=n.textWidth(u),u===" "&&(d=c),l>t.maxWidth){if(c===0)break;const f=n.textWidth(a.slice(0,c+1));if(f<=t.maxWidth){l=f,c++;continue}if(d){const y=this.getWordAt(a,d+1),m=n.textWidth(y);if(m<=t.maxWidth){s.push(a.slice(0,d).trimEnd()),a=a.slice(d).trimStart(),c=0,l=0,d=0;continue}else o&&m>t.maxWidth&&s.push(a.slice(0,d).trimEnd(),this.truncateLine(a.slice(d).trimStart(),n,t.maxWidth,!0))}else o&&s.push(this.truncateLine(a,n,t.maxWidth,!0));if(o){a="";break}const g=r?"-":"";let p=a.slice(0,c).trim();for(;p.length&&n.textWidth(p+g)>t.maxWidth;)p=p.slice(0,-1).trimEnd();if(s.push(p+g),!p.length){a="";break}a=a.slice(p.length).trimStart(),c=-1,l=0,d=0}c++}a&&s.push(a)}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,o=0;r<s.length;r++){const{lineHeight:h}=s[r];if(o+=h,o>i.maxHeight){if(i.overflow==="hide")return[];const a=e.slice(0,r||1),c=a.pop();return a.concat(this.truncateLine(c,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 o=r.lastIndexOf(" ");if(o===-1||o===r.indexOf(" ")||s.includes(" "))return;const h=r.slice(o+1);t.textWidth(s+h)<=i.maxWidth&&(e[n-2]=r.slice(0,o),e[n-1]=h+" "+s)}},$=class extends we{constructor(){super(...arguments),this.id=ln(this),this.node=new _s({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;if(un(i))return;const r=Math.min(this.maxWidth??1/0,e)-n*2,o=this.maxHeight??t-n*2;if(!isFinite(r)&&!isFinite(o)){this.node.text=i;return}const h=Ws.wrapText(i??"",{maxWidth:r,maxHeight:o,font:this,textWrap:s});this.node.text=h,this.truncated=h.includes(O.EllipsisChar)}updateA11yText(e,t){const{proxyInteractionService:i}=e;if(this.enabled&&this.text){const n=xt.toCanvas(this.node);if(n){const{id:s}=this;this.proxyText??(this.proxyText=i.createProxyElement({type:"text",domManagerId:s,where:t})),this.proxyText.textContent=Qe(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.truncated){const{x:i,y:n}=xt.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:Qe(this.text)}])}}handleMouseLeave(e,t){e.tooltipManager.removeTooltip(this.id)}};$.SMALL_PADDING=10,x([H,rt("node","visible")],$.prototype,"enabled",2),x([H,rt("node")],$.prototype,"text",2),x([H,rt("node")],$.prototype,"textAlign",2),x([H,rt("node")],$.prototype,"fontStyle",2),x([H,rt("node")],$.prototype,"fontWeight",2),x([H,rt("node")],$.prototype,"fontSize",2),x([H,rt("node")],$.prototype,"fontFamily",2),x([H,rt("node","fill")],$.prototype,"color",2),x([H],$.prototype,"spacing",2),x([H],$.prototype,"maxWidth",2),x([H],$.prototype,"maxHeight",2),x([H],$.prototype,"wrapping",2),x([H],$.prototype,"padding",2),x([H],$.prototype,"layoutStyle",2);function Vt(e,t){const{path:i,size:n}=e,{x:s,y:r}=e;i.clear();let o=!1;for(const[h,a]of t){const c=s+(h-.5)*n,l=r+(a-.5)*n;o?i.lineTo(c,l):i.moveTo(c,l),o=!0}i.closePath()}var Gs={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){Vt(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){Vt(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){Vt(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(L(s,t-r),L(s,i-r)),e.lineTo(L(s,t+r),L(s,i-r)),e.lineTo(L(s,t+r),L(s,i+r)),e.lineTo(L(s,t-r),L(s,i+r)),e.closePath()},star({path:e,x:t,y:i,size:n}){const r=n/2,o=r/2,h=Math.PI/2;for(let a=0;a<5*2;a++){const c=a%2===0?r:o,l=a*Math.PI/5-h,d=t+Math.cos(l)*c,u=i+Math.sin(l)*c;e.lineTo(d,u)}e.closePath()},triangle(e){Vt(e,[[.5,0],[1,.87],[0,.87]])}},Et=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=Kt.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,o=Kt.anchor(t),h={path:e,x:i-(o.x-.5)*s,y:n-(o.y-.5)*s,size:s,pixelRatio:r};e.clear(),typeof t=="string"?Gs[t](h):typeof t=="function"&&t(h)}computeBBox(){const{x:e,y:t,size:i}=this,n=Kt.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)}};x([tt({equals:ce})],Et.prototype,"shape",2),x([b()],Et.prototype,"x",2),x([b()],Et.prototype,"y",2),x([b({convertor:Math.abs})],Et.prototype,"size",2);var Kt=class extends Bt(Li(jt(Et))){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{clamp as Hi}from"ag-charts-core";import"ag-charts-core";function qs(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}function $i(e){return e=e|0,e<=0?0:e===1?1:1<<31-Math.clz32(e)}var Jt=1e3,bt=Jt*60,Zt=bt*60,Lt=Zt*24,Hs=Lt*7,ji=Lt*30,$s=Lt*365,Mt=new Date().getTimezoneOffset()*bt,js={millisecond:{milliseconds:1,hierarchy:"day",encode(e){return e.getTime()},decode(e){return new Date(e)}},second:{milliseconds:Jt,hierarchy:"day",encode(e,t){const i=t?0:Mt;return Math.floor((e.getTime()-i)/Jt)},decode(e,t){const i=t?0:Mt;return new Date(i+e*Jt)}},minute:{milliseconds:bt,hierarchy:"day",encode(e,t){const i=t?0:Mt;return Math.floor((e.getTime()-i)/bt)},decode(e,t){const i=t?0:Mt;return new Date(i+e*bt)}},hour:{milliseconds:Zt,hierarchy:"day",encode(e,t){const i=t?0:Mt;return Math.floor((e.getTime()-i)/Zt)},decode(e,t){const i=t?0:Mt;return new Date(i+e*Zt)}},day:{milliseconds:Lt,hierarchy:"month",encode(e,t){const i=t?0:e.getTimezoneOffset()*bt;return Math.floor((e.getTime()-i)/Lt)},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:ji,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:$s,hierarchy:void 0,encode(e,t){return t?e.getUTCFullYear():e.getFullYear()},decode(e,t){let i;return t?(i=new Date,i.setUTCFullYear(e),i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0)):i=new Date(e,0,1,0,0,0,0),i}}};function Ys(e){return typeof e=="string"?e:e.unit}function Xs(e){return typeof e=="string"?1:e.step??1}function Us(e){return Xs(e)*js[Ys(e)].milliseconds}function ze(e){return e instanceof Date?e.getTime():e}import{Logger as Vs,clamp as Qt}from"ag-charts-core";var We=class on extends Me{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 on}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=Qt(0,t,1),this._paddingInner=t,this._paddingOuter=t}get padding(){return this._paddingInner}set paddingInner(t){this.invalid=!0,this._paddingInner=Qt(0,t,1)}get paddingInner(){return this._paddingInner}set paddingOuter(t){this.invalid=!0,this._paddingOuter=Qt(0,t,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&Vs.warnOnce("Expected update to not invalidate scale"))}convert(t,i){this.refresh();const n=this.findIndex(t,i?.alignment);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,o=0;for(;n<=s;){const h=(s+n)/2|0,a=this.ordinalRange(h),c=Math.abs(a-t);if(c===0)return h;c<r&&(r=c,o=h),a<t?n=h+1:s=h-1}return o}update(){const[t,i]=this.range;let{_paddingInner:n}=this;const{_paddingOuter:s,round:r,bands:o}=this,h=o.length;if(h===0)return;const a=i-t;let c;h===1?(n=0,c=a*(1-s*2)):c=a/Math.max(1,h-n+s*2);const l=r?Math.floor(c):c;let d=t+(a-l*(h-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=c*(1-n)}ordinalRange(t){const{_inset:i,_step:n,range:s}=this,r=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return Qt(r,i+n*t,o)}};x([qt],We.prototype,"range",2),x([qt],We.prototype,"round",2);var Ks=We;import{clamp as Yi}from"ag-charts-core";function Js(e,t,i){if(i==null||i[0]===0&&i[1]===1)return{ticks:e,count:e.length,firstTickIndex:0};const n=Yi(0,Math.floor(i[0]*e.length),e.length),s=Yi(0,Math.ceil(i[1]*e.length),e.length),r=t?e.length-s:n,o=t?e.length-n:s;return{ticks:e.slice(r,o),count:e.length,firstTickIndex:r}}var Zs=class an extends Ks{constructor(){super(...arguments),this.type="category",this.defaultTickCount=0,this.index=new Map,this.indexInitialized=!1,this._domain=[]}static is(t){return t instanceof an}set domain(t){this._domain!==t&&(this.invalid=!0,this._domain=t,this.index.clear(),this.indexInitialized=!1)}get domain(){return this._domain}get bands(){return this._domain}normalizeDomains(...t){let i;const n=new Set;let s=!0;for(const r of t)n.has(r)||(n.add(r),i==null?i=Xi(r):(s&&(s=Qs(r,i)),i=Xi([...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){const{bands:s}=this;let{tickCount:r}=t;if(r===0){const p=s.length>1?1:0;return{ticks:[s[p]],count:void 0,firstTickIndex:p}}let o=r!=null&&r!==0?s.length/r|0:1;if(o=$i(o),o<=1)return Js(i,!1,n);r=s.length/o|0;const h=o*r,a=$i((s.length-h)/2|0),c=Hi(0,Math.floor((n?.[0]??0)*s.length),s.length),l=Hi(0,Math.ceil((n?.[1]??1)*s.length),s.length),d=Math.floor((c-a)/o)*o+a,u=Math.ceil((l-a)/o)*o+a,f=[];for(let p=d;p<u;p+=o)p>=0&&p<s.length&&f.push(s[p]);let g=f.length>0?this.findIndex(f[0]):void 0;return g!=null&&(g=Math.floor((g-a)/o)),{ticks:f,count:void 0,firstTickIndex:g}}findIndex(t){const{index:i,indexInitialized:n}=this;if(!n){const{domain:s}=this;for(let r=0;r<s.length;r++)i.set(ze(s[r]),r);this.indexInitialized=!0}return i.get(ze(t))}};function Xi(e){let t;const i=new Set;for(const n of e){const s=ze(n),r=i.size;i.add(s),i.size!==r?t?.push(n):t??(t=e.slice(0,i.size))}return t??e}function Qs(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 tr,clamp as er,countFractionDigits as ir}from"ag-charts-core";var B=(e,t)=>({duration:Us(e)*t,timeInterval:e,step:t}),mo=[B({unit:"second"},1),B({unit:"second"},5),B({unit:"second"},15),B({unit:"second"},30),B({unit:"minute"},1),B({unit:"minute"},5),B({unit:"minute"},15),B({unit:"minute"},30),B({unit:"hour"},1),B({unit:"hour"},3),B({unit:"hour"},6),B({unit:"hour"},12),B({unit:"day"},1),B({unit:"day"},2),B({unit:"day",step:7},1),B({unit:"day",step:7},2),B({unit:"day",step:7},3),B({unit:"month"},1),B({unit:"month"},2),B({unit:"month"},3),B({unit:"month"},4),B({unit:"month"},6),B({unit:"year"},1)],Ui=[1,2,5,10];function Vi(e,t){return Math.abs(Math.round(e)-e)<t}function Ki(e,t,i){return Math.abs(t-e)>=i?Math.abs(t-e)/i+1:1}function nr(e,t,i,n,s,r){if(e===t)return{ticks:[e],count:1,firstTickIndex:0};if(i<2)return{ticks:[e,t],count:2,firstTickIndex:0};const o=Ji(e,t,i,n,s);if(!Number.isFinite(o))return{ticks:[],count:0,firstTickIndex:void 0};let h=e,a=t;if(Vi(h/o,1e-12)||(h=Math.ceil(h/o)*o),Vi(a/o,1e-12)||(a=Math.floor(a/o)*o),r!=null){const d=a-h,u=t-e,f=e+u*r[0],g=e+u*r[1];r=[(f-h)/d,(g-h)/d]}const{ticks:c}=Zi(h,a,o,r),l=c.at(0);return{ticks:c,count:Ki(h,a,o),firstTickIndex:l==null?void 0:Math.round((l-h)/o)}}var yo=Math.floor(2*Hs/ji*10)/10;function Ji(e,t,i,n=0,s=1/0){if(e===t)return er(1,n,s);if(i<1)return NaN;const r=Math.abs(t-e),o=10**Math.floor(Math.log10(r/i));let h=NaN,a=1/0,c=!1;for(const l of Ui){const d=Math.ceil(r/(l*o)),u=d>=n&&d<=s;if(c&&!u)continue;const f=Math.abs(d-i);(a>f||c!==u)&&(c||(c=u),a=f,h=l)}return h*o}function Zi(e,t,i,n){if(!Number.isFinite(i)||i<=0)return{ticks:[],count:0,firstTickIndex:void 0};if(e===t)return{ticks:[e],count:1,firstTickIndex:0};const s=10**ir(i),r=Math.min(e,t),o=Math.max(e,t);let h,a;if(n!=null&&(n[0]!==0||n[1]!==1)){const d=t-e,u=e+d*n[0],f=t-d*(1-n[1]);h=Math.min(u,f),a=Math.max(u,f)}else h=r,a=o;h=Math.floor(h*s)/s,a=Math.ceil(a*s)/s;const c=[];for(let d=0;;d+=1){const u=Math.round((r+i*d)*s)/s;if(u>o)break;u>=h&&u<=a&&c.push(u)}const l=c.at(0);return{ticks:c,count:Ki(r,o,i),firstTickIndex:l==null?void 0:Math.round((l-r)/i)}}function sr(e,t){return e>=t?(tr.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function rr(e,t){const i=Math.abs(t-e),n=10**Math.floor(Math.log10(i));let s=1/0,r=[e,t];for(const o of Ui){const h=o*n,a=Math.floor(e/h)*h,c=Math.ceil(t/h)*h,l=1-i/Math.abs(c-a);s>l&&(s=l,r=[a,c])}return r}var Qi=class je extends Me{constructor(t=[],i=[]){super(),this.domain=t,this.range=i,this.defaultTickCount=je.defaultTickCount,this.defaultClamp=!1}static is(t){return t instanceof je}normalizeDomains(...t){return or(...t)}calcBandwidth(t=1,i=1){const{domain:n}=this,s=this.getPixelRange();if(n.length===0)return s;let o=Math.abs(n[1].valueOf()-n[0].valueOf())/t+1;if(i!==0){const h=Math.floor(s);o=Math.min(o,h)}return s/Math.max(1,o)}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 o=n[0].valueOf(),h=n[1].valueOf(),a=t.valueOf();if(this.transform&&(o=this.transform(o),h=this.transform(h),a=this.transform(a)),r){const[l,d]=qs([o,h]);if(a<l)return s[0];if(a>d)return s[1]}if(o===h)return(s[0]+s[1])/2;if(a===o)return s[0];if(a===h)return s[1];const c=s[0];return c+(a-o)/(h-o)*(s[1]-c)}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:o}=this,[h,a]=o;let c;return h===a?c=this.toDomain((s+r)/2):c=this.toDomain(s+(t-h)/(a-h)*(r-s)),this.transformInvert?this.transformInvert(c):c}getPixelRange(){const[t,i]=this.range;return Math.abs(i-t)}};Qi.defaultTickCount=5;var te=Qi;function or(...e){let t,i=1/0,n,s=-1/0;for(const r of e)for(const o of r){const h=o.valueOf();h<i&&(i=h,t=o),h>s&&(s=h,n=o)}return t!=null&&n!=null?{domain:[t,n],animatable:!0}:{domain:[],animatable:!1}}var ar=class Ye extends te{constructor(){super([0,1],[0,1]),this.type="number"}static is(t){return t instanceof Ye}static getTickStep(t,i,n){const{interval:s,tickCount:r=te.defaultTickCount,minTickCount:o,maxTickCount:h}=n;return s??Ji(t,i,r,o,h)}toDomain(t){return t}ticks({interval:t,tickCount:i=te.defaultTickCount,minTickCount:n,maxTickCount:s},r=this.domain,o){if(!r||r.length<2||i<1||!r.every(isFinite))return{ticks:[],count:0,firstTickIndex:0};const[h,a]=r;if(t){const c=Math.abs(t);if(!sr((a-h)/c,this.getPixelRange()))return Zi(h,a,c,o)}return nr(h,a,i,n,s,o)}niceDomain(t,i=this.domain){if(i.length<2)return[];const{tickCount:n=te.defaultTickCount}=t;let[s,r]=i;if(n===1)[s,r]=rr(s,r);else if(n>1){const o=s>r?Math.ceil:Math.floor,h=s>r?Math.floor:Math.ceil,a=4;for(let c=0;c<a;c++){const l=s,d=r,u=Ye.getTickStep(s,r,t),[f,g]=i;if(s=o(f/u)*u,r=h(g/u)*u,s===l&&r===d)break}}return[s,r]}};import{CleanupRegistry as cr,EventEmitter as hr,Logger as lr,createId as ur,downloadUrl as dr}from"ag-charts-core";import{createElement as fr,getWindow as gr}from"ag-charts-core";var tn=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??gr("devicePixelRatio")??1,this.element=n??fr("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),fi(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(){di(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")}};x([zs(e=>e.onEnabledChange())],tn.prototype,"enabled",2);import{EventEmitter as pr}from"ag-charts-core";var mr=class extends pr{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()}},yr=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 fe({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()}},en=class extends hr{constructor(e){super(),this.debug=j.create(!0,"scene"),this.id=ur(this),this.imageLoader=new mr,this.root=null,this.pendingSize=null,this.isDirty=!1,this.cleanup=new cr,this.updateDebugFlags(),this.canvas=new tn(e),this.layersManager=new yr(this.canvas),this.cleanup.register(this.imageLoader.on("image-loaded",()=>{this.emit("scene-changed",{})}),this.imageLoader.on("image-error",({uri:t})=>{lr.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(()=>It._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){dr(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:o,pendingSize:h,width:a,height:c,pixelRatio:l}=this;if(!r)return;const d=performance.now();let u=!1;if(h&&(u=!0,this.layersManager.resize(...h),this.pendingSize=null),o&&!o.visible){this.isDirty=!1;return}let f;if(o instanceof U&&(f=o.dirty),o!=null&&f===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:Yt(o,"console")}),_i(this.layersManager,t,r,void 0,i,n);return}const g={ctx:r,width:a,height:c,devicePixelRatio:l,debugNodes:{}};j.check("scene:stats:verbose")&&(g.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),Fs(g);let p=!1;if((f!==!1||u)&&(p=!0,s.clear()),o&&j.check("scene:dirtyTree")){const{dirtyTree:y,paths:m}=zi(o);j.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:y,paths:m})}if(o&&p){if(o.visible&&o.preRender(g),this.debug.check()){const y=Yt(o,"console");this.debug("Scene.render() - before",{canvasCleared:p,tree:y})}if(o.visible)try{r.save(),o.render(g),r.restore()}catch(y){throw this.canvas.reset(),y}}t["\u270D\uFE0F"]=performance.now()-d,r.verifyDepthZero?.(),this.isDirty=!1,_i(this.layersManager,t,r,g.stats,i,n),Rs(r,g.debugNodes),o&&this.debug.check()&&this.debug("Scene.render() - after",{tree:Yt(o,"console"),canvasCleared:p})}toSVG(){const{root:e,width:t,height:i}=this;if(e!=null)return It.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})}};en.className="Scene";import{isNumberEqual as xr}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 xr(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",x([b()],it.prototype,"centerX",2),x([b()],it.prototype,"centerY",2),x([b()],it.prototype,"radius",2),x([b()],it.prototype,"startAngle",2),x([b()],it.prototype,"endAngle",2),x([b()],it.prototype,"counterClockwise",2),x([b()],it.prototype,"type",2);import{createSvgElement as br}from"ag-charts-core";var vt=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 Te(e,t,i,n,s,r,1/0)}render(e){const{ctx:t,devicePixelRatio:i}=e;let{x1:n,y1:s,x2:r,y2:o}=this;if(n===r){const{strokeWidth:h}=this,a=Math.round(n*i)/i+Math.trunc(h*i)%2/(i*2);n=a,r=a}else if(s===o){const{strokeWidth:h}=this,a=Math.round(s*i)/i+Math.trunc(h*i)%2/(i*2);s=a,o=a}t.beginPath(),t.moveTo(n,s),t.lineTo(r,o),this.fillStroke(t),this.fillShadow?.markClean(),super.render(e)}toSVG(){if(!this.visible)return;const e=br("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]}}};vt.className="Line",x([b()],vt.prototype,"x1",2),x([b()],vt.prototype,"y1",2),x([b()],vt.prototype,"x2",2),x([b()],vt.prototype,"y2",2);import{isNumberEqual as Ge}from"ag-charts-core";function qe(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,o=-t,h=-e;let a=1/0,c=1/0,l=-1/0,d=-1/0;for(let u=0;u<4;u+=1){const{x:f,y:g}=qe(u%2===0?s:r,u<2?o:h,n);a=Math.min(f,a),c=Math.min(g,c),l=Math.max(f,l),d=Math.max(g,d)}return new W(a,c,l-a,d-c)}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,o=-i,h=-t,a=this.getRotation(),c=[[s,h],[s,o],[r,o],[r,h]].map(([l,d])=>qe(l,d,a));n.clear(!0),n.moveTo(c[0].x,c[0].y),n.lineTo(c[1].x,c[1].y),n.lineTo(c[2].x,c[2].y),n.lineTo(c[3].x,c[3].y),n.closePath()}updateBeveledPath(){const{columnWidth:e,path:t,outerRadius:i,innerRadius:n,axisInnerRadius:s,axisOuterRadius:r,isRadiusAxisReversed:o}=this,h=Ge(n,s),a=Math.asin(e/2/n),c=this.getRotation(),l=(S,C)=>qe(S,C,c),d=(S,C)=>Math.sqrt(S**2+C**2),u=(S,C)=>C>S?0:Math.sqrt(S**2-C**2),f=(S,C,T)=>T?S<C:S>C,g=h&&!isNaN(a)&&a<Math.PI/6;let p=-e/2,y=e/2;const m=-i,M=-n*(g?Math.cos(a):1),w=f(r,d(n,e/2),!o);if(w){const S=u(r,n);p=-S,y=S}t.clear(!0);const P=l(p,M);t.moveTo(P.x,P.y);const A=Ge(n,i),k=f(r,d(i,e/2),!o);if(A&&g)t.arc(0,0,n,G(-a-Math.PI/2)+c,G(a-Math.PI/2)+c,!1);else if(k){const S=-u(r,e/2),C=u(r,i);if(!w){const T=l(p,S);t.lineTo(T.x,T.y)}if(t.arc(0,0,r,Math.atan2(S,p)+c,Math.atan2(m,-C)+c,!1),!Ge(C,0)){const T=l(C,m);t.lineTo(T.x,T.y)}t.arc(0,0,r,Math.atan2(m,C)+c,Math.atan2(S,y)+c,!1)}else{const S=l(p,m),C=l(y,m);t.lineTo(S.x,S.y),t.lineTo(C.x,C.y)}const v=l(y,M);if(t.lineTo(v.x,v.y),g)t.arc(0,0,n,G(a-Math.PI/2)+c,G(-a-Math.PI/2)+c,!0);else{const S=l(p,M);t.lineTo(S.x,S.y)}t.closePath()}};K.className="RadialColumnShape",x([b()],K.prototype,"isBeveled",2),x([b()],K.prototype,"columnWidth",2),x([b()],K.prototype,"startAngle",2),x([b()],K.prototype,"endAngle",2),x([b()],K.prototype,"outerRadius",2),x([b()],K.prototype,"innerRadius",2),x([b()],K.prototype,"axisInnerRadius",2),x([b()],K.prototype,"axisOuterRadius",2),x([b()],K.prototype,"isRadiusAxisReversed",2);function Mr(e,t,i,n,s){const r=pe(e,t),o=r*(1-n)/2;if(e+=o,t-=o,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 h=i*Math.cos(e),a=i*Math.sin(e),c=i*Math.cos(t),l=i*Math.sin(t),d=Math.floor(Math.sqrt((h-c)**2+(a-l)**2)),u=2*i*s;return Math.max(1,Math.min(u,d))}var vr=class Xe{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 Xe(t,i,n,s)}equals(t){return this.startAngle===t.startAngle&&this.endAngle===t.endAngle&&this.innerRadius===t.innerRadius&&this.outerRadius===t.outerRadius}[ri](t,i){return new Xe(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 Sr({startAngle:e,endAngle:t,innerRadius:i,outerRadius:n}){let s=1/0,r=1/0,o=-1/0,h=-1/0;const a=(c,l)=>{s=Math.min(c,s),r=Math.min(l,r),o=Math.max(c,o),h=Math.max(l,h)};return a(i*Math.cos(e),i*Math.sin(e)),a(i*Math.cos(t),i*Math.sin(t)),a(n*Math.cos(e),n*Math.sin(e)),a(n*Math.cos(t),n*Math.sin(t)),Wt(0,e,t)&&a(n,0),Wt(Math.PI*.5,e,t)&&a(0,n),Wt(Math.PI,e,t)&&a(-n,0),Wt(Math.PI*1.5,e,t)&&a(0,-n),new W(s,r,o-s,h-r)}function nn(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 o=pi(i.startAngle),h=pi(i.endAngle),a=Math.atan2(t,e);return o<h?a<=h&&a>=o:a<=h&&a>=-Math.PI||a>=o&&a<=Math.PI}function sn(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,o=1;for(let h=0;h<8;h+=1){const a=(r+o)/2;Math.asin(Math.abs(a*i)/(e+a*i))+Math.asin(Math.abs(a*n)/(e+a*n))-t<0?r=a:o=a}return r}var Cr=1e-6;function ot(e,t){return pe(e,t)<Cr?t:G(e-t)+t}function ee(e,t,i=0){const s=Math.abs(t-e)>=2*Math.PI?2*Math.PI:G(t-e);return e=ot(e,i),t=e+s,{startAngle:e,endAngle:t}}function ie(e,t,i,n,s,r){const o=Math.sin(r),h=Math.cos(r),a=e**2+t**2-i**2;let c,l,d,u;if(h>.5){const w=o/h,P=1+w**2,A=-2*(e+t*w),k=A**2-4*P*a;if(k<0)return;const v=(-A+Math.sqrt(k))/(2*P),S=(-A-Math.sqrt(k))/(2*P);c=v,l=v*w,d=S,u=S*w}else{const w=h/o,P=1+w**2,A=-2*(t+e*w),k=A**2-4*P*a;if(k<0)return;const v=(-A+Math.sqrt(k))/(2*P),S=(-A-Math.sqrt(k))/(2*P);c=v*w,l=v,d=S*w,u=S}const f=h,g=o,p=c*f+l*g,y=d*f+u*g,m=p>0?ot(Math.atan2(l-t,c-e),n):NaN,M=y>0?ot(Math.atan2(u-t,d-e),n):NaN;if(m>=n&&m<=s)return m;if(M>=n&&M<=s)return M}function ne(e,t,i,n,s,r){const o=Math.hypot(e,t),h=(o**2-i**2+r**2)/(2*o),a=o-h,c=Math.atan2(t,e),l=Math.acos(-a/i),d=ot(c+l,n),u=ot(c-l,n);if(d>=n&&d<=s)return d;if(u>=n&&u<=s)return u}var He=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 Sr(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}=ee(this.startAngle,this.endAngle),{innerRadius:n,outerRadius:s}=this.normalizedRadii(),r=ee(e.startAngle,e.endAngle,t);return new vr(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,o,h){if(e<=0)return;const{startAngle:a,endAngle:c}=ee(this.startAngle,this.endAngle),{innerRadius:l,outerRadius:d}=this.normalizedRadii(),u=this.normalizedClipSector();if(h&&l<=0)return;const f=h?this.getAngleOffset(l+e):this.getAngleOffset(d-e),g=o?a+f+t:c-f-t,p=h?l+e:d-e,y=p*Math.cos(g),m=p*Math.sin(g);if(u!=null&&(!o&&!(g>=a-1e-6&&g<=u.endAngle-1e-6)||o&&!(g>=u.startAngle+1e-6&&g<=c-1e-6)||h&&p<u.innerRadius-1e-6||!h&&p>u.outerRadius+1e-6))return;const M=new He(y,m,e,i,n);if(u!=null){h?(M.clipStart(ie(y,m,e,i,n,u.endAngle)),M.clipEnd(ie(y,m,e,i,n,u.startAngle))):(M.clipStart(ie(y,m,e,i,n,u.startAngle)),M.clipEnd(ie(y,m,e,i,n,u.endAngle)));let v,S;if(o?(v=ne(y,m,e,i,n,u.innerRadius),S=ne(y,m,e,i,n,u.outerRadius)):(v=ne(y,m,e,i,n,u.outerRadius),S=ne(y,m,e,i,n,u.innerRadius)),M.clipStart(v),M.clipEnd(S),v!=null){const{x:C,y:T}=M.pointAt(v),R=ot(Math.atan2(T,C),a);o?r?.clipStart(R):s.clipEnd(R)}if(S!=null){const{x:C,y:T}=M.pointAt(S),R=ot(Math.atan2(T,C),a);o?s.clipStart(R):r?.clipEnd(R)}}if(u!=null){const{x:v,y:S}=M.pointAt((M.a0+M.a1)/2);if(!nn(v,S,u))return}const{x:w,y:P}=M.pointAt(o===h?M.a0:M.a1),A=ot(Math.atan2(P,w),a),k=h?r:s;return o?k?.clipStart(A):k?.clipEnd(A),M}updatePath(){const{path:t,centerX:i,centerY:n,concentricEdgeInset:s,radialEdgeInset:r}=this;let{startOuterCornerRadius:o,endOuterCornerRadius:h,startInnerCornerRadius:a,endInnerCornerRadius:c}=this;const{startAngle:l,endAngle:d}=ee(this.startAngle,this.endAngle),{innerRadius:u,outerRadius:f}=this.normalizedRadii(),g=this.normalizedClipSector(),p=d-l,y=p>=2*Math.PI-1e-6;if(t.clear(),u===0&&f===0||u>f)return;if((g?.startAngle??l)===(g?.endAngle??d))return;if(y&&this.clipSector==null&&o===0&&h===0&&a===0&&c===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),M=this.getAngleOffset(f);if(p<2*M)return;const P=(g?.innerRadius??u)>s,A=u<s||p<2*m,k=f-u,v=Math.max(o,a,h,c),S=v>0?Math.min(k/v,1):1;o*=S,h*=S,a*=S,c*=S;const C=sn(f,p-2*M,-o,-h);if(o*=C,h*=C,!A&&P){const I=sn(u,p-2*m,a,c);a*=I,c*=I}else a=0,c=0;const T=Math.max(o+a,h+c),R=T>0?Math.min(k/T,1):1;o*=R,h*=R,a*=R,c*=R;let N=0,z=0;const ft=o/(f-o),gt=h/(f-h);if(ft>=0&&ft<1-1e-6)N=Math.asin(ft);else{N=p/2;const I=f/(1/Math.sin(N)+1);o=Math.min(I,o)}if(gt>=0&><1-1e-6)z=Math.asin(gt);else{z=p/2;const I=f/(1/Math.sin(z)+1);h=Math.min(I,h)}const wt=Math.asin(a/(u+a)),Pt=Math.asin(c/(u+c)),kt=g?.outerRadius??f,At=this.getAngleOffset(kt),nt=new He(0,0,kt,l+At,d-At),Ue=g?.innerRadius??u,Ve=this.getAngleOffset(Ue),Q=P?new He(0,0,Ue,l+Ve,d-Ve):void 0;g!=null&&(nt.clipStart(g.startAngle),nt.clipEnd(g.endAngle),Q?.clipStart(g.startAngle),Q?.clipEnd(g.endAngle));const Ke=this.arc(o,N,l-Math.PI*.5,l+N,nt,Q,!0,!1),Je=this.arc(h,z,d-z,d+Math.PI*.5,nt,Q,!1,!1),Ze=this.arc(c,Pt,d+Math.PI*.5,d+Math.PI-Pt,nt,Q,!1,!0),re=this.arc(a,wt,l+Math.PI+wt,l+Math.PI*1.5,nt,Q,!0,!0);if(A){const I=p<Math.PI*.5?r*(1+Math.cos(p))/Math.sin(p):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+p*.5;t.moveTo(i+E*Math.cos(q),n+E*Math.sin(q))}else if(!(re?.isValid()===!0||Q?.isValid()===!0)){const I=l+p/2,E=u*Math.cos(I),q=u*Math.sin(I);t.moveTo(i+E,n+q)}if(Ke?.isValid()===!0){const{cx:I,cy:E,r:q,a0:at,a1:ct}=Ke;t.arc(i+I,n+E,q,at,ct)}if(nt.isValid()){const{r:I,a0:E,a1:q}=nt;t.arc(i,n,I,E,q)}if(Je?.isValid()===!0){const{cx:I,cy:E,r:q,a0:at,a1:ct}=Je;t.arc(i+I,n+E,q,at,ct)}if(!A){if(Ze?.isValid()===!0){const{cx:I,cy:E,r:q,a0:at,a1:ct}=Ze;t.arc(i+I,n+E,q,at,ct)}if(Q?.isValid()===!0){const{r:I,a0:E,a1:q}=Q;t.arc(i,n,I,q,E,!0)}if(re?.isValid()===!0){const{cx:I,cy:E,r:q,a0:at,a1:ct}=re;t.arc(i+I,n+E,q,at,ct)}}t.closePath()}isPointInPath(e,t){const{startAngle:i,endAngle:n,innerRadius:s,outerRadius:r}=this.clipSector??this;return nn(e-this.centerX,t-this.centerY,{startAngle:i,endAngle:n,innerRadius:Math.min(s,r),outerRadius:Math.max(s,r)})}};Y.className="Sector",x([b()],Y.prototype,"centerX",2),x([b()],Y.prototype,"centerY",2),x([b()],Y.prototype,"innerRadius",2),x([b()],Y.prototype,"outerRadius",2),x([b()],Y.prototype,"startAngle",2),x([b()],Y.prototype,"endAngle",2),x([tt({equals:(e,t)=>e.equals(t)})],Y.prototype,"clipSector",2),x([b()],Y.prototype,"concentricEdgeInset",2),x([b()],Y.prototype,"radialEdgeInset",2),x([b()],Y.prototype,"startOuterCornerRadius",2),x([b()],Y.prototype,"endOuterCornerRadius",2),x([b()],Y.prototype,"startInnerCornerRadius",2),x([b()],Y.prototype,"endInnerCornerRadius",2);export{it as Arc,W as BBox,$ as Caption,Zs as CategoryScale,U as Group,vt as Line,ar as LinearScale,Kt as Marker,Z as Path,K as RadialColumnShape,V as Rect,en as Scene,Y as Sector,_ as Shape,ws as TranslatableGroup,Mr as getRadialColumnWidth,J as toRadians};