@nordicsemiconductor/pc-nrfconnect-shared 213.0.0 → 214.0.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.
Files changed (101) hide show
  1. package/Changelog.md +21 -0
  2. package/nrfutil/collectingResultParser.ts +82 -0
  3. package/nrfutil/common.ts +41 -0
  4. package/nrfutil/device/batch.ts +25 -62
  5. package/nrfutil/device/batchTypes.ts +8 -46
  6. package/nrfutil/device/boardController.ts +2 -2
  7. package/nrfutil/device/common.ts +6 -10
  8. package/nrfutil/device/deviceInfo.ts +4 -3
  9. package/nrfutil/device/erase.ts +4 -3
  10. package/nrfutil/device/getBoardControllerConfig.ts +2 -2
  11. package/nrfutil/device/getBoardControllerVersion.ts +2 -2
  12. package/nrfutil/device/getCoreInfo.ts +4 -3
  13. package/nrfutil/device/getFwInfo.ts +4 -3
  14. package/nrfutil/device/getProtectionStatus.ts +4 -3
  15. package/nrfutil/device/list.ts +5 -10
  16. package/nrfutil/device/logLibVersions.ts +8 -69
  17. package/nrfutil/device/program.ts +60 -66
  18. package/nrfutil/device/recover.ts +4 -3
  19. package/nrfutil/device/reset.ts +7 -13
  20. package/nrfutil/device/setMcuState.ts +2 -2
  21. package/nrfutil/device/setProtectionStatus.ts +4 -3
  22. package/nrfutil/device/xRead.ts +26 -28
  23. package/nrfutil/index.ts +2 -3
  24. package/nrfutil/modules.ts +10 -15
  25. package/nrfutil/sandbox.ts +162 -327
  26. package/nrfutil/sandboxTypes.ts +4 -43
  27. package/nrfutil/{jlinkVersion.test.ts → version/jlinkVersion.test.ts} +1 -1
  28. package/nrfutil/{jlinkVersion.ts → version/jlinkVersion.ts} +2 -2
  29. package/nrfutil/{moduleVersion.ts → version/moduleVersion.ts} +44 -7
  30. package/package.json +1 -1
  31. package/scripts/nordic-publish.js +4 -2
  32. package/scripts/nordic-publish.ts +44 -7
  33. package/src/logging/index.ts +0 -1
  34. package/src/utils/systemReport.ts +4 -1
  35. package/typings/generated/nrfutil/collectingResultParser.d.ts +19 -0
  36. package/typings/generated/nrfutil/collectingResultParser.d.ts.map +1 -0
  37. package/typings/generated/nrfutil/common.d.ts +6 -0
  38. package/typings/generated/nrfutil/common.d.ts.map +1 -0
  39. package/typings/generated/nrfutil/device/__mocks__/device.d.ts +1 -1
  40. package/typings/generated/nrfutil/device/batch.d.ts +6 -4
  41. package/typings/generated/nrfutil/device/batch.d.ts.map +1 -1
  42. package/typings/generated/nrfutil/device/batchTypes.d.ts +8 -30
  43. package/typings/generated/nrfutil/device/batchTypes.d.ts.map +1 -1
  44. package/typings/generated/nrfutil/device/boardController.d.ts +2 -2
  45. package/typings/generated/nrfutil/device/boardController.d.ts.map +1 -1
  46. package/typings/generated/nrfutil/device/common.d.ts +4 -3
  47. package/typings/generated/nrfutil/device/common.d.ts.map +1 -1
  48. package/typings/generated/nrfutil/device/device.d.ts +14 -14
  49. package/typings/generated/nrfutil/device/deviceInfo.d.ts +2 -2
  50. package/typings/generated/nrfutil/device/deviceInfo.d.ts.map +1 -1
  51. package/typings/generated/nrfutil/device/erase.d.ts +2 -2
  52. package/typings/generated/nrfutil/device/erase.d.ts.map +1 -1
  53. package/typings/generated/nrfutil/device/getBoardControllerConfig.d.ts +2 -2
  54. package/typings/generated/nrfutil/device/getBoardControllerConfig.d.ts.map +1 -1
  55. package/typings/generated/nrfutil/device/getBoardControllerVersion.d.ts +2 -2
  56. package/typings/generated/nrfutil/device/getBoardControllerVersion.d.ts.map +1 -1
  57. package/typings/generated/nrfutil/device/getCoreInfo.d.ts +2 -2
  58. package/typings/generated/nrfutil/device/getCoreInfo.d.ts.map +1 -1
  59. package/typings/generated/nrfutil/device/getFwInfo.d.ts +2 -2
  60. package/typings/generated/nrfutil/device/getFwInfo.d.ts.map +1 -1
  61. package/typings/generated/nrfutil/device/getProtectionStatus.d.ts +2 -2
  62. package/typings/generated/nrfutil/device/getProtectionStatus.d.ts.map +1 -1
  63. package/typings/generated/nrfutil/device/list.d.ts.map +1 -1
  64. package/typings/generated/nrfutil/device/logLibVersions.d.ts +2 -2
  65. package/typings/generated/nrfutil/device/logLibVersions.d.ts.map +1 -1
  66. package/typings/generated/nrfutil/device/program.d.ts +13 -13
  67. package/typings/generated/nrfutil/device/program.d.ts.map +1 -1
  68. package/typings/generated/nrfutil/device/recover.d.ts +2 -2
  69. package/typings/generated/nrfutil/device/recover.d.ts.map +1 -1
  70. package/typings/generated/nrfutil/device/reset.d.ts +2 -2
  71. package/typings/generated/nrfutil/device/reset.d.ts.map +1 -1
  72. package/typings/generated/nrfutil/device/setMcuState.d.ts +2 -2
  73. package/typings/generated/nrfutil/device/setMcuState.d.ts.map +1 -1
  74. package/typings/generated/nrfutil/device/setProtectionStatus.d.ts +2 -2
  75. package/typings/generated/nrfutil/device/setProtectionStatus.d.ts.map +1 -1
  76. package/typings/generated/nrfutil/device/xRead.d.ts +9 -2
  77. package/typings/generated/nrfutil/device/xRead.d.ts.map +1 -1
  78. package/typings/generated/nrfutil/index.d.ts +2 -3
  79. package/typings/generated/nrfutil/index.d.ts.map +1 -1
  80. package/typings/generated/nrfutil/modules.d.ts +1 -1
  81. package/typings/generated/nrfutil/modules.d.ts.map +1 -1
  82. package/typings/generated/nrfutil/sandbox.d.ts +27 -35
  83. package/typings/generated/nrfutil/sandbox.d.ts.map +1 -1
  84. package/typings/generated/nrfutil/sandboxTypes.d.ts +4 -29
  85. package/typings/generated/nrfutil/sandboxTypes.d.ts.map +1 -1
  86. package/typings/generated/nrfutil/{jlinkVersion.d.ts → version/jlinkVersion.d.ts} +1 -1
  87. package/typings/generated/nrfutil/version/jlinkVersion.d.ts.map +1 -0
  88. package/typings/generated/nrfutil/version/jlinkVersion.test.d.ts.map +1 -0
  89. package/typings/generated/nrfutil/version/moduleVersion.d.ts +40 -0
  90. package/typings/generated/nrfutil/version/moduleVersion.d.ts.map +1 -0
  91. package/typings/generated/nrfutil/version/version.d.ts.map +1 -0
  92. package/typings/generated/src/logging/index.d.ts.map +1 -1
  93. package/typings/generated/src/utils/systemReport.d.ts.map +1 -1
  94. package/typings/generated/nrfutil/jlinkVersion.d.ts.map +0 -1
  95. package/typings/generated/nrfutil/jlinkVersion.test.d.ts.map +0 -1
  96. package/typings/generated/nrfutil/moduleVersion.d.ts +0 -12
  97. package/typings/generated/nrfutil/moduleVersion.d.ts.map +0 -1
  98. package/typings/generated/nrfutil/version.d.ts.map +0 -1
  99. /package/nrfutil/{version.ts → version/version.ts} +0 -0
  100. /package/typings/generated/nrfutil/{jlinkVersion.test.d.ts → version/jlinkVersion.test.d.ts} +0 -0
  101. /package/typings/generated/nrfutil/{version.d.ts → version/version.d.ts} +0 -0
