realchart-export
Version:
Wooritech realchart exporting moudle
8 lines (6 loc) • 20 kB
JavaScript
/**
* RealChart-Export v1.1.7
* Copyright (C) 2023-2025 WooriTech Inc.
* All Rights Reserved.
*/
const e=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4)}${e}`)})();function t(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function n(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function r(e,t={}){return{width:t.width||function(e){const t=n(e,"border-left-width"),r=n(e,"border-right-width");return e.clientWidth+t+r}(e),height:t.height||function(e){const t=n(e,"border-top-width"),r=n(e,"border-bottom-width");return e.clientHeight+t+r}(e)}}const o=16384;function i(e){return new Promise(((t,n)=>{const r=new Image;r.decode=()=>t(r),r.onload=()=>t(r),r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function s(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),async function(e){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(e))).then(encodeURIComponent).then((e=>`data:image/svg+xml;charset=utf-8,${e}`))}(o)}const c=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||c(n,t))};function a(e,n,r){const o=`.${e}:${n}`,i=r.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(r):function(e){return t(e).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(r);return document.createTextNode(`${o}{${i}}`)}function l(t,n,r){const o=window.getComputedStyle(t,r),i=o.getPropertyValue("content");if(""===i||"none"===i)return;const s=e();try{n.className=`${n.className} ${s}`}catch(e){return}const c=document.createElement("style");c.appendChild(a(s,r,o)),n.appendChild(c)}const u="application/font-woff",h="image/jpeg",d={woff:u,woff2:u,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:h,jpeg:h,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function m(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return d[t]||""}function f(e){return-1!==e.search(/^(data:)/)}function g(e,t){return`data:${t};base64,${e}`}async function p(e,t,n){const r=await fetch(e,t);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((e,t)=>{const i=new FileReader;i.onerror=t,i.onloadend=()=>{try{e(n({res:r,result:i.result}))}catch(e){t(e)}},i.readAsDataURL(o)}))}const y={};async function w(e,t,n){const r=function(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}(e,t,n.includeQueryParams);if(null!=y[r])return y[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await p(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=g(r,t)}catch(t){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${e}`;t&&(r="string"==typeof t?t:t.message),r&&console.warn(r)}return y[r]=o,o}async function v(e,t){return c(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):i(t)}(e):c(e,HTMLVideoElement)?async function(e,t){if(e.currentSrc){const t=document.createElement("canvas"),n=t.getContext("2d");return t.width=e.clientWidth,t.height=e.clientHeight,null==n||n.drawImage(e,0,0,t.width,t.height),i(t.toDataURL())}const n=e.poster,r=m(n);return i(await w(n,r,t))}(e,t):c(e,HTMLIFrameElement)?async function(e){var t;try{if(null===(t=null==e?void 0:e.contentDocument)||void 0===t?void 0:t.body)return await E(e.contentDocument.body,{},!0)}catch(e){}return e.cloneNode(!1)}(e):e.cloneNode(!1)}const x=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase();function b(e,n){return c(n,Element)&&(function(e,n){const r=n.style;if(!r)return;const o=window.getComputedStyle(e);o.cssText?(r.cssText=o.cssText,r.transformOrigin=o.transformOrigin):t(o).forEach((t=>{let i=o.getPropertyValue(t);if("font-size"===t&&i.endsWith("px")){const e=Math.floor(parseFloat(i.substring(0,i.length-2)))-.1;i=`${e}px`}c(e,HTMLIFrameElement)&&"display"===t&&"inline"===i&&(i="block"),"d"===t&&n.getAttribute("d")&&(i=`path(${n.getAttribute("d")})`),r.setProperty(t,i,o.getPropertyPriority(t))}))}(e,n),function(e,t){l(e,t,":before"),l(e,t,":after")}(e,n),function(e,t){c(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),c(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,n),function(e,t){if(c(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,n)),n}async function E(e,n,r){return r||!n.filter||n.filter(e)?Promise.resolve(e).then((e=>v(e,n))).then((r=>async function(e,n,r){var o,i;let s=[];return s=x(e)&&e.assignedNodes?t(e.assignedNodes()):c(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?t(e.contentDocument.body.childNodes):t((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||c(e,HTMLVideoElement)||await s.reduce(((e,t)=>e.then((()=>E(t,r))).then((e=>{e&&n.appendChild(e)}))),Promise.resolve()),n}(e,r,n))).then((t=>b(e,t))).then((e=>async function(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(0===n.length)return e;const r={};for(let o=0;o<n.length;o++){const i=n[o].getAttribute("xlink:href");if(i){const n=e.querySelector(i),o=document.querySelector(i);n||!o||r[i]||(r[i]=await E(o,t,!0))}}const o=Object.values(r);if(o.length){const t="http://www.w3.org/1999/xhtml",n=document.createElementNS(t,"svg");n.setAttribute("xmlns",t),n.style.position="absolute",n.style.width="0",n.style.height="0",n.style.overflow="hidden",n.style.display="none";const r=document.createElementNS(t,"defs");n.appendChild(r);for(let e=0;e<o.length;e++)r.appendChild(o[e]);e.appendChild(n)}return e}(e,n))):null}const $=/url\((['"]?)([^'"]+?)\1\)/g,C=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,S=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function R(e,t,n,r,o){try{const i=n?function(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}(t,n):t,s=m(t);let c;if(o){c=g(await o(i),s)}else c=await w(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${c}$3`)}catch(e){}return e}function L(e){return-1!==e.search($)}async function T(e,t,n){if(!L(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(S,(e=>{for(;;){const[n,,r]=C.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace($,((e,n,r)=>(t.push(r),e))),t.filter((e=>!f(e)))}(r);return o.reduce(((e,r)=>e.then((e=>R(e,r,t,n)))),Promise.resolve(r))}async function _(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await T(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function k(e,n){c(e,Element)&&(await async function(e,t){await _("background",e,t)||await _("background-image",e,t),await _("mask",e,t)||await _("mask-image",e,t)}(e,n),await async function(e,t){const n=c(e,HTMLImageElement);if((!n||f(e.src))&&(!c(e,SVGImageElement)||f(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await w(r,m(r),t);await new Promise(((t,r)=>{e.onload=t,e.onerror=r;const i=e;i.decode&&(i.decode=t),"lazy"===i.loading&&(i.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,n),await async function(e,n){const r=t(e.childNodes).map((e=>k(e,n)));await Promise.all(r).then((()=>e))}(e,n))}const I={};async function P(e){let t=I[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},I[e]=t,t}async function A(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),p(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function N(e){if(null==e)return[];const t=[];let n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const e=r.exec(n);if(null===e)break;t.push(e[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let e=o.exec(n);if(null===e){if(e=i.exec(n),null===e)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(e[0])}return t}async function M(e,n){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=t(e.ownerDocument.styleSheets),o=await async function(e,n){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{t(r.cssRules||[]).forEach(((e,t)=>{if(e.type===CSSRule.IMPORT_RULE){let i=t+1;const s=P(e.href).then((e=>A(e,n))).then((e=>N(e).forEach((e=>{try{r.insertRule(e,e.startsWith("@import")?i+=1:r.cssRules.length)}catch(t){console.error("Error inserting rule from remote css",{rule:e,error:t})}})))).catch((e=>{console.error("Error loading remote css",e.toString())}));o.push(s)}}))}catch(t){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(P(r.href).then((e=>A(e,n))).then((e=>N(e).forEach((e=>{i.insertRule(e,r.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",t)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{t(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,n);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>L(e.style.getPropertyValue("src"))))}(o)}async function H(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await async function(e,t){const n=await M(e,t);return(await Promise.all(n.map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return T(e.cssText,n,t)})))).join("\n")}(e,t);if(n){const t=document.createElement("style"),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function D(e,t={}){const{width:n,height:o}=r(e,t),i=await E(e,t,!0);await H(i,t),await k(i,t),function(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;null!=r&&Object.keys(r).forEach((e=>{n[e]=r[e]}))}(i,t);return await s(i,n,o)}async function j(e,t={}){const{width:n,height:s}=r(e,t),c=await D(e,t),a=await i(c),l=document.createElement("canvas"),u=l.getContext("2d"),h=t.pixelRatio||function(){let e,t;try{t=process}catch(e){}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}(),d=t.canvasWidth||n,m=t.canvasHeight||s;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>o||e.height>o)&&(e.width>o&&e.height>o?e.width>e.height?(e.height*=o/e.width,e.width=o):(e.width*=o/e.height,e.height=o):e.width>o?(e.height*=o/e.width,e.width=o):(e.width*=o/e.height,e.height=o))}(l),l.style.width=`${d}`,l.style.height=`${m}`,t.backgroundColor&&(u.fillStyle=t.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.drawImage(a,0,0,l.width,l.height),l}class O{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",c=t.fileName||n.fileName||"realchart",a=document.createElement("div");a.classList.add("rct-export-indicator"),a.style.position="absolute",a.style.width="40px",a.style.height="40px",a.style.top=(r.height+40)/2+"px",a.style.left=(r.width+40)/2+"px",e.appendChild(a);const l=["rct-feedbacks","rct-tooltip"];o.hideNavigator&&l.push("rct-navigator"),o.hideScrollbar&&l.push("rct-axis-scrollbar"),o.hideZoomButton&&l.push("rct-reset-zoom");let u,h={};switch(h.width=r.width,h.height=r.height,h.canvasWidth=r.width*i,h.canvasHeight=r.height*i,h.filter=e=>{var t;return"none"!==(null===(t=e.style)||void 0===t?void 0:t.display)&&!l.some((t=>{var n;return null===(n=e.classList)||void 0===n?void 0:n.contains(t)}))},h.pixelRatio=1,s){case"png":u=async function(e,t={}){return(await j(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await j(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=D(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${c}.${s}`,t.href=e,t.click(),a&&a.remove()})),a&&a.remove()}}class B{export(e,t,n){}$_removeItems(e,t){e.querySelectorAll(t).forEach((e=>{e.remove()}))}$_removeAriaLabelRecursively(e){e.hasAttribute("aria-label")&&e.removeAttribute("aria-label");const t=e.children;for(let e=0;e<t.length;e++)this.$_removeAriaLabelRecursively(t[e])}$_removeHiddenElementsRecursively(e){if("none"===window.getComputedStyle(e).display||"none"===e.style.display)return void e.parentNode.removeChild(e);const t=e.children;for(let e=0;e<t.length;e++)this.$_removeHiddenElementsRecursively(t[e])}}var U=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))};class V extends B{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realchart",s=e.getBoundingClientRect(),c=o.width?o.width/s.width:o.scale||1,a=document.createElement("canvas"),l=a.getContext("2d");a.width=s.width,a.height=s.height,e.appendChild(a);const u=document.createElement("div");u.classList.add("rct-export-indicator"),u.style.position="absolute",u.style.width="40px",u.style.height="40px",u.style.top=(s.height+40)/2+"px",u.style.left=(s.width+40)/2+"px";const h=e.cloneNode(!0);e.appendChild(u);const d=()=>{const n=new Image;n.onload=function(){l.drawImage(n,0,0,a.width,a.height);const e=a.width*c,r=a.height*c,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(a,0,0,a.width,a.height,0,0,e,r);const h=o.toDataURL(`image/${t.type}`),d=document.createElement("a");d.href=h,d.download=`${i}.${t.type}`,d.click(),u&&u.remove()},h.querySelectorAll("g").forEach((e=>{0===e.childElementCount&&e.remove()})),this.$_removeItems(h,".rct-contextmenu-button"),this.$_removeItems(h,".rct-feedbacks"),this.$_removeItems(h,".rct-tooltip"),this.$_removeItems(h,".rct-crosshair-flag"),this.$_removeItems(h,".rct-crosshair-flag-text"),o.hideNavigator&&this.$_removeItems(h,".rct-navigator"),o.hideScrollbar&&this.$_removeItems(h,".rct-axis-scrollbar"),o.hideZoomButton&&this.$_removeItems(h,".rct-reset-zoom"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rct-svg");r.style.background=getComputedStyle(e).background,r.style.backgroundColor=getComputedStyle(e).backgroundColor,this.$_imagesToBase64(h,(()=>U(this,void 0,void 0,(function*(){const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),c=this.$_getUsedStyles(r),a=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${c.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(a),d=5e4;let m="";if(l.length/d>1)for(let e=0;e<l.length/d;e++)m+=String.fromCharCode.apply(null,l.slice(e*d,(e+1)*d));else m=String.fromCharCode.apply(null,l);try{n.src="data:image/svg+xml;base64,"+btoa(m)}catch(e){const r=o.url||"https://exporter.realchart.co.kr/api";fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t.type,size:{width:s.width,height:s.height},dom:h.outerHTML})}).then((e=>e.json())).then((({data:e})=>{n.src=`data:image/png;base64,${e}`})).catch((e=>{u&&u.remove(),console.log("error"),console.error("Error:",e)}))}}))))},m=h.style.backgroundImage;if(m&&"none"!==m&&"initial"!==m){const e=null===(r=m.match(/^url\(["']?(.*?)["']?\)$/))||void 0===r?void 0:r[1];if(e){const t=new Image;t.onload=()=>{l.drawImage(t,0,0,a.width,a.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=[],n=(e.ownerDocument||document).styleSheets;for(const[r,o]of Object.entries(n))try{for(let n=0;n<o.cssRules.length;n++){const r=o.cssRules[n];let i=!1;try{i=e.querySelectorAll(r.selectorText).length>0}catch(e){}i&&t.push(r.cssText)}}catch(e){}return t}$_imagesToBase64(e,t){var n;function r(e){return fetch(e).then((e=>e.blob())).then((e=>new Promise(((t,n)=>{const r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})))).catch((e=>{throw console.error("Error:",e),e}))}const o=[],i=e.style.backgroundImage;if(i&&"none"!==i){const t=null===(n=i.match(/^url\(["']?(.*?)["']?\)$/))||void 0===n?void 0:n[1];if(t){const n=r(t).then((t=>{e.style.backgroundImage=`url(${t})`})).catch((e=>{console.warn("Failed to convert background image to base64",e)}));o.push(n)}}const s=e.querySelectorAll("image");s.length>0&&s.forEach((e=>{const t=e.getAttribute("href");if(t){const n=r(t).then((t=>{e.setAttribute("href",t)}));o.push(n)}})),Promise.all(o).then((()=>t()))}}class F{constructor(e,t,n){this._imageExporter=new V,this._libraryExporter=new O,this._chart=n,this.render(e,t)}exportToImage(e,t,n){n&&(n.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,n):this._imageExporter.export(e,t,n))}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}render(e,t){const n=t.parentElement,r=this._chart.options.exporting||{},o=e.getElementsByClassName("rct-contextmenu-button");for(const e of Array.from(o))e.remove();if(!r.visible)return;this._contextmenuButton&&(this._contextmenuButton.remove(),this._contextmenuButton=null,this._contextmenu=null),n.style.position="relative";const i=this._contextmenuButton=e.createElement("div");i.classList.add("rct-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rct-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const c=e.createElement("ul");c.classList.add("rct-contextmenu-list"),s.appendChild(c),i.appendChild(s),n.appendChild(i);const a=n.getBoundingClientRect();i.style.display="block",i.style.top="20px",i.style.left=a.width-i.clientWidth-11+"px",s.style.top=i.clientHeight+"px",c.innerHTML="",r.menus.forEach((n=>{const o=e.createElement("li");o.classList.add("rct-contextmenu-item"),o.id=n;const i={type:n,fileName:r.fileName};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i,this._chart.options.exporting);break;default:return void console.error("지원하지 않는 타입입니다.")}c.appendChild(o)}))}}class q{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(q))}static createExporter(e,t,n){return new F(e,t,n)}}q.MODULE_NAME="$$realchart_export";const z=q.use;export{z as RealchartExport};