@fern-api/typescript-dynamic-snippets 3.107.6 → 3.107.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var Hr=Object.defineProperty;var ws=(n,e,t)=>e in n?Hr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ot=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var ae=(n,e)=>{for(var t in e)Hr(n,t,{get:e[t],enumerable:!0})};var E=(n,e,t)=>ws(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};ae(v,{_debugEnd:()=>Mn,_debugProcess:()=>jn,_events:()=>ei,_eventsCount:()=>ti,_exiting:()=>xn,_fatalExceptions:()=>On,_getActiveHandles:()=>_n,_getActiveRequests:()=>wn,_kill:()=>An,_linkedBinding:()=>yn,_maxListeners:()=>Qn,_preload_modules:()=>Jn,_rawDebug:()=>mn,_startProfilerIdleNotifier:()=>Un,_stopProfilerIdleNotifier:()=>$n,_tickCallback:()=>Pn,abort:()=>qn,addListener:()=>ri,allowedNodeEnvironmentFlags:()=>Sn,arch:()=>Qr,argv:()=>rn,argv0:()=>Yn,assert:()=>Cn,binding:()=>un,browser:()=>fn,chdir:()=>pn,config:()=>vn,cpuUsage:()=>Yt,cwd:()=>cn,debugPort:()=>Hn,default:()=>pi,dlopen:()=>bn,domain:()=>gn,emit:()=>oi,emitWarning:()=>on,env:()=>tn,execArgv:()=>nn,execPath:()=>Gn,exit:()=>Rn,features:()=>Fn,hasUncaughtExceptionCaptureCallback:()=>Ln,hrtime:()=>Ht,kill:()=>kn,listeners:()=>ci,memoryUsage:()=>In,moduleLoadList:()=>hn,nextTick:()=>Jr,off:()=>ii,on:()=>we,once:()=>ni,openStdin:()=>Nn,pid:()=>zn,platform:()=>en,ppid:()=>Zn,prependListener:()=>ui,prependOnceListener:()=>li,reallyExit:()=>Tn,release:()=>dn,removeAllListeners:()=>si,removeListener:()=>ai,resourceUsage:()=>En,setSourceMapsEnabled:()=>Kn,setUncaughtExceptionCaptureCallback:()=>Bn,stderr:()=>Vn,stdin:()=>Wn,stdout:()=>Dn,title:()=>Xr,umask:()=>ln,uptime:()=>Xn,version:()=>an,versions:()=>sn});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function _s(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Gt=-1,be.length&&Yr())}function Yr(){if(!ut){var n=setTimeout(_s,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Gt<e;)Pe&&Pe[Gt].run();Gt=-1,e=be.length}Pe=null,ut=!1,clearTimeout(n)}}function Jr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Kr(n,e)),be.length===1&&!ut&&setTimeout(Yr,0)}function Kr(n,e){this.fun=n,this.array=e}function Q(){}function yn(n){hr("_linkedBinding")}function bn(n){hr("dlopen")}function wn(){return[]}function _n(){return[]}function Cn(n,e){if(!n)throw new Error(e||"assertion error")}function Ln(){return!1}function Xn(){return Ne.now()/1e3}function Ht(n){var e=Math.floor((Date.now()-Ne.now())*.001),t=Ne.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=mr)),[r,a]}function we(){return pi}function ci(n){return[]}var be,ut,Pe,Gt,Xr,Qr,en,tn,rn,nn,an,sn,on,un,ln,cn,pn,dn,fn,mn,hn,gn,xn,vn,Tn,An,Yt,En,In,kn,Rn,Nn,Sn,Fn,On,Bn,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Hn,Yn,Jn,Kn,Ne,fr,mr,Qn,ei,ti,ri,ni,ii,ai,si,oi,ui,li,pi,di=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Gt=-1;Kr.prototype.run=function(){this.fun.apply(null,this.array)};Xr="browser",Qr="x64",en="browser",tn={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},rn=["/usr/bin/node"],nn=[],an="v16.8.0",sn={},on=function(n,e){console.warn((e?e+": ":"")+n)},un=function(n){hr("binding")},ln=function(n){return 0},cn=function(){return"/"},pn=function(n){},dn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};fn=!0,mn=Q,hn=[];gn={},xn=!1,vn={};Tn=Q,An=Q,Yt=function(){return{}},En=Yt,In=Yt,kn=Q,Rn=Q,Nn=Q,Sn={};Fn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},On=Q,Bn=Q;Pn=Q,jn=Q,Mn=Q,Un=Q,$n=Q,Dn=void 0,Vn=void 0,Wn=void 0,qn=Q,zn=2,Zn=1,Gn="/bin/usr/node",Hn=9229,Yn="node",Jn=[],Kn=Q,Ne={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ne.now===void 0&&(fr=Date.now(),Ne.timing&&Ne.timing.navigationStart&&(fr=Ne.timing.navigationStart),Ne.now=()=>Date.now()-fr);mr=1e9;Ht.bigint=function(n){var e=Ht(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Qn=10,ei={},ti=0;ri=we,ni=we,ii=we,ai=we,si=we,oi=Q,ui=we,li=we;pi={version:an,versions:sn,arch:Qr,platform:en,browser:fn,release:dn,_rawDebug:mn,moduleLoadList:hn,binding:un,_linkedBinding:yn,_events:ei,_eventsCount:ti,_maxListeners:Qn,on:we,addListener:ri,once:ni,off:ii,removeListener:ai,removeAllListeners:si,emit:oi,prependListener:ui,prependOnceListener:li,listeners:ci,domain:gn,_exiting:xn,config:vn,dlopen:bn,uptime:Xn,_getActiveRequests:wn,_getActiveHandles:_n,reallyExit:Tn,_kill:An,cpuUsage:Yt,resourceUsage:En,memoryUsage:In,kill:kn,exit:Rn,openStdin:Nn,allowedNodeEnvironmentFlags:Sn,assert:Cn,features:Fn,_fatalExceptions:On,setUncaughtExceptionCaptureCallback:Bn,hasUncaughtExceptionCaptureCallback:Ln,emitWarning:on,nextTick:Jr,_tickCallback:Pn,_debugProcess:jn,_debugEnd:Mn,_startProfilerIdleNotifier:Un,_stopProfilerIdleNotifier:$n,stdout:Dn,stdin:Wn,stderr:Vn,abort:qn,umask:ln,chdir:pn,cwd:cn,env:tn,title:Xr,argv:rn,execArgv:nn,pid:zn,ppid:Zn,execPath:Gn,debugPort:Hn,hrtime:Ht,argv0:Yn,_preload_modules:Jn,setSourceMapsEnabled:Kn}});var d=ot(()=>{"use strict";di()});function Ts(){if(fi)return Rt;fi=!0,Rt.byteLength=h,Rt.toByteArray=A,Rt.fromByteArray=J;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var j=C.length;if(j%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var D=C.indexOf("=");D===-1&&(D=j);var Y=D===j?0:4-D%4;return[D,Y]}function h(C){var j=u(C),D=j[0],Y=j[1];return(D+Y)*3/4-Y}function x(C,j,D){return(j+D)*3/4-D}function A(C){var j,D=u(C),Y=D[0],re=D[1],H=new t(x(C,Y,re)),ne=0,ue=re>0?Y-4:Y,te;for(te=0;te<ue;te+=4)j=e[C.charCodeAt(te)]<<18|e[C.charCodeAt(te+1)]<<12|e[C.charCodeAt(te+2)]<<6|e[C.charCodeAt(te+3)],H[ne++]=j>>16&255,H[ne++]=j>>8&255,H[ne++]=j&255;return re===2&&(j=e[C.charCodeAt(te)]<<2|e[C.charCodeAt(te+1)]>>4,H[ne++]=j&255),re===1&&(j=e[C.charCodeAt(te)]<<10|e[C.charCodeAt(te+1)]<<4|e[C.charCodeAt(te+2)]>>2,H[ne++]=j>>8&255,H[ne++]=j&255),H}function N(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function O(C,j,D){for(var Y,re=[],H=j;H<D;H+=3)Y=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(N(Y));return re.join("")}function J(C){for(var j,D=C.length,Y=D%3,re=[],H=16383,ne=0,ue=D-Y;ne<ue;ne+=H)re.push(O(C,ne,ne+H>ue?ue:ne+H));return Y===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):Y===2&&(j=(C[D-2]<<8)+C[D-1],re.push(n[j>>10]+n[j>>4&63]+n[j<<2&63]+"=")),re.join("")}return Rt}function As(){if(mi)return Jt;mi=!0;return Jt.read=function(n,e,t,r,a){var o,u,h=a*8-r-1,x=(1<<h)-1,A=x>>1,N=-7,O=t?a-1:0,J=t?-1:1,C=n[e+O];for(O+=J,o=C&(1<<-N)-1,C>>=-N,N+=h;N>0;o=o*256+n[e+O],O+=J,N-=8);for(u=o&(1<<-N)-1,o>>=-N,N+=r;N>0;u=u*256+n[e+O],O+=J,N-=8);if(o===0)o=1-A;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-A}return(C?-1:1)*u*Math.pow(2,o-r)},Jt.write=function(n,e,t,r,a,o){var u,h,x,A=o*8-a-1,N=(1<<A)-1,O=N>>1,J=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:o-1,j=r?1:-1,D=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,u=N):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+O>=1?e+=J/x:e+=J*Math.pow(2,1-O),e*x>=2&&(u++,x/=2),u+O>=N?(h=0,u=N):u+O>=1?(h=(e*x-1)*Math.pow(2,a),u=u+O):(h=e*Math.pow(2,O-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=h&255,C+=j,h/=256,a-=8);for(u=u<<a|h,A+=a;A>0;n[t+C]=u&255,C+=j,u/=256,A-=8);n[t+C-j]|=D*128},Jt}function yi(){if(hi)return je;hi=!0;let n=Ts(),e=As(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer=u,je.SlowBuffer=re,je.INSPECT_MAX_BYTES=50;let r=2147483647;je.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let l=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(l,i),l.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(l){if(l>r)throw new RangeError('The value "'+l+'" is invalid for option "size"');let i=new Uint8Array(l);return Object.setPrototypeOf(i,u.prototype),i}function u(l,i,s){if(typeof l=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(l)}return h(l,i,s)}u.poolSize=8192;function h(l,i,s){if(typeof l=="string")return O(l,i);if(ArrayBuffer.isView(l))return C(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(he(l,ArrayBuffer)||l&&he(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(l,SharedArrayBuffer)||l&&he(l.buffer,SharedArrayBuffer)))return j(l,i,s);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return u.from(c,i,s);let y=D(l);if(y)return y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return u.from(l[Symbol.toPrimitive]("string"),i,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}u.from=function(l,i,s){return h(l,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function A(l,i,s){return x(l),l<=0?o(l):i!==void 0?typeof s=="string"?o(l).fill(i,s):o(l).fill(i):o(l)}u.alloc=function(l,i,s){return A(l,i,s)};function N(l){return x(l),o(l<0?0:Y(l)|0)}u.allocUnsafe=function(l){return N(l)},u.allocUnsafeSlow=function(l){return N(l)};function O(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(l,i)|0,c=o(s),y=c.write(l,i);return y!==s&&(c=c.slice(0,y)),c}function J(l){let i=l.length<0?0:Y(l.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=l[c]&255;return s}function C(l){if(he(l,Uint8Array)){let i=new Uint8Array(l);return j(i.buffer,i.byteOffset,i.byteLength)}return J(l)}function j(l,i,s){if(i<0||l.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let c;return i===void 0&&s===void 0?c=new Uint8Array(l):s===void 0?c=new Uint8Array(l,i):c=new Uint8Array(l,i,s),Object.setPrototypeOf(c,u.prototype),c}function D(l){if(u.isBuffer(l)){let i=Y(l.length)|0,s=o(i);return s.length===0||l.copy(s,0,0,i),s}if(l.length!==void 0)return typeof l.length!="number"||dr(l.length)?o(0):J(l);if(l.type==="Buffer"&&Array.isArray(l.data))return J(l.data)}function Y(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function re(l){return+l!=l&&(l=0),u.alloc(+l)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,s){if(he(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),he(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(i)||!u.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===s)return 0;let c=i.length,y=s.length;for(let g=0,_=Math.min(c,y);g<_;++g)if(i[g]!==s[g]){c=i[g],y=s[g];break}return c<y?-1:y<c?1:0},u.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let y=u.allocUnsafe(s),g=0;for(c=0;c<i.length;++c){let _=i[c];if(he(_,Uint8Array))g+_.length>y.length?(u.isBuffer(_)||(_=u.from(_)),_.copy(y,g)):Uint8Array.prototype.set.call(y,_,g);else if(u.isBuffer(_))_.copy(y,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=_.length}return y};function H(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||he(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let s=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&s===0)return 0;let y=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return pr(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Gr(l).length;default:if(y)return c?-1:pr(l).length;i=(""+i).toLowerCase(),y=!0}}u.byteLength=H;function ne(l,i,s){let c=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,i>>>=0,s<=i))return"";for(l||(l="utf8");;)switch(l){case"hex":return ds(this,i,s);case"utf8":case"utf-8":return Mr(this,i,s);case"ascii":return cs(this,i,s);case"latin1":case"binary":return ps(this,i,s);case"base64":return us(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fs(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ue(l,i,s){let c=l[i];l[i]=l[s],l[s]=c}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<i;s+=2)ue(this,s,s+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<i;s+=4)ue(this,s,s+3),ue(this,s+1,s+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<i;s+=8)ue(this,s,s+7),ue(this,s+1,s+6),ue(this,s+2,s+5),ue(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Mr(this,0,i):ne.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",s=je.INSPECT_MAX_BYTES;return i=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,s,c,y,g){if(he(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(s===void 0&&(s=0),c===void 0&&(c=i?i.length:0),y===void 0&&(y=0),g===void 0&&(g=this.length),s<0||c>i.length||y<0||g>this.length)throw new RangeError("out of range index");if(y>=g&&s>=c)return 0;if(y>=g)return-1;if(s>=c)return 1;if(s>>>=0,c>>>=0,y>>>=0,g>>>=0,this===i)return 0;let _=g-y,M=c-s,Z=Math.min(_,M),z=this.slice(y,g),G=i.slice(s,c);for(let V=0;V<Z;++V)if(z[V]!==G[V]){_=z[V],M=G[V];break}return _<M?-1:M<_?1:0};function te(l,i,s,c,y){if(l.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,dr(s)&&(s=y?0:l.length-1),s<0&&(s=l.length+s),s>=l.length){if(y)return-1;s=l.length-1}else if(s<0)if(y)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:jr(l,i,s,c,y);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?y?Uint8Array.prototype.indexOf.call(l,i,s):Uint8Array.prototype.lastIndexOf.call(l,i,s):jr(l,[i],s,c,y);throw new TypeError("val must be string, number or Buffer")}function jr(l,i,s,c,y){let g=1,_=l.length,M=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||i.length<2)return-1;g=2,_/=2,M/=2,s/=2}function Z(G,V){return g===1?G[V]:G.readUInt16BE(V*g)}let z;if(y){let G=-1;for(z=s;z<_;z++)if(Z(l,z)===Z(i,G===-1?0:z-G)){if(G===-1&&(G=z),z-G+1===M)return G*g}else G!==-1&&(z-=z-G),G=-1}else for(s+M>_&&(s=_-M),z=s;z>=0;z--){let G=!0;for(let V=0;V<M;V++)if(Z(l,z+V)!==Z(i,V)){G=!1;break}if(G)return z}return-1}u.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},u.prototype.indexOf=function(i,s,c){return te(this,i,s,c,!0)},u.prototype.lastIndexOf=function(i,s,c){return te(this,i,s,c,!1)};function ns(l,i,s,c){s=Number(s)||0;let y=l.length-s;c?(c=Number(c),c>y&&(c=y)):c=y;let g=i.length;c>g/2&&(c=g/2);let _;for(_=0;_<c;++_){let M=parseInt(i.substr(_*2,2),16);if(dr(M))return _;l[s+_]=M}return _}function is(l,i,s,c){return Zt(pr(i,l.length-s),l,s,c)}function as(l,i,s,c){return Zt(gs(i),l,s,c)}function ss(l,i,s,c){return Zt(Gr(i),l,s,c)}function os(l,i,s,c){return Zt(xs(i,l.length-s),l,s,c)}u.prototype.write=function(i,s,c,y){if(s===void 0)y="utf8",c=this.length,s=0;else if(c===void 0&&typeof s=="string")y=s,c=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(c)?(c=c>>>0,y===void 0&&(y="utf8")):(y=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-s;if((c===void 0||c>g)&&(c=g),i.length>0&&(c<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");y||(y="utf8");let _=!1;for(;;)switch(y){case"hex":return ns(this,i,s,c);case"utf8":case"utf-8":return is(this,i,s,c);case"ascii":case"latin1":case"binary":return as(this,i,s,c);case"base64":return ss(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return os(this,i,s,c);default:if(_)throw new TypeError("Unknown encoding: "+y);y=(""+y).toLowerCase(),_=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function us(l,i,s){return i===0&&s===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,s))}function Mr(l,i,s){s=Math.min(l.length,s);let c=[],y=i;for(;y<s;){let g=l[y],_=null,M=g>239?4:g>223?3:g>191?2:1;if(y+M<=s){let Z,z,G,V;switch(M){case 1:g<128&&(_=g);break;case 2:Z=l[y+1],(Z&192)===128&&(V=(g&31)<<6|Z&63,V>127&&(_=V));break;case 3:Z=l[y+1],z=l[y+2],(Z&192)===128&&(z&192)===128&&(V=(g&15)<<12|(Z&63)<<6|z&63,V>2047&&(V<55296||V>57343)&&(_=V));break;case 4:Z=l[y+1],z=l[y+2],G=l[y+3],(Z&192)===128&&(z&192)===128&&(G&192)===128&&(V=(g&15)<<18|(Z&63)<<12|(z&63)<<6|G&63,V>65535&&V<1114112&&(_=V))}}_===null?(_=65533,M=1):_>65535&&(_-=65536,c.push(_>>>10&1023|55296),_=56320|_&1023),c.push(_),y+=M}return ls(c)}let Ur=4096;function ls(l){let i=l.length;if(i<=Ur)return String.fromCharCode.apply(String,l);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,l.slice(c,c+=Ur));return s}function cs(l,i,s){let c="";s=Math.min(l.length,s);for(let y=i;y<s;++y)c+=String.fromCharCode(l[y]&127);return c}function ps(l,i,s){let c="";s=Math.min(l.length,s);for(let y=i;y<s;++y)c+=String.fromCharCode(l[y]);return c}function ds(l,i,s){let c=l.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let y="";for(let g=i;g<s;++g)y+=vs[l[g]];return y}function fs(l,i,s){let c=l.slice(i,s),y="";for(let g=0;g<c.length-1;g+=2)y+=String.fromCharCode(c[g]+c[g+1]*256);return y}u.prototype.slice=function(i,s){let c=this.length;i=~~i,s=s===void 0?c:~~s,i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),s<0?(s+=c,s<0&&(s=0)):s>c&&(s=c),s<i&&(s=i);let y=this.subarray(i,s);return Object.setPrototypeOf(y,u.prototype),y};function K(l,i,s){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||K(i,s,this.length);let y=this[i],g=1,_=0;for(;++_<s&&(g*=256);)y+=this[i+_]*g;return y},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||K(i,s,this.length);let y=this[i+--s],g=1;for(;s>0&&(g*=256);)y+=this[i+--s]*g;return y},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||K(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||K(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||K(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||K(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&kt(i,this.length-8);let y=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,g=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(y)+(BigInt(g)<<BigInt(32))}),u.prototype.readBigUInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&kt(i,this.length-8);let y=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],g=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(y)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||K(i,s,this.length);let y=this[i],g=1,_=0;for(;++_<s&&(g*=256);)y+=this[i+_]*g;return g*=128,y>=g&&(y-=Math.pow(2,8*s)),y},u.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||K(i,s,this.length);let y=s,g=1,_=this[i+--y];for(;y>0&&(g*=256);)_+=this[i+--y]*g;return g*=128,_>=g&&(_-=Math.pow(2,8*s)),_},u.prototype.readInt8=function(i,s){return i=i>>>0,s||K(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||K(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||K(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},u.prototype.readInt32LE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,s){return i=i>>>0,s||K(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&kt(i,this.length-8);let y=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(y)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Re(function(i){i=i>>>0,st(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&kt(i,this.length-8);let y=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(y)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c)}),u.prototype.readFloatLE=function(i,s){return i=i>>>0,s||K(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||K(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||K(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||K(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,s,c,y,g){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>y||i<g)throw new RangeError('"value" argument is out of bounds');if(s+c>l.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,c,y){if(i=+i,s=s>>>0,c=c>>>0,!y){let M=Math.pow(2,8*c)-1;ie(this,i,s,c,M,0)}let g=1,_=0;for(this[s]=i&255;++_<c&&(g*=256);)this[s+_]=i/g&255;return s+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,c,y){if(i=+i,s=s>>>0,c=c>>>0,!y){let M=Math.pow(2,8*c)-1;ie(this,i,s,c,M,0)}let g=c-1,_=1;for(this[s+g]=i&255;--g>=0&&(_*=256);)this[s+g]=i/_&255;return s+c},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s+3]=i>>>24,this[s+2]=i>>>16,this[s+1]=i>>>8,this[s]=i&255,s+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4};function $r(l,i,s,c,y){Zr(i,c,y,l,s,7);let g=Number(i&BigInt(4294967295));l[s++]=g,g=g>>8,l[s++]=g,g=g>>8,l[s++]=g,g=g>>8,l[s++]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return l[s++]=_,_=_>>8,l[s++]=_,_=_>>8,l[s++]=_,_=_>>8,l[s++]=_,s}function Dr(l,i,s,c,y){Zr(i,c,y,l,s,7);let g=Number(i&BigInt(4294967295));l[s+7]=g,g=g>>8,l[s+6]=g,g=g>>8,l[s+5]=g,g=g>>8,l[s+4]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return l[s+3]=_,_=_>>8,l[s+2]=_,_=_>>8,l[s+1]=_,_=_>>8,l[s]=_,s+8}u.prototype.writeBigUInt64LE=Re(function(i,s=0){return $r(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,s=0){return Dr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,c,y){if(i=+i,s=s>>>0,!y){let Z=Math.pow(2,8*c-1);ie(this,i,s,c,Z-1,-Z)}let g=0,_=1,M=0;for(this[s]=i&255;++g<c&&(_*=256);)i<0&&M===0&&this[s+g-1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+c},u.prototype.writeIntBE=function(i,s,c,y){if(i=+i,s=s>>>0,!y){let Z=Math.pow(2,8*c-1);ie(this,i,s,c,Z-1,-Z)}let g=c-1,_=1,M=0;for(this[s+g]=i&255;--g>=0&&(_*=256);)i<0&&M===0&&this[s+g+1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+c},u.prototype.writeInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,127,-128),i<0&&(i=255+i+1),this[s]=i&255,s+1},u.prototype.writeInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),this[s]=i&255,this[s+1]=i>>>8,this[s+2]=i>>>16,this[s+3]=i>>>24,s+4},u.prototype.writeInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4},u.prototype.writeBigInt64LE=Re(function(i,s=0){return $r(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,s=0){return Dr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Vr(l,i,s,c,y,g){if(s+c>l.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Wr(l,i,s,c,y){return i=+i,s=s>>>0,y||Vr(l,i,s,4),e.write(l,i,s,c,23,4),s+4}u.prototype.writeFloatLE=function(i,s,c){return Wr(this,i,s,!0,c)},u.prototype.writeFloatBE=function(i,s,c){return Wr(this,i,s,!1,c)};function qr(l,i,s,c,y){return i=+i,s=s>>>0,y||Vr(l,i,s,8),e.write(l,i,s,c,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,c){return qr(this,i,s,!0,c)},u.prototype.writeDoubleBE=function(i,s,c){return qr(this,i,s,!1,c)},u.prototype.copy=function(i,s,c,y){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!y&&y!==0&&(y=this.length),s>=i.length&&(s=i.length),s||(s=0),y>0&&y<c&&(y=c),y===c||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("sourceEnd out of bounds");y>this.length&&(y=this.length),i.length-s<y-c&&(y=i.length-s+c);let g=y-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,c,y):Uint8Array.prototype.set.call(i,this.subarray(c,y),s),g},u.prototype.fill=function(i,s,c,y){if(typeof i=="string"){if(typeof s=="string"?(y=s,s=0,c=this.length):typeof c=="string"&&(y=c,c=this.length),y!==void 0&&typeof y!="string")throw new TypeError("encoding must be a string");if(typeof y=="string"&&!u.isEncoding(y))throw new TypeError("Unknown encoding: "+y);if(i.length===1){let _=i.charCodeAt(0);(y==="utf8"&&_<128||y==="latin1")&&(i=_)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(s<0||this.length<s||this.length<c)throw new RangeError("Out of range index");if(c<=s)return this;s=s>>>0,c=c===void 0?this.length:c>>>0,i||(i=0);let g;if(typeof i=="number")for(g=s;g<c;++g)this[g]=i;else{let _=u.isBuffer(i)?i:u.from(i,y),M=_.length;if(M===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(g=0;g<c-s;++g)this[g+s]=_[g%M]}return this};let at={};function cr(l,i,s){at[l]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:y,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}cr("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),cr("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),cr("ERR_OUT_OF_RANGE",function(l,i,s){let c=`The value of "${l}" is out of range.`,y=s;return Number.isInteger(s)&&Math.abs(s)>2**32?y=zr(String(s)):typeof s=="bigint"&&(y=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(y=zr(y)),y+="n"),c+=` It must be ${i}. Received ${y}`,c},RangeError);function zr(l){let i="",s=l.length,c=l[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${l.slice(s-3,s)}${i}`;return`${l.slice(0,s)}${i}`}function ms(l,i,s){st(i,"offset"),(l[i]===void 0||l[i+s]===void 0)&&kt(i,l.length-(s+1))}function Zr(l,i,s,c,y,g){if(l>s||l<i){let _=typeof i=="bigint"?"n":"",M;throw i===0||i===BigInt(0)?M=`>= 0${_} and < 2${_} ** ${(g+1)*8}${_}`:M=`>= -(2${_} ** ${(g+1)*8-1}${_}) and < 2 ** ${(g+1)*8-1}${_}`,new at.ERR_OUT_OF_RANGE("value",M,l)}ms(c,y,g)}function st(l,i){if(typeof l!="number")throw new at.ERR_INVALID_ARG_TYPE(i,"number",l)}function kt(l,i,s){throw Math.floor(l)!==l?(st(l,s),new at.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let hs=/[^+/0-9A-Za-z-_]/g;function ys(l){if(l=l.split("=")[0],l=l.trim().replace(hs,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function pr(l,i){i=i||1/0;let s,c=l.length,y=null,g=[];for(let _=0;_<c;++_){if(s=l.charCodeAt(_),s>55295&&s<57344){if(!y){if(s>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(_+1===c){(i-=3)>-1&&g.push(239,191,189);continue}y=s;continue}if(s<56320){(i-=3)>-1&&g.push(239,191,189),y=s;continue}s=(y-55296<<10|s-56320)+65536}else y&&(i-=3)>-1&&g.push(239,191,189);if(y=null,s<128){if((i-=1)<0)break;g.push(s)}else if(s<2048){if((i-=2)<0)break;g.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;g.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;g.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return g}function gs(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function xs(l,i){let s,c,y,g=[];for(let _=0;_<l.length&&!((i-=2)<0);++_)s=l.charCodeAt(_),c=s>>8,y=s%256,g.push(y),g.push(c);return g}function Gr(l){return n.toByteArray(ys(l))}function Zt(l,i,s,c){let y;for(y=0;y<c&&!(y+s>=i.length||y>=l.length);++y)i[y+s]=l[y];return y}function he(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function dr(l){return l!==l}let vs=(function(){let l="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let c=s*16;for(let y=0;y<16;++y)i[c+y]=l[s]+l[y]}return i})();function Re(l){return typeof BigInt>"u"?bs:l}function bs(){throw new Error("BigInt not supported")}return je}var Rt,fi,Jt,mi,je,hi,gi=ot(()=>{"use strict";p();f();d();Rt={},fi=!1;Jt={},mi=!1;je={},hi=!1});var Me,b,sc,oc,xi=ot(()=>{"use strict";p();f();d();gi();Me=yi();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,sc=Me.INSPECT_MAX_BYTES,oc=Me.kMaxLength});var f=ot(()=>{"use strict";xi()});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var Es=typeof global=="object"&&global&&global.Object===Object&&global,vi=Es;var Is=typeof self=="object"&&self&&self.Object===Object&&self,ks=vi||Is||Function("return this")(),bi=ks;var Rs=bi.Symbol,_e=Rs;p();f();d();var wi=Object.prototype,Ns=wi.hasOwnProperty,Ss=wi.toString,Nt=_e?_e.toStringTag:void 0;function Cs(n){var e=Ns.call(n,Nt),t=n[Nt];try{n[Nt]=void 0;var r=!0}catch{}var a=Ss.call(n);return r&&(e?n[Nt]=t:delete n[Nt]),a}var _i=Cs;p();f();d();var Fs=Object.prototype,Os=Fs.toString;function Bs(n){return Os.call(n)}var Ti=Bs;var Ls="[object Null]",Ps="[object Undefined]",Ai=_e?_e.toStringTag:void 0;function js(n){return n==null?n===void 0?Ps:Ls:Ai&&Ai in Object(n)?_i(n):Ti(n)}var Ei=js;p();f();d();function Ms(n){return n!=null&&typeof n=="object"}var Ii=Ms;var Us="[object Symbol]";function $s(n){return typeof n=="symbol"||Ii(n)&&Ei(n)==Us}var ki=$s;p();f();d();p();f();d();function Ds(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var Ri=Ds;p();f();d();var Vs=Array.isArray,Ni=Vs;var Ws=1/0,Si=_e?_e.prototype:void 0,Ci=Si?Si.toString:void 0;function Fi(n){if(typeof n=="string")return n;if(Ni(n))return Ri(n,Fi)+"";if(ki(n))return Ci?Ci.call(n):"";var e=n+"";return e=="0"&&1/n==-Ws?"-0":e}var Oi=Fi;p();f();d();function qs(n){return n==null?"":Oi(n)}var Se=qs;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function zs(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(a);++r<a;)o[r]=n[r+e];return o}var Bi=zs;function Zs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Bi(n,e,t)}var Li=Zs;p();f();d();var Gs="\\ud800-\\udfff",Hs="\\u0300-\\u036f",Ys="\\ufe20-\\ufe2f",Js="\\u20d0-\\u20ff",Ks=Hs+Ys+Js,Xs="\\ufe0e\\ufe0f",Qs="\\u200d",eo=RegExp("["+Qs+Gs+Ks+Xs+"]");function to(n){return eo.test(n)}var Kt=to;p();f();d();p();f();d();function ro(n){return n.split("")}var Pi=ro;p();f();d();var ji="\\ud800-\\udfff",no="\\u0300-\\u036f",io="\\ufe20-\\ufe2f",ao="\\u20d0-\\u20ff",so=no+io+ao,oo="\\ufe0e\\ufe0f",uo="["+ji+"]",yr="["+so+"]",gr="\\ud83c[\\udffb-\\udfff]",lo="(?:"+yr+"|"+gr+")",Mi="[^"+ji+"]",Ui="(?:\\ud83c[\\udde6-\\uddff]){2}",$i="[\\ud800-\\udbff][\\udc00-\\udfff]",co="\\u200d",Di=lo+"?",Vi="["+oo+"]?",po="(?:"+co+"(?:"+[Mi,Ui,$i].join("|")+")"+Vi+Di+")*",fo=Vi+Di+po,mo="(?:"+[Mi+yr+"?",yr,Ui,$i,uo].join("|")+")",ho=RegExp(gr+"(?="+gr+")|"+mo+fo,"g");function yo(n){return n.match(ho)||[]}var Wi=yo;function go(n){return Kt(n)?Wi(n):Pi(n)}var qi=go;function xo(n){return function(e){e=Se(e);var t=Kt(e)?qi(e):void 0,r=t?t[0]:e.charAt(0),a=t?Li(t,1).join(""):e.slice(1);return r[n]()+a}}var zi=xo;var vo=zi("toUpperCase"),Ue=vo;function bo(n){return Ue(Se(n).toLowerCase())}var Zi=bo;p();f();d();p();f();d();function wo(n,e,t,r){var a=-1,o=n==null?0:n.length;for(r&&o&&(t=n[++a]);++a<o;)t=e(t,n[a],a,n);return t}var Gi=wo;p();f();d();p();f();d();p();f();d();function _o(n){return function(e){return n?.[e]}}var Hi=_o;var To={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ao=Hi(To),Yi=Ao;var Eo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Io="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",No=Io+ko+Ro,So="["+No+"]",Co=RegExp(So,"g");function Fo(n){return n=Se(n),n&&n.replace(Eo,Yi).replace(Co,"")}var Ji=Fo;p();f();d();p();f();d();var Oo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Bo(n){return n.match(Oo)||[]}var Ki=Bo;p();f();d();var Lo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Po(n){return Lo.test(n)}var Xi=Po;p();f();d();var na="\\ud800-\\udfff",jo="\\u0300-\\u036f",Mo="\\ufe20-\\ufe2f",Uo="\\u20d0-\\u20ff",$o=jo+Mo+Uo,ia="\\u2700-\\u27bf",aa="a-z\\xdf-\\xf6\\xf8-\\xff",Do="\\xac\\xb1\\xd7\\xf7",Vo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Wo="\\u2000-\\u206f",qo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",sa="A-Z\\xc0-\\xd6\\xd8-\\xde",zo="\\ufe0e\\ufe0f",oa=Do+Vo+Wo+qo,ua="['\u2019]",Qi="["+oa+"]",Zo="["+$o+"]",la="\\d+",Go="["+ia+"]",ca="["+aa+"]",pa="[^"+na+oa+la+ia+aa+sa+"]",Ho="\\ud83c[\\udffb-\\udfff]",Yo="(?:"+Zo+"|"+Ho+")",Jo="[^"+na+"]",da="(?:\\ud83c[\\udde6-\\uddff]){2}",fa="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="["+sa+"]",Ko="\\u200d",ea="(?:"+ca+"|"+pa+")",Xo="(?:"+lt+"|"+pa+")",ta="(?:"+ua+"(?:d|ll|m|re|s|t|ve))?",ra="(?:"+ua+"(?:D|LL|M|RE|S|T|VE))?",ma=Yo+"?",ha="["+zo+"]?",Qo="(?:"+Ko+"(?:"+[Jo,da,fa].join("|")+")"+ha+ma+")*",eu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ru=ha+ma+Qo,nu="(?:"+[Go,da,fa].join("|")+")"+ru,iu=RegExp([lt+"?"+ca+"+"+ta+"(?="+[Qi,lt,"$"].join("|")+")",Xo+"+"+ra+"(?="+[Qi,lt+ea,"$"].join("|")+")",lt+"?"+ea+"+"+ta,lt+"+"+ra,tu,eu,la,nu].join("|"),"g");function au(n){return n.match(iu)||[]}var ya=au;function su(n,e,t){return n=Se(n),e=t?void 0:e,e===void 0?Xi(n)?ya(n):Ki(n):n.match(e)||[]}var ga=su;var ou="['\u2019]",uu=RegExp(ou,"g");function lu(n){return function(e){return Gi(ga(Ji(e).replace(uu,"")),n,"")}}var xa=lu;var cu=xa(function(n,e,t){return e=e.toLowerCase(),n+(t?Zi(e):e)}),St=cu;p();f();d();function q(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();f();d();function Ct(n){return Object.keys(n)}p();f();d();p();f();d();p();f();d();var Ft=v.env.FERN_STACK_TRACK?.toLowerCase()??"",ye=Ft!==""&&Ft!=="0"&&Ft!=="false",xr=["single","multiline","box"].includes(Ft)?Ft:"single";ye&&(Error.stackTraceLimit=50);var pu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),du=new Set(["stacktrace"]);function Qt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:h=x=>x}={}){if(!ye)return[];r=[...r,...pu],t=[...t,...du],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
|
|
2
|
-
`).map(
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function va({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:
|
|
1
|
+
var Hr=Object.defineProperty;var _o=(n,e,t)=>e in n?Hr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var st=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var ae=(n,e)=>{for(var t in e)Hr(n,t,{get:e[t],enumerable:!0})};var A=(n,e,t)=>_o(n,typeof e!="symbol"?e+"":e,t);var p=st(()=>{"use strict"});var v={};ae(v,{_debugEnd:()=>Mn,_debugProcess:()=>jn,_events:()=>ei,_eventsCount:()=>ti,_exiting:()=>xn,_fatalExceptions:()=>On,_getActiveHandles:()=>_n,_getActiveRequests:()=>wn,_kill:()=>En,_linkedBinding:()=>yn,_maxListeners:()=>Qn,_preload_modules:()=>Jn,_rawDebug:()=>mn,_startProfilerIdleNotifier:()=>Un,_stopProfilerIdleNotifier:()=>$n,_tickCallback:()=>Pn,abort:()=>qn,addListener:()=>ri,allowedNodeEnvironmentFlags:()=>Sn,arch:()=>Qr,argv:()=>rn,argv0:()=>Yn,assert:()=>Cn,binding:()=>un,browser:()=>fn,chdir:()=>pn,config:()=>vn,cpuUsage:()=>Yt,cwd:()=>cn,debugPort:()=>Hn,default:()=>pi,dlopen:()=>bn,domain:()=>gn,emit:()=>si,emitWarning:()=>sn,env:()=>tn,execArgv:()=>nn,execPath:()=>Gn,exit:()=>Rn,features:()=>Fn,hasUncaughtExceptionCaptureCallback:()=>Ln,hrtime:()=>Ht,kill:()=>kn,listeners:()=>ci,memoryUsage:()=>In,moduleLoadList:()=>hn,nextTick:()=>Jr,off:()=>ii,on:()=>we,once:()=>ni,openStdin:()=>Nn,pid:()=>zn,platform:()=>en,ppid:()=>Zn,prependListener:()=>ui,prependOnceListener:()=>li,reallyExit:()=>Tn,release:()=>dn,removeAllListeners:()=>oi,removeListener:()=>ai,resourceUsage:()=>An,setSourceMapsEnabled:()=>Kn,setUncaughtExceptionCaptureCallback:()=>Bn,stderr:()=>Vn,stdin:()=>Wn,stdout:()=>Dn,title:()=>Xr,umask:()=>ln,uptime:()=>Xn,version:()=>an,versions:()=>on});function hr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function To(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Gt=-1,be.length&&Yr())}function Yr(){if(!ut){var n=setTimeout(To,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Gt<e;)Pe&&Pe[Gt].run();Gt=-1,e=be.length}Pe=null,ut=!1,clearTimeout(n)}}function Jr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Kr(n,e)),be.length===1&&!ut&&setTimeout(Yr,0)}function Kr(n,e){this.fun=n,this.array=e}function Q(){}function yn(n){hr("_linkedBinding")}function bn(n){hr("dlopen")}function wn(){return[]}function _n(){return[]}function Cn(n,e){if(!n)throw new Error(e||"assertion error")}function Ln(){return!1}function Xn(){return Ne.now()/1e3}function Ht(n){var e=Math.floor((Date.now()-Ne.now())*.001),t=Ne.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=mr)),[r,a]}function we(){return pi}function ci(n){return[]}var be,ut,Pe,Gt,Xr,Qr,en,tn,rn,nn,an,on,sn,un,ln,cn,pn,dn,fn,mn,hn,gn,xn,vn,Tn,En,Yt,An,In,kn,Rn,Nn,Sn,Fn,On,Bn,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Hn,Yn,Jn,Kn,Ne,fr,mr,Qn,ei,ti,ri,ni,ii,ai,oi,si,ui,li,pi,di=st(()=>{"use strict";p();f();d();be=[],ut=!1,Gt=-1;Kr.prototype.run=function(){this.fun.apply(null,this.array)};Xr="browser",Qr="x64",en="browser",tn={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},rn=["/usr/bin/node"],nn=[],an="v16.8.0",on={},sn=function(n,e){console.warn((e?e+": ":"")+n)},un=function(n){hr("binding")},ln=function(n){return 0},cn=function(){return"/"},pn=function(n){},dn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};fn=!0,mn=Q,hn=[];gn={},xn=!1,vn={};Tn=Q,En=Q,Yt=function(){return{}},An=Yt,In=Yt,kn=Q,Rn=Q,Nn=Q,Sn={};Fn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},On=Q,Bn=Q;Pn=Q,jn=Q,Mn=Q,Un=Q,$n=Q,Dn=void 0,Vn=void 0,Wn=void 0,qn=Q,zn=2,Zn=1,Gn="/bin/usr/node",Hn=9229,Yn="node",Jn=[],Kn=Q,Ne={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ne.now===void 0&&(fr=Date.now(),Ne.timing&&Ne.timing.navigationStart&&(fr=Ne.timing.navigationStart),Ne.now=()=>Date.now()-fr);mr=1e9;Ht.bigint=function(n){var e=Ht(n);return typeof BigInt>"u"?e[0]*mr+e[1]:BigInt(e[0]*mr)+BigInt(e[1])};Qn=10,ei={},ti=0;ri=we,ni=we,ii=we,ai=we,oi=we,si=Q,ui=we,li=we;pi={version:an,versions:on,arch:Qr,platform:en,browser:fn,release:dn,_rawDebug:mn,moduleLoadList:hn,binding:un,_linkedBinding:yn,_events:ei,_eventsCount:ti,_maxListeners:Qn,on:we,addListener:ri,once:ni,off:ii,removeListener:ai,removeAllListeners:oi,emit:si,prependListener:ui,prependOnceListener:li,listeners:ci,domain:gn,_exiting:xn,config:vn,dlopen:bn,uptime:Xn,_getActiveRequests:wn,_getActiveHandles:_n,reallyExit:Tn,_kill:En,cpuUsage:Yt,resourceUsage:An,memoryUsage:In,kill:kn,exit:Rn,openStdin:Nn,allowedNodeEnvironmentFlags:Sn,assert:Cn,features:Fn,_fatalExceptions:On,setUncaughtExceptionCaptureCallback:Bn,hasUncaughtExceptionCaptureCallback:Ln,emitWarning:sn,nextTick:Jr,_tickCallback:Pn,_debugProcess:jn,_debugEnd:Mn,_startProfilerIdleNotifier:Un,_stopProfilerIdleNotifier:$n,stdout:Dn,stdin:Wn,stderr:Vn,abort:qn,umask:ln,chdir:pn,cwd:cn,env:tn,title:Xr,argv:rn,execArgv:nn,pid:zn,ppid:Zn,execPath:Gn,debugPort:Hn,hrtime:Ht,argv0:Yn,_preload_modules:Jn,setSourceMapsEnabled:Kn}});var d=st(()=>{"use strict";di()});function Eo(){if(fi)return Rt;fi=!0,Rt.byteLength=h,Rt.toByteArray=E,Rt.fromByteArray=J;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=r.length;a<s;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var j=C.length;if(j%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var D=C.indexOf("=");D===-1&&(D=j);var Y=D===j?0:4-D%4;return[D,Y]}function h(C){var j=u(C),D=j[0],Y=j[1];return(D+Y)*3/4-Y}function x(C,j,D){return(j+D)*3/4-D}function E(C){var j,D=u(C),Y=D[0],re=D[1],H=new t(x(C,Y,re)),ne=0,ue=re>0?Y-4:Y,te;for(te=0;te<ue;te+=4)j=e[C.charCodeAt(te)]<<18|e[C.charCodeAt(te+1)]<<12|e[C.charCodeAt(te+2)]<<6|e[C.charCodeAt(te+3)],H[ne++]=j>>16&255,H[ne++]=j>>8&255,H[ne++]=j&255;return re===2&&(j=e[C.charCodeAt(te)]<<2|e[C.charCodeAt(te+1)]>>4,H[ne++]=j&255),re===1&&(j=e[C.charCodeAt(te)]<<10|e[C.charCodeAt(te+1)]<<4|e[C.charCodeAt(te+2)]>>2,H[ne++]=j>>8&255,H[ne++]=j&255),H}function N(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function O(C,j,D){for(var Y,re=[],H=j;H<D;H+=3)Y=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(N(Y));return re.join("")}function J(C){for(var j,D=C.length,Y=D%3,re=[],H=16383,ne=0,ue=D-Y;ne<ue;ne+=H)re.push(O(C,ne,ne+H>ue?ue:ne+H));return Y===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):Y===2&&(j=(C[D-2]<<8)+C[D-1],re.push(n[j>>10]+n[j>>4&63]+n[j<<2&63]+"=")),re.join("")}return Rt}function Ao(){if(mi)return Jt;mi=!0;return Jt.read=function(n,e,t,r,a){var s,u,h=a*8-r-1,x=(1<<h)-1,E=x>>1,N=-7,O=t?a-1:0,J=t?-1:1,C=n[e+O];for(O+=J,s=C&(1<<-N)-1,C>>=-N,N+=h;N>0;s=s*256+n[e+O],O+=J,N-=8);for(u=s&(1<<-N)-1,s>>=-N,N+=r;N>0;u=u*256+n[e+O],O+=J,N-=8);if(s===0)s=1-E;else{if(s===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),s=s-E}return(C?-1:1)*u*Math.pow(2,s-r)},Jt.write=function(n,e,t,r,a,s){var u,h,x,E=s*8-a-1,N=(1<<E)-1,O=N>>1,J=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:s-1,j=r?1:-1,D=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,u=N):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+O>=1?e+=J/x:e+=J*Math.pow(2,1-O),e*x>=2&&(u++,x/=2),u+O>=N?(h=0,u=N):u+O>=1?(h=(e*x-1)*Math.pow(2,a),u=u+O):(h=e*Math.pow(2,O-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=h&255,C+=j,h/=256,a-=8);for(u=u<<a|h,E+=a;E>0;n[t+C]=u&255,C+=j,u/=256,E-=8);n[t+C-j]|=D*128},Jt}function yi(){if(hi)return je;hi=!0;let n=Eo(),e=Ao(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer=u,je.SlowBuffer=re,je.INSPECT_MAX_BYTES=50;let r=2147483647;je.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let l=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(l,i),l.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function s(l){if(l>r)throw new RangeError('The value "'+l+'" is invalid for option "size"');let i=new Uint8Array(l);return Object.setPrototypeOf(i,u.prototype),i}function u(l,i,o){if(typeof l=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(l)}return h(l,i,o)}u.poolSize=8192;function h(l,i,o){if(typeof l=="string")return O(l,i);if(ArrayBuffer.isView(l))return C(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(he(l,ArrayBuffer)||l&&he(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(l,SharedArrayBuffer)||l&&he(l.buffer,SharedArrayBuffer)))return j(l,i,o);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return u.from(c,i,o);let y=D(l);if(y)return y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return u.from(l[Symbol.toPrimitive]("string"),i,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}u.from=function(l,i,o){return h(l,i,o)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function E(l,i,o){return x(l),l<=0?s(l):i!==void 0?typeof o=="string"?s(l).fill(i,o):s(l).fill(i):s(l)}u.alloc=function(l,i,o){return E(l,i,o)};function N(l){return x(l),s(l<0?0:Y(l)|0)}u.allocUnsafe=function(l){return N(l)},u.allocUnsafeSlow=function(l){return N(l)};function O(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let o=H(l,i)|0,c=s(o),y=c.write(l,i);return y!==o&&(c=c.slice(0,y)),c}function J(l){let i=l.length<0?0:Y(l.length)|0,o=s(i);for(let c=0;c<i;c+=1)o[c]=l[c]&255;return o}function C(l){if(he(l,Uint8Array)){let i=new Uint8Array(l);return j(i.buffer,i.byteOffset,i.byteLength)}return J(l)}function j(l,i,o){if(i<0||l.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<i+(o||0))throw new RangeError('"length" is outside of buffer bounds');let c;return i===void 0&&o===void 0?c=new Uint8Array(l):o===void 0?c=new Uint8Array(l,i):c=new Uint8Array(l,i,o),Object.setPrototypeOf(c,u.prototype),c}function D(l){if(u.isBuffer(l)){let i=Y(l.length)|0,o=s(i);return o.length===0||l.copy(o,0,0,i),o}if(l.length!==void 0)return typeof l.length!="number"||dr(l.length)?s(0):J(l);if(l.type==="Buffer"&&Array.isArray(l.data))return J(l.data)}function Y(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function re(l){return+l!=l&&(l=0),u.alloc(+l)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,o){if(he(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),he(o,Uint8Array)&&(o=u.from(o,o.offset,o.byteLength)),!u.isBuffer(i)||!u.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===o)return 0;let c=i.length,y=o.length;for(let g=0,_=Math.min(c,y);g<_;++g)if(i[g]!==o[g]){c=i[g],y=o[g];break}return c<y?-1:y<c?1:0},u.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(i,o){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let c;if(o===void 0)for(o=0,c=0;c<i.length;++c)o+=i[c].length;let y=u.allocUnsafe(o),g=0;for(c=0;c<i.length;++c){let _=i[c];if(he(_,Uint8Array))g+_.length>y.length?(u.isBuffer(_)||(_=u.from(_)),_.copy(y,g)):Uint8Array.prototype.set.call(y,_,g);else if(u.isBuffer(_))_.copy(y,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=_.length}return y};function H(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||he(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let o=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&o===0)return 0;let y=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return pr(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Gr(l).length;default:if(y)return c?-1:pr(l).length;i=(""+i).toLowerCase(),y=!0}}u.byteLength=H;function ne(l,i,o){let c=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,i>>>=0,o<=i))return"";for(l||(l="utf8");;)switch(l){case"hex":return fo(this,i,o);case"utf8":case"utf-8":return Mr(this,i,o);case"ascii":return co(this,i,o);case"latin1":case"binary":return po(this,i,o);case"base64":return uo(this,i,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mo(this,i,o);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ue(l,i,o){let c=l[i];l[i]=l[o],l[o]=c}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<i;o+=2)ue(this,o,o+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<i;o+=4)ue(this,o,o+3),ue(this,o+1,o+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<i;o+=8)ue(this,o,o+7),ue(this,o+1,o+6),ue(this,o+2,o+5),ue(this,o+3,o+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Mr(this,0,i):ne.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",o=je.INSPECT_MAX_BYTES;return i=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,o,c,y,g){if(he(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(o===void 0&&(o=0),c===void 0&&(c=i?i.length:0),y===void 0&&(y=0),g===void 0&&(g=this.length),o<0||c>i.length||y<0||g>this.length)throw new RangeError("out of range index");if(y>=g&&o>=c)return 0;if(y>=g)return-1;if(o>=c)return 1;if(o>>>=0,c>>>=0,y>>>=0,g>>>=0,this===i)return 0;let _=g-y,M=c-o,Z=Math.min(_,M),z=this.slice(y,g),G=i.slice(o,c);for(let V=0;V<Z;++V)if(z[V]!==G[V]){_=z[V],M=G[V];break}return _<M?-1:M<_?1:0};function te(l,i,o,c,y){if(l.length===0)return-1;if(typeof o=="string"?(c=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,dr(o)&&(o=y?0:l.length-1),o<0&&(o=l.length+o),o>=l.length){if(y)return-1;o=l.length-1}else if(o<0)if(y)o=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:jr(l,i,o,c,y);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?y?Uint8Array.prototype.indexOf.call(l,i,o):Uint8Array.prototype.lastIndexOf.call(l,i,o):jr(l,[i],o,c,y);throw new TypeError("val must be string, number or Buffer")}function jr(l,i,o,c,y){let g=1,_=l.length,M=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||i.length<2)return-1;g=2,_/=2,M/=2,o/=2}function Z(G,V){return g===1?G[V]:G.readUInt16BE(V*g)}let z;if(y){let G=-1;for(z=o;z<_;z++)if(Z(l,z)===Z(i,G===-1?0:z-G)){if(G===-1&&(G=z),z-G+1===M)return G*g}else G!==-1&&(z-=z-G),G=-1}else for(o+M>_&&(o=_-M),z=o;z>=0;z--){let G=!0;for(let V=0;V<M;V++)if(Z(l,z+V)!==Z(i,V)){G=!1;break}if(G)return z}return-1}u.prototype.includes=function(i,o,c){return this.indexOf(i,o,c)!==-1},u.prototype.indexOf=function(i,o,c){return te(this,i,o,c,!0)},u.prototype.lastIndexOf=function(i,o,c){return te(this,i,o,c,!1)};function no(l,i,o,c){o=Number(o)||0;let y=l.length-o;c?(c=Number(c),c>y&&(c=y)):c=y;let g=i.length;c>g/2&&(c=g/2);let _;for(_=0;_<c;++_){let M=parseInt(i.substr(_*2,2),16);if(dr(M))return _;l[o+_]=M}return _}function io(l,i,o,c){return Zt(pr(i,l.length-o),l,o,c)}function ao(l,i,o,c){return Zt(xo(i),l,o,c)}function oo(l,i,o,c){return Zt(Gr(i),l,o,c)}function so(l,i,o,c){return Zt(vo(i,l.length-o),l,o,c)}u.prototype.write=function(i,o,c,y){if(o===void 0)y="utf8",c=this.length,o=0;else if(c===void 0&&typeof o=="string")y=o,c=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(c)?(c=c>>>0,y===void 0&&(y="utf8")):(y=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-o;if((c===void 0||c>g)&&(c=g),i.length>0&&(c<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");y||(y="utf8");let _=!1;for(;;)switch(y){case"hex":return no(this,i,o,c);case"utf8":case"utf-8":return io(this,i,o,c);case"ascii":case"latin1":case"binary":return ao(this,i,o,c);case"base64":return oo(this,i,o,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return so(this,i,o,c);default:if(_)throw new TypeError("Unknown encoding: "+y);y=(""+y).toLowerCase(),_=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function uo(l,i,o){return i===0&&o===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,o))}function Mr(l,i,o){o=Math.min(l.length,o);let c=[],y=i;for(;y<o;){let g=l[y],_=null,M=g>239?4:g>223?3:g>191?2:1;if(y+M<=o){let Z,z,G,V;switch(M){case 1:g<128&&(_=g);break;case 2:Z=l[y+1],(Z&192)===128&&(V=(g&31)<<6|Z&63,V>127&&(_=V));break;case 3:Z=l[y+1],z=l[y+2],(Z&192)===128&&(z&192)===128&&(V=(g&15)<<12|(Z&63)<<6|z&63,V>2047&&(V<55296||V>57343)&&(_=V));break;case 4:Z=l[y+1],z=l[y+2],G=l[y+3],(Z&192)===128&&(z&192)===128&&(G&192)===128&&(V=(g&15)<<18|(Z&63)<<12|(z&63)<<6|G&63,V>65535&&V<1114112&&(_=V))}}_===null?(_=65533,M=1):_>65535&&(_-=65536,c.push(_>>>10&1023|55296),_=56320|_&1023),c.push(_),y+=M}return lo(c)}let Ur=4096;function lo(l){let i=l.length;if(i<=Ur)return String.fromCharCode.apply(String,l);let o="",c=0;for(;c<i;)o+=String.fromCharCode.apply(String,l.slice(c,c+=Ur));return o}function co(l,i,o){let c="";o=Math.min(l.length,o);for(let y=i;y<o;++y)c+=String.fromCharCode(l[y]&127);return c}function po(l,i,o){let c="";o=Math.min(l.length,o);for(let y=i;y<o;++y)c+=String.fromCharCode(l[y]);return c}function fo(l,i,o){let c=l.length;(!i||i<0)&&(i=0),(!o||o<0||o>c)&&(o=c);let y="";for(let g=i;g<o;++g)y+=bo[l[g]];return y}function mo(l,i,o){let c=l.slice(i,o),y="";for(let g=0;g<c.length-1;g+=2)y+=String.fromCharCode(c[g]+c[g+1]*256);return y}u.prototype.slice=function(i,o){let c=this.length;i=~~i,o=o===void 0?c:~~o,i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),o<0?(o+=c,o<0&&(o=0)):o>c&&(o=c),o<i&&(o=i);let y=this.subarray(i,o);return Object.setPrototypeOf(y,u.prototype),y};function K(l,i,o){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+i>o)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,o,c){i=i>>>0,o=o>>>0,c||K(i,o,this.length);let y=this[i],g=1,_=0;for(;++_<o&&(g*=256);)y+=this[i+_]*g;return y},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,o,c){i=i>>>0,o=o>>>0,c||K(i,o,this.length);let y=this[i+--o],g=1;for(;o>0&&(g*=256);)y+=this[i+--o]*g;return y},u.prototype.readUint8=u.prototype.readUInt8=function(i,o){return i=i>>>0,o||K(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,o){return i=i>>>0,o||K(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,o){return i=i>>>0,o||K(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,o){return i=i>>>0,o||K(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,o){return i=i>>>0,o||K(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Re(function(i){i=i>>>0,ot(i,"offset");let o=this[i],c=this[i+7];(o===void 0||c===void 0)&&kt(i,this.length-8);let y=o+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,g=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(y)+(BigInt(g)<<BigInt(32))}),u.prototype.readBigUInt64BE=Re(function(i){i=i>>>0,ot(i,"offset");let o=this[i],c=this[i+7];(o===void 0||c===void 0)&&kt(i,this.length-8);let y=o*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],g=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(y)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,o,c){i=i>>>0,o=o>>>0,c||K(i,o,this.length);let y=this[i],g=1,_=0;for(;++_<o&&(g*=256);)y+=this[i+_]*g;return g*=128,y>=g&&(y-=Math.pow(2,8*o)),y},u.prototype.readIntBE=function(i,o,c){i=i>>>0,o=o>>>0,c||K(i,o,this.length);let y=o,g=1,_=this[i+--y];for(;y>0&&(g*=256);)_+=this[i+--y]*g;return g*=128,_>=g&&(_-=Math.pow(2,8*o)),_},u.prototype.readInt8=function(i,o){return i=i>>>0,o||K(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,o){i=i>>>0,o||K(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},u.prototype.readInt16BE=function(i,o){i=i>>>0,o||K(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},u.prototype.readInt32LE=function(i,o){return i=i>>>0,o||K(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,o){return i=i>>>0,o||K(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Re(function(i){i=i>>>0,ot(i,"offset");let o=this[i],c=this[i+7];(o===void 0||c===void 0)&&kt(i,this.length-8);let y=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(y)<<BigInt(32))+BigInt(o+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Re(function(i){i=i>>>0,ot(i,"offset");let o=this[i],c=this[i+7];(o===void 0||c===void 0)&&kt(i,this.length-8);let y=(o<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(y)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c)}),u.prototype.readFloatLE=function(i,o){return i=i>>>0,o||K(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,o){return i=i>>>0,o||K(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,o){return i=i>>>0,o||K(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,o){return i=i>>>0,o||K(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,o,c,y,g){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>y||i<g)throw new RangeError('"value" argument is out of bounds');if(o+c>l.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,o,c,y){if(i=+i,o=o>>>0,c=c>>>0,!y){let M=Math.pow(2,8*c)-1;ie(this,i,o,c,M,0)}let g=1,_=0;for(this[o]=i&255;++_<c&&(g*=256);)this[o+_]=i/g&255;return o+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,o,c,y){if(i=+i,o=o>>>0,c=c>>>0,!y){let M=Math.pow(2,8*c)-1;ie(this,i,o,c,M,0)}let g=c-1,_=1;for(this[o+g]=i&255;--g>=0&&(_*=256);)this[o+g]=i/_&255;return o+c},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,1,255,0),this[o]=i&255,o+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,2,65535,0),this[o]=i&255,this[o+1]=i>>>8,o+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,2,65535,0),this[o]=i>>>8,this[o+1]=i&255,o+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,4,4294967295,0),this[o+3]=i>>>24,this[o+2]=i>>>16,this[o+1]=i>>>8,this[o]=i&255,o+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,4,4294967295,0),this[o]=i>>>24,this[o+1]=i>>>16,this[o+2]=i>>>8,this[o+3]=i&255,o+4};function $r(l,i,o,c,y){Zr(i,c,y,l,o,7);let g=Number(i&BigInt(4294967295));l[o++]=g,g=g>>8,l[o++]=g,g=g>>8,l[o++]=g,g=g>>8,l[o++]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return l[o++]=_,_=_>>8,l[o++]=_,_=_>>8,l[o++]=_,_=_>>8,l[o++]=_,o}function Dr(l,i,o,c,y){Zr(i,c,y,l,o,7);let g=Number(i&BigInt(4294967295));l[o+7]=g,g=g>>8,l[o+6]=g,g=g>>8,l[o+5]=g,g=g>>8,l[o+4]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return l[o+3]=_,_=_>>8,l[o+2]=_,_=_>>8,l[o+1]=_,_=_>>8,l[o]=_,o+8}u.prototype.writeBigUInt64LE=Re(function(i,o=0){return $r(this,i,o,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,o=0){return Dr(this,i,o,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,o,c,y){if(i=+i,o=o>>>0,!y){let Z=Math.pow(2,8*c-1);ie(this,i,o,c,Z-1,-Z)}let g=0,_=1,M=0;for(this[o]=i&255;++g<c&&(_*=256);)i<0&&M===0&&this[o+g-1]!==0&&(M=1),this[o+g]=(i/_>>0)-M&255;return o+c},u.prototype.writeIntBE=function(i,o,c,y){if(i=+i,o=o>>>0,!y){let Z=Math.pow(2,8*c-1);ie(this,i,o,c,Z-1,-Z)}let g=c-1,_=1,M=0;for(this[o+g]=i&255;--g>=0&&(_*=256);)i<0&&M===0&&this[o+g+1]!==0&&(M=1),this[o+g]=(i/_>>0)-M&255;return o+c},u.prototype.writeInt8=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,1,127,-128),i<0&&(i=255+i+1),this[o]=i&255,o+1},u.prototype.writeInt16LE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,2,32767,-32768),this[o]=i&255,this[o+1]=i>>>8,o+2},u.prototype.writeInt16BE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,2,32767,-32768),this[o]=i>>>8,this[o+1]=i&255,o+2},u.prototype.writeInt32LE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,4,2147483647,-2147483648),this[o]=i&255,this[o+1]=i>>>8,this[o+2]=i>>>16,this[o+3]=i>>>24,o+4},u.prototype.writeInt32BE=function(i,o,c){return i=+i,o=o>>>0,c||ie(this,i,o,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[o]=i>>>24,this[o+1]=i>>>16,this[o+2]=i>>>8,this[o+3]=i&255,o+4},u.prototype.writeBigInt64LE=Re(function(i,o=0){return $r(this,i,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,o=0){return Dr(this,i,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Vr(l,i,o,c,y,g){if(o+c>l.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function Wr(l,i,o,c,y){return i=+i,o=o>>>0,y||Vr(l,i,o,4),e.write(l,i,o,c,23,4),o+4}u.prototype.writeFloatLE=function(i,o,c){return Wr(this,i,o,!0,c)},u.prototype.writeFloatBE=function(i,o,c){return Wr(this,i,o,!1,c)};function qr(l,i,o,c,y){return i=+i,o=o>>>0,y||Vr(l,i,o,8),e.write(l,i,o,c,52,8),o+8}u.prototype.writeDoubleLE=function(i,o,c){return qr(this,i,o,!0,c)},u.prototype.writeDoubleBE=function(i,o,c){return qr(this,i,o,!1,c)},u.prototype.copy=function(i,o,c,y){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!y&&y!==0&&(y=this.length),o>=i.length&&(o=i.length),o||(o=0),y>0&&y<c&&(y=c),y===c||i.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("sourceEnd out of bounds");y>this.length&&(y=this.length),i.length-o<y-c&&(y=i.length-o+c);let g=y-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,c,y):Uint8Array.prototype.set.call(i,this.subarray(c,y),o),g},u.prototype.fill=function(i,o,c,y){if(typeof i=="string"){if(typeof o=="string"?(y=o,o=0,c=this.length):typeof c=="string"&&(y=c,c=this.length),y!==void 0&&typeof y!="string")throw new TypeError("encoding must be a string");if(typeof y=="string"&&!u.isEncoding(y))throw new TypeError("Unknown encoding: "+y);if(i.length===1){let _=i.charCodeAt(0);(y==="utf8"&&_<128||y==="latin1")&&(i=_)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(o<0||this.length<o||this.length<c)throw new RangeError("Out of range index");if(c<=o)return this;o=o>>>0,c=c===void 0?this.length:c>>>0,i||(i=0);let g;if(typeof i=="number")for(g=o;g<c;++g)this[g]=i;else{let _=u.isBuffer(i)?i:u.from(i,y),M=_.length;if(M===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(g=0;g<c-o;++g)this[g+o]=_[g%M]}return this};let at={};function cr(l,i,o){at[l]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:y,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}cr("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),cr("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),cr("ERR_OUT_OF_RANGE",function(l,i,o){let c=`The value of "${l}" is out of range.`,y=o;return Number.isInteger(o)&&Math.abs(o)>2**32?y=zr(String(o)):typeof o=="bigint"&&(y=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(y=zr(y)),y+="n"),c+=` It must be ${i}. Received ${y}`,c},RangeError);function zr(l){let i="",o=l.length,c=l[0]==="-"?1:0;for(;o>=c+4;o-=3)i=`_${l.slice(o-3,o)}${i}`;return`${l.slice(0,o)}${i}`}function ho(l,i,o){ot(i,"offset"),(l[i]===void 0||l[i+o]===void 0)&&kt(i,l.length-(o+1))}function Zr(l,i,o,c,y,g){if(l>o||l<i){let _=typeof i=="bigint"?"n":"",M;throw i===0||i===BigInt(0)?M=`>= 0${_} and < 2${_} ** ${(g+1)*8}${_}`:M=`>= -(2${_} ** ${(g+1)*8-1}${_}) and < 2 ** ${(g+1)*8-1}${_}`,new at.ERR_OUT_OF_RANGE("value",M,l)}ho(c,y,g)}function ot(l,i){if(typeof l!="number")throw new at.ERR_INVALID_ARG_TYPE(i,"number",l)}function kt(l,i,o){throw Math.floor(l)!==l?(ot(l,o),new at.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let yo=/[^+/0-9A-Za-z-_]/g;function go(l){if(l=l.split("=")[0],l=l.trim().replace(yo,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function pr(l,i){i=i||1/0;let o,c=l.length,y=null,g=[];for(let _=0;_<c;++_){if(o=l.charCodeAt(_),o>55295&&o<57344){if(!y){if(o>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(_+1===c){(i-=3)>-1&&g.push(239,191,189);continue}y=o;continue}if(o<56320){(i-=3)>-1&&g.push(239,191,189),y=o;continue}o=(y-55296<<10|o-56320)+65536}else y&&(i-=3)>-1&&g.push(239,191,189);if(y=null,o<128){if((i-=1)<0)break;g.push(o)}else if(o<2048){if((i-=2)<0)break;g.push(o>>6|192,o&63|128)}else if(o<65536){if((i-=3)<0)break;g.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((i-=4)<0)break;g.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return g}function xo(l){let i=[];for(let o=0;o<l.length;++o)i.push(l.charCodeAt(o)&255);return i}function vo(l,i){let o,c,y,g=[];for(let _=0;_<l.length&&!((i-=2)<0);++_)o=l.charCodeAt(_),c=o>>8,y=o%256,g.push(y),g.push(c);return g}function Gr(l){return n.toByteArray(go(l))}function Zt(l,i,o,c){let y;for(y=0;y<c&&!(y+o>=i.length||y>=l.length);++y)i[y+o]=l[y];return y}function he(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function dr(l){return l!==l}let bo=(function(){let l="0123456789abcdef",i=new Array(256);for(let o=0;o<16;++o){let c=o*16;for(let y=0;y<16;++y)i[c+y]=l[o]+l[y]}return i})();function Re(l){return typeof BigInt>"u"?wo:l}function wo(){throw new Error("BigInt not supported")}return je}var Rt,fi,Jt,mi,je,hi,gi=st(()=>{"use strict";p();f();d();Rt={},fi=!1;Jt={},mi=!1;je={},hi=!1});var Me,b,oc,sc,xi=st(()=>{"use strict";p();f();d();gi();Me=yi();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,oc=Me.INSPECT_MAX_BYTES,sc=Me.kMaxLength});var f=st(()=>{"use strict";xi()});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var Io=typeof global=="object"&&global&&global.Object===Object&&global,vi=Io;var ko=typeof self=="object"&&self&&self.Object===Object&&self,Ro=vi||ko||Function("return this")(),bi=Ro;var No=bi.Symbol,_e=No;p();f();d();var wi=Object.prototype,So=wi.hasOwnProperty,Co=wi.toString,Nt=_e?_e.toStringTag:void 0;function Fo(n){var e=So.call(n,Nt),t=n[Nt];try{n[Nt]=void 0;var r=!0}catch{}var a=Co.call(n);return r&&(e?n[Nt]=t:delete n[Nt]),a}var _i=Fo;p();f();d();var Oo=Object.prototype,Bo=Oo.toString;function Lo(n){return Bo.call(n)}var Ti=Lo;var Po="[object Null]",jo="[object Undefined]",Ei=_e?_e.toStringTag:void 0;function Mo(n){return n==null?n===void 0?jo:Po:Ei&&Ei in Object(n)?_i(n):Ti(n)}var Ai=Mo;p();f();d();function Uo(n){return n!=null&&typeof n=="object"}var Ii=Uo;var $o="[object Symbol]";function Do(n){return typeof n=="symbol"||Ii(n)&&Ai(n)==$o}var ki=Do;p();f();d();p();f();d();function Vo(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var Ri=Vo;p();f();d();var Wo=Array.isArray,Ni=Wo;var qo=1/0,Si=_e?_e.prototype:void 0,Ci=Si?Si.toString:void 0;function Fi(n){if(typeof n=="string")return n;if(Ni(n))return Ri(n,Fi)+"";if(ki(n))return Ci?Ci.call(n):"";var e=n+"";return e=="0"&&1/n==-qo?"-0":e}var Oi=Fi;p();f();d();function zo(n){return n==null?"":Oi(n)}var Se=zo;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function Zo(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(a);++r<a;)s[r]=n[r+e];return s}var Bi=Zo;function Go(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Bi(n,e,t)}var Li=Go;p();f();d();var Ho="\\ud800-\\udfff",Yo="\\u0300-\\u036f",Jo="\\ufe20-\\ufe2f",Ko="\\u20d0-\\u20ff",Xo=Yo+Jo+Ko,Qo="\\ufe0e\\ufe0f",es="\\u200d",ts=RegExp("["+es+Ho+Xo+Qo+"]");function rs(n){return ts.test(n)}var Kt=rs;p();f();d();p();f();d();function ns(n){return n.split("")}var Pi=ns;p();f();d();var ji="\\ud800-\\udfff",is="\\u0300-\\u036f",as="\\ufe20-\\ufe2f",os="\\u20d0-\\u20ff",ss=is+as+os,us="\\ufe0e\\ufe0f",ls="["+ji+"]",yr="["+ss+"]",gr="\\ud83c[\\udffb-\\udfff]",cs="(?:"+yr+"|"+gr+")",Mi="[^"+ji+"]",Ui="(?:\\ud83c[\\udde6-\\uddff]){2}",$i="[\\ud800-\\udbff][\\udc00-\\udfff]",ps="\\u200d",Di=cs+"?",Vi="["+us+"]?",ds="(?:"+ps+"(?:"+[Mi,Ui,$i].join("|")+")"+Vi+Di+")*",fs=Vi+Di+ds,ms="(?:"+[Mi+yr+"?",yr,Ui,$i,ls].join("|")+")",hs=RegExp(gr+"(?="+gr+")|"+ms+fs,"g");function ys(n){return n.match(hs)||[]}var Wi=ys;function gs(n){return Kt(n)?Wi(n):Pi(n)}var qi=gs;function xs(n){return function(e){e=Se(e);var t=Kt(e)?qi(e):void 0,r=t?t[0]:e.charAt(0),a=t?Li(t,1).join(""):e.slice(1);return r[n]()+a}}var zi=xs;var vs=zi("toUpperCase"),Ue=vs;function bs(n){return Ue(Se(n).toLowerCase())}var Zi=bs;p();f();d();p();f();d();function ws(n,e,t,r){var a=-1,s=n==null?0:n.length;for(r&&s&&(t=n[++a]);++a<s;)t=e(t,n[a],a,n);return t}var Gi=ws;p();f();d();p();f();d();p();f();d();function _s(n){return function(e){return n?.[e]}}var Hi=_s;var Ts={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Es=Hi(Ts),Yi=Es;var As=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Is="\\u0300-\\u036f",ks="\\ufe20-\\ufe2f",Rs="\\u20d0-\\u20ff",Ns=Is+ks+Rs,Ss="["+Ns+"]",Cs=RegExp(Ss,"g");function Fs(n){return n=Se(n),n&&n.replace(As,Yi).replace(Cs,"")}var Ji=Fs;p();f();d();p();f();d();var Os=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Bs(n){return n.match(Os)||[]}var Ki=Bs;p();f();d();var Ls=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ps(n){return Ls.test(n)}var Xi=Ps;p();f();d();var na="\\ud800-\\udfff",js="\\u0300-\\u036f",Ms="\\ufe20-\\ufe2f",Us="\\u20d0-\\u20ff",$s=js+Ms+Us,ia="\\u2700-\\u27bf",aa="a-z\\xdf-\\xf6\\xf8-\\xff",Ds="\\xac\\xb1\\xd7\\xf7",Vs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ws="\\u2000-\\u206f",qs=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",oa="A-Z\\xc0-\\xd6\\xd8-\\xde",zs="\\ufe0e\\ufe0f",sa=Ds+Vs+Ws+qs,ua="['\u2019]",Qi="["+sa+"]",Zs="["+$s+"]",la="\\d+",Gs="["+ia+"]",ca="["+aa+"]",pa="[^"+na+sa+la+ia+aa+oa+"]",Hs="\\ud83c[\\udffb-\\udfff]",Ys="(?:"+Zs+"|"+Hs+")",Js="[^"+na+"]",da="(?:\\ud83c[\\udde6-\\uddff]){2}",fa="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="["+oa+"]",Ks="\\u200d",ea="(?:"+ca+"|"+pa+")",Xs="(?:"+lt+"|"+pa+")",ta="(?:"+ua+"(?:d|ll|m|re|s|t|ve))?",ra="(?:"+ua+"(?:D|LL|M|RE|S|T|VE))?",ma=Ys+"?",ha="["+zs+"]?",Qs="(?:"+Ks+"(?:"+[Js,da,fa].join("|")+")"+ha+ma+")*",eu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ru=ha+ma+Qs,nu="(?:"+[Gs,da,fa].join("|")+")"+ru,iu=RegExp([lt+"?"+ca+"+"+ta+"(?="+[Qi,lt,"$"].join("|")+")",Xs+"+"+ra+"(?="+[Qi,lt+ea,"$"].join("|")+")",lt+"?"+ea+"+"+ta,lt+"+"+ra,tu,eu,la,nu].join("|"),"g");function au(n){return n.match(iu)||[]}var ya=au;function ou(n,e,t){return n=Se(n),e=t?void 0:e,e===void 0?Xi(n)?ya(n):Ki(n):n.match(e)||[]}var ga=ou;var su="['\u2019]",uu=RegExp(su,"g");function lu(n){return function(e){return Gi(ga(Ji(e).replace(uu,"")),n,"")}}var xa=lu;var cu=xa(function(n,e,t){return e=e.toLowerCase(),n+(t?Zi(e):e)}),St=cu;p();f();d();function q(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();f();d();function Ct(n){return Object.keys(n)}p();f();d();p();f();d();p();f();d();var Ft=v.env.FERN_STACK_TRACK?.toLowerCase()??"",ye=Ft!==""&&Ft!=="0"&&Ft!=="false",xr=["single","multiline","box"].includes(Ft)?Ft:"single";ye&&(Error.stackTraceLimit=50);var pu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),du=new Set(["stacktrace"]);function Qt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:s=!0,filterJs:u=!0,formatFilename:h=x=>x}={}){if(!ye)return[];r=[...r,...pu],t=[...t,...du],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(E=>{let N=E.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(N&&N.length===5){let[,O,J,C,j]=N;if(!O||!J||!C||!j)return;if(x||a.some(D=>O?.includes(D))){x=!0;return}switch(O){case"Object.<anonymous>":O="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":O=`${O.substring(O.indexOf(".")+1)}()=> { ... }`;break}return{fn:O,path:h(J),position:`${C}:${j}`}}}).filter(E=>E&&!r.some(N=>E.fn.includes(N))&&!(s&&E.path?.startsWith("node:"))&&!(u&&E.path?.endsWith(".js"))&&!t.some(N=>E.path.includes(N))).slice(e,e+n)}var Xt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:s=[],filterNode:u=!0,filterJs:h=!0,multiline:x=!1,formatFilename:E=N=>N}={}){A(this,"maxFrames");A(this,"skip");A(this,"filterPaths");A(this,"filterFunctions");A(this,"stopOn");A(this,"filterNode");A(this,"filterJs");A(this,"multiline");A(this,"formatFilename");A(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=s,this.filterNode=u,this.filterJs=h,this.multiline=x,this.formatFilename=E}tag(e){let t=this.tracking.get(e)||new Set;Qt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>t.add(r)),this.tracking.set(e,t)}trace(e){if(!ye)return"";let t=this.tracking.get(e);return t?[...t].map(r=>`${this.multiline?`
|
|
3
|
+
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function va({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:s=!0,filterJs:u=!0,multiline:h=!1,formatFilename:x=E=>E}={}){ye&&(vr??(vr=new Xt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:s,filterJs:u,multiline:h,formatFilename:x})))}function ba(n){vr?.tag(n)}function br(n){return vr?.frames(n)??[]}var $e=class{constructor(){ba(this)}};p();f();d();var er=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},Ot=class extends er{async format(e){return e}formatSync(e){return e}};p();f();d();p();f();d();p();f();d();var de=class extends $e{constructor(t){super();A(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var fu=4;va({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Bt=class{constructor(){A(this,"lineBuffer",[]);A(this,"indentLevel",0);A(this,"hasWrittenAnything",!1);A(this,"lastCharacterIsSemicolon",!1);A(this,"lastCharacterIsNewline",!1);A(this,"nodeStackFrames",[])}get buffer(){return ye&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
4
|
`),this.lineBuffer.join(`
|
|
5
5
|
`)+(this.lastCharacterIsNewline?`
|
|
6
6
|
`:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
|
|
7
|
-
`),a=r?t.substring(0,t.length-1):t,
|
|
7
|
+
`),a=r?t.substring(0,t.length-1):t,s=this.getIndentString(),u=a.replaceAll(`
|
|
8
8
|
`,`
|
|
9
|
-
${
|
|
9
|
+
${s}`);this.isAtStartOfLine()&&(u=s+u),r&&(u+=`
|
|
10
10
|
`),this.writeInternal(u)}else this.writeNode(t)}writeStatement(...e){this.write(...e),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(e){let t=this.indentLevel;this.indentLevel=0,this.write(e),this.indentLevel=t}writeNode(e){ye&&this.nodeStackFrames.push(...br(e)),e.write(this),ye&&xr!=="single"&&this.writeInternal(`
|
|
11
11
|
`)}writeNodeOrString(e){if(typeof e=="string"){this.write(e);return}this.writeNode(e)}writeNodeStatement(e){this.writeNode(e),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(e){new de(e).write(this),e.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(e,t){new de(e).write(this),this.write(" (",t,")"),this.pushScope()}controlFlowWithoutStatement(e){new de(e).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(e,t){this.dedent(),this.write("} "),new de(e).write(this),this.write(" (",t,")"),this.pushScope()}alternativeControlFlow(e){this.dedent(),this.write("} "),new de(e).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(e=!0){this.dedent(),this.writeNewLineIfLastLineNot(),e?this.writeLine("}"):this.write("}")}writeLine(...e){this.write(...e.length===0?[""]:e),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
|
-
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:r}){if(e.length>0){let a=e[0];a!=null&&r(a);for(let
|
|
13
|
+
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:r}){if(e.length>0){let a=e[0];a!=null&&r(a);for(let s=1;s<e.length;s++){this.write(t);let u=e[s];u!=null&&r(u)}}}toString(){return this.buffer}writeInternal(e){if(e.length===0)return;let t=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
|
|
14
14
|
`),this.lastCharacterIsSemicolon=e.endsWith(";");let r=e.split(`
|
|
15
|
-
`),a=ye&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Qt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return fu}};p();f();d();p();f();d();p();f();d();var Lt=class{constructor(){E(this,"reporter");E(this,"snippet");E(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Pt=class{constructor(e){E(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Lt;for(let o of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{let x=await h.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{return await h.generateSnippetAst({endpoint:o,request:e,options:t})}catch(x){a=x}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Lt;for(let o of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{let x=h.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};p();f();d();p();f();d();p();f();d();var jt=class{constructor(){E(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};p();f();d();var $={Critical:"CRITICAL",Warning:"WARNING"},Mt=class n{constructor(){E(this,"errors");E(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Ut=class{constructor({ir:e,config:t,options:r={}}){E(this,"config");E(this,"options");E(this,"errors");E(this,"_ir");E(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Mt,this.httpEndpointReferenceParser=new jt}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,o]of Object.entries(t))if(o!==void 0){this.errors.scope(a);try{let u=e.find(x=>x.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let h=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:h})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let o=t[a.name.wireValue];if(o==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")o=`<${a.name.wireValue}>`;else{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],o=new Set;for(let u of e){let h=u.name.wireValue,x=t[h];if(x!==void 0){o.add(h),this.errors.scope(h);try{a.push({name:u.name,typeReference:u.typeReference,value:x})}finally{this.errors.unscope()}}}if(!r){for(let[u,h]of Object.entries(t))if(!(h===void 0||o.has(u))){this.errors.scope(u);try{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(u).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let u=r[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:$.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}a.push(o)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:$.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:$.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,o=r[a];if(o==null){this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:$.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=e.types[o];if(u==null){this.errors.add({severity:$.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:h,...x}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:x}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:q(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:q(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Ct(r.urls));for(let o of Ct(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:$.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Ct(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:q(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:q(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:q(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};p();f();d();var fe={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var ct=class extends Bt{constructor({customConfig:t,formatter:r}){super();E(this,"customConfig");E(this,"formatter");E(this,"imports",{});E(this,"defaultImports",{});E(this,"starImportAliases",{});E(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Ot}addImport(t){var r,a;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let o=(r=this.imports)[a=t.importFrom.moduleName]??(r[a]=[]);o.map(h=>h.name).includes(t.name)||o.push(t)}}validateDefault(t){var a,o;if(t.importFrom?.type!=="default")return;let r=(a=this.defaultImports)[o=t.importFrom.moduleName]??(a[o]=t);if(r.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${r.name}`)}validateNamed(t){if(t.importFrom?.type!=="named")return;let a=(this.imports[t.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(a.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${a.map(u=>u.name)} already exist`);let o=[];for(let u of Object.values(this.imports))for(let h of u)h.importFrom?.type==="named"&&h.importFrom.moduleName!==t.importFrom.moduleName&&h.name===t.name&&o.push(h);if(o.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${o[0]?.importFrom?.moduleName}`)}validateStar(t){var o,u,h,x;if(t.importFrom?.type!=="star")return;let r=(o=this.starImportAliases)[u=t.importFrom.moduleName]??(o[u]=t.importFrom.starImportAlias);if(r!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${r}.`);if(((h=this.starImportAliasesInverse)[x=t.importFrom.starImportAlias]??(h[x]=t.importFrom.moduleName))!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var $t=class extends ct{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
15
|
+
`),a=ye&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Qt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return fu}};p();f();d();p();f();d();p();f();d();var Lt=class{constructor(){A(this,"reporter");A(this,"snippet");A(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Pt=class{constructor(e){A(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Lt;for(let s of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{let x=await h.generateSnippet({endpoint:s,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let s of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{return await h.generateSnippetAst({endpoint:s,request:e,options:t})}catch(x){a=x}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new Lt;for(let s of r){let u=this.context.clone(),h=this.createSnippetGenerator(u);try{let x=h.generateSnippetSync({endpoint:s,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};p();f();d();p();f();d();p();f();d();var jt=class{constructor(){A(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};p();f();d();var $={Critical:"CRITICAL",Warning:"WARNING"},Mt=class n{constructor(){A(this,"errors");A(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Ut=class{constructor({ir:e,config:t,options:r={}}){A(this,"config");A(this,"options");A(this,"errors");A(this,"_ir");A(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Mt,this.httpEndpointReferenceParser=new jt}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,s]of Object.entries(t))if(s!==void 0){this.errors.scope(a);try{let u=e.find(x=>x.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let h=this.isListTypeReference(u.typeReference)&&!Array.isArray(s)?[s]:s;r.push({name:u.name,typeReference:u.typeReference,value:h})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let s=t[a.name.wireValue];if(s==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")s=`<${a.name.wireValue}>`;else{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:s})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[],s=new Set;for(let u of e){let h=u.name.wireValue,x=t[h];if(x!==void 0){s.add(h),this.errors.scope(h);try{a.push({name:u.name,typeReference:u.typeReference,value:x})}finally{this.errors.unscope()}}}if(!r){for(let[u,h]of Object.entries(t))if(!(h===void 0||s.has(u))){this.errors.scope(u);try{this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(u).message})}finally{this.errors.unscope()}}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let s of e){let u=r[s.name.wireValue];u==null?s.typeReference.type==="nullable"&&a.push({name:s.name,typeReference:s.typeReference,value:null}):a.push({name:s.name,typeReference:s.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:$.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let s of r){if(typeof s!="string"){this.errors.add({severity:$.Critical,message:`Expected file array value to be an array of strings, got ${typeof s}`});return}a.push(s)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:$.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:$.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,s=r[a];if(s==null){this.errors.add({severity:$.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof s!="string"){this.errors.add({severity:$.Critical,message:`Expected discriminant value to be a string but got: ${typeof s}`});return}let u=e.types[s];if(u==null){this.errors.add({severity:$.Critical,message:`No type found for discriminant value "${s}"`});return}let{[a]:h,...x}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:x}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:q(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:q(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:$.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Ct(r.urls));for(let s of Ct(e))a.has(s)&&a.delete(s);return a.size>0?(this.errors.add({severity:$.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Ct(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:$.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:q(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:q(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:q(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};p();f();d();var fe={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var ct=class extends Bt{constructor({customConfig:t,formatter:r}){super();A(this,"customConfig");A(this,"formatter");A(this,"imports",{});A(this,"defaultImports",{});A(this,"starImportAliases",{});A(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Ot}addImport(t){var r,a;if(t.importFrom!=null){switch(t.importFrom.type){case"default":{this.validateDefault(t);break}case"named":{this.validateNamed(t);break}case"star":{this.validateStar(t);break}}let s=(r=this.imports)[a=t.importFrom.moduleName]??(r[a]=[]);s.map(h=>h.name).includes(t.name)||s.push(t)}}validateDefault(t){var a,s;if(t.importFrom?.type!=="default")return;let r=(a=this.defaultImports)[s=t.importFrom.moduleName]??(a[s]=t);if(r.name!==t.name)throw new Error(`Cannot have multiple default imports for module ${t.importFrom.moduleName}: got ${t.name} but already had ${r.name}`)}validateNamed(t){if(t.importFrom?.type!=="named")return;let a=(this.imports[t.importFrom.moduleName]??[]).filter(u=>u.importFrom?.type==="star");if(a.length>0)throw new Error(`Cannot add named import ${t.name} because non-named imports ${a.map(u=>u.name)} already exist`);let s=[];for(let u of Object.values(this.imports))for(let h of u)h.importFrom?.type==="named"&&h.importFrom.moduleName!==t.importFrom.moduleName&&h.name===t.name&&s.push(h);if(s.length>0)throw new Error(`Cannot add named import from module ${t.importFrom.moduleName} because it is already imported from ${s[0]?.importFrom?.moduleName}`)}validateStar(t){var s,u,h,x;if(t.importFrom?.type!=="star")return;let r=(s=this.starImportAliases)[u=t.importFrom.moduleName]??(s[u]=t.importFrom.starImportAlias);if(r!==t.importFrom.starImportAlias)throw new Error(`Cannot have more than one alias for non-named imports from a module: got ${t.importFrom.starImportAlias} but already have ${r}.`);if(((h=this.starImportAliasesInverse)[x=t.importFrom.starImportAlias]??(h[x]=t.importFrom.moduleName))!==t.importFrom.moduleName)throw new Error(`Attempted to use alias ${t.importFrom.starImportAlias} for more than one module in the same file`)}};var $t=class extends ct{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
16
16
|
${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
|
|
17
17
|
${e}`)}return e}getContent(){let e=this.stringifyImports();return e.length>0?e+`
|
|
18
|
-
`+this.buffer:this.buffer}stringifyImports(){let e="";for(let[t,r]of Object.entries(this.imports)){let a=this.defaultImports[t],
|
|
19
|
-
`}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var m={};ae(m,{BRAND:()=>Uu,DIRTY:()=>De,EMPTY_PATH:()=>gu,INVALID:()=>F,NEVER:()=>Tl,OK:()=>ee,ParseStatus:()=>X,Schema:()=>P,ZodAny:()=>Oe,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Vt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>nr,ZodEffects:()=>pe,ZodEnum:()=>Xe,ZodError:()=>se,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>ar,ZodIntersection:()=>Ye,ZodIssueCode:()=>T,ZodLazy:()=>Je,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>oe,ZodOptional:()=>le,ZodParsedType:()=>R,ZodPipeline:()=>Wt,ZodPromise:()=>Be,ZodReadonly:()=>rt,ZodRecord:()=>ir,ZodSchema:()=>P,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>pe,ZodTuple:()=>xe,ZodType:()=>P,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ee,ZodVoid:()=>ht,addIssueToContext:()=>k,any:()=>Hu,array:()=>Xu,bigint:()=>Wu,boolean:()=>Ca,coerce:()=>_l,custom:()=>Ra,date:()=>qu,datetimeRegex:()=>Ia,defaultErrorMap:()=>Te,discriminatedUnion:()=>rl,effect:()=>ml,enum:()=>pl,function:()=>ul,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Du,intersection:()=>nl,isAborted:()=>tr,isAsync:()=>dt,isDirty:()=>rr,isValid:()=>Ce,late:()=>$u,lazy:()=>ll,literal:()=>cl,makeIssue:()=>Dt,map:()=>sl,nan:()=>Vu,nativeEnum:()=>dl,never:()=>Ju,null:()=>Gu,nullable:()=>yl,number:()=>Sa,object:()=>Qu,objectUtil:()=>wr,oboolean:()=>wl,onumber:()=>bl,optional:()=>hl,ostring:()=>vl,pipeline:()=>xl,preprocess:()=>gl,promise:()=>fl,quotelessJson:()=>mu,record:()=>al,set:()=>ol,setErrorMap:()=>yu,strictObject:()=>el,string:()=>Na,symbol:()=>zu,transformer:()=>ml,tuple:()=>il,undefined:()=>Zu,union:()=>tl,unknown:()=>Yu,util:()=>U,void:()=>Ku});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(h=>typeof a[a[h]]!="number"),u={};for(let h of o)u[h]=a[h];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(U||(U={}));var wr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(wr||(wr={}));var R=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(n)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(n)?R.array:n===null?R.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?R.promise:typeof Map<"u"&&n instanceof Map?R.map:typeof Set<"u"&&n instanceof Set?R.set:typeof Date<"u"&&n instanceof Date?R.date:R.object;default:return R.unknown}};var T=U.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"]),mu=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),se=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let h=r,x=0;for(;x<u.path.length;){let A=u.path[x];x===u.path.length-1?(h[A]=h[A]||{_errors:[]},h[A]._errors.push(t(u))):h[A]=h[A]||{_errors:[]},h=h[A],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};se.create=n=>new se(n);var hu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===R.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=hu;var wa=Te;function yu(n){wa=n}function pt(){return wa}p();f();d();var Dt=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let h="",x=r.filter(A=>!!A).slice().reverse();for(let A of x)h=A(u,{data:e,defaultError:h}).message;return{...a,path:o,message:h}},gu=[];function k(n,e){let t=pt(),r=Dt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return F;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),tr=n=>n.status==="aborted",rr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var S;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(S||(S={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},_a=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new se(n.common.issues);return this._error=t,this._error}}};function L(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,h)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??h.defaultError}:typeof h.data>"u"?{message:x??r??h.defaultError}:u.code!=="invalid_type"?{message:h.defaultError}:{message:x??t??h.defaultError}},description:a}}var P=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return _a(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(dt(a)?a:Promise.resolve(a));return _a(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),h=()=>o.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(h(),!1)):u?!0:(h(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new pe({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return le.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Be.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new pe({...L(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...L(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Vt({typeName:B.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...L(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},xu=/^c[^\s-]{8,}$/i,vu=/^[0-9a-z]+$/,bu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wu=/^[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,_u=/^[a-z0-9_-]{21}$/i,Tu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Au=/^[-+]?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)?)??$/,Eu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Iu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,ku=/^(?:(?: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])$/,Ru=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Nu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Su=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Aa="((\\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])))",Ou=new RegExp(`^${Aa}$`);function Ea(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Bu(n){return new RegExp(`^${Ea(n)}$`)}function Ia(n){let e=`${Aa}T${Ea(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Lu(n,e){return!!((e==="v4"||!e)&&ku.test(n)||(e==="v6"||!e)&&Nu.test(n))}function Pu(n,e){if(!Tu.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function ju(n,e){return!!((e==="v4"||!e)&&Ru.test(n)||(e==="v6"||!e)&&Su.test(n))}var Fe=class n extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let o=this._getOrReturnCtx(e);return k(o,{code:T.invalid_type,expected:R.string,received:o.parsedType}),F}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,h=e.data.length<o.value;(u||h)&&(a=this._getOrReturnCtx(e,a),u?k(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):h&&k(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(Iu,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")wu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")_u.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")xu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")vu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")bu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ulid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),k(a,{validation:"url",code:T.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"regex",code:T.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?Ia(o).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Ou.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Bu(o).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Au.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Pu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?ju(e.data,o.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Cu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Fu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64url",code:T.invalid_string,message:o.message}),r.dirty()):U.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...S.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){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:e?.offset??!1,local:e?.local??!1,...S.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.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...L(n)});function Mu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends P{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)!==R.number){let o=this._getOrReturnCtx(e);return k(o,{code:T.invalid_type,expected:R.number,received:o.parsedType}),F}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Mu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_finite,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...L(n)});var We=class n extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let r,a=new X;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):U.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...L(n)});var qe=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...L(n)});var ze=class n extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let o=this._getOrReturnCtx(e);return k(o,{code:T.invalid_type,expected:R.date,received:o.parsedType}),F}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return k(o,{code:T.invalid_date}),F}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):U.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...L(n)});var mt=class extends P{_parse(e){if(this._getType(e)!==R.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...L(n)});var Ze=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...L(n)});var Ge=class extends P{_parse(e){if(this._getType(e)!==R.null){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...L(n)});var Oe=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Oe.create=n=>new Oe({typeName:B.ZodAny,...L(n)});var Ee=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ee.create=n=>new Ee({typeName:B.ZodUnknown,...L(n)});var me=class extends P{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.never,received:t.parsedType}),F}};me.create=n=>new me({typeName:B.ZodNever,...L(n)});var ht=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...L(n)});var Ie=class n extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==R.array)return k(t,{code:T.invalid_type,expected:R.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,h=t.data.length<a.exactLength.value;(u||h)&&(k(t,{code:u?T.too_big:T.too_small,minimum:h?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(k(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(k(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,h)=>a.type._parseAsync(new ce(t,u,t.path,h)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,h)=>a.type._parseSync(new ce(t,u,t.path,h)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...L(e)});function ft(n){if(n instanceof oe){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=le.create(ft(r))}return new oe({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof le?le.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var oe=class n extends P{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(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let A=this._getOrReturnCtx(e);return k(A,{code:T.invalid_type,expected:R.object,received:A.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),h=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(let A in a.data)u.includes(A)||h.push(A);let x=[];for(let A of u){let N=o[A],O=a.data[A];x.push({key:{status:"valid",value:A},value:N._parse(new ce(a,O,a.path,A)),alwaysSet:A in a.data})}if(this._def.catchall instanceof me){let A=this._def.unknownKeys;if(A==="passthrough")for(let N of h)x.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(A==="strict")h.length>0&&(k(a,{code:T.unrecognized_keys,keys:h}),r.dirty());else if(A!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let A=this._def.catchall;for(let N of h){let O=a.data[N];x.push({key:{status:"valid",value:N},value:A._parse(new ce(a,O,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let A=[];for(let N of x){let O=await N.key,J=await N.value;A.push({key:O,value:J,alwaysSet:N.alwaysSet})}return A}).then(A=>X.mergeObjectSync(r,A)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:S.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof le;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return ka(U.objectKeys(this.shape))}};oe.create=(n,e)=>new oe({shape:()=>n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});oe.strictCreate=(n,e)=>new oe({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...L(e)});oe.lazycreate=(n,e)=>new oe({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});var He=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let h of o)if(h.result.status==="valid")return h.result;for(let h of o)if(h.result.status==="dirty")return t.common.issues.push(...h.ctx.common.issues),h.result;let u=o.map(h=>new se(h.ctx.common.issues));return k(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let A={...t,common:{...t.common,issues:[]},parent:null},N=x._parseSync({data:t.data,path:t.path,parent:A});if(N.status==="valid")return N;N.status==="dirty"&&!o&&(o={result:N,ctx:A}),A.common.issues.length&&u.push(A.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let h=u.map(x=>new se(x));return k(t,{code:T.invalid_union,unionErrors:h}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...L(e)});var Ae=n=>n instanceof Je?Ae(n.schema):n instanceof pe?Ae(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?Ae(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof le?[void 0,...Ae(n.unwrap())]:n instanceof ve?[null,...Ae(n.unwrap())]:n instanceof Vt||n instanceof rt?Ae(n.unwrap()):n instanceof tt?Ae(n._def.innerType):[],nr=class n extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return k(t,{code:T.invalid_type,expected:R.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=Ae(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let h of u){if(a.has(h))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(h)}`);a.set(h,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...L(r)})}};function Tr(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===R.object&&r===R.object){let a=U.objectKeys(e),o=U.objectKeys(n).filter(h=>a.indexOf(h)!==-1),u={...n,...e};for(let h of o){let x=Tr(n[h],e[h]);if(!x.valid)return{valid:!1};u[h]=x.data}return{valid:!0,data:u}}else if(t===R.array&&r===R.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],h=e[o],x=Tr(u,h);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===R.date&&r===R.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ye=class extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(tr(o)||tr(u))return F;let h=Tr(o.value,u.value);return h.valid?((rr(o)||rr(u))&&t.dirty(),{status:t.value,value:h.data}):(k(r,{code:T.invalid_intersection_types}),F)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,u])=>a(o,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ye.create=(n,e,t)=>new Ye({left:n,right:e,typeName:B.ZodIntersection,...L(t)});var xe=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.array)return k(r,{code:T.invalid_type,expected:R.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return k(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,h)=>{let x=this._def.items[h]||this._def.rest;return x?x._parse(new ce(r,u,r.path,h)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...L(e)})};var ir=class n extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return k(r,{code:T.invalid_type,expected:R.object,received:r.parsedType}),F;let a=[],o=this._def.keyType,u=this._def.valueType;for(let h in r.data)a.push({key:o._parse(new ce(r,h,r.path,h)),value:u._parse(new ce(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof P?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...L(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...L(t)})}},yt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.map)return k(r,{code:T.invalid_type,expected:R.map,received:r.parsedType}),F;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([h,x],A)=>({key:a._parse(new ce(r,h,r.path,[A,"key"])),value:o._parse(new ce(r,x,r.path,[A,"value"]))}));if(r.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let x of u){let A=await x.key,N=await x.value;if(A.status==="aborted"||N.status==="aborted")return F;(A.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(A.value,N.value)}return{status:t.value,value:h}})}else{let h=new Map;for(let x of u){let A=x.key,N=x.value;if(A.status==="aborted"||N.status==="aborted")return F;(A.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(A.value,N.value)}return{status:t.value,value:h}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...L(t)});var gt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.set)return k(r,{code:T.invalid_type,expected:R.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(k(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(k(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let A=new Set;for(let N of x){if(N.status==="aborted")return F;N.status==="dirty"&&t.dirty(),A.add(N.value)}return{status:t.value,value:A}}let h=[...r.data.values()].map((x,A)=>o._parse(new ce(r,x,r.path,A)));return r.common.async?Promise.all(h).then(x=>u(x)):u(h)}min(e,t){return new n({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...L(e)});var ar=class n extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return k(t,{code:T.invalid_type,expected:R.function,received:t.parsedType}),F;function r(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(A=>!!A),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(A=>!!A),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Be){let h=this;return ee(async function(...x){let A=new se([]),N=await h._def.args.parseAsync(x,o).catch(C=>{throw A.addIssue(r(x,C)),A}),O=await Reflect.apply(u,this,N);return await h._def.returns._def.type.parseAsync(O,o).catch(C=>{throw A.addIssue(a(O,C)),A})})}else{let h=this;return ee(function(...x){let A=h._def.args.safeParse(x,o);if(!A.success)throw new se([r(x,A.error)]);let N=Reflect.apply(u,this,A.data),O=h._def.returns.safeParse(N,o);if(!O.success)throw new se([a(N,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ee.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ee.create()),returns:t||Ee.create(),typeName:B.ZodFunction,...L(r)})}},Je=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Je.create=(n,e)=>new Je({getter:n,typeName:B.ZodLazy,...L(e)});var Ke=class extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...L(e)});function ka(n,e){return new Xe({values:n,typeName:B.ZodEnum,...L(e)})}var Xe=class n extends P{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Xe.create=ka;var Qe=class extends P{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==R.string&&r.parsedType!==R.number){let a=U.objectValues(t);return k(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return k(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...L(e)});var Be=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return k(t,{code:T.invalid_type,expected:R.promise,received:t.parsedType}),F;let r=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Be.create=(n,e)=>new Be({type:n,typeName:B.ZodPromise,...L(e)});var pe=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{k(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async h=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let h=this._def.schema._parseSync({data:u,path:r.path,parent:r});return h.status==="aborted"?F:h.status==="dirty"?De(h.value):t.value==="dirty"?De(h.value):h}}if(a.type==="refinement"){let u=h=>{let x=a.refinement(h,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){let h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value),{status:t.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value).then(()=>({status:t.value,value:h.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let h=a.transform(u.value,o);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,o)).then(h=>({status:t.value,value:h})):F);U.assertNever(a)}};pe.create=(n,e,t)=>new pe({schema:n,typeName:B.ZodEffects,effect:e,...L(t)});pe.createWithPreprocess=(n,e,t)=>new pe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...L(t)});var le=class extends P{_parse(e){return this._getType(e)===R.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(n,e)=>new le({innerType:n,typeName:B.ZodOptional,...L(e)});var ve=class extends P{_parse(e){return this._getType(e)===R.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...L(e)});var et=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===R.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var tt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new se(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var xt=class extends P{_parse(e){if(this._getType(e)!==R.nan){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...L(n)});var Uu=Symbol("zod_brand"),Vt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Wt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?F:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends P{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...L(e)});function Ta(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ra(n,e={},t){return n?Oe.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let h=Ta(e,r),x=h.fatal??t??!0;a.addIssue({code:"custom",...h,fatal:x})}});if(!o){let u=Ta(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}}):Oe.create()}var $u={object:oe.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Du=(n,e={message:`Input not instance of ${n.name}`})=>Ra(t=>t instanceof n,e),Na=Fe.create,Sa=Ve.create,Vu=xt.create,Wu=We.create,Ca=qe.create,qu=ze.create,zu=mt.create,Zu=Ze.create,Gu=Ge.create,Hu=Oe.create,Yu=Ee.create,Ju=me.create,Ku=ht.create,Xu=Ie.create,Qu=oe.create,el=oe.strictCreate,tl=He.create,rl=nr.create,nl=Ye.create,il=xe.create,al=ir.create,sl=yt.create,ol=gt.create,ul=ar.create,ll=Je.create,cl=Ke.create,pl=Xe.create,dl=Qe.create,fl=Be.create,ml=pe.create,hl=le.create,yl=ve.create,gl=pe.createWithPreprocess,xl=Wt.create,vl=()=>Na().optional(),bl=()=>Sa().optional(),wl=()=>Ca().optional(),_l={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Tl=F;p();f();d();var Fa=m.strictObject({title:m.string(),content:m.string()});var Al=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Oa=m.string().refine(n=>Al.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Ba=m.strictObject({namespace:m.optional(Oa),client:m.optional(m.string()),error:m.optional(m.string()),timeoutError:m.optional(m.string()),environment:m.optional(m.string()),environmentUrls:m.optional(m.string()),version:m.optional(m.string())}),La=m.union([Oa,Ba]),El=m.strictObject({neverThrowErrors:m.optional(m.boolean()),outputEsm:m.optional(m.boolean()),esmOnly:m.optional(m.boolean()),outputSourceFiles:m.optional(m.boolean()),outputSrcOnly:m.optional(m.boolean()),includeCredentialsOnCrossOriginRequests:m.optional(m.boolean()),bundle:m.optional(m.boolean()),allowCustomFetcher:m.optional(m.boolean()),generateWebSocketClients:m.optional(m.boolean()),defaultTimeout:m.optional(m.union([m.literal("infinity"),m.number()])),skipResponseValidation:m.optional(m.boolean()),extraDependencies:m.optional(m.record(m.string())),extraDevDependencies:m.optional(m.record(m.string())),extraPeerDependencies:m.optional(m.record(m.string())),extraPeerDependenciesMeta:m.optional(m.record(m.any())),treatUnknownAsAny:m.optional(m.boolean()),noOptionalProperties:m.optional(m.boolean()),tolerateRepublish:m.optional(m.boolean()),packageJson:m.optional(m.record(m.any())),packageJsonMergeStrategy:m.optional(m.enum(["shallow","deep"])),exactOptionalPropertyTypes:m.optional(m.boolean()),publishToJsr:m.optional(m.boolean()),omitUndefined:m.optional(m.boolean()),useLegacyExports:m.optional(m.boolean()),streamType:m.optional(m.enum(["wrapper","web"])),fileResponseType:m.optional(m.enum(["stream","binary-response"])),formDataSupport:m.optional(m.enum(["Node16","Node18"])),fetchSupport:m.optional(m.enum(["node-fetch","native"])),packagePath:m.optional(m.string()),omitFernHeaders:m.optional(m.boolean()),includePlatformHeaders:m.optional(m.boolean()),userAgentOnly:m.optional(m.boolean()),allowUserAgentAppInfo:m.optional(m.boolean()),useDefaultRequestParameterValues:m.optional(m.boolean()),packageManager:m.optional(m.enum(["pnpm","yarn"])),flattenRequestParameters:m.optional(m.boolean()),respectOptionalRequestBody:m.optional(m.boolean()),deepObjectMapQueryParameters:m.optional(m.boolean()),exportAllRequestsAtRoot:m.optional(m.boolean()),customReadmeSections:m.optional(m.array(Fa)),testFramework:m.optional(m.enum(["jest","vitest"])),consolidateTypeFiles:m.optional(m.boolean()),generateEndpointMetadata:m.optional(m.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:m.boolean().optional(),linter:m.optional(m.enum(["biome","oxlint","none"])),formatter:m.optional(m.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:m.optional(m.boolean()),parameterNaming:m.optional(m.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:m.optional(m.boolean()),allowExtraFields:m.optional(m.boolean()),enableInlineTypes:m.optional(m.boolean()),inlineFileProperties:m.optional(m.boolean()),inlinePathParameters:m.optional(m.boolean()),naming:m.optional(La),namespaceExport:m.optional(m.string()),noSerdeLayer:m.optional(m.boolean()),serdeLayer:m.optional(m.boolean()),private:m.optional(m.boolean()),requireDefaultEnvironment:m.optional(m.boolean()),requireBaseUrl:m.optional(m.boolean()),retainOriginalCasing:m.optional(m.boolean()),useBigInt:m.optional(m.boolean()),useBrandedStringAliases:m.optional(m.boolean()),offsetSemantics:m.optional(m.enum(["item-index","page-index"])),customPagerName:m.optional(m.string()),resolveQueryParameterNameConflicts:m.optional(m.boolean()),alwaysSendAuth:m.optional(m.boolean()),"optional-auth":m.optional(m.boolean()),guardProcessEnvAccess:m.optional(m.boolean()),flattenAnyAuthOptions:m.optional(m.boolean()),generateReactQueryHooks:m.optional(m.boolean()),websocketHandlerMode:m.optional(m.enum(["replace","accumulate"])),includeContentHeadersOnFileDownloadResponse:m.optional(m.boolean()),includeUtilsOnUnionMembers:m.optional(m.boolean()),includeOtherInUnionTypes:m.optional(m.boolean()),writeUnitTests:m.optional(m.boolean()),generateWireTests:m.optional(m.boolean()),noScripts:m.optional(m.boolean()),skipNpmPkgFix:m.optional(m.boolean()),experimentalGenerateReadWriteOnlyTypes:m.optional(m.boolean()),defaultTimeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),timeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),includeApiReference:m.optional(m.boolean()),shouldGenerateWebsocketClients:m.optional(m.boolean()),_fernLicenseName:m.optional(m.string()),maxRetries:m.optional(m.number().int().min(0)),retryStatusCodes:m.optional(m.enum(["legacy","recommended"]))});function vt(n){return n?.serdeLayer!=null?!n.serdeLayer:n?.noSerdeLayer??!0}var I={};ae(I,{AstNode:()=>W,ClassInstantiation:()=>bt,CodeBlock:()=>wt,Comment:()=>Le,Function:()=>_t,FunctionInvocation:()=>Tt,MethodInvocation:()=>At,Parameter:()=>Et,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>ke,Types:()=>nt,Variable:()=>It,Writer:()=>ct,codeblock:()=>Sl,function_:()=>Cl,instantiateClass:()=>Fl,invokeFunction:()=>Ol,invokeMethod:()=>Bl,parameter:()=>Ll,reference:()=>Pl,variable:()=>jl});p();f();d();p();f();d();p();f();d();var bt=class extends W{constructor({class_:t,arguments_:r}){super();E(this,"class_");E(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var wt=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){return new de(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();E(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
|
|
20
|
-
`).forEach(r=>{t.writeLine(` * ${r}`)}),t.writeLine("*/"))}};p();f();d();p();f();d();var nt=class extends W{constructor(t){super();
|
|
18
|
+
`+this.buffer:this.buffer}stringifyImports(){let e="";for(let[t,r]of Object.entries(this.imports)){let a=this.defaultImports[t],s="",u=r.filter(x=>x.importFrom?.type==="named"),h=this.starImportAliases[t];if(u.length>0||a!=null||h!=null){if(e+="import",a!=null&&(e+=` ${a.name}`),u.length>0){for(let E of u.slice(0,-1))s+=`${E.name}, `;let x=u[u.length-1];x!=null&&(s+=`${x.name}`),a!=null&&(e+=","),e+=` { ${s} }`}h!=null&&((a!=null||u.length>0)&&(e+=", "),e+=` * as ${h}`),e+=` from "${t}";
|
|
19
|
+
`}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var m={};ae(m,{BRAND:()=>Uu,DIRTY:()=>De,EMPTY_PATH:()=>gu,INVALID:()=>F,NEVER:()=>Tl,OK:()=>ee,ParseStatus:()=>X,Schema:()=>P,ZodAny:()=>Oe,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Vt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>nr,ZodEffects:()=>pe,ZodEnum:()=>Xe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>ar,ZodIntersection:()=>Ye,ZodIssueCode:()=>T,ZodLazy:()=>Je,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>le,ZodParsedType:()=>R,ZodPipeline:()=>Wt,ZodPromise:()=>Be,ZodReadonly:()=>rt,ZodRecord:()=>ir,ZodSchema:()=>P,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>pe,ZodTuple:()=>xe,ZodType:()=>P,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ae,ZodVoid:()=>ht,addIssueToContext:()=>k,any:()=>Hu,array:()=>Xu,bigint:()=>Wu,boolean:()=>Ca,coerce:()=>_l,custom:()=>Ra,date:()=>qu,datetimeRegex:()=>Ia,defaultErrorMap:()=>Te,discriminatedUnion:()=>rl,effect:()=>ml,enum:()=>pl,function:()=>ul,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Du,intersection:()=>nl,isAborted:()=>tr,isAsync:()=>dt,isDirty:()=>rr,isValid:()=>Ce,late:()=>$u,lazy:()=>ll,literal:()=>cl,makeIssue:()=>Dt,map:()=>ol,nan:()=>Vu,nativeEnum:()=>dl,never:()=>Ju,null:()=>Gu,nullable:()=>yl,number:()=>Sa,object:()=>Qu,objectUtil:()=>wr,oboolean:()=>wl,onumber:()=>bl,optional:()=>hl,ostring:()=>vl,pipeline:()=>xl,preprocess:()=>gl,promise:()=>fl,quotelessJson:()=>mu,record:()=>al,set:()=>sl,setErrorMap:()=>yu,strictObject:()=>el,string:()=>Na,symbol:()=>zu,transformer:()=>ml,tuple:()=>il,undefined:()=>Zu,union:()=>tl,unknown:()=>Yu,util:()=>U,void:()=>Ku});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let s={};for(let u of a)s[u]=u;return s},n.getValidEnumValues=a=>{let s=n.objectKeys(a).filter(h=>typeof a[a[h]]!="number"),u={};for(let h of s)u[h]=a[h];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(s){return a[s]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.push(u);return s},n.find=(a,s)=>{for(let u of a)if(s(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(U||(U={}));var wr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(wr||(wr={}));var R=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(n)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(n)?R.array:n===null?R.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?R.promise:typeof Map<"u"&&n instanceof Map?R.map:typeof Set<"u"&&n instanceof Set?R.set:typeof Date<"u"&&n instanceof Date?R.date:R.object;default:return R.unknown}};var T=U.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"]),mu=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},a=s=>{for(let u of s.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let h=r,x=0;for(;x<u.path.length;){let E=u.path[x];x===u.path.length-1?(h[E]=h[E]||{_errors:[]},h[E]._errors.push(t(u))):h[E]=h[E]||{_errors:[]},h=h[E],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];t[s]=t[s]||[],t[s].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=n=>new oe(n);var hu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===R.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=hu;var wa=Te;function yu(n){wa=n}function pt(){return wa}p();f();d();var Dt=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,s=[...t,...a.path||[]],u={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let h="",x=r.filter(E=>!!E).slice().reverse();for(let E of x)h=E(u,{data:e,defaultError:h}).message;return{...a,path:s,message:h}},gu=[];function k(n,e){let t=pt(),r=Dt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let s=await a.key,u=await a.value;r.push({key:s,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:s,value:u}=a;if(s.status==="aborted"||u.status==="aborted")return F;s.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[s.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),tr=n=>n.status==="aborted",rr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var S;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(S||(S={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},_a=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function L(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,h)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??h.defaultError}:typeof h.data>"u"?{message:x??r??h.defaultError}:u.code!=="invalid_type"?{message:h.defaultError}:{message:x??t??h.defaultError}},description:a}}var P=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return _a(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(dt(a)?a:Promise.resolve(a));return _a(r,s)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,s)=>{let u=e(a),h=()=>s.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(h(),!1)):u?!0:(h(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new pe({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return le.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Be.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new pe({...L(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...L(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Vt({typeName:B.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...L(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},xu=/^c[^\s-]{8,}$/i,vu=/^[0-9a-z]+$/,bu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wu=/^[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,_u=/^[a-z0-9_-]{21}$/i,Tu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Eu=/^[-+]?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)?)??$/,Au=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Iu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,ku=/^(?:(?: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])$/,Ru=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Nu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Su=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ea="((\\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])))",Ou=new RegExp(`^${Ea}$`);function Aa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Bu(n){return new RegExp(`^${Aa(n)}$`)}function Ia(n){let e=`${Ea}T${Aa(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Lu(n,e){return!!((e==="v4"||!e)&&ku.test(n)||(e==="v6"||!e)&&Nu.test(n))}function Pu(n,e){if(!Tu.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function ju(n,e){return!!((e==="v4"||!e)&&Ru.test(n)||(e==="v6"||!e)&&Su.test(n))}var Fe=class n extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.string,received:s.parsedType}),F}let r=new X,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let u=e.data.length>s.value,h=e.data.length<s.value;(u||h)&&(a=this._getOrReturnCtx(e,a),u?k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):h&&k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Au.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"email",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")_r||(_r=new RegExp(Iu,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"emoji",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")wu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"uuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")_u.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"nanoid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")xu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")vu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid2",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")bu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ulid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),k(a,{validation:"url",code:T.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"regex",code:T.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.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)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Ia(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Ou.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Bu(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"duration",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Lu(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ip",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Pu(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"jwt",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?ju(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cidr",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Cu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?Fu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64url",code:T.invalid_string,message:s.message}),r.dirty()):U.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...S.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){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:e?.offset??!1,local:e?.local??!1,...S.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.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...L(n)});function Mu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,s=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return s%u/10**a}var Ve=class n extends P{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)!==R.number){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.number,received:s.parsedType}),F}let r,a=new X;for(let s of this._def.checks)s.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Mu(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_finite,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...L(n)});var We=class n extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let r,a=new X;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...L(n)});var qe=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...L(n)});var ze=class n extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.date,received:s.parsedType}),F}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_date}),F}let r=new X,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):U.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...L(n)});var mt=class extends P{_parse(e){if(this._getType(e)!==R.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...L(n)});var Ze=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...L(n)});var Ge=class extends P{_parse(e){if(this._getType(e)!==R.null){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...L(n)});var Oe=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Oe.create=n=>new Oe({typeName:B.ZodAny,...L(n)});var Ae=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ae.create=n=>new Ae({typeName:B.ZodUnknown,...L(n)});var me=class extends P{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.never,received:t.parsedType}),F}};me.create=n=>new me({typeName:B.ZodNever,...L(n)});var ht=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...L(n)});var Ie=class n extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==R.array)return k(t,{code:T.invalid_type,expected:R.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,h=t.data.length<a.exactLength.value;(u||h)&&(k(t,{code:u?T.too_big:T.too_small,minimum:h?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(k(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(k(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,h)=>a.type._parseAsync(new ce(t,u,t.path,h)))).then(u=>X.mergeArray(r,u));let s=[...t.data].map((u,h)=>a.type._parseSync(new ce(t,u,t.path,h)));return X.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...L(e)});function ft(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=le.create(ft(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof le?le.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var se=class n extends P{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(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let E=this._getOrReturnCtx(e);return k(E,{code:T.invalid_type,expected:R.object,received:E.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:u}=this._getCached(),h=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(let E in a.data)u.includes(E)||h.push(E);let x=[];for(let E of u){let N=s[E],O=a.data[E];x.push({key:{status:"valid",value:E},value:N._parse(new ce(a,O,a.path,E)),alwaysSet:E in a.data})}if(this._def.catchall instanceof me){let E=this._def.unknownKeys;if(E==="passthrough")for(let N of h)x.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(E==="strict")h.length>0&&(k(a,{code:T.unrecognized_keys,keys:h}),r.dirty());else if(E!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let E=this._def.catchall;for(let N of h){let O=a.data[N];x.push({key:{status:"valid",value:N},value:E._parse(new ce(a,O,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let E=[];for(let N of x){let O=await N.key,J=await N.value;E.push({key:O,value:J,alwaysSet:N.alwaysSet})}return E}).then(E=>X.mergeObjectSync(r,E)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:S.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof le;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return ka(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});var He=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(s){for(let h of s)if(h.result.status==="valid")return h.result;for(let h of s)if(h.result.status==="dirty")return t.common.issues.push(...h.ctx.common.issues),h.result;let u=s.map(h=>new oe(h.ctx.common.issues));return k(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async s=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let s,u=[];for(let x of r){let E={...t,common:{...t.common,issues:[]},parent:null},N=x._parseSync({data:t.data,path:t.path,parent:E});if(N.status==="valid")return N;N.status==="dirty"&&!s&&(s={result:N,ctx:E}),E.common.issues.length&&u.push(E.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let h=u.map(x=>new oe(x));return k(t,{code:T.invalid_union,unionErrors:h}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...L(e)});var Ee=n=>n instanceof Je?Ee(n.schema):n instanceof pe?Ee(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?Ee(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof le?[void 0,...Ee(n.unwrap())]:n instanceof ve?[null,...Ee(n.unwrap())]:n instanceof Vt||n instanceof rt?Ee(n.unwrap()):n instanceof tt?Ee(n._def.innerType):[],nr=class n extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return k(t,{code:T.invalid_type,expected:R.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let s of t){let u=Ee(s.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let h of u){if(a.has(h))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(h)}`);a.set(h,s)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...L(r)})}};function Tr(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===R.object&&r===R.object){let a=U.objectKeys(e),s=U.objectKeys(n).filter(h=>a.indexOf(h)!==-1),u={...n,...e};for(let h of s){let x=Tr(n[h],e[h]);if(!x.valid)return{valid:!1};u[h]=x.data}return{valid:!0,data:u}}else if(t===R.array&&r===R.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<n.length;s++){let u=n[s],h=e[s],x=Tr(u,h);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===R.date&&r===R.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ye=class extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(s,u)=>{if(tr(s)||tr(u))return F;let h=Tr(s.value,u.value);return h.valid?((rr(s)||rr(u))&&t.dirty(),{status:t.value,value:h.data}):(k(r,{code:T.invalid_intersection_types}),F)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,u])=>a(s,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ye.create=(n,e,t)=>new Ye({left:n,right:e,typeName:B.ZodIntersection,...L(t)});var xe=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.array)return k(r,{code:T.invalid_type,expected:R.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return k(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((u,h)=>{let x=this._def.items[h]||this._def.rest;return x?x._parse(new ce(r,u,r.path,h)):null}).filter(u=>!!u);return r.common.async?Promise.all(s).then(u=>X.mergeArray(t,u)):X.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...L(e)})};var ir=class n extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.object)return k(r,{code:T.invalid_type,expected:R.object,received:r.parsedType}),F;let a=[],s=this._def.keyType,u=this._def.valueType;for(let h in r.data)a.push({key:s._parse(new ce(r,h,r.path,h)),value:u._parse(new ce(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof P?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...L(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...L(t)})}},yt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.map)return k(r,{code:T.invalid_type,expected:R.map,received:r.parsedType}),F;let a=this._def.keyType,s=this._def.valueType,u=[...r.data.entries()].map(([h,x],E)=>({key:a._parse(new ce(r,h,r.path,[E,"key"])),value:s._parse(new ce(r,x,r.path,[E,"value"]))}));if(r.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let x of u){let E=await x.key,N=await x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}})}else{let h=new Map;for(let x of u){let E=x.key,N=x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...L(t)});var gt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.set)return k(r,{code:T.invalid_type,expected:R.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(k(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(k(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function u(x){let E=new Set;for(let N of x){if(N.status==="aborted")return F;N.status==="dirty"&&t.dirty(),E.add(N.value)}return{status:t.value,value:E}}let h=[...r.data.values()].map((x,E)=>s._parse(new ce(r,x,r.path,E)));return r.common.async?Promise.all(h).then(x=>u(x)):u(h)}min(e,t){return new n({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...L(e)});var ar=class n extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return k(t,{code:T.invalid_type,expected:R.function,received:t.parsedType}),F;function r(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let s={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Be){let h=this;return ee(async function(...x){let E=new oe([]),N=await h._def.args.parseAsync(x,s).catch(C=>{throw E.addIssue(r(x,C)),E}),O=await Reflect.apply(u,this,N);return await h._def.returns._def.type.parseAsync(O,s).catch(C=>{throw E.addIssue(a(O,C)),E})})}else{let h=this;return ee(function(...x){let E=h._def.args.safeParse(x,s);if(!E.success)throw new oe([r(x,E.error)]);let N=Reflect.apply(u,this,E.data),O=h._def.returns.safeParse(N,s);if(!O.success)throw new oe([a(N,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ae.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ae.create()),returns:t||Ae.create(),typeName:B.ZodFunction,...L(r)})}},Je=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Je.create=(n,e)=>new Je({getter:n,typeName:B.ZodLazy,...L(e)});var Ke=class extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...L(e)});function ka(n,e){return new Xe({values:n,typeName:B.ZodEnum,...L(e)})}var Xe=class n extends P{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Xe.create=ka;var Qe=class extends P{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==R.string&&r.parsedType!==R.number){let a=U.objectValues(t);return k(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return k(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...L(e)});var Be=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return k(t,{code:T.invalid_type,expected:R.promise,received:t.parsedType}),F;let r=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Be.create=(n,e)=>new Be({type:n,typeName:B.ZodPromise,...L(e)});var pe=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:u=>{k(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let u=a.transform(r.data,s);if(r.common.async)return Promise.resolve(u).then(async h=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let h=this._def.schema._parseSync({data:u,path:r.path,parent:r});return h.status==="aborted"?F:h.status==="dirty"?De(h.value):t.value==="dirty"?De(h.value):h}}if(a.type==="refinement"){let u=h=>{let x=a.refinement(h,s);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){let h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value),{status:t.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value).then(()=>({status:t.value,value:h.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let h=a.transform(u.value,s);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,s)).then(h=>({status:t.value,value:h})):F);U.assertNever(a)}};pe.create=(n,e,t)=>new pe({schema:n,typeName:B.ZodEffects,effect:e,...L(t)});pe.createWithPreprocess=(n,e,t)=>new pe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...L(t)});var le=class extends P{_parse(e){return this._getType(e)===R.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(n,e)=>new le({innerType:n,typeName:B.ZodOptional,...L(e)});var ve=class extends P{_parse(e){return this._getType(e)===R.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...L(e)});var et=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===R.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var tt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var xt=class extends P{_parse(e){if(this._getType(e)!==R.nan){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...L(n)});var Uu=Symbol("zod_brand"),Vt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Wt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?F:s.status==="dirty"?(t.dirty(),De(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends P{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...L(e)});function Ta(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ra(n,e={},t){return n?Oe.create().superRefine((r,a)=>{let s=n(r);if(s instanceof Promise)return s.then(u=>{if(!u){let h=Ta(e,r),x=h.fatal??t??!0;a.addIssue({code:"custom",...h,fatal:x})}});if(!s){let u=Ta(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}}):Oe.create()}var $u={object:se.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Du=(n,e={message:`Input not instance of ${n.name}`})=>Ra(t=>t instanceof n,e),Na=Fe.create,Sa=Ve.create,Vu=xt.create,Wu=We.create,Ca=qe.create,qu=ze.create,zu=mt.create,Zu=Ze.create,Gu=Ge.create,Hu=Oe.create,Yu=Ae.create,Ju=me.create,Ku=ht.create,Xu=Ie.create,Qu=se.create,el=se.strictCreate,tl=He.create,rl=nr.create,nl=Ye.create,il=xe.create,al=ir.create,ol=yt.create,sl=gt.create,ul=ar.create,ll=Je.create,cl=Ke.create,pl=Xe.create,dl=Qe.create,fl=Be.create,ml=pe.create,hl=le.create,yl=ve.create,gl=pe.createWithPreprocess,xl=Wt.create,vl=()=>Na().optional(),bl=()=>Sa().optional(),wl=()=>Ca().optional(),_l={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Tl=F;p();f();d();var Fa=m.strictObject({title:m.string(),content:m.string()});var El=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Oa=m.string().refine(n=>El.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Ba=m.strictObject({namespace:m.optional(Oa),client:m.optional(m.string()),error:m.optional(m.string()),timeoutError:m.optional(m.string()),environment:m.optional(m.string()),environmentUrls:m.optional(m.string()),version:m.optional(m.string())}),La=m.union([Oa,Ba]),Al=m.strictObject({neverThrowErrors:m.optional(m.boolean()),outputEsm:m.optional(m.boolean()),esmOnly:m.optional(m.boolean()),outputSourceFiles:m.optional(m.boolean()),outputSrcOnly:m.optional(m.boolean()),includeCredentialsOnCrossOriginRequests:m.optional(m.boolean()),bundle:m.optional(m.boolean()),allowCustomFetcher:m.optional(m.boolean()),generateWebSocketClients:m.optional(m.boolean()),defaultTimeout:m.optional(m.union([m.literal("infinity"),m.number()])),skipResponseValidation:m.optional(m.boolean()),extraDependencies:m.optional(m.record(m.string())),extraDevDependencies:m.optional(m.record(m.string())),extraPeerDependencies:m.optional(m.record(m.string())),extraPeerDependenciesMeta:m.optional(m.record(m.any())),treatUnknownAsAny:m.optional(m.boolean()),noOptionalProperties:m.optional(m.boolean()),tolerateRepublish:m.optional(m.boolean()),packageJson:m.optional(m.record(m.any())),packageJsonMergeStrategy:m.optional(m.enum(["shallow","deep"])),exactOptionalPropertyTypes:m.optional(m.boolean()),publishToJsr:m.optional(m.boolean()),omitUndefined:m.optional(m.boolean()),useLegacyExports:m.optional(m.boolean()),streamType:m.optional(m.enum(["wrapper","web"])),fileResponseType:m.optional(m.enum(["stream","binary-response"])),formDataSupport:m.optional(m.enum(["Node16","Node18"])),fetchSupport:m.optional(m.enum(["node-fetch","native"])),packagePath:m.optional(m.string()),omitFernHeaders:m.optional(m.boolean()),includePlatformHeaders:m.optional(m.boolean()),userAgentOnly:m.optional(m.boolean()),allowUserAgentAppInfo:m.optional(m.boolean()),useDefaultRequestParameterValues:m.optional(m.boolean()),packageManager:m.optional(m.enum(["pnpm","yarn"])),flattenRequestParameters:m.optional(m.boolean()),respectOptionalRequestBody:m.optional(m.boolean()),deepObjectMapQueryParameters:m.optional(m.boolean()),exportAllRequestsAtRoot:m.optional(m.boolean()),customReadmeSections:m.optional(m.array(Fa)),testFramework:m.optional(m.enum(["jest","vitest"])),consolidateTypeFiles:m.optional(m.boolean()),generateEndpointMetadata:m.optional(m.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:m.boolean().optional(),linter:m.optional(m.enum(["biome","oxlint","none"])),formatter:m.optional(m.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:m.optional(m.boolean()),parameterNaming:m.optional(m.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:m.optional(m.boolean()),allowExtraFields:m.optional(m.boolean()),enableInlineTypes:m.optional(m.boolean()),inlineFileProperties:m.optional(m.boolean()),inlinePathParameters:m.optional(m.boolean()),naming:m.optional(La),namespaceExport:m.optional(m.string()),noSerdeLayer:m.optional(m.boolean()),serdeLayer:m.optional(m.boolean()),private:m.optional(m.boolean()),requireDefaultEnvironment:m.optional(m.boolean()),requireBaseUrl:m.optional(m.boolean()),retainOriginalCasing:m.optional(m.boolean()),useBigInt:m.optional(m.boolean()),useBrandedStringAliases:m.optional(m.boolean()),offsetSemantics:m.optional(m.enum(["item-index","page-index"])),customPagerName:m.optional(m.string()),resolveQueryParameterNameConflicts:m.optional(m.boolean()),alwaysSendAuth:m.optional(m.boolean()),"optional-auth":m.optional(m.boolean()),guardProcessEnvAccess:m.optional(m.boolean()),flattenAnyAuthOptions:m.optional(m.boolean()),generateReactQueryHooks:m.optional(m.boolean()),websocketHandlerMode:m.optional(m.enum(["replace","accumulate"])),includeContentHeadersOnFileDownloadResponse:m.optional(m.boolean()),includeUtilsOnUnionMembers:m.optional(m.boolean()),includeOtherInUnionTypes:m.optional(m.boolean()),writeUnitTests:m.optional(m.boolean()),generateWireTests:m.optional(m.boolean()),noScripts:m.optional(m.boolean()),skipNpmPkgFix:m.optional(m.boolean()),experimentalGenerateReadWriteOnlyTypes:m.optional(m.boolean()),defaultTimeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),timeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),includeApiReference:m.optional(m.boolean()),shouldGenerateWebsocketClients:m.optional(m.boolean()),_fernLicenseName:m.optional(m.string()),maxRetries:m.optional(m.number().int().min(0)),retryStatusCodes:m.optional(m.enum(["legacy","recommended"]))});function vt(n){return n?.serdeLayer!=null?!n.serdeLayer:n?.noSerdeLayer??!0}var I={};ae(I,{AstNode:()=>W,ClassInstantiation:()=>bt,CodeBlock:()=>wt,Comment:()=>Le,Function:()=>_t,FunctionInvocation:()=>Tt,MethodInvocation:()=>Et,Parameter:()=>At,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>ke,Types:()=>nt,Variable:()=>It,Writer:()=>ct,codeblock:()=>Sl,function_:()=>Cl,instantiateClass:()=>Fl,invokeFunction:()=>Ol,invokeMethod:()=>Bl,parameter:()=>Ll,reference:()=>Pl,variable:()=>jl});p();f();d();p();f();d();p();f();d();var bt=class extends W{constructor({class_:t,arguments_:r}){super();A(this,"class_");A(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var wt=class extends W{constructor(t){super();A(this,"args");this.args=t}write(t){return new de(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();A(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
|
|
20
|
+
`).forEach(r=>{t.writeLine(` * ${r}`)}),t.writeLine("*/"))}};p();f();d();p();f();d();var nt=class extends W{constructor(t){super();A(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"string":t.write("string");break;case"number":t.write("number");break;case"bigint":t.write("bigint");break;case"boolean":t.write("boolean");break;case"array":this.internalType.valueType.write(t),t.write("[]");break;case"map":t.write("Record<"),this.internalType.keyType.write(t),t.write(", "),this.internalType.valueType.write(t),t.write(">");break;case"object":t.write("{"),t.indent();for(let[r,a]of Object.entries(this.internalType.fields))t.write(`${r}: `),a.write(t),t.writeLine(",");t.dedent(),t.write("}");break;case"enum":t.write("enum");break;case"any":t.write("any");break;case"promise":t.write("Promise<"),this.internalType.value.write(t),t.write(">");break;case"unknown":t.write("unknown");break;case"void":t.write("void");break;case"undefined":t.write("undefined");break;case"null":t.write("null");break;case"never":t.write("never");break;case"nop":break;default:q(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(t){return new this({type:"array",valueType:t})}static object(t){return new this({type:"object",fields:t})}static enum(t){return new this({type:"enum",values:t})}static any(){return new this({type:"any"})}static promise(t){return t.internalType.type==="promise"?t:new this({type:"promise",value:t})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};var _t=class extends W{constructor({name:t,parameters:r,async:a,body:s,return_:u,docs:h}){super();A(this,"name");A(this,"parameters");A(this,"async");A(this,"body");A(this,"return_");A(this,"docs");this.name=t,this.parameters=r,this.async=a??!1,this.body=s,this.return_=u,this.docs=h}write(t){t.writeNode(new Le({docs:this.docs})),this.async&&t.write("async "),t.write("function "),t.write(`${this.name}`),this.writeParameters(t),this.return_!=null&&(t.write(": "),t.writeNode(this.async?nt.promise(this.return_):this.return_)),t.writeLine(" {"),t.indent(),this.body?.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeParameters(t){if(this.parameters.length===0){t.write("()");return}t.indent(),t.writeLine("(");for(let r of this.parameters)t.writeNode(r),t.writeLine(",");t.dedent(),t.write(")")}};p();f();d();var Tt=class extends W{constructor({function_:t,arguments_:r}){super();A(this,"function_");A(this,"arguments_");this.function_=t,this.arguments_=r}write(t){t.writeNode(this.function_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var Et=class extends W{constructor({on:t,method:r,arguments_:a,async:s}){super();A(this,"on");A(this,"method");A(this,"arguments_");A(this,"async");this.on=t,this.method=r,this.arguments_=a,this.async=s}write(t){this.async&&t.write("await "),this.on.write(t),t.write("."),t.write(this.method),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var At=class extends W{constructor({name:t,type:r,docs:a}){super();A(this,"name");A(this,"type");A(this,"docs");this.name=t,this.type=r,this.docs=a}write(t){this.docs!=null&&t.writeNode(new Le({docs:this.docs})),t.write(`${this.name}: `),this.type.write(t)}};p();f();d();var it=class extends W{constructor({name:t,importFrom:r,memberName:a}){super();A(this,"name");A(this,"importFrom");A(this,"memberName");this.name=t,this.importFrom=r,this.memberName=a}write(t){this.importFrom!=null&&t.addImport(this);let r=this.importFrom?.type==="star"?`${this.importFrom.starImportAlias}.`:"",a=this.memberName!=null?`.${this.memberName}`:"";t.write(`${r}${this.name}${a}`)}};p();f();d();var ke=class n extends W{constructor(t){super();A(this,"internalType");this.internalType=t}write(t){let r=vt(t.customConfig),a=!!t.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{t.write("new Blob(["),t.writeNode(n.string(this.internalType.value)),t.write("])");break}case"boolean":{t.write(this.internalType.value.toString());break}case"bigint":{if(a){t.write(`BigInt("${this.internalType.value.toString()}")`);return}t.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(r){t.writeNode(n.string(this.internalType.value));return}t.write("new Date("),t.writeNode(n.string(this.internalType.value)),t.write(")");break}case"number":{t.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:t,object:this.internalType});break}case"record":{this.writeRecord({writer:t,record:this.internalType});break}case"reference":{t.writeNode(this.internalType.value);break}case"set":{if(r||this.isSetOfObjects()){t.writeNode(n.array({values:this.internalType.values}));return}t.write("new Set("),this.writeIterable({writer:t,iterable:this.internalType}),t.write(")");break}case"string":{this.internalType.value.includes(`
|
|
21
21
|
`)?this.writeStringWithBackticks({writer:t,value:this.internalType.value}):t.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:t,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:t,value:this.internalType.value});break}case"null":{t.write("null");break}case"nop":break;default:q(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(t=>t.isObject())}writeStringWithBackticks({writer:t,value:r}){t.write("`");let a=r.split(`
|
|
22
|
-
`),
|
|
22
|
+
`),s=a[0]+`
|
|
23
23
|
`,u=a.slice(1).join(`
|
|
24
|
-
`);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=Rl({values:r.values});if(a.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let o of a)o.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:r}){let a=kl({entries:r.entries});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)this.writeObjectKey({writer:t,key:o.key}),t.write(": "),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObjectKey({writer:t,key:r}){let a=r.internalType;if(a.type==="string"&&Pa(a.value)){t.write(a.value);return}r.write(t)}writeObject({writer:t,object:r}){let a=Il({fields:r.fields});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let o of a)t.write(`${o.name}: `),o.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}getObjectFields(){return this.internalType.type==="object"?this.internalType.fields:void 0}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let a of r)t.writeNode(n.unknown(a)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[o,u]of a)Pa(o)?t.write(`${o}: `):(t.writeNode(n.string(o)),t.write(": ")),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function Pa(n){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n)}function Il({fields:n}){return n.filter(e=>!ke.isNop(e.value))}function kl({entries:n}){return n.filter(e=>!ke.isNop(e.key)&&!ke.isNop(e.value))}function Rl({values:n}){return n.filter(e=>!ke.isNop(e))}p();f();d();var It=class extends W{constructor(t){super();E(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};function Sl(n){return new wt(n)}function Cl(n){return new _t(n)}function Fl(n){return new bt(n)}function Ol(n){return new Tt(n)}function Bl(n){return new At(n)}function Ll(n){return new Et(n)}function Pl(n){return new it(n)}function jl(n){return new It(n)}p();f();d();p();f();d();function Ma({generatorConfig:n,isPackagePrivate:e}){let t=n.output.mode;switch(t.type){case"downloadFiles":return;case"publish":return{packageName:t.registriesV2.npm.packageName,version:t.version,private:e,publishInfo:{registryUrl:t.registriesV2.npm.registryUrl,token:t.registriesV2.npm.token},license:ja(n.license),repoUrl:void 0};case"github":if(t.publishInfo!=null&&t.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${t.publishInfo.type} instead`);return{packageName:t.publishInfo!=null?t.publishInfo.packageName:"",version:t.version,private:e,publishInfo:void 0,repoUrl:Ml(t.repoUrl),license:ja(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Ml(n){if(n!=null)return n.startsWith("https://github.com/")?`git+${n}`:n.startsWith("ssh://github.com/")?`github:${qt(n).replace("ssh://github.com/","")}`:n.startsWith("https://bitbucket.org/")?`bitbucket:${qt(n).replace("https://bitbucket.org/","")}`:n.startsWith("ssh://bitbucket.org/")?`bitbucket:${qt(n).replace("ssh://bitbucket.org/","")}`:n.startsWith("https://gitlab.com/")?`gitlab:${qt(n).replace("https://gitlab.com/","")}`:n.startsWith("ssh://gitlab.com/")?`gitlab:${qt(n).replace("ssh://gitlab.com/","")}`:(n.startsWith("git+")||(n=`git+${n}`),n.endsWith(".git")||(n=`${n}.git`),n)}function qt(n){return n.endsWith(".git")?n.slice(0,-4):n}function ja(n){return n?._visit({basic:e=>e.id,custom:e=>`See ${e.filename}`,_other:()=>{}})}p();f();d();function Ar({organization:n,workspaceName:e,namespaceExport:t,naming:r}){return(typeof r=="string"?r:r?.namespace)??t??`${Ue(St(n))}${Ue(St(e))}`}function Er({namespaceExport:n,naming:e}){let t=typeof e=="string"?{}:e,r=e!=null?Ue(St(n)):n;return{namespace:n,client:t?.client??`${r}Client`,error:t?.error??`${r}Error`,timeoutError:t?.timeoutError??`${r}TimeoutError`,environment:t?.environment??`${r}Environment`,environmentUrls:t?.environmentUrls??`${r}EnvironmentUrls`,version:t?.version??`${r}Version`}}p();f();d();p();f();d();var zt={};ae(zt,{AvailabilityStatus:()=>Ua,GlobalParameterApplyMode:()=>Xa,GlobalParameterLocation:()=>Qa,PrimitiveTypeV1:()=>es,commons:()=>Ir,dynamic:()=>Cr,generatorExec:()=>Or,globalParameters:()=>Br,types:()=>Lr});p();f();d();p();f();d();var Ir={};ae(Ir,{AvailabilityStatus:()=>Ua});p();f();d();p();f();d();var Ua={InDevelopment:"IN_DEVELOPMENT",PreRelease:"PRE_RELEASE",GeneralAvailability:"GENERAL_AVAILABILITY",Deprecated:"DEPRECATED",Alpha:"ALPHA",Beta:"BETA",Preview:"PREVIEW",Legacy:"LEGACY"};var Cr={};ae(Cr,{AuthRequirement:()=>$a,ErrorSeverity:()=>Ga,HttpMethod:()=>za,ObjectPropertyAccess:()=>Ha,PrimitiveTypeV1:()=>Ya,auth:()=>kr,commons:()=>Da,declaration:()=>Va,endpoints:()=>Wa,environment:()=>qa,http:()=>Rr,ir:()=>Za,snippets:()=>Nr,types:()=>Sr,variables:()=>Ja});p();f();d();p();f();d();var kr={};ae(kr,{AuthRequirement:()=>$a});p();f();d();p();f();d();var $a={All:"ALL",Any:"ANY",EndpointSecurity:"ENDPOINT_SECURITY"};var Da={};p();f();d();var Va={};p();f();d();var Wa={};p();f();d();var qa={};p();f();d();var Rr={};ae(Rr,{HttpMethod:()=>za});p();f();d();p();f();d();var za={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var Za={};p();f();d();var Nr={};ae(Nr,{ErrorSeverity:()=>Ga});p();f();d();p();f();d();var Ga={Critical:"CRITICAL",Warning:"WARNING"};var Sr={};ae(Sr,{ObjectPropertyAccess:()=>Ha,PrimitiveTypeV1:()=>Ya});p();f();d();p();f();d();var Ha={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var Ya={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var Ja={};p();f();d();var Or={};ae(Or,{LicenseId:()=>Ka,config:()=>Fr});p();f();d();p();f();d();var Fr={};ae(Fr,{LicenseId:()=>Ka});p();f();d();p();f();d();var Ka={Mit:"MIT",Apache2:"Apache-2.0"};var Br={};ae(Br,{GlobalParameterApplyMode:()=>Xa,GlobalParameterLocation:()=>Qa});p();f();d();p();f();d();var Xa={Explicit:"explicit",Auto:"auto"};p();f();d();var Qa={Header:"header",Query:"query",Body:"body",Path:"path"};var Lr={};ae(Lr,{PrimitiveTypeV1:()=>es});p();f();d();p();f();d();var es={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var Ul="value",sr=class{constructor({context:e}){E(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?I.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),I.TypeLiteral.nop());if(e.value===void 0)return I.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,convertOpts:t});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value,convertOpts:t});case"map":return this.convertMap({map:e.typeReference,value:e.value,convertOpts:t});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?I.TypeLiteral.nop():this.convertNamed({named:r,value:e.value,as:e.as,convertOpts:t})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,convertOpts:t});case"unknown":return this.convertUnknown({value:e.value,convertOpts:t});default:q(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.array({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.set({values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertMap({map:e,value:t,convertOpts:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),I.TypeLiteral.nop()):I.TypeLiteral.record({entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"key",convertOpts:r}),value:this.convert({typeReference:e.value,value:o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,convertOpts:a}){switch(e.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?I.TypeLiteral.reference(I.codeblock(o=>{o.writeNode(I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})})),o.write("("),o.writeNode(this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a})),o.write(")")})):this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:a});case"enum":return this.convertEnum({enum_:e,value:t,convertOpts:a});case"object":return this.convertObject({object_:e,value:t,convertOpts:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:a});default:q(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:r}){let a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return I.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:o,convertOpts:r});if(u==null)return I.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return I.TypeLiteral.reference(I.codeblock(x=>{x.writeNode(I.invokeMethod({on:I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})}),method:this.context.getMethodName(o.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:a,unionVariant:o,unionProperties:u,convertOpts:r})}))}));let h={name:this.context.getPropertyNameFromNameAndWireValue(e.discriminant),value:I.TypeLiteral.string(o.discriminantValue.wireValue)};return I.TypeLiteral.object({fields:[h,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t,convertOpts:r}){let a=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let o=this.context.resolveNamedType({typeId:t.typeId});if(o==null)return;let u=this.convertNamed({named:o,value:e.value,convertOpts:r});if(!u.isObject()){this.context.errors.add({severity:$.Critical,message:"Internal error; expected union value to be an object"});return}let h=u.asObjectOrThrow();return[...a,...h.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let o=this.context.getRecord(e.value);return o==null?[...a,{name:Ul,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyNameFromNameAndWireValue(t.discriminantValue),value:this.convert({typeReference:t.typeReference,value:o[t.discriminantValue.wireValue],convertOpts:r})}]}finally{this.context.errors.unscope()}case"noProperties":return a;default:q(t)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:e,unionVariant:t,unionProperties:r,convertOpts:a}){return t.type==="singleProperty"&&this.context.getRecord(e.value)==null&&r.length===1?[this.convert({typeReference:t.typeReference,value:e.value,convertOpts:a})]:r.length>0?[I.TypeLiteral.object({fields:r})]:[]}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t,convertOpts:r}){return this.context.associateByWireValue({parameters:t.properties??[],values:this.context.getRecord(e.value)??{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyNameFromNameAndWireValue(o.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t,convertOpts:r}){let a=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(e.properties,r),values:this.context.getRecord(t)??{}});return I.TypeLiteral.object({fields:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyNameFromNameAndWireValue(o.name),value:this.convert({...o,convertOpts:r})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(e,t){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof t>"u"||(t.isForRequest&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.ReadOnly)),t.isForResponse&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.WriteOnly))),e}convertEnum({enum_:e,value:t}){let r=this.getEnumValue({enum_:e,value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(a=>a.wireValue===t)==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:r}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r});return a??I.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r}){for(let a of e.types){let o=this.context.errors.size();try{let u=this.convert({typeReference:a,value:t,convertOpts:r});if(I.TypeLiteral.isNop(u)||this.context.errors.size()>o){this.context.errors.truncate(o);continue}return u}catch{this.context.errors.truncate(o);continue}}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e,convertOpts:t}){return I.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r,convertOpts:a}){switch(e){case"INTEGER":case"UINT":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"LONG":case"UINT_64":{let o=this.getValueAsNumber({value:t,as:r});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.number(o)}case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.number(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:t,as:r});return o==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(o)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.string(o)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():I.TypeLiteral.datetime(o)}case"BIG_INTEGER":{let o=this.context.getValueAsString({value:t});return o==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(o)):I.TypeLiteral.string(o)}default:q(e)}}getValueAsNumber({value:e,as:t}){let r=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};p();f();d();var or=class{constructor({context:e}){E(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getPropertyNameFromNameAndWireValue(o),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyNameFromNameAndWireValue(o),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyNameFromNameAndWireValue(o.name),value:this.getBodyProperty({property:o,record:a})});break;default:q(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?e.isOptional===!0?I.TypeLiteral.nop():this.context.getFilePlaceholder():I.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null||r.length===0?e.isOptional===!0?I.TypeLiteral.nop():I.TypeLiteral.array({values:[this.context.getFilePlaceholder()]}):I.TypeLiteral.array({values:r.map(a=>I.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?I.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var $l=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Dl="/path/to/your/file",ur=class n extends Ut{constructor({ir:t,config:r}){super({ir:t,config:r});E(this,"ir");E(this,"customConfig");E(this,"dynamicTypeLiteralMapper");E(this,"filePropertyMapper");E(this,"moduleName");E(this,"namespaceExport");E(this,"resolvedClientName");E(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new sr({context:this}),this.filePropertyMapper=new or({context:this}),this.moduleName=Vl({config:r,customConfig:this.customConfig}),this.namespaceExport=Ar({organization:r.organization,workspaceName:r.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let a=Er({namespaceExport:this.namespaceExport,naming:this.customConfig?.naming});this.resolvedClientName=a.client,this.resolvedEnvironmentName=a.environment}clone(){return new n({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return this.resolvedClientName}getPropertyName(t){return this.customConfig?.retainOriginalCasing||vt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.camelCase.unsafeName}getPropertyNameFromNameAndWireValue(t){return this.customConfig?.retainOriginalCasing||vt(this.customConfig)?this.formatOriginalPropertyName(t.wireValue):t.name.camelCase.unsafeName}getMethodName(t){return t.camelCase.unsafeName}getTypeName(t){return t.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return this.getEnvironmentsTypeReference(r)}getFullyQualifiedReference({declaration:t}){return t.fernFilepath.allParts.length>0?`${t.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}.${this.getTypeName(t.name)}`:`${this.getTypeName(t.name)}`}getEnvironmentsTypeReference(t){return I.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}getFilePlaceholder(){return I.TypeLiteral.reference(I.invokeFunction({function_:I.reference({name:"createReadStream",importFrom:{type:"star",moduleName:"fs",starImportAlias:"fs"}}),arguments_:[I.TypeLiteral.string(Dl)]}))}formatOriginalPropertyName(t){return $l.test(t)?t:JSON.stringify(t)}};function Vl({config:n,customConfig:e}){return Ma({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var ts="client",rs="main",Wl={type:"primitive",value:"STRING"};function ql(n){return"wrapperProperty"in n}function zl(n){return ql(n)?n.wrapperProperty??void 0:void 0}function Zl(n){return"requirement"in n}function Gl(n){return Zl(n)?n.requirement??void 0:void 0}var lr=class{constructor({context:e}){E(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return I.codeblock(r=>{r.writeNode(I.function_({name:rs,async:!0,parameters:[],body:I.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(I.invokeFunction({function_:I.reference({name:rs}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return I.variable({name:ts,const:!0,initializer:I.instantiateClass({class_:I.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],a=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&r.push(...a),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:$.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(fe.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(fe.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?I.TypeLiteral.nop():I.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:$.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return I.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:$.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return I.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?I.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Wl,value:a})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:q(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:$.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:$.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.username),value:I.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:I.TypeLiteral.string(t.password)}]})}getConstructorBearerAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.token),value:I.TypeLiteral.string(t.token)}]})}getConstructorHeaderAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]})}getConstructorOAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.clientId),value:I.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:I.TypeLiteral.string(t.clientSecret)}]})}getAuthWrapperPropertyName(e){return e.camelCase.unsafeName==="oAuth"?"oauth":e.camelCase.unsafeName}shouldFlattenAuthFields(e){if(this.context.customConfig?.flattenAnyAuthOptions!==!0)return!1;let t=Gl(e);return t==null||t==="ANY"}wrapAuthFields({auth:e,fields:t}){let r=zl(e);return r==null||this.shouldFlattenAuthFields(e)?t:[{name:this.getAuthWrapperPropertyName(r),value:I.TypeLiteral.object({fields:t})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=t[a.name.wireValue],u=this.getConstructorHeaderArg({header:a,value:o});u!=null&&r.push(u)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!I.TypeLiteral.isNop(r))return{name:e.name.name.camelCase.unsafeName,value:r}}callMethod({endpoint:e,snippet:t}){return I.invokeMethod({on:I.reference({name:ts}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:q(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(fe.PathParameters);let a=[...this.context.ir.pathParameters??[],...e.pathParameters??[]];if(a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody),e.body!=null&&!this.callOmitsRequestBody({request:e,snippet:t})){let o=this.getBodyRequestArg({body:e.body,value:t.requestBody});I.TypeLiteral.isNop(o)||r.push(o)}return this.context.errors.unscope(),r}callOmitsRequestBody({request:e,snippet:t}){if(this.context.customConfig?.respectOptionalRequestBody!==!0||e.bodyRequired!==!1)return!1;let r=t.requestBody;return r==null||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:$.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),I.TypeLiteral.nop()):I.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!0,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!0};this.context.errors.scope(fe.PathParameters);let u=[];e.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody);let h=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(x=>x.value)),o||r.push(...h.fileFields.map(x=>x.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:a,inlineFileProperties:o})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:h})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(fe.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).map(O=>({name:this.context.getPropertyNameFromNameAndWireValue(O.name),value:this.context.dynamicTypeLiteralMapper.convert({...O,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(fe.Headers);let x=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).map(O=>({name:this.context.getPropertyNameFromNameAndWireValue(O.name),value:this.context.dynamicTypeLiteralMapper.convert({...O,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody);let A=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];this.context.errors.unscope();let N=new Set(A.map(O=>O.name));return I.TypeLiteral.object({fields:[...r.filter(O=>!N.has(O.name)),...u,...x,...A]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":{let a;if(this.context.customConfig?.flattenRequestParameters===!0&&e.bodyType.type==="typeReference"&&e.bodyType.value.type==="named"&&this.context.resolveNamedType({typeId:e.bodyType.value.value})?.type==="object"){a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.bodyType.value,value:t,convertOpts:{isForRequest:!0}});let h=a.getObjectFields();if(h!=null)return h}let o=this.getReferencedRequestBodyPropertyObjectField({body:e,value:t,literal:a});return I.TypeLiteral.isNop(o.value)?[]:[o]}case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:q(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return this.context.customConfig?.inlineFileProperties??!0?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:e,value:t,literal:r}){return{name:this.context.getPropertyName(e.bodyKey),value:r??this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}});for(let o of a)r.push({name:this.context.getPropertyNameFromNameAndWireValue(o.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let o of a)r.push({name:this.context.getPropertyNameFromNameAndWireValue(o.name),value:this.context.dynamicTypeLiteralMapper.convert({...o,convertOpts:{isForRequest:!0}})});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};var Pr=class extends Pt{constructor({ir:e,config:t}){super(new ur({ir:e,config:t}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new lr({context:e})}};export{Pr as DynamicSnippetsGenerator};
|
|
24
|
+
`);t.write(s.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=Rl({values:r.values});if(a.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let s of a)s.write(t),t.writeLine(",");t.dedent(),t.write("]")}writeRecord({writer:t,record:r}){let a=kl({entries:r.entries});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let s of a)this.writeObjectKey({writer:t,key:s.key}),t.write(": "),s.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}writeObjectKey({writer:t,key:r}){let a=r.internalType;if(a.type==="string"&&Pa(a.value)){t.write(a.value);return}r.write(t)}writeObject({writer:t,object:r}){let a=Il({fields:r.fields});if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let s of a)t.write(`${s.name}: `),s.value.write(t),t.writeLine(",");t.dedent(),t.write("}")}static array({values:t}){return new this({type:"array",values:t})}static bigint(t){return new this({type:"bigint",value:t})}static blob(t){return new this({type:"blob",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static datetime(t){return new this({type:"datetime",value:t})}static number(t){return new this({type:"number",value:t})}static object({fields:t}){return new this({type:"object",fields:t})}getObjectFields(){return this.internalType.type==="object"?this.internalType.fields:void 0}static record({entries:t}){return new this({type:"record",entries:t})}static reference(t){return new this({type:"reference",value:t})}static set({values:t}){return new this({type:"set",values:t})}static string(t){return new this({type:"string",value:t})}static tuple({values:t}){return new this({type:"tuple",values:t})}static unknown(t){return new this({type:"unknown",value:t})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(r.includes('"')?`\`${r}\``:`"${r}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownObject({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("[]");return}t.writeLine("["),t.indent();for(let a of r)t.writeNode(n.unknown(a)),t.writeLine(",");t.dedent(),t.write("]")}writeUnknownObject({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("{}");return}t.writeLine("{"),t.indent();for(let[s,u]of a)Pa(s)?t.write(`${s}: `):(t.writeNode(n.string(s)),t.write(": ")),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function Pa(n){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n)}function Il({fields:n}){return n.filter(e=>!ke.isNop(e.value))}function kl({entries:n}){return n.filter(e=>!ke.isNop(e.key)&&!ke.isNop(e.value))}function Rl({values:n}){return n.filter(e=>!ke.isNop(e))}p();f();d();var It=class extends W{constructor(t){super();A(this,"args");this.args=t}write(t){this.args.export&&t.write("export "),this.args.const?t.write("const "):t.write("let "),t.write(`${this.args.name} = `),t.writeNode(this.args.initializer)}};function Sl(n){return new wt(n)}function Cl(n){return new _t(n)}function Fl(n){return new bt(n)}function Ol(n){return new Tt(n)}function Bl(n){return new Et(n)}function Ll(n){return new At(n)}function Pl(n){return new it(n)}function jl(n){return new It(n)}p();f();d();p();f();d();function Ma({generatorConfig:n,isPackagePrivate:e}){let t=n.output.mode;switch(t.type){case"downloadFiles":return;case"publish":return{packageName:t.registriesV2.npm.packageName,version:t.version,private:e,publishInfo:{registryUrl:t.registriesV2.npm.registryUrl,token:t.registriesV2.npm.token},license:ja(n.license),repoUrl:void 0};case"github":if(t.publishInfo!=null&&t.publishInfo.type!=="npm")throw new Error(`Expected to receive npm publish info but received ${t.publishInfo.type} instead`);return{packageName:t.publishInfo!=null?t.publishInfo.packageName:"",version:t.version,private:e,publishInfo:void 0,repoUrl:Ml(t.repoUrl),license:ja(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Ml(n){if(n!=null)return n.startsWith("https://github.com/")?`git+${n}`:n.startsWith("ssh://github.com/")?`github:${qt(n).replace("ssh://github.com/","")}`:n.startsWith("https://bitbucket.org/")?`bitbucket:${qt(n).replace("https://bitbucket.org/","")}`:n.startsWith("ssh://bitbucket.org/")?`bitbucket:${qt(n).replace("ssh://bitbucket.org/","")}`:n.startsWith("https://gitlab.com/")?`gitlab:${qt(n).replace("https://gitlab.com/","")}`:n.startsWith("ssh://gitlab.com/")?`gitlab:${qt(n).replace("ssh://gitlab.com/","")}`:(n.startsWith("git+")||(n=`git+${n}`),n.endsWith(".git")||(n=`${n}.git`),n)}function qt(n){return n.endsWith(".git")?n.slice(0,-4):n}function ja(n){return n?._visit({basic:e=>e.id,custom:e=>`See ${e.filename}`,_other:()=>{}})}p();f();d();function Er({organization:n,workspaceName:e,namespaceExport:t,naming:r}){return(typeof r=="string"?r:r?.namespace)??t??`${Ue(St(n))}${Ue(St(e))}`}function Ar({namespaceExport:n,naming:e}){let t=typeof e=="string"?{}:e,r=e!=null?Ue(St(n)):n;return{namespace:n,client:t?.client??`${r}Client`,error:t?.error??`${r}Error`,timeoutError:t?.timeoutError??`${r}TimeoutError`,environment:t?.environment??`${r}Environment`,environmentUrls:t?.environmentUrls??`${r}EnvironmentUrls`,version:t?.version??`${r}Version`}}p();f();d();p();f();d();var zt={};ae(zt,{AvailabilityStatus:()=>Ua,GlobalParameterApplyMode:()=>Xa,GlobalParameterLocation:()=>Qa,PrimitiveTypeV1:()=>eo,commons:()=>Ir,dynamic:()=>Cr,generatorExec:()=>Or,globalParameters:()=>Br,types:()=>Lr});p();f();d();p();f();d();var Ir={};ae(Ir,{AvailabilityStatus:()=>Ua});p();f();d();p();f();d();var Ua={InDevelopment:"IN_DEVELOPMENT",PreRelease:"PRE_RELEASE",GeneralAvailability:"GENERAL_AVAILABILITY",Deprecated:"DEPRECATED",Alpha:"ALPHA",Beta:"BETA",Preview:"PREVIEW",Legacy:"LEGACY"};var Cr={};ae(Cr,{AuthRequirement:()=>$a,ErrorSeverity:()=>Ga,HttpMethod:()=>za,ObjectPropertyAccess:()=>Ha,PrimitiveTypeV1:()=>Ya,auth:()=>kr,commons:()=>Da,declaration:()=>Va,endpoints:()=>Wa,environment:()=>qa,http:()=>Rr,ir:()=>Za,snippets:()=>Nr,types:()=>Sr,variables:()=>Ja});p();f();d();p();f();d();var kr={};ae(kr,{AuthRequirement:()=>$a});p();f();d();p();f();d();var $a={All:"ALL",Any:"ANY",EndpointSecurity:"ENDPOINT_SECURITY"};var Da={};p();f();d();var Va={};p();f();d();var Wa={};p();f();d();var qa={};p();f();d();var Rr={};ae(Rr,{HttpMethod:()=>za});p();f();d();p();f();d();var za={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var Za={};p();f();d();var Nr={};ae(Nr,{ErrorSeverity:()=>Ga});p();f();d();p();f();d();var Ga={Critical:"CRITICAL",Warning:"WARNING"};var Sr={};ae(Sr,{ObjectPropertyAccess:()=>Ha,PrimitiveTypeV1:()=>Ya});p();f();d();p();f();d();var Ha={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var Ya={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var Ja={};p();f();d();var Or={};ae(Or,{LicenseId:()=>Ka,config:()=>Fr});p();f();d();p();f();d();var Fr={};ae(Fr,{LicenseId:()=>Ka});p();f();d();p();f();d();var Ka={Mit:"MIT",Apache2:"Apache-2.0"};var Br={};ae(Br,{GlobalParameterApplyMode:()=>Xa,GlobalParameterLocation:()=>Qa});p();f();d();p();f();d();var Xa={Explicit:"explicit",Auto:"auto"};p();f();d();var Qa={Header:"header",Query:"query",Body:"body",Path:"path"};var Lr={};ae(Lr,{PrimitiveTypeV1:()=>eo});p();f();d();p();f();d();var eo={Integer:"INTEGER",Long:"LONG",Uint:"UINT",Uint64:"UINT_64",Float:"FLOAT",Double:"DOUBLE",Boolean:"BOOLEAN",String:"STRING",Date:"DATE",DateTime:"DATE_TIME",DateTimeRfc2822:"DATE_TIME_RFC_2822",Uuid:"UUID",Base64:"BASE_64",BigInteger:"BIG_INTEGER"};var Ul="value",or=class{constructor({context:e}){A(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?I.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),I.TypeLiteral.nop());if(e.value===void 0)return I.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,convertOpts:t});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value,convertOpts:t});case"map":return this.convertMap({map:e.typeReference,value:e.value,convertOpts:t});case"named":{let r=this.context.resolveNamedType({typeId:e.typeReference.value});return r==null?I.TypeLiteral.nop():this.convertNamed({named:r,value:e.value,as:e.as,convertOpts:t})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as,convertOpts:t});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,convertOpts:t});case"unknown":return this.convertUnknown({value:e.value,convertOpts:t});default:q(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.array({values:t.map((a,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?I.TypeLiteral.set({values:t.map((a,s)=>{this.context.errors.scope({index:s});try{return this.convert({typeReference:e,value:a,convertOpts:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:$.Critical,message:`Expected array but got: ${typeof t}`}),I.TypeLiteral.nop())}convertMap({map:e,value:t,convertOpts:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:$.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),I.TypeLiteral.nop()):I.TypeLiteral.record({entries:Object.entries(t).map(([a,s])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"key",convertOpts:r}),value:this.convert({typeReference:e.value,value:s,convertOpts:r})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,convertOpts:a}){switch(e.type){case"alias":return this.context.customConfig?.useBrandedStringAliases?I.TypeLiteral.reference(I.codeblock(s=>{s.writeNode(I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})})),s.write("("),s.writeNode(this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a})),s.write(")")})):this.convert({typeReference:e.typeReference,value:t,as:r,convertOpts:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:a});case"enum":return this.convertEnum({enum_:e,value:t,convertOpts:a});case"object":return this.convertObject({object_:e,value:t,convertOpts:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:a});default:q(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,convertOpts:r}){let a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return I.TypeLiteral.nop();let s=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:s,convertOpts:r});if(u==null)return I.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return I.TypeLiteral.reference(I.codeblock(x=>{x.writeNode(I.invokeMethod({on:I.reference({name:this.context.namespaceExport,importFrom:this.context.getModuleImport(),memberName:this.context.getFullyQualifiedReference({declaration:e.declaration})}),method:this.context.getMethodName(s.discriminantValue.name),arguments_:this.convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:a,unionVariant:s,unionProperties:u,convertOpts:r})}))}));let h={name:this.context.getPropertyNameFromNameAndWireValue(e.discriminant),value:I.TypeLiteral.string(s.discriminantValue.wireValue)};return I.TypeLiteral.object({fields:[h,...u]})}convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:e,unionVariant:t,convertOpts:r}){let a=this.getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t});switch(t.type){case"samePropertiesAsObject":{let s=this.context.resolveNamedType({typeId:t.typeId});if(s==null)return;let u=this.convertNamed({named:s,value:e.value,convertOpts:r});if(!u.isObject()){this.context.errors.add({severity:$.Critical,message:"Internal error; expected union value to be an object"});return}let h=u.asObjectOrThrow();return[...a,...h.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let s=this.context.getRecord(e.value);return s==null?[...a,{name:Ul,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyNameFromNameAndWireValue(t.discriminantValue),value:this.convert({typeReference:t.typeReference,value:s[t.discriminantValue.wireValue],convertOpts:r})}]}finally{this.context.errors.unscope()}case"noProperties":return a;default:q(t)}}convertDiscriminatedUnionUtilsArgs({discriminatedUnionTypeInstance:e,unionVariant:t,unionProperties:r,convertOpts:a}){return t.type==="singleProperty"&&this.context.getRecord(e.value)==null&&r.length===1?[this.convert({typeReference:t.typeReference,value:e.value,convertOpts:a})]:r.length>0?[I.TypeLiteral.object({fields:r})]:[]}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:t,convertOpts:r}){return this.context.associateByWireValue({parameters:t.properties??[],values:this.context.getRecord(e.value)??{},ignoreMissingParameters:!0}).map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyNameFromNameAndWireValue(s.name),value:this.convert({...s,convertOpts:r})}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:t,convertOpts:r}){let a=this.context.associateByWireValue({parameters:this.filterReadWriteProperties(e.properties,r),values:this.context.getRecord(t)??{}});return I.TypeLiteral.object({fields:a.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyNameFromNameAndWireValue(s.name),value:this.convert({...s,convertOpts:r})}}finally{this.context.errors.unscope()}})})}filterReadWriteProperties(e,t){return this.context.customConfig?.experimentalGenerateReadWriteOnlyTypes!==!0||typeof t>"u"||(t.isForRequest&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.ReadOnly)),t.isForResponse&&(e=e.filter(r=>r.propertyAccess!==zt.dynamic.ObjectPropertyAccess.WriteOnly))),e}convertEnum({enum_:e,value:t}){let r=this.getEnumValue({enum_:e,value:t});return r==null?I.TypeLiteral.nop():I.TypeLiteral.string(r)}getEnumValue({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:$.Critical,message:`Expected enum value string, got: ${typeof t}`});return}if(e.values.find(a=>a.wireValue===t)==null){this.context.errors.add({severity:$.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return t}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,convertOpts:r}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r});return a??I.TypeLiteral.nop()}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,convertOpts:r}){for(let a of e.types){let s=this.context.errors.size();try{let u=this.convert({typeReference:a,value:t,convertOpts:r});if(I.TypeLiteral.isNop(u)||this.context.errors.size()>s){this.context.errors.truncate(s);continue}return u}catch{this.context.errors.truncate(s);continue}}this.context.errors.add({severity:$.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e,convertOpts:t}){return I.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r,convertOpts:a}){switch(e){case"INTEGER":case"UINT":{let s=this.getValueAsNumber({value:t,as:r});return s==null?I.TypeLiteral.nop():I.TypeLiteral.number(s)}case"LONG":case"UINT_64":{let s=this.getValueAsNumber({value:t,as:r});return s==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(s)):I.TypeLiteral.number(s)}case"FLOAT":case"DOUBLE":{let s=this.getValueAsNumber({value:t});return s==null?I.TypeLiteral.nop():I.TypeLiteral.number(s)}case"BOOLEAN":{let s=this.getValueAsBoolean({value:t,as:r});return s==null?I.TypeLiteral.nop():I.TypeLiteral.boolean(s)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let s=this.context.getValueAsString({value:t});return s==null?I.TypeLiteral.nop():I.TypeLiteral.string(s)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let s=this.context.getValueAsString({value:t});return s==null?I.TypeLiteral.nop():I.TypeLiteral.datetime(s)}case"BIG_INTEGER":{let s=this.context.getValueAsString({value:t});return s==null?I.TypeLiteral.nop():this.context.customConfig?.useBigInt?I.TypeLiteral.bigint(BigInt(s)):I.TypeLiteral.string(s)}default:q(e)}}getValueAsNumber({value:e,as:t}){let r=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};p();f();d();var sr=class{constructor({context:e}){A(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let s of e.properties)switch(s.type){case"file":r.fileFields.push({name:this.context.getPropertyNameFromNameAndWireValue(s),value:this.getSingleFileProperty({property:s,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyNameFromNameAndWireValue(s),value:this.getArrayFileProperty({property:s,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyNameFromNameAndWireValue(s.name),value:this.getBodyProperty({property:s,record:a})});break;default:q(s)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?e.isOptional===!0?I.TypeLiteral.nop():this.context.getFilePlaceholder():I.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null||r.length===0?e.isOptional===!0?I.TypeLiteral.nop():I.TypeLiteral.array({values:[this.context.getFilePlaceholder()]}):I.TypeLiteral.array({values:r.map(a=>I.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?I.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var $l=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Dl="/path/to/your/file",ur=class n extends Ut{constructor({ir:t,config:r}){super({ir:t,config:r});A(this,"ir");A(this,"customConfig");A(this,"dynamicTypeLiteralMapper");A(this,"filePropertyMapper");A(this,"moduleName");A(this,"namespaceExport");A(this,"resolvedClientName");A(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new or({context:this}),this.filePropertyMapper=new sr({context:this}),this.moduleName=Vl({config:r,customConfig:this.customConfig}),this.namespaceExport=Er({organization:r.organization,workspaceName:r.workspaceName,namespaceExport:this.customConfig?.namespaceExport,naming:this.customConfig?.naming});let a=Ar({namespaceExport:this.namespaceExport,naming:this.customConfig?.naming});this.resolvedClientName=a.client,this.resolvedEnvironmentName=a.environment}clone(){return new n({ir:this.ir,config:this.config})}getModuleImport(){return{type:"named",moduleName:this.moduleName}}getRootClientName(){return this.resolvedClientName}getPropertyName(t){return this.customConfig?.retainOriginalCasing||vt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.camelCase.unsafeName}getPropertyNameFromNameAndWireValue(t){return this.customConfig?.retainOriginalCasing||vt(this.customConfig)?this.formatOriginalPropertyName(t.wireValue):t.name.camelCase.unsafeName}getMethodName(t){return t.camelCase.unsafeName}getTypeName(t){return t.pascalCase.unsafeName}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return this.getEnvironmentsTypeReference(r)}getFullyQualifiedReference({declaration:t}){return t.fernFilepath.allParts.length>0?`${t.fernFilepath.allParts.map(r=>r.camelCase.unsafeName).join(".")}.${this.getTypeName(t.name)}`:`${this.getTypeName(t.name)}`}getEnvironmentsTypeReference(t){return I.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}getFilePlaceholder(){return I.TypeLiteral.reference(I.invokeFunction({function_:I.reference({name:"createReadStream",importFrom:{type:"star",moduleName:"fs",starImportAlias:"fs"}}),arguments_:[I.TypeLiteral.string(Dl)]}))}formatOriginalPropertyName(t){return $l.test(t)?t:JSON.stringify(t)}};function Vl({config:n,customConfig:e}){return Ma({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var to="client",ro="main",Wl={type:"primitive",value:"STRING"};function ql(n){return"wrapperProperty"in n}function zl(n){return ql(n)?n.wrapperProperty??void 0:void 0}function Zl(n){return"requirement"in n}function Gl(n){return Zl(n)?n.requirement??void 0:void 0}var lr=class{constructor({context:e}){A(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){return await this.buildCodeBlock({endpoint:e,snippet:t}).toStringAsync({customConfig:this.context.customConfig})}generateSnippetSync({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t}).toString({customConfig:this.context.customConfig})}async generateSnippetAst({endpoint:e,request:t}){return this.buildCodeBlock({endpoint:e,snippet:t})}buildCodeBlock({endpoint:e,snippet:t}){return I.codeblock(r=>{r.writeNode(I.function_({name:ro,async:!0,parameters:[],body:I.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(I.invokeFunction({function_:I.reference({name:ro}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return I.variable({name:to,const:!0,initializer:I.instantiateClass({class_:I.reference({name:this.context.getRootClientName(),importFrom:this.context.getModuleImport()}),arguments_:[this.getConstructorArgs({endpoint:e,snippet:t})]})})}getConstructorArgs({endpoint:e,snippet:t}){let r=[],a=this.getConstructorEnvironmentArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&r.push(...a),e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:$.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(fe.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(fe.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),r.length===0?I.TypeLiteral.nop():I.TypeLiteral.object({fields:r})}getConstructorEnvironmentArgs({baseUrl:e,environment:t}){let r=this.getEnvironmentValue({baseUrl:e,environment:t});return r==null?[]:[{name:"environment",value:r}]}getEnvironmentValue({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:$.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null)return I.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:$.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return I.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?I.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Wl,value:a})}))}):void 0}}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBasicAuthArg({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.addAuthMismatchError(e,t),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.addAuthMismatchError(e,t),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.addAuthMismatchError(e,t),[]):this.getConstructorOAuthArgs({auth:e,values:t});case"inferred":return t.type!=="inferred"?(this.addAuthMismatchError(e,t),[]):(this.addWarning("The TypeScript SDK v2 Generator does not support Inferred auth scheme yet"),[]);default:q(e)}}addAuthMismatchError(e,t){this.context.errors.add({severity:$.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message})}addWarning(e){this.context.errors.add({severity:$.Warning,message:e})}getConstructorBasicAuthArg({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.username),value:I.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:I.TypeLiteral.string(t.password)}]})}getConstructorBearerAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.token),value:I.TypeLiteral.string(t.token)}]})}getConstructorHeaderAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]})}getConstructorOAuthArgs({auth:e,values:t}){return this.wrapAuthFields({auth:e,fields:[{name:this.context.getPropertyName(e.clientId),value:I.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:I.TypeLiteral.string(t.clientSecret)}]})}getAuthWrapperPropertyName(e){return e.camelCase.unsafeName==="oAuth"?"oauth":e.camelCase.unsafeName}shouldFlattenAuthFields(e){if(this.context.customConfig?.flattenAnyAuthOptions!==!0)return!1;let t=Gl(e);return t==null||t==="ANY"}wrapAuthFields({auth:e,fields:t}){let r=zl(e);return r==null||this.shouldFlattenAuthFields(e)?t:[{name:this.getAuthWrapperPropertyName(r),value:I.TypeLiteral.object({fields:t})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let s=t[a.name.wireValue],u=this.getConstructorHeaderArg({header:a,value:s});u!=null&&r.push(u)}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!I.TypeLiteral.isNop(r))return{name:e.name.name.camelCase.unsafeName,value:r}}callMethod({endpoint:e,snippet:t}){return I.invokeMethod({on:I.reference({name:to}),method:this.getMethod({endpoint:e}),async:!0,arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:q(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(fe.PathParameters);let a=[...this.context.ir.pathParameters??[],...e.pathParameters??[]];if(a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(s=>s.value)),this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody),e.body!=null&&!this.callOmitsRequestBody({request:e,snippet:t})){let s=this.getBodyRequestArg({body:e.body,value:t.requestBody});I.TypeLiteral.isNop(s)||r.push(s)}return this.context.errors.unscope(),r}callOmitsRequestBody({request:e,snippet:t}){if(this.context.customConfig?.respectOptionalRequestBody!==!0||e.bodyRequired!==!1)return!1;let r=t.requestBody;return r==null||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getBytesBodyRequestArg({value:e}){return typeof e!="string"?(this.context.errors.add({severity:$.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),I.TypeLiteral.nop()):I.TypeLiteral.blob(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:s}={inlinePathParameters:this.context.customConfig?.inlinePathParameters??!0,inlineFileProperties:this.context.customConfig?.inlineFileProperties??!0};this.context.errors.scope(fe.PathParameters);let u=[];e.pathParameters!=null&&u.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody);let h=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(x=>x.value)),s||r.push(...h.fileFields.map(x=>x.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:a,inlineFileProperties:s})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:h})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(fe.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).map(O=>({name:this.context.getPropertyNameFromNameAndWireValue(O.name),value:this.context.dynamicTypeLiteralMapper.convert({...O,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(fe.Headers);let x=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).map(O=>({name:this.context.getPropertyNameFromNameAndWireValue(O.name),value:this.context.dynamicTypeLiteralMapper.convert({...O,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody);let E=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];this.context.errors.unscope();let N=new Set(E.map(O=>O.name));return I.TypeLiteral.object({fields:[...r.filter(O=>!N.has(O.name)),...u,...x,...E]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":{let a;if(this.context.customConfig?.flattenRequestParameters===!0&&e.bodyType.type==="typeReference"&&e.bodyType.value.type==="named"&&this.context.resolveNamedType({typeId:e.bodyType.value.value})?.type==="object"){a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.bodyType.value,value:t,convertOpts:{isForRequest:!0}});let h=a.getObjectFields();if(h!=null)return h}let s=this.getReferencedRequestBodyPropertyObjectField({body:e,value:t,literal:a});return I.TypeLiteral.isNop(s.value)?[]:[s]}case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:q(e)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:e}){return this.context.customConfig?.inlineFileProperties??!0?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyObjectField({body:e,value:t,literal:r}){return{name:this.context.getPropertyName(e.bodyKey),value:r??this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,convertOpts:{isForRequest:!0}});default:q(e)}}getInlinedRequestBodyPropertyObjectFields({parameters:e,value:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}});for(let s of a)r.push({name:this.context.getPropertyNameFromNameAndWireValue(s.name),value:this.context.dynamicTypeLiteralMapper.convert({...s,convertOpts:{isForRequest:!0}})});return r}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});for(let s of a)r.push({name:this.context.getPropertyNameFromNameAndWireValue(s.name),value:this.context.dynamicTypeLiteralMapper.convert({...s,convertOpts:{isForRequest:!0}})});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getMethodName(t)).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}};var Pr=class extends Pt{constructor({ir:e,config:t}){super(new ur({ir:e,config:t}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e){return super.generateSync(e)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new lr({context:e})}};export{Pr as DynamicSnippetsGenerator};
|
|
25
25
|
/*! Bundled license information:
|
|
26
26
|
|
|
27
27
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|