@@ -4,8 +4,6 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
- import type { DiscriminatedVersion } from './version';
8
-
9
7
  export interface BackgroundTask<T> {
10
8
  onError: (error: Error, pid?: number) => void;
11
9
  onData: (data: T) => void;
@@ -13,12 +11,6 @@ export interface BackgroundTask<T> {
13
11
 
14
12
  export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
15
13
 
16
- export type FeatureClassification =
17
- | 'nrf-internal-confidential'
18
- | 'nrf-internal'
19
- | 'nrf-external-confidential'
20
- | 'nrf-external';
21
-
22
14
  export type Task<T = undefined | null> = {
23
15
  id: string;
24
16
  description: string;
@@ -128,38 +120,7 @@ export type LogMessage = {
128
120
  message: string;
129
121
  };
130
122
 
131
- type Plugin = DiscriminatedVersion & {
132
- dependencies: TopLevelDependency[];
133
- name: string;
134
- };
135
-
136
- type DependencyWithoutVersion = {
137
- name: string;
138
- description?: string;
139
- dependencies?: Dependency[];
140
- expectedVersion?: DiscriminatedVersion;
141
- };
142
- type DependencyWithVersion = DiscriminatedVersion & DependencyWithoutVersion;
143
-
144
- export type Dependency = DependencyWithoutVersion | DependencyWithVersion;
145
-
146
- export type TopLevelDependency = Dependency & {
147
- classification?: FeatureClassification;
148
- plugins?: Plugin[];
149
- };
150
-
151
- export type ModuleVersion = {
152
- build_timestamp: string;
153
- classification: FeatureClassification;
154
- commit_date: string;
155
- commit_hash: string;
156
- dependencies: TopLevelDependency[];
157
- host: string;
158
- name: string;
159
- version: string;
160
- };
161
-
162
- export const hasVersion = (
163
- dependency?: Dependency | DiscriminatedVersion
164
- ): dependency is DependencyWithVersion | DiscriminatedVersion =>
165
- dependency != null && 'version' in dependency && dependency.version != null;
123
+ export type OnProgress = (progress: Progress, task?: Task) => void;
124
+ export type OnTaskBegin = (taskBegin: TaskBegin) => void;
125
+ export type OnTaskEnd<T> = (taskEnd: TaskEnd<T>) => void;
126
+ export type OnLog = (message: LogMessage, pid: number | undefined) => void;
@@ -11,7 +11,7 @@ import {
11
11
  hasExpectedVersionFormat,
12
12
  strippedVersionName,
13
13
  } from './jlinkVersion';
14
- import type { Dependency, ModuleVersion } from './sandboxTypes';
14
+ import type { Dependency, ModuleVersion } from './moduleVersion';
15
15
 
16
16
  // Note: In this test the space at the end of 'JLink_V7.96 ' or '7.96 ' is
17
17
  // intentional because it is also reported like that by nrfutil.
@@ -6,12 +6,12 @@
6
6
 
7
7
  import semver from 'semver';
8
8
 
9
- import { findDependency } from './moduleVersion';
10
9
  import {
11
10
  type Dependency,
11
+ findDependency,
12
12
  hasVersion,
13
13
  type ModuleVersion,
14
- } from './sandboxTypes';
14
+ } from './moduleVersion';
15
15
  import {
16
16
  type DiscriminatedVersion,
17
17
  isStringVersion,
@@ -4,13 +4,50 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
- import { isLauncher, packageJsonApp } from '../src/utils/packageJson';
8
- import {
9
- type Dependency,
10
- hasVersion,
11
- type TopLevelDependency,
12
- } from './sandboxTypes';
13
- import { versionToString } from './version';
7
+ import { isLauncher, packageJsonApp } from '../../src/utils/packageJson';
8
+ import { type DiscriminatedVersion, versionToString } from './version';
9
+
10
+ type FeatureClassification =
11
+ | 'nrf-internal-confidential'
12
+ | 'nrf-internal'
13
+ | 'nrf-external-confidential'
14
+ | 'nrf-external';
15
+
16
+ type Plugin = DiscriminatedVersion & {
17
+ dependencies: TopLevelDependency[];
18
+ name: string;
19
+ };
20
+
21
+ type DependencyWithoutVersion = {
22
+ name: string;
23
+ description?: string;
24
+ dependencies?: Dependency[];
25
+ expectedVersion?: DiscriminatedVersion;
26
+ };
27
+ type DependencyWithVersion = DiscriminatedVersion & DependencyWithoutVersion;
28
+
29
+ export type Dependency = DependencyWithoutVersion | DependencyWithVersion;
30
+
31
+ type TopLevelDependency = Dependency & {
32
+ classification?: FeatureClassification;
33
+ plugins?: Plugin[];
34
+ };
35
+
36
+ export type ModuleVersion = {
37
+ build_timestamp: string;
38
+ classification: FeatureClassification;
39
+ commit_date: string;
40
+ commit_hash: string;
41
+ dependencies: TopLevelDependency[];
42
+ host: string;
43
+ name: string;
44
+ version: string;
45
+ };
46
+
47
+ export const hasVersion = (
48
+ dependency?: Dependency | DiscriminatedVersion
49
+ ): dependency is DependencyWithVersion | DiscriminatedVersion =>
50
+ dependency != null && 'version' in dependency && dependency.version != null;
14
51
 
15
52
  export const describeVersion = (dependencyOrVersion?: Dependency | string) => {
16
53
  if (typeof dependencyOrVersion === 'string') return dependencyOrVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "213.0.0",
3
+ "version": "214.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,10 @@ Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,s=>{let
30
30
  `+xe)+`
31
31
  `+a+"}":"{"+o.join(",")+"}",xe=a,i;default:}}Y0.exports=function(t,e,r){var n;if(xe="",Ln="",typeof r=="number")for(n=0;n<r;n+=1)Ln+=" ";else typeof r=="string"&&(Ln=r);if(Ot=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("JSON.stringify");return qn("",{"":t})}});var Q0=A(Es=>{"use strict";Es.parse=K0();Es.stringify=X0()});var tu=A((vD,eu)=>{var Vp=typeof JSON<"u"?JSON:Q0();eu.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=e.cmp&&function(n){return function(i){return function(s,a){var o={key:s,value:i[s]},u={key:a,value:i[a]};return n(o,u)}}}(e.cmp);return function n(i){if(typeof i!="object"||i===null)return Vp.stringify(i);if(Up(i)){for(var s=[],a=0;a<i.length;a++)s.push(n(i[a]));return"["+s.join(",")+"]"}else{for(var o=Hp(i).sort(r&&r(i)),s=[],a=0;a<o.length;a++){var u=o[a];s.push(n(u)+":"+n(i[u]))}return"{"+s.join(",")+"}"}}(t)};var Up=Array.isArray||function(t){return{}.toString.call(t)==="[object Array]"},Hp=Object.keys||function(t){var e=Object.prototype.hasOwnProperty||function(){return!0},r=[];for(var n in t)e.call(t,n)&&r.push(n);return r}});var iu=A((bD,nu)=>{var zp=require("crypto").createHash,ru=require("buffer").Buffer,Wp=tu();nu.exports=function(e,r,n){return e=typeof e=="string"||ru.isBuffer(e)?e:Wp(e),zp(r||"sha1").update(e,ru.isBuffer(e)?null:"utf8").digest(n||"hex")}});var au=A((xD,su)=>{function Gp(t){return function(e){return e?.[t]}}su.exports=Gp});var Mn=A((wD,ou)=>{var Jp=Array.isArray;ou.exports=Jp});var cu=A((ID,uu)=>{var Kp=typeof global=="object"&&global&&global.Object===Object&&global;uu.exports=Kp});var Vn=A((SD,lu)=>{var Yp=cu(),Xp=typeof self=="object"&&self&&self.Object===Object&&self,Qp=Yp||Xp||Function("return this")();lu.exports=Qp});var Un=A((TD,du)=>{var eA=Vn(),tA=eA.Symbol;du.exports=tA});var Au=A((OD,pu)=>{var fu=Un(),hu=Object.prototype,rA=hu.hasOwnProperty,nA=hu.toString,en=fu?fu.toStringTag:void 0;function iA(t){var e=rA.call(t,en),r=t[en];try{t[en]=void 0;var n=!0}catch{}var i=nA.call(t);return n&&(e?t[en]=r:delete t[en]),i}pu.exports=iA});var Eu=A((kD,Fu)=>{var sA=Object.prototype,aA=sA.toString;function oA(t){return aA.call(t)}Fu.exports=oA});var ms=A((ND,gu)=>{var mu=Un(),uA=Au(),cA=Eu(),lA="[object Null]",dA="[object Undefined]",Cu=mu?mu.toStringTag:void 0;function fA(t){return t==null?t===void 0?dA:lA:Cu&&Cu in Object(t)?uA(t):cA(t)}gu.exports=fA});var _u=A((RD,Du)=>{function hA(t){return t!=null&&typeof t=="object"}Du.exports=hA});var Hn=A((PD,Bu)=>{var pA=ms(),AA=_u(),FA="[object Symbol]";function EA(t){return typeof t=="symbol"||AA(t)&&pA(t)==FA}Bu.exports=EA});var Cs=A(($D,yu)=>{var mA=Mn(),CA=Hn(),gA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,DA=/^\w*$/;function _A(t,e){if(mA(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||CA(t)?!0:DA.test(t)||!gA.test(t)||e!=null&&t in Object(e)}yu.exports=_A});var gs=A((ZD,vu)=>{function BA(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}vu.exports=BA});var xu=A((jD,bu)=>{var yA=ms(),vA=gs(),bA="[object AsyncFunction]",xA="[object Function]",wA="[object GeneratorFunction]",IA="[object Proxy]";function SA(t){if(!vA(t))return!1;var e=yA(t);return e==xA||e==wA||e==bA||e==IA}bu.exports=SA});var Iu=A((LD,wu)=>{var TA=Vn(),OA=TA["__core-js_shared__"];wu.exports=OA});var Ou=A((qD,Tu)=>{var Ds=Iu(),Su=function(){var t=/[^.]+$/.exec(Ds&&Ds.keys&&Ds.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function kA(t){return!!Su&&Su in t}Tu.exports=kA});var Nu=A((MD,ku)=>{var NA=Function.prototype,RA=NA.toString;function PA(t){if(t!=null){try{return RA.call(t)}catch{}try{return t+""}catch{}}return""}ku.exports=PA});var Pu=A((VD,Ru)=>{var $A=xu(),ZA=Ou(),jA=gs(),LA=Nu(),qA=/[\\^$.*+?()[\]{}|]/g,MA=/^\[object .+?Constructor\]$/,VA=Function.prototype,UA=Object.prototype,HA=VA.toString,zA=UA.hasOwnProperty,WA=RegExp("^"+HA.call(zA).replace(qA,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function GA(t){if(!jA(t)||ZA(t))return!1;var e=$A(t)?WA:MA;return e.test(LA(t))}Ru.exports=GA});var Zu=A((UD,$u)=>{function JA(t,e){return t?.[e]}$u.exports=JA});var _s=A((HD,ju)=>{var KA=Pu(),YA=Zu();function XA(t,e){var r=YA(t,e);return KA(r)?r:void 0}ju.exports=XA});var tn=A((zD,Lu)=>{var QA=_s(),eF=QA(Object,"create");Lu.exports=eF});var Vu=A((WD,Mu)=>{var qu=tn();function tF(){this.__data__=qu?qu(null):{},this.size=0}Mu.exports=tF});var Hu=A((GD,Uu)=>{function rF(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}Uu.exports=rF});var Wu=A((JD,zu)=>{var nF=tn(),iF="__lodash_hash_undefined__",sF=Object.prototype,aF=sF.hasOwnProperty;function oF(t){var e=this.__data__;if(nF){var r=e[t];return r===iF?void 0:r}return aF.call(e,t)?e[t]:void 0}zu.exports=oF});var Ju=A((KD,Gu)=>{var uF=tn(),cF=Object.prototype,lF=cF.hasOwnProperty;function dF(t){var e=this.__data__;return uF?e[t]!==void 0:lF.call(e,t)}Gu.exports=dF});var Yu=A((YD,Ku)=>{var fF=tn(),hF="__lodash_hash_undefined__";function pF(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fF&&e===void 0?hF:e,this}Ku.exports=pF});var Qu=A((XD,Xu)=>{var AF=Vu(),FF=Hu(),EF=Wu(),mF=Ju(),CF=Yu();function gr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}gr.prototype.clear=AF;gr.prototype.delete=FF;gr.prototype.get=EF;gr.prototype.has=mF;gr.prototype.set=CF;Xu.exports=gr});var tc=A((QD,ec)=>{function gF(){this.__data__=[],this.size=0}ec.exports=gF});var nc=A((e_,rc)=>{function DF(t,e){return t===e||t!==t&&e!==e}rc.exports=DF});var rn=A((t_,ic)=>{var _F=nc();function BF(t,e){for(var r=t.length;r--;)if(_F(t[r][0],e))return r;return-1}ic.exports=BF});var ac=A((r_,sc)=>{var yF=rn(),vF=Array.prototype,bF=vF.splice;function xF(t){var e=this.__data__,r=yF(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():bF.call(e,r,1),--this.size,!0}sc.exports=xF});var uc=A((n_,oc)=>{var wF=rn();function IF(t){var e=this.__data__,r=wF(e,t);return r<0?void 0:e[r][1]}oc.exports=IF});var lc=A((i_,cc)=>{var SF=rn();function TF(t){return SF(this.__data__,t)>-1}cc.exports=TF});var fc=A((s_,dc)=>{var OF=rn();function kF(t,e){var r=this.__data__,n=OF(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}dc.exports=kF});var pc=A((a_,hc)=>{var NF=tc(),RF=ac(),PF=uc(),$F=lc(),ZF=fc();function Dr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Dr.prototype.clear=NF;Dr.prototype.delete=RF;Dr.prototype.get=PF;Dr.prototype.has=$F;Dr.prototype.set=ZF;hc.exports=Dr});var Fc=A((o_,Ac)=>{var jF=_s(),LF=Vn(),qF=jF(LF,"Map");Ac.exports=qF});var Cc=A((u_,mc)=>{var Ec=Qu(),MF=pc(),VF=Fc();function UF(){this.size=0,this.__data__={hash:new Ec,map:new(VF||MF),string:new Ec}}mc.exports=UF});var Dc=A((c_,gc)=>{function HF(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}gc.exports=HF});var nn=A((l_,_c)=>{var zF=Dc();function WF(t,e){var r=t.__data__;return zF(e)?r[typeof e=="string"?"string":"hash"]:r.map}_c.exports=WF});var yc=A((d_,Bc)=>{var GF=nn();function JF(t){var e=GF(this,t).delete(t);return this.size-=e?1:0,e}Bc.exports=JF});var bc=A((f_,vc)=>{var KF=nn();function YF(t){return KF(this,t).get(t)}vc.exports=YF});var wc=A((h_,xc)=>{var XF=nn();function QF(t){return XF(this,t).has(t)}xc.exports=QF});var Sc=A((p_,Ic)=>{var eE=nn();function tE(t,e){var r=eE(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}Ic.exports=tE});var Oc=A((A_,Tc)=>{var rE=Cc(),nE=yc(),iE=bc(),sE=wc(),aE=Sc();function _r(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_r.prototype.clear=rE;_r.prototype.delete=nE;_r.prototype.get=iE;_r.prototype.has=sE;_r.prototype.set=aE;Tc.exports=_r});var Rc=A((F_,Nc)=>{var kc=Oc(),oE="Expected a function";function Bs(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(oE);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(Bs.Cache||kc),r}Bs.Cache=kc;Nc.exports=Bs});var $c=A((E_,Pc)=>{var uE=Rc(),cE=500;function lE(t){var e=uE(t,function(n){return r.size===cE&&r.clear(),n}),r=e.cache;return e}Pc.exports=lE});var jc=A((m_,Zc)=>{var dE=$c(),fE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hE=/\\(\\)?/g,pE=dE(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fE,function(r,n,i,s){e.push(i?s.replace(hE,"$1"):n||r)}),e});Zc.exports=pE});var qc=A((C_,Lc)=>{function AE(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}Lc.exports=AE});var Wc=A((g_,zc)=>{var Mc=Un(),FE=qc(),EE=Mn(),mE=Hn(),CE=1/0,Vc=Mc?Mc.prototype:void 0,Uc=Vc?Vc.toString:void 0;function Hc(t){if(typeof t=="string")return t;if(EE(t))return FE(t,Hc)+"";if(mE(t))return Uc?Uc.call(t):"";var e=t+"";return e=="0"&&1/t==-CE?"-0":e}zc.exports=Hc});var Jc=A((D_,Gc)=>{var gE=Wc();function DE(t){return t==null?"":gE(t)}Gc.exports=DE});var Yc=A((__,Kc)=>{var _E=Mn(),BE=Cs(),yE=jc(),vE=Jc();function bE(t,e){return _E(t)?t:BE(t,e)?[t]:yE(vE(t))}Kc.exports=bE});var ys=A((B_,Xc)=>{var xE=Hn(),wE=1/0;function IE(t){if(typeof t=="string"||xE(t))return t;var e=t+"";return e=="0"&&1/t==-wE?"-0":e}Xc.exports=IE});var el=A((y_,Qc)=>{var SE=Yc(),TE=ys();function OE(t,e){e=SE(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[TE(e[r++])];return r&&r==n?t:void 0}Qc.exports=OE});var rl=A((v_,tl)=>{var kE=el();function NE(t){return function(e){return kE(e,t)}}tl.exports=NE});var il=A((b_,nl)=>{var RE=au(),PE=rl(),$E=Cs(),ZE=ys();function jE(t){return $E(t)?RE(ZE(t)):PE(t)}nl.exports=jE});var dn=A(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.getParsedType=te.ZodParsedType=te.objectUtil=te.util=void 0;var Cl;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(let o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(let a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Cl=te.util||(te.util={}));var Um;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Um=te.objectUtil||(te.objectUtil={}));te.ZodParsedType=Cl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Hm=t=>{switch(typeof t){case"undefined":return te.ZodParsedType.undefined;case"string":return te.ZodParsedType.string;case"number":return isNaN(t)?te.ZodParsedType.nan:te.ZodParsedType.number;case"boolean":return te.ZodParsedType.boolean;case"function":return te.ZodParsedType.function;case"bigint":return te.ZodParsedType.bigint;case"symbol":return te.ZodParsedType.symbol;case"object":return Array.isArray(t)?te.ZodParsedType.array:t===null?te.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?te.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?te.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?te.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?te.ZodParsedType.date:te.ZodParsedType.object;default:return te.ZodParsedType.unknown}};te.getParsedType=Hm});var Qn=A(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.ZodError=Et.quotelessJson=Et.ZodIssueCode=void 0;var gl=dn();Et.ZodIssueCode=gl.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var zm=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Et.quotelessJson=zm;var fn=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,gl.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Et.ZodError=fn;fn.create=t=>new fn(t)});var Ts=A(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});var Gt=dn(),he=Qn(),Wm=(t,e)=>{let r;switch(t.code){case he.ZodIssueCode.invalid_type:t.received===Gt.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case he.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Gt.util.jsonStringifyReplacer)}`;break;case he.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Gt.util.joinValues(t.keys,", ")}`;break;case he.ZodIssueCode.invalid_union:r="Invalid input";break;case he.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Gt.util.joinValues(t.options)}`;break;case he.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Gt.util.joinValues(t.options)}, received '${t.received}'`;break;case he.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case he.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case he.ZodIssueCode.invalid_date:r="Invalid date";break;case he.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Gt.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case he.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case he.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case he.ZodIssueCode.custom:r="Invalid input";break;case he.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case he.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case he.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Gt.util.assertNever(t)}return{message:r}};Ss.default=Wm});var ei=A(Ge=>{"use strict";var Gm=Ge&&Ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getErrorMap=Ge.setErrorMap=Ge.defaultErrorMap=void 0;var Dl=Gm(Ts());Ge.defaultErrorMap=Dl.default;var _l=Dl.default;function Jm(t){_l=t}Ge.setErrorMap=Jm;function Km(){return _l}Ge.getErrorMap=Km});var ks=A(Q=>{"use strict";var Ym=Q&&Q.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Q,"__esModule",{value:!0});Q.isAsync=Q.isValid=Q.isDirty=Q.isAborted=Q.OK=Q.DIRTY=Q.INVALID=Q.ParseStatus=Q.addIssueToContext=Q.EMPTY_PATH=Q.makeIssue=void 0;var Xm=ei(),Bl=Ym(Ts()),Qm=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)o=c(a,{data:e,defaultError:o}).message;return{...i,path:s,message:o}};Q.makeIssue=Qm;Q.EMPTY_PATH=[];function e2(t,e){let r=(0,Xm.getErrorMap)(),n=(0,Q.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Bl.default?void 0:Bl.default].filter(i=>!!i)});t.common.issues.push(n)}Q.addIssueToContext=e2;var Os=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Q.INVALID;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let s=await i.key,a=await i.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Q.INVALID;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}};Q.ParseStatus=Os;Q.INVALID=Object.freeze({status:"aborted"});var t2=t=>({status:"dirty",value:t});Q.DIRTY=t2;var r2=t=>({status:"valid",value:t});Q.OK=r2;var n2=t=>t.status==="aborted";Q.isAborted=n2;var i2=t=>t.status==="dirty";Q.isDirty=i2;var s2=t=>t.status==="valid";Q.isValid=s2;var a2=t=>typeof Promise<"u"&&t instanceof Promise;Q.isAsync=a2});var vl=A(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0})});var bl=A(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.errorUtil=void 0;var o2;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(o2=hn.errorUtil||(hn.errorUtil={}))});var Zl=A(d=>{"use strict";var ri=d&&d.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},wl=d&&d.__classPrivateFieldSet||function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},pn,An;Object.defineProperty(d,"__esModule",{value:!0});d.boolean=d.bigint=d.array=d.any=d.coerce=d.ZodFirstPartyTypeKind=d.late=d.ZodSchema=d.Schema=d.custom=d.ZodReadonly=d.ZodPipeline=d.ZodBranded=d.BRAND=d.ZodNaN=d.ZodCatch=d.ZodDefault=d.ZodNullable=d.ZodOptional=d.ZodTransformer=d.ZodEffects=d.ZodPromise=d.ZodNativeEnum=d.ZodEnum=d.ZodLiteral=d.ZodLazy=d.ZodFunction=d.ZodSet=d.ZodMap=d.ZodRecord=d.ZodTuple=d.ZodIntersection=d.ZodDiscriminatedUnion=d.ZodUnion=d.ZodObject=d.ZodArray=d.ZodVoid=d.ZodNever=d.ZodUnknown=d.ZodAny=d.ZodNull=d.ZodUndefined=d.ZodSymbol=d.ZodDate=d.ZodBoolean=d.ZodBigInt=d.ZodNumber=d.ZodString=d.datetimeRegex=d.ZodType=void 0;d.NEVER=d.void=d.unknown=d.union=d.undefined=d.tuple=d.transformer=d.symbol=d.string=d.strictObject=d.set=d.record=d.promise=d.preprocess=d.pipeline=d.ostring=d.optional=d.onumber=d.oboolean=d.object=d.number=d.nullable=d.null=d.never=d.nativeEnum=d.nan=d.map=d.literal=d.lazy=d.intersection=d.instanceof=d.function=d.enum=d.effect=d.discriminatedUnion=d.date=void 0;var ti=ei(),S=bl(),p=ks(),_=dn(),D=Qn(),$e=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xl=(t,e)=>{if((0,p.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new D.ZodError(t.common.issues);return this._error=r,this._error}}};function q(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{var u,c;let{message:l}=t;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(u=l??n)!==null&&u!==void 0?u:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(c=l??r)!==null&&c!==void 0?c:o.defaultError}},description:i}}var M=class{constructor(e){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)}get description(){return this._def.description}_getType(e){return(0,_.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,_.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,_.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,p.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,_.getParsedType)(e)},s=this._parseSync({data:e,path:i.path,parent:i});return xl(i,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,_.getParsedType)(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await((0,p.isAsync)(i)?i:Promise.resolve(i));return xl(n,s)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let a=e(i),o=()=>s.addIssue({code:D.ZodIssueCode.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Se({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Pe.create(this,this._def)}nullable(){return Ke.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ut.create(this,this._def)}promise(){return gt.create(this,this._def)}or(e){return tr.create([this,e],this._def)}and(e){return rr.create(this,e,this._def)}transform(e){return new Se({...q(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new or({...q(this._def),innerType:this,defaultValue:r,typeName:P.ZodDefault})}brand(){return new Fn({typeName:P.ZodBranded,type:this,...q(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ur({...q(this._def),innerType:this,catchValue:r,typeName:P.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return En.create(this,e)}readonly(){return cr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};d.ZodType=M;d.Schema=M;d.ZodSchema=M;var u2=/^c[^\s-]{8,}$/i,c2=/^[0-9a-z]+$/,l2=/^[0-9A-HJKMNP-TV-Z]{26}$/,d2=/^[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,f2=/^[a-z0-9_-]{21}$/i,h2=/^[-+]?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)?)??$/,p2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ns,F2=/^(?:(?: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])$/,E2=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,m2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Il="((\\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])))",C2=new RegExp(`^${Il}$`);function Sl(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function g2(t){return new RegExp(`^${Sl(t)}$`)}function Tl(t){let e=`${Il}T${Sl(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}d.datetimeRegex=Tl;function D2(t,e){return!!((e==="v4"||!e)&&F2.test(t)||(e==="v6"||!e)&&E2.test(t))}var mt=class t extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.ZodParsedType.string){let s=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(s,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.string,received:s.parsedType}),p.INVALID}let n=new p.ParseStatus,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,o=e.data.length<s.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")p2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"email",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Ns||(Ns=new RegExp(A2,"u")),Ns.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"emoji",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")d2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"uuid",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")f2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"nanoid",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")u2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"cuid",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")c2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"cuid2",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")l2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"ulid",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"url",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"regex",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Tl(s).test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?C2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?g2(s).test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?h2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"duration",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?D2(e.data,s.version)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"ip",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?m2.test(e.data)||(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{validation:"base64",code:D.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):_.util.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:D.ZodIssueCode.invalid_string,...S.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...S.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...S.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...S.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...S.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...S.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...S.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...S.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...S.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...S.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,S.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};d.ZodString=mt;mt.create=t=>{var e;return new mt({checks:[],typeName:P.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...q(t)})};function _2(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}var Jt=class t extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.ZodParsedType.number){let s=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(s,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.number,received:s.parsedType}),p.INVALID}let n,i=new p.ParseStatus;for(let s of this._def.checks)s.kind==="int"?_.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?_2(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.not_finite,message:s.message}),i.dirty()):_.util.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,S.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,S.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,S.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,S.errorUtil.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:S.errorUtil.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:S.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:S.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};d.ZodNumber=Jt;Jt.create=t=>new Jt({checks:[],typeName:P.ZodNumber,coerce:t?.coerce||!1,...q(t)});var Kt=class t extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==_.ZodParsedType.bigint){let s=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(s,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.bigint,received:s.parsedType}),p.INVALID}let n,i=new p.ParseStatus;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):_.util.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,S.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,S.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,S.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,S.errorUtil.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:S.errorUtil.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:S.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};d.ZodBigInt=Kt;Kt.create=t=>{var e;return new Kt({checks:[],typeName:P.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...q(t)})};var Yt=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.boolean,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};d.ZodBoolean=Yt;Yt.create=t=>new Yt({typeName:P.ZodBoolean,coerce:t?.coerce||!1,...q(t)});var Xt=class t extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.ZodParsedType.date){let s=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(s,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.date,received:s.parsedType}),p.INVALID}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(s,{code:D.ZodIssueCode.invalid_date}),p.INVALID}let n=new p.ParseStatus,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),(0,p.addIssueToContext)(i,{code:D.ZodIssueCode.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):_.util.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:S.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:S.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};d.ZodDate=Xt;Xt.create=t=>new Xt({checks:[],coerce:t?.coerce||!1,typeName:P.ZodDate,...q(t)});var Or=class extends M{_parse(e){if(this._getType(e)!==_.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.symbol,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};d.ZodSymbol=Or;Or.create=t=>new Or({typeName:P.ZodSymbol,...q(t)});var Qt=class extends M{_parse(e){if(this._getType(e)!==_.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.undefined,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};d.ZodUndefined=Qt;Qt.create=t=>new Qt({typeName:P.ZodUndefined,...q(t)});var er=class extends M{_parse(e){if(this._getType(e)!==_.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.null,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};d.ZodNull=er;er.create=t=>new er({typeName:P.ZodNull,...q(t)});var Ct=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,p.OK)(e.data)}};d.ZodAny=Ct;Ct.create=t=>new Ct({typeName:P.ZodAny,...q(t)});var ot=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,p.OK)(e.data)}};d.ZodUnknown=ot;ot.create=t=>new ot({typeName:P.ZodUnknown,...q(t)});var Ve=class extends M{_parse(e){let r=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.never,received:r.parsedType}),p.INVALID}};d.ZodNever=Ve;Ve.create=t=>new Ve({typeName:P.ZodNever,...q(t)});var kr=class extends M{_parse(e){if(this._getType(e)!==_.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.void,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};d.ZodVoid=kr;kr.create=t=>new kr({typeName:P.ZodVoid,...q(t)});var ut=class t extends M{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==_.ZodParsedType.array)return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:r.parsedType}),p.INVALID;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(a||o)&&((0,p.addIssueToContext)(r,{code:a?D.ZodIssueCode.too_big:D.ZodIssueCode.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&((0,p.addIssueToContext)(r,{code:D.ZodIssueCode.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&((0,p.addIssueToContext)(r,{code:D.ZodIssueCode.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new $e(r,a,r.path,o)))).then(a=>p.ParseStatus.mergeArray(n,a));let s=[...r.data].map((a,o)=>i.type._parseSync(new $e(r,a,r.path,o)));return p.ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:S.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:S.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:S.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};d.ZodArray=ut;ut.create=(t,e)=>new ut({type:t,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...q(e)});function Tr(t){if(t instanceof De){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Pe.create(Tr(n))}return new De({...t._def,shape:()=>e})}else return t instanceof ut?new ut({...t._def,type:Tr(t.element)}):t instanceof Pe?Pe.create(Tr(t.unwrap())):t instanceof Ke?Ke.create(Tr(t.unwrap())):t instanceof Je?Je.create(t.items.map(e=>Tr(e))):t}var De=class t extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=_.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==_.ZodParsedType.object){let c=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(c,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:c.parsedType}),p.INVALID}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ve&&this._def.unknownKeys==="strip"))for(let c in i.data)a.includes(c)||o.push(c);let u=[];for(let c of a){let l=s[c],f=i.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new $e(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ve){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of o)u.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")o.length>0&&((0,p.addIssueToContext)(i,{code:D.ZodIssueCode.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of o){let f=i.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new $e(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of u){let f=await l.key,m=await l.value;c.push({key:f,value:m,alwaysSet:l.alwaysSet})}return c}).then(c=>p.ParseStatus.mergeObjectSync(n,c)):p.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return S.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;let u=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=S.errorUtil.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return _.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return _.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return Tr(this)}partial(e){let r={};return _.util.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return _.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Pe;)s=s._def.innerType;r[n]=s}}),new t({...this._def,shape:()=>r})}keyof(){return Ol(_.util.objectKeys(this.shape))}};d.ZodObject=De;De.create=(t,e)=>new De({shape:()=>t,unknownKeys:"strip",catchall:Ve.create(),typeName:P.ZodObject,...q(e)});De.strictCreate=(t,e)=>new De({shape:()=>t,unknownKeys:"strict",catchall:Ve.create(),typeName:P.ZodObject,...q(e)});De.lazycreate=(t,e)=>new De({shape:t,unknownKeys:"strip",catchall:Ve.create(),typeName:P.ZodObject,...q(e)});var tr=class extends M{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(o=>new D.ZodError(o.ctx.common.issues));return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_union,unionErrors:a}),p.INVALID}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(u=>new D.ZodError(u));return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_union,unionErrors:o}),p.INVALID}}get options(){return this._def.options}};d.ZodUnion=tr;tr.create=(t,e)=>new tr({options:t,typeName:P.ZodUnion,...q(e)});var at=t=>t instanceof nr?at(t.schema):t instanceof Se?at(t.innerType()):t instanceof ir?[t.value]:t instanceof sr?t.options:t instanceof ar?_.util.objectValues(t.enum):t instanceof or?at(t._def.innerType):t instanceof Qt?[void 0]:t instanceof er?[null]:t instanceof Pe?[void 0,...at(t.unwrap())]:t instanceof Ke?[null,...at(t.unwrap())]:t instanceof Fn||t instanceof cr?at(t.unwrap()):t instanceof ur?at(t._def.innerType):[],ni=class t extends M{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==_.ZodParsedType.object)return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:r.parsedType}),p.INVALID;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):((0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let s of r){let a=at(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new t({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...q(n)})}};d.ZodDiscriminatedUnion=ni;function Rs(t,e){let r=(0,_.getParsedType)(t),n=(0,_.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===_.ZodParsedType.object&&n===_.ZodParsedType.object){let i=_.util.objectKeys(e),s=_.util.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(let o of s){let u=Rs(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(r===_.ZodParsedType.array&&n===_.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<t.length;s++){let a=t[s],o=e[s],u=Rs(a,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===_.ZodParsedType.date&&n===_.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var rr=class extends M{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(s,a)=>{if((0,p.isAborted)(s)||(0,p.isAborted)(a))return p.INVALID;let o=Rs(s.value,a.value);return o.valid?(((0,p.isDirty)(s)||(0,p.isDirty)(a))&&r.dirty(),{status:r.value,value:o.data}):((0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_intersection_types}),p.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};d.ZodIntersection=rr;rr.create=(t,e,r)=>new rr({left:t,right:e,typeName:P.ZodIntersection,...q(r)});var Je=class t extends M{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.ZodParsedType.array)return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:n.parsedType}),p.INVALID;if(n.data.length<this._def.items.length)return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new $e(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>p.ParseStatus.mergeArray(r,a)):p.ParseStatus.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};d.ZodTuple=Je;Je.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Je({items:t,typeName:P.ZodTuple,rest:null,...q(e)})};var ii=class t extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.ZodParsedType.object)return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:n.parsedType}),p.INVALID;let i=[],s=this._def.keyType,a=this._def.valueType;for(let o in n.data)i.push({key:s._parse(new $e(n,o,n.path,o)),value:a._parse(new $e(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?p.ParseStatus.mergeObjectAsync(r,i):p.ParseStatus.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof M?new t({keyType:e,valueType:r,typeName:P.ZodRecord,...q(n)}):new t({keyType:mt.create(),valueType:e,typeName:P.ZodRecord,...q(r)})}};d.ZodRecord=ii;var Nr=class extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.ZodParsedType.map)return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.map,received:n.parsedType}),p.INVALID;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([o,u],c)=>({key:i._parse(new $e(n,o,n.path,[c,"key"])),value:s._parse(new $e(n,u,n.path,[c,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of a){let c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return p.INVALID;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of a){let c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return p.INVALID;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}};d.ZodMap=Nr;Nr.create=(t,e,r)=>new Nr({valueType:e,keyType:t,typeName:P.ZodMap,...q(r)});var Rr=class t extends M{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.ZodParsedType.set)return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.set,received:n.parsedType}),p.INVALID;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&((0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&((0,p.addIssueToContext)(n,{code:D.ZodIssueCode.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let c=new Set;for(let l of u){if(l.status==="aborted")return p.INVALID;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let o=[...n.data.values()].map((u,c)=>s._parse(new $e(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:S.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:S.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};d.ZodSet=Rr;Rr.create=(t,e)=>new Rr({valueType:t,minSize:null,maxSize:null,typeName:P.ZodSet,...q(e)});var si=class t extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==_.ZodParsedType.function)return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.function,received:r.parsedType}),p.INVALID;function n(o,u){return(0,p.makeIssue)({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ti.getErrorMap)(),ti.defaultErrorMap].filter(c=>!!c),issueData:{code:D.ZodIssueCode.invalid_arguments,argumentsError:u}})}function i(o,u){return(0,p.makeIssue)({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ti.getErrorMap)(),ti.defaultErrorMap].filter(c=>!!c),issueData:{code:D.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof gt){let o=this;return(0,p.OK)(async function(...u){let c=new D.ZodError([]),l=await o._def.args.parseAsync(u,s).catch(F=>{throw c.addIssue(n(u,F)),c}),f=await Reflect.apply(a,this,l);return await o._def.returns._def.type.parseAsync(f,s).catch(F=>{throw c.addIssue(i(f,F)),c})})}else{let o=this;return(0,p.OK)(function(...u){let c=o._def.args.safeParse(u,s);if(!c.success)throw new D.ZodError([n(u,c.error)]);let l=Reflect.apply(a,this,c.data),f=o._def.returns.safeParse(l,s);if(!f.success)throw new D.ZodError([i(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Je.create(e).rest(ot.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Je.create([]).rest(ot.create()),returns:r||ot.create(),typeName:P.ZodFunction,...q(n)})}};d.ZodFunction=si;var nr=class extends M{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};d.ZodLazy=nr;nr.create=(t,e)=>new nr({getter:t,typeName:P.ZodLazy,...q(e)});var ir=class extends M{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(r,{received:r.data,code:D.ZodIssueCode.invalid_literal,expected:this._def.value}),p.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};d.ZodLiteral=ir;ir.create=(t,e)=>new ir({value:t,typeName:P.ZodLiteral,...q(e)});function Ol(t,e){return new sr({values:t,typeName:P.ZodEnum,...q(e)})}var sr=class t extends M{constructor(){super(...arguments),pn.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(r,{expected:_.util.joinValues(n),received:r.parsedType,code:D.ZodIssueCode.invalid_type}),p.INVALID}if(ri(this,pn,"f")||wl(this,pn,new Set(this._def.values),"f"),!ri(this,pn,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(r,{received:r.data,code:D.ZodIssueCode.invalid_enum_value,options:n}),p.INVALID}return(0,p.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};d.ZodEnum=sr;pn=new WeakMap;sr.create=Ol;var ar=class extends M{constructor(){super(...arguments),An.set(this,void 0)}_parse(e){let r=_.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.ZodParsedType.string&&n.parsedType!==_.ZodParsedType.number){let i=_.util.objectValues(r);return(0,p.addIssueToContext)(n,{expected:_.util.joinValues(i),received:n.parsedType,code:D.ZodIssueCode.invalid_type}),p.INVALID}if(ri(this,An,"f")||wl(this,An,new Set(_.util.getValidEnumValues(this._def.values)),"f"),!ri(this,An,"f").has(e.data)){let i=_.util.objectValues(r);return(0,p.addIssueToContext)(n,{received:n.data,code:D.ZodIssueCode.invalid_enum_value,options:i}),p.INVALID}return(0,p.OK)(e.data)}get enum(){return this._def.values}};d.ZodNativeEnum=ar;An=new WeakMap;ar.create=(t,e)=>new ar({values:t,typeName:P.ZodNativeEnum,...q(e)});var gt=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==_.ZodParsedType.promise&&r.common.async===!1)return(0,p.addIssueToContext)(r,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.promise,received:r.parsedType}),p.INVALID;let n=r.parsedType===_.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,p.OK)(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};d.ZodPromise=gt;gt.create=(t,e)=>new gt({type:t,typeName:P.ZodPromise,...q(e)});var Se=class extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{(0,p.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async o=>{if(r.value==="aborted")return p.INVALID;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?p.INVALID:u.status==="dirty"||r.value==="dirty"?(0,p.DIRTY)(u.value):u});{if(r.value==="aborted")return p.INVALID;let o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:o.status==="dirty"||r.value==="dirty"?(0,p.DIRTY)(o.value):o}}if(i.type==="refinement"){let a=o=>{let u=i.refinement(o,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p.INVALID:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,p.isValid)(a))return a;let o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,p.isValid)(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);_.util.assertNever(i)}};d.ZodEffects=Se;d.ZodTransformer=Se;Se.create=(t,e,r)=>new Se({schema:t,typeName:P.ZodEffects,effect:e,...q(r)});Se.createWithPreprocess=(t,e,r)=>new Se({schema:e,effect:{type:"preprocess",transform:t},typeName:P.ZodEffects,...q(r)});var Pe=class extends M{_parse(e){return this._getType(e)===_.ZodParsedType.undefined?(0,p.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodOptional=Pe;Pe.create=(t,e)=>new Pe({innerType:t,typeName:P.ZodOptional,...q(e)});var Ke=class extends M{_parse(e){return this._getType(e)===_.ZodParsedType.null?(0,p.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};d.ZodNullable=Ke;Ke.create=(t,e)=>new Ke({innerType:t,typeName:P.ZodNullable,...q(e)});var or=class extends M{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===_.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};d.ZodDefault=or;or.create=(t,e)=>new or({innerType:t,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...q(e)});var ur=class extends M{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,p.isAsync)(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new D.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new D.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};d.ZodCatch=ur;ur.create=(t,e)=>new ur({innerType:t,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...q(e)});var Pr=class extends M{_parse(e){if(this._getType(e)!==_.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:D.ZodIssueCode.invalid_type,expected:_.ZodParsedType.nan,received:n.parsedType}),p.INVALID}return{status:"valid",value:e.data}}};d.ZodNaN=Pr;Pr.create=t=>new Pr({typeName:P.ZodNaN,...q(t)});d.BRAND=Symbol("zod_brand");var Fn=class extends M{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};d.ZodBranded=Fn;var En=class t extends M{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?p.INVALID:s.status==="dirty"?(r.dirty(),(0,p.DIRTY)(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?p.INVALID:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:P.ZodPipeline})}};d.ZodPipeline=En;var cr=class extends M{_parse(e){let r=this._def.innerType._parse(e),n=i=>((0,p.isValid)(i)&&(i.value=Object.freeze(i.value)),i);return(0,p.isAsync)(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};d.ZodReadonly=cr;cr.create=(t,e)=>new cr({innerType:t,typeName:P.ZodReadonly,...q(e)});function kl(t,e={},r){return t?Ct.create().superRefine((n,i)=>{var s,a;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:u})}}):Ct.create()}d.custom=kl;d.late={object:De.lazycreate};var P;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(P=d.ZodFirstPartyTypeKind||(d.ZodFirstPartyTypeKind={}));var B2=(t,e={message:`Input not instance of ${t.name}`})=>kl(r=>r instanceof t,e);d.instanceof=B2;var Nl=mt.create;d.string=Nl;var Rl=Jt.create;d.number=Rl;var y2=Pr.create;d.nan=y2;var v2=Kt.create;d.bigint=v2;var Pl=Yt.create;d.boolean=Pl;var b2=Xt.create;d.date=b2;var x2=Or.create;d.symbol=x2;var w2=Qt.create;d.undefined=w2;var I2=er.create;d.null=I2;var S2=Ct.create;d.any=S2;var T2=ot.create;d.unknown=T2;var O2=Ve.create;d.never=O2;var k2=kr.create;d.void=k2;var N2=ut.create;d.array=N2;var R2=De.create;d.object=R2;var P2=De.strictCreate;d.strictObject=P2;var $2=tr.create;d.union=$2;var Z2=ni.create;d.discriminatedUnion=Z2;var j2=rr.create;d.intersection=j2;var L2=Je.create;d.tuple=L2;var q2=ii.create;d.record=q2;var M2=Nr.create;d.map=M2;var V2=Rr.create;d.set=V2;var U2=si.create;d.function=U2;var H2=nr.create;d.lazy=H2;var z2=ir.create;d.literal=z2;var W2=sr.create;d.enum=W2;var G2=ar.create;d.nativeEnum=G2;var J2=gt.create;d.promise=J2;var $l=Se.create;d.effect=$l;d.transformer=$l;var K2=Pe.create;d.optional=K2;var Y2=Ke.create;d.nullable=Y2;var X2=Se.createWithPreprocess;d.preprocess=X2;var Q2=En.create;d.pipeline=Q2;var eC=()=>Nl().optional();d.ostring=eC;var tC=()=>Rl().optional();d.onumber=tC;var rC=()=>Pl().optional();d.oboolean=rC;d.coerce={string:t=>mt.create({...t,coerce:!0}),number:t=>Jt.create({...t,coerce:!0}),boolean:t=>Yt.create({...t,coerce:!0}),bigint:t=>Kt.create({...t,coerce:!0}),date:t=>Xt.create({...t,coerce:!0})};d.NEVER=p.INVALID});var Ps=A(Ze=>{"use strict";var nC=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$r=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nC(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});$r(ei(),Ze);$r(ks(),Ze);$r(vl(),Ze);$r(dn(),Ze);$r(Zl(),Ze);$r(Qn(),Ze)});var ql=A(_e=>{"use strict";var jl=_e&&_e.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iC=_e&&_e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sC=_e&&_e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jl(e,t,r);return iC(e,t),e},aC=_e&&_e.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jl(e,t,r)};Object.defineProperty(_e,"__esModule",{value:!0});_e.z=void 0;var Ll=sC(Ps());_e.z=Ll;aC(Ps(),_e);_e.default=Ll});var Ml=A(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.joinPath=void 0;var oC=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function uC(t){return t.length===1?t[0].toString():t.reduce((e,r)=>{if(typeof r=="number")return e+"["+r.toString()+"]";if(r.includes('"'))return e+'["'+cC(r)+'"]';if(!oC.test(r))return e+'["'+r+'"]';let n=e.length===0?"":".";return e+n+r},"")}ai.joinPath=uC;function cC(t){return t.replace(/"/g,'\\"')}});var Vl=A(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.isNonEmptyArray=void 0;function lC(t){return t.length!==0}oi.isNonEmptyArray=lC});var Kl=A(ae=>{"use strict";var dC=ae&&ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fC=ae&&ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hC=ae&&ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dC(e,t,r);return fC(e,t),e};Object.defineProperty(ae,"__esModule",{value:!0});ae.errorMap=ae.isValidationErrorLike=ae.isValidationError=ae.toValidationError=ae.fromZodError=ae.fromZodIssue=ae.ValidationError=void 0;var pC=hC(ql()),AC=Ml(),FC=Vl(),EC=99,Ul="; ",Hl=", or ",$s="Validation error",zl=": ",Zr=class extends Error{details;name;constructor(e,r=[]){super(e),this.details=r,this.name="ZodValidationError"}toString(){return this.message}};ae.ValidationError=Zr;function Zs(t,e,r){if(t.code==="invalid_union")return t.unionErrors.reduce((n,i)=>{let s=i.issues.map(a=>Zs(a,e,r)).join(e);return n.includes(s)||n.push(s),n},[]).join(r);if((0,FC.isNonEmptyArray)(t.path)){if(t.path.length===1){let n=t.path[0];if(typeof n=="number")return`${t.message} at index ${n}`}return`${t.message} at "${(0,AC.joinPath)(t.path)}"`}return t.message}function Wl(t,e,r){return e!==null?t.length>0?[e,t].join(r):e:t.length>0?t:$s}function Gl(t,e={}){let{issueSeparator:r=Ul,unionSeparator:n=Hl,prefixSeparator:i=zl,prefix:s=$s}=e,a=Zs(t,r,n),o=Wl(a,s,i);return new Zr(o,[t])}ae.fromZodIssue=Gl;function Jl(t,e={}){let{maxIssuesInMessage:r=EC,issueSeparator:n=Ul,unionSeparator:i=Hl,prefixSeparator:s=zl,prefix:a=$s}=e,o=t.errors.slice(0,r).map(c=>Zs(c,n,i)).join(n),u=Wl(o,a,s);return new Zr(u,t.errors)}ae.fromZodError=Jl;var mC=(t={})=>e=>e instanceof pC.ZodError?Jl(e,t):e instanceof Error?e:new Error("Unknown error");ae.toValidationError=mC;function CC(t){return t instanceof Zr}ae.isValidationError=CC;function gC(t){return t instanceof Error&&t.name==="ZodValidationError"}ae.isValidationErrorLike=gC;var DC=(t,e)=>({message:Gl({...t,message:t.message??e.defaultError}).message});ae.errorMap=DC});var Yl=A(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.errorMap=pe.fromZodIssue=pe.fromZodError=pe.isValidationErrorLike=pe.isValidationError=pe.toValidationError=pe.ValidationError=void 0;var lr=Kl();Object.defineProperty(pe,"ValidationError",{enumerable:!0,get:function(){return lr.ValidationError}});Object.defineProperty(pe,"toValidationError",{enumerable:!0,get:function(){return lr.toValidationError}});Object.defineProperty(pe,"isValidationError",{enumerable:!0,get:function(){return lr.isValidationError}});Object.defineProperty(pe,"isValidationErrorLike",{enumerable:!0,get:function(){return lr.isValidationErrorLike}});Object.defineProperty(pe,"fromZodError",{enumerable:!0,get:function(){return lr.fromZodError}});Object.defineProperty(pe,"fromZodIssue",{enumerable:!0,get:function(){return lr.fromZodIssue}});Object.defineProperty(pe,"errorMap",{enumerable:!0,get:function(){return lr.errorMap}})});var hd=require("child_process");var ia=Bt(na(),1),{program:bi,createCommand:og,createArgument:ug,createOption:cg,CommanderError:lg,InvalidArgumentError:dg,InvalidOptionArgumentError:fg,Command:hg,Argument:pg,Option:sa,Help:Ag}=ia.default;var dr=Bt(require("fs")),pd=Bt(Wa()),Ad=Bt(H0()),Fd=Bt(iu());var ad=require("child_process"),_t=require("fs"),od=Bt(il());var W;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(let o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(let a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(W||(W={}));var bs;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(bs||(bs={}));var y=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ht=t=>{switch(typeof t){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(t)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(t)?y.array:t===null?y.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?y.promise:typeof Map<"u"&&t instanceof Map?y.map:typeof Set<"u"&&t instanceof Set?y.set:typeof Date<"u"&&t instanceof Date?y.date:y.object;default:return y.unknown}},E=W.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),LE=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),we=class t extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},i=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,u=0;for(;u<a.path.length;){let c=a.path[u];u===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(a))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};we.create=t=>new we(t);var vr=(t,e)=>{let r;switch(t.code){case E.invalid_type:t.received===y.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case E.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:r=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case E.invalid_union:r="Invalid input";break;case E.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case E.invalid_enum_value:r=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case E.invalid_arguments:r="Invalid function arguments";break;case E.invalid_return_type:r="Invalid function return type";break;case E.invalid_date:r="Invalid date";break;case E.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:W.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case E.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case E.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case E.custom:r="Invalid input";break;case E.invalid_intersection_types:r="Intersection results could not be merged";break;case E.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case E.not_finite:r="Number must be finite";break;default:r=e.defaultError,W.assertNever(t)}return{message:r}},ol=vr;function qE(t){ol=t}function zn(){return ol}var Wn=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,s=[...r,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)o=c(a,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},ME=[];function B(t,e){let r=zn(),n=Wn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===vr?void 0:vr].filter(i=>!!i)});t.common.issues.push(n)}var fe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return R;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let s=await i.key,a=await i.value;n.push({key:s,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return R;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},R=Object.freeze({status:"aborted"}),yr=t=>({status:"dirty",value:t}),me=t=>({status:"valid",value:t}),xs=t=>t.status==="aborted",ws=t=>t.status==="dirty",on=t=>t.status==="valid",un=t=>typeof Promise<"u"&&t instanceof Promise;function Gn(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function ul(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(I||(I={}));var sn,an,Re=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},sl=(t,e)=>{if(on(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new we(t.common.issues);return this._error=r,this._error}}};function j(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{var u,c;let{message:l}=t;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(u=l??n)!==null&&u!==void 0?u:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(c=l??r)!==null&&c!==void 0?c:o.defaultError}},description:i}}var L=class{constructor(e){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)}get description(){return this._def.description}_getType(e){return ht(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new fe,ctx:{common:e.parent.common,data:e.data,parsedType:ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(un(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let i={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ht(e)},s=this._parseSync({data:e,path:i.path,parent:i});return sl(i,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ht(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(un(i)?i:Promise.resolve(i));return sl(n,s)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let a=e(i),o=()=>s.addIssue({code:E.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Ie({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ne.create(this,this._def)}nullable(){return We.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return st.create(this,this._def)}promise(){return Ft.create(this,this._def)}or(e){return jt.create([this,e],this._def)}and(e){return Lt.create(this,e,this._def)}transform(e){return new Ie({...j(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ht({...j(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new cn({typeName:N.ZodBranded,type:this,...j(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new zt({...j(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ln.create(this,e)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},VE=/^c[^\s-]{8,}$/i,UE=/^[0-9a-z]+$/,HE=/^[0-9A-HJKMNP-TV-Z]{26}$/,zE=/^[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,WE=/^[a-z0-9_-]{21}$/i,GE=/^[-+]?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)?)??$/,JE=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,KE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vs,YE=/^(?:(?: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])$/,XE=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,QE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cl="((\\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])))",em=new RegExp(`^${cl}$`);function ll(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function tm(t){return new RegExp(`^${ll(t)}$`)}function dl(t){let e=`${cl}T${ll(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function rm(t,e){return!!((e==="v4"||!e)&&YE.test(t)||(e==="v6"||!e)&&XE.test(t))}var pt=class t extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){let s=this._getOrReturnCtx(e);return B(s,{code:E.invalid_type,expected:y.string,received:s.parsedType}),R}let n=new fe,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,o=e.data.length<s.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?B(i,{code:E.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&B(i,{code:E.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")JE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"email",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")vs||(vs=new RegExp(KE,"u")),vs.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"emoji",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")zE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"uuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")WE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"nanoid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")VE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")UE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"cuid2",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")HE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ulid",code:E.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),B(i,{validation:"url",code:E.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"regex",code:E.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?dl(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?em.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?tm(s).test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{code:E.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?GE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"duration",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?rm(e.data,s.version)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"ip",code:E.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?QE.test(e.data)||(i=this._getOrReturnCtx(e,i),B(i,{validation:"base64",code:E.invalid_string,message:s.message}),n.dirty()):W.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:E.invalid_string,...I.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...I.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...I.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...I.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...I.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...I.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...I.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...I.errToObj(r)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};pt.create=t=>{var e;return new pt({checks:[],typeName:N.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...j(t)})};function nm(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}var kt=class t extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==y.number){let s=this._getOrReturnCtx(e);return B(s,{code:E.invalid_type,expected:y.number,received:s.parsedType}),R}let n,i=new fe;for(let s of this._def.checks)s.kind==="int"?W.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:E.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?nm(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:E.not_finite,message:s.message}),i.dirty()):W.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&W.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};kt.create=t=>new kt({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...j(t)});var Nt=class t extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==y.bigint){let s=this._getOrReturnCtx(e);return B(s,{code:E.invalid_type,expected:y.bigint,received:s.parsedType}),R}let n,i=new fe;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:E.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):W.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Nt.create=t=>{var e;return new Nt({checks:[],typeName:N.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...j(t)})};var Rt=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.boolean,received:n.parsedType}),R}return me(e.data)}};Rt.create=t=>new Rt({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...j(t)});var Pt=class t extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){let s=this._getOrReturnCtx(e);return B(s,{code:E.invalid_type,expected:y.date,received:s.parsedType}),R}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return B(s,{code:E.invalid_date}),R}let n=new fe,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:E.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),B(i,{code:E.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):W.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Pt.create=t=>new Pt({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...j(t)});var br=class extends L{_parse(e){if(this._getType(e)!==y.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.symbol,received:n.parsedType}),R}return me(e.data)}};br.create=t=>new br({typeName:N.ZodSymbol,...j(t)});var $t=class extends L{_parse(e){if(this._getType(e)!==y.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.undefined,received:n.parsedType}),R}return me(e.data)}};$t.create=t=>new $t({typeName:N.ZodUndefined,...j(t)});var Zt=class extends L{_parse(e){if(this._getType(e)!==y.null){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.null,received:n.parsedType}),R}return me(e.data)}};Zt.create=t=>new Zt({typeName:N.ZodNull,...j(t)});var At=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return me(e.data)}};At.create=t=>new At({typeName:N.ZodAny,...j(t)});var it=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return me(e.data)}};it.create=t=>new it({typeName:N.ZodUnknown,...j(t)});var Me=class extends L{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:E.invalid_type,expected:y.never,received:r.parsedType}),R}};Me.create=t=>new Me({typeName:N.ZodNever,...j(t)});var xr=class extends L{_parse(e){if(this._getType(e)!==y.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.void,received:n.parsedType}),R}return me(e.data)}};xr.create=t=>new xr({typeName:N.ZodVoid,...j(t)});var st=class t extends L{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==y.array)return B(r,{code:E.invalid_type,expected:y.array,received:r.parsedType}),R;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,o=r.data.length<i.exactLength.value;(a||o)&&(B(r,{code:a?E.too_big:E.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(B(r,{code:E.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(B(r,{code:E.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>i.type._parseAsync(new Re(r,a,r.path,o)))).then(a=>fe.mergeArray(n,a));let s=[...r.data].map((a,o)=>i.type._parseSync(new Re(r,a,r.path,o)));return fe.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:I.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:I.toString(r)}})}nonempty(e){return this.min(1,e)}};st.create=(t,e)=>new st({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...j(e)});function Br(t){if(t instanceof ge){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ne.create(Br(n))}return new ge({...t._def,shape:()=>e})}else return t instanceof st?new st({...t._def,type:Br(t.element)}):t instanceof Ne?Ne.create(Br(t.unwrap())):t instanceof We?We.create(Br(t.unwrap())):t instanceof ze?ze.create(t.items.map(e=>Br(e))):t}var ge=class t extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=W.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==y.object){let c=this._getOrReturnCtx(e);return B(c,{code:E.invalid_type,expected:y.object,received:c.parsedType}),R}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Me&&this._def.unknownKeys==="strip"))for(let c in i.data)a.includes(c)||o.push(c);let u=[];for(let c of a){let l=s[c],f=i.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Re(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Me){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of o)u.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")o.length>0&&(B(i,{code:E.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of o){let f=i.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Re(i,f,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of u){let f=await l.key,m=await l.value;c.push({key:f,value:m,alwaysSet:l.alwaysSet})}return c}).then(c=>fe.mergeObjectSync(n,c)):fe.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,o;let u=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=I.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return W.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return W.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return Br(this)}partial(e){let r={};return W.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return W.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof Ne;)s=s._def.innerType;r[n]=s}}),new t({...this._def,shape:()=>r})}keyof(){return fl(W.objectKeys(this.shape))}};ge.create=(t,e)=>new ge({shape:()=>t,unknownKeys:"strip",catchall:Me.create(),typeName:N.ZodObject,...j(e)});ge.strictCreate=(t,e)=>new ge({shape:()=>t,unknownKeys:"strict",catchall:Me.create(),typeName:N.ZodObject,...j(e)});ge.lazycreate=(t,e)=>new ge({shape:t,unknownKeys:"strip",catchall:Me.create(),typeName:N.ZodObject,...j(e)});var jt=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(o=>new we(o.ctx.common.issues));return B(r,{code:E.invalid_union,unionErrors:a}),R}if(r.common.async)return Promise.all(n.map(async s=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(u=>new we(u));return B(r,{code:E.invalid_union,unionErrors:o}),R}}get options(){return this._def.options}};jt.create=(t,e)=>new jt({options:t,typeName:N.ZodUnion,...j(e)});var nt=t=>t instanceof qt?nt(t.schema):t instanceof Ie?nt(t.innerType()):t instanceof Mt?[t.value]:t instanceof Vt?t.options:t instanceof Ut?W.objectValues(t.enum):t instanceof Ht?nt(t._def.innerType):t instanceof $t?[void 0]:t instanceof Zt?[null]:t instanceof Ne?[void 0,...nt(t.unwrap())]:t instanceof We?[null,...nt(t.unwrap())]:t instanceof cn||t instanceof Wt?nt(t.unwrap()):t instanceof zt?nt(t._def.innerType):[],Jn=class t extends L{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==y.object)return B(r,{code:E.invalid_type,expected:y.object,received:r.parsedType}),R;let n=this.discriminator,i=r.data[n],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let s of r){let a=nt(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...j(n)})}};function Is(t,e){let r=ht(t),n=ht(e);if(t===e)return{valid:!0,data:t};if(r===y.object&&n===y.object){let i=W.objectKeys(e),s=W.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(let o of s){let u=Is(t[o],e[o]);if(!u.valid)return{valid:!1};a[o]=u.data}return{valid:!0,data:a}}else if(r===y.array&&n===y.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<t.length;s++){let a=t[s],o=e[s],u=Is(a,o);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===y.date&&n===y.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Lt=class extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(s,a)=>{if(xs(s)||xs(a))return R;let o=Is(s.value,a.value);return o.valid?((ws(s)||ws(a))&&r.dirty(),{status:r.value,value:o.data}):(B(n,{code:E.invalid_intersection_types}),R)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Lt.create=(t,e,r)=>new Lt({left:t,right:e,typeName:N.ZodIntersection,...j(r)});var ze=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return B(n,{code:E.invalid_type,expected:y.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return B(n,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((a,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new Re(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>fe.mergeArray(r,a)):fe.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ze.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ze({items:t,typeName:N.ZodTuple,rest:null,...j(e)})};var Kn=class t extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return B(n,{code:E.invalid_type,expected:y.object,received:n.parsedType}),R;let i=[],s=this._def.keyType,a=this._def.valueType;for(let o in n.data)i.push({key:s._parse(new Re(n,o,n.path,o)),value:a._parse(new Re(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?fe.mergeObjectAsync(r,i):fe.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof L?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...j(n)}):new t({keyType:pt.create(),valueType:e,typeName:N.ZodRecord,...j(r)})}},wr=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return B(n,{code:E.invalid_type,expected:y.map,received:n.parsedType}),R;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([o,u],c)=>({key:i._parse(new Re(n,o,n.path,[c,"key"])),value:s._parse(new Re(n,u,n.path,[c,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of a){let c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return R;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of a){let c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return R;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}};wr.create=(t,e,r)=>new wr({valueType:e,keyType:t,typeName:N.ZodMap,...j(r)});var Ir=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return B(n,{code:E.invalid_type,expected:y.set,received:n.parsedType}),R;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(B(n,{code:E.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(B(n,{code:E.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function a(u){let c=new Set;for(let l of u){if(l.status==="aborted")return R;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let o=[...n.data.values()].map((u,c)=>s._parse(new Re(n,u,n.path,c)));return n.common.async?Promise.all(o).then(u=>a(u)):a(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:I.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Ir.create=(t,e)=>new Ir({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...j(e)});var Yn=class t extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==y.function)return B(r,{code:E.invalid_type,expected:y.function,received:r.parsedType}),R;function n(o,u){return Wn({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zn(),vr].filter(c=>!!c),issueData:{code:E.invalid_arguments,argumentsError:u}})}function i(o,u){return Wn({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zn(),vr].filter(c=>!!c),issueData:{code:E.invalid_return_type,returnTypeError:u}})}let s={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Ft){let o=this;return me(async function(...u){let c=new we([]),l=await o._def.args.parseAsync(u,s).catch(F=>{throw c.addIssue(n(u,F)),c}),f=await Reflect.apply(a,this,l);return await o._def.returns._def.type.parseAsync(f,s).catch(F=>{throw c.addIssue(i(f,F)),c})})}else{let o=this;return me(function(...u){let c=o._def.args.safeParse(u,s);if(!c.success)throw new we([n(u,c.error)]);let l=Reflect.apply(a,this,c.data),f=o._def.returns.safeParse(l,s);if(!f.success)throw new we([i(l,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ze.create(e).rest(it.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ze.create([]).rest(it.create()),returns:r||it.create(),typeName:N.ZodFunction,...j(n)})}},qt=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};qt.create=(t,e)=>new qt({getter:t,typeName:N.ZodLazy,...j(e)});var Mt=class extends L{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:E.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}};Mt.create=(t,e)=>new Mt({value:t,typeName:N.ZodLiteral,...j(e)});function fl(t,e){return new Vt({values:t,typeName:N.ZodEnum,...j(e)})}var Vt=class t extends L{constructor(){super(...arguments),sn.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:W.joinValues(n),received:r.parsedType,code:E.invalid_type}),R}if(Gn(this,sn,"f")||ul(this,sn,new Set(this._def.values),"f"),!Gn(this,sn,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:E.invalid_enum_value,options:n}),R}return me(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};sn=new WeakMap;Vt.create=fl;var Ut=class extends L{constructor(){super(...arguments),an.set(this,void 0)}_parse(e){let r=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){let i=W.objectValues(r);return B(n,{expected:W.joinValues(i),received:n.parsedType,code:E.invalid_type}),R}if(Gn(this,an,"f")||ul(this,an,new Set(W.getValidEnumValues(this._def.values)),"f"),!Gn(this,an,"f").has(e.data)){let i=W.objectValues(r);return B(n,{received:n.data,code:E.invalid_enum_value,options:i}),R}return me(e.data)}get enum(){return this._def.values}};an=new WeakMap;Ut.create=(t,e)=>new Ut({values:t,typeName:N.ZodNativeEnum,...j(e)});var Ft=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==y.promise&&r.common.async===!1)return B(r,{code:E.invalid_type,expected:y.promise,received:r.parsedType}),R;let n=r.parsedType===y.promise?r.data:Promise.resolve(r.data);return me(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ft.create=(t,e)=>new Ft({type:t,typeName:N.ZodPromise,...j(e)});var Ie=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{B(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(n.data,s);if(n.common.async)return Promise.resolve(a).then(async o=>{if(r.value==="aborted")return R;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?R:u.status==="dirty"||r.value==="dirty"?yr(u.value):u});{if(r.value==="aborted")return R;let o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?R:o.status==="dirty"||r.value==="dirty"?yr(o.value):o}}if(i.type==="refinement"){let a=o=>{let u=i.refinement(o,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?R:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?R:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!on(a))return a;let o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>on(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:r.value,value:o})):a);W.assertNever(i)}};Ie.create=(t,e,r)=>new Ie({schema:t,typeName:N.ZodEffects,effect:e,...j(r)});Ie.createWithPreprocess=(t,e,r)=>new Ie({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...j(r)});var Ne=class extends L{_parse(e){return this._getType(e)===y.undefined?me(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ne.create=(t,e)=>new Ne({innerType:t,typeName:N.ZodOptional,...j(e)});var We=class extends L{_parse(e){return this._getType(e)===y.null?me(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};We.create=(t,e)=>new We({innerType:t,typeName:N.ZodNullable,...j(e)});var Ht=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ht.create=(t,e)=>new Ht({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...j(e)});var zt=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return un(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new we(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new we(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zt.create=(t,e)=>new zt({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...j(e)});var Sr=class extends L{_parse(e){if(this._getType(e)!==y.nan){let n=this._getOrReturnCtx(e);return B(n,{code:E.invalid_type,expected:y.nan,received:n.parsedType}),R}return{status:"valid",value:e.data}}};Sr.create=t=>new Sr({typeName:N.ZodNaN,...j(t)});var im=Symbol("zod_brand"),cn=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ln=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?R:s.status==="dirty"?(r.dirty(),yr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Wt=class extends L{_parse(e){let r=this._def.innerType._parse(e),n=i=>(on(i)&&(i.value=Object.freeze(i.value)),i);return un(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Wt.create=(t,e)=>new Wt({innerType:t,typeName:N.ZodReadonly,...j(e)});function hl(t,e={},r){return t?At.create().superRefine((n,i)=>{var s,a;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(a=(s=o.fatal)!==null&&s!==void 0?s:r)!==null&&a!==void 0?a:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:u})}}):At.create()}var sm={object:ge.lazycreate},N;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(N||(N={}));var am=(t,e={message:`Input not instance of ${t.name}`})=>hl(r=>r instanceof t,e),pl=pt.create,Al=kt.create,om=Sr.create,um=Nt.create,Fl=Rt.create,cm=Pt.create,lm=br.create,dm=$t.create,fm=Zt.create,hm=At.create,pm=it.create,Am=Me.create,Fm=xr.create,Em=st.create,mm=ge.create,Cm=ge.strictCreate,gm=jt.create,Dm=Jn.create,_m=Lt.create,Bm=ze.create,ym=Kn.create,vm=wr.create,bm=Ir.create,xm=Yn.create,wm=qt.create,Im=Mt.create,Sm=Vt.create,Tm=Ut.create,Om=Ft.create,al=Ie.create,km=Ne.create,Nm=We.create,Rm=Ie.createWithPreprocess,Pm=ln.create,$m=()=>pl().optional(),Zm=()=>Al().optional(),jm=()=>Fl().optional(),Lm={string:t=>pt.create({...t,coerce:!0}),number:t=>kt.create({...t,coerce:!0}),boolean:t=>Rt.create({...t,coerce:!0}),bigint:t=>Nt.create({...t,coerce:!0}),date:t=>Pt.create({...t,coerce:!0})},qm=R,Y=Object.freeze({__proto__:null,defaultErrorMap:vr,setErrorMap:qE,getErrorMap:zn,makeIssue:Wn,EMPTY_PATH:ME,addIssueToContext:B,ParseStatus:fe,INVALID:R,DIRTY:yr,OK:me,isAborted:xs,isDirty:ws,isValid:on,isAsync:un,get util(){return W},get objectUtil(){return bs},ZodParsedType:y,getParsedType:ht,ZodType:L,datetimeRegex:dl,ZodString:pt,ZodNumber:kt,ZodBigInt:Nt,ZodBoolean:Rt,ZodDate:Pt,ZodSymbol:br,ZodUndefined:$t,ZodNull:Zt,ZodAny:At,ZodUnknown:it,ZodNever:Me,ZodVoid:xr,ZodArray:st,ZodObject:ge,ZodUnion:jt,ZodDiscriminatedUnion:Jn,ZodIntersection:Lt,ZodTuple:ze,ZodRecord:Kn,ZodMap:wr,ZodSet:Ir,ZodFunction:Yn,ZodLazy:qt,ZodLiteral:Mt,ZodEnum:Vt,ZodNativeEnum:Ut,ZodPromise:Ft,ZodEffects:Ie,ZodTransformer:Ie,ZodOptional:Ne,ZodNullable:We,ZodDefault:Ht,ZodCatch:zt,ZodNaN:Sr,BRAND:im,ZodBranded:cn,ZodPipeline:ln,ZodReadonly:Wt,custom:hl,Schema:L,ZodSchema:L,late:sm,get ZodFirstPartyTypeKind(){return N},coerce:Lm,any:hm,array:Em,bigint:um,boolean:Fl,date:cm,discriminatedUnion:Dm,effect:al,enum:Sm,function:xm,instanceof:am,intersection:_m,lazy:wm,literal:Im,map:vm,nan:om,nativeEnum:Tm,never:Am,null:fm,nullable:Nm,number:Al,object:mm,oboolean:jm,onumber:Zm,optional:km,ostring:$m,pipeline:Pm,preprocess:Rm,promise:Om,record:ym,set:bm,strictObject:Cm,string:pl,symbol:lm,transformer:al,tuple:Bm,undefined:dm,union:gm,unknown:pm,void:Fm,NEVER:qm,ZodIssueCode:E,quotelessJson:LE,ZodError:we});var El=["PCA10028","PCA10031","PCA10040","PCA10056","PCA10059","PCA10090","PCA10095","PCA10100","PCA10121","PCA20020","PCA20035","PCA10143","PCA10152","PCA10153","PCA10165","PCA20049","PCA10171","PCA10156","PCA10175"];var S_=Y.object({name:Y.string(),description:Y.string().optional(),apps:Y.array(Y.string().url())}),T_=Y.array(Y.string().url()),Xn=Y.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,"Is not a valid string for a semantic version"),Mm=Y.string(),Vm=Xn,ml=Y.record(Mm,Y.tuple([Vm]));var Xl=Bt(Yl()),ui=t=>e=>{let r=t.safeParse(JSON.parse(e));return r.success?r:{...r,error:(0,Xl.fromZodError)(r.error,{prefix:"Error in package.json",prefixSeparator:`:
32
32
  - `,issueSeparator:`
33
- - `})}};var Ql=Y.object({name:Y.string(),version:Xn,displayName:Y.string().optional()}),X_=ui(Ql),ed=Y.object({supportedDevices:Y.enum(El).array().nonempty().optional(),nrfutil:ml.optional(),nrfutilCore:Xn,html:Y.string()}),ci=Y.record(Y.string().optional()),_C=ci.and(Y.object({nrfconnect:Y.string()})),td=Ql.extend({dependencies:ci.optional(),description:Y.string(),homepage:Y.string().url().optional(),devDependencies:ci.optional(),displayName:Y.string(),engines:_C,nrfConnectForDesktop:ed,files:Y.string().array().optional(),peerDependencies:ci.optional(),repository:Y.object({type:Y.string(),url:Y.string().url()}).optional()}),rd=ui(td),BC=td.extend({nrfConnectForDesktop:ed.extend({supportedDevices:Y.array(Y.string()).nonempty().optional()}).partial({html:!0,nrfutilCore:!0}).optional()}),Q_=ui(BC);var ud=t=>t.map(e=>`\`${e}\``).join(", "),nd=t=>e=>{let r=(0,od.default)(e)(t);return r==null||r===""},Dt=t=>{console.error(t),process.exit(1)},id=t=>{console.warn(t)},yC=(t,e)=>{t.length!==0&&Dt(`${e}: ${ud(t)}`)},cd=(t,e,r)=>{let n=e.filter(i=>!t.includes(i));yC(n,r)},vC=(t,e,r)=>{e.some(n=>t.includes(n))||Dt(`${r}: ${ud(e)}`)},bC=t=>{if(!(0,_t.existsSync)("./.git"))return;let e=(0,ad.execSync)("git remote get-url origin",{encoding:"utf-8"}).trimEnd(),r=t.repository?.url,n=a=>a?.replace(/\.git$/,""),i=a=>a?.replace(/^git@github\.com:/,"github.com/").replace(/^https:\/\//,""),s=a=>i(n(a));s(e)!==s(r)&&Dt(`package.json says the repository is located at \`${r}\` but \`git remote get-url origin\` says it is at \`${e}\`.`)},xC=t=>{nd(t)("homepage")&&id("Please provide a property `homepage` in package.json."),nd(t)("repository.url")?id("Please provide a property `repository.url` in package.json."):bC(t)},wC=t=>{cd(t.files??[],["LICENSE","dist/","Changelog.md"],"These entries are missing in the property `files` in package.json"),vC(t.files??[],["resources/*","resources/icon.*","resources/"],"One of these entries must be in the property `files` in package.json")},IC=()=>{let t=rd((0,_t.readFileSync)("./package.json","utf8"));t.success||(console.error(t.error.message),process.exit(1));let e=t.data;return xC(e),wC(e),e},sd=t=>new RegExp(`^## ${t}`,"mi"),SC=(t,e)=>{if((0,_t.existsSync)("./Changelog.md")||Dt("The mandatory file `Changelog.md` is missing."),e){t.version==null&&Dt("package.json must specify a `version`.");let r=(0,_t.readFileSync)("./Changelog.md","utf8");r.match(sd(t.version))||Dt(`Found no entry for the current version packageJson.version ${t.version} in \`Changelog.md\`.`),r.match(sd("unreleased"))&&Dt("There must not be an entry `unreleased` in `Changelog.md`.")}},TC=t=>{try{return(0,_t.readdirSync)(t)}catch{throw Dt(`Unable to read directory \`${t}\`.`),new Error}},OC=()=>{cd(TC("./resources"),["icon.svg","icon.icns","icon.ico","icon.png"],"In the directory `resources` these files are missing")},ld=({checkChangelogHasCurrentEntry:t})=>{let e=IC();SC(e,t),OC()},kC=require.main===module;kC&&ld({checkChangelogHasCurrentEntry:!1});var dd=ld;var Ue,li=class{initialise(e){}end(){}},js=class extends li{constructor(r){super();this.options=r;this.ftpClient=new pd.default;this.host=process.env.REPO_HOST||"localhost";this.port=Number(process.env.REPO_PORT)||21;this.user=process.env.REPO_USER||"anonymous";this.password=process.env.REPO_PASS||"anonymous@";this.getSourceDir=()=>{let r="/.pc-tools/nrfconnect-apps";return process.env.REPO_DIR?process.env.REPO_DIR:this.options.deployOfficial?r:`${r}/${this.options.source}`};this.getSourceUrl=()=>process.env.REPO_URL?process.env.REPO_URL:`https://developer.nordicsemi.com${this.sourceDir}`;this.connect=()=>new Promise((r,n)=>{console.log(`Connecting to ftp://${this.user}@${this.host}:${this.port}`),this.ftpClient.once("error",i=>{this.ftpClient.removeAllListeners("ready"),n(i)}),this.ftpClient.once("ready",()=>{this.ftpClient.removeAllListeners("error"),r()}),this.ftpClient.connect({host:this.host,port:this.port,user:this.user,password:this.password})});this.changeWorkingDirectory=()=>new Promise((r,n)=>{console.log(`Changing to directory ${this.sourceDir}`),this.ftpClient.cwd(this.sourceDir,i=>{i?n(new Error(`
34
- Error: Failed to change to directory. Check whether it exists on the FTP server.`)):r()})});this.initialise=async()=>{await this.connect(),await this.changeWorkingDirectory()};this.download=r=>new Promise((n,i)=>{console.log(`Downloading file ${r}`);let s="";this.ftpClient.get(r,(a,o)=>{if(a)return i(a);o.once("close",()=>n(s)),o.on("data",u=>{s+=u})})});this.upload=(r,n)=>new Promise((i,s)=>{console.log(`Uploading file ${n}`),this.ftpClient.put(r,n,a=>a?s(a):i())});this.uploadContent=this.upload;this.uploadLocalFile=this.upload;this.end=()=>this.ftpClient.end();this.sourceDir=this.getSourceDir(),this.sourceUrl=this.getSourceUrl()}},Ls=class extends li{constructor(r){super();this.options=r;this.token=process.env.ARTIFACTORY_TOKEN;this.getAccessLevel=()=>this.options.accessLevel!=null?this.options.accessLevel:this.options.deployOfficial?"external":"internal";this.download=async r=>{console.log(`Downloading ${r}`);let n=`${this.sourceUrl}/${r}`,i=await fetch(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!i.ok)throw new Error(`Failed to download ${n}: ${i.statusText}`);return i.text()};this.upload=async(r,n)=>{let i=`${this.uploadUrl}/${n}`,s=await fetch(i,{method:"PUT",body:r,headers:{Authorization:`Bearer ${this.token}`}});if(!s.ok)throw new Error(`Failed to upload ${i}: ${s.statusText}`)};this.uploadContent=(r,n)=>(console.log(`Uploading content for ${n}`),this.upload(r,n));this.uploadLocalFile=(r,n)=>(console.log(`Uploading local file ${r} as ${n}`),this.upload(dr.default.readFileSync(r),n));if(this.token==null)throw new Error("The environment variable ARTIFACTORY_TOKEN must be set.");this.uploadUrl=`https://files.nordicsemi.com/artifactory/swtools/${this.getAccessLevel()}/ncd/apps/${r.source}`,this.sourceUrl=`https://files.nordicsemi.com/ui/api/v1/download?isNativeBrowsing=false&repoKey=swtools&path=${this.getAccessLevel()}/ncd/apps/${r.source}`}},NC=t=>t!=null&&typeof t=="object"&&"message"in t,di=t=>NC(t)?t.message:String(t),Ed=["external","external-confidential","internal","internal-confidential"],RC=t=>Ed.includes(t),PC=t=>{let e=t.match(/(?<source>.*?)\s*\((?<accessLevel>.*)\)/);if(e==null)return{source:t};let{source:r,accessLevel:n}=e.groups;if(!RC(n))throw new Error(`The specified access level "${n}" must be one of ${Ed.join(", ")}.`);return{source:r,accessLevel:n}},$C=()=>{bi.description("Publish an nRF Connect for Desktop app").requiredOption("-s, --source <source>",'Specify the source to publish (e.g. "official" or "releast-test"). When publishing to Artifactory, an access level can be specified at the end in parantheses (e.g. "official (external)").').addOption(new sa("-d, --destination <ftp|artifactory>","Specify where to publish.").choices(["ftp","artifactory"]).makeOptionMandatory()).option("-n, --no-pack","Publish existing .tgz file at the root directory without npm pack.").parse();let t=bi.opts(),{source:e,accessLevel:r}=PC(t.source),n=e==="official";return{doPack:t.pack,source:e,deployOfficial:n,destination:t.destination,accessLevel:r}},ZC=()=>JSON.parse(dr.default.readFileSync("./package.json","utf-8")),jC=()=>{console.log("Packing current package"),(0,hd.execSync)("npm pack")},LC=t=>{if(!dr.default.existsSync(t))throw new Error(`Package \`${t}\` to publish is not found`)},qC=t=>{try{return(0,Fd.default)(dr.default.readFileSync(t))}catch(e){throw new Error(`Unable to read file when verifying shasum: ${t}.
33
+ - `})}};var Ql=Y.object({name:Y.string(),version:Xn,displayName:Y.string().optional()}),X_=ui(Ql),ed=Y.object({supportedDevices:Y.enum(El).array().nonempty().optional(),nrfutil:ml.optional(),nrfutilCore:Xn,html:Y.string()}),ci=Y.record(Y.string().optional()),_C=ci.and(Y.object({nrfconnect:Y.string()})),td=Ql.extend({dependencies:ci.optional(),description:Y.string(),homepage:Y.string().url().optional(),devDependencies:ci.optional(),displayName:Y.string(),engines:_C,nrfConnectForDesktop:ed,files:Y.string().array().optional(),peerDependencies:ci.optional(),repository:Y.object({type:Y.string(),url:Y.string().url()}).optional()}),rd=ui(td),BC=td.extend({nrfConnectForDesktop:ed.extend({supportedDevices:Y.array(Y.string()).nonempty().optional()}).partial({html:!0,nrfutilCore:!0}).optional()}),Q_=ui(BC);var ud=t=>t.map(e=>`\`${e}\``).join(", "),nd=t=>e=>{let r=(0,od.default)(e)(t);return r==null||r===""},Dt=t=>{console.error(t),process.exit(1)},id=t=>{console.warn(t)},yC=(t,e)=>{t.length!==0&&Dt(`${e}: ${ud(t)}`)},cd=(t,e,r)=>{let n=e.filter(i=>!t.includes(i));yC(n,r)},vC=(t,e,r)=>{e.some(n=>t.includes(n))||Dt(`${r}: ${ud(e)}`)},bC=t=>{if(!(0,_t.existsSync)("./.git"))return;let e=(0,ad.execSync)("git remote get-url origin",{encoding:"utf-8"}).trimEnd(),r=t.repository?.url,n=a=>a?.replace(/\.git$/,""),i=a=>a?.replace(/^git@github\.com:/,"github.com/").replace(/^https:\/\//,""),s=a=>i(n(a));s(e)!==s(r)&&Dt(`package.json says the repository is located at \`${r}\` but \`git remote get-url origin\` says it is at \`${e}\`.`)},xC=t=>{nd(t)("homepage")&&id("Please provide a property `homepage` in package.json."),nd(t)("repository.url")?id("Please provide a property `repository.url` in package.json."):bC(t)},wC=t=>{cd(t.files??[],["LICENSE","dist/","Changelog.md"],"These entries are missing in the property `files` in package.json"),vC(t.files??[],["resources/*","resources/icon.*","resources/"],"One of these entries must be in the property `files` in package.json")},IC=()=>{let t=rd((0,_t.readFileSync)("./package.json","utf8"));t.success||(console.error(t.error.message),process.exit(1));let e=t.data;return xC(e),wC(e),e},sd=t=>new RegExp(`^## ${t}`,"mi"),SC=(t,e)=>{if((0,_t.existsSync)("./Changelog.md")||Dt("The mandatory file `Changelog.md` is missing."),e){t.version==null&&Dt("package.json must specify a `version`.");let r=(0,_t.readFileSync)("./Changelog.md","utf8");r.match(sd(t.version))||Dt(`Found no entry for the current version packageJson.version ${t.version} in \`Changelog.md\`.`),r.match(sd("unreleased"))&&Dt("There must not be an entry `unreleased` in `Changelog.md`.")}},TC=t=>{try{return(0,_t.readdirSync)(t)}catch{throw Dt(`Unable to read directory \`${t}\`.`),new Error}},OC=()=>{cd(TC("./resources"),["icon.svg","icon.icns","icon.ico","icon.png"],"In the directory `resources` these files are missing")},ld=({checkChangelogHasCurrentEntry:t})=>{let e=IC();SC(e,t),OC()},kC=require.main===module;kC&&ld({checkChangelogHasCurrentEntry:!1});var dd=ld;var Ue,li=class{initialise(e){}},js=class extends li{constructor(r){super();this.options=r;this.ftpClient=new pd.default;this.host=process.env.REPO_HOST||"localhost";this.port=Number(process.env.REPO_PORT)||21;this.user=process.env.REPO_USER||"anonymous";this.password=process.env.REPO_PASS||"anonymous@";this.getSourceDir=()=>{let r="/.pc-tools/nrfconnect-apps";return process.env.REPO_DIR?process.env.REPO_DIR:this.options.deployOfficial?r:`${r}/${this.options.source}`};this.getSourceUrl=()=>process.env.REPO_URL?process.env.REPO_URL:`https://developer.nordicsemi.com${this.sourceDir}`;this.connect=()=>new Promise((r,n)=>{console.log(`Connecting to ftp://${this.user}@${this.host}:${this.port}`),this.ftpClient.once("error",i=>{this.ftpClient.removeAllListeners("ready"),n(i)}),this.ftpClient.once("ready",()=>{this.ftpClient.removeAllListeners("error"),r()}),this.ftpClient.connect({host:this.host,port:this.port,user:this.user,password:this.password})});this.changeWorkingDirectory=()=>new Promise((r,n)=>{console.log(`Changing to directory ${this.sourceDir}`),this.ftpClient.cwd(this.sourceDir,i=>{i?n(new Error(`
34
+ Error: Failed to change to directory. Check whether it exists on the FTP server.`)):r()})});this.initialise=async()=>{await this.connect(),await this.changeWorkingDirectory()};this.download=r=>new Promise((n,i)=>{console.log(`Downloading file ${r}`);let s="";this.ftpClient.get(r,(a,o)=>{if(a)return i(a);o.once("close",()=>n(s)),o.on("data",u=>{s+=u})})});this.upload=(r,n)=>new Promise((i,s)=>{console.log(`Uploading file ${n}`),this.ftpClient.put(r,n,a=>a?s(a):i())});this.uploadContent=this.upload;this.uploadLocalFile=this.upload;this.end=()=>this.ftpClient.end();this.sourceDir=this.getSourceDir(),this.sourceUrl=this.getSourceUrl()}},Ls=class extends li{constructor(r){super();this.options=r;this.token=process.env.ARTIFACTORY_TOKEN;this.filesWhereCacheZappingFailed=[];this.getAccessLevel=()=>this.options.accessLevel!=null?this.options.accessLevel:this.options.deployOfficial?"external":"internal";this.download=async r=>{console.log(`Downloading ${r}`);let n=`${this.sourceUrl}/${r}`,i=await fetch(n,{headers:{Authorization:`Bearer ${this.token}`}});if(!i.ok)throw new Error(`Failed to download ${n}: ${i.statusText}`);return i.text()};this.zapCache=async r=>{let n=`${this.cacheUrl}/${r}`,i=await fetch(n,{method:"DELETE",headers:{Authorization:`Bearer ${this.token}`}});i.ok||i.status===404||this.filesWhereCacheZappingFailed.push(`${this.folderName}/${r}`)};this.upload=async(r,n)=>{let i=`${this.uploadUrl}/${n}`,s=await fetch(i,{method:"PUT",body:r,headers:{Authorization:`Bearer ${this.token}`}});if(!s.ok)throw new Error(`Failed to upload ${i}: ${s.statusText}`);await this.zapCache(n)};this.uploadContent=(r,n)=>(console.log(`Uploading content for ${n}`),this.upload(r,n));this.uploadLocalFile=(r,n)=>(console.log(`Uploading local file ${r} as ${n}`),this.upload(dr.default.readFileSync(r),n));this.end=()=>{this.filesWhereCacheZappingFailed.length>0&&(console.warn(`
35
+ Cache zapping failed for these files, probably because your Artifactory token lacks permission for it:`),this.filesWhereCacheZappingFailed.forEach(r=>{console.warn(`- ${r}`)}),console.warn(`
36
+ Go to https://github.com/NordicSemiconductor/pc-nrfconnect-shared/actions/workflows/zap-cache.yml, run the workflow and paste this string as the list of paths to zap them manually:`),console.warn(" ",this.filesWhereCacheZappingFailed.join(", ")))};if(this.token==null)throw new Error("The environment variable ARTIFACTORY_TOKEN must be set.");this.folderName=`${this.getAccessLevel()}/ncd/apps/${r.source}`,this.uploadUrl=`https://files.nordicsemi.com/artifactory/swtools/${this.folderName}`,this.sourceUrl=`https://files.nordicsemi.com/ui/api/v1/download?isNativeBrowsing=false&repoKey=swtools&path=${this.folderName}`,this.cacheUrl=`https://files.nordicsemi.cn/artifactory/swtools-cache/${this.folderName}`}},NC=t=>t!=null&&typeof t=="object"&&"message"in t,di=t=>NC(t)?t.message:String(t),Ed=["external","external-confidential","internal","internal-confidential"],RC=t=>Ed.includes(t),PC=t=>{let e=t.match(/(?<source>.*?)\s*\((?<accessLevel>.*)\)/);if(e==null)return{source:t};let{source:r,accessLevel:n}=e.groups;if(!RC(n))throw new Error(`The specified access level "${n}" must be one of ${Ed.join(", ")}.`);return{source:r,accessLevel:n}},$C=()=>{bi.description("Publish an nRF Connect for Desktop app").requiredOption("-s, --source <source>",'Specify the source to publish (e.g. "official" or "releast-test"). When publishing to Artifactory, an access level can be specified at the end in parantheses (e.g. "official (external)").').addOption(new sa("-d, --destination <ftp|artifactory>","Specify where to publish.").choices(["ftp","artifactory"]).makeOptionMandatory()).option("-n, --no-pack","Publish existing .tgz file at the root directory without npm pack.").parse();let t=bi.opts(),{source:e,accessLevel:r}=PC(t.source),n=e==="official";return{doPack:t.pack,source:e,deployOfficial:n,destination:t.destination,accessLevel:r}},ZC=()=>JSON.parse(dr.default.readFileSync("./package.json","utf-8")),jC=()=>{console.log("Packing current package"),(0,hd.execSync)("npm pack")},LC=t=>{if(!dr.default.existsSync(t))throw new Error(`Package \`${t}\` to publish is not found`)},qC=t=>{try{return(0,Fd.default)(dr.default.readFileSync(t))}catch(e){throw new Error(`Unable to read file when verifying shasum: ${t}.
35
37
  Error: ${di(e)}`)}},MC=t=>{let e=ZC(),{name:r,version:n}=e,i=`${r}-${n}.tgz`;t.doPack?jC():LC(i);let s=qC(i);return console.log(`Package name: ${r} version: ${n}`),{name:r,version:n,filename:i,shasum:s,sourceUrl:Ue.sourceUrl,isOfficial:t.deployOfficial,appInfoName:`${r}.json`,releaseNotesFilename:`${r}-Changelog.md`,iconFilename:`${r}.svg`,packageJson:e}},VC=(t,e)=>{if(t!=null&&(console.log(`Latest published version ${t}`),Ad.default.lte(e.version,t)&&e.isOfficial))throw new Error("Current package version cannot be published, bump it higher")},UC=async()=>{let t;try{t=await Ue.download("source.json");let e=JSON.parse(t);if(e==null||typeof e!="object"||e.name==null||e.apps!==void 0&&!Array.isArray(e.apps))throw new Error("`source.json` does not have the expected content.");return e}catch(e){let r="Unable to read `source.json` on the server.\nError: ",n=di(e),i=t==null?"":`Content: \`${t}\``;throw new Error(r+n+i)}},HC=async t=>{let e=await UC();return{...e,apps:[...new Set(e.apps).add(`${t.sourceUrl}/${t.appInfoName}`)].sort()}},zC=async t=>{try{let e=await Ue.download(t.appInfoName);return JSON.parse(e)}catch(e){return console.log(`No previous app versions found due to: ${di(e)}`),{}}},fd=()=>{throw new Error("This must never happen, because the properties were already checked before")},WC=async t=>{let e=await zC(t);VC(e.latestVersion,t);let{name:r,displayName:n,description:i,homepage:s,version:a,nrfConnectForDesktop:o}=t.packageJson,u=o?.nrfutil,c=o?.nrfutilCore;return{name:r,displayName:n??fd(),description:i??fd(),homepage:s,iconUrl:`${t.sourceUrl}/${t.iconFilename}`,releaseNotesUrl:`${t.sourceUrl}/${t.releaseNotesFilename}`,latestVersion:a,versions:{...e.versions,[a]:{tarballUrl:`${t.sourceUrl}/${t.filename}`,publishTimestamp:new Date().toISOString(),shasum:t.shasum,nrfutilModules:u,nrfutilCore:c}}}},GC=t=>Ue.uploadContent(Buffer.from(JSON.stringify(t,void 0,2)),"source.json"),JC=(t,e)=>Ue.uploadContent(Buffer.from(JSON.stringify(e,void 0,2)),t.appInfoName),KC=t=>Ue.uploadLocalFile(t.filename,t.filename),YC=t=>{let e="Changelog.md";if(!dr.default.existsSync(e)){let r=`There should be a changelog called "${e}". Please provide it!`;return Promise.reject(new Error(r))}return Ue.uploadLocalFile(e,t.releaseNotesFilename)},XC=t=>{let e="resources/icon.svg";if(!dr.default.existsSync(e)){let r=`There must be an icon called "${e}". Please provide it!`;return Promise.reject(new Error(r))}return Ue.uploadLocalFile(e,t.iconFilename)},QC=async()=>{try{let t=$C();Ue=t.destination==="ftp"?new js(t):new Ls(t),dd({checkChangelogHasCurrentEntry:t.deployOfficial});let e=MC(t);await Ue.initialise(t);let r=await HC(e),n=await WC(e);await YC(e),await XC(e),await KC(e),await JC(e,n),await GC(r),console.log("Done")}catch(t){console.error(di(t)),process.exitCode=1}Ue?.end()};QC();
36
38
  /*! Bundled license information:
37
39