/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/offline-exporting
 * @requires highcharts
 * @requires highcharts/modules/exporting
 *
 * Client side exporting module
 *
 * (c) 2015-2026 Highsoft AS
 * Author: Torstein Hønsi / Øystein 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 n=o.n(r);let{isSafari:a,win:l,win:{document:i}}=n(),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 d(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 n=/Edge\/\d+/.test(o.userAgent);if((a&&"string"==typeof t&&0===t.indexOf("data:application/pdf")||n||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 f(t){return new Promise((e,o)=>{let n=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}`;(0,r.error)(e),o(Error(e))},n.appendChild(a)})}let p=t.default.AST;var h=o.n(p);let u=t.default.Chart;var y=o.n(u);let g={exporting:{}},{doc:m,win:w}=n();Array.prototype.find;let{getOptions:v,setOptions:b}=n(),{composed:E,doc:F,win:x}=n();!function(t){async function e(t,e,n,a){var l,i;let s,c,f,p,u,y=(l=t,i=a,f=F.createElement("div"),h().setElementHTML(f,l),p=f.getElementsByTagName("text"),u=function(t,e){let o=t;for(;o&&o!==f;){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=>{u(t,e)}),t.style.fontFamily=i?.normal?"HighchartsFont":String(t.style.fontFamily&&t.style.fontFamily.split(" ").splice(-1)),s=t.getElementsByTagName("title"),[].forEach.call(s,function(e){t.removeChild(e)}),c=t.getElementsByClassName("highcharts-text-outline");c.length>0;){let t=c[0];t.parentNode&&t.parentNode.removeChild(t)}}),f.querySelector("svg"));y&&(await o(y,a),d(await r(y,0,e),n))}async function o(t,e){let o,r,n=(t,e)=>{x.jspdf.jsPDF.API.events.push(["initialized",function(){this.addFileToVFS(t,e),this.addFont(t,"HighchartsFont",t),this.getFontList()?.HighchartsFont||this.setFont("HighchartsFont")}])};for(let a of(e&&(r=t.textContent||"",!/[^\u0000-\u007F\u200B]+/.test(r))&&(e=void 0),["normal","italic","bold","bolditalic"])){let t=e?.[a];if(t)try{let e=await x.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)});n(a,i),"normal"===a&&(o=i)}catch{}else o&&n(a,o)}}async function r(t,e,o){let r=(Number(t.getAttribute("width"))+2*e)*o,n=(Number(t.getAttribute("height"))+2*e)*o,a=new x.jspdf.jsPDF(n>r?"p":"l","pt",[r,n]);[].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 a.svg(t,{x:0,y:0,width:r,height:n,removeInvalid:!0}),a.output("datauristring")}t.compose=function(t){var o;if(!function(t,e,o,r={}){let a="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(a,"hcEvents")||(a.hcEvents={});let l=a.hcEvents;n().Point&&t instanceof n().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let i=t.addEventListener;i&&i.call(t,e,o,!!n().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),l[e]||(l[e]=[]);let s={fn:o,order:"number"==typeof r.order?r.order:1/0};l[e].push(s),l[e].sort((t,e)=>t.order-e.order)}(t,"downloadSVG",async function(t){let{svg:o,exportingOptions:r,exporting:a,preventDefault:l}=t;if(r?.type==="application/pdf"){l?.();try{let{type:t,filename:a,scale:l,libURL:i}=n().Exporting.prepareImageOptions(r);"application/pdf"===t&&(x.jspdf?.jsPDF||(await f(`${i}jspdf.js`),await f(`${i}svg2pdf.js`)),await e(o,l,a,r?.pdfFont))}catch(t){await a?.fallbackToServer(r,t)}}}),o="OfflineExporting",!(0>E.indexOf(o)&&E.push(o)))return;!function(t,e){let o;for(o in t||(t={}),e)t[o]=e[o]}(y().prototype,{exportChartLocal:async function(t,e){await this.exporting?.exportChart(t,e)}}),b(g);let r=v().exporting?.buttons?.contextButton?.menuItems;r?.push("downloadPDF")},t.downloadSVGLocal=async function(t,e){await n().Exporting.prototype.downloadSVG.call(void 0,t,e)}}(e||(e={}));let A=e,S=n();S.dataURLtoBlob=S.dataURLtoBlob||c,S.downloadSVGLocal=A.downloadSVGLocal,S.downloadURL=S.downloadURL||d,A.compose(S.Exporting);let j=n();export{j as default};