@tomtom-org/maps-sdk 0.29.2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},t=class{constructor(){this.config={...e}}put(e){this.config={...this.config,...e}}reset(){this.config={...e}}get(){return this.config}};t.instance=new t;let r=t;const o=["carTrain","ferry","tunnel","motorway","pedestrian","toll","tollVignette","country","vehicleRestricted","traffic","carpool","urban","unpaved","lowEmissionZone","speedLimit","roadShields","importantRoadStretch"],n=[...o,"lanes"],a=[...n,"leg"],i=e=>!!e&&(e.length>=4&&e[3]!==e[1]&&e[2]!==e[0]),s=(e,t)=>{if(e&&!(e.length<2))return t?[t[0]>e[0]?e[0]:t[0],t[1]>e[1]?e[1]:t[1],t[2]<e[0]?e[0]:t[2],t[3]<e[1]?e[1]:t[3]]:[e[0],e[1],e[0],e[1]]},p=(e,t)=>t&&e?[t[0]>e[0]?e[0]:t[0],t[1]>e[1]?e[1]:t[1],t[2]<e[2]?e[2]:t[2],t[3]<e[3]?e[3]:t[3]]:e||t,c=e=>e?.length?e.reduce((e,t)=>p(t,e)):void 0,u=e=>{const t=e?.length;if(!t)return;let r;const o=Math.ceil(t/1e3);for(let n=0;n<t;n+=o)r=s(e[n],r);return 1===o?r:s(e[t-1],r)},d=e=>{if(e){if(Array.isArray(e))return"number"==typeof e[0]?e.length>=4?e:void 0:c(e.map(e=>d(e)));if(e.bbox)return e.bbox;switch(e.type){case"Feature":return d(e.geometry);case"FeatureCollection":return c(e.features.map(d));case"GeometryCollection":return c(e.geometries.map(d));case"Point":return s(e.coordinates);case"LineString":case"MultiPoint":return u(e.coordinates);case"MultiLineString":case"Polygon":return c(e.coordinates.map(u));case"MultiPolygon":return c(e.coordinates.flatMap(e=>e.map(u)));default:return}}},l="TomTomSDKsMapsJS",_=e=>{if(!/^[a-zA-Z0-9-]{1,100}$/.test(e))throw new TypeError(`a string matching regular expression ^[a-zA-Z0-9-]{1,100}$ is expected, but ${e} ['${typeof e}'] given`);return e},y=(e,t)=>{if(e){if(Array.isArray(e))return e;if(e.coordinates)return e.coordinates;if(e.geometry){if("main-when-available"===t?.useEntryPoint){const t=(r=e,r?.properties?.entryPoints?.find(e=>"main"===e.type));return t?.position??e.geometry.coordinates}return e.geometry.coordinates}}var r;return null},h=(e,t)=>{const r=y(e,t);if(!r)throw new Error(`The received object does not have lng-lat coordinates: ${JSON.stringify(e)}`);return r},C=e=>({type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}});const g=e=>e?.minutes??"min",m=1609.344,b=e=>e?.meters??"m",S=e=>e?.kilometers??"km",$=(e,t,r)=>t<3?((e,t,r)=>{const o=Number.parseInt(t.toString()),n=t-o,a=e<0?"-":"";if(n<.125)return`${a}${o} ${r}`;const i=o>0?o:"";return n<.375?`${a}${i}¼ ${r}`:n<.625?`${a}${i}½ ${r}`:n<.875?`${a}${i}¾ ${r}`:`${a}${o+1} ${r}`})(e,t,r):t<10?((e,t,r)=>{const o=Number.parseInt(t.toString()),n=t-o,a=e<0?"-":"";return n<.25?`${a}${o} ${r}`:n<.75?`${a}${o}½ ${r}`:`${a}${o+1} ${r}`})(e,t,r):`${Math.round(e)} ${r}`,x=e=>e.miles??"mi",f=(e,t)=>{const r=e/m,o=Math.abs(r);return o<.125?((e,t)=>{const r=Math.round(e/.3048),o=Math.abs(r);return o<30?`${r} ${t}`:o<500?`${10*Math.round(r/10)} ${t}`:`${100*Math.round(r/100)} ${t}`})(e,t.feet??"ft"):$(r,o,x(t))},T=(e,t)=>{const r=e/m,o=Math.abs(r);return o<.125?((e,t)=>{const r=Math.round(e/.9144);return Math.abs(r)<10?`${Math.round(r)} ${t}`:`${10*Math.round(r/10)} ${t}`})(e,t.yards??"yd"):$(r,o,x(t))};exports.TOMTOM_USER_AGENT_SDK_NAME=l,exports.TomTomConfig=r,exports.asSoftWaypoint=(e,t)=>{let r;return r=Array.isArray(e)||"Feature"!==e.type?C(h(e)):e,{...r,properties:{...r.properties,radiusMeters:t}}},exports.avoidableTypes=["tollRoads","motorways","ferries","unpavedRoads","carpools","alreadyUsedRoads","borderCrossings","tunnels","carTrains","lowEmissionZones"],exports.bboxCenter=e=>[(e[0]+e[2])/2,(e[1]+e[3])/2],exports.bboxExpandedWithBBox=p,exports.bboxExpandedWithGeoJSON=(e,t)=>p(d(e),t),exports.bboxExpandedWithPosition=s,exports.bboxFromBBoxes=c,exports.bboxFromCoordsArray=u,exports.bboxFromGeoJSON=d,exports.bboxOnlyIfWithArea=e=>i(e)?e:void 0,exports.chargingPointCapabilities=["ChargingProfileCapable","ChargingPreferencesCapable","ChipCardSupport","ContactlessCardSupport","CreditCardPayable","DebitCardPayable","PedTerminal","RemoteStartStopCapable","Reservable","RfidReader","StartSessionConnectorRequired","TokenGroupCapable","UnlockCapable","PlugAndCharge","Unknown"],exports.chargingPointRestrictions=["EvOnly","Plugged","Disabled","Customers","Motorcycles"],exports.chargingPointStatus=["Available","Reserved","Occupied","OutOfService","Unknown"],exports.chargingStationAccessTypes=["Public","Authorized","Restricted","Private","Unknown"],exports.connectorTypes=["StandardHouseholdCountrySpecific","IEC62196Type1","IEC62196Type1CCS","IEC62196Type2CableAttached","IEC62196Type2Outlet","IEC62196Type2CCS","IEC62196Type3","Chademo","GBT20234Part2","GBT20234Part3","IEC60309AC3PhaseRed","IEC60309AC1PhaseBlue","IEC60309DCWhite","Tesla"],exports.currentTypes=["AC1","AC3","DC"],exports.defaultConfig=e,exports.formatDistance=(e,t)=>{if(null==e)return"";const o={...r.instance.get().displayUnits?.distance,...t};switch(o?.type??"metric"){case"metric":return((e,t)=>{const r=Math.abs(e);if(r<10)return`${e} ${b(t)}`;if(r<500)return`${10*Math.round(e/10)} ${b(t)}`;if(r<1e3){const r=100*Math.round(e/100);return 1e3===r||-1e3===r?`${e<0?"-":""}1 ${S(t)}`:`${r} ${b(t)}`}return r<1e4?`${100*Math.round(e/100)/1e3} ${S(t)}`:`${Math.round(e/1e3)} ${S(t)}`})(e,o);case"imperial_us":return f(e,o);case"imperial_uk":return T(e,o)}},exports.formatDuration=(e,t)=>{if(e){const n=Math.abs(e)/3600;let a=Math.floor(n),i=Math.round(n%1*60);60===i&&(i=0,a++);const s={...r.instance.get().displayUnits?.time,...t};if(a)return`${a} ${o=s,o?.hours??"hr"} ${i.toString().padStart(2,"0")} ${g(s)}`;if(i)return`${i.toString()} ${g(s)}`}var o},exports.generateId=()=>Date.now().toString(36)+Math.random().toString(36).substring(2),exports.generateTomTomHeaders=e=>({...e.tomtomUserAgent&&{"TomTom-User-Agent":`${l}/__SDK_VERSION__`},...e.trackingId&&{"Tracking-ID":_(e.trackingId)}}),exports.geographyTypes=["Country","CountrySubdivision","CountrySecondarySubdivision","CountryTertiarySubdivision","Municipality","MunicipalitySubdivision","Neighbourhood","PostalCodeArea"],exports.getPosition=y,exports.getPositionStrict=h,exports.getRoutePlanningLocationType=e=>Array.isArray(e)?Array.isArray(e[0])?"path":"waypoint":"Feature"===e.type&&"LineString"===e.geometry.type?"path":"waypoint",exports.indexedMagnitudes=["unknown","minor","moderate","major","indefinite"],exports.inputSectionTypes=o,exports.inputSectionTypesWithGuidance=n,exports.isBBoxWithArea=i,exports.mergeFromGlobal=(e={})=>({...r.instance.get(),...e}),exports.paymentMethods=["No_Payment","Subscription","Direct"],exports.placeTypes=["POI","Street","Geography","Point Address","Address Range","Cross Street"],exports.plugTypes=["Small_Paddle_Inductive","Large_Paddle_Inductive","IEC_60309_1_Phase","IEC_60309_3_Phase","IEC_62196_Type_1_Outlet","IEC_62196_Type_2_Outlet","IEC_62196_Type_3_Outlet","IEC_62196_Type_1_Connector_Cable_Attached","IEC_62196_Type_2_Connector_Cable_Attached","IEC_62196_Type_3_Connector_Cable_Attached","Combo_to_IEC_62196_Type_1_Base","Combo_to_IEC_62196_Type_2_Base","Type_E_French_Standard_CEE_7_5","Type_F_Schuko_CEE_7_4","Type_G_British_Standard_BS_1363","Type_J_Swiss_Standard_SEV_1011","China_GB_Part_2","China_GB_Part_3","IEC_309_DC_Plug","AVCON_Connector","Tesla_Connector","NEMA_5_20","CHAdeMO","SAE_J1772","TEPCO","Better_Place_Socket","Marechal_Socket","Standard_Household_Country_Specific"],exports.sectionTypes=a,exports.toPointFeature=C,exports.views=["Unified","AR","IN","PK","IL","MA","RU","TR","CN"];
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},t=class{constructor(){this.config={...e}}put(e){this.config={...this.config,...e}}reset(){this.config={...e}}get(){return this.config}};t.instance=new t;let r=t;const o=["carTrain","ferry","tunnel","motorway","pedestrian","toll","tollVignette","country","vehicleRestricted","traffic","carpool","urban","unpaved","lowEmissionZone","speedLimit","roadShields","importantRoadStretch"],n=[...o,"lanes"],a=[...n,"leg"],i=e=>!!e&&(e.length>=4&&e[3]!==e[1]&&e[2]!==e[0]),s=(e,t)=>{if(e&&!(e.length<2))return t?[t[0]>e[0]?e[0]:t[0],t[1]>e[1]?e[1]:t[1],t[2]<e[0]?e[0]:t[2],t[3]<e[1]?e[1]:t[3]]:[e[0],e[1],e[0],e[1]]},p=(e,t)=>t&&e?[t[0]>e[0]?e[0]:t[0],t[1]>e[1]?e[1]:t[1],t[2]<e[2]?e[2]:t[2],t[3]<e[3]?e[3]:t[3]]:e||t,c=e=>e?.length?e.reduce((e,t)=>p(t,e)):void 0,u=e=>{const t=e?.length;if(!t)return;let r;const o=Math.ceil(t/1e3);for(let n=0;n<t;n+=o)r=s(e[n],r);return 1===o?r:s(e[t-1],r)},d=e=>{if(e){if(Array.isArray(e))return"number"==typeof e[0]?e.length>=4?e:void 0:c(e.map(e=>d(e)));if(e.bbox)return e.bbox;switch(e.type){case"Feature":return d(e.geometry);case"FeatureCollection":return c(e.features.map(d));case"GeometryCollection":return c(e.geometries.map(d));case"Point":return s(e.coordinates);case"LineString":case"MultiPoint":return u(e.coordinates);case"MultiLineString":case"Polygon":return c(e.coordinates.map(u));case"MultiPolygon":return c(e.coordinates.flatMap(e=>e.map(u)));default:return}}},l="MapsSDKJS",_=e=>{if(!/^[a-zA-Z0-9-]{1,100}$/.test(e))throw new TypeError(`a string matching regular expression ^[a-zA-Z0-9-]{1,100}$ is expected, but ${e} ['${typeof e}'] given`);return e},y=(e,t)=>{if(e){if(Array.isArray(e))return e;if(e.coordinates)return e.coordinates;if(e.geometry){if("main-when-available"===t?.useEntryPoint){const t=(r=e,r?.properties?.entryPoints?.find(e=>"main"===e.type));return t?.position??e.geometry.coordinates}return e.geometry.coordinates}}var r;return null},h=(e,t)=>{const r=y(e,t);if(!r)throw new Error(`The received object does not have lng-lat coordinates: ${JSON.stringify(e)}`);return r},C=e=>({type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}});const g=e=>e?.minutes??"min",m=1609.344,b=e=>e?.meters??"m",$=e=>e?.kilometers??"km",S=(e,t,r)=>t<3?((e,t,r)=>{const o=Number.parseInt(t.toString()),n=t-o,a=e<0?"-":"";if(n<.125)return`${a}${o} ${r}`;const i=o>0?o:"";return n<.375?`${a}${i}¼ ${r}`:n<.625?`${a}${i}½ ${r}`:n<.875?`${a}${i}¾ ${r}`:`${a}${o+1} ${r}`})(e,t,r):t<10?((e,t,r)=>{const o=Number.parseInt(t.toString()),n=t-o,a=e<0?"-":"";return n<.25?`${a}${o} ${r}`:n<.75?`${a}${o}½ ${r}`:`${a}${o+1} ${r}`})(e,t,r):`${Math.round(e)} ${r}`,x=e=>e.miles??"mi",f=(e,t)=>{const r=e/m,o=Math.abs(r);return o<.125?((e,t)=>{const r=Math.round(e/.3048),o=Math.abs(r);return o<30?`${r} ${t}`:o<500?`${10*Math.round(r/10)} ${t}`:`${100*Math.round(r/100)} ${t}`})(e,t.feet??"ft"):S(r,o,x(t))},T=(e,t)=>{const r=e/m,o=Math.abs(r);return o<.125?((e,t)=>{const r=Math.round(e/.9144);return Math.abs(r)<10?`${Math.round(r)} ${t}`:`${10*Math.round(r/10)} ${t}`})(e,t.yards??"yd"):S(r,o,x(t))};exports.TOMTOM_USER_AGENT_SDK_NAME=l,exports.TomTomConfig=r,exports.asSoftWaypoint=(e,t)=>{let r;return r=Array.isArray(e)||"Feature"!==e.type?C(h(e)):e,{...r,properties:{...r.properties,radiusMeters:t}}},exports.avoidableTypes=["tollRoads","motorways","ferries","unpavedRoads","carpools","alreadyUsedRoads","borderCrossings","tunnels","carTrains","lowEmissionZones"],exports.bboxCenter=e=>[(e[0]+e[2])/2,(e[1]+e[3])/2],exports.bboxExpandedWithBBox=p,exports.bboxExpandedWithGeoJSON=(e,t)=>p(d(e),t),exports.bboxExpandedWithPosition=s,exports.bboxFromBBoxes=c,exports.bboxFromCoordsArray=u,exports.bboxFromGeoJSON=d,exports.bboxOnlyIfWithArea=e=>i(e)?e:void 0,exports.chargingPointCapabilities=["ChargingProfileCapable","ChargingPreferencesCapable","ChipCardSupport","ContactlessCardSupport","CreditCardPayable","DebitCardPayable","PedTerminal","RemoteStartStopCapable","Reservable","RfidReader","StartSessionConnectorRequired","TokenGroupCapable","UnlockCapable","PlugAndCharge","Unknown"],exports.chargingPointRestrictions=["EvOnly","Plugged","Disabled","Customers","Motorcycles"],exports.chargingPointStatus=["Available","Reserved","Occupied","OutOfService","Unknown"],exports.chargingStationAccessTypes=["Public","Authorized","Restricted","Private","Unknown"],exports.connectorTypes=["StandardHouseholdCountrySpecific","IEC62196Type1","IEC62196Type1CCS","IEC62196Type2CableAttached","IEC62196Type2Outlet","IEC62196Type2CCS","IEC62196Type3","Chademo","GBT20234Part2","GBT20234Part3","IEC60309AC3PhaseRed","IEC60309AC1PhaseBlue","IEC60309DCWhite","Tesla"],exports.currentTypes=["AC1","AC3","DC"],exports.defaultConfig=e,exports.formatDistance=(e,t)=>{if(null==e)return"";const o={...r.instance.get().displayUnits?.distance,...t};switch(o?.type??"metric"){case"metric":return((e,t)=>{const r=Math.abs(e);if(r<10)return`${e} ${b(t)}`;if(r<500)return`${10*Math.round(e/10)} ${b(t)}`;if(r<1e3){const r=100*Math.round(e/100);return 1e3===r||-1e3===r?`${e<0?"-":""}1 ${$(t)}`:`${r} ${b(t)}`}return r<1e4?`${100*Math.round(e/100)/1e3} ${$(t)}`:`${Math.round(e/1e3)} ${$(t)}`})(e,o);case"imperial_us":return f(e,o);case"imperial_uk":return T(e,o)}},exports.formatDuration=(e,t)=>{if(e){const n=Math.abs(e)/3600;let a=Math.floor(n),i=Math.round(n%1*60);60===i&&(i=0,a++);const s={...r.instance.get().displayUnits?.time,...t};if(a)return`${a} ${o=s,o?.hours??"hr"} ${i.toString().padStart(2,"0")} ${g(s)}`;if(i)return`${i.toString()} ${g(s)}`}var o},exports.generateId=()=>Date.now().toString(36)+Math.random().toString(36).substring(2),exports.generateTomTomHeaders=e=>({"TomTom-User-Agent":`${l}/0.30.0`,...e.trackingId&&{"Tracking-ID":_(e.trackingId)}}),exports.geographyTypes=["Country","CountrySubdivision","CountrySecondarySubdivision","CountryTertiarySubdivision","Municipality","MunicipalitySubdivision","Neighbourhood","PostalCodeArea"],exports.getPosition=y,exports.getPositionStrict=h,exports.getRoutePlanningLocationType=e=>Array.isArray(e)?Array.isArray(e[0])?"path":"waypoint":"Feature"===e.type&&"LineString"===e.geometry.type?"path":"waypoint",exports.indexedMagnitudes=["unknown","minor","moderate","major","indefinite"],exports.inputSectionTypes=o,exports.inputSectionTypesWithGuidance=n,exports.isBBoxWithArea=i,exports.mergeFromGlobal=(e={})=>({...r.instance.get(),...e}),exports.paymentMethods=["No_Payment","Subscription","Direct"],exports.placeTypes=["POI","Street","Geography","Point Address","Address Range","Cross Street"],exports.plugTypes=["Small_Paddle_Inductive","Large_Paddle_Inductive","IEC_60309_1_Phase","IEC_60309_3_Phase","IEC_62196_Type_1_Outlet","IEC_62196_Type_2_Outlet","IEC_62196_Type_3_Outlet","IEC_62196_Type_1_Connector_Cable_Attached","IEC_62196_Type_2_Connector_Cable_Attached","IEC_62196_Type_3_Connector_Cable_Attached","Combo_to_IEC_62196_Type_1_Base","Combo_to_IEC_62196_Type_2_Base","Type_E_French_Standard_CEE_7_5","Type_F_Schuko_CEE_7_4","Type_G_British_Standard_BS_1363","Type_J_Swiss_Standard_SEV_1011","China_GB_Part_2","China_GB_Part_3","IEC_309_DC_Plug","AVCON_Connector","Tesla_Connector","NEMA_5_20","CHAdeMO","SAE_J1772","TEPCO","Better_Place_Socket","Marechal_Socket","Standard_Household_Country_Specific"],exports.sectionTypes=a,exports.toPointFeature=C,exports.views=["Unified","AR","IN","PK","IL","MA","RU","TR","CN"];
2
2
  //# sourceMappingURL=core.cjs.min.js.map