@theseam/ui-common 2.0.1-beta.114 → 2.0.1-beta.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-google-maps.mjs","sources":["../../../projects/ui-common/google-maps/map-controls-service.ts","../../../projects/ui-common/google-maps/google-maps-feature-helpers.ts","../../../projects/ui-common/google-maps/feature-groups/feature-group-registry.ts","../../../projects/ui-common/google-maps/feature-style/compute-feature-style.ts","../../../projects/ui-common/google-maps/google-maps-contextmenu.ts","../../../projects/ui-common/google-maps/interaction/grouped-interaction-model.ts","../../../projects/ui-common/google-maps/interaction/legacy-interaction-model.ts","../../../projects/ui-common/google-maps/labels/label-visibility.ts","../../../projects/ui-common/google-maps/labels/map-feature-labels-overlay.ts","../../../projects/ui-common/google-maps/map-value-manager.service.ts","../../../projects/ui-common/google-maps/google-maps.service.ts","../../../projects/ui-common/google-maps/google-maps-controls.service.ts","../../../projects/ui-common/google-maps/google-maps-draw-button-control/google-maps-draw-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-draw-button-control/google-maps-draw-button-control.component.html","../../../projects/ui-common/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.html","../../../projects/ui-common/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.html","../../../projects/ui-common/google-maps/google-maps-api-loader/google-maps-api-loader.ts","../../../projects/ui-common/google-maps/map-file-drop/map-file-drop.component.ts","../../../projects/ui-common/google-maps/map-file-drop/map-file-drop.component.html","../../../projects/ui-common/google-maps/map-control.component.ts","../../../projects/ui-common/google-maps/google-maps/google-maps.component.ts","../../../projects/ui-common/google-maps/google-maps/google-maps.component.html","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.ts","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.ts","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.html","../../../projects/ui-common/google-maps/google-maps.module.ts","../../../projects/ui-common/google-maps/google-maps-api-loader/lazy-google-maps-api-loader.ts","../../../projects/ui-common/google-maps/google-maps-api-loader/noop-google-maps-api-loader.ts","../../../projects/ui-common/google-maps/theseam-ui-common-google-maps.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\n\nimport { ComponentType } from '@theseam/ui-common/models'\n\nexport interface MapControl<TData = any> {\n component: ComponentType<any>\n data?: TData\n position?: google.maps.ControlPosition\n}\n\nexport interface MapControlsService {\n add(control: MapControl): void\n}\n\nexport const MAP_CONTROLS_SERVICE = new InjectionToken<MapControlsService>(\n 'MAP_CONTROLS_SERVICE',\n)\n\nexport const MAP_CONTROL_DATA = new InjectionToken<any>('MAP_CONTROL_DATA')\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { NgZone } from '@angular/core'\nimport { Feature, MultiPolygon, Polygon } from 'geojson'\nimport { Observable } from 'rxjs'\n\nimport {\n addHoleToPolygon,\n closePolygons,\n notNullOrUndefined,\n polygonContains,\n} from '@theseam/ui-common/utils'\n\nexport enum AppFeaturePropertyName {\n IsSelected = `__app__isSelected`,\n GroupKey = `__app__groupKey`,\n}\n\nexport function isAppFeatureProperty(\n propertyName: string,\n): propertyName is AppFeaturePropertyName {\n return (\n Object.values(AppFeaturePropertyName).findIndex(\n (value) => value === propertyName,\n ) !== -1\n )\n}\n\nexport function isFeatureSelected(feature: google.maps.Data.Feature): boolean {\n const isSelected = feature.getProperty(AppFeaturePropertyName.IsSelected)\n return coerceBooleanProperty(isSelected)\n}\n\nexport function setFeatureSelected(\n feature: google.maps.Data.Feature,\n isSelected: boolean,\n): void {\n feature.setProperty(AppFeaturePropertyName.IsSelected, isSelected)\n}\n\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_PROPERTY_NAME = 'styleOptions'\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_HOVERED_PROPERTY_NAME =\n 'styleOptionsHovered'\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_SELECTED_PROPERTY_NAME =\n 'styleOptionsSelected'\n\nexport function getStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\nexport function getHoveredStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_HOVERED_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\nexport function getSelectedStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_SELECTED_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\n// TODO: Check performance of cloning a google.maps.Data instance, so the\n// properties can be removed with the google maps api, instead of on the\n// resulting json.\nexport function stripAppFeaturePropertiesFromJson(json: any) {\n if (notNullOrUndefined(json) && Array.isArray(json?.features)) {\n for (const feature of json.features) {\n if (notNullOrUndefined(feature?.properties)) {\n for (const k of Object.keys(feature.properties)) {\n if (isAppFeatureProperty(k)) {\n feature.properties[k] = undefined\n delete feature.properties[k]\n }\n }\n }\n }\n }\n}\n\nexport function polygonHasValidPathsLengths(\n polygon: google.maps.Polygon,\n minPointsInValidPath: number = 3,\n): boolean {\n const paths = polygon.getPaths().getArray()\n for (const path of paths) {\n if (path.getLength() < minPointsInValidPath) {\n return false\n }\n }\n return true\n}\n\nexport function polygonCoordinates(\n polygon: google.maps.Data.Polygon,\n): number[][][] {\n const polygonGeoJson: Polygon = {\n type: 'Polygon',\n coordinates: polygon\n .getArray()\n .map((linRing) => linRing.getArray().map((x) => [x.lng(), x.lat()])),\n }\n closePolygons(polygonGeoJson)\n return polygonGeoJson.coordinates\n}\n\n/** Build a google.maps.Data.Polygon from a GeoJSON Polygon (lng/lat order). */\nexport function dataPolygonFromGeoJson(\n polygon: Polygon,\n): google.maps.Data.Polygon {\n const rings = polygon.coordinates.map((ring) =>\n // GeoJSON rings are explicitly closed (first coordinate repeated at the\n // end), but google.maps.Data.Polygon paths are implicitly closed and must\n // NOT include the repeated point — otherwise it becomes a duplicate vertex\n // coincident with the first (two points that edit independently, and a\n // double closing point when serialized back to GeoJSON).\n openRing(ring).map(\n ([lng, lat]) => ({ lat, lng }) as google.maps.LatLngLiteral,\n ),\n )\n return new google.maps.Data.Polygon(rings)\n}\n\n/** Drop a ring's explicit closing point (a trailing copy of the first). */\nfunction openRing(ring: number[][]): number[][] {\n if (ring.length < 2) {\n return ring\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n return first[0] === last[0] && first[1] === last[1] ? ring.slice(0, -1) : ring\n}\n\n/**\n * Read an existing feature's Polygon geometry as a closed GeoJSON Polygon.\n * Returns undefined for non-Polygon geometries. Does not mutate the feature.\n */\nexport function geoJsonPolygonFromDataFeature(\n feature: google.maps.Data.Feature,\n): Polygon | undefined {\n const geometry = feature.getGeometry()\n if (geometry === null || geometry.getType() !== 'Polygon') {\n return undefined\n }\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(geometry as google.maps.Data.Polygon),\n }\n closePolygons(polygon)\n return polygon\n}\n\n/** Build a google.maps.Data.MultiPolygon from a GeoJSON MultiPolygon. */\nexport function dataMultiPolygonFromGeoJson(\n multiPolygon: MultiPolygon,\n): google.maps.Data.MultiPolygon {\n return new google.maps.Data.MultiPolygon(\n multiPolygon.coordinates.map((rings) =>\n dataPolygonFromGeoJson({ type: 'Polygon', coordinates: rings }),\n ),\n )\n}\n\n/**\n * Every Polygon part of a feature, as closed GeoJSON. A Polygon feature yields\n * one; a MultiPolygon yields one per part; anything else yields none.\n *\n * Callers that need to match a drawn shape against existing geometry must use\n * this rather than `geoJsonPolygonFromDataFeature`, which sees only Polygons\n * and silently ignores MultiPolygon features.\n */\nexport function polygonsFromDataFeature(\n feature: google.maps.Data.Feature,\n): Polygon[] {\n const geometry = feature.getGeometry()\n if (geometry === null) {\n return []\n }\n if (geometry.getType() === 'Polygon') {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(geometry as google.maps.Data.Polygon),\n }\n closePolygons(polygon)\n return [polygon]\n }\n if (geometry.getType() === 'MultiPolygon') {\n return (geometry as google.maps.Data.MultiPolygon)\n .getArray()\n .map((part) => {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(part),\n }\n closePolygons(polygon)\n return polygon\n })\n }\n return []\n}\n\n/**\n * Cut `hole` into whichever part of `feature`'s geometry fully contains it.\n *\n * Mutates the EXISTING feature (via `setGeometry`) rather than replacing it,\n * so its identity and properties survive. A single-part Polygon feature stays\n * a Polygon; a MultiPolygon feature stays a MultiPolygon with only the\n * containing part modified. Returns whether a containing part was found —\n * when none is, the feature is left untouched.\n */\nexport function applyHoleToFeature(\n feature: google.maps.Data.Feature,\n hole: Polygon,\n): boolean {\n const parts = polygonsFromDataFeature(feature)\n const containingIndex = parts.findIndex((part) => polygonContains(part, hole))\n if (containingIndex === -1) {\n return false\n }\n\n parts[containingIndex] = addHoleToPolygon(parts[containingIndex], hole)\n feature.setGeometry(\n parts.length === 1\n ? dataPolygonFromGeoJson(parts[0])\n : dataMultiPolygonFromGeoJson({\n type: 'MultiPolygon',\n coordinates: parts.map((p) => p.coordinates),\n }),\n )\n return true\n}\n\n/**\n * Read a feature as a GeoJSON Feature, geometry and properties together.\n *\n * `excludeProperty` filters properties out by name — used to keep internal\n * `__app__` bookkeeping out of anything handed to a consumer.\n */\nexport function geoJsonFeatureFromDataFeature(\n feature: google.maps.Data.Feature,\n excludeProperty?: (name: string) => boolean,\n): Feature<Polygon | MultiPolygon> | undefined {\n const parts = polygonsFromDataFeature(feature)\n if (parts.length === 0) {\n return undefined\n }\n\n const geometry: Polygon | MultiPolygon =\n feature.getGeometry()?.getType() === 'MultiPolygon'\n ? { type: 'MultiPolygon', coordinates: parts.map((p) => p.coordinates) }\n : parts[0]\n\n const properties: Record<string, any> = {}\n feature.forEachProperty((value, name) => {\n if (!excludeProperty?.(name)) {\n properties[name] = value\n }\n })\n\n const id = feature.getId()\n return {\n type: 'Feature',\n ...(id === undefined ? {} : { id }),\n geometry,\n properties,\n }\n}\n\nexport function getBoundsWithAllFeatures(\n data: google.maps.Data,\n): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds()\n\n data.forEach((feature) => {\n const geometry = feature.getGeometry()\n if (geometry === null) {\n throw Error(`Geometry not found.`)\n }\n geometry.forEachLatLng((latLng) => {\n bounds.extend(latLng)\n })\n })\n\n return bounds\n}\n\nexport function getFeatureBounds(\n feature: google.maps.Data.Feature,\n): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds()\n\n const geometry = feature.getGeometry()\n if (geometry === null) {\n throw Error(`Geometry not found.`)\n }\n geometry.forEachLatLng((latLng) => {\n bounds.extend(latLng)\n })\n\n return bounds\n}\n\nexport function getFeatureCenter(\n feature: google.maps.Data.Feature,\n): google.maps.LatLng {\n return getFeatureBounds(feature).getCenter()\n}\n\nexport function removeAllFeatures(data: google.maps.Data): void {\n data.forEach((f) => data.remove(f))\n}\n\nexport function getFeaturesCount(data: google.maps.Data): number {\n let count = 0\n data.forEach(() => count++)\n return count\n}\n\n/**\n * NOTE: Original events are not emitted, because filtering may omit events.\n */\nexport function createFeatureChangeObservable(\n data: google.maps.Data,\n ngZone: NgZone,\n): Observable<void> {\n return new Observable<void>((subscriber) => {\n const listeners: google.maps.MapsEventListener[] = []\n\n ngZone.runOutsideAngular(() => {\n listeners.push(\n data.addListener(\n 'setgeometry',\n (event: google.maps.Data.SetGeometryEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'addfeature',\n (event: google.maps.Data.AddFeatureEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'removefeature',\n (event: google.maps.Data.RemoveFeatureEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'setproperty',\n (event: google.maps.Data.SetPropertyEvent) => {\n if (!isAppFeatureProperty(event.name)) {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n }\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'removeproperty',\n (event: google.maps.Data.RemovePropertyEvent) => {\n if (!isAppFeatureProperty(event.name)) {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n }\n },\n ),\n )\n })\n\n return () => {\n listeners.forEach(google.maps.event.removeListener)\n }\n })\n}\n","import {\n AppFeaturePropertyName,\n geoJsonFeatureFromDataFeature,\n isAppFeatureProperty,\n} from '../google-maps-feature-helpers'\nimport { TheSeamMapFeatureGroup } from './feature-group'\n\ndeclare const ngDevMode: boolean | undefined\n\nexport interface FeatureGroupRegistryOptions {\n /**\n * Name of the GeoJSON property that groups features. When unset, every\n * feature is its own group.\n */\n groupProperty?: string | null\n /** Generates the key written for a newly created group. */\n newGroupKeyFactory?: () => string\n}\n\nconst isDevMode = () => typeof ngDevMode === 'undefined' || !!ngDevMode\n\n/**\n * Resolves which group each feature on the data layer belongs to, and assigns\n * keys to features the map itself creates.\n *\n * Keys resolve from `properties[groupProperty]` when present, and otherwise\n * from an internal `__app__groupKey`, which is stripped from serialized output\n * and does not trigger value changes.\n */\nexport class FeatureGroupRegistry {\n private _assignedSeq = 0\n private _warnedAboutMissingGroupValues = false\n private _warnedAboutUnsupportedGeometry = false\n\n constructor(\n private readonly _data: google.maps.Data,\n private _options: FeatureGroupRegistryOptions = {},\n ) {}\n\n setOptions(options: FeatureGroupRegistryOptions): void {\n this._options = options\n }\n\n /**\n * The group key for a feature, assigning an internal one if it has neither a\n * group property value nor a previously assigned key.\n *\n * Assigning here mutates the feature, but only via an `__app__` property,\n * which neither serializes nor raises a value change.\n */\n keyOf(feature: google.maps.Data.Feature): string {\n const declared = this._declaredKey(feature)\n if (declared !== undefined) {\n return declared\n }\n\n const assigned = feature.getProperty(AppFeaturePropertyName.GroupKey)\n if (typeof assigned === 'string' && assigned.length > 0) {\n return assigned\n }\n\n this._warnAboutMissingGroupValue()\n const key = `__assigned__${this._assignedSeq++}`\n feature.setProperty(AppFeaturePropertyName.GroupKey, key)\n return key\n }\n\n /** Every feature on the data layer belonging to `key`. */\n featuresIn(key: string): google.maps.Data.Feature[] {\n const features: google.maps.Data.Feature[] = []\n this._data.forEach((feature) => {\n if (this.keyOf(feature) === key) {\n features.push(feature)\n }\n })\n return features\n }\n\n /** The group a feature belongs to, as emittable GeoJSON. */\n groupOf(\n feature: google.maps.Data.Feature,\n ): TheSeamMapFeatureGroup | undefined {\n return this.group(this.keyOf(feature))\n }\n\n /** The group for a key, or undefined when no feature carries it. */\n group(key: string): TheSeamMapFeatureGroup | undefined {\n return this.groupWithSources(key)?.group\n }\n\n /**\n * A group alongside the `Data.Feature` each emitted GeoJSON feature came\n * from, index-aligned.\n *\n * Callers that need to map a `Data.Feature` back to its emitted counterpart\n * must use this rather than indexing `group.features` against\n * `featuresIn(key)` — a feature with unsupported geometry is dropped from\n * the emitted list, which would shift every index after it.\n */\n groupWithSources(\n key: string,\n ):\n | { group: TheSeamMapFeatureGroup; sources: google.maps.Data.Feature[] }\n | undefined {\n const candidates = this.featuresIn(key)\n if (candidates.length === 0) {\n return undefined\n }\n\n const sources: google.maps.Data.Feature[] = []\n const features: TheSeamMapFeatureGroup['features'] = []\n for (const candidate of candidates) {\n const geoJson = geoJsonFeatureFromDataFeature(\n candidate,\n isAppFeatureProperty,\n )\n if (geoJson === undefined) {\n this._warnAboutUnsupportedGeometry()\n continue\n }\n sources.push(candidate)\n features.push(geoJson)\n }\n\n return { group: { key, features }, sources }\n }\n\n /** Every group currently on the data layer. */\n groups(): TheSeamMapFeatureGroup[] {\n const keys = new Set<string>()\n this._data.forEach((feature) => keys.add(this.keyOf(feature)))\n return [...keys]\n .map((key) => this.group(key))\n .filter((g): g is TheSeamMapFeatureGroup => g !== undefined)\n }\n\n /**\n * Start a new group on a feature the map created, writing a real group\n * property when one is configured so the grouping survives serialization.\n */\n assignNewKey(feature: google.maps.Data.Feature): string {\n const key = this._options.newGroupKeyFactory?.() ?? defaultGroupKey()\n if (isDevMode() && this.featuresIn(key).length > 0) {\n console.warn(\n `[seam-google-maps] newGroupKeyFactory produced the key \"${key}\", ` +\n `which is already in use. The drawn feature joins that group. ` +\n `The factory is responsible for producing unique keys.`,\n )\n }\n this.assignKey(feature, key)\n return key\n }\n\n /** Put a feature into an existing group. */\n assignKey(feature: google.maps.Data.Feature, key: string): void {\n const groupProperty = this._options.groupProperty\n if (groupProperty) {\n feature.setProperty(groupProperty, key)\n feature.removeProperty(AppFeaturePropertyName.GroupKey)\n return\n }\n feature.setProperty(AppFeaturePropertyName.GroupKey, key)\n }\n\n private _declaredKey(feature: google.maps.Data.Feature): string | undefined {\n const groupProperty = this._options.groupProperty\n if (!groupProperty) {\n return undefined\n }\n const value = feature.getProperty(groupProperty)\n if (value === null || value === undefined || value === '') {\n return undefined\n }\n return String(value)\n }\n\n private _warnAboutUnsupportedGeometry(): void {\n if (!isDevMode() || this._warnedAboutUnsupportedGeometry) {\n return\n }\n this._warnedAboutUnsupportedGeometry = true\n console.warn(\n `[seam-google-maps] a feature's geometry is neither Polygon nor ` +\n `MultiPolygon. It still renders, but is excluded from groups, ` +\n `outputs, and labels.`,\n )\n }\n\n private _warnAboutMissingGroupValue(): void {\n if (\n !isDevMode() ||\n !this._options.groupProperty ||\n this._warnedAboutMissingGroupValues\n ) {\n return\n }\n this._warnedAboutMissingGroupValues = true\n console.warn(\n `[seam-google-maps] featureGroupProperty is ` +\n `\"${this._options.groupProperty}\", but at least one feature has no ` +\n `value for it. Each becomes its own group under a session-scoped key ` +\n `that is not serialized. Assign the property during import.`,\n )\n }\n}\n\nfunction defaultGroupKey(): string {\n return (\n globalThis.crypto?.randomUUID?.() ?? `group-${Date.now()}-${Math.random()}`\n )\n}\n","import {\n getHoveredStyleOptionsDefinedByFeature,\n getSelectedStyleOptionsDefinedByFeature,\n getStyleOptionsDefinedByFeature,\n isFeatureSelected,\n} from '../google-maps-feature-helpers'\n\nexport const FEATURE_STYLE_OPTIONS_DEFAULT =\n (): google.maps.Data.StyleOptions => ({\n clickable: true,\n visible: true,\n draggable: false,\n editable: false,\n fillColor: 'teal',\n fillOpacity: 0.3,\n strokeColor: 'blue',\n strokeOpacity: 1,\n strokeWeight: 2,\n })\n\nexport const FEATURE_STYLE_OPTIONS_SELECTED =\n (): google.maps.Data.StyleOptions => ({\n fillColor: 'green',\n fillOpacity: 0.7,\n strokeColor: 'limegreen',\n strokeOpacity: 1,\n strokeWeight: 2,\n })\n\nexport const FEATURE_STYLE_OVERRIDE_OPTIONS_HOVERED =\n (): google.maps.Data.StyleOptions => ({\n strokeColor: 'black',\n strokeOpacity: 1,\n strokeWeight: 4,\n })\n\n/**\n * Style options a feature may set through its GeoJSON properties.\n *\n * `editable`, `draggable`, and `clickable` are here so a feature can opt OUT —\n * a retired field stays unreshapeable while its neighbours do not. They cannot\n * opt in: the clamp in `computeFeatureStyle` runs last and only ever narrows.\n */\nexport const SUPPORTED_PROPERTY_STYLE_OPTIONS: (keyof google.maps.Data.StyleOptions)[] =\n [\n 'fillColor',\n 'fillOpacity',\n 'strokeColor',\n 'strokeOpacity',\n 'strokeWeight',\n 'label',\n 'opacity',\n 'icon',\n 'clickable',\n 'visible',\n 'editable',\n 'draggable',\n ]\n\n/** What the interaction model and the global gate permit for a feature. */\nexport interface TheSeamMapFeatureStyleContext {\n /** The `editingEnabled` input. */\n editingEnabled: boolean\n /** Whether the model currently arms geometry editing at all. */\n geometryEditingArmed: boolean\n /** Whether the model lets this feature receive clicks. */\n clicksAllowed: boolean\n}\n\n/** Merge only the supported subset of one options object into another. */\nexport function mergeStyleOptions(\n target: google.maps.Data.StyleOptions,\n source: google.maps.Data.StyleOptions | undefined,\n): google.maps.Data.StyleOptions {\n if (!source || Object.keys(source).length === 0) {\n return target\n }\n for (const option of SUPPORTED_PROPERTY_STYLE_OPTIONS) {\n if (Object.prototype.hasOwnProperty.call(source, option)) {\n target[option] = source[option] as any\n }\n }\n return target\n}\n\n/**\n * The style for a feature, in a fixed precedence order:\n *\n * defaults\n * -> properties.styleOptions\n * -> selected defaults (when selected)\n * -> properties.styleOptionsSelected (when selected)\n * -> interaction clamp (always last)\n *\n * That chain governs the *visual* options (colours, etc.) only. The opt-out\n * flags (`editable`/`draggable`/`clickable`) resolve separately, per key: a\n * selected feature consults `styleOptionsSelected` first and falls back to\n * `styleOptions` only for a key `styleOptionsSelected` doesn't itself\n * mention — never a whole-object fallback. Otherwise a feature that declares\n * `styleOptionsSelected` for an unrelated reason, such as a different\n * selected fill colour, would silently lose an unrelated `editable: false`\n * from `styleOptions` the moment it's selected.\n *\n * The clamp is one-directional. A feature can only narrow what the context\n * permits, never widen it, so no property in an uploaded file can arm editing\n * when the mode says no.\n *\n * A declared `editable: false` also implies `draggable: false`: moving a\n * polygon changes the map's value exactly as much as reshaping it does, so a\n * feature that opts out of one opts out of the other. This implication runs\n * only one way — `draggable: false` alone does not imply `editable: false`, so\n * a feature may still opt out of dragging while remaining reshapeable via its\n * vertex handles. Resolved through the same per-key `wants()` lookup as\n * `editable` itself, so a feature that locks `editable: false` in\n * `styleOptions` cannot be dragged even if `styleOptionsSelected` declares\n * `draggable` for an unrelated reason (or not at all).\n */\nexport function computeFeatureStyle(\n feature: google.maps.Data.Feature,\n context: TheSeamMapFeatureStyleContext,\n): google.maps.Data.StyleOptions {\n const selected = isFeatureSelected(feature)\n const baseDeclared = getStyleOptionsDefinedByFeature(feature)\n const selectedDeclared = selected\n ? getSelectedStyleOptionsDefinedByFeature(feature)\n : undefined\n\n const options = FEATURE_STYLE_OPTIONS_DEFAULT()\n mergeStyleOptions(options, getStyleOptionsDefinedByFeature(feature))\n\n if (selected) {\n mergeStyleOptions(options, FEATURE_STYLE_OPTIONS_SELECTED())\n mergeStyleOptions(options, getSelectedStyleOptionsDefinedByFeature(feature))\n }\n\n // Resolved per key, not per object. A feature that opts out in\n // `styleOptions` must stay opted out even when it also declares a\n // `styleOptionsSelected` for unrelated reasons such as colour — otherwise\n // the clamp stops being one-directional and a retired field becomes\n // editable the moment it is selected.\n const wants = (option: 'editable' | 'draggable' | 'clickable') =>\n (selectedDeclared?.[option] ?? baseDeclared?.[option]) !== false\n\n const editingArmed =\n context.editingEnabled && context.geometryEditingArmed && selected\n const wantsEditable = wants('editable')\n\n options.editable = wantsEditable && editingArmed\n // editable: false implies draggable: false (see the doc comment above) —\n // the reverse does not hold, so wants('draggable') is still consulted on\n // its own for a feature that opts out of dragging alone.\n options.draggable = wants('draggable') && wantsEditable && editingArmed\n options.clickable = wants('clickable') && context.clicksAllowed\n\n return options\n}\n\n/**\n * The hover override, merged with anything the feature declares for hover.\n *\n * `mergeStyleOptions` is shared with `computeFeatureStyle`, and\n * `SUPPORTED_PROPERTY_STYLE_OPTIONS` includes `editable`/`draggable` so a\n * feature can opt OUT of them via `styleOptions`/`styleOptionsSelected`. But\n * this override is applied via `overrideStyle`, with no clamp downstream at\n * all — unlike `computeFeatureStyle`, where the interaction clamp runs last\n * and narrows whatever came before it. So if a consumer's\n * `styleOptionsHovered` declared `editable` or `draggable`, it would apply\n * unclamped: the one path where the \"clamp is one-directional and always\n * runs last\" guarantee would not hold. A hover override has no business\n * touching either, so both are stripped unconditionally, regardless of what\n * `styleOptionsHovered` declares.\n */\nexport function computeFeatureHoverStyle(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions {\n const options = mergeStyleOptions(\n FEATURE_STYLE_OVERRIDE_OPTIONS_HOVERED(),\n getHoveredStyleOptionsDefinedByFeature(feature),\n )\n delete options.editable\n delete options.draggable\n return options\n}\n","import { ESCAPE } from '@angular/cdk/keycodes'\nimport { NgZone, ViewContainerRef } from '@angular/core'\nimport { fromEvent, Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\n\nimport { MenuComponent } from '@theseam/ui-common/menu'\n\nimport { isFeatureSelected } from './google-maps-feature-helpers'\n\n// TODO: Close on map losing focus.\n\nexport class GoogleMapsContextMenu {\n private readonly _overlayView: google.maps.OverlayView\n private readonly _cleanupFn: () => void\n\n constructor(\n private readonly _map: google.maps.Map,\n private readonly _menu: MenuComponent,\n _position: google.maps.LatLng,\n private readonly _vcr: ViewContainerRef,\n private readonly _ngZone: NgZone,\n private readonly _data: google.maps.Data,\n private readonly _feature: google.maps.Data.Feature,\n ) {\n const tplRef = this._menu.templateRef\n if (tplRef === undefined || tplRef === null) {\n throw Error(`Menu template is not defined.`)\n }\n\n const ref = this._vcr.createEmbeddedView(tplRef)\n ref.detectChanges()\n\n const listeners: google.maps.MapsEventListener[] = []\n const ngUnsubscribe = new Subject<void>()\n\n // TODO: Fix the initial focus. setTimeout avoids the wrong contextmenu\n // getting triggered, but the first item flashes and looks off this way.\n setTimeout(() => {\n this._menu.focusFirstItem('program')\n })\n this._menu.closed.pipe(takeUntil(ngUnsubscribe)).subscribe((v) => {\n this.close()\n })\n\n fromEvent(document, 'keydown')\n .pipe(takeUntil(ngUnsubscribe))\n .subscribe((event: any) => {\n if (event.keyCode === ESCAPE) {\n this.close()\n }\n })\n\n const __cleanup = () => this._cleanupFn()\n class GoogleMapsContextMenuOverlayView extends google.maps.OverlayView {\n public containerDiv: HTMLDivElement\n\n constructor(\n public position: google.maps.LatLng,\n content: HTMLElement,\n ) {\n super()\n this.position = position\n\n this.containerDiv = document.createElement('div')\n this.containerDiv.style.cursor = 'auto'\n this.containerDiv.style.height = '0'\n this.containerDiv.style.position = 'absolute'\n this.containerDiv.appendChild(content)\n\n // Optionally stop clicks, etc., from bubbling up to the map.\n GoogleMapsContextMenuOverlayView.preventMapHitsAndGesturesFrom(\n this.containerDiv,\n )\n }\n\n /** Called when the view is added to the map. */\n onAdd() {\n this.getPanes()?.floatPane.appendChild(this.containerDiv)\n }\n\n /** Called when the view is removed from the map. */\n onRemove() {\n if (this.containerDiv.parentElement) {\n this.containerDiv.parentElement.removeChild(this.containerDiv)\n }\n __cleanup()\n }\n\n /** Called each frame when the view needs to draw itself. */\n draw() {\n const divPosition = this.getProjection().fromLatLngToDivPixel(\n this.position,\n )\n if (!divPosition) {\n return\n }\n\n // Hide the popup when it is far out of view.\n const display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000\n ? 'block'\n : 'none'\n\n if (display === 'block') {\n this.containerDiv.style.left = `${divPosition.x}px`\n this.containerDiv.style.top = `${divPosition.y}px`\n }\n\n if (this.containerDiv.style.display !== display) {\n this.containerDiv.style.display = display\n }\n }\n }\n\n this._overlayView = new GoogleMapsContextMenuOverlayView(\n _position,\n ref.rootNodes[0],\n )\n this._overlayView.setMap(this._map)\n\n this._ngZone.runOutsideAngular(() => {\n listeners.push(\n this._data.addListener(\n 'removefeature',\n (event: google.maps.Data.RemoveFeatureEvent) => {\n if (event.feature === this._feature) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'setproperty',\n (event: google.maps.Data.SetPropertyEvent) => {\n if (\n event.feature === this._feature &&\n !isFeatureSelected(this._feature)\n ) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'removeproperty',\n (event: google.maps.Data.RemovePropertyEvent) => {\n if (\n event.feature === this._feature &&\n !isFeatureSelected(this._feature)\n ) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._map.addListener(\n 'click',\n (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => {\n this._ngZone.run(() => {\n this.close()\n })\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'click',\n (event: google.maps.Data.MouseEvent) => {\n this._ngZone.run(() => {\n this.close()\n })\n },\n ),\n )\n })\n\n this._cleanupFn = () => {\n ngUnsubscribe.next()\n ngUnsubscribe.complete()\n listeners.forEach(google.maps.event.removeListener)\n }\n }\n\n public close(): void {\n this._overlayView.setMap(null)\n }\n}\n","import { Polygon } from 'geojson'\n\nimport {\n MapDrawOutcome,\n MapFeatureInteractionFlags,\n MapInteractionContext,\n MapInteractionModel,\n} from './map-interaction-model'\n\n/**\n * Multi-field behaviour, where selection and geometry editing are separate\n * concerns.\n *\n * Clicking a polygon selects its whole group and mutates nothing, whether\n * edit mode is on or off — the point being that a stray click can never nudge\n * a vertex on an imported boundary, which is close to unrecoverable without\n * an undo feature. With edit mode on, the selected group's own geometry also\n * goes to Google's vertex/midpoint editor, and a click on open map starts a\n * new drawing.\n *\n * A click on a polygon is suppressed only while a draw is actually in\n * progress — that is the one moment a click is genuinely ambiguous between\n * \"select this\" and \"place a vertex\". Between draws there is no ambiguity at\n * all, since Terra Draw is not capturing pointer input, so every polygon\n * stays clickable and selecting a different field never requires leaving\n * edit mode first.\n */\nexport class GroupedInteractionModel implements MapInteractionModel {\n readonly id = 'grouped' as const\n\n onFeatureClick(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): void {\n // While a draw is in progress, a click on a polygon is placing a vertex,\n // not a selection. Defensive: the service's data `click` listener already\n // guards on `isDrawing()` before calling in here (see onMapClick's\n // identical defence below), but this model does not rely solely on that\n // guard.\n if (context.isDrawing) {\n return\n }\n\n // Selecting mutates nothing, so it is safe on any group regardless of\n // edit mode — including a group other than the one currently selected.\n // Note which polygon was touched, since `Delete` acts on that one alone.\n // Google's vertex editor still receives the click for the selected\n // group's own geometry.\n context.selectGroup(context.groups.keyOf(feature), feature)\n }\n\n onMapClick(context: MapInteractionContext): void {\n // A click while a draw is already in progress is placing a vertex, not a\n // map click. Defensive: the service's map `click` listener already guards\n // on `isDrawing()` before calling in here, but `startDrawing()` calling\n // `setMode('polyline')` again would reset the in-progress path, so this\n // model does not rely solely on the caller's guard.\n if (context.isDrawing) {\n return\n }\n if (context.editMode) {\n context.startDrawing()\n return\n }\n context.selectGroup(null, null)\n }\n\n onDrawFinished(\n polygon: Polygon,\n context: MapInteractionContext,\n ): MapDrawOutcome {\n const selectedKey = context.getSelectedKey()\n\n if (selectedKey === null) {\n // No selection means no field to cut into. Skipping the containment\n // search entirely is what stops a polygon drawn over an unrelated field\n // from punching a hole in it.\n return { kind: 'newFeature', groupKey: null }\n }\n\n if (context.allowHoles) {\n const target = context.findContainingFeature(polygon, selectedKey)\n if (target) {\n return { kind: 'hole', target }\n }\n }\n\n return { kind: 'newFeature', groupKey: selectedKey }\n }\n\n featureFlags(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): MapFeatureInteractionFlags {\n if (!context.editMode) {\n return { geometryEditingArmed: false, clicksAllowed: true }\n }\n\n const selectedKey = context.getSelectedKey()\n const isSelectedGroup =\n selectedKey !== null && context.groups.keyOf(feature) === selectedKey\n\n return {\n // The group stays visibly selected while a draw is in progress (F3) —\n // it is the target the drawn polygon will join — but its vertex/midpoint\n // handles are disarmed for the duration, since Google's edit handles are\n // separate interactive elements that would otherwise compete with Terra\n // Draw for pointer events near the polygon. Only the selected group is\n // ever reshapeable; every group, selected or not, is merely selectable.\n geometryEditingArmed: isSelectedGroup && !context.isDrawing,\n // Suppressed only while Terra Draw is actually capturing pointer input\n // — the one window in which a click is ambiguous between selecting and\n // placing a vertex. Between draws every polygon stays clickable\n // regardless of selection, so a click can switch the selection to a\n // different field without leaving edit mode.\n clicksAllowed: !context.isDrawing,\n }\n }\n\n allowsContextMenu(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): boolean {\n // Every item this menu offers is a destructive edit (Delete Polygon,\n // Delete Field), so it must not be reachable outside edit mode, and —\n // matching legacy's `isFeatureSelected(feature)` — not for a feature the\n // user has not selected. clicksAllowed above stays gated on drawing alone\n // (a non-selected group must remain clickable so it can BECOME the\n // selection), but offering destructive actions for a field the user has\n // not selected is more surprising than useful, so the menu is narrower\n // than what is merely clickable.\n const selectedKey = context.getSelectedKey()\n return (\n context.editMode &&\n selectedKey !== null &&\n context.groups.keyOf(feature) === selectedKey\n )\n }\n}\n","import { Polygon } from 'geojson'\n\nimport { isFeatureSelected } from '../google-maps-feature-helpers'\nimport {\n MapDrawOutcome,\n MapFeatureInteractionFlags,\n MapInteractionContext,\n MapInteractionModel,\n} from './map-interaction-model'\n\n/**\n * The behaviour this module has always had: one boundary, clicking a feature\n * selects it and arms its handles, and the draw button toggles drawing.\n *\n * Two applications depend on this and are not being updated, so it must not\n * drift. Every decision here mirrors the pre-strategy service exactly.\n */\nexport class LegacyInteractionModel implements MapInteractionModel {\n readonly id = 'legacy' as const\n\n onFeatureClick(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): void {\n context.selectGroup(context.groups.keyOf(feature), feature)\n }\n\n onMapClick(context: MapInteractionContext): void {\n context.selectGroup(null, null)\n }\n\n onDrawFinished(\n polygon: Polygon,\n context: MapInteractionContext,\n ): MapDrawOutcome {\n // Legacy parity: the pre-strategy service found the exterior feature with\n // geoJsonPolygonFromDataFeature, which returns undefined for MultiPolygon\n // geometry, and that function's caller SKIPPED such a candidate and kept\n // iterating rather than giving up — so a Polygon further along could still\n // match. The shared search is now MultiPolygon-aware for grouped mode;\n // narrow it back here with an accept predicate, filtered DURING the\n // search, so a MultiPolygon candidate is skipped rather than aborting the\n // whole search the way discarding the result afterward would. Two apps\n // depend on this behaviour and are not being updated.\n const target = context.allowHoles\n ? context.findContainingFeature(\n polygon,\n undefined,\n (feature) => feature.getGeometry()?.getType() === 'Polygon',\n )\n : undefined\n\n return target\n ? { kind: 'hole', target }\n : { kind: 'newFeature', groupKey: null }\n }\n\n featureFlags(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): MapFeatureInteractionFlags {\n // Selection alone arms handles here; `editingEnabled` is the only gate,\n // and `computeFeatureStyle` applies it.\n return { geometryEditingArmed: true, clicksAllowed: true }\n }\n\n allowsContextMenu(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): boolean {\n return isFeatureSelected(feature)\n }\n}\n","/** Below this projected diagonal, a shape is too small to label. */\nexport const DEFAULT_LABEL_MIN_DIAGONAL_PX = 48\n\n/**\n * Whether a group is large enough on screen to carry a label.\n *\n * Uses the diagonal rather than width and height separately, so a long thin\n * field — which has plenty of room for a label — is not hidden for being\n * narrow. This self-tunes as the map zooms out, which is why there is no\n * `minZoom` input.\n */\nexport function isLabelVisibleAtSize(\n widthPx: number,\n heightPx: number,\n minDiagonalPx: number = DEFAULT_LABEL_MIN_DIAGONAL_PX,\n): boolean {\n return Math.hypot(widthPx, heightPx) >= minDiagonalPx\n}\n","import { isLabelVisibleAtSize } from './label-visibility'\n\nexport interface MapFeatureLabel {\n key: string\n text: string\n bounds: google.maps.LatLngBounds\n}\n\nexport const MAP_FEATURE_LABEL_CLASS = 'seam-map-feature-label'\n\n/**\n * Renders one label per feature group.\n *\n * The `google.maps.OverlayView` subclass is declared INSIDE the constructor\n * rather than at module scope. This codebase's Google Maps API loader is\n * lazy (see `TheSeamLazyMapsApiLoader`), so `google.maps` is not guaranteed\n * to exist when this module is first imported — a top-level\n * `class X extends google.maps.OverlayView` evaluates that reference at\n * import time and throws `ReferenceError: google is not defined` before the\n * API script has loaded. `GoogleMapsContextMenuOverlayView` in\n * `google-maps-contextmenu.ts` is declared locally for the same reason.\n * `MapFeatureLabelsOverlay` itself is only ever constructed once the map\n * (and therefore the API) is ready, via `GoogleMapsService`, so deferring the\n * subclass to construction time is safe.\n *\n * Internally it is a single OverlayView holding one child div per group,\n * rather than one overlay each: with many fields that is one `draw()` per\n * frame updating N child positions instead of N overlays each doing\n * projection work.\n *\n * Labels live in the `markerLayer` pane, which sits above the `overlayLayer`\n * pane the Data layer renders polygons into (so labels are not decided by DOM\n * insertion order) and below the `floatPane` `GoogleMapsContextMenu` uses (so\n * the context menu still stays on top). `pointer-events: none` means labels\n * never take part in hit testing and cannot interfere with clicks, drawing, or\n * the context-menu overlay.\n *\n * Known limitation: no collision de-confliction. Labels of nearby groups will\n * overlap at low zoom. The size threshold reduces but does not eliminate this.\n */\nexport class MapFeatureLabelsOverlay {\n private readonly _overlay: google.maps.OverlayView & { refresh(): void }\n\n constructor(getLabels: () => MapFeatureLabel[]) {\n const container = document.createElement('div')\n container.style.position = 'absolute'\n container.style.left = '0'\n container.style.top = '0'\n container.style.pointerEvents = 'none'\n\n const elements = new Map<string, HTMLDivElement>()\n let labels: MapFeatureLabel[] = []\n\n const elementFor = (label: MapFeatureLabel): HTMLDivElement => {\n let element = elements.get(label.key)\n if (!element) {\n element = document.createElement('div')\n element.className = MAP_FEATURE_LABEL_CLASS\n element.style.position = 'absolute'\n element.style.transform = 'translate(-50%, -50%)'\n element.style.pointerEvents = 'none'\n element.style.whiteSpace = 'nowrap'\n container.appendChild(element)\n elements.set(label.key, element)\n }\n if (element.textContent !== label.text) {\n element.textContent = label.text\n }\n return element\n }\n\n class Overlay extends google.maps.OverlayView {\n onAdd(): void {\n this.getPanes()?.markerLayer.appendChild(container)\n }\n\n onRemove(): void {\n container.parentElement?.removeChild(container)\n elements.clear()\n }\n\n /** Re-read the labels and repaint. Call when the value or grouping changes. */\n refresh(): void {\n labels = getLabels()\n this.draw()\n }\n\n draw(): void {\n const projection = this.getProjection()\n if (!projection) {\n return\n }\n\n const seen = new Set<string>()\n\n for (const label of labels) {\n seen.add(label.key)\n const element = elementFor(label)\n\n const ne = projection.fromLatLngToDivPixel(\n label.bounds.getNorthEast(),\n )\n const sw = projection.fromLatLngToDivPixel(\n label.bounds.getSouthWest(),\n )\n const centre = projection.fromLatLngToDivPixel(\n label.bounds.getCenter(),\n )\n if (!ne || !sw || !centre) {\n element.hidden = true\n continue\n }\n\n const visible = isLabelVisibleAtSize(\n Math.abs(ne.x - sw.x),\n Math.abs(ne.y - sw.y),\n )\n element.hidden = !visible\n if (visible) {\n element.style.left = `${centre.x}px`\n element.style.top = `${centre.y}px`\n }\n }\n\n for (const [key, element] of elements) {\n if (!seen.has(key)) {\n element.parentElement?.removeChild(element)\n elements.delete(key)\n }\n }\n }\n }\n\n this._overlay = new Overlay()\n }\n\n /** Attach to (or detach from, with `null`) a map. */\n setMap(map: google.maps.Map | null): void {\n this._overlay.setMap(map)\n }\n\n /** Re-read the labels and repaint. Call when the value or grouping changes. */\n refresh(): void {\n this._overlay.refresh()\n }\n\n destroy(): void {\n this._overlay.setMap(null)\n }\n}\n","import { Injectable } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nexport enum MapValueSource {\n Input = 'input',\n FeatureChange = 'featurechange',\n}\n\nexport type MapValue = object | undefined | null\n\nexport interface MapValueChange {\n value: MapValue\n source: MapValueSource\n}\n\n@Injectable()\nexport class MapValueManagerService {\n private readonly _valueChangedSubject = new Subject<MapValueChange>()\n\n private _value: MapValue\n\n public readonly valueChanged: Observable<MapValueChange>\n\n constructor() {\n this.valueChanged = this._valueChangedSubject.asObservable()\n }\n\n public setValue(value: MapValue, source: MapValueSource): boolean {\n if (value === this._value) {\n return false\n }\n\n if (value === null || value === undefined) {\n this._value = value\n const _change: MapValueChange = {\n source,\n value: this._value,\n }\n this._valueChangedSubject.next(_change)\n return true\n }\n\n if (JSON.stringify(value) === JSON.stringify(this._value)) {\n return true\n }\n\n // TODO: Validate object is valid geojson.\n this._value = value\n const change: MapValueChange = {\n source,\n value: this._value,\n }\n this._valueChangedSubject.next(change)\n return true\n }\n\n public get value(): MapValue {\n return this._value\n }\n}\n","import { Injectable, NgZone, OnDestroy, ViewContainerRef } from '@angular/core'\nimport { Geometry, Polygon } from 'geojson'\nimport { BehaviorSubject, from, Observable, Subject } from 'rxjs'\nimport { distinctUntilChanged, switchMap, takeUntil, tap } from 'rxjs/operators'\n\nimport { TerraDraw, TerraDrawPolyLineMode } from 'terra-draw'\nimport { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'\n\nimport { MenuComponent } from '@theseam/ui-common/menu'\nimport {\n closePolygons,\n notNullOrUndefined,\n polygonContains,\n polygonHasMinDistinctVertices,\n} from '@theseam/ui-common/utils'\n\nimport {\n FeatureGroupRegistry,\n FeatureGroupRegistryOptions,\n} from './feature-groups/feature-group-registry'\nimport {\n TheSeamMapFeatureGroup,\n TheSeamMapGroupTarget,\n} from './feature-groups/feature-group'\nimport {\n computeFeatureHoverStyle,\n computeFeatureStyle,\n} from './feature-style/compute-feature-style'\nimport { GoogleMapsContextMenu } from './google-maps-contextmenu'\nimport {\n applyHoleToFeature,\n createFeatureChangeObservable,\n dataPolygonFromGeoJson,\n getBoundsWithAllFeatures,\n getFeatureCenter,\n getFeaturesCount,\n isFeatureSelected,\n polygonsFromDataFeature,\n removeAllFeatures,\n setFeatureSelected,\n stripAppFeaturePropertiesFromJson,\n} from './google-maps-feature-helpers'\nimport { GroupedInteractionModel } from './interaction/grouped-interaction-model'\nimport { TheSeamMapInteractionMode } from './interaction/interaction-mode'\nimport { LegacyInteractionModel } from './interaction/legacy-interaction-model'\nimport {\n MapInteractionContext,\n MapInteractionModel,\n} from './interaction/map-interaction-model'\nimport {\n MapFeatureLabel,\n MapFeatureLabelsOverlay,\n} from './labels/map-feature-labels-overlay'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from './map-value-manager.service'\n\ndeclare const ngDevMode: boolean | undefined\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\n@Injectable()\nexport class GoogleMapsService implements OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private readonly _mapReadySubject = new BehaviorSubject<boolean>(false)\n private readonly _editingEnabledSubject = new BehaviorSubject<boolean>(true)\n\n private _terraDraw?: TerraDraw\n private _terraDrawReady = false\n // Terra Draw's Google Maps adapter can lose pointer capture at the adapter\n // level after a completed draw session (terra-draw#710): every click after\n // that lands on nothing, and a drag pans the map instead of editing.\n // Recreating the whole `TerraDraw` instance (and its adapter) is the only\n // thing that restores it. `stopDrawing()` triggers this — EAGERLY, right\n // when the session ends, not lazily on the next `startDrawing()` — but\n // only for a session that actually placed a coordinate (see\n // `_hasPlacedVertex()`): that is the only kind that ever touched the\n // adapter's pointer capture, so an armed-but-empty session (armed, then\n // cancelled with zero vertices placed — e.g. by `Escape`, or by\n // `setEditMode(true)`'s auto-arm getting turned straight back off) does\n // not need it and does not pay for it.\n //\n // Recreating eagerly (rather than deferring to the next `startDrawing()`)\n // means the new instance's `ready` has every chance to have already fired\n // by the time the user's NEXT click asks to start a second draw, so that\n // click is not the one racing the async gap. A `startDrawing()` call that\n // still arrives before `ready` fires — instance rebuild is fast but not\n // free — queues itself via `_pendingStartDrawing` below rather than being\n // dropped, so nothing is lost even in that case.\n private _pendingStartDrawing = false\n /**\n * One-shot suppression for the map `click` listener, armed the instant a\n * draw finishes (see `_armMapClickSuppression()` for why, and its call\n * site in `_onDrawFinished()`).\n *\n * `domEvent.timeStamp` was tried first, since it is a `DOMHighResTimeStamp`\n * on the same origin as `performance.now()` and looks like a clean,\n * delay-free discriminator: a stale click's timestamp should predate the\n * moment the draw finished. It does not hold up empirically. Driving real\n * mouse draws against the live Storybook and logging both the map `click`\n * listener and `stopDrawing()` (see .superpowers/closing-click-report.md)\n * caught the echo repeatedly, and every single time its `domEvent.timeStamp`\n * was a few milliseconds AFTER `stopDrawing()`'s own timestamp, not before\n * — indistinguishable from a genuinely fresh click by timestamp alone.\n * Google appears to stamp its own synthetic `click` at the moment IT\n * dispatches, not at the original pointer event's time, so there is no\n * \"stale-looking\" timestamp to compare against.\n */\n private _suppressNextMapClick = false\n private readonly _drawingSubject = new BehaviorSubject<boolean>(false)\n public readonly drawing$ = this._drawingSubject.asObservable()\n private _featureContextMenu: MenuComponent | null = null\n private _activeContextMenu: GoogleMapsContextMenu | null = null\n private _baseLatLng?: google.maps.LatLngLiteral\n private _padding?: number | google.maps.Padding\n\n private _allowDrawingHoleInPolygon = false\n\n private _model: MapInteractionModel = new LegacyInteractionModel()\n private readonly _interactionModeSubject =\n new BehaviorSubject<TheSeamMapInteractionMode>('legacy')\n public readonly interactionMode$ = this._interactionModeSubject.asObservable()\n private _groups?: FeatureGroupRegistry\n private _groupOptions: FeatureGroupRegistryOptions = {}\n private _focusedFeature: google.maps.Data.Feature | null = null\n private _styleFn?: google.maps.Data.StylingFunction\n\n private _labelProperty: string | undefined\n private _labelsOverlay?: MapFeatureLabelsOverlay\n private _warnedAboutLabelDisagreement = false\n\n private readonly _selectionSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n /**\n * `distinctUntilChanged` collapses repeated `null`s. Several paths clear the\n * selection defensively — `setData`, `clearSelection`, the declarative\n * `selectedGroupKey` application on map-ready — and each would otherwise\n * emit its own `null` to consumers before the user has touched anything.\n *\n * Non-null targets are rebuilt on every change, so reference equality never\n * suppresses a real one, including re-selecting the same group with a\n * different focused polygon.\n */\n public readonly selection$ = this._selectionSubject.pipe(\n distinctUntilChanged(),\n )\n\n private readonly _hoverSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n /** Same reasoning as `selection$`; `mouseout` repeats `null` freely. */\n public readonly hover$ = this._hoverSubject.pipe(distinctUntilChanged())\n\n /**\n * The group of the feature a `contextmenu` event last landed on. Kept\n * distinct from `selection$` even though `allowsContextMenu()` now requires\n * the right-clicked feature's group to already be the selection — so, for\n * as long as the menu stays open, the two are provably the same group.\n * Collapsing onto `selection$` would re-couple \"what the menu acts on\" to\n * \"whatever is currently selected\", which is exactly the coupling this\n * subject was introduced to break when the menu could still open for a\n * non-selected group. That rule has already moved twice; keeping this\n * separate means a future loosening of `allowsContextMenu()` does not have\n * to re-invent it.\n */\n private readonly _contextMenuTargetSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n public readonly contextMenuTarget$ =\n this._contextMenuTargetSubject.asObservable()\n\n private readonly _editModeSubject = new BehaviorSubject<boolean>(false)\n public readonly editMode$ = this._editModeSubject.asObservable()\n\n // TODO: Move to a better place than the map wrapper service.\n private _fileInputHandler: ((file: File) => void) | undefined | null\n\n public googleMap?: google.maps.Map\n\n public readonly mapReady$: Observable<boolean>\n\n public get mapReady(): boolean {\n return this._mapReadySubject.value\n }\n\n public readonly editingEnabled$: Observable<boolean>\n\n constructor(\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _ngZone: NgZone,\n private readonly _vcr: ViewContainerRef,\n ) {\n this.editingEnabled$ = this._editingEnabledSubject.asObservable()\n this.mapReady$ = this._mapReadySubject.asObservable()\n }\n\n ngOnDestroy(): void {\n this._disposeTerraDraw()\n this._drawingSubject.complete()\n this._selectionSubject.complete()\n this._hoverSubject.complete()\n this._contextMenuTargetSubject.complete()\n this._editModeSubject.complete()\n this._interactionModeSubject.complete()\n this._groups = undefined\n\n this._labelsOverlay?.destroy()\n this._labelsOverlay = undefined\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n public setMap(map: google.maps.Map): void {\n this.googleMap = map\n this._mapReadySubject.next(true)\n // Terra Draw's Google Maps adapter binds its event listeners to the map's\n // rendered '.gm-style' DOM subtree (located via querySelector). That subtree\n // does not exist yet when 'mapInitialized' fires, so initializing Terra Draw\n // synchronously here makes the adapter register listeners on a null element\n // and throw. Defer init until the map has rendered (first 'idle').\n google.maps.event.addListenerOnce(map, 'idle', () => this._initTerraDraw())\n this._initFeatureStyling()\n this._initFeatureChangeListeners()\n }\n\n public setBaseLatLng(lat: number, lng: number): void {\n this._baseLatLng = { lat, lng }\n }\n\n public setPadding(padding: number | google.maps.Padding | undefined): void {\n this._padding = padding\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public setFeatureContextMenu(menu: MenuComponent | null): void {\n this.closeContextMenu()\n this._featureContextMenu = menu\n }\n\n public setEditingEnabled(enabled: boolean): void {\n this._editingEnabledSubject.next(enabled)\n\n if (this.mapReady) {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n if (!enabled) {\n this.stopDrawing()\n this.setEditMode(false)\n this.clearSelection()\n }\n }\n }\n\n public isEditingEnabled(): boolean {\n return this._editingEnabledSubject.value\n }\n\n public getDiv(): HTMLDivElement {\n this._assertInitialized()\n return this.googleMap.getDiv() as HTMLDivElement\n }\n\n public fitBounds(\n bounds: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n padding?: number | google.maps.Padding,\n ): void {\n this._assertInitialized()\n this.googleMap.fitBounds(bounds, padding)\n }\n\n /**\n * Iterates the map's features and removes any that are selected.\n */\n public deleteSelection(): void {\n this._assertInitialized()\n const mapData = this.googleMap.data\n mapData.forEach((f) => {\n if (isFeatureSelected(f)) {\n mapData.remove(f)\n }\n })\n // Every deleted feature was selected, so nothing should still read as\n // selected afterward. Re-sync `selection$` and `_focusedFeature` the same\n // way `deleteFocusedFeature()` and `setData()` already do, rather than\n // leaving them pointing at a group that no longer exists. In 'legacy'\n // mode nothing consumes selection$ today, and no remaining feature's raw\n // selected flag changes here (they were already false), so this is inert\n // there.\n this.clearSelection()\n }\n\n /**\n * Delete every feature in `key`'s group. Backs the grouped \"Delete Field\"\n * context-menu item.\n *\n * `allowsContextMenu()` now requires the right-clicked feature's group to\n * already be the selection, so `key` here is always the selected group's\n * key by the time this runs — making this call equivalent in practice to\n * `deleteSelection()`. Kept as its own method anyway: it names the thing\n * the menu item actually acts on (the group the menu opened for) rather\n * than relying on the coincidence that it currently matches whatever is\n * selected, a coincidence this design has already stopped being true once\n * before and could again.\n */\n public deleteGroup(key: string): void {\n this._assertInitialized()\n const mapData = this.googleMap.data\n const wasSelected = this._selectionSubject.value?.group.key === key\n const focusedInGroup =\n this._focusedFeature !== null &&\n this._registry.keyOf(this._focusedFeature) === key\n const contextMenuTargetInGroup =\n this._contextMenuTargetSubject.value?.group.key === key\n\n this._registry.featuresIn(key).forEach((f) => mapData.remove(f))\n\n if (wasSelected) {\n this._applySelection(null, null)\n } else if (focusedInGroup) {\n this._focusedFeature = null\n }\n // The whole group is gone, so a context-menu target pointing at it — set\n // by whichever interaction opened the menu, not necessarily this one — is\n // now a dangling reference. Only clear it when it actually named this\n // group; an unrelated still-open menu's target must survive.\n if (contextMenuTargetInGroup) {\n this._contextMenuTargetSubject.next(null)\n }\n }\n\n /**\n * Whether polygon drawing mode is currently active.\n *\n * Reads `_drawingSubject` — set by `startDrawing()`/`stopDrawing()`, which\n * this service fully controls — rather than asking Terra Draw's own\n * `getMode()`. The two are kept in lockstep by every call to those two\n * methods, so this is not a behaviour change; it exists so a stuck Terra\n * Draw mode can never silently disagree with, and disarm, the rest of this\n * service's drawing-state bookkeeping (F3's `geometryEditingArmed`\n * included). `stopDrawing()` still always calls `_terraDraw.setMode('static')`\n * to make Terra Draw itself release its cursor override and any\n * in-progress geometry, regardless of which source `isDrawing()` reads.\n */\n public isDrawing(): boolean {\n return this._drawingSubject.value\n }\n\n /** Enter polygon drawing mode. */\n public startDrawing(): void {\n if (\n !this._terraDraw ||\n !this.isEditingEnabled() ||\n // Already drawing: `setMode('polyline')` resets the in-progress path,\n // so a click that lands here mid-draw (F4) must not re-enter drawing\n // mode. `onMapClick` already guards on `context.isDrawing` before\n // calling in, and the map `click` listener guards on `isDrawing()`\n // before calling the model at all — this is the last line of defence.\n this.isDrawing()\n ) {\n return\n }\n if (!this._terraDrawReady) {\n // A `TerraDraw` recreate is in flight — either the eager rebuild\n // `stopDrawing()` kicks off after a real draw session ends (see\n // `_hasPlacedVertex()`), or, rarely, first-ever init hasn't reported\n // `ready` yet. Recreation itself is synchronous, but the new\n // instance's `ready` event is not (see `_createTerraDraw()`), so queue\n // this call rather than silently dropping the click that made it —\n // the `ready` handler below finishes entering drawing mode once the\n // new instance is actually usable.\n this._pendingStartDrawing = true\n return\n }\n this._enterDrawingMode()\n }\n\n /**\n * Clear any selection when entering drawing mode, but only in 'legacy'\n * mode. There, a selected feature and the shape being drawn are unrelated,\n * so leaving the old one visibly selected would read as one shape. In\n * 'grouped' mode they are related: the selected group is exactly the\n * target the drawn polygon will join, so it keeps its selected styling —\n * `GroupedInteractionModel.featureFlags()` disarms its edit handles for\n * the duration instead (F3), so they don't compete with Terra Draw for\n * pointer events.\n *\n * Split out of `startDrawing()` so a recreate-in-flight (see\n * `_pendingStartDrawing`) can defer this until the new instance's `ready`\n * event actually fires, instead of entering drawing mode against an\n * instance that isn't ready yet.\n */\n private _enterDrawingMode(): void {\n this._assertInitialized()\n if (this._model.id === 'legacy') {\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n setFeatureSelected(f, false)\n }\n })\n }\n this._terraDraw?.setMode('polyline')\n this._drawingSubject.next(true)\n this._refreshStyles()\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Cancel any in-progress drawing and leave drawing mode. Switching to the\n * `static` mode clears an unfinished line.\n */\n public stopDrawing(): void {\n if (!this._terraDraw || !this._terraDrawReady) {\n return\n }\n const wasDrawing = this.isDrawing()\n // Read BEFORE setMode('static') below — switching the active mode away\n // stops it, which resets its own state, so this only means anything\n // while the polyline mode is still the one active.\n const placedVertex = wasDrawing && this._hasPlacedVertex()\n this._terraDraw.setMode('static')\n this._drawingSubject.next(false)\n if (placedVertex) {\n // A real draw session — one that actually placed a coordinate, and so\n // actually engaged the adapter's pointer capture — just ended\n // (finished OR cancelled). That capture is what terra-draw#710 can\n // leave broken. An armed-but-empty session (armed via a click, or via\n // setEditMode(true)'s auto-arm, then cancelled — e.g. by Escape —\n // with zero vertices placed) never touched it and does not need this.\n //\n // Recreate EAGERLY, right now, rather than deferring to the next\n // startDrawing() call: the new instance then has the rest of this\n // moment, plus however long the user takes to look at what they just\n // did, to finish coming up — so the click that starts the NEXT draw\n // does not itself race the async `ready` gap. `startDrawing()`'s own\n // `!_terraDrawReady` branch (queuing via `_pendingStartDrawing`) is\n // the safety net for a start that still arrives before `ready` fires.\n this._recreateTerraDraw()\n }\n // Re-arms the selected group's edit handles in 'grouped' mode: nothing\n // else changes a feature's own properties here, so nothing else would\n // make Data re-evaluate the style function and pick up\n // `featureFlags().geometryEditingArmed` no longer being disarmed by\n // `isDrawing` (F3).\n this._refreshStyles()\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Whether the active Terra Draw mode has actually placed a coordinate.\n * Terra Draw's own mode state machine transitions from `'started'`\n * (armed, no coordinate committed yet) to `'drawing'` the instant the\n * first vertex lands (`TerraDrawPolyLineMode`'s internal `setDrawing()`,\n * confirmed against `terra-draw`'s own source). Read directly from Terra\n * Draw's state rather than inferred from this service's own flags, so it\n * reflects whether the adapter's pointer capture was actually\n * engaged — the thing terra-draw#710 is actually about — rather than\n * merely whether this service thought a draw was armed.\n */\n private _hasPlacedVertex(): boolean {\n return this._terraDraw?.getModeState() === 'drawing'\n }\n\n /**\n * Stop (if running) and drop the current `TerraDraw` instance. `TerraDraw#\n * stop()` deregisters its adapter, which for the Google Maps adapter's\n * `isolatedData: true` mode calls `this._data.setMap(null)` and drops the\n * reference — so this never leaves an orphaned or duplicate Data layer\n * behind, across any number of calls.\n */\n private _disposeTerraDraw(): void {\n if (this._terraDraw?.enabled) {\n this._terraDraw.stop()\n }\n this._terraDraw = undefined\n this._terraDrawReady = false\n }\n\n /**\n * Dispose the current `TerraDraw` instance (and its adapter) and build a\n * fresh one in its place. This is the terra-draw#710 recovery: the old\n * instance's listeners die with it (its adapter is deregistered by\n * `stop()`, so nothing further reaches it), and `_createTerraDraw()` wires\n * up brand new `ready`/`finish` listeners on the new instance — never the\n * stale closures from a previous instance.\n */\n private _recreateTerraDraw(): void {\n this._disposeTerraDraw()\n this._terraDraw = this._createTerraDraw()\n }\n\n private _initTerraDraw(): void {\n if (notNullOrUndefined(this._terraDraw)) {\n throw Error(`Terra Draw is already initialized.`)\n }\n this._terraDraw = this._createTerraDraw()\n }\n\n /**\n * Build and start a new `TerraDraw` instance with its Google Maps adapter,\n * wiring up this instance's own `ready`/`finish` listeners. Called both by\n * `_initTerraDraw()` (first-ever init, guarded against running twice) and\n * by `_recreateTerraDraw()` (every terra-draw#710 recovery afterward) —\n * the guard against accidental double-init only lives in `_initTerraDraw()`\n * itself, so recreation is free to call this as many times as needed.\n */\n private _createTerraDraw(): TerraDraw {\n this._assertInitialized()\n\n // The Google Maps adapter creates an OverlayView on the map; ensure the map\n // element has an id (harmless if one is already present).\n const div = this.googleMap.getDiv() as HTMLElement\n if (!div.id) {\n div.id = `seam-google-map-${Math.floor(performance.now())}`\n }\n\n const pointerDistance = 10\n\n // KNOWN ISSUE (upstream, unresolved): after repeated draws, Terra Draw can\n // intermittently lose pointer control of the Google Maps adapter, so input\n // pans the map instead of drawing until the page is reloaded. This is a race\n // between Terra Draw and the Google Maps adapter, tracked at\n // https://github.com/JamesLMilner/terra-draw/issues/710 (open as of\n // terra-draw 1.32.0 / adapter 1.6.1). It is not fixable in this wrapper;\n // revisit when the upstream issue is resolved.\n const draw = new TerraDraw({\n adapter: new TerraDrawGoogleMapsAdapter({\n lib: google.maps,\n map: this.googleMap,\n // Render Terra Draw's in-progress/finished geometry on its OWN Data\n // layer instead of the map's shared `map.data`. Without this, Terra\n // Draw's features land in the same layer this service manages, so the\n // exterior-feature search would match a just-drawn polygon against its\n // own rendered copy (cutting a hole equal to itself) and getGeoJson\n // would serialize Terra Draw's transient features.\n isolatedData: true,\n }),\n modes: [\n new TerraDrawPolyLineMode({\n // Tighten how close a click must be to the first point to close the\n // polygon (Terra Draw's default ~40px felt too far / closed too\n // easily).\n pointerDistance,\n // Snap the moving vertex onto the line's OWN first point when the\n // cursor is within a few pixels of it, so it's clear the ends are\n // about to meet just before the click that closes the polygon.\n // (Terra Draw's built-in `toCoordinate` only snaps to OTHER features'\n // points — excluding the line being drawn — so it does nothing here.)\n snapping: {\n toCustom: (event, ctx) => {\n const geometry = ctx.getCurrentGeometrySnapshot()\n if (!geometry) {\n return undefined\n }\n const ring =\n geometry.type === 'LineString'\n ? geometry.coordinates\n : geometry.coordinates[0]\n // Only offer the closing snap once enough points exist to form a\n // polygon (placed points plus the live cursor point).\n if (!ring || ring.length < 4) {\n return undefined\n }\n const first = ring[0]\n const firstPixel = ctx.project(first[0], first[1])\n const distance = Math.hypot(\n firstPixel.x - event.containerX,\n firstPixel.y - event.containerY,\n )\n const SNAP_DISTANCE_PX = pointerDistance\n return distance <= SNAP_DISTANCE_PX ? first : undefined\n },\n },\n // Draw as an open line that closes into a polygon when the start point\n // is clicked (the old Drawing manager's feel): while drawing you see a\n // line, and the shape only \"fills in\" once committed to the map's Data\n // layer, which is the clear \"done\" signal. Black line, small white\n // closing/snapping dots (like the edit anchors), no fill on Terra\n // Draw's transient polygon. Terra Draw requires hex colors.\n styles: {\n lineStringColor: '#000000',\n lineStringWidth: 2,\n polygonFillOpacity: 0,\n polygonOutlineColor: '#000000',\n polygonOutlineWidth: 2,\n closingPointColor: '#ffffff',\n closingPointWidth: 4,\n closingPointOutlineColor: '#000000',\n closingPointOutlineWidth: 1,\n snappingPointColor: '#ffffff',\n snappingPointWidth: 4,\n snappingPointOutlineColor: '#000000',\n snappingPointOutlineWidth: 1,\n },\n }),\n ],\n })\n\n draw.on('ready', () => {\n this._terraDrawReady = true\n // Start in the resting (non-drawing) mode.\n draw.setMode('static')\n // A `startDrawing()` call arrived while THIS instance was still\n // starting up (terra-draw#710 recovery, or plain first-time init) and\n // queued itself rather than being dropped — finish the job now, but\n // only if nothing since then made drawing invalid: editing disabled,\n // somehow already drawing, or — grouped mode only, where edit mode is\n // its own on/off concept `startDrawing()` itself never re-checks —\n // edit mode having been turned off while this was in flight. Mirrors\n // exactly the check `GroupedInteractionModel.onMapClick()` made before\n // calling in, just re-run after the async gap instead of trusting it\n // still holds.\n if (this._pendingStartDrawing) {\n this._pendingStartDrawing = false\n const stillValid =\n this.isEditingEnabled() &&\n !this.isDrawing() &&\n (this._model.id !== 'grouped' || this.isEditMode())\n if (stillValid) {\n this._enterDrawingMode()\n }\n }\n })\n\n draw.on('finish', (id, context) => {\n if (context.action !== 'draw') {\n return\n }\n this._ngZone.run(() => this._onDrawFinished(id))\n })\n\n draw.start()\n return draw\n }\n\n public addControl(\n element: HTMLElement,\n position: google.maps.ControlPosition,\n ): void {\n this._assertInitialized()\n this.googleMap.controls[position].push(element)\n }\n\n public async setData(data: any): Promise<void> {\n this._assertInitialized()\n removeAllFeatures(this.googleMap.data)\n // Every prior feature is gone, so nothing selected or hovered survives it —\n // clear both rather than leaving selection$/hover$ referencing removed\n // features.\n this.clearSelection()\n this._hoverSubject.next(null)\n this._contextMenuTargetSubject.next(null)\n this.googleMap.data.addGeoJson(data)\n this.googleMap.fitBounds(\n getBoundsWithAllFeatures(this.googleMap.data),\n this._padding,\n )\n this._labelsOverlay?.refresh()\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public reCenterOnFeatures(): void {\n this._assertInitialized()\n if (getFeaturesCount(this.googleMap.data) === 0) {\n if (!this._baseLatLng) {\n return\n }\n\n this.googleMap.panTo(this._baseLatLng)\n return\n }\n this.googleMap.fitBounds(\n getBoundsWithAllFeatures(this.googleMap.data),\n this._padding,\n )\n\n // TODO: Fix to pan to center. Currently fitBounds results in the expected\n // result, but pantToBounds animates.\n // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))\n }\n\n public allowDrawingHoleInPolygon(allow: boolean): void {\n this._allowDrawingHoleInPolygon = allow\n }\n\n public setFileInputHandler(\n handler: ((file: File) => void) | undefined | null,\n ): void {\n this._fileInputHandler = handler\n }\n\n public getFileInputHandler(): ((file: File) => void) | undefined | null {\n return this._fileInputHandler\n }\n\n public setInteractionMode(mode: TheSeamMapInteractionMode): void {\n this._model =\n mode === 'grouped'\n ? new GroupedInteractionModel()\n : new LegacyInteractionModel()\n if (mode !== 'grouped') {\n this._editModeSubject.next(false)\n }\n this._interactionModeSubject.next(mode)\n this._refreshStyles()\n }\n\n public setGroupOptions(options: FeatureGroupRegistryOptions): void {\n this._groupOptions = options\n this._groups?.setOptions(options)\n this._refreshStyles()\n }\n\n /**\n * Name of the GeoJSON property to render as a per-group label. `undefined`\n * removes labels entirely (and, until now set, means the overlay is never\n * even constructed).\n */\n public setLabelProperty(property: string | undefined): void {\n this._labelProperty = property\n if (!this.mapReady) {\n return\n }\n if (!property) {\n this._labelsOverlay?.destroy()\n this._labelsOverlay = undefined\n return\n }\n this._ensureLabelsOverlay()\n this._labelsOverlay?.refresh()\n }\n\n private _ensureLabelsOverlay(): void {\n this._assertInitialized()\n if (this._labelsOverlay) {\n return\n }\n this._labelsOverlay = new MapFeatureLabelsOverlay(() => this._buildLabels())\n this._labelsOverlay.setMap(this.googleMap)\n }\n\n private _buildLabels(): MapFeatureLabel[] {\n if (this.isDrawing()) {\n return []\n }\n const property = this._labelProperty\n if (!property) {\n return []\n }\n this._assertInitialized()\n\n const byKey = new Map<\n string,\n { text: string; bounds: google.maps.LatLngBounds; others: Set<string> }\n >()\n\n this.googleMap.data.forEach((feature) => {\n const key = this._registry.keyOf(feature)\n const raw = feature.getProperty(property)\n const text =\n raw === null || raw === undefined || raw === '' ? '' : String(raw)\n\n const existing = byKey.get(key)\n const bounds = existing?.bounds ?? new google.maps.LatLngBounds()\n feature.getGeometry()?.forEachLatLng((latLng) => bounds.extend(latLng))\n\n if (!existing) {\n byKey.set(key, { text, bounds, others: new Set(text ? [text] : []) })\n return\n }\n if (text) {\n existing.others.add(text)\n if (!existing.text) {\n existing.text = text\n }\n }\n })\n\n const labels: MapFeatureLabel[] = []\n for (const [key, entry] of byKey) {\n if (entry.others.size > 1) {\n this._warnAboutLabelDisagreement(key)\n }\n if (entry.text) {\n labels.push({ key, text: entry.text, bounds: entry.bounds })\n }\n }\n return labels\n }\n\n private _warnAboutLabelDisagreement(key: string): void {\n if (\n this._warnedAboutLabelDisagreement ||\n (typeof ngDevMode !== 'undefined' && !ngDevMode)\n ) {\n return\n }\n this._warnedAboutLabelDisagreement = true\n console.warn(\n `[seam-google-maps] features in group \"${key}\" carry different ` +\n `\"${this._labelProperty}\" values. One is rendered; which is ` +\n `unspecified. Keeping them consistent is the consumer's business.`,\n )\n }\n\n public isEditMode(): boolean {\n return this._editModeSubject.value\n }\n\n public setEditMode(enabled: boolean): void {\n if (this._model.id !== 'grouped' || enabled === this.isEditMode()) {\n return\n }\n if (!enabled) {\n const wasDrawing = this.isDrawing()\n this.stopDrawing()\n if (wasDrawing) {\n this._reapplyCurrentSelection()\n }\n }\n this._editModeSubject.next(enabled)\n this._refreshStyles()\n // Arm drawing immediately when edit mode is turned on with nothing\n // selected, so the button press itself is what puts Terra Draw in\n // crosshair mode — matching legacy's button, which calls startDrawing()\n // directly. Without this, the very next click only arms Terra Draw\n // (switching the cursor) without placing a vertex, and a SECOND click is\n // what actually starts the polygon.\n //\n // Not when a group is already selected: the user is there to reshape that\n // group by clicking its vertex/midpoint handles, and arming would make\n // every click place a vertex instead — including the clicks on OTHER\n // groups that let the user switch which one is selected. Also not on the\n // selection merely being CLEARED while already in edit mode (e.g. via\n // Escape, in handleEscape()): that path never calls setEditMode(), so it\n // never reaches this arm — deliberately, since that state has to stay\n // clickable or Escape becomes a trap with no way back to selecting.\n //\n // Goes through startDrawing(), the same path a click on open map already\n // uses, so a Terra Draw recreate still in flight from the PREVIOUS\n // session (stopDrawing() now kicks it off eagerly — see\n // _hasPlacedVertex()) is honoured rather than bypassed — a call that\n // arrives before the new instance's `ready` fires queues itself via\n // _pendingStartDrawing exactly as it would from that click.\n if (enabled && this._selectionSubject.value === null) {\n this.startDrawing()\n }\n }\n\n /**\n * Re-run the style callback for every feature.\n *\n * Google re-evaluates the callback whenever the style is set, so handing\n * back the same stored function is enough to repaint after a mode change.\n */\n private _refreshStyles(): void {\n if (!this.mapReady || !this._styleFn) {\n return\n }\n this._assertInitialized()\n this.googleMap.data.setStyle(this._styleFn)\n }\n\n private get _registry(): FeatureGroupRegistry {\n this._assertInitialized()\n if (!this._groups) {\n this._groups = new FeatureGroupRegistry(\n this.googleMap.data,\n this._groupOptions,\n )\n }\n return this._groups\n }\n\n private _interactionContext(): MapInteractionContext {\n return {\n groups: this._registry,\n editingEnabled: this.isEditingEnabled(),\n allowHoles: this._allowDrawingHoleInPolygon,\n editMode: this.isEditMode(),\n isDrawing: this.isDrawing(),\n getSelectedKey: () => this._selectionSubject.value?.group.key ?? null,\n selectGroup: (key, feature) => this._applySelection(key, feature),\n startDrawing: () => this.startDrawing(),\n findContainingFeature: (polygon, groupKey, accept) =>\n this._findContainingFeature(polygon, groupKey, accept),\n }\n }\n\n /**\n * Find an existing feature that fully contains `polygon`, restricted to a\n * group when `groupKey` is given and to features `accept` returns true for\n * when given. Matches any part of a MultiPolygon.\n *\n * `accept` is applied DURING iteration — a rejected candidate is skipped,\n * not treated as ending the search — so legacy mode's Polygon-only filter\n * can let a later Polygon candidate still match.\n */\n private _findContainingFeature(\n polygon: Polygon,\n groupKey?: string,\n accept?: (feature: google.maps.Data.Feature) => boolean,\n ): google.maps.Data.Feature | undefined {\n this._assertInitialized()\n let match: google.maps.Data.Feature | undefined\n this.googleMap.data.forEach((feature) => {\n if (match) {\n return\n }\n if (\n groupKey !== undefined &&\n this._registry.keyOf(feature) !== groupKey\n ) {\n return\n }\n if (accept && !accept(feature)) {\n return\n }\n const contains = polygonsFromDataFeature(feature).some((part) =>\n polygonContains(part, polygon),\n )\n if (contains) {\n match = feature\n }\n })\n return match\n }\n\n private _applySelection(\n key: string | null,\n feature: google.maps.Data.Feature | null,\n ): void {\n this._assertInitialized()\n\n this._focusedFeature = feature\n const selectedFeatures = key === null ? [] : this._registry.featuresIn(key)\n\n this.googleMap.data.forEach((f) => {\n const shouldSelect = selectedFeatures.indexOf(f) !== -1\n if (isFeatureSelected(f) !== shouldSelect) {\n setFeatureSelected(f, shouldSelect)\n }\n })\n\n if (key === null) {\n this._selectionSubject.next(null)\n return\n }\n\n const resolved = this._registry.groupWithSources(key)\n if (!resolved) {\n this._selectionSubject.next(null)\n return\n }\n this._selectionSubject.next(this._targetFor(resolved, feature))\n }\n\n /**\n * Pair a group with the emitted GeoJSON for one of its `Data.Feature`s.\n *\n * Indexes into the returned source array rather than `featuresIn()`, because\n * a feature with unsupported geometry is dropped from the emitted list and\n * would shift every index after it.\n */\n private _targetFor(\n resolved: {\n group: TheSeamMapFeatureGroup\n sources: google.maps.Data.Feature[]\n },\n feature: google.maps.Data.Feature | null,\n ): TheSeamMapGroupTarget {\n const index = feature ? resolved.sources.indexOf(feature) : -1\n return {\n group: resolved.group,\n feature: index === -1 ? null : resolved.group.features[index],\n }\n }\n\n public selectGroup(key: string | null): boolean {\n this._assertInitialized()\n if (key === null) {\n this._applySelection(null, null)\n return true\n }\n const features = this._registry.featuresIn(key)\n if (features.length === 0) {\n return false\n }\n this._applySelection(key, features[0])\n return true\n }\n\n public clearSelection(): void {\n this._applySelection(null, null)\n }\n\n public getGroups(): TheSeamMapFeatureGroup[] {\n return this._registry.groups()\n }\n\n private _boundsForGroup(key: string): google.maps.LatLngBounds | undefined {\n const features = this._registry.featuresIn(key)\n if (features.length === 0) {\n return undefined\n }\n const bounds = new google.maps.LatLngBounds()\n features.forEach((f) =>\n f.getGeometry()?.forEachLatLng((latLng) => bounds.extend(latLng)),\n )\n return bounds\n }\n\n public fitGroup(\n key: string,\n padding?: number | google.maps.Padding,\n ): boolean {\n this._assertInitialized()\n const bounds = this._boundsForGroup(key)\n if (!bounds) {\n return false\n }\n this.googleMap.fitBounds(bounds, padding ?? this._padding)\n return true\n }\n\n public panToGroup(key: string): boolean {\n this._assertInitialized()\n const bounds = this._boundsForGroup(key)\n if (!bounds) {\n return false\n }\n this.googleMap.panTo(bounds.getCenter())\n return true\n }\n\n /**\n * Delete only the polygon the last interaction landed on.\n *\n * Re-applies the selection's group key afterward (with no focused feature)\n * rather than leaving `selection$` holding a `TheSeamMapGroupTarget` whose\n * `feature` no longer exists — `_applySelection` naturally clears to null\n * when the group is now empty, via `groupWithSources`.\n */\n public deleteFocusedFeature(): void {\n this._assertInitialized()\n const key = this._focusedFeature\n ? this._registry.keyOf(this._focusedFeature)\n : (this._selectionSubject.value?.group.key ?? null)\n const contextMenuTargetInGroup =\n key !== null && this._contextMenuTargetSubject.value?.group.key === key\n\n if (this._focusedFeature) {\n this.googleMap.data.remove(this._focusedFeature)\n this._focusedFeature = null\n } else {\n this.deleteSelection()\n }\n\n this._applySelection(key, null)\n // Same reasoning as deleteGroup(): a context-menu target naming this\n // group may now reference a removed feature (or a stale feature count),\n // so clear it — but only when it actually named this group.\n if (contextMenuTargetInGroup) {\n this._contextMenuTargetSubject.next(null)\n }\n }\n\n /** Escape cascades: cancel a draw, then clear selection, then leave edit mode. */\n public handleEscape(): void {\n if (this.isDrawing()) {\n this.stopDrawing()\n this._reapplyCurrentSelection()\n return\n }\n if (this._selectionSubject.value !== null) {\n this.clearSelection()\n return\n }\n if (this.isEditMode()) {\n this.setEditMode(false)\n }\n }\n\n /**\n * `startDrawing()` raw-deselects every feature (via `setFeatureSelected`)\n * without touching `_selectionSubject`, so that `onDrawFinished` can still\n * read `getSelectedKey()` for the group being drawn into. When a draw ends\n * WITHOUT producing a finished feature — cancelled by `Escape` or\n * `setEditMode(false)`, or a `finish` event with no valid geometry — nothing\n * else re-applies those raw flags, so the map renders the selection as gone\n * while `selection$`/`getSelectedKey()` still report it. Call this at every\n * such stopping point to bring the two back in sync.\n *\n * Not called from the successful-finish path in `_onDrawFinished`: that\n * path calls `_applySelection` itself with the new/joined selection, and\n * doing it here first would only add a redundant, momentarily-stale\n * `selectionChange` emission ahead of the real one.\n */\n private _reapplyCurrentSelection(): void {\n if (this._model.id !== 'grouped') {\n return\n }\n const currentKey = this._selectionSubject.value?.group.key ?? null\n this._applySelection(currentKey, this._focusedFeature)\n }\n\n private _initFeatureStyling(): void {\n this._assertInitialized()\n\n this.googleMap.addListener('click', () => {\n // The physical click that closes a polygon can reach this listener\n // TWICE: once (fast) via Terra Draw's own pointer-driven close\n // detection — which is what runs `_onDrawFinished()` / `stopDrawing()`\n // and flips `isDrawing()` false — and, separately, via Google's own\n // `click` recognition on this map, which this listener is bound to\n // directly. By the time that second delivery arrives (confirmed\n // against the live Storybook: consistently a few milliseconds later,\n // comfortably within one animation frame — see\n // .superpowers/closing-click-report.md), `isDrawing()` already reads\n // false, so the guard just below cannot tell it apart from a fresh\n // click on open map. `_suppressNextMapClick` exists to catch exactly\n // that echo; see its doc comment for why a `domEvent.timeStamp`\n // comparison does NOT work here.\n if (this._suppressNextMapClick) {\n this._suppressNextMapClick = false\n return\n }\n // While drawing, a click on open map is placing a vertex, not a map\n // click — mirrors the data 'click' listener's guard just below. Without\n // this, `onMapClick` in 'grouped' mode calls `startDrawing()`, which\n // calls `setMode('polyline')` again and resets the in-progress path.\n if (this.isDrawing()) {\n return\n }\n this._model.onMapClick(this._interactionContext())\n })\n\n this._styleFn = (feature) =>\n computeFeatureStyle(feature, {\n editingEnabled: this.isEditingEnabled(),\n ...this._model.featureFlags(feature, this._interactionContext()),\n })\n this.googleMap.data.setStyle(this._styleFn)\n\n this.googleMap.data.addListener(\n 'click',\n (event: google.maps.Data.MouseEvent) => {\n // While drawing, a click on a polygon is placing a vertex.\n if (this.isDrawing()) {\n return\n }\n this._model.onFeatureClick(event.feature, this._interactionContext())\n },\n )\n\n this.googleMap.data.addListener(\n 'mouseover',\n (event: google.maps.Data.MouseEvent) => {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n\n if (!this.isDrawing() && !isFeatureSelected(event.feature)) {\n this.setFeatureHoveredStyleOverride(event.feature)\n }\n\n const resolved = this._registry.groupWithSources(\n this._registry.keyOf(event.feature),\n )\n this._hoverSubject.next(\n resolved ? this._targetFor(resolved, event.feature) : null,\n )\n },\n )\n\n this.googleMap.data.addListener('mouseout', () => {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n this._hoverSubject.next(null)\n })\n }\n\n public setFeatureHoveredStyleOverride(feature: google.maps.Data.Feature) {\n this._assertInitialized()\n this.googleMap.data.overrideStyle(\n feature,\n computeFeatureHoverStyle(feature),\n )\n }\n\n private _initFeatureChangeListeners(): void {\n this._assertInitialized()\n\n createFeatureChangeObservable(this.googleMap.data, this._ngZone)\n .pipe(\n switchMap(() =>\n from(this.getGeoJson()).pipe(\n tap((geoJson) => {\n this._mapValueManager.setValue(\n geoJson,\n MapValueSource.FeatureChange,\n )\n this._labelsOverlay?.refresh()\n }),\n ),\n ),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this.googleMap.data.addListener(\n 'contextmenu',\n (event: google.maps.Data.MouseEvent) => {\n if (\n !this._model.allowsContextMenu(\n event.feature,\n this._interactionContext(),\n )\n ) {\n return\n }\n this._setContextMenuTarget(event.feature)\n this._openContextMenuForFeature(\n event.feature,\n event.latLng ?? undefined,\n )\n },\n )\n }\n\n /**\n * Establish `feature` as what the context menu is about to open for:\n * `_focusedFeature` (what \"Delete Polygon\" acts on) and\n * `contextMenuTarget$` (what \"Delete Field\" is gated on and acts on) both\n * follow it. Shared by the `contextmenu` mouse listener and\n * `openContextMenu()`'s keyboard path so the two establish the target\n * identically — the menu's target must always be the feature the menu was\n * opened for, on either path. Before this, only the mouse listener set\n * `contextMenuTarget$`, so pressing the `ContextMenu` key could open a menu\n * over whatever was CURRENTLY selected while still offering \"Delete Field\"\n * for whatever a PRIOR right-click had targeted.\n */\n private _setContextMenuTarget(feature: google.maps.Data.Feature): void {\n this._focusedFeature = feature\n const resolved = this._registry.groupWithSources(\n this._registry.keyOf(feature),\n )\n this._contextMenuTargetSubject.next(\n resolved ? this._targetFor(resolved, feature) : null,\n )\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public hasSelectedFeature(): boolean {\n this._assertInitialized()\n let isSelected = false\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n isSelected = true\n }\n })\n return isSelected\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public getSelectedFeature(): google.maps.Data.Feature | null {\n this._assertInitialized()\n let feature: google.maps.Data.Feature | null = null\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n feature = f\n }\n })\n return feature\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public openContextMenu(): void {\n const feature = this.getSelectedFeature()\n if (\n feature &&\n this._model.allowsContextMenu(feature, this._interactionContext())\n ) {\n this._setContextMenuTarget(feature)\n this._openContextMenuForFeature(feature)\n }\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public closeContextMenu(): void {\n if (this._activeContextMenu) {\n this._activeContextMenu.close()\n this._activeContextMenu = null\n }\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n private _openContextMenuForFeature(\n feature: google.maps.Data.Feature,\n position?: google.maps.LatLng,\n ) {\n this.closeContextMenu()\n\n this._assertInitialized()\n\n let _position = position\n if (!_position) {\n _position = getFeatureCenter(feature)\n }\n if (this._featureContextMenu) {\n this._activeContextMenu = new GoogleMapsContextMenu(\n this.googleMap,\n this._featureContextMenu,\n _position,\n this._vcr,\n this._ngZone,\n this.googleMap.data,\n feature,\n )\n }\n }\n\n public getGeoJson(removeAppProperties: boolean = true): Promise<object> {\n return new Promise((resolve, reject) => {\n this._assertInitialized()\n this.googleMap.data.toGeoJson((f) => {\n if (removeAppProperties) {\n stripAppFeaturePropertiesFromJson(f)\n }\n resolve(f)\n })\n })\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n GoogleMapsService,\n 'googleMap'\n > {\n if (!this.googleMap && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n\n /**\n * Arm `_suppressNextMapClick`, and guarantee it cannot linger forever if\n * the echo it exists for never arrives — confirmed to be the normal case\n * for most real closes, and true of every synthetic/`play()`-driven draw,\n * per .superpowers/closing-click-report.md. A `setTimeout` would \"solve\"\n * this by guessing a safe wall-clock delay, which is exactly the kind of\n * timing window this fix is trying to avoid introducing. Two\n * `requestAnimationFrame` callbacks bound the window instead: the observed\n * echo arrives a few milliseconds after `stopDrawing()`, comfortably\n * inside a single frame, so two frames is generous headroom without\n * guessing at a duration — and two real user actions (even fast automated\n * ones) are never going to land within two animation frames of each other,\n * so an unrelated later click is never at risk of being swallowed.\n */\n private _armMapClickSuppression(): void {\n this._suppressNextMapClick = true\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this._suppressNextMapClick = false\n })\n })\n }\n\n private _onDrawFinished(id: string | number): void {\n // Armed first, before any other work below — including the early return\n // for a draw that produced no usable geometry — since the closing\n // click's late echo (see `_suppressNextMapClick`'s doc comment) can\n // follow either outcome.\n this._armMapClickSuppression()\n const feature = this._terraDraw?.getSnapshotFeature(id)\n this._terraDraw?.removeFeatures([id])\n this.stopDrawing()\n\n const drawn = feature ? this._toDrawnPolygon(feature.geometry) : undefined\n if (!drawn || !polygonHasMinDistinctVertices(drawn, 3)) {\n // A 'finish' event that produced no usable geometry is, for selection\n // purposes, a cancelled draw — see _reapplyCurrentSelection().\n this._reapplyCurrentSelection()\n return\n }\n\n this._assertInitialized()\n\n const context = this._interactionContext()\n const outcome = this._model.onDrawFinished(drawn, context)\n\n if (outcome.kind === 'hole' && applyHoleToFeature(outcome.target, drawn)) {\n this._applySelection(this._registry.keyOf(outcome.target), outcome.target)\n this._labelsOverlay?.refresh()\n return\n }\n\n const newFeature = new google.maps.Data.Feature({\n geometry: dataPolygonFromGeoJson(drawn),\n })\n this.googleMap.data.add(newFeature)\n\n const key =\n outcome.kind === 'newFeature' && outcome.groupKey !== null\n ? (this._registry.assignKey(newFeature, outcome.groupKey),\n outcome.groupKey)\n : this._registry.assignNewKey(newFeature)\n\n this._applySelection(key, newFeature)\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Normalize a finished Terra Draw geometry into a Polygon. A Polygon (the\n * user closed the line on its start point) passes through; an open LineString\n * (the user finished without closing) is closed into a polygon so nothing\n * they drew is discarded. Any other geometry type yields undefined.\n */\n private _toDrawnPolygon(geometry: Geometry): Polygon | undefined {\n if (geometry.type === 'Polygon') {\n return geometry\n }\n if (geometry.type === 'LineString') {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: [[...geometry.coordinates]],\n }\n closePolygons(polygon)\n return polygon\n }\n return undefined\n }\n}\n","import {\n ComponentRef,\n Injectable,\n Injector,\n StaticProvider,\n ViewContainerRef,\n} from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nimport { GoogleMapsService } from './google-maps.service'\nimport {\n MapControl,\n MapControlsService,\n MAP_CONTROL_DATA,\n} from './map-controls-service'\n\nexport class MapControlRef {\n private readonly _destroyedSubject = new Subject<void>()\n\n private _componentRef: ComponentRef<any>\n private _addedAtPosition: google.maps.ControlPosition\n\n public destroyed: Observable<void>\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n private readonly _injector: Injector,\n private readonly _controlDef: MapControl,\n private readonly _viewContainerRef: ViewContainerRef,\n ) {\n this.destroyed = this._destroyedSubject.asObservable()\n\n const component: any = this._controlDef.component\n // const factory = this._componentFactoryResolver.resolveComponentFactory(component)\n\n const providers: StaticProvider[] = []\n if (this._controlDef.data) {\n providers.push({\n provide: MAP_CONTROL_DATA,\n useValue: this._controlDef.data,\n })\n }\n const injector = Injector.create({\n providers,\n parent: this._injector,\n })\n\n // this._componentRef = factory.create(injector)\n this._componentRef = this._viewContainerRef.createComponent(component, {\n index: this._viewContainerRef.length,\n injector,\n })\n this._componentRef.changeDetectorRef.detectChanges()\n\n const position =\n this._controlDef.position ?? google.maps.ControlPosition.LEFT_BOTTOM\n\n this._googleMaps.addControl(\n this._componentRef.location.nativeElement,\n position,\n )\n\n this._addedAtPosition = position\n }\n\n public destroy() {\n const googleMaps = this._googleMaps.googleMap\n if (googleMaps !== undefined) {\n let idx = -1\n googleMaps.controls[this._addedAtPosition].forEach((elem, index) => {\n if (elem === this._componentRef.location.nativeElement) {\n idx = index\n }\n })\n if (idx === -1) {\n throw Error(`Unable to destroy control. Control not found.`)\n }\n googleMaps.controls[this._addedAtPosition].removeAt(idx)\n }\n this._componentRef.destroy()\n\n this._destroyedSubject.next()\n this._destroyedSubject.complete()\n }\n}\n\n@Injectable()\nexport class GoogleMapsControlsService implements MapControlsService {\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n private readonly _injector: Injector,\n private readonly _viewContainerRef: ViewContainerRef,\n ) {}\n\n public add(control: MapControl): MapControlRef {\n return new MapControlRef(\n this._googleMaps,\n this._injector,\n control,\n this._viewContainerRef,\n )\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n} from '@angular/core'\nimport { toSignal } from '@angular/core/rxjs-interop'\n\nimport { faDrawPolygon } from '@fortawesome/free-solid-svg-icons'\nimport { SeamIcon, TheSeamIconModule } from '@theseam/ui-common/icon'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\n\nexport interface GoogleMapsDrawButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-draw-button-control]',\n templateUrl: './google-maps-draw-button-control.component.html',\n styleUrls: ['./google-maps-draw-button-control.component.scss'],\n imports: [TheSeamIconModule],\n host: {\n '(click)': '_onClick()',\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n '[attr.aria-pressed]': '_active()',\n '[class.active]': '_active()',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TheSeamGoogleMapsDrawButtonControlComponent {\n private readonly _googleMaps = inject(GoogleMapsService)\n private readonly _data = inject<GoogleMapsDrawButtonControlData>(\n MAP_CONTROL_DATA,\n { optional: true },\n )\n\n private readonly _mode = toSignal(this._googleMaps.interactionMode$, {\n initialValue: 'legacy' as const,\n })\n\n private readonly _drawing = toSignal(this._googleMaps.drawing$, {\n initialValue: false,\n })\n\n private readonly _editMode = toSignal(this._googleMaps.editMode$, {\n initialValue: false,\n })\n\n /**\n * In 'legacy' the button toggles drawing directly. In 'grouped' it toggles\n * edit mode, which is what makes a click on open map begin a drawing.\n */\n protected readonly _active = computed(() =>\n this._mode() === 'grouped' ? this._editMode() : this._drawing(),\n )\n\n protected readonly _label = computed(\n () =>\n this._data?.label ??\n (this._mode() === 'grouped' ? 'Edit Fields' : 'Draw Field'),\n )\n\n get label(): string {\n return this._label()\n }\n\n icon: SeamIcon = this._data?.icon ?? faDrawPolygon\n\n _onClick() {\n if (this._mode() === 'grouped') {\n this._googleMaps.setEditMode(!this._googleMaps.isEditMode())\n return\n }\n if (this._googleMaps.isDrawing()) {\n this._googleMaps.stopDrawing()\n } else {\n this._googleMaps.startDrawing()\n }\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n Inject,\n Input,\n OnDestroy,\n Optional,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\n\nimport { SeamIcon } from '@theseam/ui-common/icon'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\n\nexport interface GoogleMapsRecenterButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n/**\n *\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-recenter-button-control]',\n templateUrl: './google-maps-recenter-button-control.component.html',\n styleUrls: ['./google-maps-recenter-button-control.component.scss'],\n host: {\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamGoogleMapsRecenterButtonControlComponent\n implements OnDestroy\n{\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _listeners: (() => void)[] = []\n\n @Input() label: string | undefined | null\n\n @Input() icon: SeamIcon | undefined | null\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._googleMaps.reCenterOnFeatures()\n }\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n @Optional()\n @Inject(MAP_CONTROL_DATA)\n _data?: GoogleMapsRecenterButtonControlData,\n ) {\n if (_data) {\n if (Object.prototype.hasOwnProperty.call(_data, 'label')) {\n this.label = _data.label\n }\n if (Object.prototype.hasOwnProperty.call(_data, 'icon')) {\n this.icon = _data.icon\n }\n }\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._listeners.forEach((l) => l())\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n Inject,\n Input,\n OnDestroy,\n Optional,\n Renderer2,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\n\nimport { SeamIcon } from '@theseam/ui-common/icon'\nimport { readGeoFile } from '@theseam/ui-common/utils'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\n\nexport interface GoogleMapsUploadButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n/**\n *\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-upload-button-control]',\n templateUrl: './google-maps-upload-button-control.component.html',\n styleUrls: ['./google-maps-upload-button-control.component.scss'],\n host: {\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamGoogleMapsUploadButtonControlComponent\n implements OnDestroy\n{\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private readonly _fileInputElement: HTMLInputElement\n\n private _listeners: (() => void)[] = []\n\n @Input() label: string | undefined | null\n\n @Input() icon: SeamIcon | undefined | null\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._fileInputElement.click()\n }\n\n constructor(\n private readonly _elementRef: ElementRef,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _renderer: Renderer2,\n private readonly _googleMaps: GoogleMapsService,\n @Optional()\n @Inject(MAP_CONTROL_DATA)\n _data?: GoogleMapsUploadButtonControlData,\n ) {\n if (_data) {\n if (Object.prototype.hasOwnProperty.call(_data, 'label')) {\n this.label = _data.label\n }\n if (Object.prototype.hasOwnProperty.call(_data, 'icon')) {\n this.icon = _data.icon\n }\n }\n\n this._fileInputElement = this._createHiddenInput()\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this._fileInputElement,\n )\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._listeners.forEach((l) => l())\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _getFile(throwIfInvalidFiles: boolean = true): File | null {\n const files = this._fileInputElement.files\n if (files === null || files.length === 0) {\n return null\n }\n\n if (throwIfInvalidFiles) {\n if (files.length > 1) {\n throw Error(`Only one file can be imported at a time.`)\n }\n }\n\n return files[0]\n }\n\n private async _importFile(file: File): Promise<void> {\n const json = await readGeoFile(file)\n this._mapValueManager.setValue(json, MapValueSource.Input)\n this._resetInput()\n }\n\n private _createHiddenInput(): HTMLInputElement {\n const fileInputElement = this._renderer.createElement('input')\n this._renderer.setAttribute(fileInputElement, 'type', 'file')\n this._renderer.setAttribute(fileInputElement, 'hidden', '')\n this._renderer.setAttribute(\n fileInputElement,\n 'accept',\n '.json,.geojson,.shp,.zip',\n )\n\n this._listeners.push(\n this._renderer.listen(fileInputElement, 'change', (event: Event) => {\n const file = this._getFile()\n if (file === null) {\n return\n }\n const fileImportHandler = this._googleMaps.getFileInputHandler()\n if (fileImportHandler) {\n fileImportHandler(file)\n } else {\n this._importFile(file)\n }\n }),\n )\n\n return fileInputElement\n }\n\n private _createTemporaryFormElement(): HTMLFormElement {\n return this._renderer.createElement('form')\n }\n\n /**\n * Reset input element, so that the same file can be added again.\n */\n private _resetInput(): void {\n const formElement = this._createTemporaryFormElement()\n this._renderer.appendChild(formElement, this._fileInputElement)\n formElement.reset()\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this._fileInputElement,\n )\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import { Observable } from 'rxjs'\n\nexport abstract class TheSeamGoogleMapsApiLoader {\n abstract load(): Observable<void>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n NgZone,\n OnDestroy,\n OnInit,\n Renderer2,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil, tap } from 'rxjs/operators'\n\nimport { readGeoFile } from '@theseam/ui-common/utils'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\n\n/**\n *\n */\n@Component({\n selector: 'seam-map-file-drop',\n templateUrl: './map-file-drop.component.html',\n styleUrls: ['./map-file-drop.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamMapFileDropComponent implements OnInit, OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n /**\n * Map element drag events added to.\n */\n private _mapDiv: HTMLDivElement | undefined\n\n private _listeners: (() => void)[] = []\n\n private _globalDragInProgress = false\n\n constructor(\n private readonly _elementRef: ElementRef,\n private readonly _ngZone: NgZone,\n private readonly _googleMaps: GoogleMapsService,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _renderer: Renderer2,\n ) {}\n\n /** @ignore */\n ngOnInit() {\n this._googleMaps.mapReady$\n .pipe(\n tap((ready) => {\n if (ready) {\n this._enableFileDrop()\n } else {\n this._disableFileDrop()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._disableFileDrop()\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _enableFileDrop(): void {\n const divElement = this._googleMaps.getDiv()\n if (this._mapDiv === divElement) {\n return\n }\n\n if (this._mapDiv !== undefined) {\n // Disable file drop on previous map div.\n this._disableFileDrop()\n }\n\n this._mapDiv = divElement\n this._ngZone.runOutsideAngular(() => {\n this._listeners.push(\n this._renderer.listen('document', 'dragstart', (event: Event) => {\n this._globalDragInProgress = true\n }),\n )\n\n this._listeners.push(\n this._renderer.listen('document', 'dragend', (event: Event) => {\n this._globalDragInProgress = false\n }),\n )\n\n this._listeners.push(\n this._renderer.listen(\n divElement,\n 'dragover',\n this._handleDragOverEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'dragover',\n this._handleDragOverEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'drop',\n this._handleDropEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n divElement,\n 'dragenter',\n this._handleDragEnterEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'dragleave',\n this._handleDragLeaveEvent,\n ),\n )\n })\n }\n\n private _disableFileDrop(): void {\n if (this._listeners.length > 0) {\n this._listeners.forEach((l) => l())\n this._listeners = []\n }\n }\n\n private readonly _handleDragOverEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n if (!this._isSupportedDataTransferTypes(event.dataTransfer)) {\n return\n }\n\n event.preventDefault()\n event.dataTransfer.dropEffect = 'copy'\n }\n\n private readonly _handleDropEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'none')\n\n // TODO: Show error if multiple files?\n if (!this._isSupportedDataTransfer(event.dataTransfer)) {\n return\n }\n\n const item = event.dataTransfer.items[0]\n const file = item.getAsFile()\n readGeoFile(file).then((json) => {\n this._mapValueManager.setValue(json, MapValueSource.Input)\n })\n }\n\n private readonly _handleDragEnterEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n if (!this._isSupportedDataTransferTypes(event.dataTransfer)) {\n return\n }\n\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'block')\n }\n\n private readonly _handleDragLeaveEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'none')\n }\n\n private _dropAllowed(): boolean {\n return !this._globalDragInProgress\n }\n\n private _isSupportedDataTransfer(dataTransfer: DataTransfer): boolean {\n return dataTransfer.files.length === 1 && dataTransfer.types[0] === 'Files'\n }\n\n private _isSupportedDataTransferTypes(dataTransfer: DataTransfer): boolean {\n return dataTransfer.types[0] === 'Files'\n }\n}\n","","import { OnInit } from '@angular/core'\nimport {\n ChangeDetectionStrategy,\n Component,\n Inject,\n Input,\n OnDestroy,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil, tap } from 'rxjs/operators'\n\nimport {\n GoogleMapsControlsService,\n MapControlRef,\n} from './google-maps-controls.service'\nimport { GoogleMapsService } from './google-maps.service'\nimport { MapControl, MAP_CONTROLS_SERVICE } from './map-controls-service'\n\n@Component({\n selector: 'seam-map-control',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamMapsControlComponent implements OnInit, OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _controlRef?: MapControlRef\n\n @Input()\n set def(value: MapControl | null | undefined) {\n if (value !== this._def) {\n this._remove()\n this._def = value\n }\n }\n _def: MapControl | null | undefined\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n @Inject(MAP_CONTROLS_SERVICE)\n private readonly _googleMapsControls: GoogleMapsControlsService,\n ) {}\n\n /** @ignore */\n ngOnInit(): void {\n this._googleMaps.mapReady$\n .pipe(\n tap((ready) => {\n if (ready) {\n this._add()\n } else {\n this._remove()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n /** @ignore */\n ngOnDestroy(): void {\n this._remove()\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _add(): void {\n if (this._controlRef) {\n return\n }\n\n if (this._def === null || this._def === undefined) {\n return\n }\n\n this._controlRef = this._googleMapsControls.add(this._def)\n }\n\n private _remove(): void {\n this._controlRef?.destroy()\n this._controlRef = undefined\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y'\nimport {\n BooleanInput,\n coerceBooleanProperty,\n coerceNumberProperty,\n NumberInput,\n} from '@angular/cdk/coercion'\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { combineLatest, fromEvent, Observable, of, Subject } from 'rxjs'\nimport { catchError, map, skip, takeUntil, tap } from 'rxjs/operators'\n\nimport { faCrosshairs, faFileImport } from '@fortawesome/free-solid-svg-icons'\nimport {\n CanDisable,\n CanDisableCtor,\n InputBoolean,\n InputNumber,\n mixinDisabled,\n} from '@theseam/ui-common/core'\nimport { MenuComponent } from '@theseam/ui-common/menu'\n\nimport {\n TheSeamMapFeatureGroup,\n TheSeamMapGroupTarget,\n} from '../feature-groups/feature-group'\nimport { TheSeamGoogleMapsApiLoader } from '../google-maps-api-loader/google-maps-api-loader'\nimport { GoogleMapsControlsService } from '../google-maps-controls.service'\nimport { TheSeamGoogleMapsDrawButtonControlComponent } from '../google-maps-draw-button-control/google-maps-draw-button-control.component'\nimport { TheSeamGoogleMapsRecenterButtonControlComponent } from '../google-maps-recenter-button-control/google-maps-recenter-button-control.component'\nimport { TheSeamGoogleMapsUploadButtonControlComponent } from '../google-maps-upload-button-control/google-maps-upload-button-control.component'\nimport { GoogleMapsService } from '../google-maps.service'\nimport { TheSeamMapInteractionMode } from '../interaction/interaction-mode'\nimport { MapControl, MAP_CONTROLS_SERVICE } from '../map-controls-service'\nimport {\n MapValue,\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\n\ndeclare const ngDevMode: boolean | undefined\n\ninterface TheSeamMapContextMenuItem {\n label: string\n action: (item: TheSeamMapContextMenuItem) => void\n}\n\nclass TheSeamGoogleMapsComponentBase {\n constructor(public _elementRef: ElementRef) {}\n}\n\nconst _TheSeamGoogleMapsMixinBase: CanDisableCtor &\n typeof TheSeamGoogleMapsComponentBase = mixinDisabled(\n TheSeamGoogleMapsComponentBase,\n)\n\n/**\n * A wrapper for googlemap.\n */\n@Component({\n selector: 'seam-google-maps',\n templateUrl: './google-maps.component.html',\n styleUrls: ['./google-maps.component.scss'],\n inputs: ['disabled'],\n providers: [\n MapValueManagerService,\n GoogleMapsService,\n { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },\n {\n provide: NG_VALUE_ACCESSOR,\n\n useExisting: forwardRef(() => TheSeamGoogleMapsComponent),\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'seamGoogleMaps',\n standalone: false,\n})\nexport class TheSeamGoogleMapsComponent\n extends _TheSeamGoogleMapsMixinBase\n implements OnInit, OnDestroy, OnChanges, CanDisable, ControlValueAccessor\n{\n static ngAcceptInputType_disabled: BooleanInput\n static ngAcceptInputType_zoom: NumberInput\n static ngAcceptInputType_longitude: NumberInput\n static ngAcceptInputType_latitude: NumberInput\n static ngAcceptInputType_fileDropEnabled: BooleanInput\n static ngAcceptInputType_fileUploadControlEnabled: BooleanInput\n static ngAcceptInputType_fullscreenControlEnabled: BooleanInput\n static ngAcceptInputType_reCenterControlEnabled: BooleanInput\n static ngAcceptInputType_mapTypeControlEnabled: BooleanInput\n static ngAcceptInputType_streetViewControlEnabled: BooleanInput\n static ngAcceptInputType_allowDrawingHoleInPolygon: BooleanInput\n static ngAcceptInputType_editingEnabled: BooleanInput\n static ngAcceptInputType_selectedGroupKey: string | null\n\n private readonly _changeDetectorRef = inject(ChangeDetectorRef)\n\n private readonly _ngUnsubscribe = new Subject<void>()\n\n readonly _gmApiLoaded: Observable<boolean>\n\n readonly _fileUploadControlDef: MapControl = {\n component: TheSeamGoogleMapsUploadButtonControlComponent,\n data: { label: 'Import Geo File', icon: faFileImport },\n position: 6 /* google.maps.ControlPosition.LEFT_BOTTOM */,\n }\n\n readonly _reCenterControlDef: MapControl = {\n component: TheSeamGoogleMapsRecenterButtonControlComponent,\n data: { label: 'Center on Field', icon: faCrosshairs },\n position: 9 /* google.maps.ControlPosition.RIGHT_BOTTOM */,\n }\n\n readonly _drawControlDef: MapControl = {\n component: TheSeamGoogleMapsDrawButtonControlComponent,\n position: 1 /* google.maps.ControlPosition.TOP_LEFT */,\n }\n\n private _focusOrigin: FocusOrigin = null\n\n @Input()\n set value(value: MapValue) {\n this._mapValueManager.setValue(value, MapValueSource.Input)\n }\n get value(): MapValue {\n return this._mapValueManager.value\n }\n\n @Input()\n set tabIndex(value: number) {\n this._tabIndex = coerceNumberProperty(value)\n }\n get tabIndex(): number {\n return this._tabIndex\n }\n /**\n * Set the tab index to `-1` to allow the root element of the\n * component to receive `focus` event from javascript, but not get focused by\n * keyboard navigation.\n */\n private _tabIndex = -1\n\n @Input() @InputBoolean() fileDropEnabled = true\n\n @Input() @InputBoolean() fileUploadControlEnabled = false\n @Input() @InputBoolean() fullscreenControlEnabled = true\n @Input() @InputBoolean() reCenterControlEnabled = true\n @Input() @InputBoolean() mapTypeControlEnabled = true\n @Input() @InputBoolean() streetViewControlEnabled = false\n\n @Input() @InputBoolean() allowDrawingHoleInPolygon = false\n\n @Input() @InputBoolean() editingEnabled = true\n\n @Input()\n set fileImportHandler(value: ((file: File) => void) | undefined | null) {\n this._googleMaps.setFileInputHandler(value)\n }\n\n @HostBinding('attr.disabled')\n get _attrDisabled() {\n return this.disabled || null\n }\n\n @HostBinding('attr.tabindex')\n get _attrTabIndex() {\n return this.disabled ? -1 : this.tabIndex || 0\n }\n\n onChange: any\n onTouched: any\n\n @Input() @InputNumber() zoom = 14\n @Input() @InputNumber() longitude = -98.570209\n @Input() @InputNumber() latitude = 37.633814\n\n @Input() padding: number | google.maps.Padding | undefined = 0\n\n /**\n * Which interaction model the map uses.\n *\n * `'legacy'` is the single-boundary behaviour this component has always had\n * and is the default, so existing consumers are unaffected. `'grouped'`\n * separates selection from geometry editing; see the design doc.\n */\n @Input() interactionMode: TheSeamMapInteractionMode = 'legacy'\n\n /**\n * Name of the GeoJSON property that groups features into one logical thing,\n * such as a field. Features sharing a value select, style, and edit together.\n * Unset means every feature is its own group.\n */\n @Input() featureGroupProperty: string | undefined\n\n /** Name of the GeoJSON property holding a group's label text. */\n @Input() featureLabelProperty: string | undefined\n\n /**\n * Generates the key written to `featureGroupProperty` for a newly drawn\n * group. Consumer-supplied so the format is one the app recognises.\n */\n @Input() newGroupKeyFactory: (() => string) | undefined\n\n /** Preselect a group. Applied on map-ready and after each external value write. */\n @Input() selectedGroupKey: string | null = null\n\n @Output() mapReady = new EventEmitter<google.maps.Map | undefined>()\n\n @Output() selectionChange = new EventEmitter<TheSeamMapGroupTarget | null>()\n @Output() featureHoverChange =\n new EventEmitter<TheSeamMapGroupTarget | null>()\n\n @ViewChild('featureContextMenu', { static: true, read: MenuComponent })\n public featureContextMenu!: MenuComponent\n\n _options = {\n mapTypeControl: true,\n mapTypeId: 'hybrid',\n streetViewControl: false,\n fullscreenControl: this.fullscreenControlEnabled,\n }\n\n readonly _contextMenuItems$: Observable<TheSeamMapContextMenuItem[]>\n\n private idleListener: google.maps.MapsEventListener | undefined\n\n constructor(\n readonly elementRef: ElementRef,\n private readonly _focusMonitor: FocusMonitor,\n private readonly _googleMaps: GoogleMapsService,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _googleMapsApiLoader: TheSeamGoogleMapsApiLoader,\n ) {\n super(elementRef)\n\n this._focusMonitor\n .monitor(this._elementRef, true)\n .pipe(\n tap((origin) => {\n this._focusOrigin = origin\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._mapValueManager.valueChanged\n .pipe(\n tap((change) => {\n if (this.onChange) {\n this.onChange(change.value)\n }\n if (this.onTouched) {\n this.onTouched()\n }\n }),\n tap((changed) => {\n if (\n this._googleMaps.mapReady &&\n changed.source !== MapValueSource.FeatureChange\n ) {\n this._googleMaps.setData(changed.value)\n this._applySelectedGroupKey()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n // `skip(1)` drops the value these BehaviorSubject-backed streams replay on\n // subscribe. An Angular `@Output` should fire when something changes, not\n // when someone starts listening — without this, a consumer binding\n // `(selectionChange)` receives a `null` before the user has interacted at\n // all, which reads as \"the selection was cleared\" and can wrongly reset a\n // panel or dirty a form on open. The subscription happens in the\n // constructor, when the replayed value is always the initial `null`, so\n // nothing real is ever skipped.\n this._googleMaps.selection$\n .pipe(\n skip(1),\n tap((selection) => this.selectionChange.emit(selection)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._googleMaps.hover$\n .pipe(\n skip(1),\n tap((hover) => this.featureHoverChange.emit(hover)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._contextMenuItems$ = combineLatest([\n this._googleMaps.editingEnabled$,\n // The RIGHT-CLICKED feature's group. In 'grouped' mode the menu now\n // only opens when that group is already the selection (see\n // `GroupedInteractionModel.allowsContextMenu()`), so this and\n // `selection$` always agree here — but this is still the one that\n // names what \"Delete Field\" is conceptually acting on, independent of\n // that coincidence. See `contextMenuTarget$`'s doc comment.\n this._googleMaps.contextMenuTarget$,\n ]).pipe(\n map(([enabled, target]) => {\n const items: TheSeamMapContextMenuItem[] = []\n if (!enabled) {\n return items\n }\n if (this.interactionMode === 'grouped') {\n items.push({\n label: 'Delete Polygon',\n action: () => this._googleMaps.deleteFocusedFeature(),\n })\n if (target && target.group.features.length > 1) {\n items.push({\n label: 'Delete Field',\n action: () => this._googleMaps.deleteGroup(target.group.key),\n })\n }\n return items\n }\n items.push({\n label: 'Delete',\n action: () => this._onClickDeleteFeature(),\n })\n return items\n }),\n tap((items) => {\n if (items.length === 0) {\n this._googleMaps.setFeatureContextMenu(null)\n } else {\n this._googleMaps.setFeatureContextMenu(this.featureContextMenu)\n }\n }),\n )\n\n this._googleMaps.setBaseLatLng(this.latitude, this.longitude)\n\n this._googleMaps.setPadding(this.padding)\n\n this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(\n map(() => true),\n catchError(() => of(false)),\n )\n }\n\n ngOnInit() {\n fromEvent<KeyboardEvent>(window, 'keydown')\n .pipe(\n tap((event: KeyboardEvent) => {\n switch (event.code) {\n case 'Delete':\n if (this._googleMaps.isEditingEnabled()) {\n if (this.interactionMode === 'grouped') {\n this._googleMaps.deleteFocusedFeature()\n } else {\n this._googleMaps.deleteSelection()\n }\n event.preventDefault()\n event.stopPropagation()\n }\n break\n case 'Escape':\n if (this.interactionMode === 'grouped') {\n this._googleMaps.handleEscape()\n } else {\n // Legacy parity: `handleEscape()`'s cascade also clears a\n // selection, but in legacy mode clicking a feature populates\n // the selection, so that would newly deselect it (and drop\n // its vertex handles) on a key that previously only cancelled\n // a draw. Two apps depend on legacy behaviour unchanged, so\n // keep the narrower pre-existing call here.\n this._googleMaps.stopDrawing()\n }\n event.preventDefault()\n event.stopPropagation()\n break\n case 'ContextMenu':\n this._googleMaps.openContextMenu()\n event.preventDefault()\n event.stopPropagation()\n break\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef)\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n let updateBase = false\n if (Object.prototype.hasOwnProperty.call(changes, 'latitude')) {\n this.latitude = changes.latitude.currentValue\n updateBase = true\n }\n if (Object.prototype.hasOwnProperty.call(changes, 'longitude')) {\n this.longitude = changes.longitude.currentValue\n updateBase = true\n }\n if (updateBase) {\n this._googleMaps.setBaseLatLng(this.latitude, this.longitude)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'allowDrawingHoleInPolygon')\n ) {\n this._googleMaps.allowDrawingHoleInPolygon(this.allowDrawingHoleInPolygon)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'fullscreenControlEnabled')\n ) {\n const fullscreenControl = coerceBooleanProperty(\n changes.fullscreenControlEnabled.currentValue,\n )\n if (fullscreenControl !== this._options.fullscreenControl) {\n this._options = {\n ...this._options,\n fullscreenControl,\n }\n }\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {\n this._googleMaps.setEditingEnabled(this.editingEnabled)\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {\n this._googleMaps.setPadding(this.padding)\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'interactionMode')) {\n this._googleMaps.setInteractionMode(this.interactionMode)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'featureGroupProperty') ||\n Object.prototype.hasOwnProperty.call(changes, 'newGroupKeyFactory')\n ) {\n this._googleMaps.setGroupOptions({\n groupProperty: this.featureGroupProperty,\n newGroupKeyFactory: this.newGroupKeyFactory,\n })\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'selectedGroupKey')) {\n this._applySelectedGroupKey()\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'featureLabelProperty')) {\n this._googleMaps.setLabelProperty(this.featureLabelProperty)\n }\n }\n\n private _applySelectedGroupKey(): void {\n if (!this._googleMaps.mapReady) {\n return\n }\n if (this.selectedGroupKey === null) {\n this._googleMaps.clearSelection()\n return\n }\n if (!this._googleMaps.selectGroup(this.selectedGroupKey)) {\n // The named group is not in the current value. Clearing keeps the map\n // and the consumer's expectation from silently diverging.\n this._googleMaps.clearSelection()\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.warn(\n `[seam-google-maps] selectedGroupKey \"${this.selectedGroupKey}\" ` +\n `matches no group in the current value.`,\n )\n }\n }\n }\n\n writeValue(value: MapValue): void {\n this.value = value\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled = isDisabled\n this._changeDetectorRef.markForCheck()\n }\n\n public fitBounds(\n bounds: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n padding?: number | google.maps.Padding,\n ): void {\n this._googleMaps.fitBounds(bounds, padding)\n }\n\n public getGeoJson(): Promise<object> {\n return this._googleMaps.getGeoJson()\n }\n\n public hasFocus(): boolean {\n return this._focusOrigin !== null && this._focusOrigin !== undefined\n }\n\n /** Focuses the button. */\n public focus(): void {\n this._getHostElement().focus()\n }\n\n private _getHostElement() {\n return this._elementRef.nativeElement\n }\n\n _onMapReady(theMap: google.maps.Map) {\n this._googleMaps.setMap(theMap)\n this._googleMaps.setData(this._mapValueManager.value)\n\n // NOTE: The input zoom level was getting reset after this function ran,\n // so putting in this idle listener to wait until the map is fully rendered\n // to set the zoom.\n // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes\n // will display correctly\n this.idleListener = this._googleMaps.googleMap?.addListener('idle', () => {\n this._googleMaps.googleMap?.setZoom(this.zoom)\n this._googleMaps.reCenterOnFeatures()\n this._googleMaps.setInteractionMode(this.interactionMode)\n this._googleMaps.setGroupOptions({\n groupProperty: this.featureGroupProperty,\n newGroupKeyFactory: this.newGroupKeyFactory,\n })\n this._googleMaps.setLabelProperty(this.featureLabelProperty)\n this._applySelectedGroupKey()\n this.mapReady.emit(this._googleMaps.googleMap)\n\n this.idleListener?.remove()\n })\n }\n\n _onClickDeleteFeature() {\n this._googleMaps.deleteSelection()\n }\n\n // The service delegates below guard on `mapReady` themselves, the same way\n // `_applySelectedGroupKey()` already does for the declarative\n // `selectedGroupKey` input. Their service-side counterparts call\n // `_assertInitialized()` and throw when the map hasn't finished loading;\n // this component's public surface is documented as non-throwing (an\n // unknown key returns `false` and changes nothing), so \"not ready yet\"\n // must behave the same way, not worse.\n\n /** Select a group by key. Returns false when no such group exists. */\n public selectGroup(key: string): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.selectGroup(key)\n }\n\n public clearSelection(): void {\n if (!this._googleMaps.mapReady) {\n return\n }\n this._googleMaps.clearSelection()\n }\n\n /** Fit the viewport to a group. Returns false when no such group exists. */\n public fitGroup(\n key: string,\n padding?: number | google.maps.Padding,\n ): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.fitGroup(key, padding)\n }\n\n /** Pan to a group's centre. Returns false when no such group exists. */\n public panToGroup(key: string): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.panToGroup(key)\n }\n\n public getGroups(): TheSeamMapFeatureGroup[] {\n if (!this._googleMaps.mapReady) {\n return []\n }\n return this._googleMaps.getGroups()\n }\n\n public setEditMode(enabled: boolean): void {\n this._googleMaps.setEditMode(enabled)\n }\n\n public isEditMode(): boolean {\n return this._googleMaps.isEditMode()\n }\n}\n","<ng-container *ngIf=\"_gmApiLoaded | async\">\n <google-map\n height=\"100%\"\n width=\"100%\"\n [center]=\"{ lat: latitude, lng: longitude }\"\n [zoom]=\"zoom\"\n [options]=\"_options\"\n (mapInitialized)=\"_onMapReady($any($event))\"\n >\n </google-map>\n</ng-container>\n<seam-menu #featureContextMenu>\n <button\n seamMenuItem\n *ngFor=\"let item of _contextMenuItems$ | async\"\n (click)=\"item.action(item)\"\n >\n {{ item.label }}\n </button>\n</seam-menu>\n<seam-map-file-drop *ngIf=\"fileDropEnabled\"></seam-map-file-drop>\n\n<seam-map-control\n *ngIf=\"fileUploadControlEnabled\"\n [def]=\"_fileUploadControlDef\"\n></seam-map-control>\n<seam-map-control\n *ngIf=\"reCenterControlEnabled\"\n [def]=\"_reCenterControlDef\"\n></seam-map-control>\n<seam-map-control\n *ngIf=\"editingEnabled\"\n [def]=\"_drawControlDef\"\n></seam-map-control>\n","import {\n Directive,\n ElementRef,\n HostBinding,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n} from '@angular/core'\nimport { interval, Observable, Subject, Subscriber } from 'rxjs'\nimport {\n filter,\n mapTo,\n startWith,\n switchMap,\n take,\n takeUntil,\n} from 'rxjs/operators'\n\ndeclare const ngDevMode: boolean | undefined\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\nexport const SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS: google.maps.places.AutocompleteOptions =\n {\n componentRestrictions: { country: 'US' },\n }\n\n@Directive({\n selector: 'input[seamGoogleMapsPlacesAutocomplete]',\n exportAs: 'seamGoogleMapsPlacesAutocomplete',\n})\nexport class TheSeamGoogleMapsPlacesAutocompleteDirective\n implements OnInit, OnDestroy, OnChanges\n{\n private readonly _autoCompleteReadySubject = new Subject<void>()\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _placeChangedPending: {\n observable: Observable<any>\n subscriber: Subscriber<any>\n }[] = []\n private _listeners: google.maps.MapsEventListener[] = []\n\n public autoComplete?: google.maps.places.Autocomplete\n\n @Input()\n set options(\n value: google.maps.places.AutocompleteOptions | undefined | null,\n ) {\n this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n }\n private _options: google.maps.places.AutocompleteOptions =\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n\n /**\n * This event is fired when a PlaceResult is made available for a Place the\n * user has selected. If the user enters the name of a Place that was not\n * suggested by the control and presses the Enter key, or if a Place Details\n * request fails, the PlaceResult contains the user input in the name\n * property, with no other properties defined.\n *\n * See: https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete.place_changed\n */\n @Output() readonly placeChanged: Observable<any>\n\n @HostBinding('attr.type') _attrType = 'text'\n\n constructor(\n private readonly _elementRef: ElementRef<HTMLInputElement>,\n private readonly _ngZone: NgZone,\n ) {\n this.placeChanged = this._autoCompleteReadySubject.pipe(\n startWith(undefined),\n switchMap(() => this._createPlaceChangedObservable<any>()),\n )\n }\n\n ngOnInit(): void {\n this._ngZone.runOutsideAngular(() => {\n this._untilGoogleMapsApiLoaded()\n .pipe(takeUntil(this._ngUnsubscribe))\n .subscribe(() => {\n this.autoComplete = new google.maps.places.Autocomplete(\n this.getHostElement(),\n this._options,\n )\n\n this._placeChangedPending.forEach((pending) =>\n pending.observable.subscribe(pending.subscriber),\n )\n\n this._autoCompleteReadySubject.next(undefined)\n })\n })\n }\n\n ngOnDestroy(): void {\n this._listeners.forEach((l) => l.remove())\n this._listeners = []\n\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (this.autoComplete && changes['options']) {\n this.autoComplete.setOptions(this._options)\n }\n }\n\n private _untilGoogleMapsApiLoaded(): Observable<void> {\n return interval(500).pipe(\n filter(\n () =>\n !!(window.google && window.google.maps && window.google.maps.version),\n ),\n take(1),\n mapTo(undefined),\n )\n }\n\n /**\n * Returns the bounds to which predictions are biased.\n */\n public getBounds(): google.maps.LatLngBounds | undefined {\n this._assertInitialized()\n return this.autoComplete.getBounds()\n }\n\n /**\n * Returns the fields to be included for the Place in the details response\n * when the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public getFields(): string[] | undefined {\n this._assertInitialized()\n return (this.autoComplete as any).getFields()\n }\n\n /**\n * Returns the details of the Place selected by user if the details were\n * successfully retrieved. Otherwise returns a stub Place object, with the\n * name property set to the current value of the input field.\n */\n public getPlace(): google.maps.places.PlaceResult {\n this._assertInitialized()\n return this.autoComplete.getPlace()\n }\n\n /**\n * Sets the preferred area within which to return Place results. Results are\n * biased towards, but not restricted to, this area.\n */\n public setBounds(\n bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setBounds(bounds!)\n }\n\n /**\n * Sets the component restrictions. Component restrictions are used to\n * restrict predictions to only those within the parent component. For\n * example, the country.\n */\n public setComponentRestrictions(\n restrictions?: google.maps.places.ComponentRestrictions,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setComponentRestrictions(restrictions!)\n }\n\n /**\n * Sets the fields to be included for the Place in the details response when\n * the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public setFields(fields?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setFields(fields!)\n }\n\n /** */\n public setOptions(options?: google.maps.places.AutocompleteOptions): void {\n this._assertInitialized()\n\n return this.autoComplete.setOptions(options!)\n }\n\n /**\n * Sets the types of predictions to be returned. For supported types, see the\n * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).\n * If no types are specified, all types will be returned.\n */\n public setTypes(types?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setTypes(types!)\n }\n\n /** Focuses the input. */\n public focus(): void {\n this._elementRef.nativeElement.focus()\n }\n\n /** Unfocuses the input. */\n public blur(): void {\n this._elementRef.nativeElement.blur()\n }\n\n public getHostElement(): HTMLInputElement {\n return this._elementRef.nativeElement\n }\n\n private _createPlaceChangedObservable<T>(): Observable<T> {\n const observable = new Observable<T>((subscriber) => {\n if (!this.autoComplete) {\n this._placeChangedPending.push({ observable, subscriber })\n return undefined\n }\n const listener = this.autoComplete.addListener(\n 'place_changed',\n (event: T) => {\n this._ngZone.run(() => subscriber.next(event))\n },\n )\n this._listeners.push(listener)\n\n return () => listener.remove()\n })\n return observable\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n 'autoComplete'\n > {\n if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map Places information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n}\n","import { BooleanInput, coerceNumberProperty } from '@angular/cdk/coercion'\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n HostListener,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n} from '@angular/core'\nimport { interval, Observable, of, Subject, Subscriber } from 'rxjs'\nimport {\n filter,\n mapTo,\n startWith,\n switchMap,\n take,\n takeUntil,\n} from 'rxjs/operators'\n\nimport { faSearchLocation } from '@fortawesome/free-solid-svg-icons'\nimport { InputBoolean } from '@theseam/ui-common/core'\nimport { InputDirective } from '@theseam/ui-common/form-field'\nimport { SeamIcon } from '@theseam/ui-common/icon'\n\nimport {\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n} from './google-maps-places-autocomplete.directive'\n\ndeclare const ngDevMode: boolean | undefined\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\n/**\n *\n */\n@Component({\n selector: 'seam-google-maps-places-autocomplete',\n templateUrl: './google-maps-places-autocomplete.component.html',\n styleUrls: ['./google-maps-places-autocomplete.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'seamGoogleMapsPlacesAutoComplete',\n standalone: false,\n})\nexport class TheSeamGoogleMapsPlacesAutoCompleteComponent implements OnDestroy {\n static ngAcceptInputType_disabled: BooleanInput\n\n private readonly _ngUnsubscribe = new Subject<void>()\n private readonly _autoCompleteReadySubject = new Subject()\n\n private _placeChangedPending: {\n observable: Observable<any>\n subscriber: Subscriber<any>\n }[] = []\n\n public autoComplete?: google.maps.places.Autocomplete\n\n @Input() label: string | undefined | null = 'Search by address, place or name'\n\n @Input() icon: SeamIcon | undefined | null = faSearchLocation\n\n @Input() @InputBoolean() disabled: BooleanInput = false\n\n @Input() placeholder: string | undefined | null =\n 'Enter address, place or name'\n\n @Input() autocorrect: 'off' | 'on' | undefined | null = 'off'\n\n @Input() autocapitalize: 'off' | 'on' | undefined | null = 'off'\n\n /**\n * Set the tab index to `-1` to allow the root element of the\n * component to receive `focus` event from javascript, but not get focused by\n * keyboard navigation.\n */\n @Input()\n set tabIndex(value: number) {\n this._tabIndex = coerceNumberProperty(value)\n }\n get tabIndex(): number {\n return this._tabIndex\n }\n private _tabIndex = -1\n\n @Input()\n set options(\n value: google.maps.places.AutocompleteOptions | undefined | null,\n ) {\n this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n }\n _options: google.maps.places.AutocompleteOptions =\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n\n /**\n * This event is fired when a PlaceResult is made available for a Place the\n * user has selected. If the user enters the name of a Place that was not\n * suggested by the control and presses the Enter key, or if a Place Details\n * request fails, the PlaceResult contains the user input in the name\n * property, with no other properties defined.\n *\n * See: https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete.place_changed\n */\n @Output() readonly placeChanged: Observable<void>\n\n @ViewChild('inp', { read: InputDirective, static: true })\n _inputDirective!: InputDirective\n\n @ViewChild(TheSeamGoogleMapsPlacesAutocompleteDirective, { static: true })\n set __autocompleteDirective(\n value: TheSeamGoogleMapsPlacesAutocompleteDirective,\n ) {\n this._autoCompleteDirective = value\n this._untilAutoCompleteReady()\n .pipe(takeUntil(this._ngUnsubscribe))\n .subscribe(() => {\n this.autoComplete = this._autoCompleteDirective.autoComplete\n this._placeChangedPending.forEach((pending) =>\n pending.observable.subscribe(pending.subscriber),\n )\n this._placeChangedPending = []\n })\n }\n _autoCompleteDirective!: TheSeamGoogleMapsPlacesAutocompleteDirective\n\n @HostBinding('attr.tabindex')\n get _attrTabIndex() {\n return this.disabled ? -1 : this.tabIndex || 0\n }\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._inputDirective.focus()\n }\n\n @HostListener('focus', ['$event'])\n _onFocus() {\n this._inputDirective?.focus()\n }\n\n constructor(private readonly _elementRef: ElementRef) {\n this.placeChanged = this._autoCompleteReadySubject.pipe(\n startWith(undefined),\n switchMap(() => this._createPlaceChangedObservable<any>()),\n )\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _untilAutoCompleteReady(): Observable<void> {\n return interval(500).pipe(\n filter(() => !!this._autoCompleteDirective.autoComplete),\n take(1),\n mapTo(undefined),\n )\n }\n\n /**\n * Returns the bounds to which predictions are biased.\n */\n public getBounds(): google.maps.LatLngBounds | undefined {\n this._assertInitialized()\n return this.autoComplete.getBounds()\n }\n\n /**\n * Returns the fields to be included for the Place in the details response\n * when the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public getFields(): string[] | undefined {\n this._assertInitialized()\n return (this.autoComplete as any).getFields()\n }\n\n /**\n * Returns the details of the Place selected by user if the details were\n * successfully retrieved. Otherwise returns a stub Place object, with the\n * name property set to the current value of the input field.\n */\n public getPlace(): google.maps.places.PlaceResult {\n this._assertInitialized()\n return this.autoComplete.getPlace()\n }\n\n /**\n * Sets the preferred area within which to return Place results. Results are\n * biased towards, but not restricted to, this area.\n */\n public setBounds(\n bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setBounds(bounds!)\n }\n\n /**\n * Sets the component restrictions. Component restrictions are used to\n * restrict predictions to only those within the parent component. For\n * example, the country.\n */\n public setComponentRestrictions(\n restrictions?: google.maps.places.ComponentRestrictions,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setComponentRestrictions(restrictions!)\n }\n\n /**\n * Sets the fields to be included for the Place in the details response when\n * the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public setFields(fields?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setFields(fields!)\n }\n\n /** */\n public setOptions(options?: google.maps.places.AutocompleteOptions): void {\n this._assertInitialized()\n\n return this.autoComplete.setOptions(options!)\n }\n\n /**\n * Sets the types of predictions to be returned. For supported types, see the\n * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).\n * If no types are specified, all types will be returned.\n */\n public setTypes(types?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setTypes(types!)\n }\n\n /** Focuses the input. */\n public focus(): void {\n this._elementRef.nativeElement.focus()\n }\n\n /** Unfocuses the input. */\n public blur(): void {\n this._elementRef.nativeElement.blur()\n }\n\n public getHostElement(): HTMLInputElement {\n return this._elementRef.nativeElement\n }\n\n private _createPlaceChangedObservable<T>(): Observable<T> {\n const observable = new Observable<T>((subscriber) => {\n if (!this.autoComplete) {\n this._placeChangedPending.push({ observable, subscriber })\n return undefined\n }\n\n const sub = this._autoCompleteDirective.placeChanged.subscribe(subscriber)\n\n return () => sub.unsubscribe()\n })\n return observable\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n 'autoComplete'\n > {\n if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map Places information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n}\n","<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\n</div>\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{\n label || placeholder\n}}</label>\n<input\n #inp=\"seamInput\"\n seamInput\n seamGoogleMapsPlacesAutocomplete\n [disabled]=\"disabled\"\n [attr.placeholder]=\"placeholder\"\n [attr.autocorrect]=\"autocorrect\"\n [attr.autocapitalize]=\"autocapitalize\"\n [options]=\"_options\"\n/>\n","import { ObserversModule } from '@angular/cdk/observers'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\n\nimport { GoogleMapsModule } from '@angular/google-maps'\nimport { TheSeamFormFieldModule } from '@theseam/ui-common/form-field'\nimport { TheSeamIconModule } from '@theseam/ui-common/icon'\nimport { TheSeamMenuModule } from '@theseam/ui-common/menu'\nimport { TheSeamSharedModule } from '@theseam/ui-common/shared'\n\nimport { TheSeamGoogleMapsPlacesAutoCompleteComponent } from './google-maps-places-autocomplete/google-maps-places-autocomplete.component'\nimport { TheSeamGoogleMapsPlacesAutocompleteDirective } from './google-maps-places-autocomplete/google-maps-places-autocomplete.directive'\nimport { TheSeamGoogleMapsRecenterButtonControlComponent } from './google-maps-recenter-button-control/google-maps-recenter-button-control.component'\nimport { TheSeamGoogleMapsUploadButtonControlComponent } from './google-maps-upload-button-control/google-maps-upload-button-control.component'\nimport { TheSeamGoogleMapsComponent } from './google-maps/google-maps.component'\nimport { TheSeamMapsControlComponent } from './map-control.component'\nimport { TheSeamMapFileDropComponent } from './map-file-drop/map-file-drop.component'\n\n@NgModule({\n declarations: [\n TheSeamGoogleMapsComponent,\n TheSeamMapFileDropComponent,\n TheSeamGoogleMapsUploadButtonControlComponent,\n TheSeamGoogleMapsRecenterButtonControlComponent,\n TheSeamMapsControlComponent,\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n ],\n imports: [\n CommonModule,\n ObserversModule,\n TheSeamSharedModule,\n TheSeamMenuModule,\n TheSeamIconModule,\n TheSeamFormFieldModule,\n GoogleMapsModule,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n ],\n exports: [\n TheSeamGoogleMapsComponent,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n TheSeamMapsControlComponent,\n ],\n})\nexport class TheSeamGoogleMapsModule {}\n","import {\n Inject,\n Injectable,\n InjectionToken,\n LOCALE_ID,\n Optional,\n} from '@angular/core'\nimport { from, Observable, of } from 'rxjs'\n\nimport { TheSeamGoogleMapsApiLoader } from './google-maps-api-loader'\n\ninterface GoogleMapsWindow extends Window {\n gm_authFailure?: () => void\n google?: typeof google\n}\n\ndeclare const window: GoogleMapsWindow\n\n/**\n * Token for the config of the LazyMapsAPILoader. Please provide an object of\n * type {@link TheSeamLazyMapsApiLoader}.\n */\nexport const THESEAM_LAZY_MAPS_API_CONFIG =\n new InjectionToken<TheSeamLazyMapsApiLoaderConfig>(\n 'THESEAM_LAZY_MAPS_API_CONFIG',\n )\n\n/**\n * Configuration for the {@link TheSeamLazyMapsApiLoader}.\n */\nexport interface TheSeamLazyMapsApiLoaderConfig {\n /**\n * The Google Maps API Key (see:\n * https://developers.google.com/maps/documentation/javascript/get-api-key)\n */\n apiKey?: string\n\n /**\n * The Google Maps client ID (for premium plans). When you have a Google Maps\n * APIs Premium Plan license, you must authenticate your application with\n * either an API key or a client ID. The Google Maps API will fail to load if\n * both a client ID and an API key are included.\n */\n clientId?: string\n\n /**\n * The Google Maps channel name (for premium plans). A channel parameter is an\n * optional parameter that allows you to track usage under your client ID by\n * assigning a distinct channel to each of your applications.\n */\n channel?: string\n\n /**\n * Google Maps API version.\n */\n apiVersion?: string\n\n /**\n * Url used for the `<script>` tag.\n */\n url?: string\n\n /**\n * Defines which Google Maps libraries should get loaded.\n */\n libraries?: string[]\n\n /**\n * The default bias for the map behavior is US. If you wish to alter your\n * application to serve different map tiles or bias the application, you can\n * overwrite the default behavior (US) by defining a `region`. See\n * https://developers.google.com/maps/documentation/javascript/basics#Region\n */\n region?: string\n\n /**\n * The Google Maps API uses the browser's preferred language when displaying\n * textual information. If you wish to overwrite this behavior and force the\n * API to use a given language, you can use this setting. See\n * https://developers.google.com/maps/documentation/javascript/basics#Language\n */\n language?: string\n\n loading?: string\n}\n\n@Injectable()\nexport class TheSeamLazyMapsApiLoader extends TheSeamGoogleMapsApiLoader {\n protected _scriptLoadingPromise?: Promise<void>\n protected readonly _config: TheSeamLazyMapsApiLoaderConfig\n protected readonly _SCRIPT_ID: string = 'seamGoogleMapsApiScript'\n protected readonly callbackName: string = `__seamLazyGoogleMapsApiLoader`\n\n constructor(\n @Inject(LOCALE_ID) private readonly _localeId: string,\n @Optional()\n @Inject(THESEAM_LAZY_MAPS_API_CONFIG)\n readonly config?: TheSeamLazyMapsApiLoaderConfig,\n ) {\n super()\n this._config = config || {}\n }\n\n public load(): Observable<void> {\n if (window.google && window.google.maps) {\n // Google maps already loaded on the page.\n return of(undefined)\n }\n\n if (this._scriptLoadingPromise) {\n return from(this._scriptLoadingPromise)\n }\n\n // This can happen in HMR situations or Stackblitz.io editors.\n const scriptOnPage = document.getElementById(this._SCRIPT_ID)\n if (scriptOnPage) {\n this._assignScriptLoadingPromise(scriptOnPage)\n return from(this._getScriptLoadingPromise())\n }\n\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.async = true\n script.defer = true\n script.id = this._SCRIPT_ID\n script.src = this._getScriptSrc(this.callbackName)\n this._assignScriptLoadingPromise(script)\n document.body.appendChild(script)\n return from(this._getScriptLoadingPromise())\n }\n\n private _assignScriptLoadingPromise(scriptElem: HTMLElement) {\n this._scriptLoadingPromise = new Promise((resolve, reject) => {\n const win = window as any\n win[this.callbackName] = () => {\n resolve()\n }\n\n scriptElem.onerror = (error: Event | string) => {\n reject(error)\n }\n })\n }\n\n private _getScriptLoadingPromise(): Promise<void> {\n if (!this._scriptLoadingPromise) {\n throw Error(`_scriptLoadingPromise has not been assigned.`)\n }\n return this._scriptLoadingPromise\n }\n\n protected _getScriptSrc(callbackName: string): string {\n const hostAndPath: string =\n this._config.url || 'https://maps.googleapis.com/maps/api/js'\n const queryParams: { [key: string]: string | string[] | undefined | null } =\n {\n v: this._config.apiVersion || 'quarterly',\n callback: callbackName,\n key: this._config.apiKey,\n client: this._config.clientId,\n channel: this._config.channel,\n libraries: this._config.libraries,\n region: this._config.region,\n language:\n this._config.language ||\n (this._localeId !== 'en-US' ? this._localeId : null),\n loading: this._config.loading || 'async',\n }\n\n const params: string = Object.keys(queryParams)\n // Remove undefined or null params.\n .filter(\n (k: string) => queryParams[k] !== undefined && queryParams[k] !== null,\n )\n // Remove empty arrays.\n .filter((k: string) => {\n const param = queryParams[k]\n return !Array.isArray(param) || param.length > 0\n })\n // Join arrays as comma seperated strings.\n .map((k: string) => {\n const param = queryParams[k]\n return {\n key: k,\n value: Array.isArray(param) ? param.join(',') : param,\n } as { key: string; value: string }\n })\n .map((entry: { key: string; value: string }) => {\n return `${entry.key}=${entry.value}`\n })\n .join('&')\n\n return `${hostAndPath}?${params}`\n }\n}\n","import { Injectable } from '@angular/core'\nimport { defer, Observable, of, throwError } from 'rxjs'\n\nimport { TheSeamGoogleMapsApiLoader } from './google-maps-api-loader'\n\n/**\n * When using the TheSeamNoopGoogleMapsAPILoader, the Google Maps API must be\n * added to the page some other way before the map component is initialixed. One\n * way would be via a `<script>` Tag.\n */\n@Injectable()\nexport class TheSeamNoopGoogleMapsAPILoader extends TheSeamGoogleMapsApiLoader {\n load(): Observable<void> {\n return defer(() => {\n if (!(window as any).google || !(window as any).google.maps) {\n return throwError(\n new Error(\n 'Google Maps API not loaded on page. Make sure window.google.maps is available.',\n ),\n )\n }\n return of(undefined)\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.MapValueManagerService","i1.GoogleMapsService","i1","i3","i2.MapValueManagerService","i2.GoogleMapsService","i3.MapValueManagerService","i4.TheSeamGoogleMapsApiLoader","i8.TheSeamMapFileDropComponent","i9.TheSeamMapsControlComponent","i4.TheSeamGoogleMapsPlacesAutocompleteDirective"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAca,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;MAGX,gBAAgB,GAAG,IAAI,cAAc,CAAM,kBAAkB;;ICN9D;AAAZ,CAAA,UAAY,sBAAsB,EAAA;AAChC,IAAA,sBAAA,CAAA,YAAA,CAAA,GAAA,mBAAgC;AAChC,IAAA,sBAAA,CAAA,UAAA,CAAA,GAAA,iBAA4B;AAC9B,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB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C,GAAG,CAAC;AAEZ,QAAA,OAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,MAAM,EAAE;IACnC;wGA1GW,wBAAwB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAOzB,SAAS,EAAA,EAAA,EAAA,KAAA,EAET,4BAA4B,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAT3B,wBAAwB,EAAA,CAAA;;4FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC;;0BAQI,MAAM;2BAAC,SAAS;;0BAChB;;0BACA,MAAM;2BAAC,4BAA4B;;;AC3FxC;;;;AAIG;AAEG,MAAO,8BAA+B,SAAQ,0BAA0B,CAAA;IAC5E,IAAI,GAAA;QACF,OAAO,KAAK,CAAC,MAAK;AAChB,YAAA,IAAI,CAAE,MAAc,CAAC,MAAM,IAAI,CAAE,MAAc,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC3D,OAAO,UAAU,CACf,IAAI,KAAK,CACP,gFAAgF,CACjF,CACF;YACH;AACA,YAAA,OAAO,EAAE,CAAC,SAAS,CAAC;AACtB,QAAA,CAAC,CAAC;IACJ;wGAZW,8BAA8B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;4GAA9B,8BAA8B,EAAA,CAAA;;4FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-google-maps.mjs","sources":["../../../projects/ui-common/google-maps/map-controls-service.ts","../../../projects/ui-common/google-maps/google-maps-feature-helpers.ts","../../../projects/ui-common/google-maps/feature-groups/feature-group-registry.ts","../../../projects/ui-common/google-maps/feature-style/compute-feature-style.ts","../../../projects/ui-common/google-maps/google-maps-contextmenu.ts","../../../projects/ui-common/google-maps/interaction/grouped-interaction-model.ts","../../../projects/ui-common/google-maps/interaction/legacy-interaction-model.ts","../../../projects/ui-common/google-maps/labels/label-visibility.ts","../../../projects/ui-common/google-maps/labels/map-feature-labels-overlay.ts","../../../projects/ui-common/google-maps/map-value-manager.service.ts","../../../projects/ui-common/google-maps/google-maps.service.ts","../../../projects/ui-common/google-maps/google-maps-controls.service.ts","../../../projects/ui-common/google-maps/google-maps-draw-button-control/google-maps-draw-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-draw-button-control/google-maps-draw-button-control.component.html","../../../projects/ui-common/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-recenter-button-control/google-maps-recenter-button-control.component.html","../../../projects/ui-common/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.ts","../../../projects/ui-common/google-maps/google-maps-upload-button-control/google-maps-upload-button-control.component.html","../../../projects/ui-common/google-maps/context-menu/delete-menu-items.ts","../../../projects/ui-common/google-maps/google-maps-api-loader/google-maps-api-loader.ts","../../../projects/ui-common/google-maps/map-file-drop/map-file-drop.component.ts","../../../projects/ui-common/google-maps/map-file-drop/map-file-drop.component.html","../../../projects/ui-common/google-maps/map-control.component.ts","../../../projects/ui-common/google-maps/google-maps/google-maps.component.ts","../../../projects/ui-common/google-maps/google-maps/google-maps.component.html","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.ts","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.ts","../../../projects/ui-common/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.html","../../../projects/ui-common/google-maps/google-maps.module.ts","../../../projects/ui-common/google-maps/google-maps-api-loader/lazy-google-maps-api-loader.ts","../../../projects/ui-common/google-maps/google-maps-api-loader/noop-google-maps-api-loader.ts","../../../projects/ui-common/google-maps/theseam-ui-common-google-maps.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\n\nimport { ComponentType } from '@theseam/ui-common/models'\n\nexport interface MapControl<TData = any> {\n component: ComponentType<any>\n data?: TData\n position?: google.maps.ControlPosition\n}\n\nexport interface MapControlsService {\n add(control: MapControl): void\n}\n\nexport const MAP_CONTROLS_SERVICE = new InjectionToken<MapControlsService>(\n 'MAP_CONTROLS_SERVICE',\n)\n\nexport const MAP_CONTROL_DATA = new InjectionToken<any>('MAP_CONTROL_DATA')\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { NgZone } from '@angular/core'\nimport { Feature, MultiPolygon, Polygon } from 'geojson'\nimport { Observable } from 'rxjs'\n\nimport {\n addHoleToPolygon,\n closePolygons,\n notNullOrUndefined,\n polygonContains,\n} from '@theseam/ui-common/utils'\n\nexport enum AppFeaturePropertyName {\n IsSelected = `__app__isSelected`,\n GroupKey = `__app__groupKey`,\n}\n\nexport function isAppFeatureProperty(\n propertyName: string,\n): propertyName is AppFeaturePropertyName {\n return (\n Object.values(AppFeaturePropertyName).findIndex(\n (value) => value === propertyName,\n ) !== -1\n )\n}\n\nexport function isFeatureSelected(feature: google.maps.Data.Feature): boolean {\n const isSelected = feature.getProperty(AppFeaturePropertyName.IsSelected)\n return coerceBooleanProperty(isSelected)\n}\n\nexport function setFeatureSelected(\n feature: google.maps.Data.Feature,\n isSelected: boolean,\n): void {\n feature.setProperty(AppFeaturePropertyName.IsSelected, isSelected)\n}\n\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_PROPERTY_NAME = 'styleOptions'\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_HOVERED_PROPERTY_NAME =\n 'styleOptionsHovered'\nconst EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_SELECTED_PROPERTY_NAME =\n 'styleOptionsSelected'\n\nexport function getStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\nexport function getHoveredStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_HOVERED_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\nexport function getSelectedStyleOptionsDefinedByFeature(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions | undefined {\n return (\n (feature.getProperty(\n EXTERNAL_FEATURE_DEFINED_STYLE_OPTIONS_SELECTED_PROPERTY_NAME,\n ) as google.maps.Data.StyleOptions) || undefined\n )\n}\n\n// TODO: Check performance of cloning a google.maps.Data instance, so the\n// properties can be removed with the google maps api, instead of on the\n// resulting json.\nexport function stripAppFeaturePropertiesFromJson(json: any) {\n if (notNullOrUndefined(json) && Array.isArray(json?.features)) {\n for (const feature of json.features) {\n if (notNullOrUndefined(feature?.properties)) {\n for (const k of Object.keys(feature.properties)) {\n if (isAppFeatureProperty(k)) {\n feature.properties[k] = undefined\n delete feature.properties[k]\n }\n }\n }\n }\n }\n}\n\nexport function polygonHasValidPathsLengths(\n polygon: google.maps.Polygon,\n minPointsInValidPath: number = 3,\n): boolean {\n const paths = polygon.getPaths().getArray()\n for (const path of paths) {\n if (path.getLength() < minPointsInValidPath) {\n return false\n }\n }\n return true\n}\n\nexport function polygonCoordinates(\n polygon: google.maps.Data.Polygon,\n): number[][][] {\n const polygonGeoJson: Polygon = {\n type: 'Polygon',\n coordinates: polygon\n .getArray()\n .map((linRing) => linRing.getArray().map((x) => [x.lng(), x.lat()])),\n }\n closePolygons(polygonGeoJson)\n return polygonGeoJson.coordinates\n}\n\n/** Build a google.maps.Data.Polygon from a GeoJSON Polygon (lng/lat order). */\nexport function dataPolygonFromGeoJson(\n polygon: Polygon,\n): google.maps.Data.Polygon {\n const rings = polygon.coordinates.map((ring) =>\n // GeoJSON rings are explicitly closed (first coordinate repeated at the\n // end), but google.maps.Data.Polygon paths are implicitly closed and must\n // NOT include the repeated point — otherwise it becomes a duplicate vertex\n // coincident with the first (two points that edit independently, and a\n // double closing point when serialized back to GeoJSON).\n openRing(ring).map(\n ([lng, lat]) => ({ lat, lng }) as google.maps.LatLngLiteral,\n ),\n )\n return new google.maps.Data.Polygon(rings)\n}\n\n/** Drop a ring's explicit closing point (a trailing copy of the first). */\nfunction openRing(ring: number[][]): number[][] {\n if (ring.length < 2) {\n return ring\n }\n const first = ring[0]\n const last = ring[ring.length - 1]\n return first[0] === last[0] && first[1] === last[1] ? ring.slice(0, -1) : ring\n}\n\n/**\n * Read an existing feature's Polygon geometry as a closed GeoJSON Polygon.\n * Returns undefined for non-Polygon geometries. Does not mutate the feature.\n */\nexport function geoJsonPolygonFromDataFeature(\n feature: google.maps.Data.Feature,\n): Polygon | undefined {\n const geometry = feature.getGeometry()\n if (geometry === null || geometry.getType() !== 'Polygon') {\n return undefined\n }\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(geometry as google.maps.Data.Polygon),\n }\n closePolygons(polygon)\n return polygon\n}\n\n/** Build a google.maps.Data.MultiPolygon from a GeoJSON MultiPolygon. */\nexport function dataMultiPolygonFromGeoJson(\n multiPolygon: MultiPolygon,\n): google.maps.Data.MultiPolygon {\n return new google.maps.Data.MultiPolygon(\n multiPolygon.coordinates.map((rings) =>\n dataPolygonFromGeoJson({ type: 'Polygon', coordinates: rings }),\n ),\n )\n}\n\n/**\n * Every Polygon part of a feature, as closed GeoJSON. A Polygon feature yields\n * one; a MultiPolygon yields one per part; anything else yields none.\n *\n * Callers that need to match a drawn shape against existing geometry must use\n * this rather than `geoJsonPolygonFromDataFeature`, which sees only Polygons\n * and silently ignores MultiPolygon features.\n */\nexport function polygonsFromDataFeature(\n feature: google.maps.Data.Feature,\n): Polygon[] {\n const geometry = feature.getGeometry()\n if (geometry === null) {\n return []\n }\n if (geometry.getType() === 'Polygon') {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(geometry as google.maps.Data.Polygon),\n }\n closePolygons(polygon)\n return [polygon]\n }\n if (geometry.getType() === 'MultiPolygon') {\n return (geometry as google.maps.Data.MultiPolygon)\n .getArray()\n .map((part) => {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: polygonCoordinates(part),\n }\n closePolygons(polygon)\n return polygon\n })\n }\n return []\n}\n\n/**\n * Cut `hole` into whichever part of `feature`'s geometry fully contains it.\n *\n * Mutates the EXISTING feature (via `setGeometry`) rather than replacing it,\n * so its identity and properties survive. A single-part Polygon feature stays\n * a Polygon; a MultiPolygon feature stays a MultiPolygon with only the\n * containing part modified. Returns whether a containing part was found —\n * when none is, the feature is left untouched.\n */\nexport function applyHoleToFeature(\n feature: google.maps.Data.Feature,\n hole: Polygon,\n): boolean {\n const parts = polygonsFromDataFeature(feature)\n const containingIndex = parts.findIndex((part) => polygonContains(part, hole))\n if (containingIndex === -1) {\n return false\n }\n\n parts[containingIndex] = addHoleToPolygon(parts[containingIndex], hole)\n feature.setGeometry(\n parts.length === 1\n ? dataPolygonFromGeoJson(parts[0])\n : dataMultiPolygonFromGeoJson({\n type: 'MultiPolygon',\n coordinates: parts.map((p) => p.coordinates),\n }),\n )\n return true\n}\n\n/**\n * Read a feature as a GeoJSON Feature, geometry and properties together.\n *\n * `excludeProperty` filters properties out by name — used to keep internal\n * `__app__` bookkeeping out of anything handed to a consumer.\n */\nexport function geoJsonFeatureFromDataFeature(\n feature: google.maps.Data.Feature,\n excludeProperty?: (name: string) => boolean,\n): Feature<Polygon | MultiPolygon> | undefined {\n const parts = polygonsFromDataFeature(feature)\n if (parts.length === 0) {\n return undefined\n }\n\n const geometry: Polygon | MultiPolygon =\n feature.getGeometry()?.getType() === 'MultiPolygon'\n ? { type: 'MultiPolygon', coordinates: parts.map((p) => p.coordinates) }\n : parts[0]\n\n const properties: Record<string, any> = {}\n feature.forEachProperty((value, name) => {\n if (!excludeProperty?.(name)) {\n properties[name] = value\n }\n })\n\n const id = feature.getId()\n return {\n type: 'Feature',\n ...(id === undefined ? {} : { id }),\n geometry,\n properties,\n }\n}\n\nexport function getBoundsWithAllFeatures(\n data: google.maps.Data,\n): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds()\n\n data.forEach((feature) => {\n const geometry = feature.getGeometry()\n if (geometry === null) {\n throw Error(`Geometry not found.`)\n }\n geometry.forEachLatLng((latLng) => {\n bounds.extend(latLng)\n })\n })\n\n return bounds\n}\n\nexport function getFeatureBounds(\n feature: google.maps.Data.Feature,\n): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds()\n\n const geometry = feature.getGeometry()\n if (geometry === null) {\n throw Error(`Geometry not found.`)\n }\n geometry.forEachLatLng((latLng) => {\n bounds.extend(latLng)\n })\n\n return bounds\n}\n\nexport function getFeatureCenter(\n feature: google.maps.Data.Feature,\n): google.maps.LatLng {\n return getFeatureBounds(feature).getCenter()\n}\n\nexport function removeAllFeatures(data: google.maps.Data): void {\n data.forEach((f) => data.remove(f))\n}\n\nexport function getFeaturesCount(data: google.maps.Data): number {\n let count = 0\n data.forEach(() => count++)\n return count\n}\n\n/**\n * NOTE: Original events are not emitted, because filtering may omit events.\n */\nexport function createFeatureChangeObservable(\n data: google.maps.Data,\n ngZone: NgZone,\n): Observable<void> {\n return new Observable<void>((subscriber) => {\n const listeners: google.maps.MapsEventListener[] = []\n\n ngZone.runOutsideAngular(() => {\n listeners.push(\n data.addListener(\n 'setgeometry',\n (event: google.maps.Data.SetGeometryEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'addfeature',\n (event: google.maps.Data.AddFeatureEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'removefeature',\n (event: google.maps.Data.RemoveFeatureEvent) => {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'setproperty',\n (event: google.maps.Data.SetPropertyEvent) => {\n if (!isAppFeatureProperty(event.name)) {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n }\n },\n ),\n )\n\n listeners.push(\n data.addListener(\n 'removeproperty',\n (event: google.maps.Data.RemovePropertyEvent) => {\n if (!isAppFeatureProperty(event.name)) {\n ngZone.run(() => {\n subscriber.next(undefined)\n })\n }\n },\n ),\n )\n })\n\n return () => {\n listeners.forEach(google.maps.event.removeListener)\n }\n })\n}\n","import {\n AppFeaturePropertyName,\n geoJsonFeatureFromDataFeature,\n isAppFeatureProperty,\n} from '../google-maps-feature-helpers'\nimport { TheSeamMapFeatureGroup } from './feature-group'\n\ndeclare const ngDevMode: boolean | undefined\n\nexport interface FeatureGroupRegistryOptions {\n /**\n * Name of the GeoJSON property that groups features. When unset, every\n * feature is its own group.\n */\n groupProperty?: string | null\n /** Generates the key written for a newly created group. */\n newGroupKeyFactory?: () => string\n}\n\nconst isDevMode = () => typeof ngDevMode === 'undefined' || !!ngDevMode\n\n/**\n * Resolves which group each feature on the data layer belongs to, and assigns\n * keys to features the map itself creates.\n *\n * Keys resolve from `properties[groupProperty]` when present, and otherwise\n * from an internal `__app__groupKey`, which is stripped from serialized output\n * and does not trigger value changes.\n */\nexport class FeatureGroupRegistry {\n private _assignedSeq = 0\n private _warnedAboutMissingGroupValues = false\n private _warnedAboutUnsupportedGeometry = false\n\n constructor(\n private readonly _data: google.maps.Data,\n private _options: FeatureGroupRegistryOptions = {},\n ) {}\n\n setOptions(options: FeatureGroupRegistryOptions): void {\n this._options = options\n }\n\n /**\n * The group key for a feature, assigning an internal one if it has neither a\n * group property value nor a previously assigned key.\n *\n * Assigning here mutates the feature, but only via an `__app__` property,\n * which neither serializes nor raises a value change.\n */\n keyOf(feature: google.maps.Data.Feature): string {\n const declared = this._declaredKey(feature)\n if (declared !== undefined) {\n return declared\n }\n\n const assigned = feature.getProperty(AppFeaturePropertyName.GroupKey)\n if (typeof assigned === 'string' && assigned.length > 0) {\n return assigned\n }\n\n this._warnAboutMissingGroupValue()\n const key = `__assigned__${this._assignedSeq++}`\n feature.setProperty(AppFeaturePropertyName.GroupKey, key)\n return key\n }\n\n /** Every feature on the data layer belonging to `key`. */\n featuresIn(key: string): google.maps.Data.Feature[] {\n const features: google.maps.Data.Feature[] = []\n this._data.forEach((feature) => {\n if (this.keyOf(feature) === key) {\n features.push(feature)\n }\n })\n return features\n }\n\n /** The group a feature belongs to, as emittable GeoJSON. */\n groupOf(\n feature: google.maps.Data.Feature,\n ): TheSeamMapFeatureGroup | undefined {\n return this.group(this.keyOf(feature))\n }\n\n /** The group for a key, or undefined when no feature carries it. */\n group(key: string): TheSeamMapFeatureGroup | undefined {\n return this.groupWithSources(key)?.group\n }\n\n /**\n * A group alongside the `Data.Feature` each emitted GeoJSON feature came\n * from, index-aligned.\n *\n * Callers that need to map a `Data.Feature` back to its emitted counterpart\n * must use this rather than indexing `group.features` against\n * `featuresIn(key)` — a feature with unsupported geometry is dropped from\n * the emitted list, which would shift every index after it.\n */\n groupWithSources(\n key: string,\n ):\n | { group: TheSeamMapFeatureGroup; sources: google.maps.Data.Feature[] }\n | undefined {\n const candidates = this.featuresIn(key)\n if (candidates.length === 0) {\n return undefined\n }\n\n const sources: google.maps.Data.Feature[] = []\n const features: TheSeamMapFeatureGroup['features'] = []\n for (const candidate of candidates) {\n const geoJson = geoJsonFeatureFromDataFeature(\n candidate,\n isAppFeatureProperty,\n )\n if (geoJson === undefined) {\n this._warnAboutUnsupportedGeometry()\n continue\n }\n sources.push(candidate)\n features.push(geoJson)\n }\n\n return { group: { key, features }, sources }\n }\n\n /** Every group currently on the data layer. */\n groups(): TheSeamMapFeatureGroup[] {\n const keys = new Set<string>()\n this._data.forEach((feature) => keys.add(this.keyOf(feature)))\n return [...keys]\n .map((key) => this.group(key))\n .filter((g): g is TheSeamMapFeatureGroup => g !== undefined)\n }\n\n /**\n * Start a new group on a feature the map created, writing a real group\n * property when one is configured so the grouping survives serialization.\n */\n assignNewKey(feature: google.maps.Data.Feature): string {\n const key = this._options.newGroupKeyFactory?.() ?? defaultGroupKey()\n if (isDevMode() && this.featuresIn(key).length > 0) {\n console.warn(\n `[seam-google-maps] newGroupKeyFactory produced the key \"${key}\", ` +\n `which is already in use. The drawn feature joins that group. ` +\n `The factory is responsible for producing unique keys.`,\n )\n }\n this.assignKey(feature, key)\n return key\n }\n\n /** Put a feature into an existing group. */\n assignKey(feature: google.maps.Data.Feature, key: string): void {\n const groupProperty = this._options.groupProperty\n if (groupProperty) {\n feature.setProperty(groupProperty, key)\n feature.removeProperty(AppFeaturePropertyName.GroupKey)\n return\n }\n feature.setProperty(AppFeaturePropertyName.GroupKey, key)\n }\n\n private _declaredKey(feature: google.maps.Data.Feature): string | undefined {\n const groupProperty = this._options.groupProperty\n if (!groupProperty) {\n return undefined\n }\n const value = feature.getProperty(groupProperty)\n if (value === null || value === undefined || value === '') {\n return undefined\n }\n return String(value)\n }\n\n private _warnAboutUnsupportedGeometry(): void {\n if (!isDevMode() || this._warnedAboutUnsupportedGeometry) {\n return\n }\n this._warnedAboutUnsupportedGeometry = true\n console.warn(\n `[seam-google-maps] a feature's geometry is neither Polygon nor ` +\n `MultiPolygon. It still renders, but is excluded from groups, ` +\n `outputs, and labels.`,\n )\n }\n\n private _warnAboutMissingGroupValue(): void {\n if (\n !isDevMode() ||\n !this._options.groupProperty ||\n this._warnedAboutMissingGroupValues\n ) {\n return\n }\n this._warnedAboutMissingGroupValues = true\n console.warn(\n `[seam-google-maps] featureGroupProperty is ` +\n `\"${this._options.groupProperty}\", but at least one feature has no ` +\n `value for it. Each becomes its own group under a session-scoped key ` +\n `that is not serialized. Assign the property during import.`,\n )\n }\n}\n\nfunction defaultGroupKey(): string {\n return (\n globalThis.crypto?.randomUUID?.() ?? `group-${Date.now()}-${Math.random()}`\n )\n}\n","import {\n getHoveredStyleOptionsDefinedByFeature,\n getSelectedStyleOptionsDefinedByFeature,\n getStyleOptionsDefinedByFeature,\n isFeatureSelected,\n} from '../google-maps-feature-helpers'\n\nexport const FEATURE_STYLE_OPTIONS_DEFAULT =\n (): google.maps.Data.StyleOptions => ({\n clickable: true,\n visible: true,\n draggable: false,\n editable: false,\n fillColor: 'teal',\n fillOpacity: 0.3,\n strokeColor: 'blue',\n strokeOpacity: 1,\n strokeWeight: 2,\n })\n\nexport const FEATURE_STYLE_OPTIONS_SELECTED =\n (): google.maps.Data.StyleOptions => ({\n fillColor: 'green',\n fillOpacity: 0.7,\n strokeColor: 'limegreen',\n strokeOpacity: 1,\n strokeWeight: 2,\n })\n\nexport const FEATURE_STYLE_OVERRIDE_OPTIONS_HOVERED =\n (): google.maps.Data.StyleOptions => ({\n strokeColor: 'black',\n strokeOpacity: 1,\n strokeWeight: 4,\n })\n\n/**\n * Style options a feature may set through its GeoJSON properties.\n *\n * `editable`, `draggable`, and `clickable` are here so a feature can opt OUT —\n * a retired field stays unreshapeable while its neighbours do not. They cannot\n * opt in: the clamp in `computeFeatureStyle` runs last and only ever narrows.\n */\nexport const SUPPORTED_PROPERTY_STYLE_OPTIONS: (keyof google.maps.Data.StyleOptions)[] =\n [\n 'fillColor',\n 'fillOpacity',\n 'strokeColor',\n 'strokeOpacity',\n 'strokeWeight',\n 'label',\n 'opacity',\n 'icon',\n 'clickable',\n 'visible',\n 'editable',\n 'draggable',\n ]\n\n/** What the interaction model and the global gate permit for a feature. */\nexport interface TheSeamMapFeatureStyleContext {\n /** The `editingEnabled` input. */\n editingEnabled: boolean\n /** Whether the model currently arms geometry editing at all. */\n geometryEditingArmed: boolean\n /** Whether the model lets this feature receive clicks. */\n clicksAllowed: boolean\n}\n\n/** Merge only the supported subset of one options object into another. */\nexport function mergeStyleOptions(\n target: google.maps.Data.StyleOptions,\n source: google.maps.Data.StyleOptions | undefined,\n): google.maps.Data.StyleOptions {\n if (!source || Object.keys(source).length === 0) {\n return target\n }\n for (const option of SUPPORTED_PROPERTY_STYLE_OPTIONS) {\n if (Object.prototype.hasOwnProperty.call(source, option)) {\n target[option] = source[option] as any\n }\n }\n return target\n}\n\n/**\n * Whether the feature declines to opt OUT of `option`.\n *\n * Resolved per key, not per object: a selected feature consults\n * `styleOptionsSelected` first and falls back to `styleOptions` only for a key\n * `styleOptionsSelected` does not itself mention. Otherwise a feature\n * declaring `styleOptionsSelected` for an unrelated reason, such as a\n * different selected fill colour, would silently lose an unrelated\n * `editable: false` from `styleOptions` the moment it is selected.\n *\n * Only an explicit `false` opts out. Shared by `computeFeatureStyle` and the\n * delete gate in `GoogleMapsService`, so the lock a consumer declares means\n * the same thing to both.\n */\nexport function featureAllows(\n feature: google.maps.Data.Feature,\n option: 'editable' | 'draggable' | 'clickable',\n): boolean {\n const selectedDeclared = isFeatureSelected(feature)\n ? getSelectedStyleOptionsDefinedByFeature(feature)\n : undefined\n const baseDeclared = getStyleOptionsDefinedByFeature(feature)\n return (selectedDeclared?.[option] ?? baseDeclared?.[option]) !== false\n}\n\n/**\n * The style for a feature, in a fixed precedence order:\n *\n * defaults\n * -> properties.styleOptions\n * -> selected defaults (when selected)\n * -> properties.styleOptionsSelected (when selected)\n * -> interaction clamp (always last)\n *\n * That chain governs the *visual* options (colours, etc.) only. The opt-out\n * flags (`editable`/`draggable`/`clickable`) resolve separately, per key: a\n * selected feature consults `styleOptionsSelected` first and falls back to\n * `styleOptions` only for a key `styleOptionsSelected` doesn't itself\n * mention — never a whole-object fallback. Otherwise a feature that declares\n * `styleOptionsSelected` for an unrelated reason, such as a different\n * selected fill colour, would silently lose an unrelated `editable: false`\n * from `styleOptions` the moment it's selected.\n *\n * The clamp is one-directional. A feature can only narrow what the context\n * permits, never widen it, so no property in an uploaded file can arm editing\n * when the mode says no.\n *\n * A declared `editable: false` also implies `draggable: false`: moving a\n * polygon changes the map's value exactly as much as reshaping it does, so a\n * feature that opts out of one opts out of the other. This implication runs\n * only one way — `draggable: false` alone does not imply `editable: false`, so\n * a feature may still opt out of dragging while remaining reshapeable via its\n * vertex handles. Resolved through `featureAllows`, which the delete gate\n * shares, so a feature that locks `editable: false` in `styleOptions` cannot\n * be dragged even if `styleOptionsSelected` declares `draggable` for an\n * unrelated reason (or not at all).\n */\nexport function computeFeatureStyle(\n feature: google.maps.Data.Feature,\n context: TheSeamMapFeatureStyleContext,\n): google.maps.Data.StyleOptions {\n const selected = isFeatureSelected(feature)\n\n const options = FEATURE_STYLE_OPTIONS_DEFAULT()\n mergeStyleOptions(options, getStyleOptionsDefinedByFeature(feature))\n\n if (selected) {\n mergeStyleOptions(options, FEATURE_STYLE_OPTIONS_SELECTED())\n mergeStyleOptions(options, getSelectedStyleOptionsDefinedByFeature(feature))\n }\n\n const editingArmed =\n context.editingEnabled && context.geometryEditingArmed && selected\n const wantsEditable = featureAllows(feature, 'editable')\n\n options.editable = wantsEditable && editingArmed\n // editable: false implies draggable: false (see the doc comment above) —\n // the reverse does not hold, so 'draggable' is still resolved on its own\n // for a feature that opts out of dragging alone.\n options.draggable =\n featureAllows(feature, 'draggable') && wantsEditable && editingArmed\n options.clickable =\n featureAllows(feature, 'clickable') && context.clicksAllowed\n\n return options\n}\n\n/**\n * The hover override, merged with anything the feature declares for hover.\n *\n * `mergeStyleOptions` is shared with `computeFeatureStyle`, and\n * `SUPPORTED_PROPERTY_STYLE_OPTIONS` includes `editable`/`draggable` so a\n * feature can opt OUT of them via `styleOptions`/`styleOptionsSelected`. But\n * this override is applied via `overrideStyle`, with no clamp downstream at\n * all — unlike `computeFeatureStyle`, where the interaction clamp runs last\n * and narrows whatever came before it. So if a consumer's\n * `styleOptionsHovered` declared `editable` or `draggable`, it would apply\n * unclamped: the one path where the \"clamp is one-directional and always\n * runs last\" guarantee would not hold. A hover override has no business\n * touching either, so both are stripped unconditionally, regardless of what\n * `styleOptionsHovered` declares.\n */\nexport function computeFeatureHoverStyle(\n feature: google.maps.Data.Feature,\n): google.maps.Data.StyleOptions {\n const options = mergeStyleOptions(\n FEATURE_STYLE_OVERRIDE_OPTIONS_HOVERED(),\n getHoveredStyleOptionsDefinedByFeature(feature),\n )\n delete options.editable\n delete options.draggable\n return options\n}\n","import { ESCAPE } from '@angular/cdk/keycodes'\nimport { NgZone, ViewContainerRef } from '@angular/core'\nimport { fromEvent, Subject } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\n\nimport { MenuComponent } from '@theseam/ui-common/menu'\n\nimport { isFeatureSelected } from './google-maps-feature-helpers'\n\n// TODO: Close on map losing focus.\n\nexport class GoogleMapsContextMenu {\n private readonly _overlayView: google.maps.OverlayView\n private readonly _cleanupFn: () => void\n\n constructor(\n private readonly _map: google.maps.Map,\n private readonly _menu: MenuComponent,\n _position: google.maps.LatLng,\n private readonly _vcr: ViewContainerRef,\n private readonly _ngZone: NgZone,\n private readonly _data: google.maps.Data,\n private readonly _feature: google.maps.Data.Feature,\n ) {\n const tplRef = this._menu.templateRef\n if (tplRef === undefined || tplRef === null) {\n throw Error(`Menu template is not defined.`)\n }\n\n const ref = this._vcr.createEmbeddedView(tplRef)\n ref.detectChanges()\n\n const listeners: google.maps.MapsEventListener[] = []\n const ngUnsubscribe = new Subject<void>()\n\n // TODO: Fix the initial focus. setTimeout avoids the wrong contextmenu\n // getting triggered, but the first item flashes and looks off this way.\n setTimeout(() => {\n this._menu.focusFirstItem('program')\n })\n this._menu.closed.pipe(takeUntil(ngUnsubscribe)).subscribe((v) => {\n this.close()\n })\n\n fromEvent(document, 'keydown')\n .pipe(takeUntil(ngUnsubscribe))\n .subscribe((event: any) => {\n if (event.keyCode === ESCAPE) {\n this.close()\n }\n })\n\n const __cleanup = () => this._cleanupFn()\n class GoogleMapsContextMenuOverlayView extends google.maps.OverlayView {\n public containerDiv: HTMLDivElement\n\n constructor(\n public position: google.maps.LatLng,\n content: HTMLElement,\n ) {\n super()\n this.position = position\n\n this.containerDiv = document.createElement('div')\n this.containerDiv.style.cursor = 'auto'\n this.containerDiv.style.height = '0'\n this.containerDiv.style.position = 'absolute'\n this.containerDiv.appendChild(content)\n\n // Optionally stop clicks, etc., from bubbling up to the map.\n GoogleMapsContextMenuOverlayView.preventMapHitsAndGesturesFrom(\n this.containerDiv,\n )\n }\n\n /** Called when the view is added to the map. */\n onAdd() {\n this.getPanes()?.floatPane.appendChild(this.containerDiv)\n }\n\n /** Called when the view is removed from the map. */\n onRemove() {\n if (this.containerDiv.parentElement) {\n this.containerDiv.parentElement.removeChild(this.containerDiv)\n }\n __cleanup()\n }\n\n /** Called each frame when the view needs to draw itself. */\n draw() {\n const divPosition = this.getProjection().fromLatLngToDivPixel(\n this.position,\n )\n if (!divPosition) {\n return\n }\n\n // Hide the popup when it is far out of view.\n const display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000\n ? 'block'\n : 'none'\n\n if (display === 'block') {\n this.containerDiv.style.left = `${divPosition.x}px`\n this.containerDiv.style.top = `${divPosition.y}px`\n }\n\n if (this.containerDiv.style.display !== display) {\n this.containerDiv.style.display = display\n }\n }\n }\n\n this._overlayView = new GoogleMapsContextMenuOverlayView(\n _position,\n ref.rootNodes[0],\n )\n this._overlayView.setMap(this._map)\n\n this._ngZone.runOutsideAngular(() => {\n listeners.push(\n this._data.addListener(\n 'removefeature',\n (event: google.maps.Data.RemoveFeatureEvent) => {\n if (event.feature === this._feature) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'setproperty',\n (event: google.maps.Data.SetPropertyEvent) => {\n if (\n event.feature === this._feature &&\n !isFeatureSelected(this._feature)\n ) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'removeproperty',\n (event: google.maps.Data.RemovePropertyEvent) => {\n if (\n event.feature === this._feature &&\n !isFeatureSelected(this._feature)\n ) {\n this._ngZone.run(() => {\n this.close()\n })\n }\n },\n ),\n )\n\n listeners.push(\n this._map.addListener(\n 'click',\n (event: google.maps.MapMouseEvent | google.maps.IconMouseEvent) => {\n this._ngZone.run(() => {\n this.close()\n })\n },\n ),\n )\n\n listeners.push(\n this._data.addListener(\n 'click',\n (event: google.maps.Data.MouseEvent) => {\n this._ngZone.run(() => {\n this.close()\n })\n },\n ),\n )\n })\n\n this._cleanupFn = () => {\n ngUnsubscribe.next()\n ngUnsubscribe.complete()\n listeners.forEach(google.maps.event.removeListener)\n }\n }\n\n public close(): void {\n this._overlayView.setMap(null)\n }\n}\n","import { Polygon } from 'geojson'\n\nimport {\n MapDrawOutcome,\n MapFeatureInteractionFlags,\n MapInteractionContext,\n MapInteractionModel,\n} from './map-interaction-model'\n\n/**\n * Multi-field behaviour, where selection and geometry editing are separate\n * concerns.\n *\n * Clicking a polygon selects its whole group and mutates nothing, whether\n * edit mode is on or off — the point being that a stray click can never nudge\n * a vertex on an imported boundary, which is close to unrecoverable without\n * an undo feature. With edit mode on, the selected group's own geometry also\n * goes to Google's vertex/midpoint editor, and a click on open map starts a\n * new drawing.\n *\n * A click on a polygon is suppressed only while a draw is actually in\n * progress — that is the one moment a click is genuinely ambiguous between\n * \"select this\" and \"place a vertex\". Between draws there is no ambiguity at\n * all, since Terra Draw is not capturing pointer input, so every polygon\n * stays clickable and selecting a different field never requires leaving\n * edit mode first.\n */\nexport class GroupedInteractionModel implements MapInteractionModel {\n readonly id = 'grouped' as const\n\n onFeatureClick(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): void {\n // While a draw is in progress, a click on a polygon is placing a vertex,\n // not a selection. Defensive: the service's data `click` listener already\n // guards on `isDrawing()` before calling in here (see onMapClick's\n // identical defence below), but this model does not rely solely on that\n // guard.\n if (context.isDrawing) {\n return\n }\n\n // Selecting mutates nothing, so it is safe on any group regardless of\n // edit mode — including a group other than the one currently selected.\n // Note which polygon was touched, since `Delete` acts on that one alone.\n // Google's vertex editor still receives the click for the selected\n // group's own geometry.\n context.selectGroup(context.groups.keyOf(feature), feature)\n }\n\n onMapClick(context: MapInteractionContext): void {\n // A click while a draw is already in progress is placing a vertex, not a\n // map click. Defensive: the service's map `click` listener already guards\n // on `isDrawing()` before calling in here, but `startDrawing()` calling\n // `setMode('polyline')` again would reset the in-progress path, so this\n // model does not rely solely on the caller's guard.\n if (context.isDrawing) {\n return\n }\n if (context.editMode) {\n context.startDrawing()\n return\n }\n context.selectGroup(null, null)\n }\n\n onDrawFinished(\n polygon: Polygon,\n context: MapInteractionContext,\n ): MapDrawOutcome {\n const selectedKey = context.getSelectedKey()\n\n if (selectedKey === null) {\n // No selection means no field to cut into. Skipping the containment\n // search entirely is what stops a polygon drawn over an unrelated field\n // from punching a hole in it.\n return { kind: 'newFeature', groupKey: null }\n }\n\n if (context.allowHoles) {\n const target = context.findContainingFeature(polygon, selectedKey)\n if (target) {\n return { kind: 'hole', target }\n }\n }\n\n return { kind: 'newFeature', groupKey: selectedKey }\n }\n\n featureFlags(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): MapFeatureInteractionFlags {\n if (!context.editMode) {\n return { geometryEditingArmed: false, clicksAllowed: true }\n }\n\n const selectedKey = context.getSelectedKey()\n const isSelectedGroup =\n selectedKey !== null && context.groups.keyOf(feature) === selectedKey\n\n return {\n // The group stays visibly selected while a draw is in progress (F3) —\n // it is the target the drawn polygon will join — but its vertex/midpoint\n // handles are disarmed for the duration, since Google's edit handles are\n // separate interactive elements that would otherwise compete with Terra\n // Draw for pointer events near the polygon. Only the selected group is\n // ever reshapeable; every group, selected or not, is merely selectable.\n geometryEditingArmed: isSelectedGroup && !context.isDrawing,\n // Suppressed only while Terra Draw is actually capturing pointer input\n // — the one window in which a click is ambiguous between selecting and\n // placing a vertex. Between draws every polygon stays clickable\n // regardless of selection, so a click can switch the selection to a\n // different field without leaving edit mode.\n clicksAllowed: !context.isDrawing,\n }\n }\n\n allowsContextMenu(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): boolean {\n // Every item this menu offers is a destructive edit (Delete Polygon,\n // Delete Field), so it must not be reachable outside edit mode, and —\n // matching legacy's `isFeatureSelected(feature)` — not for a feature the\n // user has not selected. clicksAllowed above stays gated on drawing alone\n // (a non-selected group must remain clickable so it can BECOME the\n // selection), but offering destructive actions for a field the user has\n // not selected is more surprising than useful, so the menu is narrower\n // than what is merely clickable.\n const selectedKey = context.getSelectedKey()\n return (\n context.editMode &&\n selectedKey !== null &&\n context.groups.keyOf(feature) === selectedKey\n )\n }\n}\n","import { Polygon } from 'geojson'\n\nimport { isFeatureSelected } from '../google-maps-feature-helpers'\nimport {\n MapDrawOutcome,\n MapFeatureInteractionFlags,\n MapInteractionContext,\n MapInteractionModel,\n} from './map-interaction-model'\n\n/**\n * The behaviour this module has always had: one boundary, clicking a feature\n * selects it and arms its handles, and the draw button toggles drawing.\n *\n * Two applications depend on this and are not being updated, so it must not\n * drift. Every decision here mirrors the pre-strategy service exactly.\n */\nexport class LegacyInteractionModel implements MapInteractionModel {\n readonly id = 'legacy' as const\n\n onFeatureClick(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): void {\n context.selectGroup(context.groups.keyOf(feature), feature)\n }\n\n onMapClick(context: MapInteractionContext): void {\n context.selectGroup(null, null)\n }\n\n onDrawFinished(\n polygon: Polygon,\n context: MapInteractionContext,\n ): MapDrawOutcome {\n // Legacy parity: the pre-strategy service found the exterior feature with\n // geoJsonPolygonFromDataFeature, which returns undefined for MultiPolygon\n // geometry, and that function's caller SKIPPED such a candidate and kept\n // iterating rather than giving up — so a Polygon further along could still\n // match. The shared search is now MultiPolygon-aware for grouped mode;\n // narrow it back here with an accept predicate, filtered DURING the\n // search, so a MultiPolygon candidate is skipped rather than aborting the\n // whole search the way discarding the result afterward would. Two apps\n // depend on this behaviour and are not being updated.\n const target = context.allowHoles\n ? context.findContainingFeature(\n polygon,\n undefined,\n (feature) => feature.getGeometry()?.getType() === 'Polygon',\n )\n : undefined\n\n return target\n ? { kind: 'hole', target }\n : { kind: 'newFeature', groupKey: null }\n }\n\n featureFlags(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): MapFeatureInteractionFlags {\n // Selection alone arms handles here; `editingEnabled` is the only gate,\n // and `computeFeatureStyle` applies it.\n return { geometryEditingArmed: true, clicksAllowed: true }\n }\n\n allowsContextMenu(\n feature: google.maps.Data.Feature,\n context: MapInteractionContext,\n ): boolean {\n return isFeatureSelected(feature)\n }\n}\n","/** Below this projected diagonal, a shape is too small to label. */\nexport const DEFAULT_LABEL_MIN_DIAGONAL_PX = 48\n\n/**\n * Whether a group is large enough on screen to carry a label.\n *\n * Uses the diagonal rather than width and height separately, so a long thin\n * field — which has plenty of room for a label — is not hidden for being\n * narrow. This self-tunes as the map zooms out, which is why there is no\n * `minZoom` input.\n */\nexport function isLabelVisibleAtSize(\n widthPx: number,\n heightPx: number,\n minDiagonalPx: number = DEFAULT_LABEL_MIN_DIAGONAL_PX,\n): boolean {\n return Math.hypot(widthPx, heightPx) >= minDiagonalPx\n}\n","import { isLabelVisibleAtSize } from './label-visibility'\n\nexport interface MapFeatureLabel {\n key: string\n text: string\n bounds: google.maps.LatLngBounds\n}\n\nexport const MAP_FEATURE_LABEL_CLASS = 'seam-map-feature-label'\n\n/**\n * Renders one label per feature group.\n *\n * The `google.maps.OverlayView` subclass is declared INSIDE the constructor\n * rather than at module scope. This codebase's Google Maps API loader is\n * lazy (see `TheSeamLazyMapsApiLoader`), so `google.maps` is not guaranteed\n * to exist when this module is first imported — a top-level\n * `class X extends google.maps.OverlayView` evaluates that reference at\n * import time and throws `ReferenceError: google is not defined` before the\n * API script has loaded. `GoogleMapsContextMenuOverlayView` in\n * `google-maps-contextmenu.ts` is declared locally for the same reason.\n * `MapFeatureLabelsOverlay` itself is only ever constructed once the map\n * (and therefore the API) is ready, via `GoogleMapsService`, so deferring the\n * subclass to construction time is safe.\n *\n * Internally it is a single OverlayView holding one child div per group,\n * rather than one overlay each: with many fields that is one `draw()` per\n * frame updating N child positions instead of N overlays each doing\n * projection work.\n *\n * Labels live in the `markerLayer` pane, which sits above the `overlayLayer`\n * pane the Data layer renders polygons into (so labels are not decided by DOM\n * insertion order) and below the `floatPane` `GoogleMapsContextMenu` uses (so\n * the context menu still stays on top). `pointer-events: none` means labels\n * never take part in hit testing and cannot interfere with clicks, drawing, or\n * the context-menu overlay.\n *\n * Known limitation: no collision de-confliction. Labels of nearby groups will\n * overlap at low zoom. The size threshold reduces but does not eliminate this.\n */\nexport class MapFeatureLabelsOverlay {\n private readonly _overlay: google.maps.OverlayView & { refresh(): void }\n\n constructor(getLabels: () => MapFeatureLabel[]) {\n const container = document.createElement('div')\n container.style.position = 'absolute'\n container.style.left = '0'\n container.style.top = '0'\n container.style.pointerEvents = 'none'\n\n const elements = new Map<string, HTMLDivElement>()\n let labels: MapFeatureLabel[] = []\n\n const elementFor = (label: MapFeatureLabel): HTMLDivElement => {\n let element = elements.get(label.key)\n if (!element) {\n element = document.createElement('div')\n element.className = MAP_FEATURE_LABEL_CLASS\n element.style.position = 'absolute'\n element.style.transform = 'translate(-50%, -50%)'\n element.style.pointerEvents = 'none'\n element.style.whiteSpace = 'nowrap'\n container.appendChild(element)\n elements.set(label.key, element)\n }\n if (element.textContent !== label.text) {\n element.textContent = label.text\n }\n return element\n }\n\n class Overlay extends google.maps.OverlayView {\n onAdd(): void {\n this.getPanes()?.markerLayer.appendChild(container)\n }\n\n onRemove(): void {\n container.parentElement?.removeChild(container)\n elements.clear()\n }\n\n /** Re-read the labels and repaint. Call when the value or grouping changes. */\n refresh(): void {\n labels = getLabels()\n this.draw()\n }\n\n draw(): void {\n const projection = this.getProjection()\n if (!projection) {\n return\n }\n\n const seen = new Set<string>()\n\n for (const label of labels) {\n seen.add(label.key)\n const element = elementFor(label)\n\n const ne = projection.fromLatLngToDivPixel(\n label.bounds.getNorthEast(),\n )\n const sw = projection.fromLatLngToDivPixel(\n label.bounds.getSouthWest(),\n )\n const centre = projection.fromLatLngToDivPixel(\n label.bounds.getCenter(),\n )\n if (!ne || !sw || !centre) {\n element.hidden = true\n continue\n }\n\n const visible = isLabelVisibleAtSize(\n Math.abs(ne.x - sw.x),\n Math.abs(ne.y - sw.y),\n )\n element.hidden = !visible\n if (visible) {\n element.style.left = `${centre.x}px`\n element.style.top = `${centre.y}px`\n }\n }\n\n for (const [key, element] of elements) {\n if (!seen.has(key)) {\n element.parentElement?.removeChild(element)\n elements.delete(key)\n }\n }\n }\n }\n\n this._overlay = new Overlay()\n }\n\n /** Attach to (or detach from, with `null`) a map. */\n setMap(map: google.maps.Map | null): void {\n this._overlay.setMap(map)\n }\n\n /** Re-read the labels and repaint. Call when the value or grouping changes. */\n refresh(): void {\n this._overlay.refresh()\n }\n\n destroy(): void {\n this._overlay.setMap(null)\n }\n}\n","import { Injectable } from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nexport enum MapValueSource {\n Input = 'input',\n FeatureChange = 'featurechange',\n}\n\nexport type MapValue = object | undefined | null\n\nexport interface MapValueChange {\n value: MapValue\n source: MapValueSource\n}\n\n@Injectable()\nexport class MapValueManagerService {\n private readonly _valueChangedSubject = new Subject<MapValueChange>()\n\n private _value: MapValue\n\n public readonly valueChanged: Observable<MapValueChange>\n\n constructor() {\n this.valueChanged = this._valueChangedSubject.asObservable()\n }\n\n public setValue(value: MapValue, source: MapValueSource): boolean {\n if (value === this._value) {\n return false\n }\n\n if (value === null || value === undefined) {\n this._value = value\n const _change: MapValueChange = {\n source,\n value: this._value,\n }\n this._valueChangedSubject.next(_change)\n return true\n }\n\n if (JSON.stringify(value) === JSON.stringify(this._value)) {\n return true\n }\n\n // TODO: Validate object is valid geojson.\n this._value = value\n const change: MapValueChange = {\n source,\n value: this._value,\n }\n this._valueChangedSubject.next(change)\n return true\n }\n\n public get value(): MapValue {\n return this._value\n }\n}\n","import { Injectable, NgZone, OnDestroy, ViewContainerRef } from '@angular/core'\nimport { Geometry, Polygon } from 'geojson'\nimport { BehaviorSubject, from, Observable, Subject } from 'rxjs'\nimport { distinctUntilChanged, switchMap, takeUntil, tap } from 'rxjs/operators'\n\nimport { TerraDraw, TerraDrawPolyLineMode } from 'terra-draw'\nimport { TerraDrawGoogleMapsAdapter } from 'terra-draw-google-maps-adapter'\n\nimport { MenuComponent } from '@theseam/ui-common/menu'\nimport {\n closePolygons,\n notNullOrUndefined,\n polygonContains,\n polygonHasMinDistinctVertices,\n} from '@theseam/ui-common/utils'\n\nimport {\n FeatureGroupRegistry,\n FeatureGroupRegistryOptions,\n} from './feature-groups/feature-group-registry'\nimport {\n TheSeamMapFeatureGroup,\n TheSeamMapGroupTarget,\n} from './feature-groups/feature-group'\nimport { TheSeamMapFileImportError } from './map-file-import-error'\nimport {\n computeFeatureHoverStyle,\n computeFeatureStyle,\n featureAllows,\n} from './feature-style/compute-feature-style'\nimport { GoogleMapsContextMenu } from './google-maps-contextmenu'\nimport {\n applyHoleToFeature,\n createFeatureChangeObservable,\n dataPolygonFromGeoJson,\n getBoundsWithAllFeatures,\n getFeatureCenter,\n getFeaturesCount,\n isFeatureSelected,\n polygonsFromDataFeature,\n removeAllFeatures,\n setFeatureSelected,\n stripAppFeaturePropertiesFromJson,\n} from './google-maps-feature-helpers'\nimport { GroupedInteractionModel } from './interaction/grouped-interaction-model'\nimport { TheSeamMapInteractionMode } from './interaction/interaction-mode'\nimport { LegacyInteractionModel } from './interaction/legacy-interaction-model'\nimport {\n MapInteractionContext,\n MapInteractionModel,\n} from './interaction/map-interaction-model'\nimport {\n MapFeatureLabel,\n MapFeatureLabelsOverlay,\n} from './labels/map-feature-labels-overlay'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from './map-value-manager.service'\n\ndeclare const ngDevMode: boolean | undefined\n\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\n/**\n * A delete that has been resolved to the features it would remove and the\n * target to consult `canDelete` with. Built by `_deletionOf`; `null` there\n * means there is nothing to delete at all, which is not a refusal.\n */\ninterface ResolvedDeletion {\n removing: google.maps.Data.Feature[]\n target: TheSeamMapGroupTarget\n /**\n * The delete removes a feature that no target can honestly name: it is\n * absent from `groupWithSources().sources` (its geometry is neither Polygon\n * nor MultiPolygon), so it appears in no `group.features` the consumer has\n * ever seen, while the group itself survives the delete.\n *\n * Only ever true for a delete that does NOT empty the group — when the group\n * is emptied, `feature: null` is honest regardless of what is being removed.\n */\n unnamable: boolean\n}\n\n@Injectable()\nexport class GoogleMapsService implements OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private readonly _mapReadySubject = new BehaviorSubject<boolean>(false)\n private readonly _editingEnabledSubject = new BehaviorSubject<boolean>(true)\n\n private _terraDraw?: TerraDraw\n private _terraDrawReady = false\n // Terra Draw's Google Maps adapter can lose pointer capture at the adapter\n // level after a completed draw session (terra-draw#710): every click after\n // that lands on nothing, and a drag pans the map instead of editing.\n // Recreating the whole `TerraDraw` instance (and its adapter) is the only\n // thing that restores it. `stopDrawing()` triggers this — EAGERLY, right\n // when the session ends, not lazily on the next `startDrawing()` — but\n // only for a session that actually placed a coordinate (see\n // `_hasPlacedVertex()`): that is the only kind that ever touched the\n // adapter's pointer capture, so an armed-but-empty session (armed, then\n // cancelled with zero vertices placed — e.g. by `Escape`, or by\n // `setEditMode(true)`'s auto-arm getting turned straight back off) does\n // not need it and does not pay for it.\n //\n // Recreating eagerly (rather than deferring to the next `startDrawing()`)\n // means the new instance's `ready` has every chance to have already fired\n // by the time the user's NEXT click asks to start a second draw, so that\n // click is not the one racing the async gap. A `startDrawing()` call that\n // still arrives before `ready` fires — instance rebuild is fast but not\n // free — queues itself via `_pendingStartDrawing` below rather than being\n // dropped, so nothing is lost even in that case.\n private _pendingStartDrawing = false\n /**\n * One-shot suppression for the map `click` listener, armed the instant a\n * draw finishes (see `_armMapClickSuppression()` for why, and its call\n * site in `_onDrawFinished()`).\n *\n * `domEvent.timeStamp` was tried first, since it is a `DOMHighResTimeStamp`\n * on the same origin as `performance.now()` and looks like a clean,\n * delay-free discriminator: a stale click's timestamp should predate the\n * moment the draw finished. It does not hold up empirically. Driving real\n * mouse draws against the live Storybook and logging both the map `click`\n * listener and `stopDrawing()` (see docs/superpowers/reports/closing-click-report.md)\n * caught the echo repeatedly, and every single time its `domEvent.timeStamp`\n * was a few milliseconds AFTER `stopDrawing()`'s own timestamp, not before\n * — indistinguishable from a genuinely fresh click by timestamp alone.\n * Google appears to stamp its own synthetic `click` at the moment IT\n * dispatches, not at the original pointer event's time, so there is no\n * \"stale-looking\" timestamp to compare against.\n */\n private _suppressNextMapClick = false\n private readonly _drawingSubject = new BehaviorSubject<boolean>(false)\n public readonly drawing$ = this._drawingSubject.asObservable()\n private _featureContextMenu: MenuComponent | null = null\n private _activeContextMenu: GoogleMapsContextMenu | null = null\n private _baseLatLng?: google.maps.LatLngLiteral\n private _padding?: number | google.maps.Padding\n\n private _allowDrawingHoleInPolygon = false\n\n private _model: MapInteractionModel = new LegacyInteractionModel()\n private readonly _interactionModeSubject =\n new BehaviorSubject<TheSeamMapInteractionMode>('legacy')\n public readonly interactionMode$ = this._interactionModeSubject.asObservable()\n private _groups?: FeatureGroupRegistry\n private _groupOptions: FeatureGroupRegistryOptions = {}\n private _focusedFeature: google.maps.Data.Feature | null = null\n private _styleFn?: google.maps.Data.StylingFunction\n\n private _labelProperty: string | undefined\n private _labelsOverlay?: MapFeatureLabelsOverlay\n private _warnedAboutLabelDisagreement = false\n\n private _canDelete: ((target: TheSeamMapGroupTarget) => boolean) | undefined\n\n private readonly _deleteBlockedSubject = new Subject<TheSeamMapGroupTarget>()\n /**\n * A delete that was attempted and refused. Fires only from the three delete\n * commands, never from their `canDelete*` queries — rendering a menu is not\n * an attempt.\n */\n public readonly deleteBlocked$ = this._deleteBlockedSubject.asObservable()\n\n /**\n * A file reached one of the import paths and could not be read. Plain\n * `Subject`, not `BehaviorSubject`: a consumer subscribing later should not\n * be handed a failure from before it was listening.\n */\n private readonly _fileImportErrorSubject =\n new Subject<TheSeamMapFileImportError>()\n public readonly fileImportError$ = this._fileImportErrorSubject.asObservable()\n\n private readonly _selectionSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n /**\n * `distinctUntilChanged` collapses repeated `null`s. Several paths clear the\n * selection defensively — `setData`, `clearSelection`, the declarative\n * `selectedGroupKey` application on map-ready — and each would otherwise\n * emit its own `null` to consumers before the user has touched anything.\n *\n * Non-null targets are rebuilt on every change, so reference equality never\n * suppresses a real one, including re-selecting the same group with a\n * different focused polygon.\n */\n public readonly selection$ = this._selectionSubject.pipe(\n distinctUntilChanged(),\n )\n\n private readonly _hoverSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n /** Same reasoning as `selection$`; `mouseout` repeats `null` freely. */\n public readonly hover$ = this._hoverSubject.pipe(distinctUntilChanged())\n\n /**\n * The group of the feature a `contextmenu` event last landed on. Kept\n * distinct from `selection$` even though `allowsContextMenu()` now requires\n * the right-clicked feature's group to already be the selection — so, for\n * as long as the menu stays open, the two are provably the same group.\n * Collapsing onto `selection$` would re-couple \"what the menu acts on\" to\n * \"whatever is currently selected\", which is exactly the coupling this\n * subject was introduced to break when the menu could still open for a\n * non-selected group. That rule has already moved twice; keeping this\n * separate means a future loosening of `allowsContextMenu()` does not have\n * to re-invent it.\n */\n private readonly _contextMenuTargetSubject =\n new BehaviorSubject<TheSeamMapGroupTarget | null>(null)\n public readonly contextMenuTarget$ =\n this._contextMenuTargetSubject.asObservable()\n\n private readonly _editModeSubject = new BehaviorSubject<boolean>(false)\n public readonly editMode$ = this._editModeSubject.asObservable()\n\n // TODO: Move to a better place than the map wrapper service.\n private _fileInputHandler: ((file: File) => void) | undefined | null\n\n public googleMap?: google.maps.Map\n\n public readonly mapReady$: Observable<boolean>\n\n public get mapReady(): boolean {\n return this._mapReadySubject.value\n }\n\n public readonly editingEnabled$: Observable<boolean>\n\n constructor(\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _ngZone: NgZone,\n private readonly _vcr: ViewContainerRef,\n ) {\n this.editingEnabled$ = this._editingEnabledSubject.asObservable()\n this.mapReady$ = this._mapReadySubject.asObservable()\n }\n\n ngOnDestroy(): void {\n this._disposeTerraDraw()\n this._drawingSubject.complete()\n this._selectionSubject.complete()\n this._hoverSubject.complete()\n this._contextMenuTargetSubject.complete()\n this._editModeSubject.complete()\n this._interactionModeSubject.complete()\n this._deleteBlockedSubject.complete()\n this._fileImportErrorSubject.complete()\n this._groups = undefined\n\n this._labelsOverlay?.destroy()\n this._labelsOverlay = undefined\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n public setMap(map: google.maps.Map): void {\n this.googleMap = map\n this._mapReadySubject.next(true)\n // Terra Draw's Google Maps adapter binds its event listeners to the map's\n // rendered '.gm-style' DOM subtree (located via querySelector). That subtree\n // does not exist yet when 'mapInitialized' fires, so initializing Terra Draw\n // synchronously here makes the adapter register listeners on a null element\n // and throw. Defer init until the map has rendered (first 'idle').\n google.maps.event.addListenerOnce(map, 'idle', () => this._initTerraDraw())\n this._initFeatureStyling()\n this._initFeatureChangeListeners()\n }\n\n public setBaseLatLng(lat: number, lng: number): void {\n this._baseLatLng = { lat, lng }\n }\n\n public setPadding(padding: number | google.maps.Padding | undefined): void {\n this._padding = padding\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public setFeatureContextMenu(menu: MenuComponent | null): void {\n this.closeContextMenu()\n this._featureContextMenu = menu\n }\n\n public setEditingEnabled(enabled: boolean): void {\n this._editingEnabledSubject.next(enabled)\n\n if (this.mapReady) {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n if (!enabled) {\n this.stopDrawing()\n this.setEditMode(false)\n this.clearSelection()\n }\n }\n }\n\n public isEditingEnabled(): boolean {\n return this._editingEnabledSubject.value\n }\n\n public getDiv(): HTMLDivElement {\n this._assertInitialized()\n return this.googleMap.getDiv() as HTMLDivElement\n }\n\n public fitBounds(\n bounds: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n padding?: number | google.maps.Padding,\n ): void {\n this._assertInitialized()\n this.googleMap.fitBounds(bounds, padding)\n }\n\n /**\n * Iterates the map's features and removes any that are selected.\n */\n private _removeSelection(): void {\n this._assertInitialized()\n const mapData = this.googleMap.data\n mapData.forEach((f) => {\n if (isFeatureSelected(f)) {\n mapData.remove(f)\n }\n })\n // Every deleted feature was selected, so nothing should still read as\n // selected afterward. Re-sync `selection$` and `_focusedFeature` the same\n // way `_removeFocusedFeature()` and `setData()` already do, rather than\n // leaving them pointing at a group that no longer exists. In 'legacy'\n // mode nothing consumes selection$ today, and no remaining feature's raw\n // selected flag changes here (they were already false), so this is inert\n // there.\n this.clearSelection()\n }\n\n /**\n * The consumer's veto. Consulted for every delete on every path, and for\n * whether to offer a delete at all.\n */\n public setCanDelete(\n predicate: ((target: TheSeamMapGroupTarget) => boolean) | undefined | null,\n ): void {\n this._canDelete = predicate ?? undefined\n }\n\n /**\n * Pair a set of features to remove with the target to consult `canDelete`\n * with. `null` when there is nothing to delete — distinct from a refusal,\n * and the reason no honest target exists to report.\n *\n * Builds `target.feature` itself rather than delegating the decision to\n * `_targetFor`. There, `feature: null` means only \"no particular feature\";\n * here it is a promise that the whole group is about to cease to exist.\n * Conflating the two is what let a delete of ONE polygon be consulted as a\n * group delete — see `ResolvedDeletion.unnamable`.\n */\n private _deletionOf(\n key: string | null,\n removing: google.maps.Data.Feature[],\n ): ResolvedDeletion | null {\n if (key === null || removing.length === 0) {\n return null\n }\n const resolved = this._registry.groupWithSources(key)\n if (!resolved) {\n return null\n }\n // The empty-group invariant: a delete that leaves the group with no\n // features at all is a group delete, whichever path asked for it — so\n // `feature: null` always means \"this group is about to cease to exist\"\n // and a consumer never has to count features itself. Compared against\n // `featuresIn`, not `resolved.sources`, because a feature with\n // unsupported geometry is missing from `sources` but still occupies the\n // group.\n const all = this._registry.featuresIn(key)\n const emptiesGroup = all.every((f) => removing.indexOf(f) !== -1)\n if (emptiesGroup) {\n // `feature: null` is honest here whatever `removing` holds: the group\n // really is going, unsupported-geometry members included. This case is\n // never at risk, so it is never `unnamable`.\n return {\n removing,\n target: { group: resolved.group, feature: null },\n unnamable: false,\n }\n }\n\n // The group survives, so the target must name the polygon being removed.\n const index = resolved.sources.indexOf(removing[0])\n if (index === -1) {\n // The feature being removed is absent from `sources`: its geometry is\n // neither Polygon nor MultiPolygon, so `groupWithSources` dropped it and\n // it has no emitted GeoJSON counterpart. It has never appeared in any\n // `group.features` the consumer has seen, so NO value of\n // `target.feature` describes it — which is exactly why this deletion is\n // `unnamable` and `_mayDeleteResolved()` refuses it outright whenever a\n // predicate is set.\n //\n // `feature: null` is the least dishonest option available. It overstates\n // the scope — it reads as \"the field is going\" when only one polygon\n // was asked for — but it names the right group, and it is only ever READ\n // on the `deleteBlocked$` emission that reports the refusal: the\n // predicate is refused before it is ever consulted with this target, and\n // with no predicate set nothing observes it at all. A target that only\n // ever reports a refusal cannot authorise a removal, so the overstatement\n // is inert. The alternative was emitting nothing, which would leave a\n // refused delete indistinguishable from a successful one on the design's\n // only feedback channel.\n return {\n removing,\n target: { group: resolved.group, feature: null },\n unnamable: true,\n }\n }\n return {\n removing,\n target: {\n group: resolved.group,\n feature: resolved.group.features[index],\n },\n unnamable: false,\n }\n }\n\n /** Resolves the same features `_removeSelection()` would remove. */\n private _selectionDeletion() {\n this._assertInitialized()\n const removing: google.maps.Data.Feature[] = []\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n removing.push(f)\n }\n })\n if (removing.length === 0) {\n return null\n }\n return this._deletionOf(this._registry.keyOf(removing[0]), removing)\n }\n\n /** Resolves the same features `_removeFocusedFeature()` would remove. */\n private _focusedFeatureDeletion() {\n const focused = this._focusedFeature\n if (focused === null) {\n return this._selectionDeletion()\n }\n return this._deletionOf(this._registry.keyOf(focused), [focused])\n }\n\n /** Resolves the same features `_removeGroup(key)` would remove. */\n private _groupDeletion(key: string) {\n return this._deletionOf(key, this._registry.featuresIn(key))\n }\n\n /**\n * Whether `removing` may be deleted: the feature-declared lock first, then\n * the consumer's predicate.\n *\n * MUST stay pure. It also answers menu-render questions, which are not\n * delete attempts — a side effect here would fire on every right-click.\n */\n private _mayDelete(\n removing: google.maps.Data.Feature[],\n target: TheSeamMapGroupTarget,\n ): boolean {\n // A feature the consumer locked against reshaping must not be removable\n // by another route: deleting a polygon changes the map's value at least\n // as much as reshaping it does. Same precedent as editable: false\n // implying draggable: false in compute-feature-style.ts.\n if (removing.some((f) => !featureAllows(f, 'editable'))) {\n return false\n }\n return this._canDelete?.(target) ?? true\n }\n\n /**\n * Whether a resolved deletion may proceed. The single gate every query and\n * every command goes through.\n *\n * Wraps `_mayDelete` with the one refusal that cannot be phrased as a\n * question about a target: an `unnamable` delete. Consulting the predicate\n * there would mean LYING to it — handing it `feature: null`, which promises\n * the whole group is about to cease to exist, for a delete that removes one\n * polygon and leaves the rest standing. A consumer whose rule is \"a field\n * may be deleted, an individual polygon may not\" answers `true` to that and\n * loses a polygon it meant to keep. Fail closed exactly where a consumer's\n * rule could be subverted.\n *\n * Only when a predicate is actually set. With none there is nobody to lie\n * to, so there is nothing to protect — and refusing unconditionally would\n * change 'legacy' mode's behaviour for unsupported-geometry features, which\n * two applications depend on and this work must not drift.\n *\n * Pure, like `_mayDelete`: it also answers menu-render questions.\n */\n private _mayDeleteResolved(deletion: ResolvedDeletion): boolean {\n if (deletion.unnamable && this._canDelete !== undefined) {\n return false\n }\n return this._mayDelete(deletion.removing, deletion.target)\n }\n\n /** Whether \"Delete Polygon\" (or the `Delete` key) may act. */\n public canDeleteFocusedFeature(): boolean {\n if (!this.mapReady) {\n return false\n }\n const deletion = this._focusedFeatureDeletion()\n return deletion !== null && this._mayDeleteResolved(deletion)\n }\n\n /** Whether \"Delete Field\" may act on `key`. */\n public canDeleteGroup(key: string): boolean {\n if (!this.mapReady) {\n return false\n }\n const deletion = this._groupDeletion(key)\n return deletion !== null && this._mayDeleteResolved(deletion)\n }\n\n /** Whether the legacy \"Delete\" item (or the `Delete` key) may act. */\n public canDeleteSelection(): boolean {\n if (!this.mapReady) {\n return false\n }\n const deletion = this._selectionDeletion()\n return deletion !== null && this._mayDeleteResolved(deletion)\n }\n\n /**\n * Remove every selected feature, unless `canDelete` or a feature's own\n * `editable: false` refuses. A refused delete emits on `deleteBlocked$` and\n * changes nothing.\n */\n public deleteSelection(): void {\n this._assertInitialized()\n const deletion = this._selectionDeletion()\n if (deletion !== null && !this._mayDeleteResolved(deletion)) {\n this._deleteBlockedSubject.next(deletion.target)\n return\n }\n this._removeSelection()\n }\n\n /**\n * Delete every feature in `key`'s group. Backs the grouped \"Delete Field\"\n * context-menu item.\n *\n * `allowsContextMenu()` now requires the right-clicked feature's group to\n * already be the selection, so `key` here is always the selected group's\n * key by the time this runs — making this call equivalent in practice to\n * `deleteSelection()`. Kept as its own method anyway: it names the thing\n * the menu item actually acts on (the group the menu opened for) rather\n * than relying on the coincidence that it currently matches whatever is\n * selected, a coincidence this design has already stopped being true once\n * before and could again.\n */\n private _removeGroup(key: string): void {\n this._assertInitialized()\n const mapData = this.googleMap.data\n const wasSelected = this._selectionSubject.value?.group.key === key\n const focusedInGroup =\n this._focusedFeature !== null &&\n this._registry.keyOf(this._focusedFeature) === key\n const contextMenuTargetInGroup =\n this._contextMenuTargetSubject.value?.group.key === key\n\n this._registry.featuresIn(key).forEach((f) => mapData.remove(f))\n\n if (wasSelected) {\n this._applySelection(null, null)\n } else if (focusedInGroup) {\n this._focusedFeature = null\n }\n // The whole group is gone, so a context-menu target pointing at it — set\n // by whichever interaction opened the menu, not necessarily this one — is\n // now a dangling reference. Only clear it when it actually named this\n // group; an unrelated still-open menu's target must survive.\n if (contextMenuTargetInGroup) {\n this._contextMenuTargetSubject.next(null)\n }\n }\n\n /**\n * Remove every feature in `key`'s group, unless `canDelete` or a feature's\n * own `editable: false` refuses. A refused delete emits on `deleteBlocked$`\n * and changes nothing.\n */\n public deleteGroup(key: string): void {\n this._assertInitialized()\n const deletion = this._groupDeletion(key)\n if (deletion !== null && !this._mayDeleteResolved(deletion)) {\n this._deleteBlockedSubject.next(deletion.target)\n return\n }\n this._removeGroup(key)\n }\n\n /**\n * Whether polygon drawing mode is currently active.\n *\n * Reads `_drawingSubject` — set by `startDrawing()`/`stopDrawing()`, which\n * this service fully controls — rather than asking Terra Draw's own\n * `getMode()`. The two are kept in lockstep by every call to those two\n * methods, so this is not a behaviour change; it exists so a stuck Terra\n * Draw mode can never silently disagree with, and disarm, the rest of this\n * service's drawing-state bookkeeping (F3's `geometryEditingArmed`\n * included). `stopDrawing()` still always calls `_terraDraw.setMode('static')`\n * to make Terra Draw itself release its cursor override and any\n * in-progress geometry, regardless of which source `isDrawing()` reads.\n */\n public isDrawing(): boolean {\n return this._drawingSubject.value\n }\n\n /** Enter polygon drawing mode. */\n public startDrawing(): void {\n if (\n !this._terraDraw ||\n !this.isEditingEnabled() ||\n // Already drawing: `setMode('polyline')` resets the in-progress path,\n // so a click that lands here mid-draw (F4) must not re-enter drawing\n // mode. `onMapClick` already guards on `context.isDrawing` before\n // calling in, and the map `click` listener guards on `isDrawing()`\n // before calling the model at all — this is the last line of defence.\n this.isDrawing()\n ) {\n return\n }\n if (!this._terraDrawReady) {\n // A `TerraDraw` recreate is in flight — either the eager rebuild\n // `stopDrawing()` kicks off after a real draw session ends (see\n // `_hasPlacedVertex()`), or, rarely, first-ever init hasn't reported\n // `ready` yet. Recreation itself is synchronous, but the new\n // instance's `ready` event is not (see `_createTerraDraw()`), so queue\n // this call rather than silently dropping the click that made it —\n // the `ready` handler below finishes entering drawing mode once the\n // new instance is actually usable.\n this._pendingStartDrawing = true\n return\n }\n this._enterDrawingMode()\n }\n\n /**\n * Clear any selection when entering drawing mode, but only in 'legacy'\n * mode. There, a selected feature and the shape being drawn are unrelated,\n * so leaving the old one visibly selected would read as one shape. In\n * 'grouped' mode they are related: the selected group is exactly the\n * target the drawn polygon will join, so it keeps its selected styling —\n * `GroupedInteractionModel.featureFlags()` disarms its edit handles for\n * the duration instead (F3), so they don't compete with Terra Draw for\n * pointer events.\n *\n * Split out of `startDrawing()` so a recreate-in-flight (see\n * `_pendingStartDrawing`) can defer this until the new instance's `ready`\n * event actually fires, instead of entering drawing mode against an\n * instance that isn't ready yet.\n */\n private _enterDrawingMode(): void {\n this._assertInitialized()\n if (this._model.id === 'legacy') {\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n setFeatureSelected(f, false)\n }\n })\n }\n this._terraDraw?.setMode('polyline')\n this._drawingSubject.next(true)\n this._refreshStyles()\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Cancel any in-progress drawing and leave drawing mode. Switching to the\n * `static` mode clears an unfinished line.\n */\n public stopDrawing(): void {\n if (!this._terraDraw || !this._terraDrawReady) {\n return\n }\n const wasDrawing = this.isDrawing()\n // Read BEFORE setMode('static') below — switching the active mode away\n // stops it, which resets its own state, so this only means anything\n // while the polyline mode is still the one active.\n const placedVertex = wasDrawing && this._hasPlacedVertex()\n this._terraDraw.setMode('static')\n this._drawingSubject.next(false)\n if (placedVertex) {\n // A real draw session — one that actually placed a coordinate, and so\n // actually engaged the adapter's pointer capture — just ended\n // (finished OR cancelled). That capture is what terra-draw#710 can\n // leave broken. An armed-but-empty session (armed via a click, or via\n // setEditMode(true)'s auto-arm, then cancelled — e.g. by Escape —\n // with zero vertices placed) never touched it and does not need this.\n //\n // Recreate EAGERLY, right now, rather than deferring to the next\n // startDrawing() call: the new instance then has the rest of this\n // moment, plus however long the user takes to look at what they just\n // did, to finish coming up — so the click that starts the NEXT draw\n // does not itself race the async `ready` gap. `startDrawing()`'s own\n // `!_terraDrawReady` branch (queuing via `_pendingStartDrawing`) is\n // the safety net for a start that still arrives before `ready` fires.\n this._recreateTerraDraw()\n }\n // Re-arms the selected group's edit handles in 'grouped' mode: nothing\n // else changes a feature's own properties here, so nothing else would\n // make Data re-evaluate the style function and pick up\n // `featureFlags().geometryEditingArmed` no longer being disarmed by\n // `isDrawing` (F3).\n this._refreshStyles()\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Whether the active Terra Draw mode has actually placed a coordinate.\n * Terra Draw's own mode state machine transitions from `'started'`\n * (armed, no coordinate committed yet) to `'drawing'` the instant the\n * first vertex lands (`TerraDrawPolyLineMode`'s internal `setDrawing()`,\n * confirmed against `terra-draw`'s own source). Read directly from Terra\n * Draw's state rather than inferred from this service's own flags, so it\n * reflects whether the adapter's pointer capture was actually\n * engaged — the thing terra-draw#710 is actually about — rather than\n * merely whether this service thought a draw was armed.\n */\n private _hasPlacedVertex(): boolean {\n return this._terraDraw?.getModeState() === 'drawing'\n }\n\n /**\n * Stop (if running) and drop the current `TerraDraw` instance. `TerraDraw#\n * stop()` deregisters its adapter, which for the Google Maps adapter's\n * `isolatedData: true` mode calls `this._data.setMap(null)` and drops the\n * reference — so this never leaves an orphaned or duplicate Data layer\n * behind, across any number of calls.\n */\n private _disposeTerraDraw(): void {\n if (this._terraDraw?.enabled) {\n this._terraDraw.stop()\n }\n this._terraDraw = undefined\n this._terraDrawReady = false\n }\n\n /**\n * Dispose the current `TerraDraw` instance (and its adapter) and build a\n * fresh one in its place. This is the terra-draw#710 recovery: the old\n * instance's listeners die with it (its adapter is deregistered by\n * `stop()`, so nothing further reaches it), and `_createTerraDraw()` wires\n * up brand new `ready`/`finish` listeners on the new instance — never the\n * stale closures from a previous instance.\n */\n private _recreateTerraDraw(): void {\n this._disposeTerraDraw()\n this._terraDraw = this._createTerraDraw()\n }\n\n private _initTerraDraw(): void {\n if (notNullOrUndefined(this._terraDraw)) {\n throw Error(`Terra Draw is already initialized.`)\n }\n this._terraDraw = this._createTerraDraw()\n }\n\n /**\n * Build and start a new `TerraDraw` instance with its Google Maps adapter,\n * wiring up this instance's own `ready`/`finish` listeners. Called both by\n * `_initTerraDraw()` (first-ever init, guarded against running twice) and\n * by `_recreateTerraDraw()` (every terra-draw#710 recovery afterward) —\n * the guard against accidental double-init only lives in `_initTerraDraw()`\n * itself, so recreation is free to call this as many times as needed.\n */\n private _createTerraDraw(): TerraDraw {\n this._assertInitialized()\n\n // The Google Maps adapter creates an OverlayView on the map; ensure the map\n // element has an id (harmless if one is already present).\n const div = this.googleMap.getDiv() as HTMLElement\n if (!div.id) {\n div.id = `seam-google-map-${Math.floor(performance.now())}`\n }\n\n const pointerDistance = 10\n\n // KNOWN ISSUE (upstream, unresolved): after repeated draws, Terra Draw can\n // intermittently lose pointer control of the Google Maps adapter, so input\n // pans the map instead of drawing until the page is reloaded. This is a race\n // between Terra Draw and the Google Maps adapter, tracked at\n // https://github.com/JamesLMilner/terra-draw/issues/710 (open as of\n // terra-draw 1.32.0 / adapter 1.6.1). It is not fixable in this wrapper;\n // revisit when the upstream issue is resolved.\n const draw = new TerraDraw({\n adapter: new TerraDrawGoogleMapsAdapter({\n lib: google.maps,\n map: this.googleMap,\n // Render Terra Draw's in-progress/finished geometry on its OWN Data\n // layer instead of the map's shared `map.data`. Without this, Terra\n // Draw's features land in the same layer this service manages, so the\n // exterior-feature search would match a just-drawn polygon against its\n // own rendered copy (cutting a hole equal to itself) and getGeoJson\n // would serialize Terra Draw's transient features.\n isolatedData: true,\n }),\n modes: [\n new TerraDrawPolyLineMode({\n // Tighten how close a click must be to the first point to close the\n // polygon (Terra Draw's default ~40px felt too far / closed too\n // easily).\n pointerDistance,\n // Snap the moving vertex onto the line's OWN first point when the\n // cursor is within a few pixels of it, so it's clear the ends are\n // about to meet just before the click that closes the polygon.\n // (Terra Draw's built-in `toCoordinate` only snaps to OTHER features'\n // points — excluding the line being drawn — so it does nothing here.)\n snapping: {\n toCustom: (event, ctx) => {\n const geometry = ctx.getCurrentGeometrySnapshot()\n if (!geometry) {\n return undefined\n }\n const ring =\n geometry.type === 'LineString'\n ? geometry.coordinates\n : geometry.coordinates[0]\n // Only offer the closing snap once enough points exist to form a\n // polygon (placed points plus the live cursor point).\n if (!ring || ring.length < 4) {\n return undefined\n }\n const first = ring[0]\n const firstPixel = ctx.project(first[0], first[1])\n const distance = Math.hypot(\n firstPixel.x - event.containerX,\n firstPixel.y - event.containerY,\n )\n const SNAP_DISTANCE_PX = pointerDistance\n return distance <= SNAP_DISTANCE_PX ? first : undefined\n },\n },\n // Draw as an open line that closes into a polygon when the start point\n // is clicked (the old Drawing manager's feel): while drawing you see a\n // line, and the shape only \"fills in\" once committed to the map's Data\n // layer, which is the clear \"done\" signal. Black line, small white\n // closing/snapping dots (like the edit anchors), no fill on Terra\n // Draw's transient polygon. Terra Draw requires hex colors.\n styles: {\n lineStringColor: '#000000',\n lineStringWidth: 2,\n polygonFillOpacity: 0,\n polygonOutlineColor: '#000000',\n polygonOutlineWidth: 2,\n closingPointColor: '#ffffff',\n closingPointWidth: 4,\n closingPointOutlineColor: '#000000',\n closingPointOutlineWidth: 1,\n snappingPointColor: '#ffffff',\n snappingPointWidth: 4,\n snappingPointOutlineColor: '#000000',\n snappingPointOutlineWidth: 1,\n },\n }),\n ],\n })\n\n draw.on('ready', () => {\n this._terraDrawReady = true\n // Start in the resting (non-drawing) mode.\n draw.setMode('static')\n // A `startDrawing()` call arrived while THIS instance was still\n // starting up (terra-draw#710 recovery, or plain first-time init) and\n // queued itself rather than being dropped — finish the job now, but\n // only if nothing since then made drawing invalid: editing disabled,\n // somehow already drawing, or — grouped mode only, where edit mode is\n // its own on/off concept `startDrawing()` itself never re-checks —\n // edit mode having been turned off while this was in flight. Mirrors\n // exactly the check `GroupedInteractionModel.onMapClick()` made before\n // calling in, just re-run after the async gap instead of trusting it\n // still holds.\n if (this._pendingStartDrawing) {\n this._pendingStartDrawing = false\n const stillValid =\n this.isEditingEnabled() &&\n !this.isDrawing() &&\n (this._model.id !== 'grouped' || this.isEditMode())\n if (stillValid) {\n this._enterDrawingMode()\n }\n }\n })\n\n draw.on('finish', (id, context) => {\n if (context.action !== 'draw') {\n return\n }\n this._ngZone.run(() => this._onDrawFinished(id))\n })\n\n draw.start()\n return draw\n }\n\n public addControl(\n element: HTMLElement,\n position: google.maps.ControlPosition,\n ): void {\n this._assertInitialized()\n this.googleMap.controls[position].push(element)\n }\n\n public async setData(data: any): Promise<void> {\n this._assertInitialized()\n removeAllFeatures(this.googleMap.data)\n // Every prior feature is gone, so nothing selected or hovered survives it —\n // clear both rather than leaving selection$/hover$ referencing removed\n // features.\n this.clearSelection()\n this._hoverSubject.next(null)\n this._contextMenuTargetSubject.next(null)\n this.googleMap.data.addGeoJson(data)\n this.googleMap.fitBounds(\n getBoundsWithAllFeatures(this.googleMap.data),\n this._padding,\n )\n this._labelsOverlay?.refresh()\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public reCenterOnFeatures(): void {\n this._assertInitialized()\n if (getFeaturesCount(this.googleMap.data) === 0) {\n if (!this._baseLatLng) {\n return\n }\n\n this.googleMap.panTo(this._baseLatLng)\n return\n }\n this.googleMap.fitBounds(\n getBoundsWithAllFeatures(this.googleMap.data),\n this._padding,\n )\n\n // TODO: Fix to pan to center. Currently fitBounds results in the expected\n // result, but pantToBounds animates.\n // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))\n }\n\n public allowDrawingHoleInPolygon(allow: boolean): void {\n this._allowDrawingHoleInPolygon = allow\n }\n\n public setFileInputHandler(\n handler: ((file: File) => void) | undefined | null,\n ): void {\n this._fileInputHandler = handler\n }\n\n public getFileInputHandler(): ((file: File) => void) | undefined | null {\n return this._fileInputHandler\n }\n\n /**\n * Reports a file the library tried to import and could not read. Called by\n * the import controls, not by consumers — a consumer that owns importing\n * through `setFileInputHandler` reports its own failures.\n */\n public notifyFileImportError(file: File, error: unknown): void {\n this._fileImportErrorSubject.next({ file, error })\n }\n\n public setInteractionMode(mode: TheSeamMapInteractionMode): void {\n this._model =\n mode === 'grouped'\n ? new GroupedInteractionModel()\n : new LegacyInteractionModel()\n if (mode !== 'grouped') {\n this._editModeSubject.next(false)\n }\n this._interactionModeSubject.next(mode)\n this._refreshStyles()\n }\n\n public setGroupOptions(options: FeatureGroupRegistryOptions): void {\n this._groupOptions = options\n this._groups?.setOptions(options)\n this._refreshStyles()\n }\n\n /**\n * Name of the GeoJSON property to render as a per-group label. `undefined`\n * removes labels entirely (and, until now set, means the overlay is never\n * even constructed).\n */\n public setLabelProperty(property: string | undefined): void {\n this._labelProperty = property\n if (!this.mapReady) {\n return\n }\n if (!property) {\n this._labelsOverlay?.destroy()\n this._labelsOverlay = undefined\n return\n }\n this._ensureLabelsOverlay()\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Write `label` into `featureLabelProperty` on every feature in `key`'s\n * group, without re-adding any data. Returns `false` when no feature\n * carries `key`, or when no `featureLabelProperty` is configured — there is\n * then no property to write the label into.\n *\n * Unlike a write through the map's `value`, this does NOT go through\n * `setData()`, so the selection and the viewport are untouched. The\n * repaint and the value update fall out of the data layer's own\n * `setproperty` event, which `_initFeatureChangeListeners()` already turns\n * into a `_labelsOverlay.refresh()` and a `MapValueSource.FeatureChange`\n * emission.\n *\n * It DOES emit a value change, because the label is part of the GeoJSON and\n * the value genuinely changed. Writing that emitted value straight back\n * through the `value` input is inert: `MapValueManagerService.setValue`\n * finds the serialized form identical and returns without emitting.\n */\n public setGroupLabel(key: string, label: string): boolean {\n this._assertInitialized()\n const property = this._labelProperty\n if (!property) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.warn(\n `[seam-google-maps] setGroupLabel(\"${key}\") was called with no ` +\n `featureLabelProperty configured, so there is no property to ` +\n `write the label into. Nothing changed.`,\n )\n }\n return false\n }\n\n const features = this._registry.featuresIn(key)\n if (features.length === 0) {\n return false\n }\n\n for (const feature of features) {\n // `setProperty` raises `setproperty` whether or not the value differs,\n // and each one costs a full re-serialization of the map's value. A\n // rename typed character by character would pay that per keystroke per\n // feature for writes that change nothing.\n if (feature.getProperty(property) === label) {\n continue\n }\n feature.setProperty(property, label)\n }\n return true\n }\n\n private _ensureLabelsOverlay(): void {\n this._assertInitialized()\n if (this._labelsOverlay) {\n return\n }\n this._labelsOverlay = new MapFeatureLabelsOverlay(() => this._buildLabels())\n this._labelsOverlay.setMap(this.googleMap)\n }\n\n private _buildLabels(): MapFeatureLabel[] {\n if (this.isDrawing()) {\n return []\n }\n const property = this._labelProperty\n if (!property) {\n return []\n }\n this._assertInitialized()\n\n const byKey = new Map<\n string,\n { text: string; bounds: google.maps.LatLngBounds; others: Set<string> }\n >()\n\n this.googleMap.data.forEach((feature) => {\n const key = this._registry.keyOf(feature)\n const raw = feature.getProperty(property)\n const text =\n raw === null || raw === undefined || raw === '' ? '' : String(raw)\n\n const existing = byKey.get(key)\n const bounds = existing?.bounds ?? new google.maps.LatLngBounds()\n feature.getGeometry()?.forEachLatLng((latLng) => bounds.extend(latLng))\n\n if (!existing) {\n byKey.set(key, { text, bounds, others: new Set(text ? [text] : []) })\n return\n }\n if (text) {\n existing.others.add(text)\n if (!existing.text) {\n existing.text = text\n }\n }\n })\n\n const labels: MapFeatureLabel[] = []\n for (const [key, entry] of byKey) {\n if (entry.others.size > 1) {\n this._warnAboutLabelDisagreement(key)\n }\n if (entry.text) {\n labels.push({ key, text: entry.text, bounds: entry.bounds })\n }\n }\n return labels\n }\n\n private _warnAboutLabelDisagreement(key: string): void {\n if (\n this._warnedAboutLabelDisagreement ||\n (typeof ngDevMode !== 'undefined' && !ngDevMode)\n ) {\n return\n }\n this._warnedAboutLabelDisagreement = true\n console.warn(\n `[seam-google-maps] features in group \"${key}\" carry different ` +\n `\"${this._labelProperty}\" values. One is rendered; which is ` +\n `unspecified. Keeping them consistent is the consumer's business.`,\n )\n }\n\n public isEditMode(): boolean {\n return this._editModeSubject.value\n }\n\n public setEditMode(enabled: boolean): void {\n if (this._model.id !== 'grouped' || enabled === this.isEditMode()) {\n return\n }\n if (!enabled) {\n const wasDrawing = this.isDrawing()\n this.stopDrawing()\n if (wasDrawing) {\n this._reapplyCurrentSelection()\n }\n }\n this._editModeSubject.next(enabled)\n this._refreshStyles()\n // Arm drawing immediately when edit mode is turned on with nothing\n // selected, so the button press itself is what puts Terra Draw in\n // crosshair mode — matching legacy's button, which calls startDrawing()\n // directly. Without this, the very next click only arms Terra Draw\n // (switching the cursor) without placing a vertex, and a SECOND click is\n // what actually starts the polygon.\n //\n // Not when a group is already selected: the user is there to reshape that\n // group by clicking its vertex/midpoint handles, and arming would make\n // every click place a vertex instead — including the clicks on OTHER\n // groups that let the user switch which one is selected. Also not on the\n // selection merely being CLEARED while already in edit mode (e.g. via\n // Escape, in handleEscape()): that path never calls setEditMode(), so it\n // never reaches this arm — deliberately, since that state has to stay\n // clickable or Escape becomes a trap with no way back to selecting.\n //\n // Goes through startDrawing(), the same path a click on open map already\n // uses, so a Terra Draw recreate still in flight from the PREVIOUS\n // session (stopDrawing() now kicks it off eagerly — see\n // _hasPlacedVertex()) is honoured rather than bypassed — a call that\n // arrives before the new instance's `ready` fires queues itself via\n // _pendingStartDrawing exactly as it would from that click.\n if (enabled && this._selectionSubject.value === null) {\n this.startDrawing()\n }\n }\n\n /**\n * Re-run the style callback for every feature.\n *\n * Google re-evaluates the callback whenever the style is set, so handing\n * back the same stored function is enough to repaint after a mode change.\n */\n private _refreshStyles(): void {\n if (!this.mapReady || !this._styleFn) {\n return\n }\n this._assertInitialized()\n this.googleMap.data.setStyle(this._styleFn)\n }\n\n private get _registry(): FeatureGroupRegistry {\n this._assertInitialized()\n if (!this._groups) {\n this._groups = new FeatureGroupRegistry(\n this.googleMap.data,\n this._groupOptions,\n )\n }\n return this._groups\n }\n\n private _interactionContext(): MapInteractionContext {\n return {\n groups: this._registry,\n editingEnabled: this.isEditingEnabled(),\n allowHoles: this._allowDrawingHoleInPolygon,\n editMode: this.isEditMode(),\n isDrawing: this.isDrawing(),\n getSelectedKey: () => this._selectionSubject.value?.group.key ?? null,\n selectGroup: (key, feature) => this._applySelection(key, feature),\n startDrawing: () => this.startDrawing(),\n findContainingFeature: (polygon, groupKey, accept) =>\n this._findContainingFeature(polygon, groupKey, accept),\n }\n }\n\n /**\n * Find an existing feature that fully contains `polygon`, restricted to a\n * group when `groupKey` is given and to features `accept` returns true for\n * when given. Matches any part of a MultiPolygon.\n *\n * `accept` is applied DURING iteration — a rejected candidate is skipped,\n * not treated as ending the search — so legacy mode's Polygon-only filter\n * can let a later Polygon candidate still match.\n */\n private _findContainingFeature(\n polygon: Polygon,\n groupKey?: string,\n accept?: (feature: google.maps.Data.Feature) => boolean,\n ): google.maps.Data.Feature | undefined {\n this._assertInitialized()\n let match: google.maps.Data.Feature | undefined\n this.googleMap.data.forEach((feature) => {\n if (match) {\n return\n }\n if (\n groupKey !== undefined &&\n this._registry.keyOf(feature) !== groupKey\n ) {\n return\n }\n if (accept && !accept(feature)) {\n return\n }\n const contains = polygonsFromDataFeature(feature).some((part) =>\n polygonContains(part, polygon),\n )\n if (contains) {\n match = feature\n }\n })\n return match\n }\n\n private _applySelection(\n key: string | null,\n feature: google.maps.Data.Feature | null,\n ): void {\n this._assertInitialized()\n\n this._focusedFeature = feature\n const selectedFeatures = key === null ? [] : this._registry.featuresIn(key)\n\n this.googleMap.data.forEach((f) => {\n const shouldSelect = selectedFeatures.indexOf(f) !== -1\n if (isFeatureSelected(f) !== shouldSelect) {\n setFeatureSelected(f, shouldSelect)\n }\n })\n\n if (key === null) {\n this._selectionSubject.next(null)\n return\n }\n\n const resolved = this._registry.groupWithSources(key)\n if (!resolved) {\n this._selectionSubject.next(null)\n return\n }\n this._selectionSubject.next(this._targetFor(resolved, feature))\n }\n\n /**\n * Pair a group with the emitted GeoJSON for one of its `Data.Feature`s.\n *\n * Indexes into the returned source array rather than `featuresIn()`, because\n * a feature with unsupported geometry is dropped from the emitted list and\n * would shift every index after it.\n */\n private _targetFor(\n resolved: {\n group: TheSeamMapFeatureGroup\n sources: google.maps.Data.Feature[]\n },\n feature: google.maps.Data.Feature | null,\n ): TheSeamMapGroupTarget {\n const index = feature ? resolved.sources.indexOf(feature) : -1\n return {\n group: resolved.group,\n feature: index === -1 ? null : resolved.group.features[index],\n }\n }\n\n public selectGroup(key: string | null): boolean {\n this._assertInitialized()\n if (key === null) {\n this._applySelection(null, null)\n return true\n }\n const features = this._registry.featuresIn(key)\n if (features.length === 0) {\n return false\n }\n this._applySelection(key, features[0])\n return true\n }\n\n public clearSelection(): void {\n this._applySelection(null, null)\n }\n\n public getGroups(): TheSeamMapFeatureGroup[] {\n return this._registry.groups()\n }\n\n private _boundsForGroup(key: string): google.maps.LatLngBounds | undefined {\n const features = this._registry.featuresIn(key)\n if (features.length === 0) {\n return undefined\n }\n const bounds = new google.maps.LatLngBounds()\n features.forEach((f) =>\n f.getGeometry()?.forEachLatLng((latLng) => bounds.extend(latLng)),\n )\n return bounds\n }\n\n public fitGroup(\n key: string,\n padding?: number | google.maps.Padding,\n ): boolean {\n this._assertInitialized()\n const bounds = this._boundsForGroup(key)\n if (!bounds) {\n return false\n }\n this.googleMap.fitBounds(bounds, padding ?? this._padding)\n return true\n }\n\n public panToGroup(key: string): boolean {\n this._assertInitialized()\n const bounds = this._boundsForGroup(key)\n if (!bounds) {\n return false\n }\n this.googleMap.panTo(bounds.getCenter())\n return true\n }\n\n /**\n * Delete only the polygon the last interaction landed on.\n *\n * Re-applies the selection's group key afterward (with no focused feature)\n * rather than leaving `selection$` holding a `TheSeamMapGroupTarget` whose\n * `feature` no longer exists — `_applySelection` naturally clears to null\n * when the group is now empty, via `groupWithSources`.\n */\n private _removeFocusedFeature(): void {\n this._assertInitialized()\n const key = this._focusedFeature\n ? this._registry.keyOf(this._focusedFeature)\n : (this._selectionSubject.value?.group.key ?? null)\n const contextMenuTargetInGroup =\n key !== null && this._contextMenuTargetSubject.value?.group.key === key\n\n if (this._focusedFeature) {\n this.googleMap.data.remove(this._focusedFeature)\n this._focusedFeature = null\n } else {\n this._removeSelection()\n }\n\n this._applySelection(key, null)\n // Same reasoning as deleteGroup(): a context-menu target naming this\n // group may now reference a removed feature (or a stale feature count),\n // so clear it — but only when it actually named this group.\n if (contextMenuTargetInGroup) {\n this._contextMenuTargetSubject.next(null)\n }\n }\n\n /**\n * Remove the focused polygon — or, with nothing focused, the selection —\n * unless `canDelete` or a feature's own `editable: false` refuses. A\n * refused delete emits on `deleteBlocked$` and changes nothing.\n */\n public deleteFocusedFeature(): void {\n this._assertInitialized()\n const deletion = this._focusedFeatureDeletion()\n if (deletion !== null && !this._mayDeleteResolved(deletion)) {\n this._deleteBlockedSubject.next(deletion.target)\n return\n }\n this._removeFocusedFeature()\n }\n\n /** Escape cascades: cancel a draw, then clear selection, then leave edit mode. */\n public handleEscape(): void {\n if (this.isDrawing()) {\n this.stopDrawing()\n this._reapplyCurrentSelection()\n return\n }\n if (this._selectionSubject.value !== null) {\n this.clearSelection()\n return\n }\n if (this.isEditMode()) {\n this.setEditMode(false)\n }\n }\n\n /**\n * `startDrawing()` raw-deselects every feature (via `setFeatureSelected`)\n * without touching `_selectionSubject`, so that `onDrawFinished` can still\n * read `getSelectedKey()` for the group being drawn into. When a draw ends\n * WITHOUT producing a finished feature — cancelled by `Escape` or\n * `setEditMode(false)`, or a `finish` event with no valid geometry — nothing\n * else re-applies those raw flags, so the map renders the selection as gone\n * while `selection$`/`getSelectedKey()` still report it. Call this at every\n * such stopping point to bring the two back in sync.\n *\n * Not called from the successful-finish path in `_onDrawFinished`: that\n * path calls `_applySelection` itself with the new/joined selection, and\n * doing it here first would only add a redundant, momentarily-stale\n * `selectionChange` emission ahead of the real one.\n */\n private _reapplyCurrentSelection(): void {\n if (this._model.id !== 'grouped') {\n return\n }\n const currentKey = this._selectionSubject.value?.group.key ?? null\n this._applySelection(currentKey, this._focusedFeature)\n }\n\n private _initFeatureStyling(): void {\n this._assertInitialized()\n\n this.googleMap.addListener('click', () => {\n // The physical click that closes a polygon can reach this listener\n // TWICE: once (fast) via Terra Draw's own pointer-driven close\n // detection — which is what runs `_onDrawFinished()` / `stopDrawing()`\n // and flips `isDrawing()` false — and, separately, via Google's own\n // `click` recognition on this map, which this listener is bound to\n // directly. By the time that second delivery arrives (confirmed\n // against the live Storybook: consistently a few milliseconds later,\n // comfortably within one animation frame — see\n // docs/superpowers/reports/closing-click-report.md), `isDrawing()` already reads\n // false, so the guard just below cannot tell it apart from a fresh\n // click on open map. `_suppressNextMapClick` exists to catch exactly\n // that echo; see its doc comment for why a `domEvent.timeStamp`\n // comparison does NOT work here.\n if (this._suppressNextMapClick) {\n this._suppressNextMapClick = false\n return\n }\n // While drawing, a click on open map is placing a vertex, not a map\n // click — mirrors the data 'click' listener's guard just below. Without\n // this, `onMapClick` in 'grouped' mode calls `startDrawing()`, which\n // calls `setMode('polyline')` again and resets the in-progress path.\n if (this.isDrawing()) {\n return\n }\n this._model.onMapClick(this._interactionContext())\n })\n\n this._styleFn = (feature) =>\n computeFeatureStyle(feature, {\n editingEnabled: this.isEditingEnabled(),\n ...this._model.featureFlags(feature, this._interactionContext()),\n })\n this.googleMap.data.setStyle(this._styleFn)\n\n this.googleMap.data.addListener(\n 'click',\n (event: google.maps.Data.MouseEvent) => {\n // While drawing, a click on a polygon is placing a vertex.\n if (this.isDrawing()) {\n return\n }\n this._model.onFeatureClick(event.feature, this._interactionContext())\n },\n )\n\n this.googleMap.data.addListener(\n 'mouseover',\n (event: google.maps.Data.MouseEvent) => {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n\n if (!this.isDrawing() && !isFeatureSelected(event.feature)) {\n this.setFeatureHoveredStyleOverride(event.feature)\n }\n\n const resolved = this._registry.groupWithSources(\n this._registry.keyOf(event.feature),\n )\n this._hoverSubject.next(\n resolved ? this._targetFor(resolved, event.feature) : null,\n )\n },\n )\n\n this.googleMap.data.addListener('mouseout', () => {\n this._assertInitialized()\n this.googleMap.data.revertStyle()\n this._hoverSubject.next(null)\n })\n }\n\n public setFeatureHoveredStyleOverride(feature: google.maps.Data.Feature) {\n this._assertInitialized()\n this.googleMap.data.overrideStyle(\n feature,\n computeFeatureHoverStyle(feature),\n )\n }\n\n private _initFeatureChangeListeners(): void {\n this._assertInitialized()\n\n createFeatureChangeObservable(this.googleMap.data, this._ngZone)\n .pipe(\n switchMap(() =>\n from(this.getGeoJson()).pipe(\n tap((geoJson) => {\n this._mapValueManager.setValue(\n geoJson,\n MapValueSource.FeatureChange,\n )\n this._labelsOverlay?.refresh()\n }),\n ),\n ),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this.googleMap.data.addListener(\n 'contextmenu',\n (event: google.maps.Data.MouseEvent) => {\n if (\n !this._model.allowsContextMenu(\n event.feature,\n this._interactionContext(),\n )\n ) {\n return\n }\n this._setContextMenuTarget(event.feature)\n this._openContextMenuForFeature(\n event.feature,\n event.latLng ?? undefined,\n )\n },\n )\n }\n\n /**\n * Establish `feature` as what the context menu is about to open for:\n * `_focusedFeature` (what \"Delete Polygon\" acts on) and\n * `contextMenuTarget$` (what \"Delete Field\" is gated on and acts on) both\n * follow it. Shared by the `contextmenu` mouse listener and\n * `openContextMenu()`'s keyboard path so the two establish the target\n * identically — the menu's target must always be the feature the menu was\n * opened for, on either path. Before this, only the mouse listener set\n * `contextMenuTarget$`, so pressing the `ContextMenu` key could open a menu\n * over whatever was CURRENTLY selected while still offering \"Delete Field\"\n * for whatever a PRIOR right-click had targeted.\n */\n private _setContextMenuTarget(feature: google.maps.Data.Feature): void {\n this._focusedFeature = feature\n const resolved = this._registry.groupWithSources(\n this._registry.keyOf(feature),\n )\n this._contextMenuTargetSubject.next(\n resolved ? this._targetFor(resolved, feature) : null,\n )\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public hasSelectedFeature(): boolean {\n this._assertInitialized()\n let isSelected = false\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n isSelected = true\n }\n })\n return isSelected\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public getSelectedFeature(): google.maps.Data.Feature | null {\n this._assertInitialized()\n let feature: google.maps.Data.Feature | null = null\n this.googleMap.data.forEach((f) => {\n if (isFeatureSelected(f)) {\n feature = f\n }\n })\n return feature\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public openContextMenu(): void {\n const feature = this.getSelectedFeature()\n if (\n feature &&\n this._model.allowsContextMenu(feature, this._interactionContext())\n ) {\n this._setContextMenuTarget(feature)\n this._openContextMenuForFeature(feature)\n }\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n public closeContextMenu(): void {\n if (this._activeContextMenu) {\n this._activeContextMenu.close()\n this._activeContextMenu = null\n }\n }\n\n // TODO: Refactor out of the service meant to just wrap the google maps api.\n private _openContextMenuForFeature(\n feature: google.maps.Data.Feature,\n position?: google.maps.LatLng,\n ) {\n this.closeContextMenu()\n\n this._assertInitialized()\n\n let _position = position\n if (!_position) {\n _position = getFeatureCenter(feature)\n }\n if (this._featureContextMenu) {\n this._activeContextMenu = new GoogleMapsContextMenu(\n this.googleMap,\n this._featureContextMenu,\n _position,\n this._vcr,\n this._ngZone,\n this.googleMap.data,\n feature,\n )\n }\n }\n\n public getGeoJson(removeAppProperties: boolean = true): Promise<object> {\n return new Promise((resolve, reject) => {\n this._assertInitialized()\n this.googleMap.data.toGeoJson((f) => {\n if (removeAppProperties) {\n stripAppFeaturePropertiesFromJson(f)\n }\n resolve(f)\n })\n })\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n GoogleMapsService,\n 'googleMap'\n > {\n if (!this.googleMap && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n\n /**\n * Arm `_suppressNextMapClick`, and guarantee it cannot linger forever if\n * the echo it exists for never arrives — confirmed to be the normal case\n * for most real closes, and true of every synthetic/`play()`-driven draw,\n * per docs/superpowers/reports/closing-click-report.md. A `setTimeout` would \"solve\"\n * this by guessing a safe wall-clock delay, which is exactly the kind of\n * timing window this fix is trying to avoid introducing. Two\n * `requestAnimationFrame` callbacks bound the window instead: the observed\n * echo arrives a few milliseconds after `stopDrawing()`, comfortably\n * inside a single frame, so two frames is generous headroom without\n * guessing at a duration — and two real user actions (even fast automated\n * ones) are never going to land within two animation frames of each other,\n * so an unrelated later click is never at risk of being swallowed.\n */\n private _armMapClickSuppression(): void {\n this._suppressNextMapClick = true\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this._suppressNextMapClick = false\n })\n })\n }\n\n private _onDrawFinished(id: string | number): void {\n // Armed first, before any other work below — including the early return\n // for a draw that produced no usable geometry — since the closing\n // click's late echo (see `_suppressNextMapClick`'s doc comment) can\n // follow either outcome.\n this._armMapClickSuppression()\n const feature = this._terraDraw?.getSnapshotFeature(id)\n this._terraDraw?.removeFeatures([id])\n this.stopDrawing()\n\n const drawn = feature ? this._toDrawnPolygon(feature.geometry) : undefined\n if (!drawn || !polygonHasMinDistinctVertices(drawn, 3)) {\n // A 'finish' event that produced no usable geometry is, for selection\n // purposes, a cancelled draw — see _reapplyCurrentSelection().\n this._reapplyCurrentSelection()\n return\n }\n\n this._assertInitialized()\n\n const context = this._interactionContext()\n const outcome = this._model.onDrawFinished(drawn, context)\n\n if (outcome.kind === 'hole' && applyHoleToFeature(outcome.target, drawn)) {\n this._applySelection(this._registry.keyOf(outcome.target), outcome.target)\n this._labelsOverlay?.refresh()\n return\n }\n\n const newFeature = new google.maps.Data.Feature({\n geometry: dataPolygonFromGeoJson(drawn),\n })\n this.googleMap.data.add(newFeature)\n\n const key =\n outcome.kind === 'newFeature' && outcome.groupKey !== null\n ? (this._registry.assignKey(newFeature, outcome.groupKey),\n outcome.groupKey)\n : this._registry.assignNewKey(newFeature)\n\n this._applySelection(key, newFeature)\n this._labelsOverlay?.refresh()\n }\n\n /**\n * Normalize a finished Terra Draw geometry into a Polygon. A Polygon (the\n * user closed the line on its start point) passes through; an open LineString\n * (the user finished without closing) is closed into a polygon so nothing\n * they drew is discarded. Any other geometry type yields undefined.\n */\n private _toDrawnPolygon(geometry: Geometry): Polygon | undefined {\n if (geometry.type === 'Polygon') {\n return geometry\n }\n if (geometry.type === 'LineString') {\n const polygon: Polygon = {\n type: 'Polygon',\n coordinates: [[...geometry.coordinates]],\n }\n closePolygons(polygon)\n return polygon\n }\n return undefined\n }\n}\n","import {\n ComponentRef,\n Injectable,\n Injector,\n StaticProvider,\n ViewContainerRef,\n} from '@angular/core'\nimport { Observable, Subject } from 'rxjs'\n\nimport { GoogleMapsService } from './google-maps.service'\nimport {\n MapControl,\n MapControlsService,\n MAP_CONTROL_DATA,\n} from './map-controls-service'\n\nexport class MapControlRef {\n private readonly _destroyedSubject = new Subject<void>()\n\n private _componentRef: ComponentRef<any>\n private _addedAtPosition: google.maps.ControlPosition\n\n public destroyed: Observable<void>\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n private readonly _injector: Injector,\n private readonly _controlDef: MapControl,\n private readonly _viewContainerRef: ViewContainerRef,\n ) {\n this.destroyed = this._destroyedSubject.asObservable()\n\n const component: any = this._controlDef.component\n // const factory = this._componentFactoryResolver.resolveComponentFactory(component)\n\n const providers: StaticProvider[] = []\n if (this._controlDef.data) {\n providers.push({\n provide: MAP_CONTROL_DATA,\n useValue: this._controlDef.data,\n })\n }\n const injector = Injector.create({\n providers,\n parent: this._injector,\n })\n\n // this._componentRef = factory.create(injector)\n this._componentRef = this._viewContainerRef.createComponent(component, {\n index: this._viewContainerRef.length,\n injector,\n })\n this._componentRef.changeDetectorRef.detectChanges()\n\n const position =\n this._controlDef.position ?? google.maps.ControlPosition.LEFT_BOTTOM\n\n this._googleMaps.addControl(\n this._componentRef.location.nativeElement,\n position,\n )\n\n this._addedAtPosition = position\n }\n\n public destroy() {\n const googleMaps = this._googleMaps.googleMap\n if (googleMaps !== undefined) {\n let idx = -1\n googleMaps.controls[this._addedAtPosition].forEach((elem, index) => {\n if (elem === this._componentRef.location.nativeElement) {\n idx = index\n }\n })\n if (idx === -1) {\n throw Error(`Unable to destroy control. Control not found.`)\n }\n googleMaps.controls[this._addedAtPosition].removeAt(idx)\n }\n this._componentRef.destroy()\n\n this._destroyedSubject.next()\n this._destroyedSubject.complete()\n }\n}\n\n@Injectable()\nexport class GoogleMapsControlsService implements MapControlsService {\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n private readonly _injector: Injector,\n private readonly _viewContainerRef: ViewContainerRef,\n ) {}\n\n public add(control: MapControl): MapControlRef {\n return new MapControlRef(\n this._googleMaps,\n this._injector,\n control,\n this._viewContainerRef,\n )\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n} from '@angular/core'\nimport { toSignal } from '@angular/core/rxjs-interop'\n\nimport { faDrawPolygon } from '@fortawesome/free-solid-svg-icons'\nimport { SeamIcon, TheSeamIconModule } from '@theseam/ui-common/icon'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\n\nexport interface GoogleMapsDrawButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-draw-button-control]',\n templateUrl: './google-maps-draw-button-control.component.html',\n styleUrls: ['./google-maps-draw-button-control.component.scss'],\n imports: [TheSeamIconModule],\n host: {\n '(click)': '_onClick()',\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n '[attr.aria-pressed]': '_active()',\n '[class.active]': '_active()',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TheSeamGoogleMapsDrawButtonControlComponent {\n private readonly _googleMaps = inject(GoogleMapsService)\n private readonly _data = inject<GoogleMapsDrawButtonControlData>(\n MAP_CONTROL_DATA,\n { optional: true },\n )\n\n private readonly _mode = toSignal(this._googleMaps.interactionMode$, {\n initialValue: 'legacy' as const,\n })\n\n private readonly _drawing = toSignal(this._googleMaps.drawing$, {\n initialValue: false,\n })\n\n private readonly _editMode = toSignal(this._googleMaps.editMode$, {\n initialValue: false,\n })\n\n /**\n * In 'legacy' the button toggles drawing directly. In 'grouped' it toggles\n * edit mode, which is what makes a click on open map begin a drawing.\n */\n protected readonly _active = computed(() =>\n this._mode() === 'grouped' ? this._editMode() : this._drawing(),\n )\n\n protected readonly _label = computed(\n () =>\n this._data?.label ??\n (this._mode() === 'grouped' ? 'Edit Fields' : 'Draw Field'),\n )\n\n get label(): string {\n return this._label()\n }\n\n icon: SeamIcon = this._data?.icon ?? faDrawPolygon\n\n _onClick() {\n if (this._mode() === 'grouped') {\n this._googleMaps.setEditMode(!this._googleMaps.isEditMode())\n return\n }\n if (this._googleMaps.isDrawing()) {\n this._googleMaps.stopDrawing()\n } else {\n this._googleMaps.startDrawing()\n }\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import {\n ChangeDetectionStrategy,\n Component,\n HostListener,\n Inject,\n Input,\n OnDestroy,\n Optional,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\n\nimport { SeamIcon } from '@theseam/ui-common/icon'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\n\nexport interface GoogleMapsRecenterButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n/**\n *\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-recenter-button-control]',\n templateUrl: './google-maps-recenter-button-control.component.html',\n styleUrls: ['./google-maps-recenter-button-control.component.scss'],\n host: {\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamGoogleMapsRecenterButtonControlComponent\n implements OnDestroy\n{\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _listeners: (() => void)[] = []\n\n @Input() label: string | undefined | null\n\n @Input() icon: SeamIcon | undefined | null\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._googleMaps.reCenterOnFeatures()\n }\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n @Optional()\n @Inject(MAP_CONTROL_DATA)\n _data?: GoogleMapsRecenterButtonControlData,\n ) {\n if (_data) {\n if (Object.prototype.hasOwnProperty.call(_data, 'label')) {\n this.label = _data.label\n }\n if (Object.prototype.hasOwnProperty.call(_data, 'icon')) {\n this.icon = _data.icon\n }\n }\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._listeners.forEach((l) => l())\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n Inject,\n Input,\n OnDestroy,\n Optional,\n Renderer2,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\n\nimport { SeamIcon } from '@theseam/ui-common/icon'\nimport { readGeoFile } from '@theseam/ui-common/utils'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport { MAP_CONTROL_DATA } from '../map-controls-service'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\n\nexport interface GoogleMapsUploadButtonControlData {\n label?: string | undefined | null\n icon?: SeamIcon | undefined | null\n}\n\n/**\n *\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'button[seam-google-maps-upload-button-control]',\n templateUrl: './google-maps-upload-button-control.component.html',\n styleUrls: ['./google-maps-upload-button-control.component.scss'],\n host: {\n '[attr.draggable]': 'false',\n '[attr.aria-label]': 'label',\n '[attr.title]': 'label',\n type: 'button',\n class: 'gmnoprint gm-control-active',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamGoogleMapsUploadButtonControlComponent\n implements OnDestroy\n{\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private readonly _fileInputElement: HTMLInputElement\n\n private _listeners: (() => void)[] = []\n\n @Input() label: string | undefined | null\n\n @Input() icon: SeamIcon | undefined | null\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._fileInputElement.click()\n }\n\n constructor(\n private readonly _elementRef: ElementRef,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _renderer: Renderer2,\n private readonly _googleMaps: GoogleMapsService,\n @Optional()\n @Inject(MAP_CONTROL_DATA)\n _data?: GoogleMapsUploadButtonControlData,\n ) {\n if (_data) {\n if (Object.prototype.hasOwnProperty.call(_data, 'label')) {\n this.label = _data.label\n }\n if (Object.prototype.hasOwnProperty.call(_data, 'icon')) {\n this.icon = _data.icon\n }\n }\n\n this._fileInputElement = this._createHiddenInput()\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this._fileInputElement,\n )\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._listeners.forEach((l) => l())\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _getFile(throwIfInvalidFiles: boolean = true): File | null {\n const files = this._fileInputElement.files\n if (files === null || files.length === 0) {\n return null\n }\n\n if (throwIfInvalidFiles) {\n if (files.length > 1) {\n throw Error(`Only one file can be imported at a time.`)\n }\n }\n\n return files[0]\n }\n\n private async _importFile(file: File): Promise<void> {\n const json = await readGeoFile(file)\n this._mapValueManager.setValue(json, MapValueSource.Input)\n }\n\n private _reportImportError(file: File | undefined, error: unknown): void {\n if (file === undefined) {\n return\n }\n this._googleMaps.notifyFileImportError(file, error)\n }\n\n private _createHiddenInput(): HTMLInputElement {\n const fileInputElement = this._renderer.createElement('input')\n this._renderer.setAttribute(fileInputElement, 'type', 'file')\n this._renderer.setAttribute(fileInputElement, 'hidden', '')\n this._renderer.setAttribute(\n fileInputElement,\n 'accept',\n '.json,.geojson,.shp,.zip',\n )\n\n this._listeners.push(\n this._renderer.listen(fileInputElement, 'change', (event: Event) => {\n let file: File | null\n try {\n file = this._getFile()\n } catch (err) {\n // `_getFile` refuses a multi-file selection. Report it like any\n // other reason the chosen files could not be imported. `_getFile`\n // has already read `files` by this point, so resetting now cannot\n // disturb the read.\n this._reportImportError(this._fileInputElement.files?.[0], err)\n this._resetInput()\n return\n }\n\n if (file === null) {\n return\n }\n\n const fileImportHandler = this._googleMaps.getFileInputHandler()\n if (fileImportHandler) {\n // The consumer owns the file now, including reporting its failures.\n fileImportHandler(file)\n this._resetInput()\n } else {\n this._importFile(file)\n .catch((err) => this._reportImportError(file, err))\n .finally(() => this._resetInput())\n }\n }),\n )\n\n return fileInputElement\n }\n\n private _createTemporaryFormElement(): HTMLFormElement {\n return this._renderer.createElement('form')\n }\n\n /**\n * Reset input element, so that the same file can be added again.\n */\n private _resetInput(): void {\n const formElement = this._createTemporaryFormElement()\n this._renderer.appendChild(formElement, this._fileInputElement)\n formElement.reset()\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this._fileInputElement,\n )\n }\n}\n","<seam-icon [icon]=\"icon\" iconType=\"image-fill\"></seam-icon>\n","import { TheSeamMapGroupTarget } from '../feature-groups/feature-group'\nimport { TheSeamMapInteractionMode } from '../interaction/interaction-mode'\n\n/** One entry in the map's feature context menu. */\nexport interface TheSeamMapContextMenuItem {\n label: string\n action: () => void\n}\n\n/**\n * What the menu needs from the map service to decide what to offer.\n *\n * Narrowed to the query/command pairs so the decision stays a pure function\n * and can be tested without a rendered map.\n */\nexport interface TheSeamMapDeleteMenuContext {\n mode: TheSeamMapInteractionMode\n editingEnabled: boolean\n /** The group the menu is opening for, or null when nothing is targeted. */\n target: TheSeamMapGroupTarget | null\n\n canDeleteFocusedFeature(): boolean\n canDeleteGroup(key: string): boolean\n canDeleteSelection(): boolean\n\n deleteFocusedFeature(): void\n deleteGroup(key: string): void\n deleteSelection(): void\n}\n\n/**\n * The delete items the feature context menu offers.\n *\n * A refused item is not rendered at all. The caller is expected to hide the\n * menu entirely for an empty list, so a consumer that refuses everything gets\n * no menu rather than an empty one.\n */\nexport function buildDeleteMenuItems(\n context: TheSeamMapDeleteMenuContext,\n): TheSeamMapContextMenuItem[] {\n const items: TheSeamMapContextMenuItem[] = []\n\n if (!context.editingEnabled) {\n return items\n }\n\n if (context.mode !== 'grouped') {\n if (context.canDeleteSelection()) {\n items.push({ label: 'Delete', action: () => context.deleteSelection() })\n }\n return items\n }\n\n const target = context.target\n if (!target) {\n return items\n }\n const key = target.group.key\n\n // On a one-polygon field, \"Delete Polygon\" and \"Delete Field\" are the same\n // act — the first empties the group without saying so. Offer only the one\n // that names what happens.\n if (target.group.features.length <= 1) {\n if (context.canDeleteGroup(key)) {\n items.push({\n label: 'Delete Field',\n action: () => context.deleteGroup(key),\n })\n }\n return items\n }\n\n if (context.canDeleteFocusedFeature()) {\n items.push({\n label: 'Delete Polygon',\n action: () => context.deleteFocusedFeature(),\n })\n }\n if (context.canDeleteGroup(key)) {\n items.push({\n label: 'Delete Field',\n action: () => context.deleteGroup(key),\n })\n }\n return items\n}\n","import { Observable } from 'rxjs'\n\nexport abstract class TheSeamGoogleMapsApiLoader {\n abstract load(): Observable<void>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n NgZone,\n OnDestroy,\n OnInit,\n Renderer2,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil, tap } from 'rxjs/operators'\n\nimport { readGeoFile } from '@theseam/ui-common/utils'\n\nimport { GoogleMapsService } from '../google-maps.service'\nimport {\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\n\n/**\n *\n */\n@Component({\n selector: 'seam-map-file-drop',\n templateUrl: './map-file-drop.component.html',\n styleUrls: ['./map-file-drop.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamMapFileDropComponent implements OnInit, OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n /**\n * Map element drag events added to.\n */\n private _mapDiv: HTMLDivElement | undefined\n\n private _listeners: (() => void)[] = []\n\n private _globalDragInProgress = false\n\n constructor(\n private readonly _elementRef: ElementRef,\n private readonly _ngZone: NgZone,\n private readonly _googleMaps: GoogleMapsService,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _renderer: Renderer2,\n ) {}\n\n /** @ignore */\n ngOnInit() {\n this._googleMaps.mapReady$\n .pipe(\n tap((ready) => {\n if (ready) {\n this._enableFileDrop()\n } else {\n this._disableFileDrop()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._disableFileDrop()\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _enableFileDrop(): void {\n const divElement = this._googleMaps.getDiv()\n if (this._mapDiv === divElement) {\n return\n }\n\n if (this._mapDiv !== undefined) {\n // Disable file drop on previous map div.\n this._disableFileDrop()\n }\n\n this._mapDiv = divElement\n this._ngZone.runOutsideAngular(() => {\n this._listeners.push(\n this._renderer.listen('document', 'dragstart', (event: Event) => {\n this._globalDragInProgress = true\n }),\n )\n\n this._listeners.push(\n this._renderer.listen('document', 'dragend', (event: Event) => {\n this._globalDragInProgress = false\n }),\n )\n\n this._listeners.push(\n this._renderer.listen(\n divElement,\n 'dragover',\n this._handleDragOverEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'dragover',\n this._handleDragOverEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'drop',\n this._handleDropEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n divElement,\n 'dragenter',\n this._handleDragEnterEvent,\n ),\n )\n this._listeners.push(\n this._renderer.listen(\n this._elementRef.nativeElement,\n 'dragleave',\n this._handleDragLeaveEvent,\n ),\n )\n })\n }\n\n private _disableFileDrop(): void {\n if (this._listeners.length > 0) {\n this._listeners.forEach((l) => l())\n this._listeners = []\n }\n }\n\n private readonly _handleDragOverEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n if (!this._isSupportedDataTransferTypes(event.dataTransfer)) {\n return\n }\n\n event.preventDefault()\n event.dataTransfer.dropEffect = 'copy'\n }\n\n private readonly _handleDropEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'none')\n\n if (!this._isSupportedDataTransferTypes(event.dataTransfer)) {\n // Not a file drag at all — selected text, a link, an image dragged out\n // of a page. Nobody asked for an import and there is no file to name,\n // so this stays silent rather than reporting a failure.\n return\n }\n\n const files: FileList = event.dataTransfer.files\n if (files.length !== 1) {\n if (files.length > 1) {\n // Refused before any handler is consulted, exactly as the upload\n // button's `_getFile` does: `fileImportHandler` takes a single file\n // and cannot be handed several, so the consumer never sees these and\n // this output is its only way to learn the drop was rejected. Same\n // message as the button, so a consumer matching on it needs one\n // string rather than two.\n this._ngZone.run(() =>\n this._googleMaps.notifyFileImportError(\n files[0],\n Error('Only one file can be imported at a time.'),\n ),\n )\n }\n return\n }\n\n const item = event.dataTransfer.items[0]\n const file = item.getAsFile()\n if (file === null) {\n return\n }\n\n // These listeners are registered outside Angular's zone, so re-enter it\n // before calling back into anything that expects change detection — the\n // consumer's handler may well render a message from here.\n this._ngZone.run(() => this._importDroppedFile(file))\n }\n\n /**\n * Routes a dropped file the same way the upload button routes a chosen one,\n * so `fileImportHandler` means \"the consumer owns imported files\" whichever\n * way the file arrived.\n */\n private _importDroppedFile(file: File): void {\n const fileImportHandler = this._googleMaps.getFileInputHandler()\n if (fileImportHandler) {\n // The consumer owns the file now, including reporting its failures.\n fileImportHandler(file)\n return\n }\n\n readGeoFile(file)\n .then((json) => {\n this._mapValueManager.setValue(json, MapValueSource.Input)\n })\n .catch((error) => {\n this._googleMaps.notifyFileImportError(file, error)\n })\n }\n\n private readonly _handleDragEnterEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n if (!this._isSupportedDataTransferTypes(event.dataTransfer)) {\n return\n }\n\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'block')\n }\n\n private readonly _handleDragLeaveEvent = (event: any) => {\n if (!this._dropAllowed()) {\n return\n }\n\n this._renderer.setStyle(this._elementRef.nativeElement, 'display', 'none')\n }\n\n private _dropAllowed(): boolean {\n return !this._globalDragInProgress\n }\n\n private _isSupportedDataTransferTypes(dataTransfer: DataTransfer): boolean {\n return dataTransfer.types[0] === 'Files'\n }\n}\n","","import { OnInit } from '@angular/core'\nimport {\n ChangeDetectionStrategy,\n Component,\n Inject,\n Input,\n OnDestroy,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil, tap } from 'rxjs/operators'\n\nimport {\n GoogleMapsControlsService,\n MapControlRef,\n} from './google-maps-controls.service'\nimport { GoogleMapsService } from './google-maps.service'\nimport { MapControl, MAP_CONTROLS_SERVICE } from './map-controls-service'\n\n@Component({\n selector: 'seam-map-control',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class TheSeamMapsControlComponent implements OnInit, OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _controlRef?: MapControlRef\n\n @Input()\n set def(value: MapControl | null | undefined) {\n if (value !== this._def) {\n this._remove()\n this._def = value\n }\n }\n _def: MapControl | null | undefined\n\n constructor(\n private readonly _googleMaps: GoogleMapsService,\n @Inject(MAP_CONTROLS_SERVICE)\n private readonly _googleMapsControls: GoogleMapsControlsService,\n ) {}\n\n /** @ignore */\n ngOnInit(): void {\n this._googleMaps.mapReady$\n .pipe(\n tap((ready) => {\n if (ready) {\n this._add()\n } else {\n this._remove()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n /** @ignore */\n ngOnDestroy(): void {\n this._remove()\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _add(): void {\n if (this._controlRef) {\n return\n }\n\n if (this._def === null || this._def === undefined) {\n return\n }\n\n this._controlRef = this._googleMapsControls.add(this._def)\n }\n\n private _remove(): void {\n this._controlRef?.destroy()\n this._controlRef = undefined\n }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y'\nimport {\n BooleanInput,\n coerceBooleanProperty,\n coerceNumberProperty,\n NumberInput,\n} from '@angular/cdk/coercion'\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { combineLatest, fromEvent, Observable, of, Subject } from 'rxjs'\nimport { catchError, map, skip, takeUntil, tap } from 'rxjs/operators'\n\nimport { faCrosshairs, faFileImport } from '@fortawesome/free-solid-svg-icons'\nimport {\n CanDisable,\n CanDisableCtor,\n InputBoolean,\n InputNumber,\n mixinDisabled,\n} from '@theseam/ui-common/core'\nimport { MenuComponent } from '@theseam/ui-common/menu'\n\nimport {\n TheSeamMapFeatureGroup,\n TheSeamMapGroupTarget,\n} from '../feature-groups/feature-group'\nimport { TheSeamGoogleMapsApiLoader } from '../google-maps-api-loader/google-maps-api-loader'\nimport { GoogleMapsControlsService } from '../google-maps-controls.service'\nimport { TheSeamGoogleMapsDrawButtonControlComponent } from '../google-maps-draw-button-control/google-maps-draw-button-control.component'\nimport { TheSeamGoogleMapsRecenterButtonControlComponent } from '../google-maps-recenter-button-control/google-maps-recenter-button-control.component'\nimport { TheSeamGoogleMapsUploadButtonControlComponent } from '../google-maps-upload-button-control/google-maps-upload-button-control.component'\nimport { GoogleMapsService } from '../google-maps.service'\nimport { TheSeamMapInteractionMode } from '../interaction/interaction-mode'\nimport { TheSeamMapFileImportError } from '../map-file-import-error'\nimport { MapControl, MAP_CONTROLS_SERVICE } from '../map-controls-service'\nimport {\n MapValue,\n MapValueManagerService,\n MapValueSource,\n} from '../map-value-manager.service'\nimport {\n buildDeleteMenuItems,\n TheSeamMapContextMenuItem,\n} from '../context-menu/delete-menu-items'\n\ndeclare const ngDevMode: boolean | undefined\n\nclass TheSeamGoogleMapsComponentBase {\n constructor(public _elementRef: ElementRef) {}\n}\n\nconst _TheSeamGoogleMapsMixinBase: CanDisableCtor &\n typeof TheSeamGoogleMapsComponentBase = mixinDisabled(\n TheSeamGoogleMapsComponentBase,\n)\n\n/**\n * A wrapper for googlemap.\n */\n@Component({\n selector: 'seam-google-maps',\n templateUrl: './google-maps.component.html',\n styleUrls: ['./google-maps.component.scss'],\n inputs: ['disabled'],\n providers: [\n MapValueManagerService,\n GoogleMapsService,\n { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },\n {\n provide: NG_VALUE_ACCESSOR,\n\n useExisting: forwardRef(() => TheSeamGoogleMapsComponent),\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'seamGoogleMaps',\n standalone: false,\n})\nexport class TheSeamGoogleMapsComponent\n extends _TheSeamGoogleMapsMixinBase\n implements OnInit, OnDestroy, OnChanges, CanDisable, ControlValueAccessor\n{\n static ngAcceptInputType_disabled: BooleanInput\n static ngAcceptInputType_zoom: NumberInput\n static ngAcceptInputType_longitude: NumberInput\n static ngAcceptInputType_latitude: NumberInput\n static ngAcceptInputType_fileDropEnabled: BooleanInput\n static ngAcceptInputType_fileUploadControlEnabled: BooleanInput\n static ngAcceptInputType_fullscreenControlEnabled: BooleanInput\n static ngAcceptInputType_reCenterControlEnabled: BooleanInput\n static ngAcceptInputType_mapTypeControlEnabled: BooleanInput\n static ngAcceptInputType_streetViewControlEnabled: BooleanInput\n static ngAcceptInputType_allowDrawingHoleInPolygon: BooleanInput\n static ngAcceptInputType_editingEnabled: BooleanInput\n static ngAcceptInputType_selectedGroupKey: string | null\n\n private readonly _changeDetectorRef = inject(ChangeDetectorRef)\n\n private readonly _ngUnsubscribe = new Subject<void>()\n\n readonly _gmApiLoaded: Observable<boolean>\n\n readonly _fileUploadControlDef: MapControl = {\n component: TheSeamGoogleMapsUploadButtonControlComponent,\n data: { label: 'Import Geo File', icon: faFileImport },\n // position: 6 /* google.maps.ControlPosition.LEFT_BOTTOM */,\n position: 7, // Below top-right fullscreen button\n }\n\n readonly _reCenterControlDef: MapControl = {\n component: TheSeamGoogleMapsRecenterButtonControlComponent,\n data: { label: 'Center on Field', icon: faCrosshairs },\n position: 9 /* google.maps.ControlPosition.RIGHT_BOTTOM */,\n }\n\n readonly _drawControlDef: MapControl = {\n component: TheSeamGoogleMapsDrawButtonControlComponent,\n position: 1 /* google.maps.ControlPosition.TOP_LEFT */,\n }\n\n private _focusOrigin: FocusOrigin = null\n\n @Input()\n set value(value: MapValue) {\n this._mapValueManager.setValue(value, MapValueSource.Input)\n }\n get value(): MapValue {\n return this._mapValueManager.value\n }\n\n @Input()\n set tabIndex(value: number) {\n this._tabIndex = coerceNumberProperty(value)\n }\n get tabIndex(): number {\n return this._tabIndex\n }\n /**\n * Set the tab index to `-1` to allow the root element of the\n * component to receive `focus` event from javascript, but not get focused by\n * keyboard navigation.\n */\n private _tabIndex = -1\n\n @Input() @InputBoolean() fileDropEnabled = true\n\n @Input() @InputBoolean() fileUploadControlEnabled = false\n @Input() @InputBoolean() fullscreenControlEnabled = true\n @Input() @InputBoolean() reCenterControlEnabled = true\n @Input() @InputBoolean() mapTypeControlEnabled = true\n @Input() @InputBoolean() streetViewControlEnabled = false\n\n @Input() @InputBoolean() allowDrawingHoleInPolygon = false\n\n @Input() @InputBoolean() editingEnabled = true\n\n /**\n * Intercepts a file the user chose or dropped, in place of the library's own\n * import handling. Covers **both** import paths: a file picked through the\n * upload button and one dropped onto the map (`fileDropEnabled` defaults to\n * `true`, so setting this now also intercepts drops a consumer relying on\n * the default previously had handled internally).\n *\n * Once called, the consumer owns the file, including reporting any failure\n * in its own UI — `fileImportError` will not fire for a file handed to this\n * handler.\n */\n @Input()\n set fileImportHandler(value: ((file: File) => void) | undefined | null) {\n this._googleMaps.setFileInputHandler(value)\n }\n\n @HostBinding('attr.disabled')\n get _attrDisabled() {\n return this.disabled || null\n }\n\n @HostBinding('attr.tabindex')\n get _attrTabIndex() {\n return this.disabled ? -1 : this.tabIndex || 0\n }\n\n onChange: any\n onTouched: any\n\n @Input() @InputNumber() zoom = 14\n @Input() @InputNumber() longitude = -98.570209\n @Input() @InputNumber() latitude = 37.633814\n\n @Input() padding: number | google.maps.Padding | undefined = 0\n\n /**\n * Which interaction model the map uses.\n *\n * `'legacy'` is the single-boundary behaviour this component has always had\n * and is the default, so existing consumers are unaffected. `'grouped'`\n * separates selection from geometry editing; see the design doc.\n */\n @Input() interactionMode: TheSeamMapInteractionMode = 'legacy'\n\n /**\n * Name of the GeoJSON property that groups features into one logical thing,\n * such as a field. Features sharing a value select, style, and edit together.\n * Unset means every feature is its own group.\n */\n @Input() featureGroupProperty: string | undefined\n\n /** Name of the GeoJSON property holding a group's label text. */\n @Input() featureLabelProperty: string | undefined\n\n /**\n * Generates the key written to `featureGroupProperty` for a newly drawn\n * group. Consumer-supplied so the format is one the app recognises.\n */\n @Input() newGroupKeyFactory: (() => string) | undefined\n\n /** Preselect a group. Applied on map-ready and after each external value write. */\n @Input() selectedGroupKey: string | null = null\n\n /**\n * Vetoes a delete. Return `false` to refuse the target.\n *\n * `target.feature === null` means the whole group is about to cease to\n * exist — every polygon of it is going, however the delete was asked for.\n * A non-null `feature` means one polygon is being removed from a group that\n * survives.\n *\n * **Consulted when no delete is happening.** It decides whether to render\n * the context-menu items, so it runs on every context-menu open. A\n * predicate that logs an attempt or flips state will do so on every\n * right-click. It must also be deterministic for a given target, or the\n * menu and the `Delete` key can disagree about the same target.\n *\n * That is a correctness warning, not a performance one. The context-menu\n * target changes only on a right-click, a delete, and a value write, so\n * this runs a handful of times per gesture.\n *\n * Passing nothing refuses nothing, which is the behaviour this component\n * has always had.\n */\n @Input() canDelete: ((target: TheSeamMapGroupTarget) => boolean) | undefined\n\n @Output() mapReady = new EventEmitter<google.maps.Map | undefined>()\n\n @Output() selectionChange = new EventEmitter<TheSeamMapGroupTarget | null>()\n @Output() featureHoverChange =\n new EventEmitter<TheSeamMapGroupTarget | null>()\n\n /**\n * A delete was attempted and refused — in practice, the `Delete` key, since\n * a refused menu item is never rendered. Emits the target that was refused\n * so the consumer can explain why; only the consumer knows the reason.\n */\n @Output() deleteBlocked = new EventEmitter<TheSeamMapGroupTarget>()\n\n /**\n * A file reached one of the import paths and could not be read — a corrupt\n * archive, a `.zip` of something else, malformed GeoJSON. Emitted so the\n * consumer can say so in its own UI; the library has nowhere to show it.\n *\n * Not emitted for a file a `fileImportHandler` took: once the consumer owns\n * the file, it owns reporting the outcome too.\n */\n @Output() fileImportError = new EventEmitter<TheSeamMapFileImportError>()\n\n @ViewChild('featureContextMenu', { static: true, read: MenuComponent })\n public featureContextMenu!: MenuComponent\n\n _options = {\n mapTypeControl: true,\n mapTypeId: 'hybrid',\n streetViewControl: false,\n fullscreenControl: this.fullscreenControlEnabled,\n }\n\n readonly _contextMenuItems$: Observable<TheSeamMapContextMenuItem[]>\n\n private idleListener: google.maps.MapsEventListener | undefined\n\n constructor(\n readonly elementRef: ElementRef,\n private readonly _focusMonitor: FocusMonitor,\n private readonly _googleMaps: GoogleMapsService,\n private readonly _mapValueManager: MapValueManagerService,\n private readonly _googleMapsApiLoader: TheSeamGoogleMapsApiLoader,\n ) {\n super(elementRef)\n\n this._focusMonitor\n .monitor(this._elementRef, true)\n .pipe(\n tap((origin) => {\n this._focusOrigin = origin\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._mapValueManager.valueChanged\n .pipe(\n tap((change) => {\n if (this.onChange) {\n this.onChange(change.value)\n }\n if (this.onTouched) {\n this.onTouched()\n }\n }),\n tap((changed) => {\n if (\n this._googleMaps.mapReady &&\n changed.source !== MapValueSource.FeatureChange\n ) {\n this._googleMaps.setData(changed.value)\n this._applySelectedGroupKey()\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n // `skip(1)` drops the value these BehaviorSubject-backed streams replay on\n // subscribe. An Angular `@Output` should fire when something changes, not\n // when someone starts listening — without this, a consumer binding\n // `(selectionChange)` receives a `null` before the user has interacted at\n // all, which reads as \"the selection was cleared\" and can wrongly reset a\n // panel or dirty a form on open. The subscription happens in the\n // constructor, when the replayed value is always the initial `null`, so\n // nothing real is ever skipped.\n this._googleMaps.selection$\n .pipe(\n skip(1),\n tap((selection) => this.selectionChange.emit(selection)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._googleMaps.hover$\n .pipe(\n skip(1),\n tap((hover) => this.featureHoverChange.emit(hover)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n // No `skip(1)` here, unlike `selection$` and `hover$`: `deleteBlocked$` is\n // a plain Subject with no replayed initial value to drop.\n this._googleMaps.deleteBlocked$\n .pipe(\n tap((target) => this.deleteBlocked.emit(target)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n // As with `deleteBlocked$`, a plain Subject with nothing to replay, so no\n // `skip(1)`.\n this._googleMaps.fileImportError$\n .pipe(\n tap((value) => this.fileImportError.emit(value)),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n\n this._contextMenuItems$ = combineLatest([\n this._googleMaps.editingEnabled$,\n // The RIGHT-CLICKED feature's group — what \"Delete Field\" is\n // conceptually acting on, independent of what happens to be selected.\n // See `contextMenuTarget$`'s doc comment.\n this._googleMaps.contextMenuTarget$,\n ]).pipe(\n map(([editingEnabled, target]) =>\n buildDeleteMenuItems({\n mode: this.interactionMode,\n editingEnabled,\n target,\n canDeleteFocusedFeature: () =>\n this._googleMaps.canDeleteFocusedFeature(),\n canDeleteGroup: (key) => this._googleMaps.canDeleteGroup(key),\n canDeleteSelection: () => this._googleMaps.canDeleteSelection(),\n deleteFocusedFeature: () => this._googleMaps.deleteFocusedFeature(),\n deleteGroup: (key) => this._googleMaps.deleteGroup(key),\n deleteSelection: () => this._googleMaps.deleteSelection(),\n }),\n ),\n tap((items) => {\n if (items.length === 0) {\n this._googleMaps.setFeatureContextMenu(null)\n } else {\n this._googleMaps.setFeatureContextMenu(this.featureContextMenu)\n }\n }),\n )\n\n this._googleMaps.setBaseLatLng(this.latitude, this.longitude)\n\n this._googleMaps.setPadding(this.padding)\n\n this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(\n map(() => true),\n catchError(() => of(false)),\n )\n }\n\n ngOnInit() {\n fromEvent<KeyboardEvent>(window, 'keydown')\n .pipe(\n tap((event: KeyboardEvent) => {\n switch (event.code) {\n case 'Delete':\n if (this._googleMaps.isEditingEnabled()) {\n if (this.interactionMode === 'grouped') {\n this._googleMaps.deleteFocusedFeature()\n } else {\n this._googleMaps.deleteSelection()\n }\n event.preventDefault()\n event.stopPropagation()\n }\n break\n case 'Escape':\n if (this.interactionMode === 'grouped') {\n this._googleMaps.handleEscape()\n } else {\n // Legacy parity: `handleEscape()`'s cascade also clears a\n // selection, but in legacy mode clicking a feature populates\n // the selection, so that would newly deselect it (and drop\n // its vertex handles) on a key that previously only cancelled\n // a draw. Two apps depend on legacy behaviour unchanged, so\n // keep the narrower pre-existing call here.\n this._googleMaps.stopDrawing()\n }\n event.preventDefault()\n event.stopPropagation()\n break\n case 'ContextMenu':\n this._googleMaps.openContextMenu()\n event.preventDefault()\n event.stopPropagation()\n break\n }\n }),\n takeUntil(this._ngUnsubscribe),\n )\n .subscribe()\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef)\n\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n let updateBase = false\n if (Object.prototype.hasOwnProperty.call(changes, 'latitude')) {\n this.latitude = changes.latitude.currentValue\n updateBase = true\n }\n if (Object.prototype.hasOwnProperty.call(changes, 'longitude')) {\n this.longitude = changes.longitude.currentValue\n updateBase = true\n }\n if (updateBase) {\n this._googleMaps.setBaseLatLng(this.latitude, this.longitude)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'allowDrawingHoleInPolygon')\n ) {\n this._googleMaps.allowDrawingHoleInPolygon(this.allowDrawingHoleInPolygon)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'fullscreenControlEnabled')\n ) {\n const fullscreenControl = coerceBooleanProperty(\n changes.fullscreenControlEnabled.currentValue,\n )\n if (fullscreenControl !== this._options.fullscreenControl) {\n this._options = {\n ...this._options,\n fullscreenControl,\n }\n }\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {\n this._googleMaps.setEditingEnabled(this.editingEnabled)\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {\n this._googleMaps.setPadding(this.padding)\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'interactionMode')) {\n this._googleMaps.setInteractionMode(this.interactionMode)\n }\n\n if (\n Object.prototype.hasOwnProperty.call(changes, 'featureGroupProperty') ||\n Object.prototype.hasOwnProperty.call(changes, 'newGroupKeyFactory')\n ) {\n this._googleMaps.setGroupOptions({\n groupProperty: this.featureGroupProperty,\n newGroupKeyFactory: this.newGroupKeyFactory,\n })\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'selectedGroupKey')) {\n this._applySelectedGroupKey()\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'canDelete')) {\n this._googleMaps.setCanDelete(this.canDelete)\n }\n\n if (Object.prototype.hasOwnProperty.call(changes, 'featureLabelProperty')) {\n this._googleMaps.setLabelProperty(this.featureLabelProperty)\n }\n }\n\n private _applySelectedGroupKey(): void {\n if (!this._googleMaps.mapReady) {\n return\n }\n if (this.selectedGroupKey === null) {\n this._googleMaps.clearSelection()\n return\n }\n if (!this._googleMaps.selectGroup(this.selectedGroupKey)) {\n // The named group is not in the current value. Clearing keeps the map\n // and the consumer's expectation from silently diverging.\n this._googleMaps.clearSelection()\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.warn(\n `[seam-google-maps] selectedGroupKey \"${this.selectedGroupKey}\" ` +\n `matches no group in the current value.`,\n )\n }\n }\n }\n\n writeValue(value: MapValue): void {\n this.value = value\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled = isDisabled\n this._changeDetectorRef.markForCheck()\n }\n\n public fitBounds(\n bounds: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n padding?: number | google.maps.Padding,\n ): void {\n this._googleMaps.fitBounds(bounds, padding)\n }\n\n public getGeoJson(): Promise<object> {\n return this._googleMaps.getGeoJson()\n }\n\n public hasFocus(): boolean {\n return this._focusOrigin !== null && this._focusOrigin !== undefined\n }\n\n /** Focuses the button. */\n public focus(): void {\n this._getHostElement().focus()\n }\n\n private _getHostElement() {\n return this._elementRef.nativeElement\n }\n\n _onMapReady(theMap: google.maps.Map) {\n this._googleMaps.setMap(theMap)\n this._googleMaps.setData(this._mapValueManager.value)\n\n // NOTE: The input zoom level was getting reset after this function ran,\n // so putting in this idle listener to wait until the map is fully rendered\n // to set the zoom.\n // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes\n // will display correctly\n this.idleListener = this._googleMaps.googleMap?.addListener('idle', () => {\n this._googleMaps.googleMap?.setZoom(this.zoom)\n this._googleMaps.reCenterOnFeatures()\n this._googleMaps.setInteractionMode(this.interactionMode)\n this._googleMaps.setGroupOptions({\n groupProperty: this.featureGroupProperty,\n newGroupKeyFactory: this.newGroupKeyFactory,\n })\n this._googleMaps.setLabelProperty(this.featureLabelProperty)\n this._applySelectedGroupKey()\n this.mapReady.emit(this._googleMaps.googleMap)\n\n this.idleListener?.remove()\n })\n }\n\n // The service delegates below guard on `mapReady` themselves, the same way\n // `_applySelectedGroupKey()` already does for the declarative\n // `selectedGroupKey` input. Their service-side counterparts call\n // `_assertInitialized()` and throw when the map hasn't finished loading;\n // this component's public surface is documented as non-throwing (an\n // unknown key returns `false` and changes nothing), so \"not ready yet\"\n // must behave the same way, not worse.\n\n /** Select a group by key. Returns false when no such group exists. */\n public selectGroup(key: string): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.selectGroup(key)\n }\n\n public clearSelection(): void {\n if (!this._googleMaps.mapReady) {\n return\n }\n this._googleMaps.clearSelection()\n }\n\n /** Fit the viewport to a group. Returns false when no such group exists. */\n public fitGroup(\n key: string,\n padding?: number | google.maps.Padding,\n ): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.fitGroup(key, padding)\n }\n\n /** Pan to a group's centre. Returns false when no such group exists. */\n public panToGroup(key: string): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.panToGroup(key)\n }\n\n public getGroups(): TheSeamMapFeatureGroup[] {\n if (!this._googleMaps.mapReady) {\n return []\n }\n return this._googleMaps.getGroups()\n }\n\n /**\n * Set a group's label text in place. Returns false when no such group\n * exists, or when no `featureLabelProperty` is set.\n *\n * Does not clear the selection or re-fit the viewport, so it is safe to\n * call while the user is renaming the very group being displayed.\n */\n public setGroupLabel(key: string, label: string): boolean {\n if (!this._googleMaps.mapReady) {\n return false\n }\n return this._googleMaps.setGroupLabel(key, label)\n }\n\n public setEditMode(enabled: boolean): void {\n this._googleMaps.setEditMode(enabled)\n }\n\n public isEditMode(): boolean {\n return this._googleMaps.isEditMode()\n }\n}\n","<ng-container *ngIf=\"_gmApiLoaded | async\">\n <google-map\n height=\"100%\"\n width=\"100%\"\n [center]=\"{ lat: latitude, lng: longitude }\"\n [zoom]=\"zoom\"\n [options]=\"_options\"\n (mapInitialized)=\"_onMapReady($any($event))\"\n >\n </google-map>\n</ng-container>\n<seam-menu #featureContextMenu>\n <button\n seamMenuItem\n *ngFor=\"let item of _contextMenuItems$ | async\"\n (click)=\"item.action()\"\n >\n {{ item.label }}\n </button>\n</seam-menu>\n<seam-map-file-drop *ngIf=\"fileDropEnabled\"></seam-map-file-drop>\n\n<seam-map-control\n *ngIf=\"fileUploadControlEnabled\"\n [def]=\"_fileUploadControlDef\"\n></seam-map-control>\n<seam-map-control\n *ngIf=\"reCenterControlEnabled\"\n [def]=\"_reCenterControlDef\"\n></seam-map-control>\n<seam-map-control\n *ngIf=\"editingEnabled\"\n [def]=\"_drawControlDef\"\n></seam-map-control>\n","import {\n Directive,\n ElementRef,\n HostBinding,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n} from '@angular/core'\nimport { interval, Observable, Subject, Subscriber } from 'rxjs'\nimport {\n filter,\n mapTo,\n startWith,\n switchMap,\n take,\n takeUntil,\n} from 'rxjs/operators'\n\ndeclare const ngDevMode: boolean | undefined\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\nexport const SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS: google.maps.places.AutocompleteOptions =\n {\n componentRestrictions: { country: 'US' },\n }\n\n@Directive({\n selector: 'input[seamGoogleMapsPlacesAutocomplete]',\n exportAs: 'seamGoogleMapsPlacesAutocomplete',\n})\nexport class TheSeamGoogleMapsPlacesAutocompleteDirective\n implements OnInit, OnDestroy, OnChanges\n{\n private readonly _autoCompleteReadySubject = new Subject<void>()\n private readonly _ngUnsubscribe = new Subject<void>()\n\n private _placeChangedPending: {\n observable: Observable<any>\n subscriber: Subscriber<any>\n }[] = []\n private _listeners: google.maps.MapsEventListener[] = []\n\n public autoComplete?: google.maps.places.Autocomplete\n\n @Input()\n set options(\n value: google.maps.places.AutocompleteOptions | undefined | null,\n ) {\n this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n }\n private _options: google.maps.places.AutocompleteOptions =\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n\n /**\n * This event is fired when a PlaceResult is made available for a Place the\n * user has selected. If the user enters the name of a Place that was not\n * suggested by the control and presses the Enter key, or if a Place Details\n * request fails, the PlaceResult contains the user input in the name\n * property, with no other properties defined.\n *\n * See: https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete.place_changed\n */\n @Output() readonly placeChanged: Observable<any>\n\n @HostBinding('attr.type') _attrType = 'text'\n\n constructor(\n private readonly _elementRef: ElementRef<HTMLInputElement>,\n private readonly _ngZone: NgZone,\n ) {\n this.placeChanged = this._autoCompleteReadySubject.pipe(\n startWith(undefined),\n switchMap(() => this._createPlaceChangedObservable<any>()),\n )\n }\n\n ngOnInit(): void {\n this._ngZone.runOutsideAngular(() => {\n this._untilGoogleMapsApiLoaded()\n .pipe(takeUntil(this._ngUnsubscribe))\n .subscribe(() => {\n this.autoComplete = new google.maps.places.Autocomplete(\n this.getHostElement(),\n this._options,\n )\n\n this._placeChangedPending.forEach((pending) =>\n pending.observable.subscribe(pending.subscriber),\n )\n\n this._autoCompleteReadySubject.next(undefined)\n })\n })\n }\n\n ngOnDestroy(): void {\n this._listeners.forEach((l) => l.remove())\n this._listeners = []\n\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (this.autoComplete && changes['options']) {\n this.autoComplete.setOptions(this._options)\n }\n }\n\n private _untilGoogleMapsApiLoaded(): Observable<void> {\n return interval(500).pipe(\n filter(\n () =>\n !!(window.google && window.google.maps && window.google.maps.version),\n ),\n take(1),\n mapTo(undefined),\n )\n }\n\n /**\n * Returns the bounds to which predictions are biased.\n */\n public getBounds(): google.maps.LatLngBounds | undefined {\n this._assertInitialized()\n return this.autoComplete.getBounds()\n }\n\n /**\n * Returns the fields to be included for the Place in the details response\n * when the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public getFields(): string[] | undefined {\n this._assertInitialized()\n return (this.autoComplete as any).getFields()\n }\n\n /**\n * Returns the details of the Place selected by user if the details were\n * successfully retrieved. Otherwise returns a stub Place object, with the\n * name property set to the current value of the input field.\n */\n public getPlace(): google.maps.places.PlaceResult {\n this._assertInitialized()\n return this.autoComplete.getPlace()\n }\n\n /**\n * Sets the preferred area within which to return Place results. Results are\n * biased towards, but not restricted to, this area.\n */\n public setBounds(\n bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setBounds(bounds!)\n }\n\n /**\n * Sets the component restrictions. Component restrictions are used to\n * restrict predictions to only those within the parent component. For\n * example, the country.\n */\n public setComponentRestrictions(\n restrictions?: google.maps.places.ComponentRestrictions,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setComponentRestrictions(restrictions!)\n }\n\n /**\n * Sets the fields to be included for the Place in the details response when\n * the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public setFields(fields?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setFields(fields!)\n }\n\n /** */\n public setOptions(options?: google.maps.places.AutocompleteOptions): void {\n this._assertInitialized()\n\n return this.autoComplete.setOptions(options!)\n }\n\n /**\n * Sets the types of predictions to be returned. For supported types, see the\n * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).\n * If no types are specified, all types will be returned.\n */\n public setTypes(types?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setTypes(types!)\n }\n\n /** Focuses the input. */\n public focus(): void {\n this._elementRef.nativeElement.focus()\n }\n\n /** Unfocuses the input. */\n public blur(): void {\n this._elementRef.nativeElement.blur()\n }\n\n public getHostElement(): HTMLInputElement {\n return this._elementRef.nativeElement\n }\n\n private _createPlaceChangedObservable<T>(): Observable<T> {\n const observable = new Observable<T>((subscriber) => {\n if (!this.autoComplete) {\n this._placeChangedPending.push({ observable, subscriber })\n return undefined\n }\n const listener = this.autoComplete.addListener(\n 'place_changed',\n (event: T) => {\n this._ngZone.run(() => subscriber.next(event))\n },\n )\n this._listeners.push(listener)\n\n return () => listener.remove()\n })\n return observable\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n 'autoComplete'\n > {\n if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map Places information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n}\n","import { BooleanInput, coerceNumberProperty } from '@angular/cdk/coercion'\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n HostListener,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n} from '@angular/core'\nimport { interval, Observable, of, Subject, Subscriber } from 'rxjs'\nimport {\n filter,\n mapTo,\n startWith,\n switchMap,\n take,\n takeUntil,\n} from 'rxjs/operators'\n\nimport { faSearchLocation } from '@fortawesome/free-solid-svg-icons'\nimport { InputBoolean } from '@theseam/ui-common/core'\nimport { InputDirective } from '@theseam/ui-common/form-field'\nimport { SeamIcon } from '@theseam/ui-common/icon'\n\nimport {\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n} from './google-maps-places-autocomplete.directive'\n\ndeclare const ngDevMode: boolean | undefined\ntype WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }\n\n/**\n *\n */\n@Component({\n selector: 'seam-google-maps-places-autocomplete',\n templateUrl: './google-maps-places-autocomplete.component.html',\n styleUrls: ['./google-maps-places-autocomplete.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n exportAs: 'seamGoogleMapsPlacesAutoComplete',\n standalone: false,\n})\nexport class TheSeamGoogleMapsPlacesAutoCompleteComponent implements OnDestroy {\n static ngAcceptInputType_disabled: BooleanInput\n\n private readonly _ngUnsubscribe = new Subject<void>()\n private readonly _autoCompleteReadySubject = new Subject()\n\n private _placeChangedPending: {\n observable: Observable<any>\n subscriber: Subscriber<any>\n }[] = []\n\n public autoComplete?: google.maps.places.Autocomplete\n\n @Input() label: string | undefined | null = 'Search by address, place or name'\n\n @Input() icon: SeamIcon | undefined | null = faSearchLocation\n\n @Input() @InputBoolean() disabled: BooleanInput = false\n\n @Input() placeholder: string | undefined | null =\n 'Enter address, place or name'\n\n @Input() autocorrect: 'off' | 'on' | undefined | null = 'off'\n\n @Input() autocapitalize: 'off' | 'on' | undefined | null = 'off'\n\n /**\n * Set the tab index to `-1` to allow the root element of the\n * component to receive `focus` event from javascript, but not get focused by\n * keyboard navigation.\n */\n @Input()\n set tabIndex(value: number) {\n this._tabIndex = coerceNumberProperty(value)\n }\n get tabIndex(): number {\n return this._tabIndex\n }\n private _tabIndex = -1\n\n @Input()\n set options(\n value: google.maps.places.AutocompleteOptions | undefined | null,\n ) {\n this._options = value || SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n }\n _options: google.maps.places.AutocompleteOptions =\n SEAM_GOOGLE_PLACES_AUTOCOMPLETE_DEFAULT_OPTIONS\n\n /**\n * This event is fired when a PlaceResult is made available for a Place the\n * user has selected. If the user enters the name of a Place that was not\n * suggested by the control and presses the Enter key, or if a Place Details\n * request fails, the PlaceResult contains the user input in the name\n * property, with no other properties defined.\n *\n * See: https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete.place_changed\n */\n @Output() readonly placeChanged: Observable<void>\n\n @ViewChild('inp', { read: InputDirective, static: true })\n _inputDirective!: InputDirective\n\n @ViewChild(TheSeamGoogleMapsPlacesAutocompleteDirective, { static: true })\n set __autocompleteDirective(\n value: TheSeamGoogleMapsPlacesAutocompleteDirective,\n ) {\n this._autoCompleteDirective = value\n this._untilAutoCompleteReady()\n .pipe(takeUntil(this._ngUnsubscribe))\n .subscribe(() => {\n this.autoComplete = this._autoCompleteDirective.autoComplete\n this._placeChangedPending.forEach((pending) =>\n pending.observable.subscribe(pending.subscriber),\n )\n this._placeChangedPending = []\n })\n }\n _autoCompleteDirective!: TheSeamGoogleMapsPlacesAutocompleteDirective\n\n @HostBinding('attr.tabindex')\n get _attrTabIndex() {\n return this.disabled ? -1 : this.tabIndex || 0\n }\n\n @HostListener('click', ['event'])\n _onClick(event: MouseEvent) {\n this._inputDirective.focus()\n }\n\n @HostListener('focus', ['$event'])\n _onFocus() {\n this._inputDirective?.focus()\n }\n\n constructor(private readonly _elementRef: ElementRef) {\n this.placeChanged = this._autoCompleteReadySubject.pipe(\n startWith(undefined),\n switchMap(() => this._createPlaceChangedObservable<any>()),\n )\n }\n\n /** @ignore */\n ngOnDestroy() {\n this._ngUnsubscribe.next()\n this._ngUnsubscribe.complete()\n }\n\n private _untilAutoCompleteReady(): Observable<void> {\n return interval(500).pipe(\n filter(() => !!this._autoCompleteDirective.autoComplete),\n take(1),\n mapTo(undefined),\n )\n }\n\n /**\n * Returns the bounds to which predictions are biased.\n */\n public getBounds(): google.maps.LatLngBounds | undefined {\n this._assertInitialized()\n return this.autoComplete.getBounds()\n }\n\n /**\n * Returns the fields to be included for the Place in the details response\n * when the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public getFields(): string[] | undefined {\n this._assertInitialized()\n return (this.autoComplete as any).getFields()\n }\n\n /**\n * Returns the details of the Place selected by user if the details were\n * successfully retrieved. Otherwise returns a stub Place object, with the\n * name property set to the current value of the input field.\n */\n public getPlace(): google.maps.places.PlaceResult {\n this._assertInitialized()\n return this.autoComplete.getPlace()\n }\n\n /**\n * Sets the preferred area within which to return Place results. Results are\n * biased towards, but not restricted to, this area.\n */\n public setBounds(\n bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setBounds(bounds!)\n }\n\n /**\n * Sets the component restrictions. Component restrictions are used to\n * restrict predictions to only those within the parent component. For\n * example, the country.\n */\n public setComponentRestrictions(\n restrictions?: google.maps.places.ComponentRestrictions,\n ): void {\n this._assertInitialized()\n\n return this.autoComplete.setComponentRestrictions(restrictions!)\n }\n\n /**\n * Sets the fields to be included for the Place in the details response when\n * the details are successfully retrieved. For a list of fields see\n * [PlaceResult](https://developers.google.com/maps/documentation/javascript/reference/places-service#PlaceResult).\n */\n public setFields(fields?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setFields(fields!)\n }\n\n /** */\n public setOptions(options?: google.maps.places.AutocompleteOptions): void {\n this._assertInitialized()\n\n return this.autoComplete.setOptions(options!)\n }\n\n /**\n * Sets the types of predictions to be returned. For supported types, see the\n * [developer's guide](https://developers.google.com/maps/documentation/javascript/places-autocomplete#constrain-place-types).\n * If no types are specified, all types will be returned.\n */\n public setTypes(types?: string[]): void {\n this._assertInitialized()\n\n return this.autoComplete.setTypes(types!)\n }\n\n /** Focuses the input. */\n public focus(): void {\n this._elementRef.nativeElement.focus()\n }\n\n /** Unfocuses the input. */\n public blur(): void {\n this._elementRef.nativeElement.blur()\n }\n\n public getHostElement(): HTMLInputElement {\n return this._elementRef.nativeElement\n }\n\n private _createPlaceChangedObservable<T>(): Observable<T> {\n const observable = new Observable<T>((subscriber) => {\n if (!this.autoComplete) {\n this._placeChangedPending.push({ observable, subscriber })\n return undefined\n }\n\n const sub = this._autoCompleteDirective.placeChanged.subscribe(subscriber)\n\n return () => sub.unsubscribe()\n })\n return observable\n }\n\n /** Asserts that the map has been initialized. */\n private _assertInitialized(): asserts this is WithRequired<\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n 'autoComplete'\n > {\n if (!this.autoComplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(\n 'Cannot access Google Map Places information before the API has been initialized. ' +\n 'Please wait for the API to load before trying to interact with it.',\n )\n }\n }\n}\n","<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\n</div>\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{\n label || placeholder\n}}</label>\n<input\n #inp=\"seamInput\"\n seamInput\n seamGoogleMapsPlacesAutocomplete\n [disabled]=\"disabled\"\n [attr.placeholder]=\"placeholder\"\n [attr.autocorrect]=\"autocorrect\"\n [attr.autocapitalize]=\"autocapitalize\"\n [options]=\"_options\"\n/>\n","import { ObserversModule } from '@angular/cdk/observers'\nimport { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\n\nimport { GoogleMapsModule } from '@angular/google-maps'\nimport { TheSeamFormFieldModule } from '@theseam/ui-common/form-field'\nimport { TheSeamIconModule } from '@theseam/ui-common/icon'\nimport { TheSeamMenuModule } from '@theseam/ui-common/menu'\nimport { TheSeamSharedModule } from '@theseam/ui-common/shared'\n\nimport { TheSeamGoogleMapsPlacesAutoCompleteComponent } from './google-maps-places-autocomplete/google-maps-places-autocomplete.component'\nimport { TheSeamGoogleMapsPlacesAutocompleteDirective } from './google-maps-places-autocomplete/google-maps-places-autocomplete.directive'\nimport { TheSeamGoogleMapsRecenterButtonControlComponent } from './google-maps-recenter-button-control/google-maps-recenter-button-control.component'\nimport { TheSeamGoogleMapsUploadButtonControlComponent } from './google-maps-upload-button-control/google-maps-upload-button-control.component'\nimport { TheSeamGoogleMapsComponent } from './google-maps/google-maps.component'\nimport { TheSeamMapsControlComponent } from './map-control.component'\nimport { TheSeamMapFileDropComponent } from './map-file-drop/map-file-drop.component'\n\n@NgModule({\n declarations: [\n TheSeamGoogleMapsComponent,\n TheSeamMapFileDropComponent,\n TheSeamGoogleMapsUploadButtonControlComponent,\n TheSeamGoogleMapsRecenterButtonControlComponent,\n TheSeamMapsControlComponent,\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n ],\n imports: [\n CommonModule,\n ObserversModule,\n TheSeamSharedModule,\n TheSeamMenuModule,\n TheSeamIconModule,\n TheSeamFormFieldModule,\n GoogleMapsModule,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n ],\n exports: [\n TheSeamGoogleMapsComponent,\n TheSeamGoogleMapsPlacesAutocompleteDirective,\n TheSeamGoogleMapsPlacesAutoCompleteComponent,\n TheSeamMapsControlComponent,\n ],\n})\nexport class TheSeamGoogleMapsModule {}\n","import {\n Inject,\n Injectable,\n InjectionToken,\n LOCALE_ID,\n Optional,\n} from '@angular/core'\nimport { from, Observable, of } from 'rxjs'\n\nimport { TheSeamGoogleMapsApiLoader } from './google-maps-api-loader'\n\ninterface GoogleMapsWindow extends Window {\n gm_authFailure?: () => void\n google?: typeof google\n}\n\ndeclare const window: GoogleMapsWindow\n\n/**\n * Token for the config of the LazyMapsAPILoader. Please provide an object of\n * type {@link TheSeamLazyMapsApiLoader}.\n */\nexport const THESEAM_LAZY_MAPS_API_CONFIG =\n new InjectionToken<TheSeamLazyMapsApiLoaderConfig>(\n 'THESEAM_LAZY_MAPS_API_CONFIG',\n )\n\n/**\n * Configuration for the {@link TheSeamLazyMapsApiLoader}.\n */\nexport interface TheSeamLazyMapsApiLoaderConfig {\n /**\n * The Google Maps API Key (see:\n * https://developers.google.com/maps/documentation/javascript/get-api-key)\n */\n apiKey?: string\n\n /**\n * The Google Maps client ID (for premium plans). When you have a Google Maps\n * APIs Premium Plan license, you must authenticate your application with\n * either an API key or a client ID. The Google Maps API will fail to load if\n * both a client ID and an API key are included.\n */\n clientId?: string\n\n /**\n * The Google Maps channel name (for premium plans). A channel parameter is an\n * optional parameter that allows you to track usage under your client ID by\n * assigning a distinct channel to each of your applications.\n */\n channel?: string\n\n /**\n * Google Maps API version.\n */\n apiVersion?: string\n\n /**\n * Url used for the `<script>` tag.\n */\n url?: string\n\n /**\n * Defines which Google Maps libraries should get loaded.\n */\n libraries?: string[]\n\n /**\n * The default bias for the map behavior is US. If you wish to alter your\n * application to serve different map tiles or bias the application, you can\n * overwrite the default behavior (US) by defining a `region`. See\n * https://developers.google.com/maps/documentation/javascript/basics#Region\n */\n region?: string\n\n /**\n * The Google Maps API uses the browser's preferred language when displaying\n * textual information. If you wish to overwrite this behavior and force the\n * API to use a given language, you can use this setting. See\n * https://developers.google.com/maps/documentation/javascript/basics#Language\n */\n language?: string\n\n loading?: string\n}\n\n@Injectable()\nexport class TheSeamLazyMapsApiLoader extends TheSeamGoogleMapsApiLoader {\n protected _scriptLoadingPromise?: Promise<void>\n protected readonly _config: TheSeamLazyMapsApiLoaderConfig\n protected readonly _SCRIPT_ID: string = 'seamGoogleMapsApiScript'\n protected readonly callbackName: string = `__seamLazyGoogleMapsApiLoader`\n\n constructor(\n @Inject(LOCALE_ID) private readonly _localeId: string,\n @Optional()\n @Inject(THESEAM_LAZY_MAPS_API_CONFIG)\n readonly config?: TheSeamLazyMapsApiLoaderConfig,\n ) {\n super()\n this._config = config || {}\n }\n\n public load(): Observable<void> {\n if (window.google && window.google.maps) {\n // Google maps already loaded on the page.\n return of(undefined)\n }\n\n if (this._scriptLoadingPromise) {\n return from(this._scriptLoadingPromise)\n }\n\n // This can happen in HMR situations or Stackblitz.io editors.\n const scriptOnPage = document.getElementById(this._SCRIPT_ID)\n if (scriptOnPage) {\n this._assignScriptLoadingPromise(scriptOnPage)\n return from(this._getScriptLoadingPromise())\n }\n\n const script = document.createElement('script')\n script.type = 'text/javascript'\n script.async = true\n script.defer = true\n script.id = this._SCRIPT_ID\n script.src = this._getScriptSrc(this.callbackName)\n this._assignScriptLoadingPromise(script)\n document.body.appendChild(script)\n return from(this._getScriptLoadingPromise())\n }\n\n private _assignScriptLoadingPromise(scriptElem: HTMLElement) {\n this._scriptLoadingPromise = new Promise((resolve, reject) => {\n const win = window as any\n win[this.callbackName] = () => {\n resolve()\n }\n\n scriptElem.onerror = (error: Event | string) => {\n reject(error)\n }\n })\n }\n\n private _getScriptLoadingPromise(): Promise<void> {\n if (!this._scriptLoadingPromise) {\n throw Error(`_scriptLoadingPromise has not been assigned.`)\n }\n return this._scriptLoadingPromise\n }\n\n protected _getScriptSrc(callbackName: string): string {\n const hostAndPath: string =\n this._config.url || 'https://maps.googleapis.com/maps/api/js'\n const queryParams: { [key: string]: string | string[] | undefined | null } =\n {\n v: this._config.apiVersion || 'quarterly',\n callback: callbackName,\n key: this._config.apiKey,\n client: this._config.clientId,\n channel: this._config.channel,\n libraries: this._config.libraries,\n region: this._config.region,\n language:\n this._config.language ||\n (this._localeId !== 'en-US' ? this._localeId : null),\n loading: this._config.loading || 'async',\n }\n\n const params: string = Object.keys(queryParams)\n // Remove undefined or null params.\n .filter(\n (k: string) => queryParams[k] !== undefined && queryParams[k] !== null,\n )\n // Remove empty arrays.\n .filter((k: string) => {\n const param = queryParams[k]\n return !Array.isArray(param) || param.length > 0\n })\n // Join arrays as comma seperated strings.\n .map((k: string) => {\n const param = queryParams[k]\n return {\n key: k,\n value: Array.isArray(param) ? param.join(',') : param,\n } as { key: string; value: string }\n })\n .map((entry: { key: string; value: string }) => {\n return `${entry.key}=${entry.value}`\n })\n .join('&')\n\n return `${hostAndPath}?${params}`\n }\n}\n","import { Injectable } from '@angular/core'\nimport { defer, Observable, of, throwError } from 'rxjs'\n\nimport { TheSeamGoogleMapsApiLoader } from './google-maps-api-loader'\n\n/**\n * When using the TheSeamNoopGoogleMapsAPILoader, the Google Maps API must be\n * added to the page some other way before the map component is initialixed. One\n * way would be via a `<script>` Tag.\n */\n@Injectable()\nexport class TheSeamNoopGoogleMapsAPILoader extends TheSeamGoogleMapsApiLoader {\n load(): Observable<void> {\n return defer(() => {\n if (!(window as any).google || !(window as any).google.maps) {\n return throwError(\n new Error(\n 'Google Maps API not loaded on page. Make sure window.google.maps is available.',\n ),\n )\n }\n return of(undefined)\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.MapValueManagerService","i1.GoogleMapsService","i1","i3","i2.MapValueManagerService","i2.GoogleMapsService","i3.MapValueManagerService","i4.TheSeamGoogleMapsApiLoader","i8.TheSeamMapFileDropComponent","i9.TheSeamMapsControlComponent","i4.TheSeamGoogleMapsPlacesAutocompleteDirective"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;MAca,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;MAGX,gBAAgB,GAAG,IAAI,cAAc,CAAM,kBAAkB;;ICN9D;AAAZ,CAAA,UAAY,sBAAsB,EAAA;AAChC,IAAA,sBAAA,CAAA,YAAA,CAAA,GAAA,mBAAgC;AAChC,IAAA,sBAAA,CAAA,UAAA,CAAA,GAAA,iBAA4B;AAC9B,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,GAAA,EAAA,CAAA,CAAA;AAK5B,SAAU,oBAAoB,CAClC,YAAoB,EAAA;IAEpB,QACE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,SAAS,CAC7C,CAAC,KAAK,KAAK,KAAK,KAAK,YAAY,CAClC,KAAK,CAAC,CAAC;AAEZ;AAEM,SAAU,iBAAiB,CAAC,OAAiC,EAAA;I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