@tomtom-org/maps-sdk 0.40.0 → 0.41.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.
- package/CHANGELOG.md +28 -0
- package/README.md +21 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +10 -22
- package/core/package.json +2 -2
- package/map/dist/THIRD_PARTY.txt +4 -4
- package/map/dist/index.d.ts +86 -56
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +1 -1
- package/package.json +2 -2
- package/services/dist/index.d.ts +84 -75
- package/services/dist/services.es.js +22 -22
- package/services/dist/services.es.js.map +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{mergeFromGlobal as e,generateTomTomHeaders as t,getPosition as n,poiCategoriesToID as r,toPointGeometry as o,views as i,bboxFromGeoJSON as s,bboxOnlyIfWithArea as a,generateId as c,bboxFromCoordsArray as u,plugTypes as p,currentTypes as l,avoidableTypes as d,getPositionStrict as h,getRoutePlanningLocationType as g,inputSectionTypesWithGuidance as f,inputSectionTypes as m,indexedMagnitudes as y}from"@tomtom-org/maps-sdk/core";var v=/* @__PURE__ */(e=>(e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.FORBIDDEN=403]="FORBIDDEN",e))(v||{});class b extends Error{constructor(e,t,n){super(e),this.service=t,this.issues=n,Error.captureStackTrace&&Error.captureStackTrace(this,b)}}const _={[v.TOO_MANY_REQUESTS]:"Too Many Requests: The API Key is over QPS (Queries per second)",[v.FORBIDDEN]:"Request failed with status code 403"};class w extends b{constructor(e,t,n){super(e,t),this.status=n,this.status&&_[this.status]&&(this.message=_[this.status])}}const S=(e,t)=>{const{data:n,message:r,status:o}=e;return new w(n?.error||n?.errorText||r,t,o)},P=(e,t,n)=>{if(e.status){const r=e;return n?n(r,t):S(r,t)}return new b(e.message,t)},T=(e,t)=>new b(e.message,t,e.issues);function I(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const o=s.prototype,i=Object.keys(o);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=o[t].bind(n))}}const o=n?.Parent??Object;class i extends o{}function s(e){var t;const o=n?.Parent?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class j extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const z={};function x(e){return z}function C(e,t){return"bigint"==typeof t?t.toString():t}function R(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function A(e){return null==e}function k(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const O=/* @__PURE__ */Symbol("evaluating");function E(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==O)return void 0===r&&(r=O,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function M(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function L(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}const $="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function F(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const U=/* @__PURE__ */new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function B(e,t){if(!function(e){if(!1===F(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==F(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=L(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return M(this,"shape",n),n}});return N(e,r)}function q(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function H(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function K(e){return"string"==typeof e?e:e?.message}function Z(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=K(e.inst?._zod.def?.error?.(e))??K(t?.error?.(e))??K(n.customError?.(e))??K(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function V(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}const G=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,C,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Y=I("$ZodError",G),J=I("$ZodError",G,{Parent:Error});function Q(e){const t=[],n=e.map(e=>"object"==typeof e?e.key:e);for(const r of n)"number"==typeof r?t.push(`[${r}]`):"symbol"==typeof r?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}const X=/* @__PURE__ */(e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new j;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Z(e,i,x())));throw $(t,o?.callee),t}return s.value})(J),ee=/* @__PURE__ */(e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Z(e,i,x())));throw $(t,o?.callee),t}return s.value})(J),te=/* @__PURE__ */(e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new j;return i.issues.length?{success:!1,error:new(e??Y)(i.issues.map(e=>Z(e,o,x())))}:{success:!0,data:i.value}})(J),ne=/* @__PURE__ */(e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>Z(e,o,x())))}:{success:!0,data:i.value}})(J),re=/^-?\d+(?:\.\d+)?$/,oe=/^(?:true|false)$/i,ie=/^undefined$/i,se=/* @__PURE__ */I("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ae={number:"number",bigint:"bigint",object:"date"},ce=/* @__PURE__ */I("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ue=/* @__PURE__ */I("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pe=/* @__PURE__ */I("$ZodCheckMaxLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=V(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),le=/* @__PURE__ */I("$ZodCheckMinLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=V(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),de=/* @__PURE__ */I("$ZodCheckLengthEquals",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=V(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),he={major:4,minor:3,patch:5},ge=/* @__PURE__ */I("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const t of o._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=q(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new j;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(o||(o=q(e,t)))});else{if(e.issues.length===t)continue;o||(o=q(e,t))}}return r?r.then(()=>e):e},n=(n,o,i)=>{if(q(n))return n.aborted=!0,n;const s=t(o,r,i);if(s instanceof Promise){if(!1===i.async)throw new j;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if("backward"===i.direction){const t=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,i)):n(t,o,i)}const s=e._zod.parse(o,i);if(s instanceof Promise){if(!1===i.async)throw new j;return s.then(e=>t(e,r,i))}return t(s,r,i)}}E(e,"~standard",()=>({validate:t=>{try{const n=te(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return ne(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),fe=/* @__PURE__ */I("$ZodString",(e,t)=>{var n;ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),me=/* @__PURE__ */I("$ZodNumber",(e,t)=>{ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??re,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),ye=/* @__PURE__ */I("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=oe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ve=/* @__PURE__ */I("$ZodUndefined",(e,t)=>{ge.init(e,t),e._zod.pattern=ie,e._zod.values=/* @__PURE__ */new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),t}}),be=/* @__PURE__ */I("$ZodAny",(e,t)=>{ge.init(e,t),e._zod.parse=e=>e}),_e=/* @__PURE__ */I("$ZodDate",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(s){}const o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function we(e,t,n){e.issues.length&&t.issues.push(...H(n,e.issues)),t.value[n]=e.value}const Se=/* @__PURE__ */I("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>we(t,n,e))):we(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function Pe(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...H(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Te(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}const Ie=/* @__PURE__ */I("$ZodObject",(e,t)=>{ge.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=R(()=>Te(t));E(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const o=F,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e],o="optional"===r._zod.optout,i=r._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then(n=>Pe(n,t,e,a,o))):Pe(i,t,e,a,o)}return i?function(e,t,n,r,o,i){const s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,p="optional"===c.optout;for(const l in t){if(a.has(l))continue;if("never"===u){s.push(l);continue}const o=c.run({value:t[l],issues:[]},r);o instanceof Promise?e.push(o.then(e=>Pe(e,n,l,t,p))):Pe(o,n,l,t,p)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}});function je(e,t,n,r){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!q(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Z(e,r,x())))}),t)}const ze=/* @__PURE__ */I("$ZodUnion",(e,t)=>{ge.init(e,t),E(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),E(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),E(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>k(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>je(t,o,e,i)):je(a,o,e,i)}}),xe=/* @__PURE__ */I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ze.init(e,t);const n=e._zod.parse;E(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const r of n)e[t].add(r)}}return e});const r=R(()=>{const e=t.options,n=/* @__PURE__ */new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(o,i)=>{const s=o.value;if(!F(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),Ce=/* @__PURE__ */I("$ZodTuple",(e,t)=>{ge.init(e,t);const n=t.items;e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[],a=[...n].reverse().findIndex(e=>"optional"!==e._zod.optin),c=-1===a?0:n.length-a;if(!t.rest){const t=i.length>n.length,o=i.length<c-1;if(t||o)return r.issues.push({...t?{code:"too_big",maximum:n.length,inclusive:!0}:{code:"too_small",minimum:n.length},input:i,inst:e,origin:"array"}),r}let u=-1;for(const e of n){if(u++,u>=i.length&&u>=c)continue;const t=e._zod.run({value:i[u],issues:[]},o);t instanceof Promise?s.push(t.then(e=>Re(e,r,u))):Re(t,r,u)}if(t.rest){const e=i.slice(n.length);for(const n of e){u++;const e=t.rest._zod.run({value:n,issues:[]},o);e instanceof Promise?s.push(e.then(e=>Re(e,r,u))):Re(e,r,u)}}return s.length?Promise.all(s).then(()=>r):r}});function Re(e,t,n){e.issues.length&&t.issues.push(...H(n,e.issues)),t.value[n]=e.value}const Ae=/* @__PURE__ */I("$ZodEnum",(e,t)=>{ge.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>U.has(typeof e)).map(e=>"string"==typeof e?W(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),ke=/* @__PURE__ */I("$ZodLiteral",(e,t)=>{if(ge.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?W(e):e?W(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});function Oe(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ee=/* @__PURE__ */I("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${k(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Oe(t,e.value)):Oe(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Me=/* @__PURE__ */I("$ZodCustom",(e,t)=>{se.init(e,t),ge.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>Le(t,n,r,e));Le(o,n,r,e)}});function Le(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(function(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}(e))}}var $e;class Fe{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ue(e,t){return new e({type:"string",...D(t)})}function We(e,t){return new e({type:"number",checks:[],...D(t)})}function Ne(e,t){return new e({type:"boolean",...D(t)})}function De(e,t){return new e({type:"undefined",...D(t)})}function Be(e){return new e({type:"any"})}function qe(e,t){return new e({type:"date",...D(t)})}function He(e,t){return new ce({check:"less_than",...D(t),value:e,inclusive:!0})}function Ke(e,t){return new ue({check:"greater_than",...D(t),value:e,inclusive:!1})}function Ze(e,t){return new ue({check:"greater_than",...D(t),value:e,inclusive:!0})}function Ve(e){/* @__PURE__ */
|
|
2
|
-
return Ke(0,e)}function Ge(e,t){return new pe({check:"max_length",...D(t),maximum:e})}function Ye(e,t){return new le({check:"min_length",...D(t),minimum:e})}function Je(e,t){return new de({check:"length_equals",...D(t),length:e})}function Qe(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}($e=globalThis).__zod_globalRegistry??($e.__zod_globalRegistry=new Fe);const Xe=/* @__PURE__ */
|
|
3
|
-
return Ue(et,e)}const nt=/* @__PURE__ */
|
|
4
|
-
return We(nt,e)}const ot=/* @__PURE__ */
|
|
5
|
-
return Ne(ot,e)}const st=/* @__PURE__ */
|
|
6
|
-
return De(st,e)}const ct=/* @__PURE__ */
|
|
7
|
-
return Be(ct)}const pt=/* @__PURE__ */
|
|
8
|
-
return qe(pt,e)}const dt=/* @__PURE__ */
|
|
9
|
-
return
|
|
1
|
+
import{mergeFromGlobal as e,generateTomTomHeaders as t,getPosition as n,poiCategoriesToID as r,toPointGeometry as o,views as i,bboxFromGeoJSON as s,bboxOnlyIfWithArea as a,generateId as c,bboxFromCoordsArray as u,plugTypes as p,currentTypes as l,avoidableTypes as d,getPositionStrict as h,getRoutePlanningLocationType as g,inputSectionTypesWithGuidance as f,inputSectionTypes as m,indexedMagnitudes as y}from"@tomtom-org/maps-sdk/core";var v=/* @__PURE__ */(e=>(e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.FORBIDDEN=403]="FORBIDDEN",e))(v||{});class b extends Error{constructor(e,t,n){super(e),this.service=t,this.issues=n,Error.captureStackTrace&&Error.captureStackTrace(this,b)}}const _={[v.TOO_MANY_REQUESTS]:"Too Many Requests: The API Key is over QPS (Queries per second)",[v.FORBIDDEN]:"Request failed with status code 403"};class w extends b{constructor(e,t,n){super(e,t),this.status=n,this.status&&_[this.status]&&(this.message=_[this.status])}}const S=(e,t)=>{const{data:n,message:r,status:o}=e;return new w(n?.error||n?.errorText||r,t,o)},P=(e,t,n)=>{if(e.status){const r=e;return n?n(r,t):S(r,t)}return new b(e.message,t)},T=(e,t)=>new b(e.message,t,e.issues);function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:s,traits:/* @__PURE__ */new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const o=s.prototype,i=Object.keys(o);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=o[t].bind(n))}}const o=n?.Parent??Object;class i extends o{}function s(e){var t;const o=n?.Parent?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class I extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const z={};function x(e){return z}function C(e,t){return"bigint"==typeof t?t.toString():t}function R(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function A(e){return null==e}function k(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const O=/* @__PURE__ */Symbol("evaluating");function E(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==O)return void 0===r&&(r=O,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function M(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function L(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}const $="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function F(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const U=/* @__PURE__ */new Set(["string","number","symbol"]);function W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function B(e,t){if(!function(e){if(!1===F(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==F(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=L(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return M(this,"shape",n),n}});return N(e,r)}function q(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function H(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function K(e){return"string"==typeof e?e:e?.message}function Z(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=K(e.inst?._zod.def?.error?.(e))??K(t?.error?.(e))??K(n.customError?.(e))??K(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function V(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}const G=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,C,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Y=j("$ZodError",G),J=j("$ZodError",G,{Parent:Error});function Q(e){const t=[],n=e.map(e=>"object"==typeof e?e.key:e);for(const r of n)"number"==typeof r?t.push(`[${r}]`):"symbol"==typeof r?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}const X=/* @__PURE__ */(e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new I;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Z(e,i,x())));throw $(t,o?.callee),t}return s.value})(J),ee=/* @__PURE__ */(e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Z(e,i,x())));throw $(t,o?.callee),t}return s.value})(J),te=/* @__PURE__ */(e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new I;return i.issues.length?{success:!1,error:new(e??Y)(i.issues.map(e=>Z(e,o,x())))}:{success:!0,data:i.value}})(J),ne=/* @__PURE__ */(e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>Z(e,o,x())))}:{success:!0,data:i.value}})(J),re=/^-?\d+(?:\.\d+)?$/,oe=/^(?:true|false)$/i,ie=/^undefined$/i,se=/* @__PURE__ */j("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ae={number:"number",bigint:"bigint",object:"date"},ce=/* @__PURE__ */j("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ue=/* @__PURE__ */j("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pe=/* @__PURE__ */j("$ZodCheckMaxLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=V(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),le=/* @__PURE__ */j("$ZodCheckMinLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=V(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),de=/* @__PURE__ */j("$ZodCheckLengthEquals",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!A(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=V(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),he={major:4,minor:3,patch:5},ge=/* @__PURE__ */j("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const t of o._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=q(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new I;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(o||(o=q(e,t)))});else{if(e.issues.length===t)continue;o||(o=q(e,t))}}return r?r.then(()=>e):e},n=(n,o,i)=>{if(q(n))return n.aborted=!0,n;const s=t(o,r,i);if(s instanceof Promise){if(!1===i.async)throw new I;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if("backward"===i.direction){const t=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,i)):n(t,o,i)}const s=e._zod.parse(o,i);if(s instanceof Promise){if(!1===i.async)throw new I;return s.then(e=>t(e,r,i))}return t(s,r,i)}}E(e,"~standard",()=>({validate:t=>{try{const n=te(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return ne(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),fe=/* @__PURE__ */j("$ZodString",(e,t)=>{var n;ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),me=/* @__PURE__ */j("$ZodNumber",(e,t)=>{ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??re,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),ye=/* @__PURE__ */j("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=oe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ve=/* @__PURE__ */j("$ZodUndefined",(e,t)=>{ge.init(e,t),e._zod.pattern=ie,e._zod.values=/* @__PURE__ */new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),t}}),be=/* @__PURE__ */j("$ZodAny",(e,t)=>{ge.init(e,t),e._zod.parse=e=>e}),_e=/* @__PURE__ */j("$ZodDate",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(s){}const o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function we(e,t,n){e.issues.length&&t.issues.push(...H(n,e.issues)),t.value[n]=e.value}const Se=/* @__PURE__ */j("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>we(t,n,e))):we(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function Pe(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...H(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Te(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}const je=/* @__PURE__ */j("$ZodObject",(e,t)=>{ge.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=R(()=>Te(t));E(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */new Set);for(const e of r.values)n[t].add(e)}}return n});const o=F,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e],o="optional"===r._zod.optout,i=r._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then(n=>Pe(n,t,e,a,o))):Pe(i,t,e,a,o)}return i?function(e,t,n,r,o,i){const s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,p="optional"===c.optout;for(const l in t){if(a.has(l))continue;if("never"===u){s.push(l);continue}const o=c.run({value:t[l],issues:[]},r);o instanceof Promise?e.push(o.then(e=>Pe(e,n,l,t,p))):Pe(o,n,l,t,p)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}});function Ie(e,t,n,r){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!q(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Z(e,r,x())))}),t)}const ze=/* @__PURE__ */j("$ZodUnion",(e,t)=>{ge.init(e,t),E(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),E(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),E(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>k(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>Ie(t,o,e,i)):Ie(a,o,e,i)}}),xe=/* @__PURE__ */j("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ze.init(e,t);const n=e._zod.parse;E(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const r of n)e[t].add(r)}}return e});const r=R(()=>{const e=t.options,n=/* @__PURE__ */new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(o,i)=>{const s=o.value;if(!F(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),Ce=/* @__PURE__ */j("$ZodTuple",(e,t)=>{ge.init(e,t);const n=t.items;e._zod.parse=(r,o)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const s=[],a=[...n].reverse().findIndex(e=>"optional"!==e._zod.optin),c=-1===a?0:n.length-a;if(!t.rest){const t=i.length>n.length,o=i.length<c-1;if(t||o)return r.issues.push({...t?{code:"too_big",maximum:n.length,inclusive:!0}:{code:"too_small",minimum:n.length},input:i,inst:e,origin:"array"}),r}let u=-1;for(const e of n){if(u++,u>=i.length&&u>=c)continue;const t=e._zod.run({value:i[u],issues:[]},o);t instanceof Promise?s.push(t.then(e=>Re(e,r,u))):Re(t,r,u)}if(t.rest){const e=i.slice(n.length);for(const n of e){u++;const e=t.rest._zod.run({value:n,issues:[]},o);e instanceof Promise?s.push(e.then(e=>Re(e,r,u))):Re(e,r,u)}}return s.length?Promise.all(s).then(()=>r):r}});function Re(e,t,n){e.issues.length&&t.issues.push(...H(n,e.issues)),t.value[n]=e.value}const Ae=/* @__PURE__ */j("$ZodEnum",(e,t)=>{ge.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>U.has(typeof e)).map(e=>"string"==typeof e?W(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),ke=/* @__PURE__ */j("$ZodLiteral",(e,t)=>{if(ge.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?W(e):e?W(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});function Oe(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ee=/* @__PURE__ */j("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?/* @__PURE__ */new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${k(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Oe(t,e.value)):Oe(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Me=/* @__PURE__ */j("$ZodCustom",(e,t)=>{se.init(e,t),ge.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>Le(t,n,r,e));Le(o,n,r,e)}});function Le(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(function(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}(e))}}var $e;class Fe{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ue(e,t){return new e({type:"string",...D(t)})}function We(e,t){return new e({type:"number",checks:[],...D(t)})}function Ne(e,t){return new e({type:"boolean",...D(t)})}function De(e,t){return new e({type:"undefined",...D(t)})}function Be(e){return new e({type:"any"})}function qe(e,t){return new e({type:"date",...D(t)})}function He(e,t){return new ce({check:"less_than",...D(t),value:e,inclusive:!0})}function Ke(e,t){return new ue({check:"greater_than",...D(t),value:e,inclusive:!1})}function Ze(e,t){return new ue({check:"greater_than",...D(t),value:e,inclusive:!0})}function Ve(e){/* @__PURE__ */
|
|
2
|
+
return Ke(0,e)}function Ge(e,t){return new pe({check:"max_length",...D(t),maximum:e})}function Ye(e,t){return new le({check:"min_length",...D(t),minimum:e})}function Je(e,t){return new de({check:"length_equals",...D(t),length:e})}function Qe(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}($e=globalThis).__zod_globalRegistry??($e.__zod_globalRegistry=new Fe);const Xe=/* @__PURE__ */j("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ge.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>X(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>te(e,t,n),e.parseAsync=async(t,n)=>ee(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ne(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>N(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.apply=t=>t(e)}),et=/* @__PURE__ */j("ZodMiniString",(e,t)=>{fe.init(e,t),Xe.init(e,t)});function tt(e){/* @__PURE__ */
|
|
3
|
+
return Ue(et,e)}const nt=/* @__PURE__ */j("ZodMiniNumber",(e,t)=>{me.init(e,t),Xe.init(e,t)});function rt(e){/* @__PURE__ */
|
|
4
|
+
return We(nt,e)}const ot=/* @__PURE__ */j("ZodMiniBoolean",(e,t)=>{ye.init(e,t),Xe.init(e,t)});function it(e){/* @__PURE__ */
|
|
5
|
+
return Ne(ot,e)}const st=/* @__PURE__ */j("ZodMiniUndefined",(e,t)=>{ve.init(e,t),Xe.init(e,t)});function at(e){/* @__PURE__ */
|
|
6
|
+
return De(st,e)}const ct=/* @__PURE__ */j("ZodMiniAny",(e,t)=>{be.init(e,t),Xe.init(e,t)});function ut(){/* @__PURE__ */
|
|
7
|
+
return Be(ct)}const pt=/* @__PURE__ */j("ZodMiniDate",(e,t)=>{_e.init(e,t),Xe.init(e,t)});function lt(e){/* @__PURE__ */
|
|
8
|
+
return qe(pt,e)}const dt=/* @__PURE__ */j("ZodMiniArray",(e,t)=>{Se.init(e,t),Xe.init(e,t)});function ht(e,t){return new dt({type:"array",element:e,...D(t)})}function gt(e){const t=e._zod.def.shape;/* @__PURE__ */
|
|
9
|
+
return It(Object.keys(t))}const ft=/* @__PURE__ */j("ZodMiniObject",(e,t)=>{je.init(e,t),Xe.init(e,t),E(e,"shape",()=>t.shape)});function mt(e,t){const n={type:"object",shape:e??{},...D(t)};return new ft(n)}function yt(e,t){return B(e,t)}function vt(e,t){return function(e,t){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=L(t._zod.def,{get shape(){const n=t._zod.def.shape,r={...n};for(const t in n)r[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return M(this,"shape",r),r},checks:[]});return N(t,r)}(Ct,e)}const bt=/* @__PURE__ */j("ZodMiniUnion",(e,t)=>{ze.init(e,t),Xe.init(e,t)});function _t(e,t){return new bt({type:"union",options:e,...D(t)})}const wt=/* @__PURE__ */j("ZodMiniDiscriminatedUnion",(e,t)=>{xe.init(e,t),Xe.init(e,t)});function St(e,t,n){return new wt({type:"union",options:t,discriminator:e,...D(n)})}const Pt=/* @__PURE__ */j("ZodMiniTuple",(e,t)=>{Ce.init(e,t),Xe.init(e,t)});function Tt(e,t,n){const r=t instanceof ge;return new Pt({type:"tuple",items:e,rest:r?t:null,...D(r?n:t)})}const jt=/* @__PURE__ */j("ZodMiniEnum",(e,t)=>{Ae.init(e,t),Xe.init(e,t),e.options=Object.values(t.entries)});function It(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new jt({type:"enum",entries:n,...D(t)})}const zt=/* @__PURE__ */j("ZodMiniLiteral",(e,t)=>{ke.init(e,t),Xe.init(e,t)});function xt(e,t){return new zt({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const Ct=/* @__PURE__ */j("ZodMiniOptional",(e,t)=>{Ee.init(e,t),Xe.init(e,t)});function Rt(e){return new Ct({type:"optional",innerType:e})}const At=/* @__PURE__ */j("ZodMiniCustom",(e,t)=>{Me.init(e,t),Xe.init(e,t)});function kt(e,t={}){/* @__PURE__ */
|
|
10
10
|
return Qe(At,e,t)}const Ot=/* @__PURE__ */vt(
|
|
11
11
|
/* @__PURE__ */mt({apiKey:/* @__PURE__ */tt(),commonBaseURL:/* @__PURE__ */tt(),customServiceBaseURL:/* @__PURE__ */tt(),language:/* @__PURE__ */tt()}));class Et extends Error{constructor(e){super(function(e){const t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(const r of n)t.push(`✖ ${r.message}`),r.path?.length&&t.push(` → at ${Q(r.path)}`);return t.join("\n")}(e)),this.issues=e.issues}}const Mt=async(n,r,o)=>{const i=r.getAPIVersion?.(n),s=e({...n,...i&&{apiVersion:i}});if(void 0===n.validateRequest||n.validateRequest)try{((e,t)=>{const n=(t?.schema?/* @__PURE__ */yt(Ot,t.schema.shape):Ot).check(
|
|
12
|
-
/* @__PURE__ */kt(e=>"commonBaseURL"in e||"customServiceBaseURL"in e,"commonBaseURL or customServiceBaseURL is required"));let r;if(t?.refinements?.length){r=n;for(const e of t.refinements)r=r.check(/* @__PURE__ */kt(e.check,e.message))}const o=(r??n).safeParse(e);if(!o.success)throw new Et(o.error)})(s,r.requestValidation)}catch(u){return Promise.reject(T(u,o))}const a=r.buildRequest(s),c=t(s);n.onAPIRequest?.(a);try{const e=await r.sendRequest(a,c);return n.onAPIResponse?.(a,e),r.parseResponse(await e.data,s)}catch(u){return n.onAPIResponse?.(a,u),Promise.reject(P(u,o,r.parseResponseError))}};class Lt extends Error{constructor(e,t,n){super(t??`HTTP Error ${e}`),this.name="FetchError",this.status=e,this.data=n,Error.captureStackTrace&&Error.captureStackTrace(this,Lt)}}const $t=async e=>{if(e.ok)return{data:await e.json(),status:e.status};let t,n;const r=e.headers.get("content-type");throw e.bodyUsed?t=e.statusText:r?.includes("application/json")?(n=await e.json(),t=n?.errorText??n?.message??n?.detailedError?.message):r?.includes("text/xml")&&(n=await e.text(),t=e.statusText),new Lt(e.status,t,n)},Ft=async(e,t)=>$t(await fetch(e,{headers:t})),Ut=async(e,t)=>$t(await fetch(e.url,{method:"POST",body:JSON.stringify(e.data),headers:{...t,"Content-Type":"application/json"}})),Wt=/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */rt())),Nt=/* @__PURE__ */mt({type:/* @__PURE__ */
|
|
12
|
+
/* @__PURE__ */kt(e=>"commonBaseURL"in e||"customServiceBaseURL"in e,"commonBaseURL or customServiceBaseURL is required"));let r;if(t?.refinements?.length){r=n;for(const e of t.refinements)r=r.check(/* @__PURE__ */kt(e.check,e.message))}const o=(r??n).safeParse(e);if(!o.success)throw new Et(o.error)})(s,r.requestValidation)}catch(u){return Promise.reject(T(u,o))}const a=r.buildRequest(s),c=t(s);n.onAPIRequest?.(a);try{const e=await r.sendRequest(a,c);return n.onAPIResponse?.(a,e),r.parseResponse(await e.data,s)}catch(u){return n.onAPIResponse?.(a,u),Promise.reject(P(u,o,r.parseResponseError))}};class Lt extends Error{constructor(e,t,n){super(t??`HTTP Error ${e}`),this.name="FetchError",this.status=e,this.data=n,Error.captureStackTrace&&Error.captureStackTrace(this,Lt)}}const $t=async e=>{if(e.ok)return{data:await e.json(),status:e.status};let t,n;const r=e.headers.get("content-type");throw e.bodyUsed?t=e.statusText:r?.includes("application/json")?(n=await e.json(),t=n?.errorText??n?.message??n?.detailedError?.message):r?.includes("text/xml")&&(n=await e.text(),t=e.statusText),new Lt(e.status,t,n)},Ft=async(e,t)=>$t(await fetch(e,{headers:t})),Ut=async(e,t)=>$t(await fetch(e.url,{method:"POST",body:JSON.stringify(e.data),headers:{...t,"Content-Type":"application/json"}})),Wt=/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */rt())),Nt=/* @__PURE__ */mt({type:/* @__PURE__ */It(["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Circle"]),coordinates:/* @__PURE__ */_t([
|
|
13
13
|
/* @__PURE__ */ht(/* @__PURE__ */rt()),Wt,
|
|
14
14
|
/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */rt()))),
|
|
15
15
|
/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */ht(/* @__PURE__ */rt()))))]),radius:/* @__PURE__ */Rt(/* @__PURE__ */rt()),radiusMeters:/* @__PURE__ */Rt(/* @__PURE__ */rt()),bbox:/* @__PURE__ */Rt(/* @__PURE__ */ht(/* @__PURE__ */rt()))}).check(
|
|
@@ -20,27 +20,27 @@ return Qe(At,e,t)}const Ot=/* @__PURE__ */vt(
|
|
|
20
20
|
/* @__PURE__ */rt().check(/* @__PURE__ */Ze(-90),/* @__PURE__ */He(90)),
|
|
21
21
|
/* @__PURE__ */rt()]),
|
|
22
22
|
/* @__PURE__ */mt({type:/* @__PURE__ */xt("Point"),coordinates:/* @__PURE__ */ht(/* @__PURE__ */rt())}),Dt]),Ht=/* @__PURE__ */_t([/* @__PURE__ */ht(/* @__PURE__ */rt()).check(/* @__PURE__ */Je(4)),/* @__PURE__ */ht(/* @__PURE__ */rt()).check(/* @__PURE__ */Je(6))]),Kt=/* @__PURE__ */_t([Nt,Dt,Bt]),Zt=/* @__PURE__ */_t([Ht,Kt,/* @__PURE__ */ht(Kt)]),Vt=/* @__PURE__ */yt(/* @__PURE__ */mt({query:/* @__PURE__ */tt()}),/* @__PURE__ */vt(
|
|
23
|
-
/* @__PURE__ */mt({position:qt,limit:/* @__PURE__ */rt().check(/* @__PURE__ */He(100)),radiusMeters:/* @__PURE__ */rt(),countries:/* @__PURE__ */ht(/* @__PURE__ */tt()),resultType:/* @__PURE__ */ht(/* @__PURE__ */tt())})).shape);var Gt="object"==typeof global&&global&&global.Object===Object&&global,Yt="object"==typeof self&&self&&self.Object===Object&&self,Jt=Gt||Yt||Function("return this")(),Qt=Jt.Symbol,Xt=Object.prototype,en=Xt.hasOwnProperty,tn=Xt.toString,nn=Qt?Qt.toStringTag:void 0;var rn=Object.prototype.toString;var on=Qt?Qt.toStringTag:void 0;function sn(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":on&&on in Object(e)?function(e){var t=en.call(e,nn),n=e[nn];try{e[nn]=void 0;var r=!0}catch(i){}var o=tn.call(e);return r&&(t?e[nn]=n:delete e[nn]),o}(e):function(e){return rn.call(e)}(e)}function an(e){return null!=e&&"object"==typeof e}function cn(e){return"symbol"==typeof e||an(e)&&"[object Symbol]"==sn(e)}function un(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var pn=Array.isArray,ln=Qt?Qt.prototype:void 0,dn=ln?ln.toString:void 0;function hn(e){if("string"==typeof e)return e;if(pn(e))return un(e,hn)+"";if(cn(e))return dn?dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function gn(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function fn(e){if(!gn(e))return!1;var t=sn(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var mn,yn=Jt["__core-js_shared__"],vn=(mn=/[^.]+$/.exec(yn&&yn.keys&&yn.keys.IE_PROTO||""))?"Symbol(src)_1."+mn:"";var bn=Function.prototype.toString;function _n(e){if(null!=e){try{return bn.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var wn=/^\[object .+?Constructor\]$/,Sn=Function.prototype,Pn=Object.prototype,Tn=Sn.toString,In=Pn.hasOwnProperty,jn=RegExp("^"+Tn.call(In).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zn(e){return!(!gn(e)||(t=e,vn&&vn in t))&&(fn(e)?jn:wn).test(_n(e));var t}function xn(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return zn(n)?n:void 0}var Cn=xn(Jt,"WeakMap");var Rn=Date.now;var An,kn,On,En=function(){try{var e=xn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Mn=En?function(e,t){return En(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:function(e){return e},Ln=(An=Mn,kn=0,On=0,function(){var e=Rn(),t=16-(e-On);if(On=e,t>0){if(++kn>=800)return arguments[0]}else kn=0;return An.apply(void 0,arguments)});var $n=/^(?:0|[1-9]\d*)$/;function Fn(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&$n.test(e))&&e>-1&&e%1==0&&e<t}function Un(e,t,n){"__proto__"==t&&En?En(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Wn(e,t){return e===t||e!=e&&t!=t}var Nn=Object.prototype.hasOwnProperty;function Dn(e,t,n){var r=e[t];Nn.call(e,t)&&Wn(r,n)&&(void 0!==n||t in e)||Un(e,t,n)}var Bn=Math.max;function qn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var Hn=Object.prototype;function Kn(e){return an(e)&&"[object Arguments]"==sn(e)}var Zn=Object.prototype,Vn=Zn.hasOwnProperty,Gn=Zn.propertyIsEnumerable,Yn=Kn(/* @__PURE__ */function(){return arguments}())?Kn:function(e){return an(e)&&Vn.call(e,"callee")&&!Gn.call(e,"callee")};var Jn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qn=Jn&&"object"==typeof module&&module&&!module.nodeType&&module,Xn=Qn&&Qn.exports===Jn?Jt.Buffer:void 0,er=(Xn?Xn.isBuffer:void 0)||function(){return!1},tr={};function nr(e){return function(t){return e(t)}}tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Arguments]"]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object Boolean]"]=tr["[object DataView]"]=tr["[object Date]"]=tr["[object Error]"]=tr["[object Function]"]=tr["[object Map]"]=tr["[object Number]"]=tr["[object Object]"]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object WeakMap]"]=!1;var rr="object"==typeof exports&&exports&&!exports.nodeType&&exports,or=rr&&"object"==typeof module&&module&&!module.nodeType&&module,ir=or&&or.exports===rr&&Gt.process,sr=function(){try{var e=or&&or.require&&or.require("util").types;return e||ir&&ir.binding&&ir.binding("util")}catch(t){}}(),ar=sr&&sr.isTypedArray,cr=ar?nr(ar):function(e){return an(e)&&qn(e.length)&&!!tr[sn(e)]};function ur(e,t){var n=pn(e),r=!n&&Yn(e),o=!n&&!r&&er(e),i=!n&&!r&&!o&&cr(e),s=n||r||o||i,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var u in e)s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Fn(u,c))||a.push(u);return a}var pr=Object.prototype.hasOwnProperty;function lr(e){if(!gn(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t,n,r=(n=(t=e)&&t.constructor,t===("function"==typeof n&&n.prototype||Hn)),o=[];for(var i in e)("constructor"!=i||!r&&pr.call(e,i))&&o.push(i);return o}function dr(e){return null!=(t=e)&&qn(t.length)&&!fn(t)?ur(e):lr(e);var t}var hr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gr=/^\w*$/;var fr=xn(Object,"create");var mr=Object.prototype.hasOwnProperty;var yr=Object.prototype.hasOwnProperty;function vr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function br(e,t){for(var n=e.length;n--;)if(Wn(e[n][0],t))return n;return-1}vr.prototype.clear=function(){this.__data__=fr?fr(null):{},this.size=0},vr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vr.prototype.get=function(e){var t=this.__data__;if(fr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return mr.call(t,e)?t[e]:void 0},vr.prototype.has=function(e){var t=this.__data__;return fr?void 0!==t[e]:yr.call(t,e)},vr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fr&&void 0===t?"__lodash_hash_undefined__":t,this};var _r=Array.prototype.splice;function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wr.prototype.clear=function(){this.__data__=[],this.size=0},wr.prototype.delete=function(e){var t=this.__data__,n=br(t,e);return!(n<0)&&(n==t.length-1?t.pop():_r.call(t,n,1),--this.size,!0)},wr.prototype.get=function(e){var t=this.__data__,n=br(t,e);return n<0?void 0:t[n][1]},wr.prototype.has=function(e){return br(this.__data__,e)>-1},wr.prototype.set=function(e,t){var n=this.__data__,r=br(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Sr=xn(Jt,"Map");function Pr(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Tr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Tr.prototype.clear=function(){this.size=0,this.__data__={hash:new vr,map:new(Sr||wr),string:new vr}},Tr.prototype.delete=function(e){var t=Pr(this,e).delete(e);return this.size-=t?1:0,t},Tr.prototype.get=function(e){return Pr(this,e).get(e)},Tr.prototype.has=function(e){return Pr(this,e).has(e)},Tr.prototype.set=function(e,t){var n=Pr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function Ir(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Ir.Cache||Tr),n}Ir.Cache=Tr;var jr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zr=/\\(\\)?/g,xr=function(e){var t=Ir(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(jr,function(e,n,r,o){t.push(r?o.replace(zr,"$1"):n||e)}),t});function Cr(e,t){return pn(e)?e:function(e,t){if(pn(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!cn(e))||gr.test(e)||!hr.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:xr(function(e){return null==e?"":hn(e)}(e))}function Rr(e){if("string"==typeof e||cn(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ar(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var kr=Qt?Qt.isConcatSpreadable:void 0;function Or(e){return pn(e)||Yn(e)||!!(kr&&e&&e[kr])}function Er(e){return(null==e?0:e.length)?function(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=Or),o||(o=[]);++i<s;){var a=e[i];n(a)?Ar(o,a):o[o.length]=a}return o}(e):[]}var Mr=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Lr=Function.prototype,$r=Object.prototype,Fr=Lr.toString,Ur=$r.hasOwnProperty,Wr=Fr.call(Object);function Nr(e){var t=this.__data__=new wr(e);this.size=t.size}Nr.prototype.clear=function(){this.__data__=new wr,this.size=0},Nr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Nr.prototype.get=function(e){return this.__data__.get(e)},Nr.prototype.has=function(e){return this.__data__.has(e)},Nr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wr){var r=n.__data__;if(!Sr||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tr(r)}return n.set(e,t),this.size=n.size,this};var Dr="object"==typeof exports&&exports&&!exports.nodeType&&exports,Br=Dr&&"object"==typeof module&&module&&!module.nodeType&&module,qr=Br&&Br.exports===Dr?Jt.Buffer:void 0;function Hr(){return[]}qr&&qr.allocUnsafe;var Kr=Object.prototype.propertyIsEnumerable,Zr=Object.getOwnPropertySymbols,Vr=Zr?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}(Zr(e),function(t){return Kr.call(e,t)}))}:Hr,Gr=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ar(t,Vr(e)),e=Mr(e);return t}:Hr;function Yr(e){return function(e,t,n){var r=t(e);return pn(e)?r:Ar(r,n(e))}(e,dr,Gr)}var Jr=xn(Jt,"DataView"),Qr=xn(Jt,"Promise"),Xr=xn(Jt,"Set"),eo="[object Map]",to="[object Promise]",no="[object Set]",ro="[object WeakMap]",oo="[object DataView]",io=_n(Jr),so=_n(Sr),ao=_n(Qr),co=_n(Xr),uo=_n(Cn),po=sn;(Jr&&po(new Jr(new ArrayBuffer(1)))!=oo||Sr&&po(new Sr)!=eo||Qr&&po(Qr.resolve())!=to||Xr&&po(new Xr)!=no||Cn&&po(new Cn)!=ro)&&(po=function(e){var t=sn(e),n="[object Object]"==t?e.constructor:void 0,r=n?_n(n):"";if(r)switch(r){case io:return oo;case so:return eo;case ao:return to;case co:return no;case uo:return ro}return t});var lo=Object.prototype.hasOwnProperty;var ho=Jt.Uint8Array;function go(e){var t=new e.constructor(e.byteLength);return new ho(t).set(new ho(e)),t}var fo=/\w*$/;var mo=Qt?Qt.prototype:void 0,yo=mo?mo.valueOf:void 0;function vo(e,t,n){var r,o,i,s,a,c=e.constructor;switch(t){case"[object ArrayBuffer]":return go(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return a=go((s=e).buffer),new s.constructor(a,s.byteOffset,s.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e){var t=go(e.buffer);return new e.constructor(t,e.byteOffset,e.length)}(e);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return(i=new(o=e).constructor(o.source,fo.exec(o))).lastIndex=o.lastIndex,i;case"[object Symbol]":return r=e,yo?Object(yo.call(r)):{}}}var bo=sr&&sr.isMap,_o=bo?nr(bo):function(e){return an(e)&&"[object Map]"==po(e)};var wo=sr&&sr.isSet,So=wo?nr(wo):function(e){return an(e)&&"[object Set]"==po(e)},Po="[object Arguments]",To="[object Function]",Io="[object Object]",jo={};function zo(e,t,n,r,o,i){var s;if(n&&(s=o?n(e,r,o,i):n(e)),void 0!==s)return s;if(!gn(e))return e;var a=pn(e);if(a)s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&lo.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=po(e),u=c==To||"[object GeneratorFunction]"==c;if(er(e))return e.slice();if(c==Io||c==Po||u&&!o)s={};else{if(!jo[c])return o?e:{};s=vo(e,c)}}i||(i=new Nr);var p=i.get(e);if(p)return p;i.set(e,s),So(e)?e.forEach(function(r){s.add(zo(r,t,n,r,e,i))}):_o(e)&&e.forEach(function(r,o){s.set(o,zo(r,t,n,o,e,i))});var l=a?void 0:Yr(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(l||e,function(r,o){l&&(r=e[o=r]),Dn(s,o,zo(r,t,n,o,e,i))}),s}function xo(e,t){return t.length<2?e:function(e,t){for(var n=0,r=(t=Cr(t,e)).length;null!=e&&n<r;)e=e[Rr(t[n++])];return n&&n==r?e:void 0}(e,function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}(t,0,-1))}function Co(e){return null==e}jo[Po]=jo["[object Array]"]=jo["[object ArrayBuffer]"]=jo["[object DataView]"]=jo["[object Boolean]"]=jo["[object Date]"]=jo["[object Float32Array]"]=jo["[object Float64Array]"]=jo["[object Int8Array]"]=jo["[object Int16Array]"]=jo["[object Int32Array]"]=jo["[object Map]"]=jo["[object Number]"]=jo[Io]=jo["[object RegExp]"]=jo["[object Set]"]=jo["[object String]"]=jo["[object Symbol]"]=jo["[object Uint8Array]"]=jo["[object Uint8ClampedArray]"]=jo["[object Uint16Array]"]=jo["[object Uint32Array]"]=!0,jo["[object Error]"]=jo[To]=jo["[object WeakMap]"]=!1;var Ro=Object.prototype.hasOwnProperty;function Ao(e,t){var n=-1,r=(t=Cr(t,e)).length;if(!r)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<r;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!Ro.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<r&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=xo(e,t);return null==s||delete s[Rr(function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}(t))]}function ko(e){return function(e){if(!an(e)||"[object Object]"!=sn(e))return!1;var t=Mr(e);if(null===t)return!0;var n=Ur.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fr.call(n)==Wr}(e)?void 0:e}var Oo=function(e){return Ln(function(e,t,n){return t=Bn(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=Bn(r.length-t,0),s=Array(i);++o<i;)s[o]=r[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=r[o];return a[t]=n(s),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,void 0,Er),e+"")}(function(e,t){var n={};if(null==e)return n;var r=!1;t=un(t,function(t){return t=Cr(t,e),r||(r=t.length>1),t}),function(e,t,n){var r=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=void 0;void 0===a&&(a=e[s]),r?Un(n,s,a):Dn(n,s,a)}}(e,Yr(e),n),r&&(n=zo(n,7,ko));for(var o=t.length;o--;)Ao(n,t[o]);return n});const Eo=(e,t)=>{e.append("apiVersion",String(t.apiVersion)),e.append("key",t.apiKey),t.language&&e.append("language",t.language)},Mo=(e,t,n)=>{for(const r of n||[])e.append(t,r)},Lo=(e,t,n)=>{Array.isArray(n)&&n.length>0&&e.append(t,n.join(","))},$o=(e,t,n)=>{!Co(n)&&e.append(t,String(n))},Fo=(e,t)=>{const r=n(t);r&&(e.append("lat",String(r[1])),e.append("lon",String(r[0])))},Uo="/maps/orbis/places",Wo=(e,t)=>{const n=e.searchParams;Eo(n,t),$o(n,"limit",t.limit),Fo(n,t.position),Lo(n,"fuelSet",t.fuelTypes),Lo(n,"idxSet",t.indexes),Lo(n,"brandSet",t.poiBrands),t.poiCategories&&Lo(n,"categorySet",t.poiCategories.map(e=>"number"!=typeof e?r[e]:e)),Lo(n,"connectorSet",t.connectors),Lo(n,"mapcodes",t.mapcodes),Lo(n,"extendedPostalCodesFor",t.extendedPostalCodesFor),$o(n,"minPowerKW",t.minPowerKW),$o(n,"maxPowerKW",t.maxPowerKW),$o(n,"view",t.view),$o(n,"openingHours",t.openingHours),$o(n,"timeZone",t.timeZone),$o(n,"relatedPois",t.relatedPois),Lo(n,"entityTypeSet",t.geographyTypes)},No=e=>{const t=new URL(`${n=e,n.customServiceBaseURL||`${n.commonBaseURL}${Uo}/autocomplete/${n.query}.json`}`);var n;const r=t.searchParams;return e.language=e.language??"en-GB",Eo(r,e),$o(r,"limit",e.limit),Fo(r,e.position),Lo(r,"countrySet",e.countries),$o(r,"radius",e.radiusMeters),Lo(r,"resultSet",e.resultType),t},Do=e=>{const t=e.split(",");return[Number(t[1]),Number(t[0])]},Bo=e=>`${e[1]},${e[0]}`,qo=e=>{let t,n;return void 0!==e.topLeftPoint?(t=[e.topLeftPoint.lon,e.btmRightPoint.lat],n=[e.btmRightPoint.lon,e.topLeftPoint.lat]):(t=Do(e.southWest),n=Do(e.northEast)),[t[0],t[1],n[0],n[1]]},Ho=e=>[e.lon,e.lat],Ko=e=>{const{position:t,...n}=e.context.geoBias||{};return{...e,context:{...e.context,geoBias:{...t&&{position:Ho(t)},radiusMeters:n.radius}}}},Zo={requestValidation:{schema:Vt},buildRequest:No,sendRequest:Ft,parseResponse:Ko},Vo=async(e,t)=>Mt(e,{...Zo,...t},"Autocomplete"),Go={autocompleteSearch:Vo,buildAutocompleteSearchRequest:No,parseAutocompleteSearchResponse:Ko,autocompleteSearchTemplate:Zo},Yo=e=>{const t=new URL((e=>e.customServiceBaseURL??`${e.commonBaseURL}${Uo}/ev/id`)(e)),n=t.searchParams;return Eo(n,e),n.append("id",e.id),t},Jo=e=>e<12?"slow":e<50?"regular":e<150?"fast":"ultra-fast",Qo=e=>{const t={count:0,statusCounts:{}};for(const n of e)for(const e of n.chargingPoints)t.count++,t.statusCounts[e.status]=(t.statusCounts[e.status]||0)+1;return t},Xo=(e,t)=>e.type===t.type&&e.ratedPowerKW===t.ratedPowerKW,ei=(e,t,n)=>{if(e)for(const r of e){const e=n.find(e=>Xo(r,e.connector));if(e){if(e.count++,t){const n=e.statusCounts;e.statusCounts[t]=(n[t]||0)+1}}else n.push({connector:r,count:1,statusCounts:t?{[t]:1}:{}})}},ti=e=>{const t=[];return((e,t)=>{if(e)for(const n of e){const e=t.find(e=>Xo(n,e.connector));e?e.count++:t.push({connector:n,count:1})}})(e,t),t},ni=e=>{const t=[];for(const n of e)for(const e of n.chargingPoints)ei(e.connectors,e.status,t);return t},ri=e=>{const{year:t,month:n,day:r}=(e=>{const t=e.split("-");return{year:Number.parseInt(t[0]),month:Number.parseInt(t[1]),day:Number.parseInt(t[2])}})(e.date);return{dateYYYYMMDD:e.date,year:t,month:n,day:r,hour:e.hour,minute:e.minute,date:new Date(t,n-1,r,e.hour,e.minute)}},oi=e=>1===e.length&&0===e[0].start.hour&&0===e[0].end.hour,ii=e=>{const t=e.timeRanges.map(e=>({start:ri(e.startTime),end:ri(e.endTime)}));return{mode:e.mode,timeRanges:t,alwaysOpenThisPeriod:oi(t)}},si=e=>{const{position:t,entryPoints:n,poi:r,id:i,dist:s,boundingBox:a,chargingPark:c,...u}=e,p=c?.connectors?.map(e=>({...Oo(e,"connectorType"),type:e.connectorType,chargingSpeed:Jo(e.ratedPowerKW)}));return{type:"Feature",geometry:o(Ho(t)),...a&&{bbox:qo(a)},id:i,properties:{...Oo(u,"viewport"),...s&&{distance:s},...n?.length&&{entryPoints:n.map(e=>({...e,position:Ho(e.position)}))},...p?.length&&{chargingPark:{...c,connectors:p.map(e=>({...e,chargingSpeed:Jo(e.ratedPowerKW)})),connectorCounts:ti(p)}},...r&&{poi:{...Oo(r,"categorySet","openingHours"),brands:r?.brands?.map(e=>e.name)??[],categoryIds:r?.categorySet?.map(e=>e.id)??[],...r?.openingHours&&{openingHours:ii(r?.openingHours)}}}}}},ai=e=>{const{geoBias:t,...n}=e;return{...t&&{geoBias:Ho(t)},...n}},ci=e=>{const t=e.results?.[0];return t?{id:t.id,accessType:t.accessType,chargingStations:(n=t.chargingStations,n.map(e=>({...e,chargingPoints:e.chargingPoints.map(e=>({...e,connectors:e.connectors?.map(e=>({...e,chargingSpeed:Jo(e.ratedPowerKW)}))}))}))),chargingPointAvailability:Qo(t.chargingStations),connectorAvailabilities:ni(t.chargingStations),...t.openingHours&&{openingHours:ii(t.openingHours)}}:void 0;var n},ui={requestValidation:{schema:/* @__PURE__ */mt({id:/* @__PURE__ */tt()})},buildRequest:Yo,sendRequest:Ft,parseResponse:ci,parseResponseError:(e,t)=>{const n=e.data?.detailedError?.message??e.message;return new w(n,t,e.status)}},pi={buildEVChargingStationsAvailabilityRequest:Yo,parseEVChargingStationsAvailabilityResponse:ci,evChargingStationsAvailabilityTemplate:ui},li=/* @__PURE__ */vt(
|
|
23
|
+
/* @__PURE__ */mt({position:qt,limit:/* @__PURE__ */rt().check(/* @__PURE__ */He(100)),radiusMeters:/* @__PURE__ */rt(),countries:/* @__PURE__ */ht(/* @__PURE__ */tt()),resultType:/* @__PURE__ */ht(/* @__PURE__ */tt())})).shape);var Gt="object"==typeof global&&global&&global.Object===Object&&global,Yt="object"==typeof self&&self&&self.Object===Object&&self,Jt=Gt||Yt||Function("return this")(),Qt=Jt.Symbol,Xt=Object.prototype,en=Xt.hasOwnProperty,tn=Xt.toString,nn=Qt?Qt.toStringTag:void 0;var rn=Object.prototype.toString;var on=Qt?Qt.toStringTag:void 0;function sn(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":on&&on in Object(e)?function(e){var t=en.call(e,nn),n=e[nn];try{e[nn]=void 0;var r=!0}catch(i){}var o=tn.call(e);return r&&(t?e[nn]=n:delete e[nn]),o}(e):function(e){return rn.call(e)}(e)}function an(e){return null!=e&&"object"==typeof e}function cn(e){return"symbol"==typeof e||an(e)&&"[object Symbol]"==sn(e)}function un(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var pn=Array.isArray,ln=Qt?Qt.prototype:void 0,dn=ln?ln.toString:void 0;function hn(e){if("string"==typeof e)return e;if(pn(e))return un(e,hn)+"";if(cn(e))return dn?dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function gn(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function fn(e){if(!gn(e))return!1;var t=sn(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var mn,yn=Jt["__core-js_shared__"],vn=(mn=/[^.]+$/.exec(yn&&yn.keys&&yn.keys.IE_PROTO||""))?"Symbol(src)_1."+mn:"";var bn=Function.prototype.toString;function _n(e){if(null!=e){try{return bn.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var wn=/^\[object .+?Constructor\]$/,Sn=Function.prototype,Pn=Object.prototype,Tn=Sn.toString,jn=Pn.hasOwnProperty,In=RegExp("^"+Tn.call(jn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zn(e){return!(!gn(e)||(t=e,vn&&vn in t))&&(fn(e)?In:wn).test(_n(e));var t}function xn(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return zn(n)?n:void 0}var Cn=xn(Jt,"WeakMap");var Rn=Date.now;var An,kn,On,En=function(){try{var e=xn(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Mn=En?function(e,t){return En(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:function(e){return e},Ln=(An=Mn,kn=0,On=0,function(){var e=Rn(),t=16-(e-On);if(On=e,t>0){if(++kn>=800)return arguments[0]}else kn=0;return An.apply(void 0,arguments)});var $n=/^(?:0|[1-9]\d*)$/;function Fn(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&$n.test(e))&&e>-1&&e%1==0&&e<t}function Un(e,t,n){"__proto__"==t&&En?En(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Wn(e,t){return e===t||e!=e&&t!=t}var Nn=Object.prototype.hasOwnProperty;function Dn(e,t,n){var r=e[t];Nn.call(e,t)&&Wn(r,n)&&(void 0!==n||t in e)||Un(e,t,n)}var Bn=Math.max;function qn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var Hn=Object.prototype;function Kn(e){return an(e)&&"[object Arguments]"==sn(e)}var Zn=Object.prototype,Vn=Zn.hasOwnProperty,Gn=Zn.propertyIsEnumerable,Yn=Kn(/* @__PURE__ */function(){return arguments}())?Kn:function(e){return an(e)&&Vn.call(e,"callee")&&!Gn.call(e,"callee")};var Jn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qn=Jn&&"object"==typeof module&&module&&!module.nodeType&&module,Xn=Qn&&Qn.exports===Jn?Jt.Buffer:void 0,er=(Xn?Xn.isBuffer:void 0)||function(){return!1},tr={};function nr(e){return function(t){return e(t)}}tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Arguments]"]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object Boolean]"]=tr["[object DataView]"]=tr["[object Date]"]=tr["[object Error]"]=tr["[object Function]"]=tr["[object Map]"]=tr["[object Number]"]=tr["[object Object]"]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object WeakMap]"]=!1;var rr="object"==typeof exports&&exports&&!exports.nodeType&&exports,or=rr&&"object"==typeof module&&module&&!module.nodeType&&module,ir=or&&or.exports===rr&&Gt.process,sr=function(){try{var e=or&&or.require&&or.require("util").types;return e||ir&&ir.binding&&ir.binding("util")}catch(t){}}(),ar=sr&&sr.isTypedArray,cr=ar?nr(ar):function(e){return an(e)&&qn(e.length)&&!!tr[sn(e)]};function ur(e,t){var n=pn(e),r=!n&&Yn(e),o=!n&&!r&&er(e),i=!n&&!r&&!o&&cr(e),s=n||r||o||i,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var u in e)s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Fn(u,c))||a.push(u);return a}var pr=Object.prototype.hasOwnProperty;function lr(e){if(!gn(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t,n,r=(n=(t=e)&&t.constructor,t===("function"==typeof n&&n.prototype||Hn)),o=[];for(var i in e)("constructor"!=i||!r&&pr.call(e,i))&&o.push(i);return o}function dr(e){return null!=(t=e)&&qn(t.length)&&!fn(t)?ur(e):lr(e);var t}var hr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gr=/^\w*$/;var fr=xn(Object,"create");var mr=Object.prototype.hasOwnProperty;var yr=Object.prototype.hasOwnProperty;function vr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function br(e,t){for(var n=e.length;n--;)if(Wn(e[n][0],t))return n;return-1}vr.prototype.clear=function(){this.__data__=fr?fr(null):{},this.size=0},vr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vr.prototype.get=function(e){var t=this.__data__;if(fr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return mr.call(t,e)?t[e]:void 0},vr.prototype.has=function(e){var t=this.__data__;return fr?void 0!==t[e]:yr.call(t,e)},vr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fr&&void 0===t?"__lodash_hash_undefined__":t,this};var _r=Array.prototype.splice;function wr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wr.prototype.clear=function(){this.__data__=[],this.size=0},wr.prototype.delete=function(e){var t=this.__data__,n=br(t,e);return!(n<0)&&(n==t.length-1?t.pop():_r.call(t,n,1),--this.size,!0)},wr.prototype.get=function(e){var t=this.__data__,n=br(t,e);return n<0?void 0:t[n][1]},wr.prototype.has=function(e){return br(this.__data__,e)>-1},wr.prototype.set=function(e,t){var n=this.__data__,r=br(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Sr=xn(Jt,"Map");function Pr(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Tr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Tr.prototype.clear=function(){this.size=0,this.__data__={hash:new vr,map:new(Sr||wr),string:new vr}},Tr.prototype.delete=function(e){var t=Pr(this,e).delete(e);return this.size-=t?1:0,t},Tr.prototype.get=function(e){return Pr(this,e).get(e)},Tr.prototype.has=function(e){return Pr(this,e).has(e)},Tr.prototype.set=function(e,t){var n=Pr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function jr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(jr.Cache||Tr),n}jr.Cache=Tr;var Ir=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zr=/\\(\\)?/g,xr=function(e){var t=jr(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ir,function(e,n,r,o){t.push(r?o.replace(zr,"$1"):n||e)}),t});function Cr(e,t){return pn(e)?e:function(e,t){if(pn(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!cn(e))||gr.test(e)||!hr.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:xr(function(e){return null==e?"":hn(e)}(e))}function Rr(e){if("string"==typeof e||cn(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ar(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var kr=Qt?Qt.isConcatSpreadable:void 0;function Or(e){return pn(e)||Yn(e)||!!(kr&&e&&e[kr])}function Er(e){return(null==e?0:e.length)?function(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=Or),o||(o=[]);++i<s;){var a=e[i];n(a)?Ar(o,a):o[o.length]=a}return o}(e):[]}var Mr=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Lr=Function.prototype,$r=Object.prototype,Fr=Lr.toString,Ur=$r.hasOwnProperty,Wr=Fr.call(Object);function Nr(e){var t=this.__data__=new wr(e);this.size=t.size}Nr.prototype.clear=function(){this.__data__=new wr,this.size=0},Nr.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Nr.prototype.get=function(e){return this.__data__.get(e)},Nr.prototype.has=function(e){return this.__data__.has(e)},Nr.prototype.set=function(e,t){var n=this.__data__;if(n instanceof wr){var r=n.__data__;if(!Sr||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Tr(r)}return n.set(e,t),this.size=n.size,this};var Dr="object"==typeof exports&&exports&&!exports.nodeType&&exports,Br=Dr&&"object"==typeof module&&module&&!module.nodeType&&module,qr=Br&&Br.exports===Dr?Jt.Buffer:void 0;function Hr(){return[]}qr&&qr.allocUnsafe;var Kr=Object.prototype.propertyIsEnumerable,Zr=Object.getOwnPropertySymbols,Vr=Zr?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}(Zr(e),function(t){return Kr.call(e,t)}))}:Hr,Gr=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ar(t,Vr(e)),e=Mr(e);return t}:Hr;function Yr(e){return function(e,t,n){var r=t(e);return pn(e)?r:Ar(r,n(e))}(e,dr,Gr)}var Jr=xn(Jt,"DataView"),Qr=xn(Jt,"Promise"),Xr=xn(Jt,"Set"),eo="[object Map]",to="[object Promise]",no="[object Set]",ro="[object WeakMap]",oo="[object DataView]",io=_n(Jr),so=_n(Sr),ao=_n(Qr),co=_n(Xr),uo=_n(Cn),po=sn;(Jr&&po(new Jr(new ArrayBuffer(1)))!=oo||Sr&&po(new Sr)!=eo||Qr&&po(Qr.resolve())!=to||Xr&&po(new Xr)!=no||Cn&&po(new Cn)!=ro)&&(po=function(e){var t=sn(e),n="[object Object]"==t?e.constructor:void 0,r=n?_n(n):"";if(r)switch(r){case io:return oo;case so:return eo;case ao:return to;case co:return no;case uo:return ro}return t});var lo=Object.prototype.hasOwnProperty;var ho=Jt.Uint8Array;function go(e){var t=new e.constructor(e.byteLength);return new ho(t).set(new ho(e)),t}var fo=/\w*$/;var mo=Qt?Qt.prototype:void 0,yo=mo?mo.valueOf:void 0;function vo(e,t,n){var r,o,i,s,a,c=e.constructor;switch(t){case"[object ArrayBuffer]":return go(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return a=go((s=e).buffer),new s.constructor(a,s.byteOffset,s.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e){var t=go(e.buffer);return new e.constructor(t,e.byteOffset,e.length)}(e);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return(i=new(o=e).constructor(o.source,fo.exec(o))).lastIndex=o.lastIndex,i;case"[object Symbol]":return r=e,yo?Object(yo.call(r)):{}}}var bo=sr&&sr.isMap,_o=bo?nr(bo):function(e){return an(e)&&"[object Map]"==po(e)};var wo=sr&&sr.isSet,So=wo?nr(wo):function(e){return an(e)&&"[object Set]"==po(e)},Po="[object Arguments]",To="[object Function]",jo="[object Object]",Io={};function zo(e,t,n,r,o,i){var s;if(n&&(s=o?n(e,r,o,i):n(e)),void 0!==s)return s;if(!gn(e))return e;var a=pn(e);if(a)s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&lo.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=po(e),u=c==To||"[object GeneratorFunction]"==c;if(er(e))return e.slice();if(c==jo||c==Po||u&&!o)s={};else{if(!Io[c])return o?e:{};s=vo(e,c)}}i||(i=new Nr);var p=i.get(e);if(p)return p;i.set(e,s),So(e)?e.forEach(function(r){s.add(zo(r,t,n,r,e,i))}):_o(e)&&e.forEach(function(r,o){s.set(o,zo(r,t,n,o,e,i))});var l=a?void 0:Yr(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(l||e,function(r,o){l&&(r=e[o=r]),Dn(s,o,zo(r,t,n,o,e,i))}),s}function xo(e,t){return t.length<2?e:function(e,t){for(var n=0,r=(t=Cr(t,e)).length;null!=e&&n<r;)e=e[Rr(t[n++])];return n&&n==r?e:void 0}(e,function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}(t,0,-1))}function Co(e){return null==e}Io[Po]=Io["[object Array]"]=Io["[object ArrayBuffer]"]=Io["[object DataView]"]=Io["[object Boolean]"]=Io["[object Date]"]=Io["[object Float32Array]"]=Io["[object Float64Array]"]=Io["[object Int8Array]"]=Io["[object Int16Array]"]=Io["[object Int32Array]"]=Io["[object Map]"]=Io["[object Number]"]=Io[jo]=Io["[object RegExp]"]=Io["[object Set]"]=Io["[object String]"]=Io["[object Symbol]"]=Io["[object Uint8Array]"]=Io["[object Uint8ClampedArray]"]=Io["[object Uint16Array]"]=Io["[object Uint32Array]"]=!0,Io["[object Error]"]=Io[To]=Io["[object WeakMap]"]=!1;var Ro=Object.prototype.hasOwnProperty;function Ao(e,t){var n=-1,r=(t=Cr(t,e)).length;if(!r)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<r;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!Ro.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<r&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=xo(e,t);return null==s||delete s[Rr(function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}(t))]}function ko(e){return function(e){if(!an(e)||"[object Object]"!=sn(e))return!1;var t=Mr(e);if(null===t)return!0;var n=Ur.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fr.call(n)==Wr}(e)?void 0:e}var Oo=function(e){return Ln(function(e,t,n){return t=Bn(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=Bn(r.length-t,0),s=Array(i);++o<i;)s[o]=r[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=r[o];return a[t]=n(s),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,void 0,Er),e+"")}(function(e,t){var n={};if(null==e)return n;var r=!1;t=un(t,function(t){return t=Cr(t,e),r||(r=t.length>1),t}),function(e,t,n){var r=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=void 0;void 0===a&&(a=e[s]),r?Un(n,s,a):Dn(n,s,a)}}(e,Yr(e),n),r&&(n=zo(n,7,ko));for(var o=t.length;o--;)Ao(n,t[o]);return n});const Eo=(e,t)=>{e.append("apiVersion",String(t.apiVersion)),e.append("key",t.apiKey),t.language&&e.append("language",t.language)},Mo=(e,t,n)=>{for(const r of n||[])e.append(t,r)},Lo=(e,t,n)=>{Array.isArray(n)&&n.length>0&&e.append(t,n.join(","))},$o=(e,t,n)=>{!Co(n)&&e.append(t,String(n))},Fo=(e,t)=>{const r=n(t);r&&(e.append("lat",String(r[1])),e.append("lon",String(r[0])))},Uo="/maps/orbis/places",Wo=(e,t)=>{const n=e.searchParams;Eo(n,t),$o(n,"limit",t.limit),Fo(n,t.position),Lo(n,"fuelSet",t.fuelTypes),Lo(n,"idxSet",t.indexes),Lo(n,"brandSet",t.poiBrands),t.poiCategories&&Lo(n,"categorySet",t.poiCategories.map(e=>"number"!=typeof e?r[e]:e)),Lo(n,"connectorSet",t.connectors),Lo(n,"mapcodes",t.mapcodes),Lo(n,"extendedPostalCodesFor",t.extendedPostalCodesFor),$o(n,"minPowerKW",t.minPowerKW),$o(n,"maxPowerKW",t.maxPowerKW),$o(n,"view",t.view),$o(n,"openingHours",t.openingHours),$o(n,"timeZone",t.timeZone),$o(n,"relatedPois",t.relatedPois),Lo(n,"entityTypeSet",t.geographyTypes)},No=e=>{const t=new URL(`${n=e,n.customServiceBaseURL||`${n.commonBaseURL}${Uo}/autocomplete/${n.query}.json`}`);var n;const r=t.searchParams;return e.language=e.language??"en-GB",Eo(r,e),$o(r,"limit",e.limit),Fo(r,e.position),Lo(r,"countrySet",e.countries),$o(r,"radius",e.radiusMeters),Lo(r,"resultSet",e.resultType),t},Do=e=>{const t=e.split(",");return[Number(t[1]),Number(t[0])]},Bo=e=>`${e[1]},${e[0]}`,qo=e=>{let t,n;return void 0!==e.topLeftPoint?(t=[e.topLeftPoint.lon,e.btmRightPoint.lat],n=[e.btmRightPoint.lon,e.topLeftPoint.lat]):(t=Do(e.southWest),n=Do(e.northEast)),[t[0],t[1],n[0],n[1]]},Ho=e=>[e.lon,e.lat],Ko=e=>{const{position:t,...n}=e.context.geoBias||{};return{...e,context:{...e.context,geoBias:{...t&&{position:Ho(t)},radiusMeters:n.radius}}}},Zo={requestValidation:{schema:Vt},buildRequest:No,sendRequest:Ft,parseResponse:Ko},Vo=async(e,t)=>Mt(e,{...Zo,...t},"Autocomplete"),Go={autocompleteSearch:Vo,buildAutocompleteSearchRequest:No,parseAutocompleteSearchResponse:Ko,autocompleteSearchTemplate:Zo},Yo=e=>{const t=new URL((e=>e.customServiceBaseURL??`${e.commonBaseURL}${Uo}/ev/id`)(e)),n=t.searchParams;return Eo(n,e),n.append("id",e.id),t},Jo=e=>e<12?"slow":e<50?"regular":e<150?"fast":"ultra-fast",Qo=e=>{const t={count:0,statusCounts:{}};for(const n of e)for(const e of n.chargingPoints)t.count++,t.statusCounts[e.status]=(t.statusCounts[e.status]||0)+1;return t},Xo=(e,t)=>e.type===t.type&&e.ratedPowerKW===t.ratedPowerKW,ei=(e,t,n)=>{if(e)for(const r of e){const e=n.find(e=>Xo(r,e.connector));if(e){if(e.count++,t){const n=e.statusCounts;e.statusCounts[t]=(n[t]||0)+1}}else n.push({connector:r,count:1,statusCounts:t?{[t]:1}:{}})}},ti=e=>{const t=[];return((e,t)=>{if(e)for(const n of e){const e=t.find(e=>Xo(n,e.connector));e?e.count++:t.push({connector:n,count:1})}})(e,t),t},ni=e=>{const t=[];for(const n of e)for(const e of n.chargingPoints)ei(e.connectors,e.status,t);return t},ri=e=>{const{year:t,month:n,day:r}=(e=>{const t=e.split("-");return{year:Number.parseInt(t[0]),month:Number.parseInt(t[1]),day:Number.parseInt(t[2])}})(e.date);return{dateYYYYMMDD:e.date,year:t,month:n,day:r,hour:e.hour,minute:e.minute,date:new Date(t,n-1,r,e.hour,e.minute)}},oi=e=>1===e.length&&0===e[0].start.hour&&0===e[0].end.hour,ii=e=>{const t=e.timeRanges.map(e=>({start:ri(e.startTime),end:ri(e.endTime)}));return{mode:e.mode,timeRanges:t,alwaysOpenThisPeriod:oi(t)}},si=e=>{const{position:t,entryPoints:n,poi:r,id:i,dist:s,boundingBox:a,chargingPark:c,...u}=e,p=c?.connectors?.map(e=>({...Oo(e,"connectorType"),type:e.connectorType,chargingSpeed:Jo(e.ratedPowerKW)}));return{type:"Feature",geometry:o(Ho(t)),...a&&{bbox:qo(a)},id:i,properties:{...Oo(u,"viewport"),...s&&{distance:s},...n?.length&&{entryPoints:n.map(e=>({...e,position:Ho(e.position)}))},...p?.length&&{chargingPark:{...c,connectors:ti(p)}},...r&&{poi:{...Oo(r,"categorySet","openingHours"),brands:r?.brands?.map(e=>e.name)??[],categoryIds:r?.categorySet?.map(e=>e.id)??[],...r?.openingHours&&{openingHours:ii(r?.openingHours)}}}}}},ai=e=>{const{geoBias:t,...n}=e;return{...t&&{geoBias:Ho(t)},...n}},ci=e=>{const t=e.results?.[0];return t?{id:t.id,accessType:t.accessType,chargingStations:(n=t.chargingStations,n.map(e=>({...e,chargingPoints:e.chargingPoints.map(e=>({...e,connectors:e.connectors?.map(e=>({...e,chargingSpeed:Jo(e.ratedPowerKW)}))}))}))),chargingPointAvailability:Qo(t.chargingStations),connectorAvailabilities:ni(t.chargingStations),...t.openingHours&&{openingHours:ii(t.openingHours)}}:void 0;var n},ui={requestValidation:{schema:/* @__PURE__ */mt({id:/* @__PURE__ */tt()})},buildRequest:Yo,sendRequest:Ft,parseResponse:ci,parseResponseError:(e,t)=>{const n=e.data?.detailedError?.message??e.message;return new w(n,t,e.status)}},pi={buildEVChargingStationsAvailabilityRequest:Yo,parseEVChargingStationsAvailabilityResponse:ci,evChargingStationsAvailabilityTemplate:ui},li=/* @__PURE__ */vt(
|
|
24
24
|
/* @__PURE__ */mt({typeahead:/* @__PURE__ */it(),offset:/* @__PURE__ */rt().check(/* @__PURE__ */He(1900)),radiusMeters:/* @__PURE__ */rt(),boundingBox:Zt,countries:/* @__PURE__ */ht(/* @__PURE__ */tt())})),di=/* @__PURE__ */yt(/* @__PURE__ */mt({query:/* @__PURE__ */tt()}),/* @__PURE__ */vt(
|
|
25
|
-
/* @__PURE__ */mt({position:qt,limit:/* @__PURE__ */rt().check(/* @__PURE__ */He(100)),extendedPostalCodesFor:/* @__PURE__ */ht(/* @__PURE__ */tt()),mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */mt({position:qt,limit:/* @__PURE__ */rt().check(/* @__PURE__ */He(100)),extendedPostalCodesFor:/* @__PURE__ */ht(/* @__PURE__ */tt()),mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */It(i),geographyTypes:/* @__PURE__ */ht(/* @__PURE__ */tt())})).shape),hi=/* @__PURE__ */yt(di,li.shape),gi=e=>e?Array.isArray(e)?e.join(","):"string"==typeof e?e:String(e):"",fi=(e,t)=>{const n=e.length;if(n<=t)return e;const r=[];let o;const i=Math.ceil(n/t);for(o=0;o<n;o+=i)r.push(e[o]);return o>=n-i&&(r.length<t?r.push(e[n-1]):r[r.length-1]=e[n-1]),r},mi=e=>{const t=new URL(`${(e=>e.customServiceBaseURL||`${e.commonBaseURL}${Uo}/geocode`)(e)}/${e.query}.json`),n=t.searchParams;Eo(n,e),e.typeahead&&n.append("typeahead",String(e.typeahead)),!Co(e.limit)&&n.append("limit",String(e.limit)),!Co(e.offset)&&n.append("ofs",String(e.offset)),Fo(n,e.position),e.countries&&n.append("countrySet",gi(e.countries)),!Co(e.radiusMeters)&&n.append("radius",String(e.radiusMeters));const r=e.boundingBox&&s(e.boundingBox);return r&&(n.append("topLeft",gi([r[3],r[0]])),n.append("btmRight",gi([r[1],r[2]]))),e.extendedPostalCodesFor&&n.append("extendedPostalCodesFor",gi(e.extendedPostalCodesFor)),e.mapcodes&&n.append("mapcodes",gi(e.mapcodes)),e.view&&n.append("view",e.view),e.geographyTypes&&n.append("entityTypeSet",gi(e.geographyTypes)),t},yi=e=>{const{position:t,boundingBox:n,dist:r,entryPoints:i,addressRanges:s,entityType:a,id:c,...u}=e;return{type:"Feature",geometry:o(Ho(t)),...n&&{bbox:qo(n)},id:c,properties:{...Oo(u,"viewport"),...r&&{distance:r},...a&&{geographyType:a.split(",")},...i&&{entryPoints:i.map(e=>({...e,position:Ho(e.position)}))},...s&&{addressRanges:{...s,from:Ho(s.from),to:Ho(s.to)}}}}},vi=e=>{const t=e.results.map(yi),n=a(s(t));return{type:"FeatureCollection",features:t,...n&&{bbox:n}}},bi={requestValidation:{schema:hi},buildRequest:mi,sendRequest:Ft,parseResponse:vi},_i={buildGeocodingRequest:mi,parseGeocodingResponse:vi,geocodingTemplate:bi},wi=/* @__PURE__ */yt(/* @__PURE__ */mt({geometries:/* @__PURE__ */_t([Bt,
|
|
26
26
|
/* @__PURE__ */ht(/* @__PURE__ */_t([/* @__PURE__ */tt(),Dt])).check(/* @__PURE__ */Ye(1),/* @__PURE__ */Ge(20))])}),/* @__PURE__ */vt(
|
|
27
|
-
/* @__PURE__ */mt({zoom:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(22))})).shape),Si=e=>e.map(e=>e.properties.dataSources?.geometry?.id).filter(e=>e),Pi=e=>{const t=new URL((e=>e.customServiceBaseURL||`${e.commonBaseURL}${Uo}/additionalData.json`)(e)),n=t.searchParams;return n.append("apiVersion",String(e.apiVersion)),n.append("key",e.apiKey),((e,t)=>{let n;n=Array.isArray(t)?"string"==typeof t[0]?t:Si(t):Si(t.features),e.append("geometries",gi(n))})(n,e.geometries),$o(n,"geometriesZoom",e.zoom),t},Ti=e=>{const t=e.additionalData.flatMap(e=>e.geometryData?.features.map(e=>({...e,id:e.id??c(),bbox:s(e.geometry)}))).filter(e=>e);return{type:"FeatureCollection",bbox:s(t),features:t}},
|
|
27
|
+
/* @__PURE__ */mt({zoom:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(22))})).shape),Si=e=>e.map(e=>e.properties.dataSources?.geometry?.id).filter(e=>e),Pi=e=>{const t=new URL((e=>e.customServiceBaseURL||`${e.commonBaseURL}${Uo}/additionalData.json`)(e)),n=t.searchParams;return n.append("apiVersion",String(e.apiVersion)),n.append("key",e.apiKey),((e,t)=>{let n;n=Array.isArray(t)?"string"==typeof t[0]?t:Si(t):Si(t.features),e.append("geometries",gi(n))})(n,e.geometries),$o(n,"geometriesZoom",e.zoom),t},Ti=e=>{const t=e.additionalData.flatMap(e=>e.geometryData?.features.map(e=>({...e,id:e.id??c(),bbox:s(e.geometry)}))).filter(e=>e);return{type:"FeatureCollection",bbox:s(t),features:t}},ji={requestValidation:{schema:wi},buildRequest:Pi,sendRequest:Ft,parseResponse:Ti},Ii={buildGeometryDataRequest:Pi,parseGeometryDataResponse:Ti,geometryDataTemplate:ji},zi=/* @__PURE__ */mt(r),xi=/* @__PURE__ */yt(di,/* @__PURE__ */vt(
|
|
28
28
|
/* @__PURE__ */mt({indexes:/* @__PURE__ */ht(/* @__PURE__ */tt()),poiCategories:/* @__PURE__ */ht(/* @__PURE__ */_t([/* @__PURE__ */rt(),/* @__PURE__ */gt(zi)])),poiBrands:/* @__PURE__ */ht(/* @__PURE__ */tt()),connectors:/* @__PURE__ */ht(/* @__PURE__ */tt()),fuelTypes:/* @__PURE__ */ht(/* @__PURE__ */tt()),openingHours:/* @__PURE__ */tt(),timeZone:/* @__PURE__ */tt(),relatedPois:/* @__PURE__ */tt(),minPowerKW:/* @__PURE__ */rt(),maxPowerKW:/* @__PURE__ */rt(),minFuzzyLevel:/* @__PURE__ */rt(),mixFuzzyLevel:/* @__PURE__ */rt()})).shape),Ci=/* @__PURE__ */yt(xi,/* @__PURE__ */mt({geometries:/* @__PURE__ */ht(/* @__PURE__ */_t([Bt,Nt]))}).shape),Ri=e=>{switch(e.type){case"Circle":return[{type:"CIRCLE",radius:e.radius,position:Bo(e.coordinates)}];case"Polygon":return[{type:"POLYGON",vertices:fi(e.coordinates[0],50).map(e=>Bo(e))}];case"MultiPolygon":return e.coordinates.length>50?(e=>{let t=/* @__PURE__ */new Map;return e.coordinates.forEach(e=>{const n=u(e[0]);if(n){const r=Math.abs((n[2]-n[0])*(n[3]-n[1]));t.set(e,r)}}),t=new Map([...t.entries()].sort((e,t)=>t[1]-e[1]).splice(0,50)),[...t.keys()]})(e).flatMap(e=>Ri({type:"Polygon",coordinates:e})):e.coordinates.flatMap(e=>Ri({type:"Polygon",coordinates:e}));case"FeatureCollection":return e.features.flatMap(e=>Ri(e.geometry));default:throw new Error(`Type ${e.type} is not supported`)}},Ai=e=>{const t=new URL(`${n=e,n.customServiceBaseURL??`${n.commonBaseURL}${Uo}/geometrySearch/${n.query}.json`}`);var n;return Wo(t,e),{url:t,data:{geometryList:e.geometries.flatMap(Ri)}}},ki=e=>{const t=e.results.map(si),n=a(s(t));return{type:"FeatureCollection",properties:{...ai(e.summary)},features:t,...n&&{bbox:n}}},Oi={requestValidation:{schema:Ci},buildRequest:Ai,sendRequest:Ut,parseResponse:ki},Ei=async(e,t)=>Mt(e,{...Oi,...t},"GeometrySearch"),Mi={geometrySearch:Ei,buildGeometrySearchRequest:Ai,parseGeometrySearchResponse:ki,geometrySearchTemplate:Oi},Li=/* @__PURE__ */yt(/* @__PURE__ */mt({entityId:/* @__PURE__ */tt()}),/* @__PURE__ */vt(
|
|
29
|
-
/* @__PURE__ */mt({mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */mt({acceleration:Vi,deceleration:Vi,uphill:Vi,downhill:Vi}))},Ji=/* @__PURE__ */ht(Gi).check(/* @__PURE__ */Ye(1),/* @__PURE__ */Ge(25)),Qi=/* @__PURE__ */mt({...Yi,speedsToConsumptionsLiters:Ji,auxiliaryPowerInLitersPerHour:Zi,fuelEnergyDensityInMJoulesPerLiter:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1)))}),Xi=/* @__PURE__ */mt({...Yi,speedsToConsumptionsKWH:Ji,auxiliaryPowerInkW:Zi,consumptionInKWHPerKMAltitudeGain:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */He(500))),recuperationInKWHPerKMAltitudeLoss:Zi}),es=/* @__PURE__ */mt({currentType:/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */mt({mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */It(i),openingHours:/* @__PURE__ */tt(),timeZone:/* @__PURE__ */tt(),relatedPois:/* @__PURE__ */tt()})).shape),$i=e=>{const t=new URL(`${(e=>e.customServiceBaseURL||`${e.commonBaseURL}${Uo}/place.json`)(e)}`),n=t.searchParams;return Eo(n,e),$o(n,"entityId",e.entityId),Lo(n,"mapcodes",e.mapcodes),$o(n,"view",e.view),$o(n,"openingHours",e.openingHours),$o(n,"timeZone",e.timeZone),$o(n,"relatedPois",e.relatedPois),t},Fi=e=>e.results?.length?si(e.results[0]):void 0,Ui={requestValidation:{schema:Li},buildRequest:$i,sendRequest:Ft,parseResponse:Fi},Wi={buildPlaceByIdRequest:$i,parsePlaceByIdResponse:Fi,placeByIdTemplate:Ui},Ni=["fast","short","efficient","thrilling"],Di=["USHazmatClass1","USHazmatClass2","USHazmatClass3","USHazmatClass4","USHazmatClass5","USHazmatClass6","USHazmatClass7","USHazmatClass8","USHazmatClass9","otherHazmatExplosive","otherHazmatGeneral","otherHazmatHarmfulToWater"],Bi=/* @__PURE__ */rt().check(/* @__PURE__ */Ve()),qi=/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0)),Hi=/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(100)),Ki=/* @__PURE__ */Rt(Bi),Zi=/* @__PURE__ */Rt(qi),Vi=/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(1))),Gi=/* @__PURE__ */mt({speedKMH:/* @__PURE__ */rt(),consumptionUnitsPer100KM:/* @__PURE__ */rt()}),Yi={efficiency:/* @__PURE__ */Rt(
|
|
30
|
+
/* @__PURE__ */mt({acceleration:Vi,deceleration:Vi,uphill:Vi,downhill:Vi}))},Ji=/* @__PURE__ */ht(Gi).check(/* @__PURE__ */Ye(1),/* @__PURE__ */Ge(25)),Qi=/* @__PURE__ */mt({...Yi,speedsToConsumptionsLiters:Ji,auxiliaryPowerInLitersPerHour:Zi,fuelEnergyDensityInMJoulesPerLiter:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1)))}),Xi=/* @__PURE__ */mt({...Yi,speedsToConsumptionsKWH:Ji,auxiliaryPowerInkW:Zi,consumptionInKWHPerKMAltitudeGain:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */He(500))),recuperationInKWHPerKMAltitudeLoss:Zi}),es=/* @__PURE__ */mt({currentType:/* @__PURE__ */It(l),plugTypes:/* @__PURE__ */ht(/* @__PURE__ */It(p)).check(/* @__PURE__ */Ye(1)),efficiency:Vi,baseLoadInkW:Zi,maxPowerInkW:Zi,maxVoltageInV:Zi,maxCurrentInA:Zi,voltageRange:/* @__PURE__ */Rt(
|
|
31
31
|
/* @__PURE__ */mt({minVoltageInV:Zi,maxVoltageInV:/* @__PURE__ */Rt(/* @__PURE__ */rt())}))}),ts=/* @__PURE__ */mt({maxChargeKWH:Bi,batteryCurve:/* @__PURE__ */Rt(/* @__PURE__ */ht(/* @__PURE__ */mt({stateOfChargeInkWh:qi,maxPowerInkW:Bi})).check(/* @__PURE__ */Ge(20))),chargingConnectors:/* @__PURE__ */Rt(/* @__PURE__ */ht(es).check(/* @__PURE__ */Ye(1))),chargingTimeOffsetInSec:Zi}),ns=/* @__PURE__ */mt({consumption:Qi}),rs=/* @__PURE__ */mt({consumption:Xi,charging:/* @__PURE__ */Rt(ts)}),os=/* @__PURE__ */Rt(
|
|
32
32
|
/* @__PURE__ */mt({lengthMeters:Ki,widthMeters:Ki,heightMeters:Ki,weightKG:Ki,axleWeightKG:Ki})),is=/* @__PURE__ */Rt(/* @__PURE__ */_t([/* @__PURE__ */mt({variantId:/* @__PURE__ */tt()}),/* @__PURE__ */mt({dimensions:os,engine:/* @__PURE__ */Rt(/* @__PURE__ */_t([ns,rs]))})])),ss=/* @__PURE__ */mt({heading:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(360)))}),as=/* @__PURE__ */yt(ss,
|
|
33
33
|
/* @__PURE__ */mt({currentFuelInLiters:qi}).shape),cs=/* @__PURE__ */_t([/* @__PURE__ */yt(ss,
|
|
34
34
|
/* @__PURE__ */mt({currentChargePCT:Hi}).shape),/* @__PURE__ */yt(ss,
|
|
35
35
|
/* @__PURE__ */mt({currentChargeInkWh:qi}).shape)]),us=/* @__PURE__ */mt({chargingPreferences:/* @__PURE__ */Rt(/* @__PURE__ */_t([/* @__PURE__ */mt({minChargeAtDestinationPCT:Hi,minChargeAtChargingStopsPCT:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(50))}),/* @__PURE__ */mt({minChargeAtDestinationInkWh:qi,minChargeAtChargingStopsInkWh:qi})]))}),ps={model:is,restrictions:/* @__PURE__ */Rt(
|
|
36
|
-
/* @__PURE__ */mt({loadTypes:/* @__PURE__ */Rt(/* @__PURE__ */ht(/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */mt({loadTypes:/* @__PURE__ */Rt(/* @__PURE__ */ht(/* @__PURE__ */It(Di))),maxSpeedKMH:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(250))),adrCode:/* @__PURE__ */Rt(/* @__PURE__ */It(["B","C","D","E"])),commercial:/* @__PURE__ */Rt(/* @__PURE__ */it())}))},ls=/* @__PURE__ */mt({...ps,engineType:/* @__PURE__ */at(),state:/* @__PURE__ */Rt(ss),preferences:/* @__PURE__ */Rt(/* @__PURE__ */mt({}))}),ds=/* @__PURE__ */_t([
|
|
37
37
|
/* @__PURE__ */St("engineType",[/* @__PURE__ */mt({...ps,engineType:/* @__PURE__ */xt("combustion"),state:/* @__PURE__ */Rt(as),preferences:/* @__PURE__ */Rt(/* @__PURE__ */mt({}))}),/* @__PURE__ */mt({...ps,engineType:/* @__PURE__ */xt("electric"),state:/* @__PURE__ */Rt(cs),preferences:/* @__PURE__ */Rt(us)})]),ls]),hs=/* @__PURE__ */vt(
|
|
38
38
|
/* @__PURE__ */mt({costModel:/* @__PURE__ */vt(
|
|
39
|
-
/* @__PURE__ */mt({avoid:/* @__PURE__ */ht(/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */mt({hilliness:/* @__PURE__ */Rt(/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */yt(/* @__PURE__ */mt({origin:qt,budget:/* @__PURE__ */mt({type:/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */mt({allowFreeformNewline:/* @__PURE__ */it(),geographyType:/* @__PURE__ */ht(/* @__PURE__ */tt()),heading:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(-360),/* @__PURE__ */He(360)),mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),number:/* @__PURE__ */tt(),radiusMeters:/* @__PURE__ */rt(),returnMatchType:/* @__PURE__ */it(),returnRoadUse:/* @__PURE__ */it(),returnSpeedLimit:/* @__PURE__ */it(),roadUses:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */mt({computeAdditionalTravelTimeFor:/* @__PURE__ */jt(["none","all"]),vehicleHeading:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(359.5)),maxAlternatives:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(5)),sectionTypes:/* @__PURE__ */ht(/* @__PURE__ */jt(f))})).shape).shape),xs=e=>e.vehicle?.preferences?.chargingPreferences,Cs=e=>Array.isArray(e)?e:e.geometry.coordinates,Rs=(e,t,n)=>((e,t)=>e.map(e=>{const n=Bo(h(e,{useEntryPoint:t})),r=(e=>e.properties||null)(e)?.radiusMeters;return r?`circle(${n},${r})`:n}).join(":"))(t.includes("path")?((e,t,n)=>{let r;const o=e[0];r="path"===t[0]?Cs(o)[0]:h(o,{useEntryPoint:n});const i=e[e.length-1];let s;if("path"===t[t.length-1]){const e=Cs(i);s=e[e.length-1]}else s=h(i,{useEntryPoint:n});return[r,s]})(e,t,n):e,n),As=e=>({latitude:e[1],longitude:e[0]}),ks=(e,t,n)=>{const r=[],o=[];return e.forEach((i,s)=>{"path"===t[s]?((e,t,n,r,o)=>{const i=r.length;for(const s of Cs(e))r.push(As(s));Array.isArray(e)||(e.properties.sections.leg.forEach((e,n)=>{(t>0||n>0)&&o.push({supportingPointIndex:i+e.startPointIndex,waypointSourceType:"USER_DEFINED"})}),t<n.length-1&&o.push({supportingPointIndex:i+e.geometry.coordinates.length-1,waypointSourceType:"USER_DEFINED"}))})(i,s,e,r,o):((e,t,n,r,o,i)=>{r.push(As(h(e,{useEntryPoint:i}))),t>0&&t<n.length-1&&o.push({supportingPointIndex:r.length-1,waypointSourceType:"USER_DEFINED"})})(i,s,e,r,o,n)}),{supportingPoints:r,...o.length&&{pointWaypoints:o}}},Os=e=>{const t=e.locations.map(g),n=e.useEntryPoints??"main-when-available",r=new URL(`${(e=>e.customServiceBaseURL||`${e.commonBaseURL}/maps/orbis/routing/${xs(e)?"calculateLongDistanceEVRoute":"calculateRoute"}`)(e)}/${Rs(e.locations,t,n)}/json`),o=r.searchParams;Eo(o,e),"language"in e||o.append("language","en-GB"),bs(o,e),$o(o,"computeTravelTimeFor",e.computeAdditionalTravelTimeFor),((e,t)=>{if(t?.guidance){const n=t.guidance;e.append("instructionsType",n.type),e.append("guidanceVersion",String(n.version??2)),e.append("instructionPhonetics",n.phonetics??"IPA"),e.append("instructionRoadShieldReferences",n.roadShieldReferences??"all"),e.append("language",t.language??"en-US")}})(o,e),!Co(e.maxAlternatives)&&o.append("maxAlternatives",String(e.maxAlternatives)),((e,t,n)=>{const r=(t??(n?f:m)).map(e=>"vehicleRestricted"===e?"travelMode":e);Mo(e,"sectionType",r)})(o,e.sectionTypes,!!e.guidance?.type);for(const s of e.extendedRouteRepresentations??["distance","travelTime"])o.append("extendedRouteRepresentation",s);const i=((e,t,n)=>{const r=t.includes("path"),o=!!xs(e);if(!r&&!o)return null;const i=e.vehicle?.model,s=i?.engine?.charging;return{...r&&ks(e.locations,t,n),...o&&s&&{chargingParameters:Oo(s,"maxChargeKWH")}}})(e,t,n);return i?{method:"POST",url:r,data:i}:{method:"GET",url:r}},Es=e=>{switch(e){case"Direct_Current":return"DC";case"Alternating_Current_1_Phase":return"AC1";case"Alternating_Current_3_Phase":return"AC3";default:return}},Ms=(e,t)=>{const n=e.chargingConnectionInfo,r=e.chargingParkLocation,o=[r.coordinate.longitude,r.coordinate.latitude],i=[r.street,r.houseNumber].filter(Boolean),s=i.length>0?i.join(", "):"";return{type:"Feature",id:e.chargingParkId,geometry:{type:"Point",coordinates:o},properties:{...Oo(e,["chargingConnectionInfo","chargingParkLocation"]),type:"POI",address:{freeformAddress:s,...r.street&&{streetName:r.street},...r.houseNumber&&{streetNumber:r.houseNumber},...r.city&&{municipality:r.city},...r.region&&{countrySubdivision:r.region},...r.postalCode&&{postalCode:r.postalCode},...r.country&&{country:r.country}},...n&&{chargingConnectionInfo:{plugType:n.chargingPlugType,currentInA:n.chargingCurrentInA,voltageInV:n.chargingVoltageInV,chargingPowerInkW:n.chargingPowerInkW,currentType:Es(n.chargingCurrentType),chargingSpeed:Jo(n.chargingPowerInkW)}},...t&&{targetChargeInPCT:100*e.targetChargeInkWh/t},...e.chargingParkPowerInkW&&{chargingParkSpeed:Jo(e.chargingParkPowerInkW)}}}},Ls=(e,t)=>{const n=t?.vehicle?.model?.engine?.charging?.maxChargeKWH;return{lengthInMeters:e.lengthInMeters,historicTrafficTravelTimeInSeconds:e.historicTrafficTravelTimeInSeconds,liveTrafficIncidentsTravelTimeInSeconds:e.liveTrafficIncidentsTravelTimeInSeconds,noTrafficTravelTimeInSeconds:e.noTrafficTravelTimeInSeconds,trafficDelayInSeconds:e.trafficDelayInSeconds,trafficLengthInMeters:e.trafficLengthInMeters,travelTimeInSeconds:e.travelTimeInSeconds,departureTime:new Date(e.departureTime),arrivalTime:new Date(e.arrivalTime),deviationDistanceInMeters:e.deviationDistance,fuelConsumptionInLiters:e.fuelConsumptionInLiters,...e.deviationPoint&&{deviationPoint:[e.deviationPoint.longitude,e.deviationPoint.latitude]},totalChargingTimeInSeconds:e.totalChargingTimeInSeconds,batteryConsumptionInkWh:e.batteryConsumptionInkWh,...n&&e.batteryConsumptionInkWh&&{batteryConsumptionInPCT:100*e.batteryConsumptionInkWh/n},remainingChargeAtArrivalInkWh:e.remainingChargeAtArrivalInkWh,...n&&e.remainingChargeAtArrivalInkWh&&{remainingChargeAtArrivalInPCT:100*e.remainingChargeAtArrivalInkWh/n},...e.chargingInformationAtEndOfLeg&&{chargingInformationAtEndOfLeg:Ms(e.chargingInformationAtEndOfLeg,n)}}},$s=(e,t)=>e.reduce((e,n,r)=>{const o=0===r?0:e[r-1]?.endPointIndex;let i;return Co(o)||(i=0===o?n.points?.length>0?n.points.length-1:0:o+n.points?.length),e.push({...!Co(o)&&{startPointIndex:o},...i&&{endPointIndex:i},summary:Ls(n.summary,t),id:c()}),e},[]),Fs=e=>({id:c(),startPointIndex:e.startPointIndex,endPointIndex:e.endPointIndex}),Us=e=>({...Fs(e),index:e.importantRoadStretchIndex,streetName:e.streetName?.text,roadNumbers:e.roadNumbers?.map(e=>e.text)}),Ws=e=>({...Fs(e),countryCodeISO3:e.countryCode}),Ns=e=>"other"===e.travelMode?Fs(e):null,Ds=e=>{if(e.tec?.causes?.length)return e.tec.causes.map(e=>(e=>{switch(e){case 1:return"jam";case 2:return"accident";case 3:return"roadworks";case 4:return"narrow-lanes";case 5:return"road-closed";case 9:return"danger";case 11:return"animals-on-road";case 13:return"broken-down-vehicle";case 16:return"lane-closed";case 17:return"wind";case 18:return"fog";case 19:return"rain";case 22:return"frost";case 23:return"flooding";default:return"other"}})(e.mainCauseCode));switch(e.simpleCategory){case"JAM":return["jam"];case"ROAD_WORK":return["roadworks"];case"ROAD_CLOSURE":return["road-closed"];default:return["other"]}},Bs=e=>({...Fs(e),delayInSeconds:e.delayInSeconds,effectiveSpeedInKmh:e.effectiveSpeedInKmh,categories:Ds(e),magnitudeOfDelay:y[e.magnitudeOfDelay],tec:e.tec}),qs=e=>({...Fs(e),lanes:e.lanes,laneSeparators:e.laneSeparators,properties:e.properties}),Hs=e=>({...Fs(e),maxSpeedLimitInKmh:e.maxSpeedLimitInKmh}),Ks=e=>({...Fs(e),roadShieldReferences:e.roadShieldReferences}),Zs=(e,t)=>(t[e]||(t[e]=[]),t[e]),Vs=e=>{switch(e.sectionType){case"CAR_TRAIN":return{sectionType:"carTrain",mappingFunction:Fs};case"COUNTRY":return{sectionType:"country",mappingFunction:Ws};case"FERRY":return{sectionType:"ferry",mappingFunction:Fs};case"MOTORWAY":return{sectionType:"motorway",mappingFunction:Fs};case"PEDESTRIAN":return{sectionType:"pedestrian",mappingFunction:Fs};case"TOLL_VIGNETTE":return{sectionType:"tollVignette",mappingFunction:Ws};case"TOLL":return{sectionType:"toll",mappingFunction:Fs};case"TRAFFIC":return{sectionType:"traffic",mappingFunction:Bs};case"TRAVEL_MODE":return{sectionType:"vehicleRestricted",mappingFunction:Ns};case"TUNNEL":return{sectionType:"tunnel",mappingFunction:Fs};case"UNPAVED":return{sectionType:"unpaved",mappingFunction:Fs};case"URBAN":return{sectionType:"urban",mappingFunction:Fs};case"CARPOOL":return{sectionType:"carpool",mappingFunction:Fs};case"LOW_EMISSION_ZONE":return{sectionType:"lowEmissionZone",mappingFunction:Fs};case"LANES":return{sectionType:"lanes",mappingFunction:qs};case"SPEED_LIMIT":return{sectionType:"speedLimit",mappingFunction:Hs};case"ROAD_SHIELDS":return{sectionType:"roadShields",mappingFunction:Ks};case"IMPORTANT_ROAD_STRETCH":return{sectionType:"importantRoadStretch",mappingFunction:Us}}},Gs=(e,t)=>{const n={leg:$s(e.legs,t)};return((e,t)=>{if(Array.isArray(e))for(const n of e){const e=Vs(n),r=e?.mappingFunction(n);r&&Zs(e.sectionType,t).push(r)}})(e.sections,n),n},Ys=1e-4,Js=(e,t)=>Math.abs(e[0]-t[0])<Ys&&Math.abs(e[1]-t[1])<Ys,Qs=(e,t)=>{const n=[];let r=0;for(const o of e.instructions){const e=[o.maneuverPoint.longitude,o.maneuverPoint.latitude];for(let n=r;n<t.length;n++){if(Js(t[n],e)){r=n;break}if(n===t.length-1)break}n.push({...o,maneuverPoint:e,pathPointIndex:r,routePath:o.routePath.map(e=>({...e,point:[e.point.longitude,e.point.latitude]}))})}return{instructions:n}},Xs=(e,t)=>{const n=e.routes.map((e,n)=>((e,t,n)=>{const r={type:"LineString",coordinates:e.legs.flatMap(e=>e.points?.map(e=>[e.longitude,e.latitude]))};return{type:"Feature",geometry:r,id:c(),bbox:s(r),properties:{index:t,summary:Ls(e.summary,n),sections:Gs(e,n),...e.guidance&&{guidance:Qs(e.guidance,r.coordinates)},...e.progress&&{progress:e.progress}}}})(e,n,t)),r=s(n);return{type:"FeatureCollection",...r&&{bbox:r},features:n}},ea={requestValidation:{schema:zs,refinements:[{check:e=>!!e.locations.map(g).includes("path")||e.locations.length>=2,message:"When passing waypoints only: at least 2 must be defined. If passing also paths, at least one path must be defined"}]},buildRequest:Os,sendRequest:async(e,t)=>{const n=e.method;if("GET"===n)return Ft(e.url,t);if("POST"===n)return Ut(e,t);throw new Error(`Unsupported HTTP method received: ${n}`)},parseResponse:Xs,parseResponseError:(e,t)=>{const{data:n,message:r,status:o}=e;return new w(n?.error?.description??n?.detailedError?.message??r,t,o)},getAPIVersion:()=>2},ta={reverseGeocode:js,geocode:_i,geometryData:ji,geometrySearch:Mi,calculateRoute:{buildCalculateRouteRequest:Os,parseCalculateRouteResponse:Xs,calculateRouteTemplate:ea},reachableRange:Ss,evChargingStationsAvailability:pi,placeByID:Wi,autocompleteSearch:Go},na=async(e,t)=>Mt(e,{...ui,...t},"EVChargingStationsAvailability"),ra=async e=>{const t=e.properties.dataSources?.chargingAvailability?.id;if(!t)return e;try{const n=await na({id:t}),r=e.properties.poi;return n?{...e,properties:{...e.properties,...r&&{poi:{...r,openingHours:n.openingHours}},chargingPark:{...e.properties.chargingPark,availability:n}}}:e}catch(n){return console.error(n),e}},oa=async(e,t={includeIfAvailabilityUnknown:!0})=>{const n=[];for(const r of e.features){const e=await ra(r);(e.properties.chargingPark?.availability||t.includeIfAvailabilityUnknown)&&n.push(e)}return{...e,features:n,bbox:s(n)}},ia=async(e,t)=>Mt(e,{...bi,...t},"Geocode"),sa=async e=>(await ia({query:e,limit:1})).features[0];async function aa(e,t){const n=await Mt(e,{...Ii,...t},"GeometryData");return Array.isArray(e.geometries)||"FeatureCollection"!==e.geometries.type?n:((e,t)=>{const n=e.features.reduce((e,t)=>{const n=t.properties.dataSources?.geometry?.id;return n&&(e[n]={...t.properties,placeCoordinates:t.geometry.coordinates}),e},{}),r=t.features.map(e=>e.id&&n[e.id]?{...e,properties:n[e.id]}:e);return{type:"FeatureCollection",bbox:t.bbox,features:r}})(e.geometries,n)}const ca=async(e,t)=>Mt(e,{...Ui,...t},"PlaceById"),ua=async(e,t)=>Mt(e,{...Is,...t},"ReverseGeocode"),pa=async(e,t)=>Mt(e,{...ea,...t},"Routing"),la=/* @__PURE__ */yt(xi,
|
|
39
|
+
/* @__PURE__ */mt({avoid:/* @__PURE__ */ht(/* @__PURE__ */It(d)),traffic:/* @__PURE__ */Rt(/* @__PURE__ */It(["live","historical"])),routeType:/* @__PURE__ */Rt(/* @__PURE__ */It(Ni)),thrillingParams:/* @__PURE__ */Rt(
|
|
40
|
+
/* @__PURE__ */mt({hilliness:/* @__PURE__ */Rt(/* @__PURE__ */It(["low","normal","high"])),windingness:/* @__PURE__ */Rt(/* @__PURE__ */It(["low","normal","high"]))}))})),travelMode:/* @__PURE__ */tt(),vehicle:ds,when:/* @__PURE__ */mt({option:/* @__PURE__ */It(["departAt","arriveBy"]),date:/* @__PURE__ */lt()})})),gs=/* @__PURE__ */yt(hs,
|
|
41
|
+
/* @__PURE__ */yt(/* @__PURE__ */mt({origin:qt,budget:/* @__PURE__ */mt({type:/* @__PURE__ */It(["timeMinutes","remainingChargeCPT","spentChargePCT","spentFuelLiters","distanceKM"]),value:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0))})}),/* @__PURE__ */mt({maxFerryLengthMeters:/* @__PURE__ */Rt(/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0)))}).shape).shape),fs=e=>e.map(e=>`${e.speedKMH},${e.consumptionUnitsPer100KM}`).join(":"),ms=(e,t,n)=>{((e,t)=>{t&&(!Co(t.acceleration)&&e.append("accelerationEfficiency",String(t.acceleration)),!Co(t.deceleration)&&e.append("decelerationEfficiency",String(t.deceleration)),!Co(t.uphill)&&e.append("uphillEfficiency",String(t.uphill)),!Co(t.downhill)&&e.append("downhillEfficiency",String(t.downhill)))})(e,n.consumption.efficiency),"electric"===t?(((e,t)=>{t.speedsToConsumptionsKWH&&e.append("constantSpeedConsumptionInkWhPerHundredkm",fs(t.speedsToConsumptionsKWH)),!Co(t.auxiliaryPowerInkW)&&e.append("auxiliaryPowerInkW",String(t.auxiliaryPowerInkW)),!Co(t.consumptionInKWHPerKMAltitudeGain)&&e.append("consumptionInkWhPerkmAltitudeGain",String(t.consumptionInKWHPerKMAltitudeGain)),!Co(t.recuperationInKWHPerKMAltitudeLoss)&&e.append("recuperationInkWhPerkmAltitudeLoss",String(t.recuperationInKWHPerKMAltitudeLoss))})(e,n.consumption),((e,t)=>{const n=t.charging;n?.maxChargeKWH&&e.append("maxChargeInkWh",String(n.maxChargeKWH))})(e,n)):((e,t)=>{const n=t.consumption;n.speedsToConsumptionsLiters&&e.append("constantSpeedConsumptionInLitersPerHundredkm",fs(n.speedsToConsumptionsLiters)),!Co(n.auxiliaryPowerInLitersPerHour)&&e.append("auxiliaryPowerInLitersPerHour",String(n.auxiliaryPowerInLitersPerHour)),!Co(n.fuelEnergyDensityInMJoulesPerLiter)&&e.append("fuelEnergyDensityInMJoulesPerLiter",String(n.fuelEnergyDensityInMJoulesPerLiter))})(e,n)},ys=(e,t)=>{t.model&&("variantId"in t.model?e.append("vehicleModelId",t.model.variantId):(((e,t)=>{t&&(t.lengthMeters&&e.append("vehicleLength",String(t.lengthMeters)),t.heightMeters&&e.append("vehicleHeight",String(t.heightMeters)),t.widthMeters&&e.append("vehicleWidth",String(t.widthMeters)),t.weightKG&&e.append("vehicleWeight",String(t.weightKG)),t.axleWeightKG&&e.append("vehicleAxleWeight",String(t.axleWeightKG)))})(e,t.model.dimensions),t.model.engine&&ms(e,"engineType"in t?t.engineType:void 0,t.model.engine)))},vs=(e,t)=>{t&&("electric"===t.engineType&&e.append("vehicleEngineType","electric"),ys(e,t),((e,t)=>{if(t.state&&(t.state.heading&&e.append("vehicleHeading",String(t.state.heading)),"engineType"in t))if("combustion"===t.engineType){const n=t.state;n.currentFuelInLiters&&e.append("currentFuelInLiters",String(n.currentFuelInLiters))}else if("electric"===t.engineType){const n=t.state,r=n,o=n;if(r.currentChargeInkWh)e.append("currentChargeInkWh",String(r.currentChargeInkWh));else if(o.currentChargePCT&&t.model&&"engine"in t.model&&t.model.engine){const n=t.model.engine,r=n.charging?.maxChargeKWH;r&&e.append("currentChargeInkWh",String(r*o.currentChargePCT/100))}}})(e,t),((e,t)=>{if(t.preferences&&"engineType"in t&&"electric"===t.engineType){const n=t.preferences;if(n.chargingPreferences){const r=n.chargingPreferences,o=r,i=r;if(o.minChargeAtChargingStopsInkWh||o.minChargeAtDestinationInkWh)e.append("minChargeAtDestinationInkWh",String(o.minChargeAtDestinationInkWh)),e.append("minChargeAtChargingStopsInkWh",String(o.minChargeAtChargingStopsInkWh));else if((i.minChargeAtChargingStopsPCT||i.minChargeAtDestinationPCT)&&t.model&&"engine"in t.model&&t.model.engine){const n=t.model.engine,r=n.charging?.maxChargeKWH;r&&(e.append("minChargeAtDestinationInkWh",String(r*i.minChargeAtDestinationPCT/100)),e.append("minChargeAtChargingStopsInkWh",String(r*i.minChargeAtChargingStopsPCT/100)))}}}})(e,t),((e,t)=>{const n=t.restrictions;n&&(Mo(e,"vehicleLoadType",n.loadTypes),n.adrCode&&e.append("vehicleAdrTunnelRestrictionCode",n.adrCode),n.commercial&&e.append("vehicleCommercial",String(n.commercial)),n.maxSpeedKMH&&e.append("vehicleMaxSpeed",String(n.maxSpeedKMH)))})(e,t))},bs=(e,t)=>{const n=t.costModel;Mo(e,"avoid",n?.avoid),$o(e,"traffic",n?.traffic),((e,t)=>{if(t?.date){const n=t.date.toISOString();"departAt"===t.option?e.append("departAt",n):"arriveBy"===t.option&&e.append("arriveAt",n)}})(e,t.when),$o(e,"routeType",n?.routeType),$o(e,"travelMode",t.travelMode),vs(e,t.vehicle)},_s=e=>{const t=new URL((e=>e.customServiceBaseURL||`${e.commonBaseURL}/routing/1/calculateReachableRange/${Bo(h(e.origin))}/json`)(e)),n=t.searchParams;return Eo(n,e),bs(n,e),$o(n,"maxFerryLengthInMeters",e.maxFerryLengthMeters),t},ws=(e,t)=>{const n={type:"Polygon",coordinates:[e.reachableRange.boundary.map(e=>[e.longitude,e.latitude])]};return{type:"Feature",geometry:n,bbox:s(n),properties:t}},Ss={buildReachableRangeRequest:_s,parseReachableRangeResponse:ws,reachableRangeTemplate:{requestValidation:{schema:gs},buildRequest:_s,sendRequest:Ft,parseResponse:ws}},Ps=e=>{const t=h(e.position),n=new URL(`${(e=>e.customServiceBaseURL||`${e.commonBaseURL}${Uo}/reverseGeocode`)(e)}/${t[1]},${t[0]}.json`),r=n.searchParams;return Eo(r,e),e.allowFreeformNewline&&r.append("allowFreeformNewline",String(e.allowFreeformNewline)),e.geographyType&&r.append("entityType",gi(e.geographyType)),!Co(e.heading)&&r.append("heading",String(e.heading)),e.mapcodes&&r.append("mapcodes",gi(e.mapcodes)),e.number&&r.append("number",e.number),!Co(e.radiusMeters)&&r.append("radius",String(e.radiusMeters)),e.returnSpeedLimit&&r.append("returnSpeedLimit",String(e.returnSpeedLimit)),e.returnRoadUse&&r.append("returnRoadUse",String(e.returnRoadUse)),e.roadUses&&r.append("roadUse",JSON.stringify(e.roadUses)),n},Ts=(e,t)=>{const n=e.addresses[0],{boundingBox:r,sideOfStreet:i,offsetPosition:s,...a}=n?.address||{};return{type:"Feature",geometry:o(h(t.position)),...r&&{bbox:qo(r)},id:c(),...n&&{properties:{type:n?.entityType?"Geography":a.streetNumber?"Point Address":"Street",address:a,...n.dataSources&&{dataSources:n.dataSources},...n.mapcodes&&{mapcodes:n.mapcodes},...i&&{sideOfStreet:i},...s&&{offsetPosition:Do(s)},originalPosition:Do(n.position)}}}},js={requestValidation:{schema:/* @__PURE__ */yt(/* @__PURE__ */mt({position:qt}),/* @__PURE__ */vt(
|
|
42
|
+
/* @__PURE__ */mt({allowFreeformNewline:/* @__PURE__ */it(),geographyType:/* @__PURE__ */ht(/* @__PURE__ */tt()),heading:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(-360),/* @__PURE__ */He(360)),mapcodes:/* @__PURE__ */ht(/* @__PURE__ */tt()),number:/* @__PURE__ */tt(),radiusMeters:/* @__PURE__ */rt(),returnMatchType:/* @__PURE__ */it(),returnRoadUse:/* @__PURE__ */it(),returnSpeedLimit:/* @__PURE__ */it(),roadUses:/* @__PURE__ */ht(/* @__PURE__ */tt()),view:/* @__PURE__ */It(i)})).shape)},buildRequest:Ps,sendRequest:Ft,parseResponse:Ts},Is={buildRevGeoRequest:Ps,parseRevGeoResponse:Ts,reverseGeocodingTemplate:js},zs=/* @__PURE__ */yt(hs,/* @__PURE__ */yt(/* @__PURE__ */mt({locations:/* @__PURE__ */ht(/* @__PURE__ */_t([/* @__PURE__ */_t([qt,Nt]),/* @__PURE__ */_t([Wt,Dt])])).check(/* @__PURE__ */Ye(1))}),/* @__PURE__ */vt(
|
|
43
|
+
/* @__PURE__ */mt({computeAdditionalTravelTimeFor:/* @__PURE__ */It(["none","all"]),vehicleHeading:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(359.5)),maxAlternatives:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(0),/* @__PURE__ */He(5)),sectionTypes:/* @__PURE__ */ht(/* @__PURE__ */It(f))})).shape).shape),xs=e=>e.vehicle?.preferences?.chargingPreferences,Cs=e=>Array.isArray(e)?e:e.geometry.coordinates,Rs=(e,t,n)=>((e,t)=>e.map(e=>{const n=Bo(h(e,{useEntryPoint:t})),r=(e=>e.properties||null)(e)?.radiusMeters;return r?`circle(${n},${r})`:n}).join(":"))(t.includes("path")?((e,t,n)=>{let r;const o=e[0];r="path"===t[0]?Cs(o)[0]:h(o,{useEntryPoint:n});const i=e[e.length-1];let s;if("path"===t[t.length-1]){const e=Cs(i);s=e[e.length-1]}else s=h(i,{useEntryPoint:n});return[r,s]})(e,t,n):e,n),As=e=>({latitude:e[1],longitude:e[0]}),ks=(e,t,n)=>{const r=[],o=[];return e.forEach((i,s)=>{"path"===t[s]?((e,t,n,r,o)=>{const i=r.length;for(const s of Cs(e))r.push(As(s));Array.isArray(e)||(e.properties.sections.leg.forEach((e,n)=>{(t>0||n>0)&&o.push({supportingPointIndex:i+e.startPointIndex,waypointSourceType:"USER_DEFINED"})}),t<n.length-1&&o.push({supportingPointIndex:i+e.geometry.coordinates.length-1,waypointSourceType:"USER_DEFINED"}))})(i,s,e,r,o):((e,t,n,r,o,i)=>{r.push(As(h(e,{useEntryPoint:i}))),t>0&&t<n.length-1&&o.push({supportingPointIndex:r.length-1,waypointSourceType:"USER_DEFINED"})})(i,s,e,r,o,n)}),{supportingPoints:r,...o.length&&{pointWaypoints:o}}},Os=e=>{const t=e.locations.map(g),n=e.useEntryPoints??"main-when-available",r=new URL(`${(e=>e.customServiceBaseURL||`${e.commonBaseURL}/maps/orbis/routing/${xs(e)?"calculateLongDistanceEVRoute":"calculateRoute"}`)(e)}/${Rs(e.locations,t,n)}/json`),o=r.searchParams;Eo(o,e),"language"in e||o.append("language","en-GB"),bs(o,e),$o(o,"computeTravelTimeFor",e.computeAdditionalTravelTimeFor),((e,t)=>{if(t?.guidance){const n=t.guidance;e.append("instructionsType",n.type),e.append("guidanceVersion",String(n.version??2)),e.append("instructionPhonetics",n.phonetics??"IPA"),e.append("instructionRoadShieldReferences",n.roadShieldReferences??"all"),e.append("language",t.language??"en-US")}})(o,e),!Co(e.maxAlternatives)&&o.append("maxAlternatives",String(e.maxAlternatives)),((e,t,n)=>{const r=(t??(n?f:m)).map(e=>"vehicleRestricted"===e?"travelMode":e);Mo(e,"sectionType",r)})(o,e.sectionTypes,!!e.guidance?.type);for(const s of e.extendedRouteRepresentations??["distance","travelTime"])o.append("extendedRouteRepresentation",s);const i=((e,t,n)=>{const r=t.includes("path"),o=!!xs(e);if(!r&&!o)return null;const i=e.vehicle?.model,s=i?.engine?.charging;return{...r&&ks(e.locations,t,n),...o&&s&&{chargingParameters:Oo(s,"maxChargeKWH")}}})(e,t,n);return i?{method:"POST",url:r,data:i}:{method:"GET",url:r}},Es=e=>{switch(e){case"Direct_Current":return"DC";case"Alternating_Current_1_Phase":return"AC1";case"Alternating_Current_3_Phase":return"AC3";default:return}},Ms=(e,t)=>{const n=e.chargingConnectionInfo,r=e.chargingParkLocation,o=[r.coordinate.longitude,r.coordinate.latitude],i=[r.street,r.houseNumber].filter(Boolean),s=i.length>0?i.join(", "):"";return{type:"Feature",id:e.chargingParkId,geometry:{type:"Point",coordinates:o},properties:{...Oo(e,["chargingConnectionInfo","chargingParkLocation"]),type:"POI",address:{freeformAddress:s,...r.street&&{streetName:r.street},...r.houseNumber&&{streetNumber:r.houseNumber},...r.city&&{municipality:r.city},...r.region&&{countrySubdivision:r.region},...r.postalCode&&{postalCode:r.postalCode},...r.country&&{country:r.country}},...n&&{chargingConnectionInfo:{plugType:n.chargingPlugType,currentInA:n.chargingCurrentInA,voltageInV:n.chargingVoltageInV,chargingPowerInkW:n.chargingPowerInkW,currentType:Es(n.chargingCurrentType),chargingSpeed:Jo(n.chargingPowerInkW)}},...t&&{targetChargeInPCT:100*e.targetChargeInkWh/t},...e.chargingParkPowerInkW&&{chargingParkSpeed:Jo(e.chargingParkPowerInkW)}}}},Ls=(e,t)=>{const n=t?.vehicle?.model?.engine?.charging?.maxChargeKWH;return{lengthInMeters:e.lengthInMeters,historicTrafficTravelTimeInSeconds:e.historicTrafficTravelTimeInSeconds,liveTrafficIncidentsTravelTimeInSeconds:e.liveTrafficIncidentsTravelTimeInSeconds,noTrafficTravelTimeInSeconds:e.noTrafficTravelTimeInSeconds,trafficDelayInSeconds:e.trafficDelayInSeconds,trafficLengthInMeters:e.trafficLengthInMeters,travelTimeInSeconds:e.travelTimeInSeconds,departureTime:new Date(e.departureTime),arrivalTime:new Date(e.arrivalTime),deviationDistanceInMeters:e.deviationDistance,fuelConsumptionInLiters:e.fuelConsumptionInLiters,...e.deviationPoint&&{deviationPoint:[e.deviationPoint.longitude,e.deviationPoint.latitude]},totalChargingTimeInSeconds:e.totalChargingTimeInSeconds,batteryConsumptionInkWh:e.batteryConsumptionInkWh,...n&&e.batteryConsumptionInkWh&&{batteryConsumptionInPCT:100*e.batteryConsumptionInkWh/n},remainingChargeAtArrivalInkWh:e.remainingChargeAtArrivalInkWh,...n&&e.remainingChargeAtArrivalInkWh&&{remainingChargeAtArrivalInPCT:100*e.remainingChargeAtArrivalInkWh/n},...e.chargingInformationAtEndOfLeg&&{chargingInformationAtEndOfLeg:Ms(e.chargingInformationAtEndOfLeg,n)}}},$s=(e,t)=>e.reduce((e,n,r)=>{const o=0===r?0:e[r-1]?.endPointIndex;let i;return Co(o)||(i=0===o?n.points?.length>0?n.points.length-1:0:o+n.points?.length),e.push({...!Co(o)&&{startPointIndex:o},...i&&{endPointIndex:i},summary:Ls(n.summary,t),id:c()}),e},[]),Fs=e=>({id:c(),startPointIndex:e.startPointIndex,endPointIndex:e.endPointIndex}),Us=e=>({...Fs(e),index:e.importantRoadStretchIndex,streetName:e.streetName?.text,roadNumbers:e.roadNumbers?.map(e=>e.text)}),Ws=e=>({...Fs(e),countryCodeISO3:e.countryCode}),Ns=e=>"other"===e.travelMode?Fs(e):null,Ds=e=>{if(e.tec?.causes?.length)return e.tec.causes.map(e=>(e=>{switch(e){case 1:return"jam";case 2:return"accident";case 3:return"roadworks";case 4:return"narrow-lanes";case 5:return"road-closed";case 9:return"danger";case 11:return"animals-on-road";case 13:return"broken-down-vehicle";case 16:return"lane-closed";case 17:return"wind";case 18:return"fog";case 19:return"rain";case 22:return"frost";case 23:return"flooding";default:return"other"}})(e.mainCauseCode));switch(e.simpleCategory){case"JAM":return["jam"];case"ROAD_WORK":return["roadworks"];case"ROAD_CLOSURE":return["road-closed"];default:return["other"]}},Bs=e=>({...Fs(e),delayInSeconds:e.delayInSeconds,effectiveSpeedInKmh:e.effectiveSpeedInKmh,categories:Ds(e),magnitudeOfDelay:y[e.magnitudeOfDelay],tec:e.tec}),qs=e=>({...Fs(e),lanes:e.lanes,laneSeparators:e.laneSeparators,properties:e.properties}),Hs=e=>({...Fs(e),maxSpeedLimitInKmh:e.maxSpeedLimitInKmh}),Ks=e=>({...Fs(e),roadShieldReferences:e.roadShieldReferences}),Zs=(e,t)=>(t[e]||(t[e]=[]),t[e]),Vs=e=>{switch(e.sectionType){case"CAR_TRAIN":return{sectionType:"carTrain",mappingFunction:Fs};case"COUNTRY":return{sectionType:"country",mappingFunction:Ws};case"FERRY":return{sectionType:"ferry",mappingFunction:Fs};case"MOTORWAY":return{sectionType:"motorway",mappingFunction:Fs};case"PEDESTRIAN":return{sectionType:"pedestrian",mappingFunction:Fs};case"TOLL_VIGNETTE":return{sectionType:"tollVignette",mappingFunction:Ws};case"TOLL":return{sectionType:"toll",mappingFunction:Fs};case"TRAFFIC":return{sectionType:"traffic",mappingFunction:Bs};case"TRAVEL_MODE":return{sectionType:"vehicleRestricted",mappingFunction:Ns};case"TUNNEL":return{sectionType:"tunnel",mappingFunction:Fs};case"UNPAVED":return{sectionType:"unpaved",mappingFunction:Fs};case"URBAN":return{sectionType:"urban",mappingFunction:Fs};case"CARPOOL":return{sectionType:"carpool",mappingFunction:Fs};case"LOW_EMISSION_ZONE":return{sectionType:"lowEmissionZone",mappingFunction:Fs};case"LANES":return{sectionType:"lanes",mappingFunction:qs};case"SPEED_LIMIT":return{sectionType:"speedLimit",mappingFunction:Hs};case"ROAD_SHIELDS":return{sectionType:"roadShields",mappingFunction:Ks};case"IMPORTANT_ROAD_STRETCH":return{sectionType:"importantRoadStretch",mappingFunction:Us}}},Gs=(e,t)=>{const n={leg:$s(e.legs,t)};return((e,t)=>{if(Array.isArray(e))for(const n of e){const e=Vs(n),r=e?.mappingFunction(n);r&&Zs(e.sectionType,t).push(r)}})(e.sections,n),n},Ys=1e-4,Js=(e,t)=>Math.abs(e[0]-t[0])<Ys&&Math.abs(e[1]-t[1])<Ys,Qs=(e,t)=>{const n=[];let r=0;for(const o of e.instructions){const e=[o.maneuverPoint.longitude,o.maneuverPoint.latitude];for(let n=r;n<t.length;n++){if(Js(t[n],e)){r=n;break}if(n===t.length-1)break}n.push({...o,maneuverPoint:e,pathPointIndex:r,routePath:o.routePath.map(e=>({...e,point:[e.point.longitude,e.point.latitude]}))})}return{instructions:n}},Xs=(e,t)=>{const n=e.routes.map((e,n)=>((e,t,n)=>{const r={type:"LineString",coordinates:e.legs.flatMap(e=>e.points?.map(e=>[e.longitude,e.latitude]))};return{type:"Feature",geometry:r,id:c(),bbox:s(r),properties:{index:t,summary:Ls(e.summary,n),sections:Gs(e,n),...e.guidance&&{guidance:Qs(e.guidance,r.coordinates)},...e.progress&&{progress:e.progress}}}})(e,n,t)),r=s(n);return{type:"FeatureCollection",...r&&{bbox:r},features:n}},ea={requestValidation:{schema:zs,refinements:[{check:e=>!!e.locations.map(g).includes("path")||e.locations.length>=2,message:"When passing waypoints only: at least 2 must be defined. If passing also paths, at least one path must be defined"}]},buildRequest:Os,sendRequest:async(e,t)=>{const n=e.method;if("GET"===n)return Ft(e.url,t);if("POST"===n)return Ut(e,t);throw new Error(`Unsupported HTTP method received: ${n}`)},parseResponse:Xs,parseResponseError:(e,t)=>{const{data:n,message:r,status:o}=e;return new w(n?.error?.description??n?.detailedError?.message??r,t,o)},getAPIVersion:()=>2},ta={reverseGeocode:Is,geocode:_i,geometryData:Ii,geometrySearch:Mi,calculateRoute:{buildCalculateRouteRequest:Os,parseCalculateRouteResponse:Xs,calculateRouteTemplate:ea},reachableRange:Ss,evChargingStationsAvailability:pi,placeByID:Wi,autocompleteSearch:Go},na=async(e,t)=>Mt(e,{...ui,...t},"EVChargingStationsAvailability"),ra=async e=>{const t=e.properties.dataSources?.chargingAvailability?.id;if(t)try{const n=await na({id:t}),r=e.properties.poi;return n?{...e,properties:{...e.properties,...r&&{poi:{...r,openingHours:n.openingHours}},chargingPark:{...e.properties.chargingPark,availability:n}}}:void 0}catch(n){return void console.error(n)}};async function oa(e,t){const n=[];for(const r of e.features){const e=await ra(r);e?n.push(e):t?.excludeIfAvailabilityUnknown||n.push(r)}return{...e,features:n,bbox:s(n)}}const ia=e=>Boolean(e&&"availability"in e&&e.availability),sa=async(e,t)=>Mt(e,{...bi,...t},"Geocode"),aa=async e=>(await sa({query:e,limit:1})).features[0];async function ca(e,t){const n=await Mt(e,{...ji,...t},"GeometryData");return Array.isArray(e.geometries)||"FeatureCollection"!==e.geometries.type?n:((e,t)=>{const n=e.features.reduce((e,t)=>{const n=t.properties.dataSources?.geometry?.id;return n&&(e[n]={...t.properties,placeCoordinates:t.geometry.coordinates}),e},{}),r=t.features.map(e=>e.id&&n[e.id]?{...e,properties:n[e.id]}:e);return{type:"FeatureCollection",bbox:t.bbox,features:r}})(e.geometries,n)}const ua=async(e,t)=>Mt(e,{...Ui,...t},"PlaceById"),pa=async(e,t)=>Mt(e,{...js,...t},"ReverseGeocode"),la=async(e,t)=>Mt(e,{...ea,...t},"Routing"),da=/* @__PURE__ */yt(xi,
|
|
44
44
|
/* @__PURE__ */yt(li,/* @__PURE__ */vt(
|
|
45
|
-
/* @__PURE__ */mt({minFuzzyLevel:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1),/* @__PURE__ */He(4)),maxFuzzyLevel:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1),/* @__PURE__ */He(4))})).shape).shape),
|
|
45
|
+
/* @__PURE__ */mt({minFuzzyLevel:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1),/* @__PURE__ */He(4)),maxFuzzyLevel:/* @__PURE__ */rt().check(/* @__PURE__ */Ze(1),/* @__PURE__ */He(4))})).shape).shape),ha=e=>{let t;switch(e.type){case"COORDINATE":t={...e,details:{position:Ho(e.details)}};break;case"NEARBY":t={...e,details:{position:Ho({lon:e.details.lon,lat:e.details.lat}),text:e.details.text,query:e.details.query}};break;case"BOOKMARK":case"W3W":t=e}return t},ga={requestValidation:{schema:da},buildRequest:e=>{const t=new URL(`${n=e,n.customServiceBaseURL??`${n.commonBaseURL}${Uo}/search/${n.query}.json`}`);var n;Wo(t,e);const r=t.searchParams;$o(r,"typeahead",e.typeahead),$o(r,"ofs",e.offset),Lo(r,"countrySet",e.countries),$o(r,"radius",e.radiusMeters);const o=e.boundingBox&&s(e.boundingBox);return o&&(r.append("topLeft",gi([o[3],o[0]])),r.append("btmRight",gi([o[1],o[2]]))),$o(r,"minFuzzyLevel",e.minFuzzyLevel),$o(r,"maxFuzzyLevel",e.maxFuzzyLevel),t},sendRequest:Ft,parseResponse:e=>{const t=e.results.map(si),n=a(s(t));return{type:"FeatureCollection",properties:{...ai(e.summary),queryIntent:e.summary.queryIntent.map(ha)},features:t,...n&&{bbox:n}}}},fa=async(e,t)=>"geometries"in e?Ei(e,t):(async(e,t)=>Mt(e,{...ga,...t},"FuzzySearch"))(e,t),ma=async e=>(await fa({query:e,limit:1})).features[0];export{_ as APIErrorCode,b as SDKError,w as SDKServiceError,Vo as autocompleteSearch,P as buildResponseError,T as buildValidationError,la as calculateRoute,ta as customizeService,na as evChargingStationsAvailability,sa as geocode,aa as geocodeOne,ca as geometryData,ra as getPlaceWithEVAvailability,oa as getPlacesWithEVAvailability,ia as hasChargingAvailability,S as parseDefaultResponseError,ua as placeById,pa as reverseGeocode,fa as search,ma as searchOne};
|
|
46
46
|
//# sourceMappingURL=services.es.js.map
|