{\n return new Promise((resolve, reject) => {\n this.loadCallback((err: ErrorEvent) => {\n if (!err) {\n resolve(window.google);\n } else {\n reject(err.error);\n }\n });\n });\n }\n\n /**\n * Load the Google Maps JavaScript API script with a callback.\n */\n public loadCallback(fn: (e: ErrorEvent) => void): void {\n this.callbacks.push(fn);\n this.execute();\n }\n\n /**\n * Set the script on document.\n */\n private setScript(): void {\n if (document.getElementById(this.id)) {\n // TODO wrap onerror callback for cases where the script was loaded elsewhere\n this.callback();\n return;\n }\n\n const url = this.createUrl();\n const script = document.createElement(\"script\");\n script.id = this.id;\n script.type = \"text/javascript\";\n script.src = url;\n script.onerror = this.loadErrorCallback.bind(this);\n script.defer = true;\n script.async = true;\n\n if (this.nonce) {\n script.nonce = this.nonce;\n }\n\n document.head.appendChild(script);\n }\n\n /**\n * Reset the loader state.\n */\n private reset(): void {\n this.deleteScript();\n this.done = false;\n this.loading = false;\n this.errors = [];\n this.onerrorEvent = null;\n }\n\n private resetIfRetryingFailed(): void {\n if (this.failed) {\n this.reset();\n }\n }\n\n private loadErrorCallback(e: ErrorEvent): void {\n this.errors.push(e);\n\n if (this.errors.length <= this.retries) {\n const delay = this.errors.length * 2 ** this.errors.length;\n\n console.log(\n `Failed to load Google Maps script, retrying in ${delay} ms.`\n );\n\n setTimeout(() => {\n this.deleteScript();\n this.setScript();\n }, delay);\n } else {\n this.onerrorEvent = e;\n this.callback();\n }\n }\n\n private setCallback(): void {\n window.__googleMapsCallback = this.callback.bind(this);\n }\n\n private callback(): void {\n this.done = true;\n this.loading = false;\n\n this.callbacks.forEach((cb) => {\n cb(this.onerrorEvent);\n });\n\n this.callbacks = [];\n }\n\n private execute(): void {\n this.resetIfRetryingFailed();\n\n if (this.done) {\n this.callback();\n } else {\n // short circuit and warn if google.maps is already loaded\n if (window.google && window.google.maps && window.google.maps.version) {\n console.warn(\n \"Google Maps already loaded outside @googlemaps/js-api-loader.\" +\n \"This may result in undesirable behavior as options and script parameters may not match.\"\n );\n this.callback();\n return;\n }\n\n if (this.loading) {\n // do nothing but wait\n } else {\n this.loading = true;\n this.setCallback();\n this.setScript();\n }\n }\n }\n}\n","import { alpha, getPath } from '@mui/system';\nexport const colorTransformations = {\n primary: 'primary.main',\n textPrimary: 'text.primary',\n secondary: 'secondary.main',\n textSecondary: 'text.secondary',\n error: 'error.main'\n};\n\nconst transformDeprecatedColors = color => {\n return colorTransformations[color] || color;\n};\n\nconst getTextDecoration = ({\n theme,\n ownerState\n}) => {\n const transformedColor = transformDeprecatedColors(ownerState.color);\n const color = getPath(theme, `palette.${transformedColor}`, false) || ownerState.color;\n const channelColor = getPath(theme, `palette.${transformedColor}Channel`);\n\n if ('vars' in theme && channelColor) {\n return `rgba(${channelColor} / 0.4)`;\n }\n\n return alpha(color, 0.4);\n};\n\nexport default getTextDecoration;","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nconst _excluded = [\"className\", \"color\", \"component\", \"onBlur\", \"onFocus\", \"TypographyClasses\", \"underline\", \"variant\", \"sx\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { elementTypeAcceptingRef } from '@mui/utils';\nimport { unstable_composeClasses as composeClasses } from '@mui/base';\nimport capitalize from '../utils/capitalize';\nimport styled from '../styles/styled';\nimport useThemeProps from '../styles/useThemeProps';\nimport useIsFocusVisible from '../utils/useIsFocusVisible';\nimport useForkRef from '../utils/useForkRef';\nimport Typography from '../Typography';\nimport linkClasses, { getLinkUtilityClass } from './linkClasses';\nimport getTextDecoration, { colorTransformations } from './getTextDecoration';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n component,\n focusVisible,\n underline\n } = ownerState;\n const slots = {\n root: ['root', `underline${capitalize(underline)}`, component === 'button' && 'button', focusVisible && 'focusVisible']\n };\n return composeClasses(slots, getLinkUtilityClass, classes);\n};\n\nconst LinkRoot = styled(Typography, {\n name: 'MuiLink',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, styles[`underline${capitalize(ownerState.underline)}`], ownerState.component === 'button' && styles.button];\n }\n})(({\n theme,\n ownerState\n}) => {\n return _extends({}, ownerState.underline === 'none' && {\n textDecoration: 'none'\n }, ownerState.underline === 'hover' && {\n textDecoration: 'none',\n '&:hover': {\n textDecoration: 'underline'\n }\n }, ownerState.underline === 'always' && _extends({\n textDecoration: 'underline'\n }, ownerState.color !== 'inherit' && {\n textDecorationColor: getTextDecoration({\n theme,\n ownerState\n })\n }, {\n '&:hover': {\n textDecorationColor: 'inherit'\n }\n }), ownerState.component === 'button' && {\n position: 'relative',\n WebkitTapHighlightColor: 'transparent',\n backgroundColor: 'transparent',\n // Reset default value\n // We disable the focus ring for mouse, touch and keyboard users.\n outline: 0,\n border: 0,\n margin: 0,\n // Remove the margin in Safari\n borderRadius: 0,\n padding: 0,\n // Remove the padding in Firefox\n cursor: 'pointer',\n userSelect: 'none',\n verticalAlign: 'middle',\n MozAppearance: 'none',\n // Reset\n WebkitAppearance: 'none',\n // Reset\n '&::-moz-focus-inner': {\n borderStyle: 'none' // Remove Firefox dotted outline.\n\n },\n [`&.${linkClasses.focusVisible}`]: {\n outline: 'auto'\n }\n });\n});\nconst Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {\n const props = useThemeProps({\n props: inProps,\n name: 'MuiLink'\n });\n\n const {\n className,\n color = 'primary',\n component = 'a',\n onBlur,\n onFocus,\n TypographyClasses,\n underline = 'always',\n variant = 'inherit',\n sx\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n\n const {\n isFocusVisibleRef,\n onBlur: handleBlurVisible,\n onFocus: handleFocusVisible,\n ref: focusVisibleRef\n } = useIsFocusVisible();\n const [focusVisible, setFocusVisible] = React.useState(false);\n const handlerRef = useForkRef(ref, focusVisibleRef);\n\n const handleBlur = event => {\n handleBlurVisible(event);\n\n if (isFocusVisibleRef.current === false) {\n setFocusVisible(false);\n }\n\n if (onBlur) {\n onBlur(event);\n }\n };\n\n const handleFocus = event => {\n handleFocusVisible(event);\n\n if (isFocusVisibleRef.current === true) {\n setFocusVisible(true);\n }\n\n if (onFocus) {\n onFocus(event);\n }\n };\n\n const ownerState = _extends({}, props, {\n color,\n component,\n focusVisible,\n underline,\n variant\n });\n\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(LinkRoot, _extends({\n color: color,\n className: clsx(classes.root, className),\n classes: TypographyClasses,\n component: component,\n onBlur: handleBlur,\n onFocus: handleFocus,\n ref: handlerRef,\n ownerState: ownerState,\n variant: variant,\n sx: [...(!Object.keys(colorTransformations).includes(color) ? [{\n color\n }] : []), ...(Array.isArray(sx) ? sx : [sx])]\n }, other));\n});\nprocess.env.NODE_ENV !== \"production\" ? Link.propTypes\n/* remove-proptypes */\n= {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n\n /**\n * @ignore\n */\n className: PropTypes.string,\n\n /**\n * The color of the link.\n * @default 'primary'\n */\n color: PropTypes\n /* @typescript-to-proptypes-ignore */\n .any,\n\n /**\n * The component used for the root node.\n * Either a string to use a HTML element or a component.\n */\n component: elementTypeAcceptingRef,\n\n /**\n * @ignore\n */\n onBlur: PropTypes.func,\n\n /**\n * @ignore\n */\n onFocus: PropTypes.func,\n\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n\n /**\n * `classes` prop applied to the [`Typography`](/material-ui/api/typography/) element.\n */\n TypographyClasses: PropTypes.object,\n\n /**\n * Controls when the link should have an underline.\n * @default 'always'\n */\n underline: PropTypes.oneOf(['always', 'hover', 'none']),\n\n /**\n * Applies the theme typography styles.\n * @default 'inherit'\n */\n variant: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([PropTypes.oneOf(['body1', 'body2', 'button', 'caption', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'inherit', 'overline', 'subtitle1', 'subtitle2']), PropTypes.string])\n} : void 0;\nexport default Link;","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","import React, { Component } from 'react';\n\nconst style = {\n width: '100%',\n height: '100%',\n left: 0,\n top: 0,\n margin: 0,\n padding: 0,\n position: 'absolute',\n};\n\nexport default class GoogleMapMap extends Component {\n shouldComponentUpdate() {\n return false; // disable react on this div\n }\n\n render() {\n const { registerChild } = this.props;\n return ;\n }\n}\n","import EventEmitter from 'eventemitter3';\n\nexport default class MarkerDispatcher extends EventEmitter {\n constructor(gmapInstance) {\n super();\n this.gmapInstance = gmapInstance;\n }\n\n getChildren() {\n return this.gmapInstance.props.children;\n }\n\n getMousePosition() {\n return this.gmapInstance.mouse_;\n }\n\n getUpdateCounter() {\n return this.gmapInstance.updateCounter_;\n }\n\n dispose() {\n this.gmapInstance = null;\n this.removeAllListeners();\n }\n}\n","// https://github.com/acdlite/recompose/blob/master/src/packages/recompose/utils/omit.js\nconst omit = (obj, keys) => {\n const { ...rest } = obj;\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key in rest) {\n delete rest[key];\n }\n }\n return rest;\n};\n\nexport default omit;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @providesModule shallowEqual\n * @typechecks\n * @flow\n */\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n }\n // Step 6.a: NaN == NaN\n // eslint-disable-next-line no-self-compare\n return x !== x && y !== y;\n}\n\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * Returns true when the values of all keys are strictly equal.\n */\nfunction shallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return false;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n for (let i = 0; i < keysA.length; i++) {\n if (\n !hasOwnProperty.call(objB, keysA[i]) ||\n !is(objA[keysA[i]], objB[keysA[i]])\n ) {\n return false;\n }\n }\n\n return true;\n}\n\nexport default shallowEqual;\n/* src: https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js */\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\n// utils\nimport omit from './utils/omit';\nimport shallowEqual from './utils/shallowEqual';\n\nconst mainStyle = {\n width: '100%',\n height: '100%',\n left: 0,\n top: 0,\n margin: 0,\n padding: 0,\n position: 'absolute',\n};\n\nconst style = {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n backgroundColor: 'transparent',\n position: 'absolute',\n};\n\nexport default class GoogleMapMarkers extends Component {\n /* eslint-disable react/forbid-prop-types */\n static propTypes = {\n geoService: PropTypes.any,\n style: PropTypes.any,\n distanceToMouse: PropTypes.func,\n dispatcher: PropTypes.any,\n onChildClick: PropTypes.func,\n onChildMouseDown: PropTypes.func,\n onChildMouseLeave: PropTypes.func,\n onChildMouseEnter: PropTypes.func,\n getHoverDistance: PropTypes.func,\n insideMapPanes: PropTypes.bool,\n prerender: PropTypes.bool,\n };\n /* eslint-enable react/forbid-prop-types */\n\n static defaultProps = {\n insideMapPanes: false,\n prerender: false,\n };\n\n constructor(props) {\n super(props);\n\n this.dimensionsCache_ = {};\n this.hoverKey_ = null;\n this.hoverChildProps_ = null;\n this.allowMouse_ = true;\n\n this.state = { ...this._getState(), hoverKey: null };\n }\n\n componentDidMount() {\n this.props.dispatcher.on('kON_CHANGE', this._onChangeHandler);\n this.props.dispatcher.on(\n 'kON_MOUSE_POSITION_CHANGE',\n this._onMouseChangeHandler\n );\n this.props.dispatcher.on('kON_CLICK', this._onChildClick);\n this.props.dispatcher.on('kON_MDOWN', this._onChildMouseDown);\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n if (this.props.experimental === true) {\n return (\n !shallowEqual(this.props, nextProps) ||\n !shallowEqual(\n omit(this.state, ['hoverKey']),\n omit(nextState, ['hoverKey'])\n )\n );\n }\n\n return (\n !shallowEqual(this.props, nextProps) ||\n !shallowEqual(this.state, nextState)\n );\n }\n\n componentWillUnmount() {\n this.props.dispatcher.removeListener('kON_CHANGE', this._onChangeHandler);\n this.props.dispatcher.removeListener(\n 'kON_MOUSE_POSITION_CHANGE',\n this._onMouseChangeHandler\n );\n this.props.dispatcher.removeListener('kON_CLICK', this._onChildClick);\n this.props.dispatcher.removeListener('kON_MDOWN', this._onChildMouseDown);\n\n this.dimensionsCache_ = null;\n }\n\n _getState = () => ({\n children: this.props.dispatcher.getChildren(),\n updateCounter: this.props.dispatcher.getUpdateCounter(),\n });\n\n _onChangeHandler = () => {\n if (!this.dimensionsCache_) {\n return;\n }\n\n const prevChildCount = (this.state.children || []).length;\n const state = this._getState();\n\n this.setState(\n state,\n () =>\n (state.children || []).length !== prevChildCount &&\n this._onMouseChangeHandler()\n );\n };\n\n _onChildClick = () => {\n if (this.props.onChildClick) {\n if (this.hoverChildProps_) {\n const hoverKey = this.hoverKey_;\n const childProps = this.hoverChildProps_;\n // click works only on hovered item\n this.props.onChildClick(hoverKey, childProps);\n }\n }\n };\n\n _onChildMouseDown = () => {\n if (this.props.onChildMouseDown) {\n if (this.hoverChildProps_) {\n const hoverKey = this.hoverKey_;\n const childProps = this.hoverChildProps_;\n // works only on hovered item\n this.props.onChildMouseDown(hoverKey, childProps);\n }\n }\n };\n\n _onChildMouseEnter = (hoverKey, childProps) => {\n if (!this.dimensionsCache_) {\n return;\n }\n\n if (this.props.onChildMouseEnter) {\n this.props.onChildMouseEnter(hoverKey, childProps);\n }\n\n this.hoverChildProps_ = childProps;\n this.hoverKey_ = hoverKey;\n this.setState({ hoverKey });\n };\n\n _onChildMouseLeave = () => {\n if (!this.dimensionsCache_) {\n return;\n }\n\n const hoverKey = this.hoverKey_;\n const childProps = this.hoverChildProps_;\n\n if (hoverKey !== undefined && hoverKey !== null) {\n if (this.props.onChildMouseLeave) {\n this.props.onChildMouseLeave(hoverKey, childProps);\n }\n\n this.hoverKey_ = null;\n this.hoverChildProps_ = null;\n this.setState({ hoverKey: null });\n }\n };\n\n _onMouseAllow = (value) => {\n if (!value) {\n this._onChildMouseLeave();\n }\n\n this.allowMouse_ = value;\n };\n\n _onMouseChangeHandler = () => {\n if (this.allowMouse_) {\n this._onMouseChangeHandlerRaf();\n }\n };\n\n _onMouseChangeHandlerRaf = () => {\n if (!this.dimensionsCache_) {\n return;\n }\n\n const mp = this.props.dispatcher.getMousePosition();\n\n if (mp) {\n const distances = [];\n const hoverDistance = this.props.getHoverDistance();\n\n React.Children.forEach(this.state.children, (child, childIndex) => {\n if (!child) return;\n // layers\n if (\n child.props.latLng === undefined &&\n child.props.lat === undefined &&\n child.props.lng === undefined\n ) {\n return;\n }\n\n const childKey =\n child.key !== undefined && child.key !== null\n ? child.key\n : childIndex;\n const dist = this.props.distanceToMouse(\n this.dimensionsCache_[childKey],\n mp,\n child.props\n );\n if (dist < hoverDistance) {\n distances.push({\n key: childKey,\n dist,\n props: child.props,\n });\n }\n });\n\n if (distances.length) {\n distances.sort((a, b) => a.dist - b.dist);\n const hoverKey = distances[0].key;\n const childProps = distances[0].props;\n\n if (this.hoverKey_ !== hoverKey) {\n this._onChildMouseLeave();\n\n this._onChildMouseEnter(hoverKey, childProps);\n }\n } else {\n this._onChildMouseLeave();\n }\n } else {\n this._onChildMouseLeave();\n }\n };\n\n _getDimensions = (key) => {\n const childKey = key;\n return this.dimensionsCache_[childKey];\n };\n\n render() {\n const mainElementStyle = this.props.style || mainStyle;\n this.dimensionsCache_ = {};\n\n const markers = React.Children.map(\n this.state.children,\n (child, childIndex) => {\n if (!child) return undefined;\n if (\n child.props.latLng === undefined &&\n child.props.lat === undefined &&\n child.props.lng === undefined\n ) {\n return React.cloneElement(child, {\n $geoService: this.props.geoService,\n $onMouseAllow: this._onMouseAllow,\n $prerender: this.props.prerender,\n });\n }\n\n const latLng =\n child.props.latLng !== undefined\n ? child.props.latLng\n : { lat: child.props.lat, lng: child.props.lng };\n\n const pt = this.props.insideMapPanes\n ? this.props.geoService.fromLatLngToDivPixel(latLng)\n : this.props.geoService.fromLatLngToCenterPixel(latLng);\n\n const stylePtPos = {\n left: pt.x,\n top: pt.y,\n };\n\n // If the component has a southeast corner defined (either as a LatLng, or a separate\n // lat and lng pair), set the width and height based on the distance between the northwest\n // and the southeast corner to lock the overlay to the correct geographic bounds.\n if (\n child.props.seLatLng !== undefined ||\n (child.props.seLat !== undefined && child.props.seLng !== undefined)\n ) {\n const seLatLng =\n child.props.seLatLng !== undefined\n ? child.props.seLatLng\n : { lat: child.props.seLat, lng: child.props.seLng };\n\n const sePt = this.props.insideMapPanes\n ? this.props.geoService.fromLatLngToDivPixel(seLatLng)\n : this.props.geoService.fromLatLngToCenterPixel(seLatLng);\n\n stylePtPos.width = sePt.x - pt.x;\n stylePtPos.height = sePt.y - pt.y;\n }\n\n const containerPt = this.props.geoService.fromLatLngToContainerPixel(\n latLng\n );\n\n // to prevent rerender on child element i need to pass\n // const params $getDimensions and $dimensionKey instead of dimension object\n const childKey =\n child.key !== undefined && child.key !== null\n ? child.key\n : childIndex;\n\n this.dimensionsCache_[childKey] = {\n x: containerPt.x,\n y: containerPt.y,\n ...latLng,\n };\n\n return (\n \n {React.cloneElement(child, {\n $hover: childKey === this.state.hoverKey,\n $getDimensions: this._getDimensions,\n $dimensionKey: childKey,\n $geoService: this.props.geoService,\n $onMouseAllow: this._onMouseAllow,\n $prerender: this.props.prerender,\n })}\n
\n );\n }\n );\n\n return {markers}
;\n }\n}\n","import React from 'react';\nimport GoogleMapMarkers from './google_map_markers';\n\nconst style = {\n width: '50%',\n height: '50%',\n left: '50%',\n top: '50%',\n // backgroundColor: 'red',\n margin: 0,\n padding: 0,\n position: 'absolute',\n // opacity: 0.3\n};\n\nexport default function (props) {\n return (\n \n \n
\n );\n}\n","import { Loader } from '@googlemaps/js-api-loader';\n\nlet loader_;\nlet loadPromise_;\nlet resolveCustomPromise_;\n\nconst _customPromise = new Promise((resolve) => {\n resolveCustomPromise_ = resolve;\n});\n\n// TODO add libraries language and other map options\nexport default (bootstrapURLKeys, heatmapLibrary) => {\n // call from outside google-map-react\n // will be as soon as loadPromise resolved\n if (!bootstrapURLKeys) {\n return _customPromise;\n }\n\n // avoid api to be loaded multiple times\n if (loadPromise_) {\n return loadPromise_;\n }\n\n if (!bootstrapURLKeys.libraries) {\n bootstrapURLKeys.libraries = [];\n }\n\n const libraries = [...bootstrapURLKeys.libraries];\n\n // note: heatmapLibrary will be deprecated on next major\n if (heatmapLibrary) {\n // if heatmapLibrary is present\n // check if we need to add visualization library\n if (libraries.length === 0 || !libraries.includes('visualization')) {\n // if the array isEmpty or visualization is\n // not present, push the visualization library\n libraries.push('visualization');\n }\n console.warn(\n \"heatmapLibrary will be deprecated in the future. Please use { libraries: ['visualization'] } in bootstrapURLKeys property instead\"\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(bootstrapURLKeys).indexOf('callback') > -1) {\n const message = `\"callback\" key in bootstrapURLKeys is not allowed,\n use onGoogleApiLoaded property instead`;\n // eslint-disable-next-line no-console\n console.error(message);\n throw new Error(message);\n }\n }\n\n if (typeof window === 'undefined') {\n throw new Error('google map cannot be loaded outside browser env');\n }\n\n const { key, ...restKeys } = bootstrapURLKeys;\n\n // use single instance of Loader to avoid multiple api loads\n if (!loader_) {\n loader_ = new Loader({\n // need to keep key as a prop for backwards compatibility\n apiKey: key || '',\n ...restKeys,\n libraries,\n });\n }\n\n loadPromise_ = loader_.load().then(() => {\n resolveCustomPromise_(window.google.maps);\n return window.google.maps;\n });\n\n resolveCustomPromise_(loadPromise_);\n\n return loadPromise_;\n};\n","/* eslint-disable import/prefer-default-export */\n\nexport function wrap(n, min, max) {\n const d = max - min;\n return n === max ? n : ((((n - min) % d) + d) % d) + min;\n}\n","import { wrap } from './wrap';\n\nexport default class LatLng {\n static convert = (a) => {\n if (a instanceof LatLng) {\n return a;\n }\n\n if (Array.isArray(a)) {\n return new LatLng(a[0], a[1]);\n }\n\n if ('lng' in a && 'lat' in a) {\n return new LatLng(a.lat, a.lng);\n }\n\n return a;\n };\n\n constructor(lat, lng) {\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error(`Invalid LatLng object: (${lat}, ${lng})`);\n }\n this.lat = +lat;\n this.lng = +lng;\n }\n\n wrap() {\n return new LatLng(this.lat, wrap(this.lng, -180, 180));\n }\n}\n","/* eslint-disable class-methods-use-this */\nimport Point from '@mapbox/point-geometry';\nimport LatLng from './lat_lng';\nimport { wrap } from './wrap';\n\n// A single transform, generally used for a single tile to be scaled, rotated, and zoomed.\nexport default class Transform {\n constructor(tileSize, minZoom, maxZoom) {\n this.tileSize = tileSize || 512; // constant\n\n this._minZoom = minZoom || 0;\n this._maxZoom = maxZoom || 52;\n\n this.latRange = [-85.05113, 85.05113];\n\n this.width = 0;\n this.height = 0;\n this.zoom = 0;\n this.center = new LatLng(0, 0);\n this.angle = 0;\n }\n\n get minZoom() {\n return this._minZoom;\n }\n\n set minZoom(zoom) {\n this._minZoom = zoom;\n this.zoom = Math.max(this.zoom, zoom);\n }\n\n get maxZoom() {\n return this._maxZoom;\n }\n\n set maxZoom(zoom) {\n this._maxZoom = zoom;\n this.zoom = Math.min(this.zoom, zoom);\n }\n\n get worldSize() {\n return this.tileSize * this.scale;\n }\n\n get centerPoint() {\n return new Point(0, 0); // this.size._div(2);\n }\n\n get size() {\n return new Point(this.width, this.height);\n }\n\n get bearing() {\n return (-this.angle / Math.PI) * 180;\n }\n\n set bearing(bearing) {\n this.angle = (-wrap(bearing, -180, 180) * Math.PI) / 180;\n }\n\n get zoom() {\n return this._zoom;\n }\n\n set zoom(zoom) {\n const zoomV = Math.min(Math.max(zoom, this.minZoom), this.maxZoom);\n this._zoom = zoomV;\n this.scale = this.zoomScale(zoomV);\n this.tileZoom = Math.floor(zoomV);\n this.zoomFraction = zoomV - this.tileZoom;\n }\n\n zoomScale(zoom) {\n return Math.pow(2, zoom);\n }\n\n scaleZoom(scale) {\n return Math.log(scale) / Math.LN2;\n }\n\n project(latlng, worldSize) {\n return new Point(\n this.lngX(latlng.lng, worldSize),\n this.latY(latlng.lat, worldSize)\n );\n }\n\n unproject(point, worldSize) {\n return new LatLng(\n this.yLat(point.y, worldSize),\n this.xLng(point.x, worldSize)\n );\n }\n\n get x() {\n return this.lngX(this.center.lng);\n }\n\n get y() {\n return this.latY(this.center.lat);\n }\n\n get point() {\n return new Point(this.x, this.y);\n }\n\n // lat/lon <-> absolute pixel coords convertion\n lngX(lon, worldSize) {\n return ((180 + lon) * (worldSize || this.worldSize)) / 360;\n }\n\n // latitude to absolute y coord\n latY(lat, worldSize) {\n const y =\n (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));\n return ((180 - y) * (worldSize || this.worldSize)) / 360;\n }\n\n xLng(x, worldSize) {\n return (x * 360) / (worldSize || this.worldSize) - 180;\n }\n\n yLat(y, worldSize) {\n const y2 = 180 - (y * 360) / (worldSize || this.worldSize);\n return (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n\n locationPoint(latlng) {\n const p = this.project(latlng);\n return this.centerPoint._sub(this.point._sub(p)._rotate(this.angle));\n }\n\n pointLocation(p) {\n const p2 = this.centerPoint._sub(p)._rotate(-this.angle);\n return this.unproject(this.point.sub(p2));\n }\n}\n","import Point from '@mapbox/point-geometry';\n\nimport LatLng from './lat_lng';\nimport Transform from './transform';\n\nexport default class Geo {\n constructor(tileSize) {\n // left_top view пользует гугл\n // super();\n this.hasSize_ = false;\n this.hasView_ = false;\n this.transform_ = new Transform(tileSize || 512);\n }\n\n setView(center, zoom, bearing) {\n this.transform_.center = LatLng.convert(center);\n this.transform_.zoom = +zoom;\n this.transform_.bearing = +bearing;\n this.hasView_ = true;\n }\n\n setViewSize(width, height) {\n this.transform_.width = width;\n this.transform_.height = height;\n this.hasSize_ = true;\n }\n\n setMapCanvasProjection(maps, mapCanvasProjection) {\n this.maps_ = maps;\n this.mapCanvasProjection_ = mapCanvasProjection;\n }\n\n canProject() {\n return this.hasSize_ && this.hasView_;\n }\n\n hasSize() {\n return this.hasSize_;\n }\n\n /** Returns the pixel position relative to the map center. */\n fromLatLngToCenterPixel(ptLatLng) {\n return this.transform_.locationPoint(LatLng.convert(ptLatLng));\n }\n\n /**\n * Returns the pixel position relative to the map panes,\n * or relative to the map center if there are no panes.\n */\n fromLatLngToDivPixel(ptLatLng) {\n if (this.mapCanvasProjection_) {\n const latLng = new this.maps_.LatLng(ptLatLng.lat, ptLatLng.lng);\n return this.mapCanvasProjection_.fromLatLngToDivPixel(latLng);\n }\n return this.fromLatLngToCenterPixel(ptLatLng);\n }\n\n /** Returns the pixel position relative to the map top-left. */\n fromLatLngToContainerPixel(ptLatLng) {\n if (this.mapCanvasProjection_) {\n const latLng = new this.maps_.LatLng(ptLatLng.lat, ptLatLng.lng);\n return this.mapCanvasProjection_.fromLatLngToContainerPixel(latLng);\n }\n\n const pt = this.fromLatLngToCenterPixel(ptLatLng);\n pt.x -=\n this.transform_.worldSize * Math.round(pt.x / this.transform_.worldSize);\n\n pt.x += this.transform_.width / 2;\n pt.y += this.transform_.height / 2;\n\n return pt;\n }\n\n /** Returns the LatLng for the given offset from the map top-left. */\n fromContainerPixelToLatLng(ptXY) {\n if (this.mapCanvasProjection_) {\n const latLng = this.mapCanvasProjection_.fromContainerPixelToLatLng(ptXY);\n return { lat: latLng.lat(), lng: latLng.lng() };\n }\n\n const ptxy = { ...ptXY };\n ptxy.x -= this.transform_.width / 2;\n ptxy.y -= this.transform_.height / 2;\n const ptRes = this.transform_.pointLocation(Point.convert(ptxy));\n\n ptRes.lng -= 360 * Math.round(ptRes.lng / 360); // convert 2 google format\n return ptRes;\n }\n\n getWidth() {\n return this.transform_.width;\n }\n\n getHeight() {\n return this.transform_.height;\n }\n\n getZoom() {\n return this.transform_.zoom;\n }\n\n getCenter() {\n const ptRes = this.transform_.pointLocation({ x: 0, y: 0 });\n\n return ptRes;\n }\n\n getBounds(margins, roundFactor) {\n const bndT = (margins && margins[0]) || 0;\n const bndR = (margins && margins[1]) || 0;\n const bndB = (margins && margins[2]) || 0;\n const bndL = (margins && margins[3]) || 0;\n\n if (\n this.getWidth() - bndR - bndL > 0 &&\n this.getHeight() - bndT - bndB > 0\n ) {\n const topLeftCorner = this.transform_.pointLocation(\n Point.convert({\n x: bndL - this.getWidth() / 2,\n y: bndT - this.getHeight() / 2,\n })\n );\n const bottomRightCorner = this.transform_.pointLocation(\n Point.convert({\n x: this.getWidth() / 2 - bndR,\n y: this.getHeight() / 2 - bndB,\n })\n );\n\n let res = [\n topLeftCorner.lat,\n topLeftCorner.lng, // NW\n bottomRightCorner.lat,\n bottomRightCorner.lng, // SE\n bottomRightCorner.lat,\n topLeftCorner.lng, // SW\n topLeftCorner.lat,\n bottomRightCorner.lng, // NE\n ];\n\n if (roundFactor) {\n res = res.map((r) => Math.round(r * roundFactor) / roundFactor);\n }\n return res;\n }\n\n return [0, 0, 0, 0];\n }\n}\n","export default function raf(callback) {\n if (window.requestAnimationFrame) {\n return window.requestAnimationFrame(callback);\n }\n\n const nativeRaf =\n window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;\n\n return nativeRaf\n ? nativeRaf(callback)\n : window.setTimeout(callback, 1e3 / 60);\n}\n","const log2 = Math.log2 ? Math.log2 : (x) => Math.log(x) / Math.LN2;\n\nexport default log2;\n","// source taken from https://github.com/rackt/redux/blob/master/src/utils/pick.js\n\nexport default function pick(obj, fn) {\n return Object.keys(obj).reduce((result, key) => {\n if (fn(obj[key])) {\n result[key] = obj[key]; // eslint-disable-line\n }\n return result;\n }, {});\n}\n","const isEmpty = (val) => {\n // check for empty object {}, array []\n if (val !== null && typeof val === 'object') {\n if (Object.keys(val).length === 0) {\n return true;\n }\n } else if (val === null || val === undefined || val === '') {\n // check for undefined, null and \"\"\n return true;\n }\n return false;\n};\n\nexport default isEmpty;\n","function isObjectLike(value) {\n return !!value && typeof value === 'object';\n}\n\nconst objectToString = Object.prototype.toString;\n\nexport default function isNumber(value) {\n const numberTag = '[object Number]';\n return (\n typeof value === 'number' ||\n (isObjectLike(value) && objectToString.call(value) === numberTag)\n );\n}\n","// http://stackoverflow.com/questions/5899783/detect-safari-chrome-ie-firefox-opera-with-user-agent\nlet detectBrowserResult_ = null;\n\nexport default function detectBrowser() {\n if (detectBrowserResult_) {\n return detectBrowserResult_;\n }\n\n if (typeof navigator !== 'undefined') {\n const isExplorer = navigator.userAgent.indexOf('MSIE') > -1;\n const isFirefox = navigator.userAgent.indexOf('Firefox') > -1;\n const isOpera = navigator.userAgent.toLowerCase().indexOf('op') > -1;\n\n let isChrome = navigator.userAgent.indexOf('Chrome') > -1;\n let isSafari = navigator.userAgent.indexOf('Safari') > -1;\n\n if (isChrome && isSafari) {\n isSafari = false;\n }\n\n if (isChrome && isOpera) {\n isChrome = false;\n }\n\n detectBrowserResult_ = {\n isExplorer,\n isFirefox,\n isOpera,\n isChrome,\n isSafari,\n };\n return detectBrowserResult_;\n }\n\n detectBrowserResult_ = {\n isChrome: true,\n isExplorer: false,\n isFirefox: false,\n isOpera: false,\n isSafari: false,\n };\n\n return detectBrowserResult_;\n}\n","// source taken from https://github.com/rackt/redux/blob/master/src/utils/isPlainObject.js\nconst fnToString = (fn) => Function.prototype.toString.call(fn);\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nexport default function isPlainObject(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n const proto =\n typeof obj.constructor === 'function'\n ? Object.getPrototypeOf(obj)\n : Object.prototype;\n\n if (proto === null) {\n return true;\n }\n\n const constructor = proto.constructor;\n\n return (\n typeof constructor === 'function' &&\n constructor instanceof constructor &&\n fnToString(constructor) === fnToString(Object)\n );\n}\n","// feature detection for passive support\n// see: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\nfunction hasPassiveSupport() {\n let passiveSupported = false;\n\n try {\n const options = Object.defineProperty({}, 'passive', {\n get() {\n passiveSupported = true;\n },\n });\n\n window.addEventListener('test', options, options);\n window.removeEventListener('test', options, options);\n } catch (err) {\n passiveSupported = false;\n }\n\n return passiveSupported;\n}\n\nexport default function addPassiveEventListener(\n element,\n eventName,\n func,\n capture\n) {\n element.addEventListener(\n eventName,\n func,\n hasPassiveSupport()\n ? {\n capture,\n passive: true,\n }\n : capture\n );\n}\n","/* eslint-disable */\n/**\n* Detect Element Resize.\n* Forked in order to guard against unsafe 'window' and 'document' references.\n*\n* https://github.com/sdecima/javascript-detect-element-resize\n* Sebastian Decima\n*\n* version: 0.5.3\n**/\n\nimport addPassiveEventListener from './passiveEvents';\n\n// Reliable `window` and `document` detection\nvar canUseDOM = !!(typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement);\n\n// Check `document` and `window` in case of server-side rendering\nvar _window;\nif (canUseDOM) {\n _window = window;\n} else if (typeof self !== 'undefined') {\n _window = self;\n} else {\n _window = this;\n}\n\nvar attachEvent = typeof document !== 'undefined' && document.attachEvent;\nvar stylesCreated = false;\n\nif (canUseDOM && !attachEvent) {\n var requestFrame = (function () {\n var raf = _window.requestAnimationFrame ||\n _window.mozRequestAnimationFrame ||\n _window.webkitRequestAnimationFrame ||\n function (fn) {\n return _window.setTimeout(fn, 20);\n };\n return function (fn) {\n return raf(fn);\n };\n })();\n\n var cancelFrame = (function () {\n var cancel = _window.cancelAnimationFrame ||\n _window.mozCancelAnimationFrame ||\n _window.webkitCancelAnimationFrame ||\n _window.clearTimeout;\n return function (id) {\n return cancel(id);\n };\n })();\n\n var resetTriggers = function (element) {\n var triggers = element.__resizeTriggers__,\n expand = triggers.firstElementChild,\n contract = triggers.lastElementChild,\n expandChild = expand.firstElementChild;\n contract.scrollLeft = contract.scrollWidth;\n contract.scrollTop = contract.scrollHeight;\n expandChild.style.width = expand.offsetWidth + 1 + 'px';\n expandChild.style.height = expand.offsetHeight + 1 + 'px';\n expand.scrollLeft = expand.scrollWidth;\n expand.scrollTop = expand.scrollHeight;\n };\n\n var checkTriggers = function (element) {\n return element.offsetWidth != element.__resizeLast__.width ||\n element.offsetHeight != element.__resizeLast__.height;\n };\n\n var scrollListener = function (e) {\n var element = this;\n resetTriggers(this);\n if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__);\n this.__resizeRAF__ = requestFrame(function () {\n if (checkTriggers(element)) {\n element.__resizeLast__.width = element.offsetWidth;\n element.__resizeLast__.height = element.offsetHeight;\n element.__resizeListeners__.forEach(function (fn) {\n fn.call(element, e);\n });\n }\n });\n };\n\n /* Detect CSS Animations support to detect element display/re-attach */\n var animation = false,\n animationstring = 'animation',\n keyframeprefix = '',\n animationstartevent = 'animationstart',\n domPrefixes = 'Webkit Moz O ms'.split(' '),\n startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(\n ' '\n ),\n pfx = '';\n\n if (canUseDOM) {\n var elm = document.createElement('fakeelement');\n if (elm.style.animationName !== undefined) {\n animation = true;\n }\n\n if (animation === false) {\n for (var i = 0; i < domPrefixes.length; i++) {\n if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {\n pfx = domPrefixes[i];\n animationstring = pfx + 'Animation';\n keyframeprefix = '-' + pfx.toLowerCase() + '-';\n animationstartevent = startEvents[i];\n animation = true;\n break;\n }\n }\n }\n }\n\n var animationName = 'resizeanim';\n var animationKeyframes = '@' +\n keyframeprefix +\n 'keyframes ' +\n animationName +\n ' { from { opacity: 0; } to { opacity: 0; } } ';\n var animationStyle = keyframeprefix +\n 'animation: 1ms ' +\n animationName +\n '; ';\n}\n\nvar createStyles = function () {\n if (!stylesCreated) {\n //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360\n var css = (animationKeyframes ? animationKeyframes : '') +\n '.resize-triggers { ' +\n (animationStyle ? animationStyle : '') +\n 'visibility: hidden; opacity: 0; } ' +\n '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',\n head = document.head || document.getElementsByTagName('head')[0],\n style = document.createElement('style');\n\n style.type = 'text/css';\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n\n head.appendChild(style);\n stylesCreated = true;\n }\n};\n\nvar addResizeListener = function (element, fn) {\n if (element.parentNode === undefined) {\n var tempParentDiv = document.createElement('div');\n element.parentNode = tempParentDiv;\n }\n element = element.parentNode;\n if (attachEvent)\n element.attachEvent('onresize', fn);\n else {\n if (!element.__resizeTriggers__) {\n if (getComputedStyle(element).position == 'static')\n element.style.position = 'relative';\n createStyles();\n element.__resizeLast__ = {};\n element.__resizeListeners__ = [];\n (element.__resizeTriggers__ = document.createElement(\n 'div'\n )).className = 'resize-triggers';\n element.__resizeTriggers__.innerHTML = '' +\n '';\n element.appendChild(element.__resizeTriggers__);\n resetTriggers(element);\n\n addPassiveEventListener(element, 'scroll', scrollListener, true);\n\n /* Listen for a css animation to detect element display/re-attach */\n animationstartevent &&\n element.__resizeTriggers__.addEventListener(\n animationstartevent,\n function (e) {\n if (e.animationName == animationName) resetTriggers(element);\n }\n );\n }\n element.__resizeListeners__.push(fn);\n }\n};\n\nvar removeResizeListener = function (element, fn) {\n element = element.parentNode;\n if (attachEvent)\n element.detachEvent('onresize', fn);\n else {\n element.__resizeListeners__.splice(\n element.__resizeListeners__.indexOf(fn),\n 1\n );\n if (!element.__resizeListeners__.length) {\n element.removeEventListener('scroll', scrollListener);\n element.__resizeTriggers__ = !element.removeChild(\n element.__resizeTriggers__\n );\n }\n }\n};\n\nexport {\n addResizeListener,\n removeResizeListener,\n};\n","/* eslint-disable import/no-extraneous-dependencies, react/forbid-prop-types, react/no-find-dom-node, no-console, no-undef */\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\n\n// helpers\nimport GoogleMapMap from './google_map_map';\nimport MarkerDispatcher from './marker_dispatcher';\nimport GoogleMapMarkers from './google_map_markers';\nimport GoogleMapMarkersPrerender from './google_map_markers_prerender';\nimport { generateHeatmap, optionsHeatmap } from './google_heatmap';\n\n// loaders\nimport googleMapLoader from './loaders/google_map_loader';\n\n// lib\nimport Geo from './lib/geo';\n\n// tools\nimport raf from './utils/raf';\nimport log2 from './utils/log2';\nimport omit from './utils/omit';\nimport pick from './utils/pick';\nimport isEmpty from './utils/isEmpty';\nimport isNumber from './utils/isNumber';\nimport detectBrowser from './utils/detect';\nimport shallowEqual from './utils/shallowEqual';\nimport isPlainObject from './utils/isPlainObject';\nimport isArraysEqualEps from './utils/isArraysEqualEps';\nimport {\n addResizeListener,\n removeResizeListener,\n} from './utils/detectElementResize';\nimport addPassiveEventListener from './utils/passiveEvents';\n\n// consts\nconst kEPS = 0.00001;\nconst K_GOOGLE_TILE_SIZE = 256;\n// real minZoom calculated here _getMinZoom\nconst K_IDLE_TIMEOUT = 100;\nconst K_IDLE_CLICK_TIMEOUT = 300;\nconst DEFAULT_MIN_ZOOM = 3;\n// Starting with version 3.32, the maps API calls `draw()` each frame during\n// a zoom animation.\nconst DRAW_CALLED_DURING_ANIMATION_VERSION = 32;\nconst IS_REACT_16 = ReactDOM.createPortal !== undefined;\n\nconst createPortal = IS_REACT_16\n ? ReactDOM.createPortal\n : ReactDOM.unstable_renderSubtreeIntoContainer;\n\nfunction defaultOptions_(/* maps */) {\n return {\n overviewMapControl: false,\n streetViewControl: false,\n rotateControl: true,\n mapTypeControl: false,\n // disable poi\n styles: [\n {\n featureType: 'poi',\n elementType: 'labels',\n stylers: [{ visibility: 'off' }],\n },\n ],\n minZoom: DEFAULT_MIN_ZOOM, // dynamically recalculted if possible during init\n };\n}\n\nconst latLng2Obj = (latLng) =>\n isPlainObject(latLng) ? latLng : { lat: latLng[0], lng: latLng[1] };\n\nconst _checkMinZoom = (zoom, minZoom) => {\n if (process.env.NODE_ENV !== 'production') {\n if (zoom < minZoom) {\n console.warn(\n 'GoogleMap: ' + // eslint-disable-line\n 'minZoom option is less than recommended ' +\n 'minZoom option for your map sizes.\\n' +\n 'overrided to value ' +\n minZoom\n );\n }\n }\n\n if (minZoom < zoom) {\n return zoom;\n }\n return minZoom;\n};\n\nconst isFullScreen = () =>\n document.fullscreen ||\n document.webkitIsFullScreen ||\n document.mozFullScreen ||\n document.msFullscreenElement;\n\nclass GoogleMap extends Component {\n static propTypes = {\n apiKey: PropTypes.string,\n bootstrapURLKeys: PropTypes.any,\n\n defaultCenter: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.shape({\n lat: PropTypes.number,\n lng: PropTypes.number,\n }),\n ]),\n center: PropTypes.oneOfType([\n PropTypes.array,\n PropTypes.shape({\n lat: PropTypes.number,\n lng: PropTypes.number,\n }),\n ]),\n defaultZoom: PropTypes.number,\n zoom: PropTypes.number,\n onBoundsChange: PropTypes.func,\n onChange: PropTypes.func,\n onClick: PropTypes.func,\n onChildClick: PropTypes.func,\n onChildMouseDown: PropTypes.func,\n onChildMouseUp: PropTypes.func,\n onChildMouseMove: PropTypes.func,\n onChildMouseEnter: PropTypes.func,\n onChildMouseLeave: PropTypes.func,\n onZoomAnimationStart: PropTypes.func,\n onZoomAnimationEnd: PropTypes.func,\n onDrag: PropTypes.func,\n onDragEnd: PropTypes.func,\n onMapTypeIdChange: PropTypes.func,\n onTilesLoaded: PropTypes.func,\n options: PropTypes.any,\n distanceToMouse: PropTypes.func,\n hoverDistance: PropTypes.number,\n debounced: PropTypes.bool,\n margin: PropTypes.array,\n googleMapLoader: PropTypes.any,\n onGoogleApiLoaded: PropTypes.func,\n yesIWantToUseGoogleMapApiInternals: PropTypes.bool,\n draggable: PropTypes.bool,\n style: PropTypes.any,\n resetBoundsOnResize: PropTypes.bool,\n layerTypes: PropTypes.arrayOf(PropTypes.string), // ['TransitLayer', 'TrafficLayer']\n shouldUnregisterMapOnUnmount: PropTypes.bool,\n };\n\n static defaultProps = {\n distanceToMouse(pt, mousePos /* , markerProps */) {\n return Math.sqrt(\n (pt.x - mousePos.x) * (pt.x - mousePos.x) +\n (pt.y - mousePos.y) * (pt.y - mousePos.y)\n );\n },\n hoverDistance: 30,\n debounced: true,\n options: defaultOptions_,\n googleMapLoader,\n yesIWantToUseGoogleMapApiInternals: false,\n style: {\n width: '100%',\n height: '100%',\n margin: 0,\n padding: 0,\n position: 'relative',\n },\n layerTypes: [],\n heatmap: {},\n heatmapLibrary: false,\n shouldUnregisterMapOnUnmount: true,\n };\n\n static googleMapLoader = googleMapLoader; // eslint-disable-line\n\n constructor(props) {\n super(props);\n this.mounted_ = false;\n this.initialized_ = false;\n this.googleApiLoadedCalled_ = false;\n\n this.map_ = null;\n this.maps_ = null;\n this.prevBounds_ = null;\n this.heatmap = null;\n\n this.layers_ = {};\n\n this.mouse_ = null;\n this.mouseMoveTime_ = 0;\n this.boundingRect_ = null;\n this.mouseInMap_ = true;\n\n this.dragTime_ = 0;\n this.fireMouseEventOnIdle_ = false;\n this.updateCounter_ = 0;\n\n this.markersDispatcher_ = new MarkerDispatcher(this);\n this.geoService_ = new Geo(K_GOOGLE_TILE_SIZE);\n this.centerIsObject_ = isPlainObject(this.props.center);\n\n this.minZoom_ = DEFAULT_MIN_ZOOM;\n this.defaultDraggableOption_ = true;\n\n this.zoomControlClickTime_ = 0;\n\n this.childMouseDownArgs_ = null;\n this.childMouseUpTime_ = 0;\n\n this.googleMapDom_ = null;\n\n if (process.env.NODE_ENV !== 'production') {\n if (this.props.apiKey) {\n console.warn(\n 'GoogleMap: ' + // eslint-disable-line no-console\n 'apiKey is deprecated, use ' +\n 'bootstrapURLKeys={{key: YOUR_API_KEY}} instead.'\n );\n }\n\n if (this.props.onBoundsChange) {\n console.warn(\n 'GoogleMap: ' + // eslint-disable-line no-console\n 'onBoundsChange is deprecated, use ' +\n 'onChange({center, zoom, bounds, ...other}) instead.'\n );\n }\n\n if (isEmpty(this.props.center) && isEmpty(this.props.defaultCenter)) {\n console.warn(\n 'GoogleMap: center or defaultCenter property must be defined' // eslint-disable-line no-console\n );\n }\n\n if (isEmpty(this.props.zoom) && isEmpty(this.props.defaultZoom)) {\n console.warn(\n 'GoogleMap: zoom or defaultZoom property must be defined' // eslint-disable-line no-console\n );\n }\n }\n\n if (this._isCenterDefined(this.props.center || this.props.defaultCenter)) {\n const propsCenter = latLng2Obj(\n this.props.center || this.props.defaultCenter\n );\n this.geoService_.setView(\n propsCenter,\n this.props.zoom || this.props.defaultZoom,\n 0\n );\n }\n\n this.zoomAnimationInProgress_ = false;\n\n this.state = {\n overlay: null,\n };\n }\n\n componentDidMount() {\n this.mounted_ = true;\n addPassiveEventListener(window, 'resize', this._onWindowResize, false);\n addPassiveEventListener(window, 'keydown', this._onKeyDownCapture, true);\n const mapDom = ReactDOM.findDOMNode(this.googleMapDom_);\n // gmap can't prevent map drag if mousedown event already occured\n // the only workaround I find is prevent mousedown native browser event\n\n if (mapDom) {\n addPassiveEventListener(\n mapDom,\n 'mousedown',\n this._onMapMouseDownNative,\n true\n );\n }\n\n addPassiveEventListener(window, 'mouseup', this._onChildMouseUp, false);\n const bootstrapURLKeys = {\n ...(this.props.apiKey && { key: this.props.apiKey }),\n ...this.props.bootstrapURLKeys,\n };\n\n this.props.googleMapLoader(bootstrapURLKeys, this.props.heatmapLibrary); // we can start load immediatly\n\n setTimeout(\n () => {\n // to detect size\n this._setViewSize();\n if (\n this._isCenterDefined(this.props.center || this.props.defaultCenter)\n ) {\n this._initMap();\n }\n },\n 0,\n this\n );\n if (this.props.resetBoundsOnResize) {\n const that = this;\n addResizeListener(mapDom, that._mapDomResizeCallback);\n }\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n // draggable does not affect inner components\n return (\n !shallowEqual(\n omit(this.props, ['draggable']),\n omit(nextProps, ['draggable'])\n ) || !shallowEqual(this.state, nextState)\n );\n }\n\n componentDidUpdate(prevProps) {\n if (process.env.NODE_ENV !== 'production') {\n if (!shallowEqual(prevProps.defaultCenter, this.props.defaultCenter)) {\n console.warn(\n \"GoogleMap: defaultCenter prop changed. You can't change default props.\"\n );\n }\n\n if (!shallowEqual(prevProps.defaultZoom, this.props.defaultZoom)) {\n console.warn(\n \"GoogleMap: defaultZoom prop changed. You can't change default props.\"\n );\n }\n }\n\n if (\n !this._isCenterDefined(prevProps.center) &&\n this._isCenterDefined(this.props.center)\n ) {\n setTimeout(() => this._initMap(), 0);\n }\n\n if (this.map_) {\n const centerLatLng = this.geoService_.getCenter();\n if (this._isCenterDefined(this.props.center)) {\n const currentCenter = latLng2Obj(this.props.center);\n const prevCenter = this._isCenterDefined(prevProps.center)\n ? latLng2Obj(prevProps.center)\n : null;\n\n if (\n !prevCenter ||\n Math.abs(currentCenter.lat - prevCenter.lat) +\n Math.abs(currentCenter.lng - prevCenter.lng) >\n kEPS\n ) {\n if (\n Math.abs(currentCenter.lat - centerLatLng.lat) +\n Math.abs(currentCenter.lng - centerLatLng.lng) >\n kEPS\n ) {\n this.map_.panTo({\n lat: currentCenter.lat,\n lng: currentCenter.lng,\n });\n }\n }\n }\n\n if (!isEmpty(this.props.zoom)) {\n // if zoom chaged by user\n if (Math.abs(this.props.zoom - prevProps.zoom) > 0) {\n this.map_.setZoom(this.props.zoom);\n }\n }\n\n if (!isEmpty(prevProps.draggable) && isEmpty(this.props.draggable)) {\n // reset to default\n this.map_.setOptions({ draggable: this.defaultDraggableOption_ });\n } else if (!shallowEqual(prevProps.draggable, this.props.draggable)) {\n // also prevent this on window 'mousedown' event to prevent map move\n this.map_.setOptions({ draggable: this.props.draggable });\n }\n\n // use shallowEqual to try avoid calling map._setOptions if only the ref changes\n if (\n !isEmpty(this.props.options) &&\n !shallowEqual(prevProps.options, this.props.options)\n ) {\n const mapPlainObjects = pick(this.maps_, isPlainObject);\n let options =\n typeof this.props.options === 'function'\n ? this.props.options(mapPlainObjects)\n : this.props.options;\n // remove zoom, center and draggable options as these are managed by google-maps-react\n options = omit(options, ['zoom', 'center', 'draggable']);\n\n if ('minZoom' in options) {\n const minZoom = this._computeMinZoom(options.minZoom);\n options.minZoom = _checkMinZoom(options.minZoom, minZoom);\n }\n\n this.map_.setOptions(options);\n }\n\n if (!shallowEqual(this.props.layerTypes, prevProps.layerTypes)) {\n Object.keys(this.layers_).forEach((layerKey) => {\n this.layers_[layerKey].setMap(null);\n delete this.layers_[layerKey];\n });\n this._setLayers(this.props.layerTypes);\n }\n\n if (\n this.heatmap &&\n !shallowEqual(this.props.heatmap.positions, prevProps.heatmap.positions)\n ) {\n this.heatmap.setData(\n this.props.heatmap.positions.map((p) => ({\n location: new this.maps_.LatLng(p.lat, p.lng),\n weight: p.weight,\n }))\n );\n }\n if (\n this.heatmap &&\n !shallowEqual(this.props.heatmap.options, prevProps.heatmap.options)\n ) {\n Object.keys(this.props.heatmap.options).forEach((option) => {\n this.heatmap.set(option, this.props.heatmap.options[option]);\n });\n }\n }\n // emit actions\n this.markersDispatcher_.emit('kON_CHANGE');\n\n if (!shallowEqual(this.props.hoverDistance, prevProps.hoverDistance)) {\n this.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE');\n }\n }\n\n componentWillUnmount() {\n this.mounted_ = false;\n const mapDom = ReactDOM.findDOMNode(this.googleMapDom_);\n if (mapDom) {\n mapDom.removeEventListener('mousedown', this._onMapMouseDownNative, true);\n }\n window.removeEventListener('resize', this._onWindowResize);\n window.removeEventListener('keydown', this._onKeyDownCapture);\n window.removeEventListener('mouseup', this._onChildMouseUp, false);\n if (this.props.resetBoundsOnResize) {\n removeResizeListener(mapDom, this._mapDomResizeCallback);\n }\n\n if (this.overlay_) {\n // this triggers overlay_.onRemove(), which will unmount the \n this.overlay_.setMap(null);\n }\n\n if (this.maps_ && this.map_ && this.props.shouldUnregisterMapOnUnmount) {\n // fix google, as otherwise listeners works even without map\n this.map_.setOptions({ scrollwheel: false });\n this.maps_.event.clearInstanceListeners(this.map_);\n }\n\n if (this.props.shouldUnregisterMapOnUnmount) {\n this.map_ = null;\n this.maps_ = null;\n }\n this.markersDispatcher_.dispose();\n\n this.resetSizeOnIdle_ = false;\n\n if (this.props.shouldUnregisterMapOnUnmount) {\n delete this.map_;\n delete this.markersDispatcher_;\n }\n }\n\n // calc minZoom if map size available\n // it's better to not set minZoom less than this calculation gives\n // otherwise there is no homeomorphism between screen coordinates and map\n // (one map coordinate can have different screen coordinates)\n _getMinZoom = () => {\n if (this.geoService_.getWidth() > 0 || this.geoService_.getHeight() > 0) {\n const tilesPerWidth =\n Math.ceil(this.geoService_.getWidth() / K_GOOGLE_TILE_SIZE) + 2;\n const tilesPerHeight =\n Math.ceil(this.geoService_.getHeight() / K_GOOGLE_TILE_SIZE) + 2;\n const maxTilesPerDim = Math.max(tilesPerWidth, tilesPerHeight);\n return Math.ceil(log2(maxTilesPerDim));\n }\n return DEFAULT_MIN_ZOOM;\n };\n\n _computeMinZoom = (minZoom) => {\n if (!isEmpty(minZoom)) {\n return minZoom;\n }\n return this._getMinZoom();\n };\n\n _mapDomResizeCallback = () => {\n this.resetSizeOnIdle_ = true;\n if (this.maps_) {\n const originalCenter = this.props.center || this.props.defaultCenter;\n const currentCenter = this.map_.getCenter();\n this.maps_.event.trigger(this.map_, 'resize');\n this.map_.setCenter(\n this.props.resetBoundsOnResize ? originalCenter : currentCenter\n );\n }\n };\n\n _setLayers = (layerTypes) => {\n layerTypes.forEach((layerType) => {\n this.layers_[layerType] = new this.maps_[layerType]();\n this.layers_[layerType].setMap(this.map_);\n });\n };\n\n _renderPortal = () => (\n \n );\n\n _initMap = () => {\n // only initialize the map once\n if (this.initialized_) {\n return;\n }\n this.initialized_ = true;\n\n const propsCenter = latLng2Obj(\n this.props.center || this.props.defaultCenter\n );\n this.geoService_.setView(\n propsCenter,\n this.props.zoom || this.props.defaultZoom,\n 0\n );\n\n this._onBoundsChanged(); // now we can calculate map bounds center etc...\n\n const bootstrapURLKeys = {\n ...(this.props.apiKey && { key: this.props.apiKey }),\n ...this.props.bootstrapURLKeys,\n };\n\n this.props\n .googleMapLoader(bootstrapURLKeys, this.props.heatmapLibrary)\n .then((maps) => {\n if (!this.mounted_) {\n return;\n }\n\n const centerLatLng = this.geoService_.getCenter();\n\n const propsOptions = {\n zoom: this.props.zoom || this.props.defaultZoom,\n center: new maps.LatLng(centerLatLng.lat, centerLatLng.lng),\n };\n\n // Start Heatmap\n if (this.props.heatmap.positions) {\n Object.assign(this, {\n heatmap: generateHeatmap(maps, this.props.heatmap),\n });\n optionsHeatmap(this.heatmap, this.props.heatmap);\n }\n // End Heatmap\n\n // prevent to exapose full api\n // next props must be exposed (console.log(Object.keys(pick(maps, isPlainObject))))\n // \"Animation\", \"ControlPosition\", \"MapTypeControlStyle\", \"MapTypeId\",\n // \"NavigationControlStyle\", \"ScaleControlStyle\", \"StrokePosition\",\n // \"SymbolPath\", \"ZoomControlStyle\",\n // \"event\", \"DirectionsStatus\", \"DirectionsTravelMode\", \"DirectionsUnitSystem\",\n // \"DistanceMatrixStatus\",\n // \"DistanceMatrixElementStatus\", \"ElevationStatus\", \"GeocoderLocationType\",\n // \"GeocoderStatus\", \"KmlLayerStatus\",\n // \"MaxZoomStatus\", \"StreetViewStatus\", \"TransitMode\", \"TransitRoutePreference\",\n // \"TravelMode\", \"UnitSystem\"\n const mapPlainObjects = pick(maps, isPlainObject);\n const options =\n typeof this.props.options === 'function'\n ? this.props.options(mapPlainObjects)\n : this.props.options;\n const defaultOptions = defaultOptions_(mapPlainObjects);\n\n const draggableOptions = !isEmpty(this.props.draggable) && {\n draggable: this.props.draggable,\n };\n\n const minZoom = this._computeMinZoom(options.minZoom);\n this.minZoom_ = minZoom;\n\n const preMapOptions = {\n ...defaultOptions,\n minZoom,\n ...options,\n ...propsOptions,\n };\n\n this.defaultDraggableOption_ = !isEmpty(preMapOptions.draggable)\n ? preMapOptions.draggable\n : this.defaultDraggableOption_;\n\n const mapOptions = {\n ...preMapOptions,\n ...draggableOptions,\n };\n\n mapOptions.minZoom = _checkMinZoom(mapOptions.minZoom, minZoom);\n\n const map = new maps.Map(\n ReactDOM.findDOMNode(this.googleMapDom_),\n mapOptions\n );\n\n this.map_ = map;\n this.maps_ = maps;\n\n this._setLayers(this.props.layerTypes);\n\n // Parse `google.maps.version` to capture the major version number.\n const versionMatch = maps.version.match(/^3\\.(\\d+)\\./);\n // The major version is the first (and only) captured group.\n const mapsVersion = versionMatch && Number(versionMatch[1]);\n\n // render in overlay\n const this_ = this;\n const overlay = Object.assign(new maps.OverlayView(), {\n onAdd() {\n const K_MAX_WIDTH =\n typeof screen !== 'undefined' ? `${screen.width}px` : '2000px';\n const K_MAX_HEIGHT =\n typeof screen !== 'undefined' ? `${screen.height}px` : '2000px';\n\n const div = document.createElement('div');\n div.style.backgroundColor = 'transparent';\n div.style.position = 'absolute';\n div.style.left = '0px';\n div.style.top = '0px';\n div.style.width = K_MAX_WIDTH; // prevents some chrome draw defects\n div.style.height = K_MAX_HEIGHT;\n\n if (this_.props.overlayViewDivStyle) {\n const { overlayViewDivStyle } = this_.props;\n if (typeof overlayViewDivStyle === 'object') {\n Object.keys(overlayViewDivStyle).forEach((property) => {\n div.style[property] = overlayViewDivStyle[property];\n });\n }\n }\n\n const panes = this.getPanes();\n panes.overlayMouseTarget.appendChild(div);\n this_.geoService_.setMapCanvasProjection(\n maps,\n overlay.getProjection()\n );\n\n if (!IS_REACT_16) {\n createPortal(\n this_,\n this_._renderPortal(),\n div,\n // remove prerendered markers\n () => this_.setState({ overlay: div })\n );\n } else {\n this_.setState({ overlay: div });\n }\n },\n\n onRemove() {\n const renderedOverlay = this_.state.overlay;\n if (renderedOverlay && !IS_REACT_16) {\n ReactDOM.unmountComponentAtNode(renderedOverlay);\n }\n this_.setState({ overlay: null });\n },\n\n draw() {\n this_.updateCounter_++;\n this_._onBoundsChanged(map, maps, !this_.props.debounced);\n\n if (!this_.googleApiLoadedCalled_) {\n this_._onGoogleApiLoaded({ map, maps, ref: this_.googleMapDom_ });\n this_.googleApiLoadedCalled_ = true;\n }\n\n if (this_.mouse_) {\n const latLng = this_.geoService_.fromContainerPixelToLatLng(\n this_.mouse_\n );\n this_.mouse_.lat = latLng.lat;\n this_.mouse_.lng = latLng.lng;\n }\n\n this_._onChildMouseMove();\n\n if (this_.markersDispatcher_) {\n this_.markersDispatcher_.emit('kON_CHANGE');\n if (this_.fireMouseEventOnIdle_) {\n this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE');\n }\n }\n },\n });\n\n this.overlay_ = overlay;\n\n overlay.setMap(map);\n if (this.props.heatmap.positions) {\n this.heatmap.setMap(map);\n }\n\n if (this.props.onTilesLoaded) {\n maps.event.addListener(map, 'tilesloaded', () => {\n this_._onTilesLoaded();\n });\n }\n\n maps.event.addListener(map, 'zoom_changed', () => {\n // recalc position at zoom start\n if (this_.geoService_.getZoom() !== map.getZoom()) {\n if (!this_.zoomAnimationInProgress_) {\n this_.zoomAnimationInProgress_ = true;\n this_._onZoomAnimationStart(map.zoom);\n }\n\n // If draw() is not called each frame during a zoom animation,\n // simulate it.\n if (mapsVersion < DRAW_CALLED_DURING_ANIMATION_VERSION) {\n const TIMEOUT_ZOOM = 300;\n\n if (\n new Date().getTime() - this.zoomControlClickTime_ <\n TIMEOUT_ZOOM\n ) {\n // there is strange Google Map Api behavior in chrome when zoom animation of map\n // is started only on second raf call, if was click on zoom control\n // or +- keys pressed, so i wait for two rafs before change state\n\n // this does not fully prevent animation jump\n // but reduce it's occurence probability\n raf(() =>\n raf(() => {\n this_.updateCounter_++;\n this_._onBoundsChanged(map, maps);\n })\n );\n } else {\n this_.updateCounter_++;\n this_._onBoundsChanged(map, maps);\n }\n }\n }\n });\n\n maps.event.addListener(map, 'idle', () => {\n if (this.resetSizeOnIdle_) {\n this._setViewSize();\n const currMinZoom = this._computeMinZoom(options.minZoom);\n\n if (currMinZoom !== this.minZoom_) {\n this.minZoom_ = currMinZoom;\n map.setOptions({ minZoom: currMinZoom });\n }\n\n this.resetSizeOnIdle_ = false;\n }\n\n if (this_.zoomAnimationInProgress_) {\n this_.zoomAnimationInProgress_ = false;\n this_._onZoomAnimationEnd(map.zoom);\n }\n\n this_.updateCounter_++;\n this_._onBoundsChanged(map, maps);\n\n this_.dragTime_ = 0;\n\n if (this_.markersDispatcher_) {\n this_.markersDispatcher_.emit('kON_CHANGE');\n }\n });\n\n maps.event.addListener(map, 'mouseover', () => {\n // has advantage over div MouseLeave\n this_.mouseInMap_ = true;\n });\n\n // an alternative way to know the mouse is back within the map\n // This would not fire when clicking/interacting with google maps\n // own on-map countrols+markers. This handles an edge case for touch devices\n // + 'draggable:false' custom option. See #332 for more details.\n maps.event.addListener(map, 'click', () => {\n this_.mouseInMap_ = true;\n });\n\n maps.event.addListener(map, 'mouseout', () => {\n // has advantage over div MouseLeave\n this_.mouseInMap_ = false;\n this_.mouse_ = null;\n this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE');\n });\n\n maps.event.addListener(map, 'drag', () => {\n this_.dragTime_ = new Date().getTime();\n this_._onDrag(map);\n });\n\n maps.event.addListener(map, 'dragend', () => {\n // 'dragend' fires on mouse release.\n // 'idle' listener waits until drag inertia ends before firing `onDragEnd`\n const idleListener = maps.event.addListener(map, 'idle', () => {\n maps.event.removeListener(idleListener);\n this_._onDragEnd(map);\n });\n });\n // user choosing satellite vs roads, etc\n maps.event.addListener(map, 'maptypeid_changed', () => {\n this_._onMapTypeIdChange(map.getMapTypeId());\n });\n })\n .catch((e) => {\n // notify callback of load failure\n this._onGoogleApiLoaded({\n map: null,\n maps: null,\n ref: this.googleMapDom_,\n });\n console.error(e); // eslint-disable-line no-console\n throw e;\n });\n };\n\n _onGoogleApiLoaded = (...args) => {\n if (this.props.onGoogleApiLoaded) {\n if (\n process.env.NODE_ENV !== 'production' &&\n this.props.yesIWantToUseGoogleMapApiInternals !== true\n ) {\n console.warn(\n 'GoogleMap: ' + // eslint-disable-line\n 'Usage of internal api objects is dangerous ' +\n 'and can cause a lot of issues.\\n' +\n 'To hide this warning add yesIWantToUseGoogleMapApiInternals={true} ' +\n 'to this.props.hoverDistance;\n\n _onDrag = (...args) => this.props.onDrag && this.props.onDrag(...args);\n\n _onDragEnd = (...args) =>\n this.props.onDragEnd && this.props.onDragEnd(...args);\n\n _onMapTypeIdChange = (...args) =>\n this.props.onMapTypeIdChange && this.props.onMapTypeIdChange(...args);\n\n _onZoomAnimationStart = (...args) =>\n this.props.onZoomAnimationStart && this.props.onZoomAnimationStart(...args);\n\n _onZoomAnimationEnd = (...args) =>\n this.props.onZoomAnimationEnd && this.props.onZoomAnimationEnd(...args);\n\n _onTilesLoaded = () => this.props.onTilesLoaded && this.props.onTilesLoaded();\n\n _onChildClick = (...args) => {\n if (this.props.onChildClick) {\n return this.props.onChildClick(...args);\n }\n return undefined;\n };\n\n _onChildMouseDown = (hoverKey, childProps) => {\n this.childMouseDownArgs_ = [hoverKey, childProps];\n if (this.props.onChildMouseDown) {\n this.props.onChildMouseDown(hoverKey, childProps, { ...this.mouse_ });\n }\n };\n\n // this method works only if this.props.onChildMouseDown was called\n _onChildMouseUp = () => {\n if (this.childMouseDownArgs_) {\n if (this.props.onChildMouseUp) {\n this.props.onChildMouseUp(...this.childMouseDownArgs_, {\n ...this.mouse_,\n });\n }\n this.childMouseDownArgs_ = null;\n this.childMouseUpTime_ = new Date().getTime();\n }\n };\n\n // this method works only if this.props.onChildMouseDown was called\n _onChildMouseMove = () => {\n if (this.childMouseDownArgs_) {\n if (this.props.onChildMouseMove) {\n this.props.onChildMouseMove(...this.childMouseDownArgs_, {\n ...this.mouse_,\n });\n }\n }\n };\n\n _onChildMouseEnter = (...args) => {\n if (this.props.onChildMouseEnter) {\n return this.props.onChildMouseEnter(...args);\n }\n return undefined;\n };\n\n _onChildMouseLeave = (...args) => {\n if (this.props.onChildMouseLeave) {\n return this.props.onChildMouseLeave(...args);\n }\n return undefined;\n };\n\n _setViewSize = () => {\n if (!this.mounted_) return;\n if (isFullScreen()) {\n this.geoService_.setViewSize(window.innerWidth, window.innerHeight);\n } else {\n const mapDom = ReactDOM.findDOMNode(this.googleMapDom_);\n this.geoService_.setViewSize(mapDom.clientWidth, mapDom.clientHeight);\n }\n this._onBoundsChanged();\n };\n\n _onWindowResize = () => {\n this.resetSizeOnIdle_ = true;\n };\n\n _onMapMouseMove = (e) => {\n if (!this.mouseInMap_) return;\n\n const currTime = new Date().getTime();\n const K_RECALC_CLIENT_RECT_MS = 50;\n\n if (currTime - this.mouseMoveTime_ > K_RECALC_CLIENT_RECT_MS) {\n this.boundingRect_ = e.currentTarget.getBoundingClientRect();\n }\n this.mouseMoveTime_ = currTime;\n\n const mousePosX = e.clientX - this.boundingRect_.left;\n const mousePosY = e.clientY - this.boundingRect_.top;\n\n if (!this.mouse_) {\n this.mouse_ = { x: 0, y: 0, lat: 0, lng: 0 };\n }\n\n this.mouse_.x = mousePosX;\n this.mouse_.y = mousePosY;\n\n const latLng = this.geoService_.fromContainerPixelToLatLng(this.mouse_);\n this.mouse_.lat = latLng.lat;\n this.mouse_.lng = latLng.lng;\n\n this._onChildMouseMove();\n\n if (currTime - this.dragTime_ < K_IDLE_TIMEOUT) {\n this.fireMouseEventOnIdle_ = true;\n } else {\n this.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE');\n this.fireMouseEventOnIdle_ = false;\n }\n };\n\n // K_IDLE_CLICK_TIMEOUT - looks like 300 is enough\n _onClick = (...args) =>\n this.props.onClick &&\n !this.childMouseDownArgs_ &&\n new Date().getTime() - this.childMouseUpTime_ > K_IDLE_CLICK_TIMEOUT &&\n this.dragTime_ === 0 &&\n this.props.onClick(...args);\n\n _onMapClick = (event) => {\n if (this.markersDispatcher_) {\n // support touch events and recalculate mouse position on click\n this._onMapMouseMove(event);\n const currTime = new Date().getTime();\n if (currTime - this.dragTime_ > K_IDLE_TIMEOUT) {\n if (this.mouse_) {\n this._onClick({\n ...this.mouse_,\n event,\n });\n }\n\n this.markersDispatcher_.emit('kON_CLICK', event);\n }\n }\n };\n\n // gmap can't prevent map drag if mousedown event already occured\n // the only workaround I find is prevent mousedown native browser event\n _onMapMouseDownNative = (event) => {\n if (!this.mouseInMap_) return;\n\n this._onMapMouseDown(event);\n };\n\n _onMapMouseDown = (event) => {\n if (this.markersDispatcher_) {\n const currTime = new Date().getTime();\n if (currTime - this.dragTime_ > K_IDLE_TIMEOUT) {\n // Hovered marker detected at mouse move could be deleted at mouse down time\n // so it will be good to force hovered marker recalculation\n this._onMapMouseMove(event);\n this.markersDispatcher_.emit('kON_MDOWN', event);\n }\n }\n };\n\n _onMapMouseDownCapture = () => {\n if (detectBrowser().isChrome) {\n // to fix strange zoom in chrome\n this.zoomControlClickTime_ = new Date().getTime();\n }\n };\n\n _onKeyDownCapture = () => {\n if (detectBrowser().isChrome) {\n this.zoomControlClickTime_ = new Date().getTime();\n }\n };\n\n _isCenterDefined = (center) =>\n center &&\n ((isPlainObject(center) && isNumber(center.lat) && isNumber(center.lng)) ||\n (center.length === 2 && isNumber(center[0]) && isNumber(center[1])));\n\n _onBoundsChanged = (map, maps, callExtBoundsChange) => {\n if (map) {\n const gmC = map.getCenter();\n this.geoService_.setView([gmC.lat(), gmC.lng()], map.getZoom(), 0);\n }\n\n if (\n (this.props.onChange || this.props.onBoundsChange) &&\n this.geoService_.canProject()\n ) {\n const zoom = this.geoService_.getZoom();\n const bounds = this.geoService_.getBounds();\n const centerLatLng = this.geoService_.getCenter();\n\n if (!isArraysEqualEps(bounds, this.prevBounds_, kEPS)) {\n if (callExtBoundsChange !== false) {\n const marginBounds = this.geoService_.getBounds(this.props.margin);\n if (this.props.onBoundsChange) {\n this.props.onBoundsChange(\n this.centerIsObject_\n ? { ...centerLatLng }\n : [centerLatLng.lat, centerLatLng.lng],\n zoom,\n bounds,\n marginBounds\n );\n }\n\n if (this.props.onChange) {\n this.props.onChange({\n center: { ...centerLatLng },\n zoom,\n bounds: {\n nw: {\n lat: bounds[0],\n lng: bounds[1],\n },\n se: {\n lat: bounds[2],\n lng: bounds[3],\n },\n sw: {\n lat: bounds[4],\n lng: bounds[5],\n },\n ne: {\n lat: bounds[6],\n lng: bounds[7],\n },\n },\n marginBounds: {\n nw: {\n lat: marginBounds[0],\n lng: marginBounds[1],\n },\n se: {\n lat: marginBounds[2],\n lng: marginBounds[3],\n },\n sw: {\n lat: marginBounds[4],\n lng: marginBounds[5],\n },\n ne: {\n lat: marginBounds[6],\n lng: marginBounds[7],\n },\n },\n\n size: this.geoService_.hasSize()\n ? {\n width: this.geoService_.getWidth(),\n height: this.geoService_.getHeight(),\n }\n : {\n width: 0,\n height: 0,\n },\n });\n }\n\n this.prevBounds_ = bounds;\n }\n }\n }\n };\n\n _registerChild = (ref) => {\n this.googleMapDom_ = ref;\n };\n\n render() {\n const overlay = this.state.overlay;\n const mapMarkerPrerender = !overlay ? (\n \n ) : null;\n\n return (\n \n \n {IS_REACT_16 && overlay && createPortal(this._renderPortal(), overlay)}\n\n {/* render markers before map load done */}\n {mapMarkerPrerender}\n
\n );\n }\n}\n\nexport default GoogleMap;\n","export const generateHeatmap = (instance, { positions }) =>\n new instance.visualization.HeatmapLayer({\n data: positions.reduce((acc, { lat, lng, weight = 1 }) => {\n acc.push({\n location: new instance.LatLng(lat, lng),\n weight,\n });\n return acc;\n }, []),\n });\n\nexport const optionsHeatmap = (instance, { options = {} }) =>\n Object.keys(options).map((option) => instance.set(option, options[option]));\n","export default function isArraysEqualEps(arrayA, arrayB, eps) {\n if (arrayA && arrayB) {\n for (let i = 0; i !== arrayA.length; ++i) {\n if (Math.abs(arrayA[i] - arrayB[i]) > eps) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n","import { generateUtilityClass, generateUtilityClasses } from '@mui/base';\nexport function getIconButtonUtilityClass(slot) {\n return generateUtilityClass('MuiIconButton', slot);\n}\nconst iconButtonClasses = generateUtilityClasses('MuiIconButton', ['root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge']);\nexport default iconButtonClasses;","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nconst _excluded = [\"edge\", \"children\", \"className\", \"color\", \"disabled\", \"disableFocusRipple\", \"size\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { chainPropTypes } from '@mui/utils';\nimport { unstable_composeClasses as composeClasses } from '@mui/base';\nimport { alpha } from '@mui/system';\nimport styled from '../styles/styled';\nimport useThemeProps from '../styles/useThemeProps';\nimport ButtonBase from '../ButtonBase';\nimport capitalize from '../utils/capitalize';\nimport iconButtonClasses, { getIconButtonUtilityClass } from './iconButtonClasses';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n\nconst useUtilityClasses = ownerState => {\n const {\n classes,\n disabled,\n color,\n edge,\n size\n } = ownerState;\n const slots = {\n root: ['root', disabled && 'disabled', color !== 'default' && `color${capitalize(color)}`, edge && `edge${capitalize(edge)}`, `size${capitalize(size)}`]\n };\n return composeClasses(slots, getIconButtonUtilityClass, classes);\n};\n\nconst IconButtonRoot = styled(ButtonBase, {\n name: 'MuiIconButton',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, ownerState.color !== 'default' && styles[`color${capitalize(ownerState.color)}`], ownerState.edge && styles[`edge${capitalize(ownerState.edge)}`], styles[`size${capitalize(ownerState.size)}`]];\n }\n})(({\n theme,\n ownerState\n}) => _extends({\n textAlign: 'center',\n flex: '0 0 auto',\n fontSize: theme.typography.pxToRem(24),\n padding: 8,\n borderRadius: '50%',\n overflow: 'visible',\n // Explicitly set the default value to solve a bug on IE11.\n color: (theme.vars || theme).palette.action.active,\n transition: theme.transitions.create('background-color', {\n duration: theme.transitions.duration.shortest\n })\n}, !ownerState.disableRipple && {\n '&:hover': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.active} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n }\n}, ownerState.edge === 'start' && {\n marginLeft: ownerState.size === 'small' ? -3 : -12\n}, ownerState.edge === 'end' && {\n marginRight: ownerState.size === 'small' ? -3 : -12\n}), ({\n theme,\n ownerState\n}) => _extends({}, ownerState.color === 'inherit' && {\n color: 'inherit'\n}, ownerState.color !== 'inherit' && ownerState.color !== 'default' && _extends({\n color: (theme.vars || theme).palette[ownerState.color].main\n}, !ownerState.disableRipple && {\n '&:hover': {\n backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),\n // Reset on touch devices, it doesn't add specificity\n '@media (hover: none)': {\n backgroundColor: 'transparent'\n }\n }\n}), ownerState.size === 'small' && {\n padding: 5,\n fontSize: theme.typography.pxToRem(18)\n}, ownerState.size === 'large' && {\n padding: 12,\n fontSize: theme.typography.pxToRem(28)\n}, {\n [`&.${iconButtonClasses.disabled}`]: {\n backgroundColor: 'transparent',\n color: (theme.vars || theme).palette.action.disabled\n }\n}));\n/**\n * Refer to the [Icons](/material-ui/icons/) section of the documentation\n * regarding the available icon options.\n */\n\nconst IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, ref) {\n const props = useThemeProps({\n props: inProps,\n name: 'MuiIconButton'\n });\n\n const {\n edge = false,\n children,\n className,\n color = 'default',\n disabled = false,\n disableFocusRipple = false,\n size = 'medium'\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n\n const ownerState = _extends({}, props, {\n edge,\n color,\n disabled,\n disableFocusRipple,\n size\n });\n\n const classes = useUtilityClasses(ownerState);\n return /*#__PURE__*/_jsx(IconButtonRoot, _extends({\n className: clsx(classes.root, className),\n centerRipple: true,\n focusRipple: !disableFocusRipple,\n disabled: disabled,\n ref: ref,\n ownerState: ownerState\n }, other, {\n children: children\n }));\n});\nprocess.env.NODE_ENV !== \"production\" ? IconButton.propTypes\n/* remove-proptypes */\n= {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The icon to display.\n */\n children: chainPropTypes(PropTypes.node, props => {\n const found = React.Children.toArray(props.children).some(child => /*#__PURE__*/React.isValidElement(child) && child.props.onClick);\n\n if (found) {\n return new Error(['MUI: You are providing an onClick event listener to a child of a button element.', 'Prefer applying it to the IconButton directly.', 'This guarantees that the whole