apexcharts
Version:
A JavaScript Chart Library
6 lines (5 loc) • 43.8 kB
JavaScript
/*!
* ApexCharts v7.0.0
* (c) 2018-2026 ApexCharts
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ApexUnit={})}(this,function(t){"use strict";var e=Object.defineProperty,i=Object.defineProperties,a=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(t,i,a)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[i]=a,l=(t,e)=>{for(var i in e||(e={}))r.call(e,i)&&o(t,i,e[i]);if(s)for(var i of s(e))n.call(e,i)&&o(t,i,e[i]);return t},c=(t,e)=>i(t,a(e));const h=globalThis.ApexCharts,u=1/45;function d(t,e,i,a){return{value:t,velocity:0,target:t,stiffness:e,damping:i}}function p(t,e){if(e<=0)return f(t);let i=e;for(;i>0;){const e=Math.min(i,u),a=-t.stiffness*(t.value-t.target)-t.damping*t.velocity;t.velocity+=a*e,t.value+=t.velocity*e,i-=e}return!!f(t)&&(t.value=t.target,t.velocity=0,!0)}function m(t,e){t.target=e}function f(t){var e,i;const a=null!=(e=t.restVelocity)?e:.05,s=null!=(i=t.restDisplacement)?i:.05;return Math.abs(t.velocity)<a&&Math.abs(t.value-t.target)<s}const x={crisp:[210,26],gentle:[120,20],snappy:[320,30]};const g=globalThis.ApexCharts.__internals.__apex_Graphics,y="__apexcharts_unit_layouts__";function b(t){return t&&globalThis[y][t]||null}globalThis[y]||(globalThis[y]={});const M="__apexcharts_unit_marks__";function _(t,e){if("string"==typeof t){const e=t.trim();return e?Object.freeze({name:"anonymous",path:e,viewBox:[0,0,100,100]}):null}if(!t||"object"!=typeof t)return null;if("string"!=typeof t.path||!t.path.trim())return null;const i=Array.isArray(t.viewBox)&&4===t.viewBox.length?t.viewBox.map(Number):[0,0,100,100];return!i.every(t=>isFinite(t))||i[2]<=0||i[3]<=0?null:Object.freeze(c(l({},t),{name:t.name||"anonymous",path:t.path.trim(),viewBox:i,fillRule:"evenodd"===t.fillRule?"evenodd":void 0}))}function A(t){return t&&globalThis[M][t]||null}globalThis[M]||(globalThis[M]={});const w=globalThis.ApexCharts.__internals.__apex_Utils,S=globalThis.ApexCharts.__internals.__apex_Environment_Environment,R=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,k=globalThis.ApexCharts.__internals;k.__apex_Animations,k.__apex_Animations_computeStagger,k.__apex_Animations_applyAnimationPolicy;const v=k.__apex_Animations_prefersReducedMotion;k.__apex_Animations_applyProgressiveReveal;const F=Math.PI*(3-Math.sqrt(5));function E(t){return 1-Math.pow(1-t,3)}function C(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function T(t,e){const[i,a]=null!=(r=x[null!=(s=t)?s:"crisp"])?r:x.crisp;var s,r;const n=800/Math.max(1,e);return[i*n*n,a*n]}h.use({unit:class{constructor(t,e){this.ctx=e,this.w=t,this._lastDotR=1,this._gridTrack=null,this._gridDenom=1,this._scatterAxis=null,this._specCache=new Map,this._markWarned=null}draw(t){const e=this.w,i=new g(e,this.ctx),a=i.group({class:"apexcharts-unit"});if(e.globals.noData||!Array.isArray(t)||0===t.length)return a;const s=e.config.plotOptions.unit,r="packed"===s.layout?"packed":"columns"===s.layout?"columns":"grid"===s.layout?"grid":"scatter"===s.layout?"scatter":"arc"===s.layout?"arc":"custom"===s.layout?"custom":"grouped",n=s.transition,o="flow"===n,l="identity"===n,c=s.unitValue>0?s.unitValue:1;let h=t.map(t=>{const e=Math.abs(w.parseNumber(t))/c;return e>0?Math.max(1,Math.round(e)):0});h=this._applyMaxUnits(h,s.maxUnits);const u=h.reduce((t,e)=>t+e,0),d="packed"===r?this._layoutPacked(h,s):"columns"===r?this._layoutColumns(h,s):"grid"===r?this._layoutGrid(h,s):"scatter"===r?this._layoutScatter(s):"arc"===r?this._layoutArc(h,s):"custom"===r?this._layoutCustom(h,s):this._layoutGrouped(h,s),p="grid"===r&&!(!s.grid||!s.grid.split);p&&this._drawGridTrack(a,i,s),"scatter"===r&&this._drawScatterAxes(a,i);const m=this._lastDotR,f=this._shouldAnimate(),x=this.ctx&&this.ctx.morphTypeChange,y=f&&!!x&&"function"==typeof x.isActive&&x.isActive()&&"function"==typeof x.getInitialCenterFor,b=y&&"function"==typeof x.getInitialSlotFor,M=y&&"function"==typeof x.usesPieceTakeover&&x.usesPieceTakeover(),_=f&&!y&&this.ctx?this.ctx._unitPrevDots:null,A=new Map,S=[],R=e.seriesData.unitData||[],k=this._bubbleStats(R,s,m);let v=0;if(d.forEach(t=>{const n=e.globals.colors[t.i]||e.globals.colors[0]||"#008FFB",c=i.group({class:"apexcharts-series",seriesName:w.escapeString(e.seriesData.seriesNames[t.i]||`series-${t.i+1}`),rel:t.i+1,"data:realIndex":t.i}),d=y&&!b?x.getInitialCenterFor(t.i):null,g=t.dots.length,F=R[t.i];if(t.dots.forEach((e,a)=>{const r=null!=e.j?e.j:a,h=F?F[r]:void 0,u=h&&"object"==typeof h&&h.fillColor?h.fillColor:n,y=null!=e.r?e.r:k?this._radiusForValue(this._unitValueOf(h),k):m,w=this._markSpecFor(s,h,t.i,y),R=this._drawDot(i,s,y,u,t.i,r,w);let E;if(c.add(R),l){const t=h&&"object"==typeof h?null!=h.id?h.id:h.name:void 0;E=null!=t?`id:${t}`:`g:${v}`}else E=o?String(v):null!=e.slot?`slot:${e.slot}`:`${t.i}:${r}`;if(v++,A.set(E,{x:e.x,y:e.y,fill:u,r:y,spec:w}),M)this._place(R.node,w,e.x,e.y),R.node.setAttribute("opacity","0"),R.node.setAttribute("data-piece-hidden","1");else if(f){const i=_&&_.get(E),a=i||(b?x.getInitialSlotFor(t.i,r,g):d),n=s.gather&&s.gather.enter||"burst",o=p||"fade"===n||"rise"===n,l=a?a.x:o?e.x:t.cx,c=a?a.y:"rise"!==n||p?o?e.y:t.cy:e.y+14;R.node.style.opacity=a?"1":"0",this._place(R.node,w,l,c),S.push({node:R.node,spec:w,x:e.x,y:e.y,cx0:l,cy0:c,key:E,r0:i&&null!=i.r?i.r:y,r1:y,fill0:i?i.fill:u,fill1:u,delay:0,isEnter:!a})}else this._place(R.node,w,e.x,e.y)}),("grouped"===r||"columns"===r||p)&&s.clusterLabels&&s.clusterLabels.show&&h[t.i]>0){const e=p?this._gridDenom:u;this._drawClusterLabel(c,t,h[t.i],e,s,n)}a.add(c)}),this._outerLabelsOn(s)&&this._drawOuterLabels(a,d,h,u,s,f&&!_),_){const t=this._collectExits(_,A,s);if(t.length){const e=i.group({class:"apexcharts-unit-exits"});a.add(e),this._runExits(e,t,s)}}return this.ctx&&(this.ctx._unitPrevDots=A),!this.ctx||f&&!y||(this.ctx._unitSprings=null),f&&S.length?this._runGather(S):e.globals.animationEnded=!0,a}_applyMaxUnits(t,e){const i=t.reduce((t,e)=>t+e,0);if(!e||e<=0||i<=e)return t;const a=e/i;return console.warn(`[ApexCharts] unit chart: ${i} dots exceeds maxUnits (${e}); counts were scaled down proportionally. Raise plotOptions.unit.maxUnits or use plotOptions.unit.unitValue to represent more units per dot.`),t.map(t=>t>0?Math.max(1,Math.round(t*a)):0)}_layoutCustom(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=t.reduce((t,e)=>t+e,0),n=this._resolveLayoutProvider(e);if(!n)return console.warn("[ApexCharts] unit chart: layout 'custom' needs plotOptions.unit.positions (a function, or the name of a layout registered with ApexCharts.registerUnitLayout). Falling back to 'grouped'."),this._layoutGrouped(t,e);const o=this._outerLabelsOn(e)?this._outerLabelGutter(t,e):0;this._lastOuterGutter=o;const l={x:o,y:0,width:Math.max(1,a-2*o),height:s},c=Math.sqrt(l.width*l.height/Math.PI),h=this._resolveStep(e,c,r);this._lastDotR=this._dotRadiusFromStep(h,e);const u=this._lastDotR,d=this._layoutObjects(t,u);let p;try{p=n(d,l)}catch(i){return console.warn("[ApexCharts] unit chart: the layout provider threw; falling back to 'grouped'.",i),this._layoutGrouped(t,e)}if(!Array.isArray(p))return console.warn("[ApexCharts] unit chart: the layout provider must return an array of {id, x, y}; falling back to 'grouped'."),this._layoutGrouped(t,e);const m=new Map;p.forEach(t=>{t&&isFinite(t.x)&&isFinite(t.y)&&m.set(String(t.id),{x:t.x,y:t.y,r:"number"==typeof t.r&&t.r>0?t.r:void 0})});const f=t.map((t,e)=>({i:e,cx:a/2,cy:s/2,outerR:u,dots:[]}));return d.forEach(t=>{const e=m.get(t.id);e&&f[t.seriesIndex].dots.push({x:e.x,y:e.y,r:e.r,j:t.dataPointIndex})}),f.forEach(t=>{if(!t.dots.length)return;let e=0,i=0;t.dots.forEach(t=>{e+=t.x,i+=t.y}),t.cx=e/t.dots.length,t.cy=i/t.dots.length;let a=0;t.dots.forEach(e=>{a=Math.max(a,Math.hypot(e.x-t.cx,e.y-t.cy))}),t.outerR=a+u}),f}_layoutObjects(t,e){const i=this.w,a=i.seriesData.unitData||[],s=i.seriesData.seriesNames||[],r=[];let n=0;return t.forEach((t,i)=>{var o;const l=a[i];for(let a=0;a<t;a++){const t=l?l[a]:void 0,c=!t||"object"!=typeof t||null==t.id&&null==t.name?`${i}:${a}`:String(null!=t.id?t.id:t.name);r.push({id:c,index:n,seriesIndex:i,dataPointIndex:a,label:s[i],value:null!=(o=this._unitValueOf(t))?o:void 0,datum:t,r:e}),n++}}),r}_resolveLayoutProvider(t){const e=t.positions;if("function"==typeof e)return e;if("string"==typeof e&&e){const t=b(e);if(t)return t;console.warn(`[ApexCharts] unit chart: no layout named "${e}" is registered. Register one with ApexCharts.registerUnitLayout("${e}", fn).`)}return null}_layoutGrouped(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.clusterLabels&&e.clusterLabels.show?30:6,n=t.map((t,e)=>e).filter(e=>t[e]>0),o=Math.max(1,n.length),l=new Array(t.length).fill(-1);n.forEach((t,e)=>l[t]=e);const c=a/o,h=s-r,u=Math.max(1,...t),d=.08*Math.min(c,h),p=Math.max(4,Math.min(c,h)/2-d),m=this._resolveStep(e,p,u);this._lastDotR=this._dotRadiusFromStep(m,e);const f=this._lastDotR,x=r+h/2,g=t.map(t=>m*Math.sqrt(Math.max(1,t))+f);let y=t.map((t,e)=>(t=>l[t]>=0?c*(l[t]+.5):a/2)(e));const b=n.map(t=>g[t]);let M=!1;for(let t=1;t<o;t++)if(y[n[t]]-y[n[t-1]]<b[t]+b[t-1]){M=!0;break}if(M){const e=Math.max(2*f,8),i=b.reduce((t,e)=>t+2*e,0)+e*(o-1);let s;if(i<=a){let t=(a-i)/2;s=b.map(i=>{const a=t+i;return t+=2*i+e,a})}else if(1===o)s=[a/2];else{const t=b[0],e=a-b[o-1];s=b.map((i,a)=>t+(e-t)*a/(o-1))}y=t.map((t,e)=>l[e]>=0?s[l[e]]:a/2)}return t.map((t,e)=>({i:e,cx:y[e],cy:x,outerR:g[e],dots:this._spiral(y[e],x,t,m,0)}))}_layoutPacked(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=Math.max(1,t.reduce((t,e)=>t+e,0)),n=Math.max(4,Math.min(a,s-6)/2-.06*Math.min(a,s)),o=this._resolveStep(e,n,r);this._lastDotR=this._dotRadiusFromStep(o,e);const l=a/2,c=6+(s-6)/2,h=t.map((t,e)=>e);!1!==e.sortByGroup&&h.sort((e,i)=>t[e]-t[i]);const u=t.map((t,e)=>({i:e,cx:l,cy:c,outerR:o*Math.sqrt(r)+this._lastDotR,dots:[]}));let d=0;return h.forEach(e=>{for(let i=0;i<t[e];i++){const t=o*Math.sqrt(d+.5),i=d*F;u[e].dots.push({x:l+t*Math.cos(i),y:c+t*Math.sin(i),slot:d}),d++}}),u}_layoutArc(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=Math.max(1,t.reduce((t,e)=>t+e,0)),n=e.arc||{},o="number"==typeof n.startAngle?n.startAngle:-90,l="number"==typeof n.endAngle?n.endAngle:90,c=o*Math.PI/180,h=l*Math.PI/180,u=h-c||Math.PI,d=Math.max(0,Math.min(.95,"number"==typeof n.innerRadiusRatio?n.innerRadiusRatio:.4)),p=t=>Math.sin(t),m=t=>-Math.cos(t),f=this._arcBounds(c,h),x=.04*Math.min(a,s),g=Math.max(1e-6,f.maxX-f.minX),y=Math.max(1e-6,f.maxY-f.minY),b=Math.max(4,Math.min((a-2*x)/g,(s-2*x)/y)),M=b*d,_=a/2-(f.minX+f.maxX)/2*b,A=s/2-(f.minY+f.maxY)/2*b,w=this._arcAllocate(r,M,b,u,e);this._lastDotR=w.dotR;const S=[];for(let t=0;t<w.R;t++){const e=w.radii[t],i=w.seatsPerRow[t];for(let t=0;t<i;t++){const a=1===i?(c+h)/2:c+u*(t+.5)/i;S.push({a:a,x:_+e*p(a),y:A+e*m(a)})}}S.sort((t,e)=>t.a-e.a);const R=t.map((t,e)=>({i:e,cx:_,cy:A,outerR:b,dots:[]}));let k=0,v=0;return S.forEach((e,i)=>{for(;k<t.length&&v>=t[k];)k++,v=0;k>=t.length||(R[k].dots.push({x:e.x,y:e.y,slot:i}),v++)}),R}_arcBounds(t,e){const i=t=>Math.sin(t),a=t=>-Math.cos(t),s=Math.min(t,e),r=Math.max(t,e),n=[0,i(t),i(e)],o=[0,a(t),a(e)],l=Math.PI/2;for(let t=Math.ceil(s/l);t*l<=r;t++)n.push(i(t*l)),o.push(a(t*l));return{minX:Math.min(...n),maxX:Math.max(...n),minY:Math.min(...o),maxY:Math.max(...o)}}_arcAllocate(t,e,i,a,s){const r=s.spacing>0?s.spacing:1.05,n=Math.abs(a)||Math.PI,o=this._fixedRadius(s),l=a=>{a=Math.max(1,Math.round(a));const s=[];for(let t=0;t<a;t++)s.push(1===a?(e+i)/2:e+t/(a-1)*(i-e));const o=s.reduce((t,e)=>t+e,0)||1,l=s.map(e=>t*e/o),c=l.map(t=>Math.floor(t));let h=t-c.reduce((t,e)=>t+e,0);for(l.map((t,e)=>({idx:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac).forEach(t=>{h>0&&(c[t.idx]++,h--)});h>0;)c[a-1]++,h--;const u=1===a?i-e||i:(i-e)/(a-1);let d=1/0;for(let t=0;t<a;t++){const e=c[t];if(e<=0)continue;const i=s[t]*n/e;i<d&&(d=i)}const p=Math.min(u,d);return{R:a,radii:s,seatsPerRow:c,dotR:Math.max(1,p/(2*r))}},c=s.arc&&s.arc.rows;let h;if("number"==typeof c&&c>=1)h=l(c);else if(o){h=l((i-e)/(2*o*r)+1)}else{const e=Math.max(1,Math.min(40,Math.ceil(Math.sqrt(t))+6));h=l(1);for(let t=2;t<=e;t++){const e=l(t);e.dotR>h.dotR&&(h=e)}}return o&&(h.dotR=o),h}_layoutColumns(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=!(!e.clusterLabels||!e.clusterLabels.show),n=r&&"bottom"===e.clusterLabels.position,o=r&&!n?30:6,l=t.map((t,e)=>e).filter(e=>t[e]>0),c=Math.max(1,l.length),h=new Array(t.length).fill(-1);l.forEach((t,e)=>h[t]=e);const u=a/c,d=.62*u,p=Math.max(8,.04*s)+(n?30:0),m=Math.max(4,s-o-p),f=Math.max(1,...t),x=e.spacing>0?e.spacing:1,g=e.columns?e.columns.size:void 0;let y;y="image"!==e.shape&&"auto"===g?null:"image"!==e.shape&&"number"==typeof g&&g>0?g:this._fixedRadius(e);let b=1,M=0;if(y){M=2*y*x,this._lastDotR=y;const t=Math.max(1,Math.floor(m/M)),e=Math.max(1,Math.floor(d/M));b=Math.max(1,Math.min(e,Math.ceil(f/t)))}else{let t=0;const e=Math.max(1,Math.min(40,Math.round(d/4)));for(let i=1;i<=e;i++){const e=Math.ceil(f/i),a=Math.min(d/i,m/e);a>t&&(t=a,b=i)}M=t,this._lastDotR=Math.max(1,M/(2*x))}const _=this._lastDotR,A=Math.ceil(f/b),w=o+(m+Math.min(m,A*M))/2;return t.map((t,e)=>{const i=h[e]>=0?u*(h[e]+.5):a/2,s=Math.ceil(Math.max(1,t)/b)*M,r=i-b*M/2+M/2,n=[];for(let e=0;e<t;e++){const t=Math.floor(e/b),i=e%b;n.push({x:r+i*M,y:w-_-t*M})}return{i:e,cx:i,cy:w-s/2,outerR:s/2,flat:!0,dots:n}})}_layoutGrid(t,e){if(e.grid&&e.grid.split)return this._layoutGridSplit(t,e);this._gridTrack=null;const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.grid||{},n=Math.max(1,Math.round(r.columns>0?r.columns:10)),o="top"===r.fillFrom?"top":"bottom",l=r.total>0?this._largestRemainder(t,Math.round(r.total)):t.slice(),c=l.reduce((t,e)=>t+e,0),h=Math.max(1,Math.ceil(Math.max(1,c)/n)),u=e.spacing>0?e.spacing:1,d=Math.max(4,a),p=Math.max(4,s-6),m=this._fixedRadius(e);let f=0;m?(f=2*m*u,this._lastDotR=m):(f=Math.min(d/n,p/h),this._lastDotR=Math.max(1,f/(2*u)));const x=n*f,g=h*f,y=(a-x)/2+f/2,b=6+(p-g)/2,M=t=>"bottom"===o?b+g-f/2-t*f:b+f/2+t*f,_=t.map((t,e)=>({i:e,cx:a/2,cy:6+p/2,outerR:Math.max(x,g)/2,dots:[]}));let A=0;for(let t=0;t<l.length;t++)for(let e=0;e<l[t];e++){const e=A%n,i=Math.floor(A/n);_[t].dots.push({x:y+e*f,y:M(i),slot:A}),A++}return _}_layoutGridSplit(t,e){const i=this.w,a=i.layout.gridWidth,s=i.layout.gridHeight,r=e.grid||{},n=Math.max(1,Math.round(r.columns>0?r.columns:10)),o="top"===r.fillFrom?"top":"bottom",l=Math.max(1,Math.round(r.total>0?r.total:100)),c=Math.max(1,Math.ceil(l/n)),h=t.map((t,e)=>e).filter(e=>t[e]>0),u=Math.max(1,h.length),d=r.max>0?r.max:Math.max(1,...t),p=Math.max(1,Math.round(r.tileColumns>0?r.tileColumns:Math.ceil(Math.sqrt(u)))),m=Math.max(1,Math.ceil(u/p)),f=!(e.clusterLabels&&!1===e.clusterLabels.show),x=f&&e.clusterLabels&&"bottom"===e.clusterLabels.position,g=f&&!x?22:4,y=f&&x?22:4,b=a/p,M=s/m,_=Math.max(4,.86*b),A=Math.max(4,M-g-y),w=e.spacing>0?e.spacing:1,S=this._fixedRadius(e);let R=0;S?(R=2*S*w,this._lastDotR=S):(R=Math.min(_/n,A/c),this._lastDotR=Math.max(1,R/(2*w)));const k=n*R,v=c*R,F=(t,e)=>"bottom"===o?t+v-R/2-e*R:t+R/2+e*R,E=[],C=[];return h.forEach((e,i)=>{const a=i%p,s=Math.floor(i/p),r=a*b,o=r+(b-k)/2+R/2,c=s*M+g+(A-v)/2,h=t=>({x:o+t%n*R,y:F(c,Math.floor(t/n))});for(let t=0;t<l;t++)E.push(h(t));const u=Math.max(0,Math.min(l,Math.round(t[e]/d*l))),m=[];for(let t=0;t<u;t++){const e=h(t);m.push({x:e.x,y:e.y,slot:i*l+t})}C.push({i:e,cx:r+b/2,cy:c+v/2,outerR:v/2,flat:!0,split:!0,dots:m})}),this._gridDenom=d,this._gridTrack={cells:E},C}_drawGridTrack(t,e,i){const a=this._gridTrack;if(!a||!a.cells||!a.cells.length)return;const s=this._lastDotR,r=(i.grid||{}).trackColor||"rgba(128,128,128,0.14)",n=e.group({class:"apexcharts-unit-track"});a.cells.forEach(t=>{let a;if("square"===i.shape){const n=2*s;a=e.drawRect(0,0,n,n,i.borderRadius||0,r,1,0,"none"),a.node.setAttribute("fill",r),a.node.setAttribute("x",String(t.x-s)),a.node.setAttribute("y",String(t.y-s))}else a=e.drawCircle(s,{fill:r,"stroke-width":0,stroke:"none"}),a.node.setAttribute("fill",r),a.node.setAttribute("cx",String(t.x)),a.node.setAttribute("cy",String(t.y));a.node.classList.add("apexcharts-unit-track-cell"),n.add(a)}),t.add(n)}_layoutScatter(t){const e=this.w,i=t.scatter||{};if("value"===i.y)return this._layoutScatter2D(t);if("vertical"===i.orientation)return this._layoutScatterVertical(t);const a=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(i,r),c=r.map(t=>Array.isArray(t)?t.map(o):[]),h=t=>null!=t&&isFinite(t),u=c.map((t,e)=>e).filter(t=>c[t].some(h)),d=Math.max(1,u.length);let p=1/0,m=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(t<p&&(p=t),t>m&&(m=t))})),p===1/0&&(p=0,m=1);const f=Math.max(2,Math.round(i.tickAmount>0?i.tickAmount:5)),x=this._scatterValueDomain(i,p,m,f),g=x.min,y=x.max,b=y-g||1,M=null!=i.laneLabelWidth?Math.max(0,i.laneLabelWidth):d>1?92:8,_=30+(i.xTitle?20:0),A=M,w=a-8,S=s-_,R=Math.max(4,w-A),k=Math.max(4,S-10),v=t=>A+(t-g)/b*R,F=k/d;let E=0;const C=this._fixedRadius(t);if(C)E=C;else{const t=Math.max(1,...u.map(t=>c[t].filter(h).length));E=Math.max(2,Math.min(6,.12*F,R/(2.5*Math.sqrt(t))))}this._lastDotR=E;const T=t.spacing>0?t.spacing:1,D=Math.max(.5,E*T),L="jitter"===i.spread,$=[],B=[],z=l?l.rMax:E;u.forEach((t,e)=>{const i=(t=>10+F*(t+.5))(e);B.push({i:t,cy:i,name:n[t]||`series-${t+1}`});const a=(r[t]||[]).map((t,e)=>{const a=o(t),s={j:e,px:v(h(a)?a:g),y:i};return l&&(s.r=this._scatterRadius(t,l,E)),s});if(L){const t=Math.max(z,F/2-z);a.forEach((e,a)=>{const s=(9301*a+49297)%233280/233280;e.y=i+(2*s-1)*t})}else this._beeswarm(a,i,E,D,z);$.push({i:t,cx:(A+w)/2,cy:i,outerR:F/2,dots:a.map(t=>({x:t.px,y:t.y,r:t.r}))})});const Y=x.ticks;return this._scatterAxis={mode:"1d",plotL:A,plotR:w,plotT:10,plotB:S,xMin:g,xMax:y,plotX:v,ticks:Y,lanes:B,xTitle:i.xTitle,formatter:"function"==typeof i.xFormatter?i.xFormatter:null,gridlines:!1!==i.gridlines},$}_layoutScatterVertical(t){const e=this.w,i=t.scatter||{},a=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(i,r),c=r.map(t=>Array.isArray(t)?t.map(o):[]),h=t=>null!=t&&isFinite(t),u=c.map((t,e)=>e).filter(t=>c[t].some(h)),d=Math.max(1,u.length);let p=1/0,m=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(t<p&&(p=t),t>m&&(m=t))})),p===1/0&&(p=0,m=1);const f=Math.max(2,Math.round(i.tickAmount>0?i.tickAmount:5)),x=this._scatterValueDomain(i,p,m,f),g=x.min,y=x.max,b=y-g||1,M=46+(i.xTitle?18:0),_=a-10,A=s-(d>1?26:10),w=Math.max(4,_-M),S=Math.max(4,A-10),R=t=>A-(t-g)/b*S,k=w/d;let v=0;const F=this._fixedRadius(t);if(F)v=F;else{const t=Math.max(1,...u.map(t=>c[t].filter(h).length));v=Math.max(2,Math.min(6,.12*k,S/(2.5*Math.sqrt(t))))}this._lastDotR=v;const E=t.spacing>0?t.spacing:1,C=Math.max(.5,v*E),T="jitter"===i.spread,D=[],L=[],$=l?l.rMax:v;u.forEach((t,e)=>{const i=(t=>M+k*(t+.5))(e);L.push({i:t,cx:i,name:n[t]||`series-${t+1}`});const a=(r[t]||[]).map((t,e)=>{const a=o(t),s={j:e,py:R(h(a)?a:g),x:i};return l&&(s.r=this._scatterRadius(t,l,v)),s});if(T){const t=Math.max($,k/2-$);a.forEach((e,a)=>{const s=(9301*a+49297)%233280/233280;e.x=i+(2*s-1)*t})}else this._beeswarm(a,i,v,C,$,!0);D.push({i:t,cx:i,cy:(10+A)/2,outerR:k/2,dots:a.map(t=>({x:t.x,y:t.py,r:t.r}))})});const B=x.ticks;return this._scatterAxis={mode:"1d",orientation:"vertical",plotL:M,plotR:_,plotT:10,plotB:A,vMin:g,vMax:y,plotY:R,ticks:B,lanes:L,valueTitle:i.xTitle,formatter:"function"==typeof i.xFormatter?i.xFormatter:null,gridlines:!1!==i.gridlines},D}_layoutScatter2D(t){const e=this.w,i=e.layout.gridWidth,a=e.layout.gridHeight,s=t.scatter||{},r=e.seriesData.unitData||[],n=t=>"number"==typeof t&&isFinite(t),o=t=>t&&"object"==typeof t?t.x:null,l=t=>t&&"object"==typeof t?null!=t.y?t.y:t.value:null,c=r.map((t,e)=>e).filter(t=>(r[t]||[]).some(t=>n(o(t))&&n(l(t))));let h=1/0,u=-1/0,d=1/0,p=-1/0;r.forEach(t=>(t||[]).forEach(t=>{const e=o(t),i=l(t);n(e)&&n(i)&&(e<h&&(h=e),e>u&&(u=e),i<d&&(d=i),i>p&&(p=i))})),h===1/0&&(h=0,u=1,d=0,p=1);const m=Math.max(2,Math.round(s.tickAmount>0?s.tickAmount:5)),f=Math.max(2,Math.round(s.yTickAmount>0?s.yTickAmount:5)),x=this._niceScale(null!=s.xMin?s.xMin:h,null!=s.xMax?s.xMax:u,m),g=this._niceScale(null!=s.yMin?s.yMin:d,null!=s.yMax?s.yMax:p,f),y=null!=s.xMin?s.xMin:x.min,b=null!=s.xMax?s.xMax:x.max,M=null!=s.yMin?s.yMin:g.min,_=null!=s.yMax?s.yMax:g.max,A=b-y||1,w=_-M||1,S=46+(s.yTitle?18:0),R=30+(s.xTitle?20:0),k=S,v=i-12,F=a-R,E=Math.max(4,v-k),C=Math.max(4,F-10),T=t=>k+(t-y)/A*E,D=t=>F-(t-M)/w*C,L=this._scatterSizeStats(s,r),$=this._fixedRadius(t)||5;this._lastDotR=$;const B=[];c.forEach(t=>{const e=(r[t]||[]).map(t=>{const e=o(t),i=l(t);return{x:T(n(e)?e:y),y:D(n(i)?i:M),r:L?this._scatterRadius(t,L,$):void 0}});B.push({i:t,cx:(k+v)/2,cy:(10+F)/2,outerR:C/2,dots:e})});const z=(t,e,i,a,s,r)=>{const n=[];if(s)for(let e=0;e<r;e++)n.push(t+i*e/(r-1));else{const s=a||i/Math.max(1,r-1);for(let i=t;i<=e+.5*s;i+=s)n.push(Math.abs(i)<1e-9*s?0:i)}return n};return this._scatterAxis={mode:"2d",plotL:k,plotR:v,plotT:10,plotB:F,plotX:T,plotY:D,xTicks:z(y,b,A,x.spacing,null!=s.xMin||null!=s.xMax,m),yTicks:z(M,_,w,g.spacing,null!=s.yMin||null!=s.yMax,f),xTitle:s.xTitle,yTitle:s.yTitle,xFormatter:"function"==typeof s.xFormatter?s.xFormatter:null,yFormatter:"function"==typeof s.yFormatter?s.yFormatter:null,gridlines:!1!==s.gridlines},B}_scatterSizeStats(t,e){const i=t&&t.sizeRange;if(!Array.isArray(i)||i.length<2)return null;const a=Math.max(.5,+i[0]),s=Math.max(a,+i[1]),r=t.sizeField||"z";let n=1/0,o=-1/0;return e.forEach(t=>(t||[]).forEach(t=>{const e=t&&"object"==typeof t?t[r]:null;"number"==typeof e&&isFinite(e)&&(e<n&&(n=e),e>o&&(o=e))})),n===1/0?null:{zmin:n,zmax:o,rMin:a,rMax:s,field:r}}_scatterRadius(t,e,i){if(!e)return i;const a=t&&"object"==typeof t?t[e.field]:null;if("number"!=typeof a||!isFinite(a))return e.rMin;const s=e.zmax>e.zmin?(a-e.zmin)/(e.zmax-e.zmin):1,r=Math.max(0,Math.min(1,s)),n=e.rMin*e.rMin,o=e.rMax*e.rMax;return Math.sqrt(n+r*(o-n))}_beeswarm(t,e,i,a,s,r=!1){const n=r?"py":"px",o=r?"x":"y",l=t.slice().sort((t,e)=>t[n]-e[n]),c=[],h=null!=s?s:i;l.forEach(t=>{const s=null!=t.r?t.r:i;let r=0;for(let i=0;i<2e3;i++){const o=0===i?0:Math.ceil(i/2)*a*(i%2?1:-1),l=e+o;let u=!0;for(let e=c.length-1;e>=0;e--){const i=c[e],a=t[n]-i.f;if(a>s+h)break;const r=s+i.r,o=l-i.s;if(a*a+o*o<r*r){u=!1;break}}if(u){r=o;break}}t[o]=e+r,c.push({f:t[n],s:t[o],r:s})})}_scatterValueDomain(t,e,i,a){const s=(t,e,i)=>{const a=[];for(let s=t;s<=e+.5*i;s+=i)a.push(Math.abs(s)<1e-9*i?0:s);return a};if(null!=t.xMin||null!=t.xMax){let r=null!=t.xMin?t.xMin:e,n=null!=t.xMax?t.xMax:i;n>r||(n=r+1);const o=(n-r)/Math.max(1,a-1);return e<r&&(r-=Math.ceil((r-e)/o)*o),i>n&&(n+=Math.ceil((i-n)/o)*o),{min:r,max:n,ticks:s(r,n,o)}}const r=this._niceScale(e,i,a),n=r.spacing||(r.max-r.min)/Math.max(1,a-1);return{min:r.min,max:r.max,ticks:s(r.min,r.max,n)}}_niceScale(t,e,i){const a=t;let s=e;s>a||(s=a+1);const r=this._niceNum(s-a,!1),n=this._niceNum(r/Math.max(1,i-1),!0);return{min:Math.floor(a/n)*n,max:Math.ceil(s/n)*n,spacing:n}}_niceNum(t,e){const i=t>0?t:1,a=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,a);let r;return r=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,r*Math.pow(10,a)}_drawScatterAxes(t,e){const i=this.w;if(!S.isBrowser())return;const a=this._scatterAxis;if(!a)return;const s="http://www.w3.org/2000/svg",r=e.group({class:"apexcharts-unit-axis"}),n=i.config.grid&&i.config.grid.borderColor||"rgba(128,128,128,0.18)",o="rgba(128,128,128,0.5)",l=i.config.xaxis&&i.config.xaxis.labels&&i.config.xaxis.labels.style&&i.config.xaxis.labels.style.colors,c=Array.isArray(l)?l[0]:l,h=c||"rgba(120,130,140,0.9)",u=(t,e,i,a,n)=>{const o=R.createElementNS(s,"line");o.setAttribute("x1",String(t)),o.setAttribute("y1",String(e)),o.setAttribute("x2",String(i)),o.setAttribute("y2",String(a)),o.setAttribute("stroke",n),o.setAttribute("shape-rendering","crispEdges"),r.node.appendChild(o)},d=(t,e,a,n,o,l,c,h)=>{const u=R.createElementNS(s,"text");u.setAttribute("class",h),u.setAttribute("x",String(e)),u.setAttribute("y",String(a)),u.setAttribute("text-anchor",n),u.setAttribute("dominant-baseline","middle"),u.setAttribute("font-size",`${l}px`),u.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),u.setAttribute("font-weight",String(c)),u.setAttribute("fill",o),u.textContent=t,r.node.appendChild(u)};if("2d"!==a.mode){if("vertical"===a.orientation){if(a.ticks.forEach(t=>{const e=a.plotY(t);a.gridlines&&u(a.plotL,e,a.plotR,e,n);const i=a.formatter?String(a.formatter(t)):this._formatTick(t);d(i,a.plotL-8,e,"end",h,11,400,"apexcharts-unit-tick")}),u(a.plotL,a.plotT,a.plotL,a.plotB,o),a.valueTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(a.plotT+a.plotB)/2;t.setAttribute("x",String(e)),t.setAttribute("y",String(n)),t.setAttribute("text-anchor","middle"),t.setAttribute("font-size","12px"),t.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",h),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(a.valueTitle),r.node.appendChild(t)}return a.lanes.forEach(t=>{const e=c||i.globals.colors[t.i]||i.globals.colors[0]||"#008FFB";d(t.name,t.cx,a.plotB+16,"middle",e,12,600,"apexcharts-unit-lane-label")}),void t.add(r)}a.ticks.forEach((t,e)=>{const i=a.plotX(t);a.gridlines&&u(i,a.plotT,i,a.plotB,n);const s=a.formatter?String(a.formatter(t)):this._formatTick(t),r=0===e?"start":e===a.ticks.length-1?"end":"middle";d(s,i,a.plotB+14,r,h,11,400,"apexcharts-unit-tick")}),u(a.plotL,a.plotB,a.plotR,a.plotB,o),a.xTitle&&d(String(a.xTitle),(a.plotL+a.plotR)/2,a.plotB+32,"middle",h,12,600,"apexcharts-unit-axis-title"),a.plotL>12&&a.lanes.forEach(t=>{const e=c||i.globals.colors[t.i]||i.globals.colors[0]||"#008FFB";d(t.name,a.plotL-8,t.cy,"end",e,12,600,"apexcharts-unit-lane-label")}),t.add(r)}else{if(a.yTicks.forEach(t=>{const e=a.plotY(t);a.gridlines&&u(a.plotL,e,a.plotR,e,n);const i=a.yFormatter?String(a.yFormatter(t)):this._formatTick(t);d(i,a.plotL-8,e,"end",h,11,400,"apexcharts-unit-tick")}),a.xTicks.forEach(t=>{const e=a.plotX(t);a.gridlines&&u(e,a.plotT,e,a.plotB,n);const i=a.xFormatter?String(a.xFormatter(t)):this._formatTick(t);d(i,e,a.plotB+14,"middle",h,11,400,"apexcharts-unit-tick")}),u(a.plotL,a.plotB,a.plotR,a.plotB,o),u(a.plotL,a.plotT,a.plotL,a.plotB,o),a.xTitle&&d(String(a.xTitle),(a.plotL+a.plotR)/2,a.plotB+32,"middle",h,12,600,"apexcharts-unit-axis-title"),a.yTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(a.plotT+a.plotB)/2;t.setAttribute("x",String(e)),t.setAttribute("y",String(n)),t.setAttribute("text-anchor","middle"),t.setAttribute("font-size","12px"),t.setAttribute("font-family",i.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",h),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(a.yTitle),r.node.appendChild(t)}t.add(r)}}_formatTick(t){if(!isFinite(t))return"";const e=Math.abs(t);return e>=1e6?+(t/1e6).toFixed(1)+"M":e>=1e4?+(t/1e3).toFixed(1)+"k":Number.isInteger(t)?String(t):String(+t.toFixed(2))}_largestRemainder(t,e){const i=t.reduce((t,e)=>t+e,0);if(i<=0||e<=0)return t.map(()=>0);const a=t.map(t=>t/i*e),s=a.map(t=>Math.floor(t)),r=s.reduce((t,e)=>t+e,0),n=Math.max(0,e-r),o=a.map((t,e)=>({i:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac),l=s.slice();for(let t=0;t<n&&t<o.length;t++)l[o[t].i]++;return l}_spiral(t,e,i,a,s){const r=[];for(let n=0;n<i;n++){const i=s+n,o=a*Math.sqrt(i+.5),l=i*F;r.push({x:t+o*Math.cos(l),y:e+o*Math.sin(l)})}return r}_fixedRadius(t){return"image"===t.shape&&t.image?Math.max(t.image.width||20,t.image.height||20)/2:this._bubbleActive(t)&&"number"==typeof t.sizeByValue.maxRadius?t.sizeByValue.maxRadius>0?t.sizeByValue.maxRadius:null:"number"==typeof t.size&&t.size>0?t.size:null}_bubbleActive(t){const e=t.sizeByValue;return!(!e||!e.enabled||"image"===t.shape||"square"===t.shape)}_unitValueOf(t){if("number"==typeof t)return t;if(t&&"object"==typeof t){const e=null!=t.value?t.value:t.y;return"number"==typeof e?e:null}return null}_radiusForValue(t,e){if(null==t||!isFinite(t))return e.minR;const i=e.max>e.min?(t-e.min)/(e.max-e.min):1,a=Math.max(0,Math.min(1,i));if("linear"===e.scale)return e.minR+a*(e.maxR-e.minR);const s=e.minR*e.minR,r=e.maxR*e.maxR;return Math.sqrt(s+a*(r-s))}_bubbleStats(t,e,i){if(!this._bubbleActive(e))return null;let a=1/0,s=-1/0;if(t.forEach(t=>{t&&t.forEach(t=>{const e=this._unitValueOf(t);null!=e&&isFinite(e)&&(e<a&&(a=e),e>s&&(s=e))})}),a===1/0||s<a)return null;const r=e.sizeByValue,n=i,o=Math.max(1,Math.min(n,"number"==typeof r.minRadius?r.minRadius:.35*n));return{min:a,max:s,minR:o,maxR:n,scale:"linear"===r.scale?"linear":"area"}}_resolveStep(t,e,i){const a=t.spacing>0?t.spacing:1,s=this._fixedRadius(t);return s?2*s*a:e/(Math.sqrt(Math.max(1,i))+.5)}_dotRadiusFromStep(t,e){const i=e.spacing>0?e.spacing:1,a=this._fixedRadius(e);return a||Math.max(1,t/(2*i))}_isCorner(t){return"square"===t.shape||"image"===t.shape}_halfExtent(t,e){if("image"===t.shape&&t.image)return{hx:(t.image.width||20)/2,hy:(t.image.height||20)/2};const i=null!=e?e:this._lastDotR;return{hx:i,hy:i}}_place(t,e,i,a){const s=e;2===s.pk?t.setAttribute("transform","translate("+(i-s.ox)+","+(a-s.oy)+s.tail):1===s.pk?(t.setAttribute("x",String(i-s.hx)),t.setAttribute("y",String(a-s.hy))):(t.setAttribute("cx",String(i)),t.setAttribute("cy",String(a)))}_baseSpec(t,e){const i=null!=e?e:this._lastDotR;if(!this._isCorner(t))return{pk:0,r:i};const{hx:a,hy:s}=this._halfExtent(t,i);return{pk:1,hx:a,hy:s,r:i}}_resolveMark(t){if(null==t)return null;if("object"==typeof t)return _(t);if("string"!=typeof t||!t)return null;const e=t.trim();if("M"===e[0]||"m"===e[0])return _(e);const i=A(e);return i||(this._markWarned||(this._markWarned=new Set),this._markWarned.has(e)||(this._markWarned.add(e),console.warn(`[ApexCharts] unit chart: no mark named "${e}" is registered. Register one with ApexCharts.registerUnitMark("${e}", pathData), or import a catalog from 'apexcharts/pictograms'.`)),null)}_glyphSpec(t,e,i){const a=Math.round(10*e)/10,s=t.name+"|"+t.path.length+"|"+a,r=this._specCache.get(s);if(r)return r;const n=t.viewBox||[0,0,100,100],o=2*a*(1-Math.max(0,Math.min(.9,i.padding||0)))*("number"==typeof i.scale&&i.scale>0?i.scale:1),l="width"===i.fit?o/n[2]:"height"===i.fit?o/n[3]:o/Math.max(n[2],n[3]),c=Object.freeze({pk:2,mark:t,d:t.path,fillRule:t.fillRule,s:l,ox:(n[0]+n[2]/2)*l,oy:(n[1]+n[3]/2)*l,tail:") scale("+l+")",r:a});return this._specCache.set(s,c),c}_markSpecFor(t,e,i,a){if("pictogram"!==t.shape)return this._baseSpec(t,a);const s=t.pictogram||{},r=e&&"object"==typeof e?e.mark:void 0,n=Array.isArray(s.mark)?s.mark[i%s.mark.length]:s.mark,o=this._resolveMark(null!=r?r:n);return o?this._glyphSpec(o,a,s):this._baseSpec(c(l({},t),{shape:"square"===s.fallback?"square":"circle"}),a)}_drawDot(t,e,i,a,s,r,n){const o=this.w,l=o.config.stroke.show?o.config.stroke.width:0,c=Array.isArray(o.globals.stroke.colors)&&o.globals.stroke.colors[s]||"none",h="number"==typeof o.config.fill.opacity?o.config.fill.opacity:1;let u;if(n&&2===n.pk)u=o.dom.Paper.path(n.d),u.node.setAttribute("fill",a),"evenodd"===n.fillRule&&u.node.setAttribute("fill-rule","evenodd"),h<1&&u.node.setAttribute("fill-opacity",String(h)),u.node.setAttribute("data:r",String(n.r));else if("image"===e.shape&&e.image&&e.image.src){const t=e.image.width||20,i=e.image.height||20;u=o.dom.Paper.image(e.image.src),u.node.setAttribute("width",String(t)),u.node.setAttribute("height",String(i)),u.node.setAttribute("preserveAspectRatio","xMidYMid meet"),e.image.tint&&u.node.setAttribute("filter",`url(#${this._tintFilter(a)})`)}else if("square"===e.shape){const s=2*i;u=t.drawRect(0,0,s,s,e.borderRadius||0,a,1,l,c),u.node.setAttribute("fill",a),h<1&&u.node.setAttribute("fill-opacity",String(h))}else u=t.drawCircle(i,{fill:a,"stroke-width":l,stroke:c}),u.node.setAttribute("fill",a),h<1&&u.node.setAttribute("fill-opacity",String(h));return u.node.classList.add("apexcharts-unit-area"),u.node.setAttribute("i",String(s)),u.node.setAttribute("j",String(r)),u}_tintFilter(t){const e=this.w,i="http://www.w3.org/2000/svg",a=String(t).replace(/[^a-zA-Z0-9]/g,""),s=`apexcharts-unit-tint-${e.globals.chartID}-${a}`,r=e.dom.Paper.node;if(r.querySelector(`#${s}`))return s;let n=r.querySelector("defs");n||(n=R.createElementNS(i,"defs"),r.insertBefore(n,r.firstChild));const o=R.createElementNS(i,"filter");o.setAttribute("id",s),o.setAttribute("x","0%"),o.setAttribute("y","0%"),o.setAttribute("width","100%"),o.setAttribute("height","100%");const l=R.createElementNS(i,"feFlood");l.setAttribute("flood-color",t),l.setAttribute("result","flood");const c=R.createElementNS(i,"feComposite");return c.setAttribute("in","flood"),c.setAttribute("in2","SourceAlpha"),c.setAttribute("operator","in"),o.appendChild(l),o.appendChild(c),n.appendChild(o),s}_placeDot(t,e,i,a,s){this._place(t,s||this._baseSpec(e),i,a)}_rgb(t){if("string"!=typeof t)return null;let e=t.trim();if("#"===e[0]){4===e.length&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(1,7),16);return isNaN(t)?null:[t>>16&255,t>>8&255,255&t]}const i=e.match(/rgba?\(([^)]+)\)/);if(i){const t=i[1].split(",").map(t=>parseFloat(t));if(t.length>=3&&t.every(t=>!isNaN(t)))return[t[0],t[1],t[2]]}return null}_shouldAnimate(){const t=this.w,e=t.config.chart.animations;return!!S.isBrowser()&&(!(!e||!1===e.enabled)&&(!1!==t.globals.shouldAnimate&&(!(t.globals.resized&&!t.globals.dataChanged)&&(!e.respectReducedMotion||!v()))))}_seedSprings(t,e,i){const[a,s]=T(e.spring,i),r=this.ctx?this.ctx._unitSprings:null,n=new Map;for(let e=0;e<t.length;e++){const i=t[e],o=r&&!i.isEnter&&null!=i.key?r.get(i.key):null,l=o?o.x:d(i.cx0,a,s),c=o?o.y:d(i.cy0,a,s);o&&(l.stiffness=a,c.stiffness=a,l.damping=s,c.damping=s,i.cx0=l.value,i.cy0=c.value,this._place(i.node,i.spec,i.cx0,i.cy0),0===l.velocity&&0===c.velocity||(i.delay=0)),i.sx=l,i.sy=c,null!=i.key&&n.set(i.key,{x:l,y:c})}this.ctx&&(this.ctx._unitSprings=n)}_runGather(t){const e=this.w,i=e.config.plotOptions.unit,a=Math.max(1,e.config.chart.animations.speed||800),s=Math.min(.6*a,450),r=t.length;for(let e=0;e<r;e++)t[e].delay=r>1?e/(r-1)*s:0;const n=i.gather||{},o=n.motion||"auto";"spring"===o||"auto"===o&&(!n.easing||"outCubic"===n.easing)?this._seedSprings(t,n,a):this.ctx&&(this.ctx._unitSprings=null);for(let e=0;e<r;e++){const i=t[e];0===i.spec.pk&&null!=i.r0&&null!=i.r1&&i.r0!==i.r1&&i.node.setAttribute("r",String(i.r0))}for(let e=0;e<r;e++){const i=t[e];i.fill0&&i.fill1&&i.fill0!==i.fill1&&(i._c0=this._rgb(i.fill0),i._c1=this._rgb(i.fill1))}const l="outBack"===n.easing?(c="number"==typeof n.overshoot?n.overshoot:1.70158,t=>1+(c+1)*Math.pow(t-1,3)+c*Math.pow(t-1,2)):"inOutCubic"===n.easing?C:E;var c;null!=this.w.globals.unitGatherRAF&&(R.cancelAnimationFrame(this.w.globals.unitGatherRAF),this.w.globals.unitGatherRAF=null);const h=performance.now();let u=h;const d=e=>{if(this.w.globals.isDestroyed)return this.w.globals.unitGatherRAF=null,void(this.w.globals.animationEnded=!0);const i=Math.min(.25,Math.max(0,(e-u)/1e3));u=e;let s=!0;for(let n=0;n<r;n++){const r=t[n],o=e-h-r.delay,c=Math.max(0,Math.min(1,o/a)),u=E(c);let d,f;if(r.sx&&r.sy){o>=0&&!r.released&&(m(r.sx,r.x),m(r.sy,r.y),r.released=!0);const t=p(r.sx,i),e=p(r.sy,i);r.released&&t&&e||(s=!1),d=r.sx.value,f=r.sy.value}else{const t=l(c);d=r.cx0+(r.x-r.cx0)*t,f=r.cy0+(r.y-r.cy0)*t}if(this._place(r.node,r.spec,d,f),r.isEnter&&(r.node.style.opacity=String(Math.min(1,2.5*c))),r._c0&&r._c1){const t=Math.round(r._c0[0]+(r._c1[0]-r._c0[0])*u),e=Math.round(r._c0[1]+(r._c1[1]-r._c0[1])*u),i=Math.round(r._c0[2]+(r._c1[2]-r._c0[2])*u);r.node.setAttribute("fill",`rgb(${t},${e},${i})`)}0===r.spec.pk&&null!=r.r0&&null!=r.r1&&r.r0!==r.r1&&r.node.setAttribute("r",String(r.r0+(r.r1-r.r0)*u)),c<1&&(s=!1)}if(s){for(let e=0;e<r;e++){const i=t[e];i.node.style.opacity="",i._c1&&i.fill1&&i.node.setAttribute("fill",i.fill1),0===i.spec.pk&&null!=i.r0&&null!=i.r1&&i.r0!==i.r1&&i.node.setAttribute("r",String(i.r1))}this.w.globals.unitGatherRAF=null,this.w.globals.animationEnded=!0}else this.w.globals.unitGatherRAF=R.requestAnimationFrame(d)};this.w.globals.unitGatherRAF=R.requestAnimationFrame(d)}_collectExits(t,e,i){const a=Math.max(0,i.maxUnits||5e3),s=[];for(const[i,r]of t)if(!e.has(i)&&(s.push(r),s.length>=a))break;return s}_runExits(t,e,i){const a=this.w,s=new g(a,this.ctx),r=this._lastDotR,n=a.layout.gridWidth/2,o=a.layout.gridHeight/2,l="grid"===i.layout||"scatter"===i.layout||"arc"===i.layout||"custom"===i.layout?0:.35,c=[];if(e.forEach(e=>{const a=null!=e.r?e.r:r,n=e.spec||this._baseSpec(i,a),o=this._drawDot(s,i,a,e.fill,0,0,n);o.node.classList.add("apexcharts-unit-exit"),this._place(o.node,n,e.x,e.y),t.add(o),c.push({node:o.node,x0:e.x,y0:e.y,spec:n})}),!this._shouldAnimate())return void c.forEach(t=>t.node.remove());const h=Math.max(1,a.config.chart.animations.speed||800);null!=this.w.globals.unitExitRAF&&(R.cancelAnimationFrame(this.w.globals.unitExitRAF),this.w.globals.unitExitRAF=null);const u=performance.now(),d=e=>{if(this.w.globals.isDestroyed)return void(this.w.globals.unitExitRAF=null);const i=Math.max(0,Math.min(1,(e-u)/h)),a=E(i);for(let t=0;t<c.length;t++){const e=c[t];if(l){const t=e.x0+(n-e.x0)*a*l,i=e.y0+(o-e.y0)*a*l;this._place(e.node,e.spec,t,i)}e.node.style.opacity=String(1-a)}i<1?this.w.globals.unitExitRAF=R.requestAnimationFrame(d):(this.w.globals.unitExitRAF=null,t.node&&t.node.remove())};this.w.globals.unitExitRAF=R.requestAnimationFrame(d)}_outerLabelsOn(t){const e=t.clusterLabels;return!!("custom"===t.layout&&e&&!1!==e.show&&e.external&&e.external.show)}_outerLabelLines(t,e,i,a){const s=this.w,r=s.seriesData.seriesNames[t]||`series-${t+1}`,n=i>0?e/i*100:0,o=a.clusterLabels,l="function"==typeof o.formatter?o.formatter(r,{seriesIndex:t,value:e,percent:n,w:s}):`${r}\n${n.toFixed(1)}%`;return String(l).split("\n")}_outerLabelGutter(t,e){const i=this.w,a=e.clusterLabels,s=a.external.connector||{},r=t.reduce((t,e)=>t+e,0),n=[];if(t.forEach((t,i)=>{t>0&&n.push(...this._outerLabelLines(i,t,r,e))}),!n.length)return 0;const o=function(t,e,i={}){const a=new g(t),s=i.fontSize||"12px",r=parseFloat(s)||12;let n=0;return e.forEach(t=>{if(null==t||""===t)return;const e=`${t}`,o=a.getTextRects(e,s,i.fontFamily,"").width;n=Math.max(n,o>0?o:e.length*r*.58)}),n}(i,n,{fontSize:a.fontSize,fontFamily:a.fontFamily||i.config.chart.fontFamily}),l=o+(null!=s.gap?s.gap:8)+(null!=s.length?s.length:22)+8+Math.abs(parseFloat(a.external.offsetX)||0);return Math.min(l,.25*i.layout.gridWidth)}_drawOuterLabels(t,e,i,a,s,r){const n=this.w;if(!S.isBrowser())return;const o=s.clusterLabels,l=o.external,c=l.connector||{},h=null!=c.gap?c.gap:8,u=null!=c.length?c.length:22,d=parseFloat(l.offsetX)||0,p=parseFloat(l.offsetY)||0,m=n.layout.gridWidth,f=n.layout.gridHeight,x=this._lastDotR,y=e.filter(t=>t.dots.length>0);if(!y.length)return;let b=0,M=0;if(y.length>1){const t=y.map(t=>t.cx),e=y.map(t=>t.cy);b=Math.max(...t)-Math.min(...t),M=Math.max(...e)-Math.min(...e)}const _=b>M,A=parseFloat(o.fontSize)||13,w=Math.round(1.35*A),R=[];if(y.slice().sort((t,e)=>t.cy-e.cy).forEach((t,e)=>{const r=this._outerLabelLines(t.i,i[t.i],a,s);if(!r.some(t=>""!==t))return;const n=_?t.cx>=m/2?"right":"left":e%2==0?"right":"left",o="right"===n?1:-1;let l=t.dots[0],c=-1/0;t.dots.forEach(e=>{const i=o*e.x-.75*Math.abs(e.y-t.cy);i>c&&(c=i,l=e)});const f={x:l.x+o*(l.r||x),y:l.y},g={x:f.x+o*h,y:f.y};R.push({i:t.i,lines:r,anchor:f,elbow:g,labelX:g.x+o*u+d,idealY:f.y+p,labelY:f.y+p,side:n})}),!R.length)return;const k=R.reduce((t,e)=>Math.max(t,e.lines.length),1)*w,v=k/2;["left","right"].forEach(t=>{!function(t,e,i,a){const s=t.slice().sort((t,e)=>t.idealY-e.idealY);s.forEach(t=>{t.labelY=t.idealY});for(let t=1;t<s.length;t++)s[t].labelY-s[t-1].labelY<e&&(s[t].labelY=s[t-1].labelY+e);const r=s[s.length-1],n=r?r.labelY-i:0;if(n>0)for(let t=s.length-1;t>=0;t--)s[t].labelY-=n,t<s.length-1&&s[t+1].labelY-s[t].labelY<e&&(s[t].labelY=s[t+1].labelY-e);if(null!=a&&s.length&&s[0].labelY<a){const t=a-s[0].labelY;for(let e=0;e<s.length;e++)s[e].labelY+=t}}(R.filter(e=>e.side===t),k+2,f-v,v)});const F=new g(n,this.ctx).group({class:"apexcharts-unit-outer-labels"});if(r){const t=Math.max(1,n.config.chart.animations.speed||800);F.node.classList.add("apexcharts-unit-label-delay"),F.node.style.animationDelay=Math.min(.45*t,600)/1e3+"s"}R.forEach(t=>{const e=n.globals.colors[t.i]||n.globals.colors[0]||"#008FFB";F.add(function(t,e){const{lines:i,lineHeight:a,anchor:s,elbow:r,labelX:n,labelY:o,side:l,connector:c,style:h,foreColor:u}=e,d=new g(t),p=d.group({class:e.groupClass||"apexcharts-outer-label-group"});if(c.show){const t=`M ${s.x} ${s.y} L ${r.x} ${r.y} L ${n} ${o}`,i=d.drawPath({d:t,stroke:c.color,strokeWidth:c.width,fill:"none",strokeLinecap:"round"});i.node.classList.add(e.connectorClass||"apexcharts-outer-label-connector"),p.add(i)}const m="right"===l?n+4:n-4,f=i.length,x=o-(f-1)*a/2,y=d.drawText({x:m,y:x,text:1===f?i[0]:i,textAnchor:"right"===l?"start":"end",fontSize:h.fontSize,fontFamily:h.fontFamily,fontWeight:h.fontWeight,foreColor:u,dominantBaseline:"central",cssClass:e.textClass||"apexcharts-outer-label"});if(f>1){const t=y.node.getElementsByTagName("tspan");for(let e=0;e<t.length;e++)t[e].setAttribute("x",`${m}`),t[e].setAttribute("dy",0===e?"0":`${a}`)}return p.add(y),p}(n,{lines:t.lines,lineHeight:w,anchor:t.anchor,elbow:t.elbow,labelX:t.labelX,labelY:t.labelY,side:t.side,connector:{show:!1!==c.show,width:null!=c.width?c.width:1.5,color:c.color||e},style:{fontSize:o.fontSize,fontFamily:o.fontFamily||n.config.chart.fontFamily,fontWeight:o.fontWeight},foreColor:o.color||n.config.chart.foreColor,groupClass:"apexcharts-unit-outer-label-group",textClass:"apexcharts-unit-outer-label",connectorClass:"apexcharts-unit-label-connector"}))}),t.add(F)}_drawClusterLabel(t,e,i,a,s,r){const n=this.w;if(!S.isBrowser())return;const o="http://www.w3.org/2000/svg",l=n.seriesData.seriesNames[e.i]||`series-${e.i+1}`,c=a>0?i/a*100:0,h=s.clusterLabels,u=parseFloat(h.fontSize)||13;let d;d="function"==typeof h.formatter?h.formatter(l,{seriesIndex:e.i,value:i,percent:c,w:n}):`${l} (${c.toFixed(1)}%)`;const p="string"==typeof d?d:String(d),m=R.createElementNS(o,"text");m.setAttribute("class","apexcharts-unit-label"),m.setAttribute("text-anchor","middle"),m.setAttribute("font-size",`${u}px`),m.setAttribute("font-family",h.fontFamily||n.config.chart.fontFamily||"inherit"),m.setAttribute("font-weight",String(h.fontWeight||600)),m.setAttribute("fill",h.color||r);const f="bottom"===h.position,x=e.outerR+.6*u+3+(h.offsetY||0),g=p.length*u*.55;if(!f&&!e.flat&&!1!==h.curved&&g<=Math.PI*x*.95){const i=e.cy,a=`M ${e.cx-x} ${i} A ${x} ${x} 0 0 1 ${e.cx+x} ${i}`,s=`apexcharts-unit-label-${n.globals.chartID}-${e.i}`,r=R.createElementNS(o,"path");r.setAttribute("id",s),r.setAttribute("d",a),r.setAttribute("fill","none"),r.setAttribute("stroke","none");const l=R.createElementNS(o,"textPath");l.setAttribute("href",`#${s}`),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`#${s}`),l.setAttribute("startOffset","50%"),l.textContent=p,m.appendChild(l),t.node.appendChild(r)}else{m.setAttribute("x",String(e.cx));const t=f?e.cy+e.outerR+u+6+(h.offsetY||0):e.cy-e.outerR-6-(h.offsetY||0);m.setAttribute("y",String(t)),m.textContent=p}t.node.appendChild(m)}}}),t.default=h,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});