{
  "version": 3,
  "sources": ["../src/index.ts", "../src/google-maps-overlay.ts", "../src/utils.ts"],
  "sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {default as GoogleMapsOverlay} from './google-maps-overlay';\nexport type {GoogleMapsOverlayProps} from './google-maps-overlay';\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global google */\nimport {GL, GLParameters} from '@luma.gl/constants';\nimport {WebGLDevice} from '@luma.gl/webgl';\nimport {\n  createDeckInstance,\n  destroyDeckInstance,\n  getViewPropsFromOverlay,\n  getViewPropsFromCoordinateTransformer\n} from './utils';\nimport {Deck} from '@deck.gl/core';\n\nimport type {DeckProps, MapViewState} from '@deck.gl/core';\nimport type {Device} from '@luma.gl/core';\n\nconst HIDE_ALL_LAYERS = () => false;\nconst GL_STATE: GLParameters = {\n  depthMask: true,\n  depthTest: true,\n  blend: true,\n  blendFunc: [GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ONE, GL.ONE_MINUS_SRC_ALPHA],\n  blendEquation: GL.FUNC_ADD\n};\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction noop() {}\n\nconst defaultProps = {\n  interleaved: true\n};\n\nexport type GoogleMapsOverlayProps = Omit<\n  DeckProps,\n  | 'width'\n  | 'height'\n  | 'gl'\n  | 'deviceProps'\n  | 'parent'\n  | 'canvas'\n  | '_customRender'\n  | 'viewState'\n  | 'initialViewState'\n  | 'controller'\n> & {\n  interleaved?: boolean;\n};\n\nexport default class GoogleMapsOverlay {\n  private props: GoogleMapsOverlayProps = {};\n  private _map: google.maps.Map | null = null;\n  private _deck: Deck | null = null;\n  private _overlay: google.maps.WebGLOverlayView | google.maps.OverlayView | null = null;\n\n  constructor(props: GoogleMapsOverlayProps) {\n    this.setProps({...defaultProps, ...props});\n  }\n\n  /* Public API */\n\n  /** Add/remove the overlay from a map. */\n  setMap(map: google.maps.Map | null): void {\n    if (map === this._map) {\n      return;\n    }\n\n    const {VECTOR, UNINITIALIZED} = google.maps.RenderingType;\n    if (this._map) {\n      if (!map && this._map.getRenderingType() === VECTOR && this.props.interleaved) {\n        (this._overlay as google.maps.WebGLOverlayView).requestRedraw();\n      }\n      this._overlay?.setMap(null);\n      this._map = null;\n    }\n    if (map) {\n      this._map = map;\n      const renderingType = map.getRenderingType();\n      if (renderingType !== UNINITIALIZED) {\n        this._createOverlay(map);\n      } else {\n        map.addListener('renderingtype_changed', () => {\n          this._createOverlay(map);\n        });\n      }\n    }\n  }\n\n  /**\n   * Update (partial) props.\n   */\n  setProps(props: Partial<GoogleMapsOverlayProps>): void {\n    Object.assign(this.props, props);\n    if (this._deck) {\n      const canvas = this._deck.getCanvas();\n      if (props.style && canvas?.parentElement) {\n        const parentStyle = canvas.parentElement.style;\n        Object.assign(parentStyle, props.style);\n        props.style = null;\n      }\n      this._deck.setProps(props);\n    }\n  }\n\n  /** Equivalent of `deck.pickObject`. */\n  pickObject(params) {\n    return this._deck && this._deck.pickObject(params);\n  }\n\n  /** Equivalent of `deck.pickObjects`.  */\n  pickMultipleObjects(params) {\n    return this._deck && this._deck.pickMultipleObjects(params);\n  }\n\n  /** Equivalent of `deck.pickMultipleObjects`. */\n  pickObjects(params) {\n    return this._deck && this._deck.pickObjects(params);\n  }\n\n  /** Remove the overlay and release all underlying resources. */\n  finalize() {\n    this.setMap(null);\n    if (this._deck) {\n      destroyDeckInstance(this._deck);\n      this._deck = null;\n    }\n  }\n\n  /* Private API */\n  _createOverlay(map: google.maps.Map) {\n    const {interleaved} = this.props;\n    const {VECTOR, UNINITIALIZED} = google.maps.RenderingType;\n    const renderingType = map.getRenderingType();\n    if (renderingType === UNINITIALIZED) {\n      return;\n    }\n\n    const isVectorMap = renderingType === VECTOR && google.maps.WebGLOverlayView;\n    const OverlayView = isVectorMap ? google.maps.WebGLOverlayView : google.maps.OverlayView;\n    const overlay = new OverlayView();\n\n    if (overlay instanceof google.maps.WebGLOverlayView) {\n      if (interleaved) {\n        overlay.onAdd = noop;\n        overlay.onContextRestored = this._onContextRestored.bind(this);\n        overlay.onDraw = this._onDrawVectorInterleaved.bind(this);\n      } else {\n        overlay.onAdd = this._onAdd.bind(this);\n        overlay.onContextRestored = noop;\n        overlay.onDraw = this._onDrawVectorOverlay.bind(this);\n      }\n      overlay.onContextLost = this._onContextLost.bind(this);\n    } else {\n      overlay.onAdd = this._onAdd.bind(this);\n      overlay.draw = this._onDrawRaster.bind(this);\n    }\n    overlay.onRemove = this._onRemove.bind(this);\n\n    this._overlay = overlay;\n    this._overlay.setMap(map);\n  }\n\n  _onAdd() {\n    // @ts-ignore (TS2345) map is defined at this stage\n    this._deck = createDeckInstance(this._map, this._overlay, this._deck, this.props);\n  }\n\n  _onContextRestored({gl}) {\n    if (!this._map || !this._overlay) {\n      return;\n    }\n    const _customRender = () => {\n      if (this._overlay) {\n        (this._overlay as google.maps.WebGLOverlayView).requestRedraw();\n      }\n    };\n    const deck = createDeckInstance(this._map, this._overlay, this._deck, {\n      gl,\n      _customRender,\n      ...this.props\n    });\n    this._deck = deck;\n\n    // By default, animationLoop._renderFrame invokes\n    // animationLoop.onRender. We override this to wrap\n    // in withParameters so we don't modify the GL state\n    // @ts-ignore accessing protected member\n    const animationLoop = deck.animationLoop!;\n    animationLoop._renderFrame = () => {\n      const ab = gl.getParameter(gl.ARRAY_BUFFER_BINDING);\n      // @ts-expect-error accessing protected member\n      const device: Device = deck.device;\n      device.withParametersWebGL({}, () => {\n        animationLoop.props.onRender(animationLoop.animationProps!);\n      });\n      gl.bindBuffer(gl.ARRAY_BUFFER, ab);\n    };\n  }\n\n  _onContextLost() {\n    // TODO this isn't working\n    if (this._deck) {\n      destroyDeckInstance(this._deck);\n      this._deck = null;\n    }\n  }\n\n  _onRemove() {\n    this._deck?.setProps({layerFilter: HIDE_ALL_LAYERS});\n  }\n\n  _onDrawRaster() {\n    if (!this._deck || !this._map) {\n      return;\n    }\n    const deck = this._deck;\n\n    const {width, height, left, top, ...rest} = getViewPropsFromOverlay(\n      this._map,\n      this._overlay as google.maps.OverlayView\n    );\n\n    const canvas = deck.getCanvas();\n    const parent = canvas?.parentElement || deck.props.parent;\n    if (parent) {\n      const parentStyle = parent.style;\n      parentStyle.left = `${left}px`;\n      parentStyle.top = `${top}px`;\n    }\n\n    const altitude = 10000;\n    deck.setProps({\n      width,\n      height,\n      // @ts-expect-error altitude is accepted by WebMercatorViewport but not exposed by type\n      viewState: {altitude, ...rest} as MapViewState\n    });\n    // Deck is initialized\n    deck.redraw();\n  }\n\n  // Vector code path\n  _onDrawVectorInterleaved({gl, transformer}) {\n    if (!this._deck || !this._map) {\n      return;\n    }\n\n    const deck = this._deck;\n\n    deck.setProps({\n      ...getViewPropsFromCoordinateTransformer(this._map, transformer),\n\n      // Using external gl context - do not set css size\n      width: null,\n      height: null\n    });\n\n    if (deck.isInitialized) {\n      // @ts-expect-error\n      const device: Device = deck.device;\n\n      // As an optimization, some renders are to an separate framebuffer\n      // which we need to pass onto deck\n      if (device instanceof WebGLDevice) {\n        const _framebuffer = device.getParametersWebGL(GL.FRAMEBUFFER_BINDING);\n        deck.setProps({_framebuffer});\n      }\n\n      // With external gl context, animation loop doesn't resize webgl-canvas and thus fails to\n      // calculate corrext pixel ratio. Force this manually.\n      device.getDefaultCanvasContext().resize();\n\n      // Camera changed, will trigger a map repaint right after this\n      // Clear any change flag triggered by setting viewState so that deck does not request\n      // a second repaint\n      deck.needsRedraw({clearRedrawFlags: true});\n\n      // Workaround for bug in Google maps where viewport state is wrong\n      // TODO remove once fixed\n      if (device instanceof WebGLDevice) {\n        device.setParametersWebGL({\n          viewport: [0, 0, gl.canvas.width, gl.canvas.height],\n          scissor: [0, 0, gl.canvas.width, gl.canvas.height],\n          stencilFunc: [gl.ALWAYS, 0, 255, gl.ALWAYS, 0, 255]\n        });\n\n        device.withParametersWebGL(GL_STATE, () => {\n          deck._drawLayers('google-vector', {\n            clearCanvas: false\n          });\n        });\n      }\n    }\n  }\n\n  _onDrawVectorOverlay({transformer}) {\n    if (!this._deck || !this._map) {\n      return;\n    }\n\n    const deck = this._deck;\n\n    deck.setProps({\n      ...getViewPropsFromCoordinateTransformer(this._map, transformer)\n    });\n    deck.redraw();\n  }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* global google, document */\nimport {Deck, MapView} from '@deck.gl/core';\nimport {Matrix4, Vector2} from '@math.gl/core';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\n\n// https://en.wikipedia.org/wiki/Web_Mercator_projection#Formulas\nconst MAX_LATITUDE = 85.05113;\n\ntype UserData = {\n  _googleMap: google.maps.Map;\n  _eventListeners: Record<string, google.maps.MapsEventListener | null>;\n};\n\n/**\n * Get a new deck instance\n * @param map (google.maps.Map) - The parent Map instance\n * @param overlay (google.maps.OverlayView) - A maps Overlay instance\n * @param [deck] (Deck) - a previously created instances\n */\nexport function createDeckInstance(\n  map: google.maps.Map,\n  overlay: google.maps.OverlayView | google.maps.WebGLOverlayView,\n  deck: Deck | null | undefined,\n  props\n): Deck {\n  if (deck) {\n    if (deck.userData._googleMap === map) {\n      return deck;\n    }\n    // deck instance was created for a different map\n    destroyDeckInstance(deck);\n  }\n\n  const eventListeners = {\n    click: null,\n    rightclick: null,\n    dblclick: null,\n    mousemove: null,\n    mouseout: null\n  };\n\n  const newDeck = new Deck({\n    ...props,\n    useDevicePixels: props.interleaved ? true : props.useDevicePixels,\n    style: props.interleaved ? null : {pointerEvents: 'none'},\n    parent: getContainer(overlay, props.style),\n    views: new MapView({repeat: true}),\n    initialViewState: {\n      longitude: 0,\n      latitude: 0,\n      zoom: 1\n    },\n    controller: false\n  });\n\n  // Register event listeners\n  for (const eventType in eventListeners) {\n    eventListeners[eventType] = map.addListener(eventType, evt =>\n      handleMouseEvent(newDeck, eventType, evt)\n    );\n  }\n\n  // Attach userData directly to Deck instance\n  (newDeck.userData as UserData)._googleMap = map;\n  (newDeck.userData as UserData)._eventListeners = eventListeners;\n\n  return newDeck;\n}\n\n// Create a container that will host the deck canvas and tooltip\nfunction getContainer(\n  overlay: google.maps.OverlayView | google.maps.WebGLOverlayView,\n  style?: Partial<CSSStyleDeclaration>\n): HTMLElement {\n  const container = document.createElement('div');\n  container.style.position = 'absolute';\n  Object.assign(container.style, style);\n\n  // The DOM structure has a different structure depending on whether\n  // the Google map is rendered as vector or raster\n  if ('getPanes' in overlay) {\n    overlay.getPanes()?.overlayLayer.appendChild(container);\n  } else {\n    overlay.getMap()?.getDiv().appendChild(container);\n  }\n  return container;\n}\n\n/**\n * Safely remove a deck instance\n * @param deck (Deck) - a previously created instances\n */\nexport function destroyDeckInstance(deck: Deck) {\n  const {_eventListeners: eventListeners} = deck.userData;\n\n  // Unregister event listeners\n  for (const eventType in eventListeners) {\n    // Check that event listener was set before trying to remove.\n    if (eventListeners[eventType]) {\n      eventListeners[eventType].remove();\n    }\n  }\n\n  deck.finalize();\n}\n\n/* eslint-disable max-statements */\n/**\n * Get the current view state\n * @param map (google.maps.Map) - The parent Map instance\n * @param overlay (google.maps.OverlayView) - A maps Overlay instance\n */\n// eslint-disable-next-line complexity\nexport function getViewPropsFromOverlay(map: google.maps.Map, overlay: google.maps.OverlayView) {\n  const {width, height} = getMapSize(map);\n\n  // Canvas position relative to draggable map's container depends on\n  // overlayView's projection, not the map's. Have to use the center of the\n  // map for this, not the top left, for the same reason as above.\n  const projection = overlay.getProjection();\n\n  const bounds = map.getBounds();\n  if (!bounds) {\n    return {width, height, left: 0, top: 0};\n  }\n\n  const ne = bounds.getNorthEast();\n  const sw = bounds.getSouthWest();\n  const topRight = projection.fromLatLngToDivPixel(ne);\n  const bottomLeft = projection.fromLatLngToDivPixel(sw);\n\n  // google maps places overlays in a container anchored at the map center.\n  // the container CSS is manipulated during dragging.\n  // We need to update left/top of the deck canvas to match the base map.\n  const centerLngLat = pixelToLngLat(projection, width / 2, height / 2);\n  const centerH = new google.maps.LatLng(0, centerLngLat[0]);\n  const centerContainerPx = projection.fromLatLngToContainerPixel(centerH);\n  const centerDivPx = projection.fromLatLngToDivPixel(centerH);\n\n  if (!topRight || !bottomLeft || !centerDivPx || !centerContainerPx) {\n    return {width, height, left: 0, top: 0};\n  }\n  const leftOffset = Math.round(centerDivPx.x - centerContainerPx.x);\n  let topOffset = centerDivPx.y - centerContainerPx.y;\n\n  const topLngLat = pixelToLngLat(projection, width / 2, 0);\n  const bottomLngLat = pixelToLngLat(projection, width / 2, height);\n\n  // Compute fractional center.\n  let latitude = centerLngLat[1];\n  const longitude = centerLngLat[0];\n\n  // Adjust vertical offset - limit latitude\n  if (Math.abs(latitude) > MAX_LATITUDE) {\n    latitude = latitude > 0 ? MAX_LATITUDE : -MAX_LATITUDE;\n    const center = new google.maps.LatLng(latitude, longitude);\n    const centerPx = projection.fromLatLngToContainerPixel(center);\n    // @ts-ignore (TS2531) Object is possibly 'null'\n    topOffset += centerPx.y - height / 2;\n  }\n  topOffset = Math.round(topOffset);\n\n  // Compute fractional bearing\n  const delta = new Vector2(topLngLat).sub(bottomLngLat);\n  let bearing = (180 * delta.verticalAngle()) / Math.PI;\n  if (bearing < 0) bearing += 360;\n\n  // Maps sometimes returns undefined instead of 0\n  const heading = map.getHeading() || 0;\n\n  let zoom = (map.getZoom() as number) - 1;\n\n  let scale;\n\n  if (bearing === 0) {\n    // At full world view (always unrotated) simply compare height, as diagonal\n    // is incorrect due to multiple world copies\n    scale = height ? (bottomLeft.y - topRight.y) / height : 1;\n  } else if (bearing === heading) {\n    // Fractional zoom calculation only correct when bearing is not animating\n    const viewDiagonal = new Vector2([topRight.x, topRight.y])\n      .sub([bottomLeft.x, bottomLeft.y])\n      .len();\n    const mapDiagonal = new Vector2([width, -height]).len();\n    scale = mapDiagonal ? viewDiagonal / mapDiagonal : 1;\n  }\n\n  // When resizing aggressively, occasionally ne and sw are the same points\n  // See https://github.com/visgl/deck.gl/issues/4218\n  zoom += Math.log2(scale || 1);\n\n  return {\n    width,\n    height,\n    left: leftOffset,\n    top: topOffset,\n    zoom,\n    bearing,\n    pitch: map.getTilt(),\n    latitude,\n    longitude\n  };\n}\n\n/* eslint-enable max-statements */\n\n/**\n * Get the current view state\n * @param map (google.maps.Map) - The parent Map instance\n * @param transformer (google.maps.CoordinateTransformer) - A CoordinateTransformer instance\n */\nexport function getViewPropsFromCoordinateTransformer(\n  map: google.maps.Map,\n  transformer: google.maps.CoordinateTransformer\n) {\n  const {width, height} = getMapSize(map);\n  const {center, heading: bearing, tilt: pitch, zoom} = transformer.getCameraParams();\n\n  // Match Google projection matrix\n  const fovy = 25;\n  const aspect = height ? width / height : 1;\n\n  // Match depth range (crucial for correct z-sorting)\n  const near = 0.75;\n  const far = 300000000000000;\n  // const far = Infinity;\n\n  const projectionMatrix = new Matrix4().perspective({\n    fovy: (fovy * Math.PI) / 180,\n    aspect,\n    near,\n    far\n  });\n  const focalDistance = 0.5 * projectionMatrix[5];\n\n  return {\n    width,\n    height,\n    viewState: {\n      altitude: focalDistance,\n      bearing,\n      latitude: center.lat(),\n      longitude: center.lng(),\n      pitch,\n      projectionMatrix,\n      repeat: true,\n      zoom: zoom - 1\n    }\n  };\n}\n\nfunction getMapSize(map: google.maps.Map): {width: number; height: number} {\n  // The map fills the container div unless it's in fullscreen mode\n  // at which point the first child of the container is promoted\n  const container = map.getDiv().firstChild as HTMLElement | null;\n  return {\n    // @ts-ignore (TS2531) Object is possibly 'null'\n    width: container.offsetWidth,\n    // @ts-ignore (TS2531) Object is possibly 'null'\n    height: container.offsetHeight\n  };\n}\n\nfunction pixelToLngLat(\n  projection: google.maps.MapCanvasProjection,\n  x: number,\n  y: number\n): [longitude: number, latitude: number] {\n  const point = new google.maps.Point(x, y);\n  const latLng = projection.fromContainerPixelToLatLng(point);\n  // @ts-ignore (TS2531) Object is possibly 'null'\n  return [latLng.lng(), latLng.lat()];\n}\n\nfunction getEventPixel(event, deck: Deck): {x: number; y: number} {\n  if (event.pixel) {\n    return event.pixel;\n  }\n  // event.pixel may not exist when clicking on a POI\n  // https://developers.google.com/maps/documentation/javascript/reference/map#MouseEvent\n  const point = deck.getViewports()[0].project([event.latLng.lng(), event.latLng.lat()]);\n  return {\n    x: point[0],\n    y: point[1]\n  };\n}\n\n// Triggers picking on a mouse event\nfunction handleMouseEvent(deck: Deck, type: string, event) {\n  if (!deck.isInitialized) {\n    return;\n  }\n\n  const mockEvent: Record<string, any> = {\n    type,\n    offsetCenter: getEventPixel(event, deck),\n    srcEvent: event\n  };\n\n  switch (type) {\n    case 'click':\n    case 'rightclick':\n      mockEvent.type = 'click';\n      mockEvent.tapCount = 1;\n      // Hack: because we do not listen to pointer down, perform picking now\n      deck._onPointerDown(mockEvent as MjolnirPointerEvent);\n      deck._onEvent(mockEvent as MjolnirGestureEvent);\n      break;\n\n    case 'dblclick':\n      mockEvent.type = 'click';\n      mockEvent.tapCount = 2;\n      deck._onEvent(mockEvent as MjolnirGestureEvent);\n      break;\n\n    case 'mousemove':\n      mockEvent.type = 'pointermove';\n      deck._onPointerMove(mockEvent as MjolnirPointerEvent);\n      break;\n\n    case 'mouseout':\n      mockEvent.type = 'pointerleave';\n      deck._onPointerMove(mockEvent as MjolnirPointerEvent);\n      break;\n\n    default:\n      return;\n  }\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACKA,uBAA+B;AAC/B,mBAA0B;;;ACD1B,kBAA4B;AAC5B,IAAAA,eAA+B;AAI/B,IAAM,eAAe;AAaf,SAAU,mBACd,KACA,SACA,MACA,OAAK;AAEL,MAAI,MAAM;AACR,QAAI,KAAK,SAAS,eAAe,KAAK;AACpC,aAAO;IACT;AAEA,wBAAoB,IAAI;EAC1B;AAEA,QAAM,iBAAiB;IACrB,OAAO;IACP,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;;AAGZ,QAAM,UAAU,IAAI,iBAAK;IACvB,GAAG;IACH,iBAAiB,MAAM,cAAc,OAAO,MAAM;IAClD,OAAO,MAAM,cAAc,OA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