UNPKG

ag-charts-core

Version:

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

4 lines (3 loc) 30.6 kB
var mt=Object.defineProperty,Ce=(e,t)=>{for(var n in t)mt(e,n,{get:t[n],enumerable:!0})},le={};Ce(le,{error:()=>je,errorOnce:()=>xt,log:()=>wt,logGroup:()=>Mt,reset:()=>kt,table:()=>$t,warn:()=>fe,warnOnce:()=>G});var ue=new Set;function wt(...e){console.log(...e)}function fe(e,...t){console.warn(`AG Charts - ${e}`,...t)}function je(e,...t){typeof e=="object"?console.error("AG Charts error",e,...t):console.error(`AG Charts - ${e}`,...t)}function $t(...e){console.table(...e)}function Ee(e,t,n){let r;e instanceof Error?r=e.message:typeof e=="string"?r=e:typeof e=="object"?r=JSON.stringify(e):r=String(e);const i=`${t}: ${r}`;ue.has(i)||(n(e),ue.add(i))}function G(e,...t){Ee(e,"Logger.warn",n=>fe(n,...t))}function xt(e,...t){Ee(e,"Logger.error",n=>je(n,...t))}function kt(){ue.clear()}function Mt(e,t){console.groupCollapsed(e);try{return t()}finally{console.groupEnd()}}var Ae={};Ce(Ae,{detectChartDefinition:()=>At,getAxisModule:()=>Ot,getPresetModule:()=>Pt,getSeriesModule:()=>It,hasModule:()=>jt,listModulesByType:()=>Et,register:()=>Pe,registerMany:()=>St,reset:()=>Ct});var Oe=(e=>(e.Axis="axis",e.Chart="chart",e.Preset="preset",e.Plugin="plugin",e.Series="series",e))(Oe||{}),j=new Map;function Pe(e,t){const{def:n,version:r}=j.get(e.name)??{};if(!n){j.set(e.name,{def:e,version:t});return}if(!n.enterprise&&e.enterprise&&t===r){j.set(e.name,{def:e,version:t});return}if(r===t){fe([`AG Charts - Module '${e.name}' already registered,', 'ignoring (version: ${r}).`,"Check your code for duplicate loading of charts NPM modules."].join(" "));return}throw new Error([`AG Charts - Module '${e.name}' already registered with different version:`,`${r} vs ${t}`,"","Check your package.json for conflicting dependencies - depending on your package manager","one of these commands may help:","- npm ls ag-charts-community","- yarn why ag-charts-community"].join(` `))}function St(e,t){for(const n of e)Pe(n,t)}function Ct(){j.clear()}function jt(e){return j.has(e)}function*Et(e){for(const t of j.values())B(e,t.def)&&(yield t.def)}function At(e){for(const t of j.values())if(B("chart",t.def)&&t.def.detect(e))return t.def;throw new Error("AG Charts - Unknown chart type; Check options are correctly structured and series types are specified")}function Ot(e){const t=j.get(e);if(B("axis",t?.def))return t?.def}function Pt(e){const t=j.get(e);if(B("preset",t?.def))return t?.def}function It(e){const t=j.get(e);if(B("series",t?.def))return t?.def}function B(e,t){return t?.type===e}var Vt=class{constructor(){this.events=new Map}on(e,t){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e)?.add(t),()=>this.off(e,t)}off(e,t){const n=this.events.get(e);n&&(n.delete(t),n.size===0&&this.events.delete(e))}emit(e,t){this.events.get(e)?.forEach(n=>n(t))}clear(e){e?this.events.delete(e):this.events.clear()}},E={};typeof window<"u"?E.window=window:typeof global<"u"&&(E.window=global.window),typeof document<"u"?E.document=document:typeof global<"u"&&(E.document=global.document);function Z(e){return e?E.document?.[e]:E.document}function Ie(e){return e?E.window?.[e]:E.window}function Nt(e){E.document=e}function Ft(e){E.window=e}function Ve(e,t,n){const r=Z().createElement(e);if(typeof t=="object"&&(n=t,t=void 0),t)for(const i of t.split(" "))r.classList.add(i);return n&&Object.assign(r.style,n),r}function Dt(e){return Z().createElementNS("http://www.w3.org/2000/svg",e)}function Tt(e,t){const n=Z("body"),r=Ve("a",{display:"none"});r.href=e,r.download=t,n.appendChild(r),r.click(),setTimeout(()=>n.removeChild(r))}function Rt(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Q;function Ne(e){if(Q==null){const t=Ie("Option");Q=new t().style}return Q.color=e,Q.color||null}function Fe(e){return e!=null}function A(e){return Array.isArray(e)}function De(e){return typeof e=="boolean"}function de(e){return e instanceof Date}function he(e){return de(e)&&!isNaN(Number(e))}function Wt(e){return e instanceof RegExp}function O(e){return typeof e=="function"}function P(e){return typeof e=="object"&&e!==null&&!A(e)}function qt(e){return A(e)||Te(e)}function Te(e){return typeof e=="object"&&e!==null&&e.constructor?.name==="Object"}function _t(e){if(typeof e!="object"||e===null)return!1;for(const t in e)return!1;return!0}function F(e){return typeof e=="string"}function Ut(e){return typeof e=="number"}function I(e){return Number.isFinite(e)}function Gt(e){return typeof window<"u"&&e instanceof HTMLElement}function Bt(e,t){return F(t)&&Object.keys(e).includes(t)}function zt(e,t){return Object.values(e).includes(t)}function Ht(e){return typeof e=="symbol"}function Re(e){return F(e)&&(e==="none"||Ne(e)!=null)}function Kt(e,t){return e in t}function Lt(e,t=0,n){const{leading:r=!1,trailing:i=!0,maxWait:o=1/0}=n??{};let a,s;if(o<t)throw new Error("Value of maxWait cannot be lower than waitMs.");function l(...c){if(r&&!s){s=Date.now(),a=setTimeout(()=>s=null,t),e(...c);return}let u=t;if(o!==1/0&&s){const h=Date.now()-s;t>o-h&&(u=o-h)}clearTimeout(a),s??(s=Date.now()),a=setTimeout(()=>{s=null,i&&e(...c)},u)}return Object.assign(l,{cancel(){clearTimeout(a),s=null}})}function Jt(e,t,n){const{leading:r=!0,trailing:i=!0}=n??{};let o,a,s=!1;function l(){i&&a?(o=setTimeout(l,t),e(...a)):s=!1,a=null}function c(...u){s?a=u:(s=!0,o=setTimeout(l,t),r?e(...u):a=u)}return Object.assign(c,{cancel(){clearTimeout(o),s=!1,a=null}})}function ge(e,t,n=""){try{return e(...t)}catch(r){const i=n?` \`${n}\``:"";G(`Uncaught exception in user callback${i}`,r)}}function X(e,t="and",n=String,r=1/0){if(e.length===0)return"";if(e.length===1)return n(e[0]);e=e.map(n);const i=e.pop();if(e.length>=r){const o=e.length-(r-1);return`${e.slice(0,r-1).join(", ")}, and ${o} more ${t} ${i}`}return`${e.join(", ")} ${t} ${i}`}function Y(e,t=1/0){if(typeof e=="number"){if(isNaN(e))return"NaN";if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity"}const n=JSON.stringify(e)??typeof e;return n.length>t?`${n.slice(0,t)}... (+${n.length-t} characters)`:n}function Zt(e){let t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function We(e,t){if(e===t)return 0;const[n,r]=e.length<t.length?[e,t]:[t,e],i=n.length,o=r.length;let a=new Array(i+1).fill(0).map((l,c)=>c),s=new Array(i+1);for(let l=1;l<=o;l++){s[0]=l;for(let c=1;c<=i;c++){const u=r[l-1]===n[c-1]?0:1;s[c]=Math.min(a[c]+1,s[c-1]+1,a[c-1]+u)}[a,s]=[s,a]}return a[i]}function Qt(e){return e.replace(Xt,(t,n)=>(n>0?"-":"")+t.toLowerCase())}var Xt=/[A-Z]+(?![a-z])|[A-Z]/g;function Yt(e){return A(e)?e.map(t=>t.text).join(""):e??""}var w=Symbol("description"),qe=Symbol("required"),ee=Symbol("marked"),_e=Symbol("undocumented"),te=Symbol("union"),en=[["placement","position"],["padding","spacing","gap"],["color","fill","stroke"],["whisker","wick"],["nodeClick","seriesNodeClick"],["nodeDoubleClick","seriesNodeDoubleClick"],["src","url"]].reduce((e,t)=>{for(const n of t)e.set(n.toLowerCase(),new Set(t.filter(r=>r!==n)));return e},new Map),Ue=(e=>(e.Invalid="invalid",e.Required="required",e.Unknown="unknown",e))(Ue||{});function z(e,t){return I(t)?`${e}[${t}]`:e?`${e}.${t}`:t}var H=class{constructor(e,t,n,r,i){this.type=e,this.description=t,this.value=n,this.path=r,this.key=i}setUnionType(e,t){if(this.path.startsWith(t)){const n=this.path.slice(t.length);this.altPath=`${t}[type=${e}]${n}`}}getPrefix(){const{altPath:e=this.path,key:t}=this;return!e&&!t?"Value":`Option \`${t?z(e,t):e}\``}toString(){const{description:e="unknown",type:t,value:n}=this;return t==="required"&&n==null?`${this.getPrefix()} is required and has not been provided; expecting ${e}, ignoring.`:`${this.getPrefix()} cannot be set to \`${Y(n,50)}\`; expecting ${e}, ignoring.`}},pe=class extends H{constructor(e,t,n,r){super("unknown",void 0,t,n,r),this.suggestions=e,this.key=r}getPrefix(){return`Unknown option \`${z(this.altPath??this.path,this.key)}\``}getPostfix(){const e=X(tn(this.key,this.suggestions),"or",t=>`\`${t}\``);return e?`; Did you mean ${e}? Ignoring.`:", ignoring."}toString(){return`${this.getPrefix()}${this.getPostfix()}`}};function R(e,t,n=""){if(!P(e))return{cleared:null,invalid:[new H("required","an object",e,n)]};const r={},i=[],o=new Set(Object.keys(e)),a=[];if(te in t){const s=Object.keys(t),l=t[te];if(e.type!=null&&s.includes(e.type)||e.type==null&&l!=null){const{type:c=l,...u}=e,h=R(u,t[c],n);Object.assign(r,{type:c},h.cleared);for(const x of h.invalid)x.setUnionType(c,n);i.push(...h.invalid)}else{const c=X(s,"or",u=>`'${u}'`);i.push(new H("required",`a keyword such as ${c}`,e.type,n,"type"))}return{cleared:r,invalid:i}}for(const s of Object.keys(t)){const l=t[s],c=l[qe],u=e[s];if(o.delete(s),typeof u>"u"&&(l[_e]||a.push(s),!c))continue;const h=z(n,s);if(O(l)){const M=l(u,{options:e,path:h});if(typeof M=="object"){if(i.push(...M.invalid),M.valid){r[s]=M.cleared;continue}else if(re(M.invalid,h))continue}else if(M){r[s]=u;continue}i.push(new H(c?"required":"invalid",l[w],u,n,s))}else{const x=R(u,l,h);x.cleared!=null&&(r[s]=x.cleared),i.push(...x.invalid)}}for(const s of o){const l=e[s];typeof l>"u"||i.push(new pe(a,l,n,s))}return{cleared:r,invalid:i}}function tn(e,t,n=2){const r=[],i=e.toLowerCase(),o=en.get(i);for(const a of t){const s=a.toLowerCase();(o?.has(a)||s.includes(i)||We(i,s)<=n)&&r.push(a)}return r}function f(e,t){if(O(e)){let r=function(i,o){return e(i,o)};var n=r;return r[w]=t,r}else return{...e,[w]:t}}function d(e){return Object.assign(O(e)?(t,n)=>e(t,n):C(e),{[qe]:!0,[w]:e[w]})}function S(e){return Object.assign(O(e)?(t,n)=>e(t,n):C(e),{[_e]:!0,[w]:e[w]})}var C=(e,t="an object")=>f((n,r)=>{const i=R(n,e,r.path);return{valid:!re(i.invalid,r.path),cleared:i.cleared,invalid:i.invalid}},t),Ge=(e,t,n)=>({...e,[w]:t,[te]:n}),ye=(...e)=>f((t,n)=>{const r=[];for(const i of e){const o=i(t,n);if(typeof o=="object"){if(r.push(...o.invalid),!o.valid)return{valid:!1,cleared:t,invalid:r};t=o.cleared}else if(!o)return!1}return{valid:!0,cleared:t,invalid:r}},e.map(t=>t[w]).filter(Boolean).join(" and ")),D=(...e)=>f((t,n)=>{for(const r of e){const i=r(t,n);if(typeof i=="object"?i.valid:i)return i}return!1},e.map(t=>t[w]).filter(Boolean).join(" or ")),ne=e=>I(e)||he(e),nn=e=>de(e)||(I(e)||F(e))&&he(new Date(e)),rn=f(A,"an array"),V=f(De,"a boolean"),on=f(O,"a function"),m=f(Re,"a color string"),sn=f(nn,"a date"),an=f(Fe,"a defined value"),y=f(I,"a number"),cn=f(P,"an object"),W=f(F,"a string"),ln=f(e=>typeof HTMLElement>"u"||e instanceof HTMLElement,"an html element"),be=(e,t=1/0)=>{let n;return t===1/0?n=`an array of at least ${e} items`:e===t?n=`an array of exactly ${e} items`:e===0?n=`an array of no more than ${t} items`:n=`an array of at least ${e} and no more than ${t} items`,f(r=>A(r)&&r.length>=e&&r.length<=t,n)},ve=(e,t=1/0)=>{let n;return t===1/0?n=`a string of at least ${e} characters`:e===t?n=`an string of exactly ${e} characters`:e===0?n=`an string of no more than ${t} characters`:n=`an string of at least ${e} and no more than ${t} characters`,f(r=>F(r)&&r.length>=e&&r.length<=t,n)},me=(e,t=!0)=>f(n=>I(n)&&(n>e||t&&n===e),`a number greater than ${t?"or equal to ":""}${e}`),Be=(e,t)=>f(n=>I(n)&&n>=e&&n<=t,`a number between ${e} and ${t} inclusive`),g=me(0),un=me(0,!1),b=Be(0,1),fn=e=>f((t,{options:n})=>!ne(t)||!ne(n[e])||t<n[e],`the value to be less than \`${e}\``),dn=e=>f((t,{options:n})=>!ne(t)||!ne(n[e])||t>n[e],`the value to be greater than \`${e}\``);function v(...e){P(e[0])&&(e=Object.values(e[0]));const t=X(e,"or",n=>`'${n}'`);return f(n=>e.includes(n),`a keyword such as ${t}`)}var K=e=>f(t=>e===t,`the value ${JSON.stringify(e)}`),hn=(e,t)=>f(n=>n instanceof e,t??`an instance of ${e.name}`),L=(e,t,n=!0)=>f((r,i)=>{if(!A(r))return!1;let o=n;const a=[],s=[],l=c=>o=n?o&&c:o||c;if(r.length===0)return{valid:!0,cleared:a,invalid:s};for(let c=0;c<r.length;c++){const u=r[c],h=e(u,{options:u,path:`${i.path}[${c}]`});typeof h=="object"?(o=l(h.valid),s.push(...h.invalid),h.cleared!=null&&a.push(h.cleared)):(o=l(h),h&&a.push(u))}return{valid:o,cleared:o||!n?a:null,invalid:s}},t??`${e[w]} array`),gn=(e,t="an object array")=>f((n,r)=>{if(!A(n))return!1;const i=[],o=[];for(let a=0;a<n.length;a++){const s=`${r.path}[${a}]`,l=R(n[a],e,s);re(l.invalid,s)||i.push(l.cleared),o.push(...l.invalid)}return{valid:!0,cleared:i,invalid:o}},t),pn=(e,t)=>f((n,r)=>O(n)?ee in n?!0:{valid:!0,cleared:Object.assign((...o)=>{const a=ge(n,o);if(a==null)return;const s=e(a,{options:a,path:""});if(typeof s=="object"){if(s.invalid.forEach(ze(r,t??e[w])),s.valid)return s.cleared}else{if(s)return a;G(`Callback \`${r.path}\` returned an invalid value \`${Y(a,50)}\`; expecting ${t??e[w]}, ignoring.`)}},{[ee]:!0}),invalid:[]}:!1,"a function"),yn=(e,t="an object")=>f((n,r)=>O(n)?ee in n?!0:{valid:!0,cleared:Object.assign((...o)=>{const a=ge(n,o,r.path);if(a==null)return;const s=R(a,e);return s.invalid.forEach(ze(r,t)),s.cleared},{[ee]:!0}),invalid:[]}:!1,"a function");function re(e,t){return e.some(n=>n.type==="required"&&n.path===t)}function ze(e,t){return n=>{if(n instanceof pe)return G(`Callback \`${e.path}\` returned an unknown property \`${z(n.path,n.key)}\`${n.getPostfix()}`);const r=Y(n.value,50);G(n.key?`Callback \`${e.path}\` returned an invalid property \`${z(n.path,n.key)}\`: \`${r}\`; expecting ${n.description}, ignoring.`:`Callback \`${e.path}\` returned an invalid value \`${r}\`; expecting ${t??n.description}, ignoring.`)}}var He=e=>{if(!P(e))return!1;const t=Object.keys(e);return t.length===1&&t[0].startsWith("$")},bn=C({color:m,stop:b},""),Ke=f(e=>{let t=-1/0;for(const n of e)if(n?.stop!=null){if(n.stop<t)return!1;t=n.stop}return!0},"color stops to be defined in ascending order"),ie=ye(be(2),L(bn),Ke),we=v("axis","item","series"),vn=C({type:d(K("gradient")),colorStops:d(ie),rotation:y,gradient:S(v("linear","radial","conic")),bounds:S(we),reverse:S(V)},"a gradient object with color stops"),J={stroke:m,strokeWidth:g,strokeOpacity:b},Le=C({type:d(K("gradient")),gradient:d(v("linear","radial","conic")),bounds:d(we),colorStops:d(D(ie,ye(be(2),L(m)))),rotation:d(y),reverse:d(V)}),Je=C({type:d(K("pattern")),pattern:d(v("vertical-lines","horizontal-lines","forward-slanted-lines","backward-slanted-lines","circles","squares","triangles","diamonds","stars","hearts","crosses")),path:ve(2),width:d(g),height:d(g),fill:d(m),fillOpacity:d(b),backgroundFill:d(m),backgroundFillOpacity:d(b),padding:d(g),rotation:d(y),scale:d(g),stroke:d(m),strokeWidth:d(g),strokeOpacity:d(b)}),Ze=C({type:d(K("image")),url:W,width:g,height:g,rotation:d(y),backgroundFill:d(m),backgroundFillOpacity:b,fit:d(v("stretch","contain","cover")),repeat:d(v("repeat","repeat-x","repeat-y","no-repeat"))}),mn=Ge({gradient:{colorStops:ie,rotation:y,gradient:S(v("linear","radial","conic")),bounds:S(we),reverse:S(V)},pattern:{pattern:v("vertical-lines","horizontal-lines","forward-slanted-lines","backward-slanted-lines","circles","squares","triangles","diamonds","stars","hearts","crosses"),path:ve(2),width:g,height:g,rotation:y,scale:g,fill:m,fillOpacity:b,backgroundFill:m,backgroundFillOpacity:b,...J,padding:S(g)},image:{url:d(W),backgroundFill:m,backgroundFillOpacity:b,width:g,height:g,fit:v("stretch","contain","cover","none"),repeat:v("repeat","repeat-x","repeat-y","no-repeat"),rotation:y}},"a color object"),Qe=D(m,C(mn,"a color object")),T={fill:Qe,fillOpacity:b};T.fillGradientDefaults=S(Le),T.fillPatternDefaults=S(Je),T.fillImageDefaults=S(Ze);var oe={lineDash:L(g),lineDashOffset:y},wn={...T,...J,...oe,opacity:b,cornerRadius:g},$n={...J,...oe,opacity:b},xn={...T,...J,...oe,opacity:b};function kn(e){return{enabled:V,range:v("tooltip","node"),highlightedItem:e,unhighlightedItem:e}}function Mn(e,t){return{enabled:V,range:v("tooltip","node"),highlightedItem:e,unhighlightedItem:e,highlightedSeries:t,unhighlightedSeries:t,bringToFront:V}}var $e=C({googleFont:W},"google font"),Xe=D(W,He,$e,L(D(W,$e))),Sn={color:m,fontFamily:Xe,fontSize:g,fontStyle:v("normal","italic","oblique"),fontWeight:D(g,v("normal","bold","bolder","lighter"))},Ye=C({top:y,right:y,bottom:y,left:y},"padding object"),et=D(y,Ye),tt={enabled:V,stroke:m,strokeWidth:g,strokeOpacity:b},Cn={border:{...tt},cornerRadius:y,padding:et,...T};function jn(e,t,n=1/0){const r=t,i=n,o=e%180*(Math.PI/180),a=Math.abs(Math.sin(o)),s=Math.abs(Math.cos(o));if(a===0)return{width:r,height:i};if(s===0)return{width:i,height:r};if(!isFinite(i)){const c=s/a,u=r/(s+c*a);return{width:u,height:c*u}}const l=s*s-a*a;if(l===0){const c=Math.min(r,i)/Math.SQRT2;return{width:c,height:c}}return{width:Math.abs((r*s-i*a)/l),height:Math.abs((i*s-r*a)/l)}}function En(e){return typeof e>"u"?[]:Array.isArray(e)?e:[e]}function An(e){return Array.from(new Set(e))}function On(e,t){return e.reduce((n,r)=>{const i=t(r);return n[i]??(n[i]=[]),n[i].push(r),n},{})}function nt(e,t){if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Array.isArray(e[n])&&Array.isArray(t[n])){if(!nt(e[n],t[n]))return!1}else if(e[n]!==t[n])return!1;return!0}function Pn(e,t,n=0){if(e.length===0)return[];const r=[];for(let i=0;i<t;i++)r.push(e.at((i+n)%e.length));return r}function In(e,t){const n=new Map;return t.forEach((r,i)=>{n.set(r,i)}),e.sort((r,i)=>{const o=n.get(r)??1/0,a=n.get(i)??1/0;return o-a})}function Vn(e,t){let n=0;for(;n<e.length&&t(e[n]);)n+=1;const r=n;r!==0&&e.splice(0,r)}function Nn(e,t){let n=e.length-1;for(;n>=0&&t(e[n]);)n-=1;const r=e.length-1-n;r!==0&&e.splice(e.length-r,r)}var Fn=class{constructor(){this.queue=[]}await(e=50){return new Promise(t=>{const n=()=>{clearTimeout(i),t(!0)},i=setTimeout(()=>{const o=this.queue.indexOf(n);o<0||(this.queue.splice(o,1),t(!1))},e);this.queue.push(n)})}notify(){this.queue.splice(0).forEach(e=>e())}};function Dn(e=0){return new Promise(t=>{setTimeout(t,e)})}function*Tn(...e){for(const t of e)yield*t}function Rn(e){return e!=null&&typeof e=="object"&&Symbol.iterator in e?e:[e]}function Wn(e){for(const t of e)return t;throw new Error("AG Charts - no first() value found")}function*xe(e){const t=[void 0,void 0];for(const n of Object.keys(e))t[0]=n,t[1]=e[n],yield t}function N(e){return e==="true"}function qn(e){return Number(e)}function $(e){return e}var _n={role:$,"aria-checked":N,"aria-controls":$,"aria-describedby":$,"aria-disabled":N,"aria-expanded":N,"aria-haspopup":$,"aria-hidden":N,"aria-label":$,"aria-labelledby":$,"aria-live":$,"aria-orientation":$,"aria-selected":N,"data-focus-override":N,"data-focus-visible-override":N,"data-preventdefault":N,class:$,for:$,id:$,tabindex:qn,title:$,placeholder:$};function rt(e,t,n){n==null||n===""||n===""?e?.removeAttribute(t):e?.setAttribute(t,n.toString())}function Un(e,t){if(t!=null)for(const[n,r]of xe(t))n!=="class"&&rt(e,n,r)}function Gn(e,t,n){if(!(e instanceof HTMLElement))return;const r=e.getAttribute(t);return r===null?n:_n[t]?.(r)??void 0}function it(e,t,n){e!=null&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n.toString()))}function Bn(e,t){for(const[n,r]of xe(t))it(e,n,r)}function zn(e,t,n,r,i){return t<e.x+e.width&&t+r>e.x&&n<e.y+e.height&&n+i>e.y}function Hn(e,t,n,r=0,i=0){return t>=e.x&&t+r<=e.x+e.width&&n>=e.y&&n+i<=e.y+e.height}function Kn(e){return e==null||e.height===0||e.width===0||isNaN(e.height)||isNaN(e.width)}function Ln(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Jn(e,t,n){if(e>t)return;let r;for(;t>=e;){const i=Math.floor((t+e)/2);n(i)?(r=i,e=i+1):t=i-1}return r}function Zn(e,t,n){if(e>t)return;let r;for(;t>=e;){const i=Math.floor((t+e)/2);n(i)?(r=i,t=i-1):e=i+1}return r}function Qn(e,t,n){if(e>t)return;let r;for(;t>=e;){const i=Math.floor((t+e)/2),o=n(i);o==null?t=i-1:(r=o,e=i+1)}return r}function Xn(e,t,n){if(e>t)return;let r;for(;t>=e;){const i=Math.floor((t+e)/2),o=n(i);o==null?e=i+1:(r=o,t=i-1)}return r}var Yn=class{constructor(e){this.getter=e}get(){return this.result??(this.result=this.getter()),this.result}clear(){this.result=void 0}},er=class{constructor(e){this.getter=e}get(){let e=this.result?.deref();return e||(e=this.getter(),this.result=new WeakRef(e),e)}clear(){this.result=void 0}},tr=class{constructor(){this.callbacks=new Set}flush(){for(const e of this.callbacks)e();this.callbacks.clear()}merge(e){for(const t of e.callbacks)this.callbacks.add(t)}register(...e){for(const t of e)t&&this.callbacks.add(t)}};function nr(e,t){const n=Math.max(e.length,t.length),r=new Set,i=new Set;for(let o=0;o<n;o++){const a=e[o],s=t[o];a!==s&&(i.has(s)?i.delete(s):s&&r.add(s),r.has(a)?r.delete(a):a&&i.add(a))}return{changed:r.size>0||i.size>0,added:r,removed:i}}function ot(e,t,n){return Math.min(n,Math.max(e,t))}function rr(e,t,n=1e-10){return e>=t[0]-n&&e<=t[1]+n}function ke(e,t,n=1e-10){return e===t||Math.abs(e-t)<n}function ir(e){return Math.sign(e)===-1||Object.is(e,-0)}function or(e){return e%1===0}function sr(e,t=2){const n=10**t;return Math.round(e*n)/n}function ar(e,t){return Math.floor(e%t+(e<0?Math.abs(t):0))}function cr(e){if(Math.floor(e)===e)return 0;let t=String(e),n=0;if(e<1e-6||e>=1e21){let i;[t,i]=t.split("e"),i!=null&&(n=Number(i))}const r=t.split(".")[1]?.length??0;return Math.max(r-n,0)}function st(e){return Array.isArray(e)&&e.length>=2&&e.every(I)}function se(e){return Array.isArray(e)&&e.length>=2&&e.every(st)}function lr(e){const t=e[0],n=e[e.length-1];return ke(t[0],n[0],.001)&&ke(t[1],n[1],.001)}function at(e){return Array.isArray(e)&&e.every(se)&&e.every(lr)}function ct(e){if(e===null)return!0;if(!P(e)||e.type==null)return!1;const{type:t,coordinates:n}=e;switch(t){case"GeometryCollection":return Array.isArray(e.geometries)&&e.geometries.every(ct);case"MultiPolygon":return Array.isArray(n)&&n.every(at);case"Polygon":return at(n);case"MultiLineString":return Array.isArray(n)&&n.every(se);case"LineString":return se(n);case"MultiPoint":return se(n);case"Point":return st(n);default:return!1}}function ur(e){return P(e)&&e.type==="Feature"&&ct(e.geometry)}function fr(e){return P(e)&&e.type==="FeatureCollection"&&Array.isArray(e.features)&&e.features.every(ur)}var dr=f(fr,"a GeoJSON object"),hr=class{constructor(e,t){this._vertexCount=0,this.pendingProcessingEdgesFrom=[],this.pendingProcessingEdgesTo=[],this.cachedNeighboursEdge=e,this.processedEdge=t}clear(){this._vertexCount=0,this.pendingProcessingEdgesFrom=[],this.pendingProcessingEdgesTo=[]}addVertex(e){const t=new lt(e);return this._vertexCount++,t}addEdge(e,t,n){n===this.cachedNeighboursEdge?e.updateCachedNeighbours().set(t.value,t):n===this.processedEdge&&(this.pendingProcessingEdgesFrom.push(e),this.pendingProcessingEdgesTo.push(t));const{edges:r}=e,i=r.get(n);i?i.indexOf(t)===-1&&i.push(t):r.set(n,[t])}removeVertex(e){this._vertexCount--;const t=e.edges;if(t){for(const[n,r]of t)this._vertexCount-=r.length;e.clear()}}removeEdge(e,t){for(const[n,r]of e.edges){const i=r.indexOf(t);r.splice(i,1),r.length===0&&e.edges.delete(n)}}removeEdges(e,t){e.edges.delete(t)}getVertexValue(e){return e.value}*neighbours(e){for(const[t,n]of e.edges)for(const r of n)yield r}*neighboursAndEdges(e){for(const[t,n]of e.edges)for(const r of n)yield[r,t]}neighboursWithEdgeValue(e,t){return e.edges.get(t)}findNeighbour(e,t){return e.edges.get(t)?.[0]}findNeighbourValue(e,t){const n=this.findNeighbour(e,t);if(n)return this.getVertexValue(n)}findNeighbourWithValue(e,t,n){const r=n==null?this.neighbours(e):this.neighboursWithEdgeValue(e,n);if(r){for(const i of r)if(this.getVertexValue(i)===t)return i}}findVertexAlongEdge(e,t,n){if(n===this.cachedNeighboursEdge){let i;for(const o of t)if(i=(i??e).readCachedNeighbours()?.get(o),!i)return;return i}if(t.length===0)return;let r=e;for(const i of t){const o=r?this.neighboursWithEdgeValue(r,n):void 0;if(!o)return;r=o.find(a=>a.value===i)}return r}adjacent(e,t){for(const[n,r]of e.edges)if(r.includes(t))return!0;return!1}},lt=class{constructor(e){this.value=e,this.edges=new Map}readCachedNeighbours(){return this._cachedNeighbours}updateCachedNeighbours(){return this._cachedNeighbours??(this._cachedNeighbours=new Map),this._cachedNeighbours}clear(){this.edges.clear(),this._cachedNeighbours?.clear()}},Me=new Map,Ar=Symbol("ElementID"),ut=1;function gr(){Me.clear(),ut=1}function pr(e){const t=e.constructor,n=Object.hasOwn(t,"className")?t.className:t.name;if(!n)throw new Error(`The ${t} is missing the 'className' property.`);const r=(Me.get(n)??0)+1;return Me.set(n,r),`${n}-${r}`}function yr(){return`ag-charts-${ut++}`}function br(){return crypto.randomUUID?.()??vr()}function vr(){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<e.length;n++)(n===4||n===6||n===8||n===10)&&(t+="-"),t+=e[n].toString(16).padStart(2,"0");return t}var mr=(e,t,n)=>{let r=e,i=r;for(const o of t)if(r==null||n(r.value,o)>0)r={value:o,next:r},i=r;else{for(i=i;i.next!=null&&n(i.next.value,o)<=0;)i=i.next;i.next={value:o,next:i.next}}return r},ft=/^(?:(.)?([<>=^]))?([+\-( ])?([$€£¥₣₹#])?(0)?(\d+)?(,)?(?:\.(\d+))?(~)?([%a-z])?$/i,dt=/^((?:[^#]|#[^{])*)#{([^}]+)}(.*)$/;function wr(e){if(!F(e))return!1;const t=dt.exec(e);return ft.test(t?t[2]:e)}function ht(e){let t,n;const r=dt.exec(e);r&&([,t,e,n]=r);const i=ft.exec(e);if(!i){le.warnOnce(`The number formatter is invalid: ${e}`);return}const[,o,a,s,l,c,u,h,x,M,_]=i;return{fill:o,align:a,sign:s,symbol:l,zero:c,width:parseInt(u),comma:h,precision:parseInt(x),trim:!!M,type:_,prefix:t,suffix:n}}function $r(e){const t=typeof e=="string"?ht(e):e;if(t==null)return;const{fill:n,align:r,sign:i="-",symbol:o,zero:a,width:s,comma:l,type:c,prefix:u="",suffix:h="",precision:x}=t;let{trim:M}=t;const _=x==null||isNaN(x);let U;if(!c)U=k.g,M=!0;else if(c in k&&c in q)U=_?q[c]:k[c];else if(c in k)U=k[c];else if(c in q)U=q[c];else throw new Error(`The number formatter type is invalid: ${c}`);const bt=c?6:12;let Se;return _||(Se=x),(ce,vt)=>{let p=U(ce,Se??vt??bt);return M&&(p=Mr(p)),l&&(p=Sr(p,l)),p=jr(ce,p,i),o&&o!=="#"&&(p=`${o}${p}`),o==="#"&&c==="x"&&(p=`0x${p}`),c==="s"&&(p=`${p}${Cr(ce)}`),(c==="%"||c==="p")&&(p=`${p}%`),s!=null&&!isNaN(s)&&(p=Er(p,s,n??a,r)),p=`${u}${p}${h}`,p}}var q={b:e=>ae(e).toString(2),c:e=>String.fromCharCode(e),d:e=>Math.round(Math.abs(e)).toFixed(0),o:e=>ae(e).toString(8),x:e=>ae(e).toString(16),X:e=>q.x(e).toUpperCase(),n:e=>q.d(e),"%":e=>`${ae(e*100).toFixed(0)}`},k={e:(e,t)=>Math.abs(e).toExponential(t),E:(e,t)=>k.e(e,t).toUpperCase(),f:(e,t)=>Math.abs(e).toFixed(t),F:(e,t)=>k.f(e,t).toUpperCase(),g:(e,t)=>{if(e===0)return"0";const n=Math.abs(e),r=Math.floor(Math.log10(n));return r>=-4&&r<t?n.toFixed(t-1-r):n.toExponential(t-1)},G:(e,t)=>k.g(e,t).toUpperCase(),n:(e,t)=>k.g(e,t),p:(e,t)=>k.r(e*100,t),r:(e,t)=>{if(e===0)return"0";const n=Math.abs(e),i=Math.floor(Math.log10(n))-(t-1);if(i<=0)return n.toFixed(-i);const o=10**i;return(Math.round(n/o)*o).toFixed()},s:(e,t)=>{const n=yt(e);return k.r(e/10**n,t)},"%":(e,t)=>k.f(e*100,t)},gt=-24,pt=24,xr={[gt]:"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",[pt]:"Y"},kr="\u2212";function ae(e){return Math.floor(Math.abs(e))}function Mr(e){if(!e.endsWith("0")||e.indexOf(".")===-1)return e;let t=e.length-1;for(;t>0;)if(e[t]=="0")t-=1;else if(e[t]=="."){t-=1;break}else break;return e.substring(0,t+1)}function Sr(e,t){let n=e.indexOf(".");n<0&&(n=e.length);const r=e.substring(0,n).split(""),i=e.substring(n);for(let o=r.length-3;o>0;o-=3)r.splice(o,0,t);return`${r.join("")}${i}`}function Cr(e){return xr[yt(e)]}function yt(e){return ot(gt,e?Math.floor(Math.log10(Math.abs(e))/3)*3:0,pt)}function jr(e,t,n=""){if(n==="(")return e>=0?t:`(${t})`;const r=n==="+"?"+":"";return`${e>=0?r:kr}${t}`}function Er(e,t,n=" ",r=">"){let i=e;if(r===">"||!r)i=i.padStart(t,n);else if(r==="<")i=i.padEnd(t,n);else if(r==="^"){const o=Math.max(0,t-i.length),a=Math.ceil(o/2),s=Math.floor(o/2);i=i.padStart(a+i.length,n),i=i.padEnd(s+i.length,n)}return i}export{hr as AdjacencyListGraph,Fn as AsyncAwaitQueue,tr as CleanupRegistry,Ue as ErrorType,Vt as EventEmitter,le as Logger,Ae as ModuleRegistry,Oe as ModuleType,Yn as SimpleCache,pe as UnknownError,H as ValidationError,lt as Vertex,er as WeakCache,ye as and,rn as array,be as arrayLength,L as arrayOf,gn as arrayOfDefs,nt as arraysEqual,f as attachDescription,Rt as attachListener,wn as barHighlightOptionsDef,V as boolean,tt as borderOptionsDef,zn as boxCollides,Hn as boxContains,Kn as boxEmpty,Ln as boxesEqual,on as callback,yn as callbackDefs,pn as callbackOf,Pn as circularSliceArray,ot as clamp,m as color,Ke as colorStopsOrderValidator,Qe as colorUnion,K as constant,cr as countFractionDigits,Zt as countLines,Ve as createElement,yr as createElementId,pr as createId,$r as createNumberFormatter,Dt as createSvgElement,sn as date,Lt as debounce,an as defined,nr as diffArrays,Tt as downloadUrl,Vn as dropFirstWhile,Nn as dropLastWhile,xe as entries,Le as fillGradientDefaults,Ze as fillImageDefaults,T as fillOptionsDef,Je as fillPatternDefaults,Jn as findMaxIndex,Qn as findMaxValue,Zn as findMinIndex,Xn as findMinValue,Wn as first,Xe as fontFamilyFull,Sn as fontOptionsDef,br as generateUUID,dr as geoJson,Gn as getAttribute,Z as getDocument,jn as getMaxInnerRectSize,Ie as getWindow,$e as googleFont,ie as gradientColorStops,vn as gradientStrict,dn as greaterThan,On as groupBy,re as hasRequiredInPath,kn as highlightOptionsDef,ln as htmlElement,rr as inRange,mr as insertListItemsSorted,hn as instanceOf,A as isArray,De as isBoolean,Re as isColor,de as isDate,Fe as isDefined,_t as isEmptyObject,Bt as isEnumKey,zt as isEnumValue,I as isFiniteNumber,O as isFunction,Gt as isHtmlElement,or as isInteger,Kt as isKeyOf,ir as isNegative,Ut as isNumber,ke as isNumberEqual,P as isObject,qt as isObjectLike,Te as isPlainObject,Wt as isRegExp,F as isString,Ht as isSymbol,he as isValidDate,wr as isValidNumberFormat,Tn as iterate,X as joinFormatted,Qt as kebabCase,Cn as labelBoxOptionsDef,fn as lessThan,We as levenshteinDistance,oe as lineDashOptionsDef,$n as lineHighlightOptionsDef,ar as modulus,Mn as multiSeriesHighlightOptionsDef,y as number,me as numberMin,Be as numberRange,cn as object,C as optionsDefs,D as or,et as padding,Ye as paddingOptions,Ne as parseColor,ht as parseNumberFormat,Dn as pause,g as positiveNumber,un as positiveNumberNonZero,b as ratio,d as required,gr as resetIds,sr as roundTo,ge as safeCall,rt as setAttribute,Un as setAttributes,Nt as setDocument,it as setElementStyle,Bn as setElementStyles,Ft as setWindow,xn as shapeHighlightOptionsDef,In as sortBasedOnArray,W as string,ve as stringLength,Y as stringifyValue,J as strokeOptionsDef,He as themeOperator,Jt as throttle,En as toArray,Rn as toIterable,Yt as toPlainText,Ge as typeUnion,S as undocumented,v as union,te as unionSymbol,An as unique,R as validate};