"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var i in e)__defProp(t,i,{get:e[i],enumerable:!0})},__copyProps=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of __getOwnPropNames(e))!__hasOwnProp.call(t,n)&&n!==i&&__defProp(t,n,{get:()=>e[n],enumerable:!(s=__getOwnPropDesc(e,n))||s.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,i,s)=>{for(var n=s>1?void 0:s?__getOwnPropDesc(e,i):e,r=t.length-1,o;r>=0;r--)(o=t[r])&&(n=(s?o(e,i,n):o(n))||n);return s&&n&&__defProp(e,i,n),n},main_exports={};__export(main_exports,{AG_CHARTS_LOCALE_EN_US:()=>AG_CHARTS_LOCALE_EN_US,AgCharts:()=>AgCharts,AgChartsCommunityModule:()=>AgChartsCommunityModule,AgErrorBarSupportedSeriesTypes:()=>AgErrorBarSupportedSeriesTypes,AgTooltipPositionType:()=>AgTooltipPositionType,VERSION:()=>VERSION,_ModuleSupport:()=>module_support_exports,_Scene:()=>integrated_charts_scene_exports,_Theme:()=>integrated_charts_theme_exports,_Util:()=>integrated_charts_util_exports,_Widget:()=>exports_exports,setupCommunityModules:()=>registerInbuiltModules,time:()=>time_exports}),module.exports=__toCommonJS(main_exports);var logger_exports={};__export(logger_exports,{error:()=>error,errorOnce:()=>errorOnce,log:()=>log,logGroup:()=>logGroup,reset:()=>reset,table:()=>table,warn:()=>warn,warnOnce:()=>warnOnce});var doOnceCache=new Set;function log(...t){console.log(...t)}function warn(t,...e){console.warn(`AG Charts - ${t}`,...e)}function error(t,...e){typeof t=="object"?console.error("AG Charts error",t,...e):console.error(`AG Charts - ${t}`,...e)}function table(...t){console.table(...t)}function warnOnce(t,...e){const i=`Logger.warn: ${t}`;doOnceCache.has(i)||(warn(t,...e),doOnceCache.add(i))}function errorOnce(t,...e){const i=`Logger.error: ${t}`;doOnceCache.has(i)||(error(t,...e),doOnceCache.add(i))}function reset(){doOnceCache.clear()}function logGroup(t,e){console.groupCollapsed(t);try{return e()}finally{console.groupEnd()}}var ModuleRegistry=class{static[Symbol.iterator](){return this.registeredModules.values()}static register(t){const e=this.registeredModules.get(t.name);if(e&&(e.enterprise||!t.enterprise))throw new Error(`AG Charts - Module '${t.name}' already registered`);this.registeredModules.set(t.name,t)}static registerMany(t){for(const e of t)this.register(e)}static reset(){this.registeredModules.clear()}static detectChartDefinition(t){return this.detectDefinition("chart",t)}static detectSeriesDefinition(t){return this.detectDefinition("series",t)}static detectDefinition(t,e){for(const i of this.registeredModules.values())if(i.type===t&&i.detect(e))return i;throw new Error(`AG Charts - Unknown ${t} type; Check options are correctly structured and series types are specified`)}};ModuleRegistry.registeredModules=new Map;var EventEmitter=class{constructor(){this.events=new Map}on(t,e){return this.events.has(t)||this.events.set(t,new Set),this.events.get(t)?.add(e),()=>this.off(t,e)}off(t,e){const i=this.events.get(t);i&&(i.delete(e),i.size===0&&this.events.delete(t))}emit(t,e){this.events.get(t)?.forEach(i=>i(e))}clear(t){t?this.events.delete(t):this.events.clear()}};function toArray(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}function unique(t){return Array.from(new Set(t))}function groupBy(t,e){return t.reduce((i,s)=>{const n=e(s);return i[n]??(i[n]=[]),i[n].push(s),i},{})}function arraysEqual(t,e){if(t==null||e==null||t.length!==e.length)return!1;for(let i=0;i{i.set(s,n)}),t.sort((s,n)=>{const r=i.get(s)??1/0,o=i.get(n)??1/0;return r-o})}function findMaxIndex(t,e,i){if(t>e)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2);i(n)?(s=n,t=n+1):e=n-1}return s}function findMinIndex(t,e,i){if(t>e)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2);i(n)?(s=n,e=n-1):t=n+1}return s}function findMinValue(t,e,i){if(t>e)return;let s;for(;e>=t;){const n=Math.floor((e+t)/2),r=i(n);r==null?t=n+1:(s=r,e=n-1)}return s}function diffArrays(t,e){const i=Math.max(t.length,e.length),s=new Set,n=new Set;for(let r=0;r0||n.size>0,added:s,removed:n}}function throttle(t,e,i){const{leading:s=!0,trailing:n=!0}=i??{};let r,o,a=!1;function l(){n&&o?(r=setTimeout(l,e),t(...o)):a=!1,o=null}function c(...h){a?o=h:(a=!0,r=setTimeout(l,e),s?t(...h):o=h)}return Object.assign(c,{cancel(){clearTimeout(r),a=!1,o=null}})}function*iterate(...t){for(const e of t)yield*e}function toIterable(t){return t!=null&&typeof t=="object"&&Symbol.iterator in t?t:[t]}function first(t){for(const e of t)return e;throw new Error("AG Charts - no first() value found")}function joinFormatted(t,e="and",i=String,s=1/0){if(t.length===1)return i(t[0]);t=t.map(i);const n=t.pop();if(t.length>=s){const r=t.length-(s-1);return`${t.slice(0,s-1).join(", ")}, and ${r} more ${e} ${n}`}return`${t.join(", ")} ${e} ${n}`}function stringifyValue(t,e=1/0){switch(typeof t){case"undefined":return"undefined";case"number":if(isNaN(t))return"NaN";if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";default:return t=JSON.stringify(t),t.length>e?`${t.slice(0,e)}... (+${t.length-e} characters)`:t}}function countLines(t){let e=1;for(let i=0;i"u"))if(isFunction(l))l(c,t)?r[a]=c:n.push({key:a,path:i,value:c,message:validateMessage(o(a),c,l)});else{const h=validate(c,l,o(a));r[a]=h.valid,n.push(...h.errors)}}for(const a of s)n.push({key:a,path:i,unknown:!0,message:`Unknown option \`${o(a)}\`, ignoring.`});return{valid:r,errors:n}}function validateMessage(t,e,i){const s=isString(i)?i:i[descriptionSymbol],n=s?`; expecting ${s}`:"";return`${t?`Option \`${t}\``:"Value"} cannot be set to \`${stringifyValue(e)}\`${n}, ignoring.`}function attachDescription(t,e){return Object.assign((i,s)=>t(i,s),{[descriptionSymbol]:e})}var and=(...t)=>attachDescription((e,i)=>t.every(s=>s(e,i)),t.map(e=>e[descriptionSymbol]).filter(Boolean).join(" and ")),or=(...t)=>attachDescription((e,i)=>t.some(s=>s(e,i)),t.map(e=>e[descriptionSymbol]).filter(Boolean).join(" or ")),array=attachDescription(isArray,"an array"),boolean=attachDescription(isBoolean,"a boolean"),callback=attachDescription(isFunction,"a function"),number=attachDescription(isFiniteNumber,"a number"),object=attachDescription(isObject,"an object"),string=attachDescription(isString,"a string"),date=attachDescription(t=>isDate(t)||(isFiniteNumber(t)||isString(t))&&isValidDate(new Date(t)),"a date"),numberMin=(t,e=!0)=>attachDescription(i=>isFiniteNumber(i)&&(i>t||e&&i===t),`a number greater than ${e?"or equal to ":""}${t}`),numberRange=(t,e)=>attachDescription(i=>isFiniteNumber(i)&&i>=t&&i<=e,`a number between ${t} and ${e} inclusive`),positiveNumber=numberMin(0),ratio=numberRange(0,1),isComparable=t=>isFiniteNumber(t)||isValidDate(t),lessThan=t=>attachDescription((e,i)=>!isComparable(e)||!isComparable(i[t])||e`'${i}'`,6);return attachDescription(i=>t.includes(i),`a keyword such as ${e}`)}var arrayOf=(t,e)=>attachDescription((i,s)=>isArray(i)&&i.every(n=>t(n,s)),e??`${t[descriptionSymbol]} array`),fromToMotion_exports={};__export(fromToMotion_exports,{NODE_UPDATE_STATE_TO_PHASE_MAPPING:()=>NODE_UPDATE_STATE_TO_PHASE_MAPPING,fromToMotion:()=>fromToMotion,staticFromToMotion:()=>staticFromToMotion});var verifiedGlobals={};typeof window<"u"?verifiedGlobals.window=window:typeof global<"u"&&(verifiedGlobals.window=global.window),typeof document<"u"?verifiedGlobals.document=document:typeof global<"u"&&(verifiedGlobals.document=global.document);function getDocument(t){return t?verifiedGlobals.document?.[t]:verifiedGlobals.document}function getWindow(t){return t?verifiedGlobals.window?.[t]:verifiedGlobals.window}function setDocument(t){verifiedGlobals.document=t}function setWindow(t){verifiedGlobals.window=t}function createElement(t,e,i){const s=getDocument().createElement(t);if(typeof e=="object"&&(i=e,e=void 0),e)for(const n of e.split(" "))s.classList.add(n);return i&&Object.assign(s.style,i),s}function createSvgElement(t){return getDocument().createElementNS("http://www.w3.org/2000/svg",t)}function downloadUrl(t,e){const i=getDocument("body"),s=createElement("a",{display:"none"});s.href=t,s.download=e,i.appendChild(s),s.click(),setTimeout(()=>i.removeChild(s))}var ID_MAP=new Map;function resetIds(){ID_MAP.clear()}function createId(t){const e=t.constructor,i=Object.hasOwn(e,"className")?e.className:e.name;if(!i)throw new Error(`The ${e} is missing the 'className' property.`);const s=(ID_MAP.get(i)??0)+1;return ID_MAP.set(i,s),`${i}-${s}`}function generateUUID(){return crypto.randomUUID?.()??generateUUIDv4()}function generateUUIDv4(){const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e="";for(let i=0;i=t.x&&e<=t.x+t.width&&i>=t.y&&i<=t.y+t.height}function isEmpty(t){return t==null||t.height===0||t.width===0||isNaN(t.height)||isNaN(t.width)}function normalize(t){let{x:e,y:i,width:s,height:n}=t;return(s==null||s>0)&&(n==null||n>0)?t:(e!=null&&s!=null&&s<0&&(s=-s,e=e-s),i!=null&&n!=null&&n<0&&(n=-n,i=i-n),{x:e,y:i,width:s,height:n})}var interpolate=Symbol("interpolate"),isInterpolating=t=>t[interpolate]!=null;function nearestSquared(t,e,i,s=1/0){const n={nearest:void 0,distanceSquared:s};for(const r of i){const o=r.distanceSquared(t,e);if(o===0)return{nearest:r,distanceSquared:0};oe[1]&&(e[1]=i);return e}function findRangeExtent(t){const[e,i]=findMinMax(t);return i-e}function inRange(t,e,i=1e-10){return t>=e[0]-i&&t<=e[1]+i}function isNumberEqual(t,e,i=1e-10){return t===e||Math.abs(t-e)=1e21){let n;[e,n]=e.split("e"),n!=null&&(i=Number(n))}const s=e.split(".")[1]?.length??0;return Math.max(s-i,0)}var _BBox=class yt{constructor(e,i,s,n){this.x=e,this.y=i,this.width=s,this.height=n}static fromDOMRect({x:e,y:i,width:s,height:n}){return new yt(e,i,s,n)}static merge(e){let i=1/0,s=1/0,n=-1/0,r=-1/0;for(const o of e)o.xn&&(n=o.x+o.width),o.y+o.height>r&&(r=o.y+o.height);return new yt(i,s,n-i,r-s)}static nearestBox(e,i,s){return nearestSquared(e,i,s)}toDOMRect(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.y,left:this.x,right:this.x+this.width,bottom:this.y+this.height,toJSON(){return{}}}}clone(){const{x:e,y:i,width:s,height:n}=this;return new yt(e,i,s,n)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}containsPoint(e,i){return BBoxValues.containsPoint(this,e,i)}intersection(e){if(!this.collidesBBox(e))return;const i=clamp(e.x,this.x,e.x+e.width),s=clamp(e.y,this.y,e.y+e.height),n=clamp(e.x,this.x+this.width,e.x+e.width),r=clamp(e.y,this.y+this.height,e.y+e.height);return new yt(i,s,n-i,r-s)}collidesBBox(e){return this.xe.x&&this.ye.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(e,i){if(this.containsPoint(e,i))return 0;const s=e-clamp(this.x,e,this.x+this.width),n=i-clamp(this.y,i,this.y+this.height);return s*s+n*n}shrink(e,i){if(typeof e=="number")this.applyMargin(e,i);else for(const[s,n]of Object.entries(e))this.applyMargin(n,s);return this.width<0&&(this.width=0),this.height<0&&(this.height=0),this}grow(e,i){if(typeof e=="number")this.applyMargin(-e,i);else for(const[s,n]of Object.entries(e))this.applyMargin(-n,s);return this}applyMargin(e,i){switch(i){case"top":this.y+=e;case"bottom":this.height-=e;break;case"left":this.x+=e;case"right":this.width-=e;break;case"vertical":this.y+=e,this.height-=e*2;break;case"horizontal":this.x+=e,this.width-=e*2;break;case void 0:this.x+=e,this.y+=e,this.width-=e*2,this.height-=e*2;break}}translate(e,i){return this.x+=e,this.y+=i,this}[interpolate](e,i){return new yt(this.x*(1-i)+e.x*i,this.y*(1-i)+e.y*i,this.width*(1-i)+e.width*i,this.height*(1-i)+e.height*i)}};_BBox.zero=Object.freeze(new _BBox(0,0,0,0)),_BBox.NaN=Object.freeze(new _BBox(NaN,NaN,NaN,NaN));var BBox=_BBox;function SceneChangeDetection(t){return function(e,i){const s=`__${i}`;e[i]||prepareGetSet(e,i,s,t)}}function prepareGetSet(t,e,i,s){const{type:n="normal",changeCb:r,convertor:o,checkDirtyOnAssignment:a=!1}=s??{},l={type:n,changeCb:r,checkDirtyOnAssignment:a,convertor:o};let c;switch(n){case"normal":c=buildNormalSetter(i,l);break;case"transform":c=buildTransformSetter(i);break;case"path":c=buildPathSetter(i);break}c=buildCheckDirtyChain(buildChangeCallbackChain(buildConvertorChain(c,l),l),l),Object.defineProperty(t,e,{set:c,get:function(){return this[i]},enumerable:!0,configurable:!0})}function buildConvertorChain(t,e){const{convertor:i}=e;return i?function(s){t.call(this,i(s))}:t}var NO_CHANGE=Symbol("no-change");function buildChangeCallbackChain(t,e){const{changeCb:i}=e;return i?function(s){const n=t.call(this,s);return n!==NO_CHANGE&&i.call(this,this),n}:t}function buildCheckDirtyChain(t,e){const{checkDirtyOnAssignment:i}=e;return i?function(s){const n=t.call(this,s);return s?._dirty===!0&&this.markDirty(),n}:t}function buildNormalSetter(t,e){const{changeCb:i}=e;return function(s){const n=this[t];return s!==n?(this[t]=s,this.markDirty(),i?.(this),s):NO_CHANGE}}function buildTransformSetter(t){return function(e){const i=this[t];return e!==i?(this[t]=e,this.markDirtyTransform(),e):NO_CHANGE}}function buildPathSetter(t){return function(e){const i=this[t];return e!==i?(this[t]=e,this._dirtyPath||(this._dirtyPath=!0,this.markDirty()),e):NO_CHANGE}}var PointerEvents=(t=>(t[t.All=0]="All",t[t.None=1]="None",t))(PointerEvents||{}),_Node=class Et{constructor(e){this.serialNumber=Et._nextSerialNumber++,this.childNodeCounts={groups:0,nonGroups:0,thisComplexity:0,complexity:0},this.id=createId(this),this.pointerEvents=0,this._dirty=!0,this.dirtyZIndex=!1,this.isContainerNode=!1,this.visible=!0,this.zIndex=0,this.name=e?.name,this.tag=e?.tag??NaN,this.zIndex=e?.zIndex??0}static toSVG(e,i,s){const n=e?.toSVG();if(n==null||!n.elements.length&&!n.defs?.length)return;const r=createSvgElement("svg");if(r.setAttribute("width",String(i)),r.setAttribute("height",String(s)),r.setAttribute("viewBox",`0 0 ${i} ${s}`),n.defs?.length){const o=createSvgElement("defs");o.append(...n.defs),r.append(o)}return r.append(...n.elements),r.outerHTML}static*extractBBoxes(e,i){for(const s of e)if(!i||s.visible&&!s.transitionOut){const n=s.getBBox();n&&(yield n)}}get datum(){return this._datum??this.parentNode?.datum}set datum(e){this._datum!==e&&(this._previousDatum=this._datum,this._datum=e)}get previousDatum(){return this._previousDatum}get layerManager(){return this._layerManager}get dirty(){return this._dirty}preRender(e,i=1){this.childNodeCounts.groups=0,this.childNodeCounts.nonGroups=1,this.childNodeCounts.complexity=i,this.childNodeCounts.thisComplexity=i;for(const s of this.children()){const n=s.preRender(e);this.childNodeCounts.groups+=n.groups,this.childNodeCounts.nonGroups+=n.nonGroups,this.childNodeCounts.complexity+=n.complexity}return this.childNodeCounts}render(e){const{stats:i}=e;if(this._dirty=!1,e.debugNodeSearch){const s=this.name??this.id;e.debugNodeSearch.some(n=>typeof n=="string"?n===s:n.test(s))&&(e.debugNodes[this.name??this.id]=this)}i&&(i.nodesRendered++,i.opsPerformed+=this.childNodeCounts.thisComplexity)}_setLayerManager(e){this._layerManager=e,this._debug=e?.debug;for(const i of this.children())i._setLayerManager(e)}sortChildren(e){if(this.dirtyZIndex=!1,!this.childNodes)return;const i=[...this.childNodes].sort(e);this.childNodes.clear();for(const s of i)this.childNodes.add(s)}*traverseUp(e){let i=this;for(e&&(yield i);i=i.parentNode;)yield i}*children(){if(this.childNodes)for(const e of this.childNodes)yield e}*descendants(){for(const e of this.children())yield e,yield*e.descendants()}isLeaf(){return!this.childNodes?.size}isRoot(){return!this.parentNode}append(e){this.childNodes??(this.childNodes=new Set);for(const i of toIterable(e))i.parentNode?.removeChild(i),this.childNodes.add(i),i.parentNode=this,i._setLayerManager(this.layerManager);this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty()}appendChild(e){return this.append(e),e}removeChild(e){return this.childNodes?.delete(e)?(delete e.parentNode,e._setLayerManager(),this.invalidateCachedBBox(),this.dirtyZIndex=!0,this.markDirty(),!0):!1}remove(){return this.parentNode?.removeChild(this)??!1}clear(){for(const e of this.children())delete e.parentNode,e._setLayerManager();this.childNodes?.clear(),this.invalidateCachedBBox()}destroy(){this.parentNode?.removeChild(this)}setProperties(e,i){if(i)for(const s of i)this[s]=e[s];else Object.assign(this,e);return this}containsPoint(e,i){return!1}pickNode(e,i,s=!1){if(!this.visible||this.pointerEvents===1||!this.containsPoint(e,i))return;const n=[...this.children()];if(n.length>1e3)for(let r=n.length-1;r>=0;r--){const o=n[r],l=o.containsPoint(e,i)?o.pickNode(e,i):void 0;if(l)return l}else if(n.length)for(let r=n.length-1;r>=0;r--){const o=n[r].pickNode(e,i);if(o)return o}else if(!this.isContainerNode)return this}invalidateCachedBBox(){this.cachedBBox!=null&&(this.cachedBBox=void 0,this.parentNode?.invalidateCachedBBox())}getBBox(){return this.cachedBBox==null&&(this.cachedBBox=Object.freeze(this.computeBBox())),this.cachedBBox}computeBBox(){}markDirty(){const{_dirty:e}=this;this.cachedBBox==null&&e||(this.invalidateCachedBBox(),this._dirty=!0,this.parentNode&&this.parentNode.markDirty())}markClean(){if(this._dirty){this._dirty=!1;for(const e of this.children())e.markClean()}}onZIndexChange(){const{parentNode:e}=this;e&&(e.dirtyZIndex=!0)}toSVG(){}};_Node._nextSerialNumber=0,__decorateClass([SceneChangeDetection()],_Node.prototype,"visible",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onZIndexChange()})],_Node.prototype,"zIndex",2);var Node=_Node,lerp=(t,e,i)=>t*(1-i)+e*i,srgbToLinear=t=>{const e=t<0?-1:1,i=Math.abs(t);return i<=.04045?t/12.92:e*((i+.055)/1.055)**2.4},srgbFromLinear=t=>{const e=t<0?-1:1,i=Math.abs(t);return i>.0031308?e*(1.055*i**(1/2.4)-.055):12.92*t},_Color=class tt{constructor(e,i,s,n=1){this.r=clamp(0,e||0,1),this.g=clamp(0,i||0,1),this.b=clamp(0,s||0,1),this.a=clamp(0,n||0,1)}static validColorString(e){return e.indexOf("#")>=0?!!tt.parseHex(e):e.indexOf("rgb")>=0?!!tt.stringToRgba(e):tt.nameToHex.has(e.toLowerCase())}static fromString(e){if(e.indexOf("#")>=0)return tt.fromHexString(e);const i=tt.nameToHex.get(e.toLowerCase());if(i)return tt.fromHexString(i);if(e.indexOf("rgb")>=0)return tt.fromRgbaString(e);throw new Error(`Invalid color string: '${e}'`)}static parseHex(e){e=e.replace(/ /g,"").slice(1);let i;switch(e.length){case 6:case 8:i=[];for(let s=0;sparseInt(s,16)).map(s=>s+s*16);break}if(i?.length>=3&&i.every(s=>s>=0))return i.length===3&&i.push(255),i}static fromHexString(e){const i=tt.parseHex(e);if(i){const[s,n,r,o]=i;return new tt(s/255,n/255,r/255,o/255)}throw new Error(`Malformed hexadecimal color string: '${e}'`)}static stringToRgba(e){let i=-1,s=-1;for(let a=0;a=0?(c=clamp(0,c,100),c/=100):a===3?c=clamp(0,c,1):(c=clamp(0,c,255),c/=255),o.push(c)}return o}static fromRgbaString(e){const i=tt.stringToRgba(e);if(i){if(i.length===3)return new tt(i[0],i[1],i[2]);if(i.length===4)return new tt(i[0],i[1],i[2],i[3])}throw new Error(`Malformed rgb/rgba color string: '${e}'`)}static fromArray(e){if(e.length===4)return new tt(e[0],e[1],e[2],e[3]);if(e.length===3)return new tt(e[0],e[1],e[2]);throw new Error("The given array should contain 3 or 4 color components (numbers).")}static fromHSB(e,i,s,n=1){const r=tt.HSBtoRGB(e,i,s);return new tt(r[0],r[1],r[2],n)}static fromHSL(e,i,s,n=1){const r=tt.HSLtoRGB(e,i,s);return new tt(r[0],r[1],r[2],n)}static fromOKLCH(e,i,s,n=1){const r=tt.OKLCHtoRGB(e,i,s);return new tt(r[0],r[1],r[2],n)}static padHex(e){return e.length===1?"0"+e:e}toHexString(){let e="#"+tt.padHex(Math.round(this.r*255).toString(16))+tt.padHex(Math.round(this.g*255).toString(16))+tt.padHex(Math.round(this.b*255).toString(16));return this.a<1&&(e+=tt.padHex(Math.round(this.a*255).toString(16))),e}toRgbaString(e=3){const i=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)],s=Math.pow(10,e);return this.a!==1?(i.push(Math.round(this.a*s)/s),`rgba(${i.join(", ")})`):`rgb(${i.join(", ")})`}toString(){return this.a===1?this.toHexString():this.toRgbaString()}toHSB(){return tt.RGBtoHSB(this.r,this.g,this.b)}static RGBtoOKLCH(e,i,s){const n=srgbToLinear(e),r=srgbToLinear(i),o=srgbToLinear(s),a=Math.cbrt(.4122214708*n+.5363325363*r+.0514459929*o),l=Math.cbrt(.2119034982*n+.6806995451*r+.1073969566*o),c=Math.cbrt(.0883024619*n+.2817188376*r+.6299787005*o),h=.2104542553*a+.793617785*l-.0040720468*c,u=1.9779984951*a-2.428592205*l+.4505937099*c,d=.0259040371*a+.7827717662*l-.808675766*c,p=Math.atan2(d,u)*180/Math.PI,g=h,m=Math.hypot(u,d),y=p>=0?p:p+360;return[g,m,y]}static OKLCHtoRGB(e,i,s){const n=e,r=i*Math.cos(s*Math.PI/180),o=i*Math.sin(s*Math.PI/180),a=(n+.3963377774*r+.2158037573*o)**3,l=(n-.1055613458*r-.0638541728*o)**3,c=(n-.0894841775*r-1.291485548*o)**3,h=4.0767416621*a-3.3077115913*l+.2309699292*c,u=-1.2684380046*a+2.6097574011*l-.3413193965*c,d=-.0041960863*a-.7034186147*l+1.707614701*c,p=srgbFromLinear(h),g=srgbFromLinear(u),m=srgbFromLinear(d);return[p,g,m]}static RGBtoHSL(e,i,s){const n=Math.min(e,i,s),r=Math.max(e,i,s),o=(r+n)/2;let a,l;if(r===n)a=0,l=0;else{const c=r-n;l=o>.5?c/(2-r-n):c/(r+n),r===e?a=(i-s)/c+(i1&&(h-=1),h<1/6?r+(n-r)*6*h:h<1/2?n:h<2/3?r+(n-r)*(2/3-h)*6:r}const a=o(e/360+1/3),l=o(e/360),c=o(e/360-1/3);return[a,l,c]}static RGBtoHSB(e,i,s){const n=Math.min(e,i,s),r=Math.max(e,i,s),o=r===0?0:(r-n)/r;let a=0;if(n!==r){const l=r-n,c=(r-e)/l,h=(r-i)/l,u=(r-s)/l;e===r?a=u-h:i===r?a=2+c-u:a=4+h-c,a/=6,a<0&&(a=a+1)}return[a*360,o,r]}static HSBtoRGB(e,i,s){e=(e%360+360)%360/360;let n=0,r=0,o=0;if(i===0)n=r=o=s;else{const a=(e-Math.floor(e))*6,l=a-Math.floor(a),c=s*(1-i),h=s*(1-i*l),u=s*(1-i*(1-l));switch(a>>0){case 0:n=s,r=u,o=c;break;case 1:n=h,r=s,o=c;break;case 2:n=c,r=s,o=u;break;case 3:n=c,r=h,o=s;break;case 4:n=u,r=c,o=s;break;case 5:n=s,r=c,o=h;break}}return[n,r,o]}static mix(e,i,s){return new tt(lerp(e.r,i.r,s),lerp(e.g,i.g,s),lerp(e.b,i.b,s),lerp(e.a,i.a,s))}};_Color.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 Color=_Color;function interpolateNumber(t,e){return i=>Number(t)*(1-i)+Number(e)*i}function interpolateColor(t,e){if(typeof t=="string")try{t=Color.fromString(t)}catch{t=Color.fromArray([0,0,0])}if(typeof e=="string")try{e=Color.fromString(e)}catch{e=Color.fromArray([0,0,0])}return i=>Color.mix(t,e,i).toRgbaString()}var BREAK_TRANSFORM_CHAIN=Symbol("BREAK"),CONFIG_KEY="__decorator_config";function initialiseConfig(t,e){Object.getOwnPropertyDescriptor(t,CONFIG_KEY)==null&&Object.defineProperty(t,CONFIG_KEY,{value:{}});const i=t[CONFIG_KEY],s=e.toString();if(typeof i[s]<"u")return i[s];const n=new WeakMap;i[s]={setters:[],getters:[],observers:[],valuesMap:n};const r=Object.getOwnPropertyDescriptor(t,e),o=r?.set,a=r?.get;return Object.defineProperty(t,e,{set:function(h){const{setters:u,observers:d}=i[s];let p;u.some(g=>g.length>2)&&(p=a?a.call(this):n.get(this));for(const g of u)if(h=g(this,e,h,p),h===BREAK_TRANSFORM_CHAIN)return;o?o.call(this,h):n.set(this,h);for(const g of d)g(this,h,p)},get:function(){let h=a?a.call(this):n.get(this);for(const u of i[s].getters)if(h=u(this,e,h),h===BREAK_TRANSFORM_CHAIN)return;return h},enumerable:!0,configurable:!1}),i[s]}function addTransformToInstanceProperty(t,e,i){return(s,n)=>{const r=initialiseConfig(s,n);r.setters.push(t),e&&r.getters.unshift(e),i&&Object.assign(r,i)}}function addObserverToInstanceProperty(t){return(e,i)=>{initialiseConfig(e,i).observers.push(t)}}function isDecoratedObject(t){return typeof t<"u"&&CONFIG_KEY in t}function listDecoratedProperties(t){const e=new Set;for(;isDecoratedObject(t);)e.add(t?.[CONFIG_KEY]),t=Object.getPrototypeOf(t);return Array.from(e).flatMap(i=>Object.keys(i))}function extractDecoratedProperties(t){return listDecoratedProperties(t).reduce((e,i)=>(e[i]=t[i]??null,e),{})}function extractDecoratedPropertyMetadata(t,e){const i=e.toString();for(;isDecoratedObject(t);){const s=t[CONFIG_KEY];if(Object.hasOwn(s,i))return s[i];t=Object.getPrototypeOf(t)}}function objectsEqual(t,e){return Array.isArray(t)?!Array.isArray(e)||t.length!==e.length?!1:t.every((i,s)=>objectsEqual(i,e[s])):isPlainObject(t)?isPlainObject(e)?objectsEqualWith(t,e,objectsEqual):!1:t===e}function objectsEqualWith(t,e,i){for(const s of Object.keys(e))if(!(s in t))return!1;for(const s of Object.keys(t))if(!(s in e)||!i(t[s],e[s]))return!1;return!0}function mergeDefaults(...t){const e={};for(const i of t){if(!isObject(i))continue;const s=isDecoratedObject(i)?listDecoratedProperties(i):Object.keys(i);for(const n of s)isPlainObject(e[n])&&isPlainObject(i[n])?e[n]=mergeDefaults(e[n],i[n]):e[n]??(e[n]=i[n])}return e}function mergeArrayDefaults(t,...e){return e&&isArray(t)?t.map(i=>mergeDefaults(i,...e)):t}function mapValues(t,e){return Object.entries(t).reduce((i,[s,n])=>(i[s]=e(n,s,t),i),{})}function without(t,e){const i={...t};for(const s of e)delete i[s];return i}function getPath(t,e){return(isArray(e)?e:e.split(".")).reduce((s,n)=>s[n],t)}var SKIP_JS_BUILTINS=new Set(["__proto__","constructor","prototype"]);function setPath(t,e,i){const s=isArray(e)?e.slice():e.split("."),n=s.pop();if(s.some(o=>SKIP_JS_BUILTINS.has(o)))return;const r=s.reduce((o,a)=>o[a],t);return r[n]=i,r[n]}function partialAssign(t,e,i){if(i===void 0)return e;for(const s of t){const n=i[s];n!==void 0&&(e[s]=n)}return e}function deepFreeze(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const i=t[e];i!==null&&(typeof i=="object"||typeof i=="function")&&!Object.isFrozen(i)&&deepFreeze(i)}),t}var easing_exports={};__export(easing_exports,{easeIn:()=>easeIn,easeInOut:()=>easeInOut,easeInOutQuad:()=>easeInOutQuad,easeInQuad:()=>easeInQuad,easeOut:()=>easeOut,easeOutQuad:()=>easeOutQuad,inverseEaseOut:()=>inverseEaseOut,linear:()=>linear});var linear=t=>t,easeIn=t=>1-Math.cos(t*Math.PI/2),easeOut=t=>Math.sin(t*Math.PI/2),easeInOut=t=>-(Math.cos(t*Math.PI)-1)/2,easeInQuad=t=>t*t,easeOutQuad=t=>1-(1-t)**2,easeInOutQuad=t=>t<.5?2*t*t:1-(-2*t+2)**2/2,inverseEaseOut=t=>2*Math.asin(t)/Math.PI,QUICK_TRANSITION=.2,PHASE_ORDER=["initial","remove","update","add","trailing","end","none"],PHASE_METADATA={initial:{animationDuration:1,animationDelay:0},add:{animationDuration:.25,animationDelay:.75},remove:{animationDuration:.25,animationDelay:0},update:{animationDuration:.5,animationDelay:.25},trailing:{animationDuration:QUICK_TRANSITION,animationDelay:1,skipIfNoEarlierAnimations:!0},end:{animationDelay:1+QUICK_TRANSITION,animationDuration:0,skipIfNoEarlierAnimations:!0},none:{animationDuration:0,animationDelay:0}},RepeatType=(t=>(t.Loop="loop",t.Reverse="reverse",t))(RepeatType||{});function isNodeArray(t){return t.every(e=>e instanceof Node)}function deconstructSelectionsOrNodes(t){return isNodeArray(t)?{nodes:t,selections:[]}:{nodes:[],selections:t}}function animationValuesEqual(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((i,s)=>animationValuesEqual(i,e[s])):isInterpolating(t)&&isInterpolating(e)?t.equals(e):isPlainObject(t)&&isPlainObject(e)?objectsEqualWith(t,e,animationValuesEqual):!1}var Animation=class{constructor(t){this.isComplete=!1,this.elapsed=0,this.iteration=0,this.isPlaying=!1,this.isReverse=!1,this.id=t.id,this.groupId=t.groupId,this.autoplay=t.autoplay??!0,this.ease=t.ease??linear,this.phase=t.phase;const e=t.duration??PHASE_METADATA[this.phase].animationDuration;this.duration=e*t.defaultDuration,this.delay=(t.delay??0)*t.defaultDuration,this.onComplete=t.onComplete,this.onPlay=t.onPlay,this.onStop=t.onStop,this.onUpdate=t.onUpdate,this.interpolate=this.createInterpolator(t.from,t.to),this.from=t.from,t.skip===!0&&(this.onUpdate?.(t.to,!1,this),this.onStop?.(this),this.onComplete?.(this),this.isComplete=!0),t.collapsable!==!1&&(this.duration=this.checkCollapse(t,this.duration))}checkCollapse(t,e){return animationValuesEqual(t.from,t.to)?0:e}play(t=!1){this.isPlaying||this.isComplete||(this.isPlaying=!0,this.onPlay?.(this),this.autoplay&&(this.autoplay=!1,t&&this.onUpdate?.(this.from,!0,this)))}stop(){this.isPlaying=!1,this.isComplete||(this.isComplete=!0,this.onStop?.(this))}update(t){if(this.isComplete)return t;!this.isPlaying&&this.autoplay&&this.play(!0);const e=this.elapsed;if(this.elapsed+=t,this.delay>this.elapsed)return 0;const i=this.interpolate(this.isReverse?1-this.delta:this.delta);this.onUpdate?.(i,!1,this);const s=this.delay+this.duration;return this.elapsed>=s?(this.stop(),this.isComplete=!0,this.onComplete?.(this),t-(s-e)):0}get delta(){return this.ease(clamp(0,(this.elapsed-this.delay)/this.duration,1))}createInterpolator(t,e){if(typeof e!="object"||isInterpolating(e))return this.interpolateValue(t,e);const i=[];for(const s of Object.keys(e)){const n=this.interpolateValue(t[s],e[s]);n!=null&&i.push([s,n])}return s=>{const n={};for(const[r,o]of i)n[r]=o(s);return n}}interpolateValue(t,e){if(!(t==null||e==null)){if(isInterpolating(t))return i=>t[interpolate](e,i);try{switch(typeof t){case"number":return interpolateNumber(t,e);case"string":return interpolateColor(t,e);case"boolean":if(t===e)return()=>t;break}}catch{}throw new Error(`Unable to interpolate values: ${t}, ${e}`)}}},NODE_UPDATE_STATE_TO_PHASE_MAPPING={added:"add",updated:"update",removed:"remove",unknown:"initial","no-op":"none"};function fromToMotion(t,e,i,s,n,r,o){const{fromFn:a,toFn:l,applyFn:c=(g,m)=>g.setProperties(m)}=n,{nodes:h,selections:u}=deconstructSelectionsOrNodes(s),d=(g,m)=>{let y,f=0,x=0;for(const v of m){const b=g[f]===v,S={last:x>=m.length-1,lastLive:f>=g.length-1,prev:m[x-1],prevFromProps:y,prevLive:g[f-1],next:m[x+1],nextLive:g[f+(b?1:0)]},A=`${t}_${e}_${v.id}`;i.stopByAnimationId(A);let D="unknown";b?r&&o&&(D=calculateStatus(v,v.datum,r,o)):D="removed",v.transitionOut=D==="removed";const{phase:I,start:L,finish:N,delay:T,duration:w,...O}=a(v,v.datum,D,S),{phase:Z,start:F,finish:U,delay:W,duration:H,..._}=l(v,v.datum,D,S),E=N==null;i.animate({id:A,groupId:t,phase:I??Z??"update",duration:w??H,delay:T??W,from:O,to:_,ease:easeOut,collapsable:E,onPlay:()=>{const P={...L,...F,...O};c(v,P,"start")},onUpdate(P){c(v,P,"update")},onStop:()=>{const P={...L,...F,...O,..._,...N,...U};c(v,P,"end")}}),b&&f++,x++,y=O}};let p=0;for(const g of u){const m=g.nodes(),y=m.filter(f=>!g.isGarbage(f));d(y,m),i.animate({id:`${t}_${e}_selection_${p}`,groupId:t,phase:"end",from:0,to:1,ease:easeOut,onStop(){g.cleanup()}}),p++}d(h,h)}function staticFromToMotion(t,e,i,s,n,r,o){const{nodes:a,selections:l}=deconstructSelectionsOrNodes(s),{start:c,finish:h,phase:u}=o;i.animate({id:`${t}_${e}`,groupId:t,phase:u??"update",from:n,to:r,ease:easeOut,onPlay:()=>{if(c){for(const d of a)d.setProperties(c);for(const d of l)for(const p of d.nodes())p.setProperties(c)}},onUpdate(d){for(const p of a)p.setProperties(d);for(const p of l)for(const g of p.nodes())g.setProperties(d)},onStop:()=>{for(const d of a)d.setProperties({...r,...h});for(const d of l){for(const p of d.nodes())p.setProperties({...r,...h});d.cleanup()}}})}function calculateStatus(t,e,i,s){const n=i(t,e);return s.added.has(n)?"added":s.removed.has(n)?"removed":"updated"}var AbstractScale=class{ticks(t,e,i){}niceDomain(t,e=this.domain){return e}tickFormatter(t){}datumFormatter(t){}get bandwidth(){}get step(){}get inset(){}},_ContinuousScale=class Ot extends AbstractScale{constructor(e=[],i=[]){super(),this.domain=e,this.range=i,this.defaultClamp=!1}static is(e){return e instanceof Ot}normalizeDomains(...e){let i,s=1/0,n,r=-1/0;for(const o of e)for(const a of o){const l=a.valueOf();lr&&(r=l,n=a)}return i!=null&&n!=null?{domain:[i,n],animatable:!0}:{domain:[],animatable:!1}}transform(e){return e}transformInvert(e){return e}calcBandwidth(e=1){const{domain:i}=this,s=this.getPixelRange();if(i.length===0)return s;const n=Math.abs(i[1].valueOf()-i[0].valueOf())/e+1,r=Math.floor(s),o=Math.min(n,r);return s/Math.max(1,o)}convert(e,i=this.defaultClamp){const{domain:s}=this;if(!s||s.length<2)return NaN;const n=Number(this.transform(s[0])),r=Number(this.transform(s[1])),o=Number(this.transform(e)),{range:a}=this,[l,c]=a;if(i){const[h,u]=findMinMax([n,r]);if(ou)return c}return n===r?(l+c)/2:o===n?l:o===r?c:l+(o-n)/(r-n)*(c-l)}invert(e,i){const s=this.domain.map(h=>this.transform(h)),[n,r]=s,{range:o}=this,[a,l]=o;let c;return a===l?c=this.toDomain((Number(n)+Number(r))/2):c=this.toDomain(Number(n)+(e-a)/(l-a)*(Number(r)-Number(n))),this.transformInvert(c)}getPixelRange(){const[e,i]=this.range;return Math.abs(i-e)}};_ContinuousScale.defaultTickCount=5;var ContinuousScale=_ContinuousScale,time_exports={};__export(time_exports,{TimeInterval:()=>TimeInterval,day:()=>day,friday:()=>friday,hour:()=>hour,millisecond:()=>millisecond,minute:()=>minute,monday:()=>monday,month:()=>month,saturday:()=>saturday,second:()=>second,sunday:()=>sunday,thursday:()=>thursday,tuesday:()=>tuesday,utcDay:()=>utcDay,utcHour:()=>utcHour,utcMinute:()=>utcMinute,utcMonth:()=>utcMonth,utcYear:()=>utcYear,wednesday:()=>wednesday,year:()=>year});var TimeInterval=class{constructor(t,e,i){this._encode=t,this._decode=e,this._rangeCallback=i}floor(t){const e=new Date(t),i=this._encode(e);return this._decode(i)}ceil(t){const e=new Date(Number(t)-1),i=this._encode(e);return this._decode(i+1)}range(t,e,{extend:i=!1,visibleRange:s=[0,1]}={}){let n=!1;t.getTime()>e.getTime()&&([t,e]=[e,t],n=!0);const r=this._rangeCallback?.(t,e),o=this._encode(i?this.floor(t):this.ceil(t)),a=this._encode(i?this.ceil(e):this.floor(e));if(a{const u=r==="start"?c:h;return i=this.getOffset(u,t),()=>i=l}}else typeof r=="number"?i=this.getOffset(new Date(r),t):r instanceof Date&&(i=this.getOffset(r,t));const o=l=>Math.floor((this._encode(l)-i)/t),a=l=>this._decode(l*t+i);return new TimeInterval(o,a,s)}};function encode(t){return t.getTime()}function decode(t){return new Date(t)}var millisecond=new CountableTimeInterval(encode,decode),durationSecond=1e3,durationMinute=durationSecond*60,durationHour=durationMinute*60,durationDay=durationHour*24,durationWeek=durationDay*7,durationMonth=durationDay*30,durationYear=durationDay*365,offset=new Date().getTimezoneOffset()*durationMinute;function encode2(t){return Math.floor((t.getTime()-offset)/durationSecond)}function decode2(t){return new Date(offset+t*durationSecond)}var second=new CountableTimeInterval(encode2,decode2),offset2=new Date().getTimezoneOffset()*durationMinute;function encode3(t){return Math.floor((t.getTime()-offset2)/durationMinute)}function decode3(t){return new Date(offset2+t*durationMinute)}var minute=new CountableTimeInterval(encode3,decode3),offset3=new Date().getTimezoneOffset()*durationMinute;function encode4(t){return Math.floor((t.getTime()-offset3)/durationHour)}function decode4(t){return new Date(offset3+t*durationHour)}var hour=new CountableTimeInterval(encode4,decode4);function encode5(t){const e=t.getTimezoneOffset()*durationMinute;return Math.floor((t.getTime()-e)/durationDay)}function decode5(t){const e=new Date(1970,0,1);return e.setDate(e.getDate()+t),e}var day=new CountableTimeInterval(encode5,decode5);function weekday(t){const i=(7+t-4)%7;function s(r){const o=r.getTimezoneOffset()*durationMinute;return Math.floor((r.getTime()-o)/durationWeek-i/7)}function n(r){const o=new Date(1970,0,1);return o.setDate(o.getDate()+r*7+i),o}return new CountableTimeInterval(s,n)}var sunday=weekday(0),monday=weekday(1),tuesday=weekday(2),wednesday=weekday(3),thursday=weekday(4),friday=weekday(5),saturday=weekday(6);function encode6(t){return t.getFullYear()*12+t.getMonth()}function decode6(t){const e=Math.floor(t/12),i=t-e*12;return new Date(e,i,1)}var month=new CountableTimeInterval(encode6,decode6);function encode7(t){return t.getFullYear()}function decode7(t){const e=new Date;return e.setFullYear(t),e.setMonth(0,1),e.setHours(0,0,0,0),e}var year=new CountableTimeInterval(encode7,decode7);function encode8(t){return Math.floor(t.getTime()/durationMinute)}function decode8(t){return new Date(t*durationMinute)}var utcMinute=new CountableTimeInterval(encode8,decode8);function encode9(t){return Math.floor(t.getTime()/durationHour)}function decode9(t){return new Date(t*durationHour)}var utcHour=new CountableTimeInterval(encode9,decode9);function encode10(t){return Math.floor(t.getTime()/durationDay)}function decode10(t){const e=new Date(0);return e.setUTCDate(e.getUTCDate()+t),e.setUTCHours(0,0,0,0),e}var utcDay=new CountableTimeInterval(encode10,decode10);function encode11(t){return t.getUTCFullYear()*12+t.getUTCMonth()}function decode11(t){const e=Math.floor(t/12),i=t-e*12;return new Date(Date.UTC(e,i,1))}var utcMonth=new CountableTimeInterval(encode11,decode11);function encode12(t){return t.getUTCFullYear()}function decode12(t){const e=new Date;return e.setUTCFullYear(t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0),e}var utcYear=new CountableTimeInterval(encode12,decode12),CONSTANTS={periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};function dayOfYear(t,e=new Date(t.getFullYear(),0,1)){const i=t.getTimezoneOffset()-e.getTimezoneOffset(),s=t.getTime()-e.getTime()+i*6e4,n=36e5*24;return Math.floor(s/n)}function weekOfYear(t,e){const s=new Date(t.getFullYear(),0,1).getDay(),n=(e-s+7)%7,r=new Date(t.getFullYear(),0,n+1);return r<=t?Math.floor(dayOfYear(t,r)/7)+1:0}var SUNDAY=0,MONDAY=1,THURSDAY=4;function isoWeekOfYear(t,e=t.getFullYear()){const s=new Date(e,0,1).getDay(),n=(THURSDAY-s+7)%7,r=new Date(e,0,n-(THURSDAY-MONDAY)+1);return r<=t?Math.floor(dayOfYear(t,r)/7)+1:isoWeekOfYear(t,e-1)}function timezone(t){const e=t.getTimezoneOffset(),i=Math.abs(e);return`${e>0?"-":"+"}${pad(Math.floor(i/60),2,"0")}${pad(Math.floor(i%60),2,"0")}`}var FORMATTERS={a:t=>CONSTANTS.shortDays[t.getDay()],A:t=>CONSTANTS.days[t.getDay()],b:t=>CONSTANTS.shortMonths[t.getMonth()],B:t=>CONSTANTS.months[t.getMonth()],c:"%x, %X",d:(t,e)=>pad(t.getDate(),2,e??"0"),e:"%_d",f:(t,e)=>pad(t.getMilliseconds()*1e3,6,e??"0"),H:(t,e)=>pad(t.getHours(),2,e??"0"),I:(t,e)=>{const i=t.getHours()%12;return i===0?"12":pad(i,2,e??"0")},j:(t,e)=>pad(dayOfYear(t)+1,3,e??"0"),m:(t,e)=>pad(t.getMonth()+1,2,e??"0"),M:(t,e)=>pad(t.getMinutes(),2,e??"0"),L:(t,e)=>pad(t.getMilliseconds(),3,e??"0"),p:t=>t.getHours()<12?"AM":"PM",Q:t=>String(t.getTime()),s:t=>String(Math.floor(t.getTime()/1e3)),S:(t,e)=>pad(t.getSeconds(),2,e??"0"),u:t=>{let e=t.getDay();return e<1&&(e+=7),String(e%7)},U:(t,e)=>pad(weekOfYear(t,SUNDAY),2,e??"0"),V:(t,e)=>pad(isoWeekOfYear(t),2,e??"0"),w:(t,e)=>pad(t.getDay(),2,e??"0"),W:(t,e)=>pad(weekOfYear(t,MONDAY),2,e??"0"),x:"%-m/%-d/%Y",X:"%-I:%M:%S %p",y:(t,e)=>pad(t.getFullYear()%100,2,e??"0"),Y:(t,e)=>pad(t.getFullYear(),4,e??"0"),Z:t=>timezone(t),"%":()=>"%"},PADS={_:" ",0:"0","-":""};function pad(t,e,i){const s=String(Math.floor(t));return s.length>=e?s:`${i.repeat(e-s.length)}${s}`}function buildFormatter(t){const e=[];for(;t.length>0;){let i=t.indexOf("%");if(i!==0){const a=i>0?t.substring(0,i):t;e.push(a)}if(i<0)break;const s=t[i+1],n=PADS[s];n!=null&&i++;const r=t[i+1],o=FORMATTERS[r];if(typeof o=="function")e.push([o,n]);else if(typeof o=="string"){const a=buildFormatter(o);e.push([a,n])}else e.push(`${n??""}${r}`);t=t.substring(i+2)}return i=>{const s=typeof i=="number"?new Date(i):i;return e.map(n=>typeof n=="string"?n:n[0](s,n[1])).join("")}}function dateToNumber(t){return t instanceof Date?t.getTime():t}function defaultTimeTickFormat(t,e,i){const s=calculateDefaultTimeTickFormat(t,e,i),n=buildFormatter(s);return r=>n(r)}function calculateDefaultTimeTickFormat(t,e,i=0){let s=1/0;for(let h=1;h0,c=isFinite(s)?getIntervalLowestGranularityFormat(s,t):getLowestGranularityFormat(t[0]);return formatStringBuilder(Math.max(c-i,0),l,t)}function getIntervalLowestGranularityFormat(t,e){return t{if(typeof d=="string")return!0;const[p,g,m,y]=d;return y>=t&&g<=r&&r(typeof p=="string"?d.result.push(p):d.used.has(p[0])||(d.result.push(p),d.used.add(p[0])),d),{result:[],used:new Set}).result,h=c.findIndex(d=>typeof d!="string"),u=c.findLastIndex(d=>typeof d!="string");return c.slice(h,u+1).map(d=>typeof d=="string"?d:d[4]).join("").replaceAll(/\s+/g," ").trim()}var Invalidating=(t,e)=>{const i=Symbol(String(e));t[i]=void 0,Object.defineProperty(t,e,{get(){return this[i]},set(s){this[i]!==s&&(this[i]=s,this.invalid=!0)},enumerable:!0,configurable:!1})};function filterVisibleTicks(t,e,i){if(i==null||i[0]===0&&i[1]===1)return t;const s=clamp(0,Math.floor(i[0]*t.length),t.length),n=clamp(0,Math.ceil(i[1]*t.length),t.length),r=e?t.length-n:s,o=e?t.length-s:n;return t.slice(r,o)}var _BandScale=class Rt extends AbstractScale{constructor(){super(...arguments),this.invalid=!0,this.range=[0,1],this.round=!1,this.interval=void 0,this._bandwidth=1,this._step=1,this._inset=1,this._rawBandwidth=1,this._paddingInner=0,this._paddingOuter=0}static is(e){return e instanceof Rt}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(e){e=clamp(0,e,1),this._paddingInner=e,this._paddingOuter=e}get padding(){return this._paddingInner}set paddingInner(e){this.invalid=!0,this._paddingInner=clamp(0,e,1)}get paddingInner(){return this._paddingInner}set paddingOuter(e){this.invalid=!0,this._paddingOuter=clamp(0,e,1)}get paddingOuter(){return this._paddingOuter}refresh(){this.invalid&&(this.invalid=!1,this.update(),this.invalid&&logger_exports.warnOnce("Expected update to not invalidate scale"))}ticks(e,i=this.domain,s){return filterVisibleTicks(i,!1,s)}convert(e,i){this.refresh();const s=this.getIndex(e);return s==null||s<0||s>=this.domain.length?NaN:this.ordinalRange(s)}invertNearestIndex(e){this.refresh();const{domain:i}=this;if(i.length===0)return-1;let s=0,n=i.length-1,r=1/0,o=0;for(;s<=n;){const a=(n+s)/2|0,l=this.ordinalRange(a),c=Math.abs(l-e);if(c===0)return a;c{const{optional:i}=extractDecoratedPropertyMetadata(this,e),s=i===!0||typeof this[e]<"u";return s||logger_exports.warnOnce(`${t??""}[${e}] is required.`),s})}toJson(){return listDecoratedProperties(this).reduce((t,e)=>{const i=this[e];return t[e]=isProperties(i)?i.toJson():i,t},{})}},PropertiesArray=class Pt extends Array{constructor(e,...i){super(i.length);const n=(r=>!!r?.prototype?.constructor?.name)(e)?r=>new e().set(r):e;Object.defineProperty(this,"itemFactory",{value:n,enumerable:!1,configurable:!1}),this.set(i)}set(e){if(isArray(e)){this.length=e.length;for(let i=0;ie?.toJson?.()??e)}};function isProperties(t){return t instanceof BaseProperties||t instanceof PropertiesArray}function Validate(t,e={}){const{optional:i=!1,property:s}=e;return addTransformToInstanceProperty((n,r,o)=>{const a={...e,target:n,property:r};if(i&&typeof o>"u"||t(o,a))return isProperties(n[r])&&!isProperties(o)?(n[r].set(o),n[r]):o;const l=s??String(r).replace(/^_*/,""),c=n.constructor.className??n.constructor.name.replace(/Properties$/,""),h=stringifyValue(o,50);return logger_exports.warn(`Property [${l}] of [${c}] cannot be set to [${h}]${t.message?`; expecting ${getPredicateMessage(t,a)}`:""}, ignoring.`),BREAK_TRANSFORM_CHAIN},void 0,{optional:i})}var AND=(...t)=>{const e=[];return predicateWithMessage((i,s)=>(e.length=0,t.every(n=>{const r=n(i,s);return r||e.push(getPredicateMessage(n,s)),r})),()=>e.filter(Boolean).join(" AND "))},OR=(...t)=>predicateWithMessage((e,i)=>t.some(s=>s(e,i)),e=>t.map(getPredicateMessageMapper(e)).filter(Boolean).join(" OR ")),OBJECT=attachObjectRestrictions(predicateWithMessage((t,e)=>isProperties(t)||isObject(t)&&isProperties(e.target[e.property]),"a properties object")),PLAIN_OBJECT=attachObjectRestrictions(predicateWithMessage(t=>isObject(t),"an object")),BOOLEAN=predicateWithMessage(isBoolean,"a boolean"),FUNCTION=predicateWithMessage(isFunction,"a function"),STRING=predicateWithMessage(isString,"a string"),NUMBER=attachNumberRestrictions(predicateWithMessage(isFiniteNumber,"a number")),REAL_NUMBER=predicateWithMessage(t=>isNumber(t)&&!isNaN(t),"a real number"),NAN=predicateWithMessage(t=>isNumber(t)&&isNaN(t),"NaN"),POSITIVE_NUMBER=NUMBER.restrict({min:0}),RATIO=NUMBER.restrict({min:0,max:1}),NUMBER_OR_NAN=OR(NUMBER,NAN),ARRAY=attachArrayRestrictions(predicateWithMessage(isArray,"an array")),ARRAY_OF=(t,e)=>predicateWithMessage((i,s)=>isArray(i)&&i.every(n=>t(n,s)),i=>{const s=getPredicateMessage(ARRAY,i)??"";return typeof e=="function"?`${s} of ${e(i)}`:e?`${s} of ${e}`:s}),isComparable2=t=>isFiniteNumber(t)||isValidDate(t),LESS_THAN=t=>predicateWithMessage((e,i)=>!isComparable2(e)||!isComparable2(i.target[t])||epredicateWithMessage((e,i)=>!isComparable2(e)||!isComparable2(i.target[t])||e>i.target[t],`to be greater than ${t}`),DATE=predicateWithMessage(isValidDate,"Date object"),DATE_OR_DATETIME_MS=OR(DATE,POSITIVE_NUMBER),colorMessage="A color string can be in one of the following formats to be valid: #rgb, #rrggbb, rgb(r, g, b), rgba(r, g, b, a) or a CSS color name such as 'white', 'orange', 'cyan', etc",COLOR_STRING=predicateWithMessage(t=>isString(t)&&Color.validColorString(t),`color String. ${colorMessage}`),COLOR_GRADIENT=attachObjectRestrictions(predicateWithMessage(t=>isObject(t)&&t.type==="gradient","a color gradient object")),COLOR_STRING_ARRAY=predicateWithMessage(ARRAY_OF(COLOR_STRING),`color strings. ${colorMessage}`),BOOLEAN_ARRAY=ARRAY_OF(BOOLEAN,"boolean values"),NUMBER_ARRAY=ARRAY_OF(NUMBER,"numbers"),STRING_ARRAY=ARRAY_OF(STRING,"strings"),DATE_ARRAY=predicateWithMessage(ARRAY_OF(DATE),"Date objects"),OBJECT_ARRAY=predicateWithMessage(ARRAY_OF(OBJECT),"objects"),LINE_CAP=UNION(["butt","round","square"],"a line cap"),LINE_JOIN=UNION(["round","bevel","miter"],"a line join"),LINE_STYLE=UNION(["solid","dashed","dotted"],"a line style"),LINE_DASH=predicateWithMessage(ARRAY_OF(POSITIVE_NUMBER),"numbers specifying the length in pixels of alternating dashes and gaps, for example, [6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels."),POSITION=UNION(["top","right","bottom","left"],"a position"),FONT_STYLE=UNION(["normal","italic","oblique"],"a font style"),FONT_WEIGHT=OR(UNION(["normal","bold","bolder","lighter"],"a font weight"),NUMBER.restrict({min:1,max:1e3})),TEXT_WRAP=UNION(["never","always","hyphenate","on-space"],"a text wrap strategy"),TEXT_ALIGN=UNION(["left","center","right"],"a text align"),VERTICAL_ALIGN=UNION(["top","middle","bottom"],"a vertical align"),OVERFLOW_STRATEGY=UNION(["ellipsis","hide"],"an overflow strategy"),DIRECTION=UNION(["horizontal","vertical"],"a direction"),PLACEMENT=UNION(["inside","outside"],"a placement"),INTERACTION_RANGE=OR(UNION(["exact","nearest"],"interaction range"),NUMBER),LABEL_PLACEMENT=UNION(["top","bottom","left","right"]);function UNION(t,e="a"){return predicateWithMessage((i,s)=>{const n=t.find(r=>{const o=typeof r=="string"?r:r.value;return i===o});if(n==null)return!1;if(typeof n!="string"&&(n.deprecated===!0||n.deprecatedTo!=null)){const r=[`Property [%s] with value '${n.value}' is deprecated.`];n.deprecatedTo&&r.push(`Use ${n.deprecatedTo} instead.`),logger_exports.warnOnce(r.join(" "),s.property)}return!0},`${e} keyword such as ${joinUnionOptions(t)}`)}var MIN_SPACING=OR(AND(NUMBER.restrict({min:1}),LESS_THAN("maxSpacing")),NAN),MAX_SPACING=OR(AND(NUMBER.restrict({min:1}),GREATER_THAN("minSpacing")),NAN);function predicateWithMessage(t,e){return t.message=e,t}function joinUnionOptions(t){const e=t.filter(s=>typeof s=="string"||s.undocumented!==!0).map(s=>`'${typeof s=="string"?s:s.value}'`);if(e.length===1)return e[0];const i=e.pop();return`${e.join(", ")} or ${i}`}function getPredicateMessage(t,e){return isFunction(t.message)?t.message(e):t.message}function getPredicateMessageMapper(t){return e=>getPredicateMessage(e,t)}function attachArrayRestrictions(t){return Object.assign(t,{restrict({length:e,minLength:i}={}){let s="an array";return isNumber(i)&&i>0?s="a non-empty array":isNumber(e)&&(s=`an array of length ${e}`),predicateWithMessage(n=>isArray(n)&&(isNumber(e)?n.length===e:!0)&&(isNumber(i)?n.length>=i:!0),s)}})}function attachNumberRestrictions(t){return Object.assign(t,{restrict({min:e,max:i}={}){const s=["a number"],n=isNumber(e),r=isNumber(i);return n&&r?s.push(`between ${e} and ${i} inclusive`):n?s.push(`greater than or equal to ${e}`):r&&s.push(`less than or equal to ${i}`),predicateWithMessage(o=>isFiniteNumber(o)&&(n?o>=e:!0)&&(r?o<=i:!0),s.join(" "))}})}function attachObjectRestrictions(t){return Object.assign(t,{restrict(e){return predicateWithMessage(i=>i instanceof e,i=>getPredicateMessage(t,i)??`an instance of ${e.name}`)}})}var resetMotion_exports={};__export(resetMotion_exports,{resetMotion:()=>resetMotion});function resetMotion(t,e){const{nodes:i,selections:s}=deconstructSelectionsOrNodes(t);for(const n of s){for(const r of n.nodes()){const o=e(r,r.datum);r.setProperties(o)}n.cleanup()}for(const n of i){const r=e(n,n.datum);n.setProperties(r)}}var LONG_TIME_PERIOD_THRESHOLD=2e3,timeOfLastLog=Date.now(),logTimeGap=()=>{const t=Date.now()-timeOfLastLog;if(t>LONG_TIME_PERIOD_THRESHOLD){const e=(Math.floor(t/100)/10).toFixed(1);logger_exports.log(`**** ${e}s since last log message ****`)}timeOfLastLog=Date.now()},Debug={create(...t){return Object.assign((...i)=>{Debug.check(...t)&&(typeof i[0]=="function"&&(i=toArray(i[0]())),logTimeGap(),logger_exports.log(...i))},{check:()=>Debug.check(...t),group:(i,s)=>Debug.check(...t)?logger_exports.logGroup(i,s):s()})},check(...t){return t.length===0&&t.push(!0),toArray(getWindow("agChartsDebug")).some(i=>t.includes(i))}};function clearContext({context:t,pixelRatio:e,width:i,height:s}){t.save(),t.resetTransform(),t.clearRect(0,0,Math.ceil(i*e),Math.ceil(s*e)),t.restore()}function debugContext(t){if(Debug.check("canvas")){const e=t.save.bind(t),i=t.restore.bind(t);let s=0;Object.assign(t,{save(){e(),s++},restore(){if(s===0)throw new Error("AG Charts - Unable to restore() past depth 0");i(),s--},verifyDepthZero(){if(s!==0)throw new Error(`AG Charts - Save/restore depth is non-zero: ${s}`)}})}}function canvasDimensions(t,e,i){return[Math.round(t*i),Math.round(e*i)]}var HdpiOffscreenCanvas=class{constructor(t){const{width:e,height:i,pixelRatio:s,willReadFrequently:n=!1}=t;this.width=e,this.height=i,this.pixelRatio=s;const[r,o]=canvasDimensions(e,i,s);this.canvas=new OffscreenCanvas(r,o),this.context=this.canvas.getContext("2d",{willReadFrequently:n}),this.context.setTransform(s,0,0,s,0,0),debugContext(this.context)}drawImage(t,e=0,i=0){return t.drawImage(this.canvas,e,i)}transferToImageBitmap(){return this.canvas.transferToImageBitmap()}resize(t,e,i){if(!(t>0&&e>0))return;const{canvas:s,context:n}=this;if(t!==this.width||e!==this.height||i!==this.pixelRatio){const[r,o]=canvasDimensions(t,e,i);s.width=r,s.height=o}n.setTransform(i,0,0,i,0,0),this.width=t,this.height=e,this.pixelRatio=i}clear(){clearContext(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)}},convertColorStringToOklcha=t=>{const e=Color.fromString(t),[i,s,n]=Color.RGBtoOKLCH(e.r,e.g,e.b);return{l:i,c:s,h:n,a:e.a}},delta=1e-6,isAchromatic=t=>t.c1-delta,interpolateOklch=(t,e,i)=>{i=clamp(0,i,1);let s;if(isAchromatic(t))s=e.h;else if(isAchromatic(e))s=t.h;else{const a=t.h;let l=e.h;const c=e.h-t.h;c>180?l-=360:c<-180&&(l+=360),s=a*(1-i)+l*i}const n=t.c*(1-i)+e.c*i,r=t.l*(1-i)+e.l*i,o=t.a*(1-i)+e.a*i;return Color.fromOKLCH(r,n,s,o)},ColorScale=class extends AbstractScale{constructor(){super(...arguments),this.type="color",this.invalid=!0,this.domain=[0,1],this.range=["red","blue"],this.parsedRange=this.range.map(convertColorStringToOklcha)}update(){const{domain:t,range:e}=this;t.length<2&&(logger_exports.warnOnce("`colorDomain` should have at least 2 values."),t.length===0?t.push(0,1):t.length===1&&t.push(t[0]+1));for(let i=1;i=n){logger_exports.warnOnce("`colorDomain` values should be supplied in ascending order."),t.sort((r,o)=>r-o);break}}if(e.length0?e[0]:"black");this.parsedRange=this.range.map(convertColorStringToOklcha)}normalizeDomains(...t){return{domain:t.flat(),animatable:!0}}toDomain(){}convert(t){this.refresh();const{domain:e,range:i,parsedRange:s}=this,n=e[0],r=e.at(-1),o=i[0],a=i[i.length-1];if(t<=n)return o;if(t>=r)return a;let l,c;if(e.length===2){const d=(t-n)/(r-n),p=1/(i.length-1);l=i.length<=2?0:Math.min(Math.floor(d*(i.length-1)),i.length-2),c=(d-l*p)/p}else{for(l=0;l=Math.PI&&(t-=twoPi),t}function isBetweenAngles(t,e,i){const s=normalizeAngle360(t),n=normalizeAngle360(e),r=normalizeAngle360(i);return nr?n<=s||s<=r:!0}function toRadians(t){return t/180*Math.PI}function toDegrees(t){return t/Math.PI*180}function angleBetween(t,e){return t=normalizeAngle360(t),e=normalizeAngle360(e),e-t+(t>e?twoPi:0)}function getAngleRatioRadians(t){const e=normalizeAngle360(t);return e<=halfPi?e/halfPi:e<=Math.PI?(Math.PI-e)/halfPi:e<=1.5*Math.PI?(e-Math.PI)/halfPi:(twoPi-e)/halfPi}var LinearGradient=class extends Gradient{constructor(t,e,i=0,s){super(t,e,s),this.angle=i}createCanvasGradient(t,e){const{angle:s}=this,n=normalizeAngle360(toRadians(s+90)),r=Math.cos(n),o=Math.sin(n),a=e.width,l=e.height,c=e.x+a*.5,h=e.y+l*.5,u=Math.sqrt(l*l+a*a)/2,d=Math.atan2(l,a);let p;n{const{offset:s}=e,n=t.at(i+1)?.color;return n!=null?[e,{offset:s,color:n}]:[e]})}function getDefaultColorStops(t,e){const i=e==="discrete"?1:0,s=t.map((n,r,{length:o})=>({offset:(r+i)/(o-1+i),color:n}));return e==="discrete"?discreteColorStops(s):s}function getColorStops(t,e,i,s="continuous"){if(t.length===0)return getDefaultColorStops(e,s);if(!stopsAreAscending(t))return logger_exports.warnOnce("[fills] must have the stops defined in ascending order"),[];const n=Math.min(...i),r=Math.max(...i),o=s==="discrete",a=new Float64Array(t.length);let l=0,c=-1;for(let p=0;p=c){c=t.length-1;for(let y=p+1;yp.color!=null)?.color,u;const d=t.map(({color:p},g)=>{const m=a[g];return p!=null?h=p:h!=null?p=h:(u==null&&(u=new ColorScale,u.domain=[0,1],u.range=e),p=u.convert(m)),{offset:m,color:p}});return s==="discrete"?discreteColorStops(d):d}function isGradientFill(t){return t!==null&&isObject(t)&&t.type=="gradient"}function align(t,e,i){const s=Math.round(e*t)/t;return i==null?s:i===0?0:i<1?Math.ceil(i*t)/t:Math.round((i+e)*t)/t-s}function alignBefore(t,e){return Math.floor(e*t)/t}var LINEAR_GRADIENT_REGEXP=/^linear-gradient\((-?[\d.]+)deg,(.*?)\)$/i,_Shape=class ht extends Node{constructor(){super(...arguments),this.fillOpacity=1,this.strokeOpacity=1,this.fill=ht.defaultStyles.fill,this.stroke=ht.defaultStyles.stroke,this.strokeWidth=ht.defaultStyles.strokeWidth,this.lineDash=ht.defaultStyles.lineDash,this.lineDashOffset=ht.defaultStyles.lineDashOffset,this.lineCap=ht.defaultStyles.lineCap,this.lineJoin=ht.defaultStyles.lineJoin,this.miterLimit=void 0,this.opacity=ht.defaultStyles.opacity,this.fillShadow=ht.defaultStyles.fillShadow,this.gradientFillOptions={domain:[0,1],defaultColorRange:ht.defaultStyles.defaultColorRange}}restoreOwnStyles(){const{defaultStyles:e}=this.constructor;Object.assign(this,e)}getGradient(e){let i;if(e instanceof Gradient)return e;if(typeof e=="string"&&e?.startsWith("linear-gradient")&&(i=LINEAR_GRADIENT_REGEXP.exec(e))){const s=parseFloat(i[1]),n=[],r=i[2],o=/(#[0-9a-f]+)|(rgba?\(.+?\))|([a-z]+)/gi;let a;for(;a=o.exec(r);)n.push(a[0]);return new LinearGradient("rgb",n.map((l,c)=>({color:l,offset:c/(n.length-1)})),s)}else if(isGradientFill(e))return this.createLinearGradient(e)}createLinearGradient(e){const{colorStops:i=[],direction:s}=e,n=s==="horizontal",{domain:r,defaultColorRange:o=[]}=this.gradientFillOptions,a=getColorStops(i,o,r);return new LinearGradient("oklch",a,n?0:90)}onFillChange(){this.fillGradient=this.getGradient(this.fill)}onStrokeChange(){this.strokeGradient=this.getGradient(this.stroke)}align(e,i){return align(this.layerManager?.canvas?.pixelRatio??1,e,i)}fillStroke(e,i){this.renderFill(e,i),this.renderStroke(e,i)}renderFill(e,i){if(this.fill){const{globalAlpha:s}=e;this.applyFill(e),this.applyFillAlpha(e),this.applyShadow(e),this.executeFill(e,i),e.globalAlpha=s}e.shadowColor="rgba(0, 0, 0, 0)"}executeFill(e,i){i?e.fill(i):e.fill()}applyFill(e){const i=this.gradientFillOptions.bbox??this.getBBox();e.fillStyle=this.fillGradient?.createGradient(e,i)??(typeof this.fill=="string"?this.fill:void 0)??"black"}applyStroke(e){e.strokeStyle=this.strokeGradient?.createGradient(e,this.getBBox())??(typeof this.stroke=="string"?this.stroke:void 0)??"black"}applyFillAlpha(e){e.globalAlpha*=this.opacity*this.fillOpacity}applyShadow(e){const i=this.layerManager?.canvas.pixelRatio??1,s=this.fillShadow;s?.enabled&&(e.shadowColor=s.color,e.shadowOffsetX=s.xOffset*i,e.shadowOffsetY=s.yOffset*i,e.shadowBlur=s.blur*i)}renderStroke(e,i){if(this.stroke&&this.strokeWidth){const{globalAlpha:s}=e;this.applyStroke(e),e.globalAlpha*=this.opacity*this.strokeOpacity,e.lineWidth=this.strokeWidth,this.lineDash&&e.setLineDash(this.lineDash),this.lineDashOffset&&(e.lineDashOffset=this.lineDashOffset),this.lineCap&&(e.lineCap=this.lineCap),this.lineJoin&&(e.lineJoin=this.lineJoin),this.miterLimit!=null&&(e.miterLimit=this.miterLimit),this.executeStroke(e,i),e.globalAlpha=s}}executeStroke(e,i){i?e.stroke(i):e.stroke()}containsPoint(e,i){return this.isPointInPath(e,i)}applySvgFillAttributes(e){const{fill:i,fillOpacity:s}=this;e.setAttribute("fill",typeof i=="string"?i:"none"),e.setAttribute("fill-opacity",String(s))}applySvgStrokeAttributes(e){const{stroke:i,strokeOpacity:s,strokeWidth:n,lineDash:r,lineDashOffset:o}=this;if(i!=null&&(e.setAttribute("stroke",typeof i=="string"?i:"none"),e.setAttribute("stroke-opacity",String(s)),e.setAttribute("stroke-width",String(n))),r?.some(a=>a!==0)===!0){const a=r.length%2===1?[...r,...r]:r;e.setAttribute("stroke-dasharray",a.join(" ")),e.setAttribute("stroke-dashoffset",String(o))}}};_Shape.defaultStyles={fill:"black",stroke:void 0,strokeWidth:0,lineDash:void 0,lineDashOffset:0,lineCap:void 0,lineJoin:void 0,opacity:1,fillShadow:void 0,defaultColorRange:["#5090dc","#ef5452"]},__decorateClass([SceneChangeDetection()],_Shape.prototype,"fillOpacity",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"strokeOpacity",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onFillChange()})],_Shape.prototype,"fill",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onStrokeChange()})],_Shape.prototype,"stroke",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"strokeWidth",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineDash",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineDashOffset",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineCap",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"lineJoin",2),__decorateClass([SceneChangeDetection()],_Shape.prototype,"miterLimit",2),__decorateClass([SceneChangeDetection({convertor:t=>clamp(0,t,1)})],_Shape.prototype,"opacity",2),__decorateClass([SceneChangeDetection({checkDirtyOnAssignment:!0})],_Shape.prototype,"fillShadow",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onFillChange()})],_Shape.prototype,"gradientFillOptions",2);var Shape=_Shape,IDENTITY_MATRIX_ELEMENTS=[1,0,0,1,0,0],Matrix=class vt{get e(){return[...this.elements]}constructor(e=IDENTITY_MATRIX_ELEMENTS){this.elements=[...e]}setElements(e){const i=this.elements;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],this}get identity(){const e=this.elements;return isNumberEqual(e[0],1)&&isNumberEqual(e[1],0)&&isNumberEqual(e[2],0)&&isNumberEqual(e[3],1)&&isNumberEqual(e[4],0)&&isNumberEqual(e[5],0)}AxB(e,i,s){const n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],l=e[0]*i[4]+e[2]*i[5]+e[4],c=e[1]*i[4]+e[3]*i[5]+e[5];s=s??e,s[0]=n,s[1]=r,s[2]=o,s[3]=a,s[4]=l,s[5]=c}multiplySelf(e){return this.AxB(this.elements,e.elements),this}multiply(e){const i=new Array(6);return e instanceof vt?this.AxB(this.elements,e.elements,i):this.AxB(this.elements,[e.a,e.b,e.c,e.d,e.e,e.f],i),new vt(i)}preMultiplySelf(e){return this.AxB(e.elements,this.elements,this.elements),this}inverse(){const e=this.elements;let i=e[0],s=e[1],n=e[2],r=e[3];const o=e[4],a=e[5],l=1/(i*r-s*n);return i*=l,s*=l,n*=l,r*=l,new vt([r,-s,-n,i,n*a-r*o,s*o-i*a])}invertSelf(){const e=this.elements;let i=e[0],s=e[1],n=e[2],r=e[3];const o=e[4],a=e[5],l=1/(i*r-s*n);return i*=l,s*=l,n*=l,r*=l,e[0]=r,e[1]=-s,e[2]=-n,e[3]=i,e[4]=n*a-r*o,e[5]=s*o-i*a,this}transformPoint(e,i){const s=this.elements;return{x:e*s[0]+i*s[2]+s[4],y:e*s[1]+i*s[3]+s[5]}}transformBBox(e,i){const s=this.elements,n=s[0],r=s[1],o=s[2],a=s[3],l=e.width*.5,c=e.height*.5,h=e.x+l,u=e.y+c,d=Math.abs(l*n)+Math.abs(c*o),p=Math.abs(l*r)+Math.abs(c*a);return i??(i=new BBox(0,0,0,0)),i.x=h*n+u*o+s[4]-d,i.y=h*r+u*a+s[5]-p,i.width=d+d,i.height=p+p,i}toContext(e){if(this.identity)return;const i=this.elements;e.transform(i[0],i[1],i[2],i[3],i[4],i[5])}static updateTransformMatrix(e,i,s,n,r,o,a){const l=i,c=s;let h,u;l===1&&c===1?(h=0,u=0):(h=a?.scalingCenterX??0,u=a?.scalingCenterY??0);const d=n,p=Math.cos(d),g=Math.sin(d);let m,y;d===0?(m=0,y=0):(m=a?.rotationCenterX??0,y=a?.rotationCenterY??0);const f=r,x=o,v=h*(1-l)-m,b=u*(1-c)-y;return e.setElements([p*l,g*l,-g*c,p*c,p*v-g*b+m+f,g*v+p*b+y+x]),e}};function isMatrixTransform(t){return isMatrixTransformType(t.constructor)}var MATRIX_TRANSFORM_TYPE=Symbol("isMatrixTransform");function isMatrixTransformType(t){return t[MATRIX_TRANSFORM_TYPE]===!0}function MatrixTransform(t){var e,i;const s=t;if(isMatrixTransformType(t))return t;const n=Symbol("matrix_combined_transform");class r extends s{constructor(){super(...arguments),this[i]=new Matrix,this._dirtyTransform=!0}markDirtyTransform(){this._dirtyTransform=!0,super.markDirty()}updateMatrix(a){}computeTransformMatrix(){this._dirtyTransform&&(this[n].setElements(IDENTITY_MATRIX_ELEMENTS),this.updateMatrix(this[n]),this._dirtyTransform=!1)}toParent(a){return this.computeTransformMatrix(),this[n].identity?a.clone():this[n].transformBBox(a)}toParentPoint(a,l){return this.computeTransformMatrix(),this[n].identity?{x:a,y:l}:this[n].transformPoint(a,l)}fromParent(a){return this.computeTransformMatrix(),this[n].identity?a.clone():this[n].inverse().transformBBox(a)}fromParentPoint(a,l){return this.computeTransformMatrix(),this[n].identity?{x:a,y:l}:this[n].inverse().transformPoint(a,l)}computeBBox(){const a=super.computeBBox();return a&&this.toParent(a)}computeBBoxWithoutTransforms(){return super.computeBBox()}pickNode(a,l,c=!1){return c||({x:a,y:l}=this.fromParentPoint(a,l)),super.pickNode(a,l)}render(a){this.computeTransformMatrix();const{ctx:l}=a,c=this[n];let h=!1;c.identity||(l.save(),h=!0,c.toContext(l)),super.render(a),h&&l.restore()}toSVG(){this.computeTransformMatrix();const a=super.toSVG(),l=this[n];if(l.identity||a==null)return a;const c=createSvgElement("g");c.append(...a.elements);const[h,u,d,p,g,m]=l.e;return c.setAttribute("transform",`matrix(${h} ${u} ${d} ${p} ${g} ${m})`),{elements:[c],defs:a.defs}}}return e=MATRIX_TRANSFORM_TYPE,i=n,r[e]=!0,r}function Rotatable(t){var e;const i=t,s=Symbol("matrix_rotation");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.rotationCenterX=null,this.rotationCenterY=null,this.rotation=0}updateMatrix(o){super.updateMatrix(o);const{rotation:a,rotationCenterX:l,rotationCenterY:c}=this;a!==0&&(Matrix.updateTransformMatrix(this[s],1,1,a,0,0,{rotationCenterX:l,rotationCenterY:c}),o.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotationCenterX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotationCenterY",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"rotation",2),n}function Scalable(t){var e;const i=t,s=Symbol("matrix_scale");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.scalingX=1,this.scalingY=1,this.scalingCenterX=null,this.scalingCenterY=null}updateMatrix(o){super.updateMatrix(o);const{scalingX:a,scalingY:l,scalingCenterX:c,scalingCenterY:h}=this;a===1&&l===1||(Matrix.updateTransformMatrix(this[s],a,l,0,0,0,{scalingCenterX:c,scalingCenterY:h}),o.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingY",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingCenterX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"scalingCenterY",2),n}function Translatable(t){var e;const i=t,s=Symbol("matrix_translation");class n extends MatrixTransform(i){constructor(){super(...arguments),this[e]=new Matrix,this.translationX=0,this.translationY=0}updateMatrix(o){super.updateMatrix(o);const{translationX:a,translationY:l}=this;a===0&&l===0||(Matrix.updateTransformMatrix(this[s],1,1,0,a,l),o.multiplySelf(this[s]))}}return e=s,__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"translationX",2),__decorateClass([SceneChangeDetection({type:"transform"})],n.prototype,"translationY",2),n}var Transformable=class{static fromCanvas(t,e){const i=[];for(const s of t.traverseUp())isMatrixTransform(s)&&i.unshift(s);for(const s of i)e=s.fromParent(e);return isMatrixTransform(t)&&(e=t.fromParent(e)),e}static toCanvas(t,e){e==null?e=t.getBBox():isMatrixTransform(t)&&(e=t.toParent(e));for(const i of t.traverseUp())isMatrixTransform(i)&&(e=i.toParent(e));return e}static fromCanvasPoint(t,e,i){const s=[];for(const n of t.traverseUp())isMatrixTransform(n)&&s.unshift(n);for(const n of s)({x:e,y:i}=n.fromParentPoint(e,i));return isMatrixTransform(t)&&({x:e,y:i}=t.fromParentPoint(e,i)),{x:e,y:i}}static toCanvasPoint(t,e,i){isMatrixTransform(t)&&({x:e,y:i}=t.toParentPoint(e,i));for(const s of t.traverseUp())isMatrixTransform(s)&&({x:e,y:i}=s.toParentPoint(e,i));return{x:e,y:i}}},cmp=(t,e)=>Math.sign(t-e);function compareZIndex(t,e){if(typeof t=="number"&&typeof e=="number")return cmp(t,e);const i=typeof t=="number"?[t]:t,s=typeof e=="number"?[e]:e,n=Math.min(i.length,s.length);for(let r=0;r0&&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(e){const{layer:i,renderToOffscreenCanvas:s}=this,n={...e};if(!s){this.renderInContext(n),super.render(n);return}const{ctx:r,stats:o,devicePixelRatio:a}=e;let{image:l}=this;if(this.isDirty(e)){l?.bitmap.close(),l=void 0;const h=i?void 0:this.computeSafeClippingBBox(a),u=(d,...p)=>{const g=d.context;n.ctx=g,d.clear(),g.save(),g.setTransform(...p),g.globalAlpha=1,this.renderInContext(n),g.restore(),g.verifyDepthZero?.()};if(i)u(i,r.getTransform());else if(h){const{x:d,y:p,width:g,height:m}=h,y=this.prepareSharedCanvas(g,m,a);u(y,a,0,0,a,-d*a,-p*a),l={bitmap:y.transferToImageBitmap(),x:d,y:p,width:g,height:m}}else this.dirtyZIndex&&this.sortChildren(xt.compareChildren);this.image=l,o&&o.layersRendered++}else this.skipRender(n),o&&o.layersSkipped++;const{globalAlpha:c}=r;if(r.globalAlpha=c*this.opacity,i)r.save(),r.resetTransform(),i.drawImage(r),r.restore();else if(l){const{bitmap:h,x:u,y:d,width:p,height:g}=l;r.drawImage(h,0,0,p*a,g*a,u,d,p,g)}r.globalAlpha=c,super.render(n)}skipRender(e){const{stats:i}=e;for(const s of this.children())s.markClean(),i&&(i.nodesSkipped+=this.childNodeCounts.groups+this.childNodeCounts.nonGroups,i.opsSkipped+=this.childNodeCounts.complexity)}applyClip(e,i){const{x:s,y:n,width:r,height:o}=i;e.beginPath(),e.rect(s,n,r,o),e.clip()}renderInContext(e){const{ctx:i,stats:s}=e;this.dirtyZIndex&&this.sortChildren(xt.compareChildren),i.save(),i.globalAlpha*=this.opacity,this.clipRect!=null&&(this.applyClip(i,this.clipRect),e.clipBBox=Transformable.toCanvas(this,this.clipRect));for(const n of this.children()){if(!n.visible){n.markClean(),s&&(s.nodesSkipped+=n.childNodeCounts.nonGroups+n.childNodeCounts.groups,s.opsSkipped+=n.childNodeCounts.complexity);continue}i.save(),n.render(e),i.restore()}i.restore()}setClipRect(e){this.clipRect=e?Transformable.fromCanvas(this,e):void 0}setClipRectCanvasSpace(e){this.clipRect=e}_setLayerManager(e){this.layer&&(this._layerManager?.removeLayer(this.layer),this.layer=void 0),super._setLayerManager(e)}getVisibility(){for(const e of this.traverseUp(!0))if(!e.visible)return!1;return!0}toSVG(){if(!this.visible)return;const e=[],i=[];for(const s of this.children()){const n=s.toSVG();n!=null&&(i.push(...n.elements),n.defs!=null&&e.push(...n.defs))}return{elements:i,defs:e}}};_Group.className="Group",__decorateClass([SceneChangeDetection({convertor:t=>clamp(0,t,1)})],_Group.prototype,"opacity",2);var Group=_Group,ScalableGroup=class extends Scalable(Group){},RotatableGroup=class extends Rotatable(Group){},TranslatableGroup=class extends Translatable(Group){},TransformableGroup=class extends Rotatable(Translatable(Group)){};function createCanvasContext(t=0,e=0){return new OffscreenCanvas(t,e).getContext("2d")}var LRUCache=class{constructor(t=5){this.maxCacheSize=t,this.store=new Map}get(t){if(!this.store.has(t))return;const e=this.store.get(t);return this.store.delete(t),this.store.set(t,e),e}has(t){return this.store.has(t)}set(t,e){if(this.store.set(t,e),this.store.size>this.maxCacheSize){const i=this.store.keys();let s=this.store.size-this.maxCacheSize;for(;s>0;){const n=i.next();n.done||this.store.delete(n.value),s--}}return e}clear(){this.store.clear()}},CachedTextMeasurerPool=class{static measureText(t,e){return this.getMeasurer(e).measureText(t)}static measureLines(t,e){return this.getMeasurer(e).measureLines(t)}static getMeasurer(t){const e=typeof t.font=="string"?t.font:TextUtils.toFontString(t.font),i=`${e}-${t.textAlign??"start"}-${t.textBaseline??"alphabetic"}`;return this.instanceMap.get(i)??this.createFontMeasurer(e,t,i)}static createFontMeasurer(t,e,i){const s=createCanvasContext();s.font=t,s.textAlign=e.textAlign??"start",s.textBaseline=e.textBaseline??"alphabetic";const n=new CachedTextMeasurer(s,e);return this.instanceMap.set(i,n),n}};CachedTextMeasurerPool.instanceMap=new LRUCache(10);var CachedTextMeasurer=class{constructor(t,e){this.ctx=t,this.measureMap=new LRUCache(100),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline),t.font=typeof e.font=="string"?e.font:TextUtils.toFontString(e.font),this.textMeasurer=new SimpleTextMeasurer(i=>this.cachedCtxMeasureText(i),e.textBaseline??"alphabetic")}textWidth(t,e){return this.textMeasurer.textWidth(t,e)}measureText(t){return this.textMeasurer.measureText(t)}measureLines(t){return this.textMeasurer.measureLines(t)}cachedCtxMeasureText(t){if(!this.measureMap.has(t)){const e=this.ctx.measureText(t);this.measureMap.set(t,{actualBoundingBoxAscent:e.actualBoundingBoxAscent,emHeightAscent:e.emHeightAscent,emHeightDescent:e.emHeightDescent,actualBoundingBoxDescent:e.actualBoundingBoxDescent,actualBoundingBoxLeft:e.actualBoundingBoxLeft,actualBoundingBoxRight:e.actualBoundingBoxRight,alphabeticBaseline:e.alphabeticBaseline,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent,hangingBaseline:e.hangingBaseline,ideographicBaseline:e.ideographicBaseline,width:e.width})}return this.measureMap.get(t)}},TextUtils=class{static toFontString({fontSize:t=10,fontStyle:e,fontWeight:i,fontFamily:s,lineHeight:n}){let r="";return e&&(r+=`${e} `),i&&(r+=`${i} `),r+=`${t}px`,n&&(r+=`/${n}px`),r+=` ${s}`,r.trim()}static getLineHeight(t){return Math.ceil(t*this.defaultLineHeight)}static getVerticalModifier(t){switch(t){case"hanging":case"top":return 0;case"middle":return .5;case"alphabetic":case"bottom":case"ideographic":default:return 1}}};TextUtils.EllipsisChar="\u2026",TextUtils.defaultLineHeight=1.15,TextUtils.lineSplitter=/\r?\n/g;var SimpleTextMeasurer=class{constructor(t,e="alphabetic"){this.measureTextFn=t,this.textBaseline=e,this.charMap=new Map}getMetrics(t){const e=this.measureTextFn(t);return e.fontBoundingBoxAscent??(e.fontBoundingBoxAscent=e.emHeightAscent),e.fontBoundingBoxDescent??(e.fontBoundingBoxDescent=e.emHeightDescent),{width:e.width,height:e.actualBoundingBoxAscent+e.actualBoundingBoxDescent,lineHeight:e.fontBoundingBoxAscent+e.fontBoundingBoxDescent,offsetTop:e.actualBoundingBoxAscent,offsetLeft:e.actualBoundingBoxLeft}}getMultilineMetrics(t){let e=0,i=0,s=0,n=0,r=0;const o=TextUtils.getVerticalModifier(this.textBaseline),a=[];let l=0;const c=t.length;for(const h of t){const u=this.measureTextFn(h);u.fontBoundingBoxAscent??(u.fontBoundingBoxAscent=u.emHeightAscent),u.fontBoundingBoxDescent??(u.fontBoundingBoxDescent=u.emHeightDescent),e1?this.measureTextFn(t).width:this.charMap.get(t)??this.charWidth(t)}measureText(t){return this.getMetrics(t)}measureLines(t){const e=typeof t=="string"?t.split(TextUtils.lineSplitter):t;return this.getMultilineMetrics(e)}charWidth(t){const{width:e}=this.measureTextFn(t);return this.charMap.set(t,e),e}},_Text=class St extends Shape{constructor(){super(...arguments),this.x=0,this.y=0,this.lines=[],this.text=void 0,this.fontSize=10,this.fontFamily="sans-serif",this.textAlign=St.defaultStyles.textAlign,this.textBaseline=St.defaultStyles.textBaseline}onTextChange(){this.lines=this.text?.split(` `).map(e=>e.trim())??[]}static computeBBox(e,i,s,n){const{offsetTop:r,offsetLeft:o,width:a,height:l}=CachedTextMeasurerPool.measureLines(e,n);return new BBox(i-o,s-r,a,l)}computeBBox(){const{x:e,y:i,lines:s,textBaseline:n,textAlign:r}=this;return St.computeBBox(s,e,i,{font:this,textBaseline:n,textAlign:r})}isPointInPath(e,i){const s=this.getBBox();return s?s.containsPoint(e,i):!1}render(e){const{ctx:i,stats:s}=e;if(!this.lines.length||!this.layerManager)return s&&(s.nodesSkipped+=1),super.render(e);const{fill:n,stroke:r,strokeWidth:o}=this,{pixelRatio:a}=this.layerManager.canvas;if(i.font=TextUtils.toFontString(this),i.textAlign=this.textAlign,i.textBaseline=this.textBaseline,n){this.applyFill(i),i.globalAlpha*=this.opacity*this.fillOpacity;const{fillShadow:l}=this;l?.enabled&&(i.shadowColor=l.color,i.shadowOffsetX=l.xOffset*a,i.shadowOffsetY=l.yOffset*a,i.shadowBlur=l.blur*a),this.renderLines((c,h,u)=>i.fillText(c,h,u))}if(r&&o){this.applyStroke(i),i.lineWidth=o,i.globalAlpha*=this.opacity*this.strokeOpacity;const{lineDash:l,lineDashOffset:c,lineCap:h,lineJoin:u}=this;l&&i.setLineDash(l),c&&(i.lineDashOffset=c),h&&(i.lineCap=h),u&&(i.lineJoin=u),this.renderLines((d,p,g)=>i.strokeText(d,p,g))}super.render(e)}renderLines(e){const{lines:i,x:s,y:n}=this,r=this.lineHeight??TextUtils.getLineHeight(this.fontSize);let o=(r-r*i.length)*TextUtils.getVerticalModifier(this.textBaseline);for(const a of i)e(a,s,n+o),o+=r}setFont(e){this.fontFamily=e.fontFamily,this.fontSize=e.fontSize,this.fontStyle=e.fontStyle,this.fontWeight=e.fontWeight}setAlign(e){this.textAlign=e.textAlign,this.textBaseline=e.textBaseline}toSVG(){if(!this.visible||!this.text)return;const e=createSvgElement("text");return this.applySvgFillAttributes(e),e.setAttribute("font-family",this.fontFamily?.split(",")[0]??""),e.setAttribute("font-size",String(this.fontSize)),e.setAttribute("font-style",this.fontStyle??""),e.setAttribute("font-weight",String(this.fontWeight??"")),e.setAttribute("text-anchor",{center:"middle",left:"start",right:"end",start:"start",end:"end"}[this.textAlign??"start"]),e.setAttribute("alignment-baseline",{alphabetic:"alphabetic",top:"top",bottom:"bottom",hanging:"hanging",middle:"middle",ideographic:"ideographic"}[this.textBaseline??"alphabetic"]),e.setAttribute("x",String(this.x)),e.setAttribute("y",String(this.y)),e.textContent=this.text??"",{elements:[e]}}};_Text.className="Text",_Text.defaultStyles={...Shape.defaultStyles,textAlign:"start",fontStyle:void 0,fontWeight:void 0,fontSize:10,fontFamily:"sans-serif",textBaseline:"alphabetic"},__decorateClass([SceneChangeDetection()],_Text.prototype,"x",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"y",2),__decorateClass([SceneChangeDetection({changeCb:t=>t.onTextChange()})],_Text.prototype,"text",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontStyle",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontWeight",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontSize",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"fontFamily",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"textAlign",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"textBaseline",2),__decorateClass([SceneChangeDetection()],_Text.prototype,"lineHeight",2);var Text=_Text,RotatableText=class extends Rotatable(Text){},TransformableText=class extends Rotatable(Translatable(Text)){},debugColor="color: green",debugQuietColor="color: grey";function StateMachineProperty(){return addObserverToInstanceProperty(()=>{})}function applyProperties(t,e){const i=listDecoratedProperties(e);if(i.length===0)return;const s=extractDecoratedProperties(t);for(const n of i)n in s&&(e[n]=s[n])}var AbstractStateMachine=class{transitionRoot(t,e){this.parent?this.parent.transitionRoot(t,e):this.transition(t,e)}},_StateMachine=class lt extends AbstractStateMachine{constructor(e,i,s){super(),this.defaultState=e,this.states=i,this.enterEach=s,this.debug=Debug.create(!0,"animation"),this.state=e,this.debug(`%c${this.constructor.name} | init -> ${e}`,debugColor)}transition(e,i){if(!this.transitionChild(e,i)||this.state===lt.child||this.state===lt.parent)return;const n=this.state,r=this.states[this.state];let o=r[e];const a=`%c${this.constructor.name} | ${this.state} -> ${e} ->`;if(Array.isArray(o))o=o.find(h=>{if(!h.guard)return!0;const u=h.guard(i);return u||this.debug(`${a} (guarded)`,h.target,debugQuietColor),u});else if(typeof o=="object"&&!(o instanceof lt)&&o.guard&&!o.guard(i)){this.debug(`${a} (guarded)`,o.target,debugQuietColor);return}if(!o){this.debug(`${a} ${this.state}`,debugQuietColor);return}const l=this.getDestinationState(o),c=l===this.state?void 0:r.onExit;this.debug(`${a} ${l}`,debugColor),this.state=l,typeof o=="function"?o(i):typeof o=="object"&&!(o instanceof lt)&&o.action?.(i),c?.(),this.enterEach?.(n,l),l!==n&&l!==lt.child&&l!==lt.parent&&this.states[l].onEnter?.(n,i)}transitionAsync(e,i){setTimeout(()=>{this.transition(e,i)},0)}is(e){return this.state===lt.child&&this.childState?this.childState.is(e):this.state===e}resetHierarchy(){this.debug(`%c${this.constructor.name} | ${this.state} -> [resetHierarchy] -> ${this.defaultState}`,"color: green"),this.state=this.defaultState}transitionChild(e,i){return this.state!==lt.child||!this.childState||(applyProperties(this,this.childState),this.childState.transition(e,i),!this.childState.is(lt.parent))?!0:(this.debug(`%c${this.constructor.name} | ${this.state} -> ${e} -> ${this.defaultState}`,debugColor),this.state=this.defaultState,this.states[this.state].onEnter?.(),this.childState.resetHierarchy(),!1)}getDestinationState(e){let i=this.state;return typeof e=="string"?i=e:e instanceof lt?(this.childState=e,this.childState.parent=this,i=lt.child):typeof e=="object"&&(e.target instanceof lt?(this.childState=e.target,this.childState.parent=this,i=lt.child):e.target!=null&&(i=e.target)),i}};_StateMachine.child="__child",_StateMachine.parent="__parent";var StateMachine=_StateMachine,ParallelStateMachine=class extends AbstractStateMachine{constructor(...t){super(),this.stateMachines=t;for(const e of t)e.parent=this}transition(t,e){for(const i of this.stateMachines)applyProperties(this,i),i.transition(t,e)}transitionAsync(t,e){for(const i of this.stateMachines)applyProperties(this,i),i.transitionAsync(t,e)}};function ProxyProperty(t,e){const i=isArray(t)?t:t.split(".");if(i.length===1){const[s]=i;return addTransformToInstanceProperty((n,r,o)=>n[s]=o,n=>n[s],e)}return addTransformToInstanceProperty((s,n,r)=>setPath(s,i,r),s=>getPath(s,i),e)}function ProxyOnWrite(t){return addTransformToInstanceProperty((e,i,s)=>e[t]=s)}function ProxyPropertyOnWrite(t,e){return addTransformToInstanceProperty((i,s,n)=>i[t][e??s]=n)}function ActionOnSet(t){const{newValue:e,oldValue:i,changeValue:s}=t;return addTransformToInstanceProperty((n,r,o,a)=>(o!==a&&(a!==void 0&&i?.call(n,a),o!==void 0&&e?.call(n,o),s?.call(n,o,a)),o))}function ObserveChanges(t){return addObserverToInstanceProperty(t)}var TextWrapper=class{static wrapText(t,e){return this.wrapLines(t,e).join(` `)}static wrapLines(t,e){const i=this.textWrap(t,e);return e.overflow==="hide"&&i.some(s=>s.endsWith(TextUtils.EllipsisChar))?[]:i}static appendEllipsis(t){return t.replace(/[.,]{1,5}$/,"")+TextUtils.EllipsisChar}static truncateLine(t,e,i,s){const n=e.textWidth(TextUtils.EllipsisChar);let r=0,o=0;for(;oi)break;r+=a}if(t.length===o&&(!s||r+n<=i))return s?t+TextUtils.EllipsisChar:t;for(t=t.slice(0,o).trimEnd();t.length&&e.textWidth(t)+n>i;)t=t.slice(0,-1).trimEnd();return t+TextUtils.EllipsisChar}static textWrap(t,e){const i=t.split(TextUtils.lineSplitter),s=CachedTextMeasurerPool.getMeasurer(e);if(e.textWrap==="never")return i.map(a=>this.truncateLine(a.trimEnd(),s,e.maxWidth));const n=[],r=e.textWrap==="hyphenate",o=e.textWrap==null||e.textWrap==="on-space";for(const a of i){let l=a.trimEnd();if(l===""){n.push(l);continue}let c=0,h=0,u=0;for(;ce.maxWidth){if(c===0)break;const p=s.textWidth(l.slice(0,c+1));if(p<=e.maxWidth){h=p,c++;continue}if(u){const y=this.getWordAt(l,u+1),f=s.textWidth(y);if(f<=e.maxWidth){n.push(l.slice(0,u).trimEnd()),l=l.slice(u).trimStart(),c=0,h=0,u=0;continue}else o&&f>e.maxWidth&&n.push(l.slice(0,u).trimEnd(),this.truncateLine(l.slice(u).trimStart(),s,e.maxWidth,!0))}else o&&n.push(this.truncateLine(l,s,e.maxWidth,!0));if(o){l="";break}const g=r?"-":"";let m=l.slice(0,c).trim();for(;m.length&&s.textWidth(m+g)>e.maxWidth;)m=m.slice(0,-1).trimEnd();if(n.push(m+g),!m.length){l="";break}l=l.slice(m.length).trimStart(),c=-1,h=0,u=0}c++}l&&n.push(l)}return this.avoidOrphans(n,s,e),this.clipLines(n,s,e)}static getWordAt(t,e){const i=t.indexOf(" ",e);return i===-1?t.slice(e):t.slice(e,i)}static clipLines(t,e,i){if(!i.maxHeight)return t;const{height:s,lineMetrics:n}=e.measureLines(t);if(s<=i.maxHeight)return t;for(let r=0,o=0;ri.maxHeight){if(i.overflow==="hide")return[];const l=t.slice(0,r||1),c=l.pop();return l.concat(this.truncateLine(c,e,i.maxWidth,!0))}}return t}static avoidOrphans(t,e,i){if(i.avoidOrphans===!1||t.length<2)return;const{length:s}=t,n=t[s-1],r=t[s-2];if(r.lengththis.updateA11yText(t,e))}computeTextWrap(t,e){const{text:i,padding:s,wrapping:n}=this,r=Math.min(this.maxWidth??1/0,t)-s*2,o=this.maxHeight??e-s*2;if(!isFinite(r)&&!isFinite(o)){this.node.text=i;return}const a=TextWrapper.wrapText(i??"",{maxWidth:r,maxHeight:o,font:this,textWrap:n});this.node.text=a,this.truncated=a.includes(TextUtils.EllipsisChar)}updateA11yText(t,e){const{proxyInteractionService:i}=t;if(this.enabled&&this.text){const s=Transformable.toCanvas(this.node);if(s){const{id:n}=this;this.proxyText??(this.proxyText=i.createProxyElement({type:"text",domManagerId:n,where:e})),this.proxyText.textContent=this.text,this.proxyText.setBounds(s),this.proxyText.addListener("mousemove",r=>this.handleMouseMove(t,r)),this.proxyText.addListener("mouseleave",r=>this.handleMouseLeave(t,r))}}else this.proxyText?.destroy(),this.proxyText=void 0}handleMouseMove(t,e){if(e!=null&&this.enabled&&this.node.visible&&this.truncated){const{x:i,y:s}=Transformable.toCanvas(this.node),n=e.sourceEvent.offsetX+i,r=e.sourceEvent.offsetY+s,o={type:"pointermove",canvasX:n,canvasY:r};t.tooltipManager.updateTooltip(this.id,{canvasX:n,canvasY:r,lastPointerEvent:o,showArrow:!1},{type:"structured",title:this.text})}}handleMouseLeave(t,e){t.tooltipManager.removeTooltip(this.id)}};Caption.SMALL_PADDING=10,Caption.LARGE_PADDING=20,__decorateClass([Validate(BOOLEAN),ProxyPropertyOnWrite("node","visible")],Caption.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"text",2),__decorateClass([Validate(TEXT_ALIGN,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"textAlign",2),__decorateClass([Validate(FONT_STYLE,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0}),ProxyPropertyOnWrite("node")],Caption.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER),ProxyPropertyOnWrite("node")],Caption.prototype,"fontSize",2),__decorateClass([Validate(STRING),ProxyPropertyOnWrite("node")],Caption.prototype,"fontFamily",2),__decorateClass([Validate(COLOR_STRING,{optional:!0}),ProxyPropertyOnWrite("node","fill")],Caption.prototype,"color",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"spacing",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"maxWidth",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Caption.prototype,"maxHeight",2),__decorateClass([Validate(TEXT_WRAP)],Caption.prototype,"wrapping",2),__decorateClass([Validate(POSITIVE_NUMBER)],Caption.prototype,"padding",2),__decorateClass([Validate(STRING)],Caption.prototype,"layoutStyle",2);var ChartAxisDirection=(t=>(t.X="x",t.Y="y",t))(ChartAxisDirection||{}),ModuleMap=class{constructor(){this.moduleMap=new Map}*modules(){for(const t of this.moduleMap.values())yield t.moduleInstance}addModule(t,e){if(this.moduleMap.has(t.optionsKey))throw new Error(`AG Charts - module already initialised: ${t.optionsKey}`);this.moduleMap.set(t.optionsKey,{module:t,moduleInstance:e(t)})}removeModule(t){const e=isString(t)?t:t.optionsKey;this.moduleMap.get(e)?.moduleInstance.destroy(),this.moduleMap.delete(e)}getModule(t){return this.moduleMap.get(isString(t)?t:t.optionsKey)?.moduleInstance}isEnabled(t){return this.moduleMap.has(isString(t)?t:t.optionsKey)}mapModules(t){return Array.from(this.moduleMap.values(),(e,i)=>t(e.moduleInstance,i))}destroy(){for(const t of this.moduleMap.keys())this.moduleMap.get(t)?.moduleInstance.destroy();this.moduleMap.clear()}};function compareDates(t,e){return t.valueOf()-e.valueOf()}function deduplicateSortedArray(t){let e=NaN;const i=[];for(const s of t){const n=s.valueOf();e!==n&&i.push(s),e=n}return i}function sortAndUniqueDates(t){const e=t.slice().sort(compareDates);return datesSortOrder(e)==null?deduplicateSortedArray(e):e}function datesSortOrder(t){if(t.length===0)return 1;const e=Number(t[t.length-1])>Number(t[0])?1:-1;let i=-1/0*e;for(const s of t){const n=s.valueOf();if(Math.sign(n-i)!==e)return;i=n}return e}function parseFormat(t){let e,i;const s=surroundedRegEx.exec(t);s&&([,e,t,i]=s);const n=formatRegEx.exec(t);if(!n)throw new Error(`The number formatter is invalid: ${t}`);const[,r,o,a,l,c,h,u,d,p,g]=n;return{fill:r,align:o,sign:a,symbol:l,zero:c,width:parseInt(h),comma:u,precision:parseInt(d),trim:!!p,type:g,prefix:e,suffix:i}}function numberFormat(t){const e=typeof t=="string"?parseFormat(t):t,{fill:i,align:s,sign:n="-",symbol:r,zero:o,width:a,comma:l,type:c,prefix:h="",suffix:u="",precision:d}=e;let{trim:p}=e;const g=d==null||isNaN(d);let m;if(!c)m=decimalTypes.g,p=!0;else if(c in decimalTypes&&c in integerTypes)m=g?integerTypes[c]:decimalTypes[c];else if(c in decimalTypes)m=decimalTypes[c];else if(c in integerTypes)m=integerTypes[c];else throw new Error(`The number formatter type is invalid: ${c}`);let y;return d==null||g?y=c?6:12:y=d,f=>{let x=m(f,y);return p&&(x=removeTrailingZeros(x)),l&&(x=insertSeparator(x,l)),x=addSign(f,x,n),r&&r!=="#"&&(x=`${r}${x}`),r==="#"&&c==="x"&&(x=`0x${x}`),c==="s"&&(x=`${x}${getSIPrefix(f)}`),(c==="%"||c==="p")&&(x=`${x}%`),a!=null&&!isNaN(a)&&(x=addPadding(x,a,i??o,s)),x=`${h}${x}${u}`,x}}var formatRegEx=/^(?:(.)?([<>=^]))?([+\-( ])?([$€£¥₣₹#])?(0)?(\d+)?(,)?(?:\.(\d+))?(~)?([%a-z])?$/i,surroundedRegEx=/^((?:[^#]|#[^{])*)#{([^}]+)}(.*)$/,integerTypes={b:t=>absFloor(t).toString(2),c:t=>String.fromCharCode(t),d:t=>Math.round(Math.abs(t)).toFixed(0),o:t=>absFloor(t).toString(8),x:t=>absFloor(t).toString(16),X:t=>integerTypes.x(t).toUpperCase(),n:t=>integerTypes.d(t),"%":t=>`${absFloor(t*100).toFixed(0)}`},decimalTypes={e:(t,e)=>Math.abs(t).toExponential(e),E:(t,e)=>decimalTypes.e(t,e).toUpperCase(),f:(t,e)=>Math.abs(t).toFixed(e),F:(t,e)=>decimalTypes.f(t,e).toUpperCase(),g:(t,e)=>{if(t===0)return"0";const i=Math.abs(t),s=Math.floor(Math.log10(i));return s>=-4&&sdecimalTypes.g(t,e).toUpperCase(),n:(t,e)=>decimalTypes.g(t,e),p:(t,e)=>decimalTypes.r(t*100,e),r:(t,e)=>{if(t===0)return"0";const i=Math.abs(t),n=Math.floor(Math.log10(i))-(e-1);if(n<=0)return i.toFixed(-n);const r=10**n;return(Math.round(i/r)*r).toFixed()},s:(t,e)=>{const i=getSIPrefixPower(t);return decimalTypes.r(t/10**i,e)},"%":(t,e)=>decimalTypes.f(t*100,e)},minSIPrefix=-24,maxSIPrefix=24,siPrefixes={[minSIPrefix]:"y",[-21]:"z",[-18]:"a",[-15]:"f",[-12]:"p",[-9]:"n",[-6]:"\xB5",[-3]:"m",0:"",3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",[maxSIPrefix]:"Y"},minusSign="\u2212";function absFloor(t){return Math.floor(Math.abs(t))}function removeTrailingZeros(t){return t.replace(/\.0+$/,"").replace(/(\.[1-9])0+$/,"$1")}function insertSeparator(t,e){let i=t.indexOf(".");i<0&&(i=t.length);const s=t.substring(0,i).split(""),n=t.substring(i);for(let r=s.length-3;r>0;r-=3)s.splice(r,0,e);return`${s.join("")}${n}`}function getSIPrefix(t){return siPrefixes[getSIPrefixPower(t)]}function getSIPrefixPower(t){return clamp(minSIPrefix,t?Math.floor(Math.log10(Math.abs(t))/3)*3:0,maxSIPrefix)}function addSign(t,e,i=""){if(i==="(")return t>=0?e:`(${e})`;const s=i==="+"?"+":"";return`${t>=0?s:minusSign}${e}`}function addPadding(t,e,i=" ",s=">"){let n=t;if(s===">"||!s)n=n.padStart(e,i);else if(s==="<")n=n.padEnd(e,i);else if(s==="^"){const r=Math.max(0,e-n.length),o=Math.ceil(r/2),a=Math.floor(r/2);n=n.padStart(o+n.length,i),n=n.padEnd(a+n.length,i)}return n}var tInterval=(t,e,i)=>({duration:e*i,timeInterval:t,step:i}),TickIntervals=[tInterval(second,durationSecond,1),tInterval(second,durationSecond,5),tInterval(second,durationSecond,15),tInterval(second,durationSecond,30),tInterval(minute,durationMinute,1),tInterval(minute,durationMinute,5),tInterval(minute,durationMinute,15),tInterval(minute,durationMinute,30),tInterval(hour,durationHour,1),tInterval(hour,durationHour,3),tInterval(hour,durationHour,6),tInterval(hour,durationHour,12),tInterval(day,durationDay,1),tInterval(day,durationDay,2),tInterval(sunday,durationWeek,1),tInterval(sunday,durationWeek,2),tInterval(sunday,durationWeek,3),tInterval(month,durationMonth,1),tInterval(month,durationMonth,2),tInterval(month,durationMonth,3),tInterval(month,durationMonth,4),tInterval(month,durationMonth,6),tInterval(year,durationYear,1)],TickMultipliers=[1,2,5,10];function isCloseToInteger(t,e){return Math.abs(Math.round(t)-t)=s&&u<=n;if(c&&!d)continue;const p=Math.abs(u-i);(l>p||c!==d)&&(c||(c=d),l=p,a=h)}return a*o}function decimalPlaces(t){for(let e=t.length-1;e>=0;e-=1)if(t[e]!=="0")return e+1;return 0}function tickFormat(t,e){const i=parseFormat(e??",f");(i.precision==null||isNaN(i.precision))&&(!i.type||"eEFgGnprs".includes(i.type)?i.precision=Math.max(...t.map(n=>{if(!Number.isFinite(n))return 0;const[r,o]=n.toExponential((i.type?6:12)-1).split(/[.e]/g);return(r!=="1"&&r!=="-1"?1:0)+decimalPlaces(o)+1})):"f%".includes(i.type)&&(i.precision=Math.max(...t.map(n=>{if(!Number.isFinite(n)||n===0)return 0;const r=Math.floor(Math.log10(Math.abs(n))),o=i.type?6:12,a=n.toExponential(o-1).split(/[.e]/g)[1],l=decimalPlaces(a);return Math.max(0,l-r)}))));const s=numberFormat(i);return n=>s(Number(n))}function range(t,e,i){if(!Number.isFinite(i)||i<=0)return[];const s=10**countFractionDigits(i),n=Math.min(t,e),r=Math.max(t,e),o=[];for(let a=0;;a+=1){const l=Math.round((n+i*a)*s)/s;if(l>r)break;o.push(l)}return o}function isDenseInterval(t,e){return t>=e?(logger_exports.warnOnce("the configured interval results in more than 1 item per pixel, ignoring. Supply a larger interval or omit this configuration"),!0):!1}function niceTicksDomain(t,e){const i=Math.abs(e-t),s=10**Math.floor(Math.log10(i));let n=1/0,r=[t,e];for(const o of TickMultipliers){const a=o*s,l=Math.floor(t/a)*a,c=Math.ceil(e/a)*a,h=1-i/Math.abs(c-l);n>h&&(n=h,r=[l,c])}return r}function estimateTickCount(t,e,i,s,n,r){r=Math.max(r,t/(n+1)),isNaN(i)&&(i=r),isNaN(s)&&(s=t),i>s&&(i===r?i=s:s=i);const o=Math.max(1,Math.floor(t/(e*i))),a=Math.min(o,Math.ceil(t/(e*s))),l=clamp(a,Math.floor(n/e),o);return{minTickCount:a,maxTickCount:o,tickCount:l}}var TimeScale=class extends ContinuousScale{constructor(){super([],[0,1]),this.type="time"}toDomain(t){return new Date(t)}convert(t,e){return t instanceof Date||(t=new Date(t)),super.convert(t,e)}invert(t){return new Date(super.invert(t))}niceDomain(t,e=this.domain){if(e.length<2)return[];const i=4;let[s,n]=e;for(let r=0;rr%h.duration===0);if(o)return o.timeInterval.every(r/(o.duration/o.step)).range(new Date(t),new Date(e),{visibleRange:n});let a=new Date(Math.min(t,e));const l=new Date(Math.max(t,e)),c=[];for(;a<=l;)c.push(a),a=new Date(a),a.setMilliseconds(a.getMilliseconds()+r);return c}function updateNiceDomainIteration(t,e,i){const{interval:s}=i,n=Math.min(dateToNumber(t),dateToNumber(e)),r=Math.max(dateToNumber(t),dateToNumber(e)),o=t>e;let a;if(s instanceof TimeInterval)a=s;else{const l=typeof s=="number"?(r-n)/Math.max(s,1):i.tickCount??ContinuousScale.defaultTickCount;a=getTickInterval(n,r,l,i.minTickCount,i.maxTickCount)}if(a){const l=a.range(new Date(n),new Date(r),{extend:!0}),c=o?[...l].reverse():l,h=c[0],u=c.at(-1);return[h,u]}else return[t,e]}var OrdinalTimeScale=class jt extends BandScale{constructor(){super(...arguments),this.type="ordinal-time",this._domain=[],this.isReversed=!1}static is(e){return e instanceof jt}set domain(e){e!==this._domain&&(this.invalid=!0,this._domain=e,this.isReversed=e.length>0&&e[0]>e[e.length-1],this.sortedTimestamps=void 0,this.precomputedSteps=void 0)}get domain(){return this._domain}toDomain(e){return new Date(e)}normalizeDomains(...e){const i=e.filter(n=>n.length>0).map(n=>{let r=datesSortOrder(n);return r==null&&(n=sortAndUniqueDates(n.slice()),r=1),{domain:n,sortOrder:r}});if(i.length===0)return{domain:[],animatable:!1};if(i.length===1)return{domain:i[0].domain,animatable:!0};let s=i.flatMap(n=>n.domain);return s=sortAndUniqueDates(s),i.every(n=>n.sortOrder===-1)&&s.reverse(),{domain:s,animatable:!0}}ticks({interval:e,maxTickCount:i},s=this.domain,n=[0,1]){if(!s.length)return[];this.refresh();const{isReversed:r}=this;if(e==null)return getDefaultTicks(s,i,r,n);const[o,a]=[s[0].valueOf(),s.at(-1).valueOf()],l=Math.min(o,a),c=Math.max(o,a),[h,u]=this.range,d=Math.abs(u-h),p=getDateTicksForInterval({start:l,stop:c,interval:e,availableRange:d,visibleRange:n})??[];let g=-1;return p.filter(m=>{const y=this.findInterval(m.valueOf()),f=y===g;return g=y,!f})}getSortedTimestamps(){let{sortedTimestamps:e}=this;return e==null&&(e=this.domain.map(dateToNumber),this.isReversed&&e.reverse(),this.sortedTimestamps=e),e}getPrecomputedSteps(){const{domain:e}=this;let{precomputedSteps:i}=this;const s=e.length<1e4?e.length:Math.ceil(e.length/16);if(i!=null||s<=1)return i;const n=this.getSortedTimestamps();i=new Int32Array(s);const r=n[0],a=n[n.length-1]-r,l=0,c=n.length-1;for(let h=0;hthis.ordinalRange(r)>=e?s[r]:void 0)??s[0]}getIndex(e){const i=this.getSortedTimestamps(),s=Number(e);if(snew i:i}static select(e,i,s=!0){return new gt(e,i,s)}static selectAll(e,i){const s=[],n=r=>{i(r)&&s.push(r);for(const o of r.children())n(o)};return n(e),s}static selectByClass(e,...i){return gt.selectAll(e,s=>i.some(n=>s instanceof n))}static selectByTag(e,i){return gt.selectAll(e,s=>s.tag===i)}createNode(e,i,s){const n=this.nodeFactory(e);return n.datum=e,i?.(n),s==null?this._nodes.push(n):this._nodes.splice(s,0,n),this.parentNode.appendChild(n),n}update(e,i,s){if(this.garbageBin.size>0&&this.debug("Selection - update() called with pending garbage",e),s){const n=new Map(e.map((r,o)=>[s(r),[r,o]]));for(const[r,o]of this._nodesMap.entries())if(n.has(o)){const[a]=n.get(o);r.datum=a,this.garbageBin.delete(r),n.delete(o)}else this.garbageBin.add(r);for(const[r,[o,a]]of n.entries())this._nodesMap.set(this.createNode(o,i,a),r)}else{const n=Math.max(e.length,this.data.length);for(let r=0;r=e.length?this.garbageBin.add(this._nodes[r]):r>=this._nodes.length?this.createNode(e[r],i):(this._nodes[r].datum=e[r],this.garbageBin.delete(this._nodes[r]))}return this.data=e.slice(),this.autoCleanup&&this.cleanup(),this}cleanup(){return this.garbageBin.size===0?this:(this._nodes=this._nodes.filter(e=>this.garbageBin.has(e)?(this._nodesMap.delete(e),this.garbageBin.delete(e),e.destroy(),!1):!0),this)}clear(){return this.update([]),this}isGarbage(e){return this.garbageBin.has(e)}each(e){for(const i of this._nodes.entries())e(i[1],i[1].datum,i[0]);return this}*[Symbol.iterator](){for(let e=0;e=0&&e<=Math.PI?-1:1,r=!s&&i>=0&&i<=Math.PI?-1:1;let o=0;return t.parallel?o=n*Math.PI/2:r===-1&&(o=Math.PI),{configuredRotation:s,defaultRotation:o,parallelFlipFlag:n,regularFlipFlag:r}}function getLabelSpacing(t,e){return isNaN(t)?e?0:10:t}function getTextBaseline(t,e,i,s){return t&&!e?i*s===-1?"hanging":"bottom":"middle"}function getTextAlign(t,e,i,s,n){const r=e>0&&e<=Math.PI,o=i>0&&i<=Math.PI,a=r||o?-1:1;if(t)if(e||i){if(s*a===-1)return"end"}else return"center";else if(s*n===-1)return"end";return"start"}function createLabelData(t,e,i,s){const n=[];for(const{tickLabel:r,translationY:o}of t){if(!r)continue;const{width:a,height:l}=s.measureLines(r),c=new BBox(e,o,a,l),h=new BBox(e,o,0,0);i.transformBBox(h,c);const{x:u,y:d}=c;n.push({point:{x:u,y:d},label:{text:r,width:a,height:l}})}return n}function isStringObject(t){return t!=null&&Object.hasOwn(t,"toString")&&isString(t.toString())}function isNumberObject(t){return t!=null&&Object.hasOwn(t,"valueOf")&&isFiniteNumber(t.valueOf())}function isContinuous(t){return isFiniteNumber(t)||isValidDate(t)||isNumberObject(t)}function checkDatum(t,e){return t!=null&&(!e||isContinuous(t))}function transformIntegratedCategoryValue(t){return isStringObject(t)&&Object.hasOwn(t,"id")?t.id:t}var MATCHING_CROSSLINE_TYPE=t=>t==="value"?predicateWithMessage((e,i)=>i.target.type==="line",e=>e.target.type==="range"?"crossLine type 'range' to have a 'range' property instead of 'value'":"crossLine property 'type' to be 'line'"):predicateWithMessage((e,i)=>i.target.type==="range",e=>e.target.type==="line"?"crossLine type 'line' to have a 'value' property instead of 'range'":"crossLine property 'type' to be 'range'"),validateCrossLineValues=(t,e,i,s,n)=>{const r=t==="line"&&e!==void 0,o=t==="range"&&i!==void 0;if(!r&&!o)return!0;const[a,l]=i??[e,void 0],c=ContinuousScale.is(s)||OrdinalTimeScale.is(s),h=checkDatum(a,c)&&!isNaN(s.convert(a)),u=checkDatum(l,c)&&!isNaN(s.convert(l));if(r&&h||o&&h&&u)return n?.()??!0;const d=["Expecting crossLine"];return o?(h||d.push(`range start ${stringifyValue(a)}`),u||d.push(`${h?"":"and "}range end ${stringifyValue(l)}`)):d.push(`value ${stringifyValue(a)}`),d.push("to match the axis scale domain."),logger_exports.warnOnce(d.join(" ")),!1},horizontalCrosslineTranslationDirections={top:{xTranslationDirection:0,yTranslationDirection:-1},bottom:{xTranslationDirection:0,yTranslationDirection:1},left:{xTranslationDirection:-1,yTranslationDirection:0},right:{xTranslationDirection:1,yTranslationDirection:0},"top-left":{xTranslationDirection:1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"bottom-right":{xTranslationDirection:-1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:1,yTranslationDirection:0},"inside-right":{xTranslationDirection:-1,yTranslationDirection:0},"inside-top":{xTranslationDirection:0,yTranslationDirection:1},"inside-bottom":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-right":{xTranslationDirection:-1,yTranslationDirection:-1}},verticalCrossLineTranslationDirections={top:{xTranslationDirection:1,yTranslationDirection:0},bottom:{xTranslationDirection:-1,yTranslationDirection:0},left:{xTranslationDirection:0,yTranslationDirection:-1},right:{xTranslationDirection:0,yTranslationDirection:1},"top-left":{xTranslationDirection:-1,yTranslationDirection:-1},"top-right":{xTranslationDirection:-1,yTranslationDirection:1},"bottom-left":{xTranslationDirection:1,yTranslationDirection:-1},"bottom-right":{xTranslationDirection:1,yTranslationDirection:1},inside:{xTranslationDirection:0,yTranslationDirection:0},"inside-left":{xTranslationDirection:0,yTranslationDirection:1},"inside-right":{xTranslationDirection:0,yTranslationDirection:-1},"inside-top":{xTranslationDirection:-1,yTranslationDirection:0},"inside-bottom":{xTranslationDirection:1,yTranslationDirection:0},"inside-top-left":{xTranslationDirection:-1,yTranslationDirection:1},"inside-bottom-left":{xTranslationDirection:1,yTranslationDirection:1},"inside-top-right":{xTranslationDirection:-1,yTranslationDirection:-1},"inside-bottom-right":{xTranslationDirection:1,yTranslationDirection:-1}};function calculateLabelTranslation({yDirection:t,padding:e=0,position:i="top",bbox:s}){const n=t?horizontalCrosslineTranslationDirections:verticalCrossLineTranslationDirections,{xTranslationDirection:r,yTranslationDirection:o}=n[i],a=r*(e+s.width/2),l=o*(e+s.height/2);return{xTranslation:a,yTranslation:l}}function calculateLabelChartPadding({yDirection:t,bbox:e,padding:i=0,position:s="top"}){const n={};return s.startsWith("inside")||(s==="top"&&!t?n.top=i+e.height:s==="bottom"&&!t?n.bottom=i+e.height:s==="left"&&t?n.left=i+e.width:s==="right"&&t&&(n.right=i+e.width)),n}var POSITION_TOP_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e/2,y:i}:{x:e,y:isNaN(s)?i:(i+s)/2},POSITION_LEFT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:e,y:isNaN(n)?s:(s+n)/2}:{x:i/2,y:s},POSITION_RIGHT_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:isNaN(s)?i:(i+s)/2}:{x:e/2,y:isNaN(s)?i:s},POSITION_BOTTOM_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:i/2,y:isNaN(n)?s:n}:{x:e,y:isNaN(n)?s:(s+n)/2},POSITION_INSIDE_COORDINATES=({xEnd:t,yStart:e,yEnd:i})=>({x:t/2,y:isNaN(i)?e:(e+i)/2}),POSITION_TOP_LEFT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s})=>t==="y"?{x:e/2,y:s}:{x:i,y:s},POSITION_BOTTOM_LEFT_COORDINATES=({direction:t,xStart:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:isNaN(s)?i:s}:{x:e,y:i},POSITION_TOP_RIGHT_COORDINATES=({direction:t,xEnd:e,yStart:i,yEnd:s})=>t==="y"?{x:e,y:i}:{x:e,y:isNaN(s)?i:s},POSITION_BOTTOM_RIGHT_COORDINATES=({direction:t,xStart:e,xEnd:i,yStart:s,yEnd:n})=>t==="y"?{x:i,y:isNaN(n)?s:n}:{x:e,y:isNaN(n)?s:n},labelDirectionHandling={top:{c:POSITION_TOP_COORDINATES},bottom:{c:POSITION_BOTTOM_COORDINATES},left:{c:POSITION_LEFT_COORDINATES},right:{c:POSITION_RIGHT_COORDINATES},"top-left":{c:POSITION_TOP_LEFT_COORDINATES},"top-right":{c:POSITION_TOP_RIGHT_COORDINATES},"bottom-left":{c:POSITION_BOTTOM_LEFT_COORDINATES},"bottom-right":{c:POSITION_BOTTOM_RIGHT_COORDINATES},inside:{c:POSITION_INSIDE_COORDINATES},"inside-left":{c:POSITION_LEFT_COORDINATES},"inside-right":{c:POSITION_RIGHT_COORDINATES},"inside-top":{c:POSITION_TOP_COORDINATES},"inside-bottom":{c:POSITION_BOTTOM_COORDINATES},"inside-top-left":{c:POSITION_TOP_LEFT_COORDINATES},"inside-bottom-left":{c:POSITION_BOTTOM_LEFT_COORDINATES},"inside-top-right":{c:POSITION_TOP_RIGHT_COORDINATES},"inside-bottom-right":{c:POSITION_BOTTOM_RIGHT_COORDINATES}},CROSSLINE_LABEL_POSITION=UNION(["top","left","right","bottom","top-left","top-right","bottom-left","bottom-right","inside","inside-left","inside-right","inside-top","inside-bottom","inside-top-left","inside-bottom-left","inside-top-right","inside-bottom-right"],"crossLine label position"),CartesianCrossLineLabel=class extends BaseProperties{constructor(){super(...arguments),this.fontSize=14,this.fontFamily="Verdana, sans-serif",this.padding=5,this.color="rgba(87, 87, 87, 1)"}};__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLineLabel.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],CartesianCrossLineLabel.prototype,"text",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],CartesianCrossLineLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],CartesianCrossLineLabel.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],CartesianCrossLineLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],CartesianCrossLineLabel.prototype,"fontFamily",2),__decorateClass([Validate(NUMBER)],CartesianCrossLineLabel.prototype,"padding",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLineLabel.prototype,"color",2),__decorateClass([Validate(CROSSLINE_LABEL_POSITION,{optional:!0})],CartesianCrossLineLabel.prototype,"position",2),__decorateClass([Validate(NUMBER,{optional:!0})],CartesianCrossLineLabel.prototype,"rotation",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLineLabel.prototype,"parallel",2);var CartesianCrossLine=class extends BaseProperties{constructor(){super(),this.id=createId(this),this.label=new CartesianCrossLineLabel,this.scale=void 0,this.clippedRange=[-1/0,1/0],this.gridLength=0,this.sideFlag=-1,this.parallelFlipRotation=0,this.regularFlipRotation=0,this.direction="x",this.rangeGroup=new Group({name:this.id}),this.lineGroup=new Group({name:this.id}),this.labelGroup=new Group({name:this.id}),this.crossLineRange=new Range,this.crossLineLabel=new TransformableText,this.labelPoint=void 0,this.data=[],this.startLine=!1,this.endLine=!1,this.isRange=!1,this._isRange=void 0,this.lineGroup.append(this.crossLineRange),this.labelGroup.append(this.crossLineLabel),this.crossLineRange.pointerEvents=1}update(t){const{enabled:e,data:i,type:s,value:n,range:r,scale:o}=this;if(!s||!o||!e||!t||!validateCrossLineValues(s,n,r,o)||i.length===0){this.rangeGroup.visible=!1,this.lineGroup.visible=!1,this.labelGroup.visible=!1;return}this.rangeGroup.visible=t,this.lineGroup.visible=t,this.labelGroup.visible=t,this.updateNodes();const{isRange:a}=this;a!==this._isRange&&(a?this.rangeGroup.appendChild(this.crossLineRange):this.lineGroup.appendChild(this.crossLineRange)),this._isRange=a}calculateLayout(t,e){if(!t)return;const{scale:i,gridLength:s,sideFlag:n,direction:r,label:{position:o="top"},clippedRange:a,strokeWidth:l=0}=this;if(this.data=[],!i)return;const c=i.bandwidth??0,h=i.step??0,u=(e?-1:1)*(i instanceof BandScale?(h-c)/2:0),[d,p]=[0,n*s];let[g,m]=this.getRange();const y=m===void 0&&OrdinalTimeScale.is(i)?c/2+u:0;let[f,x]=[Number(i.convert(g,!0))-u+y,i.convert(m,!0)+c+u];f=clampArray(f,a),x=clampArray(x,a),[g,m]=[Number(i.convert(g))+y,i.convert(m)+c];const v=(g===f||m===x||f!==x)&&Math.abs(x-f)>0;if(v&&f>x&&([f,x]=[x,f],[g,m]=[m,g]),g-u>=f&&(g-=u),m+u<=x&&(m+=u),this.isRange=v,this.startLine=l>0&&g>=f&&g<=f+u,this.endLine=l>0&&m>=x-c-u&&m<=x,!v&&!this.startLine&&!this.endLine||(this.data=[f,x],!this.label.enabled))return;const{c:b=POSITION_TOP_COORDINATES}=labelDirectionHandling[o]??{},{x:S,y:A}=b({direction:r,xStart:d,xEnd:p,yStart:f,yEnd:x});this.labelPoint={x:S,y:A}}updateNodes(){this.updateRangeNode(),this.label.enabled&&(this.updateLabel(),this.positionLabel())}updateRangeNode(){const{crossLineRange:t,sideFlag:e,gridLength:i,data:s,startLine:n,endLine:r,isRange:o,fill:a,fillOpacity:l,stroke:c,strokeWidth:h,lineDash:u}=this;t.x1=0,t.x2=e*i,t.y1=s[0],t.y2=s[1],t.startLine=n,t.endLine=r,t.isRange=o,t.fill=a,t.fillOpacity=l??1,t.stroke=c,t.strokeWidth=h??1,t.strokeOpacity=this.strokeOpacity??1,t.lineDash=u}updateLabel(){const{crossLineLabel:t,label:e}=this;e.text&&(t.fontStyle=e.fontStyle,t.fontWeight=e.fontWeight,t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.fill=e.color,t.text=e.text)}positionLabel(){const{crossLineLabel:t,labelPoint:{x:e=void 0,y:i=void 0}={},label:{parallel:s,rotation:n,position:r="top",padding:o=0},direction:a,parallelFlipRotation:l,regularFlipRotation:c}=this;if(e===void 0||i===void 0)return;const{defaultRotation:h,configuredRotation:u}=calculateLabelRotation({rotation:n,parallel:s,regularFlipRotation:c,parallelFlipRotation:l});t.rotation=h+u,t.textBaseline="middle",t.textAlign="center";const d=t.getBBox();if(!d)return;const p=a==="y",{xTranslation:g,yTranslation:m}=calculateLabelTranslation({yDirection:p,padding:o,position:r,bbox:d});t.translationX=e+g,t.translationY=i+m}getRange(){const{value:t,range:e,scale:i}=this,s=ContinuousScale.is(i)||OrdinalTimeScale.is(i),n=e?.[0]??t;let r=e?.[1];return!s&&r===void 0&&(r=n),s&&n===r&&(r=void 0),[n,r]}computeLabelBBox(){const{label:t}=this;if(!t.enabled)return;const e=new TransformableText;e.fontFamily=t.fontFamily,e.fontSize=t.fontSize,e.fontStyle=t.fontStyle,e.fontWeight=t.fontWeight,e.text=t.text;const{labelPoint:{x:i=void 0,y:s=void 0}={},label:{parallel:n,rotation:r,position:o="top",padding:a=0},direction:l,parallelFlipRotation:c,regularFlipRotation:h}=this;if(i===void 0||s===void 0)return;const{configuredRotation:u}=calculateLabelRotation({rotation:r,parallel:n,regularFlipRotation:h,parallelFlipRotation:c});e.rotation=u,e.textBaseline="middle",e.textAlign="center";const d=e.getBBox();if(!d)return;const p=l==="y",{xTranslation:g,yTranslation:m}=calculateLabelTranslation({yDirection:p,padding:a,position:o,bbox:d});return e.x=i+g,e.y=s+m,e.getBBox()}calculatePadding(t){const{isRange:e,startLine:i,endLine:s,direction:n,label:{padding:r=0,position:o="top"}}=this;if(!e&&!i&&!s)return;const a=this.computeLabelBBox();if(a?.x==null||a?.y==null)return;const l=calculateLabelChartPadding({yDirection:n==="y",padding:r,position:o,bbox:a});t.left=Math.max(t.left??0,l.left??0),t.right=Math.max(t.right??0,l.right??0),t.top=Math.max(t.top??0,l.top??0),t.bottom=Math.max(t.bottom??0,l.bottom??0)}};CartesianCrossLine.className="CrossLine",__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianCrossLine.prototype,"enabled",2),__decorateClass([Validate(UNION(["range","line"],"a crossLine type"),{optional:!0})],CartesianCrossLine.prototype,"type",2),__decorateClass([Validate(AND(MATCHING_CROSSLINE_TYPE("range"),ARRAY.restrict({length:2})),{optional:!0})],CartesianCrossLine.prototype,"range",2),__decorateClass([Validate(MATCHING_CROSSLINE_TYPE("value"),{optional:!0})],CartesianCrossLine.prototype,"value",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLine.prototype,"fill",2),__decorateClass([Validate(RATIO,{optional:!0})],CartesianCrossLine.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],CartesianCrossLine.prototype,"stroke",2),__decorateClass([Validate(NUMBER,{optional:!0})],CartesianCrossLine.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],CartesianCrossLine.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH,{optional:!0})],CartesianCrossLine.prototype,"lineDash",2),__decorateClass([Validate(OBJECT)],CartesianCrossLine.prototype,"label",2);var ZIndexMap=(t=>(t[t.CHART_BACKGROUND=0]="CHART_BACKGROUND",t[t.AXIS_GRID=1]="AXIS_GRID",t[t.AXIS=2]="AXIS",t[t.ZOOM_SELECTION=3]="ZOOM_SELECTION",t[t.SERIES_CROSSLINE_RANGE=4]="SERIES_CROSSLINE_RANGE",t[t.SERIES_LAYER=5]="SERIES_LAYER",t[t.AXIS_FOREGROUND=6]="AXIS_FOREGROUND",t[t.SERIES_CROSSHAIR=7]="SERIES_CROSSHAIR",t[t.SERIES_CROSSLINE_LINE=8]="SERIES_CROSSLINE_LINE",t[t.SERIES_ANNOTATION=9]="SERIES_ANNOTATION",t[t.CHART_ANNOTATION=10]="CHART_ANNOTATION",t[t.CHART_ANNOTATION_FOCUSED=11]="CHART_ANNOTATION_FOCUSED",t[t.STATUS_BAR=12]="STATUS_BAR",t[t.SERIES_LABEL=13]="SERIES_LABEL",t[t.LEGEND=14]="LEGEND",t[t.NAVIGATOR=15]="NAVIGATOR",t[t.FOREGROUND=16]="FOREGROUND",t))(ZIndexMap||{}),GRID_STYLE_KEYS=["stroke","lineDash"],GRID_STYLE=ARRAY_OF(t=>isObject(t)&&Object.keys(t).every(e=>GRID_STYLE_KEYS.includes(e)),"objects with gridline style properties such as 'stroke' or 'lineDash'"),AxisGridLine=class{constructor(){this.enabled=!0,this.width=1,this.style=[{stroke:void 0,lineDash:[]}]}};__decorateClass([Validate(BOOLEAN)],AxisGridLine.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisGridLine.prototype,"width",2),__decorateClass([Validate(GRID_STYLE)],AxisGridLine.prototype,"style",2);function Default(t,e=[void 0]){return addTransformToInstanceProperty((i,s,n)=>e.includes(n)?isFunction(t)?t(n):t:n)}var TICK_INTERVAL=predicateWithMessage(t=>isFiniteNumber(t)&&t>0||t instanceof TimeInterval,"a non-zero positive Number value or, for a time axis, a Time Interval such as 'agCharts.time.month'"),AxisInterval=class extends BaseProperties{constructor(){super(...arguments),this.minSpacing=NaN,this.maxSpacing=NaN}};__decorateClass([Validate(TICK_INTERVAL,{optional:!0})],AxisInterval.prototype,"step",2),__decorateClass([Validate(ARRAY,{optional:!0})],AxisInterval.prototype,"values",2),__decorateClass([Validate(MIN_SPACING),Default(NaN)],AxisInterval.prototype,"minSpacing",2),__decorateClass([Validate(MAX_SPACING),Default(NaN)],AxisInterval.prototype,"maxSpacing",2);var AxisLabel=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0,this.fontSize=12,this.fontFamily="Verdana, sans-serif",this.spacing=5,this.minSpacing=NaN,this.color="#575757",this.avoidCollisions=!0,this.mirrored=!1,this.parallel=!1}getSideFlag(){return this.mirrored?1:-1}};__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"enabled",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],AxisLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],AxisLabel.prototype,"fontWeight",2),__decorateClass([Validate(NUMBER.restrict({min:1}))],AxisLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],AxisLabel.prototype,"fontFamily",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisLabel.prototype,"spacing",2),__decorateClass([Validate(NUMBER_OR_NAN),Default(NaN)],AxisLabel.prototype,"minSpacing",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisLabel.prototype,"color",2),__decorateClass([Validate(NUMBER,{optional:!0})],AxisLabel.prototype,"rotation",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"avoidCollisions",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"mirrored",2),__decorateClass([Validate(BOOLEAN)],AxisLabel.prototype,"parallel",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisLabel.prototype,"itemStyler",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisLabel.prototype,"formatter",2),__decorateClass([Validate(STRING,{optional:!0})],AxisLabel.prototype,"format",2);var AxisLine=class{constructor(){this.enabled=!0,this.width=1,this.stroke=void 0}};__decorateClass([Validate(BOOLEAN)],AxisLine.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisLine.prototype,"width",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisLine.prototype,"stroke",2);var AxisTick=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0,this.width=1,this.size=6}};__decorateClass([Validate(BOOLEAN)],AxisTick.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTick.prototype,"width",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTick.prototype,"size",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisTick.prototype,"stroke",2);var AxisTitle=class extends BaseProperties{constructor(){super(...arguments),this.caption=new Caption,this.enabled=!1,this.spacing=Caption.SMALL_PADDING,this.fontSize=10,this.fontFamily="sans-serif",this.wrapping="always"}};__decorateClass([Validate(BOOLEAN)],AxisTitle.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],AxisTitle.prototype,"text",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],AxisTitle.prototype,"spacing",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],AxisTitle.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],AxisTitle.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],AxisTitle.prototype,"fontSize",2),__decorateClass([Validate(STRING)],AxisTitle.prototype,"fontFamily",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],AxisTitle.prototype,"color",2),__decorateClass([Validate(TEXT_WRAP)],AxisTitle.prototype,"wrapping",2),__decorateClass([Validate(FUNCTION,{optional:!0})],AxisTitle.prototype,"formatter",2);var NiceMode=(t=>(t[t.TickAndDomain=0]="TickAndDomain",t[t.TicksOnly=1]="TicksOnly",t[t.Off=2]="Off",t))(NiceMode||{});function prepareAxisAnimationContext(t){const[e,i]=findMinMax(t.range),s=Math.floor(e),n=Math.ceil(i);return{min:s,max:n,visible:s!==n}}var fullCircle=Math.PI*2,halfCircle=fullCircle/2;function normaliseEndRotation(t,e){return Math.abs(e-t)e?e+fullCircle:e-fullCircle}function prepareAxisAnimationFunctions(t){const e=(o,a)=>{const[l=t.min,c=t.max]=findMinMax(a??[]);return oc};return{tick:{fromFn(o,a,l){let c=o.y1+o.translationY,h=o.opacity;return(l==="added"||e(o.datum.translationY,o.datum.range))&&(c=a.translationY,h=0),{y:0,translationY:c,opacity:h,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[l]}},toFn(o,a,l){const c=a.translationY;let h=1;return l==="removed"&&(h=0),{y:0,translationY:c,opacity:h,finish:{y:c,translationY:0}}},applyFn(o,a){o.setProperties(a),o.visible=!e(o.y)}},line:{fromFn(o,a){return{...o.previousDatum??a,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING.updated}},toFn(o,a){return{...a}}},label:{fromFn(o,a,l){const c=o.previousDatum??a,h=c.x,u=c.y,d=c.rotationCenterX;let p=Math.round(o.translationY),g=c.rotation,m=o.opacity;return l==="removed"||e(c.y,c.range)?g=a.rotation:(l==="added"||e(o.datum.y,o.datum.range))&&(p=Math.round(c.translationY),m=0,g=a.rotation),{x:h,y:u,rotationCenterX:d,translationY:p,rotation:g,opacity:m,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[l]}},toFn(o,a,l){const c=a.x,h=a.y,u=a.rotationCenterX,d=Math.round(a.translationY);let p=0,g=1;return l==="added"?p=a.rotation:l==="removed"?(g=0,p=a.rotation):p=normaliseEndRotation(o.previousDatum?.rotation??a.rotation,a.rotation),{x:c,y:h,rotationCenterX:u,translationY:d,rotation:p,opacity:g,finish:{rotation:a.rotation}}}},group:{fromFn(o,a){const{rotation:l,translationX:c,translationY:h}=o;return{rotation:l,translationX:c,translationY:h,phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING.updated}},toFn(o,a){const{rotation:l,translationX:c,translationY:h}=a;return{rotation:l,translationX:c,translationY:h}}}}}function resetAxisGroupFn(){return(t,e)=>({rotation:e.rotation,rotationCenterX:e.rotationCenterX,rotationCenterY:e.rotationCenterY,translationX:e.translationX,translationY:e.translationY})}function resetAxisSelectionFn(t){const{visible:e,min:i,max:s}=t;return(n,r)=>{const o=r.translationY,a=e&&o>=i&&o<=s;return{y:o,translationY:0,opacity:1,visible:a}}}function resetAxisLabelSelectionFn(){return(t,e)=>({x:e.x,y:e.y,translationY:e.translationY,rotation:e.rotation,rotationCenterX:e.rotationCenterX})}function resetAxisLineSelectionFn(){return(t,e)=>({...e})}var TranslatableLine=class extends Translatable(Line){},AxisGroupZIndexMap=(t=>(t[t.TickLines=0]="TickLines",t[t.AxisLine=1]="AxisLine",t[t.TickLabels=2]="TickLabels",t))(AxisGroupZIndexMap||{}),_Axis=class zt{constructor(e,i){this.moduleCtx=e,this.scale=i,this.id=createId(this),this.nice=!0,this.reverse=!1,this.keys=[],this.interval=new AxisInterval,this.dataDomain={domain:[],clipped:!1},this.layoutConstraints={stacked:!0,align:"start",width:100,unit:"percent"},this.boundSeries=[],this.includeInvisibleDomains=!1,this.interactionEnabled=!0,this.axisGroup=new TransformableGroup({name:`${this.id}-axis`}),this.tickLineGroup=this.axisGroup.appendChild(new Group({name:`${this.id}-Axis-tick-lines`,zIndex:0})),this.tickLabelGroup=this.axisGroup.appendChild(new Group({name:`${this.id}-Axis-tick-labels`,zIndex:2})),this.labelGroup=new Group({name:`${this.id}-Labels`,zIndex:9}),this.gridGroup=new TransformableGroup({name:`${this.id}-Axis-grid`,zIndex:1}),this.gridLineGroup=this.gridGroup.appendChild(new Group({name:`${this.id}-gridLines`})),this.crossLineRangeGroup=new TransformableGroup({name:`${this.id}-CrossLines-Range`,zIndex:4}),this.crossLineLineGroup=new TransformableGroup({name:`${this.id}-CrossLines-Line`,zIndex:8}),this.crossLineLabelGroup=new TransformableGroup({name:`${this.id}-CrossLines-Label`,zIndex:13}),this.tickLineGroupSelection=Selection.select(this.tickLineGroup,TranslatableLine,!1),this.tickLabelGroupSelection=Selection.select(this.tickLabelGroup,TransformableText,!1),this.gridLineGroupSelection=Selection.select(this.gridLineGroup,TranslatableLine,!1),this._crossLines=[],this.line=new AxisLine,this.tick=new AxisTick,this.gridLine=new AxisGridLine,this.label=this.createLabel(),this.defaultTickMinSpacing=zt.defaultTickMinSpacing,this.translation={x:0,y:0},this.rotation=0,this.layout={label:{fractionDigits:0,spacing:this.label.spacing,format:this.label.format}},this.axisContext=void 0,this.labelFormatter=void 0,this.datumFormatter=void 0,this.scaleFormatterParams=void 0,this.destroyFns=[],this.range=[0,1],this.visibleRange=[0,1],this.title=new AxisTitle,this.gridLength=0,this.gridPadding=0,this.seriesAreaPadding=0,this.animatable=!0,this._scaleNiceDomainInputDomain=void 0,this._scaleNiceDomainRangeExtent=NaN,this.moduleMap=new ModuleMap,this.range=this.scale.range.slice(),this.crossLines.forEach(s=>this.initCrossLine(s))}get type(){return this.constructor.type??""}get labelNodes(){return this.tickLabelGroupSelection.nodes()}set crossLines(e){const{CrossLineConstructor:i}=this.constructor;this._crossLines.forEach(s=>this.detachCrossLine(s)),this._crossLines=e.map(s=>{const n=new i;return n.set(s),n}),this._crossLines.forEach(s=>{this.attachCrossLine(s),this.initCrossLine(s)})}get crossLines(){return this._crossLines}resetAnimation(e){}attachCrossLine(e){this.crossLineRangeGroup.appendChild(e.rangeGroup),this.crossLineLineGroup.appendChild(e.lineGroup),this.crossLineLabelGroup.appendChild(e.labelGroup)}detachCrossLine(e){this.crossLineRangeGroup.removeChild(e.rangeGroup),this.crossLineLineGroup.removeChild(e.lineGroup),this.crossLineLabelGroup.removeChild(e.labelGroup)}destroy(){this.moduleMap.destroy(),this.destroyFns.forEach(e=>e())}updateScale(){const{range:e,visibleRange:i,scale:s}=this,n=(e[1]-e[0])/(i[1]-i[0]),r=n*i[0],o=e[0]-r;s.range=[o,o+n],this.crossLines.forEach(a=>{a.clippedRange=[e[0],e[1]]})}setCrossLinesVisible(e){this.crossLineRangeGroup.visible=e,this.crossLineLineGroup.visible=e,this.crossLineLabelGroup.visible=e}attachAxis(e){e.gridNode.appendChild(this.gridGroup),e.axisNode.appendChild(this.axisGroup),e.labelNode.appendChild(this.labelGroup),e.crossLineRangeNode.appendChild(this.crossLineRangeGroup),e.crossLineLineNode.appendChild(this.crossLineLineGroup),e.crossLineLabelNode.appendChild(this.crossLineLabelGroup)}detachAxis(e){e.gridNode.removeChild(this.gridGroup),e.axisNode.removeChild(this.axisGroup),e.labelNode.removeChild(this.labelGroup),e.crossLineRangeNode.removeChild(this.crossLineRangeGroup),e.crossLineLineNode.removeChild(this.crossLineLineGroup),e.crossLineLabelNode.removeChild(this.crossLineLabelGroup)}attachLabel(e){this.labelGroup.append(e)}inRange(e,i=0){const[s,n]=findMinMax(this.range);return e>=s-i&&e<=n+i}defaultDatumFormatter(e,i){return formatValue(e,i+1)}defaultLabelFormatter(e,i){return formatValue(e,i)}onGridLengthChange(e,i){i^e&&this.onGridVisibilityChange(),this.crossLines.forEach(s=>this.initCrossLine(s))}onGridVisibilityChange(){this.gridLineGroupSelection.clear()}createLabel(){return new AxisLabel}update(){this.updatePosition(),this.updateSelections(),this.tickLineGroup.visible=this.tick.enabled,this.gridLineGroup.visible=this.gridLine.enabled,this.tickLabelGroup.visible=this.label.enabled,this.updateLabels(),this.updateGridLines(),this.updateTickLines(),this.updateCrossLines()}getAxisLineCoordinates(){const[e,i]=findMinMax(this.range);return{x:0,y1:e,y2:i}}getLabelStyles(e,i){const{label:s}=this,n={color:s.color,spacing:s.spacing,fontFamily:s.fontFamily,fontSize:s.fontSize,fontStyle:s.fontStyle,fontWeight:s.fontWeight};let r;s.itemStyler&&(r=this.moduleCtx.callbackCache.call(s.itemStyler,{...e,...n}));const{color:o,fontFamily:a,fontSize:l,fontStyle:c,fontWeight:h,spacing:u}=mergeDefaults(r,i,n);return{fill:o,fontFamily:a,fontSize:l,fontStyle:c,fontWeight:h,spacing:u}}getTickSize(){return this.tick.enabled?this.tick.size:0}setTitleProps(e,i){const{title:s}=this;if(!s.enabled){e.enabled=!1,e.node.visible=!1;return}e.enabled=!0,e.color=s.color,e.fontFamily=s.fontFamily,e.fontSize=s.fontSize,e.fontStyle=s.fontStyle,e.fontWeight=s.fontWeight,e.wrapping=s.wrapping;const n=e.node,r=(s.spacing??0)+i.spacing,o=this.label.getSideFlag(),a=normalizeAngle360(this.rotation),l=o===-1&&a>Math.PI&&af.defaultValue}=s,y=g.call(m,this.getTitleFormatterParams());e.text=y,n.setProperties({visible:!0,text:y,textBaseline:h,x:d,y:p,rotation:c})}processData(){const{includeInvisibleDomains:e,boundSeries:i,direction:s}=this,r=(e?i:i.filter(o=>o.isEnabled())).map(o=>o.getDomain(s));this.setDomains(...r)}setDomains(...e){let i,s;e.length>0?{domain:i,animatable:s}=this.scale.normalizeDomains(...e):(i=[],s=!0),this.dataDomain=this.normaliseDataDomain(i),this.reverse&&this.dataDomain.domain.reverse(),this.animatable=s}calculateLayout(e){const{scale:i,label:s,visibleRange:n,nice:r}=this;this.updateScale();const o=findRangeExtent(this.range),a=this.dataDomain.domain;let l;n[0]===0&&n[1]===1?l=void 0:r?this._scaleNiceDomainInputDomain===a&&this._scaleNiceDomainRangeExtent===o?l=this.scale.domain:l=this.calculateTickLayout(a,0,[0,1]).niceDomain:l=a;let c;r?l==null?c=0:c=1:c=2;const{niceDomain:h,primaryTickCount:u,ticks:d,tickDomain:p,fractionDigits:g,bbox:m}=this.calculateTickLayout(l??a,c,n,e);this.scale.domain=h,this._scaleNiceDomainInputDomain=r?a:void 0,this._scaleNiceDomainRangeExtent=r?o:NaN;const y=s.format;this.labelFormatter=i.tickFormatter({domain:p,specifier:y,ticks:d,fractionDigits:g})??(A=>this.defaultLabelFormatter(A,g)),this.datumFormatter=i.datumFormatter({domain:p,specifier:y,ticks:d,fractionDigits:g})??(A=>this.defaultDatumFormatter(A,g)),this.scaleFormatterParams={domain:p,ticks:d,fractionDigits:g},this.layout.label={fractionDigits:g,spacing:this.label.spacing,format:this.label.format};const f=s.getSideFlag(),x=this.isAnySeriesActive(),{rotation:v,parallelFlipRotation:b,regularFlipRotation:S}=this.calculateRotations();return this.crossLines.forEach(A=>{var D;A.sideFlag=-f,A.direction=v===-Math.PI/2?"x":"y",A instanceof CartesianCrossLine&&((D=A.label).parallel??(D.parallel=s.parallel)),A.parallelFlipRotation=b,A.regularFlipRotation=S,A.calculateLayout?.(x,this.reverse)}),{primaryTickCount:u,bbox:m}}getTransformBox(e){const i=new Matrix,{rotation:s,translationX:n,translationY:r}=this.getAxisTransform();return Matrix.updateTransformMatrix(i,1,1,s,n,r),i.transformBBox(e)}calculateRotations(){const e=toRadians(this.rotation),i=normalizeAngle360(e),s=normalizeAngle360(e-Math.PI/2);return{rotation:e,parallelFlipRotation:i,regularFlipRotation:s}}updateCrossLines(){const e=this.isAnySeriesActive();this.crossLines.forEach(i=>{i.update(e)})}updateTickLines(){const{tick:e,label:i}=this,s=i.getSideFlag();this.tickLineGroupSelection.each((n,r)=>{n.strokeWidth=r.tickWidth??e.width,n.stroke=r.tickStroke??e.stroke,n.x1=s*(r.tickSize??this.getTickSize()),n.x2=0})}getAxisTransform(){return{rotation:toRadians(this.rotation),translationX:Math.floor(this.translation.x),translationY:Math.floor(this.translation.y)}}updatePosition(){const{crossLineRangeGroup:e,crossLineLineGroup:i,crossLineLabelGroup:s,gridGroup:n,translation:r}=this,{rotation:o}=this.calculateRotations(),a=Math.floor(r.x),l=Math.floor(r.y);e.setProperties({rotation:o,translationX:a,translationY:l}),i.setProperties({rotation:o,translationX:a,translationY:l}),s.setProperties({rotation:o,translationX:a,translationY:l}),n.setProperties({rotation:o,translationX:a,translationY:l})}updateGridLines(){const e=this.label.getSideFlag(),{gridLine:{style:i,width:s},gridPadding:n,gridLength:r}=this;r===0||i.length===0||this.gridLineGroupSelection.each((o,a,l)=>{const{stroke:c,lineDash:h}=i[l%i.length];o.setProperties({x1:n,x2:-e*r+n,stroke:c,strokeWidth:s,lineDash:h})})}formatTick(e,i,s,n){const{labelFormatter:r,label:{formatter:o},moduleCtx:{callbackCache:a}}=this;let l;return o?l=a.call(o,{value:e,index:i,fractionDigits:s}):n?l=n(e):r&&(l=r(e)),String(l??e)}formatDatum(e){const{label:{formatter:i},moduleCtx:{callbackCache:s},datumFormatter:n=this.labelFormatter}=this;let r;return i?r=s.call(i,{value:e,index:NaN}):n?r=s.call(n,e):isArray(e)&&(r=e.filter(Boolean).join(" - ")),String(r??e)}getScaleValueFormatter(e){const{scaleFormatterParams:i}=this;let s;try{e!=null&&i!=null&&(s=this.scale.tickFormatter({...i,specifier:e}))}catch{logger_exports.warnOnce(`the format string ${e} is invalid, ignoring.`)}return s??(s=n=>this.formatDatum(n)),s}getBBox(){return this.axisGroup.getBBox()}initCrossLine(e){e.scale=this.scale,e.gridLength=this.gridLength}isAnySeriesActive(){return this.boundSeries.some(e=>this.includeInvisibleDomains||e.isEnabled())}clipTickLines(e,i,s,n){this.tickLineGroup.setClipRect(new BBox(e,i,s,n))}clipGrid(e,i,s,n){this.gridGroup.setClipRect(new BBox(e,i,s,n))}getTitleFormatterParams(){const{direction:e}=this,i=[];for(const s of this.boundSeries){const n=s.getKeys(e),r=s.getNames(e);for(let o=0;oTransformable.toCanvas(this.axisGroup),seriesKeyProperties:()=>this.boundSeries.reduce((i,s)=>(s.getKeyProperties(this.direction).forEach(r=>i.add(r)),i),new Set),seriesIds:()=>this.boundSeries.map(i=>i.id),scaleValueFormatter:i=>this.getScaleValueFormatter(i),scaleInvert:i=>e.invert(i,!0),scaleInvertNearest:i=>e.invert(i,!0),attachLabel:i=>this.attachLabel(i),inRange:(i,s)=>this.inRange(i,s)}}isReversed(){return this.reverse}};_Axis.defaultTickMinSpacing=50,_Axis.CrossLineConstructor=CartesianCrossLine,__decorateClass([Validate(BOOLEAN)],_Axis.prototype,"nice",2),__decorateClass([Validate(BOOLEAN)],_Axis.prototype,"reverse",2),__decorateClass([Validate(STRING_ARRAY)],_Axis.prototype,"keys",2),__decorateClass([Validate(OBJECT)],_Axis.prototype,"interval",2),__decorateClass([Validate(OBJECT)],_Axis.prototype,"title",2),__decorateClass([ObserveChanges((t,e,i)=>t.onGridLengthChange(e,i))],_Axis.prototype,"gridLength",2);var Axis=_Axis;function circleRectOverlap(t,e,i,s,n,r){if(t.size===0)return!1;let o=t.x,a=t.y;e!=null&&(o-=(e.x-.5)*t.size,a-=(e.y-.5)*t.size);let l=o;oi+n&&(l=i+n);let c=a;as+r&&(c=s+r);const h=o-l,u=a-c;return Math.sqrt(h*h+u*u)<=t.size*.5}function rectRectOverlap(t,e,i,s,n){const r=t.x+t.width>e&&t.xi&&t.yt.x&&i>t.y&&i+n[a,l.toSorted((c,h)=>h.point.size-c.point.size)])),o=[...r.values()].flat();for(const[a,l]of r.entries()){const c=[];if(l[0]?.label){for(let h=0,u=l.length;h0&&d.placement!=null){const w=labelPlacements[d.placement];b=(f*.5+v+i)*w.x,S=(x*.5+v+i)*w.y}const A=p.x-f*.5+b-((m?.x??.5)-.5)*p.size,D=p.y-x*.5+S-((m?.y??.5)-.5)*p.size;if(!(!e||rectContainsRect(e,A,D,f,x))||o.some(w=>circleRectOverlap(w.point,w.anchor,A,D,f,x))||n.some(w=>rectRectOverlap(w,A,D,f,x)))continue;const T={index:h,text:y,x:A,y:D,width:f,height:x,datum:d};c.push(T),n.push(T)}s.set(a,c)}}return s}function axisLabelsOverlap(t,e=0){const i=[];for(let s=0;srectRectOverlap(h,r,o,l,c)))return!0;i.push({index:s,text:a,x:r,y:o,width:l,height:c,datum:n})}return!1}function calculateNiceSecondaryAxis(t,e,i){let[s,n]=findMinMax(t);s=calculateNiceStart(Math.floor(s),n,e);const r=getTickStep(s,n,e),o=e-1;n=s+o*r;const a=i?[n,s]:[s,n],l=getTicks(s,r,e);return{domain:a,ticks:l}}function calculateNiceStart(t,e,i){const s=Math.abs(e-t)/(i-1),n=Math.floor(Math.log10(s)),r=Math.pow(10,n);return Math.floor(t/r)*r}function getTicks(t,e,i){const s=Math.floor(Math.log10(e)),n=e>0&&e<1?Math.abs(s):0,r=Math.pow(10,n),o=[];for(let a=0;a0&&s<=1?i/10:s>1&&s<=2?2*i/10:s>1&&s<=5?5*i/10:s>5&&s<=10?10*i/10:s>10&&s<=20?20*i/10:s>20&&s<=40?40*i/10:s>40&&s<=50?50*i/10:s>50&&s<=100?100*i/10:s}function createIdsGenerator(){const t=new Map;return e=>{const i=t.get(e);return i?(t.set(e,i+1),`${e}_${i}`):(t.set(e,1),e)}}var AxisTickGenerator=class{constructor(t){this.axis=t}estimateTickCount(t,e,i){return estimateTickCount(findRangeExtent(this.axis.range),findRangeExtent(t),e,i,ContinuousScale.defaultTickCount,this.axis.defaultTickMinSpacing)}filterTicks(t,e){const{minSpacing:i,maxSpacing:s}=this.axis.interval,r=!isNaN(i)||!isNaN(s)?Math.ceil(t.length/e):2,o=t.length%r?-1:0;return t.filter((a,l)=>(l+o)%r===0)}generateTicks({domain:t,primaryTickCount:e,visibleRange:i,niceMode:s,parallelFlipRotation:n,regularFlipRotation:r,labelX:o,sideFlag:a}){const{scale:l,label:c,interval:{minSpacing:h,maxSpacing:u}}=this.axis,{parallel:d,rotation:p,fontFamily:g,fontSize:m,fontStyle:y,fontWeight:f}=c,x=e!==void 0,{defaultRotation:v,configuredRotation:b,parallelFlipFlag:S,regularFlipFlag:A}=calculateLabelRotation({rotation:p,parallel:d,regularFlipRotation:r,parallelFlipRotation:n}),D=b+v,I=new Matrix,{maxTickCount:L}=this.estimateTickCount(i,h,u),T=!(ContinuousScale.is(l)||OrdinalTimeScale.is(l))||isNaN(L)?10:L;let w=getTextAlign(d,b,0,a,A);const O=getTextBaseline(d,b,a,S),Z=TextUtils.toFontString({fontFamily:g,fontSize:m,fontStyle:y,fontWeight:f}),F=CachedTextMeasurerPool.getMeasurer({font:Z}),U={fontFamily:g,fontSize:m,fontStyle:y,fontWeight:f,textBaseline:O,textAlign:w},W=c.enabled&&c.avoidCollisions,H=({ticks:$},j)=>{if(!W)return!1;const B=b!==0||j!==0,k=D+j,R=getLabelSpacing(c.minSpacing,B);Matrix.updateTransformMatrix(I,1,1,k,0,0);const z=createLabelData($,o,I,F);return axisLabelsOverlap(z,R)};let _={tickDomain:[],ticks:[],rawTicks:[],fractionDigits:0,niceDomain:void 0},E=0,P=0,G=!0,V=!1;for(;!V&&G&&E<=T;){P=0;for(const $ of this.getTickStrategies({domain:t,niceMode:s,secondaryAxis:x,index:E}))({tickData:_,index:E,autoRotation:P,terminate:V}=$({index:E,tickData:_,textProps:U,terminate:V,primaryTickCount:e,visibleRange:i,get labelOverlap(){return H(_,P)}}));G=H(_,P)}w=getTextAlign(d,b,P,a,A);const Y=v+b+P;return!x&&_.rawTicks.length>0&&(e=_.rawTicks.length),{tickData:_,primaryTickCount:e,combinedRotation:Y,textBaseline:O,textAlign:w}}getTickStrategies({domain:t,niceMode:e,index:i,secondaryAxis:s}){const{scale:n,label:r,interval:o}=this.axis,{minSpacing:a}=o,l=ContinuousScale.is(n)||OrdinalTimeScale.is(n),c=r.enabled&&r.avoidCollisions,h=!l&&i!==0&&c,u=r.autoRotate===!0&&r.rotation===void 0,d=[];let p;o.values?p=3:s?p=1:h?p=2:p=0;const g=({index:m,tickData:y,primaryTickCount:f,visibleRange:x,terminate:v})=>this.createTickData(t,e,x,f,p,m,y,v);if(d.push(g),!l&&!isNaN(a)){const m=({index:y,tickData:f,primaryTickCount:x,visibleRange:v,terminate:b})=>this.createTickData(t,e,v,x,2,y,f,b);d.push(m)}if(c&&u){const m=({index:y,tickData:f,labelOverlap:x,terminate:v})=>({index:y,tickData:f,autoRotation:x?normalizeAngle360(toRadians(r.autoRotateAngle??0)):0,terminate:v});d.push(m)}return d}createTickData(t,e,i,s,n,r,o,a){const{scale:l,interval:c}=this.axis,{step:h,values:u,minSpacing:d,maxSpacing:p}=c,{maxTickCount:g,minTickCount:m,tickCount:y}=this.estimateTickCount(i,d,p),f=ContinuousScale.is(l)||OrdinalTimeScale.is(l),x=!f||isNaN(g)?10:g,v=S=>f?Math.max(y-S,m):g,b=h==null&&u==null&&v(r)>m&&(f||n===2);for(;r<=x;){const S=o.rawTicks;if(o=this.getTicks({domain:t,niceMode:e,visibleRange:i,tickGenerationType:n,previousTicks:S,minTickCount:m,maxTickCount:g,primaryTickCount:s,tickCount:v(r)}),r++,!b||!arraysEqual(o.rawTicks,S))break}return a||(a=h!=null||u!=null),{tickData:o,index:r,autoRotation:0,terminate:a}}getTicks({domain:t,niceMode:e,visibleRange:i,tickGenerationType:s,previousTicks:n,tickCount:r,minTickCount:o,maxTickCount:a,primaryTickCount:l}){const{axis:c}=this,{label:h,range:u,scale:d,interval:p}=c,g=createIdsGenerator(),m={nice:e===0,interval:p.step,tickCount:r,minTickCount:o,maxTickCount:a},y={...m,nice:e===0||e===1};let f=e===0?d.niceDomain(m,t):t,x=f,v;switch(s){case 3:if(x=p.values,v=p.values,ContinuousScale.is(d)){const[N,T]=findMinMax(f.map(Number));v=v.filter(w=>Number(w)>=N&&Number(w)<=T).sort((w,O)=>Number(w)-Number(O))}break;case 1:if(ContinuousScale.is(d)){const N=calculateNiceSecondaryAxis(t.map(Number),l??0,c.reverse);v=N.ticks,f=N.domain.map(T=>d.toDomain(T))}else v=d.ticks(y,f,i)??[];break;case 2:v=this.filterTicks(n,r);break;default:v=d.ticks(y,f,i)??[]}const b=v.reduce((N,T)=>Math.max(N,typeof T=="number"?countFractionDigits(T):0),0),S={domain:x,ticks:v,fractionDigits:b,specifier:h.format},A=d.tickFormatter(S),D=d.domain;d.domain=f;const I=(d.bandwidth??0)/2,L=[];for(let N=0;N0&&!c.inRange(w,.001))continue;const O=h.enabled?c.formatTick(T,N,b,A):"";L.push({tick:T,tickId:g(O),tickLabel:O,translationY:Math.floor(w)})}return d.domain=D,{tickDomain:x,rawTicks:v,fractionDigits:b,ticks:L,niceDomain:f}}},CartesianAxisLabel=class extends AxisLabel{constructor(){super(...arguments),this.autoRotateAngle=335}};__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianAxisLabel.prototype,"autoRotate",2),__decorateClass([Validate(NUMBER)],CartesianAxisLabel.prototype,"autoRotateAngle",2);var _CartesianAxis=class Ft extends Axis{constructor(e,i){super(e,i),this.lineNode=this.axisGroup.appendChild(new TranslatableLine({name:`${this.id}-Axis-line`,zIndex:1})),this.tempText=new TransformableText,this.tempCaption=new Caption,this.tickGenerator=new AxisTickGenerator(this),this.generatedTicks=void 0,this.animationManager=e.animationManager,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:()=>this.resetSelectionNodes()},reset:"empty"},ready:{update:n=>this.animateReadyUpdate(n),resize:()=>this.resetSelectionNodes(),reset:"empty"}}),this.axisGroup.appendChild(this.title.caption.node);let s;this.destroyFns.push(e.layoutManager.addListener("layout:complete",n=>{const r=[n.chart.width,n.chart.height];s!=null&&!arraysEqual(r,s)&&this.animationState.transition("resize"),s=r}),this.title.caption.registerInteraction(this.moduleCtx,"afterend"))}static is(e){return e instanceof Ft}resetAnimation(e){e==="initial"&&this.animationState.transition("reset")}get direction(){return this.position==="top"||this.position==="bottom"?"x":"y"}createAxisContext(){return{...super.createAxisContext(),position:this.position}}createLabel(){return new CartesianAxisLabel}updateDirection(){switch(this.position){case"top":this.rotation=-90,this.label.mirrored=!0,this.label.parallel=!0;break;case"right":this.rotation=0,this.label.mirrored=!0,this.label.parallel=!1;break;case"bottom":this.rotation=-90,this.label.mirrored=!1,this.label.parallel=!0;break;case"left":this.rotation=0,this.label.mirrored=!1,this.label.parallel=!1;break}this.axisContext&&(this.axisContext.position=this.position,this.axisContext.direction=this.direction)}calculateLayout(e){return this.updateDirection(),super.calculateLayout(e)}calculateTickLayout(e,i,s,n){const r=this.label.getSideFlag(),{parallelFlipRotation:o,regularFlipRotation:a}=this.calculateRotations(),l=r*(this.getTickSize()+this.label.spacing+this.seriesAreaPadding),c=this.tickGenerator.generateTicks({domain:e,niceMode:i,visibleRange:s,primaryTickCount:n,parallelFlipRotation:o,regularFlipRotation:a,labelX:l,sideFlag:r}),{tickData:h,primaryTickCount:u=n}=c,{ticks:d,tickDomain:p,rawTicks:g,fractionDigits:m,niceDomain:y=e}=h,f=d.map(v=>this.getTickLabelProps(v,c)),x=this.tickBBox(d,f);return this.generatedTicks={ticks:d,labels:f},{ticks:g,tickDomain:p,niceDomain:y,primaryTickCount:u,fractionDigits:m,bbox:x}}update(){this.updateDirection();const e=Array.from(this.tickLabelGroupSelection.nodes(),r=>r.datum.tickId);if(super.update(),this.animatable||this.moduleCtx.animationManager.skipCurrentBatch(),this.generatedTicks){const{ticks:r}=this.generatedTicks;if(this.animationManager.isSkipped())this.resetSelectionNodes();else{const o=r.map(l=>l.tickId),a=diffArrays(e,o);this.animationState.transition("update",a)}}const{enabled:i,stroke:s,width:n}=this.line;this.lineNode.setProperties({stroke:s,strokeWidth:i?n:0}),this.updateTitle(!this.generatedTicks?.ticks.length)}updatePosition(){super.updatePosition(),this.axisGroup.datum=this.getAxisTransform()}tickBBox(e,i){const s=this.label.getSideFlag(),n=[],{x:r,y1:o,y2:a}=this.getAxisLineCoordinates(),l=new BBox(r+Math.min(s*this.seriesAreaPadding,0),o,this.seriesAreaPadding,a-o);if(n.push(l),this.tick.enabled)for(const u of e){const{x1:d,x2:p,y:g}=this.getTickLineCoordinates(u),m=new BBox(d,g,p-d,0);n.push(m)}const{tempText:c}=this;if(this.label.enabled)for(const u of i){if(!u.visible)continue;c.setProperties({...u,translationY:Math.round(u.translationY)});const d=c.getBBox();d&&n.push(d)}if(this.title?.enabled){const u=BBox.merge(n).width;this.setTitleProps(this.tempCaption,{spacing:u});const d=this.tempCaption.node.getBBox();d&&n.push(d)}const h=BBox.merge(n);return this.getTransformBox(h)}getTickLabelProps(e,i){const{combinedRotation:s,textBaseline:n,textAlign:r}=i,{range:o}=this.scale,a=e.tickLabel,c=this.label.getSideFlag()*(this.getTickSize()+this.label.spacing+this.seriesAreaPadding),h=a!==""&&a!=null;return{...this.getLabelStyles({value:e.tickLabel}),tickId:e.tickId,rotation:s,rotationCenterX:c,translationY:e.translationY,text:a,textAlign:r,textBaseline:n,visible:h,x:c,y:0,range:o}}getTickLineCoordinates(e){const s=this.label.getSideFlag()*this.getTickSize(),n=Math.min(0,s),r=n+Math.abs(s),o=e.translationY;return{x1:n,x2:r,y:o}}updateSelections(){if(!this.generatedTicks)return;const e=this.getAxisLineCoordinates(),{ticks:i,labels:s}=this.generatedTicks,n=r=>r.tickId;this.lineNode.datum=e,this.gridLineGroupSelection.update(this.gridLength?i:[],void 0,n),this.tickLineGroupSelection.update(i,void 0,n),this.tickLabelGroupSelection.update(s,void 0,n)}updateTitle(e,i){const{title:s,tickLineGroup:n,tickLabelGroup:r,lineNode:o}=this;s.enabled&&!e&&i==null&&(i=Group.computeChildrenBBox([n,r,o]).width+(r.visible?0:this.seriesAreaPadding)),i??(i=0),this.setTitleProps(s.caption,{spacing:i})}updateLabels(){this.label.enabled&&this.tickLabelGroupSelection.each((e,i)=>{e.fill=i.fill,e.fontFamily=i.fontFamily,e.fontSize=i.fontSize,e.fontStyle=i.fontStyle,e.fontWeight=i.fontWeight,e.text=i.text,e.textBaseline=i.textBaseline,e.textAlign=i.textAlign??"center"})}animateReadyUpdate(e){const{animationManager:i}=this.moduleCtx,s=prepareAxisAnimationContext(this),n=prepareAxisAnimationFunctions(s);fromToMotion(this.id,"axis-group",i,[this.axisGroup],n.group),fromToMotion(this.id,"line",i,[this.lineNode],n.line),fromToMotion(this.id,"line-paths",i,[this.gridLineGroupSelection,this.tickLineGroupSelection],n.tick,(r,o)=>o.tickId,e),fromToMotion(this.id,"tick-labels",i,[this.tickLabelGroupSelection],n.label,(r,o)=>o.tickId,e)}resetSelectionNodes(){const e=prepareAxisAnimationContext(this);resetMotion([this.axisGroup],resetAxisGroupFn()),resetMotion([this.gridLineGroupSelection,this.tickLineGroupSelection],resetAxisSelectionFn(e)),resetMotion([this.tickLabelGroupSelection],resetAxisLabelSelectionFn()),resetMotion([this.lineNode],resetAxisLineSelectionFn())}};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],_CartesianAxis.prototype,"thickness",2),__decorateClass([Validate(POSITION)],_CartesianAxis.prototype,"position",2);var CartesianAxis=_CartesianAxis,_CategoryAxis=class Bt extends CartesianAxis{constructor(e,i=new CategoryScale){super(e,i),this.groupPaddingInner=.1,this.includeInvisibleDomains=!0}static is(e){return e instanceof Bt}normaliseDataDomain(e){return{domain:e,clipped:!1}}updateScale(){super.updateScale();let{paddingInner:e,paddingOuter:i}=this;if(!isFiniteNumber(e)||!isFiniteNumber(i)){const s=this.reduceBandScalePadding();e??(e=s.inner),i??(i=s.outer)}this.scale.paddingInner=e??0,this.scale.paddingOuter=i??0}reduceBandScalePadding(){return this.boundSeries.reduce((e,i)=>{const s=i.getBandScalePadding?.();return s&&(e.inner>s.inner&&(e.inner=s.inner),e.outere.type===s.type&&("optionsKey"in e&&"optionsKey"in s?e.optionsKey===s.optionsKey:!0)&&e.identifier===s.identifier);if(i){if(e.packageType==="enterprise"&&i.packageType==="community"){const s=this.modules.indexOf(i);this.modules.splice(s,1,e),"optionsKey"in e&&this.modulesByOptionKey.set(e.optionsKey,e)}}else this.modules.push(e),"optionsKey"in e&&this.modulesByOptionKey.set(e.optionsKey,e)}}hasEnterpriseModules(){return this.modules.some(t=>t.packageType==="enterprise")}*byType(...t){const e=new Set,i=this.modules.filter(r=>t.includes(r.type)),s=r=>{const o=this.dependencies.get(r);return o?.flatMap(s).concat(o)??[]},n=[];for(const r of i){const o="optionsKey"in r?r.optionsKey:r.contextKey;if(!e.has(o)){for(const a of s(o)){if(e.has(a))continue;const l=this.modulesByOptionKey.get(a);if(!l){n.push(a);continue}t.includes(l.type)&&(yield l,e.add(a))}yield r,e.add(o)}}if(n.length>0)throw new Error(`Could not resolve module dependencies: ${n}`)}registerDependencies(t){if(t.dependencies==null||t.dependencies.length===0)return;const e="optionsKey"in t?t.optionsKey:t.contextKey;this.dependencies.set(e,t.dependencies)}},moduleRegistry=new ModuleRegistry2,AsyncAwaitQueue=class{constructor(){this.queue=[]}await(t=50){return new Promise(e=>{const i=()=>{clearTimeout(n),e(!0)},n=setTimeout(()=>{const r=this.queue.indexOf(i);r<0||(this.queue.splice(r,1),e(!1))},t);this.queue.push(i)})}notify(){this.queue.splice(0).forEach(t=>t())}};function pause(){return new Promise(t=>{setTimeout(t,0)})}function setElementBBox(t,e){t&&(e=BBoxValues.normalize(e),e.width==null?t.style.removeProperty("width"):t.style.width=`${e.width}px`,e.height==null?t.style.removeProperty("height"):t.style.height=`${e.height}px`,e.x==null?t.style.removeProperty("left"):t.style.left=`${e.x}px`,e.y==null?t.style.removeProperty("top"):t.style.top=`${e.y}px`)}function getElementBBox(t){const e=parseFloat(t.style.width)||t.offsetWidth,i=parseFloat(t.style.height)||t.offsetHeight,s=parseFloat(t.style.left)||t.offsetLeft,n=parseFloat(t.style.top)||t.offsetTop;return{x:s,y:n,width:e,height:i}}function focusCursorAtEnd(t){if(t.focus({preventScroll:!0}),t.lastChild?.textContent==null)return;const e=getDocument().createRange();e.setStart(t.lastChild,t.lastChild.textContent.length),e.setEnd(t.lastChild,t.lastChild.textContent.length);const i=getWindow().getSelection();i?.removeAllRanges(),i?.addRange(e)}var _id=0;function createElementId(t){return`${t??"ag-charts-element"}-${_id++}`}function isInputPending(){const t=getWindow("navigator");if("scheduling"in t){const e=t.scheduling;if("isInputPending"in e)return e.isInputPending({includeContinuous:!0})}return!1}function getIconClassNames(t){return`ag-charts-icon ag-charts-icon-${t}`}var CLASS_INSTANCE_TYPE="class-instance";function jsonDiff(t,e,i){if(isArray(e)){if(!isArray(t)||t.length!==e.length||e.some((s,n)=>jsonDiff(t[n],s)!=null))return e}else if(isPlainObject(e)){if(!isPlainObject(t))return e;const s={},n=new Set([...Object.keys(t),...Object.keys(e)]);for(const r of n)if(!(t[r]===e[r]||i?.includes(r)))if(typeof t[r]==typeof e[r]){const o=jsonDiff(t[r],e[r]);o!==null&&(s[r]=o)}else s[r]=e[r];return Object.keys(s).length?s:null}else if(t!==e)return e;return null}function jsonPropertyCompare(t,e){for(const i of Object.keys(t))if(t[i]!==e?.[i])return!1;return!0}function deepClone(t,e){return isArray(t)?t.map(i=>deepClone(i,e)):isPlainObject(t)?clonePlainObject(t,e):t instanceof Map?new Map(deepClone(Array.from(t))):shallowClone(t)}function clonePlainObject(t,e){const i={};for(const s of Object.keys(t))i[s]=e?.has(s)?shallowClone(t[s]):deepClone(t[s],e);return i}function shallowClone(t){return isArray(t)?t.slice(0):isPlainObject(t)?{...t}:isDate(t)?new Date(t):isRegExp(t)?new RegExp(t.source,t.flags):t}function jsonWalk(t,e,i,s,n,r){if(isArray(t)){r=e(t,s,n,r);let o=0;for(const a of t)r=jsonWalk(a,e,i,s?.[o],n,r),o++}else if(isPlainObject(t)){r=e(t,s,n,r);for(const o of Object.keys(t)){if(i?.has(o))continue;const a=t[o];r=jsonWalk(a,e,i,s?.[o],n,r)}}return r}function jsonApply(t,e,i={}){const{path:s,matcherPath:n=s?.replace(/(\[[0-9+]+])/i,"[]"),skip:r=[]}=i;if(t==null)throw new Error(`AG Charts - target is uninitialised: ${s??""}`);if(e==null)return t;if(isProperties(t))return t.set(e);const o=t,a=classify(t);for(const l of Object.keys(e)){if(SKIP_JS_BUILTINS.has(l))continue;const c=`${n?n+".":""}${l}`;if(r.includes(c))continue;const h=e[l],u=`${s?s+".":""}${l}`,d=o.constructor,p=o[l];try{const g=classify(p),m=classify(h);if(a===CLASS_INSTANCE_TYPE&&!(l in t)){if(h===void 0)continue;logger_exports.warn(`unable to set [${u}] in ${d?.name} - property is unknown`);continue}if(g!=null&&m!=null&&m!==g&&(g!==CLASS_INSTANCE_TYPE||m!=="object")){logger_exports.warn(`unable to set [${u}] in ${d?.name} - can't apply type of [${m}], allowed types are: [${g}]`);continue}if(isProperties(p))o[l].set(h);else if(m==="object"){if(p==null){logger_exports.warn(`unable to set [${u}] in ${d?.name} - property is unknown`);continue}jsonApply(p,h,{...i,path:u,matcherPath:c})}else o[l]=h}catch(g){logger_exports.warn(`unable to set [${u}] in [${d?.name}]; nested error is: ${g.message}`)}}return t}function classify(t){return t==null?null:isHtmlElement(t)||isDate(t)?"primitive":isArray(t)?"array":isObject(t)?isPlainObject(t)?"object":CLASS_INSTANCE_TYPE:isFunction(t)?"function":"primitive"}function jsonResolveOperations(t,e,i){return jsonResolveInner(t,e,t,i)}function jsonResolveInner(t,e,i,s,n=[],r={}){if(isArray(t)){jsonResolveVisitor(t,e,i,n,r);let o=0;for(const a of t)jsonResolveInner(a,e,i,s,[...n,`${o}`],r),o++}else if(isPlainObject(t)){jsonResolveVisitor(t,e,i,n,r);for(const o of Object.keys(t)){if(s?.has(o))continue;const a=t[o];jsonResolveInner(a,e,i,s,[...n,o],r)}}return r}function jsonResolveVisitor(t,e,i,s,n){if(isArray(t))for(let r=0;r(t.Ref="$ref",t.Path="$path",t.If="$if",t.Eq="$eq",t.Not="$not",t.Or="$or",t.And="$and",t.Mul="$mul",t.Round="$round",t.Rem="$rem",t.Mix="$mix",t.ForegroundBackgroundMix="$foregroundBackgroundMix",t.ForegroundBackgroundAccentMix="$foregroundBackgroundAccentMix",t))(Operation||{}),operationKeys=new Set(Object.values(Operation));function getOperation(t){if(!isPlainObject(t))return{};const[e,...i]=Object.keys(t);return i.length!==0||!operationKeys.has(e)?{}:{operation:e,values:t[e]}}function resolveOperation(t,e,i,s,n,r){return isArray(e)&&(e=e.map(o=>{const{operation:a,values:l}=getOperation(o);return a?resolveOperation(a,l,i,s,n,r):o})),operations[t](e,i,s,n,r)}function isRatio(t){return isNumber(t)&&t>=0&&t<=1}var operations={$ref:(t,e,i,s,n)=>{if(isString(t)&&t in e){const{operation:r,values:o}=getOperation(e[t]);if(r!=="$ref")return e[t];if(n?.has(o)){logger_exports.warnOnce(`\`$ref\` json operation failed on [${String(t)}] at [${s.join(".")}], circular reference detected with [${[...n].join(", ")}].`);return}return n?.add(o),operations.$ref(o,e,i,s,n)}logger_exports.warnOnce(`\`$ref\` json operation failed on [${String(t)}] at [${s.join(".")}], expecting one of [${Object.keys(e).join(", ")}].`)},$path:(t,e,i,s)=>{if(!isString(t)){logger_exports.warnOnce(`\`$path\` json operation failed on [${String(t)}] at [${s.join(".")}], expecting a string.`);return}const n=t.split("/"),r=[...s];for(const a of n)a===".."?(r.pop(),r.pop()):a==="."?r.pop():r.push(a);let o=i;for(const a of r){if(!(a in o)){logger_exports.warnOnce(`\`$path\` json operation failed on [${String(t)}] at [${s.join(".")}], could not find path in object.`);return}o=o[a]}return o},$if:([t,e,i])=>t?e:i,$eq:([t,e])=>t===e,$not:([t,e])=>t!==e,$or:([t,e])=>t||e,$and:([t,e])=>t&&e,$mul:([t,e],i,s,n)=>{if(typeof t=="number"&&typeof e=="number")return t*e;logger_exports.warnOnce(`\`$mul\` json operation failed on [${String(t)}] and [${String(e)}] at [${n.join(".")}], expecting two numbers.`)},$round:([t],e,i,s)=>{if(typeof t=="number")return Math.round(t);logger_exports.warnOnce(`\`$round\` json operation failed on [${String(t)}] at [${s.join(".")}], expecting a number.`)},$rem:([t],e)=>{if(typeof t=="number")return Math.round(t*e.fontSize)},$mix:([t,e,i],s,n,r)=>{if(typeof t=="string"&&typeof e=="string"&&isRatio(i))try{return Color.mix(Color.fromString(t),Color.fromString(e),i).toString()}catch{}logger_exports.warnOnce(`\`$mix\` json operation failed on [${String(t)}, ${String(e)}, ${String(i)}] at [${r.join(".")}], expecting two colors and a number between 0 and 1.`)},$foregroundBackgroundMix:([t],e,i,s)=>{if(isRatio(t))return Color.mix(Color.fromString(e.foregroundColor),Color.fromString(e.backgroundColor),t).toString();logger_exports.warnOnce(`\`$foregroundBackgroundMix\` json operation failed on [${String(t)}}}] at [${s.join(".")}], expecting a number between 0 and 1.`)},$foregroundBackgroundAccentMix:([t,e],i,s,n)=>{if(isRatio(t)&&isRatio(e))return Color.mix(Color.mix(Color.fromString(i.foregroundColor),Color.fromString(i.backgroundColor),t),Color.fromString(i.accentColor),e).toString();logger_exports.warnOnce(`\`$foregroundBackgroundAccentMix\` json operation failed on [${String(t)}, ${String(e)}}] at [${n.join(".")}], expecting two numbers between 0 and 1.`)}},Mutex=class{constructor(){this.available=!0,this.acquireQueue=[]}acquire(t){return new Promise(e=>{this.acquireQueue.push([t,e]),this.available&&this.dispatchNext().catch(i=>logger_exports.errorOnce(i))})}async acquireImmediately(t){return this.available?(await this.acquire(t),!0):!1}async waitForClearAcquireQueue(){return this.acquire(()=>Promise.resolve(void 0))}async dispatchNext(){this.available=!1;let[t,e]=this.acquireQueue.shift()??[];for(;t;){try{await t(),e?.()}catch(i){logger_exports.error("mutex callback error",i),e?.()}[t,e]=this.acquireQueue.shift()??[]}this.available=!0}},Observable=class{constructor(){this.eventListeners=new Map}addEventListener(t,e){if(typeof e!="function")throw new Error("AG Charts - listener must be a Function");const i=this.eventListeners.get(t);i?i.add(e):this.eventListeners.set(t,new Set([e]))}removeEventListener(t,e){this.eventListeners.get(t)?.delete(e),this.eventListeners.size===0&&this.eventListeners.delete(t)}hasEventListener(t){return this.eventListeners.has(t)}clearEventListeners(){this.eventListeners.clear()}fireEvent(t){this.eventListeners.get(t.type)?.forEach(e=>e(t))}},Padding=class extends BaseProperties{constructor(t=0,e=t,i=t,s=e){super(),this.top=t,this.right=e,this.bottom=i,this.left=s}};__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"top",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"right",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"bottom",2),__decorateClass([Validate(POSITIVE_NUMBER)],Padding.prototype,"left",2);function debouncedAnimationFrame(t){return buildScheduler((e,i)=>getWindow().requestAnimationFrame(e),t)}function debouncedCallback(t){return buildScheduler((e,i=0)=>{i===0?queueMicrotask(e):setTimeout(e,i)},t)}function buildScheduler(t,e){let i=0,s=!1,n,r;const o=()=>s,a=()=>{s=!1,r?.(),r=void 0,n=void 0,i>0&&t(l)},l=()=>{const c=i;i=0,s=!0;const h=e({count:c});if(!h){a();return}h.then(a,a)};return{schedule(c){i===0&&!o()&&t(l,c),i++},async await(){if(o())for(n==null&&(n=new Promise(c=>{r=c}));o();)await n}}}function booleanParser(t){return t==="true"}function numberParser(t){return Number(t)}function stringParser(t){return t}var AttributeTypeParsers={role:stringParser,"aria-checked":booleanParser,"aria-controls":stringParser,"aria-describedby":stringParser,"aria-disabled":booleanParser,"aria-expanded":booleanParser,"aria-haspopup":booleanParser,"aria-hidden":booleanParser,"aria-label":stringParser,"aria-labelledby":stringParser,"aria-live":stringParser,"aria-orientation":stringParser,"aria-selected":booleanParser,"data-preventdefault":booleanParser,class:stringParser,id:stringParser,tabindex:numberParser,title:stringParser,placeholder:stringParser};function setAttribute(t,e,i){i==null||i===""||i===""?t?.removeAttribute(e):t?.setAttribute(e,i.toString())}function setAttributes(t,e){if(e!=null)for(const[i,s]of Object.entries(e))i!=="class"&&setAttribute(t,i,s)}function getAttribute(t,e,i){if(!(t instanceof HTMLElement))return;const s=t.getAttribute(e);return s===null?i:AttributeTypeParsers[e]?.(s)??void 0}function setElementStyle(t,e,i){t!=null&&(i==null?t.style.removeProperty(e):t.style.setProperty(e,i.toString()))}function setElementStyles(t,e){for(const[i,s]of Object.entries(e))setElementStyle(t,i,s)}var WIDGET_HTML_EVENTS=["blur","change","contextmenu","focus","keydown","keyup","click","dblclick","mouseenter","mousemove","mouseleave","wheel","touchstart","touchmove","touchend","touchcancel"];function allocMouseEvent(t,e,i){const{offsetX:s,offsetY:n,clientX:r,clientY:o}=e,{currentX:a,currentY:l}=WidgetEventUtil.calcCurrentXY(i,e);return{type:t,offsetX:s,offsetY:n,clientX:r,clientY:o,currentX:a,currentY:l,sourceEvent:e}}function allocTouchEvent(t,e,i){return{type:t,sourceEvent:e}}var WidgetAllocators={blur:t=>({type:"blur",sourceEvent:t}),change:t=>({type:"change",sourceEvent:t}),contextmenu:(t,e)=>allocMouseEvent("contextmenu",t,e),focus:t=>({type:"focus",sourceEvent:t}),keydown:t=>({type:"keydown",sourceEvent:t}),keyup:t=>({type:"keyup",sourceEvent:t}),click:(t,e)=>allocMouseEvent("click",t,e),dblclick:(t,e)=>allocMouseEvent("dblclick",t,e),mouseenter:(t,e)=>allocMouseEvent("mouseenter",t,e),mousemove:(t,e)=>allocMouseEvent("mousemove",t,e),mouseleave:(t,e)=>allocMouseEvent("mouseleave",t,e),wheel:t=>{const{offsetX:e,offsetY:i,clientX:s,clientY:n}=t,r=t.deltaMode===0?.01:1,o=t.deltaX*r,a=t.deltaY*r;return{type:"wheel",offsetX:e,offsetY:i,clientX:s,clientY:n,deltaX:o,deltaY:a,sourceEvent:t}},touchstart:(t,e)=>allocTouchEvent("touchstart",t,e),touchmove:(t,e)=>allocTouchEvent("touchmove",t,e),touchend:(t,e)=>allocTouchEvent("touchend",t,e),touchcancel:(t,e)=>allocTouchEvent("touchcancel",t,e)},WidgetEventUtil=class{static alloc(t,e,i){return WidgetAllocators[t](e,i)}static isHTMLEvent(t){return WIDGET_HTML_EVENTS.includes(t)}static calcCurrentXY(t,e){const i=t.getBoundingClientRect();return{currentX:e.clientX-i.x,currentY:e.clientY-i.y}}},WidgetListenerHTML=class{constructor(){this.widgetListeners={},this.sourceListeners={}}initSourceHandler(t,e){this.sourceListeners??(this.sourceListeners={}),this.sourceListeners[t]=e}lazyGetWidgetListeners(t,e){var i;if(!(t in(this.sourceListeners??{}))){const s=r=>{const o=WidgetEventUtil.alloc(t,r,e.getElement());for(const a of this.widgetListeners?.[t]??[])a(o,e)},n={};t.startsWith("touch")&&(n.passive=!1),this.initSourceHandler(t,s),e.getElement().addEventListener(t,s,n)}return this.widgetListeners??(this.widgetListeners={}),(i=this.widgetListeners)[t]??(i[t]=[]),this.widgetListeners[t]}add(t,e,i){this.lazyGetWidgetListeners(t,e).push(i)}remove(t,e,i){const s=this.lazyGetWidgetListeners(t,e),n=s.indexOf(i);n>-1&&s.splice(n,1)}destroy(t){for(const[e,i]of Object.entries(this.sourceListeners??{})){const s=e;t.getElement().removeEventListener(s,i)}this.widgetListeners=void 0,this.sourceListeners=void 0}},MouseDragger=class{constructor(t,e,i,s){this.glob=t,this.self=e,this.window=getWindow(),this.mousegeneral=l=>{l.stopPropagation(),l.stopImmediatePropagation()},this.mousemove=l=>{l.stopPropagation(),l.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mousemove(l)},this.mouseup=l=>{l.button===0&&(l.stopPropagation(),l.stopImmediatePropagation(),this.glob.globalMouseDragCallbacks?.mouseup(l),this.destroy())};const{window:n,mousegeneral:r,mousemove:o,mouseup:a}=this;n.addEventListener("mousedown",r,{capture:!0}),n.addEventListener("mouseenter",r,{capture:!0}),n.addEventListener("mouseleave",r,{capture:!0}),n.addEventListener("mouseout",r,{capture:!0}),n.addEventListener("mouseover",r,{capture:!0}),n.addEventListener("mousemove",o,{capture:!0}),n.addEventListener("mouseup",a,{capture:!0}),e.mouseDragger=this,t.globalMouseDragCallbacks=i,t.globalMouseDragCallbacks.mousedown(s)}destroy(){const{window:t,mousegeneral:e,mousemove:i,mouseup:s}=this;t.removeEventListener("mousedown",e,{capture:!0}),t.removeEventListener("mouseenter",e,{capture:!0}),t.removeEventListener("mouseleave",e,{capture:!0}),t.removeEventListener("mouseout",e,{capture:!0}),t.removeEventListener("mouseover",e,{capture:!0}),t.removeEventListener("mousemove",i,{capture:!0}),t.removeEventListener("mouseup",s,{capture:!0}),this.glob.globalMouseDragCallbacks=void 0,this.self.mouseDragger=void 0}};function startMouseDrag(t,e,i,s){if(t.globalMouseDragCallbacks==null)return new MouseDragger(t,e,i,s)}var LONG_TAP_DURATION_MS=500,LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX=100;function deltaClientSquared(t,e){const i=t.clientX-e.clientX,s=t.clientY-e.clientY;return i*i+s*s}var gIsInLongTap=!1,TouchDragger=class{constructor(t,e,i,s,n){this.glob=t,this.self=e,this.initialTouch=s,this.target=n,this.longTapInterrupted=!1,this.longtap=()=>{const{target:a,initialTouch:l}=this;if(!this.longTapInterrupted){a.dispatchEvent(new TouchEvent("touchcancel",{touches:[l],bubbles:!0})),gIsInLongTap=!0;const c=g=>{g.preventDefault()},h=g=>{gIsInLongTap=!1,g.preventDefault(),a.removeEventListener("touchmove",c),a.removeEventListener("touchend",h),a.removeEventListener("touchcancel",h)};a.addEventListener("touchmove",c,{passive:!1}),a.addEventListener("touchend",h,{passive:!1}),a.addEventListener("touchcancel",h,{passive:!1});const{clientX:u,clientY:d}=l,p=new PointerEvent("contextmenu",{bubbles:!0,cancelable:!0,view:getWindow(),clientX:u,clientY:d,pointerType:"touch"});a.dispatchEvent(p)}},this.touchmove=a=>{const{glob:l,self:c,initialTouch:h}=this,u=this.findInitialFinger(a.targetTouches);u!=null&&(this.longTapInterrupted=this.longTapInterrupted||deltaClientSquared(h,u)>LONG_TAP_INTERRUPT_MIN_TOUCHMOVE_PXPX,c.dragTouchEnabled&&u!=null&&l.globalTouchDragCallbacks?.touchmove(a,u))},this.touchend=a=>{this.longTapInterrupted=!0;const l=this.findInitialFinger(a.changedTouches,a.touches);l!=null&&this.glob.globalTouchDragCallbacks?.touchend(a,l),this.destroy()},this.longtapTimer=setTimeout(this.longtap,LONG_TAP_DURATION_MS);const{touchmove:r,touchend:o}=this;n.addEventListener("touchmove",r,{passive:!1}),n.addEventListener("touchstart",o,{passive:!1}),n.addEventListener("touchend",o,{passive:!1}),n.addEventListener("touchcancel",o,{passive:!1}),e.touchDragger=this,t.globalTouchDragCallbacks=i}destroy(){const{longtapTimer:t,touchmove:e,touchend:i}=this;clearTimeout(t),this.target.removeEventListener("touchstart",i),this.target.removeEventListener("touchmove",e),this.target.removeEventListener("touchend",i),this.target.removeEventListener("touchcancel",i),this.glob.globalTouchDragCallbacks=void 0,this.self.touchDragger=void 0}findInitialFinger(...t){const e=t.map(i=>Array.from(i)).flat();return Array.from(e).find(i=>i.identifier===this.initialTouch.identifier)}};function startOneFingerTouch(t,e,i,s,n){if(!(t.globalTouchDragCallbacks!=null||gIsInLongTap))return new TouchDragger(t,e,i,s,n)}function makeMouseDrag(t,e,i,s){const{currentX:n,currentY:r}=WidgetEventUtil.calcCurrentXY(t.getElement(),s),o=s.pageX-i.pageX,a=s.pageY-i.pageY;return{type:e,device:"mouse",offsetX:i.offsetX+o,offsetY:i.offsetY+a,clientX:s.clientX,clientY:s.clientY,currentX:n,currentY:r,originDeltaX:o,originDeltaY:a,sourceEvent:s}}function getTouchOffsets(t,{pageX:e,pageY:i}){const{x:s,y:n}=t.getElement().getBoundingClientRect();return{offsetX:e-s,offsetY:i-n}}function makeTouchDrag(t,e,i,s,n){const{currentX:r,currentY:o}=WidgetEventUtil.calcCurrentXY(t.getElement(),n),a=n.pageX-i.pageX,l=n.pageY-i.pageY;return{type:e,device:"touch",offsetX:i.offsetX+a,offsetY:i.offsetY+l,clientX:n.clientX,clientY:n.clientY,currentX:r,currentY:o,originDeltaX:a,originDeltaY:l,sourceEvent:s}}var GlobalCallbacks={},WidgetListenerInternal=class{constructor(t){this.dispatchCallback=t,this.dragTouchEnabled=!0}destroy(){this.dragTriggerRemover?.(),this.dragTriggerRemover=void 0,this.dragStartListeners=void 0,this.dragMoveListeners=void 0,this.dragEndListeners=void 0,this.mouseDragger?.destroy(),this.touchDragger?.destroy()}add(t,e,i){switch(t){case"drag-start":{this.dragStartListeners??(this.dragStartListeners=[]),this.dragStartListeners.push(i),this.registerDragTrigger(e);break}case"drag-move":{this.dragMoveListeners??(this.dragMoveListeners=[]),this.dragMoveListeners.push(i),this.registerDragTrigger(e);break}case"drag-end":{this.dragEndListeners??(this.dragEndListeners=[]),this.dragEndListeners.push(i),this.registerDragTrigger(e);break}}}remove(t,e,i){switch(t){case"drag-start":return this.removeHandler(this.dragStartListeners,i);case"drag-move":return this.removeHandler(this.dragMoveListeners,i);case"drag-end":return this.removeHandler(this.dragEndListeners,i)}}removeHandler(t,e){const i=t?.indexOf(e);i!==void 0&&t?.splice(i,1)}registerDragTrigger(t){if(this.dragTriggerRemover==null){const e=s=>this.triggerMouseDrag(t,s),i=s=>this.triggerTouchDrag(t,s);t.getElement().addEventListener("mousedown",e),t.getElement().addEventListener("touchstart",i,{passive:!1}),this.dragTriggerRemover=()=>{t.getElement().removeEventListener("mousedown",e),t.getElement().removeEventListener("touchstart",i)}}}triggerMouseDrag(t,e){e.button===0&&this.startMouseDrag(t,e)}startMouseDrag(t,e){const i={pageX:NaN,pageY:NaN,offsetX:NaN,offsetY:NaN};partialAssign(["pageX","pageY","offsetX","offsetY"],i,e);const s={mousedown:n=>{const r=makeMouseDrag(t,"drag-start",i,n);this.dispatch("drag-start",t,r)},mousemove:n=>{const r=makeMouseDrag(t,"drag-move",i,n);this.dispatch("drag-move",t,r)},mouseup:n=>{const r=makeMouseDrag(t,"drag-end",i,n);this.dispatch("drag-end",t,r),this.endDrag(t,r)}};this.mouseDragger=startMouseDrag(GlobalCallbacks,this,s,e)}endDrag(t,{sourceEvent:e,clientX:i,clientY:s}){const n=t.getElement(),r=n.getBoundingClientRect();BBoxValues.containsPoint(r,i,s)||(n.dispatchEvent(new MouseEvent("mouseleave",e)),e.target?.dispatchEvent(new MouseEvent("mouseenter",e)))}triggerTouchDrag(t,e){const i=e.targetTouches.item(0);e.targetTouches.length===1&&i!=null&&this.startOneFingerTouch(t,e,i)}startOneFingerTouch(t,e,i){const s={pageX:NaN,pageY:NaN,...getTouchOffsets(t,i)};partialAssign(["pageX","pageY"],s,i);const n={touchmove:(a,l)=>{const c=makeTouchDrag(t,"drag-move",s,a,l);this.dispatch("drag-move",t,c)},touchend:(a,l)=>{const c=makeTouchDrag(t,"drag-end",s,a,l);this.dispatch("drag-end",t,c)}},r=t.getElement();this.touchDragger=startOneFingerTouch(GlobalCallbacks,this,n,i,r);const o=makeTouchDrag(t,"drag-start",s,e,i);this.dispatch("drag-start",t,o)}dispatch(t,e,i){switch(t){case"drag-start":this.dragStartListeners?.forEach(s=>s(i,e));break;case"drag-move":this.dragMoveListeners?.forEach(s=>s(i,e));break;case"drag-end":this.dragEndListeners?.forEach(s=>s(i,e));break}this.dispatchCallback(t,i)}},WidgetBounds=class{constructor(t){this.elem=t}setBounds(t){setElementBBox(this.elemContainer??this.elem,t)}getBounds(){return getElementBBox(this.elemContainer??this.elem)}static setElementContainer(t,e){const i=t.getBounds();setElementBBox(e,i),setElementStyles(t.elem,{width:"100%",height:"100%"}),t.elem.remove(),t.elemContainer=e,t.elemContainer.replaceChildren(t.elem)}},Widget=class extends WidgetBounds{constructor(t){super(t),this.elem=t,this.index=NaN,this.children=[]}getElement(){return this.elem}getBoundingClientRect(){return this.elem.getBoundingClientRect()}get clientWidth(){return this.elem.clientWidth}get clientHeight(){return this.elem.clientHeight}destroy(){this.parent?.removeChild(this),this.children.forEach(t=>{t.parent=void 0,t.destroy()}),this.children.length=0,this.destructor(),this.elem.remove(),this.elemContainer?.remove(),this.internalListener?.destroy(),this.htmlListener?.destroy(this)}setHidden(t){setElementStyle(this.elem,"display",t?"none":void 0)}isHidden(){return getWindow()?.getComputedStyle?.(this.elem).display==="none"}setCursor(t){setElementStyle(this.elem,"cursor",t)}setTextContent(t){this.elem.textContent=t??null}setAriaDescribedBy(t){setAttribute(this.elem,"aria-describedby",t)}setAriaHidden(t){setAttribute(this.elem,"aria-hidden",t)}setAriaLabel(t){setAttribute(this.elem,"aria-label",t)}setInnerHTML(t){this.elem.innerHTML=t}isDisabled(){return getAttribute(this.elem,"aria-disabled",!1)}parseFloat(t){return t===""?0:parseFloat(t)}cssLeft(){return this.parseFloat(this.elem.style.left)}cssTop(){return this.parseFloat(this.elem.style.top)}cssWidth(){return this.parseFloat(this.elem.style.width)}cssHeight(){return this.parseFloat(this.elem.style.height)}focus(){this.elem.focus()}setPreventsDefault(t){setAttribute(this.elem,"data-preventdefault",t)}setTabIndex(t){setAttribute(this.elem,"tabindex",t)}addChild(t){this.addChildToDOM(t,this.getBefore(t)),this.children.push(t),t.index=this.children.length-1,t.parent=this,this.onChildAdded(t)}removeChild(t){const e=this.children.findIndex(i=>i===t);this.children.splice(e,1),this.removeChildFromDOM(t),this.onChildRemoved(t)}moveChild(t,e){t.domIndex!==e&&(t.domIndex=e,this.removeChildFromDOM(t),this.addChildToDOM(t,this.getBefore(t)))}addClass(...t){this.elem.classList.add(...t)}removeClass(...t){this.elem.classList.remove(...t)}toggleClass(t,e){this.elem.classList.toggle(t,e)}appendOrInsert(t,e){e?e.getElement().insertAdjacentElement("beforebegin",t):this.elem.appendChild(t)}addChildToDOM(t,e){this.appendOrInsert(t.getElement(),e)}removeChildFromDOM(t){this.elem.removeChild(t.getElement())}onChildAdded(t){}onChildRemoved(t){}getBefore({domIndex:t}){if(t!==void 0)return this.children.filter(e=>e.domIndex!==void 0&&e.domIndex>t).reduce((e,i)=>!e||i.domIndexthis.removeListener(t,e)}removeListener(t,e){WidgetEventUtil.isHTMLEvent(t)?this.htmlListener?.remove(t,this,e):this.htmlListener!=null&&this.internalListener?.remove(t,this,e)}setDragTouchEnabled(t){this.internalListener??(this.internalListener=new WidgetListenerInternal(this.onDispatch.bind(this))),this.internalListener.dragTouchEnabled=t}onDispatch(t,e){if(!e.sourceEvent.bubbles)return;let{parent:i}=this;for(;i!=null;){const{internalListener:s}=i;if(s!=null){const n={...e,...WidgetEventUtil.calcCurrentXY(i.getElement(),e)};s.dispatch(t,i,n)}i=i.parent}}static addWindowEvent(t,e){const i=s=>{s.persisted||e()};return getWindow().addEventListener("pagehide",i),()=>getWindow().removeEventListener("pagehide",i)}},LayoutElement=(t=>(t[t.Caption=0]="Caption",t[t.Legend=1]="Legend",t[t.ToolbarLeft=2]="ToolbarLeft",t[t.ToolbarBottom=3]="ToolbarBottom",t[t.Navigator=4]="Navigator",t[t.Overlay=5]="Overlay",t))(LayoutElement||{}),LayoutManager=class{constructor(){this.events=new EventEmitter,this.elements=new Map}addListener(t,e){return this.events.on(t,e)}registerElement(t,e){return this.elements.has(t)?this.elements.get(t).add(e):this.elements.set(t,new Set([e])),()=>this.elements.get(t)?.delete(e)}createContext(t,e){const i=new LayoutContext(t,e);for(const s of Object.values(LayoutElement))typeof s=="number"&&this.elements.get(s)?.forEach(n=>n(i));return i}emitLayoutComplete(t,e){const i="layout:complete",{width:s,height:n}=t;this.events.emit(i,{type:i,axes:e.axes??[],chart:{width:s,height:n},clipSeries:e.clipSeries??!1,series:e.series})}},LayoutContext=class{constructor(t,e){this.width=t,this.height=e,this.layoutBox=new BBox(0,0,t,e)}},ChartCaptions=class{constructor(){this.title=new Caption,this.subtitle=new Caption,this.footnote=new Caption}positionCaptions(t){const{title:e,subtitle:i,footnote:s}=this,n=t.layoutBox.height/10;if(e.enabled){const{spacing:r=i.enabled?Caption.SMALL_PADDING:Caption.LARGE_PADDING}=e;this.positionCaption("top",e,t.layoutBox,n),this.shrinkLayoutByCaption("top",e,t.layoutBox,r)}i.enabled&&(this.positionCaption("top",i,t.layoutBox,n),this.shrinkLayoutByCaption("top",i,t.layoutBox,i.spacing)),s.enabled&&(this.positionCaption("bottom",s,t.layoutBox,n),this.shrinkLayoutByCaption("bottom",s,t.layoutBox,s.spacing))}positionAbsoluteCaptions(t){const{title:e,subtitle:i,footnote:s}=this,{rect:n}=t.series;for(const r of[e,i,s])if(r.layoutStyle==="overlay"){if(r.textAlign==="left")r.node.x=n.x+r.padding;else if(r.textAlign==="right"){const o=r.node.getBBox();r.node.x=n.x+n.width-o.width-r.padding}}}computeX(t,e){return t==="left"?e.x:t==="right"?e.x+e.width:e.x+e.width/2}positionCaption(t,e,i,s){const n=Math.max(TextUtils.getLineHeight(e.fontSize),s);e.node.x=this.computeX(e.textAlign,i)+e.padding,e.node.y=i.y+(t==="top"?0:i.height)+e.padding,e.node.textBaseline=t,e.computeTextWrap(i.width,n)}shrinkLayoutByCaption(t,e,i,s=0){if(e.layoutStyle==="block"){const n=e.node.getBBox();i.shrink(Math.ceil(t==="top"?n.y-i.y+n.height+s:i.y+i.height-n.y+s),t)}}};__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"title",2),__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"subtitle",2),__decorateClass([Validate(OBJECT)],ChartCaptions.prototype,"footnote",2);var chartTypes=["candlestick","hollow-candlestick","ohlc","line","step-line","hlc","high-low"],ChartTypeOriginator=class{constructor(t){this.chartService=t,this.mementoOriginatorKey="chartType"}createMemento(){let t=this.chartService.publicApi?.getOptions()?.chartType;return t==null&&(t="candlestick"),t}guardMemento(t){return t==null||chartTypes.includes(t)}restoreMemento(t,e,i){if(i==null)return;const s={chartType:i};this.chartService.publicApi?.updateDelta(s).catch(n=>logger_exports.error("error restoring state",n))}},DestroyFns=class{constructor(){this.destroyFns=[]}destroy(){this.destroyFns.forEach(t=>t()),this.destroyFns.length=0}setFns(t){this.destroy(),this.destroyFns=t}push(...t){this.destroyFns.push(...t)}},VERSION="11.1.1",NOT_FOUND=Symbol("previous-memento-not-found"),HistoryManager=class{constructor(t){this.history=[],this.historyIndex=-1,this.originators=new Map,this.clearState=new Map,this.maxHistoryLength=100,this.debug=Debug.create(!0,"history"),this.destroyFns=new DestroyFns,this.destroyFns.setFns([t.addListener("series-undo",this.undo.bind(this)),t.addListener("series-redo",this.redo.bind(this))])}destroy(){this.destroyFns.destroy()}addMementoOriginator(t){this.originators.set(t.mementoOriginatorKey,t),this.clearState.set(t.mementoOriginatorKey,t.createMemento()),this.debugEvent("History add originator:",t.mementoOriginatorKey)}clear(){this.debug("History clear:",Object.keys(this.originators)),this.history=[],this.historyIndex=-1;for(const[t,e]of this.originators.entries())this.clearState.set(t,e.createMemento())}record(t,...e){this.historyIndexthis.maxHistoryLength&&(this.history=this.history.slice(-this.maxHistoryLength));const i=new Map;for(const s of e){if(!this.originators.has(s.mementoOriginatorKey))throw new Error(`Originator [${s.mementoOriginatorKey}] has not been added to the HistoryManager.`);i.set(s.mementoOriginatorKey,s.createMemento())}this.history.push({label:t,mementos:i}),this.historyIndex=this.history.length-1,this.debugEvent(`History record: [${t}]`)}undo(){const t=this.history[this.historyIndex];if(t){for(const e of t.mementos.keys()){const i=this.findPreviousMemento(e);if(i===NOT_FOUND)throw new Error(`Could not find previous memento for [${e}].`);this.restoreMemento(e,i)}this.historyIndex-=1,this.debugEvent(`History undo: [${t.label}]`)}}redo(){const t=this.history[this.historyIndex+1];if(t){for(const[e,i]of t.mementos.entries())this.restoreMemento(e,i);this.historyIndex+=1,this.debugEvent(`History redo: [${t.label}]`)}}findPreviousMemento(t){for(let e=this.historyIndex-1;e>=0;e--)if(this.history[e].mementos.has(t))return this.history[e].mementos.get(t);return this.clearState.has(t)?this.clearState.get(t):NOT_FOUND}restoreMemento(t,e){this.originators.get(t)?.restoreMemento(VERSION,VERSION,e)}debugEvent(...t){this.debug(...t,this.history.map((e,i)=>i===this.historyIndex?`** ${e.label} **`:e.label))}},MementoCaretaker=class Lt{constructor(e){this.version=e.split("-")[0]}save(...e){const i={version:this.version};for(const s of Object.values(e))i[s.mementoOriginatorKey]=this.encode(s,s.createMemento());return i}restore(e,...i){if(typeof e!="object"){logger_exports.warnOnce(`Could not restore data of type [${typeof e}], expecting an object, ignoring.`);return}if(e==null){logger_exports.warnOnce("Could not restore data of type [null], expecting an object, ignoring.");return}if(!("version"in e)||typeof e.version!="string"){logger_exports.warnOnce("Could not restore data, missing [version] string in object, ignoring.");return}for(const s of i){const n=this.decode(s,e[s.mementoOriginatorKey]),r=[];if(!s.guardMemento(n,r)){const o=r.length>0?` ${r.join(` `)} `:"";logger_exports.warnOnce(`Could not restore [${s.mementoOriginatorKey}] data, value was invalid, ignoring.${o}`,n);return}s.restoreMemento(this.version,e.version,n)}}encode(e,i){try{return JSON.parse(JSON.stringify(i,Lt.encodeTypes))}catch(s){throw new Error(`Failed to encode [${e.mementoOriginatorKey}] value [${s}].`,{cause:s})}}decode(e,i){if(i==null)return i;try{return JSON.parse(JSON.stringify(i),Lt.decodeTypes)}catch(s){throw new Error(`Failed to decode [${e.mementoOriginatorKey}] value [${s}].`,{cause:s})}}static encodeTypes(e,i){return isDate(this[e])?{__type:"date",value:this[e].toISOString()}:i}static decodeTypes(e,i){return isObject(this[e])&&"__type"in this[e]&&this[e].__type==="date"?new Date(this[e].value):i}},StateManager=class{constructor(){this.caretaker=new MementoCaretaker(VERSION),this.state=new Map}setState(t,e){objectsEqual(this.state.get(t.mementoOriginatorKey),e)||this.setStateAndRestore(t,e)}setStateAndRestore(t,e){this.state.set(t.mementoOriginatorKey,e),this.restoreState(t)}restoreState(t){const{caretaker:e,state:i}=this;if(!i.has(t.mementoOriginatorKey))return;const s=i.get(t.mementoOriginatorKey);e.restore({version:e.version,[t.mementoOriginatorKey]:s},t)}},styles_default=`.ag-charts-wrapper,.ag-charts-wrapper:after,.ag-charts-wrapper:before,.ag-charts-wrapper *,.ag-charts-wrapper *:after,.ag-charts-wrapper *:before{box-sizing:border-box}.ag-charts-wrapper{--align-items: center;--justify-content: center;position:relative;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ag-charts-wrapper--safe-horizontal{--justify-content: flex-start}.ag-charts-wrapper--safe-vertical{--align-items: flex-start}.ag-charts-tab-guard{width:0%;height:0%;position:absolute;pointer-events:none}.ag-charts-canvas-center{width:100%;height:100%;position:absolute;touch-action:auto;pointer-events:auto;display:flex;align-items:var(--align-items);justify-content:var(--justify-content)}.ag-charts-canvas-container,.ag-charts-canvas{position:relative;user-select:none;-webkit-user-select:none}.ag-charts-canvas-container>*,.ag-charts-canvas>*{display:block;pointer-events:none}.ag-charts-series-area{outline:none;pointer-events:auto;position:absolute}.ag-charts-swapchain{outline:none;opacity:0;pointer-events:none;position:absolute;width:100%;height:100%}.ag-charts-swapchain:focus-visible{opacity:1}.ag-charts-canvas-proxy,.ag-charts-canvas-overlay{inset:0;pointer-events:none;position:absolute;user-select:none;-webkit-user-select:none}.ag-charts-canvas-overlay>*{position:absolute;pointer-events:auto}.ag-charts-theme-default,.ag-charts-theme-default-dark{--ag-charts-accent-color: #2196f3;--ag-charts-background-color: #fff;--ag-charts-border-color: #dddddd;--ag-charts-foreground-color: #464646;--ag-charts-font-family: Verdana, sans-serif;--ag-charts-font-size: 12px;--ag-charts-font-weight: 400;--ag-charts-padding: 20px;--ag-charts-shadow-color: #00000080;--ag-charts-subtle-text-color: #8c8c8c;--ag-charts-text-color: #464646;--ag-charts-chrome-background-color: #fafafa;--ag-charts-chrome-font-family: Verdana, sans-serif;--ag-charts-chrome-font-size: 12px;--ag-charts-chrome-font-weight: 400;--ag-charts-chrome-subtle-text-color: #8c8c8c;--ag-charts-chrome-text-color: #181d1f;--ag-charts-input-background-color: #fff;--ag-charts-input-text-color: #464646;--ag-charts-crosshair-label-background-color: #fff;--ag-charts-crosshair-label-text-color: #464646;--ag-charts-spacing: 4px;--ag-charts-border-radius: 4px;--ag-charts-shadow: 0 2px 8px 0 color-mix(in srgb, black 8%, transparent);--ag-charts-focus-shadow: 0 0 0 3px var(--ag-charts-accent-color);--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 12%);--ag-charts-input-border-color: var(--ag-charts-border-color);--ag-charts-input-border-radius: var(--ag-charts-border-radius);--ag-charts-input-focus-border-color: var(--ag-charts-accent-color);--ag-charts-input-focus-text-color: var(--ag-charts-accent-color);--ag-charts-input-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-input-disabled-border-color: var(--ag-charts-border-color);--ag-charts-input-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-input-text-color) 50% );--ag-charts-input-placeholder-text-color: color-mix( in srgb, var(--ag-charts-input-background-color), var(--ag-charts-input-text-color) 60% );--ag-charts-button-background-color: var(--ag-charts-background-color);--ag-charts-button-border-color: var(--ag-charts-border-color);--ag-charts-button-border-radius: var(--ag-charts-border-radius);--ag-charts-button-text-color: var(--ag-charts-text-color);--ag-charts-button-focus-background-color: color-mix( in srgb, var(--ag-charts-button-background-color), var(--ag-charts-accent-color) 12% );--ag-charts-button-focus-border-color: var(--ag-charts-accent-color);--ag-charts-button-focus-text-color: var(--ag-charts-accent-color);--ag-charts-button-disabled-background-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-foreground-color) 6% );--ag-charts-button-disabled-border-color: var(--ag-charts-border-color);--ag-charts-button-disabled-text-color: color-mix( in srgb, var(--ag-charts-chrome-background-color), var(--ag-charts-chrome-text-color) 50% );--ag-charts-checkbox-background-color: color-mix( in srgb, var(--ag-charts-background-color), var(--ag-charts-foreground-color) 35% );--ag-charts-checkbox-checked-background-color: var(--ag-charts-accent-color);--ag-charts-chrome-font-size-small: var(--ag-charts-chrome-font-size);--ag-charts-chrome-font-size-medium: calc(var(--ag-charts-chrome-font-size) * (13 / 12));--ag-charts-chrome-font-size-large: calc(var(--ag-charts-chrome-font-size) * (14 / 12));--ag-charts-border: solid 1px var(--ag-charts-border-color);--ag-charts-focus-border: solid 1px var(--ag-charts-accent-color);--ag-charts-focus-border-shadow: 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%);--ag-charts-layer-menu: 6;--ag-charts-layer-ui-overlay: 5;--ag-charts-layer-tooltip: 4;--ag-charts-layer-toolbar: 3;--ag-charts-layer-crosshair: 2;--ag-charts-layer-annotations: 1}.ag-charts-theme-default-dark{--ag-charts-shadow: 0 2px 12px 0 color-mix(in srgb, black 33.3%, transparent);--ag-charts-focus-color: color-mix(in srgb, var(--ag-charts-background-color), var(--ag-charts-accent-color) 22%)}.ag-chart-canvas-wrapper .ag-charts-theme-default{--ag-charts-border-radius: var(--ag-border-radius, 4px);--ag-charts-border: var(--ag-borders-critical, solid 1px) var(--ag-charts-border-color);--ag-charts-focus-shadow: var(--ag-focus-shadow, 0 0 0 3px var(--ag-charts-accent-color));--ag-charts-focus-border-shadow: var( --ag-focus-shadow, 0 0 0 3px color-mix(in srgb, transparent, var(--ag-charts-accent-color) 20%) )}.ag-charts-icon{display:block;width:20px;height:20px;speak:none;speak:never;mask:var(--icon) center / contain no-repeat;background-color:currentColor;transition:background-color .25s ease-in-out}.ag-charts-icon-align-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNyAxMGg2djFIN3pNNCA3aDEydjFINHptMSA2aDEwdjFINXoiLz48L3N2Zz4=)}.ag-charts-icon-align-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNNCAxMGg2djFINHptMC0zaDEydjFINHptMCA2aDEwdjFINHoiLz48L3N2Zz4=)}.ag-charts-icon-align-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTAgMTBoNnYxaC02ek00IDdoMTJ2MUg0em0yIDZoMTB2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-arrow-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1LjI5MyA0LjVIMTIuNXYtMUgxN3Y0aC0xVjUuMjA3bC05LjY0NiA5LjY0Ny0uNzA4LS43MDh6IiBmaWxsPSIjMDAwIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDE2YTIuNSAyLjUgMCAxIDEtNSAwIDIuNSAyLjUgMCAwIDEgNSAwbS0yLjUgMS41YTEuNSAxLjUgMCAxIDAgMC0zIDEuNSAxLjUgMCAwIDAgMCAzIiBmaWxsPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-arrow-down-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02IDhMMS41IDhMMTAgMThMMTguNSA4TDE0IDhMMTQgM0w2IDNMNiA4Wk03IDRMNyA5SDMuNjYyNDRMMTAgMTYuNDU2TDE2LjMzNzYgOUwxMyA5TDEzIDRMNyA0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-arrow-up-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNCAxMkgxOC41TDEwIDJMMS41IDEySDZMNi4wMDAwMiAxN0gxNFYxMlpNMTMgMTZWMTFIMTYuMzM3NkwxMCAzLjU0NDA1TDMuNjYyNDQgMTFIN0w3LjAwMDAyIDE2SDEzWiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-callout-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtNC41MTRhMjYgMjYgMCAwIDAtMi4wMTcgMS41NGwtLjMxNC4yNmMtLjU1LjQ1Ny0xLjExNS45MjYtMS43NiAxLjQtLjY2OS40OTEtMS41NjItLjAxMi0xLjU2Mi0uOFYxNEg0LjVBMS41IDEuNSAwIDAgMSAzIDEyLjV6TTQuNSA0YS41LjUgMCAwIDAtLjUuNXY4YS41LjUgMCAwIDAgLjUuNWgxLjgzM3YzLjM3MmEzNiAzNiAwIDAgMCAxLjY3OC0xLjMzOGwuMzItLjI2NWEyNiAyNiAwIDAgMSAyLjIyNS0xLjY4NWwuMTI2LS4wODRIMTUuNWEuNS41IDAgMCAwIC41LS41di04YS41LjUgMCAwIDAtLjUtLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyAxdjNoMnYxMkg3djNINnYtM0g0VjRoMlYxek01IDVoM3YxMEg1ek0xMSAxNFY2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6bTEtN2gzdjZoLTN6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-close{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNSA1IDEwIDEwTTUgMTUgMTUgNSIgc3Ryb2tlPSIjMDAwIi8+PC9zdmc+)}.ag-charts-icon-comment-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy41MTMgMy45OTVhNi41IDYuNSAwIDAgMSA2LjA5OCAxMS40MWMtLjU4OC4zOTMtMS4yMTcuNTM2LTEuODI5LjU4NWExMyAxMyAwIDAgMS0xLjI3LjAxN0EyNyAyNyAwIDAgMCAxMCAxNkg0LjVhLjUuNSAwIDAgMS0uNS0uNVYxMHEwLS4yNDctLjAwNy0uNTEzYy0uMDA4LS40MTYtLjAxNi0uODU3LjAxNy0xLjI2OS4wNS0uNjEyLjE5Mi0xLjI0LjU4NS0xLjgzYTYuNSA2LjUgMCAwIDEgMi45MTgtMi4zOTNtMy41Ni42MWE1LjUgNS41IDAgMCAwLTUuNjQ2IDIuMzRjLS4yNjYuMzk3LS4zNzkuODQyLS40MiAxLjM1NC0uMDMuMzYtLjAyMi43MTgtLjAxNSAxLjEwOFE1IDkuNjg5IDUgMTB2NWg1cS4zMTEuMDAxLjU5My4wMDhjLjM5LjAwNy43NDcuMDE1IDEuMTA4LS4wMTUuNTEyLS4wNDEuOTU3LS4xNTQgMS4zNTUtLjQyYTUuNSA1LjUgMCAwIDAtMS45ODMtOS45NjciIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-crosshair-add-line{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-date-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMiAyaDF2MTZIMnptMTUgMGgxdjE2aC0xeiIgZmlsbD0iIzE4MUQxRiIvPjxwYXRoIGQ9Ik0xMy4xNTcgMTFINXYtMWg3Ljc5M0wxMSA4LjIwN2wuNzA3LS43MDcgMy4xODIgMy4xODItMy4xODIgMy4xODItLjcwNy0uNzA3eiIgZmlsbD0iIzAwMCIvPjwvc3ZnPg==)}.ag-charts-icon-date-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMyAySDJ2MTZoMXptMy41MDcgNC44OUw4LjUgNC44OTVWMTBINXYxaDMuNXY3aDF2LTdoNS4wODhsLTEuOTU3IDEuOTU3LjcwNy43MDcgMy4xODItMy4xODJMMTMuMzM4IDcuM2wtLjcwNy43MDdMMTQuNjI0IDEwSDkuNVY0LjkzMmwxLjk1NyAxLjk1Ny43MDctLjcwN0w4Ljk4MiAzIDUuOCA2LjE4MnoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-delete{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTguNDk2IDguOTk2QS41LjUgMCAwIDEgOSA5LjQ5MnY0YS41LjUgMCAxIDEtMSAuMDA4di00YS41LjUgMCAwIDEgLjQ5Ni0uNTA0TTEyIDkuNWEuNS41IDAgMCAwLTEgMHY0YS41LjUgMCAwIDAgMSAweiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTYgNVYzLjVBMi41IDIuNSAwIDAgMSA4LjUgMWgzQTIuNSAyLjUgMCAwIDEgMTQgMy41VjVoMi44MzNhLjUuNSAwIDAgMSAwIDFIMTV2MTAuMjVjMCAuNDE1LS4wNjYuODYzLS4zIDEuMjIxLS4yNTcuMzk0LS42NzIuNjEyLTEuMi42MTJoLTdjLS41MjggMC0uOTQzLS4yMTgtMS4yLS42MTItLjIzNC0uMzU4LS4zLS44MDYtLjMtMS4yMjFWNkgzLjMzM2EuNS41IDAgMCAxIDAtMXptMS0xLjVBMS41IDEuNSAwIDAgMSA4LjUgMmgzQTEuNSAxLjUgMCAwIDEgMTMgMy41VjVIN3pNNiAxNi4yNVY2aDh2MTAuMjVjMCAuMzM1LS4wNTkuNTU0LS4xMzguNjc1LS4wNTUuMDg1LS4xNC4xNTgtLjM2Mi4xNThoLTdjLS4yMjIgMC0uMzA3LS4wNzMtLjM2Mi0uMTU4LS4wOC0uMTIxLS4xMzgtLjM0LS4xMzgtLjY3NSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-disjoint-channel,.ag-charts-icon-disjoint-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTkuMDI4IDE3LjQ2YTIuMjUgMi4yNSAwIDAgMC00LjA5Mi0xLjg1bC05LjUxMS0yLjM3OGEyLjI1IDIuMjUgMCAxIDAtLjIyNS45NzRsOS40NzUgMi4zNjlhMi4yNTEgMi4yNTEgMCAwIDAgNC4zNTMuODg2bS0xLjY2Mi0xLjk2NWExLjI1IDEuMjUgMCAxIDEtLjg4NSAyLjMzOCAxLjI1IDEuMjUgMCAwIDEgLjg4NS0yLjMzOE00LjM0MyAxMy42NjlhMS4yNSAxLjI1IDAgMSAwLTIuMzM4LS44ODUgMS4yNSAxLjI1IDAgMCAwIDIuMzM4Ljg4NU0zLjk3IDguNzY5YTIuMjUgMi4yNSAwIDAgMCAxLjQ1NS0yLjExbDkuNTExLTIuMzc4YTIuMjUgMi4yNSAwIDEgMC0uMjYtLjk2NUw1LjIgNS42ODVhMi4yNSAyLjI1IDAgMSAwLTEuMjMgMy4wODRtLjM3My0yLjU0N2ExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjc1LTMuNDM4YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-drag-handle{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjcuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjxjaXJjbGUgY3g9IjEzLjc1IiBjeT0iNy43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iMTMuNzUiIGN5PSIxMS43NSIgcj0iLjc1IiBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjExLjc1IiByPSIuNzUiIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjUiLz48Y2lyY2xlIGN4PSI1Ljc1IiBjeT0iMTEuNzUiIHI9Ii43NSIgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuNSIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA1aDEydjFIMnoiLz48Y2lyY2xlIGN4PSIxNS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4yNSIgY3k9IjE0LjUiIHI9IjEuNzUiIHN0cm9rZT0iIzAwMCIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik0xOCAxNUg2di0xaDEyem0wLTQuNUgydi0xaDE2eiIvPjwvc3ZnPg==)}.ag-charts-icon-fibonacci-retracement-trend-based-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJtNC45OTYgMTIuNjc0IDMuMjkxLTUuNzQzLjg2OC40OTctMy4yOTEgNS43NDN6Ii8+PGNpcmNsZSBjeD0iOS43NSIgY3k9IjUuNSIgcj0iMS43NSIgc3Ryb2tlPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC4zNTEiIGN5PSIxNC41IiByPSIxLjc1IiBzdHJva2U9IiMwMDAiLz48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTggNmgtN1Y1aDd6bTAgNC41aC03di0xaDd6bTAgNC41SDZ2LTFoMTJ6Ii8+PC9zdmc+)}.ag-charts-icon-fill-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtOC4wNzEgNC4wNi0uOTI0LS45MjQuNzA3LS43MDcgNy4yODggNy4yODgtNC45NSA0Ljk1YTMuNSAzLjUgMCAwIDEtNC45NSAwbC0xLjQxNC0xLjQxNGEzLjUgMy41IDAgMCAxIDAtNC45NXptLjcwNy43MDhMNC41MzYgOS4wMWEyLjUgMi41IDAgMCAwIDAgMy41MzZMNS45NSAxMy45NmEyLjUgMi41IDAgMCAwIDMuNTM1IDBsNC4yNDMtNC4yNDN6bTYuOSA3LjIwMi0uMzQ1LjM2My0uMzQ0LS4zNjNhLjUuNSAwIDAgMSAuNjg4IDBtLS4zNDUgMS4wOGE4IDggMCAwIDAtLjI4LjMyMyA0LjMgNC4zIDAgMCAwLS40MDkuNTgyYy0uMTEzLjIwMS0uMTQ0LjMyNi0uMTQ0LjM3OGEuODMzLjgzMyAwIDAgMCAxLjY2NyAwYzAtLjA1Mi0uMDMxLS4xNzctLjE0NC0uMzc4YTQuMyA0LjMgMCAwIDAtLjQxLS41ODIgOCA4IDAgMCAwLS4yOC0uMzIybS0uMzQ0LTEuMDguMzQ0LjM2My4zNDQtLjM2My4wMDIuMDAyLjAwNC4wMDQuMDEzLjAxMmE2IDYgMCAwIDEgLjIwNi4yMDhjLjEzMS4xMzYuMzA4LjMyNy40ODUuNTQ1LjE3Ni4yMTUuMzYzLjQ2Ny41MDcuNzI0LjEzNy4yNDMuMjczLjU1My4yNzMuODY4YTEuODMzIDEuODMzIDAgMSAxLTMuNjY3IDBjMC0uMzE1LjEzNi0uNjI1LjI3My0uODY4LjE0NC0uMjU3LjMzLS41MDkuNTA3LS43MjRhOSA5IDAgMCAxIC42NDUtLjcwOGwuMDQ2LS4wNDUuMDEzLS4wMTIuMDA0LS4wMDR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-hollow-candlestick-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1vcGFjaXR5PSIuMTUiIGQ9Ik01IDVoM3YxMEg1eiIvPjxwYXRoIGZpbGw9IiMxMzE3MjIiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTcgMXYzaDJ2MTJIN3YzSDZ2LTNINFY0aDJWMXpNNSA1aDN2MTBINXptNyAyaDN2NmgtM3ptLTEgN1Y2aDJWMy4yNWgxVjZoMnY4aC0ydjIuNzVoLTFWMTR6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-horizontal-line,.ag-charts-icon-horizontal-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNLjUgOS41aDcuMzA2YTIuMjUgMi4yNSAwIDAgMSA0LjM4OCAwSDE5LjV2MWgtNy4zMDZhMi4yNSAyLjI1IDAgMCAxLTQuMzg4IDBILjV6bTkuNSAxLjc1YTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-line-color{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTQuMjQyIDIuNzIyYy0uNjEyIDAtMS4yLjI0My0xLjYzMi42NzVsLTEuMzQzIDEuMzQ0YS41LjUgMCAwIDAtLjExMi4xMTJMNC4wNSAxMS45NTljLS4yMDcuMjA3LS4zNi40Ni0uNDQ2Ljc0di4wMDFsLS42OSAyLjc2N3YuMDAyYS44Mi44MiAwIDAgMCAxLjAyMiAxLjAyMWguMDAybDIuNjM0LS44MjJjLjI4LS4wODUuNTM0LS4yMzcuNzQtLjQ0M2w3LjEwNy03LjEwOGEuNS41IDAgMCAwIC4xMTItLjExMmwxLjM0My0xLjM0M2EyLjMwOCAyLjMwOCAwIDAgMC0xLjYzMi0zLjk0TTE0LjEyMiA3bDEuMDQ0LTEuMDQ1YTEuMzA4IDEuMzA4IDAgMSAwLTEuODQ5LTEuODVMMTIuMjcxIDUuMTV6bS0yLjU1OC0xLjE0Mi02LjgwNyA2LjgwOWEuOC44IDAgMCAwLS4xOTYuMzI1bC0uNzUgMi40NjggMi40Ny0uNzQ5YS44LjggMCAwIDAgLjMyNS0uMTk0bDYuODA4LTYuODF6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTcuMzYyIDQuODczLTQuNTk0IDYuNjU0LTQuODUtMy4zMTctNC4yNTEgNi45NzctLjg1NC0uNTJMNy42MTIgNi43OWw0Ljg5OSAzLjM1IDQuMDI4LTUuODM2eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-line-style-dashed{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDR2MUgyem0xMiAwaDR2MWgtNHpNOCA5aDR2MUg4eiIvPjwvc3ZnPg==)}.ag-charts-icon-line-style-dotted{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIyLjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iNC41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSI4LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTAuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48Y2lyY2xlIGN4PSIxMi41IiBjeT0iOS41IiByPSIuNSIgZmlsbD0iIzAwMCIvPjxjaXJjbGUgY3g9IjE0LjUiIGN5PSI5LjUiIHI9Ii41IiBmaWxsPSIjMDAwIi8+PGNpcmNsZSBjeD0iMTYuNSIgY3k9IjkuNSIgcj0iLjUiIGZpbGw9IiMwMDAiLz48L3N2Zz4=)}.ag-charts-icon-line-style-solid{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMiA5aDE2djFIMnoiLz48L3N2Zz4=)}.ag-charts-icon-line-with-markers-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTk4IDQuODg4LTMuNTU2IDQuOTE4YTIuMjUgMi4yNSAwIDEgMS0zLjg2Ni43NWwtMS40MzItLjlhMi4yNCAyLjI0IDAgMCAxLTIuMDA5LjQzNWwtMy44MjggNi40MjgtLjg2LS41MTJMNi40NSA5LjYyM2EyLjI1IDIuMjUgMCAxIDEgMy41MS0uNzYxbDEuMzI5LjgzNWEyLjI0IDIuMjQgMCAwIDEgMi41NTctLjQ5N2wzLjU0Mi00Ljg5OHptLTQuOTYgNS4xNTNhMS4yNSAxLjI1IDAgMSAwLS42NCAyLjQxOSAxLjI1IDEuMjUgMCAwIDAgLjY0LTIuNDE5TTkuMSA4LjMyMXEuMDY2LS4xOTIuMDY3LS40MDRhMS4yNSAxLjI1IDAgMSAwLS4wNjcuNDA0IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-lock,.ag-charts-icon-locked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuMjA3IDMuNzY0YTIuODk0IDIuODk0IDAgMCAwLTIuODk1IDIuODk0VjloNS43ODlWNi42NThhMi44OTQgMi44OTQgMCAwIDAtMi44OTUtMi44OTRNMTQuMSA5VjYuNjU4YTMuODk0IDMuODk0IDAgMSAwLTcuNzg5IDB2Mi4zNDlBMi41IDIuNSAwIDAgMCA0IDExLjV2M0EyLjUgMi41IDAgMCAwIDYuNSAxN2g4YTIuNSAyLjUgMCAwIDAgMi41LTIuNXYtM0EyLjUgMi41IDAgMCAwIDE0LjUgOXpNNi41IDEwQTEuNSAxLjUgMCAwIDAgNSAxMS41djNBMS41IDEuNSAwIDAgMCA2LjUgMTZoOGExLjUgMS41IDAgMCAwIDEuNS0xLjV2LTNhMS41IDEuNSAwIDAgMC0xLjUtMS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-measurer-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibTQuNDYxIDEyLjcxIDEuNTMyLTEuNTMxIDEuNDE0IDEuNDE0LjcwNy0uNzA3TDYuNyAxMC40NzJsMS41MzItMS41MzMgMiAyIC43MDctLjcwNy0yLTIgNi4wMS02LjAxIDIuODMgMi44MjhMNS4wNSAxNy43NzggMi4yMjIgMTQuOTVsMS41MzItMS41MzIgMS40MTQgMS40MTQuNzA3LS43MDd6TS44MDggMTQuOTVsLjcwNy0uNzA3TDE0LjI0MyAxLjUxNWwuNzA3LS43MDcuNzA3LjcwNyAyLjgyOCAyLjgyOC43MDcuNzA3LS43MDcuNzA3TDUuNzU3IDE4LjQ4NWwtLjcwNy43MDctLjcwNy0uNzA3LTIuODI4LTIuODI4em0xMS4wNzgtNi44MzVMMTAuNDcgNi43bC43MDctLjcwNyAxLjQxNSAxLjQxNHptLjgyNC0zLjY1NCAxIDEgLjcwOC0uNzA3LTEtMXoiIGZpbGw9IiMxODFEMUYiLz48L3N2Zz4=)}.ag-charts-icon-note-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMyA0LjVBMS41IDEuNSAwIDAgMSA0LjUgM2gxMUExLjUgMS41IDAgMCAxIDE3IDQuNXY4YTEuNSAxLjUgMCAwIDEtMS41IDEuNWgtMy4yMWwtMS40NjkgMi41N2ExIDEgMCAwIDEtMS42ODIuMDg1TDcuMjQzIDE0SDQuNUExLjUgMS41IDAgMCAxIDMgMTIuNXpNNC41IDRhLjUuNSAwIDAgMC0uNS41djhhLjUuNSAwIDAgMCAuNS41aDMuMjU3bDIuMTk2IDMuMDc0TDExLjcxIDEzaDMuNzlhLjUuNSAwIDAgMCAuNS0uNXYtOGEuNS41IDAgMCAwLS41LS41eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi41IDYuNUEuNS41IDAgMCAxIDcgNmg2YS41LjUgMCAwIDEgMCAxSDdhLjUuNSAwIDAgMS0uNS0uNU02LjUgOS41QS41LjUgMCAwIDEgNyA5aDZhLjUuNSAwIDAgMSAwIDFIN2EuNS41IDAgMCAxLS41LS41IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-ohlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZD0iTTEzIDExaC0zdi0xaDNWM2gxdjJoNHYxaC00djExaC0xek02IDE3di0yaDN2LTFINlY0SDV2MUgydjFoM3YxMXoiLz48L3N2Zz4=)}.ag-charts-icon-pan-end{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0ibTYuNjQ2IDEzLjgxMy0uMzUzLjM1NC43MDcuNzA3LjM1NC0uMzU0ek0xMS4xNjYgMTBsLjM1NC4zNTQuMzU0LS4zNTQtLjM1NC0uMzU0ek03LjM1NSA1LjQ4IDcgNS4xMjZsLS43MDcuNzA3LjM1My4zNTR6bTAgOS4wNCA0LjE2Ni00LjE2Ni0uNzA3LS43MDgtNC4xNjcgNC4xNjd6bTQuMTY2LTQuODc0TDcuMzU0IDUuNDhsLS43MDguNzA3IDQuMTY3IDQuMTY3ek0xMy4wODMgNXYxMGgxVjV6Ii8+PC9zdmc+)}.ag-charts-icon-pan-left{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuNzkgNS44MzMgOC42MjUgMTBsNC4xNjYgNC4xNjctLjcwNy43MDdMNy4yMSAxMGw0Ljg3My00Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-right{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNy4yMSAxNC4xNjcgMTEuMzc2IDEwIDcuMjEgNS44MzNsLjcwNy0uNzA3TDEyLjc5IDEwbC00Ljg3MyA0Ljg3NHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-pan-start{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgNXYxMGgxVjV6TTkuNjI0IDEwbDQuMTY2LTQuMTY3LS43MDctLjcwN0w4LjIxIDEwbDQuODc0IDQuODc0LjcwNy0uNzA3eiIvPjwvc3ZnPg==)}.ag-charts-icon-parallel-channel,.ag-charts-icon-parallel-channel-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTcuNzIgNS4zMzFBMi4yNSAyLjI1IDAgMSAwIDE0LjcwNSAzLjZsLTkuNDkgNC41NjJhMi4yNSAyLjI1IDAgMSAwIC4yMDkgMS4wMWw5LjY2Mi00LjY0NmEyLjI1IDIuMjUgMCAwIDAgMi42MzQuODA1bS4zNzMtMi41NDdhMS4yNSAxLjI1IDAgMSAxLTIuMzM4Ljg4NSAxLjI1IDEuMjUgMCAwIDEgMi4zMzgtLjg4NU00LjM0MyA4LjY3YTEuMjUgMS4yNSAwIDEgMS0yLjMzOC44ODUgMS4yNSAxLjI1IDAgMCAxIDIuMzM4LS44ODVNNS4zMDcgMTYuNzI4YTIuMjUgMi4yNSAwIDEgMS0uNTI1LS44NThsOS45MjMtNC43N2EyLjI1IDIuMjUgMCAxIDEgLjM4MS45MjZ6bS0uOTY0LjI3NGExLjI1IDEuMjUgMCAxIDEtMi4zMzguODg1IDEuMjUgMS4yNSAwIDAgMSAyLjMzOC0uODg1bTEzLjAyMy01LjEwNmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-position-bottom{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzem0zLTNoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTYgMTNoOHYxSDZ6Ii8+PC9zdmc+)}.ag-charts-icon-position-center{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMyAxMGgxNHYxSDN6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDdoOHYxSDZ6bTAgNmg4djFINnoiLz48L3N2Zz4=)}.ag-charts-icon-position-top{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDAwIiBmaWxsLW9wYWNpdHk9Ii4yNSIgZD0iTTMgMTBoMTR2MUgzeiIvPjxwYXRoIGZpbGw9IiMwMDAiIGQ9Ik02IDdoOHYxSDZ6Ii8+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIuMjUiIGQ9Ik02IDEzaDh2MUg2eiIvPjwvc3ZnPg==)}.ag-charts-icon-price-label-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNC41IDNBMS41IDEuNSAwIDAgMCAzIDQuNVYxM2ExLjUgMS41IDAgMCAwIDEuNSAxLjVoLjgzM3YuMDU3Yy4yNDItLjI5OS41OTctLjUwMyAxLS41NDhWMTMuNUg0LjVBLjUuNSAwIDAgMSA0IDEzVjQuNWEuNS41IDAgMCAxIC41LS41aDExYS41LjUgMCAwIDEgLjUuNXY4YS41LjUgMCAwIDEtLjUuNWgtNC44MThsLS4xMjYuMDg0YTI2IDI2IDAgMCAwLTIuMjI1IDEuNjg1bC0uMzIuMjY1LS4wNjguMDU2YTEuNSAxLjUgMCAwIDEtMi42MDkgMS4zNTRjLjAzMy43NjMuOTA1IDEuMjM4IDEuNTYuNzU2LjY0Ni0uNDc0IDEuMjEtLjk0MyAxLjc2MS0xLjRsLjMxMy0uMjZBMjYgMjYgMCAwIDEgMTAuOTg2IDE0SDE1LjVhMS41IDEuNSAwIDAgMCAxLjUtMS41di04QTEuNSAxLjUgMCAwIDAgMTUuNSAzeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC43MTYgMTQuODE1YTIuMjUgMi4yNSAwIDEgMS00LjIxIDEuNTkzIDIuMjUgMi4yNSAwIDAgMSA0LjIxLTEuNTkzbS0xLjY2MiAxLjk2NmExLjI1IDEuMjUgMCAxIDAtLjg4NS0yLjMzOSAxLjI1IDEuMjUgMCAwIDAgLjg4NSAyLjMzOSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-price-range-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS4wNDYgMTVWNS44NzdoLjk0MlYxNXoiIGZpbGw9IiMxODFEMUYiLz48cGF0aCBkPSJNOS41IDYuMjI4IDcuMTY3IDguMzc2IDYuNSA3Ljc2MiA5LjUgNWwzIDIuNzYyLS42NjcuNjE0eiIgZmlsbD0iIzAwMCIvPjxwYXRoIGQ9Ik0yIDE4di0xaDE2djF6TTIgM1YyaDE2djF6IiBmaWxsPSIjMTgxRDFGIi8+PC9zdmc+)}.ag-charts-icon-reset{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTIuMDQgNC40NDVhNS44MSA1LjgxIDAgMCAwLTcuMjU3IDIuNDUzLjUuNSAwIDAgMS0uODY1LS41MDJBNi44MSA2LjgxIDAgMSAxIDMgOS44MTNhLjUuNSAwIDAgMSAxIDAgNS44MSA1LjgxIDAgMSAwIDguMDQtNS4zNjgiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTQuMjg5IDMuMDAyYS41LjUgMCAwIDEgLjUuNXYyLjY1NWgyLjY1NWEuNS41IDAgMCAxIDAgMUg0LjI5YS41LjUgMCAwIDEtLjUtLjVWMy41MDJhLjUuNSAwIDAgMSAuNS0uNSIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+)}.ag-charts-icon-settings{--icon: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkIj48cGF0aCBkPSJNMTAgMTNhMyAzIDAgMSAwIDAtNiAzIDMgMCAwIDAgMCA2bTAtMWEyIDIgMCAxIDEtLjAwMS0zLjk5OUEyIDIgMCAwIDEgMTAgMTIiLz48cGF0aCBkPSJNMi4zMSAxNC4zNDVjLS44MTctMS40OTEuMDI3LTIuNDk5LjQ3NC0yLjg2NS41MzEtLjQzNC45NjktLjM2NS45NzItMS40OC0uMDAzLTEuMTE1LS40NDEtMS4wNDYtLjk3Mi0xLjQ4MS0uNDU0LS4zNzEtMS4zMTctMS40MDUtLjQzNC0yLjkzNmwuMDA1LS4wMDljLjg4NC0xLjUyIDIuMjA3LTEuMjkgMi43NTUtMS4wODMuNjQxLjI0My44MDEuNjU2IDEuNzY4LjEwMS45NjQtLjU2LjY4Ni0uOTA0Ljc5Ni0xLjU4Mi4wOTQtLjU3OC41NTktMS44NDMgMi4zMjYtMS44NDNoLjAxYzEuNzU5LjAwNSAyLjIyMiAxLjI2NiAyLjMxNiAxLjg0My4xMS42NzgtLjE2OCAxLjAyMi43OTYgMS41ODIuOTY3LjU1NSAxLjEyNy4xNDIgMS43NjgtLjEwMS41NDktLjIwOCAxLjg3Ni0uNDM4IDIuNzYgMS4wOTJzLjAyIDIuNTY1LS40MzQgMi45MzZjLS41MzEuNDM1LS45NjkuMzY2LS45NzIgMS40ODEuMDAzIDEuMTE1LjQ0MSAxLjA0Ni45NzIgMS40OC40NTQuMzcyIDEuMzE3IDEuNDA2LjQzNCAyLjkzN2wtLjAwNS4wMDljLS44ODQgMS41Mi0yLjIwNyAxLjI5LTIuNzU1IDEuMDgzLS42NDEtLjI0My0uODAxLS42NTYtMS43NjgtLjEwMS0uOTY0LjU2LS42ODYuOTA0LS43OTYgMS41ODEtLjA5NC41NzktLjU1OSAxLjg0NC0yLjMyNiAxLjg0NGgtLjAxYy0xLjc1OS0uMDA1LTIuMjIyLTEuMjY2LTIuMzE2LTEuODQ0LS4xMS0uNjc3LjE2OC0xLjAyMS0uNzk2LTEuNTgxLS45NjctLjU1NS0xLjEyNy0uMTQyLTEuNzY4LjEwMS0uNTQ5LjIwOC0xLjg3Ni40MzgtMi43Ni0xLjA5MmwtLjAyLS4wMzZ6TTkuOTg0IDIuMTYySDEwYzEuMzU1IDAgMS4zNDIgMS4wMzkgMS4zNTMgMS40MjUuMDA4LjMxMi4wNCAxLjE2IDEuMjU5IDEuODcybC4wMTUuMDA4YzEuMjI1LjcgMS45NzYuMzA0IDIuMjUxLjE1NS4zMzctLjE4MyAxLjIyNi0uNzExIDEuOTAyLjQ0NWwuMDA4LjAxNGMuNjc4IDEuMTczLS4yMjkgMS42ODItLjU1OCAxLjg4NC0uMjY2LjE2My0uOTg0LjYxNS0uOTkxIDIuMDI3di4wMTZjLjAwNyAxLjQxMi43MjUgMS44NjQuOTkxIDIuMDI3LjMyOC4yMDEgMS4yMjkuNzA3LjU2NiAxLjg3bC0uMDA4LjAxNGMtLjY3NyAxLjE3NC0xLjU3MS42NDMtMS45MS40NTktLjI3NS0uMTQ5LTEuMDI2LS41NDUtMi4yNTEuMTU0bC0uMDE1LjAwOWMtMS4yMTkuNzEyLTEuMjUxIDEuNTYtMS4yNTkgMS44NzItLjAxMS4zODYuMDAyIDEuNDI1LTEuMzUzIDEuNDI1cy0xLjM0Mi0xLjAzOS0xLjM1My0xLjQyNWMtLjAwOC0uMzEyLS4wNC0xLjE2LTEuMjU5LTEuODcybC0uMDE1LS4wMDljLTEuMjI1LS42OTktMS45NzYtLjMwMy0yLjI1MS0uMTU0LS4zMzYuMTgzLTEuMjE5LjcwNi0xLjg5NC0uNDMybC0uMDE2LS4wMjdjLS42NzgtMS4xNzQuMjI5LTEuNjgyLjU1OC0xLjg4NC4yNjYtLjE2My45ODQtLjYxNS45OTEtMi4wMjd2LS4wMTZjLS4wMDctMS40MTItLjcyNS0xLjg2NC0uOTkxLTIuMDI3LS4zMjgtLjIwMS0xLjIyOS0uNzA3LS41NjYtMS44N2wuMDA4LS4wMTRjLjY3Ny0xLjE3NCAxLjU3MS0uNjQzIDEuOTEtLjQ1OS4yNzUuMTQ5IDEuMDI2LjU0NSAyLjI1MS0uMTU1bC4wMTUtLjAwOGMxLjIxOS0uNzEyIDEuMjUxLTEuNTYgMS4yNTktMS44NzIuMDEtLjM4NC0uMDAyLTEuNDE3IDEuMzM3LTEuNDI1Ii8+PC9zdmc+)}.ag-charts-icon-step-line-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzE4MUQxRiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNiA0aDV2OGgzVjhoNXYxaC00djRoLTVWNUg3djEwSDJ2LTFoNHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-text-annotation{--icon: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00IDRIMTZWN0gxNVY1SDEwLjVWMTVIMTRWMTZINlYxNUg5LjVWNUg1VjdINFY0WiIgZmlsbD0iYmxhY2siLz4KPC9zdmc+Cg==)}.ag-charts-icon-trend-line,.ag-charts-icon-trend-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS4zMTQgMTAuOTM4YTIuMjUgMi4yNSAwIDEgMSAuMDEtMWg5LjM1MmEyLjI1IDIuMjUgMCAxIDEgLjAxIDF6bS0yLjE4OS43MjlhMS4yNSAxLjI1IDAgMSAwIDAtMi41IDEuMjUgMS4yNSAwIDAgMCAwIDIuNW0xMy43NSAwYTEuMjUgMS4yNSAwIDEgMCAwLTIuNSAxLjI1IDEuMjUgMCAwIDAgMCAyLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-unlock,.ag-charts-icon-unlocked{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNjUxIDMuNWEyLjg5NCAyLjg5NCAwIDAgMC0yLjg5NCAyLjg5NFY5SDE0LjVhMi41IDIuNSAwIDAgMSAyLjUgMi41djNhMi41IDIuNSAwIDAgMS0yLjUgMi41aC04QTIuNSAyLjUgMCAwIDEgNCAxNC41di0zQTIuNSAyLjUgMCAwIDEgNi41IDloLjI1N1Y2LjM5NGEzLjg5NCAzLjg5NCAwIDEgMSA3Ljc4OSAwIC41LjUgMCAwIDEtMSAwQTIuODk0IDIuODk0IDAgMCAwIDEwLjY1IDMuNU02LjUgMTBBMS41IDEuNSAwIDAgMCA1IDExLjV2M0ExLjUgMS41IDAgMCAwIDYuNSAxNmg4YTEuNSAxLjUgMCAwIDAgMS41LTEuNXYtM2ExLjUgMS41IDAgMCAwLTEuNS0xLjV6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-vertical-line,.ag-charts-icon-vertical-line-drawing{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAuNSA3LjgwNmEyLjI1IDIuMjUgMCAwIDEgMCA0LjM4OFYxOS41aC0xdi03LjMwNmEyLjI1IDIuMjUgMCAwIDEgMC00LjM4OFYuNWgxem0tLjUuOTQ0YTEuMjUgMS4yNSAwIDEgMSAwIDIuNSAxLjI1IDEuMjUgMCAwIDEgMC0yLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-zoom-in{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTEwIDUuNWEuNS41IDAgMCAxIC41LjV2My41aDMuODc1YS41LjUgMCAwIDEgMCAxSDEwLjV2NC4yNWEuNS41IDAgMSAxLTEgMFYxMC41SDUuNjI1YS41LjUgMCAxIDEgMC0xSDkuNVY2YS41LjUgMCAwIDEgLjUtLjUiLz48L3N2Zz4=)}.ag-charts-icon-zoom-out{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNS41IDEwYS41LjUgMCAwIDEgLjUtLjVoOGEuNS41IDAgMCAxIDAgMUg2YS41LjUgMCAwIDEtLjUtLjUiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-high-low-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNyA0aDJ2MTJINFY0aDNNNSA1aDN2MTBINXpNMTEgMTRWNmg1djhoLTVtMS03aDN2NmgtM3oiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==)}.ag-charts-icon-hlc-series{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzEzMTcyMiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJtMTguMTYzIDEuODM3LTUuMzM0IDExLjYyMUw2Ljk1NyA4LjEybC00LjE5OSA5LjYyMi0uOTE2LS40IDQuNzU2LTEwLjlMMTIuNDkgMTEuOCAxNy4yNTQgMS40MnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjxwYXRoIGZpbGw9IiMwMDAiIGZpbGwtb3BhY2l0eT0iLjQiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTUuODI1IDIuNzA0LjU1IDEzLjc4NWwuOTAyLjQzIDQuNzI0LTkuOTE5IDYuMDM0IDUuMDI5IDMuMjU1LTguMTQtLjkyOC0uMzctMi43NDUgNi44NnptNy44NTIgMTQuNjM2IDUuNzgtMTMuMTM5LS45MTUtLjQwMi01LjIxOSAxMS44Ni02LjAwNS01LjUwNC0zLjI3OCA3LjY0OC45Mi4zOTQgMi43MjItNi4zNTJ6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ag-charts-icon-zoom-in-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20taW4iPjxjaXJjbGUgY3g9IjExIiBjeT0iMTEiIHI9IjgiLz48bGluZSB4MT0iMjEiIHgyPSIxNi42NSIgeTE9IjIxIiB5Mj0iMTYuNjUiLz48bGluZSB4MT0iMTEiIHgyPSIxMSIgeTE9IjgiIHkyPSIxNCIvPjxsaW5lIHgxPSI4IiB4Mj0iMTQiIHkxPSIxMSIgeTI9IjExIi8+PC9zdmc+)}.ag-charts-icon-zoom-out-alt{--icon: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLXpvb20tb3V0Ij48Y2lyY2xlIGN4PSIxMSIgY3k9IjExIiByPSI4Ii8+PGxpbmUgeDE9IjIxIiB4Mj0iMTYuNjUiIHkxPSIyMSIgeTI9IjE2LjY1Ii8+PGxpbmUgeDE9IjgiIHgyPSIxNCIgeTE9IjExIiB5Mj0iMTEiLz48L3N2Zz4=)}.ag-charts-input{--input-layer-active: 1;--input-layer-focus: 2;--input-padding: calc(var(--ag-charts-spacing) * 2);--input-padding-large: calc(var(--ag-charts-spacing) * 2.5);color:var(--ag-charts-input-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);transition-duration:.25s;transition-property:none;transition-timing-function:ease-out}.ag-charts-input:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--input-layer-focus)}.ag-charts-button{background:var(--ag-charts-button-background-color);border:1px solid var(--ag-charts-border-color);border-radius:var(--ag-charts-button-border-radius);color:var(--ag-charts-button-text-color);cursor:pointer;padding:var(--input-padding);transition-property:background,border-color}.ag-charts-button:hover{background:var(--ag-charts-focus-color)}.ag-charts-button:has(.ag-charts-icon){padding:2px}.ag-charts-checkbox{--checkbox-transition-duration: .1s;appearance:none;background:var(--ag-charts-checkbox-background-color);border-radius:calc(var(--ag-charts-border-radius) * 9);cursor:pointer;height:18px;margin:0;transition-duration:var(--checkbox-transition-duration);transition-property:margin;width:29px}.ag-charts-checkbox:before{display:block;background:var(--ag-charts-input-background-color);border-radius:calc(var(--ag-charts-border-radius) * 7);content:" ";height:14px;margin:2px;transition-duration:var(--checkbox-transition-duration);transition-property:margin;transition-timing-function:var(--ag-charts-input-transition-easing);width:14px}.ag-charts-checkbox:checked{background:var(--ag-charts-checkbox-checked-background-color)}.ag-charts-checkbox:checked:before{margin-left:13px}.ag-charts-select{background:var(--ag-charts-input-background-color);border:1px solid var(--ag-charts-input-border-color);border-radius:var(--ag-charts-input-border-radius);padding:3px 2px 4px;font-size:inherit}.ag-charts-textarea{--textarea-line-height: 1.38;background:var(--ag-charts-input-background-color);border:1px solid var(--ag-charts-border-color);border-radius:var(--ag-charts-input-border-radius);line-height:var(--textarea-line-height);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-large);padding:var(--input-padding-large) var(--input-padding)}.ag-charts-textarea::placeholder{color:var(--ag-charts-input-placeholder-text-color)}.ag-charts-proxy-container{pointer-events:none;position:absolute}.ag-charts-proxy-elem{-webkit-appearance:none;appearance:none;background:none;border:none;color:#0000;overflow:hidden;pointer-events:auto;position:absolute}.ag-charts-proxy-elem::-moz-range-thumb,.ag-charts-proxy-elem::-moz-range-track{opacity:0}.ag-charts-proxy-elem::-webkit-slider-runnable-track,.ag-charts-proxy-elem::-webkit-slider-thumb{opacity:0}.ag-charts-proxy-elem:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow)}.ag-charts-focus-indicator{position:absolute;display:block;pointer-events:none;user-select:none;-webkit-user-select:none;width:100%;height:100%}.ag-charts-focus-indicator>div{position:absolute;outline:solid 1px var(--ag-charts-chrome-background-color);box-shadow:var(--ag-charts-focus-shadow)}.ag-charts-focus-indicator>svg{width:100%;height:100%;fill:none;overflow:visible}.ag-charts-focus-svg-outer-path{stroke:var(--ag-charts-chrome-background-color);stroke-width:4px}.ag-charts-focus-svg-inner-path{stroke:var(--ag-charts-accent-color);stroke-width:2px}.ag-charts-overlay{color:#181d1f;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay{color:#fff}.ag-charts-overlay--loading{color:#8c8c8c}.ag-charts-overlay__loading-background{background:#fff;pointer-events:none}.ag-charts-overlay.ag-charts-dark-overlay .ag-charts-overlay__loading-background{background:#192232}.ag-charts-tooltip{--tooltip-arrow-size: 8px;position:fixed;inset:unset;margin:0;padding:0;overflow:visible;width:max-content;max-width:100%;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);color:var(--ag-charts-chrome-text-color);background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);box-shadow:var(--ag-charts-shadow)}.ag-charts-tooltip--compact .ag-charts-tooltip-content{padding:3px 6px}.ag-charts-tooltip--arrow:before{content:"";position:absolute;top:100%;left:50%;margin:0 auto;transform:translate(-50%) translateY(calc(var(--tooltip-arrow-size) * -.5)) rotate(45deg);display:block;width:var(--tooltip-arrow-size);height:var(--tooltip-arrow-size);border:inherit;border-top:none;border-left:none;clip-path:polygon(0% 100%,100% 0%,100% 100%)}.ag-charts-tooltip--arrow:after{--tooltip-inner-size: calc(var(--tooltip-arrow-size) - 2px);content:"";position:absolute;top:100%;left:50%;margin:0 auto;transform:translate(-50%) translateY(calc(var(--tooltip-inner-size) * -.5)) rotate(45deg);display:block;width:var(--tooltip-inner-size);height:var(--tooltip-inner-size);border:inherit;border-color:transparent;background:inherit;clip-path:polygon(-10% 100%,100% -10%,100% 100%)}.ag-charts-tooltip--no-interaction{pointer-events:none;user-select:none;-webkit-user-select:none}.ag-charts-tooltip--wrap-always{overflow-wrap:break-word;word-break:break-word;hyphens:none}.ag-charts-tooltip--wrap-hyphenate{overflow-wrap:break-word;word-break:break-word;hyphens:auto}.ag-charts-tooltip--wrap-on-space{overflow-wrap:normal;word-break:normal}.ag-charts-tooltip--wrap-never{white-space:nowrap}.ag-charts-tooltip-heading,.ag-charts-tooltip-title,.ag-charts-tooltip-label,.ag-charts-tooltip-value{overflow:hidden;text-overflow:ellipsis}.ag-charts-tooltip-content{display:grid;grid:auto-flow minmax(1em,auto) / 1fr;padding:8px 12px;gap:8px}.ag-charts-tooltip-content:has(.ag-charts-tooltip-symbol){grid:auto-flow minmax(1em,auto) / auto 1fr}.ag-charts-tooltip-heading{grid-column:1 / -1}.ag-charts-tooltip-symbol{grid-column:1 / 2;align-self:center}.ag-charts-tooltip-symbol svg{display:block}.ag-charts-tooltip-title{grid-column:-2 / -1}.ag-charts-tooltip-row{grid-column:1 / -1;display:flex;gap:16px;align-items:baseline;justify-content:space-between;overflow:hidden}.ag-charts-tooltip-row--inline{grid-column:-2 / -1}.ag-charts-tooltip-label{flex:1;min-width:0}.ag-charts-tooltip-value{min-width:0}.ag-charts-popover{position:absolute;border:var(--ag-charts-border);border-radius:var(--ag-charts-border-radius);background:var(--ag-charts-chrome-background-color);color:var(--ag-charts-chrome-text-color);font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size);font-weight:var(--ag-charts-chrome-font-weight);box-shadow:var(--ag-charts-shadow);z-index:var(--ag-charts-layer-ui-overlay)}.ag-charts-menu{--item-padding: 6px 12px;--icon-color: var(--ag-charts-chrome-text-color);display:grid;grid:auto-flow auto / 1fr;column-gap:12px;font-size:var(--ag-charts-chrome-font-size)}.ag-charts-menu:has(.ag-charts-menu__icon,.ag-charts-menu__row--stroke-width-visible){grid:auto-flow auto / auto 1fr}.ag-charts-menu__row--stroke-width-visible:before{content:"";height:var(--strokeWidth);width:12px;background:var(--icon-color)}.ag-charts-menu__row--stroke-width-visible[aria-disabled=true]:before{filter:grayscale(1);opacity:.5}.ag-charts-menu__row{display:grid;grid-column:1 / -1;grid-template-columns:subgrid;align-items:center;padding:var(--item-padding)}.ag-charts-menu__row:not(.ag-charts-menu__row--active){cursor:pointer}.ag-charts-menu__row:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.ag-charts-menu__row:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.ag-charts-menu__row:focus{background:var(--ag-charts-focus-color)}.ag-charts-menu__row:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:var(--ag-charts-layer-menu)}.ag-charts-menu__row--active{--icon-color: var(--ag-charts-accent-color);background:var(--ag-charts-focus-color);color:var(--ag-charts-accent-color)}.ag-charts-menu__label{grid-column:-1 / span 1}.ag-charts-toolbar{--toolbar-gap: calc(var(--ag-charts-spacing) * 2);--toolbar-size: 34px;--toolbar-button-padding: 6px;align-items:center;display:flex;flex-wrap:nowrap;position:absolute}.ag-charts-toolbar__button{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);color:var(--ag-charts-chrome-text-color);cursor:pointer;display:flex;font-family:var(--ag-charts-chrome-font-family);font-size:var(--ag-charts-chrome-font-size-medium);font-weight:var(--ag-charts-chrome-font-weight);justify-content:center;min-height:var(--toolbar-size);min-width:var(--toolbar-size);padding:var(--toolbar-button-padding);position:relative;transition:background-color .25s ease-in-out,border-color .25s ease-in-out,color .25s ease-in-out;white-space:nowrap}.ag-charts-toolbar__button:hover{background:var(--ag-charts-focus-color);z-index:1}.ag-charts-toolbar__button:focus-visible{outline:var(--ag-charts-focus-border);box-shadow:var(--ag-charts-focus-border-shadow);z-index:calc(var(--ag-charts-layer-ui-overlay) + 1)}.ag-charts-toolbar__button--active{background:var(--ag-charts-focus-color);border-color:var(--ag-charts-accent-color);color:var(--ag-charts-accent-color);z-index:2}.ag-charts-toolbar__button[aria-disabled=true]{background:var(--ag-charts-button-disabled-background-color);color:var(--ag-charts-button-disabled-text-color);cursor:default}.ag-charts-toolbar--horizontal{flex-direction:row;.ag-charts-toolbar__button{margin:0 0 0 -1px}.ag-charts-toolbar__button--first{border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-right-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar--vertical{flex-direction:column;.ag-charts-toolbar__button{margin:-1px 0 0;max-width:100%}.ag-charts-toolbar__button--first{border-top-left-radius:var(--ag-charts-border-radius);border-top-right-radius:var(--ag-charts-border-radius);margin:0}.ag-charts-toolbar__button--last{border-bottom-left-radius:var(--ag-charts-border-radius);border-bottom-right-radius:var(--ag-charts-border-radius)}}.ag-charts-toolbar__icon+.ag-charts-toolbar__label{margin-left:var(--toolbar-gap)}.ag-charts-toolbar__icon,.ag-charts-toolbar__label{pointer-events:none}.ag-charts-floating-toolbar{border:none;display:flex;.ag-charts-toolbar{align-items:unset;position:unset}}.ag-charts-floating-toolbar__drag-handle{align-items:center;background:var(--ag-charts-chrome-background-color);border:var(--ag-charts-border);border-bottom-left-radius:var(--ag-charts-border-radius);border-top-left-radius:var(--ag-charts-border-radius);cursor:grab;display:flex;justify-content:center;min-width:24px;padding-left:0;padding-right:0}.ag-charts-floating-toolbar__drag-handle--dragging{cursor:grabbing} `,Listeners=class{constructor(){this.registeredListeners=new Map}addListener(t,e){const i={symbol:Symbol(t),handler:e};return this.registeredListeners.has(t)?this.registeredListeners.get(t).push(i):this.registeredListeners.set(t,[i]),()=>this.removeListener(i.symbol)}removeListener(t){for(const[e,i]of this.registeredListeners.entries()){const s=i.findIndex(n=>n.symbol===t);if(s>=0){i.splice(s,1),i.length===0&&this.registeredListeners.delete(e);break}}}dispatch(t,...e){for(const i of this.getListenersByType(t))try{i.handler(...e)}catch(s){logger_exports.errorOnce(String(s))}}getListenersByType(t){return this.registeredListeners.get(t)??[]}destroy(){this.registeredListeners.clear()}},BaseManager=class{constructor(){this.listeners=new Listeners,this.destroyFns=[]}addListener(t,e){return this.listeners.addListener(t,e)}destroy(){this.listeners.destroy(),this.destroyFns.forEach(t=>t())}},GuardedElement=class It{constructor(e,i,s){this.element=e,this.topTabGuard=i,this.bottomTabGuard=s,this.destroyFns=[],this.guardTabIndex=0,this.hasFocus=!1,this.initTabGuard(this.topTabGuard,n=>this.onTab(n,!1)),this.initTabGuard(this.bottomTabGuard,n=>this.onTab(n,!0)),this.element.addEventListener("focus",()=>this.onFocus(),{capture:!0}),this.element.addEventListener("blur",n=>this.onBlur(n),{capture:!0})}set tabIndex(e){this.guardTabIndex=e,this.guardTabIndex===0?this.setGuardIndices(void 0):this.hasFocus||this.setGuardIndices(this.guardTabIndex)}destroy(){for(const e of this.destroyFns)e();this.destroyFns.length=0}initTabGuard(e,i){const s=()=>i(e);e.addEventListener("focus",s),this.destroyFns.push(()=>e.removeEventListener("focus",s))}setGuardIndices(e){const i=e;setAttribute(this.topTabGuard,"tabindex",i),setAttribute(this.bottomTabGuard,"tabindex",i)}onFocus(){this.hasFocus=!0,this.guardTabIndex!==0&&this.setGuardIndices(0)}onBlur({relatedTarget:e}){const{topTabGuard:i,bottomTabGuard:s}=this;this.hasFocus=!1,this.guardTabIndex!==0&&e!==i&&e!==s&&this.setGuardIndices(this.guardTabIndex)}onTab(e,i){if(this.guardTabIndex!==0){let s;e.tabIndex===0?(s=this.findExitTarget(!i),this.setGuardIndices(this.guardTabIndex)):s=this.findEnterTarget(i),s?.focus()}}static queryFocusable(e,i){const s=getWindow();return Array.from(e.querySelectorAll(i)).filter(n=>{if(n instanceof HTMLElement){const r=s.getComputedStyle(n);return r.display!=="none"&&r.visibility!=="none"}return!1})}findEnterTarget(e){const i=It.queryFocusable(this.element,'[tabindex="0"]'),s=e?i.length-1:0;return i[s]}findExitTarget(e){const i=It.queryFocusable(getDocument(),"[tabindex]").filter(r=>r.tabIndex>0).sort((r,o)=>r.tabIndex-o.tabIndex),{before:s,after:n}=It.findBeforeAndAfter(i,this.guardTabIndex);return e?s:n}static findBeforeAndAfter(e,i){let s=0,n=e.length-1,r,o;for(;s<=n;){const a=Math.floor((s+n)/2),l=e[a].tabIndex;if(l===i){r=e[a-1]||void 0,o=e[a+1]||void 0;break}else le.removeEventListener(i,s,n);return t.push(r),r}function addEscapeEventListener(t,e,i){addRemovableEventListener(t,e,"keydown",s=>{s.key==="Escape"&&i(s)})}function addMouseCloseListener(t,e,i){const s=addRemovableEventListener(t,window,"mousedown",n=>{[0,2].includes(n.button)&&!containsPoint2(e,n)&&(i(),s())});return s}function addTouchCloseListener(t,e,i){const s=addRemovableEventListener(t,window,"touchstart",n=>{Array.from(n.targetTouches).some(o=>!containsPoint2(e,o))&&(i(),s())});return s}function containsPoint2(t,e){if(e.target instanceof Element){const{x:i,y:s,width:n,height:r}=t.getBoundingClientRect(),{clientX:o,clientY:a}=e;return o>=i&&a>=s&&o<=i+n&&a<=s+r}return!1}function hasNoModifiers(t){return!(t.shiftKey||t.altKey||t.ctrlKey||t.metaKey)}function matchesKey(t,e,...i){return hasNoModifiers(t)&&(t.key===e||i.some(s=>t.key===s))}function linkTwoButtons(t,e,i,s){i&&addRemovableEventListener(t,e,"keydown",n=>{matchesKey(n,s)&&i.focus()})}function linkThreeButtons(t,e,i,s,n,r){linkTwoButtons(t,e,n,r),linkTwoButtons(t,e,i,s),addRemovableEventListener(t,e,"keydown",o=>{matchesKey(o,s,r)&&o.preventDefault()})}var PREV_NEXT_KEYS={horizontal:{nextKey:"ArrowRight",prevKey:"ArrowLeft"},vertical:{nextKey:"ArrowDown",prevKey:"ArrowUp"}};function initRovingTabIndex(t){const{orientation:e,buttons:i,wrapAround:s=!1,onEscape:n,onFocus:r,onBlur:o}=t,{nextKey:a,prevKey:l}=PREV_NEXT_KEYS[e],c=p=>{p.target&&"tabIndex"in p.target&&(i.forEach(g=>g.tabIndex=-1),p.target.tabIndex=0)},[h,u]=s?[i.length,i.length]:[0,1/0],d=[];for(let p=0;pthis.close(!0))),this.destroyFns.push(addTouchCloseListener(this.destroyFns,t,()=>this.close(!0)))}close(t){this.destroyFns.forEach(e=>e()),this.destroyFns.length=0,this.closeCallback(),this.finishClosing(t)}finishClosing(t){this.destroyFns.forEach(e=>e()),this.destroyFns.length=0,setAttribute(this.lastFocus,"aria-expanded",!1),t||this.lastFocus?.focus({preventScroll:!0}),this.lastFocus=void 0}};function initMenuKeyNav(t){const{sourceEvent:e,orientation:i,menu:s,buttons:n,closeCallback:r,overrideFocusVisible:o,autoCloseOnBlur:a=!1}=t,{nextKey:l,prevKey:c}=PREV_NEXT_KEYS[i],h=getLastFocus(e);setAttribute(h,"aria-expanded",!0);const u=new MenuCloserImp(s,h,r),d=()=>u.close(),{destroyFns:p}=u;if(s.role="menu",s.ariaOrientation=i,p.push(...initRovingTabIndex({orientation:i,buttons:n,onEscape:d,wrapAround:!0})),s.tabIndex=-1,addEscapeEventListener(p,s,d),addRemovableEventListener(p,s,"keydown",g=>{g.target===s&&(g.key===l||g.key===c)&&(g.preventDefault(),n[0]?.focus())}),a){const g=m=>{!n.includes(m.relatedTarget)&&d()};for(const m of n)addRemovableEventListener(p,m,"blur",g)}return n[0]?.focus({preventScroll:!0}),o!==void 0&&(n.forEach(m=>m.setAttribute("data-focus-visible-override",o.toString())),addRemovableEventListener(p,s,"keydown",()=>{n.forEach(m=>m.setAttribute("data-focus-visible-override","true"))},{once:!0})),u}function makeAccessibleClickListener(t,e){return i=>{if(t.ariaDisabled==="true")return i.preventDefault();e(i)}}function isButtonClickEvent(t){return"button"in t?t.button===0:hasNoModifiers(t)&&(t.code==="Space"||t.key==="Enter")}function getLastFocus(t){if(t?.target instanceof HTMLElement&&"tabindex"in t.target.attributes)return t.target}function stopPageScrolling(t){const e=i=>{if(i.defaultPrevented)return;getAttribute(i.target,"data-preventdefault",!0)&&matchesKey(i,"ArrowRight","ArrowLeft","ArrowDown","ArrowUp")&&i.preventDefault()};return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)}var PixelRatioObserver=class{constructor(t){this.callback=t,this.devicePixelRatio=getWindow("devicePixelRatio")??1,this.devicePixelRatioMediaQuery=void 0,this.devicePixelRatioListener=e=>{e.matches||(this.devicePixelRatio=getWindow("devicePixelRatio")??1,this.unregisterDevicePixelRatioListener(),this.registerDevicePixelRatioListener(),this.callback(this.pixelRatio))}}get pixelRatio(){return this.devicePixelRatio}observe(){this.registerDevicePixelRatioListener()}disconnect(){this.unregisterDevicePixelRatioListener()}unregisterDevicePixelRatioListener(){this.devicePixelRatioMediaQuery?.removeEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=void 0}registerDevicePixelRatioListener(){const t=getWindow("matchMedia")?.(`(resolution: ${this.pixelRatio}dppx)`);t?.addEventListener("change",this.devicePixelRatioListener),this.devicePixelRatioMediaQuery=t}},SizeMonitor=class{constructor(){this.elements=new Map,this.documentReady=!1,this.queuedObserveRequests=[],this.onLoad=()=>{this.documentReady=!0,this.queuedObserveRequests.forEach(([e,i])=>this.observe(e,i)),this.queuedObserveRequests=[],this.observeWindow()},typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(e=>{for(const{target:i,contentRect:{width:s,height:n}}of e){const r=this.elements.get(i);this.checkSize(r,i,s,n)}}));let t;this.pixelRatioObserver=new PixelRatioObserver(()=>{clearTimeout(t),t=setTimeout(()=>this.checkPixelRatio(),0)}),this.documentReady=getDocument("readyState")==="complete",this.documentReady?this.observeWindow():getWindow()?.addEventListener("load",this.onLoad)}destroy(){getWindow()?.removeEventListener("load",this.onLoad),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.pixelRatioObserver?.disconnect(),this.pixelRatioObserver=void 0}observeWindow(){this.pixelRatioObserver?.observe()}checkPixelRatio(){const t=this.pixelRatioObserver?.pixelRatio??1;for(const[e,i]of this.elements)if(i.size!=null&&i.size.pixelRatio!==t){const{width:s,height:n}=i.size;i.size={width:s,height:n,pixelRatio:t},i.cb(i.size,e)}}checkSize(t,e,i,s){if(t&&(i!==t.size?.width||s!==t.size?.height)){const n=this.pixelRatioObserver?.pixelRatio??1;t.size={width:i,height:s,pixelRatio:n},t.cb(t.size,e)}}observe(t,e){if(!this.documentReady){this.queuedObserveRequests.push([t,e]);return}this.elements.has(t)?this.removeFromQueue(t):this.resizeObserver?.observe(t);const i={cb:e};this.elements.set(t,i)}unobserve(t){this.resizeObserver?.unobserve(t),this.elements.delete(t),this.removeFromQueue(t),this.elements.size||this.destroy()}removeFromQueue(t){this.queuedObserveRequests=this.queuedObserveRequests.filter(([e])=>e!==t)}},StateTracker=class extends Map{constructor(t,e){super(),this.defaultValue=t,this.defaultState=e}set(t,e){return this.delete(t),typeof e<"u"&&super.set(t,e),this}stateId(){return Array.from(this.keys()).pop()??this.defaultState}stateValue(){return Array.from(this.values()).pop()??this.defaultValue}},domLayout_default='',DOM_ELEMENT_CLASSES=["styles","canvas","canvas-center","canvas-container","canvas-overlay","canvas-proxy","series-area"],CONTAINER_MODIFIERS={safeHorizontal:"ag-charts-wrapper--safe-horizontal",safeVertical:"ag-charts-wrapper--safe-vertical"},domElementConfig=new Map([["styles",{childElementType:"style"}],["canvas",{childElementType:"canvas"}],["canvas-proxy",{childElementType:"div"}],["canvas-overlay",{childElementType:"div"}],["canvas-center",{childElementType:"div"}],["series-area",{childElementType:"div"}]]);function setupObserver(t,e){if(typeof IntersectionObserver>"u")return;const i=new IntersectionObserver(s=>{for(const n of s)n.target===t&&e(n.intersectionRatio)},{root:t});return i.observe(t),i}var NULL_DOMRECT={x:0,y:0,width:0,height:0,top:0,bottom:0,left:0,right:0,toJSON(){return NULL_DOMRECT}};function createTabGuardElement(t,e){const i=createElement("div");return i.className="ag-charts-tab-guard",t.insertAdjacentElement(e,i),i}var DOMManager=class extends BaseManager{constructor(t,e){super(),this.styles=new Map,this.container=void 0,this.containerSize=void 0,this.sizeMonitor=new SizeMonitor,this.cursorState=new StateTracker("default"),this.minWidth=0,this.minHeight=0;const i=createElement("div");i.innerHTML=domLayout_default,this.element=i.children.item(0),this.styleRootElement=e,this.rootElements=DOM_ELEMENT_CLASSES.reduce((a,l)=>{const c=`ag-charts-${l}`,h=this.element.classList.contains(c)?this.element:this.element.querySelector(`.${c}`);if(!h)throw new Error(`AG Charts - unable to find DOM element ${c}`);return a[l]={element:h,children:new Map,listeners:[]},a},{});let s=!1;this.observer=setupObserver(this.element,a=>{a===0&&!s&&this.listeners.dispatch("hidden",{type:"hidden"}),s=a===0}),this.setSizeOptions(),this.updateContainerSize(),this.addStyles("ag-charts-community",styles_default),t&&this.setContainer(t),this.destroyFns.push(stopPageScrolling(this.element));const n=this.element.querySelector(".ag-charts-canvas-center");if(n==null)throw new Error("Error initializing tab guards");const r=createTabGuardElement(n,"beforebegin"),o=createTabGuardElement(n,"afterend");this.tabGuards=new GuardedElement(n,r,o)}destroy(){super.destroy(),this.observer?.unobserve(this.element),this.container&&this.sizeMonitor.unobserve(this.container),Object.values(this.rootElements).forEach(t=>{t.children.forEach(e=>e.remove()),t.element.remove()}),this.element.remove()}setSizeOptions(t=300,e=300,i,s){const{style:n}=this.element;n.width=`${i??t}px`,n.height=`${s??e}px`,this.minWidth=i??t,this.minHeight=s??e,this.updateContainerClassName()}updateContainerSize(){const{style:t}=this.rootElements["canvas-center"].element;t.visibility=this.containerSize==null?"hidden":"",this.containerSize?(t.width=`${this.containerSize.width??0}px`,t.height=`${this.containerSize.height??0}px`):(t.width="",t.height=""),this.updateContainerClassName()}setTabGuardIndex(t){this.tabGuards.tabIndex=t}setContainer(t){if(t===this.container)return;if(this.container&&(this.container.removeChild(this.element),this.sizeMonitor.unobserve(this.container)),!(this.getShadowDocumentRoot(t)!=null))for(const i of this.rootElements.styles.children.keys())this.removeChild("styles",i);this.container=t;for(const[i,s]of this.styles)this.addStyles(i,s);t.appendChild(this.element),this.sizeMonitor.observe(t,i=>{this.containerSize=i,this.updateContainerSize(),this.listeners.dispatch("resize",{type:"resize"})}),this.listeners.dispatch("container-changed",{type:"container-changed"})}setThemeClass(t){const e="ag-charts-theme-";this.element.classList.forEach(i=>{i.startsWith(e)&&i!==t&&this.element.classList.remove(i)}),this.element.classList.add(t)}setThemeParameters(t){const e={accentColor:"accent-color",axisColor:"axis-color",backgroundColor:"background-color",borderColor:"border-color",foregroundColor:"foreground-color",fontFamily:"font-family",fontSize:"font-size",fontWeight:"font-weight",gridLineColor:"grid-line-color",padding:"padding",subtleTextColor:"subtle-text-color",textColor:"text-color",chromeBackgroundColor:"chrome-background-color",chromeFontFamily:"chrome-font-family",chromeFontSize:"chrome-font-size",chromeFontWeight:"chrome-font-weight",chromeSubtleTextColor:"chrome-subtle-text-color",chromeTextColor:"chrome-text-color",inputBackgroundColor:"input-background-color",inputTextColor:"input-text-color",crosshairLabelBackgroundColor:"crosshair-label-background-color",crosshairLabelTextColor:"crosshair-label-text-color"},i=["fontSize","chromeFontSize"];for(const[s,n]of Object.entries(t)){let r=`${n}`;i.includes(s)&&(r=`${n}px`),this.element.style.setProperty(`--ag-charts-${e[s]}`,r)}}updateCanvasLabel(t){setAttribute(this.rootElements["canvas-proxy"].element,"aria-label",t)}getEventElement(t,e){return["focus","blur","keydown","keyup"].includes(e)?this.rootElements["series-area"].element:t}addEventListener(t,e,i){this.getEventElement(this.element,t).addEventListener(t,e,i)}removeEventListener(t,e,i){this.getEventElement(this.element,t).removeEventListener(t,e,i)}getBoundingClientRect(){return this.rootElements.canvas.element.getBoundingClientRect()}getOverlayClientRect(){const t=getWindow(),e=new BBox(0,0,t.innerWidth,t.innerHeight),i=this.getRawOverlayClientRect();return e.intersection(i)?.toDOMRect()??NULL_DOMRECT}getRawOverlayClientRect(){let t=this.element;for(;t!=null;){const r=t.computedStyleMap?.()?.get("overflow-y")?.toString();if(r==="auto"||r==="scroll")return BBox.fromDOMRect(t.getBoundingClientRect());t=t.parentElement}const e=this.getShadowDocumentRoot();if(e!=null)return BBox.fromDOMRect(e.getBoundingClientRect());const{innerWidth:i,innerHeight:s}=getWindow();return new BBox(0,0,i,s)}getShadowDocumentRoot(t=this.container){const e=t?.ownerDocument?.body??getDocument("body");for(;t!=null;){if(t===e)return;if(t.parentNode instanceof DocumentFragment)return t;t=t.parentNode}return this.container}getParent(t){return this.rootElements[t].element}getChildBoundingClientRect(t){const{children:e}=this.rootElements[t],i=[];for(const s of e.values())i.push(BBox.fromDOMRect(s.getBoundingClientRect()));return BBox.merge(i)}isManagedChildDOMElement(t,e,i){const{children:s}=this.rootElements[e],n=s?.get(i);return n!=null&&t.contains(n)}contains(t,e){return e==null?this.element.contains(t):this.rootElements[e].element.contains(t)}addStyles(t,e){const i="data-ag-charts";if(this.styles.set(t,e),this.container==null)return;const s=o=>o.getAttribute(i)===t,n=o=>{const a=new Set(["TITLE","META"]);let l=!0,c;for(const u of o.children){if(l&&a.has(u.tagName)){c=u;continue}if(l=!1,s(u))return;u.hasAttribute(i)&&(c=u)}const h=createElement("style");return c!=null?o.insertBefore(h,c.nextSibling):o.prepend(h),h};let r;this.styleRootElement?r=n(this.styleRootElement):this.getShadowDocumentRoot(this.container)!=null?r=this.addChild("styles",t):r=n(getDocument("head")),!(r==null||s(r))&&(r.setAttribute(i,t),r.innerHTML=e)}removeStyles(t){this.removeChild("styles",t)}updateCursor(t,e){this.cursorState.set(t,e),this.element.style.cursor=this.cursorState.stateValue()}getCursor(){return this.element.style.cursor}addChild(t,e,i,s){const{element:n,children:r,listeners:o}=this.rootElements[t];if(!r)throw new Error("AG Charts - unable to create DOM elements after destroy()");if(r.has(e))return r.get(e);const{childElementType:a="div"}=domElementConfig.get(t)??{};if(i&&i.tagName.toLowerCase()!==a.toLowerCase())throw new Error("AG Charts - mismatching DOM element type");const l=i??createElement(a);for(const[c,h,u]of o)l.addEventListener(c,h,u);if(r.set(e,l),s){const c=n.querySelector(s.query);if(c==null)throw new Error(`AG Charts - addChild query failed ${s.query}`);c.insertAdjacentElement(s.where,l)}else n?.appendChild(l);return l}removeChild(t,e){const{children:i}=this.rootElements[t];i&&(i.get(e)?.remove(),i.delete(e))}incrementDataCounter(t){const{dataset:e}=this.element;e[t]??(e[t]="0"),e[t]=String(Number(e[t])+1)}setDataBoolean(t,e){this.element.dataset[t]=String(e)}updateContainerClassName(){const{element:t,containerSize:e,minWidth:i,minHeight:s}=this;t.classList.toggle(CONTAINER_MODIFIERS.safeHorizontal,i>=(e?.width??1/0)),t.classList.toggle(CONTAINER_MODIFIERS.safeVertical,s>=(e?.height??1/0))}},BoundedTextWidget=class extends Widget{constructor(){super(createElement("div")),this.textElement=createSvgElement("text"),this.textElement.role="presentation",this.svgElement=createSvgElement("svg"),this.svgElement.appendChild(this.textElement),this.svgElement.style.width="100%",this.svgElement.style.opacity="0",this.svgElement.role="presentation",this.elem.appendChild(this.svgElement),this.elem.role="presentation"}set textContent(t){this.textElement.textContent=t;const i=this.textElement.getBBox?.();i&&this.svgElement.setAttribute("viewBox",`${i.x} ${i.y} ${i.width} ${i.height}`)}get textContent(){return this.textElement.textContent}destructor(){}},ButtonWidget=class extends Widget{constructor(){super(createElement("button")),this.setEnabled(!0)}destructor(){}setEnabled(t){setAttribute(this.elem,"aria-disabled",!t),setElementStyle(this.elem,"pointer-events",t?void 0:"none")}addListener(t,e){return super.addListener(t,(i,s)=>{(t==="click"||t==="dblclick")&&this.isDisabled()||e(i,s)})}},GroupWidget=class extends Widget{constructor(){super(createElement("div")),setAttribute(this.elem,"role","group")}destructor(){}},RovingTabContainerWidget=class extends Widget{constructor(t,e){super(createElement("div")),this.focusedChildIndex=0,this.onChildFocus=(i,s)=>{const n=this.children[this.focusedChildIndex];this.focusedChildIndex=s.index,n?.setTabIndex(-1),s.setTabIndex(0)},this.onChildKeyDown=(i,s)=>{const n=this.orientation,[r,o]=n==="both"?[PREV_NEXT_KEYS.horizontal,PREV_NEXT_KEYS.vertical]:[PREV_NEXT_KEYS[n],void 0];let a=-1;if(hasNoModifiers(i.sourceEvent)){const l=i.sourceEvent.key;l===r.nextKey||l===o?.nextKey?a=s.index+1:(l===r.prevKey||l===o?.prevKey)&&(a=s.index-1)}this.children[a]?.focus()},this.orientation=t,setAttribute(this.elem,"role",e)}get orientation(){return getAttribute(this.elem,"aria-orientation")??"both"}set orientation(t){setAttribute(this.elem,"aria-orientation",t!=="both"?t:void 0)}focus(){this.children[this.focusedChildIndex]?.focus()}onChildAdded(t){t.addListener("focus",this.onChildFocus),t.addListener("keydown",this.onChildKeyDown),t.setTabIndex(this.children.length===1?0:-1)}onChildRemoved(t){t.removeListener("focus",this.onChildFocus),t.removeListener("keydown",this.onChildKeyDown)}},ListWidget=class extends RovingTabContainerWidget{constructor(){super("both","list"),this.setHidden(!0)}destructor(){this.children.forEach(t=>t.getElement().parentElement.remove())}addChildToDOM(t,e){const i=createElement("div");setAttribute(i,"role","listitem"),setElementStyle(i,"position","absolute"),Widget.setElementContainer(t,i),this.appendOrInsert(i,e),this.setHidden(!1)}removeChildFromDOM(t){t.getElement().parentElement.remove(),this.setHidden(this.children.length===0)}setHidden(t){this.children.length===0&&(t=!0),super.setHidden(t)}},NativeWidget=class extends Widget{constructor(t){super(t)}destructor(){}},_SliderWidget=class bt extends Widget{constructor(){super(createElement("input")),this._step=bt.STEP_ONE,this.orientation="both"}get step(){return this._step}set step(e){this._step=e,this.getElement().step=e.attributeValue}get keyboardStep(){return this._keyboardStep?.step??this._step}set keyboardStep(e){if(e!==this._keyboardStep?.step&&(this._keyboardStep!==void 0&&(this.removeListener("keydown",this._keyboardStep.onKeyDown),this.removeListener("keyup",this._keyboardStep.onKeyUp),this.removeListener("blur",this._keyboardStep.onBlur),this._keyboardStep=void 0),e!==void 0)){const i=()=>this.getElement().step=e.attributeValue,s=()=>this.getElement().step=this._step.attributeValue;this._keyboardStep={step:e,onKeyDown:i,onKeyUp:s,onBlur:s},this.addListener("keydown",this._keyboardStep.onKeyDown),this.addListener("keyup",this._keyboardStep.onKeyUp),this.addListener("blur",this._keyboardStep.onBlur)}}get orientation(){return getAttribute(this.elem,"aria-orientation")??"both"}set orientation(e){setAttribute(this.elem,"aria-orientation",e!=="both"?e:void 0),bt.registerDefaultPreventers(this,e)}destructor(){}clampValueRatio(e,i){const s=this.getValueRatio(),n=clamp(e,s,i);return n!==s&&this.setValueRatio(n),n}setValueRatio(e,i){const{divider:s}=this.step,n=Math.round(e*1e4)/s,{ariaValueText:r=formatPercent(n/s)}=i??{},o=this.getElement();o.value=`${n}`,o.ariaValueText=r}getValueRatio(){return parseFloat(this.getElement().value)/this.step.divider}static registerDefaultPreventers(e,i){i==="both"?e.removeListener("keydown",bt.onKeyDown):e.addListener("keydown",bt.onKeyDown)}static onKeyDown(e,i){let s=[];const{orientation:n}=i;n==="horizontal"?s=["ArrowUp","ArrowDown"]:n==="vertical"&&(s=["ArrowLeft","ArrowRight"]),s.includes(e.sourceEvent.code)&&e.sourceEvent.preventDefault()}};_SliderWidget.STEP_ONE={attributeValue:"1",divider:1},_SliderWidget.STEP_HUNDRETH={attributeValue:"0.01",divider:100};var SliderWidget=_SliderWidget,SwitchWidget=class extends ButtonWidget{constructor(){super(),setAttribute(this.elem,"role","switch"),this.setChecked(!1)}setChecked(t){setAttribute(this.elem,"aria-checked",t)}},ToolbarWidget=class extends RovingTabContainerWidget{constructor(t="horizontal"){super(t,"toolbar")}destructor(){}};function checkType(t,e){return e.params?.type===t}function allocateResult(t){if(t==="button")return new ButtonWidget;if(t==="slider")return new SliderWidget;if(t==="toolbar")return new ToolbarWidget;if(t==="group")return new GroupWidget;if(t==="list")return new ListWidget;if(t==="region")return new NativeWidget(createElement("div"));if(t==="text")return new BoundedTextWidget;if(t==="listswitch")return new SwitchWidget;throw Error("AG Charts - error allocating meta")}function allocateMeta(t){const e={params:t,result:void 0};return e.result=allocateResult(e.params.type),e}var ProxyInteractionService=class{constructor(t,e){this.localeManager=t,this.domManager=e,this.destroyFns=[]}destroy(){this.destroyFns.forEach(t=>t())}addLocalisation(t){t(),this.destroyFns.push(this.localeManager.addListener("locale-changed",t))}createProxyContainer(t){const e=allocateMeta(t),{params:i,result:s}=e,n=s.getElement();return this.domManager.addChild("canvas-proxy",i.domManagerId,n),n.classList.add(...i.classList,"ag-charts-proxy-container"),n.role=i.type,"ariaOrientation"in i&&(n.ariaOrientation=i.ariaOrientation),checkType("toolbar",e)&&(e.result.orientation=e.params.orientation),this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),s}createProxyElement(t){const e=allocateMeta(t);if(checkType("button",e)){const{params:i,result:s}=e,n=s.getElement();if(this.initInteract(i,s),typeof i.textContent=="string")n.textContent=i.textContent;else{const{textContent:r}=i;this.addLocalisation(()=>{n.textContent=this.localeManager.t(r.id,r.params)})}this.setParent(e.params,e.result)}if(checkType("slider",e)){const{params:i,result:s}=e,n=s.getElement();this.initInteract(i,s),n.type="range",n.role="presentation",n.style.margin="0px",this.addLocalisation(()=>{n.ariaLabel=this.localeManager.t(i.ariaLabel.id,i.ariaLabel.params)}),this.setParent(e.params,e.result)}if(checkType("text",e)){const{params:i,result:s}=e;this.initElement(i,s),this.setParent(e.params,e.result)}if(checkType("listswitch",e)){const{params:i,result:s}=e;this.initInteract(i,s),s.setTextContent(i.textContent),s.setChecked(i.ariaChecked),s.setAriaDescribedBy(i.ariaDescribedBy),this.setParent(e.params,e.result)}if(checkType("region",e)){const{params:i,result:s}=e,n=s.getElement();this.initInteract(i,s),n.role="region",this.setParent(e.params,e.result)}return e.result}initElement(t,e){const i=e.getElement();return setAttribute(i,"id",t.id),setElementStyle(i,"cursor",t.cursor),i.classList.toggle("ag-charts-proxy-elem",!0),i}initInteract(t,e){const{tabIndex:i,domIndex:s}=t,n=this.initElement(t,e);i!==void 0&&(n.tabIndex=i),s!==void 0&&(e.domIndex=s)}setParent(t,e){if("parent"in t)t.parent?.addChild(e);else{const i={where:t.where,query:".ag-charts-series-area"};this.domManager.addChild("canvas-proxy",t.domManagerId,e.getElement(),i)}}},AG_CHARTS_LOCALE_EN_US={ariaAnnounceHoverDatum:"${datum}",ariaAnnounceChart:"chart, ${seriesCount}[number] series",ariaAnnounceHierarchyChart:"hierarchy chart, ${caption}",ariaAnnounceGaugeChart:"gauge chart, ${caption}",ariaAnnounceHierarchyDatum:"level ${level}[number], ${count}[number] children, ${description}",ariaAnnounceFlowProportionLink:"link ${index} of ${count}, from ${from} to ${to}, ${sizeName} ${size}",ariaAnnounceFlowProportionNode:"node ${index} of ${count}, ${description}",ariaDescriptionLegendItem:"Press Space or Enter to toggle visibility",ariaLabelAddHorizontalLine:"Add Horizontal Line",ariaLabelAnnotationOptionsToolbar:"Annotation Options",ariaLabelAnnotationSettingsDialog:"Annotation Settings",ariaLabelColorPicker:"Color picker",ariaLabelFinancialCharts:"Financial Charts",ariaLabelLegend:"Legend",ariaLabelLegendPagination:"Legend Pagination",ariaLabelLegendPagePrevious:"Previous Legend Page",ariaLabelLegendPageNext:"Next Legend Page",ariaLabelLegendItem:"${label}, Legend item ${index}[number] of ${count}[number]",ariaLabelLegendItemUnknown:"Unknown legend item",ariaLabelNavigator:"Navigator",ariaLabelNavigatorRange:"Range",ariaLabelNavigatorMinimum:"Minimum",ariaLabelNavigatorMaximum:"Maximum",ariaLabelRangesToolbar:"Ranges",ariaLabelSettingsTabBar:"Settings",ariaLabelZoomToolbar:"Zoom",ariaValuePanRange:"${min}[percent] to ${max}[percent]",iconAltTextLineStyleSolid:"Solid",iconAltTextLineStyleDashed:"Long-dashed",iconAltTextLineStyleDotted:"Short-dashed",iconAltTextPositionTop:"Top",iconAltTextPositionCenter:"Center",iconAltTextPositionBottom:"Bottom",iconAltTextAlignLeft:"Left",iconAltTextAlignCenter:"Center",iconAltTextAlignRight:"Right",iconAltTextClose:"Close",overlayLoadingData:"Loading data...",overlayNoData:"No data to display",overlayNoVisibleSeries:"No visible series",overlayUnsupportedBrowser:"Incompatible browser version. Please upgrade your browser.",seriesHistogramTooltipFrequency:"Frequency",seriesHistogramTooltipSum:"${yName} (sum)",seriesHistogramTooltipCount:"${yName} (count)",seriesHistogramTooltipMean:"${yName} (mean)",toolbarSeriesTypeDropdown:"Chart Type",toolbarSeriesTypeOHLC:"OHLC",toolbarSeriesTypeHLC:"HLC",toolbarSeriesTypeHighLow:"High Low",toolbarSeriesTypeCandles:"Candles",toolbarSeriesTypeHollowCandles:"Hollow Candles",toolbarSeriesTypeLine:"Line",toolbarSeriesTypeLineWithMarkers:"Line with Markers",toolbarSeriesTypeStepLine:"Step Line",toolbarAnnotationsTrendLine:"Trend Line",toolbarAnnotationsFibonacciRetracement:"Fib Retracement",toolbarAnnotationsFibonacciRetracementTrendBased:"Fib Trend Based",toolbarAnnotationsHorizontalLine:"Horizontal Line",toolbarAnnotationsVerticalLine:"Vertical Line",toolbarAnnotationsParallelChannel:"Parallel Channel",toolbarAnnotationsDisjointChannel:"Disjoint Channel",toolbarAnnotationsClearAll:"Clear All",toolbarAnnotationsFillColor:"Fill Color",toolbarAnnotationsLineColor:"Line Color",toolbarAnnotationsLineStyle:"Line Style",toolbarAnnotationsLineStrokeWidth:"Line Stroke Width",toolbarAnnotationsSettings:"Settings",toolbarAnnotationsTextColor:"Text Color",toolbarAnnotationsTextSize:"Text Size",toolbarAnnotationsLock:"Lock",toolbarAnnotationsUnlock:"Unlock",toolbarAnnotationsDelete:"Delete",toolbarAnnotationsDragHandle:"Drag Toolbar",toolbarAnnotationsLineAnnotations:"Trend Lines",toolbarAnnotationsFibonacciAnnotations:"Fibonacci",toolbarAnnotationsTextAnnotations:"Text Annotations",toolbarAnnotationsShapeAnnotations:"Arrows",toolbarAnnotationsMeasurerAnnotations:"Measurers",toolbarAnnotationsCallout:"Callout",toolbarAnnotationsComment:"Comment",toolbarAnnotationsNote:"Note",toolbarAnnotationsText:"Text",toolbarAnnotationsArrow:"Arrow",toolbarAnnotationsArrowUp:"Arrow Up",toolbarAnnotationsArrowDown:"Arrow Down",toolbarAnnotationsDateRange:"Date Range",toolbarAnnotationsPriceRange:"Price Range",toolbarAnnotationsDatePriceRange:"Date and Price",toolbarAnnotationsQuickDatePriceRange:"Measure",toolbarRange1Month:"1M",toolbarRange1MonthAria:"1 month",toolbarRange3Months:"3M",toolbarRange3MonthsAria:"3 months",toolbarRange6Months:"6M",toolbarRange6MonthsAria:"6 months",toolbarRangeYearToDate:"YTD",toolbarRangeYearToDateAria:"Year to date",toolbarRange1Year:"1Y",toolbarRange1YearAria:"1 year",toolbarRangeAll:"All",toolbarRangeAllAria:"All",toolbarZoomZoomOut:"Zoom out",toolbarZoomZoomIn:"Zoom in",toolbarZoomPanLeft:"Pan left",toolbarZoomPanRight:"Pan right",toolbarZoomPanStart:"Pan to the start",toolbarZoomPanEnd:"Pan to the end",toolbarZoomReset:"Reset the zoom",contextMenuDownload:"Download",contextMenuToggleSeriesVisibility:"Toggle Visibility",contextMenuToggleOtherSeries:"Toggle Other Series",contextMenuZoomToCursor:"Zoom to here",contextMenuPanToCursor:"Pan to here",dialogHeaderChannel:"Channel",dialogHeaderLine:"Line",dialogHeaderFibonacciRange:"Fib Retracement",dialogHeaderDateRange:"Date Range",dialogHeaderPriceRange:"Price Range",dialogHeaderDatePriceRange:"Date and Price",dialogHeaderText:"Text",dialogInputAlign:"Align",dialogInputColorPicker:"Color",dialogInputColorPickerAltText:"Text Color",dialogInputFillColorPicker:"Fill",dialogInputFillColorPickerAltText:"Fill Color",dialogInputExtendChannelStart:"Extend channel start",dialogInputExtendChannelEnd:"Extend channel end",dialogInputExtendLineStart:"Extend line start",dialogInputExtendLineEnd:"Extend line end",dialogInputExtendAbove:"Extend above",dialogInputExtendBelow:"Extend below",dialogInputExtendLeft:"Extend left",dialogInputExtendRight:"Extend right",dialogInputReverse:"Reverse",dialogInputShowFill:"Show Fill",dialogInputFontSize:"Size",dialogInputFontSizeAltText:"Font Size",dialogInputLineStyle:"Dash",dialogInputPosition:"Position",dialogInputStrokeWidth:"Weight",dialogInputStrokeWidthAltText:"Line Weight",dialogInputFibonacciBands:"Bands",dialogInputFibonacciBandsAltText:"Fibonacci Bands",inputTextareaPlaceholder:"Add Text",measurerDateRangeBars:"${value}[number] bars",measurerPriceRangeValue:"${value}[number]",measurerPriceRangePercent:"${value}[percent]",measurerVolume:"Vol ${value}"},messageRegExp=/\$\{(\w+)}(?:\[(\w+)])?/gi,formatters={number:new Intl.NumberFormat("en-US"),percent:new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}),date:new Intl.DateTimeFormat("en-US",{dateStyle:"full"}),time:new Intl.DateTimeFormat("en-US",{timeStyle:"full"}),datetime:new Intl.DateTimeFormat("en-US",{dateStyle:"full",timeStyle:"full"})},defaultMessageFormatter=({defaultValue:t,variables:e})=>t?.replaceAll(messageRegExp,(i,s,n)=>{const r=e[s],o=n!=null?formatters[n]:null;return n!=null&&o==null&&logger_exports.warnOnce(`Format style [${n}] is not supported`),o!=null?o.format(r):typeof r=="number"?formatters.number.format(r):r instanceof Date?formatters.datetime.format(r):String(r)}),LocaleManager=class extends Listeners{constructor(){super(...arguments),this.localeText=void 0,this.getLocaleText=void 0}setLocaleText(t){this.localeText!==t&&(this.localeText=t,this.dispatch("locale-changed"))}setLocaleTextFormatter(t){this.getLocaleText=t,this.getLocaleText!==t&&(this.getLocaleText=t,this.dispatch("locale-changed"))}t(t,e={}){const{localeText:i=AG_CHARTS_LOCALE_EN_US,getLocaleText:s}=this,n=i[t];return s?.({key:t,defaultValue:n,variables:e})??defaultMessageFormatter({key:t,defaultValue:n,variables:e})??t}},HdpiCanvas=class{constructor(t){this.enabled=!0,this.width=600,this.height=300;const{width:e,height:i,canvasElement:s,willReadFrequently:n=!1}=t;this.pixelRatio=t.pixelRatio??getWindow("devicePixelRatio")??1,this.element=s??createElement("canvas"),this.element.style.display="block",this.element.style.width=(e??this.width)+"px",this.element.style.height=(i??this.height)+"px",this.element.width=Math.round((e??this.width)*this.pixelRatio),this.element.height=Math.round((i??this.height)*this.pixelRatio),this.context=this.element.getContext("2d",{willReadFrequently:n}),this.onEnabledChange(),this.resize(e??0,i??0,this.pixelRatio),debugContext(this.context)}drawImage(t,e=0,i=0){return t.drawImage(this.context.canvas,e,i)}toDataURL(t){return this.element.toDataURL(t)}resize(t,e,i){if(!(t>0&&e>0))return;const{element:s,context:n}=this;s.width=Math.round(t*i),s.height=Math.round(e*i),n.setTransform(i,0,0,i,0,0),s.style.width=t+"px",s.style.height=e+"px",this.width=t,this.height=e,this.pixelRatio=i}clear(){clearContext(this)}destroy(){this.element.remove(),this.element.width=0,this.element.height=0,this.context.clearRect(0,0,0,0),Object.freeze(this)}onEnabledChange(){this.element&&(this.element.style.display=this.enabled?"":"none")}};__decorateClass([ObserveChanges(t=>t.onEnabledChange())],HdpiCanvas.prototype,"enabled",2);var LayersManager=class{constructor(t){this.canvas=t,this.debug=Debug.create(!0,"scene"),this.layersMap=new Map,this.nextLayerId=0}get size(){return this.layersMap.size}resize(t,e,i){this.canvas.resize(t,e,i),this.layersMap.forEach(({canvas:s})=>s.resize(t,e,i))}addLayer(t){const{width:e,height:i,pixelRatio:s}=this.canvas,{name:n}=t,r=new HdpiOffscreenCanvas({width:e,height:i,pixelRatio:s});return this.layersMap.set(r,{id:this.nextLayerId++,name:n,canvas:r}),this.debug("Scene.addLayer() - layers",this.layersMap),r}removeLayer(t){this.layersMap.has(t)&&(this.layersMap.delete(t),t.destroy(),this.debug("Scene.removeLayer() - layers",this.layersMap))}clear(){for(const t of this.layersMap.values())t.canvas.destroy();this.layersMap.clear()}};function formatBytes(t){for(const e of["B","KB","MB","GB"]){if(t<1536)return`${t.toFixed(1)}${e}`;t/=1024}return`${t.toFixed(1)}TB}`}function memoryUsage(){if(!("memory"in performance))return;const{totalJSHeapSize:t,usedJSHeapSize:e,jsHeapSizeLimit:i}=performance.memory,s=[];for(const n of[e,t,i])typeof n=="number"&&s.push(formatBytes(n));return`Heap ${s.join(" / ")}`}function debugStats(t,e,i,s,n={},r=BBox.zero){if(!Debug.check("scene:stats","scene:stats:verbose"))return;const{layersRendered:o=0,layersSkipped:a=0,nodesRendered:l=0,nodesSkipped:c=0,opsPerformed:h=0,opsSkipped:u=0}=s??{},d=performance.now(),{start:p,...g}=e,m=Object.entries(g).map(([N,T])=>time(N,T)).filter(N=>N!=null).join(" + "),y=Object.entries(n).map(([N,T])=>`${N}: ${JSON.stringify(T)}`).join(" ; "),f=Debug.check("scene:stats:verbose"),x=memoryUsage(),v=[`${time("\u23F1\uFE0F",p,d)} (${m})`,`${y}`,`Layers: ${f?pct(o,a):t.size}`,f?`Nodes: ${pct(l,c)}`:null,f?`Ops: ${pct(h,u)}`:null,f&&x?x:null].filter(isString),b=new SimpleTextMeasurer(N=>i.measureText(N)),S=new Map(v.map(N=>[N,b.measureLines(N)])),A=Math.max(...Array.from(S.values(),N=>N.width)),D=accumulate(S.values(),N=>N.height),I=2+r.x;i.save(),i.fillStyle="white",i.fillRect(I,0,A,D),i.fillStyle="black";let L=0;for(const[N,T]of S.entries())L+=T.height,i.fillText(N,I,L);i.restore()}function prepareSceneNodeHighlight(t){const e=toArray(getWindow("agChartsSceneDebug")),i=[];for(const s of e)s==="layout"?i.push("seriesRoot","legend","root",/.*Axis-\d+-axis.*/):i.push(s);t.debugNodeSearch=i}function debugSceneNodeHighlight(t,e){t.save();for(const[i,s]of Object.entries(e)){const n=Transformable.toCanvas(s);if(!n){logger_exports.log(`Scene.render() - no bbox for debugged node [${i}].`);continue}t.globalAlpha=.8,t.strokeStyle="red",t.lineWidth=1,t.strokeRect(n.x,n.y,n.width,n.height),t.fillStyle="red",t.strokeStyle="white",t.font="16px sans-serif",t.textBaseline="top",t.textAlign="left",t.lineWidth=2,t.strokeText(i,n.x,n.y,n.width),t.fillText(i,n.x,n.y,n.width)}t.restore()}var skippedProperties=new Set,allowedProperties=new Set(["gradient","zIndex","clipRect","cachedBBox","childNodeCounts","path","__zIndex","name","__scalingCenterX","__scalingCenterY","__rotationCenterX","__rotationCenterY","_previousDatum","__fill","__lineDash","borderPath","borderClipPath","_clipPath"]);function nodeProps(t){const{...e}=t;for(const i of Object.keys(e))allowedProperties.has(i)||typeof e[i]!="number"&&typeof e[i]!="string"&&typeof e[i]!="boolean"&&(skippedProperties.add(i),delete e[i]);return e}function buildTree(t,e){if(!Debug.check(!0,"scene"))return{};let i=0;return{node:e==="json"?nodeProps(t):t,name:t.name??t.id,dirty:t.dirty,...Array.from(t.children(),s=>buildTree(s,e)).reduce((s,n)=>{let{name:r}=n;const{node:{visible:o,opacity:a,zIndex:l,translationX:c,translationY:h,rotation:u,scalingX:d,scalingY:p},node:g}=n;(!o||a<=0)&&(r=`(${r})`),Group.is(g)&&g.renderToOffscreenCanvas&&(r=`*${r}*`);const m=Array.isArray(l)?`(${l.join(", ")})`:l,y=[`${(i++).toString().padStart(3,"0")}|`,`${r??""}`,`z: ${m}`,c&&`x: ${c}`,h&&`y: ${h}`,u&&`r: ${u}`,d!=null&&d!==1&&`sx: ${d}`,p!=null&&p!==1&&`sy: ${p}`].filter(v=>!!v).join(" ");let f=y,x=1;for(;s[f]!=null&&x<100;)f=`${y} (${x++})`;return s[f]=n,s},{})}}function buildDirtyTree(t){if(!t.dirty)return{dirtyTree:{},paths:[]};const e=Array.from(t.children(),n=>buildDirtyTree(n)).filter(n=>n.paths.length>0),i=Group.is(t)?t.name??t.id:t.id,s=e.length?e.flatMap(n=>n.paths).map(n=>`${i}.${n}`):[i];return{dirtyTree:{name:i,node:t,dirty:t.dirty,...e.map(n=>n.dirtyTree).filter(n=>n.dirty!=null).reduce((n,r)=>(n[r.name??""]=r,n),{})},paths:s}}function pct(t,e){const i=t+e;return`${t} / ${i} (${Math.round(100*t/i)}%)`}function time(t,e,i){const s=i!=null?i-e:e;return`${t}: ${Math.round(s*100)/100}ms`}function accumulate(t,e){let i=0;for(const s of t)i+=e(s);return i}var Scene=class{constructor(t){this.debug=Debug.create(!0,"scene"),this.id=createId(this),this.root=null,this.pendingSize=null,this.isDirty=!1,this.canvas=new HdpiCanvas(t),this.layersManager=new LayersManager(this.canvas)}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(t){const{element:e}=this.canvas;return e.parentElement?.removeChild(e),t.appendChild(e),this}setRoot(t){return this.root===t?this:(this.isDirty=!0,this.root?._setLayerManager(),this.root=t,t&&(t.visible=!0,t._setLayerManager(this.layersManager)),this)}clear(){this.canvas.clear()}attachNode(t){return this.appendChild(t),()=>this.removeChild(t)}appendChild(t){return this.root?.appendChild(t),this}removeChild(t){return this.root?.removeChild(t),this}download(t,e){downloadUrl(this.canvas.toDataURL(e),t?.trim()??"image")}getDataURL(t){return this.canvas.toDataURL(t)}resize(t,e,i){return t=Math.round(t),e=Math.round(e),i??(i=this.pixelRatio),t>0&&e>0&&(t!==this.width||e!==this.height||i!==this.pixelRatio)?(this.pendingSize=[t,e,i],this.isDirty=!0,!0):!1}render(t){const{debugSplitTimes:e={start:performance.now()},extraDebugStats:i,seriesRect:s}=t??{},{canvas:n,canvas:{context:r}={},root:o,pendingSize:a,width:l,height:c,pixelRatio:h}=this;if(!r)return;const u=performance.now();if(a&&(this.layersManager.resize(...a),this.pendingSize=null),o&&!o.visible){this.isDirty=!1;return}if(o?.dirty===!1&&!this.isDirty){this.debug.check()&&this.debug("Scene.render() - no-op",{tree:buildTree(o,"console")}),debugStats(this.layersManager,e,r,void 0,i,s);return}const d={ctx:r,width:l,height:c,devicePixelRatio:h,debugNodes:{}};Debug.check("scene:stats:verbose")&&(d.stats={layersRendered:0,layersSkipped:0,nodesRendered:0,nodesSkipped:0,opsPerformed:0,opsSkipped:0}),prepareSceneNodeHighlight(d);let p=!1;if(o?.dirty!==!1&&(p=!0,n.clear()),o&&Debug.check("scene:dirtyTree")){const{dirtyTree:g,paths:m}=buildDirtyTree(o);Debug.create("scene:dirtyTree")("Scene.render() - dirtyTree",{dirtyTree:g,paths:m})}if(o&&p){if(o.visible&&o.preRender(d),this.debug.check()){const g=buildTree(o,"console");this.debug("Scene.render() - before",{canvasCleared:p,tree:g})}o.visible&&(r.save(),o.render(d),r.restore())}e["\u270D\uFE0F"]=performance.now()-u,r.verifyDepthZero?.(),this.isDirty=!1,debugStats(this.layersManager,e,r,d.stats,i,s),debugSceneNodeHighlight(r,d.debugNodes),o&&this.debug.check()&&this.debug("Scene.render() - after",{tree:buildTree(o,"console"),canvasCleared:p})}toSVG(){const{root:t,width:e,height:i}=this;if(t!=null)return Node.toSVG(t,e,i)}strip(){const{context:t,pixelRatio:e}=this.canvas;t.setTransform(e,0,0,e,0,0),this.layersManager.clear(),this.setRoot(null),this.isDirty=!1}destroy(){this.strip(),this.canvas.destroy(),Object.assign(this,{canvas:void 0})}};Scene.className="Scene";var CallbackCache=class{constructor(){this.cache=new WeakMap}call(t,...e){let i,s=this.cache.get(t);try{i=JSON.stringify(e)}catch{return this.invoke(t,e,s)}return s==null&&(s=new Map,this.cache.set(t,s)),s.has(i)?s.get(i):this.invoke(t,e,s,i)}invoke(t,e,i,s){try{const n=t(...e);return i&&s!=null&&i.set(s,n),n}catch(n){logger_exports.warnOnce("User callback errored, ignoring",n);return}}invalidateCache(){this.cache=new WeakMap}},AnnotationManager=class extends BaseManager{constructor(t){super(),this.annotationRoot=t,this.mementoOriginatorKey="annotations",this.annotations=[]}createMemento(){return this.annotations}guardMemento(t){return t==null||isArray(t)}restoreMemento(t,e,i){this.annotations=this.cleanData(i??[]).map(s=>{const n=this.getAnnotationTypeStyles(s.type);return mergeDefaults(s,n)}),this.listeners.dispatch("restore-annotations",{type:"restore-annotations",annotations:this.annotations})}updateData(t){this.annotations=this.cleanData(t??[])}attachNode(t){return this.annotationRoot.append(t),()=>(this.annotationRoot?.removeChild(t),this)}setAnnotationStyles(t){this.styles=t}getAnnotationTypeStyles(t){return this.styles?.[t]}cleanData(t){for(const e of t)"textAlign"in e&&delete e.textAlign;return t}},AxisManager=class{constructor(t){this.sceneRoot=t,this.axes=new Map,this.axisGridGroup=new Group({name:"Axes-Grids",zIndex:1}),this.axisGroup=new Group({name:"Axes",zIndex:2}),this.axisLabelGroup=new Group({name:"Axes-Labels",zIndex:13}),this.axisCrosslineRangeGroup=new Group({name:"Axes-Crosslines-Range",zIndex:4}),this.axisCrosslineLineGroup=new Group({name:"Axes-Crosslines-Line",zIndex:8}),this.axisCrosslineLabelGroup=new Group({name:"Axes-Crosslines-Label",zIndex:13}),this.sceneRoot.appendChild(this.axisGroup),this.sceneRoot.appendChild(this.axisGridGroup),this.sceneRoot.appendChild(this.axisLabelGroup),this.sceneRoot.appendChild(this.axisCrosslineRangeGroup),this.sceneRoot.appendChild(this.axisCrosslineLineGroup),this.sceneRoot.appendChild(this.axisCrosslineLabelGroup)}updateAxes(t,e){const i={axisNode:this.axisGroup,gridNode:this.axisGridGroup,labelNode:this.axisLabelGroup,crossLineRangeNode:this.axisCrosslineRangeGroup,crossLineLineNode:this.axisCrosslineLineGroup,crossLineLabelNode:this.axisCrosslineLabelGroup};for(const s of t)e.includes(s)||(s.detachAxis(i),s.destroy());for(const s of e)t?.includes(s)||s.attachAxis(i);this.axes.clear();for(const s of e){const n=s.createAxisContext();this.axes.has(n.direction)?this.axes.get(n.direction)?.push(n):this.axes.set(n.direction,[n])}}getAxisContext(t){return this.axes.get(t)??[]}destroy(){this.axes.clear(),this.sceneRoot.removeChild(this.axisGroup),this.sceneRoot.removeChild(this.axisGridGroup)}},DataService=class extends Listeners{constructor(t){super(),this.animationManager=t,this.dispatchOnlyLatest=!0,this.dispatchThrottle=0,this.requestThrottle=300,this.isLoadingInitialData=!1,this.isLoadingData=!1,this.freshRequests=[],this.requestCounter=0,this.debug=Debug.create(!0,"data-model","data-source"),this.throttledFetch=this.createThrottledFetch(this.requestThrottle),this.throttledDispatch=this.createThrottledDispatch(this.dispatchThrottle)}updateCallback(t){typeof t=="function"&&(this.debug("DataService - updated data source callback"),this.dataSourceCallback=t,this.isLoadingInitialData=!0,this.animationManager.skip(),this.dispatch("data-source-change"))}clearCallback(){this.dataSourceCallback=void 0}load(t){this.isLoadingData=!0,this.throttledFetch(t)}isLazy(){return this.dataSourceCallback!=null}isLoading(){return this.isLazy()&&(this.isLoadingInitialData||this.isLoadingData)}createThrottledFetch(t){return throttle(e=>this.fetch(e).catch(i=>logger_exports.error("callback failed",i)),t,{leading:!1,trailing:!0})}createThrottledDispatch(t){return throttle((e,i)=>{this.debug(`DataService - dispatching 'data-load' | ${e}`),this.dispatch("data-load",{type:"data-load",data:i})},t,{leading:!0,trailing:!0})}async fetch(t){if(!this.dataSourceCallback)throw new Error("DataService - [dataSource.getData] callback not initialised");const e=performance.now(),i=this.requestCounter++;this.debug(`DataService - requesting | ${i}`),this.freshRequests.push(i);let s;try{s=await this.dataSourceCallback(t),this.debug(`DataService - response | ${performance.now()-e}ms | ${i}`)}catch(r){this.debug(`DataService - request failed | ${i}`),logger_exports.errorOnce(`DataService - request failed | [${r}]`)}this.isLoadingInitialData=!1;const n=this.freshRequests.findIndex(r=>r===i);if(n===-1||this.dispatchOnlyLatest&&n!==this.freshRequests.length-1){this.debug(`DataService - discarding stale request | ${i}`);return}this.freshRequests=this.freshRequests.slice(n+1),this.freshRequests.length===0&&(this.isLoadingData=!1),Array.isArray(s)?this.throttledDispatch(i,s):this.dispatch("data-error")}};__decorateClass([ActionOnSet({newValue(t){this.throttledDispatch=this.createThrottledDispatch(t)}})],DataService.prototype,"dispatchThrottle",2),__decorateClass([ActionOnSet({newValue(t){this.throttledFetch=this.createThrottledFetch(t)}})],DataService.prototype,"requestThrottle",2);var AnimationBatch=class{constructor(t){this.maxAnimationTime=t,this.debug=Debug.create(!0,"animation"),this.controllers=new Map,this.stoppedCbs=new Set,this.currentPhase=0,this.phases=new Map(PHASE_ORDER.map(e=>[e,[]])),this.skipAnimations=!1,this.animationTimeConsumed=0,this.isReady=!1}get size(){return this.controllers.size}get consumedTimeMs(){return this.animationTimeConsumed}isActive(){return this.controllers.size>0}getActiveControllers(){return this.phases.get(PHASE_ORDER[this.currentPhase])??[]}checkOverlappingId(t){t!=null&&this.controllers.has(t)&&(this.controllers.get(t).stop(),this.debug(`Skipping animation batch due to update of existing animation: ${t}`),this.skip())}addAnimation(t){if(t.isComplete)return;if(PHASE_ORDER.indexOf(t.phase)=0&&e?.splice(i,1)}progress(t){if(!this.isReady)return;let e=t===0?.01:t;const i=()=>{const c=PHASE_ORDER[this.currentPhase];return{phaseControllers:[...this.getActiveControllers()],phase:c,phaseMeta:PHASE_METADATA[c]}};let{phase:s,phaseControllers:n,phaseMeta:r}=i();const o=()=>PHASE_ORDER[this.currentPhase]==null,a=()=>{for({phase:s,phaseControllers:n,phaseMeta:r}=i();!o()&&n.length===0;)this.currentPhase++,{phase:s,phaseControllers:n,phaseMeta:r}=i(),this.debug(`AnimationBatch - phase changing to ${s}`,{unusedTime:e},n)},l=this.controllers.size;this.debug(`AnimationBatch - ${t}ms; phase ${s} with ${n?.length} of ${l}`);do{const c=e,h=r.skipIfNoEarlierAnimations&&this.animationTimeConsumed===0;let u=0;for(const d of n)h?d.stop():e=Math.min(d.update(c),e),d.isComplete&&(u++,this.removeAnimation(d));this.animationTimeConsumed+=c-e,this.debug(`AnimationBatch - updated ${n.length} controllers; ${u} completed`),this.debug(`AnimationBatch - animationTimeConsumed: ${this.animationTimeConsumed}`),a()}while(e>0&&!o());this.animationTimeConsumed>this.maxAnimationTime&&(this.debug("Animation batch exceeded max animation time, skipping",[...this.controllers]),this.stop())}ready(){if(this.isReady)return;this.isReady=!0,this.debug(`AnimationBatch - ready; skipped: ${this.skipAnimations}`,[...this.controllers]);let t=!0;for(const[,e]of this.controllers)if(e.duration>0&&PHASE_METADATA[e.phase].skipIfNoEarlierAnimations!==!0){t=!1;break}if(!t)for(const[,e]of this.controllers)e.autoplay&&e.play(!0)}skip(t=!0){if(this.skipAnimations===!1&&t===!0){for(const e of this.controllers.values())e.stop();this.controllers.clear()}this.skipAnimations=t}play(){for(const t of this.controllers.values())t.play()}stop(){for(const t of this.controllers.values())try{t.stop(),this.removeAnimation(t)}catch(e){logger_exports.error("Error during animation stop",e)}this.dispatchStopped()}stopByAnimationId(t){if(t!=null&&this.controllers.has(t)){const e=this.controllers.get(t);e&&(e.stop(),this.removeAnimation(e))}}stopByAnimationGroupId(t){for(const e of this.controllers.values())e.groupId===t&&this.stopByAnimationId(e.id)}dispatchStopped(){this.stoppedCbs.forEach(t=>t()),this.stoppedCbs.clear()}isSkipped(){return this.skipAnimations}destroy(){this.stop(),this.controllers.clear()}},InteractionState=(t=>(t[t.Default=32]="Default",t[t.ZoomDrag=16]="ZoomDrag",t[t.Annotations=8]="Annotations",t[t.ContextMenu=4]="ContextMenu",t[t.Animation=2]="Animation",t[t.AnnotationsSelected=1]="AnnotationsSelected",t[t.Clickable=41]="Clickable",t[t.Focusable=34]="Focusable",t[t.Keyable=43]="Keyable",t[t.ContextMenuable=36]="ContextMenuable",t[t.AnnotationsMoveable=9]="AnnotationsMoveable",t[t.AnnotationsDraggable=57]="AnnotationsDraggable",t[t.ZoomDraggable=50]="ZoomDraggable",t[t.ZoomClickable=34]="ZoomClickable",t[t.ZoomWheelable=59]="ZoomWheelable",t[t.All=63]="All",t))(InteractionState||{}),InteractionManager=class{constructor(){this.stateQueue=34}pushState(t){this.stateQueue|=t}popState(t){this.stateQueue&=~t}isState(t){return!!(this.stateQueue&-this.stateQueue&t)}};function validAnimationDuration(t){return t==null?!0:!isNaN(t)&&t>=0&&t<=2}var AnimationManager=class{constructor(t,e){this.interactionManager=t,this.chartUpdateMutex=e,this.defaultDuration=1e3,this.batch=new AnimationBatch(this.defaultDuration*1.5),this.debug=Debug.create(!0,"animation"),this.events=new EventEmitter,this.rafAvailable=typeof requestAnimationFrame<"u",this.isPlaying=!0,this.requestId=null,this.skipAnimations=!0,this.currentAnonymousAnimationId=0}addListener(t,e){return this.events.on(t,e)}animate(t){const e=this.batch;try{e.checkOverlappingId(t.id)}catch(a){this.failsafeOnError(a);return}let{id:i}=t;i==null&&(i=`__${this.currentAnonymousAnimationId}`,this.currentAnonymousAnimationId+=1);const s=this.isSkipped()||t.phase==="none";s&&this.debug("AnimationManager - skipping animation");const{delay:n,duration:r}=t;if(!validAnimationDuration(n))throw new Error(`Animation delay of ${n} is unsupported (${i})`);if(!validAnimationDuration(r))throw new Error(`Animation duration of ${r} is unsupported (${i})`);const o=new Animation({...t,id:i,skip:s,autoplay:this.isPlaying?t.autoplay:!1,phase:t.phase,defaultDuration:this.defaultDuration});if(!this.forceTimeJump(o,this.defaultDuration))return this.batch.addAnimation(o),o}play(){if(!this.isPlaying){this.isPlaying=!0,this.debug("AnimationManager.play()");try{this.batch.play()}catch(t){this.failsafeOnError(t)}this.requestAnimation()}}stop(){this.isPlaying=!1,this.cancelAnimation(),this.debug("AnimationManager.stop()"),this.batch.stop()}stopByAnimationId(t){try{this.batch.stopByAnimationId(t)}catch(e){this.failsafeOnError(e)}}stopByAnimationGroupId(t){try{this.batch.stopByAnimationGroupId(t)}catch(e){this.failsafeOnError(e)}}reset(){this.isPlaying?(this.stop(),this.play()):this.stop()}skip(t=!0){this.skipAnimations=t}isSkipped(){return!this.rafAvailable||this.skipAnimations||this.batch.isSkipped()}isActive(){return this.isPlaying&&this.batch.isActive()}skipCurrentBatch(){this.debug.check()&&this.debug("AnimationManager - skipCurrentBatch()",{stack:new Error().stack}),this.batch.skip()}isSkippingFrames(){return!0}scheduleAnimationFrame(t){this.requestId=getWindow().requestAnimationFrame(e=>{t(e).catch(i=>logger_exports.error(i))})}forceTimeJump(t,e){return!1}requestAnimation(){if(!this.rafAvailable||!this.batch.isActive()||this.requestId!==null)return;let t;const e=async i=>{const s=()=>{const n=i-(t??i);t=i,this.debug("AnimationManager - onAnimationFrame()",{controllersCount:this.batch.size,deltaTime:n}),this.interactionManager.pushState(2);try{this.batch.progress(n)}catch(r){this.failsafeOnError(r)}this.events.emit("animation-frame",{type:"animation-frame",deltaMs:n})};this.isSkippingFrames()?await this.chartUpdateMutex.acquireImmediately(s):await this.chartUpdateMutex.acquire(s),this.batch.isActive()?this.scheduleAnimationFrame(e):(this.batch.stop(),this.events.emit("animation-stop",{type:"animation-stop",deltaMs:this.batch.consumedTimeMs}))};this.events.emit("animation-start",{type:"animation-start",deltaMs:0}),this.scheduleAnimationFrame(e)}cancelAnimation(){this.requestId!==null&&(cancelAnimationFrame(this.requestId),this.requestId=null,this.startBatch())}failsafeOnError(t,e=!0){logger_exports.error("Error during animation, skipping animations",t),e&&this.cancelAnimation()}startBatch(t){this.debug(`AnimationManager - startBatch() with skipAnimations=${t}.`),this.reset(),this.batch.destroy(),this.batch=new AnimationBatch(this.defaultDuration*1.5),t===!0&&this.batch.skip()}endBatch(){this.batch.isActive()?(this.batch.ready(),this.requestAnimation()):(this.interactionManager.popState(2),this.batch.isSkipped()&&this.batch.skip(!1))}onBatchStop(t){this.batch.stoppedCbs.add(t)}destroy(){this.stop(),this.events.clear()}},ChartEventManager=class extends BaseManager{seriesEvent(t){this.listeners.dispatch(t,{type:t})}seriesKeyNavZoom(t,e){const i={type:"series-keynav-zoom",delta:t,widgetEvent:e};this.listeners.dispatch("series-keynav-zoom",i)}legendItemClick(t,e,i,s,n){const r={type:"legend-item-click",legendType:t,series:e,itemId:i,enabled:s,legendItemName:n};this.listeners.dispatch("legend-item-click",r)}legendItemDoubleClick(t,e,i,s,n,r){const o={type:"legend-item-double-click",legendType:t,series:e,itemId:i,enabled:s,legendItemName:r,numVisibleItems:n};this.listeners.dispatch("legend-item-double-click",o)}},ContextMenuRegistry=class{constructor(){this.defaultActions=[],this.disabledActions=new Set,this.hiddenActions=new Set,this.listeners=new Listeners}static check(t,e){return e.type===t}static checkCallback(t,e,i){return t===e}dispatchContext(t,e,i,s){const{sourceEvent:n}=e,r=s?.x??e.canvasX,o=s?.y??e.canvasY;n.stopPropagation();const a={type:t,x:r,y:o,context:i,sourceEvent:n};this.listeners.dispatch("",a)}addListener(t){return this.listeners.addListener("",t)}filterActions(t){return this.defaultActions.filter(e=>e.id!=null&&!this.hiddenActions.has(e.id)&&["all",t].includes(e.type))}registerDefaultAction(t){const e=t.id!=null&&!this.defaultActions.some(({id:i})=>i===t.id);return e&&this.defaultActions.push(t),()=>{const i=e?this.defaultActions.findIndex(({id:s})=>s===t.id):-1;i!==-1&&this.defaultActions.splice(i,1)}}enableAction(t){this.disabledActions.delete(t)}disableAction(t){this.disabledActions.add(t)}showAction(t){this.hiddenActions.add(t)}hideAction(t){this.hiddenActions.delete(t)}isDisabled(t){return this.disabledActions.has(t)}},HighlightManager=class extends BaseManager{constructor(){super(...arguments),this.highlightStates=new StateTracker}updateHighlight(t,e){const{activeHighlight:i}=this;this.highlightStates.set(t,e),this.activeHighlight=this.highlightStates.stateValue(),this.isEqual(this.activeHighlight,i)||this.listeners.dispatch("highlight-change",{type:"highlight-change",currentHighlight:this.activeHighlight,previousHighlight:i,callerId:t})}getActiveHighlight(){return this.activeHighlight}isEqual(t,e){return t===e||t!=null&&e!=null&&t?.series===e?.series&&t?.itemId===e?.itemId&&t?.datum===e?.datum}};function datumBoundaryPoints(t,e){if(t==null||e.length===0)return[!1,!1];const i=t.valueOf(),s=e[0],n=e[e.length-1];if(typeof s=="string")return[i===s,i===n];let r=s.valueOf(),o=n.valueOf();return r>o&&([r,o]=[o,r]),[i===r,i===o]}function datumStylerProperties(t,e,i,s,n){const{xValue:r,yValue:o}=t,[a,l]=datumBoundaryPoints(o,n),[c,h]=datumBoundaryPoints(r,s);return{datum:t,xKey:e,yKey:i,xValue:r,yValue:o,first:c,last:h,min:a,max:l}}function visibleRangeIndices(t,[e,i],s){const n=findMinIndex(0,t-1,o=>{const a=s(o)?.[1]??NaN;return!Number.isFinite(a)||a>e})??0;let r=findMaxIndex(0,t-1,o=>{const a=s(o)?.[0]??NaN;return!Number.isFinite(a)||a=0&&(a+=1),l&&a<0&&(a-=1),ce){l=!0;continue}n(c)&&(o+=1)}return o}var TooltipManager=class{constructor(t,e){this.domManager=t,this.tooltip=e,this.stateTracker=new StateTracker,this.suppressState=new StateTracker(!1),this.appliedState=null,e.setup(t),t.addListener("hidden",()=>this.tooltip.hide())}updateTooltip(t,e,i){this.tooltip.enabled&&(i??(i=this.stateTracker.get(t)?.content),this.stateTracker.set(t,{content:i,meta:e}),this.applyStates())}removeTooltip(t){this.tooltip.enabled&&(this.stateTracker.delete(t),this.applyStates())}suppressTooltip(t){this.suppressState.set(t,!0)}unsuppressTooltip(t){this.suppressState.delete(t)}destroy(){this.domManager.removeStyles("tooltip")}applyStates(){const t=this.stateTracker.stateId(),e=t?this.stateTracker.get(t):null;if(this.suppressState.stateValue()||e?.meta==null||e?.content==null){this.appliedState=null,this.tooltip.hide();return}const i=this.domManager.getBoundingClientRect(),s=this.tooltip.bounds==="extended"?this.domManager.getOverlayClientRect():i;if(this.appliedState?.content===e?.content){const n=this.tooltip.isVisible();this.tooltip.show(s,i,e?.meta,null,n)}else this.tooltip.show(s,i,e?.meta,e?.content);this.appliedState=e}static makeTooltipMeta(t,e,i){const{canvasX:s,canvasY:n}=t,r=e.properties.tooltip,o={canvasX:s,canvasY:n,enableInteraction:r.interaction?.enabled??!1,lastPointerEvent:{type:t.type,canvasX:s,canvasY:n},showArrow:r.showArrow,position:{type:r.position.type,xOffset:r.position.xOffset,yOffset:r.position.yOffset}},a=getDatumRefPoint(e,i);return(r.position.type==="node"||r.position.type==="sparkline")&&a?{...o,canvasX:a.canvasX,canvasY:a.canvasY}:o}isEnteringInteractiveTooltip(t){const{tooltip:e}=this,i=t.sourceEvent.relatedTarget;return e.interactive&&e.enabled&&e.isVisible()&&e.contains(i)}},DRAG_THRESHOLD_PX=3,DOUBLE_TAP_TIMER_MS=505;function makeSynthetic(t,e,i){const{offsetX:s,offsetY:n,clientX:r,clientY:o,currentX:a,currentY:l,sourceEvent:c}=i;return{type:e,device:t,offsetX:s,offsetY:n,clientX:r,clientY:o,currentX:a,currentY:l,sourceEvent:c}}function checkDistanceSquared(t,e){const i=t*t+e*e,s=DRAG_THRESHOLD_PX*DRAG_THRESHOLD_PX;return i>=s}var DragInterpreter=class{constructor(t){this.destroyFns=[],this.listeners=new Listeners,this.isDragging=!1,this.touch={distanceTravelledX:0,distanceTravelledY:0,clientX:0,clientY:0},this.destroyFns.push(t.addListener("touchstart",this.onTouchStart.bind(this)),t.addListener("touchmove",this.onTouchMove.bind(this)),t.addListener("touchend",this.onTouchEnd.bind(this)),t.addListener("mousemove",this.onMouseMove.bind(this)),t.addListener("dblclick",this.onDblClick.bind(this)),t.addListener("drag-start",this.onDragStart.bind(this)),t.addListener("drag-move",this.onDragMove.bind(this)),t.addListener("drag-end",this.onDragEnd.bind(this)))}destroy(){this.destroyFns.forEach(t=>t()),this.listeners.destroy()}addListener(t,e){return this.listeners.addListener(t,e)}dispatch(t){this.listeners.dispatch(t.type,t)}onTouchStart(t){const{clientX:e,clientY:i}=t.sourceEvent.targetTouches.item(0)??{clientX:1/0,clientY:1/0};this.touch.distanceTravelledX=0,this.touch.distanceTravelledY=0,this.touch.clientX=e,this.touch.clientY=i}onTouchMove(t){const{clientX:e,clientY:i}=t.sourceEvent.targetTouches.item(0)??{clientX:1/0,clientY:1/0};this.touch.distanceTravelledX+=Math.abs(this.touch.clientX-e),this.touch.distanceTravelledY+=Math.abs(this.touch.clientY-i),this.touch.clientX=e,this.touch.clientY=i}onTouchEnd(t){t.sourceEvent.preventDefault()}onMouseMove(t){this.dispatch(t)}onDblClick(t){this.dispatch({device:"mouse",...t})}onDragStart(t){this.dragStartEvent=t}onDragMove(t){this.dragStartEvent!=null&&checkDistanceSquared(t.originDeltaX,t.originDeltaY)&&(this.dispatch(this.dragStartEvent),this.dispatch({...this.dragStartEvent,type:"drag-move"}),this.dragStartEvent=void 0,this.isDragging=!0),this.isDragging&&this.dispatch(t)}onDragEnd(t){if(this.isDragging){this.dispatch(t),this.isDragging=!1;return}if(t.device==="mouse"){const e=makeSynthetic("mouse","click",t);this.dispatch(e)}else if(t.sourceEvent.type==="touchend"){if(checkDistanceSquared(this.touch.distanceTravelledX,this.touch.distanceTravelledY))return;const e=makeSynthetic("touch","click",t);this.dispatch(e);const i=Date.now();if(this.lastClickTime!==void 0&&i-this.lastClickTime<=DOUBLE_TAP_TIMER_MS){const s=makeSynthetic(t.device,"dblclick",t);this.dispatch(s),this.lastClickTime=void 0}else this.lastClickTime=i}}},DOMManagerWidget=class extends NativeWidget{constructor(t){super(t)}addChildToDOM(){}removeChildFromDOM(){}},WidgetSet=class{constructor(t){this.seriesWidget=new DOMManagerWidget(t.getParent("series-area")),this.chartWidget=new DOMManagerWidget(t.getParent("canvas-proxy")),this.containerWidget=new DOMManagerWidget(t.getParent("canvas-container")),this.containerWidget.addChild(this.chartWidget),this.chartWidget.addChild(this.seriesWidget),this.seriesDragInterpreter=new DragInterpreter(this.seriesWidget)}destroy(){this.seriesDragInterpreter.destroy(),this.seriesWidget.destroy(),this.chartWidget.destroy(),this.containerWidget.destroy()}},Vec4={bottomCenter,center,clone,collides,end,from,height,round:round2,start,topCenter,origin,width};function start(t){return{x:t.x1,y:t.y1}}function end(t){return{x:t.x2,y:t.y2}}function topCenter(t){return{x:(t.x1+t.x2)/2,y:Math.min(t.y1,t.y2)}}function center(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function bottomCenter(t){return{x:(t.x1+t.x2)/2,y:Math.max(t.y1,t.y2)}}function width(t){return Math.abs(t.x2-t.x1)}function height(t){return Math.abs(t.y2-t.y1)}function round2(t){return{x1:Math.round(t.x1),y1:Math.round(t.y1),x2:Math.round(t.x2),y2:Math.round(t.y2)}}function clone(t){return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}function collides(t,e){const i=normalise(t),s=normalise(e);return i.x1<=s.x2&&i.x2>=s.x1&&i.y1<=s.y2&&i.y2>=s.y1}function normalise(t){return{x1:Math.min(t.x1,t.x2),x2:Math.max(t.x1,t.x2),y1:Math.min(t.y1,t.y2),y2:Math.max(t.y1,t.y2)}}function from(t,e,i,s){if(typeof t=="number")return{x1:t,y1:e,x2:i,y2:s};if("width"in t)return{x1:t.x,y1:t.y,x2:t.x+t.width,y2:t.y+t.height};throw new Error(`Values can not be converted into a vector4: [${JSON.stringify(t)}] [${e}] [${i}] [${s}]`)}function origin(){return{x1:0,y1:0,x2:0,y2:0}}function normalize2(t,e,i,s,n){return e+(s-e)*((n-t)/(i-t))}function unnormalize(t,e,i,s,n){return t+(n-e)*((i-t)/(s-e))}function calcWorldAxis(t,e,i){return[unnormalize(t,i.min,e,i.max,0),unnormalize(t,i.min,e,i.max,1)]}function calcWorldVec4(t,e,i){const[s,n]=calcWorldAxis(t.x1,t.x2,e),[r,o]=calcWorldAxis(t.y1,t.y2,i);return{x1:s,x2:n,y1:r,y2:o}}function panAxesUnnormalized(t,e,i,s,n,r){if(i<=n&&r<=s)return i;const o=n-i,a=r-s,l=Math.abs(o)attachDescription((e,i)=>!ContinuousScale.is(t?.scale)&&!OrdinalTimeScale.is(t?.scale)||e==null||i.end==null?!0:e<=i.end,"to be less than end"),ZoomManager=class extends BaseManager{constructor(t,e){super(),this.fireChartEvent=t,this.mementoOriginatorKey="zoom",this.axisZoomManagers=new Map,this.state=new StateTracker(void 0,"initial"),this.axes=[],this.didLayoutAxes=!1,this.autoScaleYAxis=new ZoomManagerAutoScaleAxis,this.lastRestoredState=void 0,this.independentAxes=!1,this.navigatorModule=!1,this.zoomModule=!1,this.pendingMemento=void 0,this.destroyFns.push(e.addListener("layout:complete",()=>{const{pendingMemento:i}=this,s=!this.didLayoutAxes;this.didLayoutAxes=!0,i?this.restoreMemento(i.version,i.mementoVersion,i.memento):s&&this.autoScaleYZoom("zoom-manager")}))}createMemento(){return this.getMementoRanges()}guardMemento(t,e){if(t==null)return!0;if(!isObject(t))return!1;for(const o of Object.keys(t))if(!expectedMementoKeys.includes(o))return!1;const i=this.getPrimaryAxis("x"),s=this.getPrimaryAxis("y"),n={rangeX:{start:and(or(number,date),rangeValidator(i)),end:or(number,date)},rangeY:{start:and(or(number,date),rangeValidator(s)),end:or(number,date)},ratioX:{start:and(ratio,lessThan("end")),end:ratio},ratioY:{start:and(ratio,lessThan("end")),end:ratio},autoScaledAxes:arrayOf(union("y"))},r=validate(t,n);return r.errors.length>0?(e.push(...r.errors.map(o=>o.message)),!1):!0}restoreMemento(t,e,i){const{independentAxes:s}=this;if(!this.axes||!this.didLayoutAxes){this.pendingMemento={version:t,mementoVersion:e,memento:i};return}this.pendingMemento=void 0;const n=this.getDefinedZoom();if(i?.rangeX?n.x=this.rangeToRatio(i.rangeX,"x")??{min:0,max:1}:i?.ratioX?n.x={min:i.ratioX.start??0,max:i.ratioX.end??1}:n.x={min:0,max:1},!this.navigatorModule||this.zoomModule){let a=i?.autoScaledAxes?.includes("y");i?.rangeY?(n.y=this.rangeToRatio(i.rangeY,"y")??{min:0,max:1},a??(a=!1)):i?.ratioY?(n.y={min:i.ratioY.start??0,max:i.ratioY.end??1},a??(a=!1)):(n.y={min:0,max:1},a??(a=!0)),n.autoScaleYAxis=a}if(this.lastRestoredState=n,s!==!0){this.updateZoom("zoom-manager",n);return}const r=this.getPrimaryAxis("x"),o=this.getPrimaryAxis("y");for(const a of[r,o])a&&this.updateAxisZoom("zoom-manager",a.id,n[a.direction])}updateAxes(t){this.axes=t;const e=new Map(t.map(i=>[i.id,this.axisZoomManagers.get(i.id)]));this.axisZoomManagers.clear();for(const i of t)this.axisZoomManagers.set(i.id,e.get(i.id)??new AxisZoomManager(i));this.state.size>0&&t.length>0&&this.updateZoom(this.state.stateId(),this.state.stateValue())}setIndependentAxes(t=!0){this.independentAxes=t}setAutoScaleYAxis(t,e){this.autoScaleYAxis.enabled=t,this.autoScaleYAxis.padding=e}setNavigatorEnabled(t=!0){this.navigatorModule=t}setZoomModuleEnabled(t=!0){this.zoomModule=t}isZoomEnabled(){return this.zoomModule}updateZoom(t,e){if(e?.x&&(e.x.min<0||e.x.max>1)&&(logger_exports.warnOnce(`Attempted to update x-axis zoom to an invalid ratio of [{ min: ${e.x.min}, max: ${e.x.max} }], expecting a ratio of 0 to 1, ignoring.`),e.x=void 0),e?.y&&(e.y.min<0||e.y.max>1)&&(logger_exports.warnOnce(`Attempted to update y-axis zoom to an invalid ratio of [{ min: ${e.y.min}, max: ${e.y.max} }], expecting a ratio of 0 to 1, ignoring.`),e.y=void 0),this.axisZoomManagers.size===0){const s=this.state.stateId();(s==="initial"||s===t)&&this.state.set(t,e);return}this.state.set(t,e);const i=e?.autoScaleYAxis;i!=null&&(this.autoScaleYAxis.manuallyAdjusted=!i),this.axisZoomManagers.forEach(s=>{s.updateZoom(t,e?.[s.getDirection()])}),this.applyChanges(t)}updateAxisZoom(t,e,i){this.axisZoomManagers.get(e)?.updateZoom(t,i),this.applyChanges(t)}resetZoom(t){this.autoScaleYAxis.manuallyAdjusted=!1;const e=this.getRestoredZoom();this.updateZoom(t,{x:{min:e?.x?.min??0,max:e?.x?.max??1},y:{min:e?.y?.min??0,max:e?.y?.max??1},autoScaleYAxis:e?.autoScaleYAxis??!0})}resetAxisZoom(t,e){const s=this.axisZoomManagers.get(e)?.getDirection();if(s==null)return;const n=this.getRestoredZoom();if(s==="y"){const r=n?.autoScaleYAxis??!0;this.autoScaleYAxis.manuallyAdjusted=!r}this.updateAxisZoom(t,e,n?.[s]??{min:0,max:1})}setAxisManuallyAdjusted(t,e){this.axisZoomManagers.get(e)?.getDirection()==="y"&&(this.autoScaleYAxis.manuallyAdjusted=!0)}updatePrimaryAxisZoom(t,e,i){const s=this.getPrimaryAxis(e);s&&this.updateAxisZoom(t,s.id,i)}panToBBox(t,e,i){if(!this.isZoomEnabled())return!1;const s=this.getZoom();if(s===void 0||!s.x&&!s.y)return!1;if(!(e.width>0&&e.height>0&&Math.abs(i.width)<=Math.abs(e.width)&&Math.abs(i.height)<=Math.abs(e.height)))return logger_exports.warnOnce("cannot pan to target BBox - chart too small?"),!1;const r=calcPanToBBoxRatios(e,s,i);return this.independentAxes?(this.updatePrimaryAxisZoom(t,"x",r.x),this.updatePrimaryAxisZoom(t,"y",r.y)):this.updateZoom(t,r),!0}fireZoomPanStartEvent(t){this.listeners.dispatch("zoom-pan-start",{type:"zoom-pan-start",callerId:t})}extendToEnd(t,e,i){return this.extendWith(t,e,s=>Number(s)-i)}extendWith(t,e,i){const s=this.getPrimaryAxis(e);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;const[,r]=n,o=i(r),a=this.rangeToRatio({start:o,end:r},e);a&&this.updateZoom(t,{[e]:a})}updateWith(t,e,i){const s=this.getPrimaryAxis(e);if(!s)return;const n=this.getDomainExtents(s);if(!n)return;let[r,o]=n;[r,o]=i(r,o);const a=this.rangeToRatio({start:r,end:o},e);a&&this.updateZoom(t,{[e]:a})}getZoom(){let t,e;if(this.axisZoomManagers.forEach(i=>{i.getDirection()==="x"?t??(t=i.getZoom()):i.getDirection()==="y"&&(e??(e=i.getZoom()))}),t||e)return{x:t,y:e}}getAxisZoom(t){return this.axisZoomManagers.get(t)?.getZoom()??{min:0,max:1}}getAxisZooms(){const t={};for(const[e,i]of this.axisZoomManagers.entries())t[e]={direction:i.getDirection(),zoom:i.getZoom()};return t}getRestoredZoom(){return this.lastRestoredState}getPrimaryAxisId(t){return this.getPrimaryAxis(t)?.id}isVisibleItemsCountAtLeast(t,e){const i=this.getPrimaryAxis("x"),s=this.getPrimaryAxis("y"),n=new Set;let r=0;const o=[t.x.min,t.x.max],a=[t.y.min,t.y.max];for(const l of i?.boundSeries??[]){n.add(l.id);const c=e-(r??0),h=l.getVisibleItems(o,a,c);if(r+=h,r>=e)return!0}for(const l of s?.boundSeries??[]){if(n.has(l.id))continue;const c=e-(r??0),h=l.getVisibleItems(o,a,c);if(r+=h,r>=e)return!0}return n.size===0}getMementoRanges(){const t=this.getDefinedZoom();let e;return this.autoScaleYAxis.enabled&&(e=this.autoScaleYAxis.manuallyAdjusted?[]:["y"]),{rangeX:this.getRangeDirection(t.x,"x"),rangeY:this.getRangeDirection(t.y,"y"),ratioX:{start:t.x.min,end:t.x.max},ratioY:{start:t.y.min,end:t.y.max},autoScaledAxes:e}}autoScaleYZoom(t,e=!0){if(!this.isZoomEnabled())return;const{independentAxes:i,autoScaleYAxis:s}=this,n=this.getZoom();if(n?.x==null||!s.enabled||s.manuallyAdjusted)return;const{padding:r}=s;let o;if(n.x?.min===0&&n.x?.max===1?o={min:0,max:1}:i?o=this.primaryAxisZoom("y",n.x,{padding:r}):o=this.combinedAxisZoom("y",n.x,{padding:r}),o!=null){if(i){const a=this.getPrimaryAxis("y");(a==null?void 0:this.axisZoomManagers.get(a.id))?.updateZoom("zoom-manager",o)}else for(const a of this.axisZoomManagers.values())a.getDirection()==="y"&&a.updateZoom("zoom-manager",o);e&&this.applyChanges(t)}}applyChanges(t){if(this.autoScaleYZoom(t,!1),!Array.from(this.axisZoomManagers.values(),s=>s.applyChanges()).includes(!0))return;const i={};for(const[s,n]of this.axisZoomManagers.entries())i[s]=n.getZoom();this.listeners.dispatch("zoom-change",{type:"zoom-change",...this.getZoom(),axes:i,callerId:t}),this.fireChartEvent({type:"zoom",...this.getMementoRanges()})}getRangeDirection(t,e){const i=this.getPrimaryAxis(e);if(!i||!ContinuousScale.is(i.scale)&&!OrdinalTimeScale.is(i.scale))return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,r]=s;let o,a;return n<=r?(o=i.scale.invert(0),a=i.scale.invert(n+(r-n)*t.max)):(o=i.scale.invert(n-(n-r)*t.min),a=i.scale.invert(0)),{start:o,end:a}}rangeToRatio(t,e){const i=this.getPrimaryAxis(e);if(!i)return;const s=this.getDomainPixelExtents(i);if(!s)return;const[n,r]=s;let o=t.start==null?n:i.scale.convert?.(t.start),a=t.end==null?r:i.scale.convert?.(t.end);if(!isFiniteNumber(o)||!isFiniteNumber(a))return;const[l,c]=[Math.min(n,r),Math.max(n,r)];if(oc){logger_exports.warnOnce(`Invalid range start [${t.start}], expecting a value between [${i.scale.invert?.(n)}] and [${i.scale.invert?.(r)}], ignoring.`);return}if(ac){logger_exports.warnOnce(`Invalid range end [${t.end}], expecting a value between [${i.scale.invert?.(n)}] and [${i.scale.invert?.(r)}], ignoring.`);return}o=Math.min(c,Math.max(l,o)),a=Math.min(c,Math.max(l,a));const h=r-n,u=Math.abs((o-n)/h),d=Math.abs((a-n)/h);return{min:u,max:d}}getPrimaryAxis(t){return this.axes?.find(e=>e.direction===t)}getDomainExtents(t){const{domain:e}=t.scale,i=e.at(0),s=e.at(-1);if(!(i==null||s==null))return[i,s]}getDomainPixelExtents(t){const{domain:e}=t.scale,i=t.scale.convert?.(e.at(0)),s=t.scale.convert?.(e.at(-1));if(!(!isFiniteNumber(i)||!isFiniteNumber(s)))return[i,s]}getDefinedZoom(){const t=this.getZoom();return{x:{min:t?.x?.min??0,max:t?.x?.max??1},y:{min:t?.y?.min??0,max:t?.y?.max??1}}}zoomBounds(t,e,i,s){const n=t.scale,r=n.range;n.range=[0,1];const o=e.scale,a=o.range;o.range=[0,1];let l=1,c=!1,h=0,u=!1;for(const g of e.boundSeries){const{connectsToYAxis:m}=g,y=g.getRange("y",[i.min,i.max]);for(const f of y){const x=o.convert(f);Number.isFinite(x)&&(xh&&(h=x,u=!m||f>0))}}if(isFiniteNumber(e.min)&&(l=0),isFiniteNumber(e.max)&&(h=1),n.range=r,o.range=a,l>=h)return;const d=(c?s:0)+(u?s:0),p=Math.min((h-l)*(1+d),1);if(!(p<=0)){if(c&&u){const g=(h+l)/2;l=g-p/2,h=g+p/2}else!c&&u?h=l+p:c&&!u&&(l=h-p);return l<0?(h+=-l,l=0):h>1&&(l-=h-1,h=1),{min:l,max:h}}}primaryAxisZoom(t,e,{padding:i=0}={}){const s=t==="x"?"y":"x",n=this.getPrimaryAxis(s),r=this.getPrimaryAxis(t);if(!(n==null||r==null))return this.zoomBounds(n,r,e,i)}combinedAxisZoom(t,e,{padding:i=0}={}){const s=t==="x"?"y":"x",n=new Map;for(const l of this.axes)if(l.direction===s)for(const c of l.boundSeries)n.set(c,l);let r=1,o=0;for(const l of this.axes)if(l.direction===t)for(const c of l.boundSeries){const h=n.get(c);if(h==null)continue;const u=this.zoomBounds(h,l,e,i);if(u==null)return;r=Math.min(r,u.min),o=Math.max(o,u.max)}const a=1e-6;if(r1-a&&(o=1),!(r>o))return{min:r,max:o}}},AxisZoomManager=class{constructor(t){this.axis=t;const[e=0,i=1]=t.visibleRange;this.state=new StateTracker({min:e,max:i}),this.currentZoom=this.state.stateValue()}getDirection(){return this.axis.direction}updateZoom(t,e){this.state.set(t,e)}getZoom(){return deepClone(this.state.stateValue())}hasChanges(){const t=this.currentZoom,e=this.state.stateValue();return t.min!==e.min||t.max!==e.max}applyChanges(){const t=this.hasChanges();return this.currentZoom=this.state.stateValue(),t}},SeriesLabelLayoutManager=class{constructor(){this.labelData=new Map}updateLabels(t,e,i=BBox.zero){const s={x:-e.left,y:-e.top,width:i.width+e.left+e.right,height:i.height+e.top+e.bottom},n=new Set(t.map(o=>o.id));for(const o of this.labelData.keys())n.has(o)||this.labelData.delete(o);for(const o of t){const a=o.getLabelData();a.every(isPointLabelDatum)&&this.labelData.set(o.id,a)}const r=placeLabels(this.labelData,s,5);for(const o of t)o.updatePlacedLabelData?.(r.get(o.id)??[])}},LegendManager=class extends BaseManager{constructor(){super(...arguments),this.mementoOriginatorKey="legend",this.legendDataMap=new Map}createMemento(){return this.getData().filter(({hideInLegend:t,isFixed:e})=>!t&&!e).map(({enabled:t,seriesId:e,itemId:i,legendItemName:s})=>({visible:t,seriesId:e,itemId:i,legendItemName:s}))}guardMemento(t){return t==null||isArray(t)}restoreMemento(t,e,i){i?.forEach(s=>{const{seriesId:n,data:r}=this.getRestoredData(s)??{};!n||!r||this.updateData(n,r)}),this.update()}getRestoredData(t){const{seriesId:e,itemId:i,legendItemName:s,visible:n}=t;if(e){const o=(this.legendDataMap.get(e)??[]).map(a=>{const l=a.seriesId===e&&(!i||a.itemId===i);return l&&a.isFixed&&this.warnFixed(a.seriesId,a.itemId),!a.isFixed&&l?{...a,enabled:n}:a});return{seriesId:e,data:o}}if(!(i==null&&s==null))for(const r of this.getData()){if(i!=null&&r.itemId!==i||s!=null&&r.legendItemName!==s)continue;if(r.isFixed){this.warnFixed(r.seriesId,i);return}const o=(this.legendDataMap.get(r.seriesId)??[]).map(a=>a.itemId===i||a.legendItemName===s?{...a,enabled:n}:a);return{seriesId:r.seriesId,data:o}}}warnFixed(t,e){logger_exports.warnOnce(`The legend item with seriesId [${t}] and itemId [${e}] is not configurable, this series item cannot be toggled through the legend.`)}update(t){this.listeners.dispatch("legend-change",{type:"legend-change",legendData:t??this.getData()})}updateData(t,e=[]){this.legendDataMap.set(t,e)}clearData(){this.legendDataMap.clear()}toggleItem({enabled:t,seriesId:e,itemId:i,legendItemName:s}){if(s){this.getData().forEach(a=>{const l=(this.legendDataMap.get(a.seriesId)??[]).map(c=>c.legendItemName===s?{...c,enabled:t}:c);this.updateData(a.seriesId,l)});return}const n=this.getData(e),r=n.length===1,o=n.map(a=>i==null&&r||a.itemId===i?{...a,enabled:t}:a);this.updateData(e,o)}getData(t){return t?this.legendDataMap.get(t)??[]:[...this.legendDataMap].reduce((e,[i,s])=>e.concat(s),[])}getDatum({seriesId:t,itemId:e}={}){return this.getData(t).find(i=>i.itemId===e)}getSeriesEnabled(t){const e=this.getData(t);if(e.length>0)return e.some(i=>i.enabled)}getItemEnabled({seriesId:t,itemId:e}={}){return this.getDatum({seriesId:t,itemId:e})?.enabled??!0}},SeriesStateManager=class{constructor(){this.groups={}}registerSeries({internalId:t,seriesGrouping:e,visible:i,type:s}){var n;e&&((n=this.groups)[s]??(n[s]={}),this.groups[s][t]={grouping:e,visible:i})}updateSeries({internalId:t,seriesGrouping:e,visible:i,type:s}){if(!e)return;const n=this.groups[s]?.[t];n&&(n.grouping=e,n.visible=i)}deregisterSeries({internalId:t,type:e}){this.groups[e]&&delete this.groups[e][t],this.groups[e]&&Object.keys(this.groups[e]).length===0&&delete this.groups[e]}getVisiblePeerGroupIndex({type:t,seriesGrouping:e,visible:i}){if(!e)return{visibleGroupCount:i?1:0,visibleSameStackCount:i?1:0,index:0};const s=new Set,n=new Set;for(const o of Object.values(this.groups[t]??{}))o.visible&&(s.add(o.grouping.groupIndex),o.grouping.groupIndex===e.groupIndex&&n.add(o.grouping.stackIndex));const r=Array.from(s);return r.sort((o,a)=>o-a),{visibleGroupCount:r.length,visibleSameStackCount:n.size,index:r.indexOf(e.groupIndex)}}},ChartUpdateType=(t=>(t[t.FULL=0]="FULL",t[t.UPDATE_DATA=1]="UPDATE_DATA",t[t.PROCESS_DATA=2]="PROCESS_DATA",t[t.PERFORM_LAYOUT=3]="PERFORM_LAYOUT",t[t.SERIES_UPDATE=4]="SERIES_UPDATE",t[t.PRE_SCENE_RENDER=5]="PRE_SCENE_RENDER",t[t.SCENE_RENDER=6]="SCENE_RENDER",t[t.NONE=7]="NONE",t))(ChartUpdateType||{}),UpdateService=class{constructor(t){this.updateCallback=t,this.events=new EventEmitter}addListener(t,e){return this.events.on(t,e)}removeListener(t,e){return this.events.on(t,e)}destroy(){this.events.clear()}update(t=0,e){this.updateCallback(t,e)}dispatchUpdateComplete(){this.events.emit("update-complete",{type:"update-complete"})}dispatchPreDomUpdate(){this.events.emit("pre-dom-update",{type:"pre-dom-update"})}dispatchPreSceneRender(){this.events.emit("pre-scene-render",{type:"pre-scene-render"})}dispatchProcessData({series:t}){this.events.emit("process-data",{type:"process-data",series:t})}},ChartContext=class{constructor(t,e){this.callbackCache=new CallbackCache,this.chartEventManager=new ChartEventManager,this.highlightManager=new HighlightManager,this.layoutManager=new LayoutManager,this.localeManager=new LocaleManager,this.seriesStateManager=new SeriesStateManager,this.stateManager=new StateManager,this.seriesLabelLayoutManager=new SeriesLabelLayoutManager,this.contextModules=[];const{scene:i,root:s,syncManager:n,container:r,fireEvent:o,updateCallback:a,updateMutex:l,styleContainer:c,chartType:h}=e;this.chartService=t,this.syncManager=n,this.domManager=new DOMManager(r,c),this.widgets=new WidgetSet(this.domManager);const u=this.domManager.addChild("canvas","scene-canvas",i?.canvas.element);this.scene=i??new Scene({canvasElement:u}),this.scene.setRoot(s),this.axisManager=new AxisManager(s),this.legendManager=new LegendManager,this.annotationManager=new AnnotationManager(t.annotationRoot),this.chartTypeOriginator=new ChartTypeOriginator(t),this.interactionManager=new InteractionManager,this.contextMenuRegistry=new ContextMenuRegistry,this.updateService=new UpdateService(a),this.proxyInteractionService=new ProxyInteractionService(this.localeManager,this.domManager),this.historyManager=new HistoryManager(this.chartEventManager),this.animationManager=new AnimationManager(this.interactionManager,l),this.dataService=new DataService(this.animationManager),this.tooltipManager=new TooltipManager(this.domManager,t.tooltip),this.zoomManager=new ZoomManager(o,this.layoutManager);for(const d of moduleRegistry.byType("context")){if(!d.chartTypes.includes(h))continue;const p=d.moduleFactory(this);this.contextModules.push(p),this[d.contextKey]=p}}destroy(){this.animationManager.destroy(),this.highlightManager.destroy(),this.axisManager.destroy(),this.callbackCache.invalidateCache(),this.chartEventManager.destroy(),this.domManager.destroy(),this.highlightManager.destroy(),this.proxyInteractionService.destroy(),this.syncManager.destroy(),this.tooltipManager.destroy(),this.zoomManager.destroy(),this.widgets.destroy(),this.contextModules.forEach(t=>t.destroy())}},ChartHighlight=class extends BaseProperties{constructor(){super(...arguments),this.range="tooltip"}};__decorateClass([Validate(UNION(["tooltip","node"],"a range"))],ChartHighlight.prototype,"range",2);function setsEqual(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function idsMapEqual(t,e){if(t==null||e==null)return t===e;if(t.size!==e.size)return!1;for(const[i,s]of t){const n=e.get(i);if(n==null||!setsEqual(s,n))return!1}return!0}function propsEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;is&&(i[0]=s),i[1]e&&(this.domain[0]=e),this.domain[1]Math.max(r,o.length),0);let s=1<<32-Math.clz32(e);e===s/2&&(s=s>>>1),this.maxLevelSize=s;const n=new Float64Array((s*2-1)*2).fill(NaN);for(const r of t)for(let o=0;od)&&(n[h]=a)}for(let r=s/2|0;r>=1;r=r/2|0){const o=r-1|0,a=o+r|0;for(let l=0;lm?g:m}}this.buffer=n}computeRangeInto(t,e,i,s,n,r,o){const a=n+r-1;if(a=i)return o;if(n>=e&&a1&&(s=s*2|0,r=r/2|0,this.computeRangeInto(t,e,i,s+1|0,n,r,o),this.computeRangeInto(t,e,i,s+2|0,n+r,r,o));return o}rangeBetween(t,e){if(t>e)return[NaN,NaN];const{maxLevelSize:i,buffer:s}=this,n=[1/0,-1/0];return this.computeRangeInto(s,t,e,0,0,i,n),n}get range(){const{buffer:t}=this;return[t[MIN],t[MAX]]}},DOMAIN_RANGES=Symbol("domain-ranges");function toKeyString(t){return t.map(e=>isObject(e)?JSON.stringify(e):e).join("-")}function round3(t){return Number.isInteger(t)?t:Math.abs(t)>1e4?Math.trunc(t):Math.round(t*1e4)/1e4}function fixNumericExtent(t){const e=t?.map(Number);return e?.every(Number.isFinite)?e:[]}function getMissCount(t,e){return e?.get(t.id)??0}function isScoped(t){return"scopes"in t&&Array.isArray(t.scopes)}var INVALID_VALUE=Symbol("invalid");function createArray(t,e){const i=[];for(let s=0;s{let i=e;for(const s of t)i=i[s];return i}}var DataModel=class{constructor(t,e="standalone",i=!1){this.opts=t,this.mode=e,this.suppressFieldDotNotation=i,this.debug=Debug.create(!0,"data-model"),this.scopeCache=new Map,this.keys=[],this.values=[],this.aggregates=[],this.groupProcessors=[],this.propertyProcessors=[],this.reducers=[],this.processors=[],this.markScopeDatumInvalid=function(a,l,c,h){for(const u of a)h.has(u)||h.set(u,createArray(l.length,!1)),h.get(u)[c]=!0};let s=!0;for(const a of t.props){if(a.type==="key"&&!s)throw new Error("AG Charts - internal config error: keys must come before values.");a.type==="value"&&s&&(s=!1)}const n=({matchGroupIds:a=[]})=>{for(const l of a)if(this.values.every(c=>c.groupId!==l))throw new Error(`AG Charts - internal config error: matchGroupIds properties must match defined groups (${l}).`)},r=new Set,o=new Set;for(const a of t.props){const l=a.type==="key"?r:o;switch(isScoped(a)&&a.scopes?.forEach(c=>l.add(c)),a.type){case"key":this.keys.push({...a,index:this.keys.length,missing:new Map});break;case"value":if(a.property==null)throw new Error(`AG Charts - internal config error: no properties specified for value definitions: ${JSON.stringify(a)}`);this.values.push({...a,index:this.values.length,missing:new Map});break;case"aggregate":n(a),this.aggregates.push({...a,index:this.aggregates.length});break;case"group-value-processor":n(a),this.groupProcessors.push({...a,index:this.groupProcessors.length});break;case"property-value-processor":this.propertyProcessors.push({...a,index:this.propertyProcessors.length});break;case"reducer":this.reducers.push({...a,index:this.reducers.length});break;case"processor":this.processors.push({...a,index:this.processors.length});break}}if(this.opts.groupByKeys||this.opts.groupByFn!=null){const a=new Set(o.values());if(r.forEach(l=>a.delete(l)),a.size>0)throw new Error(`AG Charts - scopes missing key for grouping, illegal configuration: ${[...a.values()]}`)}}resolveProcessedDataDefById(t,e){const i=this.scopeCache.get(t.id)?.get(e);if(!i)throw new Error(`AG Charts - didn't find property definition for [${e}, ${t.id}]`);return{index:i.index,def:i}}resolveProcessedDataIndexById(t,e){return this.resolveProcessedDataDefById(t,e).index}resolveKeysById(t,e,i){const s=this.resolveProcessedDataIndexById(t,e),n=i.keys[s];if(n==null)throw new Error(`AG Charts - didn't find keys for [${e}, ${t.id}]`);return n.get(t.id)}hasColumnById(t,e){return this.scopeCache.get(t.id)?.get(e)!=null}resolveColumnById(t,e,i){const s=this.resolveProcessedDataIndexById(t,e),n=i.columns?.[s];if(n==null)throw new Error(`AG Charts - didn't find column for [${e}, ${t.id}]`);return n}*forEachDatum(t,e,i){const s=e.columnScopes.findIndex(n=>n.has(t.id));for(const n of i.datumIndices[s]??[])yield e.columns[s][n]}*forEachGroupDatum(t,e){const i=e.columnScopes.findIndex(r=>r.has(t.id)),s={groupIndex:0,columnIndex:i},n=[];for(const r of e.groups){s.group=r;let o=0;for(const a of r.datumIndices[i]??n)s.datumIndex=a,s.valueIndex=o++,yield s;s.groupIndex++}}*forEachGroupDatumTuple(t,e){const s={columnIndex:e.columnScopes.findIndex(n=>n.has(t.id)),datumIndexes:[void 0,void 0,void 0]};for(const n of this.forEachGroupDatum(t,e))s.group=s.nextGroup,s.groupIndex=s.nextGroupIndex,s.nextGroup=n.group,s.nextGroupIndex=n.groupIndex,s.datumIndexes[0]=s.datumIndexes[1],s.datumIndexes[1]=s.datumIndexes[2],s.datumIndexes[2]=n.datumIndex,s.group!=null&&s.datumIndexes[1]!=null&&(yield s);s.group=s.nextGroup,s.groupIndex=s.nextGroupIndex,s.nextGroup=void 0,s.nextGroupIndex=void 0,s.datumIndexes[0]=s.datumIndexes[1],s.datumIndexes[1]=s.datumIndexes[2],s.datumIndexes[2]=void 0,s.group!=null&&s.datumIndexes[1]!=null&&(yield s)}getDomain(t,e,i,s){return this.getDomainsByType(i??"value",s)?.[this.resolveProcessedDataIndexById(t,e)]??[]}getDomainBetweenRange(t,e,[i,s],n){const r=e.map(c=>this.resolveProcessedDataIndexById(t,c)),o=r.join(":"),a=n[DOMAIN_RANGES];let l=a.get(o);if(l==null){const c=r.map(h=>n.columns[h]);l=new RangeLookup(c),a.set(o,l)}return l.rangeBetween(i,s)}getDomainsByType(t,e){switch(t){case"key":return e.domain.keys;case"value":return e.domain.values;case"aggregate":return e.domain.aggValues;case"group-value-processor":return e.domain.groups;default:return null}}processData(t){const{opts:{groupByKeys:e,groupByFn:i},aggregates:s,groupProcessors:n,reducers:r,processors:o,propertyProcessors:a}=this,l=performance.now();if(e&&this.keys.length===0)return;let c=this.extractData(t);e?c=this.groupData(c):i&&(c=this.groupData(c,i(c))),n.length>0&&c.type==="grouped"&&this.postProcessGroups(c),s.length>0&&c.type==="ungrouped"?this.aggregateUngroupedData(c):s.length>0&&c.type==="grouped"&&this.aggregateGroupedData(c),a.length>0&&this.postProcessProperties(c),r.length>0&&this.reduceData(c),o.length>0&&this.postProcessData(c),this.warnDataMissingProperties(t);const h=performance.now();return c.time=h-l,this.debug.check()&&logProcessedData(c),this.processScopeCache(),c}warnDataMissingProperties(t){if(t.size!==0)for(const e of iterate(this.keys,this.values))for(const[i,s]of e.missing){if(s<(t.get(i)?.length??1/0))continue;const n=i==null?"":` for ${i}`;logger_exports.warnOnce(`the key '${e.property}' was not found in any data element${n}.`)}}processScopeCache(){this.scopeCache.clear();for(const t of iterate(this.keys,this.values,this.aggregates))if(t.idsMap)for(const[e,i]of t.idsMap)for(const s of i)if(!this.scopeCache.has(e))this.scopeCache.set(e,new Map([[s,t]]));else{if(this.scopeCache.get(e)?.has(s))throw new Error("duplicate definition ids on the same scope are not allowed.");this.scopeCache.get(e).set(s,t)}}valueGroupIdxLookup({matchGroupIds:t}){const e=[];for(const[i,s]of this.values.entries())(!t||s.groupId&&t.includes(s.groupId))&&e.push(i);return e}valueIdxLookup(t,e){const i=t==null||t.length===0,s=typeof e=="string"?e:e.id,n=o=>{if(o.idsMap){for(const[a,l]of o.idsMap)if(t?.includes(a)&&l.has(s))return!0}return!1},r=this.values.reduce((o,a,l)=>((a.scopes==null||i&&!a.scopes.length||a.scopes.some(h=>t?.includes(h)))&&(a.property===s||a.id===s||n(a))&&o.push(l),o),[]);if(r.length===0)throw new Error(`AG Charts - configuration error, unknown property ${JSON.stringify(e)} in scope(s) ${JSON.stringify(t)}`);return r}extractData(t){const{dataDomain:e,processValue:i,allScopesHaveSameDefs:s}=this.initDataDomainProcessor(),{keys:n,values:r}=this,{invalidData:o,invalidKeys:a,allKeyMappings:l}=this.extractKeys(n,t,i),{columns:c,columnScopes:h,partialValidDataCount:u,maxDataLength:d}=this.extractValues(o,r,t,a,i),p=g=>{const m=e.get(g),y=m.getDomain();return ContinuousDomain.is(m)&&y[0]>y[1]?[]:y};return{type:"ungrouped",input:{count:d},scopes:new Set(t.keys()),dataSources:t,aggregation:void 0,keys:[...l.values()],columns:c,columnScopes:h,invalidKeys:a,invalidData:o,domain:{keys:n.map(p),values:r.map(p)},defs:{allScopesHaveSameDefs:s,keys:n,values:r},partialValidDataCount:u,time:0,[DOMAIN_RANGES]:new Map}}extractKeys(t,e,i){const s=new Map,n=new Map,r=new Map;let o,a;const l=(c,h)=>{const u=a.get(c);o.set(h,o.get(u)),s.has(u)&&(s.set(h,s.get(u)),n.set(h,n.get(u)))};for(const c of t){const{invalidValue:h,scopes:u}=c;o=new Map,a=new Map,r.set(c,o);for(const d of u??[]){const p=e.get(d)??[];if(a.has(p)){l(p,d);continue}const g=[];o.set(d,g),a.set(p,d);let m,y;for(let f=0;fi.get(y))).size>1)throw new Error(`AG Charts - more than one data source for: ${JSON.stringify(c)}`);const d=new Set(c.scopes),p=first(c.scopes),g=i.get(p),m=g.map((y,f)=>{const x=s.get(p)?.[f];let v=n(c,y,f,c.scopes);return(x||v===INVALID_VALUE)&&this.markScopeDatumInvalid(c.scopes,g,f,t),x?v=h:v===INVALID_VALUE&&(r+=1,v=h),v});o.push(m),a.push(d),l=Math.max(l,m.length)}return{columns:o,columnScopes:a,partialValidDataCount:r,maxDataLength:l}}groupData(t,e){var i;const s=new Map,{keys:n,columns:r,columnScopes:o,invalidKeys:a,invalidData:l}=t,c=t.scopes,h=new Set;for(const p of c){const g=r.map((b,S)=>S).filter(b=>!h.has(b)&&o[b].has(p));if(g.length===0)continue;for(const b of g)h.add(b);const m=new Set;for(const b of g)for(const S of o[b])m.add(S);const y=n.map(b=>b.get(p)).filter(b=>b!=null),f=r[first(g)],x=l?.get(p),v=a?.get(p);for(let b=0;bL[b]);if(S==null||S.length===0)throw new Error("AG Charts - no keys found for scope: "+p);const A=e?.(S)??S,D=toKeyString(A),I=s.get(D)??{keys:A,datumIndices:[],validScopes:c};if(s.has(D)||s.set(D,I),x?.[b]===!0){I.validScopes===c&&(I.validScopes=new Set(c.values()));for(const L of m)I.validScopes.delete(L)}if(I.validScopes.size!==0)for(const L of g)(i=I.datumIndices)[L]??(i[L]=[]),I.datumIndices[L].push(b)}}const u=[],d=[];for(const{keys:p,datumIndices:g,validScopes:m}of s.values())m?.size!==0&&(u.push(p),d.push({datumIndices:g,keys:p,aggregation:[],validScopes:m}));return{...t,type:"grouped",domain:{...t.domain,groups:u},groups:d}}aggregateUngroupedData(t){const e=this.aggregates.map(()=>[1/0,-1/0]);t.domain.aggValues=e;const{keys:i,columns:s,dataSources:n}=t,r=first(n.keys()),o=n.get(r);t.aggregation=o?.map((a,l)=>{const c=[];for(const[h,u]of this.aggregates.entries()){const d=this.valueGroupIdxLookup(u);let p=u.groupAggregateFunction?.()??[1/0,-1/0];const g=d.map(x=>s[x][l]),m=datumKeys(i,r,l),y=m!=null?u.aggregateFunction(g,m):void 0;y&&(p=u.groupAggregateFunction?.(y,p)??ContinuousDomain.extendDomain(y,p));const f=u.finalFunction?.(p)??p;if(u.round===!0)for(const x in f)f[x]=round3(f[x]);c[h]=f,ContinuousDomain.extendDomain(f,e[h])}return c})}aggregateGroupedData(t){const e=this.aggregates.map(()=>[1/0,-1/0]);t.domain.aggValues=e;const{columns:i}=t;for(const[s,n]of this.aggregates.entries()){const r=this.valueGroupIdxLookup(n);for(const o of t.groups){if(o.aggregation??(o.aggregation=[]),o.validScopes?.size===0)continue;const a=o.keys;let l=n.groupAggregateFunction?.()??[1/0,-1/0];const c=Math.max(...r.map(u=>o.datumIndices[u]?.length??0));for(let u=0;ui[g][o.datumIndices[g]?.[u]]),p=n.aggregateFunction(d,a);p&&(l=n.groupAggregateFunction?.(p,l)??ContinuousDomain.extendDomain(p,l))}const h=n.finalFunction?.(l)??l;if(n.round===!0)for(const u in h)h[u]=round3(h[u]);o.aggregation[s]=h,ContinuousDomain.extendDomain(h,e[s])}}}postProcessGroups(t){const{groupProcessors:e}=this,{columnScopes:i,columns:s,invalidData:n,scopes:r}=t;for(const o of e){const a=this.valueGroupIdxLookup(o),l=o.adjust()();for(const c of t.groups)c.validScopes===r&&l(s,a,c);for(const c of a){const u=this.values[c].valueType==="category",d=s[c],p=first(i[c]),g=n?.get(p),m=u?new DiscreteDomain:new ContinuousDomain;for(let y=0;yh.get(o)).filter(h=>h!=null),l=a.map(()=>{}),c=e.get(o);for(let h=0;h{for(const c of iterate(t,e))c.valueType==="category"?s.set(c,new DiscreteDomain):(s.set(c,new ContinuousDomain),r&&(r=(c.scopes??[]).length===i.size))};o();const a=this.buildAccessors(iterate(t,e));return{dataDomain:s,processValue:(c,h,u,d)=>{let p,g;if(a.has(c.property)){try{g=a.get(c.property)(h)}catch{}p=g!=null}else p=c.property in h,g=p?h[c.property]:c.missingValue;c.forceValue!=null&&(g=p&&isNegative(g)?-1*c.forceValue:c.forceValue,p=!0);const m="missingValue"in c;if(!p&&!m)if(typeof d=="string"){const y=c.missing.get(d)??0;c.missing.set(d,y+1)}else for(const y of d){const f=c.missing.get(y)??0;c.missing.set(y,f+1)}if(s.has(c)||o(),p&&c.validation?.(g,h,u)===!1)if("invalidValue"in c)g=c.invalidValue;else return this.mode!=="integrated"&&logger_exports.warnOnce(`invalid value of type [${typeof g}] for [${c.scopes} / ${c.id}] ignored:`,`[${g}]`),INVALID_VALUE;return c.processor&&(n.has(c)||n.set(c,c.processor()),g=n.get(c)?.(g)),s.get(c)?.extend(g),g},initDataDomain:o,scopes:i,allScopesHaveSameDefs:r}}buildAccessors(t){const e=new Map;if(this.suppressFieldDotNotation)return e;for(const i of t){if(!(i.property.includes(".")||i.property.includes("[")))continue;const n=getPathComponents(i.property);if(n==null){logger_exports.warnOnce("Invalid property path [%s]",i.property);continue}const r=createPathAccessor(n);e.set(i.property,r)}return e}};function logProcessedData(t){const e=(i,s)=>{s.length>0&&(logger_exports.log(`DataModel.processData() - ${i}`),logger_exports.table(s))};logger_exports.log("DataModel.processData() - processedData",t),e("Key Domains",t.domain.keys),e("Group Domains",t.domain.groups??[]),e("Value Domains",t.domain.values),e("Aggregate Domains",t.domain.aggValues??[])}var _DataController=class dt{constructor(e,i){this.mode=e,this.suppressFieldDotNotation=i,this.debug=Debug.create(!0,"data-model"),this.requested=[],this.status="setup"}async request(e,i,s){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");return new Promise((n,r)=>{this.requested.push({id:e,opts:s,data:i,resolve:n,reject:r})})}execute(e){if(this.status!=="setup")throw new Error("AG Charts - data request after data setup phase.");this.status="executed",this.debug("DataController.execute() - requested",this.requested);const i=this.validateRequests(this.requested);this.debug("DataController.execute() - validated",i);const s=this.mergeRequested(i);this.debug("DataController.execute() - merged",s),this.debug.check()&&(getWindow().processedData=[]);const n=[];for(const{data:r,ids:o,opts:a,resolves:l,rejects:c}of s){const h=e?.find(p=>canReuseCachedData(p,r,o,a));let u,d;if(h==null)try{u=new DataModel(a,this.mode,this.suppressFieldDotNotation);const p=new Map(i.map(g=>[g.id,g.data]));d=u.processData(p)}catch(p){c.forEach(g=>g(p));continue}else({dataModel:u,processedData:d}=h);n.push({opts:a,data:r,ids:o,dataModel:u,processedData:d}),this.debug.check()&&getWindow("processedData").push(d),d?.partialValidDataCount===0?l.forEach(p=>p({dataModel:u,processedData:d})):d?this.splitResult(u,d,o,l):c.forEach(p=>p(new Error("AG Charts - no processed data generated")))}return n}validateRequests(e){const i=[];for(const[s,n]of e.entries())s>0&&n.data.length!==e[0].data.length&&n.opts.groupByData===!1&&n.opts.groupByKeys===!1?n.reject(new Error("all series[].data arrays must be of the same length and have matching keys.")):i.push(n);return i}mergeRequested(e){const i=[];for(const s of e){const n=i.find(dt.groupMatch(s));n?n.push(s):i.push([s])}return i.map(dt.mergeRequests)}splitResult(e,i,s,n){for(let r=0;rh.type==="key").map(h=>h.property).join(";")}const{groupByData:n,groupByKeys:r=!1,groupByFn:o,props:a}=i,l=s(a);return([c])=>(n===!1||c.data===e)&&(c.opts.groupByKeys??!1)===r&&c.opts.groupByFn===o&&s(c.opts.props)===l}static mergeRequests(e){const i=new Set(["key","group-value-processor"]);return e.reduce((s,{id:n,data:r,resolve:o,reject:a,opts:{props:l,...c}})=>{s.ids.push(n),s.rejects.push(a),s.resolves.push(o),s.data??(s.data=r),s.opts??(s.opts={...c,props:[]});for(const h of l){const u={...h,scopes:[n],data:r};dt.createIdsMap(n,u);const d=s.opts.props.find(p=>p.type===u.type&&(i.has(p.type)||p.data===u.data)&&dt.deepEqual(p,u));if(!d){s.opts.props.push(u);continue}d.scopes??(d.scopes=[]),d.scopes.push(...u.scopes??[]),(d.type==="key"||d.type==="value")&&u.idsMap?.size&&dt.mergeIdsMap(u.idsMap,d.idsMap)}return s},{ids:[],rejects:[],resolves:[],data:null,opts:null})}static mergeIdsMap(e,i){for(const[s,n]of e){const r=i.get(s);if(r==null)i.set(s,new Set(n));else for(const o of n)r.add(o)}}static createIdsMap(e,i){i.id!=null&&(i.idsMap??(i.idsMap=new Map),i.idsMap.has(e)?i.idsMap.get(e).add(i.id):i.idsMap.set(e,new Set([i.id])))}static deepEqual(e,i){if(e===i)return!0;if(e&&i&&typeof e=="object"&&typeof i=="object"){if(e.constructor!==i.constructor)return!1;let s,n;if(Array.isArray(e)){if(n=e.length,n!==i.length)return!1;for(s=n-1;s>=0;s--)if(!dt.deepEqual(e[s],i[s]))return!1;return!0}const r=Object.keys(e);if(n=r.length,n!==Object.keys(i).length)return!1;for(s=n-1;s>=0;s--){const o=r[s];if(!dt.skipKeys.has(o)&&(!Object.hasOwn(i,o)||!dt.deepEqual(e[o],i[o])))return!1}return!0}return!1}};_DataController.skipKeys=new Set(["id","idsMap","type","scopes","data"]);var DataController=_DataController,AxisRegistry=class{constructor(){this.axesMap=new Map,this.themeTemplates=new Map}register(t,e){this.axesMap.set(t,e.moduleFactory),e.themeTemplate&&this.setThemeTemplate(t,e.themeTemplate)}create(t,e){const i=this.axesMap.get(t);if(i)return i(e);throw new Error(`AG Charts - unknown axis type: ${t}`)}has(t){return this.axesMap.has(t)}keys(){return this.axesMap.keys()}setThemeTemplate(t,e){return this.themeTemplates.set(t,e),this}getThemeTemplate(t){return this.themeTemplates.get(t)}},axisRegistry=new AxisRegistry,EXPECTED_ENTERPRISE_MODULES=[{type:"root",optionsKey:"animation",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"annotations",chartTypes:["cartesian"]},{type:"root",optionsKey:"background",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],optionsInnerKey:"image"},{type:"root",optionsKey:"foreground",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],optionsInnerKey:"image"},{type:"root",optionsKey:"chartToolbar",chartTypes:["cartesian"]},{type:"root",optionsKey:"contextMenu",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"statusBar",chartTypes:["cartesian"],identifier:"status-bar"},{type:"root",optionsKey:"dataSource",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"]},{type:"root",optionsKey:"sync",chartTypes:["cartesian"]},{type:"root",optionsKey:"zoom",chartTypes:["cartesian","topology"]},{type:"root",optionsKey:"ranges",chartTypes:["cartesian"]},{type:"legend",optionsKey:"gradientLegend",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],identifier:"gradient"},{type:"root",optionsKey:"navigator",chartTypes:["cartesian"]},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"angle-number"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-category"},{type:"axis",optionsKey:"axes[]",chartTypes:["polar"],identifier:"radius-number"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"bar",community:!0},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"line",community:!0},{type:"axis",optionsKey:"axes[]",chartTypes:["cartesian"],identifier:"ordinal-time"},{type:"axis-option",optionsKey:"crosshair",chartTypes:["cartesian"]},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"box-plot"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"candlestick"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"cone-funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"funnel"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"ohlc"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"heatmap"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-area"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"range-bar"},{type:"series",optionsKey:"series[]",chartTypes:["cartesian"],identifier:"waterfall"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"nightingale"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-area"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radar-line"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-bar"},{type:"series",optionsKey:"series[]",chartTypes:["polar"],identifier:"radial-column"},{type:"series",optionsKey:"series[]",chartTypes:["hierarchy"],identifier:"sunburst"},{type:"series",optionsKey:"series[]",chartTypes:["hierarchy"],identifier:"treemap"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-marker"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-shape-background"},{type:"series",optionsKey:"series[]",chartTypes:["topology"],identifier:"map-line-background"},{type:"series",optionsKey:"series[]",chartTypes:["flow-proportion"],identifier:"chord"},{type:"series",optionsKey:"series[]",chartTypes:["flow-proportion"],identifier:"sankey"},{type:"series",optionsKey:"series[]",chartTypes:["standalone"],identifier:"pyramid"},{type:"series",optionsKey:"series[]",chartTypes:["gauge"],identifier:"linear-gauge"},{type:"series",optionsKey:"series[]",chartTypes:["gauge"],identifier:"radial-gauge"},{type:"series-option",optionsKey:"errorBar",chartTypes:["cartesian"],identifier:"error-bars"},{type:"context",contextKey:"sharedToolbar",chartTypes:["cartesian"]}];function isEnterpriseSeriesType(t){return EXPECTED_ENTERPRISE_MODULES.some(e=>e.type==="series"&&e.identifier===t)}function getEnterpriseSeriesChartTypes(t){return EXPECTED_ENTERPRISE_MODULES.find(e=>e.type==="series"&&e.identifier===t)?.chartTypes}function isEnterpriseCartesian(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="cartesian")==="cartesian"}function isEnterprisePolar(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="polar")==="polar"}function isEnterpriseHierarchy(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="hierarchy")==="hierarchy"}function isEnterpriseTopology(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="topology")==="topology"}function isEnterpriseFlowProportion(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="flow-proportion")==="flow-proportion"}function isEnterpriseStandalone(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="standalone")==="standalone"}function isEnterpriseGauge(t){return getEnterpriseSeriesChartTypes(t)?.find(i=>i==="gauge")==="gauge"}function isEnterpriseModule(t){return t.packageType==="enterprise"}function verifyIfModuleExpected(t){if(!isEnterpriseModule(t))throw new Error("AG Charts - internal configuration error, only enterprise modules need verification.");const e=EXPECTED_ENTERPRISE_MODULES.find(i=>i.type===t.type&&("optionsKey"in i&&"optionsKey"in t?i.optionsKey===t.optionsKey:!0)&&("contextKey"in i&&"contextKey"in t?i.contextKey===t.contextKey:!0)&&i.identifier===t.identifier&&t.chartTypes.every(s=>i.chartTypes.includes(s)));return e&&(e.useCount??(e.useCount=0),e.useCount++),e!=null}function getUnusedExpectedModules(){return EXPECTED_ENTERPRISE_MODULES.filter(({useCount:t})=>t==null||t===0)}var LegendRegistry=class{constructor(){this.legendMap=new Map,this.themeTemplates=new Map}register(t,{optionsKey:e,moduleFactory:i,themeTemplate:s}){this.legendMap.set(t,{optionsKey:e,moduleFactory:i}),this.themeTemplates.set(e,s)}create(t,e){const i=this.legendMap.get(t)?.moduleFactory;if(i)return i(e);throw new Error(`AG Charts - unknown legend type: ${t}`)}getThemeTemplates(){return Object.fromEntries(this.themeTemplates)}getKeys(){return Array.from(this.legendMap.entries()).reduce((t,[e,i])=>(t[e]=i.optionsKey,t),{})}},legendRegistry=new LegendRegistry,ChartTypes=class extends Map{get(t){return super.get(t)??"unknown"}isCartesian(t){return this.get(t)==="cartesian"}isPolar(t){return this.get(t)==="polar"}isHierarchy(t){return this.get(t)==="hierarchy"}isTopology(t){return this.get(t)==="topology"}isFlowProportion(t){return this.get(t)==="flow-proportion"}isStandalone(t){return this.get(t)==="standalone"}isGauge(t){return this.get(t)==="gauge"}get seriesTypes(){return Array.from(this.keys())}get cartesianTypes(){return this.seriesTypes.filter(t=>this.isCartesian(t))}get polarTypes(){return this.seriesTypes.filter(t=>this.isPolar(t))}get hierarchyTypes(){return this.seriesTypes.filter(t=>this.isHierarchy(t))}get topologyTypes(){return this.seriesTypes.filter(t=>this.isTopology(t))}get flowProportionTypes(){return this.seriesTypes.filter(t=>this.isFlowProportion(t))}get standaloneTypes(){return this.seriesTypes.filter(t=>this.isStandalone(t))}get gaugeTypes(){return this.seriesTypes.filter(t=>this.isGauge(t))}},ChartDefaults=class extends Map{set(t,e){return super.set(t,mergeDefaults(e,this.get(t)))}},chartTypes2=new ChartTypes,publicChartTypes=new ChartTypes,chartDefaults=new ChartDefaults,SeriesRegistry=class{constructor(){this.seriesMap=new Map,this.themeTemplates=new Map}register(t,{chartTypes:[e],moduleFactory:i,tooltipDefaults:s,defaultAxes:n,themeTemplate:r,paletteFactory:o,solo:a,stackable:l,groupable:c,stackedByDefault:h,hidden:u}){this.setThemeTemplate(t,r),this.seriesMap.set(t,{moduleFactory:i,tooltipDefaults:s,defaultAxes:n,paletteFactory:o,solo:a,stackable:l,groupable:c,stackedByDefault:h}),chartTypes2.set(t,e),u||publicChartTypes.set(t,e)}create(t,e){const i=this.seriesMap.get(t)?.moduleFactory;if(i)return i(e);throw new Error(`AG Charts - unknown series type: ${t}`)}cloneDefaultAxes(t,e){const i=this.seriesMap.get(t)?.defaultAxes;if(i==null)return null;const s=typeof i=="function"?i(e):i;return{axes:deepClone(s)}}isDerivedDefaultAxes(t){return typeof this.seriesMap.get(t)?.defaultAxes=="function"}setThemeTemplate(t,e){const i=this.themeTemplates.get(t);this.themeTemplates.set(t,mergeDefaults(e,i))}getThemeTemplate(t){return this.themeTemplates.get(t)}getPaletteFactory(t){return this.seriesMap.get(t)?.paletteFactory}getTooltipDefauls(t){return this.seriesMap.get(t)?.tooltipDefaults}isSolo(t){return this.seriesMap.get(t)?.solo??!1}isGroupable(t){return this.seriesMap.get(t)?.groupable??!1}isStackable(t){return this.seriesMap.get(t)?.stackable??!1}isStackedByDefault(t){return this.seriesMap.get(t)?.stackedByDefault??!1}},seriesRegistry=new SeriesRegistry,_SyncManager=class ft extends BaseManager{constructor(e){super(),this.chart=e}subscribe(e=ft.DEFAULT_GROUP){let i=this.get(e);return i||(i=new Set,ft.chartsGroups.set(e,i)),i.add(this.chart),this}unsubscribe(e=ft.DEFAULT_GROUP){return this.get(e)?.delete(this.chart),this}getChart(){return this.chart}getGroup(e=ft.DEFAULT_GROUP){const i=this.get(e);return i?Array.from(i):[]}getGroupSiblings(e=ft.DEFAULT_GROUP){return this.getGroup(e).filter(i=>i!==this.chart)}get(e){return ft.chartsGroups.get(e)}};_SyncManager.chartsGroups=new Map,_SyncManager.DEFAULT_GROUP=Symbol("sync-group-default");var SyncManager=_SyncManager,Keyboard=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!1}};__decorateClass([Validate(BOOLEAN)],Keyboard.prototype,"enabled",2),__decorateClass([Validate(NUMBER)],Keyboard.prototype,"tabIndex",2);var CartesianAxisPositions=["top","right","bottom","left"];function isAxisPosition(t){return typeof t=="string"&&CartesianAxisPositions.includes(t)}function guessInvalidPositions(t){const e=[],i=[],s=[...CartesianAxisPositions];for(const n of t)n instanceof CartesianAxis&&(isAxisPosition(n.position)?i.push(n.position):e.push(n));for(const n of e){let r;do r=s.pop();while(r&&i.includes(r));if(r==null)break;n.position=r}}var MATCHING_KEYS=["direction","xKey","yKey","sizeKey","angleKey","radiusKey","normalizedTo"];function matchSeriesOptions(t,e,i){const s=(c,h,u)=>{const d=[c];for(const p of MATCHING_KEYS)p in h&&h[p]!=null&&d.push(`${p}=${h[p]}`);return u?.seriesGrouping&&d.push(`seriesGrouping.groupId=${u?.seriesGrouping.groupId}`),d.join(";")},n=new Map;let r=0;for(const c of t){const h=s(c.type,c.properties,i?.[r]);n.has(h)||n.set(h,[]),n.get(h)?.push([c,r++])}const o=new Map;r=0;for(const c of e){const h=s(c.type,c,c);o.has(h)||o.set(h,[]),o.get(h)?.push([c,r++])}if(![...n.keys()].some(c=>o.has(c)))return{status:"no-overlap",oldKeys:n.keys(),newKeys:o.keys()};const l=[];for(const[c,h]of o.entries())for(const[u,d]of h){const p=n.get(c);if(p==null||p.length<1){l.push({opts:u,targetIdx:d,idx:d,status:"add"}),n.delete(c);continue}const[g,m]=p.shift(),y=i?.[m]??{},f=jsonDiff(y,u??{}),{groupIndex:x,stackIndex:v}=f?.seriesGrouping??{};x!=null||v!=null?l.push({opts:u,series:g,diff:f,targetIdx:d,idx:m,status:"series-grouping"}):f?l.push({opts:u,series:g,diff:f,targetIdx:d,idx:m,status:"update"}):l.push({opts:u,series:g,targetIdx:d,idx:m,status:"no-op"}),p.length===0&&n.delete(c)}for(const c of n.values())for(const[h,u]of c)l.push({series:h,idx:u,targetIdx:-1,status:"remove"});return{status:"overlap",changes:l}}function optionsType(t){const{series:e}=t;if(e)return e[0]?.type??"line"}function isAgCartesianChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isCartesian(e)||isEnterpriseCartesian(e)}function isAgPolarChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isPolar(e)||isEnterprisePolar(e)}function isAgHierarchyChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isHierarchy(e)||isEnterpriseHierarchy(e)}function isAgTopologyChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isTopology(e)||isEnterpriseTopology(e)}function isAgFlowProportionChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isFlowProportion(e)||isEnterpriseFlowProportion(e)}function isAgStandaloneChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isStandalone(e)||isEnterpriseStandalone(e)}function isAgGaugeChartOptions(t){const e=optionsType(t);return e==null?!1:chartTypes2.isGauge(e)||isEnterpriseGauge(e)}function isAgPolarChartOptionsWithSeriesBasedLegend(t){const e=optionsType(t);return isAgPolarChartOptions(t)&&e!=="pie"&&e!=="donut"}function isSeriesOptionType(t){return t==null?!1:chartTypes2.has(t)}function isAxisOptionType(t){return t==null?!1:axisRegistry.has(t)}var ModulesManager=class extends ModuleMap{applyOptions(t){for(const e of this.moduleMap.values())e.module.optionsKey in t&&isProperties(e.moduleInstance)&&e.moduleInstance.set(t[e.module.optionsKey])}*legends(){for(const{module:t,moduleInstance:e}of this.moduleMap.values())t.type==="legend"&&(yield{legendType:t.identifier,legend:e})}},DEFAULT_OVERLAY_CLASS="ag-charts-overlay",DEFAULT_OVERLAY_DARK_CLASS="ag-charts-dark-overlay",Overlay=class extends BaseProperties{constructor(t,e){super(),this.className=t,this.defaultMessageId=e,this.enabled=!0}getText(t){return t.t(this.text??this.defaultMessageId)}getElement(t,e,i){if(this.content?.remove(),this.focusBox=i,this.renderer){const s=this.renderer();if(s instanceof HTMLElement)this.content=s;else{const n=createElement("div");n.innerHTML=s,this.content=n.firstElementChild}}else{const s=createElement("div",{display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",height:"100%",margin:"8px",fontFamily:"var(--ag-charts-font-family)",fontSize:"var(--ag-charts-font-size)",fontWeight:"var(--ag-charts-font-weight)"});s.innerText=this.getText(e),this.content=s,t?.animate({from:0,to:1,id:"overlay",phase:"add",groupId:"opacity",onUpdate(n){s.style.opacity=String(n)},onStop(){s.style.opacity="1"}})}return this.content}removeElement(t=()=>this.content?.remove(),e){if(this.content){if(e){const{content:i}=this;e.animate({from:1,to:0,phase:"remove",id:"overlay",groupId:"opacity",onUpdate(s){i.style.opacity=String(s)},onStop(){t?.()}})}else t?.();this.content=void 0,this.focusBox=void 0}}};__decorateClass([Validate(BOOLEAN)],Overlay.prototype,"enabled",2),__decorateClass([Validate(STRING,{optional:!0})],Overlay.prototype,"text",2),__decorateClass([Validate(FUNCTION,{optional:!0})],Overlay.prototype,"renderer",2);var ChartOverlays=class extends BaseProperties{constructor(){super(...arguments),this.darkTheme=!1,this.loading=new Overlay("ag-charts-loading-overlay","overlayLoadingData"),this.noData=new Overlay("ag-charts-no-data-overlay","overlayNoData"),this.noVisibleSeries=new Overlay("ag-charts-no-visible-series","overlayNoVisibleSeries"),this.unsupportedBrowser=new Overlay("ag-charts-unsupported-browser","overlayUnsupportedBrowser")}getFocusInfo(t){for(const e of[this.loading,this.noData,this.noVisibleSeries,this.unsupportedBrowser])if(e.focusBox!==void 0)return{text:e.getText(t),rect:e.focusBox}}destroy(){this.loading.removeElement(),this.noData.removeElement(),this.noVisibleSeries.removeElement(),this.unsupportedBrowser.removeElement()}};__decorateClass([Validate(BOOLEAN)],ChartOverlays.prototype,"darkTheme",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"loading",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"noData",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"noVisibleSeries",2),__decorateClass([Validate(OBJECT)],ChartOverlays.prototype,"unsupportedBrowser",2);function getLoadingSpinner(t,e){const{animationDuration:i}=PHASE_METADATA.add,s=i*e,n=createElement("div",`${DEFAULT_OVERLAY_CLASS}--loading`,{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",height:"100%",boxSizing:"border-box",font:"13px Verdana, sans-serif",userSelect:"none",animation:`ag-charts-loading ${s}ms linear 50ms both`}),r=createElement("span",{width:"45px",height:"40px",backgroundImage:["linear-gradient(#0000 calc(1 * 100% / 6), #ccc 0 calc(3 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(2 * 100% / 6), #ccc 0 calc(4 * 100% / 6), #0000 0), ","linear-gradient(#0000 calc(3 * 100% / 6), #ccc 0 calc(5 * 100% / 6), #0000 0)"].join(""),backgroundSize:"10px 400%",backgroundRepeat:"no-repeat",animation:"ag-charts-loading-matrix 1s infinite linear"}),o=createElement("p",{marginTop:"1em"});o.innerText=t;const a=createElement("div",`${DEFAULT_OVERLAY_CLASS}__loading-background`,{position:"absolute",inset:"0",opacity:"0.5",zIndex:"-1"}),l=createElement("style");return l.innerText=["@keyframes ag-charts-loading { from { opacity: 0 } to { opacity: 1 } }","@keyframes ag-charts-loading-matrix {","0% { background-position: 0% 0%, 50% 0%, 100% 0%; }","100% { background-position: 0% 100%, 50% 100%, 100% 100%; }","}"].join(" "),n.replaceChildren(l,r,o,a),n}var SeriesZIndexMap=(t=>(t[t.BACKGROUND=0]="BACKGROUND",t[t.ANY_CONTENT=1]="ANY_CONTENT",t))(SeriesZIndexMap||{}),SeriesContentZIndexMap=(t=>(t[t.FOREGROUND=0]="FOREGROUND",t[t.HIGHLIGHT=1]="HIGHLIGHT",t[t.LABEL=2]="LABEL",t))(SeriesContentZIndexMap||{}),SeriesNodePickMode=(t=>(t[t.EXACT_SHAPE_MATCH=0]="EXACT_SHAPE_MATCH",t[t.NEAREST_NODE=1]="NEAREST_NODE",t[t.AXIS_ALIGNED=2]="AXIS_ALIGNED",t))(SeriesNodePickMode||{}),CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR=.25,CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR=.125,SeriesNodeEvent=class{constructor(t,e,{datum:i},s){this.type=t,this.event=e,this.datum=i,this.seriesId=s.id}},SeriesGroupingChangedEvent=class{constructor(t,e,i){this.series=t,this.seriesGrouping=e,this.oldGrouping=i,this.type="groupingChanged"}},Series=class extends Observable{constructor(t){super(),this.destroyFns=[],this.usesPlacedLabels=!1,this.seriesGrouping=void 0,this.NodeEvent=SeriesNodeEvent,this.internalId=createId(this),this.contentGroup=new TranslatableGroup({name:`${this.internalId}-content`,zIndex:1}),this.highlightGroup=new TranslatableGroup({name:`${this.internalId}-highlight`,zIndex:1}),this.annotationGroup=new TranslatableGroup({name:`${this.internalId}-annotation`}),this.labelGroup=new TranslatableGroup({name:`${this.internalId}-series-labels`}),this.axes={x:void 0,y:void 0},this.directions=["x","y"],this.nodeDataRefresh=!0,this.moduleMap=new ModuleMap,this.datumCallbackCache=new Map,this.connectsToYAxis=!1,this._declarationOrder=-1,this.seriesListeners=new Listeners,this._pickNodeCache=new LRUCache;const{moduleCtx:e,pickModes:i,directionKeys:s={},directionNames:n={},canHaveAxes:r=!1,usesPlacedLabels:o=!1}=t;this.ctx=e,this.directionKeys=s,this.directionNames=n,this.canHaveAxes=r,this.usesPlacedLabels=o,this.highlightGroup=new TranslatableGroup({name:`${this.internalId}-highlight`}),this.highlightNode=this.highlightGroup.appendChild(new Group({name:"highlightNode",zIndex:0})),this.highlightLabel=this.highlightGroup.appendChild(new Group({name:"highlightLabel",zIndex:10})),this.pickModes=i}get pickModeAxis(){return"main"}get id(){return this.properties?.id??this.internalId}get type(){return this.constructor.type??""}get focusable(){return!0}get data(){return this._data??this._chartData}set visible(t){this.properties.visible=t,this.ctx.legendManager.toggleItem({enabled:t,seriesId:this.id}),this.ctx.legendManager.update(),this.visibleMaybeChanged()}get visible(){return this.ctx.legendManager.getSeriesEnabled(this.id)??this.properties.visible}get hasData(){return this.data!=null&&this.data.length>0}get tooltipEnabled(){return this.properties.tooltip?.enabled??!1}onDataChange(){this.nodeDataRefresh=!0,this._pickNodeCache.clear()}setOptionsData(t){this._data=t,this.onDataChange()}setChartData(t){this._chartData=t,this.data===t&&this.onDataChange()}onSeriesGroupingChange(t,e){const{internalId:i,type:s,visible:n}=this;t&&this.ctx.seriesStateManager.deregisterSeries(this),e&&this.ctx.seriesStateManager.registerSeries({internalId:i,type:s,visible:n,seriesGrouping:e}),this.fireEvent(new SeriesGroupingChangedEvent(this,e,t))}getBandScalePadding(){return{inner:1,outer:0}}attachSeries(t,e,i){t.appendChild(this.contentGroup),e.appendChild(this.highlightGroup),e.appendChild(this.labelGroup),i?.appendChild(this.annotationGroup)}detachSeries(t,e,i){t?.removeChild(this.contentGroup),e.removeChild(this.highlightGroup),e.removeChild(this.labelGroup),i?.removeChild(this.annotationGroup)}setSeriesIndex(t){return t===this._declarationOrder?!1:(this._declarationOrder=t,this.contentGroup.zIndex=[1,t,0],this.highlightGroup.zIndex=[1,t,1],this.labelGroup.zIndex=[1,t,2],this.annotationGroup.zIndex=t,!0)}renderToOffscreenCanvas(){return!1}addEventListener(t,e){return super.addEventListener(t,e)}addListener(t,e){return this.seriesListeners.addListener(t,e)}dispatch(t,e){this.seriesListeners.dispatch(t,e)}addChartEventListeners(){}destroy(){this.destroyFns.forEach(t=>t()),this.destroyFns=[],this.resetDatumCallbackCache(),this.ctx.seriesStateManager.deregisterSeries(this)}getDirectionValues(t,e){const i=this.resolveKeyDirection(t),s=e?.[i],n=[];if(!s)return n;const r=(...o)=>{for(const a of o)Array.isArray(a)?r(...a):typeof a=="object"?r(...Object.values(a)):n.push(a)};return r(...s.map(o=>this.properties[o])),n}getKeys(t){return this.getDirectionValues(t,this.directionKeys)}getKeyProperties(t){return this.directionKeys[this.resolveKeyDirection(t)]??[]}getNames(t){return this.getDirectionValues(t,this.directionNames)}resolveKeyDirection(t){return t}getDomain(t){const e=this.getSeriesDomain(t),i=this.moduleMap.mapModules(s=>s.getDomain(t)).flat();return i.length!==0?e.concat(i):e}getRange(t,e){return this.getSeriesRange(t,e)}getVisibleItems(t,e,i){return 1/0}getGradientFillOptions({bounds:t},e){const{axes:i}=this,s=i.x,n=i.y,r=s?.range??[0,1],o=n?.range??[0,1],[a,l]=findMinMax(r),[c,h]=findMinMax(o),u=l-a,d=h-c;let p=[0,1];return t==="series"?p=this.getSeriesDomain("y"):t==="axes"&&(p=n?.scale.domain??[0,1]),{bbox:new BBox(a,c,u,d),domain:p,defaultColorRange:e}}markNodeDataDirty(){this.nodeDataRefresh=!0,this._pickNodeCache.clear(),this.visibleMaybeChanged()}visibleMaybeChanged(){this.ctx.seriesStateManager.updateSeries(this)}getOpacity(){const{dimOpacity:e=1,enabled:i=!0}=this.properties.highlightStyle.series;if(!i||e===1)return 1;switch(this.isItemIdHighlighted()){case 0:case 1:return 1;case 2:default:return e}}getStrokeWidth(t){const{strokeWidth:e,enabled:i=!0}=this.properties.highlightStyle.series;if(!i||e===void 0)return t;switch(this.isItemIdHighlighted()){case 1:return e;case 0:case 2:return t}}isItemIdHighlighted(){const t=this.ctx.highlightManager?.getActiveHighlight()?.series;return t==null?0:t!==this?2:1}getModuleTooltipParams(){return this.moduleMap.mapModules(t=>t.getTooltipParams()).reduce((t,e)=>Object.assign(t,e),{})}pickNode(t,e,i=!1){const{pickModes:s,pickModeAxis:n,visible:r,contentGroup:o}=this;if(!r||!o.visible||e==="highlight"&&!this.properties.highlight.enabled||e==="highlight-tooltip"&&!this.properties.highlight.enabled)return;let a=1/0;if(e==="tooltip"||e==="highlight-tooltip"){const{tooltip:d}=this.properties;a=typeof d.range=="number"?d.range:1/0,i||(i=d.range==="exact")}else if(e==="event"||e==="context-menu"){const{nodeClickRange:d}=this.properties;a=typeof d=="number"?d:1/0,i||(i=d==="exact")}const l=s.filter(d=>!i||d===0),{x:c,y:h}=t,u=JSON.stringify({x:c,y:h,maxDistance:a,selectedPickModes:l});if(this._pickNodeCache.has(u))return this._pickNodeCache.get(u);for(const d of l){let p;switch(d){case 0:p=this.pickNodeExactShape(t);break;case 1:p=this.pickNodeClosestDatum(t);break;case 2:p=n!=null?this.pickNodeMainAxisFirst(t,n==="main-category"):void 0;break}if(p&&p.distance<=a)return this._pickNodeCache.set(u,{pickMode:d,match:p.datum,distance:p.distance})}return this._pickNodeCache.set(u,void 0)}pickNodeExactShape(t){const e=this.contentGroup.pickNode(t.x,t.y);if(e&&e.datum.missing!==!0)return{datum:e.datum,distance:0}}pickNodeClosestDatum(t){throw new Error("AG Charts - Series.pickNodeClosestDatum() not implemented")}pickNodeNearestDistantObject(t,e){const i=nearestSquared(t.x,t.y,e);if(i.nearest!==void 0&&i.nearest.datum.missing!==!0)return{datum:i.nearest.datum,distance:Math.sqrt(i.distanceSquared)}}pickNodeMainAxisFirst(t,e){throw new Error("AG Charts - Series.pickNodeMainAxisFirst() not implemented")}getLabelData(){return[]}updatePlacedLabelData(t){}fireNodeClickEvent(t,e){this.fireEvent(new this.NodeEvent("nodeClick",t,e,this))}fireNodeDoubleClickEvent(t,e){this.fireEvent(new this.NodeEvent("nodeDoubleClick",t,e,this))}createNodeContextMenuActionEvent(t,e){return new this.NodeEvent("nodeContextMenuAction",t,e,this)}onLegendInitialState(t,e){const{visible:i=!0,itemId:s,legendItemName:n}=e??{};this.toggleSeriesItem(i,t,s,n)}onLegendItemClick(t){const{enabled:e,itemId:i,series:s,legendType:n}=t,r="legendItemName"in this.properties?this.properties.legendItemName:void 0,o="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,a=r!=null&&r===t.legendItemName;(s.id===this.id||a||o!=null)&&this.toggleSeriesItem(e,n,i,r,t)}onLegendItemDoubleClick(t){const{enabled:e,itemId:i,series:s,numVisibleItems:n,legendType:r}=t,o="legendItemName"in this.properties?this.properties.legendItemName:void 0,a="legendItemKey"in this.properties?this.properties.legendItemKey:void 0,l=o!=null&&o===t.legendItemName;s.id===this.id||l||a!=null?this.toggleSeriesItem(!0,r,i,o,t):e&&n===1?this.toggleSeriesItem(!0,r,void 0,o):this.toggleSeriesItem(!1,r,void 0,o)}toggleSeriesItem(t,e,i,s,n){const r=this.id;(t||e!=="category")&&(this.visible=t),this.nodeDataRefresh=!0,this._pickNodeCache.clear();const o={type:"seriesVisibilityChange",seriesId:r,itemId:i,legendItemName:n?.legendItemName??s,visible:t};this.fireEvent(o),this.ctx.legendManager.toggleItem({enabled:t,seriesId:r,itemId:i,legendItemName:s})}isEnabled(){return this.visible}getModuleMap(){return this.moduleMap}createModuleContext(){return{...this.ctx,series:this}}getLabelText(t,e,i=formatValue){return t.formatter?this.ctx.callbackCache.call(t.formatter,{seriesId:this.id,...e})??i(e.value):i(e.value)}getMarkerStyle(t,e,i=t.getStyle()){const s={size:e.datum.point?.size??0},n=mergeDefaults(s,i);if(t.itemStyler){const r=this.ctx.callbackCache.call(t.itemStyler,{seriesId:this.id,...n,...e,datum:e.datum.datum});return mergeDefaults(r,n)}return n}updateMarkerStyle(t,e,i,s=e.getStyle(),{applyTranslation:n=!0,selected:r=!0}={}){const{point:o}=i.datum,a=this.getMarkerStyle(e,i,s),l=this.visible&&a.size>0&&o&&!isNaN(o.x)&&!isNaN(o.y);if(n?t.setProperties({visible:l,...a,translationX:o?.x,translationY:o?.y}):t.setProperties({visible:l,...a}),r||(t.fillOpacity*=CROSS_FILTER_MARKER_FILL_OPACITY_FACTOR,t.strokeOpacity*=CROSS_FILTER_MARKER_STROKE_OPACITY_FACTOR),typeof e.shape=="function"&&!t.dirtyPath){t.path.clear(!0),t.updatePath(),t.checkPathDirty();const c=t.getBBox();if(o!==void 0&&c.isFinite()){const h=c.computeCenter(),[u,d]=["x","y"].map(p=>(a.strokeWidth??0)+Math.abs(h[p]-o[p]));o.focusSize=Math.max(c.width+u,c.height+d)}}}get nodeDataDependencies(){return this._nodeDataDependencies??{seriesRectWidth:NaN,seriesRectHeight:NaN}}checkResize(t){const{width:e,height:i}=t??{width:NaN,height:NaN},s=t?{seriesRectWidth:e,seriesRectHeight:i}:void 0,n=jsonDiff(this.nodeDataDependencies,s)!=null;return n&&(this._nodeDataDependencies=s,this.markNodeDataDirty()),n}pickFocus(t){}resetDatumCallbackCache(){this.datumCallbackCache.clear()}cachedDatumCallback(t,e){const{datumCallbackCache:i}=this,s=i.get(t);if(s!=null)return s;const n=e();return i.set(t,n),n}};__decorateClass([ActionOnSet({changeValue:function(t,e){this.onSeriesGroupingChange(e,t)}})],Series.prototype,"seriesGrouping",2);function linearRoot(t,e){const i=-e/t;return t!==0&&i>=0&&i<=1?[i]:[]}function quadraticRoots(t,e,i){if(t===0)return linearRoot(e,i);const s=e*e-4*t*i,n=[];if(s===0){const r=-e/(2*t);r>=0&&r<=1&&n.push(r)}else if(s>0){const r=Math.sqrt(s),o=(-e-r)/(2*t),a=(-e+r)/(2*t);o>=0&&o<=1&&n.push(o),a>=0&&a<=1&&n.push(a)}return n}function cubicRoots(t,e,i,s){if(t===0)return quadraticRoots(e,i,s);const n=e/t,r=i/t,o=s/t,a=(3*r-n*n)/9,l=(9*n*r-27*o-2*n*n*n)/54,c=a*a*a+l*l,h=1/3,u=[];if(c>=0){const d=Math.sqrt(c),p=Math.sign(l+d)*Math.pow(Math.abs(l+d),h),g=Math.sign(l-d)*Math.pow(Math.abs(l-d),h),m=Math.abs(Math.sqrt(3)*(p-g)/2),y=-h*n+(p+g);if(y>=0&&y<=1&&u.push(y),m===0){const f=-h*n-(p+g)/2;f>=0&&f<=1&&u.push(f)}}else{const d=Math.acos(l/Math.sqrt(-a*a*a)),p=h*n,g=2*Math.sqrt(-a),m=g*Math.cos(h*d)-p,y=g*Math.cos(h*(d+2*Math.PI))-p,f=g*Math.cos(h*(d+4*Math.PI))-p;m>=0&&m<=1&&u.push(m),y>=0&&y<=1&&u.push(y),f>=0&&f<=1&&u.push(f)}return u}function segmentIntersection(t,e,i,s,n,r,o,a){const l=(i-t)*(a-r)-(s-e)*(o-n);if(l===0)return 0;const c=((o-n)*(e-r)-(t-n)*(a-r))/l,h=((i-t)*(e-r)-(s-e)*(t-n))/l;return c>=0&&c<=1&&h>=0&&h<=1?1:0}function cubicSegmentIntersections(t,e,i,s,n,r,o,a,l,c,h,u){let d=0;const p=c-u,g=h-l,m=l*(u-c)-c*(h-l),y=bezierCoefficients(t,i,n,o),f=bezierCoefficients(e,s,r,a),x=p*y[0]+g*f[0],v=p*y[1]+g*f[1],b=p*y[2]+g*f[2],S=p*y[3]+g*f[3]+m,A=cubicRoots(x,v,b,S);for(const D of A){const I=D*D,L=D*I,N=y[0]*L+y[1]*I+y[2]*D+y[3],T=f[0]*L+f[1]*I+f[2]*D+f[3];let w;l===h?w=(T-c)/(u-c):w=(N-l)/(h-l),w>=0&&w<=1&&d++}return d}function bezierCoefficients(t,e,i,s){return[-t+3*e-3*i+s,3*t-6*e+3*i,-3*t+3*e,t]}function arcIntersections(t,e,i,s,n,r,o,a,l,c){if(isNaN(t)||isNaN(e))return 0;r&&([n,s]=[s,n]);const h=(c-a)/(l-o),u=a-h*o,d=Math.pow(h,2)+1,p=2*(h*(u-e)-t),g=Math.pow(t,2)+Math.pow(u-e,2)-Math.pow(i,2),m=Math.pow(p,2)-4*d*g;if(m<0)return 0;const y=(-p+Math.sqrt(m))/2/d,f=(-p-Math.sqrt(m))/2/d;let x=0;return[y,f].forEach(v=>{if(!(v>=Math.min(o,l)&&v<=Math.max(o,l)))return;const S=h*v+u,A=v-t,D=S-e,I=Math.atan2(D,A);isBetweenAngles(I,s,n)&&x++}),x}function evaluateBezier(t,e,i,s,n){return(1-n)**3*t+3*(1-n)**2*n*e+3*(1-n)*n**2*i+n**3*s}function solveBezier(t,e,i,s,n){if(n<=Math.min(t,s))return t=Math.max(t,s))return t0&&l<1)return[l]}return[]}const a=r*r-4*n*o;if(a>=0){const l=Math.sqrt(a),c=(-r+l)/(2*n),h=(-r-l)/(2*n);return[c,h].filter(u=>u>0&&u<1)}return[]}function calculateDerivativeExtremaXY(t,e,i,s,n,r,o,a){const l=calculateDerivativeExtrema(t,i,n,o),c=calculateDerivativeExtrema(e,s,r,a);return[...l,...c]}var ExtendedPath2D=class{constructor(){this.path2d=new Path2D,this.previousCommands=[],this.previousParams=[],this.previousClosedPath=!1,this.commands=[],this.params=[],this.openedPath=!1,this.closedPath=!1}isEmpty(){return this.commands.length===0}isDirty(){return this.closedPath!==this.previousClosedPath||this.previousCommands.length!==this.commands.length||this.previousParams.length!==this.params.length||this.previousCommands.toString()!==this.commands.toString()||this.previousParams.toString()!==this.params.toString()}getPath2D(){return this.path2d}moveTo(t,e){this.openedPath=!0,this.path2d.moveTo(t,e),this.commands.push(0),this.params.push(t,e)}lineTo(t,e){this.openedPath?(this.path2d.lineTo(t,e),this.commands.push(1),this.params.push(t,e)):this.moveTo(t,e)}rect(t,e,i,s){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+s),this.lineTo(t,e+s),this.closePath()}roundRect(t,e,i,s,n){n=Math.min(n,i/2,s/2),this.moveTo(t,e+n),this.arc(t+n,e+n,n,Math.PI,1.5*Math.PI),this.lineTo(t+n,e),this.lineTo(t+i-n,e),this.arc(t+i-n,e+n,n,1.5*Math.PI,2*Math.PI),this.lineTo(t+i,e+n),this.lineTo(t+i,e+s-n),this.arc(t+i-n,e+s-n,n,0,Math.PI/2),this.lineTo(t+i-n,e+s),this.lineTo(t+n,e+s),this.arc(t+ +n,e+s-n,n,Math.PI/2,Math.PI),this.lineTo(t,e+s-n),this.closePath()}arc(t,e,i,s,n,r){this.openedPath=!0,this.path2d.arc(t,e,i,s,n,r),this.commands.push(2),this.params.push(t,e,i,s,n,r?1:0)}cubicCurveTo(t,e,i,s,n,r){this.openedPath||this.moveTo(t,e),this.path2d.bezierCurveTo(t,e,i,s,n,r),this.commands.push(3),this.params.push(t,e,i,s,n,r)}closePath(){this.openedPath&&(this.path2d.closePath(),this.commands.push(4),this.openedPath=!1,this.closedPath=!0)}clear(t){t&&(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(t,e){const i=this.commands,s=this.params,n=i.length,r=-1e4,o=-1e4;let a=NaN,l=NaN,c=0,h=0,u=0;for(let d=0,p=0;d({x:e,y:i})){const e=[],{commands:i,params:s}=this,n=(o,...a)=>{e.push(o);for(let l=0;l{i=Math.min(p,i),s=Math.min(d,s),n=Math.max(d,n),r=Math.max(p,r),g&&([o,a]=[d,p])};let u=0;for(const d of t)switch(d){case 0:h(e[u++],e[u++],!0),[l,c]=[o,a];break;case 1:h(e[u++],e[u++],!0);break;case 3:{const p=e[u++],g=e[u++],m=e[u++],y=e[u++],f=e[u++],x=e[u++];h(f,x,!0),calculateDerivativeExtremaXY(o,a,p,g,m,y,f,x).forEach(b=>{const S=evaluateBezier(o,p,m,f,b),A=evaluateBezier(a,g,y,x,b);h(S,A)});break}case 2:{const p=e[u++],g=e[u++],m=e[u++];let y=normalizeAngle360(e[u++]),f=normalizeAngle360(e[u++]);e[u++]&&([y,f]=[f,y]);const v=(S,A)=>{const D=p+m*Math.cos(S),I=g+m*Math.sin(S);h(D,I,A)};v(y),v(f,!0);const b=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const S of b)(yf&&(y<=S||S<=f))&&v(S);break}case 4:[o,a]=[l,c];break}return new BBox(s,i,n-s,r-i)}};function ScenePathChangeDetection(t){const{changeCb:e,convertor:i}=t??{};return SceneChangeDetection({type:"path",convertor:i,changeCb:e})}var Path=class extends Shape{constructor(){super(...arguments),this.path=new ExtendedPath2D,this._clipX=NaN,this._clipY=NaN,this.clip=!1,this._dirtyPath=!0,this.lastPixelRatio=NaN}set clipX(t){this._clipX=t,this.dirtyPath=!0}set clipY(t){this._clipY=t,this.dirtyPath=!0}set dirtyPath(t){this._dirtyPath!==t&&(this._dirtyPath=t,t&&this.markDirty())}get dirtyPath(){return this._dirtyPath}checkPathDirty(){this._dirtyPath||(this.dirtyPath=this.path.isDirty()||(this.fillShadow?.isDirty()??!1)||(this._clipPath?.isDirty()??!1))}isPointInPath(t,e){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(t,e)}distanceSquared(t,e){return this.distanceSquaredTransformedPoint(t,e)}svgPathData(t){return this.updatePathIfDirty(),this.path.toSVG(t)}distanceSquaredTransformedPoint(t,e){return this.updatePathIfDirty(),this.path.closedPath&&this.path.isPointInPath(t,e)?0:this.path.distanceSquared(t,e)}isDirtyPath(){return!1}updatePath(){}updatePathIfDirty(){(this.dirtyPath||this.isDirtyPath())&&(this.updatePath(),this.dirtyPath=!1)}preRender(t){return t.devicePixelRatio!==this.lastPixelRatio&&(this.dirtyPath=!0),this.lastPixelRatio=t.devicePixelRatio,this.updatePathIfDirty(),super.preRender(t,this.path.commands.length)}render(t){const{ctx:e}=t;if(this.clip&&!isNaN(this._clipX)&&!isNaN(this._clipY)){e.save();const i=this.strokeWidth/2;this._clipPath??(this._clipPath=new ExtendedPath2D),this._clipPath.clear(),this._clipPath.rect(-i,-i,this._clipX+i,this._clipY+i+i),e.clip(this._clipPath?.getPath2D()),this._clipX>0&&this._clipY>0&&this.drawPath(e),e.restore()}else this._clipPath=void 0,this.drawPath(e);this.fillShadow?.markClean(),super.render(t)}drawPath(t){this.fillStroke(t,this.path.getPath2D())}toSVG(){if(!this.visible)return;const t=createSvgElement("path");return t.setAttribute("d",this.svgPathData()),this.applySvgFillAttributes(t),this.applySvgStrokeAttributes(t),{elements:[t]}}};Path.className="Path",__decorateClass([ScenePathChangeDetection()],Path.prototype,"clip",2),__decorateClass([ScenePathChangeDetection()],Path.prototype,"clipX",1),__decorateClass([ScenePathChangeDetection()],Path.prototype,"clipY",1);var FocusIndicator=class{constructor(t){this.swapChain=t,this.div=createElement("div"),this.svg=createSvgElement("svg"),this.outerPath=createSvgElement("path"),this.innerPath=createSvgElement("path"),this.svg.append(this.outerPath),this.svg.append(this.innerPath),this.outerPath.classList.add("ag-charts-focus-svg-outer-path"),this.innerPath.classList.add("ag-charts-focus-svg-inner-path"),this.element=createElement("div","ag-charts-focus-indicator"),this.element.ariaHidden="true",this.element.append(this.svg),this.swapChain.addListener("swap",e=>this.onSwap(e))}clear(){}update(t,e,i){if(e!=null)if(t instanceof Path){const s=(r,o)=>{let{x:a,y:l}=Transformable.toCanvasPoint(t,r,o);return a-=e.x??0,l-=e.y??0,{x:a,y:l}},n=t.svgPathData(s);this.outerPath.setAttribute("d",n),this.innerPath.setAttribute("d",n),this.show(this.svg)}else{let s;if(i){const n=Math.max(t.x-e.x,0),r=Math.max(t.y-e.y,0),o=Math.min(t.x+t.width-e.x,e.width),a=Math.min(t.y+t.height-e.y,e.height);s=new BBox(n,r,o-n,a-r)}else s=new BBox(t.x-e.x,t.y-e.y,t.width,t.height);setElementBBox(this.div,s),this.show(this.div)}}onSwap(t){t!==this.element.parentElement&&(this.element.remove(),t.appendChild(this.element),this.overrideFocusVisible(this.focusVisible))}show(t){this.element.innerHTML="",this.element.append(t)}overrideFocusVisible(t){this.focusVisible=t;const e={true:"1",false:"0",undefined:""};this.element.parentElement?.style.setProperty("opacity",e[`${t}`])}isFocusVisible(){const t=this.element.parentElement;return t!=null&&getWindow().getComputedStyle(t).opacity==="1"}},FocusSwapChain=class{constructor(t,e,i,s){this.label1=t,this.label2=e,this.hasFocus=!1,this.skipDispatch=!1,this.listeners={blur:[],focus:[],swap:[]},this.onBlur=n=>(setElementStyle(n.target,"pointer-events",void 0),!this.skipDispatch&&this.dispatch("blur",n)),this.onFocus=n=>(setElementStyle(n.target,"pointer-events","auto"),!this.skipDispatch&&this.dispatch("focus",n)),setAttribute(this.label1,"id",`${i}-label1`),setAttribute(this.label2,"id",`${i}-label2`),setElementStyle(this.label1,"display","none"),setElementStyle(this.label2,"display","none"),this.activeAnnouncer=this.createAnnouncer(s),this.inactiveAnnouncer=this.createAnnouncer(s),setAttribute(this.activeAnnouncer,"tabindex",0),this.label2.insertAdjacentElement("afterend",this.activeAnnouncer),this.label2.insertAdjacentElement("afterend",this.inactiveAnnouncer),this.swap("")}createAnnouncer(t){const e=createElement("div");return e.role=t,e.className="ag-charts-swapchain",e.addEventListener("blur",this.onBlur),e.addEventListener("focus",this.onFocus),e}destroy(){for(const t of[this.activeAnnouncer,this.inactiveAnnouncer])t.removeEventListener("blur",this.onBlur),t.removeEventListener("focus",this.onFocus),t.remove()}focus(t){this.focusOptions=t,this.activeAnnouncer.focus(t),this.focusOptions=void 0}update(t){this.skipDispatch=!0,this.swap(t),this.hasFocus&&this.activeAnnouncer.focus(this.focusOptions),this.skipDispatch=!1}addListener(t,e){this.listeners[t].push(e),t==="swap"&&e(this.activeAnnouncer)}dispatch(t,e){t==="focus"?this.hasFocus=!0:t==="blur"&&(this.hasFocus=!1),this.listeners[t].forEach(i=>i(e))}swap(t){const e=this.activeAnnouncer.tabIndex;this.label2.textContent=t,[this.inactiveAnnouncer,this.activeAnnouncer]=[this.activeAnnouncer,this.inactiveAnnouncer],[this.label1,this.label2]=[this.label2,this.label1],setAttributes(this.inactiveAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!0,tabindex:void 0}),setAttributes(this.activeAnnouncer,{"aria-labelledby":this.label1.id,"aria-hidden":!1,tabindex:e}),this.dispatch("swap",this.activeAnnouncer)}},KEY_BINDINGS={arrowdown:{bindings:[{code:"ArrowDown"}]},arrowleft:{bindings:[{code:"ArrowLeft"}]},arrowright:{bindings:[{code:"ArrowRight"}]},arrowup:{bindings:[{code:"ArrowUp"}]},delete:{bindings:[{key:"Backspace"},{key:"Delete"}],activatesFocusIndicator:!1},redo:{bindings:[{key:"y",ctrlOrMeta:!0},{key:"z",ctrlOrMeta:!0,shift:!0}],activatesFocusIndicator:!1},undo:{bindings:[{key:"z",ctrlOrMeta:!0}],activatesFocusIndicator:!1},submit:{bindings:[{key:"Enter"},{code:"Enter"},{code:"Space"}]},zoomin:{bindings:[{key:"+"},{code:"ZoomIn"},{code:"Add"}],activatesFocusIndicator:!1},zoomout:{bindings:[{key:"-"},{code:"ZoomOut"},{code:"Substract"}],activatesFocusIndicator:!1}};function matchesKeyBinding(t,e){for(const i of e)if("code"in i){if(i.code===t.code)return!0}else if(i.key===t.key&&(i.shift===void 0||i.shift===t.shiftKey)&&(i.ctrlOrMeta===void 0||i.ctrlOrMeta===t.ctrlKey||i.ctrlOrMeta===t.metaKey))return!0;return!1}function mapKeyboardEventToAction(t){for(const[e,{activatesFocusIndicator:i=!0,bindings:s}]of Object.entries(KEY_BINDINGS))if(matchesKeyBinding(t,s))return{name:e,activatesFocusIndicator:i}}function computeCenter(t,e,i){const s=getDatumRefPoint(t,i.datum);if(s!=null)return{x:s.canvasX,y:s.canvasY};const n=i.bounds;if(n!=null){if(n instanceof BBox){const{x:r,y:o}=n.computeCenter();return{x:e.x+r,y:e.y+o}}return Transformable.toCanvas(n).computeCenter()}}function getPickedFocusBBox({bounds:t}){return t instanceof BBox?t:t!=null?Transformable.toCanvas(t):BBox.NaN}function makeKeyboardPointerEvent(t,e,i){const{x:s,y:n}=computeCenter(t,e,i)??{};if(s!==void 0&&n!==void 0)return{type:"keyboard",canvasX:s,canvasY:n}}function calculatePlacement(t,e,i,s){let{top:n,right:r,bottom:o,left:a,width:l,height:c}=s;return a!=null?l!=null?r=i.width-a+l:r!=null&&(l=i.width-a-r):r!=null&&l!=null&&(a=i.width-r-l),n!=null?c!=null?o=i.height-n-c:o!=null&&(c=i.height-o-n):o!=null&&c!=null&&(n=i.height-o-c),l==null?c==null?(l=t,c=e):l=Math.ceil(t*c/e):c==null&&(c=Math.ceil(e*l/t)),a==null&&(r==null?a=Math.floor((i.width-l)/2):a=i.width-r-l),n==null&&(o==null?n=Math.floor((i.height-c)/2):n=i.height-c-o),{x:a,y:n,width:l,height:c}}var element=null;function sanitizeHtml(t){if(t!=null)return t===""?"":(element??(element=createElement("div")),element.textContent=String(t),element.innerHTML)}function drawMarkerUnitPolygon(t,e){const{path:i,size:s}=t,{x:n,y:r}=t;i.clear();let o=!1;for(const[a,l]of e){const c=n+(a-.5)*s,h=r+(l-.5)*s;o?i.lineTo(c,h):i.moveTo(c,h),o=!0}i.closePath()}var MARKER_SHAPES={circle({path:t,x:e,y:i,size:s}){const n=s/2;t.clear(),t.arc(e,i,n,0,Math.PI*2),t.closePath()},cross(t){drawMarkerUnitPolygon(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]])},diamond(t){drawMarkerUnitPolygon(t,[[.5,0],[1,.5],[.5,1],[0,.5]])},heart({path:t,x:e,y:i,size:s}){const n=s/4;i=i+n/2,t.clear(),t.arc(e-n,i-n,n,toRadians(130),toRadians(330)),t.arc(e+n,i-n,n,toRadians(220),toRadians(50)),t.lineTo(e,i+n),t.closePath()},pin({path:t,x:e,y:i,size:s}){t.moveTo(e+(.15625-.5)*s,i+(.34375-.5)*s),t.cubicCurveTo(e+(.15625-.5)*s,i+(.151491-.5)*s,e+(.307741-.5)*s,i+(0-.5)*s,e+(.5-.5)*s,i+(0-.5)*s),t.cubicCurveTo(e+(.692259-.5)*s,i+(0-.5)*s,e+(.84375-.5)*s,i+(.151491-.5)*s,e+(.84375-.5)*s,i+(.34375-.5)*s),t.cubicCurveTo(e+(.84375-.5)*s,i+(.493824-.5)*s,e+(.784625-.5)*s,i+(.600181-.5)*s,e+(.716461-.5)*s,i+(.695393-.5)*s),t.cubicCurveTo(e+(.699009-.5)*s,i+(.719769-.5)*s,e+(.681271-.5)*s,i+(.743104-.5)*s,e+(.663785-.5)*s,i+(.766105-.5)*s),t.cubicCurveTo(e+(.611893-.5)*s,i+(.834367-.5)*s,e+(.562228-.5)*s,i+(.899699-.5)*s,e+(.528896-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.524075-.5)*s,i+(.992358-.5)*s,e+(.512663-.5)*s,i+(1-.5)*s,e+(.5-.5)*s,i+(1-.5)*s),t.cubicCurveTo(e+(.487337-.5)*s,i+(1-.5)*s,e+(.475925-.5)*s,i+(.992358-.5)*s,e+(.471104-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.487337-.5)*s,i+(1-.5)*s,e+(.475925-.5)*s,i+(.992358-.5)*s,e+(.471104-.5)*s,i+(.980648-.5)*s),t.cubicCurveTo(e+(.437772-.5)*s,i+(.899699-.5)*s,e+(.388107-.5)*s,i+(.834367-.5)*s,e+(.336215-.5)*s,i+(.766105-.5)*s),t.cubicCurveTo(e+(.318729-.5)*s,i+(.743104-.5)*s,e+(.300991-.5)*s,i+(.719769-.5)*s,e+(.283539-.5)*s,i+(.695393-.5)*s),t.cubicCurveTo(e+(.215375-.5)*s,i+(.600181-.5)*s,e+(.15625-.5)*s,i+(.493824-.5)*s,e+(.15625-.5)*s,i+(.34375-.5)*s),t.closePath()},plus(t){drawMarkerUnitPolygon(t,[[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:t,x:e,y:i,size:s,pixelRatio:n}){const r=s/2;t.clear(),t.moveTo(align(n,e-r),align(n,i-r)),t.lineTo(align(n,e+r),align(n,i-r)),t.lineTo(align(n,e+r),align(n,i+r)),t.lineTo(align(n,e-r),align(n,i+r)),t.closePath()},star({path:t,x:e,y:i,size:s}){const r=s/2,o=r/2,a=Math.PI/2;for(let l=0;l<5*2;l++){const c=l%2===0?r:o,h=l*Math.PI/5-a,u=e+Math.cos(h)*c,d=i+Math.sin(h)*c;t.lineTo(u,d)}t.closePath()},triangle(t){drawMarkerUnitPolygon(t,[[.5,0],[1,.87],[0,.87]])}},InternalMarker=class extends Path{constructor(){super(...arguments),this.shape="square",this.x=0,this.y=0,this.size=12}updatePath(){const{path:t,shape:e,x:i,y:s,size:n}=this,r=this.layerManager?.canvas?.pixelRatio??1,o=Marker.anchor(e),a={path:t,x:i-(o.x-.5)*n,y:s-(o.y-.5)*n,size:n,pixelRatio:r};t.clear(),typeof e=="string"?MARKER_SHAPES[e](a):typeof e=="function"&&e(a)}computeBBox(){const{x:t,y:e,size:i}=this,s=Marker.anchor(this.shape);return new BBox(t-i*s.x,e-i*s.y,i,i)}executeFill(t,e){if(e)return super.executeFill(t,e)}executeStroke(t,e){if(e)return super.executeStroke(t,e)}};__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"shape",2),__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"x",2),__decorateClass([ScenePathChangeDetection()],InternalMarker.prototype,"y",2),__decorateClass([ScenePathChangeDetection({convertor:Math.abs})],InternalMarker.prototype,"size",2);var Marker=class extends Rotatable(Scalable(Translatable(InternalMarker))){static anchor(t){return t==="pin"?{x:.5,y:1}:typeof t=="function"&&"anchor"in t?t.anchor:{x:.5,y:.5}}constructor(t){super(t),t?.shape!=null&&(this.shape=t.shape)}};function legendSymbolSvg(t,e,i=e*(5/3)){const s=new Group,n=Math.min(t.marker.strokeWidth,2),r=Math.min(t.line?.strokeWidth??0,2),o=Math.max(t.marker.enabled===!1?0:e,t.line==null?0:i),a=Math.max(t.marker.enabled===!1?0:e,r);if(t.line!=null){const{stroke:l,strokeOpacity:c,lineDash:h}=t.line,u=new Line;u.x1=0,u.y1=a/2,u.x2=o,u.y2=a/2,u.stroke=l,u.strokeOpacity=c,u.strokeWidth=r,u.lineDash=h,s.append(u)}if(t.marker.enabled!==!1){const{shape:l,fill:c,fillOpacity:h,stroke:u,strokeOpacity:d,lineDash:p,lineDashOffset:g}=t.marker,m=new Marker;m.shape=l??"square",m.size=e,m.fill=c,m.fillOpacity=h,m.stroke=u,m.strokeOpacity=d,m.strokeWidth=n,m.lineDash=p,m.lineDashOffset=g;const y=Marker.anchor(l),f=o/2+(y.x-.5)*e,x=a/2+(y.y-.5)*e,v=e/(e+n);m.x=0,m.y=0,m.translationX=f,m.translationY=x,m.scalingX=v,m.scalingY=v,s.append(m)}return Group.toSVG(s,o,a)}var M=.1,K=200,C=12,DELTA=.5,SpringAnimation=class extends Listeners{constructor(){super(...arguments),this.x1=NaN,this.y1=NaN,this.x=NaN,this.y=NaN,this.vx=0,this.vy=0,this.t0=NaN,this.animationFrameHandle=void 0}reset(){this.x=NaN,this.y=NaN,this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0)}update(t,e){if(Number.isNaN(this.x)||Number.isNaN(this.y)){this.x=t,this.y=e,this.vx=0,this.vy=0,this.emitUpdate(),this.animationFrameHandle!=null&&(cancelAnimationFrame(this.animationFrameHandle),this.animationFrameHandle=void 0);return}this.x1=t,this.y1=e,this.t0=Date.now(),this.animationFrameHandle==null&&(this.animationFrameHandle=requestAnimationFrame(this.onFrame.bind(this)))}onFrame(){this.animationFrameHandle=void 0;const{x1:t,y1:e,t0:i}=this,s=Date.now(),n=s-i;this.t0=s;const r=.001,o=Math.ceil(n/(r*1e3))|0;let{x:a,y:l,vx:c,vy:h}=this;for(let u=0;u{e.push(i.label??i.fallbackLabel,i.value)}),e.join("; "))}function dataHtml(t,e,i){let s="";t==null?s+=`${sanitizeHtml(e)}`:(s+=`${sanitizeHtml(t)}`,s+=" ",s+=`${sanitizeHtml(e)}`);const n=[`${DEFAULT_TOOLTIP_CLASS}-row`];return i&&n.push(`${DEFAULT_TOOLTIP_CLASS}-row--inline`),s=`
${s}
`,s}function tooltipContentHtml(t){if(t.type==="raw")return t.rawHtmlString;let e="";if((t.heading==null||t.title==null)&&t.data?.length===1&&t.data[0].label==null&&t.data[0].value!=null){const i=t.data[0];e+=dataHtml(t.heading??t.title,i.value,!1)}else{const i=t.title==null&&t.data?.length===1;t.heading!=null&&(e+=`${sanitizeHtml(t.heading)}`,e+=" ");const s=t.symbol==null?void 0:legendSymbolSvg(t.symbol,12);s!=null&&(t.title!=null||t.data?.length)&&(e+=`${s}`),t.title!=null&&(e+=`${sanitizeHtml(t.title)}`,e+=" "),t.data?.forEach(n=>{e+=dataHtml(n.label??n.fallbackLabel,n.value,i),e+=" "})}return e=`
${e.trimEnd()}
`,e}var TooltipPosition=class extends BaseProperties{constructor(){super(...arguments),this.type="pointer",this.xOffset=0,this.yOffset=0}};__decorateClass([Validate(UNION(["pointer","node","top","right","bottom","left","top-left","top-right","bottom-right","bottom-left",{value:"sparkline",undocumented:!0},{value:"sparkline-",undocumented:!0}],"a position type"))],TooltipPosition.prototype,"type",2),__decorateClass([Validate(NUMBER)],TooltipPosition.prototype,"xOffset",2),__decorateClass([Validate(NUMBER)],TooltipPosition.prototype,"yOffset",2);var Tooltip=class extends BaseProperties{constructor(){super(),this.enabled=!0,this.delay=0,this.range=void 0,this.wrapping="hyphenate",this.position=new TooltipPosition,this.darkTheme=!1,this.bounds="extended",this.destroyFns=[],this.springAnimation=new SpringAnimation,this.enableInteraction=!1,this.wrapTypes=["always","hyphenate","on-space","never"],this.showTimeout=0,this._showArrow=!0,this._compact=!1,this._visible=!1,this.positionParams=void 0,this.destroyFns.push(this.springAnimation.addListener("update",this.updateTooltipPosition.bind(this)))}get interactive(){return this.enableInteraction}setup(t){"togglePopover"in getWindow().HTMLElement.prototype&&(this.element=t.addChild("canvas-overlay",DEFAULT_TOOLTIP_CLASS),this.element.setAttribute("popover","manual"),this.element.className=DEFAULT_TOOLTIP_CLASS)}destroy(t){t.removeChild("canvas-overlay",DEFAULT_TOOLTIP_CLASS),this.destroyFns.forEach(e=>e())}isVisible(){return this._visible}contains(t){return this.element?.contains(t)??!1}updateTooltipPosition(){const{element:t,positionParams:e}=this;if(t==null||e==null)return;const{canvasRect:i,relativeRect:s,meta:n}=e,{x:r,y:o}=this.springAnimation,a=n.position?.type??this.position.type,l=n.position?.xOffset??0,c=n.position?.yOffset??0,h=s.x,u=s.y,d=s.width-t.clientWidth-1+h,p=s.height-t.clientHeight+u;let g=this.getTooltipBounds({positionType:a,canvasX:r,canvasY:o,yOffset:c,xOffset:l,canvasRect:i}),m=calculatePlacement(t.clientWidth,t.clientHeight,s,g);a==="sparkline"&&(m.x<=h||m.x>=d)&&(g=this.getTooltipBounds({positionType:"sparkline-constrained",canvasX:r,canvasY:o,yOffset:c,xOffset:l,canvasRect:i}),m=calculatePlacement(t.clientWidth,t.clientHeight,s,g));const y=clamp(h,m.x,d),f=clamp(u,m.y,p),x=y!==m.x||f!==m.y,v=(a==="node"||a==="pointer")&&!x&&!l&&!c,b=n.showArrow??this.showArrow??v;this.updateShowArrow(b),this.updateCompact(a==="sparkline"||a==="sparkline-constrained"),t.style.transform=`translate(${y}px, ${f}px)`}show(t,e,i,s,n=!1){const{element:r}=this;if(r!=null&&s!=null)r.innerHTML=tooltipContentHtml(s);else if(r==null||r.innerHTML===""){this.toggle(!1);return}const o={x:t.x-e.x,y:t.y-e.y,width:t.width,height:t.height};this.positionParams={canvasRect:e,relativeRect:o,meta:i},this.springAnimation.update(i.canvasX,i.canvasY),r.style.top=`${e.top}px`,r.style.left=`${e.left}px`,i.enableInteraction?(this.enableInteraction=!0,r.style.pointerEvents="auto",r.removeAttribute("aria-hidden")):(this.enableInteraction=!1,r.style.pointerEvents="none",r.setAttribute("aria-hidden","true")),this.delay>0&&!n?(this.toggle(!1),this.showTimeout=setTimeout(()=>{this.toggle(!0)},this.delay)):this.toggle(!0)}hide(){this.springAnimation.reset(),this.toggle(!1)}toggle(t){if(!this.element?.isConnected)return;this._visible=t;const{classList:e}=this.element,i=(s,n)=>e.toggle(`${DEFAULT_TOOLTIP_CLASS}--${s}`,n);t||clearTimeout(this.showTimeout),i("no-interaction",!this.enableInteraction),i("arrow",this._showArrow),i("compact",this._compact),e.toggle(DEFAULT_TOOLTIP_DARK_CLASS,this.darkTheme),this.element.togglePopover(t),t&&this.updateTooltipPosition();for(const s of this.wrapTypes)e.toggle(`${DEFAULT_TOOLTIP_CLASS}--wrap-${s}`,s===this.wrapping)}updateShowArrow(t){this._showArrow=t}updateCompact(t){this._compact=t}getTooltipBounds(t){if(!this.element)return{};const{positionType:e,canvasX:i,canvasY:s,yOffset:n,xOffset:r,canvasRect:o}=t,{clientWidth:a,clientHeight:l}=this.element,c={width:a,height:l};switch(e){case"node":case"pointer":return c.top=s+n-l-8,c.left=i+r-a/2,c;case"top":return c.top=n,c.left=o.width/2-a/2+r,c;case"right":return c.top=o.height/2-l/2+n,c.left=o.width-a/2+r,c;case"left":return c.top=o.height/2-l/2+n,c.left=r,c;case"bottom":return c.top=o.height-l+n,c.left=o.width/2-a/2+r,c;case"top-left":return c.top=n,c.left=r,c;case"top-right":return c.top=n,c.left=o.width-a+r,c;case"bottom-right":return c.top=o.height-l+n,c.left=o.width-a+r,c;case"bottom-left":return c.top=o.height-l+n,c.left=r,c;case"sparkline":return c.top=s+n-l/2,c.left=i+r+8,c;case"sparkline-constrained":return c.top=s+n-l/2,c.left=i+r-8-a,c}}};__decorateClass([Validate(BOOLEAN)],Tooltip.prototype,"enabled",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],Tooltip.prototype,"showArrow",2),__decorateClass([Validate(POSITIVE_NUMBER)],Tooltip.prototype,"delay",2),__decorateClass([Validate(INTERACTION_RANGE,{optional:!0})],Tooltip.prototype,"range",2),__decorateClass([Validate(TEXT_WRAP)],Tooltip.prototype,"wrapping",2),__decorateClass([Validate(OBJECT)],Tooltip.prototype,"position",2),__decorateClass([Validate(BOOLEAN)],Tooltip.prototype,"darkTheme",2),__decorateClass([Validate(UNION(["extended","canvas"]))],Tooltip.prototype,"bounds",2);var SeriesAreaManager=class extends BaseManager{constructor(t){super(),this.chart=t,this.id=createId(this),this.series=[],this.highlight={pendingHoverEvent:void 0,appliedHoverEvent:void 0,stashedHoverEvent:void 0},this.tooltip={lastHover:void 0},this.hoverDevice="pointer",this.previousInputDevice="keyboard",this.focus={sortedSeries:[],series:void 0,seriesIndex:0,datumIndex:0,datum:void 0},this.hoverScheduler=debouncedAnimationFrame(()=>{if(!(!this.tooltip.lastHover&&!this.highlight.pendingHoverEvent)){if(this.chart.getUpdateType()<=4){this.hoverScheduler.schedule();return}this.highlight.pendingHoverEvent&&this.handleHoverHighlight(!1),this.tooltip.lastHover&&this.handleHoverTooltip(this.tooltip.lastHover,!1)}});const e=t.ctx.domManager.addChild("series-area","series-area-aria-label1"),i=t.ctx.domManager.addChild("series-area","series-area-aria-label2");this.swapChain=new FocusSwapChain(e,i,this.id,"img"),this.swapChain.addListener("blur",()=>this.onBlur()),this.swapChain.addListener("focus",()=>this.onFocus()),this.focusIndicator=new FocusIndicator(this.swapChain),this.focusIndicator.overrideFocusVisible(t.mode==="integrated"?!1:void 0);const{seriesDragInterpreter:s,seriesWidget:n,containerWidget:r}=t.ctx.widgets;n.setTabIndex(-1),this.destroyFns.push(()=>t.ctx.domManager.removeChild("series-area","series-area-aria-label1"),()=>t.ctx.domManager.removeChild("series-area","series-area-aria-label2"),n.addListener("focus",()=>this.swapChain.focus()),n.addListener("mousemove",o=>this.onHover(o)),n.addListener("wheel",o=>this.onWheel(o)),n.addListener("mouseleave",o=>this.onLeave(o)),n.addListener("keydown",o=>this.onKeyDown(o)),n.addListener("contextmenu",(o,a)=>this.onContextMenu(o,a)),s.addListener("drag-move",o=>this.onDragMove(o)),s.addListener("click",o=>this.onClick(o,n)),s.addListener("dblclick",o=>this.onClick(o,n)),r.addListener("contextmenu",(o,a)=>this.onContextMenu(o,a)),r.addListener("click",(o,a)=>this.onClick(o,a)),r.addListener("dblclick",(o,a)=>this.onClick(o,a)),t.ctx.animationManager.addListener("animation-start",()=>this.clearAll()),t.ctx.domManager.addListener("resize",()=>this.clearAll()),t.ctx.highlightManager.addListener("highlight-change",o=>this.changeHighlightDatum(o)),t.ctx.layoutManager.addListener("layout:complete",o=>this.layoutComplete(o)),t.ctx.updateService.addListener("pre-scene-render",()=>this.preSceneRender()),t.ctx.updateService.addListener("update-complete",()=>this.updateComplete()),t.ctx.zoomManager.addListener("zoom-change",()=>this.clearAll()),t.ctx.zoomManager.addListener("zoom-pan-start",()=>this.clearAll()))}isState(t){return this.chart.ctx.interactionManager.isState(t)}isIgnoredTouch(t){return!(t.device!=="touch"||t.type==="click"||this.chart.ctx.chartService.touch.dragAction==="hover"||this.chart.ctx.chartService.touch.dragAction==="drag"&&this.isState(9))}dataChanged(){var t;(t=this.highlight).stashedHoverEvent??(t.stashedHoverEvent=this.highlight.appliedHoverEvent),this.chart.ctx.tooltipManager.removeTooltip(this.id),this.focusIndicator.clear(),this.clearHighlight()}preSceneRender(){this.highlight.stashedHoverEvent!=null&&(this.highlight.pendingHoverEvent=this.highlight.stashedHoverEvent,this.highlight.stashedHoverEvent=void 0,this.handleHoverHighlight(!0)),this.tooltip.lastHover!=null&&this.handleHoverTooltip(this.tooltip.lastHover,!0)}updateComplete(){this.focusIndicator.isFocusVisible()&&this.isState(34)&&this.handleSeriesFocus(0,0,!0)}update(t,e){this.chart.ctx.updateService.update(t,e)}seriesChanged(t){this.focus.sortedSeries=[...t].sort((e,i)=>{let s=e.properties.focusPriority??1/0,n=i.properties.focusPriority??1/0;return s===n&&([s,n]=[e._declarationOrder,i._declarationOrder]),sn?1:0}),this.series=t}layoutComplete(t){this.seriesRect=t.series.rect,this.hoverRect=t.series.paddedRect,this.chart.ctx.widgets.seriesWidget.setBounds(t.series.paddedRect),this.chart.ctx.widgets.chartWidget.setBounds(t.chart)}onContextMenu(t,e){const{sourceEvent:i}=t;if(i.currentTarget!=e.getElement())return;if(i.target==this.chart.ctx.widgets.containerWidget.getElement()){if(this.isState(36)){const{currentX:l,currentY:c}=t;this.chart.ctx.contextMenuRegistry.dispatchContext("all",{sourceEvent:i,canvasX:l,canvasY:c},{})}return}let s,n;if(this.focusIndicator.isFocusVisible())s=this.chart.ctx.highlightManager.getActiveHighlight(),s&&this.seriesRect&&s.midPoint&&(n=Transformable.toCanvasPoint(s.series.contentGroup,s.midPoint.x,s.midPoint.y));else if(this.isState(36)){const l=this.pickNode({x:t.currentX,y:t.currentY},"context-menu");l&&(this.chart.ctx.highlightManager.updateHighlight(this.id),s=l.datum)}const r=s?.series;this.clearAll();const o=t.currentX+e.cssLeft(),a=t.currentY+e.cssTop();this.chart.ctx.contextMenuRegistry.dispatchContext("series-area",{sourceEvent:i,canvasX:o,canvasY:a},{pickedSeries:r,pickedNode:s},n)}onLeave(t){!this.isState(41)||t.sourceEvent.relatedTarget?.className==="ag-charts-text-input__textarea"||this.chart.ctx.tooltipManager.isEnteringInteractiveTooltip(t)||(this.chart.ctx.domManager.updateCursor(this.id),this.focusIndicator.isFocusVisible()||this.clearAll())}onWheel(t){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.previousInputDevice="pointer")}onDragMove(t){this.isState(41)&&(this.focusIndicator?.overrideFocusVisible(!1),this.onHoverLikeEvent(t))}onHover(t){this.isState(41)&&this.onHoverLikeEvent(t)}onHoverLikeEvent(t){if(!this.isIgnoredTouch(t)&&((t.device==="touch"||excludesType(t,"drag-move"))&&(this.tooltip.lastHover=t),t.device==="touch"&&this.chart.ctx.chartService.touch.dragAction==="hover"&&t.sourceEvent.preventDefault(),this.hoverDevice="pointer",this.previousInputDevice="pointer",this.highlight.pendingHoverEvent=t,this.hoverScheduler.schedule(),this.isState(32))){const{currentX:e,currentY:i}=t,s=this.pickNode({x:e,y:i},"event");s?.series.hasEventListener("nodeClick")||s?.series.hasEventListener("nodeDoubleClick")?this.chart.ctx.domManager.updateCursor(this.id,"pointer"):this.chart.ctx.domManager.updateCursor(this.id)}}onClick(t,e){if(t.device==="touch"&&e===this.chart.ctx.widgets.seriesWidget&&this.swapChain.focus({preventScroll:!0}),!this.isState(41))return;if(e===this.chart.ctx.widgets.seriesWidget){if(!e.getElement().contains(t.sourceEvent.target))return}else if(t.sourceEvent.target!=e.getElement())return;if(this.focusIndicator.overrideFocusVisible(!1),this.onHoverLikeEvent(t),!this.isState(32))return;if(e==this.chart.ctx.widgets.seriesWidget&&this.checkSeriesNodeClick(t)){this.update(4),t.sourceEvent.preventDefault();return}const i={type:t.type==="click"?"click":"doubleClick",event:t.sourceEvent};this.chart.fireEvent(i)}onFocus(){this.isState(34)&&(this.hoverDevice=this.focusIndicator.isFocusVisible()?"keyboard":"pointer",this.handleFocus(0,0))}onBlur(){this.isState(34)&&(this.hoverDevice="pointer",this.clearAll(),this.focusIndicator.overrideFocusVisible(void 0))}onKeyDown(t){if(!this.isState(43))return;const e=mapKeyboardEventToAction(t.sourceEvent);switch(e?.activatesFocusIndicator===!1&&this.focusIndicator.overrideFocusVisible(this.previousInputDevice==="keyboard"),e?.name){case"redo":return this.chart.ctx.chartEventManager.seriesEvent("series-redo");case"undo":return this.chart.ctx.chartEventManager.seriesEvent("series-undo");case"zoomin":return this.chart.ctx.chartEventManager.seriesKeyNavZoom(1,t);case"zoomout":return this.chart.ctx.chartEventManager.seriesKeyNavZoom(-1,t);case"arrowup":return this.onArrow(-1,0,t);case"arrowdown":return this.onArrow(1,0,t);case"arrowleft":return this.onArrow(0,-1,t);case"arrowright":return this.onArrow(0,1,t);case"submit":return this.onSubmit(t)}}onArrow(t,e,i){this.isState(34)&&(this.hoverDevice="keyboard",this.previousInputDevice="keyboard",this.focusIndicator.overrideFocusVisible(!0),this.focus.seriesIndex+=t,this.focus.datumIndex+=e,this.handleFocus(t,e),i.sourceEvent.preventDefault(),this.chart.ctx.chartEventManager.seriesEvent("series-focus-change"))}onSubmit(t){if(!this.isState(34))return;const{series:e,datum:i}=this.focus,s=t.sourceEvent;e!==void 0&&i!==void 0?e.fireNodeClickEvent(s,i):this.chart.fireEvent({type:"click",event:s}),s.preventDefault()}checkSeriesNodeClick(t){const e=this.pickNode({x:t.currentX,y:t.currentY},"event");return e==null?!1:t.type==="click"?(e.series.fireNodeClickEvent(t.sourceEvent,e.datum),!0):t.type==="dblclick"?(t.preventZoomDblClick=e.distance===0,e.series.fireNodeDoubleClickEvent(t.sourceEvent,e.datum),!0):!1}handleFocus(t,e){const i=this.chart.overlays.getFocusInfo(this.chart.ctx.localeManager);i==null?this.handleSeriesFocus(t,e):this.focusIndicator.update(i.rect,this.seriesRect,!1)}handleSeriesFocus(t,e,i=!1){if(this.chart.chartType==="hierarchy"||this.chart.chartType==="gauge"){this.handleSoloSeriesFocus(t,e,i);return}const{focus:s,seriesRect:n}=this,r=s.sortedSeries.filter(h=>h.visible&&h.focusable);if(r.length===0)return;const o={datumIndex:s.datumIndex-e,otherIndex:s.seriesIndex-t};s.seriesIndex=clamp(0,s.seriesIndex,r.length-1),s.series=r[s.seriesIndex];const{datumIndex:a,seriesIndex:l}=s,c=s.series.pickFocus({datumIndex:a,datumIndexDelta:e,otherIndex:l,otherIndexDelta:t,seriesRect:n});this.updatePickedFocus(t,e,o,c,i)}handleSoloSeriesFocus(t,e,i){this.focus.series=this.focus.sortedSeries[0];const{focus:{series:s,seriesIndex:n,datumIndex:r},seriesRect:o}=this;if(s==null)return;const a={datumIndex:this.focus.datumIndex-e,otherIndex:this.focus.seriesIndex-t},l=s.pickFocus({datumIndex:r,datumIndexDelta:e,otherIndex:n,otherIndexDelta:t,seriesRect:o});this.updatePickedFocus(t,e,a,l,i)}updatePickedFocus(t,e,i,s,n){const{focus:r,hoverRect:o}=this;if(s===void 0||r.series===void 0||o===void 0)return;const{datum:a,datumIndex:l,otherIndex:c}=s;if(c!==void 0&&(r.seriesIndex=c),r.datumIndex=l,r.datum=a,this.focusIndicator.isFocusVisible()&&this.chart.ctx.animationManager.reset(),this.focusIndicator.isFocusVisible()){const u=getPickedFocusBBox(s),{x:d,y:p}=u.computeCenter();if(!o.containsPoint(d,p)&&this.chart.ctx.zoomManager.panToBBox(this.id,o,u))return}this.focusIndicator.update(s.bounds,this.seriesRect,s.clipFocusBox);const h=makeKeyboardPointerEvent(r.series,o,s);if(h!==void 0&&this.hoverDevice==="keyboard"){this.tooltip.lastHover=void 0,this.highlight.appliedHoverEvent=void 0,this.highlight.pendingHoverEvent=void 0,this.highlight.stashedHoverEvent=void 0;const u=r.series.getTooltipContent(a),d=TooltipManager.makeTooltipMeta(h,r.series,a);this.chart.ctx.highlightManager.updateHighlight(this.id,a),this.chart.tooltip.enabled&&r.series.tooltipEnabled?this.chart.ctx.tooltipManager.updateTooltip(this.id,d,u):this.chart.ctx.tooltipManager.removeTooltip(this.id),n||(e===0&&t===0||i.datumIndex!==s.datumIndex||i.otherIndex!==(s.otherIndex??r.seriesIndex))&&this.swapChain.update(this.getDatumAriaText(a,u))}}getDatumAriaText(t,e){const i=e==null?"":tooltipContentAriaLabel(e);return this.chart.ctx.localeManager.t("ariaAnnounceHoverDatum",{datum:t.series.getDatumAriaText?.(t,i)??i})}clearHighlight(){this.highlight.pendingHoverEvent=void 0,this.highlight.appliedHoverEvent=void 0,this.chart.ctx.highlightManager.updateHighlight(this.id)}clearTooltip(){this.chart.ctx.tooltipManager.removeTooltip(this.id),this.tooltip.lastHover=void 0}clearAll(){this.clearHighlight(),this.clearTooltip(),this.focusIndicator.clear()}handleHoverHighlight(t){this.highlight.appliedHoverEvent=this.highlight.pendingHoverEvent,this.highlight.pendingHoverEvent=void 0;const e=this.highlight.appliedHoverEvent;if(!e||!this.isState(41))return;const{currentX:i,currentY:s}=e,n=e.currentX+(this.hoverRect?.x??0),r=e.currentY+(this.hoverRect?.y??0);if(t?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(n,r)){this.clearHighlight();return}const{range:o}=this.chart.highlight,a=o==="tooltip"?"highlight-tooltip":"highlight",l=this.pickNode({x:i,y:s},a);if(l){this.chart.ctx.highlightManager.updateHighlight(this.id,l.datum),this.hoverDevice="pointer";return}this.chart.ctx.highlightManager.updateHighlight(this.id)}handleHoverTooltip(t,e){if(!this.isState(41))return;const{currentX:i,currentY:s}=t,n=i+(this.hoverRect?.x??0),r=s+(this.hoverRect?.y??0),o=t.sourceEvent.target;if(e?this.chart.ctx.animationManager.isActive():!this.hoverRect?.containsPoint(n,r)){this.hoverDevice=="pointer"&&this.clearTooltip();return}if(o&&this.chart.tooltip.interactive&&this.chart.ctx.domManager.isManagedChildDOMElement(o,"canvas-overlay",DEFAULT_TOOLTIP_CLASS))return;const a=this.pickNode({x:t.currentX,y:t.currentY},"tooltip");if(!a){this.hoverDevice=="pointer"&&this.clearTooltip();return}this.hoverDevice="pointer";const l=a.series.getTooltipContent(a.datum);if(this.chart.tooltip.enabled&&a.series.tooltipEnabled&&l!=null){const u=TooltipManager.makeTooltipMeta({type:"pointermove",canvasX:n,canvasY:r},a.series,a.datum);this.chart.ctx.tooltipManager.updateTooltip(this.id,u,l)}else this.chart.ctx.tooltipManager.removeTooltip(this.id)}changeHighlightDatum(t){const e=new Set,{series:i=void 0,datum:s}=t.currentHighlight??{},{series:n=void 0,datum:r}=t.previousHighlight??{};n&&e.add(n),i&&e.add(i),n?.properties.cursor&&r&&this.chart.ctx.domManager.updateCursor(n.id),i?.properties.cursor&&i?.properties.cursor!=="default"&&s&&this.chart.ctx.domManager.updateCursor(i.id,i.properties.cursor),i==null||n==null?this.update(4):this.update(4,{seriesToUpdate:e})}pickNode(t,e,i){const s=[...this.series].reverse();let n;for(const r of s){if(!r.visible||!r.contentGroup.visible)continue;const{match:o,distance:a}=r.pickNode(t,e,i)??{};if(!(!o||a==null)&&((!n||n.distance>a)&&(n={series:r,distance:a,datum:o}),a===0))break}return n}};function excludesType(t,e){return t.type!==e}var SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION=30,SeriesLayerManager=class{constructor(t){this.seriesRoot=t,this.groups=new Map,this.series=new Map,this.expectedSeriesCount=1,this.mode="normal"}setSeriesCount(t){this.expectedSeriesCount=t}requestGroup(t){const{internalId:e,type:i,contentGroup:s,seriesGrouping:n}=t,{groupIndex:r=e}=n??{},o=this.series.get(e);if(o!=null)throw new Error(`AG Charts - series already has an allocated layer: ${JSON.stringify(o)}`);this.series.size===0&&(this.mode=this.expectedSeriesCount>=SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION?"aggressive-grouping":"normal");let a=this.groups.get(i);a==null&&(a=new Map,this.groups.set(i,a));const l=this.lookupIdx(r);let c=a.get(l);return c==null&&(c={type:i,id:l,seriesIds:[],group:this.seriesRoot.appendChild(new Group({name:`${t.contentGroup.name??i}-managed-layer`,zIndex:t.contentGroup.zIndex,renderToOffscreenCanvas:!1}))},a.set(l,c)),this.series.set(e,{layerState:c,seriesConfig:t}),c.seriesIds.push(e),c.group.appendChild(s),c.group}changeGroup(t){const{internalId:e,seriesGrouping:i,type:s,contentGroup:n,oldGrouping:r}=t,{groupIndex:o=e}=i??{};this.groups.get(s)?.get(o)?.seriesIds.includes(e)||(this.series.has(e)&&this.releaseGroup({internalId:e,seriesGrouping:r,type:s,contentGroup:n}),this.requestGroup(t))}releaseGroup(t){const{internalId:e,contentGroup:i,type:s}=t;if(!this.series.has(e))throw new Error(`AG Charts - series doesn't have an allocated layer: ${e}`);const n=this.series.get(e)?.layerState;n&&(n.seriesIds=n.seriesIds.filter(r=>r!==e),n.group.removeChild(i)),n?.seriesIds.length===0?(this.seriesRoot.removeChild(n.group),this.groups.get(n.type)?.delete(n.id),this.groups.get(s)?.delete(e)):n!=null&&n.seriesIds.length>0&&(n.group.zIndex=this.getLowestSeriesZIndex(n.seriesIds)),this.series.delete(e)}updateLayerCompositing(){this.groups.forEach(t=>{t.forEach(e=>{const{group:i,seriesIds:s}=e;let n;s.length===0?n=!1:s.length>1?n=!0:n=this.series.get(s[0])?.seriesConfig.renderToOffscreenCanvas()===!0,i.renderToOffscreenCanvas=n,i.zIndex=this.getLowestSeriesZIndex(s)})})}lookupIdx(t){return this.mode==="normal"?t:typeof t=="string"&&(t=Number(t.split("-").at(-1)),!t)?0:Math.floor(clamp(0,t/this.expectedSeriesCount,1)*SERIES_THRESHOLD_FOR_AGGRESSIVE_LAYER_REDUCTION)}destroy(){this.groups.forEach(t=>{t.forEach(e=>{this.seriesRoot.removeChild(e.group)})}),this.groups.clear(),this.series.clear()}getLowestSeriesZIndex(t){return t.reduce((i,s)=>{const r=this.series.get(s)?.seriesConfig.contentGroup.zIndex;return i==null||r==null?r:compareZIndex(i,r)<=0?i:r},void 0)??1}},Touch=class extends BaseProperties{constructor(){super(...arguments),this.dragAction="drag"}};__decorateClass([Validate(UNION(["none","drag","hover"]))],Touch.prototype,"dragAction",2);var DataWindowProcessor=class{constructor(t,e,i,s,n){this.chart=t,this.dataService=e,this.updateService=i,this.zoomManager=s,this.animationManager=n,this.dirtyZoom=!1,this.dirtyDataSource=!1,this.lastAxisZooms=new Map,this.destroyFns=[],this.destroyFns.push(this.dataService.addListener("data-source-change",()=>this.onDataSourceChange()),this.dataService.addListener("data-load",()=>this.onDataLoad()),this.dataService.addListener("data-error",()=>this.onDataError()),this.updateService.addListener("update-complete",()=>this.onUpdateComplete()),this.zoomManager.addListener("zoom-change",()=>this.onZoomChange()))}destroy(){this.destroyFns.forEach(t=>t())}onDataLoad(){this.animationManager.skip(),this.updateService.update(1)}onDataError(){this.updateService.update(3)}onDataSourceChange(){this.dirtyDataSource=!0}onUpdateComplete(){!this.dirtyZoom&&!this.dirtyDataSource||this.updateWindow()}onZoomChange(){this.dirtyZoom=!0}updateWindow(){if(!this.dataService.isLazy())return;const t=this.getValidAxis();let e,i=!0;if(t){const s=this.zoomManager.getAxisZoom(t.id);e=this.getAxisWindow(t,s),i=this.shouldRefresh(t,s)}this.dirtyZoom=!1,this.dirtyDataSource=!1,i&&this.dataService.load({windowStart:e?.min,windowEnd:e?.max})}getValidAxis(){return this.chart.axes.find(t=>t.type==="time")}shouldRefresh(t,e){if(this.dirtyDataSource)return!0;if(!this.dirtyZoom)return!1;const i=this.lastAxisZooms.get(t.id);return i&&e.min===i.min&&e.max===i.max?!1:(this.lastAxisZooms.set(t.id,e),!0)}getAxisWindow(t,e){const{domain:i}=t.scale;if(!e||i.length===0||isNaN(Number(i[0])))return;const s=Number(i[1])-Number(i[0]),n=new Date(Number(i[0])+s*e.min),r=new Date(Number(i[0])+s*e.max);return{min:n,max:r}}},isSafariRegexp=/^((?!chrome|android).)*safari/i,safariVersionRegexp=/Version\/(\d+(\.\d+)?)/,isChromeRegexp=/Chrome/,chromeVersionRegexp=/Chrome\/(\d+)/,isEdge=/Edg/,isOpera=/OPR/;function isUnsupportedBrowser(){const{userAgent:t}=getWindow("navigator");if(isSafariRegexp.test(t)){const e=parseFloat(safariVersionRegexp.exec(t)?.[1]??"0"),i=Math.floor(e)>16;return i||logger_exports.warnOnce(`Unsupported Safari version: ${e}; ${t}`),!i}else if(isChromeRegexp.test(t)&&!isEdge.test(t)&&!isOpera.test(t)){const e=parseInt(chromeVersionRegexp.exec(t)?.[1]??"0",10),i=e>126;return i||logger_exports.warnOnce(`Unsupported Chrome version: ${e}; ${t}`),!i}return!1}var visibleIgnoredSeries=new Set(["map-shape-background","map-line-background"]),OverlaysProcessor=class{constructor(t,e,i,s,n,r,o){this.chartLike=t,this.overlays=e,this.dataService=i,this.layoutManager=s,this.localeManager=n,this.animationManager=r,this.domManager=o,this.destroyFns=[],this.overlayElem=this.domManager.addChild("canvas-overlay","overlay"),this.overlayElem.role="status",this.overlayElem.ariaAtomic="false",this.overlayElem.ariaLive="polite",this.overlayElem.classList.toggle(DEFAULT_OVERLAY_CLASS),this.destroyFns.push(this.layoutManager.addListener("layout:complete",a=>this.onLayoutComplete(a)))}destroy(){this.destroyFns.forEach(t=>t()),this.domManager.removeStyles("overlays"),this.domManager.removeChild("canvas-overlay","overlay")}onLayoutComplete({series:{rect:t}}){const e=this.dataService.isLoading(),i=this.chartLike.series.some(c=>c.hasData),s=this.chartLike.series.some(c=>c.visible&&!visibleIgnoredSeries.has(c.type));this.overlays.darkTheme?this.overlayElem.classList.add(DEFAULT_OVERLAY_DARK_CLASS):this.overlayElem.classList.remove(DEFAULT_OVERLAY_DARK_CLASS),this.overlayElem.style.left=`${t.x}px`,this.overlayElem.style.top=`${t.y}px`,this.overlayElem.style.width=`${t.width}px`,this.overlayElem.style.height=`${t.height}px`;const n=e,r=!e&&!i,o=i&&!s,a=this.overlays.unsupportedBrowser.enabled&&isUnsupportedBrowser();n?this.showOverlay(this.overlays.loading,t):this.hideOverlay(this.overlays.loading),r?this.showOverlay(this.overlays.noData,t):this.hideOverlay(this.overlays.noData),o?this.showOverlay(this.overlays.noVisibleSeries,t):this.hideOverlay(this.overlays.noVisibleSeries),a?this.showOverlay(this.overlays.unsupportedBrowser,t):this.hideOverlay(this.overlays.unsupportedBrowser);const l=n||r||o||a;setAttribute(this.overlayElem,"aria-hidden",!l)}showOverlay(t,e){if(!t.enabled)return;const i=t.getElement(this.animationManager,this.localeManager,e);this.overlayElem.appendChild(i)}hideOverlay(t){t.removeElement(()=>{this.overlayElem.innerText="\xA0"},this.animationManager)}},debug=Debug.create(!0,"opts"),SeriesArea=class extends BaseProperties{constructor(){super(...arguments),this.padding=new Padding(0)}};__decorateClass([Validate(BOOLEAN,{optional:!0})],SeriesArea.prototype,"clip",2),__decorateClass([Validate(OBJECT)],SeriesArea.prototype,"padding",2);var _Chart=class Vt extends Observable{constructor(e,i){var s;super(),this.id=createId(this),this.seriesRoot=new TranslatableGroup({name:`${this.id}-series-root`,zIndex:5}),this.annotationRoot=new TranslatableGroup({name:`${this.id}-annotation-root`,zIndex:9}),this.titleGroup=new Group({name:"titles",zIndex:13}),this.debug=Debug.create(),this.extraDebugStats={},this.data=[],this._firstAutoSize=!0,this._autoSizeNotify=new AsyncAwaitQueue,this.padding=new Padding(20),this.seriesArea=new SeriesArea,this.keyboard=new Keyboard,this.touch=new Touch,this.mode="standalone",this.chartCaptions=new ChartCaptions,this.suppressFieldDotNotation=!1,this.destroyed=!1,this._destroyFns=[],this.skipSync=!1,this.chartAnimationPhase="initial",this.modulesManager=new ModulesManager,this.processors=[],this.queuedUserOptions=[],this.queuedChartOptions=[],this.firstApply=!0,this._pendingFactoryUpdatesCount=0,this._performUpdateSkipAnimations=!1,this._performUpdateNotify=new AsyncAwaitQueue,this.performUpdateType=7,this.runningUpdateType=7,this.updateShortcutCount=0,this.seriesToUpdate=new Set,this.updateMutex=new Mutex,this.updateRequestors={},this.performUpdateTrigger=debouncedCallback(({count:h})=>{this.destroyed||this.updateMutex.acquire(async()=>{try{await this.performUpdate(h)}catch(u){logger_exports.error("update error",u)}}).catch(u=>logger_exports.errorOnce(u))}),this._performUpdateSplits={},this.axes=[],this.series=[],this._cachedData=void 0,this.onSeriesNodeClick=h=>{this.fireEvent({...h,type:"seriesNodeClick"})},this.onSeriesNodeDoubleClick=h=>{this.fireEvent({...h,type:"seriesNodeDoubleClick"})},this.onSeriesVisibilityChange=h=>{this.fireEvent(h)},this.seriesGroupingChanged=h=>{if(!(h instanceof SeriesGroupingChangedEvent))return;const{series:u,seriesGrouping:d,oldGrouping:p}=h;u.contentGroup.isRoot()||this.seriesLayerManager.changeGroup({internalId:u.internalId,type:u.type,contentGroup:u.contentGroup,renderToOffscreenCanvas:()=>u.renderToOffscreenCanvas(),seriesGrouping:d,oldGrouping:p})},this.chartOptions=e;const n=i?.scene,r=i?.container??e.processedOptions.container??void 0,o=i?.styleContainer??e.specialOverrides.styleContainer;n&&(this._firstAutoSize=!1,this._lastAutoSize=[n.width,n.height,n.pixelRatio]);const a=new Group({name:"root"});a.visible=!1,a.append(this.seriesRoot),a.append(this.annotationRoot),a.append(this.titleGroup),this.titleGroup.append(this.title.node),this.titleGroup.append(this.subtitle.node),this.titleGroup.append(this.footnote.node),this.tooltip=new Tooltip,this.seriesLayerManager=new SeriesLayerManager(this.seriesRoot),this.mode=e.userOptions.mode??this.mode;const l=this.ctx=new ChartContext(this,{chartType:this.getChartType(),scene:n,root:a,container:r,styleContainer:o,syncManager:new SyncManager(this),fireEvent:h=>this.fireEvent(h),updateCallback:(h,u)=>this.update(h,u),updateMutex:this.updateMutex});this._destroyFns.push(l.domManager.addListener("resize",()=>this.parentResize(l.domManager.containerSize))),this.overlays=new ChartOverlays,(s=this.overlays.loading).renderer??(s.renderer=()=>getLoadingSpinner(this.overlays.loading.getText(l.localeManager),l.animationManager.defaultDuration)),this.processors=[new DataWindowProcessor(this,l.dataService,l.updateService,l.zoomManager,l.animationManager),new OverlaysProcessor(this,this.overlays,l.dataService,l.layoutManager,l.localeManager,l.animationManager,l.domManager)],this.highlight=new ChartHighlight,this.container=r;const c=this.getModuleContext();l.domManager.setDataBoolean("animating",!1),this.seriesAreaManager=new SeriesAreaManager(this.initSeriesAreaDependencies()),this._destroyFns.push(l.layoutManager.registerElement(0,h=>{h.layoutBox.shrink(this.padding.toJson()),this.chartCaptions.positionCaptions(h)}),l.layoutManager.addListener("layout:complete",h=>this.chartCaptions.positionAbsoluteCaptions(h)),l.dataService.addListener("data-load",h=>{this.data=h.data}),this.title.registerInteraction(c,"beforebegin"),this.subtitle.registerInteraction(c,"beforebegin"),this.footnote.registerInteraction(c,"afterend"),Widget.addWindowEvent("page-left",()=>this.destroy()),l.animationManager.addListener("animation-frame",()=>{this.update(6)}),l.animationManager.addListener("animation-start",()=>l.domManager.setDataBoolean("animating",!0)),l.animationManager.addListener("animation-stop",()=>l.domManager.setDataBoolean("animating",!1)),l.zoomManager.addListener("zoom-change",()=>{this.series.forEach(u=>u.animationState?.transition("updateData"));const h=this.chartAnimationPhase!=="initial";this.update(3,{forceNodeDataRefresh:!0,skipAnimations:h})})),this.parentResize(l.domManager.containerSize)}static getInstance(e){return Vt.chartsInstances.get(e)}get canvasElement(){return this.ctx.scene.canvas.element}download(e,i){this.ctx.scene.download(e,i)}getCanvasDataURL(e){return this.ctx.scene.getDataURL(e)}toSVG(){return this.ctx.scene.toSVG()}getOptions(){return this.queuedUserOptions.at(-1)??this.chartOptions.userOptions}getChartOptions(){return this.queuedChartOptions.at(-1)??this.chartOptions}overrideFocusVisible(e){this.seriesAreaManager.focusIndicator.overrideFocusVisible(e)}initSeriesAreaDependencies(){const{ctx:e,tooltip:i,highlight:s,overlays:n,seriesRoot:r,mode:o}=this,a=this.getChartType();return{fireEvent:this.fireEvent.bind(this),getUpdateType:()=>this.performUpdateType,chartType:a,ctx:e,tooltip:i,highlight:s,overlays:n,seriesRoot:r,mode:o}}getModuleContext(){return this.ctx}getCaptionText(){return[this.title,this.subtitle,this.footnote].filter(e=>e.enabled&&e.text).map(e=>e.text).join(". ")}getAriaLabel(){return this.ctx.localeManager.t("ariaAnnounceChart",{seriesCount:this.series.length})}resetAnimations(){this.chartAnimationPhase="initial";for(const e of this.series)e.resetAnimation(this.chartAnimationPhase);for(const e of this.axes)e.resetAnimation(this.chartAnimationPhase);this.animationRect=void 0,this.ctx.animationManager.reset()}skipAnimations(){this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0}detachAndClear(){this.container=void 0,this.ctx.scene.clear()}destroy(e){if(this.destroyed)return;const i=e?.keepTransferableResources;let s;return this.performUpdateType=7,this._destroyFns.forEach(n=>n()),this.processors.forEach(n=>n.destroy()),this.tooltip.destroy(this.ctx.domManager),this.overlays.destroy(),this.modulesManager.destroy(),i?(this.ctx.scene.strip(),s={container:this.container,scene:this.ctx.scene}):(this.ctx.scene.destroy(),this.container=void 0),this.destroySeries(this.series),this.seriesLayerManager.destroy(),this.axes.forEach(n=>n.destroy()),this.axes=[],this.animationRect=void 0,this.ctx.destroy(),this.destroyed=!0,Object.freeze(this),s}requestFactoryUpdate(e){this.destroyed||(this._pendingFactoryUpdatesCount++,this.updateMutex.acquire(async()=>{if(!this.destroyed)try{await e(this)}finally{this.destroyed||this._pendingFactoryUpdatesCount--}}).catch(i=>logger_exports.errorOnce(i)))}update(e=0,i){if(this.destroyed)return;const{forceNodeDataRefresh:s=!1,skipAnimations:n,seriesToUpdate:r=this.series,newAnimationBatch:o}=i??{};this.ctx.widgets.seriesWidget.setDragTouchEnabled(this.touch.dragAction!=="none"),s&&this.series.forEach(a=>a.markNodeDataDirty());for(const a of r)this.seriesToUpdate.add(a);if(n&&(this.ctx.animationManager.skipCurrentBatch(),this._performUpdateSkipAnimations=!0),o&&this.ctx.animationManager.isActive()&&(this._performUpdateSkipAnimations=!0),this.skipSync=i?.skipSync??!1,this.debug.check()){let a=new Error().stack??"";a=a.replace(/\([^)]*/g,""),this.updateRequestors[a]=e}ethis.chartAnimationPhase="ready")),this.debug("Chart.performUpdate() - start",ChartUpdateType[i]);let a=performance.now();n.start??(n.start=a);const l=h=>{n[h]??(n[h]=0),n[h]+=performance.now()-a,a=performance.now()};switch(i){case 0:if(this.checkUpdateShortcut(0))break;this.ctx.updateService.dispatchPreDomUpdate(),this.updateDOM();case 1:if(this.checkUpdateShortcut(1))break;await this.updateData(),l("\u2B07\uFE0F");case 2:if(this.checkUpdateShortcut(2))break;await this.processData(),this.seriesAreaManager.dataChanged(),l("\u{1F3ED}");case 3:if(await this.checkFirstAutoSize(),this.checkUpdateShortcut(3))break;await this.processLayout(),l("\u2316");case 4:{if(this.checkUpdateShortcut(4))break;await this.updateSeries(o),l("\u{1F914}"),this.updateAriaLabels(),this.seriesLayerManager.updateLayerCompositing()}case 5:if(this.checkUpdateShortcut(5))break;r.updateService.dispatchPreSceneRender(),l("\u2196");case 6:if(this.checkUpdateShortcut(6))break;r.animationManager.endBatch(),s.updateShortcutCount=this.updateShortcutCount,r.scene.render({debugSplitTimes:n,extraDebugStats:s,seriesRect:this.seriesRect}),this.extraDebugStats={};for(const h of Object.keys(n))delete n[h];this.ctx.domManager.incrementDataCounter("sceneRenders");case 7:this.updateShortcutCount=0,this.updateRequestors={},this._performUpdateSkipAnimations=!1,r.animationManager.endBatch()}this.destroyed||(r.updateService.dispatchUpdateComplete(),this.ctx.domManager.setDataBoolean("updatePending",!1),this.runningUpdateType=7),this._performUpdateNotify.notify();const c=performance.now();this.debug("Chart.performUpdate() - end",{chart:this,durationMs:Math.round((c-n.start)*100)/100,count:e,performUpdateType:ChartUpdateType[i]})}updateThemeClassName(){const e="ag-charts-theme-",i=[`${e}default`,`${e}default-dark`];let s=i[0],n=!1,{theme:r}=this.chartOptions.processedOptions;for(;typeof r!="string"&&r!=null;)r=r.baseTheme;typeof r=="string"&&(s=r.replace("ag-",e),n=r.includes("-dark")),i.includes(s)||(s=n?i[1]:i[0]),this.ctx.domManager.setThemeClass(s)}updateDOM(){this.updateThemeClassName();const{enabled:e,tabIndex:i}=this.keyboard;this.ctx.domManager.setTabGuardIndex(e?i??0:-1),this.ctx.domManager.setThemeParameters(this.chartOptions.themeParameters)}updateAriaLabels(){this.ctx.domManager.updateCanvasLabel(this.getAriaLabel())}checkUpdateShortcut(e){return this.destroyed?!0:this.updateShortcutCount>3?(logger_exports.warn("exceeded the maximum number of simultaneous updates (4), discarding changes and rendering",this.updateRequestors),!1):this.performUpdateType<=e?(this.updateShortcutCount++,!0):!1}async checkFirstAutoSize(){this.width!=null&&this.height!=null||this._lastAutoSize||await this._autoSizeNotify.await(500)||this.debug("Chart.checkFirstAutoSize() - timeout for first size update.")}onAxisChange(e,i){i==null&&e.length===0||this.ctx.axisManager.updateAxes(i??[],e)}onSeriesChange(e,i){const s=i?.filter(n=>!e.includes(n))??[];this.destroySeries(s),this.seriesLayerManager?.setSeriesCount(e.length);for(const n of e){if(i?.includes(n))continue;const r=this.seriesLayerManager.requestGroup(n);n.attachSeries(r,this.seriesRoot,this.annotationRoot);const o=this;n.chart={get mode(){return o.mode},get isMiniChart(){return!1},get seriesRect(){return o.seriesRect}},n.resetAnimation(this.chartAnimationPhase),this.addSeriesListeners(n),n.addChartEventListeners()}this.seriesAreaManager?.seriesChanged(e)}destroySeries(e){e?.forEach(i=>{i.removeEventListener("nodeClick",this.onSeriesNodeClick),i.removeEventListener("nodeDoubleClick",this.onSeriesNodeDoubleClick),i.removeEventListener("groupingChanged",this.seriesGroupingChanged),i.destroy(),this.seriesLayerManager.releaseGroup(i),i.detachSeries(void 0,this.seriesRoot,this.annotationRoot),i.chart=void 0})}addSeriesListeners(e){this.hasEventListener("seriesNodeClick")&&e.addEventListener("nodeClick",this.onSeriesNodeClick),this.hasEventListener("seriesNodeDoubleClick")&&e.addEventListener("nodeDoubleClick",this.onSeriesNodeDoubleClick),this.hasEventListener("seriesVisibilityChange")&&e.addEventListener("seriesVisibilityChange",this.onSeriesVisibilityChange),e.addEventListener("groupingChanged",this.seriesGroupingChanged)}assignSeriesToAxes(){for(const e of this.axes)e.boundSeries=this.series.filter(i=>i.axes[e.direction]===e)}assignAxesToSeries(){const e=groupBy(this.axes,i=>i.direction);for(const i of this.series)for(const s of i.directions){const n=e[s];if(!n){logger_exports.warnOnce(`no available axis for direction [${s}]; check series and axes configuration.`);return}const r=i.getKeys(s),o=n.find(a=>!a.keys.length||r.some(l=>a.keys.includes(l)));if(!o){logger_exports.warnOnce(`no matching axis for direction [${s}] and keys [${r}]; check series and axes configuration.`);return}i.axes[s]=o}}parentResize(e){if(e==null||this.width!=null&&this.height!=null)return;let{width:i,height:s}=e;const{pixelRatio:n}=e;if(i=Math.floor(i),s=Math.floor(s),i===0&&s===0)return;const[r=0,o=0,a=1]=this._lastAutoSize??[];r===i&&o===s&&a===n||(this._lastAutoSize=[i,s,n],this.resize("SizeMonitor",{}))}resize(e,i){const{scene:s,animationManager:n}=this.ctx,{inWidth:r,inHeight:o,inMinWidth:a,inMinHeight:l,inOverrideDevicePixelRatio:c}=i;this.ctx.domManager.setSizeOptions(a??this.minWidth,l??this.minHeight,r??this.width,o??this.height);const h=r??this.width??this._lastAutoSize?.[0],u=o??this.height??this._lastAutoSize?.[1],d=c??this.overrideDevicePixelRatio??this._lastAutoSize?.[2];if(this.debug(`Chart.resize() from ${e}`,{width:h,height:u,pixelRatio:d,stack:new Error().stack}),!(h==null||u==null||!isFiniteNumber(h)||!isFiniteNumber(u))&&s.resize(h,u,d)){n.reset();let p=!0;(this.width==null||this.height==null)&&this._firstAutoSize&&(p=!1,this._firstAutoSize=!1),this.update(3,{forceNodeDataRefresh:!0,skipAnimations:p}),this._autoSizeNotify.notify()}}async updateData(){this.series.forEach(i=>i.setChartData(this.data));const e=this.modulesManager.mapModules(i=>i.updateData?.(this.data));await Promise.all(e)}async processData(){this.series.some(n=>n.canHaveAxes)&&(this.assignAxesToSeries(),this.assignSeriesToAxes());const e=new DataController(this.mode,this.suppressFieldDotNotation),i=this.series.map(n=>(n.resetDatumCallbackCache(),n.processData(e))),s=this.modulesManager.mapModules(n=>n.processData?.(e));this._cachedData=e.execute(this._cachedData),await Promise.all([...i,...s]);for(const n of this.axes)n.processData();this.updateLegends()}updateLegends(e){for(const{legend:i,legendType:s}of this.modulesManager.legends())s==="category"?this.setCategoryLegendData(e):this.setLegendData(s,i)}setCategoryLegendData(e){var i;const{ctx:{legendManager:s,stateManager:n}}=this;e&&this.series.forEach(o=>{const a=e.find(l=>l.seriesId===o.id);o.onLegendInitialState("category",a)});const r=this.series.flatMap(o=>{const a=o.getLegendData("category");return s.updateData(o.id,a),a});if(e){n.setStateAndRestore(s,e);return}if(this.mode!=="integrated"){const o={},a=new Map(this.series.map(l=>[l.id,l.type]));for(const{seriesId:l,symbol:{marker:c},label:h}of r.filter(u=>!u.hideInLegend)){if(c.fill==null)continue;const u=a.get(l),d=o[u]??(o[u]={});d[i=h.text]??(d[i]=c.fill),d[h.text]!==c.fill&&logger_exports.warnOnce(`legend item '${h.text}' has multiple fill colors, this may cause unexpected behaviour.`)}}s.update()}setLegendData(e,i){i.data=this.series.filter(s=>s.properties.showInLegend).flatMap(s=>s.getLegendData(e))}async processLayout(){const e=this.animationRect,{width:i,height:s}=this.ctx.scene,n=this.ctx.layoutManager.createContext(i,s);await this.performLayout(n),e&&!this.animationRect?.equals(e)&&this.ctx.animationManager.skipCurrentBatch(),this.debug("Chart.performUpdate() - seriesRect",this.seriesRect)}async updateSeries(e){const{seriesRect:i}=this;await Promise.all(e.map(s=>s.update({seriesRect:i}))),this.ctx.seriesLabelLayoutManager.updateLabels(this.series.filter(s=>s.visible&&s.usesPlacedLabels),this.padding,this.seriesRect)}async waitForUpdate(e=1e4,i=!1){const s=performance.now();for(;(this._pendingFactoryUpdatesCount>0||this.performUpdateType!==7||this.runningUpdateType!==7)&&!this.destroyed;){if(this._pendingFactoryUpdatesCount>0&&await this.updateMutex.waitForClearAcquireQueue(),(this.performUpdateType!==7||this.runningUpdateType!==7)&&await this._performUpdateNotify.await(),performance.now()-s>e){const n=`Chart.waitForUpdate() timeout of ${e} reached - first chart update taking too long.`;if(i)throw new Error(n);logger_exports.warnOnce(n)}isInputPending()&&await pause()}}filterMiniChartSeries(e){return e?.filter(i=>i.showInMiniChart!==!1)}applyOptions(e){const i=this.firstApply?e.processedOptions:e.diffOptions(this.chartOptions);if(i==null||Object.keys(i).length===0)return;const s=this.firstApply?{}:this.chartOptions.processedOptions,n=e.processedOptions;debug("Chart.applyOptions() - applying delta",i);const r=this.applyModules(n),o=["type","data","series","listeners","preset","theme","legend.listeners","navigator.miniChart.series","navigator.miniChart.label","locale.localeText","axes","topology","nodes","initialState","styleContainer"];i.listeners&&this.registerListeners(this,i.listeners),jsonApply(this,i,{skip:o});let a=!1,l="no-op";i.series!=null&&(l=this.applySeries(this,i.series,s?.series),a=!0),l==="replaced"&&this.resetAnimations(),this.applyAxes(this,n,s,l,[])&&(a=!0),i.data&&(this.data=i.data),i.legend?.listeners&&this.modulesManager.isEnabled("legend")&&Object.assign(this.legend.listeners,i.legend.listeners),i.locale?.localeText&&(this.modulesManager.getModule("locale").localeText=i.locale?.localeText),this.chartOptions=e;const c=this.modulesManager.getModule("navigator"),h=this.modulesManager.getModule("zoom");!c?.enabled&&!h?.enabled&&this.ctx.zoomManager.updateZoom("chart");const u=c?.miniChart,d=n.navigator?.miniChart?.series??n.series;u?.enabled===!0&&d!=null?this.applyMiniChartOptions(u,d,n,s):u?.enabled===!1&&(u.series=[],u.axes=[]),this.ctx.annotationManager.setAnnotationStyles(e.annotationThemes),a||(a=this.shouldForceNodeDataRefresh(i,l));const g=a||r?0:3;this.maybeResetAnimations(l),this.shouldClearLegendData(n,s,l)&&this.ctx.legendManager.clearData(),this.applyInitialState(n),debug("Chart.applyOptions() - update type",ChartUpdateType[g],{seriesStatus:l,forceNodeDataRefresh:a}),this.update(g,{forceNodeDataRefresh:a,newAnimationBatch:!0}),this.firstApply=!1}applyInitialState(e){const{annotationManager:i,chartTypeOriginator:s,historyManager:n,stateManager:r,zoomManager:o}=this.ctx,{initialState:a}=e;if("annotations"in e&&e.annotations?.enabled&&a?.annotations!=null){const l=a.annotations.map(c=>{const h=i.getAnnotationTypeStyles(c.type);return mergeDefaults(c,h)});r.setState(i,l)}a?.chartType!=null&&r.setState(s,a.chartType),(e.navigator?.enabled||e.zoom?.enabled)&&a?.zoom!=null&&r.setState(o,a.zoom),a?.legend!=null&&this.updateLegends(a.legend),a!=null&&n.clear()}maybeResetAnimations(e){if(this.mode==="standalone")switch(e){case"series-grouping-change":case"replaced":this.resetAnimations();break;default:}}shouldForceNodeDataRefresh(e,i){const s=!!e.data||i==="data-change"||i==="replaced",n=legendRegistry.getKeys(),r=Object.values(n).some(a=>e[a]!=null),o=e.title!=null&&e.subtitle!=null;return s||r||o}shouldClearLegendData(e,i,s){const n=s==="replaced"||s==="series-grouping-change"||s==="updated",r=i.legend!=null&&e.legend==null;return n||r}applyMiniChartOptions(e,i,s,n){const r=n?.navigator?.miniChart?.series??n?.series,o=this.applySeries(e,this.filterMiniChartSeries(i),this.filterMiniChartSeries(r));this.applyAxes(e,s,n,o,["axes[].tick","axes[].thickness","axes[].title","axes[].crosshair","axes[].gridLine","axes[].label"]);const a=e.series;for(const h of a)h.properties.id=void 0;const l=e.axes,c=l.find(h=>h.direction==="x");for(const h of l)h.nice=!1,h.gridLine.enabled=!1,h.label.enabled=h===c,h.tick.enabled=!1,h.interactionEnabled=!1;if(c!=null){const h=s.navigator?.miniChart,u=h?.label,d=h?.label?.interval;if(c.line.enabled=!1,c.label.set(without(u,["interval","rotation","minSpacing","autoRotate","autoRotateAngle"])),c.tick.set(without(d,["enabled","width","size","color","interval","step"])),c.type==="grouped-category"){c.label.enabled=!1,c.label.rotation=0;const{depthOptions:g}=c;if(g.length===0)g.set([{label:{enabled:!0}}]);else for(let m=1;ma.moduleFactory(this.getModuleContext())),n.type==="legend"&&this.modulesManager.getModule(n)?.attachLegend(this.ctx.scene),this[n.optionsKey]=this.modulesManager.getModule(n)):(this.modulesManager.removeModule(n),delete this[n.optionsKey]),s=!0)}return s}initSeriesDeclarationOrder(e){for(let i=0;ithis.createSeries(u));return this.initSeriesDeclarationOrder(h),e.series=h,"replaced"}debug("Chart.applySeries() - matchResult",n);const r=[];let o=!1,a=!1,l=!1;const c=n.changes.toSorted((h,u)=>h.targetIdx-u.targetIdx);for(const h of c)switch(a||(a=h.status==="series-grouping"),o||(o=h.diff?.data!=null),l||(l=h.status!=="no-op"),h.status){case"add":{const u=this.createSeries(h.opts);r.push(u),debug("Chart.applySeries() - created new series",u);break}case"remove":debug(`Chart.applySeries() - removing series at previous idx ${h.idx}`,h.series);break;case"no-op":r.push(h.series),debug(`Chart.applySeries() - no change to series at previous idx ${h.idx}`,h.series);break;case"series-grouping":case"update":default:{const{series:u,diff:d,idx:p}=h;debug(`Chart.applySeries() - applying series diff previous idx ${p}`,d,u),this.applySeriesValues(u,d),u.markNodeDataDirty(),r.push(u)}}return this.initSeriesDeclarationOrder(r),debug("Chart.applySeries() - final series instances",r),e.series=r,a?"series-grouping-change":o?"data-change":l?"updated":"no-op"}applyAxes(e,i,s,n,r=[]){if(!("axes"in i)||!i.axes)return!1;r=["axes[].type",...r];const{axes:o}=i;return!(n==="replaced")&&e.axes.length===o.length&&e.axes.every((c,h)=>c.type===o[h].type)&&isAgCartesianChartOptions(s)?(e.axes.forEach((c,h)=>{const u=s.axes?.[h]??{},d=jsonDiff(u,o[h]);debug(`Chart.applyAxes() - applying axis diff idx ${h}`,d);const p=`axes[${h}]`;jsonApply(c,d,{path:p,skip:r})}),!0):(debug(`Chart.applyAxes() - creating new axes instances; seriesStatus: ${n}`),e.axes=this.createAxis(o,r),!0)}createSeries(e){const i=seriesRegistry.create(e.type,this.getModuleContext());return this.applySeriesOptionModules(i,e),this.applySeriesValues(i,e),i}applySeriesOptionModules(e,i){const s=e.createModuleContext(),n=e.getModuleMap();for(const r of moduleRegistry.byType("series-option"))r.optionsKey in i&&r.seriesTypes.includes(e.type)&&n.addModule(r,o=>o.moduleFactory(s))}applySeriesValues(e,i){const s=e.getModuleMap(),{type:n,data:r,listeners:o,seriesGrouping:a,showInMiniChart:l,...c}=i;for(const h of EXPECTED_ENTERPRISE_MODULES)if(h.type==="series-option"&&h.optionsKey in c){const u=s.getModule(h.optionsKey);if(u){const d=c[h.optionsKey];delete c[h.optionsKey],u.properties.set(d)}}e.properties.set(c),"data"in i&&e.setOptionsData(r),o&&this.registerListeners(e,o),"seriesGrouping"in i&&(a==null?e.seriesGrouping=void 0:e.seriesGrouping={...e.seriesGrouping,...a})}createAxis(e,i){const s=[],n=this.getModuleContext();for(let r=0;ra.moduleFactory(s)),e[r.optionsKey]=n.getModule(r)):(n.removeModule(r),delete e[r.optionsKey]))}}registerListeners(e,i){e.clearEventListeners();for(const[s,n]of Object.entries(i))isFunction(n)&&e.addEventListener(s,n)}};_Chart.chartsInstances=new WeakMap,__decorateClass([ActionOnSet({newValue(t){this.destroyed||(this.ctx.domManager.setContainer(t),_Chart.chartsInstances.set(t,this))},oldValue(t){_Chart.chartsInstances.delete(t)}})],_Chart.prototype,"container",2),__decorateClass([ActionOnSet({newValue(t){this.resize("width option",{inWidth:t})}})],_Chart.prototype,"width",2),__decorateClass([ActionOnSet({newValue(t){this.resize("height option",{inHeight:t})}})],_Chart.prototype,"height",2),__decorateClass([ActionOnSet({newValue(t){this.resize("minWidth option",{inMinWidth:t})}})],_Chart.prototype,"minWidth",2),__decorateClass([ActionOnSet({newValue(t){this.resize("minHeight option",{inMinHeight:t})}})],_Chart.prototype,"minHeight",2),__decorateClass([ActionOnSet({newValue(t){this.resize("overrideDevicePixelRatio option",{inOverrideDevicePixelRatio:t})}})],_Chart.prototype,"overrideDevicePixelRatio",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"padding",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"seriesArea",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"keyboard",2),__decorateClass([Validate(OBJECT)],_Chart.prototype,"touch",2),__decorateClass([Validate(UNION(["standalone","integrated"],"a chart mode"))],_Chart.prototype,"mode",2),__decorateClass([ProxyProperty("chartCaptions.title")],_Chart.prototype,"title",2),__decorateClass([ProxyProperty("chartCaptions.subtitle")],_Chart.prototype,"subtitle",2),__decorateClass([ProxyProperty("chartCaptions.footnote")],_Chart.prototype,"footnote",2),__decorateClass([Validate(BOOLEAN)],_Chart.prototype,"suppressFieldDotNotation",2),__decorateClass([ActionOnSet({changeValue(t,e){this.onAxisChange(t,e)}})],_Chart.prototype,"axes",2),__decorateClass([ActionOnSet({changeValue(t,e){this.onSeriesChange(t,e)}})],_Chart.prototype,"series",2);var Chart=_Chart,logFunctions={2:(t,e)=>Math.log2(e),[Math.E]:(t,e)=>Math.log(e),10:(t,e)=>Math.log10(e)},DEFAULT_LOG=(t,e)=>Math.log(e)/Math.log(t);function log2(t,e,i){const s=Math.min(...e),n=logFunctions[t]??DEFAULT_LOG;return s>=0?n(t,i):-n(t,-i)}var powFunctions={[Math.E]:(t,e)=>Math.exp(e),10:(t,e)=>e>=0?10**e:1/10**-e},DEFAULT_POW=(t,e)=>t**e;function pow(t,e,i){const s=Math.min(...e),n=powFunctions[t]??DEFAULT_POW;return s>=0?n(t,i):-n(t,-i)}var LogScale=class extends ContinuousScale{constructor(t=[1,10],e=[0,1]){super(t,e),this.type="log",this.defaultClamp=!0,this.base=10,this.log=i=>log2(this.base,this.domain,i),this.pow=i=>pow(this.base,this.domain,i)}toDomain(t){return t}transform(t){const[e,i]=findMinMax(this.domain);return e>=0!=i>=0?NaN:e>=0?Math.log(t):-Math.log(-t)}transformInvert(t){const[e,i]=findMinMax(this.domain);return e>=0!=i>=0?NaN:e>=0?Math.exp(t):-Math.exp(-t)}niceDomain(t,e=this.domain){if(e.length<2)return[];const{base:i}=this,[s,n]=e,r=s>n?Math.ceil:Math.floor,o=s>n?Math.floor:Math.ceil,a=pow(i,e,r(log2(i,e,s))),l=pow(i,e,o(log2(i,e,n)));return[a,l]}ticks({interval:t,tickCount:e=ContinuousScale.defaultTickCount},i=this.domain,s){if(!i||i.length<2||e<1)return[];const n=this.base,[r,o]=i,a=Math.min(r,o),l=Math.max(r,o);let c=this.log(a),h=this.log(l);if(t){const m=x=>x>=a&&x<=l,y=Math.min(Math.abs(t),Math.abs(h-c)),f=range(c,h,y).map(this.pow).filter(m);if(!isDenseInterval(f.length,this.getPixelRange()))return f}if(!isInteger(n)||h-c>=e)return createTicks(c,h,Math.min(h-c,e)).map(this.pow);let u=[];const d=a>0;c=Math.floor(c)-1,h=Math.round(h)+1;const p=findRangeExtent(this.range)/e;let g=1/0;for(let m=c;m<=h;m++){const y=this.convert(this.pow(m+1));for(let f=1;f=p&&A>=p;v>=a&&v<=l&&(f===1||D||u.length===0)&&(u.push(v),g=b)}}return u=filterVisibleTicks(u,d,s),u}tickFormatter({specifier:t}){return t!=null?numberFormat(t):String}datumFormatter(t){return this.tickFormatter(t)}},QuadtreeNearest=class{constructor(t,e,i){this.root=new QuadtreeNodeNearest(t,e,i)}clear(t){this.root.clear(t)}addValue(t,e){const i={hitTester:t,value:e,distanceSquared:(s,n)=>t.distanceSquared(s,n)};this.root.addElem(i)}find(t,e){const i={best:{nearest:void 0,distanceSquared:1/0}};return this.root.find(t,e,i),i.best}},QuadtreeSubdivisions=class{constructor(t,e,i,s){this.nw=t,this.ne=e,this.sw=i,this.se=s}addElem(t){this.nw.addElem(t),this.ne.addElem(t),this.sw.addElem(t),this.se.addElem(t)}find(t,e,i){this.nw.find(t,e,i),this.ne.find(t,e,i),this.sw.find(t,e,i),this.se.find(t,e,i)}},QuadtreeNode=class{constructor(t,e,i){this.capacity=t,this.maxdepth=e,this.boundary=i??BBox.NaN,this.elems=[],this.subdivisions=void 0}clear(t){this.elems.length=0,this.boundary=t,this.subdivisions=void 0}addElem(t){this.addCondition(t)&&(this.subdivisions===void 0?this.maxdepth===0||this.elems.length1){const o=n>r?Math.ceil:Math.floor,a=n>r?Math.floor:Math.ceil,l=4;for(let c=0;cformatValue(n,i)}datumFormatter({ticks:e,fractionDigits:i,specifier:s}){return s!=null?tickFormat(e,s):n=>formatValue(n,i+1)}};function extent(t){if(t.length===0)return null;let e=1/0,i=-1/0;for(const n of t){const r=n instanceof Date?n.getTime():n;typeof r=="number"&&(ri&&(i=r))}const s=[e,i];return s.every(isFinite)?s:null}function normalisedExtentWithMetadata(t,e,i){let s=!1;return t.length>2&&(t=extent(t)??[NaN,NaN]),isNaN(e)||(s||(s=e>t[0]),t=[e,t[1]]),isNaN(i)||(s||(s=it[1]&&(t=[]),{extent:t,clipped:s}}var NumberAxis=class extends CartesianAxis{constructor(t,e=new LinearScale){super(t,e),this.min=NaN,this.max=NaN}normaliseDataDomain(t){const{min:e,max:i}=this,{extent:s,clipped:n}=normalisedExtentWithMetadata(t,e,i);return{domain:s,clipped:n}}};NumberAxis.className="NumberAxis",NumberAxis.type="number",__decorateClass([Validate(AND(NUMBER_OR_NAN,LESS_THAN("max"))),Default(NaN)],NumberAxis.prototype,"min",2),__decorateClass([Validate(AND(NUMBER_OR_NAN,GREATER_THAN("min"))),Default(NaN)],NumberAxis.prototype,"max",2);var TimeAxis=class extends CartesianAxis{constructor(t){super(t,new TimeScale),this.min=void 0,this.max=void 0}normaliseDataDomain(t){let{min:e,max:i}=this,s=!1;return typeof e=="number"&&(e=new Date(e)),typeof i=="number"&&(i=new Date(i)),t.length>2&&(t=extent(t)?.map(n=>new Date(n))??[]),e instanceof Date&&(s||(s=e>t[0]),t=[e,t[1]]),i instanceof Date&&(s||(s=it[1]&&(t=[]),{domain:t,clipped:s}}};TimeAxis.className="TimeAxis",TimeAxis.type="time",__decorateClass([Validate(AND(DATE_OR_DATETIME_MS,LESS_THAN("max")),{optional:!0})],TimeAxis.prototype,"min",2),__decorateClass([Validate(AND(DATE_OR_DATETIME_MS,GREATER_THAN("min")),{optional:!0})],TimeAxis.prototype,"max",2);var DataModelSeries=class extends Series{constructor(){super(...arguments),this.clipFocusBox=!0}getScaleInformation({xScale:t,yScale:e}){const i=ContinuousScale.is(t),s=ContinuousScale.is(e);return{isContinuousX:i,isContinuousY:s,xScaleType:t?.type,yScaleType:e?.type}}getModulePropertyDefinitions(){const t=this.axes.x?.scale,e=this.axes.y?.scale;return this.moduleMap.mapModules(i=>i.getPropertyDefinitions(this.getScaleInformation({xScale:t,yScale:e}))).flat()}async requestDataModel(t,e,i){i.props.push(...this.getModulePropertyDefinitions());const{dataModel:s,processedData:n}=await t.request(this.id,e??[],i);return this.dataModel=s,this.processedData=n,this.dispatch("data-processed",{dataModel:s,processedData:n}),{dataModel:s,processedData:n}}isProcessedDataAnimatable(){const t=this.processedData?.reduced?.animationValidation;if(!t)return!0;const{orderedKeys:e,uniqueKeys:i}=t;return e&&i}checkProcessedDataAnimatable(){this.isProcessedDataAnimatable()||this.ctx.animationManager.skipCurrentBatch()}pickFocus(t){const e=this.getNodeData();if(e===void 0||e.length===0)return;const i=this.computeFocusDatumIndex(t,e);if(i===void 0)return;const{clipFocusBox:s}=this,n=e[i],r={...t,datumIndex:i},o=this.computeFocusBounds(r);if(o!==void 0)return{bounds:o,clipFocusBox:s,datum:n,datumIndex:i}}computeFocusDatumIndex(t,e){const i=a=>{const{missing:l=!1,enabled:c=!0,focusable:h=!0}=e[a];return!l&&c&&h},s=(a,l)=>{for(;a>=0&&!i(a);)a+=l;return a===-1?void 0:a},n=(a,l)=>{for(;a0?r=n(o,t.datumIndexDelta):r=n(o,1)??s(o,-1),r===void 0?t.datumIndexDelta===0?void 0:t.datumIndex-t.datumIndexDelta:r}},SeriesItemHighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.fill="rgba(255,255,255, 0.33)",this.stroke="rgba(0, 0, 0, 0.4)",this.strokeWidth=2}};__decorateClass([Validate(COLOR_STRING,{optional:!0})],SeriesItemHighlightStyle.prototype,"fill",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesItemHighlightStyle.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],SeriesItemHighlightStyle.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesItemHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesItemHighlightStyle.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH,{optional:!0})],SeriesItemHighlightStyle.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesItemHighlightStyle.prototype,"lineDashOffset",2);var SeriesHighlightStyle=class extends BaseProperties{};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],SeriesHighlightStyle.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO,{optional:!0})],SeriesHighlightStyle.prototype,"dimOpacity",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],SeriesHighlightStyle.prototype,"enabled",2);var TextHighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.color="black"}};__decorateClass([Validate(COLOR_STRING,{optional:!0})],TextHighlightStyle.prototype,"color",2);var HighlightProperties=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0}};__decorateClass([Validate(BOOLEAN,{optional:!0})],HighlightProperties.prototype,"enabled",2);var HighlightStyle=class extends BaseProperties{constructor(){super(...arguments),this.item=new SeriesItemHighlightStyle,this.series=new SeriesHighlightStyle,this.text=new TextHighlightStyle}};__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"item",2),__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"series",2),__decorateClass([Validate(OBJECT)],HighlightStyle.prototype,"text",2);var SeriesProperties=class extends BaseProperties{constructor(){super(...arguments),this.visible=!0,this.focusPriority=1/0,this.showInLegend=!0,this.cursor="default",this.nodeClickRange="exact",this.highlight=new HighlightProperties,this.highlightStyle=new HighlightStyle}};__decorateClass([Validate(STRING,{optional:!0})],SeriesProperties.prototype,"id",2),__decorateClass([Validate(BOOLEAN)],SeriesProperties.prototype,"visible",2),__decorateClass([Validate(REAL_NUMBER,{optional:!0})],SeriesProperties.prototype,"focusPriority",2),__decorateClass([Validate(BOOLEAN)],SeriesProperties.prototype,"showInLegend",2),__decorateClass([Validate(STRING)],SeriesProperties.prototype,"cursor",2),__decorateClass([Validate(INTERACTION_RANGE)],SeriesProperties.prototype,"nodeClickRange",2),__decorateClass([Validate(OBJECT)],SeriesProperties.prototype,"highlight",2),__decorateClass([Validate(OBJECT)],SeriesProperties.prototype,"highlightStyle",2);var DEFAULT_CARTESIAN_DIRECTION_KEYS={x:["xKey"],y:["yKey"]},DEFAULT_CARTESIAN_DIRECTION_NAMES={x:["xName"],y:["yName"]},CartesianSeriesNodeEvent=class extends SeriesNodeEvent{constructor(t,e,i,s){super(t,e,i,s),this.xKey=s.properties.xKey,this.yKey=s.properties.yKey}},CartesianSeriesProperties=class extends SeriesProperties{constructor(){super(...arguments),this.pickOutsideVisibleMinorAxis=!1}};__decorateClass([Validate(STRING,{optional:!0})],CartesianSeriesProperties.prototype,"legendItemName",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],CartesianSeriesProperties.prototype,"pickOutsideVisibleMinorAxis",2);var RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD=100,CartesianSeries=class extends DataModelSeries{constructor({pathsPerSeries:t=["path"],hasMarkers:e=!1,hasHighlightedLabels:i=!1,pathsZIndexSubOrderOffset:s=[],datumSelectionGarbageCollection:n=!0,markerSelectionGarbageCollection:r=!0,animationAlwaysUpdateSelections:o=!1,animationResetFns:a,directionKeys:l,directionNames:c,...h}){if(super({directionKeys:l,directionNames:c,canHaveAxes:!0,...h}),this.NodeEvent=CartesianSeriesNodeEvent,this.dataNodeGroup=this.contentGroup.appendChild(new Group({name:`${this.id}-series-dataNodes`,zIndex:0})),this.markerGroup=this.contentGroup.appendChild(new Group({name:`${this.id}-series-markers`,zIndex:1})),this.labelGroup=this.contentGroup.appendChild(new TranslatableGroup({name:`${this.id}-series-labels`})),this.labelSelection=Selection.select(this.labelGroup,Text),this.highlightSelection=Selection.select(this.highlightNode,()=>this.opts.hasMarkers?new Marker:this.nodeFactory()),this.highlightLabelSelection=Selection.select(this.highlightLabel,Text),this.annotationSelections=new Set,this.debug=Debug.create(),!l||!c)throw new Error(`Unable to initialise series type ${this.type}`);this.opts={pathsPerSeries:t,hasMarkers:e,hasHighlightedLabels:i,pathsZIndexSubOrderOffset:s,directionKeys:l,directionNames:c,animationResetFns:a,animationAlwaysUpdateSelections:o,datumSelectionGarbageCollection:n,markerSelectionGarbageCollection:r},this.paths=t.map(u=>new Path({name:`${this.id}-${u}`})),this.datumSelection=Selection.select(this.dataNodeGroup,()=>this.nodeFactory(),n),this.markerSelection=Selection.select(this.markerGroup,Marker,r),this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:u=>this.animateEmptyUpdateReady(u)},reset:"empty",skip:"ready",disable:"disabled"},ready:{updateData:"waiting",clear:"clearing",highlight:u=>this.animateReadyHighlight(u),highlightMarkers:u=>this.animateReadyHighlightMarkers(u),resize:u=>this.animateReadyResize(u),reset:"empty",skip:"ready",disable:"disabled"},waiting:{update:{target:"ready",action:u=>{this.ctx.animationManager.isSkipped()?this.resetAllAnimation(u):this.animateWaitingUpdateReady(u)}},reset:"empty",skip:"ready",disable:"disabled"},disabled:{update:u=>this.resetAllAnimation(u),reset:"empty"},clearing:{update:{target:"empty",action:u=>this.animateClearingUpdateEmpty(u)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}get contextNodeData(){return this._contextNodeData}getNodeData(){return this.contextNodeData?.nodeData}attachSeries(t,e,i){super.attachSeries(t,e,i),this.attachPaths(this.paths,e,i)}detachSeries(t,e,i){super.detachSeries(t,e,i),this.detachPaths(this.paths,e,i)}attachPaths(t,e,i){for(const s of t)this.contentGroup.appendChild(s)}detachPaths(t,e,i){for(const s of t)this.contentGroup.removeChild(s)}renderToOffscreenCanvas(){const t=this.getNodeData();return t!=null&&t.length>RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"?this.animationState.transition("skip"):t==="disabled"&&this.animationState.transition("disable")}addChartEventListeners(){this.destroyFns.push(this.ctx.chartEventManager.addListener("legend-item-click",t=>this.onLegendItemClick(t)),this.ctx.chartEventManager.addListener("legend-item-double-click",t=>this.onLegendItemDoubleClick(t)))}destroy(){super.destroy(),this._contextNodeData=void 0}update({seriesRect:t}){const{visible:e,_contextNodeData:i}=this,n=this.ctx.highlightManager?.getActiveHighlight()?.series===this,r=this.checkResize(t),o=this.updateHighlightSelection(n);this.updateSelections(e),this.updateNodes(o,n,e);const a=this.getAnimationData(t,i);a&&(r&&this.animationState.transition("resize",a),this.animationState.transition("update",a))}updateSelections(t){var e;const i=!this.opts.animationAlwaysUpdateSelections&&this.ctx.animationManager.isSkipped();if(!(!t&&i)&&!(!this.nodeDataRefresh&&!this.isPathOrSelectionDirty())){if(this.nodeDataRefresh){this.nodeDataRefresh=!1,this.debug("CartesianSeries.updateSelections() - calling createNodeData() for",this.id),this.markQuadtreeDirty(),this._contextNodeData=this.createNodeData();const s=this.isProcessedDataAnimatable();this._contextNodeData&&((e=this._contextNodeData).animationValid??(e.animationValid=s));const{dataModel:n,processedData:r}=this;n!==void 0&&r!==void 0&&this.dispatch("data-update",{dataModel:n,processedData:r})}this.updateSeriesSelections()}}updateSeriesSelections(t){const{datumSelection:e,labelSelection:i,markerSelection:s,paths:n}=this,r=this._contextNodeData;if(!r)return;const{nodeData:o,labelData:a,itemId:l}=r;this.updatePaths({seriesHighlighted:t,itemId:l,contextData:r,paths:n}),this.datumSelection=this.updateDatumSelection({nodeData:o,datumSelection:e}),this.labelSelection=this.updateLabelSelection({labelData:a,labelSelection:i})??i,this.opts.hasMarkers&&(this.markerSelection=this.updateMarkerSelection({nodeData:o,markerSelection:s}))}updateNodes(t,e,i){const{highlightSelection:s,highlightLabelSelection:n,opts:{hasMarkers:r,hasHighlightedLabels:o}}=this,a=!this.ctx.animationManager.isSkipped(),l=this.visible&&this._contextNodeData!=null&&i;this.contentGroup.visible=a||l,this.highlightGroup.visible=(a||l)&&e;const c=this.getOpacity();r?(this.updateMarkerNodes({markerSelection:s,isHighlight:!0}),this.animationState.transition("highlightMarkers",s)):(this.updateDatumNodes({datumSelection:s,isHighlight:!0}),this.animationState.transition("highlight",s)),o&&this.updateLabelNodes({labelSelection:n});const{dataNodeGroup:h,markerGroup:u,datumSelection:d,labelSelection:p,markerSelection:g,paths:m,labelGroup:y}=this,{itemId:f}=this.contextNodeData??{};h.opacity=c,h.visible=a||l,y.visible=l,r&&(u.opacity=c,u.visible=l),y&&(y.opacity=c),this.updatePathNodes({seriesHighlighted:e,itemId:f,paths:m,opacity:c,visible:l,animationEnabled:a}),h.visible&&(this.updateDatumNodes({datumSelection:d,highlightedItems:t,isHighlight:!1}),this.usesPlacedLabels||this.updateLabelNodes({labelSelection:p}),r&&this.updateMarkerNodes({markerSelection:g,isHighlight:!1}))}getHighlightLabelData(t,e){const i=t.filter(s=>s.datum===e.datum&&s.itemId===e.itemId);return i.length===0?void 0:i}getHighlightData(t,e){return e?[e]:void 0}updateHighlightSelection(t){const{highlightSelection:e,highlightLabelSelection:i,_contextNodeData:s}=this;if(!s)return;const n=this.ctx.highlightManager?.getActiveHighlight(),r=t&&n?.datum?n:void 0;let o,a;if(r!=null){const l=this.isLabelEnabled(),{labelData:c,nodeData:h}=s;a=this.getHighlightData(h,r),o=l?this.getHighlightLabelData(c,r):void 0}return this.highlightSelection=this.updateHighlightSelectionItem({items:a,highlightSelection:e}),this.highlightLabelSelection=this.updateHighlightSelectionLabel({items:o,highlightLabelSelection:i}),a}markQuadtreeDirty(){this.quadtree=void 0}*datumNodesIter(){for(const{node:t}of this.datumSelection)t.datum.missing!==!0&&(yield t)}getQuadTree(){if(this.quadtree===void 0){const{width:t,height:e}=this.ctx.scene.canvas,i=new BBox(0,0,t,e);this.quadtree=new QuadtreeNearest(100,10,i),this.initQuadTree(this.quadtree)}return this.quadtree}initQuadTree(t){}pickNodeExactShape(t){const e=super.pickNodeExactShape(t);if(e)return e;const{x:i,y:s}=t,{opts:{hasMarkers:n}}=this;let r;const{dataNodeGroup:o,markerGroup:a}=this;if(r=o.pickNode(i,s),!r&&n&&(r=a?.pickNode(i,s)),r&&r.datum.missing!==!0)return{datum:r.datum,distance:0};for(const l of this.moduleMap.modules()){const{datum:c}=l.pickNodeExact(t)??{};if(c!=null&&c?.missing!==!0)return{datum:c,distance:0}}}pickNodeClosestDatum(t){const{x:e,y:i}=t,{axes:s,_contextNodeData:n}=this;if(!n)return;const r=s.x,o=s.y,a={x:e,y:i};let l=1/0,c;for(const h of n.nodeData){const{point:{x:u=NaN,y:d=NaN}={}}=h;if(isNaN(u)||isNaN(d)||!(r?.inRange(u)&&o?.inRange(d)))continue;const g=Math.max((a.x-u)**2+(a.y-d)**2,0);gg.direction);if(e&&c.length===0)return;const[h="x"]=c,u=[i,s];h!=="x"&&u.reverse();const d=[1/0,1/0];let p;for(const g of r.nodeData){const{x:m=NaN,y=NaN}=g.point??g.midPoint??{};if(isNaN(m)||isNaN(y)||g.missing===!0)continue;const f=[a?.inRange(m),l?.inRange(y)];if(h!=="x"&&f.reverse(),!f[0]||!o&&!f[1])continue;const x=[m,y];h!=="x"&&x.reverse();let v=!0;for(let b=0;bd[b]){v=!1;break}else S{const o=i?.[r]??r;return this.xCoordinateRange(s[o],n,o)})}domainForVisibleRange(t,e,i,s,n,r){const{processedData:o,dataModel:a}=this,[l,c]=s,h=this.keysOrValues(i);if(n){const g=this.visibleRange(i,s,r);return a.getDomainBetweenRange(this,e,g,o)}const u=e.map(g=>this.keysOrValues(g));let d=1/0,p=-1/0;return h.forEach((g,m)=>{const[y,f]=this.xCoordinateRange(g,0,m);if(!(fc))for(let x=0;xp?[NaN,NaN]:[d,p]}domainForClippedRange(t,e,i,s){const{processedData:n,dataModel:r,axes:o}=this,l=axisExtent(o[t==="x"?"y":"x"]);if(!l)return e.flatMap(g=>r.getDomain(this,g,"value",n));const c=this.keysOrValues(i);if(s){const g=clippedRangeIndices(c.length,l,m=>c[m]);return r.getDomainBetweenRange(this,e,g,n)}const h=e.map(g=>this.keysOrValues(g)),u=l[0].valueOf(),d=l[1].valueOf(),p=[];return c.forEach((g,m)=>{const y=g.valueOf();if(yd)return;const f=h.map(x=>x[m]);y>=u&&p.push(...f),y<=d&&p.push(...f)}),p}countVisibleItems(t,e,i,s,n){const{dataModel:r,processedData:o}=this;if(!r||!o)return 1/0;const a=this.keysOrValues(t),l=e.map(S=>r.resolveColumnById(this,S,o)),c=this.axes.x,h=this.axes.y,u=this.shouldFlipXY(),d=c.range,p=h.range,g=(S,A,D)=>S[0]+(D-A[0])/(A[1]-A[0])*(S[1]-S[0]),m=g(d,c.visibleRange,i[0]),y=g(d,c.visibleRange,i[1]),f=g(p,h.visibleRange,u?s[0]:s[1]),x=g(p,h.visibleRange,u?s[1]:s[0]),v=Math.round((i[0]+(i[1]-i[0])/2)*a.length),b=0;return countExpandingSearch(0,a.length-1,v,n,S=>{let[A,D]=this.xCoordinateRange(a[S],b,S),[I,L]=this.yCoordinateRange(l.map(N=>N[S]),b,S);return!isFiniteNumber(A)||!isFiniteNumber(D)||!isFiniteNumber(I)||!isFiniteNumber(L)?!1:(u&&([A,D,I,L]=[I,L,A,D]),A>=m&&D<=y&&I>=f&&L<=x)})}updateHighlightSelectionItem(t){const{opts:{hasMarkers:e}}=this,{items:i,highlightSelection:s}=t,n=i??[];if(e){const r=s;return this.updateMarkerSelection({nodeData:n,markerSelection:r})}else return this.updateDatumSelection({nodeData:n,datumSelection:s})}updateHighlightSelectionLabel(t){return this.updateLabelSelection({labelData:t.items??[],labelSelection:t.highlightLabelSelection})}updateDatumSelection(t){return t.datumSelection}updateDatumNodes(t){}updateMarkerSelection(t){return t.markerSelection}updateMarkerNodes(t){}updatePaths(t){t.paths.forEach(e=>e.visible=!1)}updatePathNodes(t){const{paths:e,opacity:i,visible:s}=t;for(const n of e)n.opacity=i,n.visible=s}resetPathAnimation(t){const{path:e}=this.opts?.animationResetFns??{};e&&t.paths.forEach(i=>{resetMotion([i],e)})}resetDatumAnimation(t){const{datum:e}=this.opts?.animationResetFns??{};e&&resetMotion([t.datumSelection],e)}resetLabelAnimation(t){const{label:e}=this.opts?.animationResetFns??{};e&&resetMotion([t.labelSelection],e)}resetMarkerAnimation(t){const{marker:e}=this.opts?.animationResetFns??{};e&&this.opts.hasMarkers&&resetMotion([t.markerSelection],e)}resetAllAnimation(t){this.ctx.animationManager.stopByAnimationGroupId(this.id),this.resetPathAnimation(t),this.resetDatumAnimation(t),this.resetLabelAnimation(t),this.resetMarkerAnimation(t),t.contextData?.animationValid===!1&&this.ctx.animationManager.skipCurrentBatch()}animateEmptyUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}animateWaitingUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}animateReadyHighlight(t){const{datum:e}=this.opts?.animationResetFns??{};e&&resetMotion([t],e)}animateReadyHighlightMarkers(t){const{marker:e}=this.opts?.animationResetFns??{};e&&resetMotion([t],e)}animateReadyResize(t){this.resetAllAnimation(t)}animateClearingUpdateEmpty(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation(t)}getAnimationData(t,e){const{_contextNodeData:i}=this;return i?{datumSelection:this.datumSelection,markerSelection:this.markerSelection,labelSelection:this.labelSelection,annotationSelections:[...this.annotationSelections],contextData:i,previousContextData:e,paths:this.paths,seriesRect:t}:void 0}updateLabelSelection(t){return t.labelSelection}getScaling(t){if(t instanceof LogScale){const{range:e,domain:i}=t;return{type:"log",convert:s=>t.convert(s),domain:[i[0],i[1]],range:[e[0],e[1]]}}else if(t instanceof ContinuousScale){const{range:e,domain:i}=t;return{type:"continuous",domain:[i[0],i[1]],range:[e[0],e[1]]}}else if(t instanceof BandScale){const{domain:e}=t;return{type:"category",domain:e,inset:t.inset,step:t.step}}}calculateScaling(){const t={};for(const e of Object.values(ChartAxisDirection)){const i=this.axes[e];if(!i)continue;const s=this.getScaling(i.scale);s!=null&&(t[e]=s)}return t}};function axisExtent(t){let e,i;if(t instanceof NumberAxis&&(Number.isFinite(t.min)||Number.isFinite(t.max))?(e=Number.isFinite(t.min)?t.min:void 0,i=Number.isFinite(t.max)?t.max:void 0):t instanceof TimeAxis&&(t.min!=null||t.max!=null)&&({min:e,max:i}=t),!(e==null&&i==null))return e??(e=-1/0),i??(i=1/0),[e,i]}function clippedRangeIndices(t,e,i){const s=e[0].valueOf(),n=e[1].valueOf(),r=findMinIndex(0,t-1,a=>{const l=i(a)?.valueOf();return!Number.isFinite(l)||l>=s});let o=findMaxIndex(0,t-1,a=>{const l=i(a)?.valueOf();return!Number.isFinite(l)||l<=n});return r==null||o==null?[0,0]:(o=Math.min(o+1,t),[r,o])}var directions=["top","right","bottom","left"],_CartesianChart=class Wt extends Chart{constructor(e,i){super(e,i),this.paired=!0,this.lastUpdateClipRect=void 0,this.lastLayoutWidth=NaN,this.lastLayoutHeight=NaN}onAxisChange(e,i){super.onAxisChange(e,i),this.ctx!=null&&this.ctx.zoomManager.updateAxes(e)}destroySeries(e){super.destroySeries(e),this.lastLayoutWidth=NaN,this.lastLayoutHeight=NaN}getChartType(){return"cartesian"}setRootClipRects(e){const{seriesRoot:i,annotationRoot:s}=this;i.setClipRect(e),s.setClipRect(e)}async processData(){await super.processData();for(const e of this.axes){const i=this.getSyncedDomain(e);i!=null&&e.setDomains(i)}this.ctx.updateService.dispatchProcessData({series:{shouldFlipXY:this.shouldFlipXY()}})}performLayout(e){const{seriesRoot:i,annotationRoot:s}=this,{clipSeries:n,seriesRect:r,visible:o}=this.updateAxes(e.layoutBox);this.seriesRoot.visible=o,this.seriesRect=r,this.animationRect=e.layoutBox;const{x:a,y:l}=r;if(e.width!==this.lastLayoutWidth||e.height!==this.lastLayoutHeight)for(const d of[i,s])d.translationX=Math.floor(a),d.translationY=Math.floor(l);else{const{translationX:d,translationY:p}=i;staticFromToMotion(this.id,"seriesRect",this.ctx.animationManager,[i,s],{translationX:d,translationY:p},{translationX:Math.floor(a),translationY:Math.floor(l)},{phase:"update"})}this.lastLayoutWidth=e.width,this.lastLayoutHeight=e.height;const c=r.clone().grow(this.seriesArea.padding),h=this.seriesArea.clip||n?c:void 0,{lastUpdateClipRect:u}=this;this.lastUpdateClipRect=h,this.ctx.animationManager.isActive()&&u!=null?this.ctx.animationManager.animate({id:this.id,groupId:"clip-rect",phase:"update",from:u,to:c,onUpdate:d=>this.setRootClipRects(d),onComplete:()=>this.setRootClipRects(h)}):this.setRootClipRects(h),this.ctx.layoutManager.emitLayoutComplete(e,{axes:this.axes.map(d=>d.getLayoutState()),series:{visible:o,rect:r,paddedRect:c},clipSeries:n})}updateAxes(e){const{clipSeries:i,seriesRect:s,overflows:n}=this.resolveAxesLayout(e);for(const r of this.axes)r.update(),r.setCrossLinesVisible(!n),this.clipAxis(r,s,e);return{clipSeries:i,seriesRect:s,visible:!n}}resolveAxesLayout(e){let i,s,n=0;const r=10;do if(s=i??this.getDefaultState(),i=this.updateAxesPass(new Map(s.axisAreaWidths),e.clone()),n++>r){logger_exports.warn("Max iterations reached. Unable to stabilize axes layout.");break}while(!this.isLayoutStable(i,s));return this.lastAreaWidths=i.axisAreaWidths,i}updateAxesPass(e,i){const s=new Map,n={};let r=!1,o=!1;for(const f of directions){const x=this.seriesArea.padding[f],v=this.axes.findLast(b=>b.position===f);v?v.seriesAreaPadding=x:i.shrink(x,f)}const a=(e.get("left")??0)+(e.get("right")??0),l=(e.get("top")??0)+(e.get("bottom")??0),c=this.buildCrossLinePadding(e);i.width<=a+c.hPadding||i.height<=l+c.vPadding?r=!0:i.shrink(c);const h=i.clone().shrink(Object.fromEntries(e));for(const f of this.axes){const{position:x="left",direction:v}=f;this.sizeAxis(f,h,x);const b=v==="y",{primaryTickCount:S,bbox:A}=f.calculateLayout(f.nice?n[v]:void 0);n[v]??(n[v]=S),o||(o=f.dataDomain.clipped||f.visibleRange[0]>0||f.visibleRange[1]<1),s.set(f.id,Math.ceil(f.thickness??(b?A?.width:A?.height)??0))}const u=Object.entries(groupBy(this.axes,f=>f.position??"left")),{width:d,height:p,pixelRatio:g}=this.ctx.scene,m=new Map,y=new Map;for(const[f,x]of u){let b=f==="left"||f==="right"?p%g:d%g,S=0;for(const A of x){y.set(A.id,b);const D=s.get(A.id)??0;S=Math.max(S,b+D),A.layoutConstraints.stacked&&(b+=D+Wt.AxesPadding)}m.set(f,Math.ceil(S))}for(const[f,x]of u)this.positionAxes({axes:x,position:f,axisWidths:s,axisOffsets:y,axisAreaWidths:m,axisBound:i,seriesRect:h});return{clipSeries:o,seriesRect:h,axisAreaWidths:m,overflows:r}}buildCrossLinePadding(e){const i={top:0,right:0,bottom:0,left:0,hPadding:0,vPadding:0};this.axes.forEach(s=>{s.crossLines?.forEach(n=>{n.calculatePadding?.(i)})});for(const[s,n=0]of Object.entries(i))i[s]=Math.max(n-(e.get(s)??0),0);return i.hPadding=i.left+i.right,i.vPadding=i.top+i.bottom,i}clampToOutsideSeriesRect(e,i,s,n){const r=s==="x"?e.x:e.y,o=s==="x"?e.width:e.height;return n===1?Math.min(i,r+o):Math.max(i,r)}getSyncedDomain(e){const i=this.modulesManager.getModule("sync");if(!i?.enabled)return;const s=i.getSyncedDomain(e);if(s&&e.dataDomain.domain.length){let n;const{domain:r}=e.scale;if(ContinuousScale.is(e.scale)){const[o,a]=findMinMax(s);n=o!==r[0]||a!==r[1]}else n=!arraysEqual(s,r);n&&!this.skipSync&&i.updateSiblings()}return s}sizeAxis(e,i,s){const n=e instanceof CategoryAxis,r=s==="left"||s==="right",{width:o,height:a}=i,l=r?a:o;let c=0,h=l,{min:u,max:d}=this.ctx.zoomManager.getAxisZoom(e.id);const{width:p,unit:g,align:m}=e.layoutConstraints;g==="px"?h=c+p:h=h*p/100,m==="end"&&(c=l-(h-c),h=l),r&&(n?[u,d]=[1-d,1-u]:[c,h]=[h,c]),e.range=[c,h],e.visibleRange=[u,d],e.gridLength=r?o:a}positionAxes(e){const{axes:i,axisBound:s,axisWidths:n,axisOffsets:r,axisAreaWidths:o,seriesRect:a,position:l}=e,c=o.get(l)??0;let h="x",u="y",d=1;(l==="top"||l==="bottom")&&(h="y",u="x");let p=s[h];(l==="right"||l==="bottom")&&(d=-1,p+=h==="x"?s.width:s.height);for(const g of i){const m=o.get(u==="x"?"left":"top")??0,y=n.get(g.id)??0,f=r.get(g.id)??0;g.gridPadding=c-f-y,g.translation[u]=s[u]+m,g.translation[h]=this.clampToOutsideSeriesRect(a,p+d*(f+y),h,d)}}shouldFlipXY(){return this.series.every(e=>e instanceof CartesianSeries&&e.shouldFlipXY())}getDefaultState(){const e=new Map;if(this.lastAreaWidths)for(const{position:i="left"}of this.axes){const s=this.lastAreaWidths.get(i);s!=null&&e.set(i,s)}return{axisAreaWidths:e,clipSeries:!1,overflows:!1}}isLayoutStable(e,i){if(i.overflows!==e.overflows||i.clipSeries!==e.clipSeries)return!1;for(const s of e.axisAreaWidths.keys())if(!i.axisAreaWidths.has(s))return!1;for(const[s,n]of i.axisAreaWidths.entries()){const r=e.axisAreaWidths.get(s);if((n!=null||r!=null)&&n!==r)return!1}return!0}clipAxis(e,i,s){const n=Math.ceil(e.gridLine?.width??0),r=Math.ceil(e.line?.width??0);let{width:o,height:a}=i;switch(o+=e.direction==="x"?n:r,a+=e.direction==="y"?n:r,e.clipGrid(i.x,i.y,o,a),e.position){case"left":case"right":e.clipTickLines(s.x,i.y-n,s.width+n,i.height+n*2);break;case"top":case"bottom":e.clipTickLines(i.x-n,s.y,i.width+n*2,s.height+n);const{label:l,labelNodes:c,scale:h}=e;if(ContinuousScale.is(h)&&l.enabled&&l.avoidCollisions&&c.length>1){const u=c.toSorted((m,y)=>m.translationY-y.translationY),d=u.at(-1),p=d.getBBox(),g=i.x+p.y+p.height<=s.x+s.width+this.padding.right;if(d.visible=g,g||e.visibleRange[0]>0||e.visibleRange[1]<1)u[0].visible=!0;else{const m=u[0].getBBox();u[0].visible=m.y>=0}}break}}};_CartesianChart.className="CartesianChart",_CartesianChart.type="cartesian",_CartesianChart.AxesPadding=15;var CartesianChart=_CartesianChart,CartesianChartModule={type:"chart",name:"cartesian",detect:isAgCartesianChartOptions,create(t,e){return new CartesianChart(t,e)}},debug2=Debug.create(!0,"opts"),_AgChartInstanceProxy=class{constructor(e,i,s){this.factoryApi=i,this.licenseManager=s,this.chart=e}async update(e){return debug2.group("AgChartInstance.update()",async()=>{this.factoryApi.update(e,this),await this.chart.waitForUpdate()})}async updateDelta(e){return debug2.group("AgChartInstance.updateDelta()",async()=>{this.factoryApi.updateUserDelta(this,e),await this.chart.waitForUpdate()})}getOptions(){const e=deepClone(this.chart.getOptions());for(const i of Object.keys(e))i.startsWith("_")&&delete e[i];return e}waitForUpdate(){return this.chart.waitForUpdate()}async download(e){const i=await this.prepareResizedChart(this,e);try{i.chart.download(e?.fileName,e?.fileFormat)}finally{i.destroy()}}async __toSVG(e){const i=await this.prepareResizedChart(this,{width:600,height:300,...e});try{return i.chart.toSVG()}finally{i.destroy()}}async getImageDataURL(e){const i=await this.prepareResizedChart(this,e);try{return i.chart.getCanvasDataURL(e?.fileFormat)}finally{i.destroy()}}getState(){return this.factoryApi.caretaker.save(...this.getEnabledOriginators())}async setState(e){const i=this.getEnabledOriginators();if(!i.includes(this.chart.ctx.legendManager)){await this.setStateOriginators(e,i);return}await this.setStateOriginators(e,i.filter(s=>s!==this.chart.ctx.zoomManager)),await this.setStateOriginators(e,[this.chart.ctx.zoomManager])}resetAnimations(){this.chart.resetAnimations()}skipAnimations(){this.chart.skipAnimations()}destroy(){this.releaseChart?(this.releaseChart(),this.releaseChart=void 0):this.chart&&(this.chart.publicApi=void 0,this.chart.destroy()),this.chart=null}async prepareResizedChart(e,i={}){const{chart:s}=e,n=i.width??s.width??s.ctx.scene.canvas.width,r=i.height??s.height??s.ctx.scene.canvas.height,o=e.getState(),a=moduleRegistry.hasEnterpriseModules(),l={...s.chartOptions.processedOverrides,container:document.createElement("div"),width:n,height:r};i.width!=null&&i.height!=null&&(l.overrideDevicePixelRatio=1);const c=s.getOptions();a&&(l.animation={enabled:!1},this.licenseManager?.isDisplayWatermark()&&(l.foreground={text:this.licenseManager.getWatermarkMessage(),image:{url:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjU4IiBoZWlnaHQ9IjQwIiB2aWV3Qm94PSIwIDAgMjU4IDQwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjUuNzc5IDI4LjY1N0gxMy4zNTlMMTEuMTczIDM0LjAxMkg1LjY3Mjk3TDE3LjE4MiA3LjA1OTk5SDIxLjk1M0wzMy40NjIgMzQuMDEySDI3Ljk2MkwyNS43NzYgMjguNjU3SDI1Ljc3OVpNMjQuMDY4IDI0LjM5N0wxOS41ODggMTMuNDM0TDE1LjEwNyAyNC4zOTdIMjQuMDY4Wk02Mi4wOTIgMTguODIzSDQ5LjgxN1YyMy4wODZINTYuNzc1QzU2LjU1NSAyNS4yMjIgNTUuNzU1IDI2LjkyNyA1NC4zNzIgMjguMjAyQzUyLjk4OSAyOS40NzYgNTEuMTY2IDMwLjExNSA0OC45MDkgMzAuMTE1QzQ3LjYyMiAzMC4xMTUgNDYuNDUgMjkuODg1IDQ1LjM5MyAyOS40MjNDNDQuMzU4MyAyOC45NzgxIDQzLjQzMjYgMjguMzEzOCA0Mi42OCAyNy40NzZDNDEuOTI3IDI2LjYzOSA0MS4zNDQgMjUuNjMxIDQwLjkzMSAyNC40NTNDNDAuNTE5IDIzLjI3NSA0MC4zMTEgMjEuOTcgNDAuMzExIDIwLjUzN0M0MC4zMTEgMTkuMTA1IDQwLjUxNiAxNy44IDQwLjkzMSAxNi42MjFDNDEuMzQ0IDE1LjQ0MyA0MS45MjcgMTQuNDM2IDQyLjY4IDEzLjU5OEM0My40Mzc2IDEyLjc1NzcgNDQuMzY5NiAxMi4wOTMyIDQ1LjQxMSAxMS42NTFDNDYuNDc4IDExLjE4OSA0Ny42NTYgMTAuOTYgNDguOTQ2IDEwLjk2QzUxLjYxMiAxMC45NiA1My42MzcgMTEuNjAyIDU1LjAyIDEyLjg4NUw1OC4zIDkuNjA0OTlDNTUuODE3IDcuNjY5OTkgNTIuNjc2IDYuNjk5OTkgNDguODcyIDYuNjk5OTlDNDYuNzYgNi42OTk5OSA0NC44NTMgNy4wMzQ5OSA0My4xNTQgNy43MDA5OUM0MS40NTUgOC4zNjc5OSAzOS45OTggOS4zMDM5OSAzOC43ODMgMTAuNTA0QzM3LjU2NyAxMS43MDcgMzYuNjM0IDEzLjE1OCAzNS45NzcgMTQuODU3QzM1LjMxOSAxNi41NTYgMzQuOTk0IDE4LjQ1MSAzNC45OTQgMjAuNTRDMzQuOTk0IDIyLjYzIDM1LjMyOSAyNC40OTQgMzUuOTk1IDI2LjIwNUMzNi42NjIgMjcuOTE2IDM3LjYwNSAyOS4zNzQgMzguODE3IDMwLjU3N0M0MC4wMzIgMzEuNzggNDEuNDg2IDMyLjcxMyA0My4xODggMzMuMzgzQzQ0Ljg4OCAzNC4wNDkgNDYuNzgyIDM0LjM4NCA0OC44NzIgMzQuMzg0QzUwLjk2MSAzNC4zODQgNTIuNzUgMzQuMDQ5IDU0LjM5IDMzLjM4M0M1Ni4wMzEgMzIuNzE2IDU3LjQyNiAzMS43OCA1OC41NzkgMzAuNTc3QzU5LjczMyAyOS4zNzQgNjAuNjE5IDI3LjkxNiA2MS4yMzkgMjYuMjA1QzYxLjg2IDI0LjQ5NCA2Mi4xNyAyMi42MDUgNjIuMTcgMjAuNTRDNjIuMTY5NiAxOS45Njg4IDYyLjE0NDUgMTkuMzk4IDYyLjA5NSAxOC44MjlMNjIuMDkyIDE4LjgyM1pNMTUxLjgxIDE2Ljk4MUMxNTMuNDEgMTQuNjA5IDE1Ny40MTkgMTQuMzU4IDE1OS4wMjIgMTQuMzU4VjE4LjkxQzE1Ni45NTcgMTguOTEgMTU0Ljk4NSAxOC45OTYgMTUzLjc1NyAxOS44OTJDMTUyLjUyOSAyMC43OTIgMTUxLjkxOSAyMS45ODIgMTUxLjkxOSAyMy40NjRWMzMuOTlIMTQ2Ljk2NFYxNC4zNThIMTUxLjczNkwxNTEuODEgMTYuOTgxWk0xNDMuMDExIDE0LjM2MVYzNC4wMzFIMTM4LjI0TDEzOC4xMzEgMzEuMDQ1QzEzNy40NjYgMzIuMDc2IDEzNi41NTEgMzIuOTIxOSAxMzUuNDcxIDMzLjUwNEMxMzQuMzc2IDM0LjA5OSAxMzMuMDY4IDM0LjM5NiAxMzEuNTM2IDM0LjM5NkMxMzAuMiAzNC4zOTYgMTI4Ljk2MyAzNC4xNTIgMTI3LjgyMiAzMy42NjhDMTI2LjcgMzMuMTk2NCAxMjUuNjg5IDMyLjQ5NSAxMjQuODU1IDMxLjYwOUMxMjQuMDE4IDMwLjcyMiAxMjMuMzU0IDI5LjY2MiAxMjIuODcxIDI4LjQyMkMxMjIuMzg0IDI3LjE4NSAxMjIuMTQyIDI1LjgxMSAxMjIuMTQyIDI0LjMwNEMxMjIuMTQyIDIyLjc5OCAxMjIuMzg0IDIxLjM3OCAxMjIuODcxIDIwLjExNkMxMjMuMzU3IDE4Ljg1NCAxMjQuMDE4IDE3Ljc3MiAxMjQuODU1IDE2Ljg3M0MxMjUuNjg4IDE1Ljk3NjQgMTI2LjY5OCAxNS4yNjM2IDEyNy44MjIgMTQuNzhDMTI4Ljk2MyAxNC4yODEgMTMwLjIwMyAxNC4wMzMgMTMxLjUzNiAxNC4wMzNDMTMzLjA0MyAxNC4wMzMgMTM0LjMzIDE0LjMxOCAxMzUuMzk3IDE0Ljg4OEMxMzYuNDYyIDE1LjQ1ODkgMTM3LjM3NSAxNi4yNzggMTM4LjA1NyAxNy4yNzZWMTQuMzYxSDE0My4wMTFaTTEzMi42MzEgMzAuMTMzQzEzNC4yNTYgMzAuMTMzIDEzNS41NjcgMjkuNTk0IDEzNi41NjUgMjguNTEyQzEzNy41NjEgMjcuNDMgMTM4LjA2IDI1Ljk5MSAxMzguMDYgMjQuMTk2QzEzOC4wNiAyMi40MDEgMTM3LjU2MSAyMC45OSAxMzYuNTY1IDE5Ljg5OUMxMzUuNTcgMTguODA3IDEzNC4yNTkgMTguMjU4IDEzMi42MzEgMTguMjU4QzEzMS4wMDMgMTguMjU4IDEyOS43MjkgMTguODA0IDEyOC43MzQgMTkuODk5QzEyNy43MzggMjAuOTkzIDEyNy4yMzkgMjIuNDM4IDEyNy4yMzkgMjQuMjMzQzEyNy4yMzkgMjYuMDI4IDEyNy43MzUgMjcuNDMzIDEyOC43MzQgMjguNTE1QzEyOS43MjkgMjkuNTk0IDEzMS4wMjggMzAuMTM2IDEzMi42MzEgMzAuMTM2VjMwLjEzM1pNOTMuNjk4IDI3Ljg3NkM5My41Nzk1IDI4LjAwMjUgOTMuNDU2NCAyOC4xMjQ2IDkzLjMyOSAyOC4yNDJDOTEuOTQ3IDI5LjUxNiA5MC4xMjMgMzAuMTU1IDg3Ljg2NiAzMC4xNTVDODYuNTggMzAuMTU1IDg1LjQwOCAyOS45MjYgODQuMzUgMjkuNDY0QzgzLjMxNTUgMjkuMDE4OSA4Mi4zODk4IDI4LjM1NDYgODEuNjM3IDI3LjUxN0M4MC44ODQgMjYuNjc5IDgwLjMwMSAyNS42NzIgNzkuODg5IDI0LjQ5NEM3OS40NzYgMjMuMzE1IDc5LjI2OSAyMi4wMSA3OS4yNjkgMjAuNTc4Qzc5LjI2OSAxOS4xNDUgNzkuNDczIDE3Ljg0IDc5Ljg4OSAxNi42NjJDODAuMzAxIDE1LjQ4NCA4MC44ODQgMTQuNDc2IDgxLjYzNyAxMy42MzlDODIuMzk0OSAxMi43OTg3IDgzLjMyNzMgMTIuMTM0MiA4NC4zNjkgMTEuNjkyQzg1LjQzNiAxMS4yMyA4Ni42MTQgMTEgODcuOTAzIDExQzkwLjU3IDExIDkyLjU5NSAxMS42NDIgOTMuOTc3IDEyLjkyNkw5Ny4yNTggOS42NDQ5OUM5NC43NzQgNy43MTA5OSA5MS42MzMgNi43Mzk5OSA4Ny44MjkgNi43Mzk5OUM4NS43MTggNi43Mzk5OSA4My44MTEgNy4wNzQ5OSA4Mi4xMTIgNy43NDE5OUM4MC40MTMgOC40MDc5OSA3OC45NTYgOS4zNDQ5OSA3Ny43NCAxMC41NDVDNzYuNTI1IDExLjc0NyA3NS41OTIgMTMuMTk5IDc0LjkzNCAxNC44OThDNzQuMjc3IDE2LjU5NyA3My45NTEgMTguNDkxIDczLjk1MSAyMC41ODFDNzMuOTUxIDIyLjY3IDc0LjI4NiAyNC41MzQgNzQuOTUzIDI2LjI0NUM3NS42MTkgMjcuOTU3IDc2LjU2MiAyOS40MTQgNzcuNzc0IDMwLjYxN0M3OC45OSAzMS44MiA4MC40NDQgMzIuNzUzIDgyLjE0NiAzMy40MjNDODMuODQ1IDM0LjA5IDg1LjczOSAzNC40MjQgODcuODI5IDM0LjQyNEM4OS45MTkgMzQuNDI0IDkxLjcwOCAzNC4wOSA5My4zNDggMzMuNDIzQzk0LjcxOCAzMi44NjUgOTUuOTE4IDMyLjEyMSA5Ni45NDggMzEuMTkxQzk3LjE0OSAzMS4wMDggOTcuMzQ4IDMwLjgxNSA5Ny41MzcgMzAuNjJMOTMuNzAxIDI3Ljg4NUw5My42OTggMjcuODc2Wk0xMTAuODAyIDE0LjAxNUMxMDkuMTk5IDE0LjAxNSAxMDYuODM2IDE0LjQ3MSAxMDUuNjExIDE2LjE1OEwxMDUuNTM3IDYuMDE1OTlIMTAwLjc2NVYzMy45MzlIMTA1LjcyVjIyLjY0MUMxMDUuNzcxIDIxLjQ2MDcgMTA2LjI4OCAyMC4zNDg4IDEwNy4xNTcgMTkuNTQ4OUMxMDguMDI3IDE4Ljc0OTEgMTA5LjE3OCAxOC4zMjY2IDExMC4zNTggMTguMzc0QzExMy4zOTcgMTguMzc0IDExNC4yNjggMjEuMTU5IDExNC4yNjggMjIuNjQxVjMzLjkzOUgxMTkuMjIzVjIxLjA1OUMxMTkuMjIzIDIxLjA1OSAxMTkuMTQyIDE0LjAxNSAxMTAuODAyIDE0LjAxNVpNMTczLjc2MyAxNC4zNThIMTY5Ljk5OVY4LjcxNDk5SDE2NS4wNDhWMTQuMzU4SDE2MS4yODRWMTguOTE2SDE2NS4wNDhWMzQuMDAzSDE2OS45OTlWMTguOTE2SDE3My43NjNWMTQuMzU4Wk0xOTAuNzg3IDI1LjI2MkMxOTAuMTI5IDI0LjUwMTQgMTg5LjMwNyAyMy44OTk0IDE4OC4zODQgMjMuNTAxQzE4Ny40ODggMjMuMTE3IDE4Ni4zMzEgMjIuNzMyIDE4NC45NDggMjIuMzY0QzE4NC4xNjUgMjIuMTQzOSAxODMuMzkgMjEuODk3OCAxODIuNjIzIDIxLjYyNkMxODIuMTYzIDIxLjQ2MjEgMTgxLjc0MSAyMS4yMDY2IDE4MS4zODMgMjAuODc1QzE4MS4yMzUgMjAuNzQyMSAxODEuMTE4IDIwLjU3ODkgMTgxLjAzOSAyMC4zOTY0QzE4MC45NjEgMjAuMjE0IDE4MC45MjIgMjAuMDE2NiAxODAuOTI3IDE5LjgxOEMxODAuOTI3IDE5LjI3MiAxODEuMTU2IDE4Ljg0NCAxODEuNjI1IDE4LjUxQzE4Mi4xMjEgMTguMTU2IDE4Mi44NjIgMTcuOTc2IDE4My44MjYgMTcuOTc2QzE4NC43OSAxNy45NzYgMTg1LjU4NyAxOC4yMDkgMTg2LjE0OCAxOC42NjhDMTg2LjcwNiAxOS4xMjQgMTg3LjAwNyAxOS43MjUgMTg3LjA3MiAyMC41TDE4Ny4wOTQgMjAuNzgySDE5MS42MzNMMTkxLjYxNyAyMC40NkMxOTEuNTIxIDE4LjQ4NSAxOTAuNzcxIDE2LjkgMTg5LjM4NSAxNS43NUMxODguMDEyIDE0LjYxMiAxODYuMTg1IDE0LjAzMyAxODMuOTYyIDE0LjAzM0MxODIuNDc3IDE0LjAzMyAxODEuMTQxIDE0LjI4NyAxNzkuOTk0IDE0Ljc4NkMxNzguODMxIDE1LjI5MSAxNzcuOTI2IDE1Ljk5NSAxNzcuMjk2IDE2Ljg4MkMxNzYuNjczIDE3Ljc0NTUgMTc2LjMzOCAxOC43ODQgMTc2LjM0MSAxOS44NDlDMTc2LjM0MSAyMS4xNjcgMTc2LjY5OCAyMi4yNDkgMTc3LjM5OSAyMy4wNjRDMTc4LjA2IDIzLjg0MzIgMTc4Ljg5OCAyNC40NTM0IDE3OS44NDIgMjQuODQ0QzE4MC43NDQgMjUuMjE2IDE4MS45MjggMjUuNjA3IDE4My4zNjEgMjZDMTg0LjgwNiAyNi40MSAxODUuODcyIDI2Ljc4NSAxODYuNTMgMjcuMTIzQzE4Ny4xIDI3LjQxNCAxODcuMzc5IDI3Ljg0NSAxODcuMzc5IDI4LjQ0NEMxODcuMzc5IDI5LjA0MiAxODcuMTIyIDI5LjQ2NyAxODYuNTk1IDI5LjgzOUMxODYuMDQzIDMwLjIyNiAxODUuMjM3IDMwLjQyNSAxODQuMjAxIDMwLjQyNUMxODMuMTY2IDMwLjQyNSAxODIuMzk0IDMwLjE3NCAxODEuNzQ5IDI5LjY3NEMxODEuMTEzIDI5LjE4MSAxODAuNzcyIDI4LjU4OSAxODAuNzEgMjcuODY0TDE4MC42ODUgMjcuNTgySDE3Ni4wMTNMMTc2LjAyNSAyNy45MDFDMTc2LjA2NyAyOS4wOTU1IDE3Ni40NzIgMzAuMjQ4NyAxNzcuMTg4IDMxLjIwNkMxNzcuOTA3IDMyLjE4IDE3OC44OTMgMzIuOTU4IDE4MC4xMTggMzMuNTE5QzE4MS4zMzYgMzQuMDc3IDE4Mi43MzIgMzQuMzYyIDE4NC4yNjYgMzQuMzYyQzE4NS44MDEgMzQuMzYyIDE4Ny4xMDkgMzQuMTA4IDE4OC4yMzggMzMuNjA5QzE4OS4zNzYgMzMuMTA0IDE5MC4yNzIgMzIuMzk0IDE5MC45MDEgMzEuNDk0QzE5MS41MzQgMzAuNTkyIDE5MS44NTMgMjkuNTU0IDE5MS44NTMgMjguNDAzQzE5MS44MjggMjcuMTEgMTkxLjQ2NiAyNi4wNTMgMTkwLjc3NyAyNS4yNjJIMTkwLjc4N1oiIGZpbGw9IiM5QjlCOUIiLz4KPHBhdGggZD0iTTI0MS45ODIgMjUuNjU4MlYxNy43MTE3SDIyOC40NDFMMjIwLjQ5NCAyNS42NTgySDI0MS45ODJaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNTcuMjM5IDUuOTUwODFIMjQwLjI2NUwyMzIuMjU1IDEzLjg5NzNIMjU3LjIzOVY1Ljk1MDgxWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjEyLjYxMSAzMy42MDQ4TDIxNi42OCAyOS41MzYxSDIzMC40MTJWMzcuNDgyN0gyMTIuNjExVjMzLjYwNDhaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yMTUuNTk5IDIxLjc4MDNIMjI0LjM3MkwyMzIuMzgyIDEzLjgzMzdIMjE1LjU5OVYyMS43ODAzWiIgZmlsbD0iIzlCOUI5QiIvPgo8cGF0aCBkPSJNMjA2IDMzLjYwNDdIMjEyLjYxMUwyMjAuNDk0IDI1LjY1ODJIMjA2VjMzLjYwNDdaIiBmaWxsPSIjOUI5QjlCIi8+CjxwYXRoIGQ9Ik0yNDAuMjY1IDUuOTUwODFMMjM2LjE5NyAxMC4wMTk0SDIxMC4yNTlWMi4wNzI4OEgyNDAuMjY1VjUuOTUwODFaIiBmaWxsPSIjOUI5QjlCIi8+Cjwvc3ZnPgo=",width:170,height:25,right:25,bottom:50,opacity:.7}}));const h={...s.chartOptions.specialOverrides},u={...s.chartOptions.optionMetadata},d=this.factoryApi.create(c,l,h,u);await d.setState(o),d.chart.ctx.zoomManager.updateZoom("chartProxy",s.ctx.zoomManager.getZoom()),d.chart.ctx.legendManager.clearData(),d.chart.ctx.legendManager.update(s.ctx.legendManager.getData()),s.series.forEach((g,m)=>{g.visible||(d.chart.series[m].visible=!1)});const p=[];for(const g of s.modulesManager.legends())p.push(g.legend.pagination?.currentPage??0);for(const g of d.chart.modulesManager.legends()){const m=p.shift()??0;g.legend.pagination&&g.legend.pagination.setPage(m)}return d.chart.update(0,{forceNodeDataRefresh:!0}),await d.waitForUpdate(),d}getEnabledOriginators(){const{chartOptions:{processedOptions:e,optionMetadata:i},ctx:{annotationManager:s,chartTypeOriginator:n,zoomManager:r,legendManager:o}}=this.chart,a=[];return"annotations"in e&&e.annotations?.enabled&&a.push(s),i.presetType==="price-volume"&&a.push(n),(e.navigator?.enabled||e.zoom?.enabled)&&a.push(r),"legend"in this.chart&&a.push(o),a}async setStateOriginators(e,i){this.factoryApi.caretaker.restore(e,...i),this.chart.ctx.updateService.update(2,{forceNodeDataRefresh:!0}),await this.chart.waitForUpdate()}};_AgChartInstanceProxy.chartInstances=new WeakMap,__decorateClass([ActionOnSet({oldValue(t){t.destroyed||(t.publicApi=void 0),_AgChartInstanceProxy.chartInstances.delete(t)},newValue(t){t&&(t.publicApi=this,_AgChartInstanceProxy.chartInstances.set(t,this))}})],_AgChartInstanceProxy.prototype,"chart",2);var AgChartInstanceProxy=_AgChartInstanceProxy,Locale=class extends BaseModuleInstance{constructor(t){super(),this.ctx=t,this.localeText=void 0}};__decorateClass([ObserveChanges(t=>{t.ctx.localeManager.setLocaleText(t.localeText)}),Validate(PLAIN_OBJECT,{optional:!0})],Locale.prototype,"localeText",2),__decorateClass([ObserveChanges(t=>{t.ctx.localeManager.setLocaleTextFormatter(t.getLocaleText)}),Validate(FUNCTION,{optional:!0})],Locale.prototype,"getLocaleText",2);var LocaleModule={type:"root",optionsKey:"locale",packageType:"community",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],moduleFactory:t=>new Locale(t)},GroupedCategoryScale=class extends CategoryScale{getIndex(t){return super.getIndex(t)??this.getMatchIndex(t)}getMatchIndex(t){const e=JSON.stringify(t),i=this._domain.find(s=>JSON.stringify(s)===e);if(i!=null)return super.getIndex(i)}},memorizedFns=new WeakMap;function memo(t,e){const i=JSON.stringify(t,null,0);return memorizedFns.has(e)||memorizedFns.set(e,new Map),memorizedFns.get(e)?.has(i)||memorizedFns.get(e)?.set(i,e(t)),memorizedFns.get(e)?.get(i)}function simpleMemorize(t){const e=new Map,i=(...r)=>r.map(o=>typeof o=="object"||typeof o=="symbol"?o:(e.has(o)||e.set(o,{v:o}),e.get(o))),s={},n=new WeakMap;return(...r)=>{const o=r.length===0?[s]:i(...r);let a=n;for(const h of o.slice(0,-1))a.has(h)||a.set(h,new WeakMap),a=a.get(h);const l=o.at(-1);let c=a.get(l);return c||(c=t(...r),a.set(l,c)),c}}function sumValues(t,e=[0,0]){for(const i of t)typeof i=="number"&&(i<0&&(e[0]+=i),i>0&&(e[1]+=i));return e}function sum(t,e){return{id:t,matchGroupIds:[e],type:"aggregate",aggregateFunction:s=>sumValues(s)}}function groupSum(t,e){return{id:t,type:"aggregate",matchGroupIds:e?[e]:void 0,aggregateFunction:i=>sumValues(i),groupAggregateFunction:(i,s=[0,0])=>(s[0]+=i?.[0]??0,s[1]+=i?.[1]??0,s),round:!0}}function range2(t,e){return{id:t,matchGroupIds:[e],type:"aggregate",aggregateFunction:s=>ContinuousDomain.extendDomain(s)}}function groupCount(t){return{id:t,type:"aggregate",aggregateFunction:()=>[0,1],groupAggregateFunction:(e,i=[0,0])=>(i[0]+=e?.[0]??0,i[1]+=e?.[1]??0,i)}}function groupAverage(t,e){return{id:t,matchGroupIds:e?[e]:void 0,type:"aggregate",aggregateFunction:s=>sumValues(s),groupAggregateFunction:(s,n=[0,0,-1])=>(n[0]+=s?.[0]??0,n[1]+=s?.[1]??0,n[2]++,n),finalFunction:(s=[0,0,0])=>{const n=s[0]+s[1];return n>=0?[0,n/s[2]]:[n/s[2],0]},round:!0}}function area(t,e,i){const s={id:t,matchGroupIds:i?[i]:void 0,type:"aggregate",aggregateFunction:(n,r=[])=>{const o=r[1]-r[0];return e.aggregateFunction(n).map(a=>a/o)},round:!0};return e.groupAggregateFunction&&(s.groupAggregateFunction=e.groupAggregateFunction),s}function accumulatedValue(t){return()=>{let e=0;return i=>isFiniteNumber(i)?(e+=t?Math.max(0,i):i,e):i}}function trailingAccumulatedValue(){return()=>{let t=0;return e=>{if(!isFiniteNumber(e))return e;const i=t;return t+=e,i}}}function basicContinuousCheckDatumValidation(t){return t!=null&&isContinuous(t)}function basicDiscreteCheckDatumValidation(t){return t!=null}function getValidationFn(t){switch(t){case"number":case"log":case"ordinal-time":case"time":case"color":return basicContinuousCheckDatumValidation;default:return basicDiscreteCheckDatumValidation}}function getValueType(t){switch(t){case"number":case"log":case"time":case"color":return"range";default:return"category"}}function keyProperty(t,e,i={}){return{property:t,type:"key",valueType:getValueType(e),validation:getValidationFn(e),...i}}function valueProperty(t,e,i={}){return{property:t,type:"value",valueType:getValueType(e),validation:getValidationFn(e),...i}}function rowCountProperty(t,e={}){return{property:t,type:"value",valueType:"range",missingValue:1,processor:()=>()=>1,...e}}function rangedValueProperty(t,e={}){const{min:i=-1/0,max:s=1/0,...n}=e;return{type:"value",property:t,valueType:"range",validation:basicContinuousCheckDatumValidation,processor:()=>r=>isFiniteNumber(r)?clamp(i,r,s):r,...n}}function accumulativeValueProperty(t,e,i={}){const{onlyPositive:s,...n}=i;return{...valueProperty(t,e,n),processor:accumulatedValue(s)}}function trailingAccumulatedValueProperty(t,e,i={}){return{...valueProperty(t,e,i),processor:trailingAccumulatedValue()}}function groupAccumulativeValueProperty(t,e,i,s,n){return[valueProperty(t,n,s),accumulateGroup(s.groupId,e,i,s.separateNegative),...s.rangeId!=null?[range2(s.rangeId,s.groupId)]:[]]}function groupStackValueProperty(t,e,i){return[valueProperty(t,e,i),accumulateStack(i.groupId)]}var SMALLEST_KEY_INTERVAL={type:"reducer",property:"smallestKeyInterval",initialValue:1/0,reducer:()=>{let t=NaN;return(e=1/0,i)=>{const s=typeof i[0]=="number"?i[0]:Number(i[0]),n=Math.abs(s-t);return t=s,!isNaN(n)&&n>0&&n{let t=NaN;return(e=-1/0,i)=>{const s=typeof i[0]=="number"?i[0]:Number(i[0]),n=Math.abs(s-t);return t=s,!isNaN(n)&&n>0&&n>e?n:e}}},SORT_DOMAIN_GROUPS={type:"processor",property:"sortedGroupDomain",calculate:({domain:{groups:t}})=>t?.slice().sort((e,i)=>{for(let s=0;s{if(s===0)return null;const n=(i??0)*t/s;return n>=0?Math.min(t,n):Math.max(-t,n)};return()=>()=>(i,s,n)=>{const r=normaliseFindExtent(i,s,n);for(const o of s)for(const a of n.datumIndices[o]){const l=i[o],c=l[a];if(c==null){l[a]=void 0;continue}l[a]=typeof c=="number"?e(c,r):c.map(h=>e(h,r))}}}function normaliseFindExtent(t,e,i){const s=[0,0];for(const n of e){const r=t[n];for(const o of i.datumIndices[n]){const a=r[o];if(a==null)continue;const l=typeof a=="number"?a:Math.max(...a.map(h=>h??0)),c=l<0?0:1;c===0?s[c]=Math.min(s[c],l):s[c]=Math.max(s[c],l)}}return Math.max(Math.abs(s[0]),s[1])}function normaliseGroupTo(t,e){return{type:"group-value-processor",matchGroupIds:t,adjust:memo({normaliseTo:e},normaliseFnBuilder)}}function normalisePropertyFnBuilder({normaliseTo:t,zeroDomain:e,rangeMin:i,rangeMax:s}){const n=t[1]-t[0],r=(o,a,l)=>{const c=t[0]+(o-a)/l*n;return l===0?e:c>=t[1]?t[1]:c(o,a)=>{let[l,c]=o.domain.values[a];i!=null&&(l=i),s!=null&&(c=s);const h=c-l;o.domain.values[a]=[t[0],t[1]];const u=o.columns[a];for(let d=0;d{let n=ANIMATION_VALIDATION_UNIQUE_KEYS|ANIMATION_VALIDATION_ORDERED_KEYS;if(e.valueType==="category")return i.length!==t&&(n&=~ANIMATION_VALIDATION_UNIQUE_KEYS),n;let r=s[0]?.valueOf();for(let o=1;n!==0&&oa)&&(n&=~ANIMATION_VALIDATION_ORDERED_KEYS),Number.isFinite(a)&&r===a&&(n&=~ANIMATION_VALIDATION_UNIQUE_KEYS),r=a}return n};function animationValidation(t){return{type:"processor",property:"animationValidation",calculate(e){const{keys:i,values:s}=e.defs,{input:{count:n},domain:{keys:r,values:o},keys:a,columns:l}=e;let c=ANIMATION_VALIDATION_UNIQUE_KEYS|ANIMATION_VALIDATION_ORDERED_KEYS;if(n!==0){for(let h=0;c!==0&&h()=>(i,s,n)=>{const r=[0,0];for(const o of s)for(const a of n.datumIndices[o]??[]){const l=i[o],c=l[a],h=isNegative(c)&&e?0:1;isFiniteNumber(c)&&(t==="normal"&&(r[h]+=c),l[a]=r[h],t==="trailing"&&(r[h]+=c))}}}function buildGroupWindowAccFn({mode:t,sum:e}){return()=>{const i=[];let s=!0;return()=>(n,r,o)=>{let a=0;for(const l of r){const c=n[l];for(const h of o.datumIndices[l]??[]){const u=c[h],d=s&&e==="current"?0:i[l];i[l]=u;const p=e==="current"?u:d;if(!isFiniteNumber(u)||!isFiniteNumber(d)){c[h]=a;continue}t==="normal"&&(a+=p),c[h]=a,t==="trailing"&&(a+=p)}}s=!1}}}function accumulateGroup(t,e,i,s=!1){let n;if(e.startsWith("window")){const r=e.endsWith("-trailing")?"trailing":"normal";n=memo({mode:r,sum:i},buildGroupWindowAccFn)}else n=memo({mode:e,separateNegative:s},buildGroupAccFn);return{type:"group-value-processor",matchGroupIds:[t],adjust:n}}function groupStackAccFn(){return()=>(t,e,i)=>{const s=new Float64Array(e.length);let n=0;for(const r of e){const o=t[r];for(const a of i.datumIndices[r]??[]){const l=o[a];s[n]=Number.isFinite(l)?l:NaN,n+=1,o[a]=s.subarray(0,n)}}}}function accumulateStack(t){return{type:"group-value-processor",matchGroupIds:[t],adjust:groupStackAccFn}}function valueIdentifier(t){return t.id??t.property}function valueIndices(t,e,i){const s=new Map,n=e.defs.values;for(let a=0;a0||a.size>0||l.size>0,added:new Set(o.keys()),updated:new Set(a.keys()),removed:new Set(l.keys()),moved:new Set(r.keys())};return{...n,[t]:y}}}}function createDatumId(t,...e){let i;return isArray(t)?i=t.map(n=>transformIntegratedCategoryValue(n)).join("___"):i=transformIntegratedCategoryValue(t),(typeof i=="string"||typeof i=="number"||typeof i=="boolean"||i instanceof Date)&&e.length>0&&(i+=`___${e.join("___")}`),i}var Dimensions=class{constructor(){this.top=1/0,this.right=-1/0,this.bottom=-1/0,this.left=1/0}update(t,e){t>this.right&&(this.right=t),tthis.bottom&&(this.bottom=e),ec.label===r);if(l&&o)s=l;else{const c=new Ht(r,s,i);c.index=a.length,a.push(c),o&&(s=c)}}}getLeftSibling(){return this.index>0?this.parent?.children[this.index-1]:void 0}getLeftmostSibling(){return this.index>0?this.parent?.children[0]:void 0}nextLeft(){return this.children[0]}nextRight(){return this.children.at(-1)}getSiblings(){return this.parent?.children.filter((e,i)=>i!==this.index)??[]}};function ticksToTree(t){const e=t.reduce((s,n)=>s=0?t.ancestor:i}function executeShifts({children:t}){let e=0,i=0;for(let s=t.length-1;s>=0;s--){const n=t[s];n.prelim+=e,n.mod+=e,i+=n.change,e+=n.shift+i}}function apportion(t,e){const i=t.getLeftSibling();if(i){let s=t,n=t,r=i,o=n.getLeftmostSibling(),a=n.mod,l=s.mod,c=r.mod,h=o.mod;for(;r.nextRight()&&n.nextLeft();){r=r.nextRight(),n=n.nextLeft(),o=o.nextLeft(),s=s.nextRight(),s.ancestor=t;const u=r.prelim+c-(n.prelim+a)+1;u>0&&(moveSubtree(ancestor(r,t,e),t,u),a+=u,l+=u),c+=r.mod,a+=n.mod,h+=o.mod,l+=s.mod}r.nextRight()&&!s.nextRight()?s.mod+=c-l:(n.nextLeft()&&!o.nextLeft()&&(o.mod+=a-h),e=t)}return e}function firstWalk(t){const{children:e}=t;if(e.length){let[i]=e;for(const r of e)firstWalk(r),i=apportion(r,i);executeShifts(t);const s=(e[0].prelim+e.at(-1).prelim)/2,n=t.getLeftSibling();n?(t.prelim=n.prelim+1,t.mod=t.prelim-s):t.prelim=s}else{const i=t.getLeftSibling();t.prelim=i?i.prelim+1:0}}function secondWalk(t,e,i){t.x=t.prelim+e,t.y=t.depth,i.insertNode(t);for(const s of t.children)secondWalk(s,e+t.mod,i)}function thirdWalk(t){const{children:e}=t;let i=0;for(const s of e)thirdWalk(s),s.children.length?i+=s.leafCount:i++;t.leafCount=i,e.length?(t.subtreeLeft=e[0].subtreeLeft,t.subtreeRight=e[e.length-1].subtreeRight,t.x=(t.subtreeLeft+t.subtreeRight)/2):(t.subtreeLeft=t.x,t.subtreeRight=t.x)}function treeLayout(t){const e=new TreeLayout,i=ticksToTree(t);return firstWalk(i),secondWalk(i,-i.prelim,e),thirdWalk(i),e}var TreeLayout=class{constructor(){this.dimensions=new Dimensions,this.nodes=[],this.depth=0}insertNode(t){this.depth0){const{left:s,right:n}=this.dimensions;i=t/(n-s)}return e&&(i*=-1),i}},DepthLabelProperties=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0}};__decorateClass([Validate(BOOLEAN)],DepthLabelProperties.prototype,"enabled",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],DepthLabelProperties.prototype,"avoidCollisions",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],DepthLabelProperties.prototype,"color",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],DepthLabelProperties.prototype,"spacing",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],DepthLabelProperties.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],DepthLabelProperties.prototype,"fontWeight",2),__decorateClass([Validate(NUMBER.restrict({min:1}),{optional:!0})],DepthLabelProperties.prototype,"fontSize",2),__decorateClass([Validate(STRING,{optional:!0})],DepthLabelProperties.prototype,"fontFamily",2);var DepthTickProperties=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0}};__decorateClass([Validate(BOOLEAN)],DepthTickProperties.prototype,"enabled",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],DepthTickProperties.prototype,"width",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],DepthTickProperties.prototype,"stroke",2);var DepthProperties=class extends BaseProperties{constructor(){super(...arguments),this.label=new DepthLabelProperties,this.tick=new DepthTickProperties}};__decorateClass([Validate(OBJECT)],DepthProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],DepthProperties.prototype,"tick",2);var GroupedCategoryAxis=class extends CategoryAxis{constructor(t){super(t,new GroupedCategoryScale),this.tickScale=new GroupedCategoryScale,this.depthOptions=new PropertiesArray(DepthProperties),this.includeInvisibleDomains=!0,this.tickScale.paddingInner=1,this.tickScale.paddingOuter=0}resizeTickTree(){if(!this.tickTreeLayout)return;const{nodes:t}=this.tickTreeLayout,{range:e,step:i,inset:s,bandwidth:n}=this.scale,r=Math.abs(e[1]-e[0])-i,o=this.tickTreeLayout.scalingX(r,e[0]>e[1]),a=s+n/2;let l=0;for(const c of t){const h=c.x*o;l>h&&(l=h),c.screenX=h+a}for(const c of t)c.screenX-=l}getDepthOptionsMap(t){const e=[],{depthOptions:i,label:s}=this;for(let n=0;nt.setProperties(e))}updateAxisLine(){this.computedLayout&&(this.lineNode.visible=this.line.enabled,this.lineNode.stroke=this.line.stroke,this.lineNode.strokeWidth=this.line.width)}computeLayout(){if(this.updateDirection(),this.updateScale(),this.resizeTickTree(),!this.tickTreeLayout?.depth)return{bbox:BBox.zero,separatorLayout:[],tickLabelLayout:[]};const{step:t}=this.scale,{title:e,label:i,range:s,depthOptions:n}=this,{depth:r,nodes:o}=this.tickTreeLayout,a=Math.ceil(i.fontSize/t),l=toRadians(this.rotation),c=this.position==="top"||this.position==="bottom",h=i.getSideFlag(),u=[],d=new Map,p=new TransformableText,{defaultRotation:g,configuredRotation:m}=calculateLabelRotation({rotation:i.rotation,parallel:i.parallel,regularFlipRotation:normalizeAngle360(l-Math.PI/2),parallelFlipRotation:normalizeAngle360(l)}),y=g+m,f=this.getDepthOptionsMap(r),x=(F,U)=>{const W=r-F.depth;if(!f[W]?.enabled||U%a!==0||!inRange(F.screenX,s))return!1;const H=this.formatTick(F.label,U-1),_=this.getLabelStyles({value:H,depth:W},n[W]?.label);return p.setProperties({..._,text:H,textAlign:"center",textBaseline:i.parallel?"hanging":"bottom",rotation:0,translationX:0,translationY:F.screenX}),!0};let v=0;const b={};o.forEach((F,U)=>{const W=r-F.depth,H=countLines(F.label);if(b[W]??(b[W]=1),b[W]{let U=v;for(let W=1;W<=F;W++)U+=f[W].spacing,(i.mirrored||W!==F)&&(U+=b[W]*f[W].lineHeight);return U};o.forEach((F,U)=>{if(U===0)return;const W=x(F,U),H=!F.children.length,_=r-F.depth;if(F.parent){const P=H?F.x:F.x-(F.leafCount-1)/2;if(!D.has(P)){const G=this.depthOptions[_]?.tick;let V=v;for(let Y=0;Y<=_;Y++)V+=f[Y].spacing,Y!==0&&(V+=b[Y]*f[Y].lineHeight);D.set(P,{tickSize:V,tickStroke:G?.stroke,tickWidth:G?.enabled!==!1?G?.width:0})}}if(!W)return;if(p.x=A,p.y=0,H){const{width:P}=d.get(U),G=getAngleRatioRadians(y);p.rotation=y,p.textAlign="end",p.textBaseline="middle",p.rotationCenterX=A-P/2,p.translationX=(f[_].spacing-P)/2*G*h,i.mirrored&&(p.translationX+=P)}else p.rotation=c?g:-Math.PI/2,p.rotationCenterX=A,p.translationX=h*I(_);if(f[_].avoidCollisions){const P=H?t:F.leafCount*t;if(p.getBBox().height>P){d.delete(U);return}}const{text:E=""}=p;u.push({text:E,visible:!0,range:this.scale.range,tickId:S(E),fill:p.fill,fontFamily:p.fontFamily,fontSize:p.fontSize,fontStyle:p.fontStyle,fontWeight:p.fontWeight,rotation:p.rotation,rotationCenterX:p.rotationCenterX,textAlign:p.textAlign,textBaseline:p.textBaseline,translationX:p.translationX,translationY:p.translationY,x:p.x,y:p.y}),d.set(U,Transformable.toCanvas(p))});const{enabled:L,stroke:N,width:T}=this.line;this.lineNode.datum={x:0,y1:s[0],y2:s[1]},this.lineNode.setProperties({stroke:N,strokeWidth:L?T:0});const w=[...D.values()];w.push(w[0]);const O=[this.lineNode.getBBox(),new BBox(0,0,w[0].tickSize*h,0)];e.enabled&&(this.updateTitle(!1,w[0].tickSize),O.push(e.caption.node.getBBox()));const Z=BBox.merge(iterate(d.values(),O));return{bbox:this.getTransformBox(Z),separatorLayout:w,tickLabelLayout:u}}update(){if(!this.computedLayout)return;const{tickScale:t,gridLine:e,gridLength:i}=this,{separatorLayout:s}=this.computedLayout,n=t.ticks({nice:!1,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0}).map((r,o)=>({...s[o],tick:r,tickId:createDatumId(r,o),tickLabel:r.filter(Boolean).join(" - "),translationY:Math.round(t.convert(r))}));this.gridLineGroupSelection.update(e.enabled&&i?n:[]),this.tickLineGroupSelection.update(this.tick.enabled?n:[]),this.updatePosition(),this.updateCategoryLabels(),this.updateAxisLine(),this.updateGridLines(),this.updateTickLines(),this.updateTitle(),this.resetSelectionNodes()}calculateLayout(){const{separatorLayout:t,tickLabelLayout:e,bbox:i}=this.computeLayout();return this.computedLayout={separatorLayout:t,tickLabelLayout:e},{bbox:i,primaryTickCount:void 0,niceDomain:this.scale.domain}}onGridVisibilityChange(){this.gridLineGroupSelection.clear(),this.tickLabelGroupSelection.clear()}updateScale(){super.updateScale(),this.tickScale.range=this.scale.range,this.scale.paddingOuter=this.scale.paddingInner/2}processData(){const{direction:t}=this,e=this.boundSeries.filter(n=>n.visible).flatMap(n=>n.getDomain(t));this.dataDomain={domain:extent(e)??this.filterDuplicateArrays(e),clipped:!1},this.isReversed()&&this.dataDomain.domain.reverse();const i=this.dataDomain.domain.map(n=>toArray(isObject(n)&&"value"in n?n.value:n));this.tickTreeLayout=treeLayout(i);const s=[];for(const n of this.tickTreeLayout.nodes)n.leafCount||n.refId==null||s.push(this.dataDomain.domain[n.refId]);return this.scale.domain=sortBasedOnArray(this.dataDomain.domain,s),this.tickScale.domain=i.concat([[""]]),{animatable:!0}}updateGridLines(){if(!this.gridLength)return;const{width:t,style:e}=this.gridLine,i=this.gridLength*-this.label.getSideFlag();this.gridLineGroupSelection.each((s,n,r)=>{const{stroke:o,lineDash:a}=e[r%e.length],l=n.translationY;s.visible=this.inRange(l),s.x1=0,s.x2=i,s.y=l,s.stroke=o,s.strokeWidth=t,s.lineDash=a})}filterDuplicateArrays(t){const e=new Set;return t.filter(i=>{const s=isArray(i)?JSON.stringify(i):i;return e.has(s)?!1:(e.add(s),!0)})}};GroupedCategoryAxis.className="GroupedCategoryAxis",GroupedCategoryAxis.type="grouped-category",__decorateClass([Validate(OBJECT_ARRAY)],GroupedCategoryAxis.prototype,"depthOptions",2);var NON_ZERO_NUMBER=predicateWithMessage(t=>isNumber(t)&&t!==0,"a non-zero number"),LogAxis=class extends NumberAxis{constructor(t){super(t,new LogScale),this.min=NaN,this.max=NaN}normaliseDataDomain(t){const{min:e,max:i}=this,{extent:s,clipped:n}=normalisedExtentWithMetadata(t,e,i);return s[0]<0&&s[1]>0||t[0]<0&&t[1]>0?(logger_exports.warn("The log axis domain crosses zero, the chart data cannot be rendered. See log axis documentation for more information."),{domain:[],clipped:n}):s[0]===0||s[1]===0||t[0]===0||t[1]===0?(logger_exports.warn("The log axis domain contains a value of 0, the chart data cannot be rendered. See log axis documentation for more information."),{domain:[],clipped:n}):{domain:s,clipped:n}}set base(t){this.scale.base=t}get base(){return this.scale.base}defaultDatumFormatter(t,e){return String(t)}defaultLabelFormatter(t,e){return String(t)}};LogAxis.className="LogAxis",LogAxis.type="log",__decorateClass([Validate(AND(NUMBER_OR_NAN,NON_ZERO_NUMBER,LESS_THAN("max"))),Default(NaN)],LogAxis.prototype,"min",2),__decorateClass([Validate(AND(NUMBER_OR_NAN,NON_ZERO_NUMBER,GREATER_THAN("min"))),Default(NaN)],LogAxis.prototype,"max",2);var drawCorner=(t,{x0:e,y0:i,x1:s,y1:n,cx:r,cy:o},a,l)=>{if(l&&t.moveTo(e,i),e!==s||i!==n){const c=Math.atan2(i-o,e-r),h=Math.atan2(n-o,s-r);t.arc(r,o,a,c,h)}else t.lineTo(e,i)},epsilon=1e-6,cornerEdges=(t,e,i,s,n)=>{let r=!1,o=!1,a=s-Math.sqrt(Math.max(n**2-i**2,0)),l=0,c=0,h=i-Math.sqrt(Math.max(n**2-s**2,0));return a>t?(r=!0,a=t,l=i-Math.sqrt(Math.max(n**2-(s-t)**2))):ae?(o=!0,c=s-Math.sqrt(Math.max(n**2-(i-e)**2)),h=e):h{let{topLeft:a,topRight:l,bottomRight:c,bottomLeft:h}=r;const u=Math.max(a+h,l+c),d=Math.max(a+l,h+c);if(u<=0&&d<=0){o==null?t.rect(e,i,s,n):t.rect(o.x,o.y,o.width,o.height);return}else if(o==null&&a===l&&a===c&&a===h){t.roundRect(e,i,s,n,a);return}if(s<0&&(e+=s,s=Math.abs(s)),n<0&&(i+=n,n=Math.abs(n)),s<=0||n<=0)return;if(o==null)o=new BBox(e,i,s,n);else{const D=Math.max(e,o.x),I=Math.min(e+s,o.x+o.width),L=Math.max(i,o.y),N=Math.min(i+n,o.y+o.height);o=new BBox(D,L,I-D,N-L)}const p=Math.max(u/n,d/s,1);p>1&&(a/=p,l/=p,c/=p,h/=p);let g=!0,m=!0,y=!0,f=!0,x,v,b,S;if(g){const D=cornerEdges(o.height,o.width,Math.max(e+a-o.x,0),Math.max(i+a-o.y,0),a);D.leadingClipped&&(f=!1),D.trailingClipped&&(m=!1);const I=Math.max(o.x+D.leading1,o.x),L=Math.max(o.y+D.leading0,o.y),N=Math.max(o.x+D.trailing1,o.x),T=Math.max(o.y+D.trailing0,o.y),w=e+a,O=i+a;x={x0:I,y0:L,x1:N,y1:T,cx:w,cy:O}}if(m){const D=cornerEdges(o.width,o.height,Math.max(i+l-o.y,0),Math.max(o.x+o.width-(e+s-l),0),l);D.leadingClipped&&(g=!1),D.trailingClipped&&(y=!1);const I=Math.min(o.x+o.width-D.leading0,o.x+o.width),L=Math.max(o.y+D.leading1,o.y),N=Math.min(o.x+o.width-D.trailing0,o.x+o.width),T=Math.max(o.y+D.trailing1,o.y),w=e+s-l,O=i+l;v={x0:I,y0:L,x1:N,y1:T,cx:w,cy:O}}if(y){const D=cornerEdges(o.height,o.width,Math.max(o.x+o.width-(e+s-c),0),Math.max(o.y+o.height-(i+n-c),0),c);D.leadingClipped&&(m=!1),D.trailingClipped&&(f=!1);const I=Math.min(o.x+o.width-D.leading1,o.x+o.width),L=Math.min(o.y+o.height-D.leading0,o.y+o.height),N=Math.min(o.x+o.width-D.trailing1,o.x+o.width),T=Math.min(o.y+o.height-D.trailing0,o.y+o.height),w=e+s-c,O=i+n-c;b={x0:I,y0:L,x1:N,y1:T,cx:w,cy:O}}if(f){const D=cornerEdges(o.width,o.height,Math.max(o.y+o.height-(i+n-h),0),Math.max(e+h-o.x,0),h);D.leadingClipped&&(y=!1),D.trailingClipped&&(g=!1);const I=Math.max(o.x+D.leading0,o.x),L=Math.min(o.y+o.height-D.leading1,o.y+o.height),N=Math.max(o.x+D.trailing0,o.x),T=Math.min(o.y+o.height-D.trailing1,o.y+o.height),w=e+h,O=i+n-h;S={x0:I,y0:L,x1:N,y1:T,cx:w,cy:O}}let A=!1;g&&x!=null&&(drawCorner(t,x,a,!A),A||(A=!0)),m&&v!=null&&(drawCorner(t,v,l,!A),A||(A=!0)),y&&b!=null&&(drawCorner(t,b,c,!A),A||(A=!0)),f&&S!=null&&drawCorner(t,S,h,!A),t.closePath()},Rect=class extends Path{constructor(){super(...arguments),this.borderPath=new ExtendedPath2D,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=Shape.defaultStyles.strokeWidth,this.effectiveStrokeWidth=Shape.defaultStyles.strokeWidth,this.hittester=super.isPointInPath.bind(this),this.distanceCalculator=super.distanceSquaredTransformedPoint.bind(this),this.microPixelEffectOpacity=1}set cornerRadius(t){this.topLeftCornerRadius=t,this.topRightCornerRadius=t,this.bottomRightCornerRadius=t,this.bottomLeftCornerRadius=t}isDirtyPath(){return this.lastUpdatePathStrokeWidth!==this.strokeWidth||!!(this.path.isDirty()||this.borderPath.isDirty())}updatePath(){const{path:t,borderPath:e,crisp:i,topLeftCornerRadius:s,topRightCornerRadius:n,bottomRightCornerRadius:r,bottomLeftCornerRadius:o}=this;let{x:a,y:l,width:c,height:h,strokeWidth:u,clipBBox:d}=this;const g=1/(this.layerManager?.canvas.pixelRatio??1);let m=1;if(t.clear(!0),e.clear(!0),i&&(c<=g&&(m*=c/g),h<=g&&(m*=h/g),c=this.align(a,c),h=this.align(l,h),a=this.align(a),l=this.align(l),d=d!=null?new BBox(this.align(d.x),this.align(d.y),this.align(d.x,d.width),this.align(d.y,d.height)):void 0),u)if(c0?s-u:0,topRight:n>0?n-u:0,bottomRight:r>0?r-u:0,bottomLeft:o>0?o-u:0};this.borderClipPath=void 0,c>0&&h>0&&(f==null||f?.width>0&&f?.height>0)&&(clippedRoundRect(t,a,l,c,h,x,f),clippedRoundRect(e,a,l,c,h,x,f))}else this.borderClipPath=this.borderClipPath??new ExtendedPath2D,this.borderClipPath.clear(!0),this.borderClipPath.rect(a,l,c,h),e.rect(a,l,c,h);else{const y={topLeft:s,topRight:n,bottomRight:r,bottomLeft:o};this.borderClipPath=void 0,clippedRoundRect(t,a,l,c,h,y,d)}if([s,n,r,o].every(y=>y===0)){const y=this.getBBox();this.hittester=y.containsPoint.bind(y),this.distanceSquared=(f,x)=>this.getBBox().distanceSquared(f,x)}else this.hittester=super.isPointInPath,this.distanceCalculator=super.distanceSquaredTransformedPoint;this.effectiveStrokeWidth=u,this.lastUpdatePathStrokeWidth=u,this.microPixelEffectOpacity=m}computeBBox(){const{x:t,y:e,width:i,height:s,clipBBox:n}=this;return n?.clone()??new BBox(t,e,i,s)}isPointInPath(t,e){return this.hittester(t,e)}get midPoint(){return{x:this.x+this.width/2,y:this.y+this.height/2}}distanceSquared(t,e){return this.distanceCalculator(t,e)}applyFillAlpha(t){const{fillOpacity:e,microPixelEffectOpacity:i,opacity:s}=this;t.globalAlpha*=s*e*i}renderStroke(t){const{stroke:e,effectiveStrokeWidth:i}=this;if(e&&i){const{globalAlpha:s}=t,{strokeOpacity:n,lineDash:r,lineDashOffset:o,lineCap:a,lineJoin:l,borderPath:c,borderClipPath:h,opacity:u,microPixelEffectOpacity:d}=this;h&&t.clip(h.getPath2D()),this.applyStroke(t),t.globalAlpha*=u*n*d,t.lineWidth=i,r&&t.setLineDash(r),o&&(t.lineDashOffset=o),a&&(t.lineCap=a),l&&(t.lineJoin=l),t.stroke(c.getPath2D()),t.globalAlpha=s}}};Rect.className="Rect",__decorateClass([ScenePathChangeDetection()],Rect.prototype,"x",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"y",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"width",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"height",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"topLeftCornerRadius",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"topRightCornerRadius",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"bottomRightCornerRadius",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"bottomLeftCornerRadius",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"clipBBox",2),__decorateClass([ScenePathChangeDetection()],Rect.prototype,"crisp",2);var Background=class extends BaseModuleInstance{constructor(t){super(),this.ctx=t,this.rectNode=new Rect,this.textNode=new Text,this.fill="white",this.node=this.createNode(),this.node.append([this.rectNode,this.textNode]),this.visible=!0,this.destroyFns.push(t.scene.attachNode(this.node),t.layoutManager.addListener("layout:complete",e=>this.onLayoutComplete(e)))}createNode(){return new Group({name:"background",zIndex:0})}onLayoutComplete(t){const{width:e,height:i}=t.chart;this.rectNode.width=e,this.rectNode.height=i}};__decorateClass([Validate(BOOLEAN),ProxyPropertyOnWrite("node","visible")],Background.prototype,"visible",2),__decorateClass([Validate(COLOR_STRING,{optional:!0}),ProxyPropertyOnWrite("rectNode","fill")],Background.prototype,"fill",2),__decorateClass([Validate(OBJECT,{optional:!0})],Background.prototype,"image",2),__decorateClass([Validate(STRING,{optional:!0}),ProxyPropertyOnWrite("textNode")],Background.prototype,"text",2);var BackgroundModule={type:"root",optionsKey:"background",packageType:"community",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],moduleFactory:t=>new Background(t)};function gridLayout({orientation:t,bboxes:e,maxHeight:i,maxWidth:s,itemPaddingY:n=0,itemPaddingX:r=0,forceResult:o=!1}){const a=t==="horizontal",l={max:a?s:i,fn:a?d=>d.width:d=>d.height,padding:a?r:n},c={max:a?i:s,fn:a?d=>d.height:d=>d.width,padding:a?n:r};let h=0;const u=[];for(;h=1;){const l=calculatePage(t,e,a,i,s,n);if(l==null&&a<=1)return;if(l==null){a--;continue}if(typeof l=="number"){if(l<=1)return;a=l1?l:a,a--;continue}return{processedBBoxCount:l.length*l[0].length,pageIndices:l}}}function calculatePage(t,e,i,s,n,r){const o=[];let a=0,l=0,c=[];const h=[];for(let u=0;u0&&o.push(c),c=[]);const p=s.fn(t[u])+s.padding;h[d]=Math.max(h[d]??0,p),l=Math.max(l,n.fn(t[u])+n.padding);const g=a+l,m=!r||o.length>0;if(g>n.max&&m){c=[];break}if(h.reduce((f,x)=>f+x,0)>s.max&&!r)return h.length0&&o.push(c),o.length>0?o:void 0}function buildPages(t,e,i,s,n){let r=0,o=0;return{pages:t.map(l=>{e==="horizontal"&&(l=transpose(l));let c=0;const h=l.map(p=>{const g=p.map(f=>(c=Math.max(f,c),i[f]));let m=0,y=0;return g.forEach(f=>{m+=f.height+s,y=Math.max(y,f.width+n)}),{indices:p,bboxes:g,columnHeight:Math.ceil(m),columnWidth:Math.ceil(y)}});let u=0,d=0;return h.forEach(p=>{u+=p.columnWidth,d=Math.max(d,p.columnHeight)}),r=Math.max(u,r),o=Math.max(d,o),{columns:h,startIndex:l[0][0],endIndex:c,pageWidth:u,pageHeight:d}}),maxPageWidth:r,maxPageHeight:o}}function transpose(t){const e=[];for(const i of t[0])e.push([]);return t.forEach((i,s)=>{i.forEach((n,r)=>{e[r][s]=n})}),e}function estimateStartingGuess(t,e){const i=t.length;let s=0;for(let n=0;ne.max)return i/n<2?Math.ceil(i/2):n;return i}var PaginationLabel=class extends BaseProperties{constructor(){super(...arguments),this.color="black",this.fontStyle=void 0,this.fontWeight=void 0,this.fontSize=12,this.fontFamily="Verdana, sans-serif"}};__decorateClass([Validate(COLOR_STRING)],PaginationLabel.prototype,"color",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],PaginationLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],PaginationLabel.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],PaginationLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],PaginationLabel.prototype,"fontFamily",2);var PaginationMarkerStyle=class extends BaseProperties{constructor(){super(...arguments),this.size=15,this.fill=void 0,this.fillOpacity=void 0,this.stroke=void 0,this.strokeWidth=1,this.strokeOpacity=1}};__decorateClass([Validate(POSITIVE_NUMBER)],PaginationMarkerStyle.prototype,"size",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],PaginationMarkerStyle.prototype,"fill",2),__decorateClass([Validate(RATIO,{optional:!0})],PaginationMarkerStyle.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],PaginationMarkerStyle.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER)],PaginationMarkerStyle.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO)],PaginationMarkerStyle.prototype,"strokeOpacity",2);var PaginationMarker=class extends BaseProperties{constructor(t){super(),this.parent=t,this.shape="triangle",this.size=15,this.padding=8}};__decorateClass([ActionOnSet({changeValue(){this.parent.marker===this&&this.parent.onMarkerShapeChange()}})],PaginationMarker.prototype,"shape",2),__decorateClass([Validate(POSITIVE_NUMBER)],PaginationMarker.prototype,"size",2),__decorateClass([Validate(POSITIVE_NUMBER)],PaginationMarker.prototype,"padding",2);var Pagination=class extends BaseProperties{constructor(t,e){super(),this.chartUpdateCallback=t,this.pageUpdateCallback=e,this.id=createId(this),this.marker=new PaginationMarker(this),this.activeStyle=new PaginationMarkerStyle,this.inactiveStyle=new PaginationMarkerStyle,this.highlightStyle=new PaginationMarkerStyle,this.label=new PaginationLabel,this.group=new TranslatableGroup({name:"pagination"}),this.labelNode=new Text,this.totalPages=0,this.currentPage=0,this.translationX=0,this.translationY=0,this.nextButtonDisabled=!1,this.previousButtonDisabled=!1,this._visible=!0,this._enabled=!0,this._orientation="vertical",this.nextButton=new Marker,this.previousButton=new Marker,this.labelNode.setProperties({textBaseline:"middle",fontSize:12,fontFamily:"Verdana, sans-serif",fill:"black",y:1}),this.group.append([this.nextButton,this.previousButton,this.labelNode]),this.update(),this.updateMarkers()}set visible(t){this._visible=t,this.updateGroupVisibility()}get visible(){return this._visible}set enabled(t){this._enabled=t,this.updateGroupVisibility()}get enabled(){return this._enabled}updateGroupVisibility(){this.group.visible=this.enabled&&this.visible}set orientation(t){switch(this._orientation=t,t){case"horizontal":{this.previousButton.rotation=-Math.PI/2,this.nextButton.rotation=Math.PI/2;break}case"vertical":default:this.previousButton.rotation=0,this.nextButton.rotation=Math.PI}}get orientation(){return this._orientation}update(){this.updateLabel(),this.updatePositions(),this.enableOrDisableButtons()}updatePositions(){this.group.translationX=this.translationX,this.group.translationY=this.translationY,this.updateLabelPosition(),this.updateNextButtonPosition()}updateLabelPosition(){const{size:t,padding:e}=this.marker;this.nextButton.size=t,this.previousButton.size=t,this.labelNode.x=t/2+e}updateNextButtonPosition(){const t=this.labelNode.getBBox();this.nextButton.translationX=t.width+(this.marker.size/2+this.marker.padding)*2}updateLabel(){const{currentPage:t,totalPages:e,labelNode:i,label:{color:s,fontStyle:n,fontWeight:r,fontSize:o,fontFamily:a}}=this;i.text=`${t+1} / ${e}`,i.fill=s,i.fontStyle=n,i.fontWeight=r,i.fontSize=o,i.fontFamily=a}updateMarkers(){const{nextButton:t,previousButton:e,nextButtonDisabled:i,previousButtonDisabled:s,activeStyle:n,inactiveStyle:r,highlightStyle:o,highlightActive:a}=this,l=(c,h)=>h?r:c===a?o:n;this.updateMarker(t,l("next",i)),this.updateMarker(e,l("previous",s))}updateMarker(t,e){const{shape:i,size:s}=this.marker;t.shape=i,t.size=s,t.fill=e.fill,t.fillOpacity=e.fillOpacity??1,t.stroke=e.stroke,t.strokeWidth=e.strokeWidth,t.strokeOpacity=e.strokeOpacity}enableOrDisableButtons(){const{currentPage:t,totalPages:e}=this,i=e===0,s=t===e-1,n=t===0;this.nextButtonDisabled=s||i,this.previousButtonDisabled=n||i}setPage(t){t=clamp(0,t,Math.max(0,this.totalPages-1)),this.currentPage!==t&&(this.currentPage=t,this.onPaginationChanged())}getCursor(t){return{previous:this.previousButtonDisabled,next:this.nextButtonDisabled}[t]?void 0:"pointer"}onClick(t,e){t.preventDefault(),e==="next"&&!this.nextButtonDisabled?(this.incrementPage(),this.onPaginationChanged()):e==="previous"&&!this.previousButtonDisabled&&(this.decrementPage(),this.onPaginationChanged())}onMouseHover(t){this.highlightActive=t,this.updateMarkers(),this.chartUpdateCallback(6)}onPaginationChanged(){this.pageUpdateCallback(this.currentPage)}incrementPage(){this.currentPage=Math.min(this.currentPage+1,this.totalPages-1)}decrementPage(){this.currentPage=Math.max(this.currentPage-1,0)}onMarkerShapeChange(){this.updatePositions(),this.updateMarkers(),this.chartUpdateCallback(6)}attachPagination(t){t.append(this.group)}getBBox(){return this.group.getBBox()}computeCSSBounds(){const t=Transformable.toCanvas(this.previousButton),e=Transformable.toCanvas(this.nextButton);return{prev:t,next:e}}};Pagination.className="Pagination",__decorateClass([Validate(OBJECT)],Pagination.prototype,"marker",2),__decorateClass([Validate(OBJECT)],Pagination.prototype,"activeStyle",2),__decorateClass([Validate(OBJECT)],Pagination.prototype,"inactiveStyle",2),__decorateClass([Validate(OBJECT)],Pagination.prototype,"highlightStyle",2),__decorateClass([Validate(OBJECT)],Pagination.prototype,"label",2);var ChangeDetectableProperties=class extends BaseProperties{constructor(){super(...arguments),this._dirty=!0}markDirty(){this._dirty=!0}markClean(t){this._dirty=!1}isDirty(){return this._dirty}},MARKER_SUPPORTED_SHAPES=new Set(["circle","cross","diamond","heart","pin","plus","square","star","triangle"]);function isSupportedMarkerShape(t){return typeof t=="string"&&MARKER_SUPPORTED_SHAPES.has(t)}var MARKER_SHAPE=predicateWithMessage(t=>isSupportedMarkerShape(t)||typeof t=="function","a marker shape keyword such as 'circle', 'diamond' or 'square' or an object extending the Marker class"),SeriesMarker=class extends ChangeDetectableProperties{constructor(){super(...arguments),this.enabled=!0,this.shape="circle",this.size=6,this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0}getStyle(){const{size:t,shape:e,fill:i,fillOpacity:s,stroke:n,strokeWidth:r,strokeOpacity:o,lineDash:a,lineDashOffset:l}=this;return{size:t,shape:e,fill:i,fillOpacity:s,stroke:n,strokeWidth:r,strokeOpacity:o,lineDash:a,lineDashOffset:l}}getDiameter(){return this.size+this.strokeWidth}};__decorateClass([Validate(BOOLEAN),SceneChangeDetection()],SeriesMarker.prototype,"enabled",2),__decorateClass([Validate(MARKER_SHAPE),SceneChangeDetection()],SeriesMarker.prototype,"shape",2),__decorateClass([Validate(POSITIVE_NUMBER),SceneChangeDetection()],SeriesMarker.prototype,"size",2),__decorateClass([Validate(COLOR_STRING,{optional:!0}),SceneChangeDetection()],SeriesMarker.prototype,"fill",2),__decorateClass([Validate(RATIO),SceneChangeDetection()],SeriesMarker.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0}),SceneChangeDetection()],SeriesMarker.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER),SceneChangeDetection()],SeriesMarker.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO),SceneChangeDetection()],SeriesMarker.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],SeriesMarker.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],SeriesMarker.prototype,"lineDashOffset",2),__decorateClass([Validate(FUNCTION,{optional:!0}),SceneChangeDetection()],SeriesMarker.prototype,"itemStyler",2);function applyShapeStyle(t,e,i){t.fill=i?.fill??e.fill,t.fillOpacity=i?.fillOpacity??e.fillOpacity??1,t.stroke=i?.stroke??e.stroke,t.strokeOpacity=i?.strokeOpacity??e.strokeOpacity??1,t.strokeWidth=i?.strokeWidth??e.strokeWidth??0,t.lineDash=i?.lineDash??e.lineDash,t.lineDashOffset=i?.lineDashOffset??e.lineDashOffset??0}var LegendDOMProxy=class{constructor(t,e){this.idPrefix=e,this.dirty=!0,this.destroyFns=new DestroyFns,this.itemList=t.proxyInteractionService.createProxyContainer({type:"list",domManagerId:`${e}-toolbar`,classList:["ag-charts-proxy-legend-toolbar"],ariaLabel:{id:"ariaLabelLegend"}}),this.paginationGroup=t.proxyInteractionService.createProxyContainer({type:"group",domManagerId:`${e}-pagination`,classList:["ag-charts-proxy-legend-pagination"],ariaLabel:{id:"ariaLabelLegendPagination"},ariaOrientation:"horizontal"}),this.itemDescription=createElement("p"),this.itemDescription.style.display="none",this.itemDescription.id=`${e}-ariaDescription`,this.itemDescription.textContent=this.getItemAriaDescription(t.localeManager),this.itemList.getElement().append(this.itemDescription)}destroy(){this.destroyFns.destroy()}initLegendList(t){if(!this.dirty)return;const{ctx:e,itemSelection:i,datumReader:s,itemListener:n}=t,r=e.localeManager,o=i.length;i.each((a,l,c)=>{a.proxyButton?.destroy(),a.proxyButton=e.proxyInteractionService.createProxyElement({type:"listswitch",textContent:this.getItemAriaText(r,s.getItemLabel(l),c,o),ariaChecked:!!a.datum.enabled,ariaDescribedBy:this.itemDescription.id,parent:this.itemList});const h=a.proxyButton;h.addListener("click",u=>n.onClick(u.sourceEvent,a.datum,h)),h.addListener("dblclick",u=>n.onDoubleClick(u.sourceEvent,a.datum)),h.addListener("mouseenter",u=>n.onHover(u.sourceEvent,a)),h.addListener("mouseleave",()=>n.onLeave()),h.addListener("contextmenu",u=>n.onContextClick(u.sourceEvent,a)),h.addListener("blur",()=>n.onLeave()),h.addListener("focus",u=>n.onHover(u.sourceEvent,a)),h.addListener("drag-start",()=>{})}),this.dirty=!1}update(t){t.visible&&(this.initLegendList(t),this.updateItemProxyButtons(t),this.updatePaginationProxyButtons(t,!0)),this.updateVisibility(t.visible)}updateVisibility(t){this.itemList.setHidden(!t),this.paginationGroup.setHidden(!t)}updateItemProxyButtons({itemSelection:t,group:e,pagination:i,interactive:s}){const n=Transformable.toCanvas(e);this.itemList.setBounds(n);const r=Math.max(...t.nodes().map(o=>o.getBBox().height));t.each((o,a)=>{if(o.proxyButton){const l=o.pageIndex===i.currentPage,{x:c,y:h,height:u,width:d}=Transformable.toCanvas(o),p=(r-u)/2,g={x:c-n.x,y:h-p-n.y,height:r,width:d};o.proxyButton.setCursor("pointer"),o.proxyButton.setEnabled(s&&l),o.proxyButton.setBounds(g)}})}updatePaginationProxyButtons(t,e){const{pagination:i}=t;if(this.paginationGroup.setHidden(!i.visible),e&&"ctx"in t){const{ctx:r,oldPages:o,newPages:a}=t,l=(o?.length??a.length)>1,c=a.length>1;l!==c&&(c?(this.prevButton=r.proxyInteractionService.createProxyElement({type:"button",id:`${this.idPrefix}-prev-page`,textContent:{id:"ariaLabelLegendPagePrevious"},tabIndex:0,parent:this.paginationGroup}),this.prevButton.addListener("click",h=>this.onPageButton(t,h,"previous")),this.prevButton.addListener("mouseenter",()=>i.onMouseHover("previous")),this.prevButton.addListener("mouseleave",()=>i.onMouseHover(void 0)),this.nextButton??(this.nextButton=r.proxyInteractionService.createProxyElement({type:"button",id:`${this.idPrefix}-next-page`,textContent:{id:"ariaLabelLegendPageNext"},tabIndex:0,parent:this.paginationGroup})),this.nextButton.addListener("click",h=>this.onPageButton(t,h,"next")),this.nextButton.addListener("mouseenter",()=>i.onMouseHover("next")),this.nextButton.addListener("mouseleave",()=>i.onMouseHover(void 0))):(this.nextButton?.destroy(),this.prevButton?.destroy(),this.nextButton=void 0,this.prevButton=void 0))}const{prev:s,next:n}=i.computeCSSBounds();this.prevButton?.setBounds(s),this.nextButton?.setBounds(n),this.prevButton?.setEnabled(i.currentPage!==0),this.nextButton?.setEnabled(i.currentPage!==i.totalPages-1),this.nextButton?.setCursor(i.getCursor("next")),this.prevButton?.setCursor(i.getCursor("previous"))}onPageButton(t,e,i){t.pagination.onClick(e.sourceEvent,i),this.updatePaginationProxyButtons(t,!1)}onDataUpdate(t,e){this.dirty=t.length!==e.length||t.some((i,s,n)=>{const[r,o]=[e[s],t[s]];return r.id!==o.id})}onLocaleChanged(t,e,i){const s=e.length;e.each(({proxyButton:n},r,o)=>{const a=n?.getElement();if(a!=null){const l=i.getItemLabel(r);a.textContent=this.getItemAriaText(t,l,o,s)}}),this.itemDescription.textContent=this.getItemAriaDescription(t)}onPageChange(t){this.updateItemProxyButtons(t),this.updatePaginationProxyButtons(t,!1)}getItemAriaText(t,e,i,s){return i>=0&&e?(i++,t.t("ariaLabelLegendItem",{label:e,index:i,count:s})):t.t("ariaLabelLegendItemUnknown")}getItemAriaDescription(t){return t.t("ariaDescriptionLegendItem")}};function makeLegendItemEvent(t,e,i,s){const n={defaultPrevented:!1,apiEvent:{type:t,itemId:e,seriesId:i,event:s,preventDefault:()=>n.defaultPrevented=!0}};return n}var LegendMarkerLabel=class extends Translatable(Group){constructor(){super({name:"markerLabelGroup"}),this.symbolsGroup=this.appendChild(new Group({name:"legend-markerLabel-symbols"})),this.label=this.appendChild(new Text),this.enabled=!0,this.pageIndex=NaN,this.spacing=0,this.length=0,this.isCustomMarker=!1,this.marker=this.symbolsGroup.appendChild(new Marker({zIndex:1})),this.line=this.symbolsGroup.appendChild(new Line({zIndex:0}));const{label:t,line:e,symbolsGroup:i}=this;e.visible=!1,i.renderToOffscreenCanvas=!0,i.optimizeForInfrequentRedraws=!0,t.textBaseline="middle",t.fontSize=12,t.fontFamily="Verdana, sans-serif",t.fill="black",t.y=1}destroy(){super.destroy(),this.proxyButton?.destroy()}setEnabled(t){this.enabled=t,this.refreshVisibilities()}refreshVisibilities(){const t=this.enabled?1:.5;this.label.opacity=t,this.opacity=t}layout(){const{marker:t,line:e,length:i,isCustomMarker:s}=this;let n=0,r=0;if(t.visible){const{size:o}=t,a=Marker.anchor(t.shape);n=(a.x-.5)*o+i/2,r=(a.y-.5)*o,s?(t.x=0,t.y=0,t.translationX=n,t.translationY=r):(t.x=n,t.y=r,t.translationX=0,t.translationY=0)}e.visible&&(e.x1=0,e.x2=i,e.y1=0,e.y2=0)}preRender(t){const e=super.preRender(t);return this.layout(),e}layoutLabel(){const{length:t,spacing:e}=this;this.label.x=t+e}computeBBox(){return this.layout(),super.computeBBox()}};LegendMarkerLabel.className="MarkerLabel",__decorateClass([ProxyPropertyOnWrite("label")],LegendMarkerLabel.prototype,"text",2),__decorateClass([ProxyPropertyOnWrite("label")],LegendMarkerLabel.prototype,"fontStyle",2),__decorateClass([ProxyPropertyOnWrite("label")],LegendMarkerLabel.prototype,"fontWeight",2),__decorateClass([ProxyPropertyOnWrite("label")],LegendMarkerLabel.prototype,"fontSize",2),__decorateClass([ProxyPropertyOnWrite("label")],LegendMarkerLabel.prototype,"fontFamily",2),__decorateClass([ProxyPropertyOnWrite("label","fill")],LegendMarkerLabel.prototype,"color",2),__decorateClass([ObserveChanges(t=>t.layoutLabel())],LegendMarkerLabel.prototype,"spacing",2),__decorateClass([ObserveChanges(t=>t.layoutLabel())],LegendMarkerLabel.prototype,"length",2),__decorateClass([SceneChangeDetection()],LegendMarkerLabel.prototype,"isCustomMarker",2);var LegendLabel=class extends BaseProperties{constructor(){super(...arguments),this.maxLength=void 0,this.color="black",this.fontStyle=void 0,this.fontWeight=void 0,this.fontSize=12,this.fontFamily="Verdana, sans-serif"}};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LegendLabel.prototype,"maxLength",2),__decorateClass([Validate(COLOR_STRING)],LegendLabel.prototype,"color",2),__decorateClass([Validate(FONT_STYLE,{optional:!0})],LegendLabel.prototype,"fontStyle",2),__decorateClass([Validate(FONT_WEIGHT,{optional:!0})],LegendLabel.prototype,"fontWeight",2),__decorateClass([Validate(POSITIVE_NUMBER)],LegendLabel.prototype,"fontSize",2),__decorateClass([Validate(STRING)],LegendLabel.prototype,"fontFamily",2),__decorateClass([Validate(FUNCTION,{optional:!0})],LegendLabel.prototype,"formatter",2);var LegendMarker=class extends BaseProperties{constructor(){super(...arguments),this.shape=void 0,this.size=15,this.padding=8}};__decorateClass([Validate(MARKER_SHAPE,{optional:!0})],LegendMarker.prototype,"shape",2),__decorateClass([Validate(POSITIVE_NUMBER)],LegendMarker.prototype,"size",2),__decorateClass([Validate(POSITIVE_NUMBER)],LegendMarker.prototype,"padding",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LegendMarker.prototype,"strokeWidth",2),__decorateClass([Validate(BOOLEAN)],LegendMarker.prototype,"enabled",2);var LegendLine=class extends BaseProperties{};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LegendLine.prototype,"strokeWidth",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LegendLine.prototype,"length",2);var LegendItem=class extends BaseProperties{constructor(){super(...arguments),this.paddingX=16,this.paddingY=8,this.showSeriesStroke=!1,this.marker=new LegendMarker,this.label=new LegendLabel,this.line=new LegendLine}};__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LegendItem.prototype,"maxWidth",2),__decorateClass([Validate(POSITIVE_NUMBER)],LegendItem.prototype,"paddingX",2),__decorateClass([Validate(POSITIVE_NUMBER)],LegendItem.prototype,"paddingY",2),__decorateClass([Validate(BOOLEAN)],LegendItem.prototype,"showSeriesStroke",2),__decorateClass([Validate(OBJECT)],LegendItem.prototype,"marker",2),__decorateClass([Validate(OBJECT)],LegendItem.prototype,"label",2),__decorateClass([Validate(OBJECT)],LegendItem.prototype,"line",2);var LegendListeners=class extends BaseProperties{};__decorateClass([Validate(FUNCTION,{optional:!0})],LegendListeners.prototype,"legendItemClick",2),__decorateClass([Validate(FUNCTION,{optional:!0})],LegendListeners.prototype,"legendItemDoubleClick",2);var ID_LEGEND_VISIBILITY="legend-visibility",ID_LEGEND_OTHER_SERIES="legend-other-series",Legend=class extends BaseProperties{constructor(t){super(),this.ctx=t,this.id=createId(this),this.group=new TranslatableGroup({name:"legend",zIndex:14}),this.itemSelection=Selection.select(this.group,LegendMarkerLabel),this.oldSize=[0,0],this.pages=[],this.maxPageSize=[0,0],this.paginationTrackingIndex=0,this.truncatedItems=new Set,this._data=[],this.toggleSeries=!0,this.item=new LegendItem,this.listeners=new LegendListeners,this.enabled=!0,this.position="bottom",this.spacing=20,this.destroyFns=[],this.size=[0,0],this._visible=!0,this.pagination=new Pagination(e=>t.updateService.update(e),e=>this.updatePageNumber(e)),this.pagination.attachPagination(this.group),this.destroyFns.push(t.contextMenuRegistry.registerDefaultAction({id:ID_LEGEND_VISIBILITY,type:"legend",label:"contextMenuToggleSeriesVisibility",action:e=>this.contextToggleVisibility(e)}),t.contextMenuRegistry.registerDefaultAction({id:ID_LEGEND_OTHER_SERIES,type:"legend",label:"contextMenuToggleOtherSeries",action:e=>this.contextToggleOtherSeries(e)}),t.legendManager.addListener("legend-change",this.onLegendDataChange.bind(this))),this.destroyFns.push(t.layoutManager.registerElement(1,e=>this.positionLegend(e)),t.localeManager.addListener("locale-changed",()=>this.onLocaleChanged()),()=>this.group.remove()),this.domProxy=new LegendDOMProxy(this.ctx,this.id),this.ctx.historyManager.addMementoOriginator(t.legendManager)}set data(t){objectsEqual(t,this._data)||(this.domProxy.onDataUpdate(this._data,t),this._data=t,this.updateGroupVisibility())}get data(){return this._data}onLegendDataChange({legendData:t=[]}){this.enabled&&(this.data=t.filter(e=>!e.hideInLegend))}destroy(){this.ctx.domManager.removeChild("canvas-overlay",`${this.id}-toolbar`),this.ctx.domManager.removeChild("canvas-overlay",`${this.id}-pagination`),this.destroyFns.forEach(t=>t()),this.itemSelection.clear(),this.domProxy.destroy()}getOrientation(){if(this.orientation!==void 0)return this.orientation;switch(this.position){case"right":case"left":return"vertical";case"bottom":case"top":return"horizontal"}}set visible(t){this._visible=t,this.updateGroupVisibility()}get visible(){return this._visible}updateGroupVisibility(){this.group.visible=this.enabled&&this.visible&&this.data.length>0}attachLegend(t){t.appendChild(this.group)}getItemLabel(t){const{ctx:{callbackCache:e}}=this,{formatter:i}=this.item.label;if(i){const s=t.datum;return e.call(i,{itemId:t.itemId,value:t.label.text,seriesId:t.seriesId,...s&&{datum:s}})}return t.label.text}calcLayout(t,e){const{paddingX:i,paddingY:s,label:n,maxWidth:r,label:{maxLength:o=1/0,fontStyle:a,fontWeight:l,fontSize:c,fontFamily:h}}=this.item,u=[...this.data];this.reverseOrder&&u.reverse(),this.itemSelection.update(u);const d=[],p=TextUtils.toFontString(n),m=r??t*.8,y=this.calculateMarkerWidth();if(this.itemSelection.each((L,N)=>{L.fontStyle=a,L.fontWeight=l,L.fontSize=c,L.fontFamily=h;const T=this.updateMarkerLabel(L,N,y),w=N.itemId??N.id,Z=(this.getItemLabel(N)??"").replace(/\r?\n/g," ");L.text=this.truncate(Z,o,m,T,p,w),d.push(L.getBBox())}),t=Math.max(1,t),e=Math.max(1,e),!isFinite(t))return{};const f=this.size,x=this.oldSize;f[0]=t,f[1]=e,(f[0]!==x[0]||f[1]!==x[1])&&(x[0]=f[0],x[1]=f[1]);const{pages:v,maxPageHeight:b,maxPageWidth:S}=this.updatePagination(d,t,e),A=this.pages;this.pages=v,this.maxPageSize=[S-i,b-s];const D=this.pagination.currentPage,I=this.pages[D];return this.pages.length<1||!I?(this.visible=!1,{oldPages:A}):(this.visible=!0,this.updatePositions(D),this.update(),{oldPages:A})}isCustomMarker(t,e){return t&&e!==void 0&&typeof e!="string"}calcSymbolsEnabled(t){const{showSeriesStroke:e,marker:i}=this.item,s=!!i.enabled||!e||(t.marker.enabled??!0),n=!!(t.line&&e),r=this.isCustomMarker(s,t.marker.shape);return{markerEnabled:s,lineEnabled:n,isCustomMarker:r}}calcSymbolsLengths(t){const{marker:e,line:i}=this.item,{markerEnabled:s,lineEnabled:n}=this.calcSymbolsEnabled(t),{strokeWidth:r}=this.getMarkerStyles(t),{strokeWidth:o}=n?this.getLineStyles(t):{strokeWidth:0};let a;const{shape:l}=t.marker;if(this.isCustomMarker(s,l)){const u=new Marker;u.shape=l,u.updatePath();const d=u.getBBox();a=Math.max(d.width,d.height)}const c=s?e.size:0,h=n?i.length??25:0;return{markerLength:c,markerStrokeWidth:r,lineLength:h,lineStrokeWidth:o,customMarkerSize:a}}calculateMarkerWidth(){let t=0;return this.itemSelection.each((e,i)=>{const{symbol:s}=i,{markerLength:n,lineLength:r,customMarkerSize:o=-1/0}=this.calcSymbolsLengths(s);t=Math.max(t,r,o,n)}),t}updateMarkerLabel(t,e,i){const{marker:s,paddingX:n}=this.item,{symbol:r}=e;let o=n;const{markerEnabled:a,lineEnabled:l,isCustomMarker:c}=this.calcSymbolsEnabled(r),h=s.padding;(a||l)&&(o+=h+i);const{marker:u,line:d}=t;return u.visible=a,u.visible&&(u.shape=s.shape??r.marker.shape??"square",u.size=s.size,applyShapeStyle(u,this.getMarkerStyles(r))),d.visible=l,d.visible&&applyShapeStyle(d,this.getLineStyles(r)),t.length=i,t.spacing=h,t.isCustomMarker=c,o}truncate(t,e,i,s,n,r){let o=!1;t.length>e&&(t=t.substring(0,e),o=!0);const a=CachedTextMeasurerPool.getMeasurer({font:n}),l=TextWrapper.truncateLine(t,a,i-s,o);return l.endsWith(TextUtils.EllipsisChar)?this.truncatedItems.add(r):this.truncatedItems.delete(r),l}updatePagination(t,e,i){const s=this.getOrientation(),n=Math.min(this.paginationTrackingIndex,t.length);this.pagination.orientation=s,this.pagination.translationX=0,this.pagination.translationY=0;const{pages:r,maxPageHeight:o,maxPageWidth:a,paginationBBox:l,paginationVertical:c}=this.calculatePagination(t,e,i),h=r.findIndex(v=>v.endIndex>=n);this.pagination.currentPage=clamp(0,h,r.length-1);const{paddingX:u,paddingY:d}=this.item,p=8,g=a-u,m=o-d;let y=0,f=-l.y-this.item.marker.size/2;c?f+=m+p:(y+=-l.x+g+p,f+=(m-l.height)/2),this.pagination.translationX=y,this.pagination.translationY=f,this.pagination.update(),this.pagination.updateMarkers();let x=0;return this.itemSelection.each((v,b,S)=>{S>(r[x]?.endIndex??1/0)&&x++,v.pageIndex=x}),{maxPageHeight:o,maxPageWidth:a,pages:r}}calculatePagination(t,e,i){const{paddingX:s,paddingY:n}=this.item,r=this.getOrientation(),o=["left","right"].includes(this.position);let a=this.pagination.getBBox(),l=new BBox(0,0,0,0),c=[],h=0,u=0,d=0;const p=m=>m.width===a.width&&m.height===a.height,g=this.maxWidth!==void 0&&this.maxHeight!==void 0;do{if(d++>10){logger_exports.warn("unable to find stable legend layout.");break}a=l;const m=e-(o?0:a.width),y=i-(o?a.height:0),f=gridLayout({orientation:r,bboxes:t,maxHeight:y,maxWidth:m,itemPaddingY:n,itemPaddingX:s,forceResult:g});c=f?.pages??[],h=f?.maxPageWidth??0,u=f?.maxPageHeight??0;const x=c.length;if(this.pagination.visible=x>1,this.pagination.totalPages=x,this.pagination.update(),this.pagination.updateMarkers(),l=this.pagination.getBBox(),!this.pagination.visible)break}while(!p(l));return{maxPageWidth:h,maxPageHeight:u,pages:c,paginationBBox:l,paginationVertical:o}}updatePositions(t=0){const{item:{paddingY:e},itemSelection:i,pages:s}=this;if(s.length<1||!s[t])return;const{columns:n,startIndex:r,endIndex:o}=s[t];let a=0,l=0;const c=n.length,h=n[0].indices.length,u=this.getOrientation()==="horizontal",d=n[0].bboxes[0].height+e,p=[];i.each((g,m,y)=>{if(yo){g.visible=!1;return}const f=y-r;let x,v;u?(x=f%c,v=Math.floor(f/c)):(x=Math.floor(f/h),v=f%h),g.visible=!0;const b=n[x];b&&(l=Math.floor(d*v),a=Math.floor(p[v]??0),p[v]=(p[v]??0)+b.columnWidth,g.translationX=a,g.translationY=l)})}updatePageNumber(t){const{itemSelection:e,group:i,pagination:s,pages:n,toggleSeries:r}=this,{startIndex:o,endIndex:a}=n[t];o===0?this.paginationTrackingIndex=0:t===n.length-1?this.paginationTrackingIndex=a:this.paginationTrackingIndex=Math.floor((o+a)/2),this.pagination.update(),this.pagination.updateMarkers(),this.updatePositions(t),this.domProxy.onPageChange({itemSelection:e,group:i,pagination:s,interactive:r}),this.ctx.updateService.update(6)}update(){const{label:{color:t}}=this.item;this.itemSelection.each((e,i)=>{e.setEnabled(i.enabled),e.color=t}),this.updateContextMenu()}updateContextMenu(){const{toggleSeries:t,ctx:{contextMenuRegistry:e}}=this;t?(e.hideAction(ID_LEGEND_VISIBILITY),e.hideAction(ID_LEGEND_OTHER_SERIES)):(e.showAction(ID_LEGEND_VISIBILITY),e.showAction(ID_LEGEND_OTHER_SERIES))}getLineStyles(t){const{stroke:e,strokeOpacity:i=1,strokeWidth:s,lineDash:n}=t.line??{},r=Math.min(2,s??1);return{stroke:e,strokeOpacity:i,strokeWidth:this.item.line.strokeWidth??r,lineDash:n}}getMarkerStyles(t){const{fill:e,stroke:i,strokeOpacity:s=1,fillOpacity:n=1,strokeWidth:r,lineDash:o,lineDashOffset:a}=t.marker,l=Math.min(2,r??1);return{fill:e,stroke:i,strokeOpacity:s,fillOpacity:n,strokeWidth:this.item.marker.strokeWidth??l,lineDash:o,lineDashOffset:a}}computePagedBBox(){const t=Group.computeChildrenBBox(this.group.children());if(this.pages.length>1){const[e,i]=this.maxPageSize;t.height=Math.max(i,t.height),t.width=Math.max(e,t.width)}return t}findNode(t){const{datum:e,proxyButton:i}=this.itemSelection.select(s=>s.datum?.itemId===t.itemId)[0]??{};if(e===void 0||i===void 0)throw new Error(`AG Charts - Missing required properties { datum: ${e}, proxyButton: ${JSON.stringify(i)} }`);return{datum:e,proxyButton:i}}contextToggleVisibility(t){const{datum:e,proxyButton:i}=this.findNode(t);this.doClick(t.event,e,i)}contextToggleOtherSeries(t){this.doDoubleClick(t.event,this.findNode(t).datum)}onContextClick(t,e){const i=e.datum;this.preventHidingAll&&this.contextMenuDatum?.enabled&&this.getVisibleItemCount()<=1?this.ctx.contextMenuRegistry.disableAction(ID_LEGEND_VISIBILITY):this.ctx.contextMenuRegistry.enableAction(ID_LEGEND_VISIBILITY);const{offsetX:s,offsetY:n}=t,{x:r,y:o}=Transformable.toCanvasPoint(e,s,n);this.ctx.contextMenuRegistry.dispatchContext("legend",{sourceEvent:t,canvasX:r,canvasY:o},{legendItem:i})}onClick(t,e,i){this.doClick(t,e,i)&&t.preventDefault()}getVisibleItemCount(){return this.ctx.chartService.series.flatMap(t=>t.getLegendData("category")).filter(t=>t.enabled).length}doClick(t,e,i){const{listeners:{legendItemClick:s},ctx:{chartService:n,highlightManager:r},preventHidingAll:o,toggleSeries:a}=this;if(!e)return!1;const{legendType:l,seriesId:c,itemId:h,enabled:u}=e,d=n.series.find(m=>m.id===c);if(!d)return!1;let p=u;const g=makeLegendItemEvent("click",h,d.id,t);return s?.(g.apiEvent),g.defaultPrevented||(a&&(p=!u,o&&!p&&this.getVisibleItemCount()<2&&(p=!0),i.setChecked(p),this.ctx.chartEventManager.legendItemClick(l,d,h,p,e.legendItemName)),p?r.updateHighlight(this.id,{series:d,itemId:h,datum:void 0,datumIndex:void 0}):r.updateHighlight(this.id),this.ctx.legendManager.update(),this.ctx.updateService.update(2,{forceNodeDataRefresh:!0,skipAnimations:e.skipAnimations??!1})),!0}onDoubleClick(t,e){this.doDoubleClick(t,e)&&t.preventDefault()}doDoubleClick(t,e){const{listeners:{legendItemDoubleClick:i},ctx:{chartService:s},toggleSeries:n}=this;if(s.mode==="integrated"||!e)return!1;const{legendType:r,id:o,itemId:a,seriesId:l}=e,c=s.series.find(u=>u.id===o);if(!c)return!1;const h=makeLegendItemEvent("dblclick",a,c.id,t);if(i?.(h.apiEvent),h.defaultPrevented)return!0;if(n){const u=s.series.flatMap(g=>g.getLegendData("category")),d=u.filter(g=>g.enabled).length,p=u.find(g=>g.itemId===a&&g.seriesId===l);this.ctx.chartEventManager.legendItemDoubleClick(r,c,a,p?.enabled??!1,d,p?.legendItemName)}return this.ctx.legendManager.update(),this.ctx.updateService.update(2,{forceNodeDataRefresh:!0}),!0}toTooltipMeta(t,e){let i;if(t instanceof FocusEvent){const{x:r,y:o}=Transformable.toCanvas(e).computeCenter();i={type:"keyboard",canvasX:r,canvasY:o}}else{t.preventDefault();const{x:r,y:o}=Transformable.toCanvasPoint(e,t.offsetX,t.offsetY);i={type:"pointermove",canvasX:r,canvasY:o}}const{canvasX:s,canvasY:n}=i;return{canvasX:s,canvasY:n,lastPointerEvent:i,showArrow:!1}}onHover(t,e){if(!this.enabled)throw new Error("AG Charts - onHover handler called on disabled legend");this.pagination.setPage(e.pageIndex);const i=e.datum,s=i?this.ctx.chartService.series.find(n=>n.id===i?.id):void 0;if(i&&this.truncatedItems.has(i.itemId??i.id)){const n=this.toTooltipMeta(t,e);this.ctx.tooltipManager.updateTooltip(this.id,n,{type:"structured",title:this.getItemLabel(i)})}else this.ctx.tooltipManager.removeTooltip(this.id);i?.enabled&&s?this.updateHighlight({series:s,itemId:i?.itemId,datum:void 0,datumIndex:void 0}):this.updateHighlight()}onLeave(){this.ctx.tooltipManager.removeTooltip(this.id),this.updateHighlight()}updateHighlight(t){this.ctx.interactionManager.isState(32)?this.ctx.highlightManager.updateHighlight(this.id,t):this.ctx.interactionManager.isState(2)&&(this.pendingHighlightDatum=t,this.ctx.animationManager.onBatchStop(()=>{this.ctx.highlightManager.updateHighlight(this.id,this.pendingHighlightDatum)}))}onLocaleChanged(){this.domProxy.onLocaleChanged(this.ctx.localeManager,this.itemSelection,this)}positionLegend(t){const e=this.positionLegendScene(t);this.positionLegendDOM(e)}positionLegendScene(t){if(!this.enabled||!this.data.length)return;const{layoutBox:e}=t,{x:i,y:s,width:n,height:r}=e,[o,a]=this.calculateLegendDimensions(e),{oldPages:l}=this.calcLayout(o,a),c=this.computePagedBBox(),h=()=>{switch(this.position){case"top":case"left":return 0;case"bottom":return r-c.height;case"right":default:return n-c.width}};if(this.visible){const u=this.spacing;let d,p;switch(this.position){case"top":case"bottom":d=(n-c.width)/2,p=h(),e.shrink(c.height+u,this.position);break;case"left":case"right":default:d=h(),p=(r-c.height)/2,e.shrink(c.width+u,this.position)}this.group.translationX=Math.floor(i+d-c.x),this.group.translationY=Math.floor(s+p-c.y)}return l}positionLegendDOM(t){const{ctx:e,itemSelection:i,pagination:s,pages:n,toggleSeries:r,group:o,listeners:{legendItemClick:a,legendItemDoubleClick:l}}=this,c=this.visible&&this.enabled,h=r||l!=null||a!=null;this.domProxy.update({visible:c,interactive:h,ctx:e,itemSelection:i,group:o,pagination:s,oldPages:t,newPages:n,datumReader:this,itemListener:this})}calculateLegendDimensions(t){const{width:e,height:i}=t,s=e/i,n=.5,r=.2,o=.25;let a,l;switch(this.position){case"top":case"bottom":{const c=s<1?Math.min(n,r*(1/s)):r;a=this.maxWidth?Math.min(this.maxWidth,e):e,l=this.maxHeight?Math.min(this.maxHeight,i):Math.round(i*c);break}case"left":case"right":default:{const c=s>1?Math.min(n,o*s):o;a=this.maxWidth?Math.min(this.maxWidth,e):Math.round(e*c),l=this.maxHeight?Math.min(this.maxHeight,i):i}}return[a,l]}};Legend.className="Legend",__decorateClass([Validate(BOOLEAN)],Legend.prototype,"toggleSeries",2),__decorateClass([Validate(OBJECT)],Legend.prototype,"pagination",2),__decorateClass([Validate(OBJECT)],Legend.prototype,"item",2),__decorateClass([Validate(OBJECT)],Legend.prototype,"listeners",2),__decorateClass([ObserveChanges((t,e,i)=>{if(t.updateGroupVisibility(),e===i)return;const{ctx:{legendManager:s,stateManager:n}}=t;i===!1&&e===!0&&n.restoreState(s)}),Validate(BOOLEAN)],Legend.prototype,"enabled",2),__decorateClass([Validate(POSITION)],Legend.prototype,"position",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Legend.prototype,"maxWidth",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],Legend.prototype,"maxHeight",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],Legend.prototype,"reverseOrder",2),__decorateClass([Validate(UNION(["horizontal","vertical"],"an orientation"),{optional:!0})],Legend.prototype,"orientation",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],Legend.prototype,"preventHidingAll",2),__decorateClass([Validate(POSITIVE_NUMBER)],Legend.prototype,"spacing",2);var CommunityLegendModule={type:"legend",optionsKey:"legend",identifier:"category",chartTypes:["cartesian","polar","hierarchy","topology","flow-proportion","standalone","gauge"],moduleFactory:t=>new Legend(t),packageType:"community",removable:"standalone-only"},constants_exports={};__export(constants_exports,{CARTESIAN_AXIS_TYPE:()=>CARTESIAN_AXIS_TYPE,CARTESIAN_POSITION:()=>CARTESIAN_POSITION,FONT_SIZE:()=>FONT_SIZE,FONT_SIZE_RATIO:()=>FONT_SIZE_RATIO,POLAR_AXIS_SHAPE:()=>POLAR_AXIS_SHAPE,POLAR_AXIS_TYPE:()=>POLAR_AXIS_TYPE});var FONT_SIZE=(t=>(t[t.SMALLEST=8]="SMALLEST",t[t.SMALLER=10]="SMALLER",t[t.SMALL=12]="SMALL",t[t.MEDIUM=13]="MEDIUM",t[t.LARGE=14]="LARGE",t[t.LARGEST=17]="LARGEST",t))(FONT_SIZE||{}),FONT_SIZE_RATIO=(t=>(t[t.SMALLEST=.6666666666666666]="SMALLEST",t[t.SMALLER=.8333333333333334]="SMALLER",t[t.SMALL=1]="SMALL",t[t.MEDIUM=1.0833333333333333]="MEDIUM",t[t.LARGE=1.1666666666666667]="LARGE",t[t.LARGEST=1.4166666666666667]="LARGEST",t))(FONT_SIZE_RATIO||{}),CARTESIAN_POSITION=(t=>(t.TOP="top",t.RIGHT="right",t.BOTTOM="bottom",t.LEFT="left",t))(CARTESIAN_POSITION||{}),CARTESIAN_AXIS_TYPE=(t=>(t.CATEGORY="category",t.GROUPED_CATEGORY="grouped-category",t.ORDINAL_TIME="ordinal-time",t.NUMBER="number",t.TIME="time",t.LOG="log",t))(CARTESIAN_AXIS_TYPE||{}),POLAR_AXIS_TYPE=(t=>(t.ANGLE_CATEGORY="angle-category",t.ANGLE_NUMBER="angle-number",t.RADIUS_CATEGORY="radius-category",t.RADIUS_NUMBER="radius-number",t))(POLAR_AXIS_TYPE||{}),POLAR_AXIS_SHAPE=(t=>(t.CIRCLE="circle",t.POLYGON="polygon",t))(POLAR_AXIS_SHAPE||{}),symbols_exports={};__export(symbols_exports,{DEFAULT_ANNOTATION_HANDLE_FILL:()=>DEFAULT_ANNOTATION_HANDLE_FILL,DEFAULT_ANNOTATION_STATISTICS_COLOR:()=>DEFAULT_ANNOTATION_STATISTICS_COLOR,DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL:()=>DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,DEFAULT_ANNOTATION_STATISTICS_FILL:()=>DEFAULT_ANNOTATION_STATISTICS_FILL,DEFAULT_ANNOTATION_STATISTICS_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_STROKE,DEFAULT_BACKGROUND_COLOUR:()=>DEFAULT_BACKGROUND_COLOUR,DEFAULT_CAPTION_ALIGNMENT:()=>DEFAULT_CAPTION_ALIGNMENT,DEFAULT_CAPTION_LAYOUT_STYLE:()=>DEFAULT_CAPTION_LAYOUT_STYLE,DEFAULT_COLOR_RANGE:()=>DEFAULT_COLOR_RANGE,DEFAULT_DIVERGING_SERIES_COLOR_RANGE:()=>DEFAULT_DIVERGING_SERIES_COLOR_RANGE,DEFAULT_FIBONACCI_STROKES:()=>DEFAULT_FIBONACCI_STROKES,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL:()=>DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR:()=>DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,DEFAULT_FUNNEL_SERIES_COLOR_RANGE:()=>DEFAULT_FUNNEL_SERIES_COLOR_RANGE,DEFAULT_GAUGE_SERIES_COLOR_RANGE:()=>DEFAULT_GAUGE_SERIES_COLOR_RANGE,DEFAULT_GRIDLINE_ENABLED:()=>DEFAULT_GRIDLINE_ENABLED,DEFAULT_HIERARCHY_FILLS:()=>DEFAULT_HIERARCHY_FILLS,DEFAULT_HIERARCHY_STROKES:()=>DEFAULT_HIERARCHY_STROKES,DEFAULT_POLAR_SERIES_STROKE:()=>DEFAULT_POLAR_SERIES_STROKE,DEFAULT_SEPARATION_LINES_COLOUR:()=>DEFAULT_SEPARATION_LINES_COLOUR,DEFAULT_SHADOW_COLOUR:()=>DEFAULT_SHADOW_COLOUR,DEFAULT_SPARKLINE_CROSSHAIR_STROKE:()=>DEFAULT_SPARKLINE_CROSSHAIR_STROKE,DEFAULT_TEXTBOX_COLOR:()=>DEFAULT_TEXTBOX_COLOR,DEFAULT_TEXTBOX_FILL:()=>DEFAULT_TEXTBOX_FILL,DEFAULT_TEXTBOX_STROKE:()=>DEFAULT_TEXTBOX_STROKE,DEFAULT_TEXT_ANNOTATION_COLOR:()=>DEFAULT_TEXT_ANNOTATION_COLOR,DEFAULT_TOOLBAR_POSITION:()=>DEFAULT_TOOLBAR_POSITION,IS_COMMUNITY:()=>IS_COMMUNITY,IS_DARK_THEME:()=>IS_DARK_THEME,IS_ENTERPRISE:()=>IS_ENTERPRISE,PALETTE_ALT_DOWN_FILL:()=>PALETTE_ALT_DOWN_FILL,PALETTE_ALT_DOWN_STROKE:()=>PALETTE_ALT_DOWN_STROKE,PALETTE_ALT_NEUTRAL_FILL:()=>PALETTE_ALT_NEUTRAL_FILL,PALETTE_ALT_NEUTRAL_STROKE:()=>PALETTE_ALT_NEUTRAL_STROKE,PALETTE_ALT_UP_FILL:()=>PALETTE_ALT_UP_FILL,PALETTE_ALT_UP_STROKE:()=>PALETTE_ALT_UP_STROKE,PALETTE_DOWN_FILL:()=>PALETTE_DOWN_FILL,PALETTE_DOWN_STROKE:()=>PALETTE_DOWN_STROKE,PALETTE_NEUTRAL_FILL:()=>PALETTE_NEUTRAL_FILL,PALETTE_NEUTRAL_STROKE:()=>PALETTE_NEUTRAL_STROKE,PALETTE_UP_FILL:()=>PALETTE_UP_FILL,PALETTE_UP_STROKE:()=>PALETTE_UP_STROKE});var IS_DARK_THEME=Symbol("is-dark-theme"),IS_COMMUNITY=Symbol("is-community"),IS_ENTERPRISE=Symbol("is-enterprise"),DEFAULT_SEPARATION_LINES_COLOUR=Symbol("default-separation-lines-colour"),DEFAULT_BACKGROUND_COLOUR=Symbol("default-background-colour"),DEFAULT_SHADOW_COLOUR=Symbol("default-shadow-colour"),DEFAULT_CAPTION_LAYOUT_STYLE=Symbol("default-caption-layout-style"),DEFAULT_CAPTION_ALIGNMENT=Symbol("default-caption-alignment"),PALETTE_UP_STROKE=Symbol("palette-up-stroke"),PALETTE_DOWN_STROKE=Symbol("palette-down-stroke"),PALETTE_UP_FILL=Symbol("palette-up-fill"),PALETTE_DOWN_FILL=Symbol("palette-down-fill"),PALETTE_NEUTRAL_STROKE=Symbol("palette-neutral-stroke"),PALETTE_NEUTRAL_FILL=Symbol("palette-neutral-fill"),PALETTE_ALT_UP_STROKE=Symbol("palette-alt-up-stroke"),PALETTE_ALT_DOWN_STROKE=Symbol("palette-alt-down-stroke"),PALETTE_ALT_UP_FILL=Symbol("palette-alt-up-fill"),PALETTE_ALT_DOWN_FILL=Symbol("palette-alt-down-fill"),PALETTE_ALT_NEUTRAL_FILL=Symbol("palette-gray-fill"),PALETTE_ALT_NEUTRAL_STROKE=Symbol("palette-gray-stroke"),DEFAULT_POLAR_SERIES_STROKE=Symbol("default-polar-series-stroke"),DEFAULT_DIVERGING_SERIES_COLOR_RANGE=Symbol("default-diverging-series-colour-range"),DEFAULT_COLOR_RANGE=Symbol("default-colour-range"),DEFAULT_SPARKLINE_CROSSHAIR_STROKE=Symbol("default-sparkline-crosshair-stroke"),DEFAULT_GAUGE_SERIES_COLOR_RANGE=Symbol("default-gauge-series-colour-range"),DEFAULT_FUNNEL_SERIES_COLOR_RANGE=Symbol("default-funnel-series-colour-range"),DEFAULT_HIERARCHY_FILLS=Symbol("default-hierarchy-fills"),DEFAULT_HIERARCHY_STROKES=Symbol("default-hierarchy-strokes"),DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR=Symbol("default-financial-charts-annotation-stroke"),DEFAULT_FIBONACCI_STROKES=Symbol("default-hierarchy-strokes"),DEFAULT_TEXT_ANNOTATION_COLOR=Symbol("default-text-annotation-color"),DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL=Symbol("default-financial-charts-annotation-background-fill"),DEFAULT_ANNOTATION_HANDLE_FILL=Symbol("default-annotation-handle-fill"),DEFAULT_ANNOTATION_STATISTICS_FILL=Symbol("default-annotation-statistics-fill"),DEFAULT_ANNOTATION_STATISTICS_STROKE=Symbol("default-annotation-statistics-stroke"),DEFAULT_ANNOTATION_STATISTICS_COLOR=Symbol("default-annotation-statistics-color"),DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE=Symbol("default-annotation-statistics-divider-stroke"),DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL=Symbol("default-annotation-statistics-fill"),DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE=Symbol("default-annotation-statistics-stroke"),DEFAULT_TEXTBOX_FILL=Symbol("default-textbox-fill"),DEFAULT_TEXTBOX_STROKE=Symbol("default-textbox-stroke"),DEFAULT_TEXTBOX_COLOR=Symbol("default-textbox-color"),DEFAULT_TOOLBAR_POSITION=Symbol("default-toolbar-position"),DEFAULT_GRIDLINE_ENABLED=Symbol("default-gridline-enabled");function swapAxisCondition(t,e){return i=>e(i)?[{...t[0],position:t[1].position},{...t[1],position:t[0].position}]:t}function singleSeriesPaletteFactory({takeColors:t}){const{fills:[e],strokes:[i]}=t(1);return{fill:e,stroke:i}}function markerPaletteFactory(t){return{marker:singleSeriesPaletteFactory(t)}}function pathMotion(t,e,i,s,n){const{addPhaseFn:r,updatePhaseFn:o,removePhaseFn:a}=n,l=(c,h,u)=>{i.animate({id:`${t}_${e}_${h.id}_${c}`,groupId:t,from:0,to:1,ease:easeOut,collapsable:!1,onUpdate(d,p){p&&c!=="removed"||(h.path.clear(!0),u(d,h),h.checkPathDirty())},onStop(){c==="added"&&(h.path.clear(!0),u(1,h),h.checkPathDirty())},phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[c]})};for(const c of s)i.isSkipped()||(l("removed",c,a),l("updated",c,o)),l("added",c,r)}function seriesLabelFadeInAnimation({id:t},e,i,...s){staticFromToMotion(t,e,i,s,{opacity:0},{opacity:1},{phase:"trailing"})}function seriesLabelFadeOutAnimation({id:t},e,i,...s){staticFromToMotion(t,e,i,s,{opacity:1},{opacity:0},{phase:"remove"})}function resetLabelFn(t){return{opacity:1}}var DropShadow=class extends ChangeDetectableProperties{constructor(){super(...arguments),this.enabled=!0,this.color="rgba(0, 0, 0, 0.5)",this.xOffset=0,this.yOffset=0,this.blur=5}};__decorateClass([Validate(BOOLEAN),SceneChangeDetection()],DropShadow.prototype,"enabled",2),__decorateClass([Validate(COLOR_STRING),SceneChangeDetection()],DropShadow.prototype,"color",2),__decorateClass([Validate(NUMBER),SceneChangeDetection()],DropShadow.prototype,"xOffset",2),__decorateClass([Validate(NUMBER),SceneChangeDetection()],DropShadow.prototype,"yOffset",2),__decorateClass([Validate(POSITIVE_NUMBER),SceneChangeDetection()],DropShadow.prototype,"blur",2);var SeriesTooltipInteraction=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!1}};__decorateClass([Validate(BOOLEAN)],SeriesTooltipInteraction.prototype,"enabled",2);var SeriesTooltip=class extends BaseProperties{constructor(){super(...arguments),this.enabled=!0,this.interaction=new SeriesTooltipInteraction,this.position=new TooltipPosition,this.range=void 0,this.class=void 0}formatTooltip(t,e){const i=this.renderer?.(e);return typeof i=="string"?{type:"raw",rawHtmlString:i}:i!=null?{type:"structured",...t,...i}:{type:"structured",...t}}};__decorateClass([Validate(BOOLEAN)],SeriesTooltip.prototype,"enabled",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],SeriesTooltip.prototype,"showArrow",2),__decorateClass([Validate(FUNCTION,{optional:!0})],SeriesTooltip.prototype,"renderer",2),__decorateClass([Validate(OBJECT)],SeriesTooltip.prototype,"interaction",2),__decorateClass([Validate(OBJECT)],SeriesTooltip.prototype,"position",2),__decorateClass([Validate(INTERACTION_RANGE,{optional:!0})],SeriesTooltip.prototype,"range",2),__decorateClass([Validate(STRING,{optional:!0})],SeriesTooltip.prototype,"class",2);var INTERPOLATION_TYPE=UNION(["linear","smooth","step"],"a line style"),INTERPOLATION_STEP_POSITION=UNION(["start","middle","end"]),InterpolationProperties=class extends BaseProperties{constructor(){super(...arguments),this.type="linear",this.tension=1,this.position="end"}};__decorateClass([Validate(INTERPOLATION_TYPE)],InterpolationProperties.prototype,"type",2),__decorateClass([Validate(RATIO)],InterpolationProperties.prototype,"tension",2),__decorateClass([Validate(INTERPOLATION_STEP_POSITION)],InterpolationProperties.prototype,"position",2);var AreaSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.xName=void 0,this.defaultColorRange=[],this.fill="#c16068",this.fillOpacity=1,this.stroke="#874349",this.strokeWidth=2,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.interpolation=new InterpolationProperties,this.shadow=new DropShadow,this.marker=new SeriesMarker,this.label=new Label,this.tooltip=new SeriesTooltip,this.connectMissingData=!1}};__decorateClass([Validate(STRING)],AreaSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING,{optional:!0})],AreaSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING)],AreaSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING,{optional:!0})],AreaSeriesProperties.prototype,"yName",2),__decorateClass([Validate(STRING,{optional:!0})],AreaSeriesProperties.prototype,"yFilterKey",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],AreaSeriesProperties.prototype,"normalizedTo",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],AreaSeriesProperties.prototype,"defaultColorRange",2),__decorateClass([Validate(OR(COLOR_GRADIENT,COLOR_STRING))],AreaSeriesProperties.prototype,"fill",2),__decorateClass([Validate(RATIO)],AreaSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING)],AreaSeriesProperties.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER)],AreaSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO)],AreaSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],AreaSeriesProperties.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],AreaSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Validate(OBJECT)],AreaSeriesProperties.prototype,"interpolation",2),__decorateClass([Validate(OBJECT)],AreaSeriesProperties.prototype,"shadow",2),__decorateClass([Validate(OBJECT)],AreaSeriesProperties.prototype,"marker",2),__decorateClass([Validate(OBJECT)],AreaSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],AreaSeriesProperties.prototype,"tooltip",2),__decorateClass([Validate(BOOLEAN)],AreaSeriesProperties.prototype,"connectMissingData",2);function spanRange(t){switch(t.type){case"linear":case"step":return[{x:t.x0,y:t.y0},{x:t.x1,y:t.y1}];case"cubic":return[{x:t.cp0x,y:t.cp0y},{x:t.cp3x,y:t.cp3y}]}}function spanRangeNormalized(t){const e=spanRange(t);return e[0].x>e[1].x&&e.reverse(),e}function collapseSpanToPoint(t,e){const{x:i,y:s}=e;switch(t.type){case"linear":return{type:"linear",moveTo:t.moveTo,x0:i,y0:s,x1:i,y1:s};case"step":return{type:"step",moveTo:t.moveTo,x0:i,y0:s,x1:i,y1:s,stepX:i};case"cubic":return{type:"cubic",moveTo:t.moveTo,cp0x:i,cp0y:s,cp1x:i,cp1y:s,cp2x:i,cp2y:s,cp3x:i,cp3y:s}}}function rescaleSpan(t,e,i){const[s,n]=spanRange(t),r=n.x!==s.x?(i.x-e.x)/(n.x-s.x):0,o=n.y!==s.y?(i.y-e.y)/(n.y-s.y):0;switch(t.type){case"linear":return{type:"linear",moveTo:t.moveTo,x0:e.x,y0:e.y,x1:i.x,y1:i.y};case"cubic":return{type:"cubic",moveTo:t.moveTo,cp0x:e.x,cp0y:e.y,cp1x:i.x-(t.cp2x-s.x)*r,cp1y:i.y-(t.cp2y-s.y)*o,cp2x:i.x-(t.cp1x-s.x)*r,cp2y:i.y-(t.cp1y-s.y)*o,cp3x:i.x,cp3y:i.y};case"step":return{type:"step",moveTo:t.moveTo,x0:e.x,y0:e.y,x1:i.x,y1:i.y,stepX:i.x-(t.stepX-s.x)*r}}}function clipSpanX(t,e,i){const{moveTo:s}=t,[n,r]=spanRangeNormalized(t),{x:o,y:a}=n,{x:l,y:c}=r;if(il)return rescaleSpan(t,r,r);switch(t.type){case"linear":{const h=a===c?void 0:(c-a)/(l-o),u=h==null?a:h*(e-o)+a,d=h==null?a:h*(i-o)+a;return{type:"linear",moveTo:s,x0:e,y0:u,x1:i,y1:d}}case"step":if(i<=t.stepX){const h=t.y0;return{type:"step",moveTo:s,x0:e,y0:h,x1:i,y1:h,stepX:i}}else if(e>=t.stepX){const h=t.y1;return{type:"step",moveTo:s,x0:e,y0:h,x1:i,y1:h,stepX:e}}else{const{y0:h,y1:u,stepX:d}=t;return{type:"step",moveTo:s,x0:e,y0:h,x1:i,y1:u,stepX:d}}case"cubic":{const h=solveBezier(t.cp0x,t.cp1x,t.cp2x,t.cp3x,e);let[u,d]=splitBezier(t.cp0x,t.cp0y,t.cp1x,t.cp1y,t.cp2x,t.cp2y,t.cp3x,t.cp3y,h);const p=solveBezier(d[0].x,d[1].x,d[2].x,d[3].x,i);return[d,u]=splitBezier(d[0].x,d[0].y,d[1].x,d[1].y,d[2].x,d[2].y,d[3].x,d[3].y,p),{type:"cubic",moveTo:s,cp0x:d[0].x,cp0y:d[0].y,cp1x:d[1].x,cp1y:d[1].y,cp2x:d[2].x,cp2y:d[2].y,cp3x:d[3].x,cp3y:d[3].y}}}}function linearPoints(t){const e=[];let i=0,s=NaN,n=NaN;for(const{x:r,y:o}of t){if(i>0){const a=i===1;e.push({type:"linear",moveTo:a,x0:s,y0:n,x1:r,y1:o})}i+=1,s=r,n=o}return e}var lineSteps={start:0,middle:.5,end:1};function stepPoints(t,e){const i=[];let s=0,n=NaN,r=NaN;const o=typeof e=="number"?e:lineSteps[e];for(const{x:a,y:l}of t){if(s>0){const c=s===1,h=n+(a-n)*o;i.push({type:"step",moveTo:c,x0:n,y0:r,x1:a,y1:l,stepX:h})}s+=1,n=a,r=l}return i}var flatnessRatio=.05;function smoothPoints(t,e){const i=Array.isArray(t)?t:Array.from(t);if(i.length<=1)return[];const s=i.map((r,o)=>{const a=o===0?r:i[o-1],l=o===i.length-1?r:i[o+1],c=o===0||o===i.length-1;if(Math.sign(a.y-r.y)===Math.sign(l.y-r.y))return 0;if(!c){const h=Math.abs(a.y-l.y),u=Math.abs(r.y-a.y)/h,d=Math.abs(r.y-l.y)/h;if(u<=flatnessRatio||1-u<=flatnessRatio||d<=flatnessRatio||1-d<=flatnessRatio)return 0}return(l.y-a.y)/(l.x-a.x)});s[1]===0&&(s[0]*=2),s[s.length-2]===0&&(s[s.length-1]*=2);const n=[];for(let r=1;rMath.abs(u)&&(d*=Math.abs(u/p),p=Math.sign(p)*Math.abs(u)),a===0&&Math.abs(m)>Math.abs(u)&&(g*=Math.abs(u/m),m=Math.sign(m)*Math.abs(u)),n.push({type:"cubic",moveTo:r===1,cp0x:o.x,cp0y:o.y,cp1x:o.x+d,cp1y:o.y+p,cp2x:l.x-g,cp2y:l.y-m,cp3x:l.x,cp3y:l.y})}return n}function lerp2(t,e,i){return(e-t)*i+t}function linearSupertype(t,e){const{x0:i,y0:s,x1:n,y1:r}=t,a=(r-s)/(n-i)*(e-i)+s;return{leftCp1x:i,leftCp1y:s,leftCp2x:e,leftCp2y:a,stepX:e,stepY0:a,stepY1:a,rightCp1x:e,rightCp1y:a,rightCp2x:n,rightCp2y:r}}function bezierSupertype(t,e){const{cp0x:i,cp0y:s,cp1x:n,cp1y:r,cp2x:o,cp2y:a,cp3x:l,cp3y:c}=t,h=solveBezier(i,n,o,l,e),[u,d]=splitBezier(i,s,n,r,o,a,l,c,h),p=u[3].y;return{leftCp1x:u[1].x,leftCp1y:u[1].y,leftCp2x:u[2].x,leftCp2y:u[2].y,stepX:e,stepY0:p,stepY1:p,rightCp1x:d[1].x,rightCp1y:d[1].y,rightCp2x:d[2].x,rightCp2y:d[2].y}}function stepSupertype(t){const{x0:e,y0:i,x1:s,y1:n,stepX:r}=t;return{leftCp1x:(e+r)/2,leftCp1y:i,leftCp2x:(e+r)/2,leftCp2y:i,stepX:r,stepY0:i,stepY1:n,rightCp1x:(r+s)/2,rightCp1y:n,rightCp2x:(r+s)/2,rightCp2y:n}}function spanSupertype(t,e){return t.type==="linear"?linearSupertype(t,e):t.type==="cubic"?bezierSupertype(t,e):stepSupertype(t)}function plotStart(t,e,i,s,n,r,o){switch(e){case 0:o?t.moveTo(n,r):t.moveTo(i,s);break;case 1:o?t.lineTo(n,r):t.lineTo(i,s);break}}function plotLinear(t,e,i,s,n,r){r?t.lineTo(e,i):t.lineTo(s,n)}function plotCubic(t,e,i,s,n,r,o,a,l,c){c?t.cubicCurveTo(r,o,s,n,e,i):t.cubicCurveTo(s,n,r,o,a,l)}function plotStep(t,e,i,s,n,r,o){o?(t.lineTo(r,n),t.lineTo(r,i),t.lineTo(e,i)):(t.lineTo(r,i),t.lineTo(r,n),t.lineTo(s,n))}function plotSpan(t,e,i,s){const[n,r]=spanRange(e);switch(plotStart(t,i,n.x,n.y,r.x,r.y,s),e.type){case"linear":plotLinear(t,e.x0,e.y0,e.x1,e.y1,s);break;case"cubic":plotCubic(t,e.cp0x,e.cp0y,e.cp1x,e.cp1y,e.cp2x,e.cp2y,e.cp3x,e.cp3y,s);break;case"step":plotStep(t,e.x0,e.y0,e.x1,e.y1,e.stepX,s);break}}function interpolatedSpanRange(t,e,i){const[s,n]=spanRange(t),[r,o]=spanRange(e),a=lerp2(s.x,r.x,i),l=lerp2(s.y,r.y,i),c=lerp2(n.x,o.x,i),h=lerp2(n.y,o.y,i);return[{x:a,y:l},{x:c,y:h}]}function plotInterpolatedSpans(t,e,i,s,n,r){const[{x:o,y:a},{x:l,y:c}]=interpolatedSpanRange(e,i,s);if(plotStart(t,n,o,a,l,c,r),e.type==="cubic"&&i.type==="cubic"){const h=lerp2(e.cp1x,i.cp1x,s),u=lerp2(e.cp1y,i.cp1y,s),d=lerp2(e.cp2x,i.cp2x,s),p=lerp2(e.cp2y,i.cp2y,s);plotCubic(t,o,a,h,u,d,p,l,c,r)}else if(e.type==="step"&&i.type==="step"){const h=lerp2(e.stepX,i.stepX,s);plotStep(t,o,a,l,c,h,r)}else if(e.type==="linear"&&i.type==="linear")plotLinear(t,o,a,l,c,r);else{let h;e.type==="step"?h=e.stepX:i.type==="step"?h=i.stepX:h=(o+l)/2;const u=spanSupertype(e,h),d=spanSupertype(i,h),p=lerp2(u.leftCp1x,d.leftCp1x,s),g=lerp2(u.leftCp1y,d.leftCp1y,s),m=lerp2(u.leftCp2x,d.leftCp2x,s),y=lerp2(u.leftCp2y,d.leftCp2y,s),f=lerp2(u.stepX,d.stepX,s),x=lerp2(u.stepY0,d.stepY0,s),v=lerp2(u.stepY1,d.stepY1,s),b=lerp2(u.rightCp1x,d.rightCp1x,s),S=lerp2(u.rightCp1y,d.rightCp1y,s),A=lerp2(u.rightCp2x,d.rightCp2x,s),D=lerp2(u.rightCp2y,d.rightCp2y,s);r?(t.cubicCurveTo(A,D,b,S,f,v),t.lineTo(f,x),t.cubicCurveTo(m,y,p,g,o,a)):(t.cubicCurveTo(p,g,m,y,f,x),t.lineTo(f,v),t.cubicCurveTo(b,S,A,D,l,c))}}var CollapseMode=(t=>(t[t.Zero=0]="Zero",t[t.Split=1]="Split",t))(CollapseMode||{});function integratedCategoryMatch(t,e){return t==null||e==null||typeof t!="object"||typeof e!="object"?!1:"id"in t&&"id"in e?t.id===e.id:t.toString()===e.toString()}function scale(t,e){if(!e)return NaN;if(t instanceof Date&&(t=t.getTime()),e.type==="continuous"&&typeof t=="number")return(t-e.domain[0])/(e.domain[1]-e.domain[0])*(e.range[1]-e.range[0])+e.range[0];if(e.type==="log"&&typeof t=="number")return e.convert(t);if(e.type!=="category")return NaN;const i=e.domain.findIndex(n=>n===t);return i>=0||e.domain.findIndex(n=>integratedCategoryMatch(t,n))>=0?e.inset+e.step*i:NaN}function toAxisValue(t){return transformIntegratedCategoryValue(t).valueOf()}function getAxisIndices({data:t},e){return t.map((i,s)=>({xValue0Index:e.indexOf(toAxisValue(i.xValue0)),xValue1Index:e.indexOf(toAxisValue(i.xValue1)),datumIndex:s}))}function validateCategorySorting(t,e){const i=e.scales.x,s=t.scales.x;if(i?.type!=="category"||s?.type!=="category")return!0;let n=-1/0;for(const r of i.domain){const o=scale(r,s);if(Number.isFinite(o)){if(o({axisValue:h,value:u}));s.sort((h,u)=>scale(h.value,t.scales.x)-scale(u.value,t.scales.x));const n=[];for(const{xValue0:h,xValue1:u}of e.data){const d=toAxisValue(h),p=toAxisValue(u);i.has(d)||(i.set(d,h),n.push({axisValue:d,value:h})),i.has(p)||(i.set(p,u),n.push({axisValue:p,value:u}))}n.sort((h,u)=>scale(h.value,e.scales.x)-scale(u.value,e.scales.x));const r=s;let o=0;for(const h of n){for(let u=r.length-1;u>o;u-=1){const d=scale(h.value,e.scales.x),p=scale(r[u].value,e.scales.x);if(d>p){o=u+1;break}}r.splice(o,0,h),o+=1}if(!validateAxisEntriesOrder(r,e))return;const a=r.map(h=>h.axisValue),l=getAxisIndices(e,a),c=getAxisIndices(t,a);return{axisValues:a,oldDataAxisIndices:l,newDataAxisIndices:c}}function clipSpan(t,e,i){if(i.xValue1Index===i.xValue0Index+1)return t;const s=spanRange(t),n=(s[1].x-s[0].x)/(i.xValue1Index-i.xValue0Index),r=s[0].x+(e-i.xValue0Index)*n,o=r+n;return clipSpanX(t,r,o)}function axisZeroSpan(t,e){const[i,s]=spanRange(t),n=scale(0,e.scales.y);return rescaleSpan(t,{x:i.x,y:n},{x:s.x,y:n})}function collapseSpanToMidpoint(t){const[e,i]=spanRange(t);return collapseSpanToPoint(t,{x:(e.x+i.x)/2,y:(e.y+i.y)/2})}function collapseSpan(t,e,i,s,n,r){let o,a;if(n.xValue0Index>=r.xValue1Index){const u=s.findLast(p=>p.xValue1Index<=r.xValue1Index)?.datumIndex,d=u!=null?i.data[u]:void 0;o=d?.xValue1,a=d?.yValue1}else if(n.xValue0Index<=r.xValue0Index){const u=s.find(p=>p.xValue0Index>=r.xValue0Index)?.datumIndex,d=u!=null?i.data[u]:void 0;o=d?.xValue0,a=d?.yValue0}if(o==null||a==null)switch(e){case 0:return axisZeroSpan(t,i);case 1:return collapseSpanToMidpoint(t)}const l=scale(o,i.scales.x),c=scale(a,i.scales.y),h={x:l,y:c};return rescaleSpan(t,h,h)}function zeroDataSpan(t,e){if(e==null)return;const i=toAxisValue(t.xValue0),s=toAxisValue(t.xValue1);return e.find(n=>toAxisValue(n.xValue0)===i&&toAxisValue(n.xValue1)===s)?.span}function addSpan(t,e,i,s,n,r,o){const a=t.data[s.datumIndex],l=a.span,c=zeroDataSpan(a,n);if(c!=null)o.removed.push({from:c,to:c}),o.moved.push({from:c,to:l}),o.added.push({from:l,to:l});else{const h=collapseSpan(l,e,t,i,s,r);o.added.push({from:h,to:l})}}function removeSpan(t,e,i,s,n,r,o){const a=t.data[s.datumIndex],l=a.span,c=zeroDataSpan(a,n);if(c!=null)o.removed.push({from:l,to:l}),o.moved.push({from:l,to:c}),o.added.push({from:c,to:c});else{const h=collapseSpan(l,e,t,i,s,r);o.removed.push({from:l,to:h})}}function alignSpanToContainingSpan(t,e,i,s,n){const r=e[n.xValue0Index],o=i.data.find(y=>toAxisValue(y.xValue0)===r),a=e[n.xValue1Index],l=i.data.find(y=>toAxisValue(y.xValue1)===a);if(o==null||l==null)return;const[{x:c},{x:h}]=spanRange(t),u=scale(o.xValue0,i.scales.x),d=scale(o.yValue0,i.scales.y),p=scale(l.xValue1,i.scales.x),g=scale(l.yValue1,i.scales.y);let m=s.data[n.datumIndex].span;return m=rescaleSpan(m,{x:u,y:d},{x:p,y:g}),m=clipSpanX(m,c,h),m}function appendSpanPhases(t,e,i,s,n,r,o,a,l){const c=n+1,h=o.find(v=>v.xValue0Index<=n&&v.xValue1Index>=c),u=r.find(v=>v.xValue0Index<=n&&v.xValue1Index>=c),d=e.zeroData,p=t.zeroData;if(h==null&&u!=null){addSpan(t,i,r,u,d,a,l);return}else if(h!=null&&u==null){removeSpan(e,i,o,h,p,a,l);return}else if(h==null||u==null)return;let g;h.xValue0Index===u.xValue0Index&&h.xValue1Index===u.xValue1Index?g=0:h.xValue0Index<=u.xValue0Index&&h.xValue1Index>=u.xValue1Index?g=-1:h.xValue0Index>=u.xValue0Index&&h.xValue1Index<=u.xValue1Index?g=1:g=0;const m=e.data[h.datumIndex],y=clipSpan(m.span,n,h),f=t.data[u.datumIndex],x=clipSpan(f.span,n,u);if(g===1){const v=alignSpanToContainingSpan(y,s,e,t,u);v!=null?(l.removed.push({from:y,to:v}),l.moved.push({from:v,to:x}),l.added.push({from:x,to:x})):removeSpan(e,i,o,h,p,a,l)}else if(g===-1){const v=alignSpanToContainingSpan(x,s,t,e,h);v!=null?(l.removed.push({from:y,to:y}),l.moved.push({from:y,to:v}),l.added.push({from:v,to:x})):addSpan(t,i,r,u,d,a,l)}else l.removed.push({from:y,to:y}),l.moved.push({from:y,to:x}),l.added.push({from:x,to:x})}function phaseAnimation(t,e,i,s){const n={removed:[],moved:[],added:[]},{axisValues:r,oldDataAxisIndices:o,newDataAxisIndices:a}=t,l={xValue0Index:Math.max(o.at(0)?.xValue0Index??-1/0,a.at(0)?.xValue0Index??-1/0),xValue1Index:Math.min(o.at(-1)?.xValue1Index??1/0,a.at(-1)?.xValue1Index??1/0)};for(let c=0;ce!=null):t.domain.every(e=>Number.isFinite(e)||e instanceof Date)&&t.range.every(e=>Number.isFinite(e))}function interpolatePoints(t,e){let i;const s=t.map(n=>n.point);switch(e.type){case"linear":i=linearPoints(s);break;case"smooth":i=smoothPoints(s,e.tension);break;case"step":i=stepPoints(s,e.position);break}return i.map((n,r)=>({span:n,xValue0:t[r].xDatum,yValue0:t[r].yDatum,xValue1:t[r+1].xDatum,yValue1:t[r+1].yDatum}))}function pointsEq(t,e,i=.001){return Math.abs(t.x-e.x)plotInterpolatedLinePathStroke(a,l,e.removed),n=(a,l)=>plotInterpolatedLinePathStroke(a,l,e.moved),r=(a,l)=>plotInterpolatedLinePathStroke(a,l,e.added),o=prepareLinePathPropertyAnimation(t,i);return{status:t,path:{addPhaseFn:r,updatePhaseFn:n,removePhaseFn:s},pathProperties:o}}function prepareLinePathPropertyAnimation(t,e){const i=e==="none"?"updated":t,s={fromFn:n=>{let r;return t==="removed"?r={finish:{visible:!1}}:t==="added"?r={start:{visible:!0}}:r={},{phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[i],...r}},toFn:n=>({phase:NODE_UPDATE_STATE_TO_PHASE_MAPPING[i]})};return e==="fade"?{fromFn:n=>({opacity:t==="added"?0:n.opacity,...s.fromFn(n)}),toFn:n=>({opacity:t==="removed"?0:1,...s.toFn(n)})}:s}function prepareLinePathAnimation(t,e,i){const s=t.scales.x?.type==="category",n=e.scales.x?.type==="category";if(s!==n||!isScaleValid(t.scales.x)||!isScaleValid(e.scales.x)||t.strokeData==null||e.strokeData==null)return;let r="updated";e.visible&&!t.visible?r="removed":!e.visible&&t.visible&&(r="added");const o=pairUpSpans({scales:t.scales,data:t.strokeData.spans},{scales:e.scales,data:e.strokeData.spans},1);if(o==null)return;const a=prepareLinePathStrokeAnimationFns(r,o,"fade"),l=(i?.changed??!0)||!areScalingEqual(t.scales.x,e.scales.x)||!areScalingEqual(t.scales.y,e.scales.y)||r!=="updated";return{status:r,stroke:a,hasMotion:l}}function plotAreaPathFill({path:t},{spans:e,phantomSpans:i}){for(let s=0;splotInterpolatedAreaSeriesFillSpans(l,c,e.removed,i.removed),r=(l,c)=>plotInterpolatedAreaSeriesFillSpans(l,c,e.moved,i.moved),o=(l,c)=>plotInterpolatedAreaSeriesFillSpans(l,c,e.added,i.added),a=prepareLinePathPropertyAnimation(t,s);return{status:t,path:{addPhaseFn:o,updatePhaseFn:r,removePhaseFn:n},pathProperties:a}}function prepareAreaPathAnimation(t,e){const i=t.scales.x?.type==="category",s=e.scales.x?.type==="category";if(i!==s||!isScaleValid(t.scales.x)||!isScaleValid(e.scales.x))return;let n="updated";e.visible&&!t.visible?n="removed":!e.visible&&t.visible&&(n="added");const r=pairUpSpans({scales:t.scales,data:t.fillData.spans},{scales:e.scales,data:e.fillData.spans},0);if(r==null)return;const o=pairUpSpans({scales:t.scales,data:t.fillData.phantomSpans},{scales:e.scales,data:e.fillData.phantomSpans},0);if(o==null)return;const a=pairUpSpans({scales:t.scales,data:t.strokeData.spans,zeroData:t.fillData.phantomSpans},{scales:e.scales,data:e.strokeData.spans,zeroData:e.fillData.phantomSpans},0);if(a==null)return;const l="none",c=prepareAreaFillAnimationFns(n,r,o,l),h=prepareLinePathStrokeAnimationFns(n,a,l);return{status:n,fill:c,stroke:h}}function markerFadeInAnimation({id:t},e,i,...s){const n={phase:i?NODE_UPDATE_STATE_TO_PHASE_MAPPING[i]:"trailing"};staticFromToMotion(t,"markers",e,s,{opacity:0},{opacity:1},n),s.forEach(r=>r.cleanup())}function markerScaleInAnimation({id:t},e,...i){staticFromToMotion(t,"markers",e,i,{scalingX:0,scalingY:0},{scalingX:1,scalingY:1},{phase:"initial"}),i.forEach(s=>s.cleanup())}function markerSwipeScaleInAnimation({id:t,nodeDataDependencies:e},i,...s){const n=e.seriesRectWidth;fromToMotion(t,"markers",i,s,{fromFn:(a,l)=>{const c=l.midPoint?.x??n;let h=clamp(0,inverseEaseOut(c/n),1);return isNaN(h)&&(h=0),{scalingX:0,scalingY:0,delay:h,duration:QUICK_TRANSITION,phase:"initial"}},toFn:()=>({scalingX:1,scalingY:1})})}function resetMarkerFn(t){return{opacity:1,scalingX:1,scalingY:1}}function resetMarkerPositionFn(t,e){return{translationX:e.point?.x??NaN,translationY:e.point?.y??NaN}}function computeMarkerFocusBounds(t,{datumIndex:e}){const i=t.getNodeData();if(i===void 0)return;const s=i[e],{point:n}=s;if(s==null||n==null)return;const r=4+(n.focusSize??t.getFormattedMarkerStyle(s).size),o=r/2,a=s.point.x-o,l=s.point.y-o;return Transformable.toCanvas(t.contentGroup,new BBox(a,l,r,r))}function pathSwipeInAnimation({id:t,visible:e,nodeDataDependencies:i},s,...n){const{seriesRectWidth:r,seriesRectHeight:o}=i;staticFromToMotion(t,"path_properties",s,n,{clipX:0},{clipX:r},{phase:"initial",start:{clip:!0,clipY:o,visible:e},finish:{clip:!1,visible:e}})}function pathFadeInAnimation({id:t},e,i,s="add",...n){staticFromToMotion(t,e,i,n,{opacity:0},{opacity:1},{phase:s})}function buildResetPathFn(t){return e=>({visible:t.getVisible(),opacity:t.getOpacity(),clipScalingX:1,clip:!1})}function updateClipPath({nodeDataDependencies:t},e){const i=s=>isFinite(s)?s:0;e.clipX=i(t.seriesRectWidth),e.clipY=i(t.seriesRectHeight)}var CROSS_FILTER_AREA_FILL_OPACITY_FACTOR=.125,CROSS_FILTER_AREA_STROKE_OPACITY_FACTOR=.25,AreaSeries=class extends CartesianSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,pathsPerSeries:["fill","stroke"],pathsZIndexSubOrderOffset:[0,1e3],hasMarkers:!0,markerSelectionGarbageCollection:!1,pickModes:[2,0],animationResetFns:{path:buildResetPathFn({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:resetLabelFn,marker:(e,i)=>({...resetMarkerFn(e),...resetMarkerPositionFn(e,i)})}}),this.properties=new AreaSeriesProperties,this.connectsToYAxis=!0,this.backgroundGroup=new Group({name:`${this.id}-background`,zIndex:0}),this._isStacked=void 0}get pickModeAxis(){return"main"}renderToOffscreenCanvas(){return super.renderToOffscreenCanvas()||this.contextNodeData!=null&&(this.contextNodeData.fillData.spans.length>RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD||this.contextNodeData.strokeData.spans.length>RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD)}attachSeries(t,e,i){super.attachSeries(t,e,i),t.appendChild(this.backgroundGroup)}detachSeries(t,e,i){super.detachSeries(t,e,i),t?.removeChild(this.backgroundGroup)}attachPaths([t,e]){this.backgroundGroup.appendChild(t),this.contentGroup.appendChild(e),e.zIndex=-1}detachPaths([t,e]){this.backgroundGroup.removeChild(t),this.contentGroup.removeChild(e)}isStacked(){return(this.seriesGrouping?.stackCount??1)>1}setSeriesIndex(t){const e=this.isStacked();return!super.setSeriesIndex(t)&&this._isStacked===e?!1:(this._isStacked=e,e?(this.backgroundGroup.zIndex=[0,t],this.contentGroup.zIndex=[1,t,0]):(this.backgroundGroup.zIndex=[1,t,0,0],this.contentGroup.zIndex=[1,t,0,1]),!0)}async processData(t){if(this.data==null||!this.properties.isValid())return;const{data:e,visible:i,seriesGrouping:{groupIndex:s=this.id,stackCount:n=1}={}}=this,{xKey:r,yKey:o,yFilterKey:a,connectMissingData:l,normalizedTo:c}=this.properties,h=!this.ctx.animationManager.isSkipped(),u=this.axes.x?.scale,d=this.axes.y?.scale,{xScaleType:p,yScaleType:g}=this.getScaleInformation({xScale:u,yScale:d}),m={value:`area-stack-${s}-yValue`,values:`area-stack-${s}-yValues`,stack:`area-stack-${s}-yValue-stack`,marker:`area-stack-${s}-yValues-marker`},y=[];isDefined(c)&&y.push(normaliseGroupTo(Object.values(m),c)),h&&y.push(animationValidation());const f={invalidValue:null};(isDefined(c)||l)&&n>1&&(f.invalidValue=0),i||(f.forceValue=0),await this.requestDataModel(t,e,{props:[keyProperty(r,p,{id:"xValue"}),valueProperty(o,g,{id:"yValueRaw",...f}),...a!=null?[valueProperty(a,g,{id:"yFilterRaw"})]:[],...groupStackValueProperty(o,g,{id:"yValueStack",...f,groupId:m.stack}),valueProperty(o,g,{id:"yValue",...f,groupId:m.value}),...groupAccumulativeValueProperty(o,"window","current",{id:"yValueEnd",...f,groupId:m.values},g),...groupAccumulativeValueProperty(o,"normal","current",{id:"yValueCumulative",...f,groupId:m.marker},g),...y],groupByKeys:!0,groupByData:!1}),this.animationState.transition("updateData")}xCoordinateRange(t,e){const{marker:i}=this.properties,s=this.axes.x.scale.convert(t),n=i.enabled?.5*i.size*e:0;return[s-n,s+n]}yCoordinateRange(t,e){const{marker:i}=this.properties,s=this.axes.y.scale.convert(t[0]),n=i.enabled?.5*i.size*e:0;return[s-n,s+n]}getSeriesDomain(t){const{processedData:e,dataModel:i,axes:s}=this;if(!e||!i)return[];const n=s.y;if(t==="x"){const o=i.resolveProcessedDataDefById(this,"xValue"),a=i.getDomain(this,"xValue","key",e);return o?.def.type==="key"&&o.def.valueType==="category"?a:fixNumericExtent(extent(a))}const r=this.domainForClippedRange("y",["yValueEnd"],"xValue",!0);if(n instanceof LogAxis||n instanceof TimeAxis)return fixNumericExtent(r);{const o=Number.isFinite(r[1]-r[0])?[r[0]>0?0:r[0],r[1]<0?0:r[1]]:[];return fixNumericExtent(o)}}getSeriesRange(t,e){const[i,s]=this.domainForVisibleRange("y",["yValueEnd"],"xValue",e,!0);return[Math.min(i,0),Math.max(s,0)]}getVisibleItems(t,e,i){return this.countVisibleItems("xValue",["yValueEnd"],t,e,i)}createNodeData(){const{axes:t,data:e,processedData:i,dataModel:s}=this,n=t.x,r=t.y;if(!n||!r||!e||!s||i?.type!=="grouped"||!this.properties.isValid())return;const{yKey:o,xKey:a,yFilterKey:l,marker:c,label:h,fill:u,stroke:d,connectMissingData:p,interpolation:g}=this.properties,{scale:m}=n,{scale:y}=r,{isContinuousY:f}=this.getScaleInformation({xScale:m,yScale:y}),x=(m.bandwidth??0)/2,v=s.resolveKeysById(this,"xValue",i),b=s.resolveColumnById(this,"yValueEnd",i),S=s.resolveColumnById(this,"yValueRaw",i),A=s.resolveColumnById(this,"yValueCumulative",i),D=l!=null?s.resolveColumnById(this,"yFilterRaw",i):void 0,I=s.resolveColumnById(this,"yValueStack",i),L=(j,B,k)=>{let R;return(isDefined(this.properties.normalizedTo)?f&&isContinuous(k):!isNaN(k))&&(R=B),{x:m.convert(j)+x,y:y.convert(R),size:c.size}},N=[],T=[],{visibleSameStackCount:w}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);let O=!1;const{dataSources:Z}=i,F=Z.get(this.id)??[];for(const{datumIndex:j}of s.forEachGroupDatum(this,i)){const B=v[j];if(B==null)return;const k=F[j],R=S[j],z=A[j],X=b[j],Q=Number.isFinite(R),q=L(B,+z,R),J=D!=null?D[j]===R:void 0;if(J===!1&&(O=!0),Q&&c&&T.push({series:this,itemId:o,datum:k,datumIndex:j,midPoint:{x:q.x,y:q.y},cumulativeValue:X,yValue:R,xValue:B,yKey:o,xKey:a,point:q,fill:c.fill??u,stroke:c.stroke??d,strokeWidth:c.strokeWidth??this.getStrokeWidth(this.properties.strokeWidth),selected:J}),Q&&h){const it=this.getLabelText(h,{value:R,datum:k,xKey:a,yKey:o,xName:this.properties.xName,yName:this.properties.yName});N.push({series:this,itemId:o,datum:k,datumIndex:j,x:q.x,y:q.y,labelText:it})}}const U=j=>j.flatMap(B=>Array.isArray(B)?interpolatePoints(B,g):new Array(B.skip).fill(null)),W=(j,B)=>({point:{x:m.convert(j)+x,y:y.convert(B)},xDatum:j,yDatum:B}),H=j=>{const B=[];for(const{datumIndexes:[k,R,z]}of s.forEachGroupDatumTuple(this,i)){const X=v[R],Q=I[R],q=Q[j],J=Number.isFinite(q);if(p&&!J)continue;const it=k!=null?I[k]:void 0,st=z!=null?I[z]:void 0;let nt=0,ot=0;for(let et=0;et<=j;et+=1){const at=Q[et];if(Number.isFinite(at)){const ct=it==null||Number.isFinite(it[et]),At=st==null||Number.isFinite(st[et]);ct&&(nt+=at),At&&(ot+=at)}}const rt=B[B.length-1];if(!p&&(nt!==ot||!J))if(!J&&Array.isArray(rt)&&rt.length===1)B[B.length-1]={skip:1};else{const et=W(X,nt),at=W(X,ot);Array.isArray(rt)?rt.push(et):rt!=null&&(rt.skip+=1),B.push(J?[at]:{skip:0})}else{const et=Math.max(nt,ot),at=W(X,et);Array.isArray(rt)?rt.push(at):rt!=null?(rt.skip+=1,B.push([at])):B.push([at])}}return U(B)},_=this.seriesGrouping?.stackIndex??0,E=()=>{const j=Array.from(s.forEachGroupDatum(this,i),({datumIndex:B})=>{const k=v[B],z=I[B][_];if(!(p&&!Number.isFinite(z)))return W(k,0)}).filter(B=>B!=null);return interpolatePoints(j,g)},P=H(_),G=P.map(()=>null);for(let j=_-1;j>=-1;j-=1){let B;for(let k=0;kj??G[B]),Y=P.filter(j=>j!=null);return{itemId:o,fillData:{itemId:o,spans:V,phantomSpans:G},strokeData:{itemId:o,spans:Y},labelData:N,nodeData:T,scales:this.calculateScaling(),visible:this.visible,stackVisible:w>0,crossFiltering:O}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}updatePathNodes(t){const{opacity:e,visible:i,animationEnabled:s}=t,[n,r]=t.paths,o=this.contextNodeData?.crossFiltering===!0,a=this.getStrokeWidth(this.properties.strokeWidth);r.setProperties({fill:void 0,lineCap:"round",lineJoin:"round",pointerEvents:1,stroke:this.properties.stroke,strokeWidth:a,strokeOpacity:this.properties.strokeOpacity*(o?CROSS_FILTER_AREA_STROKE_OPACITY_FACTOR:1),lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset,opacity:e,visible:i||s});const{fill:l}=this.properties;if(isGradientFill(l)){const c=this.getGradientFillOptions(l,this.properties.defaultColorRange);n.gradientFillOptions=c}n.setProperties({stroke:void 0,lineJoin:"round",pointerEvents:1,fill:this.properties.fill,fillOpacity:this.properties.fillOpacity*(o?CROSS_FILTER_AREA_FILL_OPACITY_FACTOR:1),fillShadow:this.properties.shadow,opacity:e,visible:i||s}),updateClipPath(this,r),updateClipPath(this,n)}updatePaths(t){this.updateAreaPaths(t.paths,t.contextData)}updateAreaPaths(t,e){for(const i of t)i.visible=e.visible;if(e.visible)this.updateFillPath(t,e),this.updateStrokePath(t,e);else for(const i of t)i.path.clear(),i.markDirty()}updateFillPath(t,e){const[i]=t;i.path.clear(),plotAreaPathFill(i,e.fillData),i.markDirty()}updateStrokePath(t,e){const{spans:i}=e.strokeData,[,s]=t;s.path.clear(),plotLinePathStroke(s,i),s.markDirty()}updateMarkerSelection(t){const{nodeData:e,markerSelection:i}=t,s=this.properties.marker.enabled||this.contextNodeData?.crossFiltering===!0;return this.properties.marker.isDirty()&&(i.clear(),i.cleanup()),i.update(s?e:[])}getMarkerItemBaseStyle(t){const{marker:e}=this.properties,i=t?this.properties.highlightStyle.item:void 0;return{fill:i?.fill??e.fill,fillOpacity:i?.fillOpacity??e.fillOpacity,stroke:i?.stroke??e.stroke,strokeWidth:i?.strokeWidth??e.strokeWidth,strokeOpacity:i?.strokeOpacity??e.strokeOpacity}}getMarkerItemStyleOverrides(t,e,i,s,n,r){const{marker:o}=this.properties,{itemStyler:a}=o;if(a==null)return;const{id:l,properties:c}=this,{xKey:h,yKey:u}=c,{xDomain:d,yDomain:p}=this.cachedDatumCallback("domain",()=>({xDomain:this.getSeriesDomain("x"),yDomain:this.getSeriesDomain("y")}));return this.cachedDatumCallback(createDatumId(t,r?"highlight":"node"),()=>a({seriesId:l,...datumStylerProperties(e,h,u,d,p),xValue:i,yValue:s,highlighted:r,...n}))}updateMarkerNodes(t){const{markerSelection:e,isHighlight:i}=t,{xKey:s,yKey:n,marker:r,fill:o,stroke:a,strokeWidth:l,fillOpacity:c,strokeOpacity:h,highlightStyle:u}=this.properties,d=this.getSeriesDomain("x"),p=this.getSeriesDomain("y"),g=mergeDefaults(i&&u.item,r.getStyle(),{fill:o,stroke:a,strokeWidth:l,fillOpacity:c,strokeOpacity:h});e.each((m,y)=>{this.updateMarkerStyle(m,r,{...datumStylerProperties(y,s,n,d,p),highlighted:i},g,{selected:y.selected})}),i||this.properties.marker.markClean()}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t;return i.update(e)}updateLabelNodes(t){const{labelSelection:e}=t,{enabled:i,fontStyle:s,fontWeight:n,fontSize:r,fontFamily:o,color:a}=this.properties.label;e.each((l,c)=>{const{x:h,y:u,labelText:d}=c;d&&i&&this.visible?(l.fontStyle=s,l.fontWeight=n,l.fontSize=r,l.fontFamily=o,l.textAlign="center",l.textBaseline="bottom",l.text=d,l.x=h,l.y=u-10,l.fill=a,l.visible=!0):l.visible=!1})}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,axes:n,properties:r}=this,{xKey:o,xName:a,yKey:l,yName:c,tooltip:h}=r,u=n.x,d=n.y;if(!i||!s||!u||!d)return;const{datumIndex:p}=t,g=s.dataSources.get(this.id)?.[p],m=i.resolveKeysById(this,"xValue",s)[p],y=i.resolveColumnById(this,"yValueRaw",s)[p];if(m==null)return;const f=this.getMarkerItemBaseStyle(!1);return Object.assign(f,this.getMarkerItemStyleOverrides(String(p),g,m,y,f,!1)),h.formatTooltip({heading:u.formatDatum(m),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:d.formatDatum(y)}]},{seriesId:e,datum:g,title:c,xKey:o,xName:a,yKey:l,yName:c,...f,...this.getModuleTooltipParams()})}legendItemSymbol(){const{fill:t,stroke:e,fillOpacity:i,strokeOpacity:s,strokeWidth:n,lineDash:r,marker:o}=this.properties,a=!o.enabled||o.fill===void 0;return{marker:{shape:o.shape,fill:a?t:o.fill,fillOpacity:a?i:o.fillOpacity,stroke:o.stroke??e,strokeOpacity:o.strokeOpacity,strokeWidth:o.strokeWidth,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset,enabled:o.enabled||n<=0},line:{stroke:e,strokeOpacity:s,strokeWidth:n,lineDash:r}}}getLegendData(t){if(!this.properties.isValid()||t!=="category")return[];const{id:e,ctx:{legendManager:i},visible:s}=this,{yKey:n,yName:r,legendItemName:o,showInLegend:a}=this.properties;return[{legendType:t,id:e,itemId:n,seriesId:e,enabled:s&&i.getItemEnabled({seriesId:e,itemId:n}),label:{text:o??r??n},symbol:this.legendItemSymbol(),legendItemName:o,hideInLegend:!a}]}animateEmptyUpdateReady(t){const{markerSelection:e,labelSelection:i,contextData:s,paths:n}=t,{animationManager:r}=this.ctx;this.updateAreaPaths(n,s),pathSwipeInAnimation(this,r,...n),resetMotion([e],resetMarkerPositionFn),markerSwipeScaleInAnimation(this,r,e),seriesLabelFadeInAnimation(this,"labels",r,i)}animateReadyResize(t){const{contextData:e,paths:i}=t;this.updateAreaPaths(i,e),super.animateReadyResize(t)}animateWaitingUpdateReady(t){const{animationManager:e}=this.ctx,{markerSelection:i,labelSelection:s,contextData:n,paths:r,previousContextData:o}=t,[a,l]=r;if(a==null&&l==null)return;this.resetMarkerAnimation(t),this.resetLabelAnimation(t);const c=()=>{this.resetPathAnimation(t),this.updateAreaPaths(r,n)},h=()=>{e.skipCurrentBatch(),c()};if(n==null||o==null){c(),markerFadeInAnimation(this,e,"added",i),pathFadeInAnimation(this,"fill_path_properties",e,"add",a),pathFadeInAnimation(this,"stroke_path_properties",e,"add",l),seriesLabelFadeInAnimation(this,"labels",e,s);return}if(n.crossFiltering!==o.crossFiltering){h();return}const u=prepareAreaPathAnimation(n,o);if(u===void 0){h();return}else if(u.status==="no-op")return;markerFadeInAnimation(this,e,void 0,i),fromToMotion(this.id,"fill_path_properties",e,[a],u.fill.pathProperties),pathMotion(this.id,"fill_path_update",e,[a],u.fill.path),fromToMotion(this.id,"stroke_path_properties",e,[l],u.stroke.pathProperties),pathMotion(this.id,"stroke_path_update",e,[l],u.stroke.path),seriesLabelFadeInAnimation(this,"labels",e,s),this.ctx.animationManager.animate({id:this.id,groupId:"reset_after_animation",phase:"trailing",from:{},to:{},onComplete:()=>this.updateAreaPaths(r,n)})}isLabelEnabled(){return this.properties.label.enabled}nodeFactory(){return new Group}getFormattedMarkerStyle(t){const{xKey:e,yKey:i}=t,s=this.getSeriesDomain("x"),n=this.getSeriesDomain("y");return this.getMarkerStyle(this.properties.marker,{...datumStylerProperties(t,e,i,s,n),highlighted:!0})}computeFocusBounds(t){return computeMarkerFocusBounds(this,t)}};AreaSeries.className="AreaSeries",AreaSeries.type="area";var AreaSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"area",moduleFactory:t=>new AreaSeries(t),stackable:!0,tooltipDefaults:{range:"nearest"},defaultAxes:[{type:"number",position:"left"},{type:"category",position:"bottom"}],themeTemplate:{series:{nodeClickRange:"nearest",tooltip:{position:{type:"node"}},fillOpacity:.8,strokeOpacity:1,strokeWidth:0,lineDash:[0],lineDashOffset:0,shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5},interpolation:{type:"linear",tension:1,position:"end"},marker:{enabled:!1,shape:"circle",size:7,strokeWidth:0},label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}}}},paletteFactory:t=>{const{marker:e}=markerPaletteFactory(t),i=t.themeTemplateParameters.get(DEFAULT_COLOR_RANGE);return{fill:e.fill,stroke:e.stroke,marker:e,defaultColorRange:i}}};function addHitTestersToQuadtree(t,e){for(const i of e){const s=i.datum;s===void 0?logger_exports.error("undefined datum"):t.addValue(i,s)}}function findQuadtreeMatch(t,e){const{x:i,y:s}=e,{nearest:n,distanceSquared:r}=t.getQuadTree().find(i,s);if(n!==void 0)return{datum:n.value,distance:Math.sqrt(r)}}var AbstractBarSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.direction="vertical"}};__decorateClass([Validate(DIRECTION)],AbstractBarSeriesProperties.prototype,"direction",2);var AbstractBarSeries=class extends CartesianSeries{constructor(){super(...arguments),this.groupScale=new CategoryScale,this.smallestDataInterval=void 0,this.largestDataInterval=void 0}padBandExtent(t,e){const i=typeof e=="boolean"?1:.5,s=isFiniteNumber(this.smallestDataInterval)?this.smallestDataInterval*i:0,n=extent(t)??[NaN,NaN];return typeof e=="boolean"?n[e?0:1]-=(e?1:-1)*s:(n[0]-=s,n[1]+=s),fixNumericExtent(n)}getBandScalePadding(){return{inner:.3,outer:.15}}shouldFlipXY(){return!this.isVertical()}isVertical(){return this.properties.direction==="vertical"}getBarDirection(){return this.shouldFlipXY()?"x":"y"}getCategoryDirection(){return this.shouldFlipXY()?"y":"x"}getValueAxis(){const t=this.getBarDirection();return this.axes[t]}getCategoryAxis(){const t=this.getCategoryDirection();return this.axes[t]}getBandwidth(t){return ContinuousScale.is(t.scale)?t.scale.calcBandwidth(this.smallestDataInterval):t.scale.bandwidth}xCoordinateRange(t){const e=this.axes[this.getCategoryDirection()],i=e.scale,s=this.getBandwidth(e)??0,n=ContinuousScale.is(i)?s*-.5:0,r=i.convert(t)+n;return[r,r+s]}yCoordinateRange(t){const i=this.axes[this.getBarDirection()].scale,s=t.map(n=>i.convert(n));if(s.length===1){const n=i.convert(0);return[Math.min(s[0],n),Math.max(s[0],n)]}return[Math.min(...s),Math.max(...s)]}updateGroupScale(t){const e=[],{groupScale:i}=this,s=this.getBandwidth(t),{index:n,visibleGroupCount:r}=this.ctx.seriesStateManager.getVisiblePeerGroupIndex(this);for(let a=0;a=1?i.bandwidth:i.rawBandwidth,groupIndex:n}}resolveKeyDirection(t){return this.getBarDirection()==="x"?t==="x"?"y":"x":t}initQuadTree(t){addHitTestersToQuadtree(t,this.datumNodesIter())}pickNodeClosestDatum(t){return findQuadtreeMatch(this,t)}},BarSeriesLabel=class extends Label{constructor(){super(...arguments),this.placement="inside-center",this.padding=0}};__decorateClass([Validate(UNION(["inside-center","inside-start","inside-end","outside-start","outside-end"],"a placement"))],BarSeriesLabel.prototype,"placement",2),__decorateClass([Validate(NUMBER)],BarSeriesLabel.prototype,"padding",2);var BarSeriesProperties=class extends AbstractBarSeriesProperties{constructor(){super(...arguments),this.fill="#c16068",this.fillOpacity=1,this.stroke="#874349",this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.crisp=void 0,this.shadow=new DropShadow,this.label=new BarSeriesLabel,this.tooltip=new SeriesTooltip,this.sparklineMode=!1,this.fastDataProcessing=!1}};__decorateClass([Validate(STRING)],BarSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING,{optional:!0})],BarSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING)],BarSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING,{optional:!0})],BarSeriesProperties.prototype,"yName",2),__decorateClass([Validate(STRING,{optional:!0})],BarSeriesProperties.prototype,"yFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],BarSeriesProperties.prototype,"stackGroup",2),__decorateClass([Validate(NUMBER,{optional:!0})],BarSeriesProperties.prototype,"normalizedTo",2),__decorateClass([Validate(COLOR_STRING)],BarSeriesProperties.prototype,"fill",2),__decorateClass([Validate(RATIO)],BarSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING)],BarSeriesProperties.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER)],BarSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO)],BarSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],BarSeriesProperties.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],BarSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Validate(POSITIVE_NUMBER)],BarSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Validate(BOOLEAN,{optional:!0})],BarSeriesProperties.prototype,"crisp",2),__decorateClass([Validate(FUNCTION,{optional:!0})],BarSeriesProperties.prototype,"itemStyler",2),__decorateClass([Validate(OBJECT,{optional:!0})],BarSeriesProperties.prototype,"shadow",2),__decorateClass([Validate(OBJECT)],BarSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],BarSeriesProperties.prototype,"tooltip",2),__decorateClass([Validate(BOOLEAN)],BarSeriesProperties.prototype,"sparklineMode",2),__decorateClass([Validate(BOOLEAN)],BarSeriesProperties.prototype,"fastDataProcessing",2);function checkCrisp(t,e,i,s){if(e!=null){const[n,r]=e;if(n!==0||r!==1)return!1}if(ContinuousScale.is(t)){const n=t.calcBandwidth(s)-t.calcBandwidth(i);if(n>0&&n<1)return!1}return!0}var isDatumNegative=t=>isNegative(t.yValue??0);function collapsedStartingBarPosition(t,e,i){const{startingX:s,startingY:n}=getStartingValues(t,e);return{isVertical:t,calculate:(o,a)=>{let l=t?o.x:s,c=t?n:o.y,h=t?o.width:0,u=t?0:o.height;const{opacity:d=1}=o;a&&(isNaN(l)||isNaN(c))&&({x:l,y:c}=a,h=t?a.width:0,u=t?0:a.height,t&&!isDatumNegative(a)?c+=a.height:!t&&isDatumNegative(a)&&(l+=a.width));let p;return o.clipBBox==null?p=void 0:isDatumNegative(o)?p=t?new BBox(l,c-u,h,u):new BBox(l-h,c,h,u):p=new BBox(l,c,h,u),{x:l,y:c,width:h,height:u,clipBBox:p,opacity:d}},mode:i}}function midpointStartingBarPosition(t,e){return{isVertical:t,calculate:i=>({x:t?i.x:i.x+i.width/2,y:t?i.y+i.height/2:i.y,width:t?i.width:0,height:t?0:i.height,clipBBox:i.clipBBox,opacity:i.opacity??1}),mode:e}}function prepareBarAnimationFunctions(t){const e=r=>r==null||isNaN(r.x)||isNaN(r.y);return{toFn:(r,o,a)=>a==="removed"&&r.datum==null&&t.mode==="fade"?{...resetBarSelectionsFn(r,o),opacity:0}:a==="removed"||e(o)?t.calculate(o,r.previousDatum):{x:o.x,y:o.y,width:o.width,height:o.height,clipBBox:o.clipBBox,opacity:o.opacity??1},fromFn:(r,o,a)=>{a==="updated"&&e(o)?a="removed":a==="updated"&&e(r.previousDatum)&&(a="added");let l;a==="added"&&r.previousDatum==null&&t.mode==="fade"?l={...resetBarSelectionsFn(r,o),opacity:0}:a==="unknown"||a==="added"?l=t.calculate(o,r.previousDatum):l={x:r.x,y:r.y,width:r.width,height:r.height,clipBBox:r.clipBBox,opacity:r.opacity??1};const c=NODE_UPDATE_STATE_TO_PHASE_MAPPING[a];return{...l,phase:c}},applyFn:(r,o,a)=>{r.setProperties(o),r.crisp=a==="end"&&(r.datum?.crisp??!1)}}}function getStartingValues(t,e){const i=e[t?"y":"x"];let s=1/0,n=0;return i?(t?n=i.scale.convert(ContinuousScale.is(i.scale)?0:Math.max(...i.range)):s=i.scale.convert(ContinuousScale.is(i.scale)?0:Math.min(...i.range)),{startingX:s,startingY:n}):{startingX:s,startingY:n}}function resetBarSelectionsFn(t,{x:e,y:i,width:s,height:n,clipBBox:r,opacity:o=1}){return{x:e,y:i,width:s,height:n,clipBBox:r,opacity:o,crisp:t.datum?.crisp??!1}}function computeBarFocusBounds(t,e){if(e===void 0)return;const{x:i,y:s,width:n,height:r}=e;return Transformable.toCanvas(t.contentGroup,new BBox(i,s,n,r))}function updateLabelNode(t,e,i){if(e.enabled&&i){const{x:s,y:n,text:r,textAlign:o,textBaseline:a}=i,{color:l,fontStyle:c,fontWeight:h,fontSize:u,fontFamily:d}=e;t.setProperties({visible:!0,x:s,y:n,text:r,fill:l,fontStyle:c,fontWeight:h,fontSize:u,fontFamily:d,textAlign:o,textBaseline:a})}else t.visible=!1}var placements={"inside-start":{inside:!0,direction:-1,textAlignment:1},"inside-end":{inside:!0,direction:1,textAlignment:-1},"outside-start":{inside:!1,direction:-1,textAlignment:-1},"outside-end":{inside:!1,direction:1,textAlignment:1}};function adjustLabelPlacement({isUpward:t,isVertical:e,placement:i,padding:s=0,rect:n}){let r=n.x+n.width/2,o=n.y+n.height/2,a="center",l="middle";if(i!=="inside-center"){const c=(t?1:-1)*(e?-1:1),{direction:h,textAlignment:u}=placements[i],d=(h+1)*.5;if(e){const p=t?n.y+n.height:n.y,g=n.height*c;o=p+g*d+s*u*c,l=u===c?"top":"bottom"}else{const p=t?n.x:n.x+n.width,g=n.width*c;r=p+g*d+s*u*c,a=u===c?"left":"right"}}return{x:r,y:o,textAlign:a,textBaseline:l}}var X_MIN=0,X_MAX=1,Y_MIN=2,Y_MAX=3,SPAN2=4,BarSeries=class extends AbstractBarSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,pickModes:[2,1,0],pathsPerSeries:[],hasHighlightedLabels:!0,datumSelectionGarbageCollection:!1,animationAlwaysUpdateSelections:!0,animationResetFns:{datum:resetBarSelectionsFn,label:resetLabelFn}}),this.properties=new BarSeriesProperties,this.connectsToYAxis=!0,this.dataAggregationFilters=void 0}get pickModeAxis(){return this.properties.sparklineMode?"main":void 0}crossFilteringEnabled(){return this.properties.yFilterKey!=null&&(this.seriesGrouping==null||this.seriesGrouping.stackIndex===0)}async processData(t){if(!this.properties.isValid()||!this.data)return;const{xKey:e,yKey:i,yFilterKey:s,normalizedTo:n,fastDataProcessing:r}=this.properties,{seriesGrouping:{groupIndex:o=this.id}={},data:a}=this,l=this.seriesGrouping?.groupCount??0,h=(this.seriesGrouping?.stackCount??0)>=1||n!=null,u=!r||l>1||h,d=!this.ctx.animationManager.isSkipped(),p=this.getCategoryAxis()?.scale,g=this.getValueAxis()?.scale,{isContinuousX:m,xScaleType:y,yScaleType:f}=this.getScaleInformation({xScale:p,yScale:g}),x=`bar-stack-${o}-yValues`,v=`${x}-trailing`,b=this.visible?{}:{forceValue:0},S=[keyProperty(e,y,{id:"xValue"}),valueProperty(i,f,{id:"yValue-raw",invalidValue:null,...b})];this.crossFilteringEnabled()&&S.push(valueProperty(s,f,{id:"yFilterValue",invalidValue:null,...b})),h&&S.push(...groupAccumulativeValueProperty(i,"normal","current",{id:"yValue-end",rangeId:"yValue-range",invalidValue:null,missingValue:0,groupId:x,separateNegative:!0,...b},f),...groupAccumulativeValueProperty(i,"trailing","current",{id:"yValue-start",invalidValue:null,missingValue:0,groupId:v,separateNegative:!0,...b},f)),m&&S.push(SMALLEST_KEY_INTERVAL,LARGEST_KEY_INTERVAL),isFiniteNumber(n)&&S.push(normaliseGroupTo([x,v],Math.abs(n))),d&&this.processedData&&S.push(diff(this.id,this.processedData)),(d||!u)&&S.push(animationValidation());const{dataModel:A,processedData:D}=await this.requestDataModel(t,a,{props:S,groupByKeys:u,groupByData:!u});this.dataAggregationFilters=this.aggregateData(A,D),this.smallestDataInterval=D.reduced?.smallestKeyInterval,this.largestDataInterval=D.reduced?.largestKeyInterval,this.animationState.transition("updateData")}getSeriesDomain(t){const{processedData:e,dataModel:i}=this;if(i==null||e==null)return[];if(t===this.getCategoryDirection()){const o=i.resolveProcessedDataDefById(this,"xValue"),a=i.getDomain(this,"xValue","key",e);return o?.def.type==="key"&&o.def.valueType==="category"?a:this.padBandExtent(a)}const s=this.dataModel?.hasColumnById(this,"yValue-end")?"yValue-end":"yValue-raw";let n=this.domainForClippedRange("y",[s],"xValue",!0);const r=this.crossFilteringEnabled()?i.getDomain(this,"yFilterValue","value",e):void 0;if(r!=null&&(n=[Math.min(n[0],r[0]),Math.max(n[1],r[1])]),this.getValueAxis()instanceof LogAxis)return fixNumericExtent(n);{const o=Number.isFinite(n[1]-n[0])?[Math.min(0,n[0]),Math.max(0,n[1])]:[];return fixNumericExtent(o)}}getSeriesRange(t,e){const i=this.dataModel?.hasColumnById(this,"yValue-end")?"yValue-end":"yValue-raw",[s,n]=this.domainForVisibleRange("y",[i],"xValue",e,!0);return[Math.min(s,0),Math.max(n,0)]}getVisibleItems(t,e,i){const s=this.dataModel?.hasColumnById(this,"yValue-end")?"yValue-end":"yValue-raw";return this.countVisibleItems("xValue",[s],t,e,i)}aggregateData(t,e){}createNodeData(){const{dataModel:t,processedData:e,groupScale:i,dataAggregationFilters:s}=this,n=this.getCategoryAxis(),r=this.getValueAxis();if(!t||!e||!n||!r||!this.properties.isValid())return;const o=e.dataSources?.get(this.id);if(o==null)return;const a=n.scale,l=r.scale,{xKey:c,yKey:h,xName:u,yName:d,legendItemName:p,label:g}=this.properties,m=r.isReversed(),{barWidth:y,groupIndex:f}=this.updateGroupScale(n),x=i.convert(String(f)),v=ContinuousScale.is(a)?y*-.5:0,b=t.resolveKeysById(this,"xValue",e),S=t.resolveColumnById(this,"yValue-raw",e),A=this.crossFilteringEnabled()?t.resolveColumnById(this,"yFilterValue",e):void 0,D=!this.ctx.animationManager.isSkipped(),I=E=>a.convert(b[E])+x+v,L=this.properties.crisp??checkCrisp(n?.scale,n?.visibleRange,this.smallestDataInterval,this.largestDataInterval),N=l.convert(0),T=({datum:E,datumIndex:P,valueIndex:G,xValue:V,yValue:Y,cumulativeValue:$,phantom:j,currY:B,prevY:k,x:R,width:z,isPositive:X,yRange:Q,labelText:q,opacity:J,crossScale:it=1})=>{const st=X!==m,nt=l.convert(B),ot=l.convert(k),rt=l.convert(Q),et=this.getBarDirection()==="x",at=z*.5*(1-it),ct={x:et?Math.min(nt,ot):R+at,y:et?R+at:Math.min(nt,ot),width:et?Math.abs(ot-nt):z*it,height:et?z*it:Math.abs(ot-nt)},At=new BBox(ct.x,ct.y,ct.width,ct.height),Mt={x:et?Math.min(N,rt):R+at,y:et?R+at:Math.min(N,rt),width:et?Math.abs(N-rt):z*it,height:et?z*it:Math.abs(N-rt)},wt=this.shouldFlipXY()?ct.height:ct.width;return{series:this,itemId:j?createDatumId(h,j):h,datum:E,datumIndex:P,valueIndex:G,cumulativeValue:$,phantom:j,xValue:V,yValue:Y,yKey:h,xKey:c,capDefaults:{lengthRatioMultiplier:wt,lengthMax:wt},x:Mt.x,y:Mt.y,width:Mt.width,height:Mt.height,midPoint:{x:ct.x+ct.width/2,y:ct.y+ct.height/2},opacity:J,topLeftCornerRadius:et!==st,topRightCornerRadius:st,bottomRightCornerRadius:et===st,bottomLeftCornerRadius:!st,clipBBox:At,crisp:L,label:q!=null?{text:q,...adjustLabelPlacement({isUpward:st,isVertical:!et,placement:g.placement,padding:g.padding,rect:ct})}:void 0,missing:Y==null,focusable:!j}},w=[],O=[],Z=[],F=(E,P,G,V,Y,$,j,B)=>{const k=b[E];if(k==null)return;const R=S[E],z=A!=null?Number(A[E]):void 0,X=R>=0&&!Object.is(R,-0);if(!Number.isFinite($)||z!=null&&!Number.isFinite(z))return;const Q=R!=null?this.getLabelText(this.properties.label,{datum:o[E],value:z??R,xKey:c,yKey:h,xName:u,yName:d,legendItemName:p}):void 0,q=z!=null&&z>R,J=T({datum:o[E],datumIndex:E,valueIndex:P,xValue:k,yValue:z??R,cumulativeValue:z??$,phantom:!1,currY:z!=null?Y+z:$,prevY:Y,x:G,width:V,isPositive:X,yRange:Math.max(Y+(z??-1/0),j),labelText:Q,opacity:B,crossScale:q?.6:void 0});if(O.push(J),Z.push(J),z!=null){const it=T({datum:o[E],datumIndex:E,valueIndex:P,xValue:k,yValue:z,cumulativeValue:z,phantom:!0,currY:$,prevY:Y,x:G,width:V,isPositive:X,yRange:j,labelText:void 0,opacity:B,crossScale:void 0});w.push(it)}},[U,W]=a.range,H=W-U,_=s?.find(E=>E.maxRange>H);if(e.type==="grouped"){const E=y,P=t.hasColumnById(this,"yValue-start"),G=P?t.resolveColumnById(this,"yValue-start",e):void 0,V=P?t.resolveColumnById(this,"yValue-end",e):void 0,Y=P?t.resolveProcessedDataIndexById(this,"yValue-range"):-1;for(const{datumIndex:$,valueIndex:j,group:{aggregation:B}}of t.forEachGroupDatum(this,e)){const k=I($),R=S[$],z=R>=0&&!Object.is(R,-0),X=P?Number(G?.[$]):0,Q=P?Number(V?.[$]):R;let q=Q;P&&(q=B[Y][z?1:0]),F($,j,k,E,X,Q,q,1)}}else if(_==null){const E=y;let[P,G]=this.visibleRange("xValue",n.range);e.input.count<1e3&&(P=0,G=e.input.count);for(let V=P;V0){const J=q>=0?q/Q:1;F(R,0,z,X,0,Q,Q,J)}if(q<0){const J=Q<=0?Q/q:1;F(k,1,z,X,0,q,q,J)}}}return{itemId:h,nodeData:w.length>0?[...w,...O]:O,labelData:Z,scales:this.calculateScaling(),visible:this.visible||D,groupScale:this.getScaling(this.groupScale)}}nodeFactory(){return new Rect}getHighlightData(t,e){const i=t.find(s=>s.datum===e.datum&&!s.phantom);return i!=null?[i]:void 0}updateDatumSelection(t){return t.datumSelection.update(t.nodeData,void 0,e=>this.getDatumId(e))}getItemBaseStyle(t){const{properties:e}=this,{cornerRadius:i}=e,s=t?e.highlightStyle.item:void 0;return{fill:s?.fill??e.fill,fillOpacity:s?.fillOpacity??e.fillOpacity,stroke:s?.stroke??e.stroke,strokeWidth:s?.strokeWidth??this.getStrokeWidth(e.strokeWidth),strokeOpacity:s?.strokeOpacity??e.strokeOpacity,lineDash:s?.lineDash??e.lineDash??[],lineDashOffset:s?.lineDashOffset??e.lineDashOffset,cornerRadius:i}}getItemStyleOverrides(t,e,i,s,n,r){const{id:o,properties:a}=this,{xKey:l,yKey:c,itemStyler:h}=a;if(h==null)return;const{xDomain:u,yDomain:d}=this.cachedDatumCallback("domain",()=>({xDomain:this.getSeriesDomain("x"),yDomain:this.getSeriesDomain("y")}));return this.cachedDatumCallback(createDatumId(t,r?"highlight":"node"),()=>h({seriesId:o,...datumStylerProperties(e,l,c,u,d),xValue:i,yValue:s,highlighted:r,...n}))}updateDatumNodes(t){if(!this.properties.isValid())return;const{shadow:e}=this.properties,i=this.getCategoryDirection()==="x",s=this.getItemBaseStyle(t.isHighlight);t.datumSelection.each((n,r)=>{const o=this.getItemStyleOverrides(String(r.datumIndex),r.datum,r.xValue,r.yValue,s,t.isHighlight);n.opacity=r.opacity??0,applyShapeStyle(n,s,o);const a=o?.cornerRadius??s.cornerRadius;n.topLeftCornerRadius=r.topLeftCornerRadius?a:0,n.topRightCornerRadius=r.topRightCornerRadius?a:0,n.bottomRightCornerRadius=r.bottomRightCornerRadius?a:0,n.bottomLeftCornerRadius=r.bottomLeftCornerRadius?a:0,n.visible=i?(r.clipBBox?.width??r.width)>0:(r.clipBBox?.height??r.height)>0,n.crisp=r.crisp,n.fillShadow=e})}updateLabelSelection(t){const e=this.isLabelEnabled()?t.labelData:[];return t.labelSelection.update(e,i=>{i.pointerEvents=1})}updateLabelNodes(t){t.labelSelection.each((e,i)=>{updateLabelNode(e,this.properties.label,i.label)})}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,properties:n}=this,{xKey:r,xName:o,yKey:a,yName:l,legendItemName:c,stackGroup:h,tooltip:u}=n,d=this.getCategoryAxis(),p=this.getValueAxis();if(!i||!s||!d||!p)return;const{datumIndex:g}=t,m=s.dataSources.get(this.id)?.[g],y=i.resolveKeysById(this,"xValue",s)[g],f=i.resolveColumnById(this,"yValue-raw",s)[g];if(y==null)return;const x=this.getItemBaseStyle(!1);return Object.assign(x,this.getItemStyleOverrides(String(g),m,y,f,x,!1)),u.formatTooltip({heading:d.formatDatum(y),symbol:this.legendItemSymbol(),data:[{label:l,fallbackLabel:a,value:p.formatDatum(f)}]},{seriesId:e,datum:m,title:l,xKey:r,xName:o,yKey:a,yName:l,legendItemName:c,stackGroup:h,...x,...this.getModuleTooltipParams()})}legendItemSymbol(){const{fill:t,stroke:e,strokeWidth:i,fillOpacity:s,strokeOpacity:n,lineDash:r,lineDashOffset:o}=this.properties;return{marker:{fill:t,fillOpacity:s,stroke:e,strokeWidth:i,strokeOpacity:n,lineDash:r,lineDashOffset:o}}}getLegendData(t){const{showInLegend:e}=this.properties;if(t!=="category"||!this.properties.isValid())return[];const{id:i,ctx:{legendManager:s},visible:n}=this,{yKey:r,yName:o,legendItemName:a}=this.properties;return[{legendType:"category",id:i,itemId:r,seriesId:i,enabled:n&&s.getItemEnabled({seriesId:i,itemId:r}),label:{text:a??o??r},symbol:this.legendItemSymbol(),legendItemName:a,hideInLegend:!e}]}animateEmptyUpdateReady({datumSelection:t,labelSelection:e,annotationSelections:i}){const s=prepareBarAnimationFunctions(collapsedStartingBarPosition(this.isVertical(),this.axes,"normal"));fromToMotion(this.id,"nodes",this.ctx.animationManager,[t],s),seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,e),seriesLabelFadeInAnimation(this,"annotations",this.ctx.animationManager,...i)}animateWaitingUpdateReady(t){const{datumSelection:e,labelSelection:i,annotationSelections:s,previousContextData:n}=t;this.ctx.animationManager.stopByAnimationGroupId(this.id);let r=this.processedData?.reduced?.diff?.[this.id];r==null&&this.processedData?.reduced?.diff!=null&&(r={changed:!0,added:new Set(Array.from(e,({datum:h})=>this.getDatumId(h))),updated:new Set,removed:new Set,moved:new Set});const o=n==null?"fade":"normal",a=prepareBarAnimationFunctions(collapsedStartingBarPosition(this.isVertical(),this.axes,o));fromToMotion(this.id,"nodes",this.ctx.animationManager,[e],a,(h,u)=>this.getDatumId(u),r);const l=n!=null&&(!areScalingEqual(t.contextData.scales.x,n.scales.x)||!areScalingEqual(t.contextData.scales.y,n.scales.y)||!areScalingEqual(t.contextData.groupScale,t.previousContextData.groupScale));((r?.changed??!1)||l)&&(seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,i),seriesLabelFadeInAnimation(this,"annotations",this.ctx.animationManager,...s))}getDatumId(t){return createDatumId(t.xValue,t.valueIndex,t.phantom)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:t}){const e=this.contextNodeData?.nodeData[t].clipBBox;return computeBarFocusBounds(this,e)}};BarSeries.className="BarSeries",BarSeries.type="bar";var BarSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"bar",moduleFactory:t=>new BarSeries(t),stackable:!0,groupable:!0,tooltipDefaults:{range:"exact"},defaultAxes:swapAxisCondition([{type:"number",position:"left"},{type:"category",position:"bottom"}],t=>t?.direction==="horizontal"),themeTemplate:{series:{direction:"vertical",fillOpacity:1,strokeWidth:0,lineDash:[0],lineDashOffset:0,label:{enabled:!1,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$if:[{$or:[{$eq:[{$path:"./placement"},"outside-start"]},{$eq:[{$path:"./placement"},"outside-end"]}]},{$ref:"textColor"},{$ref:"backgroundColor"}]},placement:"inside-center"},shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5},errorBar:{cap:{lengthRatio:.3}}}},paletteFactory:singleSeriesPaletteFactory},BubbleSeriesMarker=class extends SeriesMarker{constructor(){super(...arguments),this.maxSize=30}};__decorateClass([Validate(POSITIVE_NUMBER),SceneChangeDetection()],BubbleSeriesMarker.prototype,"maxSize",2),__decorateClass([Validate(NUMBER_ARRAY,{optional:!0}),SceneChangeDetection()],BubbleSeriesMarker.prototype,"domain",2);var BubbleSeriesLabel=class extends Label{constructor(){super(...arguments),this.placement="top"}};__decorateClass([Validate(LABEL_PLACEMENT)],BubbleSeriesLabel.prototype,"placement",2);var BubbleSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.colorRange=["#ffff00","#00ff00","#0000ff"],this.label=new BubbleSeriesLabel,this.tooltip=new SeriesTooltip,this.marker=new BubbleSeriesMarker}};__decorateClass([Validate(STRING)],BubbleSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING)],BubbleSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING)],BubbleSeriesProperties.prototype,"sizeKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"labelKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"colorKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"xFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"yFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"sizeFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"yName",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"sizeName",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"labelName",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"colorName",2),__decorateClass([Validate(NUMBER_ARRAY,{optional:!0})],BubbleSeriesProperties.prototype,"colorDomain",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],BubbleSeriesProperties.prototype,"colorRange",2),__decorateClass([Validate(STRING,{optional:!0})],BubbleSeriesProperties.prototype,"title",2),__decorateClass([ProxyProperty("marker.shape")],BubbleSeriesProperties.prototype,"shape",2),__decorateClass([ProxyProperty("marker.size")],BubbleSeriesProperties.prototype,"size",2),__decorateClass([ProxyProperty("marker.maxSize")],BubbleSeriesProperties.prototype,"maxSize",2),__decorateClass([ProxyProperty("marker.domain",{optional:!0})],BubbleSeriesProperties.prototype,"domain",2),__decorateClass([ProxyProperty("marker.fill",{optional:!0})],BubbleSeriesProperties.prototype,"fill",2),__decorateClass([ProxyProperty("marker.fillOpacity")],BubbleSeriesProperties.prototype,"fillOpacity",2),__decorateClass([ProxyProperty("marker.stroke",{optional:!0})],BubbleSeriesProperties.prototype,"stroke",2),__decorateClass([ProxyProperty("marker.strokeWidth")],BubbleSeriesProperties.prototype,"strokeWidth",2),__decorateClass([ProxyProperty("marker.strokeOpacity")],BubbleSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([ProxyProperty("marker.lineDash")],BubbleSeriesProperties.prototype,"lineDash",2),__decorateClass([ProxyProperty("marker.lineDashOffset")],BubbleSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([ProxyProperty("marker.itemStyler",{optional:!0})],BubbleSeriesProperties.prototype,"itemStyler",2),__decorateClass([Validate(OBJECT)],BubbleSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],BubbleSeriesProperties.prototype,"tooltip",2);var BubbleSeriesNodeEvent=class extends CartesianSeriesNodeEvent{constructor(t,e,i,s){super(t,e,i,s),this.sizeKey=s.properties.sizeKey}},BubbleSeries=class extends CartesianSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,pickModes:[2,1,0],pathsPerSeries:[],hasMarkers:!0,markerSelectionGarbageCollection:!1,animationResetFns:{label:resetLabelFn,marker:resetMarkerFn},usesPlacedLabels:!0}),this.NodeEvent=BubbleSeriesNodeEvent,this.clipFocusBox=!1,this.properties=new BubbleSeriesProperties,this.sizeScale=new LinearScale,this.colorScale=new ColorScale}get pickModeAxis(){return"main-category"}async processData(t){if(!this.properties.isValid()||this.data==null||!this.visible)return;const e=this.axes.x?.scale,i=this.axes.y?.scale,{xScaleType:s,yScaleType:n}=this.getScaleInformation({xScale:e,yScale:i}),r=this.colorScale.type,o=this.sizeScale.type,{xKey:a,yKey:l,sizeKey:c,xFilterKey:h,yFilterKey:u,sizeFilterKey:d,labelKey:p,colorDomain:g,colorRange:m,colorKey:y,marker:f}=this.properties,{dataModel:x,processedData:v}=await this.requestDataModel(t,this.data,{props:[valueProperty(a,s,{id:"xValue"}),valueProperty(l,n,{id:"yValue"}),...h!=null?[valueProperty(h,s,{id:"xFilterValue"})]:[],...u!=null?[valueProperty(u,n,{id:"yFilterValue"})]:[],...d!=null?[valueProperty(d,o,{id:"sizeFilterValue"})]:[],valueProperty(c,o,{id:"sizeValue"}),...y?[valueProperty(y,r,{id:"colorValue"})]:[],...p?[valueProperty(p,"band",{id:"labelValue"})]:[]]}),b=x.resolveProcessedDataIndexById(this,"sizeValue"),S=v.domain.values[b]??[];if(this.sizeScale.domain=f.domain?f.domain:S,y){const A=x.resolveProcessedDataIndexById(this,"colorValue");this.colorScale.domain=g??v.domain.values[A]??[],this.colorScale.range=m,this.colorScale.update()}this.animationState.transition("updateData")}xCoordinateRange(t,e,i){const{properties:s,sizeScale:n}=this,{size:r,sizeKey:o}=s,a=this.axes.x.scale.convert(t),l=o!=null?this.dataModel.resolveColumnById(this,"sizeValue",this.processedData):void 0,h=.5*(l!=null?n.convert(l[i]):r)*e;return[a-h,a+h]}yCoordinateRange(t,e,i){const{properties:s,sizeScale:n}=this,{size:r,sizeKey:o}=s,a=this.axes.y.scale.convert(t[0]),l=o!=null?this.dataModel.resolveColumnById(this,"sizeValue",this.processedData):void 0,h=.5*(l!=null?n.convert(l[i]):r)*e;return[a-h,a+h]}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!i||!e)return[];const s={x:"xValue",y:"yValue"},n=s[t],r=e.resolveProcessedDataDefById(this,n),o=e.getDomain(this,n,"value",i);if(r?.def.type==="value"&&r?.def.valueType==="category")return o;const l=s[t==="x"?"y":"x"],c=this.domainForClippedRange(t,[n],l,!1);return fixNumericExtent(extent(c))}getSeriesRange(t,e){return this.domainForVisibleRange("y",["yValue"],"xValue",e,!1)}getVisibleItems(t,e,i){return this.countVisibleItems("xValue",["yValue"],t,e,i)}createNodeData(){const{axes:t,dataModel:e,processedData:i,colorScale:s,sizeScale:n,visible:r}=this,{xKey:o,yKey:a,sizeKey:l,xFilterKey:c,yFilterKey:h,sizeFilterKey:u,labelKey:d,xName:p,yName:g,sizeName:m,labelName:y,label:f,colorKey:x,marker:v}=this.properties,{placement:b}=f,S=Marker.anchor(v.shape),A=t.x,D=t.y;if(!(e&&i&&r&&A&&D))return;const I=e.resolveColumnById(this,"xValue",i),L=e.resolveColumnById(this,"yValue",i),N=l!=null?e.resolveColumnById(this,"sizeValue",i):void 0,T=x!=null?e.resolveColumnById(this,"colorValue",i):void 0,w=d!=null?e.resolveColumnById(this,"labelValue",i):void 0,O=c!=null?e.resolveColumnById(this,"xFilterValue",i):void 0,Z=h!=null?e.resolveColumnById(this,"yFilterValue",i):void 0,F=u!=null?e.resolveColumnById(this,"sizeFilterValue",i):void 0,U=A.scale,W=D.scale,H=(U.bandwidth??0)/2,_=(W.bandwidth??0)/2,E=[];n.range=[v.size,v.maxSize];const P=f.getFont(),G=CachedTextMeasurerPool.getMeasurer({font:P});return i.dataSources.get(this.id)?.forEach((V,Y)=>{const $=I[Y],j=L[Y],B=N?.[Y],k=U.convert($)+H,R=W.convert(j)+_;let z;O!=null&&Z!=null&&(z=O[Y]===$&&Z[Y]===j,F!=null&&z&&(z=F[Y]===B));const X=this.getLabelText(f,{value:w!=null?w[Y]:j,datum:V,xKey:o,yKey:a,sizeKey:l,labelKey:d,xName:p,yName:g,sizeName:m,labelName:y}),Q=G.measureText(String(X)),q=B!=null?n.convert(B):v.size,J=T!=null?s.convert(T[Y]):void 0;E.push({series:this,itemId:a,yKey:a,xKey:o,datum:V,datumIndex:Y,xValue:$,yValue:j,sizeValue:B,point:{x:k,y:R,size:q},midPoint:{x:k,y:R},fill:J,label:{text:X,...Q},anchor:S,placement:b,selected:z})}),{itemId:a,nodeData:E,labelData:E,scales:this.calculateScaling(),visible:this.visible}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}updateMarkerSelection(t){const{nodeData:e,markerSelection:i}=t;this.properties.marker.isDirty()&&(i.clear(),i.cleanup());const s=this.properties.marker.enabled?e:[];return i.update(s,void 0,n=>createDatumId([n.xValue,n.yValue,n.label.text]))}getMarkerItemBaseStyle(t){const{properties:e}=this,{marker:i}=e,s=t?e.highlightStyle.item:void 0;return{fill:s?.fill??i.fill,fillOpacity:s?.fillOpacity??i.fillOpacity,stroke:s?.stroke??i.stroke,strokeWidth:s?.strokeWidth??i.strokeWidth,strokeOpacity:s?.strokeOpacity??i.strokeOpacity,lineDash:s?.lineDash??i.lineDash,lineDashOffset:s?.lineDashOffset??i.lineDashOffset}}getMarkerItemStyleOverrides(t,e,i,s){const{id:n,properties:r}=this,{xKey:o,yKey:a,sizeKey:l,labelKey:c,marker:h}=r,{itemStyler:u}=h;if(u!=null)return this.cachedDatumCallback(createDatumId(t,s?"highlight":"node"),()=>u({seriesId:n,datum:e,xKey:o,yKey:a,sizeKey:l,labelKey:c,highlighted:s,...i}))}updateMarkerNodes(t){const{markerSelection:e,isHighlight:i}=t,{xKey:s,yKey:n,sizeKey:r,labelKey:o,marker:a}=this.properties,{size:l,shape:c,fill:h,fillOpacity:u,stroke:d,strokeWidth:p,strokeOpacity:g,lineDash:m,lineDashOffset:y}=mergeDefaults(i&&this.properties.highlightStyle.item,a.getStyle()),f={size:l,shape:c,fill:h,fillOpacity:u,stroke:d,strokeWidth:p,strokeOpacity:g,lineDash:m,lineDashOffset:y};this.sizeScale.range=[a.size,a.maxSize],e.each((x,v)=>{this.updateMarkerStyle(x,a,{datum:v,highlighted:i,xKey:s,yKey:n,sizeKey:r,labelKey:o},f,{selected:v.selected})}),i||this.properties.marker.markClean()}updatePlacedLabelData(t){this.labelSelection.update(t.map(e=>({...e.datum,point:{x:e.x,y:e.y,size:e.datum.point.size}})),e=>{e.pointerEvents=1}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(t){const{label:e}=this.properties;t.labelSelection.each((i,s)=>{i.text=s.label.text,i.fill=e.color,i.x=s.point?.x??0,i.y=s.point?.y??0,i.fontStyle=e.fontStyle,i.fontWeight=e.fontWeight,i.fontSize=e.fontSize,i.fontFamily=e.fontFamily,i.textAlign="left",i.textBaseline="top"})}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,axes:n,properties:r}=this,{xKey:o,xName:a,yKey:l,yName:c,sizeKey:h,sizeName:u,labelKey:d,labelName:p,title:g,tooltip:m}=r,y=n.x,f=n.y;if(!i||!s||!y||!f)return;const{datumIndex:x}=t,v=s.dataSources.get(this.id)?.[x],b=i.resolveColumnById(this,"xValue",s)[x],S=i.resolveColumnById(this,"yValue",s)[x];if(b==null)return;const A=[{label:a,fallbackLabel:o,value:y.formatDatum(b)},{label:c,fallbackLabel:l,value:f.formatDatum(S)}];if(h!=null){const I=i.resolveColumnById(this,"sizeValue",s)[x];A.push({label:u,fallbackLabel:h,value:String(I)})}const D=this.getMarkerItemBaseStyle(!1);return Object.assign(D,this.getMarkerItemStyleOverrides(String(x),v,D,!1)),m.formatTooltip({title:g,symbol:this.legendItemSymbol(),data:A},{seriesId:e,datum:v,title:l,xKey:o,xName:a,yKey:l,yName:c,sizeKey:h,sizeName:u,labelKey:d,labelName:p,...D,...this.getModuleTooltipParams()})}legendItemSymbol(){const{marker:t}=this.properties,{shape:e,fill:i,stroke:s,fillOpacity:n,strokeOpacity:r,strokeWidth:o,lineDash:a,lineDashOffset:l}=t;return{marker:{shape:e,fill:i??"rgba(0, 0, 0, 0)",stroke:s??"rgba(0, 0, 0, 0)",fillOpacity:n,strokeOpacity:r,strokeWidth:o,lineDash:a,lineDashOffset:l}}}getLegendData(){if(!this.properties.isValid())return[];const{id:t,ctx:{legendManager:e},visible:i}=this,{yKey:s,yName:n,title:r}=this.properties;return[{legendType:"category",id:t,itemId:s,seriesId:t,enabled:i&&e.getItemEnabled({seriesId:t,itemId:s}),label:{text:r??n??s},symbol:this.legendItemSymbol()}]}animateEmptyUpdateReady({markerSelection:t,labelSelection:e}){markerScaleInAnimation(this,this.ctx.animationManager,t),seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,e)}isLabelEnabled(){return this.properties.label.enabled}nodeFactory(){return new Group}getFormattedMarkerStyle(t){const{xKey:e,yKey:i,sizeKey:s,labelKey:n}=this.properties;return this.getMarkerStyle(this.properties.marker,{datum:t,xKey:e,yKey:i,sizeKey:s,labelKey:n,highlighted:!1})}computeFocusBounds(t){return computeMarkerFocusBounds(this,t)}};BubbleSeries.className="BubbleSeries",BubbleSeries.type="bubble";var BubbleSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"bubble",moduleFactory:t=>new BubbleSeries(t),tooltipDefaults:{range:"nearest"},defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{shape:"circle",size:7,maxSize:30,fillOpacity:.8,tooltip:{position:{type:"node"}},label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}}}},paletteFactory:singleSeriesPaletteFactory},HistogramSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.fillOpacity=1,this.strokeWidth=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.areaPlot=!1,this.aggregation="sum",this.shadow=new DropShadow,this.label=new Label,this.tooltip=new SeriesTooltip}};__decorateClass([Validate(STRING)],HistogramSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING,{optional:!0})],HistogramSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING,{optional:!0})],HistogramSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING,{optional:!0})],HistogramSeriesProperties.prototype,"yName",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],HistogramSeriesProperties.prototype,"fill",2),__decorateClass([Validate(RATIO)],HistogramSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Validate(COLOR_STRING,{optional:!0})],HistogramSeriesProperties.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER)],HistogramSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO)],HistogramSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],HistogramSeriesProperties.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],HistogramSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Validate(POSITIVE_NUMBER)],HistogramSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Validate(BOOLEAN)],HistogramSeriesProperties.prototype,"areaPlot",2),__decorateClass([Validate(ARRAY,{optional:!0})],HistogramSeriesProperties.prototype,"bins",2),__decorateClass([Validate(UNION(["count","sum","mean"],"a histogram aggregation"))],HistogramSeriesProperties.prototype,"aggregation",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],HistogramSeriesProperties.prototype,"binCount",2),__decorateClass([Validate(OBJECT)],HistogramSeriesProperties.prototype,"shadow",2),__decorateClass([Validate(OBJECT)],HistogramSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],HistogramSeriesProperties.prototype,"tooltip",2);var defaultBinCount=10,HistogramSeries=class extends CartesianSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,pickModes:[1,0],datumSelectionGarbageCollection:!1,animationResetFns:{datum:resetBarSelectionsFn,label:resetLabelFn}}),this.properties=new HistogramSeriesProperties,this.calculatedBins=[]}deriveBins(t){const e=createTicks(t[0],t[1],defaultBinCount),i=tickStep(t[0],t[1],defaultBinCount),[s]=e,n=r=>[r,r+i];return[[s-i,s],...e.map(n)]}calculateNiceBins(t,e){const i=Math.floor(t[0]),s=t[1],n=e||1,{start:r,binSize:o}=this.calculateNiceStart(i,s,n);return this.getBins(r,s,o,n)}getBins(t,e,i,s){const n=[],r=this.calculatePrecision(i);for(let o=0;o0)for(;t<1;)e*=10,t*=10;return e}calculateNiceStart(t,e,i){const s=Math.abs(e-t)/i,n=Math.floor(Math.log10(s)),r=Math.pow(10,n);return{start:Math.floor(t/r)*r,binSize:s}}async processData(t){this.visible||(this.processedData=void 0,this.animationState.transition("updateData"));const{xKey:e,yKey:i,areaPlot:s,aggregation:n}=this.properties,r=this.axes.x?.scale,o=this.axes.y?.scale,{xScaleType:a,yScaleType:l}=this.getScaleInformation({yScale:o,xScale:r}),c=[keyProperty(e,a),SORT_DOMAIN_GROUPS];if(i){let u=groupCount("groupAgg");n==="count"||(n==="sum"?u=groupSum("groupAgg"):n==="mean"&&(u=groupAverage("groupAgg"))),s&&(u=area("groupAgg",u)),c.push(valueProperty(i,l,{invalidValue:void 0}),u)}else{c.push(rowCountProperty("count"));let u=groupCount("groupAgg");s&&(u=area("groupAgg",u)),c.push(u)}const h=u=>{const d=fixNumericExtent(u.domain.keys[0]);if(d.length===0)return u.domain.groups=[],()=>[];const p=isNumber(this.properties.binCount)?this.calculateNiceBins(d,this.properties.binCount):this.properties.bins??this.deriveBins(d),g=p.length;return this.calculatedBins=[...p],m=>{let y=m[0];if(isDate(y)&&(y=y.getTime()),!isNumber(y))return[];for(let f=0;f=x[0]&&y{const[[h,u]=[0,0]]=c,[d,p]=l,[g,m]=findMinMax([r.convert(d),r.convert(p)]);if(m>=e&&g<=i){const y=h+u;a=Math.max(a,y)}}),o>a?[NaN,NaN]:[o,a]}createNodeData(){const{id:t,axes:e,processedData:i,dataModel:s}=this,n=e.x,r=e.y;if(!n||!r||!s)return;const{scale:o}=n,{scale:a}=r,{xKey:l,yKey:c,xName:h,yName:u}=this.properties,d=this.properties.label.formatter??(m=>String(m.value)),p=[],g={itemId:this.properties.yKey??this.id,nodeData:p,labelData:p,scales:this.calculateScaling(),animationValid:!0,visible:this.visible};return!this.visible||i==null||i.type!=="grouped"||(i.groups.forEach((m,y)=>{const{keys:f,datumIndices:x,aggregation:v}=m,[[b,S]=[0,0]]=v,A=x.length,D=f,[I,L]=D,N=[...s.forEachDatum(this,i,m)],T=o.convert(I),w=o.convert(L),O=b+S,Z=a.convert(0),F=a.convert(O),U=Math.abs(w-T),W=Math.abs(F-Z),H=Math.min(T,w),_=Math.min(Z,F);let E;O!==0&&(E={x:H+U/2,y:_+W/2,text:this.cachedDatumCallback(createDatumId(y,"label"),()=>d({value:O,datum:N,seriesId:t,xKey:l,yKey:c,xName:h,yName:u}))??String(O)});const P={x:H+U/2,y:_+W/2},G=r.isReversed();p.push({series:this,datumIndex:y,datum:N,aggregatedValue:O,frequency:A,domain:D,yKey:c,xKey:l,x:H,y:_,xValue:T,yValue:F,width:U,height:W,midPoint:P,topLeftCornerRadius:!G,topRightCornerRadius:!G,bottomRightCornerRadius:G,bottomLeftCornerRadius:G,label:E,crisp:!0})}),p.sort((m,y)=>m.x-y.x)),g}nodeFactory(){return new Rect}updateDatumSelection(t){const{nodeData:e,datumSelection:i}=t;return i.update(e,void 0,s=>s.domain.join("_"))}getItemBaseStyle(t){const{properties:e}=this,i=t?e.highlightStyle.item:void 0;return{fill:i?.fill??e.fill,fillOpacity:i?.fillOpacity??e.fillOpacity,stroke:i?.stroke??e.stroke,strokeWidth:i?.strokeWidth??this.getStrokeWidth(e.strokeWidth),strokeOpacity:i?.strokeOpacity??e.strokeOpacity,lineDash:i?.lineDash??e.lineDash,lineDashOffset:i?.lineDashOffset??e.lineDashOffset,cornerRadius:e.cornerRadius}}updateDatumNodes(t){const{isHighlight:e}=t,{shadow:i}=this.properties,s=this.getItemBaseStyle(e);t.datumSelection.each((n,r)=>{const{cornerRadius:o}=s,{topLeftCornerRadius:a,topRightCornerRadius:l,bottomRightCornerRadius:c,bottomLeftCornerRadius:h}=r;applyShapeStyle(n,s),n.topLeftCornerRadius=a?o:0,n.topRightCornerRadius=l?o:0,n.bottomRightCornerRadius=c?o:0,n.bottomLeftCornerRadius=h?o:0,n.crisp=r.crisp,n.fillShadow=i,n.visible=r.height>0})}updateLabelSelection(t){const{labelData:e,labelSelection:i}=t;return i.update(e,s=>{s.pointerEvents=1,s.textAlign="center",s.textBaseline="middle"})}updateLabelNodes(t){const{fontStyle:e,fontWeight:i,fontFamily:s,fontSize:n,color:r}=this.properties.label,o=this.isLabelEnabled();t.labelSelection.each((a,l)=>{o&&l?.label?(a.text=l.label.text,a.x=l.label.x,a.y=l.label.y,a.fontStyle=e,a.fontWeight=i,a.fontFamily=s,a.fontSize=n,a.fill=r,a.visible=!0):a.visible=!1})}initQuadTree(t){const{value:e}=this.contentGroup.children().next();e&&addHitTestersToQuadtree(t,e.children())}pickNodeClosestDatum(t){return findQuadtreeMatch(this,t)}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,axes:n,properties:r,ctx:{localeManager:o}}=this,{xKey:a,xName:l,yKey:c,yName:h,tooltip:u}=r,d=n.x,p=n.y;if(!i||s?.type!=="grouped"||!d||!p)return;const g=t.datumIndex,m=s.groups[g],{aggregation:y,datumIndices:f,keys:x}=m,[[v,b]=[0,0]]=y,S=f.length,A=x,[D,I]=A,L=v+b,N={data:[...i.forEachDatum(this,s,m)],aggregatedValue:L,frequency:S,domain:A},T=[{label:l,fallbackLabel:a,value:`${d.formatDatum(D)} - ${d.formatDatum(I)}`},{label:o.t("seriesHistogramTooltipFrequency"),value:p.formatDatum(S)}];if(c!=null){let w;switch(r.aggregation){case"sum":w=o.t("seriesHistogramTooltipSum",{yName:h});break;case"mean":w=o.t("seriesHistogramTooltipMean",{yName:h});break;case"count":w=o.t("seriesHistogramTooltipCount",{yName:h});break}T.push({label:w,value:p.formatDatum(L)})}return u.formatTooltip({symbol:this.legendItemSymbol(),data:T},{seriesId:e,datum:N,title:h,xKey:a,xName:l,yKey:c,yName:h,xRange:[D,I],frequency:S,...this.getItemBaseStyle(!1)})}legendItemSymbol(){const{fill:t,fillOpacity:e,stroke:i,strokeWidth:s,strokeOpacity:n,lineDash:r,lineDashOffset:o}=this.properties;return{marker:{fill:t??"rgba(0, 0, 0, 0)",stroke:i??"rgba(0, 0, 0, 0)",fillOpacity:e,strokeOpacity:n,strokeWidth:s,lineDash:r,lineDashOffset:o}}}getLegendData(t){if(t!=="category")return[];const{id:e,ctx:{legendManager:i},visible:s}=this,{xKey:n,yName:r,showInLegend:o}=this.properties;return[{legendType:"category",id:e,itemId:n,seriesId:e,enabled:s&&i.getItemEnabled({seriesId:e,itemId:n}),label:{text:r??n??"Frequency"},symbol:this.legendItemSymbol(),hideInLegend:!o}]}animateEmptyUpdateReady({datumSelection:t,labelSelection:e}){const i=prepareBarAnimationFunctions(collapsedStartingBarPosition(!0,this.axes,"normal"));fromToMotion(this.id,"datums",this.ctx.animationManager,[t],i),seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,e)}animateWaitingUpdateReady(t){const e=this.processedData?.reduced?.diff?.[this.id],i=prepareBarAnimationFunctions(collapsedStartingBarPosition(!0,this.axes,"normal"));fromToMotion(this.id,"datums",this.ctx.animationManager,[t.datumSelection],i,(s,n)=>createDatumId(n.domain),e),seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,t.labelSelection)}isLabelEnabled(){return this.properties.label.enabled}computeFocusBounds({datumIndex:t}){return computeBarFocusBounds(this,this.contextNodeData?.nodeData[t])}};HistogramSeries.className="HistogramSeries",HistogramSeries.type="histogram";var HistogramSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"histogram",moduleFactory:t=>new HistogramSeries(t),tooltipDefaults:{range:"exact"},defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{strokeWidth:1,fillOpacity:1,strokeOpacity:1,lineDash:[0],lineDashOffset:0,label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"backgroundColor"}},shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5}}},paletteFactory:({takeColors:t})=>{const{fills:[e],strokes:[i]}=t(1);return{fill:e,stroke:i}}},LineSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.stroke="#874349",this.strokeWidth=2,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.interpolation=new InterpolationProperties,this.marker=new SeriesMarker,this.label=new Label,this.tooltip=new SeriesTooltip,this.connectMissingData=!1,this.sparklineMode=!1}};__decorateClass([Validate(STRING)],LineSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING)],LineSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING,{optional:!0})],LineSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING,{optional:!0})],LineSeriesProperties.prototype,"yName",2),__decorateClass([Validate(STRING,{optional:!0})],LineSeriesProperties.prototype,"yFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],LineSeriesProperties.prototype,"stackGroup",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],LineSeriesProperties.prototype,"normalizedTo",2),__decorateClass([Validate(STRING,{optional:!0})],LineSeriesProperties.prototype,"title",2),__decorateClass([Validate(COLOR_STRING)],LineSeriesProperties.prototype,"stroke",2),__decorateClass([Validate(POSITIVE_NUMBER)],LineSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Validate(RATIO)],LineSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],LineSeriesProperties.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],LineSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Validate(OBJECT)],LineSeriesProperties.prototype,"interpolation",2),__decorateClass([Validate(OBJECT)],LineSeriesProperties.prototype,"marker",2),__decorateClass([Validate(OBJECT)],LineSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],LineSeriesProperties.prototype,"tooltip",2),__decorateClass([Validate(BOOLEAN)],LineSeriesProperties.prototype,"connectMissingData",2),__decorateClass([Validate(BOOLEAN)],LineSeriesProperties.prototype,"sparklineMode",2);var CROSS_FILTER_LINE_STROKE_OPACITY_FACTOR=.25,LineSeries=class extends CartesianSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,hasMarkers:!0,pickModes:[2,1,0],markerSelectionGarbageCollection:!1,animationResetFns:{path:buildResetPathFn({getVisible:()=>this.visible,getOpacity:()=>this.getOpacity()}),label:resetLabelFn,marker:(e,i)=>({...resetMarkerFn(e),...resetMarkerPositionFn(e,i)})}}),this.clipFocusBox=!1,this.properties=new LineSeriesProperties,this.dataAggregationFilters=void 0}get pickModeAxis(){return this.properties.sparklineMode?"main":"main-category"}async processData(t){if(this.data==null||!this.properties.isValid())return;const{data:e,visible:i,seriesGrouping:{groupIndex:s=this.id,stackCount:n=0}={}}=this,{xKey:r,yKey:o,yFilterKey:a,connectMissingData:l,normalizedTo:c}=this.properties,h=!this.ctx.animationManager.isSkipped(),u=this.axes.x?.scale,d=this.axes.y?.scale,{isContinuousX:p,xScaleType:g,yScaleType:m}=this.getScaleInformation({xScale:u,yScale:d}),y=n>=1||c!=null,f={invalidValue:null};l&&y&&(f.invalidValue=0),y&&!i&&(f.forceValue=0);const x=[];if((!p||y)&&x.push(keyProperty(r,g,{id:"xKey"})),x.push(valueProperty(r,g,{id:"xValue"}),valueProperty(o,m,{id:"yValueRaw",...f,invalidValue:void 0})),a!=null&&x.push(valueProperty(a,m,{id:"yFilterRaw"})),y){const S=[`line-stack-${s}-yValues`,`line-stack-${s}-yValues-trailing`,`line-stack-${s}-yValues-marker`];x.push(...groupAccumulativeValueProperty(o,"window","current",{id:"yValueEnd",...f,groupId:S[0]},m),...groupAccumulativeValueProperty(o,"window-trailing","current",{id:"yValueStart",...f,groupId:S[1]},m),...groupAccumulativeValueProperty(o,"normal","current",{id:"yValueCumulative",...f,groupId:S[2]},m)),isDefined(c)&&x.push(normaliseGroupTo([S[0],S[1],S[2]],c))}h&&(x.push(animationValidation(p?["xValue"]:void 0)),this.processedData&&x.push(diff(this.id,this.processedData)));const{dataModel:v,processedData:b}=await this.requestDataModel(t,e,{props:x,groupByKeys:y,groupByData:!y});this.dataAggregationFilters=this.aggregateData(v,b),this.animationState.transition("updateData")}xCoordinateRange(t,e){const{marker:i}=this.properties,s=this.axes.x.scale.convert(t),n=i.enabled?.5*i.size*e:0;return[s-n,s+n]}yCoordinateRange(t,e){const{marker:i}=this.properties,s=this.axes.y.scale.convert(t[0]),n=i.enabled?.5*i.size*e:0;return[s-n,s+n]}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!e||!i)return[];if(t==="x"){const r=e.resolveProcessedDataDefById(this,"xValue"),o=e.getDomain(this,"xValue","value",i);return r?.def.type==="value"&&r.def.valueType==="category"?o:fixNumericExtent(extent(o))}const s=this.dataModel?.hasColumnById(this,"yValueEnd")?"yValueEnd":"yValueRaw",n=this.domainForClippedRange("y",[s],"xValue",!0);return fixNumericExtent(n)}getSeriesRange(t,e){const i=this.dataModel?.hasColumnById(this,"yValueEnd")?"yValueEnd":"yValueRaw";return this.domainForVisibleRange("y",[i],"xValue",e,!0)}getVisibleItems(t,e,i){const s=this.dataModel?.hasColumnById(this,"yValueEnd")?"yValueEnd":"yValueRaw";return this.countVisibleItems("xValue",[s],t,e,i)}aggregateData(t,e){}createNodeData(){const{dataModel:t,processedData:e,axes:i,dataAggregationFilters:s}=this,n=i.x,r=i.y;if(!t||!e||!n||!r)return;const{xKey:o,yKey:a,yFilterKey:l,xName:c,yName:h,marker:u,label:d,connectMissingData:p,interpolation:g,legendItemName:m}=this.properties,y=this.dataModel?.hasColumnById(this,"yValueEnd"),f=n.scale,x=r.scale,v=(f.bandwidth??0)/2,b=(x.bandwidth??0)/2,S=u.enabled?u.size:0,A=e.dataSources.get(this.id)??[],D=t.resolveColumnById(this,"xValue",e),I=t.resolveColumnById(this,"yValueRaw",e),L=y?t.resolveColumnById(this,"yValueEnd",e):void 0,N=y?t.resolveColumnById(this,"yValueCumulative",e):I,T=l!=null?t.resolveColumnById(this,"yFilterRaw",e):void 0,w=k=>f.convert(D[k])+v,O=k=>x.convert(N[k])+b,Z={lengthRatioMultiplier:this.properties.marker.getDiameter(),lengthMax:1/0},F=[];let U;const W=k=>{const R=A[k],z=D[k],X=I[k],Q=L?.[k],q=T?.[k],J=w(k),it=O(k);if(!Number.isFinite(J))return;if(X!=null){const nt=d.enabled?this.getLabelText(d,{value:X,datum:R,xKey:o,yKey:a,xName:c,yName:h,legendItemName:m}):void 0;F.push({series:this,datum:R,datumIndex:k,yKey:a,xKey:o,point:{x:J,y:it,size:S},midPoint:{x:J,y:it},cumulativeValue:Q,yValue:X,xValue:z,capDefaults:Z,labelText:nt,selected:q})}if(U==null)return;const st=U[U.length-1];if(X!=null){const nt={point:{x:J,y:it},xDatum:z,yDatum:X};Array.isArray(st)?st.push(nt):st!=null?(st.skip+=1,U.push([nt])):U.push([nt])}else p||(Array.isArray(st)||st==null?U.push({skip:0}):st.skip+=1)},[H,_]=f.range,E=_-H,G=s?.find(k=>k.maxRange>E)?.indices;let[V,Y]=this.visibleRange("xValue",n.range,G);V=Math.max(V-1,0),Y=Math.min(Y+1,G?.length??D.length),e.input.count<1e3&&(V=0,Y=e.input.count),G==null&&(U=[]);for(let k=V;kArray.isArray(k)?interpolatePoints(k,g):[]),j=$!=null?{itemId:a,spans:$}:void 0,B=T?.some((k,R)=>k===I[R])??!1;return{itemId:a,nodeData:F,labelData:F,strokeData:j,scales:this.calculateScaling(),visible:this.visible,crossFiltering:B}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}updatePathNodes(t){const{paths:[e],opacity:i,visible:s,animationEnabled:n}=t,r=this.contextNodeData?.crossFiltering===!0;e.setProperties({fill:void 0,lineJoin:"round",pointerEvents:1,opacity:i,stroke:this.properties.stroke,strokeWidth:this.getStrokeWidth(this.properties.strokeWidth),strokeOpacity:this.properties.strokeOpacity*(r?CROSS_FILTER_LINE_STROKE_OPACITY_FACTOR:1),lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset}),n||(e.visible=s),updateClipPath(this,e)}getMarkerItemBaseStyle(t){const{properties:e}=this,{marker:i}=e,s=t?e.highlightStyle.item:void 0;return{size:i.size,shape:i.shape,fill:s?.fill??i.fill,fillOpacity:s?.fillOpacity??i.fillOpacity,stroke:s?.stroke??i.stroke,strokeWidth:s?.strokeWidth??i.strokeWidth,strokeOpacity:s?.strokeOpacity??i.strokeOpacity,lineDash:s?.lineDash??i.lineDash,lineDashOffset:s?.lineDashOffset??i.lineDashOffset}}getMarkerItemStyleOverrides(t,e,i,s){const{id:n,properties:r}=this,{xKey:o,yKey:a,marker:l}=r,{itemStyler:c}=l;if(c!=null)return this.cachedDatumCallback(createDatumId(t,s?"highlight":"node"),()=>{const h=this.getSeriesDomain("x"),u=this.getSeriesDomain("y");return c({seriesId:n,...datumStylerProperties(e,o,a,h,u),highlighted:s,...i})})}updateMarkerSelection(t){let{nodeData:e}=t;const{markerSelection:i}=t;return e=this.properties.marker.enabled||this.contextNodeData?.crossFiltering===!0?e:[],this.properties.marker.isDirty()&&(i.clear(),i.cleanup()),i.update(e,void 0,n=>createDatumId(n.xValue))}updateMarkerNodes(t){const{markerSelection:e,isHighlight:i}=t,{xKey:s,yKey:n,stroke:r,strokeWidth:o,strokeOpacity:a,marker:l,highlightStyle:c}=this.properties,h=this.getSeriesDomain("x"),u=this.getSeriesDomain("y"),d=mergeDefaults(i&&c.item,l.getStyle(),{stroke:r,strokeWidth:o,strokeOpacity:a}),p=this.ctx.animationManager.isSkipped();e.each((g,m)=>{this.updateMarkerStyle(g,l,{...datumStylerProperties(m,s,n,h,u),highlighted:i},d,{applyTranslation:p,selected:m.selected})}),i||l.markClean()}updateLabelSelection(t){return t.labelSelection.update(this.isLabelEnabled()?t.labelData:[])}updateLabelNodes(t){const{enabled:e,fontStyle:i,fontWeight:s,fontSize:n,fontFamily:r,color:o}=this.properties.label;t.labelSelection.each((a,l)=>{e&&l?.labelText?(a.fontStyle=i,a.fontWeight=s,a.fontSize=n,a.fontFamily=r,a.textAlign="center",a.textBaseline="bottom",a.text=l.labelText,a.x=l.point.x,a.y=l.point.y-10,a.fill=o,a.visible=!0):a.visible=!1})}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,axes:n,properties:r}=this,{xKey:o,xName:a,yKey:l,yName:c,tooltip:h}=r,u=n.x,d=n.y;if(!i||!s||!u||!d)return;const{datumIndex:p}=t,g=s.dataSources.get(this.id)?.[p],m=i.resolveColumnById(this,"xValue",s)[p],y=i.resolveColumnById(this,"yValueRaw",s)[p];if(m==null)return;const f=this.getMarkerItemBaseStyle(!1);return Object.assign(f,this.getMarkerItemStyleOverrides(String(p),g,f,!1)),h.formatTooltip({heading:u.formatDatum(m),symbol:this.legendItemSymbol(),data:[{label:c,fallbackLabel:l,value:d.formatDatum(y)}]},{seriesId:e,datum:g,title:c,xKey:o,xName:a,yKey:l,yName:c,...f,...this.getModuleTooltipParams()})}legendItemSymbol(){const t="rgba(0, 0, 0, 0)",{stroke:e,strokeOpacity:i,strokeWidth:s,lineDash:n,marker:r}=this.properties;return{marker:{shape:r.shape,fill:r.fill??t,stroke:r.stroke??e??t,fillOpacity:r.fillOpacity,strokeOpacity:r.strokeOpacity,strokeWidth:r.strokeWidth,lineDash:r.lineDash,lineDashOffset:r.lineDashOffset,enabled:r.enabled},line:{stroke:e??t,strokeOpacity:i,strokeWidth:s,lineDash:n}}}getLegendData(t){if(!(this.properties.isValid()&&t==="category"))return[];const{id:e,ctx:{legendManager:i},visible:s}=this,{yKey:n,yName:r,title:o,legendItemName:a,showInLegend:l}=this.properties;return[{legendType:"category",id:e,itemId:n,legendItemName:a,seriesId:e,enabled:s&&i.getItemEnabled({seriesId:e,itemId:n}),label:{text:a??o??r??n},symbol:this.legendItemSymbol(),hideInLegend:!l}]}updatePaths(t){this.updateLinePaths(t.paths,t.contextData)}plotNodeDataPoints(t,e){if(e.length===0)return;const i=e[0].point;t.moveTo(i.x,i.y);for(let s=1;s{this.resetPathAnimation(t),this.updateLinePaths(o,r)},h=()=>{e.skipCurrentBatch(),c()};if(r==null||a==null){c(),markerFadeInAnimation(this,e,"added",i),pathFadeInAnimation(this,"path_properties",e,"add",l),seriesLabelFadeInAnimation(this,"labels",e,s),seriesLabelFadeInAnimation(this,"annotations",e,...n);return}if(r.crossFiltering!==a.crossFiltering){h();return}const u=prepareLinePathAnimation(r,a,this.processedData?.reduced?.diff?.[this.id]);if(u===void 0){h();return}else if(u.status==="no-op")return;fromToMotion(this.id,"path_properties",e,[l],u.stroke.pathProperties),u.status==="added"?this.updateLinePaths(o,r):u.status==="removed"?this.updateLinePaths(o,a):pathMotion(this.id,"path_update",e,[l],u.stroke.path),u.hasMotion&&(markerFadeInAnimation(this,e,void 0,i),seriesLabelFadeInAnimation(this,"labels",e,s),seriesLabelFadeInAnimation(this,"annotations",e,...n))}isLabelEnabled(){return this.properties.label.enabled}getBandScalePadding(){return{inner:1,outer:.1}}nodeFactory(){return new Group}getFormattedMarkerStyle(t){const{xKey:e,yKey:i}=this.properties,s=this.getSeriesDomain("x"),n=this.getSeriesDomain("y");return this.getMarkerStyle(this.properties.marker,{...datumStylerProperties(t,e,i,s,n),highlighted:!0})}computeFocusBounds(t){return computeMarkerFocusBounds(this,t)}};LineSeries.className="LineSeries",LineSeries.type="line";var LineSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"line",moduleFactory:t=>new LineSeries(t),stackable:!0,tooltipDefaults:{range:"nearest"},defaultAxes:[{type:"number",position:"left"},{type:"category",position:"bottom"}],themeTemplate:{series:{tooltip:{position:{type:"node"}},strokeWidth:2,strokeOpacity:1,lineDash:[0],lineDashOffset:0,interpolation:{type:"linear",tension:1,position:"end"},marker:{shape:"circle",size:7,strokeWidth:0},label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},errorBar:{cap:{lengthRatio:1}}}},paletteFactory:t=>{const{marker:e}=markerPaletteFactory(t);return{stroke:e.fill,marker:e}}},ScatterSeriesLabel=class extends Label{constructor(){super(...arguments),this.placement="top"}};__decorateClass([Validate(LABEL_PLACEMENT)],ScatterSeriesLabel.prototype,"placement",2);var ScatterSeriesProperties=class extends CartesianSeriesProperties{constructor(){super(...arguments),this.colorRange=["#ffff00","#00ff00","#0000ff"],this.label=new ScatterSeriesLabel,this.tooltip=new SeriesTooltip,this.marker=new SeriesMarker}};__decorateClass([Validate(STRING)],ScatterSeriesProperties.prototype,"xKey",2),__decorateClass([Validate(STRING)],ScatterSeriesProperties.prototype,"yKey",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"labelKey",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"colorKey",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"xFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"yFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"xName",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"yName",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"labelName",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"colorName",2),__decorateClass([Validate(NUMBER_ARRAY,{optional:!0})],ScatterSeriesProperties.prototype,"colorDomain",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],ScatterSeriesProperties.prototype,"colorRange",2),__decorateClass([Validate(STRING,{optional:!0})],ScatterSeriesProperties.prototype,"title",2),__decorateClass([ProxyProperty("marker.shape")],ScatterSeriesProperties.prototype,"shape",2),__decorateClass([ProxyProperty("marker.size")],ScatterSeriesProperties.prototype,"size",2),__decorateClass([ProxyProperty("marker.fill")],ScatterSeriesProperties.prototype,"fill",2),__decorateClass([ProxyProperty("marker.fillOpacity")],ScatterSeriesProperties.prototype,"fillOpacity",2),__decorateClass([ProxyProperty("marker.stroke")],ScatterSeriesProperties.prototype,"stroke",2),__decorateClass([ProxyProperty("marker.strokeWidth")],ScatterSeriesProperties.prototype,"strokeWidth",2),__decorateClass([ProxyProperty("marker.strokeOpacity")],ScatterSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([ProxyProperty("marker.lineDash")],ScatterSeriesProperties.prototype,"lineDash",2),__decorateClass([ProxyProperty("marker.lineDashOffset")],ScatterSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([ProxyProperty("marker.itemStyler",{optional:!0})],ScatterSeriesProperties.prototype,"itemStyler",2),__decorateClass([Validate(OBJECT)],ScatterSeriesProperties.prototype,"label",2),__decorateClass([Validate(OBJECT)],ScatterSeriesProperties.prototype,"tooltip",2);var ScatterSeries=class extends CartesianSeries{constructor(t){super({moduleCtx:t,directionKeys:DEFAULT_CARTESIAN_DIRECTION_KEYS,directionNames:DEFAULT_CARTESIAN_DIRECTION_NAMES,pickModes:[2,1,0],pathsPerSeries:[],hasMarkers:!0,markerSelectionGarbageCollection:!1,animationResetFns:{marker:resetMarkerFn,label:resetLabelFn},usesPlacedLabels:!0}),this.clipFocusBox=!1,this.properties=new ScatterSeriesProperties,this.colorScale=new ColorScale}get pickModeAxis(){return"main-category"}async processData(t){if(!this.properties.isValid()||this.data==null||!this.visible)return;const e=this.axes.x?.scale,i=this.axes.y?.scale,{xScaleType:s,yScaleType:n}=this.getScaleInformation({xScale:e,yScale:i}),r=this.colorScale.type,{xKey:o,yKey:a,xFilterKey:l,yFilterKey:c,labelKey:h,colorKey:u,colorDomain:d,colorRange:p}=this.properties,{dataModel:g,processedData:m}=await this.requestDataModel(t,this.data,{props:[valueProperty(o,s,{id:"xValue"}),valueProperty(a,n,{id:"yValue"}),...l!=null?[valueProperty(l,s,{id:"xFilterValue"})]:[],...c!=null?[valueProperty(c,n,{id:"yFilterValue"})]:[],...u?[valueProperty(u,r,{id:"colorValue"})]:[],...h?[valueProperty(h,"band",{id:"labelValue"})]:[]]});if(u){const y=g.resolveProcessedDataIndexById(this,"colorValue");this.colorScale.domain=d??m.domain.values[y]??[],this.colorScale.range=p,this.colorScale.update()}this.animationState.transition("updateData")}xCoordinateRange(t,e){const i=this.axes.x.scale.convert(t),s=.5*this.properties.size*e;return[i-s,i+s]}yCoordinateRange(t,e){const i=this.axes.y.scale.convert(t[0]),s=.5*this.properties.size*e;return[i-s,i+s]}getSeriesDomain(t){const{dataModel:e,processedData:i}=this;if(!i||!e)return[];const s={x:"xValue",y:"yValue"},n=s[t],r=e.resolveProcessedDataDefById(this,n),o=e.getDomain(this,n,"value",i);if(r?.def.type==="value"&&r?.def.valueType==="category")return o;const l=s[t==="x"?"y":"x"],c=this.domainForClippedRange(t,[n],l,!1);return fixNumericExtent(extent(c))}getSeriesRange(t,e){return this.domainForVisibleRange("y",["yValue"],"xValue",e,!1)}getVisibleItems(t,e,i){return this.countVisibleItems("xValue",["yValue"],t,e,i)}createNodeData(){const{axes:t,dataModel:e,processedData:i,colorScale:s,visible:n}=this,{xKey:r,yKey:o,xFilterKey:a,yFilterKey:l,labelKey:c,colorKey:h,xName:u,yName:d,labelName:p,marker:g,label:m}=this.properties,{placement:y}=m,f=Marker.anchor(g.shape),x=t.x,v=t.y;if(!(e&&i&&n&&x&&v))return;const b=e.resolveColumnById(this,"xValue",i),S=e.resolveColumnById(this,"yValue",i),A=h!=null?e.resolveColumnById(this,"colorValue",i):void 0,D=c!=null?e.resolveColumnById(this,"labelValue",i):void 0,I=a!=null?e.resolveColumnById(this,"xFilterValue",i):void 0,L=l!=null?e.resolveColumnById(this,"yFilterValue",i):void 0,N=x.scale,T=v.scale,w=(N.bandwidth??0)/2,O=(T.bandwidth??0)/2,Z=[],F=m.getFont(),U=CachedTextMeasurerPool.getMeasurer({font:F});return(i.dataSources.get(this.id)??[]).forEach((H,_)=>{const E=b[_],P=S[_],G=N.convert(E)+w,V=T.convert(P)+O,Y=I!=null&&L!=null?I[_]===E&&L[_]===P:void 0,$=this.getLabelText(m,{value:D!=null?D?.[_]:P,datum:H,xKey:r,yKey:o,labelKey:c,xName:u,yName:d,labelName:p}),j=U.measureText($),B=A!=null?s.convert(A[_]):void 0;Z.push({series:this,itemId:o,yKey:o,xKey:r,datum:H,datumIndex:_,xValue:E,yValue:P,capDefaults:{lengthRatioMultiplier:g.getDiameter(),lengthMax:1/0},point:{x:G,y:V,size:g.size},midPoint:{x:G,y:V},fill:B,label:{text:$,...j},anchor:f,placement:y,selected:Y})}),{itemId:o,nodeData:Z,labelData:Z,scales:this.calculateScaling(),visible:this.visible}}isPathOrSelectionDirty(){return this.properties.marker.isDirty()}getLabelData(){return this.isLabelEnabled()?this.contextNodeData?.labelData??[]:[]}updateMarkerSelection(t){const{nodeData:e,markerSelection:i}=t;return this.properties.marker.isDirty()&&(i.clear(),i.cleanup()),i.update(this.properties.marker.enabled?e:[])}getMarkerItemBaseStyle(t){const{properties:e}=this,{marker:i}=e,s=t?e.highlightStyle.item:void 0;return{fill:s?.fill??i.fill,fillOpacity:s?.fillOpacity??i.fillOpacity,stroke:s?.stroke??i.stroke,strokeWidth:s?.strokeWidth??i.strokeWidth,strokeOpacity:s?.strokeOpacity??i.strokeOpacity,lineDash:s?.lineDash??i.lineDash,lineDashOffset:s?.lineDashOffset??i.lineDashOffset}}getMarkerItemStyleOverrides(t,e,i,s){const{id:n,properties:r}=this,{xKey:o,yKey:a,labelKey:l,marker:c}=r,{itemStyler:h}=c;if(h!=null)return this.cachedDatumCallback(createDatumId(t,s?"highlight":"node"),()=>h({seriesId:n,datum:e,xKey:o,yKey:a,labelKey:l,highlighted:s,...i}))}updateMarkerNodes(t){const{markerSelection:e,isHighlight:i}=t,{xKey:s,yKey:n,labelKey:r,marker:o,highlightStyle:a}=this.properties,l=mergeDefaults(i&&a.item,o.getStyle());e.each((c,h)=>{this.updateMarkerStyle(c,o,{datum:h,highlighted:i,xKey:s,yKey:n,labelKey:r},l,{selected:h.selected})}),i||o.markClean()}updatePlacedLabelData(t){this.labelSelection.update(t.map(e=>({...e.datum,point:{x:e.x,y:e.y,size:e.datum.point.size}})),e=>{e.pointerEvents=1}),this.updateLabelNodes({labelSelection:this.labelSelection})}updateLabelNodes(t){const{label:e}=this.properties;t.labelSelection.each((i,s)=>{i.text=s.label.text,i.fill=e.color,i.x=s.point?.x??0,i.y=s.point?.y??0,i.fontStyle=e.fontStyle,i.fontWeight=e.fontWeight,i.fontSize=e.fontSize,i.fontFamily=e.fontFamily,i.textAlign="left",i.textBaseline="top"})}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,axes:n,properties:r}=this,{xKey:o,xName:a,yKey:l,yName:c,labelKey:h,labelName:u,title:d,tooltip:p}=r,g=n.x,m=n.y;if(!i||!s||!g||!m)return;const{datumIndex:y}=t,f=s.dataSources.get(this.id)?.[y],x=i.resolveColumnById(this,"xValue",s)[y],v=i.resolveColumnById(this,"yValue",s)[y];if(x==null)return;const b=this.getMarkerItemBaseStyle(!1);return Object.assign(b,this.getMarkerItemStyleOverrides(String(y),f,b,!1)),p.formatTooltip({symbol:this.legendItemSymbol(),title:d,data:[{label:a,fallbackLabel:o,value:g.formatDatum(x)},{label:c,fallbackLabel:l,value:m.formatDatum(v)}]},{seriesId:e,datum:f,title:c,xKey:o,xName:a,yKey:l,yName:c,labelKey:h,labelName:u,...b,...this.getModuleTooltipParams()})}legendItemSymbol(){const{shape:t,fill:e,stroke:i,fillOpacity:s,strokeOpacity:n,strokeWidth:r,lineDash:o,lineDashOffset:a}=this.properties.marker;return{marker:{shape:t,fill:e??"rgba(0, 0, 0, 0)",stroke:i??"rgba(0, 0, 0, 0)",fillOpacity:s,strokeOpacity:n,strokeWidth:r,lineDash:o,lineDashOffset:a}}}getLegendData(t){if(!this.properties.isValid()||t!=="category")return[];const{yKey:e,yName:i,title:s,showInLegend:n}=this.properties,{id:r,ctx:{legendManager:o},visible:a}=this;return[{legendType:"category",id:r,itemId:e,seriesId:r,enabled:a&&o.getItemEnabled({seriesId:r,itemId:e}),label:{text:s??i??e},symbol:this.legendItemSymbol(),hideInLegend:!n}]}animateEmptyUpdateReady(t){const{markerSelection:e,labelSelection:i,annotationSelections:s}=t;markerScaleInAnimation(this,this.ctx.animationManager,e),seriesLabelFadeInAnimation(this,"labels",this.ctx.animationManager,i),seriesLabelFadeInAnimation(this,"annotations",this.ctx.animationManager,...s)}isLabelEnabled(){return this.properties.label.enabled}nodeFactory(){return new Group}getFormattedMarkerStyle(t){const{xKey:e,yKey:i,labelKey:s}=this.properties;return this.getMarkerStyle(this.properties.marker,{datum:t,xKey:e,yKey:i,labelKey:s,highlighted:!0})}computeFocusBounds(t){return computeMarkerFocusBounds(this,t)}};ScatterSeries.className="ScatterSeries",ScatterSeries.type="scatter";var ScatterSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["cartesian"],identifier:"scatter",moduleFactory:t=>new ScatterSeries(t),tooltipDefaults:{range:"nearest"},defaultAxes:[{type:"number",position:"bottom"},{type:"number",position:"left"}],themeTemplate:{series:{shape:"circle",size:7,fillOpacity:.8,tooltip:{position:{type:"node"}},label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"}},errorBar:{cap:{lengthRatio:1}}}},paletteFactory:singleSeriesPaletteFactory},SectorBox=class Ct{constructor(e,i,s,n){this.startAngle=e,this.endAngle=i,this.innerRadius=s,this.outerRadius=n}clone(){const{startAngle:e,endAngle:i,innerRadius:s,outerRadius:n}=this;return new Ct(e,i,s,n)}equals(e){return this.startAngle===e.startAngle&&this.endAngle===e.endAngle&&this.innerRadius===e.innerRadius&&this.outerRadius===e.outerRadius}[interpolate](e,i){return new Ct(this.startAngle*(1-i)+e.startAngle*i,this.endAngle*(1-i)+e.endAngle*i,this.innerRadius*(1-i)+e.innerRadius*i,this.outerRadius*(1-i)+e.outerRadius*i)}};function sectorBox({startAngle:t,endAngle:e,innerRadius:i,outerRadius:s}){let n=1/0,r=1/0,o=-1/0,a=-1/0;const l=(c,h)=>{n=Math.min(c,n),r=Math.min(h,r),o=Math.max(c,o),a=Math.max(h,a)};return l(i*Math.cos(t),i*Math.sin(t)),l(i*Math.cos(e),i*Math.sin(e)),l(s*Math.cos(t),s*Math.sin(t)),l(s*Math.cos(e),s*Math.sin(e)),isBetweenAngles(0,t,e)&&l(s,0),isBetweenAngles(Math.PI*.5,t,e)&&l(0,s),isBetweenAngles(Math.PI,t,e)&&l(-s,0),isBetweenAngles(Math.PI*1.5,t,e)&&l(0,-s),new BBox(n,r,o-n,a-r)}function isPointInSector(t,e,i){const s=Math.sqrt(Math.pow(t,2)+Math.pow(e,2)),{innerRadius:n,outerRadius:r}=i;if(i.startAngle===i.endAngle||sMath.max(n,r))return!1;const o=normalizeAngle180(i.startAngle),a=normalizeAngle180(i.endAngle),l=Math.atan2(e,t);return o=o:l<=a&&l>=-Math.PI||l>=o&&l<=Math.PI}function lineCollidesSector(t,e){const{startAngle:i,endAngle:s,innerRadius:n,outerRadius:r}=e,o={x:r*Math.cos(i),y:r*Math.sin(i)},a={x:r*Math.cos(s),y:r*Math.sin(s)},l=n===0?{x:0,y:0}:{x:n*Math.cos(i),y:n*Math.sin(i)},c=n===0?{x:0,y:0}:{x:n*Math.cos(s),y:n*Math.sin(s)};return segmentIntersection(t.start.x,t.start.y,t.end.x,t.end.y,o.x,o.y,l.x,l.y)||segmentIntersection(t.start.x,t.start.y,t.end.x,t.end.y,a.x,a.y,c.x,c.y)||arcIntersections(0,0,r,i,s,!0,t.start.x,t.start.y,t.end.x,t.end.y)}function boxCollidesSector(t,e){const i={x:t.x,y:t.y},s={x:t.x+t.width,y:t.y},n={x:t.x,y:t.y+t.height},r={x:t.x+t.width,y:t.y+t.height};return lineCollidesSector({start:i,end:s},e)||lineCollidesSector({start:n,end:r},e)}function radiiScalingFactor(t,e,i,s){if(i===0&&s===0)return 0;if(Math.asin(Math.abs(1*i)/(t+1*i))+Math.asin(Math.abs(1*s)/(t+1*s))-e<0)return 1;let r=0,o=1;for(let a=0;a<8;a+=1){const l=(r+o)/2;Math.asin(Math.abs(l*i)/(t+l*i))+Math.asin(Math.abs(l*s)/(t+l*s))-e<0?r=l:o=l}return r}var delta2=1e-6;function clockwiseAngle(t,e){return angleBetween(t,e)=2*Math.PI?2*Math.PI:normalizeAngle360(e-t);return t=clockwiseAngle(t,i),e=t+n,{startAngle:t,endAngle:e}}function arcRadialLineIntersectionAngle(t,e,i,s,n,r){const o=Math.sin(r),a=Math.cos(r),l=t**2+e**2-i**2;let c,h,u,d;if(a>.5){const v=o/a,b=1+v**2,S=-2*(t+e*v),A=S**2-4*b*l;if(A<0)return;const D=(-S+Math.sqrt(A))/(2*b),I=(-S-Math.sqrt(A))/(2*b);c=D,h=D*v,u=I,d=I*v}else{const v=a/o,b=1+v**2,S=-2*(e+t*v),A=S**2-4*b*l;if(A<0)return;const D=(-S+Math.sqrt(A))/(2*b),I=(-S-Math.sqrt(A))/(2*b);c=D*v,h=D,u=I*v,d=I}const p=a,g=o,m=c*p+h*g,y=u*p+d*g,f=m>0?clockwiseAngle(Math.atan2(h-e,c-t),s):NaN,x=y>0?clockwiseAngle(Math.atan2(d-e,u-t),s):NaN;if(f>=s&&f<=n)return f;if(x>=s&&x<=n)return x}function arcCircleIntersectionAngle(t,e,i,s,n,r){const o=Math.hypot(t,e),a=(o**2-i**2+r**2)/(2*o),l=o-a,c=Math.atan2(e,t),h=Math.acos(-l/i),u=clockwiseAngle(c+h,s),d=clockwiseAngle(c-h,s);if(u>=s&&u<=n)return u;if(d>=s&&d<=n)return d}var Arc=class{constructor(t,e,i,s,n){this.cx=t,this.cy=e,this.r=i,this.a0=s,this.a1=n,this.a0>=this.a1&&(this.a0=NaN,this.a1=NaN)}isValid(){return Number.isFinite(this.a0)&&Number.isFinite(this.a1)}pointAt(t){return{x:this.cx+this.r*Math.cos(t),y:this.cy+this.r*Math.sin(t)}}clipStart(t){t==null||!this.isValid()||t=this.a1)&&(this.a0=NaN,this.a1=NaN))}clipEnd(t){t==null||!this.isValid()||t>this.a1||(this.a1=t,(Number.isNaN(t)||this.a0>=this.a1)&&(this.a0=NaN,this.a1=NaN))}},Sector=class extends Path{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(t){this.concentricEdgeInset=t,this.radialEdgeInset=t}set cornerRadius(t){this.startOuterCornerRadius=t,this.endOuterCornerRadius=t,this.startInnerCornerRadius=t,this.endInnerCornerRadius=t}computeBBox(){return sectorBox(this).translate(this.centerX,this.centerY)}normalizedRadii(){const{concentricEdgeInset:t}=this;let{innerRadius:e,outerRadius:i}=this;return e=e>0?e+t:0,i=Math.max(i-t,0),{innerRadius:e,outerRadius:i}}normalizedClipSector(){const{clipSector:t}=this;if(t==null)return;const{startAngle:e,endAngle:i}=clockwiseAngles(this.startAngle,this.endAngle),{innerRadius:s,outerRadius:n}=this.normalizedRadii(),r=clockwiseAngles(t.startAngle,t.endAngle,e);return new SectorBox(Math.max(e,r.startAngle),Math.min(i,r.endAngle),Math.max(s,t.innerRadius),Math.min(n,t.outerRadius))}getAngleOffset(t){return t>0?this.radialEdgeInset/t:0}arc(t,e,i,s,n,r,o,a){if(t<=0)return;const{startAngle:l,endAngle:c}=clockwiseAngles(this.startAngle,this.endAngle),{innerRadius:h,outerRadius:u}=this.normalizedRadii(),d=this.normalizedClipSector();if(a&&h<=0)return;const p=a?this.getAngleOffset(h+t):this.getAngleOffset(u-t),g=o?l+p+e:c-p-e,m=a?h+t:u-t,y=m*Math.cos(g),f=m*Math.sin(g);if(d!=null&&(!o&&!(g>=l-1e-6&&g<=d.endAngle-1e-6)||o&&!(g>=d.startAngle+1e-6&&g<=c-1e-6)||a&&md.outerRadius+1e-6))return;const x=new Arc(y,f,t,i,s);if(d!=null){a?(x.clipStart(arcRadialLineIntersectionAngle(y,f,t,i,s,d.endAngle)),x.clipEnd(arcRadialLineIntersectionAngle(y,f,t,i,s,d.startAngle))):(x.clipStart(arcRadialLineIntersectionAngle(y,f,t,i,s,d.startAngle)),x.clipEnd(arcRadialLineIntersectionAngle(y,f,t,i,s,d.endAngle)));let D,I;if(o?(D=arcCircleIntersectionAngle(y,f,t,i,s,d.innerRadius),I=arcCircleIntersectionAngle(y,f,t,i,s,d.outerRadius)):(D=arcCircleIntersectionAngle(y,f,t,i,s,d.outerRadius),I=arcCircleIntersectionAngle(y,f,t,i,s,d.innerRadius)),x.clipStart(D),x.clipEnd(I),D!=null){const{x:L,y:N}=x.pointAt(D),T=clockwiseAngle(Math.atan2(N,L),l);o?r?.clipStart(T):n.clipEnd(T)}if(I!=null){const{x:L,y:N}=x.pointAt(I),T=clockwiseAngle(Math.atan2(N,L),l);o?n.clipStart(T):r?.clipEnd(T)}}if(d!=null){const{x:D,y:I}=x.pointAt((x.a0+x.a1)/2);if(!isPointInSector(D,I,d))return}const{x:v,y:b}=x.pointAt(o===a?x.a0:x.a1),S=clockwiseAngle(Math.atan2(b,v),l),A=a?r:n;return o?A?.clipStart(S):A?.clipEnd(S),x}updatePath(){const{path:e,centerX:i,centerY:s,concentricEdgeInset:n,radialEdgeInset:r}=this;let{startOuterCornerRadius:o,endOuterCornerRadius:a,startInnerCornerRadius:l,endInnerCornerRadius:c}=this;const{startAngle:h,endAngle:u}=clockwiseAngles(this.startAngle,this.endAngle),{innerRadius:d,outerRadius:p}=this.normalizedRadii(),g=this.normalizedClipSector(),m=u-h,y=m>=2*Math.PI-1e-6;if(e.clear(),d===0&&p===0||d>p)return;if((g?.startAngle??h)===(g?.endAngle??u))return;if(y&&this.clipSector==null&&o===0&&a===0&&l===0&&c===0){e.moveTo(i+p*Math.cos(h),s+p*Math.sin(h)),e.arc(i,s,p,h,u),d>n&&(e.moveTo(i+d*Math.cos(u),s+d*Math.sin(u)),e.arc(i,s,d,u,h,!0)),e.closePath();return}else if(this.clipSector==null&&Math.abs(d-p)<1e-6){e.arc(i,s,p,h,u,!1),e.arc(i,s,p,u,h,!0),e.closePath();return}const f=this.getAngleOffset(d),x=this.getAngleOffset(p);if(m<2*x)return;const b=(g?.innerRadius??d)>n,S=d0?Math.min(A/D,1):1;o*=I,a*=I,l*=I,c*=I;const L=radiiScalingFactor(p,m-2*x,-o,-a);if(o*=L,a*=L,!S&&b){const k=radiiScalingFactor(d,m-2*f,l,c);l*=k,c*=k}else l=0,c=0;const N=Math.max(o+l,a+c),T=N>0?Math.min(A/N,1):1;o*=T,a*=T,l*=T,c*=T;let w=0,O=0;const Z=o/(p-o),F=a/(p-a);if(Z>=0&&Z<1-1e-6)w=Math.asin(Z);else{w=m/2;const k=p/(1/Math.sin(w)+1);o=Math.min(k,o)}if(F>=0&&F<1-1e-6)O=Math.asin(F);else{O=m/2;const k=p/(1/Math.sin(O)+1);a=Math.min(k,a)}const U=Math.asin(l/(d+l)),W=Math.asin(c/(d+c)),H=g?.outerRadius??p,_=this.getAngleOffset(H),E=new Arc(0,0,H,h+_,u-_),P=g?.innerRadius??d,G=this.getAngleOffset(P),V=b?new Arc(0,0,P,h+G,u-G):void 0;g!=null&&(E.clipStart(g.startAngle),E.clipEnd(g.endAngle),V?.clipStart(g.startAngle),V?.clipEnd(g.endAngle));const Y=this.arc(o,w,h-Math.PI*.5,h+w,E,V,!0,!1),$=this.arc(a,O,u-O,u+Math.PI*.5,E,V,!1,!1),j=this.arc(c,W,u+Math.PI*.5,u+Math.PI-W,E,V,!1,!0),B=this.arc(l,U,h+Math.PI+U,h+Math.PI*1.5,E,V,!0,!0);if(S){const k=m0&&k({innerRadius:n[0],outerRadius:n[0]+(n[1]-n[0])*g}),c=({radius:g})=>({innerRadius:r[0],outerRadius:r[0]+(r[1]-r[0])*g});return{nodes:{toFn:(g,m,y,{prevLive:f})=>{let{startAngle:x,endAngle:v,innerRadius:b,outerRadius:S}=m;const{stroke:A,fill:D}=m.sectorFormat;if(y==="removed"&&f?(x=f.datum?.endAngle,v=f.datum?.endAngle):y==="removed"&&!f&&(x=o,v=o),y==="removed"){const I=l(m);b=I.innerRadius,S=I.outerRadius}return{startAngle:x,endAngle:v,outerRadius:S,innerRadius:b,stroke:A,fill:D}},fromFn:(g,m,y,{prevFromProps:f})=>{let{startAngle:x,endAngle:v,innerRadius:b,outerRadius:S}=g,{fill:A,stroke:D}=m.sectorFormat;if(y==="unknown"||y==="added"&&!f?(x=o,v=o,b=m.innerRadius,S=m.outerRadius):y==="added"&&f&&(x=f.endAngle??o,v=f.endAngle??o,b=f.innerRadius??m.innerRadius,S=f.outerRadius??m.outerRadius),y==="added"&&!t){const I=c(m);b=I.innerRadius,S=I.outerRadius}return y==="updated"&&(A=g.fill??A,D=(typeof g.stroke=="string"?g.stroke:void 0)??D),{startAngle:x,endAngle:v,innerRadius:b,outerRadius:S,fill:A,stroke:D,phase:a}}},innerCircle:{fromFn:(g,m)=>({size:g.previousDatum?.radius??g.size??0,phase:a}),toFn:(g,m)=>({size:m.radius??0})}}}function resetPieSelectionsFn(t,e){return{startAngle:e.startAngle,endAngle:e.endAngle,innerRadius:e.innerRadius,outerRadius:e.outerRadius,fill:e.sectorFormat.fill,stroke:e.sectorFormat.stroke}}function pickByMatchingAngle(t,e){const i=e.y-t.centerY,s=e.x-t.centerX,n=Math.atan2(i,s),r=t.getItemNodes();for(const o of r)if(o.datum.missing!==!0&&isBetweenAngles(n,o.startAngle,o.endAngle)){const a=Math.sqrt(s*s+i*i);let l=0;return ao.outerRadius&&(l=a-o.outerRadius),{datum:o.datum,distance:l}}}var PolarZIndexMap=(t=>(t[t.BACKGROUND=0]="BACKGROUND",t[t.FOREGROUND=1]="FOREGROUND",t[t.HIGHLIGHT=2]="HIGHLIGHT",t[t.LABEL=3]="LABEL",t))(PolarZIndexMap||{}),PolarSeries=class extends DataModelSeries{constructor({useLabelLayer:t=!1,pickModes:e=[1,0],canHaveAxes:i=!1,animationResetFns:s,...n}){super({...n,useLabelLayer:t,pickModes:e,directionKeys:{x:["angleKey"],y:["radiusKey"]},directionNames:{x:["angleName"],y:["radiusName"]},canHaveAxes:i}),this.itemGroup=this.contentGroup.appendChild(new Group),this.nodeData=[],this.itemSelection=Selection.select(this.itemGroup,()=>this.nodeFactory(),!1),this.labelSelection=Selection.select(this.labelGroup,()=>this.labelFactory(),!1),this.highlightSelection=Selection.select(this.highlightGroup,()=>this.nodeFactory()),this.highlightLabelSelection=Selection.select(this.highlightLabel,()=>this.labelFactory()),this.centerX=0,this.centerY=0,this.radius=0,this.animationResetFns=s,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:r=>this.animateEmptyUpdateReady(r)},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",highlight:r=>this.animateReadyHighlight(r),highlightMarkers:r=>this.animateReadyHighlightMarkers(r),resize:r=>this.animateReadyResize(r),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:r=>this.animateWaitingUpdateReady(r)},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:r=>this.animateClearingUpdateEmpty(r)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}getItemNodes(){return[...this.itemGroup.children()]}getNodeData(){return this.nodeData}setSeriesIndex(t){return super.setSeriesIndex(t)?(this.contentGroup.zIndex=[t,1],this.highlightGroup.zIndex=[t,2],this.labelGroup.zIndex=[t,3],!0):!1}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}labelFactory(){const t=new Text;return t.pointerEvents=1,t}addChartEventListeners(){this.destroyFns.push(this.ctx.chartEventManager?.addListener("legend-item-click",t=>this.onLegendItemClick(t)))}getInnerRadius(){return 0}computeLabelsBBox(t,e){return null}resetAllAnimation(){const{item:t,label:e}=this.animationResetFns??{};this.ctx.animationManager.stopByAnimationGroupId(this.id),t&&resetMotion([this.itemSelection,this.highlightSelection],t),e&&resetMotion([this.labelSelection,this.highlightLabelSelection],e),this.itemSelection.cleanup(),this.labelSelection.cleanup(),this.highlightSelection.cleanup(),this.highlightLabelSelection.cleanup()}animateEmptyUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateWaitingUpdateReady(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}animateReadyHighlight(t){const{item:e,label:i}=this.animationResetFns??{};e&&resetMotion([this.highlightSelection],e),i&&resetMotion([this.highlightLabelSelection],i)}animateReadyHighlightMarkers(t){}animateReadyResize(t){this.resetAllAnimation()}animateClearingUpdateEmpty(t){this.ctx.animationManager.skipCurrentBatch(),this.resetAllAnimation()}computeFocusBounds(t){const e=this.getNodeData()?.[t.datumIndex];if(e!==void 0)return this.itemSelection.select(i=>i instanceof Path&&i.datum===e)[0]}getSeriesRange(t,e){return[NaN,NaN]}},DonutSeriesNodeEvent=class extends SeriesNodeEvent{constructor(t,e,i,s){super(t,e,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey,this.calloutLabelKey=s.properties.calloutLabelKey,this.sectorLabelKey=s.properties.sectorLabelKey}},DonutSeries=class extends PolarSeries{constructor(t){super({moduleCtx:t,pickModes:[1,0],useLabelLayer:!0,animationResetFns:{item:resetPieSelectionsFn,label:resetLabelFn}}),this.properties=new DonutSeriesProperties,this.phantomNodeData=void 0,this.backgroundGroup=new TranslatableGroup({name:`${this.id}-background`,zIndex:0}),this.noVisibleData=!1,this.previousRadiusScale=new LinearScale,this.radiusScale=new LinearScale,this.phantomGroup=this.backgroundGroup.appendChild(new Group({name:"phantom"})),this.phantomSelection=Selection.select(this.phantomGroup,()=>this.nodeFactory(),!1),this.calloutLabelGroup=this.contentGroup.appendChild(new Group({name:"pieCalloutLabels"})),this.calloutLabelSelection=new Selection(this.calloutLabelGroup,Group),this.zerosumRingsGroup=this.backgroundGroup.appendChild(new Group({name:`${this.id}-zerosumRings`})),this.zerosumOuterRing=this.zerosumRingsGroup.appendChild(new Marker({shape:"circle"})),this.zerosumInnerRing=this.zerosumRingsGroup.appendChild(new Marker({shape:"circle"})),this.innerLabelsGroup=this.contentGroup.appendChild(new Group({name:"innerLabels"})),this.innerCircleGroup=this.backgroundGroup.appendChild(new Group({name:`${this.id}-innerCircle`})),this.innerLabelsSelection=Selection.select(this.innerLabelsGroup,Text),this.innerCircleSelection=Selection.select(this.innerCircleGroup,()=>new Marker({shape:"circle"})),this.surroundingRadius=void 0,this.NodeEvent=DonutSeriesNodeEvent,this.angleScale=new LinearScale,this.angleScale.domain=[0,1],this.angleScale.range=[-Math.PI,Math.PI].map(e=>e+Math.PI/2),this.phantomGroup.opacity=.2}get calloutNodeData(){return this.phantomNodeData??this.nodeData}attachSeries(t,e,i){super.attachSeries(t,e,i),t?.appendChild(this.backgroundGroup)}detachSeries(t,e,i){super.detachSeries(t,e,i),t?.removeChild(this.backgroundGroup)}setSeriesIndex(t){return super.setSeriesIndex(t)?(this.backgroundGroup.zIndex=[0,t],!0):!1}nodeFactory(){return new Sector}getSeriesDomain(t){return t==="x"?this.angleScale.domain:this.radiusScale.domain}async processData(t){if(this.data==null||!this.properties.isValid())return;const{visible:e,id:i}=this,{angleKey:s,angleFilterKey:n,radiusKey:r,calloutLabelKey:o,sectorLabelKey:a,legendItemKey:l}=this.properties,c=(m,y,f)=>e&&this.ctx.legendManager.getItemEnabled({seriesId:i,itemId:f}),h=!this.ctx.animationManager.isSkipped(),u=[],d=[];l?u.push(keyProperty(l,"band",{id:"legendItemKey"})):o?u.push(keyProperty(o,"band",{id:"calloutLabelKey"})):a&&u.push(keyProperty(a,"band",{id:"sectorLabelKey"}));const p=this.radiusScale.type,g=this.angleScale.type;r&&d.push(rangedValueProperty(r,{id:"radiusValue",min:this.properties.radiusMin??0,max:this.properties.radiusMax}),valueProperty(r,p,{id:"radiusRaw"}),normalisePropertyTo("radiusValue",[0,1],1,this.properties.radiusMin??0,this.properties.radiusMax)),o&&d.push(valueProperty(o,"band",{id:"calloutLabelValue"})),a&&d.push(valueProperty(a,"band",{id:"sectorLabelValue"})),l&&d.push(valueProperty(l,"band",{id:"legendItemValue"})),n&&d.push(accumulativeValueProperty(n,g,{id:"angleFilterValue",onlyPositive:!0,validation:c,invalidValue:0}),valueProperty(n,g,{id:"angleFilterRaw"}),normalisePropertyTo("angleFilterValue",[0,1],0,0)),h&&this.processedData&&u.length>0&&d.push(diff(this.id,this.processedData)),d.push(animationValidation()),await this.requestDataModel(t,this.data,{props:[...u,accumulativeValueProperty(s,g,{id:"angleValue",onlyPositive:!0,validation:c,invalidValue:0}),valueProperty(s,g,{id:"angleRaw"}),normalisePropertyTo("angleValue",[0,1],0,0),...d]});for(const m of this.processedData?.defs?.values??[]){const{id:y,missing:f,property:x}=m,v=getMissCount(this,f);y!=="angleRaw"&&v>0&&logger_exports.warnOnce(`no value was found for the key '${String(x)}' on ${v} data element${v>1?"s":""}`)}this.animationState.transition("updateData")}maybeRefreshNodeData(){if(!this.nodeDataRefresh)return;const{nodeData:t=[],phantomNodeData:e}=this.createNodeData()??{};this.nodeData=t,this.phantomNodeData=e,this.nodeDataRefresh=!1}getProcessedDataValues(t,e){const i=t.resolveColumnById(this,"angleValue",e),s=t.resolveColumnById(this,"angleRaw",e),n=this.properties.angleFilterKey!=null?t.resolveColumnById(this,"angleFilterValue",e):void 0,r=this.properties.angleFilterKey!=null?t.resolveColumnById(this,"angleFilterRaw",e):void 0,o=this.properties.radiusKey?t.resolveColumnById(this,"radiusValue",e):void 0,a=this.properties.radiusKey?t.resolveColumnById(this,"radiusRaw",e):void 0,l=this.properties.calloutLabelKey?t.resolveColumnById(this,"calloutLabelValue",e):void 0,c=this.properties.sectorLabelKey?t.resolveColumnById(this,"sectorLabelValue",e):void 0,h=this.properties.legendItemKey?t.resolveColumnById(this,"legendItemValue",e):void 0;return{angleValues:i,angleRawValues:s,angleFilterValues:n,angleFilterRawValues:r,radiusValues:o,radiusRawValues:a,calloutLabelValues:l,sectorLabelValues:c,legendItemValues:h}}createNodeData(){const{id:t,processedData:e,dataModel:i,angleScale:s,ctx:{legendManager:n},visible:r}=this,{rotation:o,innerRadiusRatio:a}=this.properties;if(!this.properties.isValid())return this.zerosumOuterRing.visible=!0,this.zerosumInnerRing.visible=!0,{itemId:t,nodeData:[],labelData:[]};if(!i||e?.type!=="ungrouped")return;const{angleValues:l,angleRawValues:c,angleFilterValues:h,angleFilterRawValues:u,radiusValues:d,radiusRawValues:p,calloutLabelValues:g,sectorLabelValues:m,legendItemValues:y}=this.getProcessedDataValues(i,e),f=u?.some((I,L)=>I>c[L])??!1;let x=0,v=0;const b=[],S=u!=null?[]:void 0,A=e.dataSources.get(this.id)??[],D=e.invalidData?.get(this.id);return A.forEach((I,L)=>{if(D?.[L]===!0)return;const N=f?h[L]:l[L],T=u!=null&&!f?Math.sqrt(u[L]/c[L]):1,w=s.convert(x)+toRadians(o);x=N,v+=N;const O=s.convert(x)+toRadians(o),Z=Math.abs(O-w),F=w+Z/2,U=c[L],H=(d?.[L]??1)*T,_=p?.[L],E=y?.[L],P=this.getLabels(I,F,Z,!0,g?.[L],m?.[L],E),G=this.getSectorFormat(I,L,!1),V={itemId:L,series:this,datum:I,datumIndex:L,angleValue:U,midAngle:F,midCos:Math.cos(F),midSin:Math.sin(F),startAngle:w,endAngle:O,radius:H,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(H),0),sectorFormat:G,radiusValue:_,legendItemValue:E,enabled:r&&n.getItemEnabled({seriesId:t,itemId:L}),focusable:!0,...P};b.push(V),S?.push({...V,radius:1,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(1),0),focusable:!1})}),this.zerosumOuterRing.visible=v===0,this.zerosumInnerRing.visible=v===0&&a!=null&&a!==1&&a>0,{itemId:t,nodeData:b,labelData:b,phantomNodeData:S}}getLabels(t,e,i,s,n,r,o){const{calloutLabel:a,sectorLabel:l,legendItemKey:c}=this.properties,h=!s||a.enabled?this.properties.calloutLabelKey:void 0,u=!s||l.enabled?this.properties.sectorLabelKey:void 0;if(!h&&!u&&!c)return{};const d={datum:t,angleKey:this.properties.angleKey,angleName:this.properties.angleName,radiusKey:this.properties.radiusKey,radiusName:this.properties.radiusName,calloutLabelKey:this.properties.calloutLabelKey,calloutLabelName:this.properties.calloutLabelName,sectorLabelKey:this.properties.sectorLabelKey,sectorLabelName:this.properties.sectorLabelName,legendItemKey:this.properties.legendItemKey},p={};return h&&i>=toRadians(a.minAngle)&&(p.calloutLabel={...this.getTextAlignment(e),text:this.getLabelText(a,{...d,value:n}),hidden:!1,collisionTextAlign:void 0,collisionOffsetY:0,box:void 0}),u&&(p.sectorLabel={text:this.getLabelText(l,{...d,value:r})}),c!=null&&o!=null&&(p.legendItem={key:c,text:o}),p}getTextAlignment(t){const e=[{textAlign:"center",textBaseline:"bottom"},{textAlign:"left",textBaseline:"middle"},{textAlign:"center",textBaseline:"hanging"},{textAlign:"right",textBaseline:"middle"}],i=normalizeAngle180(t),s=-.75*Math.PI,n=i-s,r=Math.floor(n/(Math.PI/2)),o=mod(r,e.length);return e[o]}getSectorFormat(t,e,i){const{angleKey:s,radiusKey:n,calloutLabelKey:r,sectorLabelKey:o,legendItemKey:a,fills:l,strokes:c,itemStyler:h}=this.properties,u=c[e%c.length],{fill:d,fillOpacity:p,stroke:g,strokeWidth:m,strokeOpacity:y,lineDash:f,lineDashOffset:x,cornerRadius:v}=mergeDefaults(i&&this.properties.highlightStyle.item,{fill:l.length>0?l[e%l.length]:void 0,stroke:u,strokeWidth:this.getStrokeWidth(this.properties.strokeWidth),strokeOpacity:this.getOpacity()},this.properties);let b;return h&&(b=this.cachedDatumCallback(this.getDatumId(t,e)+(i?"-highlight":"-hide"),()=>h({datum:t,angleKey:s,radiusKey:n,calloutLabelKey:r,sectorLabelKey:o,legendItemKey:a,fill:d,fillOpacity:p,stroke:g,strokeWidth:m,strokeOpacity:y,lineDash:f,lineDashOffset:x,cornerRadius:v,highlighted:i,seriesId:this.id}))),{fill:b?.fill??d,fillOpacity:b?.fillOpacity??p,stroke:b?.stroke??g,strokeWidth:b?.strokeWidth??m,strokeOpacity:b?.strokeOpacity??y,lineDash:b?.lineDash??f,lineDashOffset:b?.lineDashOffset??x,cornerRadius:b?.cornerRadius??v}}getInnerRadius(){const{radius:t}=this,{innerRadiusRatio:e=1,innerRadiusOffset:i=0}=this.properties,s=t*e+i;return s===t||s<0?0:s}getOuterRadius(){const{outerRadiusRatio:t,outerRadiusOffset:e}=this.properties;return Math.max(this.radius*t+e,0)}updateRadiusScale(t){const e=[this.getInnerRadius(),this.getOuterRadius()];this.radiusScale.range=e,t&&(this.previousRadiusScale.range=e);const i=s=>({...s,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(s.radius),0)});this.nodeData=this.nodeData.map(i),this.phantomNodeData=this.phantomNodeData?.map(i)}getTitleTranslationY(){const t=Math.max(0,this.radiusScale.range[1]);if(t===0)return NaN;const i=2+(this.properties.title?.spacing??0),s=Math.max(0,-t);return-t-i-s}update({seriesRect:t}){const{title:e}=this.properties,i={seriesRectWidth:t?.width,seriesRectHeight:t?.height},s=jsonDiff(this.nodeDataDependencies,i)!=null;if(s&&(this._nodeDataDependencies=i),this.maybeRefreshNodeData(),this.updateTitleNodes(),this.updateRadiusScale(s),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.backgroundGroup.translationX=this.centerX,this.backgroundGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),e){const n=this.getTitleTranslationY();e.node.y=isFinite(n)?n:0;const r=e.node.getBBox();e.node.visible=e.enabled&&isFinite(n)&&!this.bboxIntersectsSurroundingSeries(r)}for(const n of[this.zerosumInnerRing,this.zerosumOuterRing])n.fillOpacity=0,n.stroke=this.properties.calloutLabel.color,n.strokeWidth=1,n.strokeOpacity=1;this.updateNodeMidPoint(),this.updateSelections(),this.updateNodes(t)}updateTitleNodes(){const{oldTitle:t}=this,{title:e}=this.properties;t!==e&&(t&&this.labelGroup?.removeChild(t.node),e&&(e.node.textBaseline="bottom",this.labelGroup?.appendChild(e.node)),this.oldTitle=e)}updateNodeMidPoint(){const t=e=>{const i=e.innerRadius+(e.outerRadius-e.innerRadius)/2;e.midPoint={x:e.midCos*Math.max(0,i),y:e.midSin*Math.max(0,i)}};this.nodeData.forEach(t),this.phantomNodeData?.forEach(t)}updateSelections(){this.updateGroupSelection(),this.updateInnerCircleSelection()}updateGroupSelection(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,highlightLabelSelection:s,calloutLabelSelection:n,labelSelection:r,innerLabelsSelection:o}=this,a=this.nodeData.map(c=>({...c,sectorFormat:{...c.sectorFormat}})),l=(c,h)=>{c.update(h,void 0,u=>this.getDatumId(u.datum,u.datumIndex)),this.ctx.animationManager.isSkipped()&&c.cleanup()};l(t,this.nodeData),l(e,a),l(i,this.phantomNodeData??[]),n.update(this.calloutNodeData,c=>{const h=new Line;h.tag=0,h.pointerEvents=1,c.appendChild(h);const u=new Text;u.tag=1,u.pointerEvents=1,c.appendChild(u)}),r.update(this.nodeData),s.update(a),o.update(this.properties.innerLabels,c=>{c.pointerEvents=1})}updateInnerCircleSelection(){const{innerCircle:t}=this.properties;let e=0;const i=this.getInnerRadius();if(i>0){const n=Math.min(i,this.getOuterRadius()),r=1;e=Math.ceil(n*2+r)}const s=t?[{radius:e}]:[];this.innerCircleSelection.update(s)}updateNodes(t){const e=this.ctx.highlightManager.getActiveHighlight(),{visible:i}=this;this.backgroundGroup.visible=i,this.contentGroup.visible=i,this.highlightGroup.visible=i&&e?.series===this,this.highlightLabel.visible=i&&e?.series===this,this.labelGroup.visible=i,this.contentGroup.opacity=this.getOpacity(),this.innerCircleSelection.each((r,{radius:o})=>{r.setProperties({fill:this.properties.innerCircle?.fill,opacity:this.properties.innerCircle?.fillOpacity,size:o})});const s=this.ctx.animationManager.isSkipped(),n=(r,o,a,l)=>{const c=this.getSectorFormat(o.datum,o.itemId,l);o.sectorFormat.fill=c.fill,o.sectorFormat.stroke=c.stroke,s&&(r.startAngle=o.startAngle,r.endAngle=o.endAngle,r.innerRadius=o.innerRadius,r.outerRadius=o.outerRadius),(l||s)&&(r.fill=c.fill,r.stroke=c.stroke),r.strokeWidth=c.strokeWidth,r.fillOpacity=c.fillOpacity,r.strokeOpacity=c.strokeOpacity,r.lineDash=c.lineDash,r.lineDashOffset=c.lineDashOffset,r.cornerRadius=c.cornerRadius,r.fillShadow=this.properties.shadow;const h=Math.max((this.properties.sectorSpacing+(c.stroke!=null?c.strokeWidth:0))/2,0);r.inset=h,r.lineJoin=this.properties.sectorSpacing>=0||h>0?"miter":"round"};this.itemSelection.each((r,o,a)=>n(r,o,a,!1)),this.highlightSelection.each((r,o,a)=>{n(r,o,a,!0),r.visible=o.itemId===e?.itemId}),this.phantomSelection.each((r,o,a)=>n(r,o,a,!1)),this.updateCalloutLineNodes(),this.updateCalloutLabelNodes(t),this.updateSectorLabelNodes(),this.updateInnerLabelNodes(),this.updateZerosumRings(),this.animationState.transition("update")}updateCalloutLineNodes(){const{calloutLine:t}=this.properties,e=t.length,i=t.strokeWidth,s=t.colors??this.properties.strokes,{offset:n}=this.properties.calloutLabel;this.calloutLabelSelection.selectByTag(0).forEach((r,o)=>{const a=r.datum,{calloutLabel:l,outerRadius:c}=a;if(l?.text&&!l.hidden&&c!==0){r.visible=!0,r.strokeWidth=i,r.stroke=s[o%s.length],r.fill=void 0;const h=a.midCos*c,u=a.midSin*c;let d=a.midCos*(c+e),p=a.midSin*(c+e);if((l.collisionTextAlign??l.collisionOffsetY!==0)&&l.box!=null){const m=l.box;let y=d,f=p;dm.x+m.width&&(y=m.x+m.width),pm.y+m.height&&(f=m.y+m.height);const x=y-d,v=f-p,b=Math.sqrt(Math.pow(x,2)+Math.pow(v,2)),S=b-n;S>0&&(d=d+x*S/b,p=p+v*S/b)}r.x1=h,r.y1=u,r.x2=d,r.y2=p}else r.visible=!1})}getLabelOverflow(t,e,i){const s=-this.centerX,n=s+i.width,r=-this.centerY,o=r+i.height,a=1;let l=1;e.x+an&&(l=(n-e.x)/e.width);const c=e.y+ao,h=l===1?t.length:Math.floor(t.length*l)-1,u=this.bboxIntersectsSurroundingSeries(e);return{textLength:h,hasVerticalOverflow:c,hasSurroundingSeriesOverflow:u}}bboxIntersectsSurroundingSeries(t){const{surroundingRadius:e}=this;if(e==null)return!1;const i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],s=e**2;return i.some(n=>n.x**2+n.y**2>s)}computeCalloutLabelCollisionOffsets(){const{radiusScale:t}=this,{calloutLabel:e,calloutLine:i}=this.properties,{offset:s,minSpacing:n}=e,r=t.convert(0),o=f=>!f.calloutLabel||f.outerRadius===0,a=this.calloutNodeData,l=a.filter(f=>!o(f));if(l.forEach(f=>{const x=f.calloutLabel;x!=null&&(x.hidden=!1,x.collisionTextAlign=void 0,x.collisionOffsetY=0)}),l.length<=1)return;const c=l.filter(f=>f.midCos<0).sort((f,x)=>f.midSin-x.midSin),h=l.filter(f=>f.midCos>=0).sort((f,x)=>f.midSin-x.midSin),u=l.filter(f=>f.midSin<0&&f.calloutLabel?.textAlign==="center").sort((f,x)=>f.midCos-x.midCos),d=l.filter(f=>f.midSin>=0&&f.calloutLabel?.textAlign==="center").sort((f,x)=>f.midCos-x.midCos),p=f=>{const x=f.calloutLabel;if(x==null)return BBox.zero.clone();const v=f.outerRadius+i.length+s,b=f.midCos*v,S=f.midSin*v+x.collisionOffsetY,A=x.collisionTextAlign??x.textAlign,D=x.textBaseline;return Text.computeBBox(x.text,b,S,{font:this.properties.calloutLabel,textAlign:A,textBaseline:D})},g=(f,x,v)=>{const b=p(f).grow(n/2),S=p(x).grow(n/2);b.xS.x&&(v==="to-top"?b.yS.y)&&(x.calloutLabel.collisionOffsetY=v==="to-top"?b.y-S.y-S.height:b.y+b.height-S.y)},m=f=>{const x=f.slice().sort((b,S)=>Math.abs(b.midSin)-Math.abs(S.midSin))[0],v=f.indexOf(x);for(let b=v-1;b>=0;b--){const S=f[b+1],A=f[b];g(S,A,"to-top")}for(let b=v+1;b{const x=l.some(I=>I.calloutLabel.collisionOffsetY!==0),v=f.map(I=>p(I)),b=v.map(I=>I.clone().grow(n/2));let S=!1;for(let I=0;I{const{startAngle:L,endAngle:N,outerRadius:T}=I;return{startAngle:L,endAngle:N,innerRadius:r,outerRadius:T}}),D=v.some(I=>A.some(L=>boxCollidesSector(I,L)));!S&&!x&&!D||f.filter(I=>I.calloutLabel.textAlign==="center").forEach(I=>{const L=I.calloutLabel;I.midCos<0?L.collisionTextAlign="right":I.midCos>0?L.collisionTextAlign="left":L.collisionTextAlign="center"})};m(c),m(h),y(u),y(d)}updateCalloutLabelNodes(t){const{radiusScale:e}=this,{calloutLabel:i,calloutLine:s}=this.properties,n=s.length,{offset:r,color:o}=i,a=new Text;this.calloutLabelSelection.selectByTag(1).forEach(l=>{const{datum:c}=l,h=c.calloutLabel,u=e.convert(c.radius),d=Math.max(0,u);if(!h?.text||d===0||h.hidden){l.visible=!1;return}const p=d+n+r,g=c.midCos*p,m=c.midSin*p+h.collisionOffsetY,y={textAlign:h.collisionTextAlign??h.textAlign,textBaseline:h.textBaseline};a.text=h.text,a.x=g,a.y=m,a.setFont(this.properties.calloutLabel),a.setAlign(y);const f=a.getBBox();let x=h.text,v=!0;if(i.avoidCollisions){const{textLength:b,hasVerticalOverflow:S}=this.getLabelOverflow(h.text,f,t);x=h.text.length===b?h.text:`${h.text.substring(0,b)}\u2026`,v=!S}l.text=x,l.x=g,l.y=m,l.setFont(this.properties.calloutLabel),l.setAlign(y),l.fill=o,l.visible=v})}computeLabelsBBox(t,e){const{calloutLabel:i,calloutLine:s}=this.properties,n=s.length,{offset:r,maxCollisionOffset:o,minSpacing:a}=i;if(!i.avoidCollisions)return null;this.maybeRefreshNodeData(),this.updateRadiusScale(!1),this.computeCalloutLabelCollisionOffsets();const l=[],c=new Text;let h;const{title:u}=this.properties;if(u?.text&&u.enabled){const d=this.getTitleTranslationY();isFinite(d)&&(c.text=u.text,c.x=0,c.y=d,c.setFont(u),c.setAlign({textBaseline:"bottom",textAlign:"center"}),h=c.getBBox(),l.push(h))}return this.calloutNodeData.forEach(d=>{const p=d.calloutLabel;if(!p||d.outerRadius===0)return null;const g=d.outerRadius+n+r,m=d.midCos*g,y=d.midSin*g+p.collisionOffsetY;c.text=p.text,c.x=m,c.y=y,c.setFont(this.properties.calloutLabel),c.setAlign({textAlign:p.collisionTextAlign??p.textAlign,textBaseline:p.textBaseline});const f=c.getBBox();if(p.box=f,Math.abs(p.collisionOffsetY)>o){p.hidden=!0;return}if(h){const x=-this.centerY,v=new BBox(h.x-a,x,h.width+2*a,h.y+h.height+a-x);if(f.collidesBBox(v)){p.hidden=!0;return}}if(t.hideWhenNecessary){const{textLength:x,hasVerticalOverflow:v,hasSurroundingSeriesOverflow:b}=this.getLabelOverflow(p.text,f,e),S=p.text.length>2&&x<2;if(v||S||b){p.hidden=!0;return}}p.hidden=!1,l.push(f)}),l.length===0?null:BBox.merge(l)}updateSectorLabelNodes(){const{radiusScale:t}=this,e=t.convert(0),{fontSize:i,fontStyle:s,fontWeight:n,fontFamily:r,positionOffset:o,positionRatio:a,color:l}=this.properties.sectorLabel,c=(h,u)=>{const{sectorLabel:d,outerRadius:p}=u;let g=!1;if(d&&p!==0){const m=e*(1-a)+p*a+o;h.fill=l,h.fontStyle=s,h.fontWeight=n,h.fontSize=i,h.fontFamily=r,h.text=d.text,h.x=u.midCos*m,h.y=u.midSin*m,h.textAlign="center",h.textBaseline="middle";const y=h.getBBox(),f=[[y.x,y.y],[y.x+y.width,y.y],[y.x+y.width,y.y+y.height],[y.x,y.y+y.height]],{startAngle:x,endAngle:v}=u,b={startAngle:x,endAngle:v,innerRadius:e,outerRadius:p};f.every(([S,A])=>isPointInSector(S,A,b))&&(g=!0)}h.visible=g};this.labelSelection.each(c),this.highlightLabelSelection.each(c)}updateInnerLabelNodes(){const t=[],e=[];this.innerLabelsSelection.each((h,u)=>{const{fontStyle:d,fontWeight:p,fontSize:g,fontFamily:m,color:y}=u;h.fontStyle=d,h.fontWeight=p,h.fontSize=g,h.fontFamily=m,h.text=u.text,h.x=0,h.y=0,h.fill=y,h.textAlign="center",h.textBaseline="alphabetic",t.push(h.getBBox()),e.push(u.spacing)});const i=h=>h===0?0:e[h],s=h=>h===e.length-1?0:e[h],n=t.reduce((h,u,d)=>h+u.height+i(d)+s(d),0),r=Math.max(...t.map(h=>h.width)),o=this.getInnerRadius(),l=Math.sqrt(Math.pow(r/2,2)+Math.pow(n/2,2))<=(o>0?o:this.getOuterRadius()),c=[];for(let h=0,u=-n/2;h{h.y=c[d],h.visible=l})}updateZerosumRings(){this.zerosumOuterRing.size=this.getOuterRadius()*2,this.zerosumInnerRing.size=this.getInnerRadius()*2}pickNodeClosestDatum(t){return pickByMatchingAngle(this,t)}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,properties:n}=this,{legendItemKey:r,calloutLabelKey:o,calloutLabelName:a,sectorLabelKey:l,sectorLabelName:c,angleKey:h,angleName:u,radiusKey:d,radiusName:p,tooltip:g}=n,m=this.properties.title.text;if(!i||!s)return;const{datumIndex:y}=t,f=s.dataSources.get(this.id)?.[y],{angleRawValues:x,legendItemValues:v,calloutLabelValues:b,sectorLabelValues:S}=this.getProcessedDataValues(i,s),A=x[y],D=v?.[y]??(o===h?void 0:b?.[y])??(l===h?void 0:S?.[y])??u;return g.formatTooltip({title:m,symbol:this.legendItemSymbol(y),data:[{label:D,fallbackLabel:h,value:formatValue(A,3)}]},{seriesId:e,datum:f,title:u,legendItemKey:r,calloutLabelKey:o,calloutLabelName:a,sectorLabelKey:l,sectorLabelName:c,angleKey:h,angleName:u,radiusKey:d,radiusName:p,...this.getSectorFormat(f,y,!1)})}legendItemSymbol(t){const e=this.processedData?.dataSources.get(this.id)?.[t],i=this.getSectorFormat(e,t,!1);return{marker:{fill:i.fill,stroke:i.stroke,fillOpacity:this.properties.fillOpacity,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth,lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset}}}getLegendData(t){const{visible:e,processedData:i,dataModel:s,id:n,ctx:{legendManager:r}}=this;if(!s||!i||!this.properties.isValid()||t!=="category")return[];const{angleKey:o,calloutLabelKey:a,sectorLabelKey:l,legendItemKey:c,showInLegend:h}=this.properties;if(!c&&(!a||a===o)&&(!l||l===o))return[];const{angleRawValues:u,calloutLabelValues:d,sectorLabelValues:p,legendItemValues:g}=this.getProcessedDataValues(s,i),m=this.properties.title?.showInLegend&&this.properties.title.text,y=[],f=this.properties.hideZeroValueSectorsInLegend,x=i.dataSources.get(this.id),v=i.invalidData?.get(this.id);for(let b=0;bi.toggleItem({enabled:n,seriesId:e,itemId:r})),i.update(),s.update(4)}animateEmptyUpdateReady(t){const{animationManager:e}=this.ctx,i=preparePieSeriesAnimationFunctions(!0,this.properties.rotation,this.radiusScale,this.previousRadiusScale);fromToMotion(this.id,"nodes",e,[this.itemSelection,this.highlightSelection,this.phantomSelection],i.nodes,(s,n)=>this.getDatumId(n.datum,n.datumIndex)),fromToMotion(this.id,"innerCircle",e,[this.innerCircleSelection],i.innerCircle),seriesLabelFadeInAnimation(this,"callout",e,this.calloutLabelSelection),seriesLabelFadeInAnimation(this,"sector",e,this.labelSelection),seriesLabelFadeInAnimation(this,"highlight",e,this.highlightLabelSelection),seriesLabelFadeInAnimation(this,"inner",e,this.innerLabelsSelection),this.previousRadiusScale.range=this.radiusScale.range}animateWaitingUpdateReady(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,processedData:s,radiusScale:n,previousRadiusScale:r}=this,{animationManager:o}=this.ctx,a=s?.reduced?.diff?.[this.id];this.ctx.animationManager.stopByAnimationGroupId(this.id);const l=(a?.moved.size??0)===0,c=(s?.defs.keys.length??0)>0,h=s?.reduced?.animationValidation?.uniqueKeys??!0;(!l||!c||!h)&&this.ctx.animationManager.skipCurrentBatch();const u=!this.nodeData.some(p=>p.enabled),d=preparePieSeriesAnimationFunctions(!1,this.properties.rotation,n,r);fromToMotion(this.id,"nodes",o,[t,e,i],d.nodes,(p,g)=>this.getDatumId(g.datum,g.datumIndex),a),fromToMotion(this.id,"innerCircle",o,[this.innerCircleSelection],d.innerCircle),seriesLabelFadeInAnimation(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),seriesLabelFadeInAnimation(this,"sector",this.ctx.animationManager,this.labelSelection),seriesLabelFadeInAnimation(this,"highlight",this.ctx.animationManager,this.highlightLabelSelection),this.noVisibleData!==u&&(this.noVisibleData=u,seriesLabelFadeInAnimation(this,"inner",this.ctx.animationManager,this.innerLabelsSelection)),this.previousRadiusScale.range=this.radiusScale.range}animateClearingUpdateEmpty(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,radiusScale:s,previousRadiusScale:n}=this,{animationManager:r}=this.ctx,o=preparePieSeriesAnimationFunctions(!1,this.properties.rotation,s,n);fromToMotion(this.id,"nodes",r,[t,e,i],o.nodes,(a,l)=>this.getDatumId(l.datum,l.datumIndex)),fromToMotion(this.id,"innerCircle",r,[this.innerCircleSelection],o.innerCircle),seriesLabelFadeOutAnimation(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),seriesLabelFadeOutAnimation(this,"sector",this.ctx.animationManager,this.labelSelection),seriesLabelFadeOutAnimation(this,"highlight",this.ctx.animationManager,this.highlightLabelSelection),seriesLabelFadeOutAnimation(this,"inner",this.ctx.animationManager,this.innerLabelsSelection),this.previousRadiusScale.range=this.radiusScale.range}getDatumId(t,e){const{calloutLabelKey:i,sectorLabelKey:s,legendItemKey:n}=this.properties;return this.processedData?.reduced?.animationValidation?.uniqueKeys?n?createDatumId(t[n]):i?createDatumId(t[i]):s?createDatumId(t[s]):`${e}`:`${e}`}};DonutSeries.className="DonutSeries",DonutSeries.type="donut";var donutTheme={series:{title:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:[1.1666666666666667]},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"},spacing:5},calloutLabel:{enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},offset:3,minAngle:.001},sectorLabel:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"backgroundColor"},positionOffset:0,positionRatio:.5},calloutLine:{length:10,strokeWidth:2},fillOpacity:1,strokeOpacity:1,strokeWidth:0,lineDash:[0],lineDashOffset:0,rotation:0,sectorSpacing:1,shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5},innerLabels:{fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},spacing:2}},legend:{enabled:!0}},pieTheme={series:{title:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:[1.1666666666666667]},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"},spacing:5},calloutLabel:{enabled:!0,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"textColor"},offset:3,minAngle:.001},sectorLabel:{enabled:!0,fontWeight:{$ref:"fontWeight"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},color:{$ref:"backgroundColor"},positionOffset:0,positionRatio:.5},calloutLine:{length:10,strokeWidth:2},fillOpacity:1,strokeOpacity:1,strokeWidth:0,lineDash:[0],lineDashOffset:0,rotation:0,sectorSpacing:1,shadow:{enabled:!1,color:DEFAULT_SHADOW_COLOUR,xOffset:3,yOffset:3,blur:5}},legend:{enabled:!0}},piePaletteFactory=({takeColors:t,colorsCount:e})=>{const{fills:i,strokes:s}=t(e);return{fills:i,strokes:s,calloutLine:{colors:s}}},DonutSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["polar"],identifier:"donut",moduleFactory:t=>new DonutSeries(t),tooltipDefaults:{range:"exact"},themeTemplate:donutTheme,paletteFactory:piePaletteFactory},PieTitle=class extends Caption{constructor(){super(...arguments),this.showInLegend=!1}};__decorateClass([Validate(BOOLEAN)],PieTitle.prototype,"showInLegend",2);var PieSeriesCalloutLabel=class extends Label{constructor(){super(...arguments),this.offset=3,this.minAngle=0,this.minSpacing=4,this.maxCollisionOffset=50,this.avoidCollisions=!0}};__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesCalloutLabel.prototype,"offset",2),__decorateClass([Validate(NUMBER.restrict({min:0,max:360}))],PieSeriesCalloutLabel.prototype,"minAngle",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesCalloutLabel.prototype,"minSpacing",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesCalloutLabel.prototype,"maxCollisionOffset",2),__decorateClass([Validate(BOOLEAN)],PieSeriesCalloutLabel.prototype,"avoidCollisions",2);var PieSeriesSectorLabel=class extends Label{constructor(){super(...arguments),this.positionOffset=0,this.positionRatio=.5}};__decorateClass([Validate(NUMBER)],PieSeriesSectorLabel.prototype,"positionOffset",2),__decorateClass([Validate(RATIO)],PieSeriesSectorLabel.prototype,"positionRatio",2);var PieSeriesCalloutLine=class extends BaseProperties{constructor(){super(...arguments),this.length=10,this.strokeWidth=1}};__decorateClass([Validate(COLOR_STRING_ARRAY,{optional:!0})],PieSeriesCalloutLine.prototype,"colors",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesCalloutLine.prototype,"length",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesCalloutLine.prototype,"strokeWidth",2);var PieSeriesProperties=class extends SeriesProperties{constructor(){super(...arguments),this.fills=Object.values(DEFAULT_FILLS),this.strokes=Object.values(DEFAULT_STROKES),this.fillOpacity=1,this.strokeOpacity=1,this.lineDash=[0],this.lineDashOffset=0,this.cornerRadius=0,this.rotation=0,this.outerRadiusOffset=0,this.outerRadiusRatio=1,this.strokeWidth=1,this.sectorSpacing=0,this.hideZeroValueSectorsInLegend=!1,this.title=new PieTitle,this.shadow=new DropShadow,this.calloutLabel=new PieSeriesCalloutLabel,this.sectorLabel=new PieSeriesSectorLabel,this.calloutLine=new PieSeriesCalloutLine,this.tooltip=new SeriesTooltip}};__decorateClass([Validate(STRING)],PieSeriesProperties.prototype,"angleKey",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"angleName",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"angleFilterKey",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"radiusKey",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"radiusName",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],PieSeriesProperties.prototype,"radiusMin",2),__decorateClass([Validate(POSITIVE_NUMBER,{optional:!0})],PieSeriesProperties.prototype,"radiusMax",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"calloutLabelKey",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"calloutLabelName",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"sectorLabelKey",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"sectorLabelName",2),__decorateClass([Validate(STRING,{optional:!0})],PieSeriesProperties.prototype,"legendItemKey",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],PieSeriesProperties.prototype,"fills",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],PieSeriesProperties.prototype,"strokes",2),__decorateClass([Validate(RATIO)],PieSeriesProperties.prototype,"fillOpacity",2),__decorateClass([Validate(RATIO)],PieSeriesProperties.prototype,"strokeOpacity",2),__decorateClass([Validate(LINE_DASH)],PieSeriesProperties.prototype,"lineDash",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesProperties.prototype,"lineDashOffset",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesProperties.prototype,"cornerRadius",2),__decorateClass([Validate(FUNCTION,{optional:!0})],PieSeriesProperties.prototype,"itemStyler",2),__decorateClass([Validate(NUMBER)],PieSeriesProperties.prototype,"rotation",2),__decorateClass([Validate(NUMBER)],PieSeriesProperties.prototype,"outerRadiusOffset",2),__decorateClass([Validate(RATIO)],PieSeriesProperties.prototype,"outerRadiusRatio",2),__decorateClass([Validate(POSITIVE_NUMBER)],PieSeriesProperties.prototype,"strokeWidth",2),__decorateClass([Validate(NUMBER)],PieSeriesProperties.prototype,"sectorSpacing",2),__decorateClass([Validate(BOOLEAN)],PieSeriesProperties.prototype,"hideZeroValueSectorsInLegend",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"title",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"shadow",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"calloutLabel",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"sectorLabel",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"calloutLine",2),__decorateClass([Validate(OBJECT)],PieSeriesProperties.prototype,"tooltip",2);var PieSeriesNodeEvent=class extends SeriesNodeEvent{constructor(t,e,i,s){super(t,e,i,s),this.angleKey=s.properties.angleKey,this.radiusKey=s.properties.radiusKey,this.calloutLabelKey=s.properties.calloutLabelKey,this.sectorLabelKey=s.properties.sectorLabelKey}},PieSeries=class extends PolarSeries{constructor(t){super({moduleCtx:t,pickModes:[1,0],useLabelLayer:!0,animationResetFns:{item:resetPieSelectionsFn,label:resetLabelFn}}),this.properties=new PieSeriesProperties,this.phantomNodeData=void 0,this.backgroundGroup=new TranslatableGroup({name:`${this.id}-background`,zIndex:0}),this.previousRadiusScale=new LinearScale,this.radiusScale=new LinearScale,this.phantomGroup=this.backgroundGroup.appendChild(new Group({name:"phantom"})),this.phantomSelection=Selection.select(this.phantomGroup,()=>this.nodeFactory(),!1),this.calloutLabelGroup=this.contentGroup.appendChild(new Group({name:"pieCalloutLabels"})),this.calloutLabelSelection=new Selection(this.calloutLabelGroup,Group),this.zerosumRingsGroup=this.backgroundGroup.appendChild(new Group({name:`${this.id}-zerosumRings`})),this.zerosumOuterRing=this.zerosumRingsGroup.appendChild(new Marker({shape:"circle"})),this.surroundingRadius=void 0,this.NodeEvent=PieSeriesNodeEvent,this.angleScale=new LinearScale,this.angleScale.domain=[0,1],this.angleScale.range=[-Math.PI,Math.PI].map(e=>e+Math.PI/2),this.phantomGroup.opacity=.2}get calloutNodeData(){return this.phantomNodeData??this.nodeData}attachSeries(t,e,i){super.attachSeries(t,e,i),t.appendChild(this.backgroundGroup)}detachSeries(t,e,i){super.detachSeries(t,e,i),t?.removeChild(this.backgroundGroup)}setSeriesIndex(t){return super.setSeriesIndex(t)?(this.backgroundGroup.zIndex=[0,t],!0):!1}nodeFactory(){const t=new Sector;return t.miterLimit=1e9,t}getSeriesDomain(t){return t==="x"?this.angleScale.domain:this.radiusScale.domain}async processData(t){if(this.data==null||!this.properties.isValid())return;const{visible:e,id:i,ctx:{legendManager:s}}=this,{angleKey:n,angleFilterKey:r,radiusKey:o,calloutLabelKey:a,sectorLabelKey:l,legendItemKey:c}=this.properties,h=(y,f,x)=>e&&s.getItemEnabled({seriesId:i,itemId:x}),u=!this.ctx.animationManager.isSkipped(),d=[],p=[];c?d.push(keyProperty(c,"band",{id:"legendItemKey"})):a?d.push(keyProperty(a,"band",{id:"calloutLabelKey"})):l&&d.push(keyProperty(l,"band",{id:"sectorLabelKey"}));const g=this.radiusScale.type,m=this.angleScale.type;o&&p.push(rangedValueProperty(o,{id:"radiusValue",min:this.properties.radiusMin??0,max:this.properties.radiusMax}),valueProperty(o,g,{id:"radiusRaw"}),normalisePropertyTo("radiusValue",[0,1],1,this.properties.radiusMin??0,this.properties.radiusMax)),a&&p.push(valueProperty(a,"band",{id:"calloutLabelValue"})),l&&p.push(valueProperty(l,"band",{id:"sectorLabelValue"})),c&&p.push(valueProperty(c,"band",{id:"legendItemValue"})),r&&p.push(accumulativeValueProperty(r,m,{id:"angleFilterValue",onlyPositive:!0,validation:h,invalidValue:0}),valueProperty(r,m,{id:"angleFilterRaw"}),normalisePropertyTo("angleFilterValue",[0,1],0,0)),u&&this.processedData?.reduced?.animationValidation?.uniqueKeys&&d.length>0&&p.push(diff(this.id,this.processedData)),p.push(animationValidation()),await this.requestDataModel(t,this.data,{props:[...d,accumulativeValueProperty(n,m,{id:"angleValue",onlyPositive:!0,validation:h,invalidValue:0}),valueProperty(n,m,{id:"angleRaw"}),normalisePropertyTo("angleValue",[0,1],0,0),...p]});for(const y of this.processedData?.defs?.values??[]){const{id:f,missing:x,property:v}=y,b=getMissCount(this,x);f!=="angleRaw"&&b>0&&logger_exports.warnOnce(`no value was found for the key '${String(v)}' on ${b} data element${b>1?"s":""}`)}this.animationState.transition("updateData")}maybeRefreshNodeData(){if(!this.nodeDataRefresh)return;const{nodeData:t=[],phantomNodeData:e}=this.createNodeData()??{};this.nodeData=t,this.phantomNodeData=e,this.nodeDataRefresh=!1}getProcessedDataValues(t,e){const i=t.resolveColumnById(this,"angleValue",e),s=t.resolveColumnById(this,"angleRaw",e),n=this.properties.angleFilterKey!=null?t.resolveColumnById(this,"angleFilterValue",e):void 0,r=this.properties.angleFilterKey!=null?t.resolveColumnById(this,"angleFilterRaw",e):void 0,o=this.properties.radiusKey?t.resolveColumnById(this,"radiusValue",e):void 0,a=this.properties.radiusKey?t.resolveColumnById(this,"radiusRaw",e):void 0,l=this.properties.calloutLabelKey?t.resolveColumnById(this,"calloutLabelValue",e):void 0,c=this.properties.sectorLabelKey?t.resolveColumnById(this,"sectorLabelValue",e):void 0,h=this.properties.legendItemKey?t.resolveColumnById(this,"legendItemValue",e):void 0;return{angleValues:i,angleRawValues:s,angleFilterValues:n,angleFilterRawValues:r,radiusValues:o,radiusRawValues:a,calloutLabelValues:l,sectorLabelValues:c,legendItemValues:h}}createNodeData(){const{id:t,processedData:e,dataModel:i,angleScale:s,ctx:{legendManager:n},visible:r}=this,{rotation:o}=this.properties;if(!i||e?.type!=="ungrouped")return;const{angleValues:a,angleRawValues:l,angleFilterValues:c,angleFilterRawValues:h,radiusValues:u,radiusRawValues:d,calloutLabelValues:p,sectorLabelValues:g,legendItemValues:m}=this.getProcessedDataValues(i,e),y=h?.some((D,I)=>D>l[I])??!1;let f=0,x=0;const v=[],b=h!=null?[]:void 0,S=e.dataSources.get(this.id)??[],A=e.invalidData?.get(this.id);return S.forEach((D,I)=>{if(A?.[I]===!0)return;const L=y?c[I]:a[I],N=h!=null&&!y?Math.sqrt(h[I]/l[I]):1,T=s.convert(f)+toRadians(o);f=L,x+=L;const w=s.convert(f)+toRadians(o),O=Math.abs(w-T),Z=T+O/2,F=l[I],W=(u?.[I]??1)*N,H=d?.[I],_=m?.[I],E=this.getLabels(D,Z,O,!0,p?.[I],g?.[I],_),P=this.getSectorFormat(D,I,!1),G={itemId:I,series:this,datum:D,datumIndex:I,angleValue:F,midAngle:Z,midCos:Math.cos(Z),midSin:Math.sin(Z),startAngle:T,endAngle:w,radius:W,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(W),0),sectorFormat:P,radiusValue:H,legendItemValue:_,enabled:r&&n.getItemEnabled({seriesId:t,itemId:I}),...E};v.push(G),b?.push({...G,radius:1,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(1),0)})}),this.zerosumOuterRing.visible=x===0,{itemId:t,nodeData:v,labelData:v,phantomNodeData:b}}getLabels(t,e,i,s,n,r,o){const{calloutLabel:a,sectorLabel:l,legendItemKey:c}=this.properties,h=!s||a.enabled?this.properties.calloutLabelKey:void 0,u=!s||l.enabled?this.properties.sectorLabelKey:void 0;if(!h&&!u&&!c)return{};const d={datum:t,angleKey:this.properties.angleKey,angleName:this.properties.angleName,radiusKey:this.properties.radiusKey,radiusName:this.properties.radiusName,calloutLabelKey:this.properties.calloutLabelKey,calloutLabelName:this.properties.calloutLabelName,sectorLabelKey:this.properties.sectorLabelKey,sectorLabelName:this.properties.sectorLabelName,legendItemKey:this.properties.legendItemKey},p={};return h&&i>=toRadians(a.minAngle)&&(p.calloutLabel={...this.getTextAlignment(e),text:this.getLabelText(a,{...d,value:n}),hidden:!1,collisionTextAlign:void 0,collisionOffsetY:0,box:void 0}),u&&(p.sectorLabel={text:this.getLabelText(l,{...d,value:r})}),c!=null&&o!=null&&(p.legendItem={key:c,text:o}),p}getTextAlignment(t){const e=[{textAlign:"center",textBaseline:"bottom"},{textAlign:"left",textBaseline:"middle"},{textAlign:"center",textBaseline:"hanging"},{textAlign:"right",textBaseline:"middle"}],i=normalizeAngle180(t),s=-.75*Math.PI,n=i-s,r=Math.floor(n/(Math.PI/2)),o=mod(r,e.length);return e[o]}getSectorFormat(t,e,i){const{angleKey:s,radiusKey:n,calloutLabelKey:r,sectorLabelKey:o,legendItemKey:a,fills:l,strokes:c,itemStyler:h}=this.properties,u=c[e%c.length],{fill:d,fillOpacity:p,stroke:g,strokeWidth:m,strokeOpacity:y,lineDash:f,lineDashOffset:x,cornerRadius:v}=mergeDefaults(i&&this.properties.highlightStyle.item,{fill:l.length>0?l[e%l.length]:void 0,stroke:u,strokeWidth:this.getStrokeWidth(this.properties.strokeWidth),strokeOpacity:this.getOpacity()},this.properties);let b;return h&&(b=this.cachedDatumCallback(this.getDatumId(t,e)+(i?"-highlight":"-hide"),()=>h({datum:t,angleKey:s,radiusKey:n,calloutLabelKey:r,sectorLabelKey:o,legendItemKey:a,fill:d,strokeOpacity:y,stroke:g,strokeWidth:m,fillOpacity:p,lineDash:f,lineDashOffset:x,cornerRadius:v,highlighted:i,seriesId:this.id}))),{fill:b?.fill??d,fillOpacity:b?.fillOpacity??p,stroke:b?.stroke??g,strokeWidth:b?.strokeWidth??m,strokeOpacity:b?.strokeOpacity??y,lineDash:b?.lineDash??f,lineDashOffset:b?.lineDashOffset??x,cornerRadius:b?.cornerRadius??v}}getOuterRadius(){return Math.max(this.radius*this.properties.outerRadiusRatio+this.properties.outerRadiusOffset,0)}updateRadiusScale(t){const e=[0,this.getOuterRadius()];this.radiusScale.range=e,t&&(this.previousRadiusScale.range=e);const i=s=>({...s,innerRadius:Math.max(this.radiusScale.convert(0),0),outerRadius:Math.max(this.radiusScale.convert(s.radius),0)});this.nodeData=this.nodeData.map(i),this.phantomNodeData=this.phantomNodeData?.map(i)}getTitleTranslationY(){const t=Math.max(0,this.radiusScale.range[1]);if(t===0)return NaN;const i=2+(this.properties.title?.spacing??0),s=Math.max(0,-t);return-t-i-s}update({seriesRect:t}){const{title:e}=this.properties,i={seriesRectWidth:t?.width,seriesRectHeight:t?.height},s=jsonDiff(this.nodeDataDependencies,i)!=null;if(s&&(this._nodeDataDependencies=i),this.maybeRefreshNodeData(),this.updateTitleNodes(),this.updateRadiusScale(s),this.contentGroup.translationX=this.centerX,this.contentGroup.translationY=this.centerY,this.highlightGroup.translationX=this.centerX,this.highlightGroup.translationY=this.centerY,this.backgroundGroup.translationX=this.centerX,this.backgroundGroup.translationY=this.centerY,this.labelGroup&&(this.labelGroup.translationX=this.centerX,this.labelGroup.translationY=this.centerY),e){const n=this.getTitleTranslationY();e.node.y=isFinite(n)?n:0;const r=e.node.getBBox();e.node.visible=e.enabled&&isFinite(n)&&!this.bboxIntersectsSurroundingSeries(r)}this.zerosumOuterRing.fillOpacity=0,this.zerosumOuterRing.stroke=this.properties.calloutLabel.color,this.zerosumOuterRing.strokeWidth=1,this.zerosumOuterRing.strokeOpacity=1,this.updateNodeMidPoint(),this.updateSelections(),this.updateNodes(t)}updateTitleNodes(){const{oldTitle:t}=this,{title:e}=this.properties;t!==e&&(t&&this.labelGroup?.removeChild(t.node),e&&(e.node.textBaseline="bottom",this.labelGroup?.appendChild(e.node)),this.oldTitle=e)}updateNodeMidPoint(){const t=e=>{const i=e.innerRadius+(e.outerRadius-e.innerRadius)/2;e.midPoint={x:e.midCos*Math.max(0,i),y:e.midSin*Math.max(0,i)}};this.nodeData.forEach(t),this.phantomNodeData?.forEach(t)}updateSelections(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,highlightLabelSelection:s,calloutLabelSelection:n,labelSelection:r}=this,o=this.nodeData.map(l=>({...l,sectorFormat:{...l.sectorFormat}})),a=(l,c)=>{l.update(c,void 0,h=>this.getDatumId(h.datum,h.datumIndex)),this.ctx.animationManager.isSkipped()&&l.cleanup()};a(t,this.nodeData),a(e,o),a(i,this.phantomNodeData??[]),n.update(this.calloutNodeData,l=>{const c=new Line;c.tag=0,c.pointerEvents=1,l.appendChild(c);const h=new Text;h.tag=1,h.pointerEvents=1,l.appendChild(h)}),r.update(this.nodeData),s.update(o)}updateNodes(t){const e=this.ctx.highlightManager.getActiveHighlight(),{visible:i}=this;this.backgroundGroup.visible=i,this.contentGroup.visible=i,this.highlightGroup.visible=i&&e?.series===this,this.highlightLabel.visible=i&&e?.series===this,this.labelGroup&&(this.labelGroup.visible=i),this.contentGroup.opacity=this.getOpacity();const s=this.ctx.animationManager.isSkipped(),n=(r,o,a,l)=>{const c=this.getSectorFormat(o.datum,o.itemId,l);o.sectorFormat.fill=c.fill,o.sectorFormat.stroke=c.stroke,s&&(r.startAngle=o.startAngle,r.endAngle=o.endAngle,r.innerRadius=o.innerRadius,r.outerRadius=o.outerRadius),(l||s)&&(r.fill=c.fill,r.stroke=c.stroke),r.strokeWidth=c.strokeWidth,r.fillOpacity=c.fillOpacity,r.strokeOpacity=c.strokeOpacity,r.lineDash=c.lineDash,r.lineDashOffset=c.lineDashOffset,r.cornerRadius=c.cornerRadius,r.fillShadow=this.properties.shadow;const h=Math.max((this.properties.sectorSpacing+(c.stroke!=null?c.strokeWidth:0))/2,0);r.inset=h,r.lineJoin=this.properties.sectorSpacing>=0||h>0?"miter":"round"};this.itemSelection.each((r,o,a)=>n(r,o,a,!1)),this.highlightSelection.each((r,o,a)=>{n(r,o,a,!0),r.visible=o.itemId===e?.itemId}),this.phantomSelection.each((r,o,a)=>n(r,o,a,!1)),this.updateCalloutLineNodes(),this.updateCalloutLabelNodes(t),this.updateSectorLabelNodes(),this.updateZerosumRings(),this.animationState.transition("update")}updateCalloutLineNodes(){const{calloutLine:t}=this.properties,e=t.length,i=t.strokeWidth,s=t.colors??this.properties.strokes,{offset:n}=this.properties.calloutLabel;this.calloutLabelSelection.selectByTag(0).forEach((r,o)=>{const a=r.datum,{calloutLabel:l,outerRadius:c}=a;if(l?.text&&!l.hidden&&c!==0){r.visible=!0,r.strokeWidth=i,r.stroke=s[o%s.length],r.fill=void 0;const h=a.midCos*c,u=a.midSin*c;let d=a.midCos*(c+e),p=a.midSin*(c+e);if((l.collisionTextAlign??l.collisionOffsetY!==0)&&l.box!=null){const m=l.box;let y=d,f=p;dm.x+m.width&&(y=m.x+m.width),pm.y+m.height&&(f=m.y+m.height);const x=y-d,v=f-p,b=Math.sqrt(Math.pow(x,2)+Math.pow(v,2)),S=b-n;S>0&&(d=d+x*S/b,p=p+v*S/b)}r.x1=h,r.y1=u,r.x2=d,r.y2=p}else r.visible=!1})}getLabelOverflow(t,e,i){const s=-this.centerX,n=s+i.width,r=-this.centerY,o=r+i.height,a=1;let l=1;e.x+an&&(l=(n-e.x)/e.width);const c=e.y+ao,h=l===1?t.length:Math.floor(t.length*l)-1,u=this.bboxIntersectsSurroundingSeries(e);return{textLength:h,hasVerticalOverflow:c,hasSurroundingSeriesOverflow:u}}bboxIntersectsSurroundingSeries(t){const{surroundingRadius:e}=this;if(e==null)return!1;const i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],s=e**2;return i.some(n=>n.x**2+n.y**2>s)}computeCalloutLabelCollisionOffsets(){const{radiusScale:t}=this,{calloutLabel:e,calloutLine:i}=this.properties,{offset:s,minSpacing:n}=e,r=t.convert(0),o=f=>!f.calloutLabel||f.outerRadius===0,a=this.calloutNodeData,l=a.filter(f=>!o(f));if(l.forEach(f=>{const x=f.calloutLabel;x!=null&&(x.hidden=!1,x.collisionTextAlign=void 0,x.collisionOffsetY=0)}),l.length<=1)return;const c=l.filter(f=>f.midCos<0).sort((f,x)=>f.midSin-x.midSin),h=l.filter(f=>f.midCos>=0).sort((f,x)=>f.midSin-x.midSin),u=l.filter(f=>f.midSin<0&&f.calloutLabel?.textAlign==="center").sort((f,x)=>f.midCos-x.midCos),d=l.filter(f=>f.midSin>=0&&f.calloutLabel?.textAlign==="center").sort((f,x)=>f.midCos-x.midCos),p=f=>{const x=f.calloutLabel;if(x==null)return BBox.zero.clone();const v=f.outerRadius+i.length+s,b=f.midCos*v,S=f.midSin*v+x.collisionOffsetY,A=x.collisionTextAlign??x.textAlign,D=x.textBaseline;return Text.computeBBox(x.text,b,S,{font:this.properties.calloutLabel,textAlign:A,textBaseline:D})},g=(f,x,v)=>{const b=p(f).grow(n/2),S=p(x).grow(n/2);b.xS.x&&(v==="to-top"?b.yS.y)&&(x.calloutLabel.collisionOffsetY=v==="to-top"?b.y-S.y-S.height:b.y+b.height-S.y)},m=f=>{const x=f.slice().sort((b,S)=>Math.abs(b.midSin)-Math.abs(S.midSin))[0],v=f.indexOf(x);for(let b=v-1;b>=0;b--){const S=f[b+1],A=f[b];g(S,A,"to-top")}for(let b=v+1;b{const x=l.some(I=>I.calloutLabel.collisionOffsetY!==0),v=f.map(I=>p(I)),b=v.map(I=>I.clone().grow(n/2));let S=!1;for(let I=0;I{const{startAngle:L,endAngle:N,outerRadius:T}=I;return{startAngle:L,endAngle:N,innerRadius:r,outerRadius:T}}),D=v.some(I=>A.some(L=>boxCollidesSector(I,L)));!S&&!x&&!D||f.filter(I=>I.calloutLabel.textAlign==="center").forEach(I=>{const L=I.calloutLabel;I.midCos<0?L.collisionTextAlign="right":I.midCos>0?L.collisionTextAlign="left":L.collisionTextAlign="center"})};m(c),m(h),y(u),y(d)}updateCalloutLabelNodes(t){const{radiusScale:e}=this,{calloutLabel:i,calloutLine:s}=this.properties,n=s.length,{offset:r,color:o}=i,a=new Text;this.calloutLabelSelection.selectByTag(1).forEach(l=>{const{datum:c}=l,h=c.calloutLabel,u=e.convert(c.radius),d=Math.max(0,u);if(!h?.text||d===0||h.hidden){l.visible=!1;return}const p=d+n+r,g=c.midCos*p,m=c.midSin*p+h.collisionOffsetY,y={textAlign:h.collisionTextAlign??h.textAlign,textBaseline:h.textBaseline};a.text=h.text,a.x=g,a.y=m,a.setFont(this.properties.calloutLabel),a.setAlign(y);const f=a.getBBox();let x=h.text,v=!0;if(i.avoidCollisions){const{textLength:b,hasVerticalOverflow:S}=this.getLabelOverflow(h.text,f,t);x=h.text.length===b?h.text:`${h.text.substring(0,b)}\u2026`,v=!S}l.text=x,l.x=g,l.y=m,l.setFont(this.properties.calloutLabel),l.setAlign(y),l.fill=o,l.visible=v})}computeLabelsBBox(t,e){const{calloutLabel:i,calloutLine:s}=this.properties,n=s.length,{offset:r,maxCollisionOffset:o,minSpacing:a}=i;if(!i.avoidCollisions)return null;this.maybeRefreshNodeData(),this.updateRadiusScale(!1),this.computeCalloutLabelCollisionOffsets();const l=[],c=new Text;let h;const{title:u}=this.properties;if(u?.text&&u.enabled){const d=this.getTitleTranslationY();isFinite(d)&&(c.text=u.text,c.x=0,c.y=d,c.setFont(u),c.setAlign({textBaseline:"bottom",textAlign:"center"}),h=c.getBBox(),l.push(h))}return this.calloutNodeData.forEach(d=>{const p=d.calloutLabel;if(!p||d.outerRadius===0)return null;const g=d.outerRadius+n+r,m=d.midCos*g,y=d.midSin*g+p.collisionOffsetY;c.text=p.text,c.x=m,c.y=y,c.setFont(this.properties.calloutLabel),c.setAlign({textAlign:p.collisionTextAlign??p.textAlign,textBaseline:p.textBaseline});const f=c.getBBox();if(p.box=f,Math.abs(p.collisionOffsetY)>o){p.hidden=!0;return}if(h){const x=-this.centerY,v=new BBox(h.x-a,x,h.width+2*a,h.y+h.height+a-x);if(f.collidesBBox(v)){p.hidden=!0;return}}if(t.hideWhenNecessary){const{textLength:x,hasVerticalOverflow:v,hasSurroundingSeriesOverflow:b}=this.getLabelOverflow(p.text,f,e),S=p.text.length>2&&x<2;if(v||S||b){p.hidden=!0;return}}p.hidden=!1,l.push(f)}),l.length===0?null:BBox.merge(l)}updateSectorLabelNodes(){const{radiusScale:t}=this,e=t.convert(0),{fontSize:i,fontStyle:s,fontWeight:n,fontFamily:r,positionOffset:o,positionRatio:a,color:l}=this.properties.sectorLabel,c=e>0,h=this.ctx.legendManager.getData(this.id)?.filter(d=>d.enabled).length===1,u=(d,p)=>{const{sectorLabel:g,outerRadius:m,startAngle:y,endAngle:f}=p;let x=!1;if(g&&m!==0){const v=e*(1-a)+m*a+o;d.fill=l,d.fontStyle=s,d.fontWeight=n,d.fontSize=i,d.fontFamily=r,d.text=g.text,!c&&h?(d.x=0,d.y=0):(d.x=p.midCos*v,d.y=p.midSin*v),d.textAlign="center",d.textBaseline="middle";const S=d.getBBox(),A=[[S.x,S.y],[S.x+S.width,S.y],[S.x+S.width,S.y+S.height],[S.x,S.y+S.height]],D={startAngle:y,endAngle:f,innerRadius:e,outerRadius:m};A.every(([I,L])=>isPointInSector(I,L,D))&&(x=!0)}d.visible=x};this.labelSelection.each(u),this.highlightLabelSelection.each(u)}updateZerosumRings(){this.zerosumOuterRing.size=this.getOuterRadius()*2}pickNodeClosestDatum(t){return pickByMatchingAngle(this,t)}getTooltipContent(t){const{id:e,dataModel:i,processedData:s,properties:n}=this,{legendItemKey:r,calloutLabelKey:o,calloutLabelName:a,sectorLabelKey:l,sectorLabelName:c,angleKey:h,angleName:u,radiusKey:d,radiusName:p,tooltip:g}=n,m=this.properties.title.text;if(!i||!s)return;const{datumIndex:y}=t,f=s.dataSources.get(this.id)?.[y],{angleRawValues:x,legendItemValues:v,calloutLabelValues:b,sectorLabelValues:S}=this.getProcessedDataValues(i,s),A=x[y],D=v?.[y]??(o===h?void 0:b?.[y])??(l===h?void 0:S?.[y])??u;return g.formatTooltip({title:m,symbol:this.legendItemSymbol(y),data:[{label:D,fallbackLabel:h,value:formatValue(A,3)}]},{seriesId:e,datum:f,title:u,legendItemKey:r,calloutLabelKey:o,calloutLabelName:a,sectorLabelKey:l,sectorLabelName:c,angleKey:h,angleName:u,radiusKey:d,radiusName:p,...this.getSectorFormat(f,y,!1)})}legendItemSymbol(t){const e=this.processedData?.dataSources.get(this.id)?.[t],i=this.getSectorFormat(e,t,!1);return{marker:{fill:i.fill,stroke:i.stroke,fillOpacity:this.properties.fillOpacity,strokeOpacity:this.properties.strokeOpacity,strokeWidth:this.properties.strokeWidth,lineDash:this.properties.lineDash,lineDashOffset:this.properties.lineDashOffset}}}getLegendData(t){const{id:e,visible:i,processedData:s,dataModel:n,ctx:{legendManager:r}}=this;if(!n||!s||t!=="category")return[];const{angleKey:o,calloutLabelKey:a,sectorLabelKey:l,legendItemKey:c,showInLegend:h}=this.properties;if(!c&&(!a||a===o)&&(!l||l===o))return[];const{calloutLabelValues:u,sectorLabelValues:d,legendItemValues:p,angleRawValues:g}=this.getProcessedDataValues(n,s),m=this.properties.title?.showInLegend&&this.properties.title.text,y=[],f=this.properties.hideZeroValueSectorsInLegend,x=s.dataSources.get(this.id),v=s.invalidData?.get(this.id);for(let b=0;bi.toggleItem({enabled:n,seriesId:e,itemId:r})),i.update(),s.update(4)}animateEmptyUpdateReady(t){const{animationManager:e}=this.ctx,i=preparePieSeriesAnimationFunctions(!0,this.properties.rotation,this.radiusScale,this.previousRadiusScale);fromToMotion(this.id,"nodes",e,[this.itemSelection,this.highlightSelection,this.phantomSelection],i.nodes,(s,n)=>this.getDatumId(n.datum,n.datumIndex)),seriesLabelFadeInAnimation(this,"callout",e,this.calloutLabelSelection),seriesLabelFadeInAnimation(this,"sector",e,this.labelSelection),seriesLabelFadeInAnimation(this,"highlight",e,this.highlightLabelSelection),this.previousRadiusScale.range=this.radiusScale.range}animateWaitingUpdateReady(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,processedData:s,radiusScale:n,previousRadiusScale:r}=this,{animationManager:o}=this.ctx,a=s?.reduced?.diff?.[this.id];this.ctx.animationManager.stopByAnimationGroupId(this.id);const l=(a?.moved.size??0)===0,c=(s?.defs.keys.length??0)>0,h=s?.reduced?.animationValidation?.uniqueKeys??!0;(!l||!c||!h)&&this.ctx.animationManager.skipCurrentBatch();const u=preparePieSeriesAnimationFunctions(!1,this.properties.rotation,n,r);fromToMotion(this.id,"nodes",o,[t,e,i],u.nodes,(d,p)=>this.getDatumId(p.datum,p.datumIndex),a),seriesLabelFadeInAnimation(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),seriesLabelFadeInAnimation(this,"sector",this.ctx.animationManager,this.labelSelection),seriesLabelFadeInAnimation(this,"highlight",this.ctx.animationManager,this.highlightLabelSelection),this.previousRadiusScale.range=this.radiusScale.range}animateClearingUpdateEmpty(){const{itemSelection:t,highlightSelection:e,phantomSelection:i,radiusScale:s,previousRadiusScale:n}=this,{animationManager:r}=this.ctx,o=preparePieSeriesAnimationFunctions(!1,this.properties.rotation,s,n);fromToMotion(this.id,"nodes",r,[t,e,i],o.nodes,(a,l)=>this.getDatumId(l.datum,l.datumIndex)),seriesLabelFadeOutAnimation(this,"callout",this.ctx.animationManager,this.calloutLabelSelection),seriesLabelFadeOutAnimation(this,"sector",this.ctx.animationManager,this.labelSelection),seriesLabelFadeOutAnimation(this,"highlight",this.ctx.animationManager,this.highlightLabelSelection),this.previousRadiusScale.range=this.radiusScale.range}getDatumId(t,e){const{calloutLabelKey:i,sectorLabelKey:s,legendItemKey:n}=this.properties;return this.processedData?.reduced?.animationValidation?.uniqueKeys?n?createDatumId(t[n]):i?createDatumId(t[i]):s?createDatumId(t[s]):`${e}`:`${e}`}};PieSeries.className="PieSeries",PieSeries.type="pie";var PieSeriesModule={type:"series",optionsKey:"series[]",packageType:"community",chartTypes:["polar"],identifier:"pie",moduleFactory:t=>new PieSeries(t),tooltipDefaults:{range:"exact"},themeTemplate:pieTheme,paletteFactory:piePaletteFactory};function registerInbuiltModules(){moduleRegistry.register(BackgroundModule,CommunityLegendModule,LocaleModule,AreaSeriesModule,BarSeriesModule,BubbleSeriesModule,LineSeriesModule,ScatterSeriesModule,DonutSeriesModule,PieSeriesModule,HistogramSeriesModule);for(const t of[NumberAxis,CategoryAxis,TimeAxis,GroupedCategoryAxis,LogAxis])axisRegistry.register(t.type,{moduleFactory:e=>new t(e)})}function setupModules(){for(const t of moduleRegistry.modules){if(t.packageType==="enterprise"&&!verifyIfModuleExpected(t)&&logger_exports.errorOnce("Unexpected enterprise module registered: "+t.identifier),t.type==="root"&&t.themeTemplate)for(const e of t.chartTypes)chartDefaults.set(e,t.themeTemplate);if(t.type==="series"){if(t.chartTypes.length>1)throw new Error(`AG Charts - Module definition error: ${t.identifier}`);seriesRegistry.register(t.identifier,t)}if(t.type==="series-option"&&t.themeTemplate)for(const e of t.seriesTypes)seriesRegistry.setThemeTemplate(e,t.themeTemplate);if(t.type==="axis-option"&&t.themeTemplate)for(const e of t.axisTypes){const i=axisRegistry.getThemeTemplate(e),s=mergeDefaults(t.themeTemplate,i);axisRegistry.setThemeTemplate(e,s)}t.type==="axis"&&axisRegistry.register(t.identifier,t),t.type==="legend"&&legendRegistry.register(t.identifier,t)}if(moduleRegistry.hasEnterpriseModules()){const t=getUnusedExpectedModules();t.length>0&&logger_exports.errorOnce("Enterprise modules expected but not registered: ",t)}}var PolarAxis=class extends Axis{constructor(){super(...arguments),this.shape="polygon",this.innerRadiusRatio=0,this.defaultTickMinSpacing=20}updatePosition(){super.updatePosition();const t=prepareAxisAnimationContext(this),e=resetAxisSelectionFn(t);this.axisGroup.setProperties(this.getAxisTransform()),this.gridLineGroupSelection.each(e),this.tickLineGroupSelection.each(e),this.tickLabelGroupSelection.each(resetAxisLabelSelectionFn())}computeLabelsBBox(t,e){return null}computeRange(){}getAxisLinePoints(){}};__decorateClass([Validate(UNION(["polygon","circle"],"a polar axis shape"))],PolarAxis.prototype,"shape",2),__decorateClass([Validate(RATIO)],PolarAxis.prototype,"innerRadiusRatio",2);var PolarChart=class extends Chart{constructor(t,e){super(t,e),this.padding=new Padding(40),this.ctx.axisManager.axisGroup.zIndex=6}getChartType(){return"polar"}async performLayout(t){const{layoutBox:e}=t;e.shrink(this.seriesArea.padding.toJson());const i=e.clone();this.seriesRect=i,this.animationRect=i,this.seriesRoot.translationX=i.x,this.seriesRoot.translationY=i.y,await this.computeCircle(i),this.axes.forEach(s=>s.update()),this.ctx.layoutManager.emitLayoutComplete(t,{series:{visible:!0,rect:i,paddedRect:i}})}updateAxes(t,e,i,s){const n=this.axes.find(l=>l.direction==="x"),r=this.axes.find(l=>l.direction==="y");if(!(n instanceof PolarAxis)||!(r instanceof PolarAxis))return;const o=n.scale,a=r.innerRadiusRatio;n.innerRadiusRatio=a,n.computeRange(),n.gridLength=s,r.gridAngles=o.ticks({nice:n.nice,interval:void 0,tickCount:void 0,minTickCount:0,maxTickCount:1/0})?.map(l=>o.convert(l)),r.gridRange=n.range,r.range=[s,s*a],[n,r].forEach(l=>{l.translation.x=t.x+e,l.translation.y=t.y+i,l.calculateLayout()})}async computeCircle(t){const e=this.series.filter(isPolarSeries),i=this.axes.filter(isPolarAxis),s=(c,h,u)=>{this.updateAxes(t,c,h,u),e.forEach(p=>{p.centerX=c,p.centerY=h,p.radius=u});const d=e.filter(p=>p.type==="donut"||p.type==="pie");if(d.length>1){const p=d.map(g=>{const m=g.getInnerRadius();return{series:g,innerRadius:m}}).sort((g,m)=>g.innerRadius-m.innerRadius);p.at(-1).series.surroundingRadius=void 0;for(let g=0;g{const h=[];for(const p of iterate(i,e)){const g=await p.computeLabelsBBox({hideWhenNecessary:c},t);g&&h.push(g)}if(h.length===0){s(n,r,o);return}const u=BBox.merge(h),d=this.refineCircle(u,a,t);s(d.centerX,d.centerY,d.radius),a=d.radius};await l(),await l(),await l(),await l({hideWhenNecessary:!0}),await l({hideWhenNecessary:!0});for(const c of iterate(i,e))await c.computeLabelsBBox({hideWhenNecessary:!0},t);return{radius:a,centerX:n,centerY:r}}refineCircle(t,e,i){const n=-e,r=-e,o=e,a=e;let l=Math.max(0,n-t.x),c=Math.max(0,r-t.y),h=Math.max(0,t.x+t.width-o),u=Math.max(0,t.y+t.height-a);l=h=Math.max(l,h),c=u=Math.max(c,u);const d=i.width-l-h,p=i.height-c-u;let g=Math.min(d,p)/2;const m=.5*i.width/2,y=.5*i.height/2,f=Math.min(m,y);if(gi.height){const A=i.height-2*g;Math.min(c,u)*2>A?(c=A/2,u=A/2):c>u?c=A-u:u=A-c}if(2*g+b>i.width){const A=i.width-2*g;Math.min(l,h)*2>A?(l=A/2,h=A/2):l>h?l=A-h:h=A-l}}const x=l+2*g+h,v=c+2*g+u;return{centerX:(i.width-x)/2+l+g,centerY:(i.height-v)/2+c+g,radius:g}}};PolarChart.className="PolarChart",PolarChart.type="polar";function isPolarSeries(t){return t instanceof PolarSeries}function isPolarAxis(t){return t instanceof PolarAxis}var PolarChartModule={type:"chart",name:"polar",detect:isAgPolarChartOptions,create(t,e){return new PolarChart(t,e)}},enterpriseModule={isEnterprise:!1},AgErrorBarSupportedSeriesTypes=["bar","line","scatter"],__MINI_CHART_SERIES_OPTIONS=void 0,__VERIFY_MINI_CHART_SERIES_OPTIONS=void 0;__VERIFY_MINI_CHART_SERIES_OPTIONS=__MINI_CHART_SERIES_OPTIONS;var __THEME_OVERRIDES=void 0,__VERIFY_THEME_OVERRIDES=void 0;__VERIFY_THEME_OVERRIDES=__THEME_OVERRIDES;var AgTooltipPositionType=(t=>(t.POINTER="pointer",t.NODE="node",t.TOP="top",t.RIGHT="right",t.BOTTOM="bottom",t.LEFT="left",t.TOP_LEFT="top-left",t.TOP_RIGHT="top-right",t.BOTTOM_RIGHT="bottom-right",t.BOTTOM_LEFT="bottom-left",t))(AgTooltipPositionType||{}),__THEMEABLE_OPTIONS=void 0,__VERIFY_THEMEABLE_OPTIONS=void 0;__VERIFY_THEMEABLE_OPTIONS=__THEMEABLE_OPTIONS;var __AXIS_LABEL_OPTIONS=void 0,__VERIFY_AXIS_LABEL_OPTIONS=void 0;__VERIFY_AXIS_LABEL_OPTIONS=__AXIS_LABEL_OPTIONS;var IGNORED_PROP=Symbol("IGNORED_PROP");function pickProps(t,e){const i={};for(const[s,n]of Object.entries(e))n!==IGNORED_PROP&&Object.hasOwn(t,s)&&(i[s]=n);return i}function pickTooltipProps(t){if(t===void 0)return;const{enabled:e,showArrow:i,range:s,position:n,delay:r,wrapping:o}=t;return Object.fromEntries(Object.entries({enabled:e,showArrow:i,range:s,position:n,delay:r,wrapping:o}).filter(([l,c])=>c!==void 0))}function isRadialGauge(t){return t.type==="radial-gauge"}function isLinearGauge(t){return t.type==="linear-gauge"}function radialGaugeOptions(t){const{animation:e,background:i,container:s,contextMenu:n,footnote:r,height:o,listeners:a,locale:l,minHeight:c,minWidth:h,overrideDevicePixelRatio:u,padding:d,subtitle:p,theme:g,title:m,width:y,type:f,cursor:x,nodeClickRange:v,tooltip:b,value:S,scale:A={},startAngle:D,endAngle:I,highlightStyle:L,segmentation:N,bar:T,needle:w,targets:O,outerRadius:Z,innerRadius:F,outerRadiusRatio:U,innerRadiusRatio:W,cornerRadius:H,cornerMode:_,label:E,secondaryLabel:P,spacing:G,...V}=t,{fills:Y,fillMode:$,fill:j,fillOpacity:B,stroke:k,strokeWidth:R,strokeOpacity:z,lineDash:X,lineDashOffset:Q,min:q=0,max:J=1,interval:it={},label:st={}}=A,nt=pickProps(t,{animation:e,background:i,container:s,contextMenu:n,footnote:r,height:o,listeners:a,locale:l,minHeight:c,minWidth:h,overrideDevicePixelRatio:u,padding:d,subtitle:p,theme:g,title:m,tooltip:pickTooltipProps(b),width:y}),ot=pickProps(A,{fills:Y,fillMode:$,fill:j,fillOpacity:B,stroke:k,strokeWidth:R,strokeOpacity:z,lineDash:X,lineDashOffset:Q}),rt=pickProps(t,{startAngle:IGNORED_PROP,endAngle:IGNORED_PROP,needle:w!=null?{enabled:!0,...w}:IGNORED_PROP,scale:ot,type:f,cursor:x,nodeClickRange:v,listeners:a,tooltip:b,value:S,highlightStyle:L,segmentation:N,bar:T,targets:O,outerRadius:Z,innerRadius:F,outerRadiusRatio:U,innerRadiusRatio:W,cornerRadius:H,cornerMode:_,label:E,secondaryLabel:P,spacing:G,...V});return{...nt,series:[rt],axes:[{type:"angle-number",min:q,max:J,startAngle:D,endAngle:I,interval:it??{},label:st??{}},{type:"radius-number"}]}}function linearGaugeOptions(t){const{animation:e,background:i,container:s,contextMenu:n,footnote:r,height:o,listeners:a,locale:l,minHeight:c,minWidth:h,overrideDevicePixelRatio:u,padding:d,subtitle:p,theme:g,title:m,width:y,type:f,cursor:x,nodeClickRange:v,tooltip:b,value:S,scale:A={},direction:D="vertical",thickness:I,highlightStyle:L,segmentation:N,bar:T,targets:w,cornerRadius:O,cornerMode:Z,label:F,...U}=t,{fills:W,fillMode:H,fill:_,fillOpacity:E,stroke:P,strokeWidth:G,strokeOpacity:V,lineDash:Y,lineDashOffset:$,min:j=0,max:B=1,interval:k={},label:R={}}=A,z=pickProps(t,{animation:e,background:i,container:s,contextMenu:n,footnote:r,height:o,listeners:a,locale:l,minHeight:c,minWidth:h,overrideDevicePixelRatio:u,padding:d,subtitle:p,theme:g,title:m,tooltip:pickTooltipProps(b),width:y}),X=pickProps(A,{fills:W,fillMode:H,fill:_,fillOpacity:E,stroke:P,strokeWidth:G,strokeOpacity:V,lineDash:Y,lineDashOffset:$}),Q=pickProps(t,{scale:X,type:f,cursor:x,nodeClickRange:v,listeners:a,tooltip:b,value:S,direction:D,thickness:I,highlightStyle:L,segmentation:N,bar:T,targets:w,cornerRadius:O,cornerMode:Z,label:F,...U}),{placement:q,...J}=R;let it,st;const nt=D==="horizontal";nt?(it=q==="before"?"top":"bottom",st="left"):(it=q==="after"?"right":"left",st="bottom");const ot={type:"number",position:it,min:j,max:B,reverse:!nt,interval:k,label:J,nice:!1},rt={type:"number",position:st,min:0,max:1,label:{enabled:!1}};return{...z,series:[Q],axes:nt?[ot,rt]:[rt,ot]}}function applyThemeDefaults(t,e){if(e==null)return t;const{targets:i,...s}=e;return t=mergeDefaults(t,s),t.targets!=null&&i!=null&&(t.targets=mergeArrayDefaults(t.targets,i)),t}function gauge(t,e){if(isRadialGauge(t)){const x=applyThemeDefaults(t,e);return radialGaugeOptions(x)}else if(isLinearGauge(t)){const x=applyThemeDefaults(t,e);return linearGaugeOptions(x)}const{animation:i,background:s,container:n,contextMenu:r,footnote:o,height:a,listeners:l,locale:c,minHeight:h,minWidth:u,padding:d,subtitle:p,theme:g,title:m,tooltip:y,width:f}=t;return pickProps(t,{animation:i,background:s,container:n,contextMenu:r,footnote:o,height:a,listeners:l,locale:c,minHeight:h,minWidth:u,padding:d,subtitle:p,theme:g,title:m,tooltip:y,width:f})}var stroke={stroke:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR},handle={fill:DEFAULT_ANNOTATION_HANDLE_FILL},axisLabel={color:"white",fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR},lineText={color:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR},font={color:DEFAULT_TEXT_ANNOTATION_COLOR,fontSize:{$rem:[1.1666666666666667]},fontFamily:{$ref:"fontFamily"}},text={...font,textAlign:"left"},measurerStatistics={...font,fontSize:{$ref:"fontSize"},color:DEFAULT_ANNOTATION_STATISTICS_COLOR,fill:DEFAULT_ANNOTATION_STATISTICS_FILL,stroke:DEFAULT_ANNOTATION_STATISTICS_STROKE,strokeWidth:1,divider:{stroke:DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,strokeWidth:1,strokeOpacity:.5}},measurer={...stroke,background:{fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2},handle:{...handle},text:{...lineText},statistics:{...measurerStatistics}},annotationsTheme={line:{...stroke,handle:{...handle},text:{...lineText}},"horizontal-line":{...stroke,handle:{...handle},axisLabel:{...axisLabel},text:{...lineText}},"vertical-line":{...stroke,handle:{...handle},axisLabel:{...axisLabel},text:{...lineText}},"disjoint-channel":{...stroke,background:{fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2},handle:{...handle},text:{...lineText}},"parallel-channel":{...stroke,background:{fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2},handle:{...handle},text:{...lineText}},"fibonacci-retracement":{...stroke,strokes:DEFAULT_FIBONACCI_STROKES,rangeStroke:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,handle:{...handle},text:{...lineText,position:"center"},label:{...font,color:void 0,fontSize:{$round:[{$mul:[{$ref:"fontSize"},10/12]}]}}},"fibonacci-retracement-trend-based":{...stroke,strokes:DEFAULT_FIBONACCI_STROKES,rangeStroke:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,handle:{...handle},text:{...lineText,position:"center"},label:{...font,color:void 0,fontSize:{$round:[{$mul:[{$ref:"fontSize"},10/12]}]}}},callout:{...stroke,...text,color:{$ref:"textColor"},handle:{...handle},fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2},comment:{...text,color:"white",fontWeight:700,handle:{...handle},fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR},note:{...text,color:DEFAULT_TEXTBOX_COLOR,fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,stroke:{$ref:"backgroundColor"},strokeWidth:1,strokeOpacity:1,handle:{...handle},background:{fill:DEFAULT_TEXTBOX_FILL,stroke:DEFAULT_TEXTBOX_STROKE,strokeWidth:1}},text:{...text,handle:{...handle}},arrow:{...stroke,handle:{...handle},text:{...lineText}},"arrow-up":{fill:PALETTE_UP_FILL,handle:{...handle,stroke:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR}},"arrow-down":{fill:PALETTE_DOWN_FILL,handle:{...handle,stroke:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR}},"date-range":{...measurer},"price-range":{...measurer},"date-price-range":{...measurer},"quick-date-price-range":{up:{...stroke,fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,fillOpacity:.2,handle:{...handle},statistics:{...measurerStatistics,color:"#fff",fill:DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}},down:{...stroke,stroke:DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,fill:DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,fillOpacity:.2,handle:{...handle,stroke:DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE},statistics:{...measurerStatistics,color:"#fff",fill:DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,strokeWidth:0,divider:{stroke:"#fff",strokeWidth:1,strokeOpacity:.5}}}}};function fromTheme(t,e){if(isObject(t))return e(t)}var chartTypes3=["ohlc","line","step-line","hlc","high-low","candlestick","hollow-candlestick"],toolbarButtons=[{icon:"trend-line-drawing",tooltip:"toolbarAnnotationsLineAnnotations",value:"line-menu"},{icon:"fibonacci-retracement-drawing",tooltip:"toolbarAnnotationsFibonacciAnnotations",value:"fibonacci-menu"},{icon:"text-annotation",tooltip:"toolbarAnnotationsTextAnnotations",value:"text-menu"},{icon:"arrow-drawing",tooltip:"toolbarAnnotationsShapeAnnotations",value:"shape-menu"},{icon:"measurer-drawing",tooltip:"toolbarAnnotationsMeasurerAnnotations",value:"measurer-menu"},{icon:"delete",tooltip:"toolbarAnnotationsClearAll",value:"clear"}];function priceVolume(t,e,i){const{dateKey:s="date",highKey:n="high",openKey:r="open",lowKey:o="low",closeKey:a="close",volumeKey:l="volume",chartType:c="candlestick",navigator:h=!1,volume:u=!0,rangeButtons:d=!0,statusBar:p=!0,toolbar:g=!0,zoom:m=!0,theme:y,data:f,...x}=t,v=createPriceSeries(y,c,s,n,o,r,a),b=createVolumeSeries(y,i,r,a,u,l),A={navigator:{enabled:h,...u?{miniChart:{enabled:h,series:[{type:"line",xKey:s,yKey:l,marker:{enabled:!1}}]},height:40,minHandle:{height:46},maxHandle:{height:46}}:null}},D=typeof y=="string"?!0:y?.overrides?.common?.annotations?.axesButtons?.enabled??!0,I={annotations:{enabled:g,optionsToolbar:{enabled:g},snap:!0,axesButtons:{enabled:D},toolbar:{enabled:g,buttons:toolbarButtons,padding:0},data:f,xKey:s,volumeKey:u?l:void 0}},L=p?{statusBar:{enabled:!0,data:f,highKey:n,openKey:r,lowKey:o,closeKey:a,volumeKey:u?l:void 0}}:null,N={zoom:{enabled:m,autoScaling:{enabled:!0},enableIndependentAxes:!0}},T={ranges:{enabled:d}},w=u?[{type:"number",position:"left",keys:[l],label:{enabled:!1},crosshair:{enabled:!1},gridLine:{enabled:!1},nice:!1,layoutConstraints:{stacked:!1,width:20,unit:"percentage",align:"end"}}]:[];return{theme:{baseTheme:typeof y=="string"?y:"ag-financial",...mergeDefaults(typeof y=="object"?y:null,{overrides:{common:{title:{padding:4},padding:{top:6,right:8,bottom:5},chartToolbar:{enabled:g},annotations:{...annotationsTheme}}}})},animation:{enabled:!1},legend:{enabled:!1},series:[...b,...v],axes:[{type:"number",position:"right",keys:[r,a,n,o],interval:{maxSpacing:fromTheme(y,O=>O.overrides?.common?.axes?.number?.interval?.maxSpacing)??45},label:{format:fromTheme(y,O=>O.overrides?.common?.axes?.number?.label?.format)??".2f"},crosshair:{enabled:!0,snap:!1},layoutConstraints:{stacked:!1,width:100,unit:"percentage",align:"start"}},...w,{type:"ordinal-time",position:"bottom",line:{enabled:!1},label:{enabled:!0},crosshair:{enabled:!0}}],tooltip:{enabled:!1},data:f,...I,...A,...L,...N,...T,...x}}function createVolumeSeries(t,e,i,s,n,r){if(!n)return[];const o=fromTheme(t,l=>l.overrides?.bar?.series?.fill),a=o?{fill:o}:{itemStyler({datum:l}){const{up:c,down:h}=e().palette;return{fill:l[i]l.overrides?.bar?.series?.fillOpacity)??.5,...a,focusPriority:1,fastDataProcessing:!0}]}var RANGE_AREA_TYPE="range-area";function createPriceSeries(t,e,i,s,n,r,o){const a={xKey:i,openKey:r,closeKey:o,highKey:s,lowKey:n},l={xKey:i,yKey:o},c={pickOutsideVisibleMinorAxis:!0};switch(e??"candlestick"){case"ohlc":return createPriceSeriesOHLC(c,a);case"line":return createPriceSeriesLine(c,t,l);case"step-line":return createPriceSeriesStepLine(c,t,l);case"hlc":return createPriceSeriesHLC(c,t,l,a);case"high-low":return createPriceSeriesHighLow(c,t,a);case"candlestick":return createPriceSeriesCandlestick(c,a);case"hollow-candlestick":return createPriceSeriesHollowCandlestick(c,t,a);default:return logger_exports.warnOnce(`unknown chart type: ${e}; expected one of: ${chartTypes3.join(", ")}`),createPriceSeriesCandlestick(c,a)}}function createPriceSeriesOHLC(t,e){return[{type:"ohlc",focusPriority:0,...t,...e}]}function createPriceSeriesLine(t,e,i){return[{type:"line",focusPriority:0,...t,...i,stroke:fromTheme(e,s=>s.overrides?.line?.series?.stroke)??PALETTE_NEUTRAL_STROKE,marker:fromTheme(e,s=>s.overrides?.line?.series?.marker)??{enabled:!1}}]}function createPriceSeriesStepLine(t,e,i){return[{type:"line",focusPriority:0,...t,...i,stroke:fromTheme(e,s=>s.overrides?.line?.series?.stroke)??PALETTE_NEUTRAL_STROKE,interpolation:fromTheme(e,s=>s.overrides?.line?.series?.interpolation)??{type:"step"},marker:fromTheme(e,s=>s.overrides?.line?.series?.marker)??{enabled:!1}}]}function createPriceSeriesHLC(t,e,i,{xKey:s,highKey:n,closeKey:r,lowKey:o}){const a=getThemeColors(RANGE_AREA_TYPE,e);return[{type:RANGE_AREA_TYPE,focusPriority:0,...t,xKey:s,yHighKey:n,yLowKey:r,fill:a.fill??PALETTE_UP_FILL,stroke:a.stroke??PALETTE_UP_STROKE,fillOpacity:fromTheme(e,l=>l.overrides?.["range-area"]?.series?.fillOpacity)??.3,strokeWidth:fromTheme(e,l=>l.overrides?.["range-area"]?.series?.strokeWidth)??2},{type:RANGE_AREA_TYPE,focusPriority:0,...t,xKey:s,yHighKey:r,yLowKey:o,fill:a.fill??PALETTE_DOWN_FILL,stroke:a.stroke??PALETTE_DOWN_STROKE,fillOpacity:fromTheme(e,l=>l.overrides?.["range-area"]?.series?.fillOpacity)??.3,strokeWidth:fromTheme(e,l=>l.overrides?.["range-area"]?.series?.strokeWidth)??2},{type:"line",...t,...i,stroke:fromTheme(e,l=>l.overrides?.line?.series?.stroke)??PALETTE_ALT_NEUTRAL_STROKE,strokeWidth:fromTheme(e,l=>l.overrides?.line?.series?.strokeWidth)??2,marker:fromTheme(e,l=>l.overrides?.line?.series?.marker)??{enabled:!1}}]}function createPriceSeriesHighLow(t,e,{xKey:i,highKey:s,lowKey:n}){const r=getThemeColors("range-bar",e);return[{type:"range-bar",...t,xKey:i,yHighKey:s,yLowKey:n,fill:r.fill??PALETTE_NEUTRAL_FILL,stroke:r.stroke??PALETTE_NEUTRAL_STROKE,tooltip:{range:"nearest"},focusPriority:0,fastDataProcessing:!0}]}function createPriceSeriesCandlestick(t,e){return[{type:"candlestick",focusPriority:0,...t,...e}]}function createPriceSeriesHollowCandlestick(t,e,i){const s=fromTheme(e,n=>n.overrides?.candlestick?.series?.item);return[{type:"candlestick",focusPriority:0,...t,...i,item:{up:{fill:s?.up?.fill??"transparent"}}}]}function getThemeColors(t,e){const i=fromTheme(e,n=>n.overrides?.[t]?.series?.fill),s=fromTheme(e,n=>n.overrides?.[t]?.series?.stroke);return{fill:i,stroke:s}}var commonAxisProperties={title:{enabled:!1},label:{enabled:!1},line:{enabled:!1},gridLine:{enabled:!1},crosshair:{enabled:!1,stroke:DEFAULT_SPARKLINE_CROSSHAIR_STROKE,lineDash:[0],label:{enabled:!1}}},numericAxisProperties={...commonAxisProperties,nice:!1},tooltipDefaults={position:{type:"sparkline"}},barGridLineDefaults={style:[{stroke:{$ref:"gridLineColor"}}],width:2},barAxisDefaults={number:{gridLine:barGridLineDefaults},time:{gridLine:barGridLineDefaults},category:{gridLine:barGridLineDefaults}},SPARKLINE_THEME={overrides:{common:{animation:{enabled:!1},contextMenu:{enabled:!1},keyboard:{enabled:!1},background:{visible:!1},padding:{top:0,right:0,bottom:0,left:0},axes:{number:{...numericAxisProperties,interval:{values:[0]}},log:{...numericAxisProperties},time:{...numericAxisProperties},category:{...commonAxisProperties}}},bar:{series:{crisp:!1,label:{placement:"inside-end",padding:4},sparklineMode:!0},tooltip:{...tooltipDefaults,range:"nearest"},axes:barAxisDefaults},line:{seriesArea:{padding:{top:2,right:2,bottom:2,left:2}},series:{sparklineMode:!0,strokeWidth:1,marker:{enabled:!1,size:3},tooltip:tooltipDefaults}},area:{seriesArea:{padding:{top:1,right:0,bottom:1,left:0}},series:{strokeWidth:1,fillOpacity:.4,tooltip:tooltipDefaults}}}},setInitialBaseTheme=simpleMemorize(createInitialBaseTheme);function createInitialBaseTheme(t,e){return typeof t=="string"?{...e,baseTheme:t}:t!=null?{...t,baseTheme:setInitialBaseTheme(t.baseTheme,e)}:e}function sparklineDataPreset(t){if(Array.isArray(t)&&t.length!==0){const e=t[0];if(typeof e=="number")return{data:t.map((s,n)=>({x:n,y:s})),series:[{xKey:"x",yKey:"y"}],datumKey:"y"};if(Array.isArray(e))return{data:t.map(s=>({x:s[0],y:s[1],datum:s})),series:[{xKey:"x",yKey:"y"}],datumKey:"datum"}}return{data:t}}function axisPreset(t,e){switch(t?.type){case"number":{const{type:i,min:s,max:n,reverse:r}=t;return pickProps(t,{type:i,reverse:r,min:s,max:n})}case"time":{const{type:i,min:s,max:n,reverse:r}=t;return pickProps(t,{type:i,reverse:r,min:s,max:n})}case"category":{const{type:i,paddingInner:s,paddingOuter:n,reverse:r}=t;return pickProps(t,{type:i,reverse:r,paddingInner:s,paddingOuter:n})}}return{type:e}}function gridLinePreset(t,e,i){const s={};return t?.stroke!=null&&(s.style=[{stroke:t?.stroke}],s.enabled??(s.enabled=!0)),t?.strokeWidth!=null&&(s.width=t?.strokeWidth,s.enabled??(s.enabled=!0)),i.type==="bar"&&i.direction!=="horizontal"&&(s.enabled??(s.enabled=!0)),t?.visible!=null&&(s.enabled=t.visible),s.enabled??(s.enabled=e),s}var tooltipRendererFn=simpleMemorize((t,e,i)=>s=>{const n=s.datum[s.xKey],r=s.datum[s.yKey],o=i!=null?s.datum[i]:s.datum,a=e?.renderer?.({context:t,datum:o,xValue:n,yValue:r});if(typeof a=="string")return a;const l=a?.title,c=a?.content;return l!=null&&c!=null?{heading:l,title:void 0,data:[{label:void 0,value:c}]}:{heading:l??c??r.toFixed(2),title:void 0,data:[]}});function sparkline(t){const{background:e,container:i,height:s,listeners:n,locale:r,minHeight:o,minWidth:a,overrideDevicePixelRatio:l,padding:c,width:h,theme:u,data:d,crosshair:p,axis:g,min:m,max:y,tooltip:f,context:x,...v}=t,b=pickProps(t,{background:e,container:i,height:s,listeners:n,locale:r,minHeight:o,minWidth:a,overrideDevicePixelRatio:l,padding:c,width:h,tooltip:IGNORED_PROP,context:IGNORED_PROP,data:IGNORED_PROP,crosshair:IGNORED_PROP,axis:IGNORED_PROP,min:IGNORED_PROP,max:IGNORED_PROP,theme:IGNORED_PROP}),{data:S,series:[A]=[],datumKey:D}=sparklineDataPreset(d),I=v;A!=null&&Object.assign(I,A),I.tooltip={...f,renderer:tooltipRendererFn(x,f,D)},b.theme=setInitialBaseTheme(u,SPARKLINE_THEME),b.data=S,b.series=[I];const L=I.type!=="bar"||I.direction!=="horizontal",[N,T]=L?["bottom","left"]:["left","bottom"],w={...axisPreset(g,"category"),position:N,...pickProps(t,{crosshair:p})},O={type:"number",gridLine:gridLinePreset(g,!1,t),position:T,...pickProps(t,{min:m,max:y})};return b.axes=L?[O,w]:[w,O],b}var PRESETS={"price-volume":priceVolume,gauge,sparkline},PRESET_DATA_PROCESSORS={sparkline:sparklineDataPreset};function removeUsedEnterpriseOptions(t,e){let i=[];const s=isAgGaugeChartOptions(t),n=optionsType(t),r=n?chartTypes2.get(n):"unknown";for(const o of EXPECTED_ENTERPRISE_MODULES)if(!(r!=="unknown"&&!o.chartTypes.includes(r))){if(o.type==="root"||o.type==="legend"){const a=t[o.optionsKey];if(a==null)continue;o.optionsInnerKey?a[o.optionsInnerKey]&&(i.push(`${o.optionsKey}.${o.optionsInnerKey}`),delete a[o.optionsInnerKey]):(i.push(o.optionsKey),delete t[o.optionsKey])}else if(o.type==="axis"){if(!("axes"in t)||!t.axes?.some(a=>a.type===o.identifier))continue;i.push(`axis[type=${o.identifier}]`),t.axes=t.axes.filter(a=>a.type!==o.identifier)}else if(o.type==="axis-option"){if(!("axes"in t)||!t.axes?.some(a=>a[o.optionsKey]))continue;i.push(`axis.${o.optionsKey}`),t.axes.forEach(a=>{a[o.optionsKey]&&delete a[o.optionsKey]})}else if(o.type==="series"){if(o.community||!t.series?.some(a=>a.type===o.identifier))continue;i.push(`series[type=${o.identifier}]`),t.series=t.series.filter(a=>a.type!==o.identifier)}else if(o.type==="series-option"){if(!t.series?.some(a=>a[o.optionsKey]))continue;i.push(`series.${o.optionsKey}`),t.series.forEach(a=>{a[o.optionsKey]&&delete a[o.optionsKey]})}}if(i.length&&!e){s&&(i=["AgCharts.createGauge"]);let o="ag-charts-enterprise",a="https://www.ag-grid.com/charts/javascript/installation/";t.mode==="integrated"&&(o="ag-grid-charts-enterprise' or 'ag-grid-enterprise/charts-enterprise",a="https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/"),logger_exports.warnOnce([`unable to use these enterprise features as '${o}' has not been loaded:`,"",...i,"",`See: ${a}`].join(` `))}}function removeUnusedEnterpriseOptions(t){const e="mode"in t&&t.mode==="integrated";for(const i of moduleRegistry.byType("root","legend")){const s=t[i.optionsKey],n=s!=null&&s.enabled===!1,r=!("removable"in i)||i.removable===!0||i.removable==="standalone-only"&&!e;n&&r&&delete t[i.optionsKey]}}function paletteType(t){return t?.up||t?.down||t?.neutral?"user-full":t?.fills||t?.strokes?"user-indexed":"inbuilt"}var DEFAULT_BACKGROUND_FILL="white",CHART_TYPE_CONFIG={get cartesian(){return{seriesTypes:chartTypes2.cartesianTypes,commonOptions:["zoom","navigator"]}},get polar(){return{seriesTypes:chartTypes2.polarTypes,commonOptions:[]}},get hierarchy(){return{seriesTypes:chartTypes2.hierarchyTypes,commonOptions:[]}},get topology(){return{seriesTypes:chartTypes2.topologyTypes,commonOptions:[]}},get"flow-proportion"(){return{seriesTypes:chartTypes2.flowProportionTypes,commonOptions:[]}},get standalone(){return{seriesTypes:chartTypes2.standaloneTypes,commonOptions:[]}},get gauge(){return{seriesTypes:chartTypes2.gaugeTypes,commonOptions:[]}}},PRESET_OVERRIDES_TYPES={"radial-gauge":!0,"linear-gauge":!0};function isPresetOverridesType(t){return PRESET_OVERRIDES_TYPES[t]===!0}var CHART_TYPE_SPECIFIC_COMMON_OPTIONS=Object.values(CHART_TYPE_CONFIG).reduce((t,{commonOptions:e})=>t.concat(e),[]),_ChartTheme=class Nt{static getAxisDefaults(e){return mergeDefaults(e,{title:{enabled:!1,text:"Axis Title",spacing:25,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:[1.0833333333333333]},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"}},label:{fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},spacing:11,color:{$ref:"textColor"},avoidCollisions:!0},line:{enabled:!0,width:1,stroke:{$ref:"axisColor"}},tick:{enabled:!1,width:1,stroke:{$ref:"axisColor"}},gridLine:{enabled:!0,style:[{stroke:{$ref:"gridLineColor"},lineDash:[]}]},crossLines:{enabled:!1,fill:{$ref:"foregroundColor"},stroke:{$ref:"foregroundColor"},fillOpacity:.1,strokeWidth:1,label:{enabled:!1,fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},padding:5,color:{$ref:"textColor"}}},crosshair:{enabled:!0}})}getChartDefaults(){return{minHeight:300,minWidth:300,background:{visible:!0,fill:{$ref:"backgroundColor"}},padding:{top:{$ref:"padding"},right:{$ref:"padding"},bottom:{$ref:"padding"},left:{$ref:"padding"}},seriesArea:{padding:{top:0,right:0,bottom:0,left:0}},keyboard:{enabled:!0},title:{enabled:!1,text:"Title",fontWeight:{$ref:"fontWeight"},fontSize:{$rem:[1.4166666666666667]},fontFamily:{$ref:"fontFamily"},color:{$ref:"textColor"},wrapping:"hyphenate",layoutStyle:DEFAULT_CAPTION_LAYOUT_STYLE,textAlign:DEFAULT_CAPTION_ALIGNMENT},subtitle:{enabled:!1,text:"Subtitle",spacing:20,fontWeight:{$ref:"fontWeight"},fontSize:{$rem:[1.0833333333333333]},fontFamily:{$ref:"fontFamily"},color:{$ref:"subtleTextColor"},wrapping:"hyphenate",layoutStyle:DEFAULT_CAPTION_LAYOUT_STYLE,textAlign:DEFAULT_CAPTION_ALIGNMENT},footnote:{enabled:!1,text:"Footnote",spacing:20,fontSize:{$rem:[1.0833333333333333]},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"},color:{$ref:"subtleTextColor"},wrapping:"hyphenate",layoutStyle:DEFAULT_CAPTION_LAYOUT_STYLE,textAlign:DEFAULT_CAPTION_ALIGNMENT},legend:{position:"bottom",spacing:30,listeners:{},toggleSeries:!0,item:{paddingX:16,paddingY:8,marker:{size:15,padding:8},showSeriesStroke:!0,label:{color:{$ref:"textColor"},fontSize:{$ref:"fontSize"},fontFamily:{$ref:"fontFamily"},fontWeight:{$ref:"fontWeight"}}},reverseOrder:!1,pagination:{marker:{size:12},activeStyle:{fill:{$ref:"foregroundColor"}},inactiveStyle:{fill:{$ref:"subtleTextColor"}},highlightStyle:{fill:{$ref:"foregroundColor"}},label:{color:{$ref:"textColor"}}}},tooltip:{enabled:!0,darkTheme:IS_DARK_THEME,delay:0},overlays:{darkTheme:IS_DARK_THEME},listeners:{}}}constructor(e={}){const{overrides:i,palette:s}=deepClone(e),n=this.createChartConfigPerChartType(this.getDefaults()),r={};i&&this.mergeOverrides(n,r,i);const{fills:o,strokes:a,...l}=this.getDefaultColors();this.palette=deepFreeze(mergeDefaults(s,{fills:Object.values(o),strokes:Object.values(a),...l})),this.paletteType=paletteType(s),this.config=deepFreeze(this.templateTheme(n)),this.presets=deepFreeze(r)}mergeOverrides(e,i,s){for(const{seriesTypes:n,commonOptions:r}of Object.values(CHART_TYPE_CONFIG)){const o={...s.common};for(const a of CHART_TYPE_SPECIFIC_COMMON_OPTIONS)r.includes(a)||delete o[a];if(o)for(const a of n){const l=a;isPresetOverridesType(l)||(e[l]=mergeDefaults(o,e[l]))}}chartTypes2.seriesTypes.forEach(n=>{const r=n,o=s[r];isPresetOverridesType(r)?i[r]=o:e[r]=mergeDefaults(o,e[r])})}createChartConfigPerChartType(e){for(const[i,{seriesTypes:s}]of Object.entries(CHART_TYPE_CONFIG)){const n=chartDefaults.get(i);for(const r of s)e[r]??(e[r]=deepClone(n))}return e}getDefaults(){const e=(i,s)=>{const n={},r={axes:{},...legendRegistry.getThemeTemplates(),...this.getChartDefaults(),...chartDefaults.get(i)};for(const o of s){n[o]=mergeDefaults(seriesRegistry.getThemeTemplate(o),n[o]??deepClone(r));const{axes:a}=n[o];for(const l of axisRegistry.keys())a[l]=mergeDefaults(a[l],axisRegistry.getThemeTemplate(l),Nt.cartesianAxisDefault[l])}return n};return mergeDefaults(e("cartesian",chartTypes2.cartesianTypes),e("polar",chartTypes2.polarTypes),e("hierarchy",chartTypes2.hierarchyTypes),e("topology",chartTypes2.topologyTypes),e("flow-proportion",chartTypes2.flowProportionTypes),e("standalone",chartTypes2.standaloneTypes),e("gauge",chartTypes2.gaugeTypes))}static applyTemplateTheme(e,i,s){if(isArray(e))for(let n=0;nnew ChartTheme),darkTheme=simpleMemorize(()=>new DarkTheme),themes={"ag-default-dark":darkTheme,"ag-sheets-dark":simpleMemorize(()=>new SheetsDark),"ag-polychroma-dark":simpleMemorize(()=>new PolychromaDark),"ag-vivid-dark":simpleMemorize(()=>new VividDark),"ag-material-dark":simpleMemorize(()=>new MaterialDark),"ag-financial-dark":simpleMemorize(()=>new FinancialDark),null:lightTheme,undefined:lightTheme,"ag-default":lightTheme,"ag-sheets":simpleMemorize(()=>new SheetsLight),"ag-polychroma":simpleMemorize(()=>new PolychromaLight),"ag-vivid":simpleMemorize(()=>new VividLight),"ag-material":simpleMemorize(()=>new MaterialLight),"ag-financial":simpleMemorize(()=>new FinancialLight)},getChartTheme=simpleMemorize(createChartTheme);function createChartTheme(t){if(t instanceof ChartTheme)return t;if(t==null||typeof t=="string"){const i=themes[t];return i?i():(logger_exports.warnOnce(`the theme [${t}] is invalid, using [ag-default] instead.`),lightTheme())}const{errors:e}=validate(t,themeOptionsDef,"theme");if(!e.length){const i=reduceThemeOptions(t),s=i.baseTheme?getChartTheme(i.baseTheme):lightTheme();return new s.constructor(i)}for(const{message:i}of e)logger_exports.warnOnce(i);return lightTheme()}function reduceThemeOptions(t){let e=t,i,s;const n=[];for(;typeof e=="object";)i??(i=e.palette),s??(s=e.params),e.overrides&&n.push(e.overrides),e=e.baseTheme;return{baseTheme:e,overrides:mergeDefaults(...n),params:s,palette:i}}var themeOptionsDef={baseTheme:or(string,object),overrides:object,params:object,palette:{fills:arrayOf(string),strokes:arrayOf(string),up:{fill:string,stroke:string},down:{fill:string,stroke:string},neutral:{fill:string,stroke:string}}},unthemedSeries=new Set(["map-shape-background","map-line-background"]),_ChartOptions=class ut{constructor(e,i,s,n,r,o=!1){this.themeParameters={},this.debug=Debug.create(!0,"opts"),this.optionMetadata=n??{},this.processedOverrides=i??{};let a=null;if(e instanceof ut){if(a=e,this.specialOverrides=a.specialOverrides,!r)throw new Error("AG Charts - internal error: deltaOptions must be supplied.");this.userOptions=mergeDefaults(r,deepClone(a.userOptions,ut.OPTIONS_CLONE_OPTS))}else this.userOptions=e,this.specialOverrides=this.specialOverridesDefaults({...s});o&&this.removeLeftoverSymbols(this.userOptions);let l,c,h,u,d;!o&&r!=null&&ut.isFastPathDelta(r)&&a!=null?{activeTheme:l,processedOptions:c,defaultAxes:h,fastDelta:u}=this.fastSetup(r,a):{activeTheme:l,processedOptions:c,defaultAxes:h,themeParameters:d}=this.slowSetup(i,r,o),this.activeTheme=l,this.processedOptions=c,this.defaultAxes=h,this.fastDelta=u,this.themeParameters=d??{}}static isFastPathDelta(e){for(const i of Object.keys(e))if(!this.FAST_PATH_OPTIONS.has(i))return!1;return!0}fastSetup(e,i){const{activeTheme:s,defaultAxes:n,processedOptions:r}=i,{presetType:o}=this.optionMetadata,a=o?PRESET_DATA_PROCESSORS[o]:void 0;if(o!=null&&e.data!=null&&a!=null){const{series:c,data:h}=a(e.data);e=mergeDefaults({series:c,data:h},e)}this.fastSeriesSetup(e,r);const l=mergeDefaults(e,r);return{activeTheme:s,defaultAxes:n,processedOptions:l,fastDelta:e}}fastSeriesSetup(e,i){e.series&&(e.series?.every((s,n)=>jsonPropertyCompare(s,i.series?.[n]??{}))?delete e.series:e.series=e.series.map((s,n)=>mergeDefaults(s,i.series?.[n]??{})))}slowSetup(e,i,s=!1){let n=deepClone(this.userOptions,ut.OPTIONS_CLONE_OPTS);i&&(n=mergeDefaults(i,n),s&&this.removeLeftoverSymbols(n));const{presetType:r}=this.optionMetadata;if(r!=null){const f=PRESETS[r],x=this.userOptions,v=this.userOptions.type,b=v!=null?getChartTheme(this.userOptions.theme).presets[v]:void 0;this.debug(">>> AgCharts.createOrUpdate() - applying preset",x),n=f?.(x,b,()=>this.activeTheme)??n}enterpriseModule.isEnterprise||removeUsedEnterpriseOptions(n);const o=getChartTheme(n.theme);this.sanityCheck(n),this.removeDisabledOptions(n);const a=this.optionsType(n),{axes:l={},annotations:c={},series:h,...u}=this.getSeriesThemeConfig(a,o),[d,p]=this.splitAnnotationsOptions(c);this.annotationThemes=deepClone(p);const g=this.getDefaultAxes(n,h);let m=mergeDefaults(e,n,d,u,g);this.processAxesOptions(m,l),this.processSeriesOptions(m,o),this.processMiniChartSeriesOptions(m,o),m=deepClone(m,ut.OPTIONS_CLONE_OPTS);const y=this.getThemeParameters(o,m);return this.resolveThemeOperations(y,y),this.resolveThemeOperations(y,m),this.resolveThemeOperations(y,this.annotationThemes),(isAgCartesianChartOptions(m)||isAgStandaloneChartOptions(m)||isAgPolarChartOptionsWithSeriesBasedLegend(m))&&m.legend?.enabled==null&&(m.legend??(m.legend={}),m.legend.enabled=m.series.length>1),this.enableConfiguredOptions(m,this.userOptions),o.templateTheme(m,!1),this.removeDisabledOptions(n),removeUnusedEnterpriseOptions(m),enterpriseModule.isEnterprise||removeUsedEnterpriseOptions(m,!0),this.debug("AgCharts.createOrUpdate() - processed options",m),{activeTheme:o,processedOptions:m,defaultAxes:g,themeParameters:y}}diffOptions(e){return this===e?{}:e==null?this.processedOptions:this.fastDelta??jsonDiff(e.processedOptions,this.processedOptions)}getSeriesThemeConfig(e,i){return i?.config[e]??{}}getDefaultAxes(e,i){const s=this.optionsType(e);let n=e.series?.find(r=>(r.type??"line")===s)??{};return seriesRegistry.isDerivedDefaultAxes(s)&&(n=mergeDefaults(n,i)),seriesRegistry.cloneDefaultAxes(s,n)}optionsType(e){return e.series?.[0]?.type??"line"}sanityCheck(e){this.axesTypeIntegrity(e),this.seriesTypeIntegrity(e),this.soloSeriesIntegrity(e)}splitAnnotationsOptions(e){const{axesButtons:i=null,enabled:s=null,optionsToolbar:n=null,toolbar:r=null,...o}=e;return i==null&&s==null&&n==null&&r==null?[{},o]:[{annotations:{axesButtons:i,enabled:s,optionsToolbar:n,toolbar:r}},o]}processAxesOptions(e,i){"axes"in e&&(e.axes=e.axes?.map(s=>{const{crossLines:n,...r}=mergeDefaults(i[s.type]?.[s.position],i[s.type]);s.crossLines&&(s.crossLines=mergeArrayDefaults(s.crossLines,n));const o=r.gridLine?.style;s.gridLine?.style&&o?.length&&(s.gridLine.style=s.gridLine.style.map((d,p)=>d.stroke!=null||d.lineDash!=null?mergeDefaults(d,o.at(p%o.length)):d));const{top:a,right:l,bottom:c,left:h,...u}=mergeDefaults(s,r);return u}))}processSeriesOptions(e,i){const s=this.getTooltipPositionDefaults(e),n=isObject(e.theme)?paletteType(e.theme?.palette):"inbuilt",r={colourIndex:0,userPalette:n},o=e.series?.map(a=>{a.type??(a.type=this.getDefaultSeriesType(e));const{innerLabels:l,...c}=this.getSeriesThemeConfig(a.type,i).series??{},h=unthemedSeries.has(a.type)?{colourIndex:0,userPalette:n}:r,u=this.getSeriesPalette(a.type,h,i),d=this.getTooltipRangeDefaults(e,a.type),p=mergeDefaults(this.getSeriesGroupingOptions(a),a,s,d,c,u,{visible:!0});return p.innerLabels&&(p.innerLabels=mergeArrayDefaults(p.innerLabels,l)),p});e.series=this.setSeriesGroupingOptions(o??[])}processMiniChartSeriesOptions(e,i){let s=e.navigator?.miniChart?.series;if(s==null)return;const n={colourIndex:0,userPalette:isObject(e.theme)?paletteType(e.theme.palette):"inbuilt"};s=s.map(r=>{r.type??(r.type="line");const{innerLabels:o,...a}=this.getSeriesThemeConfig(r.type,i).series??{};return mergeDefaults(this.getSeriesGroupingOptions(r),r,a,this.getSeriesPalette(r.type,n,i))}),e.navigator.miniChart.series=this.setSeriesGroupingOptions(s)}getThemeParameters(e,i){const s=e.getPublicParameters();if(!isPlainObject(i.theme)||!i.theme.params)return s;const n=attachDescription(l=>isString(l)&&Color.validColorString(l),"a color"),r={accentColor:n,axisColor:n,backgroundColor:n,borderColor:n,foregroundColor:n,fontFamily:string,fontSize:number,fontWeight:or(string,number),gridLineColor:n,padding:number,subtleTextColor:n,textColor:n,chromeBackgroundColor:n,chromeFontFamily:string,chromeFontSize:number,chromeFontWeight:or(string,number),chromeSubtleTextColor:n,chromeTextColor:n,inputBackgroundColor:n,inputTextColor:n,crosshairLabelBackgroundColor:n,crosshairLabelTextColor:n},{valid:o,errors:a}=validate(i.theme.params,r);for(const{message:l}of a)logger_exports.warnOnce(l);return mergeDefaults(o,s)}resolveThemeOperations(e,i){const s=jsonResolveOperations(i,e,new Set(["palette","data"]));this.debug("resolveTheme()",s)}getSeriesPalette(e,i,s){const n=seriesRegistry.getPaletteFactory(e),{colourIndex:r,userPalette:o}=i,{fills:a=[],strokes:l=[]}=s.palette;return n?.({userPalette:o,colorsCount:Math.max(a.length,l.length),themeTemplateParameters:s.getTemplateParameters(),palette:s.palette,takeColors(c){return i.colourIndex+=c,{fills:circularSliceArray(a,c,r),strokes:circularSliceArray(l,c,r)}}})}getSeriesGroupingOptions(e){const i=seriesRegistry.isGroupable(e.type),s=seriesRegistry.isStackable(e.type),n=seriesRegistry.isStackedByDefault(e.type);e.grouped&&!i&&logger_exports.warnOnce(`unsupported grouping of series type "${e.type}".`),(e.stacked||e.stackGroup)&&!s&&logger_exports.warnOnce(`unsupported stacking of series type "${e.type}".`);let{grouped:r,stacked:o}=e;return o??(o=(n||e.stackGroup!=null)&&!(i&&r)),r??(r=!0),{stacked:s&&o,grouped:i&&r&&!(s&&o)}}setSeriesGroupingOptions(e){const i=this.getSeriesGrouping(e);this.debug("setSeriesGroupingOptions() - series grouping: ",i);const s={},n=i.reduce((r,o)=>{var a;return o.groupType==="default"||(r[a=o.seriesType]??(r[a]=0),r[o.seriesType]+=o.groupType==="stack"?1:o.series.length),r},{});return i.flatMap(r=>{var o;switch(s[o=r.seriesType]??(s[o]=0),r.groupType){case"stack":{const a=s[r.seriesType]++;return r.series.map((l,c)=>Object.assign(l,{seriesGrouping:{groupId:r.groupId,groupIndex:a,groupCount:n[r.seriesType],stackIndex:c,stackCount:r.series.length}}))}case"group":return r.series.map(a=>Object.assign(a,{seriesGrouping:{groupId:r.groupId,groupIndex:s[r.seriesType]++,groupCount:n[r.seriesType],stackIndex:0,stackCount:0}}))}return r.series}).map(({stacked:r,grouped:o,...a})=>a)}getSeriesGroupId(e){return[e.type,e.xKey,e.stacked?e.stackGroup??"stacked":"grouped"].filter(Boolean).join("-")}getSeriesGrouping(e){const i=new Map;return e.reduce((s,n)=>{const r=n.type;if(!n.stacked&&!n.grouped)s.push({groupType:"default",seriesType:r,series:[n],groupId:"__default__"});else{const o=this.getSeriesGroupId(n);if(!i.has(o)){const l={groupType:n.stacked?"stack":"group",seriesType:r,series:[],groupId:o};i.set(o,l),s.push(l)}i.get(o).series.push(n)}return s},[])}getDefaultSeriesType(e){switch(ModuleRegistry.detectChartDefinition(e).name){case"cartesian":return"line";case"polar":return"pie";case"hierarchy":return"treemap";case"topology":return"map-shape";case"flow-proportion":return"sankey";case"standalone":return"pyramid";case"gauge":return"radial-gauge";default:throw new Error("Invalid chart options type detected.")}}getTooltipPositionDefaults(e){const i=e.tooltip?.position;if(!isPlainObject(i))return;const{type:s,xOffset:n,yOffset:r}=i,o={};return isString(s)&&isEnumValue(AgTooltipPositionType,s)&&(o.type=s),isFiniteNumber(n)&&(o.xOffset=n),isFiniteNumber(r)&&(o.yOffset=r),{tooltip:{position:o}}}getTooltipRangeDefaults(e,i){return{tooltip:{range:e.tooltip?.range??seriesRegistry.getTooltipDefauls(i)?.range}}}axesTypeIntegrity(e){if("axes"in e&&e.axes){const i=e.axes;for(const{type:s}of i)if(!isAxisOptionType(s)){delete e.axes;const n=[...axisRegistry.keys()].join(", ");logger_exports.warnOnce(`unknown axis type: ${s}; expected one of: ${n}`)}}}seriesTypeIntegrity(e){e.series=e.series?.filter(({type:i})=>{if(i==null||isSeriesOptionType(i)||isEnterpriseSeriesType(i))return!0;logger_exports.warnOnce(`unknown series type: ${JSON.stringify(i)}; expected one of: ${publicChartTypes.seriesTypes.join(", ")}`)})}soloSeriesIntegrity(e){const i=e.series;if(i&&i.length>1&&i.some(s=>seriesRegistry.isSolo(s.type))){const s=this.optionsType(e);if(seriesRegistry.isSolo(s))logger_exports.warn(`series[0] of type '${s}' is incompatible with other series types. Only processing series[0]`),e.series=i.slice(0,1);else{const{solo:n,nonSolo:r}=groupBy(i,a=>seriesRegistry.isSolo(a.type)?"solo":"nonSolo"),o=unique(n.map(a=>a.type)).join(", ");logger_exports.warn(`Unable to mix these series types with the lead series type: ${o}`),e.series=r}}}static enableConfiguredJsonOptions(e,i){typeof i=="object"&&"enabled"in i&&!i._enabledFromTheme&&e.enabled==null&&(i.enabled=!0)}static cleanupEnabledFromThemeJsonOptions(e){e._enabledFromTheme!=null&&delete e._enabledFromTheme}enableConfiguredOptions(e,i){jsonWalk(i,ut.enableConfiguredJsonOptions,new Set(["data","theme"]),e),jsonWalk(e,ut.cleanupEnabledFromThemeJsonOptions,new Set(["data","theme"]))}static removeDisabledOptionJson(e){"enabled"in e&&e.enabled===!1&&Object.keys(e).forEach(i=>{i!=="enabled"&&delete e[i]})}removeDisabledOptions(e){jsonWalk(e,ut.removeDisabledOptionJson,new Set(["data","theme"]))}static removeLeftoverSymbolsJson(e){if(!(!e||!isObject(e)))for(const[i,s]of Object.entries(e))isSymbol(s)&&delete e[i]}removeLeftoverSymbols(e){jsonWalk(e,ut.removeLeftoverSymbolsJson,new Set(["data"]))}specialOverridesDefaults(e){if(e.window!=null?setWindow(e.window):typeof window<"u"?e.window=window:typeof global<"u"&&(e.window=global.window),e.document!=null?setDocument(e.document):typeof document<"u"?e.document=document:typeof global<"u"&&(e.document=global.document),e.window==null)throw new Error("AG Charts - unable to resolve global window");if(e.document==null)throw new Error("AG Charts - unable to resolve global document");return e}};_ChartOptions.OPTIONS_CLONE_OPTS=new Set(["data","container"]),_ChartOptions.FAST_PATH_OPTIONS=new Set(["data","width","height"]);var ChartOptions=_ChartOptions,CLEANUP_TIMEOUT_MS=100,_Pool=class mt{constructor(e,i,s,n,r,o=CLEANUP_TIMEOUT_MS){this.name=e,this.buildItem=i,this.releaseItem=s,this.destroyItem=n,this.maxPoolSize=r,this.cleanupTimeMs=o,this.freePool=[],this.busyPool=new Set}static getPool(e,i,s,n,r){return this.pools.has(e)||this.pools.set(e,new mt(e,i,s,n,r)),this.pools.get(e)}isFull(){return this.freePool.length+this.busyPool.size>=this.maxPoolSize}obtain(e){if(this.freePool.length===0&&this.isFull())throw new Error("AG Charts - pool exhausted");let i=this.freePool.pop();return i==null?(i=this.buildItem(e),mt.debug(`Pool[name=${this.name}]: Created instance (${this.freePool.length} / ${this.busyPool.size+1} / ${this.maxPoolSize})`,i)):mt.debug(`Pool[name=${this.name}]: Re-used instance (${this.freePool.length} / ${this.busyPool.size+1} / ${this.maxPoolSize})`,i),this.busyPool.add(i),{item:i,release:()=>this.release(i)}}release(e){if(!this.busyPool.has(e))throw new Error("AG Charts - cannot free item from pool which is not tracked as busy.");mt.debug(`Pool[name=${this.name}]: Releasing instance (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`,e),this.releaseItem(e),this.busyPool.delete(e),this.freePool.push(e),mt.debug(`Pool[name=${this.name}]: Returned instance to free pool (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`,e),this.cleanPoolTimer&&clearTimeout(this.cleanPoolTimer),this.cleanPoolTimer=setTimeout(()=>{this.cleanPool()},this.cleanupTimeMs)}cleanPool(){const e=this.freePool.splice(0);for(const i of e)this.destroyItem(i);mt.debug(`Pool[name=${this.name}]: Cleaned pool of ${e.length} items (${this.freePool.length} / ${this.busyPool.size} / ${this.maxPoolSize})`)}destroy(){this.cleanPool();for(const e of this.busyPool.values())this.destroyItem(e);this.busyPool.clear()}};_Pool.pools=new Map,_Pool.debug=Debug.create(!0,"pool");var Pool=_Pool;ModuleRegistry.registerMany([CartesianChartModule,PolarChartModule]);var debug3=Debug.create(!0,"opts"),AgCharts=class{static licenseCheck(t){this.licenseChecked||(this.licenseManager=enterpriseModule.licenseManager?.(t),this.licenseManager?.validateLicense(),this.licenseChecked=!0)}static getLicenseDetails(t){return enterpriseModule.licenseManager?.({}).getLicenseDetails(t)}static getInstance(t){return AgChartsInternal.getInstance(t)}static create(t,e){return debug3.group("AgCharts.create()",()=>{this.licenseCheck(t);const i=AgChartsInternal.createOrUpdate({userOptions:t,licenseManager:this.licenseManager,optionsMetadata:e});return this.licenseManager?.isDisplayWatermark()&&this.licenseManager&&enterpriseModule.injectWatermark?.(i.chart.ctx.domManager,this.licenseManager.getWatermarkMessage()),i})}static createFinancialChart(t){return debug3.group("AgCharts.createFinancialChart()",()=>this.create(t,{presetType:"price-volume"}))}static createGauge(t){return debug3.group("AgCharts.createGauge()",()=>this.create(t,{presetType:"gauge"}))}static __createSparkline(t){return debug3.group("AgCharts.__createSparkline()",()=>{const{pool:e,...i}=t;return this.create(i,{presetType:"sparkline",pool:e??!0})})}};AgCharts.licenseChecked=!1;var _AgChartsInternal=class pt{static getInstance(e){const i=Chart.getInstance(e);return i?AgChartInstanceProxy.chartInstances.get(i):void 0}static initialiseModules(){pt.initialised||(registerInbuiltModules(),setupModules(),pt.initialised=!0)}static createOrUpdate(e){let{proxy:i}=e;const{userOptions:s,licenseManager:n,processedOverrides:r=i?.chart.chartOptions.processedOverrides??{},specialOverrides:o=i?.chart.chartOptions.specialOverrides??{},optionsMetadata:a=i?.chart.chartOptions.optionMetadata??{},deltaOptions:l,stripSymbols:c=!1}=e,h=enterpriseModule.styles!=null?[["ag-charts-enterprise",enterpriseModule.styles]]:[],{presetType:u}=a;pt.initialiseModules(),debug3(()=>[">>> AgCharts.createOrUpdate() user options",deepClone(s)]);let d=s;AgCharts.optionsMutationFn&&d&&(d=AgCharts.optionsMutationFn(deepClone(d),u),debug3(()=>[">>> AgCharts.createOrUpdate() MUTATED user options",deepClone(d)]));const{document:p,window:g,styleContainer:m,...y}=d??{},f=(l?i?.chart.getChartOptions():y)??y,x=new ChartOptions(f,r,{...o,document:p,window:g,styleContainer:m},a,l,c);let v=!1,b=i?.chart,S;return(b==null||ModuleRegistry.detectChartDefinition(x.processedOptions)!==ModuleRegistry.detectChartDefinition(b.chartOptions.processedOptions))&&(S=this.getPool(x)?.obtain(x),S?b=S.item:(v=!0,b=pt.createChartInstance(x,b)),h.forEach(([A,D])=>{b?.ctx.domManager.addStyles(A,D)})),i==null?(i=new AgChartInstanceProxy(b,pt.callbackApi,n),i.releaseChart=S?.release):(S||v)&&(i.releaseChart?.(),i.chart=b,i.releaseChart=S?.release),debug3.check()&&typeof window<"u"&&(window.agChartInstances??(window.agChartInstances={}),window.agChartInstances[b.id]=b),b.queuedUserOptions.push(x.userOptions),b.queuedChartOptions.push(x),b.requestFactoryUpdate(A=>{debug3.group(">>>> Chart.applyOptions()",()=>{A.applyOptions(x);const D=A.queuedUserOptions.indexOf(x.userOptions)+1;A.queuedUserOptions.splice(0,D),A.queuedChartOptions.splice(0,D)})}),i}static markRemovedProperties(e,i,s=!1){if(typeof e!="object")return s;for(const[n,r]of Object.entries(e))typeof r>"u"&&(Object.assign(e,{[n]:Symbol("UNSET")}),s||(s=!0));return s}static updateUserDelta(e,i){i=deepClone(i,new Set(["data"]));const s=jsonWalk(i,pt.markRemovedProperties,new Set(["data"]),void 0,void 0,!1);debug3(()=>[">>> AgCharts.updateUserDelta() user delta",deepClone(i)]),pt.createOrUpdate({proxy:e,deltaOptions:i,stripSymbols:s})}static createChartInstance(e,i){const s=i?.destroy({keepTransferableResources:!0});return ModuleRegistry.detectChartDefinition(e.processedOptions).create(e,s)}static getPool(e){if(e.optionMetadata.pool===!0)return Pool.getPool(e.optionMetadata.presetType??"default",this.createChartInstance,this.detachAndClear,this.destroy,1/0)}};_AgChartsInternal.caretaker=new MementoCaretaker(VERSION),_AgChartsInternal.initialised=!1,_AgChartsInternal.callbackApi={caretaker:_AgChartsInternal.caretaker,create(t,e,i,s){return _AgChartsInternal.createOrUpdate({userOptions:t,processedOverrides:e,specialOverrides:i,optionsMetadata:s})},update(t,e){return _AgChartsInternal.createOrUpdate({userOptions:t,proxy:e})},updateUserDelta(t,e){return _AgChartsInternal.updateUserDelta(t,e)}},_AgChartsInternal.detachAndClear=t=>t.detachAndClear(),_AgChartsInternal.destroy=t=>t.destroy();var AgChartsInternal=_AgChartsInternal,integrated_charts_scene_exports={};__export(integrated_charts_scene_exports,{Arc:()=>Arc2,BBox:()=>BBox,Caption:()=>Caption,CategoryScale:()=>CategoryScale,Group:()=>Group,Line:()=>Line,LinearScale:()=>LinearScale,Marker:()=>Marker,Path:()=>Path,RadialColumnShape:()=>RadialColumnShape,Rect:()=>Rect,Scene:()=>Scene,Sector:()=>Sector,Shape:()=>Shape,TranslatableGroup:()=>TranslatableGroup,getRadialColumnWidth:()=>getRadialColumnWidth,toRadians:()=>toRadians});var Arc2=class extends Path{constructor(){super(),this.centerX=0,this.centerY=0,this.radius=10,this.startAngle=0,this.endAngle=Math.PI*2,this.counterClockwise=!1,this.type=0,this.restoreOwnStyles()}get fullPie(){return isNumberEqual(normalizeAngle360(this.startAngle),normalizeAngle360(this.endAngle))}updatePath(){const t=this.path;t.clear(),t.arc(this.centerX,this.centerY,this.radius,this.startAngle,this.endAngle,this.counterClockwise),this.type===1?t.closePath():this.type===2&&!this.fullPie&&(t.lineTo(this.centerX,this.centerY),t.closePath())}computeBBox(){return new BBox(this.centerX-this.radius,this.centerY-this.radius,this.radius*2,this.radius*2)}isPointInPath(t,e){const i=this.getBBox();return this.type!==0&&i.containsPoint(t,e)&&this.path.isPointInPath(t,e)}};Arc2.className="Arc",__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"centerX",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"centerY",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"radius",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"startAngle",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"endAngle",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"counterClockwise",2),__decorateClass([ScenePathChangeDetection()],Arc2.prototype,"type",2);function rotatePoint(t,e,i){const s=Math.sqrt(t**2+e**2),r=Math.atan2(e,t)+i;return{x:Math.cos(r)*s,y:Math.sin(r)*s}}var RadialColumnShape=class extends Path{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(t){}computeBBox(){const{innerRadius:t,outerRadius:e,columnWidth:i}=this,s=this.getRotation(),n=-i/2,r=i/2,o=-e,a=-t;let l=1/0,c=1/0,h=-1/0,u=-1/0;for(let d=0;d<4;d+=1){const{x:p,y:g}=rotatePoint(d%2===0?n:r,d<2?o:a,s);l=Math.min(p,l),c=Math.min(g,c),h=Math.max(p,h),u=Math.max(g,u)}return new BBox(l,c,h-l,u-c)}getRotation(){const{startAngle:t,endAngle:e}=this,i=angleBetween(t,e);return normalizeAngle360(t+i/2+Math.PI/2)}updatePath(){const{isBeveled:t}=this;t?this.updateBeveledPath():this.updateRectangularPath(),this.checkPathDirty()}updateRectangularPath(){const{columnWidth:t,innerRadius:e,outerRadius:i,path:s}=this,n=-t/2,r=t/2,o=-i,a=-e,l=this.getRotation(),c=[[n,a],[n,o],[r,o],[r,a]].map(([h,u])=>rotatePoint(h,u,l));s.clear(!0),s.moveTo(c[0].x,c[0].y),s.lineTo(c[1].x,c[1].y),s.lineTo(c[2].x,c[2].y),s.lineTo(c[3].x,c[3].y),s.closePath()}updateBeveledPath(){const{columnWidth:t,path:e,outerRadius:i,innerRadius:s,axisInnerRadius:n,axisOuterRadius:r,isRadiusAxisReversed:o}=this,a=isNumberEqual(s,n),l=Math.asin(t/2/s),c=this.getRotation(),h=(I,L)=>rotatePoint(I,L,c),u=(I,L)=>Math.sqrt(I**2+L**2),d=(I,L)=>L>I?0:Math.sqrt(I**2-L**2),p=(I,L,N)=>N?IL,g=a&&!isNaN(l)&&l=2*Math.PI){const p=t+r/2;t=p-Math.PI,e=p+Math.PI}const a=i*Math.cos(t),l=i*Math.sin(t),c=i*Math.cos(e),h=i*Math.sin(e),u=Math.floor(Math.sqrt((a-c)**2+(l-h)**2)),d=2*i*n;return Math.max(1,Math.min(d,u))}var integrated_charts_theme_exports={};__export(integrated_charts_theme_exports,{ChartTheme:()=>ChartTheme,DEFAULT_ANNOTATION_HANDLE_FILL:()=>DEFAULT_ANNOTATION_HANDLE_FILL,DEFAULT_ANNOTATION_STATISTICS_COLOR:()=>DEFAULT_ANNOTATION_STATISTICS_COLOR,DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE,DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL:()=>DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL,DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE,DEFAULT_ANNOTATION_STATISTICS_FILL:()=>DEFAULT_ANNOTATION_STATISTICS_FILL,DEFAULT_ANNOTATION_STATISTICS_STROKE:()=>DEFAULT_ANNOTATION_STATISTICS_STROKE,DEFAULT_BACKGROUND_COLOUR:()=>DEFAULT_BACKGROUND_COLOUR,DEFAULT_CAPTION_ALIGNMENT:()=>DEFAULT_CAPTION_ALIGNMENT,DEFAULT_CAPTION_LAYOUT_STYLE:()=>DEFAULT_CAPTION_LAYOUT_STYLE,DEFAULT_COLOR_RANGE:()=>DEFAULT_COLOR_RANGE,DEFAULT_DIVERGING_SERIES_COLOR_RANGE:()=>DEFAULT_DIVERGING_SERIES_COLOR_RANGE,DEFAULT_FIBONACCI_STROKES:()=>DEFAULT_FIBONACCI_STROKES,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL:()=>DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL,DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR:()=>DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR,DEFAULT_FUNNEL_SERIES_COLOR_RANGE:()=>DEFAULT_FUNNEL_SERIES_COLOR_RANGE,DEFAULT_GAUGE_SERIES_COLOR_RANGE:()=>DEFAULT_GAUGE_SERIES_COLOR_RANGE,DEFAULT_GRIDLINE_ENABLED:()=>DEFAULT_GRIDLINE_ENABLED,DEFAULT_HIERARCHY_FILLS:()=>DEFAULT_HIERARCHY_FILLS,DEFAULT_HIERARCHY_STROKES:()=>DEFAULT_HIERARCHY_STROKES,DEFAULT_POLAR_SERIES_STROKE:()=>DEFAULT_POLAR_SERIES_STROKE,DEFAULT_SEPARATION_LINES_COLOUR:()=>DEFAULT_SEPARATION_LINES_COLOUR,DEFAULT_SHADOW_COLOUR:()=>DEFAULT_SHADOW_COLOUR,DEFAULT_SPARKLINE_CROSSHAIR_STROKE:()=>DEFAULT_SPARKLINE_CROSSHAIR_STROKE,DEFAULT_TEXTBOX_COLOR:()=>DEFAULT_TEXTBOX_COLOR,DEFAULT_TEXTBOX_FILL:()=>DEFAULT_TEXTBOX_FILL,DEFAULT_TEXTBOX_STROKE:()=>DEFAULT_TEXTBOX_STROKE,DEFAULT_TEXT_ANNOTATION_COLOR:()=>DEFAULT_TEXT_ANNOTATION_COLOR,DEFAULT_TOOLBAR_POSITION:()=>DEFAULT_TOOLBAR_POSITION,IS_COMMUNITY:()=>IS_COMMUNITY,IS_DARK_THEME:()=>IS_DARK_THEME,IS_ENTERPRISE:()=>IS_ENTERPRISE,PALETTE_ALT_DOWN_FILL:()=>PALETTE_ALT_DOWN_FILL,PALETTE_ALT_DOWN_STROKE:()=>PALETTE_ALT_DOWN_STROKE,PALETTE_ALT_NEUTRAL_FILL:()=>PALETTE_ALT_NEUTRAL_FILL,PALETTE_ALT_NEUTRAL_STROKE:()=>PALETTE_ALT_NEUTRAL_STROKE,PALETTE_ALT_UP_FILL:()=>PALETTE_ALT_UP_FILL,PALETTE_ALT_UP_STROKE:()=>PALETTE_ALT_UP_STROKE,PALETTE_DOWN_FILL:()=>PALETTE_DOWN_FILL,PALETTE_DOWN_STROKE:()=>PALETTE_DOWN_STROKE,PALETTE_NEUTRAL_FILL:()=>PALETTE_NEUTRAL_FILL,PALETTE_NEUTRAL_STROKE:()=>PALETTE_NEUTRAL_STROKE,PALETTE_UP_FILL:()=>PALETTE_UP_FILL,PALETTE_UP_STROKE:()=>PALETTE_UP_STROKE,getChartTheme:()=>getChartTheme,themeNames:()=>themeNames,themeSymbols:()=>symbols_exports,themes:()=>themes});var themeNames=Object.keys(themes),integrated_charts_util_exports={};__export(integrated_charts_util_exports,{Color:()=>Color,interpolateColor:()=>interpolateColor});var module_support_exports={};__export(module_support_exports,{AND:()=>AND,ARRAY:()=>ARRAY,ARRAY_OF:()=>ARRAY_OF,AbstractBarSeries:()=>AbstractBarSeries,AbstractBarSeriesProperties:()=>AbstractBarSeriesProperties,ActionOnSet:()=>ActionOnSet,AnchoredPopover:()=>AnchoredPopover,Animation:()=>Animation,AnimationManager:()=>AnimationManager,Arc:()=>Arc2,Axis:()=>Axis,AxisGroupZIndexMap:()=>AxisGroupZIndexMap,AxisInterval:()=>AxisInterval,AxisLabel:()=>AxisLabel,AxisTick:()=>AxisTick,AxisTickGenerator:()=>AxisTickGenerator,AxisTicks:()=>AxisTicks,BBox:()=>BBox,BBoxValues:()=>BBoxValues,BOOLEAN:()=>BOOLEAN,BOOLEAN_ARRAY:()=>BOOLEAN_ARRAY,Background:()=>Background,BackgroundModule:()=>BackgroundModule,BandScale:()=>BandScale,BarSeries:()=>BarSeries,BarSeriesModule:()=>BarSeriesModule,BaseModuleInstance:()=>BaseModuleInstance,BaseProperties:()=>BaseProperties,BaseToolbar:()=>BaseToolbar,ButtonWidget:()=>ButtonWidget,COLOR_GRADIENT:()=>COLOR_GRADIENT,COLOR_STRING:()=>COLOR_STRING,COLOR_STRING_ARRAY:()=>COLOR_STRING_ARRAY,CachedTextMeasurer:()=>CachedTextMeasurer,CachedTextMeasurerPool:()=>CachedTextMeasurerPool,Caption:()=>Caption,CartesianAxis:()=>CartesianAxis,CartesianSeries:()=>CartesianSeries,CartesianSeriesNodeEvent:()=>CartesianSeriesNodeEvent,CartesianSeriesProperties:()=>CartesianSeriesProperties,CategoryAxis:()=>CategoryAxis,CategoryScale:()=>CategoryScale,ChangeDetectableProperties:()=>ChangeDetectableProperties,Chart:()=>Chart,ChartAxisDirection:()=>ChartAxisDirection,ChartEventManager:()=>ChartEventManager,ChartOptions:()=>ChartOptions,ChartUpdateType:()=>ChartUpdateType,CollapseMode:()=>CollapseMode,Color:()=>Color,ColorScale:()=>ColorScale,ConicGradient:()=>ConicGradient,ContextMenuRegistry:()=>ContextMenuRegistry,ContinuousScale:()=>ContinuousScale,DATE:()=>DATE,DATE_ARRAY:()=>DATE_ARRAY,DATE_OR_DATETIME_MS:()=>DATE_OR_DATETIME_MS,DEFAULT_CARTESIAN_DIRECTION_KEYS:()=>DEFAULT_CARTESIAN_DIRECTION_KEYS,DEFAULT_CARTESIAN_DIRECTION_NAMES:()=>DEFAULT_CARTESIAN_DIRECTION_NAMES,DEFAULT_TOOLTIP_CLASS:()=>DEFAULT_TOOLTIP_CLASS,DEFAULT_TOOLTIP_DARK_CLASS:()=>DEFAULT_TOOLTIP_DARK_CLASS,DIRECTION:()=>DIRECTION,DOMManager:()=>DOMManager,DataController:()=>DataController,DataModel:()=>DataModel,DataModelSeries:()=>DataModelSeries,DataService:()=>DataService,Debug:()=>Debug,Default:()=>Default,Deprecated:()=>Deprecated,DeprecatedAndRenamedTo:()=>DeprecatedAndRenamedTo,DragInterpreter:()=>DragInterpreter,DraggablePopover:()=>DraggablePopover,DropShadow:()=>DropShadow,ExtendedPath2D:()=>ExtendedPath2D,FONT_SIZE_RATIO:()=>FONT_SIZE_RATIO,FONT_STYLE:()=>FONT_STYLE,FONT_WEIGHT:()=>FONT_WEIGHT,FUNCTION:()=>FUNCTION,FloatingToolbar:()=>FloatingToolbar,GREATER_THAN:()=>GREATER_THAN,Gradient:()=>Gradient,Group:()=>Group,GroupedCategoryAxis:()=>GroupedCategoryAxis,HdpiCanvas:()=>HdpiCanvas,HierarchyNode:()=>HierarchyNode,HierarchySeries:()=>HierarchySeries,HierarchySeriesProperties:()=>HierarchySeriesProperties,HighlightManager:()=>HighlightManager,HighlightProperties:()=>HighlightProperties,HighlightStyle:()=>HighlightStyle,INTERACTION_RANGE:()=>INTERACTION_RANGE,INTERPOLATION_STEP_POSITION:()=>INTERPOLATION_STEP_POSITION,INTERPOLATION_TYPE:()=>INTERPOLATION_TYPE,Image:()=>Image,InteractionManager:()=>InteractionManager,InteractionState:()=>InteractionState,InterpolationProperties:()=>InterpolationProperties,Invalidating:()=>Invalidating,LABEL_PLACEMENT:()=>LABEL_PLACEMENT,LARGEST_KEY_INTERVAL:()=>LARGEST_KEY_INTERVAL,LESS_THAN:()=>LESS_THAN,LINE_CAP:()=>LINE_CAP,LINE_DASH:()=>LINE_DASH,LINE_JOIN:()=>LINE_JOIN,LINE_STYLE:()=>LINE_STYLE,Label:()=>Label,LayoutElement:()=>LayoutElement,LayoutManager:()=>LayoutManager,LegendMarkerLabel:()=>LegendMarkerLabel,Line:()=>Line,LineSeries:()=>LineSeries,LineSeriesModule:()=>LineSeriesModule,LinearGradient:()=>LinearGradient,LinearScale:()=>LinearScale,Listeners:()=>Listeners,LogScale:()=>LogScale,LonLatBBox:()=>LonLatBBox,MARKER_SHAPE:()=>MARKER_SHAPE,MATCHING_CROSSLINE_TYPE:()=>MATCHING_CROSSLINE_TYPE,MAX_SPACING:()=>MAX_SPACING,MIN_SPACING:()=>MIN_SPACING,Marker:()=>Marker,Menu:()=>Menu,MercatorScale:()=>MercatorScale,ModuleRegistry:()=>ModuleRegistry,Motion:()=>easing_exports,NAN:()=>NAN,NODE_UPDATE_STATE_TO_PHASE_MAPPING:()=>NODE_UPDATE_STATE_TO_PHASE_MAPPING,NUMBER:()=>NUMBER,NUMBER_ARRAY:()=>NUMBER_ARRAY,NUMBER_OR_NAN:()=>NUMBER_OR_NAN,NativeWidget:()=>NativeWidget,NiceMode:()=>NiceMode,Node:()=>Node,NumberAxis:()=>NumberAxis,OBJECT:()=>OBJECT,OBJECT_ARRAY:()=>OBJECT_ARRAY,OR:()=>OR,OVERFLOW_STRATEGY:()=>OVERFLOW_STRATEGY,ObserveChanges:()=>ObserveChanges,OrdinalTimeScale:()=>OrdinalTimeScale,PHASE_METADATA:()=>PHASE_METADATA,PHASE_ORDER:()=>PHASE_ORDER,PLACEMENT:()=>PLACEMENT,PLAIN_OBJECT:()=>PLAIN_OBJECT,POSITION:()=>POSITION,POSITION_TOP_COORDINATES:()=>POSITION_TOP_COORDINATES,POSITIVE_NUMBER:()=>POSITIVE_NUMBER,PREV_NEXT_KEYS:()=>PREV_NEXT_KEYS,Padding:()=>Padding,ParallelStateMachine:()=>ParallelStateMachine,Path:()=>Path,PointerEvents:()=>PointerEvents,PolarAxis:()=>PolarAxis,PolarSeries:()=>PolarSeries,PolarZIndexMap:()=>PolarZIndexMap,Popover:()=>Popover,PropertiesArray:()=>PropertiesArray,ProxyInteractionService:()=>ProxyInteractionService,ProxyOnWrite:()=>ProxyOnWrite,ProxyProperty:()=>ProxyProperty,ProxyPropertyOnWrite:()=>ProxyPropertyOnWrite,QUICK_TRANSITION:()=>QUICK_TRANSITION,RATIO:()=>RATIO,REAL_NUMBER:()=>REAL_NUMBER,RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD:()=>RENDER_TO_OFFSCREEN_CANVAS_THRESHOLD,RadialColumnShape:()=>RadialColumnShape,Range:()=>Range,Rect:()=>Rect,RepeatType:()=>RepeatType,Rotatable:()=>Rotatable,RotatableGroup:()=>RotatableGroup,RotatableText:()=>RotatableText,SKIP_JS_BUILTINS:()=>SKIP_JS_BUILTINS,SMALLEST_KEY_INTERVAL:()=>SMALLEST_KEY_INTERVAL,SORT_DOMAIN_GROUPS:()=>SORT_DOMAIN_GROUPS,STRING:()=>STRING,STRING_ARRAY:()=>STRING_ARRAY,Scalable:()=>Scalable,ScalableGroup:()=>ScalableGroup,Scene:()=>Scene,SceneChangeDetection:()=>SceneChangeDetection,ScenePathChangeDetection:()=>ScenePathChangeDetection,Sector:()=>Sector,SectorBox:()=>SectorBox,Selection:()=>Selection,Series:()=>Series,SeriesContentZIndexMap:()=>SeriesContentZIndexMap,SeriesGroupingChangedEvent:()=>SeriesGroupingChangedEvent,SeriesItemHighlightStyle:()=>SeriesItemHighlightStyle,SeriesMarker:()=>SeriesMarker,SeriesNodeEvent:()=>SeriesNodeEvent,SeriesNodePickMode:()=>SeriesNodePickMode,SeriesProperties:()=>SeriesProperties,SeriesTooltip:()=>SeriesTooltip,SeriesZIndexMap:()=>SeriesZIndexMap,Shape:()=>Shape,SimpleTextMeasurer:()=>SimpleTextMeasurer,SliderWidget:()=>SliderWidget,StateMachine:()=>StateMachine,StateMachineProperty:()=>StateMachineProperty,StopProperties:()=>StopProperties,SvgPath:()=>SvgPath,TEXT_ALIGN:()=>TEXT_ALIGN,TEXT_WRAP:()=>TEXT_WRAP,TICK_INTERVAL:()=>TICK_INTERVAL,Text:()=>Text,TextUtils:()=>TextUtils,TextWrapper:()=>TextWrapper,ThemeConstants:()=>constants_exports,ThemeSymbols:()=>symbols_exports,TimeScale:()=>TimeScale,Toolbar:()=>Toolbar,ToolbarButtonProperties:()=>ToolbarButtonProperties,ToolbarButtonWidget:()=>ToolbarButtonWidget,ToolbarWidget:()=>ToolbarWidget,Tooltip:()=>Tooltip,TooltipManager:()=>TooltipManager,TooltipPosition:()=>TooltipPosition,Transformable:()=>Transformable,TransformableText:()=>TransformableText,Translatable:()=>Translatable,TranslatableGroup:()=>TranslatableGroup,TranslatableLine:()=>TranslatableLine,UNION:()=>UNION,UpdateService:()=>UpdateService,VERTICAL_ALIGN:()=>VERTICAL_ALIGN,Validate:()=>Validate,Vec2:()=>Vec2,Vec4:()=>Vec4,WIDGET_HTML_EVENTS:()=>WIDGET_HTML_EVENTS,Widget:()=>Widget,WidgetEventUtil:()=>WidgetEventUtil,ZIndexMap:()=>ZIndexMap,ZoomManager:()=>ZoomManager,accumulateGroup:()=>accumulateGroup,accumulateStack:()=>accumulateStack,accumulatedValue:()=>accumulatedValue,accumulativeValueProperty:()=>accumulativeValueProperty,addHitTestersToQuadtree:()=>addHitTestersToQuadtree,adjustLabelPlacement:()=>adjustLabelPlacement,angleBetween:()=>angleBetween,animationValidation:()=>animationValidation,applyShapeStyle:()=>applyShapeStyle,areScalingEqual:()=>areScalingEqual,area:()=>area,buildFormatter:()=>buildFormatter,buildResetPathFn:()=>buildResetPathFn,calculateDefaultTimeTickFormat:()=>calculateDefaultTimeTickFormat,calculateDerivativeExtrema:()=>calculateDerivativeExtrema,calculateDerivativeExtremaXY:()=>calculateDerivativeExtremaXY,calculateLabelChartPadding:()=>calculateLabelChartPadding,calculateLabelTranslation:()=>calculateLabelTranslation,calculatePlacement:()=>calculatePlacement,checkCrisp:()=>checkCrisp,clamp:()=>clamp,clampArray:()=>clampArray,clippedRoundRect:()=>clippedRoundRect,collapsedStartingBarPosition:()=>collapsedStartingBarPosition,compareDates:()=>compareDates,computeBarFocusBounds:()=>computeBarFocusBounds,computeMarkerFocusBounds:()=>computeMarkerFocusBounds,countExpandingSearch:()=>countExpandingSearch,countFractionDigits:()=>countFractionDigits,createButton:()=>createButton,createCheckbox:()=>createCheckbox,createDatumId:()=>createDatumId,createDeprecationWarning:()=>createDeprecationWarning,createElement:()=>createElement,createElementId:()=>createElementId,createIcon:()=>createIcon,createId:()=>createId,createSelect:()=>createSelect,createSvgElement:()=>createSvgElement,createTextArea:()=>createTextArea,dateToNumber:()=>dateToNumber,datesSortOrder:()=>datesSortOrder,datumKeys:()=>datumKeys,datumStylerProperties:()=>datumStylerProperties,deconstructSelectionsOrNodes:()=>deconstructSelectionsOrNodes,deepClone:()=>deepClone,deepFreeze:()=>deepFreeze,defaultTimeTickFormat:()=>defaultTimeTickFormat,diff:()=>diff,downloadUrl:()=>downloadUrl,drawCorner:()=>drawCorner,drawMarkerUnitPolygon:()=>drawMarkerUnitPolygon,easing:()=>easing_exports,enterpriseModule:()=>enterpriseModule,evaluateBezier:()=>evaluateBezier,extent:()=>extent,extractDecoratedProperties:()=>extractDecoratedProperties,findMinMax:()=>findMinMax,findQuadtreeMatch:()=>findQuadtreeMatch,findRangeExtent:()=>findRangeExtent,fixNumericExtent:()=>fixNumericExtent,focusCursorAtEnd:()=>focusCursorAtEnd,formatNumber:()=>formatNumber,formatPercent:()=>formatPercent,formatValue:()=>formatValue,fromToMotion:()=>fromToMotion,generateUUID:()=>generateUUID,getAngleRatioRadians:()=>getAngleRatioRadians,getColorStops:()=>getColorStops,getDateTicksForInterval:()=>getDateTicksForInterval,getDatumRefPoint:()=>getDatumRefPoint,getDocument:()=>getDocument,getElementBBox:()=>getElementBBox,getIconClassNames:()=>getIconClassNames,getLastFocus:()=>getLastFocus,getMissCount:()=>getMissCount,getPath:()=>getPath,getPathComponents:()=>getPathComponents,getRadialColumnWidth:()=>getRadialColumnWidth,getWindow:()=>getWindow,groupAccumulativeValueProperty:()=>groupAccumulativeValueProperty,groupAverage:()=>groupAverage,groupCount:()=>groupCount,groupStackValueProperty:()=>groupStackValueProperty,groupSum:()=>groupSum,hasNoModifiers:()=>hasNoModifiers,inRange:()=>inRange,initMenuKeyNav:()=>initMenuKeyNav,initRovingTabIndex:()=>initRovingTabIndex,interpolatePoints:()=>interpolatePoints,isAgFlowProportionChartOptions:()=>isAgFlowProportionChartOptions,isAgGaugeChartOptions:()=>isAgGaugeChartOptions,isAgHierarchyChartOptions:()=>isAgHierarchyChartOptions,isAgStandaloneChartOptions:()=>isAgStandaloneChartOptions,isAgTopologyChartOptions:()=>isAgTopologyChartOptions,isBetweenAngles:()=>isBetweenAngles,isButtonClickEvent:()=>isButtonClickEvent,isContinuous:()=>isContinuous,isDecoratedObject:()=>isDecoratedObject,isDenseInterval:()=>isDenseInterval,isInputPending:()=>isInputPending,isInteger:()=>isInteger,isNegative:()=>isNegative,isNumberEqual:()=>isNumberEqual,isProperties:()=>isProperties,isScaleValid:()=>isScaleValid,jsonApply:()=>jsonApply,jsonDiff:()=>jsonDiff,jsonPropertyCompare:()=>jsonPropertyCompare,jsonResolveOperations:()=>jsonResolveOperations,jsonWalk:()=>jsonWalk,keyProperty:()=>keyProperty,labelDirectionHandling:()=>labelDirectionHandling,legendSymbolSvg:()=>legendSymbolSvg,lineDistanceSquared:()=>lineDistanceSquared,listDecoratedProperties:()=>listDecoratedProperties,makeAccessibleClickListener:()=>makeAccessibleClickListener,mapValues:()=>mapValues,markerFadeInAnimation:()=>markerFadeInAnimation,markerPaletteFactory:()=>markerPaletteFactory,markerScaleInAnimation:()=>markerScaleInAnimation,markerSwipeScaleInAnimation:()=>markerSwipeScaleInAnimation,mergeArrayDefaults:()=>mergeArrayDefaults,mergeDefaults:()=>mergeDefaults,midpointStartingBarPosition:()=>midpointStartingBarPosition,mod:()=>mod,moduleRegistry:()=>moduleRegistry,motion:()=>motion,nearestSquared:()=>nearestSquared,nearestSquaredInContainer:()=>nearestSquaredInContainer,normaliseGroupTo:()=>normaliseGroupTo,normalisePropertyTo:()=>normalisePropertyTo,normalisedExtentWithMetadata:()=>normalisedExtentWithMetadata,normalizeAngle180:()=>normalizeAngle180,normalizeAngle360:()=>normalizeAngle360,normalizeAngle360Inclusive:()=>normalizeAngle360Inclusive,objectsEqual:()=>objectsEqual,objectsEqualWith:()=>objectsEqualWith,pairUpSpans:()=>pairUpSpans,partialAssign:()=>partialAssign,pathFadeInAnimation:()=>pathFadeInAnimation,pathMotion:()=>pathMotion,pathSwipeInAnimation:()=>pathSwipeInAnimation,pickByMatchingAngle:()=>pickByMatchingAngle,plotAreaPathFill:()=>plotAreaPathFill,plotInterpolatedAreaSeriesFillSpans:()=>plotInterpolatedAreaSeriesFillSpans,plotInterpolatedLinePathStroke:()=>plotInterpolatedLinePathStroke,plotLinePathStroke:()=>plotLinePathStroke,predicateWithMessage:()=>predicateWithMessage,prepareAreaFillAnimationFns:()=>prepareAreaFillAnimationFns,prepareAreaPathAnimation:()=>prepareAreaPathAnimation,prepareAxisAnimationContext:()=>prepareAxisAnimationContext,prepareAxisAnimationFunctions:()=>prepareAxisAnimationFunctions,prepareBarAnimationFunctions:()=>prepareBarAnimationFunctions,prepareLinePathAnimation:()=>prepareLinePathAnimation,prepareLinePathPropertyAnimation:()=>prepareLinePathPropertyAnimation,prepareLinePathStrokeAnimationFns:()=>prepareLinePathStrokeAnimationFns,preparePieSeriesAnimationFunctions:()=>preparePieSeriesAnimationFunctions,range:()=>range,rangedValueProperty:()=>rangedValueProperty,resetAxisGroupFn:()=>resetAxisGroupFn,resetAxisLabelSelectionFn:()=>resetAxisLabelSelectionFn,resetAxisLineSelectionFn:()=>resetAxisLineSelectionFn,resetAxisSelectionFn:()=>resetAxisSelectionFn,resetBarSelectionsFn:()=>resetBarSelectionsFn,resetIds:()=>resetIds,resetLabelFn:()=>resetLabelFn,resetMarkerFn:()=>resetMarkerFn,resetMarkerPositionFn:()=>resetMarkerPositionFn,resetMotion:()=>resetMotion,resetPieSelectionsFn:()=>resetPieSelectionsFn,round:()=>round,rowCountProperty:()=>rowCountProperty,sanitizeHtml:()=>sanitizeHtml,scale:()=>scale,sectorBox:()=>sectorBox,seriesLabelFadeInAnimation:()=>seriesLabelFadeInAnimation,seriesLabelFadeOutAnimation:()=>seriesLabelFadeOutAnimation,setAttribute:()=>setAttribute,setAttributes:()=>setAttributes,setDocument:()=>setDocument,setElementBBox:()=>setElementBBox,setElementStyle:()=>setElementStyle,setPath:()=>setPath,setWindow:()=>setWindow,shallowClone:()=>shallowClone,singleSeriesPaletteFactory:()=>singleSeriesPaletteFactory,solveBezier:()=>solveBezier,sortAndUniqueDates:()=>sortAndUniqueDates,splitBezier:()=>splitBezier,staticFromToMotion:()=>staticFromToMotion,stopPageScrolling:()=>stopPageScrolling,sum:()=>sum,sumValues:()=>sumValues,swapAxisCondition:()=>swapAxisCondition,toDegrees:()=>toDegrees,toRadians:()=>toRadians,tooltipContentAriaLabel:()=>tooltipContentAriaLabel,trailingAccumulatedValue:()=>trailingAccumulatedValue,trailingAccumulatedValueProperty:()=>trailingAccumulatedValueProperty,updateClipPath:()=>updateClipPath,updateLabelNode:()=>updateLabelNode,validateCrossLineValues:()=>validateCrossLineValues,valueProperty:()=>valueProperty,visibleRangeIndices:()=>visibleRangeIndices,without:()=>without});function createDeprecationWarning(){return(t,e)=>{const i=[`Property [${t}] is deprecated.`,e].filter(Boolean).join(" ");logger_exports.warnOnce(i)}}function Deprecated(t,e){const i=createDeprecationWarning(),s=e?.default;return addTransformToInstanceProperty((n,r,o)=>(o!==s&&i(r.toString(),t),o))}function DeprecatedAndRenamedTo(t,e){const i=createDeprecationWarning();return addTransformToInstanceProperty((s,n,r)=>(r!==s[t]&&(i(n.toString(),`Use [${t}] instead.`),setPath(s,t,e?e(r):r)),BREAK_TRANSFORM_CHAIN),(s,n)=>(i(n.toString(),`Use [${t}] instead.`),getPath(s,t)))}var Vec2={add,angle,apply,equal,distance,distanceSquared,from:from2,gradient,intercept,intersectAtX,intersectAtY,length,lengthSquared,multiply,normalized,origin:origin2,required,rotate,round:round4,sub};function add(t,e){return typeof e=="number"?{x:t.x+e,y:t.y+e}:{x:t.x+e.x,y:t.y+e.y}}function sub(t,e){return typeof e=="number"?{x:t.x-e,y:t.y-e}:{x:t.x-e.x,y:t.y-e.y}}function multiply(t,e){return typeof e=="number"?{x:t.x*e,y:t.y*e}:{x:t.x*e.x,y:t.y*e.y}}function length(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function lengthSquared(t){return t.x*t.x+t.y*t.y}function distance(t,e){const i=sub(t,e);return Math.sqrt(i.x*i.x+i.y*i.y)}function distanceSquared(t,e){const i=sub(t,e);return i.x*i.x+i.y*i.y}function normalized(t){const e=length(t);return{x:t.x/e,y:t.y/e}}function angle(t,e=origin2()){return Math.atan2(t.y,t.x)-Math.atan2(e.y,e.x)}function rotate(t,e,i=origin2()){const s=length(t);return{x:i.x+s*Math.cos(e),y:i.y+s*Math.sin(e)}}function gradient(t,e,i){const s=e.x-t.x;return(i==null?e.y-t.y:i-e.y-(i-t.y))/s}function intercept(t,e,i){return(i==null?t.y:i-t.y)-e*t.x}function intersectAtY(t,e,i=0,s){return{x:t===1/0?1/0:(i-e)/t,y:s==null?i:s-i}}function intersectAtX(t,e,i=0,s){const n=t===1/0?1/0:t*i+e;return{x:i,y:s==null?n:s-n}}function round4(t){return{x:Math.round(t.x),y:Math.round(t.y)}}function equal(t,e){return t.x===e.x&&t.y===e.y}function from2(t,e){if(typeof t=="number")return{x:t,y:e};if("currentX"in t)return{x:t.currentX,y:t.currentY};if("offsetWidth"in t)return{x:t.offsetWidth,y:t.offsetHeight};if("width"in t)return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y+t.height}];if("x1"in t)return[{x:t.x1,y:t.y1},{x:t.x2,y:t.y2}];throw new Error(`Values can not be converted into a vector: [${JSON.stringify(t)}] [${e}]`)}function apply(t,e){return t.x=e.x,t.y=e.y,t}function required(t){return{x:t?.x??0,y:t?.y??0}}function origin2(){return{x:0,y:0}}var _HierarchyNode=class Dt{constructor(e,i,s,n,r,o,a,l,c){this.series=e,this.datumIndex=i,this.datum=s,this.sizeValue=n,this.colorValue=r,this.sumSize=o,this.depth=a,this.parent=l,this.children=c,this.midPoint={x:0,y:0}}get hasChildren(){return this.children.length>0}walk(e,i=Dt.Walk.PreOrder){i===Dt.Walk.PreOrder&&e(this),this.children.forEach(s=>{s.walk(e,i)}),i===Dt.Walk.PostOrder&&e(this)}*[Symbol.iterator](){yield this;for(const e of this.children)yield*e}};_HierarchyNode.Walk={PreOrder:0,PostOrder:1};var HierarchyNode=_HierarchyNode,HierarchySeries=class extends Series{constructor(t){super({moduleCtx:t,pickModes:[1,0]}),this.colorDomain=[0,0],this.maxDepth=0,this.colorScale=new ColorScale,this.animationState=new StateMachine("empty",{empty:{update:{target:"ready",action:e=>this.animateEmptyUpdateReady(e)},reset:"empty",skip:"ready"},ready:{updateData:"waiting",clear:"clearing",highlight:e=>this.animateReadyHighlight(e),resize:e=>this.animateReadyResize(e),reset:"empty",skip:"ready"},waiting:{update:{target:"ready",action:e=>this.animateWaitingUpdateReady(e)},reset:"empty",skip:"ready"},clearing:{update:{target:"empty",action:e=>this.animateClearingUpdateEmpty(e)},reset:"empty",skip:"ready"}},()=>this.checkProcessedDataAnimatable())}resetAnimation(t){t==="initial"?this.animationState.transition("reset"):t==="ready"&&this.animationState.transition("skip")}processData(){const{NodeClass:t}=this,{childrenKey:e,sizeKey:i,colorKey:s,colorRange:n}=this.properties;let r=0,o=1/0,a=-1/0;const l=(d,p,g)=>{const m=g.depth!=null?g.depth+1:0,y=e!=null?d[e]:void 0,f=y==null||y.length===0;let x=i!=null?d[i]:void 0;Number.isFinite(x)?x=Math.max(x,0):x=f?1:0;const v=x;r=Math.max(r,m);const b=s!=null?d[s]:void 0;return typeof b=="number"&&(o=Math.min(o,b),a=Math.max(a,b)),c(new t(this,p,d,x,b,v,m,g,[]),y)},c=(d,p)=>{const{datumIndex:g}=d;return p?.forEach((m,y)=>{const f=l(m,g.concat(y),d);d.children.push(f),d.sumSize+=f.sumSize}),d},h=c(new t(this,[],void 0,0,void 0,0,void 0,void 0,[]),this.data),u=[o,a];this.colorScale.domain=ol.children[c],this.rootNode);if(s>0&&r.hasChildren)n=[...n,0];else if(s<0&&n.length>1)n=n.slice(0,-1);else if(s===0&&i!==0){const l=r.parent.children.length-1;n=n.slice(),n[n.length-1]=clamp(0,n[n.length-1]+i,l)}const o=n.reduce((l,c)=>l.children[c],this.rootNode),a=this.computeFocusBounds(this.datumSelection.at(e+1));if(a!=null)return{datum:o,datumIndex:this.removeMeIndexForIndexPath(n),otherIndex:o.depth,bounds:a,clipFocusBox:!0}}getDatumAriaText(t,e){if(!(t instanceof this.NodeClass)){logger_exports.error(`datum is not HierarchyNode: ${JSON.stringify(t)}`);return}return this.ctx.localeManager.t("ariaAnnounceHierarchyDatum",{level:(t.depth??-1)+1,count:t.children.length,description:e})}},HierarchySeriesProperties=class extends SeriesProperties{constructor(){super(...arguments),this.childrenKey="children",this.fills=Object.values(DEFAULT_FILLS),this.strokes=Object.values(DEFAULT_STROKES)}};__decorateClass([Validate(STRING)],HierarchySeriesProperties.prototype,"childrenKey",2),__decorateClass([Validate(STRING,{optional:!0})],HierarchySeriesProperties.prototype,"sizeKey",2),__decorateClass([Validate(STRING,{optional:!0})],HierarchySeriesProperties.prototype,"colorKey",2),__decorateClass([Validate(STRING,{optional:!0})],HierarchySeriesProperties.prototype,"colorName",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],HierarchySeriesProperties.prototype,"fills",2),__decorateClass([Validate(COLOR_STRING_ARRAY)],HierarchySeriesProperties.prototype,"strokes",2),__decorateClass([Validate(COLOR_STRING_ARRAY,{optional:!0})],HierarchySeriesProperties.prototype,"colorRange",2);var LonLatBBox=class{constructor(t,e,i,s){this.lon0=t,this.lat0=e,this.lon1=i,this.lat1=s}merge(t){this.lon0=Math.min(this.lon0,t.lon0),this.lat0=Math.min(this.lat0,t.lat0),this.lon1=Math.max(this.lon1,t.lon1),this.lat1=Math.max(this.lat1,t.lat1)}},radsInDeg=Math.PI/180,lonX=t=>t*radsInDeg,latY=t=>-Math.log(Math.tan(Math.PI*.25+t*radsInDeg*.5)),xLon=t=>t/radsInDeg,yLat=t=>(Math.atan(Math.exp(-t))-Math.PI*.25)/(radsInDeg*.5),MercatorScale=class Tt extends AbstractScale{constructor(e,i){super(),this.domain=e,this.range=i,this.type="mercator",this.bounds=Tt.bounds(e)}static bounds(e){const[[i,s],[n,r]]=e,o=lonX(i),a=latY(s),l=lonX(n),c=latY(r);return new BBox(Math.min(o,l),Math.min(a,c),Math.abs(l-o),Math.abs(c-a))}static fixedScale(){return new Tt([[xLon(0),yLat(0)],[xLon(1),yLat(1)]],[[0,0],[1,1]])}toDomain(){}normalizeDomains(...e){let i=-1/0,s=1/0,n=-1/0,r=1/0;for(const o of e)for(const[a,l]of o)i=Math.min(a,i),s=Math.max(a,s),n=Math.min(l,n),r=Math.max(l,r);return{domain:[[i,n],[s,r]],animatable:!0}}convert([e,i]){const[[s,n],[r,o]]=this.range,a=(r-s)/this.bounds.width,l=(o-n)/this.bounds.height;return[(lonX(e)-this.bounds.x)*a+s,(latY(i)-this.bounds.y)*l+n]}invert([e,i]){const[[s,n],[r,o]]=this.range,a=(r-s)/this.bounds.width,l=(o-n)/this.bounds.height;return[xLon((e-s)/a+this.bounds.x),yLat((i-n)/l+this.bounds.y)]}},_AxisTicks=class kt{constructor(){this.id=createId(this),this.axisGroup=new TranslatableGroup({name:`${this.id}-AxisTicks`,zIndex:2}),this.labelSelection=Selection.select(this.axisGroup,Text),this.interval=new AxisInterval,this.label=new AxisLabel,this.scale=new LinearScale,this.position="bottom",this.translationX=0,this.translationY=0,this.padding=0}attachAxis(e){e.appendChild(this.axisGroup)}calculateLayout(){const e=[],i=this.generateTicks(),{translationX:s,translationY:n}=this;return this.labelSelection.update(i.ticks.map(r=>this.createLabelDatum(r)),void 0,r=>r.tickId),this.labelSelection.each((r,o)=>{r.setProperties(o),o.visible&&e.push(r.getBBox())}),this.axisGroup.setProperties({translationX:s,translationY:n}),BBox.merge(e)}getLabelParams(e){const{padding:i}=this,{translate:s}=e;switch(this.position){case"top":case"bottom":return{x:s,y:i,textAlign:"center",textBaseline:"top"};case"left":case"right":return{x:i,y:s,textAlign:"start",textBaseline:"middle"}}}inRange(e,i=.001){const[s,n]=findMinMax(this.scale.range);return e>=s-i&&e<=n+i}createLabelDatum(e){const{x:i,y:s,textBaseline:n,textAlign:r}=this.getLabelParams(e);return{visible:!!e.tickLabel,tickId:e.tickId,fill:this.label.color,fontFamily:this.label.fontFamily,fontSize:this.label.fontSize,fontStyle:this.label.fontStyle,fontWeight:this.label.fontWeight,rotation:0,rotationCenterX:0,text:e.tickLabel,textAlign:r,textBaseline:n,x:i,y:s}}generateTicks(){const{minSpacing:e,maxSpacing:i}=this.interval,{maxTickCount:s,minTickCount:n,tickCount:r}=estimateTickCount(findRangeExtent(this.scale.range),1,e,i,kt.DefaultTickCount,kt.DefaultMinSpacing),o=this.getTicksData({nice:!0,interval:this.interval.step,tickCount:r,minTickCount:n,maxTickCount:s});if(this.position==="bottom"||this.position==="top"){const a=CachedTextMeasurerPool.getMeasurer({font:this.label}),{domain:l}=this.scale,h=l[0]>l[1]?-1:1;let u=-1/0*h;o.ticks=o.ticks.filter(d=>Math.sign(d.translate-u)!==h?!1:(u=d.translate+a.textWidth(d.tickLabel,!0)*h,!0))}return o}getTicksData(e){const i=[],s=e.nice?this.scale.niceDomain(e):this.scale.domain,n=this.scale.ticks(e,s),r=n.reduce((l,c)=>Math.max(l,countFractionDigits(c)),0),o=createIdsGenerator(),a=this.label.format?this.scale.tickFormatter({domain:s,ticks:n,fractionDigits:r,specifier:this.label.format}):l=>formatValue(l,r);for(let l=0;lt.onChange(i.checked,s)),i.addEventListener("keydown",s=>{isButtonClickEvent(s)&&(s.preventDefault(),i.click())}),setAttributes(i,e),i}function createSelect(t,e){const i=createElement("select",getClassName("ag-charts-input ag-charts-select",e));return i.append(...t.options.map(s=>{const n=createElement("option");return n.value=s.value,n.textContent=s.label,n})),setAttribute(i,"data-preventdefault",!1),i.value=t.value,i.addEventListener("change",s=>t.onChange(i.value,s)),setAttributes(i,e),i}function createTextArea(t,e){const i=createElement("textarea",getClassName("ag-charts-input ag-charts-textarea",e));return i.value=t.value,i.addEventListener("input",s=>t.onChange(i.value,s)),setAttributes(i,e),setAttribute(i,"data-preventdefault",!1),i}function createIcon(t){const e=createElement("span",`ag-charts-icon ag-charts-icon-${t}`);return setAttribute(e,"aria-hidden",!0),e}function getClassName(t,e){return e==null?t:`${t} ${e.class}`}var ConicGradient=class extends Gradient{constructor(t,e,i=0,s){super(t,e,s),this.angle=i}createCanvasGradient(t,e){const{angle:s}=this,n=normalizeAngle360(toRadians(s+90)),r=e.x+e.width*.5,o=e.y+e.height*.5;return t.createConicGradient(n,r,o)}},SvgPath=class extends Path{constructor(t=""){super(),this.x=0,this.y=0,this.commands=[],this._d="",this.d=t}get d(){return this._d}set d(t){if(t!==this._d){this._d=t,this.commands.length=0;for(const[e,i,s]of t.matchAll(/([A-Z])([0-9. ]*)/g)){const n=s.split(/\s+/g).map(Number);this.commands.push([i,n])}this.checkPathDirty()}}updatePath(){const{path:t,x:e,y:i}=this;t.clear();let s=e,n=i;for(const[r,o]of this.commands)switch(r){case"M":t.moveTo(e+o[0],i+o[1]),s=e+o[0];break;case"C":t.cubicCurveTo(e+o[0],i+o[1],e+o[2],i+o[3],e+o[4],i+o[5]),s=e+o[4],n=i+o[5];break;case"H":t.lineTo(e+o[0],n),s=i+o[0];break;case"L":t.lineTo(e+o[0],i+o[1]),s=e+o[0],n=i+o[1];break;case"V":t.lineTo(s,i+o[0]),n=i+o[0];break;case"Z":t.closePath();break;default:throw new Error(`Could not translate command '${r}' with '${o.join(" ")}'`)}t.closePath()}};__decorateClass([ScenePathChangeDetection()],SvgPath.prototype,"x",2),__decorateClass([ScenePathChangeDetection()],SvgPath.prototype,"y",2);var Image=class extends Node{constructor(t){super(),this.sourceImage=t,this.x=0,this.y=0,this.width=0,this.height=0,this.opacity=1}render(t){const{ctx:e}=t,i=this.sourceImage;i&&(e.globalAlpha=this.opacity,e.drawImage(i,0,0,i.width,i.height,this.x,this.y,this.width,this.height)),super.render(t)}};__decorateClass([SceneChangeDetection()],Image.prototype,"x",2),__decorateClass([SceneChangeDetection()],Image.prototype,"y",2),__decorateClass([SceneChangeDetection()],Image.prototype,"width",2),__decorateClass([SceneChangeDetection()],Image.prototype,"height",2),__decorateClass([SceneChangeDetection()],Image.prototype,"opacity",2);var exports_exports={};__export(exports_exports,{ButtonWidget:()=>ButtonWidget,NativeWidget:()=>NativeWidget,SliderWidget:()=>SliderWidget,ToolbarWidget:()=>ToolbarWidget,WIDGET_HTML_EVENTS:()=>WIDGET_HTML_EVENTS,Widget:()=>Widget,WidgetEventUtil:()=>WidgetEventUtil});var canvasOverlay="canvas-overlay",Popover=class extends BaseModuleInstance{constructor(t,e,i){super(),this.ctx=t,this.hideFns=[],this.moduleId=`popover-${e}`,i?.detached?this.element=createElement("div"):this.element=t.domManager.addChild(canvasOverlay,this.moduleId),this.element.setAttribute("role","presentation"),this.destroyFns.push(()=>t.domManager.removeChild(canvasOverlay,this.moduleId))}attachTo(t){this.element.parentElement||t.element.append(this.element)}hide(t){const{lastFocus:e=this.lastFocus}=t??{};this.element.children.length!==0&&(this.hideFns.forEach(i=>i()),e?.focus(),this.lastFocus=void 0)}removeChildren(){this.element.replaceChildren()}showWithChildren(t,e){if(!this.element.parentElement)throw new Error("Can not show popover that has not been attached to a parent.");const i=createElement("div","ag-charts-popover");if(e.ariaLabel!=null&&i.setAttribute("aria-label",e.ariaLabel),e.class!=null&&i.classList.add(e.class),i.replaceChildren(...t),this.element.replaceChildren(i),this.hideFns.push(()=>this.removeChildren()),e.onHide&&this.hideFns.push(e.onHide),e.initialFocus&&e.sourceEvent){const s=getLastFocus(e.sourceEvent);s!==void 0&&(this.lastFocus=s,this.initialFocus=e.initialFocus)}return i}getPopoverElement(){return this.element.firstElementChild}updatePosition(t){const e=this.getPopoverElement();e&&(e.style.setProperty("right","unset"),e.style.setProperty("bottom","unset"),t.x!=null&&e.style.setProperty("left",`${Math.floor(t.x)}px`),t.y!=null&&e.style.setProperty("top",`${Math.floor(t.y)}px`),this.initialFocus?.focus(),this.initialFocus=void 0)}},AnchoredPopover=class extends Popover{setAnchor(t,e){this.anchor=t,this.fallbackAnchor=e,this.updatePosition(t),this.repositionWithinBounds()}showWithChildren(t,e){const i=e.anchor??this.anchor,s=e.fallbackAnchor??this.fallbackAnchor,n=super.showWithChildren(t,e);return i&&this.setAnchor(i,s),getWindow().requestAnimationFrame(()=>{this.repositionWithinBounds()}),n}repositionWithinBounds(){const{anchor:t,ctx:e,fallbackAnchor:i}=this,s=this.getPopoverElement();if(!t||!s)return;const n=e.domManager.getBoundingClientRect(),{offsetWidth:r,offsetHeight:o}=s;let a=clamp(0,t.x,n.width-r),l=clamp(0,t.y,n.height-o);a!==t.x&&i?.x!=null&&(a=clamp(0,i.x-r,n.width-r)),l!==t.y&&i?.y!=null&&(l=clamp(0,i.y-o,n.height-o)),this.updatePosition({x:a,y:l})}},Menu=class extends AnchoredPopover{show(t){const e=t.items.map(s=>this.createRow(t,s)),i=this.showWithChildren(e,t);i.classList.add("ag-charts-menu"),i.setAttribute("role","menu"),this.menuCloser=initMenuKeyNav({orientation:"vertical",menu:i,buttons:e,sourceEvent:t.sourceEvent,closeCallback:()=>this.hide()}),this.hideFns.push(()=>{this.menuCloser?.finishClosing(),this.menuCloser=void 0})}createRow(t,e){const{menuItemRole:i="menuitem"}=t,s=e.value===t.value,n=createElement("div","ag-charts-menu__row");if(n.setAttribute("role",i),i==="menuitemradio"&&n.setAttribute("aria-checked",(t.value===e.value).toString()),typeof e.value=="string"&&(n.dataset.popoverId=e.value),n.classList.toggle("ag-charts-menu__row--active",s),e.icon!=null){const l=createElement("span",`ag-charts-menu__icon ${getIconClassNames(e.icon)}`);n.appendChild(l)}const r=e.strokeWidth!=null;if(r&&(n.classList.toggle("ag-charts-menu__row--stroke-width-visible",r),n.style.setProperty("--strokeWidth",r?`${e.strokeWidth}px`:null)),e.label!=null){const l=createElement("span","ag-charts-menu__label");l.textContent=this.ctx.localeManager.t(e.label),n.appendChild(l)}"altText"in e&&(n.ariaLabel=this.ctx.localeManager.t(e.altText));const o=()=>{t.onPress?.(e)},a=l=>{isButtonClickEvent(l)&&(o(),l.preventDefault(),l.stopPropagation())};return n.addEventListener("keydown",a),n.addEventListener("click",a),n.addEventListener("mousemove",()=>{n.focus({preventScroll:!0})}),n}},DraggablePopover=class extends Popover{constructor(){super(...arguments),this.dragged=!1}setDragHandle(t){t.addListener("drag-start",e=>{t.addClass(this.dragHandleDraggingClass),this.onDragStart(e)}),t.addListener("drag-move",this.onDragMove.bind(this)),t.addListener("drag-end",()=>{t.removeClass(this.dragHandleDraggingClass),this.onDragEnd.bind(this)})}onDragStart(t){const e=this.getPopoverElement();e&&(t.sourceEvent.preventDefault(),this.dragged=!0,this.dragStartState={client:Vec2.from(t.clientX,t.clientY),position:Vec2.from(Number(e.style.getPropertyValue("left").replace("px","")),Number(e.style.getPropertyValue("top").replace("px","")))})}onDragMove(t){const{dragStartState:e}=this,i=this.getPopoverElement();if(!e||!i)return;const s=Vec2.sub(Vec2.from(t.clientX,t.clientY),e.client),n=Vec2.add(e.position,s),r=this.ctx.domManager.getBoundingClientRect(),o={};n.x>=r.x&&n.x+i.offsetWidth<=r.width&&(o.x=n.x),n.y>=r.y&&n.y+i.offsetHeight<=r.height&&(o.y=n.y),this.updatePosition(o)}onDragEnd(){this.dragStartState=void 0}},ToolbarButtonProperties=class extends BaseProperties{};__decorateClass([Validate(STRING,{optional:!0})],ToolbarButtonProperties.prototype,"icon",2),__decorateClass([Validate(STRING,{optional:!0})],ToolbarButtonProperties.prototype,"label",2),__decorateClass([Validate(STRING,{optional:!0})],ToolbarButtonProperties.prototype,"ariaLabel",2),__decorateClass([Validate(STRING,{optional:!0})],ToolbarButtonProperties.prototype,"tooltip",2);var ToolbarButtonWidget=class extends ButtonWidget{constructor(t){super(),this.localeManager=t}update(t){const{localeManager:e}=this;t.tooltip&&(this.elem.title=e.t(t.tooltip));let i="";if(t.icon!=null&&(i=``),t.label!=null){const s=e.t(t.label);i=`${i}${s}`}this.elem.innerHTML=i}setChecked(t){setAttribute(this.elem,"aria-checked",t)}},BUTTON_ACTIVE_CLASS="ag-charts-toolbar__button--active",BaseToolbar=class extends ToolbarWidget{constructor(t,e="horizontal"){super(e),this.localeManager=t,this.horizontalSpacing=10,this.verticalSpacing=10,this.events=new Listeners,this.hasPrefix=!1,this.buttonWidgets=[],this.addClass("ag-charts-toolbar"),this.toggleClass("ag-charts-toolbar--horizontal",e==="horizontal"),this.toggleClass("ag-charts-toolbar--vertical",e==="vertical")}addToolbarListener(t,e){return this.events.addListener(t,e)}clearButtons(){for(const t of this.buttonWidgets)t.destroy();this.buttonWidgets.splice(0)}updateButtons(t){const{buttonWidgets:e}=this;for(const[i,s]of t.entries())(this.buttonWidgets.at(i)??this.createButton(i,s)).update(s);for(let i=t.length;ithis.getButtonWidgetBounds(t))}setButtonHiddenByIndex(t,e){this.buttonWidgets.at(t)?.setHidden(e)}getButtonWidgetBounds(t){const e=this.getBounds(),i=t.getBounds();return new BBox(i.x+e.x,i.y+e.y,i.width,i.height)}refreshButtonClasses(){const{buttonWidgets:t,hasPrefix:e}=this;let i,s,n;for(const[r,o]of t.entries())i=!e&&r===0||n!=o.section,s=r===t.length-1||o.section!=t.at(r+1)?.section,o.toggleClass("ag-charts-toolbar__button--first",i),o.toggleClass("ag-charts-toolbar__button--last",s),o.toggleClass("ag-charts-toolbar__button--gap",r>0&&i),n=o.section}createButton(t,e){const i=this.createButtonWidget();return i.addClass("ag-charts-toolbar__button"),i.addListener("click",s=>{const n={index:t,...e instanceof BaseProperties?e.toJson():e},r=this.getButtonWidgetBounds(i);this.events.dispatch("button-pressed",{event:s,button:n,buttonBounds:r})}),i.addListener("focus",()=>{this.events.dispatch("button-focused",{button:{index:t}})}),e.section&&(i.section=e.section),this.buttonWidgets.push(i),this.addChild(i),i}},Toolbar=class extends BaseToolbar{createButtonWidget(){return new ToolbarButtonWidget(this.localeManager)}},FloatingToolbarPopover=class extends DraggablePopover{constructor(t,e,i){super(t,e),this.onPopoverMoved=i,this.dragHandleDraggingClass="ag-charts-floating-toolbar__drag-handle--dragging"}show(t,e={}){this.showWithChildren(t,{...e,class:"ag-charts-floating-toolbar"})}hide(){this.dragged=!1,super.hide()}getBounds(){const t=this.getPopoverElement();return new BBox(t?.offsetLeft??0,t?.offsetTop??0,t?.offsetWidth??0,t?.offsetHeight??0)}hasBeenDragged(){return this.dragged}setAnchor(t,e,i){const s=this.getPopoverElement();if(!s)return;const n=t.position??"above",{offsetWidth:r,offsetHeight:o}=s;let a=t.y-o-i,l=t.x-r/2;n==="below"?a=t.y+i:n==="right"?(a=t.y-o/2,l=t.x+e):n==="above-left"&&(l=t.x),this.updatePosition({x:l,y:a})}ignorePointerEvents(){const t=this.getPopoverElement();t&&(t.style.pointerEvents="none")}capturePointerEvents(){const t=this.getPopoverElement();t&&(t.style.pointerEvents="unset")}updatePosition(t){const e=this.getBounds(),i=this.ctx.domManager.getBoundingClientRect();t.x=Math.floor(clamp(0,t.x,i.width-e.width)),t.y=Math.floor(clamp(0,t.y,i.height-e.height)),super.updatePosition(t),this.onPopoverMoved()}},FloatingToolbar=class extends BaseToolbar{constructor(t,e){super(t.localeManager),this.hasPrefix=!0,this.popover=new FloatingToolbarPopover(t,e,this.onPopoverMoved.bind(this)),this.dragHandle=new DragHandleWidget(t.localeManager.t("toolbarAnnotationsDragHandle")),this.popover.setDragHandle(this.dragHandle)}show(t={}){this.popover.show([this.dragHandle.getElement(),this.getElement()],t)}hide(){this.popover.hide()}setAnchor(t){this.popover.setAnchor(t,this.horizontalSpacing,this.verticalSpacing)}hasBeenDragged(){return this.popover.hasBeenDragged()}ignorePointerEvents(){this.popover.ignorePointerEvents()}capturePointerEvents(){this.popover.capturePointerEvents()}onPopoverMoved(){const t=this.popover.getBounds();if(this.popoverBounds?.equals(t))return;this.popoverBounds=t.clone();const e=this.getButtonBounds();this.events.dispatch("toolbar-moved",{popoverBounds:t,buttonBounds:e})}getButtonWidgetBounds(t){const e=this.popover.getBounds(),i=super.getButtonWidgetBounds(t),s=this.dragHandle.getBounds();return new BBox(i.x+e.x-s.width,i.y+e.y,i.width,i.height)}},DragHandleWidget=class extends NativeWidget{constructor(t){super(createElement("div","ag-charts-floating-toolbar__drag-handle"));const e=new NativeWidget(createElement("span",`${getIconClassNames("drag-handle")} ag-charts-toolbar__icon`));e.setAriaHidden(!0),this.addChild(e),this.elem.title=t}},motion={...fromToMotion_exports,...resetMotion_exports},AgChartsCommunityModule={VERSION,_Scene:integrated_charts_scene_exports,_Theme:integrated_charts_theme_exports,_Util:integrated_charts_util_exports,create:AgCharts.create.bind(AgCharts),createSparkline:AgCharts.__createSparkline.bind(AgCharts),setup:registerInbuiltModules,isEnterprise:!1};