@nuclearplayer/plugin-sdk 1.2.0 → 2.1.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/dist/index.js CHANGED
@@ -1,302 +1,337 @@
1
- import { useState as l, useEffect as g, useMemo as f } from "react";
2
- class b {
3
- #e;
4
- constructor(t) {
5
- this.#e = t;
1
+ import { useState as Se, useEffect as Ce, useMemo as Ie } from "react";
2
+ class Ne {
3
+ #t;
4
+ constructor(e) {
5
+ this.#t = e;
6
+ }
7
+ #e(e) {
8
+ const t = this.#t;
9
+ if (!t)
10
+ throw new Error("Dashboard host not available");
11
+ return e(t);
12
+ }
13
+ fetchTopTracks(e) {
14
+ return this.#e((t) => t.fetchTopTracks(e));
15
+ }
16
+ fetchTopArtists(e) {
17
+ return this.#e((t) => t.fetchTopArtists(e));
18
+ }
19
+ fetchTopAlbums(e) {
20
+ return this.#e((t) => t.fetchTopAlbums(e));
21
+ }
22
+ fetchEditorialPlaylists(e) {
23
+ return this.#e((t) => t.fetchEditorialPlaylists(e));
6
24
  }
7
- #t(t) {
8
- const e = this.#e;
9
- if (!e)
25
+ fetchNewReleases(e) {
26
+ return this.#e((t) => t.fetchNewReleases(e));
27
+ }
28
+ }
29
+ class Oe {
30
+ #t;
31
+ constructor(e) {
32
+ this.#t = e;
33
+ }
34
+ #e(e) {
35
+ const t = this.#t;
36
+ if (!t)
10
37
  throw new Error("Favorites host not available");
11
- return t(e);
38
+ return e(t);
12
39
  }
13
40
  getTracks() {
14
- return this.#t((t) => t.getTracks());
41
+ return this.#e((e) => e.getTracks());
15
42
  }
16
43
  getAlbums() {
17
- return this.#t((t) => t.getAlbums());
44
+ return this.#e((e) => e.getAlbums());
18
45
  }
19
46
  getArtists() {
20
- return this.#t((t) => t.getArtists());
47
+ return this.#e((e) => e.getArtists());
21
48
  }
22
- addTrack(t) {
23
- return this.#t((e) => e.addTrack(t));
49
+ addTrack(e) {
50
+ return this.#e((t) => t.addTrack(e));
24
51
  }
25
- removeTrack(t) {
26
- return this.#t((e) => e.removeTrack(t));
52
+ removeTrack(e) {
53
+ return this.#e((t) => t.removeTrack(e));
27
54
  }
28
- isTrackFavorite(t) {
29
- return this.#t((e) => e.isTrackFavorite(t));
55
+ isTrackFavorite(e) {
56
+ return this.#e((t) => t.isTrackFavorite(e));
30
57
  }
31
- addAlbum(t) {
32
- return this.#t((e) => e.addAlbum(t));
58
+ addAlbum(e) {
59
+ return this.#e((t) => t.addAlbum(e));
33
60
  }
34
- removeAlbum(t) {
35
- return this.#t((e) => e.removeAlbum(t));
61
+ removeAlbum(e) {
62
+ return this.#e((t) => t.removeAlbum(e));
36
63
  }
37
- isAlbumFavorite(t) {
38
- return this.#t((e) => e.isAlbumFavorite(t));
64
+ isAlbumFavorite(e) {
65
+ return this.#e((t) => t.isAlbumFavorite(e));
39
66
  }
40
- addArtist(t) {
41
- return this.#t((e) => e.addArtist(t));
67
+ addArtist(e) {
68
+ return this.#e((t) => t.addArtist(e));
42
69
  }
43
- removeArtist(t) {
44
- return this.#t((e) => e.removeArtist(t));
70
+ removeArtist(e) {
71
+ return this.#e((t) => t.removeArtist(e));
45
72
  }
46
- isArtistFavorite(t) {
47
- return this.#t((e) => e.isArtistFavorite(t));
73
+ isArtistFavorite(e) {
74
+ return this.#e((t) => t.isArtistFavorite(e));
48
75
  }
49
- subscribe(t) {
50
- return this.#t((e) => e.subscribe(t));
76
+ subscribe(e) {
77
+ return this.#e((t) => t.subscribe(e));
51
78
  }
52
79
  }
53
- const m = (r) => {
80
+ const Re = (r) => {
54
81
  if (r instanceof Headers) {
55
- const t = {};
56
- return r.forEach((e, s) => {
57
- t[s] = e;
58
- }), t;
82
+ const e = {};
83
+ return r.forEach((t, s) => {
84
+ e[s] = t;
85
+ }), e;
59
86
  }
60
87
  return Array.isArray(r) ? Object.fromEntries(r) : r;
61
88
  };
62
- function A(r) {
63
- return async (t, e) => {
64
- const s = String(t instanceof Request ? t.url : t), u = e?.headers ? m(e.headers) : void 0, n = typeof e?.body == "string" ? e.body : void 0, a = await r.fetch(s, {
65
- method: e?.method,
66
- headers: u,
89
+ function Ze(r) {
90
+ return async (e, t) => {
91
+ const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Re(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
92
+ method: t?.method,
93
+ headers: a,
67
94
  body: n
68
95
  });
69
- return new Response(a.body, {
70
- status: a.status,
71
- headers: new Headers(a.headers)
96
+ return new Response(i.body, {
97
+ status: i.status,
98
+ headers: new Headers(i.headers)
72
99
  });
73
100
  };
74
101
  }
75
- const v = {
102
+ const Ee = {
76
103
  fetch: async () => ({
77
104
  status: 501,
78
105
  headers: {},
79
106
  body: "HTTP host not configured"
80
107
  })
81
108
  };
82
- class w {
109
+ class je {
83
110
  fetch;
84
- constructor(t) {
85
- this.fetch = A(t ?? v);
111
+ constructor(e) {
112
+ this.fetch = Ze(e ?? Ee);
86
113
  }
87
114
  }
88
- const T = {
115
+ const $e = {
89
116
  log: () => {
90
117
  }
91
118
  };
92
- class p {
119
+ class Me {
93
120
  host;
94
- constructor(t) {
95
- this.host = t ?? T;
121
+ constructor(e) {
122
+ this.host = e ?? $e;
96
123
  }
97
- trace(t) {
98
- this.host.log("trace", t);
124
+ trace(e) {
125
+ this.host.log("trace", e);
99
126
  }
100
- debug(t) {
101
- this.host.log("debug", t);
127
+ debug(e) {
128
+ this.host.log("debug", e);
102
129
  }
103
- info(t) {
104
- this.host.log("info", t);
130
+ info(e) {
131
+ this.host.log("info", e);
105
132
  }
106
- warn(t) {
107
- this.host.log("warn", t);
133
+ warn(e) {
134
+ this.host.log("warn", e);
108
135
  }
109
- error(t) {
110
- this.host.log("error", t);
136
+ error(e) {
137
+ this.host.log("error", e);
111
138
  }
112
- log(t, e) {
113
- this.host.log(t, e);
139
+ log(e, t) {
140
+ this.host.log(e, t);
114
141
  }
115
142
  }
116
- class I {
117
- #e;
118
- constructor(t) {
119
- this.#e = t;
120
- }
121
- #t(t) {
122
- const e = this.#e;
123
- if (!e)
143
+ class Pe {
144
+ #t;
145
+ constructor(e) {
146
+ this.#t = e;
147
+ }
148
+ #e(e) {
149
+ const t = this.#t;
150
+ if (!t)
124
151
  throw new Error("Metadata host not available");
125
- return t(e);
152
+ return e(t);
153
+ }
154
+ search(e, t) {
155
+ return this.#e((s) => s.search(e, t));
126
156
  }
127
- search(t, e) {
128
- return this.#t((s) => s.search(t, e));
157
+ fetchArtistBio(e, t) {
158
+ return this.#e((s) => s.fetchArtistBio(e, t));
129
159
  }
130
- fetchArtistDetails(t, e) {
131
- return this.#t((s) => s.fetchArtistDetails(t, e));
160
+ fetchArtistSocialStats(e, t) {
161
+ return this.#e(
162
+ (s) => s.fetchArtistSocialStats(e, t)
163
+ );
132
164
  }
133
- fetchArtistAlbums(t, e) {
134
- return this.#t((s) => s.fetchArtistAlbums(t, e));
165
+ fetchArtistAlbums(e, t) {
166
+ return this.#e((s) => s.fetchArtistAlbums(e, t));
135
167
  }
136
- fetchArtistTopTracks(t, e) {
137
- return this.#t((s) => s.fetchArtistTopTracks(t, e));
168
+ fetchArtistTopTracks(e, t) {
169
+ return this.#e((s) => s.fetchArtistTopTracks(e, t));
138
170
  }
139
- fetchArtistRelatedArtists(t, e) {
140
- return this.#t(
141
- (s) => s.fetchArtistRelatedArtists(t, e)
171
+ fetchArtistPlaylists(e, t) {
172
+ return this.#e((s) => s.fetchArtistPlaylists(e, t));
173
+ }
174
+ fetchArtistRelatedArtists(e, t) {
175
+ return this.#e(
176
+ (s) => s.fetchArtistRelatedArtists(e, t)
142
177
  );
143
178
  }
144
- fetchAlbumDetails(t, e) {
145
- return this.#t((s) => s.fetchAlbumDetails(t, e));
179
+ fetchAlbumDetails(e, t) {
180
+ return this.#e((s) => s.fetchAlbumDetails(e, t));
146
181
  }
147
182
  }
148
- class H {
149
- #e;
150
- constructor(t) {
151
- this.#e = t;
152
- }
153
- #t(t) {
154
- const e = this.#e;
155
- if (!e)
183
+ class Ve {
184
+ #t;
185
+ constructor(e) {
186
+ this.#t = e;
187
+ }
188
+ #e(e) {
189
+ const t = this.#t;
190
+ if (!t)
156
191
  throw new Error("Providers host not available");
157
- return t(e);
192
+ return e(t);
158
193
  }
159
- register(t) {
160
- return this.#t((e) => e.register(t));
194
+ register(e) {
195
+ return this.#e((t) => t.register(e));
161
196
  }
162
- unregister(t) {
163
- return this.#t((e) => e.unregister(t));
197
+ unregister(e) {
198
+ return this.#e((t) => t.unregister(e));
164
199
  }
165
- list(t) {
166
- return this.#t((e) => e.list(t));
200
+ list(e) {
201
+ return this.#e((t) => t.list(e));
167
202
  }
168
- get(t) {
169
- return this.#t((e) => e.get(t));
203
+ get(e, t) {
204
+ return this.#e((s) => s.get(e, t));
170
205
  }
171
206
  }
172
- class y {
173
- #e;
174
- constructor(t) {
175
- this.#e = t;
176
- }
177
- #t(t) {
178
- const e = this.#e;
179
- if (!e)
207
+ class Le {
208
+ #t;
209
+ constructor(e) {
210
+ this.#t = e;
211
+ }
212
+ #e(e) {
213
+ const t = this.#t;
214
+ if (!t)
180
215
  throw new Error("Queue host not available");
181
- return t(e);
216
+ return e(t);
182
217
  }
183
218
  getQueue() {
184
- return this.#t((t) => t.getQueue());
219
+ return this.#e((e) => e.getQueue());
185
220
  }
186
221
  getCurrentItem() {
187
- return this.#t((t) => t.getCurrentItem());
222
+ return this.#e((e) => e.getCurrentItem());
188
223
  }
189
- addToQueue(t) {
190
- return this.#t((e) => e.addToQueue(t));
224
+ addToQueue(e) {
225
+ return this.#e((t) => t.addToQueue(e));
191
226
  }
192
- addNext(t) {
193
- return this.#t((e) => e.addNext(t));
227
+ addNext(e) {
228
+ return this.#e((t) => t.addNext(e));
194
229
  }
195
- addAt(t, e) {
196
- return this.#t((s) => s.addAt(t, e));
230
+ addAt(e, t) {
231
+ return this.#e((s) => s.addAt(e, t));
197
232
  }
198
- removeByIds(t) {
199
- return this.#t((e) => e.removeByIds(t));
233
+ removeByIds(e) {
234
+ return this.#e((t) => t.removeByIds(e));
200
235
  }
201
- removeByIndices(t) {
202
- return this.#t((e) => e.removeByIndices(t));
236
+ removeByIndices(e) {
237
+ return this.#e((t) => t.removeByIndices(e));
203
238
  }
204
239
  clearQueue() {
205
- return this.#t((t) => t.clearQueue());
240
+ return this.#e((e) => e.clearQueue());
206
241
  }
207
- reorder(t, e) {
208
- return this.#t((s) => s.reorder(t, e));
242
+ reorder(e, t) {
243
+ return this.#e((s) => s.reorder(e, t));
209
244
  }
210
- updateItemState(t, e) {
211
- return this.#t((s) => s.updateItemState(t, e));
245
+ updateItemState(e, t) {
246
+ return this.#e((s) => s.updateItemState(e, t));
212
247
  }
213
248
  goToNext() {
214
- return this.#t((t) => t.goToNext());
249
+ return this.#e((e) => e.goToNext());
215
250
  }
216
251
  goToPrevious() {
217
- return this.#t((t) => t.goToPrevious());
252
+ return this.#e((e) => e.goToPrevious());
218
253
  }
219
- goToIndex(t) {
220
- return this.#t((e) => e.goToIndex(t));
254
+ goToIndex(e) {
255
+ return this.#e((t) => t.goToIndex(e));
221
256
  }
222
- goToId(t) {
223
- return this.#t((e) => e.goToId(t));
257
+ goToId(e) {
258
+ return this.#e((t) => t.goToId(e));
224
259
  }
225
- setRepeatMode(t) {
226
- return this.#t((e) => e.setRepeatMode(t));
260
+ setRepeatMode(e) {
261
+ return this.#e((t) => t.setRepeatMode(e));
227
262
  }
228
- setShuffleEnabled(t) {
229
- return this.#t((e) => e.setShuffleEnabled(t));
263
+ setShuffleEnabled(e) {
264
+ return this.#e((t) => t.setShuffleEnabled(e));
230
265
  }
231
- subscribe(t) {
232
- return this.#t((e) => e.subscribe(t));
266
+ subscribe(e) {
267
+ return this.#e((t) => t.subscribe(e));
233
268
  }
234
- subscribeToCurrentItem(t) {
235
- return this.#t((e) => e.subscribeToCurrentItem(t));
269
+ subscribeToCurrentItem(e) {
270
+ return this.#e((t) => t.subscribeToCurrentItem(e));
236
271
  }
237
272
  }
238
- class S {
239
- #e;
240
- constructor(t) {
241
- this.#e = t;
242
- }
243
- #t(t) {
244
- const e = this.#e;
245
- if (!e)
273
+ class ze {
274
+ #t;
275
+ constructor(e) {
276
+ this.#t = e;
277
+ }
278
+ #e(e) {
279
+ const t = this.#t;
280
+ if (!t)
246
281
  throw new Error("Settings host not available");
247
- return t(e);
282
+ return e(t);
248
283
  }
249
- register(t) {
250
- return this.#t((e) => e.register(t));
284
+ register(e) {
285
+ return this.#e((t) => t.register(e));
251
286
  }
252
- get(t) {
253
- return this.#t((e) => e.get(t));
287
+ get(e) {
288
+ return this.#e((t) => t.get(e));
254
289
  }
255
- set(t, e) {
256
- return this.#t((s) => s.set(t, e));
290
+ set(e, t) {
291
+ return this.#e((s) => s.set(e, t));
257
292
  }
258
- subscribe(t, e) {
259
- return this.#t((s) => s.subscribe(t, e));
293
+ subscribe(e, t) {
294
+ return this.#e((s) => s.subscribe(e, t));
260
295
  }
261
296
  }
262
- class F {
263
- #e;
264
- constructor(t) {
265
- this.#e = t;
266
- }
267
- #t(t) {
268
- const e = this.#e;
269
- if (!e)
297
+ class De {
298
+ #t;
299
+ constructor(e) {
300
+ this.#t = e;
301
+ }
302
+ #e(e) {
303
+ const t = this.#t;
304
+ if (!t)
270
305
  throw new Error("Streaming host not available");
271
- return t(e);
306
+ return e(t);
272
307
  }
273
- resolveCandidatesForTrack(t) {
274
- return this.#t((e) => e.resolveCandidatesForTrack(t));
308
+ resolveCandidatesForTrack(e) {
309
+ return this.#e((t) => t.resolveCandidatesForTrack(e));
275
310
  }
276
- resolveStreamForCandidate(t) {
277
- return this.#t((e) => e.resolveStreamForCandidate(t));
311
+ resolveStreamForCandidate(e) {
312
+ return this.#e((t) => t.resolveStreamForCandidate(e));
278
313
  }
279
314
  }
280
- class P {
315
+ class Fe {
281
316
  host;
282
- constructor(t) {
283
- this.host = t;
317
+ constructor(e) {
318
+ this.host = e;
284
319
  }
285
320
  get available() {
286
321
  return !!this.host;
287
322
  }
288
- async search(t, e) {
323
+ async search(e, t) {
289
324
  if (!this.host)
290
325
  throw new Error("YtdlpAPI: No host configured");
291
- return this.host.search(t, e);
326
+ return this.host.search(e, t);
292
327
  }
293
- async getStream(t) {
328
+ async getStream(e) {
294
329
  if (!this.host)
295
330
  throw new Error("YtdlpAPI: No host configured");
296
- return this.host.getStream(t);
331
+ return this.host.getStream(e);
297
332
  }
298
333
  }
299
- class E {
334
+ class Be {
300
335
  Settings;
301
336
  Providers;
302
337
  Queue;
@@ -306,48 +341,51 @@ class E {
306
341
  Ytdlp;
307
342
  Favorites;
308
343
  Logger;
309
- constructor(t) {
310
- this.Settings = new S(t?.settingsHost), this.Providers = new H(t?.providersHost), this.Queue = new y(t?.queueHost), this.Streaming = new F(t?.streamingHost), this.Metadata = new I(t?.metadataHost), this.Http = new w(t?.httpHost), this.Ytdlp = new P(t?.ytdlpHost), this.Favorites = new b(t?.favoritesHost), this.Logger = new p(t?.loggerHost);
344
+ Dashboard;
345
+ constructor(e) {
346
+ this.Settings = new ze(e?.settingsHost), this.Providers = new Ve(e?.providersHost), this.Queue = new Le(e?.queueHost), this.Streaming = new De(e?.streamingHost), this.Metadata = new Pe(e?.metadataHost), this.Http = new je(e?.httpHost), this.Ytdlp = new Fe(e?.ytdlpHost), this.Favorites = new Oe(e?.favoritesHost), this.Logger = new Me(e?.loggerHost), this.Dashboard = new Ne(e?.dashboardHost);
311
347
  }
312
348
  }
313
- class C extends E {
349
+ class wt extends Be {
314
350
  }
315
- class R extends Error {
316
- constructor(t) {
317
- super(`Missing capability: ${t}`), this.name = "MissingCapabilityError";
351
+ class At extends Error {
352
+ constructor(e, t) {
353
+ super(
354
+ `Missing capability: Provider "${t}" declared capability "${e}" but does not implement it`
355
+ ), this.name = "MissingCapabilityError";
318
356
  }
319
357
  }
320
- const k = (r, t) => {
321
- const [e, s] = l(void 0);
322
- g(() => {
358
+ const Tt = (r, e) => {
359
+ const [t, s] = Se(void 0);
360
+ Ce(() => {
323
361
  if (!r)
324
362
  return;
325
- let n = !0, a = !1;
326
- const i = r.subscribe(t, (o) => {
327
- n && (a = !0, s(o));
363
+ let n = !0, i = !1;
364
+ const o = r.subscribe(e, (u) => {
365
+ n && (i = !0, s(u));
328
366
  });
329
- return r.get(t).then((o) => {
330
- n && (a || s(o));
367
+ return r.get(e).then((u) => {
368
+ n && (i || s(u));
331
369
  }), () => {
332
- n = !1, i && i();
370
+ n = !1, o && o();
333
371
  };
334
- }, [t, r]);
335
- const u = f(
372
+ }, [e, r]);
373
+ const a = Ie(
336
374
  () => (n) => {
337
- r && r.set(t, n);
375
+ r && r.set(e, n);
338
376
  },
339
- [t, r]
377
+ [e, r]
340
378
  );
341
- return [e, u];
379
+ return [t, a];
342
380
  };
343
- function Q(r, t, e) {
381
+ function St(r, e, t) {
344
382
  if (!r?.items?.length)
345
383
  return;
346
- const s = r.items.filter((i) => !(i.purpose && i.purpose !== t || !i.url));
384
+ const s = r.items.filter((o) => !(o.purpose && o.purpose !== e || !o.url));
347
385
  if (!s.length)
348
386
  return r.items[0];
349
- const u = (i) => !i.width || !i.height ? 1 : i.width / i.height, a = ((i) => {
350
- switch (i) {
387
+ const a = (o) => !o.width || !o.height ? 1 : o.width / o.height, i = ((o) => {
388
+ switch (o) {
351
389
  case "avatar":
352
390
  case "thumbnail":
353
391
  return 1;
@@ -358,23 +396,2678 @@ function Q(r, t, e) {
358
396
  default:
359
397
  return 1;
360
398
  }
361
- })(t);
362
- return s.map((i) => {
363
- const o = Math.min(i.width || 0, i.height || 0), h = Math.abs(u(i) - a), c = Math.abs(o - e), d = o < e ? e / o : 1;
399
+ })(e);
400
+ return s.map((o) => {
401
+ const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t), Z = u < t ? t / u : 1;
402
+ return {
403
+ artwork: o,
404
+ score: (Z > 1.5 ? -1e3 : 0) + -f * 50 + -y * 0.1
405
+ };
406
+ }).sort((o, u) => u.score - o.score)[0]?.artwork;
407
+ }
408
+ var _;
409
+ (function(r) {
410
+ r.assertEqual = (a) => {
411
+ };
412
+ function e(a) {
413
+ }
414
+ r.assertIs = e;
415
+ function t(a) {
416
+ throw new Error();
417
+ }
418
+ r.assertNever = t, r.arrayToEnum = (a) => {
419
+ const n = {};
420
+ for (const i of a)
421
+ n[i] = i;
422
+ return n;
423
+ }, r.getValidEnumValues = (a) => {
424
+ const n = r.objectKeys(a).filter((o) => typeof a[a[o]] != "number"), i = {};
425
+ for (const o of n)
426
+ i[o] = a[o];
427
+ return r.objectValues(i);
428
+ }, r.objectValues = (a) => r.objectKeys(a).map(function(n) {
429
+ return a[n];
430
+ }), r.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
431
+ const n = [];
432
+ for (const i in a)
433
+ Object.prototype.hasOwnProperty.call(a, i) && n.push(i);
434
+ return n;
435
+ }, r.find = (a, n) => {
436
+ for (const i of a)
437
+ if (n(i))
438
+ return i;
439
+ }, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
440
+ function s(a, n = " | ") {
441
+ return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(n);
442
+ }
443
+ r.joinValues = s, r.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n;
444
+ })(_ || (_ = {}));
445
+ var ne;
446
+ (function(r) {
447
+ r.mergeShapes = (e, t) => ({
448
+ ...e,
449
+ ...t
450
+ // second overwrites first
451
+ });
452
+ })(ne || (ne = {}));
453
+ const l = _.arrayToEnum([
454
+ "string",
455
+ "nan",
456
+ "number",
457
+ "integer",
458
+ "float",
459
+ "boolean",
460
+ "date",
461
+ "bigint",
462
+ "symbol",
463
+ "function",
464
+ "undefined",
465
+ "null",
466
+ "array",
467
+ "object",
468
+ "unknown",
469
+ "promise",
470
+ "void",
471
+ "never",
472
+ "map",
473
+ "set"
474
+ ]), S = (r) => {
475
+ switch (typeof r) {
476
+ case "undefined":
477
+ return l.undefined;
478
+ case "string":
479
+ return l.string;
480
+ case "number":
481
+ return Number.isNaN(r) ? l.nan : l.number;
482
+ case "boolean":
483
+ return l.boolean;
484
+ case "function":
485
+ return l.function;
486
+ case "bigint":
487
+ return l.bigint;
488
+ case "symbol":
489
+ return l.symbol;
490
+ case "object":
491
+ return Array.isArray(r) ? l.array : r === null ? l.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? l.promise : typeof Map < "u" && r instanceof Map ? l.map : typeof Set < "u" && r instanceof Set ? l.set : typeof Date < "u" && r instanceof Date ? l.date : l.object;
492
+ default:
493
+ return l.unknown;
494
+ }
495
+ }, d = _.arrayToEnum([
496
+ "invalid_type",
497
+ "invalid_literal",
498
+ "custom",
499
+ "invalid_union",
500
+ "invalid_union_discriminator",
501
+ "invalid_enum_value",
502
+ "unrecognized_keys",
503
+ "invalid_arguments",
504
+ "invalid_return_type",
505
+ "invalid_date",
506
+ "invalid_string",
507
+ "too_small",
508
+ "too_big",
509
+ "invalid_intersection_types",
510
+ "not_multiple_of",
511
+ "not_finite"
512
+ ]);
513
+ class T extends Error {
514
+ get errors() {
515
+ return this.issues;
516
+ }
517
+ constructor(e) {
518
+ super(), this.issues = [], this.addIssue = (s) => {
519
+ this.issues = [...this.issues, s];
520
+ }, this.addIssues = (s = []) => {
521
+ this.issues = [...this.issues, ...s];
522
+ };
523
+ const t = new.target.prototype;
524
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
525
+ }
526
+ format(e) {
527
+ const t = e || function(n) {
528
+ return n.message;
529
+ }, s = { _errors: [] }, a = (n) => {
530
+ for (const i of n.issues)
531
+ if (i.code === "invalid_union")
532
+ i.unionErrors.map(a);
533
+ else if (i.code === "invalid_return_type")
534
+ a(i.returnTypeError);
535
+ else if (i.code === "invalid_arguments")
536
+ a(i.argumentsError);
537
+ else if (i.path.length === 0)
538
+ s._errors.push(t(i));
539
+ else {
540
+ let o = s, u = 0;
541
+ for (; u < i.path.length; ) {
542
+ const f = i.path[u];
543
+ u === i.path.length - 1 ? (o[f] = o[f] || { _errors: [] }, o[f]._errors.push(t(i))) : o[f] = o[f] || { _errors: [] }, o = o[f], u++;
544
+ }
545
+ }
546
+ };
547
+ return a(this), s;
548
+ }
549
+ static assert(e) {
550
+ if (!(e instanceof T))
551
+ throw new Error(`Not a ZodError: ${e}`);
552
+ }
553
+ toString() {
554
+ return this.message;
555
+ }
556
+ get message() {
557
+ return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
558
+ }
559
+ get isEmpty() {
560
+ return this.issues.length === 0;
561
+ }
562
+ flatten(e = (t) => t.message) {
563
+ const t = {}, s = [];
564
+ for (const a of this.issues)
565
+ if (a.path.length > 0) {
566
+ const n = a.path[0];
567
+ t[n] = t[n] || [], t[n].push(e(a));
568
+ } else
569
+ s.push(e(a));
570
+ return { formErrors: s, fieldErrors: t };
571
+ }
572
+ get formErrors() {
573
+ return this.flatten();
574
+ }
575
+ }
576
+ T.create = (r) => new T(r);
577
+ const X = (r, e) => {
578
+ let t;
579
+ switch (r.code) {
580
+ case d.invalid_type:
581
+ r.received === l.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
582
+ break;
583
+ case d.invalid_literal:
584
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, _.jsonStringifyReplacer)}`;
585
+ break;
586
+ case d.unrecognized_keys:
587
+ t = `Unrecognized key(s) in object: ${_.joinValues(r.keys, ", ")}`;
588
+ break;
589
+ case d.invalid_union:
590
+ t = "Invalid input";
591
+ break;
592
+ case d.invalid_union_discriminator:
593
+ t = `Invalid discriminator value. Expected ${_.joinValues(r.options)}`;
594
+ break;
595
+ case d.invalid_enum_value:
596
+ t = `Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;
597
+ break;
598
+ case d.invalid_arguments:
599
+ t = "Invalid function arguments";
600
+ break;
601
+ case d.invalid_return_type:
602
+ t = "Invalid function return type";
603
+ break;
604
+ case d.invalid_date:
605
+ t = "Invalid date";
606
+ break;
607
+ case d.invalid_string:
608
+ typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : _.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
609
+ break;
610
+ case d.too_small:
611
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
612
+ break;
613
+ case d.too_big:
614
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
615
+ break;
616
+ case d.custom:
617
+ t = "Invalid input";
618
+ break;
619
+ case d.invalid_intersection_types:
620
+ t = "Intersection results could not be merged";
621
+ break;
622
+ case d.not_multiple_of:
623
+ t = `Number must be a multiple of ${r.multipleOf}`;
624
+ break;
625
+ case d.not_finite:
626
+ t = "Number must be finite";
627
+ break;
628
+ default:
629
+ t = e.defaultError, _.assertNever(r);
630
+ }
631
+ return { message: t };
632
+ };
633
+ let Ue = X;
634
+ function He() {
635
+ return Ue;
636
+ }
637
+ const We = (r) => {
638
+ const { data: e, path: t, errorMaps: s, issueData: a } = r, n = [...t, ...a.path || []], i = {
639
+ ...a,
640
+ path: n
641
+ };
642
+ if (a.message !== void 0)
643
+ return {
644
+ ...a,
645
+ path: n,
646
+ message: a.message
647
+ };
648
+ let o = "";
649
+ const u = s.filter((f) => !!f).slice().reverse();
650
+ for (const f of u)
651
+ o = f(i, { data: e, defaultError: o }).message;
652
+ return {
653
+ ...a,
654
+ path: n,
655
+ message: o
656
+ };
657
+ };
658
+ function c(r, e) {
659
+ const t = He(), s = We({
660
+ issueData: e,
661
+ data: r.data,
662
+ path: r.path,
663
+ errorMaps: [
664
+ r.common.contextualErrorMap,
665
+ // contextual error map is first priority
666
+ r.schemaErrorMap,
667
+ // then schema-bound map if available
668
+ t,
669
+ // then global override map
670
+ t === X ? void 0 : X
671
+ // then global default map
672
+ ].filter((a) => !!a)
673
+ });
674
+ r.common.issues.push(s);
675
+ }
676
+ class b {
677
+ constructor() {
678
+ this.value = "valid";
679
+ }
680
+ dirty() {
681
+ this.value === "valid" && (this.value = "dirty");
682
+ }
683
+ abort() {
684
+ this.value !== "aborted" && (this.value = "aborted");
685
+ }
686
+ static mergeArray(e, t) {
687
+ const s = [];
688
+ for (const a of t) {
689
+ if (a.status === "aborted")
690
+ return m;
691
+ a.status === "dirty" && e.dirty(), s.push(a.value);
692
+ }
693
+ return { status: e.value, value: s };
694
+ }
695
+ static async mergeObjectAsync(e, t) {
696
+ const s = [];
697
+ for (const a of t) {
698
+ const n = await a.key, i = await a.value;
699
+ s.push({
700
+ key: n,
701
+ value: i
702
+ });
703
+ }
704
+ return b.mergeObjectSync(e, s);
705
+ }
706
+ static mergeObjectSync(e, t) {
707
+ const s = {};
708
+ for (const a of t) {
709
+ const { key: n, value: i } = a;
710
+ if (n.status === "aborted" || i.status === "aborted")
711
+ return m;
712
+ n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (s[n.value] = i.value);
713
+ }
714
+ return { status: e.value, value: s };
715
+ }
716
+ }
717
+ const m = Object.freeze({
718
+ status: "aborted"
719
+ }), D = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }), ie = (r) => r.status === "aborted", oe = (r) => r.status === "dirty", $ = (r) => r.status === "valid", H = (r) => typeof Promise < "u" && r instanceof Promise;
720
+ var h;
721
+ (function(r) {
722
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
723
+ })(h || (h = {}));
724
+ class N {
725
+ constructor(e, t, s, a) {
726
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = a;
727
+ }
728
+ get path() {
729
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
730
+ }
731
+ }
732
+ const de = (r, e) => {
733
+ if ($(e))
734
+ return { success: !0, data: e.value };
735
+ if (!r.common.issues.length)
736
+ throw new Error("Validation failed but no issues detected.");
737
+ return {
738
+ success: !1,
739
+ get error() {
740
+ if (this._error)
741
+ return this._error;
742
+ const t = new T(r.common.issues);
743
+ return this._error = t, this._error;
744
+ }
745
+ };
746
+ };
747
+ function g(r) {
748
+ if (!r)
749
+ return {};
750
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: a } = r;
751
+ if (e && (t || s))
752
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
753
+ return e ? { errorMap: e, description: a } : { errorMap: (i, o) => {
754
+ const { message: u } = r;
755
+ return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: u ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: u ?? t ?? o.defaultError };
756
+ }, description: a };
757
+ }
758
+ class v {
759
+ get description() {
760
+ return this._def.description;
761
+ }
762
+ _getType(e) {
763
+ return S(e.data);
764
+ }
765
+ _getOrReturnCtx(e, t) {
766
+ return t || {
767
+ common: e.parent.common,
768
+ data: e.data,
769
+ parsedType: S(e.data),
770
+ schemaErrorMap: this._def.errorMap,
771
+ path: e.path,
772
+ parent: e.parent
773
+ };
774
+ }
775
+ _processInputParams(e) {
776
+ return {
777
+ status: new b(),
778
+ ctx: {
779
+ common: e.parent.common,
780
+ data: e.data,
781
+ parsedType: S(e.data),
782
+ schemaErrorMap: this._def.errorMap,
783
+ path: e.path,
784
+ parent: e.parent
785
+ }
786
+ };
787
+ }
788
+ _parseSync(e) {
789
+ const t = this._parse(e);
790
+ if (H(t))
791
+ throw new Error("Synchronous parse encountered promise.");
792
+ return t;
793
+ }
794
+ _parseAsync(e) {
795
+ const t = this._parse(e);
796
+ return Promise.resolve(t);
797
+ }
798
+ parse(e, t) {
799
+ const s = this.safeParse(e, t);
800
+ if (s.success)
801
+ return s.data;
802
+ throw s.error;
803
+ }
804
+ safeParse(e, t) {
805
+ const s = {
806
+ common: {
807
+ issues: [],
808
+ async: t?.async ?? !1,
809
+ contextualErrorMap: t?.errorMap
810
+ },
811
+ path: t?.path || [],
812
+ schemaErrorMap: this._def.errorMap,
813
+ parent: null,
814
+ data: e,
815
+ parsedType: S(e)
816
+ }, a = this._parseSync({ data: e, path: s.path, parent: s });
817
+ return de(s, a);
818
+ }
819
+ "~validate"(e) {
820
+ const t = {
821
+ common: {
822
+ issues: [],
823
+ async: !!this["~standard"].async
824
+ },
825
+ path: [],
826
+ schemaErrorMap: this._def.errorMap,
827
+ parent: null,
828
+ data: e,
829
+ parsedType: S(e)
830
+ };
831
+ if (!this["~standard"].async)
832
+ try {
833
+ const s = this._parseSync({ data: e, path: [], parent: t });
834
+ return $(s) ? {
835
+ value: s.value
836
+ } : {
837
+ issues: t.common.issues
838
+ };
839
+ } catch (s) {
840
+ s?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
841
+ issues: [],
842
+ async: !0
843
+ };
844
+ }
845
+ return this._parseAsync({ data: e, path: [], parent: t }).then((s) => $(s) ? {
846
+ value: s.value
847
+ } : {
848
+ issues: t.common.issues
849
+ });
850
+ }
851
+ async parseAsync(e, t) {
852
+ const s = await this.safeParseAsync(e, t);
853
+ if (s.success)
854
+ return s.data;
855
+ throw s.error;
856
+ }
857
+ async safeParseAsync(e, t) {
858
+ const s = {
859
+ common: {
860
+ issues: [],
861
+ contextualErrorMap: t?.errorMap,
862
+ async: !0
863
+ },
864
+ path: t?.path || [],
865
+ schemaErrorMap: this._def.errorMap,
866
+ parent: null,
867
+ data: e,
868
+ parsedType: S(e)
869
+ }, a = this._parse({ data: e, path: s.path, parent: s }), n = await (H(a) ? a : Promise.resolve(a));
870
+ return de(s, n);
871
+ }
872
+ refine(e, t) {
873
+ const s = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
874
+ return this._refinement((a, n) => {
875
+ const i = e(a), o = () => n.addIssue({
876
+ code: d.custom,
877
+ ...s(a)
878
+ });
879
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
880
+ });
881
+ }
882
+ refinement(e, t) {
883
+ return this._refinement((s, a) => e(s) ? !0 : (a.addIssue(typeof t == "function" ? t(s, a) : t), !1));
884
+ }
885
+ _refinement(e) {
886
+ return new V({
887
+ schema: this,
888
+ typeName: p.ZodEffects,
889
+ effect: { type: "refinement", refinement: e }
890
+ });
891
+ }
892
+ superRefine(e) {
893
+ return this._refinement(e);
894
+ }
895
+ constructor(e) {
896
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
897
+ version: 1,
898
+ vendor: "zod",
899
+ validate: (t) => this["~validate"](t)
900
+ };
901
+ }
902
+ optional() {
903
+ return I.create(this, this._def);
904
+ }
905
+ nullable() {
906
+ return L.create(this, this._def);
907
+ }
908
+ nullish() {
909
+ return this.nullable().optional();
910
+ }
911
+ array() {
912
+ return A.create(this);
913
+ }
914
+ promise() {
915
+ return Y.create(this, this._def);
916
+ }
917
+ or(e) {
918
+ return q.create([this, e], this._def);
919
+ }
920
+ and(e) {
921
+ return Q.create(this, e, this._def);
922
+ }
923
+ transform(e) {
924
+ return new V({
925
+ ...g(this._def),
926
+ schema: this,
927
+ typeName: p.ZodEffects,
928
+ effect: { type: "transform", transform: e }
929
+ });
930
+ }
931
+ default(e) {
932
+ const t = typeof e == "function" ? e : () => e;
933
+ return new te({
934
+ ...g(this._def),
935
+ innerType: this,
936
+ defaultValue: t,
937
+ typeName: p.ZodDefault
938
+ });
939
+ }
940
+ brand() {
941
+ return new pt({
942
+ typeName: p.ZodBranded,
943
+ type: this,
944
+ ...g(this._def)
945
+ });
946
+ }
947
+ catch(e) {
948
+ const t = typeof e == "function" ? e : () => e;
949
+ return new se({
950
+ ...g(this._def),
951
+ innerType: this,
952
+ catchValue: t,
953
+ typeName: p.ZodCatch
954
+ });
955
+ }
956
+ describe(e) {
957
+ const t = this.constructor;
958
+ return new t({
959
+ ...this._def,
960
+ description: e
961
+ });
962
+ }
963
+ pipe(e) {
964
+ return ae.create(this, e);
965
+ }
966
+ readonly() {
967
+ return re.create(this);
968
+ }
969
+ isOptional() {
970
+ return this.safeParse(void 0).success;
971
+ }
972
+ isNullable() {
973
+ return this.safeParse(null).success;
974
+ }
975
+ }
976
+ const qe = /^c[^\s-]{8,}$/i, Qe = /^[0-9a-z]+$/, Ye = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Je = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Ge = /^[a-z0-9_-]{21}$/i, Xe = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ke = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, et = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, tt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
977
+ let G;
978
+ const st = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, rt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, at = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, nt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, it = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ot = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, xe = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", dt = new RegExp(`^${xe}$`);
979
+ function ke(r) {
980
+ let e = "[0-5]\\d";
981
+ r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
982
+ const t = r.precision ? "+" : "?";
983
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
984
+ }
985
+ function ct(r) {
986
+ return new RegExp(`^${ke(r)}$`);
987
+ }
988
+ function ut(r) {
989
+ let e = `${xe}T${ke(r)}`;
990
+ const t = [];
991
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
992
+ }
993
+ function lt(r, e) {
994
+ return !!((e === "v4" || !e) && st.test(r) || (e === "v6" || !e) && at.test(r));
995
+ }
996
+ function ht(r, e) {
997
+ if (!Xe.test(r))
998
+ return !1;
999
+ try {
1000
+ const [t] = r.split(".");
1001
+ if (!t)
1002
+ return !1;
1003
+ const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(s));
1004
+ return !(typeof a != "object" || a === null || "typ" in a && a?.typ !== "JWT" || !a.alg || e && a.alg !== e);
1005
+ } catch {
1006
+ return !1;
1007
+ }
1008
+ }
1009
+ function ft(r, e) {
1010
+ return !!((e === "v4" || !e) && rt.test(r) || (e === "v6" || !e) && nt.test(r));
1011
+ }
1012
+ class C extends v {
1013
+ _parse(e) {
1014
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
1015
+ const n = this._getOrReturnCtx(e);
1016
+ return c(n, {
1017
+ code: d.invalid_type,
1018
+ expected: l.string,
1019
+ received: n.parsedType
1020
+ }), m;
1021
+ }
1022
+ const s = new b();
1023
+ let a;
1024
+ for (const n of this._def.checks)
1025
+ if (n.kind === "min")
1026
+ e.data.length < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1027
+ code: d.too_small,
1028
+ minimum: n.value,
1029
+ type: "string",
1030
+ inclusive: !0,
1031
+ exact: !1,
1032
+ message: n.message
1033
+ }), s.dirty());
1034
+ else if (n.kind === "max")
1035
+ e.data.length > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1036
+ code: d.too_big,
1037
+ maximum: n.value,
1038
+ type: "string",
1039
+ inclusive: !0,
1040
+ exact: !1,
1041
+ message: n.message
1042
+ }), s.dirty());
1043
+ else if (n.kind === "length") {
1044
+ const i = e.data.length > n.value, o = e.data.length < n.value;
1045
+ (i || o) && (a = this._getOrReturnCtx(e, a), i ? c(a, {
1046
+ code: d.too_big,
1047
+ maximum: n.value,
1048
+ type: "string",
1049
+ inclusive: !0,
1050
+ exact: !0,
1051
+ message: n.message
1052
+ }) : o && c(a, {
1053
+ code: d.too_small,
1054
+ minimum: n.value,
1055
+ type: "string",
1056
+ inclusive: !0,
1057
+ exact: !0,
1058
+ message: n.message
1059
+ }), s.dirty());
1060
+ } else if (n.kind === "email")
1061
+ et.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1062
+ validation: "email",
1063
+ code: d.invalid_string,
1064
+ message: n.message
1065
+ }), s.dirty());
1066
+ else if (n.kind === "emoji")
1067
+ G || (G = new RegExp(tt, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1068
+ validation: "emoji",
1069
+ code: d.invalid_string,
1070
+ message: n.message
1071
+ }), s.dirty());
1072
+ else if (n.kind === "uuid")
1073
+ Je.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1074
+ validation: "uuid",
1075
+ code: d.invalid_string,
1076
+ message: n.message
1077
+ }), s.dirty());
1078
+ else if (n.kind === "nanoid")
1079
+ Ge.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1080
+ validation: "nanoid",
1081
+ code: d.invalid_string,
1082
+ message: n.message
1083
+ }), s.dirty());
1084
+ else if (n.kind === "cuid")
1085
+ qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1086
+ validation: "cuid",
1087
+ code: d.invalid_string,
1088
+ message: n.message
1089
+ }), s.dirty());
1090
+ else if (n.kind === "cuid2")
1091
+ Qe.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1092
+ validation: "cuid2",
1093
+ code: d.invalid_string,
1094
+ message: n.message
1095
+ }), s.dirty());
1096
+ else if (n.kind === "ulid")
1097
+ Ye.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1098
+ validation: "ulid",
1099
+ code: d.invalid_string,
1100
+ message: n.message
1101
+ }), s.dirty());
1102
+ else if (n.kind === "url")
1103
+ try {
1104
+ new URL(e.data);
1105
+ } catch {
1106
+ a = this._getOrReturnCtx(e, a), c(a, {
1107
+ validation: "url",
1108
+ code: d.invalid_string,
1109
+ message: n.message
1110
+ }), s.dirty();
1111
+ }
1112
+ else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1113
+ validation: "regex",
1114
+ code: d.invalid_string,
1115
+ message: n.message
1116
+ }), s.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), c(a, {
1117
+ code: d.invalid_string,
1118
+ validation: { includes: n.value, position: n.position },
1119
+ message: n.message
1120
+ }), s.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
1121
+ code: d.invalid_string,
1122
+ validation: { startsWith: n.value },
1123
+ message: n.message
1124
+ }), s.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), c(a, {
1125
+ code: d.invalid_string,
1126
+ validation: { endsWith: n.value },
1127
+ message: n.message
1128
+ }), s.dirty()) : n.kind === "datetime" ? ut(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1129
+ code: d.invalid_string,
1130
+ validation: "datetime",
1131
+ message: n.message
1132
+ }), s.dirty()) : n.kind === "date" ? dt.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1133
+ code: d.invalid_string,
1134
+ validation: "date",
1135
+ message: n.message
1136
+ }), s.dirty()) : n.kind === "time" ? ct(n).test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1137
+ code: d.invalid_string,
1138
+ validation: "time",
1139
+ message: n.message
1140
+ }), s.dirty()) : n.kind === "duration" ? Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1141
+ validation: "duration",
1142
+ code: d.invalid_string,
1143
+ message: n.message
1144
+ }), s.dirty()) : n.kind === "ip" ? lt(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1145
+ validation: "ip",
1146
+ code: d.invalid_string,
1147
+ message: n.message
1148
+ }), s.dirty()) : n.kind === "jwt" ? ht(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), c(a, {
1149
+ validation: "jwt",
1150
+ code: d.invalid_string,
1151
+ message: n.message
1152
+ }), s.dirty()) : n.kind === "cidr" ? ft(e.data, n.version) || (a = this._getOrReturnCtx(e, a), c(a, {
1153
+ validation: "cidr",
1154
+ code: d.invalid_string,
1155
+ message: n.message
1156
+ }), s.dirty()) : n.kind === "base64" ? it.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1157
+ validation: "base64",
1158
+ code: d.invalid_string,
1159
+ message: n.message
1160
+ }), s.dirty()) : n.kind === "base64url" ? ot.test(e.data) || (a = this._getOrReturnCtx(e, a), c(a, {
1161
+ validation: "base64url",
1162
+ code: d.invalid_string,
1163
+ message: n.message
1164
+ }), s.dirty()) : _.assertNever(n);
1165
+ return { status: s.value, value: e.data };
1166
+ }
1167
+ _regex(e, t, s) {
1168
+ return this.refinement((a) => e.test(a), {
1169
+ validation: t,
1170
+ code: d.invalid_string,
1171
+ ...h.errToObj(s)
1172
+ });
1173
+ }
1174
+ _addCheck(e) {
1175
+ return new C({
1176
+ ...this._def,
1177
+ checks: [...this._def.checks, e]
1178
+ });
1179
+ }
1180
+ email(e) {
1181
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
1182
+ }
1183
+ url(e) {
1184
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
1185
+ }
1186
+ emoji(e) {
1187
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
1188
+ }
1189
+ uuid(e) {
1190
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
1191
+ }
1192
+ nanoid(e) {
1193
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
1194
+ }
1195
+ cuid(e) {
1196
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
1197
+ }
1198
+ cuid2(e) {
1199
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
1200
+ }
1201
+ ulid(e) {
1202
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
1203
+ }
1204
+ base64(e) {
1205
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
1206
+ }
1207
+ base64url(e) {
1208
+ return this._addCheck({
1209
+ kind: "base64url",
1210
+ ...h.errToObj(e)
1211
+ });
1212
+ }
1213
+ jwt(e) {
1214
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
1215
+ }
1216
+ ip(e) {
1217
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
1218
+ }
1219
+ cidr(e) {
1220
+ return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
1221
+ }
1222
+ datetime(e) {
1223
+ return typeof e == "string" ? this._addCheck({
1224
+ kind: "datetime",
1225
+ precision: null,
1226
+ offset: !1,
1227
+ local: !1,
1228
+ message: e
1229
+ }) : this._addCheck({
1230
+ kind: "datetime",
1231
+ precision: typeof e?.precision > "u" ? null : e?.precision,
1232
+ offset: e?.offset ?? !1,
1233
+ local: e?.local ?? !1,
1234
+ ...h.errToObj(e?.message)
1235
+ });
1236
+ }
1237
+ date(e) {
1238
+ return this._addCheck({ kind: "date", message: e });
1239
+ }
1240
+ time(e) {
1241
+ return typeof e == "string" ? this._addCheck({
1242
+ kind: "time",
1243
+ precision: null,
1244
+ message: e
1245
+ }) : this._addCheck({
1246
+ kind: "time",
1247
+ precision: typeof e?.precision > "u" ? null : e?.precision,
1248
+ ...h.errToObj(e?.message)
1249
+ });
1250
+ }
1251
+ duration(e) {
1252
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
1253
+ }
1254
+ regex(e, t) {
1255
+ return this._addCheck({
1256
+ kind: "regex",
1257
+ regex: e,
1258
+ ...h.errToObj(t)
1259
+ });
1260
+ }
1261
+ includes(e, t) {
1262
+ return this._addCheck({
1263
+ kind: "includes",
1264
+ value: e,
1265
+ position: t?.position,
1266
+ ...h.errToObj(t?.message)
1267
+ });
1268
+ }
1269
+ startsWith(e, t) {
1270
+ return this._addCheck({
1271
+ kind: "startsWith",
1272
+ value: e,
1273
+ ...h.errToObj(t)
1274
+ });
1275
+ }
1276
+ endsWith(e, t) {
1277
+ return this._addCheck({
1278
+ kind: "endsWith",
1279
+ value: e,
1280
+ ...h.errToObj(t)
1281
+ });
1282
+ }
1283
+ min(e, t) {
1284
+ return this._addCheck({
1285
+ kind: "min",
1286
+ value: e,
1287
+ ...h.errToObj(t)
1288
+ });
1289
+ }
1290
+ max(e, t) {
1291
+ return this._addCheck({
1292
+ kind: "max",
1293
+ value: e,
1294
+ ...h.errToObj(t)
1295
+ });
1296
+ }
1297
+ length(e, t) {
1298
+ return this._addCheck({
1299
+ kind: "length",
1300
+ value: e,
1301
+ ...h.errToObj(t)
1302
+ });
1303
+ }
1304
+ /**
1305
+ * Equivalent to `.min(1)`
1306
+ */
1307
+ nonempty(e) {
1308
+ return this.min(1, h.errToObj(e));
1309
+ }
1310
+ trim() {
1311
+ return new C({
1312
+ ...this._def,
1313
+ checks: [...this._def.checks, { kind: "trim" }]
1314
+ });
1315
+ }
1316
+ toLowerCase() {
1317
+ return new C({
1318
+ ...this._def,
1319
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1320
+ });
1321
+ }
1322
+ toUpperCase() {
1323
+ return new C({
1324
+ ...this._def,
1325
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1326
+ });
1327
+ }
1328
+ get isDatetime() {
1329
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1330
+ }
1331
+ get isDate() {
1332
+ return !!this._def.checks.find((e) => e.kind === "date");
1333
+ }
1334
+ get isTime() {
1335
+ return !!this._def.checks.find((e) => e.kind === "time");
1336
+ }
1337
+ get isDuration() {
1338
+ return !!this._def.checks.find((e) => e.kind === "duration");
1339
+ }
1340
+ get isEmail() {
1341
+ return !!this._def.checks.find((e) => e.kind === "email");
1342
+ }
1343
+ get isURL() {
1344
+ return !!this._def.checks.find((e) => e.kind === "url");
1345
+ }
1346
+ get isEmoji() {
1347
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1348
+ }
1349
+ get isUUID() {
1350
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1351
+ }
1352
+ get isNANOID() {
1353
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1354
+ }
1355
+ get isCUID() {
1356
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1357
+ }
1358
+ get isCUID2() {
1359
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1360
+ }
1361
+ get isULID() {
1362
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1363
+ }
1364
+ get isIP() {
1365
+ return !!this._def.checks.find((e) => e.kind === "ip");
1366
+ }
1367
+ get isCIDR() {
1368
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1369
+ }
1370
+ get isBase64() {
1371
+ return !!this._def.checks.find((e) => e.kind === "base64");
1372
+ }
1373
+ get isBase64url() {
1374
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1375
+ }
1376
+ get minLength() {
1377
+ let e = null;
1378
+ for (const t of this._def.checks)
1379
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1380
+ return e;
1381
+ }
1382
+ get maxLength() {
1383
+ let e = null;
1384
+ for (const t of this._def.checks)
1385
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1386
+ return e;
1387
+ }
1388
+ }
1389
+ C.create = (r) => new C({
1390
+ checks: [],
1391
+ typeName: p.ZodString,
1392
+ coerce: r?.coerce ?? !1,
1393
+ ...g(r)
1394
+ });
1395
+ function mt(r, e) {
1396
+ const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = t > s ? t : s, n = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
1397
+ return n % i / 10 ** a;
1398
+ }
1399
+ class M extends v {
1400
+ constructor() {
1401
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1402
+ }
1403
+ _parse(e) {
1404
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
1405
+ const n = this._getOrReturnCtx(e);
1406
+ return c(n, {
1407
+ code: d.invalid_type,
1408
+ expected: l.number,
1409
+ received: n.parsedType
1410
+ }), m;
1411
+ }
1412
+ let s;
1413
+ const a = new b();
1414
+ for (const n of this._def.checks)
1415
+ n.kind === "int" ? _.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
1416
+ code: d.invalid_type,
1417
+ expected: "integer",
1418
+ received: "float",
1419
+ message: n.message
1420
+ }), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1421
+ code: d.too_small,
1422
+ minimum: n.value,
1423
+ type: "number",
1424
+ inclusive: n.inclusive,
1425
+ exact: !1,
1426
+ message: n.message
1427
+ }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1428
+ code: d.too_big,
1429
+ maximum: n.value,
1430
+ type: "number",
1431
+ inclusive: n.inclusive,
1432
+ exact: !1,
1433
+ message: n.message
1434
+ }), a.dirty()) : n.kind === "multipleOf" ? mt(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), c(s, {
1435
+ code: d.not_multiple_of,
1436
+ multipleOf: n.value,
1437
+ message: n.message
1438
+ }), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), c(s, {
1439
+ code: d.not_finite,
1440
+ message: n.message
1441
+ }), a.dirty()) : _.assertNever(n);
1442
+ return { status: a.value, value: e.data };
1443
+ }
1444
+ gte(e, t) {
1445
+ return this.setLimit("min", e, !0, h.toString(t));
1446
+ }
1447
+ gt(e, t) {
1448
+ return this.setLimit("min", e, !1, h.toString(t));
1449
+ }
1450
+ lte(e, t) {
1451
+ return this.setLimit("max", e, !0, h.toString(t));
1452
+ }
1453
+ lt(e, t) {
1454
+ return this.setLimit("max", e, !1, h.toString(t));
1455
+ }
1456
+ setLimit(e, t, s, a) {
1457
+ return new M({
1458
+ ...this._def,
1459
+ checks: [
1460
+ ...this._def.checks,
1461
+ {
1462
+ kind: e,
1463
+ value: t,
1464
+ inclusive: s,
1465
+ message: h.toString(a)
1466
+ }
1467
+ ]
1468
+ });
1469
+ }
1470
+ _addCheck(e) {
1471
+ return new M({
1472
+ ...this._def,
1473
+ checks: [...this._def.checks, e]
1474
+ });
1475
+ }
1476
+ int(e) {
1477
+ return this._addCheck({
1478
+ kind: "int",
1479
+ message: h.toString(e)
1480
+ });
1481
+ }
1482
+ positive(e) {
1483
+ return this._addCheck({
1484
+ kind: "min",
1485
+ value: 0,
1486
+ inclusive: !1,
1487
+ message: h.toString(e)
1488
+ });
1489
+ }
1490
+ negative(e) {
1491
+ return this._addCheck({
1492
+ kind: "max",
1493
+ value: 0,
1494
+ inclusive: !1,
1495
+ message: h.toString(e)
1496
+ });
1497
+ }
1498
+ nonpositive(e) {
1499
+ return this._addCheck({
1500
+ kind: "max",
1501
+ value: 0,
1502
+ inclusive: !0,
1503
+ message: h.toString(e)
1504
+ });
1505
+ }
1506
+ nonnegative(e) {
1507
+ return this._addCheck({
1508
+ kind: "min",
1509
+ value: 0,
1510
+ inclusive: !0,
1511
+ message: h.toString(e)
1512
+ });
1513
+ }
1514
+ multipleOf(e, t) {
1515
+ return this._addCheck({
1516
+ kind: "multipleOf",
1517
+ value: e,
1518
+ message: h.toString(t)
1519
+ });
1520
+ }
1521
+ finite(e) {
1522
+ return this._addCheck({
1523
+ kind: "finite",
1524
+ message: h.toString(e)
1525
+ });
1526
+ }
1527
+ safe(e) {
1528
+ return this._addCheck({
1529
+ kind: "min",
1530
+ inclusive: !0,
1531
+ value: Number.MIN_SAFE_INTEGER,
1532
+ message: h.toString(e)
1533
+ })._addCheck({
1534
+ kind: "max",
1535
+ inclusive: !0,
1536
+ value: Number.MAX_SAFE_INTEGER,
1537
+ message: h.toString(e)
1538
+ });
1539
+ }
1540
+ get minValue() {
1541
+ let e = null;
1542
+ for (const t of this._def.checks)
1543
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1544
+ return e;
1545
+ }
1546
+ get maxValue() {
1547
+ let e = null;
1548
+ for (const t of this._def.checks)
1549
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1550
+ return e;
1551
+ }
1552
+ get isInt() {
1553
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
1554
+ }
1555
+ get isFinite() {
1556
+ let e = null, t = null;
1557
+ for (const s of this._def.checks) {
1558
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1559
+ return !0;
1560
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1561
+ }
1562
+ return Number.isFinite(t) && Number.isFinite(e);
1563
+ }
1564
+ }
1565
+ M.create = (r) => new M({
1566
+ checks: [],
1567
+ typeName: p.ZodNumber,
1568
+ coerce: r?.coerce || !1,
1569
+ ...g(r)
1570
+ });
1571
+ class F extends v {
1572
+ constructor() {
1573
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1574
+ }
1575
+ _parse(e) {
1576
+ if (this._def.coerce)
1577
+ try {
1578
+ e.data = BigInt(e.data);
1579
+ } catch {
1580
+ return this._getInvalidInput(e);
1581
+ }
1582
+ if (this._getType(e) !== l.bigint)
1583
+ return this._getInvalidInput(e);
1584
+ let s;
1585
+ const a = new b();
1586
+ for (const n of this._def.checks)
1587
+ n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1588
+ code: d.too_small,
1589
+ type: "bigint",
1590
+ minimum: n.value,
1591
+ inclusive: n.inclusive,
1592
+ message: n.message
1593
+ }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), c(s, {
1594
+ code: d.too_big,
1595
+ type: "bigint",
1596
+ maximum: n.value,
1597
+ inclusive: n.inclusive,
1598
+ message: n.message
1599
+ }), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), c(s, {
1600
+ code: d.not_multiple_of,
1601
+ multipleOf: n.value,
1602
+ message: n.message
1603
+ }), a.dirty()) : _.assertNever(n);
1604
+ return { status: a.value, value: e.data };
1605
+ }
1606
+ _getInvalidInput(e) {
1607
+ const t = this._getOrReturnCtx(e);
1608
+ return c(t, {
1609
+ code: d.invalid_type,
1610
+ expected: l.bigint,
1611
+ received: t.parsedType
1612
+ }), m;
1613
+ }
1614
+ gte(e, t) {
1615
+ return this.setLimit("min", e, !0, h.toString(t));
1616
+ }
1617
+ gt(e, t) {
1618
+ return this.setLimit("min", e, !1, h.toString(t));
1619
+ }
1620
+ lte(e, t) {
1621
+ return this.setLimit("max", e, !0, h.toString(t));
1622
+ }
1623
+ lt(e, t) {
1624
+ return this.setLimit("max", e, !1, h.toString(t));
1625
+ }
1626
+ setLimit(e, t, s, a) {
1627
+ return new F({
1628
+ ...this._def,
1629
+ checks: [
1630
+ ...this._def.checks,
1631
+ {
1632
+ kind: e,
1633
+ value: t,
1634
+ inclusive: s,
1635
+ message: h.toString(a)
1636
+ }
1637
+ ]
1638
+ });
1639
+ }
1640
+ _addCheck(e) {
1641
+ return new F({
1642
+ ...this._def,
1643
+ checks: [...this._def.checks, e]
1644
+ });
1645
+ }
1646
+ positive(e) {
1647
+ return this._addCheck({
1648
+ kind: "min",
1649
+ value: BigInt(0),
1650
+ inclusive: !1,
1651
+ message: h.toString(e)
1652
+ });
1653
+ }
1654
+ negative(e) {
1655
+ return this._addCheck({
1656
+ kind: "max",
1657
+ value: BigInt(0),
1658
+ inclusive: !1,
1659
+ message: h.toString(e)
1660
+ });
1661
+ }
1662
+ nonpositive(e) {
1663
+ return this._addCheck({
1664
+ kind: "max",
1665
+ value: BigInt(0),
1666
+ inclusive: !0,
1667
+ message: h.toString(e)
1668
+ });
1669
+ }
1670
+ nonnegative(e) {
1671
+ return this._addCheck({
1672
+ kind: "min",
1673
+ value: BigInt(0),
1674
+ inclusive: !0,
1675
+ message: h.toString(e)
1676
+ });
1677
+ }
1678
+ multipleOf(e, t) {
1679
+ return this._addCheck({
1680
+ kind: "multipleOf",
1681
+ value: e,
1682
+ message: h.toString(t)
1683
+ });
1684
+ }
1685
+ get minValue() {
1686
+ let e = null;
1687
+ for (const t of this._def.checks)
1688
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1689
+ return e;
1690
+ }
1691
+ get maxValue() {
1692
+ let e = null;
1693
+ for (const t of this._def.checks)
1694
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1695
+ return e;
1696
+ }
1697
+ }
1698
+ F.create = (r) => new F({
1699
+ checks: [],
1700
+ typeName: p.ZodBigInt,
1701
+ coerce: r?.coerce ?? !1,
1702
+ ...g(r)
1703
+ });
1704
+ class K extends v {
1705
+ _parse(e) {
1706
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
1707
+ const s = this._getOrReturnCtx(e);
1708
+ return c(s, {
1709
+ code: d.invalid_type,
1710
+ expected: l.boolean,
1711
+ received: s.parsedType
1712
+ }), m;
1713
+ }
1714
+ return w(e.data);
1715
+ }
1716
+ }
1717
+ K.create = (r) => new K({
1718
+ typeName: p.ZodBoolean,
1719
+ coerce: r?.coerce || !1,
1720
+ ...g(r)
1721
+ });
1722
+ class W extends v {
1723
+ _parse(e) {
1724
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
1725
+ const n = this._getOrReturnCtx(e);
1726
+ return c(n, {
1727
+ code: d.invalid_type,
1728
+ expected: l.date,
1729
+ received: n.parsedType
1730
+ }), m;
1731
+ }
1732
+ if (Number.isNaN(e.data.getTime())) {
1733
+ const n = this._getOrReturnCtx(e);
1734
+ return c(n, {
1735
+ code: d.invalid_date
1736
+ }), m;
1737
+ }
1738
+ const s = new b();
1739
+ let a;
1740
+ for (const n of this._def.checks)
1741
+ n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1742
+ code: d.too_small,
1743
+ message: n.message,
1744
+ inclusive: !0,
1745
+ exact: !1,
1746
+ minimum: n.value,
1747
+ type: "date"
1748
+ }), s.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a), c(a, {
1749
+ code: d.too_big,
1750
+ message: n.message,
1751
+ inclusive: !0,
1752
+ exact: !1,
1753
+ maximum: n.value,
1754
+ type: "date"
1755
+ }), s.dirty()) : _.assertNever(n);
364
1756
  return {
365
- artwork: i,
366
- score: (d > 1.5 ? -1e3 : 0) + -h * 50 + -c * 0.1
1757
+ status: s.value,
1758
+ value: new Date(e.data.getTime())
1759
+ };
1760
+ }
1761
+ _addCheck(e) {
1762
+ return new W({
1763
+ ...this._def,
1764
+ checks: [...this._def.checks, e]
1765
+ });
1766
+ }
1767
+ min(e, t) {
1768
+ return this._addCheck({
1769
+ kind: "min",
1770
+ value: e.getTime(),
1771
+ message: h.toString(t)
1772
+ });
1773
+ }
1774
+ max(e, t) {
1775
+ return this._addCheck({
1776
+ kind: "max",
1777
+ value: e.getTime(),
1778
+ message: h.toString(t)
1779
+ });
1780
+ }
1781
+ get minDate() {
1782
+ let e = null;
1783
+ for (const t of this._def.checks)
1784
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1785
+ return e != null ? new Date(e) : null;
1786
+ }
1787
+ get maxDate() {
1788
+ let e = null;
1789
+ for (const t of this._def.checks)
1790
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1791
+ return e != null ? new Date(e) : null;
1792
+ }
1793
+ }
1794
+ W.create = (r) => new W({
1795
+ checks: [],
1796
+ coerce: r?.coerce || !1,
1797
+ typeName: p.ZodDate,
1798
+ ...g(r)
1799
+ });
1800
+ class ce extends v {
1801
+ _parse(e) {
1802
+ if (this._getType(e) !== l.symbol) {
1803
+ const s = this._getOrReturnCtx(e);
1804
+ return c(s, {
1805
+ code: d.invalid_type,
1806
+ expected: l.symbol,
1807
+ received: s.parsedType
1808
+ }), m;
1809
+ }
1810
+ return w(e.data);
1811
+ }
1812
+ }
1813
+ ce.create = (r) => new ce({
1814
+ typeName: p.ZodSymbol,
1815
+ ...g(r)
1816
+ });
1817
+ class ue extends v {
1818
+ _parse(e) {
1819
+ if (this._getType(e) !== l.undefined) {
1820
+ const s = this._getOrReturnCtx(e);
1821
+ return c(s, {
1822
+ code: d.invalid_type,
1823
+ expected: l.undefined,
1824
+ received: s.parsedType
1825
+ }), m;
1826
+ }
1827
+ return w(e.data);
1828
+ }
1829
+ }
1830
+ ue.create = (r) => new ue({
1831
+ typeName: p.ZodUndefined,
1832
+ ...g(r)
1833
+ });
1834
+ class le extends v {
1835
+ _parse(e) {
1836
+ if (this._getType(e) !== l.null) {
1837
+ const s = this._getOrReturnCtx(e);
1838
+ return c(s, {
1839
+ code: d.invalid_type,
1840
+ expected: l.null,
1841
+ received: s.parsedType
1842
+ }), m;
1843
+ }
1844
+ return w(e.data);
1845
+ }
1846
+ }
1847
+ le.create = (r) => new le({
1848
+ typeName: p.ZodNull,
1849
+ ...g(r)
1850
+ });
1851
+ class he extends v {
1852
+ constructor() {
1853
+ super(...arguments), this._any = !0;
1854
+ }
1855
+ _parse(e) {
1856
+ return w(e.data);
1857
+ }
1858
+ }
1859
+ he.create = (r) => new he({
1860
+ typeName: p.ZodAny,
1861
+ ...g(r)
1862
+ });
1863
+ class fe extends v {
1864
+ constructor() {
1865
+ super(...arguments), this._unknown = !0;
1866
+ }
1867
+ _parse(e) {
1868
+ return w(e.data);
1869
+ }
1870
+ }
1871
+ fe.create = (r) => new fe({
1872
+ typeName: p.ZodUnknown,
1873
+ ...g(r)
1874
+ });
1875
+ class O extends v {
1876
+ _parse(e) {
1877
+ const t = this._getOrReturnCtx(e);
1878
+ return c(t, {
1879
+ code: d.invalid_type,
1880
+ expected: l.never,
1881
+ received: t.parsedType
1882
+ }), m;
1883
+ }
1884
+ }
1885
+ O.create = (r) => new O({
1886
+ typeName: p.ZodNever,
1887
+ ...g(r)
1888
+ });
1889
+ class me extends v {
1890
+ _parse(e) {
1891
+ if (this._getType(e) !== l.undefined) {
1892
+ const s = this._getOrReturnCtx(e);
1893
+ return c(s, {
1894
+ code: d.invalid_type,
1895
+ expected: l.void,
1896
+ received: s.parsedType
1897
+ }), m;
1898
+ }
1899
+ return w(e.data);
1900
+ }
1901
+ }
1902
+ me.create = (r) => new me({
1903
+ typeName: p.ZodVoid,
1904
+ ...g(r)
1905
+ });
1906
+ class A extends v {
1907
+ _parse(e) {
1908
+ const { ctx: t, status: s } = this._processInputParams(e), a = this._def;
1909
+ if (t.parsedType !== l.array)
1910
+ return c(t, {
1911
+ code: d.invalid_type,
1912
+ expected: l.array,
1913
+ received: t.parsedType
1914
+ }), m;
1915
+ if (a.exactLength !== null) {
1916
+ const i = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
1917
+ (i || o) && (c(t, {
1918
+ code: i ? d.too_big : d.too_small,
1919
+ minimum: o ? a.exactLength.value : void 0,
1920
+ maximum: i ? a.exactLength.value : void 0,
1921
+ type: "array",
1922
+ inclusive: !0,
1923
+ exact: !0,
1924
+ message: a.exactLength.message
1925
+ }), s.dirty());
1926
+ }
1927
+ if (a.minLength !== null && t.data.length < a.minLength.value && (c(t, {
1928
+ code: d.too_small,
1929
+ minimum: a.minLength.value,
1930
+ type: "array",
1931
+ inclusive: !0,
1932
+ exact: !1,
1933
+ message: a.minLength.message
1934
+ }), s.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (c(t, {
1935
+ code: d.too_big,
1936
+ maximum: a.maxLength.value,
1937
+ type: "array",
1938
+ inclusive: !0,
1939
+ exact: !1,
1940
+ message: a.maxLength.message
1941
+ }), s.dirty()), t.common.async)
1942
+ return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new N(t, i, t.path, o)))).then((i) => b.mergeArray(s, i));
1943
+ const n = [...t.data].map((i, o) => a.type._parseSync(new N(t, i, t.path, o)));
1944
+ return b.mergeArray(s, n);
1945
+ }
1946
+ get element() {
1947
+ return this._def.type;
1948
+ }
1949
+ min(e, t) {
1950
+ return new A({
1951
+ ...this._def,
1952
+ minLength: { value: e, message: h.toString(t) }
1953
+ });
1954
+ }
1955
+ max(e, t) {
1956
+ return new A({
1957
+ ...this._def,
1958
+ maxLength: { value: e, message: h.toString(t) }
1959
+ });
1960
+ }
1961
+ length(e, t) {
1962
+ return new A({
1963
+ ...this._def,
1964
+ exactLength: { value: e, message: h.toString(t) }
1965
+ });
1966
+ }
1967
+ nonempty(e) {
1968
+ return this.min(1, e);
1969
+ }
1970
+ }
1971
+ A.create = (r, e) => new A({
1972
+ type: r,
1973
+ minLength: null,
1974
+ maxLength: null,
1975
+ exactLength: null,
1976
+ typeName: p.ZodArray,
1977
+ ...g(e)
1978
+ });
1979
+ function j(r) {
1980
+ if (r instanceof k) {
1981
+ const e = {};
1982
+ for (const t in r.shape) {
1983
+ const s = r.shape[t];
1984
+ e[t] = I.create(j(s));
1985
+ }
1986
+ return new k({
1987
+ ...r._def,
1988
+ shape: () => e
1989
+ });
1990
+ } else return r instanceof A ? new A({
1991
+ ...r._def,
1992
+ type: j(r.element)
1993
+ }) : r instanceof I ? I.create(j(r.unwrap())) : r instanceof L ? L.create(j(r.unwrap())) : r instanceof E ? E.create(r.items.map((e) => j(e))) : r;
1994
+ }
1995
+ class k extends v {
1996
+ constructor() {
1997
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1998
+ }
1999
+ _getCached() {
2000
+ if (this._cached !== null)
2001
+ return this._cached;
2002
+ const e = this._def.shape(), t = _.objectKeys(e);
2003
+ return this._cached = { shape: e, keys: t }, this._cached;
2004
+ }
2005
+ _parse(e) {
2006
+ if (this._getType(e) !== l.object) {
2007
+ const f = this._getOrReturnCtx(e);
2008
+ return c(f, {
2009
+ code: d.invalid_type,
2010
+ expected: l.object,
2011
+ received: f.parsedType
2012
+ }), m;
2013
+ }
2014
+ const { status: s, ctx: a } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = [];
2015
+ if (!(this._def.catchall instanceof O && this._def.unknownKeys === "strip"))
2016
+ for (const f in a.data)
2017
+ i.includes(f) || o.push(f);
2018
+ const u = [];
2019
+ for (const f of i) {
2020
+ const y = n[f], Z = a.data[f];
2021
+ u.push({
2022
+ key: { status: "valid", value: f },
2023
+ value: y._parse(new N(a, Z, a.path, f)),
2024
+ alwaysSet: f in a.data
2025
+ });
2026
+ }
2027
+ if (this._def.catchall instanceof O) {
2028
+ const f = this._def.unknownKeys;
2029
+ if (f === "passthrough")
2030
+ for (const y of o)
2031
+ u.push({
2032
+ key: { status: "valid", value: y },
2033
+ value: { status: "valid", value: a.data[y] }
2034
+ });
2035
+ else if (f === "strict")
2036
+ o.length > 0 && (c(a, {
2037
+ code: d.unrecognized_keys,
2038
+ keys: o
2039
+ }), s.dirty());
2040
+ else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
2041
+ } else {
2042
+ const f = this._def.catchall;
2043
+ for (const y of o) {
2044
+ const Z = a.data[y];
2045
+ u.push({
2046
+ key: { status: "valid", value: y },
2047
+ value: f._parse(
2048
+ new N(a, Z, a.path, y)
2049
+ //, ctx.child(key), value, getParsedType(value)
2050
+ ),
2051
+ alwaysSet: y in a.data
2052
+ });
2053
+ }
2054
+ }
2055
+ return a.common.async ? Promise.resolve().then(async () => {
2056
+ const f = [];
2057
+ for (const y of u) {
2058
+ const Z = await y.key, Te = await y.value;
2059
+ f.push({
2060
+ key: Z,
2061
+ value: Te,
2062
+ alwaysSet: y.alwaysSet
2063
+ });
2064
+ }
2065
+ return f;
2066
+ }).then((f) => b.mergeObjectSync(s, f)) : b.mergeObjectSync(s, u);
2067
+ }
2068
+ get shape() {
2069
+ return this._def.shape();
2070
+ }
2071
+ strict(e) {
2072
+ return h.errToObj, new k({
2073
+ ...this._def,
2074
+ unknownKeys: "strict",
2075
+ ...e !== void 0 ? {
2076
+ errorMap: (t, s) => {
2077
+ const a = this._def.errorMap?.(t, s).message ?? s.defaultError;
2078
+ return t.code === "unrecognized_keys" ? {
2079
+ message: h.errToObj(e).message ?? a
2080
+ } : {
2081
+ message: a
2082
+ };
2083
+ }
2084
+ } : {}
2085
+ });
2086
+ }
2087
+ strip() {
2088
+ return new k({
2089
+ ...this._def,
2090
+ unknownKeys: "strip"
2091
+ });
2092
+ }
2093
+ passthrough() {
2094
+ return new k({
2095
+ ...this._def,
2096
+ unknownKeys: "passthrough"
2097
+ });
2098
+ }
2099
+ // const AugmentFactory =
2100
+ // <Def extends ZodObjectDef>(def: Def) =>
2101
+ // <Augmentation extends ZodRawShape>(
2102
+ // augmentation: Augmentation
2103
+ // ): ZodObject<
2104
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2105
+ // Def["unknownKeys"],
2106
+ // Def["catchall"]
2107
+ // > => {
2108
+ // return new ZodObject({
2109
+ // ...def,
2110
+ // shape: () => ({
2111
+ // ...def.shape(),
2112
+ // ...augmentation,
2113
+ // }),
2114
+ // }) as any;
2115
+ // };
2116
+ extend(e) {
2117
+ return new k({
2118
+ ...this._def,
2119
+ shape: () => ({
2120
+ ...this._def.shape(),
2121
+ ...e
2122
+ })
2123
+ });
2124
+ }
2125
+ /**
2126
+ * Prior to zod@1.0.12 there was a bug in the
2127
+ * inferred type of merged objects. Please
2128
+ * upgrade if you are experiencing issues.
2129
+ */
2130
+ merge(e) {
2131
+ return new k({
2132
+ unknownKeys: e._def.unknownKeys,
2133
+ catchall: e._def.catchall,
2134
+ shape: () => ({
2135
+ ...this._def.shape(),
2136
+ ...e._def.shape()
2137
+ }),
2138
+ typeName: p.ZodObject
2139
+ });
2140
+ }
2141
+ // merge<
2142
+ // Incoming extends AnyZodObject,
2143
+ // Augmentation extends Incoming["shape"],
2144
+ // NewOutput extends {
2145
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2146
+ // ? Augmentation[k]["_output"]
2147
+ // : k extends keyof Output
2148
+ // ? Output[k]
2149
+ // : never;
2150
+ // },
2151
+ // NewInput extends {
2152
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2153
+ // ? Augmentation[k]["_input"]
2154
+ // : k extends keyof Input
2155
+ // ? Input[k]
2156
+ // : never;
2157
+ // }
2158
+ // >(
2159
+ // merging: Incoming
2160
+ // ): ZodObject<
2161
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2162
+ // Incoming["_def"]["unknownKeys"],
2163
+ // Incoming["_def"]["catchall"],
2164
+ // NewOutput,
2165
+ // NewInput
2166
+ // > {
2167
+ // const merged: any = new ZodObject({
2168
+ // unknownKeys: merging._def.unknownKeys,
2169
+ // catchall: merging._def.catchall,
2170
+ // shape: () =>
2171
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2172
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2173
+ // }) as any;
2174
+ // return merged;
2175
+ // }
2176
+ setKey(e, t) {
2177
+ return this.augment({ [e]: t });
2178
+ }
2179
+ // merge<Incoming extends AnyZodObject>(
2180
+ // merging: Incoming
2181
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2182
+ // ZodObject<
2183
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2184
+ // Incoming["_def"]["unknownKeys"],
2185
+ // Incoming["_def"]["catchall"]
2186
+ // > {
2187
+ // // const mergedShape = objectUtil.mergeShapes(
2188
+ // // this._def.shape(),
2189
+ // // merging._def.shape()
2190
+ // // );
2191
+ // const merged: any = new ZodObject({
2192
+ // unknownKeys: merging._def.unknownKeys,
2193
+ // catchall: merging._def.catchall,
2194
+ // shape: () =>
2195
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2196
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2197
+ // }) as any;
2198
+ // return merged;
2199
+ // }
2200
+ catchall(e) {
2201
+ return new k({
2202
+ ...this._def,
2203
+ catchall: e
2204
+ });
2205
+ }
2206
+ pick(e) {
2207
+ const t = {};
2208
+ for (const s of _.objectKeys(e))
2209
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
2210
+ return new k({
2211
+ ...this._def,
2212
+ shape: () => t
2213
+ });
2214
+ }
2215
+ omit(e) {
2216
+ const t = {};
2217
+ for (const s of _.objectKeys(this.shape))
2218
+ e[s] || (t[s] = this.shape[s]);
2219
+ return new k({
2220
+ ...this._def,
2221
+ shape: () => t
2222
+ });
2223
+ }
2224
+ /**
2225
+ * @deprecated
2226
+ */
2227
+ deepPartial() {
2228
+ return j(this);
2229
+ }
2230
+ partial(e) {
2231
+ const t = {};
2232
+ for (const s of _.objectKeys(this.shape)) {
2233
+ const a = this.shape[s];
2234
+ e && !e[s] ? t[s] = a : t[s] = a.optional();
2235
+ }
2236
+ return new k({
2237
+ ...this._def,
2238
+ shape: () => t
2239
+ });
2240
+ }
2241
+ required(e) {
2242
+ const t = {};
2243
+ for (const s of _.objectKeys(this.shape))
2244
+ if (e && !e[s])
2245
+ t[s] = this.shape[s];
2246
+ else {
2247
+ let n = this.shape[s];
2248
+ for (; n instanceof I; )
2249
+ n = n._def.innerType;
2250
+ t[s] = n;
2251
+ }
2252
+ return new k({
2253
+ ...this._def,
2254
+ shape: () => t
2255
+ });
2256
+ }
2257
+ keyof() {
2258
+ return be(_.objectKeys(this.shape));
2259
+ }
2260
+ }
2261
+ k.create = (r, e) => new k({
2262
+ shape: () => r,
2263
+ unknownKeys: "strip",
2264
+ catchall: O.create(),
2265
+ typeName: p.ZodObject,
2266
+ ...g(e)
2267
+ });
2268
+ k.strictCreate = (r, e) => new k({
2269
+ shape: () => r,
2270
+ unknownKeys: "strict",
2271
+ catchall: O.create(),
2272
+ typeName: p.ZodObject,
2273
+ ...g(e)
2274
+ });
2275
+ k.lazycreate = (r, e) => new k({
2276
+ shape: r,
2277
+ unknownKeys: "strip",
2278
+ catchall: O.create(),
2279
+ typeName: p.ZodObject,
2280
+ ...g(e)
2281
+ });
2282
+ class q extends v {
2283
+ _parse(e) {
2284
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
2285
+ function a(n) {
2286
+ for (const o of n)
2287
+ if (o.result.status === "valid")
2288
+ return o.result;
2289
+ for (const o of n)
2290
+ if (o.result.status === "dirty")
2291
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2292
+ const i = n.map((o) => new T(o.ctx.common.issues));
2293
+ return c(t, {
2294
+ code: d.invalid_union,
2295
+ unionErrors: i
2296
+ }), m;
2297
+ }
2298
+ if (t.common.async)
2299
+ return Promise.all(s.map(async (n) => {
2300
+ const i = {
2301
+ ...t,
2302
+ common: {
2303
+ ...t.common,
2304
+ issues: []
2305
+ },
2306
+ parent: null
2307
+ };
2308
+ return {
2309
+ result: await n._parseAsync({
2310
+ data: t.data,
2311
+ path: t.path,
2312
+ parent: i
2313
+ }),
2314
+ ctx: i
2315
+ };
2316
+ })).then(a);
2317
+ {
2318
+ let n;
2319
+ const i = [];
2320
+ for (const u of s) {
2321
+ const f = {
2322
+ ...t,
2323
+ common: {
2324
+ ...t.common,
2325
+ issues: []
2326
+ },
2327
+ parent: null
2328
+ }, y = u._parseSync({
2329
+ data: t.data,
2330
+ path: t.path,
2331
+ parent: f
2332
+ });
2333
+ if (y.status === "valid")
2334
+ return y;
2335
+ y.status === "dirty" && !n && (n = { result: y, ctx: f }), f.common.issues.length && i.push(f.common.issues);
2336
+ }
2337
+ if (n)
2338
+ return t.common.issues.push(...n.ctx.common.issues), n.result;
2339
+ const o = i.map((u) => new T(u));
2340
+ return c(t, {
2341
+ code: d.invalid_union,
2342
+ unionErrors: o
2343
+ }), m;
2344
+ }
2345
+ }
2346
+ get options() {
2347
+ return this._def.options;
2348
+ }
2349
+ }
2350
+ q.create = (r, e) => new q({
2351
+ options: r,
2352
+ typeName: p.ZodUnion,
2353
+ ...g(e)
2354
+ });
2355
+ function ee(r, e) {
2356
+ const t = S(r), s = S(e);
2357
+ if (r === e)
2358
+ return { valid: !0, data: r };
2359
+ if (t === l.object && s === l.object) {
2360
+ const a = _.objectKeys(e), n = _.objectKeys(r).filter((o) => a.indexOf(o) !== -1), i = { ...r, ...e };
2361
+ for (const o of n) {
2362
+ const u = ee(r[o], e[o]);
2363
+ if (!u.valid)
2364
+ return { valid: !1 };
2365
+ i[o] = u.data;
2366
+ }
2367
+ return { valid: !0, data: i };
2368
+ } else if (t === l.array && s === l.array) {
2369
+ if (r.length !== e.length)
2370
+ return { valid: !1 };
2371
+ const a = [];
2372
+ for (let n = 0; n < r.length; n++) {
2373
+ const i = r[n], o = e[n], u = ee(i, o);
2374
+ if (!u.valid)
2375
+ return { valid: !1 };
2376
+ a.push(u.data);
2377
+ }
2378
+ return { valid: !0, data: a };
2379
+ } else return t === l.date && s === l.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2380
+ }
2381
+ class Q extends v {
2382
+ _parse(e) {
2383
+ const { status: t, ctx: s } = this._processInputParams(e), a = (n, i) => {
2384
+ if (ie(n) || ie(i))
2385
+ return m;
2386
+ const o = ee(n.value, i.value);
2387
+ return o.valid ? ((oe(n) || oe(i)) && t.dirty(), { status: t.value, value: o.data }) : (c(s, {
2388
+ code: d.invalid_intersection_types
2389
+ }), m);
2390
+ };
2391
+ return s.common.async ? Promise.all([
2392
+ this._def.left._parseAsync({
2393
+ data: s.data,
2394
+ path: s.path,
2395
+ parent: s
2396
+ }),
2397
+ this._def.right._parseAsync({
2398
+ data: s.data,
2399
+ path: s.path,
2400
+ parent: s
2401
+ })
2402
+ ]).then(([n, i]) => a(n, i)) : a(this._def.left._parseSync({
2403
+ data: s.data,
2404
+ path: s.path,
2405
+ parent: s
2406
+ }), this._def.right._parseSync({
2407
+ data: s.data,
2408
+ path: s.path,
2409
+ parent: s
2410
+ }));
2411
+ }
2412
+ }
2413
+ Q.create = (r, e, t) => new Q({
2414
+ left: r,
2415
+ right: e,
2416
+ typeName: p.ZodIntersection,
2417
+ ...g(t)
2418
+ });
2419
+ class E extends v {
2420
+ _parse(e) {
2421
+ const { status: t, ctx: s } = this._processInputParams(e);
2422
+ if (s.parsedType !== l.array)
2423
+ return c(s, {
2424
+ code: d.invalid_type,
2425
+ expected: l.array,
2426
+ received: s.parsedType
2427
+ }), m;
2428
+ if (s.data.length < this._def.items.length)
2429
+ return c(s, {
2430
+ code: d.too_small,
2431
+ minimum: this._def.items.length,
2432
+ inclusive: !0,
2433
+ exact: !1,
2434
+ type: "array"
2435
+ }), m;
2436
+ !this._def.rest && s.data.length > this._def.items.length && (c(s, {
2437
+ code: d.too_big,
2438
+ maximum: this._def.items.length,
2439
+ inclusive: !0,
2440
+ exact: !1,
2441
+ type: "array"
2442
+ }), t.dirty());
2443
+ const n = [...s.data].map((i, o) => {
2444
+ const u = this._def.items[o] || this._def.rest;
2445
+ return u ? u._parse(new N(s, i, s.path, o)) : null;
2446
+ }).filter((i) => !!i);
2447
+ return s.common.async ? Promise.all(n).then((i) => b.mergeArray(t, i)) : b.mergeArray(t, n);
2448
+ }
2449
+ get items() {
2450
+ return this._def.items;
2451
+ }
2452
+ rest(e) {
2453
+ return new E({
2454
+ ...this._def,
2455
+ rest: e
2456
+ });
2457
+ }
2458
+ }
2459
+ E.create = (r, e) => {
2460
+ if (!Array.isArray(r))
2461
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2462
+ return new E({
2463
+ items: r,
2464
+ typeName: p.ZodTuple,
2465
+ rest: null,
2466
+ ...g(e)
2467
+ });
2468
+ };
2469
+ class pe extends v {
2470
+ get keySchema() {
2471
+ return this._def.keyType;
2472
+ }
2473
+ get valueSchema() {
2474
+ return this._def.valueType;
2475
+ }
2476
+ _parse(e) {
2477
+ const { status: t, ctx: s } = this._processInputParams(e);
2478
+ if (s.parsedType !== l.map)
2479
+ return c(s, {
2480
+ code: d.invalid_type,
2481
+ expected: l.map,
2482
+ received: s.parsedType
2483
+ }), m;
2484
+ const a = this._def.keyType, n = this._def.valueType, i = [...s.data.entries()].map(([o, u], f) => ({
2485
+ key: a._parse(new N(s, o, s.path, [f, "key"])),
2486
+ value: n._parse(new N(s, u, s.path, [f, "value"]))
2487
+ }));
2488
+ if (s.common.async) {
2489
+ const o = /* @__PURE__ */ new Map();
2490
+ return Promise.resolve().then(async () => {
2491
+ for (const u of i) {
2492
+ const f = await u.key, y = await u.value;
2493
+ if (f.status === "aborted" || y.status === "aborted")
2494
+ return m;
2495
+ (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2496
+ }
2497
+ return { status: t.value, value: o };
2498
+ });
2499
+ } else {
2500
+ const o = /* @__PURE__ */ new Map();
2501
+ for (const u of i) {
2502
+ const f = u.key, y = u.value;
2503
+ if (f.status === "aborted" || y.status === "aborted")
2504
+ return m;
2505
+ (f.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(f.value, y.value);
2506
+ }
2507
+ return { status: t.value, value: o };
2508
+ }
2509
+ }
2510
+ }
2511
+ pe.create = (r, e, t) => new pe({
2512
+ valueType: e,
2513
+ keyType: r,
2514
+ typeName: p.ZodMap,
2515
+ ...g(t)
2516
+ });
2517
+ class B extends v {
2518
+ _parse(e) {
2519
+ const { status: t, ctx: s } = this._processInputParams(e);
2520
+ if (s.parsedType !== l.set)
2521
+ return c(s, {
2522
+ code: d.invalid_type,
2523
+ expected: l.set,
2524
+ received: s.parsedType
2525
+ }), m;
2526
+ const a = this._def;
2527
+ a.minSize !== null && s.data.size < a.minSize.value && (c(s, {
2528
+ code: d.too_small,
2529
+ minimum: a.minSize.value,
2530
+ type: "set",
2531
+ inclusive: !0,
2532
+ exact: !1,
2533
+ message: a.minSize.message
2534
+ }), t.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (c(s, {
2535
+ code: d.too_big,
2536
+ maximum: a.maxSize.value,
2537
+ type: "set",
2538
+ inclusive: !0,
2539
+ exact: !1,
2540
+ message: a.maxSize.message
2541
+ }), t.dirty());
2542
+ const n = this._def.valueType;
2543
+ function i(u) {
2544
+ const f = /* @__PURE__ */ new Set();
2545
+ for (const y of u) {
2546
+ if (y.status === "aborted")
2547
+ return m;
2548
+ y.status === "dirty" && t.dirty(), f.add(y.value);
2549
+ }
2550
+ return { status: t.value, value: f };
2551
+ }
2552
+ const o = [...s.data.values()].map((u, f) => n._parse(new N(s, u, s.path, f)));
2553
+ return s.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2554
+ }
2555
+ min(e, t) {
2556
+ return new B({
2557
+ ...this._def,
2558
+ minSize: { value: e, message: h.toString(t) }
2559
+ });
2560
+ }
2561
+ max(e, t) {
2562
+ return new B({
2563
+ ...this._def,
2564
+ maxSize: { value: e, message: h.toString(t) }
2565
+ });
2566
+ }
2567
+ size(e, t) {
2568
+ return this.min(e, t).max(e, t);
2569
+ }
2570
+ nonempty(e) {
2571
+ return this.min(1, e);
2572
+ }
2573
+ }
2574
+ B.create = (r, e) => new B({
2575
+ valueType: r,
2576
+ minSize: null,
2577
+ maxSize: null,
2578
+ typeName: p.ZodSet,
2579
+ ...g(e)
2580
+ });
2581
+ class ge extends v {
2582
+ get schema() {
2583
+ return this._def.getter();
2584
+ }
2585
+ _parse(e) {
2586
+ const { ctx: t } = this._processInputParams(e);
2587
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2588
+ }
2589
+ }
2590
+ ge.create = (r, e) => new ge({
2591
+ getter: r,
2592
+ typeName: p.ZodLazy,
2593
+ ...g(e)
2594
+ });
2595
+ class ye extends v {
2596
+ _parse(e) {
2597
+ if (e.data !== this._def.value) {
2598
+ const t = this._getOrReturnCtx(e);
2599
+ return c(t, {
2600
+ received: t.data,
2601
+ code: d.invalid_literal,
2602
+ expected: this._def.value
2603
+ }), m;
2604
+ }
2605
+ return { status: "valid", value: e.data };
2606
+ }
2607
+ get value() {
2608
+ return this._def.value;
2609
+ }
2610
+ }
2611
+ ye.create = (r, e) => new ye({
2612
+ value: r,
2613
+ typeName: p.ZodLiteral,
2614
+ ...g(e)
2615
+ });
2616
+ function be(r, e) {
2617
+ return new P({
2618
+ values: r,
2619
+ typeName: p.ZodEnum,
2620
+ ...g(e)
2621
+ });
2622
+ }
2623
+ class P extends v {
2624
+ _parse(e) {
2625
+ if (typeof e.data != "string") {
2626
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2627
+ return c(t, {
2628
+ expected: _.joinValues(s),
2629
+ received: t.parsedType,
2630
+ code: d.invalid_type
2631
+ }), m;
2632
+ }
2633
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2634
+ const t = this._getOrReturnCtx(e), s = this._def.values;
2635
+ return c(t, {
2636
+ received: t.data,
2637
+ code: d.invalid_enum_value,
2638
+ options: s
2639
+ }), m;
2640
+ }
2641
+ return w(e.data);
2642
+ }
2643
+ get options() {
2644
+ return this._def.values;
2645
+ }
2646
+ get enum() {
2647
+ const e = {};
2648
+ for (const t of this._def.values)
2649
+ e[t] = t;
2650
+ return e;
2651
+ }
2652
+ get Values() {
2653
+ const e = {};
2654
+ for (const t of this._def.values)
2655
+ e[t] = t;
2656
+ return e;
2657
+ }
2658
+ get Enum() {
2659
+ const e = {};
2660
+ for (const t of this._def.values)
2661
+ e[t] = t;
2662
+ return e;
2663
+ }
2664
+ extract(e, t = this._def) {
2665
+ return P.create(e, {
2666
+ ...this._def,
2667
+ ...t
2668
+ });
2669
+ }
2670
+ exclude(e, t = this._def) {
2671
+ return P.create(this.options.filter((s) => !e.includes(s)), {
2672
+ ...this._def,
2673
+ ...t
2674
+ });
2675
+ }
2676
+ }
2677
+ P.create = be;
2678
+ class ve extends v {
2679
+ _parse(e) {
2680
+ const t = _.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2681
+ if (s.parsedType !== l.string && s.parsedType !== l.number) {
2682
+ const a = _.objectValues(t);
2683
+ return c(s, {
2684
+ expected: _.joinValues(a),
2685
+ received: s.parsedType,
2686
+ code: d.invalid_type
2687
+ }), m;
2688
+ }
2689
+ if (this._cache || (this._cache = new Set(_.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2690
+ const a = _.objectValues(t);
2691
+ return c(s, {
2692
+ received: s.data,
2693
+ code: d.invalid_enum_value,
2694
+ options: a
2695
+ }), m;
2696
+ }
2697
+ return w(e.data);
2698
+ }
2699
+ get enum() {
2700
+ return this._def.values;
2701
+ }
2702
+ }
2703
+ ve.create = (r, e) => new ve({
2704
+ values: r,
2705
+ typeName: p.ZodNativeEnum,
2706
+ ...g(e)
2707
+ });
2708
+ class Y extends v {
2709
+ unwrap() {
2710
+ return this._def.type;
2711
+ }
2712
+ _parse(e) {
2713
+ const { ctx: t } = this._processInputParams(e);
2714
+ if (t.parsedType !== l.promise && t.common.async === !1)
2715
+ return c(t, {
2716
+ code: d.invalid_type,
2717
+ expected: l.promise,
2718
+ received: t.parsedType
2719
+ }), m;
2720
+ const s = t.parsedType === l.promise ? t.data : Promise.resolve(t.data);
2721
+ return w(s.then((a) => this._def.type.parseAsync(a, {
2722
+ path: t.path,
2723
+ errorMap: t.common.contextualErrorMap
2724
+ })));
2725
+ }
2726
+ }
2727
+ Y.create = (r, e) => new Y({
2728
+ type: r,
2729
+ typeName: p.ZodPromise,
2730
+ ...g(e)
2731
+ });
2732
+ class V extends v {
2733
+ innerType() {
2734
+ return this._def.schema;
2735
+ }
2736
+ sourceType() {
2737
+ return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2738
+ }
2739
+ _parse(e) {
2740
+ const { status: t, ctx: s } = this._processInputParams(e), a = this._def.effect || null, n = {
2741
+ addIssue: (i) => {
2742
+ c(s, i), i.fatal ? t.abort() : t.dirty();
2743
+ },
2744
+ get path() {
2745
+ return s.path;
2746
+ }
367
2747
  };
368
- }).sort((i, o) => o.score - i.score)[0]?.artwork;
2748
+ if (n.addIssue = n.addIssue.bind(n), a.type === "preprocess") {
2749
+ const i = a.transform(s.data, n);
2750
+ if (s.common.async)
2751
+ return Promise.resolve(i).then(async (o) => {
2752
+ if (t.value === "aborted")
2753
+ return m;
2754
+ const u = await this._def.schema._parseAsync({
2755
+ data: o,
2756
+ path: s.path,
2757
+ parent: s
2758
+ });
2759
+ return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ? D(u.value) : u;
2760
+ });
2761
+ {
2762
+ if (t.value === "aborted")
2763
+ return m;
2764
+ const o = this._def.schema._parseSync({
2765
+ data: i,
2766
+ path: s.path,
2767
+ parent: s
2768
+ });
2769
+ return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? D(o.value) : o;
2770
+ }
2771
+ }
2772
+ if (a.type === "refinement") {
2773
+ const i = (o) => {
2774
+ const u = a.refinement(o, n);
2775
+ if (s.common.async)
2776
+ return Promise.resolve(u);
2777
+ if (u instanceof Promise)
2778
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2779
+ return o;
2780
+ };
2781
+ if (s.common.async === !1) {
2782
+ const o = this._def.schema._parseSync({
2783
+ data: s.data,
2784
+ path: s.path,
2785
+ parent: s
2786
+ });
2787
+ return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2788
+ } else
2789
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2790
+ }
2791
+ if (a.type === "transform")
2792
+ if (s.common.async === !1) {
2793
+ const i = this._def.schema._parseSync({
2794
+ data: s.data,
2795
+ path: s.path,
2796
+ parent: s
2797
+ });
2798
+ if (!$(i))
2799
+ return m;
2800
+ const o = a.transform(i.value, n);
2801
+ if (o instanceof Promise)
2802
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2803
+ return { status: t.value, value: o };
2804
+ } else
2805
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => $(i) ? Promise.resolve(a.transform(i.value, n)).then((o) => ({
2806
+ status: t.value,
2807
+ value: o
2808
+ })) : m);
2809
+ _.assertNever(a);
2810
+ }
2811
+ }
2812
+ V.create = (r, e, t) => new V({
2813
+ schema: r,
2814
+ typeName: p.ZodEffects,
2815
+ effect: e,
2816
+ ...g(t)
2817
+ });
2818
+ V.createWithPreprocess = (r, e, t) => new V({
2819
+ schema: e,
2820
+ effect: { type: "preprocess", transform: r },
2821
+ typeName: p.ZodEffects,
2822
+ ...g(t)
2823
+ });
2824
+ class I extends v {
2825
+ _parse(e) {
2826
+ return this._getType(e) === l.undefined ? w(void 0) : this._def.innerType._parse(e);
2827
+ }
2828
+ unwrap() {
2829
+ return this._def.innerType;
2830
+ }
2831
+ }
2832
+ I.create = (r, e) => new I({
2833
+ innerType: r,
2834
+ typeName: p.ZodOptional,
2835
+ ...g(e)
2836
+ });
2837
+ class L extends v {
2838
+ _parse(e) {
2839
+ return this._getType(e) === l.null ? w(null) : this._def.innerType._parse(e);
2840
+ }
2841
+ unwrap() {
2842
+ return this._def.innerType;
2843
+ }
2844
+ }
2845
+ L.create = (r, e) => new L({
2846
+ innerType: r,
2847
+ typeName: p.ZodNullable,
2848
+ ...g(e)
2849
+ });
2850
+ class te extends v {
2851
+ _parse(e) {
2852
+ const { ctx: t } = this._processInputParams(e);
2853
+ let s = t.data;
2854
+ return t.parsedType === l.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2855
+ data: s,
2856
+ path: t.path,
2857
+ parent: t
2858
+ });
2859
+ }
2860
+ removeDefault() {
2861
+ return this._def.innerType;
2862
+ }
2863
+ }
2864
+ te.create = (r, e) => new te({
2865
+ innerType: r,
2866
+ typeName: p.ZodDefault,
2867
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2868
+ ...g(e)
2869
+ });
2870
+ class se extends v {
2871
+ _parse(e) {
2872
+ const { ctx: t } = this._processInputParams(e), s = {
2873
+ ...t,
2874
+ common: {
2875
+ ...t.common,
2876
+ issues: []
2877
+ }
2878
+ }, a = this._def.innerType._parse({
2879
+ data: s.data,
2880
+ path: s.path,
2881
+ parent: {
2882
+ ...s
2883
+ }
2884
+ });
2885
+ return H(a) ? a.then((n) => ({
2886
+ status: "valid",
2887
+ value: n.status === "valid" ? n.value : this._def.catchValue({
2888
+ get error() {
2889
+ return new T(s.common.issues);
2890
+ },
2891
+ input: s.data
2892
+ })
2893
+ })) : {
2894
+ status: "valid",
2895
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2896
+ get error() {
2897
+ return new T(s.common.issues);
2898
+ },
2899
+ input: s.data
2900
+ })
2901
+ };
2902
+ }
2903
+ removeCatch() {
2904
+ return this._def.innerType;
2905
+ }
2906
+ }
2907
+ se.create = (r, e) => new se({
2908
+ innerType: r,
2909
+ typeName: p.ZodCatch,
2910
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2911
+ ...g(e)
2912
+ });
2913
+ class _e extends v {
2914
+ _parse(e) {
2915
+ if (this._getType(e) !== l.nan) {
2916
+ const s = this._getOrReturnCtx(e);
2917
+ return c(s, {
2918
+ code: d.invalid_type,
2919
+ expected: l.nan,
2920
+ received: s.parsedType
2921
+ }), m;
2922
+ }
2923
+ return { status: "valid", value: e.data };
2924
+ }
2925
+ }
2926
+ _e.create = (r) => new _e({
2927
+ typeName: p.ZodNaN,
2928
+ ...g(r)
2929
+ });
2930
+ class pt extends v {
2931
+ _parse(e) {
2932
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2933
+ return this._def.type._parse({
2934
+ data: s,
2935
+ path: t.path,
2936
+ parent: t
2937
+ });
2938
+ }
2939
+ unwrap() {
2940
+ return this._def.type;
2941
+ }
2942
+ }
2943
+ class ae extends v {
2944
+ _parse(e) {
2945
+ const { status: t, ctx: s } = this._processInputParams(e);
2946
+ if (s.common.async)
2947
+ return (async () => {
2948
+ const n = await this._def.in._parseAsync({
2949
+ data: s.data,
2950
+ path: s.path,
2951
+ parent: s
2952
+ });
2953
+ return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), D(n.value)) : this._def.out._parseAsync({
2954
+ data: n.value,
2955
+ path: s.path,
2956
+ parent: s
2957
+ });
2958
+ })();
2959
+ {
2960
+ const a = this._def.in._parseSync({
2961
+ data: s.data,
2962
+ path: s.path,
2963
+ parent: s
2964
+ });
2965
+ return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), {
2966
+ status: "dirty",
2967
+ value: a.value
2968
+ }) : this._def.out._parseSync({
2969
+ data: a.value,
2970
+ path: s.path,
2971
+ parent: s
2972
+ });
2973
+ }
2974
+ }
2975
+ static create(e, t) {
2976
+ return new ae({
2977
+ in: e,
2978
+ out: t,
2979
+ typeName: p.ZodPipeline
2980
+ });
2981
+ }
2982
+ }
2983
+ class re extends v {
2984
+ _parse(e) {
2985
+ const t = this._def.innerType._parse(e), s = (a) => ($(a) && (a.value = Object.freeze(a.value)), a);
2986
+ return H(t) ? t.then((a) => s(a)) : s(t);
2987
+ }
2988
+ unwrap() {
2989
+ return this._def.innerType;
2990
+ }
369
2991
  }
