@mapbox/search-js-core
Advanced tools
Comparing version 1.0.0-beta.17 to 1.0.0-beta.18
@@ -42,2 +42,3 @@ import { AddressAutofillSuggestion, AddressAutofillFeatureSuggestion } from './types'; | ||
* @property {string | LngLatLike} proximity Bias the response to favor results that are closer to this location. Provide a point coordinate provided as a{@link LngLatLike}, or use the string `ip` to use the requester's IP address. | ||
* @property {string | boolean} streets If enabled, street results may be returned in addition to addresses. Defaults to `true`. | ||
*/ | ||
@@ -50,2 +51,3 @@ export interface AddressAutofillOptions { | ||
proximity: string | LngLatLike; | ||
streets: string | boolean; | ||
} | ||
@@ -52,0 +54,0 @@ /** |
@@ -370,4 +370,4 @@ var __defProp = Object.defineProperty; | ||
types: "address", | ||
streets: true, | ||
access_token: this.accessToken, | ||
streets: options.streets, | ||
language: options.language, | ||
@@ -386,3 +386,4 @@ country: options.country, | ||
language: "en", | ||
proximity: "ip" | ||
proximity: "ip", | ||
streets: true | ||
}; | ||
@@ -389,0 +390,0 @@ |
@@ -328,4 +328,4 @@ var __defProp = Object.defineProperty; | ||
types: "address", | ||
streets: true, | ||
access_token: this.accessToken, | ||
streets: options.streets, | ||
language: options.language, | ||
@@ -344,3 +344,4 @@ country: options.country, | ||
language: "en", | ||
proximity: "ip" | ||
proximity: "ip", | ||
streets: true | ||
}; | ||
@@ -347,0 +348,0 @@ |
@@ -1,2 +0,2 @@ | ||
var U=Object.defineProperty,Le=Object.defineProperties,be=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var te=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,g=(o,e)=>{for(var t in e||(e={}))M.call(e,t)&&te(o,t,e[t]);if(B)for(var t of B(e))re.call(e,t)&&te(o,t,e[t]);return o},x=(o,e)=>Le(o,ye(e)),Re=o=>U(o,"__esModule",{value:!0});var v=(o,e)=>{var t={};for(var r in o)M.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&B)for(var r of B(o))e.indexOf(r)<0&&re.call(o,r)&&(t[r]=o[r]);return t};var ke=(o,e)=>{for(var t in e)U(o,t,{get:e[t],enumerable:!0})},ve=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xe(e))!M.call(o,s)&&(t||s!=="default")&&U(o,s,{get:()=>e[s],enumerable:!(r=be(e,s))||r.enumerable});return o};var Te=(o=>(e,t)=>o&&o.get(e)||(t=ve(Re({}),e,1),o&&o.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var K=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var L=(o,e,t)=>(K(o,e,"read from private field"),t?t.call(o):e.get(o)),d=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},A=(o,e,t,r)=>(K(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);var R=(o,e,t)=>(K(o,e,"access private method"),t);var p=(o,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},i=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,i);a((t=t.apply(o,e)).next())});var $e={};ke($e,{AddressAutofillCore:()=>$,Evented:()=>_,GeocodingCore:()=>J,LngLat:()=>l,LngLatBounds:()=>m,MapboxAutofill:()=>$,MapboxError:()=>j,MapboxGeocode:()=>J,MapboxValidate:()=>V,MatchCodeConfidence:()=>X,SearchBoxCore:()=>I,SearchSession:()=>ee,SessionToken:()=>f,ValidationCore:()=>V,debounce:()=>D,featureToSuggestion:()=>Se,polyfillFetch:()=>ge});var oe="https://api.mapbox.com/autofill/v1",Ae="suggest",we="retrieve",se=`${oe}/${Ae}`,ne=`${oe}/${we}`;var l=class{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90");if(this.lng>180||this.lng<-180)throw new Error("Invalid LngLat longitude value: must be between -180 and 180")}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}static convert(e){if(e instanceof l)return new l(e.lng,e.lat);if(Array.isArray(e)&&e.length===2)return new l(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null&&("lng"in e||"lon"in e)&&"lat"in e)return new l(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var m=class{constructor(e,t){this._sw=l.convert(e),this._ne=l.convert(t)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l(this.getWest(),this.getNorth())}getSouthEast(){return new l(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toFlatArray(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}static convert(e){if(!e)throw new Error("Invalid LngLatBounds convert value: falsy");if(e instanceof m)return new m(e.getSouthWest(),e.getNorthEast());if(Array.isArray(e)&&e.length===2)return new m(l.convert(e[0]),l.convert(e[1]));if(Array.isArray(e)&&e.length===4)return new m(l.convert([e[0],e[1]]),l.convert([e[2],e[3]]));throw new Error("`LngLatBoundsLike` argument must be specified as an array [<LngLatLike>, <LngLatLike>] or an array [<west>, <south>, <east>, <north>]")}};function ie(){let e=(Math.random().toString(16)+Date.now().toString(16)+Math.random().toString(16)).replace(/\./g,"");return[e.slice(0,8),e.slice(8,12),"4"+e.slice(12,15)+"-8"+e.slice(15,18),e.slice(18,30)].join("-")}var f=class{constructor(e){this.id=e!=null?e:ie()}toString(){return this.id}static convert(e){return new f(e instanceof f?e.id:e.toString())}};var Ee="Unknown error",j=class extends Error{constructor(e,t){super(String(e.message||e.error||Ee));this.name="MapboxError",this.statusCode=t}toString(){return`${this.name} (${this.statusCode}): ${this.message}`}};function S(o){return p(this,null,function*(){if(!o.ok){let e=yield o.json();throw new j(e,o.status)}})}var N=globalThis.fetch,ae=globalThis.AbortController;function ge({fetch:o,AbortController:e},t=!1){if(!o)throw new Error("Fetch implementation must include implementations of `fetch`.");N&&!t||(N=o,ae=e)}function h(){if(!N)throw new Error("Fetch implementation not found. Please include a fetch polyfill in your application or use `polyfillFetch` from `@mapbox/search-js-core` to fix this issue.");return{fetch:N,AbortController:ae}}function b(...o){let e=[];for(let t of o){if(!t)continue;let r=Object.entries(t);for(let[s,n]of r)n!=null&&e.push(`${s}=${encodeURIComponent(String(n))}`)}return e.join("&")}var C,Oe,z=class{constructor(e={}){d(this,C);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},z.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${se}/${encodeURIComponent(e)}`);i.search=R(this,C,Oe).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return x(g({},u),{suggestions:u.suggestions.map(y=>x(g({},y),{original_search_text:e})),url:i.toString()})})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");if(!this.canRetrieve(e))throw new Error("suggestion cannot be retrieved");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ne}/${e.action.id}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}canRetrieve(e){let t=e.action;return typeof(t==null?void 0:t.id)=="string"}},$=z;C=new WeakSet,Oe=function(e){return b({types:"address",streets:!0,access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},$.defaults={language:"en",proximity:"ip"};var G="https://api.mapbox.com/search/searchbox/v1",_e="suggest",Pe="retrieve",Fe="category",Be="reverse",ce=`${G}/${_e}`,ue=`${G}/${Pe}`,le=`${G}/${Fe}`,pe=`${G}/${Be}`;var E,me,Q=class{constructor(e={}){d(this,E);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},Q.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{q:e,sessionToken:r});if(n.eta_type&&(!n.origin||!n.navigation_profile))throw new Error("to provide eta estimate: eta, navigation_profile, and origin are required");if(n.origin&&!n.navigation_profile)throw new Error("to provide distance estimate: both navigation_profile and origin are required");let i=new URL(ce);i.search=R(this,E,me).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ue}/${encodeURIComponent(e.mapbox_id)}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}category(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("category is required");let s=g(g({},this.defaults),t),n=new URL(`${le}/${encodeURIComponent(e)}`);n.search=R(this,E,me).call(this,s);let{fetch:i}=h(),a=yield i(n.toString(),{signal:s.signal});yield S(a);let c=yield a.json();return c.url=n.toString(),c})}reverse(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("lngLat is required");let[s,n]=typeof e=="string"?e.split(",").map(F=>parseFloat(F)):l.convert(e).toArray();if(isNaN(s)||isNaN(n))throw new Error("lngLat is required");let i=g(g({},this.defaults),t),a=new URL(pe);a.search=b({access_token:this.accessToken,language:i.language,limit:i.limit,longitude:s,latitude:n},i.types&&{types:typeof i.types=="string"?i.types:[...i.types].join(",")});let{fetch:c}=h(),u=yield c(a.toString(),{signal:i.signal});yield S(u);let y=yield u.json();return y.url=a.toString(),y})}},I=Q;E=new WeakSet,me=function(e){return b({q:e.q,access_token:this.accessToken,language:e.language,limit:e.limit,navigation_profile:e.navigation_profile,route:e.route,route_geometry:e.route_geometry,sar_type:e.sar_type,time_deviation:e.time_deviation,eta_type:e.eta_type,country:e.country,poi_category:e.poi_category,radius:e.radius,user_id:e.user_id,rich_metadata_provider:e.rich_metadata_provider,poi_category_exclusions:e.poi_category_exclusions},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.origin&&{origin:typeof e.origin=="string"?e.origin:l.convert(e.origin).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})},I.defaults={language:"en"};var Ue="https://api.mapbox.com/autofill/v1",je="retrieve",fe=`${Ue}/${je}`;var q,Ne,W=class{constructor(e={}){d(this,q);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},W.defaults),r)}validate(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${fe}/${encodeURIComponent(e)}`);i.search=R(this,q,Ne).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u.features.length>0&&(u.features=[u.features[0]]),u})}},V=W;q=new WeakSet,Ne=function(e){return b({access_token:this.accessToken,language:e.language,country:e.country},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},V.defaults={language:"en",proximity:"ip"};var he="https://api.mapbox.com/geocoding/v5",H=`${he}/mapbox.places`,Y=`${he}/mapbox.places-permanent`;var O,de,J=class{constructor(e={}){d(this,O);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g({},r)}forward(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=s.permanent?Y:H,i=new URL(`${n}/${encodeURIComponent(e)}.json`);i.search=R(this,O,de).call(this,s);let{fetch:a}=h(),c=r?{signal:r}:{},u=yield a(i.toString(),c);yield S(u);let y=yield u.json();return y.url=i.toString(),y})}reverse(e,t){return p(this,null,function*(){if(!e)throw new Error("lngLat is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=typeof e=="string"?e:l.convert(e).toArray().join(","),i=s.permanent?Y:H,a=new URL(`${i}/${encodeURIComponent(n)}.json`);a.search=R(this,O,de).call(this,s,!0);let{fetch:c}=h(),u=r?{signal:r}:{},y=yield c(a.toString(),u);yield S(y);let F=yield y.json();return F.url=a.toString(),F})}};O=new WeakSet,de=function(e,t=!1){return t&&["proximity","autocomplete","fuzzyMatch","bbox"].forEach(r=>{r in e&&delete e[r]}),b({access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit,autocomplete:e.autocomplete,fuzzyMatch:e.fuzzyMatch,routing:e.routing,worldview:e.worldview},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})};var X=(s=>(s.exact="exact",s.high="high",s.medium="medium",s.low="low",s))(X||{});var w,_=class{constructor(){d(this,w,{})}addEventListener(e,t){let r=L(this,w);r[e]||(r[e]=[]),r[e].push(t)}removeEventListener(e,t){let r=L(this,w);if(!r[e])return;let s=r[e],n=s.indexOf(t);n!==-1&&s.splice(n,1)}fire(e,t){let r=L(this,w);if(!r[e])return;let s=r[e];for(let n of s)n(t)}};w=new WeakMap;function D(o,e,t){let r=null;return(...s)=>{r!==null&&clearTimeout(r);let n=t&&t();r=setTimeout(()=>{r=null,!(n==null?void 0:n.aborted)&&o(...s)},e)}}function Z(){let{AbortController:o}=h();return new o}var T,k,P,ee=class extends _{constructor(e,t=0){super();this.sessionToken=new f;d(this,T,void 0);d(this,k,Z());d(this,P,void 0);A(this,P,D((n,...i)=>p(this,[n,...i],function*(r,s={}){if(L(this,k).abort(),A(this,k,Z()),!r){A(this,T,null),this.fire("suggest",L(this,T));return}try{let a=yield this.search.suggest(r,x(g({sessionToken:this.sessionToken},s),{signal:L(this,k).signal}));A(this,T,a),this.fire("suggest",a)}catch(a){if(a.name==="AbortError")return;this.fire("suggesterror",a)}}),t,()=>L(this,k).signal)),Object.defineProperties(this,{search:{value:e,writable:!1},debounce:{value:t,writable:!1}})}get suggestions(){return L(this,T)}suggest(e,t){return L(this,P).call(this,e,t),new Promise((r,s)=>{let n,i;n=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),r(a)},i=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),s(a)},this.addEventListener("suggest",n),this.addEventListener("suggesterror",i)})}clear(){this.suggest("")}retrieve(e,t){return p(this,null,function*(){let r=yield this.search.retrieve(e,g({sessionToken:this.sessionToken},t));return this.fire("retrieve",r),r})}canRetrieve(e){return this.search.canRetrieve?this.search.canRetrieve(e):!0}canSuggest(e){return this.search.canSuggest?this.search.canSuggest(e):!0}abort(){L(this,k).abort(),A(this,k,Z())}};T=new WeakMap,k=new WeakMap,P=new WeakMap;function Se(o){let{properties:e}=o;return g({},e)}module.exports=Te($e); | ||
var U=Object.defineProperty,Le=Object.defineProperties,be=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var te=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,g=(o,e)=>{for(var t in e||(e={}))M.call(e,t)&&te(o,t,e[t]);if(B)for(var t of B(e))re.call(e,t)&&te(o,t,e[t]);return o},x=(o,e)=>Le(o,ye(e)),Re=o=>U(o,"__esModule",{value:!0});var v=(o,e)=>{var t={};for(var r in o)M.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&B)for(var r of B(o))e.indexOf(r)<0&&re.call(o,r)&&(t[r]=o[r]);return t};var ke=(o,e)=>{for(var t in e)U(o,t,{get:e[t],enumerable:!0})},ve=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xe(e))!M.call(o,s)&&(t||s!=="default")&&U(o,s,{get:()=>e[s],enumerable:!(r=be(e,s))||r.enumerable});return o};var Te=(o=>(e,t)=>o&&o.get(e)||(t=ve(Re({}),e,1),o&&o.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var K=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var L=(o,e,t)=>(K(o,e,"read from private field"),t?t.call(o):e.get(o)),d=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},A=(o,e,t,r)=>(K(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);var R=(o,e,t)=>(K(o,e,"access private method"),t);var p=(o,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},i=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,i);a((t=t.apply(o,e)).next())});var $e={};ke($e,{AddressAutofillCore:()=>$,Evented:()=>_,GeocodingCore:()=>J,LngLat:()=>l,LngLatBounds:()=>m,MapboxAutofill:()=>$,MapboxError:()=>j,MapboxGeocode:()=>J,MapboxValidate:()=>V,MatchCodeConfidence:()=>X,SearchBoxCore:()=>I,SearchSession:()=>ee,SessionToken:()=>f,ValidationCore:()=>V,debounce:()=>D,featureToSuggestion:()=>Se,polyfillFetch:()=>ge});var oe="https://api.mapbox.com/autofill/v1",Ae="suggest",we="retrieve",se=`${oe}/${Ae}`,ne=`${oe}/${we}`;var l=class{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90");if(this.lng>180||this.lng<-180)throw new Error("Invalid LngLat longitude value: must be between -180 and 180")}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}static convert(e){if(e instanceof l)return new l(e.lng,e.lat);if(Array.isArray(e)&&e.length===2)return new l(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null&&("lng"in e||"lon"in e)&&"lat"in e)return new l(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var m=class{constructor(e,t){this._sw=l.convert(e),this._ne=l.convert(t)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l(this.getWest(),this.getNorth())}getSouthEast(){return new l(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toFlatArray(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}static convert(e){if(!e)throw new Error("Invalid LngLatBounds convert value: falsy");if(e instanceof m)return new m(e.getSouthWest(),e.getNorthEast());if(Array.isArray(e)&&e.length===2)return new m(l.convert(e[0]),l.convert(e[1]));if(Array.isArray(e)&&e.length===4)return new m(l.convert([e[0],e[1]]),l.convert([e[2],e[3]]));throw new Error("`LngLatBoundsLike` argument must be specified as an array [<LngLatLike>, <LngLatLike>] or an array [<west>, <south>, <east>, <north>]")}};function ie(){let e=(Math.random().toString(16)+Date.now().toString(16)+Math.random().toString(16)).replace(/\./g,"");return[e.slice(0,8),e.slice(8,12),"4"+e.slice(12,15)+"-8"+e.slice(15,18),e.slice(18,30)].join("-")}var f=class{constructor(e){this.id=e!=null?e:ie()}toString(){return this.id}static convert(e){return new f(e instanceof f?e.id:e.toString())}};var Ee="Unknown error",j=class extends Error{constructor(e,t){super(String(e.message||e.error||Ee));this.name="MapboxError",this.statusCode=t}toString(){return`${this.name} (${this.statusCode}): ${this.message}`}};function S(o){return p(this,null,function*(){if(!o.ok){let e=yield o.json();throw new j(e,o.status)}})}var N=globalThis.fetch,ae=globalThis.AbortController;function ge({fetch:o,AbortController:e},t=!1){if(!o)throw new Error("Fetch implementation must include implementations of `fetch`.");N&&!t||(N=o,ae=e)}function h(){if(!N)throw new Error("Fetch implementation not found. Please include a fetch polyfill in your application or use `polyfillFetch` from `@mapbox/search-js-core` to fix this issue.");return{fetch:N,AbortController:ae}}function b(...o){let e=[];for(let t of o){if(!t)continue;let r=Object.entries(t);for(let[s,n]of r)n!=null&&e.push(`${s}=${encodeURIComponent(String(n))}`)}return e.join("&")}var C,Oe,z=class{constructor(e={}){d(this,C);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},z.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${se}/${encodeURIComponent(e)}`);i.search=R(this,C,Oe).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return x(g({},u),{suggestions:u.suggestions.map(y=>x(g({},y),{original_search_text:e})),url:i.toString()})})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");if(!this.canRetrieve(e))throw new Error("suggestion cannot be retrieved");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ne}/${e.action.id}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}canRetrieve(e){let t=e.action;return typeof(t==null?void 0:t.id)=="string"}},$=z;C=new WeakSet,Oe=function(e){return b({types:"address",access_token:this.accessToken,streets:e.streets,language:e.language,country:e.country,limit:e.limit},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},$.defaults={language:"en",proximity:"ip",streets:!0};var G="https://api.mapbox.com/search/searchbox/v1",_e="suggest",Pe="retrieve",Fe="category",Be="reverse",ce=`${G}/${_e}`,ue=`${G}/${Pe}`,le=`${G}/${Fe}`,pe=`${G}/${Be}`;var E,me,Q=class{constructor(e={}){d(this,E);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},Q.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{q:e,sessionToken:r});if(n.eta_type&&(!n.origin||!n.navigation_profile))throw new Error("to provide eta estimate: eta, navigation_profile, and origin are required");if(n.origin&&!n.navigation_profile)throw new Error("to provide distance estimate: both navigation_profile and origin are required");let i=new URL(ce);i.search=R(this,E,me).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ue}/${encodeURIComponent(e.mapbox_id)}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}category(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("category is required");let s=g(g({},this.defaults),t),n=new URL(`${le}/${encodeURIComponent(e)}`);n.search=R(this,E,me).call(this,s);let{fetch:i}=h(),a=yield i(n.toString(),{signal:s.signal});yield S(a);let c=yield a.json();return c.url=n.toString(),c})}reverse(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("lngLat is required");let[s,n]=typeof e=="string"?e.split(",").map(F=>parseFloat(F)):l.convert(e).toArray();if(isNaN(s)||isNaN(n))throw new Error("lngLat is required");let i=g(g({},this.defaults),t),a=new URL(pe);a.search=b({access_token:this.accessToken,language:i.language,limit:i.limit,longitude:s,latitude:n},i.types&&{types:typeof i.types=="string"?i.types:[...i.types].join(",")});let{fetch:c}=h(),u=yield c(a.toString(),{signal:i.signal});yield S(u);let y=yield u.json();return y.url=a.toString(),y})}},I=Q;E=new WeakSet,me=function(e){return b({q:e.q,access_token:this.accessToken,language:e.language,limit:e.limit,navigation_profile:e.navigation_profile,route:e.route,route_geometry:e.route_geometry,sar_type:e.sar_type,time_deviation:e.time_deviation,eta_type:e.eta_type,country:e.country,poi_category:e.poi_category,radius:e.radius,user_id:e.user_id,rich_metadata_provider:e.rich_metadata_provider,poi_category_exclusions:e.poi_category_exclusions},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.origin&&{origin:typeof e.origin=="string"?e.origin:l.convert(e.origin).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})},I.defaults={language:"en"};var Ue="https://api.mapbox.com/autofill/v1",je="retrieve",fe=`${Ue}/${je}`;var q,Ne,W=class{constructor(e={}){d(this,q);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},W.defaults),r)}validate(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${fe}/${encodeURIComponent(e)}`);i.search=R(this,q,Ne).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u.features.length>0&&(u.features=[u.features[0]]),u})}},V=W;q=new WeakSet,Ne=function(e){return b({access_token:this.accessToken,language:e.language,country:e.country},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},V.defaults={language:"en",proximity:"ip"};var he="https://api.mapbox.com/geocoding/v5",H=`${he}/mapbox.places`,Y=`${he}/mapbox.places-permanent`;var O,de,J=class{constructor(e={}){d(this,O);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g({},r)}forward(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=s.permanent?Y:H,i=new URL(`${n}/${encodeURIComponent(e)}.json`);i.search=R(this,O,de).call(this,s);let{fetch:a}=h(),c=r?{signal:r}:{},u=yield a(i.toString(),c);yield S(u);let y=yield u.json();return y.url=i.toString(),y})}reverse(e,t){return p(this,null,function*(){if(!e)throw new Error("lngLat is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=typeof e=="string"?e:l.convert(e).toArray().join(","),i=s.permanent?Y:H,a=new URL(`${i}/${encodeURIComponent(n)}.json`);a.search=R(this,O,de).call(this,s,!0);let{fetch:c}=h(),u=r?{signal:r}:{},y=yield c(a.toString(),u);yield S(y);let F=yield y.json();return F.url=a.toString(),F})}};O=new WeakSet,de=function(e,t=!1){return t&&["proximity","autocomplete","fuzzyMatch","bbox"].forEach(r=>{r in e&&delete e[r]}),b({access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit,autocomplete:e.autocomplete,fuzzyMatch:e.fuzzyMatch,routing:e.routing,worldview:e.worldview},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})};var X=(s=>(s.exact="exact",s.high="high",s.medium="medium",s.low="low",s))(X||{});var w,_=class{constructor(){d(this,w,{})}addEventListener(e,t){let r=L(this,w);r[e]||(r[e]=[]),r[e].push(t)}removeEventListener(e,t){let r=L(this,w);if(!r[e])return;let s=r[e],n=s.indexOf(t);n!==-1&&s.splice(n,1)}fire(e,t){let r=L(this,w);if(!r[e])return;let s=r[e];for(let n of s)n(t)}};w=new WeakMap;function D(o,e,t){let r=null;return(...s)=>{r!==null&&clearTimeout(r);let n=t&&t();r=setTimeout(()=>{r=null,!(n==null?void 0:n.aborted)&&o(...s)},e)}}function Z(){let{AbortController:o}=h();return new o}var T,k,P,ee=class extends _{constructor(e,t=0){super();this.sessionToken=new f;d(this,T,void 0);d(this,k,Z());d(this,P,void 0);A(this,P,D((n,...i)=>p(this,[n,...i],function*(r,s={}){if(L(this,k).abort(),A(this,k,Z()),!r){A(this,T,null),this.fire("suggest",L(this,T));return}try{let a=yield this.search.suggest(r,x(g({sessionToken:this.sessionToken},s),{signal:L(this,k).signal}));A(this,T,a),this.fire("suggest",a)}catch(a){if(a.name==="AbortError")return;this.fire("suggesterror",a)}}),t,()=>L(this,k).signal)),Object.defineProperties(this,{search:{value:e,writable:!1},debounce:{value:t,writable:!1}})}get suggestions(){return L(this,T)}suggest(e,t){return L(this,P).call(this,e,t),new Promise((r,s)=>{let n,i;n=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),r(a)},i=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),s(a)},this.addEventListener("suggest",n),this.addEventListener("suggesterror",i)})}clear(){this.suggest("")}retrieve(e,t){return p(this,null,function*(){let r=yield this.search.retrieve(e,g({sessionToken:this.sessionToken},t));return this.fire("retrieve",r),r})}canRetrieve(e){return this.search.canRetrieve?this.search.canRetrieve(e):!0}canSuggest(e){return this.search.canSuggest?this.search.canSuggest(e):!0}abort(){L(this,k).abort(),A(this,k,Z())}};T=new WeakMap,k=new WeakMap,P=new WeakMap;function Se(o){let{properties:e}=o;return g({},e)}module.exports=Te($e); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var mapboxsearchcore=(()=>{var U=Object.defineProperty,Le=Object.defineProperties,be=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var te=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,g=(o,e)=>{for(var t in e||(e={}))M.call(e,t)&&te(o,t,e[t]);if(B)for(var t of B(e))re.call(e,t)&&te(o,t,e[t]);return o},x=(o,e)=>Le(o,ye(e)),Re=o=>U(o,"__esModule",{value:!0});var v=(o,e)=>{var t={};for(var r in o)M.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&B)for(var r of B(o))e.indexOf(r)<0&&re.call(o,r)&&(t[r]=o[r]);return t};var ke=(o,e)=>{for(var t in e)U(o,t,{get:e[t],enumerable:!0})},ve=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xe(e))!M.call(o,s)&&(t||s!=="default")&&U(o,s,{get:()=>e[s],enumerable:!(r=be(e,s))||r.enumerable});return o};var Te=(o=>(e,t)=>o&&o.get(e)||(t=ve(Re({}),e,1),o&&o.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var K=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var L=(o,e,t)=>(K(o,e,"read from private field"),t?t.call(o):e.get(o)),d=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},A=(o,e,t,r)=>(K(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);var R=(o,e,t)=>(K(o,e,"access private method"),t);var p=(o,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},i=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,i);a((t=t.apply(o,e)).next())});var $e={};ke($e,{AddressAutofillCore:()=>$,Evented:()=>_,GeocodingCore:()=>J,LngLat:()=>l,LngLatBounds:()=>m,MapboxAutofill:()=>$,MapboxError:()=>j,MapboxGeocode:()=>J,MapboxValidate:()=>V,MatchCodeConfidence:()=>X,SearchBoxCore:()=>I,SearchSession:()=>ee,SessionToken:()=>f,ValidationCore:()=>V,debounce:()=>D,featureToSuggestion:()=>Se,polyfillFetch:()=>ge});var oe="https://api.mapbox.com/autofill/v1",Ae="suggest",we="retrieve",se=`${oe}/${Ae}`,ne=`${oe}/${we}`;var l=class{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90");if(this.lng>180||this.lng<-180)throw new Error("Invalid LngLat longitude value: must be between -180 and 180")}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}static convert(e){if(e instanceof l)return new l(e.lng,e.lat);if(Array.isArray(e)&&e.length===2)return new l(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null&&("lng"in e||"lon"in e)&&"lat"in e)return new l(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var m=class{constructor(e,t){this._sw=l.convert(e),this._ne=l.convert(t)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l(this.getWest(),this.getNorth())}getSouthEast(){return new l(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toFlatArray(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}static convert(e){if(!e)throw new Error("Invalid LngLatBounds convert value: falsy");if(e instanceof m)return new m(e.getSouthWest(),e.getNorthEast());if(Array.isArray(e)&&e.length===2)return new m(l.convert(e[0]),l.convert(e[1]));if(Array.isArray(e)&&e.length===4)return new m(l.convert([e[0],e[1]]),l.convert([e[2],e[3]]));throw new Error("`LngLatBoundsLike` argument must be specified as an array [<LngLatLike>, <LngLatLike>] or an array [<west>, <south>, <east>, <north>]")}};function ie(){let e=(Math.random().toString(16)+Date.now().toString(16)+Math.random().toString(16)).replace(/\./g,"");return[e.slice(0,8),e.slice(8,12),"4"+e.slice(12,15)+"-8"+e.slice(15,18),e.slice(18,30)].join("-")}var f=class{constructor(e){this.id=e!=null?e:ie()}toString(){return this.id}static convert(e){return new f(e instanceof f?e.id:e.toString())}};var Ee="Unknown error",j=class extends Error{constructor(e,t){super(String(e.message||e.error||Ee));this.name="MapboxError",this.statusCode=t}toString(){return`${this.name} (${this.statusCode}): ${this.message}`}};function S(o){return p(this,null,function*(){if(!o.ok){let e=yield o.json();throw new j(e,o.status)}})}var N=globalThis.fetch,ae=globalThis.AbortController;function ge({fetch:o,AbortController:e},t=!1){if(!o)throw new Error("Fetch implementation must include implementations of `fetch`.");N&&!t||(N=o,ae=e)}function h(){if(!N)throw new Error("Fetch implementation not found. Please include a fetch polyfill in your application or use `polyfillFetch` from `@mapbox/search-js-core` to fix this issue.");return{fetch:N,AbortController:ae}}function b(...o){let e=[];for(let t of o){if(!t)continue;let r=Object.entries(t);for(let[s,n]of r)n!=null&&e.push(`${s}=${encodeURIComponent(String(n))}`)}return e.join("&")}var C,Oe,z=class{constructor(e={}){d(this,C);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},z.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${se}/${encodeURIComponent(e)}`);i.search=R(this,C,Oe).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return x(g({},u),{suggestions:u.suggestions.map(y=>x(g({},y),{original_search_text:e})),url:i.toString()})})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");if(!this.canRetrieve(e))throw new Error("suggestion cannot be retrieved");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ne}/${e.action.id}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}canRetrieve(e){let t=e.action;return typeof(t==null?void 0:t.id)=="string"}},$=z;C=new WeakSet,Oe=function(e){return b({types:"address",streets:!0,access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},$.defaults={language:"en",proximity:"ip"};var G="https://api.mapbox.com/search/searchbox/v1",_e="suggest",Pe="retrieve",Fe="category",Be="reverse",ce=`${G}/${_e}`,ue=`${G}/${Pe}`,le=`${G}/${Fe}`,pe=`${G}/${Be}`;var E,me,Q=class{constructor(e={}){d(this,E);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},Q.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{q:e,sessionToken:r});if(n.eta_type&&(!n.origin||!n.navigation_profile))throw new Error("to provide eta estimate: eta, navigation_profile, and origin are required");if(n.origin&&!n.navigation_profile)throw new Error("to provide distance estimate: both navigation_profile and origin are required");let i=new URL(ce);i.search=R(this,E,me).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ue}/${encodeURIComponent(e.mapbox_id)}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}category(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("category is required");let s=g(g({},this.defaults),t),n=new URL(`${le}/${encodeURIComponent(e)}`);n.search=R(this,E,me).call(this,s);let{fetch:i}=h(),a=yield i(n.toString(),{signal:s.signal});yield S(a);let c=yield a.json();return c.url=n.toString(),c})}reverse(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("lngLat is required");let[s,n]=typeof e=="string"?e.split(",").map(F=>parseFloat(F)):l.convert(e).toArray();if(isNaN(s)||isNaN(n))throw new Error("lngLat is required");let i=g(g({},this.defaults),t),a=new URL(pe);a.search=b({access_token:this.accessToken,language:i.language,limit:i.limit,longitude:s,latitude:n},i.types&&{types:typeof i.types=="string"?i.types:[...i.types].join(",")});let{fetch:c}=h(),u=yield c(a.toString(),{signal:i.signal});yield S(u);let y=yield u.json();return y.url=a.toString(),y})}},I=Q;E=new WeakSet,me=function(e){return b({q:e.q,access_token:this.accessToken,language:e.language,limit:e.limit,navigation_profile:e.navigation_profile,route:e.route,route_geometry:e.route_geometry,sar_type:e.sar_type,time_deviation:e.time_deviation,eta_type:e.eta_type,country:e.country,poi_category:e.poi_category,radius:e.radius,user_id:e.user_id,rich_metadata_provider:e.rich_metadata_provider,poi_category_exclusions:e.poi_category_exclusions},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.origin&&{origin:typeof e.origin=="string"?e.origin:l.convert(e.origin).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})},I.defaults={language:"en"};var Ue="https://api.mapbox.com/autofill/v1",je="retrieve",fe=`${Ue}/${je}`;var q,Ne,W=class{constructor(e={}){d(this,q);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},W.defaults),r)}validate(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${fe}/${encodeURIComponent(e)}`);i.search=R(this,q,Ne).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u.features.length>0&&(u.features=[u.features[0]]),u})}},V=W;q=new WeakSet,Ne=function(e){return b({access_token:this.accessToken,language:e.language,country:e.country},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},V.defaults={language:"en",proximity:"ip"};var he="https://api.mapbox.com/geocoding/v5",H=`${he}/mapbox.places`,Y=`${he}/mapbox.places-permanent`;var O,de,J=class{constructor(e={}){d(this,O);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g({},r)}forward(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=s.permanent?Y:H,i=new URL(`${n}/${encodeURIComponent(e)}.json`);i.search=R(this,O,de).call(this,s);let{fetch:a}=h(),c=r?{signal:r}:{},u=yield a(i.toString(),c);yield S(u);let y=yield u.json();return y.url=i.toString(),y})}reverse(e,t){return p(this,null,function*(){if(!e)throw new Error("lngLat is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=typeof e=="string"?e:l.convert(e).toArray().join(","),i=s.permanent?Y:H,a=new URL(`${i}/${encodeURIComponent(n)}.json`);a.search=R(this,O,de).call(this,s,!0);let{fetch:c}=h(),u=r?{signal:r}:{},y=yield c(a.toString(),u);yield S(y);let F=yield y.json();return F.url=a.toString(),F})}};O=new WeakSet,de=function(e,t=!1){return t&&["proximity","autocomplete","fuzzyMatch","bbox"].forEach(r=>{r in e&&delete e[r]}),b({access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit,autocomplete:e.autocomplete,fuzzyMatch:e.fuzzyMatch,routing:e.routing,worldview:e.worldview},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})};var X=(s=>(s.exact="exact",s.high="high",s.medium="medium",s.low="low",s))(X||{});var w,_=class{constructor(){d(this,w,{})}addEventListener(e,t){let r=L(this,w);r[e]||(r[e]=[]),r[e].push(t)}removeEventListener(e,t){let r=L(this,w);if(!r[e])return;let s=r[e],n=s.indexOf(t);n!==-1&&s.splice(n,1)}fire(e,t){let r=L(this,w);if(!r[e])return;let s=r[e];for(let n of s)n(t)}};w=new WeakMap;function D(o,e,t){let r=null;return(...s)=>{r!==null&&clearTimeout(r);let n=t&&t();r=setTimeout(()=>{r=null,!(n==null?void 0:n.aborted)&&o(...s)},e)}}function Z(){let{AbortController:o}=h();return new o}var T,k,P,ee=class extends _{constructor(e,t=0){super();this.sessionToken=new f;d(this,T,void 0);d(this,k,Z());d(this,P,void 0);A(this,P,D((n,...i)=>p(this,[n,...i],function*(r,s={}){if(L(this,k).abort(),A(this,k,Z()),!r){A(this,T,null),this.fire("suggest",L(this,T));return}try{let a=yield this.search.suggest(r,x(g({sessionToken:this.sessionToken},s),{signal:L(this,k).signal}));A(this,T,a),this.fire("suggest",a)}catch(a){if(a.name==="AbortError")return;this.fire("suggesterror",a)}}),t,()=>L(this,k).signal)),Object.defineProperties(this,{search:{value:e,writable:!1},debounce:{value:t,writable:!1}})}get suggestions(){return L(this,T)}suggest(e,t){return L(this,P).call(this,e,t),new Promise((r,s)=>{let n,i;n=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),r(a)},i=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),s(a)},this.addEventListener("suggest",n),this.addEventListener("suggesterror",i)})}clear(){this.suggest("")}retrieve(e,t){return p(this,null,function*(){let r=yield this.search.retrieve(e,g({sessionToken:this.sessionToken},t));return this.fire("retrieve",r),r})}canRetrieve(e){return this.search.canRetrieve?this.search.canRetrieve(e):!0}canSuggest(e){return this.search.canSuggest?this.search.canSuggest(e):!0}abort(){L(this,k).abort(),A(this,k,Z())}};T=new WeakMap,k=new WeakMap,P=new WeakMap;function Se(o){let{properties:e}=o;return g({},e)}return Te($e);})(); | ||
var mapboxsearchcore=(()=>{var U=Object.defineProperty,Le=Object.defineProperties,be=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var te=(o,e,t)=>e in o?U(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,g=(o,e)=>{for(var t in e||(e={}))M.call(e,t)&&te(o,t,e[t]);if(B)for(var t of B(e))re.call(e,t)&&te(o,t,e[t]);return o},x=(o,e)=>Le(o,ye(e)),Re=o=>U(o,"__esModule",{value:!0});var v=(o,e)=>{var t={};for(var r in o)M.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&B)for(var r of B(o))e.indexOf(r)<0&&re.call(o,r)&&(t[r]=o[r]);return t};var ke=(o,e)=>{for(var t in e)U(o,t,{get:e[t],enumerable:!0})},ve=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xe(e))!M.call(o,s)&&(t||s!=="default")&&U(o,s,{get:()=>e[s],enumerable:!(r=be(e,s))||r.enumerable});return o};var Te=(o=>(e,t)=>o&&o.get(e)||(t=ve(Re({}),e,1),o&&o.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var K=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var L=(o,e,t)=>(K(o,e,"read from private field"),t?t.call(o):e.get(o)),d=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)},A=(o,e,t,r)=>(K(o,e,"write to private field"),r?r.call(o,t):e.set(o,t),t);var R=(o,e,t)=>(K(o,e,"access private method"),t);var p=(o,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},i=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,i);a((t=t.apply(o,e)).next())});var $e={};ke($e,{AddressAutofillCore:()=>$,Evented:()=>_,GeocodingCore:()=>J,LngLat:()=>l,LngLatBounds:()=>m,MapboxAutofill:()=>$,MapboxError:()=>j,MapboxGeocode:()=>J,MapboxValidate:()=>V,MatchCodeConfidence:()=>X,SearchBoxCore:()=>I,SearchSession:()=>ee,SessionToken:()=>f,ValidationCore:()=>V,debounce:()=>D,featureToSuggestion:()=>Se,polyfillFetch:()=>ge});var oe="https://api.mapbox.com/autofill/v1",Ae="suggest",we="retrieve",se=`${oe}/${Ae}`,ne=`${oe}/${we}`;var l=class{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90");if(this.lng>180||this.lng<-180)throw new Error("Invalid LngLat longitude value: must be between -180 and 180")}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}static convert(e){if(e instanceof l)return new l(e.lng,e.lat);if(Array.isArray(e)&&e.length===2)return new l(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null&&("lng"in e||"lon"in e)&&"lat"in e)return new l(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var m=class{constructor(e,t){this._sw=l.convert(e),this._ne=l.convert(t)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new l(this.getWest(),this.getNorth())}getSouthEast(){return new l(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toFlatArray(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}static convert(e){if(!e)throw new Error("Invalid LngLatBounds convert value: falsy");if(e instanceof m)return new m(e.getSouthWest(),e.getNorthEast());if(Array.isArray(e)&&e.length===2)return new m(l.convert(e[0]),l.convert(e[1]));if(Array.isArray(e)&&e.length===4)return new m(l.convert([e[0],e[1]]),l.convert([e[2],e[3]]));throw new Error("`LngLatBoundsLike` argument must be specified as an array [<LngLatLike>, <LngLatLike>] or an array [<west>, <south>, <east>, <north>]")}};function ie(){let e=(Math.random().toString(16)+Date.now().toString(16)+Math.random().toString(16)).replace(/\./g,"");return[e.slice(0,8),e.slice(8,12),"4"+e.slice(12,15)+"-8"+e.slice(15,18),e.slice(18,30)].join("-")}var f=class{constructor(e){this.id=e!=null?e:ie()}toString(){return this.id}static convert(e){return new f(e instanceof f?e.id:e.toString())}};var Ee="Unknown error",j=class extends Error{constructor(e,t){super(String(e.message||e.error||Ee));this.name="MapboxError",this.statusCode=t}toString(){return`${this.name} (${this.statusCode}): ${this.message}`}};function S(o){return p(this,null,function*(){if(!o.ok){let e=yield o.json();throw new j(e,o.status)}})}var N=globalThis.fetch,ae=globalThis.AbortController;function ge({fetch:o,AbortController:e},t=!1){if(!o)throw new Error("Fetch implementation must include implementations of `fetch`.");N&&!t||(N=o,ae=e)}function h(){if(!N)throw new Error("Fetch implementation not found. Please include a fetch polyfill in your application or use `polyfillFetch` from `@mapbox/search-js-core` to fix this issue.");return{fetch:N,AbortController:ae}}function b(...o){let e=[];for(let t of o){if(!t)continue;let r=Object.entries(t);for(let[s,n]of r)n!=null&&e.push(`${s}=${encodeURIComponent(String(n))}`)}return e.join("&")}var C,Oe,z=class{constructor(e={}){d(this,C);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},z.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${se}/${encodeURIComponent(e)}`);i.search=R(this,C,Oe).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return x(g({},u),{suggestions:u.suggestions.map(y=>x(g({},y),{original_search_text:e})),url:i.toString()})})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");if(!this.canRetrieve(e))throw new Error("suggestion cannot be retrieved");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ne}/${e.action.id}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}canRetrieve(e){let t=e.action;return typeof(t==null?void 0:t.id)=="string"}},$=z;C=new WeakSet,Oe=function(e){return b({types:"address",access_token:this.accessToken,streets:e.streets,language:e.language,country:e.country,limit:e.limit},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},$.defaults={language:"en",proximity:"ip",streets:!0};var G="https://api.mapbox.com/search/searchbox/v1",_e="suggest",Pe="retrieve",Fe="category",Be="reverse",ce=`${G}/${_e}`,ue=`${G}/${Pe}`,le=`${G}/${Fe}`,pe=`${G}/${Be}`;var E,me,Q=class{constructor(e={}){d(this,E);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},Q.defaults),r)}suggest(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{q:e,sessionToken:r});if(n.eta_type&&(!n.origin||!n.navigation_profile))throw new Error("to provide eta estimate: eta, navigation_profile, and origin are required");if(n.origin&&!n.navigation_profile)throw new Error("to provide distance estimate: both navigation_profile and origin are required");let i=new URL(ce);i.search=R(this,E,me).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}retrieve(e,t){return p(this,null,function*(){if(!e)throw new Error("suggestion is required");let{sessionToken:r,signal:s}=t,n=f.convert(r),i=new URL(`${ue}/${encodeURIComponent(e.mapbox_id)}`);i.search=b({access_token:this.accessToken,session_token:n.id});let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u})}category(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("category is required");let s=g(g({},this.defaults),t),n=new URL(`${le}/${encodeURIComponent(e)}`);n.search=R(this,E,me).call(this,s);let{fetch:i}=h(),a=yield i(n.toString(),{signal:s.signal});yield S(a);let c=yield a.json();return c.url=n.toString(),c})}reverse(r){return p(this,arguments,function*(e,t={}){if(!e)throw new Error("lngLat is required");let[s,n]=typeof e=="string"?e.split(",").map(F=>parseFloat(F)):l.convert(e).toArray();if(isNaN(s)||isNaN(n))throw new Error("lngLat is required");let i=g(g({},this.defaults),t),a=new URL(pe);a.search=b({access_token:this.accessToken,language:i.language,limit:i.limit,longitude:s,latitude:n},i.types&&{types:typeof i.types=="string"?i.types:[...i.types].join(",")});let{fetch:c}=h(),u=yield c(a.toString(),{signal:i.signal});yield S(u);let y=yield u.json();return y.url=a.toString(),y})}},I=Q;E=new WeakSet,me=function(e){return b({q:e.q,access_token:this.accessToken,language:e.language,limit:e.limit,navigation_profile:e.navigation_profile,route:e.route,route_geometry:e.route_geometry,sar_type:e.sar_type,time_deviation:e.time_deviation,eta_type:e.eta_type,country:e.country,poi_category:e.poi_category,radius:e.radius,user_id:e.user_id,rich_metadata_provider:e.rich_metadata_provider,poi_category_exclusions:e.poi_category_exclusions},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.origin&&{origin:typeof e.origin=="string"?e.origin:l.convert(e.origin).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})},I.defaults={language:"en"};var Ue="https://api.mapbox.com/autofill/v1",je="retrieve",fe=`${Ue}/${je}`;var q,Ne,W=class{constructor(e={}){d(this,q);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g(g({},W.defaults),r)}validate(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let{sessionToken:r,signal:s}=t,n=x(g(g({},this.defaults),t),{sessionToken:r}),i=new URL(`${fe}/${encodeURIComponent(e)}`);i.search=R(this,q,Ne).call(this,n);let{fetch:a}=h(),c=yield a(i.toString(),{signal:s});yield S(c);let u=yield c.json();return u.url=i.toString(),u.features.length>0&&(u.features=[u.features[0]]),u})}},V=W;q=new WeakSet,Ne=function(e){return b({access_token:this.accessToken,language:e.language,country:e.country},e.sessionToken&&{session_token:f.convert(e.sessionToken).id},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")})},V.defaults={language:"en",proximity:"ip"};var he="https://api.mapbox.com/geocoding/v5",H=`${he}/mapbox.places`,Y=`${he}/mapbox.places-permanent`;var O,de,J=class{constructor(e={}){d(this,O);let s=e,{accessToken:t}=s,r=v(s,["accessToken"]);this.accessToken=t,this.defaults=g({},r)}forward(e,t){return p(this,null,function*(){if(!e)throw new Error("searchText is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=s.permanent?Y:H,i=new URL(`${n}/${encodeURIComponent(e)}.json`);i.search=R(this,O,de).call(this,s);let{fetch:a}=h(),c=r?{signal:r}:{},u=yield a(i.toString(),c);yield S(u);let y=yield u.json();return y.url=i.toString(),y})}reverse(e,t){return p(this,null,function*(){if(!e)throw new Error("lngLat is required");let r;t&&({signal:r}=t);let s=g(g({},this.defaults),t),n=typeof e=="string"?e:l.convert(e).toArray().join(","),i=s.permanent?Y:H,a=new URL(`${i}/${encodeURIComponent(n)}.json`);a.search=R(this,O,de).call(this,s,!0);let{fetch:c}=h(),u=r?{signal:r}:{},y=yield c(a.toString(),u);yield S(y);let F=yield y.json();return F.url=a.toString(),F})}};O=new WeakSet,de=function(e,t=!1){return t&&["proximity","autocomplete","fuzzyMatch","bbox"].forEach(r=>{r in e&&delete e[r]}),b({access_token:this.accessToken,language:e.language,country:e.country,limit:e.limit,autocomplete:e.autocomplete,fuzzyMatch:e.fuzzyMatch,routing:e.routing,worldview:e.worldview},e.proximity&&{proximity:typeof e.proximity=="string"?e.proximity:l.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:typeof e.bbox=="string"?e.bbox:m.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:typeof e.types=="string"?e.types:[...e.types].join(",")})};var X=(s=>(s.exact="exact",s.high="high",s.medium="medium",s.low="low",s))(X||{});var w,_=class{constructor(){d(this,w,{})}addEventListener(e,t){let r=L(this,w);r[e]||(r[e]=[]),r[e].push(t)}removeEventListener(e,t){let r=L(this,w);if(!r[e])return;let s=r[e],n=s.indexOf(t);n!==-1&&s.splice(n,1)}fire(e,t){let r=L(this,w);if(!r[e])return;let s=r[e];for(let n of s)n(t)}};w=new WeakMap;function D(o,e,t){let r=null;return(...s)=>{r!==null&&clearTimeout(r);let n=t&&t();r=setTimeout(()=>{r=null,!(n==null?void 0:n.aborted)&&o(...s)},e)}}function Z(){let{AbortController:o}=h();return new o}var T,k,P,ee=class extends _{constructor(e,t=0){super();this.sessionToken=new f;d(this,T,void 0);d(this,k,Z());d(this,P,void 0);A(this,P,D((n,...i)=>p(this,[n,...i],function*(r,s={}){if(L(this,k).abort(),A(this,k,Z()),!r){A(this,T,null),this.fire("suggest",L(this,T));return}try{let a=yield this.search.suggest(r,x(g({sessionToken:this.sessionToken},s),{signal:L(this,k).signal}));A(this,T,a),this.fire("suggest",a)}catch(a){if(a.name==="AbortError")return;this.fire("suggesterror",a)}}),t,()=>L(this,k).signal)),Object.defineProperties(this,{search:{value:e,writable:!1},debounce:{value:t,writable:!1}})}get suggestions(){return L(this,T)}suggest(e,t){return L(this,P).call(this,e,t),new Promise((r,s)=>{let n,i;n=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),r(a)},i=a=>{this.removeEventListener("suggest",n),this.removeEventListener("suggesterror",i),s(a)},this.addEventListener("suggest",n),this.addEventListener("suggesterror",i)})}clear(){this.suggest("")}retrieve(e,t){return p(this,null,function*(){let r=yield this.search.retrieve(e,g({sessionToken:this.sessionToken},t));return this.fire("retrieve",r),r})}canRetrieve(e){return this.search.canRetrieve?this.search.canRetrieve(e):!0}canSuggest(e){return this.search.canSuggest?this.search.canSuggest(e):!0}abort(){L(this,k).abort(),A(this,k,Z())}};T=new WeakMap,k=new WeakMap,P=new WeakMap;function Se(o){let{properties:e}=o;return g({},e)}return Te($e);})(); | ||
//# sourceMappingURL=mapboxsearchcore.js.map |
{ | ||
"name": "@mapbox/search-js-core", | ||
"version": "1.0.0-beta.17", | ||
"version": "1.0.0-beta.18", | ||
"description": "Platform agnostic wrappers for the Search Box, Address Autofill, and Geocoding APIs.", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
"@types/jest": "^27.0.1", | ||
"node-fetch": "2", | ||
"node-fetch": "^2.6.7", | ||
"abort-controller": "^3.0.0", | ||
@@ -28,0 +28,0 @@ "jest": "^27.4.7", |
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 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 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
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
1618611
6103