/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/offline-exporting
 * @requires highcharts
 * @requires highcharts/modules/exporting
 *
 * Client side exporting module
 *
 * (c) 2015-2026 Highsoft AS
 * Author: Torstein Honsi / Oystein Moseng
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var a=o.n(r);let{isSafari:n,win:l,win:{document:i}}=a(),{error:d}=a(),s=l.URL||l.webkitURL||l;function c(t){let e=t.replace(/filename=.*;/,"").match(/data:([^;]*)(;base64)?,([A-Z+\d\/]+)/i);if(e&&e.length>3&&l.atob&&l.ArrayBuffer&&l.Uint8Array&&l.Blob&&s.createObjectURL){let t=l.atob(e[3]),o=new l.ArrayBuffer(t.length),r=new l.Uint8Array(o);for(let e=0;e<r.length;++e)r[e]=t.charCodeAt(e);return s.createObjectURL(new l.Blob([r],{type:e[1]}))}}function f(t,e){let o=l.navigator,r=i.createElement("a");if("string"!=typeof t&&!(t instanceof String)&&o.msSaveOrOpenBlob)return void o.msSaveOrOpenBlob(t,e);if(t=""+t,o.userAgent.length>1e3)throw Error("Input too long");let a=/Edge\/\d+/.test(o.userAgent);if((n&&"string"==typeof t&&0===t.indexOf("data:application/pdf")||a||t.length>2e6)&&!(t=c(t)||""))throw Error("Failed to convert to blob");if(void 0!==r.download)r.href=t,r.download=e,i.body.appendChild(r),r.click(),i.body.removeChild(r);else try{if(!l.open(t,"chart"))throw Error("Failed to open window")}catch{l.location.href=t}}function p(t){return new Promise((e,o)=>{let r=i.getElementsByTagName("head")[0],a=i.createElement("script");a.type="text/javascript",a.src=t,a.onload=()=>{e()},a.onerror=()=>{let e=`Error loading script ${t}`;d(e),o(Error(e))},r.appendChild(a)})}let h=t.default.AST;var u=o.n(h);let g=t.default.Chart;var y=o.n(g);let m={exporting:{}},{getOptions:w,setOptions:b}=a(),{composed:v,doc:E,win:F}=a(),{addEvent:x,extend:A,pushUnique:S}=a();!function(t){async function e(t,e,a,n){var l,i;let d,s,c,p,h,g=(l=t,i=n,c=E.createElement("div"),u().setElementHTML(c,l),p=c.getElementsByTagName("text"),h=function(t,e){let o=t;for(;o&&o!==c;){if(o.style[e]){let r=o.style[e];"fontSize"===e&&/em$/.test(r)&&(r=Math.round(16*parseFloat(r))+"px"),t.style[e]=r;break}o=o.parentNode}},[].forEach.call(p,function(t){for(["fontFamily","fontSize"].forEach(e=>{h(t,e)}),t.style.fontFamily=i?.normal?"HighchartsFont":String(t.style.fontFamily&&t.style.fontFamily.split(" ").splice(-1)),d=t.getElementsByTagName("title"),[].forEach.call(d,function(e){t.removeChild(e)}),s=t.getElementsByClassName("highcharts-text-outline");s.length>0;){let t=s[0];t.parentNode&&t.parentNode.removeChild(t)}}),c.querySelector("svg"));g&&(await o(g,n),f(await r(g,0,e),a))}async function o(t,e){let o,r,a=(t,e)=>{F.jspdf.jsPDF.API.events.push(["initialized",function(){this.addFileToVFS(t,e),this.addFont(t,"HighchartsFont",t),this.getFontList()?.HighchartsFont||this.setFont("HighchartsFont")}])};for(let n of(e&&(r=t.textContent||"",!/[^\u0000-\u007F\u200B]+/.test(r))&&(e=void 0),["normal","italic","bold","bolditalic"])){let t=e?.[n];if(t)try{let e=await F.fetch(t);if(!e.ok)throw Error(`Failed to fetch font: ${t}`);let r=await e.blob(),l=new FileReader,i=await new Promise((t,e)=>{l.onloadend=()=>{"string"==typeof l.result?t(l.result.split(",")[1]):e(Error("Failed to read font as base64"))},l.onerror=e,l.readAsDataURL(r)});a(n,i),"normal"===n&&(o=i)}catch{}else o&&a(n,o)}}async function r(t,e,o){let r=(Number(t.getAttribute("width"))+2*e)*o,a=(Number(t.getAttribute("height"))+2*e)*o,n=new F.jspdf.jsPDF(a>r?"p":"l","pt",[r,a]);[].forEach.call(t.querySelectorAll('*[visibility="hidden"]'),function(t){t.parentNode.removeChild(t)});let l=t.querySelectorAll("linearGradient");for(let t=0;t<l.length;t++){let e=l[t].querySelectorAll("stop"),o=0;for(;o<e.length&&"0"===e[o].getAttribute("offset")&&"0"===e[o+1].getAttribute("offset");)e[o].remove(),o++}return[].forEach.call(t.querySelectorAll("tspan"),t=>{"​"===t.textContent&&(t.textContent=" ",t.setAttribute("dx",-5))}),await n.svg(t,{x:0,y:0,width:r,height:a,removeInvalid:!0}),n.output("datauristring")}t.compose=function(t){if(x(t,"downloadSVG",async function(t){let{svg:o,exportingOptions:r,exporting:n,preventDefault:l}=t;if(r?.type==="application/pdf"){l?.();try{let{type:t,filename:n,scale:l,libURL:i}=a().Exporting.prepareImageOptions(r);"application/pdf"===t&&(F.jspdf?.jsPDF||(await p(`${i}jspdf.js`),await p(`${i}svg2pdf.js`)),await e(o,l,n,r?.pdfFont))}catch(t){await n?.fallbackToServer(r,t)}}}),!S(v,"OfflineExporting"))return;A(y().prototype,{exportChartLocal:async function(t,e){await this.exporting?.exportChart(t,e)}}),b(m);let o=w().exporting?.buttons?.contextButton?.menuItems;o&&o.push("downloadPDF")},t.downloadSVGLocal=async function(t,e){await a().Exporting.prototype.downloadSVG.call(void 0,t,e)}}(e||(e={}));let j=e,L=a();L.dataURLtoBlob=L.dataURLtoBlob||c,L.downloadSVGLocal=j.downloadSVGLocal,L.downloadURL=L.downloadURL||f,j.compose(L.Exporting);let B=a();export{B as default};