import{g as t}from"./index-B1MHyEgd.js";function e(t,e){return e.forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(r){if("default"!==r&&!(r in t)){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})}),Object.freeze(t)}var r,a={exports:{}};var n,o=r?a.exports:(r=1,n="undefined"==typeof window?a.exports:window,a.exports=(t=>(()=>{var e={944:e=>{e.exports=t}},r={};function a(t){var n=r[t];if(void 0!==n)return n.exports;var o=r[t]={exports:{}};return e[t](o,o.exports,a),o.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};a.d(n,{default:()=>y});var o=a(944),s=a.n(o);let{deg2rad:i}=s(),{addEvent:h,merge:d,uniqueKey:l,defined:f,extend:u}=s();function x(t,e){e=d(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let r=this.renderer.url,a=this.text||this,n=a.textPath,{attributes:o,enabled:s}=e;if(t=t||n&&n.path,n&&n.undo(),t&&s){let e=h(a,"afterModifyTree",e=>{if(t&&s){let n=t.attr("id");n||t.attr("id",n=l());let s={x:0,y:0};f(o.dx)&&(s.dx=o.dx,delete o.dx),f(o.dy)&&(s.dy=o.dy,delete o.dy),a.attr(s),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let i=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:u(o,{"text-anchor":o.textAnchor,href:`${r}#${n}`}),children:i}}});a.textPath={path:t,undo:e}}else a.attr({dx:0,dy:0}),delete a.textPath;return this.added&&(a.textCache="",this.renderer.buildText(a)),this}function c(t){let e=t.bBox,r=this.element?.querySelector("textPath");if(r){let t=[],{b:a,h:n}=this.renderer.fontMetrics(this.element),o=n-a,s=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),h=r.innerHTML.replace(s,"").split(/<tspan class="highcharts-br"[^>]*>/),d=h.length,l=(t,e)=>{let{x:n,y:s}=e,h=(r.getRotationOfChar(t)-90)*i,d=Math.cos(h),l=Math.sin(h);return[[n-o*d,s-o*l],[n+a*d,s+a*l]]};for(let e=0,a=0;a<d;a++){let n=h[a].length;for(let o=0;o<n;o+=5)try{let n=e+o+a,[s,i]=l(n,r.getStartPositionOfChar(n));0===o?(t.push(i),t.push(s)):(0===a&&t.unshift(i),a===d-1&&t.push(s))}catch{break}e+=n-1;try{let n=e+a,o=r.getEndPositionOfChar(n),[s,i]=l(n,o);t.unshift(i),t.unshift(s)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function p(t){let e=t.labelOptions,r=t.point,a=e[r.formatPrefix+"TextPath"]||e.textPath;a&&!e.useHTML&&(this.setTextPath(r.getDataLabelPath?.(this)||r.graphic,a),r.dataLabelPath&&!a.enabled&&(r.dataLabelPath=r.dataLabelPath.destroy()))}let b=s();b.TextPath={compose:function(t){h(t,"afterGetBBox",c),h(t,"beforeAddingDataLabel",p);let e=t.prototype;e.setTextPath||(e.setTextPath=x)}},b.TextPath.compose(b.SVGElement);let y=s();return n.default})())(n._Highcharts)),s=e({__proto__:null,default:t(o)},[o]);export{s as t};
//# sourceMappingURL=textpath-C8_FYpBf.js.map