2992
+ re.create = (r, e) => new re({
2993
+ innerType: r,
2994
+ typeName: p.ZodReadonly,
2995
+ ...g(e)
2996
+ });
2997
+ var p;
2998
+ (function(r) {
2999
+ r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
3000
+ })(p || (p = {}));
3001
+ const x = C.create, U = M.create, we = K.create;
3002
+ O.create;
3003
+ const z = A.create, R = k.create;
3004
+ q.create;
3005
+ Q.create;
3006
+ E.create;
3007
+ const gt = P.create;
3008
+ Y.create;
3009
+ I.create;
3010
+ L.create;
3011
+ const J = R({
3012
+ provider: x(),
3013
+ id: x(),
3014
+ url: x().optional()
3015
+ }), yt = R({
3016
+ url: x(),
3017
+ width: U().optional(),
3018
+ height: U().optional(),
3019
+ purpose: gt(["avatar", "cover", "background", "thumbnail"]).optional(),
3020
+ source: J.optional()
3021
+ }), Ae = R({
3022
+ items: z(yt)
3023
+ }), vt = R({
3024
+ name: x(),
3025
+ roles: z(x()),
3026
+ source: J.optional()
3027
+ }), _t = R({
3028
+ title: x(),
3029
+ artists: z(vt),
3030
+ durationMs: U().optional(),
3031
+ source: J
3032
+ }).passthrough(), xt = R({
3033
+ id: x(),
3034
+ track: _t,
3035
+ note: x().optional(),
3036
+ addedAtIso: x()
3037
+ }), Ct = R({
3038
+ id: x(),
3039
+ name: x(),
3040
+ description: x().optional(),
3041
+ artwork: Ae.optional(),
3042
+ tags: z(x()).optional(),
3043
+ createdAtIso: x(),
3044
+ lastModifiedIso: x(),
3045
+ origin: J.optional(),
3046
+ isReadOnly: we(),
3047
+ parentId: x().optional(),
3048
+ items: z(xt)
3049
+ }), kt = R({
3050
+ id: x(),
3051
+ name: x(),
3052
+ createdAtIso: x(),
3053
+ lastModifiedIso: x(),
3054
+ isReadOnly: we(),
3055
+ artwork: Ae.optional(),
3056
+ itemCount: U(),
3057
+ totalDurationMs: U()
3058
+ }), It = z(kt);
370
3059
  export {
371
- b as FavoritesAPI,
372
- w as HttpAPI,
373
- p as LoggerAPI,
374
- R as MissingCapabilityError,
375
- E as NuclearAPI,
376
- C as NuclearPluginAPI,
377
- P as YtdlpAPI,
378
- Q as pickArtwork,
379
- k as useSetting
3060
+ Ne as DashboardAPI,
3061
+ Oe as FavoritesAPI,
3062
+ je as HttpAPI,
3063
+ Me as LoggerAPI,
3064
+ At as MissingCapabilityError,
3065
+ Be as NuclearAPI,
3066
+ wt as NuclearPluginAPI,
3067
+ Fe as YtdlpAPI,
3068
+ St as pickArtwork,
3069
+ kt as playlistIndexEntrySchema,
3070
+ It as playlistIndexSchema,
3071
+ Ct as playlistSchema,
3072
+ Tt as useSetting
380
3073
  };