@mapbox/search-js-web
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
1782
dist/index.d.ts
@@ -1,1771 +0,11 @@ | ||
// Generated by dts-bundle-generator v5.9.0 | ||
/// <reference types="geojson" /> | ||
/// <reference types="mapbox-gl" /> | ||
/// <reference types="node" /> | ||
/// <reference types="react" /> | ||
declare class LngLat { | ||
/** | ||
* @name lng | ||
* @instance | ||
* @memberof LngLat | ||
*/ | ||
readonly lng: number; | ||
/** | ||
* @name lat | ||
* @instance | ||
* @memberof LngLat | ||
*/ | ||
readonly lat: number; | ||
constructor(lng: number, lat: number); | ||
/** | ||
* Returns the coordinates represented as an array of two numbers. | ||
* | ||
* @returns The coordinates represeted as an array of longitude and latitude. | ||
* @example | ||
* ```typescript | ||
* const ll = new LngLat(-73.9749, 40.7736); | ||
* ll.toArray(); // = [-73.9749, 40.7736] | ||
* ``` | ||
*/ | ||
toArray(): [ | ||
number, | ||
number | ||
]; | ||
/** | ||
* Returns the coordinates represent as a string. | ||
* | ||
* @returns The coordinates represented as a string of the format `'LngLat(lng, lat)'`. | ||
* @example | ||
* ```typescript | ||
* const ll = new LngLat(-73.9749, 40.7736); | ||
* ll.toString(); // = "LngLat(-73.9749, 40.7736)" | ||
* ``` | ||
*/ | ||
toString(): string; | ||
/** | ||
* Converts an array of two numbers or an object with `lng` and `lat` or `lon` and `lat` properties | ||
* to a `LngLat` object. | ||
* | ||
* If a `LngLat` object is passed in, the function returns a copy. | ||
* | ||
* @param input - An array of two numbers or object to convert, or a `LngLat` object to return. | ||
* @returns A new `LngLat` object, if a conversion occurred, or the original `LngLat` object. | ||
* @example | ||
* ```typescript | ||
* const arr = [-73.9749, 40.7736]; | ||
* const ll = LngLat.convert(arr); | ||
* console.log(ll); // = LngLat {lng: -73.9749, lat: 40.7736} | ||
* ``` | ||
*/ | ||
static convert(input: LngLat | { | ||
lng: number; | ||
lat: number; | ||
} | { | ||
lon: number; | ||
lat: number; | ||
} | [ | ||
number, | ||
number | ||
]): LngLat; | ||
} | ||
/** | ||
* A {@link LngLat} object, an array of two numbers representing longitude and latitude, | ||
* or an object with `lng` and `lat` or `lon` and `lat` properties. | ||
* | ||
* @typedef LngLatLike | ||
* @type {LngLat | [number, number] | { lng: number, lat: number } | { lon: number, lat: number }} | ||
* @example | ||
* ```typescript | ||
* const v1 = new LngLat(-122.420679, 37.772537); | ||
* const v2 = [-122.420679, 37.772537]; | ||
* const v3 = {lon: -122.420679, lat: 37.772537}; | ||
* ``` | ||
*/ | ||
export declare type LngLatLike = LngLat | { | ||
lng: number; | ||
lat: number; | ||
} | { | ||
lon: number; | ||
lat: number; | ||
} | [ | ||
number, | ||
number | ||
]; | ||
declare class LngLatBounds { | ||
private _ne; | ||
private _sw; | ||
/** | ||
* @param sw - The southwest corner of the bounding box. | ||
* @param ne - The northeast corner of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const sw = new LngLat(-73.9876, 40.7661); | ||
* const ne = new LngLat(-73.9397, 40.8002); | ||
* const llb = new LngLatBounds(sw, ne); | ||
* ``` | ||
*/ | ||
constructor(sw: LngLatLike, ne: LngLatLike); | ||
/** | ||
* Returns the southwest corner of the bounding box. | ||
* | ||
* @returns The southwest corner of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getSouthWest(); // LngLat {lng: -73.9876, lat: 40.7661} | ||
* ``` | ||
*/ | ||
getSouthWest(): LngLat; | ||
/** | ||
* Returns the northeast corner of the bounding box. | ||
* | ||
* @returns The northeast corner of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getNorthEast(); // LngLat {lng: -73.9397, lat: 40.8002} | ||
* ``` | ||
*/ | ||
getNorthEast(): LngLat; | ||
/** | ||
* Returns the northwest corner of the bounding box. This is commonly used | ||
* as the 'min' point in the bounding box. | ||
* | ||
* @returns The northwest corner of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getNorthWest(); // LngLat {lng: -73.9876, lat: 40.8002} | ||
* ``` | ||
*/ | ||
getNorthWest(): LngLat; | ||
/** | ||
* Returns the southeast corner of the bounding box. This is commonly used | ||
* as the 'max' point in the bounding box. | ||
* | ||
* @returns The southeast corner of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getSouthEast(); // LngLat {lng: -73.9397, lat: 40.7661} | ||
* ``` | ||
*/ | ||
getSouthEast(): LngLat; | ||
/** | ||
* Returns the west edge of the bounding box. | ||
* | ||
* @returns The west edge of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getWest(); // -73.9876 | ||
* ``` | ||
*/ | ||
getWest(): number; | ||
/** | ||
* Returns the south edge of the bounding box. | ||
* | ||
* @returns The south edge of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getSouth(); // 40.7661 | ||
* ``` | ||
*/ | ||
getSouth(): number; | ||
/** | ||
* Returns the east edge of the bounding box. | ||
* | ||
* @returns The east edge of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getEast(); // -73.9397 | ||
* ``` | ||
*/ | ||
getEast(): number; | ||
/** | ||
* Returns the north edge of the bounding box. | ||
* | ||
* @returns The north edge of the bounding box. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.getNorth(); // 40.8002 | ||
* ``` | ||
*/ | ||
getNorth(): number; | ||
/** | ||
* Returns the bounding box represented as an array. | ||
* | ||
* @returns The bounding box represented as an array, consisting of the | ||
* southwest and northeast coordinates of the bounding represented as arrays of numbers. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.toArray(); // = [[-73.9876, 40.7661], [-73.9397, 40.8002]] | ||
* ``` | ||
*/ | ||
toArray(): [ | ||
[ | ||
number, | ||
number | ||
], | ||
[ | ||
number, | ||
number | ||
] | ||
]; | ||
/** | ||
* Returns the bounding box represented as a flattened array. | ||
* | ||
* @returns The bounding box represented as an array of numbers in [west, south, east, north] order. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.toFlatArray(); // = [-73.9876, 40.7661, -73.9397, 40.8002] | ||
* ``` | ||
*/ | ||
toFlatArray(): [ | ||
number, | ||
number, | ||
number, | ||
number | ||
]; | ||
/** | ||
* Return the bounding box represented as a string. | ||
* | ||
* @returns The bounding box represents as a string of the format | ||
* `'LngLatBounds(LngLat(lng, lat), LngLat(lng, lat))'`. | ||
* @example | ||
* ```typescript | ||
* const llb = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* llb.toString(); // = "LngLatBounds(LngLat(-73.9876, 40.7661), LngLat(-73.9397, 40.8002))" | ||
* ``` | ||
*/ | ||
toString(): string; | ||
/** | ||
* Converts an array to a `LngLatBounds` object. | ||
* | ||
* If a `LngLatBounds` object is passed in, the function returns a copy. | ||
* | ||
* Internally, the function calls `LngLat#convert` to convert arrays to `LngLat` values. | ||
* | ||
* @param input - An array of two coordinates to convert, or a `LngLatBounds` object to return. | ||
* @returns A new `LngLatBounds` object, if a conversion occurred, or the original `LngLatBounds` object. | ||
* @example | ||
* ```typescript | ||
* const arr = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; | ||
* const llb = LngLatBounds.convert(arr); | ||
* console.log(llb); // = LngLatBounds {_sw: LngLat {lng: -73.9876, lat: 40.7661}, _ne: LngLat {lng: -73.9397, lat: 40.8002}} | ||
* ``` | ||
*/ | ||
static convert(input: LngLatBounds | [ | ||
LngLatLike, | ||
LngLatLike | ||
] | [ | ||
number, | ||
number, | ||
number, | ||
number | ||
]): LngLatBounds; | ||
} | ||
/** | ||
* A {@link LngLatBounds} object, an array of {@link LngLatLike} objects in [sw, ne] order, | ||
* or an array of numbers in [west, south, east, north] order. | ||
* | ||
* @typedef LngLatBoundsLike | ||
* @type {LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number]} | ||
* @example | ||
* ```typescript | ||
* const v1 = new LngLatBounds( | ||
* new LngLat(-73.9876, 40.7661), | ||
* new LngLat(-73.9397, 40.8002) | ||
* ); | ||
* const v2 = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]); | ||
* const v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]]; | ||
* ``` | ||
*/ | ||
export declare type LngLatBoundsLike = LngLatBounds | [ | ||
LngLatLike, | ||
LngLatLike | ||
] | [ | ||
number, | ||
number, | ||
number, | ||
number | ||
]; | ||
/** | ||
* Administrative unit types for the [Mapbox Search API](https://docs.mapbox.com/api/search/search/). | ||
* | ||
* @typedef AdministrativeUnitTypes | ||
* @see https://docs.mapbox.com/api/search/search/#administrative-unit-types | ||
*/ | ||
export declare type AdministrativeUnitTypes = "country" | "region" | "prefecture" | "postcode" | "district" | "place" | "city" | "locality" | "oaza" | "neighborhood" | "chome" | "block" | "street" | "address"; | ||
export interface SuggestionJSONAction { | ||
/** | ||
* The endpoint to point the next request to. The current options are suggest and retrieve. | ||
* | ||
* The `suggest` call is used when the API determines the next best option is another round of suggestions. | ||
* | ||
* The `retrieve` call is used when the API determines it understands what feature the user is looking for | ||
* and that the user is ready for the geographic coordinates of the results. | ||
*/ | ||
endpoint: "suggest" | "retrieve"; | ||
/** | ||
* The type of HTTP methods that are allowed for the next request. Options are `POST` or, less commonly, `GET`. | ||
*/ | ||
method: "POST" | "GET"; | ||
/** | ||
* The JSON body to pass in the actionable request. | ||
*/ | ||
body: unknown; | ||
/** | ||
* Indicates whether the feature can be fetched as part of a batch retrieve. Not applicable during the public beta phase. | ||
*/ | ||
multi_retrievable?: boolean; | ||
} | ||
/** | ||
* Raw JSON form of a suggestion result's "context" from the [Mapbox Search API](https://docs.mapbox.com/api/search/search/). | ||
* | ||
* Reference: | ||
* https://docs.mapbox.com/api/search/search/#response-retrieve-a-suggestion | ||
*/ | ||
export interface SuggestionJSONContext { | ||
layer: string; | ||
localized_layer: string; | ||
name: string; | ||
} | ||
/** | ||
* A `Suggestion` object represents a suggestion result from the [Mapbox Search API](https://docs.mapbox.com/api/search/search/). | ||
* | ||
* Suggestion objects are "part one" of the two-step interactive search experience, and include useful information about the result, | ||
* such as: {@link Suggestion#feature_name}, {@link Suggestion#description}, and {@link Suggestion#maki}. | ||
* | ||
* Suggestion objects do not include geographic coordinates. To get the coordinates of the result, use {@link MapboxSearch#retrieve}. | ||
* It may be useful to call {@link MapboxSearch#canRetrieve} before calling this method, as the suggestion may be a reference to | ||
* another suggest query. This can also be tested with {@link MapboxSearch#canSuggest}, and called with {@link MapboxSearch#suggest}. | ||
* | ||
* For tracking purposes, it is useful for any follow-up requests based on this suggestion to include same | ||
* {@link SessionToken} as the original request. | ||
* | ||
* Reference: | ||
* https://docs.mapbox.com/api/search/search/#response-retrieve-a-suggestion | ||
* | ||
* @typedef Suggestion | ||
* @example | ||
* ```typescript | ||
* const search = new MapboxSearch({ accessToken: 'pk.my-mapbox-access-token' }); | ||
* | ||
* const sessionToken = new SessionToken(); | ||
* const result = await search.suggest('Washington D.C.', { sessionToken }); | ||
* if (result.suggestions.length === 0) return; | ||
* | ||
* const suggestion = result.suggestions[0]; | ||
* if (search.canRetrieve(suggestion)) { | ||
* const { features } = await search.retrieve(suggestion, { sessionToken }); | ||
* doSomethingWithCoordinates(features); | ||
* } else if (search.canSuggest(suggestion)) { | ||
* // .. go through suggest flow again .. | ||
* } | ||
* ``` | ||
*/ | ||
export interface Suggestion { | ||
/** | ||
* The name of the feature. | ||
*/ | ||
feature_name: string; | ||
/** | ||
* The feature name, as matched by the search algorithm. | ||
*/ | ||
matching_name: string; | ||
/** | ||
* Additional details, such as city and state for addresses. | ||
*/ | ||
description: string; | ||
/** | ||
* The name of the [Maki](https://labs.mapbox.com/maki-icons/) icon associated with the feature. | ||
*/ | ||
maki?: string; | ||
/** | ||
* For results with an address, the locally formatted address. | ||
*/ | ||
address?: string; | ||
/** | ||
* The house number for address objects. | ||
*/ | ||
address_number?: string; | ||
/** | ||
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the feature. | ||
*/ | ||
language: string; | ||
/** | ||
* The type of result using the global context hierarchy (region, place, locality, neighborhood, address). | ||
* | ||
* @see {@link AdministrativeUnitTypes} | ||
*/ | ||
result_type?: AdministrativeUnitTypes[]; | ||
/** | ||
* Action block of the suggestion result. | ||
* "body" is an opaque object. | ||
* | ||
* Reference: https://docs.mapbox.com/api/search/search/#response-retrieve-a-suggestion | ||
*/ | ||
action?: SuggestionJSONAction; | ||
/** | ||
* A list of category IDs that the feature belongs to. | ||
*/ | ||
category?: string[]; | ||
internal_id?: string; | ||
external_ids?: { | ||
federated: string; | ||
mbx_poi?: string; | ||
foursquare?: string; | ||
[name: string]: string | undefined; | ||
}; | ||
mapbox_id?: string; | ||
/** | ||
* Address context fields of the feature. | ||
*/ | ||
context: SuggestionJSONContext[]; | ||
/** | ||
* Address metadata fields of the feature. | ||
*/ | ||
metadata: { | ||
[key: string]: string; | ||
}; | ||
} | ||
/** | ||
* Raw [GeoJSON](https://docs.mapbox.com/help/glossary/geojson/) feature properties | ||
* from the [Mapbox Search API](https://docs.mapbox.com/api/search/search/). | ||
* | ||
* Reference: | ||
* https://docs.mapbox.com/api/search/search/#response-forward-geocoding | ||
* | ||
* @typedef SearchFeatureProperties | ||
* @see {@link Suggestion} | ||
*/ | ||
export interface SearchFeatureProperties extends Suggestion { | ||
/** | ||
* ID of the feature. | ||
*/ | ||
id: string; | ||
/** | ||
* The name of the place. | ||
*/ | ||
place_name?: string; | ||
/** | ||
* The type of place using the global context hierarchy (region, place, locality, neighborhood, address). | ||
* | ||
* @see {@link AdministrativeUnitTypes} | ||
*/ | ||
place_type?: AdministrativeUnitTypes[]; | ||
} | ||
/** | ||
* A `FeatureSuggestion` object represents a [GeoJSON](https://docs.mapbox.com/help/glossary/geojson/) suggestion result from the [Mapbox Search API](https://docs.mapbox.com/api/search/search/). | ||
* | ||
* Feature suggestions are "part two" of the two-step interactive search experience and includes geographic coordinates. Multiple feature suggestions may be returned from a single search query, | ||
* for example in an airport with multiple terminals. | ||
* | ||
* As per the [Mapbox Search API](https://docs.mapbox.com/api/search/search/), this will always be | ||
* [Point](https://geojson.org/geojson-spec.html#point). | ||
* | ||
* **Legal terms:** | ||
* | ||
* Due to legal terms from our data sources, feature suggestions from the [Mapbox Search API](https://docs.mapbox.com/api/search/search/) should come from the `permanentForward` & `permanentReverse` | ||
* methods if the results are to be cached/stored in a customer database. Otherwise, results should be used ephemerally and not persisted. | ||
* | ||
* This permanent policy is consistent with the [Mapbox Terms of Service](https://www.mapbox.com/tos/) and failure to comply | ||
* may result in modified or discontinued service. | ||
* | ||
* Additionally, the [Mapbox Terms of Service](https://www.mapbox.com/tos/) states any rendering of a feature suggestion | ||
* must be using Mapbox map services (for example, displaying results on Google Maps or MapKit JS is not allowed). | ||
* | ||
* **Disclaimer:** | ||
* | ||
* The failure of Mapbox to exercise or enforce any right or provision of these Terms will not constitute a waiver of such right or provision. | ||
* | ||
* @typedef FeatureSuggestion | ||
* @example | ||
* ```typescript | ||
* const featureSuggestion = { | ||
* type: 'Feature', | ||
* geometry: { | ||
* type: 'Point', | ||
* coordinates: [0,0] | ||
* }, | ||
* properties: { | ||
* feature_name: 'Washington D.C.', | ||
* } | ||
* }; | ||
* ``` | ||
* @see [Response: Forward geocoding](https://docs.mapbox.com/api/search/search/#response-forward-geocoding) | ||
*/ | ||
export declare type FeatureSuggestion = GeoJSON.Feature<GeoJSON.Point, SearchFeatureProperties> & { | ||
/** | ||
* A bounding box for the feature. This may be significantly | ||
* larger than the geometry. | ||
*/ | ||
bbox?: LngLatBoundsLike; | ||
}; | ||
/** | ||
* @typedef Options | ||
*/ | ||
export interface Options { | ||
/** | ||
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) to be returned. | ||
* | ||
* If not specified, `en` will be used. | ||
*/ | ||
language: string; | ||
/** | ||
* An [ISO 3166 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) to be returned. | ||
* | ||
* If not specified, results will not be filtered by country. | ||
*/ | ||
country: string; | ||
/** | ||
* Limit results to only those contained within the supplied bounding box. | ||
*/ | ||
bbox: string | LngLatBoundsLike; | ||
/** | ||
* The number of results to return, up to `10`. | ||
*/ | ||
limit: string | number; | ||
/** | ||
* The navigation routing profile to use for distance/eta calculations. | ||
* | ||
* For distance calculations, both {@link Options#navigation_profile} and | ||
* {@link Options#origin} must be specified. | ||
* | ||
* For ETA calculations: {@link Options#navigation_profile}, | ||
* {@link Options#origin}, and {@link Options#eta_type} must be specified. | ||
*/ | ||
navigation_profile?: "driving" | "walking" | "cycling"; | ||
/** | ||
* The location from which to calculate distance. **This parameter may incur additional latency.** | ||
* | ||
* When both {@link Options#proximity} and {@link Options#origin} are specified, `origin` is interpreted as the | ||
* target of a route, while `proximity` indicates the current user location. | ||
* | ||
* For distance calculations, both {@link Options#navigation_profile} and | ||
* {@link Options#origin} must be specified. | ||
* | ||
* For ETA calculations: {@link Options#navigation_profile}, | ||
* {@link Options#origin}, and {@link Options#eta_type} must be specified. | ||
*/ | ||
origin: string | LngLatLike; | ||
/** | ||
* Bias the response to favor results that are closer to this location. | ||
* | ||
* When both {@link Options#proximity} and {@link Options#origin} are specified, `origin` is interpreted as the | ||
* target of a route, while `proximity` indicates the current user location. | ||
*/ | ||
proximity: string | LngLatLike; | ||
/** | ||
* Used to estimate the time of arrival from {@link Options#origin}. **This parameter may incur additional latency.** | ||
* | ||
* For ETA calculations: {@link Options#navigation_profile}, | ||
* {@link Options#origin}, and {@link Options#eta_type} must be specified. | ||
*/ | ||
eta_type?: "navigation"; | ||
/** | ||
* Limit results to one or more types of features. If no types are specified, all possible types may be returned. | ||
* | ||
* Reference: | ||
* https://docs.mapbox.com/api/search/search/#administrative-unit-types | ||
*/ | ||
types?: string | Set<AdministrativeUnitTypes>; | ||
} | ||
/** | ||
* @typedef SuggestionResponse | ||
*/ | ||
export interface SuggestionResponse { | ||
/** | ||
* The attribution data for results. | ||
*/ | ||
attribution?: string; | ||
/** | ||
* The returned suggestion objects. | ||
* | ||
* @see {@link Suggestion} | ||
*/ | ||
suggestions: Suggestion[]; | ||
} | ||
/** | ||
* @typedef RetrieveResponse | ||
*/ | ||
export interface RetrieveResponse { | ||
type: "FeatureCollection"; | ||
/** | ||
* The attribution data for results. | ||
*/ | ||
attribution?: string; | ||
/** | ||
* The returned feature objects. | ||
* | ||
* @see {@link FeatureSuggestion} | ||
*/ | ||
features: FeatureSuggestion[]; | ||
} | ||
/** | ||
* An `AutofillSuggestion` object represents a suggestion | ||
* result from the Mapbox Autofill API. | ||
* | ||
* Suggestion objects are "part one" of the two-step interactive autofill experience. | ||
* Suggestion objects do not include geographic coordinates. | ||
* | ||
* To get the coordinates of the result, use {@link MapboxAutofill#retrieve}. | ||
* | ||
* For tracking purposes, it is useful for any follow-up requests based on this suggestion to include same | ||
* {@link SessionToken} as the original request. | ||
* | ||
* @typedef AutofillSuggestion | ||
* @example | ||
* ```typescript | ||
* const autofill = new MapboxAutofill({ accessToken: 'pk.my-mapbox-access-token' }); | ||
* | ||
* const sessionToken = new SessionToken(); | ||
* const result = await search.autofill('Washington D.C.', { sessionToken }); | ||
* if (result.suggestions.length === 0) return; | ||
* | ||
* const suggestion = result.suggestions[0]; | ||
* const { features } = await autofill.retrieve(suggestion, { sessionToken }); | ||
* doSomethingWithCoordinates(features); | ||
* ``` | ||
*/ | ||
export interface AutofillSuggestion { | ||
/** | ||
* This is added by {@link MapboxAutofill} and is **not** part of the | ||
* Autofill API. | ||
* | ||
* @ignore | ||
*/ | ||
original_search_text: string; | ||
/** | ||
* The name of the feature. | ||
*/ | ||
feature_name: string; | ||
/** | ||
* The feature name, as matched by the search algorithm. | ||
*/ | ||
matching_name: string; | ||
/** | ||
* Additional details, such as city and state for addresses. | ||
*/ | ||
description: string; | ||
/** | ||
* The name of the [Maki](https://labs.mapbox.com/maki-icons/) icon associated with the feature. | ||
*/ | ||
maki?: string; | ||
/** | ||
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the feature. | ||
*/ | ||
language: string; | ||
address?: string; | ||
/** | ||
* The full address of the suggestion. | ||
*/ | ||
full_address?: string; | ||
/** | ||
* Address line 1 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_line1?: string; | ||
/** | ||
* Address line 2 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_line2?: string; | ||
/** | ||
* Address line 3 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_line3?: string; | ||
/** | ||
* Address level 1 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_level1?: string; | ||
/** | ||
* Address level 2 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_level2?: string; | ||
/** | ||
* Address level 3 from the [WHATWG Autocomplete Specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill) | ||
*/ | ||
address_level3?: string; | ||
/** | ||
* Long form country name, for example: "United States" | ||
*/ | ||
country?: string; | ||
/** | ||
* Postal code. | ||
*/ | ||
postcode?: string; | ||
/** | ||
* Address metadata fields of the feature. | ||
* | ||
* Includes the short form country name, for example: "us". This follows the | ||
* [ISO 3166 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) specification. | ||
*/ | ||
metadata: { | ||
iso_3166_1: string; | ||
}; | ||
} | ||
/** | ||
* An `AutofillFeatureSuggestion` object represents [GeoJSON](https://docs.mapbox.com/help/glossary/geojson/) | ||
* suggestion results from the Mapbox Autofill API. | ||
* | ||
* As per the Mapbox Autofill API, this will always be [Point](https://geojson.org/geojson-spec.html#point). | ||
* | ||
* @typedef AutofillFeatureSuggestion | ||
* @example | ||
* ```typescript | ||
* const featureSuggestion = { | ||
* type: 'Feature', | ||
* geometry: { | ||
* type: 'Point', | ||
* coordinates: [0,0] | ||
* }, | ||
* properties: { | ||
* feature_name: 'Washington D.C.', | ||
* } | ||
* }; | ||
* ``` | ||
*/ | ||
export declare type AutofillFeatureSuggestion = GeoJSON.Feature<GeoJSON.Point, AutofillSuggestion> & { | ||
/** | ||
* A bounding box for the feature. This may be significantly | ||
* larger than the geometry. | ||
*/ | ||
bbox?: LngLatBoundsLike; | ||
}; | ||
/** | ||
* @typedef AutofillOptions | ||
*/ | ||
export interface AutofillOptions { | ||
/** | ||
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) to be returned. | ||
* | ||
* If not specified, `en` will be used. | ||
*/ | ||
language: string; | ||
/** | ||
* An [ISO 3166 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) to be returned. | ||
* | ||
* If not specified, results will not be filtered by country. | ||
*/ | ||
country: string; | ||
/** | ||
* Limit results to only those contained within the supplied bounding box. | ||
*/ | ||
bbox: string | LngLatBoundsLike; | ||
/** | ||
* The number of results to return, up to `10`. | ||
*/ | ||
limit: string | number; | ||
/** | ||
* Bias the response to favor results that are closer to this location. | ||
* | ||
* When both {@link AutofillOptions#proximity} and {@link AutofillOptions#origin} are specified, `origin` is interpreted as the | ||
* target of a route, while `proximity` indicates the current user location. | ||
*/ | ||
proximity: string | LngLatLike; | ||
} | ||
/** | ||
* @typedef AutofillSuggestionResponse | ||
*/ | ||
export interface AutofillSuggestionResponse { | ||
/** | ||
* The attribution data for results. | ||
*/ | ||
attribution?: string; | ||
/** | ||
* The returned suggestion objects. | ||
* | ||
* @see {@link Suggestion} | ||
*/ | ||
suggestions: AutofillSuggestion[]; | ||
} | ||
/** | ||
* @typedef AutofillRetrieveResponse | ||
*/ | ||
export interface AutofillRetrieveResponse { | ||
type: "FeatureCollection"; | ||
/** | ||
* The attribution data for results. | ||
*/ | ||
attribution?: string; | ||
/** | ||
* The returned feature objects. | ||
* | ||
* @see {@link FeatureSuggestion} | ||
*/ | ||
features: AutofillFeatureSuggestion[]; | ||
} | ||
declare class HTMLScopedElement<Events extends { | ||
[key: number | string | symbol]: Event; | ||
} = Record<string, Event>> extends HTMLElement { | ||
#private; | ||
protected get template(): HTMLTemplateElement; | ||
protected get templateStyle(): string; | ||
protected get templateUserStyle(): string; | ||
/** | ||
* `clonedCallback` should be a part of the Web Components spec, but sadly | ||
* it is not. | ||
* | ||
* This is detected in {@link connectedCallback} below if the seed has changed. | ||
*/ | ||
clonedCallback(oldSeed: string, newSeed: string): void; | ||
connectedCallback(): void; | ||
prepareTemplate(template: HTMLTemplateElement): HTMLElement; | ||
prepareCSS(css: string): string; | ||
updateTemplateUserStyle(style: string): void; | ||
querySelector<E extends Element = Element>(selectors: string): E; | ||
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>; | ||
addEventListener<K extends keyof Events>(type: K, listener: (this: HTMLFormElement, ev: Events[K]) => unknown, options?: boolean | AddEventListenerOptions): void; | ||
removeEventListener<K extends keyof Events>(type: K, listener: (this: HTMLFormElement, ev: Events[K]) => unknown, options?: boolean | EventListenerOptions): void; | ||
dispatchEvent<K extends keyof Events>(event: Events[K]): boolean; | ||
} | ||
/** | ||
* `MapboxHTMLEvent` is an event dispatched by the Search Box and Autofill | ||
* components. | ||
* | ||
* @example | ||
* ``` | ||
* const search = new MapboxSearchBox(); | ||
* search.addEventListener('retrieve', (event: MapboxHTMLEvent<Suggestion>) => { | ||
* console.log(event.detail); | ||
* }); | ||
*/ | ||
export declare class MapboxHTMLEvent<T> extends CustomEvent<T> { | ||
constructor(type: string, detail?: T); | ||
/** | ||
* Returns a shallow copy of the event. This method is useful for | ||
* manually bubbling events from a connected component. | ||
* | ||
* @example | ||
* `MapboxSearchBox` will call `event.clone()` on the `retrieve` | ||
* event from `MapboxSearchListbox`, and then dispatch the cloned event. | ||
*/ | ||
clone(): MapboxHTMLEvent<T>; | ||
} | ||
/** | ||
* Currently, the only expression supported is | ||
* `['mobile', mobile_value, tablet_and_desktop_value]`. | ||
* | ||
* @typedef Expression | ||
*/ | ||
export declare type Expression = [ | ||
"mobile", | ||
string, | ||
string | ||
]; | ||
/** | ||
* `ThemeVariables` are a collection of CSS variables that style Control Theme API | ||
* elements. | ||
* | ||
* @typedef ThemeVariables | ||
*/ | ||
export interface ThemeVariables { | ||
/** @section {Sizing} */ | ||
/** | ||
* Unit is the base font size and can be referenced in other variables as multiples of `1em`. | ||
* | ||
* Analogous to [`font-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size). | ||
*/ | ||
unit?: string | Expression; | ||
/** | ||
* Unit header is a derivative of `unit` and is used for modal headers. | ||
* | ||
* Analogous to [`font-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size). | ||
*/ | ||
unitHeader?: string | Expression; | ||
/** | ||
* Minimum width of elements such as modals and listboxes. | ||
* | ||
* Analogous to CSS [`<length>`](https://developer.mozilla.org/en-US/docs/Web/CSS/length). | ||
*/ | ||
minWidth?: string; | ||
/** | ||
* Spacing between items in an element. | ||
* | ||
* Analogous to CSS [`<length>`](https://developer.mozilla.org/en-US/docs/Web/CSS/length). | ||
*/ | ||
spacing?: string; | ||
/** | ||
* Padding of items in an element. | ||
* | ||
* Analogous to CSS [`<length>`](https://developer.mozilla.org/en-US/docs/Web/CSS/length). | ||
*/ | ||
padding?: string; | ||
/** | ||
* Padding for contents of modal elements. | ||
* | ||
* Analogous to CSS [`<length>`](https://developer.mozilla.org/en-US/docs/Web/CSS/length). | ||
*/ | ||
paddingModal?: string; | ||
/** @section {Colors} */ | ||
/** | ||
* Color of the primary text. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: dark gray | ||
*/ | ||
colorText?: string; | ||
/** | ||
* Color of the primary accent color. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: variant of blue | ||
*/ | ||
colorPrimary?: string; | ||
/** | ||
* Color of the secondary accent color. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: blue-gray | ||
*/ | ||
colorSecondary?: string; | ||
/** | ||
* Background color for elements such as modals and listboxes. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: white | ||
*/ | ||
colorBackground?: string; | ||
/** | ||
* Background color for items on hover. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: light gray | ||
*/ | ||
colorBackgroundHover?: string; | ||
/** | ||
* Background color for items on press. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: dark gray | ||
*/ | ||
colorBackgroundActive?: string; | ||
/** | ||
* Backdrop color of body content behind modals. | ||
* | ||
* Analogous to CSS [`color`](https://developer.mozilla.org/en-US/docs/Web/CSS/color). | ||
* **Default**: black with alpha value | ||
*/ | ||
colorBackdrop?: string; | ||
/** @section {Borders and box shadows} */ | ||
/** | ||
* Border color of elements such as modals and listboxes. | ||
* | ||
* Analogous to CSS [`border`](https://developer.mozilla.org/en-US/docs/Web/CSS/border). | ||
*/ | ||
border?: string; | ||
/** | ||
* Border radius of elements such as modals and listboxes. | ||
* | ||
* Analogous to CSS [`border-radius`](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius). | ||
*/ | ||
borderRadius?: string; | ||
/** | ||
* Box shadow of elements such as modals and listboxes. | ||
* | ||
* Analogous to CSS [`box-shadow`](https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow). | ||
*/ | ||
boxShadow?: string; | ||
/** @section {Typography} */ | ||
/** | ||
* Line height. | ||
* | ||
* Analogous to CSS [`line-height`](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height). | ||
* **Default**: 1.2 | ||
*/ | ||
lineHeight?: string; | ||
/** | ||
* Font family. | ||
* | ||
* Analogous to CSS [`font-family`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family). | ||
* **Default**: Sans-serif [system font stack](https://systemfontstack.com/) | ||
*/ | ||
fontFamily?: string; | ||
/** | ||
* Font weight for body text. | ||
* | ||
* Analogous to CSS [`font-weight`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). | ||
* **Default**: normal | ||
*/ | ||
fontWeight?: string; | ||
/** | ||
* Font weight for subheadings. | ||
* | ||
* Analogous to CSS [`font-weight`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). | ||
* **Default**: 600 | ||
*/ | ||
fontWeightSemibold?: string; | ||
/** | ||
* Font weight for headings and item titles. | ||
* | ||
* Analogous to CSS [`font-weight`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). | ||
* **Default**: bold | ||
*/ | ||
fontWeightBold?: string; | ||
/** @section {Transitions} */ | ||
/** | ||
* The duration to use for listbox animations. | ||
* | ||
* Analogous to CSS [`<time>`](https://developer.mozilla.org/en-US/docs/Web/CSS/time). | ||
* **Default**: `150ms` | ||
*/ | ||
duration?: string; | ||
/** | ||
* The timing function to use for listbox animations. | ||
* | ||
* Analogous to CSS [`<easing-function>`](https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function). | ||
* **Default**: `ease-out` | ||
*/ | ||
curve?: string; | ||
} | ||
/** | ||
* `ThemeIcons` are [SVG icons](https://developer.mozilla.org/en-US/docs/Web/SVG) | ||
* that are used in Control Theme API elements. | ||
* | ||
* Roughly, icon names and their defaults are the same as | ||
* [Mapbox's Assembly](https://labs.mapbox.com/assembly/icons/). | ||
* | ||
* Values must be valid SVG plain-text. Unless otherwise noted, | ||
* icons should be 18px in size and have appropriate dimensions set. | ||
* | ||
* Icons can also be filled with 'currentColor'. | ||
* | ||
* @typedef ThemeIcons | ||
* @example | ||
* ```typescript | ||
* const icons = { | ||
* close: ` | ||
* <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
* <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> | ||
* <path fill-rule="evenodd" clip-rule="evenodd" d="M3.79289 3.79289C4.18342 3.40237 4.81658 3.40237 5.20711 3.79289L9 7.58579L12.7929 3.79289C13.1834 3.40237 13.8166 3.40237 14.2071 3.79289C14.5976 4.18342 14.5976 4.81658 14.2071 5.20711L10.4142 9L14.2071 12.7929C14.5976 13.1834 14.5976 13.8166 14.2071 14.2071C13.8166 14.5976 13.1834 14.5976 12.7929 14.2071L9 10.4142L5.20711 14.2071C4.81658 14.5976 4.18342 14.5976 3.79289 14.2071C3.40237 13.8166 3.40237 13.1834 3.79289 12.7929L7.58579 9L3.79289 5.20711C3.40237 4.81658 3.40237 4.18342 3.79289 3.79289Z" fill="currentColor"/> | ||
* </svg> | ||
* ` | ||
* } | ||
* ``` | ||
*/ | ||
export interface ThemeIcons { | ||
/** | ||
* Close icon. | ||
*/ | ||
close?: string; | ||
/** | ||
* Question mark icon. | ||
*/ | ||
question?: string; | ||
/** | ||
* Icon for map markers. Can be any size. | ||
*/ | ||
marker?: string; | ||
} | ||
/** | ||
* `ThemeImages` are raster images that are used in Control Theme API elements. | ||
* | ||
* There are currently only two images, "toggle default" and "toggle satellite," | ||
* which specify images for a Map/Satellite toggle button. | ||
* | ||
* Values must be valid URLs accessible by the expected browser environment. [Data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) | ||
* and [Blob URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) are also supported. | ||
* | ||
* @typedef ThemeImages | ||
*/ | ||
export interface ThemeImages { | ||
/** | ||
* Image for the "Map" of the Map/Satellite toggle button. | ||
*/ | ||
styleToggleDefault?: string; | ||
/** | ||
* Image for the "Satellite" of the Map/Satellite toggle button. | ||
*/ | ||
styleToggleSatellite?: string; | ||
} | ||
/** | ||
* The Control Theme API is a way to apply your own design system to | ||
* Mapbox Search JS Web elements. | ||
* | ||
* Control themes use a combination of CSS variables, custom scoped CSS, and | ||
* SVG icons. | ||
* | ||
* @typedef Theme | ||
* @example | ||
* ```typescript | ||
* const theme = { | ||
* variables: { | ||
* fontFamily: 'Avenir, sans-serif', | ||
* unit: '14px', | ||
* padding: '0.5em', | ||
* borderRadius: '0', | ||
* boxShadow: '0 0 0 1px silver', | ||
* } | ||
* }; | ||
* | ||
* autofill({ theme }); | ||
* ``` | ||
*/ | ||
export interface Theme { | ||
/** | ||
* CSS variables to be applied to the control. | ||
*/ | ||
variables?: ThemeVariables; | ||
/** | ||
* SVG icon overrides to be applied to the control. | ||
*/ | ||
icons?: ThemeIcons; | ||
/** | ||
* Raster image URLs to be applied to the control. | ||
*/ | ||
images?: ThemeImages; | ||
/** | ||
* Optional CSS text to be inserted into Scoped CSS elements. As such, any | ||
* CSS will not interact with the rest of the page. | ||
* | ||
* TODO: Class names are element-specific and have yet to be standardized. Breaking | ||
* changes are likely and will be flagged in CHANGELOG.md. | ||
*/ | ||
cssText?: string; | ||
} | ||
export declare type AutofillEventTypes = { | ||
/** | ||
* Fired when the user is typing in the input and provides a list of suggestions. | ||
* | ||
* The underlying response from {@link MapboxAutofill} is passed as the event's detail. | ||
* | ||
* @event suggest | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {AutofillSuggestionResponse} | ||
* @example | ||
* ```typescript | ||
* autofill.addEventListener('suggest', (event) => { | ||
* const suggestions = event.detail.suggestions; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
suggest: MapboxHTMLEvent<AutofillSuggestionResponse>; | ||
/** | ||
* Fired when {@link MapboxAutofill} has errored providing a list of suggestions. | ||
* | ||
* The underlying error is passed as the event's detail. | ||
* | ||
* @event suggesterror | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {Error} | ||
* @example | ||
* ```typescript | ||
* autofill.addEventListener('suggesterror', (event) => { | ||
* const error = event.detail; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
suggesterror: MapboxHTMLEvent<Error>; | ||
/** | ||
* Fired when the user has selected a suggestion, before the form is autofilled. | ||
* | ||
* The underlying response from {@link MapboxAutofill} is passed as the event's detail. | ||
* | ||
* @event retrieve | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {AutofillRetrieveResponse} | ||
* @example | ||
* ```typescript | ||
* autofill.addEventListener('retrieve', (event) => { | ||
* const featureCollection = event.detail; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
retrieve: MapboxHTMLEvent<AutofillRetrieveResponse>; | ||
}; | ||
/** | ||
* `MapboxAddressAutofill`, also available as the element `<mapbox-address-autofill>`, | ||
* is an element that wraps an address [`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text) element with | ||
* intelligent, location-aware autocomplete functionality. | ||
* | ||
* To use this element, you must have a [Mapbox access token](https://www.mapbox.com/help/create-api-access-token/). | ||
* | ||
* This element must be a descendant of a [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) element, and the form | ||
* must have inputs with proper HTML `autocomplete` attributes. If your application works with browser autofill, you may already have | ||
* this functionality. | ||
* - [The HTML autocomplete attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | ||
* - [Autofill](https://web.dev/learn/forms/autofill/) | ||
* | ||
* @class MapboxAddressAutofill | ||
* @example | ||
* <form> | ||
* <mapbox-address-autofill access-token="<your access token here>"> | ||
* <input type="text" name="address" autocomplete="shipping street-address" /> | ||
* </mapbox-address-autofill> | ||
* </form> | ||
*/ | ||
export declare class MapboxAddressAutofill extends HTMLScopedElement<AutofillEventTypes> { | ||
#private; | ||
/** | ||
* This is read by the Web Components API to affect the | ||
* {@link MapboxAddressAutofill.attributeChangedCallback} below. | ||
* | ||
* All of these are passthroughs to the underlying {@link MapboxSearchListbox}. | ||
* | ||
* @ignore | ||
*/ | ||
static observedAttributes: string[]; | ||
/** | ||
* The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
* | ||
* @name accessToken | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @example | ||
* ```typescript | ||
* autofill.accessToken = 'pk.my-mapbox-access-token'; | ||
* ``` | ||
*/ | ||
get accessToken(): string; | ||
set accessToken(newToken: string); | ||
/** | ||
* Options to pass to the underlying {@link MapboxAutofill} interface. | ||
* | ||
* @name options | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {AutofillOptions} | ||
* @example | ||
* ```typescript | ||
* autofill.options = { | ||
* language: 'en', | ||
* country: 'US', | ||
* }; | ||
* ``` | ||
*/ | ||
get options(): Partial<AutofillOptions>; | ||
set options(newOptions: Partial<AutofillOptions>); | ||
/** | ||
* The {@link Theme} to use for styling the autofill and confirmation dialog | ||
* components. | ||
* | ||
* @name theme | ||
* @instance | ||
* @memberof MapboxAddressAutofill | ||
* @type {Theme} | ||
* @example | ||
* ```typescript | ||
* autofill.theme = { | ||
* variables: { | ||
* colorPrimary: 'myBrandRed' | ||
* } | ||
* }; | ||
* ``` | ||
*/ | ||
get theme(): Theme; | ||
set theme(theme: Theme); | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
attributeChangedCallback(name: string, oldValue: string, newValue: string): void; | ||
/** @section {Methods} */ | ||
/** | ||
* Focuses the wrapped input element. | ||
*/ | ||
focus(): void; | ||
/** | ||
* `showConfirm` is a helper method to show the confirmation | ||
* dialog on form submit. | ||
* | ||
* The confirmation dialog will only be shown if the form values have | ||
* changed since the last autofill. | ||
* | ||
* The confirmation dialog can be themed by setting the {@link MapboxAddressAutofill#theme} | ||
* attribute. | ||
* | ||
* @returns `true` if the form values were changed, `false` otherwise. | ||
* @example | ||
* ```typescript | ||
* const form = document.querySelector('form'); | ||
* const autofill = document.querySelector('mapbox-address-autofill'); | ||
* | ||
* form.addEventListener('submit', async (e) => { | ||
* e.preventDefault(); | ||
* try { | ||
* await autofill.showConfirm(); | ||
* form.submit(); | ||
* } catch (e) { | ||
* // This means a network error occurred, | ||
* // or no suggestions could be found. | ||
* console.error(e.message || e); | ||
* } | ||
* }); | ||
* ``` | ||
*/ | ||
showConfirm(): Promise<boolean>; | ||
} | ||
export declare type SearchEventTypes = { | ||
/** | ||
* Fired when the user is typing and is provided a list of suggestions. | ||
* | ||
* The underlying response from {@link MapboxSearch} is passed as the event's detail. | ||
* | ||
* @event suggest | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {SuggestionResponse} | ||
* @example | ||
* ```typescript | ||
* search.addEventListener('suggest', (event) => { | ||
* const suggestions = event.detail.suggestions; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
suggest: MapboxHTMLEvent<SuggestionResponse>; | ||
/** | ||
* Fired when {@link MapboxSearch} has errored providing a list of suggestions. | ||
* | ||
* The underlying error is passed as the event's detail. | ||
* | ||
* @event suggesterror | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {Error} | ||
* @example | ||
* ```typescript | ||
* search.addEventListener('suggesterror', (event) => { | ||
* const error = event.detail; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
suggesterror: MapboxHTMLEvent<Error>; | ||
/** | ||
* Fired when the user has selected a suggestion. | ||
* | ||
* The underlying response from {@link MapboxSearch} is passed as the event's detail. | ||
* | ||
* @event retrieve | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {RetrieveResponse} | ||
* @example | ||
* ```typescript | ||
* search.addEventListener('retrieve', (event) => { | ||
* const featureCollection = event.detail; | ||
* // ... | ||
* }); | ||
* ``` | ||
*/ | ||
retrieve: MapboxHTMLEvent<RetrieveResponse>; | ||
}; | ||
/** | ||
* `MapboxSearchBox`, also available as the element `<mapbox-search-box>`, | ||
* is an element that lets you search for places, addresses, and landmarks using | ||
* the [Mapbox Search API](https://docs.mapbox.com/api/search/search). | ||
* | ||
* It can control a [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/guides/) map | ||
* to zoom to the selected result. | ||
* | ||
* Additionally, `MapboxSearchBox` implements the [IControl](https://www.mapbox.com/mapbox-gl-js/api/markers/#icontrol) | ||
* interface. | ||
* | ||
* To use this element, you must have a [Mapbox access token](https://www.mapbox.com/help/create-api-access-token/). | ||
* | ||
* @class MapboxSearchBox | ||
* @example | ||
* ```typescript | ||
* const search = new MapboxSearchBox(); | ||
* search.accessToken = '<your access token here>'; | ||
* map.addControl(search); | ||
* ``` | ||
* @example | ||
* <mapbox-search-box | ||
* access-token="<your access token here>" | ||
* proximity="0,0" | ||
* > | ||
* </mapbox-search-box> | ||
*/ | ||
export declare class MapboxSearchBox extends HTMLScopedElement<SearchEventTypes> implements mapboxgl.IControl { | ||
#private; | ||
/** | ||
* This is read by the Web Components API to affect the | ||
* {@link MapboxSearchBox#attributeChangedCallback} below. | ||
* | ||
* All of these are passthroughs to the underlying {@link MapboxSearchListbox}. | ||
* | ||
* @ignore | ||
*/ | ||
static observedAttributes: string[]; | ||
/** | ||
* The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
* | ||
* @name accessToken | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @example | ||
* ```typescript | ||
* search.accessToken = 'pk.my-mapbox-access-token'; | ||
* ``` | ||
*/ | ||
get accessToken(): string; | ||
set accessToken(newToken: string); | ||
protected get template(): HTMLTemplateElement; | ||
protected get templateStyle(): string; | ||
protected get templateUserStyle(): string; | ||
/** | ||
* Options to pass to the underlying {@link MapboxSearch} interface. | ||
* | ||
* @name options | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {Options} | ||
* @example | ||
* ```typescript | ||
* search.options = { | ||
* language: 'en', | ||
* country: 'US', | ||
* }; | ||
* ``` | ||
*/ | ||
get options(): Partial<Options>; | ||
set options(newOptions: Partial<Options>); | ||
/** | ||
* The {@link Theme} to use for styling the suggestion box and search box. | ||
* | ||
* @name theme | ||
* @instance | ||
* @memberof MapboxSearchBox | ||
* @type {Theme} | ||
* @example | ||
* ```typescript | ||
* search.theme = { | ||
* variables: { | ||
* colorPrimary: 'myBrandRed' | ||
* }, | ||
* cssText: ".Input:active { opacity: 0.9; }" | ||
* }; | ||
* ``` | ||
*/ | ||
get theme(): Theme; | ||
set theme(theme: Theme); | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
attributeChangedCallback(name: string, oldValue: string, newValue: string): void; | ||
/** @section {Methods} */ | ||
/** | ||
* Focuses the input element. | ||
*/ | ||
focus(): void; | ||
/** @section {Map binding} */ | ||
/** | ||
* Connects the search box to a [Map](https://docs.mapbox.com/mapbox-gl-js/api/#map), | ||
* which handles both setting proximity and zoom after a suggestion click. | ||
* | ||
* @example | ||
* ```typescript | ||
* const search = new MapboxSearchBox(); | ||
* search.bindMap(map); | ||
* ``` | ||
*/ | ||
bindMap(map: mapboxgl.Map): void; | ||
/** | ||
* Unbinds the search box from a [Map](https://docs.mapbox.com/mapbox-gl-js/api/#map). | ||
*/ | ||
unbindMap(): void; | ||
onAdd(map: mapboxgl.Map): HTMLElement; | ||
onRemove(): void; | ||
getDefaultPosition(): string; | ||
} | ||
/** | ||
* @typedef Anchor | ||
*/ | ||
export declare type Anchor = "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top" | "bottom" | "left" | "right"; | ||
export declare type MapStyleMode = "default" | "satellite"; | ||
/** | ||
* `MapboxAddressMinimap`, also available as the element `<mapbox-address-minimap>`, | ||
* is a component that displays a marker for confirmation purposes. | ||
* | ||
* Optionally, this marker is editable. When editable, the marker can be moved | ||
* around the map and the updated location is sent back to the Mapbox Contribute | ||
* workflow. | ||
* | ||
* The goal of `MapboxAddressMinimap` is to reduce delivery error in shipping and | ||
* local dispatching contexts. | ||
* | ||
* `MapboxAddressMinimap` expands to fill its container, and is hidden unless | ||
* {@link MapboxAddressMinimap#feature} is truthy. Setting {@link MapboxAddressMinimap#feature} | ||
* to `null` hides the component. | ||
* | ||
* @class MapboxAddressMinimap | ||
* @example | ||
* ```typescript | ||
* const mapboxAddressMinimap = document.createElement('mapbox-address-minimap'); | ||
* mapboxAddressMinimap.feature = { | ||
* type: 'Feature', | ||
* geometry: { | ||
* type: 'Point', | ||
* coordinates: [-122.4194, 37.7749] | ||
* }, | ||
* properties: {} | ||
* }; | ||
* ``` | ||
*/ | ||
export declare class MapboxAddressMinimap extends HTMLScopedElement { | ||
#private; | ||
static observedAttributes: string[]; | ||
/** @section {Markers} */ | ||
/** | ||
* If `true`, the marker can be moved around the map. Defaults to `false`. | ||
* | ||
* When editable, the marker can be moved around the map and the updated | ||
* location is sent back to the Mapbox Contribute workflow. | ||
* | ||
* @name canAdjustMarker | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {boolean} | ||
*/ | ||
canAdjustMarker: boolean; | ||
/** | ||
* If `true`, the map when panned moves around the marker, keeping the marker | ||
* centered. Defaults to `false`. | ||
* | ||
* @name keepMarkerCentered | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {boolean} | ||
*/ | ||
keepMarkerCentered: boolean; | ||
/** | ||
* The anchor of the marker, relative to center of the expanded size. Defaults to `'bottom'`. | ||
* | ||
* @name markerAnchor | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {Anchor} | ||
*/ | ||
markerAnchor: Anchor; | ||
/** | ||
* The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
* | ||
* @name accessToken | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @example | ||
* ```typescript | ||
* minimap.accessToken = 'pk.my-mapbox-access-token'; | ||
* ``` | ||
*/ | ||
get accessToken(): string; | ||
set accessToken(newToken: string); | ||
/** | ||
* A [GeoJSON](https://docs.mapbox.com/help/glossary/geojson/) Feature representing | ||
* a [Point](https://geojson.org/geojson-spec.html#point) geometry. | ||
* | ||
* The minimap is hidden unless | ||
* {@link MapboxAddressMinimap#feature} is truthy. Setting {@link MapboxAddressMinimap#feature} | ||
* to `null` hides the component. | ||
* | ||
* @name feature | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {Feature} | ||
*/ | ||
get feature(): GeoJSON.Feature<GeoJSON.Point>; | ||
set feature(feature: GeoJSON.Feature<GeoJSON.Point>); | ||
get template(): HTMLTemplateElement; | ||
get templateStyle(): string; | ||
get templateUserStyle(): string; | ||
/** @section {Appearance} */ | ||
/** | ||
* If `true`, the map will have an image toggle between Map and Satellite styles. | ||
* | ||
* @name satelliteToggle | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {boolean} | ||
*/ | ||
satelliteToggle: boolean; | ||
/** | ||
* The {@link Theme} to use for styling the editing interface. | ||
* | ||
* @name theme | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {Theme} | ||
* @example | ||
* ```typescript | ||
* autofill.theme = { | ||
* variables: { | ||
* colorPrimary: 'myBrandRed' | ||
* } | ||
* }; | ||
* ``` | ||
*/ | ||
get theme(): Theme; | ||
set theme(theme: Theme); | ||
/** | ||
* The map style to use, either `'default'` or `'satellite'`. The default map | ||
* style is configurable with {@link MapboxAddressMinimap#defaultMapStyle}. | ||
* | ||
* @name mapStyleMode | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {'default' | 'satellite'} | ||
*/ | ||
get mapStyleMode(): MapStyleMode; | ||
set mapStyleMode(styleMode: MapStyleMode); | ||
/** | ||
* The map style to use for the default map style. Defaults to `['mapbox', 'streets-v11']`. | ||
* | ||
* @name defaultMapStyle | ||
* @instance | ||
* @memberof MapboxAddressMinimap | ||
* @type {[string, string]} | ||
*/ | ||
get defaultMapStyle(): [ | ||
string, | ||
string | ||
]; | ||
set defaultMapStyle(style: [ | ||
string, | ||
string | ||
]); | ||
get container(): HTMLElement | null; | ||
set container(newContainer: HTMLElement | null); | ||
/** @section {Methods} */ | ||
/** | ||
* If {@link MapboxAddressMinimap#feature} is truthy, show the minimap. | ||
*/ | ||
show(): void; | ||
/** | ||
* Hide the minimap. | ||
*/ | ||
hide(): void; | ||
onSaveMarkerLocation: (coordinate: [ | ||
number, | ||
number | ||
]) => void; | ||
connectedCallback(): void; | ||
attributeChangedCallback(name: string, oldValue: string, newValue: string): void; | ||
} | ||
export interface AutofillCollectionOptions { | ||
accessToken: string; | ||
options?: Partial<AutofillOptions>; | ||
} | ||
export interface ShowConfirmAddressOptions { | ||
theme?: Theme; | ||
sections?: string[]; | ||
} | ||
declare class AutofillCollection { | ||
#private; | ||
autofillInstances: MapboxAddressAutofill[]; | ||
constructor({ accessToken, options }: AutofillCollectionOptions); | ||
/** | ||
* The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests. | ||
* | ||
* @example | ||
* ```typescript | ||
* autofill.accessToken = 'pk.my-mapbox-access-token'; | ||
* ``` | ||
*/ | ||
get accessToken(): string; | ||
set accessToken(newToken: string); | ||
/** | ||
* Options to pass to the underlying {@link MapboxAutofill} interface. | ||
* | ||
* @example | ||
* ```typescript | ||
* autofill.options = { | ||
* language: 'en', | ||
* country: 'US', | ||
* }; | ||
* ``` | ||
*/ | ||
get options(): Partial<AutofillOptions>; | ||
set options(newOptions: Partial<AutofillOptions>); | ||
/** | ||
* The {@link Theme} to use for styling the autofill and confirmation dialog | ||
* components. | ||
* | ||
* @example | ||
* ```typescript | ||
* autofill.theme = { | ||
* variables: { | ||
* colorPrimary: 'myBrandRed' | ||
* } | ||
* }; | ||
* ``` | ||
*/ | ||
get theme(): Theme; | ||
set theme(newTheme: Theme); | ||
get minimapOnConfirm(): boolean; | ||
set minimapOnConfirm(val: boolean); | ||
/** | ||
* Update autofill instance(s) based on the current DOM | ||
*/ | ||
update(): void; | ||
/** | ||
* Listen for changes to the DOM, and update autofill instances when autofill-able inputs are added/removed. | ||
* For performance reasons, it is recommended to carefully control when this is called and to call unobserve() when you are done. | ||
*/ | ||
observe(): void; | ||
/** | ||
* Stop listening for changes to the DOM. | ||
*/ | ||
unobserve(): void; | ||
/** | ||
* Display a confirmation dialog for one or more addresses filled out in a form. | ||
* @param form - The form element to show the confirmation dialog for. This can contain multiple address sections, e.g. billing and shipping. | ||
* @param options - Options to customize the dialog and confirmation behavior. | ||
* @returns A promise that resolves to true if the user accepts the standardized address(es), otherwise false. | ||
*/ | ||
showConfirmAddress(form: HTMLFormElement, options?: ShowConfirmAddressOptions): Promise<boolean>; | ||
} | ||
/** | ||
* Javascript entry point for usage of Autofill, for use on standard HTML address forms. | ||
* | ||
* --- | ||
* CDN usage: | ||
* @example | ||
* ```html | ||
* <script id="search-js" defer src="https://api.mapbox.com/search-js/vX.X.X/web.js"></script> | ||
* <script> | ||
* const script = document.getElementById('search-js'); | ||
* script.onload = function() { | ||
* mapboxsearch.autofill({ | ||
* accessToken: 'pk.my.token', | ||
* options | ||
* }); | ||
* }; | ||
* </script> | ||
* ``` | ||
* --- | ||
* NPM usage: | ||
* @example | ||
* ```js | ||
* import { autofill } from '@mapbox/search-js/web'; | ||
* autofill({ | ||
* accessToken: 'pk.my.token', | ||
* options | ||
* }) | ||
* ``` | ||
* --- | ||
* Advanced usage, tracking DOM updates: | ||
* @example | ||
* ```js | ||
* const collection = mapboxsearch.autofill({ | ||
* accessToken: 'pk.my.token', | ||
* options | ||
* }) | ||
* | ||
* myClientSideRouter.on('route', () => collection.update()); | ||
* ``` | ||
*/ | ||
export declare function autofill({ accessToken, options }: AutofillCollectionOptions): AutofillCollection; | ||
export {}; | ||
/// <reference path="../src/types/custom_elements.d.ts" /> | ||
/// <reference path="../src/types/typehead.d.ts" /> | ||
import './components/MapboxSearchListbox'; | ||
import './components/MapboxAddressConfirmation'; | ||
export { MapboxAddressAutofill } from './components/MapboxAddressAutofill'; | ||
export { MapboxSearchBox } from './components/MapboxSearchBox'; | ||
export { MapboxAddressMinimap } from './components/MapboxAddressMinimap'; | ||
export { MapboxHTMLEvent } from './MapboxHTMLEvent'; | ||
export { Theme } from './theme'; | ||
export { autofill } from './autofill'; | ||
export { MapStyleMode, Anchor } from './utils/minimap'; |
@@ -1,11 +0,11 @@ | ||
var Si=Object.create;var Me=Object.defineProperty,Ai=Object.defineProperties,Li=Object.getOwnPropertyDescriptor,ki=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,wi=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty,Ii=Object.prototype.propertyIsEnumerable;var $t=(r,e,i)=>e in r?Me(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,g=(r,e)=>{for(var i in e||(e={}))Wt.call(e,i)&&$t(r,i,e[i]);if(Xt)for(var i of Xt(e))Ii.call(e,i)&&$t(r,i,e[i]);return r},Vt=(r,e)=>Ai(r,ki(e)),qt=r=>Me(r,"__esModule",{value:!0});var Hi=(r,e)=>{for(var i in e)Me(r,i,{get:e[i],enumerable:!0})},Gt=(r,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ci(e))!Wt.call(r,n)&&(i||n!=="default")&&Me(r,n,{get:()=>e[n],enumerable:!(s=Li(e,n))||s.enumerable});return r},ut=(r,e)=>Gt(qt(Me(r!=null?Si(wi(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),Bi=(r=>(e,i)=>r&&r.get(e)||(i=Gt(qt({}),e,1),r&&r.set(e,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var Ct=(r,e,i)=>{if(!e.has(r))throw TypeError("Cannot "+i)};var t=(r,e,i)=>(Ct(r,e,"read from private field"),i?i.call(r):e.get(r)),a=(r,e,i)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,i)},d=(r,e,i,s)=>(Ct(r,e,"write to private field"),s?s.call(r,i):e.set(r,i),i);var b=(r,e,i)=>(Ct(r,e,"access private method"),i);var j=(r,e,i)=>new Promise((s,n)=>{var o=m=>{try{c(i.next(m))}catch(u){n(u)}},l=m=>{try{c(i.throw(m))}catch(u){n(u)}},c=m=>m.done?s(m.value):Promise.resolve(m.value).then(o,l);c((i=i.apply(r,e)).next())});var ds={};Hi(ds,{MapboxAddressAutofill:()=>z,MapboxAddressMinimap:()=>fe,MapboxHTMLEvent:()=>x,MapboxSearchBox:()=>me,autofill:()=>Ti});var Ot=require("@popperjs/core/lib/popper-lite");var Kt=document.implementation.createHTMLDocument();function ie(r,e){let i={};for(let[s,n]of Object.entries(e))i[s]=r.querySelector(n);return i}function Zt(r){return Array.from(r.childNodes||[]).filter(e=>e.nodeType===Node.ELEMENT_NODE)}function M(r){let e=document.createElement("template");return e.innerHTML=r,e.content.firstElementChild}function Jt(r){let e=Kt.createElement("style");return e.textContent=r,Kt.head.appendChild(e),e.sheet}function Qt(r){return window.getComputedStyle(r).display!=="none"}function L(r,e){if(!r)return;Object.getOwnPropertyDescriptor(r.constructor.prototype,"value").set.call(r,e);let s=r;s._valueTracker&&s._valueTracker.setValue("");let n=new Event("input",{bubbles:!0});n.simulated=!0,r.dispatchEvent(n);let o=new Event("change",{bubbles:!0});o.simulated=!0,r.dispatchEvent(o)}function pt(r,e=!1){let i,s,n=r.getBoundingClientRect();if(r.style.display==="none"||n.height===0&&n.width===0){let o=r.cloneNode(e);r.parentElement.appendChild(o),o.style.setProperty("display","block","important");let l=o.getBoundingClientRect();i=l.width,s=l.height,o.style.setProperty("display","none"),o.remove()}else i=n.width,s=n.height;return{height:Math.floor(s),width:Math.floor(i)}}var Ri=new RegExp("[_a-zA-Z]+[_a-zA-Z0-9-]*","g"),Pi=new RegExp(`\\.${Ri.source}`,"g"),Oi=new RegExp("^\\s*(@(?:media|supports)[^{]*){(.*)}\\s*$");function xe(r,e){return r.replace(Pi,i=>"."+e(i.slice(1)))}function wt(r,e){let s=Jt(r).cssRules;function n(l){if(l instanceof CSSStyleRule)return`${xe(l.selectorText,e)} { ${l.style.cssText} }`;let c=Oi.exec(l.cssText.split(` | ||
`).join(""));if(c&&c.length>2){let m=c[1],u=c[2];return`${m} { ${wt(u,e)} }`}return l.cssText}let o="";for(let l of Array.from(s))o+=n(l)+` | ||
var Ai=Object.create;var Me=Object.defineProperty,Li=Object.defineProperties,ki=Object.getOwnPropertyDescriptor,Ci=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertyNames,$t=Object.getOwnPropertySymbols,Ii=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty,Hi=Object.prototype.propertyIsEnumerable;var Wt=(r,e,i)=>e in r?Me(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,h=(r,e)=>{for(var i in e||(e={}))Vt.call(e,i)&&Wt(r,i,e[i]);if($t)for(var i of $t(e))Hi.call(e,i)&&Wt(r,i,e[i]);return r},qt=(r,e)=>Li(r,Ci(e)),Gt=r=>Me(r,"__esModule",{value:!0});var Bi=(r,e)=>{for(var i in e)Me(r,i,{get:e[i],enumerable:!0})},Kt=(r,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wi(e))!Vt.call(r,n)&&(i||n!=="default")&&Me(r,n,{get:()=>e[n],enumerable:!(s=ki(e,n))||s.enumerable});return r},mt=(r,e)=>Kt(Gt(Me(r!=null?Ai(Ii(r)):{},"default",!e&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),Ri=(r=>(e,i)=>r&&r.get(e)||(i=Kt(Gt({}),e,1),r&&r.set(e,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var wt=(r,e,i)=>{if(!e.has(r))throw TypeError("Cannot "+i)};var t=(r,e,i)=>(wt(r,e,"read from private field"),i?i.call(r):e.get(r)),a=(r,e,i)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,i)},d=(r,e,i,s)=>(wt(r,e,"write to private field"),s?s.call(r,i):e.set(r,i),i);var x=(r,e,i)=>(wt(r,e,"access private method"),i);var j=(r,e,i)=>new Promise((s,n)=>{var o=u=>{try{c(i.next(u))}catch(m){n(m)}},l=u=>{try{c(i.throw(u))}catch(m){n(m)}},c=u=>u.done?s(u.value):Promise.resolve(u.value).then(o,l);c((i=i.apply(r,e)).next())});var cs={};Bi(cs,{MapboxAddressAutofill:()=>z,MapboxAddressMinimap:()=>fe,MapboxHTMLEvent:()=>b,MapboxSearchBox:()=>me,autofill:()=>Si});var Ft=require("@popperjs/core/lib/popper-lite");var Zt=document.implementation.createHTMLDocument();function re(r,e){let i={};for(let[s,n]of Object.entries(e))i[s]=r.querySelector(n);return i}function Jt(r){return Array.from(r.childNodes||[]).filter(e=>e.nodeType===Node.ELEMENT_NODE)}function E(r){let e=document.createElement("template");return e.innerHTML=r,e.content.firstElementChild}function Qt(r){let e=Zt.createElement("style");return e.textContent=r,Zt.head.appendChild(e),e.sheet}function ei(r){return window.getComputedStyle(r).display!=="none"}function L(r,e){if(!r)return;Object.getOwnPropertyDescriptor(r.constructor.prototype,"value").set.call(r,e);let s=r;s._valueTracker&&s._valueTracker.setValue("");let n=new Event("input",{bubbles:!0});n.simulated=!0,r.dispatchEvent(n);let o=new Event("change",{bubbles:!0});o.simulated=!0,r.dispatchEvent(o)}function pt(r,e=!1){let i,s,n=r.getBoundingClientRect();if(r.style.display==="none"||n.height===0&&n.width===0){let o=r.cloneNode(e);r.parentElement.appendChild(o),o.style.setProperty("display","block","important");let l=o.getBoundingClientRect();i=l.width,s=l.height,o.style.setProperty("display","none"),o.remove()}else i=n.width,s=n.height;return{height:Math.floor(s),width:Math.floor(i)}}var Pi=new RegExp("[_a-zA-Z]+[_a-zA-Z0-9-]*","g"),Oi=new RegExp(`\\.${Pi.source}`,"g"),Fi=new RegExp("^\\s*(@(?:media|supports)[^{]*){(.*)}\\s*$");function xe(r,e){return r.replace(Oi,i=>"."+e(i.slice(1)))}function It(r,e){let s=Qt(r).cssRules;function n(l){if(l instanceof CSSStyleRule)return`${xe(l.selectorText,e)} { ${l.style.cssText} }`;let c=Fi.exec(l.cssText.split(` | ||
`).join(""));if(c&&c.length>2){let u=c[1],m=c[2];return`${u} { ${It(m,e)} }`}return l.cssText}let o="";for(let l of Array.from(s))o+=n(l)+` | ||
`;return o.trim()}function It(r,e){let i=Array.from(r.querySelectorAll("[class]"));i.push(r);for(let s of i){let{classList:n}=s;for(let o of Array.from(n))n.remove(o),n.add(e(o))}return r}var ei=require("@mapbox/search-js-core");function B(){return"mbx"+new ei.SessionToken().id.slice(0,8)}function ht(r){try{return JSON.parse(r)}catch(e){return null}}function Ee(r,e){if(r==null||e==null||typeof r!="object"||typeof e!="object")return r===e;let i=Object.keys(r),s=Object.keys(e);if(i.length!==s.length)return!1;for(let n of i)if(!Ee(r[n],e[n]))return!1;return!0}function Ht(r,e){let i=Math.pow(10,e);return Math.round(r*i)/i}var se,X,$,w=class extends HTMLElement{constructor(){super(...arguments);a(this,se,B());a(this,X,void 0);a(this,$,e=>`${t(this,se)}--${e}`)}get template(){return null}get templateStyle(){return null}get templateUserStyle(){return null}clonedCallback(e,i){let s=o=>o.replace(e,i);It(this,s);let n=Array.from(this.querySelectorAll("style"));for(let o of n)o.textContent=xe(o.textContent,s);n.length&&d(this,X,n[n.length-1])}connectedCallback(){if(this.childElementCount>0){let n=this.dataset.seed,o=t(this,se);n&&n!==o&&(this.clonedCallback(n,o),this.dataset.seed=o);return}this.dataset.seed=t(this,se);let e=this.template;if(e){let n=this.prepareTemplate(e);this.appendChild(n)}let i=this.templateStyle;if(i){let n=document.createElement("style");n.textContent=this.prepareCSS(i),this.appendChild(n)}let s=document.createElement("style");this.templateUserStyle&&(s.textContent=this.prepareCSS(this.templateUserStyle)),this.appendChild(s),d(this,X,s)}prepareTemplate(e){let i=e.content.firstElementChild;return It(i.cloneNode(!0),t(this,$))}prepareCSS(e){return wt(e,t(this,$))}updateTemplateUserStyle(e){!t(this,X)||(t(this,X).textContent=this.prepareCSS(e))}querySelector(e){return super.querySelector(xe(e,t(this,$)))}querySelectorAll(e){return super.querySelectorAll(xe(e,t(this,$)))}addEventListener(e,i,s){super.addEventListener(e,i,s)}removeEventListener(e,i,s){super.removeEventListener(e,i,s)}dispatchEvent(e){return super.dispatchEvent(e)}};se=new WeakMap,X=new WeakMap,$=new WeakMap;var x=class extends CustomEvent{constructor(e,i){super(e,{composed:!0,detail:i})}clone(){return new x(this.type,this.detail)}};var ti=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
`;return o.trim()}function Ht(r,e){let i=Array.from(r.querySelectorAll("[class]"));i.push(r);for(let s of i){let{classList:n}=s;for(let o of Array.from(n))n.remove(o),n.add(e(o))}return r}var ti=require("@mapbox/search-js-core");function B(){return"mbx"+new ti.SessionToken().id.slice(0,8)}function ht(r){try{return JSON.parse(r)}catch(e){return null}}function Ee(r,e){if(r==null||e==null||typeof r!="object"||typeof e!="object")return r===e;let i=Object.keys(r),s=Object.keys(e);if(i.length!==s.length)return!1;for(let n of i)if(!Ee(r[n],e[n]))return!1;return!0}function Bt(r,e){let i=Math.pow(10,e);return Math.round(r*i)/i}var ne,$,W,w=class extends HTMLElement{constructor(){super(...arguments);a(this,ne,B());a(this,$,void 0);a(this,W,e=>`${t(this,ne)}--${e}`)}get template(){return null}get templateStyle(){return null}get templateUserStyle(){return null}clonedCallback(e,i){let s=o=>o.replace(e,i);Ht(this,s);let n=Array.from(this.querySelectorAll("style"));for(let o of n)o.textContent=xe(o.textContent,s);n.length&&d(this,$,n[n.length-1])}connectedCallback(){if(this.childElementCount>0){let n=this.dataset.seed,o=t(this,ne);n&&n!==o&&(this.clonedCallback(n,o),this.dataset.seed=o);return}this.dataset.seed=t(this,ne);let e=this.template;if(e){let n=this.prepareTemplate(e);this.appendChild(n)}let i=this.templateStyle;if(i){let n=document.createElement("style");n.textContent=this.prepareCSS(i),this.appendChild(n)}let s=document.createElement("style");this.templateUserStyle&&(s.textContent=this.prepareCSS(this.templateUserStyle)),this.appendChild(s),d(this,$,s)}prepareTemplate(e){let i=e.content.firstElementChild;return Ht(i.cloneNode(!0),t(this,W))}prepareCSS(e){return It(e,t(this,W))}updateTemplateUserStyle(e){!t(this,$)||(t(this,$).textContent=this.prepareCSS(e))}querySelector(e){return super.querySelector(xe(e,t(this,W)))}querySelectorAll(e){return super.querySelectorAll(xe(e,t(this,W)))}addEventListener(e,i,s){super.addEventListener(e,i,s)}removeEventListener(e,i,s){super.removeEventListener(e,i,s)}dispatchEvent(e){return super.dispatchEvent(e)}};ne=new WeakMap,$=new WeakMap,W=new WeakMap;var b=class extends CustomEvent{constructor(e,i){super(e,{composed:!0,detail:i})}clone(){return new b(this.type,this.detail)}};var ii=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.79289 3.79289C4.18342 3.40237 4.81658 3.40237 5.20711 3.79289L9 7.58579L12.7929 3.79289C13.1834 3.40237 13.8166 3.40237 14.2071 3.79289C14.5976 4.18342 14.5976 4.81658 14.2071 5.20711L10.4142 9L14.2071 12.7929C14.5976 13.1834 14.5976 13.8166 14.2071 14.2071C13.8166 14.5976 13.1834 14.5976 12.7929 14.2071L9 10.4142L5.20711 14.2071C4.81658 14.5976 4.18342 14.5976 3.79289 14.2071C3.40237 13.8166 3.40237 13.1834 3.79289 12.7929L7.58579 9L3.79289 5.20711C3.40237 4.81658 3.40237 4.18342 3.79289 3.79289Z" fill="currentColor"/> | ||
</svg>`;var ii=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
</svg>`;var si=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9 16C12.866 16 16 12.866 16 9C16 5.13401 12.866 2 9 2C5.13401 2 2 5.13401 2 9C2 12.866 5.13401 16 9 16ZM6.88128 4.88128C7.36552 4.39704 8.02229 4.125 8.70711 4.125H9.79289C10.4777 4.125 11.1345 4.39704 11.6187 4.88128C12.103 5.36552 12.375 6.02229 12.375 6.70711V6.86762C12.375 7.8775 11.8451 8.81333 10.9792 9.33291L10.4212 9.6677C10.1547 9.82759 9.96958 10.0882 9.90264 10.3844C9.87221 10.5191 9.76307 10.6324 9.625 10.6324H8.375C8.23693 10.6324 8.12387 10.5202 8.13584 10.3826C8.21527 9.47002 8.72673 8.64354 9.52082 8.16709L10.0788 7.8323C10.4177 7.62899 10.625 7.26279 10.625 6.86762V6.70711C10.625 6.48642 10.5373 6.27477 10.3813 6.11872C10.2252 5.96267 10.0136 5.875 9.79289 5.875H8.70711C8.48642 5.875 8.27477 5.96267 8.11872 6.11872C7.96267 6.27477 7.875 6.48642 7.875 6.70711V6.8889C7.875 7.37215 7.48325 7.7639 7 7.7639C6.51675 7.7639 6.125 7.37215 6.125 6.8889V6.70711C6.125 6.02229 6.39704 5.36552 6.88128 4.88128ZM10 13C10 13.5523 9.55228 14 9 14C8.44772 14 8 13.5523 8 13C8 12.4477 8.44772 12 9 12C9.55228 12 10 12.4477 10 13Z" fill="currentColor"/> | ||
</svg>`;var si=`<svg width="48" height="56" viewBox="0 0 48 56" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
</svg>`;var ri=`<svg width="48" height="56" viewBox="0 0 48 56" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<g filter="url(#filter0_d_17_871)"> | ||
@@ -27,3 +27,3 @@ <path d="M24 50.4L37.7887 36.2834C40.5158 33.6058 42.3729 30.1944 43.1253 26.4806C43.8777 22.7667 43.4915 18.9172 42.0156 15.4188C40.5397 11.9204 38.0403 8.9303 34.8336 6.82657C31.6268 4.72284 27.8567 3.59998 24 3.59998C20.1433 3.59998 16.3732 4.72284 13.1664 6.82657C9.95966 8.9303 7.4603 11.9204 5.98438 15.4188C4.50846 18.9172 4.12229 22.7667 4.87468 26.4806C5.62707 30.1944 7.48424 33.6058 10.2113 36.2834L24 50.4Z" fill="currentColor"/> | ||
</defs> | ||
</svg>`;var Bt="1.0.0-beta.5";var Ni=`https://api.mapbox.com/search-js/v${Bt}/img/style-toggle-satellite.jpg`,zi=`https://api.mapbox.com/search-js/v${Bt}/img/style-toggle-default.jpg`,Yi=768-1,Ui=`@media only screen and (max-width: ${Yi}px)`,Rt={variables:{unit:["mobile","16px","14px"],unitHeader:["mobile","24px","18px"],minWidth:"min(300px, 100vw)",spacing:"0.75em",padding:"0.5em 0.75em",paddingModal:"1.25em",colorText:"rgba(0, 0, 0, 0.75)",colorPrimary:"#4264FB",colorSecondary:"#667F91",colorBackground:"#fff",colorBackgroundHover:"#f5f5f5",colorBackgroundActive:"#f0f0f0",colorBackdrop:"rgba(102, 127, 145, 0.3)",border:"none",borderRadius:"4px",boxShadow:` | ||
</svg>`;var Rt="1.0.0-beta.6";var zi=`https://api.mapbox.com/search-js/v${Rt}/img/style-toggle-satellite.jpg`,Yi=`https://api.mapbox.com/search-js/v${Rt}/img/style-toggle-default.jpg`,Ui=768-1,Xi=`@media only screen and (max-width: ${Ui}px)`,Pt={variables:{unit:["mobile","16px","14px"],unitHeader:["mobile","24px","18px"],minWidth:"min(300px, 100vw)",spacing:"0.75em",padding:"0.5em 0.75em",paddingModal:"1.25em",colorText:"rgba(0, 0, 0, 0.75)",colorPrimary:"#4264FB",colorSecondary:"#667F91",colorBackground:"#fff",colorBackgroundHover:"#f5f5f5",colorBackgroundActive:"#f0f0f0",colorBackdrop:"rgba(102, 127, 145, 0.3)",border:"none",borderRadius:"4px",boxShadow:` | ||
0 0 10px 2px rgba(0, 0, 0, 0.05), | ||
@@ -38,3 +38,3 @@ 0 0 6px 1px rgba(0, 0, 0, 0.1), | ||
Ubuntu, roboto, noto, arial, sans-serif | ||
`,fontWeight:"normal",fontWeightSemibold:"600",fontWeightBold:"bold",duration:"150ms",curve:"ease-out"},icons:{close:ti,question:ii,marker:si},images:{styleToggleDefault:zi,styleToggleSatellite:Ni}};function k(r,e={}){let i=g(g({},Rt.variables),e.variables||{}),s=e.cssText||"",n="";for(let[o,l]of Object.entries(i)){if(!Array.isArray(l)){n+=`--${o}: ${l};`;continue}if(l[0]!=="mobile"){let u=JSON.stringify(l);throw new Error(`Unsupported expression in theme variables: ${o} ${u}`)}let[,c,m]=l;s+=`${Ui} { ${r} { --${o}: ${c} !important; } }`,n+=`--${o}: ${m};`}return s+`${r} { ${n} }`}function W(r,e={}){return g(g({},Rt.icons),e.icons||{})[r]}function ri(r,e={}){return g(g({},Rt.images),e.images||{})[r]}var D="*{box-sizing:border-box!important}[role=button]{cursor:pointer}.MapboxSearch{--width:100%}.Results{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);margin-top:var(--spacing)!important;min-width:var(--minWidth);overflow-y:auto;position:absolute;transform:translateZ(0);transition:visibility var(--duration);width:var(--width);z-index:1000}.Results:not([aria-hidden=true]){visibility:visible}.Results[aria-hidden=true]{animation:fadein var(--duration) var(--curve) reverse forwards;visibility:hidden}.Suggestion{padding:var(--padding)}.Suggestion:hover{cursor:pointer}.Suggestion[aria-selected=true]{background-color:var(--colorBackgroundHover)}.Suggestion:active{background-color:var(--colorBackgroundActive)}.SuggestionName{font-weight:var(--fontWeightBold)}.ResultsAttribution{padding:var(--padding)}.ResultsAttribution a{color:var(--colorSecondary)}.ResultsAttribution a:not(:hover){text-decoration:none}.ResultsList{list-style:none;margin:0;padding:0}.Label{display:none}.Input{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--padding);width:100%}.MapboxAddressConfirmation{align-items:center;background-color:var(--colorBackdrop);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;transform:translateZ(0);z-index:1000}.MapboxAddressConfirmation:not([aria-hidden=true]){animation:fadein var(--duration) var(--curve) forwards;visibility:visible}.MapboxAddressConfirmation[aria-hidden=true]{visibility:hidden}.Modal{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--paddingModal);width:var(--minWidth)}@media screen and (max-width:768px){.MapboxAddressConfirmation{align-items:flex-end}.Modal{border-bottom-left-radius:0;border-bottom-right-radius:0;width:100%}}.ModalHeader{align-items:center;color:var(--colorPrimary);display:flex;font-size:var(--unitHeader);font-weight:var(--fontWeightBold);margin-bottom:var(--spacing);user-select:none;width:100%}.ModalMap{height:calc(var(--minWidth) - var(--paddingModal)*2)}.ModalMap[aria-hidden=true]{display:none}.Icon{height:var(--unitHeader);width:var(--unitHeader)}.Icon.IconClose{color:var(--colorSecondary)}.ModalHeaderTitle{flex:1;margin-left:.25em}.ModalFooter{color:var(--colorSecondary);margin-top:var(--spacing);text-align:center}.ModalSubheader{font-weight:var(--fontWeightBold);user-select:none}.ModalAddress,.ModalSubheader{margin-bottom:var(--spacing)}.ModalAddress.ModalAddressApprove{color:var(--colorPrimary)}.Button{border-radius:var(--borderRadius);cursor:pointer;font-weight:var(--fontWeightSemibold);margin-top:var(--spacing);padding:var(--padding);text-align:center;user-select:none;width:100%}.Button[aria-hidden=true]{display:none}.Button.ButtonPrimary{background-color:var(--colorPrimary);color:var(--colorBackground)}.Button.ButtonSecondary{border:1px solid var(--colorSecondary);color:var(--colorSecondary)}@keyframes fadein{0%{opacity:0}to{opacity:1}}.MapboxAddressMinimap{font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight)}.MapboxAddressMinimap[aria-hidden=true]{display:none}.MinimapImageContainer{border-radius:var(--borderRadius);overflow:hidden}.MinimapImage{height:unset;max-height:unset;max-width:unset;position:relative;width:unset}.MinimapInnerFrame{border:var(--border);border-radius:inherit;height:inherit;left:0;overflow:hidden;position:absolute;top:0;width:inherit}.MinimapMarker{left:50%;position:absolute;top:50%}.MinimapMarker>svg{color:var(--colorPrimary);display:block!important}.MinimapAttributionLogo{bottom:0;left:0;margin:0 0 6px 6px;position:absolute}.MinimapAttributionLogo a{cursor:pointer;display:block;height:23px;width:88px}.MinimapAttributionText{background-color:hsla(0,0%,100%,.65);bottom:0;font:11px/16px Helvetica Neue,Arial,Helvetica,sans-serif;padding:0 5px;position:absolute;right:0}.MinimapAttributionText a{color:rgba(0,0,0,.75);text-decoration:none}.MinimapAttributionText a:hover{color:inherit;text-decoration:underline}.MinimapAttributionText a:not(:first-child){margin-left:3px}.MinimapStyleToggle{background-position:0;background-repeat:no-repeat;background-size:contain;border:2px solid #fff;border-radius:3px;box-shadow:var(--boxShadow);cursor:pointer;height:2em;position:absolute;right:var(--spacing);top:var(--spacing);width:2em}.MinimapFooter{color:var(--colorSecondary);font-family:var(--fontFamily);font-size:var(--unit);margin-top:var(--spacing)}.MinimapEditButtons{bottom:26px;display:flex;font-family:var(--fontFamily);position:absolute;right:var(--spacing)}.MinimapEditButtons .Button{box-shadow:var(--boxShadow)}.MinimapButtonCancel{background-color:var(--colorBackground);margin-left:var(--spacing)}.draggable{cursor:move;cursor:grab}.draggable:active{cursor:grabbing}";var $i=M(` | ||
`,fontWeight:"normal",fontWeightSemibold:"600",fontWeightBold:"bold",duration:"150ms",curve:"ease-out"},icons:{close:ii,question:si,marker:ri},images:{styleToggleDefault:Yi,styleToggleSatellite:zi}};function k(r,e={}){let i=h(h({},Pt.variables),e.variables||{}),s=e.cssText||"",n="";for(let[o,l]of Object.entries(i)){if(!Array.isArray(l)){n+=`--${o}: ${l};`;continue}if(l[0]!=="mobile"){let m=JSON.stringify(l);throw new Error(`Unsupported expression in theme variables: ${o} ${m}`)}let[,c,u]=l;s+=`${Xi} { ${r} { --${o}: ${c} !important; } }`,n+=`--${o}: ${u};`}return s+`${r} { ${n} }`}function V(r,e={}){return h(h({},Pt.icons),e.icons||{})[r]}function ni(r,e={}){return h(h({},Pt.images),e.images||{})[r]}var D="*{box-sizing:border-box!important}[role=button]{cursor:pointer}.MapboxSearch{--width:100%}.Results{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);margin-top:var(--spacing)!important;min-width:var(--minWidth);overflow-y:auto;position:absolute;transform:translateZ(0);transition:visibility var(--duration);width:var(--width);z-index:1000}.Results:not([aria-hidden=true]){visibility:visible}.Results[aria-hidden=true]{animation:fadein var(--duration) var(--curve) reverse forwards;visibility:hidden}.Suggestion{padding:var(--padding)}.Suggestion:hover{cursor:pointer}.Suggestion[aria-selected=true]{background-color:var(--colorBackgroundHover)}.Suggestion:active{background-color:var(--colorBackgroundActive)}.SuggestionName{font-weight:var(--fontWeightBold)}.ResultsAttribution{padding:var(--padding)}.ResultsAttribution a{color:var(--colorSecondary)}.ResultsAttribution a:not(:hover){text-decoration:none}.ResultsList{list-style:none;margin:0;padding:0}.Label{display:none}.Input{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--padding);width:100%}.MapboxAddressConfirmation{align-items:center;background-color:var(--colorBackdrop);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;transform:translateZ(0);z-index:1000}.MapboxAddressConfirmation:not([aria-hidden=true]){animation:fadein var(--duration) var(--curve) forwards;visibility:visible}.MapboxAddressConfirmation[aria-hidden=true]{visibility:hidden}.Modal{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--paddingModal);width:var(--minWidth)}@media screen and (max-width:768px){.MapboxAddressConfirmation{align-items:flex-end}.Modal{border-bottom-left-radius:0;border-bottom-right-radius:0;width:100%}}.ModalHeader{align-items:center;color:var(--colorPrimary);display:flex;font-size:var(--unitHeader);font-weight:var(--fontWeightBold);margin-bottom:var(--spacing);user-select:none;width:100%}.ModalMap{height:calc(var(--minWidth) - var(--paddingModal)*2)}.ModalMap[aria-hidden=true]{display:none}.Icon{height:var(--unitHeader);width:var(--unitHeader)}.Icon.IconClose{color:var(--colorSecondary)}.ModalHeaderTitle{flex:1;margin-left:.25em}.ModalFooter{color:var(--colorSecondary);margin-top:var(--spacing);text-align:center}.ModalSubheader{font-weight:var(--fontWeightBold);user-select:none}.ModalAddress,.ModalSubheader{margin-bottom:var(--spacing)}.ModalAddress.ModalAddressApprove{color:var(--colorPrimary)}.Button{border-radius:var(--borderRadius);cursor:pointer;font-weight:var(--fontWeightSemibold);margin-top:var(--spacing);padding:var(--padding);text-align:center;user-select:none;width:100%}.Button[aria-hidden=true]{display:none}.Button.ButtonPrimary{background-color:var(--colorPrimary);color:var(--colorBackground)}.Button.ButtonSecondary{border:1px solid var(--colorSecondary);color:var(--colorSecondary)}@keyframes fadein{0%{opacity:0}to{opacity:1}}.MapboxAddressMinimap{font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight)}.MapboxAddressMinimap[aria-hidden=true]{display:none}.MinimapImageContainer{border-radius:var(--borderRadius);overflow:hidden}.MinimapImage{height:unset;max-height:unset;max-width:unset;position:relative;width:unset}.MinimapInnerFrame{border:var(--border);border-radius:inherit;height:inherit;left:0;overflow:hidden;position:absolute;top:0;width:inherit}.MinimapMarker{left:50%;position:absolute;top:50%}.MinimapMarker>svg{color:var(--colorPrimary);display:block!important}.MinimapAttributionLogo{bottom:0;left:0;margin:0 0 6px 6px;position:absolute}.MinimapAttributionLogo a{cursor:pointer;display:block;height:23px;width:88px}.MinimapAttributionText{background-color:hsla(0,0%,100%,.65);bottom:0;font:11px/16px Helvetica Neue,Arial,Helvetica,sans-serif;padding:0 5px;position:absolute;right:0}.MinimapAttributionText a{color:rgba(0,0,0,.75);text-decoration:none}.MinimapAttributionText a:hover{color:inherit;text-decoration:underline}.MinimapAttributionText a:not(:first-child){margin-left:3px}.MinimapStyleToggle{background-position:0;background-repeat:no-repeat;background-size:contain;border:2px solid #fff;border-radius:3px;box-shadow:var(--boxShadow);cursor:pointer;height:2em;position:absolute;right:var(--spacing);top:var(--spacing);width:2em}.MinimapFooter{color:var(--colorSecondary);font-family:var(--fontFamily);font-size:var(--unit);margin-top:var(--spacing)}.MinimapEditButtons{bottom:26px;display:flex;font-family:var(--fontFamily);position:absolute;right:var(--spacing)}.MinimapEditButtons .Button{box-shadow:var(--boxShadow)}.MinimapButtonCancel{background-color:var(--colorBackground);margin-left:var(--spacing)}.draggable{cursor:move;cursor:grab}.draggable:active{cursor:grabbing}";var Wi=E(` | ||
<template> | ||
@@ -55,3 +55,3 @@ <div class="MapboxSearch"> | ||
</template> | ||
`),Wi=M(` | ||
`),Vi=E(` | ||
<template> | ||
@@ -63,3 +63,3 @@ <div class="Suggestion" role="option"> | ||
</template> | ||
`);function Pt(r,e){return`${r}-${e}`}var ne,C,v,ye,_,oe,ae,Te,ni,R,re,gt,Vi,Se,Ae,Le,ke,Ce,le,V,we,q=class extends w{constructor(){super(...arguments);a(this,Te);a(this,R);a(this,gt);a(this,ne,void 0);a(this,C,null);a(this,v,void 0);a(this,ye,B());a(this,_,B());a(this,oe,void 0);a(this,ae,0);a(this,Se,{});a(this,Ae,{});a(this,Le,e=>{let{Results:i}=t(this,v),s=e.target;if(s.dataset.mapboxSuccess){delete s.dataset.mapboxSuccess;return}let n=s.value;i.setAttribute("aria-busy","true"),this.session.suggest(n,this.options)});a(this,ke,e=>{if(!e||!e.suggestions){b(this,R,re).call(this);return}b(this,gt,Vi).call(this),e.suggestions.length&&b(this,Te,ni).call(this),this.dispatchEvent(new x("suggest",e));let{Results:i}=t(this,v);i.setAttribute("aria-busy","false")});a(this,Ce,e=>{this.dispatchEvent(new x("suggesterror",e));let{Results:i}=t(this,v);i.setAttribute("aria-busy","false"),b(this,R,re).call(this)});a(this,le,()=>{let e=this.input;delete e.dataset.mapboxSuccess,b(this,Te,ni).call(this)});a(this,V,()=>{document.activeElement!==this.input&&(this.session.abort(),b(this,R,re).call(this))});a(this,we,e=>{if(e.key==="Escape"){b(this,R,re).call(this);return}if(e.key==="ArrowUp"){e.preventDefault(),this.selectedIndex=Math.max(0,this.selectedIndex-1);return}if(e.key==="ArrowDown"){e.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,this.suggestions.length-1);return}if(e.key==="Enter"){e.preventDefault(),this.retrieve(this.suggestions[this.selectedIndex]);return}})}get template(){return $i}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxSearch",this.theme)}get session(){return t(this,ne)}set session(e){t(this,ne)&&(e.removeEventListener("suggest",t(this,ke)),e.removeEventListener("suggesterror",t(this,Ce))),e&&(e.addEventListener("suggest",t(this,ke)),e.addEventListener("suggesterror",t(this,Ce))),d(this,ne,e)}get suggestions(){var e;return(e=this.session.suggestions)==null?void 0:e.suggestions}get input(){return t(this,oe)}set input(e){let i=t(this,oe);i&&(i.removeEventListener("input",t(this,Le)),i.removeEventListener("focus",t(this,le)),i.removeEventListener("blur",t(this,V)),i.removeEventListener("keydown",t(this,we)),t(this,C)&&t(this,C).destroy()),e&&(e.addEventListener("input",t(this,Le)),e.addEventListener("focus",t(this,le)),e.addEventListener("blur",t(this,V)),e.addEventListener("keydown",t(this,we)),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls",t(this,_)),this.isConnected&&d(this,C,(0,Ot.createPopper)(e,t(this,v).Results,{placement:"bottom-start"}))),d(this,oe,e)}get selectedIndex(){return t(this,ae)}set selectedIndex(e){let i=t(this,ae);d(this,ae,e);let{ResultsList:s,Label:n}=t(this,v),o=Pt(t(this,_),e);if(this.input.setAttribute("aria-activedescendant",o),s.setAttribute("aria-activedescendant",o),i!==e){let l=Pt(t(this,_),i),c=s.querySelector(`#${l}`);c==null||c.removeAttribute("aria-selected");let m=s.querySelector(`#${o}`);m==null||m.setAttribute("aria-selected","true")}n.textContent=this.suggestions[e].address+`: Suggestion ${e+1} of ${this.suggestions.length}`}renderItem(e){let i=this.prepareTemplate(Wi);return i.id=Pt(t(this,_),e),i}fillItem(e,i,s){let[n,o]=Array.from(e.querySelectorAll('[role="option"] > *'));n.textContent=i.feature_name,o.textContent=i.description,s===this.selectedIndex?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected")}get options(){return t(this,Se)}set options(e){d(this,Se,e)}get theme(){return t(this,Ae)}set theme(e){d(this,Ae,e),!(!t(this,v)||!e)&&this.updateTemplateUserStyle(k(".MapboxSearch",e))}connectedCallback(){super.connectedCallback(),d(this,v,ie(this,{MapboxSearch:".MapboxSearch",Results:".Results",ResultsList:".ResultsList",Label:".Label"}));let{Results:e,ResultsList:i,Label:s}=t(this,v);s.id=t(this,ye),i.id=t(this,_),i.setAttribute("aria-labelledby",t(this,ye)),e.addEventListener("blur",t(this,V)),!t(this,C)&&this.input&&d(this,C,(0,Ot.createPopper)(this.input,t(this,v).Results,{placement:"bottom-start"})),requestAnimationFrame(()=>{t(this,C)&&t(this,C).update()})}disconnectedCallback(){this.input=null;let{Results:e}=t(this,v);e.removeEventListener("blur",t(this,V))}retrieve(e){return j(this,null,function*(){let i=this.input;i&&(i.dataset.mapboxSuccess="true");let s=yield this.session.retrieve(e);b(this,R,re).call(this),this.dispatchEvent(new x("retrieve",s))})}focus(){document.activeElement===this.input?t(this,le).call(this):this.input.focus()}updatePopover(){t(this,C)&&t(this,C).update()}};ne=new WeakMap,C=new WeakMap,v=new WeakMap,ye=new WeakMap,_=new WeakMap,oe=new WeakMap,ae=new WeakMap,Te=new WeakSet,ni=function(){if(!this.suggestions||!this.suggestions.length)return;let{Results:e,MapboxSearch:i}=t(this,v),s=this.input.getBoundingClientRect();i.style.setProperty("--width",`${s.width}px`),this.input.setAttribute("aria-expanded","true"),e.removeAttribute("aria-hidden"),this.selectedIndex=0},R=new WeakSet,re=function(){let{Results:e,ResultsList:i}=t(this,v);e.setAttribute("aria-hidden","true"),this.input.removeAttribute("aria-expanded"),i.removeAttribute("aria-activedescendant"),this.input.removeAttribute("aria-activedescendant")},gt=new WeakSet,Vi=function(){let{ResultsList:e}=t(this,v),i=this.suggestions;if(!i||!i.length){e.innerHTML="",b(this,R,re).call(this);return}let s=Zt(e);if(i.length>s.length)for(let n=s.length;n<i.length;n++){let o=this.renderItem(n);s.push(o),o.onmouseenter=()=>{this.selectedIndex=n},e.appendChild(o)}if(i.length<s.length)for(let n=i.length;n<s.length;n++)s[n].remove();for(let n of i){let o=i.indexOf(n),l=s[o];this.fillItem(l,n,o),l.onclick=()=>{this.retrieve(n)}}},Se=new WeakMap,Ae=new WeakMap,Le=new WeakMap,ke=new WeakMap,Ce=new WeakMap,le=new WeakMap,V=new WeakMap,we=new WeakMap;window.MapboxSearchListbox=q;window.customElements.get("mapbox-search-listbox")||customElements.define("mapbox-search-listbox",q);var Ft=ut(require("no-scroll")),li=require("focus-trap");function oi(r){let e=r.currentTarget;(r.key===" "||r.key==="Enter")&&(r.preventDefault(),r.stopPropagation(),e.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0})))}var qi=M(` | ||
`);function Ot(r,e){return`${r}-${e}`}var ae,C,v,ye,_,le,de,Te,oi,R,oe,gt,qi,Se,Ae,Le,ke,Ce,ce,q,we,G=class extends w{constructor(){super(...arguments);a(this,Te);a(this,R);a(this,gt);a(this,ae,void 0);a(this,C,null);a(this,v,void 0);a(this,ye,B());a(this,_,B());a(this,le,void 0);a(this,de,0);a(this,Se,{});a(this,Ae,{});a(this,Le,e=>{let{Results:i}=t(this,v),s=e.target;if(s.dataset.mapboxSuccess){delete s.dataset.mapboxSuccess;return}let n=s.value;i.setAttribute("aria-busy","true"),this.session.suggest(n,this.options)});a(this,ke,e=>{if(!e||!e.suggestions){x(this,R,oe).call(this);return}x(this,gt,qi).call(this),e.suggestions.length&&x(this,Te,oi).call(this),this.dispatchEvent(new b("suggest",e));let{Results:i}=t(this,v);i.setAttribute("aria-busy","false")});a(this,Ce,e=>{this.dispatchEvent(new b("suggesterror",e));let{Results:i}=t(this,v);i.setAttribute("aria-busy","false"),x(this,R,oe).call(this)});a(this,ce,()=>{let e=this.input;delete e.dataset.mapboxSuccess,x(this,Te,oi).call(this)});a(this,q,()=>{document.activeElement!==this.input&&(this.session.abort(),x(this,R,oe).call(this))});a(this,we,e=>{if(e.key==="Escape"){x(this,R,oe).call(this);return}if(e.key==="ArrowUp"){e.preventDefault(),this.selectedIndex=Math.max(0,this.selectedIndex-1);return}if(e.key==="ArrowDown"){e.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,this.suggestions.length-1);return}if(e.key==="Enter"){e.preventDefault(),this.retrieve(this.suggestions[this.selectedIndex]);return}})}get template(){return Wi}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxSearch",this.theme)}get session(){return t(this,ae)}set session(e){t(this,ae)&&(e.removeEventListener("suggest",t(this,ke)),e.removeEventListener("suggesterror",t(this,Ce))),e&&(e.addEventListener("suggest",t(this,ke)),e.addEventListener("suggesterror",t(this,Ce))),d(this,ae,e)}get suggestions(){var e;return(e=this.session.suggestions)==null?void 0:e.suggestions}get input(){return t(this,le)}set input(e){let i=t(this,le);i&&(i.removeEventListener("input",t(this,Le)),i.removeEventListener("focus",t(this,ce)),i.removeEventListener("blur",t(this,q)),i.removeEventListener("keydown",t(this,we)),t(this,C)&&t(this,C).destroy()),e&&(e.addEventListener("input",t(this,Le)),e.addEventListener("focus",t(this,ce)),e.addEventListener("blur",t(this,q)),e.addEventListener("keydown",t(this,we)),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls",t(this,_)),this.isConnected&&d(this,C,(0,Ft.createPopper)(e,t(this,v).Results,{placement:"bottom-start"}))),d(this,le,e)}get selectedIndex(){return t(this,de)}set selectedIndex(e){let i=t(this,de);d(this,de,e);let{ResultsList:s,Label:n}=t(this,v),o=Ot(t(this,_),e);if(this.input.setAttribute("aria-activedescendant",o),s.setAttribute("aria-activedescendant",o),i!==e){let l=Ot(t(this,_),i),c=s.querySelector(`#${l}`);c==null||c.removeAttribute("aria-selected");let u=s.querySelector(`#${o}`);u==null||u.setAttribute("aria-selected","true")}n.textContent=this.suggestions[e].address+`: Suggestion ${e+1} of ${this.suggestions.length}`}renderItem(e){let i=this.prepareTemplate(Vi);return i.id=Ot(t(this,_),e),i}fillItem(e,i,s){let[n,o]=Array.from(e.querySelectorAll('[role="option"] > *'));n.textContent=i.feature_name,o.textContent=i.description,s===this.selectedIndex?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected")}get options(){return t(this,Se)}set options(e){d(this,Se,e)}get theme(){return t(this,Ae)}set theme(e){d(this,Ae,e),!(!t(this,v)||!e)&&this.updateTemplateUserStyle(k(".MapboxSearch",e))}connectedCallback(){super.connectedCallback(),d(this,v,re(this,{MapboxSearch:".MapboxSearch",Results:".Results",ResultsList:".ResultsList",Label:".Label"}));let{Results:e,ResultsList:i,Label:s}=t(this,v);s.id=t(this,ye),i.id=t(this,_),i.setAttribute("aria-labelledby",t(this,ye)),e.addEventListener("blur",t(this,q)),!t(this,C)&&this.input&&d(this,C,(0,Ft.createPopper)(this.input,t(this,v).Results,{placement:"bottom-start"})),requestAnimationFrame(()=>{t(this,C)&&t(this,C).update()})}disconnectedCallback(){this.input=null;let{Results:e}=t(this,v);e.removeEventListener("blur",t(this,q))}retrieve(e){return j(this,null,function*(){let i=this.input;i&&(i.dataset.mapboxSuccess="true");let s=yield this.session.retrieve(e);x(this,R,oe).call(this),this.dispatchEvent(new b("retrieve",s))})}focus(){document.activeElement===this.input?t(this,ce).call(this):this.input.focus()}updatePopover(){t(this,C)&&t(this,C).update()}};ae=new WeakMap,C=new WeakMap,v=new WeakMap,ye=new WeakMap,_=new WeakMap,le=new WeakMap,de=new WeakMap,Te=new WeakSet,oi=function(){if(!this.suggestions||!this.suggestions.length)return;let{Results:e,MapboxSearch:i}=t(this,v),s=this.input.getBoundingClientRect();i.style.setProperty("--width",`${s.width}px`),this.input.setAttribute("aria-expanded","true"),e.removeAttribute("aria-hidden"),this.selectedIndex=0},R=new WeakSet,oe=function(){let{Results:e,ResultsList:i}=t(this,v);e.setAttribute("aria-hidden","true"),this.input.removeAttribute("aria-expanded"),i.removeAttribute("aria-activedescendant"),this.input.removeAttribute("aria-activedescendant")},gt=new WeakSet,qi=function(){let{ResultsList:e}=t(this,v),i=this.suggestions;if(!i||!i.length){e.innerHTML="",x(this,R,oe).call(this);return}let s=Jt(e);if(i.length>s.length)for(let n=s.length;n<i.length;n++){let o=this.renderItem(n);s.push(o),o.onmouseenter=()=>{this.selectedIndex=n},e.appendChild(o)}if(i.length<s.length)for(let n=i.length;n<s.length;n++)s[n].remove();for(let n of i){let o=i.indexOf(n),l=s[o];this.fillItem(l,n,o),l.onclick=()=>{this.retrieve(n)}}},Se=new WeakMap,Ae=new WeakMap,Le=new WeakMap,ke=new WeakMap,Ce=new WeakMap,ce=new WeakMap,q=new WeakMap,we=new WeakMap;window.MapboxSearchListbox=G;window.customElements.get("mapbox-search-listbox")||customElements.define("mapbox-search-listbox",G);var jt=mt(require("no-scroll")),di=require("focus-trap");function ai(r){let e=r.currentTarget;(r.key===" "||r.key==="Enter")&&(r.preventDefault(),r.stopPropagation(),e.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0})))}var Gi=E(` | ||
<template> | ||
@@ -118,3 +118,3 @@ <div class="MapboxAddressConfirmation" aria-hidden="true"> | ||
</template> | ||
`);function ai(r){let e=M(` | ||
`);function li(r){let e=E(` | ||
<span> | ||
@@ -125,7 +125,7 @@ <span></span> | ||
</span> | ||
`),[i,s]=Array.from(e.querySelectorAll("span > span")),n=r.split(",");return i.textContent=n[0].trim(),s.textContent=n.slice(1).join(",").trim(),e}var de,E,G,Ie,He,Be,Re,Pe,Oe=class extends w{constructor(){super(...arguments);a(this,de,!1);a(this,E,void 0);a(this,G,void 0);a(this,Ie,{});a(this,He,()=>{this.dispatchEvent(new x("close")),this.hide()});this.approve=()=>{this.dispatchEvent(new x("approve")),this.hide()};this.reject=()=>{this.dispatchEvent(new x("reject")),this.hide()};a(this,Be,B());a(this,Re,B());a(this,Pe,B())}get template(){return qi}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxAddressConfirmation",this.theme)}get theme(){return t(this,Ie)}set theme(e){if(d(this,Ie,e),!t(this,E)||!e)return;this.updateTemplateUserStyle(k(".MapboxAddressConfirmation",e));let{IconQuestion:i,IconClose:s}=t(this,E);i.innerHTML=W("question",e),s.innerHTML=W("close",e)}connectedCallback(){super.connectedCallback(),d(this,E,ie(this,{MapboxAddressConfirmation:".MapboxAddressConfirmation",Modal:".Modal",ModalHeaderTitle:".ModalHeaderTitle",ModalMap:".ModalMap",Minimap:".Minimap",IconQuestion:".IconQuestion",IconClose:".IconClose",ButtonApprove:".ButtonApprove",ButtonReject:".ButtonReject",ModalAddressApprove:".ModalAddressApprove",ModalAddressReject:".ModalAddressReject"}));let{MapboxAddressConfirmation:e,Modal:i,ModalHeaderTitle:s,IconClose:n,ButtonApprove:o,ButtonReject:l,ModalAddressApprove:c}=t(this,E);i.setAttribute("aria-labelledby",t(this,Re)),i.setAttribute("aria-describedby",t(this,Pe)),n.setAttribute("aria-controls",t(this,Be)),i.id=t(this,Be),s.id=t(this,Re),c.id=t(this,Pe);let m=Array.from(this.querySelectorAll('[role="button"]'));for(let f of m)f.addEventListener("keydown",oi);n.addEventListener("click",t(this,He)),o.addEventListener("click",this.approve),l.addEventListener("click",this.reject),t(this,de)?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true");let u=this.theme;if(u){let{IconQuestion:f,IconClose:A}=t(this,E);f.innerHTML=W("question",u),A.innerHTML=W("close",u)}}disconnectedCallback(){let{IconClose:e,ButtonApprove:i,ButtonReject:s}=t(this,E);e.removeEventListener("click",t(this,He)),i.removeEventListener("click",this.approve),s.removeEventListener("click",this.reject),d(this,G,null)}hide(){var i;if(d(this,de,!1),!t(this,E))return;let{MapboxAddressConfirmation:e}=t(this,E);e.setAttribute("aria-hidden","true"),(i=t(this,G))==null||i.deactivate(),Ft.default.off()}show(e,i,s=null,n="",o=!1){var F;if(d(this,de,!0),!t(this,E))return;let{MapboxAddressConfirmation:l,Modal:c,ModalMap:m,Minimap:u,ModalAddressApprove:f,ModalAddressReject:A}=t(this,E);l.removeAttribute("aria-hidden"),o?(m.removeAttribute("aria-hidden"),u.accessToken=n,u.feature=s):m.setAttribute("aria-hidden","true"),f.innerHTML="",f.appendChild(ai(e)),A.innerHTML="",A.appendChild(ai(i)),Ft.default.on(),d(this,G,(0,li.createFocusTrap)(l,{fallbackFocus:c,escapeDeactivates:()=>(this.hide(),!0)})),(F=t(this,G))==null||F.activate()}};de=new WeakMap,E=new WeakMap,G=new WeakMap,Ie=new WeakMap,He=new WeakMap,Be=new WeakMap,Re=new WeakMap,Pe=new WeakMap;window.MapboxAddressConfirmation=Oe;window.customElements.get("mapbox-address-confirmation")||customElements.define("mapbox-address-confirmation",Oe);var P=require("@mapbox/search-js-core");var Gi=new Set(["street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code"]),Ki=new Set(["off","on","true","false"]);function jt(r){let e=r.parentNode;for(;e;){if(e instanceof HTMLFormElement)return e;e=e.parentNode}return null}var Zi="section-",Ji=Symbol.for("section--default"),Qi=Symbol.for("section--shipping"),es=Symbol.for("section--billing");function ts(r){let e=Array.from(r.querySelectorAll("[autocomplete]")).filter(s=>{let n=s.tagName.toLowerCase();return n==="input"||n==="select"||n==="textarea"}),i=[];for(let s of e){if(!Qt(s))continue;let n=s.getAttribute("autocomplete")||"";if(!n||Ki.has(n))continue;let o=n.toLowerCase().split(" ");if(o.length>3)continue;let l=o[o.length-1];if(!Gi.has(l))continue;o.pop();let c=Ji;if(o.length){let m=o[o.length-1];m==="shipping"&&(c=Qi,o.pop()),m==="billing"&&(c=es,o.pop())}if(o.length){let m=o[o.length-1];m.startsWith(Zi)&&(c=m)}i.push({input:s,section:c,field:l})}return i}function di(r,e){let i=[],s=[],n=ts(r),o=null;for(let{input:l,section:c,field:m}of n){let u=i.length-1,f=!1;if(i.length?(s[u]!==c||i[u][m])&&(f=!0):f=!0,f){if(o)break;i.push({[m]:l}),s.push(c),u++}else i[u][m]=l;l===e&&(o=i[u])}return o!=null?o:{}}function Dt(r,e,i){var l;let s=di(r,e),n=[i.address_line1,i.address_line2,i.address_line3].filter(c=>Boolean(c)).join(", ");L(s["street-address"],n),L(s["address-line1"],i.address_line1||""),L(s["address-line2"],i.address_line2||""),L(s["address-line3"],i.address_line3||""),L(s["address-level1"],i.address_level1||""),L(s["address-level2"],i.address_level2||""),L(s["address-level3"],i.address_level3||"");let o=((l=i.metadata)==null?void 0:l.iso_3166_1)||"";if(s.country&&s.country instanceof HTMLSelectElement){let c=s.country.querySelector("option").value,m=c===c.toUpperCase();L(s.country,m?o.toUpperCase():o)}else L(s.country,o);L(s["country-name"],i.country||""),L(s["postal-code"],i.postcode||"")}function _t(r,e){let i=di(r,e),s={};for(let[n,o]of Object.entries(i))(o==null?void 0:o.value)&&(s[n]=o.value);return s}function ci(r){let e=[];return r["street-address"]?e.push(r["street-address"]):(e.push(r["address-line1"]||""),e.push(r["address-line2"]||""),e.push(r["address-line3"]||"")),e.push(r["address-level3"]||""),e.push(r["address-level2"]||""),e.push(r["address-level1"]||""),e.push(r["postal-code"]||""),r["country-name"]?e.push(r["country-name"]):e.push(r.country||""),e.filter(i=>Boolean(i)).join(", ")}var N,ft,y,h,I,Fe,je,De,_e,Ne,ze,Ye,z=class extends w{constructor(){super(...arguments);a(this,N,new P.MapboxAutofill);a(this,ft,new P.SearchSession(t(this,N)));a(this,y,void 0);a(this,h,new q);a(this,I,new Oe);a(this,Fe,!1);a(this,je,e=>{this.dispatchEvent(e.clone())});a(this,De,e=>{this.dispatchEvent(e.clone())});a(this,_e,null);a(this,Ne,e=>{if(this.dispatchEvent(e.clone()),!t(this,y))return;let i=e.detail;if(!i||!i.features||!i.features.length)return;let s=jt(t(this,y));if(!s)return;let n=(0,P.featureToSuggestion)(i.features[0]);Dt(s,t(this,y),n),d(this,_e,_t(s,t(this,y)))});a(this,ze,()=>{var e;try{let i=(e=this.querySelector("input"))!=null?e:null;d(this,y,i),t(this,h).input=i}catch(i){d(this,y,null),t(this,h).input=null,console.error(i.message||i)}});a(this,Ye,new MutationObserver(t(this,ze)))}get accessToken(){return t(this,N).accessToken}set accessToken(e){t(this,N).accessToken=e}get options(){return t(this,h).options}set options(e){t(this,h).options=e}get theme(){return t(this,h).theme}set theme(e){t(this,h).theme=e,t(this,I).theme=e}connectedCallback(){super.connectedCallback(),t(this,h).session=t(this,ft),t(this,h).addEventListener("suggest",t(this,je)),t(this,h).addEventListener("suggesterror",t(this,De)),t(this,h).addEventListener("retrieve",t(this,Ne)),document.body.appendChild(t(this,h)),document.body.appendChild(t(this,I)),t(this,Ye).observe(this,{subtree:!0,childList:!0}),t(this,ze).call(this)}disconnectedCallback(){t(this,I).remove(),t(this,h).remove(),t(this,h).removeEventListener("suggest",t(this,je)),t(this,h).removeEventListener("suggesterror",t(this,De)),t(this,h).removeEventListener("retrieve",t(this,Ne)),t(this,Ye).disconnect()}attributeChangedCallback(e,i,s){if(e==="access-token"){t(this,N).accessToken=s;return}if(e==="theme"){this.theme=ht(s);return}if(e==="minimap-on-confirm"){d(this,Fe,s==="true");return}let n=e.split("-").join("_");s||delete t(this,h).options[n],t(this,h).options[n]=s}focus(){t(this,h).focus()}showConfirm(){return j(this,null,function*(){let e=jt(t(this,y));if(!e)throw new Error("Could not find parent form.");let i=t(this,_e),s=_t(e,t(this,y));if(Ee(s,i))return!0;let n=t(this,N),o=ci(s),l=yield n.retrieve(o,{sessionToken:new P.SessionToken});if(!l||!l.features||!l.features.length)throw new Error("Could not find suggestion.");let c=l.features[0];return t(this,I).show(c.place_name||c.properties.full_address||c.properties.address,o,c,n.accessToken,t(this,Fe)),new Promise(m=>{let u=f=>{t(this,I).removeEventListener("approve",u),t(this,I).removeEventListener("reject",u);let A=f.type==="approve";if(A){let F=(0,P.featureToSuggestion)(c);t(this,y).dataset.mapboxSuccess="true",Dt(e,t(this,y),F)}m(A)};t(this,I).addEventListener("approve",u),t(this,I).addEventListener("reject",u)})})}};N=new WeakMap,ft=new WeakMap,y=new WeakMap,h=new WeakMap,I=new WeakMap,Fe=new WeakMap,je=new WeakMap,De=new WeakMap,_e=new WeakMap,Ne=new WeakMap,ze=new WeakMap,Ye=new WeakMap,z.observedAttributes=["access-token","theme","css-text","minimap-on-confirm","language","country","bbox","limit","proximity"];window.MapboxAddressAutofill=z;window.customElements.get("mapbox-address-autofill")||customElements.define("mapbox-address-autofill",z);var O=require("@mapbox/search-js-core"),ui=ut(require("@turf/bbox")),pi=ut(require("@turf/bbox-polygon"));var Nt=1.4;function zt(r,e,i=.5){let{center:s,zoom:n}=r.cameraForBounds(e),o=Math.max(n-i,0);return{center:s,zoom:o,speed:Nt}}function mi(r){switch(r){case"street":return 15;case"locality":case"oaza":return 14;case"place":case"city":return 13;case"district":return 9;case"region":case"prefecture":return 6;case"country":return 4;default:return 16}}function vt(r,e){return`https://api.mapbox.com/styles/v1/${r}/${e}/static/`}var is=9,ss=M(` | ||
`),[i,s]=Array.from(e.querySelectorAll("span > span")),n=r.split(",");return i.textContent=n[0].trim(),s.textContent=n.slice(1).join(",").trim(),e}var ue,y,K,Ie,He,Be,Re,Pe,Oe=class extends w{constructor(){super(...arguments);a(this,ue,!1);a(this,y,void 0);a(this,K,void 0);a(this,Ie,{});a(this,He,()=>{this.dispatchEvent(new b("close")),this.hide()});this.approve=()=>{this.dispatchEvent(new b("approve")),this.hide()};this.reject=()=>{this.dispatchEvent(new b("reject")),this.hide()};a(this,Be,B());a(this,Re,B());a(this,Pe,B())}get template(){return Gi}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxAddressConfirmation",this.theme)}get theme(){return t(this,Ie)}set theme(e){if(d(this,Ie,e),!t(this,y)||!e)return;this.updateTemplateUserStyle(k(".MapboxAddressConfirmation",e));let{IconQuestion:i,IconClose:s}=t(this,y);i.innerHTML=V("question",e),s.innerHTML=V("close",e)}connectedCallback(){super.connectedCallback(),d(this,y,re(this,{MapboxAddressConfirmation:".MapboxAddressConfirmation",Modal:".Modal",ModalHeaderTitle:".ModalHeaderTitle",ModalMap:".ModalMap",Minimap:".Minimap",IconQuestion:".IconQuestion",IconClose:".IconClose",ButtonApprove:".ButtonApprove",ButtonReject:".ButtonReject",ModalAddressApprove:".ModalAddressApprove",ModalAddressReject:".ModalAddressReject"}));let{MapboxAddressConfirmation:e,Modal:i,ModalHeaderTitle:s,IconClose:n,ButtonApprove:o,ButtonReject:l,ModalAddressApprove:c}=t(this,y);i.setAttribute("aria-labelledby",t(this,Re)),i.setAttribute("aria-describedby",t(this,Pe)),n.setAttribute("aria-controls",t(this,Be)),i.id=t(this,Be),s.id=t(this,Re),c.id=t(this,Pe);let u=Array.from(this.querySelectorAll('[role="button"]'));for(let f of u)f.addEventListener("keydown",ai);n.addEventListener("click",t(this,He)),o.addEventListener("click",this.approve),l.addEventListener("click",this.reject),t(this,ue)?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true");let m=this.theme;if(m){let{IconQuestion:f,IconClose:A}=t(this,y);f.innerHTML=V("question",m),A.innerHTML=V("close",m)}}disconnectedCallback(){let{IconClose:e,ButtonApprove:i,ButtonReject:s}=t(this,y);e.removeEventListener("click",t(this,He)),i.removeEventListener("click",this.approve),s.removeEventListener("click",this.reject),d(this,K,null)}hide(){var i;if(d(this,ue,!1),!t(this,y))return;let{MapboxAddressConfirmation:e}=t(this,y);e.setAttribute("aria-hidden","true"),(i=t(this,K))==null||i.deactivate(),jt.default.off()}show(e,i,s=null,n="",o=!1){var F;if(d(this,ue,!0),!t(this,y))return;let{MapboxAddressConfirmation:l,Modal:c,ModalMap:u,Minimap:m,ModalAddressApprove:f,ModalAddressReject:A}=t(this,y);l.removeAttribute("aria-hidden"),o?(u.removeAttribute("aria-hidden"),m.accessToken=n,m.feature=s):u.setAttribute("aria-hidden","true"),f.innerHTML="",f.appendChild(li(e)),A.innerHTML="",A.appendChild(li(i)),jt.default.on(),d(this,K,(0,di.createFocusTrap)(l,{fallbackFocus:c,escapeDeactivates:()=>(this.hide(),!0)})),(F=t(this,K))==null||F.activate()}};ue=new WeakMap,y=new WeakMap,K=new WeakMap,Ie=new WeakMap,He=new WeakMap,Be=new WeakMap,Re=new WeakMap,Pe=new WeakMap;window.MapboxAddressConfirmation=Oe;window.customElements.get("mapbox-address-confirmation")||customElements.define("mapbox-address-confirmation",Oe);var P=require("@mapbox/search-js-core");var Ki=new Set(["street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code"]),Zi=new Set(["off","on","true","false"]);function Dt(r){let e=r.parentNode;for(;e;){if(e instanceof HTMLFormElement)return e;e=e.parentNode}return null}var Ji="section-",Qi=Symbol.for("section--default"),es=Symbol.for("section--shipping"),ts=Symbol.for("section--billing");function is(r){let e=Array.from(r.querySelectorAll("[autocomplete]")).filter(s=>{let n=s.tagName.toLowerCase();return n==="input"||n==="select"||n==="textarea"}),i=[];for(let s of e){if(!ei(s))continue;let n=s.getAttribute("autocomplete")||"";if(!n||Zi.has(n))continue;let o=n.toLowerCase().split(" ");if(o.length>3)continue;let l=o[o.length-1];if(!Ki.has(l))continue;o.pop();let c=Qi;if(o.length){let u=o[o.length-1];u==="shipping"&&(c=es,o.pop()),u==="billing"&&(c=ts,o.pop())}if(o.length){let u=o[o.length-1];u.startsWith(Ji)&&(c=u)}i.push({input:s,section:c,field:l})}return i}function ci(r,e){let i=[],s=[],n=is(r),o=null;for(let{input:l,section:c,field:u}of n){let m=i.length-1,f=!1;if(i.length?(s[m]!==c||i[m][u])&&(f=!0):f=!0,f){if(o)break;i.push({[u]:l}),s.push(c),m++}else i[m][u]=l;l===e&&(o=i[m])}return o!=null?o:{}}function _t(r,e,i){var l;let s=ci(r,e),n=[i.address_line1,i.address_line2,i.address_line3].filter(c=>Boolean(c)).join(", ");L(s["street-address"],n),L(s["address-line1"],i.address_line1||""),L(s["address-line2"],i.address_line2||""),L(s["address-line3"],i.address_line3||""),L(s["address-level1"],i.address_level1||""),L(s["address-level2"],i.address_level2||""),L(s["address-level3"],i.address_level3||"");let o=((l=i.metadata)==null?void 0:l.iso_3166_1)||"";if(s.country&&s.country instanceof HTMLSelectElement){let c=s.country.querySelector("option").value,u=c===c.toUpperCase();L(s.country,u?o.toUpperCase():o)}else L(s.country,o);L(s["country-name"],i.country||""),L(s["postal-code"],i.postcode||"")}function Nt(r,e){let i=ci(r,e),s={};for(let[n,o]of Object.entries(i))(o==null?void 0:o.value)&&(s[n]=o.value);return s}function ui(r){let e=[];return r["street-address"]?e.push(r["street-address"]):(e.push(r["address-line1"]||""),e.push(r["address-line2"]||""),e.push(r["address-line3"]||"")),e.push(r["address-level3"]||""),e.push(r["address-level2"]||""),e.push(r["address-level1"]||""),e.push(r["postal-code"]||""),r["country-name"]?e.push(r["country-name"]):e.push(r.country||""),e.filter(i=>Boolean(i)).join(", ")}var N,ft,T,g,I,Fe,je,De,_e,Ne,ze,Ye,z=class extends w{constructor(){super(...arguments);a(this,N,new P.MapboxAutofill);a(this,ft,new P.SearchSession(t(this,N)));a(this,T,void 0);a(this,g,new G);a(this,I,new Oe);a(this,Fe,!1);a(this,je,e=>{this.dispatchEvent(e.clone())});a(this,De,e=>{this.dispatchEvent(e.clone())});a(this,_e,null);a(this,Ne,e=>{if(this.dispatchEvent(e.clone()),!t(this,T))return;let i=e.detail;if(!i||!i.features||!i.features.length)return;let s=Dt(t(this,T));if(!s)return;let n=(0,P.featureToSuggestion)(i.features[0]);_t(s,t(this,T),n),d(this,_e,Nt(s,t(this,T)))});a(this,ze,()=>{var e;try{let i=(e=this.querySelector("input"))!=null?e:null;d(this,T,i),t(this,g).input=i}catch(i){d(this,T,null),t(this,g).input=null,console.error(i.message||i)}});a(this,Ye,new MutationObserver(t(this,ze)))}get accessToken(){return t(this,N).accessToken}set accessToken(e){t(this,N).accessToken=e}get options(){return t(this,g).options}set options(e){t(this,g).options=e}get theme(){return t(this,g).theme}set theme(e){t(this,g).theme=e,t(this,I).theme=e}connectedCallback(){super.connectedCallback(),t(this,g).session=t(this,ft),t(this,g).addEventListener("suggest",t(this,je)),t(this,g).addEventListener("suggesterror",t(this,De)),t(this,g).addEventListener("retrieve",t(this,Ne)),document.body.appendChild(t(this,g)),document.body.appendChild(t(this,I)),t(this,Ye).observe(this,{subtree:!0,childList:!0}),t(this,ze).call(this)}disconnectedCallback(){t(this,I).remove(),t(this,g).remove(),t(this,g).removeEventListener("suggest",t(this,je)),t(this,g).removeEventListener("suggesterror",t(this,De)),t(this,g).removeEventListener("retrieve",t(this,Ne)),t(this,Ye).disconnect()}attributeChangedCallback(e,i,s){if(e==="access-token"){t(this,N).accessToken=s;return}if(e==="theme"){this.theme=ht(s);return}if(e==="minimap-on-confirm"){d(this,Fe,s==="true");return}let n=e.split("-").join("_");s||delete t(this,g).options[n],t(this,g).options[n]=s}focus(){t(this,g).focus()}showConfirm(){return j(this,null,function*(){let e=Dt(t(this,T));if(!e)throw new Error("Could not find parent form.");let i=t(this,_e),s=Nt(e,t(this,T));if(Ee(s,i))return!0;let n=t(this,N),o=ui(s),l=yield n.retrieve(o,{sessionToken:new P.SessionToken});if(!l||!l.features||!l.features.length)throw new Error("Could not find suggestion.");let c=l.features[0];return t(this,I).show(c.place_name||c.properties.full_address||c.properties.address,o,c,n.accessToken,t(this,Fe)),new Promise(u=>{let m=f=>{t(this,I).removeEventListener("approve",m),t(this,I).removeEventListener("reject",m);let A=f.type==="approve";if(A){let F=(0,P.featureToSuggestion)(c);t(this,T).dataset.mapboxSuccess="true",_t(e,t(this,T),F)}u(A)};t(this,I).addEventListener("approve",m),t(this,I).addEventListener("reject",m)})})}};N=new WeakMap,ft=new WeakMap,T=new WeakMap,g=new WeakMap,I=new WeakMap,Fe=new WeakMap,je=new WeakMap,De=new WeakMap,_e=new WeakMap,Ne=new WeakMap,ze=new WeakMap,Ye=new WeakMap,z.observedAttributes=["access-token","theme","css-text","minimap-on-confirm","language","country","bbox","limit","proximity"];window.MapboxAddressAutofill=z;window.customElements.get("mapbox-address-autofill")||customElements.define("mapbox-address-autofill",z);var O=require("@mapbox/search-js-core"),pi=mt(require("@turf/bbox")),hi=mt(require("@turf/bbox-polygon"));var zt=1.4;function Yt(r,e,i=.5){let{center:s,zoom:n}=r.cameraForBounds(e),o=Math.max(n-i,0);return{center:s,zoom:o,speed:zt}}function mi(r){switch(r){case"street":return 15;case"locality":case"oaza":return 14;case"place":case"city":return 13;case"district":return 9;case"region":case"prefecture":return 6;case"country":return 4;default:return 16}}function vt(r,e){return`https://api.mapbox.com/styles/v1/${r}/${e}/static/`}var ss=9,rs=E(` | ||
<template> | ||
<input class="Input" type="text" /> | ||
</template> | ||
`),K,bt,Y,ce,p,Ue,Xe,$e,We,me=class extends w{constructor(){super(...arguments);a(this,K,new O.MapboxSearch({}));a(this,bt,new O.SearchSession(t(this,K)));a(this,Y,null);a(this,ce,void 0);a(this,p,new q);a(this,Ue,e=>{this.dispatchEvent(e.clone())});a(this,Xe,e=>{this.dispatchEvent(e.clone())});a(this,$e,e=>j(this,null,function*(){var m;this.dispatchEvent(e.clone());let i=e.detail;if(!i||!i.features.length)return;let s=(0,O.featureToSuggestion)(i.features[0]);t(this,ce).value=s.feature_name;let n=t(this,Y);if(!n)return;let o=i.features;if(o.length===1){let u=o[0],f=(m=u.properties.place_type)==null?void 0:m[0],A=u.bbox;if(A)n.flyTo(zt(n,O.LngLatBounds.convert(A).toFlatArray()));else{let F=u.geometry.coordinates,Ut=mi(f);n.flyTo({center:F,zoom:Ut,speed:Nt})}return}let l=i.features.map(u=>u.bbox?(0,pi.default)(O.LngLatBounds.convert(u.bbox).toFlatArray()):u),c=(0,ui.default)({type:"FeatureCollection",features:l});n.flyTo(zt(n,c))}));a(this,We,()=>{let e=t(this,Y),i=g({},t(this,p).options);if(e.getZoom()<=is){delete i.proximity,t(this,p).options=i;return}let s=e.getCenter();t(this,p).options=Vt(g({},i),{proximity:s})})}get accessToken(){return t(this,K).accessToken}set accessToken(e){t(this,K).accessToken=e}get template(){return ss}get templateStyle(){return D}get templateUserStyle(){return k(".Input",t(this,p).theme)}get options(){return t(this,p).options}set options(e){t(this,p).options=e}get theme(){return t(this,p).theme}set theme(e){t(this,p).theme=e,!!t(this,ce)&&(this.updateTemplateUserStyle(k(".Input",e)),t(this,p).updatePopover())}connectedCallback(){super.connectedCallback();let e=this.querySelector(".Input");d(this,ce,e),t(this,p).session=t(this,bt),t(this,p).input=e,t(this,p).addEventListener("suggest",t(this,Ue)),t(this,p).addEventListener("suggesterror",t(this,Xe)),t(this,p).addEventListener("retrieve",t(this,$e)),document.body.appendChild(t(this,p))}disconnectedCallback(){t(this,p).remove(),t(this,p).input=null,t(this,p).removeEventListener("suggest",t(this,Ue)),t(this,p).removeEventListener("suggesterror",t(this,Xe)),t(this,p).removeEventListener("retrieve",t(this,$e))}attributeChangedCallback(e,i,s){if(e==="access-token"){t(this,K).accessToken=s;return}if(e==="theme"){this.theme=ht(s);return}let n=e.split("-").join("_");s||delete t(this,p).options[n],t(this,p).options[n]=s}focus(){t(this,p).focus()}bindMap(e){t(this,Y)&&t(this,Y).off("moveend",t(this,We)),e&&e.on("moveend",t(this,We)),d(this,Y,e)}unbindMap(){this.bindMap(null)}onAdd(e){this.bindMap(e),this.remove();let i=document.createElement("div");return i.className="mapboxgl-ctrl",i.style.width="300px",i.appendChild(this),i}onRemove(){this.remove(),this.unbindMap()}getDefaultPosition(){return"top-right"}};K=new WeakMap,bt=new WeakMap,Y=new WeakMap,ce=new WeakMap,p=new WeakMap,Ue=new WeakMap,Xe=new WeakMap,$e=new WeakMap,We=new WeakMap,me.observedAttributes=["access-token","theme","language","country","bbox","limit","navigation-profile","origin","proximity","eta-type","types"];window.MapboxSearchBox=me;window.customElements.get("mapbox-search-box")||customElements.define("mapbox-search-box",me);var xi=require("@mapbox/search-js-core");var fi=ut(require("@mapbox/sphericalmercator"));var hi=new fi.default({size:512,antimeridian:!0}),Q=1280,Ve,Mt,Z,qe,xt,Ge,Ke,Et,Ze,Je,J,yt,Yt=class{constructor(e,i,s,n,o){a(this,Ve,void 0);a(this,Mt,()=>{[this.anchorOffsetX,this.anchorOffsetY]=gi(this.markerElement,this.anchor),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}});a(this,Z,{anchorX:0,anchorY:0,globalX:0,globalY:0});a(this,qe,!1);a(this,xt,e=>{!this.isActive||(e.preventDefault(),e.stopPropagation(),t(this,J).call(this,e),window.addEventListener("pointermove",t(this,Ke)),window.addEventListener("pointerup",t(this,Ge)))});a(this,Ge,()=>{window.removeEventListener("pointermove",t(this,Ke)),window.removeEventListener("pointerup",t(this,Ge))});a(this,Ke,e=>{e.preventDefault(),e.stopPropagation();let i=this.curPointerXPos-e.pageX,s=this.curPointerYPos-e.pageY;this.markerDeltaX+=i,this.markerDeltaY-=s,this.markerDeltaX=Math.max(Math.min(this.imgWidth/2,this.markerDeltaX),this.imgWidth/2*-1),this.markerDeltaY=Math.max(Math.min(this.imgHeight/2,this.markerDeltaY),this.imgHeight/2*-1);let n=this.imgCenterPx[0]-this.imgCenterAdjustedPx[0],o=this.imgCenterPx[1]-this.imgCenterAdjustedPx[1],l=this.markerDeltaX-n,c=this.markerDeltaY+o;this.markerTransform={globalX:l,globalY:c},t(this,J).call(this,e)});a(this,Et,e=>{!this.isActive||(e.preventDefault(),e.stopPropagation(),t(this,J).call(this,e),window.addEventListener("pointermove",t(this,Je)),window.addEventListener("pointerup",t(this,Ze)))});a(this,Ze,()=>{window.removeEventListener("pointermove",t(this,Je)),window.removeEventListener("pointerup",t(this,Ze))});a(this,Je,e=>{e.preventDefault();let i=Math.round(this.imgContainerElement.scrollTop+(this.curPointerYPos-e.pageY));i=Math.max(Math.min(this.imgHeight-this.imgContainerElement.clientHeight,i),0);let s=Math.round(this.imgContainerElement.scrollLeft+(this.curPointerXPos-e.pageX));s=Math.max(Math.min(this.imgWidth-this.imgContainerElement.clientWidth,s),0),this.imgContainerElement.scrollTop=i,this.imgContainerElement.scrollLeft=s;let n=Math.round(s-(this.imgWidth-this.imgContainerElement.clientWidth)/2),o=Math.round((this.imgHeight-this.imgContainerElement.clientHeight)/2-i);if(this.imgCenterAdjustedPx=[this.imgCenterPx[0]+n,this.imgCenterPx[1]-o],!this.keepMarkerCentered){let l=this.markerDeltaX+n,c=this.markerDeltaY+o;this.markerTransform={globalX:l,globalY:c}}t(this,J).call(this,e)});a(this,J,e=>{this.curPointerXPos=e.pageX,this.curPointerYPos=e.pageY});a(this,yt,()=>{let{anchorX:e,anchorY:i,globalX:s,globalY:n}=t(this,Z),o=e-s,l=i+n;this.markerElement.style.transform=`translate(calc(-50% + ${o}px), calc(-50% + ${l}px))`});this.reCenter=()=>{let e=(this.imgHeight-this.imgContainerElement.clientHeight)/2,i=(this.imgWidth-this.imgContainerElement.clientWidth)/2;this.imgContainerElement.scrollTop=e,this.imgContainerElement.scrollLeft=i,this.imgCenterAdjustedPx=this.imgCenterPx,this.markerDeltaX=this.markerDeltaY=0,this.markerTransform={globalX:0,globalY:0}};this.markerElement=i,this.imgContainerElement=e,this.keepMarkerCentered=s,this.zoom=n,this.anchor=o,this.curPointerXPos=0,this.curPointerYPos=0,this.markerDeltaX=0,this.markerDeltaY=0,this.imgContainerElement.addEventListener("pointerdown",t(this,Et)),this.keepMarkerCentered||this.markerElement.addEventListener("pointerdown",t(this,xt)),new ResizeObserver(t(this,Mt)).observe(this.markerElement)}get anchor(){return t(this,Ve)}set anchor(e){d(this,Ve,e),[this.anchorOffsetX,this.anchorOffsetY]=gi(this.markerElement,e),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}}get markerTransform(){return t(this,Z)}set markerTransform(e){d(this,Z,g(g({},t(this,Z)),e)),t(this,yt).call(this)}get isActive(){return t(this,qe)}set isActive(e){this.imgContainerElement.style.touchAction=e?"none":"",d(this,qe,e)}get imgHeight(){return Math.min(this.imgContainerElement.clientHeight*2,Q)}get imgWidth(){return Math.min(this.imgContainerElement.clientWidth*2,Q)}get coordinate(){let e=this.keepMarkerCentered?this.imgCenterAdjustedPx:[this.imgCenterPx[0]-this.markerDeltaX,this.imgCenterPx[1]+this.markerDeltaY],i=hi.ll(e,this.zoom);return[Ht(i[0],6),Ht(i[1],6)]}set coordinate(e){this.imgCenterPx=this.imgCenterAdjustedPx=hi.px(e,this.zoom)}};Ve=new WeakMap,Mt=new WeakMap,Z=new WeakMap,qe=new WeakMap,xt=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,Et=new WeakMap,Ze=new WeakMap,Je=new WeakMap,J=new WeakMap,yt=new WeakMap;function gi(r,e){let{width:i,height:s}=pt(r,!0);switch(e){case"center":return[0,0];case"top":return[0,s/2];case"bottom":return[0,-1*s/2];case"left":return[i/2,0];case"right":return[-1*i/2,0];case"top-left":return[i/2,s/2];case"top-right":return[-1*i/2,s/2];case"bottom-left":return[i/2,-1*s/2];case"bottom-right":return[-1*i/2,-1*s/2]}}var vi=vt("mapbox","satellite-streets-v11");var bi=`<svg width="88" height="23" viewBox="0 0 88 23" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-rule="evenodd"> | ||
`),Z,bt,Y,U,p,Ue,Xe,$e,Mt,We,me=class extends w{constructor(){super(...arguments);a(this,Z,new O.MapboxSearch({}));a(this,bt,new O.SearchSession(t(this,Z)));a(this,Y,null);a(this,U,void 0);a(this,p,new G);a(this,Ue,e=>{this.dispatchEvent(e.clone())});a(this,Xe,e=>{this.dispatchEvent(e.clone())});a(this,$e,e=>j(this,null,function*(){var u;this.dispatchEvent(e.clone());let i=e.detail;if(!i||!i.features.length)return;let s=(0,O.featureToSuggestion)(i.features[0]);t(this,U).value=s.feature_name;let n=t(this,Y);if(!n)return;let o=i.features;if(o.length===1){let m=o[0],f=(u=m.properties.place_type)==null?void 0:u[0],A=m.bbox;if(A)n.flyTo(Yt(n,O.LngLatBounds.convert(A).toFlatArray()));else{let F=m.geometry.coordinates,Xt=mi(f);n.flyTo({center:F,zoom:Xt,speed:zt})}return}let l=i.features.map(m=>m.bbox?(0,hi.default)(O.LngLatBounds.convert(m.bbox).toFlatArray()):m),c=(0,pi.default)({type:"FeatureCollection",features:l});n.flyTo(Yt(n,c))}));a(this,Mt,e=>{let i=new b("input");Object.assign(i,h({},e)),this.dispatchEvent(i)});a(this,We,()=>{let e=t(this,Y),i=h({},t(this,p).options);if(e.getZoom()<=ss){delete i.proximity,t(this,p).options=i;return}let s=e.getCenter();t(this,p).options=qt(h({},i),{proximity:s})})}get accessToken(){return t(this,Z).accessToken}set accessToken(e){t(this,Z).accessToken=e}get value(){return t(this,U).value}set value(e){t(this,U).value=e}get template(){return rs}get templateStyle(){return D}get templateUserStyle(){return k(".Input",t(this,p).theme)}get options(){return t(this,p).options}set options(e){t(this,p).options=e}get theme(){return t(this,p).theme}set theme(e){t(this,p).theme=e,!!t(this,U)&&(this.updateTemplateUserStyle(k(".Input",e)),t(this,p).updatePopover())}connectedCallback(){super.connectedCallback();let e=this.querySelector(".Input");e.addEventListener("input",t(this,Mt)),d(this,U,e),t(this,p).session=t(this,bt),t(this,p).input=e,t(this,p).addEventListener("suggest",t(this,Ue)),t(this,p).addEventListener("suggesterror",t(this,Xe)),t(this,p).addEventListener("retrieve",t(this,$e)),document.body.appendChild(t(this,p))}disconnectedCallback(){t(this,p).remove(),t(this,p).input=null,t(this,p).removeEventListener("suggest",t(this,Ue)),t(this,p).removeEventListener("suggesterror",t(this,Xe)),t(this,p).removeEventListener("retrieve",t(this,$e))}attributeChangedCallback(e,i,s){if(e==="access-token"){t(this,Z).accessToken=s;return}if(e==="theme"){this.theme=ht(s);return}let n=e.split("-").join("_");s||delete t(this,p).options[n],t(this,p).options[n]=s}focus(){t(this,p).focus()}bindMap(e){t(this,Y)&&t(this,Y).off("moveend",t(this,We)),e&&e.on("moveend",t(this,We)),d(this,Y,e)}unbindMap(){this.bindMap(null)}onAdd(e){this.bindMap(e),this.remove();let i=document.createElement("div");return i.className="mapboxgl-ctrl",i.style.width="300px",i.appendChild(this),i}onRemove(){this.remove(),this.unbindMap()}getDefaultPosition(){return"top-right"}};Z=new WeakMap,bt=new WeakMap,Y=new WeakMap,U=new WeakMap,p=new WeakMap,Ue=new WeakMap,Xe=new WeakMap,$e=new WeakMap,Mt=new WeakMap,We=new WeakMap,me.observedAttributes=["access-token","theme","language","country","bbox","limit","navigation-profile","origin","proximity","eta-type","types"];window.MapboxSearchBox=me;window.customElements.get("mapbox-search-box")||customElements.define("mapbox-search-box",me);var Ei=require("@mapbox/search-js-core");var vi=mt(require("@mapbox/sphericalmercator"));var gi=new vi.default({size:512,antimeridian:!0}),ee=1280;function fi(r,e){let{width:i,height:s}=pt(r,!0);switch(e){case"center":return[0,0];case"top":return[0,s/2];case"bottom":return[0,-1*s/2];case"left":return[i/2,0];case"right":return[-1*i/2,0];case"top-left":return[i/2,s/2];case"top-right":return[-1*i/2,s/2];case"bottom-left":return[i/2,-1*s/2];case"bottom-right":return[-1*i/2,-1*s/2]}}var Ve,xt,J,qe,Et,Ge,Ke,yt,Ze,Je,Q,Tt,Ut=class{constructor(e,i,s,n,o){a(this,Ve,void 0);a(this,xt,()=>{[this.anchorOffsetX,this.anchorOffsetY]=fi(this.markerElement,this.anchor),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}});a(this,J,{anchorX:0,anchorY:0,globalX:0,globalY:0});a(this,qe,!1);a(this,Et,e=>{!this.isActive||(e.preventDefault(),e.stopPropagation(),t(this,Q).call(this,e),window.addEventListener("pointermove",t(this,Ke)),window.addEventListener("pointerup",t(this,Ge)))});a(this,Ge,()=>{window.removeEventListener("pointermove",t(this,Ke)),window.removeEventListener("pointerup",t(this,Ge))});a(this,Ke,e=>{e.preventDefault(),e.stopPropagation();let i=this.curPointerXPos-e.pageX,s=this.curPointerYPos-e.pageY;this.markerDeltaX+=i,this.markerDeltaY-=s,this.markerDeltaX=Math.max(Math.min(this.imgWidth/2,this.markerDeltaX),this.imgWidth/2*-1),this.markerDeltaY=Math.max(Math.min(this.imgHeight/2,this.markerDeltaY),this.imgHeight/2*-1);let n=this.imgCenterPx[0]-this.imgCenterAdjustedPx[0],o=this.imgCenterPx[1]-this.imgCenterAdjustedPx[1],l=this.markerDeltaX-n,c=this.markerDeltaY+o;this.markerTransform={globalX:l,globalY:c},t(this,Q).call(this,e)});a(this,yt,e=>{!this.isActive||(e.preventDefault(),e.stopPropagation(),t(this,Q).call(this,e),window.addEventListener("pointermove",t(this,Je)),window.addEventListener("pointerup",t(this,Ze)))});a(this,Ze,()=>{window.removeEventListener("pointermove",t(this,Je)),window.removeEventListener("pointerup",t(this,Ze))});a(this,Je,e=>{e.preventDefault();let i=Math.round(this.imgContainerElement.scrollTop+(this.curPointerYPos-e.pageY));i=Math.max(Math.min(this.imgHeight-this.imgContainerElement.clientHeight,i),0);let s=Math.round(this.imgContainerElement.scrollLeft+(this.curPointerXPos-e.pageX));s=Math.max(Math.min(this.imgWidth-this.imgContainerElement.clientWidth,s),0),this.imgContainerElement.scrollTop=i,this.imgContainerElement.scrollLeft=s;let n=Math.round(s-(this.imgWidth-this.imgContainerElement.clientWidth)/2),o=Math.round((this.imgHeight-this.imgContainerElement.clientHeight)/2-i);if(this.imgCenterAdjustedPx=[this.imgCenterPx[0]+n,this.imgCenterPx[1]-o],!this.keepMarkerCentered){let l=this.markerDeltaX+n,c=this.markerDeltaY+o;this.markerTransform={globalX:l,globalY:c}}t(this,Q).call(this,e)});a(this,Q,e=>{this.curPointerXPos=e.pageX,this.curPointerYPos=e.pageY});a(this,Tt,()=>{let{anchorX:e,anchorY:i,globalX:s,globalY:n}=t(this,J),o=e-s,l=i+n;this.markerElement.style.transform=`translate(calc(-50% + ${o}px), calc(-50% + ${l}px))`});this.reCenter=()=>{let e=(this.imgHeight-this.imgContainerElement.clientHeight)/2,i=(this.imgWidth-this.imgContainerElement.clientWidth)/2;this.imgContainerElement.scrollTop=e,this.imgContainerElement.scrollLeft=i,this.imgCenterAdjustedPx=this.imgCenterPx,this.markerDeltaX=this.markerDeltaY=0,this.markerTransform={globalX:0,globalY:0}};this.markerElement=i,this.imgContainerElement=e,this.keepMarkerCentered=s,this.zoom=n,this.anchor=o,this.curPointerXPos=0,this.curPointerYPos=0,this.markerDeltaX=0,this.markerDeltaY=0,this.imgContainerElement.addEventListener("pointerdown",t(this,yt)),this.keepMarkerCentered||this.markerElement.addEventListener("pointerdown",t(this,Et)),new ResizeObserver(t(this,xt)).observe(this.markerElement)}get anchor(){return t(this,Ve)}set anchor(e){d(this,Ve,e),[this.anchorOffsetX,this.anchorOffsetY]=fi(this.markerElement,e),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}}get markerTransform(){return t(this,J)}set markerTransform(e){d(this,J,h(h({},t(this,J)),e)),t(this,Tt).call(this)}get isActive(){return t(this,qe)}set isActive(e){this.imgContainerElement.style.touchAction=e?"none":"",d(this,qe,e)}get imgHeight(){return Math.min(this.imgContainerElement.clientHeight*2,ee)}get imgWidth(){return Math.min(this.imgContainerElement.clientWidth*2,ee)}get coordinate(){let e=this.keepMarkerCentered?this.imgCenterAdjustedPx:[this.imgCenterPx[0]-this.markerDeltaX,this.imgCenterPx[1]+this.markerDeltaY],i=gi.ll(e,this.zoom);return[Bt(i[0],6),Bt(i[1],6)]}set coordinate(e){this.imgCenterPx=this.imgCenterAdjustedPx=gi.px(e,this.zoom)}};Ve=new WeakMap,xt=new WeakMap,J=new WeakMap,qe=new WeakMap,Et=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,yt=new WeakMap,Ze=new WeakMap,Je=new WeakMap,Q=new WeakMap,Tt=new WeakMap;var bi=vt("mapbox","satellite-streets-v11");var Mi=`<svg width="88" height="23" viewBox="0 0 88 23" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-rule="evenodd"> | ||
<defs> | ||
@@ -150,3 +150,3 @@ <path id="logo" d="M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z" /> | ||
</svg> | ||
`;var Mi=16,ns=M(` | ||
`;var xi=16,os=E(` | ||
<template> | ||
@@ -161,3 +161,3 @@ <div class="MapboxAddressMinimap" aria-hidden="true"> | ||
<a target="_blank" rel="noopener nofollow" href="https://www.mapbox.com/" aria-label="Mapbox logo"> | ||
${bi} | ||
${Mi} | ||
</a> | ||
@@ -173,11 +173,11 @@ </div> | ||
</template> | ||
`),os=M(` | ||
`),as=E(` | ||
<template> | ||
<button type="button" class="MinimapStyleToggle"></button> | ||
</template> | ||
`),as=M(` | ||
`),ls=E(` | ||
<template> | ||
<div class="MinimapFooter">Adjust the marker on the map if it doesn't precisely match your location. This helps your delivery reach you faster.</div> | ||
</template> | ||
`),ls=M(` | ||
`),ds=E(` | ||
<template> | ||
@@ -190,3 +190,3 @@ <div class="MinimapEditButtons"> | ||
</template> | ||
`),ee,Qe,H,U,te,ue,T,S,et,pe,tt,it,he,Tt,St,At,Lt,kt,st,rt,ge,nt,fe=class extends w{constructor(){super(...arguments);this.canAdjustMarker=!1;this.keepMarkerCentered=!1;this.markerAnchor="bottom";a(this,ee,!1);a(this,Qe,!1);a(this,H,void 0);a(this,U,"");a(this,te,void 0);a(this,ue,void 0);a(this,T,void 0);a(this,S,void 0);a(this,et,{});this.satelliteToggle=!1;a(this,pe,"default");a(this,tt,["mapbox","streets-v11"]);a(this,it,void 0);a(this,he,()=>{let{ImageContainer:e,ButtonAdjust:i,ButtonSave:s,ButtonCancel:n}=t(this,T);t(this,ee)?(e.classList.add(`${this.dataset.seed}--draggable`),t(this,S).isActive=!0,i.setAttribute("aria-hidden","true"),s.removeAttribute("aria-hidden"),n.removeAttribute("aria-hidden")):(e.classList.remove(`${this.dataset.seed}--draggable`),t(this,S).isActive=!1,i.removeAttribute("aria-hidden"),s.setAttribute("aria-hidden","true"),n.setAttribute("aria-hidden","true"))});a(this,Tt,()=>{d(this,ee,!0),t(this,he).call(this)});a(this,St,()=>{this.onSaveMarkerLocation&&this.onSaveMarkerLocation(t(this,S).coordinate),d(this,ee,!1),t(this,he).call(this)});a(this,At,()=>{t(this,S).reCenter(),d(this,ee,!1),t(this,he).call(this)});a(this,Lt,()=>{this.mapStyleMode=this.mapStyleMode==="default"?"satellite":"default"});a(this,kt,()=>{t(this,Qe)||t(this,S).reCenter(),d(this,Qe,!0)});a(this,st,e=>{let[i,s]=this.defaultMapStyle,n=vt(i,s);return(this.mapStyleMode==="default"?n:vi)+xi.LngLat.convert(e).toArray().join(",")+","+Mi+",0/"+Math.min(t(this,te)*2,Q)+"x"+Math.min(t(this,ue)*2,Q)+"?access_token="+this.accessToken+"&attribution=false&logo=false"});a(this,rt,()=>{if(t(this,H)){let e=t(this,H).geometry.coordinates;d(this,U,t(this,st).call(this,e));let{Image:i}=t(this,T);i.src=t(this,U)}});a(this,ge,e=>`url("${ri(e==="default"?"styleToggleDefault":"styleToggleSatellite",this.theme)}")`);a(this,nt,()=>{let{MapboxAddressMinimap:e,ImageContainer:i}=t(this,T),{width:s,height:n}=pt(this.container);d(this,te,Math.min(s,Q)),d(this,ue,Math.min(n,Q)),e.style.setProperty("width",`${t(this,te)}px`),i.style.setProperty("height",`${t(this,ue)}px`),i.style.setProperty("width",`${t(this,te)}px`)})}get accessToken(){return this.getAttribute("access-token")}set accessToken(e){this.setAttribute("access-token",e)}get feature(){return t(this,H)}set feature(e){d(this,H,e),e?this.show():this.hide()}get template(){return ns}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxAddressMinimap",this.theme)}get theme(){return t(this,et)}set theme(e){if(d(this,et,e),!t(this,T)||!e)return;this.updateTemplateUserStyle(k(".MapboxAddressMinimap",e));let{Marker:i,MapStyleToggle:s}=t(this,T);i.innerHTML=W("marker",e),s&&(s.style.backgroundImage=t(this,ge).call(this,this.mapStyleMode==="default"?"satellite":"default"))}get mapStyleMode(){return t(this,pe)}set mapStyleMode(e){let i=t(this,pe);d(this,pe,e);let{MapStyleToggle:s}=t(this,T);s.style.backgroundImage=t(this,ge).call(this,i),s.setAttribute("title",`Switch to ${i==="satellite"?"Satellite":"Default"}`),t(this,rt).call(this)}get defaultMapStyle(){return t(this,tt)}set defaultMapStyle(e){d(this,tt,e),t(this,rt).call(this)}get container(){return t(this,it)}set container(e){e&&(e.style.position="relative",d(this,it,e))}show(){if(!t(this,H))return;let e=t(this,H).geometry.coordinates;t(this,S).coordinate=e,d(this,U,t(this,st).call(this,e));let{MapboxAddressMinimap:i,Image:s}=t(this,T);s.src=t(this,U),i.removeAttribute("aria-hidden")}hide(){let{MapboxAddressMinimap:e}=t(this,T);e.setAttribute("aria-hidden","true")}connectedCallback(){if(super.connectedCallback(),this.canAdjustMarker){let f=this.prepareTemplate(as);this.querySelector(".MapboxAddressMinimap").appendChild(f);let F=this.prepareTemplate(ls);this.querySelector(".MinimapInnerFrame").appendChild(F)}if(this.satelliteToggle){let f=this.prepareTemplate(os);this.querySelector(".MinimapInnerFrame").appendChild(f)}d(this,T,ie(this,{MapboxAddressMinimap:".MapboxAddressMinimap",ImageContainer:".MinimapImageContainer",Image:".MinimapImage",Marker:".MinimapMarker",MapStyleToggle:".MinimapStyleToggle",EditButtons:".MinimapEditButtons",ButtonAdjust:".MinimapButtonAdjust",ButtonSave:".MinimapButtonSave",ButtonCancel:".MinimapButtonCancel"}));let{MapboxAddressMinimap:e,ImageContainer:i,Image:s,Marker:n,MapStyleToggle:o,ButtonAdjust:l,ButtonSave:c,ButtonCancel:m}=t(this,T);this.theme=g({},this.theme),this.container=this.parentElement,new ResizeObserver(t(this,nt)).observe(this.container),t(this,nt).call(this),this.canAdjustMarker&&(l.addEventListener("click",t(this,Tt)),c.addEventListener("click",t(this,St)),m.addEventListener("click",t(this,At))),this.satelliteToggle&&(o.addEventListener("click",t(this,Lt)),o.style.backgroundImage=t(this,ge).call(this,this.mapStyleMode==="default"?"satellite":"default"),o.setAttribute("title",`Switch to ${this.mapStyleMode==="default"?"Satellite":"Default"}`)),d(this,S,new Yt(i,n,this.keepMarkerCentered,Mi,this.markerAnchor)),t(this,S).reCenter(),s.onload=t(this,kt),s.src=t(this,U),t(this,H)?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}attributeChangedCallback(e,i,s){if(e==="can-adjust-marker")this.canAdjustMarker=s==="true";else if(e==="keep-marker-centered")this.keepMarkerCentered=s==="true";else if(e==="marker-anchor"){let n=s;this.markerAnchor=n,t(this,S)&&(t(this,S).anchor=n)}else e==="satellite-toggle"&&(this.satelliteToggle=s==="true")}};ee=new WeakMap,Qe=new WeakMap,H=new WeakMap,U=new WeakMap,te=new WeakMap,ue=new WeakMap,T=new WeakMap,S=new WeakMap,et=new WeakMap,pe=new WeakMap,tt=new WeakMap,it=new WeakMap,he=new WeakMap,Tt=new WeakMap,St=new WeakMap,At=new WeakMap,Lt=new WeakMap,kt=new WeakMap,st=new WeakMap,rt=new WeakMap,ge=new WeakMap,nt=new WeakMap,fe.observedAttributes=["can-adjust-marker","keep-marker-centered","marker-anchor","satellite-toggle"];window.MapboxAddressMinimap=fe;window.customElements.get("mapbox-address-minimap")||customElements.define("mapbox-address-minimap",fe);var ve,ot,be,at,lt,dt,Ei,ct,mt,yi=class{constructor({accessToken:e,options:i}){a(this,dt);this.autofillInstances=[];a(this,ve,void 0);a(this,ot,void 0);a(this,be,void 0);a(this,at,void 0);a(this,lt,!1);a(this,ct,()=>{Ee(b(this,dt,Ei).call(this),t(this,ve))||this.update()});a(this,mt,new MutationObserver(t(this,ct)));this.accessToken=e,i&&(this.options=i),this.update()}get accessToken(){return t(this,ot)}set accessToken(e){d(this,ot,e),this.autofillInstances.forEach(i=>{i.accessToken=e})}get options(){return t(this,be)}set options(e){d(this,be,g(g({},t(this,be)),e)),this.autofillInstances.forEach(i=>{i.options=g(g({},i.options),e)})}get theme(){return t(this,at)}set theme(e){d(this,at,e),this.autofillInstances.forEach(i=>{i.theme=e})}get minimapOnConfirm(){return t(this,lt)}set minimapOnConfirm(e){d(this,lt,e),this.autofillInstances.forEach(i=>{i.setAttribute("minimap-on-confirm",e===!0?"true":"false")})}update(){this.autofillInstances.forEach(e=>{e.replaceWith(e.children[0])}),d(this,ve,b(this,dt,Ei).call(this)),t(this,ve).forEach(e=>{let i=new z;i.accessToken=this.accessToken,i.options=this.options,i.theme=this.theme,e.parentElement.replaceChild(i,e),i.appendChild(e),this.autofillInstances.push(i)})}observe(){t(this,mt).observe(document,{subtree:!0,childList:!0}),t(this,ct).call(this)}unobserve(){t(this,mt).disconnect()}showConfirmAddress(e,i){return j(this,null,function*(){let s=!0;if(i==null?void 0:i.sections)for(let n of i.sections){let o=this.autofillInstances.find(c=>c.querySelector("input").autocomplete.indexOf(n)!==-1);if(!o)continue;(yield o.showConfirm())||(s=!1)}else for(let n of this.autofillInstances)(yield n.showConfirm())||(s=!1);return s})}};ve=new WeakMap,ot=new WeakMap,be=new WeakMap,at=new WeakMap,lt=new WeakMap,dt=new WeakSet,Ei=function(){return document.querySelectorAll('input[autocomplete~="address-line1"], input[autocomplete~="street-address"]')},ct=new WeakMap,mt=new WeakMap;function Ti({accessToken:r,options:e}){return new yi({accessToken:r,options:e})}module.exports=Bi(ds); | ||
`),te,Qe,H,X,ie,pe,M,S,et,se,tt,it,he,St,At,Lt,kt,Ct,st,rt,ge,nt,fe=class extends w{constructor(){super(...arguments);this.canAdjustMarker=!1;this.keepMarkerCentered=!1;this.markerAnchor="bottom";a(this,te,!1);a(this,Qe,!1);a(this,H,void 0);a(this,X,"");a(this,ie,void 0);a(this,pe,void 0);a(this,M,void 0);a(this,S,void 0);a(this,et,{});this.satelliteToggle=!1;a(this,se,"default");a(this,tt,["mapbox","streets-v11"]);a(this,it,void 0);a(this,he,()=>{let{ImageContainer:e,ButtonAdjust:i,ButtonSave:s,ButtonCancel:n}=t(this,M);t(this,te)?(e.classList.add(`${this.dataset.seed}--draggable`),t(this,S).isActive=!0,i.setAttribute("aria-hidden","true"),s.removeAttribute("aria-hidden"),n.removeAttribute("aria-hidden")):(e.classList.remove(`${this.dataset.seed}--draggable`),t(this,S).isActive=!1,i.removeAttribute("aria-hidden"),s.setAttribute("aria-hidden","true"),n.setAttribute("aria-hidden","true"))});a(this,St,()=>{d(this,te,!0),t(this,he).call(this)});a(this,At,()=>{this.onSaveMarkerLocation&&this.onSaveMarkerLocation(t(this,S).coordinate),d(this,te,!1),t(this,he).call(this)});a(this,Lt,()=>{t(this,S).reCenter(),d(this,te,!1),t(this,he).call(this)});a(this,kt,()=>{this.mapStyleMode=this.mapStyleMode==="default"?"satellite":"default"});a(this,Ct,()=>{t(this,Qe)||t(this,S).reCenter(),d(this,Qe,!0)});a(this,st,e=>{let[i,s]=this.defaultMapStyle,n=vt(i,s);return(this.mapStyleMode==="default"?n:bi)+Ei.LngLat.convert(e).toArray().join(",")+","+xi+",0/"+Math.min(t(this,ie)*2,ee)+"x"+Math.min(t(this,pe)*2,ee)+"?access_token="+this.accessToken+"&attribution=false&logo=false"});a(this,rt,()=>{if(t(this,H)){let e=t(this,H).geometry.coordinates;d(this,X,t(this,st).call(this,e));let{Image:i}=t(this,M);i.src=t(this,X)}});a(this,ge,e=>`url("${ni(e==="default"?"styleToggleDefault":"styleToggleSatellite",this.theme)}")`);a(this,nt,()=>{let{MapboxAddressMinimap:e,ImageContainer:i}=t(this,M),{width:s,height:n}=pt(this.container);d(this,ie,Math.min(s,ee)),d(this,pe,Math.min(n,ee)),e.style.setProperty("width",`${t(this,ie)}px`),i.style.setProperty("height",`${t(this,pe)}px`),i.style.setProperty("width",`${t(this,ie)}px`)})}get accessToken(){return this.getAttribute("access-token")}set accessToken(e){this.setAttribute("access-token",e)}get feature(){return t(this,H)}set feature(e){d(this,H,e),e?this.show():this.hide()}get template(){return os}get templateStyle(){return D}get templateUserStyle(){return k(".MapboxAddressMinimap",this.theme)}get theme(){return t(this,et)}set theme(e){if(d(this,et,e),!t(this,M)||!e)return;this.updateTemplateUserStyle(k(".MapboxAddressMinimap",e));let{Marker:i,MapStyleToggle:s}=t(this,M);i.innerHTML=V("marker",e),s&&(s.style.backgroundImage=t(this,ge).call(this,this.mapStyleMode==="default"?"satellite":"default"))}get mapStyleMode(){return t(this,se)}set mapStyleMode(e){let i=t(this,se);if(d(this,se,e),!t(this,M))return;let{MapStyleToggle:s}=t(this,M);!s||(s.style.backgroundImage=t(this,ge).call(this,i),s.setAttribute("title",`Switch to ${i==="satellite"?"Satellite":"Default"}`),t(this,rt).call(this))}get defaultMapStyle(){return t(this,tt)}set defaultMapStyle(e){d(this,tt,e),t(this,rt).call(this)}get container(){return t(this,it)}set container(e){e&&(e.style.position="relative",d(this,it,e))}show(){if(!t(this,H))return;let e=t(this,H).geometry.coordinates;t(this,S).coordinate=e,d(this,X,t(this,st).call(this,e));let{MapboxAddressMinimap:i,Image:s}=t(this,M);s.src=t(this,X),i.removeAttribute("aria-hidden")}hide(){let{MapboxAddressMinimap:e}=t(this,M);e.setAttribute("aria-hidden","true")}connectedCallback(){if(super.connectedCallback(),this.canAdjustMarker){let f=this.prepareTemplate(ls);this.querySelector(".MapboxAddressMinimap").appendChild(f);let F=this.prepareTemplate(ds);this.querySelector(".MinimapInnerFrame").appendChild(F)}if(this.satelliteToggle){let f=this.prepareTemplate(as);this.querySelector(".MinimapInnerFrame").appendChild(f)}d(this,M,re(this,{MapboxAddressMinimap:".MapboxAddressMinimap",ImageContainer:".MinimapImageContainer",Image:".MinimapImage",Marker:".MinimapMarker",MapStyleToggle:".MinimapStyleToggle",EditButtons:".MinimapEditButtons",ButtonAdjust:".MinimapButtonAdjust",ButtonSave:".MinimapButtonSave",ButtonCancel:".MinimapButtonCancel"}));let{MapboxAddressMinimap:e,ImageContainer:i,Image:s,Marker:n,MapStyleToggle:o,ButtonAdjust:l,ButtonSave:c,ButtonCancel:u}=t(this,M);this.mapStyleMode=t(this,se),this.theme=h({},this.theme),this.container=this.parentElement,new ResizeObserver(t(this,nt)).observe(this.container),t(this,nt).call(this),this.canAdjustMarker&&(l.addEventListener("click",t(this,St)),c.addEventListener("click",t(this,At)),u.addEventListener("click",t(this,Lt))),this.satelliteToggle&&(o.addEventListener("click",t(this,kt)),o.style.backgroundImage=t(this,ge).call(this,this.mapStyleMode==="default"?"satellite":"default"),o.setAttribute("title",`Switch to ${this.mapStyleMode==="default"?"Satellite":"Default"}`)),d(this,S,new Ut(i,n,this.keepMarkerCentered,xi,this.markerAnchor)),t(this,S).reCenter(),s.onload=t(this,Ct),s.src=t(this,X),t(this,H)?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}attributeChangedCallback(e,i,s){if(e==="can-adjust-marker")this.canAdjustMarker=s==="true";else if(e==="keep-marker-centered")this.keepMarkerCentered=s==="true";else if(e==="marker-anchor"){let n=s;this.markerAnchor=n,t(this,S)&&(t(this,S).anchor=n)}else e==="satellite-toggle"&&(this.satelliteToggle=s==="true")}};te=new WeakMap,Qe=new WeakMap,H=new WeakMap,X=new WeakMap,ie=new WeakMap,pe=new WeakMap,M=new WeakMap,S=new WeakMap,et=new WeakMap,se=new WeakMap,tt=new WeakMap,it=new WeakMap,he=new WeakMap,St=new WeakMap,At=new WeakMap,Lt=new WeakMap,kt=new WeakMap,Ct=new WeakMap,st=new WeakMap,rt=new WeakMap,ge=new WeakMap,nt=new WeakMap,fe.observedAttributes=["can-adjust-marker","keep-marker-centered","marker-anchor","satellite-toggle"];window.MapboxAddressMinimap=fe;window.customElements.get("mapbox-address-minimap")||customElements.define("mapbox-address-minimap",fe);var ve,ot,be,at,lt,dt,yi,ct,ut,Ti=class{constructor({accessToken:e,options:i}){a(this,dt);this.autofillInstances=[];a(this,ve,void 0);a(this,ot,void 0);a(this,be,void 0);a(this,at,void 0);a(this,lt,!1);a(this,ct,()=>{Ee(x(this,dt,yi).call(this),t(this,ve))||this.update()});a(this,ut,new MutationObserver(t(this,ct)));this.accessToken=e,i&&(this.options=i),this.update()}get accessToken(){return t(this,ot)}set accessToken(e){d(this,ot,e),this.autofillInstances.forEach(i=>{i.accessToken=e})}get options(){return t(this,be)}set options(e){d(this,be,h(h({},t(this,be)),e)),this.autofillInstances.forEach(i=>{i.options=h(h({},i.options),e)})}get theme(){return t(this,at)}set theme(e){d(this,at,e),this.autofillInstances.forEach(i=>{i.theme=e})}get minimapOnConfirm(){return t(this,lt)}set minimapOnConfirm(e){d(this,lt,e),this.autofillInstances.forEach(i=>{i.setAttribute("minimap-on-confirm",e===!0?"true":"false")})}update(){this.autofillInstances.forEach(e=>{e.replaceWith(e.children[0])}),d(this,ve,x(this,dt,yi).call(this)),t(this,ve).forEach(e=>{let i=new z;i.accessToken=this.accessToken,i.options=this.options,i.theme=this.theme,e.parentElement.replaceChild(i,e),i.appendChild(e),this.autofillInstances.push(i)})}observe(){t(this,ut).observe(document,{subtree:!0,childList:!0}),t(this,ct).call(this)}unobserve(){t(this,ut).disconnect()}showConfirmAddress(e,i){return j(this,null,function*(){let s=!0;if(i==null?void 0:i.sections)for(let n of i.sections){let o=this.autofillInstances.find(c=>c.querySelector("input").autocomplete.indexOf(n)!==-1);if(!o)continue;(yield o.showConfirm())||(s=!1)}else for(let n of this.autofillInstances)(yield n.showConfirm())||(s=!1);return s})}};ve=new WeakMap,ot=new WeakMap,be=new WeakMap,at=new WeakMap,lt=new WeakMap,dt=new WeakSet,yi=function(){return document.querySelectorAll('input[autocomplete~="address-line1"], input[autocomplete~="street-address"]')},ct=new WeakMap,ut=new WeakMap;function Si(r){let{accessToken:e,options:i}=r;return new Ti({accessToken:e,options:i})}module.exports=Ri(cs); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@mapbox/search-js-web", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"description": "Search web component with form autocomplete.", | ||
@@ -10,4 +10,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "typehead build && dts-bundle-generator -o dist/index.d.ts src/index.ts", | ||
"copy:cdn": "mkdir -p dist/cdn && cp dist/mapboxsearch.js dist/cdn/web.js && cp -r src/img dist/cdn", | ||
"build": "typehead build && tsc -p tsconfig.types.json", | ||
"watch": "typehead build --watch", | ||
@@ -24,3 +23,3 @@ "serve": "typehead serve", | ||
"dependencies": { | ||
"@mapbox/search-js-core": "^1.0.0-beta.5", | ||
"@mapbox/search-js-core": "^1.0.0-beta.6", | ||
"@mapbox/sphericalmercator": "^1.2.0", | ||
@@ -37,3 +36,3 @@ "@popperjs/core": "^2.11.2", | ||
"devDependencies": { | ||
"@mapbox/search-js-jest-preset": "^1.0.0", | ||
"@mapbox/esbuild-jest": "^1.1.0", | ||
"@mapbox/typehead": "^1.2.0", | ||
@@ -50,3 +49,2 @@ "@size-limit/preset-big-lib": "^7.0.8", | ||
"cssnano": "^5.1.0", | ||
"dts-bundle-generator": "^5.9.0", | ||
"jest": "^27.5.1", | ||
@@ -65,7 +63,17 @@ "mapbox-gl": "^2.7.0", | ||
"jest": { | ||
"preset": "@mapbox/search-js-jest-preset", | ||
"preset": "@mapbox/esbuild-jest", | ||
"rootDir": ".", | ||
"setupFilesAfterEnv": [ | ||
"<rootDir>/test/jest_framework_setup.ts" | ||
] | ||
], | ||
"transform": { | ||
"^.+\\.(svg)$": [ | ||
"@mapbox/esbuild-jest", | ||
{ | ||
"loader": { | ||
".svg": "text" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
@@ -72,0 +80,0 @@ "size-limit": [ |
@@ -15,3 +15,2 @@ { | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
"typeRoots": [ | ||
@@ -22,3 +21,4 @@ "./types", | ||
] | ||
} | ||
}, | ||
"exclude": ["dist/*", "dist/**/*"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20
57
2436210
8558
+ Addedmapbox-gl@3.7.0(transitive)
- Removedmapbox-gl@3.8.0(transitive)