/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/textpath
 * @requires highcharts
 *
 * (c) 2009-2026 Highsoft AS
 * Author: Torstein Hønsi
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,a={};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);let r=t.default;var h=a.n(r);let{composed:s,deg2rad:n}=h();e=h().SVGElement,(0,r.pushUnique)(s,"TextPath")&&((0,r.addEvent)(e,"afterGetBBox",function(t){let e=t.bBox,a=this.element?.querySelector("textPath");if(a){let t=[],{b:r,h}=this.renderer.fontMetrics(this.element),s=h-r,d=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),i=a.innerHTML.replace(d,"").split(/<tspan class="highcharts-br"[^>]*>/),l=i.length,o=(t,e)=>{let{x:h,y:d}=e,i=(a.getRotationOfChar(t)-90)*n,l=Math.cos(i),o=Math.sin(i);return[[h-s*l,d-s*o],[h+r*l,d+r*o]]};for(let e=0,r=0;r<l;r++){let h=i[r].length;for(let s=0;s<h;s+=5)try{let h=e+s+r,[n,d]=o(h,a.getStartPositionOfChar(h));0===s?(t.push(d),t.push(n)):(0===r&&t.unshift(d),r===l-1&&t.push(n))}catch{break}e+=h-1;try{let h=e+r,s=a.getEndPositionOfChar(h),[n,d]=o(h,s);t.unshift(d),t.unshift(n)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}),(0,r.addEvent)(e,"beforeAddingDataLabel",function(t){let e=t.labelOptions,a=t.point,r=e[a.formatPrefix+"TextPath"]||e.textPath;r&&!e.useHTML&&(this.setTextPath(a.getDataLabelPath?.(this)||a.graphic,r),a.dataLabelPath&&!r.enabled&&(a.dataLabelPath=a.dataLabelPath.destroy()))}),e.prototype.setTextPath=e.prototype.setTextPath??function(t,e){let a=this.renderer.url,h=this.text||this,s=h.textPath,{attributes:n,enabled:d}=(0,r.merge)({enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);if(t=t||s&&s.path,s?.undo(),t&&d){let e=(0,r.addEvent)(h,"afterModifyTree",e=>{if(t&&d){let s=t.attr("id");s||t.attr("id",s=(0,r.uniqueKey)());let d={x:0,y:0};(0,r.defined)(n.dx)&&(d.dx=n.dx,delete n.dx),(0,r.defined)(n.dy)&&(d.dy=n.dy,delete n.dy),h.attr(d),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:(0,r.extend)(n,{"text-anchor":n.textAnchor,href:`${a}#${s}`}),children:i}}});h.textPath={path:t,undo:e}}else h.attr({dx:0,dy:0}),delete h.textPath;return this.added&&(h.textCache="",this.renderer.buildText(h)),this});let d=h();export{d as default};