{"version":3,"file":"index.cjs","sources":["../src/util.ts","../src/color.ts","../src/map-state-observer.ts","../src/position-formats.ts","../src/marker-attributes.ts","../src/computed-marker-attributes.ts","../src/marker.ts","../src/marker-collection.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 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 {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 {\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"],"names":["helperDiv","warnings","Set","warnOnce","message","_console","has","add","console","warn","apply","concat","slice","call","arguments","assertNotNull","value","Error","colorCache","rxHexColor","rxRgbColor","parseCssColorValue","color","test","length","Number","repeat","parseHexColor","parseRgbColor","document","createElement","style","cssText","body","appendChild","rgb","getComputedStyle","remove","_color$match","match","_color$match$","a","map","s","endsWith","err","rgbaToString","join","luminance","_rgb$map","n","g","b","channelLuminance","x","Math","pow","darken","rgbIn","amount","labBrightnessAdjust","brighten","_ref","r","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","splice","indexOf","getMapState","center","getCenter","bounds","getBounds","zoom","getZoom","heading","getHeading","tilt","getTilt","_iterator","_step","_createForOfIteratorHelperLoose","done","listener","debug","Map","positionFormats","isValid","google","maps","LatLng","fromLatLng","toLatLng","Array","isArray","p","lng","lat","toJSON","getPositionFormat","fmt","_class","attributeKeys","ComputedMarkerAttributes","marker","marker_","callbackDepth_","getComputedAttributeValue","key","_this$marker_$getDyna","getDynamicAttributeState","res","data","attr","Object","defineProperty","userValue","_loop","CollisionBehavior","MarkerEvents","Marker","options","mapObserver_","mapEventListeners_","data_","markerState_","hovered","content","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","setProperty","toString","rgba","rgbaDark","rgbaLight","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"],"mappings":"ssDAgBA,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,qFAcI,SAAUC,EAAmBC,GAEjC,GAAIH,EAAWI,KAAKD,GAClB,OA8BJ,SAAuBA,GACrB,OAAIA,EAAME,OAAS,EAEV,CACLC,OAAO,KAAOH,EAAM,GAAGI,OAAO,IAC9BD,OAAO,KAAOH,EAAM,GAAGI,OAAO,IAC9BD,OAAO,KAAOH,EAAM,GAAGI,OAAO,IACb,IAAjBJ,EAAME,OAAe,EAAIC,OAAO,KAAOH,EAAM,GAAGI,OAAO,KAKpD,CACLD,OAAO,KAAOH,EAAMV,MAAM,EAAG,IAC7Ba,OAAO,KAAOH,EAAMV,MAAM,EAAG,IAC7Ba,OAAO,KAAOH,EAAMV,MAAM,EAAG,IACZ,IAAjBU,EAAME,OAAe,EAAIC,OAAO,KAAOH,EAAMV,MAAM,EAAG,IAE1D,CAhDWe,CAAcL,GACZF,GAAAA,EAAWG,KAAKD,GACzB,OAAOM,EAAcN,GAGvB,GAAIJ,EAAWI,GACb,OAAOJ,EAAWI,GAAOV,MAAM,GAG5BZ,KACHA,EAAY6B,SAASC,cAAc,QACzBC,MAAMC,QAKlB,qGACAhC,EAAU+B,MAAMT,MAAQA,EACxBO,SAASI,KAAKC,YAAYlC,GAC1B,IAAMmC,EAAMC,iBAAiBpC,GAAWsB,MAG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