realmap-react
Version:
Wooritech map chart component library
18 lines (16 loc) • 15.3 kB
JavaScript
/**
* RealMap React v1.0.5
* Copyright (C) 2023-2025 WooriTech Inc.
* All Rights Reserved.
*/
import e,{useRef as t,useState as r,useEffect as n,memo as o,forwardRef as i,useImperativeHandle as s}from"react";function a(e){const t=e.map,r=e.series;if(Array.isArray(t)){for(const e of t)if(e.url)return!1}else if("object"==typeof t&&(null==t?void 0:t.url))return!1;if(Array.isArray(r))for(const e of r)if(e.dataUrl)return!1;return!0}function c({license:e,realmapModule:o,config:i,elRef:s,animate:c,onChartLoaded:p}){const l=t(!1),[f,u]=r(null);return n((()=>{!l.current&&s.current&&(l.current=!0,(async t=>{e&&o.setLicenseKey(e);const r=a(t)?o.createChart(document,s.current,t,c,p):await o.createChartAsync(document,s.current,t,c,p);u(r)})(i))}),[]),{mapChart:f}}var p,l={exports:{}},f={};var u,d={};
/**
* @license React
* react-dom.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/"production"===process.env.NODE_ENV?(!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){if("production"!==process.env.NODE_ENV)throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}}(),l.exports=function(){if(p)return f;p=1;var t=e;function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var o={d:{f:n,r:function(){throw Error(r(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal"),s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}return f.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,f.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(r(299));return function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:i,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}(e,t,null,n)},f.flushSync=function(e){var t=s.T,r=o.p;try{if(s.T=null,o.p=2,e)return e()}finally{s.T=t,o.p=r,o.d.f()}},f.preconnect=function(e,t){"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,o.d.C(e,t))},f.prefetchDNS=function(e){"string"==typeof e&&o.d.D(e)},f.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var r=t.as,n=a(r,t.crossOrigin),i="string"==typeof t.integrity?t.integrity:void 0,s="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===r?o.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:n,integrity:i,fetchPriority:s}):"script"===r&&o.d.X(e,{crossOrigin:n,integrity:i,fetchPriority:s,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},f.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var r=a(t.as,t.crossOrigin);o.d.M(e,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&o.d.M(e)},f.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var r=t.as,n=a(r,t.crossOrigin);o.d.L(e,r,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},f.preloadModule=function(e,t){if("string"==typeof e)if(t){var r=a(t.as,t.crossOrigin);o.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else o.d.m(e)},f.requestFormReset=function(e){o.d.r(e)},f.unstable_batchedUpdates=function(e,t){return e(t)},f.useFormState=function(e,t,r){return s.H.useFormState(e,t,r)},f.useFormStatus=function(){return s.H.useHostTransitionStatus()},f.version="19.1.0",f}()):l.exports=(u||(u=1,"production"!==process.env.NODE_ENV&&function(){function t(){}function r(e){return""+e}function n(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}function o(e){return null===e?"`null`":void 0===e?"`undefined`":""===e?"an empty string":'something with type "'+typeof e+'"'}function i(e){return null===e?"`null`":void 0===e?"`undefined`":""===e?"an empty string":"string"==typeof e?JSON.stringify(e):"number"==typeof e?"`"+e+"`":'something with type "'+typeof e+'"'}function s(){var e=l.H;return null===e&&console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."),e}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=e,c={d:{f:t,r:function(){throw Error("Invalid form element. requestFormReset must be passed a form that was rendered by React.")},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},p=Symbol.for("react.portal"),l=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;"function"==typeof Map&&null!=Map.prototype&&"function"==typeof Map.prototype.forEach&&"function"==typeof Set&&null!=Set.prototype&&"function"==typeof Set.prototype.clear&&"function"==typeof Set.prototype.forEach||console.error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,d.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error("Target container is not a DOM element.");return function(e,t,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;try{r(o);var i=!1}catch(e){i=!0}return i&&(console.error("The provided key is an unsupported type %s. This value must be coerced to a string before using it here.","function"==typeof Symbol&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object"),r(o)),{$$typeof:p,key:null==o?null:""+o,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},d.flushSync=function(e){var t=l.T,r=c.p;try{if(l.T=null,c.p=2,e)return e()}finally{l.T=t,c.p=r,c.d.f()&&console.error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.")}},d.preconnect=function(e,t){"string"==typeof e&&e?null!=t&&"object"!=typeof t?console.error("ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",i(t)):null!=t&&"string"!=typeof t.crossOrigin&&console.error("ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",o(t.crossOrigin)):console.error("ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",o(e)),"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,c.d.C(e,t))},d.prefetchDNS=function(e){if("string"==typeof e&&e){if(1<arguments.length){var t=arguments[1];"object"==typeof t&&t.hasOwnProperty("crossOrigin")?console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",i(t)):console.error("ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",i(t))}}else console.error("ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",o(e));"string"==typeof e&&c.d.D(e)},d.preinit=function(e,t){if("string"==typeof e&&e?null==t||"object"!=typeof t?console.error("ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",i(t)):"style"!==t.as&&"script"!==t.as&&console.error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',i(t.as)):console.error("ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",o(e)),"string"==typeof e&&t&&"string"==typeof t.as){var r=t.as,s=n(r,t.crossOrigin),a="string"==typeof t.integrity?t.integrity:void 0,p="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===r?c.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:s,integrity:a,fetchPriority:p}):"script"===r&&c.d.X(e,{crossOrigin:s,integrity:a,fetchPriority:p,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},d.preinitModule=function(e,t){var r="";"string"==typeof e&&e||(r+=" The `href` argument encountered was "+o(e)+"."),void 0!==t&&"object"!=typeof t?r+=" The `options` argument encountered was "+o(t)+".":t&&"as"in t&&"script"!==t.as&&(r+=" The `as` option encountered was "+i(t.as)+"."),r?console.error("ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",r):"script"===(r=t&&"string"==typeof t.as?t.as:"script")||(r=i(r),console.error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',r,e)),"string"==typeof e&&("object"==typeof t&&null!==t?null!=t.as&&"script"!==t.as||(r=n(t.as,t.crossOrigin),c.d.M(e,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})):null==t&&c.d.M(e))},d.preload=function(e,t){var r="";if("string"==typeof e&&e||(r+=" The `href` argument encountered was "+o(e)+"."),null==t||"object"!=typeof t?r+=" The `options` argument encountered was "+o(t)+".":"string"==typeof t.as&&t.as||(r+=" The `as` option encountered was "+o(t.as)+"."),r&&console.error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',r),"string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var i=n(r=t.as,t.crossOrigin);c.d.L(e,r,{crossOrigin:i,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},d.preloadModule=function(e,t){var r="";"string"==typeof e&&e||(r+=" The `href` argument encountered was "+o(e)+"."),void 0!==t&&"object"!=typeof t?r+=" The `options` argument encountered was "+o(t)+".":t&&"as"in t&&"string"!=typeof t.as&&(r+=" The `as` option encountered was "+o(t.as)+"."),r&&console.error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',r),"string"==typeof e&&(t?(r=n(t.as,t.crossOrigin),c.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0})):c.d.m(e))},d.requestFormReset=function(e){c.d.r(e)},d.unstable_batchedUpdates=function(e,t){return e(t)},d.useFormState=function(e,t,r){return s().useFormState(e,t,r)},d.useFormStatus=function(){return s().useHostTransitionStatus()},d.version="19.1.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),d);var y=l.exports;const g={position:"absolute",width:0,height:0,overflow:"hidden",opacity:0};function h({templates:t}){const[o,i]=r(null);return n((()=>{const e=document.createElement("div");return e.classList.add("rm-template-container"),Object.assign(e.style,g),document.body.appendChild(e),i(e),()=>{e&&document.body.removeChild(e)}}),[]),o?y.createPortal(Object.keys(t).map((r=>e.createElement("div",{key:r,id:r},t[r]))),o):null}var m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};const O=o(i(((r,o)=>{var{license:i,realmap:p,id:l="realmap",w:f="100%",h:u="100%",config:d,animate:y=!0,onChartLoaded:g,style:O,templates:_}=r,v=m(r,["license","realmap","id","w","h","config","animate","onChartLoaded","style","templates"]);const S=t(null),{mapChart:b}=c({realmapModule:p,license:i,elRef:S,config:d,onChartLoaded:g});return function({config:e,chart:t}){n((()=>{t&&e&&"object"==typeof e&&(a(e)?t.load(e):t.loadAsync(e))}),[e])}({chart:b,config:d}),s(o,(()=>({realmap:b})),[b]),e.createElement(e.Fragment,null,e.createElement("div",Object.assign({id:l,ref:S,style:Object.assign({width:f,height:u},O)},v)),e.createElement(h,{templates:_}))})));export{O as RealMapReact};
//# sourceMappingURL=realmap-react.mjs.map