{"version":3,"file":"places.cjs","sources":["../src/util.ts","../src/color.ts","../src/map-state-observer.ts","../src/position-formats.ts","../src/computed-marker-attributes.ts","../src/marker-attributes.ts","../src/marker.ts","../src/marker-collection.ts","../src/places.ts"],"sourcesContent":["/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nconst warnings = new Set();\n\n/**\n * Prints the specified message to the console the first time it is called with\n * the message.\n *\n * @param message\n * @param params\n */\nexport function warnOnce(message: string, ...params: unknown[]) {\n  if (warnings.has(message)) return;\n\n  warnings.add(message);\n  if (typeof console !== 'undefined') {\n    console.warn(message, ...params);\n  }\n}\n\n/**\n * Verifies that the Google Maps API is properly loaded and throws an exception\n * if it isn't.\n */\nexport function assertMapsApiLoaded() {\n  if (!('google' in window) || !google.maps) {\n    console.error(\n      `Google Maps API couldn't be found. Please make sure ` +\n        `to wait for the Google Maps API to load before creating markers.`\n    );\n    throw new Error('Google Maps API not found.');\n  }\n\n  if (google.maps && !google.maps.marker) {\n    console.error(\n      `Google Maps API was loaded without the required marker-library. ` +\n        `To load it, add the '&libraries=marker' parameter to the API url ` +\n        `or use \\`await google.maps.importLibrary('marker');\\` before creating ` +\n        `a marker.`\n    );\n    throw new Error('Google Maps Marker Library not found.');\n  }\n}\n\n/**\n * A typescript assertion function used in cases where typescript has to be\n * convinced that the object in question can not be null.\n *\n * @param value\n * @param message\n */\nexport function assertNotNull<TValue>(\n  value: TValue,\n  message: string = 'assertion failed'\n): asserts value is NonNullable<TValue> {\n  if (value === null || value === undefined) {\n    throw Error(message);\n  }\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport {warnOnce} from './util';\n\nexport type RGBAColor = [number, number, number, number];\nexport type RGBColor = [number, number, number];\nexport type LABColor = [number, number, number];\n\nlet helperDiv: HTMLElement;\nconst colorCache: Record<string, RGBAColor> = {};\n\nconst rxHexColor = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/;\n\n// slightly simplified regex to parse all rgb() and rgba() formats\nconst rxRgbColor =\n  /^rgba?\\(\\s*(\\d+%?)\\s*,\\s*(\\d+%?)\\s*,\\s*(\\d+%?)(?:\\s*[,/]\\s*(\\d*(?:\\.\\d*)?%?)?)?\\)$/;\n\n/**\n * Parses the given css color-value and returns it as `RGBAColor` (r/g/b in\n * range [0..255] a in range [0..1]).\n *\n * Color values are parsed using a fast-path for hex- and rgb-colors and a\n * hidden dom-element and `getComputedStyle()` to get the rgb-values for any\n * other valid css color-value including css custom-properties. Since computing\n * the color-values this way can be expensive, the values for those more complex\n * formats are cached.\n *\n * @param color\n */\nexport function parseCssColorValue(color: string): RGBAColor {\n  // fast paths for most common formats\n  if (rxHexColor.test(color)) {\n    return parseHexColor(color);\n  } else if (rxRgbColor.test(color)) {\n    return parseRgbColor(color);\n  }\n\n  if (colorCache[color]) {\n    return colorCache[color].slice(0) as RGBAColor;\n  }\n\n  if (!helperDiv) {\n    helperDiv = document.createElement('div');\n    helperDiv.style.cssText = `\n        position: absolute;\n        visibility: hidden;\n        pointer-events: none;\n      `;\n  }\n  helperDiv.style.color = color;\n  document.body.appendChild(helperDiv);\n  const rgb = getComputedStyle(helperDiv).color;\n  helperDiv.remove();\n\n  return (colorCache[color] = parseRgbColor(rgb));\n}\n\n/**\n * Parses a color in hex-notation and returns the RGBA array.\n *\n * @param color\n */\nfunction parseHexColor(color: string): RGBAColor {\n  if (color.length < 7) {\n    // '#rgb'\n    return [\n      Number('0x' + color[1].repeat(2)),\n      Number('0x' + color[2].repeat(2)),\n      Number('0x' + color[3].repeat(2)),\n      color.length === 4 ? 1 : Number('0x' + color[4].repeat(2))\n    ];\n  }\n\n  // '#rrggbb' / '#rrggbbaa'\n  return [\n    Number('0x' + color.slice(1, 3)),\n    Number('0x' + color.slice(3, 5)),\n    Number('0x' + color.slice(5, 7)),\n    color.length === 7 ? 1 : Number('0x' + color.slice(7, 9))\n  ];\n}\n\n/**\n * Parses a color in rgb/rgba notation and returns the RGBA array.\n *\n * @param color\n */\nfunction parseRgbColor(color: string): RGBAColor {\n  try {\n    const [, r, g, b, a = '1'] = color.match(rxRgbColor) as RegExpMatchArray;\n    const rgba = [r, g, b, a];\n\n    return rgba.map(s =>\n      s.endsWith('%') ? Number(s.slice(0, -1)) * 2.55 : Number(s)\n    ) as RGBAColor;\n  } catch (err) {\n    warnOnce(`rgb-color parsing failed (parsing value: '${color}')`);\n\n    return [0, 0, 0, 1];\n  }\n}\n\n/**\n * Converts a color-value in array-format into a rgb/rgba-string.\n *\n * @param rgb\n */\nexport function rgbaToString(rgb: RGBColor | RGBAColor): string {\n  return (rgb.length === 4 ? `rgba` : `rgb`) + `(${rgb.join(',')})`;\n}\n\n/**\n * Computes the relative luminance of the specified color-value (range [0..1]).\n * See http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n */\nexport function luminance(rgb: RGBColor | RGBAColor) {\n  const [r, g, b] = rgb.map(n => n / 255);\n\n  return (\n    0.2126 * channelLuminance(r) +\n    0.7152 * channelLuminance(g) +\n    0.0722 * channelLuminance(b)\n  );\n}\n\nconst channelLuminance = (x: number) =>\n  x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n\n/**\n * Darkens the given color by the amount specified. An amount of 1 is roughly\n * one step in the material design palette.\n *\n * @param rgb\n * @param amount\n */\nexport function darken(rgb: RGBColor, amount?: number): RGBColor;\nexport function darken(rgba: RGBAColor, amount?: number): RGBAColor;\nexport function darken(rgbIn: RGBColor | RGBAColor, amount = 1) {\n  return labBrightnessAdjust(rgbIn, -amount);\n}\n\n/**\n * Brightens the given color by the amount specified. An amount of 1 is roughly\n * one step in the material design palette.\n *\n * @param rgb\n * @param amount\n */\nexport function brighten(rgb: RGBColor, amount?: number): RGBColor;\nexport function brighten(rgba: RGBAColor, amount?: number): RGBAColor;\nexport function brighten(rgbIn: RGBColor | RGBAColor, amount = 1) {\n  return labBrightnessAdjust(rgbIn, amount);\n}\n\nfunction labBrightnessAdjust(rgbIn: RGBColor | RGBAColor, amount = 1) {\n  const [r, g, b, alpha = 1] = rgbIn;\n\n  const lab = rgb2lab([r, g, b]);\n  lab[0] += LAB_CONSTANTS.Kn * amount;\n  const rgbOut = lab2rgb(lab);\n\n  return alpha === 1 ? rgbOut : [...rgbOut, alpha];\n}\n\n// the code below was adapted from the implementation in chroma.js\n// Copyright (c) 2011-2019, Gregor Aisch\n// Dual Licensed under BSD-3-Clause / Apache-2.0\n// https://raw.githubusercontent.com/gka/chroma.js/b2fc17a34d729f4d1fc3a30dabd61caa34245526/LICENSE\n\nconst LAB_CONSTANTS = {\n  // Corresponds roughly to RGB brighter/darker\n  Kn: 18,\n\n  // D65 standard referent\n  Xn: 0.95047,\n  Yn: 1,\n  Zn: 1.08883,\n\n  t0: 0.137931034, // 4 / 29\n  t1: 0.206896552, // 6 / 29\n  t2: 0.12841855, // 3 * t1 * t1\n  t3: 0.008856452 // t1 * t1 * t1\n};\n\nfunction rgb2lab([r, g, b]: RGBColor): LABColor {\n  r = rgb_xyz(r);\n  g = rgb_xyz(g);\n  b = rgb_xyz(b);\n  const x = xyz_lab(\n    (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / LAB_CONSTANTS.Xn\n  );\n  const y = xyz_lab(\n    (0.2126729 * r + 0.7151522 * g + 0.072175 * b) / LAB_CONSTANTS.Yn\n  );\n  const z = xyz_lab(\n    (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / LAB_CONSTANTS.Zn\n  );\n\n  const l = 116 * y - 16;\n  return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];\n}\n\nfunction rgb_xyz(r: number) {\n  if ((r /= 255) <= 0.04045) return r / 12.92;\n  return Math.pow((r + 0.055) / 1.055, 2.4);\n}\n\nfunction xyz_lab(t: number) {\n  if (t > LAB_CONSTANTS.t3) return Math.pow(t, 1 / 3);\n  return t / LAB_CONSTANTS.t2 + LAB_CONSTANTS.t0;\n}\n\n/*\n * L* [0..100]\n * a [-100..100]\n * b [-100..100]\n */\nfunction lab2rgb([l, a, b]: LABColor) {\n  let x, y, z;\n\n  y = (l + 16) / 116;\n  x = isNaN(a) ? y : y + a / 500;\n  z = isNaN(b) ? y : y - b / 200;\n\n  y = LAB_CONSTANTS.Yn * lab_xyz(y);\n  x = LAB_CONSTANTS.Xn * lab_xyz(x);\n  z = LAB_CONSTANTS.Zn * lab_xyz(z);\n\n  const r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB\n  const g = xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z);\n  const b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);\n\n  return [r, g, b_];\n}\n\nfunction xyz_rgb(r: number) {\n  return (\n    255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055)\n  );\n}\n\nfunction lab_xyz(t: number) {\n  return t > LAB_CONSTANTS.t1\n    ? t * t * t\n    : LAB_CONSTANTS.t2 * (t - LAB_CONSTANTS.t0);\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\n/** The MapState type describes the current viewport state of the map. */\nexport type MapState = {\n  zoom: number;\n  heading: number;\n  tilt: number;\n  center: google.maps.LatLng;\n  bounds: google.maps.LatLngBounds;\n};\n\nexport type MapStateListener = (state: MapState) => void;\n\n/**\n * Since we have many more markers than maps, it doesn't make sense to have each\n * marker observe the map for changes by itself. Instead, a MapStateObserver is\n * created for every map that receives 'bounds_changed'-events from the map and\n * triggers updates for all added markers.\n */\nexport class MapStateObserver {\n  private static instances_ = new Map<google.maps.Map, MapStateObserver>();\n\n  /**\n   * Returns the observer instance for the given map.\n   *\n   * @param map\n   */\n  static getInstance(map: google.maps.Map): MapStateObserver {\n    if (!this.instances_.has(map)) {\n      this.instances_.set(map, new MapStateObserver(map));\n    }\n\n    return this.instances_.get(map) as MapStateObserver;\n  }\n\n  private map_: google.maps.Map;\n  private mapState_!: MapState;\n  private listeners_: MapStateListener[] = [];\n\n  private constructor(map: google.maps.Map) {\n    this.map_ = map;\n\n    map.addListener('bounds_changed', () => this.handleBoundsChange());\n    this.handleBoundsChange();\n  }\n\n  /**\n   * Add a listener to be notified of map-state changes.\n   *\n   * @param callback\n   */\n  addListener(callback: MapStateListener): google.maps.MapsEventListener {\n    this.listeners_.push(callback);\n\n    return {\n      remove: () => {\n        this.listeners_.splice(this.listeners_.indexOf(callback), 1);\n      }\n    };\n  }\n\n  /**\n   * Returns the map-state as it will be passed into the dynamic attribute\n   * callbacks of the markers.\n   */\n  getMapState(): MapState {\n    return this.mapState_;\n  }\n\n  private handleBoundsChange() {\n    const center = this.map_.getCenter();\n    const bounds = this.map_.getBounds();\n\n    if (!center || !bounds) {\n      console.debug(\n        'MapStateObserver.handleBoundsChange(): map center and/or bounds ' +\n          'undefined. Not updating map state.'\n      );\n\n      return;\n    }\n\n    this.mapState_ = {\n      center,\n      bounds,\n      zoom: this.map_.getZoom() || 0,\n      heading: this.map_.getHeading() || 0,\n      tilt: this.map_.getTilt() || 0\n    };\n\n    for (const listener of this.listeners_) {\n      listener(this.mapState_);\n    }\n  }\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport type {LngLatArray} from './marker-attributes';\n\ntype PositionFormat<T> = {\n  isValid(value: unknown): value is T;\n  toLatLng(value: T): google.maps.LatLng;\n  fromLatLng(value: google.maps.LatLng): T;\n};\n\nconst LatLngFormat: PositionFormat<google.maps.LatLng> = {\n  isValid(value: unknown): value is google.maps.LatLng {\n    return typeof value === 'object' && value instanceof google.maps.LatLng;\n  },\n\n  fromLatLng(value: google.maps.LatLng): google.maps.LatLng {\n    return value;\n  },\n\n  toLatLng(value: google.maps.LatLng): google.maps.LatLng {\n    return value;\n  }\n};\n\nconst LngLatArrayFormat: PositionFormat<LngLatArray> = {\n  isValid(value: unknown): value is LngLatArray {\n    return Array.isArray(value) && value.length === 2;\n  },\n\n  fromLatLng(p: google.maps.LatLng): LngLatArray {\n    return [p.lng(), p.lat()];\n  },\n\n  toLatLng(p: LngLatArray): google.maps.LatLng {\n    return new google.maps.LatLng(p[1], p[0]);\n  }\n};\n\nconst LatLngLiteralFormat: PositionFormat<google.maps.LatLngLiteral> = {\n  isValid(value: unknown): value is google.maps.LatLngLiteral {\n    return (\n      value !== null &&\n      typeof value === 'object' &&\n      'lat' in value &&\n      'lng' in value\n    );\n  },\n\n  fromLatLng(p: google.maps.LatLng): google.maps.LatLngLiteral {\n    return p.toJSON();\n  },\n\n  toLatLng(p: google.maps.LatLngLiteral): google.maps.LatLng {\n    return new google.maps.LatLng(p);\n  }\n};\n\n/** Union type of all position-formats supported by the markers. */\nexport type Position =\n  | google.maps.LatLngLiteral\n  | google.maps.LatLng\n  | LngLatArray;\n\n/** The supported position-formats. */\nexport const positionFormats = [\n  LatLngFormat,\n  LngLatArrayFormat,\n  LatLngLiteralFormat\n];\n\n/**\n * Returns the position-format for the specified datum.\n *\n * @param p\n */\nexport function getPositionFormat(p: Position): PositionFormat<typeof p> {\n  for (const fmt of positionFormats) {\n    if (fmt.isValid(p)) return fmt;\n  }\n\n  throw new Error('unknown position format');\n}\n\n/**\n * Converts the specified datum into the google.maps.LatLng format used\n * internally.\n *\n * @param p\n */\nexport function toLatLng(p: Position): google.maps.LatLng {\n  return getPositionFormat(p).toLatLng(p);\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport {toLatLng} from './position-formats';\nimport {AttributeKey, attributeKeys} from './marker-attributes';\n\nimport type {Marker} from './marker';\nimport type {StaticAttributes} from './marker-attributes';\n\n/**\n * Internal class that resolves all attributes based on dynamic and static\n * values and makes them behave as if there were only static attributes.\n *\n * @typeParam TUserData - Can be used to specify a type for the data specified\n *   in {@link Marker.setData} and available in dynamic attribute callbacks.\n * @internal\n */\nexport class ComputedMarkerAttributes<TUserData = unknown> {\n  private readonly marker_: Marker<TUserData>;\n  private callbackDepth_: number = 0;\n\n  // Attributes are declaration-only, the implementataion uses dynamic\n  // getters/setters created in the static initializer\n\n  // note: internally, the position-attribute uses the google.maps.LatLng\n  //   type instead of the generic Position type.\n  declare readonly position?: google.maps.LatLng;\n  declare readonly draggable?: StaticAttributes['draggable'];\n  declare readonly collisionBehavior?: StaticAttributes['collisionBehavior'];\n  declare readonly title?: StaticAttributes['title'];\n  declare readonly zIndex?: StaticAttributes['zIndex'];\n\n  declare readonly glyph?: StaticAttributes['glyph'];\n  declare readonly scale?: StaticAttributes['scale'];\n  declare readonly color?: StaticAttributes['color'];\n  declare readonly backgroundColor?: StaticAttributes['backgroundColor'];\n  declare readonly borderColor?: StaticAttributes['borderColor'];\n  declare readonly glyphColor?: StaticAttributes['glyphColor'];\n  declare readonly icon?: StaticAttributes['icon'];\n\n  declare readonly content?: StaticAttributes['content'];\n  declare readonly classList?: StaticAttributes['classList'];\n\n  constructor(marker: Marker<TUserData>) {\n    this.marker_ = marker;\n  }\n\n  /**\n   * Resolves the specified attribute into a static value, calling a dynamic\n   * attribute function.\n   *\n   * @param key\n   */\n  private getComputedAttributeValue<TKey extends AttributeKey>(\n    key: TKey\n  ): StaticAttributes[TKey] | undefined {\n    const value = this.marker_[key];\n    if (typeof value !== 'function') {\n      return this.marker_[key] as StaticAttributes[TKey];\n    }\n\n    this.callbackDepth_++;\n    if (this.callbackDepth_ > 10) {\n      throw new Error(\n        'maximum recursion depth reached. ' +\n          'This is probably caused by a cyclic dependency in dynamic attributes.'\n      );\n    }\n\n    const {map, data, marker} = this.marker_.getDynamicAttributeState();\n    const res = value({data, map, marker, attr: this});\n    this.callbackDepth_--;\n\n    return res as StaticAttributes[TKey];\n  }\n\n  // The static initializer sets up the implementation for the properties of the\n  // ComputedMarkerAttributes class.\n  static {\n    Object.defineProperty(this.prototype, 'position', {\n      get(this: ComputedMarkerAttributes) {\n        const userValue = this.getComputedAttributeValue('position');\n\n        if (userValue) return toLatLng(userValue);\n      }\n    });\n\n    for (const key of attributeKeys) {\n      // position is treated separately, so it is skipped here\n      if (key === 'position') continue;\n\n      Object.defineProperty(this.prototype, key, {\n        get(this: ComputedMarkerAttributes) {\n          return this.getComputedAttributeValue(key);\n        }\n      });\n    }\n  }\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport type {CollisionBehavior, MarkerState} from './marker';\nimport type {MapState} from './map-state-observer';\nimport type {ComputedMarkerAttributes} from './computed-marker-attributes';\nimport type {Position} from './position-formats';\n\n// These keys are used to create the dynamic properties (mostly to save us\n// from having to type them all out and to make adding attributes a bit easier).\nexport const attributeKeys: readonly AttributeKey[] = [\n  'position',\n  'draggable',\n  'collisionBehavior',\n  'title',\n  'zIndex',\n  'color',\n  'backgroundColor',\n  'borderColor',\n  'glyphColor',\n  'icon',\n  'glyph',\n  'scale',\n  'content',\n  'classList'\n] as const;\n\n/** Array based position format as it is used in e.g. GeoJSON */\nexport type LngLatArray = [lng: number, lat: number];\n\n/** StaticAttributes contains the base definition for all attribute-values. */\nexport type StaticAttributes = {\n  /** {@inheritDoc Marker.position} */\n  position: Position;\n  /** {@inheritDoc Marker.draggable} */\n  draggable: boolean;\n  /** {@inheritDoc Marker.collisionBehavior} */\n  collisionBehavior: CollisionBehavior;\n  /** {@inheritDoc Marker.title} */\n  title: string;\n  /** {@inheritDoc Marker.zIndex} */\n  zIndex: number;\n  /** {@inheritDoc Marker.color} */\n  color: string;\n  /** {@inheritDoc Marker.backgroundColor} */\n  backgroundColor: string;\n  /** {@inheritDoc Marker.borderColor} */\n  borderColor: string;\n  /** {@inheritDoc Marker.glyphColor} */\n  glyphColor: string;\n  /** {@inheritDoc Marker.icon} */\n  icon: string;\n  /** {@inheritDoc Marker.glyph} */\n  glyph: string | Element | URL;\n  /** {@inheritDoc Marker.scale} */\n  scale: number;\n  /** {@inheritDoc Marker.content} */\n  content: HTMLElement;\n  /** {@inheritDoc Marker.classList} */\n  classList: string | string[];\n};\n\n/** Keys for all attributes. */\nexport type AttributeKey = keyof StaticAttributes;\n\n/**\n * DynamicAttributeValues are functions that take a state object consisting of\n * internal state and user-data and return the attribute value. They are\n * evaluated whenever a state-change happens or user-data is updated.\n *\n * @typeParam TUserData - The type of the user-specified data passed to\n *   `setData()` and made available in the arguments of the dynamic attribute\n *   callbacks.\n * @typeParam TAttr - The type of the attribute-value.\n */\nexport type DynamicAttributeValue<TUserData, TAttr> = (\n  state: {data: TUserData | null} & {\n    map: MapState;\n    marker: MarkerState;\n    attr: ComputedMarkerAttributes<TUserData>;\n  }\n) => TAttr | undefined;\n\n/**\n * An AttributeValue can be either a static value of a dynamic attribute.\n *\n * @typeParam TUserData - The type of the user-specified data passed to\n *   `setData()` and made available in the arguments of the dynamic attribute\n *   callbacks.\n * @typeParam TAttr - The type of the attribute-value.\n */\nexport type AttributeValue<TUserData, TAttr> =\n  | TAttr\n  | DynamicAttributeValue<TUserData, TAttr>;\n\n/**\n * Internally used to store the attributes with dynamic values separately.\n *\n * @typeParam TUserData - The type of the user-specified data passed to\n *   `setData()` and made available in the arguments of the dynamic attribute\n *   callbacks.\n */\nexport type DynamicAttributes<TUserData> = {\n  [key in AttributeKey]: DynamicAttributeValue<\n    TUserData,\n    StaticAttributes[key]\n  >;\n};\n\n/**\n * These are the attribute-types as specified to the constructor and individual\n * attribute setters\n *\n * @typeParam TUserData - The type of the user-specified data passed to\n *   `setData()` and made available in the arguments of the dynamic attribute\n *   callbacks.\n */\nexport type Attributes<TUserData = unknown> = {\n  [key in AttributeKey]: AttributeValue<TUserData, StaticAttributes[key]>;\n};\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport {\n  brighten,\n  darken,\n  luminance,\n  parseCssColorValue,\n  rgbaToString\n} from './color';\nimport {assertMapsApiLoaded, assertNotNull, warnOnce} from './util';\nimport {MapStateObserver} from './map-state-observer';\nimport {ComputedMarkerAttributes} from './computed-marker-attributes';\nimport {attributeKeys} from './marker-attributes';\n\nimport type {IconProvider} from './icons';\nimport type {Attributes} from './marker-attributes';\nimport type {MapState} from './map-state-observer';\n\n/**\n * The Marker class.\n *\n * @typeParam TUserData - Can be used to specify a type for the data specified\n *   in {@link Marker.setData} and available in dynamic attribute callbacks.\n */\nexport class Marker<TUserData = unknown> {\n  private static iconProviders: Map<string, IconProvider> = new Map();\n\n  /**\n   * Registers a new icon provider that resolves the value of the icon-attribute\n   * to something that can be used as glyph. When multiple providers are used,\n   * you can additionally provide a namespace for the icons.\n   *\n   * For example:\n   *\n   *     marker.icon = 'star'; // requests the 'star' icon from the 'default' provider\n   *     marker.icon = 'other:star'; // requests the icon from the 'other' provider\n   *\n   * @param provider\n   * @param namespace\n   */\n  static registerIconProvider(\n    provider: IconProvider,\n    namespace: string = 'default'\n  ) {\n    Marker.iconProviders.set(namespace, provider);\n  }\n\n  // attributes are declaration-only, they are dynamically added to the\n  // prototype in the static-initializer\n\n  /** The position of the marker on the map. */\n  declare position?: Attributes<TUserData>['position'];\n\n  /**\n   * Flag to enable draggable markers. When using draggable markers, the\n   * position-attribute of the marker will not be automatically updated. You\n   * have to listen to the `dragstart`, `drag` and `dragend` events and update\n   * the position accordingly.\n   */\n  declare draggable?: Attributes<TUserData>['draggable'];\n\n  /**\n   * The collision behavior controls how the marker interacts with other markers\n   * and labels on the map. See {@link CollisionBehavior} for more information.\n   */\n  declare collisionBehavior?: Attributes<TUserData>['collisionBehavior'];\n\n  /**\n   * The title of the marker element. Will be shown in the browsers default\n   * tooltip and should be provided for accessibility reasons.\n   */\n  declare title?: Attributes<TUserData>['title'];\n\n  /**\n   * Defines the z-ordering for the marker and is used to compute the priority\n   * for collision handling. See [the official documentation][gmp-marker-zindex]\n   * for more information.\n   *\n   * [gmp-marker-zindex]: https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.zIndex\n   */\n  declare zIndex?: Attributes<TUserData>['zIndex'];\n\n  /**\n   * The glyph to be shown inside the marker-pin. This can be a single letter or\n   * number, a dom-element or a URL-object pointing to an image file.\n   */\n  declare glyph?: Attributes<TUserData>['glyph'];\n\n  /** The scale of the marker as a multiple of the original scale. */\n  declare scale?: Attributes<TUserData>['scale'];\n\n  /**\n   * The color of the marker. Can be specified in any format supported by CSS.\n   *\n   * This is a shorthand property to set a default value for the three\n   * color-values (`backgroundColor`, `borderColor` and `glyphColor`) to\n   * matching colors.\n   *\n   * The `backgroundColor` will be set to the specified color, the border-color\n   * will be a darkened vertsion of the color and the glyph-color is set based\n   * on the brightness of the specified color to either a darkened or lightened\n   * version.\n   */\n  declare color?: Attributes<TUserData>['color'];\n\n  /**\n   * The background-color for the marker pin. Can be specified in any format\n   * supported by CSS.\n   */\n  declare backgroundColor?: Attributes<TUserData>['backgroundColor'];\n\n  /**\n   * The border-color for the marker pin. Can be specified in any format\n   * supported by CSS.\n   */\n  declare borderColor?: Attributes<TUserData>['borderColor'];\n\n  /**\n   * The color of the glyph within the marker pin. Can be specified in any\n   * format supported by CSS.\n   */\n  declare glyphColor?: Attributes<TUserData>['glyphColor'];\n\n  /**\n   * The id of an icon to be fetched via the {@link icons.IconProvider}. The\n   * resulting icon will be shown\n   */\n  declare icon?: Attributes<TUserData>['icon'];\n\n  /**\n   * The content to replace the default pin. The specified html-element will be\n   * rendered instead of the default pin.\n   *\n   * The content element you provide here will have access to the\n   * style-properties of the marker (colors and scale) via css custom properties\n   * (e.g. `color: var(--marker-glyph-color, white)`).\n   */\n  declare content?: Attributes<TUserData>['content'];\n\n  /**\n   * A single classname or list of class names to be added to the content\n   * element.\n   */\n  declare classList?: Attributes<TUserData>['classList'];\n\n  /** The map instance the marker is added to. */\n  private map_: google.maps.Map | null = null;\n\n  /**\n   * The map-observer receives the `bounds_changed` event from the map-instances\n   * and provides the map-data for the dynamic attributes.\n   */\n  private mapObserver_: MapStateObserver | null = null;\n\n  /**\n   * All listeners bound to the marker, it's dom-element or the map-instance are\n   * stored here, so they can be easily removed when the marker is removed from\n   * the map.\n   *\n   * @see Marker.bindEvents_()\n   * @see Marker.unbindEvents_()\n   */\n  private mapEventListeners_: google.maps.MapsEventListener[] = [];\n\n  /**\n   * User-data that has been passed to the constructor or the\n   * {@link Marker.setData} method.\n   */\n  private data_: TUserData | null = null;\n\n  /**\n   * Special state attributes of the marker that are made available in dynamic\n   * attribute callbacks.\n   */\n  private markerState_: MarkerState = {\n    hovered: false,\n    content: document.createElement('div')\n  };\n\n  /** Attributes set by the user. */\n  private attributes_: Partial<Attributes<TUserData>> = {};\n\n  /**\n   * Attributes set by inheriting classes. These are applied at a lower\n   * precedence than the values in attributes_ and allow inheriting classes to\n   * provide values that can be overridden by the user and restored to their\n   * original value.\n   */\n  protected attributeDefaults_: Partial<Attributes<TUserData>> = {};\n\n  /**\n   * Computed attributes take care of resolving the dynamic attributes into the\n   * static values at the time of evaluation.\n   */\n  private readonly computedAttributes_: ComputedMarkerAttributes<TUserData> =\n    new ComputedMarkerAttributes(this);\n\n  // AdvancedMarkerElement and PinElement instances used to render the marker\n  private markerView_: google.maps.marker.AdvancedMarkerElement;\n  private pinView_: google.maps.marker.PinElement;\n\n  /**\n   * Internal flag to prevent multiple updates in the same execution frame\n   * (updates start as microtasks after being requested)\n   */\n  private updateScheduled_: boolean = false;\n\n  /**\n   * Creates a new marker instance. Markers can be created without any options,\n   * or with any number of attributes set.\n   *\n   * @param options\n   * @param data\n   */\n  constructor(options: MarkerOptions<TUserData> = {}, data?: TUserData) {\n    const {map, ...attributes} = options;\n\n    assertMapsApiLoaded();\n\n    this.pinView_ = new google.maps.marker.PinElement();\n    this.markerView_ = new google.maps.marker.AdvancedMarkerElement();\n    this.markerView_.content = this.pinView_.element;\n\n    if (data) this.data_ = data;\n\n    // set all remaining parameters as attributes\n    this.setAttributes(attributes);\n\n    if (map) {\n      this.map = map;\n      this.update();\n    }\n  }\n\n  /**\n   * Adds an event-listener to this marker. The internal events (click and\n   * dragging events) are attached to the marker instance using the Google Maps\n   * event system, while any dom-events will be added to the marker-element\n   * itself.\n   *\n   * @param eventName 'click', 'dragstart', 'dragend', 'drag' or any DOM\n   *   event-name.\n   * @param handler\n   */\n  addListener<K extends keyof GoogleMapsAMVEventMap>(\n    eventName: K,\n    handler: (ev: GoogleMapsAMVEventMap[K]) => void\n  ): google.maps.MapsEventListener;\n\n  addListener<K extends keyof HTMLElementEventMap>(\n    eventName: K,\n    handler: (ev: HTMLElementEventMap[K]) => void\n  ): google.maps.MapsEventListener;\n\n  addListener(\n    eventName: string,\n    handler: ((ev: google.maps.MapMouseEvent) => void) | ((ev: Event) => void)\n  ): google.maps.MapsEventListener {\n    if (eventName in MarkerEvents) {\n      return this.markerView_.addListener(\n        eventName === 'click' ? 'gmp-click' : eventName,\n        handler\n      );\n    }\n\n    const element = this.markerView_.element;\n\n    assertNotNull(element);\n\n    element.addEventListener(\n      eventName as keyof ElementEventMap,\n      handler as (ev: Event) => void\n    );\n\n    return {\n      remove() {\n        element.removeEventListener(\n          eventName as keyof ElementEventMap,\n          handler as (ev: Event) => void\n        );\n      }\n    };\n  }\n\n  /**\n   * Stores the map-instance. The map will be passed on to the\n   * AdvancedMarkerElement in `performUpdate()`.\n   */\n  get map(): google.maps.Map | null {\n    return this.map_ || null;\n  }\n\n  set map(map: google.maps.Map | null) {\n    if (this.map_ === map) {\n      return;\n    }\n\n    this.unbindEvents_();\n    this.mapObserver_ = null;\n    this.map_ = map;\n\n    if (map) {\n      this.mapObserver_ = MapStateObserver.getInstance(map);\n      this.bindEvents_();\n    }\n\n    this.update();\n  }\n\n  /**\n   * Sets the data for this marker and triggers an update.\n   *\n   * @param data\n   */\n  setData(data: TUserData) {\n    this.data_ = data;\n\n    this.update();\n  }\n\n  /**\n   * Sets multiple attributes at once.\n   *\n   * @param attributes\n   */\n  setAttributes(attributes: Partial<Attributes<TUserData>>) {\n    Object.assign(this.attributes_, attributes);\n    this.update();\n  }\n\n  /**\n   * Schedules an update of the marker, writing all attribute values to the\n   * underlying advanced marker objects. Calling this manually should not be\n   * needed.\n   */\n  update() {\n    if (this.updateScheduled_) return;\n\n    this.updateScheduled_ = true;\n    queueMicrotask(() => {\n      this.updateScheduled_ = false;\n      this.performUpdate();\n    });\n  }\n\n  /**\n   * Updates the rendered objects for this marker, typically an\n   * AdvancedMarkerElement and PinElement. This method is called very often, so\n   * it is critical to keep it as performant as possible:\n   *\n   * - Avoid object allocations if possible\n   * - Avoid expensive computations. These can likely be moved into setAttribute_\n   *   or the ComputedMarkerAttributes class\n   */\n  private performUpdate() {\n    if (!this.map) {\n      this.markerView_.map = null;\n\n      return;\n    }\n\n    const attrs = this.computedAttributes_ as ComputedMarkerAttributes;\n    const position = attrs.position;\n\n    // if the marker doesn't have a position, we can skip it entirely and\n    // remove it from the map.\n    if (!position) {\n      this.markerView_.map = null;\n\n      return;\n    }\n\n    if (this.markerView_.map !== this.map_) {\n      this.markerView_.map = this.map_;\n    }\n\n    this.markerView_.position = position;\n    this.markerView_.gmpDraggable = attrs.draggable || false;\n    this.markerView_.title = attrs.title || '';\n    this.markerView_.zIndex = attrs.zIndex;\n    this.markerView_.collisionBehavior = attrs.collisionBehavior;\n    this.pinView_.scale = attrs.scale;\n\n    this.updateContent_(attrs);\n\n    // the element returned by a dynamic content attribute is stored in the\n    // markerState to allow for dom updates in dynamic attributes instead of\n    // creating new elements for every update.\n    if (attrs.content) this.markerState_.content = attrs.content;\n  }\n\n  /**\n   * Updates the content element, it's classes and css custom properties.\n   *\n   * @param attrs\n   */\n  private updateContent_(attrs: ComputedMarkerAttributes) {\n    const {content, classList} = attrs;\n\n    if (content) {\n      content.className = classList\n        ? Array.isArray(classList)\n          ? classList.join(' ')\n          : classList\n        : '';\n      this.markerView_.content = content;\n    } else {\n      this.markerView_.content = this.pinView_.element;\n      this.updateColors_(attrs);\n      this.updateGlyph_(attrs);\n    }\n\n    if (this.markerView_.element) {\n      const el = this.markerView_.element;\n      const {\n        color = null,\n        backgroundColor = null,\n        glyphColor = null,\n        borderColor = null,\n        scale = null\n      } = attrs;\n\n      el.style.setProperty('--marker-color', color);\n      el.style.setProperty('--marker-background-color', backgroundColor);\n      el.style.setProperty('--marker-glyph-color', glyphColor);\n      el.style.setProperty('--marker-border-color', borderColor);\n      el.style.setProperty('--marker-scale', scale ? scale.toString() : null);\n    }\n  }\n\n  /**\n   * Updates the colors for the embedded pin-view based on the different color\n   * attributes.\n   *\n   * @param attributes\n   */\n  private updateColors_(attributes: ComputedMarkerAttributes) {\n    let {color, backgroundColor, borderColor, glyphColor} = attributes;\n\n    if (color) {\n      const rgba = parseCssColorValue(color);\n      const rgbaDark = darken(rgba, 1.2);\n      const rgbaLight = brighten(rgba, 1.2);\n\n      if (!backgroundColor) backgroundColor = rgbaToString(rgba);\n      if (!borderColor) borderColor = rgbaToString(rgbaDark);\n\n      if (!glyphColor) {\n        glyphColor = rgbaToString(luminance(rgba) > 0.4 ? rgbaDark : rgbaLight);\n      }\n    }\n\n    this.pinView_.background = backgroundColor;\n    this.pinView_.borderColor = borderColor;\n    this.pinView_.glyphColor = glyphColor;\n  }\n\n  /**\n   * Updates the pinelement glyph based on the `icon` and `glyph` attributes.\n   *\n   * @param attrs\n   */\n  private updateGlyph_(attrs: ComputedMarkerAttributes) {\n    if (!attrs.icon) {\n      this.pinView_.glyph = attrs.glyph || undefined;\n\n      return;\n    }\n\n    let namespace = 'default';\n    let iconId = attrs.icon;\n\n    if (attrs.icon.includes(':')) {\n      [namespace, iconId] = attrs.icon.split(':');\n    }\n\n    const provider = Marker.iconProviders.get(namespace);\n    if (provider) {\n      this.pinView_.glyph = provider(iconId);\n    } else {\n      const nsText =\n        namespace === 'default' ? '' : `with namespace '${namespace}' `;\n\n      warnOnce(\n        `An icon is set but no icon provider ${nsText}is configured.\\n` +\n          `You can register an icon-provider using e.g. ` +\n          `\\`Marker.iconProvider = MaterialIcons()\\` to use the material ` +\n          `icons webfont.`\n      );\n    }\n  }\n\n  /** Binds the required dom- and map-events to the marker-instance. */\n  private bindEvents_() {\n    assertNotNull(this.mapObserver_);\n\n    this.mapEventListeners_ = [\n      this.mapObserver_.addListener(() => this.update()),\n      this.addListener('pointerenter', () => {\n        this.markerState_.hovered = true;\n        this.update();\n      }),\n      this.addListener('pointerleave', () => {\n        this.markerState_.hovered = false;\n        this.update();\n      })\n    ];\n  }\n\n  /** Unbinds all event listeners from the marker. */\n  private unbindEvents_() {\n    for (const listener of this.mapEventListeners_) listener.remove();\n    this.mapEventListeners_ = [];\n  }\n\n  /**\n   * Retrieve the parameters to be passed to dynamic attribute callbacks. This\n   * method is part of the internal API used by the ComputedMarkerAttributes.\n   *\n   * @internal\n   */\n  getDynamicAttributeState(): {\n    data: TUserData | null;\n    map: MapState;\n    marker: MarkerState;\n  } {\n    assertNotNull(this.mapObserver_, 'this.mapObserver_ is not defined');\n\n    return {\n      data: this.data_,\n      map: this.mapObserver_.getMapState(),\n      marker: this.markerState_\n    };\n  }\n\n  static {\n    // set up all attributes for the Marker prototype. For performance reasons,\n    // these are defined on the prototype instead of the object itself.\n    for (const key of attributeKeys) {\n      // Note: in a static initializer, `this` refers to the class itself.\n      Object.defineProperty(this.prototype, key, {\n        get(this: Marker) {\n          return this.attributes_[key] || this.attributeDefaults_[key];\n        },\n\n        set(this: Marker, value) {\n          // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n          this.attributes_[key] = value;\n          this.update();\n        }\n      });\n    }\n  }\n}\n\n/**\n * The CollisionBehaviour enum is copied from Google Maps typings in order to\n * allow those to be used before the api has loaded.\n */\nexport enum CollisionBehavior {\n  /**\n   * Display the marker only if it does not overlap with other markers. If two\n   * markers of this type would overlap, the one with the higher zIndex is\n   * shown. If they have the same zIndex, the one with the lower vertical screen\n   * position is shown.\n   */\n  OPTIONAL_AND_HIDES_LOWER_PRIORITY = 'OPTIONAL_AND_HIDES_LOWER_PRIORITY',\n  /**\n   * Always display the marker regardless of collision. This is the default\n   * behavior.\n   */\n  REQUIRED = 'REQUIRED',\n  /**\n   * Always display the marker regardless of collision, and hide any\n   * OPTIONAL_AND_HIDES_LOWER_PRIORITY markers or labels that would overlap with\n   * the marker.\n   */\n  REQUIRED_AND_HIDES_OPTIONAL = 'REQUIRED_AND_HIDES_OPTIONAL'\n}\n\n/**\n * The single options argument for the marker-class contains the attributes as\n * well as additional options.\n *\n * @typeParam TUserData - The type of the user-specified data passed to\n *   `setData()` and made available in the arguments of the dynamic attribute\n *   callbacks.\n */\nexport type MarkerOptions<TUserData> = {\n  map?: google.maps.Map | null;\n} & Partial<Attributes<TUserData>>;\n\n/**\n * The MarkerState contains additional state-information about the marker\n * itself.\n */\nexport type MarkerState = {\n  hovered: boolean;\n  content: HTMLElement;\n};\n\n/**\n * The names of events that will be forwarded to the Google Maps implementation\n * instead of using standard dom-events.\n */\nenum MarkerEvents {\n  click = 'click',\n  dragstart = 'dragstart',\n  drag = 'drag',\n  dragend = 'dragend'\n}\n\n/**\n * Maps the supported Google Maps events to the type of event-object the\n * callbacks will receive.\n */\ninterface GoogleMapsAMVEventMap {\n  click: google.maps.MapMouseEvent;\n  dragstart: google.maps.MapMouseEvent;\n  drag: google.maps.MapMouseEvent;\n  dragend: google.maps.MapMouseEvent;\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport {Marker, MarkerOptions} from './marker';\nimport {warnOnce} from './util';\nimport type {Attributes} from './marker-attributes';\n\n/**\n * Markers in a collection can have additional (virtual) attributes that are\n * defined here.\n */\nexport type CollectionMarkerAttributes<TUserData> = Attributes<TUserData> & {\n  /**\n   * The key function used to create string ids for the records in the\n   * collection. Specifying this function is highly recommended when the data\n   * needs to be updated.\n   */\n  key: (data: TUserData) => string;\n};\n\nexport type MarkerCollectionOptions<T> = {\n  map?: google.maps.Map | null;\n} & Partial<CollectionMarkerAttributes<T>>;\n\n/**\n * The MarkerCollection provides bindings between an array of arbitrary records\n * and the corresponding markers.\n *\n * - Attributes: attributes are shared with all markers, for the\n *   position-attribute this has to be a dynamic attribute, all other attributes\n *   could be either static or dynamic attributes.\n * - Data-updates: data in the collection can be updated after creation. This will\n *   assume that complete sets of records are passed on every update. If\n *   incremental updates are needed, those have to be applied to the data before\n *   updating the marker collection. When transitions are implemented (also for\n *   performance reasons), it will become important to recognize identical\n *   records, so those can be updated instead of re-created with every update.\n *\n * @example\n *   const myData = [{position: [10, 53.5]}, {position: [-110, 23]}];\n *\n *   const markers = new MarkerCollection(myData, {\n *     position: ({data}) => data.position\n *   });\n *\n *   markers.map = map;\n */\n\nexport class MarkerCollection<TUserData extends object = object> {\n  /** The map instance the markers are added to. */\n  private map_: google.maps.Map | null = null;\n  /** The markers, stored by their keys */\n  private markers_: Map<string, Marker<TUserData>> = new Map();\n  /** The shared marker-attributes. */\n  private markerAttributes_: Partial<Attributes<TUserData>> = {};\n  /**\n   * When a key-function is missing, unique keys are automatically generated. In\n   * case the same objects are passed into setData() again, the generated keys\n   * can be looked up in this map.\n   */\n  private generatedKeyCache_ = new WeakMap<TUserData, string>();\n\n  /**\n   * The key function used to create string ids for the records in the\n   * collection. Specifying this function is highly recommended when the data\n   * needs to be updated.\n   */\n  key?: (data: TUserData) => string;\n\n  /**\n   * Creates a new MarkerCollection without specifying the data yet. This could\n   * be useful since fetching the data typically happens at a different time\n   * Providing data when creating the marker-collection is optional.\n   *\n   * @param options\n   */\n  constructor(options: MarkerCollectionOptions<TUserData>);\n\n  /**\n   * Creates a new MarkerCollection with existing data.\n   *\n   * @param data\n   * @param options\n   */\n  constructor(data: TUserData[], options: MarkerCollectionOptions<TUserData>);\n\n  constructor(\n    dataOrOptions: TUserData[] | MarkerCollectionOptions<TUserData>,\n    optOptions?: MarkerCollectionOptions<TUserData>\n  ) {\n    let data: TUserData[] = [];\n    let options: MarkerCollectionOptions<TUserData>;\n\n    if (arguments.length === 1) {\n      options = dataOrOptions as MarkerCollectionOptions<TUserData>;\n    } else {\n      data = dataOrOptions as TUserData[];\n      options = optOptions as NonNullable<typeof optOptions>;\n    }\n\n    const {map, key, ...attributes} = options;\n\n    this.key = key;\n    this.markerAttributes_ = attributes;\n    this.setData(data);\n\n    if (map) {\n      this.map = map;\n    }\n  }\n\n  /** Returns the Google Map instance this collection was added to. */\n  get map(): google.maps.Map | null {\n    return this.map_;\n  }\n\n  /**\n   * Adds this collection to the specified map instance. This will add all\n   * markers to the map.\n   */\n  set map(map: google.maps.Map | null) {\n    if (map === this.map) return;\n\n    this.map_ = map;\n    for (const marker of this.markers_.values()) {\n      marker.map = map;\n    }\n  }\n\n  /**\n   * Sets or updates the data for this collection. When updating data, the\n   * implementation will use the key-function provided with the Options to\n   * detrmine which records were added, removed or changed and update the\n   * underlying marker instances accordingly.\n   *\n   * @param data\n   */\n  setData(data: TUserData[]) {\n    const keyedData = new Map(data.map(r => [this.generateKey(r), r]));\n    const currentKeys = new Set(this.markers_.keys());\n    const newKeys = new Set(keyedData.keys());\n\n    const toRemove = [...currentKeys].filter(k => !newKeys.has(k));\n    const toAdd = [...newKeys].filter(k => !currentKeys.has(k));\n    const toUpdate = [...newKeys].filter(k => currentKeys.has(k));\n\n    for (const key of toRemove) {\n      const m = this.markers_.get(key) as Marker;\n      m.map = null;\n\n      this.markers_.delete(key);\n    }\n\n    const options = {\n      map: this.map,\n      ...this.markerAttributes_\n    };\n\n    for (const key of toAdd) {\n      const marker = this.createMarker(\n        options,\n        keyedData.get(key) as TUserData\n      );\n      this.markers_.set(key, marker);\n    }\n\n    if (toUpdate.length > 0 && !this.key) {\n      warnOnce(\n        `MarkerCollection: updating markers without a key can ` +\n          `cause performance issues. Add an attribute named 'key' to the ` +\n          `marker-collection to make records identifyable.`\n      );\n    }\n\n    for (const key of toUpdate) {\n      const marker = this.markers_.get(key) as Marker;\n      const data = keyedData.get(key) as TUserData;\n\n      marker.setData(data);\n    }\n  }\n\n  /**\n   * Sets the attributes for all markers.\n   *\n   * @param attributes\n   */\n  setAttributes(attributes: Partial<Attributes<TUserData>>) {\n    this.markerAttributes_ = attributes;\n\n    for (const marker of this.markers_.values()) {\n      marker.setAttributes(attributes);\n    }\n  }\n\n  /**\n   * Generates a key for the passed user-data record. This implementation calls\n   * the key-function if specified or generates a random key and stores it.\n   *\n   * @param record\n   */\n  protected generateKey(record: TUserData): string {\n    if (!this.key) {\n      // if we don't have a key-function, we use a WeakMap to store\n      // generated keys and issue a warning when updating.\n      let key = this.generatedKeyCache_.get(record);\n      if (!key) {\n        key = Math.random().toString(36).slice(2);\n        this.generatedKeyCache_.set(record, key);\n      }\n      return key;\n    }\n\n    return this.key(record);\n  }\n\n  /**\n   * Creates a new Marker with the specified options and data.\n   *\n   * @param options\n   * @param data\n   */\n  protected createMarker(\n    options: MarkerOptions<TUserData>,\n    data: TUserData\n  ): Marker<TUserData> {\n    return new Marker(options, data);\n  }\n}\n","/**\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport {Marker, MarkerCollection, MarkerOptions} from '@googlemaps/marker';\n\nexport type PlaceMarkerOptions = {\n  place?: google.maps.places.PlaceResult;\n} & MarkerOptions<google.maps.places.PlaceResult>;\n\n/**\n * A special marker class for data from the Google Maps Places API. Uses the\n * recommended colors and icons from a place result.\n */\nexport class PlaceMarker extends Marker<google.maps.places.PlaceResult> {\n  private place_: google.maps.places.PlaceResult | null = null;\n\n  constructor(\n    options: PlaceMarkerOptions,\n    data?: google.maps.places.PlaceResult\n  ) {\n    if (options.place) {\n      data = options.place;\n    }\n\n    super(options, data);\n\n    this.attributeDefaults_ = {\n      position: ({data}) => data?.geometry?.location?.toJSON(),\n      color: ({data}) => data?.icon_background_color as string,\n      glyphColor: () => '#ffff',\n      glyph: ({data}) =>\n        data?.icon_mask_base_uri && new URL(`${data?.icon_mask_base_uri}.svg`)\n    };\n  }\n\n  get place(): google.maps.places.PlaceResult | null {\n    return this.place_;\n  }\n\n  set place(place: google.maps.places.PlaceResult | null) {\n    this.place_ = place;\n    if (place) {\n      this.setData(place);\n    }\n  }\n}\n\n/**\n * An extended MarkerCollection that can directly be used with results from the\n * PlacesService.\n *\n * @example\n *   const markers = new PlaceMarkerCollection({map});\n *   const placesService = new google.maps.places.PlacesService(map);\n *\n *   const searchQuery = {keyword: 'coffee', radius: 2000};\n *\n *   placesService.nearbySearch(searchQuery, (result, status) => {\n *     if (status !== 'OK' || !result) return;\n *\n *     markers.setData(result);\n *   });\n */\nexport class PlaceMarkerCollection extends MarkerCollection<google.maps.places.PlaceResult> {\n  protected createMarker(\n    options: MarkerOptions<google.maps.places.PlaceResult>,\n    data: google.maps.places.PlaceResult\n  ): Marker<google.maps.places.PlaceResult> {\n    return new PlaceMarker(options, data);\n  }\n}\n"],"names":["helperDiv","warnings","Set","warnOnce","message","_console","has","add","console","warn","apply","concat","slice","call","arguments","assertNotNull","value","Error","colorCache","rxHexColor","rxRgbColor","parseRgbColor","color","_color$match","match","_color$match$","a","map","s","endsWith","Number","err","rgbaToString","rgb","length","join","channelLuminance","x","Math","pow","labBrightnessAdjust","rgbIn","amount","_ref","r","g","b","y","l","_rgbIn$","alpha","lab","xyz_lab","rgb_xyz","LAB_CONSTANTS","Xn","Yn","Zn","Kn","rgbOut","_ref2","z","isNaN","lab_xyz","xyz_rgb","lab2rgb","t0","t1","t2","t3","t","MapStateObserver","_this","map_","this","mapState_","listeners_","addListener","handleBoundsChange","getInstance","instances_","set","get","_proto","prototype","callback","_this2","push","remove","splice","indexOf","getMapState","center","getCenter","bounds","getBounds","zoom","getZoom","heading","getHeading","tilt","getTilt","_iterator","_step","_createForOfIteratorHelperLoose","done","listener","debug","Map","_class","positionFormats","isValid","google","maps","LatLng","fromLatLng","toLatLng","Array","isArray","p","lng","lat","toJSON","attributeKeys","ComputedMarkerAttributes","marker","marker_","callbackDepth_","getComputedAttributeValue","key","_this$marker_$getDyna","getDynamicAttributeState","res","data","attr","Object","defineProperty","userValue","fmt","getPositionFormat","_loop","CollisionBehavior","MarkerEvents","Marker","options","mapObserver_","mapEventListeners_","data_","markerState_","hovered","content","document","createElement","attributes_","attributeDefaults_","computedAttributes_","markerView_","pinView_","updateScheduled_","attributes","_objectWithoutPropertiesLoose","_excluded","window","error","assertMapsApiLoaded","PinElement","AdvancedMarkerElement","element","setAttributes","update","registerIconProvider","provider","namespace","iconProviders","eventName","handler","addEventListener","removeEventListener","setData","assign","queueMicrotask","performUpdate","attrs","position","gmpDraggable","draggable","title","zIndex","collisionBehavior","scale","updateContent_","classList","className","updateColors_","updateGlyph_","el","_attrs$color","_attrs$backgroundColo","backgroundColor","_attrs$glyphColor","glyphColor","_attrs$borderColor","borderColor","_attrs$scale","style","setProperty","toString","_rgb$map","rgba","test","repeat","parseHexColor","cssText","body","appendChild","getComputedStyle","parseCssColorValue","rgbaDark","rgbaLight","brighten","n","background","icon","iconId","includes","_attrs$icon$split","split","glyph","undefined","bindEvents_","unbindEvents_","_createClass","_step2","_iterator2","MarkerCollection","dataOrOptions","optOptions","markers_","markerAttributes_","generatedKeyCache_","WeakMap","keyedData","generateKey","currentKeys","keys","newKeys","toRemove","filter","k","toAdd","toUpdate","_extends","createMarker","_step3","_iterator3","_iterator4","_step4","values","record","random","_step5","_iterator5","PlaceMarker","_Marker","place","place_","_data$geometry","geometry","location","icon_background_color","_ref3","icon_mask_base_uri","URL","_inheritsLoose","PlaceMarkerCollection","_MarkerCollection"],"mappings":"u5DAgBA,ICMIA,EDNEC,EAAW,IAAIC,IASL,SAAAC,EAASC,GAIaC,IAAAA,EAHhCJ,EAASK,IAAIF,KAEjBH,EAASM,IAAIH,GACU,oBAAZI,UACTH,EAAAG,SAAQC,KAAIC,MAAAL,EAAA,CAACD,GAAOO,UAAAC,MAAAC,KAAAC,UAAW,KAEnC,UAiCgBC,EACdC,EACAZ,GAEA,QAFAA,IAAAA,IAAAA,EAAkB,oBAEdY,QACF,MAAMC,MAAMb,EAEhB,CCjDA,IAAMc,EAAwC,CAAE,EAE1CC,EAAa,2CAGbC,EACJ,qFAwEF,SAASC,EAAcC,GACrB,IACE,IAAAC,EAA6BD,EAAME,MAAMJ,GAAzBK,EAAAF,EAAEG,GAGlB,MAFa,CADHH,EAAA,GAAGA,EAAA,GAAGA,EAAAE,QAAG,IAAAA,EAAG,IAAGA,GAGbE,IAAI,SAAAC,GACd,OAAAA,EAAEC,SAAS,KAAgC,KAAzBC,OAAOF,EAAEhB,MAAM,GAAI,IAAakB,OAAOF,EAAE,EAE/D,CAAE,MAAOG,GAGP,OAFA5B,EAAQ,6CAA8CmB,EAAS,MAExD,CAAC,EAAG,EAAG,EAAG,EACnB,CACF,CAOM,SAAUU,EAAaC,GAC3B,OAAuB,IAAfA,EAAIC,OAA6B,OAAA,OAAA,IAAQD,EAAIE,KAAK,KAAI,GAChE,CAgBA,IAAMC,EAAmB,SAACC,GAAS,OACjCA,GAAK,OAAUA,EAAI,MA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