highcharts
Version:
JavaScript charting framework
13 lines • 30.9 kB
JavaScript
!/**
* Highcharts JS v13.0.1 (2026-08-17)
* @module highcharts/modules/exporting
* @requires highcharts
*
* Exporting module
*
* (c) 2010-2026 Highsoft AS
* Author: Torstein Hønsi
*
* A commercial license may be required depending on use,
* see www.highcharts.com/license
*/function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):"function"==typeof define&&define.amd?define("highcharts/modules/exporting",["highcharts/highcharts"],function(e){return t(e,e.AST,e.Chart)}):"object"==typeof exports?exports["highcharts/modules/exporting"]=t(e._Highcharts,e._Highcharts.AST,e._Highcharts.Chart):e.Highcharts=t(e.Highcharts,e.Highcharts.AST,e.Highcharts.Chart)}("u"<typeof window?this:window,(e,t,n)=>(()=>{"use strict";var i,r,o={660(e){e.exports=t},960(e){e.exports=n},944(t){t.exports=e}};let a={};function s(e){let t=a[e];if(void 0!==t)return t.exports;let n=a[e]={exports:{}};return o[e](n,n.exports,s),n.exports}s.n=e=>{let t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var i=t[n++],r=t[n++];s.o(e,i)?0===r&&n++:0===r?Object.defineProperty(e,i,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,i,{enumerable:!0,get:r})}else for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let l={};s.d(l,{default:()=>$});var c=s(944),h=s.n(c),d=s(660),p=s.n(d),u=s(960),g=s.n(u),f=i||(i={});f.compose=function(e){return e.navigation||(e.navigation=new m(e)),e};class m{constructor(e){this.updates=[],this.chart=e}addUpdate(e){this.chart.navigation.updates.push(e)}update(e,t){this.updates.forEach(n=>{n.call(this.chart,e,t)})}}f.Additions=m;let y=i,{isSafari:x,win:v,win:{document:w}}=h(),b=v.URL||v.webkitURL||v;function S(e,t){let n=v.navigator,i=w.createElement("a");if("string"!=typeof e&&!(e instanceof String)&&n.msSaveOrOpenBlob)return void n.msSaveOrOpenBlob(e,t);if(e=""+e,n.userAgent.length>1e3)throw Error("Input too long");let r=/Edge\/\d+/.test(n.userAgent);if((x&&"string"==typeof e&&0===e.indexOf("data:application/pdf")||r||e.length>2e6)&&!(e=function(e){let t=e.replace(/filename=.*;/,"").match(/data:([^;]*)(;base64)?,([A-Z+\d\/]+)/i);if(t&&t.length>3&&v.atob&&v.ArrayBuffer&&v.Uint8Array&&v.Blob&&b.createObjectURL){let e=v.atob(t[3]),n=new v.ArrayBuffer(e.length),i=new v.Uint8Array(n);for(let t=0;t<i.length;++t)i[t]=e.charCodeAt(t);return b.createObjectURL(new v.Blob([i],{type:t[1]}))}}(e)||""))throw Error("Failed to convert to blob");if(void 0!==i.download)i.href=e,i.download=t,w.body.appendChild(i),i.click(),w.body.removeChild(i);else try{if(!v.open(e,"chart"))throw Error("Failed to open window")}catch{v.location.href=e}}let{isTouchDevice:E}=h(),C={exporting:{allowHTML:!0,allowTableSorting:!0,local:!0,type:"image/png",url:`https://export-svg.highcharts.com?v=${h().version}`,pdfFont:{normal:void 0,bold:void 0,bolditalic:void 0,italic:void 0},printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",titleKey:"contextButtonTitle",menuItems:["viewFullscreen","printChart","separator","downloadPNG","downloadJPEG","downloadSVG"]}},menuItemDefinitions:{viewFullscreen:{textKey:"viewFullscreen",onclick:function(){this.fullscreen?.toggle()}},printChart:{textKey:"printChart",onclick:function(){this.exporting?.print()}},separator:{separator:!0},downloadPNG:{textKey:"downloadPNG",onclick:async function(){await this.exporting?.exportChart()}},downloadJPEG:{textKey:"downloadJPEG",onclick:async function(){await this.exporting?.exportChart({type:"image/jpeg"})}},downloadPDF:{textKey:"downloadPDF",onclick:async function(){await this.exporting?.exportChart({type:"application/pdf"})}},downloadSVG:{textKey:"downloadSVG",onclick:async function(){await this.exporting?.exportChart({type:"image/svg+xml"})}}}},lang:{viewFullscreen:"View in full screen",exitFullscreen:"Exit from full screen",printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",contextButtonTitle:"Chart context menu"},navigation:{buttonOptions:{symbolSize:14,symbolX:14.5,symbolY:13.5,align:"right",buttonSpacing:5,height:28,y:-5,verticalAlign:"top",width:28,symbolFill:"var(--highcharts-neutral-color-60)",symbolStroke:"var(--highcharts-neutral-color-60)",symbolStrokeWidth:3,theme:{fill:"var(--highcharts-background-color)",padding:5,stroke:"none","stroke-linecap":"round"}},menuStyle:{border:"none",borderRadius:"3px",background:"var(--highcharts-background-color)",padding:"0.5em"},menuItemStyle:{background:"none",borderRadius:"3px",color:"var(--highcharts-neutral-color-80)",padding:"0.5em",fontSize:E?"0.9em":"0.8em",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"var(--highcharts-neutral-color-5)"}}};!function(e){let t=[];function n(e,t,n,i){return[["M",e,t+2.5],["L",e+n,t+2.5],["M",e,t+i/2+.5],["L",e+n,t+i/2+.5],["M",e,t+i-1.5],["L",e+n,t+i-1.5]]}function i(e,t,n,i){let r=i/3-2,o=[];return o.concat(this.circle(n-r,t,r,r),this.circle(n-r,t+r+4,r,r),this.circle(n-r,t+2*(r+4),r,r))}e.compose=function(e){if(-1===t.indexOf(e)){t.push(e);let r=e.prototype.symbols;r.menu=n,r.menuball=i.bind(r)}}}(r||(r={}));let O=r,{composed:T}=h();function F(){this.fullscreen=new k(this)}class k{static compose(e){(0,c.pushUnique)(T,"Fullscreen")&&(0,c.addEvent)(e,"beforeRender",F)}constructor(e){this.chart=e,this.isOpen=!1;const t=e.renderTo;!this.browserProps&&("function"==typeof t.requestFullscreen?this.browserProps={fullscreenChange:"fullscreenchange",requestFullscreen:"requestFullscreen",exitFullscreen:"exitFullscreen"}:t.mozRequestFullScreen?this.browserProps={fullscreenChange:"mozfullscreenchange",requestFullscreen:"mozRequestFullScreen",exitFullscreen:"mozCancelFullScreen"}:t.webkitRequestFullScreen?this.browserProps={fullscreenChange:"webkitfullscreenchange",requestFullscreen:"webkitRequestFullScreen",exitFullscreen:"webkitExitFullscreen"}:t.msRequestFullscreen&&(this.browserProps={fullscreenChange:"MSFullscreenChange",requestFullscreen:"msRequestFullscreen",exitFullscreen:"msExitFullscreen"}))}close(){let e=this,t=e.chart,n=t.options.chart;(0,c.fireEvent)(t,"fullscreenClose",void 0,function(){e.isOpen&&e.browserProps&&t.container.ownerDocument instanceof Document&&t.container.ownerDocument[e.browserProps.exitFullscreen](),e.unbindFullscreenEvent&&(e.unbindFullscreenEvent=e.unbindFullscreenEvent()),t.setSize(e.origWidth,e.origHeight,!1),e.origWidth=void 0,e.origHeight=void 0,n.width=e.origWidthOption,n.height=e.origHeightOption,e.origWidthOption=void 0,e.origHeightOption=void 0,e.isOpen=!1,e.setButtonText()})}open(){let e=this,t=e.chart,n=t.options.chart;(0,c.fireEvent)(t,"fullscreenOpen",void 0,function(){if(n&&(e.origWidthOption=n.width,e.origHeightOption=n.height),e.origWidth=t.chartWidth,e.origHeight=t.chartHeight,e.browserProps){let n=(0,c.addEvent)(t.container.ownerDocument,e.browserProps.fullscreenChange,function(){e.isOpen?(e.isOpen=!1,e.close()):(t.setSize(null,null,!1),e.isOpen=!0,e.setButtonText())}),i=(0,c.addEvent)(t,"destroy",n);e.unbindFullscreenEvent=()=>{n(),i()};let r=t.renderTo[e.browserProps.requestFullscreen]();r&&r.catch(function(){alert("Full screen is not supported inside a frame.")})}})}setButtonText(){let e=this.chart,t=e.exporting?.divElements,n=e.options.exporting,i=n&&n.buttons&&n.buttons.contextButton.menuItems,r=e.options.lang;if(n?.menuItemDefinitions&&r?.exitFullscreen&&r.viewFullscreen&&i&&t){let e=t[i.indexOf("viewFullscreen")];e&&p().setElementHTML(e,this.isOpen?r.exitFullscreen:n.menuItemDefinitions.viewFullscreen?.text||r.viewFullscreen)}}toggle(){this.isOpen?this.close():this.open()}}let{win:R}=h(),A={ajax:function(e){let t={json:"application/json",xml:"application/xml",text:"text/plain",octet:"application/octet-stream"},n=new XMLHttpRequest;function i(t,n){e.error&&e.error(t,n)}if(!e.url)return!1;n.open((e.type||"get").toUpperCase(),e.url,!0),e.headers?.["Content-Type"]||n.setRequestHeader("Content-Type",t[e.dataType||"json"]||t.text),(0,c.objectEach)(e.headers,function(e,t){n.setRequestHeader(t,e)}),e.responseType&&(n.responseType=e.responseType),n.onreadystatechange=function(){let t;if(4===n.readyState){if(200===n.status){if("blob"!==e.responseType&&(t=n.responseText,"json"===e.dataType))try{t=JSON.parse(t)}catch(e){if(e instanceof Error)return i(n,e)}return e.success?.(t,n)}i(n,n.responseText)}},e.data&&"string"!=typeof e.data&&(e.data=JSON.stringify(e.data)),n.send(e.data)},getJSON:function(e,t){A.ajax({url:e,success:t,dataType:"json",headers:{"Content-Type":"text/plain"}})}};A.post=async function(e,t,n){let i=new R.FormData;(0,c.objectEach)(t,function(e,t){i.append(t,e)}),i.append("b64","true");let r=await R.fetch(e,{method:"POST",body:i,...n});if(r.ok){let e=await r.text(),n=document.createElement("a");n.href=`data:${t.type};base64,${e}`,n.download=t.filename,n.click(),(0,c.discardElement)(n)}};let{defaultOptions:N,setOptions:P}=h(),{composed:M,doc:D,isFirefox:H,isMS:L,isSafari:I,SVG_NS:U,win:G}=h();p().allowedAttributes.push("data-z-index","fill-opacity","filter","preserveAspectRatio","rx","ry","stroke-dasharray","stroke-linejoin","stroke-opacity","text-anchor","transform","transform-origin","version","viewBox","visibility","xmlns","xmlns:xlink"),p().allowedTags.push("desc","clippath","fedropshadow","femorphology","g","image");let j=G.URL||G.webkitURL||G;class B{constructor(e,t){this.options={},this.chart=e,this.options=t,this.btnCount=0,this.buttonOffset=0,this.divElements=[],this.svgElements=[]}static hyphenate(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})}static async imageToDataURL(e,t,n){let i=await B.loadImage(e),r=D.createElement("canvas"),o=r?.getContext("2d");if(o)return r.height=i.height*t,r.width=i.width*t,o.drawImage(i,0,0,r.width,r.height),r.toDataURL(n);throw Error("No canvas found!")}static async fetchCSS(e){try{let t=await fetch(e),n=await t.text(),i=new CSSStyleSheet;return i.replaceSync(n),i}catch{(0,c.error)(`Warning: Failed to fetch CSS from ${e}`,!1)}}static extractFontFamilies(e){return e?e.split(",").map(e=>e.trim().replace(/^['"]|['"]$/g,"")).filter(Boolean):[]}static selectorAffectsSVG(e,t){try{if(t.matches(e))return!0;return!!t.querySelector(e)}catch{return!1}}static collectSVGInlineFonts(e,t){for(let n of[e,...Array.from(e.querySelectorAll("text, tspan"))]){let e=n.getAttribute("style")||"",i=n.getAttribute("font-family")||"";if(e.indexOf("font-family")>-1){let n=e.match(/font-family\s*:\s*([^;]+)/i);for(let e of B.extractFontFamilies(n?.[1]))t.add(e)}for(let e of B.extractFontFamilies(i))t.add(e)}}static async handleStyleSheet(e,t,n,i,r=new Set){let o=e.href;if(o){if(r.has(o))return;r.add(o)}try{for(let a of Array.from(e.cssRules)){if(a instanceof CSSImportRule)try{let e=await B.fetchCSS(a.href);e&&await B.handleStyleSheet(e,t,n,i,r)}catch{}if(a instanceof CSSStyleRule&&B.selectorAffectsSVG(a.selectorText,i))for(let e of B.extractFontFamilies(a.style.fontFamily))n.add(e);if(a instanceof CSSFontFaceRule){let e=a.cssText;if(o){let t=/url\(\s*(['"]?)(?![a-z]+:|\/\/)([^'")]+?)\1\s*\)/gi;e=e.replace(t,(e,t,n)=>{let i=new URL(n,o).href;return`url(${t}${i}${t})`})}t.push(e)}}}catch(e){if("SecurityError"===e.name&&o)try{let e=await B.fetchCSS(o);e&&await B.handleStyleSheet(e,t,n,i,r)}catch{}}}static async fetchStyleSheets(e){let t=[],n=new Set;for(let i of(B.collectSVGInlineFonts(e,n),Array.from(D.styleSheets)))await B.handleStyleSheet(i,t,n,e);return n.size?t.filter(e=>{let t=e.match(/font-family\s*:\s*([^;]+);?/i);return B.extractFontFamilies(t?.[1]).some(e=>n.has(e))}):t}static async inlineFonts(e){let t=await B.fetchStyleSheets(e),n=/url\(([^)]+)\)/g,i=[],r=t.join("\n"),o;for(;o=n.exec(r);){let e=o[1].replace(/['"]/g,"");i.includes(e)||i.push(e)}let a=e=>{let t="",n=new Uint8Array(e);for(let e=0;e<n.byteLength;e++)t+=String.fromCharCode(n[e]);return btoa(t)},s={};for(let e of i)try{let t=await fetch(e),n=t.headers.get("Content-Type")||"",i=a(await t.arrayBuffer());s[e]=`data:${n};base64,${i}`}catch{}r=r.replace(n,(e,t)=>{let n=t.replace(/['"]/g,"");return`url(${s[n]||n})`});let l=document.createElementNS("http://www.w3.org/2000/svg","style");return l.textContent=r,e.append(l),e}static loadImage(e){return new Promise((t,n)=>{let i=new G.Image;i.crossOrigin="Anonymous",i.onload=()=>{setTimeout(()=>{t(i)},B.loadEventDeferDelay)},i.onerror=e=>{n(e)},i.src=e})}static prepareImageOptions(e){let t=e?.type||"image/png",n=e?.libURL||N.exporting?.libURL;return{type:t,filename:(e?.filename||"chart")+"."+("image/svg+xml"===t?"svg":t.split("/")[1]),scale:e?.scale||1,libURL:n?.slice(-1)!=="/"?n+"/":n}}static sanitizeDOM(e){e.querySelectorAll("foreignObject").forEach(e=>{["width","height"].forEach(t=>{let n=e.getAttribute(t);n&&e.setAttribute(t,Math.ceil(1.15*parseInt(n,10)))})})}static sanitizeSVG(e,t){let n=e.lastIndexOf("</svg>");return n>-1&&(e=e.substr(0,n+6)),e=e.replace(/(<(?:img|br).*?(?=\>))>/g,"$1 />").replace(/(<svg(?![^>]*xmlns=)[^>]*)>/g,'$1 xmlns="http://www.w3.org/2000/svg">').replace(/zIndex="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery\d+="[^"]+"/g,"").replace(/url\(("|")(.*?)("|")\;?\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ (NS\d+\:)?href=/g," xlink:href=").replace(/(<image[^>]*) xlink:href=/g,"$1 href=").replace(/\n+/g," ").replace(/ /g,"\xa0").replace(/­/g,"\xad")}static svgToDataURL(e){let t=G.navigator.userAgent,n=t.indexOf("WebKit")>-1&&0>t.indexOf("Chrome");try{if(!n&&-1===e.indexOf("<foreignObject"))return j.createObjectURL(new G.Blob([e],{type:"image/svg+xml;charset-utf-16"}))}catch{}return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(e)}addButton(e){let t,n=this,i=n.chart,r=i.renderer,o=(0,c.merge)(i.options.navigation?.buttonOptions,e),a=o.onclick,s=o.menuItems,l=o.symbolSize||12;if(!1===o.enabled||!o.theme)return;let h=i.styledMode?{}:o.theme,d=()=>{};a?d=function(e){e&&e.stopPropagation(),a.call(i,e,i)}:s&&(d=function(e){e&&e.stopPropagation(),n.contextMenu(p.menuClassName,s,p.translateX||0,p.translateY||0,p.width||0,p.height||0,p),p.setState(2)}),o.text&&o.symbol?h.paddingLeft=(0,c.pick)(h.paddingLeft,30):o.text||(0,c.extend)(h,{width:o.width,height:o.height,padding:0});let p=r.button(o.text||"",0,0,d,h,void 0,void 0,void 0,void 0,o.useHTML).addClass(e.className||"").attr({title:(0,c.pick)(i.options.lang[o._titleKey||o.titleKey],"")});p.menuClassName=e.menuClassName||"highcharts-menu-"+n.btnCount++,o.symbol&&(t=r.symbol(o.symbol,Math.round((o.symbolX||0)-l/2),Math.round((o.symbolY||0)-l/2),l,l,{width:l,height:l}).addClass("highcharts-button-symbol").attr({zIndex:1}).add(p),i.styledMode||t.attr({stroke:o.symbolStroke,fill:o.symbolFill,"stroke-width":o.symbolStrokeWidth||1})),p.add(n.group).align((0,c.extend)(o,{width:p.width,x:(0,c.pick)(o.x,n.buttonOffset)}),!0,"spacingBox"),n.buttonOffset+=((p.width||0)+(o.buttonSpacing||0))*("right"===o.align?-1:1),n.svgElements.push(p,t)}afterPrint(){let e=this.chart;if(!this.printReverseInfo)return;let{childNodes:t,origDisplay:n,resetParams:i}=this.printReverseInfo;this.moveContainers(e.renderTo),[].forEach.call(t,function(e,t){1===e.nodeType&&(e.style.display=n[t]||"")}),this.isPrinting=!1,i&&e.setSize.apply(e,i),delete this.printReverseInfo,B.printingChart=void 0,(0,c.fireEvent)(e,"afterPrint")}beforePrint(){let e=this.chart,t=D.body,n=this.options.printMaxWidth,i={childNodes:t.childNodes,origDisplay:[],resetParams:void 0};this.isPrinting=!0,e.pointer?.reset(void 0,0),(0,c.fireEvent)(e,"beforePrint"),n&&e.chartWidth>n&&(i.resetParams=[e.options.chart.width,void 0,!1],e.setSize(n,void 0,!1)),[].forEach.call(i.childNodes,function(e,t){1===e.nodeType&&(i.origDisplay[t]=e.style.display,e.style.display="none")}),this.moveContainers(t),this.printReverseInfo=i}contextMenu(e,t,n,i,r,o,a){let s=this,l=s.chart,h=l.options.navigation,{chartWidth:d,chartHeight:u}=l,g="cache-"+e,f=Math.max(r,o),m,y=l[g];y||(s.contextMenuEl=l[g]=y=(0,c.createElement)("div",{className:e},{position:"absolute",zIndex:1e3,padding:f+"px",pointerEvents:"auto",...l.renderer.style},l.scrollablePlotArea?.fixedDiv||l.container),m=(0,c.createElement)("ul",{className:"highcharts-menu"},l.styledMode?{}:{listStyle:"none",margin:0,padding:0},y),l.styledMode||(0,c.css)(m,(0,c.extend)({MozBoxShadow:"3px 3px 10px #0008",WebkitBoxShadow:"3px 3px 10px #0008",boxShadow:"3px 3px 10px #0008"},h?.menuStyle||{})),y.hideMenu=function(){(0,c.css)(y,{display:"none"}),a&&a.setState(0),l.exporting&&(l.exporting.openMenu=!1),(0,c.css)(l.renderTo,{overflow:"hidden"}),(0,c.css)(l.container,{overflow:"hidden"}),(0,c.internalClearTimeout)(y.hideTimer),(0,c.fireEvent)(l,"exportMenuHidden")},s.events?.push((0,c.addEvent)(y,"mouseleave",function(){y.hideTimer=G.setTimeout(y.hideMenu,500)}),(0,c.addEvent)(y,"mouseenter",function(){(0,c.internalClearTimeout)(y.hideTimer)}),(0,c.addEvent)(D,"mouseup",function(t){l.pointer?.inClass(t.target,e)||y.hideMenu()}),(0,c.addEvent)(y,"click",function(){l.exporting?.openMenu&&y.hideMenu()})),t.forEach(function(e){if("string"==typeof e&&s.options.menuItemDefinitions?.[e]&&(e=s.options.menuItemDefinitions[e]),(0,c.isObject)(e,!0)){let t;e.separator?(t=(0,c.createElement)("li",{className:"highcharts-menu-item highcharts-separator",role:"separator"},void 0,m),l.styledMode||(0,c.css)(t,{border:"none",backgroundColor:"var(--highcharts-neutral-color-40)",height:"0.5px",margin:"10px 0",padding:0,listStyle:"none","pointer-events":"none"})):("viewData"===e.textKey&&s.isDataTableVisible&&(e.textKey="hideData"),t=(0,c.createElement)("li",{className:"highcharts-menu-item",onclick:function(t){t&&t.stopPropagation(),y.hideMenu(),"string"!=typeof e&&e.onclick&&e.onclick.apply(l,arguments)}},void 0,m),p().setElementHTML(t,e.text||l.options.lang[e.textKey]),l.styledMode||(t.onmouseover=function(){(0,c.css)(this,h?.menuItemHoverStyle||{})},t.onmouseout=function(){(0,c.css)(this,h?.menuItemStyle||{})},(0,c.css)(t,(0,c.extend)({cursor:"pointer"},h?.menuItemStyle||{})))),s.divElements.push(t)}}),s.divElements.push(m,y),s.menuHeight=y.offsetHeight,s.menuWidth=y.offsetWidth);let x={display:"block"};n+(s.menuWidth||0)>d?x.right=d-n-r-f+"px":x.left=n-f+"px",i+o+(s.menuHeight||0)>u&&a.alignOptions?.verticalAlign!=="top"?x.bottom=u-i-f+"px":x.top=i+o-f+"px",(0,c.css)(y,x),(0,c.css)(l.renderTo,{overflow:""}),(0,c.css)(l.container,{overflow:""}),l.exporting&&(l.exporting.openMenu=!0),(0,c.fireEvent)(l,"exportMenuShown")}destroy(e){let t,n=e?e.target:this.chart,{divElements:i,events:r,svgElements:o}=this;o.forEach((e,i)=>{e&&(e.onclick=e.ontouchstart=null,n[t="cache-"+e.menuClassName]&&delete n[t],o[i]=e.destroy())}),o.length=0,this.group&&(this.group.destroy(),delete this.group),i.forEach(function(e,t){e&&((0,c.internalClearTimeout)(e.hideTimer),(0,c.removeEvent)(e,"mouseleave"),i[t]=e.onmouseout=e.onmouseover=e.ontouchstart=e.onclick=null,(0,c.discardElement)(e))}),i.length=0,r&&(r.forEach(function(e){e()}),r.length=0)}async downloadSVG(e,t){let n,i={svg:e,exportingOptions:t,exporting:this};if((0,c.fireEvent)(B.prototype,"downloadSVG",i),i.defaultPrevented)return;let{type:r,filename:o,scale:a,libURL:s}=B.prepareImageOptions(t);if("application/pdf"===r)throw Error("Offline exporting logic for PDF type is not found.");if("image/svg+xml"===r){if(void 0!==G.MSBlobBuilder){let t=new G.MSBlobBuilder;t.append(e),n=t.getBlob("image/svg+xml")}else n=B.svgToDataURL(e);S(n,o)}else{n=B.svgToDataURL(e);try{B.objectURLRevoke=!0;let e=await B.imageToDataURL(n,a,r);S(e,o)}catch(d){if("No canvas found!"===d.message)throw d;if(e.length>1e8)throw Error("Input too long");let t=D.createElement("canvas"),n=t.getContext("2d"),i=e.match(/^<svg[^>]*\s{,1000}width\s{,1000}=\s{,1000}\"?(\d+)\"?[^>]*>/),h=e.match(/^<svg[^>]*\s{0,1000}height\s{,1000}=\s{,1000}\"?(\d+)\"?[^>]*>/);if(n&&i&&h){let d=i[1]*a,p=h[1]*a;if(t.width=d,t.height=p,!G.canvg){var l;if(!s)throw Error("Image export requires canvg. Set exporting.libURL or preload canvg.");B.objectURLRevoke=!0,await (l=s+"canvg.js",new Promise((e,t)=>{let n=w.getElementsByTagName("head")[0],i=w.createElement("script");i.type="text/javascript",i.src=l,i.onload=()=>{e()},i.onerror=()=>{let e=`Error loading script ${l}`;(0,c.error)(e),t(Error(e))},n.appendChild(i)}))}G.canvg.Canvg.fromString(n,e).start(),S(G.navigator.msSaveOrOpenBlob?t.msToBlob():t.toDataURL(r),o)}}finally{if(B.objectURLRevoke)try{j.revokeObjectURL(n)}catch{}}}}async exportChart(e,t){if((e=(0,c.merge)(this.options,e)).local)await this.localExport(e,t||{});else{let n=await this.getSVGForExport(e,t);e.url&&await A.post(e.url,{filename:e.filename?e.filename.replace(/\//g,"-"):this.getFilename(),type:e.type,width:e.width,scale:e.scale,svg:n},e.fetchOptions)}}async fallbackToServer(e,t){!1===e.fallbackToExportServer?e.error?e.error(e,t):(0,c.error)(t?.message||28,!0,this.chart):"application/pdf"===e.type?(e.local=!1,await this.exportChart(e)):(0,c.error)(t.message,!1)}getChartHTML(e){let t=this.chart;return e&&this.inlineStyles(),this.resolveCSSVariables(),B.sanitizeDOM(t.renderer.box),t.container.querySelectorAll("canvas").forEach(function(e){let n=e.toDataURL("image/png"),i=e.parentNode,r=t.renderer.image(n,0,0,e.width,e.height);(0,c.css)(r.element,{width:e.style.width,height:e.style.height}),i.parentNode.insertBefore(r.element,i),i.remove()}),t.container.innerHTML}getFilename(){let e=this.chart.userOptions.title?.text,t=this.options.filename;return t?t.replace(/\//g,"-"):("string"==typeof e&&(t=e.toLowerCase().replace(/<\/?[^>]+(>|$)/g,"").replace(/[\s_]+/g,"-").replace(/[^a-z\d\-]/g,"").replace(/^[\-]+/g,"").replace(/[\-]+/g,"-").substr(0,24).replace(/[\-]+$/g,"")),(!t||t.length<5)&&(t="chart"),t)}getSVG(e,t){let n=this.chart,i,r,o=(0,c.merge)(n.options,e);o.plotOptions=(0,c.merge)(n.userOptions.plotOptions,e?.plotOptions),o.time=(0,c.merge)(n.userOptions.time,e?.time);let a=(0,c.createElement)("div",void 0,{position:"absolute",top:"-9999em",width:n.chartWidth+"px",height:n.chartHeight+"px"},D.body),s=n.renderTo.style.width,l=n.renderTo.style.height,h=o.exporting?.sourceWidth||o.chart.width||/px$/.test(s)&&parseInt(s,10)||(o.isGantt?800:600),d=o.exporting?.sourceHeight||o.chart.height||/px$/.test(l)&&parseInt(l,10)||400;(0,c.extend)(o.chart,{animation:!1,renderTo:a,forExport:!0,renderer:"SVGRenderer",width:h,height:d}),o.exporting&&(o.exporting.enabled=!1),delete o.data,o.series=[],n.series.forEach(function(e){(r=(0,c.merge)(e.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:e.visible})).isInternal||o?.series?.push(r)});let p={};n.axes.forEach(function(e){e.userOptions.internalKey||(e.userOptions.internalKey=(0,c.uniqueKey)()),o&&!e.options.isInternal&&(p[e.coll]||(p[e.coll]=!0,o[e.coll]=[]),o[e.coll].push((0,c.merge)(e.userOptions,{visible:e.visible,type:e.type,uniqueNames:e.uniqueNames})))}),o.colorAxis=n.userOptions.colorAxis;let u=t=>{e&&["xAxis","yAxis","series"].forEach(function(n){e[n]&&t.update({[n]:e[n]})}),n.axes.forEach(function(n){let i=(0,c.find)(t.axes,e=>e.options.internalKey===n.userOptions.internalKey);if(i){let t=n.getExtremes(),r=(0,c.splat)(e?.[n.coll]||{})[0],o="min"in r?r.min:t.userMin,a="max"in r?r.max:t.userMax;(void 0!==o&&o!==i.min||void 0!==a&&a!==i.max)&&i.setExtremes(o??void 0,a??void 0,!0,!1)}});let r=t.exporting;return r?.options.applyStyleSheets&&this.applyShadowDOMStyles(t),(0,c.fireEvent)(n,"getSVG",{chartCopy:t}),i=r?.getChartHTML(n.styledMode||o?.exporting?.applyStyleSheets)||"",i=B.sanitizeSVG(i,o),(0,c.fireEvent)(n,"afterGetSVG",{chartCopy:t,svg:i}),o=void 0,t.destroy(),(0,c.discardElement)(a),i};return t?new Promise(e=>new n.constructor(o||{},function(t){n.callback?.call(this,t);let i=(0,c.addEvent)(this,"render",function(){i(),e(u(this))})})):u(new n.constructor(o,n.callback))}applyShadowDOMStyles(e){let t=this.chart,n=[],i=t.container,r;for(;i&&(!(r=i.getRootNode())||"object"!=typeof r.host);)i=i.parentNode,r=null;r?.querySelectorAll("style").forEach(t=>{let i=t.cloneNode(!0);e.renderer.defs.element.appendChild(i),n.push(i)}),(0,c.addEvent)(t,"afterGetSVG",()=>{n.forEach(e=>{e.remove()})})}async getSVGForExport(e,t){let n=this.options;return await this.getSVG((0,c.merge)({chart:{borderRadius:0}},n.chartOptions,t,{exporting:{sourceWidth:e?.sourceWidth||n.sourceWidth,sourceHeight:e?.sourceHeight||n.sourceHeight}}),!0)}inlineStyles(){let e,t=B.inlineDenylist,n=B.inlineAllowlist,i={},r=(0,c.createElement)("iframe",void 0,{width:"1px",height:"1px",visibility:"hidden"},D.body),o=r.contentWindow?.document;o&&o.body.appendChild(o.createElementNS(U,"svg")),!function r(a){let s,l,h,d,p,u,g={};if(o&&1===a.nodeType&&-1===B.unstyledElements.indexOf(a.nodeName)){if(s=G.getComputedStyle(a,null),l="svg"===a.nodeName?{}:G.getComputedStyle(a.parentNode,null),!i[a.nodeName]){e=o.getElementsByTagName("svg")[0],h=o.createElementNS(a.namespaceURI,a.nodeName),e.appendChild(h);let t=G.getComputedStyle(h,null),n={};for(let e in t)e.length<1e3&&"string"==typeof t[e]&&!/^\d+$/.test(e)&&(n[e]=t[e]);i[a.nodeName]=n,"text"===a.nodeName&&delete i.text.fill,e.removeChild(h)}for(let e in s)(H||L||I||Object.hasOwnProperty.call(s,e))&&function(e,r){if(d=p=!1,n.length){for(u=n.length;u--&&!p;)p=n[u].test(r);d=!p}for("transform"===r&&"none"===e&&(d=!0),u=t.length;u--&&!d;){if(r.length>1e3)throw Error("Input too long");d=t[u].test(r)||"function"==typeof e}!d&&(l[r]!==e||"svg"===a.nodeName)&&i[a.nodeName][r]!==e&&(B.inlineToAttributes&&-1===B.inlineToAttributes.indexOf(r)?g[r]=e:e&&a.setAttribute(B.hyphenate(r),e))}(s[e],e);if((0,c.css)(a,g),"svg"===a.nodeName&&a.setAttribute("stroke-width","1px"),"text"===a.nodeName)return;[].forEach.call(a.children||a.childNodes,r)}}(this.chart.container.querySelector("svg")),e.parentNode.removeChild(e),r.parentNode.removeChild(r)}async localExport(e,t){let n=this.chart,i,r,o=null,a;if(L&&n.styledMode&&!B.inlineAllowlist.length&&B.inlineAllowlist.push(/^blockSize/,/^border/,/^caretColor/,/^color/,/^columnRule/,/^columnRuleColor/,/^cssFloat/,/^cursor/,/^fill$/,/^fillOpacity/,/^font/,/^inlineSize/,/^length/,/^lineHeight/,/^opacity/,/^outline/,/^parentRule/,/^rx$/,/^ry$/,/^stroke/,/^textAlign/,/^textAnchor/,/^textDecoration/,/^transform/,/^vectorEffect/,/^visibility/,/^x$/,/^y$/),L&&("application/pdf"===e.type||n.container.getElementsByTagName("image").length&&"image/svg+xml"!==e.type)||"application/pdf"===e.type&&[].some.call(n.container.getElementsByTagName("image"),function(e){let t=e.getAttribute("href");return""!==t&&"string"==typeof t&&0!==t.indexOf("data:")}))return void await this.fallbackToServer(e,Error("Image type not supported for this chart/browser."));let s=(0,c.addEvent)(n,"afterGetSVG",e=>{r=e.chartCopy.options,a=(i=e.chartCopy.container.cloneNode(!0))&&i.getElementsByTagName("image")||[]});try{let n;for(let n of(await this.getSVGForExport(e,t),a?Array.from(a):[]))if(o=n.getAttributeNS("http://www.w3.org/1999/xlink","href")){B.objectURLRevoke=!1;let t=await B.imageToDataURL(o,e?.scale||1,e?.type||"image/png");n.setAttributeNS("http://www.w3.org/1999/xlink","href",t)}else n.parentNode.removeChild(n);let s=i?.querySelector("svg");s&&!e.chartOptions?.chart?.style?.fontFamily&&await B.inlineFonts(s);let l=(n=i?.innerHTML,B.sanitizeSVG(n||"",r));if(l.indexOf("<foreignObject")>-1&&"image/svg+xml"!==e.type&&(L||"application/pdf"===e.type))throw Error("Image type not supported for charts with embedded HTML");return await this.downloadSVG(l,(0,c.extend)({filename:this.getFilename()},e)),l}catch(t){await this.fallbackToServer(e,t)}finally{s()}}moveContainers(e){let t=this.chart,{scrollablePlotArea:n}=t;(n?[n.fixedDiv,n.scrollingContainer]:[t.container]).forEach(function(t){e.appendChild(t)})}print(){let e=this.chart;this.isPrinting||(B.printingChart=e,I||this.beforePrint(),setTimeout(()=>{G.focus(),G.print(),I||setTimeout(()=>{e.exporting?.afterPrint()},1e3)},1))}render(){let e=this,{chart:t,options:n}=e,i=e?.isDirty||!e?.svgElements.length;e.buttonOffset=0,e.isDirty&&e.destroy(),i&&!1!==n.enabled&&(e.events=[],e.group||(e.group=t.renderer.g("exporting-group").attr({zIndex:3}).add()),(0,c.objectEach)(n?.buttons,function(t){e.addButton(t)}),e.isDirty=!1)}resolveCSSVariables(){Array.from(this.chart.container.querySelectorAll("*")).forEach(e=>{["color","fill","stop-color","stroke"].forEach(t=>{let n=e.getAttribute(t);n?.includes("var(")&&e.setAttribute(t,getComputedStyle(e).getPropertyValue(t));let i=e.style?.[t];i?.includes("var(")&&(e.style[t]=getComputedStyle(e).getPropertyValue(t))})})}update(e,t){this.isDirty=!0,(0,c.merge)(!0,this.options,e),(0,c.pick)(t,!0)&&this.chart.redraw()}}B.inlineAllowlist=[],B.inlineDenylist=[/-/,/^(clipPath|cssText|d|height|width)$/,/^font$/,/[lL]ogical(Width|Height)$/,/^parentRule$/,/^(cssRules|ownerRules)$/,/perspective/,/TapHighlightColor/,/^transition/,/^length$/,/^\d+$/],B.inlineToAttributes=["fill","stroke","strokeLinecap","strokeLinejoin","strokeWidth","textAnchor","x","y"],B.loadEventDeferDelay=150*!!L,B.unstyledElements=["clipPath","defs","desc"],function(e){function t(e){let t=e.exporting;t&&(t.render(),(0,c.addEvent)(e,"redraw",function(){this.exporting?.render()}),(0,c.addEvent)(e,"destroy",function(){this.exporting?.destroy()}))}function n(){let t=this;t.options.exporting&&(t.exporting=new e(t,t.options.exporting),y.compose(t).navigation.addUpdate((e,n)=>{t.exporting&&(t.exporting.isDirty=!0,(0,c.merge)(!0,t.options.navigation,e),(0,c.pick)(n,!0)&&t.redraw())}))}function i({alignTo:e,key:t,textPxLength:n}){let i=this.options.exporting,{align:r,buttonSpacing:o=0,verticalAlign:a,width:s=0}=(0,c.merge)(this.options.navigation?.buttonOptions,i?.buttons?.contextButton),l=e.width-n,h=s+o;(i?.enabled??!0)&&"title"===t&&"right"===r&&"top"===a&&l<2*h&&(l<h?e.width-=h:this.title?.alignValue!=="left"&&(e.x-=h-l/2))}e.compose=function(r,o){O.compose(o),k.compose(r),(0,c.pushUnique)(M,"Exporting")&&((0,c.extend)(g().prototype,{exportChart:async function(e,t){await this.exporting?.exportChart(e,t)},getChartHTML:function(e){return this.exporting?.getChartHTML(e)},getFilename:function(){return this.exporting?.getFilename()},getSVG:function(e){return this.exporting?.getSVG(e,!1)},print:function(){return this.exporting?.print()}}),r.prototype.callbacks.push(t),(0,c.addEvent)(r,"afterInit",n),(0,c.addEvent)(r,"layOutTitle",i),I&&G.matchMedia("print").addListener(function(t){e.printingChart&&(t.matches?e.printingChart.exporting?.beforePrint():e.printingChart.exporting?.afterPrint())}),P(C))}}(B||(B={}));let V=h();V.Exporting=B,V.HttpUtilities=V.HttpUtilities||A,V.ajax=V.HttpUtilities.ajax,V.getJSON=V.HttpUtilities.getJSON,V.post=V.HttpUtilities.post,B.compose(V.Chart,V.Renderer);let $=h();return l.default})());