"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime");require("react");const h=require("react-markdown"),x=require("remark-gfm"),y=require("rehype-raw"),d=require("string-template"),j=/(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi,b=/(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi,q=/(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi,m=(n,e,a,s,t,r)=>{let o,i=e;for(;(o=n.exec(e))!==null;){const u=o[2],l=o[1],v=((p,g=2)=>t.formatNumber(s?p/100:p,{maximumFractionDigits:g,...a,signDisplay:l&&l.startsWith("+")?"never":"auto"})).apply(void 0,u.split(","));i=i.replaceAll(o[0],v)}return i},f=(n,e,a,s)=>{let t=s?d(n,e):d(n,e).replace(/(?:\r\n|\r|\n)/g,"<br>");return t=m(j,t,{style:"percent"},!0,a),t=m(b,t,{style:"decimal"},!1,a),t=m(q,t,{notation:"compact"},!1,a),t},F=({tooltip:n,d:e,intl:a,tooltipEnableMarkdown:s})=>{const{color:t,data:r}=e.datum||e.point||e,o=e.value||(e.datum?e.datum.value:null)||(e.point?e.point.data.y:null);if(r){const i=r.variables?r.variables[e.id]||r.variables:r,u={field:e.point?e.point.serieId:e.id,...i,value:o};r.measureFieldName&&(u.populationValue=r.variables[r.measureFieldName+"Population"]);const l=f(n,u,a,s);return s?c.jsx("div",{className:"chart tooltip",children:c.jsx(h,{children:l,remarkPlugins:[x],rehypePlugins:[y]})}):c.jsx("div",{className:"chart tooltip",children:c.jsx("div",{dangerouslySetInnerHTML:{__html:l}})})}else return c.jsx("div",{})};exports.default=F;exports.formatContent=f;
