Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-maps-js-api-react

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-maps-js-api-react - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

dist/hooks/useMergedRef.d.ts

9

dist/components/OverlayView.d.ts
/// <reference types="google.maps" />
import { FC } from 'react';
export declare type OverlayViewProps = {
import React, { ComponentClass, ComponentProps, ComponentPropsWithRef, ForwardRefExoticComponent, PropsWithChildren, ReactPortal, VFC } from 'react';
export declare type OverlayViewProps<C extends VFC<any> | ComponentClass<any> | keyof JSX.IntrinsicElements = 'div'> = (C extends keyof JSX.IntrinsicElements ? ComponentPropsWithRef<C> : C extends ForwardRefExoticComponent<any> ? PropsWithChildren<ComponentProps<C>> : ComponentProps<C>) & {
/**
* for details see this [link](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes)
* @default 'overlayLayer'
* @default 'overlayMouseTarget'
*/

@@ -12,4 +12,5 @@ mapPaneLayer?: keyof google.maps.MapPanes;

onRemove?: () => void;
component?: C;
} & google.maps.LatLngLiteral;
declare const OverlayView: FC<OverlayViewProps>;
declare const OverlayView: <C extends keyof JSX.IntrinsicElements | React.ComponentClass<any, any> | React.VFC<any> = "div">(props: OverlayViewProps<C>) => ReactPortal;
export default OverlayView;

@@ -32,6 +32,6 @@ /// <reference types="google.maps" />

};
declare const createGoogleMapComponent: <H extends "onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged", S extends "center" | "heading" | "mapTypeId" | "tilt" | "zoom" | "clickableIcons" | "streetView">(handlerNamesList: H[], stateNamesList: S[]) => React.VFC<GoogleMapsBaseProps & {
declare const createGoogleMapComponent: <H extends "onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged", S extends "heading" | "center" | "mapTypeId" | "tilt" | "zoom" | "clickableIcons" | "streetView">(handlerNamesList: H[], stateNamesList: S[]) => React.VFC<GoogleMapsBaseProps & {
onMount?(instance: google.maps.Map): void;
onUnmount?(): void;
} & Partial<Pick<GoogleMapsHandlers, H>> & Pick<import("../types").GetState<google.maps.Map, "center" | "heading" | "mapTypeId" | "tilt" | "zoom" | "clickableIcons" | "streetView">, S>>;
} & Partial<Pick<GoogleMapsHandlers, H>> & Pick<import("../types").GetState<google.maps.Map, "heading" | "center" | "mapTypeId" | "tilt" | "zoom" | "clickableIcons" | "streetView">, S>>;
export default createGoogleMapComponent;

@@ -31,6 +31,6 @@ /// <reference types="google.maps" />

};
declare const createMarkerComponent: <H extends "onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", S extends "label" | "title" | "draggable" | "animation" | "clickable" | "cursor" | "icon" | "position" | "shape" | "visible" | "zIndex" | "opacity">(handlerNamesList: H[], stateNamesList: S[]) => import("react").VFC<MarkerBaseProps & {
declare const createMarkerComponent: <H extends "onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", S extends "label" | "title" | "cursor" | "opacity" | "draggable" | "shape" | "animation" | "clickable" | "icon" | "position" | "visible" | "zIndex">(handlerNamesList: H[], stateNamesList: S[]) => import("react").VFC<MarkerBaseProps & {
onMount?(instance: google.maps.Marker): void;
onUnmount?(): void;
} & Partial<Pick<MarkerHandlers, H>> & Pick<import("../types").GetState<google.maps.Marker, "label" | "title" | "draggable" | "animation" | "clickable" | "cursor" | "icon" | "position" | "shape" | "visible" | "zIndex" | "opacity">, S>>;
} & Partial<Pick<MarkerHandlers, H>> & Pick<import("../types").GetState<google.maps.Marker, "label" | "title" | "cursor" | "opacity" | "draggable" | "shape" | "animation" | "clickable" | "icon" | "position" | "visible" | "zIndex">, S>>;
export default createMarkerComponent;

@@ -1,2 +0,2 @@

