UNPKG

next-store-locator-test

Version:

React port of jquery store-locator plugin.

1,443 lines (1,437 loc) 364 kB
import * as Qt from "react"; import yi, { useRef as Xt, useEffect as In, useCallback as pi, createContext as Lr, useLayoutEffect as CA, useContext as Jt, useInsertionEffect as jf, useMemo as Er, forwardRef as SA, createElement as PA, useId as Na, useState as Jn, cloneElement as EA, Children as RA, isValidElement as IA } from "react"; var ii = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ca = { exports: {} }, si = {}; /** * @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 Bc; function LA() { if (Bc) return si; Bc = 1; var r = yi, n = Symbol.for("react.element"), i = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 }; function l(h, p, m) { var v, y = {}, _ = null, C = null; m !== void 0 && (_ = "" + m), p.key !== void 0 && (_ = "" + p.key), p.ref !== void 0 && (C = p.ref); for (v in p) o.call(p, v) && !f.hasOwnProperty(v) && (y[v] = p[v]); if (h && h.defaultProps) for (v in p = h.defaultProps, p) y[v] === void 0 && (y[v] = p[v]); return { $$typeof: n, type: h, key: _, ref: C, props: y, _owner: u.current }; } return si.Fragment = i, si.jsx = l, si.jsxs = l, si; } var oi = {}; /** * @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 Oc; function MA() { return Oc || (Oc = 1, process.env.NODE_ENV !== "production" && function() { var r = yi, n = Symbol.for("react.element"), i = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), h = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), C = Symbol.for("react.offscreen"), E = Symbol.iterator, D = "@@iterator"; function V(x) { if (x === null || typeof x != "object") return null; var O = E && x[E] || x[D]; return typeof O == "function" ? O : null; } var F = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function M(x) { { for (var O = arguments.length, k = new Array(O > 1 ? O - 1 : 0), q = 1; q < O; q++) k[q - 1] = arguments[q]; L("error", x, k); } } function L(x, O, k) { { var q = F.ReactDebugCurrentFrame, ft = q.getStackAddendum(); ft !== "" && (O += "%s", k = k.concat([ft])); var dt = k.map(function(at) { return String(at); }); dt.unshift("Warning: " + O), Function.prototype.apply.call(console[x], console, dt); } } var U = !1, j = !1, ot = !1, rt = !1, Q = !1, lt; lt = Symbol.for("react.module.reference"); function Gt(x) { return !!(typeof x == "string" || typeof x == "function" || x === o || x === f || Q || x === u || x === m || x === v || rt || x === C || U || j || ot || typeof x == "object" && x !== null && (x.$$typeof === _ || x.$$typeof === y || x.$$typeof === l || x.$$typeof === h || x.$$typeof === p || // 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. x.$$typeof === lt || x.getModuleId !== void 0)); } function He(x, O, k) { var q = x.displayName; if (q) return q; var ft = O.displayName || O.name || ""; return ft !== "" ? k + "(" + ft + ")" : k; } function Ht(x) { return x.displayName || "Context"; } function Rt(x) { if (x == null) return null; if (typeof x.tag == "number" && M("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof x == "function") return x.displayName || x.name || null; if (typeof x == "string") return x; switch (x) { case o: return "Fragment"; case i: return "Portal"; case f: return "Profiler"; case u: return "StrictMode"; case m: return "Suspense"; case v: return "SuspenseList"; } if (typeof x == "object") switch (x.$$typeof) { case h: var O = x; return Ht(O) + ".Consumer"; case l: var k = x; return Ht(k._context) + ".Provider"; case p: return He(x, x.render, "ForwardRef"); case y: var q = x.displayName || null; return q !== null ? q : Rt(x.type) || "Memo"; case _: { var ft = x, dt = ft._payload, at = ft._init; try { return Rt(at(dt)); } catch { return null; } } } return null; } var vt = Object.assign, $t = 0, Ct, Dt, Ft, Be, je, it, ze; function Bn() { } Bn.__reactDisabledLog = !0; function nr() { { if ($t === 0) { Ct = console.log, Dt = console.info, Ft = console.warn, Be = console.error, je = console.group, it = console.groupCollapsed, ze = console.groupEnd; var x = { configurable: !0, enumerable: !0, value: Bn, writable: !0 }; Object.defineProperties(console, { info: x, log: x, warn: x, error: x, group: x, groupCollapsed: x, groupEnd: x }); } $t++; } } function Oe() { { if ($t--, $t === 0) { var x = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: vt({}, x, { value: Ct }), info: vt({}, x, { value: Dt }), warn: vt({}, x, { value: Ft }), error: vt({}, x, { value: Be }), group: vt({}, x, { value: je }), groupCollapsed: vt({}, x, { value: it }), groupEnd: vt({}, x, { value: ze }) }); } $t < 0 && M("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var te = F.ReactCurrentDispatcher, dn; function we(x, O, k) { { if (dn === void 0) try { throw Error(); } catch (ft) { var q = ft.stack.trim().match(/\n( *(at )?)/); dn = q && q[1] || ""; } return ` ` + dn + x; } } var ce = !1, Ve; { var ee = typeof WeakMap == "function" ? WeakMap : Map; Ve = new ee(); } function pn(x, O) { if (!x || ce) return ""; { var k = Ve.get(x); if (k !== void 0) return k; } var q; ce = !0; var ft = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var dt; dt = te.current, te.current = null, nr(); try { if (O) { var at = function() { throw Error(); }; if (Object.defineProperty(at.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(at, []); } catch (re) { q = re; } Reflect.construct(x, [], at); } else { try { at.call(); } catch (re) { q = re; } x.call(at.prototype); } } else { try { throw Error(); } catch (re) { q = re; } x(); } } catch (re) { if (re && q && typeof re.stack == "string") { for (var nt = re.stack.split(` `), kt = q.stack.split(` `), _t = nt.length - 1, St = kt.length - 1; _t >= 1 && St >= 0 && nt[_t] !== kt[St]; ) St--; for (; _t >= 1 && St >= 0; _t--, St--) if (nt[_t] !== kt[St]) { if (_t !== 1 || St !== 1) do if (_t--, St--, St < 0 || nt[_t] !== kt[St]) { var ne = ` ` + nt[_t].replace(" at new ", " at "); return x.displayName && ne.includes("<anonymous>") && (ne = ne.replace("<anonymous>", x.displayName)), typeof x == "function" && Ve.set(x, ne), ne; } while (_t >= 1 && St >= 0); break; } } } finally { ce = !1, te.current = dt, Oe(), Error.prepareStackTrace = ft; } var ke = x ? x.displayName || x.name : "", Di = ke ? we(ke) : ""; return typeof x == "function" && Ve.set(x, Di), Di; } function Ti(x, O, k) { return pn(x, !1); } function fe(x) { var O = x.prototype; return !!(O && O.isReactComponent); } function Ye(x, O, k) { if (x == null) return ""; if (typeof x == "function") return pn(x, fe(x)); if (typeof x == "string") return we(x); switch (x) { case m: return we("Suspense"); case v: return we("SuspenseList"); } if (typeof x == "object") switch (x.$$typeof) { case p: return Ti(x.render); case y: return Ye(x.type, O, k); case _: { var q = x, ft = q._payload, dt = q._init; try { return Ye(dt(ft), O, k); } catch { } } } return ""; } var rr = Object.prototype.hasOwnProperty, _e = {}, Mr = F.ReactDebugCurrentFrame; function ir(x) { if (x) { var O = x._owner, k = Ye(x.type, x._source, O ? O.type : null); Mr.setExtraStackFrame(k); } else Mr.setExtraStackFrame(null); } function On(x, O, k, q, ft) { { var dt = Function.call.bind(rr); for (var at in x) if (dt(x, at)) { var nt = void 0; try { if (typeof x[at] != "function") { var kt = Error((q || "React class") + ": " + k + " type `" + at + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof x[at] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw kt.name = "Invariant Violation", kt; } nt = x[at](O, at, q, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (_t) { nt = _t; } nt && !(nt instanceof Error) && (ir(ft), M("%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).", q || "React class", k, at, typeof nt), ir(null)), nt instanceof Error && !(nt.message in _e) && (_e[nt.message] = !0, ir(ft), M("Failed %s type: %s", k, nt.message), ir(null)); } } } var he = Array.isArray; function Xe(x) { return he(x); } function sr(x) { { var O = typeof Symbol == "function" && Symbol.toStringTag, k = O && x[Symbol.toStringTag] || x.constructor.name || "Object"; return k; } } function Ks(x) { try { return gn(x), !1; } catch { return !0; } } function gn(x) { return "" + x; } function Ci(x) { if (Ks(x)) return M("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", sr(x)), gn(x); } var Fe = F.ReactCurrentOwner, mn = { key: !0, ref: !0, __self: !0, __source: !0 }, or, ar, Vn; Vn = {}; function Dr(x) { if (rr.call(x, "ref")) { var O = Object.getOwnPropertyDescriptor(x, "ref").get; if (O && O.isReactWarning) return !1; } return x.ref !== void 0; } function Br(x) { if (rr.call(x, "key")) { var O = Object.getOwnPropertyDescriptor(x, "key").get; if (O && O.isReactWarning) return !1; } return x.key !== void 0; } function Or(x, O) { if (typeof x.ref == "string" && Fe.current && O && Fe.current.stateNode !== O) { var k = Rt(Fe.current.type); Vn[k] || (M('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', Rt(Fe.current.type), x.ref), Vn[k] = !0); } } function Vr(x, O) { { var k = function() { or || (or = !0, M("%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)", O)); }; k.isReactWarning = !0, Object.defineProperty(x, "key", { get: k, configurable: !0 }); } } function Fr(x, O) { { var k = function() { ar || (ar = !0, M("%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)", O)); }; k.isReactWarning = !0, Object.defineProperty(x, "ref", { get: k, configurable: !0 }); } } var kr = function(x, O, k, q, ft, dt, at) { var nt = { // This tag allows us to uniquely identify this as a React Element $$typeof: n, // Built-in properties that belong on the element type: x, key: O, ref: k, props: at, // Record the component responsible for creating this element. _owner: dt }; return nt._store = {}, Object.defineProperty(nt._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(nt, "_self", { configurable: !1, enumerable: !1, writable: !1, value: q }), Object.defineProperty(nt, "_source", { configurable: !1, enumerable: !1, writable: !1, value: ft }), Object.freeze && (Object.freeze(nt.props), Object.freeze(nt)), nt; }; function Zs(x, O, k, q, ft) { { var dt, at = {}, nt = null, kt = null; k !== void 0 && (Ci(k), nt = "" + k), Br(O) && (Ci(O.key), nt = "" + O.key), Dr(O) && (kt = O.ref, Or(O, ft)); for (dt in O) rr.call(O, dt) && !mn.hasOwnProperty(dt) && (at[dt] = O[dt]); if (x && x.defaultProps) { var _t = x.defaultProps; for (dt in _t) at[dt] === void 0 && (at[dt] = _t[dt]); } if (nt || kt) { var St = typeof x == "function" ? x.displayName || x.name || "Unknown" : x; nt && Vr(at, St), kt && Fr(at, St); } return kr(x, nt, kt, ft, q, Fe.current, at); } } var Nr = F.ReactCurrentOwner, Si = F.ReactDebugCurrentFrame; function Je(x) { if (x) { var O = x._owner, k = Ye(x.type, x._source, O ? O.type : null); Si.setExtraStackFrame(k); } else Si.setExtraStackFrame(null); } var ur; ur = !1; function Ur(x) { return typeof x == "object" && x !== null && x.$$typeof === n; } function Pi() { { if (Nr.current) { var x = Rt(Nr.current.type); if (x) return ` Check the render method of \`` + x + "`."; } return ""; } } function qs(x) { { if (x !== void 0) { var O = x.fileName.replace(/^.*[\\\/]/, ""), k = x.lineNumber; return ` Check your code at ` + O + ":" + k + "."; } return ""; } } var Ei = {}; function Ri(x) { { var O = Pi(); if (!O) { var k = typeof x == "string" ? x : x.displayName || x.name; k && (O = ` Check the top-level render call using <` + k + ">."); } return O; } } function Ii(x, O) { { if (!x._store || x._store.validated || x.key != null) return; x._store.validated = !0; var k = Ri(O); if (Ei[k]) return; Ei[k] = !0; var q = ""; x && x._owner && x._owner !== Nr.current && (q = " It was passed a child from " + Rt(x._owner.type) + "."), Je(x), M('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, q), Je(null); } } function Li(x, O) { { if (typeof x != "object") return; if (Xe(x)) for (var k = 0; k < x.length; k++) { var q = x[k]; Ur(q) && Ii(q, O); } else if (Ur(x)) x._store && (x._store.validated = !0); else if (x) { var ft = V(x); if (typeof ft == "function" && ft !== x.entries) for (var dt = ft.call(x), at; !(at = dt.next()).done; ) Ur(at.value) && Ii(at.value, O); } } } function Qs(x) { { var O = x.type; if (O == null || typeof O == "string") return; var k; if (typeof O == "function") k = O.propTypes; else if (typeof O == "object" && (O.$$typeof === p || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. O.$$typeof === y)) k = O.propTypes; else return; if (k) { var q = Rt(O); On(k, x.props, "prop", q, x); } else if (O.PropTypes !== void 0 && !ur) { ur = !0; var ft = Rt(O); M("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", ft || "Unknown"); } typeof O.getDefaultProps == "function" && !O.getDefaultProps.isReactClassApproved && M("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function Wr(x) { { for (var O = Object.keys(x.props), k = 0; k < O.length; k++) { var q = O[k]; if (q !== "children" && q !== "key") { Je(x), M("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", q), Je(null); break; } } x.ref !== null && (Je(x), M("Invalid attribute `ref` supplied to `React.Fragment`."), Je(null)); } } function Mi(x, O, k, q, ft, dt) { { var at = Gt(x); if (!at) { var nt = ""; (x === void 0 || typeof x == "object" && x !== null && Object.keys(x).length === 0) && (nt += " 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 kt = qs(ft); kt ? nt += kt : nt += Pi(); var _t; x === null ? _t = "null" : Xe(x) ? _t = "array" : x !== void 0 && x.$$typeof === n ? (_t = "<" + (Rt(x.type) || "Unknown") + " />", nt = " Did you accidentally export a JSX literal instead of a component?") : _t = typeof x, M("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", _t, nt); } var St = Zs(x, O, k, ft, dt); if (St == null) return St; if (at) { var ne = O.children; if (ne !== void 0) if (q) if (Xe(ne)) { for (var ke = 0; ke < ne.length; ke++) Li(ne[ke], x); Object.freeze && Object.freeze(ne); } else M("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 Li(ne, x); } return x === o ? Wr(St) : Qs(St), St; } } function Gr(x, O, k) { return Mi(x, O, k, !0); } function Xs(x, O, k) { return Mi(x, O, k, !1); } var Js = Xs, $s = Gr; oi.Fragment = o, oi.jsx = Js, oi.jsxs = $s; }()), oi; } process.env.NODE_ENV === "production" ? Ca.exports = LA() : Ca.exports = MA(); var G = Ca.exports; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ function DA(r, n, i, o) { function u(f) { return f instanceof i ? f : new i(function(l) { l(f); }); } return new (i || (i = Promise))(function(f, l) { function h(v) { try { m(o.next(v)); } catch (y) { l(y); } } function p(v) { try { m(o.throw(v)); } catch (y) { l(y); } } function m(v) { v.done ? f(v.value) : u(v.value).then(h, p); } m((o = o.apply(r, n || [])).next()); }); } var BA = function r(n, i) { if (n === i) return !0; if (n && i && typeof n == "object" && typeof i == "object") { if (n.constructor !== i.constructor) return !1; var o, u, f; if (Array.isArray(n)) { if (o = n.length, o != i.length) return !1; for (u = o; u-- !== 0; ) if (!r(n[u], i[u])) return !1; return !0; } if (n.constructor === RegExp) return n.source === i.source && n.flags === i.flags; if (n.valueOf !== Object.prototype.valueOf) return n.valueOf() === i.valueOf(); if (n.toString !== Object.prototype.toString) return n.toString() === i.toString(); if (f = Object.keys(n), o = f.length, o !== Object.keys(i).length) return !1; for (u = o; u-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(i, f[u])) return !1; for (u = o; u-- !== 0; ) { var l = f[u]; if (!r(n[l], i[l])) return !1; } return !0; } return n !== n && i !== i; }; const Vc = "__googleMapsScriptId"; var br; (function(r) { r[r.INITIALIZED = 0] = "INITIALIZED", r[r.LOADING = 1] = "LOADING", r[r.SUCCESS = 2] = "SUCCESS", r[r.FAILURE = 3] = "FAILURE"; })(br || (br = {})); class Qn { /** * Creates an instance of Loader using [[LoaderOptions]]. No defaults are set * using this library, instead the defaults are set by the Google Maps * JavaScript API server. * * ``` * const loader = Loader({apiKey, version: 'weekly', libraries: ['places']}); * ``` */ constructor({ apiKey: n, authReferrerPolicy: i, channel: o, client: u, id: f = Vc, language: l, libraries: h = [], mapIds: p, nonce: m, region: v, retries: y = 3, url: _ = "https://maps.googleapis.com/maps/api/js", version: C }) { if (this.callbacks = [], this.done = !1, this.loading = !1, this.errors = [], this.apiKey = n, this.authReferrerPolicy = i, this.channel = o, this.client = u, this.id = f || Vc, this.language = l, this.libraries = h, this.mapIds = p, this.nonce = m, this.region = v, this.retries = y, this.url = _, this.version = C, Qn.instance) { if (!BA(this.options, Qn.instance.options)) throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(Qn.instance.options)}`); return Qn.instance; } Qn.instance = this; } get options() { return { version: this.version, apiKey: this.apiKey, channel: this.channel, client: this.client, id: this.id, libraries: this.libraries, language: this.language, region: this.region, mapIds: this.mapIds, nonce: this.nonce, url: this.url, authReferrerPolicy: this.authReferrerPolicy }; } get status() { return this.errors.length ? br.FAILURE : this.done ? br.SUCCESS : this.loading ? br.LOADING : br.INITIALIZED; } get failed() { return this.done && !this.loading && this.errors.length >= this.retries + 1; } /** * CreateUrl returns the Google Maps JavaScript API script url given the [[LoaderOptions]]. * * @ignore * @deprecated */ createUrl() { let n = this.url; return n += "?callback=__googleMapsCallback", this.apiKey && (n += `&key=${this.apiKey}`), this.channel && (n += `&channel=${this.channel}`), this.client && (n += `&client=${this.client}`), this.libraries.length > 0 && (n += `&libraries=${this.libraries.join(",")}`), this.language && (n += `&language=${this.language}`), this.region && (n += `&region=${this.region}`), this.version && (n += `&v=${this.version}`), this.mapIds && (n += `&map_ids=${this.mapIds.join(",")}`), this.authReferrerPolicy && (n += `&auth_referrer_policy=${this.authReferrerPolicy}`), n; } deleteScript() { const n = document.getElementById(this.id); n && n.remove(); } /** * Load the Google Maps JavaScript API script and return a Promise. * @deprecated, use importLibrary() instead. */ load() { return this.loadPromise(); } /** * Load the Google Maps JavaScript API script and return a Promise. * * @ignore * @deprecated, use importLibrary() instead. */ loadPromise() { return new Promise((n, i) => { this.loadCallback((o) => { o ? i(o.error) : n(window.google); }); }); } importLibrary(n) { return this.execute(), google.maps.importLibrary(n); } /** * Load the Google Maps JavaScript API script with a callback. * @deprecated, use importLibrary() instead. */ loadCallback(n) { this.callbacks.push(n), this.execute(); } /** * Set the script on document. */ setScript() { var n, i; if (document.getElementById(this.id)) { this.callback(); return; } const o = { key: this.apiKey, channel: this.channel, client: this.client, libraries: this.libraries.length && this.libraries, v: this.version, mapIds: this.mapIds, language: this.language, region: this.region, authReferrerPolicy: this.authReferrerPolicy }; Object.keys(o).forEach( // eslint-disable-next-line @typescript-eslint/no-explicit-any (f) => !o[f] && delete o[f] ), !((i = (n = window == null ? void 0 : window.google) === null || n === void 0 ? void 0 : n.maps) === null || i === void 0) && i.importLibrary || ((f) => { let l, h, p, m = "The Google Maps JavaScript API", v = "google", y = "importLibrary", _ = "__ib__", C = document, E = window; E = E[v] || (E[v] = {}); const D = E.maps || (E.maps = {}), V = /* @__PURE__ */ new Set(), F = new URLSearchParams(), M = () => ( // @ts-ignore l || (l = new Promise((L, U) => DA(this, void 0, void 0, function* () { var j; yield h = C.createElement("script"), h.id = this.id, F.set("libraries", [...V] + ""); for (p in f) F.set(p.replace(/[A-Z]/g, (ot) => "_" + ot[0].toLowerCase()), f[p]); F.set("callback", v + ".maps." + _), h.src = this.url + "?" + F, D[_] = L, h.onerror = () => l = U(Error(m + " could not load.")), h.nonce = this.nonce || ((j = C.querySelector("script[nonce]")) === null || j === void 0 ? void 0 : j.nonce) || "", C.head.append(h); }))) ); D[y] ? console.warn(m + " only loads once. Ignoring:", f) : D[y] = (L, ...U) => V.add(L) && M().then(() => D[y](L, ...U)); })(o); const u = this.libraries.map((f) => this.importLibrary(f)); u.length || u.push(this.importLibrary("core")), Promise.all(u).then(() => this.callback(), (f) => { const l = new ErrorEvent("error", { error: f }); this.loadErrorCallback(l); }); } /** * Reset the loader state. */ reset() { this.deleteScript(), this.done = !1, this.loading = !1, this.errors = [], this.onerrorEvent = null; } resetIfRetryingFailed() { this.failed && this.reset(); } loadErrorCallback(n) { if (this.errors.push(n), this.errors.length <= this.retries) { const i = this.errors.length * Math.pow(2, this.errors.length); console.error(`Failed to load Google Maps script, retrying in ${i} ms.`), setTimeout(() => { this.deleteScript(), this.setScript(); }, i); } else this.onerrorEvent = n, this.callback(); } callback() { this.done = !0, this.loading = !1, this.callbacks.forEach((n) => { n(this.onerrorEvent); }), this.callbacks = []; } execute() { if (this.resetIfRetryingFailed(), this.done) this.callback(); else { if (window.google && window.google.maps && window.google.maps.version) { console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."), this.callback(); return; } this.loading || (this.loading = !0, this.setScript()); } } } function OA(r, n) { for (let i in n.prototype) r.prototype[i] = n.prototype[i]; } class ks { constructor() { OA(ks, google.maps.OverlayView); } } function fa(r) { return Object.keys(r).reduce((n, i) => (r[i] && n.push(i + ":" + r[i]), n), []).join(";"); } function Ae(r) { return r ? r + "px" : void 0; } class VA extends ks { /** * @param cluster_ The cluster with which the icon is to be associated. * @param styles_ An array of {@link ClusterIconStyle} defining the cluster icons * to use for various cluster sizes. */ constructor(n, i) { super(), this.cluster_ = n, this.styles_ = i, this.center_ = null, this.div_ = null, this.sums_ = null, this.visible_ = !1, this.style = null, this.setMap(n.getMap()); } /** * Adds the icon to the DOM. */ onAdd() { let n, i; const o = this.cluster_.getMarkerClusterer(), [u, f] = google.maps.version.split("."), l = parseInt(u, 10) * 100 + parseInt(f, 10); this.div_ = document.createElement("div"), this.visible_ && this.show(), this.getPanes().overlayMouseTarget.appendChild(this.div_), this.boundsChangedListener_ = google.maps.event.addListener(this.getMap(), "bounds_changed", function() { i = n; }), google.maps.event.addDomListener(this.div_, "mousedown", () => { n = !0, i = !1; }), l >= 332 && google.maps.event.addDomListener(this.div_, "touchstart", (h) => { h.stopPropagation(); }), google.maps.event.addDomListener(this.div_, "click", (h) => { if (n = !1, !i) { if (google.maps.event.trigger(o, "click", this.cluster_), google.maps.event.trigger(o, "clusterclick", this.cluster_), o.getZoomOnClick()) { const p = o.getMaxZoom(), m = this.cluster_.getBounds(); o.getMap().fitBounds(m), setTimeout(function() { o.getMap().fitBounds(m), p !== null && o.getMap().getZoom() > p && o.getMap().setZoom(p + 1); }, 100); } h.cancelBubble = !0, h.stopPropagation && h.stopPropagation(); } }), google.maps.event.addDomListener(this.div_, "mouseover", () => { google.maps.event.trigger(o, "mouseover", this.cluster_); }), google.maps.event.addDomListener(this.div_, "mouseout", () => { google.maps.event.trigger(o, "mouseout", this.cluster_); }); } /** * Removes the icon from the DOM. */ onRemove() { this.div_ && this.div_.parentNode && (this.hide(), google.maps.event.removeListener(this.boundsChangedListener_), google.maps.event.clearInstanceListeners(this.div_), this.div_.parentNode.removeChild(this.div_), this.div_ = null); } /** * Draws the icon. */ draw() { if (this.visible_) { const n = this.getPosFromLatLng_(this.center_); this.div_.style.top = n.y + "px", this.div_.style.left = n.x + "px"; } } /** * Hides the icon. */ hide() { this.div_ && (this.div_.style.display = "none"), this.visible_ = !1; } /** * Positions and shows the icon. */ show() { this.div_ && (this.div_.className = this.className_, this.div_.style.cssText = this.createCss_(this.getPosFromLatLng_(this.center_)), this.div_.innerHTML = (this.style.url ? this.getImageElementHtml() : "") + this.getLabelDivHtml(), typeof this.sums_.title > "u" || this.sums_.title === "" ? this.div_.title = this.cluster_.getMarkerClusterer().getTitle() : this.div_.title = this.sums_.title, this.div_.style.display = ""), this.visible_ = !0; } getLabelDivHtml() { const i = this.cluster_.getMarkerClusterer().ariaLabelFn(this.sums_.text), o = { position: "absolute", top: Ae(this.anchorText_[0]), left: Ae(this.anchorText_[1]), color: this.style.textColor, "font-size": Ae(this.style.textSize), "font-family": this.style.fontFamily, "font-weight": this.style.fontWeight, "font-style": this.style.fontStyle, "text-decoration": this.style.textDecoration, "text-align": "center", width: Ae(this.style.width), "line-height": Ae(this.style.textLineHeight) }; return ` <div aria-label="${i}" style="${fa(o)}" tabindex="0"> <span aria-hidden="true">${this.sums_.text}</span> </div> `; } getImageElementHtml() { const n = (this.style.backgroundPosition || "0 0").split(" "), i = parseInt(n[0].replace(/^\s+|\s+$/g, ""), 10), o = parseInt(n[1].replace(/^\s+|\s+$/g, ""), 10); let u = {}; if (this.cluster_.getMarkerClusterer().getEnableRetinaIcons()) u = { width: Ae(this.style.width), height: Ae(this.style.height) }; else { const [l, h, p, m] = [ -1 * o, -1 * i + this.style.width, -1 * o + this.style.height, -1 * i ]; u = { clip: `rect(${l}px, ${h}px, ${p}px, ${m}px)` }; } const f = fa(Object.assign({ position: "absolute", top: Ae(o), left: Ae(i) }, u)); return `<img alt="${this.sums_.text}" aria-hidden="true" src="${this.style.url}" style="${f}"/>`; } /** * Sets the icon styles to the appropriate element in the styles array. * * @ignore * @param sums The icon label text and styles index. */ useStyle(n) { this.sums_ = n; let i = Math.max(0, n.index - 1); i = Math.min(this.styles_.length - 1, i), this.style = this.styles_[i], this.anchorText_ = this.style.anchorText || [0, 0], this.anchorIcon_ = this.style.anchorIcon || [ Math.floor(this.style.height / 2), Math.floor(this.style.width / 2) ], this.className_ = this.cluster_.getMarkerClusterer().getClusterClass() + " " + (this.style.className || "cluster-" + i); } /** * Sets the position at which to center the icon. * * @param center The latlng to set as the center. */ setCenter(n) { this.center_ = n; } /** * Creates the `cssText` style parameter based on the position of the icon. * * @param pos The position of the icon. * @return The CSS style text. */ createCss_(n) { return fa({ "z-index": `${this.cluster_.getMarkerClusterer().getZIndex()}`, top: Ae(n.y), left: Ae(n.x), width: Ae(this.style.width), height: Ae(this.style.height), cursor: "pointer", position: "absolute", "-webkit-user-select": "none", "-khtml-user-select": "none", "-moz-user-select": "none", "-o-user-select": "none", "user-select": "none" }); } /** * Returns the position at which to place the DIV depending on the latlng. * * @param latlng The position in latlng. * @return The position in pixels. */ getPosFromLatLng_(n) { const i = this.getProjection().fromLatLngToDivPixel(n); return i.x = Math.floor(i.x - this.anchorIcon_[1]), i.y = Math.floor(i.y - this.anchorIcon_[0]), i; } } class FA { /** * * @param markerClusterer_ The `MarkerClusterer` object with which this * cluster is associated. */ constructor(n) { this.markerClusterer_ = n, this.map_ = this.markerClusterer_.getMap(), this.minClusterSize_ = this.markerClusterer_.getMinimumClusterSize(), this.averageCenter_ = this.markerClusterer_.getAverageCenter(), this.markers_ = [], this.center_ = null, this.bounds_ = null, this.clusterIcon_ = new VA(this, this.markerClusterer_.getStyles()); } /** * Returns the number of markers managed by the cluster. You can call this from * a `click`, `mouseover`, or `mouseout` event handler for the `MarkerClusterer` object. * * @return The number of markers in the cluster. */ getSize() { return this.markers_.length; } /** * Returns the array of markers managed by the cluster. You can call this from * a `click`, `mouseover`, or `mouseout` event handler for the `MarkerClusterer` object. * * @return The array of markers in the cluster. */ getMarkers() { return this.markers_; } /** * Returns the center of the cluster. You can call this from * a `click`, `mouseover`, or `mouseout` event handler * for the `MarkerClusterer` object. * * @return The center of the cluster. */ getCenter() { return this.center_; } /** * Returns the map with which the cluster is associated. * * @return The map. * @ignore */ getMap() { return this.map_; } /** * Returns the `MarkerClusterer` object with which the cluster is associated. * * @return The associated marker clusterer. * @ignore */ getMarkerClusterer() { return this.markerClusterer_; } /** * Returns the bounds of the cluster. * * @return the cluster bounds. * @ignore */ getBounds() { const n = new google.maps.LatLngBounds(this.center_, this.center_), i = this.getMarkers(); for (let o = 0; o < i.length; o++) n.extend(i[o].getPosition()); return n; } /** * Removes the cluster from the map. * * @ignore */ remove() { this.clusterIcon_.setMap(null), this.markers_ = [], delete this.markers_; } /** * Adds a marker to the cluster. * * @param marker The marker to be added. * @return True if the marker was added. * @ignore */ addMarker(n) { if (this.isMarkerAlreadyAdded_(n)) return !1; if (!this.center_) this.center_ = n.getPosition(), this.calculateBounds_(); else if (this.averageCenter_) { const u = this.markers_.length + 1, f = (this.center_.lat() * (u - 1) + n.getPosition().lat()) / u, l = (this.center_.lng() * (u - 1) + n.getPosition().lng()) / u; this.center_ = new google.maps.LatLng(f, l), this.calculateBounds_(); } n.isAdded = !0, this.markers_.push(n); const i = this.markers_.length, o = this.markerClusterer_.getMaxZoom(); if (o !== null && this.map_.getZoom() > o) n.getMap() !== this.map_ && n.setMap(this.map_); else if (i < this.minClusterSize_) n.getMap() !== this.map_ && n.setMap(this.map_); else if (i === this.minClusterSize_) for (let u = 0; u < i; u++) this.markers_[u].setMap(null); else n.setMap(null); return !0; } /** * Determines if a marker lies within the cluster's bounds. * * @param marker The marker to check. * @return True if the marker lies in the bounds. * @ignore */ isMarkerInClusterBounds(n) { return this.bounds_.contains(n.getPosition()); } /** * Calculates the extended bounds of the cluster with the grid. */ calculateBounds_() { const n = new google.maps.LatLngBounds(this.center_, this.center_); this.bounds_ = this.markerClusterer_.getExtendedBounds(n); } /** * Updates the cluster icon. */ updateIcon() { const n = this.markers_.length, i = this.markerClusterer_.getMaxZoom(); if (i !== null && this.map_.getZoom() > i) { this.clusterIcon_.hide(); return; } if (n < this.minClusterSize_) { this.clusterIcon_.hide(); return; } const o = this.markerClusterer_.getStyles().length, u = this.markerClusterer_.getCalculator()(this.markers_, o); this.clusterIcon_.setCenter(this.center_), this.clusterIcon_.useStyle(u), this.clusterIcon_.show(); } /** * Determines if a marker has already been added to the cluster. * * @param marker The marker to check. * @return True if the marker has already been added. */ isMarkerAlreadyAdded_(n) { if (this.markers_.indexOf) return this.markers_.indexOf(n) !== -1; for (let i = 0; i < this.markers_.length; i++) if (n === this.markers_[i]) return !0; return !1; } } const xs = (r, n, i) => r[n] !== void 0 ? r[n] : i; class ue extends ks { /** * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. * @param map The Google map to attach to. * @param markers The markers to be added to the cluster. * @param options The optional parameters. */ constructor(n, i = [], o = {}) { super(), this.options = o, this.markers_ = [], this.clusters_ = [], this.listeners_ = [], this.activeMap_ = null, this.ready_ = !1, this.ariaLabelFn = this.options.ariaLabelFn || (() => ""), this.zIndex_ = this.options.zIndex || google.maps.Marker.MAX_ZINDEX + 1, this.gridSize_ = this.options.gridSize || 60, this.minClusterSize_ = this.options.minimumClusterSize || 2, this.maxZoom_ = this.options.maxZoom || null, this.styles_ = this.options.styles || [], this.title_ = this.options.title || "", this.zoomOnClick_ = xs(this.options, "zoomOnClick", !0), this.averageCenter_ = xs(this.options, "averageCenter", !1), this.ignoreHidden_ = xs(this.options, "ignoreHidden", !1), this.enableRetinaIcons_ = xs(this.options, "enableRetinaIcons", !1), this.imagePath_ = this.options.imagePath || ue.IMAGE_PATH, this.imageExtension_ = this.options.imageExtension || ue.IMAGE_EXTENSION, this.imageSizes_ = this.options.imageSizes || ue.IMAGE_SIZES, this.calculator_ = this.options.calculator || ue.CALCULATOR, this.batchSize_ = this.options.batchSize || ue.BATCH_SIZE, this.batchSizeIE_ = this.options.batchSizeIE || ue.BATCH_SIZE_IE, this.clusterClass_ = this.options.clusterClass || "cluster", navigator.userAgent.toLowerCase().indexOf("msie") !== -1 && (this.batchSize_ = this.batchSizeIE_), this.setupStyles_(), this.addMarkers(i, !0), this.setMap(n); } /** * Implementation of the onAdd interface method. * @ignore */ onAdd() { this.activeMap_ = this.getMap(), this.ready_ = !0, this.repaint(), this.prevZoom_ = this.getMap().getZoom(), this.listeners_ = [ google.maps.event.addListener(this.getMap(), "zoom_changed", () => { const n = this.getMap(), i = n.minZoom || 0, o = Math.min(n.maxZoom || 100, n.mapTypes[n.getMapTypeId()].maxZoom), u = Math.min(Math.max(this.getMap().getZoom(), i), o); this.prevZoom_ != u && (this.prevZoom_ = u, this.resetViewport_(!1)); }), google.maps.event.addListener(this.getMap(), "idle", () => { this.redraw_(); }) ]; } /** * Implementation of the onRemove interface method. * Removes map event listeners and all cluster icons from the DOM. * All managed markers are also put back on the map. * @ignore */ onRemove() { for (let n = 0; n < this.markers_.length; n++) this.markers_[n].getMap() !== this.activeMap_ && this.markers_[n].setMap(this.activeMap_); for (let n = 0; n < this.clusters_.length; n++) this.clusters_[n].remove(); this.clusters_ = []; for (let n = 0; n < this.listeners_.length; n++) google.maps.event.removeListener(this.listeners_[n]); this.listeners_ = [], this.activeMap_ = null, this.ready_ = !1; } /** * Implementation of the draw interface method. * @ignore */ draw() { } /** * Sets up the styles object. */ setupStyles_() { if (!(this.styles_.length > 0)) for (let n = 0; n < this.imageSizes_.length; n++) { const i = this.imageSizes_[n]; this.styles_.push(ue.withDefaultStyle({ url: this.imagePath_ + (n + 1) + "." + this.imageExtension_, height: i, width: i })); } } /** * Fits the map to the bounds of the markers managed by the clusterer. */ fitMapToMarkers(n) { const i = this.getMarkers(), o = new google.maps.LatLngBounds(); for (let u = 0; u < i.length; u++) (i[u].getVisible() || !this.getIgnoreHidden()) && o.extend(i[u].getPosition()); this.getMap().fitBounds(o, n); } /** * Returns the value of the `gridSize` property. * * @return The grid size. */ getGridSize() { return this.gridSize_; } /** * Sets the value of the `gridSize` property. * * @param gridSize The grid size. */ setGridSize(n) { this.gridSize_ = n; } /** * Returns the value of the `minimumClusterSize` property. * * @return The minimum cluster size. */ getMinimumClusterSize() { return this.minClusterSize_; } /** * Sets the value of the `minimumClusterSize` property. * * @param minimumClusterSize The minimum cluster size. */ setMinimumClusterSize(n) { this.minClusterSize_ = n; } /** * Returns the value of the `maxZoom` property. * * @return The maximum zoom level. */ getMaxZoom() { return this.maxZoom_; } /** * Sets the value of the `maxZoom` property. * * @param maxZoom The maximum zoom level. */ setMaxZoom(n) { this.maxZoom_ = n; } getZIndex() { return this.zIndex_; } setZIndex(n) { this.zIndex_ = n; } /** * Returns the value of the `styles` property. * * @return The array of styles defining the cluster markers to be used. */ getStyles() { return this.styles_; } /** * Sets the value of the `styles` property. * * @param styles The array of styles to use. */ setStyles(n) { this.styles_ = n; } /** * Returns the value of the `title` property. * * @return The content of the title text. */ getTitle() { return this.title_; } /** * Sets the value of the `title` property. * * @param title The value of the title property. */ setTitle(n) { this.title_ = n; } /** * Returns the value of the `zoomOnClick` property. * * @return True if zoomOnClick property is set. */ getZoomOnClick() { return this.zoomOnClick_; } /** * Sets the value of the `zoomOnClick` property. * * @param zoomOnClick The value of the zoomOnClick property. */ setZoomOnClick(n) { this.zoomOnClick_ = n; } /** * Returns the value of the `averageCenter` property. * * @return True if averageCenter property is set. */ getAverageCenter() { return this.averageCenter_; } /** * Sets the value of the `averageCenter` property. * * @param averageCenter The value of the averageCenter property. */ setAverageCenter(n) { this.averageCenter_ = n; } /** * Returns the value of the `ignoreHidden` property. * * @return True if ignoreHidden property is set. */ getIgnoreHidden() { return this.ignoreHidden_; } /** * Sets the value of the `ignoreHidden` property. * * @param ignoreHidden The value of the ignoreHidden property. */ setIgnoreHidden(n) { this.ignoreHidden_ = n; } /** * Returns the value of the `enableRetinaIcons` property. * * @return True if enableRetinaIcons property is set. */ getEnableRetinaIcons() { return this.enableRetinaIcons_; } /** * Sets the value of the `enableRetinaIcons` property. * * @param enableRetinaIcons The value of the enableRetinaIcons property. */ setEnableRetinaIcons(n) { this.enableRetinaIcons_ = n; } /** * Returns the value of the `imageExtension` property. * * @return The value of the imageExtension property. */ getImageExtension() { return this.imageExtension_; } /** * Sets the value of the `imageExtension` property. * * @param imageExtension The value of the imageExtension property. */ setImageExtension(n) { this.imageExtension_ = n; } /** * Returns the value of the `imagePath` property. *