@naver-maps/react
Version:
NaverMaps Component For React or Next
1,007 lines (1,003 loc) • 34.6 kB
JavaScript
import Xe, { createContext as Fr, useRef as Ze, useState as me, useEffect as ye, useContext as Lr, useMemo as $r } from "react";
var be = { exports: {} }, z = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ze;
function Wr() {
if (ze)
return z;
ze = 1;
var r = Xe, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
function f(h, v, m) {
var y, w = {}, j = null, U = null;
m !== void 0 && (j = "" + m), v.key !== void 0 && (j = "" + v.key), v.ref !== void 0 && (U = v.ref);
for (y in v)
a.call(v, y) && !u.hasOwnProperty(y) && (w[y] = v[y]);
if (h && h.defaultProps)
for (y in v = h.defaultProps, v)
w[y] === void 0 && (w[y] = v[y]);
return { $$typeof: t, type: h, key: j, ref: U, props: w, _owner: s.current };
}
return z.Fragment = n, z.jsx = f, z.jsxs = f, z;
}
var J = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Je;
function Yr() {
return Je || (Je = 1, process.env.NODE_ENV !== "production" && function() {
var r = Xe, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), h = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), U = Symbol.for("react.offscreen"), Z = Symbol.iterator, Q = "@@iterator";
function nr(e) {
if (e === null || typeof e != "object")
return null;
var i = Z && e[Z] || e[Q];
return typeof i == "function" ? i : null;
}
var V = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function O(e) {
{
for (var i = arguments.length, o = new Array(i > 1 ? i - 1 : 0), c = 1; c < i; c++)
o[c - 1] = arguments[c];
ar("error", e, o);
}
}
function ar(e, i, o) {
{
var c = V.ReactDebugCurrentFrame, g = c.getStackAddendum();
g !== "" && (i += "%s", o = o.concat([g]));
var b = o.map(function(d) {
return String(d);
});
b.unshift("Warning: " + i), Function.prototype.apply.call(console[e], console, b);
}
}
var ir = !1, or = !1, sr = !1, ur = !1, cr = !1, Te;
Te = Symbol.for("react.module.reference");
function lr(e) {
return !!(typeof e == "string" || typeof e == "function" || e === a || e === u || cr || e === s || e === m || e === y || ur || e === U || ir || or || sr || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === w || e.$$typeof === f || e.$$typeof === h || e.$$typeof === v || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === Te || e.getModuleId !== void 0));
}
function fr(e, i, o) {
var c = e.displayName;
if (c)
return c;
var g = i.displayName || i.name || "";
return g !== "" ? o + "(" + g + ")" : o;
}
function Se(e) {
return e.displayName || "Context";
}
function M(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && O("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
return e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case a:
return "Fragment";
case n:
return "Portal";
case u:
return "Profiler";
case s:
return "StrictMode";
case m:
return "Suspense";
case y:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case h:
var i = e;
return Se(i) + ".Consumer";
case f:
var o = e;
return Se(o._context) + ".Provider";
case v:
return fr(e, e.render, "ForwardRef");
case w:
var c = e.displayName || null;
return c !== null ? c : M(e.type) || "Memo";
case j: {
var g = e, b = g._payload, d = g._init;
try {
return M(d(b));
} catch {
return null;
}
}
}
return null;
}
var $ = Object.assign, q = 0, Oe, Ce, Pe, je, xe, Ae, ke;
function Ie() {
}
Ie.__reactDisabledLog = !0;
function dr() {
{
if (q === 0) {
Oe = console.log, Ce = console.info, Pe = console.warn, je = console.error, xe = console.group, Ae = console.groupCollapsed, ke = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: Ie,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
q++;
}
}
function vr() {
{
if (q--, q === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: $({}, e, {
value: Oe
}),
info: $({}, e, {
value: Ce
}),
warn: $({}, e, {
value: Pe
}),
error: $({}, e, {
value: je
}),
group: $({}, e, {
value: xe
}),
groupCollapsed: $({}, e, {
value: Ae
}),
groupEnd: $({}, e, {
value: ke
})
});
}
q < 0 && O("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var ce = V.ReactCurrentDispatcher, le;
function ee(e, i, o) {
{
if (le === void 0)
try {
throw Error();
} catch (g) {
var c = g.stack.trim().match(/\n( *(at )?)/);
le = c && c[1] || "";
}
return `
` + le + e;
}
}
var fe = !1, re;
{
var pr = typeof WeakMap == "function" ? WeakMap : Map;
re = new pr();
}
function Me(e, i) {
if (!e || fe)
return "";
{
var o = re.get(e);
if (o !== void 0)
return o;
}
var c;
fe = !0;
var g = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var b;
b = ce.current, ce.current = null, dr();
try {
if (i) {
var d = function() {
throw Error();
};
if (Object.defineProperty(d.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(d, []);
} catch (N) {
c = N;
}
Reflect.construct(e, [], d);
} else {
try {
d.call();
} catch (N) {
c = N;
}
e.call(d.prototype);
}
} else {
try {
throw Error();
} catch (N) {
c = N;
}
e();
}
} catch (N) {
if (N && c && typeof N.stack == "string") {
for (var l = N.stack.split(`
`), C = c.stack.split(`
`), R = l.length - 1, _ = C.length - 1; R >= 1 && _ >= 0 && l[R] !== C[_]; )
_--;
for (; R >= 1 && _ >= 0; R--, _--)
if (l[R] !== C[_]) {
if (R !== 1 || _ !== 1)
do
if (R--, _--, _ < 0 || l[R] !== C[_]) {
var A = `
` + l[R].replace(" at new ", " at ");
return e.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, A), A;
}
while (R >= 1 && _ >= 0);
break;
}
}
} finally {
fe = !1, ce.current = b, vr(), Error.prepareStackTrace = g;
}
var K = e ? e.displayName || e.name : "", Ge = K ? ee(K) : "";
return typeof e == "function" && re.set(e, Ge), Ge;
}
function hr(e, i, o) {
return Me(e, !1);
}
function gr(e) {
var i = e.prototype;
return !!(i && i.isReactComponent);
}
function te(e, i, o) {
if (e == null)
return "";
if (typeof e == "function")
return Me(e, gr(e));
if (typeof e == "string")
return ee(e);
switch (e) {
case m:
return ee("Suspense");
case y:
return ee("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case v:
return hr(e.render);
case w:
return te(e.type, i, o);
case j: {
var c = e, g = c._payload, b = c._init;
try {
return te(b(g), i, o);
} catch {
}
}
}
return "";
}
var ne = Object.prototype.hasOwnProperty, Ne = {}, De = V.ReactDebugCurrentFrame;
function ae(e) {
if (e) {
var i = e._owner, o = te(e.type, e._source, i ? i.type : null);
De.setExtraStackFrame(o);
} else
De.setExtraStackFrame(null);
}
function mr(e, i, o, c, g) {
{
var b = Function.call.bind(ne);
for (var d in e)
if (b(e, d)) {
var l = void 0;
try {
if (typeof e[d] != "function") {
var C = Error((c || "React class") + ": " + o + " type `" + d + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[d] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw C.name = "Invariant Violation", C;
}
l = e[d](i, d, c, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (R) {
l = R;
}
l && !(l instanceof Error) && (ae(g), O("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", o, d, typeof l), ae(null)), l instanceof Error && !(l.message in Ne) && (Ne[l.message] = !0, ae(g), O("Failed %s type: %s", o, l.message), ae(null));
}
}
}
var yr = Array.isArray;
function de(e) {
return yr(e);
}
function br(e) {
{
var i = typeof Symbol == "function" && Symbol.toStringTag, o = i && e[Symbol.toStringTag] || e.constructor.name || "Object";
return o;
}
}
function Er(e) {
try {
return Fe(e), !1;
} catch {
return !0;
}
}
function Fe(e) {
return "" + e;
}
function Le(e) {
if (Er(e))
return O("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", br(e)), Fe(e);
}
var G = V.ReactCurrentOwner, Rr = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, $e, We, ve;
ve = {};
function _r(e) {
if (ne.call(e, "ref")) {
var i = Object.getOwnPropertyDescriptor(e, "ref").get;
if (i && i.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function wr(e) {
if (ne.call(e, "key")) {
var i = Object.getOwnPropertyDescriptor(e, "key").get;
if (i && i.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function Tr(e, i) {
if (typeof e.ref == "string" && G.current && i && G.current.stateNode !== i) {
var o = M(G.current.type);
ve[o] || (O('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', M(G.current.type), e.ref), ve[o] = !0);
}
}
function Sr(e, i) {
{
var o = function() {
$e || ($e = !0, O("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
};
o.isReactWarning = !0, Object.defineProperty(e, "key", {
get: o,
configurable: !0
});
}
}
function Or(e, i) {
{
var o = function() {
We || (We = !0, O("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", i));
};
o.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: o,
configurable: !0
});
}
}
var Cr = function(e, i, o, c, g, b, d) {
var l = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: e,
key: i,
ref: o,
props: d,
// Record the component responsible for creating this element.
_owner: b
};
return l._store = {}, Object.defineProperty(l._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(l, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: c
}), Object.defineProperty(l, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: g
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
};
function Pr(e, i, o, c, g) {
{
var b, d = {}, l = null, C = null;
o !== void 0 && (Le(o), l = "" + o), wr(i) && (Le(i.key), l = "" + i.key), _r(i) && (C = i.ref, Tr(i, g));
for (b in i)
ne.call(i, b) && !Rr.hasOwnProperty(b) && (d[b] = i[b]);
if (e && e.defaultProps) {
var R = e.defaultProps;
for (b in R)
d[b] === void 0 && (d[b] = R[b]);
}
if (l || C) {
var _ = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
l && Sr(d, _), C && Or(d, _);
}
return Cr(e, l, C, g, c, G.current, d);
}
}
var pe = V.ReactCurrentOwner, Ye = V.ReactDebugCurrentFrame;
function B(e) {
if (e) {
var i = e._owner, o = te(e.type, e._source, i ? i.type : null);
Ye.setExtraStackFrame(o);
} else
Ye.setExtraStackFrame(null);
}
var he;
he = !1;
function ge(e) {
return typeof e == "object" && e !== null && e.$$typeof === t;
}
function Ue() {
{
if (pe.current) {
var e = M(pe.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
}
}
function jr(e) {
{
if (e !== void 0) {
var i = e.fileName.replace(/^.*[\\\/]/, ""), o = e.lineNumber;
return `
Check your code at ` + i + ":" + o + ".";
}
return "";
}
}
var Ve = {};
function xr(e) {
{
var i = Ue();
if (!i) {
var o = typeof e == "string" ? e : e.displayName || e.name;
o && (i = `
Check the top-level render call using <` + o + ">.");
}
return i;
}
}
function Be(e, i) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var o = xr(i);
if (Ve[o])
return;
Ve[o] = !0;
var c = "";
e && e._owner && e._owner !== pe.current && (c = " It was passed a child from " + M(e._owner.type) + "."), B(e), O('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, c), B(null);
}
}
function Ke(e, i) {
{
if (typeof e != "object")
return;
if (de(e))
for (var o = 0; o < e.length; o++) {
var c = e[o];
ge(c) && Be(c, i);
}
else if (ge(e))
e._store && (e._store.validated = !0);
else if (e) {
var g = nr(e);
if (typeof g == "function" && g !== e.entries)
for (var b = g.call(e), d; !(d = b.next()).done; )
ge(d.value) && Be(d.value, i);
}
}
}
function Ar(e) {
{
var i = e.type;
if (i == null || typeof i == "string")
return;
var o;
if (typeof i == "function")
o = i.propTypes;
else if (typeof i == "object" && (i.$$typeof === v || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
i.$$typeof === w))
o = i.propTypes;
else
return;
if (o) {
var c = M(i);
mr(o, e.props, "prop", c, e);
} else if (i.PropTypes !== void 0 && !he) {
he = !0;
var g = M(i);
O("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
}
typeof i.getDefaultProps == "function" && !i.getDefaultProps.isReactClassApproved && O("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function kr(e) {
{
for (var i = Object.keys(e.props), o = 0; o < i.length; o++) {
var c = i[o];
if (c !== "children" && c !== "key") {
B(e), O("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), B(null);
break;
}
}
e.ref !== null && (B(e), O("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
}
}
function qe(e, i, o, c, g, b) {
{
var d = lr(e);
if (!d) {
var l = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (l += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var C = jr(g);
C ? l += C : l += Ue();
var R;
e === null ? R = "null" : de(e) ? R = "array" : e !== void 0 && e.$$typeof === t ? (R = "<" + (M(e.type) || "Unknown") + " />", l = " Did you accidentally export a JSX literal instead of a component?") : R = typeof e, O("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, l);
}
var _ = Pr(e, i, o, g, b);
if (_ == null)
return _;
if (d) {
var A = i.children;
if (A !== void 0)
if (c)
if (de(A)) {
for (var K = 0; K < A.length; K++)
Ke(A[K], e);
Object.freeze && Object.freeze(A);
} else
O("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
Ke(A, e);
}
return e === a ? kr(_) : Ar(_), _;
}
}
function Ir(e, i, o) {
return qe(e, i, o, !0);
}
function Mr(e, i, o) {
return qe(e, i, o, !1);
}
var Nr = Mr, Dr = Ir;
J.Fragment = a, J.jsx = Nr, J.jsxs = Dr;
}()), J;
}
process.env.NODE_ENV === "production" ? be.exports = Wr() : be.exports = Yr();
var oe = be.exports;
const Ur = {
BACKGROUND: "bg",
BACKGROUND_DETAIL: "ol",
BICYCLE: "br",
CADASTRAL: "lp",
CTT: "ctt",
HIKING_TRAIL: "ar",
PANORAMA: "pr",
POI_KOREAN: "lko",
TRANSIT: "ts",
KOREAN: "lko",
ENGLISH: "len",
CHINESE: "lzh",
JAPANESE: "lja"
}, Vr = (r, t) => {
const n = r ?? {}, s = (t ?? []).map((u) => Ur[u]).join(".");
return n.latitude && n.longitude && (n.center = new window.naver.maps.LatLng(
n.latitude,
n.longitude
)), {
...n,
mapTypes: new window.naver.maps.MapTypeRegistry({
normal: window.naver.maps.NaverStyleMapTypeOptions.getNormalMap({
overlayType: s
}),
satellite: window.naver.maps.NaverStyleMapTypeOptions.getSatelliteMap({
overlayType: s
}),
hybrid: window.naver.maps.NaverStyleMapTypeOptions.getHybridMap({
overlayType: s
}),
terrain: window.naver.maps.NaverStyleMapTypeOptions.getTerrainMap({
overlayType: s
})
})
};
}, P = Symbol.for("@ts-pattern/matcher"), Qe = Symbol.for("@ts-pattern/isVariadic"), se = "@ts-pattern/anonymous-select-key", Ee = (r) => !!(r && typeof r == "object"), ie = (r) => r && !!r[P], T = (r, t, n) => {
if (ie(r)) {
const a = r[P](), { matched: s, selections: u } = a.match(t);
return s && u && Object.keys(u).forEach((f) => n(f, u[f])), s;
}
if (Ee(r)) {
if (!Ee(t))
return !1;
if (Array.isArray(r)) {
if (!Array.isArray(t))
return !1;
let a = [], s = [], u = [];
for (const f of r.keys()) {
const h = r[f];
ie(h) && h[Qe] ? u.push(h) : u.length ? s.push(h) : a.push(h);
}
if (u.length) {
if (u.length > 1)
throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
if (t.length < a.length + s.length)
return !1;
const f = t.slice(0, a.length), h = s.length === 0 ? [] : t.slice(-s.length), v = t.slice(a.length, s.length === 0 ? 1 / 0 : -s.length);
return a.every((m, y) => T(m, f[y], n)) && s.every((m, y) => T(m, h[y], n)) && (u.length === 0 || T(u[0], v, n));
}
return r.length === t.length && r.every((f, h) => T(f, t[h], n));
}
return Object.keys(r).every((a) => {
const s = r[a];
return (a in t || ie(u = s) && u[P]().matcherType === "optional") && T(s, t[a], n);
var u;
});
}
return Object.is(t, r);
}, x = (r) => {
var t, n, a;
return Ee(r) ? ie(r) ? (t = (n = (a = r[P]()).getSelectionKeys) == null ? void 0 : n.call(a)) != null ? t : [] : Array.isArray(r) ? H(r, x) : H(Object.values(r), x) : [];
}, H = (r, t) => r.reduce((n, a) => n.concat(t(a)), []);
function Br(...r) {
if (r.length === 1) {
const [t] = r;
return (n) => T(t, n, () => {
});
}
if (r.length === 2) {
const [t, n] = r;
return T(t, n, () => {
});
}
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${r.length}.`);
}
function S(r) {
return Object.assign(r, { optional: () => we(r), and: (t) => E(r, t), or: (t) => er(r, t), select: (t) => t === void 0 ? X(r) : X(t, r) });
}
function Re(r) {
return Object.assign(((t) => Object.assign(t, { *[Symbol.iterator]() {
yield Object.assign(t, { [Qe]: !0 });
} }))(r), { optional: () => Re(we(r)), select: (t) => Re(t === void 0 ? X(r) : X(t, r)) });
}
function we(r) {
return S({ [P]: () => ({ match: (t) => {
let n = {};
const a = (s, u) => {
n[s] = u;
};
return t === void 0 ? (x(r).forEach((s) => a(s, void 0)), { matched: !0, selections: n }) : { matched: T(r, t, a), selections: n };
}, getSelectionKeys: () => x(r), matcherType: "optional" }) });
}
const Kr = (r, t) => {
for (const n of r)
if (!t(n))
return !1;
return !0;
}, qr = (r, t) => {
for (const [n, a] of r.entries())
if (!t(a, n))
return !1;
return !0;
};
function E(...r) {
return S({ [P]: () => ({ match: (t) => {
let n = {};
const a = (s, u) => {
n[s] = u;
};
return { matched: r.every((s) => T(s, t, a)), selections: n };
}, getSelectionKeys: () => H(r, x), matcherType: "and" }) });
}
function er(...r) {
return S({ [P]: () => ({ match: (t) => {
let n = {};
const a = (s, u) => {
n[s] = u;
};
return H(r, x).forEach((s) => a(s, void 0)), { matched: r.some((s) => T(s, t, a)), selections: n };
}, getSelectionKeys: () => H(r, x), matcherType: "or" }) });
}
function p(r) {
return { [P]: () => ({ match: (t) => ({ matched: !!r(t) }) }) };
}
function X(...r) {
const t = typeof r[0] == "string" ? r[0] : void 0, n = r.length === 2 ? r[1] : typeof r[0] == "string" ? void 0 : r[0];
return S({ [P]: () => ({ match: (a) => {
let s = { [t ?? se]: a };
return { matched: n === void 0 || T(n, a, (u, f) => {
s[u] = f;
}), selections: s };
}, getSelectionKeys: () => [t ?? se].concat(n === void 0 ? [] : x(n)) }) });
}
function k(r) {
return typeof r == "number";
}
function W(r) {
return typeof r == "string";
}
function F(r) {
return typeof r == "bigint";
}
const rr = S(p(function(r) {
return !0;
})), Gr = rr, Y = (r) => Object.assign(S(r), { startsWith: (t) => {
return Y(E(r, (n = t, p((a) => W(a) && a.startsWith(n)))));
var n;
}, endsWith: (t) => {
return Y(E(r, (n = t, p((a) => W(a) && a.endsWith(n)))));
var n;
}, minLength: (t) => Y(E(r, ((n) => p((a) => W(a) && a.length >= n))(t))), maxLength: (t) => Y(E(r, ((n) => p((a) => W(a) && a.length <= n))(t))), includes: (t) => {
return Y(E(r, (n = t, p((a) => W(a) && a.includes(n)))));
var n;
}, regex: (t) => {
return Y(E(r, (n = t, p((a) => W(a) && !!a.match(n)))));
var n;
} }), zr = Y(p(W)), I = (r) => Object.assign(S(r), { between: (t, n) => I(E(r, ((a, s) => p((u) => k(u) && a <= u && s >= u))(t, n))), lt: (t) => I(E(r, ((n) => p((a) => k(a) && a < n))(t))), gt: (t) => I(E(r, ((n) => p((a) => k(a) && a > n))(t))), lte: (t) => I(E(r, ((n) => p((a) => k(a) && a <= n))(t))), gte: (t) => I(E(r, ((n) => p((a) => k(a) && a >= n))(t))), int: () => I(E(r, p((t) => k(t) && Number.isInteger(t)))), finite: () => I(E(r, p((t) => k(t) && Number.isFinite(t)))), positive: () => I(E(r, p((t) => k(t) && t > 0))), negative: () => I(E(r, p((t) => k(t) && t < 0))) }), Jr = I(p(k)), L = (r) => Object.assign(S(r), { between: (t, n) => L(E(r, ((a, s) => p((u) => F(u) && a <= u && s >= u))(t, n))), lt: (t) => L(E(r, ((n) => p((a) => F(a) && a < n))(t))), gt: (t) => L(E(r, ((n) => p((a) => F(a) && a > n))(t))), lte: (t) => L(E(r, ((n) => p((a) => F(a) && a <= n))(t))), gte: (t) => L(E(r, ((n) => p((a) => F(a) && a >= n))(t))), positive: () => L(E(r, p((t) => F(t) && t > 0))), negative: () => L(E(r, p((t) => F(t) && t < 0))) }), Hr = L(p(F)), Xr = S(p(function(r) {
return typeof r == "boolean";
})), Zr = S(p(function(r) {
return typeof r == "symbol";
})), Qr = S(p(function(r) {
return r == null;
}));
var D = { __proto__: null, matcher: P, optional: we, array: function(...r) {
return Re({ [P]: () => ({ match: (t) => {
if (!Array.isArray(t))
return { matched: !1 };
if (r.length === 0)
return { matched: !0 };
const n = r[0];
let a = {};
if (t.length === 0)
return x(n).forEach((u) => {
a[u] = [];
}), { matched: !0, selections: a };
const s = (u, f) => {
a[u] = (a[u] || []).concat([f]);
};
return { matched: t.every((u) => T(n, u, s)), selections: a };
}, getSelectionKeys: () => r.length === 0 ? [] : x(r[0]) }) });
}, set: function(...r) {
return S({ [P]: () => ({ match: (t) => {
if (!(t instanceof Set))
return { matched: !1 };
let n = {};
if (t.size === 0)
return { matched: !0, selections: n };
if (r.length === 0)
return { matched: !0 };
const a = (u, f) => {
n[u] = (n[u] || []).concat([f]);
}, s = r[0];
return { matched: Kr(t, (u) => T(s, u, a)), selections: n };
}, getSelectionKeys: () => r.length === 0 ? [] : x(r[0]) }) });
}, map: function(...r) {
return S({ [P]: () => ({ match: (t) => {
if (!(t instanceof Map))
return { matched: !1 };
let n = {};
if (t.size === 0)
return { matched: !0, selections: n };
const a = (h, v) => {
n[h] = (n[h] || []).concat([v]);
};
if (r.length === 0)
return { matched: !0 };
var s;
if (r.length === 1)
throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(s = r[0]) == null ? void 0 : s.toString()}`);
const [u, f] = r;
return { matched: qr(t, (h, v) => {
const m = T(u, v, a), y = T(f, h, a);
return m && y;
}), selections: n };
}, getSelectionKeys: () => r.length === 0 ? [] : [...x(r[0]), ...x(r[1])] }) });
}, intersection: E, union: er, not: function(r) {
return S({ [P]: () => ({ match: (t) => ({ matched: !T(r, t, () => {
}) }), getSelectionKeys: () => [], matcherType: "not" }) });
}, when: p, select: X, any: rr, _: Gr, string: zr, number: Jr, bigint: Hr, boolean: Xr, symbol: Zr, nullish: Qr, instanceOf: function(r) {
return S(p(function(t) {
return (n) => n instanceof t;
}(r)));
}, shape: function(r) {
return S(p(Br(r)));
} };
const _e = { matched: !1, value: void 0 };
function et(r) {
return new ue(r, _e);
}
class ue {
constructor(t, n) {
this.input = void 0, this.state = void 0, this.input = t, this.state = n;
}
with(...t) {
if (this.state.matched)
return this;
const n = t[t.length - 1], a = [t[0]];
let s;
t.length === 3 && typeof t[1] == "function" ? (a.push(t[0]), s = t[1]) : t.length > 2 && a.push(...t.slice(1, t.length - 1));
let u = !1, f = {};
const h = (m, y) => {
u = !0, f[m] = y;
}, v = !a.some((m) => T(m, this.input, h)) || s && !s(this.input) ? _e : { matched: !0, value: n(u ? se in f ? f[se] : f : this.input, this.input) };
return new ue(this.input, v);
}
when(t, n) {
if (this.state.matched)
return this;
const a = !!t(this.input);
return new ue(this.input, a ? { matched: !0, value: n(this.input, this.input) } : _e);
}
otherwise(t) {
return this.state.matched ? this.state.value : t(this.input);
}
exhaustive() {
return this.run();
}
run() {
if (this.state.matched)
return this.state.value;
let t;
try {
t = JSON.stringify(this.input);
} catch {
t = this.input;
}
throw new Error(`Pattern matching error: no pattern matches value ${t}`);
}
returnType() {
return this;
}
}
const rt = (r) => et(r).with(D.not({ clientId: D.string }), () => "clientId is required").with(
D.not({ category: D.optional(D.union("fin", "gov", "ncp")) }),
() => "only fin, gov, ncp is allowed"
).with(
D.optional({
subModules: D.not(
D.array(D.union("drawing", "geocoder", "panorama", "visualization"))
)
}),
() => "subModules is invalid"
).otherwise(() => {
}), He = "naver-maps-script-id", tt = "https://oapi.map.naver.com/openapi/v3/maps.js", nt = ({
clientId: r,
category: t = "ncp",
subModules: n = [],
callback: a = []
}) => {
var y;
const s = { clientId: r, category: t, subModules: n }, u = rt(s), f = !!document.getElementById(He);
if (u)
throw new Error(u);
if (f)
return;
const h = new URLSearchParams({
[`${s.category ?? "ncp"}ClientId`]: s.clientId,
submodules: ((y = s.subModules) == null ? void 0 : y.join()) ?? ""
}), v = `${tt}?${h}`, m = document.createElement("script");
m.setAttribute("id", He), m.setAttribute("type", "text/javascript"), m.setAttribute("src", v), m.setAttribute("async", ""), m.setAttribute("defer", ""), m.onerror = () => new Error("naver map script load failed"), m.onload = () => {
a && a.forEach((w) => w());
}, document.head.appendChild(m);
}, tr = Fr({
map: void 0,
mapIsLoaded: !1
});
function ot({
clientId: r,
category: t,
subModules: n,
initLayers: a,
mapOptions: s,
onLoaded: u,
children: f,
...h
}) {
const v = Ze(null), [m, y] = me(!1), [w, j] = me(), U = { clientId: r, category: t, subModules: n }, Z = () => {
if (!v.current)
throw new Error("map ref is not founded");
const Q = new naver.maps.Map(
v.current,
Vr(s, a)
);
j(() => Q), y(() => !0), u && u(Q);
};
return ye(() => (nt({
...U,
callback: [Z]
}), () => {
w == null || w.destroy(), j(() => {
});
}), []), /* @__PURE__ */ oe.jsx(tr.Provider, { value: { map: w, mapIsLoaded: m }, children: /* @__PURE__ */ oe.jsx("div", { ref: v, ...h, children: f }) });
}
const at = () => {
const r = Lr(tr);
return $r(() => r, [r]);
};
function st({
onLoaded: r,
latitude: t,
longitude: n,
children: a,
...s
}) {
const u = Ze(null), [f, h] = me(), { map: v, mapIsLoaded: m } = at(), y = (w) => {
if (!u.current)
throw new Error("marker ref is not founded");
const j = new naver.maps.Marker({
map: w,
position: new naver.maps.LatLng(t, n),
icon: a ? {
content: u.current
} : void 0
});
h(() => j), r && r(j);
};
return ye(() => {
m && v && y(v);
}, [m]), ye(() => () => {
f == null || f.setMap(null), h(() => {
});
}, []), /* @__PURE__ */ oe.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ oe.jsx("div", { ref: u, ...s, children: a }) });
}
export {
ot as NaverMap,
st as NaverMarker
};