var e=require("react"),n=require("fast-deep-equal"),t=require("google-maps-js-api-loader"),r=require("react-dom"),o=require("marker-cluster");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/a(e),u=/*#__PURE__*/a(n),c=/*#__PURE__*/a(t),s=/*#__PURE__*/a(o);function l(){return l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(this,arguments)}function d(e,n){return d=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},d(e,n)}function f(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(o[t]=e[t]);return o}var g,h=e.createContext(null),C=function(){return e.useContext(h)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(g||(g={}));var v=Object.freeze({onClick:g.CLICK,onDoubleClick:g.DOUBLE_CLICK,onDrag:g.DRAG,onDragEnd:g.DRAG_END,onDragStart:g.DRAG_START,onContextMenu:g.CONTEXT_MENU,onMouseMove:g.MOUSE_MOVE,onMouseOut:g.MOUSE_OUT,onMouseOver:g.MOUSE_OVER,onRightClick:g.RIGHT_CLICK,onBoundsChanged:g.BOUNDS_CHANGED,onCenterChanged:g.CENTER_CHANGED,onHeadingChanged:g.HEADING_CHANGED,onIdle:g.IDLE,onMapTypeIdChanged:g.MAP_TYPE_ID_CHANGED,onProjectionChanged:g.PROJECTION_CHANGED,onResize:g.RESIZE,onTilesLoaded:g.TILES_LOADED,onTiltChanged:g.TILT_CHANGED,onZoomChanged:g.ZOOM_CHANGED,onAnimationChanged:g.ANIMATION_CHANGED,onClickableChanged:g.CLICKABLE_CHANGED,onCursorChanged:g.CURSOR_CHANGED,onDraggableChanged:g.DRAGGABLE_CHANGED,onFlatChanged:g.FLAT_CHANGED,onIconChanged:g.ICON_CHANGED,onMouseDown:g.MOUSE_DOWN,onMouseUp:g.MOUSE_UP,onPositionChanged:g.POSITION_CHANGED,onShapeChanged:g.SHAPE_CHANGED,onTitleChanged:g.TITLE_CHANGED,onVisibleChanged:g.VISIBLE_CHANGED,onZIndexChanged:g.Z_INDEX_CHANGED}),E=function(){},p=function(n,t){return void 0===t&&(t={}),function(r,o){return n(function(n,t,r){if(0===t.length&&0===n.length)return E;n=Array.from(new Set(n)).reverse();var o=(t=Array.from(new Set(t)).reverse()).length,a=function(n,r){var a=e.useRef([]);e.useEffect(function(){var e=n.current;if(e){var i=a.current;if(i.length)for(var c=o;c--;){var s=t[c],l=r[s];u.default(l,i[c])||(e.set(s,l),i[c]=l)}else for(var d=o;d--;)i[d]=r[t[d]]}})};if(0===n.length)return a;var i=function(t,o){for(var a=function(a){var i=n[a],u=o[i];e.useEffect(function(){var e=t.current;if(e&&u){var n=r[i],o=e.addListener(v[i],n?function(){u.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){u.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return o.remove()}}},[u])},i=n.length;i--;)a(i)};if(0===o)return i;for(var c=[],s=n.length;s--;){var l=n[s],d=r[l];d&&t.includes(d)&&(c.push(l),n.splice(s,1))}var f=c.length;return 0===f?function(e,n){i(e,n),a(e,n)}:(0===n.length&&(i=E),function(n,a){var s=e.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});i(n,a);for(var l=s.current.isTriggeredBySetStateMap,d=function(t){var o=c[t],i=a[o];e.useEffect(function(){var e=n.current;if(e&&i){var t=r[o],a=e.addListener(v[o],function(){l.has(t)?l.delete(t):i.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[i])},g=f;g--;)d(g);e.useEffect(function(){var e=n.current;if(e){var r=s.current.prevStateArr;if(r.length)for(var i=o;i--;){var c=t[i],d=a[c];u.default(d,r[i])||(l.set(c,!0),e.set(c,d),r[i]=d)}else for(var f=o;f--;)r[f]=a[t[f]]}})})}(r,o,t))}},_=["children","className","style","defaultOptions","onMount","onUnmount"],D=p(function(n){return function(t){var r=t.children,o=t.className,a=t.style,u=t.defaultOptions,c=t.onMount,s=t.onUnmount,d=f(t,_),g=e.useRef(null),C=e.useRef(),v=e.useState(),p=v[0],D=v[1];return e.useEffect(function(){var e=g.current;if(e){var n=new google.maps.Map(e,l({},u,d));C.current=n,(c||E)(n),D(n)}return s},[]),n(C,d),i.default.createElement("div",{ref:g,className:o,style:a},r&&p&&i.default.createElement(h.Provider,{value:p},"function"==typeof r?r(p):r))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),A=["defaultOptions","onMount","onUnmount"],O=p(function(n){return function(t){var r=t.defaultOptions,o=t.onMount,a=t.onUnmount,i=f(t,A),u=C(),c=e.useRef();return e.useEffect(function(){var e=new google.maps.Marker(l({map:u},r,i));return c.current=e,(o||E)(e),function(){e.setMap(null),(a||E)()}},[]),n(c,i),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),N=function(n,r){void 0===r&&(r={});var o=e.useState(c.default.status),a=o[0],i=o[1];return e.useEffect(function(){a!==t.LoaderStatus.LOADED&&(n?c.default.load(n):c.default.completion).then(function(){i(t.LoaderStatus.LOADED),(r.onLoaded||E)()}).catch(function(e){i(t.LoaderStatus.ERROR),(r.onError||E)(e)})},[]),a},m=["children","options"],L=e.createContext(c.default.status),G=function(n){var t=e.useRef();return t.current||(t.current=n())},S={_:function(){/*#__PURE__*/return function(e){var n,t;function r(n,t,r,o){var a;return(a=e.call(this)||this)._div=void 0,a._mapPaneLayer=void 0,a._latLng=void 0,a._onAdd=void 0,a._onDraw=void 0,a._onRemove=void 0,a._div=n,a._mapPaneLayer=t,a._latLng=new google.maps.LatLng(r[0],r[1]),a.setCallbacks(o),a}t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,d(n,t);var o=r.prototype;return o.setCallbacks=function(e){this._onAdd=e[0]||E,this._onDraw=e[1]||E,this._onRemove=e[2]||E},o.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1])},o.onAdd=function(){this._div.style.position="absolute",this.getPanes()[this._mapPaneLayer].appendChild(this._div),this._onAdd()},o.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y;this._div.style.left=n+"px",this._div.style.top=t+"px",this._onDraw(n,t)}},o.onRemove=function(){var e;null==(e=this._div.parentNode)||e.removeChild(this._div),this._onRemove()},r}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},y=function(){if(c.default.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")};Object.defineProperty(exports,"Loader",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(exports,"LoaderStatus",{enumerable:!0,get:function(){return t.LoaderStatus}}),exports.GoogleMapLoader=function(e){var n=e.children,t=e.options,r=f(e,m),o=N(t,r);return n?i.default.createElement(L.Provider,{value:o},n):null},exports.OverlayView=function(n){var t=n.lat,o=n.lng,a=n.children,i=n.mapPaneLayer,u=n.onAdd,c=n.onDraw,s=n.onRemove,l=C(),d=G(function(){return document.createElement("div")}),f=e.useRef({}),g=[t,o],h=[u,c,s];return e.useEffect(function(){var e=new S.OverlayView(d,i||"overlayLayer",g,h);return f.current.overlay=e,e.setMap(l),function(){return e.setMap(null)}},[]),e.useEffect(function(){var e=f.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(h)},h),e.useEffect(function(){var e=f.current;if(e.isNotFirstRender){var n=e.overlay;n&&(n.setCoords(g),n.draw())}else e.isNotFirstRender=!0},g),r.createPortal(a,d)},exports.createGoogleMapComponent=D,exports.createMarkerComponent=O,exports.useAutocompleteService=function(){var n=e.useState(function(){return c.default.status===t.LoaderStatus.LOADED?y():void 0}),r=n[0],o=n[1];return e.useEffect(function(){if(c.default.status===t.LoaderStatus.NONE)throw new Error("start the loading of script first");c.default.status===t.LoaderStatus.LOADING&&c.default.completion.then(function(){return o(y())})},[]),r},exports.useGoogleMap=C,exports.useGoogleMapLoader=N,exports.useGoogleMapStatus=function(){return e.useContext(L)},exports.useMarkerCluster=function(n,t,r){var o=G(function(){return new s.default(t,r)}),a=e.useState([]),i=a[0][0],u=a[1],c=e.useRef();return e.useEffect(function(){return function(){return o.cleanUp()}},[]),e.useEffect(function(){var e=function(){var e=c.current;e&&u([function(){return o.getPoints.apply(o,e.concat([].slice.call(arguments)))}])};if(r.asyncMode)return o.loadAsync(n).then(e),function(){var e;n!==o.points&&(null==(e=o.worker)||e.terminate(),o.worker=void 0)};o.load(n),e()},[n]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),r=e.getNorthEast(),a=[n.getZoom(),t.lng(),t.lat(),r.lng(),r.lat()];c.current=a,o.points&&u([function(){return o.getPoints.apply(o,a.concat([].slice.call(arguments)))}])},getPoints:i,markerCluster:o}};
var e=require("react"),n=require("fast-deep-equal"),t=require("google-maps-js-api-loader"),r=require("react-dom"),o=require("marker-cluster");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/a(e),i=/*#__PURE__*/a(n),c=/*#__PURE__*/a(t),l=/*#__PURE__*/a(o);function s(){return s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},s.apply(this,arguments)}function f(e,n){return f=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},f(e,n)}function d(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(o[t]=e[t]);return o}var g,C=e.createContext(null),E=function(){return e.useContext(C)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(g||(g={}));var p=Object.freeze({onClick:g.CLICK,onDoubleClick:g.DOUBLE_CLICK,onDrag:g.DRAG,onDragEnd:g.DRAG_END,onDragStart:g.DRAG_START,onContextMenu:g.CONTEXT_MENU,onMouseMove:g.MOUSE_MOVE,onMouseOut:g.MOUSE_OUT,onMouseOver:g.MOUSE_OVER,onRightClick:g.RIGHT_CLICK,onBoundsChanged:g.BOUNDS_CHANGED,onCenterChanged:g.CENTER_CHANGED,onHeadingChanged:g.HEADING_CHANGED,onIdle:g.IDLE,onMapTypeIdChanged:g.MAP_TYPE_ID_CHANGED,onProjectionChanged:g.PROJECTION_CHANGED,onResize:g.RESIZE,onTilesLoaded:g.TILES_LOADED,onTiltChanged:g.TILT_CHANGED,onZoomChanged:g.ZOOM_CHANGED,onAnimationChanged:g.ANIMATION_CHANGED,onClickableChanged:g.CLICKABLE_CHANGED,onCursorChanged:g.CURSOR_CHANGED,onDraggableChanged:g.DRAGGABLE_CHANGED,onFlatChanged:g.FLAT_CHANGED,onIconChanged:g.ICON_CHANGED,onMouseDown:g.MOUSE_DOWN,onMouseUp:g.MOUSE_UP,onPositionChanged:g.POSITION_CHANGED,onShapeChanged:g.SHAPE_CHANGED,onTitleChanged:g.TITLE_CHANGED,onVisibleChanged:g.VISIBLE_CHANGED,onZIndexChanged:g.Z_INDEX_CHANGED}),h=function(){},v=function(n,t){return void 0===t&&(t={}),function(r,o){return n(function(n,t,r){if(0===t.length&&0===n.length)return h;n=Array.from(new Set(n)).reverse();var o=(t=Array.from(new Set(t)).reverse()).length,a=function(n,r){var a=e.useRef([]);e.useEffect(function(){var e=n.current;if(e){var u=a.current;if(u.length)for(var c=o;c--;){var l=t[c],s=r[l];i.default(s,u[c])||(e.set(l,s),u[c]=s)}else for(var f=o;f--;)u[f]=r[t[f]]}})};if(0===n.length)return a;var u=function(t,o){for(var a=function(a){var u=n[a],i=o[u];e.useEffect(function(){var e=t.current;if(e&&i){var n=r[u],o=e.addListener(p[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return o.remove()}}},[i])},u=n.length;u--;)a(u)};if(0===o)return u;for(var c=[],l=n.length;l--;){var s=n[l],f=r[s];f&&t.includes(f)&&(c.push(s),n.splice(l,1))}var d=c.length;return 0===d?function(e,n){u(e,n),a(e,n)}:(0===n.length&&(u=h),function(n,a){var l=e.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(n,a);for(var s=l.current.isTriggeredBySetStateMap,f=function(t){var o=c[t],u=a[o];e.useEffect(function(){var e=n.current;if(e&&u){var t=r[o],a=e.addListener(p[o],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=d;g--;)f(g);e.useEffect(function(){var e=n.current;if(e){var r=l.current.prevStateArr;if(r.length)for(var u=o;u--;){var c=t[u],f=a[c];i.default(f,r[u])||(s.set(c,!0),e.set(c,f),r[u]=f)}else for(var d=o;d--;)r[d]=a[t[d]]}})})}(r,o,t))}},_=["children","className","style","defaultOptions","onMount","onUnmount"],D=v(function(n){return function(t){var r=t.children,o=t.className,a=t.style,i=t.defaultOptions,c=t.onMount,l=t.onUnmount,f=d(t,_),g=e.useRef(null),E=e.useRef(),p=e.useState(),v=p[0],D=p[1];return e.useEffect(function(){var e=g.current;if(e){var n=new google.maps.Map(e,s({},i,f));E.current=n,(c||h)(n),D(n)}return l},[]),n(E,f),u.default.createElement("div",{ref:g,className:o,style:a},r&&v&&u.default.createElement(C.Provider,{value:v},"function"==typeof r?r(v):r))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),A=["defaultOptions","onMount","onUnmount"],O=v(function(n){return function(t){var r=t.defaultOptions,o=t.onMount,a=t.onUnmount,u=d(t,A),i=E(),c=e.useRef();return e.useEffect(function(){var e=new google.maps.Marker(s({map:i},r,u));return c.current=e,(o||h)(e),function(){e.setMap(null),(a||h)()}},[]),n(c,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),N=function(n,r){void 0===r&&(r={});var o=e.useState(c.default.status),a=o[0],u=o[1];return e.useEffect(function(){a!==t.LoaderStatus.LOADED&&(n?c.default.load(n):c.default.completion).then(function(){u(t.LoaderStatus.LOADED),(r.onLoaded||h)()}).catch(function(e){u(t.LoaderStatus.ERROR),(r.onError||h)(e)})},[]),a},m=["children","options"],L=e.createContext(c.default.status),G=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer"],S={_:function(){/*#__PURE__*/return function(e){var n,t;function r(n,t,r){var o;return(o=e.call(this)||this)._el=void 0,o._latLng=void 0,o._onDraw=void 0,o._el=n,o._latLng=new google.maps.LatLng(t[0],t[1]),o.setCallbacks(r),o}t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,f(n,t);var o=r.prototype;return o.setCallbacks=function(e){this.onAdd=e[0]||h,this._onDraw=e[1]||h,this.onRemove=e[2]||h},o.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1])},o.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,r=this._el.style;r.left=n+"px",r.top=t+"px",this._onDraw(n,t)}},r}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},I=e.forwardRef(function(n,t){var o=n.lat,a=n.lng,i=n.onAdd,c=n.onDraw,l=n.onRemove,f=n.component,g=void 0===f?"div":f,C=n.mapPaneLayer,p=void 0===C?"overlayMouseTarget":C,h=d(n,G),v=E(),_=e.useRef(null),D=function(){var n=[].slice.call(arguments);return e.useCallback(function(e){for(var t=n.length;t--;){var r=n[t];r&&("object"==typeof r?r.current=e:"function"==typeof r&&r(e))}},n)}(t,_),A=e.useRef({}),O=[o,a],N=[i,c,l];return e.useLayoutEffect(function(){var e=_.current;e.style.position="absolute";var n=new S.OverlayView(e,O,N);return A.current.overlay=n,n.setMap(v),function(){return n.setMap(null)}},[]),e.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(N)},N),e.useEffect(function(){var e=A.current;if(e.isNotFirstRender){var n=e.overlay;n&&(n.setCoords(O),n.draw())}else e.isNotFirstRender=!0},O),r.createPortal(u.default.createElement(g,s({ref:D},h)),v.__gm.panes[p])}),y=function(){if(c.default.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")};Object.defineProperty(exports,"Loader",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(exports,"LoaderStatus",{enumerable:!0,get:function(){return t.LoaderStatus}}),exports.GoogleMapLoader=function(e){var n=e.children,t=e.options,r=d(e,m),o=N(t,r);return n?u.default.createElement(L.Provider,{value:o},n):null},exports.OverlayView=I,exports.createGoogleMapComponent=D,exports.createMarkerComponent=O,exports.useAutocompleteService=function(){var n=e.useState(function(){return c.default.status===t.LoaderStatus.LOADED?y():void 0}),r=n[0],o=n[1];return e.useEffect(function(){if(c.default.status===t.LoaderStatus.NONE)throw new Error("start the loading of script first");c.default.status===t.LoaderStatus.LOADING&&c.default.completion.then(function(){return o(y())})},[]),r},exports.useGoogleMap=E,exports.useGoogleMapLoader=N,exports.useGoogleMapStatus=function(){return e.useContext(L)},exports.useMarkerCluster=function(n,t,r){var o,a,u=(o=function(){return new l.default(t,r)},(a=e.useRef()).current||(a.current=o())),i=e.useState([]),c=i[0][0],s=i[1],f=e.useRef();return e.useEffect(function(){return function(){return u.cleanUp()}},[]),e.useEffect(function(){var e=function(){var e=f.current;e&&s([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(r.asyncMode)return u.loadAsync(n).then(e),function(){var e;n!==u.points&&(null==(e=u.worker)||e.terminate(),u.worker=void 0)};u.load(n),e()},[n]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),r=e.getNorthEast(),o=[n.getZoom(),t.lng(),t.lat(),r.lng(),r.lat()];f.current=o,u.points&&s([function(){return u.getPoints.apply(u,o.concat([].slice.call(arguments)))}])},getPoints:c,markerCluster:u}};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import n,{createContext as e,useContext as t,useRef as o,useEffect as r,useState as a}from"react";import i from"fast-deep-equal";import u,{LoaderStatus as c}from"google-maps-js-api-loader";export{default as Loader,LoaderStatus}from"google-maps-js-api-loader";import{createPortal as l}from"react-dom";import s from"marker-cluster";function d(){return d=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},d.apply(this,arguments)}function g(n,e){return g=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},g(n,e)}function f(n,e){if(null==n)return{};var t,o,r={},a=Object.keys(n);for(o=0;o<a.length;o++)e.indexOf(t=a[o])>=0||(r[t]=n[t]);return r}var h,v=e(null),C=function(){return t(v)};!function(n){n.CLICK="click",n.CONTEXT_MENU="contextmenu",n.DOUBLE_CLICK="dblclick",n.DRAG="drag",n.DRAG_END="dragend",n.DRAG_START="dragstart",n.MOUSE_MOVE="mousemove",n.MOUSE_OUT="mouseout",n.MOUSE_OVER="mouseover",n.RIGHT_CLICK="rightclick",n.BOUNDS_CHANGED="bounds_changed",n.CENTER_CHANGED="center_changed",n.HEADING_CHANGED="heading_changed",n.IDLE="idle",n.MAP_TYPE_ID_CHANGED="maptypeid_changed",n.PROJECTION_CHANGED="projection_changed",n.RESIZE="resize",n.TILES_LOADED="tilesloaded",n.TILT_CHANGED="tilt_changed",n.ZOOM_CHANGED="zoom_changed",n.ANIMATION_CHANGED="animation_changed",n.CLICKABLE_CHANGED="clickable_changed",n.CURSOR_CHANGED="cursor_changed",n.DRAGGABLE_CHANGED="draggable_changed",n.FLAT_CHANGED="flat_changed",n.ICON_CHANGED="icon_changed",n.MOUSE_DOWN="mousedown",n.MOUSE_UP="mouseup",n.POSITION_CHANGED="position_changed",n.SHAPE_CHANGED="shape_changed",n.TITLE_CHANGED="title_changed",n.VISIBLE_CHANGED="visible_changed",n.Z_INDEX_CHANGED="zindex_changed"}(h||(h={}));var _=Object.freeze({onClick:h.CLICK,onDoubleClick:h.DOUBLE_CLICK,onDrag:h.DRAG,onDragEnd:h.DRAG_END,onDragStart:h.DRAG_START,onContextMenu:h.CONTEXT_MENU,onMouseMove:h.MOUSE_MOVE,onMouseOut:h.MOUSE_OUT,onMouseOver:h.MOUSE_OVER,onRightClick:h.RIGHT_CLICK,onBoundsChanged:h.BOUNDS_CHANGED,onCenterChanged:h.CENTER_CHANGED,onHeadingChanged:h.HEADING_CHANGED,onIdle:h.IDLE,onMapTypeIdChanged:h.MAP_TYPE_ID_CHANGED,onProjectionChanged:h.PROJECTION_CHANGED,onResize:h.RESIZE,onTilesLoaded:h.TILES_LOADED,onTiltChanged:h.TILT_CHANGED,onZoomChanged:h.ZOOM_CHANGED,onAnimationChanged:h.ANIMATION_CHANGED,onClickableChanged:h.CLICKABLE_CHANGED,onCursorChanged:h.CURSOR_CHANGED,onDraggableChanged:h.DRAGGABLE_CHANGED,onFlatChanged:h.FLAT_CHANGED,onIconChanged:h.ICON_CHANGED,onMouseDown:h.MOUSE_DOWN,onMouseUp:h.MOUSE_UP,onPositionChanged:h.POSITION_CHANGED,onShapeChanged:h.SHAPE_CHANGED,onTitleChanged:h.TITLE_CHANGED,onVisibleChanged:h.VISIBLE_CHANGED,onZIndexChanged:h.Z_INDEX_CHANGED}),E=function(){},p=function(n,e){return void 0===e&&(e={}),function(t,a){return n(function(n,e,t){if(0===e.length&&0===n.length)return E;n=Array.from(new Set(n)).reverse();var a=(e=Array.from(new Set(e)).reverse()).length,u=function(n,t){var u=o([]);r(function(){var o=n.current;if(o){var r=u.current;if(r.length)for(var c=a;c--;){var l=e[c],s=t[l];i(s,r[c])||(o.set(l,s),r[c]=s)}else for(var d=a;d--;)r[d]=t[e[d]]}})};if(0===n.length)return u;var c=function(e,o){for(var a=function(a){var i=n[a],u=o[i];r(function(){var n=e.current;if(n&&u){var o=t[i],r=n.addListener(_[i],o?function(){u.apply(void 0,[this.get(o)].concat([].slice.call(arguments),[this]))}:function(){u.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[u])},i=n.length;i--;)a(i)};if(0===a)return c;for(var l=[],s=n.length;s--;){var d=n[s],g=t[d];g&&e.includes(g)&&(l.push(d),n.splice(s,1))}var f=l.length;return 0===f?function(n,e){c(n,e),u(n,e)}:(0===n.length&&(c=E),function(n,u){var s=o({isTriggeredBySetStateMap:new Map,prevStateArr:[]});c(n,u);for(var d=s.current.isTriggeredBySetStateMap,g=function(e){var o=l[e],a=u[o];r(function(){var e=n.current;if(e&&a){var r=t[o],i=e.addListener(_[o],function(){d.has(r)?d.delete(r):a.apply(void 0,[this.get(r)].concat([].slice.call(arguments),[this]))});return function(){return i.remove()}}},[a])},h=f;h--;)g(h);r(function(){var t=n.current;if(t){var o=s.current.prevStateArr;if(o.length)for(var r=a;r--;){var c=e[r],l=u[c];i(l,o[r])||(d.set(c,!0),t.set(c,l),o[r]=l)}else for(var g=a;g--;)o[g]=u[e[g]]}})})}(t,a,e))}},D=["children","className","style","defaultOptions","onMount","onUnmount"],A=p(function(e){return function(t){var i=t.children,u=t.className,c=t.style,l=t.defaultOptions,s=t.onMount,g=t.onUnmount,h=f(t,D),C=o(null),_=o(),p=a(),A=p[0],N=p[1];return r(function(){var n=C.current;if(n){var e=new google.maps.Map(n,d({},l,h));_.current=e,(s||E)(e),N(e)}return g},[]),e(_,h),n.createElement("div",{ref:C,className:u,style:c},i&&A&&n.createElement(v.Provider,{value:A},"function"==typeof i?i(A):i))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),N=["defaultOptions","onMount","onUnmount"],m=p(function(n){return function(e){var t=e.defaultOptions,a=e.onMount,i=e.onUnmount,u=f(e,N),c=C(),l=o();return r(function(){var n=new google.maps.Marker(d({map:c},t,u));return l.current=n,(a||E)(n),function(){n.setMap(null),(i||E)()}},[]),n(l,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),O=function(n,e){void 0===e&&(e={});var t=a(u.status),o=t[0],i=t[1];return r(function(){o!==c.LOADED&&(n?u.load(n):u.completion).then(function(){i(c.LOADED),(e.onLoaded||E)()}).catch(function(n){i(c.ERROR),(e.onError||E)(n)})},[]),o},L=["children","options"],I=e(u.status),G=function(){return t(I)},y=function(e){var t=e.children,o=e.options,r=f(e,L),a=O(o,r);return t?n.createElement(I.Provider,{value:a},t):null},T=function(n){var e=o();return e.current||(e.current=n())},H={_:function(){/*#__PURE__*/return function(n){var e,t;function o(e,t,o,r){var a;return(a=n.call(this)||this)._div=void 0,a._mapPaneLayer=void 0,a._latLng=void 0,a._onAdd=void 0,a._onDraw=void 0,a._onRemove=void 0,a._div=e,a._mapPaneLayer=t,a._latLng=new google.maps.LatLng(o[0],o[1]),a.setCallbacks(r),a}t=n,(e=o).prototype=Object.create(t.prototype),e.prototype.constructor=e,g(e,t);var r=o.prototype;return r.setCallbacks=function(n){this._onAdd=n[0]||E,this._onDraw=n[1]||E,this._onRemove=n[2]||E},r.setCoords=function(n){this._latLng=new google.maps.LatLng(n[0],n[1])},r.onAdd=function(){this._div.style.position="absolute",this.getPanes()[this._mapPaneLayer].appendChild(this._div),this._onAdd()},r.draw=function(){var n=this.getProjection().fromLatLngToDivPixel(this._latLng);if(n){var e=n.x,t=n.y;this._div.style.left=e+"px",this._div.style.top=t+"px",this._onDraw(e,t)}},r.onRemove=function(){var n;null==(n=this._div.parentNode)||n.removeChild(this._div),this._onRemove()},o}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},M=function(n){var e=n.lat,t=n.lng,a=n.children,i=n.mapPaneLayer,u=n.onAdd,c=n.onDraw,s=n.onRemove,d=C(),g=T(function(){return document.createElement("div")}),f=o({}),h=[e,t],v=[u,c,s];return r(function(){var n=new H.OverlayView(g,i||"overlayLayer",h,v);return f.current.overlay=n,n.setMap(d),function(){return n.setMap(null)}},[]),r(function(){var n=f.current,e=n.overlay;n.isNotFirstRender&&e&&e.setCallbacks(v)},v),r(function(){var n=f.current;if(n.isNotFirstRender){var e=n.overlay;e&&(e.setCoords(h),e.draw())}else n.isNotFirstRender=!0},h),l(a,g)},S=function(n,e,t){var i=T(function(){return new s(e,t)}),u=a([]),c=u[0][0],l=u[1],d=o();return r(function(){return function(){return i.cleanUp()}},[]),r(function(){var e=function(){var n=d.current;n&&l([function(){return i.getPoints.apply(i,n.concat([].slice.call(arguments)))}])};if(t.asyncMode)return i.loadAsync(n).then(e),function(){var e;n!==i.points&&(null==(e=i.worker)||e.terminate(),i.worker=void 0)};i.load(n),e()},[n]),{handleBoundsChange:function(n,e){var t=n.getSouthWest(),o=n.getNorthEast(),r=[e.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];d.current=r,i.points&&l([function(){return i.getPoints.apply(i,r.concat([].slice.call(arguments)))}])},getPoints:c,markerCluster:i}},R=function(){if(u.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},P=function(){var n=a(function(){return u.status===c.LOADED?R():void 0}),e=n[0],t=n[1];return r(function(){if(u.status===c.NONE)throw new Error("start the loading of script first");u.status===c.LOADING&&u.completion.then(function(){return t(R())})},[]),e};export{y as GoogleMapLoader,M as OverlayView,A as createGoogleMapComponent,m as createMarkerComponent,P as useAutocompleteService,C as useGoogleMap,O as useGoogleMapLoader,G as useGoogleMapStatus,S as useMarkerCluster};
import n,{createContext as e,useContext as t,useRef as r,useEffect as o,useState as a,useCallback as i,forwardRef as c,useLayoutEffect as u}from"react";import l from"fast-deep-equal";import s,{LoaderStatus as d}from"google-maps-js-api-loader";export{default as Loader,LoaderStatus}from"google-maps-js-api-loader";import{createPortal as g}from"react-dom";import f from"marker-cluster";function C(){return C=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},C.apply(this,arguments)}function h(n,e){return h=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},h(n,e)}function E(n,e){if(null==n)return{};var t,r,o={},a=Object.keys(n);for(r=0;r<a.length;r++)e.indexOf(t=a[r])>=0||(o[t]=n[t]);return o}var v,_=e(null),p=function(){return t(_)};!function(n){n.CLICK="click",n.CONTEXT_MENU="contextmenu",n.DOUBLE_CLICK="dblclick",n.DRAG="drag",n.DRAG_END="dragend",n.DRAG_START="dragstart",n.MOUSE_MOVE="mousemove",n.MOUSE_OUT="mouseout",n.MOUSE_OVER="mouseover",n.RIGHT_CLICK="rightclick",n.BOUNDS_CHANGED="bounds_changed",n.CENTER_CHANGED="center_changed",n.HEADING_CHANGED="heading_changed",n.IDLE="idle",n.MAP_TYPE_ID_CHANGED="maptypeid_changed",n.PROJECTION_CHANGED="projection_changed",n.RESIZE="resize",n.TILES_LOADED="tilesloaded",n.TILT_CHANGED="tilt_changed",n.ZOOM_CHANGED="zoom_changed",n.ANIMATION_CHANGED="animation_changed",n.CLICKABLE_CHANGED="clickable_changed",n.CURSOR_CHANGED="cursor_changed",n.DRAGGABLE_CHANGED="draggable_changed",n.FLAT_CHANGED="flat_changed",n.ICON_CHANGED="icon_changed",n.MOUSE_DOWN="mousedown",n.MOUSE_UP="mouseup",n.POSITION_CHANGED="position_changed",n.SHAPE_CHANGED="shape_changed",n.TITLE_CHANGED="title_changed",n.VISIBLE_CHANGED="visible_changed",n.Z_INDEX_CHANGED="zindex_changed"}(v||(v={}));var D=Object.freeze({onClick:v.CLICK,onDoubleClick:v.DOUBLE_CLICK,onDrag:v.DRAG,onDragEnd:v.DRAG_END,onDragStart:v.DRAG_START,onContextMenu:v.CONTEXT_MENU,onMouseMove:v.MOUSE_MOVE,onMouseOut:v.MOUSE_OUT,onMouseOver:v.MOUSE_OVER,onRightClick:v.RIGHT_CLICK,onBoundsChanged:v.BOUNDS_CHANGED,onCenterChanged:v.CENTER_CHANGED,onHeadingChanged:v.HEADING_CHANGED,onIdle:v.IDLE,onMapTypeIdChanged:v.MAP_TYPE_ID_CHANGED,onProjectionChanged:v.PROJECTION_CHANGED,onResize:v.RESIZE,onTilesLoaded:v.TILES_LOADED,onTiltChanged:v.TILT_CHANGED,onZoomChanged:v.ZOOM_CHANGED,onAnimationChanged:v.ANIMATION_CHANGED,onClickableChanged:v.CLICKABLE_CHANGED,onCursorChanged:v.CURSOR_CHANGED,onDraggableChanged:v.DRAGGABLE_CHANGED,onFlatChanged:v.FLAT_CHANGED,onIconChanged:v.ICON_CHANGED,onMouseDown:v.MOUSE_DOWN,onMouseUp:v.MOUSE_UP,onPositionChanged:v.POSITION_CHANGED,onShapeChanged:v.SHAPE_CHANGED,onTitleChanged:v.TITLE_CHANGED,onVisibleChanged:v.VISIBLE_CHANGED,onZIndexChanged:v.Z_INDEX_CHANGED}),A=function(){},N=function(n,e){return void 0===e&&(e={}),function(t,a){return n(function(n,e,t){if(0===e.length&&0===n.length)return A;n=Array.from(new Set(n)).reverse();var a=(e=Array.from(new Set(e)).reverse()).length,i=function(n,t){var i=r([]);o(function(){var r=n.current;if(r){var o=i.current;if(o.length)for(var c=a;c--;){var u=e[c],s=t[u];l(s,o[c])||(r.set(u,s),o[c]=s)}else for(var d=a;d--;)o[d]=t[e[d]]}})};if(0===n.length)return i;var c=function(e,r){for(var a=function(a){var i=n[a],c=r[i];o(function(){var n=e.current;if(n&&c){var r=t[i],o=n.addListener(D[i],r?function(){c.apply(void 0,[this.get(r)].concat([].slice.call(arguments),[this]))}:function(){c.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return o.remove()}}},[c])},i=n.length;i--;)a(i)};if(0===a)return c;for(var u=[],s=n.length;s--;){var d=n[s],g=t[d];g&&e.includes(g)&&(u.push(d),n.splice(s,1))}var f=u.length;return 0===f?function(n,e){c(n,e),i(n,e)}:(0===n.length&&(c=A),function(n,i){var s=r({isTriggeredBySetStateMap:new Map,prevStateArr:[]});c(n,i);for(var d=s.current.isTriggeredBySetStateMap,g=function(e){var r=u[e],a=i[r];o(function(){var e=n.current;if(e&&a){var o=t[r],i=e.addListener(D[r],function(){d.has(o)?d.delete(o):a.apply(void 0,[this.get(o)].concat([].slice.call(arguments),[this]))});return function(){return i.remove()}}},[a])},C=f;C--;)g(C);o(function(){var t=n.current;if(t){var r=s.current.prevStateArr;if(r.length)for(var o=a;o--;){var c=e[o],u=i[c];l(u,r[o])||(d.set(c,!0),t.set(c,u),r[o]=u)}else for(var g=a;g--;)r[g]=i[e[g]]}})})}(t,a,e))}},O=["children","className","style","defaultOptions","onMount","onUnmount"],m=N(function(e){return function(t){var i=t.children,c=t.className,u=t.style,l=t.defaultOptions,s=t.onMount,d=t.onUnmount,g=E(t,O),f=r(null),h=r(),v=a(),p=v[0],D=v[1];return o(function(){var n=f.current;if(n){var e=new google.maps.Map(n,C({},l,g));h.current=e,(s||A)(e),D(e)}return d},[]),e(h,g),n.createElement("div",{ref:f,className:c,style:u},i&&p&&n.createElement(_.Provider,{value:p},"function"==typeof i?i(p):i))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),I=["defaultOptions","onMount","onUnmount"],G=N(function(n){return function(e){var t=e.defaultOptions,a=e.onMount,i=e.onUnmount,c=E(e,I),u=p(),l=r();return o(function(){var n=new google.maps.Marker(C({map:u},t,c));return l.current=n,(a||A)(n),function(){n.setMap(null),(i||A)()}},[]),n(l,c),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),L=function(n,e){void 0===e&&(e={});var t=a(s.status),r=t[0],i=t[1];return o(function(){r!==d.LOADED&&(n?s.load(n):s.completion).then(function(){i(d.LOADED),(e.onLoaded||A)()}).catch(function(n){i(d.ERROR),(e.onError||A)(n)})},[]),r},y=["children","options"],T=e(s.status),H=function(){return t(T)},M=function(e){var t=e.children,r=e.options,o=E(e,y),a=L(r,o);return t?n.createElement(T.Provider,{value:a},t):null},S=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer"],R={_:function(){/*#__PURE__*/return function(n){var e,t;function r(e,t,r){var o;return(o=n.call(this)||this)._el=void 0,o._latLng=void 0,o._onDraw=void 0,o._el=e,o._latLng=new google.maps.LatLng(t[0],t[1]),o.setCallbacks(r),o}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t);var o=r.prototype;return o.setCallbacks=function(n){this.onAdd=n[0]||A,this._onDraw=n[1]||A,this.onRemove=n[2]||A},o.setCoords=function(n){this._latLng=new google.maps.LatLng(n[0],n[1])},o.draw=function(){var n=this.getProjection().fromLatLngToDivPixel(this._latLng);if(n){var e=n.x,t=n.y,r=this._el.style;r.left=e+"px",r.top=t+"px",this._onDraw(e,t)}},r}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},w=c(function(e,t){var a=e.lat,c=e.lng,l=e.onAdd,s=e.onDraw,d=e.onRemove,f=e.component,h=void 0===f?"div":f,v=e.mapPaneLayer,_=void 0===v?"overlayMouseTarget":v,D=E(e,S),A=p(),N=r(null),O=function(){var n=[].slice.call(arguments);return i(function(e){for(var t=n.length;t--;){var r=n[t];r&&("object"==typeof r?r.current=e:"function"==typeof r&&r(e))}},n)}(t,N),m=r({}),I=[a,c],G=[l,s,d];return u(function(){var n=N.current;n.style.position="absolute";var e=new R.OverlayView(n,I,G);return m.current.overlay=e,e.setMap(A),function(){return e.setMap(null)}},[]),o(function(){var n=m.current,e=n.overlay;n.isNotFirstRender&&e&&e.setCallbacks(G)},G),o(function(){var n=m.current;if(n.isNotFirstRender){var e=n.overlay;e&&(e.setCoords(I),e.draw())}else n.isNotFirstRender=!0},I),g(n.createElement(h,C({ref:O},D)),A.__gm.panes[_])}),b=function(n,e,t){var i,c,u=(i=function(){return new f(e,t)},(c=r()).current||(c.current=i())),l=a([]),s=l[0][0],d=l[1],g=r();return o(function(){return function(){return u.cleanUp()}},[]),o(function(){var e=function(){var n=g.current;n&&d([function(){return u.getPoints.apply(u,n.concat([].slice.call(arguments)))}])};if(t.asyncMode)return u.loadAsync(n).then(e),function(){var e;n!==u.points&&(null==(e=u.worker)||e.terminate(),u.worker=void 0)};u.load(n),e()},[n]),{handleBoundsChange:function(n,e){var t=n.getSouthWest(),r=n.getNorthEast(),o=[e.getZoom(),t.lng(),t.lat(),r.lng(),r.lat()];g.current=o,u.points&&d([function(){return u.getPoints.apply(u,o.concat([].slice.call(arguments)))}])},getPoints:s,markerCluster:u}},P=function(){if(s.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")},U=function(){var n=a(function(){return s.status===d.LOADED?P():void 0}),e=n[0],t=n[1];return o(function(){if(s.status===d.NONE)throw new Error("start the loading of script first");s.status===d.LOADING&&s.completion.then(function(){return t(P())})},[]),e};export{M as GoogleMapLoader,w as OverlayView,m as createGoogleMapComponent,G as createMarkerComponent,U as useAutocompleteService,p as useGoogleMap,L as useGoogleMapLoader,H as useGoogleMapStatus,b as useMarkerCluster};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("fast-deep-equal"),require("google-maps-js-api-loader"),require("react-dom"),require("marker-cluster")):"function"==typeof define&&define.amd?define(["exports","react","fast-deep-equal","google-maps-js-api-loader","react-dom","marker-cluster"],n):n((e||self).googleMapsJsApiReact={},e.react,e.fastDeepEqual,e.googleMapsJsApiLoader,e.reactDom,e.markerCluster)}(this,function(e,n,t,o,r,a){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=/*#__PURE__*/i(n),c=/*#__PURE__*/i(t),s=/*#__PURE__*/i(o),l=/*#__PURE__*/i(a);function d(){return d=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},d.apply(this,arguments)}function f(e,n){return f=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},f(e,n)}function g(e,n){if(null==e)return{};var t,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(r[t]=e[t]);return r}var h,C=n.createContext(null),E=function(){return n.useContext(C)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(h||(h={}));var p=Object.freeze({onClick:h.CLICK,onDoubleClick:h.DOUBLE_CLICK,onDrag:h.DRAG,onDragEnd:h.DRAG_END,onDragStart:h.DRAG_START,onContextMenu:h.CONTEXT_MENU,onMouseMove:h.MOUSE_MOVE,onMouseOut:h.MOUSE_OUT,onMouseOver:h.MOUSE_OVER,onRightClick:h.RIGHT_CLICK,onBoundsChanged:h.BOUNDS_CHANGED,onCenterChanged:h.CENTER_CHANGED,onHeadingChanged:h.HEADING_CHANGED,onIdle:h.IDLE,onMapTypeIdChanged:h.MAP_TYPE_ID_CHANGED,onProjectionChanged:h.PROJECTION_CHANGED,onResize:h.RESIZE,onTilesLoaded:h.TILES_LOADED,onTiltChanged:h.TILT_CHANGED,onZoomChanged:h.ZOOM_CHANGED,onAnimationChanged:h.ANIMATION_CHANGED,onClickableChanged:h.CLICKABLE_CHANGED,onCursorChanged:h.CURSOR_CHANGED,onDraggableChanged:h.DRAGGABLE_CHANGED,onFlatChanged:h.FLAT_CHANGED,onIconChanged:h.ICON_CHANGED,onMouseDown:h.MOUSE_DOWN,onMouseUp:h.MOUSE_UP,onPositionChanged:h.POSITION_CHANGED,onShapeChanged:h.SHAPE_CHANGED,onTitleChanged:h.TITLE_CHANGED,onVisibleChanged:h.VISIBLE_CHANGED,onZIndexChanged:h.Z_INDEX_CHANGED}),v=function(){},_=function(e,t){return void 0===t&&(t={}),function(o,r){return e(function(e,t,o){if(0===t.length&&0===e.length)return v;e=Array.from(new Set(e)).reverse();var r=(t=Array.from(new Set(t)).reverse()).length,a=function(e,o){var a=n.useRef([]);n.useEffect(function(){var n=e.current;if(n){var i=a.current;if(i.length)for(var u=r;u--;){var s=t[u],l=o[s];c.default(l,i[u])||(n.set(s,l),i[u]=l)}else for(var d=r;d--;)i[d]=o[t[d]]}})};if(0===e.length)return a;var i=function(t,r){for(var a=function(a){var i=e[a],u=r[i];n.useEffect(function(){var e=t.current;if(e&&u){var n=o[i],r=e.addListener(p[i],n?function(){u.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){u.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return r.remove()}}},[u])},i=e.length;i--;)a(i)};if(0===r)return i;for(var u=[],s=e.length;s--;){var l=e[s],d=o[l];d&&t.includes(d)&&(u.push(l),e.splice(s,1))}var f=u.length;return 0===f?function(e,n){i(e,n),a(e,n)}:(0===e.length&&(i=v),function(e,a){var s=n.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});i(e,a);for(var l=s.current.isTriggeredBySetStateMap,d=function(t){var r=u[t],i=a[r];n.useEffect(function(){var n=e.current;if(n&&i){var t=o[r],a=n.addListener(p[r],function(){l.has(t)?l.delete(t):i.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[i])},g=f;g--;)d(g);n.useEffect(function(){var n=e.current;if(n){var o=s.current.prevStateArr;if(o.length)for(var i=r;i--;){var u=t[i],d=a[u];c.default(d,o[i])||(l.set(u,!0),n.set(u,d),o[i]=d)}else for(var f=r;f--;)o[f]=a[t[f]]}})})}(o,r,t))}},D=["children","className","style","defaultOptions","onMount","onUnmount"],A=_(function(e){return function(t){var o=t.children,r=t.className,a=t.style,i=t.defaultOptions,c=t.onMount,s=t.onUnmount,l=g(t,D),f=n.useRef(null),h=n.useRef(),E=n.useState(),p=E[0],_=E[1];return n.useEffect(function(){var e=f.current;if(e){var n=new google.maps.Map(e,d({},i,l));h.current=n,(c||v)(n),_(n)}return s},[]),e(h,l),u.default.createElement("div",{ref:f,className:r,style:a},o&&p&&u.default.createElement(C.Provider,{value:p},"function"==typeof o?o(p):o))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),O=["defaultOptions","onMount","onUnmount"],N=_(function(e){return function(t){var o=t.defaultOptions,r=t.onMount,a=t.onUnmount,i=g(t,O),u=E(),c=n.useRef();return n.useEffect(function(){var e=new google.maps.Marker(d({map:u},o,i));return c.current=e,(r||v)(e),function(){e.setMap(null),(a||v)()}},[]),e(c,i),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),m=function(e,t){void 0===t&&(t={});var r=n.useState(s.default.status),a=r[0],i=r[1];return n.useEffect(function(){a!==o.LoaderStatus.LOADED&&(e?s.default.load(e):s.default.completion).then(function(){i(o.LoaderStatus.LOADED),(t.onLoaded||v)()}).catch(function(e){i(o.LoaderStatus.ERROR),(t.onError||v)(e)})},[]),a},L=["children","options"],y=n.createContext(s.default.status),G=function(e){var t=n.useRef();return t.current||(t.current=e())},S={_:function(){/*#__PURE__*/return function(e){var n,t;function o(n,t,o,r){var a;return(a=e.call(this)||this)._div=void 0,a._mapPaneLayer=void 0,a._latLng=void 0,a._onAdd=void 0,a._onDraw=void 0,a._onRemove=void 0,a._div=n,a._mapPaneLayer=t,a._latLng=new google.maps.LatLng(o[0],o[1]),a.setCallbacks(r),a}t=e,(n=o).prototype=Object.create(t.prototype),n.prototype.constructor=n,f(n,t);var r=o.prototype;return r.setCallbacks=function(e){this._onAdd=e[0]||v,this._onDraw=e[1]||v,this._onRemove=e[2]||v},r.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1])},r.onAdd=function(){this._div.style.position="absolute",this.getPanes()[this._mapPaneLayer].appendChild(this._div),this._onAdd()},r.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y;this._div.style.left=n+"px",this._div.style.top=t+"px",this._onDraw(n,t)}},r.onRemove=function(){var e;null==(e=this._div.parentNode)||e.removeChild(this._div),this._onRemove()},o}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},I=function(){if(s.default.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")};Object.defineProperty(e,"Loader",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"LoaderStatus",{enumerable:!0,get:function(){return o.LoaderStatus}}),e.GoogleMapLoader=function(e){var n=e.children,t=e.options,o=g(e,L),r=m(t,o);return n?u.default.createElement(y.Provider,{value:r},n):null},e.OverlayView=function(e){var t=e.lat,o=e.lng,a=e.children,i=e.mapPaneLayer,u=e.onAdd,c=e.onDraw,s=e.onRemove,l=E(),d=G(function(){return document.createElement("div")}),f=n.useRef({}),g=[t,o],h=[u,c,s];return n.useEffect(function(){var e=new S.OverlayView(d,i||"overlayLayer",g,h);return f.current.overlay=e,e.setMap(l),function(){return e.setMap(null)}},[]),n.useEffect(function(){var e=f.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(h)},h),n.useEffect(function(){var e=f.current;if(e.isNotFirstRender){var n=e.overlay;n&&(n.setCoords(g),n.draw())}else e.isNotFirstRender=!0},g),r.createPortal(a,d)},e.createGoogleMapComponent=A,e.createMarkerComponent=N,e.useAutocompleteService=function(){var e=n.useState(function(){return s.default.status===o.LoaderStatus.LOADED?I():void 0}),t=e[0],r=e[1];return n.useEffect(function(){if(s.default.status===o.LoaderStatus.NONE)throw new Error("start the loading of script first");s.default.status===o.LoaderStatus.LOADING&&s.default.completion.then(function(){return r(I())})},[]),t},e.useGoogleMap=E,e.useGoogleMapLoader=m,e.useGoogleMapStatus=function(){return n.useContext(y)},e.useMarkerCluster=function(e,t,o){var r=G(function(){return new l.default(t,o)}),a=n.useState([]),i=a[0][0],u=a[1],c=n.useRef();return n.useEffect(function(){return function(){return r.cleanUp()}},[]),n.useEffect(function(){var n=function(){var e=c.current;e&&u([function(){return r.getPoints.apply(r,e.concat([].slice.call(arguments)))}])};if(o.asyncMode)return r.loadAsync(e).then(n),function(){var n;e!==r.points&&(null==(n=r.worker)||n.terminate(),r.worker=void 0)};r.load(e),n()},[e]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),o=e.getNorthEast(),a=[n.getZoom(),t.lng(),t.lat(),o.lng(),o.lat()];c.current=a,r.points&&u([function(){return r.getPoints.apply(r,a.concat([].slice.call(arguments)))}])},getPoints:i,markerCluster:r}}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("fast-deep-equal"),require("google-maps-js-api-loader"),require("react-dom"),require("marker-cluster")):"function"==typeof define&&define.amd?define(["exports","react","fast-deep-equal","google-maps-js-api-loader","react-dom","marker-cluster"],n):n((e||self).googleMapsJsApiReact={},e.react,e.fastDeepEqual,e.googleMapsJsApiLoader,e.reactDom,e.markerCluster)}(this,function(e,n,t,r,o,a){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/u(n),c=/*#__PURE__*/u(t),l=/*#__PURE__*/u(r),s=/*#__PURE__*/u(a);function f(){return f=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},f.apply(this,arguments)}function d(e,n){return d=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},d(e,n)}function g(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(o[t]=e[t]);return o}var C,E=n.createContext(null),p=function(){return n.useContext(E)};!function(e){e.CLICK="click",e.CONTEXT_MENU="contextmenu",e.DOUBLE_CLICK="dblclick",e.DRAG="drag",e.DRAG_END="dragend",e.DRAG_START="dragstart",e.MOUSE_MOVE="mousemove",e.MOUSE_OUT="mouseout",e.MOUSE_OVER="mouseover",e.RIGHT_CLICK="rightclick",e.BOUNDS_CHANGED="bounds_changed",e.CENTER_CHANGED="center_changed",e.HEADING_CHANGED="heading_changed",e.IDLE="idle",e.MAP_TYPE_ID_CHANGED="maptypeid_changed",e.PROJECTION_CHANGED="projection_changed",e.RESIZE="resize",e.TILES_LOADED="tilesloaded",e.TILT_CHANGED="tilt_changed",e.ZOOM_CHANGED="zoom_changed",e.ANIMATION_CHANGED="animation_changed",e.CLICKABLE_CHANGED="clickable_changed",e.CURSOR_CHANGED="cursor_changed",e.DRAGGABLE_CHANGED="draggable_changed",e.FLAT_CHANGED="flat_changed",e.ICON_CHANGED="icon_changed",e.MOUSE_DOWN="mousedown",e.MOUSE_UP="mouseup",e.POSITION_CHANGED="position_changed",e.SHAPE_CHANGED="shape_changed",e.TITLE_CHANGED="title_changed",e.VISIBLE_CHANGED="visible_changed",e.Z_INDEX_CHANGED="zindex_changed"}(C||(C={}));var h=Object.freeze({onClick:C.CLICK,onDoubleClick:C.DOUBLE_CLICK,onDrag:C.DRAG,onDragEnd:C.DRAG_END,onDragStart:C.DRAG_START,onContextMenu:C.CONTEXT_MENU,onMouseMove:C.MOUSE_MOVE,onMouseOut:C.MOUSE_OUT,onMouseOver:C.MOUSE_OVER,onRightClick:C.RIGHT_CLICK,onBoundsChanged:C.BOUNDS_CHANGED,onCenterChanged:C.CENTER_CHANGED,onHeadingChanged:C.HEADING_CHANGED,onIdle:C.IDLE,onMapTypeIdChanged:C.MAP_TYPE_ID_CHANGED,onProjectionChanged:C.PROJECTION_CHANGED,onResize:C.RESIZE,onTilesLoaded:C.TILES_LOADED,onTiltChanged:C.TILT_CHANGED,onZoomChanged:C.ZOOM_CHANGED,onAnimationChanged:C.ANIMATION_CHANGED,onClickableChanged:C.CLICKABLE_CHANGED,onCursorChanged:C.CURSOR_CHANGED,onDraggableChanged:C.DRAGGABLE_CHANGED,onFlatChanged:C.FLAT_CHANGED,onIconChanged:C.ICON_CHANGED,onMouseDown:C.MOUSE_DOWN,onMouseUp:C.MOUSE_UP,onPositionChanged:C.POSITION_CHANGED,onShapeChanged:C.SHAPE_CHANGED,onTitleChanged:C.TITLE_CHANGED,onVisibleChanged:C.VISIBLE_CHANGED,onZIndexChanged:C.Z_INDEX_CHANGED}),v=function(){},_=function(e,t){return void 0===t&&(t={}),function(r,o){return e(function(e,t,r){if(0===t.length&&0===e.length)return v;e=Array.from(new Set(e)).reverse();var o=(t=Array.from(new Set(t)).reverse()).length,a=function(e,r){var a=n.useRef([]);n.useEffect(function(){var n=e.current;if(n){var u=a.current;if(u.length)for(var i=o;i--;){var l=t[i],s=r[l];c.default(s,u[i])||(n.set(l,s),u[i]=s)}else for(var f=o;f--;)u[f]=r[t[f]]}})};if(0===e.length)return a;var u=function(t,o){for(var a=function(a){var u=e[a],i=o[u];n.useEffect(function(){var e=t.current;if(e&&i){var n=r[u],o=e.addListener(h[u],n?function(){i.apply(void 0,[this.get(n)].concat([].slice.call(arguments),[this]))}:function(){i.apply(void 0,[].slice.call(arguments).concat([this]))});return function(){return o.remove()}}},[i])},u=e.length;u--;)a(u)};if(0===o)return u;for(var i=[],l=e.length;l--;){var s=e[l],f=r[s];f&&t.includes(f)&&(i.push(s),e.splice(l,1))}var d=i.length;return 0===d?function(e,n){u(e,n),a(e,n)}:(0===e.length&&(u=v),function(e,a){var l=n.useRef({isTriggeredBySetStateMap:new Map,prevStateArr:[]});u(e,a);for(var s=l.current.isTriggeredBySetStateMap,f=function(t){var o=i[t],u=a[o];n.useEffect(function(){var n=e.current;if(n&&u){var t=r[o],a=n.addListener(h[o],function(){s.has(t)?s.delete(t):u.apply(void 0,[this.get(t)].concat([].slice.call(arguments),[this]))});return function(){return a.remove()}}},[u])},g=d;g--;)f(g);n.useEffect(function(){var n=e.current;if(n){var r=l.current.prevStateArr;if(r.length)for(var u=o;u--;){var i=t[u],f=a[i];c.default(f,r[u])||(s.set(i,!0),n.set(i,f),r[u]=f)}else for(var d=o;d--;)r[d]=a[t[d]]}})})}(r,o,t))}},D=["children","className","style","defaultOptions","onMount","onUnmount"],A=_(function(e){return function(t){var r=t.children,o=t.className,a=t.style,u=t.defaultOptions,c=t.onMount,l=t.onUnmount,s=g(t,D),d=n.useRef(null),C=n.useRef(),p=n.useState(),h=p[0],_=p[1];return n.useEffect(function(){var e=d.current;if(e){var n=new google.maps.Map(e,f({},u,s));C.current=n,(c||v)(n),_(n)}return l},[]),e(C,s),i.default.createElement("div",{ref:d,className:o,style:a},r&&h&&i.default.createElement(E.Provider,{value:h},"function"==typeof r?r(h):r))}},{onCenterChanged:"center",onHeadingChanged:"heading",onMapTypeIdChanged:"mapTypeId",onTiltChanged:"tilt",onZoomChanged:"zoom",onBoundsChanged:"bounds"}),O=["defaultOptions","onMount","onUnmount"],N=_(function(e){return function(t){var r=t.defaultOptions,o=t.onMount,a=t.onUnmount,u=g(t,O),i=p(),c=n.useRef();return n.useEffect(function(){var e=new google.maps.Marker(f({map:i},r,u));return c.current=e,(o||v)(e),function(){e.setMap(null),(a||v)()}},[]),e(c,u),null}},{onAnimationChanged:"animation",onCursorChanged:"cursor",onDraggableChanged:"draggable",onIconChanged:"icon",onPositionChanged:"position",onShapeChanged:"shape",onTitleChanged:"title",onVisibleChanged:"visible",onZIndexChanged:"zIndex"}),m=function(e,t){void 0===t&&(t={});var o=n.useState(l.default.status),a=o[0],u=o[1];return n.useEffect(function(){a!==r.LoaderStatus.LOADED&&(e?l.default.load(e):l.default.completion).then(function(){u(r.LoaderStatus.LOADED),(t.onLoaded||v)()}).catch(function(e){u(r.LoaderStatus.ERROR),(t.onError||v)(e)})},[]),a},L=["children","options"],G=n.createContext(l.default.status),y=["lat","lng","onAdd","onDraw","onRemove","component","mapPaneLayer"],S={_:function(){/*#__PURE__*/return function(e){var n,t;function r(n,t,r){var o;return(o=e.call(this)||this)._el=void 0,o._latLng=void 0,o._onDraw=void 0,o._el=n,o._latLng=new google.maps.LatLng(t[0],t[1]),o.setCallbacks(r),o}t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,d(n,t);var o=r.prototype;return o.setCallbacks=function(e){this.onAdd=e[0]||v,this._onDraw=e[1]||v,this.onRemove=e[2]||v},o.setCoords=function(e){this._latLng=new google.maps.LatLng(e[0],e[1])},o.draw=function(){var e=this.getProjection().fromLatLngToDivPixel(this._latLng);if(e){var n=e.x,t=e.y,r=this._el.style;r.left=n+"px",r.top=t+"px",this._onDraw(n,t)}},r}(google.maps.OverlayView)},get OverlayView(){return Object.defineProperty(this,"OverlayView",{value:this._()}),delete this._,this.OverlayView}},I=n.forwardRef(function(e,t){var r=e.lat,a=e.lng,u=e.onAdd,c=e.onDraw,l=e.onRemove,s=e.component,d=void 0===s?"div":s,C=e.mapPaneLayer,E=void 0===C?"overlayMouseTarget":C,h=g(e,y),v=p(),_=n.useRef(null),D=function(){var e=[].slice.call(arguments);return n.useCallback(function(n){for(var t=e.length;t--;){var r=e[t];r&&("object"==typeof r?r.current=n:"function"==typeof r&&r(n))}},e)}(t,_),A=n.useRef({}),O=[r,a],N=[u,c,l];return n.useLayoutEffect(function(){var e=_.current;e.style.position="absolute";var n=new S.OverlayView(e,O,N);return A.current.overlay=n,n.setMap(v),function(){return n.setMap(null)}},[]),n.useEffect(function(){var e=A.current,n=e.overlay;e.isNotFirstRender&&n&&n.setCallbacks(N)},N),n.useEffect(function(){var e=A.current;if(e.isNotFirstRender){var n=e.overlay;n&&(n.setCoords(O),n.draw())}else e.isNotFirstRender=!0},O),o.createPortal(i.default.createElement(d,f({ref:D},h)),v.__gm.panes[E])}),M=function(){if(l.default.libraries.includes("places"))return new google.maps.places.AutocompleteService;throw Error("Places library not loaded")};Object.defineProperty(e,"Loader",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"LoaderStatus",{enumerable:!0,get:function(){return r.LoaderStatus}}),e.GoogleMapLoader=function(e){var n=e.children,t=e.options,r=g(e,L),o=m(t,r);return n?i.default.createElement(G.Provider,{value:o},n):null},e.OverlayView=I,e.createGoogleMapComponent=A,e.createMarkerComponent=N,e.useAutocompleteService=function(){var e=n.useState(function(){return l.default.status===r.LoaderStatus.LOADED?M():void 0}),t=e[0],o=e[1];return n.useEffect(function(){if(l.default.status===r.LoaderStatus.NONE)throw new Error("start the loading of script first");l.default.status===r.LoaderStatus.LOADING&&l.default.completion.then(function(){return o(M())})},[]),t},e.useGoogleMap=p,e.useGoogleMapLoader=m,e.useGoogleMapStatus=function(){return n.useContext(G)},e.useMarkerCluster=function(e,t,r){var o,a,u=(o=function(){return new s.default(t,r)},(a=n.useRef()).current||(a.current=o())),i=n.useState([]),c=i[0][0],l=i[1],f=n.useRef();return n.useEffect(function(){return function(){return u.cleanUp()}},[]),n.useEffect(function(){var n=function(){var e=f.current;e&&l([function(){return u.getPoints.apply(u,e.concat([].slice.call(arguments)))}])};if(r.asyncMode)return u.loadAsync(e).then(n),function(){var n;e!==u.points&&(null==(n=u.worker)||n.terminate(),u.worker=void 0)};u.load(e),n()},[e]),{handleBoundsChange:function(e,n){var t=e.getSouthWest(),r=e.getNorthEast(),o=[n.getZoom(),t.lng(),t.lat(),r.lng(),r.lat()];f.current=o,u.points&&l([function(){return u.getPoints.apply(u,o.concat([].slice.call(arguments)))}])},getPoints:c,markerCluster:u}}});
//# sourceMappingURL=index.umd.js.map

@@ -5,3 +5,3 @@ /// <reference types="google.maps" />

export declare type UseStateAndHandlers<A extends HandlerName = HandlerName, S extends string = string> = (instanceRef: MutableRefObject<Pick<google.maps.Map, 'addListener' | 'set' | 'get'> | undefined>, props: Partial<Record<A, (...args: any) => void>> & Record<S, unknown>) => void;
declare const createUseStateAndHandlers: <A extends "onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", S extends string>(handlerNamesList: A[], stateNamesList: S[], connectedPairs: Partial<Record<A, S>>) => UseStateAndHandlers<A, S>;
declare const createUseStateAndHandlers: <A extends "onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", S extends string>(handlerNamesList: A[], stateNamesList: S[], connectedPairs: Partial<Record<A, S>>) => UseStateAndHandlers<A, S>;
export default createUseStateAndHandlers;
import { VFC } from 'react';
import { GetState, HandlerName, UnSet } from '../types';
import { UseStateAndHandlers } from './createUseStateAndHandlers';
declare const wrapper: <Instance extends {} | Record<`set${string}`, (value: any) => void>, Props extends Record<string, unknown>, Handlers extends Partial<Record<"onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", (...args: any[]) => void>>, StateKeys extends UnSet<keyof Instance>>(createRender: <H extends keyof Handlers & ("onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), S extends StateKeys>(useStateAndHandlers: UseStateAndHandlers) => VFC<Props & {
declare const wrapper: <Instance extends {} | Record<`set${string}`, (value: any) => void>, Props extends Record<string, unknown>, Handlers extends Partial<Record<"onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged", (...args: any[]) => void>>, StateKeys extends UnSet<keyof Instance>>(createRender: <H extends keyof Handlers & ("onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), S extends StateKeys>(useStateAndHandlers: UseStateAndHandlers) => VFC<Props & {
onMount?(instance: Instance): void;
onUnmount?(): void;
} & Partial<Pick<Handlers, H>> & Pick<GetState<Instance, StateKeys>, S>>, connectedHandlersAndState?: Partial<Record<keyof Handlers & ("onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), UnSet<keyof Instance>>>) => <H_1 extends keyof Handlers & ("onClick" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onContextMenu" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onMouseDown" | "onMouseUp" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), S_1 extends StateKeys>(handlerNamesList: H_1[], stateNamesList: S_1[]) => VFC<Props & {
} & Partial<Pick<Handlers, H>> & Pick<GetState<Instance, StateKeys>, S>>, connectedHandlersAndState?: Partial<Record<keyof Handlers & ("onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), UnSet<keyof Instance>>>) => <H_1 extends keyof Handlers & ("onClick" | "onContextMenu" | "onDoubleClick" | "onDrag" | "onDragEnd" | "onDragStart" | "onMouseDown" | "onMouseMove" | "onMouseOut" | "onMouseOver" | "onMouseUp" | "onRightClick" | "onBoundsChanged" | "onCenterChanged" | "onHeadingChanged" | "onIdle" | "onMapTypeIdChanged" | "onProjectionChanged" | "onResize" | "onTilesLoaded" | "onTiltChanged" | "onZoomChanged" | "onAnimationChanged" | "onClickableChanged" | "onCursorChanged" | "onDraggableChanged" | "onFlatChanged" | "onIconChanged" | "onPositionChanged" | "onShapeChanged" | "onTitleChanged" | "onVisibleChanged" | "onZIndexChanged"), S_1 extends StateKeys>(handlerNamesList: H_1[], stateNamesList: S_1[]) => VFC<Props & {
onMount?(instance: Instance): void;

@@ -9,0 +9,0 @@ onUnmount?(): void;

{
"name": "google-maps-js-api-react",
"version": "1.0.1",
"version": "1.1.0",
"description": "Library for convenient work of Google Maps JavaScript API with React",

@@ -16,3 +16,3 @@ "author": "Krombik",

"build": "microbundle --jsx React.createElement",
"start": "microbundle --jsx React.createElement watch --no-compress",
"start": "microbundle --jsx React.createElement watch",
"prepare": "run-s build",

@@ -19,0 +19,0 @@ "predeploy": "cd example && yarn install && yarn run build",

@@ -288,4 +288,7 @@ # google-maps-js-api-react

```ts
type C = FC | ComponentClass | keyof JSX.IntrinsicElements;
const OverlayView: FC<{
mapPaneLayer?: keyof google.maps.MapPanes = 'overlayLayer';
mapPaneLayer?: keyof google.maps.MapPanes = 'overlayMouseTarget';
component?: C;
onAdd?: () => void;

@@ -296,3 +299,4 @@ onDraw?: (x: number, y: number) => void;

lng: number;
}>;
}> &
ComponentPropsWithRef<C>;
```

@@ -302,2 +306,25 @@

| Name | Description | Default |
| :-------------- | :------------------------------------------------------------------------------------------------- | :------------------- |
| `mapPaneLayer?` | [see](https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes) | 'overlayMouseTarget' |
| `component?` | same to [material-ui component props](https://mui.com/guides/composition/#component-prop) | 'div' |
> Note: if you pass functional component to `component` prop, you should wrap it in forwardRef like in example below
```jsx
const SomeComponent = forwardRef(({ children }, ref) => (
<div ref={ref}>{children}</div>
));
const AnotherComponent = () => {
const ref = useRef(null); // you can pass your own ref to OverlayView if you need it
return (
<OverlayView component={SomeComponent} lat={0} lng={0} ref={ref}>
hi
</OverlayView>
);
};
```
---

@@ -304,0 +331,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc