import{M as dt}from"./entry.783d4ced.js";function ct(j,y){for(var g=0;g<y.length;g++){const x=y[g];if(typeof x!="string"&&!Array.isArray(x)){for(const m in x)if(m!=="default"&&!(m in j)){const u=Object.getOwnPropertyDescriptor(x,m);u&&Object.defineProperty(j,m,u.get?u:{enumerable:!0,get:()=>x[m]})}}}return Object.freeze(Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}))}var ot={exports:{}};(function(j){(function(y){j.exports?(y.default=y,j.exports=y):y(typeof Highcharts<"u"?Highcharts:void 0)})(function(y){var g=y?y._modules:{};function x(m,u,A,C){m.hasOwnProperty(u)||(m[u]=C.apply(null,A),typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:u,module:m[u]}})))}x(g,"Series/FlowMap/FlowMapPoint.js",[g["Core/Series/SeriesRegistry.js"],g["Core/Utilities.js"]],function(m,u){let{seriesTypes:{mapline:{prototype:{pointClass:A}}}}=m,{pick:C,isString:X,isNumber:T}=u;return class extends A{constructor(){super(...arguments),this.options=void 0,this.series=void 0}isValid(){let E=!!(this.options.to&&this.options.from);return[this.options.to,this.options.from].forEach(function(P){E=!!(E&&P&&(X(P)||T(C(P[0],P.lat))&&T(C(P[1],P.lon))))}),E}}}),x(g,"Series/FlowMap/FlowMapSeries.js",[g["Series/FlowMap/FlowMapPoint.js"],g["Core/Series/SeriesRegistry.js"],g["Core/Utilities.js"]],function(m,u,A){let{series:{prototype:{pointClass:C}},seriesTypes:{column:X,map:T,mapline:E}}=u,{addEvent:P,arrayMax:st,arrayMin:rt,defined:q,extend:nt,isArray:I,merge:N,pick:v,relativeLength:U}=A;class w extends E{constructor(){super(...arguments),this.data=void 0,this.options=void 0,this.points=void 0,this.smallestWeight=void 0,this.greatestWeight=void 0,this.centerOfPoints=void 0}static getLength(e,s){return Math.sqrt(e*e+s*s)}static normalize(e,s){let o=this.getLength(e,s);return[e/o,s/o]}static markerEndPath(e,s,o,t){let r=U(t.width||0,this.getLength(s[0]-e[0],s[1]-e[1])),l=t.markerType||"arrow",[f,n]=this.normalize(s[0]-e[0],s[1]-e[1]),i=[];if(l==="arrow"){let[p,a]=e;p-=f*r,a-=n*r,i.push(["L",p,a]),i.push(["L",o[0],o[1]]),[p,a]=s,p+=f*r,a+=n*r,i.push(["L",p,a])}if(l==="mushroom"){let[p,a]=e,[d,h]=s,[c,M]=o,z=(d-p)/2+p,D=(h-a)/2+a;p-=f*r,a-=n*r,i.push(["L",p,a]),d+=f*r,h+=n*r,i.push(["Q",(c-z)*2+z,(M-D)*2+D,d,h])}return i}animate(e){let s=this.points;e||s.forEach(o=>{if(o.shapeArgs&&I(o.shapeArgs.d)&&o.shapeArgs.d.length){let t=o.shapeArgs.d,r=t[0][1],l=t[0][2];if(r&&l){let f=[];for(let n=0;n<t.length;n++){f.push([...t[n]]);for(let i=1;i<t[n].length;i++)f[n][i]=i%2?r:l}o.graphic&&(o.graphic.attr({d:f}),o.graphic.animate({d:t}))}}})}getLinkWidth(e){let s=this.options.width,o=e.options.weight||this.options.weight;if(e.options.weight=o,s&&!o)return s;let t=this.smallestWeight,r=this.greatestWeight;if(!q(o)||!t||!r)return 0;let l=this.options.minWidth,f=this.options.maxWidth;return(o-t)*(f-l)/(r-t||1)+l}autoCurve(e,s,o,t,r,l){let f={x:o-e,y:t-s},n={x:(o-e)/2+e,y:(t-s)/2+s},i={x:n.x-r,y:n.y-l},p=f.x*i.x+f.y*i.y,a=f.x*i.y-f.y*i.x,d=Math.atan2(a,p),h=180*d/Math.PI;return h<0&&(h=360+h),-(.7*Math.sin(d=h*Math.PI/180))}pointAttribs(e,s){let o=T.prototype.pointAttribs.call(this,e,s);return o.fill=v(e.options.fillColor,e.options.color,this.options.fillColor==="none"?null:this.options.fillColor,this.color),o["fill-opacity"]=v(e.options.fillOpacity,this.options.fillOpacity),o["stroke-width"]=v(e.options.lineWidth,this.options.lineWidth,1),e.options.opacity&&(o.opacity=e.options.opacity),o}translate(){this.chart.hasRendered&&(this.isDirtyData||!this.hasRendered)&&(this.processData(),this.generatePoints());let e=[],s=0,o=0;this.points.forEach(t=>{let r,l,f=this.chart,n=f.mapView,i=t.options,p=()=>{t.series.isDirty=!0},a=h=>{let c=f.get(h);if(c instanceof C&&c.plotX&&c.plotY)return P(c,"update",p),{x:c.plotX,y:c.plotY}},d=h=>I(h)?{lon:h[0],lat:h[1]}:h;typeof i.from=="string"?r=a(i.from):typeof i.from=="object"&&n&&(r=n.lonLatToPixels(d(i.from))),typeof i.to=="string"?l=a(i.to):typeof i.to=="object"&&n&&(l=n.lonLatToPixels(d(i.to))),t.fromPos=r,t.toPos=l,r&&l&&(s+=(r.x+l.x)/2,o+=(r.y+l.y)/2),v(t.options.weight,this.options.weight)&&e.push(v(t.options.weight,this.options.weight))}),this.smallestWeight=rt(e),this.greatestWeight=st(e),this.centerOfPoints={x:s/this.points.length,y:o/this.points.length},this.points.forEach(t=>{if(!this.getLinkWidth(t)){t.shapeArgs={d:[]};return}t.fromPos&&(t.plotX=t.fromPos.x,t.plotY=t.fromPos.y),t.shapeType="path",t.shapeArgs=this.getPointShapeArgs(t),t.color=v(t.options.color,t.series.color)})}getPointShapeArgs(e){let{fromPos:s,toPos:o}=e;if(!s||!o)return{};let t=this.getLinkWidth(e)/2,r=e.options,l=N(this.options.markerEnd,r.markerEnd),f=v(r.growTowards,this.options.growTowards),n=s.x||0,i=s.y||0,p=o.x||0,a=o.y||0,d=v(r.curveFactor,this.options.curveFactor),h=l&&l.enabled&&l.height||0;if(q(d)||(d=this.autoCurve(n,i,p,a,this.centerOfPoints.x,this.centerOfPoints.y)),h){h=U(h,4*t);let W=p-n,F=a-i;W*=.5,F*=.5;let at=n+W,pt=i+F,lt=W;W=F,F=-lt;let ht=at+W*d,ft=pt+F*d,[tt,et]=w.normalize(ht-p,ft-a);tt*=h,et*=h,p+=tt,a+=et}let c=p-n,M=a-i;c*=.5,M*=.5;let z=n+c,D=i+M,S=c;c=M,M=-S;let[$,R]=w.normalize(c,M),V=1+.25*Math.sqrt(d*d);$*=t*V,R*=t*V;let H=z+c*d,Q=D+M*d,[O,k]=w.normalize(H-n,Q-i);S=O,O=k,k=-S,O*=t,k*=t;let[b,L]=w.normalize(H-p,Q-a);S=b,b=-L,L=S,b*=t,L*=t,f&&(O/=t,k/=t,$/=4,R/=4);let Y={d:[["M",n-O,i-k],["Q",H-$,Q-R,p-b,a-L],["L",p+b,a+L],["Q",H+$,Q+R,n+O,i+k],["Z"]]};if(l&&l.enabled&&Y.d){let W=w.markerEndPath([p-b,a-L],[p+b,a+L],[o.x,o.y],l);Y.d.splice(2,0,...W)}let G=e.options.from,Z=e.options.to,_=G.lat,B=G.lon,J=Z.lat,K=Z.lon;return _&&B&&(e.options.from=`${+_}, ${+B}`),J&&K&&(e.options.to=`${+J}, ${+K}`),Y}}return w.defaultOptions=N(E.defaultOptions,{animation:!0,dataLabels:{enabled:!1},fillOpacity:.5,markerEnd:{enabled:!0,height:"40%",width:"40%",markerType:"arrow"},width:1,maxWidth:25,minWidth:5,lineWidth:void 0,tooltip:{headerFormat:'<span style="font-size: 0.8em">{series.name}</span><br/>',pointFormat:"{point.options.from} → {point.options.to}: <b>{point.options.weight}</b>"}}),nt(w.prototype,{pointClass:m,pointArrayMap:["from","to","weight"],drawPoints:X.prototype.drawPoints,useMapGeometry:!0}),u.registerSeriesType("flowmap",w),w}),x(g,"masters/modules/flowmap.src.js",[],function(){})})})(ot);var it=ot.exports;const mt=dt(it),gt=ct({__proto__:null,default:mt},[it]);export{gt as f};
