@fern-api/typescript-dynamic-snippets 3.88.0-rc.0 → 3.88.1
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 +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Gt=Object.defineProperty;var ms=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var ys=Object.prototype.hasOwnProperty;var gs=(n,e,t)=>e in n?Gt(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 pe=(n,e)=>{for(var t in e)Gt(n,t,{get:e[t],enumerable:!0})},xs=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of hs(e))!ys.call(n,a)&&a!==t&&Gt(n,a,{get:()=>e[a],enumerable:!(r=ms(e,a))||r.enumerable});return n};var vs=n=>xs(Gt({},"__esModule",{value:!0}),n);var k=(n,e,t)=>gs(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};pe(v,{_debugEnd:()=>On,_debugProcess:()=>Bn,_events:()=>Yn,_eventsCount:()=>Kn,_exiting:()=>mn,_fatalExceptions:()=>Sn,_getActiveHandles:()=>xn,_getActiveRequests:()=>gn,_kill:()=>bn,_linkedBinding:()=>dn,_maxListeners:()=>Jn,_preload_modules:()=>Zn,_rawDebug:()=>ln,_startProfilerIdleNotifier:()=>Ln,_stopProfilerIdleNotifier:()=>Pn,_tickCallback:()=>Fn,abort:()=>$n,addListener:()=>Xn,allowedNodeEnvironmentFlags:()=>En,arch:()=>Jr,argv:()=>Xr,argv0:()=>zn,assert:()=>An,binding:()=>nn,browser:()=>cn,chdir:()=>on,config:()=>hn,cpuUsage:()=>Yt,cwd:()=>sn,debugPort:()=>qn,default:()=>oi,dlopen:()=>yn,domain:()=>fn,emit:()=>ni,emitWarning:()=>rn,env:()=>Kr,execArgv:()=>Qr,execPath:()=>Wn,exit:()=>In,features:()=>Rn,hasUncaughtExceptionCaptureCallback:()=>Cn,hrtime:()=>Jt,kill:()=>Tn,listeners:()=>si,memoryUsage:()=>_n,moduleLoadList:()=>pn,nextTick:()=>Zr,off:()=>ei,on:()=>we,once:()=>Qn,openStdin:()=>kn,pid:()=>Dn,platform:()=>Yr,ppid:()=>Vn,prependListener:()=>ii,prependOnceListener:()=>ai,reallyExit:()=>vn,release:()=>un,removeAllListeners:()=>ri,removeListener:()=>ti,resourceUsage:()=>wn,setSourceMapsEnabled:()=>Gn,setUncaughtExceptionCaptureCallback:()=>Nn,stderr:()=>Mn,stdin:()=>Un,stdout:()=>jn,title:()=>Hr,umask:()=>an,uptime:()=>Hn,version:()=>en,versions:()=>tn});function gr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function bs(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Ht=-1,be.length&&zr())}function zr(){if(!ut){var n=setTimeout(bs,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Ht<e;)Pe&&Pe[Ht].run();Ht=-1,e=be.length}Pe=null,ut=!1,clearTimeout(n)}}function Zr(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 Gr(n,e)),be.length===1&&!ut&&setTimeout(zr,0)}function Gr(n,e){this.fun=n,this.array=e}function Q(){}function dn(n){gr("_linkedBinding")}function yn(n){gr("dlopen")}function gn(){return[]}function xn(){return[]}function An(n,e){if(!n)throw new Error(e||"assertion error")}function Cn(){return!1}function Hn(){return Se.now()/1e3}function Jt(n){var e=Math.floor((Date.now()-Se.now())*.001),t=Se.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+=yr)),[r,a]}function we(){return oi}function si(n){return[]}var be,ut,Pe,Ht,Hr,Jr,Yr,Kr,Xr,Qr,en,tn,rn,nn,an,sn,on,un,cn,ln,pn,fn,mn,hn,vn,bn,Yt,wn,_n,Tn,In,kn,En,Rn,Sn,Nn,Fn,Bn,On,Ln,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Se,hr,yr,Jn,Yn,Kn,Xn,Qn,ei,ti,ri,ni,ii,ai,oi,ui=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Ht=-1;Gr.prototype.run=function(){this.fun.apply(null,this.array)};Hr="browser",Jr="x64",Yr="browser",Kr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Xr=["/usr/bin/node"],Qr=[],en="v16.8.0",tn={},rn=function(n,e){console.warn((e?e+": ":"")+n)},nn=function(n){gr("binding")},an=function(n){return 0},sn=function(){return"/"},on=function(n){},un={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cn=!0,ln=Q,pn=[];fn={},mn=!1,hn={};vn=Q,bn=Q,Yt=function(){return{}},wn=Yt,_n=Yt,Tn=Q,In=Q,kn=Q,En={};Rn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Sn=Q,Nn=Q;Fn=Q,Bn=Q,On=Q,Ln=Q,Pn=Q,jn=void 0,Mn=void 0,Un=void 0,$n=Q,Dn=2,Vn=1,Wn="/bin/usr/node",qn=9229,zn="node",Zn=[],Gn=Q,Se={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Se.now===void 0&&(hr=Date.now(),Se.timing&&Se.timing.navigationStart&&(hr=Se.timing.navigationStart),Se.now=()=>Date.now()-hr);yr=1e9;Jt.bigint=function(n){var e=Jt(n);return typeof BigInt>"u"?e[0]*yr+e[1]:BigInt(e[0]*yr)+BigInt(e[1])};Jn=10,Yn={},Kn=0;Xn=we,Qn=we,ei=we,ti=we,ri=we,ni=Q,ii=we,ai=we;oi={version:en,versions:tn,arch:Jr,platform:Yr,browser:cn,release:un,_rawDebug:ln,moduleLoadList:pn,binding:nn,_linkedBinding:dn,_events:Yn,_eventsCount:Kn,_maxListeners:Jn,on:we,addListener:Xn,once:Qn,off:ei,removeListener:ti,removeAllListeners:ri,emit:ni,prependListener:ii,prependOnceListener:ai,listeners:si,domain:fn,_exiting:mn,config:hn,dlopen:yn,uptime:Hn,_getActiveRequests:gn,_getActiveHandles:xn,reallyExit:vn,_kill:bn,cpuUsage:Yt,resourceUsage:wn,memoryUsage:_n,kill:Tn,exit:In,openStdin:kn,allowedNodeEnvironmentFlags:En,assert:An,features:Rn,_fatalExceptions:Sn,setUncaughtExceptionCaptureCallback:Nn,hasUncaughtExceptionCaptureCallback:Cn,emitWarning:rn,nextTick:Zr,_tickCallback:Fn,_debugProcess:Bn,_debugEnd:On,_startProfilerIdleNotifier:Ln,_stopProfilerIdleNotifier:Pn,stdout:jn,stdin:Un,stderr:Mn,abort:$n,umask:an,chdir:on,cwd:sn,env:Kr,title:Hr,argv:Xr,execArgv:Qr,pid:Dn,ppid:Vn,execPath:Wn,debugPort:qn,hrtime:Jt,argv0:zn,_preload_modules:Zn,setSourceMapsEnabled:Gn}});var d=ot(()=>{"use strict";ui()});function ws(){if(ci)return Rt;ci=!0,Rt.byteLength=m,Rt.toByteArray=T,Rt.fromByteArray=Y;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 J=D===j?0:4-D%4;return[D,J]}function m(C){var j=u(C),D=j[0],J=j[1];return(D+J)*3/4-J}function x(C,j,D){return(j+D)*3/4-D}function T(C){var j,D=u(C),J=D[0],re=D[1],H=new t(x(C,J,re)),ne=0,oe=re>0?J-4:J,te;for(te=0;te<oe;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 R(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function P(C,j,D){for(var J,re=[],H=j;H<D;H+=3)J=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(R(J));return re.join("")}function Y(C){for(var j,D=C.length,J=D%3,re=[],H=16383,ne=0,oe=D-J;ne<oe;ne+=H)re.push(P(C,ne,ne+H>oe?oe:ne+H));return J===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):J===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 _s(){if(li)return Kt;li=!0;return Kt.read=function(n,e,t,r,a){var o,u,m=a*8-r-1,x=(1<<m)-1,T=x>>1,R=-7,P=t?a-1:0,Y=t?-1:1,C=n[e+P];for(P+=Y,o=C&(1<<-R)-1,C>>=-R,R+=m;R>0;o=o*256+n[e+P],P+=Y,R-=8);for(u=o&(1<<-R)-1,o>>=-R,R+=r;R>0;u=u*256+n[e+P],P+=Y,R-=8);if(o===0)o=1-T;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-T}return(C?-1:1)*u*Math.pow(2,o-r)},Kt.write=function(n,e,t,r,a,o){var u,m,x,T=o*8-a-1,R=(1<<T)-1,P=R>>1,Y=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?(m=isNaN(e)?1:0,u=R):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+P>=1?e+=Y/x:e+=Y*Math.pow(2,1-P),e*x>=2&&(u++,x/=2),u+P>=R?(m=0,u=R):u+P>=1?(m=(e*x-1)*Math.pow(2,a),u=u+P):(m=e*Math.pow(2,P-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=m&255,C+=j,m/=256,a-=8);for(u=u<<a|m,T+=a;T>0;n[t+C]=u&255,C+=j,u/=256,T-=8);n[t+C-j]|=D*128},Kt}function di(){if(pi)return je;pi=!0;let n=ws(),e=_s(),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 c=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(c,i),c.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(c){if(c>r)throw new RangeError('The value "'+c+'" is invalid for option "size"');let i=new Uint8Array(c);return Object.setPrototypeOf(i,u.prototype),i}function u(c,i,s){if(typeof c=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return R(c)}return m(c,i,s)}u.poolSize=8192;function m(c,i,s){if(typeof c=="string")return P(c,i);if(ArrayBuffer.isView(c))return C(c);if(c==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof c);if(he(c,ArrayBuffer)||c&&he(c.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(c,SharedArrayBuffer)||c&&he(c.buffer,SharedArrayBuffer)))return j(c,i,s);if(typeof c=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let l=c.valueOf&&c.valueOf();if(l!=null&&l!==c)return u.from(l,i,s);let y=D(c);if(y)return y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof c[Symbol.toPrimitive]=="function")return u.from(c[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 c)}u.from=function(c,i,s){return m(c,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(c){if(typeof c!="number")throw new TypeError('"size" argument must be of type number');if(c<0)throw new RangeError('The value "'+c+'" is invalid for option "size"')}function T(c,i,s){return x(c),c<=0?o(c):i!==void 0?typeof s=="string"?o(c).fill(i,s):o(c).fill(i):o(c)}u.alloc=function(c,i,s){return T(c,i,s)};function R(c){return x(c),o(c<0?0:J(c)|0)}u.allocUnsafe=function(c){return R(c)},u.allocUnsafeSlow=function(c){return R(c)};function P(c,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(c,i)|0,l=o(s),y=l.write(c,i);return y!==s&&(l=l.slice(0,y)),l}function Y(c){let i=c.length<0?0:J(c.length)|0,s=o(i);for(let l=0;l<i;l+=1)s[l]=c[l]&255;return s}function C(c){if(he(c,Uint8Array)){let i=new Uint8Array(c);return j(i.buffer,i.byteOffset,i.byteLength)}return Y(c)}function j(c,i,s){if(i<0||c.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(c.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let l;return i===void 0&&s===void 0?l=new Uint8Array(c):s===void 0?l=new Uint8Array(c,i):l=new Uint8Array(c,i,s),Object.setPrototypeOf(l,u.prototype),l}function D(c){if(u.isBuffer(c)){let i=J(c.length)|0,s=o(i);return s.length===0||c.copy(s,0,0,i),s}if(c.length!==void 0)return typeof c.length!="number"||mr(c.length)?o(0):Y(c);if(c.type==="Buffer"&&Array.isArray(c.data))return Y(c.data)}function J(c){if(c>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return c|0}function re(c){return+c!=c&&(c=0),u.alloc(+c)}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 l=i.length,y=s.length;for(let g=0,_=Math.min(l,y);g<_;++g)if(i[g]!==s[g]){l=i[g],y=s[g];break}return l<y?-1:y<l?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 l;if(s===void 0)for(s=0,l=0;l<i.length;++l)s+=i[l].length;let y=u.allocUnsafe(s),g=0;for(l=0;l<i.length;++l){let _=i[l];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(c,i){if(u.isBuffer(c))return c.length;if(ArrayBuffer.isView(c)||he(c,ArrayBuffer))return c.byteLength;if(typeof c!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof c);let s=c.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&s===0)return 0;let y=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return fr(c).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return qr(c).length;default:if(y)return l?-1:fr(c).length;i=(""+i).toLowerCase(),y=!0}}u.byteLength=H;function ne(c,i,s){let l=!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(c||(c="utf8");;)switch(c){case"hex":return as(this,i,s);case"utf8":case"utf-8":return Lr(this,i,s);case"ascii":return ns(this,i,s);case"latin1":case"binary":return is(this,i,s);case"base64":return ts(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ss(this,i,s);default:if(l)throw new TypeError("Unknown encoding: "+c);c=(c+"").toLowerCase(),l=!0}}u.prototype._isBuffer=!0;function oe(c,i,s){let l=c[i];c[i]=c[s],c[s]=l}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)oe(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)oe(this,s,s+3),oe(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)oe(this,s,s+7),oe(this,s+1,s+6),oe(this,s+2,s+5),oe(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Lr(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,l,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),l===void 0&&(l=i?i.length:0),y===void 0&&(y=0),g===void 0&&(g=this.length),s<0||l>i.length||y<0||g>this.length)throw new RangeError("out of range index");if(y>=g&&s>=l)return 0;if(y>=g)return-1;if(s>=l)return 1;if(s>>>=0,l>>>=0,y>>>=0,g>>>=0,this===i)return 0;let _=g-y,M=l-s,Z=Math.min(_,M),z=this.slice(y,g),G=i.slice(s,l);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(c,i,s,l,y){if(c.length===0)return-1;if(typeof s=="string"?(l=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,mr(s)&&(s=y?0:c.length-1),s<0&&(s=c.length+s),s>=c.length){if(y)return-1;s=c.length-1}else if(s<0)if(y)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,l)),u.isBuffer(i))return i.length===0?-1:Or(c,i,s,l,y);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?y?Uint8Array.prototype.indexOf.call(c,i,s):Uint8Array.prototype.lastIndexOf.call(c,i,s):Or(c,[i],s,l,y);throw new TypeError("val must be string, number or Buffer")}function Or(c,i,s,l,y){let g=1,_=c.length,M=i.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(c.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(c,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(c,z+V)!==Z(i,V)){G=!1;break}if(G)return z}return-1}u.prototype.includes=function(i,s,l){return this.indexOf(i,s,l)!==-1},u.prototype.indexOf=function(i,s,l){return te(this,i,s,l,!0)},u.prototype.lastIndexOf=function(i,s,l){return te(this,i,s,l,!1)};function Ya(c,i,s,l){s=Number(s)||0;let y=c.length-s;l?(l=Number(l),l>y&&(l=y)):l=y;let g=i.length;l>g/2&&(l=g/2);let _;for(_=0;_<l;++_){let M=parseInt(i.substr(_*2,2),16);if(mr(M))return _;c[s+_]=M}return _}function Ka(c,i,s,l){return Zt(fr(i,c.length-s),c,s,l)}function Xa(c,i,s,l){return Zt(ls(i),c,s,l)}function Qa(c,i,s,l){return Zt(qr(i),c,s,l)}function es(c,i,s,l){return Zt(ps(i,c.length-s),c,s,l)}u.prototype.write=function(i,s,l,y){if(s===void 0)y="utf8",l=this.length,s=0;else if(l===void 0&&typeof s=="string")y=s,l=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(l)?(l=l>>>0,y===void 0&&(y="utf8")):(y=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-s;if((l===void 0||l>g)&&(l=g),i.length>0&&(l<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 Ya(this,i,s,l);case"utf8":case"utf-8":return Ka(this,i,s,l);case"ascii":case"latin1":case"binary":return Xa(this,i,s,l);case"base64":return Qa(this,i,s,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return es(this,i,s,l);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 ts(c,i,s){return i===0&&s===c.length?n.fromByteArray(c):n.fromByteArray(c.slice(i,s))}function Lr(c,i,s){s=Math.min(c.length,s);let l=[],y=i;for(;y<s;){let g=c[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=c[y+1],(Z&192)===128&&(V=(g&31)<<6|Z&63,V>127&&(_=V));break;case 3:Z=c[y+1],z=c[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=c[y+1],z=c[y+2],G=c[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,l.push(_>>>10&1023|55296),_=56320|_&1023),l.push(_),y+=M}return rs(l)}let Pr=4096;function rs(c){let i=c.length;if(i<=Pr)return String.fromCharCode.apply(String,c);let s="",l=0;for(;l<i;)s+=String.fromCharCode.apply(String,c.slice(l,l+=Pr));return s}function ns(c,i,s){let l="";s=Math.min(c.length,s);for(let y=i;y<s;++y)l+=String.fromCharCode(c[y]&127);return l}function is(c,i,s){let l="";s=Math.min(c.length,s);for(let y=i;y<s;++y)l+=String.fromCharCode(c[y]);return l}function as(c,i,s){let l=c.length;(!i||i<0)&&(i=0),(!s||s<0||s>l)&&(s=l);let y="";for(let g=i;g<s;++g)y+=ds[c[g]];return y}function ss(c,i,s){let l=c.slice(i,s),y="";for(let g=0;g<l.length-1;g+=2)y+=String.fromCharCode(l[g]+l[g+1]*256);return y}u.prototype.slice=function(i,s){let l=this.length;i=~~i,s=s===void 0?l:~~s,i<0?(i+=l,i<0&&(i=0)):i>l&&(i=l),s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),s<i&&(s=i);let y=this.subarray(i,s);return Object.setPrototypeOf(y,u.prototype),y};function K(c,i,s){if(c%1!==0||c<0)throw new RangeError("offset is not uint");if(c+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||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,l){i=i>>>0,s=s>>>0,l||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],l=this[i+7];(s===void 0||l===void 0)&&At(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+l*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],l=this[i+7];(s===void 0||l===void 0)&&At(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+l;return(BigInt(y)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,s,l){i=i>>>0,s=s>>>0,l||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,l){i=i>>>0,s=s>>>0,l||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 l=this[i]|this[i+1]<<8;return l&32768?l|4294901760:l},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||K(i,2,this.length);let l=this[i+1]|this[i]<<8;return l&32768?l|4294901760:l},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],l=this[i+7];(s===void 0||l===void 0)&&At(i,this.length-8);let y=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(l<<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],l=this[i+7];(s===void 0||l===void 0)&&At(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+l)}),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(c,i,s,l,y,g){if(!u.isBuffer(c))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+l>c.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,l,y){if(i=+i,s=s>>>0,l=l>>>0,!y){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=1,_=0;for(this[s]=i&255;++_<l&&(g*=256);)this[s+_]=i/g&255;return s+l},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,l,y){if(i=+i,s=s>>>0,l=l>>>0,!y){let M=Math.pow(2,8*l)-1;ie(this,i,s,l,M,0)}let g=l-1,_=1;for(this[s+g]=i&255;--g>=0&&(_*=256);)this[s+g]=i/_&255;return s+l},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,l){return i=+i,s=s>>>0,l||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,l){return i=+i,s=s>>>0,l||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,l){return i=+i,s=s>>>0,l||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,l){return i=+i,s=s>>>0,l||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 jr(c,i,s,l,y){Wr(i,l,y,c,s,7);let g=Number(i&BigInt(4294967295));c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g,g=g>>8,c[s++]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,_=_>>8,c[s++]=_,s}function Mr(c,i,s,l,y){Wr(i,l,y,c,s,7);let g=Number(i&BigInt(4294967295));c[s+7]=g,g=g>>8,c[s+6]=g,g=g>>8,c[s+5]=g,g=g>>8,c[s+4]=g;let _=Number(i>>BigInt(32)&BigInt(4294967295));return c[s+3]=_,_=_>>8,c[s+2]=_,_=_>>8,c[s+1]=_,_=_>>8,c[s]=_,s+8}u.prototype.writeBigUInt64LE=Re(function(i,s=0){return jr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Re(function(i,s=0){return Mr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,l,y){if(i=+i,s=s>>>0,!y){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=0,_=1,M=0;for(this[s]=i&255;++g<l&&(_*=256);)i<0&&M===0&&this[s+g-1]!==0&&(M=1),this[s+g]=(i/_>>0)-M&255;return s+l},u.prototype.writeIntBE=function(i,s,l,y){if(i=+i,s=s>>>0,!y){let Z=Math.pow(2,8*l-1);ie(this,i,s,l,Z-1,-Z)}let g=l-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+l},u.prototype.writeInt8=function(i,s,l){return i=+i,s=s>>>0,l||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,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,l){return i=+i,s=s>>>0,l||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,l){return i=+i,s=s>>>0,l||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,l){return i=+i,s=s>>>0,l||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 jr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Re(function(i,s=0){return Mr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ur(c,i,s,l,y,g){if(s+l>c.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function $r(c,i,s,l,y){return i=+i,s=s>>>0,y||Ur(c,i,s,4),e.write(c,i,s,l,23,4),s+4}u.prototype.writeFloatLE=function(i,s,l){return $r(this,i,s,!0,l)},u.prototype.writeFloatBE=function(i,s,l){return $r(this,i,s,!1,l)};function Dr(c,i,s,l,y){return i=+i,s=s>>>0,y||Ur(c,i,s,8),e.write(c,i,s,l,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,l){return Dr(this,i,s,!0,l)},u.prototype.writeDoubleBE=function(i,s,l){return Dr(this,i,s,!1,l)},u.prototype.copy=function(i,s,l,y){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(l||(l=0),!y&&y!==0&&(y=this.length),s>=i.length&&(s=i.length),s||(s=0),y>0&&y<l&&(y=l),y===l||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=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-l&&(y=i.length-s+l);let g=y-l;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,l,y):Uint8Array.prototype.set.call(i,this.subarray(l,y),s),g},u.prototype.fill=function(i,s,l,y){if(typeof i=="string"){if(typeof s=="string"?(y=s,s=0,l=this.length):typeof l=="string"&&(y=l,l=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<l)throw new RangeError("Out of range index");if(l<=s)return this;s=s>>>0,l=l===void 0?this.length:l>>>0,i||(i=0);let g;if(typeof i=="number")for(g=s;g<l;++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<l-s;++g)this[g+s]=_[g%M]}return this};let at={};function dr(c,i,s){at[c]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${c}]`,this.stack,delete this.name}get code(){return c}set code(y){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:y,writable:!0})}toString(){return`${this.name} [${c}]: ${this.message}`}}}dr("ERR_BUFFER_OUT_OF_BOUNDS",function(c){return c?`${c} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),dr("ERR_INVALID_ARG_TYPE",function(c,i){return`The "${c}" argument must be of type number. Received type ${typeof i}`},TypeError),dr("ERR_OUT_OF_RANGE",function(c,i,s){let l=`The value of "${c}" is out of range.`,y=s;return Number.isInteger(s)&&Math.abs(s)>2**32?y=Vr(String(s)):typeof s=="bigint"&&(y=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(y=Vr(y)),y+="n"),l+=` It must be ${i}. Received ${y}`,l},RangeError);function Vr(c){let i="",s=c.length,l=c[0]==="-"?1:0;for(;s>=l+4;s-=3)i=`_${c.slice(s-3,s)}${i}`;return`${c.slice(0,s)}${i}`}function os(c,i,s){st(i,"offset"),(c[i]===void 0||c[i+s]===void 0)&&At(i,c.length-(s+1))}function Wr(c,i,s,l,y,g){if(c>s||c<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,c)}os(l,y,g)}function st(c,i){if(typeof c!="number")throw new at.ERR_INVALID_ARG_TYPE(i,"number",c)}function At(c,i,s){throw Math.floor(c)!==c?(st(c,s),new at.ERR_OUT_OF_RANGE("offset","an integer",c)):i<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,c)}let us=/[^+/0-9A-Za-z-_]/g;function cs(c){if(c=c.split("=")[0],c=c.trim().replace(us,""),c.length<2)return"";for(;c.length%4!==0;)c=c+"=";return c}function fr(c,i){i=i||1/0;let s,l=c.length,y=null,g=[];for(let _=0;_<l;++_){if(s=c.charCodeAt(_),s>55295&&s<57344){if(!y){if(s>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(_+1===l){(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 ls(c){let i=[];for(let s=0;s<c.length;++s)i.push(c.charCodeAt(s)&255);return i}function ps(c,i){let s,l,y,g=[];for(let _=0;_<c.length&&!((i-=2)<0);++_)s=c.charCodeAt(_),l=s>>8,y=s%256,g.push(y),g.push(l);return g}function qr(c){return n.toByteArray(cs(c))}function Zt(c,i,s,l){let y;for(y=0;y<l&&!(y+s>=i.length||y>=c.length);++y)i[y+s]=c[y];return y}function he(c,i){return c instanceof i||c!=null&&c.constructor!=null&&c.constructor.name!=null&&c.constructor.name===i.name}function mr(c){return c!==c}let ds=(function(){let c="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let l=s*16;for(let y=0;y<16;++y)i[l+y]=c[s]+c[y]}return i})();function Re(c){return typeof BigInt>"u"?fs:c}function fs(){throw new Error("BigInt not supported")}return je}var Rt,ci,Kt,li,je,pi,fi=ot(()=>{"use strict";p();f();d();Rt={},ci=!1;Kt={},li=!1;je={},pi=!1});var Me,b,Qc,el,mi=ot(()=>{"use strict";p();f();d();fi();Me=di();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,Qc=Me.INSPECT_MAX_BYTES,el=Me.kMaxLength});var f=ot(()=>{"use strict";mi()});var $c={};pe($c,{DynamicSnippetsGenerator:()=>pr});module.exports=vs($c);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 Ts=typeof global=="object"&&global&&global.Object===Object&&global,hi=Ts;var Is=typeof self=="object"&&self&&self.Object===Object&&self,ks=hi||Is||Function("return this")(),yi=ks;var Es=yi.Symbol,_e=Es;p();f();d();var gi=Object.prototype,As=gi.hasOwnProperty,Rs=gi.toString,St=_e?_e.toStringTag:void 0;function Ss(n){var e=As.call(n,St),t=n[St];try{n[St]=void 0;var r=!0}catch{}var a=Rs.call(n);return r&&(e?n[St]=t:delete n[St]),a}var xi=Ss;p();f();d();var Ns=Object.prototype,Cs=Ns.toString;function Fs(n){return Cs.call(n)}var vi=Fs;var Bs="[object Null]",Os="[object Undefined]",bi=_e?_e.toStringTag:void 0;function Ls(n){return n==null?n===void 0?Os:Bs:bi&&bi in Object(n)?xi(n):vi(n)}var wi=Ls;p();f();d();function Ps(n){return n!=null&&typeof n=="object"}var _i=Ps;var js="[object Symbol]";function Ms(n){return typeof n=="symbol"||_i(n)&&wi(n)==js}var Ti=Ms;p();f();d();p();f();d();function Us(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 Ii=Us;p();f();d();var $s=Array.isArray,ki=$s;var Ds=1/0,Ei=_e?_e.prototype:void 0,Ai=Ei?Ei.toString:void 0;function Ri(n){if(typeof n=="string")return n;if(ki(n))return Ii(n,Ri)+"";if(Ti(n))return Ai?Ai.call(n):"";var e=n+"";return e=="0"&&1/n==-Ds?"-0":e}var Si=Ri;p();f();d();function Vs(n){return n==null?"":Si(n)}var Ne=Vs;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function Ws(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 Ni=Ws;function qs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ni(n,e,t)}var Ci=qs;p();f();d();var zs="\\ud800-\\udfff",Zs="\\u0300-\\u036f",Gs="\\ufe20-\\ufe2f",Hs="\\u20d0-\\u20ff",Js=Zs+Gs+Hs,Ys="\\ufe0e\\ufe0f",Ks="\\u200d",Xs=RegExp("["+Ks+zs+Js+Ys+"]");function Qs(n){return Xs.test(n)}var Xt=Qs;p();f();d();p();f();d();function eo(n){return n.split("")}var Fi=eo;p();f();d();var Bi="\\ud800-\\udfff",to="\\u0300-\\u036f",ro="\\ufe20-\\ufe2f",no="\\u20d0-\\u20ff",io=to+ro+no,ao="\\ufe0e\\ufe0f",so="["+Bi+"]",xr="["+io+"]",vr="\\ud83c[\\udffb-\\udfff]",oo="(?:"+xr+"|"+vr+")",Oi="[^"+Bi+"]",Li="(?:\\ud83c[\\udde6-\\uddff]){2}",Pi="[\\ud800-\\udbff][\\udc00-\\udfff]",uo="\\u200d",ji=oo+"?",Mi="["+ao+"]?",co="(?:"+uo+"(?:"+[Oi,Li,Pi].join("|")+")"+Mi+ji+")*",lo=Mi+ji+co,po="(?:"+[Oi+xr+"?",xr,Li,Pi,so].join("|")+")",fo=RegExp(vr+"(?="+vr+")|"+po+lo,"g");function mo(n){return n.match(fo)||[]}var Ui=mo;function ho(n){return Xt(n)?Ui(n):Fi(n)}var $i=ho;function yo(n){return function(e){e=Ne(e);var t=Xt(e)?$i(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ci(t,1).join(""):e.slice(1);return r[n]()+a}}var Di=yo;var go=Di("toUpperCase"),Ue=go;function xo(n){return Ue(Ne(n).toLowerCase())}var Vi=xo;p();f();d();p();f();d();function vo(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 Wi=vo;p();f();d();p();f();d();p();f();d();function bo(n){return function(e){return n?.[e]}}var qi=bo;var wo={\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"},_o=qi(wo),zi=_o;var To=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Io="\\u0300-\\u036f",ko="\\ufe20-\\ufe2f",Eo="\\u20d0-\\u20ff",Ao=Io+ko+Eo,Ro="["+Ao+"]",So=RegExp(Ro,"g");function No(n){return n=Ne(n),n&&n.replace(To,zi).replace(So,"")}var Zi=No;p();f();d();p();f();d();var Co=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Fo(n){return n.match(Co)||[]}var Gi=Fo;p();f();d();var Bo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Oo(n){return Bo.test(n)}var Hi=Oo;p();f();d();var Qi="\\ud800-\\udfff",Lo="\\u0300-\\u036f",Po="\\ufe20-\\ufe2f",jo="\\u20d0-\\u20ff",Mo=Lo+Po+jo,ea="\\u2700-\\u27bf",ta="a-z\\xdf-\\xf6\\xf8-\\xff",Uo="\\xac\\xb1\\xd7\\xf7",$o="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Do="\\u2000-\\u206f",Vo=" \\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",ra="A-Z\\xc0-\\xd6\\xd8-\\xde",Wo="\\ufe0e\\ufe0f",na=Uo+$o+Do+Vo,ia="['\u2019]",Ji="["+na+"]",qo="["+Mo+"]",aa="\\d+",zo="["+ea+"]",sa="["+ta+"]",oa="[^"+Qi+na+aa+ea+ta+ra+"]",Zo="\\ud83c[\\udffb-\\udfff]",Go="(?:"+qo+"|"+Zo+")",Ho="[^"+Qi+"]",ua="(?:\\ud83c[\\udde6-\\uddff]){2}",ca="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="["+ra+"]",Jo="\\u200d",Yi="(?:"+sa+"|"+oa+")",Yo="(?:"+ct+"|"+oa+")",Ki="(?:"+ia+"(?:d|ll|m|re|s|t|ve))?",Xi="(?:"+ia+"(?:D|LL|M|RE|S|T|VE))?",la=Go+"?",pa="["+Wo+"]?",Ko="(?:"+Jo+"(?:"+[Ho,ua,ca].join("|")+")"+pa+la+")*",Xo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Qo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eu=pa+la+Ko,tu="(?:"+[zo,ua,ca].join("|")+")"+eu,ru=RegExp([ct+"?"+sa+"+"+Ki+"(?="+[Ji,ct,"$"].join("|")+")",Yo+"+"+Xi+"(?="+[Ji,ct+Yi,"$"].join("|")+")",ct+"?"+Yi+"+"+Ki,ct+"+"+Xi,Qo,Xo,aa,tu].join("|"),"g");function nu(n){return n.match(ru)||[]}var da=nu;function iu(n,e,t){return n=Ne(n),e=t?void 0:e,e===void 0?Hi(n)?da(n):Gi(n):n.match(e)||[]}var fa=iu;var au="['\u2019]",su=RegExp(au,"g");function ou(n){return function(e){return Wi(fa(Zi(e).replace(su,"")),n,"")}}var ma=ou;var uu=ma(function(n,e,t){return e=e.toLowerCase(),n+(t?Vi(e):e)}),Nt=uu;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",br=["single","multiline","box"].includes(Ft)?Ft:"single";ye&&(Error.stackTraceLimit=50);var cu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),lu=new Set(["stacktrace"]);function er({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:m=x=>x}={}){if(!ye)return[];r=[...r,...cu],t=[...t,...lu],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}},wr;function
|
|
1
|
+
"use strict";var Gt=Object.defineProperty;var bs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var _s=Object.prototype.hasOwnProperty;var Ts=(n,e,t)=>e in n?Gt(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)Gt(n,t,{get:e[t],enumerable:!0})},Es=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ws(e))!_s.call(n,a)&&a!==t&&Gt(n,a,{get:()=>e[a],enumerable:!(r=bs(e,a))||r.enumerable});return n};var Is=n=>Es(Gt({},"__esModule",{value:!0}),n);var I=(n,e,t)=>Ts(n,typeof e!="symbol"?e+"":e,t);var p=ot(()=>{"use strict"});var v={};ae(v,{_debugEnd:()=>jn,_debugProcess:()=>Pn,_events:()=>Qn,_eventsCount:()=>ei,_exiting:()=>gn,_fatalExceptions:()=>Bn,_getActiveHandles:()=>wn,_getActiveRequests:()=>bn,_kill:()=>Tn,_linkedBinding:()=>hn,_maxListeners:()=>Xn,_preload_modules:()=>Jn,_rawDebug:()=>fn,_startProfilerIdleNotifier:()=>Mn,_stopProfilerIdleNotifier:()=>Un,_tickCallback:()=>Ln,abort:()=>Wn,addListener:()=>ti,allowedNodeEnvironmentFlags:()=>Sn,arch:()=>Xr,argv:()=>tn,argv0:()=>Hn,assert:()=>Nn,binding:()=>on,browser:()=>dn,chdir:()=>cn,config:()=>xn,cpuUsage:()=>Yt,cwd:()=>ln,debugPort:()=>Gn,default:()=>ci,dlopen:()=>vn,domain:()=>yn,emit:()=>si,emitWarning:()=>sn,env:()=>en,execArgv:()=>rn,execPath:()=>Zn,exit:()=>An,features:()=>Cn,hasUncaughtExceptionCaptureCallback:()=>On,hrtime:()=>Jt,kill:()=>kn,listeners:()=>li,memoryUsage:()=>In,moduleLoadList:()=>mn,nextTick:()=>Jr,off:()=>ni,on:()=>we,once:()=>ri,openStdin:()=>Rn,pid:()=>qn,platform:()=>Qr,ppid:()=>zn,prependListener:()=>oi,prependOnceListener:()=>ui,reallyExit:()=>_n,release:()=>pn,removeAllListeners:()=>ai,removeListener:()=>ii,resourceUsage:()=>En,setSourceMapsEnabled:()=>Yn,setUncaughtExceptionCaptureCallback:()=>Fn,stderr:()=>Dn,stdin:()=>Vn,stdout:()=>$n,title:()=>Kr,umask:()=>un,uptime:()=>Kn,version:()=>nn,versions:()=>an});function gr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function ks(){!ut||!Pe||(ut=!1,Pe.length?be=Pe.concat(be):Ht=-1,be.length&&Hr())}function Hr(){if(!ut){var n=setTimeout(ks,0);ut=!0;for(var e=be.length;e;){for(Pe=be,be=[];++Ht<e;)Pe&&Pe[Ht].run();Ht=-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 Yr(n,e)),be.length===1&&!ut&&setTimeout(Hr,0)}function Yr(n,e){this.fun=n,this.array=e}function Q(){}function hn(n){gr("_linkedBinding")}function vn(n){gr("dlopen")}function bn(){return[]}function wn(){return[]}function Nn(n,e){if(!n)throw new Error(e||"assertion error")}function On(){return!1}function Kn(){return Se.now()/1e3}function Jt(n){var e=Math.floor((Date.now()-Se.now())*.001),t=Se.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+=yr)),[r,a]}function we(){return ci}function li(n){return[]}var be,ut,Pe,Ht,Kr,Xr,Qr,en,tn,rn,nn,an,sn,on,un,ln,cn,pn,dn,fn,mn,yn,gn,xn,_n,Tn,Yt,En,In,kn,An,Rn,Sn,Cn,Bn,Fn,Ln,Pn,jn,Mn,Un,$n,Dn,Vn,Wn,qn,zn,Zn,Gn,Hn,Jn,Yn,Se,hr,yr,Xn,Qn,ei,ti,ri,ni,ii,ai,si,oi,ui,ci,pi=ot(()=>{"use strict";p();f();d();be=[],ut=!1,Ht=-1;Yr.prototype.run=function(){this.fun.apply(null,this.array)};Kr="browser",Xr="x64",Qr="browser",en={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},tn=["/usr/bin/node"],rn=[],nn="v16.8.0",an={},sn=function(n,e){console.warn((e?e+": ":"")+n)},on=function(n){gr("binding")},un=function(n){return 0},ln=function(){return"/"},cn=function(n){},pn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};dn=!0,fn=Q,mn=[];yn={},gn=!1,xn={};_n=Q,Tn=Q,Yt=function(){return{}},En=Yt,In=Yt,kn=Q,An=Q,Rn=Q,Sn={};Cn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Bn=Q,Fn=Q;Ln=Q,Pn=Q,jn=Q,Mn=Q,Un=Q,$n=void 0,Dn=void 0,Vn=void 0,Wn=Q,qn=2,zn=1,Zn="/bin/usr/node",Gn=9229,Hn="node",Jn=[],Yn=Q,Se={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Se.now===void 0&&(hr=Date.now(),Se.timing&&Se.timing.navigationStart&&(hr=Se.timing.navigationStart),Se.now=()=>Date.now()-hr);yr=1e9;Jt.bigint=function(n){var e=Jt(n);return typeof BigInt>"u"?e[0]*yr+e[1]:BigInt(e[0]*yr)+BigInt(e[1])};Xn=10,Qn={},ei=0;ti=we,ri=we,ni=we,ii=we,ai=we,si=Q,oi=we,ui=we;ci={version:nn,versions:an,arch:Xr,platform:Qr,browser:dn,release:pn,_rawDebug:fn,moduleLoadList:mn,binding:on,_linkedBinding:hn,_events:Qn,_eventsCount:ei,_maxListeners:Xn,on:we,addListener:ti,once:ri,off:ni,removeListener:ii,removeAllListeners:ai,emit:si,prependListener:oi,prependOnceListener:ui,listeners:li,domain:yn,_exiting:gn,config:xn,dlopen:vn,uptime:Kn,_getActiveRequests:bn,_getActiveHandles:wn,reallyExit:_n,_kill:Tn,cpuUsage:Yt,resourceUsage:En,memoryUsage:In,kill:kn,exit:An,openStdin:Rn,allowedNodeEnvironmentFlags:Sn,assert:Nn,features:Cn,_fatalExceptions:Bn,setUncaughtExceptionCaptureCallback:Fn,hasUncaughtExceptionCaptureCallback:On,emitWarning:sn,nextTick:Jr,_tickCallback:Ln,_debugProcess:Pn,_debugEnd:jn,_startProfilerIdleNotifier:Mn,_stopProfilerIdleNotifier:Un,stdout:$n,stdin:Vn,stderr:Dn,abort:Wn,umask:un,chdir:cn,cwd:ln,env:en,title:Kr,argv:tn,execArgv:rn,pid:qn,ppid:zn,execPath:Zn,debugPort:Gn,hrtime:Jt,argv0:Hn,_preload_modules:Jn,setSourceMapsEnabled:Yn}});var d=ot(()=>{"use strict";pi()});function As(){if(di)return At;di=!0,At.byteLength=h,At.toByteArray=E,At.fromByteArray=Y;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 J=D===j?0:4-D%4;return[D,J]}function h(C){var j=u(C),D=j[0],J=j[1];return(D+J)*3/4-J}function x(C,j,D){return(j+D)*3/4-D}function E(C){var j,D=u(C),J=D[0],re=D[1],H=new t(x(C,J,re)),ne=0,ue=re>0?J-4:J,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 R(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function P(C,j,D){for(var J,re=[],H=j;H<D;H+=3)J=(C[H]<<16&16711680)+(C[H+1]<<8&65280)+(C[H+2]&255),re.push(R(J));return re.join("")}function Y(C){for(var j,D=C.length,J=D%3,re=[],H=16383,ne=0,ue=D-J;ne<ue;ne+=H)re.push(P(C,ne,ne+H>ue?ue:ne+H));return J===1?(j=C[D-1],re.push(n[j>>2]+n[j<<4&63]+"==")):J===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 At}function Rs(){if(fi)return Kt;fi=!0;return Kt.read=function(n,e,t,r,a){var o,u,h=a*8-r-1,x=(1<<h)-1,E=x>>1,R=-7,P=t?a-1:0,Y=t?-1:1,C=n[e+P];for(P+=Y,o=C&(1<<-R)-1,C>>=-R,R+=h;R>0;o=o*256+n[e+P],P+=Y,R-=8);for(u=o&(1<<-R)-1,o>>=-R,R+=r;R>0;u=u*256+n[e+P],P+=Y,R-=8);if(o===0)o=1-E;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-E}return(C?-1:1)*u*Math.pow(2,o-r)},Kt.write=function(n,e,t,r,a,o){var u,h,x,E=o*8-a-1,R=(1<<E)-1,P=R>>1,Y=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=R):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+P>=1?e+=Y/x:e+=Y*Math.pow(2,1-P),e*x>=2&&(u++,x/=2),u+P>=R?(h=0,u=R):u+P>=1?(h=(e*x-1)*Math.pow(2,a),u=u+P):(h=e*Math.pow(2,P-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},Kt}function hi(){if(mi)return je;mi=!0;let n=As(),e=Rs(),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 R(l)}return h(l,i,s)}u.poolSize=8192;function h(l,i,s){if(typeof l=="string")return P(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 E(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 E(l,i,s)};function R(l){return x(l),o(l<0?0:J(l)|0)}u.allocUnsafe=function(l){return R(l)},u.allocUnsafeSlow=function(l){return R(l)};function P(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 Y(l){let i=l.length<0?0:J(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 Y(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=J(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"||mr(l.length)?o(0):Y(l);if(l.type==="Buffer"&&Array.isArray(l.data))return Y(l.data)}function J(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 fr(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:fr(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 ps(this,i,s);case"utf8":case"utf-8":return Mr(this,i,s);case"ascii":return ls(this,i,s);case"latin1":case"binary":return cs(this,i,s);case"base64":return os(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ds(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,mr(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 rs(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(mr(M))return _;l[s+_]=M}return _}function ns(l,i,s,c){return Zt(fr(i,l.length-s),l,s,c)}function is(l,i,s,c){return Zt(ys(i),l,s,c)}function as(l,i,s,c){return Zt(Gr(i),l,s,c)}function ss(l,i,s,c){return Zt(gs(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 rs(this,i,s,c);case"utf8":case"utf-8":return ns(this,i,s,c);case"ascii":case"latin1":case"binary":return is(this,i,s,c);case"base64":return as(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ss(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 os(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 us(c)}let Ur=4096;function us(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 ls(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 cs(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 ps(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+=xs[l[g]];return y}function ds(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 dr(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}`}}}dr("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),dr("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),dr("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 fs(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)}fs(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 ms=/[^+/0-9A-Za-z-_]/g;function hs(l){if(l=l.split("=")[0],l=l.trim().replace(ms,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function fr(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 ys(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function gs(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(hs(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 mr(l){return l!==l}let xs=(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"?vs:l}function vs(){throw new Error("BigInt not supported")}return je}var At,di,Kt,fi,je,mi,yi=ot(()=>{"use strict";p();f();d();At={},di=!1;Kt={},fi=!1;je={},mi=!1});var Me,b,ac,sc,gi=ot(()=>{"use strict";p();f();d();yi();Me=hi();Me.Buffer;Me.SlowBuffer;Me.INSPECT_MAX_BYTES;Me.kMaxLength;b=Me.Buffer,ac=Me.INSPECT_MAX_BYTES,sc=Me.kMaxLength});var f=ot(()=>{"use strict";gi()});var Zl={};ae(Zl,{DynamicSnippetsGenerator:()=>pr});module.exports=Is(Zl);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 Ss=typeof global=="object"&&global&&global.Object===Object&&global,xi=Ss;var Ns=typeof self=="object"&&self&&self.Object===Object&&self,Cs=xi||Ns||Function("return this")(),vi=Cs;var Bs=vi.Symbol,_e=Bs;p();f();d();var bi=Object.prototype,Fs=bi.hasOwnProperty,Os=bi.toString,Rt=_e?_e.toStringTag:void 0;function Ls(n){var e=Fs.call(n,Rt),t=n[Rt];try{n[Rt]=void 0;var r=!0}catch{}var a=Os.call(n);return r&&(e?n[Rt]=t:delete n[Rt]),a}var wi=Ls;p();f();d();var Ps=Object.prototype,js=Ps.toString;function Ms(n){return js.call(n)}var _i=Ms;var Us="[object Null]",$s="[object Undefined]",Ti=_e?_e.toStringTag:void 0;function Ds(n){return n==null?n===void 0?$s:Us:Ti&&Ti in Object(n)?wi(n):_i(n)}var Ei=Ds;p();f();d();function Vs(n){return n!=null&&typeof n=="object"}var Ii=Vs;var Ws="[object Symbol]";function qs(n){return typeof n=="symbol"||Ii(n)&&Ei(n)==Ws}var ki=qs;p();f();d();p();f();d();function zs(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 Ai=zs;p();f();d();var Zs=Array.isArray,Ri=Zs;var Gs=1/0,Si=_e?_e.prototype:void 0,Ni=Si?Si.toString:void 0;function Ci(n){if(typeof n=="string")return n;if(Ri(n))return Ai(n,Ci)+"";if(ki(n))return Ni?Ni.call(n):"";var e=n+"";return e=="0"&&1/n==-Gs?"-0":e}var Bi=Ci;p();f();d();function Hs(n){return n==null?"":Bi(n)}var Ne=Hs;p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();function Js(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 Fi=Js;function Ys(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Fi(n,e,t)}var Oi=Ys;p();f();d();var Ks="\\ud800-\\udfff",Xs="\\u0300-\\u036f",Qs="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",to=Xs+Qs+eo,ro="\\ufe0e\\ufe0f",no="\\u200d",io=RegExp("["+no+Ks+to+ro+"]");function ao(n){return io.test(n)}var Xt=ao;p();f();d();p();f();d();function so(n){return n.split("")}var Li=so;p();f();d();var Pi="\\ud800-\\udfff",oo="\\u0300-\\u036f",uo="\\ufe20-\\ufe2f",lo="\\u20d0-\\u20ff",co=oo+uo+lo,po="\\ufe0e\\ufe0f",fo="["+Pi+"]",xr="["+co+"]",vr="\\ud83c[\\udffb-\\udfff]",mo="(?:"+xr+"|"+vr+")",ji="[^"+Pi+"]",Mi="(?:\\ud83c[\\udde6-\\uddff]){2}",Ui="[\\ud800-\\udbff][\\udc00-\\udfff]",ho="\\u200d",$i=mo+"?",Di="["+po+"]?",yo="(?:"+ho+"(?:"+[ji,Mi,Ui].join("|")+")"+Di+$i+")*",go=Di+$i+yo,xo="(?:"+[ji+xr+"?",xr,Mi,Ui,fo].join("|")+")",vo=RegExp(vr+"(?="+vr+")|"+xo+go,"g");function bo(n){return n.match(vo)||[]}var Vi=bo;function wo(n){return Xt(n)?Vi(n):Li(n)}var Wi=wo;function _o(n){return function(e){e=Ne(e);var t=Xt(e)?Wi(e):void 0,r=t?t[0]:e.charAt(0),a=t?Oi(t,1).join(""):e.slice(1);return r[n]()+a}}var qi=_o;var To=qi("toUpperCase"),Ue=To;function Eo(n){return Ue(Ne(n).toLowerCase())}var zi=Eo;p();f();d();p();f();d();function Io(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 Zi=Io;p();f();d();p();f();d();p();f();d();function ko(n){return function(e){return n?.[e]}}var Gi=ko;var Ao={\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"},Ro=Gi(Ao),Hi=Ro;var So=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,No="\\u0300-\\u036f",Co="\\ufe20-\\ufe2f",Bo="\\u20d0-\\u20ff",Fo=No+Co+Bo,Oo="["+Fo+"]",Lo=RegExp(Oo,"g");function Po(n){return n=Ne(n),n&&n.replace(So,Hi).replace(Lo,"")}var Ji=Po;p();f();d();p();f();d();var jo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Mo(n){return n.match(jo)||[]}var Yi=Mo;p();f();d();var Uo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function $o(n){return Uo.test(n)}var Ki=$o;p();f();d();var ra="\\ud800-\\udfff",Do="\\u0300-\\u036f",Vo="\\ufe20-\\ufe2f",Wo="\\u20d0-\\u20ff",qo=Do+Vo+Wo,na="\\u2700-\\u27bf",ia="a-z\\xdf-\\xf6\\xf8-\\xff",zo="\\xac\\xb1\\xd7\\xf7",Zo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Go="\\u2000-\\u206f",Ho=" \\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",aa="A-Z\\xc0-\\xd6\\xd8-\\xde",Jo="\\ufe0e\\ufe0f",sa=zo+Zo+Go+Ho,oa="['\u2019]",Xi="["+sa+"]",Yo="["+qo+"]",ua="\\d+",Ko="["+na+"]",la="["+ia+"]",ca="[^"+ra+sa+ua+na+ia+aa+"]",Xo="\\ud83c[\\udffb-\\udfff]",Qo="(?:"+Yo+"|"+Xo+")",eu="[^"+ra+"]",pa="(?:\\ud83c[\\udde6-\\uddff]){2}",da="[\\ud800-\\udbff][\\udc00-\\udfff]",lt="["+aa+"]",tu="\\u200d",Qi="(?:"+la+"|"+ca+")",ru="(?:"+lt+"|"+ca+")",ea="(?:"+oa+"(?:d|ll|m|re|s|t|ve))?",ta="(?:"+oa+"(?:D|LL|M|RE|S|T|VE))?",fa=Qo+"?",ma="["+Jo+"]?",nu="(?:"+tu+"(?:"+[eu,pa,da].join("|")+")"+ma+fa+")*",iu="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",au="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",su=ma+fa+nu,ou="(?:"+[Ko,pa,da].join("|")+")"+su,uu=RegExp([lt+"?"+la+"+"+ea+"(?="+[Xi,lt,"$"].join("|")+")",ru+"+"+ta+"(?="+[Xi,lt+Qi,"$"].join("|")+")",lt+"?"+Qi+"+"+ea,lt+"+"+ta,au,iu,ua,ou].join("|"),"g");function lu(n){return n.match(uu)||[]}var ha=lu;function cu(n,e,t){return n=Ne(n),e=t?void 0:e,e===void 0?Ki(n)?ha(n):Yi(n):n.match(e)||[]}var ya=cu;var pu="['\u2019]",du=RegExp(pu,"g");function fu(n){return function(e){return Zi(ya(Ji(e).replace(du,"")),n,"")}}var ga=fu;var mu=ga(function(n,e,t){return e=e.toLowerCase(),n+(t?zi(e):e)}),St=mu;p();f();d();function q(n){throw new Error("Unexpected value: "+JSON.stringify(n))}p();f();d();function Nt(n){return Object.keys(n)}p();f();d();p();f();d();p();f();d();var Ct=v.env.FERN_STACK_TRACK?.toLowerCase()??"",ye=Ct!==""&&Ct!=="0"&&Ct!=="false",br=["single","multiline","box"].includes(Ct)?Ct:"single";ye&&(Error.stackTraceLimit=50);var hu=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),yu=new Set(["stacktrace"]);function er({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,...hu],t=[...t,...yu],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
|
|
2
|
+
`).map(E=>{let R=E.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(R&&R.length===5){let[,P,Y,C,j]=R;if(!P||!Y||!C||!j)return;if(x||a.some(D=>P?.includes(D))){x=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:h(Y),position:`${C}:${j}`}}}).filter(E=>E&&!r.some(R=>E.fn.includes(R))&&!(o&&E.path?.startsWith("node:"))&&!(u&&E.path?.endsWith(".js"))&&!t.some(R=>E.path.includes(R))).slice(e,e+n)}var Qt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:h=!0,multiline:x=!1,formatFilename:E=R=>R}={}){I(this,"maxFrames");I(this,"skip");I(this,"filterPaths");I(this,"filterFunctions");I(this,"stopOn");I(this,"filterNode");I(this,"filterJs");I(this,"multiline");I(this,"formatFilename");I(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=h,this.multiline=x,this.formatFilename=E}tag(e){let t=this.tracking.get(e)||new Set;er({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}},wr;function xa({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:h=!1,formatFilename:x=E=>E}={}){ye&&(wr??(wr=new Qt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:h,formatFilename:x})))}function va(n){wr?.tag(n)}function _r(n){return wr?.frames(n)??[]}var $e=class{constructor(){va(this)}};p();f();d();var tr=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},Bt=class extends tr{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();I(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 gu=4;xa({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ft=class{constructor(){I(this,"lineBuffer",[]);I(this,"indentLevel",0);I(this,"hasWrittenAnything",!1);I(this,"lastCharacterIsSemicolon",!1);I(this,"lastCharacterIsNewline",!1);I(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(`
|
|
@@ -12,16 +12,16 @@ ${o}`);this.isAtStartOfLine()&&(u=o+u),r&&(u+=`
|
|
|
12
12
|
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
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 o=1;o<e.length;o++){this.write(t);let u=e[o];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(er({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,br){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 pu}};p();f();d();p();f();d();p();f();d();var Lt=class{constructor(){k(this,"reporter");k(this,"snippet");k(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){k(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(),m=this.createSnippetGenerator(u);try{let x=await m.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(),m=this.createSnippetGenerator(u);try{return await m.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(),m=this.createSnippetGenerator(u);try{let x=m.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})}generateInvocationSync(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,o;for(let u of r){let m=this.context.clone(),x=this.createSnippetGenerator(m);if(x.generateInvocationSnippetSync==null)return;try{let T=x.generateInvocationSnippetSync({endpoint:u,request:e,options:t});if(T==null)return;if(m.errors.empty())return T;this.shouldUpdateInvocationResponse({candidate:T,current:a})&&(a=T)}catch(T){o==null&&(o=T)}}if(a!=null)return a;throw o??new Error(`Failed to generate snippet for endpoint "${e.endpoint.method} ${e.endpoint.path}"`)}shouldUpdateInvocationResponse({candidate:e,current:t}){return t==null?!0:e.snippet.length>t.snippet.length}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(){k(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(){k(this,"errors");k(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={}}){k(this,"config");k(this,"options");k(this,"errors");k(this,"_ir");k(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 m=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:m})}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 m=u.name.wireValue,x=t[m];if(x!==void 0){o.add(m),this.errors.scope(m);try{a.push({name:u.name,typeReference:u.typeReference,value:x})}finally{this.errors.unscope()}}}if(!r){for(let[u,m]of Object.entries(t))if(!(m===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]:m,...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 lt=class extends Ot{constructor({customConfig:t,formatter:r}){super();k(this,"customConfig");k(this,"formatter");k(this,"imports",{});k(this,"defaultImports",{});k(this,"starImportAliases",{});k(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Bt}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(m=>m.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 m of u)m.importFrom?.type==="named"&&m.importFrom.moduleName!==t.importFrom.moduleName&&m.name===t.name&&o.push(m);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,m,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(((m=this.starImportAliasesInverse)[x=t.importFrom.starImportAlias]??(m[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 pt=class extends lt{constructor({customConfig:e,formatter:t}){super({customConfig:e,formatter:t})}async toStringAsync({omitImports:e}={}){let t=this.getContent({omitImports:e});if(this.formatter!=null)try{return this.formatter.format(t)}catch(r){throw new Error(`Failed to format TypeScript file: ${r}
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
`+this.buffer:this.buffer}
|
|
19
|
-
`}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new pt({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new pt({customConfig:e,formatter:t});return this.write(r),r.toString()}toStringWithoutImports({customConfig:e,formatter:t}){let r=new pt({customConfig:e,formatter:t});return this.write(r),{code:r.toString({omitImports:!0}),imports:r.getImports(),hasImports:r.hasImports()}}};p();f();d();p();f();d();var h={};pe(h,{BRAND:()=>ju,DIRTY:()=>De,EMPTY_PATH:()=>hu,INVALID:()=>F,NEVER:()=>wc,OK:()=>ee,ParseStatus:()=>X,Schema:()=>L,ZodAny:()=>Be,ZodArray:()=>Ee,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Dt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>ir,ZodEffects:()=>le,ZodEnum:()=>Xe,ZodError:()=>ae,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>sr,ZodIntersection:()=>Je,ZodIssueCode:()=>I,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>gt,ZodNaN:()=>vt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>ue,ZodParsedType:()=>S,ZodPipeline:()=>Vt,ZodPromise:()=>Oe,ZodReadonly:()=>rt,ZodRecord:()=>ar,ZodSchema:()=>L,ZodSet:()=>xt,ZodString:()=>Fe,ZodSymbol:()=>ht,ZodTransformer:()=>le,ZodTuple:()=>xe,ZodType:()=>L,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>ke,ZodVoid:()=>yt,addIssueToContext:()=>A,any:()=>Zu,array:()=>Yu,bigint:()=>Du,boolean:()=>Aa,coerce:()=>bc,custom:()=>Ia,date:()=>Vu,datetimeRegex:()=>_a,defaultErrorMap:()=>Te,discriminatedUnion:()=>ec,effect:()=>dc,enum:()=>cc,function:()=>sc,getErrorMap:()=>dt,getParsedType:()=>ge,instanceof:()=>Uu,intersection:()=>tc,isAborted:()=>rr,isAsync:()=>ft,isDirty:()=>nr,isValid:()=>Ce,late:()=>Mu,lazy:()=>oc,literal:()=>uc,makeIssue:()=>$t,map:()=>ic,nan:()=>$u,nativeEnum:()=>lc,never:()=>Hu,null:()=>zu,nullable:()=>mc,number:()=>Ea,object:()=>Ku,objectUtil:()=>Tr,oboolean:()=>vc,onumber:()=>xc,optional:()=>fc,ostring:()=>gc,pipeline:()=>yc,preprocess:()=>hc,promise:()=>pc,quotelessJson:()=>du,record:()=>nc,set:()=>ac,setErrorMap:()=>mu,strictObject:()=>Xu,string:()=>ka,symbol:()=>Wu,transformer:()=>dc,tuple:()=>rc,undefined:()=>qu,union:()=>Qu,unknown:()=>Gu,util:()=>U,void:()=>Ju});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(m=>typeof a[a[m]]!="number"),u={};for(let m of o)u[m]=a[m];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 Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var S=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 S.undefined;case"string":return S.string;case"number":return Number.isNaN(n)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(n)?S.array:n===null?S.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?S.promise:typeof Map<"u"&&n instanceof Map?S.map:typeof Set<"u"&&n instanceof Set?S.set:typeof Date<"u"&&n instanceof Date?S.date:S.object;default:return S.unknown}};var I=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"]),du=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),ae=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 m=r,x=0;for(;x<u.path.length;){let T=u.path[x];x===u.path.length-1?(m[T]=m[T]||{_errors:[]},m[T]._errors.push(t(u))):m[T]=m[T]||{_errors:[]},m=m[T],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()}};ae.create=n=>new ae(n);var fu=(n,e)=>{let t;switch(n.code){case I.invalid_type:n.received===S.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case I.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case I.invalid_union:t="Invalid input";break;case I.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case I.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case I.invalid_arguments:t="Invalid function arguments";break;case I.invalid_return_type:t="Invalid function return type";break;case I.invalid_date:t="Invalid date";break;case I.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 I.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 I.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 I.custom:t="Invalid input";break;case I.invalid_intersection_types:t="Intersection results could not be merged";break;case I.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case I.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=fu;var ga=Te;function mu(n){ga=n}function dt(){return ga}p();f();d();var $t=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 m="",x=r.filter(T=>!!T).slice().reverse();for(let T of x)m=T(u,{data:e,defaultError:m}).message;return{...a,path:o,message:m}},hu=[];function A(n,e){let t=dt(),r=$t({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}),rr=n=>n.status==="aborted",nr=n=>n.status==="dirty",Ce=n=>n.status==="valid",ft=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var N;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));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}},xa=(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 ae(n.common.issues);return this._error=t,this._error}}};function O(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,m)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??m.defaultError}:typeof m.data>"u"?{message:x??r??m.defaultError}:u.code!=="invalid_type"?{message:m.defaultError}:{message:x??t??m.defaultError}},description:a}}var L=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(ft(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 xa(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(ft(a)?a:Promise.resolve(a));return xa(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),m=()=>o.addIssue({code:I.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(m(),!1)):u?!0:(m(),!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 le({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 ue.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this)}promise(){return Oe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new le({...O(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...O(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Dt({typeName:B.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...O(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 Vt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},yu=/^c[^\s-]{8,}$/i,gu=/^[0-9a-z]+$/,xu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vu=/^[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,bu=/^[a-z0-9_-]{21}$/i,wu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_u=/^[-+]?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)?)??$/,Tu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Iu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ir,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])$/,Eu=/^(?:(?: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])$/,Au=/^(([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]))$/,Ru=/^(([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])$/,Su=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ba="((\\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])))",Cu=new RegExp(`^${ba}$`);function wa(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 Fu(n){return new RegExp(`^${wa(n)}$`)}function _a(n){let e=`${ba}T${wa(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 Bu(n,e){return!!((e==="v4"||!e)&&ku.test(n)||(e==="v6"||!e)&&Au.test(n))}function Ou(n,e){if(!wu.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 Lu(n,e){return!!((e==="v4"||!e)&&Eu.test(n)||(e==="v6"||!e)&&Ru.test(n))}var Fe=class n extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:S.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),A(a,{code:I.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),A(a,{code:I.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,m=e.data.length<o.value;(u||m)&&(a=this._getOrReturnCtx(e,a),u?A(a,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):m&&A(a,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Tu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"email",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Ir||(Ir=new RegExp(Iu,"u")),Ir.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"emoji",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")vu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"uuid",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")bu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"nanoid",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")yu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")gu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid2",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")xu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ulid",code:I.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),A(a,{validation:"url",code:I.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),A(a,{validation:"regex",code:I.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),A(a,{code:I.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),A(a,{code:I.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),A(a,{code:I.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?_a(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:I.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Cu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:I.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Fu(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:I.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?_u.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"duration",code:I.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Bu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ip",code:I.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?Ou(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"jwt",code:I.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?Lu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cidr",code:I.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Su.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64",code:I.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Nu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64url",code:I.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:I.invalid_string,...N.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.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,...N.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,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.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,...O(n)});function Pu(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 L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.number){let o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:S.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),A(r,{code:I.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),A(r,{code:I.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),A(r,{code:I.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Pu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),A(r,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),A(r,{code:I.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,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.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,...O(n)});var We=class n extends L{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)!==S.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),A(r,{code:I.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),A(r,{code:I.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),A(r,{code:I.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 A(t,{code:I.invalid_type,expected:S.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.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:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.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,...O(n)});var qe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...O(n)});var ze=class n extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return A(o,{code:I.invalid_type,expected:S.date,received:o.parsedType}),F}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return A(o,{code:I.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),A(a,{code:I.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),A(a,{code:I.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:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.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,...O(n)});var ht=class extends L{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.symbol,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodSymbol,...O(n)});var Ze=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...O(n)});var Ge=class extends L{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...O(n)});var Be=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...O(n)});var ke=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};ke.create=n=>new ke({typeName:B.ZodUnknown,...O(n)});var me=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:I.invalid_type,expected:S.never,received:t.parsedType}),F}};me.create=n=>new me({typeName:B.ZodNever,...O(n)});var yt=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.void,received:r.parsedType}),F}return ee(e.data)}};yt.create=n=>new yt({typeName:B.ZodVoid,...O(n)});var Ee=class n extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==S.array)return A(t,{code:I.invalid_type,expected:S.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,m=t.data.length<a.exactLength.value;(u||m)&&(A(t,{code:u?I.too_big:I.too_small,minimum:m?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&&(A(t,{code:I.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&&(A(t,{code:I.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,m)=>a.type._parseAsync(new ce(t,u,t.path,m)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,m)=>a.type._parseSync(new ce(t,u,t.path,m)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}};Ee.create=(n,e)=>new Ee({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...O(e)});function mt(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=ue.create(mt(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ee?new Ee({...n._def,type:mt(n.element)}):n instanceof ue?ue.create(mt(n.unwrap())):n instanceof ve?ve.create(mt(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>mt(e))):n}var se=class n extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let T=this._getOrReturnCtx(e);return A(T,{code:I.invalid_type,expected:S.object,received:T.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),m=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(let T in a.data)u.includes(T)||m.push(T);let x=[];for(let T of u){let R=o[T],P=a.data[T];x.push({key:{status:"valid",value:T},value:R._parse(new ce(a,P,a.path,T)),alwaysSet:T in a.data})}if(this._def.catchall instanceof me){let T=this._def.unknownKeys;if(T==="passthrough")for(let R of m)x.push({key:{status:"valid",value:R},value:{status:"valid",value:a.data[R]}});else if(T==="strict")m.length>0&&(A(a,{code:I.unrecognized_keys,keys:m}),r.dirty());else if(T!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let T=this._def.catchall;for(let R of m){let P=a.data[R];x.push({key:{status:"valid",value:R},value:T._parse(new ce(a,P,a.path,R)),alwaysSet:R in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let T=[];for(let R of x){let P=await R.key,Y=await R.value;T.push({key:P,value:Y,alwaysSet:R.alwaysSet})}return T}).then(T=>X.mergeObjectSync(r,T)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return N.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:N.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 mt(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 ue;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return Ta(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...O(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...O(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...O(e)});var He=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let m of o)if(m.result.status==="valid")return m.result;for(let m of o)if(m.result.status==="dirty")return t.common.issues.push(...m.ctx.common.issues),m.result;let u=o.map(m=>new ae(m.ctx.common.issues));return A(t,{code:I.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 T={...t,common:{...t.common,issues:[]},parent:null},R=x._parseSync({data:t.data,path:t.path,parent:T});if(R.status==="valid")return R;R.status==="dirty"&&!o&&(o={result:R,ctx:T}),T.common.issues.length&&u.push(T.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let m=u.map(x=>new ae(x));return A(t,{code:I.invalid_union,unionErrors:m}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...O(e)});var Ie=n=>n instanceof Ye?Ie(n.schema):n instanceof le?Ie(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?Ie(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof ue?[void 0,...Ie(n.unwrap())]:n instanceof ve?[null,...Ie(n.unwrap())]:n instanceof Dt||n instanceof rt?Ie(n.unwrap()):n instanceof tt?Ie(n._def.innerType):[],ir=class n extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return A(t,{code:I.invalid_type,expected:S.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}):(A(t,{code:I.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=Ie(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 m of u){if(a.has(m))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(m)}`);a.set(m,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...O(r)})}};function kr(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===S.object&&r===S.object){let a=U.objectKeys(e),o=U.objectKeys(n).filter(m=>a.indexOf(m)!==-1),u={...n,...e};for(let m of o){let x=kr(n[m],e[m]);if(!x.valid)return{valid:!1};u[m]=x.data}return{valid:!0,data:u}}else if(t===S.array&&r===S.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],m=e[o],x=kr(u,m);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===S.date&&r===S.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(rr(o)||rr(u))return F;let m=kr(o.value,u.value);return m.valid?((nr(o)||nr(u))&&t.dirty(),{status:t.value,value:m.data}):(A(r,{code:I.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}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:B.ZodIntersection,...O(t)});var xe=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return A(r,{code:I.invalid_type,expected:S.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return A(r,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(A(r,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,m)=>{let x=this._def.items[m]||this._def.rest;return x?x._parse(new ce(r,u,r.path,m)):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,...O(e)})};var ar=class n extends L{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!==S.object)return A(r,{code:I.invalid_type,expected:S.object,received:r.parsedType}),F;let a=[],o=this._def.keyType,u=this._def.valueType;for(let m in r.data)a.push({key:o._parse(new ce(r,m,r.path,m)),value:u._parse(new ce(r,r.data[m],r.path,m)),alwaysSet:m 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 L?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...O(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...O(t)})}},gt=class extends L{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!==S.map)return A(r,{code:I.invalid_type,expected:S.map,received:r.parsedType}),F;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([m,x],T)=>({key:a._parse(new ce(r,m,r.path,[T,"key"])),value:o._parse(new ce(r,x,r.path,[T,"value"]))}));if(r.common.async){let m=new Map;return Promise.resolve().then(async()=>{for(let x of u){let T=await x.key,R=await x.value;if(T.status==="aborted"||R.status==="aborted")return F;(T.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(T.value,R.value)}return{status:t.value,value:m}})}else{let m=new Map;for(let x of u){let T=x.key,R=x.value;if(T.status==="aborted"||R.status==="aborted")return F;(T.status==="dirty"||R.status==="dirty")&&t.dirty(),m.set(T.value,R.value)}return{status:t.value,value:m}}}};gt.create=(n,e,t)=>new gt({valueType:e,keyType:n,typeName:B.ZodMap,...O(t)});var xt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return A(r,{code:I.invalid_type,expected:S.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(A(r,{code:I.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&&(A(r,{code:I.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 T=new Set;for(let R of x){if(R.status==="aborted")return F;R.status==="dirty"&&t.dirty(),T.add(R.value)}return{status:t.value,value:T}}let m=[...r.data.values()].map((x,T)=>o._parse(new ce(r,x,r.path,T)));return r.common.async?Promise.all(m).then(x=>u(x)):u(m)}min(e,t){return new n({...this._def,minSize:{value:e,message:N.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:N.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};xt.create=(n,e)=>new xt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...O(e)});var sr=class n extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return A(t,{code:I.invalid_type,expected:S.function,received:t.parsedType}),F;function r(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),Te].filter(T=>!!T),issueData:{code:I.invalid_arguments,argumentsError:x}})}function a(m,x){return $t({data:m,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),Te].filter(T=>!!T),issueData:{code:I.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Oe){let m=this;return ee(async function(...x){let T=new ae([]),R=await m._def.args.parseAsync(x,o).catch(C=>{throw T.addIssue(r(x,C)),T}),P=await Reflect.apply(u,this,R);return await m._def.returns._def.type.parseAsync(P,o).catch(C=>{throw T.addIssue(a(P,C)),T})})}else{let m=this;return ee(function(...x){let T=m._def.args.safeParse(x,o);if(!T.success)throw new ae([r(x,T.error)]);let R=Reflect.apply(u,this,T.data),P=m._def.returns.safeParse(R,o);if(!P.success)throw new ae([a(R,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(ke.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(ke.create()),returns:t||ke.create(),typeName:B.ZodFunction,...O(r)})}},Ye=class extends L{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})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...O(e)});var Ke=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:I.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,...O(e)});function Ta(n,e){return new Xe({values:n,typeName:B.ZodEnum,...O(e)})}var Xe=class n extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:U.joinValues(r),received:t.parsedType,code:I.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 A(t,{received:t.data,code:I.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=Ta;var Qe=class extends L{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let a=U.objectValues(t);return A(r,{expected:U.joinValues(a),received:r.parsedType,code:I.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 A(r,{received:r.data,code:I.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,...O(e)});var Oe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return A(t,{code:I.invalid_type,expected:S.promise,received:t.parsedType}),F;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Oe.create=(n,e)=>new Oe({type:n,typeName:B.ZodPromise,...O(e)});var le=class extends L{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=>{A(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 m=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:m,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 m=this._def.schema._parseSync({data:u,path:r.path,parent:r});return m.status==="aborted"?F:m.status==="dirty"?De(m.value):t.value==="dirty"?De(m.value):m}}if(a.type==="refinement"){let u=m=>{let x=a.refinement(m,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 m};if(r.common.async===!1){let m=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value),{status:t.value,value:m.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(m=>m.status==="aborted"?F:(m.status==="dirty"&&t.dirty(),u(m.value).then(()=>({status:t.value,value:m.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 m=a.transform(u.value,o);if(m instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:m}}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(m=>({status:t.value,value:m})):F);U.assertNever(a)}};le.create=(n,e,t)=>new le({schema:n,typeName:B.ZodEffects,effect:e,...O(t)});le.createWithPreprocess=(n,e,t)=>new le({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...O(t)});var ue=class extends L{_parse(e){return this._getType(e)===S.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ue.create=(n,e)=>new ue({innerType:n,typeName:B.ZodOptional,...O(e)});var ve=class extends L{_parse(e){return this._getType(e)===S.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...O(e)});var et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.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,...O(e)});var tt=class extends L{_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 ft(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ae(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ae(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,...O(e)});var vt=class extends L{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return A(r,{code:I.invalid_type,expected:S.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};vt.create=n=>new vt({typeName:B.ZodNaN,...O(n)});var ju=Symbol("zod_brand"),Dt=class extends L{_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}},Vt=class n extends L{_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 L{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return ft(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...O(e)});function va(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ia(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let m=va(e,r),x=m.fatal??t??!0;a.addIssue({code:"custom",...m,fatal:x})}});if(!o){let u=va(e,r),m=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:m})}}):Be.create()}var Mu={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 Uu=(n,e={message:`Input not instance of ${n.name}`})=>Ia(t=>t instanceof n,e),ka=Fe.create,Ea=Ve.create,$u=vt.create,Du=We.create,Aa=qe.create,Vu=ze.create,Wu=ht.create,qu=Ze.create,zu=Ge.create,Zu=Be.create,Gu=ke.create,Hu=me.create,Ju=yt.create,Yu=Ee.create,Ku=se.create,Xu=se.strictCreate,Qu=He.create,ec=ir.create,tc=Je.create,rc=xe.create,nc=ar.create,ic=gt.create,ac=xt.create,sc=sr.create,oc=Ye.create,uc=Ke.create,cc=Xe.create,lc=Qe.create,pc=Oe.create,dc=le.create,fc=ue.create,mc=ve.create,hc=le.createWithPreprocess,yc=Vt.create,gc=()=>ka().optional(),xc=()=>Ea().optional(),vc=()=>Aa().optional(),bc={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 wc=F;p();f();d();var Ra=h.strictObject({title:h.string(),content:h.string()});var _c=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Sa=h.string().refine(n=>_c.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Na=h.strictObject({namespace:h.optional(Sa),client:h.optional(h.string()),error:h.optional(h.string()),timeoutError:h.optional(h.string()),environment:h.optional(h.string()),environmentUrls:h.optional(h.string()),version:h.optional(h.string())}),Ca=h.union([Sa,Na]),Tc=h.strictObject({neverThrowErrors:h.optional(h.boolean()),outputEsm:h.optional(h.boolean()),outputSourceFiles:h.optional(h.boolean()),outputSrcOnly:h.optional(h.boolean()),includeCredentialsOnCrossOriginRequests:h.optional(h.boolean()),bundle:h.optional(h.boolean()),allowCustomFetcher:h.optional(h.boolean()),generateWebSocketClients:h.optional(h.boolean()),defaultTimeout:h.optional(h.union([h.literal("infinity"),h.number()])),skipResponseValidation:h.optional(h.boolean()),extraDependencies:h.optional(h.record(h.string())),extraDevDependencies:h.optional(h.record(h.string())),extraPeerDependencies:h.optional(h.record(h.string())),extraPeerDependenciesMeta:h.optional(h.record(h.any())),treatUnknownAsAny:h.optional(h.boolean()),noOptionalProperties:h.optional(h.boolean()),tolerateRepublish:h.optional(h.boolean()),packageJson:h.optional(h.record(h.any())),publishToJsr:h.optional(h.boolean()),omitUndefined:h.optional(h.boolean()),useLegacyExports:h.optional(h.boolean()),streamType:h.optional(h.enum(["wrapper","web"])),fileResponseType:h.optional(h.enum(["stream","binary-response"])),formDataSupport:h.optional(h.enum(["Node16","Node18"])),fetchSupport:h.optional(h.enum(["node-fetch","native"])),packagePath:h.optional(h.string()),omitFernHeaders:h.optional(h.boolean()),includePlatformHeaders:h.optional(h.boolean()),allowUserAgentAppInfo:h.optional(h.boolean()),useDefaultRequestParameterValues:h.optional(h.boolean()),packageManager:h.optional(h.enum(["pnpm","yarn"])),flattenRequestParameters:h.optional(h.boolean()),exportAllRequestsAtRoot:h.optional(h.boolean()),customReadmeSections:h.optional(h.array(Ra)),testFramework:h.optional(h.enum(["jest","vitest"])),consolidateTypeFiles:h.optional(h.boolean()),generateEndpointMetadata:h.optional(h.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:h.boolean().optional(),linter:h.optional(h.enum(["biome","oxlint","none"])),formatter:h.optional(h.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:h.optional(h.boolean()),parameterNaming:h.optional(h.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:h.optional(h.boolean()),allowExtraFields:h.optional(h.boolean()),enableInlineTypes:h.optional(h.boolean()),inlineFileProperties:h.optional(h.boolean()),inlinePathParameters:h.optional(h.boolean()),naming:h.optional(Ca),namespaceExport:h.optional(h.string()),noSerdeLayer:h.optional(h.boolean()),serdeLayer:h.optional(h.boolean()),private:h.optional(h.boolean()),requireDefaultEnvironment:h.optional(h.boolean()),requireBaseUrl:h.optional(h.boolean()),retainOriginalCasing:h.optional(h.boolean()),useBigInt:h.optional(h.boolean()),useBrandedStringAliases:h.optional(h.boolean()),offsetSemantics:h.optional(h.enum(["item-index","page-index"])),customPagerName:h.optional(h.string()),resolveQueryParameterNameConflicts:h.optional(h.boolean()),alwaysSendAuth:h.optional(h.boolean()),"optional-auth":h.optional(h.boolean()),generateReactQueryHooks:h.optional(h.boolean()),includeContentHeadersOnFileDownloadResponse:h.optional(h.boolean()),includeUtilsOnUnionMembers:h.optional(h.boolean()),includeOtherInUnionTypes:h.optional(h.boolean()),writeUnitTests:h.optional(h.boolean()),generateWireTests:h.optional(h.boolean()),noScripts:h.optional(h.boolean()),skipNpmPkgFix:h.optional(h.boolean()),experimentalGenerateReadWriteOnlyTypes:h.optional(h.boolean()),defaultTimeoutInSeconds:h.optional(h.union([h.literal("infinity"),h.number()])),timeoutInSeconds:h.optional(h.union([h.literal("infinity"),h.number()])),includeApiReference:h.optional(h.boolean()),shouldGenerateWebsocketClients:h.optional(h.boolean()),_fernLicenseName:h.optional(h.string()),maxRetries:h.optional(h.number().int().min(0)),retryStatusCodes:h.optional(h.enum(["legacy","recommended"]))});function Wt(n){return n?.serdeLayer!=null?!n.serdeLayer:!!n?.noSerdeLayer}var E={};pe(E,{AstNode:()=>W,ClassInstantiation:()=>bt,CodeBlock:()=>wt,Comment:()=>Le,Function:()=>_t,FunctionInvocation:()=>Tt,MethodInvocation:()=>It,Parameter:()=>kt,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>Ae,Types:()=>nt,Variable:()=>Et,Writer:()=>lt,codeblock:()=>Rc,function_:()=>Sc,instantiateClass:()=>Nc,invokeFunction:()=>Cc,invokeMethod:()=>Fc,parameter:()=>Bc,reference:()=>Oc,variable:()=>Lc});p();f();d();p();f();d();p();f();d();var bt=class extends W{constructor({class_:t,arguments_:r}){super();k(this,"class_");k(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();k(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();k(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();
|
|
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(er({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,br){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 gu}};p();f();d();p();f();d();p();f();d();var Ot=class{constructor(){I(this,"reporter");I(this,"snippet");I(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 Lt=class{constructor(e){I(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 Ot;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 Ot;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 Pt=class{constructor(){I(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"},jt=class n{constructor(){I(this,"errors");I(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 Mt=class{constructor({ir:e,config:t,options:r={}}){I(this,"config");I(this,"options");I(this,"errors");I(this,"_ir");I(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new jt,this.httpEndpointReferenceParser=new Pt}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(Nt(r.urls));for(let o of Nt(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: [${Nt(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 Ft{constructor({customConfig:t,formatter:r}){super();I(this,"customConfig");I(this,"formatter");I(this,"imports",{});I(this,"defaultImports",{});I(this,"starImportAliases",{});I(this,"starImportAliasesInverse",{});this.customConfig=t,this.formatter=r??new Bt}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 Ut=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
|
+
${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
|
+
${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],o="",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))o+=`${E.name}, `;let x=u[u.length-1];x!=null&&(o+=`${x.name}`),a!=null&&(e+=","),e+=` { ${o} }`}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 Ut({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new Ut({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var m={};ae(m,{BRAND:()=>Wu,DIRTY:()=>De,EMPTY_PATH:()=>wu,INVALID:()=>B,NEVER:()=>Al,OK:()=>ee,ParseStatus:()=>X,Schema:()=>L,ZodAny:()=>Fe,ZodArray:()=>ke,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Dt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>ir,ZodEffects:()=>pe,ZodEnum:()=>Xe,ZodError:()=>se,ZodFirstPartyTypeKind:()=>F,ZodFunction:()=>sr,ZodIntersection:()=>Je,ZodIssueCode:()=>T,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>oe,ZodOptional:()=>le,ZodParsedType:()=>S,ZodPipeline:()=>Vt,ZodPromise:()=>Oe,ZodReadonly:()=>rt,ZodRecord:()=>ar,ZodSchema:()=>L,ZodSet:()=>gt,ZodString:()=>Be,ZodSymbol:()=>mt,ZodTransformer:()=>pe,ZodTuple:()=>xe,ZodType:()=>L,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ie,ZodVoid:()=>ht,addIssueToContext:()=>A,any:()=>Xu,array:()=>rl,bigint:()=>Gu,boolean:()=>Na,coerce:()=>kl,custom:()=>Aa,date:()=>Hu,datetimeRegex:()=>Ia,defaultErrorMap:()=>Te,discriminatedUnion:()=>sl,effect:()=>xl,enum:()=>hl,function:()=>dl,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>zu,intersection:()=>ol,isAborted:()=>rr,isAsync:()=>dt,isDirty:()=>nr,isValid:()=>Ce,late:()=>qu,lazy:()=>fl,literal:()=>ml,makeIssue:()=>$t,map:()=>cl,nan:()=>Zu,nativeEnum:()=>yl,never:()=>el,null:()=>Ku,nullable:()=>bl,number:()=>Sa,object:()=>nl,objectUtil:()=>Tr,oboolean:()=>Il,onumber:()=>El,optional:()=>vl,ostring:()=>Tl,pipeline:()=>_l,preprocess:()=>wl,promise:()=>gl,quotelessJson:()=>xu,record:()=>ll,set:()=>pl,setErrorMap:()=>bu,strictObject:()=>il,string:()=>Ra,symbol:()=>Ju,transformer:()=>xl,tuple:()=>ul,undefined:()=>Yu,union:()=>al,unknown:()=>Qu,util:()=>U,void:()=>tl});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 Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var S=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 S.undefined;case"string":return S.string;case"number":return Number.isNaN(n)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(n)?S.array:n===null?S.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?S.promise:typeof Map<"u"&&n instanceof Map?S.map:typeof Set<"u"&&n instanceof Set?S.set:typeof Date<"u"&&n instanceof Date?S.date:S.object;default:return S.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"]),xu=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 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 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 vu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===S.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=vu;var ba=Te;function bu(n){ba=n}function pt(){return ba}p();f();d();var $t=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(E=>!!E).slice().reverse();for(let E of x)h=E(u,{data:e,defaultError:h}).message;return{...a,path:o,message:h}},wu=[];function A(n,e){let t=pt(),r=$t({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 B;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 B;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}}},B=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),rr=n=>n.status==="aborted",nr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var N;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(N||(N={}));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}},wa=(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 O(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 L=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 wa(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 wa(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:F.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 ke.create(this)}promise(){return Oe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new pe({...O(this._def),schema:this,typeName:F.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...O(this._def),innerType:this,defaultValue:t,typeName:F.ZodDefault})}brand(){return new Dt({typeName:F.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...O(this._def),innerType:this,catchValue:t,typeName:F.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_u=/^c[^\s-]{8,}$/i,Tu=/^[0-9a-z]+$/,Eu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iu=/^[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,ku=/^[a-z0-9_-]{21}$/i,Au=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ru=/^[-+]?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)?)??$/,Su=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Er,Cu=/^(?:(?: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])$/,Bu=/^(?:(?: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])$/,Fu=/^(([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]))$/,Ou=/^(([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])$/,Lu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ta="((\\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])))",ju=new RegExp(`^${Ta}$`);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 Mu(n){return new RegExp(`^${Ea(n)}$`)}function Ia(n){let e=`${Ta}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 Uu(n,e){return!!((e==="v4"||!e)&&Cu.test(n)||(e==="v6"||!e)&&Fu.test(n))}function $u(n,e){if(!Au.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 Du(n,e){return!!((e==="v4"||!e)&&Bu.test(n)||(e==="v6"||!e)&&Ou.test(n))}var Be=class n extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.string,received:o.parsedType}),B}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),A(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),A(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?A(a,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):h&&A(a,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Su.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Er||(Er=new RegExp(Nu,"u")),Er.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Iu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")ku.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")_u.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Tu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(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),A(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),A(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),A(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),A(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),A(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),A(a,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?ju.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?Mu(o).test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Ru.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?Uu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?$u(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?Du(e.data,o.version)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Lu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(a,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Pu.test(e.data)||(a=this._getOrReturnCtx(e,a),A(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,...N.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...N.errToObj(e)})}url(e){return this._addCheck({kind:"url",...N.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...N.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...N.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...N.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...N.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...N.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...N.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...N.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...N.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...N.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,...N.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,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.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}};Be.create=n=>new Be({checks:[],typeName:F.ZodString,coerce:n?.coerce??!1,...O(n)});function Vu(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 L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.number){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.number,received:o.parsedType}),B}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),A(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),A(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),A(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Vu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),A(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),A(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,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:N.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:N.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.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:F.ZodNumber,coerce:n?.coerce||!1,...O(n)});var We=class n extends L{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)!==S.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),A(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),A(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),A(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 A(t,{code:T.invalid_type,expected:S.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,N.toString(t))}gt(e,t){return this.setLimit("min",e,!1,N.toString(t))}lte(e,t){return this.setLimit("max",e,!0,N.toString(t))}lt(e,t){return this.setLimit("max",e,!1,N.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:N.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:N.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:N.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:F.ZodBigInt,coerce:n?.coerce??!1,...O(n)});var qe=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.boolean,received:r.parsedType}),B}return ee(e.data)}};qe.create=n=>new qe({typeName:F.ZodBoolean,coerce:n?.coerce||!1,...O(n)});var ze=class n extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_type,expected:S.date,received:o.parsedType}),B}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return A(o,{code:T.invalid_date}),B}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),A(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),A(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:N.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:N.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:F.ZodDate,...O(n)});var mt=class extends L{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.symbol,received:r.parsedType}),B}return ee(e.data)}};mt.create=n=>new mt({typeName:F.ZodSymbol,...O(n)});var Ze=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.undefined,received:r.parsedType}),B}return ee(e.data)}};Ze.create=n=>new Ze({typeName:F.ZodUndefined,...O(n)});var Ge=class extends L{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.null,received:r.parsedType}),B}return ee(e.data)}};Ge.create=n=>new Ge({typeName:F.ZodNull,...O(n)});var Fe=class extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Fe.create=n=>new Fe({typeName:F.ZodAny,...O(n)});var Ie=class extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ie.create=n=>new Ie({typeName:F.ZodUnknown,...O(n)});var me=class extends L{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),B}};me.create=n=>new me({typeName:F.ZodNever,...O(n)});var ht=class extends L{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.void,received:r.parsedType}),B}return ee(e.data)}};ht.create=n=>new ht({typeName:F.ZodVoid,...O(n)});var ke=class n extends L{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==S.array)return A(t,{code:T.invalid_type,expected:S.array,received:t.parsedType}),B;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,h=t.data.length<a.exactLength.value;(u||h)&&(A(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&&(A(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&&(A(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:N.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:N.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:N.toString(t)}})}nonempty(e){return this.min(1,e)}};ke.create=(n,e)=>new ke({type:n,minLength:null,maxLength:null,exactLength:null,typeName:F.ZodArray,...O(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 ke?new ke({...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 L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let E=this._getOrReturnCtx(e);return A(E,{code:T.invalid_type,expected:S.object,received:E.parsedType}),B}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 E in a.data)u.includes(E)||h.push(E);let x=[];for(let E of u){let R=o[E],P=a.data[E];x.push({key:{status:"valid",value:E},value:R._parse(new ce(a,P,a.path,E)),alwaysSet:E in a.data})}if(this._def.catchall instanceof me){let E=this._def.unknownKeys;if(E==="passthrough")for(let R of h)x.push({key:{status:"valid",value:R},value:{status:"valid",value:a.data[R]}});else if(E==="strict")h.length>0&&(A(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 R of h){let P=a.data[R];x.push({key:{status:"valid",value:R},value:E._parse(new ce(a,P,a.path,R)),alwaysSet:R in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let E=[];for(let R of x){let P=await R.key,Y=await R.value;E.push({key:P,value:Y,alwaysSet:R.alwaysSet})}return E}).then(E=>X.mergeObjectSync(r,E)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return N.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:N.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:F.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:F.ZodObject,...O(e)});oe.strictCreate=(n,e)=>new oe({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:F.ZodObject,...O(e)});oe.lazycreate=(n,e)=>new oe({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:F.ZodObject,...O(e)});var He=class extends L{_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 A(t,{code:T.invalid_union,unionErrors:u}),B}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 E={...t,common:{...t.common,issues:[]},parent:null},R=x._parseSync({data:t.data,path:t.path,parent:E});if(R.status==="valid")return R;R.status==="dirty"&&!o&&(o={result:R,ctx:E}),E.common.issues.length&&u.push(E.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let h=u.map(x=>new se(x));return A(t,{code:T.invalid_union,unionErrors:h}),B}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:F.ZodUnion,...O(e)});var Ee=n=>n instanceof Ye?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 Dt||n instanceof rt?Ee(n.unwrap()):n instanceof tt?Ee(n._def.innerType):[],ir=class n extends L{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return A(t,{code:T.invalid_type,expected:S.object,received:t.parsedType}),B;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}):(A(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),B)}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=Ee(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:F.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...O(r)})}};function Ir(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===S.object&&r===S.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=Ir(n[h],e[h]);if(!x.valid)return{valid:!1};u[h]=x.data}return{valid:!0,data:u}}else if(t===S.array&&r===S.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=Ir(u,h);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===S.date&&r===S.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(rr(o)||rr(u))return B;let h=Ir(o.value,u.value);return h.valid?((nr(o)||nr(u))&&t.dirty(),{status:t.value,value:h.data}):(A(r,{code:T.invalid_intersection_types}),B)};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}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:F.ZodIntersection,...O(t)});var xe=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return A(r,{code:T.invalid_type,expected:S.array,received:r.parsedType}),B;if(r.data.length<this._def.items.length)return A(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&r.data.length>this._def.items.length&&(A(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:F.ZodTuple,rest:null,...O(e)})};var ar=class n extends L{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!==S.object)return A(r,{code:T.invalid_type,expected:S.object,received:r.parsedType}),B;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 L?new n({keyType:e,valueType:t,typeName:F.ZodRecord,...O(r)}):new n({keyType:Be.create(),valueType:e,typeName:F.ZodRecord,...O(t)})}},yt=class extends L{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!==S.map)return A(r,{code:T.invalid_type,expected:S.map,received:r.parsedType}),B;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([h,x],E)=>({key:a._parse(new ce(r,h,r.path,[E,"key"])),value:o._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,R=await x.value;if(E.status==="aborted"||R.status==="aborted")return B;(E.status==="dirty"||R.status==="dirty")&&t.dirty(),h.set(E.value,R.value)}return{status:t.value,value:h}})}else{let h=new Map;for(let x of u){let E=x.key,R=x.value;if(E.status==="aborted"||R.status==="aborted")return B;(E.status==="dirty"||R.status==="dirty")&&t.dirty(),h.set(E.value,R.value)}return{status:t.value,value:h}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:F.ZodMap,...O(t)});var gt=class n extends L{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return A(r,{code:T.invalid_type,expected:S.set,received:r.parsedType}),B;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(A(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&&(A(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 E=new Set;for(let R of x){if(R.status==="aborted")return B;R.status==="dirty"&&t.dirty(),E.add(R.value)}return{status:t.value,value:E}}let h=[...r.data.values()].map((x,E)=>o._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:N.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:N.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:F.ZodSet,...O(e)});var sr=class n extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return A(t,{code:T.invalid_type,expected:S.function,received:t.parsedType}),B;function r(h,x){return $t({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 $t({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 o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Oe){let h=this;return ee(async function(...x){let E=new se([]),R=await h._def.args.parseAsync(x,o).catch(C=>{throw E.addIssue(r(x,C)),E}),P=await Reflect.apply(u,this,R);return await h._def.returns._def.type.parseAsync(P,o).catch(C=>{throw E.addIssue(a(P,C)),E})})}else{let h=this;return ee(function(...x){let E=h._def.args.safeParse(x,o);if(!E.success)throw new se([r(x,E.error)]);let R=Reflect.apply(u,this,E.data),P=h._def.returns.safeParse(R,o);if(!P.success)throw new se([a(R,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ie.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(Ie.create()),returns:t||Ie.create(),typeName:F.ZodFunction,...O(r)})}},Ye=class extends L{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})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:F.ZodLazy,...O(e)});var Ke=class extends L{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:F.ZodLiteral,...O(e)});function ka(n,e){return new Xe({values:n,typeName:F.ZodEnum,...O(e)})}var Xe=class n extends L{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),B}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 A(t,{received:t.data,code:T.invalid_enum_value,options:r}),B}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 L{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let a=U.objectValues(t);return A(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),B}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return A(r,{received:r.data,code:T.invalid_enum_value,options:a}),B}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:F.ZodNativeEnum,...O(e)});var Oe=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return A(t,{code:T.invalid_type,expected:S.promise,received:t.parsedType}),B;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Oe.create=(n,e)=>new Oe({type:n,typeName:F.ZodPromise,...O(e)});var pe=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===F.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=>{A(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 B;let x=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return x.status==="aborted"?B:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return B;let h=this._def.schema._parseSync({data:u,path:r.path,parent:r});return h.status==="aborted"?B: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"?B:(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"?B:(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 B;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})):B);U.assertNever(a)}};pe.create=(n,e,t)=>new pe({schema:n,typeName:F.ZodEffects,effect:e,...O(t)});pe.createWithPreprocess=(n,e,t)=>new pe({schema:e,effect:{type:"preprocess",transform:n},typeName:F.ZodEffects,...O(t)});var le=class extends L{_parse(e){return this._getType(e)===S.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(n,e)=>new le({innerType:n,typeName:F.ZodOptional,...O(e)});var ve=class extends L{_parse(e){return this._getType(e)===S.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:F.ZodNullable,...O(e)});var et=class extends L{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===S.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:F.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...O(e)});var tt=class extends L{_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:F.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...O(e)});var xt=class extends L{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return A(r,{code:T.invalid_type,expected:S.nan,received:r.parsedType}),B}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:F.ZodNaN,...O(n)});var Wu=Symbol("zod_brand"),Dt=class extends L{_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}},Vt=class n extends L{_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"?B: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"?B: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:F.ZodPipeline})}},rt=class extends L{_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:F.ZodReadonly,...O(e)});function _a(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Aa(n,e={},t){return n?Fe.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let h=_a(e,r),x=h.fatal??t??!0;a.addIssue({code:"custom",...h,fatal:x})}});if(!o){let u=_a(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}}):Fe.create()}var qu={object:oe.lazycreate},F;(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"})(F||(F={}));var zu=(n,e={message:`Input not instance of ${n.name}`})=>Aa(t=>t instanceof n,e),Ra=Be.create,Sa=Ve.create,Zu=xt.create,Gu=We.create,Na=qe.create,Hu=ze.create,Ju=mt.create,Yu=Ze.create,Ku=Ge.create,Xu=Fe.create,Qu=Ie.create,el=me.create,tl=ht.create,rl=ke.create,nl=oe.create,il=oe.strictCreate,al=He.create,sl=ir.create,ol=Je.create,ul=xe.create,ll=ar.create,cl=yt.create,pl=gt.create,dl=sr.create,fl=Ye.create,ml=Ke.create,hl=Xe.create,yl=Qe.create,gl=Oe.create,xl=pe.create,vl=le.create,bl=ve.create,wl=pe.createWithPreprocess,_l=Vt.create,Tl=()=>Ra().optional(),El=()=>Sa().optional(),Il=()=>Na().optional(),kl={string:(n=>Be.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 Al=B;p();f();d();var Ca=m.strictObject({title:m.string(),content:m.string()});var Rl=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Ba=m.string().refine(n=>Rl.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Fa=m.strictObject({namespace:m.optional(Ba),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())}),Oa=m.union([Ba,Fa]),Sl=m.strictObject({neverThrowErrors:m.optional(m.boolean()),outputEsm: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())),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()),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()),exportAllRequestsAtRoot:m.optional(m.boolean()),customReadmeSections:m.optional(m.array(Ca)),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(Oa),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()),generateReactQueryHooks:m.optional(m.boolean()),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 Wt(n){return n?.serdeLayer!=null?!n.serdeLayer:!!n?.noSerdeLayer}var k={};ae(k,{AstNode:()=>W,ClassInstantiation:()=>vt,CodeBlock:()=>bt,Comment:()=>Le,Function:()=>wt,FunctionInvocation:()=>_t,MethodInvocation:()=>Tt,Parameter:()=>Et,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>Ae,Types:()=>nt,Variable:()=>It,Writer:()=>ct,codeblock:()=>Ol,function_:()=>Ll,instantiateClass:()=>Pl,invokeFunction:()=>jl,invokeMethod:()=>Ml,parameter:()=>Ul,reference:()=>$l,variable:()=>Dl});p();f();d();p();f();d();p();f();d();var vt=class extends W{constructor({class_:t,arguments_:r}){super();I(this,"class_");I(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 bt=class extends W{constructor(t){super();I(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();I(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();I(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 wt=class extends W{constructor({name:t,parameters:r,async:a,body:o,return_:u,docs:h}){super();I(this,"name");I(this,"parameters");I(this,"async");I(this,"body");I(this,"return_");I(this,"docs");this.name=t,this.parameters=r,this.async=a??!1,this.body=o,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 _t=class extends W{constructor({function_:t,arguments_:r}){super();I(this,"function_");I(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 Tt=class extends W{constructor({on:t,method:r,arguments_:a,async:o}){super();I(this,"on");I(this,"method");I(this,"arguments_");I(this,"async");this.on=t,this.method=r,this.arguments_=a,this.async=o}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 Et=class extends W{constructor({name:t,type:r,docs:a}){super();I(this,"name");I(this,"type");I(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();I(this,"name");I(this,"importFrom");I(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 Ae=class n extends W{constructor(t){super();I(this,"internalType");this.internalType=t}write(t){let r=Wt(t.customConfig),a=!!t.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{if(r){t.writeNode(n.string(this.internalType.value));return}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
|
`),o=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=Ec({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=kc({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"&&Fa(a.value)){t.write(a.value);return}r.write(t)}writeObject({writer:t,object:r}){let a=Ic({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})}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)Fa(o)?t.write(`${o}: `):(t.writeNode(n.string(o)),t.write(": ")),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function Fa(n){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n)}function Ic({fields:n}){return n.filter(e=>!Ae.isNop(e.value))}function kc({entries:n}){return n.filter(e=>!Ae.isNop(e.key)&&!Ae.isNop(e.value))}function Ec({values:n}){return n.filter(e=>!Ae.isNop(e))}p();f();d();var Et=class extends W{constructor(t){super();k(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 Rc(n){return new wt(n)}function Sc(n){return new _t(n)}function Nc(n){return new bt(n)}function Cc(n){return new Tt(n)}function Fc(n){return new It(n)}function Bc(n){return new kt(n)}function Oc(n){return new it(n)}function Lc(n){return new Et(n)}p();f();d();p();f();d();function Oa({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:Ba(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:Pc(t.repoUrl),license:Ba(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Pc(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 Ba(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(Nt(n))}${Ue(Nt(e))}`}function Ar({namespaceExport:n,naming:e}){let t=typeof e=="string"?{}:e,r=e!=null?Ue(Nt(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={};pe(zt,{commons:()=>La,dynamic:()=>Cr,generatorExec:()=>Br});p();f();d();p();f();d();var La={};p();f();d();var Cr={};pe(Cr,{ErrorSeverity:()=>Wa,HttpMethod:()=>Da,ObjectPropertyAccess:()=>qa,PrimitiveTypeV1:()=>za,auth:()=>Pa,commons:()=>ja,declaration:()=>Ma,endpoints:()=>Ua,environment:()=>$a,http:()=>Rr,ir:()=>Va,snippets:()=>Sr,types:()=>Nr,variables:()=>Za});p();f();d();p();f();d();var Pa={};p();f();d();var ja={};p();f();d();var Ma={};p();f();d();var Ua={};p();f();d();var $a={};p();f();d();var Rr={};pe(Rr,{HttpMethod:()=>Da});p();f();d();p();f();d();var Da={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var Va={};p();f();d();var Sr={};pe(Sr,{ErrorSeverity:()=>Wa});p();f();d();p();f();d();var Wa={Critical:"CRITICAL",Warning:"WARNING"};var Nr={};pe(Nr,{ObjectPropertyAccess:()=>qa,PrimitiveTypeV1:()=>za});p();f();d();p();f();d();var qa={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var za={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 Za={};p();f();d();var Br={};pe(Br,{LicenseId:()=>Ga,config:()=>Fr});p();f();d();p();f();d();var Fr={};pe(Fr,{LicenseId:()=>Ga});p();f();d();p();f();d();var Ga={Mit:"MIT",Apache2:"Apache-2.0"};var jc="value",or=class{constructor({context:e}){k(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?E.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),E.TypeLiteral.nop());if(e.value===void 0)return E.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?E.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?E.TypeLiteral.nop():E.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?E.TypeLiteral.nop():E.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?E.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}`}),E.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?E.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}`}),E.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}`}),E.TypeLiteral.nop()):E.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?E.TypeLiteral.reference(E.codeblock(o=>{o.writeNode(E.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 E.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:o,convertOpts:r});if(u==null)return E.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return E.TypeLiteral.reference(E.codeblock(x=>{x.writeNode(E.invokeMethod({on:E.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 m={name:this.context.getPropertyName(e.discriminant.name),value:E.TypeLiteral.string(o.discriminantValue.wireValue)};return E.TypeLiteral.object({fields:[m,...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 m=u.asObjectOrThrow();return[...a,...m.fields]}case"singleProperty":try{this.context.errors.scope(t.discriminantValue.wireValue);let o=this.context.getRecord(e.value);return o==null?[...a,{name:jc,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyName(t.discriminantValue.name),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?[E.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.getPropertyName(o.name.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 E.TypeLiteral.object({fields:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.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?E.TypeLiteral.nop():E.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??E.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(E.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 E.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?E.TypeLiteral.nop():E.TypeLiteral.number(o)}case"LONG":case"UINT_64":{let o=this.getValueAsNumber({value:t,as:r});return o==null?E.TypeLiteral.nop():this.context.customConfig?.useBigInt?E.TypeLiteral.bigint(BigInt(o)):E.TypeLiteral.number(o)}case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:t});return o==null?E.TypeLiteral.nop():E.TypeLiteral.number(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:t,as:r});return o==null?E.TypeLiteral.nop():E.TypeLiteral.boolean(o)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let o=this.context.getValueAsString({value:t});return o==null?E.TypeLiteral.nop():E.TypeLiteral.string(o)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let o=this.context.getValueAsString({value:t});return o==null?E.TypeLiteral.nop():E.TypeLiteral.datetime(o)}case"BIG_INTEGER":{let o=this.context.getValueAsString({value:t});return o==null?E.TypeLiteral.nop():this.context.customConfig?.useBigInt?E.TypeLiteral.bigint(BigInt(o)):E.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 ur=class{constructor({context:e}){k(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.getPropertyName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.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.TypeLiteral.nop():E.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null?E.TypeLiteral.nop():E.TypeLiteral.array({values:r.map(a=>E.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?E.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var cr=class n extends Ut{constructor({ir:t,config:r}){super({ir:t,config:r});k(this,"ir");k(this,"customConfig");k(this,"dynamicTypeLiteralMapper");k(this,"filePropertyMapper");k(this,"moduleName");k(this,"namespaceExport");k(this,"resolvedClientName");k(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new or({context:this}),this.filePropertyMapper=new ur({context:this}),this.moduleName=Mc({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||Wt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.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 E.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}formatOriginalPropertyName(t){return t.includes("-")?`"${t}"`:t}};function Mc({config:n,customConfig:e}){return Oa({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var Ha="client",Ja="main",Uc={type:"primitive",value:"STRING"},lr=class{constructor({context:e}){k(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})}generateInvocationSnippetSync({endpoint:e,request:t,options:r}){let a=this.callMethod({endpoint:e,snippet:t,clientVariableName:r?.clientVariableName,await_:!1}),{code:o,imports:u}=a.toStringWithoutImports({customConfig:this.context.customConfig});return{snippet:o.trim().replace(/;$/,""),imports:u,clientName:this.context.getRootClientName(),errors:this.context.errors.empty()?void 0:this.context.errors.toDynamicSnippetErrors()}}buildCodeBlock({endpoint:e,snippet:t}){return E.codeblock(r=>{r.writeNode(E.function_({name:Ja,async:!0,parameters:[],body:E.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t,await_:!0}))})})),r.writeNodeStatement(E.invokeFunction({function_:E.reference({name:Ja}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return E.variable({name:Ha,const:!0,initializer:E.instantiateClass({class_:E.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?E.TypeLiteral.nop():E.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 E.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 E.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?E.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Uc,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[{name:this.context.getPropertyName(e.username),value:E.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:E.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:E.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{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[{name:this.context.getPropertyName(e.clientId),value:E.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:E.TypeLiteral.string(t.clientSecret)}]}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(!E.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t,clientVariableName:r,await_:a}){return E.invokeMethod({on:E.reference({name:r??Ha}),method:this.getMethod({endpoint:e}),async:a,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){let o=this.getBodyRequestArg({body:e.body,value:t.requestBody});E.TypeLiteral.isNop(o)||r.push(o)}return this.context.errors.unscope(),r}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}`}),E.TypeLiteral.nop()):E.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 m=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(...m.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:m})),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(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,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(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,convertOpts:{isForRequest:!0}})}));this.context.errors.unscope(),this.context.errors.scope(fe.RequestBody);let T=e.body!=null?this.getInlinedRequestBodyObjectFields({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),E.TypeLiteral.object({fields:[...r,...u,...x,...T]})}getInlinedRequestBodyObjectFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:e.value,value:t});case"referenced":{let a=this.getReferencedRequestBodyPropertyObjectField({body:e,value:t});return E.TypeLiteral.isNop(a.value)?[]:[a]}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}){return{name:this.context.getPropertyName(e.bodyKey),value: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.getPropertyName(o.name.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.getPropertyName(o.name.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 cr({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})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
24
|
+
`);t.write(o.replaceAll("`","\\`")),t.writeNoIndent(u.replaceAll("`","\\`")),t.write("`")}writeIterable({writer:t,iterable:r}){let a=Bl({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=Cl({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"&&La(a.value)){t.write(a.value);return}r.write(t)}writeObject({writer:t,object:r}){let a=Nl({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})}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)La(o)?t.write(`${o}: `):(t.writeNode(n.string(o)),t.write(": ")),t.writeNode(n.unknown(u)),t.writeLine(",");t.dedent(),t.write("}")}};function La(n){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n)}function Nl({fields:n}){return n.filter(e=>!Ae.isNop(e.value))}function Cl({entries:n}){return n.filter(e=>!Ae.isNop(e.key)&&!Ae.isNop(e.value))}function Bl({values:n}){return n.filter(e=>!Ae.isNop(e))}p();f();d();var It=class extends W{constructor(t){super();I(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 Ol(n){return new bt(n)}function Ll(n){return new wt(n)}function Pl(n){return new vt(n)}function jl(n){return new _t(n)}function Ml(n){return new Tt(n)}function Ul(n){return new Et(n)}function $l(n){return new it(n)}function Dl(n){return new It(n)}p();f();d();p();f();d();function ja({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:Pa(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:Vl(t.repoUrl),license:Pa(n.license)};default:throw new Error(`Encountered unknown output mode: ${t}`)}}function Vl(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 Pa(n){return n?._visit({basic:e=>e.id,custom:e=>`See ${e.filename}`,_other:()=>{}})}p();f();d();function kr({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:()=>Ma,GlobalParameterApplyMode:()=>Ka,GlobalParameterLocation:()=>Xa,PrimitiveTypeV1:()=>Qa,commons:()=>Rr,dynamic:()=>Br,generatorExec:()=>Or,globalParameters:()=>Lr,types:()=>Pr});p();f();d();p();f();d();var Rr={};ae(Rr,{AvailabilityStatus:()=>Ma});p();f();d();p();f();d();var Ma={InDevelopment:"IN_DEVELOPMENT",PreRelease:"PRE_RELEASE",GeneralAvailability:"GENERAL_AVAILABILITY",Deprecated:"DEPRECATED",Alpha:"ALPHA",Beta:"BETA",Preview:"PREVIEW",Legacy:"LEGACY"};var Br={};ae(Br,{ErrorSeverity:()=>Za,HttpMethod:()=>qa,ObjectPropertyAccess:()=>Ga,PrimitiveTypeV1:()=>Ha,auth:()=>Ua,commons:()=>$a,declaration:()=>Da,endpoints:()=>Va,environment:()=>Wa,http:()=>Sr,ir:()=>za,snippets:()=>Nr,types:()=>Cr,variables:()=>Ja});p();f();d();p();f();d();var Ua={};p();f();d();var $a={};p();f();d();var Da={};p();f();d();var Va={};p();f();d();var Wa={};p();f();d();var Sr={};ae(Sr,{HttpMethod:()=>qa});p();f();d();p();f();d();var qa={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD"};var za={};p();f();d();var Nr={};ae(Nr,{ErrorSeverity:()=>Za});p();f();d();p();f();d();var Za={Critical:"CRITICAL",Warning:"WARNING"};var Cr={};ae(Cr,{ObjectPropertyAccess:()=>Ga,PrimitiveTypeV1:()=>Ha});p();f();d();p();f();d();var Ga={ReadOnly:"READ_ONLY",WriteOnly:"WRITE_ONLY"};p();f();d();var Ha={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:()=>Ya,config:()=>Fr});p();f();d();p();f();d();var Fr={};ae(Fr,{LicenseId:()=>Ya});p();f();d();p();f();d();var Ya={Mit:"MIT",Apache2:"Apache-2.0"};var Lr={};ae(Lr,{GlobalParameterApplyMode:()=>Ka,GlobalParameterLocation:()=>Xa});p();f();d();p();f();d();var Ka={Explicit:"explicit",Auto:"auto"};p();f();d();var Xa={Header:"header",Query:"query",Body:"body",Path:"path"};var Pr={};ae(Pr,{PrimitiveTypeV1:()=>Qa});p();f();d();p();f();d();var Qa={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 Wl="value",or=class{constructor({context:e}){I(this,"context");this.context=e}convert(e){let t=e.convertOpts;if(e.value===null)return this.context.isNullable(e.typeReference)?k.TypeLiteral.null():(this.context.errors.add({severity:$.Critical,message:"Expected non-null value, but got null"}),k.TypeLiteral.nop());if(e.value===void 0)return k.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?k.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?k.TypeLiteral.nop():k.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?k.TypeLiteral.nop():k.TypeLiteral.string(r)}default:q(e)}}convertList({list:e,value:t,convertOpts:r}){return Array.isArray(t)?k.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}`}),k.TypeLiteral.nop())}convertSet({set:e,value:t,convertOpts:r}){return Array.isArray(t)?k.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}`}),k.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}`}),k.TypeLiteral.nop()):k.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?k.TypeLiteral.reference(k.codeblock(o=>{o.writeNode(k.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 k.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType,u=this.convertDiscriminatedUnionProperties({discriminatedUnionTypeInstance:a,unionVariant:o,convertOpts:r});if(u==null)return k.TypeLiteral.nop();if(this.context.customConfig?.includeUtilsOnUnionMembers)return k.TypeLiteral.reference(k.codeblock(x=>{x.writeNode(k.invokeMethod({on:k.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.getPropertyName(e.discriminant.name),value:k.TypeLiteral.string(o.discriminantValue.wireValue)};return k.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:Wl,value:this.convert({typeReference:t.typeReference,value:e.value,convertOpts:r})}]:[...a,{name:this.context.getPropertyName(t.discriminantValue.name),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?[k.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.getPropertyName(o.name.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 k.TypeLiteral.object({fields:a.map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getPropertyName(o.name.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?k.TypeLiteral.nop():k.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??k.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(k.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 k.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?k.TypeLiteral.nop():k.TypeLiteral.number(o)}case"LONG":case"UINT_64":{let o=this.getValueAsNumber({value:t,as:r});return o==null?k.TypeLiteral.nop():this.context.customConfig?.useBigInt?k.TypeLiteral.bigint(BigInt(o)):k.TypeLiteral.number(o)}case"FLOAT":case"DOUBLE":{let o=this.getValueAsNumber({value:t});return o==null?k.TypeLiteral.nop():k.TypeLiteral.number(o)}case"BOOLEAN":{let o=this.getValueAsBoolean({value:t,as:r});return o==null?k.TypeLiteral.nop():k.TypeLiteral.boolean(o)}case"BASE_64":case"DATE":case"UUID":case"STRING":{let o=this.context.getValueAsString({value:t});return o==null?k.TypeLiteral.nop():k.TypeLiteral.string(o)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let o=this.context.getValueAsString({value:t});return o==null?k.TypeLiteral.nop():k.TypeLiteral.datetime(o)}case"BIG_INTEGER":{let o=this.context.getValueAsString({value:t});return o==null?k.TypeLiteral.nop():this.context.customConfig?.useBigInt?k.TypeLiteral.bigint(BigInt(o)):k.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 ur=class{constructor({context:e}){I(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.getPropertyName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getPropertyName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getPropertyName(o.name.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?k.TypeLiteral.nop():k.TypeLiteral.blob(r)}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});return r==null?k.TypeLiteral.nop():k.TypeLiteral.array({values:r.map(a=>k.TypeLiteral.blob(a))})}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?k.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var lr=class n extends Mt{constructor({ir:t,config:r}){super({ir:t,config:r});I(this,"ir");I(this,"customConfig");I(this,"dynamicTypeLiteralMapper");I(this,"filePropertyMapper");I(this,"moduleName");I(this,"namespaceExport");I(this,"resolvedClientName");I(this,"resolvedEnvironmentName");this.ir=t,this.customConfig=r.customConfig!=null?r.customConfig:void 0,this.dynamicTypeLiteralMapper=new or({context:this}),this.filePropertyMapper=new ur({context:this}),this.moduleName=ql({config:r,customConfig:this.customConfig}),this.namespaceExport=kr({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||Wt(this.customConfig)?this.formatOriginalPropertyName(t.originalName):t.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 k.reference({name:this.resolvedEnvironmentName,importFrom:this.getModuleImport(),memberName:this.getTypeName(t)})}formatOriginalPropertyName(t){return t.includes("-")?`"${t}"`:t}};function ql({config:n,customConfig:e}){return ja({generatorConfig:n,isPackagePrivate:e?.private??!1})?.packageName??n.organization}p();f();d();var es="client",ts="main",zl={type:"primitive",value:"STRING"},cr=class{constructor({context:e}){I(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 k.codeblock(r=>{r.writeNode(k.function_({name:ts,async:!0,parameters:[],body:k.codeblock(a=>{a.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),a.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})})),r.writeNodeStatement(k.invokeFunction({function_:k.reference({name:ts}),arguments_:[]}))})}constructClient({endpoint:e,snippet:t}){return k.variable({name:es,const:!0,initializer:k.instantiateClass({class_:k.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?k.TypeLiteral.nop():k.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 k.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 k.TypeLiteral.reference(r)}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?k.TypeLiteral.object({fields:Object.entries(t).map(([r,a])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:zl,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[{name:this.context.getPropertyName(e.username),value:k.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),value:k.TypeLiteral.string(t.password)}]}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),value:k.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{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[{name:this.context.getPropertyName(e.clientId),value:k.TypeLiteral.string(t.clientId)},{name:this.context.getPropertyName(e.clientSecret),value:k.TypeLiteral.string(t.clientSecret)}]}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(!k.TypeLiteral.isNop(r))return{name:this.context.getPropertyName(e.name.name),value:r}}callMethod({endpoint:e,snippet:t}){return k.invokeMethod({on:k.reference({name:es}),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});k.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}`}),k.TypeLiteral.nop()):k.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(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,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(R=>({name:this.context.getPropertyName(R.name.name),value:this.context.dynamicTypeLiteralMapper.convert({...R,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}):[];return this.context.errors.unscope(),k.TypeLiteral.object({fields:[...r,...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=this.getReferencedRequestBodyPropertyObjectField({body:e,value:t});return k.TypeLiteral.isNop(a.value)?[]:[a]}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}){return{name:this.context.getPropertyName(e.bodyKey),value: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.getPropertyName(o.name.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.getPropertyName(o.name.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 Lt{constructor({ir:e,config:t}){super(new lr({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 cr({context:e})}};0&&(module.exports={DynamicSnippetsGenerator});
|
|
25
25
|
/*! Bundled license information:
|
|
26
26
|
|
|
27
27
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|