realmap 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/band.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Band v1.1.13
3
+ * RealMap Band v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/band.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Band v1.1.13
3
+ * RealMap Band v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/chart.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Chart v1.1.13
3
+ * RealMap Chart v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/chart.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Chart v1.1.13
3
+ * RealMap Chart v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/design.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Design v1.1.13
3
+ * RealMap Design v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/design.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Design v1.1.13
3
+ * RealMap Design v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/editing.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Editing v1.1.13
3
+ * RealMap Editing v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/editing.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Editing v1.1.13
3
+ * RealMap Editing v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/export.d.ts CHANGED
@@ -6,11 +6,19 @@ declare class RealMapExporter {
6
6
  private _contextmenuButton;
7
7
  private _contextmenu;
8
8
  private _chart;
9
+ private _docPointerDownHandler;
10
+ private _doc;
9
11
  /**
10
12
  * @private
11
13
  * 컨트롤 내부에서 자동 생성되므로 이 생성자를 직접 호출할 일은 없다.
12
14
  */
13
15
  constructor(doc: Document, dom: HTMLElement, chart: MapChart);
16
+ /**
17
+ * @private
18
+ * #565: 차트 파괴(React 언마운트 등) 시 호출되어 document 리스너와 버튼 DOM을 정리한다.
19
+ * 정리하지 않으면 차트가 여러 번 생성/파괴될 때 document에 죽은 리스너가 누적된다.
20
+ */
21
+ dispose(): void;
14
22
  exportToImage(dom: HTMLElement, options: ExportOptions): void;
15
23
  isContextMenuVisible(): boolean;
16
24
  toggleContextMenu(): void;
package/export.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealMap Export v1.1.13
3
+ * RealMap Export v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).$$_RealMapExporter={})}(this,(function(e){"use strict";const t=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function n(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let r=null;function o(e={}){return r||(e.includeStyleProperties?(r=e.includeStyleProperties,r):(r=n(window.getComputedStyle(document.documentElement)),r))}function i(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function s(e,t={}){return{width:t.width||function(e){const t=i(e,"border-left-width"),n=i(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=i(e,"border-top-width"),n=i(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const a=16384;function c(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function l(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 u=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||u(n,t))};function h(e,t,n,r){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return o(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,r);return document.createTextNode(`${i}{${s}}`)}function d(e,n,r,o){const i=window.getComputedStyle(e,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=t();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(h(a,r,i,o)),n.appendChild(c)}const m="application/font-woff",f="image/jpeg",p={woff:m,woff2:m,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:f,jpeg:f,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return p[t]||""}function y(e){return-1!==e.search(/^(data:)/)}function w(e,t){return`data:${t};base64,${e}`}async function x(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 b={};async function v(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!=b[r])return b[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await x(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=w(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 b[r]=o,o}async function E(e,t){return u(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):c(t)}(e):u(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),c(t.toDataURL())}const n=e.poster,r=g(n);return c(await v(n,r,t))}(e,t):u(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await R(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode($(e))}const S=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),$=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function C(e,t,n){return u(t,Element)&&(function(e,t,n){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):o(n).forEach((n=>{let o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){const e=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o=`${e}px`}u(e,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(n,o,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){d(e,t,":before",n),d(e,t,":after",n)}(e,t,n),function(e,t){u(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),u(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(u(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function R(e,t,r){return r||!t.filter||t.filter(e)?Promise.resolve(e).then((e=>E(e,t))).then((r=>async function(e,t,r){var o,i;if($(t))return t;let s=[];return s=S(e)&&e.assignedNodes?n(e.assignedNodes()):u(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?n(e.contentDocument.body.childNodes):n((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||u(e,HTMLVideoElement)||await s.reduce(((e,n)=>e.then((()=>R(n,r))).then((e=>{e&&t.appendChild(e)}))),Promise.resolve()),t}(e,r,t))).then((n=>C(e,n,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 R(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,t))):null}const L=/url\((['"]?)([^'"]+?)\1\)/g,_=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function T(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=g(t);let a;if(o){a=w(await o(i),s)}else a=await v(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function A(e){return-1!==e.search(L)}async function I(e,t,n){if(!A(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(k,(e=>{for(;;){const[n,,r]=_.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(L,((e,n,r)=>(t.push(r),e))),t.filter((e=>!y(e)))}(r);return o.reduce(((e,r)=>e.then((e=>T(e,r,t,n)))),Promise.resolve(r))}async function P(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await I(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function N(e,t){u(e,Element)&&(await async function(e,t){await P("background",e,t)||await P("background-image",e,t),await P("mask",e,t)||await P("-webkit-mask",e,t)||await P("mask-image",e,t)||await P("-webkit-mask-image",e,t)}(e,t),await async function(e,t){const n=u(e,HTMLImageElement);if((!n||y(e.src))&&(!u(e,SVGImageElement)||y(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await v(r,g(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,t),await async function(e,t){const r=n(e.childNodes).map((e=>N(e,t)));await Promise.all(r).then((()=>e))}(e,t))}const M={};async function H(e){let t=M[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},M[e]=t,t}async function D(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),x(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function j(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 F(e,t){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=n(e.ownerDocument.styleSheets),o=await async function(e,t){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{n(r.cssRules||[]).forEach(((e,n)=>{if(e.type===CSSRule.IMPORT_RULE){let i=n+1;const s=H(e.href).then((e=>D(e,t))).then((e=>j(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(n){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(H(r.href).then((e=>D(e,t))).then((e=>j(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",n)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{n(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,t);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>A(e.style.getPropertyValue("src"))))}(o)}function V(e){return e.trim().replace(/["']/g,"")}async function B(e,t){const n=await F(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(V(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(V(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return I(e.cssText,n,t)})))).join("\n")}async function U(e,t={}){const{width:n,height:r}=s(e,t),o=await R(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await B(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)}}(o,t),await N(o,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]}))}(o,t);return await l(o,n,r)}async function O(e,t={}){const{width:n,height:r}=s(e,t),o=await U(e,t),i=await c(o),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||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>a||e.height>a)&&(e.width>a&&e.height>a?e.width>e.height?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a):e.width>a?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a))}(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(i,0,0,l.width,l.height),l}class q{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];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 O(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await O(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=U(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class z{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])}}class W extends z{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-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,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.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,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),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){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.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,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}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, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class G{constructor(e,t,n){this._imageExporter=new W,this._libraryExporter=new q,this._chart=n,this.$_render(e,t)}exportToImage(e,t){const n=this._chart.exporter,r={useLibrary:n.prop("useLibrary"),width:n.prop("width"),scale:n.prop("scale"),fileName:n.prop("fileName"),url:n.prop("url")};r.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,r):this._imageExporter.export(e,t,r)}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.exporter,o=e.getElementsByClassName("rm-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("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.prop("menus").forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.prop("fileName")};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class X{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(X))}static createExporter(e,t,n){return new G(e,t,n)}}X.MODULE_NAME="$$realmap_export";const J=X.use;e.RealMapExport=J}));
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).$$_RealMapExporter={})}(this,(function(e){"use strict";const t=(()=>{let e=0;return()=>(e+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${e}`)})();function n(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let r=null;function o(e={}){return r||(e.includeStyleProperties?(r=e.includeStyleProperties,r):(r=n(window.getComputedStyle(document.documentElement)),r))}function i(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function s(e,t={}){return{width:t.width||function(e){const t=i(e,"border-left-width"),n=i(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=i(e,"border-top-width"),n=i(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const a=16384;function c(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function l(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 u=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||u(n,t))};function h(e,t,n,r){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return o(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,r);return document.createTextNode(`${i}{${s}}`)}function d(e,n,r,o){const i=window.getComputedStyle(e,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=t();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(h(a,r,i,o)),n.appendChild(c)}const m="application/font-woff",f="image/jpeg",p={woff:m,woff2:m,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:f,jpeg:f,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function g(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return p[t]||""}function y(e){return-1!==e.search(/^(data:)/)}function w(e,t){return`data:${t};base64,${e}`}async function x(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 v={};async function b(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!=v[r])return v[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await x(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=w(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 v[r]=o,o}async function E(e,t){return u(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):c(t)}(e):u(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),c(t.toDataURL())}const n=e.poster,r=g(n);return c(await b(n,r,t))}(e,t):u(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await _(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode($(e))}const S=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),$=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function C(e,t,n){return u(t,Element)&&(function(e,t,n){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):o(n).forEach((n=>{let o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){const e=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o=`${e}px`}u(e,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(n,o,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){d(e,t,":before",n),d(e,t,":after",n)}(e,t,n),function(e,t){u(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),u(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(u(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function _(e,t,r){return r||!t.filter||t.filter(e)?Promise.resolve(e).then((e=>E(e,t))).then((r=>async function(e,t,r){var o,i;if($(t))return t;let s=[];return s=S(e)&&e.assignedNodes?n(e.assignedNodes()):u(e,HTMLIFrameElement)&&(null===(o=e.contentDocument)||void 0===o?void 0:o.body)?n(e.contentDocument.body.childNodes):n((null!==(i=e.shadowRoot)&&void 0!==i?i:e).childNodes),0===s.length||u(e,HTMLVideoElement)||await s.reduce(((e,n)=>e.then((()=>_(n,r))).then((e=>{e&&t.appendChild(e)}))),Promise.resolve()),t}(e,r,t))).then((n=>C(e,n,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 _(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,t))):null}const R=/url\((['"]?)([^'"]+?)\1\)/g,L=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,k=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function T(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=g(t);let a;if(o){a=w(await o(i),s)}else a=await b(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function P(e){return-1!==e.search(R)}async function A(e,t,n){if(!P(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(k,(e=>{for(;;){const[n,,r]=L.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(R,((e,n,r)=>(t.push(r),e))),t.filter((e=>!y(e)))}(r);return o.reduce(((e,r)=>e.then((e=>T(e,r,t,n)))),Promise.resolve(r))}async function I(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await A(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function N(e,t){u(e,Element)&&(await async function(e,t){await I("background",e,t)||await I("background-image",e,t),await I("mask",e,t)||await I("-webkit-mask",e,t)||await I("mask-image",e,t)||await I("-webkit-mask-image",e,t)}(e,t),await async function(e,t){const n=u(e,HTMLImageElement);if((!n||y(e.src))&&(!u(e,SVGImageElement)||y(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await b(r,g(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o}))}(e,t),await async function(e,t){const r=n(e.childNodes).map((e=>N(e,t)));await Promise.all(r).then((()=>e))}(e,t))}const M={};async function H(e){let t=M[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},M[e]=t,t}async function D(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),x(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function B(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 V(e,t){if(null==e.ownerDocument)throw new Error("Provided element is not within a Document");const r=n(e.ownerDocument.styleSheets),o=await async function(e,t){const r=[],o=[];return e.forEach((r=>{if("cssRules"in r)try{n(r.cssRules||[]).forEach(((e,n)=>{if(e.type===CSSRule.IMPORT_RULE){let i=n+1;const s=H(e.href).then((e=>D(e,t))).then((e=>B(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(n){const i=e.find((e=>null==e.href))||document.styleSheets[0];null!=r.href&&o.push(H(r.href).then((e=>D(e,t))).then((e=>B(e).forEach((e=>{i.insertRule(e,i.cssRules.length)})))).catch((e=>{console.error("Error loading remote stylesheet",e)}))),console.error("Error inlining remote css file",n)}})),Promise.all(o).then((()=>(e.forEach((e=>{if("cssRules"in e)try{n(e.cssRules||[]).forEach((e=>{r.push(e)}))}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}})),r)))}(r,t);return function(e){return e.filter((e=>e.type===CSSRule.FONT_FACE_RULE)).filter((e=>P(e.style.getPropertyValue("src"))))}(o)}function j(e){return e.trim().replace(/["']/g,"")}async function F(e,t){const n=await V(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(j(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(j(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return A(e.cssText,n,t)})))).join("\n")}async function U(e,t={}){const{width:n,height:r}=s(e,t),o=await _(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await F(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)}}(o,t),await N(o,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]}))}(o,t);return await l(o,n,r)}async function O(e,t={}){const{width:n,height:r}=s(e,t),o=await U(e,t),i=await c(o),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||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>a||e.height>a)&&(e.width>a&&e.height>a?e.width>e.height?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a):e.width>a?(e.height*=a/e.width,e.width=a):(e.width*=a/e.height,e.height=a))}(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(i,0,0,l.width,l.height),l}class q{export(e,t,n){const r=e.getBoundingClientRect(),o=n||{},i=o.width?o.width/r.width:o.scale||1,s=t.type||"png",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];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 O(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await O(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=U(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class z{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])}}class W extends z{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-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,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.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,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),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){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.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,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}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, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class G{constructor(e,t,n){this._imageExporter=new W,this._libraryExporter=new q,this._chart=n,this.$_render(e,t),this._doc=e,this._docPointerDownHandler=e=>{this._contextmenu&&this.isContextMenuVisible()&&!this.contains(e.target)&&this.hideContextMenu()},e.addEventListener("pointerdown",this._docPointerDownHandler,!0)}dispose(){var e,t;this._docPointerDownHandler&&(null===(e=this._doc)||void 0===e||e.removeEventListener("pointerdown",this._docPointerDownHandler,!0),this._docPointerDownHandler=null),null===(t=this._contextmenuButton)||void 0===t||t.remove(),this._contextmenuButton=null,this._contextmenu=null,this._doc=null,this._chart=null}exportToImage(e,t){const n=this._chart.exporter,r={useLibrary:n.prop("useLibrary"),width:n.prop("width"),scale:n.prop("scale"),fileName:n.prop("fileName"),url:n.prop("url")};r.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,r):this._imageExporter.export(e,t,r)}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.exporter,o=n.getElementsByClassName("rm-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("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.prop("menus").forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.prop("fileName")};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class X{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(X))}static createExporter(e,t,n){return new G(e,t,n)}}X.MODULE_NAME="$$realmap_export";const J=X.use;e.RealMapExport=J}));
package/export.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
- * RealMap Export v1.1.13
3
+ * RealMap Export v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
7
- 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}let n=null;function r(e={}){return n||(e.includeStyleProperties?(n=e.includeStyleProperties,n):(n=t(window.getComputedStyle(document.documentElement)),n))}function o(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function i(e,t={}){return{width:t.width||function(e){const t=o(e,"border-left-width"),n=o(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=o(e,"border-top-width"),n=o(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const s=16384;function a(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function c(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 l=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||l(n,t))};function u(e,t,n,o){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return r(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,o);return document.createTextNode(`${i}{${s}}`)}function h(t,n,r,o){const i=window.getComputedStyle(t,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=e();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(u(a,r,i,o)),n.appendChild(c)}const d="application/font-woff",m="image/jpeg",f={woff:d,woff2:d,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:m,jpeg:m,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function p(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return f[t]||""}function g(e){return-1!==e.search(/^(data:)/)}function y(e,t){return`data:${t};base64,${e}`}async function w(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 x={};async function b(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!=x[r])return x[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await w(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=y(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 x[r]=o,o}async function v(e,t){return l(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):a(t)}(e):l(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),a(t.toDataURL())}const n=e.poster,r=p(n);return a(await b(n,r,t))}(e,t):l(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await C(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode(S(e))}const E=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),S=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function $(e,t,n){return l(t,Element)&&(function(e,t,n){const o=t.style;if(!o)return;const i=window.getComputedStyle(e);i.cssText?(o.cssText=i.cssText,o.transformOrigin=i.transformOrigin):r(n).forEach((n=>{let r=i.getPropertyValue(n);if("font-size"===n&&r.endsWith("px")){const e=Math.floor(parseFloat(r.substring(0,r.length-2)))-.1;r=`${e}px`}l(e,HTMLIFrameElement)&&"display"===n&&"inline"===r&&(r="block"),"d"===n&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){h(e,t,":before",n),h(e,t,":after",n)}(e,t,n),function(e,t){l(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),l(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(l(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function C(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;if(S(n))return n;let s=[];return s=E(e)&&e.assignedNodes?t(e.assignedNodes()):l(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||l(e,HTMLVideoElement)||await s.reduce(((e,t)=>e.then((()=>C(t,r))).then((e=>{e&&n.appendChild(e)}))),Promise.resolve()),n}(e,r,n))).then((t=>$(e,t,n))).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 C(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 R=/url\((['"]?)([^'"]+?)\1\)/g,L=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,_=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function k(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=p(t);let a;if(o){a=y(await o(i),s)}else a=await b(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function T(e){return-1!==e.search(R)}async function A(e,t,n){if(!T(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(_,(e=>{for(;;){const[n,,r]=L.exec(e)||[];if(!r)return"";if(r===t)return`src: ${n};`}})):e}(e,n),o=function(e){const t=[];return e.replace(R,((e,n,r)=>(t.push(r),e))),t.filter((e=>!g(e)))}(r);return o.reduce(((e,r)=>e.then((e=>k(e,r,t,n)))),Promise.resolve(r))}async function I(e,t,n){var r;const o=null===(r=t.style)||void 0===r?void 0:r.getPropertyValue(e);if(o){const r=await A(o,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function P(e,n){l(e,Element)&&(await async function(e,t){await I("background",e,t)||await I("background-image",e,t),await I("mask",e,t)||await I("-webkit-mask",e,t)||await I("mask-image",e,t)||await I("-webkit-mask-image",e,t)}(e,n),await async function(e,t){const n=l(e,HTMLImageElement);if((!n||g(e.src))&&(!l(e,SVGImageElement)||g(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await b(r,p(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.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=>P(e,n)));await Promise.all(r).then((()=>e))}(e,n))}const N={};async function M(e){let t=N[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},N[e]=t,t}async function H(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),w(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function D(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 F(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=M(e.href).then((e=>H(e,n))).then((e=>D(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(M(r.href).then((e=>H(e,n))).then((e=>D(e).forEach((e=>{i.insertRule(e,i.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=>T(e.style.getPropertyValue("src"))))}(o)}function V(e){return e.trim().replace(/["']/g,"")}async function j(e,t){const n=await F(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(V(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(V(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return A(e.cssText,n,t)})))).join("\n")}async function B(e,t={}){const{width:n,height:r}=i(e,t),o=await C(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await j(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)}}(o,t),await P(o,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]}))}(o,t);return await c(o,n,r)}async function U(e,t={}){const{width:n,height:r}=i(e,t),o=await B(e,t),c=await a(o),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||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>s||e.height>s)&&(e.width>s&&e.height>s?e.width>e.height?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s):e.width>s?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s))}(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(c,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",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];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 U(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await U(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=B(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class q{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])}}class z extends q{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-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,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.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,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),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){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.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,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}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, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class W{constructor(e,t,n){this._imageExporter=new z,this._libraryExporter=new O,this._chart=n,this.$_render(e,t)}exportToImage(e,t){const n=this._chart.exporter,r={useLibrary:n.prop("useLibrary"),width:n.prop("width"),scale:n.prop("scale"),fileName:n.prop("fileName"),url:n.prop("url")};r.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,r):this._imageExporter.export(e,t,r)}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.exporter,o=e.getElementsByClassName("rm-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("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.prop("menus").forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.prop("fileName")};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class G{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(G))}static createExporter(e,t,n){return new W(e,t,n)}}G.MODULE_NAME="$$realmap_export";const X=G.use;export{X as RealMapExport};
7
+ 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}let n=null;function r(e={}){return n||(e.includeStyleProperties?(n=e.includeStyleProperties,n):(n=t(window.getComputedStyle(document.documentElement)),n))}function o(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function i(e,t={}){return{width:t.width||function(e){const t=o(e,"border-left-width"),n=o(e,"border-right-width");return e.clientWidth+t+n}(e),height:t.height||function(e){const t=o(e,"border-top-width"),n=o(e,"border-bottom-width");return e.clientHeight+t+n}(e)}}const s=16384;function a(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then((()=>{requestAnimationFrame((()=>t(r)))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e}))}async function c(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 l=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return null!==n&&(n.constructor.name===t.name||l(n,t))};function u(e,t,n,o){const i=`.${e}:${t}`,s=n.cssText?function(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}(n):function(e,t){return r(t).map((t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?" !important":""};`)).join(" ")}(n,o);return document.createTextNode(`${i}{${s}}`)}function h(t,n,r,o){const i=window.getComputedStyle(t,r),s=i.getPropertyValue("content");if(""===s||"none"===s)return;const a=e();try{n.className=`${n.className} ${a}`}catch(e){return}const c=document.createElement("style");c.appendChild(u(a,r,i,o)),n.appendChild(c)}const d="application/font-woff",m="image/jpeg",f={woff:d,woff2:d,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:m,jpeg:m,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function p(e){const t=function(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}(e).toLowerCase();return f[t]||""}function g(e){return-1!==e.search(/^(data:)/)}function y(e,t){return`data:${t};base64,${e}`}async function w(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 x={};async function v(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!=x[r])return x[r];let o;n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());try{const r=await w(e,n.fetchRequestInit,(({res:e,result:n})=>(t||(t=e.headers.get("Content-Type")||""),function(e){return e.split(/,/)[1]}(n))));o=y(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 x[r]=o,o}async function b(e,t){return l(e,HTMLCanvasElement)?async function(e){const t=e.toDataURL();return"data:,"===t?e.cloneNode(!1):a(t)}(e):l(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),a(t.toDataURL())}const n=e.poster,r=p(n);return a(await v(n,r,t))}(e,t):l(e,HTMLIFrameElement)?async function(e,t){var n;try{if(null===(n=null==e?void 0:e.contentDocument)||void 0===n?void 0:n.body)return await C(e.contentDocument.body,t,!0)}catch(e){}return e.cloneNode(!1)}(e,t):e.cloneNode(S(e))}const E=e=>null!=e.tagName&&"SLOT"===e.tagName.toUpperCase(),S=e=>null!=e.tagName&&"SVG"===e.tagName.toUpperCase();function $(e,t,n){return l(t,Element)&&(function(e,t,n){const o=t.style;if(!o)return;const i=window.getComputedStyle(e);i.cssText?(o.cssText=i.cssText,o.transformOrigin=i.transformOrigin):r(n).forEach((n=>{let r=i.getPropertyValue(n);if("font-size"===n&&r.endsWith("px")){const e=Math.floor(parseFloat(r.substring(0,r.length-2)))-.1;r=`${e}px`}l(e,HTMLIFrameElement)&&"display"===n&&"inline"===r&&(r="block"),"d"===n&&t.getAttribute("d")&&(r=`path(${t.getAttribute("d")})`),o.setProperty(n,r,i.getPropertyPriority(n))}))}(e,t,n),function(e,t,n){h(e,t,":before",n),h(e,t,":after",n)}(e,t,n),function(e,t){l(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),l(e,HTMLInputElement)&&t.setAttribute("value",e.value)}(e,t),function(e,t){if(l(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find((t=>e.value===t.getAttribute("value")));r&&r.setAttribute("selected","")}}(e,t)),t}async function C(e,n,r){return r||!n.filter||n.filter(e)?Promise.resolve(e).then((e=>b(e,n))).then((r=>async function(e,n,r){var o,i;if(S(n))return n;let s=[];return s=E(e)&&e.assignedNodes?t(e.assignedNodes()):l(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||l(e,HTMLVideoElement)||await s.reduce(((e,t)=>e.then((()=>C(t,r))).then((e=>{e&&n.appendChild(e)}))),Promise.resolve()),n}(e,r,n))).then((t=>$(e,t,n))).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 C(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,R=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,L=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function k(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=p(t);let a;if(o){a=y(await o(i),s)}else a=await v(i,s,r);return e.replace(function(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}(t),`$1${a}$3`)}catch(e){}return e}function P(e){return-1!==e.search(_)}async function T(e,t,n){if(!P(e))return e;const r=function(e,{preferredFontFormat:t}){return t?e.replace(L,(e=>{for(;;){const[n,,r]=R.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=>!g(e)))}(r);return o.reduce(((e,r)=>e.then((e=>k(e,r,t,n)))),Promise.resolve(r))}async function A(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 I(e,n){l(e,Element)&&(await async function(e,t){await A("background",e,t)||await A("background-image",e,t),await A("mask",e,t)||await A("-webkit-mask",e,t)||await A("mask-image",e,t)||await A("-webkit-mask-image",e,t)}(e,n),await async function(e,t){const n=l(e,HTMLImageElement);if((!n||g(e.src))&&(!l(e,SVGImageElement)||g(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await v(r,p(r),t);await new Promise(((r,i)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){i(e)}}:i;const s=e;s.decode&&(s.decode=r),"lazy"===s.loading&&(s.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=>I(e,n)));await Promise.all(r).then((()=>e))}(e,n))}const N={};async function H(e){let t=N[e];if(null!=t)return t;const n=await fetch(e);return t={url:e,cssText:await n.text()},N[e]=t,t}async function M(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),w(i,t.fetchRequestInit,(({result:e})=>(n=n.replace(o,`url(${e})`),[o,e])))}));return Promise.all(o).then((()=>n))}function D(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 B(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=H(e.href).then((e=>M(e,n))).then((e=>D(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(H(r.href).then((e=>M(e,n))).then((e=>D(e).forEach((e=>{i.insertRule(e,i.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=>P(e.style.getPropertyValue("src"))))}(o)}function V(e){return e.trim().replace(/["']/g,"")}async function F(e,t){const n=await B(e,t),r=function(e){const t=new Set;return function e(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((e=>{t.add(V(e))})),Array.from(n.children).forEach((t=>{t instanceof HTMLElement&&e(t)}))}(e),t}(e);return(await Promise.all(n.filter((e=>r.has(V(e.style.fontFamily)))).map((e=>{const n=e.parentStyleSheet?e.parentStyleSheet.href:null;return T(e.cssText,n,t)})))).join("\n")}async function j(e,t={}){const{width:n,height:r}=i(e,t),o=await C(e,t,!0);await async function(e,t){const n=null!=t.fontEmbedCSS?t.fontEmbedCSS:t.skipFonts?null:await F(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)}}(o,t),await I(o,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]}))}(o,t);return await c(o,n,r)}async function U(e,t={}){const{width:n,height:r}=i(e,t),o=await j(e,t),c=await a(o),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||r;return l.width=d*h,l.height=m*h,t.skipAutoScale||function(e){(e.width>s||e.height>s)&&(e.width>s&&e.height>s?e.width>e.height?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s):e.width>s?(e.height*=s/e.width,e.width=s):(e.width*=s/e.height,e.height=s))}(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(c,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",a=t.fileName||n.fileName||"realmap",c=document.createElement("div");c.classList.add("rm-export-indicator"),c.style.position="absolute",c.style.width="40px",c.style.height="40px",c.style.top=(r.height+40)/2+"px",c.style.left=(r.width+40)/2+"px",e.appendChild(c);const l=["rm-feedbacks","rm-tooltip"];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 U(e,t)).toDataURL()}(e,h);break;case"jpeg":u=async function(e,t={}){return(await U(e,t)).toDataURL("image/jpeg",t.quality||1)}(e,h);break;case"svg":u=j(e,h);break;default:console.error("유효하지 않은 타입 입니다.")}u.then((e=>{const t=document.createElement("a");t.download=`${a}.${s}`,t.href=e,t.click(),c&&c.remove()})),c&&c.remove()}}class q{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])}}class z extends q{export(e,t,n){var r;const o=n||{},i=t.fileName||n.fileName||"realmap",s=e.getBoundingClientRect(),a=o.width?o.width/s.width:o.scale||1,c=document.createElement("canvas"),l=c.getContext("2d");c.width=s.width,c.height=s.height,e.appendChild(c);const u=document.createElement("div");u.classList.add("rm-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,c.width,c.height);const e=c.width*a,r=c.height*a,o=document.createElement("canvas"),s=o.getContext("2d");o.width=e,o.height=r,s.drawImage(c,0,0,c.width,c.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,".rm-contextmenu-button"),this.$_removeItems(h,".rm-feedbacks"),this.$_removeItems(h,".rm-tooltip"),this.$_removeItems(h,".rm-crosshair-flag"),this.$_removeItems(h,".rm-crosshair-flag-text"),this.$_removeItems(h,".rm-button"),this.$_removeAriaLabelRecursively(h),this.$_removeHiddenElementsRecursively(h);const r=h.querySelector(".rm-svg"),{background:d,backgroundColor:m}=getComputedStyle(e);r.style.background=d,r.style.backgroundColor=m,this.$_imagesToBase64(h,(async()=>{const e=(new XMLSerializer).serializeToString(r),i=e.indexOf(">"),a=this.$_getUsedStyles(r),c=`\n ${e.slice(0,i+1)}\n <style type="text/css">\n ${a.join(" ")}\n </style>\n ${e.slice(i+1)}`,l=(new TextEncoder).encode(c),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){console.error("Error converting SVG to base64:",e);const r=o.url||"https://exporter.realmap.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,c.width,c.height),d()},t.onerror=()=>{console.warn("Background image failed to load"),d()},t.src=e}else d()}else d()}$_getUsedStyles(e){const t=new Set,n=(e.ownerDocument||document).styleSheets;for(const e of Array.from(n)){this.$_collectStyle(e).forEach((e=>t.add(e)))}return Array.from(t)}$_collectStyle(e){const t=[];for(let n=0;n<e.cssRules.length;n++){const r=e.cssRules[n];if(r instanceof CSSStyleRule||r instanceof CSSLayerBlockRule||r instanceof CSSLayerStatementRule)if(r instanceof CSSLayerBlockRule&&"properties"===r.name){const e=`@layer properties { ${r.cssRules[0].cssRules[0].cssText} }`;t.push(e)}else t.push(r.cssText)}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, img");s.length>0&&s.forEach((e=>{const t=e instanceof HTMLImageElement?"src":"href",n=e.getAttribute(t);if(n){const i=r(n).then((n=>{e.setAttribute(t,n)}));o.push(i)}})),Promise.all(o).then((()=>t()))}}class W{constructor(e,t,n){this._imageExporter=new z,this._libraryExporter=new O,this._chart=n,this.$_render(e,t),this._doc=e,this._docPointerDownHandler=e=>{this._contextmenu&&this.isContextMenuVisible()&&!this.contains(e.target)&&this.hideContextMenu()},e.addEventListener("pointerdown",this._docPointerDownHandler,!0)}dispose(){var e,t;this._docPointerDownHandler&&(null===(e=this._doc)||void 0===e||e.removeEventListener("pointerdown",this._docPointerDownHandler,!0),this._docPointerDownHandler=null),null===(t=this._contextmenuButton)||void 0===t||t.remove(),this._contextmenuButton=null,this._contextmenu=null,this._doc=null,this._chart=null}exportToImage(e,t){const n=this._chart.exporter,r={useLibrary:n.prop("useLibrary"),width:n.prop("width"),scale:n.prop("scale"),fileName:n.prop("fileName"),url:n.prop("url")};r.useLibrary||"svg"===t.type?this._libraryExporter.export(e,t,r):this._imageExporter.export(e,t,r)}isContextMenuVisible(){return"none"!==this._contextmenu.style.display}toggleContextMenu(){this._contextmenu&&(this._contextmenu.style.display=this.isContextMenuVisible()?"none":"block")}contains(e){var t,n;return(null===(t=this._contextmenu)||void 0===t?void 0:t.contains(e))||(null===(n=this._contextmenuButton)||void 0===n?void 0:n.contains(e))}hideContextMenu(){this._contextmenu&&(this._contextmenu.style.display="none")}$_render(e,t){const n=t.parentElement,r=this._chart.exporter,o=n.getElementsByClassName("rm-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("rm-contextmenu-button"),i.style.position="absolute",i.onclick=e=>{this.toggleContextMenu()};const s=this._contextmenu=e.createElement("div");s.classList.add("rm-contextmenu"),s.style.position="absolute",s.style.display="none",s.style.right="0px";const a=e.createElement("ul");a.classList.add("rm-contextmenu-list"),s.appendChild(a),i.appendChild(s),n.appendChild(i),n.getBoundingClientRect(),i.style.display="block",i.style.top="10px",i.style.right="8px",s.style.top=i.clientHeight+"px",a.innerHTML="",r.prop("menus").forEach((n=>{const o=e.createElement("li");o.classList.add("rm-contextmenu-item"),o.id=n;const i={type:n,fileName:r.prop("fileName")};switch(n){case"png":case"jpeg":case"svg":o.textContent="Download "+n.toLocaleUpperCase(),o.onclick=()=>this.exportToImage(t,i);break;default:return void console.error("지원하지 않는 타입입니다.")}a.appendChild(o)}))}}class G{static use(e){var t;e instanceof Object&&(null===(t=e.$ctrl)||void 0===t||t.use(G))}static createExporter(e,t,n){return new W(e,t,n)}}G.MODULE_NAME="$$realmap_export";const X=G.use;export{X as RealMapExport};
package/feature.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Feature v1.1.13
3
+ * RealMap Feature v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/feature.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Feature v1.1.13
3
+ * RealMap Feature v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/gl.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Gl v1.1.13
3
+ * RealMap Gl v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/gl.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Gl v1.1.13
3
+ * RealMap Gl v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/heatmap.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Heatmap v1.1.13
3
+ * RealMap Heatmap v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/heatmap.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * RealMap Heatmap v1.1.13
3
+ * RealMap Heatmap v1.1.14
4
4
  * Copyright (C) 2023-2026 WooriTech Inc.
5
5
  * All Rights Reserved.
6
6
  */
package/index.d.ts CHANGED
@@ -647,6 +647,11 @@ interface ChartExporter {
647
647
  toggleContextMenu: () => void;
648
648
  contains: (dom: Element) => boolean;
649
649
  hideContextMenu: () => void;
650
+ /**
651
+ * @private
652
+ * #565: 차트 파괴 시 document 리스너 등 외부 자원을 정리한다.
653
+ */
654
+ dispose: () => void;
650
655
  }
651
656
 
652
657
  /**
@@ -732,6 +737,11 @@ interface OnClickArgs extends CommonCallbackArgs {
732
737
  *
733
738
  */
734
739
  interface ChartGlobalOptions extends ChartItemOptions {
740
+ /**
741
+ * theme 이름.<br/>
742
+ * **realmap-style.css**에 기본 theme이 정의되어 있다.
743
+ */
744
+ theme?: string;
735
745
  /**
736
746
  * false가 아닌 경우 첫번째 시리즈가 'map' 시리즈가 아니면 내부적으로 자동 추가한다.<br/>
737
747
  *
@@ -1611,6 +1621,7 @@ declare abstract class RmControl extends RObject {
1611
1621
  isTesting(): boolean;
1612
1622
  doc(): Document;
1613
1623
  dom(): HTMLElement;
1624
+ setData(data: string, value?: string, container?: boolean): void;
1614
1625
  width(): number;
1615
1626
  height(): number;
1616
1627
  contentWidth(): number;
@@ -7406,6 +7417,12 @@ declare class Exporter extends ChartItem<ExporterOptions> {
7406
7417
  contains(dom: Element): boolean;
7407
7418
  hideContextMenu(): void;
7408
7419
  exportToImage(dom: HTMLElement, options: ExportOptions): void;
7420
+ /**
7421
+ * @private
7422
+ * #565: 외부 export 모듈의 자원(document 리스너, 버튼 DOM 등)을 정리한다.
7423
+ * RealMap 코어의 destroy()에서 자동 호출되며, 사용자가 직접 호출하지 않는다.
7424
+ */
7425
+ dispose(): null;
7409
7426
  }
7410
7427
 
7411
7428
  /**