/*!
 * Copyright (c) what3words http://what3words.com
 */
import { AUTOSUGGEST_SELECTOR, CURRENT_LOCATION_CONTROL_SELECTOR, DEFAULTS, MAP_SELECTOR, MAP_TYPE_CONTROL_SELECTOR, MARKER_SRC, MIN_GRID_ZOOM_LEVEL, SEARCH_CONTROL_SELECTOR, SELECTED_ZOOM_LEVEL, SELECTORS, TOP_LEFT, W3W_REGEX, ZOOM_CONTROL_SELECTOR, } from "../../lib/constants";
import { sdk, what3wordsClients } from "../../lib/sdk";
import { h, Host, } from "@stencil/core";
import { ApiVersion, fetchTransport } from "@what3words/api";
import { version } from "../../../package.json";
import { GoogleMaps } from "./providers/google";
export class What3wordsMap {
    constructor() {
        var _a;
        this.api_key = DEFAULTS.emptyString;
        this.headers = DEFAULTS.headers;
        this.base_url = (_a = sdk.api.clients.gridSection["_config"].host) !== null && _a !== void 0 ? _a : DEFAULTS.base_url;
        this.api_version = ApiVersion.Version3;
        /**
         * The three word address to load after initial map render. If empty, map will remain at the provided/default lat, lng values
         */
        this.words = DEFAULTS.emptyString;
        this.map_provider = "google";
        this.map_api_key = DEFAULTS.emptyString;
        this.version = "weekly";
        this.libraries = [];
        /**
         * Passed to the maps provider sdk. Also used as the default w3w language.
         * Cross-compatible language support is not guaranteed between the map provider and w3w sdks.
         * w3w language default behavior can be overridden by setting the what3words-autosuggest language prop to a supported language.
         * See https://developers.google.com/maps/faq#languagesupport
         * See https://developer.what3words.com/public-api/docs#available-languages
         */
        this.language = "en";
        this.region = "GB";
        /**
         * Latitude value used on initial map render. Defaults to What3Words HQ latitude.
         */
        this.lat = DEFAULTS.center.lat;
        /**
         * Longitude value used on initial map render. Defaults to What3Words HQ longitude.
         */
        this.lng = DEFAULTS.center.lng;
        this.tilt = 0;
        this.zoom = 8;
        this.zoom_control_position = 0;
        this.map_type_control_position = 0;
        this.street_view_control_position = 0;
        this.rotate_control_position = 0;
        this.fullscreen_control_position = 0;
        this.search_control_position = TOP_LEFT;
        this.current_location_control_position = 0;
        this.selected_zoom = SELECTED_ZOOM_LEVEL;
        this.marker_icon = MARKER_SRC;
        this.searchControlSlot = DEFAULTS.null;
        this.currentLocationControlSlot = DEFAULTS.null;
        this.zoomControlSlot = DEFAULTS.null;
        this.mapTypeControlSlot = DEFAULTS.null;
        this.mapLoaded = false;
        this.input = DEFAULTS.null;
        this.autosuggest = DEFAULTS.null;
        this.placesSuggestions = [];
        this.apiRequestTimeout = DEFAULTS.null;
        this.watch_id = DEFAULTS.null;
        this.provider = DEFAULTS.null;
        this.current_location_coordinates = DEFAULTS.null;
        this.w3wLanguage = this.language;
        this.clients = {};
    }
    async setApiKey(key) {
        Object.values(this.clients).forEach((client) => client.apiKey(key));
    }
    async setBaseUrl(host) {
        Object.values(this.clients).forEach((client) => client.config({ host }));
    }
    async setHeaders(value) {
        const componentHeaders = this.getComponentHeaders();
        const injectedHeaders = (typeof value === "string" ? JSON.parse(value) : value);
        Object.values(this.clients).forEach((client) => client.config({
            headers: Object.assign(Object.assign({}, injectedHeaders), componentHeaders),
        }));
    }
    async setApiVersion(api_version) {
        Object.values(this.clients).forEach((client) => client.config({ apiVersion: api_version }));
    }
    async setWords(words) {
        var _a;
        if (!W3W_REGEX.test(words) || !this.provider)
            return;
        (_a = this.clients.convertToCoordinates) === null || _a === void 0 ? void 0 : _a.run({ words }).then((response) => {
            if (!this.provider)
                return;
            const { square, coordinates } = response;
            this.provider.plotSquare(square);
            this.provider.plotMarker(response, (coordinates) => this.coordinates_changed.emit(coordinates), this.marker_icon);
            this.provider.panTo(coordinates);
            const { zoom } = this.provider;
            if (zoom && zoom < this.selected_zoom)
                this.provider.zoom = this.selected_zoom;
            this.setInputValue(words);
        }).catch((error) => {
            // TODO: Clean up error type checking
            if (Object.prototype.hasOwnProperty.call(error, "message")) {
                this.__error.emit(error);
                console.error(error.message);
            }
            else if (Object.prototype.hasOwnProperty.call(error, "details")) {
                // manual type coercion based off @what3words/api/dist/lib/transport/error.d.ts
                const transportError = error;
                this.__error.emit(new ErrorEvent(transportError.details.message));
                console.error(transportError.details.message);
            }
        });
    }
    async clearGrid() {
        if (!this.provider)
            return;
        this.provider.clearGrid();
    }
    async getLat() {
        var _a;
        if (!this.provider)
            return 0;
        return (_a = this.provider.center) === null || _a === void 0 ? void 0 : _a.lat;
    }
    async setCoordinates(newCoordinateValue, _oldCoordinateValue, propName) {
        if (!this.provider)
            return;
        const newCoordinates = {
            lat: this.lat,
            lng: this.lng,
            [propName]: newCoordinateValue,
        };
        const validatedCoordinates = this.validateCoordinates(newCoordinates);
        this.lng = validatedCoordinates.lng;
        this.lat = validatedCoordinates.lat;
        this.provider.center = validatedCoordinates;
    }
    async getLng() {
        var _a;
        if (!this.provider)
            return 0;
        return (_a = this.provider.center) === null || _a === void 0 ? void 0 : _a.lng;
    }
    async setZoom(zoom) {
        if (!this.provider)
            return;
        this.provider.zoom = zoom;
    }
    async getZoom() {
        if (!this.provider)
            return 0;
        return this.provider.zoom;
    }
    async getBounds() {
        if (!this.provider)
            return DEFAULTS.bounds;
        return this.provider.mapBounds;
    }
    async panTo(coordinates) {
        if (!this.provider)
            return;
        this.provider.panTo(coordinates);
    }
    async setMapTypeId(map_type_id) {
        if (!this.provider)
            return;
        this.provider.mapTypeId = map_type_id;
    }
    setMapControlPosition(control, position) {
        if (!this.provider)
            return;
        this.provider.setMapControlPosition(control, position);
    }
    setSearchControlPosition(position) {
        this.searchControlSlot = this.el.querySelector(SEARCH_CONTROL_SELECTOR);
        if (this.searchControlSlot) {
            this.setMapControlPosition(this.searchControlSlot, position);
        }
    }
    setCurrentLocationControlPosition(position) {
        this.currentLocationControlSlot = this.el.querySelector(CURRENT_LOCATION_CONTROL_SELECTOR);
        if (this.currentLocationControlSlot) {
            this.setMapControlPosition(this.currentLocationControlSlot, position);
        }
    }
    setMapTypeControlPosition(position) {
        if (!this.provider)
            return;
        this.provider.mapTypeControlPosition = position;
        this.mapTypeControlSlot = this.el.querySelector(MAP_TYPE_CONTROL_SELECTOR);
        if (this.mapTypeControlSlot) {
            this.setMapControlPosition(this.mapTypeControlSlot, position);
        }
    }
    setZoomControlPosition(position) {
        if (!this.provider)
            return;
        this.provider.zoomControlPosition = position;
        this.zoomControlSlot = this.el.querySelector(ZOOM_CONTROL_SELECTOR);
        if (this.zoomControlSlot) {
            this.setMapControlPosition(this.zoomControlSlot, position);
        }
    }
    setFullscreenControlPosition(position) {
        if (!this.provider)
            return;
        this.provider.fullscreenControlPosition = position;
    }
    setStreetViewControlPosition(position) {
        if (!this.provider)
            return;
        this.provider.streetViewControlPosition = position;
    }
    setRotateControlPosition(position) {
        if (!this.provider)
            return;
        this.provider.rotateControlPosition = position;
    }
    handlePlacesSuggestions(suggestions) {
        if (this.autosuggest)
            this.autosuggest.options = suggestions;
    }
    validateCoordinates(coordinates) {
        // NOTE: the Google Maps SDK will clamp lat/lng values
        // See https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLng
        if (isNaN(coordinates.lat) ||
            isNaN(coordinates.lng) ||
            coordinates.lng === 0 ||
            coordinates.lat === 0) {
            return Object.assign(Object.assign({}, coordinates), { lat: DEFAULTS.center.lat, lng: DEFAULTS.center.lng });
        }
        return coordinates;
    }
    async onLoad() {
        const { words } = this;
        const isBrowser = typeof window !== "undefined";
        const searchControl = this.el.querySelector(SEARCH_CONTROL_SELECTOR);
        if (isBrowser && this.watch_location) {
            await this.watchPosition();
        }
        else if (isBrowser && this.current_location) {
            this.getCurrentPosition();
        }
        if (words) {
            await this.setWords(words);
        }
        if (searchControl && this.provider) {
            this.provider.addControl(searchControl, this.search_control_position);
        }
    }
    async onSelectedCoordinates({ detail: { lat, lng }, }) {
        var _a;
        return (_a = this.clients.convertTo3wa) === null || _a === void 0 ? void 0 : _a.run({
            coordinates: { lat, lng },
            language: this.w3wLanguage,
        }).then((response) => {
            var _a, _b, _c;
            if (!this.provider)
                return;
            const { square, words } = response;
            this.setInputValue(words);
            // revert w3w language to map language (default) to maintain user language setting
            // e.g. sets to response.language during input change (`onSelectedSuggestion`)
            if (![(_a = this.autosuggest) === null || _a === void 0 ? void 0 : _a.language, this.language].includes(this.w3wLanguage)) {
                this.w3wLanguage = (_c = (_b = this.autosuggest) === null || _b === void 0 ? void 0 : _b.language) !== null && _c !== void 0 ? _c : this.language;
            }
            this.provider.plotSquare(square);
            this.provider.plotMarker(response, (coordinates) => this.coordinates_changed.emit(coordinates), this.marker_icon);
            this.selected_square.emit(response);
        }).catch((error) => {
            // TODO: Clean up error type checking
            if (Object.prototype.hasOwnProperty.call(error, "message")) {
                this.__error.emit(error);
                console.error(error.message);
            }
            else if (Object.prototype.hasOwnProperty.call(error, "details")) {
                // manual type coercion based off @what3words/api/dist/lib/transport/error.d.ts
                const transportError = error;
                this.__error.emit(new ErrorEvent(transportError.details.message));
                console.error(transportError.details.message);
            }
        });
    }
    initProvider(opts = {}) {
        if (!this.provider)
            return;
        const _opts = Object.assign({ version: this.version, api_key: this.map_api_key, libraries: this.libraries, language: this.language, region: this.region, center: { lat: this.lat, lng: this.lng }, tilt: this.tilt, disable_default_ui: this.disable_default_ui, zoom: this.zoom, zoom_control: this.zoom_control, zoom_control_position: this.zoom_control_position, map_type_id: this.map_type_id, map_type_control: this.map_type_control, map_type_control_position: this.map_type_control_position, scale_control: this.scale_control, street_view_control: this.street_view_control, street_view_control_position: this.street_view_control_position, rotate_control: this.rotate_control, rotate_control_position: this.rotate_control_position, fullscreen_control: this.fullscreen_control, fullscreen_control_position: this.fullscreen_control_position }, opts);
        const mapDiv = this.el.querySelector(MAP_SELECTOR);
        if (!mapDiv) {
            // TODO: Add error logging
            return;
        }
        this.provider.init(mapDiv, _opts);
    }
    watchMapVersion(version) {
        this.initProvider({ version });
    }
    watchMapApiKey(api_key) {
        this.initProvider({ api_key });
    }
    watchMapLibraries(libraries) {
        this.initProvider({ libraries });
    }
    watchMapLanguage(language) {
        this.initProvider({ language });
    }
    watchMapRegion(region) {
        this.initProvider({ region });
    }
    setMapLoaded(loaded) {
        this.mapLoaded = loaded;
    }
    async onCurrentPositionSuccess(position) {
        const { coords: { latitude: lat, longitude: lng }, } = position;
        if (!this.provider)
            return;
        const center = this.provider.center;
        const hasLocationChanged = (center === null || center === void 0 ? void 0 : center.lat) !== lat || center.lng !== lng;
        if (hasLocationChanged) {
            this.provider.panTo({ lat, lng });
            this.provider.zoom = this.selected_zoom;
            this.coordinates_changed.emit({ lat, lng });
            this.current_location_coordinates = { lat, lng };
        }
    }
    onCurrentPositionFailure(error) {
        this.__error.emit(new ErrorEvent(error.message));
    }
    async watchPosition() {
        this.watch_id = window.navigator.geolocation.watchPosition((position) => {
            this.onCurrentPositionSuccess(position).catch((_error) => {
                // TODO: Add error logging
            });
        }, (error) => {
            this.onCurrentPositionFailure(error);
        });
    }
    clearWatchPosition() {
        if (this.watch_id) {
            window.navigator.geolocation.clearWatch(this.watch_id);
        }
    }
    getCurrentPosition() {
        window.navigator.geolocation.getCurrentPosition((position) => {
            this.onCurrentPositionSuccess(position).catch((_error) => {
                // TODO: Add error logging
            });
        }, (error) => {
            this.onCurrentPositionFailure(error);
        });
    }
    addMapEventListeners() {
        if (!this.provider)
            return;
        this.provider.addEventListener("maptype_changed", this.plotGrid.bind(this));
        this.provider.addEventListener("zoom_changed", this.plotGrid.bind(this));
        this.provider.addEventListener("bounds_changed", this.plotGrid.bind(this));
        this.provider.addEventListener("click", this.onChangePosition.bind(this));
    }
    setupAutosuggest() {
        var _a;
        if (!this.autosuggest)
            return;
        // Set w3wLanguage to autosuggest language or default both to map language
        if (this.autosuggest.hasAttribute("language")) {
            this.w3wLanguage =
                (_a = this.autosuggest.getAttribute("language")) !== null && _a !== void 0 ? _a : this.w3wLanguage; // coalescing operator used to coerce string type
        }
        else {
            this.w3wLanguage = this.language;
            this.autosuggest.setAttribute("language", this.language);
        }
        // Setup autosuggest api_key if not set
        if (!this.autosuggest.hasAttribute("api_key")) {
            this.autosuggest.setAttribute("api_key", this.api_key);
        }
        this.autosuggest.strict = false;
    }
    addAutosuggestEventListeners() {
        if (!this.autosuggest)
            return;
        this.autosuggest.addEventListener("__focus", this.onControlFocus.bind(this));
        this.autosuggest.addEventListener("value_valid", this.onValueValid.bind(this));
        this.autosuggest.addEventListener("value_invalid", this.onValueInvalid.bind(this));
        this.autosuggest.addEventListener("selected_suggestion", this.onSelectedSuggestion.bind(this));
        this.autosuggest.addEventListener("selected_custom_option", this.onCustomSelect.bind(this));
    }
    removeAutosuggestEventListeners() {
        if (!this.autosuggest)
            return;
        this.autosuggest.removeEventListener("__focus", this.onControlFocus.bind(this));
        this.autosuggest.removeEventListener("value_valid", this.onValueValid.bind(this));
        this.autosuggest.removeEventListener("value_invalid", this.onValueInvalid.bind(this));
        this.autosuggest.removeEventListener("selected_suggestion", this.onSelectedSuggestion.bind(this));
        this.autosuggest.removeEventListener("selected_custom_option", this.onCustomSelect.bind(this));
    }
    removeMapEventListeners() {
        if (!this.provider)
            return;
        this.provider.removeAllEventListeners();
    }
    addCurrentLocationEventListeners() {
        if (!this.currentLocationControlSlot)
            return;
        this.currentLocationControlSlot.addEventListener("click", () => {
            this.getCurrentPosition();
        });
    }
    removeCurrentLocationEventListeners() {
        this.currentLocationControlSlot = this.el.querySelector(CURRENT_LOCATION_CONTROL_SELECTOR);
        if (!this.currentLocationControlSlot)
            return;
        this.currentLocationControlSlot.removeEventListener("click", () => {
            this.getCurrentPosition();
        });
    }
    plotGrid() {
        if (!this.provider)
            return;
        const zoom = this.provider.zoom;
        const boundingBox = this.provider.bounds;
        const gridSectionOpt = {
            boundingBox,
        };
        if (this.apiRequestTimeout)
            clearTimeout(this.apiRequestTimeout);
        if (zoom && zoom < MIN_GRID_ZOOM_LEVEL) {
            this.clearGrid().catch(() => {
                // TODO: Add error logging
            });
        }
        this.apiRequestTimeout = setTimeout(() => {
            var _a;
            (_a = this.clients.gridSection) === null || _a === void 0 ? void 0 : _a.run(gridSectionOpt).then((grid) => {
                if (!this.provider)
                    return;
                this.provider.clearGrid();
                this.provider.plotGrid(grid, (coordinates) => {
                    this.coordinates_changed.emit(coordinates);
                });
            }).catch((_error) => {
                // TODO: Add error logging
            });
        }, 100);
    }
    onChangePosition(coordinates) {
        if (!this.provider)
            return;
        const zoom = this.provider.zoom;
        if (zoom && zoom < MIN_GRID_ZOOM_LEVEL) {
            this.provider.zoom = this.selected_zoom;
        }
        this.provider.panTo(coordinates);
        this.coordinates_changed.emit(coordinates);
    }
    onSelectedSuggestion(event) {
        var _a;
        const { detail: { suggestion: { words }, }, } = event;
        // convert coordinates to 3wa
        (_a = this.clients.convertToCoordinates) === null || _a === void 0 ? void 0 : _a.run({
            words,
        }).then(async (response) => {
            // pan to the selected coordinates and zoom to selected zoom if changed
            await this.panTo(response.coordinates);
            const zoom = await this.getZoom();
            if (this.reset_zoom_on_select && zoom !== this.selected_zoom) {
                // check and reset zoom level to default (selected_zoom)
                // NOTE: larger zoom value = higher resolution / zoom in
                await this.setZoom(this.selected_zoom);
            }
            // store detected language if changed
            if (response.language !== this.w3wLanguage) {
                this.w3wLanguage = response.language;
            }
            this.coordinates_changed.emit(response.coordinates);
        }).catch((error) => {
            // TODO: Clean up error type checking
            if (Object.prototype.hasOwnProperty.call(error, "message")) {
                this.__error.emit(error);
                console.error(error.message);
            }
            else if (Object.prototype.hasOwnProperty.call(error, "details")) {
                // manual type coercion based off @what3words/api/dist/lib/transport/error.d.ts
                const transportError = error;
                this.__error.emit(new ErrorEvent(transportError.details.message));
                console.error(transportError.details.message);
            }
        });
    }
    onCustomSelect(event) {
        if (!this.provider)
            return;
        const { id } = event.detail;
        this.provider
            .getCoordinatesFromPlace(id)
            .then((coordinates) => {
            if (!coordinates)
                return;
            if (!this.provider)
                return;
            const zoom = this.provider.zoom;
            if (zoom !== this.selected_zoom)
                this.zoom = this.selected_zoom;
            this.provider.panTo(coordinates);
            this.coordinates_changed.emit(coordinates);
        })
            .catch((error) => {
            this.__error.emit(new ErrorEvent("ServiceError", {
                message: DEFAULTS.serviceErrorMessage,
                error,
            }));
            return;
        });
    }
    onControlFocus() {
        if (this.input && /^(\/\/\/)?$/i.test(this.input.value)) {
            this.input.value = "";
        }
    }
    onValueValid() {
        if (this.apiRequestTimeout)
            clearTimeout(this.apiRequestTimeout);
        this.placesSuggestions = [];
    }
    onValueInvalid(e) {
        var _a;
        const { detail: { value }, } = e;
        if (this.apiRequestTimeout)
            clearTimeout(this.apiRequestTimeout);
        if (value.length > 3) {
            this.apiRequestTimeout = setTimeout(() => {
                var _a;
                if (!this.provider)
                    return;
                this.provider
                    .getPlacesSuggestions(value, (_a = this.current_location_coordinates) !== null && _a !== void 0 ? _a : undefined, this.language)
                    .then((placesSuggestions) => {
                    this.placesSuggestions = placesSuggestions;
                })
                    .catch((error) => {
                    this.__error.emit(new ErrorEvent("ServiceError", {
                        error,
                        message: DEFAULTS.serviceErrorMessage,
                    }));
                });
            }, (_a = this.autosuggest) === null || _a === void 0 ? void 0 : _a.typeahead_delay);
        }
    }
    setInputValue(words) {
        if (this.input) {
            this.input.value = "///" + words;
        }
    }
    createProvider() {
        const { map_provider } = this;
        switch (map_provider) {
            case "google":
            default:
                return new GoogleMaps();
        }
    }
    onProviderInit() {
        if (!this.provider)
            return;
        const { el } = this;
        this.searchControlSlot = el.querySelector(SEARCH_CONTROL_SELECTOR);
        this.currentLocationControlSlot = el.querySelector(CURRENT_LOCATION_CONTROL_SELECTOR);
        this.mapTypeControlSlot = el.querySelector(MAP_TYPE_CONTROL_SELECTOR);
        this.zoomControlSlot = el.querySelector(ZOOM_CONTROL_SELECTOR);
        this.autosuggest = this.searchControlSlot
            ? this.searchControlSlot.querySelector(AUTOSUGGEST_SELECTOR)
            : null;
        this.input = this.autosuggest
            ? this.autosuggest.querySelector(SELECTORS.input)
            : null;
        this.setMapLoaded(true);
        this.addMapEventListeners();
        this.addCurrentLocationEventListeners();
        this.provider.addControl(this.searchControlSlot, this.search_control_position);
        this.provider.addControl(this.currentLocationControlSlot, this.current_location_control_position);
        this.provider.addControl(this.mapTypeControlSlot, this.map_type_control_position);
        this.provider.addControl(this.zoomControlSlot, this.zoom_control_position);
        this.setupAutosuggest();
        this.addAutosuggestEventListeners();
        this.provider.addEventListener("loaded", this.__load.emit.bind(this), {
            once: true,
        });
    }
    getComponentHeaders() {
        const { current_location, disable_default_ui, map_type_control, map_type_id, street_view_control, watch_location, } = this;
        const component_session_id = window.what3words_session_id;
        const meta = JSON.stringify({
            current_location,
            component_session_id,
            disable_default_ui,
            map_type_control,
            map_type_id,
            origin: window.location.origin,
            street_view_control,
            watch_location,
        });
        return {
            "X-W3W-AS-Component": `what3words-Map-JS/${version} (${meta})`,
        };
    }
    connectedCallback() {
        const { el, lat, lng } = this;
        // Prop validations
        const coordinates = this.validateCoordinates({ lat, lng });
        this.lat = coordinates.lat;
        this.lng = coordinates.lng;
        // Initialise provider
        const mapDiv = el.querySelector(MAP_SELECTOR);
        this.searchControlSlot = el.querySelector(SEARCH_CONTROL_SELECTOR);
        this.provider = this.createProvider();
        if (this.mapLoaded)
            this.provider.destroy(); // Do not re-initialise if map already loaded, just re-attach listeners, controls etc.
        if (!mapDiv)
            return;
        this.provider.init(mapDiv, {
            version: this.version,
            api_key: this.map_api_key,
            libraries: this.libraries,
            language: this.language,
            region: this.region,
            center: { lat: this.lat, lng: this.lng },
            tilt: this.tilt,
            disable_default_ui: this.disable_default_ui,
            zoom: this.zoom,
            zoom_control: this.zoom_control,
            zoom_control_position: this.zoom_control_position,
            map_type_id: this.map_type_id,
            map_type_control: this.map_type_control,
            map_type_control_position: this.map_type_control_position,
            scale_control: this.scale_control,
            street_view_control: this.street_view_control,
            street_view_control_position: this.street_view_control_position,
            rotate_control: this.rotate_control,
            rotate_control_position: this.rotate_control_position,
            fullscreen_control: this.fullscreen_control,
            fullscreen_control_position: this.fullscreen_control_position,
        }, this.onProviderInit.bind(this));
        // Configure service clients
        const componentHeaders = this.getComponentHeaders();
        const headers = Object.assign(Object.assign({}, componentHeaders), (typeof this.headers === "string"
            ? JSON.parse(this.headers)
            : this.headers));
        const config = {
            apiVersion: this.api_version,
            headers,
            host: this.base_url,
        };
        const transport = fetchTransport();
        this.clients = {
            convertToCoordinates: what3wordsClients.convertToCoordinates(this.api_key, config, transport),
            convertTo3wa: what3wordsClients.convertTo3wa(this.api_key, config, transport),
            gridSection: what3wordsClients.gridSection(this.api_key, config, transport),
        };
    }
    disconnectedCallback() {
        var _a;
        this.removeAutosuggestEventListeners();
        this.removeMapEventListeners();
        this.removeCurrentLocationEventListeners();
        this.clearWatchPosition();
        (_a = this.provider) === null || _a === void 0 ? void 0 : _a.destroy();
    }
    render() {
        const controlsWrapperStyle = {
            visibility: this.mapLoaded ? "visible" : "hidden",
        };
        const controlsWrapperAttributes = {
            "aria-hidden": this.mapLoaded ? "false" : "true",
            style: controlsWrapperStyle,
        };
        return (h(Host, { key: '762c2fce04720bd0c394570f7a660a43c4abb400' }, h("slot", { key: '2f00c593b35d5c476737cf269a7d9659d17d9bd2', name: "map" }), h("div", Object.assign({ key: '7b40ab724034f61140673873a0aff3bede52702c', id: "controls-wrapper", "data-testid": "controls-wrapper" }, controlsWrapperAttributes), h("slot", { key: '6bf48944766b0f97992b59f40dc41f35e2b27889', name: "search-control" }), h("slot", { key: 'a03e186f7bba3c6616ee9b9ad518ff65a734cdd6', name: "map-type-control" }), h("slot", { key: '04cf2c2471d5b9d1a1de5bd31f1ed8a50c8b77a1', name: "zoom-control" }), h("slot", { key: 'b39844002c09cf20bd5bb484687f949642b21eae', name: "current-location-control" }))));
    }
    static get is() { return "what3words-map"; }
    static get originalStyleUrls() {
        return {
            "$": ["what3words-map.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["what3words-map.css"]
        };
    }
    static get properties() {
        return {
            "api_key": {
                "type": "string",
                "attribute": "api_key",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.emptyString"
            },
            "headers": {
                "type": "string",
                "attribute": "headers",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.headers"
            },
            "base_url": {
                "type": "string",
                "attribute": "base_url",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "sdk.api.clients.gridSection[\"_config\"].host ?? DEFAULTS.base_url"
            },
            "api_version": {
                "type": "string",
                "attribute": "api_version",
                "mutable": false,
                "complexType": {
                    "original": "ApiVersion",
                    "resolved": "ApiVersion.Version1 | ApiVersion.Version2 | ApiVersion.Version3",
                    "references": {
                        "ApiVersion": {
                            "location": "import",
                            "path": "@what3words/api",
                            "id": "../../../node_modules/@what3words/api/dist/index.d.ts::ApiVersion"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "ApiVersion.Version3"
            },
            "words": {
                "type": "string",
                "attribute": "words",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The three word address to load after initial map render. If empty, map will remain at the provided/default lat, lng values"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.emptyString"
            },
            "map_provider": {
                "type": "string",
                "attribute": "map_provider",
                "mutable": false,
                "complexType": {
                    "original": "MapProviderName",
                    "resolved": "\"google\"",
                    "references": {
                        "MapProviderName": {
                            "location": "import",
                            "path": "./domain",
                            "id": "src/components/what3words-map/domain.ts::MapProviderName"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "\"google\""
            },
            "map_api_key": {
                "type": "string",
                "attribute": "map_api_key",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.emptyString"
            },
            "version": {
                "type": "string",
                "attribute": "version",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "\"weekly\""
            },
            "libraries": {
                "type": "unknown",
                "attribute": "libraries",
                "mutable": false,
                "complexType": {
                    "original": "GoogleMapsLibraries",
                    "resolved": "(\"drawing\" | \"geometry\" | \"places\" | \"visualization\")[]",
                    "references": {
                        "GoogleMapsLibraries": {
                            "location": "import",
                            "path": "./domain",
                            "id": "src/components/what3words-map/domain.ts::GoogleMapsLibraries"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            },
            "language": {
                "type": "string",
                "attribute": "language",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Passed to the maps provider sdk. Also used as the default w3w language.\nCross-compatible language support is not guaranteed between the map provider and w3w sdks.\nw3w language default behavior can be overridden by setting the what3words-autosuggest language prop to a supported language.\nSee https://developers.google.com/maps/faq#languagesupport\nSee https://developer.what3words.com/public-api/docs#available-languages"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "\"en\""
            },
            "region": {
                "type": "string",
                "attribute": "region",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "\"GB\""
            },
            "lat": {
                "type": "number",
                "attribute": "lat",
                "mutable": true,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Latitude value used on initial map render. Defaults to What3Words HQ latitude."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.center.lat"
            },
            "lng": {
                "type": "number",
                "attribute": "lng",
                "mutable": true,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Longitude value used on initial map render. Defaults to What3Words HQ longitude."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "DEFAULTS.center.lng"
            },
            "tilt": {
                "type": "number",
                "attribute": "tilt",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "disable_default_ui": {
                "type": "boolean",
                "attribute": "disable_default_ui",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "zoom": {
                "type": "number",
                "attribute": "zoom",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "8"
            },
            "zoom_control": {
                "type": "boolean",
                "attribute": "zoom_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "zoom_control_position": {
                "type": "number",
                "attribute": "zoom_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "map_type_id": {
                "type": "string",
                "attribute": "map_type_id",
                "mutable": false,
                "complexType": {
                    "original": "ViewType",
                    "resolved": "\"hybrid\" | \"road\" | \"satellite\" | \"terrain\" | undefined",
                    "references": {
                        "ViewType": {
                            "location": "import",
                            "path": "./providers/abstract",
                            "id": "src/components/what3words-map/providers/abstract.ts::ViewType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "map_type_control": {
                "type": "boolean",
                "attribute": "map_type_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "map_type_control_position": {
                "type": "number",
                "attribute": "map_type_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "scale_control": {
                "type": "boolean",
                "attribute": "scale_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "street_view_control": {
                "type": "boolean",
                "attribute": "street_view_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "street_view_control_position": {
                "type": "number",
                "attribute": "street_view_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "rotate_control": {
                "type": "boolean",
                "attribute": "rotate_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "rotate_control_position": {
                "type": "number",
                "attribute": "rotate_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "fullscreen_control": {
                "type": "boolean",
                "attribute": "fullscreen_control",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "fullscreen_control_position": {
                "type": "number",
                "attribute": "fullscreen_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "search_control_position": {
                "type": "number",
                "attribute": "search_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "TOP_LEFT"
            },
            "current_location_control_position": {
                "type": "number",
                "attribute": "current_location_control_position",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "0"
            },
            "selected_zoom": {
                "type": "number",
                "attribute": "selected_zoom",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "SELECTED_ZOOM_LEVEL"
            },
            "current_location": {
                "type": "boolean",
                "attribute": "current_location",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "watch_location": {
                "type": "boolean",
                "attribute": "watch_location",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "marker_icon": {
                "type": "string",
                "attribute": "marker_icon",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "MARKER_SRC"
            },
            "reset_zoom_on_select": {
                "type": "boolean",
                "attribute": "reset_zoom_on_select",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean | undefined",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Reset map level zoom to selected_zoom after panning to user-selected autosuggest suggestion"
                },
                "getter": false,
                "setter": false,
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "searchControlSlot": {},
            "currentLocationControlSlot": {},
            "zoomControlSlot": {},
            "mapTypeControlSlot": {},
            "mapLoaded": {},
            "input": {},
            "autosuggest": {},
            "placesSuggestions": {},
            "apiRequestTimeout": {},
            "watch_id": {},
            "provider": {},
            "current_location_coordinates": {},
            "w3wLanguage": {},
            "clients": {}
        };
    }
    static get events() {
        return [{
                "method": "selected_square",
                "name": "selected_square",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "ThreeWordAddress",
                    "resolved": "ThreeWordAddress",
                    "references": {
                        "ThreeWordAddress": {
                            "location": "import",
                            "path": "./domain",
                            "id": "src/components/what3words-map/domain.ts::ThreeWordAddress"
                        }
                    }
                }
            }, {
                "method": "coordinates_changed",
                "name": "coordinates_changed",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "Coordinates",
                    "resolved": "Coordinates",
                    "references": {
                        "Coordinates": {
                            "location": "import",
                            "path": "@what3words/api",
                            "id": "../../../node_modules/@what3words/api/dist/index.d.ts::Coordinates"
                        }
                    }
                }
            }, {
                "method": "__load",
                "name": "__load",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }, {
                "method": "__error",
                "name": "__error",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "{ error: ErrorEvent }",
                    "resolved": "{ error: ErrorEvent; }",
                    "references": {
                        "ErrorEvent": {
                            "location": "global",
                            "id": "global::ErrorEvent"
                        }
                    }
                }
            }];
    }
    static get methods() {
        return {
            "setApiKey": {
                "complexType": {
                    "signature": "(key: string) => Promise<void>",
                    "parameters": [{
                            "name": "key",
                            "type": "string",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setBaseUrl": {
                "complexType": {
                    "signature": "(host: string) => Promise<void>",
                    "parameters": [{
                            "name": "host",
                            "type": "string",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setHeaders": {
                "complexType": {
                    "signature": "(value: string) => Promise<void>",
                    "parameters": [{
                            "name": "value",
                            "type": "string",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "Record": {
                            "location": "global",
                            "id": "global::Record"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setApiVersion": {
                "complexType": {
                    "signature": "(api_version: ApiVersion) => Promise<void>",
                    "parameters": [{
                            "name": "api_version",
                            "type": "ApiVersion",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "ApiVersion": {
                            "location": "import",
                            "path": "@what3words/api",
                            "id": "../../../node_modules/@what3words/api/dist/index.d.ts::ApiVersion"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setWords": {
                "complexType": {
                    "signature": "(words: string) => Promise<void>",
                    "parameters": [{
                            "name": "words",
                            "type": "string",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "LocationJsonResponse": {
                            "location": "import",
                            "path": "@what3words/api",
                            "id": "../../../node_modules/@what3words/api/dist/index.d.ts::LocationJsonResponse"
                        },
                        "ErrorEvent": {
                            "location": "global",
                            "id": "global::ErrorEvent"
                        },
                        "Record": {
                            "location": "global",
                            "id": "global::Record"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "clearGrid": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "getLat": {
                "complexType": {
                    "signature": "() => Promise<number | undefined>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<number | undefined>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setCoordinates": {
                "complexType": {
                    "signature": "(newCoordinateValue: number, _oldCoordinateValue: number, propName: string) => Promise<void>",
                    "parameters": [{
                            "name": "newCoordinateValue",
                            "type": "number",
                            "docs": ""
                        }, {
                            "name": "_oldCoordinateValue",
                            "type": "number",
                            "docs": ""
                        }, {
                            "name": "propName",
                            "type": "string",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "getLng": {
                "complexType": {
                    "signature": "() => Promise<number | undefined>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<number | undefined>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setZoom": {
                "complexType": {
                    "signature": "(zoom: number) => Promise<void>",
                    "parameters": [{
                            "name": "zoom",
                            "type": "number",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "getZoom": {
                "complexType": {
                    "signature": "() => Promise<number | undefined>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<number | undefined>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "getBounds": {
                "complexType": {
                    "signature": "() => Promise<google.maps.LatLngBoundsLiteral>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "google": {
                            "location": "global",
                            "id": "global::google"
                        }
                    },
                    "return": "Promise<LatLngBoundsLiteral>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "panTo": {
                "complexType": {
                    "signature": "(coordinates: Coordinates) => Promise<void>",
                    "parameters": [{
                            "name": "coordinates",
                            "type": "Coordinates",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "Coordinates": {
                            "location": "import",
                            "path": "@what3words/api",
                            "id": "../../../node_modules/@what3words/api/dist/index.d.ts::Coordinates"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "setMapTypeId": {
                "complexType": {
                    "signature": "(map_type_id: ViewType) => Promise<void>",
                    "parameters": [{
                            "name": "map_type_id",
                            "type": "\"road\" | \"hybrid\" | \"satellite\" | \"terrain\"",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "ViewType": {
                            "location": "import",
                            "path": "./providers/abstract",
                            "id": "src/components/what3words-map/providers/abstract.ts::ViewType"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "api_key",
                "methodName": "setApiKey"
            }, {
                "propName": "base_url",
                "methodName": "setBaseUrl"
            }, {
                "propName": "headers",
                "methodName": "setHeaders"
            }, {
                "propName": "api_version",
                "methodName": "setApiVersion"
            }, {
                "propName": "words",
                "methodName": "setWords"
            }, {
                "propName": "lng",
                "methodName": "setCoordinates"
            }, {
                "propName": "lat",
                "methodName": "setCoordinates"
            }, {
                "propName": "zoom",
                "methodName": "setZoom"
            }, {
                "propName": "map_type_id",
                "methodName": "setMapTypeId"
            }, {
                "propName": "search_control_position",
                "methodName": "setSearchControlPosition"
            }, {
                "propName": "current_location_control_position",
                "methodName": "setCurrentLocationControlPosition"
            }, {
                "propName": "map_type_control_position",
                "methodName": "setMapTypeControlPosition"
            }, {
                "propName": "zoom_control_position",
                "methodName": "setZoomControlPosition"
            }, {
                "propName": "fullscreen_control_position",
                "methodName": "setFullscreenControlPosition"
            }, {
                "propName": "street_view_control_position",
                "methodName": "setStreetViewControlPosition"
            }, {
                "propName": "rotate_control_position",
                "methodName": "setRotateControlPosition"
            }, {
                "propName": "placesSuggestions",
                "methodName": "handlePlacesSuggestions"
            }, {
                "propName": "version",
                "methodName": "watchMapVersion"
            }, {
                "propName": "map_api_key",
                "methodName": "watchMapApiKey"
            }, {
                "propName": "libraries",
                "methodName": "watchMapLibraries"
            }, {
                "propName": "language",
                "methodName": "watchMapLanguage"
            }, {
                "propName": "region",
                "methodName": "watchMapRegion"
            }];
    }
    static get listeners() {
        return [{
                "name": "__load",
                "method": "onLoad",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "coordinates_changed",
                "method": "onSelectedCoordinates",
                "target": undefined,
                "capture": true,
                "passive": true
            }];
    }
}
