/*! * ApexCharts v8.1.0 * (c) 2018-2026 ApexCharts */ !function(t){var e="undefined"!=typeof globalThis?globalThis:self,a=e.ApexCharts;if(a&&a.__internals)return t.call(e);if(a)throw new Error("ApexCharts: dist/unit.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");if("function"==typeof define&&define.amd)return t.call(e);if("object"==typeof exports&&"undefined"!=typeof module||"undefined"==typeof window||"undefined"==typeof document)throw new Error("ApexCharts: dist/unit.js is a script-tag add-on and needs the ApexCharts script on the page. A bundler imports the matching apexcharts/ sub-path instead.");var i={file:"dist/unit.js",run:t,done:!1},s=e.__apexcharts_pending_addons__||(e.__apexcharts_pending_addons__=[]);s.push(i),"complete"!==document.readyState&&window.addEventListener("load",function(){if(!i.done){var a=e.ApexCharts;if(a)if(a.__internals){i.done=!0;var r=s.indexOf(i);-1!==r&&s.splice(r,1);try{t.call(e),a.__drainsAddons||e.console.warn("ApexCharts: dist/unit.js loaded before the ApexCharts script, which is older than 8.0 and does not pick up add-ons loaded first, so it registered only when the page finished loading. Put its tag after the ApexCharts script.")}catch(t){e.console.error("ApexCharts: dist/unit.js could not register with the ApexCharts script on this page: "+(t&&t.message))}}else e.console.error("ApexCharts: dist/unit.js cannot register: the ApexCharts on this page has no add-on surface (a script before 7.0, or a bundled apexcharts/core class). Load apexcharts.min.js, apexcharts.core.min.js or apexcharts.full.min.js.");else e.console.warn("ApexCharts: dist/unit.js is waiting for the ApexCharts script, which had not loaded when the page finished loading. It registers when an ApexCharts 8.0 or later script loads; if the page has none, add apexcharts.min.js (or apexcharts.core.min.js, or apexcharts.full.min.js).")}})}(function(){var t,e;t=this,e=function(t){"use strict";var e=Object.defineProperty,a=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,o=(t,a,i)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i,l=(t,e)=>{for(var a in e||(e={}))r.call(e,a)&&o(t,a,e[a]);if(s)for(var a of s(e))n.call(e,a)&&o(t,a,e[a]);return t},c=(t,e)=>a(t,i(e));const h=globalThis.ApexCharts,u=1/45;function d(t,e,a,i){return{value:t,velocity:0,target:t,stiffness:e,damping:a}}function p(t,e){if(e<=0)return m(t);let a=e;for(;a>0;){const e=Math.min(a,u),i=-t.stiffness*(t.value-t.target)-t.damping*t.velocity;t.velocity+=i*e,t.value+=t.velocity*e,a-=e}return!!m(t)&&(t.value=t.target,t.velocity=0,!0)}function f(t,e){t.target=e}function m(t){var e,a;const i=null!=(e=t.restVelocity)?e:.05,s=null!=(a=t.restDisplacement)?a:.05;return Math.abs(t.velocity)isFinite(t))||a[2]<=0||a[3]<=0?null:Object.freeze(c(l({},t),{name:t.name||"anonymous",path:t.path.trim(),viewBox:a,fillRule:"evenodd"===t.fillRule?"evenodd":void 0}))}function A(t){return t&&globalThis[_][t]||null}globalThis[_]||(globalThis[_]={});const w=globalThis.ApexCharts.__internals.__apex_Utils,S=globalThis.ApexCharts.__internals.__apex_Environment_Environment,R=globalThis.ApexCharts.__internals.__apex_BrowserAPIs_BrowserAPIs,v=globalThis.ApexCharts.__internals;v.__apex_Animations,v.__apex_Animations_computeStagger,v.__apex_Animations_applyAnimationPolicy;const k=v.__apex_Animations_prefersReducedMotion;v.__apex_Animations_applyProgressiveReveal;const F=Math.PI*(3-Math.sqrt(5));function C(t){return 1-Math.pow(1-t,3)}function E(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function T(t,e){const[a,i]=null!=(r=x[null!=(s=t)?s:"crisp"])?r:x.crisp;var s,r;const n=800/Math.max(1,e);return[a*n*n,i*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,a=new g(e,this.ctx),i=a.group({class:"apexcharts-unit"});if(e.globals.noData||!Array.isArray(t)||0===t.length)return i;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(i,a,s),"scatter"===r&&this._drawScatterAxes(i,a);const f=this._lastDotR,m=this._shouldAnimate(),x=this.ctx&&this.ctx.morphTypeChange,y=m&&!!x&&"function"==typeof x.isActive&&x.isActive()&&"function"==typeof x.getInitialCenterFor,b=y&&"function"==typeof x.getInitialSlotFor,_=y&&"function"==typeof x.usesPieceTakeover&&x.usesPieceTakeover(),M=m&&!y&&this.ctx?this.ctx._unitPrevDots:null,A=new Map,S=[],R=e.seriesData.unitData||[],v=this._bubbleStats(R,s,f);let k=0;if(d.forEach(t=>{const n=e.globals.colors[t.i]||e.globals.colors[0]||"#008FFB",c=a.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,i)=>{const r=null!=e.j?e.j:i,h=F?F[r]:void 0,u=h&&"object"==typeof h&&h.fillColor?h.fillColor:n,y=null!=e.r?e.r:v?this._radiusForValue(this._unitValueOf(h),v):f,w=this._markSpecFor(s,h,t.i,y),R=this._drawDot(a,s,y,u,t.i,r,w);let C;if(c.add(R),l){const t=h&&"object"==typeof h?null!=h.id?h.id:h.name:void 0;C=null!=t?`id:${t}`:`g:${k}`}else C=o?String(k):null!=e.slot?`slot:${e.slot}`:`${t.i}:${r}`;if(k++,A.set(C,{x:e.x,y:e.y,fill:u,r:y,spec:w}),_)this._place(R.node,w,e.x,e.y),R.node.setAttribute("opacity","0"),R.node.setAttribute("data-piece-hidden","1");else if(m){const a=M&&M.get(C),i=a||(b?x.getInitialSlotFor(t.i,r,g):d),n=s.gather&&s.gather.enter||"burst",o=p||"fade"===n||"rise"===n,l=i?i.x:o?e.x:t.cx,c=i?i.y:"rise"!==n||p?o?e.y:t.cy:e.y+14;R.node.style.opacity=i?"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:C,r0:a&&null!=a.r?a.r:y,r1:y,fill0:a?a.fill:u,fill1:u,delay:0,isEnter:!i})}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)}i.add(c)}),this._outerLabelsOn(s)&&this._drawOuterLabels(i,d,h,u,s,m&&!M),M){const t=this._collectExits(M,A,s);if(t.length){const e=a.group({class:"apexcharts-unit-exits"});i.add(e),this._runExits(e,t,s)}}return this.ctx&&(this.ctx._unitPrevDots=A),!this.ctx||m&&!y||(this.ctx._unitSprings=null),m&&S.length?this._runGather(S):e.globals.animationEnded=!0,i}_applyMaxUnits(t,e){const a=t.reduce((t,e)=>t+e,0);if(!e||e<=0||a<=e)return t;const i=e/a;return console.warn(`[ApexCharts] unit chart: ${a} 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*i)):0)}_layoutCustom(t,e){const a=this.w,i=a.layout.gridWidth,s=a.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,i-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(a){return console.warn("[ApexCharts] unit chart: the layout provider threw; falling back to 'grouped'.",a),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 f=new Map;p.forEach(t=>{t&&isFinite(t.x)&&isFinite(t.y)&&f.set(String(t.id),{x:t.x,y:t.y,r:"number"==typeof t.r&&t.r>0?t.r:void 0})});const m=t.map((t,e)=>({i:e,cx:i/2,cy:s/2,outerR:u,dots:[]}));return d.forEach(t=>{const e=f.get(t.id);e&&m[t.seriesIndex].dots.push({x:e.x,y:e.y,r:e.r,j:t.dataPointIndex})}),m.forEach(t=>{if(!t.dots.length)return;let e=0,a=0;t.dots.forEach(t=>{e+=t.x,a+=t.y}),t.cx=e/t.dots.length,t.cy=a/t.dots.length;let i=0;t.dots.forEach(e=>{i=Math.max(i,Math.hypot(e.x-t.cx,e.y-t.cy))}),t.outerR=i+u}),m}_layoutObjects(t,e){const a=this.w,i=a.seriesData.unitData||[],s=a.seriesData.seriesNames||[],r=[];let n=0;return t.forEach((t,a)=>{var o;const l=i[a];for(let i=0;ie).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=i/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),f=this._resolveStep(e,p,u);this._lastDotR=this._dotRadiusFromStep(f,e);const m=this._lastDotR,x=r+h/2,g=t.map(t=>f*Math.sqrt(Math.max(1,t))+m);let y=t.map((t,e)=>(t=>l[t]>=0?c*(l[t]+.5):i/2)(e));const b=n.map(t=>g[t]);let _=!1;for(let t=1;tt+2*e,0)+e*(o-1);let s;if(a<=i){let t=(i-a)/2;s=b.map(a=>{const i=t+a;return t+=2*a+e,i})}else if(1===o)s=[i/2];else{const t=b[0],e=i-b[o-1];s=b.map((a,i)=>t+(e-t)*i/(o-1))}y=t.map((t,e)=>l[e]>=0?s[l[e]]:i/2)}return t.map((t,e)=>({i:e,cx:y[e],cy:x,outerR:g[e],dots:this._spiral(y[e],x,t,f,0)}))}_layoutPacked(t,e){const a=this.w,i=a.layout.gridWidth,s=a.layout.gridHeight,r=Math.max(1,t.reduce((t,e)=>t+e,0)),n=Math.max(4,Math.min(i,s-6)/2-.06*Math.min(i,s)),o=this._resolveStep(e,n,r);this._lastDotR=this._dotRadiusFromStep(o,e);const l=i/2,c=6+(s-6)/2,h=t.map((t,e)=>e);!1!==e.sortByGroup&&h.sort((e,a)=>t[e]-t[a]);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 a=0;at+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),f=t=>-Math.cos(t),m=this._arcBounds(c,h),x=.04*Math.min(i,s),g=Math.max(1e-6,m.maxX-m.minX),y=Math.max(1e-6,m.maxY-m.minY),b=Math.max(4,Math.min((i-2*x)/g,(s-2*x)/y)),_=b*d,M=i/2-(m.minX+m.maxX)/2*b,A=s/2-(m.minY+m.maxY)/2*b,w=this._arcAllocate(r,_,b,u,e);this._lastDotR=w.dotR;const S=[];for(let t=0;tt.a-e.a);const R=t.map((t,e)=>({i:e,cx:M,cy:A,outerR:b,dots:[]}));let v=0,k=0;return S.forEach((e,a)=>{for(;v=t[v];)v++,k=0;v>=t.length||(R[v].dots.push({x:e.x,y:e.y,slot:a}),k++)}),R}_arcBounds(t,e){const a=t=>Math.sin(t),i=t=>-Math.cos(t),s=Math.min(t,e),r=Math.max(t,e),n=[0,a(t),a(e)],o=[0,i(t),i(e)],l=Math.PI/2;for(let t=Math.ceil(s/l);t*l<=r;t++)n.push(a(t*l)),o.push(i(t*l));return{minX:Math.min(...n),maxX:Math.max(...n),minY:Math.min(...o),maxY:Math.max(...o)}}_arcAllocate(t,e,a,i,s){const r=s.spacing>0?s.spacing:1.05,n=Math.abs(i)||Math.PI,o=this._fixedRadius(s),l=i=>{i=Math.max(1,Math.round(i));const s=[];for(let t=0;tt+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[i-1]++,h--;const u=1===i?a-e||a:(a-e)/(i-1);let d=1/0;for(let t=0;t=1)h=l(c);else if(o)h=l((a-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 a=this.w,i=a.layout.gridWidth,s=a.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=i/c,d=.62*u,p=Math.max(8,.04*s)+(n?30:0),f=Math.max(4,s-o-p),m=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,_=0;if(y){_=2*y*x,this._lastDotR=y;const t=Math.max(1,Math.floor(f/_)),e=Math.max(1,Math.floor(d/_));b=Math.max(1,Math.min(e,Math.ceil(m/t)))}else{let t=0;const e=Math.max(1,Math.min(40,Math.round(d/4)));for(let a=1;a<=e;a++){const e=Math.ceil(m/a),i=Math.min(d/a,f/e);i>t&&(t=i,b=a)}_=t,this._lastDotR=Math.max(1,_/(2*x))}const M=this._lastDotR,A=Math.ceil(m/b),w=o+(f+Math.min(f,A*_))/2;return t.map((t,e)=>{const a=h[e]>=0?u*(h[e]+.5):i/2,s=Math.ceil(Math.max(1,t)/b)*_,r=a-b*_/2+_/2,n=[];for(let e=0;e0?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,i),p=Math.max(4,s-6),f=this._fixedRadius(e);let m=0;f?(m=2*f*u,this._lastDotR=f):(m=Math.min(d/n,p/h),this._lastDotR=Math.max(1,m/(2*u)));const x=n*m,g=h*m,y=(i-x)/2+m/2,b=6+(p-g)/2,_=t=>"bottom"===o?b+g-m/2-t*m:b+m/2+t*m,M=t.map((t,e)=>({i:e,cx:i/2,cy:6+p/2,outerR:Math.max(x,g)/2,dots:[]}));let A=0;for(let t=0;t0?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)))),f=Math.max(1,Math.ceil(u/p)),m=!(e.clusterLabels&&!1===e.clusterLabels.show),x=m&&e.clusterLabels&&"bottom"===e.clusterLabels.position,g=m&&!x?22:4,y=m&&x?22:4,b=i/p,_=s/f,M=Math.max(4,.86*b),A=Math.max(4,_-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(M/n,A/c),this._lastDotR=Math.max(1,R/(2*w)));const v=n*R,k=c*R,F=(t,e)=>"bottom"===o?t+k-R/2-e*R:t+R/2+e*R,C=[],E=[];return h.forEach((e,a)=>{const i=a%p,s=Math.floor(a/p),r=i*b,o=r+(b-v)/2+R/2,c=s*_+g+(A-k)/2,h=t=>({x:o+t%n*R,y:F(c,Math.floor(t/n))});for(let t=0;t{let i;if("square"===a.shape){const n=2*s;i=e.drawRect(0,0,n,n,a.borderRadius||0,r,1,0,"none"),i.node.setAttribute("fill",r),i.node.setAttribute("x",String(t.x-s)),i.node.setAttribute("y",String(t.y-s))}else i=e.drawCircle(s,{fill:r,"stroke-width":0,stroke:"none"}),i.node.setAttribute("fill",r),i.node.setAttribute("cx",String(t.x)),i.node.setAttribute("cy",String(t.y));i.node.classList.add("apexcharts-unit-track-cell"),n.add(i)}),t.add(n)}_layoutScatter(t){const e=this.w,a=t.scatter||{};if("value"===a.y)return this._layoutScatter2D(t);if("vertical"===a.orientation)return this._layoutScatterVertical(t);const i=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(a,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,f=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(tf&&(f=t))})),p===1/0&&(p=0,f=1);const m=Math.max(2,Math.round(a.tickAmount>0?a.tickAmount:5)),x=this._scatterValueDomain(a,p,f,m),g=x.min,y=x.max,b=y-g||1,_=null!=a.laneLabelWidth?Math.max(0,a.laneLabelWidth):d>1?92:8,M=30+(a.xTitle?20:0),A=_,w=i-8,S=s-M,R=Math.max(4,w-A),v=Math.max(4,S-10),k=t=>A+(t-g)/b*R,F=v/d;let C=0;const E=this._fixedRadius(t);if(E)C=E;else{const t=Math.max(1,...u.map(t=>c[t].filter(h).length));C=Math.max(2,Math.min(6,.12*F,R/(2.5*Math.sqrt(t))))}this._lastDotR=C;const T=t.spacing>0?t.spacing:1,L=Math.max(.5,C*T),D="jitter"===a.spread,$=[],j=[],B=l?l.rMax:C;u.forEach((t,e)=>{const a=(t=>10+F*(t+.5))(e);j.push({i:t,cy:a,name:n[t]||`series-${t+1}`});const i=(r[t]||[]).map((t,e)=>{const i=o(t),s={j:e,px:k(h(i)?i:g),y:a};return l&&(s.r=this._scatterRadius(t,l,C)),s});if(D){const t=Math.max(B,F/2-B);i.forEach((e,i)=>{const s=(9301*i+49297)%233280/233280;e.y=a+(2*s-1)*t})}else this._beeswarm(i,a,C,L,B);$.push({i:t,cx:(A+w)/2,cy:a,outerR:F/2,dots:i.map(t=>({x:t.px,y:t.y,r:t.r}))})});const z=x.ticks;return this._scatterAxis={mode:"1d",plotL:A,plotR:w,plotT:10,plotB:S,xMin:g,xMax:y,plotX:k,ticks:z,lanes:j,xTitle:a.xTitle,formatter:"function"==typeof a.xFormatter?a.xFormatter:null,gridlines:!1!==a.gridlines},$}_layoutScatterVertical(t){const e=this.w,a=t.scatter||{},i=e.layout.gridWidth,s=e.layout.gridHeight,r=e.seriesData.unitData||[],n=e.seriesData.seriesNames||[],o=t=>this._unitValueOf(t),l=this._scatterSizeStats(a,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,f=-1/0;c.forEach(t=>t.forEach(t=>{null!=t&&isFinite(t)&&(tf&&(f=t))})),p===1/0&&(p=0,f=1);const m=Math.max(2,Math.round(a.tickAmount>0?a.tickAmount:5)),x=this._scatterValueDomain(a,p,f,m),g=x.min,y=x.max,b=y-g||1,_=46+(a.xTitle?18:0),M=i-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,v=w/d;let k=0;const F=this._fixedRadius(t);if(F)k=F;else{const t=Math.max(1,...u.map(t=>c[t].filter(h).length));k=Math.max(2,Math.min(6,.12*v,S/(2.5*Math.sqrt(t))))}this._lastDotR=k;const C=t.spacing>0?t.spacing:1,E=Math.max(.5,k*C),T="jitter"===a.spread,L=[],D=[],$=l?l.rMax:k;u.forEach((t,e)=>{const a=(t=>_+v*(t+.5))(e);D.push({i:t,cx:a,name:n[t]||`series-${t+1}`});const i=(r[t]||[]).map((t,e)=>{const i=o(t),s={j:e,py:R(h(i)?i:g),x:a};return l&&(s.r=this._scatterRadius(t,l,k)),s});if(T){const t=Math.max($,v/2-$);i.forEach((e,i)=>{const s=(9301*i+49297)%233280/233280;e.x=a+(2*s-1)*t})}else this._beeswarm(i,a,k,E,$,!0);L.push({i:t,cx:a,cy:(10+A)/2,outerR:v/2,dots:i.map(t=>({x:t.x,y:t.py,r:t.r}))})});const j=x.ticks;return this._scatterAxis={mode:"1d",orientation:"vertical",plotL:_,plotR:M,plotT:10,plotB:A,vMin:g,vMax:y,plotY:R,ticks:j,lanes:D,valueTitle:a.xTitle,formatter:"function"==typeof a.xFormatter?a.xFormatter:null,gridlines:!1!==a.gridlines},L}_layoutScatter2D(t){const e=this.w,a=e.layout.gridWidth,i=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),a=l(t);n(e)&&n(a)&&(eu&&(u=e),ap&&(p=a))})),h===1/0&&(h=0,u=1,d=0,p=1);const f=Math.max(2,Math.round(s.tickAmount>0?s.tickAmount:5)),m=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,f),g=this._niceScale(null!=s.yMin?s.yMin:d,null!=s.yMax?s.yMax:p,m),y=null!=s.xMin?s.xMin:x.min,b=null!=s.xMax?s.xMax:x.max,_=null!=s.yMin?s.yMin:g.min,M=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),v=S,k=a-12,F=i-R,C=Math.max(4,k-v),E=Math.max(4,F-10),T=t=>v+(t-y)/A*C,L=t=>F-(t-_)/w*E,D=this._scatterSizeStats(s,r),$=this._fixedRadius(t)||5;this._lastDotR=$;const j=[];c.forEach(t=>{const e=(r[t]||[]).map(t=>{const e=o(t),a=l(t);return{x:T(n(e)?e:y),y:L(n(a)?a:_),r:D?this._scatterRadius(t,D,$):void 0}});j.push({i:t,cx:(v+k)/2,cy:(10+F)/2,outerR:E/2,dots:e})});const B=(t,e,a,i,s,r)=>{const n=[];if(s)for(let e=0;e(t||[]).forEach(t=>{const e=t&&"object"==typeof t?t[r]:null;"number"==typeof e&&isFinite(e)&&(eo&&(o=e))})),n===1/0?null:{zmin:n,zmax:o,rMin:i,rMax:s,field:r}}_scatterRadius(t,e,a){if(!e)return a;const i=t&&"object"==typeof t?t[e.field]:null;if("number"!=typeof i||!isFinite(i))return e.rMin;const s=e.zmax>e.zmin?(i-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,a,i,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:a;l.forEach(t=>{const s=null!=t.r?t.r:a;let r=0;for(let a=0;a<2e3;a++){const o=0===a?0:Math.ceil(a/2)*i*(a%2?1:-1),l=e+o;let u=!0;for(let e=c.length-1;e>=0;e--){const a=c[e],i=t[n]-a.f;if(i>s+h)break;const r=s+a.r,o=l-a.s;if(i*i+o*o{const i=[];for(let s=t;s<=e+.5*a;s+=a)i.push(Math.abs(s)<1e-9*a?0:s);return i};if(null!=t.xMin||null!=t.xMax){let r=null!=t.xMin?t.xMin:e,n=null!=t.xMax?t.xMax:a;n>r||(n=r+1);const o=(n-r)/Math.max(1,i-1);return en&&(n+=Math.ceil((a-n)/o)*o),{min:r,max:n,ticks:s(r,n,o)}}const r=this._niceScale(e,a,i),n=r.spacing||(r.max-r.min)/Math.max(1,i-1);return{min:r.min,max:r.max,ticks:s(r.min,r.max,n)}}_niceScale(t,e,a){const i=t;let s=e;s>i||(s=i+1);const r=this._niceNum(s-i,!1),n=this._niceNum(r/Math.max(1,a-1),!0);return{min:Math.floor(i/n)*n,max:Math.ceil(s/n)*n,spacing:n}}_niceNum(t,e){const a=t>0?t:1,i=Math.floor(Math.log(a)/Math.LN10),s=a/Math.pow(10,i);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,i)}_drawScatterAxes(t,e){const a=this.w;if(!S.isBrowser())return;const i=this._scatterAxis;if(!i)return;const s="http://www.w3.org/2000/svg",r=e.group({class:"apexcharts-unit-axis"}),n=a.config.grid&&a.config.grid.borderColor||"rgba(128,128,128,0.18)",o="rgba(128,128,128,0.5)",l=a.config.xaxis&&a.config.xaxis.labels&&a.config.xaxis.labels.style&&a.config.xaxis.labels.style.colors,c=Array.isArray(l)?l[0]:l,h=c||"rgba(120,130,140,0.9)",u=(t,e,a,i,n)=>{const o=R.createElementNS(s,"line");o.setAttribute("x1",String(t)),o.setAttribute("y1",String(e)),o.setAttribute("x2",String(a)),o.setAttribute("y2",String(i)),o.setAttribute("stroke",n),o.setAttribute("shape-rendering","crispEdges"),r.node.appendChild(o)},d=(t,e,i,n,o,l,c,h)=>{const u=R.createElementNS(s,"text");u.setAttribute("class",h),u.setAttribute("x",String(e)),u.setAttribute("y",String(i)),u.setAttribute("text-anchor",n),u.setAttribute("dominant-baseline","middle"),u.setAttribute("font-size",`${l}px`),u.setAttribute("font-family",a.config.chart.fontFamily||"inherit"),u.setAttribute("font-weight",String(c)),u.setAttribute("fill",o),u.textContent=t,r.node.appendChild(u)};if("2d"!==i.mode){if("vertical"===i.orientation){if(i.ticks.forEach(t=>{const e=i.plotY(t);i.gridlines&&u(i.plotL,e,i.plotR,e,n);const a=i.formatter?String(i.formatter(t)):this._formatTick(t);d(a,i.plotL-8,e,"end",h,11,400,"apexcharts-unit-tick")}),u(i.plotL,i.plotT,i.plotL,i.plotB,o),i.valueTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(i.plotT+i.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",a.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",h),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(i.valueTitle),r.node.appendChild(t)}return i.lanes.forEach(t=>{const e=c||a.globals.colors[t.i]||a.globals.colors[0]||"#008FFB";d(t.name,t.cx,i.plotB+16,"middle",e,12,600,"apexcharts-unit-lane-label")}),void t.add(r)}i.ticks.forEach((t,e)=>{const a=i.plotX(t);i.gridlines&&u(a,i.plotT,a,i.plotB,n);const s=i.formatter?String(i.formatter(t)):this._formatTick(t),r=0===e?"start":e===i.ticks.length-1?"end":"middle";d(s,a,i.plotB+14,r,h,11,400,"apexcharts-unit-tick")}),u(i.plotL,i.plotB,i.plotR,i.plotB,o),i.xTitle&&d(String(i.xTitle),(i.plotL+i.plotR)/2,i.plotB+32,"middle",h,12,600,"apexcharts-unit-axis-title"),i.plotL>12&&i.lanes.forEach(t=>{const e=c||a.globals.colors[t.i]||a.globals.colors[0]||"#008FFB";d(t.name,i.plotL-8,t.cy,"end",e,12,600,"apexcharts-unit-lane-label")}),t.add(r)}else{if(i.yTicks.forEach(t=>{const e=i.plotY(t);i.gridlines&&u(i.plotL,e,i.plotR,e,n);const a=i.yFormatter?String(i.yFormatter(t)):this._formatTick(t);d(a,i.plotL-8,e,"end",h,11,400,"apexcharts-unit-tick")}),i.xTicks.forEach(t=>{const e=i.plotX(t);i.gridlines&&u(e,i.plotT,e,i.plotB,n);const a=i.xFormatter?String(i.xFormatter(t)):this._formatTick(t);d(a,e,i.plotB+14,"middle",h,11,400,"apexcharts-unit-tick")}),u(i.plotL,i.plotB,i.plotR,i.plotB,o),u(i.plotL,i.plotT,i.plotL,i.plotB,o),i.xTitle&&d(String(i.xTitle),(i.plotL+i.plotR)/2,i.plotB+32,"middle",h,12,600,"apexcharts-unit-axis-title"),i.yTitle){const t=R.createElementNS(s,"text");t.setAttribute("class","apexcharts-unit-axis-title");const e=14,n=(i.plotT+i.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",a.config.chart.fontFamily||"inherit"),t.setAttribute("font-weight","600"),t.setAttribute("fill",h),t.setAttribute("transform",`rotate(-90 ${e} ${n})`),t.textContent=String(i.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 a=t.reduce((t,e)=>t+e,0);if(a<=0||e<=0)return t.map(()=>0);const i=t.map(t=>t/a*e),s=i.map(t=>Math.floor(t)),r=s.reduce((t,e)=>t+e,0),n=Math.max(0,e-r),o=i.map((t,e)=>({i:e,frac:t-Math.floor(t)})).sort((t,e)=>e.frac-t.frac),l=s.slice();for(let t=0;t0?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 a=e.max>e.min?(t-e.min)/(e.max-e.min):1,i=Math.max(0,Math.min(1,a));if("linear"===e.scale)return e.minR+i*(e.maxR-e.minR);const s=e.minR*e.minR,r=e.maxR*e.maxR;return Math.sqrt(s+i*(r-s))}_bubbleStats(t,e,a){if(!this._bubbleActive(e))return null;let i=1/0,s=-1/0;if(t.forEach(t=>{t&&t.forEach(t=>{const e=this._unitValueOf(t);null!=e&&isFinite(e)&&(es&&(s=e))})}),i===1/0||s0?t.spacing:1,s=this._fixedRadius(t);return s?2*s*i:e/(Math.sqrt(Math.max(1,a))+.5)}_dotRadiusFromStep(t,e){const a=e.spacing>0?e.spacing:1,i=this._fixedRadius(e);return i||Math.max(1,t/(2*a))}_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 a=null!=e?e:this._lastDotR;return{hx:a,hy:a}}_place(t,e,a,i){const s=e;2===s.pk?t.setAttribute("transform","translate("+(a-s.ox)+","+(i-s.oy)+s.tail):1===s.pk?(t.setAttribute("x",String(a-s.hx)),t.setAttribute("y",String(i-s.hy))):(t.setAttribute("cx",String(a)),t.setAttribute("cy",String(i)))}_baseSpec(t,e){const a=null!=e?e:this._lastDotR;if(!this._isCorner(t))return{pk:0,r:a};const{hx:i,hy:s}=this._halfExtent(t,a);return{pk:1,hx:i,hy:s,r:a}}_resolveMark(t){if(null==t)return null;if("object"==typeof t)return M(t);if("string"!=typeof t||!t)return null;const e=t.trim();if("M"===e[0]||"m"===e[0])return M(e);const a=A(e);return a||(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,a){const i=Math.round(10*e)/10,s=t.name+"|"+t.path.length+"|"+i,r=this._specCache.get(s);if(r)return r;const n=t.viewBox||[0,0,100,100],o=2*i*(1-Math.max(0,Math.min(.9,a.padding||0)))*("number"==typeof a.scale&&a.scale>0?a.scale:1),l="width"===a.fit?o/n[2]:"height"===a.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:i});return this._specCache.set(s,c),c}_markSpecFor(t,e,a,i){if("pictogram"!==t.shape)return this._baseSpec(t,i);const s=t.pictogram||{},r=e&&"object"==typeof e?e.mark:void 0,n=Array.isArray(s.mark)?s.mark[a%s.mark.length]:s.mark,o=this._resolveMark(null!=r?r:n);return o?this._glyphSpec(o,i,s):this._baseSpec(c(l({},t),{shape:"square"===s.fallback?"square":"circle"}),i)}_drawDot(t,e,a,i,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",i),"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,a=e.image.height||20;u=o.dom.Paper.image(e.image.src),u.node.setAttribute("width",String(t)),u.node.setAttribute("height",String(a)),u.node.setAttribute("preserveAspectRatio","xMidYMid meet"),e.image.tint&&u.node.setAttribute("filter",`url(#${this._tintFilter(i)})`)}else if("square"===e.shape){const s=2*a;u=t.drawRect(0,0,s,s,e.borderRadius||0,i,1,l,c),u.node.setAttribute("fill",i),h<1&&u.node.setAttribute("fill-opacity",String(h))}else u=t.drawCircle(a,{fill:i,"stroke-width":l,stroke:c}),u.node.setAttribute("fill",i),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,a="http://www.w3.org/2000/svg",i=String(t).replace(/[^a-zA-Z0-9]/g,""),s=`apexcharts-unit-tint-${e.globals.chartID}-${i}`,r=e.dom.Paper.node;if(r.querySelector(`#${s}`))return s;let n=r.querySelector("defs");n||(n=R.createElementNS(a,"defs"),r.insertBefore(n,r.firstChild));const o=R.createElementNS(a,"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(a,"feFlood");l.setAttribute("flood-color",t),l.setAttribute("result","flood");const c=R.createElementNS(a,"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,a,i,s){this._place(t,s||this._baseSpec(e),a,i)}_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 a=e.match(/rgba?\(([^)]+)\)/);if(a){const t=a[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&&k())}_seedSprings(t,e,a){const[i,s]=T(e.spring,a),r=this.ctx?this.ctx._unitSprings:null,n=new Map;for(let e=0;e1?e/(r-1)*s:0;const n=a.gather||{},o=n.motion||"auto";"spring"!==o&&("auto"!==o||n.easing&&"outCubic"!==n.easing)?this.ctx&&(this.ctx._unitSprings=null):this._seedSprings(t,n,i);for(let e=0;e1+(c+1)*Math.pow(t-1,3)+c*Math.pow(t-1,2)):"inOutCubic"===n.easing?E:C;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 a=Math.min(.25,Math.max(0,(e-u)/1e3));u=e;let s=!0;for(let n=0;n=0&&!r.released&&(f(r.sx,r.x),f(r.sy,r.y),r.released=!0);const t=p(r.sx,a),e=p(r.sy,a);r.released&&t&&e||(s=!1),d=r.sx.value,m=r.sy.value}else{const t=l(c);d=r.cx0+(r.x-r.cx0)*t,m=r.cy0+(r.y-r.cy0)*t}if(this._place(r.node,r.spec,d,m),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),a=Math.round(r._c0[2]+(r._c1[2]-r._c0[2])*u);r.node.setAttribute("fill",`rgb(${t},${e},${a})`)}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=i))break;return s}_runExits(t,e,a){const i=this.w,s=new g(i,this.ctx),r=this._lastDotR,n=i.layout.gridWidth/2,o=i.layout.gridHeight/2,l="grid"===a.layout||"scatter"===a.layout||"arc"===a.layout||"custom"===a.layout?0:.35,c=[];if(e.forEach(e=>{const i=null!=e.r?e.r:r,n=e.spec||this._baseSpec(a,i),o=this._drawDot(s,a,i,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,i.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 a=Math.max(0,Math.min(1,(e-u)/h)),i=C(a);for(let t=0;t0?e/a*100:0,o=i.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 a=this.w,i=e.clusterLabels,s=i.external.connector||{},r=t.reduce((t,e)=>t+e,0),n=[];if(t.forEach((t,a)=>{t>0&&n.push(...this._outerLabelLines(a,t,r,e))}),!n.length)return 0;const o=function(t,e,a={}){const i=new g(t),s=a.fontSize||"12px",r=parseFloat(s)||12;let n=0;return e.forEach(t=>{if(null==t||""===t)return;const e=`${t}`,o=i.getTextRects(e,s,a.fontFamily,"",!0,a.fontWeight).width;n=Math.max(n,o>0?o:e.length*r*.58)}),n}(a,n,{fontSize:i.fontSize,fontFamily:i.fontFamily||a.config.chart.fontFamily}),l=o+(null!=s.gap?s.gap:8)+(null!=s.length?s.length:22)+8+Math.abs(parseFloat(i.external.offsetX)||0);return Math.min(l,.25*a.layout.gridWidth)}_drawOuterLabels(t,e,a,i,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,f=n.layout.gridWidth,m=n.layout.gridHeight,x=this._lastDotR,y=e.filter(t=>t.dots.length>0);if(!y.length)return;let b=0,_=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),_=Math.max(...e)-Math.min(...e)}const M=b>_,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,a[t.i],i,s);if(!r.some(t=>""!==t))return;const n=M?t.cx>=f/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 a=o*e.x-.75*Math.abs(e.y-t.cy);a>c&&(c=a,l=e)});const m={x:l.x+o*(l.r||x),y:l.y},g={x:m.x+o*h,y:m.y};R.push({i:t.i,lines:r,anchor:m,elbow:g,labelX:g.x+o*u+d,idealY:m.y+p,labelY:m.y+p,side:n})}),!R.length)return;const v=R.reduce((t,e)=>Math.max(t,e.lines.length),1)*w,k=v/2;["left","right"].forEach(t=>{!function(t,e,a,i){const s=t.slice().sort((t,e)=>t.idealY-e.idealY);s.forEach(t=>{t.labelY=t.idealY});for(let t=1;t0)for(let t=s.length-1;t>=0;t--)s[t].labelY-=n,te.side===t),v+2,m-k,k)});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:a,lineHeight:i,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}`,a=d.drawPath({d:t,stroke:c.color,strokeWidth:c.width,fill:"none",strokeLinecap:"round"});a.node.classList.add(e.connectorClass||"apexcharts-outer-label-connector"),p.add(a)}const f="right"===l?n+4:n-4,m=a.length,x=o-(m-1)*i/2,y=d.drawText({x:f,y:x,text:1===m?a[0]:a,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(m>1){const t=y.node.getElementsByTagName("tspan");for(let e=0;e0?a/i*100:0,h=s.clusterLabels,u=parseFloat(h.fontSize)||13;let d;d="function"==typeof h.formatter?h.formatter(l,{seriesIndex:e.i,value:a,percent:c,w:n}):`${l} (${c.toFixed(1)}%)`;const p="string"==typeof d?d:String(d),f=R.createElementNS(o,"text");f.setAttribute("class","apexcharts-unit-label"),f.setAttribute("text-anchor","middle"),f.setAttribute("font-size",`${u}px`),f.setAttribute("font-family",h.fontFamily||n.config.chart.fontFamily||"inherit"),f.setAttribute("font-weight",String(h.fontWeight||600)),f.setAttribute("fill",h.color||r);const m="bottom"===h.position,x=e.outerR+.6*u+3+(h.offsetY||0),g=p.length*u*.55;if(!m&&!e.flat&&!1!==h.curved&&g<=Math.PI*x*.95){const a=e.cy,i=`M ${e.cx-x} ${a} A ${x} ${x} 0 0 1 ${e.cx+x} ${a}`,s=`apexcharts-unit-label-${n.globals.chartID}-${e.i}`,r=R.createElementNS(o,"path");r.setAttribute("id",s),r.setAttribute("d",i),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,f.appendChild(l),t.node.appendChild(r)}else{f.setAttribute("x",String(e.cx));const t=m?e.cy+e.outerR+u+6+(h.offsetY||0):e.cy-e.outerR-6-(h.offsetY||0);f.setAttribute("y",String(t)),f.textContent=p}t.node.appendChild(f)}}}),t.default=h,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},"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={})});