@tomtom-org/maps-sdk 0.41.1 → 0.41.5
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 +43 -0
- package/README.md +6 -6
- package/core/dist/THIRD_PARTY.txt +1 -1
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/package.json +0 -3
- package/map/dist/THIRD_PARTY.txt +5 -5
- package/map/dist/index.d.ts +156 -10
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +2 -4
- package/package.json +7 -5
- package/services/dist/THIRD_PARTY.txt +2 -2
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
- package/services/package.json +1 -4
package/map/package.json
CHANGED
|
@@ -24,10 +24,8 @@
|
|
|
24
24
|
"@types/geojson": "catalog:",
|
|
25
25
|
"@types/lodash-es": "catalog:",
|
|
26
26
|
"@vitest/coverage-v8": "catalog:",
|
|
27
|
+
"jsdom": "catalog:",
|
|
27
28
|
"rimraf": "catalog:",
|
|
28
|
-
"rollup-plugin-analyzer": "catalog:",
|
|
29
|
-
"rollup-plugin-license": "catalog:",
|
|
30
|
-
"rollup-plugin-visualizer": "catalog:",
|
|
31
29
|
"shared-configs": "workspace:*",
|
|
32
30
|
"ts-node": "catalog:",
|
|
33
31
|
"typescript": "catalog:",
|
|
@@ -42,7 +40,7 @@
|
|
|
42
40
|
"maplibre-gl": "catalog:"
|
|
43
41
|
},
|
|
44
42
|
"dependencies": {
|
|
45
|
-
"@turf/bearing": "^7.3.
|
|
43
|
+
"@turf/bearing": "^7.3.3",
|
|
46
44
|
"core": "workspace:*",
|
|
47
45
|
"lodash-es": "catalog:"
|
|
48
46
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tomtom-org/maps-sdk",
|
|
3
3
|
"author": "TomTom International B.V.",
|
|
4
4
|
"license": "See in LICENSE.txt",
|
|
5
|
-
"version": "0.41.
|
|
5
|
+
"version": "0.41.5",
|
|
6
6
|
"description": "TomTom Maps for JavaScript",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"tomtom",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"nodejs"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@biomejs/biome": "^2.3.
|
|
21
|
+
"@biomejs/biome": "^2.3.13",
|
|
22
22
|
"@size-limit/file": "^11.2.0",
|
|
23
23
|
"@size-limit/preset-app": "^11.2.0",
|
|
24
24
|
"size-limit": "^11.2.0",
|
|
@@ -69,10 +69,11 @@
|
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "pnpm build:sdk",
|
|
71
71
|
"build:api-reference": "typedoc",
|
|
72
|
-
"build:examples": "pnpm
|
|
72
|
+
"build:examples": "pnpm -F @tomtom-org/maps-sdk-examples build",
|
|
73
73
|
"build:sdk": "pnpm -F core build && pnpm -F services build && pnpm -F map build",
|
|
74
|
+
"build:plugins": "pnpm -F './plugins/*' build",
|
|
74
75
|
"clean": "pnpm -r --no-bail clean:dist && pnpm -r --no-bail clean:cache",
|
|
75
|
-
"e2e-test:examples": "pnpm -F examples test",
|
|
76
|
+
"e2e-test:examples": "pnpm -F @tomtom-org/maps-sdk-examples test:e2e",
|
|
76
77
|
"e2e-test:sdk": "pnpm -F map-integration-tests test",
|
|
77
78
|
"format": "biome format .",
|
|
78
79
|
"format:fix": "biome format . --write",
|
|
@@ -83,7 +84,8 @@
|
|
|
83
84
|
"test:sdk": "pnpm -F core test && pnpm -F services test && pnpm -F map test",
|
|
84
85
|
"test:sdk:coverage": "pnpm -F core test:coverage && pnpm -F services test:coverage && pnpm -F map test:coverage",
|
|
85
86
|
"test:examples": "pnpm -F @tomtom-org/maps-sdk-examples test",
|
|
86
|
-
"type-check:examples": "pnpm
|
|
87
|
+
"type-check:examples": "pnpm -F @tomtom-org/maps-sdk-examples type-check",
|
|
88
|
+
"type-check:plugins": "pnpm -F plugins type-check",
|
|
87
89
|
"type-check:sdk": "pnpm -F core type-check && pnpm -F services type-check && pnpm -F map type-check && pnpm -F map-integration-tests type-check"
|
|
88
90
|
}
|
|
89
91
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Name: zod
|
|
2
|
-
Version: 4.3.
|
|
2
|
+
Version: 4.3.6
|
|
3
3
|
License: MIT
|
|
4
4
|
Private: false
|
|
5
5
|
Description: TypeScript-first schema declaration and validation library with static type inference
|
|
@@ -34,7 +34,7 @@ SOFTWARE.
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
36
|
Name: lodash-es
|
|
37
|
-
Version: 4.17.
|
|
37
|
+
Version: 4.17.23
|
|
38
38
|
License: MIT
|
|
39
39
|
Private: false
|
|
40
40
|
Description: Lodash exported as ES modules.
|
|
@@ -1,4 +1,4 @@
|
|
|
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__ */
|
|
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:6},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
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
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
4
|
return We(nt,e)}const ot=/* @__PURE__ */j("ZodMiniBoolean",(e,t)=>{ye.init(e,t),Xe.init(e,t)});function it(e){/* @__PURE__ */
|